]> code.citadel.org Git - citadel.git/blobdiff - webcit/mk_module_init.sh
* start moving the hdr struct up, and add detach callback. Unfinished.
[citadel.git] / webcit / mk_module_init.sh
index b46d4e38950c9a8c477b79cbf82725b448828929..17bf2729896c48a11cbfc75312c0ee6ec8b5fd9a 100755 (executable)
@@ -43,6 +43,9 @@ SESS_ATTACH_FUNCS=`grep SessionAttachModule_ *.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_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`
 
@@ -76,6 +79,9 @@ void session_attach_modules (wcsession *sess);
 void session_detach_modules (wcsession *sess);
 void session_destroy_modules (wcsession **sess);
 
+void http_detach_modules (ParsedHttpHdrs *httpreq);
+void http_destroy_modules (ParsedHttpHdrs *httpreq);
+
 
 
 /*
@@ -353,16 +359,79 @@ 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
+       lprintf (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
-       free((*sess));
-       (*sess) = NULL;
 }
+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
+       lprintf (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