当前位置: 首页>>代码示例>>C++>>正文


C++ proto_tree_add_subtree_format函数代码示例

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


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

示例1: isis_dissect_clvs

/*
 * Name: isis_dissect_clvs()
 *
 * Description:
 *    Dispatch routine to shred all the CLVs in a packet.  We just
 *    walk through the clv entries in the packet.  For each one, we
 *    search the passed in valid clv's for this protocol (opts) for
 *    a matching code.  If found, we add to the display tree and
 *    then call the dissector.  If it is not, we just post an
 *    "unknown" clv entry using the passed in unknown clv tree id.
 *
 * Input:
 *    tvbuff_t * : tvbuffer for packet data
 *    proto_tree * : protocol display tree to fill out.  May be NULL
 *    int : offset into packet data where we are.
 *    isis_clv_handle_t * : NULL dissector terminated array of codes
 *        and handlers (along with tree text and tree id's).
 *    int : length of CLV area.
 *    int : length of IDs in packet.
 *    int : unknown clv tree id
 *
 * Output:
 *    void, but we will add to proto tree if !NULL.
 */
void
isis_dissect_clvs(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset,
    const isis_clv_handle_t *opts, expert_field* expert_short_len, int len, int id_length,
    int unknown_tree_id _U_, int tree_type, int tree_length)
{
    guint8 code;
    guint8 length;
    int q;
    proto_tree    *clv_tree;

    while ( len > 0 ) {
        code = tvb_get_guint8(tvb, offset);
        offset += 1;
        len -= 1;
        if (len == 0)
            break;

        length = tvb_get_guint8(tvb, offset);
        offset += 1;
        len -= 1;
        if (len == 0)
            break;

        if ( len < length ) {
            proto_tree_add_expert_format(tree, pinfo, expert_short_len, tvb, offset, -1,
                "Short CLV header (%d vs %d)",
                length, len );
            return;
        }
        q = 0;
        while ((opts[q].dissect != NULL )&&( opts[q].optcode != code )){
            q++;
        }
        if ( opts[q].dissect ) {
            /* adjust by 2 for code/len octets */
            clv_tree = proto_tree_add_subtree_format(tree, tvb, offset - 2,
                    length + 2, *opts[q].tree_id, NULL, "%s (t=%u, l=%u)",
                    opts[q].tree_text, opts[q].optcode, length);

            proto_tree_add_item(clv_tree, tree_type, tvb, offset - 2, 1, ENC_BIG_ENDIAN);
            proto_tree_add_item(clv_tree, tree_length, tvb, offset - 1, 1, ENC_BIG_ENDIAN);
            opts[q].dissect(tvb, pinfo, clv_tree, offset,
                id_length, length);
        } else {
#if 0 /* XXX: Left as commented out in case info about "unknown code" is ever to be displayed under a sub-tree */
            clv_tree = proto_tree_add_subtree_format(tree, tvb, offset - 2,
                    length + 2, unknown_tree_id, NULL, "Unknown code %u (%u)",
                    code, length);
#else
            if (tree) {
                proto_tree_add_text(tree, tvb, offset - 2,
                    length + 2, "Unknown code %u (%u)",
                    code, length);
            }
#endif
        }
        offset += length;
        len -= length;
    }
}
开发者ID:danielwhite84,项目名称:wireshark,代码行数:84,代码来源:packet-isis-clv.c

示例2: dissect_bcp_connect_data

/*
 * dissector function of connect data (request and response)
 *
 * input: tree, buffer (block data), flags (req or rsp)
 * return: nothing
 */
static void
dissect_bcp_connect_data(proto_tree *bcp_tree, tvbuff_t *tvb, gint flags)
{
    proto_tree *bcp_subtree = NULL;
    guint offset = 0;
    guint offset_base = offset;
    guint len = tvb_reported_length(tvb);

    if (flags & BCP_PROT_FLG_REQ)
    {
        bcp_subtree = proto_tree_add_subtree_format(bcp_tree, tvb, offset, len, ett_bcp_data, NULL,
                                                    "BCP Connect Request: Name=%s IpAddr=%s",
                                                    tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 16, BCP_NAME_LEN, ENC_ASCII),
                                                    tvb_ip_to_str(tvb, offset + 12));

        proto_tree_add_item(bcp_subtree, hf_bcp_connectreq_lenin, tvb, offset, 2, ENC_BIG_ENDIAN);
        offset += 2;
        proto_tree_add_item(bcp_subtree, hf_bcp_connectreq_lenout, tvb, offset, 2, ENC_BIG_ENDIAN);
        offset += 2;
        proto_tree_add_item(bcp_subtree, hf_bcp_connectreq_cycletime, tvb, offset, 4, ENC_BIG_ENDIAN);
        offset += 4;
        proto_tree_add_item(bcp_subtree, hf_bcp_connectreq_offlinefactor, tvb, offset, 2, ENC_BIG_ENDIAN);
        offset += 4;
        proto_tree_add_item(bcp_subtree, hf_bcp_connectreq_ipaddr, tvb, offset, 4, ENC_BIG_ENDIAN);
        offset += 4;
        proto_tree_add_item(bcp_subtree, hf_bcp_connectreq_name, tvb, offset, BCP_NAME_LEN, ENC_ASCII|ENC_NA);
        offset += BCP_NAME_LEN;
        proto_tree_add_item(bcp_subtree, hf_bcp_connectreq_ethaddr, tvb, offset, BCP_ETHADDR_LEN, ENC_NA);
        offset += BCP_ETHADDR_LEN;
        if((len-(offset-offset_base)))
        {
            proto_tree_add_item(bcp_subtree, hf_bcp_connectreq_ethaddr2, tvb, offset, BCP_ETHADDR_LEN, ENC_NA);
            offset += BCP_ETHADDR_LEN;
        }
    }

    if (flags & BCP_PROT_FLG_RSP)
    {
        bcp_subtree = proto_tree_add_subtree_format(bcp_tree, tvb, offset, len, ett_bcp_data, NULL,
                                                    "BCP Connect Response: Error=%d",
                                                    tvb_get_ntohl(tvb, offset));

        proto_tree_add_item(bcp_subtree, hf_bcp_connectrsp_error, tvb, offset, 4, ENC_BIG_ENDIAN);
        offset += 4;
        proto_tree_add_item(bcp_subtree, hf_bcp_connectrsp_lenin, tvb, offset, 2, ENC_BIG_ENDIAN);
        offset += 2;
        proto_tree_add_item(bcp_subtree, hf_bcp_connectrsp_lenout, tvb, offset, 2, ENC_BIG_ENDIAN);
        offset += 2;
    }
}
开发者ID:alagoutte,项目名称:wireshark,代码行数:56,代码来源:packet-bluecom.c

示例3: dissect_mx_records

static void dissect_mx_records(tvbuff_t* tvb, proto_tree* tree, guint32 nrec, int offset)
{

    guint i, curr;
    guint /*len, namelen,*/ priority, dlen;
    const guchar *dname;

    proto_tree* mx_rec_tree, *rec_tree;


    if(tree == NULL)
        return;

    mx_rec_tree = proto_tree_add_subtree_format(tree, tvb, offset, offset, ett_mx_rec, NULL, "MX records (%d)", nrec);

    curr = offset;
    for(i=0; i < nrec; i++)
    {
        /*len =       tvb_get_ntohs(tvb, curr);*/
        priority =  tvb_get_ntohs(tvb, curr + 2);
        /*namelen  =  len - 4;*/

        dlen  = get_dns_name(tvb, curr + 4, 0, curr + 4, &dname);

        rec_tree = proto_tree_add_subtree_format(mx_rec_tree, tvb, curr,6,ett_mx_rec_item,NULL,
                        "MX record: pri=%d,dname=%s", priority,dname);


        proto_tree_add_item(rec_tree,
                            hf_srv_prio,
                            tvb,
                            curr + 2,
                            2,
                            ENC_BIG_ENDIAN);

        proto_tree_add_string(rec_tree,
                            hf_srv_dname,
                            tvb,
                            curr + 4,
                            dlen,
                            dname);

        curr+=(int)((sizeof(short)*2) + dlen);


    }

}
开发者ID:danielwhite84,项目名称:wireshark,代码行数:48,代码来源:packet-lwres.c

示例4: call_ros_oid_callback

int
call_ros_oid_callback(const char *oid, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, struct SESSION_DATA_STRUCTURE* session)
{
	tvbuff_t *next_tvb;
	int len;

	next_tvb = tvb_new_subset_remaining(tvb, offset);

	if(((len = ros_try_string(oid, next_tvb, pinfo, tree, session)) == 0) &&
	   ((len = dissector_try_string(ros_oid_dissector_table, oid, next_tvb, pinfo, tree, session)) == 0)) {
		proto_item *item;
		proto_tree *next_tree;

		next_tree = proto_tree_add_subtree_format(tree, next_tvb, 0, -1, ett_ros_unknown, &item,
				"ROS: Dissector for OID:%s not implemented. Contact Wireshark developers if you want this supported", oid);

		expert_add_info_format(pinfo, item, &ei_ros_dissector_oid_not_implemented,
				       "ROS: Dissector for OID %s not implemented", oid);
		len = dissect_unknown_ber(pinfo, next_tvb, offset, next_tree);
	}

	offset += len;

	return offset;
}
开发者ID:acaceres2176,项目名称:wireshark,代码行数:25,代码来源:packet-ros.c

示例5: call_rtse_oid_callback

static int
call_rtse_oid_callback(const char *oid, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, void* data)
{
	tvbuff_t *next_tvb;

	next_tvb = tvb_new_subset_remaining(tvb, offset);
	if(!dissector_try_string(rtse_oid_dissector_table, oid, next_tvb, pinfo, tree, data)){
		proto_item *item;
		proto_tree *next_tree;
		next_tree = proto_tree_add_subtree_format(tree, next_tvb, 0, -1, ett_rtse_unknown, &item,
							"RTSE: Dissector for OID:%s not implemented. Contact Wireshark developers if you want this supported", oid);

		expert_add_info_format(pinfo, item, &ei_rtse_dissector_oid_not_implemented,
                                        "RTSE: Dissector for OID %s not implemented", oid);
		dissect_unknown_ber(pinfo, next_tvb, offset, next_tree);
	}

	/*XXX until we change the #.REGISTER signature for _PDU()s
	 * into new_dissector_t   we have to do this kludge with
	 * manually step past the content in the ANY type.
	 */
	offset+=tvb_captured_length_remaining(tvb, offset);

	return offset;
}
开发者ID:Sherkyoung,项目名称:wireshark,代码行数:25,代码来源:packet-rtse-template.c

示例6: dissect_request_resolve

static void dissect_request_resolve(tvbuff_t *tvb, int offset,
	proto_tree *tree) {

/* dissect the request resolve structure */
/* display a string with a length, characters encoding */
/* they are displayed under a tree with the name in Label variable */
/* return the length of the string and the length byte */

	proto_tree      *name_tree;

	int length = tvb_get_guint8( tvb, offset);

	if ( tree){
		name_tree = proto_tree_add_subtree_format(tree, tvb, offset, length + 1,
			ett_msproxy_name, NULL, "Host Name: %.*s", length,
			tvb_get_string_enc( wmem_packet_scope(),  tvb, offset + 18, length, ENC_ASCII));

		proto_tree_add_text( name_tree, tvb, offset, 1, "Length: %d",
			length);

		++offset;
		offset += 17;

		proto_tree_add_text( name_tree, tvb, offset, length, "String: %s",
            tvb_get_string_enc( wmem_packet_scope(),  tvb, offset, length, ENC_ASCII));
	}
}
开发者ID:danielwhite84,项目名称:wireshark,代码行数:27,代码来源:packet-msproxy.c

示例7: dissect_vektor_igrp

static void dissect_vektor_igrp (tvbuff_t *tvb, proto_tree *igrp_vektor_tree, guint8 network)
{
  guint8 *ptr_addr,addr[5];
  address ip_addr;

  addr[0]=network;
  addr[1]=tvb_get_guint8(tvb,0);
  addr[2]=tvb_get_guint8(tvb,1);
  addr[3]=tvb_get_guint8(tvb,2);
  addr[4]=0;

  ptr_addr=addr;
  if (network==0) ptr_addr=&addr[1];

  SET_ADDRESS(&ip_addr, AT_IPv4, 4, ptr_addr);
  igrp_vektor_tree = proto_tree_add_subtree_format(igrp_vektor_tree, tvb, 0 ,14,
                                                   ett_igrp_net, NULL, "Entry for network %s", address_to_str(wmem_packet_scope(), &ip_addr));
  proto_tree_add_ipv4(igrp_vektor_tree, hf_igrp_network, tvb, 0, 3, *((guint32*)ptr_addr));
  proto_tree_add_item(igrp_vektor_tree, hf_igrp_delay, tvb, 3, 3, ENC_BIG_ENDIAN);
  proto_tree_add_item(igrp_vektor_tree, hf_igrp_bandwidth, tvb, 6, 3, ENC_BIG_ENDIAN);
  proto_tree_add_uint_format_value(igrp_vektor_tree, hf_igrp_mtu, tvb, 9, 2, tvb_get_ntohs(tvb,9), "%d  bytes", tvb_get_ntohs(tvb,9));
  proto_tree_add_item(igrp_vektor_tree, hf_igrp_reliability, tvb, 11, 1, ENC_BIG_ENDIAN);
  proto_tree_add_item(igrp_vektor_tree, hf_igrp_load, tvb, 12, 1, ENC_BIG_ENDIAN);
  proto_tree_add_item(igrp_vektor_tree, hf_igrp_hop_count, tvb, 13, 1, ENC_BIG_ENDIAN);
}
开发者ID:bearxiong99,项目名称:wireshark,代码行数:25,代码来源:packet-igrp.c

示例8: dissect_umts_cell_broadcast_message

void dissect_umts_cell_broadcast_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
   guint8 sms_encoding;
   guint32       offset = 0;
   guint32       len;
   proto_item    *cbs_item;
   proto_tree    *cbs_tree, *cbs_subtree;
   guint         msg_len;
   guint8        *msg;
   tvbuff_t * cbs_msg_tvb = NULL;

   len = tvb_length(tvb);

   col_append_str(pinfo->cinfo, COL_PROTOCOL, " Cell Broadcast");
   col_append_str(pinfo->cinfo, COL_INFO, " (CBS Message)");

   cbs_item = proto_tree_add_protocol_format(proto_tree_get_root(tree), proto_cell_broadcast, tvb, 0, len, "Cell Broadcast");
   cbs_tree = proto_item_add_subtree(cbs_item, ett_cbs_msg);

   sms_encoding = dissect_cbs_data_coding_scheme(tvb, pinfo, cbs_tree, 0);
   offset++;
   cbs_msg_tvb = dissect_cbs_data(sms_encoding, tvb, cbs_tree, pinfo, offset );

   msg_len = tvb_length(cbs_msg_tvb);
   cbs_subtree = proto_tree_add_subtree_format(cbs_tree, tvb, offset, -1,
                    ett_cbs_msg, NULL, "Cell Broadcast Message Contents (length: %d)", msg_len);
   msg = tvb_get_string_enc(wmem_packet_scope(), cbs_msg_tvb, 0, msg_len, ENC_ASCII);
   proto_tree_add_string_format(cbs_subtree, hf_gsm_cbs_message_content, cbs_msg_tvb, 0, -1, msg, "%s", msg);
}
开发者ID:Sherkyoung,项目名称:wireshark,代码行数:29,代码来源:packet-cell_broadcast.c

示例9: dissect_componentstatusprotocol_componentstatusreport_message

static void
dissect_componentstatusprotocol_componentstatusreport_message(tvbuff_t *message_tvb, proto_tree *message_tree)
{
  tvbuff_t   *association_tvb;
  proto_tree *association_tree;
  /* gint        associations; - variable set but not used, so commented out */
  int         i;
  gint        offset;

  proto_tree_add_item(message_tree, hf_componentstatusreport_reportinterval, message_tvb, COMPONENTSTATUSREPORT_REPORTINTERVAL_OFFSET, COMPONENTSTATUSREPORT_REPORTINTERVAL_LENGTH, ENC_BIG_ENDIAN);
  proto_tree_add_item(message_tree, hf_componentstatusreport_location,       message_tvb, COMPONENTSTATUSREPORT_LOCATION_OFFSET,       COMPONENTSTATUSREPORT_LOCATION_LENGTH,       ENC_ASCII|ENC_NA);
  proto_tree_add_item(message_tree, hf_componentstatusreport_status,         message_tvb, COMPONENTSTATUSREPORT_STATUS_OFFSET,         COMPONENTSTATUSREPORT_STATUS_LENGTH,         ENC_ASCII|ENC_NA);
  proto_tree_add_item(message_tree, hf_componentstatusreport_workload,       message_tvb, COMPONENTSTATUSREPORT_WORKLOAD_OFFSET,       COMPONENTSTATUSREPORT_WORKLOAD_LENGTH,       ENC_BIG_ENDIAN);
  proto_tree_add_item(message_tree, hf_componentstatusreport_associations,   message_tvb, COMPONENTSTATUSREPORT_ASSOCIATIONS_OFFSET,   COMPONENTSTATUSREPORT_ASSOCIATIONS_LENGTH,   ENC_BIG_ENDIAN);

  /* associations = tvb_get_ntohs(message_tvb, COMPONENTSTATUSREPORT_ASSOCIATIONS_OFFSET); */
  offset = COMPONENTSTATUSREPORT_ASSOCIATIONARRAY_OFFSET;
  i = 1;
  while(tvb_reported_length_remaining(message_tvb, offset) >= COMPONENTASSOCIATION_LENGTH) {
     association_tree = proto_tree_add_subtree_format(message_tree, message_tvb, offset, COMPONENTASSOCIATION_LENGTH,
         ett_association, NULL, "Association #%d", i++);
     association_tvb  = tvb_new_subset(message_tvb, offset,
                                       MIN(COMPONENTASSOCIATION_LENGTH, tvb_reported_length_remaining(message_tvb, offset)),
                                       COMPONENTASSOCIATION_LENGTH);

     dissect_componentstatusprotocol_componentassociation_message(association_tvb, association_tree);
     offset += COMPONENTASSOCIATION_LENGTH;
  }
}
开发者ID:MichaelQQ,项目名称:Wireshark-PE,代码行数:29,代码来源:packet-componentstatus.c

示例10: dissect_bfd_authentication

static void
dissect_bfd_authentication(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
    int         offset    = 24;
    guint8      auth_type;
    guint8      auth_len;
    proto_item *ti        = NULL;
    proto_item *auth_item = NULL;
    proto_tree *auth_tree = NULL;
    guint8     *password;

    auth_type = tvb_get_guint8(tvb, offset);
    auth_len  = tvb_get_guint8(tvb, offset + 1);

    if (tree) {
        auth_tree = proto_tree_add_subtree_format(tree, tvb, offset, auth_len,
                                        ett_bfd_auth, NULL, "Authentication: %s",
                                        val_to_str(auth_type,
                                                   bfd_control_auth_type_values,
                                                   "Unknown Authentication Type (%d)") );

        proto_tree_add_item(auth_tree, hf_bfd_auth_type, tvb, offset, 1, ENC_BIG_ENDIAN);

        ti = proto_tree_add_item(auth_tree, hf_bfd_auth_len, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
        proto_item_append_text(ti, " bytes");

        proto_tree_add_item(auth_tree, hf_bfd_auth_key, tvb, offset + 2, 1, ENC_BIG_ENDIAN);
    }

    switch (auth_type) {
        case BFD_AUTH_SIMPLE:
            if (tree) {
                password = tvb_get_string_enc(wmem_packet_scope(), tvb, offset+3, auth_len-3, ENC_ASCII);
                proto_tree_add_string(auth_tree, hf_bfd_auth_password, tvb, offset+3,
                                      auth_len-3, password);
                proto_item_append_text(auth_item, ": %s", password);
            }
            break;
        case BFD_AUTH_MD5:
        case BFD_AUTH_MET_MD5:
        case BFD_AUTH_SHA1:
        case BFD_AUTH_MET_SHA1:
            if (auth_len != get_bfd_required_auth_len(auth_type)) {
                proto_tree_add_expert_format(auth_tree, pinfo, &ei_bfd_auth_len_invalid, tvb, offset, auth_len,
                        "Length of authentication section (%d) is invalid for Authentication Type: %s",
                        auth_len, val_to_str(auth_type, bfd_control_auth_type_values, "Unknown Authentication Type (%d)") );

                proto_item_append_text(auth_item, ": Invalid Authentication Section");
            }

            if (tree) {
                proto_tree_add_item(auth_tree, hf_bfd_auth_seq_num, tvb, offset+4, 4, ENC_BIG_ENDIAN);

                proto_tree_add_item(auth_tree, hf_bfd_checksum, tvb, offset+8, get_bfd_checksum_len(auth_type), ENC_NA);
            }
            break;
        default:
            break;
    }
}
开发者ID:joewan,项目名称:wireshark,代码行数:60,代码来源:packet-bfd.c

示例11: dissect_bcp_protocol_header

/*
 * dissector function of protocol header
 *
 * input: tree, buffer (data), offset (data pointer)
 * output: flags, block count, segcode from header
 * return: updated offset
 */
static guint
dissect_bcp_protocol_header(proto_tree *bcp_tree, tvbuff_t *tvb,
                            guint offset, gint *flags, guint *blocknb,
                            guint *segcode)
{
    proto_tree *bcp_subtree = NULL;

    *flags = tvb_get_guint8(tvb, offset + 2);
    *blocknb = tvb_get_guint8(tvb, offset + 3);
    *segcode = tvb_get_ntohs(tvb, offset + 4);

    bcp_subtree = proto_tree_add_subtree_format(bcp_tree, tvb, 0, BCP_PROTOCOL_HDR_LEN, ett_bcp_header, NULL,
                                                "BCP Protocol Header: BlockNb=%d, SegCode=%d",
                                                *blocknb,
                                                *segcode);

    proto_tree_add_item(bcp_subtree, hf_bcp_hdr_version, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset += 1;
    proto_tree_add_item(bcp_subtree, hf_bcp_hdr_format, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset += 1;
    proto_tree_add_item(bcp_subtree, hf_bcp_hdr_protflags, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset += 1;
    proto_tree_add_item(bcp_subtree, hf_bcp_hdr_blocknb, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset += 1;
    proto_tree_add_item(bcp_subtree, hf_bcp_hdr_segcode, tvb, offset, 2, ENC_BIG_ENDIAN);
    offset += 2;
    proto_tree_add_item(bcp_subtree, hf_bcp_hdr_auth, tvb, offset, 4, ENC_BIG_ENDIAN);
    offset += 4;
    return offset;
}
开发者ID:alagoutte,项目名称:wireshark,代码行数:37,代码来源:packet-bluecom.c

示例12: dissect_bcp_sync_data

/*
 * dissector function of sync data
 *
 * input: tree, buffer (block data)
 * return: nothing
 */
static void
dissect_bcp_sync_data(proto_tree *bcp_tree, tvbuff_t *tvb)
{
    proto_tree *bcp_subtree = NULL;
    guint offset = 0;
    guint offset_base = offset;
    guint len = tvb_reported_length(tvb);

    bcp_subtree = proto_tree_add_subtree_format(bcp_tree, tvb, offset, len, ett_bcp_data, NULL,
                                             "BCP Sync Data: Identify=%s",
                                             BOOLSTR(tvb_get_guint8(tvb, offset + 9)));
    proto_tree_add_item(bcp_subtree, hf_bcp_sync_starttime, tvb, offset, 4, ENC_BIG_ENDIAN);
    offset += 4;
    proto_tree_add_item(bcp_subtree, hf_bcp_sync_cycletime, tvb, offset, 4, ENC_BIG_ENDIAN);
    offset += 4;
    proto_tree_add_item(bcp_subtree, hf_bcp_sync_dataratio, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset += 1;
    proto_tree_add_item(bcp_subtree, hf_bcp_sync_identify, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset += 1;
    proto_tree_add_item(bcp_subtree, hf_bcp_sync_vlantag, tvb, offset, 2, ENC_BIG_ENDIAN);
    offset += 2;

    /* protocol expansion*/
    if((len-(offset-offset_base)))
    {
        proto_tree_add_item(bcp_subtree, hf_bcp_sync_ethaddr, tvb, offset, BCP_ETHADDR_LEN, ENC_NA);
        offset += BCP_ETHADDR_LEN;
        proto_tree_add_item(bcp_subtree, hf_bcp_sync_ethaddr2, tvb, offset, BCP_ETHADDR_LEN, ENC_NA);
        offset += BCP_ETHADDR_LEN;
    }
}
开发者ID:alagoutte,项目名称:wireshark,代码行数:37,代码来源:packet-bluecom.c

示例13: dissect_bcp_identify_data

/*
 * dissector function of identify data (request)
 *
 * input: tree, buffer (block data), flags (req or rsp)
 * return: nothing
 */
static void
dissect_bcp_identify_data(proto_tree *bcp_tree, tvbuff_t *tvb)
{
    proto_tree *bcp_subtree = NULL;
    guint offset = 0;
    guint offset_base = offset;
    guint len = tvb_reported_length(tvb);

    bcp_subtree = proto_tree_add_subtree_format(bcp_tree, tvb, offset, len, ett_bcp_data, NULL,
                    "BCP Identify Request: Name=%s, IpAddr=%s",
                    tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 12, BCP_NAME_LEN, ENC_ASCII),
                    tvb_ip_to_str(tvb, offset + 8)
                    );

    proto_tree_add_item(bcp_subtree, hf_bcp_identify_error, tvb, offset, 4, ENC_BIG_ENDIAN);
    offset += 4;
    proto_tree_add_item(bcp_subtree, hf_bcp_identify_starttime, tvb, offset, 4, ENC_BIG_ENDIAN);
    offset += 4;
    proto_tree_add_item(bcp_subtree, hf_bcp_identify_ipaddr, tvb, offset, 4, ENC_BIG_ENDIAN);
    offset += 4;
    proto_tree_add_item(bcp_subtree, hf_bcp_identify_name, tvb, offset, BCP_NAME_LEN, ENC_ASCII|ENC_NA);
    offset += BCP_NAME_LEN;
    proto_tree_add_item(bcp_subtree, hf_bcp_identify_ethaddr, tvb, offset, BCP_ETHADDR_LEN, ENC_NA);
    offset += BCP_ETHADDR_LEN;
    if((len-(offset-offset_base)))
    {
        proto_tree_add_item(bcp_subtree, hf_bcp_identify_ethaddr2, tvb, offset, BCP_ETHADDR_LEN, ENC_NA);
        offset += BCP_ETHADDR_LEN;
    }
}
开发者ID:alagoutte,项目名称:wireshark,代码行数:36,代码来源:packet-bluecom.c

示例14: dissect_a_records

static void dissect_a_records(tvbuff_t* tvb, proto_tree* tree,guint32 nrec,int offset)
{
    guint32 i, curr;
    const gchar* addrs;
    proto_tree* a_rec_tree;
    proto_tree* addr_tree;

    if(tree == NULL)
        return;

    a_rec_tree = proto_tree_add_subtree(tree,tvb,offset,
                (int)((sizeof(guint32) + sizeof(guint16)) * nrec),
                ett_a_rec, NULL, "A records");

    for(i=0; i<nrec; i++)
    {

        curr = offset + (int)((sizeof(guint32)+sizeof(guint16)) * i);

        addrs = tvb_ip_to_str(tvb, curr+2);

        addr_tree = proto_tree_add_subtree_format(a_rec_tree, tvb, curr,
                            6, ett_a_rec_addr, NULL, "Address %s", addrs);

        proto_tree_add_item(addr_tree, hf_a_rec_len, tvb, curr,
                    sizeof(guint16), ENC_BIG_ENDIAN);

        proto_tree_add_item(addr_tree, hf_a_record, tvb, curr + 2, 4, ENC_BIG_ENDIAN);
    }

}
开发者ID:danielwhite84,项目名称:wireshark,代码行数:31,代码来源:packet-lwres.c

示例15: redbackli_dissect_avp

static void
redbackli_dissect_avp(guint8 avptype, guint8 avplen, tvbuff_t *tvb, gint offset, proto_tree *tree)
{
	const char	*avpname;
	proto_tree	*st = NULL;

	avpname = val_to_str_const(avptype, avp_names, "Unknown");

	st = proto_tree_add_subtree_format(tree, tvb, offset, avplen+2, ett_redbackli, NULL, "%s AVP", avpname);

	proto_tree_add_uint(st, hf_redbackli_avptype, tvb, offset, 1, avptype);
	proto_tree_add_uint(st, hf_redbackli_avplen, tvb, offset+1, 1, avplen);

	if (!avplen)
		return;

	/* XXX: ToDo: Validate the length (avplen) of the fixed length fields
	   before calling proto_tree_add_item().
	   Note that the field lengths have been validated when
	   dissect_avp() is called from redbackli_dissect_heur().
	*/

	switch (avptype) {
		case(RB_AVP_SEQNO):
			proto_tree_add_item(st, hf_redbackli_seqno, tvb,
					    offset+2, avplen, ENC_BIG_ENDIAN);
			break;
		case(RB_AVP_LIID):
			proto_tree_add_item(st, hf_redbackli_liid, tvb,
					    offset+2, avplen, ENC_BIG_ENDIAN);
			break;
		case(RB_AVP_SESSID):
			proto_tree_add_item(st, hf_redbackli_sessid, tvb,
					    offset+2, avplen, ENC_BIG_ENDIAN);
			break;
		case(RB_AVP_LABEL):
			proto_tree_add_item(st, hf_redbackli_label, tvb,
					    offset+2, avplen, ENC_ASCII|ENC_NA);
			break;
		case(RB_AVP_EOH):
			proto_tree_add_item(st, hf_redbackli_eohpad, tvb,
					    offset+2, avplen, ENC_NA);
			break;
		case(RB_AVP_DIR):
			proto_tree_add_item(st, hf_redbackli_dir, tvb,
					offset+2, avplen, ENC_NA);
			break;
		case(RB_AVP_ACCTID):
			proto_tree_add_item(st, hf_redbackli_acctid, tvb,
					    offset+2, avplen, ENC_NA);
			break;
		default:
			proto_tree_add_item(st, hf_redbackli_unknownavp, tvb,
					    offset+2, avplen, ENC_NA);
			break;
	}

	return;
}
开发者ID:Nicholas1126,项目名称:wireshark-ex,代码行数:59,代码来源:packet-redbackli.c


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