diff --git a/libsofia-sip-ua/tport/tport_internal.h b/libsofia-sip-ua/tport/tport_internal.h index e639ec60..b7cd98f2 100644 --- a/libsofia-sip-ua/tport/tport_internal.h +++ b/libsofia-sip-ua/tport/tport_internal.h @@ -308,6 +308,7 @@ struct tport_master { tport_primary_t *mr_primaries; /**< List of primary contacts */ unsigned mr_prot_ver; /* hep version */ unsigned mr_agent_id; /* agent version */ + char *mr_agent_nodename; /* agent node name */ tport_params_t mr_params[1]; diff --git a/libsofia-sip-ua/tport/tport_logging.c b/libsofia-sip-ua/tport/tport_logging.c index 47f80316..a5f7595a 100644 --- a/libsofia-sip-ua/tport/tport_logging.c +++ b/libsofia-sip-ua/tport/tport_logging.c @@ -191,7 +191,7 @@ int tport_open_log(tport_master_t *mr, tagi_t *tags) /* default values for capture protocol and agent id */ mr->mr_prot_ver = 3; mr->mr_agent_id = 200; - + mr->mr_agent_nodename = "default"; /* get all params */ while(p) { @@ -225,6 +225,10 @@ int tport_open_log(tport_master_t *mr, tagi_t *tags) return n; } } + else if(strncmp(p, "capture_nodename=", 17) == 0) { + p+=17; + mr->mr_agent_nodename = p; + } else { su_log("unsupported capture param\n"); return n; @@ -600,6 +604,7 @@ int tport_capt_msg_hepv3 (tport_t const *self, msg_t *msg, size_t n, su_time_t now; hep_chunk_ip4_t src_ip4 = {{0}}, dst_ip4 = {{0}}; hep_chunk_t payload_chunk; + hep_chunk_t nodename_chunk; int orig_n = 0; #if SU_HAVE_IN6 @@ -757,6 +762,13 @@ int tport_capt_msg_hepv3 (tport_t const *self, msg_t *msg, size_t n, tlen = sizeof(struct hep_generic) + payload_len + iplen + sizeof(hep_chunk_t); + /* NODE NAME */ + tlen += sizeof(hep_chunk_t); + nodename_chunk.vendor_id = htons(0x0000); + nodename_chunk.type_id = htons(0x0013); + nodename_chunk.length = htons(sizeof(nodename_chunk) + strlen(mr->mr_agent_nodename)); + tlen += strlen(mr->mr_agent_nodename); + /* total */ hg->header.length = htons(tlen); @@ -791,6 +803,13 @@ int tport_capt_msg_hepv3 (tport_t const *self, msg_t *msg, size_t n, } #endif + /* NODE NAME */ + memcpy((void*) buffer + buflen, &nodename_chunk, sizeof(struct hep_chunk)); + buflen += sizeof(struct hep_chunk); + /* Now copying payload self */ + memcpy((void*) buffer + buflen, mr->mr_agent_nodename, strlen(mr->mr_agent_nodename)); + buflen += strlen(mr->mr_agent_nodename); + /* PAYLOAD CHUNK */ memcpy((char*) *buffer+buflen, &payload_chunk, sizeof(struct hep_chunk)); buflen += sizeof(struct hep_chunk);