MOD_FILE="$CUR_DIR/Make_modules"
SRC_FILE="$CUR_DIR/Make_sources"
U_FILE="$CUR_DIR/modules_upgrade.c"
+L_FILE="$CUR_DIR/language_list.h"
/usr/bin/printf "Scanning extension modules for entry points.\n"
# server lifetime:
START_FUNCS=`grep ServerStartModule_ *.c |sed "s;.*:;;" |sort -u`
INIT_FUNCS=`grep InitModule_ *.c |sed "s;.*:;;" |sort -u`
+INIT2_FUNCS=`grep InitModule2_ *.c |sed "s;.*:;;" |sort -u`
FINALIZE_FUNCS=`grep FinalizeModule_ *.c |sed "s;.*:;;" |sort -u`
SHUTDOWN_FUNCS=`grep ServerShutdownModule_ *.c |sed "s;.*:;;" |sort -u`
SESS_DETACH_FUNCS=`grep SessionDetachModule_ *.c |sed "s;.*:;;" |sort -u`
SESS_DESTROY_FUNCS=`grep SessionDestroyModule_ *.c |sed "s;.*:;;" |sort -u`
+HTTP_NEW_FUNCS=`grep HttpNewModule_ *.c |sed "s;.*:;;" |sort -u`
+HTTP_DETACH_FUNCS=`grep HttpDetachModule_ *.c |sed "s;.*:;;" |sort -u`
+HTTP_DESTROY_FUNCS=`grep HttpDestroyModule_ *.c |sed "s;.*:;;" |sort -u`
+
#SESS_NEW_FUNCS=`grep SessionNewModule_ *.c |sed "s;.*:;;" |sort -u`
* server lifetime:
*/
void initialise_modules (void);
+void initialise2_modules (void);
void start_modules (void);
void shutdown_modules (void);
void session_detach_modules (wcsession *sess);
void session_destroy_modules (wcsession **sess);
+void http_new_modules (ParsedHttpHdrs *httpreq);
+void http_detach_modules (ParsedHttpHdrs *httpreq);
+void http_destroy_modules (ParsedHttpHdrs *httpreq);
+
/*
# Add this entry point to the .c file
cat <<EOF >> $C_FILE
#ifdef DBG_PRINNT_HOOKS_AT_START
- lprintf (CTDL_INFO, "Starting $HOOKNAME\n");
+ syslog(CTDL_INFO, "Starting $HOOKNAME\n");
#endif
$HOOK();
EOF
# Add this entry point to the .c file
cat <<EOF >> $C_FILE
#ifdef DBG_PRINNT_HOOKS_AT_START
- lprintf (CTDL_INFO, "Initializing $HOOKNAME\n");
+ syslog(CTDL_INFO, "Initializing $HOOKNAME\n");
#endif
$HOOK();
EOF
EOF
done
+#********************************************************************************
+# server module ******** initialisation ******** second stage.
+#********************************************************************************
+cat <<EOF >> $H_FILE
+
+/* Server Init Hooks: */
+EOF
+
+cat <<EOF >>$C_FILE
+}
+
+
+void initialise2_modules (void)
+{
+
+EOF
+for HOOK in $INIT2_FUNCS; do
+ HOOKNAME=`echo $HOOK |sed "s;InitModule2_;;"`
+# Add this entry point to the .c file
+ cat <<EOF >> $C_FILE
+#ifdef DBG_PRINNT_HOOKS_AT_START
+ syslog(CTDL_INFO, "Initializing $HOOKNAME\n");
+#endif
+ $HOOK();
+EOF
+# Add this entry point to the .h file
+ cat <<EOF >> $H_FILE
+extern void $HOOK(void);
+EOF
+done
# Add this entry point to the .c file
cat <<EOF >> $C_FILE
#ifdef DBG_PRINNT_HOOKS_AT_START
- lprintf (CTDL_INFO, "Shutting down $HOOKNAME\n");
+ syslog(CTDL_INFO, "Shutting down $HOOKNAME\n");
#endif
$HOOK();
EOF
# Add this entry point to the .c file
cat <<EOF >> $C_FILE
#ifdef DBG_PRINNT_HOOKS_AT_START
- lprintf (CTDL_INFO, "Initializing $HOOKNAME\n");
+ syslog(CTDL_INFO, "Initializing $HOOKNAME\n");
#endif
$HOOK(sess);
EOF
# Add this entry point to the .c file
cat <<EOF >> $C_FILE
#ifdef DBG_PRINNT_HOOKS_AT_START
- lprintf (CTDL_INFO, "Attaching Session; $HOOKNAME\n");
+ syslog(CTDL_INFO, "Attaching Session; $HOOKNAME\n");
#endif
$HOOK(sess);
EOF
# Add this entry point to the .c file
cat <<EOF >> $C_FILE
#ifdef DBG_PRINNT_HOOKS_AT_START
- lprintf (CTDL_INFO, "Initializing $HOOKNAME\n");
+ syslog(CTDL_INFO, "Initializing $HOOKNAME\n");
#endif
$HOOK(sess);
EOF
# Add this entry point to the .c file
cat <<EOF >> $C_FILE
#ifdef DBG_PRINNT_HOOKS_AT_START
- lprintf (CTDL_INFO, "Initializing $HOOKNAME\n");
+ syslog(CTDL_INFO, "Initializing $HOOKNAME\n");
#endif
$HOOK(*sess);
EOF
done
+cat <<EOF >>$C_FILE
+ free((*sess));
+ (*sess) = NULL;
+}
+
+
+EOF
+
+#********************************************************************************
+# NEW-Httprequest module logic.
+#********************************************************************************
+cat <<EOF >> $C_FILE
+
+void http_new_modules (ParsedHttpHdrs *httpreq)
+{
+EOF
+
+for HOOK in $HTTP_NEW_FUNCS; do
+HOOKNAME=`echo $HOOK |sed "s;HttpNewModule_;;"`
+# Add this entry point to the .c file
+cat <<EOF >> $C_FILE
+#ifdef DBG_PRINNT_HOOKS_AT_START
+ syslog(CTDL_INFO, "NEW $HOOKNAME\n");
+#endif
+ $HOOK(httpreq);
+EOF
+# Add this entry point to the .h file
+cat <<EOF >> $H_FILE
+extern void $HOOK(ParsedHttpHdrs *httpreq);
+EOF
+done
+
cat <<EOF >>$C_FILE
- free((*sess));
- (*sess) = NULL;
}
+EOF
+#********************************************************************************
+# DETACH-Httprequest module logic.
+#********************************************************************************
+cat <<EOF >> $C_FILE
+
+void http_detach_modules (ParsedHttpHdrs *httpreq)
+{
+EOF
+
+for HOOK in $HTTP_DETACH_FUNCS; do
+HOOKNAME=`echo $HOOK |sed "s;HttpDetachModule_;;"`
+# Add this entry point to the .c file
+cat <<EOF >> $C_FILE
+#ifdef DBG_PRINNT_HOOKS_AT_START
+ syslog(CTDL_INFO, "Detaching $HOOKNAME\n");
+#endif
+ $HOOK(httpreq);
+EOF
+# Add this entry point to the .h file
+cat <<EOF >> $H_FILE
+extern void $HOOK(ParsedHttpHdrs *httpreq);
+EOF
+done
+
+cat <<EOF >>$C_FILE
+}
+EOF
+
+
+#********************************************************************************
+# DESTROY-Httprequest module logic.
+#********************************************************************************
+cat <<EOF >> $C_FILE
+
+void http_destroy_modules (ParsedHttpHdrs *httpreq)
+{
+EOF
+
+for HOOK in $HTTP_DESTROY_FUNCS; do
+HOOKNAME=`echo $HOOK |sed "s;HttpDestroyModule_;;"`
+# Add this entry point to the .c file
+cat <<EOF >> $C_FILE
+#ifdef DBG_PRINNT_HOOKS_AT_START
+ syslog(CTDL_INFO, "Destructing $HOOKNAME\n");
+#endif
+ $HOOK(httpreq);
+EOF
+# Add this entry point to the .h file
+cat <<EOF >> $H_FILE
+extern void $HOOK(ParsedHttpHdrs *httpreq);
+EOF
+done
+
+cat <<EOF >>$C_FILE
+}
EOF
+
+
+
+
+
cat <<EOF >> $H_FILE
#endif /* MODULES_INIT_H */
EOF
+
+
+### Now see what language modules we have installed ###
+/usr/bin/printf "Scanning language modules.\n"
+
+cat >$L_FILE <<EOF
+/* This file is generated automatically by mk_module_init.sh
+ * Editing it by hand would be an exercise in futility.
+ */
+const char *AvailLang[] = {
+ "C",
+EOF
+
+for x in po/webcit/*.po
+do
+ echo \ \"`basename $x | sed s/\.po\$//g`\",
+done >>$L_FILE
+
+cat >>$L_FILE <<EOF
+ ""
+};
+EOF