Update COAP dissector to the latest drafts:
- corresponded to coap-07, block-04, observe-02 and link-format-06.
- improved the option handler.

From me:
Update the comment to indicate that the port is now IANA-assigned.

There's no need to memset a string to initialize it; just set the first byte
to 0.

svn path=/trunk/; revision=38459
This commit is contained in:
Jeff Morriss 2011-08-10 20:54:44 +00:00
parent 9986755780
commit ce701a90c6
1 changed files with 258 additions and 158 deletions

View File

@ -1,8 +1,10 @@
#include <stdio.h>
/* packet-coap.c
* Routines for COAP packet disassembly
* draft-ietf-core-coap-03.txt
* draft-ietf-core-block-00.txt
* draft-ietf-core-observe-00.txt
* draft-ietf-core-coap-07.txt
* draft-ietf-core-block-04.txt
* draft-ietf-core-observe-02.txt
* draft-ietf-core-link-format-06.txt
* Shoichi Sakane <sakane@tanu.org>
*
* $Id$
@ -48,29 +50,38 @@ static int hf_coap_tid = -1;
static int hf_coap_opt_delta = -1;
static int hf_coap_opt_length = -1;
static int hf_coap_opt_ctype = -1;
static int hf_coap_opt_etag = -1;
static int hf_coap_opt_max_age = -1;
static int hf_coap_opt_uri_authority = -1;
static int hf_coap_opt_location = -1;
static int hf_coap_opt_proxy_uri = -1;
static int hf_coap_opt_etag = -1;
static int hf_coap_opt_uri_host = -1;
static int hf_coap_opt_location_path = -1;
static int hf_coap_opt_uri_port = -1;
static int hf_coap_opt_location_query = -1;
static int hf_coap_opt_uri_path = -1;
static int hf_coap_opt_subscr_lifetime = -1;
static int hf_coap_opt_token = -1;
static int hf_coap_opt_observe = -1;
static int hf_coap_opt_token = -1;
static int hf_coap_opt_accept = -1;
static int hf_coap_opt_if_match = -1;
static int hf_coap_opt_block_number = -1;
static int hf_coap_opt_block_mflag = -1;
static int hf_coap_opt_block_size = -1;
static int hf_coap_opt_uri_query = -1;
static int hf_coap_opt_if_none_match = -1;
static gint ett_coap = -1;
static gint ett_coap_option = -1;
static gint ett_coap_payload = -1;
/* TODO: COAP port number will be assigned by IANA after the draft become a RFC */
#define DEFAULT_COAP_PORT 61616
/* COAP's IANA-assigned port number */
#define DEFAULT_COAP_PORT 5683
static const gchar *coap_content_type = NULL;
static gint coap_content_type_value = ~0;
static guint global_coap_port_number = DEFAULT_COAP_PORT;
static gint block_number = ~0;
static guint block_mflag = 0;
static gchar uri_string[256]; /* 256 is probably enough to display in the screen */
/*
* Transaction Type
@ -88,6 +99,8 @@ static const value_string vals_ttype[] = {
* Response Code
*/
static const value_string vals_code[] = {
{ 0, "Empty Message" },
/* method code */
{ 1, "GET" },
{ 2, "POST" },
@ -95,21 +108,28 @@ static const value_string vals_code[] = {
{ 4, "DELETE" },
/* response code */
{ 40, "100 Continue" },
{ 80, "200 OK"},
{ 81, "201 Created"},
{ 124, "304 Not Modified"},
{ 160, "400 Bad Request"},
{ 164, "404 Not Found"},
{ 165, "405 Method Not Allowed"},
{ 175, "415 Unsupported Media Type"},
{ 200, "500 Internal Server Error"},
{ 202, "502 Bad Gateway"},
{ 203, "503 Service Unavailable"},
{ 204, "504 Gateway Timeout"},
{ 240, "Token Option required by server"},
{ 241, "Uri-Authority Option required by server"},
{ 242, "Critical Option not supported"},
{ 65, "2.01 Created" },
{ 66, "2.02 Deleted" },
{ 67, "2.03 Valid" },
{ 68, "2.04 Changed" },
{ 69, "2.05 Content" },
{ 128, "4.00 Bad Request" },
{ 129, "4.01 Unauthorized" },
{ 130, "4.02 Bad Option" },
{ 131, "4.03 Forbidden" },
{ 132, "4.04 Not Found" },
{ 133, "4.05 Method Not Allowed" },
{ 136, "4.08 Request Entity Incomplete" }, /* core-block-03 */
{ 140, "4.12 Precondition Failed" },
{ 141, "4.13 Request Entity Too Large" },
{ 143, "4.15 Unsupported Media Type" },
{ 160, "5.00 Internal Server Error" },
{ 161, "5.01 Not Implemented" },
{ 162, "5.02 Bad Gateway" },
{ 163, "5.03 Service Unavailable" },
{ 164, "5.04 Gateway Timeout" },
{ 165, "5.05 Proxying Not Supported" },
{ 0, NULL },
};
@ -120,110 +140,135 @@ static const value_string vals_code[] = {
*/
#define COAP_OPT_CONTENT_TYPE 1
#define COAP_OPT_MAX_AGE 2
#define COAP_OPT_PROXY_URI 3
#define COAP_OPT_ETAG 4
#define COAP_OPT_URI_AUTHORITY 5
#define COAP_OPT_LOCATION 6
#define COAP_OPT_URI_HOST 5
#define COAP_OPT_LOCATION_PATH 6
#define COAP_OPT_URI_PORT 7
#define COAP_OPT_LOCATION_QUERY 8
#define COAP_OPT_URI_PATH 9
#define COAP_OPT_SUBSCR_LIFETIME 10
#define COAP_OPT_OBSERVE 10 /* core-observe */
#define COAP_OPT_TOKEN 11
#define COAP_OPT_BLOCK 13
#define COAP_OPT_ACCEPT 12
#define COAP_OPT_IF_MATCH 13
#define COAP_OPT_URI_QUERY 15
#define COAP_OPT_BLOCK2 17 /* core-block-03 */
#define COAP_OPT_BLOCK1 19 /* core-block-03 */
#define COAP_OPT_IF_NONE_MATCH 21
static const value_string vals_opt_type[] = {
{ COAP_OPT_CONTENT_TYPE, "Content-Type" },
{ COAP_OPT_MAX_AGE, "Max-age" },
{ COAP_OPT_PROXY_URI, "Proxy-Uri" },
{ COAP_OPT_ETAG, "Etag" },
{ COAP_OPT_URI_AUTHORITY, "Uri-Authority" },
{ COAP_OPT_LOCATION, "Location" },
{ COAP_OPT_URI_HOST, "Uri-Host" },
{ COAP_OPT_LOCATION_PATH, "Location-Path" },
{ COAP_OPT_URI_PORT, "Uri-Port" },
{ COAP_OPT_LOCATION_QUERY, "Location-Query" },
{ COAP_OPT_URI_PATH, "Uri-Path" },
{ COAP_OPT_SUBSCR_LIFETIME, "Subscription Lifetime" },
{ COAP_OPT_OBSERVE, "Observe" },
{ COAP_OPT_TOKEN, "Token" },
{ COAP_OPT_BLOCK, "Block" },
{ COAP_OPT_ACCEPT, "Accept" },
{ COAP_OPT_IF_MATCH, "If-Match" },
{ COAP_OPT_URI_QUERY, "Uri-Query" },
{ COAP_OPT_BLOCK2, "Block2" },
{ COAP_OPT_BLOCK1, "Block1" },
{ COAP_OPT_IF_NONE_MATCH, "If-None-Match" },
{ 0, NULL },
};
static const value_string vals_ctype[] = {
{ 0, "text/plain" },
{ 1, "text/xml" },
{ 2, "text/csv" },
{ 3, "text/html" },
{ 21, "image/gif" },
{ 22, "image/jpeg" },
{ 23, "image/png" },
{ 24, "image/tiff" },
{ 25, "audio/raw" },
{ 26, "video/raw" },
{ 40, "application/link-format" },
{ 41, "application/xml" },
{ 42, "application/octet-stream" },
{ 43, "application/rdf+xml" },
{ 44, "application/soap+xml" },
{ 45, "application/atom+xml" },
{ 46, "application/xmpp+xml" },
{ 47, "application/exi" },
{ 48, "application/x-bxml" },
{ 49, "application/fastinfoset" },
{ 50, "application/soap+fastinfoset" },
{ 51, "application/json" },
{ 50, "application/json" },
{ 0, NULL },
};
void proto_reg_handoff_coap(void);
static void
dissect_coap_opt(tvbuff_t *tvb, proto_tree *subtree, gint offset, gint opt_length, int hfindex)
static int
coap_is_str_ipv6addr(guint8 *str)
{
int len = strlen(str);
int colon = 0;
while (len--) {
if (*str++ == ':')
colon++;
}
return colon > 1 ? 1 : 0;
}
static void
dissect_coap_opt_string(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *subtree, gint offset, gint opt_length, int hfindex, int opt_code)
{
guint8 *hoststr = NULL;
proto_tree_add_item(subtree, hfindex, tvb, offset, opt_length, FALSE);
}
static void
dissect_coap_opt_ctype(tvbuff_t *tvb, packet_info *pinfo, proto_tree *subtree, gint offset, gint opt_length)
{
guint32 opt_ctype = 0;
proto_item *pi;
opt_ctype = tvb_get_guint8(tvb, offset);
coap_content_type = val_to_str(opt_ctype, vals_ctype, "Unknown %d");
pi = proto_tree_add_item(subtree, hf_coap_opt_ctype, tvb, offset, 1, FALSE);
if (opt_length != 1)
expert_add_info_format(pinfo, pi, PI_MALFORMED, PI_WARN,
"Parameter has invalid length; should be 1");
}
/* the value of opt_length should be checked out of this function */
static void
dissect_coap_opt_time(tvbuff_t *tvb, proto_tree *subtree, gint offset, gint opt_length, int hfindex)
{
guint32 time = 0;
switch (opt_length) {
case 0:
time = 0;
/* forming a uri-string */
switch (opt_code) {
case COAP_OPT_URI_HOST:
g_strlcat(uri_string, "coap://", sizeof(uri_string));
hoststr = tvb_get_ephemeral_string(tvb, offset, opt_length);
/* if the string looks an IPv6 address, it has to be enclosed by brackets. */
if (coap_is_str_ipv6addr(hoststr)) {
g_strlcat(uri_string, "[", sizeof(uri_string));
g_strlcat(uri_string, hoststr, sizeof(uri_string));
g_strlcat(uri_string, "]", sizeof(uri_string));
} else
g_strlcat(uri_string, hoststr, sizeof(uri_string));
break;
case 1:
time = (guint32)tvb_get_guint8(tvb, offset);
case COAP_OPT_URI_PATH:
g_strlcat(uri_string, "/", sizeof(uri_string));
g_strlcat(uri_string, tvb_get_ephemeral_string(tvb, offset, opt_length), sizeof(uri_string));
break;
case 2:
time = (guint32)tvb_get_ntohs(tvb, offset);
break;
case 3:
time = (guint32)tvb_get_ntoh24(tvb, offset);
break;
case 4:
time = (guint32)tvb_get_ntohl(tvb, offset);
break;
default:
proto_tree_add_text(subtree, tvb, 0, 0, "Invalid length: %d", opt_length);
case COAP_OPT_URI_QUERY:
g_strlcat(uri_string, "/?", sizeof(uri_string));
g_strlcat(uri_string, tvb_get_ephemeral_string(tvb, offset, opt_length), sizeof(uri_string));
break;
}
proto_tree_add_int_format(subtree, hfindex, tvb, offset, opt_length, time, "%d (s)", time);
}
static void
dissect_coap_opt_ctype(tvbuff_t *tvb, packet_info *pinfo, proto_tree *subtree, gint offset, gint opt_length, int hfindex)
{
guint32 opt_ctype = 0;
if (opt_length != 1) {
expert_add_info_format(pinfo, subtree, PI_MALFORMED, PI_WARN, "Invalid Option Length: %d", opt_length);
return;
}
opt_ctype = tvb_get_guint8(tvb, offset);
coap_content_type_value = (gint)opt_ctype;
coap_content_type = val_to_str(opt_ctype, vals_ctype, "Unknown %d");
proto_tree_add_item(subtree, hfindex, tvb, offset, 1, FALSE);
}
static void
dissect_coap_opt_time(tvbuff_t *tvb, packet_info *pinfo, proto_tree *subtree, gint offset, gint opt_length, int hfindex)
{
proto_item *item = NULL;
if (opt_length > 4) {
expert_add_info_format(pinfo, subtree, PI_MALFORMED, PI_WARN, "Invalid Option Length: %d", opt_length);
return;
}
item = proto_tree_add_item(subtree, hfindex, tvb, offset, opt_length, FALSE);
proto_item_append_text(item, " (s)");
return;
}
static void
dissect_coap_opt_block(tvbuff_t *tvb, proto_tree *subtree, gint offset, gint opt_length)
dissect_coap_opt_block(tvbuff_t *tvb, packet_info *pinfo, proto_tree *subtree, gint offset, gint opt_length, int hfindex)
{
guint8 val = 0;
guint encoded_block_size = 0;
@ -241,7 +286,7 @@ dissect_coap_opt_block(tvbuff_t *tvb, proto_tree *subtree, gint offset, gint opt
block_number = (guint)(tvb_get_ntoh24(tvb, offset) >> 4);
break;
default:
proto_tree_add_text(subtree, tvb, 0, 0, "Invalid length: %d", opt_length);
expert_add_info_format(pinfo, subtree, PI_MALFORMED, PI_WARN, "Invalid Option Length: %d", opt_length);
return;
}
@ -250,13 +295,47 @@ dissect_coap_opt_block(tvbuff_t *tvb, proto_tree *subtree, gint offset, gint opt
block_mflag = val & 0x08;
proto_tree_add_int(subtree, hf_coap_opt_block_number, tvb, offset, opt_length, block_number);
proto_tree_add_item(subtree, hf_coap_opt_block_mflag, tvb, offset + opt_length - 1, 1, FALSE);
proto_tree_add_item(subtree, hfindex, tvb, offset + opt_length - 1, 1, FALSE);
block_size = 1 << (encoded_block_size + 4);
item = proto_tree_add_item(subtree, hf_coap_opt_block_size, tvb, offset + opt_length - 1, 1, FALSE);
proto_item_append_text(item, ", Result: %d", block_size);
}
static void
dissect_coap_opt_port(tvbuff_t *tvb, packet_info *pinfo, proto_tree *subtree, gint offset, gint opt_length, int hfindex)
{
proto_item *item = NULL;
char portstr[6];
memset(portstr, '\0', sizeof(portstr));
switch (opt_length) {
case 0:
item = proto_tree_add_int(subtree, hfindex, tvb, offset, opt_length, pinfo->destport);
proto_item_append_text(item, " (default)");
return;
case 1:
g_snprintf(portstr, sizeof(portstr), "%d", (int)tvb_get_guint8(tvb, offset));
break;
case 2:
g_snprintf(portstr, sizeof(portstr), "%d", (int)tvb_get_ntohs(tvb, offset));
break;
default:
expert_add_info_format(pinfo, subtree, PI_MALFORMED, PI_WARN, "Invalid Option Length: %d", opt_length);
return;
}
(void)proto_tree_add_item(subtree, hfindex, tvb, offset, opt_length, FALSE);
/* forming a uri-string */
if (uri_string[0] == '\0')
g_strlcat(uri_string, ep_address_to_str(&pinfo->net_dst), sizeof(uri_string));
g_strlcat(uri_string, ":", sizeof(uri_string));
g_strlcat(uri_string, portstr, sizeof(uri_string));
return;
}
/*
* dissector for each option of COAP.
* return the total length of the option including the header (e.g. delta and length).
@ -289,8 +368,8 @@ dissect_coap_options(tvbuff_t *tvb, packet_info *pinfo, proto_tree *coap_tree, g
}
item = proto_tree_add_text(coap_tree, tvb, offset, opt_hlen + opt_length,
"Option #%u: %s (Type: %u)",
opt_count, val_to_str(*opt_code, vals_opt_type, "Unknown Option"), *opt_code);
"Option #%u: %s (Type: %u)",
opt_count, val_to_str(*opt_code, vals_opt_type, *opt_code % 14 == 0 ? "No-Op" : "Unknown Option"), *opt_code);
subtree = proto_item_add_subtree(item, ett_coap_option);
proto_tree_add_item(subtree, hf_coap_opt_delta, tvb, offset, 1, FALSE);
@ -299,45 +378,61 @@ dissect_coap_options(tvbuff_t *tvb, packet_info *pinfo, proto_tree *coap_tree, g
proto_tree_add_uint_bits_format_value(subtree, hf_coap_opt_length, tvb_lenbuf, 4, opt_hlen == 1 ? 4 : 12, opt_length, "%d", opt_length);
offset += opt_hlen;
/* if opt_code is a multiple of 14, that means the option is a noop option */
if (*opt_code % 14 == 0) {
proto_tree_add_text(subtree, tvb, 0, 0, "No-Op option");
} else {
switch (*opt_code) {
case COAP_OPT_CONTENT_TYPE:
dissect_coap_opt_ctype(tvb, pinfo, subtree, offset, opt_length);
break;
case COAP_OPT_MAX_AGE:
dissect_coap_opt_time(tvb, subtree, offset, opt_length, hf_coap_opt_max_age);
break;
case COAP_OPT_SUBSCR_LIFETIME:
dissect_coap_opt_time(tvb, subtree, offset, opt_length, hf_coap_opt_subscr_lifetime);
break;
case COAP_OPT_ETAG:
dissect_coap_opt(tvb, subtree, offset, opt_length, hf_coap_opt_etag);
break;
case COAP_OPT_URI_AUTHORITY:
dissect_coap_opt(tvb, subtree, offset, opt_length, hf_coap_opt_uri_authority);
break;
case COAP_OPT_LOCATION:
dissect_coap_opt(tvb, subtree, offset, opt_length, hf_coap_opt_location);
break;
case COAP_OPT_URI_PATH:
dissect_coap_opt(tvb, subtree, offset, opt_length, hf_coap_opt_uri_path);
break;
case COAP_OPT_TOKEN:
dissect_coap_opt(tvb, subtree, offset, opt_length, hf_coap_opt_token);
break;
case COAP_OPT_BLOCK:
dissect_coap_opt_block(tvb, subtree, offset, opt_length);
break;
case COAP_OPT_URI_QUERY:
dissect_coap_opt(tvb, subtree, offset, opt_length, hf_coap_opt_uri_query);
break;
default:
proto_tree_add_text(subtree, tvb, 0, 0, "Unkown Option Type");
break;
}
switch (*opt_code) {
case COAP_OPT_CONTENT_TYPE:
dissect_coap_opt_ctype(tvb, pinfo, subtree, offset, opt_length, hf_coap_opt_ctype);
break;
case COAP_OPT_MAX_AGE:
dissect_coap_opt_time(tvb, pinfo, subtree, offset, opt_length, hf_coap_opt_max_age);
break;
case COAP_OPT_PROXY_URI:
dissect_coap_opt_string(tvb, pinfo, subtree, offset, opt_length, hf_coap_opt_proxy_uri, COAP_OPT_PROXY_URI);
break;
case COAP_OPT_ETAG:
dissect_coap_opt_string(tvb, pinfo, subtree, offset, opt_length, hf_coap_opt_etag, COAP_OPT_ETAG);
break;
case COAP_OPT_URI_HOST:
dissect_coap_opt_string(tvb, pinfo, subtree, offset, opt_length, hf_coap_opt_uri_host, COAP_OPT_URI_HOST);
break;
case COAP_OPT_LOCATION_PATH:
dissect_coap_opt_string(tvb, pinfo, subtree, offset, opt_length, hf_coap_opt_location_path, COAP_OPT_LOCATION_PATH);
break;
case COAP_OPT_URI_PORT:
dissect_coap_opt_port(tvb, pinfo, subtree, offset, opt_length, hf_coap_opt_uri_port);
break;
case COAP_OPT_LOCATION_QUERY:
dissect_coap_opt_string(tvb, pinfo, subtree, offset, opt_length, hf_coap_opt_location_query, COAP_OPT_LOCATION_QUERY);
break;
case COAP_OPT_URI_PATH:
dissect_coap_opt_string(tvb, pinfo, subtree, offset, opt_length, hf_coap_opt_uri_path, COAP_OPT_URI_PATH);
break;
case COAP_OPT_OBSERVE:
dissect_coap_opt_time(tvb, pinfo, subtree, offset, opt_length, hf_coap_opt_observe);
break;
case COAP_OPT_TOKEN:
dissect_coap_opt_string(tvb, pinfo, subtree, offset, opt_length, hf_coap_opt_token, COAP_OPT_TOKEN);
break;
case COAP_OPT_ACCEPT:
dissect_coap_opt_ctype(tvb, pinfo, subtree, offset, opt_length, hf_coap_opt_accept);
break;
case COAP_OPT_IF_MATCH:
dissect_coap_opt_string(tvb, pinfo, subtree, offset, opt_length, hf_coap_opt_if_match, COAP_OPT_IF_MATCH);
break;
case COAP_OPT_URI_QUERY:
dissect_coap_opt_string(tvb, pinfo, subtree, offset, opt_length, hf_coap_opt_uri_query, COAP_OPT_URI_QUERY);
break;
case COAP_OPT_BLOCK2:
dissect_coap_opt_block(tvb, pinfo, subtree, offset, opt_length, hf_coap_opt_block_mflag);
break;
case COAP_OPT_BLOCK1:
dissect_coap_opt_block(tvb, pinfo, subtree, offset, opt_length, hf_coap_opt_block_mflag);
break;
case COAP_OPT_IF_NONE_MATCH:
dissect_coap_opt_string(tvb, pinfo, subtree, offset, opt_length, hf_coap_opt_if_none_match, COAP_OPT_IF_NONE_MATCH);
break;
default:
/* In case of unknown opt_code, just ignore it here. A message is displayed beforehand. */
break;
}
return offset + opt_length;
@ -371,6 +466,7 @@ dissect_coap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
*/
coap_length = tvb_reported_length(tvb);
coap_content_type = NULL;
coap_content_type_value = ~0;
coap_root = proto_tree_add_item(parent_tree, proto_coap, tvb, offset, -1, FALSE);
coap_tree = proto_item_add_subtree(coap_root, ett_coap);
@ -397,7 +493,10 @@ dissect_coap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
/* append the header information */
proto_item_append_text(coap_tree, ", TID: %u, Length: %u", tid, coap_length);
/* initialize the external value */
block_number = ~0;
block_mflag = 0;
uri_string[0] = 0;
/* dissect the options */
for (i = 1; i <= opt_count; i++) {
@ -408,6 +507,12 @@ dissect_coap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
return;
}
}
if (block_number != ~0) {
col_append_fstr(pinfo->cinfo, COL_INFO, ", %sBlock #%d", block_mflag ? "" : "End of ", block_number);
}
if (uri_string[0] != '\0') {
col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", uri_string);
}
/* dissect the payload */
if (coap_length > offset) {
@ -417,34 +522,23 @@ dissect_coap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
guint payload_length = coap_length - offset;
char *ctype_str_default = "";
/*
* TODO:
* currently, coap_content_type is used to distinguish whether
* the content-type was specified. If we need to properly handle
* the case when the type was unknown, we need another flag.
*/
if (coap_content_type == NULL) {
/* default: coap-02 section 3.2.1 */
/* when it's NULL, "text/plain" is set anyway */
coap_content_type = "text/plain";
ctype_str_default = " (default)";
}
/*
* TODO: should the content type be canonicalized ?
* currently assuming it be small.
*/
if (coap_content_type_value == ~0) {
/* default: coap-02 section 3.2.1 */
coap_content_type = "text/plain";
ctype_str_default = " (default)";
}
payload_item = proto_tree_add_text(coap_tree, tvb, offset, -1, "Payload Content-Type: %s%s, Length: %u, offset: %u",
coap_content_type, ctype_str_default, payload_length, offset);
coap_content_type, ctype_str_default, payload_length, offset);
payload_tree = proto_item_add_subtree(payload_item, ett_coap_payload);
payload_tvb = tvb_new_subset(tvb, offset, payload_length, payload_length);
dissector_try_string(media_type_dissector_table, coap_content_type, payload_tvb, pinfo, payload_tree);
}
if (block_number != ~0) {
col_append_fstr(pinfo->cinfo, COL_INFO, ", %sBlock #%d", block_mflag ? "" : "End of ", block_number);
}
}
/*
@ -462,17 +556,23 @@ proto_register_coap(void)
{ &hf_coap_opt_delta, { "Delta", "coap.opt.delta", FT_UINT8, BASE_DEC, NULL, 0xf0, "COAP Option Delta", HFILL }},
{ &hf_coap_opt_length, { "Length", "coap.opt.length", FT_UINT16, BASE_DEC, NULL, 0x0, "COAP Option Length", HFILL }},
{ &hf_coap_opt_ctype, { "Content-type", "coap.opt.ctype", FT_UINT8, BASE_DEC, VALS(vals_ctype), 0x0, "COAP Content Type", HFILL }},
{ &hf_coap_opt_max_age, { "Max-age", "coap.opt.max_age", FT_INT32, BASE_DEC, NULL, 0x0, "COAP Max-age", HFILL }},
{ &hf_coap_opt_max_age, { "Max-age", "coap.opt.max_age", FT_UINT32, BASE_DEC, NULL, 0x0, "COAP Max-age", HFILL }},
{ &hf_coap_opt_proxy_uri, { "Proxy-Uri", "coap.opt.proxy_uri", FT_STRING, BASE_NONE, NULL, 0x0, "COAP Proxy-Uri", HFILL }},
{ &hf_coap_opt_etag, { "Etag", "coap.opt.etag", FT_BYTES, BASE_NONE, NULL, 0x0, "COAP Etag", HFILL }},
{ &hf_coap_opt_uri_authority, { "Uri-Authority", "coap.opt.uri_auth", FT_STRING, BASE_NONE, NULL, 0x0, "COAP Uri-Authority", HFILL }},
{ &hf_coap_opt_location, { "Location", "coap.opt.location", FT_STRING, BASE_NONE, NULL, 0x0, "COAP Location", HFILL }},
{ &hf_coap_opt_uri_host, { "Uri-Host", "coap.opt.uri_host", FT_STRING, BASE_NONE, NULL, 0x0, "COAP Uri-Host", HFILL }},
{ &hf_coap_opt_location_path, { "Location-Path", "coap.opt.location_path", FT_STRING, BASE_NONE, NULL, 0x0, "COAP URI Path", HFILL }},
{ &hf_coap_opt_uri_port, { "Uri-Port", "coap.opt.uri_port", FT_UINT16, BASE_DEC, NULL, 0x0, "COAP Uri-Port", HFILL }},
{ &hf_coap_opt_location_query, { "Location-Query", "coap.opt.location_query", FT_STRING, BASE_NONE, NULL, 0x0, "COAP URI Query", HFILL }},
{ &hf_coap_opt_uri_path, { "Uri-Path", "coap.opt.uri_path", FT_STRING, BASE_NONE, NULL, 0x0, "COAP Uri-Path", HFILL }},
{ &hf_coap_opt_subscr_lifetime, { "Subscription Lifetime", "coap.opt.subscr_lifetime", FT_INT32, BASE_DEC, NULL, 0x0, "COAP Subscription Lifetime", HFILL }},
{ &hf_coap_opt_observe, { "Lifetime", "coap.opt.subscr_lifetime", FT_INT32, BASE_DEC, NULL, 0x0, "COAP Observe", HFILL }},
{ &hf_coap_opt_token, { "Token", "coap.opt.token", FT_BYTES, BASE_NONE, NULL, 0x0, "COAP Token", HFILL }},
{ &hf_coap_opt_accept, { "Accept", "coap.opt.accept", FT_UINT8, BASE_DEC, VALS(vals_ctype), 0x0, "COAP Acceptable Content Type", HFILL }},
{ &hf_coap_opt_if_match, { "If-Match", "coap.opt.if_match", FT_BYTES, BASE_NONE, NULL, 0x0, "COAP If-Match", HFILL }},
{ &hf_coap_opt_block_number, { "Block Number", "coap.opt.block_number", FT_INT32, BASE_DEC, NULL, 0x0, "COAP Block Number", HFILL }},
{ &hf_coap_opt_block_mflag, { "More Flag", "coap.opt.block_mflag", FT_UINT8, BASE_DEC, NULL, 0x08, "COAP Block More Size", HFILL }},
{ &hf_coap_opt_block_size, { "Encoded Block Size", "coap.opt.block_size", FT_UINT8, BASE_DEC, NULL, 0x07, "COAP Encoded Block Size", HFILL }},
{ &hf_coap_opt_uri_query, { "Uri-Query", "coap.opt.uri_query", FT_STRING, BASE_NONE, NULL, 0x0, "COAP Uri-Query", HFILL }},
{ &hf_coap_opt_if_none_match, { "If-None-Match", "coap.opt.if_none_match", FT_BYTES, BASE_NONE, NULL, 0x0, "COAP If-None-Match", HFILL }},
};
static gint *ett[] = {
@ -493,9 +593,9 @@ proto_register_coap(void)
coap_module = prefs_register_protocol (proto_coap, proto_reg_handoff_coap);
prefs_register_uint_preference (coap_module, "udp_port",
"COAP port number",
"Port number used for COAP traffic",
10, &global_coap_port_number);
"COAP port number",
"Port number used for COAP traffic",
10, &global_coap_port_number);
}
void