本文整理汇总了C++中proto_tree_add_uint_format函数的典型用法代码示例。如果您正苦于以下问题:C++ proto_tree_add_uint_format函数的具体用法?C++ proto_tree_add_uint_format怎么用?C++ proto_tree_add_uint_format使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了proto_tree_add_uint_format函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dissect_tacplus_args_list
static void
dissect_tacplus_args_list( tvbuff_t *tvb, proto_tree *tree, int data_off, int len_off, int arg_cnt )
{
int i;
guint8 buff[257];
for(i=0;i<arg_cnt;i++){
int len=tvb_get_guint8(tvb,len_off+i);
proto_tree_add_uint_format(tree, hf_tacplus_arg_length, tvb, len_off+i, 1, len,
"Arg[%d] length: %d", i, len);
tvb_get_nstringz0(tvb, data_off, len+1, buff);
proto_tree_add_string_format(tree, hf_tacplus_arg_value, tvb, data_off, len, buff,
"Arg[%d] value: %s", i, buff);
data_off+=len;
}
}
示例2: dissect_status_type_identification_parameter
static void
dissect_status_type_identification_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
{
guint16 status_type, status_id;
status_type = tvb_get_ntohs(parameter_tvb, STATUS_TYPE_OFFSET);
status_id = tvb_get_ntohs(parameter_tvb, STATUS_IDENT_OFFSET);
proto_tree_add_item(parameter_tree, hf_status_type, parameter_tvb, STATUS_TYPE_OFFSET, STATUS_TYPE_LENGTH, NETWORK_BYTE_ORDER);
proto_tree_add_uint_format(parameter_tree, hf_status_id, parameter_tvb, STATUS_IDENT_OFFSET, STATUS_IDENT_LENGTH,
status_id, "Status identification: %u (%s)", status_id,
val_to_str(status_type * 256 * 256 + status_id, status_type_id_values, "unknown"));
proto_item_append_text(parameter_item, " (%s)",
val_to_str(status_type * 256 * 256 + status_id, status_type_id_values, "unknown status information"));
}
示例3: dissect_tacplus_args_list
static void
dissect_tacplus_args_list( tvbuff_t *tvb, proto_tree *tree, int data_off, int len_off, int arg_cnt )
{
int i;
int len;
guint8 *value;
for(i=0;i<arg_cnt;i++){
len=tvb_get_guint8(tvb,len_off+i);
proto_tree_add_uint_format(tree, hf_tacplus_arg_length, tvb, len_off+i, 1, len,
"Arg[%d] length: %d", i, len);
value=tvb_get_string_enc(wmem_packet_scope(), tvb, data_off, len, ENC_ASCII|ENC_NA);
proto_tree_add_string_format(tree, hf_tacplus_arg_value, tvb, data_off, len, value,
"Arg[%d] value: %s", i, value);
data_off+=len;
}
}
示例4: decode_iei_ns_vci
static void
decode_iei_ns_vci(nsip_ie_t *ie, build_info_t *bi, int ie_start_offset) {
guint16 ns_vci;
if (bi->nsip_tree) {
ns_vci = tvb_get_ntohs(bi->tvb, bi->offset);
proto_tree_add_uint_format(bi->nsip_tree, hf_nsip_ns_vci,
bi->tvb, ie_start_offset, ie->total_length,
ns_vci,
"NS VCI: %#04x", ns_vci);
col_append_sep_fstr(bi->pinfo->cinfo, COL_INFO, NSIP_SEP,
"NS VCI: %#04x", ns_vci);
proto_item_append_text(bi->ti, ", NS VCI: %#04x", ns_vci);
}
bi->offset += ie->value_length;
}
示例5: dissect_mip6_bu
static int
dissect_mip6_bu(tvbuff_t *tvb, proto_tree *mip6_tree, packet_info *pinfo)
{
proto_tree *data_tree = NULL;
proto_item *ti;
int lifetime;
col_set_str(pinfo->cinfo, COL_INFO, "Binding Update");
if (mip6_tree) {
ti = proto_tree_add_text(mip6_tree, tvb, MIP6_DATA_OFF,
MIP6_BU_LEN, "Binding Update");
data_tree = proto_item_add_subtree(ti, ett_mip6);
proto_tree_add_item(data_tree, hf_mip6_bu_seqnr, tvb,
MIP6_BU_SEQNR_OFF, MIP6_BU_SEQNR_LEN, FALSE);
proto_tree_add_item(data_tree, hf_mip6_bu_a_flag, tvb,
MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, FALSE);
proto_tree_add_item(data_tree, hf_mip6_bu_h_flag, tvb,
MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, FALSE);
proto_tree_add_item(data_tree, hf_mip6_bu_l_flag, tvb,
MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, FALSE);
proto_tree_add_item(data_tree, hf_mip6_bu_k_flag, tvb,
MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, FALSE);
proto_tree_add_item(data_tree, hf_mip6_bu_m_flag, tvb,
MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, FALSE);
proto_tree_add_item(data_tree, hf_nemo_bu_r_flag, tvb,
MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, FALSE);
proto_tree_add_item(data_tree, hf_proxy_bu_p_flag, tvb,
MIP6_BU_FLAGS_OFF, MIP6_BU_FLAGS_LEN, FALSE);
if ((tvb_get_guint8(tvb, MIP6_BU_FLAGS_OFF) & 0x0004 ) == 0x0004)
proto_nemo = 1;
lifetime = tvb_get_ntohs(tvb, MIP6_BU_LIFETIME_OFF);
proto_tree_add_uint_format(data_tree, hf_mip6_bu_lifetime, tvb,
MIP6_BU_LIFETIME_OFF,
MIP6_BU_LIFETIME_LEN, lifetime,
"Lifetime: %d (%ld seconds)",
lifetime, (long)lifetime * 4);
}
return MIP6_DATA_OFF + MIP6_BU_LEN;
}
示例6: dissect_gdb_token
static void
dissect_gdb_token(void *tvbparse_data, const void *wanted_data, tvbparse_elem_t *tok)
{
proto_tree *tree;
guint token;
guint8 ack;
if (!tok) /* XXX - is this check necessary? */
return;
tree = (proto_tree *)tvbparse_data;
token = GPOINTER_TO_UINT(wanted_data);
/* XXX - check that tok->len is what we expect? */
switch (token) {
case GDB_TOK_ACK:
ack = tvb_get_guint8(tok->tvb, tok->offset);
proto_tree_add_uint_format(tree, hf_gdb_ack,
tok->tvb, tok->offset, tok->len, ack,
"Acknowledgement: %s (%c)",
val_to_str_const(ack, gdb_ack, "unknown"), ack);
break;
case GDB_TOK_START:
proto_tree_add_item(tree, hf_gdb_start,
tok->tvb, tok->offset, tok->len, ENC_ASCII|ENC_NA);
break;
case GDB_TOK_PAYLOAD:
proto_tree_add_item(tree, hf_gdb_payload,
tok->tvb, tok->offset, tok->len, ENC_NA);
break;
case GDB_TOK_END:
proto_tree_add_item(tree, hf_gdb_end,
tok->tvb, tok->offset, tok->len, ENC_ASCII|ENC_NA);
break;
case GDB_TOK_CHKSUM:
/* the spec is not really explicit but it seems that the
checksum is big endian */
proto_tree_add_item(tree, hf_gdb_chksum,
tok->tvb, tok->offset, tok->len, ENC_BIG_ENDIAN);
break;
default:
break;
}
}
示例7: dissect_whoent
static void
dissect_whoent(tvbuff_t *tvb, int offset, proto_tree *tree)
{
proto_tree *whoent_tree = NULL;
proto_item *whoent_ti = NULL;
int line_offset = offset;
guint8 *out_line;
guint8 *out_name;
nstime_t ts;
int whoent_num = 0;
guint32 idle_secs; /* say that out loud... */
ts.nsecs = 0;
while (tvb_reported_length_remaining(tvb, line_offset) > 0
&& whoent_num < MAX_NUM_WHOENTS) {
whoent_ti = proto_tree_add_item(tree, hf_who_whoent, tvb,
line_offset, SIZE_OF_WHOENT, ENC_NA);
whoent_tree = proto_item_add_subtree(whoent_ti, ett_whoent);
out_line = tvb_get_stringzpad(wmem_packet_scope(), tvb, line_offset, 8, ENC_ASCII|ENC_NA);
proto_tree_add_string(whoent_tree, hf_who_tty, tvb, line_offset,
8, out_line);
line_offset += 8;
out_name = tvb_get_stringzpad(wmem_packet_scope(), tvb, line_offset, 8, ENC_ASCII|ENC_NA);
proto_tree_add_string(whoent_tree, hf_who_uid, tvb, line_offset,
8, out_name);
line_offset += 8;
ts.secs = tvb_get_ntohl(tvb, line_offset);
proto_tree_add_time(whoent_tree, hf_who_timeon, tvb,
line_offset, 4, &ts);
line_offset += 4;
idle_secs = tvb_get_ntohl(tvb, line_offset);
proto_tree_add_uint_format(whoent_tree, hf_who_idle, tvb,
line_offset, 4, idle_secs, "Idle: %s",
time_secs_to_str(wmem_packet_scope(), idle_secs));
line_offset += 4;
whoent_num++;
}
}
示例8: dissect_whoent
static void
dissect_whoent(tvbuff_t *tvb, int offset, proto_tree *tree)
{
proto_tree *whoent_tree = NULL;
proto_item *whoent_ti = NULL;
int line_offset = offset;
gchar out_line[9];
gchar out_name[9];
nstime_t ts;
int whoent_num = 0;
guint32 idle_secs; /* say that out loud... */
ts.nsecs = 0;
while (tvb_reported_length_remaining(tvb, line_offset) > 0
&& whoent_num < MAX_NUM_WHOENTS) {
whoent_ti = proto_tree_add_item(tree, hf_who_whoent, tvb,
line_offset, SIZE_OF_WHOENT, FALSE);
whoent_tree = proto_item_add_subtree(whoent_ti, ett_whoent);
tvb_get_nstringz0(tvb, line_offset, sizeof(out_line), (guint8*)out_line);
proto_tree_add_string(whoent_tree, hf_who_tty, tvb, line_offset,
8, out_line);
line_offset += 8;
tvb_get_nstringz0(tvb, line_offset, sizeof(out_name), (guint8*)out_name);
proto_tree_add_string(whoent_tree, hf_who_uid, tvb, line_offset,
8, out_name);
line_offset += 8;
ts.secs = tvb_get_ntohl(tvb, line_offset);
proto_tree_add_time(whoent_tree, hf_who_timeon, tvb,
line_offset, 4, &ts);
line_offset += 4;
idle_secs = tvb_get_ntohl(tvb, line_offset);
proto_tree_add_uint_format(whoent_tree, hf_who_idle, tvb,
line_offset, 4, idle_secs, "Idle: %s",
time_secs_to_str(idle_secs));
line_offset += 4;
whoent_num++;
}
}
示例9: dissect_tss_mo_state
static gint
dissect_tss_mo_state(tvbuff_t *tvb, gint offset, proto_tree *tree)
{
guint8 tmp;
guint i = 0;
for (i = 0; i < 8; i+= 2) {
tmp = tvb_get_guint8(tvb, offset);
proto_tree_add_uint_format(tree, hf_om2k_tsn_state, tvb, offset, 1, tmp & 0xf,
"Timslot %u MO State: %s", i,
val_to_str(tmp & 0xf, om2k_mo_state_vals, "unknown (%02d)"));
proto_tree_add_uint_format(tree, hf_om2k_tsn_state, tvb, offset, 1, tmp >> 4,
"Timslot %u MO State: %s", i+1,
val_to_str(tmp >> 4, om2k_mo_state_vals, "unknown (%02d)"));
offset++;
}
return 4;
}
示例10: dissect_trmac
static void
dissect_trmac(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_tree *mac_tree = NULL;
proto_item *ti;
int mv_length, sv_offset, sv_additional;
guint8 mv_val;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "TR MAC");
col_clear(pinfo->cinfo, COL_INFO);
mv_val = tvb_get_guint8(tvb, 3);
/* Interpret the major vector */
if (check_col(pinfo->cinfo, COL_INFO))
col_add_str(pinfo->cinfo, COL_INFO,
val_to_str(mv_val, major_vector_vs, "Unknown Major Vector: %u"));
if (tree) {
mv_length = tvb_get_ntohs(tvb, 0);
ti = proto_tree_add_item(tree, proto_trmac, tvb, 0, mv_length, FALSE);
mac_tree = proto_item_add_subtree(ti, ett_tr_mac);
proto_tree_add_uint(mac_tree, hf_trmac_mv, tvb, 3, 1, mv_val);
proto_tree_add_uint_format(mac_tree, hf_trmac_length, tvb, 0, 2, mv_length,
"Total Length: %d bytes", mv_length);
proto_tree_add_uint(mac_tree, hf_trmac_srcclass, tvb, 2, 1, tvb_get_guint8(tvb, 2) & 0x0f);
proto_tree_add_uint(mac_tree, hf_trmac_dstclass, tvb, 2, 1, tvb_get_guint8(tvb, 2) >> 4 );
/* interpret the subvectors */
sv_offset = 4;
while (sv_offset < mv_length) {
sv_additional = sv_text(tvb, sv_offset, mac_tree);
/* if this is a bad packet, we could get a 0-length added here,
* looping forever */
if (sv_additional > 0)
sv_offset += sv_additional;
else
break;
}
}
}
示例11: tree_add_fragment_list_incomplete
/* add the list of fragments for this sdu to 'tree' */
static void tree_add_fragment_list_incomplete(struct rlc_sdu *sdu, tvbuff_t *tvb, proto_tree *tree)
{
proto_item *ti;
proto_tree *frag_tree;
guint16 offset;
struct rlc_frag *sdufrag;
ti = proto_tree_add_item(tree, hf_rlc_frags, tvb, 0, 0, FALSE);
frag_tree = proto_item_add_subtree(ti, ett_rlc_fragments);
proto_item_append_text(ti, " (%u bytes, %u fragments): ",
sdu->len, sdu->fragcnt);
sdufrag = sdu->frags;
offset = 0;
while (sdufrag) {
proto_tree_add_uint_format(frag_tree, hf_rlc_frag, tvb, 0,
0, sdufrag->frame_num, "Frame: %u, payload %u-%u (%u bytes) (Seq: %u)",
sdufrag->frame_num, offset, offset + sdufrag->len - 1, sdufrag->len, sdufrag->seq);
offset += sdufrag->len;
sdufrag = sdufrag->next;
}
}
示例12: dissect_response_pdu
static void
dissect_response_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, guint8 flags)
{
proto_tree* subtree;
guint encoding = (flags & NETWORK_BYTE_ORDER) ? ENC_BIG_ENDIAN : ENC_LITTLE_ENDIAN;
guint32 r_uptime;
subtree = proto_tree_add_subtree(tree, tvb, offset, len, ett_response, NULL, "Response-PDU");
NORLEL(flags, r_uptime, tvb, offset);
proto_tree_add_uint_format(subtree, hf_resp_uptime, tvb, offset, 4, r_uptime,
"sysUptime: %s", time_msecs_to_str(wmem_packet_scope(), r_uptime));
proto_tree_add_item(subtree, hf_resp_error, tvb, offset + 4, 2, encoding);
proto_tree_add_item(subtree, hf_resp_index, tvb, offset + 6, 2, encoding);
offset += 8;
len += PDU_HDR_LEN;
while(len > offset) {
offset += dissect_varbind(tvb, subtree, offset, len, flags);
}
}
示例13: decode_iei_cause
static void
decode_iei_cause(nsip_ie_t *ie, build_info_t *bi, int ie_start_offset) {
guint8 cause;
if (bi->nsip_tree) {
cause = tvb_get_guint8(bi->tvb, bi->offset);
proto_tree_add_uint_format(bi->nsip_tree, hf_nsip_cause,
bi->tvb, ie_start_offset, ie->total_length,
cause,
"Cause: %s (%#02x)",
val_to_str_const(cause, tab_nsip_cause_values,
"Unknown"), cause);
col_append_sep_fstr(bi->pinfo->cinfo, COL_INFO, NSIP_SEP,
"Cause: %s",
val_to_str(cause, tab_nsip_cause_values, "Unknown (0x%02x)"));
proto_item_append_text(bi->ti, ", Cause: %s",
val_to_str(cause, tab_nsip_cause_values, "Unknown (0x%02x)"));
}
bi->offset += ie->value_length;
}
示例14: dissect_radio
/*
* Dissect 802.11 with a variable-length link-layer header and a pseudo-
* header containing radio information.
*/
static void
dissect_radio (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
{
proto_item *ti = NULL;
proto_tree *radio_tree = NULL;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "Radio");
col_clear(pinfo->cinfo, COL_INFO);
/* Add the radio information to the column information */
col_add_fstr(pinfo->cinfo, COL_TX_RATE, "%u.%u",
pinfo->pseudo_header->ieee_802_11.data_rate / 2,
pinfo->pseudo_header->ieee_802_11.data_rate & 1 ? 5 : 0);
/* XX - this is a percentage, not a dBm or normalized or raw RSSI */
col_add_fstr(pinfo->cinfo, COL_RSSI, "%u",
pinfo->pseudo_header->ieee_802_11.signal_level);
if (tree) {
ti = proto_tree_add_item(tree, proto_radio, tvb, 0, 0, ENC_NA);
radio_tree = proto_item_add_subtree (ti, ett_radio);
proto_tree_add_uint64_format(radio_tree, hf_data_rate, tvb, 0, 0,
(guint64)pinfo->pseudo_header->ieee_802_11.data_rate * 500000,
"Data Rate: %u.%u Mb/s",
pinfo->pseudo_header->ieee_802_11.data_rate / 2,
pinfo->pseudo_header->ieee_802_11.data_rate & 1 ? 5 : 0);
proto_tree_add_uint(radio_tree, hf_channel, tvb, 0, 0,
pinfo->pseudo_header->ieee_802_11.channel);
proto_tree_add_uint_format(radio_tree, hf_signal_strength, tvb, 0, 0,
pinfo->pseudo_header->ieee_802_11.signal_level,
"Signal Strength: %u%%",
pinfo->pseudo_header->ieee_802_11.signal_level);
}
/* dissect the 802.11 header next */
pinfo->current_proto = "IEEE 802.11";
call_dissector(ieee80211_handle, tvb, pinfo, tree);
}
示例15: dissect_netrom_type
static void
dissect_netrom_type(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
int hf_netrom_type_param, gint ett_netrom_type_param, const netrom_tf_items *type_items )
{
proto_tree *tc;
proto_tree *type_tree;
char *info_buffer;
guint8 type;
guint8 op_code;
type = tvb_get_guint8( tvb, offset );
op_code = type &0x0f;
info_buffer = ep_strdup_printf( "%s%s%s%s (0x%02x)",
val_to_str_const( op_code, op_code_vals_text, "Unknown" ),
( type & NETROM_MORE_FLAG ) ? ", More" : "",
( type & NETROM_NAK_FLAG ) ? ", NAK" : "",
( type & NETROM_CHOKE_FLAG ) ? ", Choke" : "",
type );
col_add_str( pinfo->cinfo, COL_INFO, info_buffer );
if ( tree )
{
tc = proto_tree_add_uint_format( tree,
hf_netrom_type_param,
tvb,
offset,
1,
type,
"Type field: %s",
info_buffer
);
type_tree = proto_item_add_subtree( tc, ett_netrom_type_param );
proto_tree_add_item( type_tree, *type_items->hf_tf_op, tvb, offset, 1, ENC_BIG_ENDIAN );
proto_tree_add_item( type_tree, *type_items->hf_tf_choke, tvb, offset, 1, ENC_BIG_ENDIAN );
proto_tree_add_item( type_tree, *type_items->hf_tf_nak, tvb, offset, 1, ENC_BIG_ENDIAN );
proto_tree_add_item( type_tree, *type_items->hf_tf_more, tvb, offset, 1, ENC_BIG_ENDIAN );
}
}