trafficserver-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Peach <jpe...@apache.org>
Subject [API REVIEW] TSClientProtoStackCreate
Date Thu, 03 Apr 2014 22:02:22 GMT
Hi all,

This is a proposal for a new API to abstract the construction of the TSClientProtoStack. Currently,
plugin authors are expected to construct TSClientProtoStack values by bitshifting them into
their correct locations. This is tedious likely to be error-prone.

https://issues.apache.org/jira/browse/TS-2699

The following function will be added:

	TSClientProtoStack TSClientProtoStackCreate(TSProtoType, ...)

The TS_PROTO_MAX will be removed and replaced with TS_PROTO_NULL, whose value will be 32.
Since TS_PROTO_MAX is the last value in the TSProtoType enumeration, it's value will change
when we add new TSProtoType values, causing each new addition to be an ABI breakage. TS_PROTO_NULL
solves this issue.

TSClientProtoStackCreate() accepts a sequence of TSProtoType values, terminated by a TS_PROTO_NULL.
It combines the values and returns a TSClientProtoStack value that describes the protocol
layering of a client request.

diff --git a/lib/ts/apidefs.h.in b/lib/ts/apidefs.h.in
index ffd8cbb..487c25e 100644
--- a/lib/ts/apidefs.h.in
+++ b/lib/ts/apidefs.h.in
@@ -118,8 +118,8 @@ extern "C"
   TS_PROTO_RTMP = 14,
   TS_PROTO_WBSK = 15, /* WebSocket */

-    /* MAX value of TSProtoType  */
-    TS_PROTO_MAX
+    /* Sentinel value  */
+    TS_PROTO_NULL = 32
 } TSProtoType;

 typedef uint32_t TSClientProtoStack;
diff --git a/proxy/api/ts/ts.h b/proxy/api/ts/ts.h
index 367317b..6139fb4 100644
--- a/proxy/api/ts/ts.h
+++ b/proxy/api/ts/ts.h
@@ -1577,6 +1577,9 @@ extern "C"

 /* --------------------------------------------------------------------------
    Initiate Http Connection */
+
+  tsapi TSClientProtoStack TSClientProtoStackCreate(TSProtoType, ...);
+
 /**
     Allows the plugin to initiate an http connection. The TSVConn the
     plugin receives as the result of successful operates identically to

Mime
View raw message