* History
* -------
* 2007-12-03 Initial version (Miklos)
+ * 2008-01-24 dynamic groups are introduced in order to make
+ * variable declaration possible in the script (Miklos)
*/
#ifndef _CFG_STRUCT_H
It is registered when the group is created,
and updated every time the block is replaced */
+ unsigned char dynamic; /* indicates whether the variables within the group
+ are dynamically allocated or not */
struct _cfg_group *next;
int name_len;
char name[1];
/* per-child process init function */
int cfg_child_init(void);
+/* per-child process destroy function
+ * Should be called only when the child process exits,
+ * but SER continues running.
+ *
+ * WARNING: this function call must be the very last action
+ * before the child process exits, because the local config
+ * is not available afterwards.
+ */
+void cfg_child_destroy(void);
+
/* creates a new cfg group, and adds it to the linked list */
-int cfg_new_group(char *name, int num, cfg_mapping_t *mapping,
+cfg_group_t *cfg_new_group(char *name, int name_len,
+ int num, cfg_mapping_t *mapping,
char *vars, int size, void **handle);
/* copy the variables to shm mem */
if (unlikely(cfg_local != *cfg_global)) \
cfg_update_local(); \
} while(0)
+
+/* searches a group by name */
+cfg_group_t *cfg_lookup_group(char *name, int len);
/* searches a variable definition by group and variable name */
int cfg_lookup_var(str *gname, str *vname,
cfg_block_t *cfg_clone_global(void);
/* clones a string to shared memory */
-char *cfg_clone_str(str s);
+int cfg_clone_str(str *src, str *dst);
+
+/* append new callbacks to the end of the child callback list
+ *
+ * WARNING: the function is unsafe, either hold CFG_LOCK(),
+ * or call the function before forking
+ */
+void cfg_install_child_cb(cfg_child_cb_t *cb_first, cfg_child_cb_t *cb_last);
/* installs a new global config
*