You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bu...@apache.org on 2011/12/19 23:58:08 UTC
svn commit: r800542 [20/23] - in
/websites/staging/trafficserver/trunk/content/docs/v2: ./ admin/
admin/images/ sdk/ sdk/css/ sdk/images/ sdk/images/docbook/ sdk/js/
Added: websites/staging/trafficserver/trunk/content/docs/v2/sdk/RemapAPI_Example.html
==============================================================================
--- websites/staging/trafficserver/trunk/content/docs/v2/sdk/RemapAPI_Example.html (added)
+++ websites/staging/trafficserver/trunk/content/docs/v2/sdk/RemapAPI_Example.html Mon Dec 19 22:58:01 2011
@@ -0,0 +1,134 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Remap Plugin Example</title>
+<!--#include file="top.html" -->
+<div class="navheader">
+<div class="navprev">
+<a accesskey="p" href="ch03.html">Prev</a> - Chapter 3. Remap Plugin: Getting Started</div>
+<div class="navnext">Remap Plugin Function Reference <a accesskey="n" href="ch03s02.html">Next</a>
+</div>
+</div>
+<div id="toc"></div>
+<div class="section" lang="en">
+<div>
+ <h2 class="title">
+<a name="ExampleQueryRemap">Example: Query Remap Plugin</a></h2>
+</div>
+
+<p>The sample remap plugin, <code class="filename">query_remap.c</code>, maps client requests to a number of servers based on a hash of the request's URL query parameter. This can be useful for spreading load for a given type of request among backend servers, while still maintaining "stickiness" to a single server for similar requests. For example, a search engine may want to send repeated queries for the same keywords to a server that has likely cached the result from a prior query.</p>
+
+<h3 class="title">Configuration of query_remap</h3>
+<p>The query remap plugin will allow the query parameter name to be specified, along with the hostnames of the servers to hash across. Sample <code class="filename">remap.config</code> rules using <code class="code">query_remap</code> will look like: <p>
+
+<pre class="configline">map http://www.example.com/search http://srch1.example.com/search @plugin=query_remap.so @pparam=q @pparam=srch1.example.com @pparam=srch2.example.com @pparam=srch3.example.com</pre>
+<pre class="configline">map http://www.example.com/profiles http://prof1.example.com/profiles @plugin=query_remap.so @pparam=user_id @pparam=prof1.example.com @pparam=prof2.example.com</pre>
+
+
+<p>The first <code class="code">@pparam</code> specifies the query param key for which the value will be hashed. The remaining parameters list the hostnames of the servers. A request for <code class="code">http://www.example.com/search?q=apache</code> will match the first rule. The plugin will look for the <code class="code"><em class="replaceable">q</em></code> parameter and hash the value '<code class="code">apache</code>' to pick from among <code class="code">srch<em class="replaceable">[1-3]</em>.example.com</code> to send the request.</p>
+
+<p>If the request does not include a <code class="code"><em class="replaceable">q</em></code> query parameter and the plugin decides not to modify the request, the default toURL '<code class="code">http://srch1.example.com/search</code>' will be used by TS.</p>
+
+<p>The parameters are passed to the plugin's <code class="code">tsremap_new_instance</code> function. In <code class="code">query_remap</code>, <code class="code">tsremap_new_instance</code> creates a plugin-defined <code class="code">query_remap_info</code> struct to store its configuration parameters. The ihandle, an opaque pointer that can be used to pass per-instance data, is set to this struct pointer and will be passed to the <code class="code">tsremap_remap</code> function when it is triggered for a request.</p>
+
+<pre class="programlisting">
+typedef struct _query_remap_info {
+ char *param_name;
+ size_t param_len;
+ char **hosts;
+ int num_hosts;
+} query_remap_info;
+
+
+int tsremap_new_instance(int argc,char *argv[],ihandle *ih,char *errbuf,int errbuf_size)
+{
+ int i;
+
+ if (argc < 4) {
+ INKError("Missing parameters for " PLUGIN_NAME);
+ return -1;
+ }
+
+ //initialize the struct to store info about this remap instance
+ // the argv parameters are:
+ // 0: fromURL
+ // 1: toURL
+ // 2: query param to hash
+ // 3,4,... : server hostnames
+ query_remap_info *qri = (query_remap_info*) INKmalloc(sizeof(query_remap_info));
+
+ qri->param_name = strdup(argv[2]);
+ qri->param_len = strlen(qri->param_name);
+ qri->num_hosts = argc - 3;
+ qri->hosts = (char**) INKmalloc(qri->num_hosts*sizeof(char*));
+
+ for (i=0; i < qri->num_hosts; ++i) {
+ qri->hosts[i] = strdup(argv[i+3]);
+ }
+
+ *ih = (ihandle)qri;
+ return 0;
+}
+</pre>
+
+<p>Another way remap plugins may want handle more complex configuration is to specify a configuration filename as a <code class="code">pparam</code> and parse the specified file during instance initialization.</p>
+
+
+<h3 class="title">Performing the Remap</h3>
+<p>The plugin implements the <code class="code">tsremap_remap</code> function, which is called when TS has read the client HTTP request headers and matched the request to a remap rule configured for the plugin. The <code class="code">TSRemapRequestInfo</code> struct contains input and output members for the remap operation. </p>
+
+<p><code class="code">tsremap_remap</code> uses the configuration information passed via the <code class="code">ihandle</code> and checks the <code class="code">request_query</code> for the configured query parameter. If the parameter is found, the plugin sets a <code class="code">new_host</code> to modify the request host:</p>
+
+<pre class="programlisting">
+int tsremap_remap(ihandle ih, rhandle rh, TSRemapRequestInfo *rri)
+{
+ int hostidx = -1;
+ query_remap_info *qri = (query_remap_info*)ih;
+
+ if (!qri) {
+ INKError("NULL ihandle");
+ return 0;
+ }
+
+ if (rri && rri->request_query && rri->request_query_size > 0) {
+ char *q, *s, *key;
+
+ //make a copy of the query, as it is read only
+ q = (char*) INKmalloc(rri->request_query_size+1);
+ strncpy(q, rri->request_query, rri->request_query_size);
+ q[rri->request_query_size] = '\0';
+
+ s = q;
+ //parse query parameters
+ for (key = strsep(&s, "&"); key != NULL; key = strsep(&s, "&")) {
+ char *val = strchr(key, '=');
+ if (val && (size_t)(val-key) == qri->param_len &&
+ !strncmp(key, qri->param_name, qri->param_len)) {
+ ++val;
+ //the param key matched the configured param_name
+ //hash the param value to pick a host
+ hostidx = hash_fnv32(val, strlen(val)) % (u_int32_t)qri->num_hosts;
+ break;
+ }
+ }
+
+ INKfree(q);
+
+ if (hostidx >= 0) {
+ rri->new_host_size = strlen(qri->hosts[hostidx]);
+ if (rri->new_host_size <= TSREMAP_RRI_MAX_HOST_SIZE) {
+ //copy the chosen host into rri
+ memcpy(rri->new_host, qri->hosts[hostidx], rri->new_host_size);
+ return 1; //host has been modified
+ }
+ }
+ }
+
+ //the request was not modified, TS will use the toURL from the remap rule
+ return 0;
+}
+</pre>
+
+</div>
+</body>
+</html>
Propchange: websites/staging/trafficserver/trunk/content/docs/v2/sdk/RemapAPI_Example.html
------------------------------------------------------------------------------
svn:executable = *
Added: websites/staging/trafficserver/trunk/content/docs/v2/sdk/RestartingTS.html
==============================================================================
--- websites/staging/trafficserver/trunk/content/docs/v2/sdk/RestartingTS.html (added)
+++ websites/staging/trafficserver/trunk/content/docs/v2/sdk/RestartingTS.html Mon Dec 19 22:58:01 2011
@@ -0,0 +1,38 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Restart Traffic Server</title>
+<!--#include file="top.html" -->
+<div class="navheader">
+<div class="navprev">
+<a accesskey="p" href="SpecifyingPluginLocation.html">Prev</a> - Specify the Plugin's Location</div>
+<div class="navnext">Plugin Registration and Version Checking - <a accesskey="n" href="PlusingRegisAndVersionCkg.html">Next</a>
+</div>
+</div>
+<div id="toc"></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="RestartingTS"></a>Restart Traffic Server</h3></div></div></div>
+<p>The last step is to start/restart Traffic Server. Shown
+ below is the output displayed after you've created and loaded your
+ <code class="filename">hello-world</code> plugin.</p>
+<pre class="programlisting"># grep proxy.config.plugin.plugin_dir config/records.config
+CONFIG proxy.config.plugin.plugin_dir STRING config/plugins
+# ls config/plugins
+hello-world.so*
+# bin/traffic_server
+[Mar 27 19:06:31.669] NOTE: updated diags config
+[Mar 27 19:06:31.680] NOTE: loading plugin 'config/plugins/hello-world.so'
+hello world
+[Mar 27 19:06:32.046] NOTE: cache disabled (initializing)
+[Mar 27 19:06:32.053] NOTE: cache enabled
+[Mar 27 19:06:32.526] NOTE: Traffic Server running</pre>
+<p><b>Note:</b> in the example above, Traffic Server notes are
+ directed to the console by specifying <code class="code">E</code> for
+ <code class="replaceable">proxy.config.diags.output.note </code> in
+ <code class="filename">records.config</code>. The second note shows Traffic
+ Server attempting to load the <code class="filename">hello-world</code> plugin.
+ The third line of Traffic Server output is from your plugin.</p>
+</div>
+</body>
+</html>
Propchange: websites/staging/trafficserver/trunk/content/docs/v2/sdk/RestartingTS.html
------------------------------------------------------------------------------
svn:executable = *
Added: websites/staging/trafficserver/trunk/content/docs/v2/sdk/RlsMarshalBufHandles.html
==============================================================================
--- websites/staging/trafficserver/trunk/content/docs/v2/sdk/RlsMarshalBufHandles.html (added)
+++ websites/staging/trafficserver/trunk/content/docs/v2/sdk/RlsMarshalBufHandles.html Mon Dec 19 22:58:01 2011
@@ -0,0 +1,67 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Release Marshal Buffer Handles</title>
+<!--#include file="top.html" -->
+<div class="navheader">
+<div class="navprev">
+<a accesskey="p" href="MIMEFldsBelongAssocMIMEHdr.html">Prev</a> - MIME Fields Always Belong to an Associated MIME
+ Header</div>
+<div class="navnext">Deprecated Functions - <a accesskey="n" href="DeprecatedMarshBufFuncs.html">Next</a>
+</div>
+</div>
+<div id="toc"></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="RlsMarshalBufHandles"></a>Release Marshal Buffer Handles</h3></div></div></div>
+<p>When you fetch a component object or create a new object, you
+ get back a handle to the object location. The handle is either an
+ <code class="function">INKMLoc</code> for an object location or <code class="code">char
+ *</code> for a string location. You can manipulate the object through
+ these handles, but when you are finished you need to release the
+ handle to free up system resources.</p>
+<p><a class="indexterm" name="id381185"></a>The general guideline is to release all
+ <code class="function">INKMLoc</code> and string handles you retrieve. The one
+ exception is the string returned by
+ <code class="function">INKUrlStringGet</code>, which must be freed by a call to
+ <code class="function">INKfree</code>.</p>
+<p><a class="indexterm" name="id381213"></a>The handle release functions expect three arguments: the
+ marshal buffer containing the data, the location of the parent object,
+ and the location of the object to be released. The parent location is
+ usually clear from the creation of the <code class="function">INKMLoc</code> or
+ string. For example, if your plugin had the following calls:</p>
+<pre class="programlisting">url_loc = INKHttpHdrUrlGet (bufp, hdr_loc);
+host_string = INKUrlHostGet (bufp, url_loc, &host_length);</pre>
+<p>then your plugin would have to call:</p>
+<pre class="programlisting">INKHandleMLocRelease (bufp, hdr_loc, url_loc);</pre>
+<p>If an <code class="function">INKMLoc</code> is obtained from a
+ transaction, then it does not have a parent <code class="function">INKMLoc</code>.
+ Use the null <code class="function">INKMLoc</code> constant
+ <code class="code">INK_NULL_MLOC</code> as its parent. For example, if your plugin
+ calls:</p>
+<pre class="programlisting">INKHttpTxnClientReqGet (txnp, &bufp, &hdr_loc);</pre>
+<p>then you must release <code class="code">hdr_loc</code> with:</p>
+<pre class="programlisting">INKHandleMLocRelease (bufp, INK_NULL_MLOC, hdr_loc);</pre>
+<p>You need to use <code class="code">INK_NULL_MLOC</code> to release any
+ <code class="function">INKMLoc</code> handles retrieved by the
+ <code class="function">INKHttpTxn*Get</code> functions.</p>
+<p>Here's an example using a new
+ <code class="function">INKMimeHdrField</code> function:</p>
+<pre class="programlisting">INKHttpTxnServerRespGet( txnp, &resp_bufp, &resp_hdr_loc );
+new_field_loc = INKMimeHdrFieldCreate (resp_bufp, resp_hdr_loc);
+INKHandleMLocRelease ( resp_bufp, resp_hdr_loc, new_field_loc);
+INKHandleMLocRelease ( resp_bufp, INK_NULL_MLOC, resp_hdr_loc);</pre>
+<p>See the sample plugins for many more examples.</p>
+<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/docbook/tip.png" /></td>
+<th align="left">Tip</th>
+</tr>
+<tr><td align="left" valign="top"><p>You should release handles before reenabling the HTTP transaction. In
+ other words, call <code class="function">INKHandleMLocRelease</code>
+ before
+ <code class="function">INKHttpTxnReenable</code>. </p></td></tr>
+</table></div>
+</div>
+</body>
+</html>
Propchange: websites/staging/trafficserver/trunk/content/docs/v2/sdk/RlsMarshalBufHandles.html
------------------------------------------------------------------------------
svn:executable = *
Added: websites/staging/trafficserver/trunk/content/docs/v2/sdk/Roadmap_CreatingPlugins.html
==============================================================================
--- websites/staging/trafficserver/trunk/content/docs/v2/sdk/Roadmap_CreatingPlugins.html (added)
+++ websites/staging/trafficserver/trunk/content/docs/v2/sdk/Roadmap_CreatingPlugins.html Mon Dec 19 22:58:01 2011
@@ -0,0 +1,86 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Roadmap for Creating Plugins</title>
+<!--#include file="top.html" -->
+<div class="navheader">
+<div class="navprev">
+<a accesskey="p" href="CreatingTSPlugins.html">Prev</a> - Chapter 2. How to Create Traffic Server Plugins</div>
+<div class="navnext">Chapter 3. Remap Plugin - <a accesskey="n" href="ch03.html">Next</a>
+</div>
+</div>
+<div id="toc"></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title">
+<a name="Roadmap_CreatingPlugins"></a>Roadmap for Creating Plugins</h2></div></div></div>
+<p>This chapter has provided an overview of Traffic Server's HTTP
+ processing, API hooks, and the asynchronous event model. Next, you must understand the capabilities of Traffic Server API
+ functions. These are quite broad:</p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<p><b>HTTP header manipulation functions</b></p>
+<p>Obtain information about and manipulate HTTP headers, URLs,
+ & MIME headers.</p>
+</li>
+<li>
+<p><b>HTTP transaction functions</b></p>
+<p>Get information about and modify HTTP transactions (for
+ example: get the client IP associated to the transaction; get the
+ server IP; get parent proxy information)</p>
+</li>
+<li>
+<p><b>IO functions</b></p>
+<p>Manipulate vconnections (virtual connections, used for network
+ and disk I/O)</p>
+</li>
+<li>
+<p><b>Network connection functions</b></p>
+<p>Open connections to remote servers.</p>
+</li>
+<li>
+<p><b>Statistics functions</b></p>
+<p>Define and compute statistics for your plugin's
+ activity.</p>
+</li>
+<li>
+ <p><b>Traffic Server management functions</b></p>
+ <p>Obtain values for Traffic Server configuration and statistics
+ variables.</p>
+</li>
+</ul></div>
+<p>Below are some guidelines for creating a plugin:</p>
+<div class="orderedlist"><ol type="1">
+<li>
+ <p>Decide what you want your plugin to do, based on the
+ capabilities of the API and Traffic Server. Two main kinds of
+ example plugins provided with this SDK are HTTP-based (includes
+ header-based and response transform plugins), and non-HTTP-based (a
+ protocol plugin). These examples are discussed in the next three
+ chapters.</p></li>
+<li>
+ <p>Determine where your plugin needs to hook on to Traffic
+ Server's HTTP processing (view the <a href="HTTPHooksAndTransactions.html#Fig_HHTTPTxStateDiag" title="Figure 8.1. HTTP Transaction State Diagram">HTTP Transaction State Diagram</a>).</p></li>
+<li>
+ <p>Read <a href="HeaderBasedPluginEx.html" title="Chapter 4. Header-Based Plugin Examples">Header-Based Plugin Examples</a> to learn the
+ basics of writing plugins: creating continuations and setting up
+ hooks. If you want to write a plugin that transforms data, then read
+ <a href="HTTPTransformationPlugins.html" title="Chapter 5. HTTP Transformation Plugins">HTTP Transformation Plugins</a>.</p></li>
+<li>
+ <p>Figure out what parts of the Traffic Server API you need to
+ use and then read about the details of those APIs in this manual's reference
+ chapters.</p></li>
+<li>
+ <p>Compile and load your plugin (see <a href="GetingStarted.html#GettingStarted">Getting Started</a>).</p></li>
+<li><p>Depending on your plugin's functionality, you might start
+ testing it by issuing requests by hand and checking for the desired
+ behavior in Traffic Server log files. See the <span class="emphasis"><em><b>Traffic
+ Server Administrator's Guide</b></em></span> for information about
+ Traffic Server logs.</p></li>
+<li><p>You can test the performance of Traffic Server running with
+ your plugin using SDKTest. You can also customize SDKTest to perform
+ functional testing on your plugin; for more information see the
+ <span class="emphasis"><em><b>Traffic Server SDKTest User's Guide</b></em></span>.</p></li>
+</ol></div>
+</div>
+</body>
+</html>
Propchange: websites/staging/trafficserver/trunk/content/docs/v2/sdk/Roadmap_CreatingPlugins.html
------------------------------------------------------------------------------
svn:executable = *
Added: websites/staging/trafficserver/trunk/content/docs/v2/sdk/SampleBufferedNullTransformPlugin.html
==============================================================================
--- websites/staging/trafficserver/trunk/content/docs/v2/sdk/SampleBufferedNullTransformPlugin.html (added)
+++ websites/staging/trafficserver/trunk/content/docs/v2/sdk/SampleBufferedNullTransformPlugin.html Mon Dec 19 22:58:01 2011
@@ -0,0 +1,189 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>The Sample Buffered Null Transform Plugin</title>
+<!--#include file="top.html" -->
+<div class="navheader">
+<div class="navprev">
+<a accesskey="p" href="AppendTransformPlugin.html">Prev</a> - The Append-Transform Plugin</div>
+<div class="navnext">Chapter 6. New Protocol Plugins - <a accesskey="n" href="NewProtocolPlugins.html">Next</a>
+</div>
+</div>
+<div id="toc"></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title">
+<a name="SampleBufferedNullTransformPlugin"></a>The Sample Buffered Null Transform Plugin</h2></div></div></div>
+<p>The buffered null transform,
+ <code class="filename">bnull-transform.c</code>, reads the response content into
+ a buffer and then writes the full buffer out to the client. Many
+ examples of transformations, such as compression, require you to gather
+ the full response content in order to perform the transformation.</p>
+<p>The buffered null transform uses a state variable to keep track of
+ when it is (a) reading data into the buffer and (b) writing the data
+ from the buffer to the downstream vconnection.</p>
+<p>The following is a step-by-step walk through the buffered null
+ transform:</p>
+<div class="orderedlist"><ol type="1">
+<li>
+<p>Gets a handle to HTTP transactions.</p>
+<pre class="programlisting">void
+ INKPluginInit (int argc, const char *argv[]) {
+ INKHttpHookAdd (INK_HTTP_READ_RESPONSE_HDR_HOOK,
+ INKContCreate (transform_plugin, NULL)); }</pre>
+<p>With this <code class="function">INKPluginInit</code> routine, the
+ plugin is called back every time Traffic Server reads a response
+ header.</p>
+</li>
+<li>
+<p>Checks to see if the transaction response is
+ transformable.</p>
+<pre class="programlisting">static int transform_plugin (INKCont contp, INKEvent event, void *edata) {
+ INKHttpTxn txnp = (INKHttpTxn) edata;
+ switch (event) {
+ case INK_EVENT_HTTP_READ_RESPONSE_HDR:
+ if (transformable (txnp)) {
+ transform_add (txnp);}</pre>
+<p>The default behavior for transformations is to cache the
+ transformed content (if desired, you also can tell Traffic Server to cache
+ untransformed content). Therefore, only responses
+ received directly from an origin server need to be transformed. Objects
+ served from the cache are already transformed. To determine whether
+ the response is from the origin server, the routine transformable
+ checks the response header for the "200 OK" server response.</p>
+<pre class="programlisting">{
+ INKMBuffer bufp;
+ INKMLoc hdr_loc;
+ INKHttpStatus resp_status;
+
+ INKHttpTxnServerRespGet (txnp, &bufp, &hdr_loc);
+
+ if(INK_HTTP_STATUS_OK==
+ (resp_status=INKHttpHdrStatusGet(bufp,hdr_loc)))
+ {
+ return 1;
+ }
+ else {
+ return 0;
+ }
+}</pre>
+</li>
+<li>
+<p>If the response is transformable, then the plugin creates a
+ transformation vconnection that gets called back when the response
+ data is ready to be transformed (as it is streaming from the origin
+ server).</p>
+<pre class="programlisting">static void transform_add (INKHttpTxn txnp)
+{
+ INKVConn connp;
+ connp = INKTransformCreate (bnull_transform, txnp);
+ INKHttpTxnHookAdd (txnp, INK_HTTP_RESPONSE_TRANSFORM_HOOK, connp);
+}</pre>
+<p>The previous code fragment shows that the handler function for
+ the transformation vconnection is
+ <code class="function">bnull_transform</code>.</p>
+</li>
+<li><p>The <code class="function">bnull_transform</code> function has to
+ handle <code class="code">ERROR</code>, <code class="code">WRITE_COMPLETE</code>,
+ <code class="code">WRITE_READY</code>, and <code class="code">IMMEDIATE</code> events. If the
+ transform is just beginning, the event received is probably
+ <code class="code">IMMEDIATE</code>. The <code class="function">bnull_transform</code>
+ function calls <code class="function">handle_transform</code> to handle
+ <code class="code">WRITE_READY</code> and <code class="code">IMMEDIATE</code>.</p></li>
+<li><p>The <code class="function">handle_transform</code> function examines
+ the data parameter for the continuation passed to it (the
+ continuation passed to <code class="function">handle_transform</code> is the
+ transformation vconnection). The data structure keeps track of two
+ states: copying the data into the buffer
+ (<code class="code">STATE_BUFFER_DATA</code>) and writing the contents of the
+ buffer to the output vconnection
+ (<code class="code">STATE_OUTPUT_DATA</code>).</p></li>
+<li>
+<p>Get a handle to the input VIO (see the
+ <code class="function">handle_buffering</code> function).</p>
+<pre class="programlisting">input_vio = INKVConnWriteVIOGet (contp);</pre>
+<p>This is so that the transformation can get information about
+ the upstream vconnection's write operation to the input
+ buffer.</p>
+</li>
+<li>
+<p>Copy data from the input buffer to the output buffer. See the
+ <code class="function">handle_buffering</code> function for the following
+ code fragment:</p>
+<pre class="programlisting">INKIOBufferCopy (data->output_buffer,
+ INKVIOReaderGet (write_vio), towrite, 0);</pre>
+</li>
+<li>
+<p>Tell the input buffer that the transformation has read the
+ data. See the <code class="function">handle_buffering</code> function for the
+ following code fragment:</p>
+<pre class="programlisting">INKIOBufferReaderConsume (INKVIOReaderGet (write_vio), towrite);</pre>
+</li>
+<li>
+<p>Modify the input VIO to tell it how much data has been read
+ (increase the value of <code>ndone</code>). See the <code class="function">handle_buffering</code> function for the following
+ code fragment:</p>
+<pre class="programlisting">INKVIONDoneSet (write_vio, INKVIONDoneGet (write_vio) + towrite); }</pre>
+</li>
+<li>
+<p>If there is more data left to read (<code class="code">if ndone <
+ nbytes</code>), then the <code class="function">handle_buffering</code> function
+ wakes up the upstream vconnection by sending it
+ <code class="code">WRITE_READY</code>:</p>
+<pre class="programlisting">if (INKVIONTodoGet (write_vio) > 0) {
+ if (towrite > 0) {
+ INKContCall (INKVIOContGet (write_vio),
+ INK_EVENT_VCONN_WRITE_READY, write_vio);
+ }
+} else {</pre>
+<p>The process of passing data through the transformation is
+ illustrated in the following diagram. The transformation sends
+ <code class="code">WRITE_READY</code> events when it needs more data; when
+ data is available, the upstream vconnection reenables the
+ transformation with an <code class="code">IMMEDIATE</code> event.</p>
+<div class="figure">
+<a name="Fig_STATE_BUFFER_DATAState"></a><p class="title"><b>Figure 5.4. Reading Data Into the Buffer (the <code>STATE_BUFFER_DATA</code> State)</b></p>
+<div class="mediaobject"><img src="images/vconn_buffer.jpg" alt="Reading Data Into the Buffer (the STATE_BUFFER_DATA State)" /></div>
+</div>
+</li>
+<li>
+<p>When the data is read into the output buffer, the
+ <code class="function">handle_buffering</code> function sets the state of the
+ transformation's data structure to <code class="code">STATE_OUTPUT_DATA</code>
+ and calls the upstream vconnection back with the
+ <code class="code">WRITE_COMPLETE</code> event.</p>
+<pre class="programlisting">data->state = STATE_OUTPUT_DATA;
+INKContCall (INKVIOContGet (write_vio),
+ INK_EVENT_VCONN_WRITE_COMPLETE, write_vio);</pre>
+</li>
+<li>
+ <p>The upstream vconnection will probably shut down the write
+ operation when it receives the <code class="code">WRITE_COMPLETE</code> event.
+ The handler function of the transformation,
+ <code class="function">bnull_transform</code>, receives an
+ <code class="code">IMMEDIATE</code> event and calls the
+ <code class="function">handle_transform</code> function. This time, the state
+ is <code class="code">STATE_OUTPUT_DATA</code>, so
+ <code class="function">handle_transform</code> calls
+ <code class="function">handle_output</code>.</p></li>
+<li>
+<p>The <code class="function">handle_output</code> function gets a handle
+ to the output vconnection:</p>
+<pre class="programlisting">output_conn = INKTransformOutputVConnGet (contp);</pre>
+</li>
+<li>
+<p>The <code>handle_output</code> function writes the buffer to the output
+ vconnection:</p>
+<pre class="programlisting">data->output_vio =
+INKVConnWrite (output_conn, contp, data->output_reader,
+INKIOBufferReaderAvail (data->output_reader) );</pre>
+<p>The following diagram illustrates the write to the output
+ vconnection:</p>
+<div class="figure">
+<a name="Fig_WriteBufferedDataToOutputVcon"></a><p class="title"><b>Figure 5.5. Writing the Buffered Data to the Output Vconnection</b></p>
+<div class="mediaobject"><img src="images/vconn_buf_output.jpg" alt="Writing the Buffered Data to the Output Vconnection" /></div>
+</div>
+</li>
+</ol></div>
+</div>
+</body>
+</html>
Propchange: websites/staging/trafficserver/trunk/content/docs/v2/sdk/SampleBufferedNullTransformPlugin.html
------------------------------------------------------------------------------
svn:executable = *
Added: websites/staging/trafficserver/trunk/content/docs/v2/sdk/SampleNullTransformPlugin.html
==============================================================================
--- websites/staging/trafficserver/trunk/content/docs/v2/sdk/SampleNullTransformPlugin.html (added)
+++ websites/staging/trafficserver/trunk/content/docs/v2/sdk/SampleNullTransformPlugin.html Mon Dec 19 22:58:01 2011
@@ -0,0 +1,185 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>The Sample Null Transform Plugin</title>
+<!--#include file="top.html" -->
+<div class="navheader">
+<div class="navprev">
+<a accesskey="p" href="HTTPTransformationPlugins.html">Prev</a> - Chapter 5. HTTP Transformation Plugins</div>
+<div class="navnext">The Append-Transform Plugin - <a accesskey="n" href="AppendTransformPlugin.html">Next</a>
+</div>
+</div>
+<div id="toc"></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title">
+<a name="SampleNullTransformPlugin"></a>The Sample Null Transform Plugin</h2></div></div></div>
+<p>This section provides a step-by-step description of what the null
+ transform plugin does, along with sections of code that apply. For
+ context, you can find each code snippet in the complete source code.
+ Some of the error checking details are left out - to give the description
+ a step-by-step flow, only the highlights of the transform are
+ included.</p>
+<p>Below is an overview of the null transform plugin:</p>
+<div class="orderedlist"><ol type="1">
+<li>
+<p>Gets a handle to HTTP transactions.</p>
+<pre class="programlisting">void
+ INKPluginInit (int argc, const char *argv[]) {
+ INKHttpHookAdd (INK_HTTP_READ_RESPONSE_HDR_HOOK,
+ INKContCreate (transform_plugin, NULL));</pre>
+<p>With this <code class="code">INKPluginInit</code> routine, the plugin is
+ called back every time Traffic Server reads a response
+ header.</p>
+</li>
+<li>
+<p>Checks to see if the transaction response is
+ transformable.</p>
+<pre class="programlisting">static int transform_plugin (INKCont contp, INKEvent event, void *edata) {
+ INKHttpTxn txnp = (INKHttpTxn) edata;
+ switch (event) {
+ case INK_EVENT_HTTP_READ_RESPONSE_HDR:
+ if (transformable (txnp)) {
+ transform_add (txnp);}</pre>
+<p>The default behavior for transformations is to cache the
+ transformed content (you can also tell Traffic Server to cache
+ untransformed content, if you want). Therefore, only responses
+ received directly from an origin server need to be transformed. Objects
+ served from cache are already transformed. To determine whether
+ the response is from the origin server, the routine
+ <code class="code">transformable</code> checks the response header for the "200
+ OK" server response.</p>
+<pre class="programlisting">static int transformable (INKHttpTxn txnp)
+{
+ INKMBuffer bufp;
+ INKMLoc hdr_loc;
+ INKHttpStatus resp_status;
+ INKHttpTxnServerRespGet (txnp, &bufp, &hdr_loc);
+
+ if (INK_HTTP_STATUS_OK == (resp_status =
+ INKHttpHdrStatusGet (bufp, hdr_loc)) ) {
+ return 1;
+ } else {
+ return 0;
+ }
+}</pre>
+</li>
+<li>
+<p>If the response is transformable, then the plugin creates a
+ transformation vconnection that gets called back when the response
+ data is ready to be transformed (as it is streaming from the origin
+ server).</p>
+<pre class="programlisting">static void transform_add (INKHttpTxn txnp)
+{
+ INKVConn connp;
+ connp = INKTransformCreate (null_transform, txnp);
+ INKHttpTxnHookAdd (txnp, INK_HTTP_RESPONSE_TRANSFORM_HOOK, connp);
+}</pre>
+<p>The previous code fragment shows that the handler function for
+ the transformation vconnection is
+ <code class="code">null_transform</code>.</p>
+</li>
+<li>
+<p>Get a handle to the output vconnection (that receives data
+ from the tranformation).</p>
+<pre class="programlisting">output_conn = INKTransformOutputVConnGet (con</pre>
+</li>
+<li>
+<p>Get a handle to the input VIO. (See the
+ <code class="code">handle_transform</code> function.)</p>
+<pre class="programlisting">input_vio = INKVConnWriteVIOGet (contp);</pre>
+<p>This is so that the transformation can get information about
+ the upstream vconnection's write operation to the input
+ buffer.</p>
+</li>
+<li>
+<p>Initiate a write to the output vconnection of the specified
+ number of bytes. When the write is initiated, the transformation
+ expects to receive <code class="code">WRITE_READY</code>,
+ <code class="code">WRITE_COMPLETE</code>, or <code class="code">ERROR</code> events from the
+ output vconnection.</p>
+<p>See the <code class="code">handle_transform</code> function for the
+ following code fragment:</p>
+<pre class="programlisting">data->output_vio = INKVConnWrite (output_conn, contp,
+ data->output_reader, INKVIONBytesGet (input_vio));</pre>
+</li>
+<li>
+<p>Copy data from the input buffer to the output buffer. See the
+ <code class="code">handle_transform</code> function for the following code
+ fragment:</p>
+<pre class="programlisting">INKIOBufferCopy (INKVIOBufferGet (data->output_vio),
+ INKVIOReaderGet (input_vio), towrite, 0);</pre>
+</li>
+<li>
+<p>Tell the input buffer that the transformation has read the
+ data. See the <code class="code">handle_transform</code> function for the
+ following code fragment:</p>
+<pre class="programlisting">INKIOBufferReaderConsume (INKVIOReaderGet (input_vio), towrite);</pre>
+</li>
+<li>
+<p>Modify the input VIO to tell it how much data has been read
+ (increase the value of <code>ndone</code>). See the <code class="code">handle_transform</code>
+ function for the following code fragment:</p>
+<pre class="programlisting">INKVIONDoneSet (input_vio, INKVIONDoneGet (input_vio) + towrite);</pre>
+</li>
+<li>
+<p>If there is more data left to read (<code class="code">if ndone <
+ nbytes</code>), then the <code class="code">handle_transform</code> function wakes up
+ the downstream vconnection with a reenable and wakes up the upstream
+ vconnection by sending it <code class="code">WRITE_READY</code>:</p>
+<pre class="programlisting">if (INKVIONTodoGet (input_vio) > 0) {
+ if (towrite > 0) {
+ INKVIOReenable (data->output_vio);
+
+ INKContCall (INKVIOContGet (input_vio),
+ INK_EVENT_VCONN_WRITE_READY, input_vio);
+ }
+ } else {</pre>
+<p>The process of passing data through the transformation is
+ illustrated in the following diagram. The downstream vconnections
+ send <code class="code">WRITE_READY</code> events when they need more data;
+ when data is available, the upstream vconnections reenable the
+ downstream vconnections. In this instance, the <code class="function">INKVIOReenable</code>
+ function sends
+ <code class="code">INK_EVENT_IMMEDIATE</code>.</p>
+<div class="figure">
+<a name="Fig_PassDataThruTransform"></a><p class="title"><b>Figure 5.2. Passing Data Through a Transformation</b></p>
+<div class="mediaobject"><img src="images/vconnection1.jpg" alt="Passing Data Through a Transformation" /></div>
+</div>
+</li>
+<li>
+<p>If the <code class="code">handle_transform</code> function finds there
+ is no more data to read, then it sets <code>nbytes</code> to <code>ndone</code> on the output
+ (downstream) VIO and wakes up the output vconnection with a
+ reenable. It then triggers the end of the write operation from the
+ upstream vconnection by sending the upstream vconnection a <code class="code">WRITE_COMPLETE</code> event.</p>
+<pre class="programlisting">} else {
+
+INKVIONBytesSet (data->output_vio, INKVIONDoneGet (input_vio));
+INKVIOReenable (data->output_vio);
+INKContCall (INKVIOContGet (input_vio),
+ INK_EVENT_VCONN_WRITE_COMPLETE, input_vio);
+}</pre>
+<p>When the upstream vconnection receives the
+ <code class="code">WRITE_COMPLETE</code> event, it will probably shut down the
+ write operation.</p>
+</li>
+<li>
+<p> Similarly, when the downstream vconnection has consumed all of
+ the data, it sends the transformation a <code class="code">WRITE_COMPLETE</code>
+ event. The transformation handles this event with a shut down (the
+ transformation shuts down the write operation to the downstream
+ vconnection). See the <code class="code">null_plugin</code> function for the
+ following code fragment:</p>
+<pre class="programlisting">case INK_EVENT_VCONN_WRITE_COMPLETE:
+ INKVConnShutdown (INKTransformOutputVConnGet (contp), 0, 1
+ break;</pre>
+<p>The following diagram illustrates the flow of events:</p>
+<div class="figure">
+<a name="Fig_EndTransformation"></a><p class="title"><b>Figure 5.3. Ending the Transformation</b></p>
+<div class="mediaobject"><img src="images/vconnection2.jpg" alt="Ending the Transformation" /></div>
+</div>
+</li>
+</ol></div>
+</div>
+</body>
+</html>
Propchange: websites/staging/trafficserver/trunk/content/docs/v2/sdk/SampleNullTransformPlugin.html
------------------------------------------------------------------------------
svn:executable = *
Added: websites/staging/trafficserver/trunk/content/docs/v2/sdk/SetTransactionHook.html
==============================================================================
--- websites/staging/trafficserver/trunk/content/docs/v2/sdk/SetTransactionHook.html (added)
+++ websites/staging/trafficserver/trunk/content/docs/v2/sdk/SetTransactionHook.html Mon Dec 19 22:58:01 2011
@@ -0,0 +1,49 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Setting a Transaction Hook</title>
+<!--#include file="top.html" -->
+<div class="navheader">
+<div class="navprev">
+<a accesskey="p" href="WorkWithHTTPHeaders.html">Prev</a> - Working With HTTP Headers</div>
+<div class="navnext">Chapter 5. HTTP Transformation Plugins - <a accesskey="n" href="HTTPTransformationPlugins.html">Next</a>
+</div>
+</div>
+<div id="toc"></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="SetTransactionHook"></a>Setting a Transaction Hook</h3></div></div></div>
+<p>If the request does not have the
+ <code class="code">Proxy-Authorization</code> field set to Basic authorization or
+ a valid username/password, then the plugin sends the <code>407 Proxy
+ authorization</code> <code>required</code> status code back to the client. The client
+ will then prompt the user for a username and password, and then resend
+ the request.</p>
+<p>In the <code class="code">handle_dns</code> routine, the following lines
+ handle the authorization error case:</p>
+<pre class="programlisting">done:
+ INKHttpTxnHookAdd (txnp, INK_HTTP_SEND_RESPONSE_HDR_HOOK, contp);
+ INKHttpTxnReenable (txnp, INK_EVENT_HTTP_ERROR);</pre>
+<p>If <code class="code">handle_dns</code> does not find the
+ <code class="code">Proxy-Authorization</code> field set to Basic authorization or
+ a valid username/password, then it adds a
+ <code class="code">SEND_RESPONSE_HDR_HOOK</code> to the transaction being
+ processed. This means that Traffic Server will call the plugin back
+ when sending the client response. <code class="code">handle_dns</code> reenables the transaction with
+ <code class="code">INK_EVENT_HTTP_ERROR</code>, which means that the plugin wants
+ Traffic Server to terminate the transaction.</p>
+<p>When Traffic Server terminates the transaction, it sends the
+ client an error message. Because of the
+ <code class="code">SEND_RESPONSE_HDR_HOOK</code>, Traffic Server calls the plugin
+ back. The <code class="code">auth-plugin</code> routine calls
+ <code class="code">handle_response</code> to send the client a <code>407</code> status
+ code. When the client resends the request with the <code class="code">Proxy-
+ Authorization</code> field, a new transaction begins.</p>
+<p><code class="code">handle_dns</code> calls <code class="code">base64_decode</code> to
+ decode the username and password; <code class="code">handle_dns</code> also calls <code class="code">authorized</code> to
+ validate the username and password. In this plugin, sample NT code is
+ provided for password validation. UNIX programmers can supply their
+ own validation mechanism.</p>
+</div>
+</body>
+</html>
Propchange: websites/staging/trafficserver/trunk/content/docs/v2/sdk/SetTransactionHook.html
------------------------------------------------------------------------------
svn:executable = *
Added: websites/staging/trafficserver/trunk/content/docs/v2/sdk/SetUpLicensing.html
==============================================================================
--- websites/staging/trafficserver/trunk/content/docs/v2/sdk/SetUpLicensing.html (added)
+++ websites/staging/trafficserver/trunk/content/docs/v2/sdk/SetUpLicensing.html Mon Dec 19 22:58:01 2011
@@ -0,0 +1,68 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Setting Up Licensing</title>
+<!--#include file="top.html" -->
+<div class="navheader">
+<div class="navprev">
+<a accesskey="p" href="LicensingPlugin.html">Prev</a> - Licensing Your Plugin</div>
+<div class="navnext">Generating a License Key - <a accesskey="n" href="GenerateLicenseKey.html">Next</a>
+</div>
+</div>
+<div id="toc"></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title">
+<a name="SetUpLicensing"></a>Setting Up Licensing</h2></div></div></div>
+<p>Set up licensing with the steps below:</p>
+<div class="orderedlist"><ol type="1">
+<li>
+ <p>Develop your plugin using the
+ <code class="function">INKPluginLicenseRequired</code> function.</p></li>
+<li><p>Create an installation program for your plugin. The
+ installation program must update both
+ <code class="filename">plugin.config</code> and
+ <code class="filename">plugin.db</code>. When your plugin customer installs
+ the plugin, the program should ask the customer for the license
+ key.</p></li>
+<li>
+ <p>Use the <code class="filename">gen_key</code> tool to generate license
+ keys. You can generate different keys for different customers and
+ you can set expiration dates for each key.</p></li>
+<li>
+ <p>Distribute your plugin, with the license key, to
+ customers.</p></li>
+</ol></div>
+<p>When the customer installs the plugin, the installation program
+ should ask for the license key. The installation program should then
+ make an entry in <code class="filename">plugin.db</code> and <code>plugin.config</code> for
+ the new plugin. When the customer runs the plugin, Traffic Server checks
+ the license key. If it passes, then Traffic Server calls <code class="function">INKPluginInit</code>.</p>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="Licensing_Example"></a>Example</h3></div></div></div>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ <p>Suppose you have a plugin filtering, implemented in the object
+ <code>filtering.so</code></p></li>
+<li>
+<p>Generate a key for your plugin filtering via:</p>
+<p><span><code>gen_key filtering ABCDE 03312002</code></span></p>
+</li>
+<li>
+<p>The key generated by <code class="code">gen_key</code> is:</p>
+<p><code class="code">ABCDE2E01E07D95</code></p>
+</li>
+<li>
+<p>Update <code class="filename">plugin.db</code> by adding the
+ following lines:</p>
+<pre class="programlisting">[filtering]
+Object=filtering.so
+License=ABCDE2E01E07D95</pre>
+</li>
+</ul></div>
+<p>The following function is used to license your plugin:</p>
+<div class="itemizedlist"><ul type="disc"><li><p><a href="INKPluginLicenseRequired.html" title="INKPluginLicenseRequired">INKPluginLicenseRequired</a></p></li></ul></div>
+</div>
+</div>
+</body>
+</html>
Propchange: websites/staging/trafficserver/trunk/content/docs/v2/sdk/SetUpLicensing.html
------------------------------------------------------------------------------
svn:executable = *
Added: websites/staging/trafficserver/trunk/content/docs/v2/sdk/SettingGlobalHook.html
==============================================================================
--- websites/staging/trafficserver/trunk/content/docs/v2/sdk/SettingGlobalHook.html (added)
+++ websites/staging/trafficserver/trunk/content/docs/v2/sdk/SettingGlobalHook.html Mon Dec 19 22:58:01 2011
@@ -0,0 +1,32 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Setting a Global Hook</title>
+<!--#include file="top.html" -->
+<div class="navheader">
+<div class="navprev">
+<a accesskey="p" href="BlacklistPlugin.html">Prev</a> - The Blacklist Plugin</div>
+<div class="navnext">Setting Up UI Update Callbacks - <a accesskey="n" href="SettingUpUIUpdateCallbacks.html">Next</a>
+</div>
+</div>
+<div id="toc"></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="SettingGlobalHook"></a>Setting a Global Hook<a class="indexterm" name="id373254"></a></h3></div></div></div>
+<p>Global hooks are always added in <code>INKPluginInit</code> using <code class="function">INKHttpHookAdd</code>. The two arguments of
+ <code class="function">INKHttpHookAdd</code> are the hook ID and the
+ continuation to call when processing the event corresponding to the
+ hook. In <code class="filename">blacklist-1.c</code>, the global hook is added
+ as follows:</p>
+<pre class="programlisting">INKHttpHookAdd (INK_HTTP_OS_DNS_HOOK, contp);</pre>
+<p>Above, <code class="code">INK_HTTP_OS_DNS_HOOK</code> is the ID for the origin
+ server DNS lookup hook and <code class="code">contp</code> is the parent
+ continuation created earlier.</p>
+<p>This means that the Blacklist plugin is called at every origin
+ server DNS lookup. When it is called, the handler function<code class="code">
+ blacklist_plugin</code> receives <code class="code">INK_EVENT_HTTP_OS_DNS</code>
+ and calls <code class="code">handle_dn</code><code>s</code> to see if the request is
+ forbidden.</p>
+</div>
+</body>
+</html>
Propchange: websites/staging/trafficserver/trunk/content/docs/v2/sdk/SettingGlobalHook.html
------------------------------------------------------------------------------
svn:executable = *
Added: websites/staging/trafficserver/trunk/content/docs/v2/sdk/SettingUpTransacHook.html
==============================================================================
--- websites/staging/trafficserver/trunk/content/docs/v2/sdk/SettingUpTransacHook.html (added)
+++ websites/staging/trafficserver/trunk/content/docs/v2/sdk/SettingUpTransacHook.html Mon Dec 19 22:58:01 2011
@@ -0,0 +1,78 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Setting Up a Transaction Hook</title>
+<!--#include file="top.html" -->
+<div class="navheader">
+<div class="navprev">
+<a accesskey="p" href="AccessingTransactionProc.html">Prev</a> - Accessing the Transaction Being Processed</div>
+<div class="navnext">Working with HTTP Header Functions - <a accesskey="n" href="WorkWHTTPHeaderFunc.html">Next</a>
+</div>
+</div>
+<div id="toc"></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="SettingUpTransacHook"></a>Setting Up a Transaction Hook<a class="indexterm" name="id373445"></a></h3></div></div></div>
+<p>The Blacklist plugin sends "access forbidden" messages to
+ clients if their requests are directed to blacklisted hosts. Therefore,
+ the plugin needs a transaction hook so it will be called back when
+ Traffic Server's HTTP state machine reaches the "send response header"
+ event. In the Blacklist plugin's <code class="code">handle_dns</code> routine, the
+ transaction hook is added as follows:</p>
+<pre class="programlisting">INKMutexLock (sites_mutex);
+for (i = 0; i < nsites; i++) {
+ if (strncmp (host, sites[i], host_length) == 0) {
+ printf ("blacklisting site: %s\n", sites[i]);
+ INKHttpTxnHookAdd (txnp,
+ INK_HTTP_SEND_RESPONSE_HDR_HOOK,
+ contp);
+ INKHandleMLocRelease (bufp, hdr_loc, url_loc);
+ INKHandleMLocRelease (bufp, INK_NULL_MLOC, hdr_loc);
+ INKHttpTxnReenable (txnp, INK_EVENT_HTTP_ERROR);
+ INKMutexUnlock (sites_mutex);
+ return;
+ }
+}
+ INKMutexUnlock (sites_mutex);
+ done:
+ INKHttpTxnReenable (txnp, INK_EVENT_HTTP_CONTINUE);
+}</pre>
+<p>This code fragment shows some interesting features. The plugin is comparing the requested site to the
+ list of blacklisted sites. While the plugin is using the blacklist, it
+ must acquire the mutex lock for the blacklist to prevent
+ configuration changes in the middle of a blacklisting operation. If
+ the requested site is blacklisted, then the following things happen:</p>
+<div class="orderedlist"><ol type="1">
+<li>
+ <p>A transaction hook is added with
+ <code class="code">INKHttpTxnHookAdd</code>; the plugin is called back
+ at the "send response header" event (i.e., the plugin sends an <code>Access
+ forbidden</code> message to the client). You can see that in order to
+ add a transaction hook, you need a handle to the transaction being
+ processed.</p></li>
+<li>
+ <p>The transaction is reenabled using
+ <code class="code">INKHttpTxnReenable</code> with
+ <code class="code">INK_EVENT_HTTP_ERROR</code> as its event argument.
+ Reenabling with an error event tells the HTTP state machine to
+ stop the transaction and jump to the "send response header" state.
+ Notice that if the requested site is not blacklisted, then the
+ transaction is reenabled with the
+ <code class="code">INK_EVENT_HTTP_CONTINUE</code> event.</p></li>
+<li>
+ <p>The string and <code class="function">INKMLoc</code> data stored in
+ the marshal buffer <code class="code">bufp</code> is released by
+ <code class="code">INKHandleMLocRelease</code> (see <a href="RlsMarshalBufHandles.html" title="Release Marshal Buffer Handles">Release Marshal Buffer Handles</a>). Release these handles before
+ reenabling the transaction.</p></li>
+</ol></div>
+<p>In general, whenever the plugin is doing something to a
+ transaction, it must reenable the transaction when it is finished. In other words: every time your handler function handles a transaction
+ event, it must call <code class="code">INKHttpTxnReenable</code> when it is
+ finished. Similarly, after your plugin handles session events
+ (<code class="code">INK_EVENT_HTTP_SSN_START</code> and
+ <code class="code">INK_EVENT_HTTP_SSN_CLOSE</code>), it must reenable the session
+ with <code class="code">INKHttpSsnReenable</code>. Reenabling the transaction twice in the same plugin routine is a
+ bad error.</p>
+</div>
+</body>
+</html>
Propchange: websites/staging/trafficserver/trunk/content/docs/v2/sdk/SettingUpTransacHook.html
------------------------------------------------------------------------------
svn:executable = *
Added: websites/staging/trafficserver/trunk/content/docs/v2/sdk/SettingUpUIUpdateCallbacks.html
==============================================================================
--- websites/staging/trafficserver/trunk/content/docs/v2/sdk/SettingUpUIUpdateCallbacks.html (added)
+++ websites/staging/trafficserver/trunk/content/docs/v2/sdk/SettingUpUIUpdateCallbacks.html Mon Dec 19 22:58:01 2011
@@ -0,0 +1,29 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Setting Up UI Update Callbacks</title>
+<!--#include file="top.html" -->
+<div class="navheader">
+<div class="navprev">
+<a accesskey="p" href="SettingGlobalHook.html">Prev</a> - Setting a Global Hook</div>
+<div class="navnext">Accessing the Transaction Being Processed - <a accesskey="n" href="AccessingTransactionProc.html">Next</a>
+</div>
+</div>
+<div id="toc"></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="SettingUpUIUpdateCallbacks"></a>Setting Up UI Update Callbacks</h3></div></div></div>
+<p>The Blacklist plugin must be called back whenever its
+ configuration is changed by an administrator. To get the interface working, you need an interface
+ program (such as a CGI form) to display an interface and obtain
+ configuration information and a text file that the CGI program edits
+ and the Blacklist plugin reads. The callback to the plugin is
+ established in <code class="function">INKPluginInit</code> by:</p>
+<pre class="programlisting">INKMgmtUpdateRegister (contp, "Dianes Blacklist Plugin", "blacklist.cgi");</pre>
+<p>Above, <code class="code">contp</code> is the plugin's static parent
+ continuation, <code>Dianes Blacklist Plugin </code>is the name of the plugin as
+ specified by the CGI form's <code class="replaceable">INK_PLUGIN_NAME </code> variable, and <code class="filename">blacklist.cgi</code> is the path to the plugin's
+ interface program (relative to the Traffic Server plugins directory). </p>
+</div>
+</body>
+</html>
Propchange: websites/staging/trafficserver/trunk/content/docs/v2/sdk/SettingUpUIUpdateCallbacks.html
------------------------------------------------------------------------------
svn:executable = *
Added: websites/staging/trafficserver/trunk/content/docs/v2/sdk/SpecifyingPluginLocation.html
==============================================================================
--- websites/staging/trafficserver/trunk/content/docs/v2/sdk/SpecifyingPluginLocation.html (added)
+++ websites/staging/trafficserver/trunk/content/docs/v2/sdk/SpecifyingPluginLocation.html Mon Dec 19 22:58:01 2011
@@ -0,0 +1,33 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Specify the Plugin's Location</title>
+<!--#include file="top.html" -->
+<div class="navheader">
+<div class="navprev">
+<a accesskey="p" href="Updatingplugin.configFile.html">Prev</a> - Update the <code class="filename">plugin.config</code> File</div>
+<div class="navnext">Restart Traffic Server - <a accesskey="n" href="RestartingTS.html">Next</a>
+</div>
+</div>
+<div id="toc"></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="SpecifyingPluginLocation"></a>Specify the Plugin's Location</h3></div></div></div>
+<p>All plugins must be located in the directory specified by the
+ configuration variable
+ <code class="replaceable"> proxy.config.plugin.plugin_dir</code>, which is located in
+ the <code class="filename">records.config</code> file. The directory can be
+ specified as an absolute or relative path.</p>
+<p>If a relative path is used, then the starting directory will be
+ the Traffic Server installation directory as specified in
+ <code class="filename">/etc/traffic_server</code>. The default value is
+ <code class="code">config/plugins</code>, which tells Traffic Server to use the
+ directory plugins located in the same configuration directory as
+ <code class="filename">records.config</code>. It is common to use the default
+ directory. Be sure to place the shared library
+ <code class="filename">hello-world.so</code> inside the directory you've
+ configured.</p>
+</div>
+</body>
+</html>
+
Propchange: websites/staging/trafficserver/trunk/content/docs/v2/sdk/SpecifyingPluginLocation.html
------------------------------------------------------------------------------
svn:executable = *
Added: websites/staging/trafficserver/trunk/content/docs/v2/sdk/StatisticsFunctions.html
==============================================================================
--- websites/staging/trafficserver/trunk/content/docs/v2/sdk/StatisticsFunctions.html (added)
+++ websites/staging/trafficserver/trunk/content/docs/v2/sdk/StatisticsFunctions.html Mon Dec 19 22:58:01 2011
@@ -0,0 +1,249 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Statistics Functions</title>
+<!--#include file="top.html" -->
+<div class="navheader">
+<div class="navprev">
+<a accesskey="p" href="INKPluginLicenseRequired.html">Prev</a> - INKPluginLicenseRequired</div>
+<div class="navnext">Coupled Statistics Functions- <a accesskey="n" href="CoupledStatsFunctions.html">Next</a>
+</div>
+</div>
+<div id="toc"></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title">
+<a name="StatisticsFunctions"></a>Statistics Functions</h2></div></div></div>
+
+
+<ul><b>
+<li><a href="StatisticsFunctions.html#UncoupledStatsFuncs">Uncoupled Statistics Functions</a></li>
+
+<ul>
+<li><a href="StatisticsFunctions.html#INKStatCreate">INKStatCreate</a></li>
+<li><a href="StatisticsFunctions.html#INKStatDecrement">INKStatDecrement</a></li>
+<li><a href="StatisticsFunctions.html#INKStatFloatAddTo">INKStatFloatAddTo</a></li>
+<li><a href="StatisticsFunctions.html#INKStatFloatGet">INKStatFloatGet</a></li>
+<li><a href="StatisticsFunctions.html#INKStatFloatSet">INKStatFloatSet</a></li>
+<li><a href="StatisticsFunctions.html#INKStatIncrement">INKStatIncrement</a></li>
+<li><a href="StatisticsFunctions.html#INKStatIntAddTo">INKStatIntAddTo</a></li>
+<li><a href="StatisticsFunctions.html#INKStatIntGet">INKStatIntGet</a></li>
+
+<li><a href="StatisticsFunctions.html#INKStatIntSet">INKStatIntSet</a></li>
+</ul>
+
+<li><a href="CoupledStatsFunctions.html#CoupledStatsFunctions">Coupled Statistics Functions</a></li>
+
+<ul>
+<li><a href="CoupledStatsFunctions.html#INKStatCoupledGlobalAdd">INKStatCoupledGlobalAdd</a></li>
+<li><a href="CoupledStatsFunctions.html#INKStatCoupledGlobalCategoryCreate">INKStatCoupledGlobalCategoryCreate</a></li>
+<li><a href="CoupledStatsFunctions.html#INKStatCoupledLocalAdd">INKStatCoupledLocalAdd</a></li>
+<li><a href="CoupledStatsFunctions.html#INKStatCoupledLocalCopyCreate">INKStatCoupledLocalCopyCreate</a></li>
+<li><a href="CoupledStatsFunctions.html#INKStatCoupledLocalCopyDestroy">INKStatCoupledLocalCopyDestroy</a></li>
+<li><a href="CoupledStatsFunctions.html#INKStatsCoupledUpdate">INKStatsCoupledUpdate</a></li>
+</ul>
+
+</b>
+</ul>
+
+<div class="section" lang="en">
+<div class="titlepage"><div><div>
+ <h3 class="title">
+<a name="UncoupledStatsFuncs"></a>Uncoupled Statistics Functions</h3></div></div></div>
+<p></p>
+
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="INKStatCreate"></a>INKStatCreate</h4></div></div></div>
+<p>Creates a new <code class="code">INKStat</code>.</p>
+<div class="variablelist"><dl>
+<dt><span class="term"><b>Prototype</b></span></dt>
+<dd><p><code class="code">INKStat INKStatCreate ( const char *
+ <em class="replaceable"><code>the_name</code></em>, INKStatTypes
+ <em class="replaceable"><code>the_type</code></em>)</code></p></dd>
+<dt><span class="term"><b>Description</b></span></dt>
+<dd>
+ <p>Creates a new <code class="code">INKStat</code>. The value pointed to
+ by <code class="code"><em class="replaceable"><code>the_name </code></em></code> is the
+ name you use to view the statistic via Traffic Line (see
+ <a href="ViewStatsUsingTrafLine.html" title="Viewing Statistics Using Traffic Line">Viewing Statistics Using Traffic Line</a>). There are two
+ <code class="code">INKStatTypes</code>: <code class="code">INKSTAT_TYPE_INT64</code>
+ and <code class="code">INKSTAT_TYPE_FLOAT</code>.</p></dd>
+<dt><span class="term"><b>Returns</b></span></dt>
+<dd>
+<p>A handle to the newly-created
+ <code class="code">INKStat</code>.</p>
+<p><code class="code">INK_ERROR_PTR</code> if an error occurs.</p>
+</dd>
+</dl></div>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="INKStatDecrement"></a>INKStatDecrement</h4></div></div></div>
+<p>Decrements a stat.</p>
+<div class="variablelist"><dl>
+<dt><span class="term"><b>Prototype</b></span></dt>
+<dd><p><code class="code">INKReturnCode INKStatDecrement(INKStat
+ <em class="replaceable"><code>the_stat</code></em> )</code></p></dd>
+<dt><span class="term"><b>Description</b></span></dt>
+<dd><p>Decrements a stat.</p></dd>
+<dt><span class="term"><b>Returns</b></span></dt>
+<dd>
+<p><code class="code">INK_SUCCESS</code> if the operation completes
+ successfully.</p>
+<p><code class="code">INK_ERROR</code> if an error occurs.</p>
+</dd>
+</dl></div>
+</div>
+
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="INKStatFloatAddTo"></a>INKStatFloatAddTo</h4></div></div></div>
+<p>Adds a float value to a float statistic.</p>
+<div class="variablelist"><dl>
+<dt><span class="term"><b>Prototype</b></span></dt>
+<dd><p><code class="code">INKReturnCode INKStatFloatAddTo ( INKStat
+ <span class="replaceable">the_stat</span>, float <span class="replaceable">amount</span>)</code></p></dd>
+<dt><span class="term"><b>Description</b></span></dt>
+<dd><p>Adds a float value to a float statistic.</p></dd>
+<dt><span class="term"><b>Returns</b></span></dt>
+<dd>
+<p><code class="code">INK_SUCCESS</code> if the operation completes
+ successfully.</p>
+<p><code class="code">INK_ERROR</code> if an error occurs.</p>
+</dd>
+</dl></div>
+</div>
+
+
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="INKStatFloatGet"></a>INKStatFloatGet</h4></div></div></div>
+<p>Obtains the value of a float statistic.</p>
+<div class="variablelist"><dl>
+<dt><span class="term"><b>Prototype</b></span></dt>
+<dd><p><code class="code">INKReturnCode INKStatFloatGet(INKStat
+ <em class="replaceable"><code>stat</code></em>, float
+ *<em class="replaceable"><code>value</code></em>)</code></p></dd>
+<dt><span class="term"><b>Returns</b></span></dt>
+<dd>
+<p><code class="code">INK_SUCCESS</code> if the API is called
+ successfully.</p>
+<p><code class="code">INK_ERROR</code> if an error occurs while calling
+ the API or if an argument is invalid.</p>
+</dd>
+</dl></div>
+</div>
+
+
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="INKStatFloatSet"></a>INKStatFloatSet</h4></div></div></div>
+<p>Sets the value of a float statistic to a particular value.</p>
+<div class="variablelist"><dl>
+<dt><span class="term"><b>Prototype</b></span></dt>
+<dd><p><code class="code">INKReturnCode INKStatFloatSet(INKStat
+ <em class="replaceable"><code>the_stat</code></em>, float
+ <em class="replaceable"><code>the_value</code></em> )</code></p></dd>
+<dt><span class="term"><b>Description</b></span></dt>
+<dd><p>Sets the value of a float stat to the specified
+ value.</p></dd>
+<dt><span class="term"><b>Returns</b></span></dt>
+<dd>
+<p><code class="code">INK_SUCCESS</code> if the operation completes
+ successfully.</p>
+<p><code class="code">INK_ERROR</code> if an error occurs.</p>
+</dd>
+</dl></div>
+</div>
+
+
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="INKStatIncrement"></a>INKStatIncrement</h4></div></div></div>
+<p>Increments a statistic.</p>
+<div class="variablelist"><dl>
+<dt><span class="term"><b>Prototype</b></span></dt>
+<dd><p><code class="code">INKReturnCode INKStatIncrement(INKStat
+ <em class="replaceable"><code>the_stat</code></em> )</code></p></dd>
+<dt><span class="term"><b>Description</b></span></dt>
+<dd>
+ <p>Increments a statistic.</p></dd>
+<dt><span class="term"><b>Returns</b></span></dt>
+<dd>
+<p><code class="code">INK_SUCCESS</code> if the operation completes
+ successfully.</p>
+<p><code class="code">INK_ERROR</code> if an error occurs.</p>
+</dd>
+</dl></div>
+</div>
+
+
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="INKStatIntAddTo"></a>INKStatIntAddTo</h4></div></div></div>
+<p>Adds an <code>INK64</code> value to an integer statistic.</p>
+<div class="variablelist"><dl>
+<dt><span class="term"><b>Prototype</b></span></dt>
+<dd><p><code class="code">INKReturnCode INKStatIntAddTo ( INKStat <span class="replaceable">the_stat</span>,
+ INK64 <span class="replaceable">amount</span>)</code></p></dd>
+<dt><span class="term"><b>Description</b></span></dt>
+<dd>
+ <p>Adds an <code>INK64</code> value to an integer statistic.</p></dd>
+<dt><span class="term"><b>Returns</b></span></dt>
+<dd>
+<p><code class="code">INK_SUCCESS</code> if the operation completes
+ successfully.</p>
+<p><code class="code">INK_ERROR</code> if an error occurs.</p>
+</dd>
+</dl></div>
+</div>
+
+
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="INKStatIntGet"></a>INKStatIntGet</h4></div></div></div>
+<p>Obtains the value of an integer statistic.</p>
+<div class="variablelist"><dl>
+<dt><span class="term"><b>Prototype</b></span></dt>
+<dd><p><code class="code">INKReturnCode INKStatIntGet(INKStat <span class="replaceable">stat</span>, INK64
+ *<span class="replaceable">value</span>)</code></p></dd>
+<dt><span class="term"><b>Returns</b></span></dt>
+<dd>
+<p><code class="code">INK_SUCCESS</code> if the API is called
+ successfully.</p>
+<p><code class="code">INK_ERROR</code> if an error occurs while calling
+ the API or if an argument is invalid.</p>
+</dd>
+</dl></div>
+</div>
+
+
+
+
+
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="INKStatIntSet"></a>INKStatIntSet</h4></div></div></div>
+<p>Sets the value of an integer statistic to a particular
+ value.</p>
+<div class="variablelist"><dl>
+<dt><span class="term"><b>Prototype</b></span></dt>
+<dd><p><code class="code">INKReturnCode INKStatIntSet(INKStat
+ <em class="replaceable"><code>the_stat</code></em>, INK64
+ <em class="replaceable"><code>the_value</code></em> )</code></p></dd>
+<dt><span class="term"><b>Description</b></span></dt>
+<dd>
+ <p>Sets the value of a integer statistic to the specified
+ value.</p></dd>
+<dt><span class="term"><b>Returns</b></span></dt>
+<dd>
+<p><code class="code">INK_SUCCESS</code> if the operation completes
+ successfully.</p>
+<p><code class="code">INK_ERROR</code> if an error occurs.</p>
+</dd>
+</dl></div>
+</div>
+</div>
+</div>
+</body>
+</html>
Propchange: websites/staging/trafficserver/trunk/content/docs/v2/sdk/StatisticsFunctions.html
------------------------------------------------------------------------------
svn:executable = *
Added: websites/staging/trafficserver/trunk/content/docs/v2/sdk/TEConfigReadFunctions.html
==============================================================================
--- websites/staging/trafficserver/trunk/content/docs/v2/sdk/TEConfigReadFunctions.html (added)
+++ websites/staging/trafficserver/trunk/content/docs/v2/sdk/TEConfigReadFunctions.html Mon Dec 19 22:58:01 2011
@@ -0,0 +1,65 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Traffic Server Configuration Read Functions</title>
+<!--#include file="top.html" -->
+<div class="navheader">
+<div class="navprev">
+<a accesskey="p" href="ManagementInterfaceFunctions.html">Prev</a> - Management Interface Functions</div>
+<div class="navnext">INKMgmtFloatGet - <a accesskey="n" href="INKMgmtFloatGet.html">Next</a>
+</div>
+</div>
+<div id="toc"></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title">
+<a name="TEConfigReadFunctions"></a>Configuration Read Functions</h2></div></div></div>
+
+
+<ul><b>
+<li><a href="TEConfigReadFunctions.html#INKMgmtCounterGet">INKMgmtCounterGet</a></li>
+<li><a href="INKMgmtFloatGet.html">INKMgmtFloatGet</a></li>
+<li><a href="INKMgmtIntGet.html">INKMgmtIntGet</a></li>
+<li><a href="INKMgmtStringGet.html">INKMgmtStringGet</a></li>
+
+</b>
+</ul>
+
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="INKMgmtCounterGet"></a>INKMgmtCounterGet</h3></div></div></div>
+<p>Gets a <code class="filename">records.config</code> variable of type
+ <code class="code">counter</code>.</p>
+<div class="variablelist"><dl>
+<dt><span class="term"><b>Prototype</b></span></dt>
+<dd><p><code class="code">int INKMgmtCounterGet (const char
+ *<em class="replaceable"><code>var_name</code></em>, INKMgmtCounter
+ *<em class="replaceable"><code>result</code></em>)</code></p></dd>
+<dt><span class="term"><b>Arguments</b></span></dt>
+<dd>
+<p><code class="code"><em class="replaceable"><code>var_name </code></em></code> is the
+ name of the variable you want from the
+ <code class="filename">records.config</code> file.</p>
+<p><code class="code"><em class="replaceable"><code>result </code></em></code> is a
+ pointer to the value of the variable; this value is of type
+ <code class="function">INKMgmtCounter</code>.</p>
+</dd>
+<dt><span class="term"><b>Description</b></span></dt>
+<dd>
+ <p><code class="function">INKMgmtCounterGet</code> obtains the value
+ of the specified <code class="filename">records.config</code> variable of
+ type <code class="code">counter</code>, and then stores the value in
+ <code class="code"><em class="replaceable"><code>result</code></em></code>.</p></dd>
+<dt><span class="term"><b>Returns</b></span></dt>
+<dd>
+ <p>If <code class="function">INKMgmtCounterGet</code> cannot get
+ the variable, then it returns zero. </p></dd>
+<dd>
+ <p>If <code class="function">INKMgmtCounterGet</code> is successful, then a nonzero value is
+ returned.</p>
+</dd>
+</dl>
+</div>
+</div>
+</div>
+</body>
+</html>
Propchange: websites/staging/trafficserver/trunk/content/docs/v2/sdk/TEConfigReadFunctions.html
------------------------------------------------------------------------------
svn:executable = *
Added: websites/staging/trafficserver/trunk/content/docs/v2/sdk/ThreadFunctions.html
==============================================================================
--- websites/staging/trafficserver/trunk/content/docs/v2/sdk/ThreadFunctions.html (added)
+++ websites/staging/trafficserver/trunk/content/docs/v2/sdk/ThreadFunctions.html Mon Dec 19 22:58:01 2011
@@ -0,0 +1,77 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Thread Functions</title>
+<!--#include file="top.html" -->
+<div class="navheader">
+<div class="navprev">
+<a accesskey="p" href="INKstrndup.html">Prev</a> - INKstrndup</div>
+<div class="navnext">INKThreadDestroy - <a accesskey="n" href="INKThreadDestroy.html">Next</a>
+</div>
+</div>
+<div id="toc"></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title">
+<a name="ThreadFunctions"></a>Thread Functions</h2></div></div></div>
+<p>The Traffic Server API thread functions enable you to create,
+ destroy, and identify threads within Traffic Server. Multithreading
+ enables a single program to have more than one stream of execution and
+ to process more than one transaction at a time. Threads serialize their access to shared resources and data using
+ the <code>INKMutex</code> type, as described in <a href="MutexGuide.html#Mutexes" title="Mutexes">Mutexes</a>.</p>
+<p>The thread functions are listed below:</p>
+
+
+<b><ul>
+<li><span class="section"><a href="ThreadFunctions.html#INKThreadCreate">INKThreadCreate</a></span></li>
+<li><span class="section"><a href="INKThreadDestroy.html">INKThreadDestroy</a></span></li>
+<li><span class="section"><a href="INKThreadInit.html">INKThreadInit</a></span></li>
+<li><span class="section"><a href="INKThreadSelf.html">INKThreadSelf</a></span></li>
+</ul></b>
+
+
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="INKThreadCreate"></a>INKThreadCreate</h3></div></div></div>
+<p>Creates a new thread.</p>
+<div class="variablelist"><dl>
+<dt><span class="term"><b>Prototype</b></span></dt>
+<dd><p><code class="code">INKThread INKThreadCreate (INKThreadFunc
+ <em class="replaceable"><code>func</code></em>, void
+ <em class="replaceable"><code>*data</code></em>)</code></p></dd>
+<dt><span class="term"><b>Arguments</b></span></dt>
+<dd>
+<p><code class="function">INKThreadFunc</code>
+ <code class="code"><em class="replaceable"><code>func </code></em></code> is the function
+ the new thread executes.</p>
+<p><code class="code">void <em class="replaceable"><code>*data </code></em></code> is the
+ data passed as an argument to
+ <code class="code"><em class="replaceable"><code>func</code></em></code>.</p>
+</dd>
+<dt><span class="term"><b>Description</b></span></dt>
+<dd>
+<p>Creates a new thread and calls
+ <code class="code"><em class="replaceable"><code> func </code></em></code> with the argument
+ <code class="code"><em class="replaceable"><code> data</code></em></code>. When
+ <code class="code"><em class="replaceable"><code> func </code></em></code> exits, the thread
+ is automatically destroyed.</p>
+<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/docbook/note.png" /></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top"><p>The <code class="function">INKThread</code> return pointer does
+ not indicate the status of the new thread
+ and cannot be modified.</p></td></tr>
+</table></div>
+</dd>
+<dt><span class="term"><b>Returns</b></span></dt>
+<dd>
+<p>If successful, a valid pointer to an <code class="function">INKThread</code>
+ object.</p>
+<p>A <code class="code">NULL</code> pointer if there is an error.</p>
+</dd>
+</dl></div>
+</div>
+</div>
+</body>
+</html>
Propchange: websites/staging/trafficserver/trunk/content/docs/v2/sdk/ThreadFunctions.html
------------------------------------------------------------------------------
svn:executable = *
Added: websites/staging/trafficserver/trunk/content/docs/v2/sdk/TransformationFunctions.html
==============================================================================
--- websites/staging/trafficserver/trunk/content/docs/v2/sdk/TransformationFunctions.html (added)
+++ websites/staging/trafficserver/trunk/content/docs/v2/sdk/TransformationFunctions.html Mon Dec 19 22:58:01 2011
@@ -0,0 +1,50 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Transformation Functions</title>
+<!--#include file="top.html" -->
+<div class="navheader">
+<div class="navprev">
+<a accesskey="p" href="INKVConnCacheObjectSizeGet.html">Prev</a> - INKVConnCacheObjectSizeGet</div>
+<div class="navnext">INKTransformOutputVConnGet - <a accesskey="n" href="INKTransformOutputVConnGet.html">Next</a>
+</div>
+</div>
+<div id="toc"></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title">
+<a name="TransformationFunctions"></a>Transformation Functions</h2></div></div></div>
+
+
+<ul><b>
+<li><a href="TransformationFunctions.html#INKTransformCreate">INKTransformCreate</a></li>
+<li><a href="INKTransformOutputVConnGet.html">INKTransformOutputVConnGet</a></li>
+</b>
+</ul>
+
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="INKTransformCreate"></a>INKTransformCreate</h3></div></div></div>
+<p>Creates a transformation vconnection.</p>
+<div class="variablelist"><dl>
+<dt><span class="term"><b>Prototype</b></span></dt>
+<dd><p><code class="code">INKVConn INKTransformCreate (INKEventFunc
+ <em class="replaceable"><code>event_funcp</code></em>, INKHttpTxn
+ <em class="replaceable"><code>txnp</code></em>)</code></p></dd>
+<dt><span class="term"><b>Description</b></span></dt>
+<dd>
+ <p>Creates a new transformation, <code class="code">INKVConn</code>. The
+ vconnection's handler function is
+ <code class="code"><em class="replaceable"><code> funcp </code></em></code> and its mutex is
+ taken from <code class="code"><em class="replaceable"><code> txnp</code></em></code>.</p></dd>
+<dt><span class="term"><b>Example</b></span></dt>
+<dd>
+ <p>See the <a href="SampleNullTransformPlugin.html" title="The Sample Null Transform Plugin"> Sample Null Transform Plugin</a> example.</p></dd>
+<dt><span class="term"><b>Returns</b></span></dt>
+<dd>
+ <p>The newly-created transformation connection.</p>
+</dd>
+</dl></div>
+</div>
+</div>
+</body>
+</html>
Propchange: websites/staging/trafficserver/trunk/content/docs/v2/sdk/TransformationFunctions.html
------------------------------------------------------------------------------
svn:executable = *