您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ tvb_reported_length_remaining函数代码示例

51自学网 2021-06-03 09:01:25
  C++
这篇教程C++ tvb_reported_length_remaining函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中tvb_reported_length_remaining函数的典型用法代码示例。如果您正苦于以下问题:C++ tvb_reported_length_remaining函数的具体用法?C++ tvb_reported_length_remaining怎么用?C++ tvb_reported_length_remaining使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了tvb_reported_length_remaining函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: dissect_kt_remove_bulk

static intdissect_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;}
开发者ID:ssyram,项目名称:wireshark,代码行数:61,


示例2: dissect_bacnet

//.........这里部分代码省略.........        * We should not go any further in dissecting the packet if it's        * not present, but we don't know about that: No length field...        */        if (bacnet_mesgtyp > 0x7f) {            proto_tree_add_item(bacnet_tree, hf_bacnet_vendor,                                tvb, offset, 2, FALSE);            offset += 2;            /* attention: doesnt work here because of if(tree) */            call_dissector(data_handle,                           tvb_new_subset_remaining(tvb, offset), pinfo, tree);        }        /* Performance Index (in I-Could-Be-Router-To-Network) */        if (bacnet_mesgtyp == BAC_NET_ICB_R) {            proto_tree_add_item(bacnet_tree, hf_bacnet_dnet,                                tvb, offset, 2, FALSE);            offset += 2;            proto_tree_add_item(bacnet_tree, hf_bacnet_perf,                                tvb, offset, 1, FALSE);            offset ++;        }        /* Reason, DNET (in Reject-Message-To-Network) */        if (bacnet_mesgtyp == BAC_NET_REJ) {            bacnet_rejectreason = tvb_get_guint8(tvb, offset);            proto_tree_add_uint_format_value(bacnet_tree,                                             hf_bacnet_rejectreason,                                             tvb, offset, 1,                                             bacnet_rejectreason, "%d (%s)",                                             bacnet_rejectreason,                                             bacnet_rejectreason_name(bacnet_rejectreason));            offset ++;            proto_tree_add_item(bacnet_tree, hf_bacnet_dnet,                                tvb, offset, 2, FALSE);            offset += 2;        }        /* N*DNET (in Router-Busy-To-Network,Router-Available-To-Network) */        if ((bacnet_mesgtyp == BAC_NET_R_BUSY) ||                (bacnet_mesgtyp == BAC_NET_WHO_R) ||                (bacnet_mesgtyp == BAC_NET_R_AVA) ||                (bacnet_mesgtyp == BAC_NET_IAM_R) ) {            while(tvb_reported_length_remaining(tvb, offset) > 1 ) {                proto_tree_add_item(bacnet_tree, hf_bacnet_dnet,                                    tvb, offset, 2, FALSE);                offset += 2;            }        }        /* Initialize-Routing-Table */        if ( (bacnet_mesgtyp == BAC_NET_INIT_RTAB) ||                (bacnet_mesgtyp == BAC_NET_INIT_RTAB_ACK) ) {            bacnet_rportnum = tvb_get_guint8(tvb, offset);            /* number of ports */            proto_tree_add_uint(bacnet_tree, hf_bacnet_rportnum,                                tvb, offset, 1, bacnet_rportnum);            offset ++;            for(i=0; i<bacnet_rportnum; i++) {                /* Connected DNET */                proto_tree_add_item(bacnet_tree, hf_bacnet_dnet,                                    tvb, offset, 2, FALSE);                offset += 2;                /* Port ID */                proto_tree_add_item(bacnet_tree, hf_bacnet_portid,                                    tvb, offset, 1, FALSE);                offset ++;                /* Port Info Length */                bacnet_pinfolen = tvb_get_guint8(tvb, offset);                proto_tree_add_uint(bacnet_tree, hf_bacnet_pinfolen,                                    tvb, offset, 1, bacnet_pinfolen);                offset ++;                proto_tree_add_text(bacnet_tree, tvb, offset,                                    bacnet_pinfolen, "Port Info: %s",                                    tvb_bytes_to_str(tvb, offset, bacnet_pinfolen));                offset += bacnet_pinfolen;            }        }        /* Establish-Connection-To-Network */        if (bacnet_mesgtyp == BAC_NET_EST_CON) {            proto_tree_add_item(bacnet_tree, hf_bacnet_dnet,                                tvb, offset, 2, FALSE);            offset += 2;            proto_tree_add_item(bacnet_tree, hf_bacnet_term_time_value,                                tvb, offset, 1, FALSE);            offset ++;        }        /* Disconnect-Connection-To-Network */        if (bacnet_mesgtyp == BAC_NET_DISC_CON) {            proto_tree_add_item(bacnet_tree, hf_bacnet_dnet,                                tvb, offset, 2, FALSE);            offset += 2;        }        proto_item_set_len(ti, offset);    }    /* dissect BACnet APDU */    next_tvb = tvb_new_subset_remaining(tvb,offset);    if (bacnet_control & BAC_CONTROL_NET) {        /* Unknown function - dissect the payload as data */        call_dissector(data_handle, next_tvb, pinfo, tree);    } else {        /* APDU - call the APDU dissector */        call_dissector(bacapp_handle, next_tvb, pinfo, tree);    }}
开发者ID:RazZziel,项目名称:wireshark-dplay,代码行数:101,


示例3: req_resp_hdrs_do_reassembly

/* * Optionally do reassembly of the request/response line, headers, and body. */gbooleanreq_resp_hdrs_do_reassembly(tvbuff_t *tvb, const int offset, packet_info *pinfo,    const gboolean desegment_headers, const gboolean desegment_body){	gint		next_offset;	gint		next_offset_sav;	gint		length_remaining, reported_length_remaining;	int		linelen;	gchar		*header_val;	int		content_length;	gboolean	content_length_found = FALSE;	gboolean	content_type_found = FALSE;	gboolean	chunked_encoding = FALSE;	gboolean	keepalive_found = FALSE;	gchar		*line;	gchar		*content_type = NULL;	/*	 * Do header desegmentation if we've been told to.	 *	 * RFC 2616 defines HTTP messages as being either of the	 * Request or the Response type	 * (HTTP-message = Request | Response).	 * Request and Response are defined as:	 *     Request = Request-Line	 *         *(( general-header	 *         | request-header	 *         | entity-header ) CRLF)	 *         CRLF	 *         [ message-body ]	 *     Response = Status-Line	 *         *(( general-header	 *         | response-header	 *         | entity-header ) CRLF)	 *         CRLF	 *         [ message-body ]	 * that's why we can always assume two consecutive line	 * endings (we allow CR, LF, or CRLF, as some clients	 * or servers might not use a full CRLF) to mark the end	 * of the headers.  The worst thing that would happen	 * otherwise would be the packet not being desegmented	 * or being interpreted as only headers.	 *	 * RFC 2326 says RTSP works the same way; RFC 3261 says SIP	 * works the same way.	 */	/*	 * If header desegmentation is activated, check that all	 * headers are in this tvbuff (search for an empty line	 * marking end of headers) or request one more byte (we	 * don't know how many bytes we'll need, so we just ask	 * for one).	 */	if (desegment_headers && pinfo->can_desegment) {		next_offset = offset;		for (;;) {			next_offset_sav = next_offset;			reported_length_remaining =			    tvb_reported_length_remaining(tvb, next_offset);			/*			 * Request one more byte if there're no			 * bytes left in the reported data (if there're			 * bytes left in the reported data, but not in			 * the available data, requesting more bytes			 * won't help, as those bytes weren't captured).			 */			if (reported_length_remaining < 1) {				pinfo->desegment_offset = offset;				pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;				return FALSE;			}			length_remaining = tvb_captured_length_remaining(tvb,			    next_offset);			/*			 * Request one more byte if we cannot find a			 * header (i.e. a line end).			 */			linelen = tvb_find_line_end(tvb, next_offset,			    length_remaining, &next_offset, TRUE);			if (linelen == -1 &&			    length_remaining >= reported_length_remaining) {				/*				 * Not enough data; ask for one more				 * byte.				 */				pinfo->desegment_offset = offset;				pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;				return FALSE;			}                        if (linelen == 0) {				/*//.........这里部分代码省略.........
开发者ID:MultipathDTLS,项目名称:wireshark,代码行数:101,


示例4: dissect_tftp_message

//.........这里部分代码省略.........        offset += i1;        tftp_dissect_options(tvb, pinfo, offset, tftp_tree,                             opcode,  tftp_info);        break;    case TFTP_INFO:        tftp_dissect_options(tvb, pinfo, offset, tftp_tree,                             opcode,  tftp_info);        break;    case TFTP_DATA:        blocknum = tvb_get_ntohs(tvb, offset);        proto_tree_add_uint(tftp_tree, hf_tftp_blocknum, tvb, offset, 2,                            blocknum);        /* Sequence analysis on blocknums (first pass only) */        if (!pinfo->fd->flags.visited) {            if (blocknum > tftp_info->next_block_num) {                /* There is a gap.  Don't try to recover from this. */                tftp_info->next_block_num = blocknum + 1;                tftp_info->blocks_missing = TRUE;                /* TODO: add info to a result table for showing expert info in later passes */            }            else if (blocknum == tftp_info->next_block_num) {                /* OK, inc what we expect next */                tftp_info->next_block_num++;            }        }        offset += 2;        /* Show number of bytes in this block, and whether it is the end of the file */        bytes = tvb_reported_length_remaining(tvb, offset);        col_append_fstr(pinfo->cinfo, COL_INFO, ", Block: %i%s",                        blocknum,                        (bytes < tftp_info->blocksize)?" (last)":"" );        /* Show data in tree */        if (bytes > 0) {            data_tvb = tvb_new_subset(tvb, offset, -1, bytes);            call_dissector(data_handle, data_tvb, pinfo, tree);        }        /* If Export Object tap is listening, need to accumulate blocks info list           to send to tap. But if already know there are blocks missing, there is no           point in trying. */        if (have_tap_listener(tftp_eo_tap) && !tftp_info->blocks_missing) {            file_block_t *block;            if (blocknum == 1) {                /* Reset data for this conversation, freeing any accumulated blocks! */                cleanup_tftp_blocks(tftp_info);                tftp_info->next_tap_block_num = 1;            }            if (blocknum != tftp_info->next_tap_block_num) {                /* Ignore.  Could be missing frames, or just clicking previous frame */                return;            }            if (bytes > 0) {                /* Create a block for this block */                block = (file_block_t*)g_malloc(sizeof(file_block_t));                block->length = bytes;                block->data = tvb_memdup(NULL, data_tvb, 0, bytes);
开发者ID:hauke,项目名称:wireshark,代码行数:67,


示例5: dissect_bfcp_attributes

static intdissect_bfcp_attributes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int bfcp_payload_length){	proto_item *ti, *item;	proto_tree  *bfcp_attr_tree = NULL;	gint        attr_start_offset;	gint        length;	guint8      attribute_type;	gint        read_attr = 0;	guint8      first_byte, pad_len;	while ((tvb_reported_length_remaining(tvb, offset) >= 2) &&			((bfcp_payload_length - read_attr) >= 2))	{		attr_start_offset = offset;		first_byte = tvb_get_guint8(tvb, offset);		/* Padding so continue to next attribute */		if (first_byte == 0){			read_attr++;			continue;		}		ti = proto_tree_add_item(tree, hf_bfcp_attribute_types, tvb, offset, 1, ENC_BIG_ENDIAN);		bfcp_attr_tree = proto_item_add_subtree(ti, ett_bfcp_attr);		proto_tree_add_item(bfcp_attr_tree, hf_bfcp_attribute_types_m_bit, tvb, offset, 1, ENC_BIG_ENDIAN);		attribute_type = (first_byte & 0xFE) >> 1;		offset++;	/*   Length: This 8-bit field contains the length of the attribute in	 *   octets, excluding any padding defined for specific attributes.  The	 *   length of attributes that are not grouped includes the Type, 'M' bit,	 *   and Length fields.  The Length in grouped attributes is the length of	 *   the grouped attribute itself (including Type, 'M' bit, and Length	 *   fields) plus the total length (including padding) of all the included	 *   attributes.	 */		item = proto_tree_add_item(bfcp_attr_tree, hf_bfcp_attribute_length, tvb, offset, 1, ENC_BIG_ENDIAN);		length = tvb_get_guint8(tvb, offset);		offset++;		switch(attribute_type){		case 1: /* Beneficiary ID */			proto_tree_add_item(bfcp_attr_tree, hf_bfcp_beneficiary_id, tvb, offset, 2, ENC_BIG_ENDIAN);			offset+=2;			break;		case 2: /* FLOOR-ID */			proto_tree_add_item(bfcp_attr_tree, hf_bfcp_floor_id, tvb, offset, 2, ENC_BIG_ENDIAN);			offset+=2;			break;		case 3: /* FLOOR-REQUEST-ID */			proto_tree_add_item(bfcp_attr_tree, hf_bfcp_floor_request_id, tvb, offset, 2, ENC_BIG_ENDIAN);			offset+=2;			break;		case 4: /* PRIORITY */			proto_tree_add_item(bfcp_attr_tree, hf_bfcp_priority, tvb, offset, 2, ENC_BIG_ENDIAN);			offset+=2;			break;		case 5: /* REQUEST-STATUS */			proto_tree_add_item(bfcp_attr_tree, hf_bfcp_request_status, tvb, offset,1, ENC_BIG_ENDIAN);			offset++;			/* Queue Position */			proto_tree_add_item(bfcp_attr_tree, hf_bfcp_queue_pos, tvb, offset,1, ENC_BIG_ENDIAN);			offset++;			break;		case 6: /* ERROR-CODE */			proto_tree_add_item(bfcp_attr_tree, hf_bfcp_error_code, tvb, offset, 1, ENC_BIG_ENDIAN);			offset++;			if(length>3){				/* We have Error Specific Details */				proto_tree_add_text(bfcp_attr_tree, tvb, offset, length-3, "Error Specific Details");			}			offset = offset + length-3;			pad_len = length & 0x03;			if(pad_len != 0){				pad_len = 4 - pad_len;				proto_tree_add_text(bfcp_attr_tree, tvb, offset, pad_len, "Padding");			}			offset = offset + pad_len;			break;		case 7: /* ERROR-INFO */			proto_tree_add_item(bfcp_attr_tree, hf_bfcp_error_info_text, tvb, offset, length-3, ENC_ASCII|ENC_NA);			offset = offset + length-3;			pad_len = length & 0x03;			if(pad_len != 0){				pad_len = 4 - pad_len;				proto_tree_add_text(bfcp_attr_tree, tvb, offset, pad_len, "Padding");			}			offset = offset + pad_len;			break;		case 8: /* PARTICIPANT-PROVIDED-INFO */			proto_tree_add_item(bfcp_attr_tree, hf_bfcp_part_prov_info_text, tvb, offset, length-3, ENC_ASCII|ENC_NA);			offset = offset + length-3;			pad_len = length & 0x03;			if(pad_len != 0){				pad_len = 4 - pad_len;				proto_tree_add_text(bfcp_attr_tree, tvb, offset, pad_len, "Padding");//.........这里部分代码省略.........
开发者ID:hauke,项目名称:wireshark,代码行数:101,


示例6: dissect_dvmrp_v3

static intdissect_dvmrp_v3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset){	guint8 code,count;	/* version */	proto_tree_add_uint(parent_tree, hf_version, tvb, 0, 0, 3);	/* type of command */	proto_tree_add_uint(parent_tree, hf_type, tvb, offset, 1, 0x13);	offset += 1;	/* code */	code = tvb_get_guint8(tvb, offset);	proto_tree_add_uint(parent_tree, hf_code_v3, tvb, offset, 1, code);	offset += 1;	col_add_fstr(pinfo->cinfo, COL_INFO,			"V%d %s",3 ,val_to_str(code, code_v3,				"Unknown Type:0x%02x"));	/* checksum */	igmp_checksum(parent_tree, tvb, hf_checksum, hf_checksum_bad, pinfo, 0);	offset += 2;	/* skip unused byte */	offset += 1;	/* PROBE and NEIGHBORS 2 packets have capabilities flags, unused	   for other packets */	if (code==DVMRP_V3_PROBE || code==DVMRP_V3_NEIGHBORS_2) {		proto_tree *tree;		proto_item *item;		item = proto_tree_add_item(parent_tree, hf_capabilities,				tvb, offset, 1, ENC_NA);		tree = proto_item_add_subtree(item, ett_capabilities);		count = tvb_get_guint8(tvb, offset);		proto_tree_add_boolean(tree, hf_cap_netmask, tvb, offset, 1, count);		proto_tree_add_boolean(tree, hf_cap_snmp, tvb, offset, 1, count);		proto_tree_add_boolean(tree, hf_cap_mtrace, tvb, offset, 1, count);		proto_tree_add_boolean(tree, hf_cap_genid, tvb, offset, 1, count);		proto_tree_add_boolean(tree, hf_cap_prune, tvb, offset, 1, count);		proto_tree_add_boolean(tree, hf_cap_leaf, tvb, offset, 1, count);	}	offset += 1;	/* minor version */	proto_tree_add_item(parent_tree, hf_min_ver, tvb, offset, 1, ENC_BIG_ENDIAN);	offset += 1;	/* major version */	proto_tree_add_item(parent_tree, hf_maj_ver, tvb, offset, 1, ENC_BIG_ENDIAN);	offset += 1;	switch (code) {	case DVMRP_V3_PROBE:		/* generation id */		proto_tree_add_item(parent_tree, hf_genid, tvb,			offset, 4, ENC_BIG_ENDIAN);		offset += 4;		while (tvb_reported_length_remaining(tvb, offset)>=4) {			proto_tree_add_item(parent_tree, hf_neighbor,				tvb, offset, 4, ENC_BIG_ENDIAN);			offset += 4;		}		break;	case DVMRP_V3_REPORT:		offset = dissect_v3_report(tvb, parent_tree, offset);		break;	case DVMRP_V3_PRUNE:		/* source address */		proto_tree_add_item(parent_tree, hf_saddr,			tvb, offset, 4, ENC_BIG_ENDIAN);		offset += 4;		/* group address */		proto_tree_add_item(parent_tree, hf_maddr,			tvb, offset, 4, ENC_BIG_ENDIAN);		offset += 4;		/* prune lifetime */		proto_tree_add_item(parent_tree, hf_life,			tvb, offset, 4, ENC_BIG_ENDIAN);		offset += 4;		/* source netmask */		if (tvb_reported_length_remaining(tvb, offset)>=4) {			proto_tree_add_item(parent_tree, hf_netmask,				tvb, offset, 4, ENC_BIG_ENDIAN);			offset += 4;		}		break;	case DVMRP_V3_GRAFT:		/* source address */		proto_tree_add_item(parent_tree, hf_saddr,			tvb, offset, 4, ENC_BIG_ENDIAN);		offset += 4;		/* group address */		proto_tree_add_item(parent_tree, hf_maddr,			tvb, offset, 4, ENC_BIG_ENDIAN);		offset += 4;		/* source netmask *///.........这里部分代码省略.........
开发者ID:AndresVelasco,项目名称:wireshark,代码行数:101,


示例7: dissect_disp

//.........这里部分代码省略.........	if( !pinfo->private_data ){		if(parent_tree){			proto_tree_add_text(parent_tree, tvb, offset, -1,				"Internal error: can't get operation information from ROS dissector.");		}		return  ;	} else {		session  = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) );	}	if(parent_tree){		item = proto_tree_add_item(parent_tree, proto_disp, tvb, 0, -1, ENC_NA);		tree = proto_item_add_subtree(item, ett_disp);	}	col_set_str(pinfo->cinfo, COL_PROTOCOL, "DISP");  	col_clear(pinfo->cinfo, COL_INFO);	switch(session->ros_op & ROS_OP_MASK) {	case (ROS_OP_BIND | ROS_OP_ARGUMENT):	/*  BindInvoke */	  disp_dissector = dissect_disp_DSAShadowBindArgument;	  disp_op_name = "Shadow-Bind-Argument";	  break;	case (ROS_OP_BIND | ROS_OP_RESULT):	/*  BindResult */	  disp_dissector = dissect_disp_DSAShadowBindResult;	  disp_op_name = "Shadow-Bind-Result";	  break;	case (ROS_OP_BIND | ROS_OP_ERROR):	/*  BindError */	  disp_dissector = dissect_disp_DSAShadowBindError;	  disp_op_name = "Shadow-Bind-Error";	  break;	case (ROS_OP_INVOKE | ROS_OP_ARGUMENT):	/*  Invoke Argument */	  switch(session->ros_op & ROS_OP_OPCODE_MASK) {	  case 1: /* requestShadowUpdate */	    disp_dissector = dissect_disp_RequestShadowUpdateArgument;	    disp_op_name = "Request-Shadow-Update-Argument";	    break;	  case 2: /* updateShadow*/	    disp_dissector = dissect_disp_UpdateShadowArgument;	    disp_op_name = "Update-Shadow-Argument";	    break;	  case 3: /* coordinateShadowUpdate */	    disp_dissector = dissect_disp_CoordinateShadowUpdateArgument;	    disp_op_name = "Coordinate-Shadow-Update-Argument";	    break;	  default:	    proto_tree_add_text(tree, tvb, offset, -1,"Unsupported DISP opcode (%d)",				session->ros_op & ROS_OP_OPCODE_MASK);	    break;	  }	  break;	case (ROS_OP_INVOKE | ROS_OP_RESULT):	/*  Return Result */	  switch(session->ros_op & ROS_OP_OPCODE_MASK) {	  case 1: /* requestShadowUpdate */	    disp_dissector = dissect_disp_RequestShadowUpdateResult;	    disp_op_name = "Request-Shadow-Result";	    break;	  case 2: /* updateShadow */	    disp_dissector = dissect_disp_UpdateShadowResult;	    disp_op_name = "Update-Shadow-Result";	    break;	  case 3: /* coordinateShadowUpdate */	    disp_dissector = dissect_disp_CoordinateShadowUpdateResult;	    disp_op_name = "Coordinate-Shadow-Update-Result";	    break;	  default:	    proto_tree_add_text(tree, tvb, offset, -1,"Unsupported DISP opcode (%d)",				session->ros_op & ROS_OP_OPCODE_MASK);	    break;	  }	  break;	case (ROS_OP_INVOKE | ROS_OP_ERROR):	/*  Return Error */	  switch(session->ros_op & ROS_OP_OPCODE_MASK) {	  case 1: /* shadowError */	    disp_dissector = dissect_disp_ShadowError;	    disp_op_name = "Shadow-Error";	    break;	  default:	    proto_tree_add_text(tree, tvb, offset, -1,"Unsupported DISP errcode (%d)",				session->ros_op & ROS_OP_OPCODE_MASK);	    break;	  }	  break;	default:	  proto_tree_add_text(tree, tvb, offset, -1,"Unsupported DISP PDU");	  return;	}	if(disp_dissector) {	  col_set_str(pinfo->cinfo, COL_INFO, disp_op_name);	  while (tvb_reported_length_remaining(tvb, offset) > 0){	    old_offset=offset;	    offset=(*disp_dissector)(FALSE, tvb, offset, &asn1_ctx, tree, -1);	    if(offset == old_offset){	      proto_tree_add_text(tree, tvb, offset, -1,"Internal error, zero-byte DISP PDU");	      break;	    }	  }	}}
开发者ID:LucaBongiorni,项目名称:LTE_monitor_c2xx,代码行数:101,


示例8: dissect_xcsl_tcp

/* Dissector for xcsl */static void dissect_xcsl_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {    guint        offset = 0;    gint         length_remaining;    guint8       idx;    gboolean     request;    guint8       par;    guint8       str[MAXLEN];    guint8       result;    const gchar *code;    guint        len;    gint         next_offset;    proto_tree  *xcsl_tree = NULL;    /* color support */    col_set_str(pinfo->cinfo, COL_PROTOCOL, "Xcsl");    col_clear(pinfo->cinfo, COL_INFO);    /* Create display tree for the xcsl protocol */    if (tree) {        proto_item  *xcsl_item;        xcsl_item = proto_tree_add_item(tree, hfi_xcsl, tvb, offset, -1, ENC_NA);        xcsl_tree = proto_item_add_subtree(xcsl_item, ett_xcsl);    }    /* reset idx */    idx = 0;    /* reset the parameter count */    par = 0;    /* switch whether it concerns a command or an answer */    request = FALSE;    while (tvb_reported_length_remaining(tvb, offset) != 0) {        length_remaining = tvb_ensure_length_remaining(tvb, offset);        if ( length_remaining == -1 ) {            return;        }        /* get next item */        if (!(get_next_item(tvb, offset, length_remaining, str, &next_offset, &len))) {            /* do not continue when get_next_item returns false */            return;        }        /* do not add to the tree when the string is of zero length */        if ( strlen(str) == 0 ) {            offset = next_offset + 1;            continue;        }        /* Xcsl (Call Specification Language) protocol in brief :         *         * Request :         *         *    <xcsl-version>;<transaction-id>;<command>;[parameter1;parameter2;parameter3;....]         *         * Reply :         *         *    <xcsl-version>;transaction-id;<result>;[answer data;answer data];...         *         * If result is one or more digits, this is determined as a Reply.         *         * Example :         *         * -->      xcsl-1.0;1000;offhook;+31356871234         * <--      xcsl-1.0;1000;0                              <- success         *         * -->      xcsl-1.0;1001;dial;+31356871234;+31356875678         * <--      xcsl-1.0;1001;0                              <- success         *         *         * index :  0        1    2    3            4         *         * Index 2 represents the return code (see the xcsl_action_vals[] definitions)         *         */        /* One by one go through each item ';' separated */        switch (idx) {            /* This is the protocol item */            case 0:                proto_tree_add_item(xcsl_tree, &hfi_xcsl_protocol_version, tvb, offset, len, ENC_ASCII|ENC_NA);                break;                /* This should be the transaction ID, if non-digit, it is treated as info */            case 1:                if ( isdigit(str[0]) ) {                    proto_tree_add_item(xcsl_tree, &hfi_xcsl_transaction_id, tvb, offset, len, ENC_ASCII|ENC_NA);                } else {                    proto_tree_add_item(xcsl_tree, &hfi_xcsl_information, tvb, offset, len, ENC_ASCII|ENC_NA);                }                col_append_fstr(pinfo->cinfo, COL_INFO, "%s ",str);                break;                /* Starting with non-digit -> Command, if it starts with a digit -> reply *///.........这里部分代码省略.........
开发者ID:pvons,项目名称:wireshark,代码行数:101,


示例9: dissect_802_3

voiddissect_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);}
开发者ID:hashbrowncipher,项目名称:wireshark,代码行数:88,


示例10: dissect_banana_element

static intdissect_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;}
开发者ID:acaceres2176,项目名称:wireshark,代码行数:92,


示例11: dissect_cisco

static void dissect_cisco (tvbuff_t * tvb, proto_tree * tree,                           gint vsif_len);/* Dissection */static intdissect_vsif (tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree, void* data _U_){  proto_item *it;  proto_tree *vsif_tree;  guint8 type;  guint8 length;  guint32 value;  gint vsif_len;  /* get the reported length of the VSIF TLV */  vsif_len = tvb_reported_length_remaining (tvb, 0);  /* The first TLV in the VSIF encodings must be type 0x08 (Vendor ID) and   * length 3.   */  type = tvb_get_guint8 (tvb, 0);  if (type != 0x08)    {      THROW (ReportedBoundsError);    }  length = tvb_get_guint8 (tvb, 1);  if (length != 3)    {      THROW (ReportedBoundsError);    }
开发者ID:CharaD7,项目名称:wireshark,代码行数:31,


示例12: 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)//.........这里部分代码省略.........
开发者ID:pvons,项目名称:wireshark,代码行数:101,


示例13: dissect_mip_extensions

/* Code to dissect extensions */static voiddissect_mip_extensions( tvbuff_t *tvb, int offset, proto_tree *tree){  proto_item   *ti;  proto_tree   *exts_tree=NULL;  proto_tree   *ext_tree;  proto_tree   *tf;  proto_tree   *ext_flags_tree;  proto_tree   *tp;  proto_tree   *pmipv4_tree;  gint          ext_len;  guint8        ext_type;  guint8        ext_subtype=0;  guint8        pmipv4skipext_subscriberid_type;  guint16       flags;  gint          hdrLen;  guint32       cvse_vendor_id;  guint16       cvse_vendor_type;  guint16       nvse_vendor_type;  int           cvse_local_offset= 0;  int           nvse_local_offset= 0;  /* None of this really matters if we don't have a tree */  if (!tree) return;  /* Add our tree, if we have extensions */  ti = proto_tree_add_text(tree, tvb, offset, -1, "Extensions");  exts_tree = proto_item_add_subtree(ti, ett_mip_exts);  /* And, handle each extension */  while (tvb_reported_length_remaining(tvb, offset) > 0) {    /* Get our extension info */    ext_type = tvb_get_guint8(tvb, offset);    if (ext_type == GEN_AUTH_EXT || ext_type == PMIPv4_NON_SKIP_EXT) {      /*       * Very nasty . . breaks normal extensions, since the length is       * in the wrong place :(       */      ext_subtype = tvb_get_guint8(tvb, offset + 1);      ext_len = tvb_get_ntohs(tvb, offset + 2);      hdrLen = 4;    }    else if(ext_type==CVSE_EXT){      /*       * CVSE also breaks since it added reserved field before       * the length field      */      ext_len = tvb_get_ntohs(tvb, offset + 2);      hdrLen = 4;    }    else {      ext_len = tvb_get_guint8(tvb, offset + 1);      hdrLen = 2;    }    ti = proto_tree_add_text(exts_tree, tvb, offset, ext_len + hdrLen,                 "Extension: %s",                 val_to_str(ext_type, mip_ext_types,                            "Unknown Extension %u"));    ext_tree = proto_item_add_subtree(ti, ett_mip_ext);    proto_tree_add_uint(ext_tree, hf_mip_ext_type, tvb, offset, 1, ext_type);    offset++;    if (ext_type != GEN_AUTH_EXT &&        ext_type != PMIPv4_NON_SKIP_EXT &&        ext_type != CVSE_EXT) {      /* Another nasty hack since GEN_AUTH_EXT and PMIPv4_NON_SKIP_EXT broke everything */      proto_tree_add_uint(ext_tree, hf_mip_ext_len, tvb, offset, 1, ext_len);      offset++;    }    switch (ext_type) {    case MH_AUTH_EXT:    case MF_AUTH_EXT:    case FH_AUTH_EXT:      /* All these extensions look the same.  4 byte SPI followed by a key */      proto_tree_add_item(ext_tree, hf_mip_aext_spi, tvb, offset, 4, ENC_BIG_ENDIAN);      proto_tree_add_item(ext_tree, hf_mip_aext_auth, tvb, offset+4, ext_len-4, ENC_NA);      break;    case MN_NAI_EXT:      proto_tree_add_item(ext_tree, hf_mip_next_nai, tvb, offset,                          ext_len, ENC_ASCII|ENC_NA);      break;    case GEN_AUTH_EXT:      /* RFC 3012 */      /*       * Very nasty . . breaks normal extensions, since the length is       * in the wrong place :(       */      proto_tree_add_uint(ext_tree, hf_mip_gaext_stype, tvb, offset, 1, ext_subtype);      offset++;      proto_tree_add_uint(ext_tree, hf_mip_ext_len, tvb, offset, 2, ext_len);      offset+=2;      /* SPI */      proto_tree_add_item(ext_tree, hf_mip_aext_spi, tvb, offset, 4, ENC_BIG_ENDIAN);      /* Key */      proto_tree_add_item(ext_tree, hf_mip_aext_auth, tvb, offset + 4,                          ext_len - 4, ENC_NA);//.........这里部分代码省略.........
开发者ID:dogphilly,项目名称:wireshark,代码行数:101,


示例14: dissect_v3_report

static intdissect_v3_report(tvbuff_t *tvb, proto_tree *parent_tree, int offset){	guint8 m0,m1,m2,m3;	guint8 s0,s1,s2,s3;	guint8 metric;	guint32 ip;	while (tvb_reported_length_remaining(tvb, offset) > 0) {		proto_tree *tree;		proto_item *item;		int old_offset_a = offset;		item = proto_tree_add_item(parent_tree, hf_route,				tvb, offset, -1, ENC_NA);		tree = proto_item_add_subtree(item, ett_route);		m0 = 0xff;		/* read the mask */		m1 = tvb_get_guint8(tvb, offset);		m2 = tvb_get_guint8(tvb, offset+1);		m3 = tvb_get_guint8(tvb, offset+2);		ip = m3;		ip = (ip<<8)|m2;		ip = (ip<<8)|m1;		ip = (ip<<8)|m0;		proto_tree_add_ipv4(tree, hf_netmask, tvb, offset, 3, ip);		offset += 3;		/* read every srcnet, metric  pairs */		do {			int old_offset_b = offset;			m0 = 0xff;			s1 = 0;			s2 = 0;			s3 = 0;			s0 = tvb_get_guint8(tvb, offset);			offset += 1;			if (m1) {				s1 = tvb_get_guint8(tvb, offset);				offset += 1;			}			if (m2) {				s2 = tvb_get_guint8(tvb, offset);				offset += 1;			}			if (m3) {				s3 = tvb_get_guint8(tvb, offset);				offset += 1;			}			/* handle special case for default route V3/3.4.3 */			if ((!m1)&&(!m2)&&(!m3)&&(!s0)) {				m0 = 0;			}			ip = s3;			ip = (ip<<8)|s2;			ip = (ip<<8)|s1;			ip = (ip<<8)|s0;			proto_tree_add_ipv4_format(tree, hf_saddr, tvb,				old_offset_b, offset-old_offset_b, ip,				"%s %d.%d.%d.%d (netmask %d.%d.%d.%d)",				m0?"Source Network":"Default Route",				s0,s1,s2,s3,m0,m1,m2,m3);			metric = tvb_get_guint8(tvb, offset);			proto_tree_add_uint(tree, hf_metric, tvb,				offset, 1, metric&0x7f);			offset += 1;		} while (!(metric&0x80));		proto_item_set_len(item, offset-old_offset_a);	}	return offset;}
开发者ID:AndresVelasco,项目名称:wireshark,代码行数:83,


示例15: dissect_mip

//.........这里部分代码省略.........      /* 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_NATT_TUNNEL_DATA:    col_add_fstr(pinfo->cinfo, COL_INFO, "Tunnel Data: Next Header=%u",               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++;      /* Next Header */      proto_tree_add_item(mip_tree, hf_mip_nattt_nexthdr, tvb, offset, 1, ENC_BIG_ENDIAN);      offset++;      /* reserved */      proto_tree_add_item(mip_tree, hf_mip_nattt_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);      offset += 2;    } /* if tree */    else {      offset += 4;    }    /* encapsulated payload */    next_tvb = tvb_new_subset_remaining(tvb, 4);    call_dissector(ip_handle, next_tvb, pinfo, mip_tree);    offset += tvb_reported_length_remaining(tvb, offset);    break;  case MIP_REGISTRATION_REVOCATION:    col_add_fstr(pinfo->cinfo, COL_INFO,               "Reg Revocation: HoA=%s HDA=%s FDA=%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++;      /* reserved */      proto_tree_add_item(mip_tree, hf_mip_rev_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);      offset++;      /* flags */      flags = tvb_get_ntohs(tvb, offset);      tf = proto_tree_add_uint(mip_tree, hf_mip_flags, tvb, offset, 2, flags);      flags_tree = proto_item_add_subtree(tf, ett_mip_flags);      proto_tree_add_boolean(flags_tree, hf_mip_rev_a, tvb, offset, 2, flags);      proto_tree_add_boolean(flags_tree, hf_mip_rev_i, tvb, offset, 2, flags);      /* reserved */      proto_tree_add_uint(flags_tree, hf_mip_rev_reserved, tvb, offset, 2, flags);      offset += 2;      /* home address */
开发者ID:dogphilly,项目名称:wireshark,代码行数:67,


示例16: dissect_dvmrp_v1

static intdissect_dvmrp_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset){	guint8 code;	guint8 af=2; /* default */	/* version */	proto_tree_add_uint(parent_tree, hf_version, tvb, 0, 0, 1);	/* type of command */	proto_tree_add_uint(parent_tree, hf_type, tvb, offset, 1, 0x13);	offset += 1;	/* code */	code = tvb_get_guint8(tvb, offset);	proto_tree_add_uint(parent_tree, hf_code_v1, tvb, offset, 1, code);	offset += 1;	col_add_fstr(pinfo->cinfo, COL_INFO,			"V%d %s",1 ,val_to_str(code, code_v1,				"Unknown Type:0x%02x"));	/* checksum */	igmp_checksum(parent_tree, tvb, hf_checksum, hf_checksum_bad, pinfo, 0);	offset += 2;	/* decode all the v1 commands */	while (tvb_reported_length_remaining(tvb, offset) > 0) {		proto_tree *tree;		proto_item *item;		guint8 cmd,count;		int old_offset = offset;		item = proto_tree_add_item(parent_tree, hf_commands,				tvb, offset, -1, ENC_NA);		tree = proto_item_add_subtree(item, ett_commands);		cmd = tvb_get_guint8(tvb, offset);		proto_tree_add_uint(tree, hf_command, tvb,			offset, 1, cmd);		offset += 1;		switch (cmd){		case V1_COMMAND_NULL:			offset += 1; /* skip ignored/pad byte*/			if (item) {				proto_item_set_text(item, "Command: NULL");			}			break;		case V1_COMMAND_AFI:			af = tvb_get_guint8(tvb, offset);			proto_tree_add_uint(tree, hf_afi, tvb,				offset, 1, af);			offset += 1;			if (item) {				proto_item_set_text(item, "%s: %s",					val_to_str(cmd, command, "Unknown Command:0x%02x"),					val_to_str(af, afi, "Unknown Family:0x%02x")				);			}			break;		case V1_COMMAND_SUBNETMASK:			count = tvb_get_guint8(tvb, offset);			proto_tree_add_uint(tree, hf_count, tvb,				offset, 1, count);			offset += 1;			if (count) { /* must be 0 or 1 */				proto_tree_add_item(tree, hf_netmask,					tvb, offset, 4, ENC_BIG_ENDIAN);				if (item) {					proto_item_set_text(item, "%s: %d.%d.%d.%d",						val_to_str(cmd, command, "Unknown Command:0x%02x"),						tvb_get_guint8(tvb, offset),						tvb_get_guint8(tvb, offset+1),						tvb_get_guint8(tvb, offset+2),						tvb_get_guint8(tvb, offset+3));				}				offset += 4;			} else {				if (item) {					proto_item_set_text(item, "%s: <no mask supplied>",						val_to_str(cmd, command, "Unknown Command:0x%02x"));				}			}			break;		case V1_COMMAND_METRIC:			proto_tree_add_item(tree, hf_metric, tvb,				offset, 1, ENC_BIG_ENDIAN);			if (item) {				proto_item_set_text(item, "%s: %d",					val_to_str(cmd, command, "Unknown Command:0x%02x"),					tvb_get_guint8(tvb, offset));			}			offset += 1;			break;		case V1_COMMAND_FLAGS0:			count = tvb_get_guint8(tvb, offset);			proto_tree_add_boolean(tree, hf_dest_unr, tvb, offset, 1, count);			proto_tree_add_boolean(tree, hf_split_horiz, tvb, offset, 1, count);			if (item) {				proto_item_set_text(item, "%s: 0x%02x",//.........这里部分代码省略.........
开发者ID:AndresVelasco,项目名称:wireshark,代码行数:101,


示例17: parse_gsm_sms_ud_message

//.........这里部分代码省略.........                ports_available = TRUE;            } else {                proto_item_append_text(subtree, " - Invalid format!");                i += len;            }            break;        case 0x05: /* Port Number UDH - 16-bit address */            if (len == 4) { /* Port fields */                p_dst = tvb_get_ntohs(tvb, i);                i += 2;                p_src = tvb_get_ntohs(tvb, i);                i += 2;                proto_item_append_text(subtree,                                       ": source port %u, destination port %u",                                       p_src, p_dst);                subtree = proto_item_add_subtree(subtree, ett_udh_ie);                proto_tree_add_uint (subtree, hf_gsm_sms_udh_ports_dst,                                     tvb, i-4, 2, p_dst);                proto_tree_add_uint (subtree, hf_gsm_sms_udh_ports_src,                                     tvb, i-2, 2, p_src);                ports_available = TRUE;            } else {                proto_item_append_text(subtree, " - Invalid format!");                i += len;            }            break;        default:            i += len;            break;        }    }    if (tvb_reported_length_remaining(tvb, i) <= 0)        return; /* No more data */    /*     * XXX - where does the "1" come from?  If it weren't there,     * "sm_data_len" would, I think, be the same as     * "tvb_reported_length_remaining(tvb, i)".     *     * I think that the above check ensures that "sm_len" won't     * be less than or equal to "udh_len", so it ensures that     * "sm_len" won't be less than "1 + udh_len", so we don't     * have to worry about "sm_data_len" being negative.     */    sm_data_len = sm_len - (1 + udh_len);    if (sm_data_len == 0)        return;	/* no more data */    /*     * Try reassembling the packets.     * XXX - fragment numbers are 1-origin, but the fragment number     * field could be 0.     * Should we flag a fragmented message with a fragment number field     * of 0?     * What if the fragment count is 0?  Should we flag that as well?     */    if ( is_fragmented && frag != 0 && frags != 0 &&            tvb_bytes_exist (tvb, i, sm_data_len) ) {        try_gsm_sms_ud_reassemble = TRUE;        save_fragmented = pinfo->fragmented;        pinfo->fragmented = TRUE;        fd_sm = fragment_add_seq_check (tvb, i, pinfo,                                        sm_id, /* guint32 ID for fragments belonging together */                                        sm_fragment_table, /* list of message fragments */
开发者ID:giuliano108,项目名称:wireshark-rtpmon,代码行数:67,


示例18: dissect_rtacser_data

static voiddissect_rtacser_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){/* Set up structures needed to add the protocol subtree and manage it */    proto_item    *rtacser_item, *ts_item, *cl_item, *data_payload;    proto_tree    *rtacser_tree, *cl_tree;    int           offset=0, len=0;    guint         event_type;    guint32       timestamp1, timestamp2;    gboolean      cts, dcd, dsr, rts, dtr, ring, mbok;    tvbuff_t      *payload_tvb;    len = RTACSER_HEADER_LEN;    /* Make entries in Protocol column on summary display */    col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTAC Serial");    col_clear(pinfo->cinfo, COL_INFO);    if (tree) {        rtacser_item = proto_tree_add_protocol_format(tree, proto_rtacser, tvb, 0, len, "RTAC Serial Line");        rtacser_tree = proto_item_add_subtree(rtacser_item, ett_rtacser);        /* Time-stamp is stored as 2 x 32-bit unsigned integers, the left and right-hand side of the decimal point respectively */        /* The format mirrors the timeval struct - absolute Epoch time (seconds since 1/1/1970) with an added microsecond component */        timestamp1 = tvb_get_ntohl(tvb, offset);        timestamp2 = tvb_get_ntohl(tvb, offset+4);        ts_item = proto_tree_add_item(rtacser_tree, hf_rtacser_timestamp, tvb, offset, 8, ENC_BIG_ENDIAN);        proto_item_set_text(ts_item, "Arrived At Time: %u.%u" , timestamp1, timestamp2);        offset += 8;        /* Set INFO column with RTAC Serial Event Type */        event_type = tvb_get_guint8(tvb, offset);        col_clear(pinfo->cinfo, COL_INFO); /* clear out stuff in the info column */        col_add_fstr(pinfo->cinfo, COL_INFO, "%-21s", val_to_str_const(event_type, rtacser_eventtype_vals, "Unknown Type"));        /* Add event type to tree */        proto_tree_add_item(rtacser_tree, hf_rtacser_event_type, tvb, offset, 1, ENC_BIG_ENDIAN);        offset += 1;        /* Retrieve EIA-232 serial control line states */        cts = tvb_get_guint8(tvb, offset) & RTACSER_CTRL_CTS;        dcd = tvb_get_guint8(tvb, offset) & RTACSER_CTRL_DCD;        dsr = tvb_get_guint8(tvb, offset) & RTACSER_CTRL_DSR;        rts = tvb_get_guint8(tvb, offset) & RTACSER_CTRL_RTS;        dtr = tvb_get_guint8(tvb, offset) & RTACSER_CTRL_DTR;        ring = tvb_get_guint8(tvb, offset) & RTACSER_CTRL_RING;        mbok = tvb_get_guint8(tvb, offset) & RTACSER_CTRL_MBOK;        cl_item = proto_tree_add_text(rtacser_tree, tvb, offset, 1, "Control Lines");        cl_tree = proto_item_add_subtree(cl_item, ett_rtacser_cl);        /* Add UART Control Line information to INFO column */        col_append_str(pinfo->cinfo, COL_INFO, " ( ");        (cts)  ? col_append_str(pinfo->cinfo, COL_INFO, "CTS") : col_append_str(pinfo->cinfo, COL_INFO, "/CTS");        (dcd)  ? col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "DCD") : col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "/DCD");        (dsr)  ? col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "DSR") : col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "/DSR");        (rts)  ? col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "RTS") : col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "/RTS");        (dtr)  ? col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "DTR") : col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "/DTR");        (ring) ? col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "RING") : col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "/RING");        (mbok) ? col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "MBOK") : col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "/MBOK");        col_append_str(pinfo->cinfo, COL_INFO, " )");        /* Add UART Control Line information to tree */        proto_item_append_text(cl_item, " (");        (cts)  ? proto_item_append_text(cl_item, "CTS, ") : proto_item_append_text(cl_item, "/CTS, ");        (dcd)  ? proto_item_append_text(cl_item, "DCD, ") : proto_item_append_text(cl_item, "/DCD, ");        (dsr)  ? proto_item_append_text(cl_item, "DSR, ") : proto_item_append_text(cl_item, "/DSR, ");        (rts)  ? proto_item_append_text(cl_item, "RTS, ") : proto_item_append_text(cl_item, "/RTS, ");        (dtr)  ? proto_item_append_text(cl_item, "DTR, ") : proto_item_append_text(cl_item, "/DTR, ");        (ring) ? proto_item_append_text(cl_item, "RING, ") : proto_item_append_text(cl_item, "/RING, ");        (mbok) ? proto_item_append_text(cl_item, "MBOK") : proto_item_append_text(cl_item, "/MBOK");        proto_item_append_text(cl_item, ")");        proto_tree_add_item(cl_tree, hf_rtacser_ctrl_cts, tvb, offset, 1, ENC_BIG_ENDIAN);        proto_tree_add_item(cl_tree, hf_rtacser_ctrl_dcd, tvb, offset, 1, ENC_BIG_ENDIAN);        proto_tree_add_item(cl_tree, hf_rtacser_ctrl_dsr, tvb, offset, 1, ENC_BIG_ENDIAN);        proto_tree_add_item(cl_tree, hf_rtacser_ctrl_rts, tvb, offset, 1, ENC_BIG_ENDIAN);        proto_tree_add_item(cl_tree, hf_rtacser_ctrl_dtr, tvb, offset, 1, ENC_BIG_ENDIAN);        proto_tree_add_item(cl_tree, hf_rtacser_ctrl_ring, tvb, offset, 1, ENC_BIG_ENDIAN);        proto_tree_add_item(cl_tree, hf_rtacser_ctrl_mbok, tvb, offset, 1, ENC_BIG_ENDIAN);        offset += 1;        /* 2-byte footer */        proto_tree_add_item(rtacser_tree, hf_rtacser_footer, tvb, offset, 2, ENC_BIG_ENDIAN);        offset += 2;        /* If no payload dissector has been selected, indicate to the user the preferences options */        if ((tvb_reported_length_remaining(tvb, offset) > 0) && (global_rtacser_payload_proto == RTACSER_PAYLOAD_NONE)) {            data_payload = proto_tree_add_item(tree, hf_rtacser_data, tvb, offset, -1, ENC_NA);            proto_item_set_text(data_payload,"Payload Protocol not selected.  Check 'Preferences-> Protocols-> RTAC Serial' for options");            return;        }    } /* tree */    /* Determine correct message type and call appropriate dissector */    if (tvb_reported_length_remaining(tvb, RTACSER_HEADER_LEN) > 0) {        switch (global_rtacser_payload_proto) {//.........这里部分代码省略.........
开发者ID:AndresVelasco,项目名称:wireshark,代码行数:101,


示例19: dissect_report_segment

static intdissect_report_segment(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ltp_tree, int frame_offset) {	guint64 rpt_sno;	guint64 chkp_sno;	guint64 upper_bound;	guint64 lower_bound;	int rcpt_clm_cnt;	guint64 offset;	guint64 length;	int rpt_sno_size;	int chkp_sno_size;	int upper_bound_size;	int lower_bound_size;	int rcpt_clm_cnt_size;	int offset_size;	int length_size;	int segment_offset = 0;	int i;	proto_item *ltp_rpt_item;	proto_item *ltp_rpt_clm_item;	proto_tree *ltp_rpt_tree;	proto_tree *ltp_rpt_clm_tree;	/* Create the subtree for report segment under the main LTP tree and all the report segment fields under it */	ltp_rpt_tree = proto_tree_add_subtree(ltp_tree, tvb, frame_offset, -1, ett_rpt_segm, &ltp_rpt_item, "Report Segment");	/* Extract the report segment info */	rpt_sno = evaluate_sdnv_64(tvb, frame_offset, &rpt_sno_size);	proto_tree_add_uint64(ltp_rpt_tree, hf_ltp_rpt_sno, tvb, frame_offset + segment_offset, rpt_sno_size, rpt_sno);	segment_offset += rpt_sno_size;	chkp_sno = evaluate_sdnv_64(tvb, frame_offset + segment_offset, &chkp_sno_size);	proto_tree_add_uint64(ltp_rpt_tree, hf_ltp_rpt_chkp, tvb, frame_offset + segment_offset, chkp_sno_size, chkp_sno);	segment_offset += chkp_sno_size;	upper_bound = evaluate_sdnv(tvb, frame_offset + segment_offset, &upper_bound_size);	proto_tree_add_uint64(ltp_rpt_tree, hf_ltp_rpt_ub, tvb, frame_offset + segment_offset, upper_bound_size, upper_bound);	segment_offset += upper_bound_size;	lower_bound = evaluate_sdnv(tvb, frame_offset + segment_offset, &lower_bound_size);	proto_tree_add_uint64(ltp_rpt_tree, hf_ltp_rpt_lb, tvb, frame_offset + segment_offset, lower_bound_size, lower_bound);	segment_offset += lower_bound_size;	rcpt_clm_cnt = evaluate_sdnv(tvb, frame_offset + segment_offset, &rcpt_clm_cnt_size);	if (rcpt_clm_cnt < 0){		proto_item_set_end(ltp_rpt_item, tvb, frame_offset + segment_offset);		expert_add_info_format(pinfo, ltp_tree, &ei_ltp_neg_reception_claim_count,				"Negative reception claim count: %d", rcpt_clm_cnt);		return 0;	}	/* Each reception claim is at least 2 bytes, so if the count is larger than the	 * max number of claims we can possibly squeeze into the remaining tvbuff, then	 * the packet is malformed.	 */	if (rcpt_clm_cnt > tvb_reported_length_remaining(tvb, frame_offset + segment_offset) / 2) {		proto_item_set_end(ltp_rpt_item, tvb, frame_offset + segment_offset);		expert_add_info_format(pinfo, ltp_tree, &ei_ltp_mal_reception_claim,				"Reception claim count impossibly large: %d > %d", rcpt_clm_cnt,				tvb_reported_length_remaining(tvb, frame_offset + segment_offset) / 2);		return 0;	}	proto_tree_add_uint(ltp_rpt_tree, hf_ltp_rpt_clm_cnt, tvb, frame_offset + segment_offset, rcpt_clm_cnt_size, rcpt_clm_cnt);	segment_offset += rcpt_clm_cnt_size;	ltp_rpt_clm_tree = proto_tree_add_subtree(ltp_rpt_tree, tvb, frame_offset + segment_offset, -1, ett_rpt_clm, &ltp_rpt_clm_item, "Reception claims");	/* There can be multiple reception claims in the same report segment */	for(i = 0; i<rcpt_clm_cnt; i++){		offset = evaluate_sdnv(tvb,frame_offset + segment_offset, &offset_size);		proto_tree_add_uint64_format(ltp_rpt_clm_tree, hf_ltp_rpt_clm_off, tvb, frame_offset + segment_offset, offset_size, offset,				"Offset[%d] : %"G_GINT64_MODIFIER"d", i, offset);		segment_offset += offset_size;		length = evaluate_sdnv(tvb,frame_offset + segment_offset, &length_size);		proto_tree_add_uint64_format(ltp_rpt_clm_tree, hf_ltp_rpt_clm_len, tvb, frame_offset + segment_offset, length_size, length,				"Length[%d] : %"G_GINT64_MODIFIER"d",i, length);		segment_offset += length_size;	}	proto_item_set_end(ltp_rpt_clm_item, tvb, frame_offset + segment_offset);	proto_item_set_end(ltp_rpt_item, tvb, frame_offset + segment_offset);	return segment_offset;}
开发者ID:DuLerWeil,项目名称:wireshark,代码行数:86,


示例20: dissect_dsp

//.........这里部分代码省略.........	  case 2: /* compare */	    dsp_dissector = dissect_dsp_ChainedCompareResult;	    dsp_op_name = "Chained-Compare-Result";	    break;	  case 3: /* abandon */	    dsp_dissector = dissect_dsp_ChainedAbandonResult;	    dsp_op_name = "Chained-Abandon-Result";	    break;	  case 4: /* list */	    dsp_dissector = dissect_dsp_ChainedListResult;	    dsp_op_name = "Chained-List-Result";	    break;	  case 5: /* search */	    dsp_dissector = dissect_dsp_ChainedSearchResult;	    dsp_op_name = "Chained-Search-Result";	    break;	  case 6: /* addEntry */	    dsp_dissector = dissect_dsp_ChainedAddEntryResult;	    dsp_op_name = "Chained-Add-Entry-Result";	    break;	  case 7: /* removeEntry */	    dsp_dissector = dissect_dsp_ChainedRemoveEntryResult;	    dsp_op_name = "Chained-Remove-Entry-Result";	    break;	  case 8: /* modifyEntry */	    dsp_dissector = dissect_dsp_ChainedModifyEntryResult;	    dsp_op_name = "Chained-Modify-Entry-Result";	    break;	  case 9: /* modifyDN */	    dsp_dissector = dissect_dsp_ChainedModifyDNResult;	    dsp_op_name = "ChainedModify-DN-Result";	    break;	  default:	    proto_tree_add_expert(tree, pinfo, &ei_dsp_unsupported_opcode, tvb, offset, -1);	    break;	  }	  break;	case (ROS_OP_INVOKE | ROS_OP_ERROR):	/*  Return Error */	  switch(session->ros_op & ROS_OP_OPCODE_MASK) {	  case 1: /* attributeError */	    dsp_dissector = dissect_dap_AttributeError;	    dsp_op_name = "Attribute-Error";	    break;	  case 2: /* nameError */	    dsp_dissector = dissect_dap_NameError;	    dsp_op_name = "Name-Error";	    break;	  case 3: /* serviceError */	    dsp_dissector = dissect_dap_ServiceError;	    dsp_op_name = "Service-Error";	    break;	  case 4: /* referral */	    dsp_dissector = dissect_dap_Referral;	    dsp_op_name = "Referral";	    break;	  case 5: /* abandoned */	    dsp_dissector = dissect_dap_Abandoned;	    dsp_op_name = "Abandoned";	    break;	  case 6: /* securityError */	    dsp_dissector = dissect_dap_SecurityError;	    dsp_op_name = "Security-Error";	    break;	  case 7: /* abandonFailed */	    dsp_dissector = dissect_dap_AbandonFailedError;	    dsp_op_name = "Abandon-Failed-Error";	    break;	  case 8: /* updateError */	    dsp_dissector = dissect_dap_UpdateError;	    dsp_op_name = "Update-Error";	    break;	  case 9: /* DSAReferral */	    dsp_dissector = dissect_dsp_DSAReferral;	    dsp_op_name = "DSA-Referral";	    break;	  default:	    proto_tree_add_expert(tree, pinfo, &ei_dsp_unsupported_errcode, tvb, offset, -1);	    break;	  }	  break;	default:	  proto_tree_add_expert(tree, pinfo, &ei_dsp_unsupported_pdu, tvb, offset, -1);	  return tvb_captured_length(tvb);	}	if(dsp_dissector) {    col_set_str(pinfo->cinfo, COL_INFO, dsp_op_name);	  while (tvb_reported_length_remaining(tvb, offset) > 0){	    old_offset=offset;	    offset=(*dsp_dissector)(FALSE, tvb, offset, &asn1_ctx, tree, -1);	    if(offset == old_offset){	      proto_tree_add_expert(tree, pinfo, &ei_dsp_zero_pdu, tvb, offset, -1);	      break;	    }	  }	}	return tvb_captured_length(tvb);}
开发者ID:MichaelQQ,项目名称:Wireshark-PE,代码行数:101,


示例21: Code

/*	5.1.1 Picture Start Code (PSC) (22 bits)	PSC is a word of 22 bits. Its value is 0000 0000 0000 0000 1 00000. All picture start codes shall be	byte aligned.	( 1000 00xx)	End Of Sequence (EOS) (22 bits)	A codeword of 22 bits. Its value is 0000 0000 0000 0000 1 11111.	( 1111 11xx )	Group of Block Start Code (GBSC) (17 bits)	A word of 17 bits. Its value is 0000 0000 0000 0000 1.	( 1xxx xxxx )	End Of Sub-Bitstream code (EOSBS) (23 bits)	The EOSBS code is a codeword of 23 bits. Its value is 0000 0000 0000 0000 1 11110 0.	( 1111 100x )	Slice Start Code (SSC) (17 bits)	A word of 17 bits. Its value is 0000 0000 0000 0000 1.	( 1xxx xxxx )  */static void dissect_h263_data( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ){	guint offset = 0;	proto_item *h263_payload_item	= NULL;	proto_tree *h263_payload_tree	= NULL;	guint32 data;	guint8 startcode;	int length;	col_append_str( pinfo->cinfo, COL_INFO, "H263 payload ");	if( tree ) {	  h263_payload_item = proto_tree_add_item( tree, proto_h263_data, tvb, offset, -1, ENC_NA );	  h263_payload_tree = proto_item_add_subtree( h263_payload_item, ett_h263_payload );	}	length = tvb_reported_length_remaining(tvb,0);	if(length<4){		if( tree )			proto_tree_add_item( h263_payload_tree, hf_h263_data, tvb, offset, -1, ENC_NA );		return;	}	/* Check for PSC, PSC is a word of 22 bits. Its value is 0000 0000 0000 0000' 1000 00xx xxxx xxxx. */	data = tvb_get_ntohl(tvb, offset);	if (( data & 0xffff8000) == 0x00008000 ) {		/* Start Code found		 *		 * Startc code holds bit 17 -23 of the codeword		 */		startcode = tvb_get_guint8(tvb,offset+2)&0xfe;		if (startcode & 0x80){			switch(startcode){			case 0xf8:				/* End Of Sub-Bitstream code (EOSBS)				 * ( 1111 100. )				 */				break;			case 0x80:			case 0x82:				/* Picture Start Code (PSC)				 * ( 1000 00x.)				 */				col_append_str( pinfo->cinfo, COL_INFO, "(PSC) ");				offset = dissect_h263_picture_layer( tvb, pinfo, h263_payload_tree, offset, -1, ENC_NA);				break;			case 0xfc:			case 0xfe:				/* End Of Sequence (EOS)				 * ( 1111 11x. )				 */			default:				/* Group of Block Start Code (GBSC) or				 * Slice Start Code (SSC)				 */				col_append_str( pinfo->cinfo, COL_INFO, "(GBSC) ");				offset = dissect_h263_group_of_blocks_layer( tvb, h263_payload_tree, offset,FALSE);				break;			}		}else{			/* Error */		}	}	if( tree )		proto_tree_add_item( h263_payload_tree, hf_h263_data, tvb, offset, -1, ENC_NA );}
开发者ID:AndresVelasco,项目名称:wireshark,代码行数:88,


示例22: proto_tree_add_item

    ti = proto_tree_add_item(tree, proto_bofl, tvb, 0, -1, ENC_NA);    bofl_tree = proto_item_add_subtree(ti, ett_bofl);    pdu = tvb_get_ntohl(tvb, 0);    col_add_fstr(pinfo->cinfo, COL_INFO,        "PDU: 0x%08x", pdu);    proto_tree_add_uint(bofl_tree, hf_bofl_pdu, tvb, 0, 4, pdu);    sequence = tvb_get_ntohl(tvb, 4);    col_append_fstr(pinfo->cinfo, COL_INFO,        " Sequence: %u", sequence);    proto_tree_add_uint(bofl_tree, hf_bofl_sequence, tvb, 4, 4, sequence);    len = tvb_reported_length_remaining(tvb, 8);    if (len > 0)        proto_tree_add_item(bofl_tree, hf_bofl_padding, tvb, 8, -1, ENC_NA);    return tvb_captured_length(tvb);}voidproto_register_bofl(void){    static hf_register_info hf[] = {        { &hf_bofl_pdu,          { "PDU", "bofl.pdu",            FT_UINT32, BASE_HEX, NULL, 0,            "PDU; normally equals 0x01010000 or 0x01011111", HFILL }
开发者ID:CharaD7,项目名称:wireshark,代码行数:31,


示例23: dissect_kt_play_script

static intdissect_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);//.........这里部分代码省略.........
开发者ID:ssyram,项目名称:wireshark,代码行数:101,



注:本文中的tvb_reported_length_remaining函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ tvherror函数代码示例
C++ tvb_reported_length函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。