Răsfoiți Sursa

core: added msg_send_buffer() function to allow skipping execution of core events

- useful for non-sip messages sent out to skip execution of
  SREV_NET_DATA_OUT, like HEP packets for sipcapture
- msg_send() is now a defined alias for msg_send_buffer()
Daniel-Constantin Mierla 9 ani în urmă
părinte
comite
526fb4cdc2
1 a modificat fișierele cu 8 adăugiri și 2 ștergeri
  1. 8 2
      forward.h

+ 8 - 2
forward.h

@@ -97,6 +97,7 @@ void forward_set_send_info(int v);
 
 int is_check_self_func_list_set(void);
 
+#define msg_send(_dst, _buf, _len) msg_send_buffer((_dst), (_buf), (_len), 0)
 
 /* params:
  * dst = struct dest_info containing:
@@ -109,9 +110,12 @@ int is_check_self_func_list_set(void);
  *        (useful for sending replies on  the same connection as the request
  *         that generated them; use 0 if you don't want this)
  * buf, len = buffer
+ * flags = control internal behavior
+ *    * 1 - skip executing event SREV_NET_DATA_OUT
  * returns: 0 if ok, -1 on error*/
 
-static inline int msg_send(struct dest_info* dst, char* buf, int len)
+static inline int msg_send_buffer(struct dest_info* dst, char* buf, int len,
+		int flags)
 {
 	struct dest_info new_dst;
 	str outb;
@@ -127,7 +131,9 @@ static inline int msg_send(struct dest_info* dst, char* buf, int len)
 	
 	outb.s = buf;
 	outb.len = len;
-	sr_event_exec(SREV_NET_DATA_OUT, (void*)&outb);
+	if(!(flags&1)) {
+		sr_event_exec(SREV_NET_DATA_OUT, (void*)&outb);
+	}
 
 	if(outb.s==NULL) {
 		LM_ERR("failed to update outgoing buffer\n");