Browse code

sl_filter_ACK no more exported and called on beginning of every script instead

Jiri Kuthan authored on 03/10/2002 20:06:10
Showing 4 changed files
... ...
@@ -96,7 +96,11 @@ int receive_msg(char* buf, unsigned int len, union sockaddr_union* src_su)
96 96
 	DBG("After parse_msg...\n");
97 97
 
98 98
 	/* execute pre-script callbacks, if any; -jiri */
99
-	exec_pre_cb(msg);
99
+	/* if some of the callbacks said not to continue with
100
+	   script processing, don't do so
101
+	*/
102
+	if (exec_pre_cb(msg)==0) goto error;
103
+
100 104
 	/* ... and clear branches from previous message */
101 105
 	clear_branches();
102 106
 
... ...
@@ -67,10 +67,15 @@ int register_script_cb( cb_function f, callback_t t, void *param )
67 67
 	return 1;
68 68
 }
69 69
 
70
-void exec_pre_cb( struct sip_msg *msg)
70
+int exec_pre_cb( struct sip_msg *msg)
71 71
 {
72 72
 	struct script_cb *i;
73
-	for (i=pre_cb; i; i=i->next) i->cbf(msg, i->param);
73
+	for (i=pre_cb; i; i=i->next) {
74
+		/* stop on error */
75
+		if (i->cbf(msg, i->param)==0)
76
+			return 0;
77
+	}
78
+	return 1;
74 79
 }
75 80
 
76 81
 void exec_post_cb( struct sip_msg *msg)
... ...
@@ -44,7 +44,7 @@ struct script_cb{
44 44
 };
45 45
 
46 46
 int register_script_cb( cb_function f, callback_t t, void *param );
47
-void exec_pre_cb( struct sip_msg *msg);
47
+int exec_pre_cb( struct sip_msg *msg);
48 48
 void exec_post_cb( struct sip_msg *msg);
49 49
 
50 50
 
... ...
@@ -60,6 +60,10 @@ struct sr_module* modules=0;
60 60
         extern struct module_exports* usrloc_exports();
61 61
 #endif
62 62
 
63
+#ifdef STATIC_SL
64
+        extern struct module_exports* sl_exports();
65
+#endif
66
+
63 67
 
64 68
 /* initializes statically built (compiled in) modules*/
65 69
 int register_builtin_modules()
... ...
@@ -96,6 +100,11 @@ int register_builtin_modules()
96 96
 	ret=register_module(usrloc_exports, "built-in", 0);
97 97
 	if (ret<0) return ret;
98 98
 #endif
99
+
100
+#ifdef STATIC_SL
101
+	ret=register_module(sl_exports, "built-in", 0);
102
+	if (ret<0) return ret;
103
+#endif
99 104
 	
100 105
 	return ret;
101 106
 }