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

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

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

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

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

示例1: dissect_nmpi

static voiddissect_nmpi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){	proto_tree	*nmpi_tree = NULL;	proto_item	*ti;	int		offset = 0;	guint8		opcode;	guint8		nmpi_name_type;	char		name[(NETBIOS_NAME_LEN - 1)*4 + 1];	int		name_type;	char		node_name[(NETBIOS_NAME_LEN - 1)*4 + 1];	int		node_name_type = 0;	tvbuff_t	*next_tvb;	col_set_str(pinfo->cinfo, COL_PROTOCOL, "NMPI");	col_clear(pinfo->cinfo, COL_INFO);	if (tree) {		ti = proto_tree_add_item(tree, proto_nmpi, tvb, offset, 68,		    FALSE);		nmpi_tree = proto_item_add_subtree(ti, ett_nmpi);		add_routers(nmpi_tree, tvb, offset);	}	offset += 32;	/*	 * XXX - we don't use "node_name" or "node_name_type".	 */	opcode = tvb_get_guint8(tvb, offset);	nmpi_name_type = tvb_get_guint8(tvb, offset+1);	name_type = get_netbios_name(tvb, offset+4, name, (NETBIOS_NAME_LEN - 1)*4 + 1);	node_name_type = get_netbios_name(tvb, offset+20, node_name, (NETBIOS_NAME_LEN - 1)*4 + 1);	if (check_col(pinfo->cinfo, COL_INFO)) {		switch (opcode) {		case INAME_CLAIM:			col_add_fstr(pinfo->cinfo, COL_INFO, "Claim name %s<%02x>",					name, name_type);			break;		case INAME_DELETE:			col_add_fstr(pinfo->cinfo, COL_INFO, "Delete name %s<%02x>",					name, name_type);			break;		case INAME_QUERY:			col_add_fstr(pinfo->cinfo, COL_INFO, "Query name %s<%02x>",					name, name_type);			break;		case INAME_FOUND:			col_add_fstr(pinfo->cinfo, COL_INFO, "Name %s<%02x> found",					name, name_type);			break;		case IMSG_HANGUP:			col_add_fstr(pinfo->cinfo, COL_INFO,			    "Messenger hangup on %s<%02x>", name, name_type);			break;		case IMSLOT_SEND:			col_add_fstr(pinfo->cinfo, COL_INFO,			    "Mailslot write to %s<%02x>", name, name_type);			break;		case IMSLOT_FIND:			col_add_fstr(pinfo->cinfo, COL_INFO,			    "Find mailslot name %s<%02x>", name, name_type);			break;		case IMSLOT_NAME:			col_add_fstr(pinfo->cinfo, COL_INFO,			    "Mailslot name %s<%02x> found", name, name_type);			break;		default:			col_add_fstr(pinfo->cinfo, COL_INFO,			    "Unknown NMPI op 0x%02x: name %s<%02x>",			    opcode, name, name_type);			break;		}	}	if (tree) {		proto_tree_add_text(nmpi_tree, tvb, offset, 1,		    "Opcode: %s (0x%02x)",		    val_to_str(opcode, nmpi_opcode_vals, "Unknown"),		    opcode);		proto_tree_add_text(nmpi_tree, tvb, offset+1, 1,		    "Name Type: %s (0x%02x)",		    val_to_str(nmpi_name_type, nmpi_name_type_vals, "Unknown"),		    nmpi_name_type);		proto_tree_add_text(nmpi_tree, tvb, offset+2, 2,		    "Message ID: 0x%04x",		    tvb_get_letohs(tvb, offset+2));		netbios_add_name("Requested name", tvb, offset+4, nmpi_tree);		netbios_add_name("Source name", tvb, offset+20, nmpi_tree);	}//.........这里部分代码省略.........
开发者ID:AkhilaAG,项目名称:gluster-wireshark-1.4,代码行数:101,


示例2: dissect_dtpt_sockaddr

static intdissect_dtpt_sockaddr(tvbuff_t *tvb, guint offset, proto_tree *tree, int hfindex, int sockaddr_type){	guint32	sockaddr_length = 0;	proto_item	*sockaddr_item = NULL;	proto_tree	*sockaddr_tree = NULL;	guint32		sockaddr_len1 = 0;	guint32		sockaddr_len2 = 0;	switch (sockaddr_type) {		case SOCKADDR_WITH_LEN:			sockaddr_len1=4;			sockaddr_len2=16;		break;		case SOCKADDR_CONNECT:			sockaddr_len1=0;			sockaddr_len2=30;		break;	}	if (sockaddr_type == SOCKADDR_WITH_LEN)		sockaddr_length = tvb_get_letohl(tvb, offset + 0);	if (tree) {		sockaddr_item = proto_tree_add_text(tree,			tvb, offset, sockaddr_len1+sockaddr_len2, "%s", proto_registrar_get_name(hfindex));		if (sockaddr_item)			sockaddr_tree = proto_item_add_subtree(sockaddr_item, ett_dtpt_sockaddr);		if (sockaddr_tree) {			if (sockaddr_type == SOCKADDR_WITH_LEN)				proto_tree_add_uint(sockaddr_tree, hf_dtpt_sockaddr_length,						tvb, offset+0, 4, sockaddr_length);		}	}	offset += sockaddr_len1;	if (sockaddr_tree) {		switch (sockaddr_type) {			case SOCKADDR_WITH_LEN: {				guint16 family;				family = tvb_get_letohs(tvb, offset);				proto_tree_add_uint(sockaddr_tree, hf_dtpt_sockaddr_family,						tvb, offset, 2, family);				switch (family) {					case WINSOCK_AF_INET: {						guint16 port;						guint32	addr;						port = tvb_get_ntohs(tvb,offset+2);						proto_tree_add_uint(sockaddr_tree, hf_dtpt_sockaddr_port,						tvb, offset+2,2,port);						addr = tvb_get_ipv4(tvb,offset+4);						proto_tree_add_ipv4(sockaddr_tree, hf_dtpt_sockaddr_address,						tvb, offset+4,4,addr);						proto_tree_add_text(sockaddr_tree, tvb, offset+8, 8, "Padding");							proto_item_append_text(sockaddr_item, ": %s:%d", ip_to_str((guint8*)&addr), port);					}					break;				}			}			break;			case SOCKADDR_CONNECT: {				guint32	family;				family = tvb_get_letohl(tvb, offset+0);				proto_tree_add_uint(sockaddr_tree, hf_dtpt_sockaddr_family,						tvb, offset+0, 4, family);				switch (family) {					case WINSOCK_AF_INET: {						guint16 port;						guint32	addr;						proto_tree_add_text(sockaddr_tree, tvb, offset+4, 4, "Padding");						port = tvb_get_ntohs(tvb,offset+8);						proto_tree_add_uint(sockaddr_tree, hf_dtpt_sockaddr_port,							tvb, offset+8,2,port);						addr = tvb_get_ipv4(tvb,offset+10);						proto_tree_add_ipv4(sockaddr_tree, hf_dtpt_sockaddr_address,							tvb, offset+10,4,addr);						proto_tree_add_text(sockaddr_tree, tvb, offset+14, 16, "Padding");						proto_item_append_text(sockaddr_item, ": %s:%d", ip_to_str((guint8*)&addr), port);					}					break;				}			}			break;		}	}	offset += sockaddr_len2;	return offset;}
开发者ID:hauke,项目名称:wireshark,代码行数:95,


示例3: dissect_mailslot_smb

gbooleandissect_mailslot_smb(tvbuff_t *mshdr_tvb, tvbuff_t *setup_tvb,		     tvbuff_t *tvb, const char *mailslot, packet_info *pinfo,		     proto_tree *parent_tree, smb_info_t* smb_info){	smb_transact_info_t *tri;	int             trans_subcmd;	proto_tree      *tree = NULL;	proto_item      *item = NULL;	guint16         opcode;	int             offset = 0;	int             len;	if (!proto_is_protocol_enabled(find_protocol_by_id(proto_smb_msp))) {		return FALSE;	}	pinfo->current_proto = "SMB Mailslot";	col_set_str(pinfo->cinfo, COL_PROTOCOL, "SMB Mailslot");	if ((tvb==NULL) || (tvb_reported_length(tvb)==0)) {		/* Interim reply */		col_set_str(pinfo->cinfo, COL_INFO, "Interim reply");		return TRUE;	}	col_clear(pinfo->cinfo, COL_INFO);	if (smb_info->sip != NULL && smb_info->sip->extra_info_type == SMB_EI_TRI)		tri = (smb_transact_info_t *)smb_info->sip->extra_info;	else		tri = NULL;	/* check which mailslot this is about */	trans_subcmd=MAILSLOT_UNKNOWN;	if(smb_info->request){		if(strncmp(mailslot,"BROWSE",6) == 0){	  		trans_subcmd=MAILSLOT_BROWSE;		} else if(strncmp(mailslot,"LANMAN",6) == 0){	  		trans_subcmd=MAILSLOT_LANMAN;		} else if(strncmp(mailslot,"NET",3) == 0){	  		trans_subcmd=MAILSLOT_NET;		} else if(strncmp(mailslot,"TEMP//NETLOGON",13) == 0){	  		trans_subcmd=MAILSLOT_TEMP_NETLOGON;		} else if(strncmp(mailslot,"MSSP",4) == 0){			trans_subcmd=MAILSLOT_MSSP;		}		if (!pinfo->fd->flags.visited) {			if (tri != NULL)				tri->trans_subcmd = trans_subcmd;		}	} else {		if(!tri){			return FALSE;		} else {			trans_subcmd = tri->trans_subcmd;		}	}	/* Only do these ones if we have them. For fragmented SMB Transactions	   we may only have the setup area for the first fragment	*/	if(mshdr_tvb && setup_tvb){		if (parent_tree) {			item = proto_tree_add_item(parent_tree, proto_smb_msp,						   mshdr_tvb, 0, -1, ENC_NA);			tree = proto_item_add_subtree(item, ett_smb_msp);		}		/* do the opcode field */		opcode = tvb_get_letohs(setup_tvb, offset);		col_add_str(pinfo->cinfo, COL_INFO,				    val_to_str(opcode, opcode_vals, "Unknown opcode: 0x%04x"));		/* These are in the setup words; use "setup_tvb". */		/* opcode */		proto_tree_add_uint(tree, hf_opcode, setup_tvb, offset, 2,		    opcode);		offset += 2;		/* priority */		proto_tree_add_item(tree, hf_priority, setup_tvb, offset, 2,		    ENC_LITTLE_ENDIAN);		offset += 2;		/* class */		proto_tree_add_item(tree, hf_class, setup_tvb, offset, 2, ENC_LITTLE_ENDIAN);		offset += 2;		/* These are in the rest of the data; use "mshdr_tvb", which		   starts at the same place "setup_tvb" does. */		/* size */		/* this is actually bytecount in the SMB Transaction command */		proto_tree_add_item(tree, hf_size, mshdr_tvb, offset, 2, ENC_LITTLE_ENDIAN);		offset += 2;//.........这里部分代码省略.........
开发者ID:pvons,项目名称:wireshark,代码行数:101,


示例4: dissect_egd

static int hf_egd_stat = -1;static int hf_egd_csig = -1;static int hf_egd_resv = -1;static gint ett_egd = -1;static gint ett_status_item = -1;static int dissect_egd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_){  /* replace UDP with EGD in display */  col_set_str(pinfo->cinfo, COL_PROTOCOL, "EGD");  /* Clear out stuff in the info column */  col_clear(pinfo->cinfo, COL_INFO);  col_add_fstr(pinfo->cinfo, COL_INFO, "Data Msg: ExchangeID=0x%08X, RequestID=%05u",                 tvb_get_letohl(tvb, 8), tvb_get_letohs(tvb, 2));  if (tree)  {    proto_item *ti = NULL;    proto_item *notime = NULL;    proto_tree *egd_tree = NULL;    tvbuff_t *next_tvb = NULL;    gint offset, data_length;    guint32 sectime;    nstime_t egd_time;    memset(&egd_time, 0, sizeof(nstime_t));    offset = 0;    ti = proto_tree_add_item(tree, proto_egd, tvb, 0, -1, ENC_NA);
开发者ID:CharaD7,项目名称:wireshark,代码行数:31,


示例5: zdp_parse_bind_table_entry

/*FUNCTION:------------------------------------------------------ *  NAME *      zdp_parse_bind_table_entry *  DESCRIPTION *      Parses and displays a single binding table entry. *  PARAMETERS *      tvbuff_t *tvb       - pointer to buffer containing raw packet. *      packet_into *pinfo  - pointer to packet information fields *      proto_tree *tree    - pointer to data tree Wireshark uses to display packet. *  RETURNS *      void *--------------------------------------------------------------- */voidzdp_parse_bind_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint8 version){    proto_item      *ti = NULL;    guint           len = 0;    guint64 src64;    guint8  src_ep;    guint16 cluster;    guint8  mode;    guint64 dst64;    guint16 dst;    guint8  dst_ep;    /* Add the source address. */    src64 = tvb_get_letoh64(tvb, *offset + len);    if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 0, "Bind {Src: %s", ep_eui64_to_display(src64));    len += (int)sizeof(guint64);    /* Add the source endpoint. */    src_ep = tvb_get_guint8(tvb, *offset + len);    if (tree) proto_item_append_text(ti, ", Src Endpoint: %d", src_ep);    len += (int)sizeof(guint8);    /* Add the cluster ID. */    if (version >= ZBEE_VERSION_2007) {        cluster = tvb_get_letohs(tvb, *offset + len);        len += (int)sizeof(guint16);    }    else {        cluster = tvb_get_guint8(tvb, *offset + len);        len += (int)sizeof(guint8);    }    if (tree) proto_item_append_text(ti, ", Cluster: %d", cluster);    /* Get the destination address mode. */    if (version >= ZBEE_VERSION_2007) {        mode = tvb_get_guint8(tvb, *offset + len);        len += (int)sizeof(guint8);    }    else {        /* Mode field doesn't exist and always uses unicast in 2003 & earlier. */        mode = ZBEE_ZDP_ADDR_MODE_UNICAST;    }    /* Add the destination address. */    if (mode == ZBEE_ZDP_ADDR_MODE_GROUP) {        dst = tvb_get_letohs(tvb, *offset + len);        if (tree) proto_item_append_text(ti, ", Dst: 0x%04x}", dst);        len += (int)sizeof(guint16);    }    else if (mode == ZBEE_ZDP_ADDR_MODE_UNICAST) {        dst64 = tvb_get_letoh64(tvb, *offset + len);        if (tree) proto_item_append_text(ti, ", Dst: %s", ep_eui64_to_display(dst64));        len += (int)sizeof(guint64);        dst_ep = tvb_get_guint8(tvb, *offset + len);        if (tree) proto_item_append_text(ti, ", Dst Endpoint: %d}", dst_ep);        len += (int)sizeof(guint8);    }    else {        if (tree) proto_item_append_text(ti, "}");    }    if (tree) {        proto_item_set_len(ti, len);    }    *offset += len;} /* zdp_parse_bind_table_entry */
开发者ID:dot-Sean,项目名称:wireshark-http2,代码行数:82,


示例6: dissect_comrej

    { 0, NULL }};static const value_string disc_status_vals[] = {    { 0x0000, "Success" },    { 0x0001, "Invalid Controller ID" },    { 0x0002, "Failed - No Physical Link exists and no Physical Link creation is in progress" },    { 0, NULL }};static intdissect_comrej(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree){    guint16 reason;    reason = tvb_get_letohs(tvb, offset);    proto_tree_add_item(tree, hf_btamp_rej_reason, tvb, offset, 2, ENC_LITTLE_ENDIAN);    offset += 2;    switch (reason) {    case 0x0000: /* Command not understood */        break;    default:        break;    }    return offset;}static int
开发者ID:parc-wifi,项目名称:wireshark,代码行数:31,


示例7: NvVarHeaderFormater

static void NvVarHeaderFormater(tvbuff_t *tvb, gint offset, char *szText, int nMax){   g_snprintf ( szText, nMax, "Variable - Id = %d, Length = %d",      tvb_get_letohs(tvb, offset),      tvb_get_letohs(tvb, offset+4));}
开发者ID:P1sec,项目名称:LTE_monitor_c2xx,代码行数:6,


示例8: dissect_nv

static void dissect_nv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){   proto_item *ti;   proto_tree *nv_tree, *nv_header_tree, *nv_var_tree,*nv_varheader_tree;   gint offset = 0;   char szText[200];   int nMax = (int)sizeof(szText)-1;   gint i;   col_set_str(pinfo->cinfo, COL_PROTOCOL, "TC-NV");   col_clear(pinfo->cinfo, COL_INFO);   NvSummaryFormater(tvb, offset, szText, nMax);   col_append_str(pinfo->cinfo, COL_INFO, szText);   if (tree)   {      guint16 nv_count;      ti = proto_tree_add_item(tree, proto_nv, tvb, 0, -1, ENC_NA);      nv_tree = proto_item_add_subtree(ti, ett_nv);      proto_item_append_text(ti,": %s",szText);      ti = proto_tree_add_item(nv_tree, hf_nv_header, tvb, offset, NvParserHDR_Len, ENC_NA);      nv_header_tree = proto_item_add_subtree(ti, ett_nv_header);      ti= proto_tree_add_item(nv_header_tree, hf_nv_publisher, tvb, offset, (int)sizeof(guint8)*6, ENC_NA);      NvPublisherFormater(tvb, offset, szText, nMax);      proto_item_set_text(ti, "%s", szText);      offset+=((int)sizeof(guint8)*6);      proto_tree_add_item(nv_header_tree, hf_nv_count, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN);      nv_count = tvb_get_letohs(tvb, offset);      offset+=(int)sizeof(guint16);      proto_tree_add_item(nv_header_tree, hf_nv_cycleindex, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN);      offset = NvParserHDR_Len;      for ( i=0; i < nv_count; i++ )      {         guint16 var_length = tvb_get_letohs(tvb, offset+4);         ti = proto_tree_add_item(nv_tree, hf_nv_variable, tvb, offset, ETYPE_88A4_NV_DATA_HEADER_Len+var_length, ENC_NA);         NvVarHeaderFormater(tvb, offset, szText, nMax);         proto_item_set_text(ti, "%s", szText);         nv_var_tree = proto_item_add_subtree(ti, ett_nv_var);         ti = proto_tree_add_item(nv_var_tree, hf_nv_varheader, tvb, offset, ETYPE_88A4_NV_DATA_HEADER_Len, ENC_NA);         nv_varheader_tree = proto_item_add_subtree(ti, ett_nv_varheader);         proto_tree_add_item(nv_varheader_tree, hf_nv_id, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN);         offset+=(int)sizeof(guint16);         proto_tree_add_item(nv_varheader_tree, hf_nv_hash, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN);         offset+=(int)sizeof(guint16);         proto_tree_add_item(nv_varheader_tree, hf_nv_length, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN);         offset+=(int)sizeof(guint16);         proto_tree_add_item(nv_varheader_tree, hf_nv_quality, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN);         offset+=(int)sizeof(guint16);         proto_tree_add_item(nv_var_tree, hf_nv_data, tvb, offset, var_length, ENC_NA);         offset+=var_length;      }   }}
开发者ID:P1sec,项目名称:LTE_monitor_c2xx,代码行数:70,


示例9: dissect_groupd

static intdissect_groupd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data){	guint    length;	int      offset;	/* int      sub_length; */	gboolean little_endian;	proto_tree *tree;	proto_item *item;	guint16     msg_type;	length = tvb_length(tvb);#define length_groupd ( (4 * 3) + 2 + 2 + 4 + 4 + 8 + GROUPD_MAX_NAMELEN )	if (length < (length_groupd))		return 0;	/*	if (check_col(pinfo->cinfo, COL_PROTOCOL))		col_set_str(pinfo->cinfo, COL_PROTOCOL, "groupd");	*/	/*	if (check_col(pinfo->cinfo, COL_INFO))		col_clear(pinfo->cinfo, COL_INFO);	*/	if (check_col(pinfo->cinfo, COL_INFO))		col_append_sep_str(pinfo->cinfo, COL_INFO, " ", "groupd");	  	if (!parent_tree)		goto out;	/*  */	little_endian = TRUE;	offset = 0;	item = proto_tree_add_item(parent_tree, proto_groupd, tvb,  				   offset, -1, little_endian);	tree = proto_item_add_subtree(item, ett_groupd);	/* TODO: Version check */	offset += 0;	proto_tree_add_item(tree,			    hf_groupd_msg_version_major,			    tvb, offset, 4, little_endian);	offset += 4;	proto_tree_add_item(tree,			    hf_groupd_msg_version_minor,			    tvb, offset, 4, little_endian);		offset += 4;	proto_tree_add_item(tree,			    hf_groupd_msg_version_patch,			    tvb, offset, 4, little_endian);	offset += 4;	proto_tree_add_item(tree,			    hf_groupd_msg_type,			    tvb, offset, 2, little_endian);	msg_type = tvb_get_letohs(tvb, offset);		offset += 2;	proto_tree_add_item(tree,			    hf_groupd_msg_level,			    tvb, offset, 2, little_endian);	offset += 2;	proto_tree_add_item(tree,			    hf_groupd_msg_length,			    tvb, offset, 4, little_endian);		offset += 4;	{		proto_item* sub_item;		proto_tree* sub_tree;		sub_item = proto_tree_add_item(tree,					       hf_groupd_msg_global_id,					       tvb, offset, 4, little_endian);		sub_tree = proto_item_add_subtree(sub_item, ett_groupd_msg_global_id);		if (msg_type != GROUPD_MSG_GLOBAL_ID) {			proto_item_append_text(sub_item, " (may not be used)");		}		/* Dissect global_id		   global_id & 0x0000FFFF => to_nodeid		   ((global_id >> 16) & 0x0000FFFF) => counter */		proto_tree_add_item(sub_tree,				    hf_groupd_msg_global_id_to_nodeid,				    tvb, offset, 2, little_endian);		proto_tree_add_item(sub_tree,				    hf_groupd_msg_global_id_counter,				    tvb, offset + 2, 2, little_endian);//.........这里部分代码省略.........
开发者ID:masatake,项目名称:wireshark-plugin-rhcs,代码行数:101,


示例10: dissect_wsmp

static voiddissect_wsmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){    /* Set up structures needed to add the protocol subtree and manage it */    proto_item *ti, *wsmdata_item;    proto_tree *wsmp_tree, *wsmdata_tree;    tvbuff_t   *wsmdata_tvb;    guint16     wsmlength, offset;    guint32     psidLen, psid;    guint8      elemenId, elemenLen, msb, supLen;    /* Make entries in Protocol column and Info column on summary display */    col_set_str(pinfo->cinfo, COL_PROTOCOL, "WSMP");    col_set_str(pinfo->cinfo, COL_INFO, "WAVE Short Message Protocol IEEE P1609.3");    /* create display subtree for the protocol */    ti = proto_tree_add_item(tree, proto_wsmp, tvb, 0, -1, ENC_NA);    wsmp_tree = proto_item_add_subtree(ti, ett_wsmp);    offset = 0;    proto_tree_add_item(wsmp_tree,                        hf_wsmp_version, tvb, offset, 1, ENC_BIG_ENDIAN);    offset++;    psid    = tvb_get_guint8(tvb, offset);    psidLen = (guint32)wme_getpsidlen((guint8*)&psid);    if (psidLen == 2)        psid = tvb_get_ntohs(tvb, offset);    else if (psidLen == 3)    {        psid = tvb_get_ntohl(tvb, offset);        psid = psid & 0x00FFFF; /* three bytes */    }    else if (psidLen == 4)        psid = tvb_get_ntohl(tvb, offset);    proto_tree_add_item(wsmp_tree,                        hf_wsmp_psid, tvb, offset, psidLen, ENC_BIG_ENDIAN);    offset += psidLen;    elemenId = tvb_get_guint8(tvb, offset);    while ((elemenId != WSMP) && (elemenId != WSMP_S) && (elemenId != WSMP_I))    {        offset++;        if (elemenId == CHANNUM)        {            /* channel number */            elemenLen = tvb_get_guint8(tvb, offset);            offset++;            proto_tree_add_item(wsmp_tree,                                hf_wsmp_channel, tvb, offset, elemenLen, ENC_BIG_ENDIAN);            offset += elemenLen;        }        else if (elemenId == DATARATE)        {            /* Data rate  */            elemenLen = tvb_get_guint8(tvb, offset);            offset++;            proto_tree_add_item(wsmp_tree,                                hf_wsmp_rate, tvb, offset, elemenLen, ENC_BIG_ENDIAN);            offset += elemenLen;        }        else if (elemenId == TRANSMITPW)        {            /* Transmit power */            elemenLen = tvb_get_guint8(tvb, offset);            offset++;            proto_tree_add_item(wsmp_tree,                                hf_wsmp_txpower, tvb, offset, elemenLen, ENC_BIG_ENDIAN);            offset += elemenLen;        }        elemenId  = tvb_get_guint8(tvb, offset);    }    proto_tree_add_item(wsmp_tree,                        hf_wsmp_WAVEid, tvb, offset, 1, ENC_BIG_ENDIAN);    offset++;    wsmlength = tvb_get_letohs( tvb, offset);    proto_tree_add_item(wsmp_tree,                        hf_wsmp_wsmlength, tvb, offset, 2, ENC_BIG_ENDIAN);    offset += 2;    if (elemenId == WSMP_S)    {        msb    = 1;        supLen = 0;        while (msb)        {            msb = tvb_get_guint8(tvb, offset + supLen);            msb = msb & 0x80;            supLen++;        }        proto_tree_add_item(wsmp_tree,//.........这里部分代码省略.........
开发者ID:lubing521,项目名称:wireshark,代码行数:101,


示例11: dissect_interlink

static voiddissect_interlink(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){	int		offset = 0;	proto_tree	*il_tree = NULL;	proto_tree	*ilh_tree = NULL;	proto_tree	*ilb_tree = NULL;	guint8		ilb_type;	guint8		ilb_version;	guint16		type_version = 0;	dissector_handle_t	handle;	tvbuff_t	*next_tvb;	col_set_str(pinfo->cinfo, COL_PROTOCOL, "INTERLINK");	col_clear(pinfo->cinfo, COL_INFO);	if (tree) {		proto_item	*il_item;		il_item = proto_tree_add_item(tree, proto_interlink,								tvb, 0, 16, FALSE);		if (il_item)			il_tree = proto_item_add_subtree(il_item, ett_interlink);	}	if (il_tree) {		proto_item	*ilh_item = NULL;		ilh_item = proto_tree_add_text(il_tree, tvb, 0, 12, "Interlink Header");		if (ilh_item)			ilh_tree = proto_item_add_subtree(ilh_item, ett_interlink_header);	}	if (ilh_tree) {		proto_tree_add_item(ilh_tree, hf_interlink_id, tvb, offset, 4, FALSE);		offset += 4;		proto_tree_add_item(ilh_tree, hf_interlink_version, tvb, offset, 2, TRUE);		offset += 2;		proto_tree_add_item(ilh_tree, hf_interlink_cmd, tvb, offset, 2, TRUE);		offset += 2;		proto_tree_add_item(ilh_tree, hf_interlink_seq, tvb, offset, 2, TRUE);		offset += 2;	} else {		offset += 10;	}	if (ilh_tree) {		proto_item	*flags_item;		proto_tree	*flags_tree = NULL;		flags_item = proto_tree_add_item(ilh_tree, hf_interlink_flags,			tvb, offset, 2, TRUE);		if (flags_item) {			flags_tree = proto_item_add_subtree(flags_item, ett_interlink_flags);		}		if (flags_tree) {			guint16		il_flags;			il_flags = tvb_get_letohs(tvb, offset);			proto_tree_add_boolean(flags_tree, hf_interlink_flags_req_ack, tvb, offset, 2, il_flags);			proto_tree_add_boolean(flags_tree, hf_interlink_flags_inc_ack_port, tvb, offset, 2, il_flags);		}	}	offset += 2;	if (tree) {		proto_item	*ilb_item;		ilb_item = proto_tree_add_text(il_tree, tvb, offset, 4, "Block Header");		if (ilb_item)			ilb_tree = proto_item_add_subtree(ilb_item, ett_interlink_block);	}	ilb_type = tvb_get_guint8(tvb, offset);	ilb_version = tvb_get_guint8(tvb, offset + 1);	type_version = ilb_type << 8 | ilb_version;	col_append_fstr(pinfo->cinfo, COL_INFO, "Type: 0x%02x, Version: %d",		ilb_type, ilb_version);	if (ilb_tree) {		proto_tree_add_item(ilb_tree, hf_interlink_block_type, tvb, offset, 1, FALSE);		offset += 1;		proto_tree_add_item(ilb_tree, hf_interlink_block_version, tvb, offset, 1, FALSE);		offset += 1;		proto_tree_add_item(ilb_tree, hf_interlink_block_length, tvb, offset, 2, TRUE);		offset += 2;	} else {		offset += 4;	}	/* Generate a new tvb for the rest. */	next_tvb = tvb_new_subset_remaining(tvb, offset);	/* Probably a sub-dissector exists for this type/version combination. */	handle = dissector_get_port_handle(subdissector_table, type_version);	/* Without a proper sub-dissector, we use "data". */	if (handle == NULL) handle = data_handle;	/* Call the sub-dissector. */	call_dissector(handle, next_tvb, pinfo, tree);}
开发者ID:AkhilaAG,项目名称:gluster-wireshark-1.4,代码行数:98,


示例12: col_clear

    gchar *curr_str;    /* these are temporary intermediate values, used in the individual cases below */    guint32 t_lat, t_lon, t_alt, t_alt_gnd;    guint32 t_herr, t_verr, t_terr;    guint32 t_appspecific_num;    /* initialize the timestamp value(s) */    gps_timestamp.secs = gps_timestamp.nsecs = already_processed_fractime = 0;    /* 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_GPS Capture v%u, Length %u", version, length);    /* Create the basic dissection tree*/    gps_line = proto_tree_add_protocol_format(tree, proto_ppi_gps, tvb, 0, length, "GPS:");    ppi_gps_tree = proto_item_add_subtree(gps_line, ett_ppi_gps);    version_item = proto_tree_add_uint(ppi_gps_tree, hf_ppi_gps_version, tvb, offset, 1, version);    proto_tree_add_item(ppi_gps_tree, hf_ppi_gps_pad, tvb, offset + 1, 1, ENC_LITTLE_ENDIAN);    length_item = proto_tree_add_uint(ppi_gps_tree, hf_ppi_gps_length, tvb, offset + 2, 2, length);    /* We support v1 and v2 of GPS tags (identical) */    if (! (version == 1 || version == 2) ) {        expert_add_info_format(pinfo, version_item, &ei_ppi_gps_version, "Invalid version (got %d,  expected 1 or 2)", version);
开发者ID:alagoutte,项目名称:wireshark,代码行数:31,


示例13: dissect_netmon_802_11

static intdissect_netmon_802_11(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data){  struct ieee_802_11_phdr *phdr = (struct ieee_802_11_phdr *)data;  proto_tree *wlan_tree = NULL, *opmode_tree;  proto_item *ti;  tvbuff_t   *next_tvb;  int         offset;  guint8      version;  guint16     length;  guint32     phy_type;  guint32     flags;  guint32     channel;  gint        calc_channel;  gint32      rssi;  guint8      rate;  col_set_str(pinfo->cinfo, COL_PROTOCOL, "WLAN");  col_clear(pinfo->cinfo, COL_INFO);  offset = 0;  version = tvb_get_guint8(tvb, offset);  length = tvb_get_letohs(tvb, offset+1);  col_add_fstr(pinfo->cinfo, COL_INFO, "NetMon WLAN Capture v%u, Length %u",               version, length);  if (version != 2) {    /* XXX - complain */    goto skip;  }  if (length < MIN_HEADER_LEN) {    /* XXX - complain */    goto skip;  }  /* Dissect the packet */  ti = proto_tree_add_item(tree, proto_netmon_802_11, tvb, 0, length,                           ENC_NA);  wlan_tree = proto_item_add_subtree(ti, ett_netmon_802_11);  proto_tree_add_item(wlan_tree, hf_netmon_802_11_version, tvb, offset, 1,                      ENC_LITTLE_ENDIAN);  offset += 1;  proto_tree_add_item(wlan_tree, hf_netmon_802_11_length, tvb, offset, 2,                      ENC_LITTLE_ENDIAN);  offset += 2;  ti = proto_tree_add_item(wlan_tree, hf_netmon_802_11_op_mode, tvb, offset,                      4, ENC_LITTLE_ENDIAN);  opmode_tree = proto_item_add_subtree(ti, ett_netmon_802_11_op_mode);  proto_tree_add_item(opmode_tree, hf_netmon_802_11_op_mode_sta, tvb, offset,                      4, ENC_LITTLE_ENDIAN);  proto_tree_add_item(opmode_tree, hf_netmon_802_11_op_mode_ap, tvb, offset,                      4, ENC_LITTLE_ENDIAN);  proto_tree_add_item(opmode_tree, hf_netmon_802_11_op_mode_sta_ext, tvb,                      offset, 4, ENC_LITTLE_ENDIAN);  proto_tree_add_item(opmode_tree, hf_netmon_802_11_op_mode_mon, tvb, offset,                      4, ENC_LITTLE_ENDIAN);  offset += 4;  flags = tvb_get_letohl(tvb, offset);  offset += 4;  if (flags != 0xffffffff) {    phy_type = tvb_get_letohl(tvb, offset);    switch (phy_type) {    case PHY_TYPE_11B:        phdr->phy = PHDR_802_11_PHY_11B;        break;    case PHY_TYPE_11A:        phdr->phy = PHDR_802_11_PHY_11A;        phdr->phy_info.info_11a.presence_flags = 0;        break;    case PHY_TYPE_11G:        phdr->phy = PHDR_802_11_PHY_11G;        phdr->phy_info.info_11g.presence_flags = 0;        break;    case PHY_TYPE_11N:        phdr->phy = PHDR_802_11_PHY_11N;        phdr->phy_info.info_11n.presence_flags = 0;        break;    default:        phdr->phy = PHDR_802_11_PHY_UNKNOWN;        break;    }    proto_tree_add_item(wlan_tree, hf_netmon_802_11_phy_type, tvb, offset, 4,                        ENC_LITTLE_ENDIAN);    offset += 4;    channel = tvb_get_letohl(tvb, offset);    if (channel < 1000) {      if (channel == 0) {        proto_tree_add_uint_format_value(wlan_tree, hf_netmon_802_11_channel,                                         tvb, offset, 4, channel,                                         "Unknown");      } else {        guint frequency;        phdr->presence_flags |= PHDR_802_11_HAS_CHANNEL;        phdr->channel = channel;        proto_tree_add_uint(wlan_tree, hf_netmon_802_11_channel,//.........这里部分代码省略.........
开发者ID:ajitlakhwani,项目名称:wireshark,代码行数:101,


示例14: dissect_netmon_802_11

static intdissect_netmon_802_11(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data){  struct ieee_802_11_phdr *phdr = (struct ieee_802_11_phdr *)data;  proto_tree *wlan_tree = NULL, *opmode_tree;  proto_item *ti;  tvbuff_t   *next_tvb;  int         offset;  guint8      version;  guint16     length;  guint32     phy_type;  guint32     flags;  guint32     channel;  gint        calc_channel;  gint32      rssi;  guint8      rate;  col_set_str(pinfo->cinfo, COL_PROTOCOL, "WLAN");  col_clear(pinfo->cinfo, COL_INFO);  offset = 0;  version = tvb_get_guint8(tvb, offset);  length = tvb_get_letohs(tvb, offset+1);  col_add_fstr(pinfo->cinfo, COL_INFO, "NetMon WLAN Capture v%u, Length %u",               version, length);  if (version != 2) {    /* XXX - complain */    goto skip;  }  if (length < MIN_HEADER_LEN) {    /* XXX - complain */    goto skip;  }  /* Dissect the packet */  ti = proto_tree_add_item(tree, proto_netmon_802_11, tvb, 0, length,                           ENC_NA);  wlan_tree = proto_item_add_subtree(ti, ett_netmon_802_11);  /*   * XXX - is this the NDIS_OBJECT_HEADER structure:   *   *    https://msdn.microsoft.com/en-us/library/windows/hardware/ff566588(v=vs.85).aspx   *   * at the beginning of a DOT11_EXTSTA_RECV_CONTEXT structure:   *   *    https://msdn.microsoft.com/en-us/library/windows/hardware/ff548626(v=vs.85).aspx   *   * If so, the byte at an offset of 0 would be the appropriate type for the   * structure following it, i.e. NDIS_OBJECT_TYPE_DEFAULT.   */  proto_tree_add_item(wlan_tree, hf_netmon_802_11_version, tvb, offset, 1,                      ENC_LITTLE_ENDIAN);  offset += 1;  proto_tree_add_item(wlan_tree, hf_netmon_802_11_length, tvb, offset, 2,                      ENC_LITTLE_ENDIAN);  offset += 2;  /*   * This isn't in the DOT11_EXTSTA_RECV_CONTEXT structure.   */  ti = proto_tree_add_item(wlan_tree, hf_netmon_802_11_op_mode, tvb, offset,                      4, ENC_LITTLE_ENDIAN);  opmode_tree = proto_item_add_subtree(ti, ett_netmon_802_11_op_mode);  proto_tree_add_item(opmode_tree, hf_netmon_802_11_op_mode_sta, tvb, offset,                      4, ENC_LITTLE_ENDIAN);  proto_tree_add_item(opmode_tree, hf_netmon_802_11_op_mode_ap, tvb, offset,                      4, ENC_LITTLE_ENDIAN);  proto_tree_add_item(opmode_tree, hf_netmon_802_11_op_mode_sta_ext, tvb,                      offset, 4, ENC_LITTLE_ENDIAN);  proto_tree_add_item(opmode_tree, hf_netmon_802_11_op_mode_mon, tvb, offset,                      4, ENC_LITTLE_ENDIAN);  offset += 4;  /*   * uReceiveFlags?   */  flags = tvb_get_letohl(tvb, offset);  offset += 4;  if (flags != 0xffffffff) {    /*     * uPhyId?     */    phy_type = tvb_get_letohl(tvb, offset);    switch (phy_type) {    case PHY_TYPE_UNKNOWN:        phdr->phy = PHDR_802_11_PHY_UNKNOWN;        break;    case PHY_TYPE_FHSS:        phdr->phy = PHDR_802_11_PHY_11_FHSS;        phdr->phy_info.info_11_fhss.presence_flags = 0;        break;    case PHY_TYPE_IR_BASEBAND:        phdr->phy = PHDR_802_11_PHY_11_IR;        break;    case PHY_TYPE_DSSS://.........这里部分代码省略.........
开发者ID:Nicholas1126,项目名称:wireshark-ex,代码行数:101,


示例15: dissect_CSF_SDU_heur

/* possibly dissect a CSF_SDU related PN-RT packet */static gbooleandissect_CSF_SDU_heur(tvbuff_t *tvb,	packet_info *pinfo, proto_tree *tree){	guint16 u16FrameID;	guint16 u16SFCRC16;	guint8  u8SFPosition;	guint8  u8SFDataLength = 255;	guint8  u8SFCycleCounter;	guint8  u8SFDataStatus;	int offset = 0;	guint32 u32SubStart;    proto_item *sub_item;    proto_tree *sub_tree;    proto_item *item;	guint16 crc;    /* the sub tvb will NOT contain the frame_id here! */    u16FrameID = GPOINTER_TO_UINT(pinfo->private_data);	/* possible FrameID ranges for DFP */	if ((u16FrameID >= 0x0500 && u16FrameID < 0x05ff) ||	    (u16FrameID >= 0x0600 && u16FrameID < 0x07ff) ||	    (u16FrameID >= 0x4800 && u16FrameID < 0x4fff) ||	    (u16FrameID >= 0x5800 && u16FrameID < 0x5fff) ||	    (u16FrameID >= 0x6800 && u16FrameID < 0x6fff) ||	    (u16FrameID >= 0x7800 && u16FrameID < 0x7fff)) {		/* can't check this CRC, as the checked data bytes are not available */		u16SFCRC16 = tvb_get_letohs(tvb, offset);		proto_tree_add_uint(tree, hf_pn_rt_sf_crc16, tvb, offset, 2, u16SFCRC16);		offset += 2;		while(1) {			sub_item = proto_tree_add_item(tree, hf_pn_rt_sf, tvb, offset, 0, FALSE);			sub_tree = proto_item_add_subtree(sub_item, ett_pn_rt_sf);			u32SubStart = offset;			u8SFPosition = tvb_get_guint8(tvb, offset);			proto_tree_add_uint(sub_tree, hf_pn_rt_sf_position_control, tvb, offset, 1, u8SFPosition);			proto_tree_add_uint(sub_tree, hf_pn_rt_sf_position, tvb, offset, 1, u8SFPosition);			offset += 1;			u8SFDataLength = tvb_get_guint8(tvb, offset);			proto_tree_add_uint(sub_tree, hf_pn_rt_sf_data_length, tvb, offset, 1, u8SFDataLength);			offset += 1;			if(u8SFDataLength == 0) {				proto_item_append_text(sub_item, ": Pos:%u, Length:%u", u8SFPosition, u8SFDataLength);				proto_item_set_len(sub_item, offset - u32SubStart);				break;			}			u8SFCycleCounter = tvb_get_guint8(tvb, offset);			proto_tree_add_uint(sub_tree, hf_pn_rt_sf_cycle_counter, tvb, offset, 1, u8SFCycleCounter);			offset += 1;			u8SFDataStatus = tvb_get_guint8(tvb, offset);			dissect_DataStatus(tvb, offset, sub_tree, u8SFDataStatus);			offset += 1;			offset = dissect_pn_user_data(tvb, offset, pinfo, sub_tree, u8SFDataLength, "DataItem");			u16SFCRC16 = tvb_get_letohs(tvb, offset);			item = proto_tree_add_uint(sub_tree, hf_pn_rt_sf_crc16, tvb, offset, 2, u16SFCRC16);			if(u8SFPosition & 0x80) {				crc = crc16_plain_tvb_offset(tvb, u32SubStart, offset-u32SubStart);				if(crc != u16SFCRC16) {					proto_item_append_text(item, " [Preliminary check: incorrect, should be: %u]", crc);					expert_add_info_format(pinfo, item, PI_CHECKSUM, PI_ERROR, "Bad checksum");				} else {					proto_item_append_text(item, " [Preliminary check: Correct]");				}			} else {				proto_item_append_text(item, " [No preliminary check, Control bit not set]");			}			offset += 2;			proto_item_append_text(sub_item, ": Pos:%u, Length:%u, Cycle:%u, Status: 0x%02x (%s,%s,%s,%s)",				u8SFPosition, u8SFDataLength, u8SFCycleCounter, u8SFDataStatus,				(u8SFDataStatus & 0x04) ? "Valid" : "Invalid",				(u8SFDataStatus & 0x01) ? "Primary" : "Backup",				(u8SFDataStatus & 0x20) ? "Ok" : "Problem",				(u8SFDataStatus & 0x10) ? "Run" : "Stop");			proto_item_set_len(sub_item, offset - u32SubStart);		}        return TRUE;    }    return FALSE;}
开发者ID:AkhilaAG,项目名称:gluster-wireshark-1.4,代码行数:96,


示例16: dissect_mtp3_routing_label

static voiddissect_mtp3_routing_label(tvbuff_t *tvb, packet_info *pinfo, proto_tree *mtp3_tree,    mtp3_addr_pc_t *mtp3_addr_opc, mtp3_addr_pc_t *mtp3_addr_dpc){  guint32 label, dpc, opc;  proto_item *label_dpc_item, *label_opc_item;  proto_item *hidden_item;  proto_tree *label_tree;  proto_tree *pc_subtree;  int hf_dpc_string;  int hf_opc_string;  switch (mtp3_standard) {  case ITU_STANDARD:    label_tree = proto_tree_add_subtree(mtp3_tree, tvb, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, ett_mtp3_label, NULL, "Routing label");    label = tvb_get_letohl(tvb, ROUTING_LABEL_OFFSET);    opc = (label & ITU_OPC_MASK) >> 14;    dpc =  label & ITU_DPC_MASK;    hidden_item = proto_tree_add_uint(label_tree, hf_mtp3_itu_pc, tvb, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, opc);    PROTO_ITEM_SET_HIDDEN(hidden_item);    hidden_item = proto_tree_add_uint(label_tree, hf_mtp3_itu_pc, tvb, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, dpc);    PROTO_ITEM_SET_HIDDEN(hidden_item);    label_dpc_item = proto_tree_add_uint(label_tree, hf_mtp3_itu_dpc, tvb, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, label);    if (mtp3_pc_structured())      proto_item_append_text(label_dpc_item, " (%s)", mtp3_pc_to_str(dpc));    if(mtp3_addr_dpc->ni == MTP3_NI_INT0) {      pc_subtree = proto_item_add_subtree(label_dpc_item, ett_mtp3_label_dpc);      analyze_q708_ispc(tvb, pc_subtree, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, dpc);    }    label_opc_item = proto_tree_add_uint(label_tree, hf_mtp3_itu_opc, tvb, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, label);    if (mtp3_pc_structured())      proto_item_append_text(label_opc_item, " (%s)", mtp3_pc_to_str(opc));    if(mtp3_addr_opc->ni == MTP3_NI_INT0) {      pc_subtree = proto_item_add_subtree(label_opc_item, ett_mtp3_label_opc);      analyze_q708_ispc(tvb, pc_subtree, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, opc);    }    proto_tree_add_uint(label_tree, hf_mtp3_itu_sls, tvb, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, label);    break;  case ANSI_STANDARD:  case CHINESE_ITU_STANDARD:    if (mtp3_standard == ANSI_STANDARD)    {      hf_dpc_string = hf_mtp3_ansi_dpc;      hf_opc_string = hf_mtp3_ansi_opc;    } else /* CHINESE_ITU_STANDARD */ {      hf_dpc_string = hf_mtp3_chinese_dpc;      hf_opc_string = hf_mtp3_chinese_opc;    }    /* Create the Routing Label Tree */    label_tree = proto_tree_add_subtree(mtp3_tree, tvb, ROUTING_LABEL_OFFSET, ANSI_ROUTING_LABEL_LENGTH, ett_mtp3_label, NULL, "Routing label");    /* create and fill the DPC tree */    dissect_mtp3_3byte_pc(tvb, ANSI_DPC_OFFSET, label_tree, ett_mtp3_label_dpc, hf_dpc_string, hf_mtp3_dpc_network,			  hf_mtp3_dpc_cluster, hf_mtp3_dpc_member, hf_mtp3_24bit_dpc, hf_mtp3_24bit_pc);    /* Store dpc for mtp3_addr below */    dpc = tvb_get_letoh24(tvb, ANSI_DPC_OFFSET);    /* create and fill the OPC tree */    dissect_mtp3_3byte_pc(tvb, ANSI_OPC_OFFSET, label_tree, ett_mtp3_label_opc, hf_opc_string, hf_mtp3_opc_network,			  hf_mtp3_opc_cluster, hf_mtp3_opc_member, hf_mtp3_24bit_opc, hf_mtp3_24bit_pc);    /* Store opc for mtp3_addr below */    opc = tvb_get_letoh24(tvb, ANSI_OPC_OFFSET);    /* SLS */    if (mtp3_standard == ANSI_STANDARD) {      if (mtp3_use_ansi_5_bit_sls)	proto_tree_add_item(label_tree, hf_mtp3_ansi_5_bit_sls, tvb, ANSI_SLS_OFFSET, SLS_LENGTH, ENC_NA);      else	proto_tree_add_item(label_tree, hf_mtp3_ansi_8_bit_sls, tvb, ANSI_SLS_OFFSET, SLS_LENGTH, ENC_NA);    } else /* CHINESE_ITU_STANDARD */ {      proto_tree_add_item(label_tree, hf_mtp3_chinese_itu_sls, tvb, ANSI_SLS_OFFSET, SLS_LENGTH, ENC_NA);    }    break;  case JAPAN_STANDARD:    label_tree = proto_tree_add_subtree(mtp3_tree, tvb, ROUTING_LABEL_OFFSET, JAPAN_ROUTING_LABEL_LENGTH, ett_mtp3_label, NULL, "Routing label");    label_dpc_item = proto_tree_add_item(label_tree, hf_mtp3_japan_dpc, tvb, ROUTING_LABEL_OFFSET, JAPAN_PC_LENGTH, ENC_LITTLE_ENDIAN);    dpc = tvb_get_letohs(tvb, ROUTING_LABEL_OFFSET);    if (mtp3_pc_structured()) {      proto_item_append_text(label_dpc_item, " (%s)", mtp3_pc_to_str(dpc));    }    label_opc_item = proto_tree_add_item(label_tree, hf_mtp3_japan_opc, tvb, JAPAN_OPC_OFFSET, JAPAN_PC_LENGTH, ENC_LITTLE_ENDIAN);    opc = tvb_get_letohs(tvb, JAPAN_OPC_OFFSET);    if (mtp3_pc_structured()) {      proto_item_append_text(label_opc_item, " (%s)", mtp3_pc_to_str(opc));    }//.........这里部分代码省略.........
开发者ID:danielwhite84,项目名称:wireshark,代码行数:101,


示例17: skip_item

static const value_string meta_direction_vals[] = {    { 0,    "Up" },    { 1,    "Down" },    { 0,    NULL }};static guint16 skip_item(proto_tree *meta_tree, tvbuff_t *tvb, packet_info *pinfo _U_, guint16 offs){    guint16     id;    guint8      type;    guint16     len, aligned_len, total_len;    proto_tree *item_tree;    proto_item *subti;    id          = tvb_get_letohs(tvb, offs); offs += 2;    type        = tvb_get_guint8(tvb, offs); offs++;    len         = tvb_get_guint8(tvb, offs); offs++;    aligned_len = (len + 3) & 0xfffc;    total_len   = aligned_len + 4; /* 4: id, type, len fields */    subti = proto_tree_add_item(meta_tree, hf_meta_item, tvb, offs - 4,        aligned_len + 4, ENC_NA);    item_tree = proto_item_add_subtree(subti, ett_meta_item);    proto_tree_add_uint(item_tree, hf_meta_item_id, tvb, offs - 4, 2, id);    proto_tree_add_uint(item_tree, hf_meta_item_type, tvb, offs - 2, 1, type);    proto_tree_add_uint(item_tree, hf_meta_item_len,        tvb, offs - 1, 1, len);    if (len > 0)        proto_tree_add_item(item_tree, hf_meta_item_data,            tvb, offs, len, ENC_NA);
开发者ID:CharaD7,项目名称:wireshark,代码行数:30,


示例18: dissect_ac_if_hdr_body

   body's length) */static gintdissect_ac_if_hdr_body(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_,        proto_tree *tree, usb_conv_info_t *usb_conv_info){    gint     offset_start;    guint16  bcdADC;    guint8   ver_major;    double   ver;    guint8   if_in_collection, i;    audio_conv_info_t *audio_conv_info;    offset_start = offset;    bcdADC = tvb_get_letohs(tvb, offset);    ver_major = USB_AUDIO_BCD44_TO_DEC(bcdADC>>8);    ver = ver_major + USB_AUDIO_BCD44_TO_DEC(bcdADC&0xFF) / 100.0;    proto_tree_add_double_format_value(tree, hf_ac_if_hdr_ver,            tvb, offset, 2, ver, "%2.2f", ver);    audio_conv_info = (audio_conv_info_t *)usb_conv_info->class_data;    if(!audio_conv_info) {        audio_conv_info = wmem_new(wmem_file_scope(), audio_conv_info_t);        usb_conv_info->class_data = audio_conv_info;        /* XXX - set reasonable default values for all components           that are not filled in by this function */    }    audio_conv_info->ver_major = ver_major;    offset += 2;
开发者ID:ARK1988,项目名称:wireshark,代码行数:30,


示例19: dissect_adb

//.........这里部分代码省略.........        if (service_data->close_local_in_frame < max_in_frame) {            sub_item = proto_tree_add_uint(main_tree, hf_close_local_in_frame, tvb, offset, 0, service_data->close_local_in_frame);            PROTO_ITEM_SET_GENERATED(sub_item);        }        if (service_data->close_remote_in_frame < max_in_frame) {            sub_item = proto_tree_add_uint(main_tree, hf_close_remote_in_frame, tvb, offset, 0, service_data->close_remote_in_frame);            PROTO_ITEM_SET_GENERATED(sub_item);        }    }    if (is_command) {        proto_tree_add_item(main_tree, hf_command, tvb, offset, 4, ENC_LITTLE_ENDIAN);        command = tvb_get_letohl(tvb, offset);        offset += 4;        col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(command, command_vals, "Unknown command"));        arg0_item = proto_tree_add_item(main_tree, hf_argument_0, tvb, offset, 4, ENC_LITTLE_ENDIAN);        arg0_tree = proto_item_add_subtree(arg0_item, ett_adb_arg0);        arg0 = tvb_get_letohl(tvb, offset);        offset += 4;        arg1_item = proto_tree_add_item(main_tree, hf_argument_1, tvb, offset, 4, ENC_LITTLE_ENDIAN);        arg1_tree = proto_item_add_subtree(arg1_item, ett_adb_arg1);        arg1 = tvb_get_letohl(tvb, offset);        offset += 4;        switch (command) {        case A_CNXN:            proto_tree_add_item(arg0_tree, hf_version, tvb, offset - 8, 4, ENC_LITTLE_ENDIAN);            proto_tree_add_item(arg1_tree, hf_max_data, tvb, offset - 4, 4, ENC_LITTLE_ENDIAN);            col_append_fstr(pinfo->cinfo, COL_INFO, "(version=%u.%u.%u, max_data=%u)", tvb_get_guint8(tvb, offset - 5), tvb_get_guint8(tvb, offset - 6), tvb_get_letohs(tvb, offset - 7), tvb_get_letohl(tvb, offset - 4));            break;        case A_AUTH:            proto_tree_add_item(arg0_tree, hf_auth_type, tvb, offset - 8, 4, ENC_LITTLE_ENDIAN);            proto_tree_add_item(arg1_tree, hf_zero, tvb, offset - 4, 4, ENC_LITTLE_ENDIAN);            col_append_fstr(pinfo->cinfo, COL_INFO, "(type=%s, 0)", val_to_str_const(tvb_get_letohl(tvb, offset - 8), auth_type_vals, "Unknown"));            break;        case A_OPEN:            proto_tree_add_item(arg0_tree, hf_local_id, tvb, offset - 8, 4, ENC_LITTLE_ENDIAN);            proto_tree_add_item(arg1_tree, hf_zero, tvb, offset - 4, 4, ENC_LITTLE_ENDIAN);            col_append_fstr(pinfo->cinfo, COL_INFO, "(local=%u, 0)", tvb_get_letohl(tvb, offset - 8));            break;        case A_WRTE:            proto_tree_add_item(arg0_tree, hf_zero, tvb, offset - 8, 4, ENC_LITTLE_ENDIAN);            proto_tree_add_item(arg1_tree, hf_remote_id, tvb, offset - 4, 4, ENC_LITTLE_ENDIAN);            col_append_fstr(pinfo->cinfo, COL_INFO, "(0, remote=%u)", tvb_get_letohl(tvb, offset - 4));            break;        case A_CLSE:        case A_OKAY:            proto_tree_add_item(arg0_tree, hf_local_id, tvb, offset - 8, 4, ENC_LITTLE_ENDIAN);            proto_tree_add_item(arg1_tree, hf_remote_id, tvb, offset - 4, 4, ENC_LITTLE_ENDIAN);            col_append_fstr(pinfo->cinfo, COL_INFO, "(local=%u, remote=%u)", tvb_get_letohl(tvb, offset - 8), tvb_get_letohl(tvb, offset - 4));            break;        case A_SYNC:            proto_tree_add_item(arg0_tree, hf_online, tvb, offset - 8, 4, ENC_LITTLE_ENDIAN);            proto_tree_add_item(arg1_tree, hf_sequence, tvb, offset - 4, 4, ENC_LITTLE_ENDIAN);            col_append_fstr(pinfo->cinfo, COL_INFO, "(online=%s, sequence=%u)", tvb_get_letohl(tvb, offset - 8) ? "Yes": "No", tvb_get_letohl(tvb, offset - 4));            break;
开发者ID:linshimiao,项目名称:wireshark,代码行数:67,


示例20: proto_tree_add_item

		 proto_tree_add_item(tree, hf_id, tvb, offset, length, encoding);		 offset += length;		 /* XXX: may be padding ? */	 }	 return offset;}static gint dissect_counted_address(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, proto_tree *tree){	 guint16 length;	 length = tvb_get_letohs(tvb, offset);	 proto_tree_add_item(tree, hf_tnef_value_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);	 offset += 2;	 proto_tree_add_item(tree, hf_tnef_attribute_display_name, tvb, offset, length, ENC_ASCII|ENC_NA);	 offset += length;	 length = tvb_get_letohs(tvb, offset);	 proto_tree_add_item(tree, hf_tnef_value_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);	 offset += 2;	 proto_tree_add_item(tree, hf_tnef_attribute_email_address, tvb, offset, length, ENC_ASCII|ENC_NA);	 offset += length;	 return offset;}
开发者ID:dot-Sean,项目名称:wireshark-http2,代码行数:30,


示例21: get_tali_pdu_len

static int hf_tali_sync_indicator = -1;static int hf_tali_opcode_indicator = -1;static int hf_tali_length_indicator = -1;static dissector_handle_t data_handle;/* Desegment TALI messages */static gboolean tali_desegment = TRUE;/* Code to actually dissect the packets */static guintget_tali_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset){  guint16 length;  length = tvb_get_letohs(tvb, offset + TALI_SYNC_LENGTH + TALI_OPCODE_LENGTH);  return length+TALI_HEADER_LENGTH;}static voiddissect_tali_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){  char opcode[TALI_OPCODE_LENGTH+1]; /* TALI opcode */  guint16 length; /* TALI length */  tvbuff_t *payload_tvb = NULL;  /* Set up structures needed to add the protocol subtree and manage it */  proto_item *tali_item = NULL;  proto_tree *tali_tree = NULL;  tvb_memcpy(tvb, (guint8*)opcode, TALI_SYNC_LENGTH, TALI_OPCODE_LENGTH);
开发者ID:AndresVelasco,项目名称:wireshark,代码行数:31,


示例22: dissect_nstrace

static voiddissect_nstrace(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){	proto_tree     *ns_tree = NULL, *flagtree = NULL;	proto_item     *ti = NULL, *flagitem = NULL;	struct nstr_phdr *pnstr = &(pinfo->pseudo_header->nstr);	tvbuff_t       *next_tvb_eth_client;	guint8		offset;	guint		i, bpos;	wmem_strbuf_t  *flags_strbuf = wmem_strbuf_new_label(wmem_packet_scope());	static const gchar *flags[] = {"FP", "FR", "DFD", "SRSS", "RSSH"};	gboolean 	first_flag = TRUE;	guint8		flagoffset, flagval;	guint8		src_vmname_len = 0, dst_vmname_len = 0;	guint8		variable_ns_len = 0;	guint 		flagval32;	wmem_strbuf_append(flags_strbuf, "None");	if (pnstr->rec_type == NSPR_HEADER_VERSION205)		{		src_vmname_len = tvb_get_guint8(tvb,pnstr->src_vmname_len_offset);		dst_vmname_len = tvb_get_guint8(tvb,pnstr->dst_vmname_len_offset);		variable_ns_len = src_vmname_len + dst_vmname_len;		pnstr->eth_offset += variable_ns_len;		}	ti = proto_tree_add_protocol_format(tree, proto_nstrace, tvb, 0, pnstr->eth_offset, "NetScaler Packet Trace");	ns_tree = proto_item_add_subtree(ti, ett_ns);	proto_tree_add_item(ns_tree, hf_ns_dir, tvb, pnstr->dir_offset, pnstr->dir_len, ENC_LITTLE_ENDIAN);	proto_tree_add_item(ns_tree, hf_ns_nicno, tvb, pnstr->nicno_offset, pnstr->nicno_len, ENC_LITTLE_ENDIAN);	switch (pnstr->rec_type)	{	case NSPR_HEADER_VERSION206:		flagoffset = pnstr->ns_activity_offset;		flagval32 = tvb_get_letohl(tvb, flagoffset);		flagitem = proto_tree_add_uint_format(ns_tree, hf_ns_activity, tvb, flagoffset, 4, flagval32,						"Activity Flags: 0x%04x", flagval32);		flagtree = proto_item_add_subtree(flagitem, ett_ns_activity_flags);		proto_tree_add_item(flagtree, hf_ns_activity_perf_collection, tvb, flagoffset, 4, ENC_LITTLE_ENDIAN);		proto_tree_add_item(flagtree, hf_ns_activity_pcb_zombie, tvb, flagoffset, 4, ENC_LITTLE_ENDIAN);		proto_tree_add_item(flagtree, hf_ns_activity_natpcb_zombie, tvb, flagoffset, 4, ENC_LITTLE_ENDIAN);		proto_tree_add_item(flagtree, hf_ns_activity_lbstats_sync, tvb, flagoffset, 4, ENC_LITTLE_ENDIAN);		proto_tree_add_item(flagtree, hf_ns_activity_stats_req, tvb, flagoffset, 4, ENC_LITTLE_ENDIAN);	case NSPR_HEADER_VERSION205:		if(src_vmname_len){			proto_tree_add_item(ns_tree,hf_ns_src_vm,tvb,pnstr->data_offset,src_vmname_len,ENC_LITTLE_ENDIAN);			}		if(dst_vmname_len){			proto_tree_add_item(ns_tree,hf_ns_dst_vm,tvb,pnstr->data_offset+src_vmname_len,dst_vmname_len,ENC_LITTLE_ENDIAN);			}	case NSPR_HEADER_VERSION204:		flagoffset = pnstr->clflags_offset;		flagval = tvb_get_guint8(tvb, flagoffset);		for (i = 0; i < 5; i++) {			bpos = 1 << i;			if (flagval & bpos) {				if (first_flag) {					wmem_strbuf_truncate(flags_strbuf, 0);				}				wmem_strbuf_append_printf(flags_strbuf, "%s%s", first_flag ? "" : ", ", flags[i]);				first_flag = FALSE;			}		}		proto_tree_add_item(ns_tree, hf_ns_snode, tvb, pnstr->srcnodeid_offset, 2, ENC_LITTLE_ENDIAN);		proto_tree_add_item(ns_tree, hf_ns_dnode, tvb, pnstr->destnodeid_offset, 2, ENC_LITTLE_ENDIAN);		flagitem = proto_tree_add_uint_format_value(ns_tree, hf_ns_clflags, tvb, flagoffset, 1, flagval,						"0x%02x (%s)", flagval, wmem_strbuf_get_str(flags_strbuf));		flagtree = proto_item_add_subtree(flagitem, ett_ns_flags);		proto_tree_add_boolean(flagtree, hf_ns_clflags_res, tvb, flagoffset, 1, flagval);		proto_tree_add_boolean(flagtree, hf_ns_clflags_rssh, tvb, flagoffset, 1, flagval);		proto_tree_add_boolean(flagtree, hf_ns_clflags_rss, tvb, flagoffset, 1, flagval);		proto_tree_add_boolean(flagtree, hf_ns_clflags_dfd, tvb, flagoffset, 1, flagval);		proto_tree_add_boolean(flagtree, hf_ns_clflags_fr, tvb, flagoffset, 1, flagval);		proto_tree_add_boolean(flagtree, hf_ns_clflags_fp, tvb, flagoffset, 1, flagval);	case NSPR_HEADER_VERSION203:		proto_tree_add_item(ns_tree, hf_ns_coreid, tvb, pnstr->coreid_offset, 2, ENC_LITTLE_ENDIAN);		/* fall through to next case */	case NSPR_HEADER_VERSION202:		col_add_fstr(pinfo->cinfo, COL_8021Q_VLAN_ID, "%d", tvb_get_letohs(tvb, pnstr->vlantag_offset));		proto_tree_add_item(ns_tree, hf_ns_vlantag, tvb, pnstr->vlantag_offset, 2, ENC_LITTLE_ENDIAN);		/* fall through to next case */	case NSPR_HEADER_VERSION201:		proto_tree_add_item(ns_tree, hf_ns_pcbdevno, tvb, pnstr->pcb_offset, 4, ENC_LITTLE_ENDIAN);		ti = proto_tree_add_item(ns_tree, hf_ns_devno, tvb, pnstr->pcb_offset, 4, ENC_LITTLE_ENDIAN);//.........这里部分代码省略.........
开发者ID:jelmer,项目名称:wireshark,代码行数:101,


示例23: dissect_turbocell

//.........这里部分代码省略.........    if (tree) {        ti = proto_tree_add_item(tree, proto_turbocell, tvb, 0, 20, ENC_NA);        turbocell_tree = proto_item_add_subtree(ti, ett_turbocell);        proto_tree_add_item(turbocell_tree, hf_turbocell_type, tvb, 0, 1, ENC_BIG_ENDIAN);        proto_tree_add_item(turbocell_tree, hf_turbocell_satmode, tvb, 1, 1, ENC_BIG_ENDIAN);        proto_tree_add_item(turbocell_tree, hf_turbocell_nwid, tvb, 1, 1, ENC_BIG_ENDIAN);        /* it seem when we have this magic number,that means an alternate header version */        if (tvb_get_bits64(tvb, 64,48,ENC_BIG_ENDIAN) != G_GINT64_CONSTANT(0x000001fe23dc45ba)){        proto_tree_add_item(turbocell_tree, hf_turbocell_counter, tvb, 0x02, 2, ENC_BIG_ENDIAN);        proto_tree_add_item(turbocell_tree, hf_turbocell_dst, tvb, 0x04, 6, ENC_NA);        proto_tree_add_item(turbocell_tree, hf_turbocell_timestamp, tvb, 0x0A, 3, ENC_BIG_ENDIAN);        } else {        proto_tree_add_item(turbocell_tree, hf_turbocell_timestamp, tvb, 0x02, 3, ENC_BIG_ENDIAN);        proto_tree_add_item(turbocell_tree, hf_turbocell_counter, tvb, 0x05, 3, ENC_BIG_ENDIAN);        proto_tree_add_item(turbocell_tree, hf_turbocell_dst, tvb, 0x08, 6, ENC_NA);        }        proto_tree_add_item(turbocell_tree, hf_turbocell_unknown, tvb, 0x0E, 2, ENC_BIG_ENDIAN);        proto_tree_add_item(turbocell_tree, hf_turbocell_ip, tvb, 0x10, 4, ENC_BIG_ENDIAN);    }        remaining_length=tvb_length_remaining(tvb, 0x14);        if (remaining_length > 6) {            /* If the first character is a printable character that means we have a payload with network info */            /* I couldn't find anything in the header that would definitvely indicate if payload is either data or network info */            /* Since the frame size is limited this should work ok */            if (tvb_get_guint8(tvb, 0x14)>=0x20){                name_item = proto_tree_add_item(turbocell_tree, hf_turbocell_name, tvb, 0x14, 30, ENC_ASCII|ENC_NA);                network_tree = proto_item_add_subtree(name_item, ett_network);                str_name=tvb_get_stringz(wmem_packet_scope(), tvb, 0x14, &str_len);                col_append_fstr(pinfo->cinfo, COL_INFO, ", Network=/"%s/"",format_text(str_name, str_len-1));                while(tvb_get_guint8(tvb, 0x34 + 8*i)==0x00 && (tvb_length_remaining(tvb,0x34 + 8*i) > 6) && (i<32)) {                    proto_tree_add_item(network_tree, hf_turbocell_station[i], tvb, 0x34+8*i, 6, ENC_NA);                    i++;                }                /*Couldn't make sense of the apparently random data in the end*/                next_tvb = tvb_new_subset_remaining(tvb, 0x34 + 8*i);                call_dissector(data_handle, next_tvb, pinfo, tree);            } else {                tvbuff_t *volatile msdu_tvb = NULL;                guint32 msdu_offset = 0x04;                guint16 j = 1;                guint16 msdu_length;                proto_item *parent_item;                proto_tree *mpdu_tree;                proto_tree *subframe_tree;                next_tvb = tvb_new_subset(tvb, 0x14, -1, tvb_get_ntohs(tvb, 0x14));                parent_item = proto_tree_add_protocol_format(tree, proto_aggregate, next_tvb, 0,                              tvb_reported_length_remaining(next_tvb, 0), "Turbocell Aggregate Frames");                mpdu_tree = proto_item_add_subtree(parent_item, ett_msdu_aggregation_parent_tree);                proto_tree_add_item(mpdu_tree, hf_turbocell_aggregate_len, next_tvb, 0x00, 2, ENC_BIG_ENDIAN);                proto_tree_add_item(mpdu_tree, hf_turbocell_aggregate_unknown1, next_tvb, 0x02, 2, ENC_BIG_ENDIAN);                remaining_length=tvb_length_remaining(next_tvb, msdu_offset);                do {                    msdu_length = (tvb_get_letohs(next_tvb, msdu_offset) & 0x0FFF);                    if (msdu_length==0) break;                    parent_item = proto_tree_add_uint_format(mpdu_tree, hf_turbocell_aggregate_msdu_header_text,                    next_tvb,msdu_offset, msdu_length + 0x02,j, "A-MSDU Subframe #%u", j);                    subframe_tree = proto_item_add_subtree(parent_item, ett_msdu_aggregation_subframe_tree);                    j++;                    proto_tree_add_item(subframe_tree, hf_turbocell_aggregate_msdu_len, next_tvb, msdu_offset, 2, ENC_LITTLE_ENDIAN);                    proto_tree_add_item(subframe_tree, hf_turbocell_aggregate_unknown2, next_tvb, msdu_offset+1, 1, ENC_BIG_ENDIAN);                    msdu_offset += 0x02;                    remaining_length -= 0x02;                    msdu_tvb = tvb_new_subset(next_tvb, msdu_offset, (msdu_length>remaining_length)?remaining_length:msdu_length, msdu_length);                    call_dissector(eth_handle, msdu_tvb, pinfo, subframe_tree);                    msdu_offset += msdu_length;                    remaining_length -= msdu_length;                } while (remaining_length > 6);                if (remaining_length > 2) {                    next_tvb = tvb_new_subset_remaining(next_tvb, msdu_offset);                    call_dissector(data_handle, next_tvb, pinfo, tree);                }            }        }}
开发者ID:AndresVelasco,项目名称:wireshark,代码行数:101,


示例24: proto_reg_handoff_op_uavtalk

  { 3, "Ack"        },  { 4, "Nack"       },  { 0, NULL         }};void proto_reg_handoff_op_uavtalk(void);#define UAVTALK_HEADER_SIZE 8#define UAVTALK_TRAILER_SIZE 1static int dissect_op_uavtalk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_){  gint offset = 0;  guint8 packet_type = tvb_get_guint8(tvb, 1) & 0x7;  guint32 objid = tvb_get_letohl(tvb, 4);  guint32 payload_length = tvb_get_letohs(tvb, 2) - UAVTALK_HEADER_SIZE - UAVTALK_TRAILER_SIZE;  guint32 reported_length = tvb_reported_length(tvb);  col_set_str(pinfo->cinfo, COL_PROTOCOL, "UAVTALK");  /* Clear out stuff in the info column */  col_clear(pinfo->cinfo, COL_INFO);  col_append_fstr(pinfo->cinfo, COL_INFO, "%s: 0x%08x", val_to_str_const(packet_type, uavtalk_packet_types, ""), objid);  if (objid & 0x1) {    col_append_str(pinfo->cinfo, COL_INFO, "(META)");  }  if (tree) { /* we are being asked for details */    proto_tree *op_uavtalk_tree = NULL;    ptvcursor_t * cursor;
开发者ID:Trex4Git,项目名称:dRonin,代码行数:31,


示例25: dissect_nbipx

//.........这里部分代码省略.........			      "Name deregistered", "Name not deregistered"));		}		offset += 1;		dissect_packet_type(tvb, offset, packet_type, nbipx_tree);		offset += 1;		if (nbipx_tree)			netbios_add_name("Name", tvb, offset, nbipx_tree);		offset += NETBIOS_NAME_LEN;		/*		 * No payload to be interpreted by another protocol.		 */		has_payload = FALSE;		break;	case NBIPX_SESSION_DATA:	case NBIPX_SESSION_END:	case NBIPX_SESSION_END_ACK:		if (check_col(pinfo->cinfo, COL_INFO)) {			col_add_str(pinfo->cinfo, COL_INFO,				val_to_str(packet_type, nbipx_data_stream_type_vals, "Unknown"));		}		dissect_conn_control(tvb, offset, nbipx_tree);		offset += 1;		dissect_packet_type(tvb, offset, packet_type, nbipx_tree);		offset += 1;		if (nbipx_tree) {			proto_tree_add_text(nbipx_tree, tvb, offset, 2,			    "Source connection ID: 0x%04X",			    tvb_get_letohs(tvb, offset));		}		offset += 2;		if (nbipx_tree) {			proto_tree_add_text(nbipx_tree, tvb, offset, 2,			    "Destination connection ID: 0x%04X",			    tvb_get_letohs(tvb, offset));		}		offset += 2;		if (nbipx_tree) {			proto_tree_add_text(nbipx_tree, tvb, offset, 2,			    "Send sequence number: %u",			    tvb_get_letohs(tvb, offset));		}		offset += 2;		if (nbipx_tree) {			proto_tree_add_text(nbipx_tree, tvb, offset, 2,			    "Total data length: %u",			    tvb_get_letohs(tvb, offset));		}		offset += 2;		if (nbipx_tree) {			proto_tree_add_text(nbipx_tree, tvb, offset, 2,			    "Offset: %u",			    tvb_get_letohs(tvb, offset));		}		offset += 2;		if (nbipx_tree) {
开发者ID:AkhilaAG,项目名称:gluster-wireshark-1.4,代码行数:67,



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


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