[soc]configuration backend

Mingwang mingwxia at gmail.com
Fri Jul 14 10:10:40 GMT 2006


hi,
  This project uses libelektra as the backend, it provides a
registry-like parameter holder. And the storage backend behind it can
be file system,berkeleydb,ini,etc. I have implement APIs to access
global and service parameter as:

char* getGlobalParam(const char *paramName);
int   setGlobalParam(const char *paramName,char *value);
char* getServiceParam(ServiceCtx *serviceCtx,const char *paramName);
int   setServiceParam(ServiceCtx *serviceCtx,const char *paramName,
char *value);

and as in loadparm.c, I used alloc_sub_basic() to substitute all %*.
Now these functions works in multiple smbd process and modification of
parameter can immediately get by next time any process access it.
  The ServiceCtx are simplely defined as:
typedef struct serviceCtx{
    char *serviceName;
    char *userName;
    char *clientIp;
} ServiceCtx;
which I only used the serviceName to help search parameters in
registry.Any comments on these?

Because there are different type of parameter(string,int,list,etc),
I'm wondering the API add a structure to hold returned paramters, such
as:
getGlobalParam(const char *paramName, ParamValue *pv);
struct pv{
   TYPE type;
   char *s;
   int i;
   LIST l;
};
Since these API interact with many other parts, whether people like it
these way or not is important. :)

-- 
Cheers,
Mingwang


More information about the samba-technical mailing list