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

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

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

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

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

示例1: ts2_parse_playerlist

/* Parses a ts2 player list (TS2T_PLAYERLIST) and adds it to the tree */static void ts2_parse_playerlist(tvbuff_t *tvb, proto_tree *ts2_tree){    gint32 offset;    gint32 number_of_players;    gint32 x;    offset=0;    x=0;    proto_tree_add_item(ts2_tree, hf_ts2_number_of_players, tvb, offset, 4, ENC_LITTLE_ENDIAN);    number_of_players = tvb_get_letohl(tvb, 0);    offset+=4;    while(offset<tvb_length_remaining(tvb, 0) && x<number_of_players)    {        proto_tree_add_item(ts2_tree, hf_ts2_player_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);        offset+=4;        proto_tree_add_item(ts2_tree, hf_ts2_channel_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);        offset+=4;        proto_tree_add_item(ts2_tree, hf_ts2_unknown, tvb, offset, 4, ENC_NA);        offset+=4;        proto_tree_add_item(ts2_tree, hf_ts2_player_status_flags, tvb, offset, 2, ENC_LITTLE_ENDIAN);        ts2_add_statusflags(tvb, ts2_tree, offset);        offset+=2;        proto_tree_add_item(ts2_tree, hf_ts2_nick, tvb, offset, 1, ENC_ASCII|ENC_NA);        offset+=30;        x++;    }    proto_tree_add_item(ts2_tree, hf_ts2_emptyspace, tvb, offset, tvb_length_remaining(tvb, 0), ENC_NA);}
开发者ID:AndresVelasco,项目名称:wireshark,代码行数:28,


示例2: getExtensionObjectType

guint32 getExtensionObjectType(tvbuff_t *tvb, gint *pOffset){    gint    iOffset = *pOffset;    guint8  EncodingMask;    guint32 Numeric = 0;    EncodingMask = tvb_get_guint8(tvb, iOffset);    iOffset++;    switch(EncodingMask)    {    case 0x00: /* two byte node id */        Numeric = tvb_get_guint8(tvb, iOffset);        /*iOffset+=1;*/        break;    case 0x01: /* four byte node id */        iOffset+=1;        Numeric = tvb_get_letohs(tvb, iOffset);        break;    case 0x02: /* numeric, that does not fit into four bytes */        iOffset+=4;        Numeric = tvb_get_letohl(tvb, iOffset);        break;    case 0x03: /* string */    case 0x04: /* uri */    case 0x05: /* guid */    case 0x06: /* byte string */        /* NOT USED */        break;    };    return Numeric;}
开发者ID:pvons,项目名称:wireshark,代码行数:33,


示例3: TvbRange_le_int64

/* *  get a Lilliputian signed 64 bit integer from a tvb */WSLUA_METHOD TvbRange_le_int64(lua_State* L) {    /* Get a Little Endian signed 64 bit integer from a `TvbRange`, as an `Int64` object.       The range must be 1, 2, 4 or 8 octets long. */    TvbRange tvbr = checkTvbRange(L,1);    if (!(tvbr && tvbr->tvb)) return 0;    if (tvbr->tvb->expired) {        luaL_error(L,"expired tvb");        return 0;    }    switch (tvbr->len) {        case 1:            pushInt64(L,(gint8)tvb_get_guint8(tvbr->tvb->ws_tvb,tvbr->offset));            return 1;        case 2:            pushInt64(L,(gint16)tvb_get_letohs(tvbr->tvb->ws_tvb,tvbr->offset));            return 1;        case 4:            pushInt64(L,(gint32)tvb_get_letohl(tvbr->tvb->ws_tvb,tvbr->offset));            return 1;        case 8:            pushInt64(L,(gint64)tvb_get_letoh64(tvbr->tvb->ws_tvb,tvbr->offset));            WSLUA_RETURN(1); /* The `Int64` object. */        default:            luaL_error(L,"TvbRange:le_int64() does not handle %d byte integers",tvbr->len);            return 0;    }}
开发者ID:DHODoS,项目名称:wireshark,代码行数:31,


示例4: parseArrayEnum

/** General parsing function for arrays of enums. * All arrays have one 4 byte signed integer length information, * followed by n data elements. */void parseArrayEnum(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, fctEnumParser pParserFunction){    static const char szFieldName[] = "Array of Enum Type";    proto_item *ti = proto_tree_add_text(tree, tvb, *pOffset, -1, "%s", szFieldName);    proto_tree *subtree = proto_item_add_subtree(ti, ett_opcua_array);    int i;    gint32 iLen;    /* read array length */    iLen = tvb_get_letohl(tvb, *pOffset);    proto_tree_add_item(subtree, hf_opcua_ArraySize, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN);    if (iLen > MAX_ARRAY_LEN)    {        proto_item *pi;        pi = proto_tree_add_text(tree, tvb, *pOffset, 4, "Array length %d too large to process", iLen);        PROTO_ITEM_SET_GENERATED(pi);        return;    }    *pOffset += 4;    for (i=0; i<iLen; i++)    {        (*pParserFunction)(subtree, tvb, pOffset);    }    proto_item_set_end(ti, tvb, *pOffset);}
开发者ID:pvons,项目名称:wireshark,代码行数:31,


示例5: parseArrayComplex

/** General parsing function for arrays of complex types. * All arrays have one 4 byte signed integer length information, * followed by n data elements. */void parseArrayComplex(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, const char *szFieldName, fctComplexTypeParser pParserFunction){    proto_item *ti = proto_tree_add_text(tree, tvb, *pOffset, -1, "Array of %s", szFieldName);    proto_tree *subtree = proto_item_add_subtree(ti, ett_opcua_array);    int i;    gint32 iLen;    /* read array length */    iLen = tvb_get_letohl(tvb, *pOffset);    proto_tree_add_item(subtree, hf_opcua_ArraySize, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN);    if (iLen > MAX_ARRAY_LEN)    {        proto_item *pi;        pi = proto_tree_add_text(tree, tvb, *pOffset, 4, "Array length %d too large to process", iLen);        PROTO_ITEM_SET_GENERATED(pi);        return;    }    *pOffset += 4;    for (i=0; i<iLen; i++)    {        char szNum[20];        g_snprintf(szNum, 20, "[%i]", i);        (*pParserFunction)(subtree, tvb, pOffset, szNum);    }    proto_item_set_end(ti, tvb, *pOffset);}
开发者ID:pvons,项目名称:wireshark,代码行数:32,


示例6: dissect_election_criterion

static voiddissect_election_criterion(tvbuff_t *tvb, proto_tree *parent_tree, int offset){	proto_tree *tree = NULL;	proto_item *item = NULL;	guint32 criterion;	criterion = tvb_get_letohl(tvb, offset);	if (parent_tree) {		item = proto_tree_add_uint(parent_tree, hf_election_criteria, tvb, offset, 4, criterion);	      	tree = proto_item_add_subtree(item, ett_browse_election_criteria);	}	/* election desire */	dissect_election_criterion_desire(tvb, tree, offset);	offset += 1;	/* browser protocol major version */	proto_tree_add_item(tree, hf_proto_major, tvb, offset, 1, ENC_LITTLE_ENDIAN);	offset += 1;	/* browser protocol minor version */	proto_tree_add_item(tree, hf_proto_minor, tvb, offset, 1, ENC_LITTLE_ENDIAN);	offset += 1;	/* election os */	dissect_election_criterion_os(tvb, tree, offset);}
开发者ID:danielwhite84,项目名称:wireshark,代码行数:30,


示例7: parseByteString

void parseByteString(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex){    char *szValue;    int iOffset = *pOffset;    gint32 iLen = tvb_get_letohl(tvb, iOffset);    iOffset += 4;    if (iLen == -1)    {        proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 0, ENC_NA);        proto_item_append_text(item, "[OpcUa Null ByteString]");        proto_item_set_end(item, tvb, *pOffset + 4);    }    else if (iLen == 0)    {        proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 0, ENC_NA);        proto_item_append_text(item, "[OpcUa Empty ByteString]");        proto_item_set_end(item, tvb, *pOffset + 4);    }    else if (iLen > 0)    {        proto_tree_add_item(tree, hfIndex, tvb, iOffset, iLen, ENC_NA);        iOffset += iLen; /* eat the whole bytestring */    }    else    {        proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 0, ENC_NA);        szValue = wmem_strdup_printf(wmem_packet_scope(), "[Invalid ByteString] Invalid length: %d", iLen);        proto_item_append_text(item, "%s", szValue);        proto_item_set_end(item, tvb, *pOffset + 4);    }    *pOffset = iOffset;}
开发者ID:pvons,项目名称:wireshark,代码行数:34,


示例8: dissect_control_get_recmaster_reply

//.........这里部分代码省略.........	{CTDB_CONTROL_GET_PID,		"GET_PID"},	{CTDB_CONTROL_GET_RECMASTER,	"GET_RECMASTER"},	{CTDB_CONTROL_SET_RECMASTER,	"SET_RECMASTER"},	{CTDB_CONTROL_FREEZE,		"FREEZE"},	{CTDB_CONTROL_THAW,		"THAW"},	{CTDB_CONTROL_GET_VNN,		"GET_VNN"},	{CTDB_CONTROL_SHUTDOWN,		"SHUTDOWN"},	{CTDB_CONTROL_GET_MONMODE,	"GET_MONMODE"},	{CTDB_CONTROL_SET_MONMODE,	"SET_MONMODE"},	{CTDB_CONTROL_MAX_RSN,		"MAX_RSN"},	{CTDB_CONTROL_SET_RSN_NONEMPTY,	"SET_RSN_NONEMPTY"},	{CTDB_CONTROL_DELETE_LOW_RSN,	"DELETE_LOW_RSN"},	{CTDB_CONTROL_TAKEOVER_IP,	"TAKEOVER_IP"},	{CTDB_CONTROL_RELEASE_IP,	"RELEASE_IP"},	{CTDB_CONTROL_TCP_CLIENT,	"TCP_CLIENT"},	{CTDB_CONTROL_TCP_ADD,		"TCP_ADD"},	{CTDB_CONTROL_TCP_REMOVE,	"TCP_REMOVE"},	{CTDB_CONTROL_STARTUP,		"STARTUP"},	{CTDB_CONTROL_SET_TUNABLE,	"SET_TUNABLE"},	{CTDB_CONTROL_GET_TUNABLE,	"GET_TUNABLE"},	{CTDB_CONTROL_LIST_TUNABLES,	"LIST_TUNABLES"},	{CTDB_CONTROL_GET_PUBLIC_IPS,	"GET_PUBLIC_IPS"},	{CTDB_CONTROL_MODIFY_FLAGS,	"MODIFY_FLAGS"},	{CTDB_CONTROL_GET_ALL_TUNABLES,	"GET_ALL_TUNABLES"},	{CTDB_CONTROL_KILL_TCP,		"KILL_TCP"},	{CTDB_CONTROL_GET_TCP_TICKLE_LIST,	"GET_TCP_TICKLE_LIST"},	{CTDB_CONTROL_SET_TCP_TICKLE_LIST,	"SET_TCP_TICKLE_LIST"},	{CTDB_CONTROL_REGISTER_SERVER_ID,	"REGISTER_SERVER_ID"},	{CTDB_CONTROL_UNREGISTER_SERVER_ID,	"UNREGISTER_SERVER_ID"},	{CTDB_CONTROL_CHECK_SERVER_ID,		"CHECK_SERVER_ID"},	{CTDB_CONTROL_GET_SERVER_ID_LIST,	"GET_SERVER_ID_LIST"},	{CTDB_CONTROL_DB_ATTACH_PERSISTENT,	"DB_ATTACH_PERSISTENT"},	{CTDB_CONTROL_PERSISTENT_STORE,		"PERSISTENT_STORE"},	{CTDB_CONTROL_UPDATE_RECORD,		"UPDATE_RECORD"},	{0, NULL}};static int dissect_control_get_recmaster_reply(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, guint32 status, int endianess _U_){	proto_tree_add_uint(tree, hf_ctdb_recmaster, tvb, 0, 0, status);	col_append_fstr(pinfo->cinfo, COL_INFO, " RecMaster:%d", status);	return offset;}static const value_string recmode_vals[] = {	{0,"NORMAL"},	{1,"RECOVERY ACTIVE"},	{0,NULL}};static int dissect_control_get_recmode_reply(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, guint32 status, int endianess _U_){	proto_tree_add_uint(tree, hf_ctdb_recmode, tvb, 0, 0, status);	col_append_fstr(pinfo->cinfo, COL_INFO, " RecMode:%s",		val_to_str(status, recmode_vals, "Unknown:%d"));	return offset;}#define CTDB_MAX_NODES 500 /* Arbitrary. */static int dissect_control_get_nodemap_reply(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, guint32 status _U_, int endianess){	guint32 num_nodes;	proto_item *item;	/* num nodes */	item = proto_tree_add_item(tree, hf_ctdb_num_nodes, tvb, offset, 4, endianess);	if(endianess){		num_nodes=tvb_get_letohl(tvb, offset);	} else {		num_nodes=tvb_get_ntohl(tvb, offset);	}	offset+=4;	if (num_nodes > CTDB_MAX_NODES) {		expert_add_info_format(pinfo, item, PI_UNDECODED, PI_WARN, "Too many nodes (%u). Stopping dissection.", num_nodes);		THROW(ReportedBoundsError);	}	while(num_nodes--){		/* vnn */		proto_tree_add_item(tree, hf_ctdb_vnn, tvb, offset, 4, endianess);		offset+=4;		/* node flags */		proto_tree_add_item(tree, hf_ctdb_node_flags, tvb, offset, 4, endianess);		offset+=4;		/* here comes a sockaddr_in but we only store ipv4 addresses in it */		proto_tree_add_item(tree, hf_ctdb_node_ip, tvb, offset+4, 4, ENC_BIG_ENDIAN);		offset+=16;	}	return offset;}
开发者ID:asriadi,项目名称:wireshark,代码行数:101,


示例9: dissect_dtpt_wstring

static intdissect_dtpt_wstring(tvbuff_t *tvb, guint offset, proto_tree *tree, int hfindex){	guint32	wstring_length;	guint32	wstring_size;	char	*wstring_data = NULL;	guint32	wstring_padding = 0;	wstring_length = tvb_get_letohl(tvb, offset);	wstring_data = tvb_get_string_enc(wmem_packet_scope(), tvb, offset+4, wstring_length, ENC_UTF_16|ENC_LITTLE_ENDIAN);	wstring_size = wstring_length;	if (wstring_size%4) {		wstring_padding = (4-wstring_size%4);		wstring_size += wstring_padding;	}	if (tree) {		proto_item	*dtpt_wstring_item;		proto_tree	*dtpt_wstring_tree;		dtpt_wstring_item = proto_tree_add_string(tree, hfindex,			tvb, offset+0, 4+wstring_size, wstring_data);		dtpt_wstring_tree = proto_item_add_subtree(dtpt_wstring_item, ett_dtpt_wstring);		if (dtpt_wstring_tree) {			proto_tree_add_uint(dtpt_wstring_tree, hf_dtpt_wstring_length,				tvb, offset+0, 4, wstring_length);			if (wstring_length)				proto_tree_add_string(dtpt_wstring_tree, hf_dtpt_wstring_data,					tvb, offset+4, wstring_length, wstring_data);			if (wstring_padding)				proto_tree_add_item(dtpt_wstring_tree, hf_dtpt_padding, tvb,					offset+4+wstring_length,wstring_padding, ENC_NA);		}	}	offset += 4+wstring_size;	return offset;}
开发者ID:CharaD7,项目名称:wireshark,代码行数:35,


示例10: dissect_nsimulator

static voiddissect_nsimulator(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){  guint32 signature;  tvbuff_t *payload_tvb;  proto_item *ns_tree = NULL;  proto_item *ns_subtree = NULL;  if (tvb_captured_length(tvb) > 4) {    signature = tvb_get_letohl(tvb, 0);    if ( signature == 0xFF77DE02 || signature == 0xFF77DE82 )    {      col_set_str(pinfo->cinfo, COL_PROTOCOL, "Network Simulator");      if (tree)      {        ns_tree = proto_tree_add_item(tree, proto_nsimulator, tvb, 0, 4, ENC_NA);        ns_subtree = proto_item_add_subtree(ns_tree, ett_nsimulator);        proto_tree_add_item(ns_subtree, hf_nsimulator_dir, tvb, 0, sizeof(guint8),          ENC_LITTLE_ENDIAN);        proto_tree_add_item(ns_subtree, hf_nsimulator_sig, tvb, 1, 3 * sizeof(guint8),          ENC_LITTLE_ENDIAN);      }      payload_tvb = tvb_new_subset(tvb, 4, -1, tvb_reported_length(tvb) - 4);      TRY      {        call_dissector(wpan_handle, payload_tvb, pinfo, tree);      }      CATCH_ALL {        show_exception(payload_tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE);      }      ENDTRY;    } else {
开发者ID:enikulenkov,项目名称:wsplugin-nsimulator,代码行数:32,


示例11: dissect_account_control

static intdissect_account_control(tvbuff_t *tvb, proto_tree *tree, int offset){	/* display the Allowable Account control bits */	proto_item *ti = NULL;	proto_tree *flags_tree = NULL;	guint32 flags;	flags = tvb_get_letohl(tvb, offset);	if (tree) {		ti = proto_tree_add_text(tree, tvb, offset, 4,			"Account control  = 0x%04x", flags);		flags_tree = proto_item_add_subtree(ti, ett_smb_account_flags);	}	proto_tree_add_boolean(flags_tree, hf_flags_autolock, tvb, offset, 4, flags);	proto_tree_add_boolean(flags_tree, hf_flags_expire, tvb, offset, 4, flags);	proto_tree_add_boolean(flags_tree, hf_flags_server_trust, tvb, offset, 4, flags);	proto_tree_add_boolean(flags_tree, hf_flags_workstation_trust, tvb, offset, 4, flags);	proto_tree_add_boolean(flags_tree, hf_flags_interdomain_trust, tvb, offset, 4, flags);	proto_tree_add_boolean(flags_tree, hf_flags_mns_user, tvb, offset, 4, flags);	proto_tree_add_boolean(flags_tree, hf_flags_normal_user, tvb, offset, 4, flags);	proto_tree_add_boolean(flags_tree, hf_flags_temp_dup_user, tvb, offset, 4, flags);	proto_tree_add_boolean(flags_tree, hf_flags_password_required, tvb, offset, 4, flags);	proto_tree_add_boolean(flags_tree, hf_flags_homedir_required, tvb, offset, 4, flags);	proto_tree_add_boolean(flags_tree, hf_flags_enabled, tvb, offset, 4, flags);	offset += 4;	return offset;}
开发者ID:AndresVelasco,项目名称:wireshark,代码行数:34,


示例12: TvbRange_le_uint

/* *  get a Lilliputian unsigned integer from a tvb */WSLUA_METHOD TvbRange_le_uint(lua_State* L) {	/* Get a Little Endian unsigned integer from a TvbRange. The range must be 1, 2, 3 or 4 octets long. */    TvbRange tvbr = checkTvbRange(L,1);    if (!(tvbr && tvbr->tvb)) return 0;    if (tvbr->tvb->expired) {        luaL_error(L,"expired tvb");        return 0;    }    switch (tvbr->len) {        case 1:            /* XXX unsigned anyway */            lua_pushnumber(L,(lua_Number)(guint)tvb_get_guint8(tvbr->tvb->ws_tvb,tvbr->offset));            return 1;        case 2:            lua_pushnumber(L,tvb_get_letohs(tvbr->tvb->ws_tvb,tvbr->offset));            return 1;        case 3:            lua_pushnumber(L,tvb_get_letoh24(tvbr->tvb->ws_tvb,tvbr->offset));            return 1;        case 4:            lua_pushnumber(L,tvb_get_letohl(tvbr->tvb->ws_tvb,tvbr->offset));            WSLUA_RETURN(1); /* The unsigned integer value */        default:            luaL_error(L,"TvbRange:le_uint() does not handle %d byte integers",tvbr->len);            return 0;    }}
开发者ID:jelmer,项目名称:wireshark,代码行数:31,


示例13: ts2_standard_find_fragments

/* * Check if a packet is in order and if it is set its fragmentation details into the passed pointers. * Returns TRUE if the packet is fragmented. * Must be run sequentially * */static gboolean ts2_standard_find_fragments(tvbuff_t *tvb, guint32 *last_inorder_frame, guint32 *frag_size, guint32 *frag_num, gboolean *outoforder){    guint32 frag_count;    gboolean ret;    frag_count=tvb_get_letohs(tvb, 18);    ret=FALSE;    *outoforder=FALSE;    /* if last_inorder_frame is zero, then this is the first reliable packet */    if(*last_inorder_frame==0)    {        *last_inorder_frame=tvb_get_letohl(tvb, 12);        *frag_size=tvb_get_letohs(tvb, 18);        *frag_num=0;        if(*frag_size>0)            ret=TRUE;        else            ret=FALSE;    }    /* This packet is in order */    else if(*last_inorder_frame==tvb_get_letohl(tvb, 12)-1)    {        if(*frag_size>0)        {            *frag_num=*frag_size-frag_count;            if(frag_count==0)            {                *frag_size=0;            }            ret=TRUE;        }        else        {            *frag_size=tvb_get_letohs(tvb, 18);            *frag_num=*frag_size-frag_count;            if(*frag_size>0)                ret=TRUE;            else                ret=FALSE;        }        *last_inorder_frame=tvb_get_letohl(tvb, 12);    }    else /* out of order */        *outoforder=TRUE;    return ret;}
开发者ID:RazZziel,项目名称:wireshark-dplay,代码行数:51,


示例14: corosync_totemsrp_get_guint32

static guint32corosync_totemsrp_get_guint32(tvbuff_t* tvb, gint offset, const guint encoding){  if (encoding == ENC_LITTLE_ENDIAN)    return tvb_get_letohl(tvb, offset);  return tvb_get_ntohl(tvb, offset);}
开发者ID:VincentLadeveze,项目名称:802154e-wireshark,代码行数:8,


示例15: tvb_get_enctohl

static guint32tvb_get_enctohl(tvbuff_t *tvb, int offset, guint encoding){    if (encoding == ENC_BIG_ENDIAN)        return tvb_get_ntohl(tvb, offset);    else        return tvb_get_letohl(tvb, offset);}
开发者ID:dot-Sean,项目名称:wireshark-http2,代码行数:8,


示例16: dissect_bt_dht_values

/* dissect a bt dht values list from tvb, start at offset. it's like "l6:....6:....e" */static intdissect_bt_dht_values(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, char **result, char *label ){  proto_item *ti;  proto_tree *sub_tree;  proto_item *value_ti;  proto_tree *value_tree;  address     addr;  guint       peer_index;  guint       string_len_start;  guint       string_len;  guint16     port;  ti = proto_tree_add_item( tree, hf_bt_dht_peers, tvb, offset, 0, ENC_NA );  sub_tree = proto_item_add_subtree( ti, ett_bt_dht_peers);  peer_index = 0;  /* we has confirmed that the first byte is 'l' */  offset += 1;  /* dissect bt-dht values */  while( tvb_get_guint8(tvb,offset)!='e' )  {    string_len_start = offset;    while( tvb_get_guint8(tvb,offset) != ':' )      offset += 1;    string_len = atoi( tvb_get_ephemeral_string(tvb,string_len_start,offset-string_len_start) );    /* skip the ':' */    offset += 1;    /* 4 bytes ip, 2 bytes port */    for( ; string_len>=6; string_len-=6, offset+=6 )    {      peer_index += 1;      SET_ADDRESS( &addr, AT_IPv4, 4, tvb_get_ptr( tvb, offset, 4) );      port = tvb_get_letohl( tvb, offset+4 );      value_ti = proto_tree_add_none_format( sub_tree, hf_bt_dht_peer, tvb, offset, 6,          "%d/t%s:%u", peer_index, ep_address_to_str( &addr ), port );      value_tree = proto_item_add_subtree( value_ti, ett_bt_dht_peers);      proto_tree_add_item( value_tree, hf_ip, tvb, offset, 4, ENC_BIG_ENDIAN);      proto_tree_add_item( value_tree, hf_port, tvb, offset+4, 2, ENC_BIG_ENDIAN);    }    /* truncated data */    if( string_len>0 )    {      proto_tree_add_item( tree, hf_truncated_data, tvb, offset, string_len, ENC_NA );      offset += string_len;    }  }  proto_item_set_text( ti, "%s: %d peers", label, peer_index );  col_append_fstr( pinfo->cinfo, COL_INFO, "reply=%d peers  ", peer_index );  *result = ep_strdup_printf("%d peers", peer_index);  return offset;}
开发者ID:giuliano108,项目名称:wireshark-rtpmon,代码行数:59,


示例17: tvb_get_guint32_endian

static guint32 tvb_get_guint32_endian(tvbuff_t *a_tvb, gint a_iOffset, gboolean a_bLittleEndian){	guint32 iResult;	if (a_bLittleEndian)		iResult = tvb_get_letohl(a_tvb, a_iOffset);	else		iResult =  tvb_get_ntohl(a_tvb, a_iOffset);	return iResult;}
开发者ID:kailiu-bupt2005,项目名称:wireshark,代码行数:9,


示例18: dissect_event_counter

static voiddissect_event_counter(tvbuff_t *tvb, proto_tree *tree){	guint32 aa;	aa 			= tvb_get_letohl(tvb, get_header_length());	if (aa != adv_aa)	{		proto_tree_add_item(tree, hf_nordic_ble_event_counter, tvb, get_ec_index(), 2, ENC_LITTLE_ENDIAN);	}}
开发者ID:ambrice,项目名称:nordic_ble,代码行数:10,


示例19: is_rrac_command_stream

static gboolean is_rrac_command_stream(tvbuff_t *tvb, int offset){  guint16 maybe_command = tvb_get_letohs(tvb, offset);  if (maybe_command >= 0x65 && maybe_command <= 0x70)    return TRUE;  #if 0  if (tvb_get_letohl(tvb, offset) == 0xffffffff || tvb_length_remaining(tvb, offset) >= 14) {    guint32 test_value = tvb_get_letohl(tvb, offset + 4);    if (test_value >= 10000 && test_value <= 10050) {      return TRUE;    }  }#endif  return FALSE;}
开发者ID:asmblur,项目名称:SynCE,代码行数:19,


示例20: dissect_bt_dht_nodes

static intdissect_bt_dht_nodes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, char **result, char *label ){  proto_item *ti;  proto_tree *sub_tree;  proto_item *node_ti;  proto_tree *node_tree;  guint       node_index;  guint       string_len_start;  guint       string_len;  address     addr;  guint16     port;  guint8     *id;  ti = proto_tree_add_item( tree, hf_bt_dht_nodes, tvb, offset, 0, ENC_NA );  sub_tree = proto_item_add_subtree( ti, ett_bt_dht_nodes);  node_index = 0;  string_len_start = offset;  while( tvb_get_guint8(tvb,offset) != ':' )    offset += 1;  string_len = atoi( tvb_get_ephemeral_string(tvb,string_len_start,offset-string_len_start) );  /* skip the ':' */  offset += 1;  /* 20 bytes id, 4 bytes ip, 2 bytes port */  for( ; string_len>=26; string_len-=26, offset+=26 )  {    node_index += 1;    id = tvb_bytes_to_str(tvb, offset, 20 );    SET_ADDRESS( &addr, AT_IPv4, 4, tvb_get_ptr( tvb, offset, 4) );    port = tvb_get_letohl( tvb, offset+24 );    node_ti = proto_tree_add_none_format( sub_tree, hf_bt_dht_node, tvb, offset, 26,        "%d/t%s %s:%u", node_index, id, ep_address_to_str( &addr ), port );    node_tree = proto_item_add_subtree( node_ti, ett_bt_dht_peers);    proto_tree_add_item( node_tree, hf_bt_dht_id, tvb, offset, 20, ENC_NA);    proto_tree_add_item( node_tree, hf_ip, tvb, offset+20, 4, ENC_BIG_ENDIAN);    proto_tree_add_item( node_tree, hf_port, tvb, offset+24, 2, ENC_BIG_ENDIAN);  }  if( string_len>0 )  {    proto_tree_add_item( tree, hf_truncated_data, tvb, offset, string_len, ENC_NA );    offset += string_len;  }  proto_item_set_text( ti, "%s: %d nodes", label, node_index );  col_append_fstr( pinfo->cinfo, COL_INFO, "reply=%d nodes  ", node_index );  *result = ep_strdup_printf("%d", node_index);  return offset;}
开发者ID:giuliano108,项目名称:wireshark-rtpmon,代码行数:55,


示例21: dissect_aoe_v1

static voiddissect_aoe_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){  guint8 flags, cmd;  guint32 tag;  proto_item *flags_item=NULL;  proto_tree *flags_tree=NULL;  /* read and dissect the flags */  flags=tvb_get_guint8(tvb, 0)&0x0f;  if(tree){    flags_item=proto_tree_add_text(tree, tvb, 0, 1, "Flags:");    flags_tree=proto_item_add_subtree(flags_item, ett_aoe_flags);  }  proto_tree_add_item(flags_tree, hf_aoe_flags_response, tvb, 0, 1, ENC_BIG_ENDIAN);  proto_tree_add_item(flags_tree, hf_aoe_flags_error, tvb, 0, 1, ENC_BIG_ENDIAN);  if(flags_item){    proto_item_append_text(flags_item,(flags&AOE_FLAGS_RESPONSE)?" Response":" Request");    if(flags&AOE_FLAGS_ERROR){      proto_item_append_text(flags_item, " Error");    }  }  /* error */  if(flags&AOE_FLAGS_ERROR){    proto_tree_add_item(tree, hf_aoe_error, tvb, 1, 1, ENC_BIG_ENDIAN);	col_append_fstr(pinfo->cinfo, COL_INFO, "Error:%s ", val_to_str(tvb_get_guint8(tvb, 1), error_vals, "Unknown error<%d>"));  }  /* major/minor address */  proto_tree_add_item(tree, hf_aoe_major, tvb, 2, 2, ENC_BIG_ENDIAN);  proto_tree_add_item(tree, hf_aoe_minor, tvb, 4, 1, ENC_BIG_ENDIAN);  /* command */  cmd=tvb_get_guint8(tvb, 5);  proto_tree_add_item(tree, hf_aoe_cmd, tvb, 5, 1, ENC_BIG_ENDIAN);  col_append_fstr(pinfo->cinfo, COL_INFO, "%s %s", val_to_str(cmd, cmd_vals, "Unknown command<%d>"), (flags&AOE_FLAGS_RESPONSE)?"Response":"Request");  /* tag */  tag=tvb_get_letohl(tvb, 6);  proto_tree_add_item(tree, hf_aoe_tag, tvb, 6, 4, ENC_BIG_ENDIAN);  switch(cmd){  case AOE_CMD_ISSUE_ATA_COMMAND:    dissect_ata_pdu(pinfo, tree, tvb, 10, flags&AOE_FLAGS_RESPONSE, tag);    break;  case AOE_CMD_QUERY_CONFIG_INFO:    break;  }}
开发者ID:LucaBongiorni,项目名称:LTE_monitor_c2xx,代码行数:54,


示例22: dissect_ros_message_header

static gintdissect_ros_message_header(tvbuff_t *tvb, proto_tree *root_tree, packet_info *pinfo, gint offset){	proto_item *ti;	proto_tree *sub_tree;	gint consumed_len = 0;	guint32 frame_id_len;	guint32 seq;	guint header_len;	frame_id_len = tvb_get_letohl(tvb, offset + consumed_len + SIZE_OF_LENGTH_FIELD + SIZE_OF_LENGTH_STAMP);	header_len = SIZE_OF_LENGTH_FIELD + SIZE_OF_LENGTH_STAMP + SIZE_OF_LENGTH_FIELD + frame_id_len;	/** Header */	ti = proto_tree_add_item(root_tree, hf_tcpros_message_header, tvb, offset + consumed_len, header_len, ENC_NA);	sub_tree = proto_item_add_subtree(ti, ett_tcpros);	/** Sequence number */	proto_tree_add_item(sub_tree, hf_tcpros_message_header_seq, tvb, offset + consumed_len, SIZE_OF_LENGTH_FIELD, ENC_LITTLE_ENDIAN);	seq = tvb_get_letohl(tvb, offset + consumed_len);	consumed_len += SIZE_OF_LENGTH_FIELD;	col_append_fstr(pinfo->cinfo, COL_INFO, "Seq: %d ", seq);	/** Timestamp */	consumed_len += dissect_ros_message_header_stamp(tvb, sub_tree, pinfo, offset + consumed_len);	/** Frame ID */	ti = proto_tree_add_item(sub_tree, hf_tcpros_message_header_frame, tvb, offset + consumed_len, SIZE_OF_LENGTH_FIELD, ENC_UTF_8|ENC_LITTLE_ENDIAN);	sub_tree = proto_item_add_subtree(ti, ett_tcpros);	proto_tree_add_item(sub_tree, hf_tcpros_message_header_frame_length, tvb, offset + consumed_len, SIZE_OF_LENGTH_FIELD, ENC_LITTLE_ENDIAN);	consumed_len += SIZE_OF_LENGTH_FIELD;	proto_tree_add_item(sub_tree, hf_tcpros_message_header_frame_value, tvb, offset + consumed_len, frame_id_len, ENC_UTF_8|ENC_NA);	col_append_fstr(pinfo->cinfo, COL_INFO, "Frame: '%s' ",	tvb_get_string_enc(wmem_packet_scope(), tvb, offset + consumed_len, frame_id_len, ENC_UTF_8) );	consumed_len += frame_id_len;	return consumed_len;}
开发者ID:Nicholas1126,项目名称:wireshark-ex,代码行数:41,


示例23: dissect_counted_values

static gint dissect_counted_values(tvbuff_t *tvb, gint offset, int hf_id,  packet_info *pinfo, proto_tree *tree, gboolean single, gboolean unicode, guint encoding){	 proto_item *item;	 guint32 length, count, i;	 count = tvb_get_letohl(tvb, offset);	 proto_tree_add_item(tree, hf_tnef_values_count, tvb, offset, 4, ENC_LITTLE_ENDIAN);	 if(count > 1) {		 if(single) {			 item = proto_tree_add_expert_format(tree, pinfo, &ei_tnef_expect_single_item, tvb, offset, 4,						    "Expecting a single item but found %d", count);			 tree = proto_item_add_subtree(item, ett_tnef_counted_items);		 }	 }	 offset += 4;	 for(i = 0; i < count; i++) {		 length = tvb_get_letohl(tvb, offset);		 proto_tree_add_item(tree, hf_tnef_value_length, tvb, offset, 4, ENC_LITTLE_ENDIAN);		 offset += 4;		 if (unicode) {			 char *unicode_str = tvb_get_unicode_string(wmem_packet_scope(), tvb, offset, length, ENC_LITTLE_ENDIAN);			 proto_tree_add_string(tree, hf_id, tvb, offset, length, unicode_str);		 } else {			 proto_tree_add_item(tree, hf_id, tvb, offset, length, encoding);		 }		 offset += length;		 /* XXX: may be padding ? */	 }	 return offset;}
开发者ID:lubing521,项目名称:wireshark,代码行数:38,


示例24: dissect_UDPR3

static voiddissect_UDPR3(tvbuff_t *tvb, packet_info *pinfo,	      proto_tree *adwin_tree, proto_tree *adwin_debug_tree){	guint32 i, seq_num;	/* Get the transaction identifier */	seq_num = tvb_get_letohl(tvb, 0);	adwin_request_response_handling(tvb, pinfo, adwin_tree, seq_num, ADWIN_RESPONSE);	if (! adwin_tree)		return;	SET_PACKET_TYPE(adwin_tree, APT_UDPR3);	ADWIN_ADD_LE(adwin_tree, packet_index,   0,  4);	ADWIN_ADD_LE(adwin_tree, packet_no,      4,  4);	if (! global_adwin_dissect_data) {		proto_tree_add_text(adwin_debug_tree, tvb, 8, 350 * 4, "Data");		return;	}	for (i = 0; i < 350; i++) {		proto_item *item;		guint32 offset = 8 + i * sizeof(guint32);		gint32 value = tvb_get_letohl(tvb, offset);		void * fvalue = &value;		proto_tree_add_text(adwin_debug_tree, tvb, offset, 4,				    "Data[%3d]: %10d - %10f - 0x%08x",				    i, value, *(float*)fvalue, value);		item = ADWIN_ADD_LE(adwin_debug_tree, data_int,   offset, 4);		PROTO_ITEM_SET_HIDDEN(item);		item = ADWIN_ADD_LE(adwin_debug_tree, data_float, offset, 4);		PROTO_ITEM_SET_HIDDEN(item);		item = ADWIN_ADD_LE(adwin_debug_tree, data_hex,   offset, 4);		PROTO_ITEM_SET_HIDDEN(item);	}}
开发者ID:hubolo,项目名称:wireshark-1.8.0,代码行数:38,


示例25: dissect_ble_delta_time

static voiddissect_ble_delta_time(tvbuff_t *tvb, proto_tree *tree){  static guint8 previous_ble_packet_length = 0;	guint32 delta_time, delta_time_ss;    /* end - start */	delta_time 			= (guint32)tvb_get_letohl(tvb, get_td_index());	proto_tree_add_item(tree, hf_nordic_ble_delta_time, tvb, get_td_index(), 4, ENC_LITTLE_ENDIAN);    /* start - start */  delta_time_ss = get_metadata_transfer_time() + (get_us_per_byte() * previous_ble_packet_length) + delta_time;	proto_tree_add_uint(tree, hf_nordic_ble_delta_time_ss, tvb, get_td_index(), 4, delta_time_ss);      previous_ble_packet_length = tvb_get_guint8(tvb, get_packet_length_index());}
开发者ID:ambrice,项目名称:nordic_ble,代码行数:16,



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


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