Forráskód Böngészése

sipcapture: updates for core events API changes

Daniel-Constantin Mierla 8 éve
szülő
commit
e67142d009

+ 3 - 3
src/modules/sipcapture/hep.c

@@ -49,7 +49,7 @@ int parsing_hepv3_message(char *buf, unsigned int len);
  * HEP message
  */
 /* int hep_msg_received(char * buf, unsigned int len, struct receive_info * ri) */
-int hep_msg_received(void *data)
+int hep_msg_received(sr_event_param_t *evp)
 {
         void **srevp;
         char *buf;
@@ -61,11 +61,11 @@ int hep_msg_received(void *data)
                 return -1;
         }
 
-        srevp = (void**)data;
+        srevp = (void**)evp->data;
 
         buf = (char *)srevp[0];
         len = (unsigned *)srevp[1];
-        ri = (struct receive_info *)srevp[2];                        
+        ri = (struct receive_info *)srevp[2];
 
 	correlation_id = NULL;
 	authkey = NULL;

+ 3 - 2
src/modules/sipcapture/hep.h

@@ -25,6 +25,7 @@
 #define _hep_h
 
 #include "../../core/endianness.h"
+#include "../../core/events.h"
 
 #ifdef __IS_BIG_ENDIAN
 #define to_le(x) bswap32(x)
@@ -45,7 +46,7 @@ extern char *authkey;
 extern char *correlation_id;
 
 /* int hep_msg_received(char * buf, unsigned int len, struct receive_info * ri);*/
-int hep_msg_received(void *data);
+int hep_msg_received(sr_event_param_t *evp);
 
 /* new method for events */
 int hepv3_message_parse(char *buf, unsigned int len, sip_msg_t* msg);
@@ -171,7 +172,7 @@ struct hep_generic_recv {
         hep_chunk_uint32_t *capt_id;
         hep_chunk_uint16_t *keep_tm;
         hep_chunk_str_t    *auth_key;
-        hep_chunk_str_t    *correlation_id;        
+        hep_chunk_str_t    *correlation_id;
         hep_chunk_t   *payload_chunk;
 } __attribute__((packed));
 

+ 18 - 18
src/modules/sipcapture/sipcapture.c

@@ -152,7 +152,7 @@ int init_rawsock_children(void);
 int extract_host_port(void);
 int raw_capture_socket(struct ip_addr* ip, str* iface, int port_start, int port_end, int proto);
 int raw_capture_rcv_loop(int rsock, int port1, int port2, int ipip);
-static int nosip_hep_msg(void *data);
+static int nosip_hep_msg(sr_event_param_t *evp);
 
 static int hep_version(struct sip_msg *msg);
 
@@ -282,7 +282,7 @@ static cmd_export_t cmds[] = {
 	{"sip_capture", (cmd_function)w_sip_capture, 2, sipcapture_fixup, 0, ANY_ROUTE },
 	{"report_capture", (cmd_function)w_report_capture, 1, reportcapture_fixup, 0, ANY_ROUTE },
 	{"report_capture", (cmd_function)w_report_capture, 2, reportcapture_fixup, 0, ANY_ROUTE },
-	{"report_capture", (cmd_function)w_report_capture, 3, reportcapture_fixup, 0, ANY_ROUTE },	
+	{"report_capture", (cmd_function)w_report_capture, 3, reportcapture_fixup, 0, ANY_ROUTE },
 	{"float2int", (cmd_function)w_float2int, 2, float2int_fixup, 0, ANY_ROUTE },
 	{0, 0, 0, 0, 0, 0}
 };
@@ -2643,7 +2643,7 @@ static int sipcapture_parse_aleg_callid_headers() {
 }
 
 
-static int nosip_hep_msg(void *data)
+static int nosip_hep_msg(sr_event_param_t *evp)
 {
         sip_msg_t* msg;
         char *buf;
@@ -2651,13 +2651,13 @@ static int nosip_hep_msg(void *data)
         struct run_act_ctx ra_ctx;
         int ret = 0;
 
-        msg = (sip_msg_t*)data;
-        
+        msg = (sip_msg_t*)evp->data;
+
         struct hep_hdr *heph;
-        
+
         buf = msg->buf;
         len = msg->len;
-        
+
         /* first send to route */
         init_run_actions_ctx(&ra_ctx);
         ret = run_actions(&ra_ctx, event_rt.rlist[hep_route_no], msg);
@@ -2666,33 +2666,33 @@ static int nosip_hep_msg(void *data)
 
         /* hep_hdr */
         heph = (struct hep_hdr*) msg->buf;
-        
+
 	if(heph->hp_v == 1 || heph->hp_v == 2)  {
 
 		LOG(L_ERR, "ERROR: HEP v 1/2: v:[%d] l:[%d]\n",heph->hp_v, heph->hp_l);
-		if((len = hepv2_message_parse(buf, len, msg)) < 0) 
-		{		
+		if((len = hepv2_message_parse(buf, len, msg)) < 0)
+		{
    		     LOG(L_ERR, "ERROR: during hepv2 parsing :[%d]\n", len);
    		     return 0;
                 }
-                
+
                 buf = msg->buf+len;
 		len = msg->len - len;
-				
+
 		msg->buf = buf;
                 msg->len = len;
         }
         else if(!memcmp(msg->buf, "\x48\x45\x50\x33",4) || !memcmp(msg->buf, "\x45\x45\x50\x31",4)) {
 
-                if((len = hepv3_message_parse(buf, len, msg)) < 0) 
-		{		
+                if((len = hepv3_message_parse(buf, len, msg)) < 0)
+		{
    		     LOG(L_ERR, "ERROR: during hepv3 parsing :[%d]\n", len);
    		     return 0;
                 }
-                
+
                 buf = msg->buf+len;
                 len = msg->len - len;
-                
+
                 msg->buf = buf;
                 msg->len = len;
         }
@@ -2704,10 +2704,10 @@ static int nosip_hep_msg(void *data)
         }
 
         if (parse_msg(buf, len, msg)!=0) {
-             LOG(L_ERR, "couldn't parse sip message\n");               
+             LOG(L_ERR, "couldn't parse sip message\n");
              return -1;
         }
-        
+
         return ret;
 }