本文整理汇总了C++中col_append_fstr函数的典型用法代码示例。如果您正苦于以下问题:C++ col_append_fstr函数的具体用法?C++ col_append_fstr怎么用?C++ col_append_fstr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了col_append_fstr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dissect_ismacryp_common
static void dissect_ismacryp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint ismacryp_version)
{
guint set_version; /* ISMACryp version used during dissection */
proto_item *ismacryp_item;
proto_tree *ismacryp_tree;
proto_tree *ismacryp_message_tree;
/* select and display ISMACryp version */
if ((ismacryp_version!=version_type) && override_flag){
/* override -> use manual preference setting */
if (check_col(pinfo->cinfo, COL_INFO)){
col_append_str(pinfo->cinfo, COL_INFO, " Manual version");
}
set_version = version_type; /* set to preference value */
}
else {
set_version = ismacryp_version;
}
if (set_version == V11){
if (check_col(pinfo->cinfo, COL_PROTOCOL))
col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_ISMACRYP_11);
/* display mode */
if (pref_user_mode == FALSE){
if (check_col( pinfo->cinfo, COL_INFO))
col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",val_to_str(mode, modetypenames, "user mode"));
}
if (pref_user_mode == TRUE){
if ( check_col( pinfo->cinfo, COL_INFO))
col_append_fstr(pinfo->cinfo, COL_INFO, ", %s","user mode");
}
user_mode = pref_user_mode;
}
if (set_version == V20){
if (check_col(pinfo->cinfo, COL_PROTOCOL))
col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_ISMACRYP_20);
user_mode = TRUE;
/* display mode */
if (check_col( pinfo->cinfo, COL_INFO))
col_append_fstr(pinfo->cinfo, COL_INFO, ", %s","user mode");
}
/* select correct AU values depending on version & selected mode in preferences menu if not in user_mode */
if (user_mode == TRUE){ /* use values set in preference menu */
au_size_length = pref_au_size_length;
au_index_length = pref_au_index_length;
au_index_delta_length = pref_au_index_delta_length;
cts_delta_length = pref_cts_delta_length;
dts_delta_length = pref_dts_delta_length;
random_access_indication = pref_random_access_indication;
stream_state_indication = pref_stream_state_indication;
} /* end if user_mode == TRUE */
if (user_mode == FALSE){
switch (mode){
case AAC_HBR_MODE:
au_size_length = 13;
au_index_length = 3;
au_index_delta_length = 3;
cts_delta_length = 0;
dts_delta_length = 0;
random_access_indication = FALSE;
stream_state_indication = 0;
break;
case MPEG4_VIDEO_MODE:
au_size_length = 0;
au_index_length = 0;
au_index_delta_length = 0;
cts_delta_length = 0;
dts_delta_length = 22;
random_access_indication = TRUE;
stream_state_indication = 0;
break;
case AVC_VIDEO_MODE:
au_size_length = 0;
au_index_length = 0;
au_index_delta_length = 0;
cts_delta_length = 0;
dts_delta_length = 22;
random_access_indication = TRUE;
stream_state_indication = 0;
break;
default:
DISSECTOR_ASSERT_NOT_REACHED();
break;
} /* end switch */
} /* end if user_mode == FALSE */
/* navigate through buffer */
if (tree)
{
/* we are being asked for details */
guint16 au_headers_length = 0; /* total length of AU headers */
guint16 totalbits =0; /* keeps track of total number of AU header bits treated (used to determine end of AU headers) */
int deltabits = -1; /* keeps track of extra bits per AU header treated (used to determine end of AU heafers ) */
guint16 totalbit_offset = 0; /* total offset in bits*/
int nbpadding_bits = 0; /* number of padding bits*/
offset_struct s_offset;
offset_struct* poffset;
guint16 nbmessage_bytes = 0; /*nb of message data bytes */
s_offset.offset_bytes = 0; /* initialise byte offset */
//.........这里部分代码省略.........
示例2: dissect_headers
static int
dissect_headers(proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo)
{
proto_tree *hdrs_tree = NULL;
proto_tree *hdr_tree = NULL;
proto_item *hdr = NULL;
proto_item *handle_item;
gint item_length = -1;
guint8 hdr_id, i;
if (tvb_length_remaining(tvb, offset) > 0) {
proto_item *hdrs;
hdrs = proto_tree_add_text(tree, tvb, offset, item_length, "Headers");
hdrs_tree = proto_item_add_subtree(hdrs, ett_btobex_hdrs);
}
else {
return offset;
}
while (tvb_length_remaining(tvb, offset) > 0) {
hdr_id = tvb_get_guint8(tvb, offset);
switch(0xC0 & hdr_id)
{
case 0x00: /* null terminated unicode */
item_length = tvb_get_ntohs(tvb, offset+1);
break;
case 0x40: /* byte sequence */
item_length = tvb_get_ntohs(tvb, offset+1);
break;
case 0x80: /* 1 byte */
item_length = 2;
break;
case 0xc0: /* 4 bytes */
item_length = 5;
break;
}
hdr = proto_tree_add_text(hdrs_tree, tvb, offset, item_length, "%s",
val_to_str_ext_const(hdr_id, &header_id_vals_ext, "Unknown"));
hdr_tree = proto_item_add_subtree(hdr, ett_btobex_hdr);
proto_tree_add_item(hdr_tree, hf_hdr_id, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
switch(0xC0 & hdr_id)
{
case 0x00: /* null terminated unicode */
{
proto_tree_add_item(hdr_tree, hf_hdr_length, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
if ((item_length - 3) > 0) {
char *str;
display_unicode_string(tvb, hdr_tree, offset, &str);
proto_item_append_text(hdr_tree, " (\"%s\")", str);
col_append_fstr(pinfo->cinfo, COL_INFO, " \"%s\"", str);
}
else {
col_append_str(pinfo->cinfo, COL_INFO, " \"\"");
}
offset += item_length - 3;
}
break;
case 0x40: /* byte sequence */
proto_tree_add_item(hdr_tree, hf_hdr_length, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
handle_item = proto_tree_add_item(hdr_tree, hf_hdr_val_byte_seq, tvb, offset, item_length - 3, ENC_NA);
if (((hdr_id == 0x46) || (hdr_id == 0x4a)) && (item_length == 19)) { /* target or who */
for(i=0; target_vals[i].strptr != NULL; i++) {
if (tvb_memeql(tvb, offset, target_vals[i].value, 16) == 0) {
proto_item_append_text(handle_item, ": %s", target_vals[i].strptr);
proto_item_append_text(hdr_tree, " (%s)", target_vals[i].strptr);
col_append_fstr(pinfo->cinfo, COL_INFO, " - %s", target_vals[i].strptr);
}
}
}
if (!tvb_strneql(tvb, offset, "<?xml", 5))
{
tvbuff_t* next_tvb = tvb_new_subset_remaining(tvb, offset);
call_dissector(xml_handle, next_tvb, pinfo, tree);
}
else if (is_ascii_str(tvb_get_ptr(tvb, offset,item_length - 3), item_length - 3))
{
proto_item_append_text(hdr_tree, " (\"%s\")", tvb_get_ephemeral_string(tvb, offset,item_length - 3));
col_append_fstr(pinfo->cinfo, COL_INFO, " \"%s\"", tvb_get_ephemeral_string(tvb, offset,item_length - 3));
}
offset += item_length - 3;
break;
case 0x80: /* 1 byte */
proto_item_append_text(hdr_tree, " (%i)", tvb_get_ntohl(tvb, offset));
proto_tree_add_item(hdr_tree, hf_hdr_val_byte, tvb, offset, 1, ENC_BIG_ENDIAN);
//.........这里部分代码省略.........
示例3: dissect_xtp_traffic_cntl
static int
dissect_xtp_traffic_cntl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint32 offset) {
guint32 len = tvb_length_remaining(tvb, offset);
guint32 start = offset;
proto_item *top_ti;
proto_tree *xtp_subtree;
struct xtp_traffic_cntl tcntl[1];
top_ti = proto_tree_add_text(tree, tvb, offset, len,
"Traffic Control Segment");
xtp_subtree = proto_item_add_subtree(top_ti, ett_xtp_tcntl);
if (len < XTP_TRAFFIC_CNTL_LEN) {
proto_item_append_text(top_ti,
", bogus length(%u, must be at least %u)",
len, XTP_TRAFFIC_CNTL_LEN);
return 0;
}
/** parse **/
/* rseq(8) */
tcntl->rseq = tvb_get_ntohl(tvb, offset);
tcntl->rseq <<= 32;
tcntl->rseq += tvb_get_ntohl(tvb, offset+4);
offset += 8;
/* alloc(8) */
tcntl->alloc = tvb_get_ntohl(tvb, offset);
tcntl->alloc <<= 32;
tcntl->alloc += tvb_get_ntohl(tvb, offset+4);
offset += 8;
/* echo(4) */
tcntl->echo = tvb_get_ntohl(tvb, offset);
offset += 4;
/* rsvd(4) */
tcntl->rsvd = tvb_get_ntohl(tvb, offset);
offset += 4;
/* xkey(8) */
tcntl->xkey = tvb_get_ntohl(tvb, offset);
tcntl->xkey <<= 32;
tcntl->xkey += tvb_get_ntohl(tvb, offset+4);
/** add summary **/
col_append_fstr(pinfo->cinfo, COL_INFO,
" Recv-Seq=%" G_GINT64_MODIFIER "u", tcntl->rseq);
col_append_fstr(pinfo->cinfo, COL_INFO,
" Alloc=%" G_GINT64_MODIFIER "u", tcntl->alloc);
proto_item_append_text(top_ti,
", Recv-Seq: %" G_GINT64_MODIFIER "u", tcntl->rseq);
/** display **/
offset = start;
/* rseq(8) */
proto_tree_add_uint64(xtp_subtree, hf_xtp_tcntl_rseq,
tvb, offset, 8, tcntl->rseq);
offset += 8;
/* alloc(8) */
proto_tree_add_uint64(xtp_subtree, hf_xtp_tcntl_alloc,
tvb, offset, 8, tcntl->alloc);
offset += 4;
/* echo(4) */
proto_tree_add_uint(xtp_subtree, hf_xtp_tcntl_echo,
tvb, offset, 4, tcntl->echo);
offset += 4;
/* rsvd(4) */
proto_tree_add_uint(xtp_subtree, hf_xtp_tcntl_rsvd,
tvb, offset, 4, tcntl->rsvd);
offset += 4;
/* xkey(8) */
proto_tree_add_uint64(xtp_subtree, hf_xtp_tcntl_xkey,
tvb, offset, 8, tcntl->xkey);
offset += 8;
return (offset - start);
}
示例4: dissect_ice_params
/*
* This function dissects an "Ice params", adds hf(s) to "tree" and returns consumed
* bytes in "*consumed", if errors "*consumed" is -1.
*/
static void dissect_ice_params(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb,
guint32 offset, gint32 *consumed)
{
/* p. 612, chapter 23.3.2 and p. 587, 23.2.2:
* "params" is an Encapsulation
*
* struct Encapsulation {
* int size;
* byte major;
* byte minor;
* //(size - 6) bytes of data
* }
*
*/
gint32 size = 0;
gint tvb_data_remained = 0;
(*consumed) = 0;
/* check first 6 bytes */
if ( !tvb_bytes_exist(tvb, offset, ICEP_MIN_PARAMS_SIZE) ) {
expert_add_info(pinfo, item, &ei_icep_params_missing);
col_append_str(pinfo->cinfo, COL_INFO, " (params missing)");
(*consumed) = -1;
return;
}
/* get the size */
size = tvb_get_letohl(tvb, offset);
DBG1("params.size --> %d\n", size);
if ( size < ICEP_MIN_PARAMS_SIZE ) {
expert_add_info(pinfo, item, &ei_icep_params_size);
col_append_str(pinfo->cinfo, COL_INFO, " (params size too small)");
(*consumed) = -1;
return;
}
if ( tree ) {
proto_tree_add_item(tree, hf_icep_params_size, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
(*consumed) += 4;
proto_tree_add_item(tree, hf_icep_params_major, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
(*consumed)++;
proto_tree_add_item(tree, hf_icep_params_minor, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
(*consumed)++;
} else {
/* skip size, major, minor */
offset += 6;
(*consumed) += 6;
}
if( size == ICEP_MIN_PARAMS_SIZE ) /* no encapsulatd data present, it's normal */
return;
/* check if I got all encapsulated data */
tvb_data_remained = tvb_reported_length_remaining(tvb, offset);
if ( tvb_data_remained < ( size - ICEP_MIN_PARAMS_SIZE ) ) {
expert_add_info_format(pinfo, item, &ei_icep_params_encapsulated, "missing encapsulated data (%d bytes)", size - ICEP_MIN_PARAMS_SIZE - tvb_data_remained);
col_append_fstr(pinfo->cinfo, COL_INFO,
" (missing encapsulated data (%d bytes))",
size - ICEP_MIN_PARAMS_SIZE - tvb_data_remained);
(*consumed) = -1;
return;
}
/* encapsulated params */
proto_tree_add_item(tree, hf_icep_params_encapsulated, tvb, offset, (size - ICEP_MIN_PARAMS_SIZE), ENC_NA);
(*consumed) += (size - ICEP_MIN_PARAMS_SIZE);
}
示例5: dissect_icep_batch_request
static void dissect_icep_batch_request(tvbuff_t *tvb, guint32 offset,
packet_info *pinfo, proto_tree *icep_tree, proto_item* icep_item)
{
/* p. 613, chapter 23.3.3
* A batch request msg is a "sequence" of batch request
* Sequence is Size + elements
*
* struct BatchRequestData {
* Ice::Identity id;
* Ice::StringSeq facet;
* string operation;
* byte mode;
* Ice::Context context;
* Encapsulation params;
* }
*
* NOTE!!!:
* The only real implementation of the Ice protocol puts a 32bit count in front
* of a Batch Request, *not* an Ice::Sequence (as the standard says). Basically the
* same people wrote both code and standard so I'll follow the code.
*/
proto_item *ti = NULL;
proto_tree *icep_sub_tree = NULL;
guint32 num_reqs = 0;
guint32 i = 0;
gint32 consumed = 0;
DBG0("dissect batch request\n");
/* check for first 4 byte */
if ( !tvb_bytes_exist(tvb, offset, 4) ) {
expert_add_info_format(pinfo, icep_item, &ei_icep_length, "counter of batch requests missing");
col_append_str(pinfo->cinfo, COL_INFO, " (counter of batch requests missing)");
return;
}
num_reqs = tvb_get_letohl(tvb, offset);
offset += 4;
DBG1("batch_requests.count --> %d\n", num_reqs);
if ( num_reqs > icep_max_batch_requests ) {
expert_add_info_format(pinfo, icep_item, &ei_icep_batch_requests, "too many batch requests (%d)", num_reqs);
col_append_fstr(pinfo->cinfo, COL_INFO, " (too many batch requests, %d)", num_reqs);
return;
}
if ( num_reqs == 0 ) {
proto_tree_add_expert(icep_tree, pinfo, &ei_icep_empty_batch, tvb, offset, -1);
col_append_str(pinfo->cinfo, COL_INFO, " (empty batch requests sequence)");
return;
}
col_append_str(pinfo->cinfo, COL_INFO, ":");
/*
* process requests
*/
for ( i = 0; i < num_reqs; i++ ) {
DBG1("looping through sequence of batch requests, loop #%d\n", i);
/* create display subtree for this message type */
icep_sub_tree = proto_tree_add_subtree_format(icep_tree, tvb, offset, -1,
ett_icep_msg, &ti, "Batch Request Message Body: #%d", i);
if (i != 0) {
col_append_str(pinfo->cinfo, COL_INFO, ",");
}
dissect_icep_request_common(tvb, offset, pinfo, icep_sub_tree, ti, &consumed);
if ( consumed == -1 )
return;
if ( icep_tree && ti )
proto_item_set_len(ti, consumed);
offset += consumed;
DBG1("consumed --> %d\n", consumed);
}
}
示例6: dissect_csm_encaps
/* Code to actually dissect the packets */
static void
dissect_csm_encaps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_item *ti, *subitem;
proto_tree *csm_encaps_tree = NULL;
proto_tree *csm_encaps_control_tree = NULL;
guint16 function_code, channel, class_type;
guint control, type, sequence, length;
guint i;
gboolean show_error_param= FALSE;
const gchar *str_function_name;
function_code = tvb_get_letohs(tvb, 10);
control = tvb_get_guint8(tvb, 3);
class_type = tvb_get_guint8(tvb, 9);
class_type = class_type<<8;
class_type|= tvb_get_guint8(tvb, 8);
type = tvb_get_guint8(tvb, 8);
sequence = tvb_get_guint8(tvb, 2);
length = tvb_get_guint8(tvb, 6);
channel = tvb_get_ntohs(tvb, 4);
if (CSM_ENCAPS_CTRL_ACK&control)
show_error_param= FALSE;
else
{
if (csm_to_host(function_code, class_type)) /* exclusive messages to host */
show_error_param= FALSE;
else
{
if (type == CSM_ENCAPS_TYPE_RESPONSE)
show_error_param= TRUE;
else
show_error_param= FALSE;
}
}
col_set_str(pinfo->cinfo, COL_PROTOCOL, "CSM_ENCAPS");
col_clear(pinfo->cinfo, COL_INFO);
if (CSM_ENCAPS_CTRL_ACK&control)
{
if (CSM_ENCAPS_CTRL_ACK_TO_HOST&control)
col_append_fstr(pinfo->cinfo, COL_INFO,
"<-- ACK Ch: 0x%04X, Seq: %2d (To Host)",
channel, sequence);
else
col_append_fstr(pinfo->cinfo, COL_INFO,
"--> ACK Ch: 0x%04X, Seq: %2d (From Host)",
channel, sequence);
}
else
{
str_function_name= csm_fc(function_code, class_type);
if ((type == CSM_ENCAPS_TYPE_RESPONSE) || (csm_to_host(function_code, class_type)))
col_append_fstr(pinfo->cinfo, COL_INFO,
"<-- %-35s Ch: 0x%04X, Seq: %2d (To Host)",
str_function_name, channel, sequence);
else
col_append_fstr(pinfo->cinfo, COL_INFO,
"--> %-35s Ch: 0x%04X, Seq: %2d (From Host)",
str_function_name, channel, sequence);
}
if (tree) {
ti = proto_tree_add_item(tree, proto_csm_encaps, tvb, 0, -1, ENC_NA);
csm_encaps_tree = proto_item_add_subtree(ti, ett_csm_encaps);
proto_tree_add_item(csm_encaps_tree, hf_csm_encaps_opcode, tvb, 0, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(csm_encaps_tree, hf_csm_encaps_seq, tvb, 2, 1, ENC_BIG_ENDIAN);
subitem = proto_tree_add_uint(csm_encaps_tree, hf_csm_encaps_ctrl, tvb, 3, 1, control);
csm_encaps_control_tree = proto_item_add_subtree(subitem, ett_csm_encaps_control);
proto_tree_add_boolean(csm_encaps_control_tree, hf_csm_encaps_ctrl_ack, tvb, 3, 1, control);
proto_tree_add_boolean(csm_encaps_control_tree, hf_csm_encaps_ctrl_ack_suppress, tvb, 3, 1, control);
proto_tree_add_boolean(csm_encaps_control_tree, hf_csm_encaps_ctrl_endian, tvb, 3, 1, control);
proto_tree_add_item(csm_encaps_tree, hf_csm_encaps_channel, tvb, 4, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(csm_encaps_tree, hf_csm_encaps_length, tvb, 6, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(csm_encaps_tree, hf_csm_encaps_index, tvb, 7, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(csm_encaps_tree, hf_csm_encaps_class, tvb, 9, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(csm_encaps_tree, hf_csm_encaps_type, tvb, 8, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(csm_encaps_tree, hf_csm_encaps_function_code, tvb, 10, 2, ENC_LITTLE_ENDIAN);
i=6;
if (i<length) proto_tree_add_item(csm_encaps_tree, hf_csm_encaps_reserved, tvb, 12 + i-6, 2, ENC_LITTLE_ENDIAN); i+=2;
//.........这里部分代码省略.........
示例7: dissect_openvpn_msg
static void
dissect_openvpn_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
gint offset = 0;
gboolean protocol_tcp;
gboolean tls_auth;
guint openvpn_keyid;
guint openvpn_opcode;
guint32 msg_mpid = -1;
guint32 msg_sessionid = -1;
guint8 openvpn_predict_tlsauth_arraylength;
proto_item *ti = NULL;
proto_item *ti2;
proto_item *ti3;
proto_tree *openvpn_tree = NULL;
proto_tree *packetarray_tree;
proto_tree *type_tree;
guint32 msg_length_remaining;
gboolean msg_lastframe;
fragment_head *frag_msg;
tvbuff_t *new_tvb;
gboolean save_fragmented;
/* check whether we are dealing with tcp or udp encapsulation */
protocol_tcp = (pinfo->ipproto == IP_PROTO_TCP ? TRUE : FALSE);
/* Clear out stuff in the info column */
col_set_str(pinfo->cinfo, COL_PROTOCOL, PSNAME);
col_clear(pinfo->cinfo,COL_INFO);
/* we are being asked for details */
if (tree) {
ti = proto_tree_add_item(tree, proto_openvpn, tvb, 0, -1, ENC_NA);
openvpn_tree = proto_item_add_subtree(ti, ett_openvpn);
}
/* openvpn packet length field is only present in tcp packets */
if (protocol_tcp) {
proto_tree_add_item(openvpn_tree, hf_openvpn_plen, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
}
/* 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(ti, ", 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, " %s", "[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) {
//.........这里部分代码省略.........
示例8: dissect_parameter
static gint
dissect_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree,
proto_tree *tree, gint offset, guint8 *parameter, gint *parameter_offset)
{
proto_item *parameter_item;
proto_item *pitem;
proto_tree *ptree;
tvbuff_t *next_tvb;
guint parameter_id;
guint parameter_length;
guint parameter_padding_length;
guint padding_length;
guint length;
guint16 max_msg_size;
guint8 connection_status;
guint8 result_code;
guint8 disconnection_type;
guint8 status_change;
guint8 transport_protocol;
parameter_id = tvb_get_guint8(tvb, offset);
parameter_length = tvb_get_ntohs(tvb, offset + 2);
parameter_padding_length = parameter_length % 4;
if (parameter_padding_length > 0)
parameter_padding_length = 4 - parameter_padding_length;
parameter_item = proto_tree_add_none_format(tree, hf_btsap_parameter, tvb, offset,
2 + 2 + parameter_length + parameter_padding_length, "Parameter: %s: ",
val_to_str_const(parameter_id, parameter_id_vals, "Unknown ParameterID"));
ptree = proto_item_add_subtree(parameter_item, ett_btsap_parameter);
proto_tree_add_item(ptree, hf_btsap_parameter_id, tvb, offset, 1, ENC_BIG_ENDIAN);
col_append_fstr(pinfo->cinfo, COL_INFO, " - %s", val_to_str_const(parameter_id, parameter_id_vals, "Unknown ParameterID"));
offset += 1;
proto_tree_add_item(ptree, hf_btsap_parameter_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
pitem = proto_tree_add_item(ptree, hf_btsap_parameter_length, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_item_append_text(pitem, " (in 4 bytes sections, padding length: %u)", parameter_padding_length);
offset += 2;
switch(parameter_id) {
case 0x00: /* MaxMsgSize */
proto_tree_add_item(ptree, hf_btsap_parameter_max_msg_size, tvb, offset, 2, ENC_BIG_ENDIAN);
max_msg_size = tvb_get_ntohs(tvb, offset);
proto_item_append_text(parameter_item, "%u", max_msg_size);
col_append_fstr(pinfo->cinfo, COL_INFO, ": %u", max_msg_size);
length = 2;
padding_length = 2;
break;
case 0x01: /* ConnectionStatus */
proto_tree_add_item(ptree, hf_btsap_parameter_connection_status, tvb, offset, 1, ENC_BIG_ENDIAN);
connection_status = tvb_get_guint8(tvb, offset);
proto_item_append_text(parameter_item, "%s", val_to_str_const(connection_status, connection_status_vals, "Unknown"));
col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", val_to_str_const(connection_status, connection_status_vals, "Unknown"));
length = 1;
padding_length = 3;
break;
case 0x02: /* ResultCode */
proto_tree_add_item(ptree, hf_btsap_parameter_result_code, tvb, offset, 1, ENC_BIG_ENDIAN);
result_code = tvb_get_guint8(tvb, offset);
proto_item_append_text(parameter_item, "%s", val_to_str_const(result_code, result_code_vals, "Unknown"));
col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", val_to_str_const(result_code, result_code_vals, "Unknown"));
length = 1;
padding_length = 3;
break;
case 0x03: /* DisconnectionType */
proto_tree_add_item(ptree, hf_btsap_parameter_disconnection_type, tvb, offset, 1, ENC_BIG_ENDIAN);
disconnection_type = tvb_get_guint8(tvb, offset);
proto_item_append_text(parameter_item, "%s", val_to_str_const(disconnection_type, disconnection_type_vals, "Unknown"));
col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", val_to_str_const(disconnection_type, disconnection_type_vals, "Unknown"));
length = 1;
padding_length = 3;
break;
case 0x04: /* CommandAPDU */
/* GSM 11.11 */
if (gsm_sim_cmd_handle && top_dissect != TOP_DISSECT_OFF) {
next_tvb = tvb_new_subset(tvb, offset, parameter_length, parameter_length);
col_append_str(pinfo->cinfo, COL_INFO, ": ");
if (top_dissect == TOP_DISSECT_INTERNAL) {
call_dissector(gsm_sim_cmd_handle, next_tvb, pinfo, ptree);
} else {
col_clear(pinfo->cinfo, COL_INFO);
call_dissector(gsm_sim_cmd_handle, next_tvb, pinfo, top_tree);
}
} else {
proto_tree_add_item(ptree, hf_btsap_data, tvb, offset, parameter_length, ENC_NA);
}
length = parameter_length;
padding_length = parameter_padding_length;
break;
case 0x05: /* ResponseAPDU */
/* GSM 11.11 or ISO/IEC 7816-4; depend of TRANSFER_APDU_REQ */
if (gsm_sim_resp_handle && top_dissect != TOP_DISSECT_OFF) {
next_tvb = tvb_new_subset(tvb, offset, parameter_length, parameter_length);
//.........这里部分代码省略.........
示例9: dissect_hci_mon
static gint
dissect_hci_mon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
proto_tree *hci_mon_item;
proto_item *hci_mon_tree;
proto_item *sub_item;
gint offset = 0;
guint16 opcode;
guint16 adapter_id;
bluetooth_data_t *bluetooth_data;
tvbuff_t *next_tvb;
guint32 *adapter_disconnect_in_frame;
wmem_tree_t *subtree;
wmem_tree_key_t key[4];
guint32 k_interface_id;
guint32 k_adapter_id;
guint32 k_frame_number;
bluetooth_data = (bluetooth_data_t *) data;
DISSECTOR_ASSERT(bluetooth_data->previous_protocol_data_type == BT_PD_BTMON);
adapter_id = bluetooth_data->previous_protocol_data.btmon->adapter_id;
opcode = bluetooth_data->previous_protocol_data.btmon->opcode;
if (opcode == 0x00 || opcode == 0x01)
pinfo->p2p_dir = P2P_DIR_RECV;
else if (opcode % 2)
pinfo->p2p_dir = P2P_DIR_RECV;
else
pinfo->p2p_dir = P2P_DIR_SENT;
hci_mon_item = proto_tree_add_item(tree, proto_hci_mon, tvb, offset, tvb_captured_length(tvb), ENC_NA);
hci_mon_tree = proto_item_add_subtree(hci_mon_item, ett_hci_mon);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "HCI_MON");
if (opcode == 0x00 || opcode == 0x01)
col_set_str(pinfo->cinfo, COL_INFO, "Info ");
else switch (pinfo->p2p_dir) {
case P2P_DIR_SENT:
col_set_str(pinfo->cinfo, COL_INFO, "Sent ");
break;
case P2P_DIR_RECV:
col_set_str(pinfo->cinfo, COL_INFO, "Rcvd ");
break;
default:
col_set_str(pinfo->cinfo, COL_INFO, "UnknownDirection ");
break;
}
sub_item = proto_tree_add_uint(hci_mon_tree, hf_adapter_id, tvb, offset, 0, adapter_id);
PROTO_ITEM_SET_GENERATED(sub_item);
sub_item = proto_tree_add_uint(hci_mon_tree, hf_opcode, tvb, offset, 0, opcode);
PROTO_ITEM_SET_GENERATED(sub_item);
col_append_fstr(pinfo->cinfo, COL_INFO, "Adapter Id: %u, Opcode: %s",
adapter_id, val_to_str_ext_const(opcode, &hci_mon_opcode_vals_ext, "Unknown"));
bluetooth_data->adapter_id = adapter_id;
k_interface_id = bluetooth_data->interface_id;
k_adapter_id = adapter_id;
k_frame_number = pinfo->num;
key[0].length = 1;
key[0].key = &k_interface_id;
key[1].length = 1;
key[1].key = &k_adapter_id;
if (!pinfo->fd->flags.visited && opcode == 0x01) { /* Delete Index */
guint32 *disconnect_in_frame;
key[2].length = 1;
key[2].key = &k_frame_number;
key[3].length = 0;
key[3].key = NULL;
disconnect_in_frame = wmem_new(wmem_file_scope(), guint32);
if (disconnect_in_frame) {
*disconnect_in_frame = pinfo->num;
wmem_tree_insert32_array(adapter_to_disconnect_in_frame, key, disconnect_in_frame);
}
}
key[2].length = 0;
key[2].key = NULL;
subtree = (wmem_tree_t *) wmem_tree_lookup32_array(adapter_to_disconnect_in_frame, key);
adapter_disconnect_in_frame = (subtree) ? (guint32 *) wmem_tree_lookup32_le(subtree, k_frame_number) : NULL;
if (adapter_disconnect_in_frame) {
bluetooth_data->adapter_disconnect_in_frame = adapter_disconnect_in_frame;
} else {
bluetooth_data->adapter_disconnect_in_frame = &max_disconnect_in_frame;
}
//.........这里部分代码省略.........
示例10: force_reassemble_seq
fragment_data *
force_reassemble_seq(packet_info *pinfo, guint32 id,
GHashTable *fragment_table)
{
fragment_key key;
fragment_data *fd_head;
fragment_data *fd_i;
fragment_data *last_fd;
guint32 dfpos, size, packet_lost, burst_lost, seq_num;
/* create key to search hash with */
key.src = pinfo->src;
key.dst = pinfo->dst;
key.id = id;
fd_head = g_hash_table_lookup(fragment_table, &key);
/* have we already seen this frame ?*/
if (pinfo->fd->flags.visited) {
if (fd_head != NULL && fd_head->flags & FD_DEFRAGMENTED) {
return fd_head;
} else {
return NULL;
}
}
if (fd_head==NULL){
/* we must have it to continue */
return NULL;
}
/* check for packet lost and count the burst of packet lost */
packet_lost = 0;
burst_lost = 0;
seq_num = 0;
for(fd_i=fd_head->next;fd_i;fd_i=fd_i->next) {
if (seq_num != fd_i->offset) {
packet_lost += fd_i->offset - seq_num;
if ( (fd_i->offset - seq_num) > burst_lost ) {
burst_lost = fd_i->offset - seq_num;
}
}
seq_num = fd_i->offset + 1;
}
/* we have received an entire packet, defragment it and
* free all fragments
*/
size=0;
last_fd=NULL;
for(fd_i=fd_head->next;fd_i;fd_i=fd_i->next) {
if(!last_fd || last_fd->offset!=fd_i->offset){
size+=fd_i->len;
}
last_fd=fd_i;
}
fd_head->data = g_malloc(size);
fd_head->len = size; /* record size for caller */
/* add all data fragments */
dfpos = 0;
last_fd=NULL;
for (fd_i=fd_head->next;fd_i && fd_i->len + dfpos <= size;fd_i=fd_i->next) {
if (fd_i->len) {
if(!last_fd || last_fd->offset!=fd_i->offset){
memcpy(fd_head->data+dfpos,fd_i->data,fd_i->len);
dfpos += fd_i->len;
} else {
/* duplicate/retransmission/overlap */
fd_i->flags |= FD_OVERLAP;
fd_head->flags |= FD_OVERLAP;
if( (last_fd->len!=fd_i->datalen)
|| memcmp(last_fd->data, fd_i->data, last_fd->len) ){
fd_i->flags |= FD_OVERLAPCONFLICT;
fd_head->flags |= FD_OVERLAPCONFLICT;
}
}
}
last_fd=fd_i;
}
/* we have defragmented the pdu, now free all fragments*/
for (fd_i=fd_head->next;fd_i;fd_i=fd_i->next) {
if(fd_i->data){
g_free(fd_i->data);
fd_i->data=NULL;
}
}
/* mark this packet as defragmented */
fd_head->flags |= FD_DEFRAGMENTED;
fd_head->reassembled_in=pinfo->fd->num;
col_append_fstr(pinfo->cinfo, COL_INFO, " (t4-data Reassembled: %d pack lost, %d pack burst lost)", packet_lost, burst_lost);
p_t38_packet_conv_info->packet_lost = packet_lost;
p_t38_packet_conv_info->burst_lost = burst_lost;
return fd_head;
}
示例11: dissect_rsh
//.........这里部分代码省略.........
}
if(pinfo->fd->num == hash_info->second_packet_number){
if(hash_info->second_packet_state == NONE){
hash_info->second_packet_state = hash_info->state;
} else {
hash_info->state = hash_info->second_packet_state;
}
}
if(pinfo->fd->num == hash_info->third_packet_number){
if(hash_info->third_packet_state == NONE){
hash_info->third_packet_state = hash_info->state;
} else {
hash_info->state = hash_info->third_packet_state;
}
}
if(pinfo->fd->num == hash_info->fourth_packet_number){
if(hash_info->fourth_packet_state == NONE){
hash_info->fourth_packet_state = hash_info->state;
} else {
hash_info->state = hash_info->fourth_packet_state;
}
}
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RSH");
/* First, clear the info column */
col_clear(pinfo->cinfo, COL_INFO);
/* Client username */
if(hash_info->client_username && preference_info_show_client_username == TRUE){
col_append_fstr(pinfo->cinfo, COL_INFO, "Client username:%s ", hash_info->client_username);
}
/* Server username */
if(hash_info->server_username && preference_info_show_server_username == TRUE){
col_append_fstr(pinfo->cinfo, COL_INFO, "Server username:%s ", hash_info->server_username);
}
/* Command */
if(hash_info->command && preference_info_show_command == TRUE){
col_append_fstr(pinfo->cinfo, COL_INFO, "Command:%s ", hash_info->command);
}
/* create display subtree for the protocol */
ti = proto_tree_add_item(tree, proto_rsh, tvb, 0, -1, ENC_NA);
rsh_tree = proto_item_add_subtree(ti, ett_rsh);
/* If this packet doesn't end with a null terminated string,
* then it must be session data only and we can skip looking
* for the other fields.
*/
if(tvb_find_guint8(tvb, tvb_length(tvb)-1, 1, '\0') == -1){
hash_info->state = WAIT_FOR_DATA;
}
if(hash_info->state == WAIT_FOR_STDERR_PORT
&& tvb_length_remaining(tvb, offset)){
field_stringz = tvb_get_stringz_enc(wmem_packet_scope(), tvb, offset, &length, ENC_ASCII);
/* Check if this looks like the stderr_port field.
* It is optional, so it may only be 1 character long
* (the NULL)
*/
示例12: dissect_auheader
//.........这里部分代码省略.........
tvb, bit_offset, 1, FALSE); /*fetch 1 bit unused */
}
add_bits(poffset, -3); /* move back 3 bits for padding_bitcount */
/* Padding_bitcount bits */
bit_offset = (poffset->offset_bytes)*8+poffset->offset_bits; /* offset in bits */
if (padding_indication){
ismacryp_item = proto_tree_add_bits_item(ismacryp_header_byte_tree, hf_ismacryp_padding_bitcount,
tvb, bit_offset, 3, FALSE); /*fetch 3 bits padding_bitcount */
}
else { /* bits unused */
ismacryp_item = proto_tree_add_bits_item(ismacryp_header_byte_tree, hf_ismacryp_unused_bits,
tvb, bit_offset, 3, FALSE); /*fetch 3 bits unused */
}
add_bits(poffset, -2); /* move back 2 bits for reserved bits */
/* Reserved bits */
bit_offset = (poffset->offset_bytes)*8+poffset->offset_bits; /* offset in bits */
ismacryp_item = proto_tree_add_bits_item(ismacryp_header_byte_tree, hf_ismacryp_reserved_bits,
tvb, bit_offset, 2, FALSE); /*fetch 2 bits reserved */
add_bits(poffset,8); /* offset to next byte */
break;
default:
DISSECTOR_ASSERT_NOT_REACHED();
break;
} /* end switch set_version */
} /* end selective encryption */
/* IV */
if (first_au_flag == TRUE && iv_length != 0)
{
ismacryp_item = proto_tree_add_item(ismacryp_header_tree, hf_ismacryp_iv, tvb, poffset->offset_bytes, iv_length, FALSE);
proto_item_append_text(ismacryp_item, ": Length=%d bytes",iv_length); /* add IV info */
if ( check_col( pinfo->cinfo, COL_INFO) ) {
col_append_fstr( pinfo->cinfo, COL_INFO,
", IV=0x%s", tvb_bytes_to_str_punct(tvb, poffset->offset_bytes, iv_length,' '));
}
poffset->offset_bytes+=iv_length; /* add IV length to offset_bytes */
}
/*Delta IV */
if (first_au_flag == FALSE && delta_iv_length != 0)
{
ismacryp_item = proto_tree_add_item(ismacryp_header_tree, hf_ismacryp_delta_iv,
tvb, poffset->offset_bytes, delta_iv_length, FALSE);
proto_item_append_text(ismacryp_item, ": Length=%d bytes",delta_iv_length); /* add delta IV info */
if ( check_col( pinfo->cinfo, COL_INFO) ) {
col_append_fstr( pinfo->cinfo, COL_INFO,
", Delta IV=0x%s", tvb_bytes_to_str_punct(tvb, poffset->offset_bytes, delta_iv_length,' '));
}
poffset->offset_bytes+=iv_length; /* add IV length to offset_bytes */
}
/* Key Indicator */
if ( key_indicator_length != 0 && ( first_au_flag == TRUE || key_indicator_per_au_flag == TRUE) )
{
/* (first AU or KI for each AU) and non-zero KeyIndicator size */
ismacryp_item = proto_tree_add_item(ismacryp_header_tree, hf_ismacryp_key_indicator,
tvb, poffset->offset_bytes, key_indicator_length, FALSE);
proto_item_append_text(ismacryp_item,": Length=%d bytes",key_indicator_length); /* add KI info */
if ( check_col( pinfo->cinfo, COL_INFO) ) {
col_append_fstr( pinfo->cinfo, COL_INFO,
", KI=0x%s", tvb_bytes_to_str_punct(tvb, poffset->offset_bytes, key_indicator_length,' '));
}
poffset->offset_bytes+=key_indicator_length; /* add KI length to offset_bytes */
}
/* AU size */
if (au_size_length != 0) /* in bits */
{
示例13: dissect_spx
static void
dissect_spx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_tree *spx_tree = NULL;
proto_item *ti;
tvbuff_t *next_tvb;
guint8 conn_ctrl;
proto_tree *cc_tree;
guint8 datastream_type;
const char *datastream_type_string;
guint16 spx_seq;
const char *spx_msg_string;
guint16 low_socket, high_socket;
guint32 src;
conversation_t *conversation;
spx_hash_value *pkt_value;
spx_rexmit_info *spx_rexmit_info_p;
spx_info spx_infox;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "SPX");
col_set_str(pinfo->cinfo, COL_INFO, "SPX");
if (tree) {
ti = proto_tree_add_item(tree, proto_spx, tvb, 0, SPX_HEADER_LEN, ENC_NA);
spx_tree = proto_item_add_subtree(ti, ett_spx);
}
conn_ctrl = tvb_get_guint8(tvb, 0);
spx_msg_string = spx_conn_ctrl(conn_ctrl);
if (check_col(pinfo->cinfo, COL_INFO))
col_append_fstr(pinfo->cinfo, COL_INFO, " %s", spx_msg_string);
if (tree) {
ti = proto_tree_add_uint_format(spx_tree, hf_spx_connection_control, tvb,
0, 1, conn_ctrl,
"Connection Control: %s (0x%02X)",
spx_msg_string, conn_ctrl);
cc_tree = proto_item_add_subtree(ti, ett_spx_connctrl);
proto_tree_add_boolean(cc_tree, hf_spx_connection_control_sys, tvb,
0, 1, conn_ctrl);
proto_tree_add_boolean(cc_tree, hf_spx_connection_control_send_ack, tvb,
0, 1, conn_ctrl);
proto_tree_add_boolean(cc_tree, hf_spx_connection_control_attn, tvb,
0, 1, conn_ctrl);
proto_tree_add_boolean(cc_tree, hf_spx_connection_control_eom, tvb,
0, 1, conn_ctrl);
}
datastream_type = tvb_get_guint8(tvb, 1);
datastream_type_string = spx_datastream(datastream_type);
if (datastream_type_string != NULL) {
if (check_col(pinfo->cinfo, COL_INFO))
col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)",
datastream_type_string);
}
if (tree) {
if (datastream_type_string != NULL) {
proto_tree_add_uint_format(spx_tree, hf_spx_datastream_type, tvb,
1, 1, datastream_type,
"Datastream Type: %s (0x%02X)",
datastream_type_string,
datastream_type);
} else {
proto_tree_add_uint_format(spx_tree, hf_spx_datastream_type, tvb,
1, 1, datastream_type,
"Datastream Type: 0x%02X",
datastream_type);
}
proto_tree_add_item(spx_tree, hf_spx_src_id, tvb, 2, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(spx_tree, hf_spx_dst_id, tvb, 4, 2, ENC_BIG_ENDIAN);
}
spx_seq = tvb_get_ntohs(tvb, 6);
if (tree) {
proto_tree_add_uint(spx_tree, hf_spx_seq_nr, tvb, 6, 2, spx_seq);
proto_tree_add_item(spx_tree, hf_spx_ack_nr, tvb, 8, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(spx_tree, hf_spx_all_nr, tvb, 10, 2, ENC_BIG_ENDIAN);
}
/*
* SPX is Connection Oriented and Delivery Guaranteed.
* On the first pass, we need to flag retransmissions by the SPX
* protocol, so that subdissectors know whether a packet was
* retransmitted.
*
* We start out by creating a conversation for this direction of the
* IPX session; we use "pinfo->srcport" twice, so that we have
* separate conversations for the two directions.
*
* XXX - that might not work correctly if there's more than one
* SPX session using that source port; can that happen? If so,
* we should probably use the direction, as well as the conversation,
* as part of the hash key; if we do that, we can probably just
* use PT_IPX as the port type, and possibly get rid of PT_NCP.
*
* According to
*
* http://developer.novell.com/research/appnotes/1995/december/03/apv.htm
*
* the sequence number is not incremented for system packets, so
* presumably that means there is no notion of a system packet
* being retransmitted; that document also says that system
//.........这里部分代码省略.........
示例14: dissect_dlm3_msg
/* Code to actually dissect the packets */
static void
dissect_dlm3_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint length, int offset)
{
guint32 m_type;
m_type = tvb_get_letohl(tvb, offset);
proto_tree_add_uint(tree,
hf_dlm3_m_type, tvb, offset, 4, m_type);
col_append_fstr(pinfo->cinfo, COL_INFO,
": %s",
val_to_str_const(m_type,
dlm3_msg,
"Unknown"));
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_m_nodeid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_m_pid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_m_lkid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
/* TODO: See `create_lkb'
lkid has some structure. We dissect more. */
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_m_remid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_m_parent_lkid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_m_parent_remid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_bitmask(tree, tvb, offset,
hf_dlm3_m_exflags, ett_dlm3_m_exflags,
m_exflags_fields, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_bitmask(tree, tvb, offset,
hf_dlm3_m_sbflags, ett_dlm3_sbflags,
m_sbflags_fields, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_bitmask(tree, tvb, offset,
hf_dlm3_m_flags, ett_dlm3_m_flags,
m_flags_fields, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_m_lvbseq, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_m_hash, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_m_status, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_m_grmode, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_m_rqmode, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_m_bastmode, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_bitmask(tree, tvb, offset,
hf_dlm3_m_asts, ett_dlm3_m_asts,
m_asts_fields, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_m_result, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
if ((length - offset) > 0) {
proto_tree_add_item(tree,
hf_dlm3_m_extra,
tvb,
offset,
-1,
ENC_NA);
}
}
示例15: dissect_sss_request
void
dissect_sss_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, ncp_req_hash_value *request_value)
{
guint8 /*func,*/ subfunc = 0;
guint32 subverb=0;
guint32 msg_length=0;
guint32 foffset= 0;
proto_tree *atree;
proto_item *aitem;
if (tvb_length_remaining(tvb, foffset)<4) {
return;
}
foffset = 6;
/*func = tvb_get_guint8(tvb, foffset);*/
foffset += 1;
subfunc = tvb_get_guint8(tvb, foffset);
foffset += 1;
/* Fill in the PROTOCOL & INFO columns. */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "NSSS");
col_add_fstr(pinfo->cinfo, COL_INFO, "C SecretStore - %s", val_to_str(subfunc, sss_func_enum, "Unknown (%d)"));
switch (subfunc) {
case 1:
aitem = proto_tree_add_text(ncp_tree, tvb, foffset, tvb_length_remaining(tvb, foffset), "Packet Type: %s", val_to_str(subfunc, sss_func_enum, "Unknown (%d)"));
atree = proto_item_add_subtree(aitem, ett_sss);
proto_tree_add_item(atree, hf_ping_version, tvb, foffset, 4, ENC_LITTLE_ENDIAN);
foffset += 4;
proto_tree_add_item(atree, hf_flags, tvb, foffset, 4, ENC_LITTLE_ENDIAN);
foffset += 4;
break;
case 2:
proto_tree_add_item(ncp_tree, hf_frag_handle, tvb, foffset, 4, ENC_LITTLE_ENDIAN);
if (tvb_get_letohl(tvb, foffset)==0xffffffff) /* Fragment handle of -1 means no fragment. So process packet */
{
foffset += 4;
proto_tree_add_item(ncp_tree, hf_buffer_size, tvb, foffset, 4, ENC_LITTLE_ENDIAN);
foffset += 4;
proto_tree_add_item(ncp_tree, hf_length, tvb, foffset, 4, ENC_LITTLE_ENDIAN);
foffset += 4;
foffset += 12; /* Blank Context */
subverb = tvb_get_letohl(tvb, foffset);
col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str(subverb, sss_verb_enum, "Unknown (%d)"));
aitem = proto_tree_add_item(ncp_tree, hf_verb, tvb, foffset, 4, ENC_LITTLE_ENDIAN);
atree = proto_item_add_subtree(aitem, ett_sss);
if (request_value) {
request_value->req_nds_flags=subverb;
}
foffset += 4;
process_flags(atree, tvb, foffset);
foffset += 4;
proto_tree_add_item(atree, hf_context, tvb, foffset, 4, ENC_BIG_ENDIAN);
foffset += 4;
switch (subverb) {
case 0:
foffset += 4;
foffset = sss_string(tvb, hf_user, atree, foffset, TRUE, 0);
break;
case 1:
foffset = sss_string(tvb, hf_secret, atree, foffset, TRUE, 0);
msg_length = tvb_get_letohl(tvb, foffset);
foffset += (msg_length+4); /* Unsure of what this length and parameter are */
/* A bad secret of length greater then 256 characters will cause frag
packets and then we will see these as malformed packets.
So check to make sure we still have data in the packet anytime
we read a secret. */
if (tvb_length_remaining(tvb, foffset) > 4)
{
foffset = sss_string(tvb, hf_user, atree, foffset, TRUE, 0);
}
break;
case 2:
foffset += 4;
foffset = sss_string(tvb, hf_secret, atree, foffset, TRUE, 0);
if (tvb_length_remaining(tvb, foffset) > 4)
{
msg_length = tvb_get_letohl(tvb, foffset);
foffset += 4;
if (tvb_length_remaining(tvb, foffset) < (gint) msg_length)
{
proto_tree_add_item(atree, hf_enc_data, tvb, foffset, -1, ENC_NA);
}
else
{
proto_tree_add_item(atree, hf_enc_data, tvb, foffset, msg_length, ENC_NA);
}
}
break;
case 3:
case 4:
foffset = sss_string(tvb, hf_secret, atree, foffset, TRUE, 0);
if (tvb_length_remaining(tvb, foffset) > 4)
{
foffset = sss_string(tvb, hf_user, atree, foffset, TRUE, 0);
}
break;
case 5:
//.........这里部分代码省略.........