You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by am...@apache.org on 2010/11/20 16:17:09 UTC

svn commit: r1037232 - in /trafficserver/traffic/branches/wccp: configure.ac example/Makefile.am proxy/InkAPI.cc proxy/api/ts/ts.h

Author: amc
Date: Sat Nov 20 15:17:03 2010
New Revision: 1037232

URL: http://svn.apache.org/viewvc?rev=1037232&view=rev
Log:
Plugin first successes.

Modified:
    trafficserver/traffic/branches/wccp/configure.ac
    trafficserver/traffic/branches/wccp/example/Makefile.am
    trafficserver/traffic/branches/wccp/proxy/InkAPI.cc
    trafficserver/traffic/branches/wccp/proxy/api/ts/ts.h

Modified: trafficserver/traffic/branches/wccp/configure.ac
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/configure.ac?rev=1037232&r1=1037231&r2=1037232&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/configure.ac (original)
+++ trafficserver/traffic/branches/wccp/configure.ac Sat Nov 20 15:17:03 2010
@@ -1227,6 +1227,8 @@ AC_CONFIG_FILES([proxy/mgmt2/web2/Makefi
 AC_CONFIG_FILES([proxy/stats/Makefile])
 AC_CONFIG_FILES([proxy/wccp/Makefile])
 AC_CONFIG_FILES([example/Makefile])
+# Pavlov Plugins
+AC_CONFIG_FILES([example/pavlov-cache/Makefile])
 # example plugins
 AC_CONFIG_FILES([example/add-header/Makefile])
 AC_CONFIG_FILES([example/append-transform/Makefile])

Modified: trafficserver/traffic/branches/wccp/example/Makefile.am
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/example/Makefile.am?rev=1037232&r1=1037231&r2=1037232&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/example/Makefile.am (original)
+++ trafficserver/traffic/branches/wccp/example/Makefile.am Sat Nov 20 15:17:03 2010
@@ -18,5 +18,5 @@ if STANDALONE_IOCORE
 SUBDIRS = app-template
 else
 # TODO: add 'file_system_cache' example when working.
-SUBDIRS = . add-header append-transform basic-auth blacklist-0 blacklist-1 bnull-transform cache_plugin cache_scan file-1 gzip-transform hello null-transform output-header protocol query_remap redirect-1 remap replace-header response-header-1 server-transform session-1 thread-1 thread-pool
+SUBDIRS = . pavlov-cache add-header append-transform basic-auth blacklist-0 blacklist-1 bnull-transform cache_plugin cache_scan file-1 gzip-transform hello null-transform output-header protocol query_remap redirect-1 remap replace-header response-header-1 server-transform session-1 thread-1 thread-pool
 endif

Modified: trafficserver/traffic/branches/wccp/proxy/InkAPI.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/InkAPI.cc?rev=1037232&r1=1037231&r2=1037232&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/InkAPI.cc (original)
+++ trafficserver/traffic/branches/wccp/proxy/InkAPI.cc Sat Nov 20 15:17:03 2010
@@ -381,6 +381,9 @@ CacheAPIHooks *cache_global_hooks = NULL
 ConfigUpdateCbTable *global_config_cbs = NULL;
 
 static char traffic_server_version[128] = "";
+static int ts_major_version = 0;
+static int ts_minor_version = 0;
+static int ts_patch_version = 0;
 
 static ClassAllocator<APIHook> apiHookAllocator("apiHookAllocator");
 static ClassAllocator<INKContInternal> INKContAllocator("INKContAllocator");
@@ -1829,6 +1832,11 @@ api_init()
 
     // Setup the version string for returning to plugins
     ink_strncpy(traffic_server_version, appVersionInfo.VersionStr, sizeof(traffic_server_version));
+    // Extract the elements.
+    if (sscanf(traffic_server_version, "%d.%d.%d", &ts_major_version, &ts_minor_version, &ts_patch_version) != 3) {
+      Warning("Unable to parse traffic server version string '%s'\n", traffic_server_version);
+    }
+
   }
 }
 
@@ -1909,6 +1917,9 @@ INKTrafficServerVersionGet(void)
 {
   return traffic_server_version;
 }
+int INKTrafficServerVersionGetMajor() { return ts_major_version; }
+int INKTrafficServerVersionGetMinor() { return ts_minor_version; }
+int INKTrafficServerVersionGetPatch() { return ts_patch_version; }
 
 const char *
 INKPluginDirGet(void)
@@ -5270,6 +5281,16 @@ INKHttpTxnPristineUrlGet (INKHttpTxn txn
     return INK_ERROR;
 }
 
+// Shortcut to just get the URL.
+char*
+INKHttpTxnUrlStringGet (INKHttpTxn txnp, int* length) {
+  char* zret = 0;
+  if (INK_SUCCESS == sdk_sanity_check_txn(txnp)) {
+    HttpSM *sm = reinterpret_cast<HttpSM*>(txnp);
+    zret = sm->t_state.hdr_info.client_request.url_string_get(0, length);
+  }
+  return zret;
+}
 
 int
 INKHttpTxnClientRespGet(INKHttpTxn txnp, INKMBuffer *bufp, INKMLoc *obj)

Modified: trafficserver/traffic/branches/wccp/proxy/api/ts/ts.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/proxy/api/ts/ts.h?rev=1037232&r1=1037231&r2=1037232&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/proxy/api/ts/ts.h (original)
+++ trafficserver/traffic/branches/wccp/proxy/api/ts/ts.h Sat Nov 20 15:17:03 2010
@@ -880,6 +880,12 @@ extern "C"
    */
   inkapi const char *INKTrafficServerVersionGet(void);
 
+  /// Get the major version number for the current running instance.
+  inkapi int INKTrafficServerVersionGetMajor();
+  /// Get the minor version number for the current running instance.
+  inkapi int INKTrafficServerVersionGetMinor();
+  /// Get the patch version number for the current running instance.
+  inkapi int INKTrafficServerVersionGetPatch();
   /* --------------------------------------------------------------------------
      Plugin registration */
 
@@ -1938,6 +1944,7 @@ extern "C"
   inkapi INKHttpSsn INKHttpTxnSsnGet(INKHttpTxn txnp);
   inkapi int INKHttpTxnClientReqGet(INKHttpTxn txnp, INKMBuffer * bufp, INKMLoc * offset);
   inkapi INKReturnCode INKHttpTxnPristineUrlGet(INKHttpTxn txnp, INKMBuffer *bufp, INKMLoc *url_loc);
+  inkapi char* INKHttpTxnUrlStringGet(INKHttpTxn txnp, int* length);
   inkapi int INKHttpTxnClientRespGet(INKHttpTxn txnp, INKMBuffer * bufp, INKMLoc * offset);
   inkapi int INKHttpTxnServerReqGet(INKHttpTxn txnp, INKMBuffer * bufp, INKMLoc * offset);
   inkapi int INKHttpTxnServerRespGet(INKHttpTxn txnp, INKMBuffer * bufp, INKMLoc * offset);