On 10/04/2011 07:11 AM, Nick Kew wrote:
I'd like to write a plugin that works on TCP Connection data.
In HTTPD I'd just work with the conn_rec and write
connection-level filters.
TS API exposes HTTP SSN and HTTP TXN, whose semantics
confuse me. Tracing callbacks for them over a simple
HTTP request, I get the order of callbacks:
SSN Start
TXN Start
SSN End
TXN End
Hmmm, this seems broken, I'd expect SSN End to happen after TXN End. A
SSN (session) is the "connection" (keep-alive) while a TXN (transaction)
is a request on the session. Perhaps file a bug ?
I want connection data to last the entire connection,
so I want to set it up on SSN Start. But there's no
API to retrieve the connection data until I have the
TXN, with TSHttpTxnClientAddrGet& family. And the
unexpected order of end events complicates ideas of
cleanup!
Well, if you want to use per-SSN private data, you can / should use
TSHttpSsnArgSet/Get() (and register your "id" with
TSHttpArgIndexReserve()). For per TXN data, cross continuations, there's
a similar set of TxnArgSet/Get APIs. Note that within a continuation,
you have a private opaque (void*) pointer that you can do whatever you
like with.
Where should I be looking for an insight into the
semantics of SSN and TXN in the API, and how I can
map these to a Connection?
So, not fully understanding what you need, I don't think we have any
exposure to the underlying connection objects (which are C++ objects)
other than the "getters" such as getting peer IP's (sockaddr's) etc.
Since these are not simple structs, we can't really expose the objects
through the C APIs, instead, each "member" needs their own getter (and
setter).
-- Leif