* start moving the hdr struct up, and add detach callback. Unfinished.
[citadel.git] / webcit / mk_module_init.sh
index 61fe9318afba03dae8685ea3e123562aa33ecb18..17bf2729896c48a11cbfc75312c0ee6ec8b5fd9a 100755 (executable)
@@ -43,6 +43,7 @@ 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`
 
 
@@ -78,6 +79,7 @@ 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);
 
 
@@ -369,6 +371,35 @@ 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
+}
+EOF
+
+
 #********************************************************************************
 # DESTROY-Httprequest module logic.
 #********************************************************************************