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
This commit is contained in:
Bill Meier 2012-05-15 20:57:21 +00:00
parent d5aa739fd0
commit b869cb0bc5
11 changed files with 777 additions and 745 deletions

View File

@ -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;

File diff suppressed because it is too large Load Diff

View File

@ -65,8 +65,8 @@
#include <stdio.h>
#include <string.h>
#include <glib.h>
#include <ctype.h>
#ifdef HAVE_LIBNETTLE
#define HAVE_KERBEROS

View File

@ -33,9 +33,8 @@
#include "config.h"
#endif
#include <ctype.h>
#include <glib.h>
#include <epan/packet.h>
#include <epan/strutil.h>

View File

@ -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>

View File

@ -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);

View File

@ -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[] = {

View File

@ -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>

View File

@ -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"

View File

@ -36,9 +36,8 @@
#include "config.h"
#endif
#include <ctype.h>
#include <glib.h>
#include <epan/packet.h>
#include <epan/strutil.h>

View File

@ -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);