]> 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 e3c91a1a311c5212069c10c851e833a2c6825d7c..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`
 
@@ -74,7 +77,10 @@ void shutdown_modules (void);
 void session_new_modules (wcsession *sess);
 void session_attach_modules (wcsession *sess);
 void session_detach_modules (wcsession *sess);
-void session_destroy_modules (wcsession *sess);
+void session_destroy_modules (wcsession **sess);
+
+void http_detach_modules (ParsedHttpHdrs *httpreq);
+void http_destroy_modules (ParsedHttpHdrs *httpreq);
 
 
 
@@ -333,7 +339,7 @@ cat <<EOF  >>$C_FILE
 }
 
 
-void session_destroy_modules (wcsession *sess)
+void session_destroy_modules (wcsession **sess)
 {
 
 EOF
@@ -344,7 +350,7 @@ cat <<EOF >> $C_FILE
 #ifdef DBG_PRINNT_HOOKS_AT_START
        lprintf (CTDL_INFO, "Initializing $HOOKNAME\n");
 #endif
-       $HOOK(sess);
+       $HOOK(*sess);
 EOF
 # Add this entry point to the .h file
 cat <<EOF >> $H_FILE
@@ -353,16 +359,81 @@ 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
 }
+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
 
 #endif /* MODULES_INIT_H */