本文整理汇总了C++中proto_item_set_len函数的典型用法代码示例。如果您正苦于以下问题:C++ proto_item_set_len函数的具体用法?C++ proto_item_set_len怎么用?C++ proto_item_set_len使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了proto_item_set_len函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dissect_v8_user_data_message
static void
dissect_v8_user_data_message(tvbuff_t *message_data_tvb, packet_info *pinfo, proto_item *m2pa_item, proto_tree *m2pa_tree, proto_tree *tree)
{
proto_item *m2pa_li_item;
proto_tree *m2pa_li_tree;
tvbuff_t *payload_tvb;
if (tvb_length(message_data_tvb) > 0) {
if (m2pa_tree) {
m2pa_li_item = proto_tree_add_text(m2pa_tree, message_data_tvb, LI_OFFSET, LI_LENGTH, "Length Indicator");
m2pa_li_tree = proto_item_add_subtree(m2pa_li_item, ett_m2pa_li);
proto_tree_add_item(m2pa_li_tree, hf_v8_li_prio, message_data_tvb, LI_OFFSET, LI_LENGTH, ENC_BIG_ENDIAN);
proto_tree_add_item(m2pa_li_tree, hf_v8_li_spare, message_data_tvb, LI_OFFSET, LI_LENGTH, ENC_BIG_ENDIAN);
/* Re-adjust length of M2PA item since it will be dissected as MTP3 */
proto_item_set_len(m2pa_item, V8_HEADER_LENGTH + LI_LENGTH);
}
payload_tvb = tvb_new_subset_remaining(message_data_tvb, MTP3_OFFSET);
call_dissector(mtp3_handle, payload_tvb, pinfo, tree);
}
}
示例2: dissect_v12_user_data_message
static void
dissect_v12_user_data_message(tvbuff_t *message_data_tvb, packet_info *pinfo, proto_item *m2pa_item, proto_tree *m2pa_tree, proto_tree *tree)
{
proto_item *m2pa_li_item;
proto_tree *m2pa_li_tree;
tvbuff_t *payload_tvb;
if (tvb_length(message_data_tvb) > 0) {
if (m2pa_tree) {
m2pa_li_item = proto_tree_add_text(m2pa_tree, message_data_tvb, PRI_OFFSET, PRI_LENGTH, "Priority");
m2pa_li_tree = proto_item_add_subtree(m2pa_li_item, ett_m2pa_li);
proto_tree_add_item(m2pa_li_tree, hf_pri_prio, message_data_tvb, PRI_OFFSET, PRI_LENGTH, NETWORK_BYTE_ORDER);
proto_tree_add_item(m2pa_li_tree, hf_pri_spare, message_data_tvb, PRI_OFFSET, PRI_LENGTH, NETWORK_BYTE_ORDER);
/* Re-adjust length of M2PA item since it will be dissected as MTP3 */
proto_item_set_len(m2pa_item, V12_HEADER_LENGTH + PRI_LENGTH);
}
payload_tvb = tvb_new_subset_remaining(message_data_tvb, MTP3_OFFSET);
call_dissector(mtp3_handle, payload_tvb, pinfo, tree);
}
}
示例3: dissect_rx_challenge
static int
dissect_rx_challenge(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset, guint32 seq, guint32 callnumber)
{
proto_tree *tree;
proto_item *item;
guint32 version;
int old_offset=offset;
col_add_fstr(pinfo->cinfo, COL_INFO,
"CHALLENGE "
"Seq: %lu "
"Call: %lu "
"Source Port: %s "
"Destination Port: %s ",
(unsigned long)seq,
(unsigned long)callnumber,
udp_port_to_display(wmem_packet_scope(), pinfo->srcport),
udp_port_to_display(wmem_packet_scope(), pinfo->destport)
);
item = proto_tree_add_item(parent_tree, hf_rx_challenge, tvb, offset, -1, ENC_NA);
tree = proto_item_add_subtree(item, ett_rx_challenge);
version = tvb_get_ntohl(tvb, offset);
proto_tree_add_uint(tree, hf_rx_version, tvb,
offset, 4, version);
offset += 4;
if (version==2) {
proto_tree_add_item(tree, hf_rx_nonce, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_rx_min_level, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
}
proto_item_set_len(item, offset-old_offset);
return offset;
}
示例4: dissect_dvb_tot
static void
dissect_dvb_tot(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint offset = 0;
guint descriptor_len;
proto_item *ti;
proto_tree *dvb_tot_tree;
nstime_t utc_time;
col_set_str(pinfo->cinfo, COL_INFO, "Time Offset Table (TOT)");
ti = proto_tree_add_item(tree, proto_dvb_tot, tvb, offset, -1, ENC_NA);
dvb_tot_tree = proto_item_add_subtree(ti, ett_dvb_tot);
offset += packet_mpeg_sect_header(tvb, offset, dvb_tot_tree, NULL, NULL);
if (packet_mpeg_sect_mjd_to_utc_time(tvb, offset, &utc_time) < 0) {
proto_tree_add_text(dvb_tot_tree, tvb, offset, 5, "UTC Time : Unparseable time");
} else {
proto_tree_add_time_format(dvb_tot_tree, hf_dvb_tot_utc_time, tvb, offset, 5, &utc_time,
"UTC Time : %s UTC", abs_time_to_str(&utc_time, ABSOLUTE_TIME_UTC, FALSE));
}
offset += 5;
descriptor_len = tvb_get_ntohs(tvb, offset) & DVB_TOT_DESCRIPTORS_LOOP_LENGTH_MASK;
proto_tree_add_item(dvb_tot_tree, hf_dvb_tot_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(dvb_tot_tree, hf_dvb_tot_descriptors_loop_length, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
offset += proto_mpeg_descriptor_loop_dissect(tvb, offset, descriptor_len, dvb_tot_tree);
offset += packet_mpeg_sect_crc(tvb, pinfo, dvb_tot_tree, 0, offset);
proto_item_set_len(ti, offset);
}
示例5: dissect_mpeg_ca
static void
dissect_mpeg_ca(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint offset = 0, length = 0;
proto_item *ti;
proto_tree *mpeg_ca_tree;
/* The TVB should start right after the section_length in the Section packet */
col_set_str(pinfo->cinfo, COL_INFO, "Conditional Access Table (CA)");
ti = proto_tree_add_item(tree, proto_mpeg_ca, tvb, offset, -1, ENC_NA);
mpeg_ca_tree = proto_item_add_subtree(ti, ett_mpeg_ca);
offset += packet_mpeg_sect_header(tvb, offset, mpeg_ca_tree, &length, NULL);
length -= 4;
proto_tree_add_item(mpeg_ca_tree, hf_mpeg_ca_reserved, tvb, offset, 3, ENC_BIG_ENDIAN);
proto_tree_add_item(mpeg_ca_tree, hf_mpeg_ca_version_number, tvb, offset, 3, ENC_BIG_ENDIAN);
proto_tree_add_item(mpeg_ca_tree, hf_mpeg_ca_current_next_indicator, tvb, offset, 3, ENC_BIG_ENDIAN);
offset += 3;
proto_tree_add_item(mpeg_ca_tree, hf_mpeg_ca_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(mpeg_ca_tree, hf_mpeg_ca_last_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
/* Parse all the programs */
while (offset < length)
offset += proto_mpeg_descriptor_dissect(tvb, offset, mpeg_ca_tree);
offset += packet_mpeg_sect_crc(tvb, pinfo, mpeg_ca_tree, 0, offset);
proto_item_set_len(ti, offset);
}
示例6: dissect_rs_pgo_result_t
static int
dissect_rs_pgo_result_t (tvbuff_t * tvb, int offset,
packet_info * pinfo, proto_tree * parent_tree,
dcerpc_info *di, guint8 * drep)
{
/*
typedef struct {
sec_rgy_name_t name;
sec_rgy_pgo_item_t item;
} rs_pgo_result_t;
*/
proto_item *item = NULL;
proto_tree *tree = NULL;
int old_offset = offset;
if (di->conformant_run)
{
return offset;
}
if (parent_tree)
{
item =
proto_tree_add_text (parent_tree, tvb, offset, -1,
"rs_pgo_result_t ");
tree = proto_item_add_subtree (item, ett_rs_pgo_result_t);
}
offset = dissect_sec_rgy_name_t (tvb, offset, pinfo, tree, di, drep);
offset = dissect_sec_rgy_pgo_item_t (tvb, offset, pinfo, tree, di, drep);
proto_item_set_len (item, offset - old_offset);
return offset;
}
示例7: mapi_dissect_element_EcDoRpc_MAPI_REPL_UNION_OpenFolder
/* EcDoRpc Function 0x2 */
static int
mapi_dissect_element_EcDoRpc_MAPI_REPL_UNION_OpenFolder(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *parent_tree, dcerpc_info* di, guint8 *drep)
{
proto_item *item = NULL;
proto_tree *tree = NULL;
int old_offset;
int origin_offset;
origin_offset = offset;
if (parent_tree) {
item = proto_tree_add_item(parent_tree, hf_mapi_EcDoRpc_MAPI_REPL_UNION_mapi_OpenFolder, tvb, offset, -1, ENC_NA);
tree = proto_item_add_subtree(item, ett_mapi_OpenFolder_repl);
}
old_offset = offset;
proto_tree_add_item(tree, hf_mapi_EcDoRpc_unknown1, tvb, old_offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
proto_item_set_len(item, offset - origin_offset);
return offset;
}
示例8: dssetup_dissect_struct_DsRoleOpStatus
int
dssetup_dissect_struct_DsRoleOpStatus(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *parent_tree, guint8 *drep, int hf_index, guint32 param _U_)
{
proto_item *item = NULL;
proto_tree *tree = NULL;
int old_offset;
ALIGN_TO_2_BYTES;
old_offset = offset;
if(parent_tree){
item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, TRUE);
tree = proto_item_add_subtree(item, ett_dssetup_dssetup_DsRoleOpStatus);
}
offset = dssetup_dissect_element_DsRoleOpStatus_status(tvb, offset, pinfo, tree, drep);
proto_item_set_len(item, offset-old_offset);
return offset;
}
示例9: misc_dissect_struct_GUID
int
misc_dissect_struct_GUID(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *parent_tree, dcerpc_info* di, guint8 *drep, int hf_index, guint32 param)
{
proto_item *item = NULL;
proto_tree *tree = NULL;
int old_offset;
ALIGN_TO_4_BYTES;
old_offset = offset;
if (parent_tree) {
item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, ENC_NA);
tree = proto_item_add_subtree(item, ett_misc_GUID);
}
offset = misc_dissect_element_GUID_time_low(tvb, offset, pinfo, tree, di, drep);
offset = misc_dissect_element_GUID_time_mid(tvb, offset, pinfo, tree, di, drep);
offset = misc_dissect_element_GUID_time_hi_and_version(tvb, offset, pinfo, tree, di, drep);
offset = misc_dissect_element_GUID_clock_seq(tvb, offset, pinfo, tree, di, drep);
offset = misc_dissect_element_GUID_node(tvb, offset, pinfo, tree, di, drep);
proto_item_set_len(item, offset-old_offset);
if (di->call_data->flags & DCERPC_IS_NDR64) {
ALIGN_TO_4_BYTES;
}
return offset;
}
示例10: xdmcp_add_authorization_names
static gint xdmcp_add_authorization_names(proto_tree *tree,
tvbuff_t *tvb, gint offset)
{
proto_tree *anames_tree;
proto_item *anames_ti;
gint anames_len, anames_start_offset;
anames_start_offset = offset;
anames_len = tvb_get_guint8(tvb, offset);
anames_tree = proto_tree_add_subtree_format(tree, tvb,
anames_start_offset, -1,
ett_xdmcp_authorization_names, &anames_ti, "Authorization names (%d)",
anames_len);
anames_len = tvb_get_guint8(tvb, offset);
offset++;
while (anames_len > 0) {
offset += xdmcp_add_string(anames_tree, hf_xdmcp_authorization_name,
tvb, offset);
anames_len--;
}
proto_item_set_len(anames_ti, offset - anames_start_offset);
return offset - anames_start_offset;
}
示例11: dissect_error_status_t
static int
dissect_error_status_t (tvbuff_t * tvb, int offset,
packet_info * pinfo, proto_tree * parent_tree,
guint8 * drep)
{
proto_item *item = NULL;
proto_tree *tree = NULL;
int old_offset = offset;
guint32 st;
dcerpc_info *di;
const char *st_str;
di = (dcerpc_info *)pinfo->private_data;
if (di->conformant_run)
{
return offset;
}
if (parent_tree)
{
item = proto_tree_add_text (parent_tree, tvb, offset, -1,
"error_status_t");
tree = proto_item_add_subtree (item, ett_error_status_t);
}
offset =
dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep, hf_error_status_t,
&st);
st_str = val_to_str_ext (st, &dce_error_vals_ext, "%u");
if (check_col (pinfo->cinfo, COL_INFO))
col_append_fstr (pinfo->cinfo, COL_INFO, " st:%s ", st_str);
proto_item_set_len (item, offset - old_offset);
return offset;
}
示例12: dissect_rs_pgo_query_t
static int
dissect_rs_pgo_query_t (tvbuff_t * tvb, int offset,
packet_info * pinfo, proto_tree * parent_tree,
dcerpc_info *di, guint8 * drep)
{
enum
{
rs_pgo_query_name,
rs_pgo_query_id,
rs_pgo_query_unix_num,
rs_pgo_query_next,
rs_pgo_query_none
};
proto_item *item = NULL;
proto_tree *tree = NULL;
int old_offset = offset;
guint8 query_t;
if (di->conformant_run)
{
return offset;
}
if (parent_tree)
{
item =
proto_tree_add_text (parent_tree, tvb, offset, -1, "rs_pgo_query_t ");
tree = proto_item_add_subtree (item, ett_rs_pgo_query_t);
}
offset =
dissect_ndr_uint8 (tvb, offset, pinfo, tree, di, drep, hf_rs_pgo_query_t,
&query_t);
col_append_str (pinfo->cinfo, COL_INFO, " rs_pgo_query_t:");
switch (query_t)
{
case rs_pgo_query_name:
col_append_str (pinfo->cinfo, COL_INFO, "NAME");
break;
case rs_pgo_query_id:
col_append_str (pinfo->cinfo, COL_INFO, "ID");
break;
case rs_pgo_query_unix_num:
col_append_str (pinfo->cinfo, COL_INFO, "UNIX_NUM");
break;
case rs_pgo_query_next:
col_append_str (pinfo->cinfo, COL_INFO, "NEXT");
break;
case rs_pgo_query_none:
col_append_str (pinfo->cinfo, COL_INFO, "NONE");
break;
default:
col_append_fstr (pinfo->cinfo, COL_INFO, " unknown:%u", query_t);
break;
;
}
proto_item_set_len (item, offset - old_offset);
return offset;
}
示例13: dissect_sec_rgy_pgo_flags_t
static int
dissect_sec_rgy_pgo_flags_t (tvbuff_t * tvb, int offset,
packet_info * pinfo, proto_tree * parent_tree,
dcerpc_info *di, guint8 * drep)
{
/*
*/
proto_item *item = NULL;
proto_tree *tree = NULL;
int old_offset = offset;
guint32 flags;
/*
typedef bitset sec_rgy_pgo_flags_t;
*/
if (di->conformant_run)
{
return offset;
}
if (parent_tree)
{
item =
proto_tree_add_text (parent_tree, tvb, offset, -1,
"sec_rgy_pgo_flags_t ");
tree = proto_item_add_subtree (item, ett_sec_rgy_pgo_flags_t);
}
offset =
dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
hf_sec_rgy_pgo_flags_t, &flags);
/*
*
* s e c _ r g y _ p g o _ f l a g s _ t
*
* pgo item is an alias *
const unsigned32 sec_rgy_pgo_is_an_alias = 0x1;
* pgo item is required - cannot be deleted *
const unsigned32 sec_rgy_pgo_is_required = 0x2;
*
* projlist_ok: on person items indicates person can have a concurrent
* group set on group items indicates this group can appear on a
* concurrent group set. On org items this flag is undefined.
*
const unsigned32 sec_rgy_pgo_projlist_ok = 0x4;
*
* bits 4-32 unused
*
const unsigned32 sec_rgy_pgo_flags_none = 0;
*/
#define sec_rgy_pgo_is_an_alias 0x01
#define sec_rgy_pgo_is_required 0x02
#define sec_rgy_pgo_projlist_ok 0x04
#define sec_rgy_pgo_flags_none 0x00
col_append_str (pinfo->cinfo, COL_INFO, " PgoFlags=");
if ((flags & sec_rgy_pgo_is_an_alias) == sec_rgy_pgo_is_an_alias)
{
col_append_str (pinfo->cinfo, COL_INFO, ":IS_AN_ALIAS");
}
if ((flags & sec_rgy_pgo_is_required) == sec_rgy_pgo_is_required)
{
col_append_str (pinfo->cinfo, COL_INFO, ":IS_REQUIRED");
}
if ((flags & sec_rgy_pgo_projlist_ok) == sec_rgy_pgo_projlist_ok)
{
col_append_str (pinfo->cinfo, COL_INFO, ":PROJLIST_OK");
}
if ((flags & sec_rgy_acct_admin_client) == sec_rgy_acct_admin_client)
{
col_append_str (pinfo->cinfo, COL_INFO, ":NONE");
}
if ((flags & sec_rgy_pgo_flags_none) == sec_rgy_pgo_flags_none)
{
col_append_str (pinfo->cinfo, COL_INFO, ":NONE");
}
proto_item_set_len (item, offset - old_offset);
return offset;
}
示例14: dissect_bencoded_dict_entry
static int
dissect_bencoded_dict_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset )
{
proto_item *ti;
proto_tree *sub_tree;
gboolean tohex;
char *key, *val;
guint orig_offset = offset;
key = NULL;
val = NULL;
ti = proto_tree_add_item( tree, hf_bencoded_dict_entry, tvb, offset, 0, ENC_NA );
sub_tree = proto_item_add_subtree( ti, ett_bencoded_dict_entry);
/* dissect the key, it must be a string */
offset = dissect_bencoded_string( tvb, pinfo, sub_tree, offset, &key, FALSE, "Key" );
/* If it is a dict, then just do recursion */
switch( tvb_get_guint8(tvb,offset) )
{
case 'd':
offset = dissect_bencoded_dict( tvb, pinfo, sub_tree, offset, "Value" );
val = (char*)dict_str;
break;
case 'l':
if( strcmp(key,"e")==0 )
offset = dissect_bt_dht_error( tvb, pinfo, sub_tree, offset, &val, "Value" );
else if( strcmp(key,"values")==0 )
offset = dissect_bt_dht_values( tvb, pinfo, sub_tree, offset, &val, "Value" );
/* other unfamiliar lists */
else
{
offset = dissect_bencoded_list( tvb, pinfo, sub_tree, offset, "Value" );
val = (char*)list_str;
}
break;
case 'i':
offset = dissect_bencoded_int( tvb, pinfo, sub_tree, offset, &val, "Value" );
break;
/* it's a string */
default:
/* special process */
if( strcmp(key,"nodes")==0 )
offset = dissect_bt_dht_nodes( tvb, pinfo, sub_tree, offset, &val, "Value" );
/* some need to return hex string */
else
{
tohex = strcmp(key,"id")==0 || strcmp(key,"target")==0
|| strcmp(key,"info_hash")==0 || strcmp(key,"t")==0
|| strcmp(key,"v")==0;
offset = dissect_bencoded_string( tvb, pinfo, sub_tree, offset, &val, tohex, "Value" );
}
}
if( strlen(key)==1 )
key = (char*)val_to_str( key[0], short_key_name_value_string, key );
if( strlen(val)==1 )
val = (char*)val_to_str( val[0], short_val_name_value_string, val );
proto_item_set_text( ti, "%s: %s", key, val );
proto_item_set_len( ti, offset-orig_offset );
if( strcmp(key,"message_type")==0 || strcmp(key,"request_type")==0 )
col_append_fstr(pinfo->cinfo, COL_INFO, "%s=%s ", key, val);
return offset;
}
示例15: dissect_gvrp
//.........这里部分代码省略.........
/* GVRP only supports one attribute type. */
if (octet != GVRP_ATTRIBUTE_TYPE)
{
call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset),
pinfo, tree);
return;
}
attr_index = 0;
while (length)
{
int attr_start = offset;
proto_item *attr_item;
/* Read in attribute length. */
octet = tvb_get_guint8(tvb, offset);
/* Check for end of mark */
if (octet == GARP_END_OF_MARK)
{
/* If at least one message has been already read,
* check for another end of mark.
*/
if (attr_index)
{
proto_tree_add_text(gvrp_tree, tvb, offset,
sizeof(guint8), " End of mark");
offset += sizeof(guint8);
length -= sizeof(guint8);
proto_item_set_len(msg_item, offset - msg_start);
break;
}
else
{
call_dissector(data_handle,
tvb_new_subset_remaining(tvb, offset), pinfo, tree);
return;
}
}
else
{
guint8 event;
offset += sizeof(guint8);
length -= sizeof(guint8);
attr_item = proto_tree_add_text(gvrp_tree, tvb,
attr_start, -1, " Attribute %d", attr_index + 1);
proto_tree_add_uint(gvrp_tree, hf_gvrp_attribute_length,
tvb, attr_start, sizeof(guint8), octet);
/* Read in attribute event */
event = tvb_get_guint8(tvb, offset);
proto_tree_add_uint(gvrp_tree, hf_gvrp_attribute_event,
tvb, offset, sizeof(guint8), event);
offset += sizeof(guint8);
length -= sizeof(guint8);
switch (event) {