Esempio n. 1
0
static void att_find_info_resp_dump(int level, struct frame *frm)
{
	uint8_t fmt = p_get_u8(frm);

	p_indent(level, frm);

	if (fmt == 0x01) {
		printf("format: uuid-16\n");

		while (frm->len > 0) {
			uint16_t handle = btohs(htons(p_get_u16(frm)));
			uint16_t uuid = btohs(htons(p_get_u16(frm)));
			p_indent(level + 1, frm);
			printf("handle 0x%4.4x, uuid 0x%4.4x (%s)\n", handle, uuid,
					uuid2str(uuid));
		}
	} else {
		printf("format: uuid-128\n");

		while (frm->len > 0) {
			uint16_t handle = btohs(htons(p_get_u16(frm)));

			p_indent(level + 1, frm);
			printf("handle 0x%4.4x, uuid ", handle);
			print_uuid128(frm);
			printf("\n");
		}
	}
}
Esempio n. 2
0
static void att_read_blob_req_dump(int level, struct frame *frm)
{
	uint16_t handle = btohs(htons(p_get_u16(frm)));
	uint16_t offset = btohs(htons(p_get_u16(frm)));

	p_indent(level, frm);
	printf("handle 0x%4.4x offset 0x%4.4x\n", handle, offset);
}
Esempio n. 3
0
static void att_find_info_req_dump(int level, struct frame *frm)
{
	uint16_t start = btohs(htons(p_get_u16(frm)));
	uint16_t end = btohs(htons(p_get_u16(frm)));

	p_indent(level, frm);
	printf("start 0x%4.4x, end 0x%4.4x\n", start, end);
}
Esempio n. 4
0
static void att_find_by_type_resp_dump(int level, struct frame *frm)
{
	while (frm->len > 0) {
		uint16_t uuid = btohs(htons(p_get_u16(frm)));
		uint16_t end = btohs(htons(p_get_u16(frm)));

		p_indent(level, frm);
		printf("Found attr 0x%4.4x, group end handle 0x%4.4x\n",
								uuid, end);
	}
}
Esempio n. 5
0
static void att_prep_write_dump(int level, struct frame *frm)
{
	uint16_t handle = btohs(htons(p_get_u16(frm)));
	uint16_t val_offset = btohs(htons(p_get_u16(frm)));

	p_indent(level, frm);
	printf("attr handle 0x%4.4x, value offset 0x%4.4x\n", handle,
								val_offset);

	p_indent(level, frm);
	printf("part attr value ");
	while (frm->len > 0)
		printf(" 0x%2.2x", p_get_u8(frm));
	printf("\n");
}
Esempio n. 6
0
static void att_find_by_type_req_dump(int level, struct frame *frm)
{
	uint16_t start = btohs(htons(p_get_u16(frm)));
	uint16_t end = btohs(htons(p_get_u16(frm)));
	uint16_t uuid = btohs(htons(p_get_u16(frm)));

	p_indent(level, frm);
	printf("start 0x%4.4x, end 0x%4.4x, uuid 0x%4.4x\n", start, end, uuid);

	p_indent(level, frm);
	printf("value");
	while (frm->len > 0)
		printf(" 0x%2.2x", p_get_u8(frm));
	printf("\n");
}
Esempio n. 7
0
static void att_mtu_resp_dump(int level, struct frame *frm)
{
	uint16_t server_rx_mtu = btohs(htons(p_get_u16(frm)));

	p_indent(level, frm);
	printf("server rx mtu %d\n", server_rx_mtu);
}
Esempio n. 8
0
static void att_mtu_req_dump(int level, struct frame *frm)
{
	uint16_t client_rx_mtu = btohs(htons(p_get_u16(frm)));

	p_indent(level, frm);
	printf("client rx mtu %d\n", client_rx_mtu);
}
Esempio n. 9
0
static void att_read_multi_req_dump(int level, struct frame *frm)
{
	p_indent(level, frm);
	printf("Handles\n");

	while (frm->len > 0) {
		p_indent(level, frm);
		printf("handle 0x%4.4x\n", btohs(htons(p_get_u16(frm))));
	}
}
Esempio n. 10
0
static void att_write_req_dump(int level, struct frame *frm)
{
	uint16_t handle = btohs(htons(p_get_u16(frm)));

	p_indent(level, frm);
	printf("handle 0x%4.4x value ", handle);

	while (frm->len > 0)
		printf(" 0x%2.2x", p_get_u8(frm));
	printf("\n");
}
Esempio n. 11
0
static void att_error_dump(int level, struct frame *frm)
{
	uint8_t op = p_get_u8(frm);
	uint16_t handle = btohs(htons(p_get_u16(frm)));
	uint8_t err = p_get_u8(frm);

	p_indent(level, frm);
	printf("Error: %s (%d)\n", atterror2str(err), err);

	p_indent(level, frm);
	printf("%s (0x%.2x) on handle 0x%4.4x\n", attop2str(op), op, handle);
}
Esempio n. 12
0
void cmtp_dump(int level, struct frame *frm)
{
	struct frame *msg;
	uint8_t hdr, bid;
	uint16_t len;

	while (frm->len > 0) {

		hdr = p_get_u8(frm);
		bid = (hdr & 0x3c) >> 2;

		switch ((hdr & 0xc0) >> 6) {
		case 0x01:
			len = p_get_u8(frm);
			break;
		case 0x02:
			len = htons(p_get_u16(frm));
			break;
		default:
			len = 0;
			break;
		}

		p_indent(level, frm);

		printf("CMTP: %s: id %d len %d\n", bst2str(hdr & 0x03), bid, len);

		switch (hdr & 0x03) {
		case 0x00:
			add_segment(bid, frm, len);
			msg = get_segment(bid, frm);
			if (!msg)
				break;

			if (!p_filter(FILT_CAPI))
				capi_dump(level + 1, msg);
			else
				raw_dump(level, msg);

			free_segment(bid, frm);
			break;
		case 0x01:
			add_segment(bid, frm, len);
			break;
		default:
			free_segment(bid, frm);
			break;
		}

		frm->ptr += len;
		frm->len -= len;
	}
}
Esempio n. 13
0
static void att_read_by_type_req_dump(int level, struct frame *frm)
{
	uint16_t start = btohs(htons(p_get_u16(frm)));
	uint16_t end = btohs(htons(p_get_u16(frm)));

	p_indent(level, frm);
	printf("start 0x%4.4x, end 0x%4.4x\n", start, end);

	p_indent(level, frm);
	if (frm->len == 2) {
		printf("type-uuid 0x%4.4x\n", btohs(htons(p_get_u16(frm))));
	} else if (frm->len == 16) {
		printf("type-uuid ");
		print_uuid128(frm);
		printf("\n");
	} else {
		printf("malformed uuid (expected 2 or 16 octets)\n");
		p_indent(level, frm);
		raw_dump(level, frm);
	}
}
Esempio n. 14
0
static void att_read_by_group_resp_dump(int level, struct frame *frm)
{
	uint8_t length = p_get_u8(frm);

	while (frm->len > 0) {
		uint16_t attr_handle = btohs(htons(p_get_u16(frm)));
		uint16_t end_grp_handle = btohs(htons(p_get_u16(frm)));
		uint8_t remaining = length - 4;

		p_indent(level, frm);
		printf("attr handle 0x%4.4x, end group handle 0x%4.4x\n",
						attr_handle, end_grp_handle);

		p_indent(level, frm);
		printf("value");
		while (remaining > 0) {
			printf(" 0x%2.2x", p_get_u8(frm));
			remaining--;
		}
		printf("\n");
	}
}
Esempio n. 15
0
static void smp_cmd_master_ident_dump(int level, struct frame *frm)
{
	uint16_t ediv = btohs(htons(p_get_u16(frm)));
	int i;

	p_indent(level, frm);
	printf("EDIV 0x%4.4x ", ediv);

	printf("Rand 0x");
	for (i = 0; i < 8; i++)
		printf("%2.2x", p_get_u8(frm));
	printf("\n");
}
Esempio n. 16
0
static void att_signed_write_dump(int level, struct frame *frm)
{
	uint16_t handle = btohs(htons(p_get_u16(frm)));
	int value_len = frm->len - 12; /* handle:2 already accounted, sig: 12 */

	p_indent(level, frm);
	printf("handle 0x%4.4x value ", handle);

	while (value_len--)
		printf(" 0x%2.2x", p_get_u8(frm));
	printf("\n");

	p_indent(level, frm);
	printf("auth signature ");
	while (frm->len > 0)
		printf(" 0x%2.2x", p_get_u8(frm));
	printf("\n");
}
Esempio n. 17
0
File: bpa.c Progetto: ghent360/bluez
void bpa_dump(int level, struct frame *frm)
{
	uint8_t id, status, channel;
	uint16_t num, len;
	uint32_t time;

	id = p_get_u8(frm);
	num = p_get_u16(frm);
	len = BPA_U16(frm);

	status  = p_get_u8(frm);
	time    = p_get_u32(frm);
	channel = p_get_u8(frm);

	p_indent(level, frm);
	printf("BPA: id %d num %d len %u status 0x%02x time %d channel %d\n",
		id, num, len, status, time, channel);

	raw_dump(level, frm);
}
Esempio n. 18
0
static void att_read_by_type_resp_dump(int level, struct frame *frm)
{
	uint8_t length = p_get_u8(frm);

	p_indent(level, frm);
	printf("length: %d\n", length);

	while (frm->len > 0) {
		uint16_t handle = btohs(htons(p_get_u16(frm)));
		int val_len = length - 2;
		int i;

		p_indent(level + 1, frm);
		printf("handle 0x%4.4x, value ", handle);
		for (i = 0; i < val_len; i++) {
			printf("0x%.2x ", p_get_u8(frm));
		}
		printf("\n");
	}
}
Esempio n. 19
0
static void bnep_control(int level, struct frame *frm, int header_length)
{
	uint8_t uuid_size;
	int i, length;
	char *s;
	uint32_t uuid = 0;
	uint8_t type = p_get_u8(frm);

	p_indent(++level, frm);
	switch (type) {
	case BNEP_CONTROL_COMMAND_NOT_UNDERSTOOD:
		printf("Not Understood(0x%02x) type 0x%02x\n", type, p_get_u8(frm));
		break;

	case BNEP_SETUP_CONNECTION_REQUEST_MSG:
		uuid_size = p_get_u8(frm);
		printf("Setup Req(0x%02x) size 0x%02x ", type, uuid_size);
		switch (uuid_size) {
		case 2:
			uuid = p_get_u16(frm);
			printf("dst 0x%x", uuid);
			if ((s = get_uuid_name(uuid)) != 0)
				printf("(%s)", s);
			uuid = p_get_u16(frm);
			printf(" src 0x%x", uuid);
			if ((s = get_uuid_name(uuid)) != 0)
				printf("(%s)", s);
			printf("\n");
			break;
		case 4:
			uuid = p_get_u32(frm);
			printf("dst 0x%x", uuid);
			if ((s = get_uuid_name(uuid)) != 0)
				printf("(%s)", s);
			uuid = p_get_u32(frm);
			printf(" src 0x%x", uuid);
			if ((s = get_uuid_name(uuid)) != 0)
				printf("(%s)", s);
			printf("\n");
			break;
		case 16:
			uuid = p_get_u32(frm);
			printf("dst 0x%x", uuid);
			if ((s = get_uuid_name(uuid)) != 0)
				printf("(%s)", s);
			frm->ptr += 12;
			frm->len -= 12;
			uuid = p_get_u32(frm);
			printf(" src 0x%x", uuid);
			if ((s = get_uuid_name(uuid)) != 0)
				printf("(%s)", s);
			printf("\n");
			frm->ptr += 12;
			frm->len -= 12;
			break;
		default:
			frm->ptr += (uuid_size * 2);
			frm->len -= (uuid_size * 2);
			break;
		}
		break;

	case BNEP_SETUP_CONNECTION_RESPONSE_MSG:
		printf("Setup Rsp(0x%02x) res 0x%04x\n",
						type, p_get_u16(frm));
		break;

	case BNEP_FILTER_NET_TYPE_SET_MSG:
		length = p_get_u16(frm);
		printf("Filter NetType Set(0x%02x) len 0x%04x\n",
							type, length);
		for (i = 0; i < length / 4; i++) {
			p_indent(level + 1, frm);
			printf("0x%04x - ", p_get_u16(frm));
			printf("0x%04x\n", p_get_u16(frm));
		}
		break;

	case BNEP_FILTER_NET_TYPE_RESPONSE_MSG:
		printf("Filter NetType Rsp(0x%02x) res 0x%04x\n",
							type, p_get_u16(frm));
		break;

	case BNEP_FILTER_MULT_ADDR_SET_MSG:
		length = p_get_u16(frm);
		printf("Filter MultAddr Set(0x%02x) len 0x%04x\n",
							type, length);
		for (i = 0; i < length / 12; i++) {
			p_indent(level + 1, frm);
			printf("%s - ", get_macaddr(frm));
			printf("%s\n", get_macaddr(frm));
		}
		break;

	case BNEP_FILTER_MULT_ADDR_RESPONSE_MSG:
		printf("Filter MultAddr Rsp(0x%02x) res 0x%04x\n",
							type, p_get_u16(frm));
		break;

	default:
		printf("Unknown control type(0x%02x)\n", type);
		raw_ndump(level + 1, frm, header_length - 1);
		frm->ptr += header_length - 1;
		frm->len -= header_length - 1;
		return;
	}
}
Esempio n. 20
0
void bnep_dump(int level, struct frame *frm)
{
	uint8_t type = p_get_u8(frm);
	uint16_t proto = 0x0000;
	int extension = type & 0x80;

	p_indent(level, frm);

	switch (type & 0x7f) {
	case BNEP_CONTROL:
		printf("BNEP: Control(0x%02x|%s)\n",
					type & 0x7f, extension ? "1" : "0");
		bnep_control(level, frm, -1);
		break;

	case BNEP_COMPRESSED_ETHERNET:
		printf("BNEP: Compressed(0x%02x|%s)\n",
					type & 0x7f, extension ? "1" : "0");
		p_indent(++level, frm);
		proto = p_get_u16(frm);
		printf("[proto 0x%04x]\n", proto);
		break;

	case BNEP_GENERAL_ETHERNET:
		printf("BNEP: General ethernet(0x%02x|%s)\n",
					type & 0x7f, extension ? "1" : "0");
		p_indent(++level, frm);
		printf("dst %s ", get_macaddr(frm));
		printf("src %s ", get_macaddr(frm));
		proto = p_get_u16(frm);
		printf("[proto 0x%04x]\n", proto);
		break;

	case BNEP_COMPRESSED_ETHERNET_DEST_ONLY:
		printf("BNEP: Compressed DestOnly(0x%02x|%s)\n",
					type & 0x7f, extension ? "1" : "0");
		p_indent(++level, frm);
		printf("dst %s ", get_macaddr(frm));
		proto = p_get_u16(frm);
		printf("[proto 0x%04x]\n", proto);
		break;

	case BNEP_COMPRESSED_ETHERNET_SOURCE_ONLY:
		printf("BNEP: Compressed SrcOnly(0x%02x|%s)\n",
					type & 0x7f, extension ? "1" : "0");
		p_indent(++level, frm);
		printf("src %s ", get_macaddr(frm));
		proto = p_get_u16(frm);
		printf("[proto 0x%04x]\n", proto);
		break;

	default:
		printf("(Unknown packet type)\n");
		return;
	}

	/* Extension info */
	if (extension)
		bnep_eval_extension(++level, frm);

	/* Control packet => No payload info */
	if ((type & 0x7f) == BNEP_CONTROL)
		return;

	/* 802.1p header */
	if (proto == 0x8100) {
		p_indent(level, frm);
		printf("802.1p Header: 0x%04x ", p_get_u16(frm));
		proto = p_get_u16(frm);
		printf("[proto 0x%04x]\n", proto);
	}

	if (!(parser.flags & DUMP_VERBOSE)) {
		raw_dump(level, frm);
		return;
	}

	switch (proto) {
	case ETHERTYPE_ARP:
		p_indent(++level, frm);
		printf("ARP: ");
		arp_dump(level, frm);
		break;

	case ETHERTYPE_REVARP:
		p_indent(++level, frm);
		printf("RARP: ");
		arp_dump(level, frm);
		break;

	case ETHERTYPE_IP:
		p_indent(++level, frm);
		printf("IP: ");
		ip_dump(level, frm);
		break;

	case ETHERTYPE_IPV6:
		p_indent(++level, frm);
		printf("IPV6: ");
		ip_dump(level, frm);
		break;

	default:
		raw_dump(level, frm);
		break;
	}
}