int dump_proto_packet(struct pcap_pkthdr *pkthdr, u_char *packet, uint8_t proto, unsigned char *data, uint32_t len, const char *ip_src, const char *ip_dst, uint16_t sport, uint16_t dport, uint8_t flags, uint16_t hdr_offset, uint8_t frag, uint16_t frag_offset, uint32_t frag_id, uint32_t ip_ver) { struct timeval tv; time_t curtime; char timebuffer[30]; rc_info_t *rcinfo = NULL; gettimeofday(&tv,NULL); curtime = tv.tv_sec; strftime(timebuffer,30,"%m-%d-%Y %T.",localtime(&curtime)); if(!memcmp(data, "\x48\x45\x50\x33",4)) { hepv3_received(data, len); } else { printf("NOT HEP3\n"); } return -1; /* rcinfo = malloc(sizeof(rc_info_t)); memset(rcinfo, 0, sizeof(rc_info_t)); rcinfo->src_port = sport; rcinfo->dst_port = dport; rcinfo->src_ip = (char *) ip_src; rcinfo->dst_ip = (char *) ip_dst; rcinfo->ip_family = ip_ver = 4 ? AF_INET : AF_INET6 ; rcinfo->ip_proto = proto; rcinfo->time_sec = pkthdr->ts.tv_sec; rcinfo->time_usec = pkthdr->ts.tv_usec; rcinfo->proto_type = PROTO_SIP; if(rcinfo) free(rcinfo); */ return 1; }
/* int hep_msg_received(char * buf, unsigned int len, struct receive_info * ri) */ int hep_msg_received(void *data) { void **srevp; char *buf; unsigned *len; struct receive_info *ri; if(!hep_capture_on) { LOG(L_ERR, "sipcapture:hep_msg_received HEP is not enabled\n"); return -1; } srevp = (void**)data; buf = (char *)srevp[0]; len = (unsigned *)srevp[1]; ri = (struct receive_info *)srevp[2]; correlation_id = NULL; authkey = NULL; count++; struct hep_hdr *heph; /* hep_hdr */ heph = (struct hep_hdr*) buf; /* Check version */ if(heph->hp_v == 1 || heph->hp_v == 2) { return hepv2_received(buf, *len, ri); } else if(!memcmp(buf, "\x48\x45\x50\x33",4)) { return hepv3_received(buf, *len, ri); } else { LOG(L_ERR, "ERROR: sipcapture:hep_msg_received: not supported version or bad length: v:[%d] l:[%d]\n", heph->hp_v, heph->hp_l); return -1; } }