diff --git a/modules/sipcapture/hep.c b/modules/sipcapture/hep.c index bbafa5a4b6a..3c048560277 100644 --- a/modules/sipcapture/hep.c +++ b/modules/sipcapture/hep.c @@ -38,12 +38,13 @@ static int count = 0; -struct hep_timehdr* heptime; +struct hep_timeinfo* heptime; /* HEPv2 HEPv3 */ int hepv2_received(char *buf, unsigned int len, struct receive_info *ri); int hepv3_received(char *buf, unsigned int len, struct receive_info *ri); int parsing_hepv3_message(char *buf, unsigned int len); + /** * HEP message */ @@ -100,7 +101,7 @@ int hepv2_received(char *buf, unsigned int len, struct receive_info *ri){ struct hep_iphdr *hepiph = NULL; struct hep_timehdr* heptime_tmp = NULL; - memset(heptime, 0, sizeof(struct hep_timehdr)); + memset(heptime, 0, sizeof(struct hep_timeinfo)); struct hep_ip6hdr *hepip6h = NULL; @@ -139,7 +140,7 @@ int hepv2_received(char *buf, unsigned int len, struct receive_info *ri){ else if(heph->hp_p == IPPROTO_SCTP) ri->proto=PROTO_SCTP; #endif else { - LOG(L_ERR, "ERROR: sipcapture:hep_msg_received: unknow protocol [%d]\n",heph->hp_p); + LOG(L_ERR, "ERROR: sipcapture:hep_msg_received: unknown protocol [%d]\n",heph->hp_p); ri->proto = PROTO_NONE; } @@ -262,7 +263,7 @@ int parsing_hepv3_message(char *buf, unsigned int len) { memset(hg, 0, sizeof(struct hep_generic_recv)); - memset(heptime, 0, sizeof(struct hep_timehdr)); + memset(heptime, 0, sizeof(struct hep_timeinfo)); /* HEADER */ @@ -394,7 +395,7 @@ int parsing_hepv3_message(char *buf, unsigned int len) { case 12: hg->capt_id = (hep_chunk_uint32_t *) (tmp); i+=chunk_length; - heptime->captid = ntohs(hg->capt_id->data); + heptime->captid = ntohl(hg->capt_id->data); totelem++; break; @@ -486,7 +487,7 @@ int parsing_hepv3_message(char *buf, unsigned int len) { /*TIME*/ heptime->tv_sec = hg->time_sec->data; heptime->tv_usec = hg->time_usec->data; - heptime->captid = ntohs(hg->capt_id->data); + heptime->captid = ntohl(hg->capt_id->data); if(payload != NULL ) { @@ -514,6 +515,3 @@ int parsing_hepv3_message(char *buf, unsigned int len) { } - - - diff --git a/modules/sipcapture/hep.h b/modules/sipcapture/hep.h index c2433db990f..65f525b7b88 100644 --- a/modules/sipcapture/hep.h +++ b/modules/sipcapture/hep.h @@ -61,6 +61,12 @@ struct hep_timehdr{ u_int16_t captid; /* Capture ID node */ }; +struct hep_timeinfo{ + u_int32_t tv_sec; /* seconds */ + u_int32_t tv_usec; /* useconds */ + u_int32_t captid; /* Capture ID node */ +}; + struct hep_ip6hdr { struct in6_addr hp6_src; /* source address */ struct in6_addr hp6_dst; /* destination address */ diff --git a/modules/sipcapture/sipcapture.c b/modules/sipcapture/sipcapture.c index 7b2f4b77fef..fb999360a59 100644 --- a/modules/sipcapture/sipcapture.c +++ b/modules/sipcapture/sipcapture.c @@ -1606,7 +1606,7 @@ static int sip_capture(struct sip_msg *msg, str *_table, _capture_mode_data_t * if(heptime && heptime->tv_sec != 0) { sco.tmstamp = (unsigned long long)heptime->tv_sec*1000000+heptime->tv_usec; /* micro ts */ - snprintf(tmp_node, 100, "%.*s:%i", capture_node.len, capture_node.s, heptime->captid); + snprintf(tmp_node, 100, "%.*s:%lu", capture_node.len, capture_node.s, (unsigned long)heptime->captid); sco.node.s = tmp_node; sco.node.len = strlen(tmp_node); } @@ -2293,7 +2293,7 @@ int receive_logging_json_msg(char * buf, unsigned int len, struct hep_generic_re if(heptime && heptime->tv_sec != 0) { sco.tmstamp = (unsigned long long)heptime->tv_sec*1000000+heptime->tv_usec; /* micro ts */ - snprintf(tmp_node, 100, "%.*s:%i", capture_node.len, capture_node.s, heptime->captid); + snprintf(tmp_node, 100, "%.*s:%lu", capture_node.len, capture_node.s, (unsigned long)heptime->captid); sco.node.s = tmp_node; sco.node.len = strlen(tmp_node); epoch_time_as_time_t = heptime->tv_sec;; @@ -2463,7 +2463,7 @@ static int report_capture(struct sip_msg *msg, str *_table, str* _corr, str *_d if(heptime && heptime->tv_sec != 0) { sco.tmstamp = (unsigned long long)heptime->tv_sec*1000000+heptime->tv_usec; /* micro ts */ - snprintf(tmp_node, 100, "%.*s:%i", capture_node.len, capture_node.s, heptime->captid); + snprintf(tmp_node, 100, "%.*s:%lu", capture_node.len, capture_node.s, (unsigned long)heptime->captid); sco.node.s = tmp_node; sco.node.len = strlen(tmp_node); epoch_time_as_time_t = heptime->tv_sec;;