tabularize parameters to be passed to vcc

Parameters are passed to vcc via specific setter functions, presumably
to avoid binary compability issues between the main program (here:
vanishd) and a library (here: libvcc).

This commit does not change that interface in any way, but generates
both sides from a common table include to avoid having to edit five
spots in four different source files and write trivial setter functions
for a simple mgt_vcc parameter change.
parent d0a89676
......@@ -221,10 +221,8 @@ int mgt_has_vcl(void);
extern char *mgt_cc_cmd;
extern const char *mgt_vcl_path;
extern const char *mgt_vmod_path;
extern unsigned mgt_vcc_err_unref;
extern unsigned mgt_vcc_acl_pedantic;
extern unsigned mgt_vcc_allow_inline_c;
extern unsigned mgt_vcc_unsafe_path;
#define MGT_VCC(t, n, cc) extern t mgt_vcc_ ## n;
#include <tbl/mgt_vcc.h>
#if defined(PTHREAD_CANCELED) || defined(PTHREAD_MUTEX_DEFAULT)
#error "Keep pthreads out of in manager process"
......
......@@ -65,11 +65,8 @@ struct vcc_priv {
char *mgt_cc_cmd;
const char *mgt_vcl_path;
const char *mgt_vmod_path;
unsigned mgt_vcc_err_unref;
unsigned mgt_vcc_allow_inline_c;
unsigned mgt_vcc_unsafe_path;
unsigned mgt_vcc_acl_pedantic;
#define MGT_VCC(t, n, cc) t mgt_vcc_ ## n;
#include <tbl/mgt_vcc.h>
#define VGC_SRC "vgc.c"
#define VGC_LIB "vgc.so"
......@@ -107,10 +104,11 @@ run_vcc(void *priv)
VCC_Builtin_VCL(vcc, builtin_vcl);
VCC_VCL_path(vcc, mgt_vcl_path);
VCC_VMOD_path(vcc, mgt_vmod_path);
VCC_Err_Unref(vcc, mgt_vcc_err_unref);
VCC_Allow_InlineC(vcc, mgt_vcc_allow_inline_c);
VCC_Unsafe_Path(vcc, mgt_vcc_unsafe_path);
VCC_Acl_Pedantic(vcc, mgt_vcc_acl_pedantic);
#define MGT_VCC(type, name, camelcase) \
VCC_ ## camelcase (vcc, mgt_vcc_ ## name);
#include "tbl/mgt_vcc.h"
STV_Foreach(stv)
VCC_Predef(vcc, "VCL_STEVEDORE", stv->ident);
VTAILQ_FOREACH(vpg, &vclhead, list)
......
......@@ -22,6 +22,7 @@ nobase_pkginclude_HEADERS = \
tbl/http_headers.h \
tbl/http_response.h \
tbl/locks.h \
tbl/mgt_vcc.h \
tbl/obj_attr.h \
tbl/oc_exp_flags.h \
tbl/oc_flags.h \
......
......@@ -33,15 +33,15 @@
struct vcc;
struct vcc *VCC_New(void);
void VCC_Allow_InlineC(struct vcc *, unsigned);
void VCC_Builtin_VCL(struct vcc *, const char *);
void VCC_Err_Unref(struct vcc *, unsigned);
void VCC_Unsafe_Path(struct vcc *, unsigned);
void VCC_Acl_Pedantic(struct vcc *, unsigned);
void VCC_VCL_path(struct vcc *, const char *);
void VCC_VMOD_path(struct vcc *, const char *);
void VCC_Predef(struct vcc *, const char *type, const char *name);
void VCC_VCL_Range(unsigned *, unsigned *);
#define MGT_VCC(t, n, cc) \
void VCC_ ## cc (struct vcc *, t);
#include "tbl/mgt_vcc.h"
int VCC_Compile(struct vcc *, struct vsb **,
const char *, const char *, const char *, const char *);
MGT_VCC(unsigned, acl_pedantic, Acl_Pedantic)
MGT_VCC(unsigned, allow_inline_c, Allow_InlineC)
MGT_VCC(unsigned, err_unref, Err_Unref)
MGT_VCC(unsigned, unsafe_path, Unsafe_Path)
#undef MGT_VCC
......@@ -889,37 +889,13 @@ VCC_VMOD_path(struct vcc *vcc, const char *str)
* Configure settings
*/
void
VCC_Err_Unref(struct vcc *vcc, unsigned u)
{
CHECK_OBJ_NOTNULL(vcc, VCC_MAGIC);
vcc->err_unref = u;
}
void
VCC_Allow_InlineC(struct vcc *vcc, unsigned u)
{
CHECK_OBJ_NOTNULL(vcc, VCC_MAGIC);
vcc->allow_inline_c = u;
}
void
VCC_Unsafe_Path(struct vcc *vcc, unsigned u)
{
CHECK_OBJ_NOTNULL(vcc, VCC_MAGIC);
vcc->unsafe_path = u;
}
void
VCC_Acl_Pedantic(struct vcc *vcc, unsigned u)
{
CHECK_OBJ_NOTNULL(vcc, VCC_MAGIC);
vcc->acl_pedantic = u;
}
#define MGT_VCC(type, name, camelcase) \
void VCC_ ## camelcase (struct vcc *vcc, type val) \
{ \
CHECK_OBJ_NOTNULL(vcc, VCC_MAGIC); \
vcc->name = val; \
}
#include "tbl/mgt_vcc.h"
/*--------------------------------------------------------------------
* Configure settings
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment