aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2012-05-15 20:57:21 +0000
committerBill Meier <wmeier@newsguy.com>2012-05-15 20:57:21 +0000
commitb869cb0bc51176db6ad0574d108481b4d250bef0 (patch)
tree175747de48a842a87136f7b1001a67e21c883d0e /epan/dissectors
parentd5aa739fd0f9ca60faa7134ee3d99fb124b1b8e3 (diff)
Remove unneeded includes (ctype.h, stdio.h);
In one case, define our own size for a string buffer (instead of using a magic constant 'BUFSIZ'); In a few cases: do some whitespace, indentation & reformatting cleanup. svn path=/trunk/; revision=42634
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-dcerpc-ndr.c301
-rw-r--r--epan/dissectors/packet-ipp.c1067
-rw-r--r--epan/dissectors/packet-kerberos.c2
-rw-r--r--epan/dissectors/packet-l1-events.c3
-rw-r--r--epan/dissectors/packet-memcache.c4
-rw-r--r--epan/dissectors/packet-osi.c86
-rw-r--r--epan/dissectors/packet-rfid-felica.c126
-rw-r--r--epan/dissectors/packet-rpc.c3
-rw-r--r--epan/dissectors/packet-smb-browse.c6
-rw-r--r--epan/dissectors/packet-text-media.c3
-rw-r--r--epan/dissectors/packet-ucp.c15
11 files changed, 824 insertions, 792 deletions
diff --git a/epan/dissectors/packet-dcerpc-ndr.c b/epan/dissectors/packet-dcerpc-ndr.c
index e82d251094..16996e469f 100644
--- a/epan/dissectors/packet-dcerpc-ndr.c
+++ b/epan/dissectors/packet-dcerpc-ndr.c
@@ -27,9 +27,8 @@
#include "config.h"
#endif
-#include <ctype.h>
-
#include <glib.h>
+
#include <epan/packet.h>
#include <epan/emem.h>
#include "packet-dcerpc.h"
@@ -42,60 +41,60 @@
*/
int
-dissect_ndr_uint8 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
- proto_tree *tree, guint8 *drep,
- int hfindex, guint8 *pdata)
+dissect_ndr_uint8(tvbuff_t *tvb, gint offset, packet_info *pinfo,
+ proto_tree *tree, guint8 *drep,
+ int hfindex, guint8 *pdata)
{
dcerpc_info *di;
- di=pinfo->private_data;
- if(di->conformant_run){
- /* just a run to handle conformant arrays, no scalars to dissect */
- return offset;
+ di = pinfo->private_data;
+ if (di->conformant_run) {
+ /* just a run to handle conformant arrays, no scalars to dissect */
+ return offset;
}
/* no alignment needed */
- return dissect_dcerpc_uint8 (tvb, offset, pinfo,
- tree, drep, hfindex, pdata);
+ return dissect_dcerpc_uint8(tvb, offset, pinfo,
+ tree, drep, hfindex, pdata);
}
int
-PIDL_dissect_uint8 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
+PIDL_dissect_uint8(tvbuff_t *tvb, gint offset, packet_info *pinfo,
proto_tree *tree, guint8 *drep,
int hfindex, guint32 param _U_)
{
dcerpc_info *di;
- guint8 val;
+ guint8 val;
- di=pinfo->private_data;
- if(di->conformant_run){
- /* just a run to handle conformant arrays, no scalars to dissect */
- return offset;
+ di = pinfo->private_data;
+ if (di->conformant_run) {
+ /* just a run to handle conformant arrays, no scalars to dissect */
+ return offset;
}
/* no alignment needed */
- offset=dissect_dcerpc_uint8 (tvb, offset, pinfo,
- tree, drep, hfindex, &val);
+ offset = dissect_dcerpc_uint8(tvb, offset, pinfo,
+ tree, drep, hfindex, &val);
- if(param&PIDL_SET_COL_INFO){
+ if (param&PIDL_SET_COL_INFO) {
header_field_info *hf_info;
char *valstr;
- hf_info=proto_registrar_get_nth(hfindex);
+ hf_info = proto_registrar_get_nth(hfindex);
- valstr=ep_alloc(64);
+ valstr = ep_alloc(64);
valstr[0]=0;
- switch(hf_info->display){
+ switch (hf_info->display) {
case BASE_DEC:
- if(hf_info->strings){
+ if (hf_info->strings) {
g_snprintf(valstr, 64, "%s(%d)",val_to_str(val, hf_info->strings, "Unknown:%u"), val);
} else {
g_snprintf(valstr, 64, "%d", val);
}
break;
case BASE_HEX:
- if(hf_info->strings){
+ if (hf_info->strings) {
g_snprintf(valstr, 64, "%s(0x%02x)",val_to_str(val, hf_info->strings, "Unknown:%u"), val);
} else {
g_snprintf(valstr, 64, "0x%02x", val);
@@ -115,66 +114,66 @@ PIDL_dissect_uint8 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
int
-dissect_ndr_uint16 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
- proto_tree *tree, guint8 *drep,
- int hfindex, guint16 *pdata)
+dissect_ndr_uint16(tvbuff_t *tvb, gint offset, packet_info *pinfo,
+ proto_tree *tree, guint8 *drep,
+ int hfindex, guint16 *pdata)
{
dcerpc_info *di;
- di=pinfo->private_data;
- if(di->conformant_run){
- /* just a run to handle conformant arrays, no scalars to dissect */
- return offset;
+ di = pinfo->private_data;
+ if (di->conformant_run) {
+ /* just a run to handle conformant arrays, no scalars to dissect */
+ return offset;
}
if (!di->no_align && (offset % 2)) {
offset++;
}
- return dissect_dcerpc_uint16 (tvb, offset, pinfo,
- tree, drep, hfindex, pdata);
+ return dissect_dcerpc_uint16(tvb, offset, pinfo,
+ tree, drep, hfindex, pdata);
}
int
-PIDL_dissect_uint16 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
+PIDL_dissect_uint16(tvbuff_t *tvb, gint offset, packet_info *pinfo,
proto_tree *tree, guint8 *drep,
int hfindex, guint32 param _U_)
{
dcerpc_info *di;
- guint16 val;
+ guint16 val;
- di=pinfo->private_data;
- if(di->conformant_run){
- /* just a run to handle conformant arrays, no scalars to dissect */
- return offset;
+ di = pinfo->private_data;
+ if (di->conformant_run) {
+ /* just a run to handle conformant arrays, no scalars to dissect */
+ return offset;
}
if (!di->no_align && (offset % 2)) {
offset++;
}
- offset=dissect_dcerpc_uint16 (tvb, offset, pinfo,
- tree, drep, hfindex, &val);
+ offset = dissect_dcerpc_uint16(tvb, offset, pinfo,
+ tree, drep, hfindex, &val);
- if(param&PIDL_SET_COL_INFO){
+ if (param&PIDL_SET_COL_INFO) {
header_field_info *hf_info;
char *valstr;
- hf_info=proto_registrar_get_nth(hfindex);
+ hf_info = proto_registrar_get_nth(hfindex);
- valstr=ep_alloc(64);
+ valstr = ep_alloc(64);
valstr[0]=0;
- switch(hf_info->display){
+ switch (hf_info->display) {
case BASE_DEC:
- if(hf_info->strings){
+ if (hf_info->strings) {
g_snprintf(valstr, 64, "%s(%d)",val_to_str(val, hf_info->strings, "Unknown:%u"), val);
} else {
g_snprintf(valstr, 64, "%d", val);
}
break;
case BASE_HEX:
- if(hf_info->strings){
+ if (hf_info->strings) {
g_snprintf(valstr, 64, "%s(0x%04x)",val_to_str(val, hf_info->strings, "Unknown:%u"), val);
} else {
g_snprintf(valstr, 64, "0x%04x", val);
@@ -193,37 +192,37 @@ PIDL_dissect_uint16 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
}
int
-dissect_ndr_uint32 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
- proto_tree *tree, guint8 *drep,
- int hfindex, guint32 *pdata)
+dissect_ndr_uint32(tvbuff_t *tvb, gint offset, packet_info *pinfo,
+ proto_tree *tree, guint8 *drep,
+ int hfindex, guint32 *pdata)
{
dcerpc_info *di;
- di=pinfo->private_data;
- if(di->conformant_run){
- /* just a run to handle conformant arrays, no scalars to dissect */
- return offset;
+ di = pinfo->private_data;
+ if (di->conformant_run) {
+ /* just a run to handle conformant arrays, no scalars to dissect */
+ return offset;
}
if (!di->no_align && (offset % 4)) {
offset += 4 - (offset % 4);
}
- return dissect_dcerpc_uint32 (tvb, offset, pinfo,
- tree, drep, hfindex, pdata);
+ return dissect_dcerpc_uint32(tvb, offset, pinfo,
+ tree, drep, hfindex, pdata);
}
/* This is used to dissect the new datatypes, such as pointers and conformance
data, which is 4 bytes in size in NDR but 8 bytes in NDR64.
*/
int
-dissect_ndr_uint3264 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
- proto_tree *tree, guint8 *drep,
- int hfindex, guint3264 *pdata)
+dissect_ndr_uint3264(tvbuff_t *tvb, gint offset, packet_info *pinfo,
+ proto_tree *tree, guint8 *drep,
+ int hfindex, guint3264 *pdata)
{
dcerpc_info *di;
- di=pinfo->private_data;
+ di = pinfo->private_data;
if (di->call_data->flags & DCERPC_IS_NDR64) {
return dissect_ndr_uint64(tvb, offset, pinfo, tree, drep, hfindex, pdata);
@@ -241,13 +240,13 @@ dissect_ndr_uint3264 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
that are 2 bytes in size in NDR but 4 bytes in NDR64.
*/
int
-dissect_ndr_uint1632 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
- proto_tree *tree, guint8 *drep,
- int hfindex, guint1632 *pdata)
+dissect_ndr_uint1632(tvbuff_t *tvb, gint offset, packet_info *pinfo,
+ proto_tree *tree, guint8 *drep,
+ int hfindex, guint1632 *pdata)
{
dcerpc_info *di;
- di=pinfo->private_data;
+ di = pinfo->private_data;
if (di->call_data->flags & DCERPC_IS_NDR64) {
return dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, hfindex, pdata);
@@ -262,45 +261,45 @@ dissect_ndr_uint1632 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
}
int
-PIDL_dissect_uint32 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
+PIDL_dissect_uint32(tvbuff_t *tvb, gint offset, packet_info *pinfo,
proto_tree *tree, guint8 *drep,
int hfindex, guint32 param)
{
dcerpc_info *di;
- guint32 val;
+ guint32 val;
- di=pinfo->private_data;
- if(di->conformant_run){
- /* just a run to handle conformant arrays, no scalars to dissect */
- return offset;
+ di = pinfo->private_data;
+ if (di->conformant_run) {
+ /* just a run to handle conformant arrays, no scalars to dissect */
+ return offset;
}
if (!di->no_align && (offset % 4)) {
offset += 4 - (offset % 4);
}
- offset=dissect_dcerpc_uint32 (tvb, offset, pinfo,
- tree, drep, hfindex, &val);
+ offset = dissect_dcerpc_uint32(tvb, offset, pinfo,
+ tree, drep, hfindex, &val);
- if(param&PIDL_SET_COL_INFO){
+ if (param&PIDL_SET_COL_INFO) {
header_field_info *hf_info;
char *valstr;
- hf_info=proto_registrar_get_nth(hfindex);
+ hf_info = proto_registrar_get_nth(hfindex);
- valstr=ep_alloc(64);
+ valstr = ep_alloc(64);
valstr[0]=0;
- switch(hf_info->display){
+ switch (hf_info->display) {
case BASE_DEC:
- if(hf_info->strings){
+ if (hf_info->strings) {
g_snprintf(valstr, 64, "%s(%d)",val_to_str(val, hf_info->strings, "Unknown:%u"), val);
} else {
g_snprintf(valstr, 64, "%d", val);
}
break;
case BASE_HEX:
- if(hf_info->strings){
+ if (hf_info->strings) {
g_snprintf(valstr, 64, "%s(0x%08x)",val_to_str(val, hf_info->strings, "Unknown:%u"), val);
} else {
g_snprintf(valstr, 64, "0x%08x", val);
@@ -324,87 +323,87 @@ PIDL_dissect_uint32 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
It is really just 2 uint32's
*/
int
-dissect_ndr_duint32 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
+dissect_ndr_duint32(tvbuff_t *tvb, gint offset, packet_info *pinfo,
proto_tree *tree, guint8 *drep,
int hfindex, guint64 *pdata)
{
dcerpc_info *di;
- di=pinfo->private_data;
- if(di->conformant_run){
- /* just a run to handle conformant arrays, no scalars to dissect */
- return offset;
+ di = pinfo->private_data;
+ if (di->conformant_run) {
+ /* just a run to handle conformant arrays, no scalars to dissect */
+ return offset;
}
if (!di->no_align && (offset % 4)) {
offset += 4 - (offset % 4);
}
- return dissect_dcerpc_uint64 (tvb, offset, pinfo,
- tree, drep, hfindex, pdata);
+ return dissect_dcerpc_uint64(tvb, offset, pinfo,
+ tree, drep, hfindex, pdata);
}
/* uint64 : hyper
a 64 bit integer aligned to proper 8 byte boundaries
*/
int
-dissect_ndr_uint64 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
- proto_tree *tree, guint8 *drep,
- int hfindex, guint64 *pdata)
+dissect_ndr_uint64(tvbuff_t *tvb, gint offset, packet_info *pinfo,
+ proto_tree *tree, guint8 *drep,
+ int hfindex, guint64 *pdata)
{
dcerpc_info *di;
- di=pinfo->private_data;
- if(di->conformant_run){
- /* just a run to handle conformant arrays, no scalars to dissect */
- return offset;
+ di = pinfo->private_data;
+ if (di->conformant_run) {
+ /* just a run to handle conformant arrays, no scalars to dissect */
+ return offset;
}
if (!di->no_align && (offset % 8)) {
offset += 8 - (offset % 8);
}
- return dissect_dcerpc_uint64 (tvb, offset, pinfo,
- tree, drep, hfindex, pdata);
+ return dissect_dcerpc_uint64(tvb, offset, pinfo,
+ tree, drep, hfindex, pdata);
}
int
-PIDL_dissect_uint64 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
+PIDL_dissect_uint64(tvbuff_t *tvb, gint offset, packet_info *pinfo,
proto_tree *tree, guint8 *drep,
int hfindex, guint32 param _U_)
{
dcerpc_info *di;
- guint64 val;
+ guint64 val;
- di=pinfo->private_data;
- if(di->conformant_run){
- /* just a run to handle conformant arrays, no scalars to dissect */
- return offset;
+ di = pinfo->private_data;
+ if (di->conformant_run) {
+ /* just a run to handle conformant arrays, no scalars to dissect */
+ return offset;
}
if (!di->no_align && (offset % 8)) {
offset += 8 - (offset % 8);
}
- offset=dissect_dcerpc_uint64 (tvb, offset, pinfo,
- tree, drep, hfindex, &val);
+ offset = dissect_dcerpc_uint64(tvb, offset, pinfo,
+ tree, drep, hfindex, &val);
- if(param&PIDL_SET_COL_INFO){
+ if (param&PIDL_SET_COL_INFO) {
header_field_info *hf_info;
char *valstr;
- hf_info=proto_registrar_get_nth(hfindex);
+ hf_info = proto_registrar_get_nth(hfindex);
- valstr=ep_alloc(64);
+ valstr = ep_alloc(64);
valstr[0]=0;
- switch(hf_info->display){
+ switch (hf_info->display) {
case BASE_DEC:
- if(hf_info->strings){
+ if (hf_info->strings) {
g_snprintf(valstr, 64, "%s(%" G_GINT64_MODIFIER "u)",val_to_str( (guint32) val, hf_info->strings, "Unknown:%u"), val);
} else {
g_snprintf(valstr, 64, "%" G_GINT64_MODIFIER "u", val);
}
break;
case BASE_HEX:
- if(hf_info->strings){
+ if (hf_info->strings) {
g_snprintf(valstr, 64, "%s(0x%" G_GINT64_MODIFIER "x)",val_to_str( (guint32) val, hf_info->strings, "Unknown:%u"), val);
} else {
g_snprintf(valstr, 64, "0x%" G_GINT64_MODIFIER "x", val);
@@ -424,88 +423,88 @@ PIDL_dissect_uint64 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
int
dissect_ndr_float(tvbuff_t *tvb, gint offset, packet_info *pinfo,
- proto_tree *tree, guint8 *drep,
- int hfindex, gfloat *pdata)
+ proto_tree *tree, guint8 *drep,
+ int hfindex, gfloat *pdata)
{
dcerpc_info *di;
- di=pinfo->private_data;
- if(di->conformant_run){
- /* just a run to handle conformant arrays, no scalars to dissect */
- return offset;
+ di = pinfo->private_data;
+ if (di->conformant_run) {
+ /* just a run to handle conformant arrays, no scalars to dissect */
+ return offset;
}
if (!di->no_align && (offset % 4)) {
offset += 4 - (offset % 4);
}
return dissect_dcerpc_float(tvb, offset, pinfo,
- tree, drep, hfindex, pdata);
+ tree, drep, hfindex, pdata);
}
int
dissect_ndr_double(tvbuff_t *tvb, gint offset, packet_info *pinfo,
- proto_tree *tree, guint8 *drep,
- int hfindex, gdouble *pdata)
+ proto_tree *tree, guint8 *drep,
+ int hfindex, gdouble *pdata)
{
dcerpc_info *di;
- di=pinfo->private_data;
- if(di->conformant_run){
- /* just a run to handle conformant arrays, no scalars to dissect */
- return offset;
+ di = pinfo->private_data;
+ if (di->conformant_run) {
+ /* just a run to handle conformant arrays, no scalars to dissect */
+ return offset;
}
if (!di->no_align && (offset % 8)) {
offset += 8 - (offset % 8);
}
return dissect_dcerpc_double(tvb, offset, pinfo,
- tree, drep, hfindex, pdata);
+ tree, drep, hfindex, pdata);
}
/* handles unix 32 bit time_t */
int
-dissect_ndr_time_t (tvbuff_t *tvb, gint offset, packet_info *pinfo,
- proto_tree *tree, guint8 *drep,
- int hfindex, guint32 *pdata)
+dissect_ndr_time_t(tvbuff_t *tvb, gint offset, packet_info *pinfo,
+ proto_tree *tree, guint8 *drep,
+ int hfindex, guint32 *pdata)
{
dcerpc_info *di;
- di=pinfo->private_data;
- if(di->conformant_run){
- /* just a run to handle conformant arrays, no scalars to dissect */
- return offset;
+ di = pinfo->private_data;
+ if (di->conformant_run) {
+ /* just a run to handle conformant arrays, no scalars to dissect */
+ return offset;
}
if (!di->no_align && (offset % 4)) {
offset += 4 - (offset % 4);
}
- return dissect_dcerpc_time_t (tvb, offset, pinfo,
- tree, drep, hfindex, pdata);
+ return dissect_dcerpc_time_t(tvb, offset, pinfo,
+ tree, drep, hfindex, pdata);
}
int
-dissect_ndr_uuid_t (tvbuff_t *tvb, gint offset, packet_info *pinfo,
- proto_tree *tree, guint8 *drep,
- int hfindex, e_uuid_t *pdata)
+dissect_ndr_uuid_t(tvbuff_t *tvb, gint offset, packet_info *pinfo,
+ proto_tree *tree, guint8 *drep,
+ int hfindex, e_uuid_t *pdata)
{
dcerpc_info *di;
- di=pinfo->private_data;
- if(di->conformant_run){
- /* just a run to handle conformant arrays, no scalars to dissect */
- return offset;
+ di = pinfo->private_data;
+ if (di->conformant_run) {
+ /* just a run to handle conformant arrays, no scalars to dissect */
+ return offset;
}
/* uuid's are aligned to 4 bytes, due to initial uint32 in struct */
if (!di->no_align && (offset % 4)) {
offset += 4 - (offset % 4);
}
- return dissect_dcerpc_uuid_t (tvb, offset, pinfo,
- tree, drep, hfindex, pdata);
+ return dissect_dcerpc_uuid_t(tvb, offset, pinfo,
+ tree, drep, hfindex, pdata);
}
/*
@@ -518,27 +517,27 @@ dissect_ndr_uuid_t (tvbuff_t *tvb, gint offset, packet_info *pinfo,
* attributes and the uuid_t?
*/
int
-dissect_ndr_ctx_hnd (tvbuff_t *tvb, gint offset, packet_info *pinfo,
- proto_tree *tree, guint8 *drep,
- int hfindex, e_ctx_hnd *pdata)
+dissect_ndr_ctx_hnd(tvbuff_t *tvb, gint offset, packet_info *pinfo,
+ proto_tree *tree, guint8 *drep,
+ int hfindex, e_ctx_hnd *pdata)
{
static e_ctx_hnd ctx_hnd;
dcerpc_info *di;
- di=pinfo->private_data;
- if(di->conformant_run){
- /* just a run to handle conformant arrays, no scalars to dissect */
- return offset;
+ di = pinfo->private_data;
+ if (di->conformant_run) {
+ /* just a run to handle conformant arrays, no scalars to dissect */
+ return offset;
}
if (!di->no_align && (offset % 2)) {
offset += 4 - (offset % 4);
}
- ctx_hnd.attributes = dcerpc_tvb_get_ntohl (tvb, offset, drep);
- dcerpc_tvb_get_uuid (tvb, offset+4, drep, &ctx_hnd.uuid);
+ ctx_hnd.attributes = dcerpc_tvb_get_ntohl(tvb, offset, drep);
+ dcerpc_tvb_get_uuid(tvb, offset+4, drep, &ctx_hnd.uuid);
if (tree) {
/* Bytes is bytes - don't worry about the data representation */
- proto_tree_add_item (tree, hfindex, tvb, offset, 20, ENC_NA);
+ proto_tree_add_item(tree, hfindex, tvb, offset, 20, ENC_NA);
}
if (pdata) {
*pdata = ctx_hnd;
diff --git a/epan/dissectors/packet-ipp.c b/epan/dissectors/packet-ipp.c
index c649e96e51..fb4cf0bcbf 100644
--- a/epan/dissectors/packet-ipp.c
+++ b/epan/dissectors/packet-ipp.c
@@ -29,7 +29,6 @@
#endif
#include <string.h>
-#include <ctype.h>
#include <glib.h>
#include <epan/packet.h>
@@ -46,19 +45,16 @@ static gint ett_ipp_attr = -1;
static dissector_handle_t data_handle;
-#define PRINT_JOB 0x0002
-#define PRINT_URI 0x0003
-#define VALIDATE_JOB 0x0004
-#define CREATE_JOB 0x0005
-#define SEND_DOCUMENT 0x0006
-#define SEND_URI 0x0007
-#define CANCEL_JOB 0x0008
-#define GET_JOB_ATTRIBUTES 0x0009
-#define GET_JOBS 0x000A
-#define GET_PRINTER_ATTRIBUTES 0x000B
-#define IDLE 0x3
-#define PROCESSING 0x4
-#define STOPPED 0x5
+#define PRINT_JOB 0x0002
+#define PRINT_URI 0x0003
+#define VALIDATE_JOB 0x0004
+#define CREATE_JOB 0x0005
+#define SEND_DOCUMENT 0x0006
+#define SEND_URI 0x0007
+#define CANCEL_JOB 0x0008
+#define GET_JOB_ATTRIBUTES 0x0009
+#define GET_JOBS 0x000A
+#define GET_PRINTER_ATTRIBUTES 0x000B
static const value_string operation_vals[] = {
{ PRINT_JOB, "Print-Job" },
@@ -75,62 +71,65 @@ static const value_string operation_vals[] = {
};
/* Printer States */
+#define PRINTER_STATE_IDLE 0x3
+#define PRINTER_STATE_PROCESSING 0x4
+#define PRINTER_STATE_STOPPED 0x5
static const value_string printer_state_vals[] = {
- { IDLE, "Idle" },
- { PROCESSING, "Processing" },
- { STOPPED, "Stopped" },
- { 0, NULL }
+ { PRINTER_STATE_IDLE, "Idle" },
+ { PRINTER_STATE_PROCESSING, "Processing" },
+ { PRINTER_STATE_STOPPED, "Stopped" },
+ { 0, NULL }
};
/* Job States */
static const value_string job_state_vals[] = {
- { 3, "Pending" },
- { 4, "Pending - Job Held" },
- { 5, "Processing" },
- { 6, "Processing - Job Stopped" },
- { 7, "Canceled" },
- { 8, "Aborted" },
- { 9, "Completed" },
- { 0, NULL }
+ { 3, "Pending" },
+ { 4, "Pending - Job Held" },
+ { 5, "Processing" },
+ { 6, "Processing - Job Stopped" },
+ { 7, "Canceled" },
+ { 8, "Aborted" },
+ { 9, "Completed" },
+ { 0, NULL }
};
-#define STATUS_SUCCESSFUL 0x0000
-#define STATUS_INFORMATIONAL 0x0100
-#define STATUS_REDIRECTION 0x0200
-#define STATUS_CLIENT_ERROR 0x0400
-#define STATUS_SERVER_ERROR 0x0500
-
-#define STATUS_TYPE_MASK 0xFF00
-
-#define SUCCESSFUL_OK 0x0000
-#define SUCCESSFUL_OK_IGN_OR_SUB_ATTR 0x0001
-#define SUCCESSFUL_OK_CONFLICTING_ATTR 0x0002
-
-#define CLIENT_ERROR_BAD_REQUEST 0x0400
-#define CLIENT_ERROR_FORBIDDEN 0x0401
-#define CLIENT_ERROR_NOT_AUTHENTICATED 0x0402
-#define CLIENT_ERROR_NOT_AUTHORIZED 0x0403
-#define CLIENT_ERROR_NOT_POSSIBLE 0x0404
-#define CLIENT_ERROR_TIMEOUT 0x0405
-#define CLIENT_ERROR_NOT_FOUND 0x0406
-#define CLIENT_ERROR_GONE 0x0407
-#define CLIENT_ERROR_REQ_ENTITY_TOO_LRG 0x0408
-#define CLIENT_ERROR_REQ_VALUE_TOO_LONG 0x0409
-#define CLIENT_ERROR_DOC_FMT_NOT_SUPP 0x040A
-#define CLIENT_ERROR_ATTR_OR_VAL_NOT_SUPP 0x040B
-#define CLIENT_ERROR_URI_SCHEME_NOT_SUPP 0x040C
-#define CLIENT_ERROR_CHARSET_NOT_SUPP 0x040D
-#define CLIENT_ERROR_CONFLICTING_ATTRS 0x040E
-
-#define SERVER_ERROR_INTERNAL_ERROR 0x0500
-#define SERVER_ERROR_OPERATION_NOT_SUPP 0x0501
-#define SERVER_ERROR_SERVICE_UNAVAIL 0x0502
-#define SERVER_ERROR_VERSION_NOT_SUPP 0x0503
-#define SERVER_ERROR_DEVICE_ERROR 0x0504
-#define SERVER_ERROR_TEMPORARY_ERROR 0x0505
-#define SERVER_ERROR_NOT_ACCEPTING_JOBS 0x0506
-#define SERVER_ERROR_BUSY 0x0507
-#define SERVER_ERROR_JOB_CANCELED 0x0508
+#define STATUS_SUCCESSFUL 0x0000
+#define STATUS_INFORMATIONAL 0x0100
+#define STATUS_REDIRECTION 0x0200
+#define STATUS_CLIENT_ERROR 0x0400
+#define STATUS_SERVER_ERROR 0x0500
+
+#define STATUS_TYPE_MASK 0xFF00
+
+#define SUCCESSFUL_OK 0x0000
+#define SUCCESSFUL_OK_IGN_OR_SUB_ATTR 0x0001
+#define SUCCESSFUL_OK_CONFLICTING_ATTR 0x0002
+
+#define CLIENT_ERROR_BAD_REQUEST 0x0400
+#define CLIENT_ERROR_FORBIDDEN 0x0401
+#define CLIENT_ERROR_NOT_AUTHENTICATED 0x0402
+#define CLIENT_ERROR_NOT_AUTHORIZED 0x0403
+#define CLIENT_ERROR_NOT_POSSIBLE 0x0404
+#define CLIENT_ERROR_TIMEOUT 0x0405
+#define CLIENT_ERROR_NOT_FOUND 0x0406
+#define CLIENT_ERROR_GONE 0x0407
+#define CLIENT_ERROR_REQ_ENTITY_TOO_LRG 0x0408
+#define CLIENT_ERROR_REQ_VALUE_TOO_LONG 0x0409
+#define CLIENT_ERROR_DOC_FMT_NOT_SUPP 0x040A
+#define CLIENT_ERROR_ATTR_OR_VAL_NOT_SUPP 0x040B
+#define CLIENT_ERROR_URI_SCHEME_NOT_SUPP 0x040C
+#define CLIENT_ERROR_CHARSET_NOT_SUPP 0x040D
+#define CLIENT_ERROR_CONFLICTING_ATTRS 0x040E
+
+#define SERVER_ERROR_INTERNAL_ERROR 0x0500
+#define SERVER_ERROR_OPERATION_NOT_SUPP 0x0501
+#define SERVER_ERROR_SERVICE_UNAVAIL 0x0502
+#define SERVER_ERROR_VERSION_NOT_SUPP 0x0503
+#define SERVER_ERROR_DEVICE_ERROR 0x0504
+#define SERVER_ERROR_TEMPORARY_ERROR 0x0505
+#define SERVER_ERROR_NOT_ACCEPTING_JOBS 0x0506
+#define SERVER_ERROR_BUSY 0x0507
+#define SERVER_ERROR_JOB_CANCELED 0x0508
static const value_string status_vals[] = {
{ SUCCESSFUL_OK, "Successful-OK" },
@@ -165,492 +164,502 @@ static const value_string status_vals[] = {
static int parse_attributes(tvbuff_t *tvb, int offset, proto_tree *tree);
static proto_tree *add_integer_tree(proto_tree *tree, tvbuff_t *tvb,
- int offset, int name_length, int value_length, guint8 tag);
+ int offset, int name_length, int value_length, guint8 tag);
static void add_integer_value(const gchar *tag_desc, proto_tree *tree,
- tvbuff_t *tvb, int offset, int name_length, int value_length, guint8 tag);
+ tvbuff_t *tvb, int offset, int name_length, int value_length, guint8 tag);
static proto_tree *add_octetstring_tree(proto_tree *tree, tvbuff_t *tvb,
- int offset, int name_length, int value_length);
+ int offset, int name_length, int value_length);
static void add_octetstring_value(const gchar *tag_desc, proto_tree *tree,
- tvbuff_t *tvb, int offset, int name_length, int value_length);
+ tvbuff_t *tvb, int offset, int name_length, int value_length);
static proto_tree *add_charstring_tree(proto_tree *tree, tvbuff_t *tvb,
- int offset, int name_length, int value_length);
+ int offset, int name_length, int value_length);
static void add_charstring_value(const gchar *tag_desc, proto_tree *tree,
- tvbuff_t *tvb, int offset, int name_length, int value_length);
+ tvbuff_t *tvb, int offset, int name_length, int value_length);
static int add_value_head(const gchar *tag_desc, proto_tree *tree,
- tvbuff_t *tvb, int offset, int name_length, int value_length, char **name_val);
+ tvbuff_t *tvb, int offset, int name_length, int value_length, char **name_val);
static void
dissect_ipp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- proto_tree *ipp_tree;
- proto_item *ti;
- int offset = 0;
- gboolean is_request = (pinfo->destport == pinfo->match_port);
- /* XXX - should this be based on the HTTP header? */
- guint16 status_code;
- const gchar *status_fmt;
-
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "IPP");
- if (check_col(pinfo->cinfo, COL_INFO)) {
- if (is_request)
- col_set_str(pinfo->cinfo, COL_INFO, "IPP request");
- else
- col_set_str(pinfo->cinfo, COL_INFO, "IPP response");
- }
-
- if (tree) {
- ti = proto_tree_add_item(tree, proto_ipp, tvb, offset, -1,
- ENC_NA);
- ipp_tree = proto_item_add_subtree(ti, ett_ipp);
-
- proto_tree_add_text(ipp_tree, tvb, offset, 2, "Version: %u.%u",
- tvb_get_guint8(tvb, offset),
- tvb_get_guint8(tvb, offset + 1));
- offset += 2;
-
- if (is_request) {
- proto_tree_add_text(ipp_tree, tvb, offset, 2, "Operation-id: %s",
- val_to_str(tvb_get_ntohs(tvb, offset), operation_vals,
- "Unknown (0x%04x)"));
- } else {
- status_code = tvb_get_ntohs(tvb, offset);
- switch (status_code & STATUS_TYPE_MASK) {
-
- case STATUS_SUCCESSFUL:
- status_fmt = "Successful (0x%04x)";
- break;
-
- case STATUS_INFORMATIONAL:
- status_fmt = "Informational (0x%04x)";
- break;
-
- case STATUS_REDIRECTION:
- status_fmt = "Redirection (0x%04x)";
- break;
-
- case STATUS_CLIENT_ERROR:
- status_fmt = "Client error (0x%04x)";
- break;
-
- case STATUS_SERVER_ERROR:
- status_fmt = "Server error (0x%04x)";
- break;
-
- default:
- status_fmt = "Unknown (0x%04x)";
- break;
- }
- proto_tree_add_text(ipp_tree, tvb, offset, 2, "Status-code: %s",
- val_to_str(status_code, status_vals, status_fmt));
- }
- offset += 2;
-
- proto_tree_add_text(ipp_tree, tvb, offset, 4, "Request ID: %u",
- tvb_get_ntohl(tvb, offset));
- offset += 4;
-
- offset = parse_attributes(tvb, offset, ipp_tree);
-
- if (tvb_offset_exists(tvb, offset)) {
- call_dissector(data_handle,
- tvb_new_subset_remaining(tvb, offset), pinfo,
- ipp_tree);
- }
- }
+ proto_tree *ipp_tree;
+ proto_item *ti;
+ int offset = 0;
+ gboolean is_request = (pinfo->destport == pinfo->match_port);
+ /* XXX - should this be based on the HTTP header? */
+ guint16 status_code;
+ const gchar *status_fmt;
+
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "IPP");
+ if (is_request)
+ col_set_str(pinfo->cinfo, COL_INFO, "IPP request");
+ else
+ col_set_str(pinfo->cinfo, COL_INFO, "IPP response");
+
+ if (tree) {
+ ti = proto_tree_add_item(tree, proto_ipp, tvb, offset, -1, ENC_NA);
+ ipp_tree = proto_item_add_subtree(ti, ett_ipp);
+
+ proto_tree_add_text(ipp_tree, tvb, offset, 2, "Version: %u.%u",
+ tvb_get_guint8(tvb, offset),
+ tvb_get_guint8(tvb, offset + 1));
+ offset += 2;
+
+ if (is_request) {
+ proto_tree_add_text(ipp_tree, tvb, offset, 2, "Operation-id: %s",
+ val_to_str(tvb_get_ntohs(tvb, offset), operation_vals,
+ "Unknown (0x%04x)"));
+ } else {
+ status_code = tvb_get_ntohs(tvb, offset);
+ switch (status_code & STATUS_TYPE_MASK) {
+
+ case STATUS_SUCCESSFUL:
+ status_fmt = "Successful (0x%04x)";
+ break;
+
+ case STATUS_INFORMATIONAL:
+ status_fmt = "Informational (0x%04x)";
+ break;
+
+ case STATUS_REDIRECTION:
+ status_fmt = "Redirection (0x%04x)";
+ break;
+
+ case STATUS_CLIENT_ERROR:
+ status_fmt = "Client error (0x%04x)";
+ break;
+
+ case STATUS_SERVER_ERROR:
+ status_fmt = "Server error (0x%04x)";
+ break;
+
+ default:
+ status_fmt = "Unknown (0x%04x)";
+ break;
+ }
+ proto_tree_add_text(ipp_tree, tvb, offset, 2, "Status-code: %s",
+ val_to_str(status_code, status_vals, status_fmt));
+ }
+ offset += 2;
+
+ proto_tree_add_text(ipp_tree, tvb, offset, 4, "Request ID: %u",
+ tvb_get_ntohl(tvb, offset));
+ offset += 4;
+
+ offset = parse_attributes(tvb, offset, ipp_tree);
+
+ if (tvb_offset_exists(tvb, offset)) {
+ call_dissector(data_handle,
+ tvb_new_subset_remaining(tvb, offset), pinfo,
+ ipp_tree);
+ }
+ }
}
-#define TAG_TYPE(tag) ((tag) & 0xF0)
-#define TAG_TYPE_DELIMITER 0x00
-#define TAG_TYPE_INTEGER 0x20
-#define TAG_TYPE_OCTETSTRING 0x30
-#define TAG_TYPE_CHARSTRING 0x40
-
-#define TAG_END_OF_ATTRIBUTES 0x03
-
-#define TAG_INTEGER 0x21
-#define TAG_BOOLEAN 0x22
-#define TAG_ENUM 0x23
-
-#define TAG_OCTETSTRING 0x30
-#define TAG_DATETIME 0x31
-#define TAG_RESOLUTION 0x32
-#define TAG_RANGEOFINTEGER 0x33
-#define TAG_TEXTWITHLANGUAGE 0x35
-#define TAG_NAMEWITHLANGUAGE 0x36
-
-#define TAG_TEXTWITHOUTLANGUAGE 0x41
-#define TAG_NAMEWITHOUTLANGUAGE 0x42
-#define TAG_KEYWORD 0x44
-#define TAG_URI 0x45
-#define TAG_URISCHEME 0x46
-#define TAG_CHARSET 0x47
-#define TAG_NATURALLANGUAGE 0x48
-#define TAG_MIMEMEDIATYPE 0x49
+#define TAG_TYPE(x) ((x) & 0xF0)
+
+#define TAG_TYPE_DELIMITER 0x00
+#define TAG_TYPE_INTEGER 0x20
+#define TAG_TYPE_OCTETSTRING 0x30
+#define TAG_TYPE_CHARSTRING 0x40
+
+#define TAG_END_OF_ATTRIBUTES 0x03
+
+#define TAG_INTEGER 0x21
+#define TAG_BOOLEAN 0x22
+#define TAG_ENUM 0x23
+
+#define TAG_OCTETSTRING 0x30
+#define TAG_DATETIME 0x31
+#define TAG_RESOLUTION 0x32
+#define TAG_RANGEOFINTEGER 0x33
+#define TAG_TEXTWITHLANGUAGE 0x35
+#define TAG_NAMEWITHLANGUAGE 0x36
+
+#define TAG_TEXTWITHOUTLANGUAGE 0x41
+#define TAG_NAMEWITHOUTLANGUAGE 0x42
+#define TAG_KEYWORD 0x44
+#define TAG_URI 0x45
+#define TAG_URISCHEME 0x46
+#define TAG_CHARSET 0x47
+#define TAG_NATURALLANGUAGE 0x48
+#define TAG_MIMEMEDIATYPE 0x49
static const value_string tag_vals[] = {
- /* Delimiter tags */
- { 0x01, "Operation attributes" },
- { 0x02, "Job attributes" },
- { TAG_END_OF_ATTRIBUTES, "End of attributes" },
- { 0x04, "Printer attributes" },
- { 0x05, "Unsupported attributes" },
-
- /* Value tags */
- { 0x10, "Unsupported" },
- { 0x12, "Unknown" },
- { 0x13, "No value" },
- { TAG_INTEGER, "Integer" },
- { TAG_BOOLEAN, "Boolean" },
- { TAG_ENUM, "Enum" },
- { TAG_OCTETSTRING, "Octet string" },
- { TAG_DATETIME, "Date/Time" },
- { TAG_RESOLUTION, "Resolution" },
- { TAG_RANGEOFINTEGER, "Range of integer" },
- { TAG_TEXTWITHLANGUAGE, "Text with language" },
- { TAG_NAMEWITHLANGUAGE, "Name with language" },
- { TAG_TEXTWITHOUTLANGUAGE, "Text without language" },
- { TAG_NAMEWITHOUTLANGUAGE, "Name without language" },
- { TAG_KEYWORD, "Keyword" },
- { TAG_URI, "URI" },
- { TAG_URISCHEME, "URI scheme" },
- { TAG_CHARSET, "Character set" },
- { TAG_NATURALLANGUAGE, "Natural language" },
- { TAG_MIMEMEDIATYPE, "MIME media type" },
- { 0, NULL }
+ /* Delimiter tags */
+ { 0x01, "Operation attributes" },
+ { 0x02, "Job attributes" },
+ { TAG_END_OF_ATTRIBUTES, "End of attributes" },
+ { 0x04, "Printer attributes" },
+ { 0x05, "Unsupported attributes" },
+
+ /* Value tags */
+ { 0x10, "Unsupported" },
+ { 0x12, "Unknown" },
+ { 0x13, "No value" },
+ { TAG_INTEGER, "Integer" },
+ { TAG_BOOLEAN, "Boolean" },
+ { TAG_ENUM, "Enum" },
+ { TAG_OCTETSTRING, "Octet string" },
+ { TAG_DATETIME, "Date/Time" },
+ { TAG_RESOLUTION, "Resolution" },
+ { TAG_RANGEOFINTEGER, "Range of integer" },
+ { TAG_TEXTWITHLANGUAGE, "Text with language" },
+ { TAG_NAMEWITHLANGUAGE, "Name with language" },
+ { TAG_TEXTWITHOUTLANGUAGE, "Text without language" },
+ { TAG_NAMEWITHOUTLANGUAGE, "Name without language" },
+ { TAG_KEYWORD, "Keyword" },
+ { TAG_URI, "URI" },
+ { TAG_URISCHEME, "URI scheme" },
+ { TAG_CHARSET, "Character set" },
+ { TAG_NATURALLANGUAGE, "Natural language" },
+ { TAG_MIMEMEDIATYPE, "MIME media type" },
+ { 0, NULL }
};
static int
parse_attributes(tvbuff_t *tvb, int offset, proto_tree *tree)
{
- guint8 tag;
- const gchar *tag_desc;
- int name_length, value_length;
- proto_tree *as_tree = tree;
- proto_item *tas = NULL;
- int start_offset = offset;
- proto_tree *attr_tree = tree;
-
- while (tvb_offset_exists(tvb, offset)) {
- tag = tvb_get_guint8(tvb, offset);
- tag_desc = val_to_str(tag, tag_vals, "Reserved (0x%02x)");
- if (TAG_TYPE(tag) == TAG_TYPE_DELIMITER) {
- /*
- * If we had an attribute sequence we were
- * working on, we're done with it; set its
- * length to the length of all the stuff
- * we've done so far.
- */
- if (tas != NULL)
- proto_item_set_len(tas, offset - start_offset);
-
- /*
- * This tag starts a new attribute sequence;
- * create a new tree under this tag when we see
- * a non-delimiter tag, under which to put
- * those attributes.
- */
- as_tree = NULL;
- attr_tree = tree;
-
- /*
- * Remember the offset at which this attribute
- * sequence started, so we can use it to compute
- * its length when it's finished.
- */
- start_offset = offset;
-
- /*
- * Now create a new item for this tag.
- */
- tas = proto_tree_add_text(tree, tvb, offset, 1,
- "%s", tag_desc);
- offset++;
- if (tag == TAG_END_OF_ATTRIBUTES) {
- /*
- * No more attributes.
- */
- break;
- }
- } else {
- /*
- * Value tag - get the name length.
- */
- name_length = tvb_get_ntohs(tvb, offset + 1);
-
- /*
- * OK, get the value length.
- */
- value_length = tvb_get_ntohs(tvb, offset + 1 + 2 + name_length);
-
- /*
- * OK, does the value run past the end of the
- * frame?
- */
- if (as_tree == NULL) {
- /*
- * OK, there's an attribute to hang
- * under a delimiter tag, but we don't
- * have a tree for that tag yet; create
- * a tree.
- */
- as_tree = proto_item_add_subtree(tas,
- ett_ipp_as);
- attr_tree = as_tree;
- }
-
- switch (TAG_TYPE(tag)) {
-
- case TAG_TYPE_INTEGER:
- if (name_length != 0) {
- /*
- * This is an attribute, not
- * an additional value, so
- * start a tree for it.
- */
- attr_tree = add_integer_tree(as_tree,
- tvb, offset, name_length,
- value_length, tag);
- }
- add_integer_value(tag_desc, attr_tree, tvb,
- offset, name_length, value_length, tag);
- break;
-
- case TAG_TYPE_OCTETSTRING:
- if (name_length != 0) {
- /*
- * This is an attribute, not
- * an additional value, so
- * start a tree for it.
- */
- attr_tree = add_octetstring_tree(as_tree,
- tvb, offset, name_length,
- value_length);
- }
- add_octetstring_value(tag_desc, attr_tree, tvb,
- offset, name_length, value_length);
- break;
-
- case TAG_TYPE_CHARSTRING:
- if (name_length != 0) {
- /*
- * This is an attribute, not
- * an additional value, so
- * start a tree for it.
- */
- attr_tree = add_charstring_tree(as_tree,
- tvb, offset, name_length,
- value_length);
- }
- add_charstring_value(tag_desc, attr_tree, tvb,
- offset, name_length, value_length);
- break;
- }
- offset += 1 + 2 + name_length + 2 + value_length;
- }
- }
-
- return offset;
+ guint8 tag;
+ const gchar *tag_desc;
+ int name_length, value_length;
+ proto_tree *as_tree = tree;
+ proto_item *tas = NULL;
+ int start_offset = offset;
+ proto_tree *attr_tree = tree;
+
+ while (tvb_offset_exists(tvb, offset)) {
+ tag = tvb_get_guint8(tvb, offset);
+ tag_desc = val_to_str(tag, tag_vals, "Reserved (0x%02x)");
+ if (TAG_TYPE(tag) == TAG_TYPE_DELIMITER) {
+ /*
+ * If we had an attribute sequence we were
+ * working on, we're done with it; set its
+ * length to the length of all the stuff
+ * we've done so far.
+ */
+ if (tas != NULL)
+ proto_item_set_len(tas, offset - start_offset);
+
+ /*
+ * This tag starts a new attribute sequence;
+ * create a new tree under this tag when we see
+ * a non-delimiter tag, under which to put
+ * those attributes.
+ */
+ as_tree = NULL;
+ attr_tree = tree;
+
+ /*
+ * Remember the offset at which this attribute
+ * sequence started, so we can use it to compute
+ * its length when it's finished.
+ */
+ start_offset = offset;
+
+ /*
+ * Now create a new item for this tag.
+ */
+ tas = proto_tree_add_text(tree, tvb, offset, 1,
+ "%s", tag_desc);
+ offset += 1;
+ if (tag == TAG_END_OF_ATTRIBUTES) {
+ /*
+ * No more attributes.
+ */
+ break;
+ }
+ } else {
+ /*
+ * Value tag - get the name length.
+ */
+ name_length = tvb_get_ntohs(tvb, offset + 1);
+
+ /*
+ * OK, get the value length.
+ */
+ value_length = tvb_get_ntohs(tvb, offset + 1 + 2 + name_length);
+
+ /*
+ * OK, does the value run past the end of the
+ * frame?
+ */
+ if (as_tree == NULL) {
+ /*
+ * OK, there's an attribute to hang
+ * under a delimiter tag, but we don't
+ * have a tree for that tag yet; create
+ * a tree.
+ */
+ as_tree = proto_item_add_subtree(tas,
+ ett_ipp_as);
+ attr_tree = as_tree;
+ }
+
+ switch (TAG_TYPE(tag)) {
+
+ case TAG_TYPE_INTEGER:
+ if (name_length != 0) {
+ /*
+ * This is an attribute, not
+ * an additional value, so
+ * start a tree for it.
+ */
+ attr_tree = add_integer_tree(as_tree,
+ tvb, offset, name_length,
+ value_length, tag);
+ }
+ add_integer_value(tag_desc, attr_tree, tvb,
+ offset, name_length, value_length, tag);
+ break;
+
+ case TAG_TYPE_OCTETSTRING:
+ if (name_length != 0) {
+ /*
+ * This is an attribute, not
+ * an additional value, so
+ * start a tree for it.
+ */
+ attr_tree = add_octetstring_tree(as_tree,
+ tvb, offset, name_length,
+ value_length);
+ }
+ add_octetstring_value(tag_desc, attr_tree, tvb,
+ offset, name_length, value_length);
+ break;
+
+ case TAG_TYPE_CHARSTRING:
+ if (name_length != 0) {
+ /*
+ * This is an attribute, not
+ * an additional value, so
+ * start a tree for it.
+ */
+ attr_tree = add_charstring_tree(as_tree,
+ tvb, offset, name_length,
+ value_length);
+ }
+ add_charstring_value(tag_desc, attr_tree, tvb,
+ offset, name_length, value_length);
+ break;
+ }
+ offset += 1 + 2 + name_length + 2 + value_length;
+ }
+ }
+
+ return offset;
}
static const value_string bool_vals[] = {
- { 0x00, "false" },
- { 0x01, "true" },
- { 0, NULL }
+ { 0x00, "false" },
+ { 0x01, "true" },
+ { 0, NULL }
};
static proto_tree *
add_integer_tree(proto_tree *tree, tvbuff_t *tvb, int offset,
- int name_length, int value_length, guint8 tag)
+ int name_length, int value_length, guint8 tag)
{
- proto_item *ti;
- guint8 bool_val;
-
- switch (tag) {
-
- case TAG_BOOLEAN:
- if (value_length != 1) {
- ti = proto_tree_add_text(tree, tvb, offset,
- 1 + 2 + name_length + 2 + value_length,
- "%s: Invalid boolean (length is %u, should be 1)",
- tvb_format_text(tvb, offset + 1 + 2, name_length),
- value_length);
- } else {
- bool_val = tvb_get_guint8(tvb,
- offset + 1 + 2 + name_length + 2);
- ti = proto_tree_add_text(tree, tvb, offset,
- 1 + 2 + name_length + 2 + value_length,
- "%s: %s",
- tvb_format_text(tvb, offset + 1 + 2, name_length),
- val_to_str(bool_val, bool_vals, "Unknown (0x%02x)"));
- }
- break;
-
- case TAG_INTEGER:
- case TAG_ENUM:
- if (value_length != 4) {
- ti = proto_tree_add_text(tree, tvb, offset,
- 1 + 2 + name_length + 2 + value_length,
- "%s: Invalid integer (length is %u, should be 4)",
- tvb_format_text(tvb, offset + 1 + 2, name_length),
- value_length);
- } else {
- const char *name_val;
- /* Some fields in IPP are really unix timestamps but IPP
- * transports these as 4 byte integers.
- * A simple heuristic to make the display of these fields
- * more human readable is to assume that if the field name
- * ends in '-time' then assume they are timestamps instead
- * of integers.
- */
- name_val=tvb_get_ptr(tvb, offset + 1 + 2, name_length);
- if( (name_length > 5) && name_val && !tvb_memeql(tvb, offset + 1 + 2 + name_length - 5, "-time", 5)){
- ti = proto_tree_add_text(tree, tvb, offset,
- 1 + 2 + name_length + 2 + value_length,
- "%s: %s",
- format_text(name_val, name_length),
- abs_time_secs_to_str(tvb_get_ntohl(tvb, offset + 1 + 2 + name_length + 2), ABSOLUTE_TIME_LOCAL, TRUE));
-
- }
- else if((name_length > 5) && name_val && !tvb_memeql(tvb, offset + 1 + 2, "printer-state", 13)){
- ti = proto_tree_add_text(tree, tvb, offset,
- 1 + 2 + name_length + 2 + value_length,
- "%s: %s",
- format_text(name_val, name_length),
- val_to_str(tvb_get_ntohl(tvb, offset + 1 + 2 + name_length + 2), printer_state_vals, "Unknown Printer State"));
+ proto_item *ti;
+ guint8 bool_val;
+
+ switch (tag) {
+
+ case TAG_BOOLEAN:
+ if (value_length != 1) {
+ ti = proto_tree_add_text(tree, tvb, offset,
+ 1 + 2 + name_length + 2 + value_length,
+ "%s: Invalid boolean (length is %u, should be 1)",
+ tvb_format_text(tvb, offset + 1 + 2, name_length),
+ value_length);
+ } else {
+ bool_val = tvb_get_guint8(tvb,
+ offset + 1 + 2 + name_length + 2);
+ ti = proto_tree_add_text(tree, tvb, offset,
+ 1 + 2 + name_length + 2 + value_length,
+ "%s: %s",
+ tvb_format_text(tvb, offset + 1 + 2, name_length),
+ val_to_str(bool_val, bool_vals, "Unknown (0x%02x)"));
+ }
+ break;
+
+ case TAG_INTEGER:
+ case TAG_ENUM:
+ if (value_length != 4) {
+ ti = proto_tree_add_text(tree, tvb, offset,
+ 1 + 2 + name_length + 2 + value_length,
+ "%s: Invalid integer (length is %u, should be 4)",
+ tvb_format_text(tvb, offset + 1 + 2, name_length),
+ value_length);
+ } else {
+ const char *name_val;
+ /* Some fields in IPP are really unix timestamps but IPP
+ * transports these as 4 byte integers.
+ * A simple heuristic to make the display of these fields
+ * more human readable is to assume that if the field name
+ * ends in '-time' then assume they are timestamps instead
+ * of integers.
+ */
+ name_val=tvb_get_ptr(tvb, offset + 1 + 2, name_length);
+ if ((name_length > 5) && name_val && !tvb_memeql(tvb, offset + 1 + 2 + name_length - 5, "-time", 5)) {
+ ti = proto_tree_add_text(tree, tvb, offset,
+ 1 + 2 + name_length + 2 + value_length,
+ "%s: %s",
+ format_text(name_val, name_length),
+ abs_time_secs_to_str(tvb_get_ntohl(tvb, offset + 1 + 2 + name_length + 2),
+ ABSOLUTE_TIME_LOCAL,
+ TRUE));
+
}
- else if((name_length > 5) && name_val && !tvb_memeql(tvb, offset + 1 + 2, "job-state", 9)){
- ti = proto_tree_add_text(tree, tvb, offset,
- 1 + 2 + name_length + 2 + value_length,
- "%s: %s",
- format_text(name_val, name_length),
- val_to_str(tvb_get_ntohl(tvb, offset + 1 + 2 + name_length + 2), job_state_vals, "Unknown Job State"));
+ else if ((name_length > 5) && name_val && !tvb_memeql(tvb, offset + 1 + 2, "printer-state", 13)) {
+ ti = proto_tree_add_text(tree, tvb, offset,
+ 1 + 2 + name_length + 2 + value_length,
+ "%s: %s",
+ format_text(name_val, name_length),
+ val_to_str(tvb_get_ntohl(tvb, offset + 1 + 2 + name_length + 2),
+ printer_state_vals,
+ "Unknown Printer State"));
+ }
+ else if ((name_length > 5) && name_val && !tvb_memeql(tvb, offset + 1 + 2, "job-state", 9)) {
+ ti = proto_tree_add_text(tree, tvb, offset,
+ 1 + 2 + name_length + 2 + value_length,
+ "%s: %s",
+ format_text(name_val, name_length),
+ val_to_str(tvb_get_ntohl(tvb, offset + 1 + 2 + name_length + 2),
+ job_state_vals,
+ "Unknown Job State"));
}
else {
- ti = proto_tree_add_text(tree, tvb, offset,
- 1 + 2 + name_length + 2 + value_length,
- "%s: %u",
- format_text(name_val, name_length),
- tvb_get_ntohl(tvb, offset + 1 + 2 + name_length + 2));
- }
- }
- break;
-
- default:
- ti = proto_tree_add_text(tree, tvb, offset,
- 1 + 2 + name_length + 2 + value_length,
- "%s: Unknown integer type 0x%02x",
- tvb_format_text(tvb, offset + 1 + 2, name_length),
- tag);
- break;
- }
- return proto_item_add_subtree(ti, ett_ipp_attr);
+ ti = proto_tree_add_text(tree, tvb, offset,
+ 1 + 2 + name_length + 2 + value_length,
+ "%s: %u",
+ format_text(name_val, name_length),
+ tvb_get_ntohl(tvb, offset + 1 + 2 + name_length + 2));
+ }
+ }
+ break;
+
+ default:
+ ti = proto_tree_add_text(tree, tvb, offset,
+ 1 + 2 + name_length + 2 + value_length,
+ "%s: Unknown integer type 0x%02x",
+ tvb_format_text(tvb, offset + 1 + 2, name_length),
+ tag);
+ break;
+ }
+ return proto_item_add_subtree(ti, ett_ipp_attr);
}
static void
add_integer_value(const gchar *tag_desc, proto_tree *tree, tvbuff_t *tvb,
- int offset, int name_length, int value_length, guint8 tag)
+ int offset, int name_length, int value_length, guint8 tag)
{
- guint8 bool_val;
- char *name_val;
-
- offset = add_value_head(tag_desc, tree, tvb, offset, name_length,
- value_length, &name_val);
-
- switch (tag) {
-
- case TAG_BOOLEAN:
- if (value_length == 1) {
- bool_val = tvb_get_guint8(tvb, offset);
- proto_tree_add_text(tree, tvb, offset, value_length,
- "Value: %s",
- val_to_str(bool_val, bool_vals, "Unknown (0x%02x)"));
- }
- break;
-
- case TAG_INTEGER:
- case TAG_ENUM:
- /* Some fields in IPP are really unix timestamps but IPP
- * transports these as 4 byte integers.
- * A simple heuristic to make the display of these fields
- * more human readable is to assume that if the field name
- * ends in '-time' then assume they are timestamps instead
- * of integers.
- */
- if (value_length == 4) {
- if( (name_length > 5) && name_val && !strcmp(name_val+name_length-5, "-time")){
- nstime_t ns;
-
- ns.secs=tvb_get_ntohl(tvb, offset);
- ns.nsecs=0;
- proto_tree_add_time(tree, hf_ipp_timestamp, tvb, offset, 4, &ns);
- }
- else if((name_length > 5) && name_val && !strcmp(name_val, "printer-state")){
+ guint8 bool_val;
+ char *name_val;
+
+ offset = add_value_head(tag_desc, tree, tvb, offset, name_length,
+ value_length, &name_val);
+
+ switch (tag) {
+
+ case TAG_BOOLEAN:
+ if (value_length == 1) {
+ bool_val = tvb_get_guint8(tvb, offset);
+ proto_tree_add_text(tree, tvb, offset, value_length,
+ "Value: %s",
+ val_to_str(bool_val, bool_vals, "Unknown (0x%02x)"));
+ }
+ break;
+
+ case TAG_INTEGER:
+ case TAG_ENUM:
+ /* Some fields in IPP are really unix timestamps but IPP
+ * transports these as 4 byte integers.
+ * A simple heuristic to make the display of these fields
+ * more human readable is to assume that if the field name
+ * ends in '-time' then assume they are timestamps instead
+ * of integers.
+ */
+ if (value_length == 4) {
+ if ((name_length > 5) && name_val && !strcmp(name_val+name_length-5, "-time")) {
+ nstime_t ns;
+
+ ns.secs=tvb_get_ntohl(tvb, offset);
+ ns.nsecs=0;
+ proto_tree_add_time(tree, hf_ipp_timestamp, tvb, offset, 4, &ns);
+ }
+ else if ((name_length > 5) && name_val && !strcmp(name_val, "printer-state")) {
guint32 printer_state_reason;
printer_state_reason = tvb_get_ntohl(tvb, offset);
- proto_tree_add_text(tree, tvb, offset, value_length, "Value: %s (%u)", val_to_str(printer_state_reason, printer_state_vals, "Unknown Printer State (0x%02x)"), printer_state_reason);
+ proto_tree_add_text(tree, tvb, offset, value_length,
+ "Value: %s (%u)",
+ val_to_str(printer_state_reason, printer_state_vals,
+ "Unknown Printer State (0x%02x)"), printer_state_reason);
}
- else if((name_length > 5) && name_val && !strcmp(name_val, "job-state")){
+ else if ((name_length > 5) && name_val && !strcmp(name_val, "job-state")) {
guint32 job_state_reason;
job_state_reason = tvb_get_ntohl(tvb, offset);
- proto_tree_add_text(tree, tvb, offset, value_length, "Value: %s (%u)", val_to_str(job_state_reason, job_state_vals, "Unknown Job State (0x%02x)"), job_state_reason);
+ proto_tree_add_text(tree, tvb, offset, value_length,
+ "Value: %s (%u)",
+ val_to_str(job_state_reason, job_state_vals,
+ "Unknown Job State (0x%02x)"), job_state_reason);
}
else{
- proto_tree_add_text(tree, tvb, offset, value_length,
- "Value: %u", tvb_get_ntohl(tvb, offset));
- }
- }
- break;
- }
+ proto_tree_add_text(tree, tvb, offset, value_length,
+ "Value: %u", tvb_get_ntohl(tvb, offset));
+ }
+ }
+ break;
+ }
}
static proto_tree *
add_octetstring_tree(proto_tree *tree, tvbuff_t *tvb, int offset,
- int name_length, int value_length)
+ int name_length, int value_length)
{
- proto_item *ti;
-
- ti = proto_tree_add_text(tree, tvb, offset,
- 1 + 2 + name_length + 2 + value_length,
- "%s: %s",
- tvb_format_text(tvb, offset + 1 + 2, name_length),
- tvb_bytes_to_str(tvb, offset + 1 + 2 + name_length + 2, value_length));
- return proto_item_add_subtree(ti, ett_ipp_attr);
+ proto_item *ti;
+
+ ti = proto_tree_add_text(tree, tvb, offset,
+ 1 + 2 + name_length + 2 + value_length,
+ "%s: %s",
+ tvb_format_text(tvb, offset + 1 + 2, name_length),
+ tvb_bytes_to_str(tvb, offset + 1 + 2 + name_length + 2, value_length));
+ return proto_item_add_subtree(ti, ett_ipp_attr);
}
static void
add_octetstring_value(const gchar *tag_desc, proto_tree *tree, tvbuff_t *tvb,
- int offset, int name_length, int value_length)
+ int offset, int name_length, int value_length)
{
- offset = add_value_head(tag_desc, tree, tvb, offset, name_length,
- value_length, NULL);
- proto_tree_add_text(tree, tvb, offset, value_length,
- "Value: %s", tvb_bytes_to_str(tvb, offset, value_length));
+ offset = add_value_head(tag_desc, tree, tvb, offset, name_length,
+ value_length, NULL);
+ proto_tree_add_text(tree, tvb, offset, value_length,
+ "Value: %s", tvb_bytes_to_str(tvb, offset, value_length));
}
static proto_tree *
add_charstring_tree(proto_tree *tree, tvbuff_t *tvb, int offset,
- int name_length, int value_length)
+ int name_length, int value_length)
{
- proto_item *ti;
-
- ti = proto_tree_add_text(tree, tvb, offset,
- 1 + 2 + name_length + 2 + value_length,
- "%s: %s",
- tvb_format_text(tvb, offset + 1 + 2, name_length),
- tvb_format_text(tvb, offset + 1 + 2 + name_length + 2, value_length));
- return proto_item_add_subtree(ti, ett_ipp_attr);
+ proto_item *ti;
+
+ ti = proto_tree_add_text(tree, tvb, offset,
+ 1 + 2 + name_length + 2 + value_length,
+ "%s: %s",
+ tvb_format_text(tvb, offset + 1 + 2, name_length),
+ tvb_format_text(tvb, offset + 1 + 2 + name_length + 2, value_length));
+ return proto_item_add_subtree(ti, ett_ipp_attr);
}
static void
add_charstring_value(const gchar *tag_desc, proto_tree *tree, tvbuff_t *tvb,
- int offset, int name_length, int value_length)
+ int offset, int name_length, int value_length)
{
- offset = add_value_head(tag_desc, tree, tvb, offset, name_length,
- value_length, NULL);
- proto_tree_add_text(tree, tvb, offset, value_length,
- "Value: %s", tvb_format_text(tvb, offset, value_length));
+ offset = add_value_head(tag_desc, tree, tvb, offset, name_length,
+ value_length, NULL);
+ proto_tree_add_text(tree, tvb, offset, value_length,
+ "Value: %s", tvb_format_text(tvb, offset, value_length));
}
/* If name_val is !NULL then return the pointer to an emem allocated string in
@@ -658,59 +667,59 @@ add_charstring_value(const gchar *tag_desc, proto_tree *tree, tvbuff_t *tvb,
*/
static int
add_value_head(const gchar *tag_desc, proto_tree *tree, tvbuff_t *tvb,
- int offset, int name_length, int value_length, char **name_val)
+ int offset, int name_length, int value_length, char **name_val)
{
- proto_tree_add_text(tree, tvb, offset, 1, "Tag: %s", tag_desc);
- offset += 1;
- proto_tree_add_text(tree, tvb, offset, 2, "Name length: %u",
- name_length);
- offset += 2;
- if (name_length != 0) {
- guint8 *nv;
- nv = tvb_get_ephemeral_string(tvb, offset, name_length);
- proto_tree_add_text(tree, tvb, offset, name_length,
- "Name: %s", format_text(nv, name_length));
- if(name_val){
- *name_val=nv;
- }
- }
- offset += name_length;
- proto_tree_add_text(tree, tvb, offset, 2, "Value length: %u",
- value_length);
- offset += 2;
- return offset;
+ proto_tree_add_text(tree, tvb, offset, 1, "Tag: %s", tag_desc);
+ offset += 1;
+ proto_tree_add_text(tree, tvb, offset, 2, "Name length: %u",
+ name_length);
+ offset += 2;
+ if (name_length != 0) {
+ guint8 *nv;
+ nv = tvb_get_ephemeral_string(tvb, offset, name_length);
+ proto_tree_add_text(tree, tvb, offset, name_length,
+ "Name: %s", format_text(nv, name_length));
+ if (name_val) {
+ *name_val=nv;
+ }
+ }
+ offset += name_length;
+ proto_tree_add_text(tree, tvb, offset, 2, "Value length: %u",
+ value_length);
+ offset += 2;
+ return offset;
}
void
proto_register_ipp(void)
{
- static hf_register_info hf[] = {
- { &hf_ipp_timestamp,
- { "Time", "ipp.timestamp", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL,
- NULL, 0, NULL, HFILL }},
- };
- static gint *ett[] = {
- &ett_ipp,
- &ett_ipp_as,
- &ett_ipp_attr,
- };
-
- proto_ipp = proto_register_protocol("Internet Printing Protocol",
- "IPP", "ipp");
- proto_register_field_array(proto_ipp, hf, array_length(hf));
- proto_register_subtree_array(ett, array_length(ett));
+ static hf_register_info hf[] = {
+ { &hf_ipp_timestamp,
+ { "Time", "ipp.timestamp", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL,
+ NULL, 0, NULL, HFILL }},
+ };
+ static gint *ett[] = {
+ &ett_ipp,
+ &ett_ipp_as,
+ &ett_ipp_attr,
+ };
+
+ proto_ipp = proto_register_protocol("Internet Printing Protocol",
+ "IPP", "ipp");
+ proto_register_field_array(proto_ipp, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
}
void
proto_reg_handoff_ipp(void)
{
- dissector_handle_t ipp_handle;
-
- /*
- * Register ourselves as running atop HTTP and using port 631.
- */
- ipp_handle = create_dissector_handle(dissect_ipp, proto_ipp);
- http_dissector_add(631, ipp_handle);
- dissector_add_string("media_type", "application/ipp", ipp_handle);
- data_handle = find_dissector("data");
+ dissector_handle_t ipp_handle;
+
+ /*
+ * Register ourselves as running atop HTTP and using port 631.
+ */
+ ipp_handle = create_dissector_handle(dissect_ipp, proto_ipp);
+ http_dissector_add(631, ipp_handle);
+ dissector_add_string("media_type", "application/ipp", ipp_handle);
+ data_handle = find_dissector("data");
}
diff --git a/epan/dissectors/packet-kerberos.c b/epan/dissectors/packet-kerberos.c
index 7269ca9604..6947a45a37 100644
--- a/epan/dissectors/packet-kerberos.c
+++ b/epan/dissectors/packet-kerberos.c
@@ -65,8 +65,8 @@
#include <stdio.h>
#include <string.h>
+
#include <glib.h>
-#include <ctype.h>
#ifdef HAVE_LIBNETTLE
#define HAVE_KERBEROS
diff --git a/epan/dissectors/packet-l1-events.c b/epan/dissectors/packet-l1-events.c
index 43e3d16fec..cd3bd56eb5 100644
--- a/epan/dissectors/packet-l1-events.c
+++ b/epan/dissectors/packet-l1-events.c
@@ -33,9 +33,8 @@
#include "config.h"
#endif
-#include <ctype.h>
-
#include <glib.h>
+
#include <epan/packet.h>
#include <epan/strutil.h>
diff --git a/epan/dissectors/packet-memcache.c b/epan/dissectors/packet-memcache.c
index 173db03793..10becaf900 100644
--- a/epan/dissectors/packet-memcache.c
+++ b/epan/dissectors/packet-memcache.c
@@ -37,11 +37,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <ctype.h>
+
#include <glib.h>
-#include <epan/conversation.h>
#include <epan/packet.h>
+#include <epan/conversation.h>
#include <epan/strutil.h>
#include <epan/base64.h>
#include <epan/emem.h>
diff --git a/epan/dissectors/packet-osi.c b/epan/dissectors/packet-osi.c
index a302d75038..5cb6739b86 100644
--- a/epan/dissectors/packet-osi.c
+++ b/epan/dissectors/packet-osi.c
@@ -29,10 +29,10 @@
# include "config.h"
#endif
-#include <ctype.h>
#include <glib.h>
-#include <epan/prefs.h>
+
#include <epan/packet.h>
+#include <epan/prefs.h>
#include <epan/llcsaps.h>
#include <epan/aftypes.h>
#include <epan/nlpid.h>
@@ -54,12 +54,12 @@ static guint global_tcp_port_osi_over_tpkt = 0;
cksum_status_t
calc_checksum( tvbuff_t *tvb, int offset, guint len, guint checksum) {
- const gchar *buffer;
- guint available_len;
+ const gchar *buffer;
+ guint available_len;
const guint8 *p;
- guint32 c0, c1;
- guint seglen;
- guint i;
+ guint32 c0, c1;
+ guint seglen;
+ guint i;
if ( 0 == checksum )
return( NO_CKSUM );
@@ -99,7 +99,7 @@ calc_checksum( tvbuff_t *tvb, int offset, guint len, guint checksum) {
len -= seglen;
}
if (c0 != 0 || c1 != 0)
- return( CKSUM_NOT_OK ); /* XXX - what should the checksum field be? */
+ return( CKSUM_NOT_OK ); /* XXX - what should the checksum field be? */
else
return( CKSUM_OK );
}
@@ -107,14 +107,14 @@ calc_checksum( tvbuff_t *tvb, int offset, guint len, guint checksum) {
cksum_status_t
check_and_get_checksum( tvbuff_t *tvb, int offset, guint len, guint checksum, int offset_check, guint16* result) {
- const gchar *buffer;
- guint available_len;
+ const gchar *buffer;
+ guint available_len;
const guint8 *p;
- guint8 discard = 0;
- guint32 c0, c1, factor;
- guint seglen, initlen = len;
- guint i;
- int block, x, y;
+ guint8 discard = 0;
+ guint32 c0, c1, factor;
+ guint seglen, initlen = len;
+ guint i;
+ int block, x, y;
if ( 0 == checksum )
return( NO_CKSUM );
@@ -191,7 +191,7 @@ check_and_get_checksum( tvbuff_t *tvb, int offset, guint len, guint checksum, in
*result = ( x << 8 ) | ( y & 0xFF );
if (*result != checksum)
- return( CKSUM_NOT_OK ); /* XXX - what should the checksum field be? */
+ return( CKSUM_NOT_OK ); /* XXX - what should the checksum field be? */
else
return( CKSUM_OK );
}
@@ -209,26 +209,26 @@ check_and_get_checksum( tvbuff_t *tvb, int offset, guint len, guint checksum, in
* means T.70 for an IPI and X.29 for an SPI.
*/
const value_string nlpid_vals[] = {
- { NLPID_NULL, "NULL" },
- { NLPID_SPI_X_29, "X.29" },
- { NLPID_X_633, "X.633" },
- { NLPID_Q_931, "Q.931" },
- { NLPID_Q_2931, "Q.2931" },
- { NLPID_Q_2119, "Q.2119" },
- { NLPID_SNAP, "SNAP" },
- { NLPID_ISO8473_CLNP, "CLNP" },
- { NLPID_ISO9542_ESIS, "ESIS" },
- { NLPID_ISO10589_ISIS, "ISIS" },
- { NLPID_ISO10747_IDRP, "IDRP" },
- { NLPID_ISO9542X25_ESIS, "ESIS (X.25)" },
- { NLPID_ISO10030, "ISO 10030" },
- { NLPID_ISO11577, "ISO 11577" },
- { NLPID_COMPRESSED, "Data compression protocol" },
- { NLPID_IP, "IP" },
- { NLPID_SNDCF, "SubNetwork Dependent Convergence Function"},
- { NLPID_IP6, "IPv6" },
- { NLPID_PPP, "PPP" },
- { 0, NULL },
+ { NLPID_NULL, "NULL" },
+ { NLPID_SPI_X_29, "X.29" },
+ { NLPID_X_633, "X.633" },
+ { NLPID_Q_931, "Q.931" },
+ { NLPID_Q_2931, "Q.2931" },
+ { NLPID_Q_2119, "Q.2119" },
+ { NLPID_SNAP, "SNAP" },
+ { NLPID_ISO8473_CLNP, "CLNP" },
+ { NLPID_ISO9542_ESIS, "ESIS" },
+ { NLPID_ISO10589_ISIS, "ISIS" },
+ { NLPID_ISO10747_IDRP, "IDRP" },
+ { NLPID_ISO9542X25_ESIS, "ESIS (X.25)" },
+ { NLPID_ISO10030, "ISO 10030" },
+ { NLPID_ISO11577, "ISO 11577" },
+ { NLPID_COMPRESSED, "Data compression protocol" },
+ { NLPID_IP, "IP" },
+ { NLPID_SNDCF, "SubNetwork Dependent Convergence Function"},
+ { NLPID_IP6, "IPv6" },
+ { NLPID_PPP, "PPP" },
+ { 0, NULL },
};
static dissector_table_t osinl_subdissector_table;
@@ -244,7 +244,7 @@ dissect_osi_tpkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
static void dissect_osi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- guint8 nlpid;
+ guint8 nlpid;
tvbuff_t *new_tvb;
pinfo->current_proto = "OSI";
@@ -274,7 +274,7 @@ static void dissect_osi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
default:
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ISO");
if (check_col(pinfo->cinfo, COL_INFO)) {
- col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown ISO protocol (%02x)", nlpid);
+ col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown ISO protocol (%02x)", nlpid);
}
call_dissector(data_handle,tvb, pinfo, tree);
break;
@@ -284,9 +284,9 @@ static void dissect_osi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
void
proto_reg_handoff_osi(void)
{
- static gboolean osi_prefs_initialized = FALSE;
+ static gboolean osi_prefs_initialized = FALSE;
static dissector_handle_t osi_tpkt_handle;
- static guint tcp_port_osi_over_tpkt;
+ static guint tcp_port_osi_over_tpkt;
if (!osi_prefs_initialized) {
osi_handle = create_dissector_handle(dissect_osi, proto_osi);
@@ -299,10 +299,10 @@ proto_reg_handoff_osi(void)
dissector_add_uint("chdlctype", CHDLCTYPE_OSI, osi_handle);
dissector_add_uint("null.type", BSD_AF_ISO, osi_handle);
dissector_add_uint("gre.proto", SAP_OSINL5, osi_handle);
- dissector_add_uint("ip.proto", IP_PROTO_ISOIP, osi_handle); /* ISO-TP4 ISO Transport Protocol Class 4 [RFC905,RC77] */
+ dissector_add_uint("ip.proto", IP_PROTO_ISOIP, osi_handle); /* ISO-TP4 ISO Transport Protocol Class 4 [RFC905,RC77] */
data_handle = find_dissector("data");
ppp_handle = find_dissector("ppp");
-
+
osi_tpkt_handle = create_dissector_handle(dissect_osi_tpkt, proto_osi);
dissector_add_handle("tcp.port", osi_tpkt_handle); /* for 'decode-as' */
@@ -338,7 +338,7 @@ proto_register_osi(void)
* (typically non OSI protocols like IP,IPv6,PPP */
osinl_excl_subdissector_table = register_dissector_table("osinl.excl",
"OSI excl NLPID", FT_UINT8, BASE_HEX);
-
+
proto_osi = proto_register_protocol("OSI", "OSI", "osi");
/* Preferences how OSI protocols should be dissected */
osi_module = prefs_register_protocol(proto_osi, proto_reg_handoff_osi);
diff --git a/epan/dissectors/packet-rfid-felica.c b/epan/dissectors/packet-rfid-felica.c
index 2a45decc58..4082d5dda1 100644
--- a/epan/dissectors/packet-rfid-felica.c
+++ b/epan/dissectors/packet-rfid-felica.c
@@ -36,10 +36,9 @@
#endif
#include <glib.h>
+
#include <epan/packet.h>
#include <epan/strutil.h>
-#include <ctype.h>
-#include <stdio.h>
static int proto_felica = -1;
@@ -118,8 +117,8 @@ static int hf_felica_status_flag2 = -1;
* val_to_str_const(opcode, felica_opcodes, "Unknown"));
*/
static const value_string felica_commands[] = {
- {CMD_POLLING, "Polling"},
- {CMD_READ_WO_ENCRYPTION, "Read Without Encryption"},
+ {CMD_POLLING, "Polling"},
+ {CMD_READ_WO_ENCRYPTION, "Read Without Encryption"},
{CMD_WRITE_WO_ENCRYPTION, "Write Without Encryption"},
/* End of commands */
@@ -127,8 +126,8 @@ static const value_string felica_commands[] = {
};
static const value_string felica_responses[] = {
- {RES_POLLING, "Polling"},
- {RES_READ_WO_ENCRYPTION, "Read Without Encryption"},
+ {RES_POLLING, "Polling"},
+ {RES_READ_WO_ENCRYPTION, "Read Without Encryption"},
{RES_WRITE_WO_ENCRYPTION, "Write Without Encryption"},
/* End of responses */
@@ -136,8 +135,8 @@ static const value_string felica_responses[] = {
};
static const value_string felica_req_codes[] = {
- {RC_NO_REQ, "No Request"},
- {RC_SYS_REQ, "System Code Request"},
+ {RC_NO_REQ, "No Request"},
+ {RC_SYS_REQ, "System Code Request"},
{RC_COM_PERF_REQ, "Communication Performance Request"},
/* Others are reserved for future use */
@@ -147,11 +146,11 @@ static const value_string felica_req_codes[] = {
};
static const value_string felica_sys_codes[] = {
- {SC_FELICA_LITE, "FeliCa Lite"},
- {SC_NFC_FORUM, "NFC Forum (NDEF)"},
+ {SC_FELICA_LITE, "FeliCa Lite"},
+ {SC_NFC_FORUM, "NFC Forum (NDEF)"},
{SC_FELICA_NW_COMMON_AREA, "FeliCa Networks Common Area"},
- {SC_IRUCA, "IruCa"},
- {SC_DOUBLE_WILDCARD, "Wildcard"},
+ {SC_IRUCA, "IruCa"},
+ {SC_DOUBLE_WILDCARD, "Wildcard"},
/* End of system codes */
{0x00, NULL}
@@ -169,9 +168,9 @@ static void dissect_felica(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_item *item;
proto_tree *felica_tree = NULL;
- guint8 opcode;
- guint8 rwe_pos = 0;
- tvbuff_t *rwe_resp_data_tvb;
+ guint8 opcode;
+ guint8 rwe_pos = 0;
+ tvbuff_t *rwe_resp_data_tvb;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "FeliCa");
col_set_str(pinfo->cinfo, COL_INFO, "FeliCa Packet");
@@ -188,7 +187,7 @@ static void dissect_felica(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case CMD_POLLING:
col_set_str(pinfo->cinfo, COL_INFO, "Polling Request");
if (tree) {
- proto_tree_add_item(felica_tree, hf_felica_command, tvb, 0, 1, ENC_NA);
+ proto_tree_add_item(felica_tree, hf_felica_command, tvb, 0, 1, ENC_NA);
proto_tree_add_item(felica_tree, hf_felica_sys_code, tvb, 1, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(felica_tree, hf_felica_req_code, tvb, 3, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(felica_tree, hf_felica_timeslot, tvb, 4, 1, ENC_BIG_ENDIAN);
@@ -199,8 +198,8 @@ static void dissect_felica(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_str(pinfo->cinfo, COL_INFO, "Polling Response");
if (tree) {
proto_tree_add_item(felica_tree, hf_felica_response, tvb, 0, 1, ENC_NA);
- proto_tree_add_item(felica_tree, hf_felica_idm, tvb, 1, 8, ENC_BIG_ENDIAN);
- proto_tree_add_item(felica_tree, hf_felica_pnm, tvb, 9, 8, ENC_BIG_ENDIAN);
+ proto_tree_add_item(felica_tree, hf_felica_idm, tvb, 1, 8, ENC_BIG_ENDIAN);
+ proto_tree_add_item(felica_tree, hf_felica_pnm, tvb, 9, 8, ENC_BIG_ENDIAN);
if (tvb_reported_length(tvb) == 19)
proto_tree_add_item(felica_tree, hf_felica_sys_code, tvb, 17, 2, ENC_BIG_ENDIAN);
@@ -216,8 +215,8 @@ static void dissect_felica(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case CMD_READ_WO_ENCRYPTION:
col_set_str(pinfo->cinfo, COL_INFO, "Read Without Encryption Request");
if (tree) {
- proto_tree_add_item(felica_tree, hf_felica_command, tvb, 0, 1, ENC_NA);
- proto_tree_add_item(felica_tree, hf_felica_idm, tvb, 1, 8, ENC_BIG_ENDIAN);
+ proto_tree_add_item(felica_tree, hf_felica_command, tvb, 0, 1, ENC_NA);
+ proto_tree_add_item(felica_tree, hf_felica_idm, tvb, 1, 8, ENC_BIG_ENDIAN);
proto_tree_add_item(felica_tree, hf_felica_nbr_of_svcs, tvb, 9, 1, ENC_BIG_ENDIAN);
/* Service codes are always 2 bytes in length */
@@ -239,10 +238,10 @@ static void dissect_felica(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case RES_READ_WO_ENCRYPTION:
col_set_str(pinfo->cinfo, COL_INFO, "Read Without Encryption Response");
if (tree) {
- proto_tree_add_item(felica_tree, hf_felica_response, tvb, 0, 1, ENC_NA);
- proto_tree_add_item(felica_tree, hf_felica_idm, tvb, 1, 8, ENC_BIG_ENDIAN);
- proto_tree_add_item(felica_tree, hf_felica_status_flag1, tvb, 9, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(felica_tree, hf_felica_status_flag2, tvb, 10, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(felica_tree, hf_felica_response, tvb, 0, 1, ENC_NA);
+ proto_tree_add_item(felica_tree, hf_felica_idm, tvb, 1, 8, ENC_BIG_ENDIAN);
+ proto_tree_add_item(felica_tree, hf_felica_status_flag1, tvb, 9, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(felica_tree, hf_felica_status_flag2, tvb, 10, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(felica_tree, hf_felica_nbr_of_blocks, tvb, 11, 1, ENC_BIG_ENDIAN);
}
rwe_resp_data_tvb = tvb_new_subset_remaining(tvb, 12);
@@ -271,65 +270,92 @@ proto_register_felica(void)
static hf_register_info hf[] = {
{&hf_felica_command,
- { "Command", "felica.cmd", FT_UINT8, BASE_HEX,
- VALS(felica_commands), 0x0, NULL, HFILL }},
+ { "Command", "felica.cmd",
+ FT_UINT8, BASE_HEX, VALS(felica_commands), 0x0,
+ NULL, HFILL }
+ },
{&hf_felica_response,
- { "Response", "felica.res", FT_UINT8, BASE_HEX,
- VALS(felica_responses), 0x0, NULL, HFILL }},
+ { "Response", "felica.res",
+ FT_UINT8, BASE_HEX,
+ VALS(felica_responses), 0x0,
+ NULL, HFILL }
+ },
/* Request Code */
{&hf_felica_req_code,
- { "Request Code", "felica.req.code", FT_UINT8, BASE_HEX,
- VALS(felica_req_codes), 0x0, NULL, HFILL }},
+ { "Request Code", "felica.req.code",
+ FT_UINT8, BASE_HEX, VALS(felica_req_codes), 0x0,
+ NULL, HFILL }
+ },
{&hf_felica_idm,
- { "IDm (Manufacture ID)/NFCID2", "felica.idm", FT_UINT64, BASE_HEX,
- NULL, 0x0, NULL, HFILL }},
+ { "IDm (Manufacture ID)/NFCID2", "felica.idm",
+ FT_UINT64, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }
+ },
/* System Code */
{&hf_felica_sys_code,
- { "System Code", "felica.sys_code", FT_UINT16, BASE_HEX,
- VALS(felica_sys_codes), 0x0, NULL, HFILL }},
+ { "System Code", "felica.sys_code",
+ FT_UINT16, BASE_HEX, VALS(felica_sys_codes), 0x0,
+ NULL, HFILL }
+ },
/* Service Code */
{&hf_felica_svc_code,
- { "Service Code", "felica.svc_code", FT_UINT16, BASE_HEX,
- NULL, 0x0, NULL, HFILL }},
+ { "Service Code", "felica.svc_code",
+ FT_UINT16, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }
+ },
/* Parameter/PAD */
{&hf_felica_pnm,
- { "PNm (Manufacture Parameter)/PAD", "felica.pnm", FT_UINT64, BASE_HEX,
- NULL, 0x0, NULL, HFILL }},
+ { "PNm (Manufacture Parameter)/PAD", "felica.pnm",
+ FT_UINT64, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }
+ },
/* Number of Services */
{&hf_felica_nbr_of_svcs,
- { "Number of Services", "felica.svcs", FT_UINT8, BASE_DEC,
- NULL, 0x0, NULL, HFILL }},
+ { "Number of Services", "felica.svcs",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
/* Number of Blocks */
{&hf_felica_nbr_of_blocks,
- { "Number of Blocks", "felica.blocks", FT_UINT8, BASE_DEC,
- NULL, 0x0, NULL, HFILL }},
+ { "Number of Blocks", "felica.blocks",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
/* Block ID */
{&hf_felica_block_nbr,
- { "Block Number", "felica.block.nbr", FT_UINT8, BASE_DEC,
- NULL, 0x0, NULL, HFILL }},
+ { "Block Number", "felica.block.nbr",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }
+ },
/* Status Flag 1 */
{&hf_felica_status_flag1,
- { "Status Flag 1", "felica.status.flag1", FT_UINT8, BASE_HEX,
- NULL, 0x0, NULL, HFILL }},
+ { "Status Flag 1", "felica.status.flag1",
+ FT_UINT8, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }
+ },
/* Status Flag 2 */
{&hf_felica_status_flag2,
- { "Status Flag 2", "felica.status.flag2", FT_UINT8, BASE_HEX,
- NULL, 0x0, NULL, HFILL }},
+ { "Status Flag 2", "felica.status.flag2",
+ FT_UINT8, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }
+ },
/* Timeslot */
{&hf_felica_timeslot,
- { "Timeslot", "felica.timeslot", FT_UINT8, BASE_HEX,
- NULL, 0x0, NULL, HFILL }}
+ { "Timeslot", "felica.timeslot",
+ FT_UINT8, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }
+ }
};
static gint *ett[] = {
diff --git a/epan/dissectors/packet-rpc.c b/epan/dissectors/packet-rpc.c
index e50aeefd44..ba20c65b15 100644
--- a/epan/dissectors/packet-rpc.c
+++ b/epan/dissectors/packet-rpc.c
@@ -30,8 +30,9 @@
#endif
#include <glib.h>
+
#include <string.h>
-#include <ctype.h>
+
#include <epan/packet.h>
#include <epan/conversation.h>
#include <epan/emem.h>
diff --git a/epan/dissectors/packet-smb-browse.c b/epan/dissectors/packet-smb-browse.c
index 361e4f0946..1b924d548e 100644
--- a/epan/dissectors/packet-smb-browse.c
+++ b/epan/dissectors/packet-smb-browse.c
@@ -29,12 +29,12 @@
# include "config.h"
#endif
-#include <time.h>
+#include <string.h>
+
#include <glib.h>
-#include <ctype.h>
+
#include <epan/packet.h>
#include <epan/dissectors/packet-smb.h>
-#include <string.h>
#include "packet-smb-browse.h"
#include "packet-dcerpc.h"
diff --git a/epan/dissectors/packet-text-media.c b/epan/dissectors/packet-text-media.c
index b8d600777d..13ed2aaffb 100644
--- a/epan/dissectors/packet-text-media.c
+++ b/epan/dissectors/packet-text-media.c
@@ -36,9 +36,8 @@
#include "config.h"
#endif
-#include <ctype.h>
-
#include <glib.h>
+
#include <epan/packet.h>
#include <epan/strutil.h>
diff --git a/epan/dissectors/packet-ucp.c b/epan/dissectors/packet-ucp.c
index 380da34058..bac62dee18 100644
--- a/epan/dissectors/packet-ucp.c
+++ b/epan/dissectors/packet-ucp.c
@@ -37,10 +37,7 @@
# include "config.h"
#endif
-#include <stdio.h>
#include <stdlib.h>
-#include <ctype.h>
-#include <time.h>
#include <glib.h>
@@ -804,17 +801,19 @@ ucp_handle_string(proto_tree *tree, tvbuff_t *tvb, int field, int *offset)
*offset += 1; /* skip terminating '/' */
}
+#define UCP_BUFSIZ 512
+
static void
ucp_handle_IRAstring(proto_tree *tree, tvbuff_t *tvb, int field, int *offset)
{
- char strval[BUFSIZ + 1],
+ char strval[UCP_BUFSIZ + 1],
*p_dst = strval;
guint8 byte;
int idx = 0;
int tmpoff = *offset;
while (((byte = tvb_get_guint8(tvb, tmpoff++)) != '/') &&
- (idx < BUFSIZ))
+ (idx < UCP_BUFSIZ))
{
if (byte >= '0' && byte <= '9')
{
@@ -839,7 +838,7 @@ ucp_handle_IRAstring(proto_tree *tree, tvbuff_t *tvb, int field, int *offset)
idx++;
}
strval[idx] = '\0';
- if (idx == BUFSIZ)
+ if (idx == UCP_BUFSIZ)
{
/*
* Data clipped, eat rest of field
@@ -1664,7 +1663,7 @@ add_5xO(proto_tree *tree, tvbuff_t *tvb)
;
if ((tmpoff - offset) > 1) {
int len = tmpoff - offset - 1;
- proto_tree *subtree;
+ proto_tree *subtree;
ti = proto_tree_add_item(tree, hf_ucp_parm_XSer, tvb, offset, len, ENC_NA);
tmptvb = tvb_new_subset(tvb, offset, len + 1, len + 1);
@@ -2777,7 +2776,7 @@ proto_reg_handoff_ucp(void)
heur_dissector_add("tcp", dissect_ucp_heur, proto_ucp);
/*
- * Also register as a dissectoir that can be selected by a TCP port number via "decode as".
+ * Also register as a dissector that can be selected by a TCP port number via "decode as".
*/
ucp_handle = create_dissector_handle(dissect_ucp_tcp, proto_ucp);
dissector_add_handle("tcp.port", ucp_handle);