本文整理汇总了C++中proto_tree_add_uint函数的典型用法代码示例。如果您正苦于以下问题:C++ proto_tree_add_uint函数的具体用法?C++ proto_tree_add_uint怎么用?C++ proto_tree_add_uint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了proto_tree_add_uint函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dissect_tpkt_encap
//.........这里部分代码省略.........
pinfo->current_proto = "TPKT";
col_set_str(pinfo->cinfo, COL_PROTOCOL, "TPKT");
/*
* Don't add the TPKT header information if we're
* reassembling segmented TPKT PDUs or if this
* PDU isn't reassembled.
*
* XXX - the first is so that subdissectors can append
* information without getting TPKT stuff in the middle;
* why the second?
*/
if (!desegment && !pinfo->fragmented) {
col_add_fstr(pinfo->cinfo, COL_INFO,
"TPKT Data length = %u", data_len);
}
if (tree) {
ti = proto_tree_add_item(tree, proto_tpkt, tvb,
offset, 4, ENC_NA);
tpkt_tree = proto_item_add_subtree(ti, ett_tpkt);
proto_item_set_text(ti, "TPKT");
/* Version */
proto_tree_add_item(tpkt_tree, hf_tpkt_version, tvb,
offset, 1, ENC_BIG_ENDIAN);
proto_item_append_text(ti, ", Version: 3");
/* Reserved octet*/
proto_tree_add_item(tpkt_tree, hf_tpkt_reserved, tvb,
offset + 1, 1, ENC_BIG_ENDIAN);
/* Length */
proto_tree_add_uint(tpkt_tree, hf_tpkt_length, tvb,
offset + 2, 2, data_len);
proto_item_append_text(ti, ", Length: %u", data_len);
}
pinfo->current_proto = saved_proto;
/* Skip the TPKT header. */
offset += 4;
data_len -= 4;
/*
* Construct a tvbuff containing the amount of the payload
* we have available. Make its reported length the
* amount of data in this TPKT packet.
*
* XXX - if reassembly isn't enabled. the subdissector
* will throw a BoundsError exception, rather than a
* ReportedBoundsError exception. We really want
* a tvbuff where the length is "length", the reported
* length is "plen + 2", and the "if the snapshot length
* were infinite" length were the minimum of the
* reported length of the tvbuff handed to us and "plen+2",
* with a new type of exception thrown if the offset is
* within the reported length but beyond that third length,
* with that exception getting the "Unreassembled Packet"
* error.
*/
length = length_remaining - 4;
if (length > data_len)
length = data_len;
next_tvb = tvb_new_subset(tvb, offset, length, data_len);
/*
示例2: dissect_status
static void
dissect_status (packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint8 flags)
{
proto_item *item;
proto_tree *tree;
item=proto_tree_add_uint(parent_tree, hf_sbccs_dib_status,
tvb, offset, 1, flags);
tree=proto_item_add_subtree(item, ett_sbccs_dib_status);
proto_tree_add_boolean(tree, hf_sbccs_dib_status_attention, tvb, offset, 1, flags);
if (flags & 0x80) {
proto_item_append_text(item, " Attention");
col_append_str(pinfo->cinfo, COL_INFO, " Attention");
}
flags &= (~( 0x80 ));
proto_tree_add_boolean(tree, hf_sbccs_dib_status_modifier, tvb, offset, 1, flags);
if (flags & 0x40) {
proto_item_append_text(item, " Status Modifier");
col_append_str(pinfo->cinfo, COL_INFO, " Status Modifier");
}
flags &= (~( 0x40 ));
proto_tree_add_boolean(tree, hf_sbccs_dib_status_cue, tvb, offset, 1, flags);
if (flags & 0x20) {
proto_item_append_text(item, " Control-Unit End");
col_append_str(pinfo->cinfo, COL_INFO, " Control-Unit End");
}
flags &= (~( 0x20 ));
proto_tree_add_boolean(tree, hf_sbccs_dib_status_busy, tvb, offset, 1, flags);
if (flags & 0x10) {
proto_item_append_text(item, " Busy");
col_append_str(pinfo->cinfo, COL_INFO, " Busy");
}
flags &= (~( 0x10 ));
proto_tree_add_boolean(tree, hf_sbccs_dib_status_channelend, tvb, offset, 1, flags);
if (flags & 0x08) {
proto_item_append_text(item, " Channel End");
col_append_str(pinfo->cinfo, COL_INFO, " Channel End");
}
flags &= (~( 0x08 ));
proto_tree_add_boolean(tree, hf_sbccs_dib_status_deviceend, tvb, offset, 1, flags);
if (flags & 0x04) {
proto_item_append_text(item, " Device End");
col_append_str(pinfo->cinfo, COL_INFO, " Device End");
}
flags &= (~( 0x04 ));
proto_tree_add_boolean(tree, hf_sbccs_dib_status_unit_check, tvb, offset, 1, flags);
if (flags & 0x02) {
proto_item_append_text(item, " Unit Check");
col_append_str(pinfo->cinfo, COL_INFO, " Unit Check");
}
flags &= (~( 0x02 ));
proto_tree_add_boolean(tree, hf_sbccs_dib_status_unit_exception, tvb, offset, 1, flags);
if (flags & 0x01) {
proto_item_append_text(item, " Unit Exception");
col_append_str(pinfo->cinfo, COL_INFO, " Unit Exception");
}
/*flags &= (~( 0x01 ));*/
}
示例3: dissect_applemidi_common
static void
dissect_applemidi_common( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 command ) {
guint16 seq_num;
guint8 count;
guint8 *name;
gint offset = 0;
gint len;
gint string_size;
proto_tree *applemidi_tree;
proto_tree *applemidi_tree_seq_num;
col_set_str( pinfo->cinfo, COL_PROTOCOL, APPLEMIDI_DISSECTOR_SHORTNAME );
/* Clear out stuff in the info column */
col_clear( pinfo->cinfo, COL_INFO );
col_add_fstr( pinfo->cinfo, COL_INFO, "%s", val_to_str( command, applemidi_commands, applemidi_unknown_command ) );
if ( tree ) {
proto_item *ti;
ti = proto_tree_add_item( tree, proto_applemidi, tvb, 0, -1, ENC_NA );
applemidi_tree = proto_item_add_subtree( ti, ett_applemidi );
proto_tree_add_item( applemidi_tree, hf_applemidi_signature, tvb, offset, 2, ENC_BIG_ENDIAN );
offset += 2;
proto_tree_add_item( applemidi_tree, hf_applemidi_command, tvb, offset, 2, ENC_BIG_ENDIAN );
offset += 2;
/* the format of packets for "IN", "NO", "OK" and "BY" is identical and contains
* the protocol version, a random number generated by the initiator of the session,
* the SSRC that is used by the respective sides RTP-entity and optionally the
* name of the participant */
if ( ( APPLEMIDI_COMMAND_INVITATION == command ) ||
( APPLEMIDI_COMMAND_INVITATION_REJECTED == command ) ||
( APLLEMIDI_COMMAND_INVITATION_ACCEPTED == command ) ||
( APPLEMIDI_COMMAND_ENDSESSION == command ) ) {
proto_tree_add_item( applemidi_tree, hf_applemidi_protocol_version, tvb, offset, 4, ENC_BIG_ENDIAN );
offset += 4;
proto_tree_add_item( applemidi_tree, hf_applemidi_token, tvb, offset, 4, ENC_BIG_ENDIAN );
offset += 4;
proto_tree_add_item( applemidi_tree, hf_applemidi_ssrc, tvb, offset, 4, ENC_BIG_ENDIAN );
offset += 4;
len = tvb_reported_length(tvb) - offset;
/* Name is optional */
if ( len > 0 ) {
name = tvb_get_ephemeral_string( tvb, offset, len );
string_size = (gint)( strlen( name ) + 1 );
proto_tree_add_item( applemidi_tree, hf_applemidi_name, tvb, offset, string_size, ENC_UTF_8|ENC_NA );
col_append_fstr( pinfo->cinfo, COL_INFO, ": peer = \"%s\"", name );
offset += string_size;
}
/* the synchronization packet contains three 64bit timestamps, and a value to define how
* many of the timestamps transmitted are valid */
} else if ( APPLEMIDI_COMMAND_SYNCHRONIZATION == command ) {
proto_tree_add_item( applemidi_tree, hf_applemidi_ssrc, tvb, offset, 4, ENC_BIG_ENDIAN );
offset += 4;
count = tvb_get_guint8( tvb, offset );
proto_tree_add_item( applemidi_tree, hf_applemidi_count, tvb, offset, 1, ENC_BIG_ENDIAN );
col_append_fstr( pinfo->cinfo, COL_INFO, ": count = %u", count );
offset += 1;
proto_tree_add_item( applemidi_tree, hf_applemidi_padding, tvb, offset, 3, ENC_BIG_ENDIAN );
offset += 3;
proto_tree_add_item( applemidi_tree, hf_applemidi_timestamp1, tvb, offset, 8, ENC_BIG_ENDIAN );
offset += 8;
proto_tree_add_item( applemidi_tree, hf_applemidi_timestamp2, tvb, offset, 8, ENC_BIG_ENDIAN );
offset += 8;
proto_tree_add_item( applemidi_tree, hf_applemidi_timestamp3, tvb, offset, 8, ENC_BIG_ENDIAN );
offset += 8;
/* With the receiver feedback packet, the recipient can tell the sender up to what sequence
* number in the RTP-stream the packets have been received; this can be used to shorten the
* recovery-journal-section in the RTP-session */
} else if ( APPLEMIDI_COMMAND_RECEIVER_FEEDBACK == command ) {
proto_tree_add_item( applemidi_tree, hf_applemidi_ssrc, tvb, offset, 4, ENC_BIG_ENDIAN );
offset += 4;
ti = proto_tree_add_item( applemidi_tree, hf_applemidi_sequence_num, tvb, offset, 4, ENC_BIG_ENDIAN );
/* Apple includes a 32bit sequence-number, but the RTP-packet only specifies 16bit.
* this subtree and subitem are added to be able to associate the sequence-number
* here easier with the one specified in the corresponding RTP-packet */
applemidi_tree_seq_num = proto_item_add_subtree( ti, ett_applemidi_seq_num );
seq_num = tvb_get_ntohs( tvb, offset );
proto_tree_add_uint( applemidi_tree_seq_num, hf_applemidi_rtp_sequence_num, tvb, offset, 2, seq_num );
offset += 4;
col_append_fstr( pinfo->cinfo, COL_INFO, ": seq = %u", seq_num );
/* With the bitrate receive limit packet, the recipient can tell the sender to limit
//.........这里部分代码省略.........
示例4: dissect_ncp_common
static void
dissect_ncp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
gboolean is_tcp)
{
proto_tree *ncp_tree = NULL;
proto_item *ti;
struct ncp_ip_header ncpiph;
struct ncp_ip_rqhdr ncpiphrq;
guint16 ncp_burst_seqno, ncp_ack_seqno;
guint16 flags = 0;
proto_tree *flags_tree = NULL;
int hdr_offset = 0;
int commhdr = 0;
int offset = 0;
gint length_remaining;
tvbuff_t *next_tvb;
guint32 testvar = 0, ncp_burst_command, burst_len, burst_off, burst_file;
guint8 subfunction;
guint32 nw_connection = 0, data_offset;
guint16 data_len = 0;
guint16 missing_fraglist_count = 0;
mncp_rhash_value *request_value = NULL;
conversation_t *conversation;
proto_item *expert_item;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "NCP");
col_clear(pinfo->cinfo, COL_INFO);
ncp_hdr = &header;
ti = proto_tree_add_item(tree, proto_ncp, tvb, 0, -1, ENC_NA);
ncp_tree = proto_item_add_subtree(ti, ett_ncp);
if (is_tcp) {
if (tvb_get_ntohl(tvb, hdr_offset) != NCPIP_RQST && tvb_get_ntohl(tvb, hdr_offset) != NCPIP_RPLY)
commhdr += 1;
/* Get NCPIP Header data */
ncpiph.signature = tvb_get_ntohl(tvb, commhdr);
proto_tree_add_uint(ncp_tree, hf_ncp_ip_sig, tvb, commhdr, 4, ncpiph.signature);
ncpiph.length = (0x7fffffff & tvb_get_ntohl(tvb, commhdr+4));
proto_tree_add_uint(ncp_tree, hf_ncp_ip_length, tvb, commhdr+4, 4, ncpiph.length);
commhdr += 8;
if (ncpiph.signature == NCPIP_RQST) {
ncpiphrq.version = tvb_get_ntohl(tvb, commhdr);
proto_tree_add_uint(ncp_tree, hf_ncp_ip_ver, tvb, commhdr, 4, ncpiphrq.version);
commhdr += 4;
ncpiphrq.rplybufsize = tvb_get_ntohl(tvb, commhdr);
proto_tree_add_uint(ncp_tree, hf_ncp_ip_rplybufsize, tvb, commhdr, 4, ncpiphrq.rplybufsize);
commhdr += 4;
}
/* Check to see if this is a valid offset, otherwise increment for packet signature */
if (try_val_to_str(tvb_get_ntohs(tvb, commhdr), ncp_type_vals)==NULL) {
/* Check to see if we have a valid type after packet signature length */
if (try_val_to_str(tvb_get_ntohs(tvb, commhdr+8), ncp_type_vals)!=NULL) {
proto_tree_add_item(ncp_tree, hf_ncp_ip_packetsig, tvb, commhdr, 8, ENC_NA);
commhdr += 8;
}
}
} else {
/* Initialize this structure, we use it below */
memset(&ncpiph, 0, sizeof(ncpiph));
}
header.type = tvb_get_ntohs(tvb, commhdr);
header.sequence = tvb_get_guint8(tvb, commhdr+2);
header.conn_low = tvb_get_guint8(tvb, commhdr+3);
header.task = tvb_get_guint8(tvb, commhdr+4);
header.conn_high = tvb_get_guint8(tvb, commhdr+5);
proto_tree_add_uint(ncp_tree, hf_ncp_type, tvb, commhdr, 2, header.type);
nw_connection = (header.conn_high*256)+header.conn_low;
/* Ok, we need to track the conversation so that we can
* determine if a new server session is occuring for this
* connection.
*/
conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
PT_NCP, (guint32) pinfo->srcport, (guint32) pinfo->destport,
0);
if ((ncpiph.length & 0x80000000) || ncpiph.signature == NCPIP_RPLY) {
/* First time through we will record the initial connection and task
* values
*/
if (!pinfo->fd->flags.visited) {
if (conversation != NULL) {
/* find the record telling us the
* request made that caused this
* reply
*/
request_value = mncp_hash_lookup(conversation, nw_connection, header.task);
/* if for some reason we have no
* conversation in our hash, create
* one */
if (request_value == NULL) {
mncp_hash_insert(conversation, nw_connection, header.task, pinfo);
}
} else {
/* It's not part of any conversation
* - create a new one.
*/
conversation = conversation_new(pinfo->fd->num, &pinfo->src,
&pinfo->dst, PT_NCP, (guint32) pinfo->srcport, (guint32) pinfo->destport, 0);
//.........这里部分代码省略.........
示例5: dissect_file_record
static void
dissect_file_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
{
proto_item *volatile ti = NULL;
guint cap_len = 0, frame_len = 0;
proto_tree *volatile tree;
proto_item *item;
const gchar *cap_plurality, *frame_plurality;
tree=parent_tree;
pinfo->current_proto = "File";
/* if FILE is not referenced from any filters we don't need to worry about
generating any tree items. */
if(!proto_field_is_referenced(tree, proto_file)) {
tree=NULL;
} else {
proto_tree *fh_tree;
gboolean old_visible;
/* Put in frame header information. */
cap_len = tvb_length(tvb);
frame_len = tvb_reported_length(tvb);
cap_plurality = plurality(cap_len, "", "s");
frame_plurality = plurality(frame_len, "", "s");
ti = proto_tree_add_protocol_format(tree, proto_file, tvb, 0, -1,
"File record %u: %u byte%s",
pinfo->fd->num, frame_len, frame_plurality);
proto_item_append_text(ti, ", %u byte%s",
cap_len, cap_plurality);
fh_tree = proto_item_add_subtree(ti, ett_file);
proto_tree_add_int(fh_tree, hf_file_ftap_encap, tvb, 0, 0, pinfo->fd->lnk_t);
proto_tree_add_uint(fh_tree, hf_file_record_number, tvb, 0, 0, pinfo->fd->num);
proto_tree_add_uint_format(fh_tree, hf_file_record_len, tvb,
0, 0, frame_len, "Record Length: %u byte%s (%u bits)",
frame_len, frame_plurality, frame_len * 8);
ti = proto_tree_add_boolean(fh_tree, hf_file_marked, tvb, 0, 0,pinfo->fd->flags.marked);
PROTO_ITEM_SET_GENERATED(ti);
ti = proto_tree_add_boolean(fh_tree, hf_file_ignored, tvb, 0, 0,pinfo->fd->flags.ignored);
PROTO_ITEM_SET_GENERATED(ti);
if(proto_field_is_referenced(tree, hf_file_protocols)) {
/* we are going to be using proto_item_append_string() on
* hf_frame_protocols, and we must therefore disable the
* TRY_TO_FAKE_THIS_ITEM() optimisation for the tree by
* setting it as visible.
*
* See proto.h for details.
*/
old_visible = proto_tree_set_visible(fh_tree, TRUE);
ti = proto_tree_add_string(fh_tree, hf_file_protocols, tvb, 0, 0, "");
PROTO_ITEM_SET_GENERATED(ti);
proto_tree_set_visible(fh_tree, old_visible);
}
if(pinfo->fd->pfd != 0){
proto_item *ppd_item;
guint num_entries = g_slist_length(pinfo->fd->pfd);
guint i;
ppd_item = proto_tree_add_uint(fh_tree, hf_file_num_p_prot_data, tvb, 0, 0, num_entries);
PROTO_ITEM_SET_GENERATED(ppd_item);
for(i=0; i<num_entries; i++){
proto_tree_add_text (fh_tree, tvb, 0, 0, "%s",p_get_proto_name_and_key(wmem_file_scope(), pinfo, i));
}
}
#if 0
if (show_file_off) {
proto_tree_add_int64_format_value(fh_tree, hf_frame_file_off, tvb,
0, 0, pinfo->fd->file_off,
"%" G_GINT64_MODIFIER "d (0x%" G_GINT64_MODIFIER "x)",
pinfo->fd->file_off, pinfo->fd->file_off);
}
#endif
if(pinfo->fd->color_filter != NULL) {
const color_filter_t *color_filter = (const color_filter_t *)pinfo->fd->color_filter;
item = proto_tree_add_string(fh_tree, hf_file_color_filter_name, tvb,
0, 0, color_filter->filter_name);
PROTO_ITEM_SET_GENERATED(item);
item = proto_tree_add_string(fh_tree, hf_file_color_filter_text, tvb,
0, 0, color_filter->filter_text);
PROTO_ITEM_SET_GENERATED(item);
}
}
if (pinfo->fd->flags.ignored) {
/* Ignored package, stop handling here */
col_set_str(pinfo->cinfo, COL_INFO, "<Ignored>");
proto_tree_add_text (tree, tvb, 0, -1, "This record is marked as ignored");
return;
//.........这里部分代码省略.........
示例6: dissect_dtpt_sockaddr
static int
dissect_dtpt_sockaddr(tvbuff_t *tvb, guint offset, proto_tree *tree, int hfindex, int sockaddr_type)
{
guint32 sockaddr_length = 0;
proto_item *sockaddr_item = NULL;
proto_tree *sockaddr_tree = NULL;
guint32 sockaddr_len1 = 0;
guint32 sockaddr_len2 = 0;
switch (sockaddr_type) {
case SOCKADDR_WITH_LEN:
sockaddr_len1=4;
sockaddr_len2=16;
break;
case SOCKADDR_CONNECT:
sockaddr_len1=0;
sockaddr_len2=30;
break;
}
if (sockaddr_type == SOCKADDR_WITH_LEN)
sockaddr_length = tvb_get_letohl(tvb, offset + 0);
if (tree) {
sockaddr_tree = proto_tree_add_subtree(tree, tvb, offset, sockaddr_len1+sockaddr_len2,
ett_dtpt_sockaddr, NULL, proto_registrar_get_name(hfindex));
if (sockaddr_type == SOCKADDR_WITH_LEN)
proto_tree_add_uint(sockaddr_tree, hf_dtpt_sockaddr_length,
tvb, offset+0, 4, sockaddr_length);
}
offset += sockaddr_len1;
if (sockaddr_tree) {
switch (sockaddr_type) {
case SOCKADDR_WITH_LEN: {
guint16 family;
family = tvb_get_letohs(tvb, offset);
proto_tree_add_uint(sockaddr_tree, hf_dtpt_sockaddr_family,
tvb, offset, 2, family);
switch (family) {
case WINSOCK_AF_INET: {
guint16 port;
port = tvb_get_ntohs(tvb,offset+2);
proto_tree_add_uint(sockaddr_tree, hf_dtpt_sockaddr_port,
tvb, offset+2,2,port);
proto_tree_add_item(sockaddr_tree, hf_dtpt_sockaddr_address,
tvb, offset+4,4,ENC_BIG_ENDIAN);
proto_tree_add_item(sockaddr_tree, hf_dtpt_padding, tvb, offset+8, 8, ENC_NA);
proto_item_append_text(sockaddr_item, ": %s:%d", tvb_ip_to_str(tvb,offset+4), port);
}
break;
}
}
break;
case SOCKADDR_CONNECT: {
guint32 family;
family = tvb_get_letohl(tvb, offset+0);
proto_tree_add_uint(sockaddr_tree, hf_dtpt_sockaddr_family,
tvb, offset+0, 4, family);
switch (family) {
case WINSOCK_AF_INET: {
guint16 port;
proto_tree_add_item(sockaddr_tree, hf_dtpt_padding, tvb, offset+4, 4, ENC_NA);
port = tvb_get_ntohs(tvb,offset+8);
proto_tree_add_uint(sockaddr_tree, hf_dtpt_sockaddr_port,
tvb, offset+8,2,port);
proto_tree_add_item(sockaddr_tree, hf_dtpt_sockaddr_address,
tvb, offset+10,4,ENC_BIG_ENDIAN);
proto_tree_add_item(sockaddr_tree, hf_dtpt_padding, tvb, offset+14, 16, ENC_NA);
proto_item_append_text(sockaddr_item, ": %s:%d", tvb_ip_to_str(tvb,offset+10), port);
}
break;
}
}
break;
}
}
offset += sockaddr_len2;
return offset;
}
示例7: dissect_PNDCP_Suboption_IP
/* dissect the "IP" suboption */
static int
dissect_PNDCP_Suboption_IP(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, proto_item *block_item, proto_item *dcp_item,
guint8 service_id, gboolean is_response)
{
guint8 suboption;
guint16 block_length;
guint16 block_info;
guint16 block_qualifier;
guint32 ip;
proto_item *item = NULL;
/* SuboptionIPParameter */
offset = dissect_pn_uint8 (tvb, offset, pinfo, tree, hf_pn_dcp_suboption_ip, &suboption);
/* DCPBlockLength */
offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_length, &block_length);
switch(suboption) {
case(PNDCP_SUBOPTION_IP_MAC):
/* MACAddressValue? */
pn_append_info(pinfo, dcp_item, ", MAC");
proto_item_append_text(block_item, "IP/MAC");
offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, block_length);
break;
case(PNDCP_SUBOPTION_IP_IP):
pn_append_info(pinfo, dcp_item, ", IP");
proto_item_append_text(block_item, "IP/IP");
/* BlockInfo? */
if( ((service_id == PNDCP_SERVICE_ID_IDENTIFY) && is_response) ||
((service_id == PNDCP_SERVICE_ID_HELLO) && !is_response) ||
((service_id == PNDCP_SERVICE_ID_GET) && is_response)) {
block_info = tvb_get_ntohs (tvb, offset);
if (tree) {
item = proto_tree_add_uint(tree, hf_pn_dcp_suboption_ip_block_info, tvb, offset, 2, block_info);
}
offset += 2;
proto_item_append_text(block_item, ", BlockInfo: %s", val_to_str(block_info, pn_dcp_suboption_ip_block_info, "Undecoded"));
block_length -= 2;
if(block_info & 0x80) {
expert_add_info_format(pinfo, item, PI_RESPONSE_CODE, PI_NOTE, "IP address conflict detected!");
}
}
/* BlockQualifier? */
if( (service_id == PNDCP_SERVICE_ID_SET) && !is_response) {
offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_qualifier, &block_qualifier);
proto_item_append_text(block_item, ", BlockQualifier: %s", val_to_str(block_qualifier, pn_dcp_block_qualifier, "Unknown"));
block_length -= 2;
}
/* IPParameterValue ... */
/* IPAddress */
offset = dissect_pn_ipv4(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_ip_ip, &ip);
proto_item_append_text(block_item, ", IP: %s", ip_to_str((guint8*)&ip));
/* Subnetmask */
offset = dissect_pn_ipv4(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_ip_subnetmask, &ip);
proto_item_append_text(block_item, ", Subnet: %s", ip_to_str((guint8*)&ip));
/* StandardGateway */
offset = dissect_pn_ipv4(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_ip_standard_gateway, &ip);
proto_item_append_text(block_item, ", Gateway: %s", ip_to_str((guint8*)&ip));
break;
default:
offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, block_length);
}
return offset;
}
示例8: dissect_banana_element
static int
dissect_banana_element(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) {
proto_item *ti;
proto_tree *list_tree;
guint8 byte = 0;
gint64 val = 0;
gint val_len = 0;
int start_offset = offset;
int old_offset;
int i;
/* Accumulate our value/length 'til we hit a valid type */
while (tvb_reported_length_remaining(tvb, offset) > 0) {
byte = tvb_get_guint8(tvb, offset);
offset++;
if (byte & 0x80) {
if (is_element(byte)) {
break;
} else {
expert_add_info_format(pinfo, NULL, &ei_banana_unknown_type, "Unknown type %u", byte);
}
} else {
val_len++;
if (val_len > MAX_ELEMENT_VAL_LEN) {
expert_add_info(pinfo, NULL, &ei_banana_too_many_value_bytes);
}
val += byte + (val << 7);
}
}
/* Type */
switch (byte) {
case BE_LIST:
if (val > MAX_ELEMENT_VAL) {
expert_add_info_format(pinfo, NULL, &ei_banana_length_too_long, "List length %" G_GINT64_MODIFIER "d longer than we can handle", val);
}
ti = proto_tree_add_uint_format_value(tree, hf_banana_list, tvb, start_offset, offset - start_offset - 1, (guint32) val, "(%d items)", (gint) val);
list_tree = proto_item_add_subtree(ti, ett_list);
for (i = 0; i < val; i++) {
old_offset = offset;
offset += dissect_banana_element(tvb, pinfo, list_tree, offset);
if (offset <= old_offset) {
return offset - start_offset;
}
}
break;
case BE_INT:
if (val > MAX_ELEMENT_VAL) {
expert_add_info_format(pinfo, NULL, &ei_banana_value_too_large, "Integer value %" G_GINT64_MODIFIER "d too large", val);
}
proto_tree_add_uint(tree, hf_banana_int, tvb, start_offset, offset - start_offset, (guint32) val);
break;
case BE_STRING:
if (val > MAX_ELEMENT_VAL) {
expert_add_info_format(pinfo, NULL, &ei_banana_length_too_long, "String length %" G_GINT64_MODIFIER "d longer than we can handle", val);
}
proto_tree_add_item(tree, hf_banana_string, tvb, offset, (guint32) val, ENC_ASCII|ENC_NA);
offset += (gint) val;
break;
case BE_NEG_INT:
if (val > MAX_ELEMENT_VAL) {
expert_add_info_format(pinfo, NULL, &ei_banana_value_too_large, "Integer value -%" G_GINT64_MODIFIER "d too large", val);
}
proto_tree_add_int(tree, hf_banana_neg_int, tvb, start_offset, offset - start_offset, (gint32) val * -1);
break;
case BE_FLOAT:
proto_tree_add_item(tree, hf_banana_float, tvb, offset, 8, ENC_BIG_ENDIAN);
offset += 8;
break;
case BE_LG_INT:
proto_tree_add_item(tree, hf_banana_lg_int, tvb, start_offset, offset - start_offset, ENC_NA);
break;
case BE_LG_NEG_INT:
proto_tree_add_item(tree, hf_banana_lg_neg_int, tvb, start_offset, offset - start_offset, ENC_NA);
break;
case BE_PB:
if (val_len > 1) {
expert_add_info(pinfo, NULL, &ei_banana_pb_error);
}
/*
* The spec says the pb dictionary value comes after the tag.
* In real-world captures it comes before.
*/
proto_tree_add_item(tree, hf_banana_pb, tvb, offset - 2, 1, ENC_BIG_ENDIAN);
break;
default:
return 0;
break;
}
return offset - start_offset;
}
示例9: dissect_ucd
/* Code to actually dissect the packets */
static void
dissect_ucd (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
{
int pos, endtlvpos;
guint8 type, length;
guint8 tlvlen, tlvtype;
proto_tree *ucd_tree;
proto_item *ucd_item;
proto_tree *tlv_tree;
proto_item *tlv_item;
gint len;
guint8 upchid, symrate;
len = tvb_reported_length_remaining (tvb, 0);
upchid = tvb_get_guint8 (tvb, 0);
/* if the upstream Channel ID is 0 then this is for Telephony Return) */
if (upchid > 0)
col_add_fstr (pinfo->cinfo, COL_INFO,
"UCD Message: Channel ID = %u (U%u)", upchid,
upchid - 1);
else
col_add_fstr (pinfo->cinfo, COL_INFO,
"UCD Message: Channel ID = %u (Telephony Return)",
upchid);
if (tree)
{
ucd_item =
proto_tree_add_protocol_format (tree, proto_docsis_ucd, tvb, 0, -1,
"UCD Message");
ucd_tree = proto_item_add_subtree (ucd_item, ett_docsis_ucd);
proto_tree_add_item (ucd_tree, hf_docsis_ucd_upstream_chid, tvb, 0, 1,
ENC_BIG_ENDIAN);
proto_tree_add_item (ucd_tree, hf_docsis_ucd_config_ch_cnt, tvb, 1, 1,
ENC_BIG_ENDIAN);
proto_tree_add_item (ucd_tree, hf_docsis_ucd_mini_slot_size, tvb, 2, 1,
ENC_BIG_ENDIAN);
proto_tree_add_item (ucd_tree, hf_docsis_ucd_down_chid, tvb, 3, 1,
ENC_BIG_ENDIAN);
pos = 4;
while (pos < len)
{
type = tvb_get_guint8 (tvb, pos);
tlv_item = proto_tree_add_text (ucd_tree, tvb, pos, -1,
"%s",
val_to_str(type, channel_tlv_vals,
"Unknown TLV (%u)"));
tlv_tree = proto_item_add_subtree (tlv_item, ett_tlv);
proto_tree_add_uint (tlv_tree, hf_docsis_ucd_type,
tvb, pos, 1, type);
pos++;
length = tvb_get_guint8 (tvb, pos);
proto_tree_add_uint (tlv_tree, hf_docsis_ucd_length,
tvb, pos, 1, length);
pos++;
proto_item_set_len(tlv_item, length + 2);
switch (type)
{
case UCD_SYMBOL_RATE:
if (length == 1)
{
symrate = tvb_get_guint8 (tvb, pos);
proto_tree_add_uint (tlv_tree, hf_docsis_ucd_symbol_rate,
tvb, pos, length, symrate * 160);
}
else
{
THROW (ReportedBoundsError);
}
pos = pos + length;
break;
case UCD_FREQUENCY:
if (length == 4)
{
proto_tree_add_item (tlv_tree, hf_docsis_ucd_frequency, tvb,
pos, length, ENC_BIG_ENDIAN);
pos = pos + length;
}
else
{
THROW (ReportedBoundsError);
}
break;
case UCD_PREAMBLE:
proto_tree_add_item (tlv_tree, hf_docsis_ucd_preamble_pat, tvb,
pos, length, ENC_NA);
pos = pos + length;
break;
case UCD_BURST_DESCR:
proto_tree_add_item (tlv_tree, hf_docsis_ucd_iuc, tvb,
pos++, 1, ENC_BIG_ENDIAN);
endtlvpos = pos + length - 1;
while (pos < endtlvpos)
{
tlvtype = tvb_get_guint8 (tvb, pos++);
tlvlen = tvb_get_guint8 (tvb, pos++);
switch (tlvtype)
//.........这里部分代码省略.........
示例10: dissect_kt_remove_bulk
static int
dissect_kt_remove_bulk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
{
guint32 next32, rnum, ksiz;
gint new_offset, rec_start_offset;
proto_item *ti;
proto_item *pi;
proto_tree *rec_tree;
new_offset = offset;
proto_tree_add_item(tree, hf_kt_magic, tvb, new_offset, 1, ENC_BIG_ENDIAN);
new_offset++;
next32 = tvb_get_ntohl(tvb, new_offset);
if (tvb_reported_length_remaining(tvb, (new_offset + 4)) > 0) { /* request */
pi = proto_tree_add_uint(tree, hf_kt_type, tvb, offset, 1, KT_OPER_REQUEST);
proto_item_set_generated(pi);
proto_tree_add_uint(tree, hf_kt_flags, tvb, new_offset, 4, next32);
new_offset += 4;
rnum = tvb_get_ntohl(tvb, new_offset);
proto_tree_add_uint(tree, hf_kt_rnum, tvb, new_offset, 4, rnum);
new_offset += 4;
while (rnum > 0) {
/* Create a sub-tree for each record */
ti = proto_tree_add_item(tree, hf_kt_rec, tvb, new_offset, -1, ENC_NA);
rec_tree = proto_item_add_subtree(ti, ett_kt_rec);
rec_start_offset = new_offset;
proto_tree_add_item(rec_tree, hf_kt_dbidx, tvb, new_offset, 2, ENC_BIG_ENDIAN);
new_offset += 2;
ksiz = tvb_get_ntohl(tvb, new_offset);
proto_tree_add_uint(rec_tree, hf_kt_ksiz, tvb, new_offset, 4, ksiz);
new_offset += 4;
proto_tree_add_item(rec_tree, hf_kt_key, tvb, new_offset, ksiz, ENC_NA);
if (kt_present_key_val_as_ascii) {
pi = proto_tree_add_item(rec_tree, hf_kt_key_str, tvb, new_offset, ksiz, ENC_ASCII|ENC_NA);
proto_item_set_generated(pi);
}
new_offset += ksiz;
proto_item_set_len(ti, new_offset - rec_start_offset);
rnum--;
}
} else { /* response */
pi = proto_tree_add_uint(tree, hf_kt_type, tvb, offset, 1, KT_OPER_RESPONSE);
proto_item_set_generated(pi);
col_append_sep_str(pinfo->cinfo, COL_INFO, " ", "[response]");
proto_tree_add_uint(tree, hf_kt_hits, tvb, new_offset, 4, next32);
new_offset += 4;
}
return new_offset;
}
示例11: dissect_802_3
void
dissect_802_3(volatile int length, gboolean is_802_2, tvbuff_t *tvb,
int offset_after_length, packet_info *pinfo, proto_tree *tree,
proto_tree *fh_tree, int length_id, int trailer_id, expert_field* ei_len,
int fcs_len)
{
proto_item *length_it;
tvbuff_t *volatile next_tvb = NULL;
tvbuff_t *trailer_tvb = NULL;
const char *saved_proto;
gint captured_length, reported_length;
void *pd_save;
length_it = proto_tree_add_uint(fh_tree, length_id, tvb,
offset_after_length - 2, 2, length);
/* Get the length of the payload.
If the FCS length is positive, remove the FCS.
(If it's zero, there's no FCS; if it's negative, we don't know whether
there's an FCS, so we'll guess based on the length of the trailer.) */
reported_length = tvb_reported_length_remaining(tvb, offset_after_length);
if (fcs_len > 0) {
if (reported_length >= fcs_len)
reported_length -= fcs_len;
}
/* Make sure the length in the 802.3 header doesn't go past the end of
the payload. */
if (length > reported_length) {
length = reported_length;
expert_add_info(pinfo, length_it, ei_len);
}
/* Give the next dissector only 'length' number of bytes. */
captured_length = tvb_length_remaining(tvb, offset_after_length);
if (captured_length > length)
captured_length = length;
next_tvb = tvb_new_subset(tvb, offset_after_length, captured_length, length);
/* Dissect the payload either as IPX or as an LLC frame.
Catch non-fatal exceptions, so that if the reported length
of "next_tvb" was reduced by some dissector before an
exception was thrown, we can still put in an item for
the trailer. */
saved_proto = pinfo->current_proto;
pd_save = pinfo->private_data;
TRY {
if (is_802_2)
call_dissector(llc_handle, next_tvb, pinfo, tree);
else {
/* Check if first three bits of payload are 0x7.
If so, then payload is IPX. If not, then it's CCSDS.
Refer to packet-eth.c for setting of is_802_2 variable. */
if (tvb_get_bits8(next_tvb, 0, 3) == 7)
call_dissector(ipx_handle, next_tvb, pinfo, tree);
else
call_dissector(ccsds_handle, next_tvb, pinfo, tree);
}
}
CATCH_NONFATAL_ERRORS {
/* Somebody threw an exception that means that there was a problem
dissecting the payload; that means that a dissector was found,
so we don't need to dissect the payload as data or update the
protocol or info columns.
Just show the exception and then drive on to show the trailer,
after noting that a dissector was found and restoring the
protocol value that was in effect before we called the subdissector. */
pinfo->private_data = pd_save;
show_exception(next_tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE);
}
ENDTRY;
/* Restore the protocol value, so that any exception thrown by
tvb_new_subset_remaining() refers to the protocol for which
this is a trailer, and restore the private_data structure in
case one of the called dissectors modified it. */
pinfo->private_data = pd_save;
pinfo->current_proto = saved_proto;
/* Construct a tvbuff for the trailer; if the trailer is past the
end of the captured data, this will throw a BoundsError, which
is what we want, as it'll report that the packet was cut short. */
trailer_tvb = tvb_new_subset_remaining(tvb, offset_after_length + length);
add_ethernet_trailer(pinfo, tree, fh_tree, trailer_id, tvb, trailer_tvb, fcs_len);
}
示例12: dissect_kt_play_script
static int
dissect_kt_play_script(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
{
guint32 next32, rnum, ksiz, vsiz, nsiz;
gint new_offset, rec_start_offset;
proto_item *ti;
proto_item *pi;
proto_tree *rec_tree;
new_offset = offset;
proto_tree_add_item(tree, hf_kt_magic, tvb, new_offset, 1, ENC_BIG_ENDIAN);
new_offset++;
next32 = tvb_get_ntohl(tvb, new_offset);
if (next32 == 0) {
if (tvb_reported_length_remaining(tvb, (new_offset + 4)) > 0) {
/* There's more data after the 32 bits. This is a request */
pi = proto_tree_add_uint(tree, hf_kt_type, tvb, offset, 1, KT_OPER_REQUEST);
proto_item_set_generated(pi);
proto_tree_add_uint(tree, hf_kt_flags, tvb, new_offset, 4, next32);
new_offset += 4;
nsiz = tvb_get_ntohl(tvb, new_offset);
proto_tree_add_uint(tree, hf_kt_nsiz, tvb, new_offset, 4, nsiz);
new_offset += 4;
rnum = tvb_get_ntohl(tvb, new_offset);
proto_tree_add_uint(tree, hf_kt_rnum, tvb, new_offset, 4, rnum);
new_offset += 4;
proto_tree_add_item(tree, hf_kt_name, tvb, new_offset, nsiz, ENC_ASCII|ENC_NA);
new_offset += nsiz;
while (rnum > 0) {
/* Create a sub-tree for each record */
ti = proto_tree_add_item(tree, hf_kt_rec, tvb, new_offset, -1, ENC_NA);
rec_tree = proto_item_add_subtree(ti, ett_kt_rec);
rec_start_offset = new_offset;
ksiz = tvb_get_ntohl(tvb, new_offset);
proto_tree_add_uint(rec_tree, hf_kt_ksiz, tvb, new_offset, 4, ksiz);
new_offset += 4;
vsiz = tvb_get_ntohl(tvb, new_offset);
proto_tree_add_uint(rec_tree, hf_kt_vsiz, tvb, new_offset, 4, vsiz);
new_offset += 4;
proto_tree_add_item(rec_tree, hf_kt_key, tvb, new_offset, ksiz, ENC_NA);
if (kt_present_key_val_as_ascii) {
pi = proto_tree_add_item(rec_tree, hf_kt_key_str, tvb, new_offset, ksiz, ENC_ASCII|ENC_NA);
proto_item_set_generated(pi);
}
new_offset += ksiz;
proto_tree_add_item(rec_tree, hf_kt_val, tvb, new_offset, vsiz, ENC_NA);
if (kt_present_key_val_as_ascii) {
pi = proto_tree_add_item(rec_tree, hf_kt_val_str, tvb, new_offset, vsiz, ENC_ASCII|ENC_NA);
proto_item_set_generated(pi);
}
new_offset += vsiz;
proto_item_set_len(ti, new_offset - rec_start_offset);
rnum--;
}
} else {
/* Nothing remaining after the 32 bits. This is a response with no records. */
pi = proto_tree_add_uint(tree, hf_kt_type, tvb, offset, 1, KT_OPER_RESPONSE);
proto_item_set_generated(pi);
col_append_sep_str(pinfo->cinfo, COL_INFO, " ", "[response]");
proto_tree_add_uint(tree, hf_kt_rnum, tvb, new_offset, 4, next32);
new_offset += 4;
}
} else { /* response - one or more records */
pi = proto_tree_add_uint(tree, hf_kt_type, tvb, offset, 1, KT_OPER_RESPONSE);
proto_item_set_generated(pi);
col_append_sep_str(pinfo->cinfo, COL_INFO, " ", "[response]");
rnum = tvb_get_ntohl(tvb, new_offset);
proto_tree_add_uint(tree, hf_kt_hits, tvb, new_offset, 4, rnum);
new_offset += 4;
while (rnum > 0) {
/* Create a sub-tree for each record */
ti = proto_tree_add_item(tree, hf_kt_rec, tvb, new_offset, -1, ENC_NA);
rec_tree = proto_item_add_subtree(ti, ett_kt_rec);
rec_start_offset = new_offset;
ksiz = tvb_get_ntohl(tvb, new_offset);
proto_tree_add_uint(rec_tree, hf_kt_ksiz, tvb, new_offset, 4, ksiz);
new_offset += 4;
vsiz = tvb_get_ntohl(tvb, new_offset);
proto_tree_add_uint(rec_tree, hf_kt_vsiz, tvb, new_offset, 4, vsiz);
new_offset += 4;
proto_tree_add_item(rec_tree, hf_kt_key, tvb, new_offset, ksiz, ENC_NA);
//.........这里部分代码省略.........
示例13: dissect_mip
/* Code to actually dissect the packets */
static void
dissect_mip( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
/* Set up structures we will need to add the protocol subtree and manage it */
proto_item *ti;
proto_tree *mip_tree=NULL;
proto_item *tf;
proto_tree *flags_tree;
guint8 type;
guint16 flags;
gint offset=0;
tvbuff_t *next_tvb;
/* Make entries in Protocol column and Info column on summary display */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "MobileIP");
col_clear(pinfo->cinfo, COL_INFO);
type = tvb_get_guint8(tvb, offset);
switch (type) {
case MIP_REGISTRATION_REQUEST:
col_add_fstr(pinfo->cinfo, COL_INFO,
"Reg Request: HoA=%s HA=%s CoA=%s",
tvb_ip_to_str(tvb, 4),
tvb_ip_to_str(tvb, 8),
tvb_ip_to_str(tvb, 12));
if (tree) {
ti = proto_tree_add_item(tree, proto_mip, tvb, offset, -1, ENC_NA);
mip_tree = proto_item_add_subtree(ti, ett_mip);
/* type */
proto_tree_add_uint(mip_tree, hf_mip_type, tvb, offset, 1, type);
offset++;
/* flags */
flags = tvb_get_guint8(tvb, offset);
tf = proto_tree_add_uint(mip_tree, hf_mip_flags, tvb, offset, 1, flags);
flags_tree = proto_item_add_subtree(tf, ett_mip_flags);
proto_tree_add_boolean(flags_tree, hf_mip_s, tvb, offset, 1, flags);
proto_tree_add_boolean(flags_tree, hf_mip_b, tvb, offset, 1, flags);
proto_tree_add_boolean(flags_tree, hf_mip_d, tvb, offset, 1, flags);
proto_tree_add_boolean(flags_tree, hf_mip_m, tvb, offset, 1, flags);
proto_tree_add_boolean(flags_tree, hf_mip_g, tvb, offset, 1, flags);
proto_tree_add_boolean(flags_tree, hf_mip_v, tvb, offset, 1, flags);
proto_tree_add_boolean(flags_tree, hf_mip_t, tvb, offset, 1, flags);
proto_tree_add_boolean(flags_tree, hf_mip_x, tvb, offset, 1, flags);
offset++;
/* lifetime */
proto_tree_add_item(mip_tree, hf_mip_life, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* home address */
proto_tree_add_item(mip_tree, hf_mip_homeaddr, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
/* home agent address */
proto_tree_add_item(mip_tree, hf_mip_haaddr, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
/* Care of Address */
proto_tree_add_item(mip_tree, hf_mip_coa, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
/* Identifier - assumed to be an NTP time here */
proto_tree_add_item(mip_tree, hf_mip_ident, tvb, offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
offset += 8;
} /* if tree */
break;
case MIP_REGISTRATION_REPLY:
col_add_fstr(pinfo->cinfo, COL_INFO,
"Reg Reply: HoA=%s HA=%s, Code=%u",
tvb_ip_to_str(tvb, 4),
tvb_ip_to_str(tvb, 8),
tvb_get_guint8(tvb,1));
if (tree) {
/* Add Subtree */
ti = proto_tree_add_item(tree, proto_mip, tvb, offset, -1, ENC_NA);
mip_tree = proto_item_add_subtree(ti, ett_mip);
/* Type */
proto_tree_add_uint(mip_tree, hf_mip_type, tvb, offset, 1, type);
offset++;
/* Reply Code */
proto_tree_add_item(mip_tree, hf_mip_code, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
/* Registration Lifetime */
proto_tree_add_item(mip_tree, hf_mip_life, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* Home address */
proto_tree_add_item(mip_tree, hf_mip_homeaddr, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
//.........这里部分代码省略.........
示例14: mate_gog_tree
static void
mate_gog_tree(proto_tree* tree, packet_info *pinfo, tvbuff_t *tvb, mate_gog* gog, mate_gop* gop)
{
proto_item *gog_item;
proto_tree *gog_tree;
proto_tree *gog_time_tree;
proto_item *gog_gops_item;
proto_tree *gog_gops_tree;
mate_gop* gog_gops;
proto_item *gog_gop_item;
proto_tree *gog_gop_tree;
mate_pdu* pdu;
gog_item = proto_tree_add_uint(tree,gog->cfg->hfid,tvb,0,0,gog->id);
gog_tree = proto_item_add_subtree(gog_item,gog->cfg->ett);
gog_attrs_tree(gog_tree,pinfo,tvb,gog);
if (gog->cfg->show_times) {
gog_time_tree = proto_tree_add_subtree_format(gog_tree,tvb,0,0,gog->cfg->ett_times,NULL,"%s Times",gog->cfg->name);
proto_tree_add_float(gog_time_tree, gog->cfg->hfid_start_time, tvb, 0, 0, gog->start_time);
proto_tree_add_float(gog_time_tree, gog->cfg->hfid_last_time, tvb, 0, 0, gog->last_time - gog->start_time);
}
gog_gops_item = proto_tree_add_uint(gog_tree, gog->cfg->hfid_gog_num_of_gops, tvb, 0, 0, gog->num_of_gops);
gog_gops_tree = proto_item_add_subtree(gog_gops_item, gog->cfg->ett_children);
for (gog_gops = gog->gops; gog_gops; gog_gops = gog_gops->next) {
if (gop != gog_gops) {
if (gog->cfg->gop_tree_mode == GOP_FULL_TREE) {
mate_gop_tree(gog_gops_tree, pinfo, tvb, gog_gops);
} else {
gog_gop_item = proto_tree_add_uint(gog_gops_tree,gog_gops->cfg->hfid,tvb,0,0,gog_gops->id);
if (gog->cfg->gop_tree_mode == GOP_BASIC_TREE) {
gog_gop_tree = proto_item_add_subtree(gog_gop_item, gog->cfg->ett_gog_gop);
proto_tree_add_float(gog_gop_tree, hf_mate_started_at, tvb,0,0,gog_gops->start_time);
proto_tree_add_float_format(gog_gop_tree, hf_mate_duration, tvb,0,0, gog_gops->last_time - gog_gops->start_time,
"%s Duration: %f", gog_gops->cfg->name, gog_gops->last_time - gog_gops->start_time);
if (gog_gops->released)
proto_tree_add_float_format(gog_gop_tree, hf_mate_released_time, tvb,0,0, gog_gops->release_time - gog_gops->start_time,
"%s has been released, Time: %f", gog_gops->cfg->name, gog_gops->release_time - gog_gops->start_time);
proto_tree_add_uint(gog_gop_tree, hf_mate_number_of_pdus, tvb,0,0, gog_gops->num_of_pdus);
if (gop->pdus && gop->cfg->pdu_tree_mode != GOP_NO_TREE) {
proto_tree_add_uint(gog_gop_tree,gog->cfg->hfid_gog_gopstart,tvb,0,0,gog_gops->pdus->frame);
for (pdu = gog_gops->pdus->next ; pdu; pdu = pdu->next) {
if (pdu->is_stop) {
proto_tree_add_uint(gog_gop_tree,gog->cfg->hfid_gog_gopstop,tvb,0,0,pdu->frame);
break;
}
}
}
}
}
} else {
proto_tree_add_uint_format(gog_gops_tree,gop->cfg->hfid,tvb,0,0,gop->id,"current %s Gop: %d",gop->cfg->name,gop->id);
}
}
}
示例15: ras_call_matching
static void ras_call_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, h225_packet_info *pi)
{
proto_item *hidden_item;
conversation_t* conversation = NULL;
h225ras_call_info_key h225ras_call_key;
h225ras_call_t *h225ras_call = NULL;
nstime_t delta;
guint msg_category;
if(pi->msg_type == H225_RAS && pi->msg_tag < 21) {
/* make RAS request/response matching only for tags from 0 to 20 for now */
msg_category = pi->msg_tag / 3;
if(pi->msg_tag % 3 == 0) { /* Request Message */
conversation = find_or_create_conversation(pinfo);
/* prepare the key data */
h225ras_call_key.reqSeqNum = pi->requestSeqNum;
h225ras_call_key.conversation = conversation;
/* look up the request */
h225ras_call = find_h225ras_call(&h225ras_call_key ,msg_category);
if (h225ras_call != NULL) {
/* We've seen requests with this reqSeqNum, with the same
source and destination, before - do we have
*this* request already? */
/* Walk through list of ras requests with identical keys */
do {
if (pinfo->fd->num == h225ras_call->req_num) {
/* We have seen this request before -> do nothing */
break;
}
/* if end of list is reached, exit loop and decide if request is duplicate or not. */
if (h225ras_call->next_call == NULL) {
if ( (pinfo->fd->num > h225ras_call->rsp_num && h225ras_call->rsp_num != 0
&& pinfo->fd->abs_ts.secs > (h225ras_call->req_time.secs + THRESHOLD_REPEATED_RESPONDED_CALL) )
||(pinfo->fd->num > h225ras_call->req_num && h225ras_call->rsp_num == 0
&& pinfo->fd->abs_ts.secs > (h225ras_call->req_time.secs + THRESHOLD_REPEATED_NOT_RESPONDED_CALL) ) )
{
/* if last request has been responded
and this request appears after last response (has bigger frame number)
and last request occured more than 300 seconds ago,
or if last request hasn't been responded
and this request appears after last request (has bigger frame number)
and last request occured more than 1800 seconds ago,
we decide that we have a new request */
/* Append new ras call to list */
h225ras_call = append_h225ras_call(h225ras_call, pinfo, &pi->guid, msg_category);
} else {
/* No, so it's a duplicate request.
Mark it as such. */
pi->is_duplicate = TRUE;
hidden_item = proto_tree_add_uint(tree, hf_h225_ras_dup, tvb, 0,0, pi->requestSeqNum);
PROTO_ITEM_SET_HIDDEN(hidden_item);
}
break;
}
h225ras_call = h225ras_call->next_call;
} while (h225ras_call != NULL );
}
else {
h225ras_call = new_h225ras_call(&h225ras_call_key, pinfo, &pi->guid, msg_category);
}
/* add link to response frame, if available */
if(h225ras_call && h225ras_call->rsp_num != 0){
proto_item *ti =
proto_tree_add_uint_format(tree, hf_h225_ras_rsp_frame, tvb, 0, 0, h225ras_call->rsp_num,
"The response to this request is in frame %u",
h225ras_call->rsp_num);
PROTO_ITEM_SET_GENERATED(ti);
}
/* end of request message handling*/
}
else { /* Confirm or Reject Message */
conversation = find_conversation(pinfo->fd->num, &pinfo->src,
&pinfo->dst, pinfo->ptype, pinfo->srcport,
pinfo->destport, 0);
if (conversation != NULL) {
/* look only for matching request, if
matching conversation is available. */
h225ras_call_key.reqSeqNum = pi->requestSeqNum;
h225ras_call_key.conversation = conversation;
h225ras_call = find_h225ras_call(&h225ras_call_key ,msg_category);
if(h225ras_call) {
/* find matching ras_call in list of ras calls with identical keys */
do {
if (pinfo->fd->num == h225ras_call->rsp_num) {
/* We have seen this response before -> stop now with matching ras call */
break;
}
/* Break when list end is reached */
if(h225ras_call->next_call == NULL) {
break;
}
h225ras_call = h225ras_call->next_call;
//.........这里部分代码省略.........