Skip to content

Commit

Permalink
core: enable updating received data via $rcv(buf)
Browse files Browse the repository at this point in the history
- on event_route[core:msg-received]
  • Loading branch information
miconda committed Apr 8, 2022
1 parent f10f3b5 commit d5e2988
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/core/ip_addr.h
Expand Up @@ -203,6 +203,7 @@ typedef struct ksr_coninfo {

typedef struct sr_net_info {
str data;
unsigned int bufsize;
receive_info_t* rcv;
dest_info_t* dst;
} sr_net_info_t;
Expand Down
8 changes: 5 additions & 3 deletions src/core/receive.c
Expand Up @@ -161,7 +161,7 @@ sr_net_info_t *ksr_evrt_rcvnetinfo_get(void)
/**
*
*/
int ksr_evrt_received(char *buf, unsigned int len, receive_info_t *rcv_info)
int ksr_evrt_received(char *buf, unsigned int *len, receive_info_t *rcv_info)
{
sr_kemi_eng_t *keng = NULL;
sr_net_info_t netinfo;
Expand Down Expand Up @@ -192,7 +192,8 @@ int ksr_evrt_received(char *buf, unsigned int len, receive_info_t *rcv_info)
}
memset(&netinfo, 0, sizeof(sr_net_info_t));
netinfo.data.s = buf;
netinfo.data.len = len;
netinfo.data.len = *len;
netinfo.bufsize = BUF_SIZE;
netinfo.rcv = rcv_info;

ksr_evrt_rcvnetinfo = &netinfo;
Expand All @@ -212,6 +213,7 @@ int ksr_evrt_received(char *buf, unsigned int len, receive_info_t *rcv_info)
LM_DBG("dropping received message\n");
ret = -1;
}
*len = netinfo.data.len;
ksr_evrt_rcvnetinfo = NULL;

return ret;
Expand Down Expand Up @@ -312,7 +314,7 @@ int receive_msg(char *buf, unsigned int len, receive_info_t *rcv_info)
}

if(ksr_evrt_received_mode!=0) {
if(ksr_evrt_received(buf, len, rcv_info)<0) {
if(ksr_evrt_received(buf, &len, rcv_info)<0) {
LM_DBG("dropping the received message\n");
goto error00;
}
Expand Down

0 comments on commit d5e2988

Please sign in to comment.