I am working on adding a couple of configuration variables and have run in to 
the problem of sharing enumerations between the plugin API and the internals. 
As far as I can tell this is currently done in one of two ways:

1) Use straight numeric values (e.g. "if (share_server_session == 2)")

2) Have multiple copies of the enum definition (e.g. "The values of this enum 
must match enum RecModeT in I_RecDefs.h")

I find both of these inferior solutions. A key issue here is that the ts.h that 
is provided to plugins cannot reach in to the source tree (because it may not 
even exist on plugin build system). Hence these kludges.

What I propose is a mechanism in the processing of ts.h.in that allows direct 
inclusion of other header files. In that case the shared enumerations could be 
placed in a separate file and that single definition shared across ATS. For 
instance, I need an enum for the value of the shared server session matching 
value. I would put that in a file, say, proxy/http/SharedServerEnum.h and 
include that in any internal logic. In ts.h.in I would put something like 
"@include "proxy/http/SharedServerEnum.h" which would directly include the 
contents of that file in ts.h. Then we get effectively solution (2) but 
*without* the maintenance problems it currently causes.

Does this seem reasonable? Does this already exist and I have just missed it?

Reply via email to