Add a tag for original frame number.

svn path=/trunk/; revision=49298
This commit is contained in:
Anders Broman 2013-05-14 19:57:19 +00:00
parent cd01af1357
commit 8e509279b8
4 changed files with 38 additions and 1 deletions

View File

@ -45,6 +45,7 @@ static int hf_exported_pdu_ipv6_src = -1;
static int hf_exported_pdu_ipv6_dst = -1;
static int hf_exported_pdu_src_port = -1;
static int hf_exported_pdu_dst_port = -1;
static int hf_exported_pdu_orig_fno = -1;
/* Initialize the subtree pointers */
@ -73,6 +74,8 @@ static const value_string exported_pdu_tag_vals[] = {
{ EXP_PDU_TAG_SS7_OPC, "SS7 OPC" },
{ EXP_PDU_TAG_SS7_DPC, "SS7 DPC" },
{ EXP_PDU_TAG_ORIG_FNO, "Original Frame number" },
{ 0, NULL }
};
@ -143,6 +146,9 @@ dissect_exported_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case EXP_PDU_TAG_DST_PORT:
proto_tree_add_item(tag_tree, hf_exported_pdu_dst_port, tvb, offset, 4, ENC_BIG_ENDIAN);
pinfo->destport = tvb_get_ntohl(tvb,offset);
break;
case EXP_PDU_TAG_ORIG_FNO:
proto_tree_add_item(tag_tree, hf_exported_pdu_orig_fno, tvb, offset, 4, ENC_BIG_ENDIAN);
break;
default:
break;
@ -227,6 +233,11 @@ proto_register_exported_pdu(void)
FT_UINT16, BASE_DEC, NULL, 0,
NULL, HFILL }
},
{ &hf_exported_pdu_orig_fno,
{ "Original Frame Number", "exported_pdu.orig_fno",
FT_INT32, BASE_DEC, NULL, 0,
NULL, HFILL }
},
};
/* Setup protocol subtree array */

View File

@ -999,7 +999,7 @@ export_sip_pdu(packet_info *pinfo, tvbuff_t *tvb)
guint32 tags_bit_field;
tags_bit_field = EXP_PDU_TAG_IP_SRC_BIT + EXP_PDU_TAG_IP_DST_BIT + EXP_PDU_TAG_SRC_PORT_BIT+
EXP_PDU_TAG_DST_PORT_BIT;
EXP_PDU_TAG_DST_PORT_BIT + EXP_PDU_TAG_ORIG_FNO_BIT;
exp_pdu_data = load_export_pdu_tags(pinfo, "sip", -1, tags_bit_field);

View File

@ -83,6 +83,10 @@ load_export_pdu_tags(packet_info *pinfo, const char* proto_name, int wtap_encap
tag_buf_size= tag_buf_size + EXP_PDU_TAG_DST_PORT_LEN + 4;
}
if((tags_bit_field & EXP_PDU_TAG_ORIG_FNO_BIT) == EXP_PDU_TAG_ORIG_FNO_BIT){
tag_buf_size= tag_buf_size + EXP_PDU_TAG_ORIG_FNO_LEN + 4;
}
/* Add end of options length */
tag_buf_size+=4;
@ -182,6 +186,22 @@ load_export_pdu_tags(packet_info *pinfo, const char* proto_name, int wtap_encap
exp_pdu_data->tlv_buffer[i+1] = (pinfo->destport & 0x00ff0000) >> 16;
exp_pdu_data->tlv_buffer[i+2] = (pinfo->destport & 0x0000ff00) >> 8;
exp_pdu_data->tlv_buffer[i+3] = (pinfo->destport & 0x000000ff);
i = i +EXP_PDU_TAG_DST_PORT_LEN;
}
if((tags_bit_field & EXP_PDU_TAG_ORIG_FNO_LEN) == EXP_PDU_TAG_ORIG_FNO_LEN){
exp_pdu_data->tlv_buffer[i] = 0;
i++;
exp_pdu_data->tlv_buffer[i] = EXP_PDU_TAG_ORIG_FNO;
i++;
exp_pdu_data->tlv_buffer[i] = 0;
i++;
exp_pdu_data->tlv_buffer[i] = EXP_PDU_TAG_ORIG_FNO_LEN; /* tag length */
i++;
exp_pdu_data->tlv_buffer[i] = (pinfo->fd->num & 0xff000000) >> 24;
exp_pdu_data->tlv_buffer[i+1] = (pinfo->fd->num & 0x00ff0000) >> 16;
exp_pdu_data->tlv_buffer[i+2] = (pinfo->fd->num & 0x0000ff00) >> 8;
exp_pdu_data->tlv_buffer[i+3] = (pinfo->fd->num & 0x000000ff);
/*i = i +EXP_PDU_TAG_DST_PORT_LEN;*/
}

View File

@ -80,6 +80,8 @@
#define EXP_PDU_TAG_SS7_OPC 27
#define EXP_PDU_TAG_SS7_DPC 28
#define EXP_PDU_TAG_ORIG_FNO 29
typedef struct _exp_pdu_data_t {
int tlv_buffer_len;
@ -99,6 +101,8 @@ typedef struct _exp_pdu_data_t {
#define EXP_PDU_TAG_SS7_OPC_BIT 0x00000020
#define EXP_PDU_TAG_SS7_DPC_BIT 0x00000040
#define EXP_PDU_TAG_ORIG_FNO_BIT 0x00000080
#define EXP_PDU_TAG_IPV4_SRC_LEN 4
#define EXP_PDU_TAG_IPV4_DST_LEN 4
#define EXP_PDU_TAG_IPV6_SRC_LEN 16
@ -112,6 +116,8 @@ typedef struct _exp_pdu_data_t {
#define EXP_PDU_TAG_SS7_OPC_LEN 2
#define EXP_PDU_TAG_SS7_DPC_LEN 2
#define EXP_PDU_TAG_ORIG_FNO_LEN 4
/**
* Allocates and fills the exp_pdu_data_t struct according to the wanted_exp_tags
* bit_fileld, if proto_name is != NULL, wtap_encap must be -1 or vice-versa