本文整理汇总了C++中proto_item_append_text函数的典型用法代码示例。如果您正苦于以下问题:C++ proto_item_append_text函数的具体用法?C++ proto_item_append_text怎么用?C++ proto_item_append_text使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了proto_item_append_text函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dissect_openvpn_msg_common
static int
dissect_openvpn_msg_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *openvpn_tree, proto_tree *parent_tree, gint offset)
{
gboolean tls_auth;
guint openvpn_keyid;
guint openvpn_opcode;
guint32 msg_mpid = -1;
guint32 msg_sessionid = -1;
guint8 openvpn_predict_tlsauth_arraylength;
proto_item *ti2, *ti3;
proto_tree *packetarray_tree, *type_tree;
guint32 msg_length_remaining;
gboolean msg_lastframe;
fragment_head *frag_msg;
tvbuff_t *new_tvb;
gboolean save_fragmented;
/* Clear out stuff in the info column */
col_set_str(pinfo->cinfo, COL_PROTOCOL, PSNAME);
col_clear(pinfo->cinfo,COL_INFO);
/* read opcode and write to info column */
openvpn_opcode = tvb_get_bits8(tvb, offset*8, 5);
col_append_fstr(pinfo->cinfo, COL_INFO, "MessageType: %s",
val_to_str_const(openvpn_opcode, openvpn_message_types, "Unknown Messagetype"));
openvpn_keyid = tvb_get_bits8(tvb, offset*8 + 5, 3);
proto_item_append_text(parent_tree, ", Opcode: %s, Key ID: %d",
val_to_str(openvpn_opcode, openvpn_message_types, "Unknown (0x%02x)"),
openvpn_keyid);
ti2 = proto_tree_add_item(openvpn_tree, hf_openvpn_pdu_type, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_item_append_text(ti2, " [opcode/key_id]");
type_tree = proto_item_add_subtree(ti2, ett_openvpn_type);
proto_tree_add_item(type_tree, hf_openvpn_opcode, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(type_tree, hf_openvpn_keyid, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
/* if we have a P_CONTROL or P_ACK packet */
if (openvpn_opcode != P_DATA_V1) {
/* read sessionid */
msg_sessionid = tvb_get_bits32(tvb, offset*8+32, 32, ENC_BIG_ENDIAN);
proto_tree_add_item(openvpn_tree, hf_openvpn_sessionid, tvb, offset, 8, ENC_BIG_ENDIAN);
offset += 8;
/* tls-auth detection (this can be overridden by preferences */
openvpn_predict_tlsauth_arraylength = tvb_get_guint8(tvb, offset);
/* if the first 4 bytes that would, if tls-auth is used, contain part of the hmac,
lack entropy, we asume no tls-auth is used */
if (pref_tls_auth_override == FALSE) {
if ((openvpn_opcode != P_DATA_V1)
&& (openvpn_predict_tlsauth_arraylength > 0)
&& check_for_valid_hmac(tvb_get_ntohl(tvb, offset))) {
tls_auth = TRUE;
} else {
tls_auth = FALSE;
}
} else {
tls_auth = pref_tls_auth;
}
if (tls_auth == TRUE) {
proto_tree_add_item(openvpn_tree, hf_openvpn_hmac, tvb, offset, tls_auth_hmac_size, ENC_NA);
offset += tls_auth_hmac_size;
if (tvb_length_remaining(tvb, offset) >= 8) {
proto_tree_add_item(openvpn_tree, hf_openvpn_pid, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
if (pref_long_format) {
proto_tree_add_item(openvpn_tree, hf_openvpn_net_time, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
}
}
}
if (tvb_length_remaining(tvb, offset) >= 1) {
/* read P_ACK packet-id array length */
gint pid_arraylength = tvb_get_guint8(tvb, offset);
gint i;
proto_tree_add_item(openvpn_tree, hf_openvpn_mpid_arraylength, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
if (pid_arraylength > 0) {
ti3 = proto_tree_add_text(openvpn_tree, tvb, offset, 0, "Packet-ID Array");
packetarray_tree = proto_item_add_subtree(ti3, ett_openvpn_packetarray);
for (i = 0; i < pid_arraylength; i++) {
proto_tree_add_item(packetarray_tree, hf_openvpn_mpid_arrayelement, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
}
if (tvb_length_remaining(tvb, offset) >= 8) {
proto_tree_add_item(openvpn_tree, hf_openvpn_rsessionid, tvb, offset, 8, ENC_BIG_ENDIAN);
offset += 8;
}
}
}
//.........这里部分代码省略.........
示例2: dissect_ccn_interest
//.........这里部分代码省略.........
}
ccn_charbuf_append_string(c, "Exclude: ");
ccn_buf_advance(d);
if (ccn_buf_match_dtag(d, CCN_DTAG_Any)) {
ccn_buf_advance(d);
ccn_charbuf_append_string(c, "* ");
ccn_buf_check_close(d);
}
else if (ccn_buf_match_dtag(d, CCN_DTAG_Bloom)) {
ccn_buf_advance(d);
if (ccn_buf_match_blob(d, &bloom, &bloom_size))
ccn_buf_advance(d);
ccn_charbuf_append_string(c, "? ");
ccn_buf_check_close(d);
}
while (ccn_buf_match_dtag(d, CCN_DTAG_Component)) {
ccn_buf_advance(d);
comp_size = 0;
if (ccn_buf_match_blob(d, &comp, &comp_size))
ccn_buf_advance(d);
ccn_uri_append_percentescaped(c, comp, comp_size);
ccn_charbuf_append_string(c, " ");
ccn_buf_check_close(d);
if (ccn_buf_match_dtag(d, CCN_DTAG_Any)) {
ccn_buf_advance(d);
ccn_charbuf_append_string(c, "* ");
ccn_buf_check_close(d);
}
else if (ccn_buf_match_dtag(d, CCN_DTAG_Bloom)) {
ccn_buf_advance(d);
if (ccn_buf_match_blob(d, &bloom, &bloom_size))
ccn_buf_advance(d);
ccn_charbuf_append_string(c, "? ");
ccn_buf_check_close(d);
}
}
titem = proto_tree_add_text(tree, tvb, pi->offset[CCN_PI_B_Exclude], l,
"%s", ccn_charbuf_as_string(c));
exclude_tree = proto_item_add_subtree(titem, ett_exclude);
ccn_charbuf_destroy(&c);
}
/* ChildSelector */
l = pi->offset[CCN_PI_E_ChildSelector] - pi->offset[CCN_PI_B_ChildSelector];
if (l > 0) {
i = pi->orderpref;
titem = proto_tree_add_uint(tree, hf_ccn_childselector, tvb, pi->offset[CCN_PI_B_ChildSelector], l, i);
proto_item_append_text(titem, ", %s", val_to_str(i & 1, VALS(childselectordirection_vals), ""));
}
/* AnswerOriginKind */
l = pi->offset[CCN_PI_E_AnswerOriginKind] - pi->offset[CCN_PI_B_AnswerOriginKind];
if (l > 0) {
i = pi->answerfrom;
titem = proto_tree_add_uint(tree, hf_ccn_answeroriginkind, tvb, pi->offset[CCN_PI_B_AnswerOriginKind], l, i);
}
/* Scope */
l = pi->offset[CCN_PI_E_Scope] - pi->offset[CCN_PI_B_Scope];
if (l > 0) {
i = pi->scope;
titem = proto_tree_add_uint(tree, hf_ccn_scope, tvb, pi->offset[CCN_PI_B_Scope], l, i);
}
/* InterestLifetime */
l = pi->offset[CCN_PI_E_InterestLifetime] - pi->offset[CCN_PI_B_InterestLifetime];
if (l > 0) {
i = ccn_ref_tagged_BLOB(CCN_DTAG_InterestLifetime, ccnb,
pi->offset[CCN_PI_B_InterestLifetime],
pi->offset[CCN_PI_E_InterestLifetime],
&blob, &blob_size);
lifetime = 0.0;
for (i = 0; i < blob_size; i++)
lifetime = lifetime * 256.0 + (double)blob[i];
lifetime /= 4096.0;
titem = proto_tree_add_double(tree, hf_ccn_interestlifetime, tvb, blob - ccnb, blob_size, lifetime);
}
/* Nonce */
l = pi->offset[CCN_PI_E_Nonce] - pi->offset[CCN_PI_B_Nonce];
if (l > 0) {
i = ccn_ref_tagged_BLOB(CCN_DTAG_Nonce, ccnb,
pi->offset[CCN_PI_B_Nonce],
pi->offset[CCN_PI_E_Nonce],
&blob, &blob_size);
if (check_col(pinfo->cinfo, COL_INFO)) {
col_append_str(pinfo->cinfo, COL_INFO, ", <");
for (i = 0; i < blob_size; i++)
col_append_fstr(pinfo->cinfo, COL_INFO, "%02x", blob[i]);
col_append_str(pinfo->cinfo, COL_INFO, ">");
}
titem = proto_tree_add_item(tree, hf_ccn_nonce, tvb,
blob - ccnb, blob_size, FALSE);
}
return (1);
}
示例3: dissect_rtse
/*
* Dissect RTSE PDUs inside a PPDU.
*/
static int
dissect_rtse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data)
{
int offset = 0;
int old_offset;
proto_item *item;
proto_tree *tree;
proto_tree *next_tree=NULL;
tvbuff_t *next_tvb = NULL;
tvbuff_t *data_tvb = NULL;
fragment_head *frag_msg = NULL;
guint32 fragment_length;
guint32 rtse_id = 0;
gboolean data_handled = FALSE;
struct SESSION_DATA_STRUCTURE* session;
conversation_t *conversation = NULL;
asn1_ctx_t asn1_ctx;
asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
/* do we have application context from the acse dissector? */
if (data == NULL)
return 0;
session = (struct SESSION_DATA_STRUCTURE*)data;
/* save parent_tree so subdissectors can create new top nodes */
top_tree=parent_tree;
asn1_ctx.private_data = session;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTSE");
col_clear(pinfo->cinfo, COL_INFO);
if (rtse_reassemble &&
((session->spdu_type == SES_DATA_TRANSFER) ||
(session->spdu_type == SES_MAJOR_SYNC_POINT))) {
/* Use conversation index as fragment id */
conversation = find_conversation (pinfo->fd->num,
&pinfo->src, &pinfo->dst, pinfo->ptype,
pinfo->srcport, pinfo->destport, 0);
if (conversation != NULL) {
rtse_id = conversation->index;
}
session->rtse_reassemble = TRUE;
}
if (rtse_reassemble && session->spdu_type == SES_MAJOR_SYNC_POINT) {
frag_msg = fragment_end_seq_next (&rtse_reassembly_table,
pinfo, rtse_id, NULL);
next_tvb = process_reassembled_data (tvb, offset, pinfo, "Reassembled RTSE",
frag_msg, &rtse_frag_items, NULL, parent_tree);
}
item = proto_tree_add_item(parent_tree, proto_rtse, next_tvb ? next_tvb : tvb, 0, -1, ENC_NA);
tree = proto_item_add_subtree(item, ett_rtse);
if (rtse_reassemble && session->spdu_type == SES_DATA_TRANSFER) {
/* strip off the OCTET STRING encoding - including any CONSTRUCTED OCTET STRING */
dissect_ber_octet_string(FALSE, &asn1_ctx, tree, tvb, offset, hf_rtse_segment_data, &data_tvb);
if (data_tvb) {
fragment_length = tvb_captured_length_remaining (data_tvb, 0);
proto_item_append_text(asn1_ctx.created_item, " (%u byte%s)", fragment_length,
plurality(fragment_length, "", "s"));
frag_msg = fragment_add_seq_next (&rtse_reassembly_table,
data_tvb, 0, pinfo,
rtse_id, NULL,
fragment_length, TRUE);
if (frag_msg && pinfo->fd->num != frag_msg->reassembled_in) {
/* Add a "Reassembled in" link if not reassembled in this frame */
proto_tree_add_uint (tree, *(rtse_frag_items.hf_reassembled_in),
data_tvb, 0, 0, frag_msg->reassembled_in);
}
pinfo->fragmented = TRUE;
data_handled = TRUE;
} else {
fragment_length = tvb_captured_length_remaining (tvb, offset);
}
col_append_fstr(pinfo->cinfo, COL_INFO, "[RTSE fragment, %u byte%s]",
fragment_length, plurality(fragment_length, "", "s"));
} else if (rtse_reassemble && session->spdu_type == SES_MAJOR_SYNC_POINT) {
if (next_tvb) {
/* ROS won't do this for us */
session->ros_op = (ROS_OP_INVOKE | ROS_OP_ARGUMENT);
/*offset=*/dissect_ber_external_type(FALSE, tree, next_tvb, 0, &asn1_ctx, -1, call_rtse_external_type_callback);
top_tree = NULL;
/* Return other than 0 to indicate that we handled this packet */
return 1;
} else {
offset = tvb_captured_length (tvb);
}
pinfo->fragmented = FALSE;
data_handled = TRUE;
}
if (!data_handled) {
while (tvb_reported_length_remaining(tvb, offset) > 0){
old_offset=offset;
//.........这里部分代码省略.........
示例4: dissect_IDispatch_Invoke_resp
int
dissect_IDispatch_Invoke_resp(tvbuff_t *tvb, int offset,
packet_info *pinfo, proto_tree *tree, guint8 *drep)
{
guint32 u32Pointer;
guint32 u32Pointer2;
guint32 u32Pointer3;
guint32 u32VariableOffset;
guint32 u32ArraySize;
guint32 u32SubStart;
guint16 u16Code;
guint16 u16Reserved;
guint32 u32HelpContext;
guint32 u32Reserved;
guint32 u32DeferredFillIn;
guint32 u32ArgErr;
guint32 u32HResult;
guint32 u32SCode;
guint32 u32VarRef;
gchar szName[1000] = { 0 };
proto_item *excepinfo_item;
proto_tree *excepinfo_tree;
offset = dissect_dcom_that(tvb, offset, pinfo, tree, drep);
offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, drep,
&u32Pointer);
if (u32Pointer) {
offset = dissect_dcom_VARIANT(tvb, offset, pinfo, tree, drep, hf_dispatch_varresult);
}
/* ExcepInfo */
excepinfo_item = proto_tree_add_item(tree, hf_dispatch_excepinfo, tvb, offset, 0, ENC_NA);
excepinfo_tree = proto_item_add_subtree (excepinfo_item, ett_dispatch_excepinfo);
u32SubStart = offset;
offset = dissect_dcom_WORD(tvb, offset, pinfo, excepinfo_tree, drep,
hf_dispatch_code, &u16Code);
offset = dissect_dcom_WORD(tvb, offset, pinfo, excepinfo_tree, drep,
hf_dispatch_reserved16, &u16Reserved);
offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, excepinfo_tree, drep,
&u32Pointer);
offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, excepinfo_tree, drep,
&u32Pointer2);
offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, excepinfo_tree, drep,
&u32Pointer3);
offset = dissect_dcom_DWORD(tvb, offset, pinfo, excepinfo_tree, drep,
hf_dispatch_help_context, &u32HelpContext);
offset = dissect_dcom_DWORD(tvb, offset, pinfo, excepinfo_tree, drep,
hf_dispatch_reserved32, &u32Reserved);
offset = dissect_dcom_DWORD(tvb, offset, pinfo, excepinfo_tree, drep,
hf_dispatch_deferred_fill_in, &u32DeferredFillIn);
offset = dissect_dcom_DWORD(tvb, offset, pinfo, excepinfo_tree, drep,
hf_dispatch_scode, &u32SCode);
if (u32Pointer) {
offset = dissect_dcom_BSTR(tvb, offset, pinfo, excepinfo_tree, drep,
hf_dispatch_source, szName, sizeof(szName));
}
if (u32Pointer2) {
offset = dissect_dcom_BSTR(tvb, offset, pinfo, excepinfo_tree, drep,
hf_dispatch_description, szName, sizeof(szName));
}
if (u32Pointer3) {
offset = dissect_dcom_BSTR(tvb, offset, pinfo, excepinfo_tree, drep,
hf_dispatch_help_file, szName, sizeof(szName));
}
proto_item_append_text(excepinfo_item, ", SCode: %s",
val_to_str(u32SCode, dcom_hresult_vals, "Unknown (0x%08x)"));
proto_item_set_len(excepinfo_item, offset - u32SubStart);
/* end of ExcepInfo */
offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, drep,
hf_dispatch_arg_err, &u32ArgErr);
/* rgVarRef: VARIANT[u32VarRef] */
offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, drep,
&u32ArraySize);
u32VarRef = u32ArraySize;
u32VariableOffset = offset + u32ArraySize * 4;
while(u32ArraySize--) {
offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, drep,
&u32Pointer);
if (u32Pointer) {
u32VariableOffset = dissect_dcom_VARIANT(tvb, u32VariableOffset, pinfo, tree, drep, hf_dispatch_varrefarg);
}
}
offset = u32VariableOffset;
/* HRESULT of call */
offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, drep,
&u32HResult);
col_append_fstr(pinfo->cinfo, COL_INFO, " SCode=%s VarRef=%u -> %s",
val_to_str(u32SCode, dcom_hresult_vals, "Unknown (0x%08x)"),
u32VarRef,
val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") );
//.........这里部分代码省略.........
示例5: dissect_control
static int
dissect_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
proto_item *pitem = NULL;
guint control_type;
guint8 unknown_control_type;
guint8 uuid_size;
guint16 uuid_dst;
guint16 uuid_src;
guint16 response_message;
guint16 list_length;
guint i_item;
proto_tree_add_item(tree, hf_btbnep_control_type, tvb, offset, 1, ENC_BIG_ENDIAN);
control_type = tvb_get_guint8(tvb, offset);
offset += 1;
col_append_fstr(pinfo->cinfo, COL_INFO, " - %s", val_to_str_const(control_type, control_type_vals, "Unknown type"));
switch(control_type) {
case 0x00: /* Command Not Understood */
proto_tree_add_item(tree, hf_btbnep_unknown_control_type, tvb, offset, 1, ENC_BIG_ENDIAN);
unknown_control_type = tvb_get_guint8(tvb, offset);
offset += 1;
col_append_fstr(pinfo->cinfo, COL_INFO, " - Unknown(%s)", val_to_str_const(unknown_control_type, control_type_vals, "Unknown type"));
break;
case 0x01: /* Setup Connection Request */
proto_tree_add_item(tree, hf_btbnep_uuid_size, tvb, offset, 1, ENC_BIG_ENDIAN);
uuid_size = tvb_get_guint8(tvb, offset);
offset += 1;
pitem = proto_tree_add_item(tree, hf_btbnep_destination_service_uuid, tvb, offset, uuid_size, ENC_NA);
uuid_dst = tvb_get_ntohs(tvb, offset);
proto_item_append_text(pitem, " (%s)", val_to_str_ext(uuid_dst, &bluetooth_uuid_vals_ext, "Unknown uuid"));
offset += uuid_size;
pitem = proto_tree_add_item(tree, hf_btbnep_source_service_uuid, tvb, offset, uuid_size, ENC_NA);
uuid_src = tvb_get_ntohs(tvb, offset);
proto_item_append_text(pitem, " (%s)", val_to_str_ext(uuid_src, &bluetooth_uuid_vals_ext, "Unknown uuid"));
offset += uuid_size;
col_append_fstr(pinfo->cinfo, COL_INFO, " - dst: <%s>, src: <%s>",
val_to_str_ext(uuid_dst, &bluetooth_uuid_vals_ext, "Unknown uuid"),
val_to_str_ext(uuid_src, &bluetooth_uuid_vals_ext, "Unknown uuid"));
break;
case 0x02: /* Setup Connection Response */
proto_tree_add_item(tree, hf_btbnep_setup_connection_response_message, tvb, offset, 2, ENC_BIG_ENDIAN);
response_message = tvb_get_ntohs(tvb, offset);
offset += 2;
col_append_fstr(pinfo->cinfo, COL_INFO, " - %s",
val_to_str_const(response_message, setup_connection_response_message_vals, "Unknown response message"));
break;
case 0x03: /* Filter Net Type Set */
proto_tree_add_item(tree, hf_btbnep_list_length, tvb, offset, 2, ENC_BIG_ENDIAN);
list_length = tvb_get_ntohs(tvb, offset);
offset += 2;
for (i_item = 0; i_item + 4 > i_item && i_item < list_length; i_item += 4) {
proto_tree_add_item(tree, hf_btbnep_network_type_start, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(tree, hf_btbnep_network_type_end, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
}
break;
case 0x04: /* Filter Net Type Response */
proto_tree_add_item(tree, hf_btbnep_filter_net_type_response_message, tvb, offset, 2, ENC_BIG_ENDIAN);
response_message = tvb_get_ntohs(tvb, offset);
offset += 2;
col_append_fstr(pinfo->cinfo, COL_INFO, " - %s",
val_to_str_const(response_message, filter_net_type_response_message_vals, "Unknown response message"));
break;
case 0x05: /*Filter Multi Addr Set*/
proto_tree_add_item(tree, hf_btbnep_list_length, tvb, offset, 2, ENC_BIG_ENDIAN);
list_length = tvb_get_ntohs(tvb, offset);
offset += 2;
for (i_item = 0; i_item + 12 > i_item && i_item < list_length; i_item += 12) {
proto_tree_add_item(tree, hf_btbnep_multicast_address_start, tvb, offset, 6, ENC_NA);
offset += 6;
proto_tree_add_item(tree, hf_btbnep_multicast_address_end, tvb, offset, 6, ENC_NA);
offset += 6;
}
break;
case 0x06: /* Filter Multi Addr Response */
proto_tree_add_item(tree, hf_btbnep_filter_multi_addr_response_message, tvb, offset, 2, ENC_BIG_ENDIAN);
response_message = tvb_get_ntohs(tvb, offset);
offset += 2;
col_append_fstr(pinfo->cinfo, COL_INFO, " - %s",
val_to_str_const(response_message, filter_multi_addr_response_message_vals, "Unknown response message"));
break;
};
return offset;
}
示例6: add_option_info
static int
add_option_info(tvbuff_t *tvb, int pos, proto_tree *tree, proto_item *ti)
{
guint8 tag, length, fcs_err = 0, encr = 0, seen_fcs_err = 0;
proto_tree *tag_tree;
/*
* Read all option tags in an endless loop. If the packet is malformed this
* loop might be a problem.
*/
while (TRUE) {
tag = tvb_get_guint8(tvb, pos);
if ((tag != TZSP_HDR_PAD) && (tag != TZSP_HDR_END)) {
length = tvb_get_guint8(tvb, pos+1);
tag_tree = proto_tree_add_subtree(tree, tvb, pos, 2+length, ett_tag, NULL, val_to_str_const(tag, option_tag_vals, "Unknown"));
} else {
tag_tree = proto_tree_add_subtree(tree, tvb, pos, 1, ett_tag, NULL, val_to_str_const(tag, option_tag_vals, "Unknown"));
length = 0;
}
proto_tree_add_item(tag_tree, hf_option_tag, tvb, pos, 1, ENC_BIG_ENDIAN);
pos++;
if ((tag != TZSP_HDR_PAD) && (tag != TZSP_HDR_END)) {
proto_tree_add_item(tag_tree, hf_option_length, tvb, pos, 1, ENC_BIG_ENDIAN);
pos++;
}
switch (tag) {
case TZSP_HDR_PAD:
break;
case TZSP_HDR_END:
/* Fill in header with information from other tags. */
if (seen_fcs_err) {
proto_item_append_text(ti,"%s", fcs_err?"FCS Error":(encr?"Encrypted":"Good"));
}
return pos;
case TZSP_HDR_ORIGINAL_LENGTH:
proto_tree_add_item(tag_tree, hf_original_length, tvb, pos, 2, ENC_BIG_ENDIAN);
break;
case WLAN_RADIO_HDR_SIGNAL:
proto_tree_add_item(tag_tree, hf_signal, tvb, pos, 1, ENC_BIG_ENDIAN);
break;
case WLAN_RADIO_HDR_NOISE:
proto_tree_add_item(tag_tree, hf_silence, tvb, pos, 1, ENC_BIG_ENDIAN);
break;
case WLAN_RADIO_HDR_RATE:
proto_tree_add_item(tag_tree, hf_rate, tvb, pos, 1, ENC_BIG_ENDIAN);
break;
case WLAN_RADIO_HDR_TIMESTAMP:
proto_tree_add_item(tag_tree, hf_time, tvb, pos, 4, ENC_BIG_ENDIAN);
break;
case WLAN_RADIO_HDR_MSG_TYPE:
proto_tree_add_item(tag_tree, hf_status_msg_type, tvb, pos, 1, ENC_BIG_ENDIAN);
break;
case WLAN_RADIO_HDR_CF:
proto_tree_add_item(tag_tree, hf_status_pcf, tvb, pos, 1, ENC_NA);
break;
case WLAN_RADIO_HDR_UN_DECR:
proto_tree_add_item(tag_tree, hf_status_undecrypted, tvb, pos, 1, ENC_NA);
encr = tvb_get_guint8(tvb, pos);
break;
case WLAN_RADIO_HDR_FCS_ERR:
seen_fcs_err = 1;
proto_tree_add_item(tag_tree, hf_status_fcs_error, tvb, pos, 1, ENC_NA);
fcs_err = tvb_get_guint8(tvb, pos);
break;
case WLAN_RADIO_HDR_CHANNEL:
proto_tree_add_item(tag_tree, hf_channel, tvb, pos, 1, ENC_BIG_ENDIAN);
break;
case TZSP_HDR_SENSOR:
proto_tree_add_item(tag_tree, hf_sensormac, tvb, pos, 6, ENC_NA);
break;
default:
proto_tree_add_item(tag_tree, hf_unknown, tvb, pos, length, ENC_NA);
break;
}
pos += length;
}
}
示例7: dissect_IDispatch_Invoke_rqst
int
dissect_IDispatch_Invoke_rqst(tvbuff_t *tvb, int offset,
packet_info *pinfo, proto_tree *tree, guint8 *drep)
{
guint32 u32DispIdMember;
e_uuid_t riid;
guint32 u32Lcid;
guint32 u32Flags;
guint32 u32Args;
guint32 u32NamedArgs;
guint32 u32Pointer;
guint32 u32Pointer2;
guint32 u32ArraySize;
guint32 u32VariableOffset;
guint32 u32VarRef;
guint32 u32VarRefIdx;
guint32 u32TmpOffset;
guint32 u32SubStart;
proto_item *feature_item;
proto_tree *feature_tree;
proto_item *dispparams_item;
proto_tree *dispparams_tree;
offset = dissect_dcom_this(tvb, offset, pinfo, tree, drep);
offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, drep,
hf_dispatch_id, &u32DispIdMember);
col_append_fstr(pinfo->cinfo, COL_INFO, " ID=0x%x", u32DispIdMember);
offset = dissect_dcom_UUID(tvb, offset, pinfo, tree, drep,
hf_dispatch_riid, &riid);
offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, drep,
hf_dispatch_lcid, &u32Lcid);
/* dispatch flags */
u32TmpOffset = dissect_dcom_DWORD(tvb, offset, pinfo, NULL, drep,
hf_dispatch_flags, &u32Flags);
feature_item = proto_tree_add_uint (tree, hf_dispatch_flags, tvb, offset, 4, u32Flags);
feature_tree = proto_item_add_subtree (feature_item, ett_dispatch_flags);
if (feature_tree) {
proto_tree_add_boolean (feature_tree, hf_dispatch_flags_propputref, tvb, offset, 4, u32Flags);
proto_tree_add_boolean (feature_tree, hf_dispatch_flags_propput, tvb, offset, 4, u32Flags);
proto_tree_add_boolean (feature_tree, hf_dispatch_flags_propget, tvb, offset, 4, u32Flags);
proto_tree_add_boolean (feature_tree, hf_dispatch_flags_method, tvb, offset, 4, u32Flags);
}
if (u32Flags & DISPATCH_FLAGS_METHOD) {
proto_item_append_text(feature_item, ", Method");
col_append_str(pinfo->cinfo, COL_INFO, " Method");
}
if (u32Flags & DISPATCH_FLAGS_PROPGET) {
proto_item_append_text(feature_item, ", PropertyGet");
col_append_str(pinfo->cinfo, COL_INFO, " PropertyGet");
}
if (u32Flags & DISPATCH_FLAGS_PROPPUT) {
proto_item_append_text(feature_item, ", PropertyPut");
col_append_str(pinfo->cinfo, COL_INFO, " PropertyPut");
}
if (u32Flags & DISPATCH_FLAGS_PROPPUTREF) {
proto_item_append_text(feature_item, ", PropertyPutRef");
col_append_str(pinfo->cinfo, COL_INFO, " PropertyPutRef");
}
offset = u32TmpOffset;
dispparams_item = proto_tree_add_item(tree, hf_dispatch_dispparams, tvb, offset, 0, ENC_NA);
dispparams_tree = proto_item_add_subtree (dispparams_item, ett_dispatch_params);
u32SubStart = offset;
/* DISPPARAMS */
/* VARIANT rgvarg[u32Args] */
offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, dispparams_tree, drep,
&u32Pointer);
/* DISPID rgdispidNamedArgs[u32NamedArgs] */
offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, dispparams_tree, drep,
&u32Pointer2);
offset = dissect_dcom_DWORD(tvb, offset, pinfo, dispparams_tree, drep,
hf_dispatch_args, &u32Args);
offset = dissect_dcom_DWORD(tvb, offset, pinfo, dispparams_tree, drep,
hf_dispatch_named_args, &u32NamedArgs);
if (u32Pointer) {
offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, dispparams_tree, drep,
&u32ArraySize);
u32VariableOffset = offset + u32ArraySize * 4;
while(u32ArraySize--) {
offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, dispparams_tree, drep,
&u32Pointer);
if (u32Pointer) {
u32VariableOffset = dissect_dcom_VARIANT(tvb, u32VariableOffset, pinfo, dispparams_tree, drep, hf_dispatch_arg);
}
}
offset = u32VariableOffset;
}
/* DISPID rgdispidNamedArgs[u32NamedArgs] */
//.........这里部分代码省略.........
示例8: dissect_rsp_flags
static void
dissect_rsp_flags(proto_tree *parent_tree, tvbuff_t *tvb, int offset)
{
proto_item *item;
proto_tree *tree;
gboolean bidi_resid_present = FALSE;
guint8 flags;
item = proto_tree_add_item(parent_tree, hf_fcp_rspflags, tvb, offset, 1, ENC_LITTLE_ENDIAN);
tree = proto_item_add_subtree(item, ett_fcp_rsp_flags);
flags = tvb_get_guint8(tvb, offset);
if (!flags)
proto_item_append_text(item, " (No values set)");
/* BIDI RSP */
proto_tree_add_boolean(tree, hf_fcp_rsp_flags_bidi, tvb, offset, 1, flags);
if (flags & 0x80) {
bidi_resid_present = TRUE;
proto_item_append_text(item, " BIDI_RSP");
if (flags & (~( 0x80 )))
proto_item_append_text(item, ",");
}
flags &= (~( 0x80 ));
/* these two bits are only defined if the bidi bit is set */
if (bidi_resid_present) {
/* BIDI READ RESID UNDER */
proto_tree_add_boolean(tree, hf_fcp_rsp_flags_bidi_rru, tvb, offset, 1, flags);
if (flags & 0x40) {
proto_item_append_text(item, " BIDI_RRU");
if (flags & (~( 0x40 )))
proto_item_append_text(item, ",");
}
flags &= (~( 0x40 ));
/* BIDI READ RESID OVER */
proto_tree_add_boolean(tree, hf_fcp_rsp_flags_bidi_rro, tvb, offset, 1, flags);
if (flags & 0x20) {
proto_item_append_text(item, " BIDI_RRO");
if (flags & (~( 0x20 )))
proto_item_append_text(item, ",");
}
flags &= (~( 0x20 ));
}
/* Conf Req */
proto_tree_add_boolean(tree, hf_fcp_rsp_flags_conf_req, tvb, offset, 1, flags);
if (flags & 0x10) {
proto_item_append_text(item, " CONF REQ");
if (flags & (~( 0x10 )))
proto_item_append_text(item, ",");
}
flags &= (~( 0x10 ));
/* Resid Under */
proto_tree_add_boolean(tree, hf_fcp_rsp_flags_resid_under, tvb, offset, 1, flags);
if (flags & 0x08) {
proto_item_append_text(item, " RESID UNDER");
if (flags & (~( 0x08 )))
proto_item_append_text(item, ",");
}
flags &= (~( 0x08 ));
/* Resid Over */
proto_tree_add_boolean(tree, hf_fcp_rsp_flags_resid_over, tvb, offset, 1, flags);
if (flags & 0x04) {
proto_item_append_text(item, " RESID OVER");
if (flags & (~( 0x04 )))
proto_item_append_text(item, ",");
}
flags &= (~( 0x04 ));
/* SNS len valid */
proto_tree_add_boolean(tree, hf_fcp_rsp_flags_sns_vld, tvb, offset, 1, flags);
if (flags & 0x02) {
proto_item_append_text(item, " SNS VLD");
if (flags & (~( 0x02 )))
proto_item_append_text(item, ",");
}
flags &= (~( 0x02 ));
/* rsp len valid */
proto_tree_add_boolean(tree, hf_fcp_rsp_flags_res_vld, tvb, offset, 1, flags);
if (flags & 0x01) {
proto_item_append_text(item, " RES VLD");
if (flags & (~( 0x01 )))
proto_item_append_text(item, ",");
}
flags &= (~( 0x01 ));
if (flags) {
proto_item_append_text(item, " Unknown bitmap value 0x%x", flags);
}
}
示例9: dissect_task_mgmt_flags
static void
dissect_task_mgmt_flags(packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb, int offset)
{
proto_item *item;
proto_tree *tree;
guint8 flags;
item = proto_tree_add_item(parent_tree, hf_fcp_taskmgmt, tvb, offset, 1, ENC_LITTLE_ENDIAN);
tree = proto_item_add_subtree(item, ett_fcp_taskmgmt);
flags = tvb_get_guint8(tvb, offset);
if (!flags)
proto_item_append_text(item, " (No values set)");
proto_tree_add_boolean(tree, hf_fcp_mgmt_flags_obsolete, tvb, offset, 1, flags);
if (flags & 0x80) {
proto_item_append_text(item, " OBSOLETE");
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[FCP OBSOLETE] ");
}
flags &= (~( 0x80 ));
proto_tree_add_boolean(tree, hf_fcp_mgmt_flags_clear_aca, tvb, offset, 1, flags);
if (flags & 0x40) {
proto_item_append_text(item, " CLEAR ACA");
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[FCP CLEAR_ACA] ");
}
flags &= (~( 0x40 ));
proto_tree_add_boolean(tree, hf_fcp_mgmt_flags_target_reset, tvb, offset, 1, flags);
if (flags & 0x20) {
proto_item_append_text(item, " TARGET RESET");
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[FCP TARGET_RESET] ");
}
flags &= (~( 0x20 ));
proto_tree_add_boolean(tree, hf_fcp_mgmt_flags_lu_reset, tvb, offset, 1, flags);
if (flags & 0x10) {
proto_item_append_text(item, " LU RESET");
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[FCP LU_RESET] ");
}
flags &= (~( 0x10 ));
proto_tree_add_boolean(tree, hf_fcp_mgmt_flags_rsvd, tvb, offset, 1, flags);
if (flags & 0x08) {
proto_item_append_text(item, " RSVD");
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[FCP RSVD] ");
}
flags &= (~( 0x08 ));
proto_tree_add_boolean(tree, hf_fcp_mgmt_flags_clear_task_set, tvb, offset, 1, flags);
if (flags & 0x04) {
proto_item_append_text(item, " CLEAR TASK SET");
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[FCP CLEAR_TASK_SET] ");
}
flags &= (~( 0x04 ));
proto_tree_add_boolean(tree, hf_fcp_mgmt_flags_abort_task_set, tvb, offset, 1, flags);
if (flags & 0x02) {
proto_item_append_text(item, " ABORT TASK SET");
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[FCP ABORT_TASK_SET] ");
}
flags &= (~( 0x02 ));
if (flags) {
proto_item_append_text(item, " Unknown bitmap value 0x%x", flags);
}
}
示例10: add_option_info
static int
add_option_info(tvbuff_t *tvb, int pos, proto_tree *tree, proto_item *ti)
{
guint8 tag, length, fcs_err = 0, encr = 0, seen_fcs_err = 0;
/*
* Read all option tags in an endless loop. If the packet is malformed this
* loop might be a problem.
*/
while (TRUE) {
tag = tvb_get_guint8(tvb, pos++);
switch (tag) {
case TZSP_HDR_PAD:
length = 0;
break;
case TZSP_HDR_END:
/* Fill in header with information from other tags. */
if (seen_fcs_err) {
if (tree)
proto_item_append_text(ti,"%s", fcs_err?"FCS Error":(encr?"Encrypted":"Good"));
}
return pos;
case TZSP_HDR_ORIGINAL_LENGTH:
length = tvb_get_guint8(tvb, pos++);
if (tree)
proto_tree_add_int (tree, hf_original_length, tvb, pos-2, 4,
tvb_get_ntohs(tvb, pos));
pos += length;
break;
case WLAN_RADIO_HDR_SIGNAL:
length = tvb_get_guint8(tvb, pos++);
if (tree)
proto_tree_add_int (tree, hf_signal, tvb, pos-2, 3,
(char)tvb_get_guint8(tvb, pos));
pos += length;
break;
case WLAN_RADIO_HDR_NOISE:
length = tvb_get_guint8(tvb, pos++);
if (tree)
proto_tree_add_int (tree, hf_silence, tvb, pos-2, 3,
(char)tvb_get_guint8(tvb, pos));
pos += length;
break;
case WLAN_RADIO_HDR_RATE:
length = tvb_get_guint8(tvb, pos++);
if (tree)
proto_tree_add_uint (tree, hf_rate, tvb, pos-2, 3,
tvb_get_guint8(tvb, pos));
pos += length;
break;
case WLAN_RADIO_HDR_TIMESTAMP:
length = tvb_get_guint8(tvb, pos++);
if (tree)
proto_tree_add_uint (tree, hf_time, tvb, pos-2, 6,
tvb_get_ntohl(tvb, pos));
pos += length;
break;
case WLAN_RADIO_HDR_MSG_TYPE:
length = tvb_get_guint8(tvb, pos++);
if (tree)
proto_tree_add_uint (tree, hf_status_msg_type, tvb, pos-2, 3,
tvb_get_guint8(tvb, pos));
pos += length;
break;
case WLAN_RADIO_HDR_CF:
length = tvb_get_guint8(tvb, pos++);
if (tree)
proto_tree_add_boolean (tree, hf_status_pcf, tvb, pos-2, 3,
tvb_get_guint8(tvb, pos));
pos += length;
break;
case WLAN_RADIO_HDR_UN_DECR:
length = tvb_get_guint8(tvb, pos++);
if (tree)
proto_tree_add_boolean (tree, hf_status_undecrypted, tvb, pos-2, 3,
tvb_get_guint8(tvb, pos));
encr = tvb_get_guint8(tvb, pos);
pos += length;
break;
case WLAN_RADIO_HDR_FCS_ERR:
seen_fcs_err = 1;
length = tvb_get_guint8(tvb, pos++);
if (tree)
proto_tree_add_boolean (tree, hf_status_fcs_error, tvb, pos-2, 3,
tvb_get_guint8(tvb, pos));
fcs_err = tvb_get_guint8(tvb, pos);
pos += length;
break;
//.........这里部分代码省略.........
示例11: usbip_dissect_urb
//.........这里部分代码省略.........
usbip_trans->devid = devid;
usbip_trans->dir = dir;
usbip_trans->ep = ep;
usbip_trans->seqnum = seqnum;
usbip_trans->cmd_frame = pinfo->num;
usbip_trans->ret_frame = 0;
usbip_trans->unlink_seqnum = 0;
wmem_tree_insert32(usbip_info->pdus, seqnum, (void *) usbip_trans);
} else {
usbip_trans = (usbip_transaction_t *) wmem_tree_lookup32(usbip_info->pdus, seqnum);
if (usbip_trans)
usbip_trans->ret_frame = pinfo->num;
}
} else {
usbip_trans = (usbip_transaction_t *) wmem_tree_lookup32(usbip_info->pdus, seqnum);
}
if (!usbip_trans) {
usbip_trans = wmem_new(wmem_packet_scope(), usbip_transaction_t);
usbip_trans->cmd_frame = 0;
usbip_trans->ret_frame = 0;
usbip_trans->devid = 0;
usbip_trans->unlink_seqnum = 0;
usbip_trans->seqnum = seqnum;
}
/* only the OP_CMD_SUBMIT has a valid devid - in all other case we have to restore it from the transaction */
if (command == OP_RET_SUBMIT || command == OP_RET_UNLINK) {
devid = usbip_trans->devid;
ep = usbip_trans->ep;
dir = usbip_trans->dir;
}
ti = proto_tree_add_uint(tree, hf_usbip_cmd_frame, NULL, 0, 0,
usbip_trans->cmd_frame);
PROTO_ITEM_SET_GENERATED(ti);
ti = proto_tree_add_uint(tree, hf_usbip_ret_frame, NULL, 0, 0,
usbip_trans->ret_frame);
PROTO_ITEM_SET_GENERATED(ti);
ti = proto_tree_add_uint(tree, hf_usbip_devid, NULL, 0, 0, devid);
PROTO_ITEM_SET_GENERATED(ti);
ti = proto_tree_add_uint(tree, hf_usbip_direction, NULL, 0, 0, dir);
PROTO_ITEM_SET_GENERATED(ti);
ti = proto_tree_add_uint(tree, hf_usbip_ep, NULL, 0, 0, ep);
PROTO_ITEM_SET_GENERATED(ti);
proto_tree_add_item(tree, hf_usbip_devid, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_usbip_direction, tvb, offset, 4,
ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_usbip_ep, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
header.ep = ep;
header.dir = dir;
header.devid = devid & 0x00ff;
header.busid = devid >> 16;
switch (command) {
case OP_CMD_SUBMIT:
offset = dissect_cmd_submit(pinfo, tree, tvb, offset);
dissect_usb_common(tvb, pinfo, orig, USB_HEADER_USBIP, &header);
break;
case OP_CMD_UNLINK:
offset = dissect_cmd_unlink(pinfo, tree, tvb, offset, usbip_info,
usbip_trans);
break;
case OP_RET_SUBMIT: {
guint32 status;
status = tvb_get_ntohl(tvb, offset);
offset = dissect_ret_submit(pinfo, tree, tvb, offset);
if (status == 0)
dissect_usb_common(tvb, pinfo, orig, USB_HEADER_USBIP, &header);
break;
}
case OP_RET_UNLINK:
offset = dissect_ret_unlink(pinfo, tree, tvb, offset, usbip_info,
usbip_trans->unlink_seqnum);
break;
default:
proto_tree_add_item(tree, hf_usbip_urb_data, tvb, offset, -1, ENC_NA);
offset = tvb_reported_length_remaining(tvb, offset);
expert_add_info_format(
pinfo, ti, &ei_usbip,
"Dissector for USBIP Command"
" (%x) code not implemented, Contact"
" Wireshark developers if you want this supported",
command);
proto_item_append_text(ti, ": Undecoded");
break;
}
return offset;
}
示例12: dissect_zep
//.........这里部分代码省略.........
}
else {
/* Although, only type 1 corresponds to data, if another value is present, assume it is dissected the same. */
zep_header_len = ZEP_V2_HEADER_LEN;
zep_data.channel_id = tvb_get_guint8(tvb, 4);
zep_data.device_id = tvb_get_ntohs(tvb, 5);
zep_data.lqi_mode = tvb_get_guint8(tvb, 7)?1:0;
zep_data.lqi = tvb_get_guint8(tvb, 8);
ntp_to_nstime(tvb, 9, &(zep_data.ntp_time));
zep_data.seqno = tvb_get_ntohl(tvb, 17);
ieee_packet_len = (tvb_get_guint8(tvb, ZEP_V2_HEADER_LEN - 1) & ZEP_LENGTH_MASK);
}
}
#if 0
/*??dat*/
if (zep_data.ntp_time.secs && zep_data.ntp_time.nsecs) {
pinfo->fd->abs_ts = zep_data.ntp_time;
}
#endif
if(ieee_packet_len < tvb_length(tvb)-zep_header_len){
/* Packet's length is mis-reported, abort dissection */
call_dissector(data_handle, tvb, pinfo, tree);
return;
}
/* Enter name info protocol field */
col_set_str(pinfo->cinfo, COL_PROTOCOL, (zep_data.version==1)?"ZEP":"ZEPv2");
/* Enter name info protocol field */
if (!((zep_data.version>=2) && (zep_data.type==ZEP_V2_TYPE_ACK)))
col_add_fstr(pinfo->cinfo, COL_INFO, "Encapsulated ZigBee Packet [Channel]=%i [Length]=%i", zep_data.channel_id, ieee_packet_len);
else
col_add_fstr(pinfo->cinfo, COL_INFO, "Ack, Sequence Number: %i", zep_data.seqno);
if(tree){
/* Create subtree for the ZEP Header */
if (!((zep_data.version>=2) && (zep_data.type==ZEP_V2_TYPE_ACK))) {
proto_root = proto_tree_add_protocol_format(tree, proto_zep, tvb, 0, zep_header_len, "ZigBee Encapsulation Protocol, Channel: %i, Length: %i", zep_data.channel_id, ieee_packet_len);
}
else {
proto_root = proto_tree_add_protocol_format(tree, proto_zep, tvb, 0, zep_header_len, "ZigBee Encapsulation Protocol, Ack");
}
zep_tree = proto_item_add_subtree(proto_root, ett_zep);
/* Display the information in the subtree */
proto_tree_add_text(zep_tree, tvb, 0, 2, "Protocol ID String: EX");
if (zep_data.version==1) {
proto_tree_add_uint(zep_tree, hf_zep_version, tvb, 2, 1, zep_data.version);
proto_tree_add_uint(zep_tree, hf_zep_channel_id, tvb, 3, 1, zep_data.channel_id);
proto_tree_add_uint(zep_tree, hf_zep_device_id, tvb, 4, 2, zep_data.device_id);
proto_tree_add_boolean_format(zep_tree, hf_zep_lqi_mode, tvb, 6, 1, zep_data.lqi_mode, "LQI/CRC Mode: %s", zep_data.lqi_mode?"CRC":"LQI");
if(!(zep_data.lqi_mode)){
proto_tree_add_uint(zep_tree, hf_zep_lqi, tvb, 7, 1, zep_data.lqi);
}
proto_tree_add_text(zep_tree, tvb, 7+((zep_data.lqi_mode)?0:1), 7+((zep_data.lqi_mode)?1:0), "Reserved Fields");
}
else {
proto_tree_add_uint(zep_tree, hf_zep_version, tvb, 2, 1, zep_data.version);
if (zep_data.type == ZEP_V2_TYPE_ACK) {
proto_tree_add_uint_format_value(zep_tree, hf_zep_type, tvb, 3, 1, zep_data.type, "%i (Ack)", ZEP_V2_TYPE_ACK);
proto_tree_add_uint(zep_tree, hf_zep_seqno, tvb, 4, 4, zep_data.seqno);
}
else {
proto_tree_add_uint_format_value(zep_tree, hf_zep_type, tvb, 3, 1, zep_data.type, "%i (%s)", zep_data.type, (zep_data.type==ZEP_V2_TYPE_DATA)?"Data":"Reserved");
proto_tree_add_uint(zep_tree, hf_zep_channel_id, tvb, 4, 1, zep_data.channel_id);
proto_tree_add_uint(zep_tree, hf_zep_device_id, tvb, 5, 2, zep_data.device_id);
proto_tree_add_boolean_format(zep_tree, hf_zep_lqi_mode, tvb, 7, 1, zep_data.lqi_mode, "LQI/CRC Mode: %s", zep_data.lqi_mode?"CRC":"LQI");
if(!(zep_data.lqi_mode)){
proto_tree_add_uint(zep_tree, hf_zep_lqi, tvb, 8, 1, zep_data.lqi);
}
pi = proto_tree_add_time(zep_tree, hf_zep_timestamp, tvb, 9, 8, &(zep_data.ntp_time));
proto_item_append_text(pi, " (%ld.%09ds)", (long)zep_data.ntp_time.secs, zep_data.ntp_time.nsecs);
proto_tree_add_uint(zep_tree, hf_zep_seqno, tvb, 17, 4, zep_data.seqno);
}
}
if (!((zep_data.version==2) && (zep_data.type==ZEP_V2_TYPE_ACK))) proto_tree_add_uint_format_value(zep_tree, hf_zep_ieee_length, tvb, zep_header_len - 1, 1, ieee_packet_len, "%i %s", ieee_packet_len, (ieee_packet_len==1)?"Byte":"Bytes");
}
/* Determine which dissector to call next. */
if (zep_data.lqi_mode) {
/* CRC present, use standard IEEE dissector. */
next_dissector = ieee802154_handle;
}
else {
/* ChipCon compliant FCS present. */
next_dissector = ieee802154_ccfcs_handle;
}
if (!next_dissector) {
/* IEEE 802.15.4 dissectors couldn't be found. */
next_dissector = data_handle;
}
/* Call the IEEE 802.15.4 dissector */
if (!((zep_data.version>=2) && (zep_data.type==ZEP_V2_TYPE_ACK))) {
next_tvb = tvb_new_subset(tvb, zep_header_len, ieee_packet_len, ieee_packet_len);
call_dissector(next_dissector, next_tvb, pinfo, tree);
}
} /* dissect_ieee802_15_4 */
示例13: dissect_soupbintcp_common
//.........这里部分代码省略.........
} else {
this_seq = 0;
}
pdu_data = (struct pdu_data *)wmem_alloc(
wmem_file_scope(),
sizeof(struct pdu_data));
pdu_data->seq_num = this_seq;
p_add_proto_data(pinfo->fd, proto_soupbintcp, 0, pdu_data);
}
} else {
pdu_data = (struct pdu_data *)p_get_proto_data(
pinfo->fd,
proto_soupbintcp, 0);
if (pdu_data) {
this_seq = pdu_data->seq_num;
} else {
this_seq = 0;
}
}
col_append_fstr(pinfo->cinfo, COL_INFO, ", SeqNum = %u", this_seq);
}
if (tree) {
/* Create sub-tree for SoupBinTCP details */
ti = proto_tree_add_item(tree,
proto_soupbintcp,
tvb, 0, -1, FALSE);
soupbintcp_tree = proto_item_add_subtree(ti, ett_soupbintcp);
/* Append the packet name to the sub-tree item */
proto_item_append_text(ti, ", %s", pkt_name);
/* Length */
proto_tree_add_item(soupbintcp_tree,
hf_soupbintcp_packet_length,
tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* Type */
proto_tree_add_item(soupbintcp_tree,
hf_soupbintcp_packet_type,
tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
switch (pkt_type) {
case '+': /* Debug Message */
proto_tree_add_item(soupbintcp_tree,
hf_soupbintcp_text,
tvb, offset, expected_len - 1, ENC_ASCII|ENC_NA);
break;
case 'A': /* Login Accept */
proto_tree_add_item(soupbintcp_tree,
hf_soupbintcp_session,
tvb, offset, 10, ENC_ASCII|ENC_NA);
offset += 10;
tmp_buf = tvb_get_ephemeral_string(tvb, offset, 20);
proto_tree_add_string_format_value(soupbintcp_tree,
hf_soupbintcp_next_seq_num,
tvb, offset, 20,
"X", "%d", atoi(tmp_buf));
break;
示例14: dissect_status
static void
dissect_status (packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint8 flags)
{
proto_item *item=NULL;
proto_tree *tree=NULL;
if(parent_tree){
item=proto_tree_add_uint(parent_tree, hf_sbccs_dib_status,
tvb, offset, 1, flags);
tree=proto_item_add_subtree(item, ett_sbccs_dib_status);
}
proto_tree_add_boolean(tree, hf_sbccs_dib_status_attention, tvb, offset, 1, flags);
if (flags&0x80){
proto_item_append_text(item, " Attention");
if (check_col(pinfo->cinfo, COL_INFO)) {
col_append_str(pinfo->cinfo, COL_INFO, " Attention");
}
}
flags&=(~( 0x80 ));
proto_tree_add_boolean(tree, hf_sbccs_dib_status_modifier, tvb, offset, 1, flags);
if (flags&0x40){
proto_item_append_text(item, " Status Modifier");
if (check_col(pinfo->cinfo, COL_INFO)) {
col_append_str(pinfo->cinfo, COL_INFO, " Status Modifier");
}
}
flags&=(~( 0x40 ));
proto_tree_add_boolean(tree, hf_sbccs_dib_status_cue, tvb, offset, 1, flags);
if (flags&0x20){
proto_item_append_text(item, " Control-Unit End");
if (check_col(pinfo->cinfo, COL_INFO)) {
col_append_str(pinfo->cinfo, COL_INFO, " Control-Unit End");
}
}
flags&=(~( 0x20 ));
proto_tree_add_boolean(tree, hf_sbccs_dib_status_busy, tvb, offset, 1, flags);
if (flags&0x10){
proto_item_append_text(item, " Busy");
if (check_col(pinfo->cinfo, COL_INFO)) {
col_append_str(pinfo->cinfo, COL_INFO, " Busy");
}
}
flags&=(~( 0x10 ));
proto_tree_add_boolean(tree, hf_sbccs_dib_status_channelend, tvb, offset, 1, flags);
if (flags&0x08){
proto_item_append_text(item, " Channel End");
if (check_col(pinfo->cinfo, COL_INFO)) {
col_append_str(pinfo->cinfo, COL_INFO, " Channel End");
}
}
flags&=(~( 0x08 ));
proto_tree_add_boolean(tree, hf_sbccs_dib_status_deviceend, tvb, offset, 1, flags);
if (flags&0x04){
proto_item_append_text(item, " Device End");
if (check_col(pinfo->cinfo, COL_INFO)) {
col_append_str(pinfo->cinfo, COL_INFO, " Device End");
}
}
flags&=(~( 0x04 ));
proto_tree_add_boolean(tree, hf_sbccs_dib_status_unit_check, tvb, offset, 1, flags);
if (flags&0x02){
proto_item_append_text(item, " Unit Check");
if (check_col(pinfo->cinfo, COL_INFO)) {
col_append_str(pinfo->cinfo, COL_INFO, " Unit Check");
}
}
flags&=(~( 0x02 ));
proto_tree_add_boolean(tree, hf_sbccs_dib_status_unit_exception, tvb, offset, 1, flags);
if (flags&0x01){
proto_item_append_text(item, " Unit Exception");
if (check_col(pinfo->cinfo, COL_INFO)) {
col_append_str(pinfo->cinfo, COL_INFO, " Unit Exception");
}
}
flags&=(~( 0x01 ));
}
示例15: dissect_control
static gint
dissect_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
gint offset, gboolean is_client_message)
{
/* flow: reqests: only client -> server; responses: only server -> */
proto_item *pitem;
guint16 control_pdu_id;
guint credits;
guint timeout;
guint context_id;
guint notification_register;
guint number;
gint parameter_length;
pitem = proto_tree_add_item(tree, hf_bthcrp_control_pdu_id, tvb, offset, 2, ENC_BIG_ENDIAN);
control_pdu_id = tvb_get_ntohs(tvb, offset);
offset += 2;
col_append_fstr(pinfo->cinfo, COL_INFO, "Control: %s %s",
((is_client_message) ? "Request" : "Response"),
val_to_str(control_pdu_id, control_pdu_id_vals, "Unknown PDU ID"));
if (control_pdu_id >= 0x8000) {
proto_item_append_text(pitem, " (Vendor Specific)");
col_append_str(pinfo->cinfo, COL_INFO, " (Vendor Specific)");
} else if (control_pdu_id == 0x0000 || control_pdu_id >= 0x000B ) {
proto_item_append_text(pitem, " (Reserved)");
col_append_str(pinfo->cinfo, COL_INFO, " (Reserved)");
}
proto_tree_add_item(tree, hf_bthcrp_control_transaction_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
pitem = proto_tree_add_item(tree, hf_bthcrp_control_parameter_length, tvb, offset, 2, ENC_BIG_ENDIAN);
parameter_length = tvb_get_ntohs(tvb, offset);
offset += 2;
if (!is_client_message && parameter_length < 2) {
expert_add_info_format(pinfo, pitem, &ei_bthcrp_control_parameter_length,
"Parameter length is shorter than 2 in response");
}
if (parameter_length < tvb_reported_length_remaining(tvb, offset)) {
expert_add_info_format(pinfo, pitem, &ei_bthcrp_control_parameter_length,
"Parameter length is shorter than payload length");
} else if (parameter_length > tvb_reported_length_remaining(tvb, offset)) {
expert_add_info_format(pinfo, pitem, &ei_bthcrp_control_parameter_length,
"Parameter length is larger than payload length");
}
if (!is_client_message) {
proto_tree_add_item(tree, hf_bthcrp_control_status, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
}
if (control_pdu_id >= 0x8000) {
if (tvb_reported_length_remaining(tvb, offset)) {
proto_tree_add_item(tree, hf_bthcrp_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
offset += tvb_reported_length_remaining(tvb, offset);
}
} else switch(control_pdu_id) {
case 0x0001: /* CR_DataChannelCreditGrant */
if (is_client_message) {
proto_tree_add_item(tree, hf_bthcrp_control_client_credit_granted, tvb, offset, 4, ENC_BIG_ENDIAN);
credits = tvb_get_ntohl(tvb, offset);
col_append_fstr(pinfo->cinfo, COL_INFO, " - CreditGranted: %u", credits);
offset += 4;
}
break;
case 0x0002: /* CR_DataChannelCreditRequest */
if (!is_client_message) {
proto_tree_add_item(tree, hf_bthcrp_control_server_credit_granted, tvb, offset, 4, ENC_BIG_ENDIAN);
credits = tvb_get_ntohl(tvb, offset);
col_append_fstr(pinfo->cinfo, COL_INFO, " - CreditGranted: %u", credits);
offset += 4;
}
break;
case 0x0003: /* CR_DataChannelCreditReturn */
if (is_client_message) {
proto_tree_add_item(tree, hf_bthcrp_control_client_credit_return, tvb, offset, 4, ENC_BIG_ENDIAN);
credits = tvb_get_ntohl(tvb, offset);
col_append_fstr(pinfo->cinfo, COL_INFO, " - Client Credit Return: %u", credits);
offset += 4;
} else {
proto_tree_add_item(tree, hf_bthcrp_control_server_credit_return, tvb, offset, 4, ENC_BIG_ENDIAN);
credits = tvb_get_ntohl(tvb, offset);
col_append_fstr(pinfo->cinfo, COL_INFO, " - Server Credit Return: %u", credits);
offset += 4;
}
break;
case 0x0004: /* CR_DataChannelCreditQuery */
if (is_client_message) {
proto_tree_add_item(tree, hf_bthcrp_control_client_credit_query, tvb, offset, 4, ENC_BIG_ENDIAN);
credits = tvb_get_ntohl(tvb, offset);
col_append_fstr(pinfo->cinfo, COL_INFO, " - Client Credit: %u", credits);
offset += 4;
} else {
proto_tree_add_item(tree, hf_bthcrp_control_server_credit_query, tvb, offset, 4, ENC_BIG_ENDIAN);
credits = tvb_get_ntohl(tvb, offset);
col_append_fstr(pinfo->cinfo, COL_INFO, " - Server Credit: %u", credits);
//.........这里部分代码省略.........