本文整理汇总了C++中dissector_try_uint函数的典型用法代码示例。如果您正苦于以下问题:C++ dissector_try_uint函数的具体用法?C++ dissector_try_uint怎么用?C++ dissector_try_uint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dissector_try_uint函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: decode_pgm_ports
static void
decode_pgm_ports(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, guint16 pgmhdr_sport, guint16 pgmhdr_dport)
{
tvbuff_t *next_tvb;
int found = 0;
next_tvb = tvb_new_subset_remaining(tvb, offset);
/* do lookup with the subdissector table */
found = dissector_try_uint(subdissector_table, pgmhdr_sport,
next_tvb, pinfo, tree);
if (found)
return;
found = dissector_try_uint(subdissector_table, pgmhdr_dport,
next_tvb, pinfo, tree);
if (found)
return;
/* do lookup with the heuristic subdissector table */
if (dissector_try_heuristic(heur_subdissector_list, next_tvb, pinfo, tree))
return;
/* Oh, well, we don't know this; dissect it as data. */
call_dissector(data_handle,next_tvb, pinfo, tree);
}
示例2: dissect_osi_juniper
static void dissect_osi_juniper(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint8 nlpid;
tvbuff_t *next_tvb;
nlpid = tvb_get_guint8(tvb, 0);
if(dissector_try_uint(osinl_incl_subdissector_table, nlpid, tvb, pinfo, tree))
return;
next_tvb = tvb_new_subset_remaining(tvb, 1);
dissector_try_uint(osinl_excl_subdissector_table, nlpid, next_tvb, pinfo, tree);
}
示例3: dissect_osi
static void dissect_osi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint8 nlpid;
tvbuff_t *new_tvb;
pinfo->current_proto = "OSI";
nlpid = tvb_get_guint8(tvb, 0);
/*
* Try the subdissector table for protocols in which the NLPID is
* considered part of the PDU; it should be handed a tvbuff that
* includes the NLPID, and should put the NLPID into the protocol
* tree itself.
*/
if (dissector_try_uint(osinl_incl_subdissector_table, nlpid, tvb, pinfo, tree))
return;
/*
* Try the subdissector table for protocols in which the NLPID is
* *not* considered part of the PDU; it should be handed a tvbuff
* that doesn't include the NLPID, and we should put the NLPID into
* the protocol tree ourselves.
*/
proto_tree_add_uint(tree, hf_osi_nlpid, tvb, 0, 1, nlpid);
new_tvb = tvb_new_subset_remaining(tvb, 1);
if (dissector_try_uint(osinl_excl_subdissector_table, nlpid, new_tvb, pinfo, tree))
return;
switch (nlpid) {
/* ESIS (X.25) is not currently decoded */
case NLPID_ISO9542X25_ESIS:
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ESIS (X.25)");
call_dissector(data_handle,tvb, pinfo, tree);
break;
case NLPID_ISO10747_IDRP:
col_set_str(pinfo->cinfo, COL_PROTOCOL, "IDRP");
call_dissector(data_handle,tvb, pinfo, tree);
break;
default:
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ISO");
col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown ISO protocol (%02x)", nlpid);
call_dissector(data_handle,tvb, pinfo, tree);
break;
}
} /* dissect_osi */
示例4: chdlctype
void
chdlctype(guint16 chdlc_type, tvbuff_t *tvb, int offset_after_chdlctype,
packet_info *pinfo, proto_tree *tree, proto_tree *fh_tree,
int chdlctype_id)
{
tvbuff_t *next_tvb;
int padbyte;
proto_tree_add_uint(fh_tree, chdlctype_id, tvb,
offset_after_chdlctype - 2, 2, chdlc_type);
padbyte = tvb_get_guint8(tvb, offset_after_chdlctype);
if (chdlc_type == CHDLCTYPE_OSI &&
!( padbyte == NLPID_ISO8473_CLNP || /* older Juniper SW does not send a padbyte */
padbyte == NLPID_ISO9542_ESIS ||
padbyte == NLPID_ISO10589_ISIS)) {
/* There is a Padding Byte for CLNS protocols over Cisco HDLC */
proto_tree_add_item(fh_tree, hf_chdlc_clns_padding, tvb, offset_after_chdlctype, 1, ENC_BIG_ENDIAN);
next_tvb = tvb_new_subset_remaining(tvb, offset_after_chdlctype + 1);
} else {
next_tvb = tvb_new_subset_remaining(tvb, offset_after_chdlctype);
}
/* do lookup with the subdissector table */
if (!dissector_try_uint(subdissector_table, chdlc_type, next_tvb, pinfo, tree)) {
col_add_fstr(pinfo->cinfo, COL_PROTOCOL, "0x%04x", chdlc_type);
call_dissector(data_handle,next_tvb, pinfo, tree);
}
}
示例5: dissect_macmgmt
/* Code to actually dissect the packets */
static void
dissect_macmgmt (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
{
const guint8 *src, *dst;
guint16 msg_len;
proto_item *mgt_hdr_it;
proto_tree *mgt_hdr_tree;
tvbuff_t *payload_tvb;
guint8 type;
col_set_str (pinfo->cinfo, COL_PROTOCOL, "DOCSIS MGMT");
col_clear(pinfo->cinfo, COL_INFO);
src = tvb_get_ptr (tvb, 6, 6);
dst = tvb_get_ptr (tvb, 0, 6);
SET_ADDRESS (&pinfo->dl_src, AT_ETHER, 6, src);
SET_ADDRESS (&pinfo->src, AT_ETHER, 6, src);
SET_ADDRESS (&pinfo->dl_dst, AT_ETHER, 6, dst);
SET_ADDRESS (&pinfo->dst, AT_ETHER, 6, dst);
if (tree)
{
mgt_hdr_it =
proto_tree_add_protocol_format (tree, proto_docsis_mgmt, tvb, 0, 20,
"Mac Management");
mgt_hdr_tree = proto_item_add_subtree (mgt_hdr_it, ett_docsis_mgmt);
proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_dst_addr, tvb, 0, 6,
ENC_NA);
proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_src_addr, tvb, 6, 6,
ENC_NA);
proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_msg_len, tvb, 12, 2,
ENC_BIG_ENDIAN);
proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_dsap, tvb, 14, 1,
ENC_BIG_ENDIAN);
proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_ssap, tvb, 15, 1,
ENC_BIG_ENDIAN);
proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_control, tvb, 16, 1,
ENC_BIG_ENDIAN);
proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_version, tvb, 17, 1,
ENC_BIG_ENDIAN);
proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_type, tvb, 18, 1,
ENC_BIG_ENDIAN);
proto_tree_add_item (mgt_hdr_tree, hf_docsis_mgt_rsvd, tvb, 19, 1,
ENC_BIG_ENDIAN);
}
/* Code to Call subdissector */
/* sub-dissectors are based on the type field */
type = tvb_get_guint8 (tvb, 18);
msg_len = tvb_get_ntohs (tvb, 12);
payload_tvb = tvb_new_subset (tvb, 20, msg_len - 6, msg_len - 6);
if (dissector_try_uint
(docsis_mgmt_dissector_table, type, payload_tvb, pinfo, tree))
return;
else
call_dissector (data_handle, payload_tvb, pinfo, tree);
}
示例6: dissect_ap1394
static void
dissect_ap1394(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_item *ti;
proto_tree *fh_tree = NULL;
guint16 etype;
tvbuff_t *next_tvb;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "IP/IEEE1394");
col_clear(pinfo->cinfo, COL_INFO);
set_address_tvb(&pinfo->dl_src, AT_EUI64, 8, tvb, 8);
copy_address_shallow(&pinfo->src, &pinfo->dl_src);
set_address_tvb(&pinfo->dl_dst, AT_EUI64, 8, tvb, 0);
copy_address_shallow(&pinfo->dst, &pinfo->dl_dst);
if (tree) {
ti = proto_tree_add_protocol_format(tree, proto_ap1394, tvb, 0, 18,
"Apple IP-over-IEEE 1394, Src: %s, Dst: %s",
address_to_str(wmem_packet_scope(), &pinfo->src), address_to_str(wmem_packet_scope(), &pinfo->dst));
fh_tree = proto_item_add_subtree(ti, ett_ap1394);
proto_tree_add_item(fh_tree, hf_ap1394_dst, tvb, 0, 8, ENC_NA);
proto_tree_add_item(fh_tree, hf_ap1394_src, tvb, 8, 8, ENC_NA);
}
etype = tvb_get_ntohs(tvb, 16);
proto_tree_add_uint(fh_tree, hf_ap1394_type, tvb, 16, 2, etype);
next_tvb = tvb_new_subset_remaining(tvb, 18);
if (!dissector_try_uint(ethertype_subdissector_table, etype, next_tvb,
pinfo, tree))
call_dissector(data_handle, next_tvb, pinfo, tree);
}
示例7: dissect_3com_xns
/*
* Apparently 3Com had some scheme for encapsulating XNS in 802.2 LLC,
* using a DSAP and SSAP of 0x80, and putting a 2-byte field that appeared
* to contain, at least for IPP, the Ethertype value for IPP.
*
* We assume that the value there is an Ethertype value, except for
* the Retix spanning tree protocol, which also uses a DSAP and SSAP
* of 0x80 but has, at least in one capture, 0x0004 as the type
* field. We handle that specially.
*
* XXX - I've also seen packets on 802.11 with a DSAP and SSAP of 0x80,
* but with random stuff that appears neither to be XNS nor Retix
* spanning tree.
*/
static void
dissect_3com_xns(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_tree *subtree;
proto_tree *ti;
guint16 type;
tvbuff_t *next_tvb;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "3Com XNS");
col_clear(pinfo->cinfo, COL_INFO);
ti = proto_tree_add_item(tree, proto_3com_xns, tvb, 0, 4, ENC_NA);
subtree = proto_item_add_subtree(ti, ett_3com_xns);
type = tvb_get_ntohs(tvb, 0);
next_tvb = tvb_new_subset_remaining(tvb, 2);
if (type == 0x0004) {
proto_tree_add_uint(subtree, hf_3com_xns_type_retix_bpdu,
tvb, 0, 2, type);
call_dissector(retix_bpdu_handle, next_tvb, pinfo, tree);
} else {
proto_tree_add_uint(subtree, hf_3com_xns_type_ethertype,
tvb, 0, 2, type);
if (!dissector_try_uint(ethertype_subdissector_table,
type, next_tvb, pinfo, tree))
call_dissector(data_handle, next_tvb, pinfo, tree);
}
}
示例8: dissect_mpeg_sect
static void
dissect_mpeg_sect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
gint offset = 0;
guint section_length = 0;
gboolean syntax_indicator = FALSE;
guint8 table_id;
proto_item *ti;
proto_tree *mpeg_sect_tree;
table_id = tvb_get_guint8(tvb, offset);
/* Check if a dissector can parse the current table */
if (dissector_try_uint(mpeg_sect_tid_dissector_table, table_id, tvb, pinfo, tree))
return;
/* If no dissector is registered, use the common one */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "MPEG SECT");
col_add_fstr(pinfo->cinfo, COL_INFO, "Table ID 0x%02x", table_id);
ti = proto_tree_add_item(tree, proto_mpeg_sect, tvb, offset, -1, ENC_NA);
mpeg_sect_tree = proto_item_add_subtree(ti, ett_mpeg_sect);
proto_item_append_text(ti, " Table_ID=0x%02x", table_id);
packet_mpeg_sect_header(tvb, offset, mpeg_sect_tree,
§ion_length, &syntax_indicator);
if (syntax_indicator)
packet_mpeg_sect_crc(tvb, pinfo, mpeg_sect_tree, 0, (section_length-1));
}
示例9: dissect_ap1394
static void
dissect_ap1394(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_item *ti;
proto_tree *fh_tree = NULL;
const guint8 *src_addr, *dst_addr;
guint16 etype;
tvbuff_t *next_tvb;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "IP/IEEE1394");
col_clear(pinfo->cinfo, COL_INFO);
src_addr=tvb_get_ptr(tvb, 8, 8);
SET_ADDRESS(&pinfo->dl_src, AT_EUI64, 8, src_addr);
SET_ADDRESS(&pinfo->src, AT_EUI64, 8, src_addr);
dst_addr=tvb_get_ptr(tvb, 0, 8);
SET_ADDRESS(&pinfo->dl_dst, AT_EUI64, 8, dst_addr);
SET_ADDRESS(&pinfo->dst, AT_EUI64, 8, dst_addr);
if (tree) {
ti = proto_tree_add_protocol_format(tree, proto_ap1394, tvb, 0, 18,
"Apple IP-over-IEEE 1394, Src: %s, Dst: %s",
bytes_to_ep_str(src_addr, 8), bytes_to_ep_str(dst_addr, 8));
fh_tree = proto_item_add_subtree(ti, ett_ap1394);
proto_tree_add_bytes(fh_tree, hf_ap1394_dst, tvb, 0, 8, dst_addr);
proto_tree_add_bytes(fh_tree, hf_ap1394_src, tvb, 8, 8, src_addr);
}
etype = tvb_get_ntohs(tvb, 16);
if (tree)
proto_tree_add_uint(fh_tree, hf_ap1394_type, tvb, 16, 2, etype);
next_tvb = tvb_new_subset_remaining(tvb, 18);
if (!dissector_try_uint(ethertype_subdissector_table, etype, next_tvb,
pinfo, tree))
call_dissector(data_handle, next_tvb, pinfo, tree);
}
示例10: dissect_hsr_frame
/* Code to actually dissect the packets */
static void
dissect_hsr_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_item *ti;
proto_tree *hsr_tree;
tvbuff_t *next_tvb;
guint16 etype;
guint16 lsdu_size, lsdu_size_correct;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "HSR");
col_set_str(pinfo->cinfo, COL_INFO, "HSR-Data Frame");
/* create display subtree for the protocol */
ti = proto_tree_add_item(tree, proto_hsr, tvb, 0, HSR_TOTAL_LENGTH, ENC_NA);
hsr_tree = proto_item_add_subtree(ti, ett_hsr_frame);
proto_tree_add_item(hsr_tree, hf_hsr_path,
tvb, HSR_PATH_OFFSET, HSR_LSDU_PATH_LENGTH , ENC_BIG_ENDIAN);
proto_tree_add_item(hsr_tree, hf_hsr_netid,
tvb, HSR_PATH_OFFSET, HSR_LSDU_PATH_LENGTH , ENC_BIG_ENDIAN);
proto_tree_add_item(hsr_tree, hf_hsr_laneid,
tvb, HSR_PATH_OFFSET, HSR_LSDU_PATH_LENGTH , ENC_BIG_ENDIAN);
lsdu_size = tvb_get_ntohs(tvb, HSR_PATH_OFFSET) & 0x0fff;
lsdu_size_correct = tvb_reported_length_remaining(tvb, 0);
if (lsdu_size == lsdu_size_correct) {
proto_tree_add_uint_format(hsr_tree, hf_hsr_lsdu_size,
tvb, HSR_PATH_OFFSET, HSR_LSDU_PATH_LENGTH, lsdu_size,
"LSDU size: %d [correct]", lsdu_size);
} else {
proto_tree_add_uint_format(hsr_tree, hf_hsr_lsdu_size,
tvb, HSR_PATH_OFFSET, HSR_LSDU_PATH_LENGTH, lsdu_size,
"LSDU size: %d [WRONG, should be %d]", lsdu_size, lsdu_size_correct);
}
proto_tree_add_item(hsr_tree, hf_hsr_sequence_nr,
tvb, HSR_SEQUENZNR_OFFSET,HSR_SEQUENZNR_LENGTH, ENC_BIG_ENDIAN);
proto_tree_add_item(hsr_tree, hf_type,
tvb, HSR_TOTAL_LENGTH,2, ENC_BIG_ENDIAN);
next_tvb = tvb_new_subset (tvb, HSR_TOTAL_LENGTH + 2, -1, -1);
etype = tvb_get_ntohs(tvb, HSR_TOTAL_LENGTH);
if (!dissector_try_uint(ethertype_subdissector_table, etype, next_tvb, pinfo, tree))
call_dissector(data_handle, next_tvb, pinfo, hsr_tree);
}
示例11: decode_teredo_ports
static void
decode_teredo_ports(tvbuff_t *tvb, int offset, packet_info *pinfo,proto_tree *tree, int th_header)
{
tvbuff_t *next_tvb;
next_tvb = tvb_new_subset_remaining(tvb, offset);
if (dissector_try_uint(teredo_dissector_table, th_header, next_tvb, pinfo, tree))
return;
call_dissector(data_handle,next_tvb, pinfo, tree);
}
示例12: dissect_ppcap_payload_data
static int
dissect_ppcap_payload_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree * ppcap_tree1, int offset, proto_tree *tree, payload_type_type payload_type)
{
tvbuff_t *next_tvb;
guint16 msg_len;
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;
proto_tree_add_item(ppcap_tree1, hf_ppcap_payload_data, tvb, offset, msg_len, ENC_NA);
if (msg_len%4)
msg_len = msg_len +( 4- (msg_len%4));
next_tvb = tvb_new_subset_remaining(tvb, offset);
switch (payload_type) {
case PPCAP_MTP3:
call_dissector(mtp3_handle, next_tvb, pinfo, tree); /* calling the MTP3 handle */
break;
case PPCAP_TCAP:
/*
* 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 */
}
break;
case PPCAP_BSSAP:
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 */
break;
case PPCAP_H248:
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 */
break;
case PPCAP_SCCP:
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 */
break;
}
offset += msg_len;
return offset;
}
示例13: dissect_vxlan_common
static int
dissect_vxlan_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int is_gpe)
{
proto_tree *vxlan_tree;
proto_item *ti;
tvbuff_t *next_tvb;
int offset = 0;
guint32 vxlan_next_proto;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "VxLAN");
col_clear(pinfo->cinfo, COL_INFO);
ti = proto_tree_add_item(tree, proto_vxlan, tvb, offset, 8, ENC_NA);
vxlan_tree = proto_item_add_subtree(ti, ett_vxlan);
if(is_gpe) {
proto_tree_add_bitmask(vxlan_tree, tvb, offset, hf_vxlan_gpe_flags, ett_vxlan_flags, gpe_flags_fields, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(vxlan_tree, hf_vxlan_gpe_reserved_16, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item_ret_uint(vxlan_tree, hf_vxlan_next_proto, tvb, offset, 1, ENC_BIG_ENDIAN, &vxlan_next_proto);
offset += 1;
} else {
proto_tree_add_bitmask(vxlan_tree, tvb, offset, hf_vxlan_flags, ett_vxlan_flags, flags_fields, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(vxlan_tree, hf_vxlan_gbp, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
}
proto_tree_add_item(vxlan_tree, hf_vxlan_vni, tvb, offset, 3, ENC_BIG_ENDIAN);
offset += 3;
proto_tree_add_item(vxlan_tree, hf_vxlan_reserved_8, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
next_tvb = tvb_new_subset_remaining(tvb, offset);
if(is_gpe){
if(!dissector_try_uint(vxlan_dissector_table, vxlan_next_proto, next_tvb, pinfo, tree)) {
call_data_dissector(next_tvb, pinfo, vxlan_tree);
}
} else {
call_dissector(eth_handle, next_tvb, pinfo, tree);
}
return tvb_captured_length(tvb);
}
示例14: dissect_osi
static void dissect_osi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint8 nlpid;
tvbuff_t *new_tvb;
pinfo->current_proto = "OSI";
nlpid = tvb_get_guint8(tvb, 0);
/* try lookup with the subdissector tables that includes the nlpid */
if (dissector_try_uint(osinl_incl_subdissector_table, nlpid, tvb, pinfo, tree))
return;
/* try lookup with the subdissector tables that excludes the nlpid */
new_tvb = tvb_new_subset_remaining(tvb, 1);
if (dissector_try_uint(osinl_excl_subdissector_table, nlpid, new_tvb, pinfo, tree))
return;
switch (nlpid) {
/* ESIS (X.25) is not currently decoded */
case NLPID_ISO9542X25_ESIS:
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ESIS (X.25)");
call_dissector(data_handle,tvb, pinfo, tree);
break;
case NLPID_ISO10747_IDRP:
col_set_str(pinfo->cinfo, COL_PROTOCOL, "IDRP");
call_dissector(data_handle,tvb, pinfo, tree);
break;
default:
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ISO");
col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown ISO protocol (%02x)", nlpid);
call_dissector(data_handle,tvb, pinfo, tree);
break;
}
} /* dissect_osi */
示例15: dissect_ayiya
static void
dissect_ayiya(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_tree *ayiya_tree;
int offset = 0;
int idlen, siglen, ayiya_len;
guint8 next_header, opcode;
tvbuff_t *payload;
idlen = 1 << tvb_get_bits8(tvb, 0, 4);
siglen = tvb_get_bits8(tvb, 8, 4) * 4;
opcode = tvb_get_bits8(tvb, 20, 4);
next_header = tvb_get_guint8(tvb, 3);
ayiya_len = 8+idlen+siglen;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "AYIYA");
if (tree) {
proto_item *ti;
nstime_t tv;
ti = proto_tree_add_protocol_format( tree, proto_ayiya, tvb,
offset, ayiya_len, "AYIYA" );
ayiya_tree = proto_item_add_subtree(ti, ett_ayiya);
proto_tree_add_bits_item(ayiya_tree, hf_id_len, tvb, 0, 4, ENC_BIG_ENDIAN);
proto_tree_add_bits_item(ayiya_tree, hf_id_type, tvb, 4, 4, ENC_BIG_ENDIAN);
proto_tree_add_bits_item(ayiya_tree, hf_sig_len, tvb, 8, 4, ENC_BIG_ENDIAN);
proto_tree_add_bits_item(ayiya_tree, hf_hash_method, tvb, 12, 4, ENC_BIG_ENDIAN);
proto_tree_add_bits_item(ayiya_tree, hf_auth_method, tvb, 16, 4, ENC_BIG_ENDIAN);
proto_tree_add_bits_item(ayiya_tree, hf_opcode, tvb, 20, 4, ENC_BIG_ENDIAN);
proto_tree_add_uint_format(ayiya_tree, hf_next_header, tvb,
3, 1, next_header,
"Next header: %s (0x%02x)",
ipprotostr(next_header), next_header);
tv.secs = tvb_get_ntohl(tvb, 4);
tv.nsecs = 0;
proto_tree_add_time(ayiya_tree, hf_epoch, tvb, 4, 4, &tv);
proto_tree_add_item(ayiya_tree, hf_identity, tvb, 8, idlen, ENC_NA);
proto_tree_add_item(ayiya_tree, hf_signature, tvb, 8+idlen, siglen, ENC_NA);
}
offset = ayiya_len;
switch (opcode) {
case OPCODE_FORWARD:
payload = tvb_new_subset_remaining(tvb, offset);
dissector_try_uint(ip_dissector_table, next_header, payload, pinfo, tree);
break;
}
}