Przeglądaj źródła

core: fire core event on each executed cfg action

- used for cfg execution tracing and interactive debugging (the new
module debugger)
Daniel-Constantin Mierla 15 lat temu
rodzic
commit
c2d36c17f9
1 zmienionych plików z 7 dodań i 0 usunięć
  1. 7 0
      action.c

+ 7 - 0
action.c

@@ -90,6 +90,7 @@
 #include "sctp_server.h"
 #include "sctp_server.h"
 #endif
 #endif
 #include "switch.h"
 #include "switch.h"
+#include "events.h"
 
 
 #include <sys/types.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/socket.h>
@@ -133,6 +134,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
 	struct rvalue* rv1;
 	struct rvalue* rv1;
 	struct rval_cache c1;
 	struct rval_cache c1;
 	str s;
 	str s;
+	void *srevp[2];
 
 
 	/* reset the value of error to E_UNSPEC so avoid unknowledgable
 	/* reset the value of error to E_UNSPEC so avoid unknowledgable
 	   functions to return with error (status<0) and not setting it
 	   functions to return with error (status<0) and not setting it
@@ -141,6 +143,11 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
 	prev_ser_error=ser_error;
 	prev_ser_error=ser_error;
 	ser_error=E_UNSPEC;
 	ser_error=E_UNSPEC;
 
 
+	/* hook for every executed action (in use by cfg debugger) */
+	srevp[0] = (void*)a;
+	srevp[1] = (void*)msg;
+	sr_event_exec(SREV_CFG_RUN_ACTION, (void*)srevp);
+
 	ret=E_BUG;
 	ret=E_BUG;
 	switch ((unsigned char)a->type){
 	switch ((unsigned char)a->type){
 		case DROP_T:
 		case DROP_T: