On 5/22/12 9:39 PM, James Peach wrote:
On 11/05/2012, at 10:21 AM, James Peach wrote:
I thought a bit more about how the remap and full APIs can be supported. 
Currently the remap plugin looks for global functions called 'init' and 'remap' 
respectively.

We don't really need 'init' because you can just run code at global scope when 
the source file is loaded; so 'init' can go away. I think that the global 
'remap' function can go away too in favour of explicitly registering a remap 
callback, eg.

        TS.remap(function(request) {
                -- do stuff here
        })

This will match the hook function that I'm thinking of, eg:

        TS.hook(TS.HttpReadRequestHeader, function(foo1, foo2) {
                -- do stuff here
        })



+1.

Is there a reason not to use the same naming conventions as we already have in <ts/ts.h>? So e.g. instead we'd have TS.HTTP_READ_REQUEST_HDR_HOOK (I ditched the TS_ prefix intentionally, since TS. sort of becomes our prefix).

Also, perhaps we should be a bit more "explicit" on the method names for adding a hook remap? E.g.

    TS.HttpHookAdd()
    TS.HttpSsnHookAdd()
    TS.HttpTxnHookAdd()

and perhaps e.g.

    TS.DoRemap()

(or some such).

This again maps to what we would use in C/C++. Even if we only implement the HttpHookAdd() for now, it avoids confusion further down the road I think?

Cheers,

-- leif

Reply via email to