aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ppcap.c
diff options
context:
space:
mode:
authorwmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7>2012-07-25 14:39:32 +0000
committerwmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7>2012-07-25 14:39:32 +0000
commitd0d17c57c40667d9b9ae33d5e1a4a0011136cf24 (patch)
treee52014936663603bca64c185ea5946b017cf50da /epan/dissectors/packet-ppcap.c
parent5f3b1312f7883bbf322028055baefbf5cedf4152 (diff)
Minor cleanup:
- col_clear() not required; - use #if 0/#endif to comment out code (iso /* ... */) - whitespace. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@43996 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-ppcap.c')
-rw-r--r--epan/dissectors/packet-ppcap.c402
1 files changed, 201 insertions, 201 deletions
diff --git a/epan/dissectors/packet-ppcap.c b/epan/dissectors/packet-ppcap.c
index 9e8c60a28c..84e0e9941d 100644
--- a/epan/dissectors/packet-ppcap.c
+++ b/epan/dissectors/packet-ppcap.c
@@ -21,7 +21,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- */
+ */
#ifdef HAVE_CONFIG_H
@@ -36,41 +36,41 @@
static guint8 ssn;
-static dissector_handle_t ppcap_handle;
+static dissector_handle_t ppcap_handle;
static dissector_handle_t mtp3_handle; /* MTP3 handle */
static dissector_handle_t tcap_handle; /* TCAP handle */
-static dissector_handle_t bssap_handle; /* BSSAP handle */
+static dissector_handle_t bssap_handle; /* BSSAP handle */
static dissector_handle_t ranap_handle; /* RANAP handle */
static dissector_handle_t h248_handle; /* H248 handle */
static dissector_handle_t sip_handle; /* SIP handle */
-static dissector_handle_t sccp_handle; /* SCCP handle */
-static dissector_handle_t data_handle; /* DATA handle */
+static dissector_handle_t sccp_handle; /* SCCP handle */
+static dissector_handle_t data_handle; /* DATA handle */
static dissector_table_t sccp_ssn_dissector_table;
-static mtp3_addr_pc_t* mtp3_addr_opc;
-static mtp3_addr_pc_t* mtp3_addr_dpc;
+static mtp3_addr_pc_t* mtp3_addr_opc;
+static mtp3_addr_pc_t* mtp3_addr_dpc;
-static gint ett_ppcap=-1;
-static gint ett_ppcap1=-1;
-static gint ett_ppcap_new=-1;
+static gint ett_ppcap = -1;
+static gint ett_ppcap1 = -1;
+static gint ett_ppcap_new = -1;
static const value_string payload_tag_values[] = {
-{1, "Payload Type"},
-{2, "Payload Data"},
-{3, "Source Address"},
-{4, "Destination Address"},
-{256, "Info String"},
-{0, NULL},
+ { 1, "Payload Type"},
+ { 2, "Payload Data"},
+ { 3, "Source Address"},
+ { 4, "Destination Address"},
+ {256, "Info String"},
+ {0, NULL},
};
static const value_string address_type_values[] = {
-{1, "SSN+SPC"},
-{2, "SPC"},
-{3, "IP Address"},
-{4, "Node Id"},
-{0, NULL},
+ {1, "SSN+SPC"},
+ {2, "SPC"},
+ {3, "IP Address"},
+ {4, "Node Id"},
+ {0, NULL},
};
@@ -115,11 +115,11 @@ typedef enum {
PPCAP_SCCP = 7
} payload_type_type;
-static int dissect_ppcap_payload_type(tvbuff_t *,proto_tree *,int,guint16, payload_type_type *);
-static int dissect_ppcap_source_address(tvbuff_t *,packet_info *,proto_tree *,int,guint16);
-static int dissect_ppcap_destination_address(tvbuff_t *,packet_info *,proto_tree *,int,guint16);
-static int dissect_ppcap_info_string(tvbuff_t *,proto_tree *,int,guint16);
-static int dissect_ppcap_payload_data(tvbuff_t *,packet_info *,proto_tree *,int,guint16, proto_tree *, payload_type_type);
+static int dissect_ppcap_payload_type(tvbuff_t *, proto_tree *, int, guint16, payload_type_type *);
+static int dissect_ppcap_source_address(tvbuff_t *, packet_info *, proto_tree *, int, guint16);
+static int dissect_ppcap_destination_address(tvbuff_t *, packet_info *, proto_tree *, int, guint16);
+static int dissect_ppcap_info_string(tvbuff_t *, proto_tree *, int, guint16);
+static int dissect_ppcap_payload_data(tvbuff_t *, packet_info *, proto_tree *, int, guint16, proto_tree *, payload_type_type);
/*Dissecting the function PPCAP */
@@ -128,47 +128,46 @@ dissect_ppcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_item *ti, *ti1;
proto_tree *ppcap_tree, *ppcap_tree1;
- guint16 msg_type,msg_len;
- int offset=0;
+ guint16 msg_type, msg_len;
+ int offset = 0;
payload_type_type payload_type = PPCAP_UNKNOWN;
- col_clear(pinfo->cinfo, COL_PROTOCOL);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPCAP");
-
col_clear(pinfo->cinfo, COL_INFO);
ti = proto_tree_add_item(tree, proto_ppcap, tvb, 0, -1, ENC_NA);
ppcap_tree = proto_item_add_subtree(ti, ett_ppcap);
- while(tvb_length_remaining(tvb, offset)>0)
+ while (tvb_length_remaining(tvb, offset) > 0)
{
- msg_type=tvb_get_ntohs(tvb, offset);
- ti1=proto_tree_add_text(ppcap_tree, tvb, offset, 2,"%s", val_to_str(msg_type,payload_tag_values,"Unknown PPCAP message type (%u)"));
+ msg_type = tvb_get_ntohs(tvb, offset);
+ ti1 = proto_tree_add_text(ppcap_tree, tvb, offset, 2, "%s",
+ val_to_str(msg_type, payload_tag_values, "Unknown PPCAP message type (%u)"));
ppcap_tree1 = proto_item_add_subtree(ti1, ett_ppcap1);
- offset = offset+2;
- msg_len=tvb_get_ntohs(tvb, offset);
+ offset = offset + 2;
+ msg_len = tvb_get_ntohs(tvb, offset);
proto_tree_add_item( ppcap_tree1, hf_ppcap_length, tvb, offset, 2, ENC_BIG_ENDIAN);
- offset = offset+2;
- switch(msg_type){
+ offset = offset + 2;
+ switch (msg_type) {
case 1:
payload_type = PPCAP_UNKNOWN;
- offset = dissect_ppcap_payload_type(tvb,ppcap_tree1,offset, msg_len, &payload_type);
+ offset = dissect_ppcap_payload_type(tvb, ppcap_tree1, offset, msg_len, &payload_type);
break;
case 2:
- offset = dissect_ppcap_payload_data(tvb,pinfo,ppcap_tree1,offset, msg_len, tree, payload_type);
+ offset = dissect_ppcap_payload_data(tvb, pinfo, ppcap_tree1, offset, msg_len, tree, payload_type);
break;
case 3:
- offset = dissect_ppcap_source_address(tvb,pinfo,ppcap_tree1,offset, msg_len);
+ offset = dissect_ppcap_source_address(tvb, pinfo, ppcap_tree1, offset, msg_len);
break;
case 4:
- offset = dissect_ppcap_destination_address(tvb,pinfo,ppcap_tree1,offset, msg_len);
+ offset = dissect_ppcap_destination_address(tvb, pinfo, ppcap_tree1, offset, msg_len);
break;
case 256:
- offset = dissect_ppcap_info_string(tvb,ppcap_tree1,offset, msg_len);
+ offset = dissect_ppcap_info_string(tvb, ppcap_tree1, offset, msg_len);
break;
}
}
-}
+}
/* Dissecting the function Payload type to compare the protocol type */
@@ -183,32 +182,32 @@ dissect_ppcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
static int
-dissect_ppcap_payload_type(tvbuff_t *tvb,proto_tree * ppcap_tree1, int offset, guint16 msg_len, payload_type_type *payload_type)
+dissect_ppcap_payload_type(tvbuff_t *tvb, proto_tree * ppcap_tree1, int offset, guint16 msg_len, payload_type_type *payload_type)
{
char *string;
- string=tvb_get_ephemeral_string(tvb,offset,msg_len);
-
- if(strcmp(string,"mtp3")==0){
+ string = tvb_get_ephemeral_string(tvb, offset, msg_len);
+
+ if (strcmp(string,"mtp3") == 0) {
*payload_type = PPCAP_MTP3;
- }else if(strcmp(string,"tcap")==0){
+ }else if (strcmp(string,"tcap") == 0) {
*payload_type = PPCAP_TCAP;
- }else if(strcmp(string,"bssap")==0){
+ }else if (strcmp(string,"bssap") == 0) {
*payload_type = PPCAP_BSSAP;
- }else if(strcmp(string,"ranap")==0){
+ }else if (strcmp(string,"ranap") == 0) {
*payload_type = PPCAP_RANAP;
- }else if(strcmp(string,"h248")==0){
+ }else if (strcmp(string,"h248") == 0) {
*payload_type = PPCAP_H248;
- }else if(strcmp(string,"sip")==0){
+ }else if (strcmp(string,"sip") == 0) {
*payload_type = PPCAP_SIP;
- }else if(strcmp(string,"sccp")==0){
+ }else if (strcmp(string,"sccp") == 0) {
*payload_type = PPCAP_SCCP;
}
proto_tree_add_item(ppcap_tree1, hf_ppcap_payload_type, tvb, offset, msg_len, ENC_BIG_ENDIAN|ENC_ASCII);
-
- if(msg_len%4)
- msg_len=msg_len+(4-(msg_len%4));
- offset+=msg_len;
+
+ if (msg_len%4)
+ msg_len = msg_len+(4-(msg_len%4));
+ offset += msg_len;
return offset;
}
@@ -226,88 +225,88 @@ dissect_ppcap_payload_type(tvbuff_t *tvb,proto_tree * ppcap_tree1, int offset, g
*/
static int
-dissect_ppcap_source_address(tvbuff_t *tvb,packet_info *pinfo, proto_tree * ppcap_tree1, int offset, guint16 msg_len)
-{
+dissect_ppcap_source_address(tvbuff_t *tvb, packet_info *pinfo, proto_tree * ppcap_tree1, int offset, guint16 msg_len)
+{
int key1;
const guchar *src_addr;
- /*guint32 src_addr1;*/
- proto_tree_add_item(ppcap_tree1, hf_ppcap_reserved ,tvb, offset , 2 , ENC_BIG_ENDIAN);
- offset+=2;
-
- key1=tvb_get_ntohs(tvb, offset);
- proto_tree_add_item(ppcap_tree1, hf_ppcap_address_type ,tvb, offset , 2 , ENC_BIG_ENDIAN);
- offset+=2;
-
- if(key1==1)
- {
- proto_tree_add_item(ppcap_tree1,hf_ppcap_ssn,tvb,offset,1,ENC_BIG_ENDIAN);
- offset+=1;
- proto_tree_add_item(ppcap_tree1,hf_ppcap_spc,tvb,offset,3,ENC_BIG_ENDIAN);
+ /*guint32 src_addr1;*/
+ proto_tree_add_item(ppcap_tree1, hf_ppcap_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
+ offset += 2;
+
+ key1 = tvb_get_ntohs(tvb, offset);
+ proto_tree_add_item(ppcap_tree1, hf_ppcap_address_type, tvb, offset, 2, ENC_BIG_ENDIAN);
+ offset += 2;
+
+ if (key1 == 1)
+ {
+ proto_tree_add_item(ppcap_tree1, hf_ppcap_ssn, tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset += 1;
+ proto_tree_add_item(ppcap_tree1, hf_ppcap_spc, tvb, offset, 3, ENC_BIG_ENDIAN);
/*src_addr1 = (guint32 )tvb_get_ntoh24(tvb, offset);*/
- mtp3_addr_opc = ep_alloc0(sizeof(mtp3_addr_pc_t));
+ mtp3_addr_opc = ep_alloc0(sizeof(mtp3_addr_pc_t));
mtp3_addr_opc->pc = (guint32 )tvb_get_ntoh24(tvb, offset);
mtp3_addr_opc->type = 1; /* ITU_STANDARD */
mtp3_addr_opc->ni = 0;
/*SET_ADDRESS(&pinfo->net_src, AT_SS7PC, sizeof(mtp3_addr_pc_t), (guint8 *) mtp3_addr_opc);*/
SET_ADDRESS(&pinfo->src, AT_SS7PC, sizeof(mtp3_addr_pc_t), (guint8 *) mtp3_addr_opc);
- if(msg_len%4)
- msg_len=msg_len+(4-(msg_len%4));
+ if (msg_len%4)
+ msg_len = msg_len + (4 - (msg_len%4));
- offset+=msg_len-1;
+ offset += msg_len-1;
return offset;
}
- else if(key1==2)
- {
- proto_tree_add_item(ppcap_tree1,hf_ppcap_opc,tvb,offset,msg_len,ENC_BIG_ENDIAN);
+ else if (key1 == 2)
+ {
+ proto_tree_add_item(ppcap_tree1, hf_ppcap_opc, tvb, offset, msg_len, ENC_BIG_ENDIAN);
/*src_addr1 = (guint32 )tvb_get_ntoh24(tvb, offset);*/
- mtp3_addr_opc = ep_alloc0(sizeof(mtp3_addr_pc_t));
+ mtp3_addr_opc = ep_alloc0(sizeof(mtp3_addr_pc_t));
mtp3_addr_opc->pc = tvb_get_ntohl(tvb, offset);
mtp3_addr_opc->type = 1; /* ITU_STANDARD */
mtp3_addr_opc->ni = 0;
SET_ADDRESS(&pinfo->src, AT_SS7PC, sizeof(mtp3_addr_pc_t), (guint8 *) mtp3_addr_opc);
- /*src_addr = tvb_get_ptr(tvb, offset, 4);*/
- /*SET_ADDRESS(&pinfo->net_src, AT_SS7PC, 4, src_addr);*/
- /*SET_ADDRESS(&pinfo->src, AT_SS7PC, 4, src_addr);*/
+ /*src_addr = tvb_get_ptr(tvb, offset, 4);*/
+ /*SET_ADDRESS(&pinfo->net_src, AT_SS7PC, 4, src_addr);*/
+ /*SET_ADDRESS(&pinfo->src, AT_SS7PC, 4, src_addr);*/
}
- else if(key1==3)
+ else if (key1 == 3)
{
- if(msg_len%4==0)
+ if (msg_len%4 == 0)
{
- proto_tree_add_ipv4(ppcap_tree1,hf_ppcap_source_ip_address1 ,tvb,offset,msg_len, tvb_get_ipv4(tvb,offset));
- src_addr = tvb_get_ptr(tvb, offset, 4);
- SET_ADDRESS(&pinfo->net_src, AT_IPv4, 4, src_addr);
- SET_ADDRESS(&pinfo->src, AT_IPv4, 4, src_addr);
- }
+ proto_tree_add_ipv4(ppcap_tree1, hf_ppcap_source_ip_address1, tvb, offset, msg_len, tvb_get_ipv4(tvb, offset));
+ src_addr = tvb_get_ptr(tvb, offset, 4);
+ SET_ADDRESS(&pinfo->net_src, AT_IPv4, 4, src_addr);
+ SET_ADDRESS(&pinfo->src, AT_IPv4, 4, src_addr);
+ }
else
- {
+ {
struct e_in6_addr value;
- tvb_get_ipv6(tvb, offset, &value);
- proto_tree_add_ipv6(ppcap_tree1,hf_ppcap_source_ip_address2 ,tvb,offset,msg_len,(guint8*)&value);
- src_addr = tvb_get_ptr(tvb, offset, 6);
- SET_ADDRESS(&pinfo->net_src, AT_IPv6, 6, src_addr);
- SET_ADDRESS(&pinfo->src, AT_IPv6, 6, src_addr);
+ tvb_get_ipv6(tvb, offset, &value);
+ proto_tree_add_ipv6(ppcap_tree1, hf_ppcap_source_ip_address2, tvb, offset, msg_len, (guint8*)&value);
+ src_addr = tvb_get_ptr(tvb, offset, 6);
+ SET_ADDRESS(&pinfo->net_src, AT_IPv6, 6, src_addr);
+ SET_ADDRESS(&pinfo->src, AT_IPv6, 6, src_addr);
}
}
- else if(key1==4)
+ else if (key1 == 4)
- {
+ {
proto_tree_add_item(ppcap_tree1, hf_ppcap_source_nodeid, tvb, offset, msg_len, ENC_BIG_ENDIAN|ENC_ASCII);
- src_addr = tvb_get_ptr(tvb, offset, msg_len);
- SET_ADDRESS(&pinfo->net_src, AT_STRINGZ, msg_len, src_addr);
+ src_addr = tvb_get_ptr(tvb, offset, msg_len);
+ SET_ADDRESS(&pinfo->net_src, AT_STRINGZ, msg_len, src_addr);
SET_ADDRESS(&pinfo->src, AT_STRINGZ, msg_len, src_addr);
}
- if(msg_len%4)
- msg_len=msg_len+(4-(msg_len%4));
- offset+=msg_len;
+ if (msg_len%4)
+ msg_len = msg_len + (4 - (msg_len%4));
+ offset += msg_len;
return offset;
}
/* Dissecting the function Destination Address */
-
-/*
+
+/*
*******************************************************
* Reserved * Address Type *
* * *
@@ -319,90 +318,90 @@ dissect_ppcap_source_address(tvbuff_t *tvb,packet_info *pinfo, proto_tree * ppca
static int
-dissect_ppcap_destination_address(tvbuff_t *tvb,packet_info * pinfo, proto_tree * ppcap_tree1, int offset, guint16 msg_len )
+dissect_ppcap_destination_address(tvbuff_t *tvb, packet_info * pinfo, proto_tree * ppcap_tree1, int offset, guint16 msg_len )
{
int key2;
const guchar *dst_addr;
- /*guint32 dst_addr1;*/
-
- proto_tree_add_item(ppcap_tree1, hf_ppcap_destreserved ,tvb, offset , 2 , ENC_BIG_ENDIAN);
- offset+=2;
-
- key2=tvb_get_ntohs(tvb, offset);
- proto_tree_add_item(ppcap_tree1, hf_ppcap_address_type ,tvb, offset , 2 , ENC_BIG_ENDIAN);
- offset+=2;
-
- if(key2==1)
- {
- ssn=tvb_get_guint8(tvb,offset);
- proto_tree_add_item(ppcap_tree1,hf_ppcap_ssn1,tvb,offset,1,ENC_BIG_ENDIAN);
- offset+=1;
-
- proto_tree_add_item(ppcap_tree1,hf_ppcap_spc1,tvb,offset,3,ENC_BIG_ENDIAN);
-
+ /*guint32 dst_addr1;*/
+
+ proto_tree_add_item(ppcap_tree1, hf_ppcap_destreserved, tvb, offset, 2, ENC_BIG_ENDIAN);
+ offset += 2;
+
+ key2 = tvb_get_ntohs(tvb, offset);
+ proto_tree_add_item(ppcap_tree1, hf_ppcap_address_type, tvb, offset, 2, ENC_BIG_ENDIAN);
+ offset += 2;
+
+ if (key2 == 1)
+ {
+ ssn = tvb_get_guint8(tvb, offset);
+ proto_tree_add_item(ppcap_tree1, hf_ppcap_ssn1, tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset += 1;
+
+ proto_tree_add_item(ppcap_tree1, hf_ppcap_spc1, tvb, offset, 3, ENC_BIG_ENDIAN);
+
/*dst_addr1 = (guint32 )tvb_get_ntoh24(tvb, offset);*/
- mtp3_addr_dpc = ep_alloc0(sizeof(mtp3_addr_pc_t));
+ mtp3_addr_dpc = ep_alloc0(sizeof(mtp3_addr_pc_t));
mtp3_addr_dpc->pc = (guint32)tvb_get_ntoh24(tvb, offset);
mtp3_addr_dpc->type = 1; /* ITU_STANDARD */
mtp3_addr_dpc->ni = 0;
SET_ADDRESS(&pinfo->dst, AT_SS7PC, sizeof(mtp3_addr_pc_t), (guint8 *) mtp3_addr_dpc);
- /*dst_addr = tvb_get_ptr(tvb, offset, msg_len-1);
- SET_ADDRESS(&pinfo->net_dst, AT_SS7PC, msg_len-1, dst_addr);
- SET_ADDRESS(&pinfo->dst, AT_SS7PC, msg_len-1, dst_addr);*/
-
- if(msg_len%4)
- msg_len=msg_len+(4-(msg_len%4));
-
- offset+=msg_len-1;
+ /*dst_addr = tvb_get_ptr(tvb, offset, msg_len-1);
+ SET_ADDRESS(&pinfo->net_dst, AT_SS7PC, msg_len-1, dst_addr);
+ SET_ADDRESS(&pinfo->dst, AT_SS7PC, msg_len-1, dst_addr);*/
+
+ if (msg_len%4)
+ msg_len = msg_len + (4 - (msg_len%4));
+
+ offset += msg_len-1;
return offset;
}
- else if(key2==2)
+ else if (key2 == 2)
{
- proto_tree_add_item(ppcap_tree1,hf_ppcap_dpc,tvb,offset,4,ENC_BIG_ENDIAN);
-
+ proto_tree_add_item(ppcap_tree1, hf_ppcap_dpc, tvb, offset, 4, ENC_BIG_ENDIAN);
+
/*dst_addr1 = (guint32 )tvb_get_ntoh24(tvb, offset);*/
- mtp3_addr_dpc = ep_alloc0(sizeof(mtp3_addr_pc_t));
+ mtp3_addr_dpc = ep_alloc0(sizeof(mtp3_addr_pc_t));
mtp3_addr_dpc->pc = tvb_get_ntohl(tvb, offset);
mtp3_addr_dpc->type = 1; /* ITU_STANDARD */
mtp3_addr_dpc->ni = 0;
SET_ADDRESS(&pinfo->dst, AT_SS7PC, sizeof(mtp3_addr_pc_t), (guint8 *) mtp3_addr_dpc);
}
- else if(key2==3)
+ else if (key2 == 3)
{
- if(msg_len%4==0)
+ if (msg_len%4 == 0)
{
- proto_tree_add_ipv4(ppcap_tree1, hf_ppcap_destination_ip_address1, tvb,offset,msg_len,tvb_get_ipv4(tvb,offset));
- dst_addr = tvb_get_ptr(tvb, offset, 4);
- SET_ADDRESS(&pinfo->net_dst, AT_IPv4, 4, dst_addr);
- SET_ADDRESS(&pinfo->dst, AT_IPv4, 4, dst_addr);
- }
+ proto_tree_add_ipv4(ppcap_tree1, hf_ppcap_destination_ip_address1, tvb, offset, msg_len, tvb_get_ipv4(tvb, offset));
+ dst_addr = tvb_get_ptr(tvb, offset, 4);
+ SET_ADDRESS(&pinfo->net_dst, AT_IPv4, 4, dst_addr);
+ SET_ADDRESS(&pinfo->dst, AT_IPv4, 4, dst_addr);
+ }
else
{
- struct e_in6_addr value;
+ struct e_in6_addr value;
- tvb_get_ipv6(tvb,offset,&value);
- proto_tree_add_ipv6(ppcap_tree1, hf_ppcap_destination_ip_address2, tvb,offset,msg_len,(guint8*)&value);
- dst_addr = tvb_get_ptr(tvb, offset, 6);
- SET_ADDRESS(&pinfo->net_dst, AT_IPv6, 6, dst_addr);
- SET_ADDRESS(&pinfo->dst, AT_IPv6, 6, dst_addr);
+ tvb_get_ipv6(tvb, offset,&value);
+ proto_tree_add_ipv6(ppcap_tree1, hf_ppcap_destination_ip_address2, tvb, offset, msg_len, (guint8*)&value);
+ dst_addr = tvb_get_ptr(tvb, offset, 6);
+ SET_ADDRESS(&pinfo->net_dst, AT_IPv6, 6, dst_addr);
+ SET_ADDRESS(&pinfo->dst, AT_IPv6, 6, dst_addr);
}
- }
-
- else if(key2==4)
+ }
+
+ else if (key2 == 4)
{
char *string;
- string=tvb_get_string(tvb,offset,msg_len);
- proto_tree_add_string(ppcap_tree1, hf_ppcap_destination_nodeid, tvb, offset, msg_len , string);
- dst_addr = tvb_get_ptr(tvb, offset, msg_len);
- SET_ADDRESS(&pinfo->net_dst, AT_STRINGZ, msg_len, dst_addr);
+ string = tvb_get_string(tvb, offset, msg_len);
+ proto_tree_add_string(ppcap_tree1, hf_ppcap_destination_nodeid, tvb, offset, msg_len, string);
+ dst_addr = tvb_get_ptr(tvb, offset, msg_len);
+ SET_ADDRESS(&pinfo->net_dst, AT_STRINGZ, msg_len, dst_addr);
SET_ADDRESS(&pinfo->dst, AT_STRINGZ, msg_len, dst_addr);
/*g_free(string);*/
- }
-
- if(msg_len%4)
- msg_len=msg_len+(4-(msg_len%4));
- offset+=msg_len;
+ }
+
+ if (msg_len%4)
+ msg_len = msg_len+(4-(msg_len%4));
+ offset += msg_len;
return offset;
}
@@ -418,11 +417,11 @@ dissect_ppcap_destination_address(tvbuff_t *tvb,packet_info * pinfo, proto_tree
static int
dissect_ppcap_info_string(tvbuff_t *tvb, proto_tree * ppcap_tree1, int offset, guint16 msg_len)
{
- proto_tree_add_item(ppcap_tree1, hf_ppcap_info ,tvb, offset , msg_len , ENC_ASCII|ENC_NA);
-
- if(msg_len%4)
+ proto_tree_add_item(ppcap_tree1, hf_ppcap_info, tvb, offset, msg_len, ENC_ASCII|ENC_NA);
+
+ if (msg_len%4)
msg_len = msg_len +( 4- (msg_len%4));
- offset+=msg_len;
+ offset += msg_len;
return offset;
}
@@ -437,82 +436,82 @@ dissect_ppcap_info_string(tvbuff_t *tvb, proto_tree * ppcap_tree1, int offset, g
static int
-dissect_ppcap_payload_data(tvbuff_t *tvb,packet_info *pinfo, proto_tree * ppcap_tree1, int offset, guint16 msg_len, proto_tree *tree, payload_type_type payload_type)
+dissect_ppcap_payload_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree * ppcap_tree1, int offset, guint16 msg_len, proto_tree *tree, payload_type_type payload_type)
{
tvbuff_t *next_tvb;
- proto_tree_add_item(ppcap_tree1, hf_ppcap_payload_data ,tvb, offset , msg_len , ENC_NA);
+ proto_tree_add_item(ppcap_tree1, hf_ppcap_payload_data, tvb, offset, msg_len, ENC_NA);
- if(msg_len%4)
+ if (msg_len%4)
msg_len = msg_len +( 4- (msg_len%4));
next_tvb = tvb_new_subset_remaining(tvb, offset);
- switch(payload_type){
+ switch (payload_type) {
case PPCAP_MTP3:
- call_dissector(mtp3_handle ,next_tvb,pinfo ,tree); /* calling the MTP3 handle */
+ call_dissector(mtp3_handle, next_tvb, pinfo, tree); /* calling the MTP3 handle */
break;
case PPCAP_TCAP:
/*
- * The protocol which run on TCAP take the SSN value from the SCCP layer which is missing in this case.
+ * The protocol which runs on TCAP takes the SSN value from the SCCP layer which is missing in this case.
* So we have made code changes for TCAP handle as below for taking the SSN value from ppcap.
*/
if (ssn != INVALID_SSN && dissector_try_uint(sccp_ssn_dissector_table, ssn, next_tvb, pinfo, tree)) {
return offset+msg_len;
}else{
- call_dissector(tcap_handle ,next_tvb,pinfo,tree); /* calling the TCAP handle */
+ call_dissector(tcap_handle, next_tvb, pinfo, tree); /* calling the TCAP handle */
}
break;
case PPCAP_BSSAP:
- call_dissector(bssap_handle,next_tvb,pinfo,tree); /* calling the BSSAP handle */
+ call_dissector(bssap_handle, next_tvb, pinfo, tree); /* calling the BSSAP handle */
break;
case PPCAP_RANAP:
- call_dissector(ranap_handle,next_tvb,pinfo,tree); /* calling the RANAP handle */
+ call_dissector(ranap_handle, next_tvb, pinfo, tree); /* calling the RANAP handle */
break;
case PPCAP_H248:
- call_dissector(h248_handle,next_tvb,pinfo,tree); /* calling the H248 handle */
+ call_dissector(h248_handle, next_tvb, pinfo, tree); /* calling the H248 handle */
break;
case PPCAP_SIP:
- call_dissector(sip_handle,next_tvb,pinfo,tree); /* calling the SIP handle */
+ call_dissector(sip_handle, next_tvb, pinfo, tree); /* calling the SIP handle */
break;
case PPCAP_SCCP:
- call_dissector(sccp_handle,next_tvb,pinfo,tree); /* calling the SCCP handle */
+ call_dissector(sccp_handle, next_tvb, pinfo, tree); /* calling the SCCP handle */
break;
default:
- call_dissector(data_handle,next_tvb,pinfo,tree); /* calling the DATA handle */
+ call_dissector(data_handle, next_tvb, pinfo, tree); /* calling the DATA handle */
break;
}
- offset+=msg_len;
+ offset += msg_len;
return offset;
}
/* Registering the hf variables */
-
+
void proto_register_ppcap(void)
{
static hf_register_info hf[] = {
{ &hf_ppcap_length,
- { "Length", "ppcap.length",
- FT_UINT16, BASE_DEC, NULL, 0x00,
- NULL, HFILL}
- },
+ { "Length", "ppcap.length",
+ FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL}},
{ &hf_ppcap_payload_type,
{ "Payload Type" , "ppcap.payload_type", FT_STRING,
- BASE_NONE, NULL, 0x0 ,NULL, HFILL}},
+ BASE_NONE, NULL, 0x0 , NULL, HFILL}},
{ &hf_ppcap_reserved,
{ "Reserved", "ppcap.reserved", FT_UINT16,
BASE_DEC, NULL, 0x00, NULL, HFILL}},
{ &hf_ppcap_address_type,
{ "Address Type", "ppcap.address_type", FT_UINT16,
- BASE_DEC, VALS(address_type_values), 0x00 , NULL, HFILL}},
- /*{ &hf_ppcap_source_address_type,
+ BASE_DEC, VALS(address_type_values), 0x00 , NULL, HFILL}},
+#if 0
+ { &hf_ppcap_source_address_type,
{ "Source Address Type", "ppcap.source_address_type", FT_UINT16,
- BASE_DEC, VALS(address_type_values), 0x00 , NULL, HFILL}},*/
+ BASE_DEC, VALS(address_type_values), 0x00 , NULL, HFILL}},
+#endif
{ &hf_ppcap_ssn,
{ "SSN", "ppcap.ssn", FT_UINT16,
- BASE_DEC, NULL, 0x00, NULL, HFILL}},
+ BASE_DEC, NULL, 0x00, NULL, HFILL}},
{ &hf_ppcap_spc,
{"OPC", "ppcap.spc", FT_UINT16,
BASE_DEC, NULL, 0x00, NULL, HFILL}},
@@ -528,9 +527,11 @@ void proto_register_ppcap(void)
{ &hf_ppcap_destreserved,
{ "Reserved", "ppcap.destreserved", FT_UINT16,
BASE_DEC, NULL, 0x00, NULL, HFILL}},
- /*{ &hf_ppcap_destination_address_type,
+#if 0
+ { &hf_ppcap_destination_address_type,
{ "Destination Address Type", "ppcap.destination_address_type", FT_UINT16,
- BASE_DEC, VALS(address_type_values), 0x00, NULL, HFILL}},*/
+ BASE_DEC, VALS(address_type_values), 0x00, NULL, HFILL}},
+#endif
{ &hf_ppcap_ssn1,
{ "SSN", "ppcap.ssn1", FT_UINT8,
BASE_DEC, NULL, 0x00, NULL, HFILL}},
@@ -573,17 +574,16 @@ void proto_register_ppcap(void)
void proto_reg_handoff_ppcap(void)
{
- /*static gboolean ppcap_initialised = FALSE;*/
-
ppcap_handle = find_dissector("ppcap");
- mtp3_handle = find_dissector("mtp3"); /* calling the protocol MTP3 */
- tcap_handle = find_dissector("tcap"); /* calling the protocol TCAP */
- bssap_handle = find_dissector("bssap"); /* calling the protocol BSSAP */
- ranap_handle = find_dissector("ranap"); /* calling the protocol RANAP */
- h248_handle = find_dissector("h248"); /* calling the protocol H248 */
- sip_handle = find_dissector("sip"); /* calling the protocol SIP */
- sccp_handle = find_dissector("sccp"); /* calling the protocol SCCP */
- data_handle = find_dissector("data"); /* calling the protocol DATA */
+ mtp3_handle = find_dissector("mtp3"); /* calling the protocol MTP3 */
+ tcap_handle = find_dissector("tcap"); /* calling the protocol TCAP */
+ bssap_handle = find_dissector("bssap"); /* calling the protocol BSSAP */
+ ranap_handle = find_dissector("ranap"); /* calling the protocol RANAP */
+ h248_handle = find_dissector("h248"); /* calling the protocol H248 */
+ sip_handle = find_dissector("sip"); /* calling the protocol SIP */
+ sccp_handle = find_dissector("sccp"); /* calling the protocol SCCP */
+ data_handle = find_dissector("data"); /* calling the protocol DATA */
+
sccp_ssn_dissector_table = find_dissector_table("sccp.ssn");
}