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

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

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

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

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

示例1: uadecode

//.........这里部分代码省略.........    case 0x15:    case 0x16:        {            call_dissector(noe_handle,                           tvb_new_subset(tvb, offset, length, length),                           pinfo,                           tree);            break;        }    case 0x00:    case 0x01:    case 0x02:    case 0x03:    case 0x04:    case 0x05:    case 0x06:    case 0x07:  /* Only UA NOE */    case 0x08:  /* Only UA NOE */    case 0x09:    case 0x0A:    case 0x0B:    case 0x0C:    case 0x0D:    case 0x0E:    case 0x0F:    case 0x11:    case 0x12:    case 0x13:    case 0x14:    case 0x17:    case 0x18:    case 0x1F:  /* case 0x9F */    case 0x20:    case 0x21:    case 0x22:    case 0x23:    case 0x24:  /* Only IP NOE */    case 0x25:  /* Only IP NOE */    case 0x26:    case 0x27:    case 0x28:    case 0x29:    case 0x2A:    case 0x2B:  /* Only UA NOE */    case 0x2C:    case 0x2D:    case 0x2E:    case 0x30:    case 0x31:    case 0x32:  /* Only UA NOE */    case 0x33:    case 0x35:    case 0x36:  /* IP Phone */    case 0x38:    case 0x39:    case 0x3A:    case 0x3B:    case 0x3C:    case 0x3D:    case 0x3E:    case 0x3F:    case 0x40:    case 0x41:    case 0x42:    case 0x43:    case 0x44:    case 0x45:    case 0x46:    case 0x47:    case 0x48:    case 0x49:    case 0x4A:    case 0x4B:    case 0x4C:    case 0x4D:    case 0x4E:    case 0x4F:    case 0x50:  /* Only UA NOE */        {            call_dissector_with_data(ua3g_handle,                       tvb_new_subset(tvb, offset, length, length),                       pinfo,                       tree, &direction);            break;        }    default:        {            /* add text to the frame "INFO" column */            col_append_str(pinfo->cinfo, COL_INFO, " - UA3G Message ERR: Opcode Unknown");            proto_tree_add_text(tree,                tvb,                offset,                length,                "Opcode Unknown 0x%02x",                tvb_get_guint8(tvb, (offset + 2)));            break;        }    }}
开发者ID:pvons,项目名称:wireshark,代码行数:101,


示例2: dissect_pw_cesopsn

staticvoid dissect_pw_cesopsn( tvbuff_t * tvb_original						,packet_info * pinfo						,proto_tree * tree						,pwc_demux_type_t demux){	const int encaps_size = 4; /*RTP header in encapsulation is not supported yet*/	gint      packet_size;	gint      payload_size;	gint      padding_size;	int properties;	packet_size = tvb_reported_length_remaining(tvb_original, 0);	/*	 * FIXME	 * "4" below should be replaced by something like "min_packet_size_this_dissector"	 * Also call to dissect_try_cw_first_nibble() should be moved before this block	 */	if (packet_size < 4) /* 4 is smallest size which may be sensible (for PWACH dissector) */	{		proto_item  *item;		item = proto_tree_add_item(tree, proto, tvb_original, 0, -1, ENC_NA);		expert_add_info_format(pinfo, item, &ei_packet_size_too_small,				       "PW packet size (%d) is too small to carry sensible information"				       ,(int)packet_size);		col_set_str(pinfo->cinfo, COL_PROTOCOL, shortname);		col_set_str(pinfo->cinfo, COL_INFO, "Malformed: PW packet is too small");		return;	}	switch (demux)	{	case PWC_DEMUX_MPLS:		if (dissect_try_cw_first_nibble(tvb_original, pinfo, tree))		{			return;		}		break;	case PWC_DEMUX_UDP:		break;	default:		DISSECTOR_ASSERT_NOT_REACHED();		return;	}	/* check how "good" is this packet */	/* also decide payload length from packet size and CW */	properties = PWC_PACKET_PROPERTIES_T_INITIALIZER;	if (0 != (tvb_get_guint8(tvb_original, 0) & 0xf0 /*bits03*/))	{		properties |= PWC_CW_BAD_BITS03;	}	if (0 != (tvb_get_guint8(tvb_original, 1) & 0xc0 /*frag*/))	{		properties |= PWC_CW_BAD_FRAG;	}	{		/* RFC5086:		 * [LEN (bits (10 to 15) MAY be used to carry the length of the CESoPSN		 * packet (defined as the size of the CESoPSN header + the payload size)		 * if it is less than 64 bytes, and MUST be set to zero otherwise.		 * Note:  If fixed RTP header is used in the encapsulation, it is		 * considered part of the CESoPSN header.]		 *		 * Note that this differs from RFC4385's definition of length:		 * [ If the MPLS payload is less than 64 bytes, the length field		 * MUST be set to the length of the PW payload...]		 *		 * We will use RFC5086's definition here.		 */		int  cw_len;		gint payload_size_from_packet;		cw_len = tvb_get_guint8(tvb_original, 1) & 0x3f;		payload_size_from_packet = packet_size - encaps_size;		if (cw_len != 0)		{			gint payload_size_from_cw;			payload_size_from_cw = cw_len - encaps_size;			/*			 * Assumptions for error case,			 * will be overwritten if no errors found:			 */			payload_size = payload_size_from_packet;			padding_size = 0;			if (payload_size_from_cw < 0)			{				properties |= PWC_CW_BAD_PAYLEN_LT_0;			}			else if (payload_size_from_cw > payload_size_from_packet)			{				properties |= PWC_CW_BAD_PAYLEN_GT_PACKET;			}			else if (payload_size_from_packet >= 64)			{				properties |= PWC_CW_BAD_LEN_MUST_BE_0;			}			else /* ok *///.........这里部分代码省略.........
开发者ID:DuLerWeil,项目名称:wireshark,代码行数:101,


示例3: dissect_tns_data

static void dissect_tns_data(tvbuff_t *tvb, int offset, packet_info *pinfo,                             proto_tree *tree, proto_tree *tns_tree){    proto_tree *data_tree = NULL, *ti;    proto_item *hidden_item;    int is_sns = 0;    if ( tvb_bytes_exist(tvb, offset+2, 4) )    {        if ( tvb_get_guint8(tvb, offset+2) == 0xDE &&                tvb_get_guint8(tvb, offset+3) == 0xAD &&                tvb_get_guint8(tvb, offset+4) == 0xBE &&                tvb_get_guint8(tvb, offset+5) == 0xEF )        {            is_sns = 1;        }    }    if ( tree )    {        if ( is_sns )        {            ti = proto_tree_add_text(tns_tree, tvb, offset, -1,                                     "Secure Network Services");        }        else        {            ti = proto_tree_add_text(tns_tree, tvb, offset, -1,                                     "Data");        }        data_tree = proto_item_add_subtree(ti, ett_tns_data);        hidden_item = proto_tree_add_boolean(tns_tree, hf_tns_data, tvb, 0, 0,                                             TRUE);        PROTO_ITEM_SET_HIDDEN(hidden_item);    }    if ( tree )    {        proto_tree *df_tree = NULL;        ti = proto_tree_add_item(data_tree, hf_tns_data_flag, tvb, offset, 2, ENC_BIG_ENDIAN);        df_tree = proto_item_add_subtree(ti, ett_tns_data_flag);        proto_tree_add_item(df_tree, hf_tns_data_flag_send, tvb, offset, 2, ENC_BIG_ENDIAN);        proto_tree_add_item(df_tree, hf_tns_data_flag_rc, tvb, offset, 2, ENC_BIG_ENDIAN);        proto_tree_add_item(df_tree, hf_tns_data_flag_c, tvb, offset, 2, ENC_BIG_ENDIAN);        proto_tree_add_item(df_tree, hf_tns_data_flag_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);        proto_tree_add_item(df_tree, hf_tns_data_flag_more, tvb, offset, 2, ENC_BIG_ENDIAN);        proto_tree_add_item(df_tree, hf_tns_data_flag_eof, tvb, offset, 2, ENC_BIG_ENDIAN);        proto_tree_add_item(df_tree, hf_tns_data_flag_dic, tvb, offset, 2, ENC_BIG_ENDIAN);        proto_tree_add_item(df_tree, hf_tns_data_flag_rts, tvb, offset, 2, ENC_BIG_ENDIAN);        proto_tree_add_item(df_tree, hf_tns_data_flag_sntt, tvb, offset, 2, ENC_BIG_ENDIAN);    }    offset += 2;    if ( check_col(pinfo->cinfo, COL_INFO) )    {        if ( is_sns )        {            col_append_str(pinfo->cinfo, COL_INFO, ", SNS");        }        else        {            col_append_str(pinfo->cinfo, COL_INFO, ", Data");        }    }    if ( data_tree )    {        call_dissector(data_handle,                       tvb_new_subset_remaining(tvb, offset), pinfo, data_tree);    }    return;}
开发者ID:kailiu-bupt2005,项目名称:wireshark,代码行数:76,


示例4: dissect_ccn

/* * Dissector that returns: * *	The amount of data in the protocol's PDU, if it was able to *	dissect all the data; * *	0, if the tvbuff doesn't contain a PDU for that protocol; * *	The negative of the amount of additional data needed, if *	we need more data (e.g., from subsequent TCP segments) to *	dissect the entire PDU. */static intdissect_ccn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){    guint tvb_size = 0;    proto_tree *ccn_tree;    proto_item *ti = NULL;    const unsigned char *ccnb;    struct ccn_skeleton_decoder skel_decoder;    struct ccn_skeleton_decoder *sd;    struct ccn_charbuf *c;    int packet_type = 0;    int packet_type_length = 0;    /* a couple of basic checks to rule out packets that are definitely not ours */    tvb_size = tvb_length(tvb);    if (tvb_size < CCN_MIN_PACKET_SIZE || tvb_get_guint8(tvb, 0) == 0)        return (0);        sd = &skel_decoder;    memset(sd, 0, sizeof(*sd));    sd->state |= CCN_DSTATE_PAUSE;    ccnb = ep_tvb_memdup(tvb, 0, tvb_size);    ccn_skeleton_decode(sd, ccnb, tvb_size);    if (sd->state < 0)        return (0);    if (CCN_GET_TT_FROM_DSTATE(sd->state) == CCN_DTAG) {        packet_type = sd->numval;        packet_type_length = sd->index;    } else {        return (0);    }    memset(sd, 0, sizeof(*sd));    ccn_skeleton_decode(sd, ccnb, tvb_size);    if (!CCN_FINAL_DSTATE(sd->state)) {        pinfo->desegment_offset = 0;        pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;        return (-1); /* what should this be? */    }        /* Make it visible that we're taking this packet */    if (check_col(pinfo->cinfo, COL_PROTOCOL)) {        col_set_str(pinfo->cinfo, COL_PROTOCOL, "CCN");    }        /* Clear out stuff in the info column */    if (check_col(pinfo->cinfo, COL_INFO)) {        col_clear(pinfo->cinfo, COL_INFO);    }        c = ccn_charbuf_create();    ccn_uri_append(c, ccnb, tvb_size, 1);        /* Add the packet type and CCN URI to the info column */    if (check_col(pinfo->cinfo, COL_INFO)) {        col_add_str(pinfo->cinfo, COL_INFO,                    val_to_str(packet_type, VALS(ccn_dtag_dict.dict), "Unknown (0x%02x"));        col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, ccn_charbuf_as_string(c));    }        if (tree == NULL) {        ccn_charbuf_destroy(&c);        return (sd->index);    }        ti = proto_tree_add_protocol_format(tree, proto_ccn, tvb, 0, -1,                                        "Content-centric Networking Protocol, %s, %s",                                        val_to_str(packet_type, VALS(ccn_dtag_dict.dict), "Unknown (0x%02x"),                                        ccn_charbuf_as_string(c));    ccn_tree = proto_item_add_subtree(ti, ett_ccn);    ccn_charbuf_destroy(&c);    ti = proto_tree_add_uint(ccn_tree, hf_ccn_type, tvb, 0, packet_type_length, packet_type);        switch (packet_type) {        case CCN_DTAG_ContentObject:            if (0 > dissect_ccn_contentobject(ccnb, sd->index, tvb, pinfo, ccn_tree))                return (0);            break;        case CCN_DTAG_Interest:            if (0 > dissect_ccn_interest(ccnb, sd->index, tvb, pinfo, ccn_tree))                return (0);            break;    }        return (sd->index);}
开发者ID:Emat12,项目名称:ccnx,代码行数:96,


示例5: dissect_dtp_tlv

static voiddissect_dtp_tlv(packet_info *pinfo, tvbuff_t *tvb, int offset, int length,		proto_tree *tree, proto_item *ti, proto_item *tlv_length_item, guint8 type){	switch (type) {	case DTP_TLV_DOMAIN:		if (length <= 33) { /* VTP domain name is at most 32 bytes long and is null-terminated */			proto_item_append_text(ti, ": %s", tvb_format_text(tvb, offset, length - 1));			proto_tree_add_item(tree, hf_dtp_domain, tvb, offset, length, ENC_ASCII|ENC_NA);		}		else			expert_add_info(pinfo, tlv_length_item, &ei_dtp_tlv_length_invalid);		break;	case DTP_TLV_TRSTATUS:		if (length == 1) { /* Value field length must be 1 byte */			proto_item * value_item = NULL;			proto_tree * field_tree = NULL;			guint8 trunk_status = tvb_get_guint8(tvb, offset);			proto_item_append_text(ti,				" (Operating/Administrative): %s/%s (0x%02x)",				val_to_str_const(DTP_TOSVALUE(trunk_status), dtp_tos_vals, "Unknown operating status"),				val_to_str_const(DTP_TASVALUE(trunk_status), dtp_tas_vals, "Unknown administrative status"),				trunk_status);			value_item = proto_tree_add_text(tree, tvb, offset, length, "Value: %s/%s (0x%02x)",				val_to_str_const(DTP_TOSVALUE(trunk_status), dtp_tos_vals, "Unknown operating status"),				val_to_str_const(DTP_TASVALUE(trunk_status), dtp_tas_vals, "Unknown administrative status"),				trunk_status);			field_tree = proto_item_add_subtree(value_item, ett_dtp_status);			proto_tree_add_item(field_tree, hf_dtp_tos, tvb, offset, length, ENC_NA);			proto_tree_add_item(field_tree, hf_dtp_tas, tvb, offset, length, ENC_NA);			}			else				expert_add_info(pinfo, tlv_length_item, &ei_dtp_tlv_length_invalid);		break;	case DTP_TLV_TRTYPE:		if (length == 1) { /* Value field length must be 1 byte */			proto_item * value_item = NULL;			proto_tree * field_tree = NULL;			guint8 trunk_type = tvb_get_guint8(tvb, offset);			proto_item_append_text(ti,				" (Operating/Administrative): %s/%s (0x%02x)",				val_to_str_const(DTP_TOTVALUE(trunk_type), dtp_tot_vals, "Unknown operating type"),				val_to_str_const(DTP_TATVALUE(trunk_type), dtp_tat_vals, "Unknown administrative type"),				trunk_type);			value_item = proto_tree_add_text(tree, tvb, offset, length, "Value: %s/%s (0x%02x)",				val_to_str_const(DTP_TOTVALUE(trunk_type), dtp_tot_vals, "Unknown operating type"),				val_to_str_const(DTP_TATVALUE(trunk_type), dtp_tat_vals, "Unknown administrative type"),				trunk_type);			field_tree = proto_item_add_subtree(value_item, ett_dtp_type);			proto_tree_add_item(field_tree, hf_dtp_tot, tvb, offset, length, ENC_NA);			proto_tree_add_item(field_tree, hf_dtp_tat, tvb, offset, length, ENC_NA);			}			else				expert_add_info(pinfo, tlv_length_item, &ei_dtp_tlv_length_invalid);		break;	case DTP_TLV_SENDERID:		if (length == 6) { /* Value length must be 6 bytes for a MAC address */			proto_item_append_text(ti, ": %s",				tvb_ether_to_str(tvb, offset));	/* XXX - resolve? */			proto_tree_add_item(tree, hf_dtp_senderid, tvb, offset, length, ENC_NA);		}		else			expert_add_info(pinfo, tlv_length_item, &ei_dtp_tlv_length_invalid);		break;	default:		proto_tree_add_text(tree, tvb, offset, length, "Data");		break;	}}
开发者ID:VincentLadeveze,项目名称:802154e-wireshark,代码行数:79,


示例6: dissect_macctrl

static voiddissect_macctrl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){  proto_item *ti, *opcode_item;  proto_tree *macctrl_tree = NULL;  proto_tree *pause_times_tree = NULL;  guint16     opcode;  guint16     pause_time;  int i;  col_set_str(pinfo->cinfo, COL_PROTOCOL, "MAC CTRL");  col_clear(pinfo->cinfo, COL_INFO);  opcode = tvb_get_ntohs(tvb, 0);  ti = proto_tree_add_item(tree, proto_macctrl, tvb, 0, 46, ENC_NA);  macctrl_tree = proto_item_add_subtree(ti, ett_macctrl);  opcode_item = proto_tree_add_uint(macctrl_tree, hf_macctrl_opcode, tvb, 0, 2, opcode);  proto_tree_add_item(macctrl_tree, hf_macctrl_timestamp, tvb, 2, 4, ENC_BIG_ENDIAN);  col_add_str(pinfo->cinfo, COL_INFO, val_to_str(opcode, opcode_vals, "Unknown"));  switch (opcode) {    case MACCTRL_PAUSE:      if (!addresses_equal(&pinfo->dst, &macctrl_dst_address)) {        expert_add_info(pinfo, opcode_item, &ei_macctrl_dst_address);      }      pause_time = tvb_get_ntohs(tvb, 6);      col_append_fstr(pinfo->cinfo, COL_INFO, ": pause_time: %u quanta",                      pause_time);      proto_tree_add_uint(macctrl_tree, hf_macctrl_pause_time, tvb, 6, 2,                          pause_time);      break;    case MACCTRL_GATE:      break;    case MACCTRL_REPORT:      break;    case MACCTRL_REGISTER_REQ:      /* Flags */      proto_tree_add_item(macctrl_tree, hf_reg_flags, tvb,                          6, 1, ENC_NA);      /* Pending Grants */      proto_tree_add_item(macctrl_tree, hf_reg_req_grants, tvb,                          7, 1, ENC_NA);      break;    case MACCTRL_REGISTER:      /* Assigned Port */      proto_tree_add_item(macctrl_tree, hf_reg_port, tvb,                          6, 2, ENC_BIG_ENDIAN);      /* Flags */      proto_tree_add_item(macctrl_tree, hf_reg_flags, tvb,                          8, 1, ENC_NA);      /* Synch Time */      proto_tree_add_item(macctrl_tree, hf_reg_time, tvb,                          9, 2, ENC_BIG_ENDIAN);      /* Echoed Pending Grants */      proto_tree_add_item(macctrl_tree, hf_reg_grants, tvb,                          11, 1, ENC_NA);      break;    case MACCTRL_REGISTER_ACK:      /* Flags */      proto_tree_add_item(macctrl_tree, hf_reg_flags, tvb,                          6, 1, ENC_NA);      /* Echoed Assigned Port */      proto_tree_add_item(macctrl_tree, hf_reg_ack_port, tvb,                          7, 2, ENC_BIG_ENDIAN);      /* Echoed Synch Time */      proto_tree_add_item(macctrl_tree, hf_reg_ack_time, tvb,                          9, 2, ENC_BIG_ENDIAN);      break;    case MACCTRL_CLASS_BASED_FLOW_CNTRL_PAUSE:      if (!addresses_equal(&pinfo->dst, &macctrl_dst_address)) {        expert_add_info(pinfo, opcode_item, &ei_macctrl_dst_address);      }      ti = proto_tree_add_bitmask(macctrl_tree, tvb, 2, hf_macctrl_cbfc_enbv,                             ett_macctrl_cbfc_enbv, macctrl_cbfc_enbv_list, ENC_BIG_ENDIAN);      if (tvb_get_guint8(tvb, 2) != 0) {        expert_add_info(pinfo, ti, &ei_macctrl_cbfc_enbv);      }      pause_times_tree = proto_tree_add_subtree(macctrl_tree, tvb, 4, 8*2, ett_macctrl_cbfc_pause_times, NULL, "CBFC Class Pause Times");      for (i=0; i<8; i++) {        proto_tree_add_item(pause_times_tree, *macctrl_cbfc_pause_times_list[i], tvb, 4+i*2, 2, ENC_BIG_ENDIAN);//.........这里部分代码省略.........
开发者ID:ARK1988,项目名称:wireshark,代码行数:101,


示例7: zebra_route

static intzebra_route(proto_tree *tree, tvbuff_t *tvb, int offset, guint16 len,	    guint8 family, guint8 version){	guint32	prefix4;	guint8 message, prefixlen, buffer6[16];	if (version == 0) {		proto_tree_add_item(tree, hf_zebra_type_v0, tvb,				    offset, 1, ENC_BIG_ENDIAN);	} else {		proto_tree_add_item(tree, hf_zebra_type_v1, tvb,				    offset, 1, ENC_BIG_ENDIAN);	}	offset += 1;	proto_tree_add_item(tree, hf_zebra_rtflags, tvb,			    offset, 1, ENC_BIG_ENDIAN);	offset += 1;	message = tvb_get_guint8(tvb, offset);	offset = zebra_route_message(tree, tvb, offset);	if (version > 1) {		/* version 2 added safi */		proto_tree_add_item(tree, hf_zebra_route_safi, tvb,				    offset, 2, ENC_BIG_ENDIAN);		offset += 2;	}	prefixlen = tvb_get_guint8(tvb, offset);	proto_tree_add_uint(tree, hf_zebra_prefixlen, tvb,			    offset, 1, prefixlen);	offset += 1;	if (family == ZEBRA_FAMILY_IPV6) {		memset(buffer6, '/0', sizeof buffer6);		tvb_memcpy(tvb, buffer6, offset,			   MIN((unsigned) PSIZE(prefixlen), sizeof buffer6));		proto_tree_add_ipv6(tree, hf_zebra_prefix6,				    tvb, offset, PSIZE(prefixlen), (struct e_in6_addr *)buffer6);	}else {		prefix4 = 0;		tvb_memcpy(tvb, (guint8 *)&prefix4, offset,			   MIN((unsigned) PSIZE(prefixlen), sizeof prefix4));		proto_tree_add_ipv4(tree, hf_zebra_prefix4,				    tvb, offset, PSIZE(prefixlen), prefix4);	}	offset += PSIZE(prefixlen);	if (message & ZEBRA_ZAPI_MESSAGE_NEXTHOP) {		offset = zebra_route_nexthop(tree, tvb, offset, len);	}	if (message & ZEBRA_ZAPI_MESSAGE_IFINDEX) {		offset = zebra_route_ifindex(tree, tvb, offset, len);	}	if (message & ZEBRA_ZAPI_MESSAGE_DISTANCE) {		proto_tree_add_item(tree, hf_zebra_distance,				    tvb, offset, 1, ENC_BIG_ENDIAN);		offset += 1;	}	if (message & ZEBRA_ZAPI_MESSAGE_METRIC) {		proto_tree_add_item(tree, hf_zebra_metric,				    tvb, offset, 4, ENC_BIG_ENDIAN);		offset += 4;	}	return offset;}
开发者ID:Nicholas1126,项目名称:wireshark-ex,代码行数:68,


示例8: dissect_dmx_sip

static voiddissect_dmx_sip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){	col_set_str(pinfo->cinfo, COL_PROTOCOL, "DMX SIP");	col_clear(pinfo->cinfo, COL_INFO);	if (tree != NULL) {		guint    offset = 0;		guint    byte_count;		guint    checksum, checksum_shouldbe;		proto_item *item;		proto_tree *checksum_tree;		proto_tree *ti = proto_tree_add_item(tree, proto_dmx_sip, tvb,							offset, -1, ENC_NA);		proto_tree *dmx_sip_tree = proto_item_add_subtree(ti, ett_dmx_sip);		byte_count = tvb_get_guint8(tvb, offset);		proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_byte_count, tvb,							offset, 1, ENC_BIG_ENDIAN);		offset++;		proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_control_bit_field, tvb,							offset, 1, ENC_BIG_ENDIAN);		offset++;		proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_prev_packet_checksum, tvb,							offset, 2, ENC_BIG_ENDIAN);		offset += 2;		proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_seq_nr, tvb,							offset, 1, ENC_BIG_ENDIAN);		offset++;		proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_dmx_universe_nr, tvb,							offset, 1, ENC_BIG_ENDIAN);		offset++;		proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_dmx_proc_level, tvb,							offset, 1, ENC_BIG_ENDIAN);		offset++;		proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_dmx_software_version, tvb,							offset, 1, ENC_BIG_ENDIAN);		offset++;		proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_dmx_packet_len, tvb,							offset, 2, ENC_BIG_ENDIAN);		offset += 2;		proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_dmx_nr_packets, tvb,							offset, 2, ENC_BIG_ENDIAN);		offset += 2;		proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_orig_dev_id, tvb,							offset, 2, ENC_BIG_ENDIAN);		offset += 2;		proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_sec_dev_id, tvb,							offset, 2, ENC_BIG_ENDIAN);		offset += 2;		proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_third_dev_id, tvb,							offset, 2, ENC_BIG_ENDIAN);		offset += 2;		proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_fourth_dev_id, tvb,							offset, 2, ENC_BIG_ENDIAN);		offset += 2;		proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_fifth_dev_id, tvb,							offset, 2, ENC_BIG_ENDIAN);		offset += 2;		if (offset < byte_count) {			proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_reserved, tvb,							offset, byte_count - offset, ENC_NA);			offset += (byte_count - offset);		}		dmx_sip_checksum(tvb, offset);		checksum_shouldbe = dmx_sip_checksum(tvb, offset);		checksum = tvb_get_guint8(tvb, offset);		item = proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_checksum, tvb,				offset, 1, ENC_BIG_ENDIAN);		if (checksum == checksum_shouldbe) {			proto_item_append_text(item, " [correct]");			checksum_tree = proto_item_add_subtree(item, ett_dmx_sip);			item = proto_tree_add_boolean(checksum_tree, hf_dmx_sip_checksum_good, tvb,						offset, 1, TRUE);			PROTO_ITEM_SET_GENERATED(item);			item = proto_tree_add_boolean(checksum_tree, hf_dmx_sip_checksum_bad, tvb,						offset, 1, FALSE);			PROTO_ITEM_SET_GENERATED(item);		} else {			proto_item_append_text(item, " [incorrect, should be 0x%02x]", checksum_shouldbe);//.........这里部分代码省略.........
开发者ID:hauke,项目名称:wireshark,代码行数:101,


示例9: dissect_djiuav_pdu

        }    }}static intdissect_djiuav_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_){    proto_item		*ti;    proto_tree		*djiuav_tree = NULL;    guint32			offset = 0;    guint32			pdu_length;    guint8			packet_type;    gboolean		is_cmd;    is_cmd = (pinfo->match_uint == pinfo->destport);    packet_type = tvb_get_guint8(tvb, 6);    col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_SHORT_NAME);    col_add_str(pinfo->cinfo, COL_INFO, is_cmd?"C: ":"R: ");    col_append_str(pinfo->cinfo, COL_INFO, val_to_str(packet_type,                   djiuav_pdu_type, "Type 0x%02x"));    ti = proto_tree_add_item(tree, proto_djiuav, tvb, offset, -1, ENC_NA);    djiuav_tree = proto_item_add_subtree(ti, ett_djiuav);    request_response_handling(tvb, pinfo, djiuav_tree, offset);    if (tree) {        proto_tree_add_item(djiuav_tree, hf_djiuav_magic, tvb, offset, 2,                            ENC_BIG_ENDIAN);        offset += 2;
开发者ID:linshimiao,项目名称:wireshark,代码行数:31,


示例10: dissect_bpkmreq

/* Initialize the subtree pointers */static gint ett_docsis_bpkmreq = -1;static dissector_handle_t attrs_handle;/* Dissection */static intdissect_bpkmreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_){  proto_item *it;  proto_tree *bpkmreq_tree;  guint8 code;  tvbuff_t *attrs_tvb;  code = tvb_get_guint8 (tvb, 0);  col_add_fstr (pinfo->cinfo, COL_INFO, "BPKM Request (%s)",                val_to_str (code, code_field_vals, "%d"));  if (tree)    {      it =        proto_tree_add_protocol_format (tree, proto_docsis_bpkmreq, tvb, 0, -1,                                        "BPKM Request Message");      bpkmreq_tree = proto_item_add_subtree (it, ett_docsis_bpkmreq);      proto_tree_add_item (bpkmreq_tree, hf_docsis_bpkmreq_code, tvb, 0, 1,                           ENC_BIG_ENDIAN);      proto_tree_add_item (bpkmreq_tree, hf_docsis_bpkmreq_ident, tvb, 1, 1,                           ENC_BIG_ENDIAN);      proto_tree_add_item (bpkmreq_tree, hf_docsis_bpkmreq_length, tvb, 2, 2,
开发者ID:appneta,项目名称:wireshark,代码行数:30,


示例11: request_response_handling

static voidrequest_response_handling(tvbuff_t *tvb, packet_info *pinfo, proto_tree *djiuav_tree,                          guint32 offset){    conversation_t		*conversation;    djiuav_conv_info_t	*djiuav_info;    djiuav_transaction_t	*djiuav_trans;    guint16			seq_no;    gboolean		is_cmd;    guint8			packet_type;    is_cmd = (pinfo->match_uint == pinfo->destport);    seq_no = tvb_get_letohs(tvb, offset + 4);    packet_type = tvb_get_guint8(tvb, offset + 6);    conversation = find_or_create_conversation(pinfo);    djiuav_info = (djiuav_conv_info_t *)conversation_get_proto_data(conversation, proto_djiuav);    if (!djiuav_info) {        djiuav_info = wmem_new(wmem_file_scope(), djiuav_conv_info_t);        djiuav_info->pdus=wmem_map_new(wmem_file_scope(), g_direct_hash, g_direct_equal);        conversation_add_proto_data(conversation, proto_djiuav, djiuav_info);    }    if (!pinfo->fd->flags.visited) {        if (is_cmd) {            djiuav_trans=wmem_new(wmem_file_scope(), djiuav_transaction_t);            djiuav_trans->request_frame=pinfo->fd->num;            djiuav_trans->reply_frame=0;            djiuav_trans->request_time=pinfo->fd->abs_ts;            djiuav_trans->seqno=seq_no;            djiuav_trans->command=packet_type;            wmem_map_insert(djiuav_info->pdus, GUINT_TO_POINTER((guint)seq_no), (void *)djiuav_trans);        } else {            djiuav_trans=(djiuav_transaction_t *)wmem_map_lookup(djiuav_info->pdus, GUINT_TO_POINTER((guint)seq_no));            if (djiuav_trans) {                /* Special case: djiuav seems to send 0x24 replies with seqno 0 and without a request */                if (djiuav_trans->reply_frame == 0)                    djiuav_trans->reply_frame=pinfo->fd->num;            }        }    } else {        djiuav_trans=(djiuav_transaction_t *)wmem_map_lookup(djiuav_info->pdus, GUINT_TO_POINTER((guint)seq_no));    }    /* djiuav_trans may be 0 in case it's a reply without a matching request */    if (djiuav_tree && djiuav_trans) {        if (is_cmd) {            if (djiuav_trans->reply_frame) {                proto_item *it;                it = proto_tree_add_uint(djiuav_tree, hf_djiuav_response_in,                                         tvb, 0, 0, djiuav_trans->reply_frame);                PROTO_ITEM_SET_GENERATED(it);            }        } else {            if (djiuav_trans->request_frame) {                proto_item *it;                nstime_t ns;                it = proto_tree_add_uint(djiuav_tree, hf_djiuav_response_to,                                         tvb, 0, 0, djiuav_trans->request_frame);                PROTO_ITEM_SET_GENERATED(it);                nstime_delta(&ns, &pinfo->fd->abs_ts, &djiuav_trans->request_time);                it = proto_tree_add_time(djiuav_tree, hf_djiuav_response_time, tvb, 0, 0, &ns);                PROTO_ITEM_SET_GENERATED(it);            }        }    }}
开发者ID:linshimiao,项目名称:wireshark,代码行数:72,


示例12: get_wow_pdu_len

static int hf_wow_realm_num_characters = -1;static int hf_wow_realm_timezone = -1;static gboolean wow_preference_desegment = TRUE;static gint ett_wow = -1;static gint ett_wow_realms = -1;static guintget_wow_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset, void *data _U_){	gint8 size_field_offset = -1;	guint8 cmd;	guint16 pkt_len;	cmd = tvb_get_guint8(tvb, offset);	if(WOW_SERVER_TO_CLIENT && cmd == REALM_LIST)		size_field_offset = 1;	if(WOW_CLIENT_TO_SERVER && cmd == AUTH_LOGON_CHALLENGE)		size_field_offset = 2;	pkt_len = tvb_get_letohs(tvb, size_field_offset);	return pkt_len + size_field_offset + 2;}static intdissect_wow_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_){
开发者ID:acaceres2176,项目名称:wireshark,代码行数:31,


示例13: dissect_btsmp

static intdissect_btsmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data){    int          offset = 0;    proto_item  *ti;    proto_tree  *st;    guint8      opcode;    guint32     interface_id;    guint32     adapter_id;    gint        previous_proto;    interface_id = HCI_INTERFACE_DEFAULT;    adapter_id = HCI_ADAPTER_DEFAULT;    previous_proto = (GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_frame_prev(wmem_list_tail(pinfo->layers)))));    if (data && previous_proto == proto_btl2cap) {        btl2cap_data_t *l2cap_data;        l2cap_data = (btl2cap_data_t *) data;        if (l2cap_data) {            interface_id = l2cap_data->interface_id;            adapter_id = l2cap_data->adapter_id;        }    }    ti = proto_tree_add_item(tree, proto_btsmp, tvb, 0, tvb_captured_length(tvb), ENC_NA);    st = proto_item_add_subtree(ti, ett_btsmp);    col_set_str(pinfo->cinfo, COL_PROTOCOL, "SMP");    switch (pinfo->p2p_dir) {    case P2P_DIR_SENT:        col_set_str(pinfo->cinfo, COL_INFO, "Sent ");        break;    case P2P_DIR_RECV:        col_set_str(pinfo->cinfo, COL_INFO, "Rcvd ");        break;    default:        col_set_str(pinfo->cinfo, COL_INFO, "UnknownDirection ");        break;    }    if (tvb_reported_length(tvb) < 1)        return FALSE;    proto_tree_add_item(st, hf_btsmp_opcode, tvb, 0, 1, ENC_LITTLE_ENDIAN);    opcode = tvb_get_guint8(tvb, 0);    offset++;    col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(opcode, opcode_vals, "<unknown>"));    switch (opcode) {    case 0x01: /* Pairing Request */    case 0x02: /* Pairing Response */    {        col_append_str(pinfo->cinfo, COL_INFO, ": ");        proto_tree_add_item(st, hf_btsmp_io_capabilities, tvb, offset, 1, ENC_LITTLE_ENDIAN);        offset++;        proto_tree_add_item(st, hf_btsmp_oob_data_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN);        offset++;        offset = dissect_btsmp_auth_req(tvb, offset, pinfo, st);        proto_tree_add_item(st, hf_btsmp_max_enc_key_size, tvb, offset, 1, ENC_LITTLE_ENDIAN);        offset++;        offset = dissect_btsmp_key_dist(tvb, offset, pinfo, st, TRUE);        offset = dissect_btsmp_key_dist(tvb, offset, pinfo, st, FALSE);        break;    }    case 0x03: /* Pairing Confirm */        proto_tree_add_item(st, hf_btsmp_cfm_value, tvb, offset, 16, ENC_NA);        offset += 16;        break;    case 0x04: /* Pairing Random */        proto_tree_add_item(st, hf_btsmp_random, tvb, offset, 16, ENC_NA);        offset += 16;        break;    case 0x05: /* Pairing Failed */        proto_tree_add_item(st, hf_btsmp_reason, tvb, offset, 1, ENC_LITTLE_ENDIAN);        col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", val_to_str_const(tvb_get_guint8(tvb, offset), reason_vals, "<unknown>"));        offset++;        break;    case 0x06: /* Encryption Information */        proto_tree_add_item(st, hf_btsmp_long_term_key, tvb, offset, 16, ENC_NA);        offset += 16;        break;    case 0x07: /* Master Identification */        proto_tree_add_item(st, hf_btsmp_ediv, tvb, offset, 2, ENC_LITTLE_ENDIAN);        offset += 2;        proto_tree_add_item(st, hf_btsmp_random, tvb, offset, 8, ENC_NA);        offset += 8;        break;    case 0x08: /* Identity Information *///.........这里部分代码省略.........
开发者ID:crondaemon,项目名称:wireshark,代码行数:101,


示例14: dissect_uhd

/* dissect a UHD header and hand payload off to respective dissector */static voiddissect_uhd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){	int	    ind;	proto_item *ti;	proto_tree *uhd_tree;	guint32	    id;	guint8	    i2c_bytes;	col_set_str(pinfo->cinfo, COL_PROTOCOL, "UHD");	col_clear(pinfo->cinfo, COL_INFO);	id = tvb_get_ntohl(tvb, 4);	col_add_str(pinfo->cinfo, COL_INFO, val_to_str(id, uhd_ids, "Unknown UHD message type '%c'"));	if (tree == NULL)		return;	ti = proto_tree_add_protocol_format(tree, proto_uhd, tvb, 0, 34, "UHD id = %c ", id);	uhd_tree = proto_item_add_subtree(ti, ett_uhd);	proto_tree_add_item(uhd_tree, hf_uhd_version, tvb, 0, 4, ENC_BIG_ENDIAN);	proto_tree_add_item(uhd_tree, hf_uhd_id,      tvb, 4, 4, ENC_BIG_ENDIAN);	proto_tree_add_item(uhd_tree, hf_uhd_seq,     tvb, 8, 4, ENC_BIG_ENDIAN);	switch (id) {		case UMTRX_CTRL_ID_REQUEST:		case UMTRX_CTRL_ID_RESPONSE:		case USRP2_CTRL_ID_WAZZUP_BRO:		case USRP2_CTRL_ID_WAZZUP_DUDE:			proto_tree_add_item(uhd_tree, hf_uhd_ip_addr,       tvb, 12, 4, ENC_BIG_ENDIAN);			break;		case USRP2_CTRL_ID_TRANSACT_ME_SOME_SPI_BRO:		case USRP2_CTRL_ID_OMG_TRANSACTED_SPI_DUDE:			proto_tree_add_item(uhd_tree, hf_uhd_spi_dev,	    tvb, 12, 4, ENC_BIG_ENDIAN);			proto_tree_add_item(uhd_tree, hf_uhd_spi_data,	    tvb, 16, 4, ENC_BIG_ENDIAN);			proto_tree_add_item(uhd_tree, hf_uhd_spi_miso_edge, tvb, 20, 1, ENC_BIG_ENDIAN);			proto_tree_add_item(uhd_tree, hf_uhd_spi_mosi_edge, tvb, 21, 1, ENC_BIG_ENDIAN);			proto_tree_add_item(uhd_tree, hf_uhd_spi_num_bits,  tvb, 22, 1, ENC_BIG_ENDIAN);			proto_tree_add_item(uhd_tree, hf_uhd_spi_readback,  tvb, 23, 1, ENC_BIG_ENDIAN);			break;		case USRP2_CTRL_ID_DO_AN_I2C_READ_FOR_ME_BRO:		case USRP2_CTRL_ID_HERES_THE_I2C_DATA_DUDE:		case USRP2_CTRL_ID_WRITE_THESE_I2C_VALUES_BRO:		case USRP2_CTRL_ID_COOL_IM_DONE_I2C_WRITE_DUDE:			proto_tree_add_item(uhd_tree, hf_uhd_i2c_addr, tvb, 12, 1, ENC_BIG_ENDIAN);			i2c_bytes = tvb_get_guint8(tvb, 13);			proto_tree_add_item(uhd_tree, hf_uhd_i2c_bytes, tvb, 13, 1, ENC_BIG_ENDIAN);			for (ind = 0; ind < i2c_bytes; ind++) {				proto_tree_add_item(uhd_tree, hf_uhd_i2c_data, tvb, 14 + ind, 1, ENC_BIG_ENDIAN);			}			break;		case USRP2_CTRL_ID_GET_THIS_REGISTER_FOR_ME_BRO:		case USRP2_CTRL_ID_OMG_GOT_REGISTER_SO_BAD_DUDE:			proto_tree_add_item(uhd_tree, hf_uhd_reg_addr,	 tvb, 12, 4, ENC_BIG_ENDIAN);			proto_tree_add_item(uhd_tree, hf_uhd_reg_data,	 tvb, 16, 4, ENC_BIG_ENDIAN);			proto_tree_add_item(uhd_tree, hf_uhd_reg_action, tvb, 20, 1, ENC_BIG_ENDIAN);			break;		case USRP2_CTRL_ID_HOLLER_AT_ME_BRO:		case USRP2_CTRL_ID_HOLLER_BACK_DUDE:		case USRP2_CTRL_ID_HUH_WHAT:		case USRP2_CTRL_ID_PEACE_OUT:			proto_tree_add_item(uhd_tree, hf_uhd_echo_len,   tvb, 12, 4, ENC_BIG_ENDIAN);			break;	}}
开发者ID:MultipathDTLS,项目名称:wireshark,代码行数:68,


示例15: dissect_channel_send

static guint16dissect_channel_send(tvbuff_t *tvb, proto_tree *tree, int offset){   guint16 send_type, awareness;   guint na;   send_type = tvb_get_ntohs(tvb, offset);   proto_item_append_text(tree, ", %s", val_to_str(send_type, sendtypenames, "0x%04x"));   proto_tree_add_item(tree, hf_sametime_channel_send_type, tvb, offset, 2, ENC_BIG_ENDIAN);   offset += 2;   switch (send_type)        {      case SAMETIME_SENDTYPE_AWARE_ADD:         offset += 8;         awareness = tvb_get_ntohs(tvb, offset);         proto_item_append_text(tree, ", %s", val_to_str(awareness, awarenessnames, "0x%04x"));         proto_tree_add_item(tree, hf_sametime_channel_awareness, tvb, offset, 2, ENC_BIG_ENDIAN);         offset += 2;         add_text_item(tvb, tree, offset, hf_sametime_field_text);         break;      case SAMETIME_SENDTYPE_OPT_DO_SET:         offset += 20;         na = tvb_get_ntohl(tvb, offset);         offset += 4;         if (na == 0x33)        {            offset += add_text_item(tvb, tree, offset, hf_sametime_location_country);            offset += add_text_item(tvb, tree, offset, hf_sametime_location_postalcode);            offset += add_text_item(tvb, tree, offset, hf_sametime_location_province);            offset += add_text_item(tvb, tree, offset, hf_sametime_location_city);            offset += add_text_item(tvb, tree, offset, hf_sametime_location_phone);            offset += 1;            offset += add_text_item(tvb, tree, offset, hf_sametime_location_name);            add_text_item(tvb, tree, offset, hf_sametime_location_timezone);         } else        {            add_text_item(tvb, tree, offset, hf_sametime_field_text);         }         break;      case SAMETIME_SENDTYPE_OPT_GOT_SET:         offset += 8;         awareness = tvb_get_ntohs(tvb, offset);         proto_item_append_text(tree, ", %s", val_to_str(awareness, awarenessnames, "0x%04x"));         proto_tree_add_item(tree, hf_sametime_channel_awareness, tvb, offset, 2, ENC_BIG_ENDIAN);         offset += 2;         while (tvb_reported_length_remaining(tvb, offset) > 2)        {            int n = add_text_item(tvb, tree, offset, hf_sametime_field_text);            offset += (n) ? n : 1;         }         break;      case SAMETIME_SENDTYPE_AWARE_SNAPSHOT:         offset += 12;         awareness = tvb_get_ntohs(tvb, offset);         proto_item_append_text(tree, ", %s", val_to_str(awareness, awarenessnames, "0x%04x"));         proto_tree_add_item(tree, hf_sametime_channel_awareness, tvb, offset, 2, ENC_BIG_ENDIAN);         offset += 2;         add_text_item(tvb, tree, offset, hf_sametime_field_text);         break;      case SAMETIME_SENDTYPE_AWARE_UPDATE:         offset += 4;         offset += 4;         awareness = tvb_get_ntohs(tvb, offset);         proto_item_append_text(tree, ", %s", val_to_str(awareness, awarenessnames, "0x%04x"));         proto_tree_add_item(tree, hf_sametime_channel_awareness, tvb, offset, 2, ENC_BIG_ENDIAN);         offset += 2;         offset += add_text_item(tvb, tree, offset, hf_sametime_field_text);         offset += 4;         if (tvb_get_guint8(tvb, offset))        {            offset += 1;            offset += add_text_item(tvb, tree, offset, hf_sametime_field_text);            dissect_set_user_status(tvb, tree, offset);         }         break;      case 0x0000:         offset += 14;         add_text_item(tvb, tree, offset, hf_sametime_field_text);         break;      case 0x0002:         offset += 8;         offset += add_text_item(tvb, tree, offset, hf_sametime_field_text);         offset += 3;         add_text_item(tvb, tree, offset, hf_sametime_field_text);         break;      case 0x0005:        /* XML */         if (26 <= tvb_reported_length_remaining(tvb, offset + 2))        {            offset += 26;            add_text_item(tvb, tree, offset, hf_sametime_field_text);         }//.........这里部分代码省略.........
开发者ID:CharaD7,项目名称:wireshark,代码行数:101,


示例16: dissect_ppi_antenna

static voiddissect_ppi_antenna(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {    /* The fixed values up front */    guint32 version;    guint length;    gint  length_remaining;    proto_tree *ppi_antenna_tree = NULL;    proto_tree *antennaflags_tree = NULL;    proto_tree *pt, *my_pt;    proto_item *ti = NULL;    proto_item *antenna_line = NULL;    /* bits */    int bit;    guint32 present, next_present;    /* values actually read out, for displaying */    guint8 gaindb;    guint16 beamid;    guint32 t_hbw, t_vbw, t_pgain, t_appspecific_num; /* temporary conversions */    gdouble horizbw, vertbw, pgain;    guint32 flags;    gchar *curr_str;    int offset = 0;    static const int * ppi_antenna_present_flags[] = {        &hf_ppi_antenna_present_flags,        &hf_ppi_antenna_present_gaindb,        &hf_ppi_antenna_present_horizbw,        &hf_ppi_antenna_present_vertbw,        &hf_ppi_antenna_present_pgain,        &hf_ppi_antenna_present_beamid,        &hf_ppi_antenna_present_serialnum,        &hf_ppi_antenna_present_modelname,        &hf_ppi_antenna_present_descstr,        &hf_ppi_antenna_present_appspecific_num,        &hf_ppi_antenna_present_appspecific_data,        &hf_ppi_antenna_present_ext,        NULL    };    /* Clear out stuff in the info column */    col_clear(pinfo->cinfo,COL_INFO);    /* pull out the first three fields of the BASE-GEOTAG-HEADER */    version = tvb_get_guint8(tvb, offset);    length  = tvb_get_letohs(tvb, offset+2);    present = tvb_get_letohl(tvb, offset+4);    /* Setup basic column info */    col_add_fstr(pinfo->cinfo, COL_INFO, "PPI Antenna info v%u, Length %u",                     version, length);    /* Create the basic dissection tree*/    if (tree) {        ti = proto_tree_add_protocol_format(tree, proto_ppi_antenna,                                            tvb, 0, length, "Antenna: ");        antenna_line = ti; /* save this for later, we will fill it in with more detail */        ppi_antenna_tree= proto_item_add_subtree(ti, ett_ppi_antenna);        proto_tree_add_uint(ppi_antenna_tree, hf_ppi_antenna_version,                            tvb, offset, 1, version);        proto_tree_add_item(ppi_antenna_tree, hf_ppi_antenna_pad,                            tvb, offset + 1, 1, ENC_LITTLE_ENDIAN);        ti = proto_tree_add_uint(ppi_antenna_tree, hf_ppi_antenna_length,                                 tvb, offset + 2, 2, length);    }    /* We support v1 and v2 of Antenna tags (identical) */    if (! (version == 1 || version == 2) ) {        if (tree)            proto_item_append_text(ti, "invalid version (got %d,  expected 1 or 2)", version);        return;    }    length_remaining = length;    /* minimum length check, should atleast be a fixed-size geotagging-base header*/    if (length_remaining < PPI_GEOBASE_MIN_HEADER_LEN) {        /*         * Base-geotag-header (Radiotap lookalike) is shorter than the fixed-length portion         * plus one "present" bitset.         */        proto_item_append_text(ti, " (invalid - minimum length is 8)");        return;    }    /* perform max length sanity checking */    if (length > PPI_ANTENNA_MAXTAGLEN ) {        proto_item_append_text(ti, "Invalid PPI-Antenna length  (got %d, %d max/n)", length, PPI_ANTENNA_MAXTAGLEN);        return;    }    /* Subtree for the "present flags" bitfield. */    pt = proto_tree_add_bitmask(ppi_antenna_tree, tvb, offset + 4, hf_ppi_antenna_present, ett_ppi_antenna_present, ppi_antenna_present_flags, ENC_LITTLE_ENDIAN);    offset += PPI_GEOBASE_MIN_HEADER_LEN;    length_remaining -= PPI_GEOBASE_MIN_HEADER_LEN;//.........这里部分代码省略.........
开发者ID:MultipathDTLS,项目名称:wireshark,代码行数:101,


示例17: dissect_fefd

static voiddissect_fefd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){    proto_item *ti;    proto_tree *fefd_tree = NULL;    int offset = 0;    guint16 type;    guint16 length;    proto_item *tlvi;    proto_tree *tlv_tree;    int real_length;    col_set_str(pinfo->cinfo, COL_PROTOCOL, "FEFD");    col_clear(pinfo->cinfo, COL_INFO);    if (tree) {	proto_item *flags_ti;	proto_tree *flags_tree;	ti = proto_tree_add_item(tree, proto_fefd, tvb, offset, -1, FALSE);	fefd_tree = proto_item_add_subtree(ti, ett_fefd);	/* FEFD header */	proto_tree_add_item(fefd_tree, hf_fefd_version, tvb, offset, 1, FALSE);	proto_tree_add_item(fefd_tree, hf_fefd_opcode, tvb, offset, 1, FALSE);	offset += 1;	flags_ti = proto_tree_add_item(fefd_tree, hf_fefd_flags, tvb, offset, 1, FALSE);	flags_tree = proto_item_add_subtree(ti, ett_fefd_flags);	proto_tree_add_item(flags_tree, hf_fefd_flags_rt, tvb, offset, 1, FALSE);	proto_tree_add_item(flags_tree, hf_fefd_flags_rsy, tvb, offset, 1, FALSE);	offset += 1;	proto_tree_add_item(fefd_tree, hf_fefd_checksum, tvb, offset, 2, FALSE);	offset += 2;    } else {	offset += 4; /* The version/opcode/flags/checksum fields from above */    }	while (tvb_reported_length_remaining(tvb, offset) != 0) {	    type = tvb_get_ntohs(tvb, offset + TLV_TYPE);	    length = tvb_get_ntohs(tvb, offset + TLV_LENGTH);	    if (length < 4) {		if (tree) {		    tlvi = proto_tree_add_text(fefd_tree, tvb, offset, 4,			"TLV with invalid length %u (< 4)",			length);		    tlv_tree = proto_item_add_subtree(tlvi, ett_fefd_tlv);		    proto_tree_add_uint(tlv_tree, hf_fefd_tlvtype, tvb,				offset + TLV_TYPE, 2, type);		    proto_tree_add_uint(tlv_tree, hf_fefd_tlvlength, tvb,				offset + TLV_LENGTH, 2, length);		}		offset += 4;		break;	    }	    switch (type) {	    case TYPE_DEVICE_ID:		/* Device ID */		if (check_col(pinfo->cinfo, COL_INFO))		    col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL,				    "Device ID: %s",				    tvb_format_stringzpad(tvb, offset + 4,							  length - 4));		if (tree) {		    tlvi = proto_tree_add_text(fefd_tree, tvb, offset,				length, "Device ID: %s",				tvb_format_stringzpad(tvb, offset + 4, length - 4));		    tlv_tree = proto_item_add_subtree(tlvi, ett_fefd_tlv);		    proto_tree_add_uint(tlv_tree, hf_fefd_tlvtype, tvb,				offset + TLV_TYPE, 2, type);		    proto_tree_add_uint(tlv_tree, hf_fefd_tlvlength, tvb,				offset + TLV_LENGTH, 2, length);		    proto_tree_add_text(tlv_tree, tvb, offset + 4,				length - 4, "Device ID: %s",				tvb_format_stringzpad(tvb, offset + 4, length - 4));		}		offset += length;		break;	    case TYPE_PORT_ID:		real_length = length;		if (tvb_get_guint8(tvb, offset + real_length) != 0x00) {		    /* The length in the TLV doesn't appear to be the		       length of the TLV, as the byte just past it		       isn't the first byte of a 2-byte big-endian		       small integer; make the length of the TLV the length		       in the TLV, plus 4 bytes for the TLV type and length,		       minus 1 because that's what makes one capture work. */		    real_length = length + 3;		}		if (check_col(pinfo->cinfo, COL_INFO))		    col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL,				    "Port ID: %s",				    tvb_format_stringzpad(tvb, offset + 4, real_length - 4));		if (tree) {//.........这里部分代码省略.........
开发者ID:flaub,项目名称:HotFuzz,代码行数:101,


示例18: dissect_lsc_udp

/* Decode LSC over UDP */static voiddissect_lsc_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){  dissect_lsc_common(tvb, pinfo, tree);}/* Determine length of LSC message */static guintget_lsc_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset){  guint8 op_code;  guint pdu_len;  /* Get the op code */  op_code = tvb_get_guint8(tvb, offset + 2);  switch (op_code)    {      case LSC_PAUSE:        pdu_len = LSC_PAUSE_LEN;        break;      case LSC_RESUME:        pdu_len = LSC_RESUME_LEN;        break;      case LSC_STATUS:        pdu_len = LSC_STATUS_LEN;        break;      case LSC_RESET:        pdu_len = LSC_RESET_LEN;        break;
开发者ID:LucaBongiorni,项目名称:LTE_monitor_c2xx,代码行数:31,


示例19: dissect_csm_encaps

/* Code to actually dissect the packets */static intdissect_csm_encaps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_){    proto_item  *ti;    proto_tree  *csm_encaps_tree = NULL;    guint16      function_code, channel, class_type;    guint        control, type, sequence, length;    guint        i;    gboolean     show_error_param= FALSE;    const gchar *str_function_name;    function_code = tvb_get_letohs(tvb, 10);    control = tvb_get_guint8(tvb, 3);    class_type = tvb_get_guint8(tvb, 9);    class_type = class_type<<8;    class_type|= tvb_get_guint8(tvb, 8);    type     = tvb_get_guint8(tvb, 8);    sequence = tvb_get_guint8(tvb, 2);    length   = tvb_get_guint8(tvb, 6);    channel  = tvb_get_ntohs(tvb, 4);    if (CSM_ENCAPS_CTRL_ACK&control)        show_error_param= FALSE;    else {        if (csm_to_host(function_code, class_type)) /* exclusive messages to host */
开发者ID:DHODoS,项目名称:wireshark,代码行数:30,


示例20: dissect_lsc_common

/* Code to actually dissect the packets */static voiddissect_lsc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){  proto_item *ti;  proto_tree *lsc_tree;  guint8 op_code;  guint32 stream;  guint expected_len;  /* Protocol is LSC, packet summary is not yet known */  col_set_str(pinfo->cinfo, COL_PROTOCOL, "LSC");  col_clear(pinfo->cinfo, COL_INFO);  /* Too little data? */  if (tvb_length(tvb) < LSC_MIN_LEN)  {    col_set_str(pinfo->cinfo, COL_INFO, "[Too short]");    return;  }  /* Get the op code */  op_code = tvb_get_guint8(tvb, 2);  /* And the stream handle */  stream = tvb_get_ntohl(tvb, 4);  /* Check the data length against what we actually received */  switch (op_code)    {      case LSC_PAUSE:        expected_len = LSC_PAUSE_LEN;        break;      case LSC_RESUME:        expected_len = LSC_RESUME_LEN;        break;      case LSC_STATUS:        expected_len = LSC_STATUS_LEN;        break;      case LSC_RESET:        expected_len = LSC_RESET_LEN;        break;      case LSC_JUMP:        expected_len = LSC_JUMP_LEN;        break;      case LSC_PLAY:        expected_len = LSC_PLAY_LEN;        break;      case LSC_DONE:      case LSC_PAUSE_REPLY:      case LSC_RESUME_REPLY:      case LSC_STATUS_REPLY:      case LSC_RESET_REPLY:      case LSC_JUMP_REPLY:      case LSC_PLAY_REPLY:        expected_len = LSC_REPLY_LEN;        break;      default:        /* Unrecognized op code */        expected_len = LSC_MIN_LEN;        break;    }  /* Display the op code in the summary */  col_add_fstr(pinfo->cinfo, COL_INFO, "%s, session %.8u",                 val_to_str(op_code, op_code_vals, "Unknown op code (0x%x)"),                 stream);  if (tvb_length(tvb) < expected_len)    col_append_str(pinfo->cinfo, COL_INFO, " [Too short]");  else if (tvb_length(tvb) > expected_len)    col_append_str(pinfo->cinfo, COL_INFO, " [Too long]");  if (tree) {    /* Create display subtree for the protocol */    ti = proto_tree_add_item(tree, proto_lsc, tvb, 0, -1, ENC_NA);    lsc_tree = proto_item_add_subtree(ti, ett_lsc);    /* Add already fetched items to the tree */    proto_tree_add_uint(lsc_tree, hf_lsc_op_code, tvb, 2, 1, op_code);    proto_tree_add_uint_format_value(lsc_tree, hf_lsc_stream_handle, tvb, 4, 4,                                     stream, "%.8u", stream);    /* Add rest of LSC header */    proto_tree_add_uint(lsc_tree, hf_lsc_version, tvb, 0, 1,                        tvb_get_guint8(tvb, 0));    proto_tree_add_uint(lsc_tree, hf_lsc_trans_id, tvb, 1, 1,                        tvb_get_guint8(tvb, 1));    /* Only replies contain a status code */    if (isReply(op_code))      proto_tree_add_uint(lsc_tree, hf_lsc_status_code, tvb, 3, 1,                          tvb_get_guint8(tvb, 3));    /* Add op code specific parts */    switch (op_code)      {        case LSC_PAUSE:          proto_tree_add_int(lsc_tree, hf_lsc_stop_npt, tvb, 8, 4,                             tvb_get_ntohl(tvb, 8));          break;//.........这里部分代码省略.........
开发者ID:LucaBongiorni,项目名称:LTE_monitor_c2xx,代码行数:101,


示例21: dissect_usb_midi_event

static voiddissect_usb_midi_event(tvbuff_t *tvb, packet_info *pinfo,                       proto_tree *usb_audio_tree, proto_tree *parent_tree,                       gint offset){    guint8      code;    guint8      cable;    gboolean    save_fragmented;    proto_tree *tree = NULL;    col_set_str(pinfo->cinfo, COL_INFO, "USB-MIDI Event Packets");    code = tvb_get_guint8(tvb, offset);    cable = (code & 0xF0) >> 4;    code &= 0x0F;    if (parent_tree)    {        proto_item *ti;        ti = proto_tree_add_protocol_format(usb_audio_tree, proto_usb_audio, tvb, offset, 4, "USB Midi Event Packet");        tree = proto_item_add_subtree(ti, ett_usb_audio);        proto_tree_add_item(tree, hf_midi_cable_number, tvb, offset, 1, ENC_BIG_ENDIAN);        proto_tree_add_item(tree, hf_midi_code_index, tvb, offset, 1, ENC_BIG_ENDIAN);        proto_tree_add_item(tree, hf_midi_event, tvb, offset+1, 3, ENC_BIG_ENDIAN);    }    save_fragmented = pinfo->fragmented;    /* Reassemble SysEx commands */    if (is_sysex_code(code))    {        tvbuff_t* new_tvb = NULL;        fragment_head *frag_sysex_msg = NULL;        pinfo->fragmented = TRUE;        if (code == 0x04)        {            frag_sysex_msg = fragment_add_seq_next(&midi_data_reassembly_table,                                                   tvb, offset+1,                                                   pinfo,                                                   cable, /* ID for fragments belonging together */                                                   NULL,                                                   3,                                                   TRUE);        }        else        {            frag_sysex_msg = fragment_add_seq_next(&midi_data_reassembly_table,                                                   tvb, offset+1,                                                   pinfo,                                                   cable, /* ID for fragments belonging together */                                                   NULL,                                                   (gint)(code - 4),                                                   FALSE);        }        if (is_last_sysex_packet_in_tvb(tvb, offset))        {            new_tvb = process_reassembled_data(tvb, offset+1, pinfo,                                               "Reassembled Message", frag_sysex_msg, &sysex_msg_frag_items,                                               NULL, usb_audio_tree);            if (code != 0x04) { /* Reassembled */                col_append_str(pinfo->cinfo, COL_INFO,                               " (SysEx Reassembled)");            } else { /* Not last packet of reassembled Short Message */                col_append_str(pinfo->cinfo, COL_INFO,                               " (SysEx fragment)");            }            if (new_tvb)            {                call_dissector(sysex_handle, new_tvb, pinfo, parent_tree);            }        }    }    pinfo->fragmented = save_fragmented;}
开发者ID:ajitlakhwani,项目名称:wireshark,代码行数:81,


示例22: _dissect_ua_msg

/*-----------------------------------------------------------------------------  UA DISSECTOR  ---------------------------------------------------------------------------*/static void _dissect_ua_msg(tvbuff_t       *tvb,                            packet_info    *pinfo,                            proto_tree     *tree,                            e_ua_direction  direction){    gint        offset = 0;    proto_item *ua_msg_item;    proto_tree *ua_msg_tree;    ua_msg_item = proto_tree_add_protocol_format(tree, proto_ua_msg, tvb, 0, -1,        "Universal Alcatel Protocol, %s",        ((direction == SYS_TO_TERM) ?        "System -> Terminal" : "Terminal -> System"));    ua_msg_tree = proto_item_add_subtree(ua_msg_item, ett_ua_msg);    while (tvb_offset_exists(tvb, offset))    {        gint length;        gint opcode;        length = tvb_get_letohs(tvb, offset) + 2;        opcode = tvb_get_guint8(tvb, offset+2);        /* RTP/RTCP conversation setup */        if (setup_conversations_enabled && (opcode==0x13) && (tvb_get_guint8(tvb, offset+3)==0x01))        {            address remote_rtp_addr;            guint32 remote_rtp_port;            gint    suboffset;            remote_rtp_addr.data = NULL;            remote_rtp_port = 0;            /* StartRTP */            suboffset = offset + 5;            while (suboffset < offset+length)            {                switch (tvb_get_guint8(tvb, suboffset))                {                case 0x00: /* local port */                    {                    /*local_rtp_port = tvb_get_ntohs(tvb, suboffset+2);*/                    break;                    }                case 0x01: /* remote IP */                    {                    remote_rtp_addr.type = AT_IPv4;                    remote_rtp_addr.len  = 4;                    remote_rtp_addr.data = tvb_get_ptr(tvb, suboffset+2, 4);                    break;                    }                case 0x02: /* remote port */                    {                    remote_rtp_port = tvb_get_ntohs(tvb, suboffset+2);                    break;                    }                }            suboffset += tvb_get_guint8(tvb, suboffset+1) + 2;            }            if ((remote_rtp_addr.data != NULL) && (remote_rtp_port != 0))            {                rtp_add_address(pinfo, &remote_rtp_addr, remote_rtp_port, 0,                        "UA", pinfo->fd->num, 0, NULL);                rtcp_add_address(pinfo, &remote_rtp_addr, remote_rtp_port+1, 0,                         "UA", pinfo->fd->num);            }        }        uadecode(direction, ua_msg_tree, pinfo, tvb, offset, opcode, length);        offset += length;    }}
开发者ID:pvons,项目名称:wireshark,代码行数:80,



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


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