• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ col_add_str函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: dissect_dm1

void
dissect_dm1(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset)
{
	int len;	/* payload length indicated by payload header */
	int llid;	/* logical link id */
	int l2len;	/* length indicated by l2cap header */
	proto_item *dm1_item;
	proto_tree *dm1_tree;
	tvbuff_t *pld_tvb;

	/*
	 * FIXME
	 * I'm probably doing a terrible, terrible thing here, but it gets my
	 * initial test cases working.
	 */
	guint16 fake_acl_data;

	if(tvb_reported_length_remaining(tvb, offset) < 3) {
		col_add_str(pinfo->cinfo, COL_INFO, "Encrypted or malformed payload data");
		return;
	}

	dm1_item = proto_tree_add_item(tree, hf_btbredr_payload, tvb, offset, -1, ENC_NA);
	dm1_tree = proto_item_add_subtree(dm1_item, ett_btbredr_payload);

	len = dissect_payload_header1(dm1_tree, tvb, offset);
	llid = tvb_get_guint8(tvb, offset) & 0x3;
	offset += 1;

	if(tvb_reported_length_remaining(tvb, offset) < len + 2) {
		col_add_str(pinfo->cinfo, COL_INFO, "Encrypted or malformed payload data");
		return;
	}
	
	if (llid == 3 && btlmp_handle) {
		/* LMP */
		pld_tvb = tvb_new_subset(tvb, offset, len, len);
		call_dissector(btlmp_handle, pld_tvb, pinfo, dm1_tree);
	} else if (llid == 2 && btl2cap_handle) {
		/* unfragmented L2CAP or start of fragment */
		l2len = tvb_get_letohs(tvb, offset);
		if (l2len + 4 == len) {
			/* unfragmented */
			pld_tvb = tvb_new_subset(tvb, offset, len, len);
			call_dissector_with_data(btl2cap_handle, pld_tvb, pinfo, dm1_tree, &fake_acl_data);
		} else {
			/* start of fragment */
			proto_tree_add_item(dm1_tree, hf_btbredr_pldbody, tvb, offset, len, ENC_NA);
		}
	} else {
		proto_tree_add_item(dm1_tree, hf_btbredr_pldbody, tvb, offset, len, ENC_NA);
	}
	offset += len;

	proto_tree_add_item(dm1_tree, hf_btbredr_crc, tvb, offset, 2, ENC_LITTLE_ENDIAN);
	offset += 2;
}
开发者ID:SylvainDR,项目名称:libbtbb,代码行数:57,代码来源:packet-btbredr.c


示例2: dissect_bthcrp

static void
dissect_bthcrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
    proto_item     *main_item;
    proto_tree     *main_tree;
    btl2cap_data_t *l2cap_data;
    gint            offset = 0;
    gboolean        is_client_message;

    l2cap_data = (btl2cap_data_t *) pinfo->private_data;

    col_set_str(pinfo->cinfo, COL_PROTOCOL, "HCRP");
    col_clear(pinfo->cinfo, COL_INFO);

    switch (pinfo->p2p_dir) {
        case P2P_DIR_SENT:
            col_add_str(pinfo->cinfo, COL_INFO, "Sent ");
            break;
        case P2P_DIR_RECV:
            col_add_str(pinfo->cinfo, COL_INFO, "Rcvd ");
            break;
        default:
            col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown direction %d ",
                pinfo->p2p_dir);
            break;
    }

    main_item = proto_tree_add_item(tree, proto_bthcrp, tvb, offset, -1, ENC_NA);
    main_tree = proto_item_add_subtree(main_item, ett_bthcrp);

/* TODO: Implement streams reconizing by SDP
 * Server provide SDP record for Control and Data PSM
 * Client provide SDP record for Notification PSM (optional)
 */
    is_client_message = (is_client && pinfo->p2p_dir == P2P_DIR_SENT) ||
            (!is_client && pinfo->p2p_dir == P2P_DIR_RECV);

    if (psm_control != 0 && l2cap_data->psm == psm_control) {
        offset = dissect_control(tvb, pinfo, main_tree, offset, is_client_message);
    } else if (psm_data_stream != 0 && l2cap_data->psm == psm_data_stream) {
        offset = dissect_data(tvb, pinfo, main_tree, offset);
    } else if (psm_notification != 0 && l2cap_data->psm == psm_notification) {
        offset = dissect_notification(tvb, pinfo, main_tree, offset, is_client_message);
    } else {
        col_append_fstr(pinfo->cinfo, COL_INFO, "HCRP stream (CID: 0x%04X)", l2cap_data->cid);
    }

    if (tvb_length_remaining(tvb, offset)) {
        proto_item *pitem;

        pitem = proto_tree_add_item(main_tree, hf_bthcrp_data, tvb, offset, -1, ENC_NA);
        expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN,
                "Unexpected data");
    }
}
开发者ID:SayCV,项目名称:wireshark,代码行数:55,代码来源:packet-bthcrp.c


示例3: dissect_teimanagement

static void
dissect_teimanagement(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
    proto_tree *tei_tree = NULL;
    proto_item *tei_ti;
    guint8 message;

    col_set_str(pinfo->cinfo, COL_PROTOCOL, "TEI");
    col_clear(pinfo->cinfo, COL_INFO);

    if (tree) {
	tei_ti = proto_tree_add_item(tree, proto_tei, tvb, 0, 5, ENC_NA);
	tei_tree = proto_item_add_subtree(tei_ti, lm_subtree);

	proto_tree_add_item(tei_tree, lm_entity_id, tvb, 0, 1, ENC_BIG_ENDIAN);
	proto_tree_add_item(tei_tree, lm_reference,  tvb, 1, 2, ENC_BIG_ENDIAN);
    }

    message = tvb_get_guint8(tvb, 3);
    if (check_col(pinfo->cinfo, COL_INFO))
	col_add_str(pinfo->cinfo, COL_INFO,
	    val_to_str(message, tei_msg_vals, "Unknown message type (0x%04x)"));
    if (tree) {
	proto_tree_add_uint(tei_tree, lm_message, tvb, 3, 1, message);
	proto_tree_add_item(tei_tree, lm_action, tvb, 4, 1, ENC_BIG_ENDIAN);
	proto_tree_add_item(tei_tree, lm_extend, tvb, 4, 1, ENC_BIG_ENDIAN);
    }
}
开发者ID:SayCV,项目名称:wireshark,代码行数:28,代码来源:packet-teimanagement.c


示例4: dissect_asf

static void
dissect_asf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
    proto_tree	*asf_tree = NULL;
    proto_item	*ti;
    guint8		type;
    guint8		len;
    tvbuff_t	*next_tvb;

    col_set_str(pinfo->cinfo, COL_PROTOCOL, "ASF");

    col_clear(pinfo->cinfo, COL_INFO);

    type = tvb_get_guint8(tvb, 4);
    len = tvb_get_guint8(tvb, 7);

    if (check_col(pinfo->cinfo, COL_INFO))
        col_add_str(pinfo->cinfo, COL_INFO,
                    val_to_str(type, asf_type_vals, "Unknown (0x%02x)"));

    if (tree) {
        ti = proto_tree_add_item(tree, proto_asf, tvb, 0, 8, FALSE);
        asf_tree = proto_item_add_subtree(ti, ett_asf);
        /* FIXME: resolve enterprise ID */
        proto_tree_add_item(asf_tree, hf_asf_iana, tvb, 0, 4, FALSE);
        proto_tree_add_item(asf_tree, hf_asf_type, tvb, 4, 1, FALSE);
        proto_tree_add_item(asf_tree, hf_asf_tag, tvb, 5, 1, FALSE);
        proto_tree_add_item(asf_tree, hf_asf_len, tvb, 7, 1, FALSE);
    }

    if (len) {
        next_tvb = tvb_new_subset(tvb, 8, -1, len);
        call_dissector(data_handle, next_tvb, pinfo, tree);
    }
}
开发者ID:flaub,项目名称:HotFuzz,代码行数:35,代码来源:packet-asf.c


示例5: dissect_fcsp

static void dissect_fcsp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
    proto_item *ti = NULL;
    guint8 opcode;
    int offset = 0;
    proto_tree *fcsp_tree = NULL;

    /* Make entry in the Info column on summary display */
    opcode = tvb_get_guint8 (tvb, 2);

    if (check_col (pinfo->cinfo, COL_INFO)) {
        col_add_str (pinfo->cinfo, COL_INFO,
                     val_to_str (opcode, fcauth_msgcode_vals, "0x%x"));
    }
    
    if (tree) {
        ti = proto_tree_add_protocol_format (tree, proto_fcsp, tvb, 0,
                                             tvb_length (tvb), "FC-SP");
        fcsp_tree = proto_item_add_subtree (ti, ett_fcsp);

        proto_tree_add_item (fcsp_tree, hf_auth_flags, tvb, offset+1, 1, 0);
        proto_tree_add_item (fcsp_tree, hf_auth_msg_code, tvb, offset+2, 1, 0);
        proto_tree_add_item (fcsp_tree, hf_auth_proto_ver, tvb, offset+3, 1,
                             0);
        proto_tree_add_item (fcsp_tree, hf_auth_len, tvb, offset+4, 4, 0);
        proto_tree_add_item (fcsp_tree, hf_auth_tid, tvb, offset+8, 4, 0);

        switch (opcode) {
        case FC_AUTH_MSG_AUTH_REJECT:
            dissect_fcsp_auth_rjt (tvb, tree);
            break;
        case FC_AUTH_MSG_AUTH_NEGOTIATE:
            dissect_fcsp_auth_negotiate (tvb, tree);
            break;
        case FC_AUTH_MSG_AUTH_DONE:
            dissect_fcsp_auth_done (tvb, tree);
            break;
        case FC_AUTH_DHCHAP_CHALLENGE:
            dissect_fcsp_dhchap_challenge (tvb, tree);
            break;
        case FC_AUTH_DHCHAP_REPLY:
            dissect_fcsp_dhchap_reply (tvb, tree);
            break;
        case FC_AUTH_DHCHAP_SUCCESS:
            dissect_fcsp_dhchap_success (tvb, tree);
            break;
        case FC_AUTH_FCAP_REQUEST:
        case FC_AUTH_FCAP_ACKNOWLEDGE:
        case FC_AUTH_FCAP_CONFIRM:
        case FC_AUTH_FCPAP_INIT:
        case FC_AUTH_FCPAP_ACCEPT:
        case FC_AUTH_FCPAP_COMPLETE:
            proto_tree_add_text (fcsp_tree, tvb, offset+12, tvb_length (tvb),
                                 "FCAP Decoding Not Supported");
            break;
        default:
            break;
        }
    }
}
开发者ID:flaub,项目名称:HotFuzz,代码行数:60,代码来源:packet-fcsp.c


示例6: dissect_ioraw

static void dissect_ioraw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
   proto_item *ti;
   proto_tree *ioraw_tree;
   gint offset = 0;
   char szText[200];
   int nMax = sizeof(szText)-1;

   guint ioraw_length = tvb_reported_length(tvb);

   col_set_str(pinfo->cinfo, COL_PROTOCOL, "IO-RAW");

   IoRawSummaryFormater(szText, nMax);
   col_add_str(pinfo->cinfo, COL_INFO, szText);

   if (tree)
   {
      ti = proto_tree_add_item(tree, proto_ioraw, tvb, 0, -1, ENC_NA);
      ioraw_tree = proto_item_add_subtree(ti, ett_ioraw);

      proto_item_append_text(ti,": %s",szText);
      proto_tree_add_item(ioraw_tree, hf_ioraw_header, tvb, offset, IoRawParserHDR_Len, ENC_NA);
      offset+=IoRawParserHDR_Len;

      proto_tree_add_item(ioraw_tree, hf_ioraw_data, tvb, offset, ioraw_length - offset, ENC_NA);
   }
}
开发者ID:MultipathDTLS,项目名称:wireshark,代码行数:27,代码来源:packet-ioraw.c


示例7: dissect_rsh

static void
dissect_rsh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
	proto_tree	*rsh_tree;
	proto_item	*ti, *hidden_item;
	gint		offset = 0;
	gint		next_offset;
	int		linelen;

	col_set_str(pinfo->cinfo, COL_PROTOCOL, "RSH");
	if (check_col(pinfo->cinfo, COL_INFO)) {
		/* Put the first line from the buffer into the summary. */
		tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE);
		linelen = next_offset - offset;	/* include the line terminator */

		/*
		 * Make sure the line terminator isn't past the end of
		 * the captured data in the packet, so we don't throw
		 * an exception in the "tvb_get_ptr()" call.
		 */
		if (linelen > (int) tvb_length(tvb))
			linelen = tvb_length(tvb);
		col_add_str(pinfo->cinfo, COL_INFO,
		    tvb_format_text(tvb, offset, linelen));
	}
	if (tree) {
		ti = proto_tree_add_item(tree, proto_rsh, tvb, offset, -1,
		    FALSE);
		rsh_tree = proto_item_add_subtree(ti, ett_rsh);

		/*
		 * Process the packet data, a line at a time.
		 */
		while (tvb_offset_exists(tvb, offset)) {
			/*
			 * Find the end of the line.
			 */
			tvb_find_line_end(tvb, offset, -1, &next_offset,
			    FALSE);

			/*
			 * Put this line.
			 */
			proto_tree_add_text(rsh_tree, tvb, offset,
			    next_offset - offset, "%s",
			    tvb_format_text(tvb, offset, next_offset - offset));
			offset = next_offset;
		}

		if (pinfo->match_port == pinfo->destport) {
			hidden_item = proto_tree_add_boolean(rsh_tree,
			    hf_rsh_request, tvb, 0, 0, 1);
                } else {
			hidden_item = proto_tree_add_boolean(rsh_tree,
			    hf_rsh_response, tvb, 0, 0, 1);
                }
                PROTO_ITEM_SET_HIDDEN(hidden_item);
	}
}
开发者ID:AkhilaAG,项目名称:gluster-wireshark-1.4,代码行数:59,代码来源:packet-rsh.c


示例8: dissect_msnms

static void
dissect_msnms(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
        proto_tree      *msnms_tree;
	proto_item	*ti;
	gint		offset = 0;
	const guchar	*line;
	gint		next_offset;
	int		linelen;
	/* int		tokenlen; */
	/* const guchar	*next_token; */

	col_set_str(pinfo->cinfo, COL_PROTOCOL, "MSNMS");

	/*
	 * Find the end of the first line.
	 *
	 * Note that "tvb_find_line_end()" will return a value that is
	 * not longer than what's in the buffer, so the "tvb_get_ptr()"
	 * call won't throw an exception.
	 */
	linelen = tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE);
	line = tvb_get_ptr(tvb, offset, linelen);


	if (check_col(pinfo->cinfo, COL_INFO)) {
		/*
		 * Put the first line from the buffer into the summary.
		 */
		col_add_str(pinfo->cinfo, COL_INFO, 
			    format_text(line, linelen));
	}

	if (tree) {
		ti = proto_tree_add_item(tree, proto_msnms, tvb, offset, -1,
		    FALSE);
		msnms_tree = proto_item_add_subtree(ti, ett_msnms);

		/*
		 * Show the rest of the packet as text,
		 * a line at a time.
		 */
		while (tvb_offset_exists(tvb, offset)) {
			/*
			 * Find the end of the line.
			 */
			linelen = tvb_find_line_end(tvb, offset, -1,
			    &next_offset, FALSE);

			/*
			 * Put this line.
			 */
			proto_tree_add_text(msnms_tree, tvb, offset,
			    next_offset - offset, "%s",
			    tvb_format_text(tvb, offset, next_offset - offset));
			offset = next_offset;
		}
	}
}
开发者ID:AkhilaAG,项目名称:gluster-wireshark-1.4,代码行数:59,代码来源:packet-msn-messenger.c


示例9: dissect_msdp

static void
dissect_msdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
        proto_item *ti;
        proto_tree *msdp_tree;
        int         offset;
        guint8      type;
        guint16     length;


        col_set_str(pinfo->cinfo, COL_PROTOCOL, "MSDP");

        if (check_col(pinfo->cinfo, COL_INFO))
                col_add_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(tvb, 0),
                                                                     msdp_types,
                                                                     "<Unknown MSDP message type>"));

        ti = proto_tree_add_item(tree, proto_msdp, tvb, 0, -1, ENC_NA);
        msdp_tree = proto_item_add_subtree(ti, ett_msdp);

        offset = 0;
        while (tvb_reported_length_remaining(tvb, offset) >= 3) {
                type = tvb_get_guint8(tvb, offset);
                length = tvb_get_ntohs(tvb, offset + 1);
                if (length < 3)
                        break;
                proto_tree_add_uint(msdp_tree, hf_msdp_type, tvb, offset, 1, type);
                proto_tree_add_uint(msdp_tree, hf_msdp_length, tvb, offset + 1, 2, length);
                offset += 3;
                length -= 3;

                switch (type) {
                case MSDP_SA:
                case MSDP_SA_RSP:
                        dissect_msdp_sa(tvb, pinfo, msdp_tree, &offset,
                                        length);
                        break;
                case MSDP_SA_REQ:
                        proto_tree_add_item(msdp_tree, hf_msdp_sa_req_res, tvb, offset, 1, ENC_BIG_ENDIAN);
                        proto_tree_add_item(msdp_tree, hf_msdp_sa_req_group, tvb, offset + 1, 4, ENC_BIG_ENDIAN);
                        offset += 5;
                        break;
                case MSDP_NOTIFICATION:
                        dissect_msdp_notification(tvb, pinfo, msdp_tree, &offset, length);
                        break;
                default:
                        if (length > 0)
                                proto_tree_add_text(msdp_tree, tvb, offset, length, "TLV contents");
                        offset += length;
                        break;
                }
        }

        if (tvb_length_remaining(tvb, offset) > 0)
                proto_tree_add_text(msdp_tree, tvb, offset,
                                    -1, "Trailing junk");

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


示例10: dissect_lmi

static void
dissect_lmi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
	proto_tree	*lmi_tree = NULL, *lmi_subtree;
	proto_item	*ti;
	int		offset = 2, len;
	guint8		msg_type;
	guint8		ele_id;

	col_set_str(pinfo->cinfo, COL_PROTOCOL, "LMI");
	col_clear(pinfo->cinfo, COL_INFO);

	if (tree) {
		ti = proto_tree_add_item(tree, proto_lmi, tvb, 0, 3, FALSE);
		lmi_tree = proto_item_add_subtree(ti, ett_lmi_ele);

		proto_tree_add_item(lmi_tree, hf_lmi_call_ref, tvb, 0, 1, FALSE);
	}
	msg_type = tvb_get_guint8( tvb, 1);
	if (check_col(pinfo->cinfo, COL_INFO)) {
		col_add_str(pinfo->cinfo, COL_INFO,
		    val_to_str(msg_type, msg_type_str, "Unknown message type (0x%02x)"));
	}
	if (tree) {
		proto_tree_add_uint(lmi_tree, hf_lmi_msg_type, tvb, 1, 1, msg_type);

	/* Display the LMI elements */
		while (tvb_reported_length_remaining(tvb, offset) > 0) {
			ele_id = tvb_get_guint8( tvb, offset);
			len =  tvb_get_guint8( tvb, offset + 1);

			ti = proto_tree_add_text(lmi_tree, tvb, offset, len + 2,
				"Information Element: %s",
				val_to_str(ele_id, element_type_str, "Unknown (%u)"));

			lmi_subtree = proto_item_add_subtree(ti, ett_lmi_ele);

	                proto_tree_add_uint(lmi_subtree, hf_lmi_inf_ele, tvb, offset, 1,
				ele_id);
			++offset;
	                proto_tree_add_uint(lmi_subtree, hf_lmi_inf_len, tvb, offset, 1, len);
			++offset;
			if (( ele_id == 1) || (ele_id == 51))
				dissect_lmi_report_type( tvb, offset, lmi_subtree);
			else if (( ele_id == 3) || (ele_id == 53))
				dissect_lmi_link_int( tvb, offset, lmi_subtree);
			else if (( ele_id == 7) || (ele_id == 57))
				dissect_lmi_pvc_status( tvb, offset, lmi_subtree);
			offset += len;
		}
	}
	else {
		lmi_tree = NULL;
	}
}
开发者ID:flaub,项目名称:HotFuzz,代码行数:55,代码来源:packet-lmi.c


示例11: dissect_pptp

static void
dissect_pptp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
  int			offset = 0;
  guint16		len;
  guint16		cntrl_type;

  col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPTP");
  col_clear(pinfo->cinfo, COL_INFO);

  len	     = tvb_get_ntohs(tvb, offset);
  cntrl_type = tvb_get_ntohs(tvb, offset + 8);

  if (check_col(pinfo->cinfo, COL_INFO))
    col_add_str(pinfo->cinfo, COL_INFO, cntrltype2str(cntrl_type));

  if (tree) {
    guint32		cookie;
    proto_item *	ti;
    proto_tree *	pptp_tree;

    ti = proto_tree_add_item(tree, proto_pptp, tvb, offset, len, FALSE);
    pptp_tree = proto_item_add_subtree(ti, ett_pptp);

    proto_tree_add_text(pptp_tree, tvb, offset, 2, "Length: %u", len);
    offset += 2;

    proto_tree_add_item(pptp_tree, hf_pptp_message_type, tvb,
			       offset, 2, FALSE);
    offset += 2;

    cookie = tvb_get_ntohl(tvb, offset);

    if (cookie == MAGIC_COOKIE)
      proto_tree_add_text(pptp_tree, tvb, offset, 4,
			  "Cookie: %#08x (correct)", cookie);
    else
      proto_tree_add_text(pptp_tree, tvb, offset, 4,
			  "Cookie: %#08x (incorrect)", cookie);
    offset += 4;

    proto_tree_add_text(pptp_tree, tvb, offset, 2,
			"Control type: %s (%u)", cntrltype2str(cntrl_type), cntrl_type);
    offset += 2;

    proto_tree_add_text(pptp_tree, tvb, offset, 2,
			"Reserved: %u", tvb_get_ntohs(tvb, offset));
    offset += 2;

    if (cntrl_type < NUM_CNTRL_TYPES)
      ( *(strfuncs[cntrl_type].func))(tvb, offset, pinfo, pptp_tree);
    else
      call_dissector(data_handle,tvb_new_subset_remaining(tvb, offset), pinfo, pptp_tree);
  }
}
开发者ID:AkhilaAG,项目名称:gluster-wireshark-1.4,代码行数:55,代码来源:packet-pptp.c


示例12: dissect_fhs

void
dissect_fhs(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset)
{
	proto_item *fhs_item, *psmode_item;
	proto_tree *fhs_tree;
    const gchar *description;
	guint8 psmode;

	if(tvb_reported_length_remaining(tvb, offset) != 20) {
		col_add_str(pinfo->cinfo, COL_INFO, "Encrypted or malformed payload data");
		return;
	}

	fhs_item = proto_tree_add_item(tree, hf_btbredr_payload, tvb, offset, -1, ENC_NA);
	fhs_tree = proto_item_add_subtree(fhs_item, ett_btbredr_payload);

	/* Use proto_tree_add_bits_item() to get around 32bit limit on bitmasks */
	proto_tree_add_bits_item(fhs_tree, hf_btbredr_fhs_parity, tvb, offset*8, 34, ENC_LITTLE_ENDIAN);
	/* proto_tree_add_item(fhs_tree, hf_btbredr_fhs_parity, tvb, offset, 5, ENC_LITTLE_ENDIAN); */
	offset += 4;

	proto_tree_add_item(fhs_tree, hf_btbredr_fhs_lap, tvb, offset, 4, ENC_LITTLE_ENDIAN);
	offset += 3;

	proto_tree_add_item(fhs_tree, hf_btbredr_fhs_eir, tvb, offset, 1, ENC_NA);
	/* skipping 1 undefined bit */
	proto_tree_add_item(fhs_tree, hf_btbredr_fhs_sr, tvb, offset, 1, ENC_NA);
	/* skipping 2 reserved bits */
	offset += 1;

	proto_tree_add_item(fhs_tree, hf_btbredr_fhs_uap, tvb, offset, 1, ENC_NA);
	offset += 1;

	proto_tree_add_item(fhs_tree, hf_btbredr_fhs_nap, tvb, offset, 2, ENC_LITTLE_ENDIAN);
	offset += 2;

	proto_tree_add_item(fhs_tree, hf_btbredr_fhs_class, tvb, offset, 3, ENC_LITTLE_ENDIAN);
	offset += 3;

	proto_tree_add_item(fhs_tree, hf_btbredr_fhs_ltaddr, tvb, offset, 1, ENC_NA);
	proto_tree_add_item(fhs_tree, hf_btbredr_fhs_clk, tvb, offset, 4, ENC_LITTLE_ENDIAN);
	offset += 3;

	psmode = tvb_get_guint8(tvb, offset);
	description = try_rval_to_str(psmode, ps_modes);
	psmode_item = proto_tree_add_item(fhs_tree, hf_btbredr_fhs_psmode, tvb, offset, 1, ENC_NA);
	if (description)
        proto_item_append_text(psmode_item, " (%s)", description);
	offset += 1;

	proto_tree_add_item(fhs_tree, hf_btbredr_crc, tvb, offset, 2, ENC_LITTLE_ENDIAN);
	offset += 2;
}
开发者ID:SylvainDR,项目名称:libbtbb,代码行数:53,代码来源:packet-btbredr.c


示例13: Column_set

WSLUA_METHOD Column_set(lua_State *L) {
	/* Sets the text of a Column. */
#define WSLUA_ARG_Column_set_TEXT 2 /* The text to which to set the Column. */
    Column c = checkColumn(L,1);
    const gchar* s = luaL_checkstring(L,WSLUA_ARG_Column_set_TEXT);

    if (!(c->cinfo))
        return 0;

    col_add_str(c->cinfo, c->col, s);

    return 0;
}
开发者ID:mACH1VO,项目名称:wireshark,代码行数:13,代码来源:wslua_pinfo.c


示例14: dissect_bjnp

static int dissect_bjnp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
  proto_tree *bjnp_tree;
  proto_item *ti;
  gint        offset = 0;
  guint32     payload_len;
  guint8      dev_type, cmd_code;
  gchar      *info;

  col_set_str (pinfo->cinfo, COL_PROTOCOL, PSNAME);
  col_clear (pinfo->cinfo, COL_INFO);

  ti = proto_tree_add_item (tree, proto_bjnp, tvb, offset, -1, ENC_NA);
  bjnp_tree = proto_item_add_subtree (ti, ett_bjnp);

  proto_tree_add_item (bjnp_tree, hf_bjnp_id, tvb, offset, 4, ENC_ASCII|ENC_NA);
  offset += 4;

  dev_type = tvb_get_guint8 (tvb, offset);
  proto_tree_add_item (bjnp_tree, hf_dev_type, tvb, offset, 1, ENC_BIG_ENDIAN);
  offset++;

  cmd_code = tvb_get_guint8 (tvb, offset);
  proto_tree_add_item (bjnp_tree, hf_cmd_code, tvb, offset, 1, ENC_BIG_ENDIAN);
  offset++;

  info = g_strdup_printf ("%s: %s",val_to_str (dev_type, dev_type_vals, "Unknown type (%d)"),
                          val_to_str (cmd_code, cmd_code_vals, "Unknown code (%d)"));

  proto_item_append_text (ti, ", %s", info);
  col_add_str (pinfo->cinfo, COL_INFO, info);

  g_free (info);

  proto_tree_add_item (bjnp_tree, hf_seq_no, tvb, offset, 4, ENC_BIG_ENDIAN);
  offset += 4;

  proto_tree_add_item (bjnp_tree, hf_session_id, tvb, offset, 2, ENC_BIG_ENDIAN);
  offset += 2;

  payload_len = tvb_get_ntohl (tvb, offset);
  proto_tree_add_item (bjnp_tree, hf_payload_len, tvb, offset, 4, ENC_BIG_ENDIAN);
  offset += 4;

  if (payload_len > 0) {
    /* TBD: Dissect various commands */
    proto_tree_add_item (bjnp_tree, hf_payload, tvb, offset, payload_len, ENC_NA);
    offset += payload_len;
  }
  return offset;
}
开发者ID:giuliano108,项目名称:wireshark-rtpmon,代码行数:51,代码来源:packet-bjnp.c


示例15: dissect_msnip

/* This function is only called from the IGMP dissector */
int
dissect_msnip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset)
{
	proto_tree *tree;
	proto_item *item;
	guint8 type;

	if (!proto_is_protocol_enabled(find_protocol_by_id(proto_msnip))) {
		/* we are not enabled, skip entire packet to be nice
		   to the igmp layer. (so clicking on IGMP will display the data)
		 */
		return offset+tvb_length_remaining(tvb, offset);
	}

	item = proto_tree_add_item(parent_tree, proto_msnip, tvb, offset, -1, FALSE);
	tree = proto_item_add_subtree(item, ett_msnip);


	col_set_str(pinfo->cinfo, COL_PROTOCOL, "MSNIP");
	col_clear(pinfo->cinfo, COL_INFO);


	type = tvb_get_guint8(tvb, offset);
	if (check_col(pinfo->cinfo, COL_INFO)) {
		col_add_str(pinfo->cinfo, COL_INFO,
			val_to_str(type, msnip_types,
				"Unknown Type:0x%02x"));
	}

	/* type of command */
	proto_tree_add_uint(tree, hf_type, tvb, offset, 1, type);
	offset += 1;

	switch (type) {
	case MSNIP_GM:
		offset = dissect_msnip_gm(tvb, pinfo, tree, offset);
		break;
	case MSNIP_IS:
		offset = dissect_msnip_is(tvb, pinfo, tree, offset);
		break;
	case MSNIP_RMR:
		offset = dissect_msnip_rmr(tvb, pinfo, tree, offset);
		break;
	}

	if (item) {
		proto_item_set_len(item, offset);
	}

	return offset;
}
开发者ID:RazZziel,项目名称:wireshark-dplay,代码行数:52,代码来源:packet-msnip.c


示例16: dissect_cimd

static void
dissect_cimd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
  guint8   OC;                  /* Operation Code */
  guint8   PN;                  /* Packet number */
  guint16  checksum        = 0; /* Checksum */
  guint16  pkt_check       = 0;
  gint     etxp            = 0; /* ETX position */
  gint     offset          = 0;
  gboolean checksumIsValid = TRUE;
  guint8   last1, last2, last3;

  etxp = tvb_find_guint8(tvb, CIMD_PN_OFFSET + CIMD_PN_LENGTH, -1, CIMD_ETX);
  if (etxp == -1) return;

  OC = (guint8)strtoul(tvb_get_string_enc(wmem_packet_scope(), tvb, CIMD_OC_OFFSET, CIMD_OC_LENGTH, ENC_ASCII), NULL, 10);
  PN = (guint8)strtoul(tvb_get_string_enc(wmem_packet_scope(), tvb, CIMD_PN_OFFSET, CIMD_PN_LENGTH, ENC_ASCII), NULL, 10);

  last1 = tvb_get_guint8(tvb, etxp - 1);
  last2 = tvb_get_guint8(tvb, etxp - 2);
  last3 = tvb_get_guint8(tvb, etxp - 3);

  if (last1 == CIMD_DELIM) {
    /* valid packet, CC is missing */
  } else if (last1 != CIMD_DELIM && last2 != CIMD_DELIM && last3 == CIMD_DELIM) {
    /* looks valid, it would be nice to check that last1 and last2 are HEXA */
    /* CC is present */
    checksum = (guint16)strtoul(tvb_get_string_enc(wmem_packet_scope(), tvb, etxp - 2, 2, ENC_ASCII), NULL, 16);
    for (; offset < (etxp - 2); offset++)
    {
      pkt_check += tvb_get_guint8(tvb, offset);
      pkt_check &= 0xFF;
    }
    checksumIsValid = (checksum == pkt_check);
  } else {
    checksumIsValid = FALSE;
  }

  /* Make entries in Protocol column on summary display */
  col_set_str(pinfo->cinfo, COL_PROTOCOL, "CIMD");

  if (checksumIsValid)
    col_add_str(pinfo->cinfo, COL_INFO, val_to_str(OC, vals_hdr_OC, "Unknown (%d)"));
  else
    col_add_fstr(pinfo->cinfo, COL_INFO, "%s - %s", val_to_str(OC, vals_hdr_OC, "Unknown (%d)"), "invalid checksum");

  dissect_cimd_operation(tvb, tree, etxp, checksum, last1, OC, PN);
}
开发者ID:jiangxilong,项目名称:wireshark-1,代码行数:48,代码来源:packet-cimd.c


示例17: dissect_asf

static int
dissect_asf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
	proto_tree *asf_tree = NULL;
	proto_item *ti;
	guint8      type;
	guint8      len;
	tvbuff_t   *next_tvb;

	col_set_str(pinfo->cinfo, COL_PROTOCOL, "ASF");

	col_clear(pinfo->cinfo, COL_INFO);

	type = tvb_get_guint8(tvb, 4);
	len = tvb_get_guint8(tvb, 7);

	col_add_str(pinfo->cinfo, COL_INFO,
		val_to_str(type, asf_type_vals, "Unknown (0x%02x)"));

	if (tree) {
		ti = proto_tree_add_item(tree, proto_asf, tvb, 0, 8,ENC_NA);
		asf_tree = proto_item_add_subtree(ti, ett_asf);
		proto_tree_add_item(asf_tree, hf_asf_iana, tvb, 0, 4,ENC_BIG_ENDIAN);
		proto_tree_add_item(asf_tree, hf_asf_type, tvb, 4, 1,ENC_BIG_ENDIAN);
		proto_tree_add_item(asf_tree, hf_asf_tag, tvb, 5, 1,ENC_BIG_ENDIAN);
		proto_tree_add_item(asf_tree, hf_asf_len, tvb, 7, 1,ENC_BIG_ENDIAN);
	}

	if (len) {
		switch(type) {
		case ASF_TYPE_OPEN_SESS_RQST:
			dissect_asf_open_session_request(tvb, asf_tree, 8, len);
			break;
		case ASF_TYPE_OPEN_SESS_RESP:
			dissect_asf_open_session_response(tvb, asf_tree, 8, len);
			break;

		/* TODO: Add the rest as captures become available to test. */

		default:
			next_tvb = tvb_new_subset(tvb, 8, len, len);
			call_dissector(data_handle, next_tvb, pinfo, tree);
			break;
		}
	}
	return 8 + len;
}
开发者ID:giuliano108,项目名称:wireshark-rtpmon,代码行数:47,代码来源:packet-asf.c


示例18: dissect_mrdisc

/* This function is only called from the IGMP dissector */
int
dissect_mrdisc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset)
{
	proto_tree *tree;
	proto_item *item;
	guint8 type;

	if (!proto_is_protocol_enabled(find_protocol_by_id(proto_mrdisc))) {
		/* we are not enabled, skip entire packet to be nice
		   to the igmp layer. (so clicking on IGMP will display the data)
		 */
		return offset+tvb_length_remaining(tvb, offset);
	}

	item = proto_tree_add_item(parent_tree, proto_mrdisc, tvb, offset, 0, ENC_NA);
	tree = proto_item_add_subtree(item, ett_mrdisc);


	col_set_str(pinfo->cinfo, COL_PROTOCOL, "MRDISC");
	col_clear(pinfo->cinfo, COL_INFO);


	type = tvb_get_guint8(tvb, offset);
	if (check_col(pinfo->cinfo, COL_INFO)) {
		col_add_str(pinfo->cinfo, COL_INFO,
			val_to_str(type, mrdisc_types,
				"Unknown Type:0x%02x"));
	}

	/* type of command */
	proto_tree_add_uint(tree, hf_type, tvb, offset, 1, type);
	offset += 1;

	switch (type) {
	case MRDISC_MRA:
		offset = dissect_mrdisc_mra(tvb, pinfo, tree, offset);
		break;
	case MRDISC_MRS:
	case MRDISC_MRT:
		/* MRS and MRT packets looks the same */
		offset = dissect_mrdisc_mrst(tvb, pinfo, tree, offset);
		break;
	}
	return offset;
}
开发者ID:SayCV,项目名称:wireshark,代码行数:46,代码来源:packet-mrdisc.c


示例19: dissect_fc_sbccs_sb3_iu_hdr

/* Decode both the SB-3 and basic IU header */
static void
dissect_fc_sbccs_sb3_iu_hdr (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
                             guint offset)
{
    proto_item *subti;
    proto_tree *sb3hdr_tree;
    proto_tree *iuhdr_tree;
    guint8      iui, dhflags;
    guint       type;

    /* Decode the basic SB3 and IU header and determine type of frame */
    type = get_fc_sbccs_iu_type (tvb, offset);

    if (check_col (pinfo->cinfo, COL_INFO)) {
        col_add_str (pinfo->cinfo, COL_INFO, val_to_str (type, fc_sbccs_iu_val,
                                                         "0x%x"));
    }

    if (tree) {
        /* Dissect SB3 header first */
        subti = proto_tree_add_text (tree, tvb, offset, FC_SBCCS_SB3_HDR_SIZE,
                                     "SB-3 Header");
        sb3hdr_tree = proto_item_add_subtree (subti, ett_fc_sbccs);

        proto_tree_add_item (sb3hdr_tree, hf_sbccs_chid, tvb, offset+1, 1, ENC_BIG_ENDIAN);
        proto_tree_add_item (sb3hdr_tree, hf_sbccs_cuid, tvb, offset+3, 1, ENC_BIG_ENDIAN);
        proto_tree_add_item (sb3hdr_tree, hf_sbccs_devaddr, tvb, offset+4, 2, ENC_BIG_ENDIAN);

        /* Dissect IU Header */
        subti = proto_tree_add_text (tree, tvb, offset + FC_SBCCS_SB3_HDR_SIZE,
                                     FC_SBCCS_IU_HDR_SIZE, "IU Header");
        iuhdr_tree = proto_item_add_subtree (subti, ett_fc_sbccs);
        offset += FC_SBCCS_SB3_HDR_SIZE;

        iui = tvb_get_guint8 (tvb, offset);
        dissect_iui_flags(iuhdr_tree, tvb, offset, iui);

        dhflags = tvb_get_guint8 (tvb, offset+1);
        dissect_dh_flags(iuhdr_tree, tvb, offset+1, dhflags);

        proto_tree_add_item (iuhdr_tree, hf_sbccs_ccw, tvb, offset+2, 2, ENC_BIG_ENDIAN);
        proto_tree_add_item (iuhdr_tree, hf_sbccs_token, tvb, offset+5, 3, ENC_BIG_ENDIAN);
    }
}
开发者ID:hubolo,项目名称:wireshark-1.8.0,代码行数:45,代码来源:packet-fcsb3.c


示例20: dissect_trmac

static void
dissect_trmac(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
	proto_tree	*mac_tree = NULL;
	proto_item	*ti;
	int		mv_length, sv_offset, sv_additional;
	guint8		mv_val;

	col_set_str(pinfo->cinfo, COL_PROTOCOL, "TR MAC");
	col_clear(pinfo->cinfo, COL_INFO);

	mv_val = tvb_get_guint8(tvb, 3);

	/* Interpret the major vector */
	if (check_col(pinfo->cinfo, COL_INFO))
		col_add_str(pinfo->cinfo, COL_INFO,
		    val_to_str(mv_val, major_vector_vs, "Unknown Major Vector: %u"));

	if (tree) {
		mv_length = tvb_get_ntohs(tvb, 0);
		ti = proto_tree_add_item(tree, proto_trmac, tvb, 0, mv_length, FALSE);
		mac_tree = proto_item_add_subtree(ti, ett_tr_mac);

		proto_tree_add_uint(mac_tree, hf_trmac_mv, tvb, 3, 1, mv_val);
		proto_tree_add_uint_format(mac_tree, hf_trmac_length, tvb, 0, 2, mv_length,
				"Total Length: %d bytes", mv_length);
		proto_tree_add_uint(mac_tree, hf_trmac_srcclass, tvb, 2, 1, tvb_get_guint8(tvb, 2) & 0x0f);
		proto_tree_add_uint(mac_tree, hf_trmac_dstclass, tvb, 2, 1, tvb_get_guint8(tvb, 2) >> 4 );

		/* interpret the subvectors */
		sv_offset = 4;
		while (sv_offset < mv_length) {
			sv_additional = sv_text(tvb, sv_offset, mac_tree);

			/* if this is a bad packet, we could get a 0-length added here,
			 * looping forever */
			if (sv_additional > 0)
				sv_offset += sv_additional;
			else
				break;
		}
	}
}
开发者ID:flaub,项目名称:HotFuzz,代码行数:43,代码来源:packet-trmac.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ col_append_fstr函数代码示例发布时间:2022-05-30
下一篇:
C++ col_add_fstr函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap