diff --git a/epan/dissectors/packet-dcerpc.c b/epan/dissectors/packet-dcerpc.c index e943d1f121..c7e732bbe1 100644 --- a/epan/dissectors/packet-dcerpc.c +++ b/epan/dissectors/packet-dcerpc.c @@ -34,32 +34,39 @@ #endif #include -#include #include + #include -#include #include #include #include #include #include -#include -#include #include #include #include +#include +#include +#include static int dcerpc_tap = -1; /* 32bit Network Data Representation, see DCE/RPC Appendix I */ -static e_uuid_t uuid_data_repr_proto = { 0x8a885d04, 0x1ceb, 0x11c9, { 0x9f, 0xe8, 0x08, 0x00, 0x2b, 0x10, 0x48, 0x60 } }; +static e_uuid_t uuid_data_repr_proto = { 0x8a885d04, 0x1ceb, 0x11c9, + { 0x9f, 0xe8, 0x08, 0x00, 0x2b, 0x10, 0x48, 0x60 } }; + /* 64bit Network Data Representation, introduced in Windows Server 2008 */ -static e_uuid_t uuid_ndr64 = { 0x71710533, 0xbeba, 0x4937, { 0x83, 0x19, 0xb5, 0xdb, 0xef, 0x9c, 0xcc, 0x36 } }; +static e_uuid_t uuid_ndr64 = { 0x71710533, 0xbeba, 0x4937, + { 0x83, 0x19, 0xb5, 0xdb, 0xef, 0x9c, 0xcc, 0x36 } }; + /* Bind Time Feature Negotiation, see [MS-RPCE] 3.3.1.5.3 */ -static e_uuid_t uuid_bind_time_feature_nego = { 0x6cb71c2c, 0x9812, 0x4540, { 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }; +static e_uuid_t uuid_bind_time_feature_nego = { 0x6cb71c2c, 0x9812, 0x4540, + { 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }; + /* see [MS-OXRPC] Appendix A: Full IDL, http://msdn.microsoft.com/en-us/library/ee217991%28v=exchg.80%29.aspx */ -static e_uuid_t uuid_asyncemsmdb = { 0x5261574a, 0x4572, 0x206e, { 0xb2, 0x68, 0x6b, 0x19, 0x92, 0x13, 0xb4, 0xe4 } }; +static e_uuid_t uuid_asyncemsmdb = { 0x5261574a, 0x4572, 0x206e, + { 0xb2, 0x68, 0x6b, 0x19, 0x92, 0x13, 0xb4, 0xe4 } }; static const value_string pckt_vals[] = { { PDU_REQ, "Request"}, @@ -200,7 +207,7 @@ static const value_string authn_level_vals[] = { * and FALSE otherwise. */ #define PFC_NOT_FRAGMENTED(hdr) \ - ((hdr->flags&(PFC_FIRST_FRAG|PFC_LAST_FRAG))==(PFC_FIRST_FRAG|PFC_LAST_FRAG)) + ((hdr->flags&(PFC_FIRST_FRAG|PFC_LAST_FRAG)) == (PFC_FIRST_FRAG|PFC_LAST_FRAG)) /* * Presentation context negotiation result. @@ -613,11 +620,11 @@ static dcerpc_info * get_next_di(void) { static dcerpc_info di[20]; - static int di_counter=0; + static int di_counter = 0; di_counter++; - if(di_counter>=20){ - di_counter=0; + if (di_counter >= 20) { + di_counter = 0; } memset(&di[di_counter], 0, sizeof(dcerpc_info)); @@ -667,13 +674,13 @@ static dcerpc_auth_subdissector_fns *get_auth_subdissector_fns( guint8 auth_level, guint8 auth_type) { gpointer data; - int i; + int i; for (i = 0; (data = g_slist_nth_data(dcerpc_auth_subdissector_list, i)); i++) { dcerpc_auth_subdissector *asd = (dcerpc_auth_subdissector *)data; - if (asd->auth_level == auth_level && - asd->auth_type == auth_type) + if ((asd->auth_level == auth_level) && + (asd->auth_type == auth_type)) return &asd->auth_fns; } @@ -774,19 +781,19 @@ static tvbuff_t *decode_encrypted_data(tvbuff_t *data_tvb, */ /* the registered subdissectors */ -GHashTable *dcerpc_uuids=NULL; +GHashTable *dcerpc_uuids = NULL; static gint -dcerpc_uuid_equal (gconstpointer k1, gconstpointer k2) +dcerpc_uuid_equal(gconstpointer k1, gconstpointer k2) { const dcerpc_uuid_key *key1 = (const dcerpc_uuid_key *)k1; const dcerpc_uuid_key *key2 = (const dcerpc_uuid_key *)k2; - return ((memcmp (&key1->uuid, &key2->uuid, sizeof (e_uuid_t)) == 0) + return ((memcmp(&key1->uuid, &key2->uuid, sizeof (e_uuid_t)) == 0) && (key1->ver == key2->ver)); } static guint -dcerpc_uuid_hash (gconstpointer k) +dcerpc_uuid_hash(gconstpointer k) { const dcerpc_uuid_key *key = (const dcerpc_uuid_key *)k; /* This isn't perfect, but the Data1 part of these is almost always @@ -795,37 +802,37 @@ dcerpc_uuid_hash (gconstpointer k) } void -dcerpc_init_uuid (int proto, int ett, e_uuid_t *uuid, guint16 ver, - dcerpc_sub_dissector *procs, int opnum_hf) +dcerpc_init_uuid(int proto, int ett, e_uuid_t *uuid, guint16 ver, + dcerpc_sub_dissector *procs, int opnum_hf) { - dcerpc_uuid_key *key = g_malloc (sizeof (*key)); - dcerpc_uuid_value *value = g_malloc (sizeof (*value)); + dcerpc_uuid_key *key = g_malloc(sizeof (*key)); + dcerpc_uuid_value *value = g_malloc(sizeof (*value)); header_field_info *hf_info; - module_t *samr_module; - const char *filter_name = proto_get_protocol_filter_name(proto); + module_t *samr_module; + const char *filter_name = proto_get_protocol_filter_name(proto); key->uuid = *uuid; key->ver = ver; - value->proto = find_protocol_by_id(proto); + value->proto = find_protocol_by_id(proto); value->proto_id = proto; - value->ett = ett; - value->name = proto_get_protocol_short_name (value->proto); - value->procs = procs; + value->ett = ett; + value->name = proto_get_protocol_short_name(value->proto); + value->procs = procs; value->opnum_hf = opnum_hf; - g_hash_table_insert (dcerpc_uuids, key, value); + g_hash_table_insert(dcerpc_uuids, key, value); hf_info = proto_registrar_get_nth(opnum_hf); hf_info->strings = value_string_from_subdissectors(procs); /* add this GUID to the global name resolving */ - guids_add_uuid(uuid, proto_get_protocol_short_name (value->proto)); + guids_add_uuid(uuid, proto_get_protocol_short_name(value->proto)); /* Register the samr.nt_password preference as obsolete */ /* This should be in packet-dcerpc-samr.c */ if (strcmp(filter_name, "samr") == 0) { - samr_module = prefs_register_protocol (proto, NULL); + samr_module = prefs_register_protocol(proto, NULL); prefs_register_obsolete_preference(samr_module, "nt_password"); } } @@ -836,12 +843,12 @@ dcerpc_init_uuid (int proto, int ett, e_uuid_t *uuid, guint16 ver, const char * dcerpc_get_proto_name(e_uuid_t *uuid, guint16 ver) { - dcerpc_uuid_key key; + dcerpc_uuid_key key; dcerpc_uuid_value *sub_proto; key.uuid = *uuid; key.ver = ver; - if(!(sub_proto = g_hash_table_lookup (dcerpc_uuids, &key))){ + if (!(sub_proto = g_hash_table_lookup(dcerpc_uuids, &key))) { return NULL; } return sub_proto->name; @@ -853,12 +860,12 @@ dcerpc_get_proto_name(e_uuid_t *uuid, guint16 ver) int dcerpc_get_proto_hf_opnum(e_uuid_t *uuid, guint16 ver) { - dcerpc_uuid_key key; + dcerpc_uuid_key key; dcerpc_uuid_value *sub_proto; key.uuid = *uuid; key.ver = ver; - if(!(sub_proto = g_hash_table_lookup (dcerpc_uuids, &key))){ + if (!(sub_proto = g_hash_table_lookup(dcerpc_uuids, &key))) { return -1; } return sub_proto->opnum_hf; @@ -869,8 +876,9 @@ dcerpc_get_proto_hf_opnum(e_uuid_t *uuid, guint16 ver) value_string *value_string_from_subdissectors(dcerpc_sub_dissector *sd) { - value_string *vs = NULL; - int i, num_sd = 0; + value_string *vs = NULL; + int i; + int num_sd = 0; again: for (i = 0; sd[i].name; i++) { @@ -898,12 +906,12 @@ again: dcerpc_sub_dissector * dcerpc_get_proto_sub_dissector(e_uuid_t *uuid, guint16 ver) { - dcerpc_uuid_key key; + dcerpc_uuid_key key; dcerpc_uuid_value *sub_proto; key.uuid = *uuid; key.ver = ver; - if(!(sub_proto = g_hash_table_lookup (dcerpc_uuids, &key))){ + if (!(sub_proto = g_hash_table_lookup(dcerpc_uuids, &key))) { return NULL; } return sub_proto->procs; @@ -917,37 +925,37 @@ dcerpc_get_proto_sub_dissector(e_uuid_t *uuid, guint16 ver) * Note that we always specify a SMB FID. For non-SMB transports this * value is 0. */ -static GHashTable *dcerpc_binds=NULL; +static GHashTable *dcerpc_binds = NULL; typedef struct _dcerpc_bind_key { conversation_t *conv; - guint16 ctx_id; - guint16 smb_fid; + guint16 ctx_id; + guint16 smb_fid; } dcerpc_bind_key; typedef struct _dcerpc_bind_value { e_uuid_t uuid; - guint16 ver; + guint16 ver; e_uuid_t transport; } dcerpc_bind_value; static gint -dcerpc_bind_equal (gconstpointer k1, gconstpointer k2) +dcerpc_bind_equal(gconstpointer k1, gconstpointer k2) { const dcerpc_bind_key *key1 = (const dcerpc_bind_key *)k1; const dcerpc_bind_key *key2 = (const dcerpc_bind_key *)k2; - return (key1->conv == key2->conv - && key1->ctx_id == key2->ctx_id - && key1->smb_fid == key2->smb_fid); + return ((key1->conv == key2->conv) + && (key1->ctx_id == key2->ctx_id) + && (key1->smb_fid == key2->smb_fid)); } static guint -dcerpc_bind_hash (gconstpointer k) +dcerpc_bind_hash(gconstpointer k) { const dcerpc_bind_key *key = (const dcerpc_bind_key *)k; guint hash; - hash=GPOINTER_TO_UINT(key->conv) + key->ctx_id + key->smb_fid; + hash = GPOINTER_TO_UINT(key->conv) + key->ctx_id + key->smb_fid; return hash; } @@ -956,8 +964,8 @@ dcerpc_bind_hash (gconstpointer k) * To keep track of callid mappings. Should really use some generic * conversation support instead. */ -static GHashTable *dcerpc_cn_calls=NULL; -static GHashTable *dcerpc_dg_calls=NULL; +static GHashTable *dcerpc_cn_calls = NULL; +static GHashTable *dcerpc_dg_calls = NULL; typedef struct _dcerpc_cn_call_key { conversation_t *conv; @@ -967,48 +975,48 @@ typedef struct _dcerpc_cn_call_key { typedef struct _dcerpc_dg_call_key { conversation_t *conv; - guint32 seqnum; - e_uuid_t act_id ; + guint32 seqnum; + e_uuid_t act_id ; } dcerpc_dg_call_key; static gint -dcerpc_cn_call_equal (gconstpointer k1, gconstpointer k2) +dcerpc_cn_call_equal(gconstpointer k1, gconstpointer k2) { const dcerpc_cn_call_key *key1 = (const dcerpc_cn_call_key *)k1; const dcerpc_cn_call_key *key2 = (const dcerpc_cn_call_key *)k2; - return (key1->conv == key2->conv - && key1->call_id == key2->call_id - && key1->smb_fid == key2->smb_fid); + return ((key1->conv == key2->conv) + && (key1->call_id == key2->call_id) + && (key1->smb_fid == key2->smb_fid)); } static gint -dcerpc_dg_call_equal (gconstpointer k1, gconstpointer k2) +dcerpc_dg_call_equal(gconstpointer k1, gconstpointer k2) { const dcerpc_dg_call_key *key1 = (const dcerpc_dg_call_key *)k1; const dcerpc_dg_call_key *key2 = (const dcerpc_dg_call_key *)k2; - return (key1->conv == key2->conv - && key1->seqnum == key2->seqnum - && (memcmp (&key1->act_id, &key2->act_id, sizeof (e_uuid_t)) == 0)); + return ((key1->conv == key2->conv) + && (key1->seqnum == key2->seqnum) + && ((memcmp(&key1->act_id, &key2->act_id, sizeof (e_uuid_t)) == 0))); } static guint -dcerpc_cn_call_hash (gconstpointer k) +dcerpc_cn_call_hash(gconstpointer k) { const dcerpc_cn_call_key *key = (const dcerpc_cn_call_key *)k; return GPOINTER_TO_UINT(key->conv) + key->call_id + key->smb_fid; } static guint -dcerpc_dg_call_hash (gconstpointer k) +dcerpc_dg_call_hash(gconstpointer k) { const dcerpc_dg_call_key *key = (const dcerpc_dg_call_key *)k; return (GPOINTER_TO_UINT(key->conv) + key->seqnum + key->act_id.Data1 - + (key->act_id.Data2 << 16) + key->act_id.Data3 + + (key->act_id.Data2 << 16) + key->act_id.Data3 + (key->act_id.Data4[0] << 24) + (key->act_id.Data4[1] << 16) - + (key->act_id.Data4[2] << 8) + (key->act_id.Data4[3] << 0) + + (key->act_id.Data4[2] << 8) + (key->act_id.Data4[3] << 0) + (key->act_id.Data4[4] << 24) + (key->act_id.Data4[5] << 16) - + (key->act_id.Data4[6] << 8) + (key->act_id.Data4[7] << 0)); + + (key->act_id.Data4[6] << 8) + (key->act_id.Data4[7] << 0)); } /* to keep track of matched calls/responses @@ -1018,7 +1026,7 @@ dcerpc_dg_call_hash (gconstpointer k) XXX - why not just use the same keys as are used for calls? */ -static GHashTable *dcerpc_matched=NULL; +static GHashTable *dcerpc_matched = NULL; typedef struct _dcerpc_matched_key { guint32 frame; @@ -1026,16 +1034,16 @@ typedef struct _dcerpc_matched_key { } dcerpc_matched_key; static gint -dcerpc_matched_equal (gconstpointer k1, gconstpointer k2) +dcerpc_matched_equal(gconstpointer k1, gconstpointer k2) { const dcerpc_matched_key *key1 = (const dcerpc_matched_key *)k1; const dcerpc_matched_key *key2 = (const dcerpc_matched_key *)k2; - return (key1->frame == key2->frame - && key1->call_id == key2->call_id); + return ((key1->frame == key2->frame) + && (key1->call_id == key2->call_id)); } static guint -dcerpc_matched_hash (gconstpointer k) +dcerpc_matched_hash(gconstpointer k) { const dcerpc_matched_key *key = (const dcerpc_matched_key *)k; return key->frame; @@ -1048,15 +1056,15 @@ dcerpc_matched_hash (gconstpointer k) */ int -dissect_dcerpc_uint8 (tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, - proto_tree *tree, guint8 *drep, - int hfindex, guint8 *pdata) +dissect_dcerpc_uint8(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, + proto_tree *tree, guint8 *drep, + int hfindex, guint8 *pdata) { guint8 data; - data = tvb_get_guint8 (tvb, offset); + data = tvb_get_guint8(tvb, offset); if (tree) { - proto_tree_add_item (tree, hfindex, tvb, offset, 1, DREP_ENC_INTEGER(drep)); + proto_tree_add_item(tree, hfindex, tvb, offset, 1, DREP_ENC_INTEGER(drep)); } if (pdata) *pdata = data; @@ -1064,18 +1072,18 @@ dissect_dcerpc_uint8 (tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, } int -dissect_dcerpc_uint16 (tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, - proto_tree *tree, guint8 *drep, - int hfindex, guint16 *pdata) +dissect_dcerpc_uint16(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, + proto_tree *tree, guint8 *drep, + int hfindex, guint16 *pdata) { guint16 data; data = ((drep[0] & DREP_LITTLE_ENDIAN) - ? tvb_get_letohs (tvb, offset) - : tvb_get_ntohs (tvb, offset)); + ? tvb_get_letohs(tvb, offset) + : tvb_get_ntohs(tvb, offset)); if (tree) { - proto_tree_add_item (tree, hfindex, tvb, offset, 2, DREP_ENC_INTEGER(drep)); + proto_tree_add_item(tree, hfindex, tvb, offset, 2, DREP_ENC_INTEGER(drep)); } if (pdata) *pdata = data; @@ -1083,18 +1091,18 @@ dissect_dcerpc_uint16 (tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, } int -dissect_dcerpc_uint32 (tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, - proto_tree *tree, guint8 *drep, - int hfindex, guint32 *pdata) +dissect_dcerpc_uint32(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, + proto_tree *tree, guint8 *drep, + int hfindex, guint32 *pdata) { guint32 data; data = ((drep[0] & DREP_LITTLE_ENDIAN) - ? tvb_get_letohl (tvb, offset) - : tvb_get_ntohl (tvb, offset)); + ? tvb_get_letohl(tvb, offset) + : tvb_get_ntohl(tvb, offset)); if (tree) { - proto_tree_add_item (tree, hfindex, tvb, offset, 4, DREP_ENC_INTEGER(drep)); + proto_tree_add_item(tree, hfindex, tvb, offset, 4, DREP_ENC_INTEGER(drep)); } if (pdata) *pdata = data; @@ -1103,25 +1111,25 @@ dissect_dcerpc_uint32 (tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, /* handles 32 bit unix time_t */ int -dissect_dcerpc_time_t (tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, - proto_tree *tree, guint8 *drep, - int hfindex, guint32 *pdata) +dissect_dcerpc_time_t(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, + proto_tree *tree, guint8 *drep, + int hfindex, guint32 *pdata) { guint32 data; nstime_t tv; data = ((drep[0] & DREP_LITTLE_ENDIAN) - ? tvb_get_letohl (tvb, offset) - : tvb_get_ntohl (tvb, offset)); + ? tvb_get_letohl(tvb, offset) + : tvb_get_ntohl(tvb, offset)); - tv.secs=data; - tv.nsecs=0; + tv.secs = data; + tv.nsecs = 0; if (tree) { - if(data==0xffffffff){ + if (data == 0xffffffff) { /* special case, no time specified */ proto_tree_add_time_format_value(tree, hfindex, tvb, offset, 4, &tv, "No time specified"); } else { - proto_tree_add_time (tree, hfindex, tvb, offset, 4, &tv); + proto_tree_add_time(tree, hfindex, tvb, offset, 4, &tv); } } if (pdata) @@ -1131,15 +1139,15 @@ dissect_dcerpc_time_t (tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, } int -dissect_dcerpc_uint64 (tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, - proto_tree *tree, guint8 *drep, - int hfindex, guint64 *pdata) +dissect_dcerpc_uint64(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, + proto_tree *tree, guint8 *drep, + int hfindex, guint64 *pdata) { guint64 data; data = ((drep[0] & DREP_LITTLE_ENDIAN) - ? tvb_get_letoh64 (tvb, offset) - : tvb_get_ntoh64 (tvb, offset)); + ? tvb_get_letoh64(tvb, offset) + : tvb_get_ntoh64(tvb, offset)); if (tree) { header_field_info *hfinfo; @@ -1150,7 +1158,7 @@ dissect_dcerpc_uint64 (tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, */ hfinfo = proto_registrar_get_nth(hfindex); - switch(hfinfo->type) { + switch (hfinfo->type) { case FT_UINT64: proto_tree_add_uint64(tree, hfindex, tvb, offset, 8, data); break; @@ -1158,7 +1166,7 @@ dissect_dcerpc_uint64 (tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, proto_tree_add_int64(tree, hfindex, tvb, offset, 8, data); break; default: - DISSECTOR_ASSERT(data<=G_MAXUINT32); + DISSECTOR_ASSERT(data <= G_MAXUINT32); proto_tree_add_uint(tree, hfindex, tvb, offset, 8, (guint32)data); } } @@ -1176,7 +1184,7 @@ dissect_dcerpc_float(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, gfloat data; - switch(drep[1]) { + switch (drep[1]) { case(DCE_RPC_DREP_FP_IEEE): data = ((drep[0] & DREP_LITTLE_ENDIAN) ? tvb_get_letohieee_float(tvb, offset) @@ -1210,7 +1218,7 @@ dissect_dcerpc_double(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, gdouble data; - switch(drep[1]) { + switch (drep[1]) { case(DCE_RPC_DREP_FP_IEEE): data = ((drep[0] & DREP_LITTLE_ENDIAN) ? tvb_get_letohieee_double(tvb, offset) @@ -1237,17 +1245,17 @@ dissect_dcerpc_double(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, int -dissect_dcerpc_uuid_t (tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, - proto_tree *tree, guint8 *drep, - int hfindex, e_uuid_t *pdata) +dissect_dcerpc_uuid_t(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, + proto_tree *tree, guint8 *drep, + int hfindex, e_uuid_t *pdata) { e_uuid_t uuid; if (drep[0] & DREP_LITTLE_ENDIAN) { - tvb_get_letohguid (tvb, offset, (e_guid_t *) &uuid); + tvb_get_letohguid(tvb, offset, (e_guid_t *) &uuid); } else { - tvb_get_ntohguid (tvb, offset, (e_guid_t *) &uuid); + tvb_get_ntohguid(tvb, offset, (e_guid_t *) &uuid); } if (tree) { proto_tree_add_guid(tree, hfindex, tvb, offset, 16, (e_guid_t *) &uuid); @@ -1263,32 +1271,32 @@ dissect_dcerpc_uuid_t (tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, * a couple simpler things */ guint16 -dcerpc_tvb_get_ntohs (tvbuff_t *tvb, gint offset, guint8 *drep) +dcerpc_tvb_get_ntohs(tvbuff_t *tvb, gint offset, guint8 *drep) { if (drep[0] & DREP_LITTLE_ENDIAN) { - return tvb_get_letohs (tvb, offset); + return tvb_get_letohs(tvb, offset); } else { - return tvb_get_ntohs (tvb, offset); + return tvb_get_ntohs(tvb, offset); } } guint32 -dcerpc_tvb_get_ntohl (tvbuff_t *tvb, gint offset, guint8 *drep) +dcerpc_tvb_get_ntohl(tvbuff_t *tvb, gint offset, guint8 *drep) { if (drep[0] & DREP_LITTLE_ENDIAN) { - return tvb_get_letohl (tvb, offset); + return tvb_get_letohl(tvb, offset); } else { - return tvb_get_ntohl (tvb, offset); + return tvb_get_ntohl(tvb, offset); } } void -dcerpc_tvb_get_uuid (tvbuff_t *tvb, gint offset, guint8 *drep, e_uuid_t *uuid) +dcerpc_tvb_get_uuid(tvbuff_t *tvb, gint offset, guint8 *drep, e_uuid_t *uuid) { if (drep[0] & DREP_LITTLE_ENDIAN) { - tvb_get_letohguid (tvb, offset, (e_guid_t *) uuid); + tvb_get_letohguid(tvb, offset, (e_guid_t *) uuid); } else { - tvb_get_ntohguid (tvb, offset, (e_guid_t *) uuid); + tvb_get_ntohguid(tvb, offset, (e_guid_t *) uuid); } } @@ -1300,35 +1308,35 @@ dissect_ndr_ucarray(tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, dcerpc_dissect_fnct_t *fnct) { - guint32 i; + guint32 i; dcerpc_info *di; - int old_offset; - int conformance_size = 4; + int old_offset; + int conformance_size = 4; - di=pinfo->private_data; + di = pinfo->private_data; if (di->call_data->flags & DCERPC_IS_NDR64) { conformance_size = 8; } - if(di->conformant_run){ + if (di->conformant_run) { guint64 val; /* conformant run, just dissect the max_count header */ - old_offset=offset; - di->conformant_run=0; - offset = dissect_ndr_uint3264 (tvb, offset, pinfo, tree, drep, + old_offset = offset; + di->conformant_run = 0; + offset = dissect_ndr_uint3264(tvb, offset, pinfo, tree, drep, hf_dcerpc_array_max_count, &val); di->array_max_count = (gint32)val; - di->array_max_count_offset=offset-conformance_size; - di->conformant_run=1; - di->conformant_eaten=offset-old_offset; + di->array_max_count_offset = offset-conformance_size; + di->conformant_run = 1; + di->conformant_eaten = offset-old_offset; } else { /* we don't remember where in the bytestream this field was */ proto_tree_add_uint(tree, hf_dcerpc_array_max_count, tvb, di->array_max_count_offset, conformance_size, di->array_max_count); /* real run, dissect the elements */ - for(i=0;iarray_max_count;i++){ + for(i=0; iarray_max_count; i++) { offset = (*fnct)(tvb, offset, pinfo, tree, drep); } } @@ -1341,40 +1349,40 @@ dissect_ndr_ucvarray(tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, dcerpc_dissect_fnct_t *fnct) { - guint32 i; + guint32 i; dcerpc_info *di; - int old_offset; - int conformance_size = 4; + int old_offset; + int conformance_size = 4; - di=pinfo->private_data; + di = pinfo->private_data; if (di->call_data->flags & DCERPC_IS_NDR64) { conformance_size = 8; } - if(di->conformant_run){ + if (di->conformant_run) { guint64 val; /* conformant run, just dissect the max_count header */ - old_offset=offset; - di->conformant_run=0; - offset = dissect_ndr_uint3264 (tvb, offset, pinfo, tree, drep, + old_offset = offset; + di->conformant_run = 0; + offset = dissect_ndr_uint3264(tvb, offset, pinfo, tree, drep, hf_dcerpc_array_max_count, &val); - DISSECTOR_ASSERT(val<=G_MAXUINT32); + DISSECTOR_ASSERT(val <= G_MAXUINT32); di->array_max_count = (guint32)val; - di->array_max_count_offset=offset-conformance_size; - offset = dissect_ndr_uint3264 (tvb, offset, pinfo, tree, drep, + di->array_max_count_offset = offset-conformance_size; + offset = dissect_ndr_uint3264(tvb, offset, pinfo, tree, drep, hf_dcerpc_array_offset, &val); - DISSECTOR_ASSERT(val<=G_MAXUINT32); + DISSECTOR_ASSERT(val <= G_MAXUINT32); di->array_offset = (guint32)val; - di->array_offset_offset=offset-conformance_size; - offset = dissect_ndr_uint3264 (tvb, offset, pinfo, tree, drep, + di->array_offset_offset = offset-conformance_size; + offset = dissect_ndr_uint3264(tvb, offset, pinfo, tree, drep, hf_dcerpc_array_actual_count, &val); - DISSECTOR_ASSERT(val<=G_MAXUINT32); - di->array_actual_count=(guint32)val; - di->array_actual_count_offset=offset-conformance_size; - di->conformant_run=1; - di->conformant_eaten=offset-old_offset; + DISSECTOR_ASSERT(val <= G_MAXUINT32); + di->array_actual_count = (guint32)val; + di->array_actual_count_offset = offset-conformance_size; + di->conformant_run = 1; + di->conformant_eaten = offset-old_offset; } else { /* we don't remember where in the bytestream these fields were */ proto_tree_add_uint(tree, hf_dcerpc_array_max_count, tvb, di->array_max_count_offset, conformance_size, di->array_max_count); @@ -1382,7 +1390,7 @@ dissect_ndr_ucvarray(tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tree_add_uint(tree, hf_dcerpc_array_actual_count, tvb, di->array_actual_count_offset, conformance_size, di->array_actual_count); /* real run, dissect the elements */ - for(i=0;iarray_actual_count;i++){ + for(i=0 ;iarray_actual_count; i++) { old_offset = offset; offset = (*fnct)(tvb, offset, pinfo, tree, drep); if (offset <= old_offset) @@ -1398,42 +1406,42 @@ dissect_ndr_uvarray(tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, dcerpc_dissect_fnct_t *fnct) { - guint32 i; + guint32 i; dcerpc_info *di; - int old_offset; - int conformance_size = 4; + int old_offset; + int conformance_size = 4; - di=pinfo->private_data; + di = pinfo->private_data; if (di->call_data->flags & DCERPC_IS_NDR64) { conformance_size = 8; } - if(di->conformant_run){ + if (di->conformant_run) { guint64 val; /* conformant run, just dissect the max_count header */ - old_offset=offset; - di->conformant_run=0; - offset = dissect_ndr_uint3264 (tvb, offset, pinfo, tree, drep, + old_offset = offset; + di->conformant_run = 0; + offset = dissect_ndr_uint3264(tvb, offset, pinfo, tree, drep, hf_dcerpc_array_offset, &val); - DISSECTOR_ASSERT(val<=G_MAXUINT32); - di->array_offset=(guint32)val; - di->array_offset_offset=offset-conformance_size; - offset = dissect_ndr_uint3264 (tvb, offset, pinfo, tree, drep, + DISSECTOR_ASSERT(val <= G_MAXUINT32); + di->array_offset = (guint32)val; + di->array_offset_offset = offset-conformance_size; + offset = dissect_ndr_uint3264(tvb, offset, pinfo, tree, drep, hf_dcerpc_array_actual_count, &val); - DISSECTOR_ASSERT(val<=G_MAXUINT32); - di->array_actual_count=(guint32)val; - di->array_actual_count_offset=offset-conformance_size; - di->conformant_run=1; - di->conformant_eaten=offset-old_offset; + DISSECTOR_ASSERT(val <= G_MAXUINT32); + di->array_actual_count = (guint32)val; + di->array_actual_count_offset = offset-conformance_size; + di->conformant_run = 1; + di->conformant_eaten = offset-old_offset; } else { /* we don't remember where in the bytestream these fields were */ proto_tree_add_uint(tree, hf_dcerpc_array_offset, tvb, di->array_offset_offset, conformance_size, di->array_offset); proto_tree_add_uint(tree, hf_dcerpc_array_actual_count, tvb, di->array_actual_count_offset, conformance_size, di->array_actual_count); /* real run, dissect the elements */ - for(i=0;iarray_actual_count;i++){ + for(i=0; iarray_actual_count; i++) { offset = (*fnct)(tvb, offset, pinfo, tree, drep); } } @@ -1449,7 +1457,7 @@ dissect_ndr_uvarray(tvbuff_t *tvb, gint offset, packet_info *pinfo, than showing each byte as an individual element. XXX - which of those is really the IDL type for, for example, - the encrypted data in some MAPI packets? (Microsoft haven't + the encrypted data in some MAPI packets? (Microsoft hasn't released that IDL.) XXX - does this need to do all the conformant array stuff that @@ -1461,10 +1469,10 @@ dissect_ndr_byte_array(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep) { dcerpc_info *di; - guint64 len; + guint64 len; - di=pinfo->private_data; - if(di->conformant_run){ + di = pinfo->private_data; + if (di->conformant_run) { /* just a run to handle conformant arrays, no scalars to dissect */ return offset; } @@ -1480,7 +1488,7 @@ dissect_ndr_byte_array(tvbuff_t *tvb, int offset, packet_info *pinfo, offset = dissect_ndr_uint3264(tvb, offset, pinfo, tree, drep, hf_dcerpc_array_actual_count, &len); - DISSECTOR_ASSERT(len<=G_MAXUINT32); + DISSECTOR_ASSERT(len <= G_MAXUINT32); if (tree && len) { tvb_ensure_bytes_exist(tvb, offset, (guint32)len); proto_tree_add_item(tree, hf_dcerpc_array_buffer, @@ -1505,16 +1513,16 @@ dissect_ndr_cvstring(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, int size_is, int hfindex, gboolean add_subtree, char **data) { - dcerpc_info *di; - proto_item *string_item; - proto_tree *string_tree; - guint64 len; - guint32 buffer_len; - char *s; + dcerpc_info *di; + proto_item *string_item; + proto_tree *string_tree; + guint64 len; + guint32 buffer_len; + char *s; header_field_info *hfinfo; - di=pinfo->private_data; - if(di->conformant_run){ + di = pinfo->private_data; + if (di->conformant_run) { /* just a run to handle conformant arrays, no scalars to dissect */ return offset; } @@ -1539,7 +1547,7 @@ dissect_ndr_cvstring(tvbuff_t *tvb, int offset, packet_info *pinfo, offset = dissect_ndr_uint3264(tvb, offset, pinfo, string_tree, drep, hf_dcerpc_array_actual_count, &len); - DISSECTOR_ASSERT(len<=G_MAXUINT32); + DISSECTOR_ASSERT(len <= G_MAXUINT32); buffer_len = size_is * (guint32)len; /* Adjust offset */ @@ -1576,7 +1584,7 @@ dissect_ndr_cvstring(tvbuff_t *tvb, int offset, packet_info *pinfo, * * XXX - if this is an octet string, does the byte order * matter? Will this ever be anything *other* than an - * octet string? What if size_is is neither 1 nor 2? + * octet string? What if size_is is neither 1 nor 2? */ tvb_ensure_bytes_exist(tvb, offset, buffer_len); s = tvb_get_ephemeral_string(tvb, offset, buffer_len); @@ -1612,7 +1620,7 @@ dissect_ndr_char_cvstring(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep) { dcerpc_info *di; - di=pinfo->private_data; + di = pinfo->private_data; return dissect_ndr_cvstring(tvb, offset, pinfo, tree, drep, sizeof(guint8), di->hf_index, @@ -1633,7 +1641,7 @@ dissect_ndr_wchar_cvstring(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep) { dcerpc_info *di; - di=pinfo->private_data; + di = pinfo->private_data; return dissect_ndr_cvstring(tvb, offset, pinfo, tree, drep, sizeof(guint16), di->hf_index, @@ -1647,28 +1655,28 @@ int PIDL_dissect_cvstring(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, int chsize, int hfindex, guint32 param) { dcerpc_info *di; - char *s = NULL; - gint levels = CB_STR_ITEM_LEVELS(param); + char *s = NULL; + gint levels = CB_STR_ITEM_LEVELS(param); - di=pinfo->private_data; + di = pinfo->private_data; offset = dissect_ndr_cvstring(tvb, offset, pinfo, tree, drep, chsize, hfindex, FALSE, &s); - if(!di->conformant_run){ + if (!di->conformant_run) { /* Append string to COL_INFO */ if (param & PIDL_SET_COL_INFO) { col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", s); } /* Save string to dcv->private_data */ - if((param & PIDL_STR_SAVE) - && (!pinfo->fd->flags.visited)){ + if ((param & PIDL_STR_SAVE) + && (!pinfo->fd->flags.visited)) { dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data; dcv->private_data = se_strdup(s); } /* Append string to upper-level proto_items */ - if (levels > 0 && tree && s && s[0]) { + if ((levels > 0) && tree && s && s[0]) { proto_item_append_text(tree, ": %s", s); tree = tree->parent; levels--; @@ -1699,16 +1707,16 @@ dissect_ndr_vstring(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, int size_is, int hfindex, gboolean add_subtree, char **data) { - dcerpc_info *di; - proto_item *string_item; - proto_tree *string_tree; - guint64 len; - guint32 buffer_len; - char *s; + dcerpc_info *di; + proto_item *string_item; + proto_tree *string_tree; + guint64 len; + guint32 buffer_len; + char *s; header_field_info *hfinfo; - di=pinfo->private_data; - if(di->conformant_run){ + di = pinfo->private_data; + if (di->conformant_run) { /* just a run to handle conformant arrays, no scalars to dissect */ return offset; } @@ -1729,7 +1737,7 @@ dissect_ndr_vstring(tvbuff_t *tvb, int offset, packet_info *pinfo, offset = dissect_ndr_uint3264(tvb, offset, pinfo, string_tree, drep, hf_dcerpc_array_actual_count, &len); - DISSECTOR_ASSERT(len<=G_MAXUINT32); + DISSECTOR_ASSERT(len <= G_MAXUINT32); buffer_len = size_is * (guint32)len; /* Adjust offset */ @@ -1766,7 +1774,7 @@ dissect_ndr_vstring(tvbuff_t *tvb, int offset, packet_info *pinfo, * * XXX - if this is an octet string, does the byte order * matter? Will this ever be anything *other* than an - * octet string? What if size_is is neither 1 nor 2? + * octet string? What if size_is is neither 1 nor 2? */ tvb_ensure_bytes_exist(tvb, offset, buffer_len); s = tvb_get_ephemeral_string(tvb, offset, buffer_len); @@ -1802,7 +1810,7 @@ dissect_ndr_char_vstring(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep) { dcerpc_info *di; - di=pinfo->private_data; + di = pinfo->private_data; return dissect_ndr_vstring(tvb, offset, pinfo, tree, drep, sizeof(guint8), di->hf_index, @@ -1823,7 +1831,7 @@ dissect_ndr_wchar_vstring(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep) { dcerpc_info *di; - di=pinfo->private_data; + di = pinfo->private_data; return dissect_ndr_vstring(tvb, offset, pinfo, tree, drep, sizeof(guint16), di->hf_index, @@ -1836,21 +1844,21 @@ dissect_ndr_wchar_vstring(tvbuff_t *tvb, int offset, packet_info *pinfo, static GSList *ndr_pointer_list = NULL; /* position where in the list to insert newly encountered pointers */ -static int ndr_pointer_list_pos=0; +static int ndr_pointer_list_pos = 0; /* Boolean controlling whether pointers are top-level or embedded */ static gboolean pointers_are_top_level = TRUE; -/* as a kludge, we represent all embedded reference pointers as id==-1 +/* as a kludge, we represent all embedded reference pointers as id == -1 hoping that his will not collide with any non-ref pointers */ typedef struct ndr_pointer_data { - guint32 id; - proto_item *item; /* proto_item for pointer */ - proto_tree *tree; /* subtree of above item */ - dcerpc_dissect_fnct_t *fnct; /*if non-NULL, we have not called it yet*/ - int hf_index; + guint32 id; + proto_item *item; /* proto_item for pointer */ + proto_tree *tree; /* subtree of above item */ + dcerpc_dissect_fnct_t *fnct; /*if non-NULL, we have not called it yet*/ + int hf_index; dcerpc_callback_fnct_t *callback; - void *callback_args; + void *callback_args; } ndr_pointer_data_t; void @@ -1858,57 +1866,57 @@ init_ndr_pointer_list(packet_info *pinfo) { dcerpc_info *di; - di=pinfo->private_data; - di->conformant_run=0; + di = pinfo->private_data; + di->conformant_run = 0; - while(ndr_pointer_list){ + while (ndr_pointer_list) { ndr_pointer_data_t *npd; - npd=g_slist_nth_data(ndr_pointer_list, 0); - ndr_pointer_list=g_slist_remove(ndr_pointer_list, npd); + npd = g_slist_nth_data(ndr_pointer_list, 0); + ndr_pointer_list = g_slist_remove(ndr_pointer_list, npd); g_free(npd); } - ndr_pointer_list=NULL; - ndr_pointer_list_pos=0; - pointers_are_top_level=TRUE; + ndr_pointer_list = NULL; + ndr_pointer_list_pos = 0; + pointers_are_top_level = TRUE; } int dissect_deferred_pointers(packet_info *pinfo, tvbuff_t *tvb, int offset, guint8 *drep) { - int found_new_pointer; + int found_new_pointer; dcerpc_info *di; - int old_offset; - int next_pointer; + int old_offset; + int next_pointer; - next_pointer=0; - di=pinfo->private_data; + next_pointer = 0; + di = pinfo->private_data; do{ int i, len; - found_new_pointer=0; - len=g_slist_length(ndr_pointer_list); - for(i=next_pointer;ifnct){ + tnpd = g_slist_nth_data(ndr_pointer_list, i); + if (tnpd->fnct) { dcerpc_dissect_fnct_t *fnct; - next_pointer=i+1; - found_new_pointer=1; - fnct=tnpd->fnct; - tnpd->fnct=NULL; - ndr_pointer_list_pos=i+1; - di->hf_index=tnpd->hf_index; + next_pointer = i+1; + found_new_pointer = 1; + fnct = tnpd->fnct; + tnpd->fnct = NULL; + ndr_pointer_list_pos = i+1; + di->hf_index = tnpd->hf_index; /* first a run to handle any conformant array headers */ - di->conformant_run=1; - di->conformant_eaten=0; + di->conformant_run = 1; + di->conformant_eaten = 0; old_offset = offset; offset = (*(fnct))(tvb, offset, pinfo, NULL, drep); - DISSECTOR_ASSERT((offset-old_offset)==di->conformant_eaten); + DISSECTOR_ASSERT((offset-old_offset) == di->conformant_eaten); /* This is to check for any bugs in the dissectors. * * Basically, the NDR representation will store all @@ -1924,12 +1932,12 @@ dissect_deferred_pointers(packet_info *pinfo, tvbuff_t *tvb, int offset, guint8 * For this reason, all pointers to types (both aggregate * and scalar, for simplicity no distinction is made) * will have its dissector called twice. - * The dissector will first be called with conformant_run==1 + * The dissector will first be called with conformant_run == 1 * in which mode the dissector MUST NOT consume any data from * the tvbuff (i.e. may not dissect anything) except the * initial control block for arrays. * The second time the dissector is called, with - * conformant_run==0, all other data for the type will be + * conformant_run == 0, all other data for the type will be * dissected. * * All dissect_ndr_ dissectors are already prepared @@ -1945,8 +1953,8 @@ dissect_deferred_pointers(packet_info *pinfo, tvbuff_t *tvb, int offset, guint8 * * dcerpc_info *di; * - * di=pinfo->private_data; - * if(di->conformant_run){ + * di = pinfo->private_data; + * if (di->conformant_run) { * return offset; * } * @@ -1956,7 +1964,7 @@ dissect_deferred_pointers(packet_info *pinfo, tvbuff_t *tvb, int offset, guint8 */ /* now we dissect the actual pointer */ - di->conformant_run=0; + di->conformant_run = 0; old_offset = offset; offset = (*(fnct))(tvb, offset, pinfo, tnpd->tree, drep); if (tnpd->callback) @@ -1964,7 +1972,7 @@ dissect_deferred_pointers(packet_info *pinfo, tvbuff_t *tvb, int offset, guint8 break; } } - } while(found_new_pointer); + } while (found_new_pointer); return offset; } @@ -1978,43 +1986,43 @@ add_pointer_to_list(packet_info *pinfo, proto_tree *tree, proto_item *item, ndr_pointer_data_t *npd; /* check if this pointer is valid */ - if(id!=0xffffffff){ + if (id != 0xffffffff) { dcerpc_info *di; dcerpc_call_value *value; - di=pinfo->private_data; - value=di->call_data; + di = pinfo->private_data; + value = di->call_data; - if(di->ptype == PDU_REQ){ - if(!(pinfo->fd->flags.visited)){ - if(id>value->max_ptr){ - value->max_ptr=id; + if (di->ptype == PDU_REQ) { + if (!(pinfo->fd->flags.visited)) { + if (id > value->max_ptr) { + value->max_ptr = id; } } } else { /* if we haven't seen the request bail out since we cant know whether this is the first non-NULL instance or not */ - if(value->req_frame==0){ + if (value->req_frame == 0) { /* XXX THROW EXCEPTION */ } /* We saw this one in the request frame, nothing to dissect later */ - if(id<=value->max_ptr){ + if (id <= value->max_ptr) { return; } } } - npd=g_malloc(sizeof(ndr_pointer_data_t)); - npd->id=id; - npd->tree=tree; - npd->item=item; - npd->fnct=fnct; - npd->hf_index=hf_index; - npd->callback=callback; - npd->callback_args=callback_args; + npd = g_malloc(sizeof(ndr_pointer_data_t)); + npd->id = id; + npd->tree = tree; + npd->item = item; + npd->fnct = fnct; + npd->hf_index = hf_index; + npd->callback = callback; + npd->callback_args = callback_args; ndr_pointer_list = g_slist_insert(ndr_pointer_list, npd, ndr_pointer_list_pos); ndr_pointer_list_pos++; @@ -2025,13 +2033,13 @@ static int find_pointer_index(guint32 id) { ndr_pointer_data_t *npd; - int i,len; + int i,len; - len=g_slist_length(ndr_pointer_list); - for(i=0;iid==id){ + len = g_slist_length(ndr_pointer_list); + for(i=0; iid == id) { return i; } } @@ -2066,12 +2074,12 @@ dissect_ndr_pointer_cb(tvbuff_t *tvb, gint offset, packet_info *pinfo, dcerpc_callback_fnct_t *callback, void *callback_args) { dcerpc_info *di; - proto_tree *tr = NULL; - gint start_offset = offset; - int pointer_size = 4; + proto_tree *tr = NULL; + gint start_offset = offset; + int pointer_size = 4; - di=pinfo->private_data; - if(di->conformant_run){ + di = pinfo->private_data; + if (di->conformant_run) { /* this call was only for dissecting the header for any embedded conformant array. we will not parse any pointers in this mode. @@ -2084,14 +2092,14 @@ dissect_ndr_pointer_cb(tvbuff_t *tvb, gint offset, packet_info *pinfo, /*TOP LEVEL REFERENCE POINTER*/ - if( pointers_are_top_level - &&(type==NDR_POINTER_REF) ){ + if ( pointers_are_top_level + && (type == NDR_POINTER_REF) ) { proto_item *item; /* we must find out a nice way to do the length here */ - item=proto_tree_add_text(tree, tvb, offset, 0, - "%s", text); - tr=proto_item_add_subtree(item,ett_dcerpc_pointer_data); + item = proto_tree_add_text(tree, tvb, offset, 0, + "%s", text); + tr = proto_item_add_subtree(item,ett_dcerpc_pointer_data); add_pointer_to_list(pinfo, tr, item, fnct, 0xffffffff, hf_index, callback, callback_args); @@ -2099,8 +2107,8 @@ dissect_ndr_pointer_cb(tvbuff_t *tvb, gint offset, packet_info *pinfo, } /*TOP LEVEL FULL POINTER*/ - if( pointers_are_top_level - && (type==NDR_POINTER_PTR) ){ + if ( pointers_are_top_level + && (type == NDR_POINTER_PTR) ) { int idx; guint64 id; proto_item *item; @@ -2110,7 +2118,7 @@ dissect_ndr_pointer_cb(tvbuff_t *tvb, gint offset, packet_info *pinfo, tvb_ensure_bytes_exist(tvb, offset-pointer_size, pointer_size); /* we got a NULL pointer */ - if(id==0){ + if (id == 0) { proto_tree_add_text(tree, tvb, offset-pointer_size, pointer_size, "(NULL pointer) %s",text); @@ -2118,11 +2126,11 @@ dissect_ndr_pointer_cb(tvbuff_t *tvb, gint offset, packet_info *pinfo, } /* see if we have seen this pointer before */ - DISSECTOR_ASSERT(id<=G_MAXUINT32); - idx=find_pointer_index((guint32)id); + DISSECTOR_ASSERT(id <= G_MAXUINT32); + idx = find_pointer_index((guint32)id); /* we have seen this pointer before */ - if(idx>=0){ + if (idx >= 0) { proto_tree_add_text(tree, tvb, offset-pointer_size, pointer_size, "(duplicate PTR) %s",text); @@ -2130,10 +2138,10 @@ dissect_ndr_pointer_cb(tvbuff_t *tvb, gint offset, packet_info *pinfo, } /* new pointer */ - item=proto_tree_add_text(tree, tvb, offset-pointer_size, - pointer_size, - "%s", text); - tr=proto_item_add_subtree(item,ett_dcerpc_pointer_data); + item = proto_tree_add_text(tree, tvb, offset-pointer_size, + pointer_size, + "%s", text); + tr = proto_item_add_subtree(item,ett_dcerpc_pointer_data); proto_tree_add_uint(tr, hf_dcerpc_referent_id, tvb, offset-pointer_size, pointer_size, (guint32)id); add_pointer_to_list(pinfo, tr, item, fnct, (guint32)id, hf_index, @@ -2141,8 +2149,8 @@ dissect_ndr_pointer_cb(tvbuff_t *tvb, gint offset, packet_info *pinfo, goto after_ref_id; } /*TOP LEVEL UNIQUE POINTER*/ - if( pointers_are_top_level - && (type==NDR_POINTER_UNIQUE) ){ + if ( pointers_are_top_level + && (type == NDR_POINTER_UNIQUE) ) { guint64 id; proto_item *item; @@ -2151,7 +2159,7 @@ dissect_ndr_pointer_cb(tvbuff_t *tvb, gint offset, packet_info *pinfo, tvb_ensure_bytes_exist(tvb, offset-pointer_size, pointer_size); /* we got a NULL pointer */ - if(id==0){ + if (id == 0) { proto_tree_add_text(tree, tvb, offset-pointer_size, pointer_size, "(NULL pointer) %s",text); @@ -2159,11 +2167,11 @@ dissect_ndr_pointer_cb(tvbuff_t *tvb, gint offset, packet_info *pinfo, } /* new pointer */ - DISSECTOR_ASSERT(id<=G_MAXUINT32); - item=proto_tree_add_text(tree, tvb, offset-pointer_size, - pointer_size, - "%s", text); - tr=proto_item_add_subtree(item,ett_dcerpc_pointer_data); + DISSECTOR_ASSERT(id <= G_MAXUINT32); + item = proto_tree_add_text(tree, tvb, offset-pointer_size, + pointer_size, + "%s", text); + tr = proto_item_add_subtree(item,ett_dcerpc_pointer_data); proto_tree_add_uint(tr, hf_dcerpc_referent_id, tvb, offset-pointer_size, pointer_size, (guint32)id); add_pointer_to_list(pinfo, tr, item, fnct, 0xffffffff, @@ -2172,8 +2180,8 @@ dissect_ndr_pointer_cb(tvbuff_t *tvb, gint offset, packet_info *pinfo, } /*EMBEDDED REFERENCE POINTER*/ - if( (!pointers_are_top_level) - && (type==NDR_POINTER_REF) ){ + if ( (!pointers_are_top_level) + && (type == NDR_POINTER_REF) ) { guint64 id; proto_item *item; @@ -2182,11 +2190,11 @@ dissect_ndr_pointer_cb(tvbuff_t *tvb, gint offset, packet_info *pinfo, tvb_ensure_bytes_exist(tvb, offset-pointer_size, pointer_size); /* new pointer */ - item=proto_tree_add_text(tree, tvb, offset-pointer_size, + item = proto_tree_add_text(tree, tvb, offset-pointer_size, pointer_size, "%s",text); - tr=proto_item_add_subtree(item,ett_dcerpc_pointer_data); - DISSECTOR_ASSERT(id<=G_MAXUINT32); + tr = proto_item_add_subtree(item,ett_dcerpc_pointer_data); + DISSECTOR_ASSERT(id <= G_MAXUINT32); proto_tree_add_uint(tr, hf_dcerpc_referent_id, tvb, offset-pointer_size, pointer_size, (guint32)id); add_pointer_to_list(pinfo, tr, item, fnct, 0xffffffff, @@ -2195,8 +2203,8 @@ dissect_ndr_pointer_cb(tvbuff_t *tvb, gint offset, packet_info *pinfo, } /*EMBEDDED UNIQUE POINTER*/ - if( (!pointers_are_top_level) - && (type==NDR_POINTER_UNIQUE) ){ + if ( (!pointers_are_top_level) + && (type == NDR_POINTER_UNIQUE) ) { guint64 id; proto_item *item; @@ -2205,7 +2213,7 @@ dissect_ndr_pointer_cb(tvbuff_t *tvb, gint offset, packet_info *pinfo, tvb_ensure_bytes_exist(tvb, offset-pointer_size, pointer_size); /* we got a NULL pointer */ - if(id==0){ + if (id == 0) { proto_tree_add_text(tree, tvb, offset-pointer_size, pointer_size, "(NULL pointer) %s", text); @@ -2213,11 +2221,11 @@ dissect_ndr_pointer_cb(tvbuff_t *tvb, gint offset, packet_info *pinfo, } /* new pointer */ - item=proto_tree_add_text(tree, tvb, offset-pointer_size, - pointer_size, - "%s",text); - tr=proto_item_add_subtree(item,ett_dcerpc_pointer_data); - DISSECTOR_ASSERT(id<=G_MAXUINT32); + item = proto_tree_add_text(tree, tvb, offset-pointer_size, + pointer_size, + "%s",text); + tr = proto_item_add_subtree(item,ett_dcerpc_pointer_data); + DISSECTOR_ASSERT(id <= G_MAXUINT32); proto_tree_add_uint(tr, hf_dcerpc_referent_id, tvb, offset-pointer_size, pointer_size, (guint32)id); add_pointer_to_list(pinfo, tr, item, fnct, 0xffffffff, @@ -2226,8 +2234,8 @@ dissect_ndr_pointer_cb(tvbuff_t *tvb, gint offset, packet_info *pinfo, } /*EMBEDDED FULL POINTER*/ - if( (!pointers_are_top_level) - && (type==NDR_POINTER_PTR) ){ + if ( (!pointers_are_top_level) + && (type == NDR_POINTER_PTR) ) { int idx; guint64 id; proto_item *item; @@ -2237,7 +2245,7 @@ dissect_ndr_pointer_cb(tvbuff_t *tvb, gint offset, packet_info *pinfo, tvb_ensure_bytes_exist(tvb, offset-pointer_size, pointer_size); /* we got a NULL pointer */ - if(id==0){ + if (id == 0) { proto_tree_add_text(tree, tvb, offset-pointer_size, pointer_size, "(NULL pointer) %s",text); @@ -2245,11 +2253,11 @@ dissect_ndr_pointer_cb(tvbuff_t *tvb, gint offset, packet_info *pinfo, } /* see if we have seen this pointer before */ - DISSECTOR_ASSERT(id<=G_MAXUINT32); - idx=find_pointer_index((guint32)id); + DISSECTOR_ASSERT(id <= G_MAXUINT32); + idx = find_pointer_index((guint32)id); /* we have seen this pointer before */ - if(idx>=0){ + if (idx >= 0) { proto_tree_add_text(tree, tvb, offset-pointer_size, pointer_size, "(duplicate PTR) %s",text); @@ -2257,10 +2265,10 @@ dissect_ndr_pointer_cb(tvbuff_t *tvb, gint offset, packet_info *pinfo, } /* new pointer */ - item=proto_tree_add_text(tree, tvb, offset-pointer_size, - pointer_size, - "%s", text); - tr=proto_item_add_subtree(item,ett_dcerpc_pointer_data); + item = proto_tree_add_text(tree, tvb, offset-pointer_size, + pointer_size, + "%s", text); + tr = proto_item_add_subtree(item,ett_dcerpc_pointer_data); proto_tree_add_uint(tr, hf_dcerpc_referent_id, tvb, offset-pointer_size, pointer_size, (guint32)id); add_pointer_to_list(pinfo, tr, item, fnct, (guint32)id, hf_index, @@ -2273,14 +2281,14 @@ after_ref_id: /* After each top level pointer we have dissected we have to dissect all deferrals before we move on to the next top level argument */ - if(pointers_are_top_level==TRUE){ - pointers_are_top_level=FALSE; + if (pointers_are_top_level == TRUE) { + pointers_are_top_level = FALSE; offset = dissect_deferred_pointers(pinfo, tvb, offset, drep); - pointers_are_top_level=TRUE; + pointers_are_top_level = TRUE; } /* Set the length for the new subtree */ - if (tr){ + if (tr) { proto_item_set_len(tr, offset-start_offset); } return offset; @@ -2302,8 +2310,8 @@ dissect_ndr_toplevel_pointer(tvbuff_t *tvb, gint offset, packet_info *pinfo, { int ret; - pointers_are_top_level=TRUE; - ret=dissect_ndr_pointer_cb( + pointers_are_top_level = TRUE; + ret = dissect_ndr_pointer_cb( tvb, offset, pinfo, tree, drep, fnct, type, text, hf_index, NULL, NULL); return ret; @@ -2315,18 +2323,18 @@ dissect_ndr_embedded_pointer(tvbuff_t *tvb, gint offset, packet_info *pinfo, { int ret; - pointers_are_top_level=FALSE; - ret=dissect_ndr_pointer_cb( + pointers_are_top_level = FALSE; + ret = dissect_ndr_pointer_cb( tvb, offset, pinfo, tree, drep, fnct, type, text, hf_index, NULL, NULL); return ret; } static void -show_stub_data (tvbuff_t *tvb, gint offset, proto_tree *dcerpc_tree, - dcerpc_auth_info *auth_info, gboolean is_encrypted) +show_stub_data(tvbuff_t *tvb, gint offset, proto_tree *dcerpc_tree, + dcerpc_auth_info *auth_info, gboolean is_encrypted) { - int length, plain_length, auth_pad_len; + int length, plain_length, auth_pad_len; guint auth_pad_offset; /* @@ -2335,9 +2343,9 @@ show_stub_data (tvbuff_t *tvb, gint offset, proto_tree *dcerpc_tree, * bytes, the reported number of bytes, not the number of bytes * that happen to be in the tvbuff. */ - if (tvb_length_remaining (tvb, offset) > 0) { + if (tvb_length_remaining(tvb, offset) > 0) { auth_pad_len = auth_info?auth_info->auth_pad_len:0; - length = tvb_reported_length_remaining (tvb, offset); + length = tvb_reported_length_remaining(tvb, offset); /* if auth_pad_len is larger than length then we ignore auth_pad_len totally */ plain_length = length - auth_pad_len; @@ -2347,8 +2355,8 @@ show_stub_data (tvbuff_t *tvb, gint offset, proto_tree *dcerpc_tree, } auth_pad_offset = offset + plain_length; - if (auth_info != NULL && - auth_info->auth_level == DCE_C_AUTHN_LEVEL_PKT_PRIVACY) { + if ((auth_info != NULL) && + (auth_info->auth_level == DCE_C_AUTHN_LEVEL_PKT_PRIVACY)) { if (is_encrypted) { tvb_ensure_bytes_exist(tvb, offset, length); proto_tree_add_text(dcerpc_tree, tvb, offset, length, @@ -2364,49 +2372,50 @@ show_stub_data (tvbuff_t *tvb, gint offset, proto_tree *dcerpc_tree, } } else { tvb_ensure_bytes_exist(tvb, offset, plain_length); - proto_tree_add_text (dcerpc_tree, tvb, offset, plain_length, - "Stub data (%d byte%s)", plain_length, - plurality(plain_length, "", "s")); + proto_tree_add_text(dcerpc_tree, tvb, offset, plain_length, + "Stub data (%d byte%s)", plain_length, + plurality(plain_length, "", "s")); } /* If there is auth padding at the end of the stub, display it */ if (auth_pad_len != 0) { tvb_ensure_bytes_exist(tvb, auth_pad_offset, auth_pad_len); - proto_tree_add_text (dcerpc_tree, tvb, auth_pad_offset, - auth_pad_len, - "Auth Padding (%u byte%s)", - auth_pad_len, - plurality(auth_pad_len, "", "s")); + proto_tree_add_text(dcerpc_tree, tvb, auth_pad_offset, + auth_pad_len, + "Auth Padding (%u byte%s)", + auth_pad_len, + plurality(auth_pad_len, "", "s")); } } } static int -dcerpc_try_handoff (packet_info *pinfo, proto_tree *tree, - proto_tree *dcerpc_tree, - tvbuff_t *volatile tvb, tvbuff_t *decrypted_tvb, - guint8 *drep, dcerpc_info *info, - dcerpc_auth_info *auth_info) +dcerpc_try_handoff(packet_info *pinfo, proto_tree *tree, + proto_tree *dcerpc_tree, + tvbuff_t *volatile tvb, tvbuff_t *decrypted_tvb, + guint8 *drep, dcerpc_info *info, + dcerpc_auth_info *auth_info) { - volatile gint offset = 0; - dcerpc_uuid_key key; - dcerpc_uuid_value *sub_proto; - proto_tree *volatile sub_tree = NULL; + volatile gint offset = 0; + dcerpc_uuid_key key; + dcerpc_uuid_value *sub_proto; + proto_tree *volatile sub_tree = NULL; dcerpc_sub_dissector *proc; - const gchar *name = NULL; + const gchar *name = NULL; + const char *volatile saved_proto; + void *volatile saved_private_data; + guint length = 0, reported_length = 0; + tvbuff_t *volatile stub_tvb; + volatile guint auth_pad_len; + volatile int auth_pad_offset; + proto_item *sub_item = NULL; + proto_item *pi, *hidden_item; + dcerpc_dissect_fnct_t *volatile sub_dissect; - const char *volatile saved_proto; - void *volatile saved_private_data; - guint length = 0, reported_length = 0; - tvbuff_t *volatile stub_tvb; - volatile guint auth_pad_len; - volatile int auth_pad_offset; - proto_item *sub_item=NULL; - proto_item *pi, *hidden_item; key.uuid = info->call_data->uuid; key.ver = info->call_data->ver; - if ((sub_proto = g_hash_table_lookup (dcerpc_uuids, &key)) == NULL + if ((sub_proto = g_hash_table_lookup(dcerpc_uuids, &key)) == NULL || !proto_is_protocol_enabled(sub_proto->proto)) { /* * We don't have a dissector for this UUID, or the protocol @@ -2416,14 +2425,14 @@ dcerpc_try_handoff (packet_info *pinfo, proto_tree *tree, hidden_item = proto_tree_add_boolean(dcerpc_tree, hf_dcerpc_unknown_if_id, tvb, offset, 0, TRUE); PROTO_ITEM_SET_HIDDEN(hidden_item); - col_append_fstr (pinfo->cinfo, COL_INFO, " %s V%u", + col_append_fstr(pinfo->cinfo, COL_INFO, " %s V%u", guids_resolve_uuid_to_str(&info->call_data->uuid), info->call_data->ver); if (decrypted_tvb != NULL) { - show_stub_data (decrypted_tvb, 0, dcerpc_tree, auth_info, - FALSE); + show_stub_data(decrypted_tvb, 0, dcerpc_tree, auth_info, + FALSE); } else - show_stub_data (tvb, 0, dcerpc_tree, auth_info, TRUE); + show_stub_data(tvb, 0, dcerpc_tree, auth_info, TRUE); return -1; } @@ -2437,21 +2446,21 @@ dcerpc_try_handoff (packet_info *pinfo, proto_tree *tree, if (!name) name = "Unknown?!"; - col_set_str (pinfo->cinfo, COL_PROTOCOL, sub_proto->name); + col_set_str(pinfo->cinfo, COL_PROTOCOL, sub_proto->name); - col_add_fstr (pinfo->cinfo, COL_INFO, "%s %s", - name, (info->ptype == PDU_REQ) ? "request" : "response"); + col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s", + name, (info->ptype == PDU_REQ) ? "request" : "response"); sub_dissect = (info->ptype == PDU_REQ) ? proc->dissect_rqst : proc->dissect_resp; if (tree) { - sub_item = proto_tree_add_item (tree, sub_proto->proto_id, - (decrypted_tvb != NULL)?decrypted_tvb:tvb, - 0, -1, ENC_NA); + sub_item = proto_tree_add_item(tree, sub_proto->proto_id, + (decrypted_tvb != NULL)?decrypted_tvb:tvb, + 0, -1, ENC_NA); if (sub_item) { - sub_tree = proto_item_add_subtree (sub_item, sub_proto->ett); + sub_tree = proto_item_add_subtree(sub_item, sub_proto->ett); proto_item_append_text(sub_item, ", %s", name); } @@ -2470,12 +2479,12 @@ dcerpc_try_handoff (packet_info *pinfo, proto_tree *tree, "Operation: %s (%u)", name, info->call_data->opnum); - if(info->ptype == PDU_REQ && info->call_data->rep_frame!=0) { + if ((info->ptype == PDU_REQ) && (info->call_data->rep_frame != 0)) { pi = proto_tree_add_uint(sub_tree, hf_dcerpc_response_in, tvb, 0, 0, info->call_data->rep_frame); PROTO_ITEM_SET_GENERATED(pi); } - if(info->ptype == PDU_RESP && info->call_data->req_frame!=0) { + if ((info->ptype == PDU_RESP) && (info->call_data->req_frame != 0)) { pi = proto_tree_add_uint(sub_tree, hf_dcerpc_request_in, tvb, 0, 0, info->call_data->req_frame); PROTO_ITEM_SET_GENERATED(pi); @@ -2487,10 +2496,10 @@ dcerpc_try_handoff (packet_info *pinfo, proto_tree *tree, the encrypted payload. */ if (sub_dissect) { /* We have a subdissector - call it. */ - saved_proto = pinfo->current_proto; - saved_private_data = pinfo->private_data; + saved_proto = pinfo->current_proto; + saved_private_data = pinfo->private_data; pinfo->current_proto = sub_proto->name; - pinfo->private_data = (void *)info; + pinfo->private_data = (void *)info; init_ndr_pointer_list(pinfo); @@ -2500,7 +2509,7 @@ dcerpc_try_handoff (packet_info *pinfo, proto_tree *tree, /* * Remove the authentication padding from the stub data. */ - if (auth_info != NULL && auth_info->auth_pad_len != 0) { + if ((auth_info != NULL) && (auth_info->auth_pad_len != 0)) { if (reported_length >= auth_info->auth_pad_len) { /* * OK, the padding length isn't so big that it @@ -2560,7 +2569,7 @@ dcerpc_try_handoff (packet_info *pinfo, proto_tree *tree, TRY { int remaining; - offset = sub_dissect (stub_tvb, 0, pinfo, sub_tree, + offset = sub_dissect(stub_tvb, 0, pinfo, sub_tree, drep); /* If we have a subdissector and it didn't dissect all @@ -2588,34 +2597,34 @@ dcerpc_try_handoff (packet_info *pinfo, proto_tree *tree, /* If there is auth padding at the end of the stub, display it */ if (auth_pad_len != 0) { tvb_ensure_bytes_exist(tvb, auth_pad_offset, auth_pad_len); - proto_tree_add_text (sub_tree, decrypted_tvb, auth_pad_offset, - auth_pad_len, - "Auth Padding (%u byte%s)", - auth_pad_len, - plurality(auth_pad_len, "", "s")); + proto_tree_add_text(sub_tree, decrypted_tvb, auth_pad_offset, + auth_pad_len, + "Auth Padding (%u byte%s)", + auth_pad_len, + plurality(auth_pad_len, "", "s")); } pinfo->current_proto = saved_proto; - pinfo->private_data = saved_private_data; + pinfo->private_data = saved_private_data; } else { /* No subdissector - show it as stub data. */ - if(decrypted_tvb){ - show_stub_data (decrypted_tvb, 0, sub_tree, auth_info, FALSE); + if (decrypted_tvb) { + show_stub_data(decrypted_tvb, 0, sub_tree, auth_info, FALSE); } else { - show_stub_data (tvb, 0, sub_tree, auth_info, TRUE); + show_stub_data(tvb, 0, sub_tree, auth_info, TRUE); } } } else - show_stub_data (tvb, 0, sub_tree, auth_info, TRUE); + show_stub_data(tvb, 0, sub_tree, auth_info, TRUE); tap_queue_packet(dcerpc_tap, pinfo, info); return 0; } static int -dissect_dcerpc_verifier (tvbuff_t *tvb, packet_info *pinfo, - proto_tree *dcerpc_tree, e_dce_cn_common_hdr_t *hdr, - dcerpc_auth_info *auth_info) +dissect_dcerpc_verifier(tvbuff_t *tvb, packet_info *pinfo, + proto_tree *dcerpc_tree, e_dce_cn_common_hdr_t *hdr, + dcerpc_auth_info *auth_info) { int auth_offset; @@ -2646,8 +2655,8 @@ dissect_dcerpc_verifier (tvbuff_t *tvb, packet_info *pinfo, } ENDTRY; } else { tvb_ensure_bytes_exist(tvb, 0, hdr->auth_len); - proto_tree_add_text (dcerpc_tree, auth_tvb, 0, hdr->auth_len, - "Auth Verifier"); + proto_tree_add_text(dcerpc_tree, auth_tvb, 0, hdr->auth_len, + "Auth Verifier"); } } @@ -2655,9 +2664,9 @@ dissect_dcerpc_verifier (tvbuff_t *tvb, packet_info *pinfo, } static void -dissect_dcerpc_cn_auth (tvbuff_t *tvb, int stub_offset, packet_info *pinfo, - proto_tree *dcerpc_tree, e_dce_cn_common_hdr_t *hdr, - gboolean are_credentials, dcerpc_auth_info *auth_info) +dissect_dcerpc_cn_auth(tvbuff_t *tvb, int stub_offset, packet_info *pinfo, + proto_tree *dcerpc_tree, e_dce_cn_common_hdr_t *hdr, + gboolean are_credentials, dcerpc_auth_info *auth_info) { volatile int offset; @@ -2665,9 +2674,9 @@ dissect_dcerpc_cn_auth (tvbuff_t *tvb, int stub_offset, packet_info *pinfo, * Initially set auth_level and auth_type to zero to indicate that we * haven't yet seen any authentication level information. */ - auth_info->auth_level = 0; - auth_info->auth_type = 0; - auth_info->auth_size = 0; + auth_info->auth_level = 0; + auth_info->auth_type = 0; + auth_info->auth_size = 0; auth_info->auth_pad_len = 0; /* @@ -2683,7 +2692,7 @@ dissect_dcerpc_cn_auth (tvbuff_t *tvb, int stub_offset, packet_info *pinfo, */ if (hdr->auth_len - && (hdr->auth_len + 8 <= hdr->frag_len - stub_offset)) { + && ((hdr->auth_len + 8) <= (hdr->frag_len - stub_offset))) { /* * Yes, there is authentication data, and the length is valid. @@ -2705,20 +2714,20 @@ dissect_dcerpc_cn_auth (tvbuff_t *tvb, int stub_offset, packet_info *pinfo, * dissect after this, such as stub data. */ TRY { - offset = dissect_dcerpc_uint8 (tvb, offset, pinfo, dcerpc_tree, hdr->drep, - hf_dcerpc_auth_type, - &auth_info->auth_type); - offset = dissect_dcerpc_uint8 (tvb, offset, pinfo, dcerpc_tree, hdr->drep, - hf_dcerpc_auth_level, - &auth_info->auth_level); + offset = dissect_dcerpc_uint8(tvb, offset, pinfo, dcerpc_tree, hdr->drep, + hf_dcerpc_auth_type, + &auth_info->auth_type); + offset = dissect_dcerpc_uint8(tvb, offset, pinfo, dcerpc_tree, hdr->drep, + hf_dcerpc_auth_level, + &auth_info->auth_level); - offset = dissect_dcerpc_uint8 (tvb, offset, pinfo, dcerpc_tree, hdr->drep, - hf_dcerpc_auth_pad_len, - &auth_info->auth_pad_len); - offset = dissect_dcerpc_uint8 (tvb, offset, pinfo, dcerpc_tree, hdr->drep, - hf_dcerpc_auth_rsrvd, NULL); - offset = dissect_dcerpc_uint32 (tvb, offset, pinfo, dcerpc_tree, hdr->drep, - hf_dcerpc_auth_ctx_id, NULL); + offset = dissect_dcerpc_uint8(tvb, offset, pinfo, dcerpc_tree, hdr->drep, + hf_dcerpc_auth_pad_len, + &auth_info->auth_pad_len); + offset = dissect_dcerpc_uint8(tvb, offset, pinfo, dcerpc_tree, hdr->drep, + hf_dcerpc_auth_rsrvd, NULL); + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, dcerpc_tree, hdr->drep, + hf_dcerpc_auth_ctx_id, NULL); /* * Dissect the authentication data. @@ -2736,7 +2745,7 @@ dissect_dcerpc_cn_auth (tvbuff_t *tvb, int stub_offset, packet_info *pinfo, dissect_auth_verf(auth_tvb, pinfo, dcerpc_tree, auth_fns, hdr, auth_info); else - proto_tree_add_text (dcerpc_tree, tvb, offset, hdr->auth_len, + proto_tree_add_text(dcerpc_tree, tvb, offset, hdr->auth_len, "Auth Credentials"); } @@ -2761,9 +2770,9 @@ dissect_dcerpc_cn_auth (tvbuff_t *tvb, int stub_offset, packet_info *pinfo, * as well in the future. */ -guint16 dcerpc_get_transport_salt (packet_info *pinfo) +guint16 dcerpc_get_transport_salt(packet_info *pinfo) { - switch(pinfo->dcetransporttype){ + switch (pinfo->dcetransporttype) { case DCE_CN_TRANSPORT_SMBPIPE: /* DCERPC over smb */ return pinfo->dcetransportsalt; @@ -2778,35 +2787,35 @@ guint16 dcerpc_get_transport_salt (packet_info *pinfo) */ static void -dissect_dcerpc_cn_bind (tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *dcerpc_tree, e_dce_cn_common_hdr_t *hdr) +dissect_dcerpc_cn_bind(tvbuff_t *tvb, gint offset, packet_info *pinfo, + proto_tree *dcerpc_tree, e_dce_cn_common_hdr_t *hdr) { - conversation_t *conv = find_or_create_conversation(pinfo); - guint8 num_ctx_items = 0; - guint i; - guint16 ctx_id; - guint8 num_trans_items; - guint j; - e_uuid_t if_id; - e_uuid_t trans_id; - guint32 trans_ver; - guint16 if_ver, if_ver_minor; - dcerpc_auth_info auth_info; - char *uuid_str; - const char *uuid_name = NULL; - proto_item *iface_item = NULL; + conversation_t *conv = find_or_create_conversation(pinfo); + guint8 num_ctx_items = 0; + guint i; + guint16 ctx_id; + guint8 num_trans_items; + guint j; + e_uuid_t if_id; + e_uuid_t trans_id; + guint32 trans_ver; + guint16 if_ver, if_ver_minor; + dcerpc_auth_info auth_info; + char *uuid_str; + const char *uuid_name = NULL; + proto_item *iface_item = NULL; - offset = dissect_dcerpc_uint16 (tvb, offset, pinfo, dcerpc_tree, hdr->drep, - hf_dcerpc_cn_max_xmit, NULL); + offset = dissect_dcerpc_uint16(tvb, offset, pinfo, dcerpc_tree, hdr->drep, + hf_dcerpc_cn_max_xmit, NULL); - offset = dissect_dcerpc_uint16 (tvb, offset, pinfo, dcerpc_tree, hdr->drep, - hf_dcerpc_cn_max_recv, NULL); + offset = dissect_dcerpc_uint16(tvb, offset, pinfo, dcerpc_tree, hdr->drep, + hf_dcerpc_cn_max_recv, NULL); - offset = dissect_dcerpc_uint32 (tvb, offset, pinfo, dcerpc_tree, hdr->drep, - hf_dcerpc_cn_assoc_group, NULL); + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, dcerpc_tree, hdr->drep, + hf_dcerpc_cn_assoc_group, NULL); - offset = dissect_dcerpc_uint8 (tvb, offset, pinfo, dcerpc_tree, hdr->drep, - hf_dcerpc_cn_num_ctx_items, &num_ctx_items); + offset = dissect_dcerpc_uint8(tvb, offset, pinfo, dcerpc_tree, hdr->drep, + hf_dcerpc_cn_num_ctx_items, &num_ctx_items); /* padding */ offset += 3; @@ -2818,8 +2827,8 @@ dissect_dcerpc_cn_bind (tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tree *ctx_tree = NULL, *iface_tree = NULL; gint ctx_offset = offset; - dissect_dcerpc_uint16 (tvb, offset, pinfo, NULL, hdr->drep, - hf_dcerpc_cn_ctx_id, &ctx_id); + dissect_dcerpc_uint16(tvb, offset, pinfo, NULL, hdr->drep, + hf_dcerpc_cn_ctx_id, &ctx_id); /* save context ID for use with dcerpc_add_conv_to_bind_table() */ /* (if we have multiple contexts, this might cause "decode as" @@ -2833,19 +2842,19 @@ dissect_dcerpc_cn_bind (tvbuff_t *tvb, gint offset, packet_info *pinfo, ctx_tree = proto_item_add_subtree(ctx_item, ett_dcerpc_cn_ctx); } - offset = dissect_dcerpc_uint16 (tvb, offset, pinfo, ctx_tree, hdr->drep, - hf_dcerpc_cn_ctx_id, &ctx_id); - offset = dissect_dcerpc_uint8 (tvb, offset, pinfo, ctx_tree, hdr->drep, - hf_dcerpc_cn_num_trans_items, &num_trans_items); + offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ctx_tree, hdr->drep, + hf_dcerpc_cn_ctx_id, &ctx_id); + offset = dissect_dcerpc_uint8(tvb, offset, pinfo, ctx_tree, hdr->drep, + hf_dcerpc_cn_num_trans_items, &num_trans_items); - if(dcerpc_tree) { + if (dcerpc_tree) { proto_item_append_text(ctx_item, "[%u]: ID:%u", i+1, ctx_id); } /* padding */ offset += 1; - dcerpc_tvb_get_uuid (tvb, offset, hdr->drep, &if_id); + dcerpc_tvb_get_uuid(tvb, offset, hdr->drep, &if_id); if (ctx_tree) { iface_item = proto_tree_add_item(ctx_tree, hf_dcerpc_cn_bind_abstract_syntax, tvb, offset, 0, ENC_NA); @@ -2853,28 +2862,28 @@ dissect_dcerpc_cn_bind (tvbuff_t *tvb, gint offset, packet_info *pinfo, uuid_str = guid_to_str((e_guid_t*)&if_id); uuid_name = guids_get_uuid_name(&if_id); - if(uuid_name) { - proto_tree_add_guid_format (iface_tree, hf_dcerpc_cn_bind_if_id, tvb, - offset, 16, (e_guid_t *) &if_id, "Interface: %s UUID: %s", uuid_name, uuid_str); + if (uuid_name) { + proto_tree_add_guid_format(iface_tree, hf_dcerpc_cn_bind_if_id, tvb, + offset, 16, (e_guid_t *) &if_id, "Interface: %s UUID: %s", uuid_name, uuid_str); proto_item_append_text(iface_item, ": %s", uuid_name); } else { - proto_tree_add_guid_format (iface_tree, hf_dcerpc_cn_bind_if_id, tvb, - offset, 16, (e_guid_t *) &if_id, "Interface UUID: %s", uuid_str); + proto_tree_add_guid_format(iface_tree, hf_dcerpc_cn_bind_if_id, tvb, + offset, 16, (e_guid_t *) &if_id, "Interface UUID: %s", uuid_str); proto_item_append_text(iface_item, ": %s", uuid_str); } } offset += 16; if (hdr->drep[0] & DREP_LITTLE_ENDIAN) { - offset = dissect_dcerpc_uint16 (tvb, offset, pinfo, iface_tree, hdr->drep, - hf_dcerpc_cn_bind_if_ver, &if_ver); - offset = dissect_dcerpc_uint16 (tvb, offset, pinfo, iface_tree, hdr->drep, - hf_dcerpc_cn_bind_if_ver_minor, &if_ver_minor); + offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iface_tree, hdr->drep, + hf_dcerpc_cn_bind_if_ver, &if_ver); + offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iface_tree, hdr->drep, + hf_dcerpc_cn_bind_if_ver_minor, &if_ver_minor); } else { - offset = dissect_dcerpc_uint16 (tvb, offset, pinfo, iface_tree, hdr->drep, - hf_dcerpc_cn_bind_if_ver_minor, &if_ver_minor); - offset = dissect_dcerpc_uint16 (tvb, offset, pinfo, iface_tree, hdr->drep, - hf_dcerpc_cn_bind_if_ver, &if_ver); + offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iface_tree, hdr->drep, + hf_dcerpc_cn_bind_if_ver_minor, &if_ver_minor); + offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iface_tree, hdr->drep, + hf_dcerpc_cn_bind_if_ver, &if_ver); } if (ctx_tree) { @@ -2887,7 +2896,7 @@ dissect_dcerpc_cn_bind (tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tree *trans_tree = NULL; proto_item *trans_item = NULL; - dcerpc_tvb_get_uuid (tvb, offset, hdr->drep, &trans_id); + dcerpc_tvb_get_uuid(tvb, offset, hdr->drep, &trans_id); if (ctx_tree) { trans_item = proto_tree_add_item(ctx_tree, hf_dcerpc_cn_bind_trans_syntax, tvb, offset, 0, ENC_NA); @@ -2896,56 +2905,57 @@ dissect_dcerpc_cn_bind (tvbuff_t *tvb, gint offset, packet_info *pinfo, uuid_str = guid_to_str((e_guid_t *) &trans_id); uuid_name = guids_get_uuid_name(&trans_id); - if(uuid_name) { - proto_tree_add_guid_format (trans_tree, hf_dcerpc_cn_bind_trans_id, tvb, - offset, 16, (e_guid_t *) &trans_id, "Transport Syntax: %s UUID:%s", uuid_name, uuid_str); + if (uuid_name) { + proto_tree_add_guid_format(trans_tree, hf_dcerpc_cn_bind_trans_id, tvb, + offset, 16, (e_guid_t *) &trans_id, + "Transport Syntax: %s UUID:%s", uuid_name, uuid_str); proto_item_append_text(trans_item, "[%u]: %s", j+1, uuid_name); } else { - proto_tree_add_guid_format (trans_tree, hf_dcerpc_cn_bind_trans_id, tvb, - offset, 16, (e_guid_t *) &trans_id, "Transport Syntax: %s", uuid_str); + proto_tree_add_guid_format(trans_tree, hf_dcerpc_cn_bind_trans_id, tvb, + offset, 16, (e_guid_t *) &trans_id, "Transport Syntax: %s", uuid_str); proto_item_append_text(trans_item, "[%u]: %s", j+1, uuid_str); } } offset += 16; - offset = dissect_dcerpc_uint32 (tvb, offset, pinfo, trans_tree, hdr->drep, - hf_dcerpc_cn_bind_trans_ver, &trans_ver); + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, trans_tree, hdr->drep, + hf_dcerpc_cn_bind_trans_ver, &trans_ver); if (ctx_tree) { proto_item_set_len(trans_item, 20); proto_item_append_text(trans_item, " V%u", trans_ver); } } - /* if this is the first time we see this packet, we need to + /* if this is the first time we've seen this packet, we need to update the dcerpc_binds table so that any later calls can match to the interface. XXX We assume that BINDs will NEVER be fragmented. */ - if(!(pinfo->fd->flags.visited)){ - dcerpc_bind_key *key; + if (!(pinfo->fd->flags.visited)) { + dcerpc_bind_key *key; dcerpc_bind_value *value; - key = se_alloc (sizeof (dcerpc_bind_key)); + key = se_alloc(sizeof (dcerpc_bind_key)); key->conv = conv; key->ctx_id = ctx_id; key->smb_fid = dcerpc_get_transport_salt(pinfo); - value = se_alloc (sizeof (dcerpc_bind_value)); + value = se_alloc(sizeof (dcerpc_bind_value)); value->uuid = if_id; value->ver = if_ver; - value->transport=trans_id; + value->transport = trans_id; /* add this entry to the bind table */ - g_hash_table_insert (dcerpc_binds, key, value); + g_hash_table_insert(dcerpc_binds, key, value); } - if (i > 0) - col_append_fstr(pinfo->cinfo, COL_INFO, ","); - col_append_fstr(pinfo->cinfo, COL_INFO, " %s V%u.%u (%s)", - guids_resolve_uuid_to_str(&if_id), if_ver, if_ver_minor, - guids_resolve_uuid_to_str(&trans_id)); + if (i > 0) + col_append_fstr(pinfo->cinfo, COL_INFO, ","); + col_append_fstr(pinfo->cinfo, COL_INFO, " %s V%u.%u (%s)", + guids_resolve_uuid_to_str(&if_id), if_ver, if_ver_minor, + guids_resolve_uuid_to_str(&trans_id)); - if(ctx_tree) { + if (ctx_tree) { proto_item_set_len(ctx_item, offset - ctx_offset); } } @@ -2955,39 +2965,39 @@ dissect_dcerpc_cn_bind (tvbuff_t *tvb, gint offset, packet_info *pinfo, * an authentication header, and associate it with an authentication * context, so subsequent PDUs can use that context. */ - dissect_dcerpc_cn_auth (tvb, offset, pinfo, dcerpc_tree, hdr, TRUE, &auth_info); + dissect_dcerpc_cn_auth(tvb, offset, pinfo, dcerpc_tree, hdr, TRUE, &auth_info); } static void -dissect_dcerpc_cn_bind_ack (tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *dcerpc_tree, e_dce_cn_common_hdr_t *hdr) +dissect_dcerpc_cn_bind_ack(tvbuff_t *tvb, gint offset, packet_info *pinfo, + proto_tree *dcerpc_tree, e_dce_cn_common_hdr_t *hdr) { - guint16 max_xmit, max_recv; - guint16 sec_addr_len; - guint8 num_results; - guint i; - guint16 result = 0; - guint16 reason = 0; - e_uuid_t trans_id; - guint32 trans_ver; - dcerpc_auth_info auth_info; - const char *uuid_name = NULL; + guint16 max_xmit, max_recv; + guint16 sec_addr_len; + guint8 num_results; + guint i; + guint16 result = 0; + guint16 reason = 0; + e_uuid_t trans_id; + guint32 trans_ver; + dcerpc_auth_info auth_info; + const char *uuid_name = NULL; - offset = dissect_dcerpc_uint16 (tvb, offset, pinfo, dcerpc_tree, hdr->drep, - hf_dcerpc_cn_max_xmit, &max_xmit); + offset = dissect_dcerpc_uint16(tvb, offset, pinfo, dcerpc_tree, hdr->drep, + hf_dcerpc_cn_max_xmit, &max_xmit); - offset = dissect_dcerpc_uint16 (tvb, offset, pinfo, dcerpc_tree, hdr->drep, - hf_dcerpc_cn_max_recv, &max_recv); + offset = dissect_dcerpc_uint16(tvb, offset, pinfo, dcerpc_tree, hdr->drep, + hf_dcerpc_cn_max_recv, &max_recv); - offset = dissect_dcerpc_uint32 (tvb, offset, pinfo, dcerpc_tree, hdr->drep, - hf_dcerpc_cn_assoc_group, NULL); + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, dcerpc_tree, hdr->drep, + hf_dcerpc_cn_assoc_group, NULL); - offset = dissect_dcerpc_uint16 (tvb, offset, pinfo, dcerpc_tree, hdr->drep, - hf_dcerpc_cn_sec_addr_len, &sec_addr_len); + offset = dissect_dcerpc_uint16(tvb, offset, pinfo, dcerpc_tree, hdr->drep, + hf_dcerpc_cn_sec_addr_len, &sec_addr_len); if (sec_addr_len != 0) { tvb_ensure_bytes_exist(tvb, offset, sec_addr_len); - proto_tree_add_item (dcerpc_tree, hf_dcerpc_cn_sec_addr, tvb, offset, - sec_addr_len, ENC_ASCII|ENC_NA); + proto_tree_add_item(dcerpc_tree, hf_dcerpc_cn_sec_addr, tvb, offset, + sec_addr_len, ENC_ASCII|ENC_NA); offset += sec_addr_len; } @@ -2995,31 +3005,31 @@ dissect_dcerpc_cn_bind_ack (tvbuff_t *tvb, gint offset, packet_info *pinfo, offset += 4 - offset % 4; } - offset = dissect_dcerpc_uint8 (tvb, offset, pinfo, dcerpc_tree, hdr->drep, - hf_dcerpc_cn_num_results, &num_results); + offset = dissect_dcerpc_uint8(tvb, offset, pinfo, dcerpc_tree, hdr->drep, + hf_dcerpc_cn_num_results, &num_results); /* padding */ offset += 3; col_append_fstr(pinfo->cinfo, COL_INFO, ", max_xmit: %u max_recv: %u, %u results:", - max_xmit, max_recv, num_results); + max_xmit, max_recv, num_results); for (i = 0; i < num_results; i++) { proto_tree *ctx_tree = NULL; - if(dcerpc_tree){ + if (dcerpc_tree) { proto_item *ctx_item; ctx_item = proto_tree_add_text(dcerpc_tree, tvb, offset, 24, "Context ID[%u]", i+1); ctx_tree = proto_item_add_subtree(ctx_item, ett_dcerpc_cn_ctx); } - offset = dissect_dcerpc_uint16 (tvb, offset, pinfo, ctx_tree, - hdr->drep, hf_dcerpc_cn_ack_result, - &result); + offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ctx_tree, + hdr->drep, hf_dcerpc_cn_ack_result, + &result); if (result != 0) { - offset = dissect_dcerpc_uint16 (tvb, offset, pinfo, ctx_tree, - hdr->drep, hf_dcerpc_cn_ack_reason, - &reason); + offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ctx_tree, + hdr->drep, hf_dcerpc_cn_ack_reason, + &reason); } else { /* * The reason for rejection isn't meaningful, and often isn't @@ -3028,59 +3038,59 @@ dissect_dcerpc_cn_bind_ack (tvbuff_t *tvb, gint offset, packet_info *pinfo, offset += 2; } - dcerpc_tvb_get_uuid (tvb, offset, hdr->drep, &trans_id); + dcerpc_tvb_get_uuid(tvb, offset, hdr->drep, &trans_id); uuid_name = guids_get_uuid_name(&trans_id); if (ctx_tree) { - proto_tree_add_guid_format (ctx_tree, hf_dcerpc_cn_ack_trans_id, tvb, - offset, 16, (e_guid_t *) &trans_id, "Transfer Syntax: %s", - uuid_name?uuid_name:guid_to_str((e_guid_t *) &trans_id)); + proto_tree_add_guid_format(ctx_tree, hf_dcerpc_cn_ack_trans_id, tvb, + offset, 16, (e_guid_t *) &trans_id, "Transfer Syntax: %s", + uuid_name?uuid_name:guid_to_str((e_guid_t *) &trans_id)); } offset += 16; - offset = dissect_dcerpc_uint32 (tvb, offset, pinfo, ctx_tree, hdr->drep, - hf_dcerpc_cn_ack_trans_ver, &trans_ver); + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ctx_tree, hdr->drep, + hf_dcerpc_cn_ack_trans_ver, &trans_ver); - if (i > 0) - col_append_fstr(pinfo->cinfo, COL_INFO, ","); - col_append_fstr(pinfo->cinfo, COL_INFO, " %s", - val_to_str(result, p_cont_result_vals, "Unknown result (%u)")); + if (i > 0) + col_append_fstr(pinfo->cinfo, COL_INFO, ","); + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", + val_to_str(result, p_cont_result_vals, "Unknown result (%u)")); } /* * XXX - do we need to do anything with the authentication level * we get back from this? */ - dissect_dcerpc_cn_auth (tvb, offset, pinfo, dcerpc_tree, hdr, TRUE, &auth_info); + dissect_dcerpc_cn_auth(tvb, offset, pinfo, dcerpc_tree, hdr, TRUE, &auth_info); } static void -dissect_dcerpc_cn_bind_nak (tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *dcerpc_tree, e_dce_cn_common_hdr_t *hdr) +dissect_dcerpc_cn_bind_nak(tvbuff_t *tvb, gint offset, packet_info *pinfo, + proto_tree *dcerpc_tree, e_dce_cn_common_hdr_t *hdr) { guint16 reason; - guint8 num_protocols; - guint i; + guint8 num_protocols; + guint i; - offset = dissect_dcerpc_uint16 (tvb, offset, pinfo, dcerpc_tree, - hdr->drep, hf_dcerpc_cn_reject_reason, - &reason); + offset = dissect_dcerpc_uint16(tvb, offset, pinfo, dcerpc_tree, + hdr->drep, hf_dcerpc_cn_reject_reason, + &reason); - col_append_fstr (pinfo->cinfo, COL_INFO, " reason: %s", - val_to_str(reason, reject_reason_vals, "Unknown (%u)")); + col_append_fstr(pinfo->cinfo, COL_INFO, " reason: %s", + val_to_str(reason, reject_reason_vals, "Unknown (%u)")); if (reason == PROTOCOL_VERSION_NOT_SUPPORTED) { - offset = dissect_dcerpc_uint8 (tvb, offset, pinfo, dcerpc_tree, hdr->drep, - hf_dcerpc_cn_num_protocols, - &num_protocols); + offset = dissect_dcerpc_uint8(tvb, offset, pinfo, dcerpc_tree, hdr->drep, + hf_dcerpc_cn_num_protocols, + &num_protocols); for (i = 0; i < num_protocols; i++) { - offset = dissect_dcerpc_uint8 (tvb, offset, pinfo, dcerpc_tree, - hdr->drep, hf_dcerpc_cn_protocol_ver_major, - NULL); - offset = dissect_dcerpc_uint8 (tvb, offset, pinfo, dcerpc_tree, - hdr->drep, hf_dcerpc_cn_protocol_ver_minor, - NULL); + offset = dissect_dcerpc_uint8(tvb, offset, pinfo, dcerpc_tree, + hdr->drep, hf_dcerpc_cn_protocol_ver_major, + NULL); + offset = dissect_dcerpc_uint8(tvb, offset, pinfo, dcerpc_tree, + hdr->drep, hf_dcerpc_cn_protocol_ver_minor, + NULL); } } } @@ -3094,10 +3104,10 @@ static const char * fragment_type(guint8 flags) { static const char* t[4] = { - "Mid", - "1st", - "Last", - "Single" + "Mid", + "1st", + "Last", + "Single" }; return t[flags & PFC_FRAG_MASK]; } @@ -3105,15 +3115,15 @@ fragment_type(guint8 flags) /* Dissect stub data (payload) of a DCERPC packet. */ static void -dissect_dcerpc_cn_stub (tvbuff_t *tvb, int offset, packet_info *pinfo, - proto_tree *dcerpc_tree, proto_tree *tree, - e_dce_cn_common_hdr_t *hdr, dcerpc_info *di, - dcerpc_auth_info *auth_info, guint32 alloc_hint _U_, - guint32 frame) +dissect_dcerpc_cn_stub(tvbuff_t *tvb, int offset, packet_info *pinfo, + proto_tree *dcerpc_tree, proto_tree *tree, + e_dce_cn_common_hdr_t *hdr, dcerpc_info *di, + dcerpc_auth_info *auth_info, guint32 alloc_hint _U_, + guint32 frame) { - gint length, reported_length; - gboolean save_fragmented; - fragment_data *fd_head=NULL; + gint length, reported_length; + gboolean save_fragmented; + fragment_data *fd_head = NULL; tvbuff_t *auth_tvb, *payload_tvb, *decrypted_tvb; proto_item *pi; @@ -3135,13 +3145,13 @@ dissect_dcerpc_cn_stub (tvbuff_t *tvb, int offset, packet_info *pinfo, length = reported_length; payload_tvb = tvb_new_subset(tvb, offset, length, reported_length); - auth_tvb=NULL; + auth_tvb = NULL; /*don't bother if we don't have the entire tvb */ /*XXX we should really make sure we calculate auth_info->auth_data and use that one instead of this auth_tvb hack */ - if(tvb_length(tvb)==tvb_reported_length(tvb)){ - if(tvb_length_remaining(tvb, offset+length)>8){ + if (tvb_length(tvb) == tvb_reported_length(tvb)) { + if (tvb_length_remaining(tvb, offset+length) > 8) { auth_tvb = tvb_new_subset_remaining(tvb, offset+length+8); } } @@ -3149,7 +3159,7 @@ dissect_dcerpc_cn_stub (tvbuff_t *tvb, int offset, packet_info *pinfo, /* Decrypt the PDU if it is encrypted */ if (auth_info->auth_type && - auth_info->auth_level == DCE_C_AUTHN_LEVEL_PKT_PRIVACY) { + (auth_info->auth_level == DCE_C_AUTHN_LEVEL_PKT_PRIVACY)) { /* * We know the authentication type, and the authentication * level is "Packet privacy", meaning the payload is @@ -3163,7 +3173,7 @@ dissect_dcerpc_cn_stub (tvbuff_t *tvb, int offset, packet_info *pinfo, * so we call it in order to have a chance to decipher the data */ if (DCE_C_RPC_AUTHN_PROTOCOL_SEC_CHAN == auth_info->auth_type) { - dissect_dcerpc_cn_auth (tvb, offset, pinfo, dcerpc_tree, hdr, TRUE, auth_info); + dissect_dcerpc_cn_auth(tvb, offset, pinfo, dcerpc_tree, hdr, TRUE, auth_info); } if ((auth_fns = get_auth_subdissector_fns( @@ -3194,7 +3204,7 @@ dissect_dcerpc_cn_stub (tvbuff_t *tvb, int offset, packet_info *pinfo, decrypted_tvb = payload_tvb; /* if this packet is not fragmented, just dissect it and exit */ - if(PFC_NOT_FRAGMENTED(hdr)){ + if (PFC_NOT_FRAGMENTED(hdr)) { pinfo->fragmented = FALSE; dcerpc_try_handoff( @@ -3218,14 +3228,14 @@ dissect_dcerpc_cn_stub (tvbuff_t *tvb, int offset, packet_info *pinfo, XXX - if we're not doing reassembly, can we decrypt an encrypted stub? */ - if( (!dcerpc_reassemble) && hdr->flags&PFC_FIRST_FRAG ){ + if ( (!dcerpc_reassemble) && (hdr->flags & PFC_FIRST_FRAG) ) { dcerpc_try_handoff( pinfo, tree, dcerpc_tree, payload_tvb, decrypted_tvb, hdr->drep, di, auth_info); - expert_add_info_format(pinfo, NULL, PI_REASSEMBLE, PI_CHAT, - "%s fragment", fragment_type(hdr->flags)); + expert_add_info_format(pinfo, NULL, PI_REASSEMBLE, PI_CHAT, + "%s fragment", fragment_type(hdr->flags)); pinfo->fragmented = save_fragmented; return; @@ -3235,8 +3245,8 @@ dissect_dcerpc_cn_stub (tvbuff_t *tvb, int offset, packet_info *pinfo, and if so dissect the full pdu. then exit */ - if(pinfo->fd->flags.visited){ - fd_head=fragment_get_reassembled(frame, dcerpc_co_reassemble_table); + if (pinfo->fd->flags.visited) { + fd_head = fragment_get_reassembled(frame, dcerpc_co_reassemble_table); goto end_cn_stub; } @@ -3244,13 +3254,13 @@ dissect_dcerpc_cn_stub (tvbuff_t *tvb, int offset, packet_info *pinfo, nor the first fragment then there is nothing more we can do so we just have to exit */ - if( !dcerpc_reassemble || (tvb_length(tvb)!=tvb_reported_length(tvb)) ) + if ( !dcerpc_reassemble || (tvb_length(tvb) != tvb_reported_length(tvb)) ) goto end_cn_stub; /* if we didn't get 'frame' we don't know where the PDU started and thus it is pointless to continue */ - if(!frame) + if (!frame) goto end_cn_stub; /* from now on we must attempt to reassemble the PDU @@ -3284,9 +3294,9 @@ end_cn_stub: * (multiple fragments in one PDU are possible!) * dissect the full PDU */ - if(fd_head && (fd_head->flags&FD_DEFRAGMENTED) ){ + if (fd_head && (fd_head->flags & FD_DEFRAGMENTED) ) { - if(pinfo->fd->num==fd_head->reassembled_in && (hdr->flags&PFC_LAST_FRAG) ){ + if ((pinfo->fd->num == fd_head->reassembled_in) && (hdr->flags & PFC_LAST_FRAG) ) { tvbuff_t *next_tvb; proto_item *frag_tree_item; @@ -3299,7 +3309,7 @@ end_cn_stub: /* the toplevel fragment subtree is now behind all desegmented data, * move it right behind the DCE/RPC tree */ dcerpc_tree_item = proto_tree_get_parent(dcerpc_tree); - if(frag_tree_item && dcerpc_tree_item) { + if (frag_tree_item && dcerpc_tree_item) { proto_tree_move_item(tree, dcerpc_tree_item, frag_tree_item); } @@ -3309,11 +3319,11 @@ end_cn_stub: "%s fragment, reassembled", fragment_type(hdr->flags)); - dcerpc_try_handoff (pinfo, tree, dcerpc_tree, next_tvb, - next_tvb, hdr->drep, di, auth_info); + dcerpc_try_handoff(pinfo, tree, dcerpc_tree, next_tvb, + next_tvb, hdr->drep, di, auth_info); } else { - if(decrypted_tvb){ + if (decrypted_tvb) { pi = proto_tree_add_uint(dcerpc_tree, hf_dcerpc_reassembled_in, decrypted_tvb, 0, 0, fd_head->reassembled_in); } else { @@ -3322,7 +3332,7 @@ end_cn_stub: } PROTO_ITEM_SET_GENERATED(pi); parent_pi = proto_tree_get_parent(dcerpc_tree); - if(parent_pi != NULL) { + if (parent_pi != NULL) { proto_item_append_text(parent_pi, ", [Reas: #%u]", fd_head->reassembled_in); } col_append_fstr(pinfo->cinfo, COL_INFO, @@ -3336,10 +3346,10 @@ end_cn_stub: expert_add_info_format(pinfo, NULL, PI_REASSEMBLE, PI_CHAT, "%s fragment", fragment_type(hdr->flags)); - if(decrypted_tvb){ - show_stub_data (decrypted_tvb, 0, tree, auth_info, FALSE); + if (decrypted_tvb) { + show_stub_data(decrypted_tvb, 0, tree, auth_info, FALSE); } else { - show_stub_data (payload_tvb, 0, tree, auth_info, TRUE); + show_stub_data(payload_tvb, 0, tree, auth_info, TRUE); } } @@ -3359,10 +3369,10 @@ struct _dcerpc_bind_value * dcerpc_add_conv_to_bind_table(decode_dcerpc_bind_values_t *binding) { dcerpc_bind_value *bind_value; - dcerpc_bind_key *key; - conversation_t *conv; + dcerpc_bind_key *key; + conversation_t *conv; - conv = find_conversation ( + conv = find_conversation( 0, &binding->addr_a, &binding->addr_b, @@ -3372,7 +3382,7 @@ dcerpc_add_conv_to_bind_table(decode_dcerpc_bind_values_t *binding) 0); if (!conv) { - conv = conversation_new ( + conv = conversation_new( 0, &binding->addr_a, &binding->addr_b, @@ -3382,14 +3392,14 @@ dcerpc_add_conv_to_bind_table(decode_dcerpc_bind_values_t *binding) 0); } - bind_value = se_alloc (sizeof (dcerpc_bind_value)); + bind_value = se_alloc(sizeof (dcerpc_bind_value)); bind_value->uuid = binding->uuid; bind_value->ver = binding->ver; /* For now, assume all DCE/RPC we pick from "decode as" is using standard ndr and not ndr64. We should make this selectable from the dialog in the future */ - bind_value->transport=uuid_data_repr_proto; + bind_value->transport = uuid_data_repr_proto; key = se_alloc(sizeof (dcerpc_bind_key)); key->conv = conv; @@ -3404,44 +3414,44 @@ dcerpc_add_conv_to_bind_table(decode_dcerpc_bind_values_t *binding) } static void -dissect_dcerpc_cn_rqst (tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *dcerpc_tree, proto_tree *tree, - e_dce_cn_common_hdr_t *hdr) +dissect_dcerpc_cn_rqst(tvbuff_t *tvb, gint offset, packet_info *pinfo, + proto_tree *dcerpc_tree, proto_tree *tree, + e_dce_cn_common_hdr_t *hdr) { - conversation_t *conv; - guint16 ctx_id; - guint16 opnum; - e_uuid_t obj_id = DCERPC_UUID_NULL; - dcerpc_auth_info auth_info; - guint32 alloc_hint; - proto_item *pi; - proto_item *parent_pi; + conversation_t *conv; + guint16 ctx_id; + guint16 opnum; + e_uuid_t obj_id = DCERPC_UUID_NULL; + dcerpc_auth_info auth_info; + guint32 alloc_hint; + proto_item *pi; + proto_item *parent_pi; - offset = dissect_dcerpc_uint32 (tvb, offset, pinfo, dcerpc_tree, hdr->drep, - hf_dcerpc_cn_alloc_hint, &alloc_hint); + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, dcerpc_tree, hdr->drep, + hf_dcerpc_cn_alloc_hint, &alloc_hint); - offset = dissect_dcerpc_uint16 (tvb, offset, pinfo, dcerpc_tree, hdr->drep, - hf_dcerpc_cn_ctx_id, &ctx_id); + offset = dissect_dcerpc_uint16(tvb, offset, pinfo, dcerpc_tree, hdr->drep, + hf_dcerpc_cn_ctx_id, &ctx_id); parent_pi = proto_tree_get_parent(dcerpc_tree); - if(parent_pi != NULL) { + if (parent_pi != NULL) { proto_item_append_text(parent_pi, " Ctx: %u", ctx_id); } - offset = dissect_dcerpc_uint16 (tvb, offset, pinfo, dcerpc_tree, hdr->drep, - hf_dcerpc_opnum, &opnum); + offset = dissect_dcerpc_uint16(tvb, offset, pinfo, dcerpc_tree, hdr->drep, + hf_dcerpc_opnum, &opnum); /* save context ID for use with dcerpc_add_conv_to_bind_table() */ pinfo->dcectxid = ctx_id; - col_append_fstr (pinfo->cinfo, COL_INFO, " opnum: %u ctx_id: %u", - opnum, ctx_id); + col_append_fstr(pinfo->cinfo, COL_INFO, " opnum: %u ctx_id: %u", + opnum, ctx_id); if (hdr->flags & PFC_OBJECT_UUID) { - dcerpc_tvb_get_uuid (tvb, offset, hdr->drep, &obj_id); + dcerpc_tvb_get_uuid(tvb, offset, hdr->drep, &obj_id); if (dcerpc_tree) { - proto_tree_add_guid_format (dcerpc_tree, hf_dcerpc_obj_id, tvb, - offset, 16, (e_guid_t *) &obj_id, "Object UUID: %s", - guid_to_str((e_guid_t *) &obj_id)); + proto_tree_add_guid_format(dcerpc_tree, hf_dcerpc_obj_id, tvb, + offset, 16, (e_guid_t *) &obj_id, "Object UUID: %s", + guid_to_str((e_guid_t *) &obj_id)); } offset += 16; } @@ -3450,12 +3460,12 @@ dissect_dcerpc_cn_rqst (tvbuff_t *tvb, gint offset, packet_info *pinfo, * XXX - what if this was set when the connection was set up, * and we just have a security context? */ - dissect_dcerpc_cn_auth (tvb, offset, pinfo, dcerpc_tree, hdr, FALSE, &auth_info); + dissect_dcerpc_cn_auth(tvb, offset, pinfo, dcerpc_tree, hdr, FALSE, &auth_info); - conv = find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); + conv = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, + pinfo->srcport, pinfo->destport, 0); if (!conv) - show_stub_data (tvb, offset, dcerpc_tree, &auth_info, TRUE); + show_stub_data(tvb, offset, dcerpc_tree, &auth_info, TRUE); else { dcerpc_matched_key matched_key, *new_matched_key; dcerpc_call_value *value; @@ -3468,26 +3478,26 @@ dissect_dcerpc_cn_rqst (tvbuff_t *tvb, gint offset, packet_info *pinfo, matched_key.frame = pinfo->fd->num; matched_key.call_id = hdr->call_id; value = g_hash_table_lookup(dcerpc_matched, &matched_key); - if(!value){ + if (!value) { dcerpc_bind_key bind_key; dcerpc_bind_value *bind_value; - bind_key.conv=conv; - bind_key.ctx_id=ctx_id; - bind_key.smb_fid=dcerpc_get_transport_salt(pinfo); + bind_key.conv = conv; + bind_key.ctx_id = ctx_id; + bind_key.smb_fid = dcerpc_get_transport_salt(pinfo); - if((bind_value=g_hash_table_lookup(dcerpc_binds, &bind_key)) ){ - if(!(hdr->flags&PFC_FIRST_FRAG)){ + if ((bind_value = g_hash_table_lookup(dcerpc_binds, &bind_key)) ) { + if (!(hdr->flags&PFC_FIRST_FRAG)) { dcerpc_cn_call_key call_key; dcerpc_call_value *call_value; - call_key.conv=conv; - call_key.call_id=hdr->call_id; - call_key.smb_fid=dcerpc_get_transport_salt(pinfo); - if((call_value=g_hash_table_lookup(dcerpc_cn_calls, &call_key))){ + call_key.conv = conv; + call_key.call_id = hdr->call_id; + call_key.smb_fid = dcerpc_get_transport_salt(pinfo); + if ((call_value = g_hash_table_lookup(dcerpc_cn_calls, &call_key))) { new_matched_key = se_alloc(sizeof (dcerpc_matched_key)); *new_matched_key = matched_key; - g_hash_table_insert (dcerpc_matched, new_matched_key, call_value); + g_hash_table_insert(dcerpc_matched, new_matched_key, call_value); value = call_value; } } else { @@ -3499,26 +3509,26 @@ dissect_dcerpc_cn_rqst (tvbuff_t *tvb, gint offset, packet_info *pinfo, the call to both the call table and the matched table */ - call_key=se_alloc (sizeof (dcerpc_cn_call_key)); - call_key->conv=conv; - call_key->call_id=hdr->call_id; - call_key->smb_fid=dcerpc_get_transport_salt(pinfo); + call_key = se_alloc(sizeof (dcerpc_cn_call_key)); + call_key->conv = conv; + call_key->call_id = hdr->call_id; + call_key->smb_fid = dcerpc_get_transport_salt(pinfo); /* if there is already a matching call in the table remove it so it is replaced with the new one */ - if(g_hash_table_lookup(dcerpc_cn_calls, call_key)){ + if (g_hash_table_lookup(dcerpc_cn_calls, call_key)) { g_hash_table_remove(dcerpc_cn_calls, call_key); } - call_value=se_alloc (sizeof (dcerpc_call_value)); + call_value = se_alloc(sizeof (dcerpc_call_value)); call_value->uuid = bind_value->uuid; call_value->ver = bind_value->ver; call_value->object_uuid = obj_id; call_value->opnum = opnum; - call_value->req_frame=pinfo->fd->num; - call_value->req_time=pinfo->fd->abs_ts; - call_value->rep_frame=0; - call_value->max_ptr=0; + call_value->req_frame = pinfo->fd->num; + call_value->req_time = pinfo->fd->abs_ts; + call_value->rep_frame = 0; + call_value->max_ptr = 0; call_value->se_data = NULL; call_value->private_data = NULL; call_value->pol = NULL; @@ -3527,11 +3537,11 @@ dissect_dcerpc_cn_rqst (tvbuff_t *tvb, gint offset, packet_info *pinfo, call_value->flags |= DCERPC_IS_NDR64; } - g_hash_table_insert (dcerpc_cn_calls, call_key, call_value); + g_hash_table_insert(dcerpc_cn_calls, call_key, call_value); new_matched_key = se_alloc(sizeof (dcerpc_matched_key)); *new_matched_key = matched_key; - g_hash_table_insert (dcerpc_matched, new_matched_key, call_value); + g_hash_table_insert(dcerpc_matched, new_matched_key, call_value); value = call_value; } } @@ -3540,7 +3550,7 @@ dissect_dcerpc_cn_rqst (tvbuff_t *tvb, gint offset, packet_info *pinfo, if (value) { dcerpc_info *di; - di=get_next_di(); + di = get_next_di(); /* handoff this call */ di->conv = conv; di->call_id = hdr->call_id; @@ -3549,16 +3559,16 @@ dissect_dcerpc_cn_rqst (tvbuff_t *tvb, gint offset, packet_info *pinfo, di->call_data = value; di->hf_index = -1; - if(value->rep_frame!=0){ + if (value->rep_frame != 0) { pi = proto_tree_add_uint(dcerpc_tree, hf_dcerpc_response_in, tvb, 0, 0, value->rep_frame); PROTO_ITEM_SET_GENERATED(pi); - if(parent_pi != NULL) { + if (parent_pi != NULL) { proto_item_append_text(parent_pi, ", [Resp: #%u]", value->rep_frame); } } - dissect_dcerpc_cn_stub (tvb, offset, pinfo, dcerpc_tree, tree, + dissect_dcerpc_cn_stub(tvb, offset, pinfo, dcerpc_tree, tree, hdr, di, &auth_info, alloc_hint, value->req_frame); } else { @@ -3567,46 +3577,46 @@ dissect_dcerpc_cn_rqst (tvbuff_t *tvb, gint offset, packet_info *pinfo, PROTO_ITEM_SET_GENERATED(pi); expert_add_info_format(pinfo, pi, PI_UNDECODED, PI_NOTE, "No bind info for interface Context ID:%u", ctx_id); - show_stub_data (tvb, offset, dcerpc_tree, &auth_info, TRUE); + show_stub_data(tvb, offset, dcerpc_tree, &auth_info, TRUE); } } /* Dissect the verifier */ - dissect_dcerpc_verifier (tvb, pinfo, dcerpc_tree, hdr, &auth_info); + dissect_dcerpc_verifier(tvb, pinfo, dcerpc_tree, hdr, &auth_info); } static void -dissect_dcerpc_cn_resp (tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *dcerpc_tree, proto_tree *tree, - e_dce_cn_common_hdr_t *hdr) +dissect_dcerpc_cn_resp(tvbuff_t *tvb, gint offset, packet_info *pinfo, + proto_tree *dcerpc_tree, proto_tree *tree, + e_dce_cn_common_hdr_t *hdr) { - dcerpc_call_value *value = NULL; - conversation_t *conv; - guint16 ctx_id; - dcerpc_auth_info auth_info; - guint32 alloc_hint; - proto_item *pi; - proto_item *parent_pi; - e_uuid_t obj_id_null = DCERPC_UUID_NULL; + dcerpc_call_value *value = NULL; + conversation_t *conv; + guint16 ctx_id; + dcerpc_auth_info auth_info; + guint32 alloc_hint; + proto_item *pi; + proto_item *parent_pi; + e_uuid_t obj_id_null = DCERPC_UUID_NULL; - offset = dissect_dcerpc_uint32 (tvb, offset, pinfo, dcerpc_tree, hdr->drep, - hf_dcerpc_cn_alloc_hint, &alloc_hint); + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, dcerpc_tree, hdr->drep, + hf_dcerpc_cn_alloc_hint, &alloc_hint); - offset = dissect_dcerpc_uint16 (tvb, offset, pinfo, dcerpc_tree, hdr->drep, - hf_dcerpc_cn_ctx_id, &ctx_id); + offset = dissect_dcerpc_uint16(tvb, offset, pinfo, dcerpc_tree, hdr->drep, + hf_dcerpc_cn_ctx_id, &ctx_id); parent_pi = proto_tree_get_parent(dcerpc_tree); - if(parent_pi != NULL) { + if (parent_pi != NULL) { proto_item_append_text(parent_pi, " Ctx: %u", ctx_id); } /* save context ID for use with dcerpc_add_conv_to_bind_table() */ pinfo->dcectxid = ctx_id; - col_append_fstr (pinfo->cinfo, COL_INFO, " ctx_id: %u", ctx_id); + col_append_fstr(pinfo->cinfo, COL_INFO, " ctx_id: %u", ctx_id); - offset = dissect_dcerpc_uint8 (tvb, offset, pinfo, dcerpc_tree, hdr->drep, - hf_dcerpc_cn_cancel_count, NULL); + offset = dissect_dcerpc_uint8(tvb, offset, pinfo, dcerpc_tree, hdr->drep, + hf_dcerpc_cn_cancel_count, NULL); /* padding */ offset++; @@ -3614,14 +3624,14 @@ dissect_dcerpc_cn_resp (tvbuff_t *tvb, gint offset, packet_info *pinfo, * XXX - what if this was set when the connection was set up, * and we just have a security context? */ - dissect_dcerpc_cn_auth (tvb, offset, pinfo, dcerpc_tree, hdr, FALSE, &auth_info); + dissect_dcerpc_cn_auth(tvb, offset, pinfo, dcerpc_tree, hdr, FALSE, &auth_info); - conv = find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); + conv = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, + pinfo->srcport, pinfo->destport, 0); if (!conv) { /* no point in creating one here, really */ - show_stub_data (tvb, offset, dcerpc_tree, &auth_info, TRUE); + show_stub_data(tvb, offset, dcerpc_tree, &auth_info, TRUE); } else { dcerpc_matched_key matched_key, *new_matched_key; @@ -3632,25 +3642,25 @@ dissect_dcerpc_cn_resp (tvbuff_t *tvb, gint offset, packet_info *pinfo, */ matched_key.frame = pinfo->fd->num; matched_key.call_id = hdr->call_id; - value=g_hash_table_lookup(dcerpc_matched, &matched_key); - if(!value){ + value = g_hash_table_lookup(dcerpc_matched, &matched_key); + if (!value) { dcerpc_cn_call_key call_key; dcerpc_call_value *call_value; - call_key.conv=conv; - call_key.call_id=hdr->call_id; - call_key.smb_fid=dcerpc_get_transport_salt(pinfo); + call_key.conv = conv; + call_key.call_id = hdr->call_id; + call_key.smb_fid = dcerpc_get_transport_salt(pinfo); - if((call_value=g_hash_table_lookup(dcerpc_cn_calls, &call_key))){ + if ((call_value = g_hash_table_lookup(dcerpc_cn_calls, &call_key))) { /* extra sanity check, only match them if the reply came after the request */ - if(call_value->req_framefd->num){ + if (call_value->req_framefd->num) { new_matched_key = se_alloc(sizeof (dcerpc_matched_key)); *new_matched_key = matched_key; - g_hash_table_insert (dcerpc_matched, new_matched_key, call_value); + g_hash_table_insert(dcerpc_matched, new_matched_key, call_value); value = call_value; - if(call_value->rep_frame==0){ - call_value->rep_frame=pinfo->fd->num; + if (call_value->rep_frame == 0) { + call_value->rep_frame = pinfo->fd->num; } } } @@ -3659,7 +3669,7 @@ dissect_dcerpc_cn_resp (tvbuff_t *tvb, gint offset, packet_info *pinfo, if (value) { dcerpc_info *di; - di=get_next_di(); + di = get_next_di(); /* handoff this call */ di->conv = conv; di->call_id = hdr->call_id; @@ -3667,23 +3677,23 @@ dissect_dcerpc_cn_resp (tvbuff_t *tvb, gint offset, packet_info *pinfo, di->ptype = PDU_RESP; di->call_data = value; - proto_tree_add_uint (dcerpc_tree, hf_dcerpc_opnum, tvb, 0, 0, value->opnum); + proto_tree_add_uint(dcerpc_tree, hf_dcerpc_opnum, tvb, 0, 0, value->opnum); /* (optional) "Object UUID" from request */ - if (value && dcerpc_tree && memcmp(&value->object_uuid, &obj_id_null, sizeof(obj_id_null)) != 0) { - pi = proto_tree_add_guid_format (dcerpc_tree, hf_dcerpc_obj_id, tvb, - offset, 0, (e_guid_t *) &value->object_uuid, "Object UUID: %s", - guid_to_str((e_guid_t *) &value->object_uuid)); + if (value && dcerpc_tree && (memcmp(&value->object_uuid, &obj_id_null, sizeof(obj_id_null)) != 0)) { + pi = proto_tree_add_guid_format(dcerpc_tree, hf_dcerpc_obj_id, tvb, + offset, 0, (e_guid_t *) &value->object_uuid, "Object UUID: %s", + guid_to_str((e_guid_t *) &value->object_uuid)); PROTO_ITEM_SET_GENERATED(pi); } /* request in */ - if(value->req_frame!=0){ + if (value->req_frame != 0) { nstime_t delta_ts; pi = proto_tree_add_uint(dcerpc_tree, hf_dcerpc_request_in, tvb, 0, 0, value->req_frame); PROTO_ITEM_SET_GENERATED(pi); - if(parent_pi != NULL) { + if (parent_pi != NULL) { proto_item_append_text(parent_pi, ", [Req: #%u]", value->req_frame); } nstime_delta(&delta_ts, &pinfo->fd->abs_ts, &value->req_time); @@ -3696,54 +3706,56 @@ dissect_dcerpc_cn_resp (tvbuff_t *tvb, gint offset, packet_info *pinfo, "No request to this DCE/RPC call found"); } - dissect_dcerpc_cn_stub (tvb, offset, pinfo, dcerpc_tree, tree, - hdr, di, &auth_info, alloc_hint, - value->rep_frame); + dissect_dcerpc_cn_stub(tvb, offset, pinfo, dcerpc_tree, tree, + hdr, di, &auth_info, alloc_hint, + value->rep_frame); } else { /* no bind information, simply show stub data */ pi = proto_tree_add_text(dcerpc_tree, tvb, offset, 0, "No bind info for this interface Context ID - capture start too late?"); PROTO_ITEM_SET_GENERATED(pi); expert_add_info_format(pinfo, pi, PI_UNDECODED, PI_NOTE, "No bind info for interface Context ID:%u", ctx_id); - show_stub_data (tvb, offset, dcerpc_tree, &auth_info, TRUE); + show_stub_data(tvb, offset, dcerpc_tree, &auth_info, TRUE); } } /* Dissect the verifier */ - dissect_dcerpc_verifier (tvb, pinfo, dcerpc_tree, hdr, &auth_info); + dissect_dcerpc_verifier(tvb, pinfo, dcerpc_tree, hdr, &auth_info); } static void -dissect_dcerpc_cn_fault (tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *dcerpc_tree, e_dce_cn_common_hdr_t *hdr) +dissect_dcerpc_cn_fault(tvbuff_t *tvb, gint offset, packet_info *pinfo, + proto_tree *dcerpc_tree, e_dce_cn_common_hdr_t *hdr) { dcerpc_call_value *value = NULL; - conversation_t *conv; - guint16 ctx_id; - guint32 status; - guint32 alloc_hint; - dcerpc_auth_info auth_info; - proto_item *pi = NULL; + conversation_t *conv; + guint16 ctx_id; + guint32 status; + guint32 alloc_hint; + dcerpc_auth_info auth_info; + proto_item *pi = NULL; - offset = dissect_dcerpc_uint32 (tvb, offset, pinfo, dcerpc_tree, hdr->drep, - hf_dcerpc_cn_alloc_hint, &alloc_hint); + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, dcerpc_tree, hdr->drep, + hf_dcerpc_cn_alloc_hint, &alloc_hint); - offset = dissect_dcerpc_uint16 (tvb, offset, pinfo, dcerpc_tree, hdr->drep, - hf_dcerpc_cn_ctx_id, &ctx_id); + offset = dissect_dcerpc_uint16(tvb, offset, pinfo, dcerpc_tree, hdr->drep, + hf_dcerpc_cn_ctx_id, &ctx_id); - offset = dissect_dcerpc_uint8 (tvb, offset, pinfo, dcerpc_tree, hdr->drep, - hf_dcerpc_cn_cancel_count, NULL); + offset = dissect_dcerpc_uint8(tvb, offset, pinfo, dcerpc_tree, hdr->drep, + hf_dcerpc_cn_cancel_count, NULL); /* padding */ offset++; - /*offset = dissect_dcerpc_uint32 (tvb, offset, pinfo, dcerpc_tree, hdr->drep, - hf_dcerpc_cn_status, &status);*/ +#if 0 + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, dcerpc_tree, hdr->drep, + hf_dcerpc_cn_status, &status); +#endif status = ((hdr->drep[0] & DREP_LITTLE_ENDIAN) - ? tvb_get_letohl (tvb, offset) - : tvb_get_ntohl (tvb, offset)); + ? tvb_get_letohl(tvb, offset) + : tvb_get_ntohl(tvb, offset)); if (dcerpc_tree) { - pi = proto_tree_add_item (dcerpc_tree, hf_dcerpc_cn_status, tvb, offset, 4, DREP_ENC_INTEGER(hdr->drep)); + pi = proto_tree_add_item(dcerpc_tree, hf_dcerpc_cn_status, tvb, offset, 4, DREP_ENC_INTEGER(hdr->drep)); } offset+=4; @@ -3753,10 +3765,10 @@ dissect_dcerpc_cn_fault (tvbuff_t *tvb, gint offset, packet_info *pinfo, /* save context ID for use with dcerpc_add_conv_to_bind_table() */ pinfo->dcectxid = ctx_id; - col_append_fstr (pinfo->cinfo, COL_INFO, - " ctx_id: %u status: %s", ctx_id, - val_to_str(status, reject_status_vals, - "Unknown (0x%08x)")); + col_append_fstr(pinfo->cinfo, COL_INFO, + " ctx_id: %u status: %s", ctx_id, + val_to_str(status, reject_status_vals, + "Unknown (0x%08x)")); /* padding */ offset += 4; @@ -3765,10 +3777,10 @@ dissect_dcerpc_cn_fault (tvbuff_t *tvb, gint offset, packet_info *pinfo, * XXX - what if this was set when the connection was set up, * and we just have a security context? */ - dissect_dcerpc_cn_auth (tvb, offset, pinfo, dcerpc_tree, hdr, FALSE, &auth_info); + dissect_dcerpc_cn_auth(tvb, offset, pinfo, dcerpc_tree, hdr, FALSE, &auth_info); - conv = find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); + conv = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, + pinfo->srcport, pinfo->destport, 0); if (!conv) { /* no point in creating one here, really */ } else { @@ -3781,23 +3793,23 @@ dissect_dcerpc_cn_fault (tvbuff_t *tvb, gint offset, packet_info *pinfo, */ matched_key.frame = pinfo->fd->num; matched_key.call_id = hdr->call_id; - value=g_hash_table_lookup(dcerpc_matched, &matched_key); - if(!value){ + value = g_hash_table_lookup(dcerpc_matched, &matched_key); + if (!value) { dcerpc_cn_call_key call_key; dcerpc_call_value *call_value; - call_key.conv=conv; - call_key.call_id=hdr->call_id; - call_key.smb_fid=dcerpc_get_transport_salt(pinfo); + call_key.conv = conv; + call_key.call_id = hdr->call_id; + call_key.smb_fid = dcerpc_get_transport_salt(pinfo); - if((call_value=g_hash_table_lookup(dcerpc_cn_calls, &call_key))){ + if ((call_value = g_hash_table_lookup(dcerpc_cn_calls, &call_key))) { new_matched_key = se_alloc(sizeof (dcerpc_matched_key)); *new_matched_key = matched_key; - g_hash_table_insert (dcerpc_matched, new_matched_key, call_value); + g_hash_table_insert(dcerpc_matched, new_matched_key, call_value); value = call_value; - if(call_value->rep_frame==0){ - call_value->rep_frame=pinfo->fd->num; + if (call_value->rep_frame == 0) { + call_value->rep_frame = pinfo->fd->num; } } @@ -3808,7 +3820,7 @@ dissect_dcerpc_cn_fault (tvbuff_t *tvb, gint offset, packet_info *pinfo, dcerpc_info *di; proto_item *parent_pi; - di=get_next_di(); + di = get_next_di(); /* handoff this call */ di->conv = conv; di->call_id = hdr->call_id; @@ -3816,14 +3828,14 @@ dissect_dcerpc_cn_fault (tvbuff_t *tvb, gint offset, packet_info *pinfo, di->ptype = PDU_FAULT; di->call_data = value; - proto_tree_add_uint (dcerpc_tree, hf_dcerpc_opnum, tvb, 0, 0, value->opnum); - if(value->req_frame!=0){ + proto_tree_add_uint(dcerpc_tree, hf_dcerpc_opnum, tvb, 0, 0, value->opnum); + if (value->req_frame != 0) { nstime_t delta_ts; pi = proto_tree_add_uint(dcerpc_tree, hf_dcerpc_request_in, tvb, 0, 0, value->req_frame); PROTO_ITEM_SET_GENERATED(pi); parent_pi = proto_tree_get_parent(dcerpc_tree); - if(parent_pi != NULL) { + if (parent_pi != NULL) { proto_item_append_text(parent_pi, ", [Req: #%u]", value->req_frame); } nstime_delta(&delta_ts, &pinfo->fd->abs_ts, &value->req_time); @@ -3854,9 +3866,9 @@ dissect_dcerpc_cn_fault (tvbuff_t *tvb, gint offset, packet_info *pinfo, the entire PDU, or if we don't have all the data in this fragment, just call the handoff directly if this is the first fragment or the PDU isn't fragmented. */ - if( (!dcerpc_reassemble) || PFC_NOT_FRAGMENTED(hdr) || - !tvb_bytes_exist(tvb, offset, stub_length) ){ - if(hdr->flags&PFC_FIRST_FRAG){ + if ( (!dcerpc_reassemble) || PFC_NOT_FRAGMENTED(hdr) || + !tvb_bytes_exist(tvb, offset, stub_length) ) { + if (hdr->flags&PFC_FIRST_FRAG) { /* First fragment, possibly the only fragment */ /* * XXX - should there be a third routine for each @@ -3871,10 +3883,10 @@ dissect_dcerpc_cn_fault (tvbuff_t *tvb, gint offset, packet_info *pinfo, if (dcerpc_tree) { if (stub_length > 0) { tvb_ensure_bytes_exist(tvb, offset, stub_length); - proto_tree_add_text (dcerpc_tree, tvb, offset, stub_length, - "Fault stub data (%d byte%s)", - stub_length, - plurality(stub_length, "", "s")); + proto_tree_add_text(dcerpc_tree, tvb, offset, stub_length, + "Fault stub data (%d byte%s)", + stub_length, + plurality(stub_length, "", "s")); } } } else { @@ -3882,10 +3894,10 @@ dissect_dcerpc_cn_fault (tvbuff_t *tvb, gint offset, packet_info *pinfo, if (dcerpc_tree) { if (stub_length > 0) { tvb_ensure_bytes_exist(tvb, offset, stub_length); - proto_tree_add_text (dcerpc_tree, tvb, offset, stub_length, - "Fragment data (%d byte%s)", - stub_length, - plurality(stub_length, "", "s")); + proto_tree_add_text(dcerpc_tree, tvb, offset, stub_length, + "Fragment data (%d byte%s)", + stub_length, + plurality(stub_length, "", "s")); } } } @@ -3897,21 +3909,21 @@ dissect_dcerpc_cn_fault (tvbuff_t *tvb, gint offset, packet_info *pinfo, if (dcerpc_tree) { if (length > 0) { tvb_ensure_bytes_exist(tvb, offset, stub_length); - proto_tree_add_text (dcerpc_tree, tvb, offset, stub_length, - "Fragment data (%d byte%s)", - stub_length, - plurality(stub_length, "", "s")); + proto_tree_add_text(dcerpc_tree, tvb, offset, stub_length, + "Fragment data (%d byte%s)", + stub_length, + plurality(stub_length, "", "s")); } } - if(hdr->flags&PFC_FIRST_FRAG){ /* FIRST fragment */ - if( (!pinfo->fd->flags.visited) && value->rep_frame ){ + if (hdr->flags&PFC_FIRST_FRAG) { /* FIRST fragment */ + if ( (!pinfo->fd->flags.visited) && value->rep_frame ) { fragment_add_seq_next(tvb, offset, pinfo, value->rep_frame, dcerpc_co_fragment_table, dcerpc_co_reassemble_table, stub_length, TRUE); } - } else if(hdr->flags&PFC_LAST_FRAG){ /* LAST fragment */ - if( value->rep_frame ){ + } else if (hdr->flags&PFC_LAST_FRAG) { /* LAST fragment */ + if ( value->rep_frame ) { fragment_data *fd_head; fd_head = fragment_add_seq_next(tvb, offset, pinfo, @@ -3920,7 +3932,7 @@ dissect_dcerpc_cn_fault (tvbuff_t *tvb, gint offset, packet_info *pinfo, stub_length, TRUE); - if(fd_head){ + if (fd_head) { /* We completed reassembly */ tvbuff_t *next_tvb; proto_item *frag_tree_item; @@ -3943,16 +3955,16 @@ dissect_dcerpc_cn_fault (tvbuff_t *tvb, gint offset, packet_info *pinfo, if (dcerpc_tree) { if (length > 0) { tvb_ensure_bytes_exist(tvb, offset, stub_length); - proto_tree_add_text (dcerpc_tree, tvb, offset, stub_length, - "Fault stub data (%d byte%s)", - stub_length, - plurality(stub_length, "", "s")); + proto_tree_add_text(dcerpc_tree, tvb, offset, stub_length, + "Fault stub data (%d byte%s)", + stub_length, + plurality(stub_length, "", "s")); } } } } } else { /* MIDDLE fragment(s) */ - if( (!pinfo->fd->flags.visited) && value->rep_frame ){ + if ( (!pinfo->fd->flags.visited) && value->rep_frame ) { fragment_add_seq_next(tvb, offset, pinfo, value->rep_frame, dcerpc_co_fragment_table, dcerpc_co_reassemble_table, stub_length, @@ -3965,36 +3977,36 @@ dissect_dcerpc_cn_fault (tvbuff_t *tvb, gint offset, packet_info *pinfo, } static void -dissect_dcerpc_cn_rts (tvbuff_t *tvb, gint offset, packet_info *pinfo, - proto_tree *dcerpc_tree, e_dce_cn_common_hdr_t *hdr) +dissect_dcerpc_cn_rts(tvbuff_t *tvb, gint offset, packet_info *pinfo, + proto_tree *dcerpc_tree, e_dce_cn_common_hdr_t *hdr) { - proto_item *tf = NULL; + proto_item *tf = NULL; proto_tree *cn_rts_pdu_tree = NULL; - guint16 rts_flags; - guint16 commands_nb = 0; - guint32 *cmd; - guint32 i; - const char *info_str = NULL; + guint16 rts_flags; + guint16 commands_nb = 0; + guint32 *cmd; + guint32 i; + const char *info_str = NULL; /* Dissect specific RTS header */ - rts_flags = dcerpc_tvb_get_ntohs (tvb, offset, hdr->drep); + rts_flags = dcerpc_tvb_get_ntohs(tvb, offset, hdr->drep); if (dcerpc_tree) { proto_tree *cn_rts_flags_tree; - tf = proto_tree_add_uint (dcerpc_tree, hf_dcerpc_cn_rts_flags, tvb, offset, 2, rts_flags); + tf = proto_tree_add_uint(dcerpc_tree, hf_dcerpc_cn_rts_flags, tvb, offset, 2, rts_flags); cn_rts_flags_tree = proto_item_add_subtree(tf, ett_dcerpc_cn_rts_flags); - proto_tree_add_boolean (cn_rts_flags_tree, hf_dcerpc_cn_rts_flags_none, tvb, offset, 1, rts_flags); - proto_tree_add_boolean (cn_rts_flags_tree, hf_dcerpc_cn_rts_flags_ping, tvb, offset, 1, rts_flags); - proto_tree_add_boolean (cn_rts_flags_tree, hf_dcerpc_cn_rts_flags_other_cmd, tvb, offset, 1, rts_flags); - proto_tree_add_boolean (cn_rts_flags_tree, hf_dcerpc_cn_rts_flags_recycle_channel, tvb, offset, 1, rts_flags); - proto_tree_add_boolean (cn_rts_flags_tree, hf_dcerpc_cn_rts_flags_in_channel, tvb, offset, 1, rts_flags); - proto_tree_add_boolean (cn_rts_flags_tree, hf_dcerpc_cn_rts_flags_out_channel, tvb, offset, 1, rts_flags); - proto_tree_add_boolean (cn_rts_flags_tree, hf_dcerpc_cn_rts_flags_eof, tvb, offset, 1, rts_flags); + proto_tree_add_boolean(cn_rts_flags_tree, hf_dcerpc_cn_rts_flags_none, tvb, offset, 1, rts_flags); + proto_tree_add_boolean(cn_rts_flags_tree, hf_dcerpc_cn_rts_flags_ping, tvb, offset, 1, rts_flags); + proto_tree_add_boolean(cn_rts_flags_tree, hf_dcerpc_cn_rts_flags_other_cmd, tvb, offset, 1, rts_flags); + proto_tree_add_boolean(cn_rts_flags_tree, hf_dcerpc_cn_rts_flags_recycle_channel, tvb, offset, 1, rts_flags); + proto_tree_add_boolean(cn_rts_flags_tree, hf_dcerpc_cn_rts_flags_in_channel, tvb, offset, 1, rts_flags); + proto_tree_add_boolean(cn_rts_flags_tree, hf_dcerpc_cn_rts_flags_out_channel, tvb, offset, 1, rts_flags); + proto_tree_add_boolean(cn_rts_flags_tree, hf_dcerpc_cn_rts_flags_eof, tvb, offset, 1, rts_flags); } offset += 2; - offset = dissect_dcerpc_uint16 (tvb, offset, pinfo, dcerpc_tree, hdr->drep, - hf_dcerpc_cn_rts_commands_nb, &commands_nb); + offset = dissect_dcerpc_uint16(tvb, offset, pinfo, dcerpc_tree, hdr->drep, + hf_dcerpc_cn_rts_commands_nb, &commands_nb); /* Create the RTS PDU tree - we do not yet know its name */ tf = proto_tree_add_text(dcerpc_tree, tvb, offset, tvb_length_remaining(tvb, offset), "RTS PDU: %u commands", commands_nb); @@ -4005,44 +4017,44 @@ dissect_dcerpc_cn_rts (tvbuff_t *tvb, gint offset, packet_info *pinfo, /* Dissect commands */ for (i = 0; i < commands_nb; ++i) { proto_tree *cn_rts_command_tree = NULL; - const guint32 command = dcerpc_tvb_get_ntohl (tvb, offset, hdr->drep); + const guint32 command = dcerpc_tvb_get_ntohl(tvb, offset, hdr->drep); cmd[i] = command; - tf = proto_tree_add_uint (cn_rts_pdu_tree, hf_dcerpc_cn_rts_command, tvb, offset, 4, command); + tf = proto_tree_add_uint(cn_rts_pdu_tree, hf_dcerpc_cn_rts_command, tvb, offset, 4, command); cn_rts_command_tree = proto_item_add_subtree(tf, ett_dcerpc_cn_rts_command); offset += 4; switch (command) { case RTS_CMD_RECEIVEWINDOWSIZE: - offset = dissect_dcerpc_uint32 (tvb, offset, pinfo, cn_rts_command_tree, hdr->drep, hf_dcerpc_cn_rts_command_receivewindowsize, NULL); + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, cn_rts_command_tree, hdr->drep, hf_dcerpc_cn_rts_command_receivewindowsize, NULL); break; case RTS_CMD_FLOWCONTROLACK: - offset = dissect_dcerpc_uint32 (tvb, offset, pinfo, cn_rts_command_tree, hdr->drep, hf_dcerpc_cn_rts_command_fack_bytesreceived, NULL); - offset = dissect_dcerpc_uint32 (tvb, offset, pinfo, cn_rts_command_tree, hdr->drep, hf_dcerpc_cn_rts_command_fack_availablewindow, NULL); - offset = dissect_dcerpc_uuid_t (tvb, offset, pinfo, cn_rts_command_tree, hdr->drep, hf_dcerpc_cn_rts_command_fack_channelcookie, NULL); + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, cn_rts_command_tree, hdr->drep, hf_dcerpc_cn_rts_command_fack_bytesreceived, NULL); + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, cn_rts_command_tree, hdr->drep, hf_dcerpc_cn_rts_command_fack_availablewindow, NULL); + offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, cn_rts_command_tree, hdr->drep, hf_dcerpc_cn_rts_command_fack_channelcookie, NULL); break; case RTS_CMD_CONNECTIONTIMEOUT: - offset = dissect_dcerpc_uint32 (tvb, offset, pinfo, cn_rts_command_tree, hdr->drep, hf_dcerpc_cn_rts_command_connectiontimeout, NULL); + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, cn_rts_command_tree, hdr->drep, hf_dcerpc_cn_rts_command_connectiontimeout, NULL); break; case RTS_CMD_COOKIE: - offset = dissect_dcerpc_uuid_t (tvb, offset, pinfo, cn_rts_command_tree, hdr->drep, hf_dcerpc_cn_rts_command_cookie, NULL); + offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, cn_rts_command_tree, hdr->drep, hf_dcerpc_cn_rts_command_cookie, NULL); break; case RTS_CMD_CHANNELLIFETIME: - offset = dissect_dcerpc_uint32 (tvb, offset, pinfo, cn_rts_command_tree, hdr->drep, hf_dcerpc_cn_rts_command_channellifetime, NULL); + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, cn_rts_command_tree, hdr->drep, hf_dcerpc_cn_rts_command_channellifetime, NULL); break; case RTS_CMD_CLIENTKEEPALIVE: - offset = dissect_dcerpc_uint32 (tvb, offset, pinfo, cn_rts_command_tree, hdr->drep, hf_dcerpc_cn_rts_command_clientkeepalive, NULL); + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, cn_rts_command_tree, hdr->drep, hf_dcerpc_cn_rts_command_clientkeepalive, NULL); break; case RTS_CMD_VERSION: - offset = dissect_dcerpc_uint32 (tvb, offset, pinfo, cn_rts_command_tree, hdr->drep, hf_dcerpc_cn_rts_command_version, NULL); + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, cn_rts_command_tree, hdr->drep, hf_dcerpc_cn_rts_command_version, NULL); break; case RTS_CMD_EMPTY: break; case RTS_CMD_PADDING: { guint8 *padding; - const guint32 conformance_count = dcerpc_tvb_get_ntohl (tvb, offset, hdr->drep); - proto_tree_add_uint (cn_rts_command_tree, hf_dcerpc_cn_rts_command_conformancecount, tvb, offset, 4, conformance_count); + const guint32 conformance_count = dcerpc_tvb_get_ntohl(tvb, offset, hdr->drep); + proto_tree_add_uint(cn_rts_command_tree, hf_dcerpc_cn_rts_command_conformancecount, tvb, offset, 4, conformance_count); offset += 4; padding = tvb_memdup(tvb, offset, conformance_count); - proto_tree_add_bytes (cn_rts_command_tree, hf_dcerpc_cn_rts_command_padding, tvb, offset, conformance_count, padding); + proto_tree_add_bytes(cn_rts_command_tree, hf_dcerpc_cn_rts_command_padding, tvb, offset, conformance_count, padding); offset += conformance_count; } break; case RTS_CMD_NEGATIVEANCE: @@ -4051,8 +4063,8 @@ dissect_dcerpc_cn_rts (tvbuff_t *tvb, gint offset, packet_info *pinfo, break; case RTS_CMD_CLIENTADDRESS: { guint8 *padding; - const guint32 addrtype = dcerpc_tvb_get_ntohl (tvb, offset, hdr->drep); - proto_tree_add_uint (cn_rts_command_tree, hf_dcerpc_cn_rts_command_addrtype, tvb, offset, 4, addrtype); + const guint32 addrtype = dcerpc_tvb_get_ntohl(tvb, offset, hdr->drep); + proto_tree_add_uint(cn_rts_command_tree, hf_dcerpc_cn_rts_command_addrtype, tvb, offset, 4, addrtype); offset += 4; switch (addrtype) { case RTS_IPV4: { @@ -4068,17 +4080,17 @@ dissect_dcerpc_cn_rts (tvbuff_t *tvb, gint offset, packet_info *pinfo, } break; } padding = tvb_memdup(tvb, offset, 12); - proto_tree_add_bytes (cn_rts_command_tree, hf_dcerpc_cn_rts_command_padding, tvb, offset, 12, padding); + proto_tree_add_bytes(cn_rts_command_tree, hf_dcerpc_cn_rts_command_padding, tvb, offset, 12, padding); offset += 12; } break; case RTS_CMD_ASSOCIATIONGROUPID: - offset = dissect_dcerpc_uuid_t (tvb, offset, pinfo, cn_rts_command_tree, hdr->drep, hf_dcerpc_cn_rts_command_associationgroupid, NULL); + offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, cn_rts_command_tree, hdr->drep, hf_dcerpc_cn_rts_command_associationgroupid, NULL); break; case RTS_CMD_DESTINATION: - offset = dissect_dcerpc_uint32 (tvb, offset, pinfo, cn_rts_command_tree, hdr->drep, hf_dcerpc_cn_rts_command_forwarddestination, NULL); + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, cn_rts_command_tree, hdr->drep, hf_dcerpc_cn_rts_command_forwarddestination, NULL); break; case RTS_CMD_PINGTRAFFICSENTNOTIFY: - offset = dissect_dcerpc_uint32 (tvb, offset, pinfo, cn_rts_command_tree, hdr->drep, hf_dcerpc_cn_rts_command_pingtrafficsentnotify, NULL); + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, cn_rts_command_tree, hdr->drep, hf_dcerpc_cn_rts_command_pingtrafficsentnotify, NULL); break; default: proto_tree_add_text(cn_rts_command_tree, tvb, offset, 0, "unknown RTS command number"); @@ -4175,7 +4187,7 @@ dissect_dcerpc_cn_rts (tvbuff_t *tvb, gint offset, packet_info *pinfo, } break; case RTS_FLAG_RECYCLE_CHANNEL: - switch(commands_nb) { + switch (commands_nb) { case 1: if (cmd[0] == 0xD) { info_str = "OUT_R1/A1,OUT_R1/A2,OUT_R2/A1,OUT_R2/A2"; @@ -4282,20 +4294,20 @@ dissect_dcerpc_cn_rts (tvbuff_t *tvb, gint offset, packet_info *pinfo, * pinfo->private_data structure to expect. */ static gboolean -dissect_dcerpc_cn (tvbuff_t *tvb, int offset, packet_info *pinfo, - proto_tree *tree, gboolean can_desegment, int *pkt_len) +dissect_dcerpc_cn(tvbuff_t *tvb, int offset, packet_info *pinfo, + proto_tree *tree, gboolean can_desegment, int *pkt_len) { - static const guint8 nulls[4] = { 0 }; - int start_offset; - int padding = 0; - proto_item *ti = NULL; - proto_item *tf = NULL; - proto_tree *dcerpc_tree = NULL; - proto_tree *cn_flags_tree = NULL; - proto_tree *drep_tree = NULL; - e_dce_cn_common_hdr_t hdr; - dcerpc_auth_info auth_info; - tvbuff_t *fragment_tvb; + static const guint8 nulls[4] = { 0 }; + int start_offset; + int padding = 0; + proto_item *ti = NULL; + proto_item *tf = NULL; + proto_tree *dcerpc_tree = NULL; + proto_tree *cn_flags_tree = NULL; + proto_tree *drep_tree = NULL; + e_dce_cn_common_hdr_t hdr; + dcerpc_auth_info auth_info; + tvbuff_t *fragment_tvb; /* * when done over nbt, dcerpc requests are padded with 4 bytes of null @@ -4306,7 +4318,7 @@ dissect_dcerpc_cn (tvbuff_t *tvb, int offset, packet_info *pinfo, * the 4 bytes of null padding, and make that the dissector * used for "netbios". */ - if (tvb_memeql (tvb, offset, nulls, 4) == 0) { + if (tvb_memeql(tvb, offset, nulls, 4) == 0) { /* * Skip the padding. @@ -4317,59 +4329,59 @@ dissect_dcerpc_cn (tvbuff_t *tvb, int offset, packet_info *pinfo, /* * Check if this looks like a C/O DCERPC call */ - if (!tvb_bytes_exist (tvb, offset, sizeof (hdr))) { + if (!tvb_bytes_exist(tvb, offset, sizeof (hdr))) { return FALSE; /* not enough information to check */ } start_offset = offset; - hdr.rpc_ver = tvb_get_guint8 (tvb, offset++); + hdr.rpc_ver = tvb_get_guint8(tvb, offset++); if (hdr.rpc_ver != 5) return FALSE; - hdr.rpc_ver_minor = tvb_get_guint8 (tvb, offset++); - if (hdr.rpc_ver_minor != 0 && hdr.rpc_ver_minor != 1) + hdr.rpc_ver_minor = tvb_get_guint8(tvb, offset++); + if ((hdr.rpc_ver_minor != 0) && (hdr.rpc_ver_minor != 1)) return FALSE; - hdr.ptype = tvb_get_guint8 (tvb, offset++); + hdr.ptype = tvb_get_guint8(tvb, offset++); if (hdr.ptype > PDU_RTS) return FALSE; - hdr.flags = tvb_get_guint8 (tvb, offset++); - tvb_memcpy (tvb, (guint8 *)hdr.drep, offset, sizeof (hdr.drep)); + hdr.flags = tvb_get_guint8(tvb, offset++); + tvb_memcpy(tvb, (guint8 *)hdr.drep, offset, sizeof (hdr.drep)); offset += sizeof (hdr.drep); - hdr.frag_len = dcerpc_tvb_get_ntohs (tvb, offset, hdr.drep); + hdr.frag_len = dcerpc_tvb_get_ntohs(tvb, offset, hdr.drep); offset += 2; - hdr.auth_len = dcerpc_tvb_get_ntohs (tvb, offset, hdr.drep); + hdr.auth_len = dcerpc_tvb_get_ntohs(tvb, offset, hdr.drep); offset += 2; - hdr.call_id = dcerpc_tvb_get_ntohl (tvb, offset, hdr.drep); + hdr.call_id = dcerpc_tvb_get_ntohl(tvb, offset, hdr.drep); offset += 4; - if(pinfo->dcectxid == 0) { - col_append_fstr (pinfo->cinfo, COL_DCE_CALL, "%u", hdr.call_id); + if (pinfo->dcectxid == 0) { + col_append_fstr(pinfo->cinfo, COL_DCE_CALL, "%u", hdr.call_id); } else { /* this is not the first DCE-RPC request/response in this (TCP?-)PDU, * prepend a delimiter */ - col_append_fstr (pinfo->cinfo, COL_DCE_CALL, "#%u", hdr.call_id); + col_append_fstr(pinfo->cinfo, COL_DCE_CALL, "#%u", hdr.call_id); } if (can_desegment && pinfo->can_desegment && !tvb_bytes_exist(tvb, start_offset, hdr.frag_len)) { pinfo->desegment_offset = start_offset; - pinfo->desegment_len = hdr.frag_len - tvb_length_remaining (tvb, start_offset); + pinfo->desegment_len = hdr.frag_len - tvb_length_remaining(tvb, start_offset); *pkt_len = 0; /* desegmentation required */ return TRUE; } - col_set_str (pinfo->cinfo, COL_PROTOCOL, "DCERPC"); + col_set_str(pinfo->cinfo, COL_PROTOCOL, "DCERPC"); - if(pinfo->dcectxid != 0) { + if (pinfo->dcectxid != 0) { /* this is not the first DCE-RPC request/response in this (TCP?-)PDU, * append a delimiter and set a column fence */ - col_append_str (pinfo->cinfo, COL_INFO, " # "); + col_append_str(pinfo->cinfo, COL_INFO, " # "); col_set_fence(pinfo->cinfo,COL_INFO); } - col_add_fstr (pinfo->cinfo, COL_INFO, "%s: call_id: %u", - pckt_vals[hdr.ptype].strptr, hdr.call_id); + col_add_fstr(pinfo->cinfo, COL_INFO, "%s: call_id: %u", + pckt_vals[hdr.ptype].strptr, hdr.call_id); - if(pinfo->dcectxid != 0) { + if (pinfo->dcectxid != 0) { /* this is not the first DCE-RPC request/response in this (TCP?-)PDU */ expert_add_info_format(pinfo, NULL, PI_SEQUENCE, PI_CHAT, "Multiple DCE/RPC fragments/PDU's in one packet"); } @@ -4377,66 +4389,67 @@ dissect_dcerpc_cn (tvbuff_t *tvb, int offset, packet_info *pinfo, offset = start_offset; tvb_ensure_bytes_exist(tvb, offset, 16); if (tree) { - ti = proto_tree_add_item (tree, proto_dcerpc, tvb, offset, hdr.frag_len, ENC_NA); - dcerpc_tree = proto_item_add_subtree (ti, ett_dcerpc); + ti = proto_tree_add_item(tree, proto_dcerpc, tvb, offset, hdr.frag_len, ENC_NA); + dcerpc_tree = proto_item_add_subtree(ti, ett_dcerpc); } - proto_tree_add_uint (dcerpc_tree, hf_dcerpc_ver, tvb, offset, 1, hdr.rpc_ver); + proto_tree_add_uint(dcerpc_tree, hf_dcerpc_ver, tvb, offset, 1, hdr.rpc_ver); offset++; - proto_tree_add_uint (dcerpc_tree, hf_dcerpc_ver_minor, tvb, offset, 1, hdr.rpc_ver_minor); + proto_tree_add_uint(dcerpc_tree, hf_dcerpc_ver_minor, tvb, offset, 1, hdr.rpc_ver_minor); offset++; - tf = proto_tree_add_uint (dcerpc_tree, hf_dcerpc_packet_type, tvb, offset, 1, hdr.ptype); + tf = proto_tree_add_uint(dcerpc_tree, hf_dcerpc_packet_type, tvb, offset, 1, hdr.ptype); offset++; - /* XXX - too much "output noise", removed for now - if(hdr.ptype == PDU_BIND || hdr.ptype == PDU_ALTER || +#if 0 /* XXX - too much "output noise", removed for now */ + if (hdr.ptype == PDU_BIND || hdr.ptype == PDU_ALTER || hdr.ptype == PDU_BIND_ACK || hdr.ptype == PDU_ALTER_ACK) expert_add_info_format(pinfo, tf, PI_SEQUENCE, PI_CHAT, "Context change: %s", - val_to_str(hdr.ptype, pckt_vals, "(0x%x)"));*/ - if(hdr.ptype == PDU_BIND_NAK) + val_to_str(hdr.ptype, pckt_vals, "(0x%x)")); +#endif + if (hdr.ptype == PDU_BIND_NAK) expert_add_info_format(pinfo, tf, PI_SEQUENCE, PI_WARN, "Bind not acknowledged"); if (tree) { proto_item_append_text(ti, " %s, Fragment: %s", - val_to_str(hdr.ptype, pckt_vals, "Unknown (0x%02x)"), - fragment_type(hdr.flags)); + val_to_str(hdr.ptype, pckt_vals, "Unknown (0x%02x)"), + fragment_type(hdr.flags)); - tf = proto_tree_add_uint (dcerpc_tree, hf_dcerpc_cn_flags, tvb, offset, 1, hdr.flags); - cn_flags_tree = proto_item_add_subtree (tf, ett_dcerpc_cn_flags); + tf = proto_tree_add_uint(dcerpc_tree, hf_dcerpc_cn_flags, tvb, offset, 1, hdr.flags); + cn_flags_tree = proto_item_add_subtree(tf, ett_dcerpc_cn_flags); } - proto_tree_add_boolean (cn_flags_tree, hf_dcerpc_cn_flags_object, tvb, offset, 1, hdr.flags); - proto_tree_add_boolean (cn_flags_tree, hf_dcerpc_cn_flags_maybe, tvb, offset, 1, hdr.flags); - proto_tree_add_boolean (cn_flags_tree, hf_dcerpc_cn_flags_dne, tvb, offset, 1, hdr.flags); - proto_tree_add_boolean (cn_flags_tree, hf_dcerpc_cn_flags_mpx, tvb, offset, 1, hdr.flags); - proto_tree_add_boolean (cn_flags_tree, hf_dcerpc_cn_flags_reserved, tvb, offset, 1, hdr.flags); - proto_tree_add_boolean (cn_flags_tree, hf_dcerpc_cn_flags_cancel_pending, tvb, offset, 1, hdr.flags); - proto_tree_add_boolean (cn_flags_tree, hf_dcerpc_cn_flags_last_frag, tvb, offset, 1, hdr.flags); - proto_tree_add_boolean (cn_flags_tree, hf_dcerpc_cn_flags_first_frag, tvb, offset, 1, hdr.flags); + proto_tree_add_boolean(cn_flags_tree, hf_dcerpc_cn_flags_object, tvb, offset, 1, hdr.flags); + proto_tree_add_boolean(cn_flags_tree, hf_dcerpc_cn_flags_maybe, tvb, offset, 1, hdr.flags); + proto_tree_add_boolean(cn_flags_tree, hf_dcerpc_cn_flags_dne, tvb, offset, 1, hdr.flags); + proto_tree_add_boolean(cn_flags_tree, hf_dcerpc_cn_flags_mpx, tvb, offset, 1, hdr.flags); + proto_tree_add_boolean(cn_flags_tree, hf_dcerpc_cn_flags_reserved, tvb, offset, 1, hdr.flags); + proto_tree_add_boolean(cn_flags_tree, hf_dcerpc_cn_flags_cancel_pending, tvb, offset, 1, hdr.flags); + proto_tree_add_boolean(cn_flags_tree, hf_dcerpc_cn_flags_last_frag, tvb, offset, 1, hdr.flags); + proto_tree_add_boolean(cn_flags_tree, hf_dcerpc_cn_flags_first_frag, tvb, offset, 1, hdr.flags); offset++; col_append_fstr(pinfo->cinfo, COL_INFO, " Fragment: %s", fragment_type(hdr.flags)); - if(dcerpc_tree){ - tf = proto_tree_add_bytes (dcerpc_tree, hf_dcerpc_drep, tvb, offset, 4, hdr.drep); - drep_tree = proto_item_add_subtree (tf, ett_dcerpc_drep); + if (dcerpc_tree) { + tf = proto_tree_add_bytes(dcerpc_tree, hf_dcerpc_drep, tvb, offset, 4, hdr.drep); + drep_tree = proto_item_add_subtree(tf, ett_dcerpc_drep); } proto_tree_add_uint(drep_tree, hf_dcerpc_drep_byteorder, tvb, offset, 1, hdr.drep[0] >> 4); proto_tree_add_uint(drep_tree, hf_dcerpc_drep_character, tvb, offset, 1, hdr.drep[0] & 0x0f); proto_tree_add_uint(drep_tree, hf_dcerpc_drep_fp, tvb, offset+1, 1, hdr.drep[1]); offset += sizeof (hdr.drep); - proto_tree_add_uint (dcerpc_tree, hf_dcerpc_cn_frag_len, tvb, offset, 2, hdr.frag_len); + proto_tree_add_uint(dcerpc_tree, hf_dcerpc_cn_frag_len, tvb, offset, 2, hdr.frag_len); offset += 2; - proto_tree_add_uint (dcerpc_tree, hf_dcerpc_cn_auth_len, tvb, offset, 2, hdr.auth_len); + proto_tree_add_uint(dcerpc_tree, hf_dcerpc_cn_auth_len, tvb, offset, 2, hdr.auth_len); offset += 2; - proto_tree_add_uint (dcerpc_tree, hf_dcerpc_cn_call_id, tvb, offset, 4, hdr.call_id); + proto_tree_add_uint(dcerpc_tree, hf_dcerpc_cn_call_id, tvb, offset, 4, hdr.call_id); offset += 4; - if(ti){ + if (ti) { proto_item_append_text(ti, ", FragLen: %u, Call: %u", hdr.frag_len, hdr.call_id); } @@ -4474,36 +4487,36 @@ dissect_dcerpc_cn (tvbuff_t *tvb, int offset, packet_info *pinfo, switch (hdr.ptype) { case PDU_BIND: case PDU_ALTER: - dissect_dcerpc_cn_bind (fragment_tvb, offset, pinfo, dcerpc_tree, &hdr); + dissect_dcerpc_cn_bind(fragment_tvb, offset, pinfo, dcerpc_tree, &hdr); break; case PDU_BIND_ACK: case PDU_ALTER_ACK: - dissect_dcerpc_cn_bind_ack (fragment_tvb, offset, pinfo, dcerpc_tree, &hdr); + dissect_dcerpc_cn_bind_ack(fragment_tvb, offset, pinfo, dcerpc_tree, &hdr); break; case PDU_AUTH3: /* * Nothing after the common header other than credentials. */ - dissect_dcerpc_cn_auth (fragment_tvb, offset, pinfo, dcerpc_tree, &hdr, TRUE, - &auth_info); + dissect_dcerpc_cn_auth(fragment_tvb, offset, pinfo, dcerpc_tree, &hdr, TRUE, + &auth_info); break; case PDU_REQ: - dissect_dcerpc_cn_rqst (fragment_tvb, offset, pinfo, dcerpc_tree, tree, &hdr); + dissect_dcerpc_cn_rqst(fragment_tvb, offset, pinfo, dcerpc_tree, tree, &hdr); break; case PDU_RESP: - dissect_dcerpc_cn_resp (fragment_tvb, offset, pinfo, dcerpc_tree, tree, &hdr); + dissect_dcerpc_cn_resp(fragment_tvb, offset, pinfo, dcerpc_tree, tree, &hdr); break; case PDU_FAULT: - dissect_dcerpc_cn_fault (fragment_tvb, offset, pinfo, dcerpc_tree, &hdr); + dissect_dcerpc_cn_fault(fragment_tvb, offset, pinfo, dcerpc_tree, &hdr); break; case PDU_BIND_NAK: - dissect_dcerpc_cn_bind_nak (fragment_tvb, offset, pinfo, dcerpc_tree, &hdr); + dissect_dcerpc_cn_bind_nak(fragment_tvb, offset, pinfo, dcerpc_tree, &hdr); break; case PDU_CO_CANCEL: @@ -4512,8 +4525,8 @@ dissect_dcerpc_cn (tvbuff_t *tvb, int offset, packet_info *pinfo, * Nothing after the common header other than an authentication * verifier. */ - dissect_dcerpc_cn_auth (fragment_tvb, offset, pinfo, dcerpc_tree, &hdr, FALSE, - &auth_info); + dissect_dcerpc_cn_auth(fragment_tvb, offset, pinfo, dcerpc_tree, &hdr, FALSE, + &auth_info); break; case PDU_SHUTDOWN: @@ -4523,13 +4536,13 @@ dissect_dcerpc_cn (tvbuff_t *tvb, int offset, packet_info *pinfo, */ break; case PDU_RTS: - dissect_dcerpc_cn_rts (fragment_tvb, offset, pinfo, dcerpc_tree, &hdr); + dissect_dcerpc_cn_rts(fragment_tvb, offset, pinfo, dcerpc_tree, &hdr); break; default: /* might as well dissect the auth info */ - dissect_dcerpc_cn_auth (fragment_tvb, offset, pinfo, dcerpc_tree, &hdr, FALSE, - &auth_info); + dissect_dcerpc_cn_auth(fragment_tvb, offset, pinfo, dcerpc_tree, &hdr, FALSE, + &auth_info); break; } return TRUE; @@ -4540,14 +4553,14 @@ dissect_dcerpc_cn (tvbuff_t *tvb, int offset, packet_info *pinfo, * transports */ static gboolean -dissect_dcerpc_cn_pk (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +dissect_dcerpc_cn_pk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { /* * Only one PDU per transport packet, and only one transport * packet per PDU. */ - pinfo->dcetransporttype=DCE_TRANSPORT_UNKNOWN; - if (!dissect_dcerpc_cn (tvb, 0, pinfo, tree, FALSE, NULL)) { + pinfo->dcetransporttype = DCE_TRANSPORT_UNKNOWN; + if (!dissect_dcerpc_cn(tvb, 0, pinfo, tree, FALSE, NULL)) { /* * It wasn't a DCERPC PDU. */ @@ -4567,12 +4580,12 @@ dissect_dcerpc_cn_pk (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * to be able to know what kind of private_data structure to expect. */ static gboolean -dissect_dcerpc_cn_bs_body (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +dissect_dcerpc_cn_bs_body(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - volatile int offset = 0; - int pdu_len = 0; + volatile int offset = 0; + int pdu_len = 0; volatile gboolean dcerpc_pdus = 0; - volatile gboolean ret = FALSE; + volatile gboolean ret = FALSE; /* * There may be multiple PDUs per transport packet; keep @@ -4590,7 +4603,7 @@ dissect_dcerpc_cn_bs_body (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ TRY { pdu_len = 0; - if(dissect_dcerpc_cn (tvb, offset, pinfo, tree, + if (dissect_dcerpc_cn(tvb, offset, pinfo, tree, dcerpc_cn_desegment, &pdu_len)) { dcerpc_pdus++; } @@ -4644,35 +4657,35 @@ dissect_dcerpc_cn_bs_body (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } static gboolean -dissect_dcerpc_cn_bs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +dissect_dcerpc_cn_bs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - pinfo->dcetransporttype=DCE_TRANSPORT_UNKNOWN; + pinfo->dcetransporttype = DCE_TRANSPORT_UNKNOWN; return dissect_dcerpc_cn_bs_body(tvb, pinfo, tree); } static gboolean -dissect_dcerpc_cn_smbpipe (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +dissect_dcerpc_cn_smbpipe(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - pinfo->dcetransporttype=DCE_CN_TRANSPORT_SMBPIPE; + pinfo->dcetransporttype = DCE_CN_TRANSPORT_SMBPIPE; return dissect_dcerpc_cn_bs_body(tvb, pinfo, tree); } static gboolean -dissect_dcerpc_cn_smb2 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +dissect_dcerpc_cn_smb2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - pinfo->dcetransporttype=DCE_TRANSPORT_UNKNOWN; + pinfo->dcetransporttype = DCE_TRANSPORT_UNKNOWN; return dissect_dcerpc_cn_bs_body(tvb, pinfo, tree); } static void -dissect_dcerpc_dg_auth (tvbuff_t *tvb, int offset, proto_tree *dcerpc_tree, - e_dce_dg_common_hdr_t *hdr, int *auth_level_p) +dissect_dcerpc_dg_auth(tvbuff_t *tvb, int offset, proto_tree *dcerpc_tree, + e_dce_dg_common_hdr_t *hdr, int *auth_level_p) { - proto_item *ti = NULL; + proto_item *ti = NULL; proto_tree *auth_tree = NULL; - guint8 protection_level; + guint8 protection_level; /* * Initially set "*auth_level_p" to -1 to indicate that we haven't @@ -4694,73 +4707,73 @@ dissect_dcerpc_dg_auth (tvbuff_t *tvb, int offset, proto_tree *dcerpc_tree, switch (hdr->auth_proto) { case DCE_C_RPC_AUTHN_PROTOCOL_KRB5: - ti = proto_tree_add_text (dcerpc_tree, tvb, offset, -1, "Kerberos authentication verifier"); - auth_tree = proto_item_add_subtree (ti, ett_dcerpc_krb5_auth_verf); - protection_level = tvb_get_guint8 (tvb, offset); + ti = proto_tree_add_text(dcerpc_tree, tvb, offset, -1, "Kerberos authentication verifier"); + auth_tree = proto_item_add_subtree(ti, ett_dcerpc_krb5_auth_verf); + protection_level = tvb_get_guint8(tvb, offset); if (auth_level_p != NULL) *auth_level_p = protection_level; - proto_tree_add_uint (auth_tree, hf_dcerpc_krb5_av_prot_level, tvb, offset, 1, protection_level); + proto_tree_add_uint(auth_tree, hf_dcerpc_krb5_av_prot_level, tvb, offset, 1, protection_level); offset++; - proto_tree_add_item (auth_tree, hf_dcerpc_krb5_av_key_vers_num, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(auth_tree, hf_dcerpc_krb5_av_key_vers_num, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; if (protection_level == DCE_C_AUTHN_LEVEL_PKT_PRIVACY) offset += 6; /* 6 bytes of padding */ else offset += 2; /* 2 bytes of padding */ - proto_tree_add_item (auth_tree, hf_dcerpc_krb5_av_key_auth_verifier, tvb, offset, 16, ENC_NA); + proto_tree_add_item(auth_tree, hf_dcerpc_krb5_av_key_auth_verifier, tvb, offset, 16, ENC_NA); offset += 16; break; default: - proto_tree_add_text (dcerpc_tree, tvb, offset, -1, "Authentication verifier"); + proto_tree_add_text(dcerpc_tree, tvb, offset, -1, "Authentication verifier"); break; } } } static void -dissect_dcerpc_dg_cancel_ack (tvbuff_t *tvb, int offset, packet_info *pinfo, - proto_tree *dcerpc_tree, - e_dce_dg_common_hdr_t *hdr) +dissect_dcerpc_dg_cancel_ack(tvbuff_t *tvb, int offset, packet_info *pinfo, + proto_tree *dcerpc_tree, + e_dce_dg_common_hdr_t *hdr) { guint32 version; - offset = dissect_dcerpc_uint32 (tvb, offset, pinfo, dcerpc_tree, - hdr->drep, hf_dcerpc_dg_cancel_vers, - &version); + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, dcerpc_tree, + hdr->drep, hf_dcerpc_dg_cancel_vers, + &version); switch (version) { case 0: /* The only version we know about */ - offset = dissect_dcerpc_uint32 (tvb, offset, pinfo, dcerpc_tree, - hdr->drep, hf_dcerpc_dg_cancel_id, - NULL); - offset = dissect_dcerpc_uint8 (tvb, offset, pinfo, dcerpc_tree, - hdr->drep, hf_dcerpc_dg_server_accepting_cancels, + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, dcerpc_tree, + hdr->drep, hf_dcerpc_dg_cancel_id, NULL); + offset = dissect_dcerpc_uint8(tvb, offset, pinfo, dcerpc_tree, + hdr->drep, hf_dcerpc_dg_server_accepting_cancels, + NULL); break; } } static void -dissect_dcerpc_dg_cancel (tvbuff_t *tvb, int offset, packet_info *pinfo, - proto_tree *dcerpc_tree, - e_dce_dg_common_hdr_t *hdr) +dissect_dcerpc_dg_cancel(tvbuff_t *tvb, int offset, packet_info *pinfo, + proto_tree *dcerpc_tree, + e_dce_dg_common_hdr_t *hdr) { guint32 version; - offset = dissect_dcerpc_uint32 (tvb, offset, pinfo, dcerpc_tree, - hdr->drep, hf_dcerpc_dg_cancel_vers, - &version); + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, dcerpc_tree, + hdr->drep, hf_dcerpc_dg_cancel_vers, + &version); switch (version) { case 0: /* The only version we know about */ - offset = dissect_dcerpc_uint32 (tvb, offset, pinfo, dcerpc_tree, - hdr->drep, hf_dcerpc_dg_cancel_id, - NULL); + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, dcerpc_tree, + hdr->drep, hf_dcerpc_dg_cancel_id, + NULL); /* XXX - are NDR Booleans 32 bits? */ /* XXX - the RPC reference in chapter: "the cancel PDU" doesn't mention @@ -4773,18 +4786,18 @@ dissect_dcerpc_dg_cancel (tvbuff_t *tvb, int offset, packet_info *pinfo, } static void -dissect_dcerpc_dg_fack (tvbuff_t *tvb, int offset, packet_info *pinfo, - proto_tree *dcerpc_tree, - e_dce_dg_common_hdr_t *hdr) +dissect_dcerpc_dg_fack(tvbuff_t *tvb, int offset, packet_info *pinfo, + proto_tree *dcerpc_tree, + e_dce_dg_common_hdr_t *hdr) { - guint8 version; + guint8 version; guint16 serial_num; guint16 selack_len; - guint i; + guint i; - offset = dissect_dcerpc_uint8 (tvb, offset, pinfo, dcerpc_tree, - hdr->drep, hf_dcerpc_dg_fack_vers, - &version); + offset = dissect_dcerpc_uint8(tvb, offset, pinfo, dcerpc_tree, + hdr->drep, hf_dcerpc_dg_fack_vers, + &version); /* padding */ offset++; @@ -4792,27 +4805,27 @@ dissect_dcerpc_dg_fack (tvbuff_t *tvb, int offset, packet_info *pinfo, case 0: /* The only version documented in the DCE RPC 1.1 spec */ case 1: /* This appears to be the same */ - offset = dissect_dcerpc_uint16 (tvb, offset, pinfo, dcerpc_tree, - hdr->drep, hf_dcerpc_dg_fack_window_size, - NULL); - offset = dissect_dcerpc_uint32 (tvb, offset, pinfo, dcerpc_tree, - hdr->drep, hf_dcerpc_dg_fack_max_tsdu, - NULL); - offset = dissect_dcerpc_uint32 (tvb, offset, pinfo, dcerpc_tree, - hdr->drep, hf_dcerpc_dg_fack_max_frag_size, - NULL); - offset = dissect_dcerpc_uint16 (tvb, offset, pinfo, dcerpc_tree, - hdr->drep, hf_dcerpc_dg_fack_serial_num, - &serial_num); - col_append_fstr (pinfo->cinfo, COL_INFO, " serial: %u", + offset = dissect_dcerpc_uint16(tvb, offset, pinfo, dcerpc_tree, + hdr->drep, hf_dcerpc_dg_fack_window_size, + NULL); + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, dcerpc_tree, + hdr->drep, hf_dcerpc_dg_fack_max_tsdu, + NULL); + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, dcerpc_tree, + hdr->drep, hf_dcerpc_dg_fack_max_frag_size, + NULL); + offset = dissect_dcerpc_uint16(tvb, offset, pinfo, dcerpc_tree, + hdr->drep, hf_dcerpc_dg_fack_serial_num, + &serial_num); + col_append_fstr(pinfo->cinfo, COL_INFO, " serial: %u", serial_num); - offset = dissect_dcerpc_uint16 (tvb, offset, pinfo, dcerpc_tree, - hdr->drep, hf_dcerpc_dg_fack_selack_len, - &selack_len); + offset = dissect_dcerpc_uint16(tvb, offset, pinfo, dcerpc_tree, + hdr->drep, hf_dcerpc_dg_fack_selack_len, + &selack_len); for (i = 0; i < selack_len; i++) { - offset = dissect_dcerpc_uint32 (tvb, offset, pinfo, dcerpc_tree, - hdr->drep, hf_dcerpc_dg_fack_selack, - NULL); + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, dcerpc_tree, + hdr->drep, hf_dcerpc_dg_fack_selack, + NULL); } break; @@ -4820,15 +4833,15 @@ dissect_dcerpc_dg_fack (tvbuff_t *tvb, int offset, packet_info *pinfo, } static void -dissect_dcerpc_dg_reject_fault (tvbuff_t *tvb, int offset, packet_info *pinfo, - proto_tree *dcerpc_tree, - e_dce_dg_common_hdr_t *hdr) +dissect_dcerpc_dg_reject_fault(tvbuff_t *tvb, int offset, packet_info *pinfo, + proto_tree *dcerpc_tree, + e_dce_dg_common_hdr_t *hdr) { guint32 status; - offset = dissect_dcerpc_uint32 (tvb, offset, pinfo, dcerpc_tree, - hdr->drep, hf_dcerpc_dg_status, - &status); + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, dcerpc_tree, + hdr->drep, hf_dcerpc_dg_status, + &status); col_append_fstr (pinfo->cinfo, COL_INFO, ": status: %s", @@ -4836,22 +4849,22 @@ dissect_dcerpc_dg_reject_fault (tvbuff_t *tvb, int offset, packet_info *pinfo, } static void -dissect_dcerpc_dg_stub (tvbuff_t *tvb, int offset, packet_info *pinfo, - proto_tree *dcerpc_tree, proto_tree *tree, - e_dce_dg_common_hdr_t *hdr, dcerpc_info *di) +dissect_dcerpc_dg_stub(tvbuff_t *tvb, int offset, packet_info *pinfo, + proto_tree *dcerpc_tree, proto_tree *tree, + e_dce_dg_common_hdr_t *hdr, dcerpc_info *di) { - int length, reported_length, stub_length; - gboolean save_fragmented; + int length, reported_length, stub_length; + gboolean save_fragmented; fragment_data *fd_head; - tvbuff_t *next_tvb; - proto_item *pi; - proto_item *parent_pi; + tvbuff_t *next_tvb; + proto_item *pi; + proto_item *parent_pi; - col_append_fstr (pinfo->cinfo, COL_INFO, " opnum: %u len: %u", - di->call_data->opnum, hdr->frag_len ); + col_append_fstr(pinfo->cinfo, COL_INFO, " opnum: %u len: %u", + di->call_data->opnum, hdr->frag_len ); - length = tvb_length_remaining (tvb, offset); - reported_length = tvb_reported_length_remaining (tvb, offset); + length = tvb_length_remaining(tvb, offset); + reported_length = tvb_reported_length_remaining(tvb, offset); stub_length = hdr->frag_len; if (length > stub_length) length = stub_length; @@ -4865,9 +4878,9 @@ dissect_dcerpc_dg_stub (tvbuff_t *tvb, int offset, packet_info *pinfo, not reassembled at a lower layer) that doesn't include all the data in the fragment, just call the handoff directly if this is the first fragment or the PDU isn't fragmented. */ - if( (!dcerpc_reassemble) || !(hdr->flags1 & PFCL1_FRAG) || - !tvb_bytes_exist(tvb, offset, stub_length) ){ - if(hdr->frag_num == 0) { + if ( (!dcerpc_reassemble) || !(hdr->flags1 & PFCL1_FRAG) || + !tvb_bytes_exist(tvb, offset, stub_length) ) { + if (hdr->frag_num == 0) { /* First fragment, possibly the only fragment */ @@ -4876,19 +4889,19 @@ dissect_dcerpc_dg_stub (tvbuff_t *tvb, int offset, packet_info *pinfo, * XXX - authentication info? */ pinfo->fragmented = (hdr->flags1 & PFCL1_FRAG); - next_tvb = tvb_new_subset (tvb, offset, length, - reported_length); - dcerpc_try_handoff (pinfo, tree, dcerpc_tree, next_tvb, - next_tvb, hdr->drep, di, NULL); + next_tvb = tvb_new_subset(tvb, offset, length, + reported_length); + dcerpc_try_handoff(pinfo, tree, dcerpc_tree, next_tvb, + next_tvb, hdr->drep, di, NULL); } else { /* PDU is fragmented and this isn't the first fragment */ if (dcerpc_tree) { if (length > 0) { tvb_ensure_bytes_exist(tvb, offset, stub_length); - proto_tree_add_text (dcerpc_tree, tvb, offset, stub_length, - "Fragment data (%d byte%s)", - stub_length, - plurality(stub_length, "", "s")); + proto_tree_add_text(dcerpc_tree, tvb, offset, stub_length, + "Fragment data (%d byte%s)", + stub_length, + plurality(stub_length, "", "s")); } } } @@ -4900,9 +4913,9 @@ dissect_dcerpc_dg_stub (tvbuff_t *tvb, int offset, packet_info *pinfo, if (dcerpc_tree) { if (length > 0) { tvb_ensure_bytes_exist(tvb, offset, stub_length); - proto_tree_add_text (dcerpc_tree, tvb, offset, stub_length, - "Fragment data (%d byte%s)", stub_length, - plurality(stub_length, "", "s")); + proto_tree_add_text(dcerpc_tree, tvb, offset, stub_length, + "Fragment data (%d byte%s)", stub_length, + plurality(stub_length, "", "s")); } } @@ -4912,7 +4925,7 @@ dissect_dcerpc_dg_stub (tvbuff_t *tvb, int offset, packet_info *pinfo, !(hdr->flags1 & PFCL1_LASTFRAG)); if (fd_head != NULL) { /* We completed reassembly... */ - if(pinfo->fd->num==fd_head->reassembled_in) { + if (pinfo->fd->num == fd_head->reassembled_in) { /* ...and this is the reassembled RPC PDU */ next_tvb = tvb_new_child_real_data(tvb, fd_head->data, fd_head->len, fd_head->len); add_new_data_source(pinfo, next_tvb, "Reassembled DCE/RPC"); @@ -4923,15 +4936,15 @@ dissect_dcerpc_dg_stub (tvbuff_t *tvb, int offset, packet_info *pinfo, * XXX - authentication info? */ pinfo->fragmented = FALSE; - dcerpc_try_handoff (pinfo, tree, dcerpc_tree, next_tvb, - next_tvb, hdr->drep, di, NULL); + dcerpc_try_handoff(pinfo, tree, dcerpc_tree, next_tvb, + next_tvb, hdr->drep, di, NULL); } else { /* ...and this isn't the reassembled RPC PDU */ pi = proto_tree_add_uint(dcerpc_tree, hf_dcerpc_reassembled_in, tvb, 0, 0, fd_head->reassembled_in); PROTO_ITEM_SET_GENERATED(pi); parent_pi = proto_tree_get_parent(dcerpc_tree); - if(parent_pi != NULL) { + if (parent_pi != NULL) { proto_item_append_text(parent_pi, ", [Reas: #%u]", fd_head->reassembled_in); } col_append_fstr(pinfo->cinfo, COL_INFO, @@ -4943,52 +4956,52 @@ dissect_dcerpc_dg_stub (tvbuff_t *tvb, int offset, packet_info *pinfo, } static void -dissect_dcerpc_dg_rqst (tvbuff_t *tvb, int offset, packet_info *pinfo, - proto_tree *dcerpc_tree, proto_tree *tree, - e_dce_dg_common_hdr_t *hdr, conversation_t *conv) +dissect_dcerpc_dg_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, + proto_tree *dcerpc_tree, proto_tree *tree, + e_dce_dg_common_hdr_t *hdr, conversation_t *conv) { - dcerpc_info *di; - dcerpc_call_value *value, v; - dcerpc_matched_key matched_key, *new_matched_key; - proto_item *pi; - proto_item *parent_pi; + dcerpc_info *di; + dcerpc_call_value *value, v; + dcerpc_matched_key matched_key, *new_matched_key; + proto_item *pi; + proto_item *parent_pi; - di=get_next_di(); - if(!(pinfo->fd->flags.visited)){ + di = get_next_di(); + if (!(pinfo->fd->flags.visited)) { dcerpc_call_value *call_value; dcerpc_dg_call_key *call_key; - call_key=se_alloc (sizeof (dcerpc_dg_call_key)); - call_key->conv=conv; - call_key->seqnum=hdr->seqnum; - call_key->act_id=hdr->act_id; + call_key = se_alloc(sizeof (dcerpc_dg_call_key)); + call_key->conv = conv; + call_key->seqnum = hdr->seqnum; + call_key->act_id = hdr->act_id; - call_value=se_alloc (sizeof (dcerpc_call_value)); + call_value = se_alloc(sizeof (dcerpc_call_value)); call_value->uuid = hdr->if_id; call_value->ver = hdr->if_ver; call_value->object_uuid = hdr->obj_id; call_value->opnum = hdr->opnum; - call_value->req_frame=pinfo->fd->num; - call_value->req_time=pinfo->fd->abs_ts; - call_value->rep_frame=0; - call_value->max_ptr=0; + call_value->req_frame = pinfo->fd->num; + call_value->req_time = pinfo->fd->abs_ts; + call_value->rep_frame = 0; + call_value->max_ptr = 0; call_value->se_data = NULL; call_value->private_data = NULL; call_value->pol = NULL; /* NDR64 is not available on dg transports ?*/ call_value->flags = 0; - g_hash_table_insert (dcerpc_dg_calls, call_key, call_value); + g_hash_table_insert(dcerpc_dg_calls, call_key, call_value); - new_matched_key = se_alloc(sizeof (dcerpc_matched_key)); + new_matched_key = se_alloc(sizeof(dcerpc_matched_key)); new_matched_key->frame = pinfo->fd->num; new_matched_key->call_id = hdr->seqnum; - g_hash_table_insert (dcerpc_matched, new_matched_key, call_value); + g_hash_table_insert(dcerpc_matched, new_matched_key, call_value); } matched_key.frame = pinfo->fd->num; matched_key.call_id = hdr->seqnum; - value=g_hash_table_lookup(dcerpc_matched, &matched_key); + value = g_hash_table_lookup(dcerpc_matched, &matched_key); if (!value) { v.uuid = hdr->if_id; v.ver = hdr->if_ver; @@ -4997,8 +5010,8 @@ dissect_dcerpc_dg_rqst (tvbuff_t *tvb, int offset, packet_info *pinfo, v.req_frame = pinfo->fd->num; v.rep_frame = 0; v.max_ptr = 0; - v.se_data=NULL; - v.private_data=NULL; + v.se_data = NULL; + v.private_data = NULL; value = &v; } @@ -5008,61 +5021,61 @@ dissect_dcerpc_dg_rqst (tvbuff_t *tvb, int offset, packet_info *pinfo, di->ptype = PDU_REQ; di->call_data = value; - if(value->rep_frame!=0){ + if (value->rep_frame != 0) { pi = proto_tree_add_uint(dcerpc_tree, hf_dcerpc_response_in, tvb, 0, 0, value->rep_frame); PROTO_ITEM_SET_GENERATED(pi); parent_pi = proto_tree_get_parent(dcerpc_tree); - if(parent_pi != NULL) { + if (parent_pi != NULL) { proto_item_append_text(parent_pi, ", [Resp: #%u]", value->rep_frame); } } - dissect_dcerpc_dg_stub (tvb, offset, pinfo, dcerpc_tree, tree, hdr, di); + dissect_dcerpc_dg_stub(tvb, offset, pinfo, dcerpc_tree, tree, hdr, di); } static void -dissect_dcerpc_dg_resp (tvbuff_t *tvb, int offset, packet_info *pinfo, - proto_tree *dcerpc_tree, proto_tree *tree, - e_dce_dg_common_hdr_t *hdr, conversation_t *conv) +dissect_dcerpc_dg_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, + proto_tree *dcerpc_tree, proto_tree *tree, + e_dce_dg_common_hdr_t *hdr, conversation_t *conv) { - dcerpc_info *di; - dcerpc_call_value *value, v; - dcerpc_matched_key matched_key, *new_matched_key; - proto_item *pi; - proto_item *parent_pi; + dcerpc_info *di; + dcerpc_call_value *value, v; + dcerpc_matched_key matched_key, *new_matched_key; + proto_item *pi; + proto_item *parent_pi; - di=get_next_di(); - if(!(pinfo->fd->flags.visited)){ + di = get_next_di(); + if (!(pinfo->fd->flags.visited)) { dcerpc_call_value *call_value; dcerpc_dg_call_key call_key; - call_key.conv=conv; - call_key.seqnum=hdr->seqnum; - call_key.act_id=hdr->act_id; + call_key.conv = conv; + call_key.seqnum = hdr->seqnum; + call_key.act_id = hdr->act_id; - if((call_value=g_hash_table_lookup(dcerpc_dg_calls, &call_key))){ + if ((call_value = g_hash_table_lookup(dcerpc_dg_calls, &call_key))) { new_matched_key = se_alloc(sizeof (dcerpc_matched_key)); new_matched_key->frame = pinfo->fd->num; new_matched_key->call_id = hdr->seqnum; - g_hash_table_insert (dcerpc_matched, new_matched_key, call_value); - if(call_value->rep_frame==0){ - call_value->rep_frame=pinfo->fd->num; + g_hash_table_insert(dcerpc_matched, new_matched_key, call_value); + if (call_value->rep_frame == 0) { + call_value->rep_frame = pinfo->fd->num; } } } matched_key.frame = pinfo->fd->num; matched_key.call_id = hdr->seqnum; - value=g_hash_table_lookup(dcerpc_matched, &matched_key); + value = g_hash_table_lookup(dcerpc_matched, &matched_key); if (!value) { v.uuid = hdr->if_id; v.ver = hdr->if_ver; v.object_uuid = hdr->obj_id; v.opnum = hdr->opnum; - v.req_frame=0; - v.rep_frame=pinfo->fd->num; - v.se_data=NULL; - v.private_data=NULL; + v.req_frame = 0; + v.rep_frame = pinfo->fd->num; + v.se_data = NULL; + v.private_data = NULL; value = &v; } @@ -5072,13 +5085,13 @@ dissect_dcerpc_dg_resp (tvbuff_t *tvb, int offset, packet_info *pinfo, di->ptype = PDU_RESP; di->call_data = value; - if(value->req_frame!=0){ + if (value->req_frame != 0) { nstime_t delta_ts; pi = proto_tree_add_uint(dcerpc_tree, hf_dcerpc_request_in, tvb, 0, 0, value->req_frame); PROTO_ITEM_SET_GENERATED(pi); parent_pi = proto_tree_get_parent(dcerpc_tree); - if(parent_pi != NULL) { + if (parent_pi != NULL) { proto_item_append_text(parent_pi, ", [Req: #%u]", value->req_frame); } nstime_delta(&delta_ts, &pinfo->fd->abs_ts, &value->req_time); @@ -5090,24 +5103,24 @@ dissect_dcerpc_dg_resp (tvbuff_t *tvb, int offset, packet_info *pinfo, expert_add_info_format(pinfo, pi, PI_SEQUENCE, PI_NOTE, "No request to this DCE/RPC call found"); } - dissect_dcerpc_dg_stub (tvb, offset, pinfo, dcerpc_tree, tree, hdr, di); + dissect_dcerpc_dg_stub(tvb, offset, pinfo, dcerpc_tree, tree, hdr, di); } static void -dissect_dcerpc_dg_ping_ack (tvbuff_t *tvb, int offset, packet_info *pinfo, - proto_tree *dcerpc_tree, - e_dce_dg_common_hdr_t *hdr, conversation_t *conv) +dissect_dcerpc_dg_ping_ack(tvbuff_t *tvb, int offset, packet_info *pinfo, + proto_tree *dcerpc_tree, + e_dce_dg_common_hdr_t *hdr, conversation_t *conv) { - proto_item *parent_pi; -/* if(!(pinfo->fd->flags.visited)){*/ - dcerpc_call_value *call_value; - dcerpc_dg_call_key call_key; + proto_item *parent_pi; +/* if (!(pinfo->fd->flags.visited)) {*/ + dcerpc_call_value *call_value; + dcerpc_dg_call_key call_key; - call_key.conv=conv; - call_key.seqnum=hdr->seqnum; - call_key.act_id=hdr->act_id; + call_key.conv = conv; + call_key.seqnum = hdr->seqnum; + call_key.act_id = hdr->act_id; - if((call_value=g_hash_table_lookup(dcerpc_dg_calls, &call_key))){ + if ((call_value = g_hash_table_lookup(dcerpc_dg_calls, &call_key))) { proto_item *pi; nstime_t delta_ts; @@ -5115,7 +5128,7 @@ dissect_dcerpc_dg_ping_ack (tvbuff_t *tvb, int offset, packet_info *pinfo, tvb, 0, 0, call_value->req_frame); PROTO_ITEM_SET_GENERATED(pi); parent_pi = proto_tree_get_parent(dcerpc_tree); - if(parent_pi != NULL) { + if (parent_pi != NULL) { proto_item_append_text(parent_pi, ", [Req: #%u]", call_value->req_frame); } @@ -5132,88 +5145,88 @@ dissect_dcerpc_dg_ping_ack (tvbuff_t *tvb, int offset, packet_info *pinfo, * DCERPC dissector for connectionless calls */ static gboolean -dissect_dcerpc_dg (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +dissect_dcerpc_dg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_item *ti = NULL; - proto_item *tf = NULL; - proto_tree *dcerpc_tree = NULL; - proto_tree *dg_flags1_tree = NULL; - proto_tree *dg_flags2_tree = NULL; - proto_tree *drep_tree = NULL; - e_dce_dg_common_hdr_t hdr; - int offset = 0; - conversation_t *conv; - int auth_level; - char *uuid_str; - const char *uuid_name = NULL; + proto_item *ti = NULL; + proto_item *tf = NULL; + proto_tree *dcerpc_tree = NULL; + proto_tree *dg_flags1_tree = NULL; + proto_tree *dg_flags2_tree = NULL; + proto_tree *drep_tree = NULL; + e_dce_dg_common_hdr_t hdr; + int offset = 0; + conversation_t *conv; + int auth_level; + char *uuid_str; + const char *uuid_name = NULL; /* * Check if this looks like a CL DCERPC call. All dg packets * have an 80 byte header on them. Which starts with * version (4), pkt_type. */ - if (tvb_length (tvb) < sizeof (hdr)) { + if (tvb_length(tvb) < sizeof (hdr)) { return FALSE; } /* Version must be 4 */ - hdr.rpc_ver = tvb_get_guint8 (tvb, offset++); + hdr.rpc_ver = tvb_get_guint8(tvb, offset++); if (hdr.rpc_ver != 4) return FALSE; - /* Type must be <=19 or its not DCE/RPC */ - hdr.ptype = tvb_get_guint8 (tvb, offset++); + /* Type must be <= 19 or its not DCE/RPC */ + hdr.ptype = tvb_get_guint8(tvb, offset++); if (hdr.ptype > 19) return FALSE; /* flags1 has bit 1 and 8 as reserved so if any of them are set, it is probably not a DCE/RPC packet */ - hdr.flags1 = tvb_get_guint8 (tvb, offset++); - if(hdr.flags1&0x81) + hdr.flags1 = tvb_get_guint8(tvb, offset++); + if (hdr.flags1&0x81) return FALSE; /* flags2 has all bits except bit 2 as reserved so if any of them are set it is probably not DCE/RPC. */ - hdr.flags2 = tvb_get_guint8 (tvb, offset++); - if(hdr.flags2&0xfd) + hdr.flags2 = tvb_get_guint8(tvb, offset++); + if (hdr.flags2&0xfd) return FALSE; - col_set_str (pinfo->cinfo, COL_PROTOCOL, "DCERPC"); - col_add_str (pinfo->cinfo, COL_INFO, pckt_vals[hdr.ptype].strptr); + col_set_str(pinfo->cinfo, COL_PROTOCOL, "DCERPC"); + col_add_str(pinfo->cinfo, COL_INFO, pckt_vals[hdr.ptype].strptr); - tvb_memcpy (tvb, (guint8 *)hdr.drep, offset, sizeof (hdr.drep)); + tvb_memcpy(tvb, (guint8 *)hdr.drep, offset, sizeof (hdr.drep)); offset += sizeof (hdr.drep); - hdr.serial_hi = tvb_get_guint8 (tvb, offset++); - dcerpc_tvb_get_uuid (tvb, offset, hdr.drep, &hdr.obj_id); + hdr.serial_hi = tvb_get_guint8(tvb, offset++); + dcerpc_tvb_get_uuid(tvb, offset, hdr.drep, &hdr.obj_id); offset += 16; - dcerpc_tvb_get_uuid (tvb, offset, hdr.drep, &hdr.if_id); + dcerpc_tvb_get_uuid(tvb, offset, hdr.drep, &hdr.if_id); offset += 16; - dcerpc_tvb_get_uuid (tvb, offset, hdr.drep, &hdr.act_id); + dcerpc_tvb_get_uuid(tvb, offset, hdr.drep, &hdr.act_id); offset += 16; - hdr.server_boot = dcerpc_tvb_get_ntohl (tvb, offset, hdr.drep); + hdr.server_boot = dcerpc_tvb_get_ntohl(tvb, offset, hdr.drep); offset += 4; - hdr.if_ver = dcerpc_tvb_get_ntohl (tvb, offset, hdr.drep); + hdr.if_ver = dcerpc_tvb_get_ntohl(tvb, offset, hdr.drep); offset += 4; - hdr.seqnum = dcerpc_tvb_get_ntohl (tvb, offset, hdr.drep); + hdr.seqnum = dcerpc_tvb_get_ntohl(tvb, offset, hdr.drep); offset += 4; - hdr.opnum = dcerpc_tvb_get_ntohs (tvb, offset, hdr.drep); + hdr.opnum = dcerpc_tvb_get_ntohs(tvb, offset, hdr.drep); offset += 2; - hdr.ihint = dcerpc_tvb_get_ntohs (tvb, offset, hdr.drep); + hdr.ihint = dcerpc_tvb_get_ntohs(tvb, offset, hdr.drep); offset += 2; - hdr.ahint = dcerpc_tvb_get_ntohs (tvb, offset, hdr.drep); + hdr.ahint = dcerpc_tvb_get_ntohs(tvb, offset, hdr.drep); offset += 2; - hdr.frag_len = dcerpc_tvb_get_ntohs (tvb, offset, hdr.drep); + hdr.frag_len = dcerpc_tvb_get_ntohs(tvb, offset, hdr.drep); offset += 2; - hdr.frag_num = dcerpc_tvb_get_ntohs (tvb, offset, hdr.drep); + hdr.frag_num = dcerpc_tvb_get_ntohs(tvb, offset, hdr.drep); offset += 2; - hdr.auth_proto = tvb_get_guint8 (tvb, offset++); - hdr.serial_lo = tvb_get_guint8 (tvb, offset++); + hdr.auth_proto = tvb_get_guint8(tvb, offset++); + hdr.serial_lo = tvb_get_guint8(tvb, offset++); if (tree) { - ti = proto_tree_add_item (tree, proto_dcerpc, tvb, 0, -1, ENC_NA); + ti = proto_tree_add_item(tree, proto_dcerpc, tvb, 0, -1, ENC_NA); if (ti) { dcerpc_tree = proto_item_add_subtree(ti, ett_dcerpc); proto_item_append_text(ti, " %s, Seq: %u, Serial: %u, Frag: %u, FragLen: %u", @@ -5225,26 +5238,26 @@ dissect_dcerpc_dg (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset = 0; if (tree) - proto_tree_add_uint (dcerpc_tree, hf_dcerpc_ver, tvb, offset, 1, hdr.rpc_ver); + proto_tree_add_uint(dcerpc_tree, hf_dcerpc_ver, tvb, offset, 1, hdr.rpc_ver); offset++; if (tree) - proto_tree_add_uint (dcerpc_tree, hf_dcerpc_packet_type, tvb, offset, 1, hdr.ptype); + proto_tree_add_uint(dcerpc_tree, hf_dcerpc_packet_type, tvb, offset, 1, hdr.ptype); offset++; if (tree) { - tf = proto_tree_add_uint (dcerpc_tree, hf_dcerpc_dg_flags1, tvb, offset, 1, hdr.flags1); - dg_flags1_tree = proto_item_add_subtree (tf, ett_dcerpc_dg_flags1); + tf = proto_tree_add_uint(dcerpc_tree, hf_dcerpc_dg_flags1, tvb, offset, 1, hdr.flags1); + dg_flags1_tree = proto_item_add_subtree(tf, ett_dcerpc_dg_flags1); if (dg_flags1_tree) { - proto_tree_add_boolean (dg_flags1_tree, hf_dcerpc_dg_flags1_rsrvd_80, tvb, offset, 1, hdr.flags1); - proto_tree_add_boolean (dg_flags1_tree, hf_dcerpc_dg_flags1_broadcast, tvb, offset, 1, hdr.flags1); - proto_tree_add_boolean (dg_flags1_tree, hf_dcerpc_dg_flags1_idempotent, tvb, offset, 1, hdr.flags1); - proto_tree_add_boolean (dg_flags1_tree, hf_dcerpc_dg_flags1_maybe, tvb, offset, 1, hdr.flags1); - proto_tree_add_boolean (dg_flags1_tree, hf_dcerpc_dg_flags1_nofack, tvb, offset, 1, hdr.flags1); - proto_tree_add_boolean (dg_flags1_tree, hf_dcerpc_dg_flags1_frag, tvb, offset, 1, hdr.flags1); - proto_tree_add_boolean (dg_flags1_tree, hf_dcerpc_dg_flags1_last_frag, tvb, offset, 1, hdr.flags1); - proto_tree_add_boolean (dg_flags1_tree, hf_dcerpc_dg_flags1_rsrvd_01, tvb, offset, 1, hdr.flags1); - if(hdr.flags1) { + proto_tree_add_boolean(dg_flags1_tree, hf_dcerpc_dg_flags1_rsrvd_80, tvb, offset, 1, hdr.flags1); + proto_tree_add_boolean(dg_flags1_tree, hf_dcerpc_dg_flags1_broadcast, tvb, offset, 1, hdr.flags1); + proto_tree_add_boolean(dg_flags1_tree, hf_dcerpc_dg_flags1_idempotent, tvb, offset, 1, hdr.flags1); + proto_tree_add_boolean(dg_flags1_tree, hf_dcerpc_dg_flags1_maybe, tvb, offset, 1, hdr.flags1); + proto_tree_add_boolean(dg_flags1_tree, hf_dcerpc_dg_flags1_nofack, tvb, offset, 1, hdr.flags1); + proto_tree_add_boolean(dg_flags1_tree, hf_dcerpc_dg_flags1_frag, tvb, offset, 1, hdr.flags1); + proto_tree_add_boolean(dg_flags1_tree, hf_dcerpc_dg_flags1_last_frag, tvb, offset, 1, hdr.flags1); + proto_tree_add_boolean(dg_flags1_tree, hf_dcerpc_dg_flags1_rsrvd_01, tvb, offset, 1, hdr.flags1); + if (hdr.flags1) { proto_item_append_text(tf, " %s%s%s%s%s%s", (hdr.flags1 & PFCL1_BROADCAST) ? "\"Broadcast\" " : "", (hdr.flags1 & PFCL1_IDEMPOTENT) ? "\"Idempotent\" " : "", @@ -5258,18 +5271,18 @@ dissect_dcerpc_dg (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset++; if (tree) { - tf = proto_tree_add_uint (dcerpc_tree, hf_dcerpc_dg_flags2, tvb, offset, 1, hdr.flags2); - dg_flags2_tree = proto_item_add_subtree (tf, ett_dcerpc_dg_flags2); + tf = proto_tree_add_uint(dcerpc_tree, hf_dcerpc_dg_flags2, tvb, offset, 1, hdr.flags2); + dg_flags2_tree = proto_item_add_subtree(tf, ett_dcerpc_dg_flags2); if (dg_flags2_tree) { - proto_tree_add_boolean (dg_flags2_tree, hf_dcerpc_dg_flags2_rsrvd_80, tvb, offset, 1, hdr.flags2); - proto_tree_add_boolean (dg_flags2_tree, hf_dcerpc_dg_flags2_rsrvd_40, tvb, offset, 1, hdr.flags2); - proto_tree_add_boolean (dg_flags2_tree, hf_dcerpc_dg_flags2_rsrvd_20, tvb, offset, 1, hdr.flags2); - proto_tree_add_boolean (dg_flags2_tree, hf_dcerpc_dg_flags2_rsrvd_10, tvb, offset, 1, hdr.flags2); - proto_tree_add_boolean (dg_flags2_tree, hf_dcerpc_dg_flags2_rsrvd_08, tvb, offset, 1, hdr.flags2); - proto_tree_add_boolean (dg_flags2_tree, hf_dcerpc_dg_flags2_rsrvd_04, tvb, offset, 1, hdr.flags2); - proto_tree_add_boolean (dg_flags2_tree, hf_dcerpc_dg_flags2_cancel_pending, tvb, offset, 1, hdr.flags2); - proto_tree_add_boolean (dg_flags2_tree, hf_dcerpc_dg_flags2_rsrvd_01, tvb, offset, 1, hdr.flags2); - if(hdr.flags2) { + proto_tree_add_boolean(dg_flags2_tree, hf_dcerpc_dg_flags2_rsrvd_80, tvb, offset, 1, hdr.flags2); + proto_tree_add_boolean(dg_flags2_tree, hf_dcerpc_dg_flags2_rsrvd_40, tvb, offset, 1, hdr.flags2); + proto_tree_add_boolean(dg_flags2_tree, hf_dcerpc_dg_flags2_rsrvd_20, tvb, offset, 1, hdr.flags2); + proto_tree_add_boolean(dg_flags2_tree, hf_dcerpc_dg_flags2_rsrvd_10, tvb, offset, 1, hdr.flags2); + proto_tree_add_boolean(dg_flags2_tree, hf_dcerpc_dg_flags2_rsrvd_08, tvb, offset, 1, hdr.flags2); + proto_tree_add_boolean(dg_flags2_tree, hf_dcerpc_dg_flags2_rsrvd_04, tvb, offset, 1, hdr.flags2); + proto_tree_add_boolean(dg_flags2_tree, hf_dcerpc_dg_flags2_cancel_pending, tvb, offset, 1, hdr.flags2); + proto_tree_add_boolean(dg_flags2_tree, hf_dcerpc_dg_flags2_rsrvd_01, tvb, offset, 1, hdr.flags2); + if (hdr.flags2) { proto_item_append_text(tf, " %s", (hdr.flags2 & PFCL2_CANCEL_PENDING) ? "\"Cancel Pending\" " : ""); } @@ -5278,48 +5291,48 @@ dissect_dcerpc_dg (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset++; if (tree) { - tf = proto_tree_add_bytes (dcerpc_tree, hf_dcerpc_drep, tvb, offset, sizeof (hdr.drep), hdr.drep); - drep_tree = proto_item_add_subtree (tf, ett_dcerpc_drep); + tf = proto_tree_add_bytes(dcerpc_tree, hf_dcerpc_drep, tvb, offset, sizeof (hdr.drep), hdr.drep); + drep_tree = proto_item_add_subtree(tf, ett_dcerpc_drep); if (drep_tree) { proto_tree_add_uint(drep_tree, hf_dcerpc_drep_byteorder, tvb, offset, 1, hdr.drep[0] >> 4); proto_tree_add_uint(drep_tree, hf_dcerpc_drep_character, tvb, offset, 1, hdr.drep[0] & 0x0f); proto_tree_add_uint(drep_tree, hf_dcerpc_drep_fp, tvb, offset+1, 1, hdr.drep[1]); proto_item_append_text(tf, " (Order: %s, Char: %s, Float: %s)", - val_to_str(hdr.drep[0] >> 4, drep_byteorder_vals, "Unknown"), - val_to_str(hdr.drep[0] & 0x0f, drep_character_vals, "Unknown"), - val_to_str(hdr.drep[1], drep_fp_vals, "Unknown")); + val_to_str_const(hdr.drep[0] >> 4, drep_byteorder_vals, "Unknown"), + val_to_str_const(hdr.drep[0] & 0x0f, drep_character_vals, "Unknown"), + val_to_str_const(hdr.drep[1], drep_fp_vals, "Unknown")); } } offset += sizeof (hdr.drep); if (tree) - proto_tree_add_uint (dcerpc_tree, hf_dcerpc_dg_serial_hi, tvb, offset, 1, hdr.serial_hi); + proto_tree_add_uint(dcerpc_tree, hf_dcerpc_dg_serial_hi, tvb, offset, 1, hdr.serial_hi); offset++; if (tree) { - proto_tree_add_guid_format (dcerpc_tree, hf_dcerpc_obj_id, tvb, - offset, 16, (e_guid_t *) &hdr.obj_id, "Object UUID: %s", - guid_to_str((e_guid_t *) &hdr.obj_id)); + proto_tree_add_guid_format(dcerpc_tree, hf_dcerpc_obj_id, tvb, + offset, 16, (e_guid_t *) &hdr.obj_id, "Object UUID: %s", + guid_to_str((e_guid_t *) &hdr.obj_id)); } offset += 16; if (tree) { uuid_str = guid_to_str((e_guid_t*)&hdr.if_id); uuid_name = guids_get_uuid_name(&hdr.if_id); - if(uuid_name) { - proto_tree_add_guid_format (dcerpc_tree, hf_dcerpc_dg_if_id, tvb, - offset, 16, (e_guid_t *) &hdr.if_id, "Interface: %s UUID: %s", uuid_name, uuid_str); + if (uuid_name) { + proto_tree_add_guid_format(dcerpc_tree, hf_dcerpc_dg_if_id, tvb, + offset, 16, (e_guid_t *) &hdr.if_id, "Interface: %s UUID: %s", uuid_name, uuid_str); } else { - proto_tree_add_guid_format (dcerpc_tree, hf_dcerpc_dg_if_id, tvb, - offset, 16, (e_guid_t *) &hdr.if_id, "Interface UUID: %s", uuid_str); + proto_tree_add_guid_format(dcerpc_tree, hf_dcerpc_dg_if_id, tvb, + offset, 16, (e_guid_t *) &hdr.if_id, "Interface UUID: %s", uuid_str); } } offset += 16; if (tree) { - proto_tree_add_guid_format (dcerpc_tree, hf_dcerpc_dg_act_id, tvb, - offset, 16, (e_guid_t *) &hdr.act_id, "Activity: %s", - guid_to_str((e_guid_t *) &hdr.act_id)); + proto_tree_add_guid_format(dcerpc_tree, hf_dcerpc_dg_act_id, tvb, + offset, 16, (e_guid_t *) &hdr.act_id, "Activity: %s", + guid_to_str((e_guid_t *) &hdr.act_id)); } offset += 16; @@ -5330,60 +5343,60 @@ dissect_dcerpc_dg (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) server_boot.nsecs = 0; if (hdr.server_boot == 0) - proto_tree_add_time_format (dcerpc_tree, hf_dcerpc_dg_server_boot, - tvb, offset, 4, &server_boot, - "Server boot time: Unknown (0)"); + proto_tree_add_time_format(dcerpc_tree, hf_dcerpc_dg_server_boot, + tvb, offset, 4, &server_boot, + "Server boot time: Unknown (0)"); else - proto_tree_add_time (dcerpc_tree, hf_dcerpc_dg_server_boot, - tvb, offset, 4, &server_boot); + proto_tree_add_time(dcerpc_tree, hf_dcerpc_dg_server_boot, + tvb, offset, 4, &server_boot); } offset += 4; if (tree) - proto_tree_add_uint (dcerpc_tree, hf_dcerpc_dg_if_ver, tvb, offset, 4, hdr.if_ver); + proto_tree_add_uint(dcerpc_tree, hf_dcerpc_dg_if_ver, tvb, offset, 4, hdr.if_ver); offset += 4; if (tree) - proto_tree_add_uint (dcerpc_tree, hf_dcerpc_dg_seqnum, tvb, offset, 4, hdr.seqnum); - col_append_fstr (pinfo->cinfo, COL_INFO, ": seq: %u", hdr.seqnum); - col_append_fstr (pinfo->cinfo, COL_DCE_CALL, "%u", hdr.seqnum); + proto_tree_add_uint(dcerpc_tree, hf_dcerpc_dg_seqnum, tvb, offset, 4, hdr.seqnum); + col_append_fstr(pinfo->cinfo, COL_INFO, ": seq: %u", hdr.seqnum); + col_append_fstr(pinfo->cinfo, COL_DCE_CALL, "%u", hdr.seqnum); offset += 4; if (tree) - proto_tree_add_uint (dcerpc_tree, hf_dcerpc_opnum, tvb, offset, 2, hdr.opnum); + proto_tree_add_uint(dcerpc_tree, hf_dcerpc_opnum, tvb, offset, 2, hdr.opnum); offset += 2; if (tree) - proto_tree_add_uint (dcerpc_tree, hf_dcerpc_dg_ihint, tvb, offset, 2, hdr.ihint); + proto_tree_add_uint(dcerpc_tree, hf_dcerpc_dg_ihint, tvb, offset, 2, hdr.ihint); offset += 2; if (tree) - proto_tree_add_uint (dcerpc_tree, hf_dcerpc_dg_ahint, tvb, offset, 2, hdr.ahint); + proto_tree_add_uint(dcerpc_tree, hf_dcerpc_dg_ahint, tvb, offset, 2, hdr.ahint); offset += 2; if (tree) - proto_tree_add_uint (dcerpc_tree, hf_dcerpc_dg_frag_len, tvb, offset, 2, hdr.frag_len); + proto_tree_add_uint(dcerpc_tree, hf_dcerpc_dg_frag_len, tvb, offset, 2, hdr.frag_len); offset += 2; if (tree) - proto_tree_add_uint (dcerpc_tree, hf_dcerpc_dg_frag_num, tvb, offset, 2, hdr.frag_num); + proto_tree_add_uint(dcerpc_tree, hf_dcerpc_dg_frag_num, tvb, offset, 2, hdr.frag_num); if (hdr.flags1 & PFCL1_FRAG) { /* Fragmented - put the fragment number into the Info column */ - col_append_fstr (pinfo->cinfo, COL_INFO, " frag: %u", + col_append_fstr(pinfo->cinfo, COL_INFO, " frag: %u", hdr.frag_num); } offset += 2; if (tree) - proto_tree_add_uint (dcerpc_tree, hf_dcerpc_dg_auth_proto, tvb, offset, 1, hdr.auth_proto); + proto_tree_add_uint(dcerpc_tree, hf_dcerpc_dg_auth_proto, tvb, offset, 1, hdr.auth_proto); offset++; if (tree) - proto_tree_add_uint (dcerpc_tree, hf_dcerpc_dg_serial_lo, tvb, offset, 1, hdr.serial_lo); + proto_tree_add_uint(dcerpc_tree, hf_dcerpc_dg_serial_lo, tvb, offset, 1, hdr.serial_lo); if (hdr.flags1 & PFCL1_FRAG) { /* Fragmented - put the serial number into the Info column */ - col_append_fstr (pinfo->cinfo, COL_INFO, " serial: %u", - (hdr.serial_hi << 8) | hdr.serial_lo); + col_append_fstr(pinfo->cinfo, COL_INFO, " serial: %u", + (hdr.serial_hi << 8) | hdr.serial_lo); } offset++; @@ -5393,8 +5406,8 @@ dissect_dcerpc_dg (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * DCE_C_AUTHN_LEVEL_PKT_PRIVACY, we can't dissect the * stub data. */ - dissect_dcerpc_dg_auth (tvb, offset, dcerpc_tree, &hdr, - &auth_level); + dissect_dcerpc_dg_auth(tvb, offset, dcerpc_tree, &hdr, + &auth_level); } /* @@ -5420,7 +5433,7 @@ dissect_dcerpc_dg (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Body is optional */ /* XXX - we assume "frag_len" is the length of the body */ if (hdr.frag_len != 0) - dissect_dcerpc_dg_cancel_ack (tvb, offset, pinfo, dcerpc_tree, &hdr); + dissect_dcerpc_dg_cancel_ack(tvb, offset, pinfo, dcerpc_tree, &hdr); break; case PDU_CL_CANCEL: @@ -5431,40 +5444,40 @@ dissect_dcerpc_dg (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ /* XXX - we assume "frag_len" is the length of the body */ if (hdr.frag_len != 0) - dissect_dcerpc_dg_cancel (tvb, offset, pinfo, dcerpc_tree, &hdr); + dissect_dcerpc_dg_cancel(tvb, offset, pinfo, dcerpc_tree, &hdr); break; case PDU_NOCALL: /* Body is optional; if present, it's the same as PDU_FACK */ /* XXX - we assume "frag_len" is the length of the body */ if (hdr.frag_len != 0) - dissect_dcerpc_dg_fack (tvb, offset, pinfo, dcerpc_tree, &hdr); + dissect_dcerpc_dg_fack(tvb, offset, pinfo, dcerpc_tree, &hdr); break; case PDU_FACK: /* Body is optional */ /* XXX - we assume "frag_len" is the length of the body */ if (hdr.frag_len != 0) - dissect_dcerpc_dg_fack (tvb, offset, pinfo, dcerpc_tree, &hdr); + dissect_dcerpc_dg_fack(tvb, offset, pinfo, dcerpc_tree, &hdr); break; case PDU_REJECT: case PDU_FAULT: - dissect_dcerpc_dg_reject_fault (tvb, offset, pinfo, dcerpc_tree, &hdr); + dissect_dcerpc_dg_reject_fault(tvb, offset, pinfo, dcerpc_tree, &hdr); break; case PDU_REQ: - dissect_dcerpc_dg_rqst (tvb, offset, pinfo, dcerpc_tree, tree, &hdr, conv); + dissect_dcerpc_dg_rqst(tvb, offset, pinfo, dcerpc_tree, tree, &hdr, conv); break; case PDU_RESP: - dissect_dcerpc_dg_resp (tvb, offset, pinfo, dcerpc_tree, tree, &hdr, conv); + dissect_dcerpc_dg_resp(tvb, offset, pinfo, dcerpc_tree, tree, &hdr, conv); break; /* these requests have no body */ case PDU_ACK: case PDU_PING: - dissect_dcerpc_dg_ping_ack (tvb, offset, pinfo, dcerpc_tree, &hdr, conv); + dissect_dcerpc_dg_ping_ack(tvb, offset, pinfo, dcerpc_tree, &hdr, conv); break; case PDU_WORKING: default: @@ -5475,39 +5488,39 @@ dissect_dcerpc_dg (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } static void -dcerpc_init_protocol (void) +dcerpc_init_protocol(void) { /* structures and data for BIND */ - if (dcerpc_binds){ - g_hash_table_destroy (dcerpc_binds); - dcerpc_binds=NULL; + if (dcerpc_binds) { + g_hash_table_destroy(dcerpc_binds); + dcerpc_binds = NULL; } - if(!dcerpc_binds){ - dcerpc_binds = g_hash_table_new (dcerpc_bind_hash, dcerpc_bind_equal); + if (!dcerpc_binds) { + dcerpc_binds = g_hash_table_new(dcerpc_bind_hash, dcerpc_bind_equal); } /* structures and data for CALL */ - if (dcerpc_cn_calls){ - g_hash_table_destroy (dcerpc_cn_calls); + if (dcerpc_cn_calls) { + g_hash_table_destroy(dcerpc_cn_calls); } - dcerpc_cn_calls = g_hash_table_new (dcerpc_cn_call_hash, dcerpc_cn_call_equal); - if (dcerpc_dg_calls){ - g_hash_table_destroy (dcerpc_dg_calls); + dcerpc_cn_calls = g_hash_table_new(dcerpc_cn_call_hash, dcerpc_cn_call_equal); + if (dcerpc_dg_calls) { + g_hash_table_destroy(dcerpc_dg_calls); } - dcerpc_dg_calls = g_hash_table_new (dcerpc_dg_call_hash, dcerpc_dg_call_equal); + dcerpc_dg_calls = g_hash_table_new(dcerpc_dg_call_hash, dcerpc_dg_call_equal); /* structure and data for MATCHED */ - if (dcerpc_matched){ - g_hash_table_destroy (dcerpc_matched); + if (dcerpc_matched) { + g_hash_table_destroy(dcerpc_matched); } - dcerpc_matched = g_hash_table_new (dcerpc_matched_hash, dcerpc_matched_equal); + dcerpc_matched = g_hash_table_new(dcerpc_matched_hash, dcerpc_matched_equal); /* call the registered hooks */ g_hook_list_invoke(&dcerpc_hooks_init_protos, FALSE /* not may_recurse */); } void -proto_register_dcerpc (void) +proto_register_dcerpc(void) { static hf_register_info hf[] = { { &hf_dcerpc_request_in, @@ -5524,33 +5537,33 @@ proto_register_dcerpc (void) { &hf_dcerpc_ver_minor, { "Version (minor)", "dcerpc.ver_minor", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_dcerpc_packet_type, - { "Packet type", "dcerpc.pkt_type", FT_UINT8, BASE_DEC, VALS (pckt_vals), 0x0, NULL, HFILL }}, + { "Packet type", "dcerpc.pkt_type", FT_UINT8, BASE_DEC, VALS(pckt_vals), 0x0, NULL, HFILL }}, { &hf_dcerpc_cn_flags, { "Packet Flags", "dcerpc.cn_flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_dcerpc_cn_flags_first_frag, - { "First Frag", "dcerpc.cn_flags.first_frag", FT_BOOLEAN, 8, TFS (&tfs_set_notset), PFC_FIRST_FRAG, NULL, HFILL }}, + { "First Frag", "dcerpc.cn_flags.first_frag", FT_BOOLEAN, 8, TFS(&tfs_set_notset), PFC_FIRST_FRAG, NULL, HFILL }}, { &hf_dcerpc_cn_flags_last_frag, - { "Last Frag", "dcerpc.cn_flags.last_frag", FT_BOOLEAN, 8, TFS (&tfs_set_notset), PFC_LAST_FRAG, NULL, HFILL }}, + { "Last Frag", "dcerpc.cn_flags.last_frag", FT_BOOLEAN, 8, TFS(&tfs_set_notset), PFC_LAST_FRAG, NULL, HFILL }}, { &hf_dcerpc_cn_flags_cancel_pending, - { "Cancel Pending", "dcerpc.cn_flags.cancel_pending", FT_BOOLEAN, 8, TFS (&tfs_set_notset), PFC_PENDING_CANCEL, NULL, HFILL }}, + { "Cancel Pending", "dcerpc.cn_flags.cancel_pending", FT_BOOLEAN, 8, TFS(&tfs_set_notset), PFC_PENDING_CANCEL, NULL, HFILL }}, { &hf_dcerpc_cn_flags_reserved, - { "Reserved", "dcerpc.cn_flags.reserved", FT_BOOLEAN, 8, TFS (&tfs_set_notset), PFC_RESERVED_1, NULL, HFILL }}, + { "Reserved", "dcerpc.cn_flags.reserved", FT_BOOLEAN, 8, TFS(&tfs_set_notset), PFC_RESERVED_1, NULL, HFILL }}, { &hf_dcerpc_cn_flags_mpx, - { "Multiplex", "dcerpc.cn_flags.mpx", FT_BOOLEAN, 8, TFS (&tfs_set_notset), PFC_CONC_MPX, NULL, HFILL }}, + { "Multiplex", "dcerpc.cn_flags.mpx", FT_BOOLEAN, 8, TFS(&tfs_set_notset), PFC_CONC_MPX, NULL, HFILL }}, { &hf_dcerpc_cn_flags_dne, - { "Did Not Execute", "dcerpc.cn_flags.dne", FT_BOOLEAN, 8, TFS (&tfs_set_notset), PFC_DID_NOT_EXECUTE, NULL, HFILL }}, + { "Did Not Execute", "dcerpc.cn_flags.dne", FT_BOOLEAN, 8, TFS(&tfs_set_notset), PFC_DID_NOT_EXECUTE, NULL, HFILL }}, { &hf_dcerpc_cn_flags_maybe, - { "Maybe", "dcerpc.cn_flags.maybe", FT_BOOLEAN, 8, TFS (&tfs_set_notset), PFC_MAYBE, NULL, HFILL }}, + { "Maybe", "dcerpc.cn_flags.maybe", FT_BOOLEAN, 8, TFS(&tfs_set_notset), PFC_MAYBE, NULL, HFILL }}, { &hf_dcerpc_cn_flags_object, - { "Object", "dcerpc.cn_flags.object", FT_BOOLEAN, 8, TFS (&tfs_set_notset), PFC_OBJECT_UUID, NULL, HFILL }}, + { "Object", "dcerpc.cn_flags.object", FT_BOOLEAN, 8, TFS(&tfs_set_notset), PFC_OBJECT_UUID, NULL, HFILL }}, { &hf_dcerpc_drep, { "Data Representation", "dcerpc.drep", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_dcerpc_drep_byteorder, - { "Byte order", "dcerpc.drep.byteorder", FT_UINT8, BASE_DEC, VALS (drep_byteorder_vals), 0x0, NULL, HFILL }}, + { "Byte order", "dcerpc.drep.byteorder", FT_UINT8, BASE_DEC, VALS(drep_byteorder_vals), 0x0, NULL, HFILL }}, { &hf_dcerpc_drep_character, - { "Character", "dcerpc.drep.character", FT_UINT8, BASE_DEC, VALS (drep_character_vals), 0x0, NULL, HFILL }}, + { "Character", "dcerpc.drep.character", FT_UINT8, BASE_DEC, VALS(drep_character_vals), 0x0, NULL, HFILL }}, { &hf_dcerpc_drep_fp, - { "Floating-point", "dcerpc.drep.fp", FT_UINT8, BASE_DEC, VALS (drep_fp_vals), 0x0, NULL, HFILL }}, + { "Floating-point", "dcerpc.drep.fp", FT_UINT8, BASE_DEC, VALS(drep_fp_vals), 0x0, NULL, HFILL }}, { &hf_dcerpc_cn_frag_len, { "Frag Length", "dcerpc.cn_frag_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_dcerpc_cn_auth_len, @@ -5616,9 +5629,9 @@ proto_register_dcerpc (void) { &hf_dcerpc_cn_deseg_req, { "Desegmentation Required", "dcerpc.cn_deseg_req", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_dcerpc_auth_type, - { "Auth type", "dcerpc.auth_type", FT_UINT8, BASE_DEC, VALS (authn_protocol_vals), 0x0, NULL, HFILL }}, + { "Auth type", "dcerpc.auth_type", FT_UINT8, BASE_DEC, VALS(authn_protocol_vals), 0x0, NULL, HFILL }}, { &hf_dcerpc_auth_level, - { "Auth level", "dcerpc.auth_level", FT_UINT8, BASE_DEC, VALS (authn_level_vals), 0x0, NULL, HFILL }}, + { "Auth level", "dcerpc.auth_level", FT_UINT8, BASE_DEC, VALS(authn_level_vals), 0x0, NULL, HFILL }}, { &hf_dcerpc_auth_pad_len, { "Auth pad len", "dcerpc.auth_pad_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_dcerpc_auth_rsrvd, @@ -5628,39 +5641,39 @@ proto_register_dcerpc (void) { &hf_dcerpc_dg_flags1, { "Flags1", "dcerpc.dg_flags1", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_dcerpc_dg_flags1_rsrvd_01, - { "Reserved", "dcerpc.dg_flags1_rsrvd_01", FT_BOOLEAN, 8, TFS (&tfs_set_notset), PFCL1_RESERVED_01, NULL, HFILL }}, + { "Reserved", "dcerpc.dg_flags1_rsrvd_01", FT_BOOLEAN, 8, TFS(&tfs_set_notset), PFCL1_RESERVED_01, NULL, HFILL }}, { &hf_dcerpc_dg_flags1_last_frag, - { "Last Fragment", "dcerpc.dg_flags1_last_frag", FT_BOOLEAN, 8, TFS (&tfs_set_notset), PFCL1_LASTFRAG, NULL, HFILL }}, + { "Last Fragment", "dcerpc.dg_flags1_last_frag", FT_BOOLEAN, 8, TFS(&tfs_set_notset), PFCL1_LASTFRAG, NULL, HFILL }}, { &hf_dcerpc_dg_flags1_frag, - { "Fragment", "dcerpc.dg_flags1_frag", FT_BOOLEAN, 8, TFS (&tfs_set_notset), PFCL1_FRAG, NULL, HFILL }}, + { "Fragment", "dcerpc.dg_flags1_frag", FT_BOOLEAN, 8, TFS(&tfs_set_notset), PFCL1_FRAG, NULL, HFILL }}, { &hf_dcerpc_dg_flags1_nofack, - { "No Fack", "dcerpc.dg_flags1_nofack", FT_BOOLEAN, 8, TFS (&tfs_set_notset), PFCL1_NOFACK, NULL, HFILL }}, + { "No Fack", "dcerpc.dg_flags1_nofack", FT_BOOLEAN, 8, TFS(&tfs_set_notset), PFCL1_NOFACK, NULL, HFILL }}, { &hf_dcerpc_dg_flags1_maybe, - { "Maybe", "dcerpc.dg_flags1_maybe", FT_BOOLEAN, 8, TFS (&tfs_set_notset), PFCL1_MAYBE, NULL, HFILL }}, + { "Maybe", "dcerpc.dg_flags1_maybe", FT_BOOLEAN, 8, TFS(&tfs_set_notset), PFCL1_MAYBE, NULL, HFILL }}, { &hf_dcerpc_dg_flags1_idempotent, - { "Idempotent", "dcerpc.dg_flags1_idempotent", FT_BOOLEAN, 8, TFS (&tfs_set_notset), PFCL1_IDEMPOTENT, NULL, HFILL }}, + { "Idempotent", "dcerpc.dg_flags1_idempotent", FT_BOOLEAN, 8, TFS(&tfs_set_notset), PFCL1_IDEMPOTENT, NULL, HFILL }}, { &hf_dcerpc_dg_flags1_broadcast, - { "Broadcast", "dcerpc.dg_flags1_broadcast", FT_BOOLEAN, 8, TFS (&tfs_set_notset), PFCL1_BROADCAST, NULL, HFILL }}, + { "Broadcast", "dcerpc.dg_flags1_broadcast", FT_BOOLEAN, 8, TFS(&tfs_set_notset), PFCL1_BROADCAST, NULL, HFILL }}, { &hf_dcerpc_dg_flags1_rsrvd_80, - { "Reserved", "dcerpc.dg_flags1_rsrvd_80", FT_BOOLEAN, 8, TFS (&tfs_set_notset), PFCL1_RESERVED_80, NULL, HFILL }}, + { "Reserved", "dcerpc.dg_flags1_rsrvd_80", FT_BOOLEAN, 8, TFS(&tfs_set_notset), PFCL1_RESERVED_80, NULL, HFILL }}, { &hf_dcerpc_dg_flags2, { "Flags2", "dcerpc.dg_flags2", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_dcerpc_dg_flags2_rsrvd_01, - { "Reserved", "dcerpc.dg_flags2_rsrvd_01", FT_BOOLEAN, 8, TFS (&tfs_set_notset), PFCL2_RESERVED_01, NULL, HFILL }}, + { "Reserved", "dcerpc.dg_flags2_rsrvd_01", FT_BOOLEAN, 8, TFS(&tfs_set_notset), PFCL2_RESERVED_01, NULL, HFILL }}, { &hf_dcerpc_dg_flags2_cancel_pending, - { "Cancel Pending", "dcerpc.dg_flags2_cancel_pending", FT_BOOLEAN, 8, TFS (&tfs_set_notset), PFCL2_CANCEL_PENDING, NULL, HFILL }}, + { "Cancel Pending", "dcerpc.dg_flags2_cancel_pending", FT_BOOLEAN, 8, TFS(&tfs_set_notset), PFCL2_CANCEL_PENDING, NULL, HFILL }}, { &hf_dcerpc_dg_flags2_rsrvd_04, - { "Reserved", "dcerpc.dg_flags2_rsrvd_04", FT_BOOLEAN, 8, TFS (&tfs_set_notset), PFCL2_RESERVED_04, NULL, HFILL }}, + { "Reserved", "dcerpc.dg_flags2_rsrvd_04", FT_BOOLEAN, 8, TFS(&tfs_set_notset), PFCL2_RESERVED_04, NULL, HFILL }}, { &hf_dcerpc_dg_flags2_rsrvd_08, - { "Reserved", "dcerpc.dg_flags2_rsrvd_08", FT_BOOLEAN, 8, TFS (&tfs_set_notset), PFCL2_RESERVED_08, NULL, HFILL }}, + { "Reserved", "dcerpc.dg_flags2_rsrvd_08", FT_BOOLEAN, 8, TFS(&tfs_set_notset), PFCL2_RESERVED_08, NULL, HFILL }}, { &hf_dcerpc_dg_flags2_rsrvd_10, - { "Reserved", "dcerpc.dg_flags2_rsrvd_10", FT_BOOLEAN, 8, TFS (&tfs_set_notset), PFCL2_RESERVED_10, NULL, HFILL }}, + { "Reserved", "dcerpc.dg_flags2_rsrvd_10", FT_BOOLEAN, 8, TFS(&tfs_set_notset), PFCL2_RESERVED_10, NULL, HFILL }}, { &hf_dcerpc_dg_flags2_rsrvd_20, - { "Reserved", "dcerpc.dg_flags2_rsrvd_20", FT_BOOLEAN, 8, TFS (&tfs_set_notset), PFCL2_RESERVED_20, NULL, HFILL }}, + { "Reserved", "dcerpc.dg_flags2_rsrvd_20", FT_BOOLEAN, 8, TFS(&tfs_set_notset), PFCL2_RESERVED_20, NULL, HFILL }}, { &hf_dcerpc_dg_flags2_rsrvd_40, - { "Reserved", "dcerpc.dg_flags2_rsrvd_40", FT_BOOLEAN, 8, TFS (&tfs_set_notset), PFCL2_RESERVED_40, NULL, HFILL }}, + { "Reserved", "dcerpc.dg_flags2_rsrvd_40", FT_BOOLEAN, 8, TFS(&tfs_set_notset), PFCL2_RESERVED_40, NULL, HFILL }}, { &hf_dcerpc_dg_flags2_rsrvd_80, - { "Reserved", "dcerpc.dg_flags2_rsrvd_80", FT_BOOLEAN, 8, TFS (&tfs_set_notset), PFCL2_RESERVED_80, NULL, HFILL }}, + { "Reserved", "dcerpc.dg_flags2_rsrvd_80", FT_BOOLEAN, 8, TFS(&tfs_set_notset), PFCL2_RESERVED_80, NULL, HFILL }}, { &hf_dcerpc_dg_serial_lo, { "Serial Low", "dcerpc.dg_serial_lo", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_dcerpc_dg_serial_hi, @@ -5674,7 +5687,7 @@ proto_register_dcerpc (void) { &hf_dcerpc_dg_frag_num, { "Fragment num", "dcerpc.dg_frag_num", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_dcerpc_dg_auth_proto, - { "Auth proto", "dcerpc.dg_auth_proto", FT_UINT8, BASE_DEC, VALS (authn_protocol_vals), 0x0, NULL, HFILL }}, + { "Auth proto", "dcerpc.dg_auth_proto", FT_UINT8, BASE_DEC, VALS(authn_protocol_vals), 0x0, NULL, HFILL }}, { &hf_dcerpc_dg_seqnum, { "Sequence num", "dcerpc.dg_seqnum", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_dcerpc_dg_server_boot, @@ -5862,38 +5875,40 @@ proto_register_dcerpc (void) }; module_t *dcerpc_module; - proto_dcerpc = proto_register_protocol ("Distributed Computing Environment / Remote Procedure Call (DCE/RPC)", "DCERPC", "dcerpc"); - proto_register_field_array (proto_dcerpc, hf, array_length (hf)); - proto_register_subtree_array (ett, array_length (ett)); - register_init_routine (dcerpc_init_protocol); - dcerpc_module = prefs_register_protocol (proto_dcerpc, NULL); - prefs_register_bool_preference (dcerpc_module, - "desegment_dcerpc", - "Reassemble DCE/RPC messages spanning multiple TCP segments", - "Whether the DCE/RPC dissector should reassemble messages spanning multiple TCP segments." - " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.", - &dcerpc_cn_desegment); - prefs_register_bool_preference (dcerpc_module, - "reassemble_dcerpc", - "Reassemble DCE/RPC fragments", - "Whether the DCE/RPC dissector should reassemble fragmented DCE/RPC PDUs", - &dcerpc_reassemble); + proto_dcerpc = proto_register_protocol("Distributed Computing Environment / Remote Procedure Call (DCE/RPC)", "DCERPC", "dcerpc"); + proto_register_field_array(proto_dcerpc, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + register_init_routine(dcerpc_init_protocol); + dcerpc_module = prefs_register_protocol(proto_dcerpc, NULL); + prefs_register_bool_preference(dcerpc_module, + "desegment_dcerpc", + "Reassemble DCE/RPC messages spanning multiple TCP segments", + "Whether the DCE/RPC dissector should reassemble messages" + " spanning multiple TCP segments." + " To use this option, you must also enable" + " \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.", + &dcerpc_cn_desegment); + prefs_register_bool_preference(dcerpc_module, + "reassemble_dcerpc", + "Reassemble DCE/RPC fragments", + "Whether the DCE/RPC dissector should reassemble fragmented DCE/RPC PDUs", + &dcerpc_reassemble); register_init_routine(dcerpc_reassemble_init); - dcerpc_uuids = g_hash_table_new (dcerpc_uuid_hash, dcerpc_uuid_equal); - dcerpc_tap=register_tap("dcerpc"); + dcerpc_uuids = g_hash_table_new(dcerpc_uuid_hash, dcerpc_uuid_equal); + dcerpc_tap = register_tap("dcerpc"); g_hook_list_init(&dcerpc_hooks_init_protos, sizeof(GHook)); } void -proto_reg_handoff_dcerpc (void) +proto_reg_handoff_dcerpc(void) { - heur_dissector_add ("tcp", dissect_dcerpc_cn_bs, proto_dcerpc); - heur_dissector_add ("netbios", dissect_dcerpc_cn_pk, proto_dcerpc); - heur_dissector_add ("udp", dissect_dcerpc_dg, proto_dcerpc); - heur_dissector_add ("smb_transact", dissect_dcerpc_cn_smbpipe, proto_dcerpc); - heur_dissector_add ("smb2_heur_subdissectors", dissect_dcerpc_cn_smb2, proto_dcerpc); - heur_dissector_add ("http", dissect_dcerpc_cn_bs, proto_dcerpc); + heur_dissector_add("tcp", dissect_dcerpc_cn_bs, proto_dcerpc); + heur_dissector_add("netbios", dissect_dcerpc_cn_pk, proto_dcerpc); + heur_dissector_add("udp", dissect_dcerpc_dg, proto_dcerpc); + heur_dissector_add("smb_transact", dissect_dcerpc_cn_smbpipe, proto_dcerpc); + heur_dissector_add("smb2_heur_subdissectors", dissect_dcerpc_cn_smb2, proto_dcerpc); + heur_dissector_add("http", dissect_dcerpc_cn_bs, proto_dcerpc); dcerpc_smb_init(proto_dcerpc); guids_add_uuid(&uuid_data_repr_proto, "32bit NDR"); diff --git a/epan/dissectors/packet-gsm_a_bssmap.c b/epan/dissectors/packet-gsm_a_bssmap.c index bbd38794e0..b852f6fc42 100644 --- a/epan/dissectors/packet-gsm_a_bssmap.c +++ b/epan/dissectors/packet-gsm_a_bssmap.c @@ -373,16 +373,16 @@ static const value_string gsm_a_rr_channel_needed_vals[] = { }; static const value_string bssmap_positioning_methods[] = { - { 0, "Timing Advance" }, - { 1, "Reserved (Note)" }, - { 2, "Reserved (Note)" }, - { 3, "Mobile Assisted E-OTD" }, - { 4, "Mobile Based E-OTD" }, - { 5, "Mobile Assisted GPS" }, - { 6, "Mobile Based GPS" }, - { 7, "Conventional GPS" }, - { 8, "U-TDOA" }, - { 9, "Reserved for UTRAN use only" }, + { 0, "Timing Advance" }, + { 1, "Reserved (Note)" }, + { 2, "Reserved (Note)" }, + { 3, "Mobile Assisted E-OTD" }, + { 4, "Mobile Based E-OTD" }, + { 5, "Mobile Assisted GPS" }, + { 6, "Mobile Based GPS" }, + { 7, "Conventional GPS" }, + { 8, "U-TDOA" }, + { 9, "Reserved for UTRAN use only" }, { 10, "Reserved for UTRAN use only" }, { 11, "Reserved for UTRAN use only" }, { 12, "Cell ID" }, @@ -440,18 +440,18 @@ static const value_string chan_mode_vals[] = { }; static const value_string fe_cur_chan_type2_chan_field_vals[] = { - { 1, "SDCCH" }, - { 8, "1 Full rate TCH" }, - { 9, "1 Half rate TCH" }, + { 1, "SDCCH" }, + { 8, "1 Full rate TCH" }, + { 9, "1 Half rate TCH" }, { 10, "2 Full Rate TCHs" }, { 11, "3 Full Rate TCHs" }, { 12, "4 Full Rate TCHs" }, { 13, "5 Full Rate TCHs" }, { 14, "6 Full Rate TCHs" }, { 15, "7 Full Rate TCHs" }, - { 4, "8 Full Rate TCHs" }, - { 0, "reserved" }, - { 0, NULL} + { 4, "8 Full Rate TCHs" }, + { 0, "reserved" }, + { 0, NULL} }; /* Initialize the protocol and registered fields */ @@ -594,120 +594,120 @@ Note this enum must be of the same size as the element decoding list typedef enum { - BE_CIC, /. Circuit Identity Code ./ - BE_RSVD_1, /. Reserved ./ - BE_RES_AVAIL, /. Resource Available ./ - BE_CAUSE, /. Cause ./ - BE_CELL_ID, /. Cell Identifier ./ - BE_PRIO, /. Priority ./ - BE_L3_HEADER_INFO, /. Layer 3 Header Information ./ - BE_IMSI, /. IMSI ./ - BE_TMSI, /. TMSI ./ - BE_ENC_INFO, /. Encryption Information ./ - BE_CHAN_TYPE, /. Channel Type ./ - BE_PERIODICITY, /. Periodicity ./ - BE_EXT_RES_IND, /. Extended Resource Indicator ./ - BE_NUM_MS, /. Number Of MSs ./ - BE_RSVD_2, /. Reserved ./ - BE_RSVD_3, /. Reserved ./ - BE_RSVD_4, /. Reserved ./ - BE_CM_INFO_2, /. Classmark Information Type 2 ./ - BE_CM_INFO_3, /. Classmark Information Type 3 ./ - BE_INT_BAND, /. Interference Band To Be Used ./ - BE_RR_CAUSE, /. RR Cause ./ - BE_RSVD_5, /. Reserved ./ - BE_L3_INFO, /. Layer 3 Information ./ - BE_DLCI, /. DLCI ./ - BE_DOWN_DTX_FLAG, /. Downlink DTX Flag ./ - BE_CELL_ID_LIST, /. Cell Identifier List ./ - BE_RESP_REQ, /. Response Request ./ - BE_RES_IND_METHOD, /. Resource Indication Method ./ - BE_CM_INFO_1, /. Classmark Information Type 1 ./ - BE_CIC_LIST, /. Circuit Identity Code List ./ - BE_DIAG, /. Diagnostic ./ - BE_L3_MSG, /. Layer 3 Message Contents ./ - BE_CHOSEN_CHAN, /. Chosen Channel ./ - BE_TOT_RES_ACC, /. Total Resource Accessible ./ - BE_CIPH_RESP_MODE, /. Cipher Response Mode ./ - BE_CHAN_NEEDED, /. Channel Needed ./ - BE_TRACE_TYPE, /. Trace Type ./ - BE_TRIGGERID, /. TriggerID ./ - BE_TRACE_REF, /. Trace Reference ./ - BE_TRANSID, /. TransactionID ./ - BE_MID, /. Mobile Identity ./ - BE_OMCID, /. OMCID ./ - BE_FOR_IND, /. Forward Indicator ./ - BE_CHOSEN_ENC_ALG, /. Chosen Encryption Algorithm ./ - BE_CCT_POOL, /. Circuit Pool ./ - BE_CCT_POOL_LIST, /. Circuit Pool List ./ - BE_TIME_IND, /. Time Indication ./ - BE_RES_SIT, /. Resource Situation ./ - BE_CURR_CHAN_1, /. Current Channel Type 1 ./ - BE_QUE_IND, /. Queueing Indicator ./ - BE_SPEECH_VER, /. Speech Version ./ - BE_ASS_REQ, /. Assignment Requirement ./ - BE_TALKER_FLAG, /. Talker Flag ./ - BE_CONN_REL_REQ, /. Connection Release Requested ./ - BE_GROUP_CALL_REF, /. Group Call Reference ./ - BE_EMLPP_PRIO, /. eMLPP Priority ./ - BE_CONF_EVO_IND, /. Configuration Evolution Indication ./ - BE_OLD2NEW_INFO, /. Old BSS to New BSS Information ./ - BE_LSA_ID, /. LSA Identifier ./ - BE_LSA_ID_LIST, /. LSA Identifier List ./ - BE_LSA_INFO, /. LSA Information ./ - BE_LCS_QOS, /. LCS QoS ./ - BE_LSA_ACC_CTRL, /. LSA access control suppression ./ - BE_LCS_PRIO, /. LCS Priority ./ - BE_LOC_TYPE, /. Location Type ./ - BE_LOC_EST, /. Location Estimate ./ - BE_POS_DATA, /. Positioning Data ./ - BE_LCS_CAUSE, /. 3.2.2.66 LCS Cause ./ - BE_LCS_CLIENT, /. LCS Client Type ./ - BE_APDU, /. APDU ./ - BE_NE_ID, /. Network Element Identity ./ - BE_GPS_ASSIST_DATA, /. GPS Assistance Data ./ - BE_DECIPH_KEYS, /. Deciphering Keys ./ - BE_RET_ERR_REQ, /. Return Error Request ./ - BE_RET_ERR_CAUSE, /. Return Error Cause ./ - BE_SEG, /. Segmentation ./ - BE_SERV_HO, /. Service Handover ./ - BE_SRC_RNC_TO_TAR_RNC_UMTS, /. Source RNC to target RNC transparent information (UMTS) ./ - BE_SRC_RNC_TO_TAR_RNC_CDMA, /. Source RNC to target RNC transparent information (cdma2000) ./ - BE_GERAN_CLS_M, /. GERAN Classmark ./ - BE_GRAN_BSC_CONT, /. GERAN BSC Container ./ - BE_NEW_BSS_TO_OLD_BSS_INF, /. New BSS to Old BSS Information ./ - BE_INTER_SYS_INF, /. Inter-System Information ./ - BE_SNA_ACC_INF, /. SNA Access Information ./ - BE_VSTK_RAND_INF, /. VSTK_RAND Information ./ - BE_VSTK_INF, /. VSTK Information ./ - BE_PAGING_INF, /. Paging Information ./ - BE_IMEI, /. IMEI ./ - BE_VEL_EST, /. Velocity Estimate ./ - BE_VGCS_FEAT_FLG, /. VGCS Feature Flags ./ - BE_TALKER_PRI, /. Talker Priority ./ - BE_EMRG_SET_IND, /. Emergency Set Indication ./ - BE_TALKER_ID, /. Talker Identity ./ - BE_CELL_ID_LIST_SEG, /. Cell Identifier List Segment ./ - BE_SMS_TO_VGCS, /. SMS to VGCS ./ - BE_VGCS_TALKER_MOD, /. VGCS Talker Mode ./ - BE_VGS_VBS_CELL_STAT, /. VGCS/VBS Cell Status ./ - BE_CELL_ID_LST_SEG_F_EST_CELLS, /. Cell Identifier List Segment for established cells ./ - BE_CELL_ID_LST_SEG_F_CELL_TB_EST, /. Cell Identifier List Segment for cells to be established ./ - BE_CELL_ID_LST_SEG_F_REL_CELL, /. Cell Identifier List Segment for released cells - no user present ./ - BE_CELL_ID_LST_SEG_F_NOT_EST_CELL, /. Cell Identifier List Segment for not established cells - no establishment possible ./ - BE_GANSS_ASS_DTA, /. GANSS Assistance Data ./ - BE_GANSS_POS_DTA, /. GANSS Positioning Data ./ - BE_GANSS_LOC_TYP, /. GANSS Location Type ./ - BE_APP_DATA, /. Application Data ./ - BE_DATA_ID /. Data Identity ./ - BE_APP_DATA_INF, /. Application Data Information ./ - BE_MSISDN, /. MSISDN ./ - BE_AOIP_TRANS_LAY_ADD, /. AoIP Transport Layer Address ./ - BE_SPEECH_CODEC_LST, /. Speech Codec List ./ - BE_SPEECH_CODEC, /. Speech Codec ./ - BE_CALL_ID, /. Call Identifier ./ - BE_CALL_ID_LST, /. Call Identifier List ./ - BE_NONE /. NONE ./ + BE_CIC, /* Circuit Identity Code */ + BE_RSVD_1, /* Reserved */ + BE_RES_AVAIL, /* Resource Available */ + BE_CAUSE, /* Cause */ + BE_CELL_ID, /* Cell Identifier */ + BE_PRIO, /* Priority */ + BE_L3_HEADER_INFO, /* Layer 3 Header Information */ + BE_IMSI, /* IMSI */ + BE_TMSI, /* TMSI */ + BE_ENC_INFO, /* Encryption Information */ + BE_CHAN_TYPE, /* Channel Type */ + BE_PERIODICITY, /* Periodicity */ + BE_EXT_RES_IND, /* Extended Resource Indicator */ + BE_NUM_MS, /* Number Of MSs */ + BE_RSVD_2, /* Reserved */ + BE_RSVD_3, /* Reserved */ + BE_RSVD_4, /* Reserved */ + BE_CM_INFO_2, /* Classmark Information Type 2 */ + BE_CM_INFO_3, /* Classmark Information Type 3 */ + BE_INT_BAND, /* Interference Band To Be Used */ + BE_RR_CAUSE, /* RR Cause */ + BE_RSVD_5, /* Reserved */ + BE_L3_INFO, /* Layer 3 Information */ + BE_DLCI, /* DLCI */ + BE_DOWN_DTX_FLAG, /* Downlink DTX Flag */ + BE_CELL_ID_LIST, /* Cell Identifier List */ + BE_RESP_REQ, /* Response Request */ + BE_RES_IND_METHOD, /* Resource Indication Method */ + BE_CM_INFO_1, /* Classmark Information Type 1 */ + BE_CIC_LIST, /* Circuit Identity Code List */ + BE_DIAG, /* Diagnostic */ + BE_L3_MSG, /* Layer 3 Message Contents */ + BE_CHOSEN_CHAN, /* Chosen Channel */ + BE_TOT_RES_ACC, /* Total Resource Accessible */ + BE_CIPH_RESP_MODE, /* Cipher Response Mode */ + BE_CHAN_NEEDED, /* Channel Needed */ + BE_TRACE_TYPE, /* Trace Type */ + BE_TRIGGERID, /* TriggerID */ + BE_TRACE_REF, /* Trace Reference */ + BE_TRANSID, /* TransactionID */ + BE_MID, /* Mobile Identity */ + BE_OMCID, /* OMCID */ + BE_FOR_IND, /* Forward Indicator */ + BE_CHOSEN_ENC_ALG, /* Chosen Encryption Algorithm */ + BE_CCT_POOL, /* Circuit Pool */ + BE_CCT_POOL_LIST, /* Circuit Pool List */ + BE_TIME_IND, /* Time Indication */ + BE_RES_SIT, /* Resource Situation */ + BE_CURR_CHAN_1, /* Current Channel Type 1 */ + BE_QUE_IND, /* Queueing Indicator */ + BE_SPEECH_VER, /* Speech Version */ + BE_ASS_REQ, /* Assignment Requirement */ + BE_TALKER_FLAG, /* Talker Flag */ + BE_CONN_REL_REQ, /* Connection Release Requested */ + BE_GROUP_CALL_REF, /* Group Call Reference */ + BE_EMLPP_PRIO, /* eMLPP Priority */ + BE_CONF_EVO_IND, /* Configuration Evolution Indication */ + BE_OLD2NEW_INFO, /* Old BSS to New BSS Information */ + BE_LSA_ID, /* LSA Identifier */ + BE_LSA_ID_LIST, /* LSA Identifier List */ + BE_LSA_INFO, /* LSA Information */ + BE_LCS_QOS, /* LCS QoS */ + BE_LSA_ACC_CTRL, /* LSA access control suppression */ + BE_LCS_PRIO, /* LCS Priority */ + BE_LOC_TYPE, /* Location Type */ + BE_LOC_EST, /* Location Estimate */ + BE_POS_DATA, /* Positioning Data */ + BE_LCS_CAUSE, /* 3*2*2*66 LCS Cause */ + BE_LCS_CLIENT, /* LCS Client Type */ + BE_APDU, /* APDU */ + BE_NE_ID, /* Network Element Identity */ + BE_GPS_ASSIST_DATA, /* GPS Assistance Data */ + BE_DECIPH_KEYS, /* Deciphering Keys */ + BE_RET_ERR_REQ, /* Return Error Request */ + BE_RET_ERR_CAUSE, /* Return Error Cause */ + BE_SEG, /* Segmentation */ + BE_SERV_HO, /* Service Handover */ + BE_SRC_RNC_TO_TAR_RNC_UMTS, /* Source RNC to target RNC transparent information (UMTS) */ + BE_SRC_RNC_TO_TAR_RNC_CDMA, /* Source RNC to target RNC transparent information (cdma2000) */ + BE_GERAN_CLS_M, /* GERAN Classmark */ + BE_GRAN_BSC_CONT, /* GERAN BSC Container */ + BE_NEW_BSS_TO_OLD_BSS_INF, /* New BSS to Old BSS Information */ + BE_INTER_SYS_INF, /* Inter-System Information */ + BE_SNA_ACC_INF, /* SNA Access Information */ + BE_VSTK_RAND_INF, /* VSTK_RAND Information */ + BE_VSTK_INF, /* VSTK Information */ + BE_PAGING_INF, /* Paging Information */ + BE_IMEI, /* IMEI */ + BE_VEL_EST, /* Velocity Estimate */ + BE_VGCS_FEAT_FLG, /* VGCS Feature Flags */ + BE_TALKER_PRI, /* Talker Priority */ + BE_EMRG_SET_IND, /* Emergency Set Indication */ + BE_TALKER_ID, /* Talker Identity */ + BE_CELL_ID_LIST_SEG, /* Cell Identifier List Segment */ + BE_SMS_TO_VGCS, /* SMS to VGCS */ + BE_VGCS_TALKER_MOD, /* VGCS Talker Mode */ + BE_VGS_VBS_CELL_STAT, /* VGCS/VBS Cell Status */ + BE_CELL_ID_LST_SEG_F_EST_CELLS, /* Cell Identifier List Segment for established cells */ + BE_CELL_ID_LST_SEG_F_CELL_TB_EST, /* Cell Identifier List Segment for cells to be established */ + BE_CELL_ID_LST_SEG_F_REL_CELL, /* Cell Identifier List Segment for released cells - no user present */ + BE_CELL_ID_LST_SEG_F_NOT_EST_CELL, /* Cell Identifier List Segment for not established cells - no establishment possible */ + BE_GANSS_ASS_DTA, /* GANSS Assistance Data */ + BE_GANSS_POS_DTA, /* GANSS Positioning Data */ + BE_GANSS_LOC_TYP, /* GANSS Location Type */ + BE_APP_DATA, /* Application Data */ + BE_DATA_ID /* Data Identity */ + BE_APP_DATA_INF, /* Application Data Information */ + BE_MSISDN, /* MSISDN */ + BE_AOIP_TRANS_LAY_ADD, /* AoIP Transport Layer Address */ + BE_SPEECH_CODEC_LST, /* Speech Codec List */ + BE_SPEECH_CODEC, /* Speech Codec */ + BE_CALL_ID, /* Call Identifier */ + BE_CALL_ID_LST, /* Call Identifier List */ + BE_NONE /* NONE */ } bssmap_elem_idx_t; #endif @@ -764,11 +764,11 @@ be_res_avail(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 of { guint32 curr_offset; guint16 value; - int i; + int i; curr_offset = offset; - for (i=0; i < 5; i++){ + for (i=0; i < 5; i++) { value = tvb_get_ntohl(tvb, curr_offset); proto_tree_add_text(tree, tvb, curr_offset, len, "Number of full rate channels available in band %u %u",i+1,value); curr_offset+=2; @@ -785,9 +785,9 @@ be_res_avail(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 of static guint16 be_cause(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string, int string_len) { - guint8 oct; - guint32 value; - guint32 curr_offset; + guint8 oct; + guint32 value; + guint32 curr_offset; const gchar *str = NULL; curr_offset = offset; @@ -1127,10 +1127,10 @@ be_enc_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 off guint16 be_chan_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string, int string_len) { - guint8 oct; - guint8 sdi; - guint8 num_chan; - guint32 curr_offset; + guint8 oct; + guint8 sdi; + guint8 num_chan; + guint32 curr_offset; const gchar *str; curr_offset = offset; @@ -1595,7 +1595,7 @@ be_lsa_id_list(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 /* LSA identification 1 - n */ - while (curr_offset-offset < len){ + while (curr_offset-offset < len) { proto_tree_add_item(tree, hf_gsm_a_bssmap_lsa_id, tvb, curr_offset, 3, ENC_BIG_ENDIAN); curr_offset+=3; } @@ -1659,7 +1659,7 @@ be_cell_id_aux(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 if (add_string) g_snprintf(add_string, string_len, " - LAC (0x%04x)", value); /* FALLTHRU */ - if (disc == 0x0b){ + if (disc == 0x0b) { /* If SAI, SAC follows */ proto_tree_add_item(tree, hf_gsm_a_bssmap_sac, tvb, curr_offset, 2, ENC_BIG_ENDIAN); curr_offset += 2; @@ -1668,7 +1668,7 @@ be_cell_id_aux(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 case 0x09: /* For intersystem handover from GSM to UMTS or cdma2000: */ - if ((disc == 0x08) ||(disc == 0x09) || (disc == 0x0a)|| (disc == 0x0c)){ + if ((disc == 0x08) ||(disc == 0x09) || (disc == 0x0a)|| (disc == 0x0c)) { /* RNC-ID * The octets 9-10 are coded as the RNC-ID (0..4095) or the * Extended RNC-ID (4096..65535) specified in 3GPP TS 25.413 [31]: @@ -1771,8 +1771,8 @@ static const true_false_string bssmap_pvi_value = { guint16 be_prio(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string, int string_len) { - guint8 oct; - guint32 curr_offset; + guint8 oct; + guint32 curr_offset; const gchar *str; curr_offset = offset; @@ -1866,7 +1866,7 @@ be_lsa_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 off proto_tree_add_item(tree, hf_gsm_a_bssmap_lsa_only, tvb, curr_offset, 1, ENC_BIG_ENDIAN); curr_offset++; - while (curr_offset-offset < len){ + while (curr_offset-offset < len) { /* LSA identification and attributes */ /* 8 7 6 5 4 3 2 1 * spare act pref priority @@ -1888,8 +1888,8 @@ be_lsa_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 off static guint16 be_l3_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_) { - guint32 curr_offset; - tvbuff_t *l3_tvb; + guint32 curr_offset; + tvbuff_t *l3_tvb; curr_offset = offset; @@ -1944,10 +1944,10 @@ be_l3_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offs static guint16 be_dlci(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) { - guint8 oct; - guint32 curr_offset; - proto_item *item = NULL; - proto_tree *subtree = NULL; + guint8 oct; + guint32 curr_offset; + proto_item *item = NULL; + proto_tree *subtree = NULL; curr_offset = offset; @@ -2004,13 +2004,13 @@ be_down_dtx_flag(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint3 guint16 be_cell_id_list(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len) { - guint8 oct; - guint16 consumed; - guint8 disc; - guint8 num_cells; - guint32 curr_offset; - proto_item *item = NULL; - proto_tree *subtree = NULL; + guint8 oct; + guint16 consumed; + guint8 disc; + guint8 num_cells; + guint32 curr_offset; + proto_item *item = NULL; + proto_tree *subtree = NULL; curr_offset = offset; @@ -2367,7 +2367,7 @@ be_ciph_resp_mode(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint static guint16 be_l3_msg(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_) { - tvbuff_t *l3_tvb; + tvbuff_t *l3_tvb; proto_tree_add_text(tree, tvb, offset, len, "Layer 3 Message Contents"); @@ -2409,7 +2409,7 @@ static guint16 be_trace_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) { guint32 curr_offset; - gint bit_offset; + gint bit_offset; bit_offset = (offset<<3); curr_offset = offset; @@ -2517,8 +2517,8 @@ be_trace_omc_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 static guint16 be_for_ind(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) { - guint8 oct; - guint32 curr_offset; + guint8 oct; + guint32 curr_offset; const gchar *str = NULL; curr_offset = offset; @@ -2556,8 +2556,8 @@ be_for_ind(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offs static guint16 be_chosen_enc_alg(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string, int string_len) { - guint8 oct; - guint32 curr_offset; + guint8 oct; + guint32 curr_offset; const gchar *str = NULL; curr_offset = offset; @@ -2600,8 +2600,8 @@ be_chosen_enc_alg(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint static guint16 be_cct_pool(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string, int string_len) { - guint8 oct; - guint32 curr_offset; + guint8 oct; + guint32 curr_offset; const gchar *str = NULL; curr_offset = offset; @@ -2700,9 +2700,9 @@ be_que_ind(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offs static guint16 be_speech_ver(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string, int string_len) { - guint8 oct; - guint32 curr_offset; - const gchar *str = NULL; + guint8 oct; + guint32 curr_offset; + const gchar *str = NULL; const gchar *short_str = NULL; curr_offset = offset; @@ -2901,7 +2901,7 @@ static guint16 be_loc_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) { guint32 curr_offset; - guint8 location_information; + guint8 location_information; curr_offset = offset; @@ -2910,7 +2910,7 @@ be_loc_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 off proto_tree_add_item(tree, hf_gsm_a_bssmap_location_type_location_information, tvb, offset, 1, ENC_BIG_ENDIAN); curr_offset++; - if(location_information == 1 || location_information == 2) + if (location_information == 1 || location_information == 2) { /* protocol method */ proto_tree_add_item(tree, hf_gsm_a_bssmap_location_type_positioning_method, tvb, curr_offset, 1, ENC_BIG_ENDIAN); @@ -2929,7 +2929,7 @@ static guint16 be_loc_est(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) { tvbuff_t *data_tvb; - guint32 curr_offset; + guint32 curr_offset; curr_offset = offset; @@ -2946,9 +2946,9 @@ static guint16 be_pos_data(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) { guint32 curr_offset; - guint8 i; + guint8 i; guint64 pos_data_disc; - gint bit_offset; + gint bit_offset; curr_offset = offset; @@ -3011,8 +3011,8 @@ static const value_string gsm_a_apdu_protocol_id_strings[] = { static guint16 be_apdu(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_) { - guint32 curr_offset; - guint8 apdu_protocol_id; + guint32 curr_offset; + guint8 apdu_protocol_id; tvbuff_t *APDU_tvb; curr_offset = offset; @@ -3032,13 +3032,13 @@ be_apdu(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, curr_offset++; len--; - switch(apdu_protocol_id){ + switch (apdu_protocol_id) { case 1: /* BSSLAP * the embedded message is as defined in 3GPP TS 08.71(3GPP TS 48.071 version 7.2.0 Release 7) */ APDU_tvb = tvb_new_subset(tvb, curr_offset, len, len); - if(gsm_bsslap_handle) + if (gsm_bsslap_handle) call_dissector(gsm_bsslap_handle, APDU_tvb, g_pinfo, g_tree); break; case 2: @@ -3567,11 +3567,11 @@ static guint16 be_aoip_trans_lay_add(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) { guint32 curr_offset; - guint8 addr_type = 0; - guint32 rtp_ipv4_address; - guint16 rtp_port; - address rtp_dst_addr; - struct e_in6_addr rtp_addr_ipv6; + guint8 addr_type = 0; + guint32 rtp_ipv4_address; + guint16 rtp_port; + address rtp_dst_addr; + struct e_in6_addr rtp_addr_ipv6; curr_offset = offset; @@ -3579,19 +3579,19 @@ be_aoip_trans_lay_add(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, g * for the Transport Layer information of the connection end point. * The Length differentiates between IPv4 and IPv6. */ - switch(len){ + switch (len) { case 6: /* IPv4 */ - addr_type = 1; + addr_type = 1; proto_tree_add_item(tree, hf_gsm_a_bssmap_aoip_trans_ipv4, tvb, curr_offset, 4, ENC_BIG_ENDIAN); - rtp_ipv4_address = tvb_get_ipv4(tvb, curr_offset); + rtp_ipv4_address = tvb_get_ipv4(tvb, curr_offset); curr_offset+=4; break; case 18: /* IPv6 */ - addr_type = 2; + addr_type = 2; proto_tree_add_item(tree, hf_gsm_a_bssmap_aoip_trans_ipv6, tvb, curr_offset, 16, ENC_NA); - tvb_get_ipv6(tvb, offset + 5, &rtp_addr_ipv6); + tvb_get_ipv6(tvb, offset + 5, &rtp_addr_ipv6); curr_offset+=16; break; default: @@ -3600,29 +3600,29 @@ be_aoip_trans_lay_add(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, g return(len); } proto_tree_add_item(tree, hf_gsm_a_bssmap_aoip_trans_port, tvb, curr_offset, 2, ENC_BIG_ENDIAN); - rtp_port = tvb_get_ntohs(tvb,curr_offset); + rtp_port = tvb_get_ntohs(tvb,curr_offset); curr_offset+=2; - - switch(addr_type){ - case 0: - break; - case 1: - /* IPv4 */ - rtp_dst_addr.type=AT_IPv4; - rtp_dst_addr.len=4; - rtp_dst_addr.data=(guint8 *)&rtp_ipv4_address; - break; - case 2: - /* IPv6 */ - rtp_dst_addr.type=AT_IPv6; - rtp_dst_addr.len=16; - rtp_dst_addr.data=(guint8 *)&rtp_addr_ipv6; - break; - } - if((!pinfo->fd->flags.visited) && rtp_port != 0 && rtp_handle && addr_type != 0){ - rtp_add_address(pinfo, &rtp_dst_addr, rtp_port, 0, "BSS MAP", pinfo->fd->num, FALSE, 0); - } + switch (addr_type) { + case 0: + break; + case 1: + /* IPv4 */ + rtp_dst_addr.type = AT_IPv4; + rtp_dst_addr.len = 4; + rtp_dst_addr.data = (guint8 *)&rtp_ipv4_address; + break; + case 2: + /* IPv6 */ + rtp_dst_addr.type = AT_IPv6; + rtp_dst_addr.len = 16; + rtp_dst_addr.data = (guint8 *)&rtp_addr_ipv6; + break; + } + + if ((!pinfo->fd->flags.visited) && rtp_port != 0 && rtp_handle && addr_type != 0) { + rtp_add_address(pinfo, &rtp_dst_addr, rtp_port, 0, "BSS MAP", pinfo->fd->num, FALSE, 0); + } return(curr_offset - offset); } /* @@ -3703,13 +3703,13 @@ be_speech_codec_lst(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gui curr_offset = offset; - while (curr_offset-offset < len){ + while (curr_offset-offset < len) { number++; - consumed=0; + consumed = 0; item = proto_tree_add_text(tree, tvb, curr_offset, 1, "Speech Codec Element %u",number); subtree = proto_item_add_subtree(item, ett_codec_lst); codec = tvb_get_guint8(tvb,curr_offset)&0x0f; - switch(codec){ + switch (codec) { case 0: /* GSM_FR is coded "0000" */ /* fall through */ @@ -3729,7 +3729,10 @@ be_speech_codec_lst(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gui proto_tree_add_item(subtree, hf_gsm_a_bssmap_tf, tvb, curr_offset, 1, ENC_BIG_ENDIAN); /* Codec Type */ proto_tree_add_item(subtree, hf_gsm_a_bssap_speech_codec, tvb, curr_offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(item, " - %s",val_to_str(tvb_get_guint8(tvb, curr_offset) & 0x0f, bssap_speech_codec_values, "Unknown")); + proto_item_append_text(item, " - %s", + val_to_str_const(tvb_get_guint8(tvb, curr_offset) & 0x0f, + bssap_speech_codec_values, + "Unknown")); curr_offset++; consumed++; break; @@ -3752,7 +3755,10 @@ be_speech_codec_lst(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gui proto_tree_add_item(subtree, hf_gsm_a_bssmap_tf, tvb, curr_offset, 1, ENC_BIG_ENDIAN); /* Codec Type */ proto_tree_add_item(subtree, hf_gsm_a_bssap_speech_codec, tvb, curr_offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(item, " - %s",val_to_str(tvb_get_guint8(tvb, curr_offset) & 0x0f, bssap_speech_codec_values, "Unknown")); + proto_item_append_text(item, " - %s", + val_to_str_const(tvb_get_guint8(tvb, curr_offset) & 0x0f, + bssap_speech_codec_values, + "Unknown")); curr_offset++; consumed++; proto_tree_add_text(subtree, tvb, curr_offset, 2, "S0 - S15"); @@ -3778,7 +3784,10 @@ be_speech_codec_lst(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gui proto_tree_add_item(subtree, hf_gsm_a_bssmap_tf, tvb, curr_offset, 1, ENC_BIG_ENDIAN); /* Codec Type */ proto_tree_add_item(subtree, hf_gsm_a_bssap_speech_codec, tvb, curr_offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(item, " - %s",val_to_str(tvb_get_guint8(tvb, curr_offset) & 0x0f, bssap_speech_codec_values, "Unknown")); + proto_item_append_text(item, " - %s", + val_to_str_const(tvb_get_guint8(tvb, curr_offset) & 0x0f, + bssap_speech_codec_values, + "Unknown")); curr_offset++; consumed++; proto_tree_add_text(subtree, tvb, curr_offset, 1, "S0 - S7"); @@ -3797,7 +3806,10 @@ be_speech_codec_lst(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gui consumed++; /* Codec Extension */ proto_tree_add_item(subtree, hf_gsm_a_bssap_extended_codec, tvb, curr_offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(item, " - %s",val_to_str(tvb_get_guint8(tvb, curr_offset), bssap_extended_codec_values, "Unknown")); + proto_item_append_text(item, " - %s", + val_to_str_const(tvb_get_guint8(tvb, curr_offset), + bssap_extended_codec_values, + "Unknown")); curr_offset++; consumed++; proto_tree_add_item(subtree, hf_gsm_a_bssap_extended_codec_r2, tvb, curr_offset, 1, ENC_BIG_ENDIAN); @@ -3845,13 +3857,13 @@ be_speech_codec(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 curr_offset = offset; - while (curr_offset-offset < len){ + while (curr_offset-offset < len) { number++; - consumed=0; + consumed = 0; item = proto_tree_add_text(tree, tvb, curr_offset, 1, "Speech Codec Element %u",number); subtree = proto_item_add_subtree(item, ett_codec_lst); codec = tvb_get_guint8(tvb,curr_offset)&0x0f; - switch(codec){ + switch (codec) { case 3: /* fall through */ case 4: @@ -3960,10 +3972,10 @@ be_call_id_lst(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 guint32 curr_offset; curr_offset = offset; - if (len==0){ + if (len==0) { proto_tree_add_text(tree, tvb, curr_offset, len, "all resources and references associated to all Call Identifiers in use between the BSC and the MSC need to be released"); } - while (curr_offset-offset < len){ + while (curr_offset-offset < len) { proto_tree_add_item(tree, hf_gsm_a_bssmap_call_id, tvb, curr_offset, 4, ENC_LITTLE_ENDIAN); curr_offset+=4; } @@ -6458,15 +6470,15 @@ dissect_bssmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { static gsm_a_tap_rec_t tap_rec[4]; static gsm_a_tap_rec_t *tap_p; - static guint tap_current=0; - guint8 oct; - guint32 offset, saved_offset; - guint32 len; - gint idx; - proto_item *bssmap_item = NULL; - proto_tree *bssmap_tree = NULL; - const gchar *str; - sccp_msg_info_t* sccp_msg_p; + static guint tap_current = 0; + guint8 oct; + guint32 offset, saved_offset; + guint32 len; + gint idx; + proto_item *bssmap_item = NULL; + proto_tree *bssmap_tree = NULL; + const gchar *str; + sccp_msg_info_t* sccp_msg_p; sccp_msg_p = pinfo->sccp_info; @@ -6503,7 +6515,9 @@ dissect_bssmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) str = match_strval_idx_ext((guint32) oct, &gsm_a_bssmap_msg_strings_ext, &idx); if (sccp_msg_p && !sccp_msg_p->data.co.label) { - sccp_msg_p->data.co.label = se_strdup(val_to_str_ext((guint32) oct, &gsm_a_bssmap_msg_strings_ext, "BSSMAP (0x%02x)")); + sccp_msg_p->data.co.label = se_strdup(val_to_str_ext((guint32)oct, + &gsm_a_bssmap_msg_strings_ext, + "BSSMAP (0x%02x)")); } /* @@ -6551,18 +6565,18 @@ dissect_bssmap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* * decode elements */ - if (idx < 0 || bssmap_msg_fcn[idx] == NULL){ + if (idx < 0 || bssmap_msg_fcn[idx] == NULL) { proto_tree_add_text(bssmap_tree, tvb, offset, len - offset, "Message Elements"); }else{ - if (sccp_msg_p && ((sccp_msg_p->data.co.assoc->app_info & 0xCD00) == 0xCD00)){ + if (sccp_msg_p && ((sccp_msg_p->data.co.assoc->app_info & 0xCD00) == 0xCD00)) { cell_discriminator = sccp_msg_p->data.co.assoc->app_info & 0xFF; }else{ cell_discriminator = 0xFF; } (*bssmap_msg_fcn[idx])(tvb, bssmap_tree, pinfo, offset, len - offset); - if (sccp_msg_p){ + if (sccp_msg_p) { sccp_msg_p->data.co.assoc->app_info = cell_discriminator | 0xCDF0; } } @@ -7151,11 +7165,11 @@ proto_reg_handoff_gsm_a_bssmap(void) bssmap_handle = find_dissector("gsm_a_bssmap"); dissector_add_uint("bssap.pdu_type", GSM_A_PDU_TYPE_BSSMAP, bssmap_handle); - dtap_handle = find_dissector("gsm_a_dtap"); + dtap_handle = find_dissector("gsm_a_dtap"); gsm_bsslap_handle = find_dissector("gsm_bsslap"); - bssgp_handle = find_dissector ("bssgp"); - rrc_handle = find_dissector ("rrc"); - rtp_handle = find_dissector("rtp"); + bssgp_handle = find_dissector ("bssgp"); + rrc_handle = find_dissector ("rrc"); + rtp_handle = find_dissector("rtp"); } diff --git a/epan/dissectors/packet-gsm_a_rr.c b/epan/dissectors/packet-gsm_a_rr.c index c582009c29..c9eaf8dffc 100644 --- a/epan/dissectors/packet-gsm_a_rr.c +++ b/epan/dissectors/packet-gsm_a_rr.c @@ -65,8 +65,6 @@ static dissector_handle_t rrc_irat_ho_to_utran_cmd_handle; #define PADDING_BYTE 0x2B -/* PROTOTYPES/FORWARDS */ - const value_string gsm_a_dtap_msg_rr_strings[] = { { 0x3c, "Reserved" }, { 0x3b, "Additional Assignment" }, @@ -882,10 +880,10 @@ gint ett_gsm_rr_rest_octets_elem[NUM_GSM_RR_REST_OCTETS_ELEM]; /* this function is used for dissecting the 0/1 presence flags in CSN.1 coded IEs */ static gboolean gsm_rr_csn_flag(tvbuff_t *tvb, proto_tree *tree, gint bit_offset, const char *description, const char *true_string, const char * false_string) { - guint8 bit_mask = 0x80 >> (bit_offset % 8); - guint8 value = tvb_get_guint8(tvb, bit_offset >> 3); - char bits_str[] = {".... ...."}; + guint8 bit_mask = 0x80 >> (bit_offset % 8); + guint8 value = tvb_get_guint8(tvb, bit_offset >> 3); guint8 offset_in_octet = bit_offset % 8; + char bits_str[] = {".... ...."}; if (value & bit_mask) { @@ -895,7 +893,7 @@ static gboolean gsm_rr_csn_flag(tvbuff_t *tvb, proto_tree *tree, gint bit_offset } bits_str[offset_in_octet + (offset_in_octet / 4)] = '0'; proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s: %s: %s", bits_str, description, false_string); - return FALSE; + return FALSE; } /* this function is used for dissecting the H/L presence flags in CSN.1 coded IEs" @@ -936,7 +934,7 @@ static gboolean gsm_rr_csn_HL_flag(tvbuff_t *tvb, proto_tree *tree, guint trunca } bits_str[offset_in_octet + (offset_in_octet / 4)] = 'L'; proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s: %s: %s", bits_str, description, false_string); - return FALSE; + return FALSE; } /* @@ -1040,8 +1038,8 @@ static gint greatest_power_of_2_lesser_or_equal_to(gint idx) { gint j = 1; do { - j<<=1; - } while (j<=idx); + j <<= 1; + } while (j <= idx); j >>= 1; return j; } @@ -1085,7 +1083,7 @@ static void dissect_channel_list_n_range(tvbuff_t *tvb, proto_tree *tree, packet subtree = proto_item_add_subtree(item, ett_gsm_rr_elem[DE_RR_NEIGH_CELL_DESC]); octet = tvb_get_guint8(tvb, curr_offset); - if (range==1024) { + if (range == 1024) { f0 = (octet>>2)&1; if (f0) list[0] = 1; @@ -1125,21 +1123,21 @@ static void dissect_channel_list_n_range(tvbuff_t *tvb, proto_tree *tree, packet for (i=1; i<=imax; i++) { w[i] = (gint) tvb_get_bits(tvb, bit_offset, wsize, FALSE); proto_tree_add_text(subtree, tvb, bit_offset>>3, ((bit_offset+wsize-1)>>3) - (bit_offset>>3) + 1 , "%s %s(%d): %d", - decode_bits_in_field(bit_offset, wsize, w[i]), - "W", - i, - w[i]); + decode_bits_in_field(bit_offset, wsize, w[i]), + "W", + i, + w[i]); bit_offset += wsize; curr_offset = bit_offset>>3; if ((iused == imax) && (w[i] == 0) ) { iused = i - 1; } - if ((curr_offset-offset)>len) { + if ((curr_offset-offset)>len) { iused = i - 1; break; - } - if (++jwi==nwi) { /* check if the number of wi at this wsize has been extracted */ + } + if (++jwi == nwi) { /* check if the number of wi at this wsize has been extracted */ jwi = 0; /* reset the count of wi at this size */ nwi <<= 1; /* get twice as many of the next size */ wsize--; /* make the next size 1 bit smaller */ @@ -1172,7 +1170,7 @@ dissect_arfcn_list_core(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, gui item = proto_tree_add_text(tree,tvb, curr_offset, len, "List of ARFCNs ="); bit = 4; arfcn = 125; - for (byte = 0;byte <= len-1;byte++) + for (byte = 0; byte <= len-1; byte++) { oct = tvb_get_guint8(tvb, curr_offset); while (bit-- != 0) @@ -1218,7 +1216,7 @@ dissect_arfcn_list_core(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, gui item = proto_tree_add_text(tree,tvb,curr_offset,len,"List of ARFCNs = %d",arfcn); curr_offset = curr_offset + 2; bit = 7; - for (byte = 0;byte <= len-3;byte++) + for (byte = 0; byte <= len-3; byte++) { oct = tvb_get_guint8(tvb, curr_offset); while (bit-- != 0) @@ -1333,7 +1331,7 @@ de_rr_utran_freq_list(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, g * { 1 < TDD_ARFCN > : bit (14) } ** 0 -- TDD frequencies * **; * Spare bits in the end of the field are used to fill the last octet. - */ + */ bit_offset = curr_offset << 3; proto_tree_add_bits_item(tree, hf_gsm_a_rr_utran_freq_list_length, tvb, bit_offset, 8, ENC_BIG_ENDIAN); bit_offset += 8; @@ -1440,7 +1438,7 @@ de_rr_cell_select_indic(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, idx = 0; break; } - if (++jwi==nwi) + if (++jwi == nwi) { jwi = 0; nwi <<= 1; @@ -1508,12 +1506,12 @@ de_rr_cell_select_indic(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, w[i] = tvb_get_bits(tvb, bit_offset, wsize, ENC_BIG_ENDIAN); bit_offset += wsize; idx -= wsize; - if (w[i] == 0) + if (w[i] == 0) { idx = 0; break; } - if (++jwi==nwi) + if (++jwi == nwi) { jwi = 0; nwi <<= 1; @@ -2081,7 +2079,7 @@ de_rr_chnl_needed(tvbuff_t *tvb, proto_tree *subtree, packet_info *pinfo _U_, gu gint bit_offset; curr_offset = offset; - if (RIGHT_NIBBLE==len) + if (RIGHT_NIBBLE == len) bit_offset = 4; else bit_offset = 0; @@ -2124,7 +2122,7 @@ de_rr_cip_mode_set(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guin * Note: The coding of fields SC and algorithm identifier is defined in [44.018] * as part of the Cipher Mode Setting IE. */ - if (RIGHT_NIBBLE==len) + if (RIGHT_NIBBLE == len) bit_offset = 4; else bit_offset = 0; @@ -2155,7 +2153,7 @@ de_rr_cip_mode_resp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gui gint bit_offset; curr_offset = offset; - if (RIGHT_NIBBLE==len) + if (RIGHT_NIBBLE == len) bit_offset = 4; else bit_offset = 0; @@ -4873,7 +4871,7 @@ de_rr_si2quater_meas_info_utran_fdd_desc(tvbuff_t *tvb, proto_tree *tree, gint b idx = 0; break; } - if (++jwi==nwi) + if (++jwi == nwi) { jwi = 0; nwi <<= 1; @@ -4953,7 +4951,7 @@ de_rr_si2quater_meas_info_utran_tdd_desc(tvbuff_t *tvb, proto_tree *tree, gint b idx = 0; break; } - if (++jwi==nwi) + if (++jwi == nwi) { jwi = 0; nwi <<= 1; @@ -5906,7 +5904,7 @@ de_rr_eutran_param_desc(tvbuff_t *tvb, proto_tree *tree, gint bit_offset) proto_tree_add_bits_item(subtree, hf_gsm_a_rr_qsearch_p_eutran, tvb, curr_bit_offset, 4, ENC_BIG_ENDIAN); curr_bit_offset += 4; rep_quant = gsm_rr_csn_flag(tvb, subtree, curr_bit_offset, "E-UTRAN Reporting Quantity", "RSRQ", "RSRP"); - curr_bit_offset++; + curr_bit_offset++; proto_tree_add_bits_item(subtree, hf_gsm_a_rr_eutran_multirat_reporting, tvb, curr_bit_offset, 2, ENC_BIG_ENDIAN); curr_bit_offset += 2; @@ -7448,12 +7446,12 @@ static const value_string gsm_a_rr_si2n_support_vals[] = { static guint16 de_rr_si13_rest_oct(tvbuff_t *tvb, proto_tree *subtree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) { - proto_tree *subtree2; - proto_item *item2; - guint bit_offset, bit_offset_sav; - guint8 tvb_len = tvb_length(tvb); - guint16 bit_len = tvb_len << 3; - bit_offset = offset << 3; + proto_tree *subtree2; + proto_item *item2; + guint bit_offset, bit_offset_sav; + guint8 tvb_len = tvb_length(tvb); + guint16 bit_len = tvb_len << 3; + bit_offset = offset << 3; if (gsm_rr_csn_HL_flag(tvb, subtree, 0, bit_offset++, "SI13 contents", "Present", "Not present")) { @@ -7603,7 +7601,7 @@ static const value_string gsm_a_rr_sync_ind_si_vals[] = { }; /* NCI: Normal cell indication (octet 1, bit 4) */ -static const true_false_string gsm_a_rr_sync_ind_nci_value = { +static const true_false_string gsm_a_rr_sync_ind_nci_value = { "Out of range timing advance shall trigger a handover failure procedure", "Out of range timing advance is ignored" }; @@ -7683,9 +7681,9 @@ de_rr_tlli(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offs static guint16 de_rr_tmsi_ptmsi(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) { - proto_tree *subtree; - proto_item *item; - guint32 curr_offset; + proto_tree *subtree; + proto_item *item; + guint32 curr_offset; curr_offset = offset; @@ -7773,8 +7771,8 @@ static guint16 de_rr_ext_meas_result(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_) { guint32 curr_offset; - gint bit_offset, i; - guint8 value; + gint bit_offset, i; + guint8 value; curr_offset = offset; bit_offset = curr_offset << 3; @@ -7987,7 +7985,7 @@ de_rr_carrier_ind(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint { proto_tree *subtree; proto_item *item; - guint32 curr_offset; + guint32 curr_offset; curr_offset = offset; @@ -8161,7 +8159,7 @@ dtap_rr_add_ass(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 { guint32 curr_offset; guint32 consumed; - guint curr_len; + guint curr_len; curr_offset = offset; curr_len = len; @@ -8278,9 +8276,9 @@ dtap_rr_ass_cmd(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 static void dtap_rr_ass_comp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -8298,9 +8296,9 @@ dtap_rr_ass_comp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint3 static void dtap_rr_ass_fail(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -8318,9 +8316,9 @@ dtap_rr_ass_fail(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint3 static void dtap_rr_ch_mode_mod(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -8347,9 +8345,9 @@ dtap_rr_ch_mode_mod(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gui static void dtap_rr_ch_mode_mod_ack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -8370,9 +8368,9 @@ dtap_rr_ch_mode_mod_ack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, static void dtap_rr_ch_rel(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -8419,8 +8417,8 @@ dtap_rr_ch_rel(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 static void dtap_rr_cip_mode_cmd(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint curr_len; + guint32 curr_offset; + guint curr_len; curr_offset = offset; curr_len = len; @@ -8439,9 +8437,9 @@ dtap_rr_cip_mode_cmd(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gu void dtap_rr_cip_mode_cpte(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -8459,9 +8457,9 @@ dtap_rr_cip_mode_cpte(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, g static void dtap_rr_mm_cm_change(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -8481,9 +8479,9 @@ dtap_rr_mm_cm_change(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gu static void dtap_rr_utran_classmark_change(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -8500,9 +8498,9 @@ dtap_rr_utran_classmark_change(tvbuff_t *tvb, proto_tree *tree, packet_info *pin static void dtap_rr_cm_enq(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -8522,7 +8520,7 @@ dtap_rr_conf_change_cmd(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, { guint32 curr_offset; guint32 consumed; - guint curr_len; + guint curr_len; curr_offset = offset; curr_len = len; @@ -8570,7 +8568,7 @@ dtap_rr_conf_change_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, { guint32 curr_offset; guint32 consumed; - guint curr_len; + guint curr_len; curr_offset = offset; curr_len = len; @@ -8590,7 +8588,7 @@ dtap_rr_freq_redef(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guin { guint32 curr_offset; guint32 consumed; - guint curr_len; + guint curr_len; curr_offset = offset; curr_len = len; @@ -8625,9 +8623,9 @@ dtap_rr_freq_redef(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guin static void dtap_rr_gprs_sus_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -8658,9 +8656,9 @@ dtap_rr_gprs_sus_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gu void dtap_rr_ho_cmd(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -8789,9 +8787,9 @@ dtap_rr_ho_cmd(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 static void dtap_rr_inter_syst_to_utran_ho_cmd(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -8808,9 +8806,9 @@ dtap_rr_inter_syst_to_utran_ho_cmd(tvbuff_t *tvb, proto_tree *tree, packet_info static void dtap_rr_ho_cpte(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -8831,9 +8829,9 @@ dtap_rr_ho_cpte(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 static void dtap_rr_ho_fail(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -8851,10 +8849,10 @@ dtap_rr_ho_fail(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 static void dtap_rr_imm_ass(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; - guint8 oct; + guint32 curr_offset; + guint32 consumed; + guint curr_len; + guint8 oct; curr_offset = offset; curr_len = len; @@ -8911,9 +8909,9 @@ dtap_rr_imm_ass(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 static void dtap_rr_imm_ass_ext(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -8950,9 +8948,9 @@ dtap_rr_imm_ass_ext(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gui static void dtap_rr_imm_ass_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -8989,9 +8987,9 @@ dtap_rr_imm_ass_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gui static void dtap_rr_meas_rep(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -9006,9 +9004,9 @@ dtap_rr_meas_rep(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint3 static void dtap_rr_paging_req_type_1(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -9035,9 +9033,9 @@ dtap_rr_paging_req_type_1(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U static void dtap_rr_paging_req_type_2(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -9067,9 +9065,9 @@ dtap_rr_paging_req_type_2(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U static void dtap_rr_paging_req_type_3(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -9102,12 +9100,12 @@ dtap_rr_paging_req_type_3(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U static void dtap_rr_paging_resp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; - guint8 oct; - proto_tree *subtree; - proto_item *item; + guint32 curr_offset; + guint32 consumed; + guint curr_len; + guint8 oct; + proto_tree *subtree; + proto_item *item; curr_offset = offset; curr_len = len; @@ -9176,7 +9174,7 @@ dtap_rr_partial_rel(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gui { guint32 curr_offset; guint32 consumed; - guint curr_len; + guint curr_len; curr_offset = offset; curr_len = len; @@ -9198,9 +9196,9 @@ dtap_rr_partial_rel(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gui static void dtap_rr_phy_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -9216,9 +9214,9 @@ dtap_rr_phy_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint3 static void dtap_rr_rr_status(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -9234,9 +9232,9 @@ dtap_rr_rr_status(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint static void dtap_rr_sys_info_1(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -9254,9 +9252,9 @@ dtap_rr_sys_info_1(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guin static void dtap_rr_sys_info_2(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -9274,9 +9272,9 @@ dtap_rr_sys_info_2(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guin static void dtap_rr_sys_info_2bis(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -9292,9 +9290,9 @@ dtap_rr_sys_info_2bis(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, g static void dtap_rr_sys_info_2ter(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -9310,9 +9308,9 @@ dtap_rr_sys_info_2ter(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, g static void dtap_rr_sys_info_2quater(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -9326,9 +9324,9 @@ dtap_rr_sys_info_2quater(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_ static void dtap_rr_sys_info_3(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -9354,9 +9352,9 @@ dtap_rr_sys_info_3(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guin static void dtap_rr_sys_info_4(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -9380,9 +9378,9 @@ dtap_rr_sys_info_4(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guin static void dtap_rr_sys_info_5(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -9412,9 +9410,9 @@ dtap_rr_sys_info_5bis(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, g static void dtap_rr_sys_info_5ter(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -9428,9 +9426,9 @@ dtap_rr_sys_info_5ter(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, g static void dtap_rr_sys_info_6(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -9452,9 +9450,9 @@ dtap_rr_sys_info_6(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guin static void dtap_rr_sys_info_13(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -9468,9 +9466,9 @@ dtap_rr_sys_info_13(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gui static void dtap_rr_ext_meas_order(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -9487,7 +9485,7 @@ dtap_rr_ext_meas_report(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, { guint32 curr_offset; guint32 consumed; - guint curr_len; + guint curr_len; curr_offset = offset; curr_len = len; @@ -9502,9 +9500,9 @@ dtap_rr_ext_meas_report(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, static void dtap_rr_app_inf(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + guint32 curr_offset; + guint32 consumed; + guint curr_len; curr_offset = offset; curr_len = len; @@ -9535,11 +9533,11 @@ sacch_rr_meas_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guin { proto_tree *subtree = NULL, *subtree2 = NULL; proto_item *item, *item2; - guint32 curr_offset; - gint bit_offset, bit_offset_sav, bit_offset_sav2; - guint8 value, idx; - guint8 tvb_len = tvb_length(tvb); - guint16 bit_len = tvb_len << 3; + guint32 curr_offset; + gint bit_offset, bit_offset_sav, bit_offset_sav2; + guint8 value, idx; + guint8 tvb_len = tvb_length(tvb); + guint16 bit_len = tvb_len << 3; curr_offset = offset; bit_offset = curr_offset << 3; @@ -9794,8 +9792,8 @@ sacch_rr_eutran_meas_report(tvbuff_t *tvb, proto_tree *tree, guint32 bit_offset, { proto_tree *subtree; proto_item *item; - gint curr_bit_offset; - gint8 n_eutran; + gint curr_bit_offset; + gint8 n_eutran; curr_bit_offset = bit_offset; @@ -9887,11 +9885,11 @@ sacch_rr_enh_meas_report(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_ { proto_tree *subtree; proto_item *item; - guint32 curr_offset; - guint bit_offset, bit_offset_sav; - guint8 tvb_len = tvb_length(tvb); - guint16 bit_len = tvb_len << 3; - guint8 idx; + guint32 curr_offset; + guint bit_offset, bit_offset_sav; + guint8 tvb_len = tvb_length(tvb); + guint16 bit_len = tvb_len << 3; + guint8 idx; curr_offset = offset; bit_offset = curr_offset << 3; @@ -10094,7 +10092,7 @@ static void (*dtap_msg_rr_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *p void get_rr_msg_params(guint8 oct, const gchar **msg_str, int *ett_tree, int *hf_idx, msg_fcn *msg_fcn_p) { - gint idx; + gint idx; *msg_str = match_strval_idx((guint32) (oct & DTAP_RR_IEI_MASK), gsm_a_dtap_msg_rr_strings, &idx); *hf_idx = hf_gsm_a_dtap_msg_rr_type; @@ -10114,25 +10112,25 @@ static void dissect_ccch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - static gsm_a_tap_rec_t tap_rec[4]; - static gsm_a_tap_rec_t *tap_p; - static guint tap_current=0; + static gsm_a_tap_rec_t tap_rec[4]; + static gsm_a_tap_rec_t *tap_p; + static guint tap_current = 0; - void (*msg_fcn_p)(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len); - guint8 oct; - guint8 pd; - guint32 offset; - guint32 len; - guint32 oct_1, oct_2; - proto_item *ccch_item = NULL; - proto_tree *ccch_tree = NULL; - proto_item *oct_1_item = NULL; - proto_tree *pd_tree = NULL; - const gchar *msg_str; - gint ett_tree; - gint ti; - int hf_idx; - gboolean nsd; + void (*msg_fcn_p)(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len); + guint8 oct; + guint8 pd; + guint32 offset; + guint32 len; + guint32 oct_1, oct_2; + proto_item *ccch_item = NULL; + proto_tree *ccch_tree = NULL; + proto_item *oct_1_item = NULL; + proto_tree *pd_tree = NULL; + const gchar *msg_str; + gint ett_tree; + gint ti; + int hf_idx; + gboolean nsd; len = tvb_length(tvb); @@ -10331,7 +10329,7 @@ static void (*sacch_msg_rr_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info * static void get_rr_short_pd_msg_params(guint8 mess_type, const gchar **msg_str, int *ett_tree, int *hf_idx, msg_fcn *msg_fcn_p) { - gint idx; + gint idx; *msg_str = match_strval_idx((guint32) mess_type, gsm_a_rr_short_pd_msg_strings, &idx); *hf_idx = hf_gsm_a_rr_short_pd_msg_type; @@ -10349,19 +10347,19 @@ const value_string short_protocol_discriminator_vals[] = { static void dissect_sacch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - static gsm_a_tap_rec_t tap_rec[4]; - static gsm_a_tap_rec_t *tap_p; - static guint tap_current=0; + static gsm_a_tap_rec_t tap_rec[4]; + static gsm_a_tap_rec_t *tap_p; + static guint tap_current = 0; - void (*msg_fcn_p)(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len); - guint8 oct, short_pd, mess_type; - guint32 offset, bit_offset = 0; - guint32 len; - proto_item *sacch_item = NULL; - proto_tree *sacch_tree = NULL; - const gchar *msg_str; - gint ett_tree; - int hf_idx; + void (*msg_fcn_p)(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len); + guint8 oct, short_pd, mess_type; + guint32 offset, bit_offset = 0; + guint32 len; + proto_item *sacch_item = NULL; + proto_tree *sacch_tree = NULL; + const gchar *msg_str; + gint ett_tree; + int hf_idx; len = tvb_length(tvb); @@ -10455,8 +10453,8 @@ dissect_sacch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) void proto_register_gsm_a_rr(void) { - guint i; - guint last_offset; + guint i; + guint last_offset; /* Setup list of header fields */ @@ -10554,8 +10552,8 @@ proto_register_gsm_a_rr(void) }, { &hf_gsm_a_rr_rxlev_sub_serv_cell, { "RXLEV-SUB-SERVING-CELL","gsm_a.rr.rxlev_sub_serv_cell", - FT_UINT8,BASE_DEC|BASE_EXT_STRING, &gsm_a_rr_rxlev_vals_ext, 0x00, - NULL, HFILL } + FT_UINT8,BASE_DEC|BASE_EXT_STRING, &gsm_a_rr_rxlev_vals_ext, 0x00, + NULL, HFILL } }, { &hf_gsm_a_rr_rxqual_full_serv_cell, { "RXQUAL-FULL-SERVING-CELL","gsm_a.rr.rxqual_full_serv_cell", @@ -11430,8 +11428,8 @@ proto_register_gsm_a_rr(void) }, { &hf_gsm_a_rr_gprs_ra_colour, { "GPRS RA Colour", "gsm_a.rr.gprs_ra_colour", - FT_UINT8, BASE_DEC, NULL, 0x0, - NULL, HFILL } + FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL } }, { &hf_gsm_a_rr_si13_position, { "SI13 Position", "gsm_a.rr.si13_position", @@ -12180,7 +12178,7 @@ proto_register_gsm_a_rr(void) }, { &hf_gsm_a_rr_link_quality_meas_mode, { "Link_Quality_Measure_Mode", "gsm_a.rr.link_qual_meas_mode", - FT_UINT8, BASE_DEC, VALS(&gsm_a_link_quality_meas_mode_vals), 0x00, + FT_UINT8, BASE_DEC, VALS(gsm_a_link_quality_meas_mode_vals), 0x00, NULL, HFILL } }, { &hf_gsm_a_rr_emr_bitmap_length, @@ -12218,22 +12216,22 @@ proto_register_gsm_a_rr(void) FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL } }, - }; + }; static hf_register_info hf_rr_short_pd[] = { { &hf_gsm_a_rr_short_pd, - { "Radio Resources Short Protocol Discriminator", "gsm_a.rr_short_pd", + { "Radio Resources Short Protocol Discriminator", "gsm_a.rr_short_pd", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_gsm_a_rr_short_pd_msg_type, - { "Radio Resources Short PD Message Type", "gsm_a.rr_short_pd_type", + { "Radio Resources Short PD Message Type", "gsm_a.rr_short_pd_type", FT_UINT8, BASE_HEX, VALS(gsm_a_rr_short_pd_msg_strings), 0x0, NULL, HFILL } }, { &hf_gsm_a_rr_short_l2_header, - { "Radio Resources Short L2 Header", "gsm_a.rr_short_l2_header", + { "Radio Resources Short L2 Header", "gsm_a.rr_short_l2_header", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } } diff --git a/epan/dissectors/packet-gtp.c b/epan/dissectors/packet-gtp.c index d02fa59af8..44d45ee2ad 100644 --- a/epan/dissectors/packet-gtp.c +++ b/epan/dissectors/packet-gtp.c @@ -1060,8 +1060,8 @@ static const value_string cause_type[] = { { 3, "No identity needed"}, { 4, "MS refuses"}, { 5, "MS is not GPRS responding"}, - { 6, "Reactivation Requested"}, - { 7, "PDP address inactivity timer expires"}, + { 6, "Reactivation Requested"}, + { 7, "PDP address inactivity timer expires"}, /* For future use 8-48 */ /* Cause values reserved for GPRS charging * protocol use (see GTP' in 3GPP TS 32.295 [33]) @@ -1477,81 +1477,81 @@ static const value_string ms_not_reachable_type[] = { */ static const value_string ranap_cause_type[] = { /* Radio Network Layer Cause (1-->64) */ - {1, "RAB preempted"}, - {2, "Trelocoverall Expiry"}, - {3, "Trelocprep Expiry"}, - {4, "Treloccomplete Expiry"}, - {5, "Tqueuing Expiry"}, - {6, "Relocation Triggered"}, - {7, "TRELOCalloc Expiry"}, - {8, "Unable to Establish During Relocation"}, - {9, "Unknown Target RNC"}, - {10, "Relocation Cancelled"}, - {11, "Successful Relocation"}, - {12, "Requested Ciphering and/or Integrity Protection Algorithms not Supported"}, - {13, "Change of Ciphering and/or Integrity Protection is not supported"}, - {14, "Failure in the Radio Interface Procedure"}, - {15, "Release due to UTRAN Generated Reason"}, - {16, "User Inactivity"}, - {17, "Time Critical Relocation"}, - {18, "Requested Traffic Class not Available"}, - {19, "Invalid RAB Parameters Value"}, - {20, "Requested Maximum Bit Rate not Available"}, - {21, "Requested Guaranteed Bit Rate not Available"}, - {22, "Requested Transfer Delay not Achievable"}, - {23, "Invalid RAB Parameters Combination"}, - {24, "Condition Violation for SDU Parameters"}, - {25, "Condition Violation for Traffic Handling Priority"}, - {26, "Condition Violation for Guaranteed Bit Rate"}, - {27, "User Plane Versions not Supported"}, - {28, "Iu UP Failure"}, - {29, "Relocation Failure in Target CN/RNC or Target System"}, - {30, "Invalid RAB ID"}, - {31, "No Remaining RAB"}, - {32, "Interaction with other procedure"}, - {33, "Requested Maximum Bit Rate for DL not Available"}, - {34, "Requested Maximum Bit Rate for UL not Available"}, - {35, "Requested Guaranteed Bit Rate for DL not Available"}, - {36, "Requested Guaranteed Bit Rate for UL not Available"}, - {37, "Repeated Integrity Checking Failure"}, - {38, "Requested Report Type not supported"}, - {39, "Request superseded"}, - {40, "Release due to UE generated signalling connection release"}, - {41, "Resource Optimisation Relocation"}, - {42, "Requested Information Not Available"}, - {43, "Relocation desirable for radio reasons"}, - {44, "Relocation not supported in Target RNC or Target System"}, - {45, "Directed Retry"}, - {46, "Radio Connection With UE Lost"}, - {47, "rNC-unable-to-establish-all-RFCs"}, - {48, "deciphering-keys-not-available"}, - {49, "dedicated-assistance-data-not-available"}, - {50, "relocation-target-not-allowed"}, - {51, "location-reporting-congestion"}, - {52, "reduce-load-in-serving-cell"}, - {53, "no-radio-resources-available-in-target-cell"}, - {54, "gERAN-Iumode-failure"}, - {55, "access-restricted-due-to-shared-networks"}, - {56, "incoming-relocation-not-supported-due-to-PUESBINE-feature"}, - {57, "traffic-load-in-the-target-cell-higher-than-in-the-source-cell"}, - {58, "mBMS-no-multicast-service-for-this-UE"}, - {59, "mBMS-unknown-UE-ID"}, - {60, "successful-MBMS-session-start-no-data-bearer-necessary"}, - {61, "mBMS-superseded-due-to-NNSF"}, - {62, "mBMS-UE-linking-already-done"}, - {63, "mBMS-UE-de-linking-failure-no-existing-UE-linking"}, - {64, "tMGI-unknown"}, + { 1, "RAB preempted"}, + { 2, "Trelocoverall Expiry"}, + { 3, "Trelocprep Expiry"}, + { 4, "Treloccomplete Expiry"}, + { 5, "Tqueuing Expiry"}, + { 6, "Relocation Triggered"}, + { 7, "TRELOCalloc Expiry"}, + { 8, "Unable to Establish During Relocation"}, + { 9, "Unknown Target RNC"}, + { 10, "Relocation Cancelled"}, + { 11, "Successful Relocation"}, + { 12, "Requested Ciphering and/or Integrity Protection Algorithms not Supported"}, + { 13, "Change of Ciphering and/or Integrity Protection is not supported"}, + { 14, "Failure in the Radio Interface Procedure"}, + { 15, "Release due to UTRAN Generated Reason"}, + { 16, "User Inactivity"}, + { 17, "Time Critical Relocation"}, + { 18, "Requested Traffic Class not Available"}, + { 19, "Invalid RAB Parameters Value"}, + { 20, "Requested Maximum Bit Rate not Available"}, + { 21, "Requested Guaranteed Bit Rate not Available"}, + { 22, "Requested Transfer Delay not Achievable"}, + { 23, "Invalid RAB Parameters Combination"}, + { 24, "Condition Violation for SDU Parameters"}, + { 25, "Condition Violation for Traffic Handling Priority"}, + { 26, "Condition Violation for Guaranteed Bit Rate"}, + { 27, "User Plane Versions not Supported"}, + { 28, "Iu UP Failure"}, + { 29, "Relocation Failure in Target CN/RNC or Target System"}, + { 30, "Invalid RAB ID"}, + { 31, "No Remaining RAB"}, + { 32, "Interaction with other procedure"}, + { 33, "Requested Maximum Bit Rate for DL not Available"}, + { 34, "Requested Maximum Bit Rate for UL not Available"}, + { 35, "Requested Guaranteed Bit Rate for DL not Available"}, + { 36, "Requested Guaranteed Bit Rate for UL not Available"}, + { 37, "Repeated Integrity Checking Failure"}, + { 38, "Requested Report Type not supported"}, + { 39, "Request superseded"}, + { 40, "Release due to UE generated signalling connection release"}, + { 41, "Resource Optimisation Relocation"}, + { 42, "Requested Information Not Available"}, + { 43, "Relocation desirable for radio reasons"}, + { 44, "Relocation not supported in Target RNC or Target System"}, + { 45, "Directed Retry"}, + { 46, "Radio Connection With UE Lost"}, + { 47, "rNC-unable-to-establish-all-RFCs"}, + { 48, "deciphering-keys-not-available"}, + { 49, "dedicated-assistance-data-not-available"}, + { 50, "relocation-target-not-allowed"}, + { 51, "location-reporting-congestion"}, + { 52, "reduce-load-in-serving-cell"}, + { 53, "no-radio-resources-available-in-target-cell"}, + { 54, "gERAN-Iumode-failure"}, + { 55, "access-restricted-due-to-shared-networks"}, + { 56, "incoming-relocation-not-supported-due-to-PUESBINE-feature"}, + { 57, "traffic-load-in-the-target-cell-higher-than-in-the-source-cell"}, + { 58, "mBMS-no-multicast-service-for-this-UE"}, + { 59, "mBMS-unknown-UE-ID"}, + { 60, "successful-MBMS-session-start-no-data-bearer-necessary"}, + { 61, "mBMS-superseded-due-to-NNSF"}, + { 62, "mBMS-UE-linking-already-done"}, + { 63, "mBMS-UE-de-linking-failure-no-existing-UE-linking"}, + { 64, "tMGI-unknown"}, /* Transport Layer Cause (65-->80) */ - {65, "Signalling Transport Resource Failure"}, - {66, "Iu Transport Connection Failed to Establish"}, + { 65, "Signalling Transport Resource Failure"}, + { 66, "Iu Transport Connection Failed to Establish"}, /* NAS Cause (81-->96) */ - {81, "User Restriction Start Indication"}, - {82, "User Restriction End Indication"}, - {83, "Normal Release"}, + { 81, "User Restriction Start Indication"}, + { 82, "User Restriction End Indication"}, + { 83, "Normal Release"}, /* Protocol Cause (97-->112) */ - {97, "Transfer Syntax Error"}, - {98, "Semantic Error"}, - {99, "Message not compatible with receiver state"}, + { 97, "Transfer Syntax Error"}, + { 98, "Semantic Error"}, + { 99, "Message not compatible with receiver state"}, {100, "Abstract Syntax Error (Reject)"}, {101, "Abstract Syntax Error (Ignore and Notify)"}, {102, "Abstract Syntax Error (Falsely Constructed Message"}, @@ -1594,13 +1594,13 @@ static const value_string gtp_cipher_algorithm[] = { {0, NULL} }; static const value_string gtp_ext_rat_type_vals[] = { - {0, "Reserved"}, - {1, "UTRAN"}, - {2, "GERAN"}, - {3, "WLAN"}, - {4, "GAN"}, - {5, "HSPA Evolution"}, - {0, NULL} + {0, "Reserved"}, + {1, "UTRAN"}, + {2, "GERAN"}, + {3, "WLAN"}, + {4, "GAN"}, + {5, "HSPA Evolution"}, + {0, NULL} }; #define MM_PROTO_GROUP_CALL_CONTROL 0x00 @@ -1779,7 +1779,7 @@ static const gtp_opt_t gtpopt[] = { /* 0x07 */ /* 0x08 */ {GTP_EXT_REORDER, decode_gtp_reorder}, /* 0x09 */ {GTP_EXT_AUTH_TRI, decode_gtp_auth_tri}, -/* 0x0a */ +/* 0x0a */ /* 0x0b */ {GTP_EXT_MAP_CAUSE, decode_gtp_map_cause}, /* 0x0c */ {GTP_EXT_PTMSI_SIG, decode_gtp_ptmsi_sig}, /* 0x0d */ {GTP_EXT_MS_VALID, decode_gtp_ms_valid}, @@ -1900,7 +1900,7 @@ static const gtp_opt_t gtpopt[] = { {0, decode_gtp_unknown} }; -#define NUM_GTP_IES 255 +#define NUM_GTP_IES 255 static gint ett_gtp_ies[NUM_GTP_IES]; struct _gtp_hdr { @@ -2944,13 +2944,13 @@ static _gtp_mess_items umts_mess_items[] = { } }; -/* Data structure attached to a conversation, +/* Data structure attached to a conversation, to keep track of request/response-pairs */ typedef struct gtp_conv_info_t { struct gtp_conv_info_t *next; - GHashTable *unmatched; - GHashTable *matched; + GHashTable *unmatched; + GHashTable *matched; } gtp_conv_info_t; static gtp_conv_info_t *gtp_info_items = NULL; @@ -2969,11 +2969,11 @@ gtp_sn_equal_matched(gconstpointer k1, gconstpointer k2) const gtp_msg_hash_t *key1 = (const gtp_msg_hash_t *)k1; const gtp_msg_hash_t *key2 = (const gtp_msg_hash_t *)k2; - if ( key1->req_frame && key2->req_frame && (key1->req_frame!=key2->req_frame) ) { + if ( key1->req_frame && key2->req_frame && (key1->req_frame != key2->req_frame) ) { return 0; } - if ( key1->rep_frame && key2->rep_frame && (key1->rep_frame!=key2->rep_frame) ) { + if ( key1->rep_frame && key2->rep_frame && (key1->rep_frame != key2->rep_frame) ) { return 0; } @@ -2992,8 +2992,8 @@ gtp_sn_equal_unmatched(gconstpointer k1, gconstpointer k2) static gtp_msg_hash_t * gtp_match_response(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gint seq_nr, guint msgtype) { - gtp_msg_hash_t gcr, *gcrp = NULL; - gtp_conv_info_t *gtp_info = (gtp_conv_info_t *)pinfo->private_data; + gtp_msg_hash_t gcr, *gcrp = NULL; + gtp_conv_info_t *gtp_info = (gtp_conv_info_t *)pinfo->private_data; gcr.seq_nr=seq_nr; @@ -3230,7 +3230,7 @@ static int decode_qos_gprs(tvbuff_t * tvb, int offset, proto_tree * tree, const gchar * qos_str, guint8 adjust) { - guint8 spare1, delay, reliability, peak, spare2, precedence, spare3, mean; + guint8 spare1, delay, reliability, peak, spare2, precedence, spare3, mean; proto_tree *ext_tree_qos; proto_item *te; @@ -3459,8 +3459,8 @@ static int decode_gtp_18(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 flow_ii; - guint32 teid_ii; + guint16 flow_ii; + guint32 teid_ii; proto_tree *ext_tree_flow_ii; proto_item *te; @@ -3469,7 +3469,7 @@ decode_gtp_18(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * te = proto_tree_add_text(tree, tvb, offset, 4, "%s", val_to_str_ext_const(GTP_EXT_FLOW_II, >p_val_ext, "Unknown message")); ext_tree_flow_ii = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_FLOW_II]); - proto_tree_add_item(ext_tree_flow_ii, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree_flow_ii, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN); flow_ii = tvb_get_ntohs(tvb, offset + 2); proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_flow_ii, tvb, offset + 2, 2, flow_ii); @@ -3525,7 +3525,7 @@ decode_gtp_19(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * static int decode_gtp_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint8 nsapi; + guint8 nsapi; proto_tree *ext_tree; proto_item *te; @@ -3533,8 +3533,8 @@ decode_gtp_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_NSAPI]); nsapi = tvb_get_guint8(tvb, offset + 1) & 0x0F; - proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN); - proto_item_append_text(te, ": %u",nsapi); + proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN); + proto_item_append_text(te, ": %u",nsapi); return 2; } @@ -3550,37 +3550,37 @@ decode_gtp_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, prot ranap = tvb_get_guint8(tvb, offset + 1); - if (ranap > 0 && ranap <= 64) + if ((ranap > 0) && (ranap <= 64)) proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap, "%s (Radio Network Layer Cause) : %s (%u)", val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, >p_val_ext, "Unknown"), val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap); - if (ranap > 64 && ranap <= 80) + if ((ranap > 64) && (ranap <= 80)) proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap, "%s (Transport Layer Cause) : %s (%u)", val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, >p_val_ext, "Unknown"), val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap); - if (ranap > 80 && ranap <= 96) + if ((ranap > 80) && (ranap <= 96)) proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap, "%s (NAS Cause) : %s (%u)", val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, >p_val_ext, "Unknown"), val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap); - if (ranap > 96 && ranap <= 112) + if ((ranap > 96) && (ranap <= 112)) proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap, "%s (Protocol Cause) : %s (%u)", val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, >p_val_ext, "Unknown"), val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap); - if (ranap > 112 && ranap <= 128) + if ((ranap > 112) && (ranap <= 128)) proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap, "%s (Miscellaneous Cause) : %s (%u)", val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, >p_val_ext, "Unknown"), val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap); - if (ranap > 128 /* && ranap <=255 */ ) + if ((ranap > 128) /* && (ranap <= 255) */ ) proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap, "%s (Non-standard Cause) : %s (%u)", val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, >p_val_ext, "Unknown"), @@ -3635,7 +3635,7 @@ decode_gtp_rp(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * proto_tree *ext_tree_rp; proto_item *te; - guint8 nsapi, rp, spare; + guint8 nsapi, rp, spare; nsapi = tvb_get_guint8(tvb, offset + 1) & 0xF0; spare = tvb_get_guint8(tvb, offset + 1) & 0x08; @@ -3660,9 +3660,9 @@ decode_gtp_pkt_flow_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, prot proto_tree *ext_tree_pkt_flow_id; proto_item *te; - guint8 nsapi, pkt_flow_id; + guint8 nsapi, pkt_flow_id; - nsapi = tvb_get_guint8(tvb, offset + 1) & 0x0F; + nsapi = tvb_get_guint8(tvb, offset + 1) & 0x0F; pkt_flow_id = tvb_get_guint8(tvb, offset + 2); te = proto_tree_add_uint_format(tree, hf_gtp_pkt_flow_id, tvb, offset, 3, pkt_flow_id, "Packet Flow ID for NSAPI(%u) : %u", nsapi, pkt_flow_id); @@ -3683,7 +3683,7 @@ static int decode_gtp_chrg_char(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 chrg_char; + guint16 chrg_char; proto_item *te; proto_tree *ext_tree_chrg_char; @@ -3760,7 +3760,7 @@ static int decode_gtp_ra_prio_lcs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -3816,12 +3816,12 @@ static int decode_gtp_user_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; - guint8 pdp_typ, pdp_org; - guint32 addr_ipv4; - struct e_in6_addr addr_ipv6; - proto_tree *ext_tree_user; - proto_item *te; + guint16 length; + guint8 pdp_typ, pdp_org; + guint32 addr_ipv4; + struct e_in6_addr addr_ipv6; + proto_tree *ext_tree_user; + proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); @@ -3839,7 +3839,7 @@ decode_gtp_user_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_ proto_tree_add_uint(ext_tree_user, hf_gtp_user_addr_pdp_type, tvb, offset + 4, 1, pdp_typ); if (length == 2) { - if (pdp_org == 0 && pdp_typ == 1) + if ((pdp_org == 0) && (pdp_typ == 1)) proto_item_append_text(te, " (Point to Point Protocol)"); else if (pdp_typ == 2) proto_item_append_text(te, " (Octet Stream Protocol)"); @@ -3868,7 +3868,7 @@ decode_triplet(tvbuff_t * tvb, int offset, proto_tree * tree, guint16 count) proto_tree *ext_tree_trip; proto_item *te_trip; - guint16 i; + guint16 i; for (i = 0; i < count; i++) { te_trip = proto_tree_add_text(tree, tvb, offset + i * 28, 28, "Triplet no%x", i); @@ -3890,8 +3890,8 @@ decode_quintuplet(tvbuff_t * tvb, int offset, proto_tree * tree, guint16 count) proto_tree *ext_tree_quint; proto_item *te_quint; - guint16 q_offset, i; - guint8 xres_len, auth_len; + guint16 q_offset, i; + guint8 xres_len, auth_len; q_offset = 0; @@ -3934,11 +3934,11 @@ static int decode_gtp_mm_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree) { - guint16 length, quint_len, con_len; - guint8 count, sec_mode, len, iei; + guint16 length, quint_len, con_len; + guint8 count, sec_mode, len, iei; proto_tree *ext_tree_mm; proto_item *te; - proto_item *tf = NULL; + proto_item *tf = NULL; proto_tree *tf_tree = NULL; te = proto_tree_add_text(tree, tvb, offset, 1, "%s", val_to_str_ext_const(GTP_EXT_MM_CNTXT, >p_val_ext, "Unknown message")); @@ -4116,18 +4116,18 @@ static int decode_qos_umts(tvbuff_t * tvb, int offset, proto_tree * tree, const gchar * qos_str, guint8 type) { - guint length; - guint8 al_ret_priority; - guint8 delay, reliability, peak, precedence, mean, spare1, spare2, spare3; - guint8 traf_class, del_order, del_err_sdu; - guint8 max_sdu_size, max_ul, max_dl, max_ul_ext, max_dl_ext; - guint8 res_ber, sdu_err_ratio; - guint8 trans_delay, traf_handl_prio; - guint8 guar_ul, guar_dl, guar_ul_ext, guar_dl_ext; - guint8 src_stat_desc, sig_ind; + guint length; + guint8 al_ret_priority; + guint8 delay, reliability, peak, precedence, mean, spare1, spare2, spare3; + guint8 traf_class, del_order, del_err_sdu; + guint8 max_sdu_size, max_ul, max_dl, max_ul_ext, max_dl_ext; + guint8 res_ber, sdu_err_ratio; + guint8 trans_delay, traf_handl_prio; + guint8 guar_ul, guar_dl, guar_ul_ext, guar_dl_ext; + guint8 src_stat_desc, sig_ind; proto_tree *ext_tree_qos; proto_item *te; - int mss, mu, md, gu, gd; + int mss, mu, md, gu, gd; /* Will keep if the input is UTF-8 encoded (as in RADIUS messages). * If 1, input is *not* UTF-8 encoded (i.e. each input octet corresponds @@ -4301,7 +4301,7 @@ decode_qos_umts(tvbuff_t * tvb, int offset, proto_tree * tree, const gchar * qos proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_del_err_sdu, tvb, offset + (4 - 1) * utf8_type + 1, utf8_type, del_err_sdu); if (max_sdu_size == 0 || max_sdu_size > 150) proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_sdu_size, tvb, offset + (5 - 1) * utf8_type + 1, utf8_type, max_sdu_size); - if (max_sdu_size > 0 && max_sdu_size <= 150) { + if ((max_sdu_size > 0) && (max_sdu_size <= 150)) { mss = max_sdu_size * 10; proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_sdu_size, tvb, offset + (5 - 1) * utf8_type + 1, utf8_type, mss, "Maximum SDU size: %u octets", mss); @@ -4309,16 +4309,16 @@ decode_qos_umts(tvbuff_t * tvb, int offset, proto_tree * tree, const gchar * qos if (max_ul == 0 || max_ul == 255) proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, max_ul); - if (max_ul > 0 && max_ul <= 63) + if ((max_ul > 0) && (max_ul <= 63)) proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, max_ul, "Maximum bit rate for uplink: %u kbps", max_ul); - if (max_ul > 63 && max_ul <= 127) { + if ((max_ul > 63) && (max_ul <= 127)) { mu = 64 + (max_ul - 64) * 8; proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, mu, "Maximum bit rate for uplink: %u kbps", mu); } - if (max_ul > 127 && max_ul <= 254) { + if ((max_ul > 127) && (max_ul <= 254)) { mu = 576 + (max_ul - 128) * 64; proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, mu, "Maximum bit rate for uplink: %u kbps", mu); @@ -4326,15 +4326,15 @@ decode_qos_umts(tvbuff_t * tvb, int offset, proto_tree * tree, const gchar * qos if (max_dl == 0 || max_dl == 255) proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, max_dl); - if (max_dl > 0 && max_dl <= 63) + if ((max_dl > 0) && (max_dl <= 63)) proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, max_dl, "Maximum bit rate for downlink: %u kbps", max_dl); - if (max_dl > 63 && max_dl <= 127) { + if ((max_dl > 63) && (max_dl <= 127)) { md = 64 + (max_dl - 64) * 8; proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, md, "Maximum bit rate for downlink: %u kbps", md); } - if (max_dl > 127 && max_dl <= 254) { + if ((max_dl > 127) && (max_dl <= 254)) { md = 576 + (max_dl - 128) * 64; proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, md, "Maximum bit rate for downlink: %u kbps", md); @@ -4347,15 +4347,15 @@ decode_qos_umts(tvbuff_t * tvb, int offset, proto_tree * tree, const gchar * qos if (guar_ul == 0 || guar_ul == 255) proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, guar_ul); - if (guar_ul > 0 && guar_ul <= 63) + if ((guar_ul > 0) && (guar_ul <= 63)) proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, guar_ul, "Guaranteed bit rate for uplink: %u kbps", guar_ul); - if (guar_ul > 63 && guar_ul <= 127) { + if ((guar_ul > 63) && (guar_ul <= 127)) { gu = 64 + (guar_ul - 64) * 8; proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, gu, "Guaranteed bit rate for uplink: %u kbps", gu); } - if (guar_ul > 127 && guar_ul <= 254) { + if ((guar_ul > 127) && (guar_ul <= 254)) { gu = 576 + (guar_ul - 128) * 64; proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, gu, "Guaranteed bit rate for uplink: %u kbps", gu); @@ -4364,15 +4364,15 @@ decode_qos_umts(tvbuff_t * tvb, int offset, proto_tree * tree, const gchar * qos /* Octet 13 */ if (guar_dl == 0 || guar_dl == 255) proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, guar_dl); - if (guar_dl > 0 && guar_dl <= 63) + if ((guar_dl > 0) && (guar_dl <= 63)) proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, guar_dl, "Guaranteed bit rate for downlink: %u kbps", guar_dl); - if (guar_dl > 63 && guar_dl <= 127) { + if ((guar_dl > 63) && (guar_dl <= 127)) { gd = 64 + (guar_dl - 64) * 8; proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, gd, "Guaranteed bit rate for downlink: %u kbps", gd); } - if (guar_dl > 127 && guar_dl <= 254) { + if ((guar_dl > 127) && (guar_dl <= 254)) { gd = 576 + (guar_dl - 128) * 64; proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, gd, "Guaranteed bit rate for downlink: %u kbps", gd); @@ -4384,17 +4384,17 @@ decode_qos_umts(tvbuff_t * tvb, int offset, proto_tree * tree, const gchar * qos } if(length > 14) { /* Octet 15 */ - if (max_dl_ext > 0 && max_dl_ext <= 0x4a) { + if ((max_dl_ext > 0) && (max_dl_ext <= 0x4a)) { md = 8600 + max_dl_ext * 100; proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md, "Ext Maximum bit rate for downlink: %u kbps", md); } - if (max_dl_ext > 0x4a && max_dl_ext <= 0xba) { + if ((max_dl_ext > 0x4a) && (max_dl_ext <= 0xba)) { md = 16 + (max_dl_ext-0x4a); proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md, "Ext Maximum bit rate for downlink: %u Mbps", md); } - if (max_dl_ext > 0xba && max_dl_ext <= 0xfa) { + if ((max_dl_ext > 0xba) && (max_dl_ext <= 0xfa)) { md = 128 + (max_dl_ext-0xba)*2; proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md, "Ext Maximum bit rate for downlink: %u Mbps", md); @@ -4402,17 +4402,17 @@ decode_qos_umts(tvbuff_t * tvb, int offset, proto_tree * tree, const gchar * qos /* Octet 16 */ if(guar_dl_ext == 0) proto_tree_add_text(ext_tree_qos, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, "Use the value indicated by the Guaranteed bit rate for downlink in octet 13"); - if (guar_dl_ext > 0 && guar_dl_ext <= 0x4a) { + if ((guar_dl_ext > 0) && (guar_dl_ext <= 0x4a)) { gd = 8600 + guar_dl_ext * 100; proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd, "Ext Guaranteed bit rate for downlink: %u kbps", gd); } - if (guar_dl_ext > 0x4a && max_dl_ext <= 0xba) { + if ((guar_dl_ext > 0x4a) && (max_dl_ext <= 0xba)) { gd = 16 + (guar_dl_ext-0x4a); proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd, "Ext Guaranteed bit rate for downlink: %u Mbps", gd); } - if (guar_dl_ext > 0xba && max_dl_ext <= 0xfa) { + if ((guar_dl_ext > 0xba) && (max_dl_ext <= 0xfa)) { gd = 128 + (guar_dl_ext-0xba)*2; proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd, "Ext Guaranteed bit rate for downlink: %u Mbps", gd); @@ -4424,17 +4424,17 @@ decode_qos_umts(tvbuff_t * tvb, int offset, proto_tree * tree, const gchar * qos * This field is an extension of the Maximum bit rate for uplink in octet 8. The coding is identical to that of the Maximum bit * rate for downlink (extended). */ - if (max_ul_ext > 0 && max_ul_ext <= 0x4a) { + if ((max_ul_ext > 0) && (max_ul_ext <= 0x4a)) { md = 8600 + max_ul_ext * 100; proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md, "Ext Maximum bit rate for uplink: %u kbps", md); } - if (max_ul_ext > 0x4a && max_ul_ext <= 0xba) { + if ((max_ul_ext > 0x4a) && (max_ul_ext <= 0xba)) { md = 16 + (max_ul_ext-0x4a); proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md, "Ext Maximum bit rate for uplink: %u Mbps", md); } - if (max_ul_ext > 0xba && max_ul_ext <= 0xfa) { + if ((max_ul_ext > 0xba) && (max_ul_ext <= 0xfa)) { md = 128 + (max_ul_ext-0xba)*2; proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md, "Ext Maximum bit rate for uplink: %u Mbps", md); @@ -4442,17 +4442,17 @@ decode_qos_umts(tvbuff_t * tvb, int offset, proto_tree * tree, const gchar * qos /* Octet 18 */ if (guar_ul_ext == 0) proto_tree_add_text(ext_tree_qos, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, "Use the value indicated by the Guaranteed bit rate for uplink in octet 12"); - if (guar_ul_ext > 0 && guar_ul_ext <= 0x4a) { + if ((guar_ul_ext > 0) && (guar_ul_ext <= 0x4a)) { gd = 8600 + guar_ul_ext * 100; proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd, "Ext Guaranteed bit rate for uplink: %u kbps", gd); } - if (guar_ul_ext > 0x4a && max_ul_ext <= 0xba) { + if ((guar_ul_ext > 0x4a) && (max_ul_ext <= 0xba)) { gd = 16 + (guar_ul_ext-0x4a); proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd, "Ext Guaranteed bit rate for uplink: %u Mbps", gd); } - if (guar_ul_ext > 0xba && max_ul_ext <= 0xfa) { + if ((guar_ul_ext > 0xba) && (max_ul_ext <= 0xfa)) { gd = 128 + (guar_ul_ext-0xba)*2; proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd, "Ext Guaranteed bit rate for uplink: %u Mbps", gd); @@ -4484,7 +4484,7 @@ decode_apn(tvbuff_t * tvb, int offset, guint16 length, proto_tree * tree) { guint8 *apn = NULL; - int name_len, tmp; + int name_len, tmp; if (length > 0) { name_len = tvb_get_guint8(tvb, offset); @@ -4509,7 +4509,7 @@ static void decode_fqdn(tvbuff_t * tvb, int offset, guint16 length, proto_tree * tree) { guint8 *fqdn = NULL; - int name_len, tmp; + int name_len, tmp; if (length > 0) { name_len = tvb_get_guint8(tvb, offset); @@ -4539,12 +4539,14 @@ static int decode_gtp_pdp_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint8 ggsn_addr_len, apn_len, trans_id, vaa, asi, order, nsapi, sapi, pdu_send_no, pdu_rec_no, pdp_cntxt_id, pdp_type_org, pdp_type_num, pdp_addr_len; - guint16 length, sn_down, sn_up, up_flow; - guint32 addr_ipv4; - struct e_in6_addr addr_ipv6; - proto_tree *ext_tree_pdp; - proto_item *te; + guint8 ggsn_addr_len, apn_len, trans_id, vaa, asi, order; + guint8 nsapi, sapi, pdu_send_no, pdu_rec_no; + guint8 pdp_cntxt_id, pdp_type_org, pdp_type_num, pdp_addr_len; + guint16 length, sn_down, sn_up, up_flow; + guint32 addr_ipv4; + struct e_in6_addr addr_ipv6; + proto_tree *ext_tree_pdp; + proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); @@ -4697,7 +4699,7 @@ static int decode_gtp_apn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree_apn; proto_item *te; @@ -4721,8 +4723,8 @@ int decode_gtp_proto_conf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree) { - guint16 length; - tvbuff_t *next_tvb; + guint16 length; + tvbuff_t *next_tvb; proto_tree *ext_tree_proto; proto_item *te; @@ -4754,12 +4756,12 @@ static int decode_gtp_gsn_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint8 addr_type, addr_len; - guint16 length; - guint32 addr_ipv4; - struct e_in6_addr addr_ipv6; - proto_tree *ext_tree_gsn_addr; - proto_item *te; + guint8 addr_type, addr_len; + guint16 length; + guint32 addr_ipv4; + struct e_in6_addr addr_ipv6; + proto_tree *ext_tree_gsn_addr; + proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); @@ -4813,8 +4815,8 @@ decode_gtp_gsn_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_t static int decode_gtp_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree) { - guint16 length; - tvbuff_t *next_tvb; + guint16 length; + tvbuff_t *next_tvb; proto_tree *ext_tree_proto; proto_item *te; @@ -4830,8 +4832,8 @@ decode_gtp_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * if (length < 1) return 3; - next_tvb = tvb_new_subset(tvb, offset+3, length, length); - dissect_gsm_map_msisdn(next_tvb, pinfo, ext_tree_proto); + next_tvb = tvb_new_subset(tvb, offset+3, length, length); + dissect_gsm_map_msisdn(next_tvb, pinfo, ext_tree_proto); return 3 + length; } @@ -4856,8 +4858,8 @@ decode_gtp_auth_qui(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_t proto_tree *ext_tree; proto_item *te_quint; - guint16 length; - guint8 xres_len, auth_len; + guint16 length; + guint8 xres_len, auth_len; length = tvb_get_ntohs(tvb, offset + 1); @@ -4897,13 +4899,13 @@ static int decode_gtp_tft(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length, port1, port2, tos; - guint8 tft_flags, tft_code, no_packet_filters, i, pf_id, pf_eval, pf_len, pf_content_id, proto; - guint pf_offset; - guint32 mask_ipv4, addr_ipv4, ipsec_id, label; - struct e_in6_addr addr_ipv6, mask_ipv6; - proto_tree *ext_tree_tft, *ext_tree_tft_pf, *ext_tree_tft_flags; - proto_item *te, *tee, *tef; + guint16 length, port1, port2, tos; + guint8 tft_flags, tft_code, no_packet_filters, i, pf_id, pf_eval, pf_len, pf_content_id, proto; + guint pf_offset; + guint32 mask_ipv4, addr_ipv4, ipsec_id, label; + struct e_in6_addr addr_ipv6, mask_ipv6; + proto_tree *ext_tree_tft, *ext_tree_tft_pf, *ext_tree_tft_flags; + proto_item *te, *tee, *tef; length = tvb_get_ntohs(tvb, offset + 1); @@ -5039,11 +5041,11 @@ static int decode_gtp_target_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_item *te; proto_tree *ext_tree; - tvbuff_t *next_tvb; - asn1_ctx_t asn1_ctx; + tvbuff_t *next_tvb; + asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo); length = tvb_get_ntohs(tvb, offset + 1); @@ -5072,10 +5074,10 @@ static int decode_gtp_utran_cont(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_item *te; proto_tree *ext_tree; - tvbuff_t *next_tvb; + tvbuff_t *next_tvb; length = tvb_get_ntohs(tvb, offset + 1); @@ -5100,11 +5102,11 @@ static int decode_gtp_rab_setup(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint32 teid, addr_ipv4; - guint16 length; - struct e_in6_addr addr_ipv6; - proto_tree *ext_tree_rab_setup; - proto_item *te; + guint32 teid, addr_ipv4; + guint16 length; + struct e_in6_addr addr_ipv6; + proto_tree *ext_tree_rab_setup; + proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); @@ -5112,7 +5114,7 @@ decode_gtp_rab_setup(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_ ext_tree_rab_setup = proto_item_add_subtree(te, ett_gtp_rab_setup); proto_tree_add_text(ext_tree_rab_setup, tvb, offset + 1, 2, "RAB setup length : %u", length); - proto_tree_add_item(ext_tree_rab_setup, hf_gtp_nsapi, tvb, offset + 3, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree_rab_setup, hf_gtp_nsapi, tvb, offset + 3, 1, ENC_BIG_ENDIAN); if (length > 1) { @@ -5145,8 +5147,8 @@ static int decode_gtp_hdr_list(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - int i; - guint8 length, hdr; + int i; + guint8 length, hdr; proto_tree *ext_tree_hdr_list; proto_item *te; @@ -5210,11 +5212,11 @@ static int decode_gtp_chrg_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; - guint32 addr_ipv4; - struct e_in6_addr addr_ipv6; - proto_tree *ext_tree_chrg_addr; - proto_item *te; + guint16 length; + guint32 addr_ipv4; + struct e_in6_addr addr_ipv6; + proto_tree *ext_tree_chrg_addr; + proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); @@ -5252,10 +5254,10 @@ static int decode_gtp_ran_tr_cont(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; - tvbuff_t *next_tvb; + tvbuff_t *next_tvb; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str_ext_const(GTP_EXT_RAN_TR_CONT, >p_val_ext, "Unknown")); @@ -5282,7 +5284,7 @@ static int decode_gtp_pdp_cont_prio(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -5307,7 +5309,7 @@ static int decode_gtp_add_rab_setup_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -5333,7 +5335,7 @@ static int decode_gtp_ssgn_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -5358,7 +5360,7 @@ static int decode_gtp_common_flgs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -5395,7 +5397,7 @@ static int decode_gtp_apn_res(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree_apn_res; proto_item *te; @@ -5430,7 +5432,7 @@ static int decode_gtp_rat_type(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree_rat_type; proto_item *te; @@ -5467,8 +5469,8 @@ static const gchar *dissect_radius_user_loc(proto_tree * tree, tvbuff_t * tvb, packet_info* pinfo) { - int offset = 0; - guint8 geo_loc_type; + int offset = 0; + guint8 geo_loc_type; guint16 length = tvb_length(tvb); /* Geographic Location Type */ @@ -5498,10 +5500,10 @@ static int decode_gtp_usr_loc_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree, *rai_tree; proto_item *te, *fi; - guint8 geo_loc_type; + guint8 geo_loc_type; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_USR_LOC_INF, >p_val_ext, "Unknown")); @@ -5579,11 +5581,11 @@ static int decode_gtp_ms_time_zone(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; - guint8 data; - char sign; + guint8 data; + char sign; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s: ", val_to_str_ext_const(GTP_EXT_MS_TIME_ZONE, >p_val_ext, "Unknown")); @@ -5626,10 +5628,10 @@ static int decode_gtp_imeisv(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_imeisv; proto_item *te; - tvbuff_t *next_tvb; + tvbuff_t *next_tvb; const char *digit_str; length = tvb_get_ntohs(tvb, offset + 1); @@ -5663,7 +5665,7 @@ static int decode_gtp_camel_chg_inf_con(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -5689,7 +5691,7 @@ static int decode_gtp_mbms_ue_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -5719,10 +5721,10 @@ static int decode_gtp_tmgi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree, *tmgi_tree; proto_item *te, *ti; - tvbuff_t *next_tvb; + tvbuff_t *next_tvb; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_TMGI, >p_val_ext, "Unknown")); @@ -5749,7 +5751,7 @@ static int decode_gtp_rim_ra(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -5778,7 +5780,7 @@ static int decode_gtp_mbms_prot_conf_opt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -5818,7 +5820,7 @@ static int decode_gtp_mbms_ses_dur(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -5857,9 +5859,9 @@ decode_gtp_mbms_ses_dur(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, pro static int dissect_gtp_3gpp_mbms_service_area(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { - int offset = 0; + int offset = 0; guint8 no_of_mbms_sa_codes; - int i; + int i; /* The MBMS Service Area is defined in 3GPP TS 23.246 [26]. * The MBMS Service Area information element indicates the area over @@ -5892,8 +5894,8 @@ static int decode_gtp_mbms_sa(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - tvbuff_t *next_tvb; - guint16 length; + tvbuff_t *next_tvb; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -5919,7 +5921,7 @@ static int decode_gtp_src_rnc_pdp_ctx_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -5945,7 +5947,7 @@ static int decode_gtp_add_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -5971,7 +5973,7 @@ static int decode_gtp_hop_count(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -5997,7 +5999,7 @@ static int decode_gtp_sel_plmn_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -6023,7 +6025,7 @@ static int decode_gtp_mbms_ses_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -6056,7 +6058,7 @@ static int decode_gtp_mbms_2g_3g_ind(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -6082,7 +6084,7 @@ static int decode_gtp_enh_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -6108,7 +6110,7 @@ static int decode_gtp_add_mbms_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -6134,7 +6136,7 @@ static int decode_gtp_mbms_ses_id_rep_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -6161,7 +6163,7 @@ static int dissect_gtp_mbms_time_to_data_tr(tvbuff_t * tvb _U_, packet_info * pinfo _U_, proto_tree * tree _U_) { - int offset = 0; + int offset = 0; guint8 time_2_dta_tr; time_2_dta_tr = tvb_get_guint8(tvb, offset) + 1; @@ -6175,10 +6177,10 @@ static int decode_gtp_mbms_time_to_data_tr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; - guint8 time_2_dta_tr; + guint8 time_2_dta_tr; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_TIME_TO_DATA_TR, >pv1_val_ext, "Unknown")); @@ -6220,7 +6222,7 @@ static int decode_gtp_ps_ho_req_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -6246,7 +6248,7 @@ static int decode_gtp_bss_cont(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -6275,7 +6277,7 @@ static int decode_gtp_cell_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -6308,7 +6310,7 @@ static int decode_gtp_pdu_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -6334,7 +6336,7 @@ static int decode_gtp_bssgp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -6361,7 +6363,7 @@ decode_gtp_bssgp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, prot static int decode_gtp_mbms_bearer_cap(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -6397,7 +6399,7 @@ static int decode_gtp_rim_ra_disc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -6424,7 +6426,7 @@ static int decode_gtp_lst_set_up_pfc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -6448,12 +6450,12 @@ static int decode_gtp_ps_handover_xid(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; - tvbuff_t *next_tvb; - guint8 sapi; - guint8 xid_par_len; + tvbuff_t *next_tvb; + guint8 sapi; + guint8 xid_par_len; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_PS_HANDOVER_XIP_PAR, >pv1_val_ext, "Unknown")); @@ -6488,7 +6490,7 @@ static int decode_gtp_ms_inf_chg_rep_act(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -6512,7 +6514,7 @@ static int decode_gtp_direct_tnl_flg(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -6541,7 +6543,7 @@ static int decode_gtp_corrl_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -6572,14 +6574,14 @@ static int decode_gtp_bearer_cntrl_mod(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_BEARER_CONTROL_MODE, >pv1_val_ext, "Unknown")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_BEARER_CONTROL_MODE]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); @@ -6597,24 +6599,24 @@ decode_gtp_bearer_cntrl_mod(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, static int decode_gtp_mbms_flow_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_FLOW_ID, >pv1_val_ext, "Unknown")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_MBMS_FLOW_ID]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; - /* 4-n MBMS Flow Identifier */ - proto_tree_add_item(ext_tree, hf_gtp_mbms_flow_id, tvb, offset, length, ENC_BIG_ENDIAN); + /* 4-n MBMS Flow Identifier */ + proto_tree_add_item(ext_tree, hf_gtp_mbms_flow_id, tvb, offset, length, ENC_BIG_ENDIAN); - return 3 + length; + return 3 + length; } /* @@ -6624,22 +6626,22 @@ decode_gtp_mbms_flow_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, pro static int decode_gtp_mbms_ip_mcast_dist(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_IP_MCAST_DIST, >pv1_val_ext, "Unknown")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_MBMS_IP_MCAST_DIST]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; - proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); + proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); - return 3 + length; + return 3 + length; } /* @@ -6656,23 +6658,23 @@ static const value_string gtp_mbms_dist_indic_vals[] = { static int decode_gtp_mbms_dist_ack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_DIST_ACK, >pv1_val_ext, "Unknown")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_MBMS_DIST_ACK]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; - /* Distribution Indication values */ - proto_tree_add_item(ext_tree, hf_gtp_mbms_dist_indic, tvb, offset, 1, ENC_BIG_ENDIAN); + /* Distribution Indication values */ + proto_tree_add_item(ext_tree, hf_gtp_mbms_dist_indic, tvb, offset, 1, ENC_BIG_ENDIAN); - return 3 + length; + return 3 + length; } /* @@ -6681,22 +6683,22 @@ decode_gtp_mbms_dist_ack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, pr static int decode_gtp_reliable_irat_ho_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_RELIABLE_IRAT_HO_INF, >pv1_val_ext, "Unknown")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_RELIABLE_IRAT_HO_INF]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; - proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); + proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); - return 3 + length; + return 3 + length; } /* @@ -6705,22 +6707,22 @@ decode_gtp_reliable_irat_ho_inf(tvbuff_t * tvb, int offset, packet_info * pinfo static int decode_gtp_rfsp_index(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_RFSP_INDEX, >pv1_val_ext, "Unknown")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_RFSP_INDEX]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; - proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); + proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); - return 3 + length; + return 3 + length; } /* * 7.7.89 PDP Type @@ -6732,7 +6734,7 @@ static int decode_gtp_fqdn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -6740,7 +6742,7 @@ decode_gtp_fqdn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree te = proto_tree_add_text(tree, tvb, offset, length + 3, "%s", val_to_str_ext_const(GTP_EXT_FQDN, >p_val_ext, "Unknown field")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_FQDN]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_text(ext_tree, tvb, offset + 1, 2, "FQDN length : %u", length); decode_fqdn(tvb, offset + 3, length, ext_tree); @@ -6755,14 +6757,14 @@ static int decode_gtp_evolved_allc_rtn_p1(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_EVO_ALLO_RETE_P1, >pv1_val_ext, "Unknown")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_EVO_ALLO_RETE_P1]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); @@ -6784,14 +6786,14 @@ static int decode_gtp_evolved_allc_rtn_p2(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_EVO_ALLO_RETE_P2, >pv1_val_ext, "Unknown")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_EVO_ALLO_RETE_P2]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); @@ -6812,22 +6814,22 @@ decode_gtp_evolved_allc_rtn_p2(tvbuff_t * tvb, int offset, packet_info * pinfo _ static int decode_gtp_extended_common_flgs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_EXTENDED_COMMON_FLGS, >pv1_val_ext, "Unknown")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_EXTENDED_COMMON_FLGS]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; - proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); + proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); - return 3 + length; + return 3 + length; } /* @@ -6836,22 +6838,22 @@ decode_gtp_extended_common_flgs(tvbuff_t * tvb, int offset, packet_info * pinfo static int decode_gtp_uci(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_UCI, >pv1_val_ext, "Unknown")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_UCI]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; - proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); + proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); - return 3 + length; + return 3 + length; } /* @@ -6861,22 +6863,22 @@ decode_gtp_uci(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * static int decode_gtp_csg_inf_rep_act(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_CSG_INF_REP_ACT, >pv1_val_ext, "Unknown")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_CSG_INF_REP_ACT]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; - proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); + proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); - return 3 + length; + return 3 + length; } /* * 7.7.96 CSG ID @@ -6885,22 +6887,22 @@ decode_gtp_csg_inf_rep_act(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, static int decode_gtp_csg_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_CSG_ID, >pv1_val_ext, "Unknown")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_CSG_ID]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; - proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); + proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); - return 3 + length; + return 3 + length; } /* * 7.7.97 CSG Membership Indication (CMI) @@ -6908,22 +6910,22 @@ decode_gtp_csg_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tre static int decode_gtp_cmi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_CMI, >pv1_val_ext, "Unknown")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_CMI]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; - proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); + proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); - return 3 + length; + return 3 + length; } /* * 7.7.98 APN Aggregate Maximum Bit Rate (APN-AMBR) @@ -6931,32 +6933,32 @@ decode_gtp_cmi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * static int decode_gtp_apn_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_AMBR, >pv1_val_ext, "Unknown")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_RELIABLE_IRAT_HO_INF]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; - /* APN Aggregate Maximum Bit Rate (APN-AMBR) is defined in clause 9.9.4.2 of 3GPP TS 24.301 [42], but shall be - * formatted as shown in Figure 7.7.98-1 as Unsigned32 binary integer values in kbps (1000 bits per second). - */ - /* 4 to 7 APN-AMBR for Uplink */ - te = proto_tree_add_item(ext_tree, hf_gtp_ext_apn_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN); - proto_item_append_text(te, " kbps"); - offset+=4; - /* 8 to 11 APN-AMBR for Downlink */ - te = proto_tree_add_item(ext_tree, hf_gtp_ext_apn_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN); - proto_item_append_text(te, " kbps"); + /* APN Aggregate Maximum Bit Rate (APN-AMBR) is defined in clause 9.9.4.2 of 3GPP TS 24.301 [42], but shall be + * formatted as shown in Figure 7.7.98-1 as Unsigned32 binary integer values in kbps (1000 bits per second). + */ + /* 4 to 7 APN-AMBR for Uplink */ + te = proto_tree_add_item(ext_tree, hf_gtp_ext_apn_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_item_append_text(te, " kbps"); + offset+=4; + /* 8 to 11 APN-AMBR for Downlink */ + te = proto_tree_add_item(ext_tree, hf_gtp_ext_apn_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_item_append_text(te, " kbps"); - return 3 + length; + return 3 + length; } /* * 7.7.99 UE Network Capability @@ -6964,7 +6966,7 @@ decode_gtp_apn_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_t static int decode_gtp_ue_network_cap(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; @@ -6976,9 +6978,9 @@ decode_gtp_ue_network_cap(tvbuff_t * tvb, int offset, packet_info * pinfo, proto proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; - de_emm_ue_net_cap(tvb, ext_tree, pinfo, offset, length, NULL, 0); + de_emm_ue_net_cap(tvb, ext_tree, pinfo, offset, length, NULL, 0); - return 3 + length; + return 3 + length; } /* * 7.7.100 UE-AMBR @@ -6987,80 +6989,80 @@ decode_gtp_ue_network_cap(tvbuff_t * tvb, int offset, packet_info * pinfo, proto static int decode_gtp_ue_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_APN_AMBR_WITH_NSAPI, >pv1_val_ext, "Unknown")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_APN_AMBR_WITH_NSAPI]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; - /* 4 to 7 Subscribed UE-AMBR for Uplink */ - te = proto_tree_add_item(ext_tree, hf_gtp_ext_sub_ue_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN); - proto_item_append_text(te, " kbps"); - offset+=4; - /* 8 to 11 Subscribed UE-AMBR for Downlink */ - te = proto_tree_add_item(ext_tree, hf_gtp_ext_sub_ue_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN); - proto_item_append_text(te, " kbps"); - offset+=4; + /* 4 to 7 Subscribed UE-AMBR for Uplink */ + te = proto_tree_add_item(ext_tree, hf_gtp_ext_sub_ue_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_item_append_text(te, " kbps"); + offset+=4; + /* 8 to 11 Subscribed UE-AMBR for Downlink */ + te = proto_tree_add_item(ext_tree, hf_gtp_ext_sub_ue_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_item_append_text(te, " kbps"); + offset+=4; - /* Authorized UE-AMBR for Uplink and Downlink fields are present in the IE only if the sender has their valid values - * available. Otherwise, the fields from m to (n+3) shall not be present. - */ - if(offset >= length) - return 3 + length; + /* Authorized UE-AMBR for Uplink and Downlink fields are present in the IE only if the sender has their valid values + * available. Otherwise, the fields from m to (n+3) shall not be present. + */ + if(offset >= length) + return 3 + length; - /* m to (m+3) Authorized UE-AMBR for Uplink */ - te = proto_tree_add_item(ext_tree, hf_gtp_ext_auth_ue_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN); - proto_item_append_text(te, " kbps"); - offset+=4; + /* m to (m+3) Authorized UE-AMBR for Uplink */ + te = proto_tree_add_item(ext_tree, hf_gtp_ext_auth_ue_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_item_append_text(te, " kbps"); + offset+=4; - /* (m+4) to (n+3) Authorized UE-AMBR for Downlink */ - te = proto_tree_add_item(ext_tree, hf_gtp_ext_auth_ue_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN); - proto_item_append_text(te, " kbps"); + /* (m+4) to (n+3) Authorized UE-AMBR for Downlink */ + te = proto_tree_add_item(ext_tree, hf_gtp_ext_auth_ue_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_item_append_text(te, " kbps"); - proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); + proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); - return 3 + length; + return 3 + length; } - + /* * 7.7.101 APN-AMBR with NSAPI */ static int decode_gtp_apn_ambr_with_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_UE_AMBR, >pv1_val_ext, "Unknown")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_UE_AMBR]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; - proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN); - offset++; + proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN); + offset++; - /* 5 to 8 Authorized APN-AMBR for Uplink */ - te = proto_tree_add_item(ext_tree, hf_gtp_ext_auth_apn_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN); - proto_item_append_text(te, " kbps"); - offset+=4; + /* 5 to 8 Authorized APN-AMBR for Uplink */ + te = proto_tree_add_item(ext_tree, hf_gtp_ext_auth_apn_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_item_append_text(te, " kbps"); + offset+=4; - /* 9 to12 Authorized APN-AMBR for Downlink */ - te = proto_tree_add_item(ext_tree, hf_gtp_ext_auth_apn_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN); - proto_item_append_text(te, " kbps"); + /* 9 to12 Authorized APN-AMBR for Downlink */ + te = proto_tree_add_item(ext_tree, hf_gtp_ext_auth_apn_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN); + proto_item_append_text(te, " kbps"); - return 3 + length; + return 3 + length; } /* * 7.7.102 GGSN Back-Off Time @@ -7078,24 +7080,24 @@ static const value_string gtp_ggsn_back_off_time_units_vals[] = { static int decode_gtp_ggsn_back_off_time(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_GGSN_BACK_OFF_TIME, >pv1_val_ext, "Unknown")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_GGSN_BACK_OFF_TIME]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; - /* 4 Timer unit Timer value */ - proto_tree_add_item(ext_tree, hf_gtp_ext_ggsn_back_off_time_units, tvb, offset, 2, ENC_BIG_ENDIAN); - proto_tree_add_item(ext_tree, hf_gtp_ext_ggsn_back_off_timer, tvb, offset, 2, ENC_BIG_ENDIAN); + /* 4 Timer unit Timer value */ + proto_tree_add_item(ext_tree, hf_gtp_ext_ggsn_back_off_time_units, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ext_ggsn_back_off_timer, tvb, offset, 2, ENC_BIG_ENDIAN); - return 3 + length; + return 3 + length; } /* @@ -7105,22 +7107,22 @@ decode_gtp_ggsn_back_off_time(tvbuff_t * tvb, int offset, packet_info * pinfo _U static int decode_gtp_sig_pri_ind(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_SIG_PRI_IND, >pv1_val_ext, "Unknown")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_SIG_PRI_IND]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; - proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); + proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); - return 3 + length; + return 3 + length; } /* * 7.7.104 Signalling Priority Indication with NSAPI @@ -7129,22 +7131,22 @@ decode_gtp_sig_pri_ind(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, prot static int decode_gtp_sig_pri_ind_w_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_SIG_PRI_IND_W_NSAPI, >pv1_val_ext, "Unknown")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_SIG_PRI_IND_W_NSAPI]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; - proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); + proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); - return 3 + length; + return 3 + length; } /* * 7.7.105 Higher bitrates than 16 Mbps flag @@ -7158,23 +7160,23 @@ static const value_string gtp_higher_br_16mb_flg_vals[] = { static int decode_gtp_higher_br_16mb_flg(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_HIGHER_BR_16MB_FLG, >pv1_val_ext, "Unknown")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_HIGHER_BR_16MB_FLG]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; - /* Higher bitrates than 16 Mbps flag */ - proto_tree_add_item(ext_tree, hf_gtp_higher_br_16mb_flg, tvb, offset, 1, ENC_BIG_ENDIAN); + /* Higher bitrates than 16 Mbps flag */ + proto_tree_add_item(ext_tree, hf_gtp_higher_br_16mb_flg, tvb, offset, 1, ENC_BIG_ENDIAN); - return 3 + length; + return 3 + length; } /* * 7.7.106 Max MBR/APN-AMBR @@ -7183,36 +7185,36 @@ decode_gtp_higher_br_16mb_flg(tvbuff_t * tvb, int offset, packet_info * pinfo _U static int decode_gtp_max_mbr_apn_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; - guint32 max_ul; - guint32 max_dl; + guint32 max_ul; + guint32 max_dl; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MAX_MBR_APN_AMBR, >pv1_val_ext, "Unknown")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_MAX_MBR_APN_AMBR]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; /* Max MBR/APN-AMBR for uplink */ - max_ul = tvb_get_ntohl(tvb, offset); - proto_tree_add_uint_format(ext_tree, hf_gtp_max_mbr_apn_ambr_ul, tvb, offset, 4, max_ul, "Max MBR/APN-AMBR for uplink : %u %s", - (max_ul) > 1000 ? max_ul/1000 : max_ul, - (max_ul) > 1000 ? "Mbps" : "kbps"); + max_ul = tvb_get_ntohl(tvb, offset); + proto_tree_add_uint_format(ext_tree, hf_gtp_max_mbr_apn_ambr_ul, tvb, offset, 4, max_ul, "Max MBR/APN-AMBR for uplink : %u %s", + (max_ul) > 1000 ? max_ul/1000 : max_ul, + (max_ul) > 1000 ? "Mbps" : "kbps"); offset += 4; /* Max MBR/APN-AMBR for downlink */ max_dl = tvb_get_ntohl(tvb, offset); - proto_tree_add_uint_format(ext_tree, hf_gtp_max_mbr_apn_ambr_dl, tvb, offset, 4, max_dl, "Max MBR/APN-AMBR for downlink : %u %s", - (max_dl) > 1000 ? max_dl/1000 : max_dl, - (max_dl) > 1000 ? "Mbps" : "kbps"); + proto_tree_add_uint_format(ext_tree, hf_gtp_max_mbr_apn_ambr_dl, tvb, offset, 4, max_dl, "Max MBR/APN-AMBR for downlink : %u %s", + (max_dl) > 1000 ? max_dl/1000 : max_dl, + (max_dl) > 1000 ? "Mbps" : "kbps"); - return 3 + length; + return 3 + length; } /* * 7.7.107 Additional MM context for SRVCC @@ -7221,22 +7223,22 @@ decode_gtp_max_mbr_apn_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, static int decode_gtp_add_mm_ctx_srvcc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_ADD_MM_CTX_SRVCC, >pv1_val_ext, "Unknown")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_ADD_MM_CTX_SRVCC]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; - proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); + proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); - return 3 + length; + return 3 + length; } /* @@ -7246,22 +7248,22 @@ decode_gtp_add_mm_ctx_srvcc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, static int decode_gtp_add_flgs_srvcc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_ADD_FLGS_SRVCC, >pv1_val_ext, "Unknown")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_ADD_FLGS_SRVCC]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; - proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); + proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); - return 3 + length; + return 3 + length; } /* * 7.7.109 STN-SR @@ -7269,22 +7271,22 @@ decode_gtp_add_flgs_srvcc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, p static int decode_gtp_stn_sr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_STN_SR, >pv1_val_ext, "Unknown")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_STN_SR]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; - proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); + proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); - return 3 + length; + return 3 + length; } /* @@ -7294,22 +7296,22 @@ decode_gtp_stn_sr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tre static int decode_gtp_c_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_C_MSISDN, >pv1_val_ext, "Unknown")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_C_MSISDN]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; - proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); + proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); - return 3 + length; + return 3 + length; } /* * 7.7.111 Extended RANAP Cause @@ -7317,22 +7319,22 @@ decode_gtp_c_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_t static int decode_gtp_ext_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; + guint16 length; proto_tree *ext_tree; proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_EXT_RANAP_CAUSE, >pv1_val_ext, "Unknown")); ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_EXT_RANAP_CAUSE]); - proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset = offset + 2; - proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); + proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet"); - return 3 + length; + return 3 + length; } /* GPRS: 12.15 @@ -7342,7 +7344,7 @@ static int decode_gtp_rel_pack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length, n, number; + guint16 length, n, number; proto_tree *ext_tree_rel_pack; proto_item *te; @@ -7371,7 +7373,7 @@ static int decode_gtp_can_pack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length, n, number; + guint16 length, n, number; proto_tree *ext_tree_can_pack; proto_item *te; @@ -7407,11 +7409,11 @@ static int decode_gtp_data_req(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length, cdr_length; - guint8 no, format, app_id, rel_id, ver_id, i; + guint16 length, cdr_length; + guint8 no, format, app_id, rel_id, ver_id, i; proto_tree *ext_tree, *ver_tree, *cdr_dr_tree; proto_item *te, *fmt_item, *ver_item; - tvbuff_t *next_tvb; + tvbuff_t *next_tvb; te = proto_tree_add_text(tree, tvb, offset, 1, "%s", val_to_str_ext_const(GTP_EXT_DATA_REQ, >p_val_ext, "Unknown message")); ext_tree = proto_item_add_subtree(te, ett_gtp_ext); @@ -7427,14 +7429,14 @@ decode_gtp_data_req(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_t offset++; /* Octet 5 Data Record Format */ - format = tvb_get_guint8(tvb, offset); + format = tvb_get_guint8(tvb, offset); fmt_item = proto_tree_add_text(ext_tree, tvb, offset, 1, "Data record format: %u", format); offset++; /* The value range is 1-255 in decimal. The value '0' should not be used. * Only the values 1-10 and 51-255 can be used for standards purposes. * Values in the range of 11-50 are to be configured only by operators, and are not subject to standardization. */ - if(format<4) { + if(format < 4) { proto_item_append_text(fmt_item, " %s", val_to_str_const(format, gtp_cdr_fmt_vals, "Unknown")); /* Octet 6 -7 Data Record Format Version * 8 7 6 5 4 3 2 1 @@ -7452,7 +7454,7 @@ decode_gtp_data_req(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_t * In circumstances where the second digit is an alphabetical character, (e.g. 3.b.0), the corresponding ASCII value shall * be taken, e.g. the Version Identifier would be "66" (ASCII(b)). */ - if(ver_id<0x65) + if(ver_id < 0x65) ver_id = ver_id -1; /* XXX We don't handle ASCCI version */ @@ -7503,7 +7505,7 @@ static int decode_gtp_data_resp(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length, n, number; + guint16 length, n, number; proto_tree *ext_tree_data_resp; proto_item *te; @@ -7533,11 +7535,11 @@ static int decode_gtp_node_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length; - guint32 addr_ipv4; - struct e_in6_addr addr_ipv6; - proto_tree *ext_tree_node_addr; - proto_item *te; + guint16 length; + guint32 addr_ipv4; + struct e_in6_addr addr_ipv6; + proto_tree *ext_tree_node_addr; + proto_item *te; length = tvb_get_ntohs(tvb, offset + 1); @@ -7575,10 +7577,10 @@ static int decode_gtp_priv_ext(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) { - guint16 length, ext_id; + guint16 length, ext_id; proto_tree *ext_tree_priv_ext; proto_item *te; - tvbuff_t *next_tvb; + tvbuff_t *next_tvb; te = proto_tree_add_text(tree, tvb, offset, 1, "%s", val_to_str_ext_const(GTP_EXT_PRIV_EXT, >p_val_ext, "Unknown message")); ext_tree_priv_ext = proto_item_add_subtree(te, ett_gtp_ext); @@ -7618,20 +7620,26 @@ decode_gtp_unknown(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tr static void dissect_gtp_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { - struct _gtp_hdr gtp_hdr; - proto_tree *gtp_tree, *flags_tree, *ext_tree; - proto_item *ti, *tf, *item; - int i, offset, length, gtp_prime, checked_field, mandatory; - int seq_no=0, flow_label=0; - guint8 pdu_no, next_hdr = 0, ext_hdr_val, noOfExtHdrs = 0, ext_hdr_length; - gchar *tid_str; - guint32 teid = 0; - tvbuff_t *next_tvb; - guint8 sub_proto, acfield_len = 0, control_field; - gtp_msg_hash_t *gcrp=NULL; - conversation_t *conversation=NULL; + struct _gtp_hdr gtp_hdr; + proto_tree *gtp_tree, *flags_tree, *ext_tree; + proto_item *ti, *tf, *item; + int i, offset, length, gtp_prime, checked_field, mandatory; + int seq_no = 0; + int flow_label = 0; + guint8 pdu_no, next_hdr = 0; + guint8 ext_hdr_val; + guint8 noOfExtHdrs = 0; + guint8 ext_hdr_length; + gchar *tid_str; + guint32 teid = 0; + tvbuff_t *next_tvb; + guint8 sub_proto; + guint8 acfield_len = 0; + guint8 control_field; + gtp_msg_hash_t *gcrp = NULL; + conversation_t *conversation = NULL; gtp_conv_info_t *gtp_info; - void* pd_save; + void* pd_save; col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTP"); @@ -7691,7 +7699,7 @@ dissect_gtp_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) tf = proto_tree_add_uint(gtp_tree, hf_gtp_flags, tvb, 0, 1, gtp_hdr.flags); flags_tree = proto_item_add_subtree(tf, ett_gtp_flags); - if(gtp_prime==1) { + if(gtp_prime == 1) { /* Octet 8 7 6 5 4 3 2 1 * 1 Version | PT| Spare '1 1 1 '| ' 0/1 ' */ @@ -7705,13 +7713,13 @@ dissect_gtp_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) * For all other versions of GTP', this bit is not used and is set to '0'. However, * this does not suggest the use of the 20-octet header, rather a shorter 6-octet header. */ - if(gtp_version==0) { + if(gtp_version == 0) { proto_tree_add_item(flags_tree, hf_gtp_flags_hdr_length, tvb, 0, 1, ENC_BIG_ENDIAN); } } else { proto_tree_add_uint(flags_tree, hf_gtp_flags_ver, tvb, 0, 1, gtp_hdr.flags); proto_tree_add_uint(flags_tree, hf_gtp_flags_pt, tvb, 0, 1, gtp_hdr.flags); - if(gtp_version==0) { + if(gtp_version == 0) { proto_tree_add_uint(flags_tree, hf_gtp_flags_spare1, tvb, 0, 1, gtp_hdr.flags); proto_tree_add_boolean(flags_tree, hf_gtp_flags_snn, tvb, 0, 1, gtp_hdr.flags); } else { @@ -7734,7 +7742,7 @@ dissect_gtp_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) proto_tree_add_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, seq_no); offset += 2; /* If GTP' version is 0 and bit 1 is 0 20 bytes header is used, step past it */ - if( (gtp_version==0)&&((gtp_hdr.flags & 0x01)==0) ) { + if( (gtp_version == 0) && ((gtp_hdr.flags & 0x01) == 0) ) { offset = GTPv0_HDR_LENGTH; } } else { @@ -7935,7 +7943,7 @@ dissect_gtp_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) if(gtp_hdr.length > offset){ proto_tree_add_text(tree, tvb, offset, gtp_hdr.length, "T-PDU Data %u bytes", gtp_hdr.length); - } + } /* Can only handle one extension header type... */ if (noOfExtHdrs != 0) offset+= 1 + noOfExtHdrs*4; @@ -7971,7 +7979,9 @@ dissect_gtp_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) col_prepend_fstr(pinfo->cinfo, COL_PROTOCOL, "GTP <"); col_append_str(pinfo->cinfo, COL_PROTOCOL, ">"); - } /*else { + } + #if 0 + else { if (gtp_prime) offset = 6; else if (gtp_version == 1) { @@ -7983,7 +7993,8 @@ dissect_gtp_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) offset = 8; } else offset = 20; - }*/ + } +#endif pinfo->private_data = pd_save; } @@ -8002,14 +8013,14 @@ dissect_gtp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) * Should this be moved to after the conversation stuff to retain that functionality for GTPv2 ??? */ version = tvb_get_guint8(tvb,0)>>5; - if (version==2) { + if (version == 2) { /* GTPv2-C 3GPP TS 29.274 */ if (gtpv2_handle) { call_dissector(gtpv2_handle, tvb, pinfo, tree); return; } } - if(version>2) { + if(version > 2) { proto_tree_add_text(tree, tvb, 0, -1, "No WS dissector for GTP version %u %s", version, val_to_str_const(version, ver_types, "Unknown")); return; @@ -8041,506 +8052,916 @@ gtp_reinit(void) gtp_info_items = NULL; } -void proto_register_gtp(void) +void +proto_register_gtp(void) { module_t *gtp_module; - guint i; - guint last_offset; + guint i; + guint last_offset; static hf_register_info hf_gtp[] = { {&hf_gtp_ie_id, - {"IE Id", "gtp.ie_id", - FT_UINT8, BASE_DEC|BASE_EXT_STRING, >p_val_ext, 0x0, - NULL, HFILL} - }, + { "IE Id", "gtp.ie_id", + FT_UINT8, BASE_DEC|BASE_EXT_STRING, >p_val_ext, 0x0, + NULL, HFILL} + }, {&hf_gtp_ie_len, - {"Length", "gtp.ie_len", - FT_UINT16, BASE_DEC, NULL, 0x0, - NULL, HFILL} - }, + { "Length", "gtp.ie_len", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL} + }, {&hf_gtp_response_in, - {"Response In", "gtp.response_in", FT_FRAMENUM, BASE_NONE, NULL, 0x0, "The response to this GTP request is in this frame", HFILL}}, + { "Response In", "gtp.response_in", + FT_FRAMENUM, BASE_NONE, NULL, 0x0, + "The response to this GTP request is in this frame", HFILL} + }, {&hf_gtp_response_to, - {"Response To", "gtp.response_to", FT_FRAMENUM, BASE_NONE, NULL, 0x0, "This is a response to the GTP request in this frame", HFILL}}, - {&hf_gtp_time, {"Time", "gtp.time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, "The time between the Request and the Response", HFILL}}, - {&hf_gtp_apn, {"APN", "gtp.apn", FT_STRING, BASE_NONE, NULL, 0, "Access Point Name", HFILL}}, - {&hf_gtp_cause, {"Cause", "gtp.cause", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &cause_type_ext, 0, "Cause of operation", HFILL}}, - {&hf_gtp_chrg_char, {"Charging characteristics", "gtp.chrg_char", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL}}, - {&hf_gtp_chrg_char_s, {"Spare", "gtp.chrg_char_s", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_S, NULL, HFILL}}, - {&hf_gtp_chrg_char_n, {"Normal charging", "gtp.chrg_char_n", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_N, NULL, HFILL}}, - {&hf_gtp_chrg_char_p, {"Prepaid charging", "gtp.chrg_char_p", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_P, NULL, HFILL}}, + { "Response To", "gtp.response_to", + FT_FRAMENUM, BASE_NONE, NULL, 0x0, + "This is a response to the GTP request in this frame", HFILL} + }, + {&hf_gtp_time, + { "Time", "gtp.time", + FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, + "The time between the Request and the Response", HFILL} + }, + {&hf_gtp_apn, + { "APN", "gtp.apn", + FT_STRING, BASE_NONE, NULL, 0, + "Access Point Name", HFILL} + }, + {&hf_gtp_cause, + { "Cause", "gtp.cause", + FT_UINT8, BASE_DEC|BASE_EXT_STRING, &cause_type_ext, 0, + "Cause of operation", HFILL} + }, + {&hf_gtp_chrg_char, + { "Charging characteristics", "gtp.chrg_char", + FT_UINT16, BASE_DEC, NULL, 0, + NULL, HFILL} + }, + {&hf_gtp_chrg_char_s, + { "Spare", "gtp.chrg_char_s", + FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_S, + NULL, HFILL} + }, + {&hf_gtp_chrg_char_n, + { "Normal charging", "gtp.chrg_char_n", + FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_N, + NULL, HFILL} + }, + {&hf_gtp_chrg_char_p, + { "Prepaid charging", "gtp.chrg_char_p", + FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_P, + NULL, HFILL} + }, {&hf_gtp_chrg_char_f, - {"Flat rate charging", "gtp.chrg_char_f", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_F, NULL, HFILL}}, + { "Flat rate charging", "gtp.chrg_char_f", + FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_F, + NULL, HFILL} + }, {&hf_gtp_chrg_char_h, - {"Hot billing charging", "gtp.chrg_char_h", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_H, NULL, HFILL}}, - {&hf_gtp_chrg_char_r, {"Reserved", "gtp.chrg_char_r", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_R, NULL, HFILL}}, - {&hf_gtp_chrg_id, {"Charging ID", "gtp.chrg_id", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL}}, - {&hf_gtp_chrg_ipv4, {"CG address IPv4", "gtp.chrg_ipv4", FT_IPv4, BASE_NONE, NULL, 0, "Charging Gateway address IPv4", HFILL}}, - {&hf_gtp_chrg_ipv6, {"CG address IPv6", "gtp.chrg_ipv6", FT_IPv6, BASE_NONE, NULL, 0, "Charging Gateway address IPv6", HFILL}}, - {&hf_gtp_ext_flow_label, {"Flow Label Data I", "gtp.ext_flow_label", FT_UINT16, BASE_HEX, NULL, 0, "Flow label data", HFILL}}, - {&hf_gtp_ext_id, {"Extension identifier", "gtp.ext_id", FT_UINT16, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0, NULL, HFILL}}, - {&hf_gtp_ext_val, {"Extension value", "gtp.ext_val", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL}}, - {&hf_gtp_flags, {"Flags", "gtp.flags", FT_UINT8, BASE_HEX, NULL, 0, "Ver/PT/Spare...", HFILL}}, - {&hf_gtp_ext_hdr, {"Extension header", "gtp.ext_hdr", FT_UINT8, BASE_HEX, VALS(next_extension_header_fieldvals), 0, NULL, HFILL}}, - {&hf_gtp_ext_hdr_next, {"Next extension header", "gtp.ext_hdr.next", FT_UINT8, BASE_HEX, VALS(next_extension_header_fieldvals), 0, NULL, HFILL}}, - {&hf_gtp_ext_hdr_pdcpsn, {"PDCP Sequence Number", "gtp.ext_hdr.pdcp_sn", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL}}, - {&hf_gtp_ext_hdr_length, {"Extension Header Length", "gtp.ext_hdr.length", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL}}, + { "Hot billing charging", "gtp.chrg_char_h", + FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_H, + NULL, HFILL} + }, + {&hf_gtp_chrg_char_r, + { "Reserved", "gtp.chrg_char_r", + FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_R, + NULL, HFILL} + }, + {&hf_gtp_chrg_id, + { "Charging ID", "gtp.chrg_id", + FT_UINT32, BASE_HEX, NULL, 0, + NULL, HFILL} + }, + {&hf_gtp_chrg_ipv4, + { "CG address IPv4", "gtp.chrg_ipv4", + FT_IPv4, BASE_NONE, NULL, 0, + "Charging Gateway address IPv4", HFILL} + }, + {&hf_gtp_chrg_ipv6, + { "CG address IPv6", "gtp.chrg_ipv6", + FT_IPv6, BASE_NONE, NULL, 0, + "Charging Gateway address IPv6", HFILL} + }, + {&hf_gtp_ext_flow_label, + { "Flow Label Data I", "gtp.ext_flow_label", + FT_UINT16, BASE_HEX, NULL, 0, + "Flow label data", HFILL} + }, + {&hf_gtp_ext_id, + { "Extension identifier", "gtp.ext_id", + FT_UINT16, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0, + NULL, HFILL} + }, + {&hf_gtp_ext_val, + { "Extension value", "gtp.ext_val", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL} + }, + {&hf_gtp_flags, + { "Flags", "gtp.flags", + FT_UINT8, BASE_HEX, NULL, 0, + "Ver/PT/Spare...", HFILL} + }, + {&hf_gtp_ext_hdr, + { "Extension header", "gtp.ext_hdr", + FT_UINT8, BASE_HEX, VALS(next_extension_header_fieldvals), 0, + NULL, HFILL} + }, + {&hf_gtp_ext_hdr_next, + { "Next extension header", "gtp.ext_hdr.next", + FT_UINT8, BASE_HEX, VALS(next_extension_header_fieldvals), 0, + NULL, HFILL} + }, + {&hf_gtp_ext_hdr_pdcpsn, + { "PDCP Sequence Number", "gtp.ext_hdr.pdcp_sn", + FT_UINT16, BASE_DEC, NULL, 0, + NULL, HFILL} + }, + {&hf_gtp_ext_hdr_length, + { "Extension Header Length", "gtp.ext_hdr.length", + FT_UINT8, BASE_DEC, NULL, 0, + NULL, HFILL} + }, {&hf_gtp_flags_ver, - {"Version", "gtp.flags.version", - FT_UINT8, BASE_DEC, VALS(ver_types), GTP_VER_MASK, - "GTP Version", HFILL} + { "Version", "gtp.flags.version", + FT_UINT8, BASE_DEC, VALS(ver_types), GTP_VER_MASK, + "GTP Version", HFILL} }, {&hf_gtp_prime_flags_ver, - {"Version", "gtp.prim.flags.version", - FT_UINT8, BASE_DEC,NULL, GTP_VER_MASK, - "GTP' Version", HFILL} + { "Version", "gtp.prim.flags.version", + FT_UINT8, BASE_DEC,NULL, GTP_VER_MASK, + "GTP' Version", HFILL} }, {&hf_gtp_flags_pt, - {"Protocol type", "gtp.flags.payload", - FT_UINT8, BASE_DEC, VALS(pt_types), GTP_PT_MASK, - NULL, HFILL} + { "Protocol type", "gtp.flags.payload", + FT_UINT8, BASE_DEC, VALS(pt_types), GTP_PT_MASK, + NULL, HFILL} }, {&hf_gtp_flags_spare1, - {"Reserved", "gtp.flags.reserved", - FT_UINT8, BASE_DEC, NULL, GTP_SPARE1_MASK, - "Reserved (shall be sent as '111' )", HFILL} + { "Reserved", "gtp.flags.reserved", + FT_UINT8, BASE_DEC, NULL, GTP_SPARE1_MASK, + "Reserved (shall be sent as '111' )", HFILL} }, {&hf_gtp_flags_hdr_length, - {"Header length", "gtp.flags._hdr_length", - FT_BOOLEAN, 8, TFS(>p_hdr_length_vals), 0x01, - NULL, HFILL}}, + { "Header length", "gtp.flags._hdr_length", + FT_BOOLEAN, 8, TFS(>p_hdr_length_vals), 0x01, + NULL, HFILL} + }, {&hf_gtp_flags_snn, - {"Is SNDCP N-PDU included?", "gtp.flags.snn", FT_BOOLEAN, 8, TFS(&tfs_yes_no), GTP_SNN_MASK, - "Is SNDCP N-PDU LLC Number included? (1 = yes, 0 = no)", HFILL}}, + { "Is SNDCP N-PDU included?", "gtp.flags.snn", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), GTP_SNN_MASK, + "Is SNDCP N-PDU LLC Number included? (1 = yes, 0 = no)", HFILL} + }, {&hf_gtp_flags_spare2, - {"Reserved", "gtp.flags.reserved", FT_UINT8, BASE_DEC, NULL, GTP_SPARE2_MASK, "Reserved (shall be sent as '1' )", HFILL}}, + { "Reserved", "gtp.flags.reserved", + FT_UINT8, BASE_DEC, NULL, GTP_SPARE2_MASK, + "Reserved (shall be sent as '1' )", HFILL} + }, {&hf_gtp_flags_e, - {"Is Next Extension Header present?", "gtp.flags.e", FT_BOOLEAN, 8, TFS(&tfs_yes_no), GTP_E_MASK, - "Is Next Extension Header present? (1 = yes, 0 = no)", HFILL}}, + { "Is Next Extension Header present?", "gtp.flags.e", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), GTP_E_MASK, + "Is Next Extension Header present? (1 = yes, 0 = no)", HFILL} + }, {&hf_gtp_flags_s, - {"Is Sequence Number present?", "gtp.flags.s", FT_BOOLEAN, 8, TFS(&tfs_yes_no), GTP_S_MASK, "Is Sequence Number present? (1 = yes, 0 = no)", - HFILL}}, + { "Is Sequence Number present?", "gtp.flags.s", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), GTP_S_MASK, + "Is Sequence Number present? (1 = yes, 0 = no)", HFILL} + }, {&hf_gtp_flags_pn, - {"Is N-PDU number present?", "gtp.flags.pn", FT_BOOLEAN, 8, TFS(&tfs_yes_no), GTP_PN_MASK, "Is N-PDU number present? (1 = yes, 0 = no)", - HFILL}}, - {&hf_gtp_flow_ii, {"Flow Label Data II", "gtp.flow_ii", FT_UINT16, BASE_DEC, NULL, 0, "Downlink flow label data", HFILL}}, - {&hf_gtp_flow_label, {"Flow label", "gtp.flow_label", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL}}, - {&hf_gtp_flow_sig, {"Flow label Signalling", "gtp.flow_sig", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL}}, + { "Is N-PDU number present?", "gtp.flags.pn", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), GTP_PN_MASK, + "Is N-PDU number present? (1 = yes, 0 = no)", HFILL} + }, + {&hf_gtp_flow_ii, + { "Flow Label Data II", "gtp.flow_ii", + FT_UINT16, BASE_DEC, NULL, 0, + "Downlink flow label data", HFILL} + }, + {&hf_gtp_flow_label, + { "Flow label", "gtp.flow_label", + FT_UINT16, BASE_HEX, NULL, 0, + NULL, HFILL} + }, + {&hf_gtp_flow_sig, + { "Flow label Signalling", "gtp.flow_sig", + FT_UINT16, BASE_HEX, NULL, 0, + NULL, HFILL} + }, {&hf_gtp_gsn_addr_len, - {"GSN Address Length", "gtp.gsn_addr_len", FT_UINT8, BASE_DEC, NULL, GTP_EXT_GSN_ADDR_LEN_MASK, NULL, HFILL}}, + { "GSN Address Length", "gtp.gsn_addr_len", + FT_UINT8, BASE_DEC, NULL, GTP_EXT_GSN_ADDR_LEN_MASK, + NULL, HFILL} + }, {&hf_gtp_gsn_addr_type, - {"GSN Address Type", "gtp.gsn_addr_type", FT_UINT8, BASE_DEC, VALS(gsn_addr_type), GTP_EXT_GSN_ADDR_TYPE_MASK, NULL, HFILL}}, - {&hf_gtp_gsn_ipv4, {"GSN address IPv4", "gtp.gsn_ipv4", FT_IPv4, BASE_NONE, NULL, 0, NULL, HFILL}}, - {&hf_gtp_gsn_ipv6, {"GSN address IPv6", "gtp.gsn_ipv6", FT_IPv6, BASE_NONE, NULL, 0, NULL, HFILL}}, - {&hf_gtp_imsi, {"IMSI", "gtp.imsi", FT_STRING, BASE_NONE, NULL, 0, "International Mobile Subscriber Identity number", HFILL}}, - {&hf_gtp_length, {"Length", "gtp.length", FT_UINT16, BASE_DEC, NULL, 0, "Length (i.e. number of octets after TID or TEID)", HFILL}}, - {&hf_gtp_map_cause, {"MAP cause", "gtp.map_cause", FT_UINT8, BASE_DEC, VALS(gsm_old_GSMMAPLocalErrorcode_vals), 0, NULL, HFILL}}, - {&hf_gtp_message_type, {"Message Type", "gtp.message", FT_UINT8, BASE_HEX|BASE_EXT_STRING, >p_message_type_ext, 0x0, "GTP Message Type", HFILL}}, + { "GSN Address Type", "gtp.gsn_addr_type", + FT_UINT8, BASE_DEC, VALS(gsn_addr_type), GTP_EXT_GSN_ADDR_TYPE_MASK, + NULL, HFILL} + }, + {&hf_gtp_gsn_ipv4, + { "GSN address IPv4", "gtp.gsn_ipv4", + FT_IPv4, BASE_NONE, NULL, 0, + NULL, HFILL} + }, + {&hf_gtp_gsn_ipv6, + { "GSN address IPv6", "gtp.gsn_ipv6", + FT_IPv6, BASE_NONE, NULL, 0, + NULL, HFILL} + }, + {&hf_gtp_imsi, + { "IMSI", "gtp.imsi", + FT_STRING, BASE_NONE, NULL, 0, + "International Mobile Subscriber Identity number", HFILL} + }, + {&hf_gtp_length, + { "Length", "gtp.length", + FT_UINT16, BASE_DEC, NULL, 0, + "Length (i.e. number of octets after TID or TEID)", HFILL} + }, + {&hf_gtp_map_cause, + { "MAP cause", "gtp.map_cause", + FT_UINT8, BASE_DEC, VALS(gsm_old_GSMMAPLocalErrorcode_vals), 0, + NULL, HFILL} + }, + {&hf_gtp_message_type, + { "Message Type", "gtp.message", + FT_UINT8, BASE_HEX|BASE_EXT_STRING, >p_message_type_ext, 0x0, + "GTP Message Type", HFILL} + }, {&hf_gtp_ms_reason, - {"MS not reachable reason", "gtp.ms_reason", FT_UINT8, BASE_DEC, VALS(ms_not_reachable_type), 0, NULL, HFILL}}, - {&hf_gtp_ms_valid, {"MS validated", "gtp.ms_valid", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, + { "MS not reachable reason", "gtp.ms_reason", + FT_UINT8, BASE_DEC, VALS(ms_not_reachable_type), 0, + NULL, HFILL} + }, + {&hf_gtp_ms_valid, + { "MS validated", "gtp.ms_valid", + FT_BOOLEAN, BASE_NONE, NULL, 0x0, + NULL, HFILL} + }, {&hf_gtp_next, - {"Next extension header type", "gtp.next", FT_UINT8, BASE_HEX, VALS(next_extension_header_fieldvals), 0, NULL, - HFILL}}, - {&hf_gtp_node_ipv4, {"Node address IPv4", "gtp.node_ipv4", FT_IPv4, BASE_NONE, NULL, 0, "Recommended node address IPv4", HFILL}}, - {&hf_gtp_node_ipv6, {"Node address IPv6", "gtp.node_ipv6", FT_IPv6, BASE_NONE, NULL, 0, "Recommended node address IPv6", HFILL}}, - {&hf_gtp_npdu_number, {"N-PDU Number", "gtp.npdu_number", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL}}, - {&hf_gtp_nsapi, - {"NSAPI", "gtp.nsapi", - FT_UINT8, BASE_DEC, NULL, 0x0f, - "Network layer Service Access Point Identifier", HFILL} + { "Next extension header type", "gtp.next", + FT_UINT8, BASE_HEX, VALS(next_extension_header_fieldvals), 0, + NULL, + HFILL} + }, + {&hf_gtp_node_ipv4, + { "Node address IPv4", "gtp.node_ipv4", + FT_IPv4, BASE_NONE, NULL, 0, + "Recommended node address IPv4", HFILL} + }, + {&hf_gtp_node_ipv6, + { "Node address IPv6", "gtp.node_ipv6", + FT_IPv6, BASE_NONE, NULL, 0, + "Recommended node address IPv6", HFILL} + }, + {&hf_gtp_npdu_number, + { "N-PDU Number", "gtp.npdu_number", + FT_UINT8, BASE_HEX, NULL, 0, + NULL, HFILL} + }, + {&hf_gtp_nsapi, + { "NSAPI", "gtp.nsapi", + FT_UINT8, BASE_DEC, NULL, 0x0f, + "Network layer Service Access Point Identifier", HFILL} + }, + {&hf_gtp_qos_version, + { "Version", "gtp.qos_version", + FT_STRING, BASE_NONE, NULL, 0, + "Version of the QoS Profile", HFILL} + }, + {&hf_gtp_qos_spare1, + { "Spare", "gtp.qos_spare1", + FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE1_MASK, + "Spare (shall be sent as '00' )", HFILL} }, - {&hf_gtp_qos_version, {"Version", "gtp.qos_version", FT_STRING, BASE_NONE, NULL, 0, "Version of the QoS Profile", HFILL}}, - {&hf_gtp_qos_spare1, {"Spare", "gtp.qos_spare1", FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE1_MASK, "Spare (shall be sent as '00' )", HFILL}}, {&hf_gtp_qos_delay, - {"QoS delay", "gtp.qos_delay", FT_UINT8, BASE_DEC, VALS(qos_delay_type), GTP_EXT_QOS_DELAY_MASK, "Quality of Service Delay Class", HFILL}}, - {&hf_gtp_qos_reliability, - {"QoS reliability", "gtp.qos_reliability", FT_UINT8, BASE_DEC, VALS(qos_reliability_type), GTP_EXT_QOS_RELIABILITY_MASK, - "Quality of Service Reliability Class", HFILL}}, - {&hf_gtp_qos_peak, - {"QoS peak", "gtp.qos_peak", FT_UINT8, BASE_DEC, VALS(qos_peak_type), GTP_EXT_QOS_PEAK_MASK, "Quality of Service Peak Throughput", HFILL}}, - {&hf_gtp_qos_spare2, {"Spare", "gtp.qos_spare2", FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE2_MASK, "Spare (shall be sent as 0)", HFILL}}, - {&hf_gtp_qos_precedence, - {"QoS precedence", "gtp.qos_precedence", FT_UINT8, BASE_DEC, VALS(qos_precedence_type), GTP_EXT_QOS_PRECEDENCE_MASK, - "Quality of Service Precedence Class", HFILL}}, - {&hf_gtp_qos_spare3, - {"Spare", "gtp.qos_spare3", FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE3_MASK, "Spare (shall be sent as '000' )", HFILL}}, - {&hf_gtp_qos_mean, - {"QoS mean", "gtp.qos_mean", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &qos_mean_type_ext, GTP_EXT_QOS_MEAN_MASK, "Quality of Service Mean Throughput", HFILL}}, - {&hf_gtp_qos_al_ret_priority, - {"Allocation/Retention priority", "gtp.qos_al_ret_priority", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL}}, - {&hf_gtp_qos_traf_class, - {"Traffic class", "gtp.qos_traf_class", FT_UINT8, BASE_DEC, VALS(qos_traf_class), GTP_EXT_QOS_TRAF_CLASS_MASK, NULL, HFILL}}, - {&hf_gtp_qos_del_order, - {"Delivery order", "gtp.qos_del_order", FT_UINT8, BASE_DEC, VALS(qos_del_order), GTP_EXT_QOS_DEL_ORDER_MASK, NULL, HFILL}}, - {&hf_gtp_qos_del_err_sdu, - {"Delivery of erroneous SDU", "gtp.qos_del_err_sdu", FT_UINT8, BASE_DEC, VALS(qos_del_err_sdu), GTP_EXT_QOS_DEL_ERR_SDU_MASK, - NULL, HFILL}}, - {&hf_gtp_qos_max_sdu_size, - {"Maximum SDU size", "gtp.qos_max_sdu_size", FT_UINT8, BASE_DEC, VALS(qos_max_sdu_size), 0, NULL, HFILL}}, - {&hf_gtp_qos_max_ul, - {"Maximum bit rate for uplink", "gtp.qos_max_ul", FT_UINT8, BASE_DEC, VALS(qos_max_ul), 0, NULL, HFILL}}, - {&hf_gtp_qos_max_dl, - {"Maximum bit rate for downlink", "gtp.qos_max_dl", FT_UINT8, BASE_DEC, VALS(qos_max_dl), 0, NULL, HFILL}}, - {&hf_gtp_qos_res_ber, - {"Residual BER", "gtp.qos_res_ber", FT_UINT8, BASE_DEC, VALS(qos_res_ber), GTP_EXT_QOS_RES_BER_MASK, "Residual Bit Error Rate", HFILL}}, - {&hf_gtp_qos_sdu_err_ratio, - {"SDU Error ratio", "gtp.qos_sdu_err_ratio", FT_UINT8, BASE_DEC, VALS(qos_sdu_err_ratio), GTP_EXT_QOS_SDU_ERR_RATIO_MASK, NULL, - HFILL}}, - {&hf_gtp_qos_trans_delay, - {"Transfer delay", "gtp.qos_trans_delay", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &qos_trans_delay_ext, GTP_EXT_QOS_TRANS_DELAY_MASK, NULL, HFILL}}, - {&hf_gtp_qos_traf_handl_prio, - {"Traffic handling priority", "gtp.qos_traf_handl_prio", FT_UINT8, BASE_DEC, VALS(qos_traf_handl_prio), GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK, - NULL, HFILL}}, - {&hf_gtp_qos_guar_ul, - {"Guaranteed bit rate for uplink", "gtp.qos_guar_ul", FT_UINT8, BASE_DEC, VALS(qos_guar_ul), 0, NULL, HFILL}}, - {&hf_gtp_qos_guar_dl, - {"Guaranteed bit rate for downlink", "gtp.qos_guar_dl", FT_UINT8, BASE_DEC, VALS(qos_guar_dl), 0, NULL, - HFILL}}, - {&hf_gtp_qos_src_stat_desc, - {"Source Statistics Descriptor", "gtp.src_stat_desc", FT_UINT8, BASE_DEC, VALS(src_stat_desc_vals), GTP_EXT_QOS_SRC_STAT_DESC_MASK, NULL, HFILL}}, - {&hf_gtp_qos_sig_ind, - {"Signalling Indication", "gtp.sig_ind", FT_BOOLEAN, 8, TFS(>p_sig_ind), GTP_EXT_QOS_SIG_IND_MASK, NULL, HFILL}}, - {&hf_gtp_pkt_flow_id, {"Packet Flow ID", "gtp.pkt_flow_id", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL}}, - {&hf_gtp_ptmsi, {"P-TMSI", "gtp.ptmsi", FT_UINT32, BASE_HEX, NULL, 0, "Packet-Temporary Mobile Subscriber Identity", HFILL}}, - {&hf_gtp_ptmsi_sig, {"P-TMSI Signature", "gtp.ptmsi_sig", FT_UINT24, BASE_HEX, NULL, 0, NULL, HFILL}}, - {&hf_gtp_rab_gtpu_dn, {"Downlink GTP-U seq number", "gtp.rab_gtp_dn", FT_UINT16, BASE_DEC, NULL, 0, "Downlink GTP-U sequence number", HFILL}}, - {&hf_gtp_rab_gtpu_up, {"Uplink GTP-U seq number", "gtp.rab_gtp_up", FT_UINT16, BASE_DEC, NULL, 0, "Uplink GTP-U sequence number", HFILL}}, - {&hf_gtp_rab_pdu_dn, - {"Downlink next PDCP-PDU seq number", "gtp.rab_pdu_dn", FT_UINT16, BASE_DEC, NULL, 0, "Downlink next PDCP-PDU sequence number", HFILL}}, - {&hf_gtp_rab_pdu_up, - {"Uplink next PDCP-PDU seq number", "gtp.rab_pdu_up", FT_UINT16, BASE_DEC, NULL, 0, "Uplink next PDCP-PDU sequence number", HFILL}}, - {&hf_gtp_rai_rac, {"RAC", "gtp.rac", FT_UINT8, BASE_DEC, NULL, 0, "Routing Area Code", HFILL}}, - {&hf_gtp_rai_lac, {"LAC", "gtp.lac", FT_UINT16, BASE_DEC, NULL, 0, "Location Area Code", HFILL}}, - {&hf_gtp_ranap_cause, {"RANAP cause", "gtp.ranap_cause", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &ranap_cause_type_ext, 0, NULL, HFILL}}, - {&hf_gtp_recovery, {"Recovery", "gtp.recovery", FT_UINT8, BASE_DEC, NULL, 0, "Restart counter", HFILL}}, - {&hf_gtp_reorder, {"Reordering required", "gtp.reorder", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, - {&hf_gtp_rnc_ipv4, {"RNC address IPv4", "gtp.rnc_ipv4", FT_IPv4, BASE_NONE, NULL, 0, "Radio Network Controller address IPv4", HFILL}}, - {&hf_gtp_rnc_ipv6, {"RNC address IPv6", "gtp.rnc_ipv6", FT_IPv6, BASE_NONE, NULL, 0, "Radio Network Controller address IPv6", HFILL}}, - {&hf_gtp_rp, {"Radio Priority", "gtp.rp", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_MASK, "Radio Priority for uplink tx", HFILL}}, - {&hf_gtp_rp_nsapi, - {"NSAPI in Radio Priority", "gtp.rp_nsapi", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_NSAPI_MASK, - "Network layer Service Access Point Identifier in Radio Priority", HFILL}}, - {&hf_gtp_rp_sms, {"Radio Priority SMS", "gtp.rp_sms", FT_UINT8, BASE_DEC, NULL, 0, "Radio Priority for MO SMS", HFILL}}, - {&hf_gtp_rp_spare, {"Reserved", "gtp.rp_spare", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_SPARE_MASK, "Spare bit", HFILL}}, - {&hf_gtp_sel_mode, - {"Selection mode", "gtp.sel_mode", - FT_UINT8, BASE_DEC, VALS(sel_mode_type), 0x03, - NULL, HFILL} + { "QoS delay", "gtp.qos_delay", + FT_UINT8, BASE_DEC, VALS(qos_delay_type), GTP_EXT_QOS_DELAY_MASK, + "Quality of Service Delay Class", HFILL} + }, + {&hf_gtp_qos_reliability, + { "QoS reliability", "gtp.qos_reliability", + FT_UINT8, BASE_DEC, VALS(qos_reliability_type), GTP_EXT_QOS_RELIABILITY_MASK, + "Quality of Service Reliability Class", HFILL} + }, + {&hf_gtp_qos_peak, + { "QoS peak", "gtp.qos_peak", + FT_UINT8, BASE_DEC, VALS(qos_peak_type), GTP_EXT_QOS_PEAK_MASK, + "Quality of Service Peak Throughput", HFILL} + }, + {&hf_gtp_qos_spare2, + { "Spare", "gtp.qos_spare2", + FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE2_MASK, + "Spare (shall be sent as 0)", HFILL} + }, + {&hf_gtp_qos_precedence, + { "QoS precedence", "gtp.qos_precedence", + FT_UINT8, BASE_DEC, VALS(qos_precedence_type), GTP_EXT_QOS_PRECEDENCE_MASK, + "Quality of Service Precedence Class", HFILL} + }, + {&hf_gtp_qos_spare3, + { "Spare", "gtp.qos_spare3", + FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE3_MASK, + "Spare (shall be sent as '000' )", HFILL} + }, + {&hf_gtp_qos_mean, + { "QoS mean", "gtp.qos_mean", + FT_UINT8, BASE_DEC|BASE_EXT_STRING, &qos_mean_type_ext, GTP_EXT_QOS_MEAN_MASK, + "Quality of Service Mean Throughput", HFILL} + }, + {&hf_gtp_qos_al_ret_priority, + { "Allocation/Retention priority", "gtp.qos_al_ret_priority", + FT_UINT8, BASE_DEC, NULL, 0, + NULL, HFILL} + }, + {&hf_gtp_qos_traf_class, + { "Traffic class", "gtp.qos_traf_class", + FT_UINT8, BASE_DEC, VALS(qos_traf_class), GTP_EXT_QOS_TRAF_CLASS_MASK, + NULL, HFILL} + }, + {&hf_gtp_qos_del_order, + { "Delivery order", "gtp.qos_del_order", + FT_UINT8, BASE_DEC, VALS(qos_del_order), GTP_EXT_QOS_DEL_ORDER_MASK, + NULL, HFILL} + }, + {&hf_gtp_qos_del_err_sdu, + { "Delivery of erroneous SDU", "gtp.qos_del_err_sdu", + FT_UINT8, BASE_DEC, VALS(qos_del_err_sdu), GTP_EXT_QOS_DEL_ERR_SDU_MASK, + NULL, HFILL} + }, + {&hf_gtp_qos_max_sdu_size, + { "Maximum SDU size", "gtp.qos_max_sdu_size", + FT_UINT8, BASE_DEC, VALS(qos_max_sdu_size), 0, + NULL, HFILL} + }, + {&hf_gtp_qos_max_ul, + { "Maximum bit rate for uplink", "gtp.qos_max_ul", + FT_UINT8, BASE_DEC, VALS(qos_max_ul), 0, + NULL, HFILL} + }, + {&hf_gtp_qos_max_dl, + { "Maximum bit rate for downlink", "gtp.qos_max_dl", + FT_UINT8, BASE_DEC, VALS(qos_max_dl), 0, + NULL, HFILL} + }, + {&hf_gtp_qos_res_ber, + { "Residual BER", "gtp.qos_res_ber", + FT_UINT8, BASE_DEC, VALS(qos_res_ber), GTP_EXT_QOS_RES_BER_MASK, + "Residual Bit Error Rate", HFILL} + }, + {&hf_gtp_qos_sdu_err_ratio, + { "SDU Error ratio", "gtp.qos_sdu_err_ratio", + FT_UINT8, BASE_DEC, VALS(qos_sdu_err_ratio), GTP_EXT_QOS_SDU_ERR_RATIO_MASK, + NULL, + HFILL} + }, + {&hf_gtp_qos_trans_delay, + { "Transfer delay", "gtp.qos_trans_delay", + FT_UINT8, BASE_DEC|BASE_EXT_STRING, &qos_trans_delay_ext, GTP_EXT_QOS_TRANS_DELAY_MASK, + NULL, HFILL} + }, + {&hf_gtp_qos_traf_handl_prio, + { "Traffic handling priority", "gtp.qos_traf_handl_prio", + FT_UINT8, BASE_DEC, VALS(qos_traf_handl_prio), GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK, + NULL, HFILL} + }, + {&hf_gtp_qos_guar_ul, + { "Guaranteed bit rate for uplink", "gtp.qos_guar_ul", + FT_UINT8, BASE_DEC, VALS(qos_guar_ul), 0, + NULL, HFILL} + }, + {&hf_gtp_qos_guar_dl, + { "Guaranteed bit rate for downlink", "gtp.qos_guar_dl", + FT_UINT8, BASE_DEC, VALS(qos_guar_dl), 0, + NULL, HFILL} + }, + {&hf_gtp_qos_src_stat_desc, + { "Source Statistics Descriptor", "gtp.src_stat_desc", + FT_UINT8, BASE_DEC, VALS(src_stat_desc_vals), GTP_EXT_QOS_SRC_STAT_DESC_MASK, + NULL, HFILL} + }, + {&hf_gtp_qos_sig_ind, + { "Signalling Indication", "gtp.sig_ind", + FT_BOOLEAN, 8, TFS(>p_sig_ind), GTP_EXT_QOS_SIG_IND_MASK, + NULL, HFILL} + }, + {&hf_gtp_pkt_flow_id, + { "Packet Flow ID", "gtp.pkt_flow_id", + FT_UINT8, BASE_DEC, NULL, 0, + NULL, HFILL} + }, + {&hf_gtp_ptmsi, + { "P-TMSI", "gtp.ptmsi", + FT_UINT32, BASE_HEX, NULL, 0, + "Packet-Temporary Mobile Subscriber Identity", HFILL} + }, + {&hf_gtp_ptmsi_sig, + { "P-TMSI Signature", "gtp.ptmsi_sig", + FT_UINT24, BASE_HEX, NULL, 0, + NULL, HFILL} + }, + {&hf_gtp_rab_gtpu_dn, + { "Downlink GTP-U seq number", "gtp.rab_gtp_dn", + FT_UINT16, BASE_DEC, NULL, 0, + "Downlink GTP-U sequence number", HFILL} + }, + {&hf_gtp_rab_gtpu_up, + { "Uplink GTP-U seq number", "gtp.rab_gtp_up", + FT_UINT16, BASE_DEC, NULL, 0, + "Uplink GTP-U sequence number", HFILL} + }, + {&hf_gtp_rab_pdu_dn, + { "Downlink next PDCP-PDU seq number", "gtp.rab_pdu_dn", + FT_UINT16, BASE_DEC, NULL, 0, + "Downlink next PDCP-PDU sequence number", HFILL} + }, + {&hf_gtp_rab_pdu_up, + { "Uplink next PDCP-PDU seq number", "gtp.rab_pdu_up", + FT_UINT16, BASE_DEC, NULL, 0, + "Uplink next PDCP-PDU sequence number", HFILL} + }, + {&hf_gtp_rai_rac, + { "RAC", "gtp.rac", + FT_UINT8, BASE_DEC, NULL, 0, + "Routing Area Code", HFILL} + }, + {&hf_gtp_rai_lac, + { "LAC", "gtp.lac", + FT_UINT16, BASE_DEC, NULL, 0, + "Location Area Code", HFILL} + }, + {&hf_gtp_ranap_cause, + { "RANAP cause", "gtp.ranap_cause", + FT_UINT8, BASE_DEC|BASE_EXT_STRING, &ranap_cause_type_ext, 0, + NULL, HFILL} + }, + {&hf_gtp_recovery, + { "Recovery", "gtp.recovery", + FT_UINT8, BASE_DEC, NULL, 0, + "Restart counter", HFILL} + }, + {&hf_gtp_reorder, + { "Reordering required", "gtp.reorder", + FT_BOOLEAN, BASE_NONE, NULL, 0x0, + NULL, HFILL} + }, + {&hf_gtp_rnc_ipv4, + { "RNC address IPv4", "gtp.rnc_ipv4", + FT_IPv4, BASE_NONE, NULL, 0, + "Radio Network Controller address IPv4", HFILL} + }, + {&hf_gtp_rnc_ipv6, + { "RNC address IPv6", "gtp.rnc_ipv6", + FT_IPv6, BASE_NONE, NULL, 0, + "Radio Network Controller address IPv6", HFILL} + }, + {&hf_gtp_rp, + { "Radio Priority", "gtp.rp", + FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_MASK, + "Radio Priority for uplink tx", HFILL} + }, + {&hf_gtp_rp_nsapi, + { "NSAPI in Radio Priority", "gtp.rp_nsapi", + FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_NSAPI_MASK, + "Network layer Service Access Point Identifier in Radio Priority", HFILL} + }, + {&hf_gtp_rp_sms, + { "Radio Priority SMS", "gtp.rp_sms", + FT_UINT8, BASE_DEC, NULL, 0, + "Radio Priority for MO SMS", HFILL} + }, + {&hf_gtp_rp_spare, + { "Reserved", "gtp.rp_spare", + FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_SPARE_MASK, + "Spare bit", HFILL} + }, + {&hf_gtp_sel_mode, + { "Selection mode", "gtp.sel_mode", + FT_UINT8, BASE_DEC, VALS(sel_mode_type), 0x03, + NULL, HFILL} + }, + {&hf_gtp_seq_number, + { "Sequence number", "gtp.seq_number", + FT_UINT16, BASE_HEX, NULL, 0, + NULL, HFILL} + }, + {&hf_gtp_sndcp_number, + { "SNDCP N-PDU LLC Number", "gtp.sndcp_number", + FT_UINT8, BASE_HEX, NULL, 0, + NULL, HFILL} + }, + {&hf_gtp_tear_ind, + { "Teardown Indicator", "gtp.tear_ind", + FT_BOOLEAN, BASE_NONE, NULL, 0x0, + NULL, HFILL} + }, + {&hf_gtp_teid, + { "TEID", "gtp.teid", + FT_UINT32, BASE_HEX, NULL, 0, + "Tunnel Endpoint Identifier", HFILL} + }, + {&hf_gtp_teid_cp, + { "TEID Control Plane", "gtp.teid_cp", + FT_UINT32, BASE_HEX, NULL, 0, + "Tunnel Endpoint Identifier Control Plane", HFILL} }, - {&hf_gtp_seq_number, {"Sequence number", "gtp.seq_number", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL}}, - {&hf_gtp_sndcp_number, {"SNDCP N-PDU LLC Number", "gtp.sndcp_number", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL}}, - {&hf_gtp_tear_ind, {"Teardown Indicator", "gtp.tear_ind", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, - {&hf_gtp_teid, {"TEID", "gtp.teid", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier", HFILL}}, - {&hf_gtp_teid_cp, {"TEID Control Plane", "gtp.teid_cp", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Control Plane", HFILL}}, {&hf_gtp_ulink_teid_cp, - {"Uplink TEID Control Plane", "gtp.ulink_teid_cp", FT_UINT32, BASE_HEX, NULL, 0, "Uplink Tunnel Endpoint Identifier Control Plane", HFILL}}, - {&hf_gtp_teid_data, {"TEID Data I", "gtp.teid_data", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Data I", HFILL}}, + { "Uplink TEID Control Plane", "gtp.ulink_teid_cp", + FT_UINT32, BASE_HEX, NULL, 0, + "Uplink Tunnel Endpoint Identifier Control Plane", HFILL} + }, + {&hf_gtp_teid_data, + { "TEID Data I", "gtp.teid_data", + FT_UINT32, BASE_HEX, NULL, 0, + "Tunnel Endpoint Identifier Data I", HFILL} + }, {&hf_gtp_ulink_teid_data, - {"Uplink TEID Data I", "gtp.ulink_teid_data", FT_UINT32, BASE_HEX, NULL, 0, "UplinkTunnel Endpoint Identifier Data I", HFILL}}, - {&hf_gtp_teid_ii, {"TEID Data II", "gtp.teid_ii", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Data II", HFILL}}, + { "Uplink TEID Data I", "gtp.ulink_teid_data", + FT_UINT32, BASE_HEX, NULL, 0, + "UplinkTunnel Endpoint Identifier Data I", HFILL} + }, + {&hf_gtp_teid_ii, + { "TEID Data II", "gtp.teid_ii", + FT_UINT32, BASE_HEX, NULL, 0, + "Tunnel Endpoint Identifier Data II", HFILL} + }, {&hf_gtp_tft_code, - {"TFT operation code", "gtp.tft_code", FT_UINT8, BASE_DEC, VALS(tft_code_type), GTPv1_TFT_CODE_MASK, NULL, HFILL}}, - {&hf_gtp_tft_spare, {"TFT spare bit", "gtp.tft_spare", FT_UINT8, BASE_DEC, NULL, GTPv1_TFT_SPARE_MASK, NULL, HFILL}}, + { "TFT operation code", "gtp.tft_code", + FT_UINT8, BASE_DEC, VALS(tft_code_type), GTPv1_TFT_CODE_MASK, + NULL, HFILL} + }, + {&hf_gtp_tft_spare, + { "TFT spare bit", "gtp.tft_spare", + FT_UINT8, BASE_DEC, NULL, GTPv1_TFT_SPARE_MASK, + NULL, HFILL} + }, {&hf_gtp_tft_number, - {"Number of packet filters", "gtp.tft_number", FT_UINT8, BASE_DEC, NULL, GTPv1_TFT_NUMBER_MASK, NULL, HFILL}}, - {&hf_gtp_tft_eval, {"Evaluation precedence", "gtp.tft_eval", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL}}, - {&hf_gtp_tid, {"TID", "gtp.tid", FT_STRING, BASE_NONE, NULL, 0, "Tunnel Identifier", HFILL}}, - {&hf_gtp_tlli, {"TLLI", "gtp.tlli", FT_UINT32, BASE_HEX, NULL, 0, "Temporary Logical Link Identity", HFILL}}, - {&hf_gtp_tr_comm, {"Packet transfer command", "gtp.tr_comm", FT_UINT8, BASE_DEC, VALS(tr_comm_type), 0, NULL, HFILL}}, - {&hf_gtp_trace_ref, {"Trace reference", "gtp.trace_ref", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL}}, - {&hf_gtp_trace_type, {"Trace type", "gtp.trace_type", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL}}, - {&hf_gtp_unknown, {"Unknown data (length)", "gtp.unknown", FT_UINT16, BASE_DEC, NULL, 0, "Unknown data", HFILL}}, + { "Number of packet filters", "gtp.tft_number", + FT_UINT8, BASE_DEC, NULL, GTPv1_TFT_NUMBER_MASK, + NULL, HFILL} + }, + {&hf_gtp_tft_eval, + { "Evaluation precedence", "gtp.tft_eval", + FT_UINT8, BASE_DEC, NULL, 0, + NULL, HFILL} + }, + {&hf_gtp_tid, + { "TID", "gtp.tid", + FT_STRING, BASE_NONE, NULL, 0, + "Tunnel Identifier", HFILL} + }, + {&hf_gtp_tlli, + { "TLLI", "gtp.tlli", + FT_UINT32, BASE_HEX, NULL, 0, + "Temporary Logical Link Identity", HFILL} + }, + {&hf_gtp_tr_comm, + { "Packet transfer command", "gtp.tr_comm", + FT_UINT8, BASE_DEC, VALS(tr_comm_type), 0, + NULL, HFILL} + }, + {&hf_gtp_trace_ref, + { "Trace reference", "gtp.trace_ref", + FT_UINT16, BASE_HEX, NULL, 0, + NULL, HFILL} + }, + {&hf_gtp_trace_type, + { "Trace type", "gtp.trace_type", + FT_UINT16, BASE_HEX, NULL, 0, + NULL, HFILL} + }, + {&hf_gtp_unknown, + { "Unknown data (length)", "gtp.unknown", + FT_UINT16, BASE_DEC, NULL, 0, + "Unknown data", HFILL} + }, {&hf_gtp_user_addr_pdp_org, - {"PDP type organization", "gtp.user_addr_pdp_org", FT_UINT8, BASE_DEC, VALS(pdp_org_type), 0, NULL, HFILL}}, - {&hf_gtp_user_addr_pdp_type, {"PDP type number", "gtp.user_addr_pdp_type", FT_UINT8, BASE_HEX, VALS(pdp_type), 0, NULL, HFILL}}, - {&hf_gtp_user_ipv4, {"End user address IPv4", "gtp.user_ipv4", FT_IPv4, BASE_NONE, NULL, 0, NULL, HFILL}}, - {&hf_gtp_user_ipv6, {"End user address IPv6", "gtp.user_ipv6", FT_IPv6, BASE_NONE, NULL, 0, NULL, HFILL}}, + { "PDP type organization", "gtp.user_addr_pdp_org", + FT_UINT8, BASE_DEC, VALS(pdp_org_type), 0, + NULL, HFILL} + }, + {&hf_gtp_user_addr_pdp_type, + { "PDP type number", "gtp.user_addr_pdp_type", + FT_UINT8, BASE_HEX, VALS(pdp_type), 0, + NULL, HFILL} + }, + {&hf_gtp_user_ipv4, + { "End user address IPv4", "gtp.user_ipv4", + FT_IPv4, BASE_NONE, NULL, 0, + NULL, HFILL} + }, + {&hf_gtp_user_ipv6, + { "End user address IPv6", "gtp.user_ipv6", + FT_IPv6, BASE_NONE, NULL, 0, + NULL, HFILL} + }, {&hf_gtp_security_mode, - {"Security Mode", "gtp.security_mode", - FT_UINT8, BASE_DEC, VALS(mm_sec_modep), 0xc0, - NULL, HFILL} + { "Security Mode", "gtp.security_mode", + FT_UINT8, BASE_DEC, VALS(mm_sec_modep), 0xc0, + NULL, HFILL} }, {&hf_gtp_no_of_vectors, - {"No of Vectors", "gtp.no_of_vectors", - FT_UINT8, BASE_DEC, NULL, 0x38, - NULL, HFILL} + { "No of Vectors", "gtp.no_of_vectors", + FT_UINT8, BASE_DEC, NULL, 0x38, + NULL, HFILL} }, {&hf_gtp_cipher_algorithm, - {"Cipher Algorithm", "gtp.cipher_algorithm", - FT_UINT8, BASE_DEC, VALS(gtp_cipher_algorithm), 0x07, - NULL, HFILL} + { "Cipher Algorithm", "gtp.cipher_algorithm", + FT_UINT8, BASE_DEC, VALS(gtp_cipher_algorithm), 0x07, + NULL, HFILL} }, {&hf_gtp_cksn_ksi, - {"Ciphering Key Sequence Number (CKSN)/Key Set Identifier (KSI)", "gtp.cksn_ksi", - FT_UINT8, BASE_DEC, NULL, 0x07, - "CKSN/KSI", HFILL} + { "Ciphering Key Sequence Number (CKSN)/Key Set Identifier (KSI)", "gtp.cksn_ksi", + FT_UINT8, BASE_DEC, NULL, 0x07, + "CKSN/KSI", HFILL} }, {&hf_gtp_cksn, - {"Ciphering Key Sequence Number (CKSN)", "gtp.cksn", - FT_UINT8, BASE_DEC, NULL, 0x07, - "CKSN", HFILL} + { "Ciphering Key Sequence Number (CKSN)", "gtp.cksn", + FT_UINT8, BASE_DEC, NULL, 0x07, + "CKSN", HFILL} }, {&hf_gtp_ksi, - {"Key Set Identifier (KSI)", "gtp.ksi", - FT_UINT8, BASE_DEC, NULL, 0x07, - "KSI", HFILL} + { "Key Set Identifier (KSI)", "gtp.ksi", + FT_UINT8, BASE_DEC, NULL, 0x07, + "KSI", HFILL} }, {&hf_gtp_ext_length, - {"Length", "gtp.ext_length", - FT_UINT16, BASE_DEC, NULL, 0x0, - "IE Length", HFILL} + { "Length", "gtp.ext_length", + FT_UINT16, BASE_DEC, NULL, 0x0, + "IE Length", HFILL} }, {&hf_gtp_ext_apn_res, - {"Restriction Type", "gtp.ext_apn_res", - FT_UINT8, BASE_DEC, NULL, 0x0, - NULL, HFILL} + { "Restriction Type", "gtp.ext_apn_res", + FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL} }, {&hf_gtp_ext_rat_type, - {"RAT Type", "gtp.ext_rat_type", - FT_UINT8, BASE_DEC, VALS(gtp_ext_rat_type_vals), 0x0, - NULL, HFILL} + { "RAT Type", "gtp.ext_rat_type", + FT_UINT8, BASE_DEC, VALS(gtp_ext_rat_type_vals), 0x0, + NULL, HFILL} }, {&hf_gtp_ext_geo_loc_type, - {"Geographic Location Type", "gtp.ext_geo_loc_type", - FT_UINT8, BASE_DEC, NULL, 0x0, - NULL, HFILL} + { "Geographic Location Type", "gtp.ext_geo_loc_type", + FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL} }, {&hf_gtp_ext_sac, - {"SAC", "gtp.ext_sac", - FT_UINT16, BASE_HEX, NULL, 0x0, - NULL, HFILL} + { "SAC", "gtp.ext_sac", + FT_UINT16, BASE_HEX, NULL, 0x0, + NULL, HFILL} }, {&hf_gtp_ext_imeisv, - {"IMEI(SV)", "gtp.ext_imeisv", - FT_STRING, BASE_NONE, NULL, 0x0, - NULL, HFILL} + { "IMEI(SV)", "gtp.ext_imeisv", + FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL} }, { &hf_gtp_targetRNC_ID, { "targetRNC-ID", "gtp.targetRNC_ID", FT_NONE, BASE_NONE, NULL, 0, - NULL, HFILL }}, + NULL, HFILL } + }, {&hf_gtp_bssgp_cause, - {"BSSGP Cause", "gtp.bssgp_cause", - FT_UINT8, BASE_DEC|BASE_EXT_STRING, &bssgp_cause_vals_ext, 0, - NULL, HFILL}}, + { "BSSGP Cause", "gtp.bssgp_cause", + FT_UINT8, BASE_DEC|BASE_EXT_STRING, &bssgp_cause_vals_ext, 0, + NULL, HFILL} + }, { &hf_gtp_bssgp_ra_discriminator, { "Routing Address Discriminator", "gtp.bssgp.rad", FT_UINT8, BASE_DEC, VALS(gtp_bssgp_ra_discriminator_vals), 0x0f, NULL, HFILL } }, {&hf_gtp_sapi, - {"PS Handover XID SAPI", "gtp.ps_handover_xid_sapi", - FT_UINT8, BASE_DEC, NULL, 0x0F, - "SAPI", HFILL}}, + { "PS Handover XID SAPI", "gtp.ps_handover_xid_sapi", + FT_UINT8, BASE_DEC, NULL, 0x0F, + "SAPI", HFILL} + }, {&hf_gtp_xid_par_len, - {"PS Handover XID parameter length", "gtp.ps_handover_xid_par_len", - FT_UINT8, BASE_DEC, NULL, 0xFF, - "XID parameter length", HFILL}}, + { "PS Handover XID parameter length", "gtp.ps_handover_xid_par_len", + FT_UINT8, BASE_DEC, NULL, 0xFF, + "XID parameter length", HFILL} + }, {&hf_gtp_earp_pvi, - {"PVI Pre-emption Vulnerability", "gtp.EARP_pre_emption_par_vulnerability", - FT_UINT8, BASE_DEC, NULL, 0x01, - NULL, HFILL}}, - {&hf_gtp_earp_pl, - {"PL Priority Level", "gtp.EARP_priority_level", - FT_UINT8, BASE_DEC, NULL, 0x3C, - NULL, HFILL}}, - {&hf_gtp_earp_pci, - {"PCI Pre-emption Capability", "gtp.EARP_pre_emption_Capability", - FT_UINT8, BASE_DEC, NULL, 0x40, - NULL, HFILL}}, - {&hf_gtp_cdr_app, - {"Application Identifier", "gtp.cdr_app", - FT_UINT8, BASE_DEC, NULL, 0xf0, - NULL, HFILL}}, - { &hf_gtp_cdr_rel, - {"Release Identifier", "gtp.cdr_rel", - FT_UINT8, BASE_DEC, NULL, 0x0f, - NULL, HFILL}}, - { &hf_gtp_cdr_ver, - {"Version Identifier", "gtp.cdr_ver", - FT_UINT8, BASE_DEC, NULL, 0x0, - NULL, HFILL}}, - {&hf_gtp_spare, - {"Spare", "gtp.spare", - FT_UINT8, BASE_DEC, NULL, 0x02, - NULL, HFILL}}, - {&hf_gtp_cmn_flg_ppc, - {"Prohibit Payload Compression", "gtp.cmn_flg.ppc", - FT_BOOLEAN, 8, NULL, 0x01, - NULL, HFILL}}, - {&hf_gtp_cmn_flg_mbs_srv_type, - {"MBMS Service Type", "gtp.cmn_flg.mbs_srv_type", - FT_BOOLEAN, 8, NULL, 0x02, - NULL, HFILL}}, - {&hf_gtp_cmn_flg_mbs_ran_pcd_rdy, - {"RAN Procedures Ready", "gtp.cmn_flg.mbs_ran_pcd_rdy", - FT_BOOLEAN, 8, NULL, 0x04, - NULL, HFILL}}, - {&hf_gtp_cmn_flg_mbs_cnt_inf, - {"MBMS Counting Information", "gtp.cmn_flg.mbs_cnt_inf", - FT_BOOLEAN, 8, NULL, 0x08, - NULL, HFILL}}, - {&hf_gtp_cmn_flg_no_qos_neg, - {"No QoS negotiation", "gtp.cmn_flg.no_qos_neg", - FT_BOOLEAN, 8, NULL, 0x10, - NULL, HFILL}}, - {&hf_gtp_cmn_flg_nrsn, - {"NRSN bit field", "gtp.cmn_flg.nrsn", - FT_BOOLEAN, 8, NULL, 0x20, - NULL, HFILL}}, - {&hf_gtp_cmn_flg_upgrd_qos_sup, - {"Upgrade QoS Supported", "gtp.cmn_flg.upgrd_qos_sup", - FT_BOOLEAN, 8, NULL, 0x40, - NULL, HFILL}}, - {&hf_gtp_tmgi, - {"Temporary Mobile Group Identity (TMGI)", "gtp.tmgi", - FT_BYTES, BASE_NONE, NULL, 0x0, - NULL, HFILL}}, - {&hf_gtp_no_of_mbms_sa_codes, - {"Number of MBMS service area codes", "gtp.no_of_mbms_sa_codes", - FT_UINT8, BASE_DEC, NULL, 0x0, - "Number N of MBMS service area codes", HFILL} - }, - {&hf_gtp_mbms_ses_dur_days, - {"Estimated session duration days", "gtp.mbms_ses_dur_days", - FT_UINT24, BASE_DEC, NULL, 0x00007F, - NULL, HFILL} - }, - {&hf_gtp_mbms_ses_dur_s, - {"Estimated session duration seconds", "gtp.mbms_ses_dur_s", - FT_UINT24, BASE_DEC, NULL, 0xFFFF80, - NULL, HFILL} - }, - {&hf_gtp_mbms_sa_code, - {"MBMS service area code", "gtp.mbms_sa_code", - FT_UINT16, BASE_DEC, NULL, 0x0, - NULL, HFILL} - }, - {&hf_gtp_mbs_2g_3g_ind, - {"MBMS 2G/3G Indicator", "gtp.mbs_2g_3g_ind", - FT_UINT8, BASE_DEC, VALS(gtp_mbs_2g_3g_ind_vals), 0x0, - NULL, HFILL} - }, - {&hf_gtp_time_2_dta_tr, - {"Time to MBMS Data Transfer", "gtp.time_2_dta_tr", - FT_UINT8, BASE_DEC, NULL, 0x0, - NULL, HFILL} - }, - { &hf_gtp_ext_ei, - {"Error Indication (EI)", "gtp.ei", - FT_UINT8, BASE_DEC, NULL, 0x04, - NULL, HFILL} - }, - {&hf_gtp_ext_gcsi, - {"GPRS-CSI (GCSI)", "gtp.gcsi", - FT_UINT8, BASE_DEC, NULL, 0x02, - NULL, HFILL} - }, - { &hf_gtp_ext_dti, - {"Direct Tunnel Indicator (DTI)", "gtp.dti", + { "PVI Pre-emption Vulnerability", "gtp.EARP_pre_emption_par_vulnerability", FT_UINT8, BASE_DEC, NULL, 0x01, NULL, HFILL} }, - { &hf_gtp_ra_prio_lcs, - {"Radio Priority LCS", "gtp.raplcs", - FT_UINT8, BASE_DEC, NULL, 0x07, + {&hf_gtp_earp_pl, + { "PL Priority Level", "gtp.EARP_priority_level", + FT_UINT8, BASE_DEC, NULL, 0x3C, NULL, HFILL} }, + {&hf_gtp_earp_pci, + { "PCI Pre-emption Capability", "gtp.EARP_pre_emption_Capability", + FT_UINT8, BASE_DEC, NULL, 0x40, + NULL, HFILL} + }, + {&hf_gtp_cdr_app, + { "Application Identifier", "gtp.cdr_app", + FT_UINT8, BASE_DEC, NULL, 0xf0, + NULL, HFILL} + }, + { &hf_gtp_cdr_rel, + { "Release Identifier", "gtp.cdr_rel", + FT_UINT8, BASE_DEC, NULL, 0x0f, + NULL, HFILL} + }, + { &hf_gtp_cdr_ver, + { "Version Identifier", "gtp.cdr_ver", + FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL} + }, + {&hf_gtp_spare, + { "Spare", "gtp.spare", + FT_UINT8, BASE_DEC, NULL, 0x02, + NULL, HFILL} + }, + {&hf_gtp_cmn_flg_ppc, + { "Prohibit Payload Compression", "gtp.cmn_flg.ppc", + FT_BOOLEAN, 8, NULL, 0x01, + NULL, HFILL} + }, + {&hf_gtp_cmn_flg_mbs_srv_type, + { "MBMS Service Type", "gtp.cmn_flg.mbs_srv_type", + FT_BOOLEAN, 8, NULL, 0x02, + NULL, HFILL} + }, + {&hf_gtp_cmn_flg_mbs_ran_pcd_rdy, + { "RAN Procedures Ready", "gtp.cmn_flg.mbs_ran_pcd_rdy", + FT_BOOLEAN, 8, NULL, 0x04, + NULL, HFILL} + }, + {&hf_gtp_cmn_flg_mbs_cnt_inf, + { "MBMS Counting Information", "gtp.cmn_flg.mbs_cnt_inf", + FT_BOOLEAN, 8, NULL, 0x08, + NULL, HFILL} + }, + {&hf_gtp_cmn_flg_no_qos_neg, + { "No QoS negotiation", "gtp.cmn_flg.no_qos_neg", + FT_BOOLEAN, 8, NULL, 0x10, + NULL, HFILL} + }, + {&hf_gtp_cmn_flg_nrsn, + { "NRSN bit field", "gtp.cmn_flg.nrsn", + FT_BOOLEAN, 8, NULL, 0x20, + NULL, HFILL} + }, + {&hf_gtp_cmn_flg_upgrd_qos_sup, + { "Upgrade QoS Supported", "gtp.cmn_flg.upgrd_qos_sup", + FT_BOOLEAN, 8, NULL, 0x40, + NULL, HFILL} + }, + {&hf_gtp_tmgi, + { "Temporary Mobile Group Identity (TMGI)", "gtp.tmgi", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL} + }, + {&hf_gtp_no_of_mbms_sa_codes, + { "Number of MBMS service area codes", "gtp.no_of_mbms_sa_codes", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Number N of MBMS service area codes", HFILL} + }, + + {&hf_gtp_mbms_ses_dur_days, + { "Estimated session duration days", "gtp.mbms_ses_dur_days", + FT_UINT24, BASE_DEC, NULL, 0x00007F, + NULL, HFILL} + }, + {&hf_gtp_mbms_ses_dur_s, + { "Estimated session duration seconds", "gtp.mbms_ses_dur_s", + FT_UINT24, BASE_DEC, NULL, 0xFFFF80, + NULL, HFILL} + }, + {&hf_gtp_mbms_sa_code, + { "MBMS service area code", "gtp.mbms_sa_code", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL} + }, + {&hf_gtp_mbs_2g_3g_ind, + { "MBMS 2G/3G Indicator", "gtp.mbs_2g_3g_ind", + FT_UINT8, BASE_DEC, VALS(gtp_mbs_2g_3g_ind_vals), 0x0, + NULL, HFILL} + }, + {&hf_gtp_time_2_dta_tr, + { "Time to MBMS Data Transfer", "gtp.time_2_dta_tr", + FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL} + }, + { &hf_gtp_ext_ei, + { "Error Indication (EI)", "gtp.ei", + FT_UINT8, BASE_DEC, NULL, 0x04, + NULL, HFILL} + }, + {&hf_gtp_ext_gcsi, + { "GPRS-CSI (GCSI)", "gtp.gcsi", + FT_UINT8, BASE_DEC, NULL, 0x02, + NULL, HFILL} + }, + { &hf_gtp_ext_dti, + { "Direct Tunnel Indicator (DTI)", "gtp.dti", + FT_UINT8, BASE_DEC, NULL, 0x01, + NULL, HFILL} + }, + { &hf_gtp_ra_prio_lcs, + { "Radio Priority LCS", "gtp.raplcs", + FT_UINT8, BASE_DEC, NULL, 0x07, + NULL, HFILL} + }, { &hf_gtp_bcm, - {"Bearer Control Mode", "gtp.bcm", - FT_UINT8, BASE_DEC, VALS(gtp_pdp_bcm_type_vals), 0, - NULL, HFILL} + { "Bearer Control Mode", "gtp.bcm", + FT_UINT8, BASE_DEC, VALS(gtp_pdp_bcm_type_vals), 0, + NULL, HFILL} }, { &hf_gtp_fqdn, - {"FQDN", "gtp.fqdn", - FT_STRING, BASE_NONE, NULL, 0, - "Fully Qualified Domain Name", HFILL} + { "FQDN", "gtp.fqdn", + FT_STRING, BASE_NONE, NULL, 0, + "Fully Qualified Domain Name", HFILL} }, { &hf_gtp_rim_routing_addr, - {"RIM Routing Address value", "gtp.rim_routing_addr_val", - FT_BYTES, BASE_NONE, NULL, 0, - NULL, HFILL} + { "RIM Routing Address value", "gtp.rim_routing_addr_val", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL} }, - { &hf_gtp_mbms_flow_id, - {"MBMS Flow Identifier", "gtp.mbms_flow_id", - FT_BYTES, BASE_NONE, NULL, 0, - NULL, HFILL} + { &hf_gtp_mbms_flow_id, + { "MBMS Flow Identifier", "gtp.mbms_flow_id", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL} }, - { &hf_gtp_mbms_dist_indic, - {"Distribution Indication", "gtp.mbms_dist_indic", - FT_UINT8, BASE_DEC, VALS(gtp_mbms_dist_indic_vals), 0x03, - NULL, HFILL} + { &hf_gtp_mbms_dist_indic, + { "Distribution Indication", "gtp.mbms_dist_indic", + FT_UINT8, BASE_DEC, VALS(gtp_mbms_dist_indic_vals), 0x03, + NULL, HFILL} }, - { &hf_gtp_ext_apn_ambr_ul, - {"APN-AMBR for Uplink", "gtp.apn_ambr_ul", - FT_INT32, BASE_DEC, NULL, 0x0, - NULL, HFILL} + { &hf_gtp_ext_apn_ambr_ul, + { "APN-AMBR for Uplink", "gtp.apn_ambr_ul", + FT_INT32, BASE_DEC, NULL, 0x0, + NULL, HFILL} }, - { &hf_gtp_ext_apn_ambr_dl, - {"APN-AMBR for Downlink", "gtp.apn_ambr_dl", - FT_INT32, BASE_DEC, NULL, 0x0, - NULL, HFILL} + { &hf_gtp_ext_apn_ambr_dl, + { "APN-AMBR for Downlink", "gtp.apn_ambr_dl", + FT_INT32, BASE_DEC, NULL, 0x0, + NULL, HFILL} }, - { &hf_gtp_ext_sub_ue_ambr_ul, - {"Subscribed UE-AMBR for Uplink", "gtp.sub_ue_ambr_ul", - FT_INT32, BASE_DEC, NULL, 0x0, - NULL, HFILL} + { &hf_gtp_ext_sub_ue_ambr_ul, + { "Subscribed UE-AMBR for Uplink", "gtp.sub_ue_ambr_ul", + FT_INT32, BASE_DEC, NULL, 0x0, + NULL, HFILL} }, - { &hf_gtp_ext_sub_ue_ambr_dl, - {"Subscribed UE-AMBR for Downlink", "gtp.sub_ue_ambr_dl", - FT_INT32, BASE_DEC, NULL, 0x0, - NULL, HFILL} + { &hf_gtp_ext_sub_ue_ambr_dl, + { "Subscribed UE-AMBR for Downlink", "gtp.sub_ue_ambr_dl", + FT_INT32, BASE_DEC, NULL, 0x0, + NULL, HFILL} }, - { &hf_gtp_ext_auth_ue_ambr_ul, - {"Authorized UE-AMBR for Uplink", "gtp.auth_ue_ambr_ul", - FT_INT32, BASE_DEC, NULL, 0x0, - NULL, HFILL} + { &hf_gtp_ext_auth_ue_ambr_ul, + { "Authorized UE-AMBR for Uplink", "gtp.auth_ue_ambr_ul", + FT_INT32, BASE_DEC, NULL, 0x0, + NULL, HFILL} }, - { &hf_gtp_ext_auth_ue_ambr_dl, - {"Authorized UE-AMBR for Downlink", "gtp.auth_ue_ambr_dl", - FT_INT32, BASE_DEC, NULL, 0x0, - NULL, HFILL} + { &hf_gtp_ext_auth_ue_ambr_dl, + { "Authorized UE-AMBR for Downlink", "gtp.auth_ue_ambr_dl", + FT_INT32, BASE_DEC, NULL, 0x0, + NULL, HFILL} }, - { &hf_gtp_ext_auth_apn_ambr_ul, - {"Authorized APN-AMBR for Uplink", "gtp.auth_apn_ambr_ul", - FT_INT32, BASE_DEC, NULL, 0x0, - NULL, HFILL} + { &hf_gtp_ext_auth_apn_ambr_ul, + { "Authorized APN-AMBR for Uplink", "gtp.auth_apn_ambr_ul", + FT_INT32, BASE_DEC, NULL, 0x0, + NULL, HFILL} }, - { &hf_gtp_ext_auth_apn_ambr_dl, - {"Authorized APN-AMBR for Downlink", "gtp.auth_apn_ambr_dl", - FT_INT32, BASE_DEC, NULL, 0x0, - NULL, HFILL} + { &hf_gtp_ext_auth_apn_ambr_dl, + { "Authorized APN-AMBR for Downlink", "gtp.auth_apn_ambr_dl", + FT_INT32, BASE_DEC, NULL, 0x0, + NULL, HFILL} }, - { &hf_gtp_ext_ggsn_back_off_time_units, - {"Timer unit", "gtp.ggsn_back_off_time_units", - FT_UINT8, BASE_DEC, VALS(gtp_ggsn_back_off_time_units_vals), 0xe0, - NULL, HFILL} + { &hf_gtp_ext_ggsn_back_off_time_units, + { "Timer unit", "gtp.ggsn_back_off_time_units", + FT_UINT8, BASE_DEC, VALS(gtp_ggsn_back_off_time_units_vals), 0xe0, + NULL, HFILL} }, - { &hf_gtp_ext_ggsn_back_off_timer, - {"Timer value", "gtp.ggsn_back_off_timer", - FT_UINT8, BASE_DEC, NULL, 0x1f, - NULL, HFILL} + { &hf_gtp_ext_ggsn_back_off_timer, + { "Timer value", "gtp.ggsn_back_off_timer", + FT_UINT8, BASE_DEC, NULL, 0x1f, + NULL, HFILL} }, - { &hf_gtp_higher_br_16mb_flg, - {"Higher bitrates than 16 Mbps flag", "gtp.higher_br_16mb_flg", - FT_UINT8, BASE_DEC, VALS(gtp_higher_br_16mb_flg_vals), 0x0, - NULL, HFILL} + { &hf_gtp_higher_br_16mb_flg, + { "Higher bitrates than 16 Mbps flag", "gtp.higher_br_16mb_flg", + FT_UINT8, BASE_DEC, VALS(gtp_higher_br_16mb_flg_vals), 0x0, + NULL, HFILL} }, - { &hf_gtp_max_mbr_apn_ambr_ul, - {"Max MBR/APN-AMBR for uplink", "gtp.max_mbr_apn_ambr_ul", - FT_UINT32, BASE_DEC, NULL, 0x0, - NULL, HFILL} + { &hf_gtp_max_mbr_apn_ambr_ul, + { "Max MBR/APN-AMBR for uplink", "gtp.max_mbr_apn_ambr_ul", + FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL} }, - { &hf_gtp_max_mbr_apn_ambr_dl, - {"Max MBR/APN-AMBR for downlink", "gtp.max_mbr_apn_ambr_dl", - FT_UINT32, BASE_DEC, NULL, 0x0, - NULL, HFILL} + { &hf_gtp_max_mbr_apn_ambr_dl, + { "Max MBR/APN-AMBR for downlink", "gtp.max_mbr_apn_ambr_dl", + FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL} }, }; - /* Setup protocol subtree array */ + /* Setup protocol subtree array */ #define GTP_NUM_INDIVIDUAL_ELEMS 26 static gint *ett_gtp_array[GTP_NUM_INDIVIDUAL_ELEMS + NUM_GTP_IES]; @@ -8625,7 +9046,8 @@ void proto_register_gtp(void) * all CGFs shall support the server port number. */ -void proto_reg_handoff_gtp(void) +void +proto_reg_handoff_gtp(void) { static gboolean Initialized = FALSE; static dissector_handle_t gtp_handle, gtp_prim_handle; diff --git a/epan/dissectors/packet-gtpv2.c b/epan/dissectors/packet-gtpv2.c index a800c3f145..4d7c4782c5 100644 --- a/epan/dissectors/packet-gtpv2.c +++ b/epan/dissectors/packet-gtpv2.c @@ -439,54 +439,54 @@ static void dissect_gtpv2_ie_common(tvbuff_t * tvb, packet_info * pinfo _U_, pro /*Message Types for GTPv2 (Refer Pg19 29.274) (SB)*/ static const value_string gtpv2_message_type_vals[] = { - {0, "Reserved"}, - {1, "Echo Request"}, - {2, "Echo Response"}, - {3, "Version Not Supported Indication"}, + { 0, "Reserved"}, + { 1, "Echo Request"}, + { 2, "Echo Response"}, + { 3, "Version Not Supported Indication"}, /* 4-24 Reserved for S101 interface TS 29.276 */ - {4, "Node Alive Request"}, - {5, "Node Alive Response"}, - {6, "Redirection Request"}, - {7, "Redirection Response"}, + { 4, "Node Alive Request"}, + { 5, "Node Alive Response"}, + { 6, "Redirection Request"}, + { 7, "Redirection Response"}, /* 25-31 Reserved for Sv interface TS 29.280 */ /*Start SRVCC Messages ETSI TS 129 280 V10.1.0 (2011-06) 5.2.1*/ - {25, "SRVCC PS to CS Request"}, - {26, "SRVCC PS to CS Response"}, - {27, "SRVCC PS to CS Complete Notification"}, - {28, "SRVCC PS to CS Complete Acknowledge"}, - {29, "SRVCC PS to CS Cancel Notification"}, - {30, "SRVCC PS to CS Cancel Acknowledge"}, - {31, "For Future Sv interface use"}, + { 25, "SRVCC PS to CS Request"}, + { 26, "SRVCC PS to CS Response"}, + { 27, "SRVCC PS to CS Complete Notification"}, + { 28, "SRVCC PS to CS Complete Acknowledge"}, + { 29, "SRVCC PS to CS Cancel Notification"}, + { 30, "SRVCC PS to CS Cancel Acknowledge"}, + { 31, "For Future Sv interface use"}, /*End SRVCC Messages*/ /* SGSN/MME to PGW (S4/S11, S5/S8) */ - {32, "Create Session Request"}, - {33, "Create Session Response"}, - {34, "Modify Bearer Request"}, - {35, "Modify Bearer Response"}, - {36, "Delete Session Request"}, - {37, "Delete Session Response"}, + { 32, "Create Session Request"}, + { 33, "Create Session Response"}, + { 34, "Modify Bearer Request"}, + { 35, "Modify Bearer Response"}, + { 36, "Delete Session Request"}, + { 37, "Delete Session Response"}, /* SGSN to PGW (S4, S5/S8) */ - {38, "Change Notification Request"}, - {39, "Change Notification Response"}, + { 38, "Change Notification Request"}, + { 39, "Change Notification Response"}, /* 40-63 For future use */ /* Messages without explicit response */ - {64, "Modify Bearer Command"}, /* (MME/SGSN to PGW -S11/S4, S5/S8) */ - {65, "Modify Bearer Failure Indication"}, /*(PGW to MME/SGSN -S5/S8, S11/S4) */ - {66, "Delete Bearer Command"}, /* (MME to PGW -S11, S5/S8) */ - {67, "Delete Bearer Failure Indication"}, /* (PGW to MME -S5/S8, S11) */ - {68, "Bearer Resource Command"}, /* (MME/SGSN to PGW -S11/S4, S5/S8) */ - {69, "Bearer Resource Failure Indication"}, /* (PGW to MME/SGSN -S5/S8, S11/S4) */ - {70, "Downlink Data Notification Failure Indication"}, /*(SGSN/MME to SGW -S4/S11) */ - {71, "Trace Session Activation"}, - {72, "Trace Session Deactivation"}, - {73, "Stop Paging Indication"}, + { 64, "Modify Bearer Command"}, /* (MME/SGSN to PGW -S11/S4, S5/S8) */ + { 65, "Modify Bearer Failure Indication"}, /*(PGW to MME/SGSN -S5/S8, S11/S4) */ + { 66, "Delete Bearer Command"}, /* (MME to PGW -S11, S5/S8) */ + { 67, "Delete Bearer Failure Indication"}, /* (PGW to MME -S5/S8, S11) */ + { 68, "Bearer Resource Command"}, /* (MME/SGSN to PGW -S11/S4, S5/S8) */ + { 69, "Bearer Resource Failure Indication"}, /* (PGW to MME/SGSN -S5/S8, S11/S4) */ + { 70, "Downlink Data Notification Failure Indication"}, /*(SGSN/MME to SGW -S4/S11) */ + { 71, "Trace Session Activation"}, + { 72, "Trace Session Deactivation"}, + { 73, "Stop Paging Indication"}, /* 74-94 For future use */ /* PDN-GW to SGSN/MME (S5/S8, S4/S11) */ - {95, "Create Bearer Request"}, - {96, "Create Bearer Response"}, - {97, "Update Bearer Request"}, - {98, "Update Bearer Response"}, - {99, "Delete Bearer Request"}, + { 95, "Create Bearer Request"}, + { 96, "Create Bearer Response"}, + { 97, "Update Bearer Request"}, + { 98, "Update Bearer Response"}, + { 99, "Delete Bearer Request"}, {100, "Delete Bearer Response"}, /* PGW to MME, MME to PGW, SGW to PGW, SGW to MME (S5/S8, S11) */ {101, "Delete PDN Connection Set Request"}, @@ -832,7 +832,7 @@ dissect_gtpv2_unknown(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto static void dissect_gtpv2_imsi(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_) { - int offset= 0; + int offset = 0; const gchar *imsi_str; /* Fetch the BCD encoded digits from tvb low half byte, formating the digits according to @@ -987,8 +987,8 @@ static const true_false_string gtpv2_cause_cs = { static void dissect_gtpv2_cause(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; - guint8 tmp; + int offset = 0; + guint8 tmp; /* Cause value octet 5 */ tmp = tvb_get_guint8(tvb, offset); @@ -1040,8 +1040,8 @@ dissect_gtpv2_cause(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, pro static void dissect_gtpv2_recovery(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; - guint8 recovery; + int offset = 0; + guint8 recovery; recovery = tvb_get_guint8(tvb, offset); proto_tree_add_item(tree, hf_gtpv2_rec, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -1059,7 +1059,7 @@ dissect_gtpv2_stn_sr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_ proto_item *stn_sr_item; proto_tree *sub_tree; tvbuff_t *new_tvb; - int offset = 0; + int offset = 0; stn_sr_item = proto_tree_add_item(tree, hf_gtpv2_stn_sr, tvb, offset, length, ENC_NA); new_tvb = tvb_new_subset(tvb, offset, length, length ); @@ -1079,7 +1079,7 @@ dissect_gtpv2_stn_sr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_ static void dissect_gtpv2_src_tgt_trans_con(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; + int offset = 0; proto_tree_add_item(tree, hf_gtpv2_len_trans_con, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /*ra_type_flag = 0;*/ @@ -1102,7 +1102,7 @@ dissect_gtpv2_src_tgt_trans_con(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre static void dissect_gtpv2_tgt_src_trans_con(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; + int offset = 0; proto_tree_add_item(tree, hf_gtpv2_len_trans_con, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; @@ -1116,8 +1116,8 @@ dissect_gtpv2_tgt_src_trans_con(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre static void dissect_gtpv2_mm_con_eutran_srvcc(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; - guint8 elm_len; + int offset = 0; + guint8 elm_len; proto_tree *ms_tree, *fi; proto_tree_add_item(tree, hf_gtpv2_eksi, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -1159,8 +1159,8 @@ dissect_gtpv2_mm_con_eutran_srvcc(tvbuff_t *tvb, packet_info *pinfo _U_, proto_t static void dissect_gtpv2_mm_con_utran_srvcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; - guint8 elm_len; + int offset = 0; + guint8 elm_len; proto_tree *ms_tree, *fi; proto_tree_add_item(tree, hf_gtpv2_ksi, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -1222,8 +1222,8 @@ static value_string_ext gtpv2_srvcc_cause_vals_ext = VALUE_STRING_EXT_INIT(gtpv2 static void dissect_gtpv2_srvcc_cause(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; - guint8 srvcc_cause; + int offset = 0; + guint8 srvcc_cause; srvcc_cause = tvb_get_guint8(tvb, offset); proto_tree_add_item(tree, hf_gtpv2_srvcc_cause, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -1235,14 +1235,14 @@ dissect_gtpv2_srvcc_cause(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre static void dissect_gtpv2_tgt_rnc_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; - guint8 rnc_id; - proto_tree *subtree; - proto_item *rai_item; - guint32 mcc; - guint32 mnc; - guint32 lac; - guint32 curr_offset; + int offset = 0; + guint8 rnc_id; + proto_tree *subtree; + proto_item *rai_item; + guint32 mcc; + guint32 mnc; + guint32 lac; + guint32 curr_offset; /*ra_type_flag = 1;*/ /*Flag to be set to differentiate GERAN and UTRAN*/ curr_offset = offset; @@ -1279,14 +1279,14 @@ dissect_gtpv2_tgt_rnc_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, pr static void dissect_gtpv2_tgt_global_cell_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; - guint8 tgt_cell_id; - proto_tree *subtree; - proto_item *rai_item; - guint32 mcc; - guint32 mnc; - guint32 lac; - guint32 curr_offset; + int offset = 0; + guint8 tgt_cell_id; + proto_tree *subtree; + proto_item *rai_item; + guint32 mcc; + guint32 mnc; + guint32 lac; + guint32 curr_offset; curr_offset = offset; @@ -1321,7 +1321,7 @@ dissect_gtpv2_tgt_global_cell_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree * static void dissect_gtpv2_teid_c(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; + int offset = 0; proto_tree_add_item(tree, hf_gtpv2_teid_c, tvb, offset, 4, ENC_BIG_ENDIAN); offset= offset+4; @@ -1333,7 +1333,7 @@ dissect_gtpv2_teid_c(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, pr static void dissect_gtpv2_sv_flags(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; + int offset = 0; proto_tree_add_item(tree, hf_gtpv2_sv_sti, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_gtpv2_sv_ics, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_gtpv2_sv_emind, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -1347,7 +1347,7 @@ dissect_gtpv2_sv_flags(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, static void dissect_gtpv2_sai(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; + int offset = 0; /* 5 MCC digit 2 MCC digit 1 * 6 MNC digit 3 MCC digit 3 @@ -1382,9 +1382,9 @@ dissect_gtpv2_sai(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_ite static void dissect_gtpv2_apn(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; - guint8 *apn = NULL; - int name_len, tmp; + int offset = 0; + guint8 *apn = NULL; + int name_len, tmp; if (length > 0) { name_len = tvb_get_guint8(tvb, offset); @@ -1430,8 +1430,8 @@ static void dissect_gtpv2_ebi(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; - guint8 ebi; + int offset = 0; + guint8 ebi; /* Spare (all bits set to 0) B8 - B5*/ proto_tree_add_bits_item(tree, hf_gtpv2_spare_bits, tvb, offset, 4, ENC_BIG_ENDIAN); @@ -1447,7 +1447,7 @@ dissect_gtpv2_ebi(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto static void dissect_gtpv2_ip_address(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; + int offset = 0; struct e_in6_addr ipv6_addr; if (length==4) @@ -1476,7 +1476,7 @@ dissect_gtpv2_ip_address(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree static void dissect_gtpv2_mei(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_) { - int offset= 0; + int offset = 0; const gchar *mei_str; /* Fetch the BCD encoded digits from tvb low half byte, formating the digits according to @@ -1498,7 +1498,7 @@ dissect_gtpv2_mei(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto static void dissect_gtpv2_msisdn(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_) { - const char *digit_str; + const char *digit_str; /* Octets 5 to (n+4) represent the MSISDN value is in international number format * as described in ITU-T Rec E.164 [25] and 3GPP TS 29.002 [41]. @@ -1606,9 +1606,10 @@ static const value_string gtpv2_pdn_type_vals[] = { static void dissect_gtpv2_paa(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; + int offset = 0; guint8 pdn_type; - pdn_type = tvb_get_guint8(tvb, offset); + + pdn_type = tvb_get_guint8(tvb, offset); proto_tree_add_item(tree, hf_gtpv2_pdn_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; switch(pdn_type) @@ -1711,7 +1712,7 @@ static value_string_ext gtpv2_rat_type_vals_ext = VALUE_STRING_EXT_INIT(gtpv2_ra static void dissect_gtpv2_rat_type(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - guint8 rat_type; + guint8 rat_type; rat_type = tvb_get_guint8(tvb, 0); proto_tree_add_item(tree, hf_gtpv2_rat_type, tvb, 0, 1, ENC_BIG_ENDIAN); @@ -1774,9 +1775,9 @@ dissect_gtpv2_tad(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_ite static void decode_gtpv2_uli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 instance _U_, guint flags) { - int offset = 1; /* flags are already dissected */ - proto_item *fi; - proto_tree *part_tree; + int offset = 1; /* flags are already dissected */ + proto_item *fi; + proto_tree *part_tree; /* 8.21.1 CGI field */ if (flags & GTPv2_ULI_CGI_MASK) @@ -1787,7 +1788,7 @@ decode_gtpv2_uli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item dissect_e212_mcc_mnc(tvb, pinfo, part_tree, offset, TRUE); offset+=3; proto_tree_add_item(part_tree, hf_gtpv2_uli_cgi_lac, tvb, offset, 2, ENC_BIG_ENDIAN); - offset+=2; + offset+=2; proto_tree_add_item(part_tree, hf_gtpv2_uli_cgi_ci, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2; if(offset==length) @@ -1890,10 +1891,10 @@ decode_gtpv2_uli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item static void dissect_gtpv2_uli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_) { - proto_item *flags_item; - proto_tree *flag_tree; - int offset = 0; - guint flags; + proto_item *flags_item; + proto_tree *flag_tree; + int offset = 0; + guint flags; flags_item = proto_tree_add_text(tree, tvb, offset, 1, "Flags"); flag_tree = proto_item_add_subtree(flags_item, ett_gtpv2_uli_flags); @@ -1949,12 +1950,12 @@ static const value_string geographic_location_type_vals[] = { static int dissect_diameter_3gpp_uli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - int offset = 0; + int offset = 0; guint length; guint flags; guint flags_3gpp; - length = tvb_length(tvb); - flags_3gpp = tvb_get_guint8(tvb,offset); + length = tvb_length(tvb); + flags_3gpp = tvb_get_guint8(tvb,offset); proto_tree_add_item(tree, hf_gtpv2_glt, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -1997,18 +1998,18 @@ dissect_diameter_3gpp_uli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * 8.22 Fully Qualified TEID (F-TEID) */ static const value_string gtpv2_f_teid_interface_type_vals[] = { - {0, "S1-U eNodeB GTP-U interface"}, - {1, "S1-U SGW GTP-U interface"}, - {2, "S12 RNC GTP-U interface"}, - {3, "S12 SGW GTP-U interface"}, - {4, "S5/S8 SGW GTP-U interface"}, - {5, "S5/S8 PGW GTP-U interface"}, - {6, "S5/S8 SGW GTP-C interface"}, - {7, "S5/S8 PGW GTP-C interface"}, - {8, "S5/S8 SGW PMIPv6 interface"},/* (the 32 bit GRE key is encoded in 32 bit TEID field " - "and since alternate CoA is not used the control plane and user plane addresses are the same for PMIPv6)"}, */ - {9, "S5/S8 PGW PMIPv6 interface"},/* (the 32 bit GRE key is encoded in 32 bit TEID field " - "and the control plane and user plane addresses are the same for PMIPv6)"}, */ + { 0, "S1-U eNodeB GTP-U interface"}, + { 1, "S1-U SGW GTP-U interface"}, + { 2, "S12 RNC GTP-U interface"}, + { 3, "S12 SGW GTP-U interface"}, + { 4, "S5/S8 SGW GTP-U interface"}, + { 5, "S5/S8 PGW GTP-U interface"}, + { 6, "S5/S8 SGW GTP-C interface"}, + { 7, "S5/S8 PGW GTP-C interface"}, + { 8, "S5/S8 SGW PMIPv6 interface"},/* (the 32 bit GRE key is encoded in 32 bit TEID field " + "and since alternate CoA is not used the control plane and user plane addresses are the same for PMIPv6)"}, */ + { 9, "S5/S8 PGW PMIPv6 interface"},/* (the 32 bit GRE key is encoded in 32 bit TEID field " + "and the control plane and user plane addresses are the same for PMIPv6)"}, */ {10, "S11 MME GTP-C interface"}, {11, "S11/S4 SGW GTP-C interface"}, {12, "S10 MME GTP-C interface"}, @@ -2050,7 +2051,7 @@ static const true_false_string gtpv2_f_teid_v6_vals = { static void dissect_gtpv2_f_teid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; + int offset = 0; guint8 flags; flags = tvb_get_guint8(tvb, offset); @@ -2118,8 +2119,8 @@ static void dissect_gtpv2_s103pdf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_) { proto_item *expert_item; - int offset = 0; - guint8 m,k,i; + int offset = 0; + guint8 m,k,i; /* The HSGW Address and GRE Key identify a GRE Tunnel towards a HSGW over S103 interface for a specific PDN * connection of the UE. The EPS Bearer IDs specify the EPS Bearers which require data forwarding that belonging to this @@ -2176,8 +2177,8 @@ static void dissect_gtpv2_s1udf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_) { proto_item *expert_item; - int offset = 0; - guint8 m; + int offset = 0; + guint8 m; /* 5 Spare EPS Bearer ID */ proto_tree_add_bits_item(tree, hf_gtpv2_spare_bits, tvb, offset<<3, 4, ENC_BIG_ENDIAN); @@ -2232,8 +2233,8 @@ dissect_gtpv2_delay_value(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre static void dissect_gtpv2_bearer_ctx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree _U_, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - int offset= 0; - tvbuff_t *new_tvb; + int offset = 0; + tvbuff_t *new_tvb; proto_tree *grouped_tree; proto_item_append_text(item, "[Grouped IE]"); @@ -2308,7 +2309,7 @@ dissect_gtpv2_pdn_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, prot proto_tree_add_bits_item(tree, hf_gtpv2_spare_bits, tvb, offset<<3, 5, ENC_BIG_ENDIAN); pdn = tvb_get_guint8(tvb, offset)& 0x7; proto_tree_add_item(tree, hf_gtpv2_pdn_type, tvb, offset, length, ENC_BIG_ENDIAN); - proto_item_append_text(item, "%s", val_to_str(pdn, gtpv2_pdn_type_vals, "Unknown")); + proto_item_append_text(item, "%s", val_to_str_const(pdn, gtpv2_pdn_type_vals, "Unknown")); } @@ -2319,9 +2320,11 @@ static void dissect_gtpv2_tra_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_) { proto_item *trigg, *msc_server, *mgw, *sgsn, *ggsn, *bm_sc, *sgw_mme, *ne_types; - proto_tree *trigg_tree, *msc_server_tree, *mgw_tree, *sgsn_tree, *ggsn_tree, *bm_sc_tree, *sgw_mme_tree, *ne_types_tree; + proto_tree *trigg_tree, *msc_server_tree, *mgw_tree, *sgsn_tree, *ggsn_tree; + proto_tree *bm_sc_tree, *sgw_mme_tree, *ne_types_tree; proto_item *interfaces, *imsc_server, *lmgw, *lsgsn, *lggsn, *lrnc, *lbm_sc, *lmme, *lsgw, *lpdn_gw, *lenb; - proto_tree *interfaces_tree, *imsc_server_tree, *lmgw_tree, *lsgsn_tree, *lggsn_tree, *lrnc_tree, *lbm_sc_tree, *lmme_tree, *lsgw_tree, *lpdn_gw_tree, *lenb_tree; + proto_tree *interfaces_tree, *imsc_server_tree, *lmgw_tree, *lsgsn_tree, *lggsn_tree, *lrnc_tree; + proto_tree *lbm_sc_tree, *lmme_tree, *lsgw_tree, *lpdn_gw_tree, *lenb_tree; int offset = 0; #if 0 @@ -2686,9 +2689,9 @@ static const value_string gtpv2_mm_context_unipa_vals[] = { static int dissect_gtpv2_authentication_triplets(tvbuff_t *tvb, proto_tree *tree, int offset, guint8 num_triplet) { - proto_item *auth_tri_item; - proto_tree *auth_tri_tree; - int i; + proto_item *auth_tri_item; + proto_tree *auth_tri_tree; + int i; for (i = 0; i < num_triplet; i++) { auth_tri_item = proto_tree_add_text(tree, tvb, offset, 0, "Authentication Triplet %u", i); @@ -2714,10 +2717,10 @@ dissect_gtpv2_authentication_triplets(tvbuff_t *tvb, proto_tree *tree, int offse static int dissect_gtpv2_authentication_quintuplets(tvbuff_t *tvb, proto_tree *tree, int offset, guint8 nr_qui) { - proto_item *auth_qui_item; - proto_tree *auth_qui_tree; - int i; - guint8 xres_len, autn_len; + proto_item *auth_qui_item; + proto_tree *auth_qui_tree; + int i; + guint8 xres_len, autn_len; for (i = 0; i < nr_qui; i++) { auth_qui_item = proto_tree_add_text(tree, tvb, offset, 0, "Authentication Quintuplet %u", i); @@ -2757,10 +2760,10 @@ dissect_gtpv2_authentication_quintuplets(tvbuff_t *tvb, proto_tree *tree, int of static int dissect_gtpv2_authentication_quadruplets(tvbuff_t *tvb, proto_tree *tree, int offset, guint8 nr_qui) { - proto_item *auth_qua_item; - proto_tree *auth_qua_tree; - guint8 tmp; - int i; + proto_item *auth_qua_item; + proto_tree *auth_qua_tree; + guint8 tmp; + int i; for (i = 0; i < nr_qui; i++) { auth_qua_item = proto_tree_add_text(tree, tvb, offset, 0, "Authentication Quadruplet"); @@ -2798,12 +2801,12 @@ static const value_string gtpv2_mm_context_higher_br_16mb_flg_vals[] = { static int dissect_gtpv2_mm_context_common_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, guint8 samb_ri, guint8 uamb_ri) { - proto_item *net_cap_item, *msnt_cap_item; - proto_tree *net_cap_tree, *msnt_cap_tree; - guint8 ue_net_cap_len, ms_net_cap_len, mei_len; + proto_item *net_cap_item, *msnt_cap_item; + proto_tree *net_cap_tree, *msnt_cap_tree; + guint8 ue_net_cap_len, ms_net_cap_len, mei_len; - /* - * If SAMBRI (Subscribed UE AMBR Indicator), bit 1 of octet 6, is set to "1", + /* + * If SAMBRI (Subscribed UE AMBR Indicator), bit 1 of octet 6, is set to "1", * then the Uplink/downlink Subscribed UE AMBR parameter field is present, */ if(samb_ri){ @@ -2818,8 +2821,8 @@ dissect_gtpv2_mm_context_common_data(tvbuff_t *tvb, packet_info *pinfo, proto_tr offset += 4; } - /* - * If UAMBRI (Used UE AMBR Indicator), bit 2 of octet 6, is set to "1", + /* + * If UAMBRI (Used UE AMBR Indicator), bit 2 of octet 6, is set to "1", * then the Uplink/downlink Used UE AMBR parameter field is present */ if(uamb_ri){ @@ -2841,7 +2844,7 @@ dissect_gtpv2_mm_context_common_data(tvbuff_t *tvb, packet_info *pinfo, proto_tr /* (q+1) to k UE Network Capability */ if(ue_net_cap_len){ /* The UE Network Capability coding is specified in clause 9.9.3.34 of 3GPP TS 24.301 [23]. - * If Length of UE Network Capability is zero, then the UE Network Capability parameter + * If Length of UE Network Capability is zero, then the UE Network Capability parameter * shall not be present. */ net_cap_item = proto_tree_add_text(tree, tvb, offset, ue_net_cap_len, "UE Network Capability"); @@ -2852,7 +2855,7 @@ dissect_gtpv2_mm_context_common_data(tvbuff_t *tvb, packet_info *pinfo, proto_tr ms_net_cap_len = tvb_get_guint8(tvb,offset); proto_tree_add_item(tree, hf_gtpv2_mm_context_ms_net_cap_len, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; - /* (k+2) to m MS Network Capability + /* (k+2) to m MS Network Capability * The MS Network Capability coding is specified in clause 10.5.5.12 of 3GPP TS 24.008 [5]. * If Length of MS Network Capability is zero, then the MS Network Capability parameter shall not be present. */ @@ -2868,7 +2871,7 @@ dissect_gtpv2_mm_context_common_data(tvbuff_t *tvb, packet_info *pinfo, proto_tr /* (m+2) to r Mobile Equipment Identity (MEI) */ if(mei_len){ const gchar *mei_str; - + mei_str = tvb_bcd_dig_to_ep_str( tvb, offset, mei_len, NULL, FALSE); proto_tree_add_string(tree, hf_gtpv2_mei, tvb, offset, mei_len, mei_str); offset = offset + mei_len; @@ -2879,8 +2882,8 @@ dissect_gtpv2_mm_context_common_data(tvbuff_t *tvb, packet_info *pinfo, proto_tr static int dissect_gtpv2_access_restriction_data(tvbuff_t *tvb, proto_tree *tree, int offset) { - proto_item *accrstdata_item; - proto_tree *accrstdata_tree; + proto_item *accrstdata_item; + proto_tree *accrstdata_tree; accrstdata_item = proto_tree_add_text(tree, tvb, offset, 1, "Access restriction data"); accrstdata_tree = proto_item_add_subtree(accrstdata_item, ett_gtpv2_access_rest_data); @@ -2903,10 +2906,10 @@ dissect_gtpv2_access_restriction_data(tvbuff_t *tvb, proto_tree *tree, int offse static void dissect_gtpv2_mm_context_gsm_t(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - proto_item *flag; - proto_tree *flag_tree; - int offset; - guint8 oct, drxi, num_triplet, uamb_ri, samb_ri; + proto_item *flag; + proto_tree *flag_tree; + int offset; + guint8 oct, drxi, num_triplet, uamb_ri, samb_ri; offset = 0; flag = proto_tree_add_text(tree, tvb, offset, 3, "MM Context flags"); @@ -2967,10 +2970,10 @@ dissect_gtpv2_mm_context_gsm_t(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr static void dissect_gtpv2_mm_context_utms_cq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - proto_item *flag; - proto_tree *flag_tree; - int offset; - guint8 oct, drxi, nr_qui, uamb_ri, samb_ri, vdp_len; + proto_item *flag; + proto_tree *flag_tree; + int offset; + guint8 oct, drxi, nr_qui, uamb_ri, samb_ri, vdp_len; offset = 0; flag = proto_tree_add_text(tree, tvb, offset, 3, "MM Context flags"); @@ -2986,13 +2989,13 @@ dissect_gtpv2_mm_context_utms_cq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr offset += 1; /* Octet 6 */ oct = tvb_get_guint8(tvb,offset); - nr_qui = oct>>5; - uamb_ri = (oct & 0x02)>>1; - samb_ri = oct & 0x01; + nr_qui = oct>>5; + uamb_ri = (oct & 0x02)>>1; + samb_ri = oct & 0x01; proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nr_qui, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, (offset<<3)+3, 3, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_uamb_ri, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_bits_item(flag_tree, hf_gtpv2_mm_context_samb_ri, tvb, (offset<<3)+7, 1, ENC_BIG_ENDIAN); + proto_tree_add_bits_item(flag_tree, hf_gtpv2_mm_context_samb_ri, tvb, (offset<<3)+7, 1, ENC_BIG_ENDIAN); offset += 1; /* Octet 7 Spare Used Cipher */ proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, ((offset<<3)), 5, ENC_BIG_ENDIAN); @@ -3006,48 +3009,48 @@ dissect_gtpv2_mm_context_utms_cq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr proto_tree_add_item(tree, hf_gtpv2_ik, tvb, offset, 16, ENC_BIG_ENDIAN); offset+=16; - /* + /* * 40 to h Authentication Quintuplet [0..4] */ if (nr_qui){ - offset = dissect_gtpv2_authentication_quintuplets(tvb, tree, offset, nr_qui); + offset = dissect_gtpv2_authentication_quintuplets(tvb, tree, offset, nr_qui); } /* * (h+1) to (h+2) DRX parameter */ - if(drxi){ - proto_tree_add_item(tree, hf_gtpv2_mm_context_drx, tvb, offset, 2, ENC_BIG_ENDIAN); - offset+=2; - } + if(drxi){ + proto_tree_add_item(tree, hf_gtpv2_mm_context_drx, tvb, offset, 2, ENC_BIG_ENDIAN); + offset+=2; + } - /* Dissect octet j to r */ - offset = dissect_gtpv2_mm_context_common_data(tvb, pinfo, tree, offset, samb_ri, uamb_ri); + /* Dissect octet j to r */ + offset = dissect_gtpv2_mm_context_common_data(tvb, pinfo, tree, offset, samb_ri, uamb_ri); - /* r+1 Spare HNNA ENA INA GANA GENA UNA - * The Access restriction data is composed of UNA(UTRAN Not Allowed), GENA(GERAN Not Allowed), - * GANA(GAN Not Allowed), INA(I-HSPA-Evolution Not Allowed), ENA(E-UTRAN Not Allowed) and - * HNNA(HO-To-Non-3GPPAccess Not Allowed). - */ + /* r+1 Spare HNNA ENA INA GANA GENA UNA + * The Access restriction data is composed of UNA(UTRAN Not Allowed), GENA(GERAN Not Allowed), + * GANA(GAN Not Allowed), INA(I-HSPA-Evolution Not Allowed), ENA(E-UTRAN Not Allowed) and + * HNNA(HO-To-Non-3GPPAccess Not Allowed). + */ if (offset < (gint)length){ - offset = dissect_gtpv2_access_restriction_data(tvb, tree, offset); + offset = dissect_gtpv2_access_restriction_data(tvb, tree, offset); }else{ return; } if (offset == (gint)length){ - return; - } + return; + } - /* r+2 Length of Voice Domain Preference and UE's Usage Setting */ - vdp_len = tvb_get_guint8(tvb,offset); - proto_tree_add_item(tree, hf_gtpv2_mm_context_vdp_len, tvb, offset, 1, ENC_BIG_ENDIAN); - offset++; - /* (r+3) to s Voice Domain Preference and UE's Usage Setting */ - if(vdp_len){ - proto_tree_add_text(tree, tvb, offset, vdp_len, "Voice Domain Preference and UE's Usage Setting"); - offset = offset + vdp_len; - } + /* r+2 Length of Voice Domain Preference and UE's Usage Setting */ + vdp_len = tvb_get_guint8(tvb,offset); + proto_tree_add_item(tree, hf_gtpv2_mm_context_vdp_len, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + /* (r+3) to s Voice Domain Preference and UE's Usage Setting */ + if(vdp_len){ + proto_tree_add_text(tree, tvb, offset, vdp_len, "Voice Domain Preference and UE's Usage Setting"); + offset = offset + vdp_len; + } /* s+1 Length of Higher bitrates than 16 Mbps flag */ proto_tree_add_item(tree, hf_gtpv2_mm_context_higher_br_16mb_flg_len, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; @@ -3063,10 +3066,10 @@ dissect_gtpv2_mm_context_utms_cq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr static void dissect_gtpv2_mm_context_gsm_cq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - proto_item *flag; - proto_tree *flag_tree; - int offset; - guint8 oct, drxi, nr_qui, uamb_ri, samb_ri, vdp_len; + proto_item *flag; + proto_tree *flag_tree; + int offset; + guint8 oct, drxi, nr_qui, uamb_ri, samb_ri, vdp_len; offset = 0; flag = proto_tree_add_text(tree, tvb, offset, 3, "MM Context flags"); @@ -3075,71 +3078,71 @@ dissect_gtpv2_mm_context_gsm_cq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_sm, tvb, offset, 1, ENC_BIG_ENDIAN); /* Octet 5 */ - drxi = (tvb_get_guint8(tvb,offset) & 0x08)>>3; + drxi = (tvb_get_guint8(tvb,offset) & 0x08)>>3; proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, ((offset<<3)+3), 1, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_drxi, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_cksn_ksi, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; /* Octet 6 */ oct = tvb_get_guint8(tvb,offset); - nr_qui = oct>>5; - uamb_ri = (oct & 0x02)>>1; - samb_ri = oct & 0x01; + nr_qui = oct>>5; + uamb_ri = (oct & 0x02)>>1; + samb_ri = oct & 0x01; proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nr_qui, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, (offset<<3)+3, 3, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_uamb_ri, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_bits_item(flag_tree, hf_gtpv2_mm_context_samb_ri, tvb, (offset<<3)+7, 1, ENC_BIG_ENDIAN); + proto_tree_add_bits_item(flag_tree, hf_gtpv2_mm_context_samb_ri, tvb, (offset<<3)+7, 1, ENC_BIG_ENDIAN); offset += 1; /* Octet 7 Spare Used Cipher */ proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, ((offset<<3)), 5, ENC_BIG_ENDIAN); proto_tree_add_bits_item(flag_tree, hf_gtpv2_mm_context_used_cipher, tvb, (offset<<3)+7, 1, ENC_BIG_ENDIAN); offset += 1; - /* 8 to 15 Kc */ + /* 8 to 15 Kc */ proto_tree_add_text(tree, tvb, offset, 8, "Kc': %s",tvb_bytes_to_str(tvb, offset, 8)); offset+=8; - /* + /* * 40 to h Authentication Quintuplet [0..4] */ if (nr_qui){ - offset = dissect_gtpv2_authentication_quintuplets(tvb, tree, offset, nr_qui); + offset = dissect_gtpv2_authentication_quintuplets(tvb, tree, offset, nr_qui); } /* * (h+1) to (h+2) DRX parameter */ - if(drxi){ - proto_tree_add_item(tree, hf_gtpv2_mm_context_drx, tvb, offset, 2, ENC_BIG_ENDIAN); - offset+=2; - } + if(drxi){ + proto_tree_add_item(tree, hf_gtpv2_mm_context_drx, tvb, offset, 2, ENC_BIG_ENDIAN); + offset+=2; + } - /* Dissect octet j to r */ - offset = dissect_gtpv2_mm_context_common_data(tvb, pinfo, tree, offset, samb_ri, uamb_ri); + /* Dissect octet j to r */ + offset = dissect_gtpv2_mm_context_common_data(tvb, pinfo, tree, offset, samb_ri, uamb_ri); - /* r+1 Spare HNNA ENA INA GANA GENA UNA - * The Access restriction data is composed of UNA(UTRAN Not Allowed), GENA(GERAN Not Allowed), - * GANA(GAN Not Allowed), INA(I-HSPA-Evolution Not Allowed), ENA(E-UTRAN Not Allowed) and - * HNNA(HO-To-Non-3GPPAccess Not Allowed). - */ + /* r+1 Spare HNNA ENA INA GANA GENA UNA + * The Access restriction data is composed of UNA(UTRAN Not Allowed), GENA(GERAN Not Allowed), + * GANA(GAN Not Allowed), INA(I-HSPA-Evolution Not Allowed), ENA(E-UTRAN Not Allowed) and + * HNNA(HO-To-Non-3GPPAccess Not Allowed). + */ if (offset < (gint)length){ - offset = dissect_gtpv2_access_restriction_data(tvb, tree, offset); + offset = dissect_gtpv2_access_restriction_data(tvb, tree, offset); }else{ return; } if (offset == (gint)length){ - return; - } + return; + } - /* r+2 Length of Voice Domain Preference and UE's Usage Setting */ - vdp_len = tvb_get_guint8(tvb,offset); - proto_tree_add_item(tree, hf_gtpv2_mm_context_vdp_len, tvb, offset, 1, ENC_BIG_ENDIAN); - offset++; - /* (r+3) to s Voice Domain Preference and UE's Usage Setting */ - if(vdp_len){ - proto_tree_add_text(tree, tvb, offset, vdp_len, "Voice Domain Preference and UE's Usage Setting"); - offset = offset + vdp_len; - } + /* r+2 Length of Voice Domain Preference and UE's Usage Setting */ + vdp_len = tvb_get_guint8(tvb,offset); + proto_tree_add_item(tree, hf_gtpv2_mm_context_vdp_len, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + /* (r+3) to s Voice Domain Preference and UE's Usage Setting */ + if(vdp_len){ + proto_tree_add_text(tree, tvb, offset, vdp_len, "Voice Domain Preference and UE's Usage Setting"); + offset = offset + vdp_len; + } /* s+1 Length of Higher bitrates than 16 Mbps flag */ proto_tree_add_item(tree, hf_gtpv2_mm_context_higher_br_16mb_flg_len, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; @@ -3157,10 +3160,10 @@ dissect_gtpv2_mm_context_gsm_cq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre static void dissect_gtpv2_mm_context_utms_q(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_) { - proto_item *flag; - proto_tree *flag_tree; - int offset; - guint8 oct, drxi, nr_qui, uamb_ri, samb_ri, vdp_len; + proto_item *flag; + proto_tree *flag_tree; + int offset; + guint8 oct, drxi, nr_qui, uamb_ri, samb_ri, vdp_len; offset = 0; flag = proto_tree_add_text(tree, tvb, offset, 3, "MM Context flags"); @@ -3179,9 +3182,9 @@ dissect_gtpv2_mm_context_utms_q(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre /* Octet 6 */ /* Number of Quintuplets Spare UAMB RI SAMB RI */ oct = tvb_get_guint8(tvb,offset); - nr_qui = oct>>5; - uamb_ri = (oct & 0x02)>>1; - samb_ri = oct & 0x01; + nr_qui = oct>>5; + uamb_ri = (oct & 0x02)>>1; + samb_ri = oct & 0x01; proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nr_qui, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_bits_item(flag_tree, hf_gtpv2_spare_bits, tvb, (offset<<3)+3, 3, ENC_BIG_ENDIAN); @@ -3198,48 +3201,48 @@ dissect_gtpv2_mm_context_utms_q(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre proto_tree_add_item(tree, hf_gtpv2_ik, tvb, offset, 16, ENC_BIG_ENDIAN); offset+=16; - /* + /* * 40 to h Authentication Quintuplet [0..4] */ if (nr_qui){ - offset = dissect_gtpv2_authentication_quintuplets(tvb, tree, offset, nr_qui); + offset = dissect_gtpv2_authentication_quintuplets(tvb, tree, offset, nr_qui); } /* * (h+1) to (h+2) DRX parameter */ - if(drxi){ - proto_tree_add_item(tree, hf_gtpv2_mm_context_drx, tvb, offset, 2, ENC_BIG_ENDIAN); - offset+=2; - } + if(drxi){ + proto_tree_add_item(tree, hf_gtpv2_mm_context_drx, tvb, offset, 2, ENC_BIG_ENDIAN); + offset+=2; + } - /* Dissect octet j to r */ - offset = dissect_gtpv2_mm_context_common_data(tvb, pinfo, tree, offset, samb_ri, uamb_ri); + /* Dissect octet j to r */ + offset = dissect_gtpv2_mm_context_common_data(tvb, pinfo, tree, offset, samb_ri, uamb_ri); - /* r+1 Spare HNNA ENA INA GANA GENA UNA - * The Access restriction data is composed of UNA(UTRAN Not Allowed), GENA(GERAN Not Allowed), - * GANA(GAN Not Allowed), INA(I-HSPA-Evolution Not Allowed), ENA(E-UTRAN Not Allowed) and - * HNNA(HO-To-Non-3GPPAccess Not Allowed). - */ + /* r+1 Spare HNNA ENA INA GANA GENA UNA + * The Access restriction data is composed of UNA(UTRAN Not Allowed), GENA(GERAN Not Allowed), + * GANA(GAN Not Allowed), INA(I-HSPA-Evolution Not Allowed), ENA(E-UTRAN Not Allowed) and + * HNNA(HO-To-Non-3GPPAccess Not Allowed). + */ if (offset < (gint)length){ - offset = dissect_gtpv2_access_restriction_data(tvb, tree, offset); + offset = dissect_gtpv2_access_restriction_data(tvb, tree, offset); }else{ return; } if (offset == (gint)length){ - return; - } + return; + } - /* r+2 Length of Voice Domain Preference and UE's Usage Setting */ - vdp_len = tvb_get_guint8(tvb,offset); - proto_tree_add_item(tree, hf_gtpv2_mm_context_vdp_len, tvb, offset, 1, ENC_BIG_ENDIAN); - offset++; - /* (r+3) to s Voice Domain Preference and UE's Usage Setting */ - if(vdp_len){ - proto_tree_add_text(tree, tvb, offset, vdp_len, "Voice Domain Preference and UE's Usage Setting"); - /*offset = offset + vdp_len;*/ - } + /* r+2 Length of Voice Domain Preference and UE's Usage Setting */ + vdp_len = tvb_get_guint8(tvb,offset); + proto_tree_add_item(tree, hf_gtpv2_mm_context_vdp_len, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + /* (r+3) to s Voice Domain Preference and UE's Usage Setting */ + if(vdp_len){ + proto_tree_add_text(tree, tvb, offset, vdp_len, "Voice Domain Preference and UE's Usage Setting"); + /*offset = offset + vdp_len;*/ + } /* s+1 Length of Higher bitrates than 16 Mbps flag */ proto_tree_add_item(tree, hf_gtpv2_mm_context_higher_br_16mb_flg_len, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; @@ -3259,10 +3262,10 @@ dissect_gtpv2_mm_context_utms_q(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre static void dissect_gtpv2_mm_context_eps_qq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_) { - proto_item *flag_item; - proto_tree *flag_tree; - gint offset; - guint8 tmp, nhi, drxi, nr_qua, nr_qui, uamb_ri, samb_ri, vdp_len; + proto_item *flag_item; + proto_tree *flag_tree; + gint offset; + guint8 tmp, nhi, drxi, nr_qua, nr_qui, uamb_ri, samb_ri, vdp_len; offset = 0; @@ -3280,8 +3283,8 @@ dissect_gtpv2_mm_context_eps_qq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre * then the optional parameters NH (Next Hop) and NCC (Next * Hop Chaining Count) are both present, otherwise their octets are not present. */ - tmp = tvb_get_guint8(tvb,offset); - nhi = (tmp&0x10)>>4; + tmp = tvb_get_guint8(tvb,offset); + nhi = (tmp&0x10)>>4; drxi = (tmp & 0x08)>>3; proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_drxi, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_ksi_a, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -3293,11 +3296,11 @@ dissect_gtpv2_mm_context_eps_qq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre * Number of | Number of | UAMB | OSCI * Quintuplets | Quadruplet | RI | */ - tmp = tvb_get_guint8(tvb, offset); - nr_qui = (tmp & 0xe0)>>5; + tmp = tvb_get_guint8(tvb, offset); + nr_qui = (tmp & 0xe0)>>5; nr_qua = tmp & 0x1c; nr_qua >>= 2; - uamb_ri = (tmp & 0x2)>>1; + uamb_ri = (tmp & 0x2)>>1; proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nr_qui, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nr_qua, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -3309,7 +3312,7 @@ dissect_gtpv2_mm_context_eps_qq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre /* Octet 7 SAMB RI Used NAS integrity protection algorithm Used NAS Cipher*/ /* SAMB RI */ - samb_ri = tvb_get_guint8(tvb, offset) >> 7; + samb_ri = tvb_get_guint8(tvb, offset) >> 7; proto_tree_add_bits_item(flag_tree, hf_gtpv2_mm_context_samb_ri, tvb, offset<<3, 1, ENC_BIG_ENDIAN); /* Used NAS integrity protection algorithm */ proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_unipa, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -3336,14 +3339,14 @@ dissect_gtpv2_mm_context_eps_qq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre } if (nr_qui){ - offset = dissect_gtpv2_authentication_quintuplets(tvb, tree, offset, nr_qui); + offset = dissect_gtpv2_authentication_quintuplets(tvb, tree, offset, nr_qui); } /* (h+1) to (h+2) DRX parameter */ - if(drxi){ - proto_tree_add_item(tree, hf_gtpv2_mm_context_drx, tvb, offset, 2, ENC_BIG_ENDIAN); - offset+=2; - } + if(drxi){ + proto_tree_add_item(tree, hf_gtpv2_mm_context_drx, tvb, offset, 2, ENC_BIG_ENDIAN); + offset+=2; + } /* Octet p to p+31 & Octet p+32 */ if ( nhi ) @@ -3358,29 +3361,29 @@ dissect_gtpv2_mm_context_eps_qq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre } - /* Dissect octet j to r */ - offset = dissect_gtpv2_mm_context_common_data(tvb, pinfo, tree, offset, samb_ri, uamb_ri); + /* Dissect octet j to r */ + offset = dissect_gtpv2_mm_context_common_data(tvb, pinfo, tree, offset, samb_ri, uamb_ri); /* r+1 Spare HNNA ENA INA GANA GENA UNA */ if (offset < (gint)length){ - offset = dissect_gtpv2_access_restriction_data(tvb, tree, offset); + offset = dissect_gtpv2_access_restriction_data(tvb, tree, offset); }else{ return; } if (offset == (gint)length){ - return; - } + return; + } - /* r+2 Length of Voice Domain Preference and UE's Usage Setting */ - vdp_len = tvb_get_guint8(tvb,offset); - proto_tree_add_item(tree, hf_gtpv2_mm_context_vdp_len, tvb, offset, 1, ENC_BIG_ENDIAN); - offset++; - /* (r+3) to s Voice Domain Preference and UE's Usage Setting */ - if(vdp_len){ - proto_tree_add_text(tree, tvb, offset, vdp_len, "Voice Domain Preference and UE's Usage Setting"); - /*offset = offset + vdp_len;*/ - } + /* r+2 Length of Voice Domain Preference and UE's Usage Setting */ + vdp_len = tvb_get_guint8(tvb,offset); + proto_tree_add_item(tree, hf_gtpv2_mm_context_vdp_len, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + /* (r+3) to s Voice Domain Preference and UE's Usage Setting */ + if(vdp_len){ + proto_tree_add_text(tree, tvb, offset, vdp_len, "Voice Domain Preference and UE's Usage Setting"); + /*offset = offset + vdp_len;*/ + } } @@ -3391,10 +3394,10 @@ dissect_gtpv2_mm_context_eps_qq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre static void dissect_gtpv2_mm_context_utms_qq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - proto_item *flag; - proto_tree *flag_tree; - guint32 offset; - guint8 tmp, drxi, nr_qua, nr_qui, uamb_ri, samb_ri; + proto_item *flag; + proto_tree *flag_tree; + guint32 offset; + guint8 tmp, drxi, nr_qua, nr_qui, uamb_ri, samb_ri; offset = 0; flag = proto_tree_add_text(tree, tvb, offset, 3, "MM Context flags"); @@ -3423,16 +3426,16 @@ dissect_gtpv2_mm_context_utms_qq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr * Number of | Number of | UAMB | SAMB * Quintuplets | Quadruplet | RI | RI */ - tmp = tvb_get_guint8(tvb, offset); - nr_qui = (tmp & 0xe0)>>5; + tmp = tvb_get_guint8(tvb, offset); + nr_qui = (tmp & 0xe0)>>5; nr_qua = tmp & 0x1c; nr_qua >>= 2; - uamb_ri = (tmp & 0x2)>>1; - samb_ri = tmp & 0x01; + uamb_ri = (tmp & 0x2)>>1; + samb_ri = tmp & 0x01; proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nr_qui, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_nr_qua, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_uamb_ri, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(flag_tree, hf_gtpv2_mm_context_uamb_ri, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_bits_item(flag_tree, hf_gtpv2_mm_context_samb_ri, tvb, (offset<<3)+7, 1, ENC_BIG_ENDIAN); offset += 1; /* Octet 7 Spare */ @@ -3451,26 +3454,26 @@ dissect_gtpv2_mm_context_utms_qq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr } if (nr_qui){ - offset = dissect_gtpv2_authentication_quintuplets(tvb, tree, offset, nr_qui); + offset = dissect_gtpv2_authentication_quintuplets(tvb, tree, offset, nr_qui); } /* (h+1) to (h+2) DRX parameter */ - if(drxi){ - proto_tree_add_item(tree, hf_gtpv2_mm_context_drx, tvb, offset, 2, ENC_BIG_ENDIAN); - offset+=2; - } + if(drxi){ + proto_tree_add_item(tree, hf_gtpv2_mm_context_drx, tvb, offset, 2, ENC_BIG_ENDIAN); + offset+=2; + } - /* Dissect octet j to r */ - offset = dissect_gtpv2_mm_context_common_data(tvb, pinfo, tree, offset, samb_ri, uamb_ri); + /* Dissect octet j to r */ + offset = dissect_gtpv2_mm_context_common_data(tvb, pinfo, tree, offset, samb_ri, uamb_ri); /* r+1 Spare HNNA ENA INA GANA GENA UNA */ if (offset < (gint)length){ - offset = dissect_gtpv2_access_restriction_data(tvb, tree, offset); + offset = dissect_gtpv2_access_restriction_data(tvb, tree, offset); }else{ return; } - proto_tree_add_text(flag_tree, tvb, offset, -1, "The rest of the IE not dissected yet"); + proto_tree_add_text(flag_tree, tvb, offset, -1, "The rest of the IE not dissected yet"); } @@ -3480,9 +3483,9 @@ dissect_gtpv2_mm_context_utms_qq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr static void dissect_gtpv2_PDN_conn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree _U_, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_) { - int offset= 0; + int offset = 0; proto_tree *grouped_tree; - tvbuff_t *new_tvb; + tvbuff_t *new_tvb; proto_item_append_text(item, "[Grouped IE]"); grouped_tree = proto_item_add_subtree(item, ett_gtpv2_PDN_conn); @@ -3496,11 +3499,11 @@ dissect_gtpv2_PDN_conn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree _U_, static void dissect_gtpv2_pdn_numbers(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - proto_item *nsapi_ti; - proto_tree *nsapi_tree; - guint8 nsapi; - guint16 dlgtpu_seq, ulgtpu_seq, send_npdu_nr, rec_npdu_nr; - int offset = 0; + proto_item *nsapi_ti; + proto_tree *nsapi_tree; + guint8 nsapi; + guint16 dlgtpu_seq, ulgtpu_seq, send_npdu_nr, rec_npdu_nr; + int offset = 0; nsapi = (tvb_get_guint8(tvb, offset) & 0x08); nsapi_ti = proto_tree_add_text(tree, tvb, offset, 1, "NSAPI: %d", nsapi); @@ -3559,7 +3562,7 @@ dissect_gtpv2_p_tmsi_sig(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree static void dissect_gtpv2_hop_counter(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; + int offset = 0; guint8 hop_counter; hop_counter = tvb_get_guint8(tvb, offset); @@ -3600,9 +3603,9 @@ dissect_gtpv2_ue_time_zone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, static void dissect_gtpv2_trace_reference(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; - guint32 trace_id; - gchar *mcc_mnc_str; + int offset = 0; + guint32 trace_id; + gchar *mcc_mnc_str; mcc_mnc_str = dissect_e212_mcc_mnc_ep_str(tvb, pinfo, tree, 0, TRUE); offset += 3; @@ -3675,12 +3678,12 @@ static const value_string gtpv2_container_type_vals[] = { static void dissect_gtpv2_F_container(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type, guint8 instance _U_) { - tvbuff_t *tvb_new; + tvbuff_t *tvb_new; proto_item *bss_item; proto_tree *sub_tree; - int offset = 0; - guint8 container_type; - guint8 container_flags, xid_len; + int offset = 0; + guint8 container_type; + guint8 container_flags, xid_len; /* Octets 8 7 6 5 4 3 2 1 * 5 Spare | Container Type @@ -3784,7 +3787,7 @@ static value_string_ext gtpv2_cause_type_vals_ext = VALUE_STRING_EXT_INIT(gtpv2_ static void dissect_gtpv2_F_cause(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; + int offset = 0; guint8 cause_type; /* The value of Instance field of the F-Cause IE in a GTPv2 message shall indicate @@ -3879,8 +3882,8 @@ static void dissect_gtpv2_target_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_) { tvbuff_t *tvb_new; - int offset = 0; - guint8 target_type; + int offset = 0; + guint8 target_type; proto_tree_add_item(tree, hf_gtpv2_target_type, tvb, 0, 1, ENC_BIG_ENDIAN); target_type = tvb_get_guint8(tvb,offset); @@ -3968,8 +3971,8 @@ dissect_gtpv2_pkt_flow_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre static void dissect_gtpv2_rab_context(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; - guint16 dlgtpu_seq, ulgtpu_seq, dl_pdcp_seq, ul_pdcp_seq; + int offset = 0; + guint16 dlgtpu_seq, ulgtpu_seq, dl_pdcp_seq, ul_pdcp_seq; /* 5 Spare NSAPI */ proto_tree_add_bits_item(tree, hf_gtpv2_spare_bits, tvb, offset<<3, 4, ENC_BIG_ENDIAN); @@ -4041,12 +4044,12 @@ static const value_string gtpv2_selec_mode_vals[] = { static void dissect_gtpv2_selec_mode(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - int offset=0; - guint8 ss_mode; + int offset = 0; + guint8 ss_mode; ss_mode = tvb_get_guint8(tvb, offset) & 0x03; proto_tree_add_item(tree, hf_gtpv2_selec_mode, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_item_append_text(item, "%s", val_to_str(ss_mode, gtpv2_selec_mode_vals, "Unknown")); + proto_item_append_text(item, "%s", val_to_str_const(ss_mode, gtpv2_selec_mode_vals, "Unknown")); } @@ -4063,8 +4066,8 @@ static void dissect_gtpv2_source_ident(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { proto_item *expert_item; - int offset=0; - guint8 source_type; + int offset = 0; + guint8 source_type; /* Octet 5 to 12 Target Cell ID */ de_cell_id(tvb, tree, pinfo, offset, 8, NULL, 0); @@ -4123,7 +4126,7 @@ dissect_gtpv2_bearer_control_mode(tvbuff_t *tvb, packet_info *pinfo _U_, proto_t proto_tree_add_item(tree, hf_gtpv2_bearer_control_mode, tvb, 0, 1, ENC_BIG_ENDIAN); /* Add Bearer Control Mode to tree */ bcm = tvb_get_guint8(tvb, 0); - proto_item_append_text(item, "%s", val_to_str(bcm, gtpv2_bearer_control_mode_short_vals, "Unknown")); + proto_item_append_text(item, "%s", val_to_str_const(bcm, gtpv2_bearer_control_mode_short_vals, "Unknown")); } /* @@ -4149,7 +4152,7 @@ dissect_gtpv2_cng_rep_act(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre action = tvb_get_guint8(tvb, 0); proto_tree_add_item(tree, hf_gtpv2_cng_rep_act, tvb, 0, 1, ENC_BIG_ENDIAN); - proto_item_append_text(item, "%s", val_to_str(action, gtpv2_cng_rep_act_vals, "Unknown")); + proto_item_append_text(item, "%s", val_to_str_const(action, gtpv2_cng_rep_act_vals, "Unknown")); } /* * 8.62 Fully qualified PDN Connection Set Identifier (FQ-CSID) @@ -4166,9 +4169,9 @@ static void dissect_gtpv2_fq_csid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { proto_item *expert_item; - int offset = 0; - guint8 octet,node_id_type, csids; - guint32 node_id, node_id_mcc_mnc; + int offset = 0; + guint8 octet,node_id_type, csids; + guint32 node_id, node_id_mcc_mnc; /* Octet 5 Node-ID Type Number of CSIDs= m */ @@ -4264,7 +4267,7 @@ dissect_gtpv2_node_type(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_tree_add_item(tree, hf_gtpv2_node_type, tvb, 0, 1, ENC_BIG_ENDIAN); /* Append Node Type to tree */ node_type = tvb_get_guint8(tvb, 0); - proto_item_append_text(item, "%s", val_to_str(node_type, gtpv2_node_type_vals, "Unknown")); + proto_item_append_text(item, "%s", val_to_str_const(node_type, gtpv2_node_type_vals, "Unknown")); } @@ -4274,8 +4277,8 @@ dissect_gtpv2_node_type(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, static void dissect_gtpv2_fqdn(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0, name_len, tmp; - guint8 *fqdn = NULL; + int offset = 0, name_len, tmp; + guint8 *fqdn = NULL; /* The FQDN field encoding shall be identical to the encoding of * a FQDN within a DNS message of section 3.1 of IETF @@ -4307,9 +4310,9 @@ dissect_gtpv2_fqdn(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, prot static void dissect_gtpv2_private_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; + int offset = 0; tvbuff_t *next_tvb; - guint16 ext_id; + guint16 ext_id; /* oct 5 -7 Enterprise ID */ ext_id = tvb_get_ntohs(tvb, offset); @@ -4340,13 +4343,13 @@ dissect_gtpv2_ti(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_ void dissect_gtpv2_mbms_session_duration(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; - int bit_offset = 0; + int offset = 0; + int bit_offset = 0; guint32 days; guint32 hours; guint32 minutes; guint32 seconds; - + /* From 3GPP TS 29.061 17.7.7 MBMS-Session-Duration AVP */ /* Bits: ssss ssss ssss ssss sddd dddd where s bits = seconds, d bits = days */ seconds = tvb_get_bits32(tvb, bit_offset, 17, ENC_BIG_ENDIAN); @@ -4358,7 +4361,7 @@ dissect_gtpv2_mbms_session_duration(tvbuff_t *tvb, packet_info *pinfo _U_, proto * Maximum allowed value for seconds: 86,400 */ if((days>18) || (seconds>86400)) { proto_tree_add_text(tree, tvb, offset, offset+3, "Days or Seconds out or allowed range"); - } + } /* The lowest value of this AVP (i.e. all 0:s) is reserved to indicate an indefinite value to denote sessions that are expected to be always-on. */ if((seconds == 0) && (days == 0)) { @@ -4386,11 +4389,11 @@ dissect_gtpv2_mbms_session_duration(tvbuff_t *tvb, packet_info *pinfo _U_, proto void dissect_gtpv2_mbms_service_area(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; + int offset = 0; proto_item *sai_item; - guint8 binary_nr; - guint16 real_nr; - guint16 sai; + guint8 binary_nr; + guint16 real_nr; + guint16 sai; binary_nr = tvb_get_guint8(tvb, offset); real_nr = (guint16)binary_nr + 1; @@ -4427,7 +4430,7 @@ dissect_gtpv2_mbms_session_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree proto_tree_add_text(tree, tvb, offset, length-1, "Spare: %s", tvb_bytes_to_str(tvb, offset, length-1)); } -/* +/* * 8.72 MBMS Flow Identifier */ static void @@ -4442,7 +4445,7 @@ dissect_gtpv2_mbms_flow_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr proto_tree_add_text(tree, tvb, offset, length-2, "Spare: %s", tvb_bytes_to_str(tvb, offset, length-2)); } -/* +/* * 8.73 MBMS IP Multicast Distribution */ static const value_string gtpv2_mbms_hc_indicator_vals[] = { @@ -4493,7 +4496,7 @@ dissect_gtpv2_mbms_ip_mc_dist(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree } -/* +/* * 8.74 MBMS Distribution Acknowledge */ static const value_string gtpv2_mbms_dist_indication_vals[] = { @@ -4623,8 +4626,8 @@ dissect_gtpv2_node_features(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *t void dissect_gtpv2_mbms_time_to_data_xfer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; - guint8 binary_secs; + int offset = 0; + guint8 binary_secs; guint16 real_secs; binary_secs = tvb_get_guint8(tvb, offset); @@ -4689,7 +4692,7 @@ dissect_gtpv2_sig_prio_ind(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr static void dissect_gtpv2_tmgi(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; + int offset = 0; guint64 tmgi; tmgi = tvb_get_ntoh48(tvb, offset); @@ -4713,10 +4716,10 @@ dissect_gtpv2_tmgi(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, prot static void dissect_gtpv2_add_mm_cont_for_srvcc(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; + int offset = 0; proto_item *ms_cm_item; proto_tree *ms_cm_tree; - guint8 elm_len; + guint8 elm_len; /* Length of Mobile Station Classmark 2 */ elm_len = tvb_get_guint8(tvb, offset); @@ -4770,7 +4773,7 @@ dissect_gtpv2_add_flags_for_srvcc(tvbuff_t *tvb, packet_info *pinfo _U_, proto_t static void dissect_gtpv2_mmbr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; + int offset = 0; guint32 max_ul; guint32 max_dl; @@ -4813,7 +4816,7 @@ dissect_gtpv2_apco(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, prot static void dissect_gtpv2_abs_mbms_data_tf_time(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_) { - int offset = 0; + int offset = 0; const gchar *time_str; time_str = tvb_ntp_fmt_ts(tvb, offset); @@ -4957,10 +4960,10 @@ dissect_gtpv2_ie_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, { proto_tree *ie_tree; proto_item *ti; - tvbuff_t *ie_tvb; - guint8 type, instance; - guint16 length; - int i; + tvbuff_t *ie_tvb; + guint8 type, instance; + guint16 length; + int i; /* * Octets 8 7 6 5 4 3 2 1 * 1 Type @@ -4970,10 +4973,13 @@ dissect_gtpv2_ie_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, */ while(offset < (gint)tvb_reported_length(tvb)){ /* Get the type and length */ - type = tvb_get_guint8(tvb,offset); - length = tvb_get_ntohs(tvb, offset+1); - ti = proto_tree_add_text(tree, tvb, offset, 4 + length, "%s : ", val_to_str(type, gtpv2_element_type_vals, "Unknown")); + + type = tvb_get_guint8(tvb,offset); + length = tvb_get_ntohs(tvb, offset+1); + ti = proto_tree_add_text(tree, tvb, offset, 4 + length, "%s : ", + val_to_str_const(type, gtpv2_element_type_vals, "Unknown")); ie_tree = proto_item_add_subtree(ti, ett_gtpv2_ie); + /* Octet 1 */ proto_tree_add_item(ie_tree, hf_gtpv2_ie, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; @@ -4994,7 +5000,8 @@ dissect_gtpv2_ie_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, proto_tree_add_text(ie_tree, tvb, offset, length, "IE type Zero is Reserved and should not be used"); }else{ i = -1; - /* Loop over the IE dissector list to se if we find an entry, the last entry will have ie_type=0 breaking the loop */ + /* Loop over the IE dissector list to se if we find an entry; + the last entry will have ie_type=0 breaking the loop */ while (gtpv2_ies[++i].ie_type){ if (gtpv2_ies[i].ie_type == type) break; @@ -5013,9 +5020,9 @@ dissect_gtpv2(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { proto_tree *gtpv2_tree, *flags_tree; proto_item *ti, *tf; - guint8 message_type, t_flag, p_flag; - int offset = 0; - guint16 msg_length; + guint8 message_type, t_flag, p_flag; + int offset = 0; + guint16 msg_length; tvbuff_t *msg_tvb; @@ -5025,7 +5032,7 @@ dissect_gtpv2(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) /* message type is in octet 2 */ message_type = tvb_get_guint8(tvb,1); - col_add_str(pinfo->cinfo, COL_INFO, val_to_str(message_type, gtpv2_message_type_vals, "Unknown")); + col_add_str(pinfo->cinfo, COL_INFO, val_to_str_const(message_type, gtpv2_message_type_vals, "Unknown")); p_flag = (tvb_get_guint8(tvb,offset) & 0x10)>>4; @@ -5033,7 +5040,8 @@ dissect_gtpv2(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) proto_tree_add_item(tree, proto_gtpv2, tvb, offset, msg_length+4, ENC_NA); if (tree) { - ti = proto_tree_add_text(tree, tvb, offset, msg_length+4, "%s", val_to_str(message_type, gtpv2_message_type_vals, "Unknown")); + ti = proto_tree_add_text(tree, tvb, offset, msg_length+4, "%s", + val_to_str_const(message_type, gtpv2_message_type_vals, "Unknown")); gtpv2_tree = proto_item_add_subtree(ti, ett_gtpv2); /* Control Plane GTP uses a variable length header. Control Plane GTP header @@ -5085,16 +5093,17 @@ dissect_gtpv2(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) dissect_gtpv2_ie_common(msg_tvb, pinfo, gtpv2_tree, offset, message_type); }else{ dissect_gtpv2_ie_common(tvb, pinfo, gtpv2_tree, offset, message_type); - } + } } - /* Bit 5 represents a "P" flag. If the "P" flag is set to "0", + /* Bit 5 represents a "P" flag. If the "P" flag is set to "0", * no piggybacked message shall be present. If the "P" flag is set to "1", - * then another GTPv2-C message with its own header and body shall be present + * then another GTPv2-C message with its own header and body shall be present * at the end of the current message. */ if(p_flag){ tvbuff_t *new_p_tvb; - /* Octets 3 to 4 represent the Length field. This field shall indicate the length of the message in octets excluding the + /* Octets 3 to 4 represent the Length field. This field shall indicate the + * length of the message in octets excluding the * mandatory part of the GTP-C header (the first 4 octets). */ new_p_tvb = tvb_new_subset_remaining(tvb,msg_length+4); @@ -6143,7 +6152,7 @@ void proto_register_gtpv2(void) FT_UINT8, BASE_DEC, NULL, 0xe0, NULL, HFILL} }, - { &hf_gtpv2_mm_context_used_cipher, + { &hf_gtpv2_mm_context_used_cipher, {"Used Cipher", "gtpv2.mm_context_used_cipher", FT_UINT8, BASE_DEC, VALS(gtpv2_mm_context_used_cipher_vals), 0x07, NULL, HFILL} @@ -6174,27 +6183,27 @@ void proto_register_gtpv2(void) FT_BYTES, BASE_NONE, NULL,0x0, NULL, HFILL} }, - { &hf_gtpv2_mm_context_rand, + { &hf_gtpv2_mm_context_rand, {"RAND","gtpv2.mm_context_rand", FT_BYTES, BASE_NONE, NULL,0x0, NULL, HFILL} }, - { &hf_gtpv2_mm_context_xres_len, + { &hf_gtpv2_mm_context_xres_len, {"XRES Length", "gtpv2.mm_context_xres_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL} }, - { &hf_gtpv2_mm_context_xres, + { &hf_gtpv2_mm_context_xres, {"XRES","gtpv2.mm_context_xres", FT_BYTES, BASE_NONE, NULL,0x0, NULL, HFILL} }, - { &hf_gtpv2_mm_context_autn_len, + { &hf_gtpv2_mm_context_autn_len, {"AUTN Length", "gtpv2.mm_context_autn_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL} }, - { &hf_gtpv2_mm_context_autn, + { &hf_gtpv2_mm_context_autn, {"AUTN","gtpv2.mm_context_autn", FT_BYTES, BASE_NONE, NULL,0x0, NULL, HFILL} @@ -6204,22 +6213,22 @@ void proto_register_gtpv2(void) FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL} }, - { &hf_gtpv2_mm_context_ue_net_cap_len, + { &hf_gtpv2_mm_context_ue_net_cap_len, {"Length of UE Network Capability", "gtpv2.mm_context_ue_net_cap_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL} }, - { &hf_gtpv2_mm_context_ms_net_cap_len, + { &hf_gtpv2_mm_context_ms_net_cap_len, {"Length of MS Network Capability", "gtpv2.mm_context_ms_net_cap_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL} }, - { &hf_gtpv2_mm_context_mei_len, + { &hf_gtpv2_mm_context_mei_len, {"Length of Mobile Equipment Identity (MEI)", "gtpv2.mm_context_mei_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL} }, - { &hf_gtpv2_mm_context_vdp_len, + { &hf_gtpv2_mm_context_vdp_len, {"Length of Voice Domain Preference and UE's Usage Setting", "gtpv2.mm_context_vdp_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL} @@ -6228,7 +6237,7 @@ void proto_register_gtpv2(void) { "UTRAN", "gtpv2.mm_context.una", FT_BOOLEAN, 8, TFS(&tfs_not_allowed_allowed), 0x01, NULL, HFILL } - }, + }, { &hf_gtpv2_gena, { "GERAN", "gtpv2.mm_context.gena", FT_BOOLEAN, 8, TFS(&tfs_not_allowed_allowed), 0x02, @@ -6652,8 +6661,8 @@ void proto_register_gtpv2(void) &ett_gtpv2_supp_codec_list, &ett_gtpv2_bss_con, &ett_gtpv2_mm_context_auth_qua, - &ett_gtpv2_mm_context_auth_qui, - &ett_gtpv2_mm_context_auth_tri, + &ett_gtpv2_mm_context_auth_qui, + &ett_gtpv2_mm_context_auth_tri, &ett_gtpv2_mm_context_net_cap, &ett_gtpv2_ms_network_capability, &ett_gtpv2_vd_pref, diff --git a/epan/dissectors/packet-nas_eps.c b/epan/dissectors/packet-nas_eps.c index 4b4f4d1968..e35f1cd352 100644 --- a/epan/dissectors/packet-nas_eps.c +++ b/epan/dissectors/packet-nas_eps.c @@ -330,31 +330,31 @@ const value_string nas_eps_common_elem_strings[] = { /* Utility functions */ static guint16 -calc_bitrate(guint8 value){ +calc_bitrate(guint8 value) { guint16 return_value = value; - if (value > 63 && value <= 127) { + if ((value > 63) && (value <= 127)) { return_value = 64 + (value - 64) * 8; } - else if (value > 127 && value <= 254) { + else if ((value > 127) && (value <= 254)) { return_value = 576 + (value - 128) * 64; } - else if (value==0xff) { + else if (value == 0xff) { return_value = 0; } return return_value; } static guint32 -calc_bitrate_ext(guint8 value){ +calc_bitrate_ext(guint8 value) { guint32 return_value = 0; - if (value > 0 && value <= 0x4a) { + if ((value > 0) && (value <= 0x4a)) { return_value = 8600 + value * 100; } - else if (value > 0x4a && value <= 0xba) { + else if ((value > 0x4a) && (value <= 0xba)) { return_value = 16 + (value-0x4a); } - else if (value > 0xba && value <= 0xfa) { + else if ((value > 0xba) && (value <= 0xfa)) { return_value = 128 + (value-0xba)*2; } else { @@ -394,20 +394,20 @@ de_eps_cmn_add_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 { proto_item *item; proto_tree *sub_tree; - tvbuff_t *new_tvb; + tvbuff_t *new_tvb; - item = proto_tree_add_item(tree, hf_nas_eps_cmn_add_info, tvb, offset, len, ENC_NA); + item = proto_tree_add_item(tree, hf_nas_eps_cmn_add_info, tvb, offset, len, ENC_NA); sub_tree = proto_item_add_subtree(item, ett_nas_eps_cmn_add_info); new_tvb = tvb_new_subset(tvb, offset, len, len); switch (eps_nas_gen_msg_cont_type) { - case 1: - /* LPP */ - dissect_lcsap_Correlation_ID_PDU(new_tvb, pinfo, sub_tree); - break; - default: - break; + case 1: + /* LPP */ + dissect_lcsap_Correlation_ID_PDU(new_tvb, pinfo, sub_tree); + break; + default: + break; } return(len); @@ -704,7 +704,7 @@ de_emm_add_upd_res(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guin guint32 curr_offset, bit_offset; curr_offset = offset; - bit_offset = (curr_offset<<3)+4; + bit_offset = (curr_offset<<3)+4; proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, bit_offset, 2, ENC_BIG_ENDIAN); bit_offset += 2; @@ -727,7 +727,7 @@ de_emm_add_upd_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gui guint32 curr_offset, bit_offset; curr_offset = offset; - bit_offset = (curr_offset<<3)+4; + bit_offset = (curr_offset<<3)+4; proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, bit_offset, 3, ENC_BIG_ENDIAN); bit_offset += 3; @@ -943,11 +943,11 @@ static const value_string nas_eps_emm_eps_att_type_vals[] = { static char * unpack_eps_mid_digits(tvbuff_t *tvb) { - int length; - guint8 octet; - int i=0; - int offset = 0; - char *digit_str; + int length; + guint8 octet; + int i = 0; + int offset = 0; + char *digit_str; length = tvb_length(tvb); @@ -959,7 +959,7 @@ unpack_eps_mid_digits(tvbuff_t *tvb) { offset++; /* Loop on following octets to retrieve other identity digits */ - while ( offset < length ){ + while ( offset < length ) { octet = tvb_get_guint8(tvb,offset); digit_str[i] = ((octet & 0x0f) + '0'); @@ -996,9 +996,9 @@ static const value_string nas_eps_emm_type_of_id_vals[] = { static guint16 de_emm_eps_mid(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) { - guint32 curr_offset; - guint8 octet; - char *digit_str; + guint32 curr_offset; + guint8 octet; + char *digit_str; tvbuff_t *new_tvb; curr_offset = offset; @@ -1007,7 +1007,7 @@ de_emm_eps_mid(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 /* Type of identity (octet 3) */ proto_tree_add_item(tree, hf_nas_eps_emm_odd_even, tvb, curr_offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_nas_eps_emm_type_of_id, tvb, curr_offset, 1, ENC_BIG_ENDIAN); - switch (octet&0x7){ + switch (octet&0x7) { case 1: /* IMSI */ new_tvb = tvb_new_subset(tvb, curr_offset, len, len ); @@ -1128,8 +1128,8 @@ de_emm_esm_msg_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gui { proto_item *item; proto_tree *sub_tree; - tvbuff_t *new_tvb; - guint32 curr_offset; + tvbuff_t *new_tvb; + guint32 curr_offset; curr_offset = offset; @@ -1181,7 +1181,7 @@ static guint16 de_emm_nas_imeisv_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) { guint32 curr_offset; - int bit_offset; + int bit_offset; curr_offset = offset; @@ -1200,7 +1200,7 @@ static guint16 de_emm_nas_ksi_and_seq_no(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) { guint32 curr_offset; - int bit_offset; + int bit_offset; curr_offset = offset; bit_offset = curr_offset<<3; @@ -1254,7 +1254,7 @@ de_emm_nas_key_set_id_bits(tvbuff_t *tvb, proto_tree *tree, guint32 bit_offset, bit_offset++; /* NAS key set identifier (octet 1) */ item = proto_tree_add_bits_item(tree, hf_nas_eps_emm_nas_key_set_id, tvb, bit_offset, 3, ENC_BIG_ENDIAN); - if(add_string){ + if (add_string) { proto_item_append_text(item, "%s", add_string); } /*bit_offset+=3;*/ @@ -1292,8 +1292,8 @@ de_emm_nas_msg_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gui { proto_item *item; proto_tree *sub_tree; - tvbuff_t *new_tvb; - guint32 curr_offset; + tvbuff_t *new_tvb; + guint32 curr_offset; curr_offset = offset; @@ -1306,7 +1306,7 @@ de_emm_nas_msg_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gui sub_tree = proto_item_add_subtree(item, ett_nas_eps_nas_msg_cont); new_tvb = tvb_new_subset(tvb, curr_offset, len, len ); - if(gsm_a_dtap_handle) + if (gsm_a_dtap_handle) call_dissector(gsm_a_dtap_handle, new_tvb, gpinfo, sub_tree); return(len); @@ -1343,7 +1343,7 @@ static const value_string nas_eps_emm_toc_vals[] = { static guint16 de_emm_nas_sec_alsgs(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) { - int bit_offset; + int bit_offset; guint32 curr_offset; curr_offset = offset; @@ -1493,16 +1493,16 @@ de_emm_trac_area_id_lst(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, tol = octet >> 5; n_elem = (octet & 0x1f)+1; item = proto_tree_add_item(tree, hf_nas_eps_emm_tai_n_elem, tvb, curr_offset, 1, ENC_BIG_ENDIAN); - if(n_elem<16) + if (n_elem<16) proto_item_append_text(item, " [+1 = %u element(s)]", n_elem); curr_offset++; - if (tol>2){ + if (tol>2) { proto_tree_add_text(tree, tvb, curr_offset, len-(curr_offset-offset) , "Unknown type of list ( Not in 3GPP TS 24.301 version 8.1.0 Release 8 )"); return len; } - switch(tol){ + switch (tol) { case 0: /* MCC digit 2 MCC digit 1 octet 2 * MNC digit 3 MCC digit 3 octet 3 @@ -1517,7 +1517,7 @@ de_emm_trac_area_id_lst(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, * TAC k octet 2k+3* * TAC k (continued) octet 2k+4* */ - if (len < (guint)(4+(n_elem*2))){ + if (len < (guint)(4+(n_elem*2))) { proto_tree_add_text(tree, tvb, curr_offset, len-1 , "[Wrong number of elements?]"); return len; } @@ -1536,12 +1536,12 @@ de_emm_trac_area_id_lst(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, curr_offset+=2; break; case 2: - if (len< (guint)(1+(n_elem*5))){ + if (len< (guint)(1+(n_elem*5))) { proto_tree_add_text(tree, tvb, curr_offset, len-1 , "[Wrong number of elements?]"); return len; } - for (i=0; i < n_elem; i++){ + for (i=0; i < n_elem; i++) { /* type of list = "001" */ /* MCC digit 2 MCC digit 1 octet 2 * MNC digit 3 MCC digit 3 octet 3 @@ -1783,7 +1783,7 @@ de_emm_ue_sec_cap(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint /* Octets 5, 6, and 7 are optional. If octet 5 is included, * then also octet 6 shall be included and octet 7 may be included. */ - if(len==2) + if (len == 2) return(len); /* UMTS encryption algorithms supported (octet 5) */ @@ -1824,7 +1824,7 @@ de_emm_ue_sec_cap(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint proto_tree_add_item(tree, hf_nas_eps_emm_uia7, tvb, curr_offset, 1, ENC_BIG_ENDIAN); curr_offset++; - if(len==4) + if (len == 4) return(len); /* Bit 8 of octet 7 is spare and shall be coded as zero. */ @@ -1912,7 +1912,7 @@ de_emm_lcs_ind(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 static guint16 de_emm_lcs_client_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) { - guint32 curr_offset; + guint32 curr_offset; tvbuff_t *new_tvb; curr_offset = offset; @@ -1958,7 +1958,7 @@ de_emm_gen_msg_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 { proto_item *item; proto_tree *sub_tree; - tvbuff_t *new_tvb; + tvbuff_t *new_tvb; item = proto_tree_add_item(tree, hf_nas_eps_gen_msg_cont, tvb, offset, len, ENC_NA); sub_tree = proto_item_add_subtree(item, ett_nas_eps_gen_msg_cont); @@ -1966,20 +1966,20 @@ de_emm_gen_msg_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 new_tvb = tvb_new_subset(tvb, offset, len, len); switch (eps_nas_gen_msg_cont_type) { - case 1: - /* LPP */ - if (lpp_handle) { - call_dissector(lpp_handle, new_tvb, pinfo, sub_tree); - } - break; - case 2: - /* Location services */ - if (gsm_a_dtap_handle) { - call_dissector(gsm_a_dtap_handle, new_tvb, pinfo, sub_tree); - } - break; - default: - break; + case 1: + /* LPP */ + if (lpp_handle) { + call_dissector(lpp_handle, new_tvb, pinfo, sub_tree); + } + break; + case 2: + /* Location services */ + if (gsm_a_dtap_handle) { + call_dissector(gsm_a_dtap_handle, new_tvb, pinfo, sub_tree); + } + break; + default: + break; } return(len); @@ -2006,18 +2006,18 @@ static guint16 de_esm_apn_aggr_max_br(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) { guint32 curr_offset; - guint8 octet; + guint8 octet; guint32 dl_total = 0; guint32 ul_total = 0; - guint32 bitrate = 0; + guint32 bitrate = 0; curr_offset = offset; /* APN-AMBR for downlink octet 3 */ octet = tvb_get_guint8(tvb,curr_offset); - if(octet==0){ + if (octet == 0) { proto_tree_add_uint_format(tree, hf_nas_eps_emm_apn_ambr_dl, tvb, curr_offset, 1, octet, "Reserved"); - }else{ + } else { bitrate = calc_bitrate(octet); dl_total += bitrate; proto_tree_add_uint_format(tree, hf_nas_eps_emm_apn_ambr_dl, tvb, curr_offset, 1, octet, @@ -2027,10 +2027,10 @@ de_esm_apn_aggr_max_br(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, /* APN-AMBR for uplink octet 4 */ octet = tvb_get_guint8(tvb,curr_offset); - if(octet==0){ + if (octet == 0) { proto_tree_add_uint_format(tree, hf_nas_eps_emm_apn_ambr_ul, tvb, curr_offset, 1, octet, "Reserved"); - }else{ + } else { bitrate = calc_bitrate(octet); ul_total += bitrate; proto_tree_add_uint_format(tree, hf_nas_eps_emm_apn_ambr_ul, tvb, curr_offset, 1, octet, @@ -2041,10 +2041,10 @@ de_esm_apn_aggr_max_br(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, return(len); /* APN-AMBR for downlink (extended) octet 5 */ octet = tvb_get_guint8(tvb,curr_offset); - if(octet==0){ + if (octet == 0) { proto_tree_add_uint_format(tree, hf_nas_eps_emm_apn_ambr_dl_ext, tvb, curr_offset, 1, octet, "Use the value indicated by the APN-AMBR for downlink"); - }else{ + } else { bitrate = calc_bitrate_ext(octet); dl_total += (octet > 0x4a) ? bitrate*1000 : bitrate; proto_tree_add_uint_format(tree, hf_nas_eps_emm_apn_ambr_dl_ext, tvb, curr_offset, 1, octet, @@ -2069,10 +2069,10 @@ de_esm_apn_aggr_max_br(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, return(len); /* APN-AMBR for uplink (extended) octet 6 */ octet = tvb_get_guint8(tvb,curr_offset); - if(octet==0){ + if (octet == 0) { proto_tree_add_uint_format(tree, hf_nas_eps_emm_apn_ambr_ul_ext, tvb, curr_offset, 1, octet, "Use the value indicated by the APN-AMBR for uplink"); - }else{ + } else { bitrate = calc_bitrate_ext(octet); ul_total += (octet > 0x4a) ? bitrate*1000 : bitrate; proto_tree_add_uint_format(tree, hf_nas_eps_emm_apn_ambr_ul_ext, tvb, curr_offset, 1, octet, @@ -2097,10 +2097,10 @@ de_esm_apn_aggr_max_br(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, return(len); /* APN-AMBR for downlink (extended-2) octet 7 */ octet = tvb_get_guint8(tvb,curr_offset); - if((octet==0)||(octet==0xff)){ + if ((octet == 0)||(octet == 0xff)) { proto_tree_add_uint_format(tree, hf_nas_eps_emm_apn_ambr_dl_ext2, tvb, curr_offset, 1, octet, "Use the value indicated by the APN-AMBR for downlink and APN-AMBR for downlink (extended)"); - }else{ + } else { dl_total += octet*256*1000; proto_tree_add_uint_format(tree, hf_nas_eps_emm_apn_ambr_dl_ext2, tvb, curr_offset, 1, octet, "APN-AMBR for downlink (extended-2) : %u Mbps", @@ -2112,10 +2112,10 @@ de_esm_apn_aggr_max_br(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, return(len); /* APN-AMBR for uplink (extended-2) octet 8 */ octet = tvb_get_guint8(tvb,curr_offset); - if((octet==0)||(octet==0xff)){ + if ((octet == 0)||(octet == 0xff)) { proto_tree_add_uint_format(tree, hf_nas_eps_emm_apn_ambr_ul_ext2, tvb, curr_offset, 1, octet, "Use the value indicated by the APN-AMBR for uplink and APN-AMBR for downlink (extended)"); - }else{ + } else { ul_total += octet*256*1000; proto_tree_add_uint_format(tree, hf_nas_eps_emm_apn_ambr_ul_ext2, tvb, curr_offset, 1, octet, "APN-AMBR for uplink (extended-2) : %u Mbps", @@ -2154,7 +2154,7 @@ static guint16 de_esm_qos(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) { guint32 curr_offset; - guint8 octet; + guint8 octet; curr_offset = offset; @@ -2165,10 +2165,10 @@ de_esm_qos(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offs return(len); /* Maximum bit rate for uplink octet 4 */ octet = tvb_get_guint8(tvb,curr_offset); - if(octet==0){ + if (octet == 0) { proto_tree_add_uint_format(tree, hf_nas_eps_mbr_ul, tvb, curr_offset, 1, octet, "UE->NW Subscribed maximum bit rate for uplink/ NW->UE Reserved"); - }else{ + } else { proto_tree_add_uint_format(tree, hf_nas_eps_mbr_ul, tvb, curr_offset, 1, octet, "Maximum bit rate for uplink : %u kbps", calc_bitrate(octet)); } @@ -2177,10 +2177,10 @@ de_esm_qos(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offs return(len); /* Maximum bit rate for downlink octet 5 */ octet = tvb_get_guint8(tvb,curr_offset); - if(octet==0){ + if (octet == 0) { proto_tree_add_uint_format(tree, hf_nas_eps_mbr_dl, tvb, curr_offset, 1, octet, "UE->NW Subscribed maximum bit rate for downlink/ NW->UE Reserved"); - }else{ + } else { proto_tree_add_uint_format(tree, hf_nas_eps_mbr_dl, tvb, curr_offset, 1, octet, "Maximum bit rate for downlink : %u kbps", calc_bitrate(octet)); } @@ -2205,10 +2205,10 @@ de_esm_qos(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offs return(len); /* Maximum bit rate for uplink (extended) octet 8 */ octet = tvb_get_guint8(tvb,curr_offset); - if(octet==0){ + if (octet == 0) { proto_tree_add_uint_format(tree, hf_nas_eps_embr_ul, tvb, curr_offset, 1, octet, "Use the value indicated by the maximum bit rate for uplink in octet 4."); - }else{ + } else { proto_tree_add_uint_format(tree, hf_nas_eps_embr_ul, tvb, curr_offset, 1, octet, "Maximum bit rate for uplink(extended) : %u %s", calc_bitrate_ext(octet), @@ -2219,10 +2219,10 @@ de_esm_qos(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offs return(len); /* Maximum bit rate for downlink (extended) octet 9 */ octet = tvb_get_guint8(tvb,curr_offset); - if(octet==0){ + if (octet == 0) { proto_tree_add_uint_format(tree, hf_nas_eps_embr_ul, tvb, curr_offset, 1, octet, "Use the value indicated by the maximum bit rate for downlink in octet 5."); - }else{ + } else { proto_tree_add_uint_format(tree, hf_nas_eps_embr_ul, tvb, curr_offset, 1, octet, "Maximum bit rate for downlink(extended) : %u %s", calc_bitrate_ext(octet), @@ -2233,10 +2233,10 @@ de_esm_qos(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offs return(len); /* Guaranteed bit rate for uplink (extended) octet 10 */ octet = tvb_get_guint8(tvb,curr_offset); - if(octet==0){ + if (octet == 0) { proto_tree_add_uint_format(tree, hf_nas_eps_embr_ul, tvb, curr_offset, 1, octet, "Use the value indicated by the Guaranteed bit rate for uplink in octet 6."); - }else{ + } else { proto_tree_add_uint_format(tree, hf_nas_eps_embr_ul, tvb, curr_offset, 1, octet, "Guaranteed bit rate for uplink(extended) : %u %s", calc_bitrate_ext(octet), @@ -2247,10 +2247,10 @@ de_esm_qos(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offs return(len); /* Guaranteed bit rate for downlink (extended) octet 11 */ octet = tvb_get_guint8(tvb,curr_offset); - if(octet==0){ + if (octet == 0) { proto_tree_add_uint_format(tree, hf_nas_eps_embr_ul, tvb, curr_offset, 1, octet, "Use the value indicated by the Guaranteed bit rate for downlink in octet 7."); - }else{ + } else { proto_tree_add_uint_format(tree, hf_nas_eps_embr_ul, tvb, curr_offset, 1, octet, "Guaranteed bit rate for downlink(extended) : %u %s", calc_bitrate_ext(octet), @@ -2420,7 +2420,7 @@ static guint16 de_esm_pdn_addr(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) { guint32 curr_offset; - guint8 pdn_type; + guint8 pdn_type; curr_offset = offset; @@ -2430,7 +2430,7 @@ de_esm_pdn_addr(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 proto_tree_add_item(tree, hf_nas_eps_esm_pdn_type, tvb, curr_offset, 1, ENC_BIG_ENDIAN); curr_offset++; - switch(pdn_type){ + switch (pdn_type) { case 1: /* IPv4 */ proto_tree_add_item(tree, hf_nas_eps_esm_pdn_ipv4, tvb, curr_offset, 4, ENC_BIG_ENDIAN); @@ -2495,11 +2495,11 @@ static const value_string nas_eps_esm_pdn_type_values[] = { * See subclause 10.5.6.17 in 3GPP TS 24.008 */ static const value_string nas_eps_esm_request_type_values[] = { - { 0x1, "initial request" }, - { 0x2, "Handover" }, - { 0x3, "Unused; shall be interpreted as initial request if received by the network" }, - { 0x4, "emergency" }, - { 0, NULL } + { 0x1, "initial request" }, + { 0x2, "Handover" }, + { 0x3, "Unused; shall be interpreted as initial request if received by the network" }, + { 0x4, "emergency" }, + { 0, NULL } }; /* @@ -2661,7 +2661,7 @@ nas_emm_attach_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guin guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* Spare half octet Spare half octet 9.9.2.7 M V 1/2 */ bit_offset = curr_offset<<3; @@ -2715,7 +2715,7 @@ nas_emm_attach_comp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gui guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* ESM message container ESM message container 9.9.3.15 M LV-E 2-n */ ELEM_MAND_LV_E(NAS_PDU_TYPE_EMM, DE_EMM_ESM_MSG_CONT, NULL); @@ -2735,7 +2735,7 @@ nas_emm_attach_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guin guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* * EMM cause EMM cause 9.9.3.9 M V 1 */ ELEM_MAND_V(NAS_PDU_TYPE_EMM, DE_EMM_CAUSE, NULL); @@ -2756,7 +2756,7 @@ nas_emm_attach_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guin guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; bit_offset = curr_offset<<3; @@ -2819,7 +2819,7 @@ nas_emm_attach_fail(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gui guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* EMM cause EMM cause 9.9.3.9 M V 1 */ ELEM_MAND_V(NAS_PDU_TYPE_EMM, DE_EMM_CAUSE, NULL); @@ -2844,7 +2844,7 @@ nas_emm_auth_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint3 guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; bit_offset = curr_offset<<3; /* H1 */ @@ -2885,7 +2885,7 @@ nas_emm_auth_resp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* * Authentication response parameter 9.9.3.4 M LV 5-17 @@ -2907,7 +2907,7 @@ nas_emm_cs_serv_not(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gui guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* Paging identity Paging identity 9.9.3.25A M V 1 */ ELEM_MAND_V(NAS_PDU_TYPE_EMM, DE_EMM_PAGING_ID, NULL); @@ -2942,7 +2942,7 @@ nas_emm_detach_req_UL(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, g guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; proto_tree_add_text(tree, tvb, curr_offset, len,"Up link"); /* NAS key set identifier NAS key set identifier 9.9.3.21 M V 1/2 */ @@ -2975,7 +2975,7 @@ nas_emm_detach_req_DL(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, g guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; proto_tree_add_text(tree, tvb, curr_offset, len,"Down link"); /* Spare half octet Spare half octet 9.9.2.7 M V 1/2 */ @@ -2994,7 +2994,7 @@ nas_emm_detach_req_DL(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, g curr_offset++; /* No more mandatory elements */ - if (curr_len==0) + if (curr_len == 0) return; /* EMM cause EMM cause 9.9.3.9 O TV 2 */ @@ -3013,11 +3013,11 @@ nas_emm_detach_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 curr_offset = offset; /*curr_len = len;*/ - if (pinfo){ - if(pinfo->link_dir==P2P_DIR_UL){ + if (pinfo) { + if (pinfo->link_dir == P2P_DIR_UL) { nas_emm_detach_req_UL(tvb, tree, pinfo, offset, len); return; - }else if(pinfo->link_dir==P2P_DIR_DL){ + }else if (pinfo->link_dir == P2P_DIR_DL) { nas_emm_detach_req_DL(tvb, tree, pinfo, offset, len); return; } @@ -3043,7 +3043,7 @@ nas_emm_dl_nas_trans(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gu guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; pinfo->link_dir = P2P_DIR_DL; @@ -3063,7 +3063,7 @@ nas_emm_emm_inf(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* 43 Full name for network Network name 9.9.3.24 O TLV 3-? */ ELEM_OPT_TLV(0x43, GSM_A_PDU_TYPE_DTAP, DE_NETWORK_NAME, " - Full name for network"); @@ -3091,7 +3091,7 @@ nas_emm_emm_status(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guin guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* EMM cause EMM cause 9.9.3.9 M V 1 */ ELEM_MAND_V(NAS_PDU_TYPE_EMM, DE_EMM_CAUSE, NULL); @@ -3110,7 +3110,7 @@ nas_emm_ext_serv_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gu guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; bit_offset = curr_offset<<3; @@ -3144,7 +3144,7 @@ nas_emm_guti_realloc_cmd(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_ guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* GUTI EPS mobile identity 9.9.3.12 M LV 12 */ ELEM_MAND_LV(NAS_PDU_TYPE_EMM, DE_EMM_EPS_MID, " - GUTI"); @@ -3171,7 +3171,7 @@ nas_emm_id_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; bit_offset=curr_offset<<3; @@ -3203,7 +3203,7 @@ nas_emm_id_res(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* Mobile identity Mobile identity 9.9.2.3 M LV 4-10 */ ELEM_MAND_LV(NAS_PDU_TYPE_COMMON, DE_EPS_CMN_MOB_ID, NULL); @@ -3224,7 +3224,7 @@ nas_emm_sec_mode_cmd(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gu guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* Selected NAS security algorithms NAS security algorithms 9.9.3.23 M V 1 */ ELEM_MAND_V(NAS_PDU_TYPE_EMM, DE_EMM_NAS_SEC_ALGS, " - Selected NAS security algorithms"); @@ -3263,7 +3263,7 @@ nas_emm_sec_mode_comp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, g guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; if (curr_len == 0) return; @@ -3284,7 +3284,7 @@ nas_emm_sec_mode_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gu guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* EMM cause EMM cause 9.9.3.9 M V 1 */ ELEM_MAND_V(NAS_PDU_TYPE_EMM, DE_EMM_CAUSE, NULL); @@ -3303,7 +3303,7 @@ nas_emm_sec_prot_msg(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gu guint8 security_header_type; curr_offset = offset; - curr_len = len; + curr_len = len; /* Security header type Security header type 9.3.1 M V 1/2 */ security_header_type = tvb_get_guint8(tvb,offset)>>4; @@ -3312,16 +3312,16 @@ nas_emm_sec_prot_msg(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gu proto_tree_add_item(tree, hf_gsm_a_L3_protocol_discriminator, tvb, 0, 1, ENC_BIG_ENDIAN); offset++; /* Message authentication code Message authentication code 9.5 M V 4 */ - if (security_header_type !=0){ + if (security_header_type != 0) { /* Message authentication code */ proto_tree_add_item(tree, hf_nas_eps_msg_auth_code, tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4; - if ((security_header_type==2)||(security_header_type==4)){ + if ((security_header_type == 2)||(security_header_type == 4)) { /* Integrity protected and ciphered = 2, Integrity protected and ciphered with new EPS security context = 4 */ proto_tree_add_text(tree, tvb, offset, len-5,"Ciphered message"); return offset; } - }else{ + } else { proto_tree_add_text(tree, tvb, offset, len,"Not a security protected message"); return offset; } @@ -3343,7 +3343,7 @@ nas_emm_serv_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint3 guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* EMM cause EMM cause 9.9.3.9 M V 1 */ ELEM_MAND_V(NAS_PDU_TYPE_EMM, DE_EMM_CAUSE, NULL); @@ -3373,7 +3373,7 @@ nas_emm_service_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gui guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* KSI and sequence number 9.9.3.19 M V 1 */ ELEM_MAND_V(NAS_PDU_TYPE_EMM, DE_EMM_KSI_AND_SEQ_NO, NULL); @@ -3395,7 +3395,7 @@ nas_emm_trac_area_upd_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* Spare half octet Spare half octet 9.9.2.7 M V 1/2 */ bit_offset = curr_offset<<3; @@ -3410,7 +3410,7 @@ nas_emm_trac_area_upd_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U curr_len--; curr_offset++; /* No more mandatory elements */ - if (curr_len==0) + if (curr_len == 0) return; /* 5A T3412 value GPRS timer 9.9.3.16 O TV 2 */ ELEM_OPT_TV(0x5a, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER, " - T3412 value"); @@ -3456,7 +3456,7 @@ nas_emm_trac_area_upd_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* EMM cause EMM cause 9.9.3.9 M V 1 */ ELEM_MAND_V(NAS_PDU_TYPE_EMM, DE_EMM_CAUSE, NULL); @@ -3475,7 +3475,7 @@ nas_emm_trac_area_upd_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; bit_offset = curr_offset<<3; @@ -3547,7 +3547,7 @@ nas_emm_ul_nas_trans(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gu guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; pinfo->link_dir = P2P_DIR_UL; @@ -3568,7 +3568,7 @@ nas_emm_dl_gen_nas_trans(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_ guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; pinfo->link_dir = P2P_DIR_DL; @@ -3595,7 +3595,7 @@ nas_emm_ul_gen_nas_trans(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_ guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; pinfo->link_dir = P2P_DIR_UL; @@ -3625,7 +3625,7 @@ nas_esm_act_ded_eps_bearer_ctx_acc(tvbuff_t *tvb, proto_tree *tree, packet_info guint32 consumed; guint curr_len; - if(len==0) + if (len == 0) return; curr_offset = offset; @@ -3651,7 +3651,7 @@ nas_esm_act_ded_eps_bearer_ctx_rej(tvbuff_t *tvb, proto_tree *tree, packet_info guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* This message is sent by UE to the network to reject activation of a dedicated EPS bearer context */ pinfo->link_dir = P2P_DIR_UL; @@ -3674,7 +3674,7 @@ nas_esm_act_ded_eps_bearer_ctx_req(tvbuff_t *tvb, proto_tree *tree, packet_info guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* This message is sent by the network to the UE to request activation of a dedicated EPS bearer context... */ pinfo->link_dir = P2P_DIR_DL; @@ -3722,9 +3722,9 @@ nas_esm_act_def_eps_bearer_ctx_acc(tvbuff_t *tvb, proto_tree *tree, packet_info guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; - if(len==0) + if (len == 0) return; /* This message is sent by the UE to the network to acknowledge activation of a default EPS bearer context */ @@ -3747,7 +3747,7 @@ nas_esm_act_def_eps_bearer_ctx_rej(tvbuff_t *tvb, proto_tree *tree, packet_info guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* This message is sent by UE to the network to reject activation of a default EPS bearer context. */ pinfo->link_dir = P2P_DIR_UL; @@ -3771,7 +3771,7 @@ nas_esm_act_def_eps_bearer_ctx_req(tvbuff_t *tvb, proto_tree *tree, packet_info guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* This message is sent by the network to the UE to request activation of a default EPS bearer context. */ pinfo->link_dir = P2P_DIR_DL; @@ -3813,7 +3813,7 @@ nas_esm_bearer_res_all_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* This message is sent by the network to the UE to reject the allocation of a dedicated bearer resource. */ pinfo->link_dir = P2P_DIR_DL; @@ -3837,7 +3837,7 @@ nas_esm_bearer_res_all_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* This message is sent by the UE to the network to request the allocation of a dedicated bearer resource. */ pinfo->link_dir = P2P_DIR_UL; @@ -3873,7 +3873,7 @@ nas_esm_bearer_res_mod_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* This message is sent by the network to the UE to reject the modification of a dedicated bearer resource. */ pinfo->link_dir = P2P_DIR_DL; @@ -3896,7 +3896,7 @@ nas_esm_bearer_res_mod_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* This message is sent by the UE to the network to request the modification of a dedicated bearer resource. */ pinfo->link_dir = P2P_DIR_UL; @@ -3933,9 +3933,9 @@ nas_esm_deact_eps_bearer_ctx_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *p guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; - if(len==0) + if (len == 0) return; /* This message is sent by the UE to acknowledge deactivation of the EPS bearer context... */ @@ -3957,7 +3957,7 @@ nas_esm_deact_eps_bearer_ctx_req(tvbuff_t *tvb, proto_tree *tree, packet_info *p guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* This message is sent by the network to request deactivation of an active EPS bearer context. */ pinfo->link_dir = P2P_DIR_DL; @@ -3981,7 +3981,7 @@ nas_esm_inf_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; EXTRANEOUS_DATA_CHECK(curr_len, 0); } @@ -3996,9 +3996,9 @@ nas_esm_inf_resp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 of guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; - if(len==0) + if (len == 0) return; /* This message is sent by the UE to the network in response to an ESM INFORMATION REQUEST... */ @@ -4022,7 +4022,7 @@ nas_esm_status(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* ESM cause ESM cause 9.9.4.4 M V 1 */ ELEM_MAND_V(NAS_PDU_TYPE_ESM, DE_ESM_CAUSE, NULL); @@ -4040,9 +4040,9 @@ nas_esm_mod_eps_bearer_ctx_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pin guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; - if(len==0) + if (len == 0) return; /* This message is sent by the UE to the network to acknowledge the modification of an active EPS bearer context. */ @@ -4064,7 +4064,7 @@ nas_esm_mod_eps_bearer_ctx_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pin guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* This message is sent by the UE or the network to reject a modification of an active EPS bearer context. */ pinfo->link_dir = P2P_DIR_UL; @@ -4087,9 +4087,9 @@ nas_esm_mod_eps_bearer_ctx_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pin guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; - if(len==0) + if (len == 0) return; /*This message is sent by the network to inform the UE about events which are relevant for the upper layer... */ @@ -4125,7 +4125,7 @@ nas_esm_notification(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, gu guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* Notification indicator Notification indicator 9.9.4.7A M LV 2 */ ELEM_MAND_LV(NAS_PDU_TYPE_ESM, DE_ESM_NOTIF_IND, NULL); @@ -4144,7 +4144,7 @@ nas_esm_pdn_con_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /*This message is sent by the network to the UE to reject establishment of a PDN connection. */ pinfo->link_dir = P2P_DIR_DL; @@ -4166,10 +4166,10 @@ nas_esm_pdn_con_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 guint32 curr_offset; guint32 consumed; guint curr_len; - int bit_offset; + int bit_offset; curr_offset = offset; - curr_len = len; + curr_len = len; /*This message is sent by the UE to the network to initiate establishment of a PDN connection. */ pinfo->link_dir = P2P_DIR_UL; @@ -4208,7 +4208,7 @@ nas_esm_pdn_disc_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint3 guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /*This message is sent by the UE to the network to initiate establishment of a PDN connection. */ pinfo->link_dir = P2P_DIR_UL; @@ -4231,7 +4231,7 @@ nas_esm_pdn_disc_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint3 guint curr_len; curr_offset = offset; - curr_len = len; + curr_len = len; /* This message is sent by the network to the UE to reject release of a PDN connection. */ pinfo->link_dir = P2P_DIR_DL; @@ -4290,9 +4290,9 @@ get_nas_esm_msg_params(guint8 oct, const gchar **msg_str, int *ett_tree, int *hf { gint idx; - *msg_str = match_strval_idx_ext((guint32) (oct & 0xff), &nas_msg_esm_strings_ext, &idx); - *ett_tree = ett_nas_msg_esm[idx]; - *hf_idx = hf_nas_eps_msg_esm_type; + *msg_str = match_strval_idx_ext((guint32) (oct & 0xff), &nas_msg_esm_strings_ext, &idx); + *ett_tree = ett_nas_msg_esm[idx]; + *hf_idx = hf_nas_eps_msg_esm_type; *msg_fcn_p = nas_msg_esm_fcn[idx]; return; @@ -4346,9 +4346,9 @@ get_nas_emm_msg_params(guint8 oct, const gchar **msg_str, int *ett_tree, int *hf { gint idx; - *msg_str = match_strval_idx_ext((guint32) (oct & 0xff), &nas_msg_emm_strings_ext, &idx); - *ett_tree = ett_nas_msg_emm[idx]; - *hf_idx = hf_nas_eps_msg_emm_type; + *msg_str = match_strval_idx_ext((guint32) (oct & 0xff), &nas_msg_emm_strings_ext, &idx); + *ett_tree = ett_nas_msg_emm[idx]; + *hf_idx = hf_nas_eps_msg_emm_type; *msg_fcn_p = nas_msg_emm_fcn[idx]; return; @@ -4361,12 +4361,12 @@ get_nas_emm_msg_params(guint8 oct, const gchar **msg_str, int *ett_tree, int *hf static void disect_nas_eps_esm_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) { - const gchar *msg_str; - guint32 len; - gint ett_tree; - int hf_idx; - void (*msg_fcn_p)(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len); - guint8 oct; + const gchar *msg_str; + guint32 len; + gint ett_tree; + int hf_idx; + void (*msg_fcn_p)(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len); + guint8 oct; len = tvb_length(tvb); /* @@ -4392,9 +4392,9 @@ disect_nas_eps_esm_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int get_nas_esm_msg_params(oct, &msg_str, &ett_tree, &hf_idx, &msg_fcn_p); - if(msg_str){ + if (msg_str) { col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, msg_str); - }else{ + } else { proto_tree_add_text(tree, tvb, offset, 1,"Unknown message 0x%x",oct); return; } @@ -4426,29 +4426,29 @@ disect_nas_eps_esm_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int static void dissect_nas_eps_emm_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, gboolean second_header) { - const gchar *msg_str; - guint32 len; - gint ett_tree; - int hf_idx; - void (*msg_fcn_p)(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len); - guint8 security_header_type, oct; + const gchar *msg_str; + guint32 len; + gint ett_tree; + int hf_idx; + void (*msg_fcn_p)(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len); + guint8 security_header_type, oct; len = tvb_length(tvb); /* 9.3.1 Security header type */ - if(second_header){ + if (second_header) { security_header_type = tvb_get_guint8(tvb,offset)>>4; proto_tree_add_item(tree, hf_nas_eps_security_header_type, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_gsm_a_L3_protocol_discriminator, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; - if (security_header_type !=0){ + if (security_header_type != 0) { /* Message authentication code */ proto_tree_add_item(tree, hf_nas_eps_msg_auth_code, tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4; /* Sequence number */ proto_tree_add_item(tree, hf_nas_eps_seq_no, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; - if ((security_header_type==2)||(security_header_type==4)) + if ((security_header_type == 2)||(security_header_type == 4)) /* Integrity protected and ciphered = 2, Integrity protected and ciphered with new EPS security context = 4 */ return; proto_tree_add_item(tree, hf_nas_eps_security_header_type, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -4465,9 +4465,9 @@ dissect_nas_eps_emm_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int get_nas_emm_msg_params(oct, &msg_str, &ett_tree, &hf_idx, &msg_fcn_p); - if(msg_str){ + if (msg_str) { col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, msg_str); - }else{ + } else { proto_tree_add_text(tree, tvb, offset, 1,"Unknown message 0x%x",oct); return; } @@ -4497,10 +4497,10 @@ dissect_nas_eps_emm_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int static void dissect_nas_eps_plain(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_item *item; - proto_tree *nas_eps_tree; + proto_item *item; + proto_tree *nas_eps_tree; guint8 pd; - int offset = 0; + int offset = 0; /* Save pinfo */ gpinfo = pinfo; @@ -4512,7 +4512,7 @@ dissect_nas_eps_plain(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) nas_eps_tree = proto_item_add_subtree(item, ett_nas_eps); pd = tvb_get_guint8(tvb,offset)&0x0f; - switch (pd){ + switch (pd) { case 2: /* EPS session management messages. * Ref 3GPP TS 24.007 version 8.0.0 Release 8, Table 11.2: Protocol discriminator values @@ -4529,7 +4529,7 @@ dissect_nas_eps_plain(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Special conformance testing functions for User Equipment messages. * Ref 3GPP TS 24.007 version 8.0.0 Release 8, Table 11.2: Protocol discriminator values */ - if (gsm_a_dtap_handle){ + if (gsm_a_dtap_handle) { tvbuff_t *new_tvb = tvb_new_subset_remaining(tvb, offset); call_dissector(gsm_a_dtap_handle, new_tvb,pinfo, nas_eps_tree); break; @@ -4577,10 +4577,10 @@ dissect_nas_eps_plain(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) static void dissect_nas_eps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_item *item; - proto_tree *nas_eps_tree; + proto_item *item; + proto_tree *nas_eps_tree; guint8 pd, security_header_type; - int offset = 0; + int offset = 0; guint32 len; guint32 msg_auth_code; @@ -4589,13 +4589,13 @@ dissect_nas_eps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* If the length of the tvbuffer is less than 8 octets, we can safely conclude the message is not protected. */ if (len < 8) { dissect_nas_eps_plain(tvb, pinfo, tree); - return; + return; } - if (g_nas_eps_dissect_plain) { - dissect_nas_eps_plain(tvb, pinfo, tree); - return; - } + if (g_nas_eps_dissect_plain) { + dissect_nas_eps_plain(tvb, pinfo, tree); + return; + } /* Save pinfo */ gpinfo = pinfo; @@ -4614,18 +4614,18 @@ dissect_nas_eps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) pd = tvb_get_guint8(tvb,offset)&0x0f; offset++; /* Message authentication code Message authentication code 9.5 M V 4 */ - if (security_header_type == 0){ - if(pd==7){ + if (security_header_type == 0) { + if (pd == 7) { /* Plain EPS mobility management messages. */ dissect_nas_eps_emm_msg(tvb, pinfo, nas_eps_tree, offset, ENC_BIG_ENDIAN); return; - }else{ + } else { proto_tree_add_text(tree, tvb, offset, len, "All ESM messages should be integrity protected"); return; } - }else{ + } else { /* SERVICE REQUEST (12) is not a plain NAS message treat separately */ - if (security_header_type == 12){ + if (security_header_type == 12) { col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "SERVICE REQUEST"); nas_emm_service_req(tvb, nas_eps_tree, pinfo, offset, len-offset); return; @@ -4634,27 +4634,27 @@ dissect_nas_eps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(nas_eps_tree, hf_nas_eps_msg_auth_code, tvb, offset, 4, ENC_BIG_ENDIAN); msg_auth_code = tvb_get_ntohl(tvb, offset); offset+=4; - if ((security_header_type==2)||(security_header_type==4)){ + if ((security_header_type == 2)||(security_header_type == 4)) { /* Possible ciphered message */ - if(msg_auth_code!=0){ + if (msg_auth_code != 0) { /* Sequence number Sequence number 9.6 M V 1 */ proto_tree_add_item(nas_eps_tree, hf_nas_eps_seq_no, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /* Integrity protected and ciphered = 2, Integrity protected and ciphered with new EPS security context = 4 */ - /* Read security_header_type AND pd */ + /* Read security_header_type AND pd */ pd = tvb_get_guint8(tvb,offset); /* If pd is in plaintext this message probably isn't ciphered */ - if((pd!=7)&&(pd!=2)&&(pd!=15)){ + if ((pd != 7) && (pd != 2) && (pd != 15)) { proto_tree_add_text(nas_eps_tree, tvb, offset, len-6,"Ciphered message"); return; } - }else{ + } else { /* msg_auth_code == 0, probably not ciphered */ /* Sequence number Sequence number 9.6 M V 1 */ proto_tree_add_item(nas_eps_tree, hf_nas_eps_seq_no, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; } - }else{ + } else { /* Sequence number Sequence number 9.6 M V 1 */ proto_tree_add_item(nas_eps_tree, hf_nas_eps_seq_no, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; @@ -4663,7 +4663,7 @@ dissect_nas_eps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* NAS message NAS message 9.7 M V 1-n */ pd = tvb_get_guint8(tvb,offset)&0x0f; - switch (pd){ + switch (pd) { case 2: /* EPS session management messages. * Ref 3GPP TS 24.007 version 8.0.0 Release 8, Table 11.2: Protocol discriminator values @@ -4680,7 +4680,7 @@ dissect_nas_eps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Special conformance testing functions for User Equipment messages. * Ref 3GPP TS 24.007 version 8.0.0 Release 8, Table 11.2: Protocol discriminator values */ - if (gsm_a_dtap_handle){ + if (gsm_a_dtap_handle) { tvbuff_t *new_tvb = tvb_new_subset_remaining(tvb, offset); call_dissector(gsm_a_dtap_handle, new_tvb, pinfo, nas_eps_tree); break; @@ -4703,9 +4703,9 @@ proto_reg_handoff_nas_eps(void) void proto_register_nas_eps(void) { - guint i; - guint last_offset; - module_t *nas_eps_module; + guint i; + guint last_offset; + module_t *nas_eps_module; /* List of fields */ @@ -5424,7 +5424,7 @@ proto_register_nas_eps(void) { NULL, HFILL } }, { &hf_nas_eps_esm_request_type, - { "Request type", "nas_eps.nas_eps_esm_request_type", + { "Request type", "nas_eps.nas_eps_esm_request_type", FT_UINT8, BASE_DEC, VALS(nas_eps_esm_request_type_values), 0x0, NULL, HFILL } }, diff --git a/epan/dissectors/packet-rsl.c b/epan/dissectors/packet-rsl.c index f17b934b1d..e77b39d4aa 100644 --- a/epan/dissectors/packet-rsl.c +++ b/epan/dissectors/packet-rsl.c @@ -117,23 +117,23 @@ static int hf_rsl_emlpp_prio = -1; static int hf_rsl_rtd = -1; static int hf_rsl_delay_ind = -1; static int hf_rsl_tfo = -1; -static int hf_rsl_speech_mode_s = -1; -static int hf_rsl_speech_mode_m = -1; -static int hf_rsl_conn_id = -1; -static int hf_rsl_rtp_payload = -1; -static int hf_rsl_rtp_csd_fmt_d = -1; -static int hf_rsl_rtp_csd_fmt_ir = -1; -static int hf_rsl_local_port = -1; -static int hf_rsl_remote_port = -1; -static int hf_rsl_local_ip = -1; -static int hf_rsl_remote_ip = -1; -static int hf_rsl_cstat_tx_pkts = -1; -static int hf_rsl_cstat_tx_octs = -1; -static int hf_rsl_cstat_rx_pkts = -1; -static int hf_rsl_cstat_rx_octs = -1; -static int hf_rsl_cstat_lost_pkts = -1; -static int hf_rsl_cstat_ia_jitter = -1; -static int hf_rsl_cstat_avg_tx_dly = -1; +static int hf_rsl_speech_mode_s = -1; +static int hf_rsl_speech_mode_m = -1; +static int hf_rsl_conn_id = -1; +static int hf_rsl_rtp_payload = -1; +static int hf_rsl_rtp_csd_fmt_d = -1; +static int hf_rsl_rtp_csd_fmt_ir = -1; +static int hf_rsl_local_port = -1; +static int hf_rsl_remote_port = -1; +static int hf_rsl_local_ip = -1; +static int hf_rsl_remote_ip = -1; +static int hf_rsl_cstat_tx_pkts = -1; +static int hf_rsl_cstat_tx_octs = -1; +static int hf_rsl_cstat_rx_pkts = -1; +static int hf_rsl_cstat_rx_octs = -1; +static int hf_rsl_cstat_lost_pkts = -1; +static int hf_rsl_cstat_ia_jitter = -1; +static int hf_rsl_cstat_avg_tx_dly = -1; /* Initialize the subtree pointers */ @@ -159,7 +159,7 @@ static int ett_ie_rach_load = -1; static int ett_ie_req_ref = -1; static int ett_ie_rel_mode = -1; static int ett_ie_resource_inf = -1; -static int ett_ie_rlm_cause =-1; +static int ett_ie_rlm_cause = -1; static int ett_ie_staring_time = -1; static int ett_ie_timing_adv = -1; static int ett_ie_uplink_meas = -1; @@ -240,10 +240,10 @@ static const value_string rsl_msg_disc_vals[] = { { 0x06, "Common Channel Management messages" }, { 0x08, "TRX Management messages" }, { 0x16, "Location Services messages" }, - { 0x3f, "ip.access Vendor Specific messages" }, + { 0x3f, "ip.access Vendor Specific messages" }, { 0, NULL } }; -#define RSL_MSGDISC_IPACCESS 0x3f +#define RSL_MSGDISC_IPACCESS 0x3f /* * 9.2 MESSAGE TYPE */ @@ -315,46 +315,46 @@ static const value_string rsl_msg_disc_vals[] = { /* Vendor-Specific messages of ip.access nanoBTS. There is no public documentation * about those extensions, all information in this dissector is based on lawful * protocol reverse enginering by Harald Welte */ -#define RSL_MSG_TYPE_IPAC_MEAS_PP_DEF 0x60 -#define RSL_MSG_TYPE_IPAC_HO_CAND_INQ 0x61 -#define RSL_MSG_TYPE_IPAC_HO_CAND_RESP 0x62 +#define RSL_MSG_TYPE_IPAC_MEAS_PP_DEF 0x60 +#define RSL_MSG_TYPE_IPAC_HO_CAND_INQ 0x61 +#define RSL_MSG_TYPE_IPAC_HO_CAND_RESP 0x62 -#define RSL_MSG_TYPE_IPAC_PDCH_ACT 0x48 -#define RSL_MSG_TYPE_IPAC_PDCH_ACT_ACK 0x49 -#define RSL_MSG_TYPE_IPAC_PDCH_ACT_NACK 0x4a -#define RSL_MSG_TYPE_IPAC_PDCH_DEACT 0x4b -#define RSL_MSG_TYPE_IPAC_PDCH_DEACT_ACK 0x4c +#define RSL_MSG_TYPE_IPAC_PDCH_ACT 0x48 +#define RSL_MSG_TYPE_IPAC_PDCH_ACT_ACK 0x49 +#define RSL_MSG_TYPE_IPAC_PDCH_ACT_NACK 0x4a +#define RSL_MSG_TYPE_IPAC_PDCH_DEACT 0x4b +#define RSL_MSG_TYPE_IPAC_PDCH_DEACT_ACK 0x4c #define RSL_MSG_TYPE_IPAC_PDCH_DEACT_NACK 0x4d -#define RSL_MSG_TYPE_IPAC_CRCX 0x70 -#define RSL_MSG_TYPE_IPAC_CRCX_ACK 0x71 -#define RSL_MSG_TYPE_IPAC_CRCX_NACK 0x72 -#define RSL_MSG_TYPE_IPAC_MDCX 0x73 -#define RSL_MSG_TYPE_IPAC_MDCX_ACK 0x74 -#define RSL_MSG_TYPE_IPAC_MDCX_NACK 0x75 -#define RSL_MSG_TYPE_IPAC_DLCX_IND 0x76 -#define RSL_MSG_TYPE_IPAC_DLCX 0x77 -#define RSL_MSG_TYPE_IPAC_DLCX_ACK 0x78 -#define RSL_MSG_TYPE_IPAC_DLCX_NACK 0x79 +#define RSL_MSG_TYPE_IPAC_CRCX 0x70 +#define RSL_MSG_TYPE_IPAC_CRCX_ACK 0x71 +#define RSL_MSG_TYPE_IPAC_CRCX_NACK 0x72 +#define RSL_MSG_TYPE_IPAC_MDCX 0x73 +#define RSL_MSG_TYPE_IPAC_MDCX_ACK 0x74 +#define RSL_MSG_TYPE_IPAC_MDCX_NACK 0x75 +#define RSL_MSG_TYPE_IPAC_DLCX_IND 0x76 +#define RSL_MSG_TYPE_IPAC_DLCX 0x77 +#define RSL_MSG_TYPE_IPAC_DLCX_ACK 0x78 +#define RSL_MSG_TYPE_IPAC_DLCX_NACK 0x79 -#define RSL_IE_IPAC_SRTP_CONFIG 0xe0 -#define RSL_IE_IPAC_PROXY_UDP 0xe1 -#define RSL_IE_IPAC_BSCMPL_TOUT 0xe2 -#define RSL_IE_IPAC_REMOTE_IP 0xf0 -#define RSL_IE_IPAC_REMOTE_PORT 0xf1 -#define RSL_IE_IPAC_RTP_PAYLOAD 0xf2 -#define RSL_IE_IPAC_LOCAL_PORT 0xf3 -#define RSL_IE_IPAC_SPEECH_MODE 0xf4 -#define RSL_IE_IPAC_LOCAL_IP 0xf5 -#define RSL_IE_IPAC_CONN_STAT 0xf6 -#define RSL_IE_IPAC_HO_C_PARMS 0xf7 -#define RSL_IE_IPAC_CONN_ID 0xf8 -#define RSL_IE_IPAC_RTP_CSD_FMT 0xf9 -#define RSL_IE_IPAC_RTP_JIT_BUF 0xfa -#define RSL_IE_IPAC_RTP_COMPR 0xfb -#define RSL_IE_IPAC_RTP_PAYLOAD2 0xfc -#define RSL_IE_IPAC_RTP_MPLEX 0xfd -#define RSL_IE_IPAC_RTP_MPLEX_ID 0xfe +#define RSL_IE_IPAC_SRTP_CONFIG 0xe0 +#define RSL_IE_IPAC_PROXY_UDP 0xe1 +#define RSL_IE_IPAC_BSCMPL_TOUT 0xe2 +#define RSL_IE_IPAC_REMOTE_IP 0xf0 +#define RSL_IE_IPAC_REMOTE_PORT 0xf1 +#define RSL_IE_IPAC_RTP_PAYLOAD 0xf2 +#define RSL_IE_IPAC_LOCAL_PORT 0xf3 +#define RSL_IE_IPAC_SPEECH_MODE 0xf4 +#define RSL_IE_IPAC_LOCAL_IP 0xf5 +#define RSL_IE_IPAC_CONN_STAT 0xf6 +#define RSL_IE_IPAC_HO_C_PARMS 0xf7 +#define RSL_IE_IPAC_CONN_ID 0xf8 +#define RSL_IE_IPAC_RTP_CSD_FMT 0xf9 +#define RSL_IE_IPAC_RTP_JIT_BUF 0xfa +#define RSL_IE_IPAC_RTP_COMPR 0xfb +#define RSL_IE_IPAC_RTP_PAYLOAD2 0xfc +#define RSL_IE_IPAC_RTP_MPLEX 0xfd +#define RSL_IE_IPAC_RTP_MPLEX_ID 0xfe static const value_string rsl_msg_type_vals[] = { /* 0 0 0 0 - - - - Radio Link Layer Management messages: */ @@ -420,25 +420,25 @@ static const value_string rsl_msg_type_vals[] = { /* 0 1 - - - - - - Location Services messages: */ /* 0x41 */ { 0x41, "Location Information" }, /* 8.7.1 */ /* ip.access */ - { 0x48, "ip.access PDCH ACTIVATION" }, - { 0x49, "ip.access PDCH ACTIVATION ACK" }, - { 0x4a, "ip.access PDCH ACTIVATION NACK" }, - { 0x4b, "ip.access PDCH DEACTIVATION" }, - { 0x4c, "ip.access PDCH DEACTIVATION ACK" }, - { 0x4d, "ip.access PDCH DEACTIVATION NACK" }, - { 0x60, "ip.access MEASurement PREPROCessing DeFauLT" }, - { 0x61, "ip.access HANDOover CANDidate ENQuiry" }, - { 0x62, "ip.access HANDOover CANDidate RESPonse" }, - { 0x70, "ip.access CRCX" }, - { 0x71, "ip.access CRCX ACK" }, - { 0x72, "ip.access CRCX NACK" }, - { 0x73, "ip.access MDCX" }, - { 0x74, "ip.access MDCX ACK" }, - { 0x75, "ip.access MDCX NACK" }, - { 0x76, "ip.access DLCX INDication" }, - { 0x77, "ip.access DLCX" }, - { 0x78, "ip.access DLCX ACK" }, - { 0x79, "ip.access DLCX NACK" }, + { 0x48, "ip.access PDCH ACTIVATION" }, + { 0x49, "ip.access PDCH ACTIVATION ACK" }, + { 0x4a, "ip.access PDCH ACTIVATION NACK" }, + { 0x4b, "ip.access PDCH DEACTIVATION" }, + { 0x4c, "ip.access PDCH DEACTIVATION ACK" }, + { 0x4d, "ip.access PDCH DEACTIVATION NACK" }, + { 0x60, "ip.access MEASurement PREPROCessing DeFauLT" }, + { 0x61, "ip.access HANDOover CANDidate ENQuiry" }, + { 0x62, "ip.access HANDOover CANDidate RESPonse" }, + { 0x70, "ip.access CRCX" }, + { 0x71, "ip.access CRCX ACK" }, + { 0x72, "ip.access CRCX NACK" }, + { 0x73, "ip.access MDCX" }, + { 0x74, "ip.access MDCX ACK" }, + { 0x75, "ip.access MDCX NACK" }, + { 0x76, "ip.access DLCX INDication" }, + { 0x77, "ip.access DLCX" }, + { 0x78, "ip.access DLCX ACK" }, + { 0x79, "ip.access DLCX NACK" }, { 0, NULL } }; static value_string_ext rsl_msg_type_vals_ext = VALUE_STRING_EXT_INIT(rsl_msg_type_vals); @@ -478,10 +478,10 @@ static value_string_ext rsl_msg_type_vals_ext = VALUE_STRING_EXT_INIT(rsl_msg_ty #define RSL_IE_MESSAGE_ID 28 #define RSL_IE_SYS_INFO_TYPE 30 -#define RSL_IE_MS_POWER_PARAM 31 +#define RSL_IE_MS_POWER_PARAM 31 #define RSL_IE_BS_POWER_PARAM 32 #define RSL_IE_PREPROC_PARAM 33 -#define RSL_IE_PREPROC_MEAS 34 +#define RSL_IE_PREPROC_MEAS 34 #define RSL_IE_FULL_IMM_ASS_INF 35 #define RSL_IE_SMSCB_INF 36 @@ -589,25 +589,25 @@ static const value_string rsl_ie_type_vals[] = { Not used */ - { 0xe0, "SRTP Configuration" }, - { 0xe1, "BSC Proxy UDP Port" }, - { 0xe2, "BSC Multiplex Timeout" }, - { 0xf0, "Remote IP Address" }, - { 0xf1, "Remote RTP Port" }, - { 0xf2, "RTP Payload Type" }, - { 0xf3, "Local RTP Port" }, - { 0xf4, "Speech Mode" }, - { 0xf5, "Local IP Address" }, - { 0xf6, "Connection Statistics" }, - { 0xf7, "Handover C Parameters" }, - { 0xf8, "Connection Identifier" }, - { 0xf9, "RTP CSD Format" }, - { 0xfa, "RTP Jitter Buffer" }, - { 0xfb, "RTP Compression" }, - { 0xfc, "RTP Payload Type 2" }, - { 0xfd, "RTP Multiplex" }, - { 0xfe, "RTP Multiplex Identifier" }, - { 0, NULL } + { 0xe0, "SRTP Configuration" }, + { 0xe1, "BSC Proxy UDP Port" }, + { 0xe2, "BSC Multiplex Timeout" }, + { 0xf0, "Remote IP Address" }, + { 0xf1, "Remote RTP Port" }, + { 0xf2, "RTP Payload Type" }, + { 0xf3, "Local RTP Port" }, + { 0xf4, "Speech Mode" }, + { 0xf5, "Local IP Address" }, + { 0xf6, "Connection Statistics" }, + { 0xf7, "Handover C Parameters" }, + { 0xf8, "Connection Identifier" }, + { 0xf9, "RTP CSD Format" }, + { 0xfa, "RTP Jitter Buffer" }, + { 0xfb, "RTP Compression" }, + { 0xfc, "RTP Payload Type 2" }, + { 0xfd, "RTP Multiplex" }, + { 0xfe, "RTP Multiplex Identifier" }, + { 0, NULL } }; static value_string_ext rsl_ie_type_vals_ext = VALUE_STRING_EXT_INIT(rsl_ie_type_vals); @@ -647,21 +647,21 @@ static value_string_ext rsl_ch_no_Cbits_vals_ext = VALUE_STRING_EXT_INIT(rsl_ch_ /* From openbsc/include/openbsc/tlv.h */ enum tlv_type { - TLV_TYPE_UNKNOWN, - TLV_TYPE_FIXED, - TLV_TYPE_T, - TLV_TYPE_TV, - TLV_TYPE_TLV, - TLV_TYPE_TL16V, + TLV_TYPE_UNKNOWN, + TLV_TYPE_FIXED, + TLV_TYPE_T, + TLV_TYPE_TV, + TLV_TYPE_TLV, + TLV_TYPE_TL16V, }; struct tlv_def { - enum tlv_type type; - guint8 fixed_len; + enum tlv_type type; + guint8 fixed_len; }; struct tlv_definition { - struct tlv_def def[0xff]; + struct tlv_def def[0xff]; }; /* This structure is initialized in proto_register_rsl() */ @@ -673,9 +673,9 @@ dissect_rsl_ie_ch_no(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, in { proto_item *ti; proto_tree *ie_tree; - guint8 ie_id; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_CH_NO) return offset; @@ -719,10 +719,10 @@ dissect_rsl_ie_link_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, { proto_item *ti; proto_tree *ie_tree; - guint8 octet; - guint8 ie_id; + guint8 octet; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_LINK_ID) return offset; @@ -737,7 +737,7 @@ dissect_rsl_ie_link_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, octet = tvb_get_guint8(tvb,offset); - if((octet&0x20) == 0x20){ + if ((octet & 0x20) == 0x20) { /* Not applicable */ proto_tree_add_item(ie_tree, hf_rsl_na, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; @@ -793,10 +793,10 @@ dissect_rsl_ie_act_type(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, { proto_item *ti; proto_tree *ie_tree; - guint8 ie_id; - guint octet; + guint8 ie_id; + guint octet; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_ACT_TYPE) return offset; @@ -816,9 +816,9 @@ dissect_rsl_ie_act_type(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, /* The A-bits indicate the type of activation, which defines the access procedure * and the operation of the data link layer */ - octet = (tvb_get_guint8(tvb,offset) & 0x06)>>1; + octet = (tvb_get_guint8(tvb,offset) & 0x06) >> 1; proto_tree_add_item(ie_tree, hf_rsl_a3a2, tvb, offset, 1, ENC_BIG_ENDIAN); - switch(octet){ + switch (octet) { case 0: /* Activation related to intra-cell channel change */ proto_tree_add_item(ie_tree, hf_rsl_a1_0, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -878,9 +878,9 @@ dissect_rsl_ie_bs_power(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, { proto_item *ti; proto_tree *ie_tree; - guint8 ie_id; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_BS_POW) return offset; @@ -916,11 +916,11 @@ dissect_rsl_ie_ch_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, in { proto_item *ti; proto_tree *ie_tree; - guint8 length; - int ie_offset; - guint8 ie_id; + guint8 length; + int ie_offset; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_CH_ID) return offset; @@ -947,7 +947,7 @@ dissect_rsl_ie_ch_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, in */ proto_tree_add_text(ie_tree, tvb,offset, 1, "Channel Description Tag"); de_rr_ch_dsc(tvb, ie_tree, pinfo, offset+1, length, NULL, 0); - offset+=4; + offset += 4; /* * The 3GPP TS 24.008 "Mobile Allocation" shall for compatibility reasons be * included but empty, i.e. the length shall be zero. @@ -1031,12 +1031,12 @@ dissect_rsl_ie_ch_mode(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, { proto_item *ti; proto_tree *ie_tree; - guint8 length; - int ie_offset; - guint8 ie_id; - guint8 octet; + guint8 length; + int ie_offset; + guint8 ie_id; + guint8 octet; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_CH_MODE) return offset; @@ -1070,7 +1070,7 @@ dissect_rsl_ie_ch_mode(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_tree_add_item(ie_tree, hf_rsl_ch_rate_and_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /* Speech coding algor./data rate + transp ind */ - switch(octet){ + switch (octet) { case 1: /* Speech */ proto_tree_add_item(ie_tree, hf_rsl_speech_coding_alg, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -1080,7 +1080,7 @@ dissect_rsl_ie_ch_mode(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_tree_add_item(ie_tree, hf_rsl_extension_bit, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(ie_tree, hf_rsl_t_nt_bit, tvb, offset, 1, ENC_BIG_ENDIAN); octet = tvb_get_guint8(tvb,offset); - if ((octet&0x40)==0x40){ + if ((octet & 0x40) == 0x40) { /* Non-transparent service */ /* For the non-transparent service, bits 6 to 1 indicate the radio interface data rate:*/ proto_tree_add_item(ie_tree, hf_rsl_ra_if_data_rte, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -1130,10 +1130,10 @@ dissect_rsl_ie_enc_inf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, { proto_item *ti; proto_tree *ie_tree; - guint8 length; - guint8 ie_id; + guint8 length; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_ENC_INF) return offset; @@ -1168,9 +1168,9 @@ dissect_rsl_ie_frame_no(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, { proto_item *ti; proto_tree *ie_tree; - guint8 ie_id; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_FRAME_NO) return offset; @@ -1200,9 +1200,9 @@ dissect_rsl_ie_ho_ref(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, i { proto_item *ti; proto_tree *ie_tree; - guint8 ie_id; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_HO_REF) return offset; @@ -1231,9 +1231,9 @@ dissect_rsl_ie_l1_inf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, i { proto_item *ti; proto_tree *ie_tree; - guint8 ie_id; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_L1_INF) return offset; @@ -1279,11 +1279,11 @@ dissect_rsl_ie_L3_inf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o { proto_item *ti; proto_tree *ie_tree; - tvbuff_t *next_tvb; - guint16 length; - guint8 ie_id; + tvbuff_t *next_tvb; + guint16 length; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_L3_INF) return offset; @@ -1338,10 +1338,10 @@ dissect_rsl_ie_ms_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of { proto_item *ti; proto_tree *ie_tree; - guint length; - guint8 ie_id; + guint length; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_MS_ID) return offset; @@ -1377,9 +1377,9 @@ dissect_rsl_ie_ms_pow(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, i { proto_item *ti; proto_tree *ie_tree; - guint8 ie_id; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_MS_POW) return offset; @@ -1410,9 +1410,9 @@ dissect_rsl_ie_paging_grp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre { proto_item *ti; proto_tree *ie_tree; - guint8 ie_id; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_PAGING_GRP) return offset; @@ -1442,9 +1442,9 @@ dissect_rsl_ie_paging_load(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr { proto_item *ti; proto_tree *ie_tree; - guint8 ie_id; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_PAGING_LOAD) return offset; @@ -1473,10 +1473,10 @@ dissect_rsl_ie_phy_ctx(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, { proto_item *ti; proto_tree *ie_tree; - guint length; - guint8 ie_id; + guint length; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_PHY_CTX) return offset; @@ -1513,9 +1513,9 @@ dissect_rsl_ie_access_delay(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *t { proto_item *ti; proto_tree *ie_tree; - guint8 ie_id; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_ACCESS_DELAY) return offset; @@ -1541,11 +1541,11 @@ dissect_rsl_ie_rach_load(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree { proto_item *ti; proto_tree *ie_tree; - guint length; - guint8 ie_id; - int ie_offset; + guint length; + guint8 ie_id; + int ie_offset; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_RACH_LOAD) return offset; @@ -1583,7 +1583,7 @@ dissect_rsl_ie_rach_load(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree length = length -2; /* Supplementary Information */ - if( length > 0){ + if ( length > 0) { proto_tree_add_text(ie_tree, tvb, offset,length ,"Supplementary Information"); } offset = ie_offset + length; @@ -1599,9 +1599,9 @@ dissect_rsl_ie_req_ref(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, { proto_item *ti; proto_tree *ie_tree; - guint8 ie_id; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_REQ_REF) return offset; @@ -1637,9 +1637,9 @@ dissect_rsl_ie_rel_mode(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, { proto_item *ti; proto_tree *ie_tree; - guint8 ie_id; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_REL_MODE) return offset; @@ -1690,11 +1690,11 @@ dissect_rsl_ie_resource_inf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *t { proto_item *ti; proto_tree *ie_tree; - guint8 ie_id; + guint8 ie_id; guint length; - int ie_offset; + int ie_offset; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_RESOURCE_INF) return offset; @@ -1716,7 +1716,7 @@ dissect_rsl_ie_resource_inf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *t ie_offset = offset; - while (length > 0){ + while (length > 0) { proto_tree_add_item(ie_tree, hf_rsl_ch_no_Cbits, tvb, offset, 1, ENC_BIG_ENDIAN); /* TN is time slot number, binary represented as in 3GPP TS 45.002. * 3 Bits @@ -1745,10 +1745,10 @@ dissect_rsl_ie_rlm_cause(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree proto_tree *ie_tree; guint length; - /* guint8 octet; */ - guint8 ie_id; + /* guint8 octet; */ + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_RLM_CAUSE) return offset; @@ -1787,9 +1787,9 @@ dissect_rsl_ie_starting_time(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * { proto_item *ti; proto_tree *ie_tree; - guint8 ie_id; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_STARTING_TIME) return offset; @@ -1819,9 +1819,9 @@ dissect_rsl_ie_timing_adv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre { proto_item *ti; proto_tree *ie_tree; - guint8 ie_id; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_TIMING_ADV) return offset; @@ -1855,9 +1855,9 @@ dissect_rsl_ie_uplik_meas(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre proto_tree *ie_tree; guint length; int ie_offset; - guint8 ie_id; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_UPLINK_MEAS) return offset; @@ -1929,9 +1929,9 @@ dissect_rsl_ie_cause(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, in guint length; guint8 octet; int ie_offset; - guint8 ie_id; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_CAUSE) return offset; @@ -1970,9 +1970,9 @@ dissect_rsl_ie_meas_res_no(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr { proto_item *ti; proto_tree *ie_tree; - guint8 ie_id; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_MEAS_RES_NO) return offset; @@ -1999,9 +1999,9 @@ dissect_rsl_ie_message_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre { proto_item *ti; proto_tree *ie_tree; - guint8 ie_id; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_MESSAGE_ID) return offset; @@ -2055,9 +2055,9 @@ dissect_rsl_ie_sys_info_type(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * { proto_item *ti; proto_tree *ie_tree; - guint8 ie_id; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_SYS_INFO_TYPE) return offset; @@ -2089,7 +2089,7 @@ dissect_rsl_ie_full_imm_ass_inf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t tvbuff_t *next_tvb; guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_FULL_IMM_ASS_INF) return offset; @@ -2132,12 +2132,12 @@ dissect_rsl_ie_smscb_inf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree { proto_item *ti; proto_tree *ie_tree; - tvbuff_t *next_tvb; + tvbuff_t *next_tvb; guint length; guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_SMSCB_INF) return offset; @@ -2177,7 +2177,7 @@ dissect_rsl_ie_ms_timing_offset(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre proto_tree *ie_tree; guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_FULL_MS_TIMING_OFFSET) return offset; @@ -2214,7 +2214,7 @@ dissect_rsl_ie_err_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int guint length; guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_ERR_MSG) return offset; @@ -2247,11 +2247,11 @@ dissect_rsl_ie_full_bcch_inf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * { proto_item *ti; proto_tree *ie_tree; - tvbuff_t *next_tvb; - guint16 length; - guint8 ie_id; + tvbuff_t *next_tvb; + guint16 length; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_FULL_BCCH_INF) return offset; @@ -2300,7 +2300,7 @@ dissect_rsl_ie_ch_needed(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree proto_tree *ie_tree; guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_CH_NEEDED) return offset; @@ -2330,7 +2330,7 @@ dissect_rsl_ie_cb_cmd_type(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr proto_tree *ie_tree; guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_CB_CMD_TYPE) return offset; @@ -2359,12 +2359,12 @@ dissect_rsl_ie_smscb_mess(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre { proto_item *ti; proto_tree *ie_tree; - tvbuff_t *next_tvb; - guint length; - guint8 ie_id; - int ie_offset; + tvbuff_t *next_tvb; + guint length; + guint8 ie_id; + int ie_offset; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_SMSCB_MESS) return offset; @@ -2411,7 +2411,7 @@ dissect_rsl_ie_cbch_load_inf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * guint8 ie_id; guint8 octet; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_CBCH_LOAD_INF) return offset; @@ -2431,7 +2431,7 @@ dissect_rsl_ie_cbch_load_inf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * /* Message Slot Count */ item = proto_tree_add_item(ie_tree, hf_rsl_msg_slt_cnt, tvb, offset, 1, ENC_BIG_ENDIAN); - if ((octet & 0x80) == 0x80){ + if ((octet & 0x80) == 0x80) { proto_item_append_text(item,"The amount of SMSCB messages (1 to 15) that are needed immediately by BTS"); }else{ proto_item_append_text(item,"The amount of delay in message slots (1 to 15) that is needed immediately by BTS"); @@ -2458,7 +2458,7 @@ dissect_rsl_ie_smscb_ch_ind(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *t proto_tree *ie_tree; guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_SMSCB_CH_IND) return offset; @@ -2487,10 +2487,10 @@ dissect_rsl_ie_grp_call_ref(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, { proto_item *ti; proto_tree *ie_tree; - guint length; - guint8 ie_id; + guint length; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_GRP_CALL_REF) return offset; @@ -2527,10 +2527,10 @@ dissect_rsl_ie_ch_desc(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, { proto_item *ti; proto_tree *ie_tree; - guint length; - guint8 ie_id; + guint length; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_CH_DESC) return offset; @@ -2570,7 +2570,7 @@ dissect_rsl_ie_nch_drx(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_tree *ie_tree; guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_NCH_DRX_INF) return offset; @@ -2608,7 +2608,7 @@ dissect_rsl_ie_cmd_ind(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint8 ie_id; guint8 octet; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_CMD_IND) return offset; @@ -2629,7 +2629,7 @@ dissect_rsl_ie_cmd_ind(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, /* TODO this should probably be add_uint instead!!! */ octet = tvb_get_guint8(tvb,offset); - if ((octet&0x80)==0x80){ + if ((octet & 0x80) == 0x80) { /* extended */ /* Command Extension */ proto_tree_add_item(ie_tree, hf_rsl_command, tvb, offset, 2, ENC_BIG_ENDIAN); @@ -2664,7 +2664,7 @@ dissect_rsl_ie_emlpp_prio(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre proto_tree *ie_tree; guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_EMLPP_PRIO) return offset; @@ -2698,7 +2698,7 @@ dissect_rsl_ie_uic(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int proto_tree *ie_tree; guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_UIC) return offset; @@ -2731,7 +2731,7 @@ dissect_rsl_ie_main_ch_ref(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr proto_tree *ie_tree; guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_MAIN_CH_REF) return offset; @@ -2761,10 +2761,10 @@ dissect_rsl_ie_multirate_conf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre { proto_item *ti; proto_tree *ie_tree; - guint length; - guint8 ie_id; + guint length; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_MULTIRATE_CONF) return offset; @@ -2800,9 +2800,9 @@ dissect_rsl_ie_multirate_cntrl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree { proto_item *ti; proto_tree *ie_tree; - guint8 ie_id; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_MULTIRATE_CNTRL) return offset; @@ -2834,10 +2834,10 @@ dissect_rsl_ie_sup_codec_types(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree { proto_item *ti; proto_tree *ie_tree; - guint length; - guint8 ie_id; + guint length; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_SUP_CODEC_TYPES) return offset; @@ -2902,10 +2902,10 @@ dissect_rsl_ie_codec_conf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre { proto_item *ti; proto_tree *ie_tree; - guint length; - guint8 ie_id; + guint length; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_CODEC_CONF) return offset; @@ -2946,7 +2946,7 @@ dissect_rsl_ie_rtd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int guint8 ie_id; guint8 rtd; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_RTD) return offset; @@ -2991,7 +2991,7 @@ dissect_rsl_ie_tfo_status(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre proto_tree *ie_tree; guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_TFO_STATUS) return offset; @@ -3017,11 +3017,11 @@ dissect_rsl_ie_llp_apdu(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, { proto_item *ti; proto_tree *ie_tree; - guint8 length; - int ie_offset; - guint8 ie_id; + guint8 length; + int ie_offset; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_LLP_APDU) return offset; @@ -3063,11 +3063,11 @@ dissect_rsl_ie_tfo_transp_cont(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree { proto_item *ti; proto_tree *ie_tree; - guint8 length; - int ie_offset; - guint8 ie_id; + guint8 length; + int ie_offset; + guint8 ie_id; - if(is_mandatory == FALSE){ + if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb,offset); if (ie_id != RSL_IE_TFO_TRANSP_CONT) return offset; @@ -3098,141 +3098,141 @@ dissect_rsl_ie_tfo_transp_cont(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree } static int -dissct_rsl_ipaccess_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) +dissct_rsl_ipaccess_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) { - guint8 msg_type; - guint32 local_addr = 0; - guint16 local_port = 0; - address src_addr; + guint8 msg_type; + guint32 local_addr = 0; + guint16 local_port = 0; + address src_addr; - msg_type = tvb_get_guint8(tvb, offset)&0x7f; - offset++; + msg_type = tvb_get_guint8(tvb, offset) & 0x7f; + offset++; - /* parse TLV attributes */ - while (tvb_reported_length_remaining(tvb, offset) > 0) { - guint8 tag; - unsigned int len, hlen; - const struct tlv_def *tdef; - proto_item *ti; - proto_tree *ie_tree; + /* parse TLV attributes */ + while (tvb_reported_length_remaining(tvb, offset) > 0) { + guint8 tag; + unsigned int len, hlen; + const struct tlv_def *tdef; + proto_item *ti; + proto_tree *ie_tree; - tag = tvb_get_guint8(tvb, offset); - tdef = &rsl_att_tlvdef.def[tag]; + tag = tvb_get_guint8(tvb, offset); + tdef = &rsl_att_tlvdef.def[tag]; - switch (tdef->type) { - case TLV_TYPE_FIXED: - hlen = 1; - len = tdef->fixed_len; - break; - case TLV_TYPE_T: - hlen = 1; - len = 0; - break; - case TLV_TYPE_TV: - hlen = 1; - len = 1; - break; - case TLV_TYPE_TLV: - hlen = 2; - len = tvb_get_guint8(tvb, offset+1); - break; - case TLV_TYPE_TL16V: - hlen = 3; - len = tvb_get_guint8(tvb, offset+1) << 8 | - tvb_get_guint8(tvb, offset+2); - break; - case TLV_TYPE_UNKNOWN: - default: - DISSECTOR_ASSERT_NOT_REACHED(); - break; - } + switch (tdef->type) { + case TLV_TYPE_FIXED: + hlen = 1; + len = tdef->fixed_len; + break; + case TLV_TYPE_T: + hlen = 1; + len = 0; + break; + case TLV_TYPE_TV: + hlen = 1; + len = 1; + break; + case TLV_TYPE_TLV: + hlen = 2; + len = tvb_get_guint8(tvb, offset+1); + break; + case TLV_TYPE_TL16V: + hlen = 3; + len = tvb_get_guint8(tvb, offset+1) << 8 | + tvb_get_guint8(tvb, offset+2); + break; + case TLV_TYPE_UNKNOWN: + default: + DISSECTOR_ASSERT_NOT_REACHED(); + break; + } - ti = proto_tree_add_item(tree, hf_rsl_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); - ie_tree = proto_item_add_subtree(ti, ett_ie_local_port); - offset += hlen; + ti = proto_tree_add_item(tree, hf_rsl_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN); + ie_tree = proto_item_add_subtree(ti, ett_ie_local_port); + offset += hlen; - switch (tag) { - case RSL_IE_CH_NO: - dissect_rsl_ie_ch_no(tvb, pinfo, ie_tree, offset, FALSE); - break; - case RSL_IE_FRAME_NO: - dissect_rsl_ie_frame_no(tvb, pinfo, ie_tree, offset, FALSE); - break; - case RSL_IE_MS_POW: - dissect_rsl_ie_ms_pow(tvb, pinfo, ie_tree, offset, FALSE); - break; - case RSL_IE_IPAC_REMOTE_IP: - proto_tree_add_item(ie_tree, hf_rsl_remote_ip, tvb, - offset, len, ENC_BIG_ENDIAN); - break; - case RSL_IE_IPAC_REMOTE_PORT: - proto_tree_add_item(ie_tree, hf_rsl_remote_port, tvb, - offset, len, ENC_BIG_ENDIAN); - break; - case RSL_IE_IPAC_LOCAL_IP: - proto_tree_add_item(ie_tree, hf_rsl_local_ip, tvb, - offset, len, ENC_BIG_ENDIAN); - local_addr = tvb_get_ipv4(tvb, offset); - break; - case RSL_IE_IPAC_LOCAL_PORT: - proto_tree_add_item(ie_tree, hf_rsl_local_port, tvb, - offset, len, ENC_BIG_ENDIAN); - local_port = tvb_get_ntohs(tvb, offset); - break; - case RSL_IE_IPAC_SPEECH_MODE: - proto_tree_add_item(ie_tree, hf_rsl_speech_mode_s, tvb, - offset, len, ENC_BIG_ENDIAN); - proto_tree_add_item(ie_tree, hf_rsl_speech_mode_m, tvb, - offset, len, ENC_BIG_ENDIAN); - break; - case RSL_IE_IPAC_RTP_PAYLOAD: - case RSL_IE_IPAC_RTP_PAYLOAD2: - proto_tree_add_item(ie_tree, hf_rsl_rtp_payload, tvb, - offset, len, ENC_BIG_ENDIAN); - break; - case RSL_IE_IPAC_RTP_CSD_FMT: - proto_tree_add_item(ie_tree, hf_rsl_rtp_csd_fmt_d, tvb, - offset, len, ENC_BIG_ENDIAN); - proto_tree_add_item(ie_tree, hf_rsl_rtp_csd_fmt_ir, tvb, - offset, len, ENC_BIG_ENDIAN); - break; - case RSL_IE_IPAC_CONN_ID: - proto_tree_add_item(ie_tree, hf_rsl_conn_id, tvb, - offset, len, ENC_BIG_ENDIAN); - break; - case RSL_IE_IPAC_CONN_STAT: - proto_tree_add_item(ie_tree, hf_rsl_cstat_tx_pkts, tvb, - offset, 4, ENC_BIG_ENDIAN); - proto_tree_add_item(ie_tree, hf_rsl_cstat_tx_octs, tvb, - offset+4, 4, ENC_BIG_ENDIAN); - proto_tree_add_item(ie_tree, hf_rsl_cstat_rx_pkts, tvb, - offset+8, 4, ENC_BIG_ENDIAN); - proto_tree_add_item(ie_tree, hf_rsl_cstat_rx_octs, tvb, - offset+12, 4, ENC_BIG_ENDIAN); - proto_tree_add_item(ie_tree, hf_rsl_cstat_lost_pkts, tvb, - offset+16, 4, ENC_BIG_ENDIAN); - proto_tree_add_item(ie_tree, hf_rsl_cstat_ia_jitter, tvb, - offset+20, 4, ENC_BIG_ENDIAN); - proto_tree_add_item(ie_tree, hf_rsl_cstat_avg_tx_dly, tvb, - offset+24, 4, ENC_BIG_ENDIAN); - break; - } - offset += len; - } + switch (tag) { + case RSL_IE_CH_NO: + dissect_rsl_ie_ch_no(tvb, pinfo, ie_tree, offset, FALSE); + break; + case RSL_IE_FRAME_NO: + dissect_rsl_ie_frame_no(tvb, pinfo, ie_tree, offset, FALSE); + break; + case RSL_IE_MS_POW: + dissect_rsl_ie_ms_pow(tvb, pinfo, ie_tree, offset, FALSE); + break; + case RSL_IE_IPAC_REMOTE_IP: + proto_tree_add_item(ie_tree, hf_rsl_remote_ip, tvb, + offset, len, ENC_BIG_ENDIAN); + break; + case RSL_IE_IPAC_REMOTE_PORT: + proto_tree_add_item(ie_tree, hf_rsl_remote_port, tvb, + offset, len, ENC_BIG_ENDIAN); + break; + case RSL_IE_IPAC_LOCAL_IP: + proto_tree_add_item(ie_tree, hf_rsl_local_ip, tvb, + offset, len, ENC_BIG_ENDIAN); + local_addr = tvb_get_ipv4(tvb, offset); + break; + case RSL_IE_IPAC_LOCAL_PORT: + proto_tree_add_item(ie_tree, hf_rsl_local_port, tvb, + offset, len, ENC_BIG_ENDIAN); + local_port = tvb_get_ntohs(tvb, offset); + break; + case RSL_IE_IPAC_SPEECH_MODE: + proto_tree_add_item(ie_tree, hf_rsl_speech_mode_s, tvb, + offset, len, ENC_BIG_ENDIAN); + proto_tree_add_item(ie_tree, hf_rsl_speech_mode_m, tvb, + offset, len, ENC_BIG_ENDIAN); + break; + case RSL_IE_IPAC_RTP_PAYLOAD: + case RSL_IE_IPAC_RTP_PAYLOAD2: + proto_tree_add_item(ie_tree, hf_rsl_rtp_payload, tvb, + offset, len, ENC_BIG_ENDIAN); + break; + case RSL_IE_IPAC_RTP_CSD_FMT: + proto_tree_add_item(ie_tree, hf_rsl_rtp_csd_fmt_d, tvb, + offset, len, ENC_BIG_ENDIAN); + proto_tree_add_item(ie_tree, hf_rsl_rtp_csd_fmt_ir, tvb, + offset, len, ENC_BIG_ENDIAN); + break; + case RSL_IE_IPAC_CONN_ID: + proto_tree_add_item(ie_tree, hf_rsl_conn_id, tvb, + offset, len, ENC_BIG_ENDIAN); + break; + case RSL_IE_IPAC_CONN_STAT: + proto_tree_add_item(ie_tree, hf_rsl_cstat_tx_pkts, tvb, + offset, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(ie_tree, hf_rsl_cstat_tx_octs, tvb, + offset+4, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(ie_tree, hf_rsl_cstat_rx_pkts, tvb, + offset+8, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(ie_tree, hf_rsl_cstat_rx_octs, tvb, + offset+12, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(ie_tree, hf_rsl_cstat_lost_pkts, tvb, + offset+16, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(ie_tree, hf_rsl_cstat_ia_jitter, tvb, + offset+20, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(ie_tree, hf_rsl_cstat_avg_tx_dly, tvb, + offset+24, 4, ENC_BIG_ENDIAN); + break; + } + offset += len; + } - switch (msg_type) { - case RSL_MSG_TYPE_IPAC_CRCX_ACK: - /* Notify the RTP and RTCP dissectors about a new RTP stream */ - src_addr.type = AT_IPv4; - src_addr.len = 4; - src_addr.data = (guint8 *)&local_addr; - rtp_add_address(pinfo, &src_addr, local_port, 0, - "GSM A-bis/IP", pinfo->fd->num, 0, NULL); - rtcp_add_address(pinfo, &src_addr, local_port+1, 0, - "GSM A-bis/IP", pinfo->fd->num); - break; - } - return offset; + switch (msg_type) { + case RSL_MSG_TYPE_IPAC_CRCX_ACK: + /* Notify the RTP and RTCP dissectors about a new RTP stream */ + src_addr.type = AT_IPv4; + src_addr.len = 4; + src_addr.data = (guint8 *)&local_addr; + rtp_add_address(pinfo, &src_addr, local_port, 0, + "GSM A-bis/IP", pinfo->fd->num, 0, NULL); + rtcp_add_address(pinfo, &src_addr, local_port+1, 0, + "GSM A-bis/IP", pinfo->fd->num); + break; + } + return offset; } static int @@ -3241,7 +3241,7 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) guint8 msg_disc, msg_type; msg_disc = tvb_get_guint8(tvb, offset++) >> 1; - msg_type = tvb_get_guint8(tvb,offset)&0x7f; + msg_type = tvb_get_guint8(tvb,offset) & 0x7f; proto_tree_add_item(tree, hf_rsl_msg_type, tvb, offset, 1, ENC_BIG_ENDIAN); if (msg_disc == RSL_MSGDISC_IPACCESS) { @@ -3250,7 +3250,7 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) } offset++; - switch (msg_type){ + switch (msg_type) { /* Radio Link Layer Management messages */ /* 8.3.1 DATA REQUEST */ case RSL_MSG_TYPE_DATA_REQ: @@ -3300,7 +3300,7 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* Link Identifier 9.3.2 M TV 2 */ offset = dissect_rsl_ie_link_id(tvb, pinfo, tree, offset, TRUE); /* L3 Information 9.3.11 O (note 1) TLV 3-23 */ - if(tvb_length_remaining(tvb,offset) >1) + if (tvb_length_remaining(tvb,offset) >1) offset = dissect_rsl_ie_L3_inf(tvb, pinfo, tree, offset, FALSE, L3_INF_OTHER); break; /* 8.3.7 RELEASE REQUEST */ @@ -3333,7 +3333,7 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* Link Identifier 9.3.2 M TV 2 */ offset = dissect_rsl_ie_link_id(tvb, pinfo, tree, offset, TRUE); /* L3 Information 9.3.11 O (note 1) TLV 3-23 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_L3_inf(tvb, pinfo, tree, offset, FALSE, L3_INF_OTHER); break; /* Common Channel Management/TRX Management messages */ @@ -3344,10 +3344,10 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* System Info Type 9.3.30 M TV 2 */ offset = dissect_rsl_ie_sys_info_type(tvb, pinfo, tree, offset, TRUE); /* Full BCCH Info (SYS INFO) 9.3.39 O 1) TLV 25 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_full_bcch_inf(tvb, pinfo, tree, offset, TRUE); /* Starting Time 9.3.23 O 2) TV 3 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_starting_time(tvb, pinfo, tree, offset, FALSE); break; /* 8.5.2 CCCH LOAD INDICATION 18*/ @@ -3358,7 +3358,7 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* RACH Load 9.3.18 C 1) TLV >=8 */ offset = dissect_rsl_ie_rach_load(tvb, pinfo, tree, offset, FALSE); /* Paging Load 9.3.15 C 2) TV 3 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_paging_load(tvb, pinfo, tree, offset, FALSE); break; /* 8.5.3 */ @@ -3370,7 +3370,7 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* Access Delay 9.3.17 M TV 2 */ offset = dissect_rsl_ie_access_delay(tvb, pinfo, tree, offset, TRUE); /* Physical Context 9.3.16 O 1) TLV >=2 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_phy_ctx(tvb, pinfo, tree, offset, FALSE); break; /* 8.5.4 DELETE INDICATION */ @@ -3388,10 +3388,10 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* MS Identity 9.3.12 M TLV 2-10 2 */ offset = dissect_rsl_ie_ms_id(tvb, pinfo, tree, offset, TRUE); /* Channel Needed 9.3.40 O 1) TV 2 2 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_ch_needed(tvb, pinfo, tree, offset, FALSE); /* eMLPP Priority 9.3.49 O 2) TV 2 2 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_emlpp_prio(tvb, pinfo, tree, offset, FALSE); break; /* 8.5.6 IMMEDIATE ASSIGN COMMAND */ @@ -3408,7 +3408,7 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* SMSCB Information 9.3.36 M TV 24 */ offset = dissect_rsl_ie_smscb_inf(tvb, pinfo, tree, offset, TRUE); /* SMSCB Channel Indicator 9.3.44 O 1) TV 2 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_smscb_ch_ind(tvb, pinfo, tree, offset, FALSE); break; /* 8.6 TRX MANAGEMENT MESSAGES */ @@ -3422,10 +3422,10 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* System Info Type 9.3.30 M TV 2 */ offset = dissect_rsl_ie_sys_info_type(tvb, pinfo, tree, offset, TRUE); /* L3 Info (SYS INFO) 9.3.11 O 1) TLV 22 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_L3_inf(tvb, pinfo, tree, offset, FALSE, L3_INF_CCCH); /* Starting Time 9.3.23 O 2) TV 3 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_starting_time(tvb, pinfo, tree, offset, FALSE); break; case RSL_MSG_OVERLOAD: /* 27 8.6.3 */ @@ -3436,16 +3436,16 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* Cause 9.3.26 M TLV >=3 */ offset = dissect_rsl_ie_cause(tvb, pinfo, tree, offset, TRUE); /* Message Identifier 9.3.28 O 1) TV 2 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_message_id(tvb, pinfo, tree, offset, FALSE); /* Channel Number 9.3.1 O 2) TV 2 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE); /* Link identifier 9.3.2 O 3) TV 2 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_link_id(tvb, pinfo, tree, offset, TRUE); /* Erroneous Message 9.3.38 O 4) TLV >=3 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_err_msg(tvb, pinfo, tree, offset, TRUE); break; /* 8.5.8 SMS BROADCAST COMMAND */ @@ -3457,7 +3457,7 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* SMSCB message 9.3.42 M TLV 2-90 */ offset = dissect_rsl_ie_smscb_mess(tvb, pinfo, tree, offset, TRUE); /* SMSCB Channel Indicator 9.3.44 O 1) TV 2 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_smscb_ch_ind(tvb, pinfo, tree, offset, FALSE); break; case RSL_MSG_CBCH_LOAD_IND: /* 30 8.5.9 */ @@ -3466,7 +3466,7 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* CBCH Load Information 9.3.43 M TV 2 */ offset = dissect_rsl_ie_cbch_load_inf(tvb, pinfo, tree, offset, TRUE); /* SMSCB Channel Indicator 9.3.44 O 1) TV 2 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_smscb_ch_ind(tvb, pinfo, tree, offset, FALSE); break; case RSL_MSG_NOT_CMD: /* 31 8.5.10 */ @@ -3475,13 +3475,13 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* Command indicator 9.3.48 M 1) TLV 3-4 */ offset = dissect_rsl_ie_cmd_ind(tvb, pinfo, tree, offset, TRUE); /* Group call reference 9.3.45 O TLV 7 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_grp_call_ref(tvb, pinfo, tree, offset, FALSE); /* Channel Description 9.3.46 O TLV 3-n */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_ch_desc(tvb, pinfo, tree, offset, FALSE); /* NCH DRX information 9.3.47 O TLV 3 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_nch_drx(tvb, pinfo, tree, offset, FALSE); break; @@ -3495,46 +3495,46 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* Channel Mode 9.3.6 M TLV 8-9 */ offset = dissect_rsl_ie_ch_mode(tvb, pinfo, tree, offset, TRUE); /* Channel Identification 9.3.5 O 7) TLV 8 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_ch_id(tvb, pinfo, tree, offset, FALSE); /* Encryption information 9.3.7 O 1) TLV >=3 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_enc_inf(tvb, pinfo, tree, offset, FALSE); /* Handover Reference 9.3.9 C 2) TV 2 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_ho_ref(tvb, pinfo, tree, offset, FALSE); /* BS Power 9.3.4 O 3) TV 2 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_bs_power(tvb, pinfo, tree, offset, FALSE); /* MS Power 9.3.13 O 3) TV 2 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_ms_pow(tvb, pinfo, tree, offset, FALSE); /* Timing Advance 9.3.24 C 3) 4) TV 2 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_timing_adv(tvb, pinfo, tree, offset, FALSE); /* BS Power Parameters 9.3.32 O 5) TLV >=2 */ /* MS Power Parameters 9.3.31 O 5) TLV >=2 */ /* Physical Context 9.3.16 O 6) TLV >=2 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_phy_ctx(tvb, pinfo, tree, offset, FALSE); /* SACCH Information 9.3.29 O 8) TLV >=3 */ /* UIC 9.3.50 O 9) TLV 3 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_uic(tvb, pinfo, tree, offset, FALSE); /* Main channel reference 9.3.51 O 10) TV 2 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_main_ch_ref(tvb, pinfo, tree, offset, FALSE); /* MultiRate configuration 9.3.52 O 11) TLV >=4 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_multirate_conf(tvb, pinfo, tree, offset, FALSE); /* MultiRate Control 9.3.53 O 12) TV 2 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_multirate_cntrl(tvb, pinfo, tree, offset, FALSE); /* Supported Codec Types 9.3.54 O 12) TLV >=5 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_sup_codec_types(tvb, pinfo, tree, offset, FALSE); /* TFO transparent container 9.3.59 O 12) TLV >=3 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_tfo_transp_cont(tvb, pinfo, tree, offset, FALSE); break; @@ -3580,7 +3580,7 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* Channel number 9.3.1 M TV 2 */ offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE); /* Access Delay 9.3.17 O 1) TV 2 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_access_delay(tvb, pinfo, tree, offset, FALSE); break; /* 8.4.8 MEASUREMENT RESULT 40 */ @@ -3594,13 +3594,13 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* BS Power 9.3.4 M TV 2 */ offset = dissect_rsl_ie_bs_power(tvb, pinfo, tree, offset, TRUE); /* L1 Information 9.3.10 O 1) TV 3 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_l1_inf(tvb, pinfo, tree, offset, FALSE); /* L3 Info (MEAS REP, EXT MEAS REP or ENH MEAS REP) 9.3.11 O 1) TLV 21 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_L3_inf(tvb, pinfo, tree, offset, FALSE, L3_INF_SACCH); /* MS Timing Offset 9.3.37 O 2) TV 2 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_ms_timing_offset(tvb, pinfo, tree, offset, FALSE); break; /* 8.4.9 MODE MODIFY */ @@ -3610,22 +3610,22 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* Channel Mode 9.3.6 M TLV 8-9 */ offset = dissect_rsl_ie_ch_mode(tvb, pinfo, tree, offset, TRUE); /* Encryption information 9.3.7 O 1) TLV >=3 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_enc_inf(tvb, pinfo, tree, offset, FALSE); /* Main channel reference 9.3.45 O 2) TV 2 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_main_ch_ref(tvb, pinfo, tree, offset, FALSE); /* MultiRate configuration 9.3.52 O 3) TLV >=3 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_multirate_conf(tvb, pinfo, tree, offset, FALSE); /* Multirate Control 9.3.53 O 4) TV 2 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_multirate_cntrl(tvb, pinfo, tree, offset, FALSE); /* Supported Codec Types 9.3.54 O 4) TLV >=5 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_sup_codec_types(tvb, pinfo, tree, offset, FALSE); /* TFO transparent container 9.3.59 O 4) TLV */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_tfo_transp_cont(tvb, pinfo, tree, offset, FALSE); break; /* 8.4.10 MODE MODIFY ACKNOWLEDGE */ @@ -3656,7 +3656,7 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* Timing Advance 9.3.24 M TV 2 */ offset = dissect_rsl_ie_timing_adv(tvb, pinfo, tree, offset, TRUE); /* Physical Context 9.3.16 O 1) TLV */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_phy_ctx(tvb, pinfo, tree, offset, FALSE); break; /* 8.4.14 RF CHANNEL RELEASE */ @@ -3669,7 +3669,7 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* Channel number 9.3.1 M TV 2 */ offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE); /* MS Power 9.3.13 M TV 2 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_ms_pow(tvb, pinfo, tree, offset, FALSE); /* MS Power Parameters 9.3.31 O 1) TLV >=2 */ break; @@ -3705,10 +3705,10 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* System Info Type 9.3.30 M TV 2 */ offset = dissect_rsl_ie_sys_info_type(tvb, pinfo, tree, offset, TRUE); /* L3 Info 9.3.11 O 1) TLV 22 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_L3_inf(tvb, pinfo, tree, offset, FALSE, L3_INF_SACCH); /* Starting Time 9.3.23 O 2) TV 3 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_starting_time(tvb, pinfo, tree, offset, FALSE); break; /* 8.4.21 TALKER DETECTION */ @@ -3716,7 +3716,7 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* Channel number 9.3.1 M TV 2 */ offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE); /* Access Delay 9.3.17 O 1) TV 2 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE); break; /* 8.4.22 LISTENER DETECTION */ @@ -3724,7 +3724,7 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* Channel number 9.3.1 M TV 2 */ offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE); /* Access Delay 9.3.17 O 1) TV 2 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE); break; /* 8.4.23 REMOTE CODEC CONFIGURATION REPORT */ @@ -3734,10 +3734,10 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* Codec Configuration 9.3.55 M TLV >=3 */ offset = dissect_rsl_ie_codec_conf(tvb, pinfo, tree, offset, TRUE); /* Supported Codec Types 9.3.54 M TLV >=5 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_sup_codec_types(tvb, pinfo, tree, offset, FALSE); /* TFO transparent container 9.3.59 O 4) TLV >=3 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_tfo_transp_cont(tvb, pinfo, tree, offset, FALSE); break; /* 8.4.24 ROUND TRIP DELAY REPORT */ @@ -3756,7 +3756,7 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* Codec Configuration 9.3.55 M TLV >=3 */ offset = dissect_rsl_ie_codec_conf(tvb, pinfo, tree, offset, TRUE); /* TFO transparent container 9.3.59 O 4) TLV >=3 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_tfo_transp_cont(tvb, pinfo, tree, offset, FALSE); break; /* 8.4.26 MULTIRATE CODEC MODIFICATION REQUEST */ @@ -3764,7 +3764,7 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* Channel number 9.3.1 M TV 2 */ offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE); /* MultiRate Configuration 9.3.52 O 1) TLV >=4 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_multirate_conf(tvb, pinfo, tree, offset, FALSE); break; /* 8.4.27 MULTIRATE CODEC MODIFICATION ACKNOWLEDGE */ @@ -3772,7 +3772,7 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* Channel number 9.3.1 M TV 2 */ offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE); /* MultiRate Configuration 9.3.52 O 1) TLV >=4 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_multirate_conf(tvb, pinfo, tree, offset, FALSE); break; /* 8.4.28 MULTIRATE CODEC MODIFICATION NEGATIVE ACKNOWLEDGE */ @@ -3803,10 +3803,10 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* MultiRateControl 9.3.53 M TV 2 */ offset = dissect_rsl_ie_multirate_cntrl(tvb, pinfo, tree, offset, TRUE); /* Supported Codec Type 9.3.54 O 1) TLV >=5 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_sup_codec_types(tvb, pinfo, tree, offset, FALSE); /* TFO transparent container 9.3.59 O 4) TLV >=3 */ - if(tvb_length_remaining(tvb,offset) > 0) + if (tvb_length_remaining(tvb,offset) > 0) offset = dissect_rsl_ie_tfo_transp_cont(tvb, pinfo, tree, offset, FALSE); break; /* 0 1 - - - - - - Location Services messages: */ @@ -3815,8 +3815,8 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) /* LLP APDU 9.3.58 M LV 2-N */ offset = dissect_rsl_ie_llp_apdu(tvb, pinfo, tree, offset, TRUE); break; - /* the following messages are ip.access specific but sent without - * ip.access memssage discriminator */ + /* the following messages are ip.access specific but sent without + * ip.access memssage discriminator */ case RSL_MSG_TYPE_IPAC_MEAS_PP_DEF: case RSL_MSG_TYPE_IPAC_HO_CAND_INQ: case RSL_MSG_TYPE_IPAC_HO_CAND_RESP: @@ -3837,36 +3837,36 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) } static const value_string rsl_ipacc_spm_s_vals[] = { - { 0, "GSM FR codec (GSM type 1, FS)" }, - { 1, "GSM EFR codec (GSM type 2, FS)" }, - { 2, "GSM AMR/FR codec (GSM type 3, FS)" }, - { 3, "GSM HR codec (GSM type 1, HS)" }, - { 5, "GSM AMR/HR codec (GSM type 3, HS)" }, - { 0xf, "As specified by RTP Payload Type IE" }, - { 0, NULL } + { 0, "GSM FR codec (GSM type 1, FS)" }, + { 1, "GSM EFR codec (GSM type 2, FS)" }, + { 2, "GSM AMR/FR codec (GSM type 3, FS)" }, + { 3, "GSM HR codec (GSM type 1, HS)" }, + { 5, "GSM AMR/HR codec (GSM type 3, HS)" }, + { 0xf, "As specified by RTP Payload Type IE" }, + { 0, NULL } }; static const value_string rsl_ipacc_spm_m_vals[] = { - { 0, "Send and Receive" }, - { 1, "Receive Only" }, - { 2, "Send Only" }, - { 0, NULL } + { 0, "Send and Receive" }, + { 1, "Receive Only" }, + { 2, "Send Only" }, + { 0, NULL } }; static const value_string rsl_ipacc_rtp_csd_fmt_d_vals[] = { - { 0, "External TRAU format" }, - { 1, "Non-TRAU Packed format" }, - { 2, "TRAU within the BTS" }, - { 3, "IWF-Free BTS-BTS Data" }, - { 0, NULL } + { 0, "External TRAU format" }, + { 1, "Non-TRAU Packed format" }, + { 2, "TRAU within the BTS" }, + { 3, "IWF-Free BTS-BTS Data" }, + { 0, NULL } }; static const value_string rsl_ipacc_rtp_csd_fmt_ir_vals[] = { - { 0, "8kb/s" }, - { 1, "16kb/s" }, - { 2, "32kb/s" }, - { 3, "64kb/s" }, - { 0, NULL } + { 0, "8kb/s" }, + { 1, "16kb/s" }, + { 2, "32kb/s" }, + { 3, "64kb/s" }, + { 0, NULL } }; static int @@ -3874,7 +3874,7 @@ dissect_rsl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_item *ti; proto_tree *rsl_tree; - guint8 msg_type; + guint8 msg_type; int offset = 0; @@ -3882,7 +3882,7 @@ dissect_rsl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "RSL"); col_clear(pinfo->cinfo, COL_INFO); - msg_type = tvb_get_guint8(tvb,offset+1)&0x7f; + msg_type = tvb_get_guint8(tvb,offset+1) & 0x7f; col_append_fstr(pinfo->cinfo, COL_INFO, "%s ",val_to_str_ext(msg_type, &rsl_msg_type_vals_ext,"unknown %u")); @@ -3890,12 +3890,12 @@ dissect_rsl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tree) { ti = proto_tree_add_item(tree, proto_rsl, tvb, 0, -1, ENC_NA); - /* if nanoBTS specific vendor messages are not enabled, skip */ + /* if nanoBTS specific vendor messages are not enabled, skip */ if (!global_rsl_use_nano_bts) { - guint8 msg_disc = tvb_get_guint8(tvb, offset) >> 1; + guint8 msg_disc = tvb_get_guint8(tvb, offset) >> 1; - if (msg_disc == RSL_MSGDISC_IPACCESS) - return 0; + if (msg_disc == RSL_MSGDISC_IPACCESS) + return 0; } rsl_tree = proto_item_add_subtree(ti, ett_rsl); @@ -4265,78 +4265,78 @@ void proto_register_rsl(void) FT_UINT8, BASE_DEC, VALS(rsl_emlpp_prio_vals), 0x03, NULL, HFILL } }, - { &hf_rsl_speech_mode_s, - { "ip.access Speech Mode S", "rsl.ipacc.speech_mode_s", - FT_UINT8, BASE_HEX, VALS(rsl_ipacc_spm_s_vals), - 0xf, NULL, HFILL } - }, - { &hf_rsl_speech_mode_m, - { "ip.access Speech Mode M", "rsl.ipacc.speech_mode_m", - FT_UINT8, BASE_HEX, VALS(rsl_ipacc_spm_m_vals), - 0xf0, NULL, HFILL } - }, - { &hf_rsl_conn_id, - { "ip.access Connection ID", "rsl.ipacc.conn_id", - FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } - }, - { &hf_rsl_rtp_payload, - { "ip.access RTP Payload Type", "rsl.ipacc.rtp_payload", - FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } - }, - { &hf_rsl_rtp_csd_fmt_d, - { "ip.access RTP CSD Format D", "rsl.ipacc.rtp_csd_fmt_d", - FT_UINT8, BASE_HEX, VALS(rsl_ipacc_rtp_csd_fmt_d_vals), - 0x0f, NULL, HFILL }, - }, - { &hf_rsl_rtp_csd_fmt_ir, - { "ip.access RTP CSD Format IR", "rsl.ipacc.rtp_csd_fmt_ir", - FT_UINT8, BASE_HEX, VALS(rsl_ipacc_rtp_csd_fmt_ir_vals), - 0xf0, NULL, HFILL }, - }, - { &hf_rsl_local_port, - { "ip.access Local RTP Port", "rsl.ipacc.local_port", - FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }, - }, - { &hf_rsl_remote_port, - { "ip.access Remote RTP Port", "rsl.ipacc.remote_port", - FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }, - }, - { &hf_rsl_local_ip, - { "ip.access Local IP Address", "rsl.ipacc.local_ip", - FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }, - }, - { &hf_rsl_remote_ip, - { "ip.access Remote IP Address", "rsl.ipacc.remote_ip", - FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }, - }, - { &hf_rsl_cstat_tx_pkts, - { "Packets Sent", "rsl.ipacc.cstat.tx_pkts", - FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } - }, - { &hf_rsl_cstat_tx_octs, - { "Octets Sent", "rsl.ipacc.cstat.tx_octets", - FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } - }, - { &hf_rsl_cstat_rx_pkts, - { "Packets Received", "rsl.ipacc.cstat.rx_pkts", - FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } - }, - { &hf_rsl_cstat_rx_octs, - { "Octets Received", "rsl.ipacc.cstat.rx_octets", - FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } - }, - { &hf_rsl_cstat_lost_pkts, - { "Packets Lost", "rsl.ipacc.cstat.lost_pkts", - FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } - }, - { &hf_rsl_cstat_ia_jitter, - { "Inter-arrival Jitter", "rsl.ipacc.cstat.ia_jitter", - FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } - }, - { &hf_rsl_cstat_avg_tx_dly, - { "Average Tx Delay", "rsl.ipacc.cstat.avg_tx_delay", - FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } - }, + { &hf_rsl_speech_mode_s, + { "ip.access Speech Mode S", "rsl.ipacc.speech_mode_s", + FT_UINT8, BASE_HEX, VALS(rsl_ipacc_spm_s_vals), + 0xf, NULL, HFILL } + }, + { &hf_rsl_speech_mode_m, + { "ip.access Speech Mode M", "rsl.ipacc.speech_mode_m", + FT_UINT8, BASE_HEX, VALS(rsl_ipacc_spm_m_vals), + 0xf0, NULL, HFILL } + }, + { &hf_rsl_conn_id, + { "ip.access Connection ID", "rsl.ipacc.conn_id", + FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } + }, + { &hf_rsl_rtp_payload, + { "ip.access RTP Payload Type", "rsl.ipacc.rtp_payload", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } + }, + { &hf_rsl_rtp_csd_fmt_d, + { "ip.access RTP CSD Format D", "rsl.ipacc.rtp_csd_fmt_d", + FT_UINT8, BASE_HEX, VALS(rsl_ipacc_rtp_csd_fmt_d_vals), + 0x0f, NULL, HFILL }, + }, + { &hf_rsl_rtp_csd_fmt_ir, + { "ip.access RTP CSD Format IR", "rsl.ipacc.rtp_csd_fmt_ir", + FT_UINT8, BASE_HEX, VALS(rsl_ipacc_rtp_csd_fmt_ir_vals), + 0xf0, NULL, HFILL }, + }, + { &hf_rsl_local_port, + { "ip.access Local RTP Port", "rsl.ipacc.local_port", + FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }, + }, + { &hf_rsl_remote_port, + { "ip.access Remote RTP Port", "rsl.ipacc.remote_port", + FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }, + }, + { &hf_rsl_local_ip, + { "ip.access Local IP Address", "rsl.ipacc.local_ip", + FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }, + }, + { &hf_rsl_remote_ip, + { "ip.access Remote IP Address", "rsl.ipacc.remote_ip", + FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }, + }, + { &hf_rsl_cstat_tx_pkts, + { "Packets Sent", "rsl.ipacc.cstat.tx_pkts", + FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } + }, + { &hf_rsl_cstat_tx_octs, + { "Octets Sent", "rsl.ipacc.cstat.tx_octets", + FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } + }, + { &hf_rsl_cstat_rx_pkts, + { "Packets Received", "rsl.ipacc.cstat.rx_pkts", + FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } + }, + { &hf_rsl_cstat_rx_octs, + { "Octets Received", "rsl.ipacc.cstat.rx_octets", + FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } + }, + { &hf_rsl_cstat_lost_pkts, + { "Packets Lost", "rsl.ipacc.cstat.lost_pkts", + FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } + }, + { &hf_rsl_cstat_ia_jitter, + { "Inter-arrival Jitter", "rsl.ipacc.cstat.ia_jitter", + FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } + }, + { &hf_rsl_cstat_avg_tx_dly, + { "Average Tx Delay", "rsl.ipacc.cstat.avg_tx_delay", + FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } + }, }; static gint *ett[] = { &ett_rsl, @@ -4394,94 +4394,94 @@ void proto_register_rsl(void) &ett_ie_meas_res_no, &ett_ie_message_id, &ett_ie_sys_info_type, - &ett_ie_speech_mode, - &ett_ie_conn_id, - &ett_ie_remote_ip, - &ett_ie_remote_port, - &ett_ie_local_port, - &ett_ie_local_ip, - &ett_ie_rtp_payload, + &ett_ie_speech_mode, + &ett_ie_conn_id, + &ett_ie_remote_ip, + &ett_ie_remote_port, + &ett_ie_local_port, + &ett_ie_local_ip, + &ett_ie_rtp_payload, }; - module_t *rsl_module; + module_t *rsl_module; -#define RSL_ATT_TLVDEF(_attr, _type, _fixed_len) \ - rsl_att_tlvdef.def[_attr].type = _type; \ - rsl_att_tlvdef.def[_attr].fixed_len = _fixed_len; \ +#define RSL_ATT_TLVDEF(_attr, _type, _fixed_len) \ + rsl_att_tlvdef.def[_attr].type = _type; \ + rsl_att_tlvdef.def[_attr].fixed_len = _fixed_len; \ - /* We register even the standard RSL IE TVLs here, not just the - * ip.access vendor specific elements. This is due to the fact that we - * don't have any formal specification for the ip.access RSL dialect, - * and this way any standard elements will be 'known' to the TLV - * parser, which can then gracefully skip over such elements and - * continue decoding the message. This will work even if the switch - * statement in dissct_rsl_ipaccess_msg() doesn't contain explicit code - * to decode them (yet?). - */ - RSL_ATT_TLVDEF(RSL_IE_CH_NO, TLV_TYPE_TV, 0); - RSL_ATT_TLVDEF(RSL_IE_LINK_ID, TLV_TYPE_TV, 0); - RSL_ATT_TLVDEF(RSL_IE_ACT_TYPE, TLV_TYPE_TV, 0); - RSL_ATT_TLVDEF(RSL_IE_BS_POW, TLV_TYPE_TV, 0); - RSL_ATT_TLVDEF(RSL_IE_CH_ID, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_CH_MODE, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_ENC_INF, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_FRAME_NO, TLV_TYPE_FIXED, 2); - RSL_ATT_TLVDEF(RSL_IE_HO_REF, TLV_TYPE_TV, 0); - RSL_ATT_TLVDEF(RSL_IE_L1_INF, TLV_TYPE_FIXED, 2); - RSL_ATT_TLVDEF(RSL_IE_L3_INF, TLV_TYPE_TL16V, 0); - RSL_ATT_TLVDEF(RSL_IE_MS_ID, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_MS_POW, TLV_TYPE_TV, 0); - RSL_ATT_TLVDEF(RSL_IE_PAGING_GRP, TLV_TYPE_TV, 0); - RSL_ATT_TLVDEF(RSL_IE_PAGING_LOAD, TLV_TYPE_FIXED, 2); - RSL_ATT_TLVDEF(RSL_IE_PHY_CTX, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_ACCESS_DELAY, TLV_TYPE_TV, 0); - RSL_ATT_TLVDEF(RSL_IE_RACH_LOAD, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_REQ_REF, TLV_TYPE_FIXED, 3); - RSL_ATT_TLVDEF(RSL_IE_REL_MODE, TLV_TYPE_TV, 0); - RSL_ATT_TLVDEF(RSL_IE_RESOURCE_INF, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_RLM_CAUSE, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_STARTING_TIME, TLV_TYPE_FIXED, 2); - RSL_ATT_TLVDEF(RSL_IE_TIMING_ADV, TLV_TYPE_TV, 0); - RSL_ATT_TLVDEF(RSL_IE_UPLINK_MEAS, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_CAUSE, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_MEAS_RES_NO, TLV_TYPE_TV, 0); - RSL_ATT_TLVDEF(RSL_IE_MESSAGE_ID, TLV_TYPE_TV, 0); - RSL_ATT_TLVDEF(RSL_IE_SYS_INFO_TYPE, TLV_TYPE_TV, 0); - RSL_ATT_TLVDEF(RSL_IE_MS_POWER_PARAM, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_BS_POWER_PARAM, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_PREPROC_PARAM, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_PREPROC_MEAS, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_ERR_MSG, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_FULL_BCCH_INF, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_CH_NEEDED, TLV_TYPE_TV, 0); - RSL_ATT_TLVDEF(RSL_IE_CB_CMD_TYPE, TLV_TYPE_TV, 0); - RSL_ATT_TLVDEF(RSL_IE_SMSCB_MESS, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_FULL_IMM_ASS_INF, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_CBCH_LOAD_INF, TLV_TYPE_TV, 0); - RSL_ATT_TLVDEF(RSL_IE_SMSCB_CH_IND, TLV_TYPE_TV, 0); - RSL_ATT_TLVDEF(RSL_IE_GRP_CALL_REF, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_CH_DESC, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_NCH_DRX_INF, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_CMD_IND, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_EMLPP_PRIO, TLV_TYPE_TV, 0); - RSL_ATT_TLVDEF(RSL_IE_UIC, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_MAIN_CH_REF, TLV_TYPE_TV, 0); - RSL_ATT_TLVDEF(RSL_IE_MULTIRATE_CONF, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_MULTIRATE_CNTRL, TLV_TYPE_TV, 0); - RSL_ATT_TLVDEF(RSL_IE_SUP_CODEC_TYPES, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_CODEC_CONF, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_RTD, TLV_TYPE_TV, 0); - RSL_ATT_TLVDEF(RSL_IE_TFO_STATUS, TLV_TYPE_TV, 0); - RSL_ATT_TLVDEF(RSL_IE_LLP_APDU, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_IPAC_REMOTE_IP, TLV_TYPE_FIXED, 4); - RSL_ATT_TLVDEF(RSL_IE_IPAC_REMOTE_PORT, TLV_TYPE_FIXED, 2); - RSL_ATT_TLVDEF(RSL_IE_IPAC_LOCAL_IP, TLV_TYPE_FIXED, 4); - RSL_ATT_TLVDEF(RSL_IE_IPAC_CONN_STAT, TLV_TYPE_TLV, 0); - RSL_ATT_TLVDEF(RSL_IE_IPAC_LOCAL_PORT, TLV_TYPE_FIXED, 2); - RSL_ATT_TLVDEF(RSL_IE_IPAC_SPEECH_MODE, TLV_TYPE_TV, 0); - RSL_ATT_TLVDEF(RSL_IE_IPAC_CONN_ID, TLV_TYPE_FIXED, 2); - RSL_ATT_TLVDEF(RSL_IE_IPAC_RTP_PAYLOAD2,TLV_TYPE_TV, 0); - RSL_ATT_TLVDEF(RSL_IE_IPAC_RTP_PAYLOAD, TLV_TYPE_TV, 0); - RSL_ATT_TLVDEF(RSL_IE_IPAC_RTP_CSD_FMT, TLV_TYPE_TV, 0); + /* We register even the standard RSL IE TVLs here, not just the + * ip.access vendor specific elements. This is due to the fact that we + * don't have any formal specification for the ip.access RSL dialect, + * and this way any standard elements will be 'known' to the TLV + * parser, which can then gracefully skip over such elements and + * continue decoding the message. This will work even if the switch + * statement in dissct_rsl_ipaccess_msg() doesn't contain explicit code + * to decode them (yet?). + */ + RSL_ATT_TLVDEF(RSL_IE_CH_NO, TLV_TYPE_TV, 0); + RSL_ATT_TLVDEF(RSL_IE_LINK_ID, TLV_TYPE_TV, 0); + RSL_ATT_TLVDEF(RSL_IE_ACT_TYPE, TLV_TYPE_TV, 0); + RSL_ATT_TLVDEF(RSL_IE_BS_POW, TLV_TYPE_TV, 0); + RSL_ATT_TLVDEF(RSL_IE_CH_ID, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_CH_MODE, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_ENC_INF, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_FRAME_NO, TLV_TYPE_FIXED, 2); + RSL_ATT_TLVDEF(RSL_IE_HO_REF, TLV_TYPE_TV, 0); + RSL_ATT_TLVDEF(RSL_IE_L1_INF, TLV_TYPE_FIXED, 2); + RSL_ATT_TLVDEF(RSL_IE_L3_INF, TLV_TYPE_TL16V, 0); + RSL_ATT_TLVDEF(RSL_IE_MS_ID, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_MS_POW, TLV_TYPE_TV, 0); + RSL_ATT_TLVDEF(RSL_IE_PAGING_GRP, TLV_TYPE_TV, 0); + RSL_ATT_TLVDEF(RSL_IE_PAGING_LOAD, TLV_TYPE_FIXED, 2); + RSL_ATT_TLVDEF(RSL_IE_PHY_CTX, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_ACCESS_DELAY, TLV_TYPE_TV, 0); + RSL_ATT_TLVDEF(RSL_IE_RACH_LOAD, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_REQ_REF, TLV_TYPE_FIXED, 3); + RSL_ATT_TLVDEF(RSL_IE_REL_MODE, TLV_TYPE_TV, 0); + RSL_ATT_TLVDEF(RSL_IE_RESOURCE_INF, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_RLM_CAUSE, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_STARTING_TIME, TLV_TYPE_FIXED, 2); + RSL_ATT_TLVDEF(RSL_IE_TIMING_ADV, TLV_TYPE_TV, 0); + RSL_ATT_TLVDEF(RSL_IE_UPLINK_MEAS, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_CAUSE, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_MEAS_RES_NO, TLV_TYPE_TV, 0); + RSL_ATT_TLVDEF(RSL_IE_MESSAGE_ID, TLV_TYPE_TV, 0); + RSL_ATT_TLVDEF(RSL_IE_SYS_INFO_TYPE, TLV_TYPE_TV, 0); + RSL_ATT_TLVDEF(RSL_IE_MS_POWER_PARAM, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_BS_POWER_PARAM, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_PREPROC_PARAM, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_PREPROC_MEAS, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_ERR_MSG, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_FULL_BCCH_INF, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_CH_NEEDED, TLV_TYPE_TV, 0); + RSL_ATT_TLVDEF(RSL_IE_CB_CMD_TYPE, TLV_TYPE_TV, 0); + RSL_ATT_TLVDEF(RSL_IE_SMSCB_MESS, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_FULL_IMM_ASS_INF, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_CBCH_LOAD_INF, TLV_TYPE_TV, 0); + RSL_ATT_TLVDEF(RSL_IE_SMSCB_CH_IND, TLV_TYPE_TV, 0); + RSL_ATT_TLVDEF(RSL_IE_GRP_CALL_REF, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_CH_DESC, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_NCH_DRX_INF, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_CMD_IND, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_EMLPP_PRIO, TLV_TYPE_TV, 0); + RSL_ATT_TLVDEF(RSL_IE_UIC, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_MAIN_CH_REF, TLV_TYPE_TV, 0); + RSL_ATT_TLVDEF(RSL_IE_MULTIRATE_CONF, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_MULTIRATE_CNTRL, TLV_TYPE_TV, 0); + RSL_ATT_TLVDEF(RSL_IE_SUP_CODEC_TYPES, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_CODEC_CONF, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_RTD, TLV_TYPE_TV, 0); + RSL_ATT_TLVDEF(RSL_IE_TFO_STATUS, TLV_TYPE_TV, 0); + RSL_ATT_TLVDEF(RSL_IE_LLP_APDU, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_IPAC_REMOTE_IP, TLV_TYPE_FIXED, 4); + RSL_ATT_TLVDEF(RSL_IE_IPAC_REMOTE_PORT, TLV_TYPE_FIXED, 2); + RSL_ATT_TLVDEF(RSL_IE_IPAC_LOCAL_IP, TLV_TYPE_FIXED, 4); + RSL_ATT_TLVDEF(RSL_IE_IPAC_CONN_STAT, TLV_TYPE_TLV, 0); + RSL_ATT_TLVDEF(RSL_IE_IPAC_LOCAL_PORT, TLV_TYPE_FIXED, 2); + RSL_ATT_TLVDEF(RSL_IE_IPAC_SPEECH_MODE, TLV_TYPE_TV, 0); + RSL_ATT_TLVDEF(RSL_IE_IPAC_CONN_ID, TLV_TYPE_FIXED, 2); + RSL_ATT_TLVDEF(RSL_IE_IPAC_RTP_PAYLOAD2,TLV_TYPE_TV, 0); + RSL_ATT_TLVDEF(RSL_IE_IPAC_RTP_PAYLOAD, TLV_TYPE_TV, 0); + RSL_ATT_TLVDEF(RSL_IE_IPAC_RTP_CSD_FMT, TLV_TYPE_TV, 0); /* Register the protocol name and description */ proto_rsl = proto_register_protocol("Radio Signalling Link (RSL)", "RSL", "rsl"); @@ -4491,11 +4491,11 @@ void proto_register_rsl(void) new_register_dissector("gsm_abis_rsl", dissect_rsl, proto_rsl); - rsl_module = prefs_register_protocol(proto_rsl, proto_reg_handoff_rsl); - prefs_register_bool_preference(rsl_module, "use_ipaccess_rsl", - "Use nanoBTS definitions", - "Use ipaccess nanoBTS specific definitions for RSL", - &global_rsl_use_nano_bts); + rsl_module = prefs_register_protocol(proto_rsl, proto_reg_handoff_rsl); + prefs_register_bool_preference(rsl_module, "use_ipaccess_rsl", + "Use nanoBTS definitions", + "Use ipaccess nanoBTS specific definitions for RSL", + &global_rsl_use_nano_bts); } void diff --git a/epan/dissectors/packet-scsi.c b/epan/dissectors/packet-scsi.c index e453d6893f..86dc36579d 100644 --- a/epan/dissectors/packet-scsi.c +++ b/epan/dissectors/packet-scsi.c @@ -41,23 +41,23 @@ * * There are four main routines that are provided: * o dissect_scsi_cdb - invoked on receiving a SCSI Command - * void dissect_scsi_cdb (tvbuff_t *, packet_info *, proto_tree *, - * guint, itlq_nexus_t *, itl_nexus_t *); + * void dissect_scsi_cdb(tvbuff_t *, packet_info *, proto_tree *, + * guint, itlq_nexus_t *, itl_nexus_t *); * o dissect_scsi_payload - invoked to decode SCSI responses - * void dissect_scsi_payload (tvbuff_t *, packet_info *, proto_tree *, guint, - * gboolean, itlq_nexusu_t *, itl_nexus_t *, - * guint32 relative_offset); + * void dissect_scsi_payload(tvbuff_t *, packet_info *, proto_tree *, guint, + * gboolean, itlq_nexusu_t *, itl_nexus_t *, + * guint32 relative_offset); * The final parameter is the length of the response field that is negotiated * as part of the SCSI transport layer. If this is not tracked by the * transport, it can be set to 0. * o dissect_scsi_rsp - invoked to dissect the scsi status code in a response * SCSI task. - * void dissect_scsi_rsp (tvbuff_t *, packet_info *, proto_tree *, - * itlq_nexus_t *, itl_nexus_t *, guint8); + * void dissect_scsi_rsp(tvbuff_t *, packet_info *, proto_tree *, + * itlq_nexus_t *, itl_nexus_t *, guint8); * o dissect_scsi_snsinfo - invoked to decode the sense data provided in case of * an error. - * void dissect_scsi_snsinfo (tvbuff_t *, packet_info *, proto_tree *, guint, - * guint, itlq_nexus_t *, itl_nexus_t *); + * void dissect_scsi_snsinfo(tvbuff_t *, packet_info *, proto_tree *, guint, + * guint, itlq_nexus_t *, itl_nexus_t *); * * In addition to this, the other requirement made from the transport is to * provide ITL and ITLQ structures that are persistent. @@ -84,8 +84,8 @@ #endif #include -#include #include +#include #include #include #include @@ -111,8 +111,8 @@ static int hf_scsi_control_reserved = -1; static int hf_scsi_control_naca = -1; static int hf_scsi_control_obs1 = -1; static int hf_scsi_control_obs2 = -1; - int hf_scsi_control = -1; - int hf_scsi_alloclen16 = -1; +int hf_scsi_control = -1; +int hf_scsi_alloclen16 = -1; static int hf_scsi_alloclen32 = -1; static int hf_scsi_time = -1; static int hf_scsi_request_frame = -1; @@ -306,22 +306,22 @@ static int hf_scsi_sbc_lbprz = -1; static int hf_scsi_sbc_anc_sup = -1; static int hf_scsi_sbc_dp = -1; static int hf_scsi_sbc_ptype = -1; -static int hf_scsi_block_limits_wsnz = -1; -static int hf_scsi_block_limits_mcawl = -1; -static int hf_scsi_block_limits_otlg = -1; -static int hf_scsi_block_limits_mtl = -1; -static int hf_scsi_block_limits_otl = -1; -static int hf_scsi_block_limits_mpl = -1; -static int hf_scsi_block_limits_mulc = -1; -static int hf_scsi_block_limits_mubdc = -1; -static int hf_scsi_block_limits_oug = -1; -static int hf_scsi_block_limits_ugavalid = -1; -static int hf_scsi_block_limits_uga = -1; -static int hf_scsi_block_limits_mwsl = -1; +static int hf_scsi_block_limits_wsnz = -1; +static int hf_scsi_block_limits_mcawl = -1; +static int hf_scsi_block_limits_otlg = -1; +static int hf_scsi_block_limits_mtl = -1; +static int hf_scsi_block_limits_otl = -1; +static int hf_scsi_block_limits_mpl = -1; +static int hf_scsi_block_limits_mulc = -1; +static int hf_scsi_block_limits_mubdc = -1; +static int hf_scsi_block_limits_oug = -1; +static int hf_scsi_block_limits_ugavalid = -1; +static int hf_scsi_block_limits_uga = -1; +static int hf_scsi_block_limits_mwsl = -1; static gint ett_scsi = -1; static gint ett_scsi_page = -1; - gint ett_scsi_control = -1; +gint ett_scsi_control = -1; static gint ett_scsi_inq_control = -1; static gint ett_scsi_inq_peripheral = -1; static gint ett_scsi_inq_acaflags = -1; @@ -360,8 +360,8 @@ const int *cdb_control_fields[6] = { static void scsi_defragment_init(void) { - fragment_table_init(&scsi_fragment_table); - reassembled_table_init(&scsi_reassembled_table); + fragment_table_init(&scsi_fragment_table); + reassembled_table_init(&scsi_reassembled_table); } static const fragment_items scsi_frag_items = { @@ -1096,19 +1096,19 @@ static const value_string scsi_devtype_val[] = { }; static const enum_val_t scsi_devtype_options[] = { - {"block", "Block Device", SCSI_DEV_SBC}, - {"sequential", "Sequential Device", SCSI_DEV_SSC}, - {"objectbased", "Object Based Storage Device", SCSI_DEV_OSD}, - {"mediumchanger", "Medium Changer Device", SCSI_DEV_SMC}, - {"cdrom", "Multimedia Device", SCSI_DEV_CDROM}, + {"block", "Block Device", SCSI_DEV_SBC}, + {"sequential", "Sequential Device", SCSI_DEV_SSC}, + {"objectbased", "Object Based Storage Device", SCSI_DEV_OSD}, + {"mediumchanger", "Medium Changer Device", SCSI_DEV_SMC}, + {"cdrom", "Multimedia Device", SCSI_DEV_CDROM}, {NULL, NULL, -1}, }; static const value_string scsi_inquiry_vers_val[] = { - {0, "No Compliance to any Standard"}, - {2, "Compliance to ANSI X3.131:1994"}, - {3, "Compliance to ANSI X3.301:1997"}, - {4, "Compliance to SPC-2"}, + {0x00, "No Compliance to any Standard"}, + {0x02, "Compliance to ANSI X3.131:1994"}, + {0x03, "Compliance to ANSI X3.301:1997"}, + {0x04, "Compliance to SPC-2"}, {0x80, "Compliance to ISO/IEC 9316:1995"}, {0x82, "Compliance to ISO/IEC 9316:1995 and to ANSI X3.131:1994"}, {0x83, "Compliance to ISO/IEC 9316:1995 and to ANSI X3.301:1997"}, @@ -1984,9 +1984,9 @@ static gint scsi_def_devtype = SCSI_DEV_SBC; typedef struct _cmdset_t { - int hf_opcode; + int hf_opcode; const value_string *cdb_vals; - scsi_cdb_table_t *cdb_table; + scsi_cdb_table_t *cdb_table; } cmdset_t; static cmdset_t *get_cmdset_data(itlq_nexus_t *itlq, itl_nexus_t *itl); @@ -1994,113 +1994,113 @@ static cmdset_t *get_cmdset_data(itlq_nexus_t *itlq, itl_nexus_t *itl); static dissector_handle_t data_handle; static void -dissect_scsi_evpd (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - guint offset, guint tot_len _U_) +dissect_scsi_evpd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, + guint offset, guint tot_len _U_) { proto_tree *evpd_tree; proto_item *ti; - guint pcode, plen, i, idlen; - guint8 codeset, flags; + guint pcode, plen, i, idlen; + guint8 codeset, flags; if (tree) { - pcode = tvb_get_guint8 (tvb, offset+1); - plen = tvb_get_guint8 (tvb, offset+3); - ti = proto_tree_add_text (tree, tvb, offset, plen+4, "Page Code: %s", - val_to_str (pcode, scsi_evpd_pagecode_val, - "Unknown (0x%08x)")); - evpd_tree = proto_item_add_subtree (ti, ett_scsi_page); + pcode = tvb_get_guint8(tvb, offset+1); + plen = tvb_get_guint8(tvb, offset+3); + ti = proto_tree_add_text(tree, tvb, offset, plen+4, "Page Code: %s", + val_to_str(pcode, scsi_evpd_pagecode_val, + "Unknown (0x%08x)")); + evpd_tree = proto_item_add_subtree(ti, ett_scsi_page); - proto_tree_add_item (evpd_tree, hf_scsi_inq_qualifier, tvb, offset, - 1, ENC_BIG_ENDIAN); - proto_tree_add_item (evpd_tree, hf_scsi_inq_devtype, tvb, offset, - 1, ENC_BIG_ENDIAN); - proto_tree_add_text (evpd_tree, tvb, offset+1, 1, - "Page Code: %s", - val_to_str (pcode, scsi_evpd_pagecode_val, - "Unknown (0x%02x)")); - proto_tree_add_text (evpd_tree, tvb, offset+3, 1, - "Page Length: %u", plen); + proto_tree_add_item(evpd_tree, hf_scsi_inq_qualifier, tvb, offset, + 1, ENC_BIG_ENDIAN); + proto_tree_add_item(evpd_tree, hf_scsi_inq_devtype, tvb, offset, + 1, ENC_BIG_ENDIAN); + proto_tree_add_text(evpd_tree, tvb, offset+1, 1, + "Page Code: %s", + val_to_str(pcode, scsi_evpd_pagecode_val, + "Unknown (0x%02x)")); + proto_tree_add_text(evpd_tree, tvb, offset+3, 1, + "Page Length: %u", plen); offset += 4; switch (pcode) { case SCSI_EVPD_SUPPPG: for (i = 0; i < plen; i++) { - proto_tree_add_text (evpd_tree, tvb, offset+i, 1, - "Supported Page: %s", - val_to_str (tvb_get_guint8 (tvb, offset+i), - scsi_evpd_pagecode_val, - "Unknown (0x%02x)")); + proto_tree_add_text(evpd_tree, tvb, offset+i, 1, + "Supported Page: %s", + val_to_str(tvb_get_guint8(tvb, offset+i), + scsi_evpd_pagecode_val, + "Unknown (0x%02x)")); } break; case SCSI_EVPD_DEVID: while (plen != 0) { - codeset = tvb_get_guint8 (tvb, offset) & 0x0F; - proto_tree_add_text (evpd_tree, tvb, offset, 1, - "Code Set: %s", - val_to_str (codeset, - scsi_devid_codeset_val, - "Unknown (0x%02x)")); + codeset = tvb_get_guint8(tvb, offset) & 0x0F; + proto_tree_add_text(evpd_tree, tvb, offset, 1, + "Code Set: %s", + val_to_str(codeset, + scsi_devid_codeset_val, + "Unknown (0x%02x)")); plen -= 1; offset += 1; if (plen < 1) { - proto_tree_add_text (evpd_tree, tvb, offset, 0, - "Product data goes past end of page"); + proto_tree_add_text(evpd_tree, tvb, offset, 0, + "Product data goes past end of page"); break; } - flags = tvb_get_guint8 (tvb, offset); - proto_tree_add_text (evpd_tree, tvb, offset, 1, - "Association: %s", - val_to_str ((flags & 0x30) >> 4, - scsi_devid_assoc_val, - "Unknown (0x%02x)")); - proto_tree_add_text (evpd_tree, tvb, offset, 1, - "Identifier Type: %s", - val_to_str ((flags & 0x0F), - scsi_devid_idtype_val, - "Unknown (0x%02x)")); + flags = tvb_get_guint8(tvb, offset); + proto_tree_add_text(evpd_tree, tvb, offset, 1, + "Association: %s", + val_to_str((flags & 0x30) >> 4, + scsi_devid_assoc_val, + "Unknown (0x%02x)")); + proto_tree_add_text(evpd_tree, tvb, offset, 1, + "Identifier Type: %s", + val_to_str((flags & 0x0F), + scsi_devid_idtype_val, + "Unknown (0x%02x)")); plen -= 1; offset += 1; /* Skip reserved byte */ if (plen < 1) { - proto_tree_add_text (evpd_tree, tvb, offset, 0, - "Product data goes past end of page"); + proto_tree_add_text(evpd_tree, tvb, offset, 0, + "Product data goes past end of page"); break; } plen -= 1; offset += 1; if (plen < 1) { - proto_tree_add_text (evpd_tree, tvb, offset, 0, - "Product data goes past end of page"); + proto_tree_add_text(evpd_tree, tvb, offset, 0, + "Product data goes past end of page"); break; } - idlen = tvb_get_guint8 (tvb, offset); - proto_tree_add_text (evpd_tree, tvb, offset, 1, - "Identifier Length: %u", idlen); + idlen = tvb_get_guint8(tvb, offset); + proto_tree_add_text(evpd_tree, tvb, offset, 1, + "Identifier Length: %u", idlen); plen -= 1; offset += 1; if (idlen != 0) { if (plen < idlen) { - proto_tree_add_text (evpd_tree, tvb, offset, 0, - "Product data goes past end of page"); + proto_tree_add_text(evpd_tree, tvb, offset, 0, + "Product data goes past end of page"); break; } if (codeset == CODESET_ASCII) { - proto_tree_add_text (evpd_tree, tvb, offset, idlen, - "Identifier: %s", - tvb_format_text (tvb, offset, - idlen)); + proto_tree_add_text(evpd_tree, tvb, offset, idlen, + "Identifier: %s", + tvb_format_text(tvb, offset, + idlen)); } else { /* * XXX - decode this based on the identifier type, * if the codeset is CODESET_BINARY? */ - proto_tree_add_text (evpd_tree, tvb, offset, idlen, - "Identifier: %s", - tvb_bytes_to_str (tvb, offset, - idlen)); + proto_tree_add_text(evpd_tree, tvb, offset, idlen, + "Identifier: %s", + tvb_bytes_to_str(tvb, offset, + idlen)); } plen -= idlen; offset += idlen; @@ -2109,61 +2109,61 @@ dissect_scsi_evpd (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, break; case SCSI_EVPD_DEVSERNUM: if (plen > 0) { - proto_tree_add_text (evpd_tree, tvb, offset, plen, - "Product Serial Number: %s", - tvb_format_text (tvb, offset, plen)); + proto_tree_add_text(evpd_tree, tvb, offset, plen, + "Product Serial Number: %s", + tvb_format_text(tvb, offset, plen)); } break; - case SCSI_EVPD_BLKLIMITS: - proto_tree_add_item (evpd_tree, hf_scsi_block_limits_wsnz, tvb, offset, 1, ENC_NA); - offset += 1; + case SCSI_EVPD_BLKLIMITS: + proto_tree_add_item(evpd_tree, hf_scsi_block_limits_wsnz, tvb, offset, 1, ENC_NA); + offset += 1; - proto_tree_add_item (evpd_tree, hf_scsi_block_limits_mcawl, tvb, offset, 1, ENC_NA); - offset += 1; + proto_tree_add_item(evpd_tree, hf_scsi_block_limits_mcawl, tvb, offset, 1, ENC_NA); + offset += 1; - proto_tree_add_item (evpd_tree, hf_scsi_block_limits_otlg, tvb, offset, 2, ENC_BIG_ENDIAN); - offset += 2; + proto_tree_add_item(evpd_tree, hf_scsi_block_limits_otlg, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; - proto_tree_add_item (evpd_tree, hf_scsi_block_limits_mtl, tvb, offset, 4, ENC_BIG_ENDIAN); - offset += 4; + proto_tree_add_item(evpd_tree, hf_scsi_block_limits_mtl, tvb, offset, 4, ENC_BIG_ENDIAN); + offset += 4; - proto_tree_add_item (evpd_tree, hf_scsi_block_limits_otl, tvb, offset, 4, ENC_BIG_ENDIAN); - offset += 4; + proto_tree_add_item(evpd_tree, hf_scsi_block_limits_otl, tvb, offset, 4, ENC_BIG_ENDIAN); + offset += 4; - proto_tree_add_item (evpd_tree, hf_scsi_block_limits_mpl, tvb, offset, 4, ENC_BIG_ENDIAN); - offset += 4; + proto_tree_add_item(evpd_tree, hf_scsi_block_limits_mpl, tvb, offset, 4, ENC_BIG_ENDIAN); + offset += 4; - proto_tree_add_item (evpd_tree, hf_scsi_block_limits_mulc, tvb, offset, 4, ENC_BIG_ENDIAN); - offset += 4; + proto_tree_add_item(evpd_tree, hf_scsi_block_limits_mulc, tvb, offset, 4, ENC_BIG_ENDIAN); + offset += 4; - proto_tree_add_item (evpd_tree, hf_scsi_block_limits_mubdc, tvb, offset, 4, ENC_BIG_ENDIAN); - offset += 4; + proto_tree_add_item(evpd_tree, hf_scsi_block_limits_mubdc, tvb, offset, 4, ENC_BIG_ENDIAN); + offset += 4; - proto_tree_add_item (evpd_tree, hf_scsi_block_limits_oug, tvb, offset, 4, ENC_BIG_ENDIAN); - offset += 4; + proto_tree_add_item(evpd_tree, hf_scsi_block_limits_oug, tvb, offset, 4, ENC_BIG_ENDIAN); + offset += 4; - proto_tree_add_item (evpd_tree, hf_scsi_block_limits_ugavalid, tvb, offset, 1, ENC_NA); - proto_tree_add_item (evpd_tree, hf_scsi_block_limits_uga, tvb, offset, 4, ENC_BIG_ENDIAN); - offset += 4; + proto_tree_add_item(evpd_tree, hf_scsi_block_limits_ugavalid, tvb, offset, 1, ENC_NA); + proto_tree_add_item(evpd_tree, hf_scsi_block_limits_uga, tvb, offset, 4, ENC_BIG_ENDIAN); + offset += 4; - proto_tree_add_item (evpd_tree, hf_scsi_block_limits_mwsl, tvb, offset, 8, ENC_BIG_ENDIAN); - offset += 8; + proto_tree_add_item(evpd_tree, hf_scsi_block_limits_mwsl, tvb, offset, 8, ENC_BIG_ENDIAN); + offset += 8; break; case SCSI_EVPD_LBP: - proto_tree_add_item (evpd_tree, hf_scsi_sbc_treshold_exponent, tvb, offset, 1, ENC_BIG_ENDIAN); - offset += 1; + proto_tree_add_item(evpd_tree, hf_scsi_sbc_treshold_exponent, tvb, offset, 1, ENC_BIG_ENDIAN); + offset += 1; - proto_tree_add_item (evpd_tree, hf_scsi_sbc_lbpu, tvb, offset, 1, ENC_NA); - proto_tree_add_item (evpd_tree, hf_scsi_sbc_lbpws, tvb, offset, 1, ENC_NA); - proto_tree_add_item (evpd_tree, hf_scsi_sbc_lbpws10, tvb, offset, 1, ENC_NA); - proto_tree_add_item (evpd_tree, hf_scsi_sbc_lbprz, tvb, offset, 1, ENC_NA); - proto_tree_add_item (evpd_tree, hf_scsi_sbc_anc_sup, tvb, offset, 1, ENC_NA); - proto_tree_add_item (evpd_tree, hf_scsi_sbc_dp, tvb, offset, 1, ENC_NA); - offset += 1; + proto_tree_add_item(evpd_tree, hf_scsi_sbc_lbpu, tvb, offset, 1, ENC_NA); + proto_tree_add_item(evpd_tree, hf_scsi_sbc_lbpws, tvb, offset, 1, ENC_NA); + proto_tree_add_item(evpd_tree, hf_scsi_sbc_lbpws10, tvb, offset, 1, ENC_NA); + proto_tree_add_item(evpd_tree, hf_scsi_sbc_lbprz, tvb, offset, 1, ENC_NA); + proto_tree_add_item(evpd_tree, hf_scsi_sbc_anc_sup, tvb, offset, 1, ENC_NA); + proto_tree_add_item(evpd_tree, hf_scsi_sbc_dp, tvb, offset, 1, ENC_NA); + offset += 1; - proto_tree_add_item (evpd_tree, hf_scsi_sbc_ptype, tvb, offset, 1, ENC_BIG_ENDIAN); - offset += 1; + proto_tree_add_item(evpd_tree, hf_scsi_sbc_ptype, tvb, offset, 1, ENC_BIG_ENDIAN); + offset += 1; break; } @@ -2171,31 +2171,31 @@ dissect_scsi_evpd (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, } static void -dissect_scsi_cmddt (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - guint offset, guint tot_len _U_) +dissect_scsi_cmddt(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, + guint offset, guint tot_len _U_) { proto_tree *cmdt_tree; proto_item *ti; - guint plen; + guint plen; if (tree) { - plen = tvb_get_guint8 (tvb, offset+5); - ti = proto_tree_add_text (tree, tvb, offset, plen, "Command Data"); - cmdt_tree = proto_item_add_subtree (ti, ett_scsi_page); + plen = tvb_get_guint8(tvb, offset+5); + ti = proto_tree_add_text(tree, tvb, offset, plen, "Command Data"); + cmdt_tree = proto_item_add_subtree(ti, ett_scsi_page); - proto_tree_add_item (cmdt_tree, hf_scsi_inq_qualifier, tvb, offset, - 1, ENC_BIG_ENDIAN); - proto_tree_add_item (cmdt_tree, hf_scsi_inq_devtype, tvb, offset, - 1, ENC_BIG_ENDIAN); - proto_tree_add_text (cmdt_tree, tvb, offset+1, 1, "Support: %s", - val_to_str (tvb_get_guint8 (tvb, offset+1) & 0x7, - scsi_cmdt_supp_val, "Unknown (%d)")); - proto_tree_add_text (cmdt_tree, tvb, offset+2, 1, "Version: %s", - val_to_str_ext (tvb_get_guint8 (tvb, offset+2), - &scsi_verdesc_val_ext, - "Unknown (0x%02x)")); - proto_tree_add_text (cmdt_tree, tvb, offset+5, 1, "CDB Size: %u", - plen); + proto_tree_add_item(cmdt_tree, hf_scsi_inq_qualifier, tvb, offset, + 1, ENC_BIG_ENDIAN); + proto_tree_add_item(cmdt_tree, hf_scsi_inq_devtype, tvb, offset, + 1, ENC_BIG_ENDIAN); + proto_tree_add_text(cmdt_tree, tvb, offset+1, 1, "Support: %s", + val_to_str(tvb_get_guint8(tvb, offset+1) & 0x7, + scsi_cmdt_supp_val, "Unknown (%d)")); + proto_tree_add_text(cmdt_tree, tvb, offset+2, 1, "Version: %s", + val_to_str_ext(tvb_get_guint8(tvb, offset+2), + &scsi_verdesc_val_ext, + "Unknown (0x%02x)")); + proto_tree_add_text(cmdt_tree, tvb, offset+5, 1, "CDB Size: %u", + plen); } } @@ -2228,46 +2228,46 @@ static const value_string inq_tpgs_vals[] = { static int dissect_spc_inq_sccsflags(tvbuff_t *tvb, int offset, proto_tree *parent_tree) { - guint8 flags; - proto_item *item=NULL; - proto_tree *tree=NULL; + guint8 flags; + proto_item *item = NULL; + proto_tree *tree = NULL; - if(parent_tree){ - item=proto_tree_add_item(parent_tree, hf_scsi_inq_sccsflags, tvb, offset, 1, ENC_BIG_ENDIAN); - tree = proto_item_add_subtree (item, ett_scsi_inq_sccsflags); + if (parent_tree) { + item = proto_tree_add_item(parent_tree, hf_scsi_inq_sccsflags, tvb, offset, 1, ENC_BIG_ENDIAN); + tree = proto_item_add_subtree(item, ett_scsi_inq_sccsflags); } - flags=tvb_get_guint8 (tvb, offset); + flags = tvb_get_guint8(tvb, offset); /* SCCS (introduced in SPC-2) */ proto_tree_add_boolean(tree, hf_scsi_inq_sccs, tvb, offset, 1, flags); - if(flags&SCSI_INQ_SCCSFLAGS_SCCS){ - proto_item_append_text(item, " SCCS"); + if (flags&SCSI_INQ_SCCSFLAGS_SCCS) { + proto_item_append_text(item, " SCCS"); } flags&=(~SCSI_INQ_SCCSFLAGS_SCCS); /* ACC (introduced in SPC-3) */ proto_tree_add_boolean(tree, hf_scsi_inq_acc, tvb, offset, 1, flags); - if(flags&SCSI_INQ_SCCSFLAGS_ACC){ - proto_item_append_text(item, " ACC"); + if (flags&SCSI_INQ_SCCSFLAGS_ACC) { + proto_item_append_text(item, " ACC"); } flags&=(~SCSI_INQ_SCCSFLAGS_ACC); /* TPGS (introduced in SPC-3) */ - proto_tree_add_item (tree, hf_scsi_inq_tpgs, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_inq_tpgs, tvb, offset, 1, ENC_BIG_ENDIAN); flags&=0xcf; /* TPC (introduced in SPC-3) */ proto_tree_add_boolean(tree, hf_scsi_inq_tpc, tvb, offset, 1, flags); - if(flags&SCSI_INQ_SCCSFLAGS_TPC){ - proto_item_append_text(item, " 3PC"); + if (flags&SCSI_INQ_SCCSFLAGS_TPC) { + proto_item_append_text(item, " 3PC"); } flags&=(~SCSI_INQ_SCCSFLAGS_TPC); /* Protect (introduced in SPC-3) */ proto_tree_add_boolean(tree, hf_scsi_inq_protect, tvb, offset, 1, flags); - if(flags&SCSI_INQ_SCCSFLAGS_PROTECT){ - proto_item_append_text(item, " PROTECT"); + if (flags&SCSI_INQ_SCCSFLAGS_PROTECT) { + proto_item_append_text(item, " PROTECT"); } flags&=(~SCSI_INQ_SCCSFLAGS_PROTECT); @@ -2285,41 +2285,41 @@ dissect_spc_inq_sccsflags(tvbuff_t *tvb, int offset, proto_tree *parent_tree) static int dissect_spc_inq_bqueflags(tvbuff_t *tvb, int offset, proto_tree *parent_tree) { - guint8 flags; - proto_item *item=NULL; - proto_tree *tree=NULL; + guint8 flags; + proto_item *item = NULL; + proto_tree *tree = NULL; - if(parent_tree){ - item=proto_tree_add_item(parent_tree, hf_scsi_inq_bqueflags, tvb, offset, 1, ENC_BIG_ENDIAN); - tree = proto_item_add_subtree (item, ett_scsi_inq_bqueflags); + if (parent_tree) { + item = proto_tree_add_item(parent_tree, hf_scsi_inq_bqueflags, tvb, offset, 1, ENC_BIG_ENDIAN); + tree = proto_item_add_subtree(item, ett_scsi_inq_bqueflags); } - flags=tvb_get_guint8 (tvb, offset); + flags = tvb_get_guint8(tvb, offset); /* BQUE (introduced in SPC-2) */ proto_tree_add_boolean(tree, hf_scsi_inq_bque, tvb, offset, 1, flags); - if(flags&SCSI_INQ_BQUEFLAGS_BQUE){ + if (flags&SCSI_INQ_BQUEFLAGS_BQUE) { proto_item_append_text(item, " BQue"); } flags&=(~SCSI_INQ_BQUEFLAGS_BQUE); /* EncServ */ proto_tree_add_boolean(tree, hf_scsi_inq_encserv, tvb, offset, 1, flags); - if(flags&SCSI_INQ_BQUEFLAGS_ENCSERV){ + if (flags&SCSI_INQ_BQUEFLAGS_ENCSERV) { proto_item_append_text(item, " EncServ"); } flags&=(~SCSI_INQ_BQUEFLAGS_ENCSERV); /* MultiP */ proto_tree_add_boolean(tree, hf_scsi_inq_multip, tvb, offset, 1, flags); - if(flags&SCSI_INQ_BQUEFLAGS_MULTIP){ + if (flags&SCSI_INQ_BQUEFLAGS_MULTIP) { proto_item_append_text(item, " MultiP"); } flags&=(~SCSI_INQ_BQUEFLAGS_MULTIP); /* MChngr */ proto_tree_add_boolean(tree, hf_scsi_inq_mchngr, tvb, offset, 1, flags); - if(flags&SCSI_INQ_BQUEFLAGS_MCHNGR){ + if (flags&SCSI_INQ_BQUEFLAGS_MCHNGR) { proto_item_append_text(item, " MChngr"); } flags&=(~SCSI_INQ_BQUEFLAGS_MCHNGR); @@ -2337,41 +2337,41 @@ dissect_spc_inq_bqueflags(tvbuff_t *tvb, int offset, proto_tree *parent_tree) static int dissect_spc_inq_reladrflags(tvbuff_t *tvb, int offset, proto_tree *parent_tree) { - guint8 flags; - proto_item *item=NULL; - proto_tree *tree=NULL; + guint8 flags; + proto_item *item = NULL; + proto_tree *tree = NULL; - if(parent_tree){ - item=proto_tree_add_item(parent_tree, hf_scsi_inq_reladrflags, tvb, offset, 1, ENC_BIG_ENDIAN); - tree = proto_item_add_subtree (item, ett_scsi_inq_reladrflags); + if (parent_tree) { + item = proto_tree_add_item(parent_tree, hf_scsi_inq_reladrflags, tvb, offset, 1, ENC_BIG_ENDIAN); + tree = proto_item_add_subtree(item, ett_scsi_inq_reladrflags); } - flags=tvb_get_guint8 (tvb, offset); + flags = tvb_get_guint8(tvb, offset); /* RelAdr (obsolete in SPC-3 and later) */ proto_tree_add_boolean(tree, hf_scsi_inq_reladr, tvb, offset, 1, flags); - if(flags&SCSI_INQ_RELADRFLAGS_RELADR){ + if (flags&SCSI_INQ_RELADRFLAGS_RELADR) { proto_item_append_text(item, " RelAdr"); } flags&=(~SCSI_INQ_RELADRFLAGS_RELADR); /* Sync */ proto_tree_add_boolean(tree, hf_scsi_inq_sync, tvb, offset, 1, flags); - if(flags&SCSI_INQ_RELADRFLAGS_SYNC){ + if (flags&SCSI_INQ_RELADRFLAGS_SYNC) { proto_item_append_text(item, " Sync"); } flags&=(~SCSI_INQ_RELADRFLAGS_SYNC); /* Linked */ proto_tree_add_boolean(tree, hf_scsi_inq_linked, tvb, offset, 1, flags); - if(flags&SCSI_INQ_RELADRFLAGS_LINKED){ + if (flags&SCSI_INQ_RELADRFLAGS_LINKED) { proto_item_append_text(item, " Linked"); } flags&=(~SCSI_INQ_RELADRFLAGS_LINKED); /* CmdQue */ proto_tree_add_boolean(tree, hf_scsi_inq_cmdque, tvb, offset, 1, flags); - if(flags&SCSI_INQ_RELADRFLAGS_CMDQUE){ + if (flags&SCSI_INQ_RELADRFLAGS_CMDQUE) { proto_item_append_text(item, " CmdQue"); } flags&=(~SCSI_INQ_RELADRFLAGS_CMDQUE); @@ -2381,14 +2381,14 @@ dissect_spc_inq_reladrflags(tvbuff_t *tvb, int offset, proto_tree *parent_tree) } void -dissect_spc_inquiry (tvbuff_t *tvb, packet_info *pinfo, - proto_tree *tree, guint offset, gboolean isreq, - gboolean iscdb, guint32 payload_len, - scsi_task_data_t *cdata) +dissect_spc_inquiry(tvbuff_t *tvb, packet_info *pinfo, + proto_tree *tree, guint offset, gboolean isreq, + gboolean iscdb, guint32 payload_len, + scsi_task_data_t *cdata) { - guint8 flags, i; - tvbuff_t *volatile tvb_v = tvb; - volatile guint offset_v = offset; + guint8 flags, i; + tvbuff_t *volatile tvb_v = tvb; + volatile guint offset_v = offset; static const int *inq_control_fields[] = { &hf_scsi_inq_control_vendor_specific, @@ -2400,75 +2400,75 @@ dissect_spc_inquiry (tvbuff_t *tvb, packet_info *pinfo, }; static const int *peripheral_fields[] = { &hf_scsi_inq_qualifier, - &hf_scsi_inq_devtype, - NULL + &hf_scsi_inq_devtype, + NULL }; static const int *aca_fields[] = { &hf_scsi_inq_aerc, /* obsolete in spc3 and forward */ - &hf_scsi_inq_trmtsk,/* obsolete in spc2 and forward */ - &hf_scsi_inq_normaca, - &hf_scsi_inq_hisup, - &hf_scsi_inq_rdf, - NULL + &hf_scsi_inq_trmtsk,/* obsolete in spc2 and forward */ + &hf_scsi_inq_normaca, + &hf_scsi_inq_hisup, + &hf_scsi_inq_rdf, + NULL }; static const int *rmb_fields[] = { &hf_scsi_inq_rmb, - NULL + NULL }; - if (!isreq && (cdata == NULL || !(cdata->itlq->flags & 0x3)) - && (tvb_length_remaining(tvb_v, offset_v)>=1) ) { + if (!isreq && ((cdata == NULL) || !(cdata->itlq->flags & 0x3)) + && (tvb_length_remaining(tvb_v, offset_v) >= 1) ) { /* - * INQUIRY response with device type information; add device type - * to list of known devices & their types if not already known. - */ - if(cdata && cdata->itl){ - cdata->itl->cmdset=tvb_get_guint8(tvb_v, offset_v)&SCSI_DEV_BITS; + * INQUIRY response with device type information; add device type + * to list of known devices & their types if not already known. + */ + if (cdata && cdata->itl) { + cdata->itl->cmdset = tvb_get_guint8(tvb_v, offset_v)&SCSI_DEV_BITS; } } if (isreq && iscdb) { - flags = tvb_get_guint8 (tvb_v, offset_v); + flags = tvb_get_guint8(tvb_v, offset_v); if (cdata) { cdata->itlq->flags = flags; } - proto_tree_add_uint_format (tree, hf_scsi_inquiry_flags, tvb_v, offset_v, 1, - flags, "CMDT = %u, EVPD = %u", - flags & 0x2, flags & 0x1); + proto_tree_add_uint_format(tree, hf_scsi_inquiry_flags, tvb_v, offset_v, 1, + flags, "CMDT = %u, EVPD = %u", + flags & 0x2, flags & 0x1); if (flags & 0x1) { - proto_tree_add_item (tree, hf_scsi_inquiry_evpd_page, tvb_v, offset_v+1, - 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_inquiry_evpd_page, tvb_v, offset_v+1, + 1, ENC_BIG_ENDIAN); } else if (flags & 0x2) { - proto_tree_add_item (tree, hf_scsi_inquiry_cmdt_page, tvb_v, offset_v+1, - 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_inquiry_cmdt_page, tvb_v, offset_v+1, + 1, ENC_BIG_ENDIAN); } - proto_tree_add_item (tree, hf_scsi_alloclen, tvb_v, offset_v+3, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_alloclen, tvb_v, offset_v+3, 1, ENC_BIG_ENDIAN); /* we need the alloc_len in the response */ - if(cdata){ - cdata->itlq->alloc_len=tvb_get_guint8(tvb_v, offset_v+3); + if (cdata) { + cdata->itlq->alloc_len = tvb_get_guint8(tvb_v, offset_v+3); } proto_tree_add_bitmask(tree, tvb_v, offset_v+4, hf_scsi_inq_control, - ett_scsi_inq_control, inq_control_fields, ENC_BIG_ENDIAN); + ett_scsi_inq_control, inq_control_fields, ENC_BIG_ENDIAN); } else if (!isreq) { if (!cdata) { return; } if (cdata->itlq->flags & 0x1) { - dissect_scsi_evpd (tvb_v, pinfo, tree, offset_v, payload_len); + dissect_scsi_evpd(tvb_v, pinfo, tree, offset_v, payload_len); return; } if (cdata->itlq->flags & 0x2) { - dissect_scsi_cmddt (tvb_v, pinfo, tree, offset_v, payload_len); + dissect_scsi_cmddt(tvb_v, pinfo, tree, offset_v, payload_len); return; } /* These pdus are sometimes truncated by SCSI allocation length - * in the CDB - */ + * in the CDB + */ TRY_SCSI_CDB_ALLOC_LEN(pinfo, tvb_v, offset_v, cdata->itlq->alloc_len); /* Qualifier and DeviceType */ @@ -2480,7 +2480,7 @@ dissect_spc_inquiry (tvbuff_t *tvb, packet_info *pinfo, offset_v+=1; /* Version */ - proto_tree_add_item (tree, hf_scsi_inq_version, tvb_v, offset_v, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_inq_version, tvb_v, offset_v, 1, ENC_BIG_ENDIAN); offset_v+=1; /* aca flags */ @@ -2493,13 +2493,13 @@ dissect_spc_inquiry (tvbuff_t *tvb, packet_info *pinfo, offset_v+=1; /* sccs flags */ - offset_v=dissect_spc_inq_sccsflags(tvb_v, offset_v, tree); + offset_v = dissect_spc_inq_sccsflags(tvb_v, offset_v, tree); /* bque flags */ - offset_v=dissect_spc_inq_bqueflags(tvb_v, offset_v, tree); + offset_v = dissect_spc_inq_bqueflags(tvb_v, offset_v, tree); /* reladdr flags */ - offset_v=dissect_spc_inq_reladrflags(tvb_v, offset_v, tree); + offset_v = dissect_spc_inq_reladrflags(tvb_v, offset_v, tree); /* vendor id */ proto_tree_add_item(tree, hf_scsi_inq_vendor_id, tvb_v, offset_v, 8, ENC_ASCII|ENC_NA); @@ -2525,7 +2525,7 @@ dissect_spc_inquiry (tvbuff_t *tvb, packet_info *pinfo, offset_v++; /* version descriptors */ - for(i=0;i<8;i++){ + for(i = 0;i<8;i++) { proto_tree_add_item(tree, hf_scsi_inq_version_desc, tvb_v, offset_v, 2, ENC_BIG_ENDIAN); offset_v+=2; } @@ -2535,21 +2535,21 @@ dissect_spc_inquiry (tvbuff_t *tvb, packet_info *pinfo, } void -dissect_spc_extcopy (tvbuff_t *tvb _U_, packet_info *pinfo _U_, - proto_tree *tree _U_, guint offset _U_, - gboolean isreq _U_, gboolean iscdb _U_, - guint payload_len _U_, scsi_task_data_t *cdata _U_) +dissect_spc_extcopy(tvbuff_t *tvb _U_, packet_info *pinfo _U_, + proto_tree *tree _U_, guint offset _U_, + gboolean isreq _U_, gboolean iscdb _U_, + guint payload_len _U_, scsi_task_data_t *cdata _U_) { } static int -dissect_scsi_log_page (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - guint offset) +dissect_scsi_log_page(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, + guint offset) { static const int *pcflags_fields[] = { &hf_scsi_log_pagecode, - NULL + NULL }; static const int *paramflags_fields[] = { &hf_scsi_log_pf_du, @@ -2563,16 +2563,17 @@ dissect_scsi_log_page (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, }; guint16 pagelen, pagecode; guint8 paramlen; - proto_tree *log_tree=NULL; - proto_item *ti=NULL; - guint old_offset=offset; + proto_tree *log_tree = NULL; + proto_item *ti = NULL; + guint old_offset = offset; const log_pages_t *log_page; - pagecode=tvb_get_guint8(tvb, offset)&0x3f; + pagecode = tvb_get_guint8(tvb, offset) & 0x3f; - if(tree){ - ti=proto_tree_add_text(tree, tvb, offset, -1, "Log Page: %s", val_to_str(pagecode, scsi_log_page_val, "Unknown (0x%04x)")); - log_tree=proto_item_add_subtree(ti, ett_scsi_log); + if (tree) { + ti = proto_tree_add_text(tree, tvb, offset, -1, + "Log Page: %s", val_to_str(pagecode, scsi_log_page_val, "Unknown (0x%04x)")); + log_tree = proto_item_add_subtree(ti, ett_scsi_log); } /* page code */ @@ -2583,29 +2584,29 @@ dissect_scsi_log_page (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, offset+=1; /* page length */ - pagelen=tvb_get_ntohs(tvb, offset); + pagelen = tvb_get_ntohs(tvb, offset); proto_tree_add_item(log_tree, hf_scsi_log_page_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2; /* find the appropriate log page */ - for(log_page=log_pages;log_page;log_page++){ - if(log_page->parameters==NULL){ - log_page=NULL; + for(log_page = log_pages;log_page;log_page++) { + if (log_page->parameters == NULL) { + log_page = NULL; break; } - if(log_page->page==pagecode){ + if (log_page->page == pagecode) { break; } } /* loop over all parameters */ - while( offset<(old_offset+4+pagelen) ){ - const log_page_parameters_t *log_parameter=NULL; + while( offset<(old_offset+4+pagelen) ) { + const log_page_parameters_t *log_parameter = NULL; guint16 log_param; /* parameter code */ - log_param=tvb_get_ntohs(tvb, offset); + log_param = tvb_get_ntohs(tvb, offset); proto_tree_add_item(log_tree, hf_scsi_log_parameter_code, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2; @@ -2614,29 +2615,29 @@ dissect_scsi_log_page (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, offset+=1; /* parameter length */ - paramlen=tvb_get_guint8(tvb, offset); + paramlen = tvb_get_guint8(tvb, offset); proto_tree_add_item(log_tree, hf_scsi_log_param_len, tvb, offset, 1, ENC_BIG_ENDIAN); offset+=1; /* find the log parameter */ - if(log_page){ - for(log_parameter=log_page->parameters;log_parameter;log_parameter++){ - if(log_parameter->dissector==NULL){ - log_parameter=NULL; + if (log_page) { + for(log_parameter = log_page->parameters;log_parameter;log_parameter++) { + if (log_parameter->dissector == NULL) { + log_parameter = NULL; break; } - if(log_parameter->number==log_param){ + if (log_parameter->number == log_param) { break; } } } /* parameter data */ - if(paramlen){ - if(log_parameter && log_parameter->dissector){ + if (paramlen) { + if (log_parameter && log_parameter->dissector) { tvbuff_t *param_tvb; - param_tvb=tvb_new_subset(tvb, offset, MIN(tvb_length_remaining(tvb, offset),paramlen), paramlen); + param_tvb = tvb_new_subset(tvb, offset, MIN(tvb_length_remaining(tvb, offset),paramlen), paramlen); log_parameter->dissector(param_tvb, pinfo, log_tree); } else { /* We did not have a dissector for this page/parameter so @@ -2653,18 +2654,18 @@ dissect_scsi_log_page (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, } void -dissect_spc_logselect (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - guint offset, gboolean isreq, gboolean iscdb, - guint payload_len _U_, scsi_task_data_t *cdata _U_) +dissect_spc_logselect(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, + guint offset, gboolean isreq, gboolean iscdb, + guint payload_len _U_, scsi_task_data_t *cdata _U_) { static const int *ppcflags_fields[] = { &hf_scsi_log_pcr, - &hf_scsi_log_sp, - NULL + &hf_scsi_log_sp, + NULL }; static const int *pcflags_fields[] = { &hf_scsi_log_pc, - NULL + NULL }; if (!tree) @@ -2672,11 +2673,11 @@ dissect_spc_logselect (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, if (isreq && iscdb) { proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_log_ppc_flags, - ett_scsi_log_ppc, ppcflags_fields, ENC_BIG_ENDIAN); + ett_scsi_log_ppc, ppcflags_fields, ENC_BIG_ENDIAN); proto_tree_add_bitmask(tree, tvb, offset+1, hf_scsi_log_pc_flags, ett_scsi_log_pc, pcflags_fields, ENC_BIG_ENDIAN); - proto_tree_add_item (tree, hf_scsi_paramlen16, tvb, offset+6, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_paramlen16, tvb, offset+6, 2, ENC_BIG_ENDIAN); proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control, - ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); + ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); } else { } @@ -2696,9 +2697,9 @@ static const true_false_string scsi_log_sp_tfs = { }; void -dissect_spc_logsense (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - guint offset, gboolean isreq, gboolean iscdb, - guint payload_len _U_, scsi_task_data_t *cdata _U_) +dissect_spc_logsense(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + guint offset, gboolean isreq, gboolean iscdb, + guint payload_len _U_, scsi_task_data_t *cdata _U_) { static const int *ppcflags_fields[] = { &hf_scsi_log_ppc, @@ -2716,14 +2717,14 @@ dissect_spc_logsense (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (isreq && iscdb) { proto_tree_add_bitmask(tree, tvb, offset, hf_scsi_log_ppc_flags, - ett_scsi_log_ppc, ppcflags_fields, ENC_BIG_ENDIAN); + ett_scsi_log_ppc, ppcflags_fields, ENC_BIG_ENDIAN); proto_tree_add_bitmask(tree, tvb, offset+1, hf_scsi_log_pc_flags, - ett_scsi_log_pc, pcflags_fields, ENC_BIG_ENDIAN); - proto_tree_add_item (tree, hf_scsi_log_parameter_ptr, tvb, offset+4, - 2, ENC_BIG_ENDIAN); - proto_tree_add_item (tree, hf_scsi_alloclen16, tvb, offset+6, 2, ENC_BIG_ENDIAN); + ett_scsi_log_pc, pcflags_fields, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_log_parameter_ptr, tvb, offset+4, + 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_alloclen16, tvb, offset+6, 2, ENC_BIG_ENDIAN); proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control, - ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); + ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); } else if (!isreq) { if (!cdata) { return; @@ -2733,11 +2734,11 @@ dissect_spc_logsense (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } static void -dissect_scsi_blockdescs (tvbuff_t *tvb, packet_info *pinfo _U_, +dissect_scsi_blockdescs(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *scsi_tree, scsi_task_data_t *cdata, gboolean longlba) { - int offset=0; + int offset = 0; /* without cdata there is no point in continuing */ if (!cdata) @@ -2745,60 +2746,60 @@ dissect_scsi_blockdescs (tvbuff_t *tvb, packet_info *pinfo _U_, while (tvb_length_remaining(tvb, offset) > 0) { if (longlba) { - if(tvb_length_remaining(tvb, offset)<8) + if (tvb_length_remaining(tvb, offset)<8) return; - proto_tree_add_text (scsi_tree, tvb, offset, 8, "No. of Blocks: %" G_GINT64_MODIFIER "u", - tvb_get_ntoh64 (tvb, offset)); + proto_tree_add_text(scsi_tree, tvb, offset, 8, "No. of Blocks: %" G_GINT64_MODIFIER "u", + tvb_get_ntoh64(tvb, offset)); offset += 8; - if(tvb_length_remaining(tvb, offset)<1) + if (tvb_length_remaining(tvb, offset)<1) return; - proto_tree_add_text (scsi_tree, tvb, offset, 1, "Density Code: 0x%02x", - tvb_get_guint8 (tvb, offset)); + proto_tree_add_text(scsi_tree, tvb, offset, 1, "Density Code: 0x%02x", + tvb_get_guint8(tvb, offset)); offset += 1; /* 3 reserved bytes */ offset += 3; - if(tvb_length_remaining(tvb, offset)<4) + if (tvb_length_remaining(tvb, offset)<4) return; - proto_tree_add_text (scsi_tree, tvb, offset, 4, "Block Length: %u", - tvb_get_ntohl (tvb, offset)); + proto_tree_add_text(scsi_tree, tvb, offset, 4, "Block Length: %u", + tvb_get_ntohl(tvb, offset)); offset += 4; } else { if ((cdata->itl->cmdset&SCSI_CMDSET_MASK) == SCSI_DEV_SBC) { - if(tvb_length_remaining(tvb, offset)<4) + if (tvb_length_remaining(tvb, offset)<4) return; - proto_tree_add_text (scsi_tree, tvb, offset, 4, "No. of Blocks: %u", - tvb_get_ntohl (tvb, offset)); + proto_tree_add_text(scsi_tree, tvb, offset, 4, "No. of Blocks: %u", + tvb_get_ntohl(tvb, offset)); offset += 4; offset++; /* reserved */ - if(tvb_length_remaining(tvb, offset)<3) + if (tvb_length_remaining(tvb, offset)<3) return; - proto_tree_add_text (scsi_tree, tvb, offset, 3, "Block Length: %u", - tvb_get_ntoh24 (tvb, offset)); + proto_tree_add_text(scsi_tree, tvb, offset, 3, "Block Length: %u", + tvb_get_ntoh24(tvb, offset)); offset += 3; } else { - if(tvb_length_remaining(tvb, offset)<1) + if (tvb_length_remaining(tvb, offset)<1) return; - proto_tree_add_text (scsi_tree, tvb, offset, 1, "Density Code: 0x%02x", - tvb_get_guint8 (tvb, offset)); + proto_tree_add_text(scsi_tree, tvb, offset, 1, "Density Code: 0x%02x", + tvb_get_guint8(tvb, offset)); offset += 1; - if(tvb_length_remaining(tvb, offset)<3) + if (tvb_length_remaining(tvb, offset)<3) return; - proto_tree_add_text (scsi_tree, tvb, offset, 3, "No. of Blocks: %u", - tvb_get_ntoh24 (tvb, offset)); + proto_tree_add_text(scsi_tree, tvb, offset, 3, "No. of Blocks: %u", + tvb_get_ntoh24(tvb, offset)); offset += 3; offset++; /* reserved */ - if(tvb_length_remaining(tvb, offset)<3) + if (tvb_length_remaining(tvb, offset)<3) return; - proto_tree_add_text (scsi_tree, tvb, offset, 3, "Block Length: %u", - tvb_get_ntoh24 (tvb, offset)); + proto_tree_add_text(scsi_tree, tvb, offset, 3, "Block Length: %u", + tvb_get_ntoh24(tvb, offset)); offset += 3; } } @@ -2806,116 +2807,116 @@ dissect_scsi_blockdescs (tvbuff_t *tvb, packet_info *pinfo _U_, } static gboolean -dissect_scsi_spc_modepage (tvbuff_t *tvb, packet_info *pinfo _U_, - proto_tree *tree, guint offset, guint8 pcode) +dissect_scsi_spc_modepage(tvbuff_t *tvb, packet_info *pinfo _U_, + proto_tree *tree, guint offset, guint8 pcode) { guint8 flags, proto; switch (pcode) { case SCSI_SPC_MODEPAGE_CTL: - flags = tvb_get_guint8 (tvb, offset+2); - proto_tree_add_item (tree, hf_scsi_modesns_tst, tvb, offset+2, 1, ENC_BIG_ENDIAN); - proto_tree_add_text (tree, tvb, offset+2, 1, - "Global Logging Target Save Disable: %u, Report Log Exception Condition: %u", - (flags & 0x2) >> 1, (flags & 0x1)); - flags = tvb_get_guint8 (tvb, offset+3); - proto_tree_add_item (tree, hf_scsi_modesns_qmod, tvb, offset+3, 1, ENC_BIG_ENDIAN); - proto_tree_add_item (tree, hf_scsi_modesns_qerr, tvb, offset+3, 1, ENC_BIG_ENDIAN); - proto_tree_add_text (tree, tvb, offset+3, 1, "Disable Queuing: %u", - flags & 0x1); - flags = tvb_get_guint8 (tvb, offset+4); - proto_tree_add_item (tree, hf_scsi_modesns_rac, tvb, offset+4, 1, ENC_BIG_ENDIAN); - proto_tree_add_item (tree, hf_scsi_modesns_tas, tvb, offset+4, 1, ENC_BIG_ENDIAN); - proto_tree_add_text (tree, tvb, offset+4, 1, - "SWP: %u, RAERP: %u, UAAERP: %u, EAERP: %u", - (flags & 0x8) >> 3, (flags & 0x4) >> 2, - (flags & 0x2) >> 1, (flags & 0x1)); - proto_tree_add_text (tree, tvb, offset+5, 1, "Autoload Mode: 0x%x", - tvb_get_guint8 (tvb, offset+5) & 0x7); - proto_tree_add_text (tree, tvb, offset+6, 2, - "Ready AER Holdoff Period: %u ms", - tvb_get_ntohs (tvb, offset+6)); - proto_tree_add_text (tree, tvb, offset+8, 2, - "Busy Timeout Period: %u ms", - tvb_get_ntohs (tvb, offset+8)*100); - proto_tree_add_text (tree, tvb, offset+10, 2, - "Extended Self-Test Completion Time: %u", - tvb_get_ntohs (tvb, offset+10)); + flags = tvb_get_guint8(tvb, offset+2); + proto_tree_add_item(tree, hf_scsi_modesns_tst, tvb, offset+2, 1, ENC_BIG_ENDIAN); + proto_tree_add_text(tree, tvb, offset+2, 1, + "Global Logging Target Save Disable: %u, Report Log Exception Condition: %u", + (flags & 0x2) >> 1, (flags & 0x1)); + flags = tvb_get_guint8(tvb, offset+3); + proto_tree_add_item(tree, hf_scsi_modesns_qmod, tvb, offset+3, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_modesns_qerr, tvb, offset+3, 1, ENC_BIG_ENDIAN); + proto_tree_add_text(tree, tvb, offset+3, 1, "Disable Queuing: %u", + flags & 0x1); + flags = tvb_get_guint8(tvb, offset+4); + proto_tree_add_item(tree, hf_scsi_modesns_rac, tvb, offset+4, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_modesns_tas, tvb, offset+4, 1, ENC_BIG_ENDIAN); + proto_tree_add_text(tree, tvb, offset+4, 1, + "SWP: %u, RAERP: %u, UAAERP: %u, EAERP: %u", + (flags & 0x8) >> 3, (flags & 0x4) >> 2, + (flags & 0x2) >> 1, (flags & 0x1)); + proto_tree_add_text(tree, tvb, offset+5, 1, "Autoload Mode: 0x%x", + tvb_get_guint8(tvb, offset+5) & 0x7); + proto_tree_add_text(tree, tvb, offset+6, 2, + "Ready AER Holdoff Period: %u ms", + tvb_get_ntohs(tvb, offset+6)); + proto_tree_add_text(tree, tvb, offset+8, 2, + "Busy Timeout Period: %u ms", + tvb_get_ntohs(tvb, offset+8)*100); + proto_tree_add_text(tree, tvb, offset+10, 2, + "Extended Self-Test Completion Time: %u", + tvb_get_ntohs(tvb, offset+10)); break; case SCSI_SPC_MODEPAGE_DISCON: - proto_tree_add_text (tree, tvb, offset+2, 1, "Buffer Full Ratio: %u", - tvb_get_guint8 (tvb, offset+2)); - proto_tree_add_text (tree, tvb, offset+3, 1, "Buffer Empty Ratio: %u", - tvb_get_guint8 (tvb, offset+3)); - proto_tree_add_text (tree, tvb, offset+4, 2, "Bus Inactivity Limit: %u", - tvb_get_ntohs (tvb, offset+4)); - proto_tree_add_text (tree, tvb, offset+6, 2, "Disconnect Time Limit: %u", - tvb_get_ntohs (tvb, offset+6)); - proto_tree_add_text (tree, tvb, offset+8, 2, "Connect Time Limit: %u", - tvb_get_ntohs (tvb, offset+8)); - proto_tree_add_text (tree, tvb, offset+10, 2, - "Maximum Burst Size: %u bytes", - tvb_get_ntohs (tvb, offset+10)*512); - flags = tvb_get_guint8 (tvb, offset+12); - proto_tree_add_text (tree, tvb, offset+12, 1, - "EMDP: %u, FAA: %u, FAB: %u, FAC: %u", - (flags & 0x80) >> 7, (flags & 0x40) >> 6, - (flags & 0x20) >> 5, (flags & 0x10) >> 4); - proto_tree_add_text (tree, tvb, offset+14, 2, - "First Burst Size: %u bytes", - tvb_get_ntohs (tvb, offset+14)*512); + proto_tree_add_text(tree, tvb, offset+2, 1, "Buffer Full Ratio: %u", + tvb_get_guint8(tvb, offset+2)); + proto_tree_add_text(tree, tvb, offset+3, 1, "Buffer Empty Ratio: %u", + tvb_get_guint8(tvb, offset+3)); + proto_tree_add_text(tree, tvb, offset+4, 2, "Bus Inactivity Limit: %u", + tvb_get_ntohs(tvb, offset+4)); + proto_tree_add_text(tree, tvb, offset+6, 2, "Disconnect Time Limit: %u", + tvb_get_ntohs(tvb, offset+6)); + proto_tree_add_text(tree, tvb, offset+8, 2, "Connect Time Limit: %u", + tvb_get_ntohs(tvb, offset+8)); + proto_tree_add_text(tree, tvb, offset+10, 2, + "Maximum Burst Size: %u bytes", + tvb_get_ntohs(tvb, offset+10)*512); + flags = tvb_get_guint8(tvb, offset+12); + proto_tree_add_text(tree, tvb, offset+12, 1, + "EMDP: %u, FAA: %u, FAB: %u, FAC: %u", + (flags & 0x80) >> 7, (flags & 0x40) >> 6, + (flags & 0x20) >> 5, (flags & 0x10) >> 4); + proto_tree_add_text(tree, tvb, offset+14, 2, + "First Burst Size: %u bytes", + tvb_get_ntohs(tvb, offset+14)*512); break; case SCSI_SPC_MODEPAGE_INFOEXCP: - flags = tvb_get_guint8 (tvb, offset+2); - proto_tree_add_text (tree, tvb, offset+2, 1, - "Perf: %u, EBF: %u, EWasc: %u, DExcpt: %u, Test: %u, LogErr: %u", - (flags & 0x80) >> 7, (flags & 0x20) >> 5, - (flags & 0x10) >> 4, (flags & 0x08) >> 3, - (flags & 0x04) >> 2, (flags & 0x01)); + flags = tvb_get_guint8(tvb, offset+2); + proto_tree_add_text(tree, tvb, offset+2, 1, + "Perf: %u, EBF: %u, EWasc: %u, DExcpt: %u, Test: %u, LogErr: %u", + (flags & 0x80) >> 7, (flags & 0x20) >> 5, + (flags & 0x10) >> 4, (flags & 0x08) >> 3, + (flags & 0x04) >> 2, (flags & 0x01)); if (!((flags & 0x10) >> 4) && ((flags & 0x08) >> 3)) { proto_item *hidden_item; - hidden_item = proto_tree_add_item (tree, hf_scsi_modesns_errrep, tvb, - offset+3, 1, ENC_BIG_ENDIAN); + hidden_item = proto_tree_add_item(tree, hf_scsi_modesns_errrep, tvb, + offset+3, 1, ENC_BIG_ENDIAN); PROTO_ITEM_SET_HIDDEN(hidden_item); } else { - proto_tree_add_item (tree, hf_scsi_modesns_errrep, tvb, offset+3, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_modesns_errrep, tvb, offset+3, 1, ENC_BIG_ENDIAN); } - proto_tree_add_text (tree, tvb, offset+4, 4, "Interval Timer: %u", - tvb_get_ntohl (tvb, offset+4)); - proto_tree_add_text (tree, tvb, offset+8, 4, "Report Count: %u", - tvb_get_ntohl (tvb, offset+8)); + proto_tree_add_text(tree, tvb, offset+4, 4, "Interval Timer: %u", + tvb_get_ntohl(tvb, offset+4)); + proto_tree_add_text(tree, tvb, offset+8, 4, "Report Count: %u", + tvb_get_ntohl(tvb, offset+8)); break; case SCSI_SPC_MODEPAGE_PWR: - flags = tvb_get_guint8 (tvb, offset+3); - proto_tree_add_text (tree, tvb, offset+3, 1, "Idle: %u, Standby: %u", - (flags & 0x2) >> 1, (flags & 0x1)); - proto_tree_add_text (tree, tvb, offset+4, 2, - "Idle Condition Timer: %u ms", - tvb_get_ntohs (tvb, offset+4) * 100); - proto_tree_add_text (tree, tvb, offset+6, 2, - "Standby Condition Timer: %u ms", - tvb_get_ntohs (tvb, offset+6) * 100); + flags = tvb_get_guint8(tvb, offset+3); + proto_tree_add_text(tree, tvb, offset+3, 1, "Idle: %u, Standby: %u", + (flags & 0x2) >> 1, (flags & 0x1)); + proto_tree_add_text(tree, tvb, offset+4, 2, + "Idle Condition Timer: %u ms", + tvb_get_ntohs(tvb, offset+4) * 100); + proto_tree_add_text(tree, tvb, offset+6, 2, + "Standby Condition Timer: %u ms", + tvb_get_ntohs(tvb, offset+6) * 100); break; case SCSI_SPC_MODEPAGE_LUN: return FALSE; case SCSI_SPC_MODEPAGE_PORT: - proto = tvb_get_guint8 (tvb, offset+2) & 0x0F; - proto_tree_add_item (tree, hf_scsi_protocol, tvb, offset+2, 1, ENC_BIG_ENDIAN); + proto = tvb_get_guint8(tvb, offset+2) & 0x0F; + proto_tree_add_item(tree, hf_scsi_protocol, tvb, offset+2, 1, ENC_BIG_ENDIAN); if (proto == SCSI_PROTO_FCP) { - flags = tvb_get_guint8 (tvb, offset+3); - proto_tree_add_text (tree, tvb, offset+3, 1, - "DTFD: %u, PLPB: %u, DDIS: %u, DLM: %u, RHA: %u, ALWI: %u, DTIPE: %u, DTOLI:%u", - (flags & 0x80) >> 7, (flags & 0x40) >> 6, - (flags & 0x20) >> 5, (flags & 0x10) >> 4, - (flags & 0x08) >> 3, (flags & 0x04) >> 2, - (flags & 0x02) >> 1, (flags & 0x1)); - proto_tree_add_text (tree, tvb, offset+6, 1, "RR_TOV Units: %s", - val_to_str (tvb_get_guint8 (tvb, offset+6) & 0x7, - scsi_fcp_rrtov_val, - "Unknown (0x%02x)")); - proto_tree_add_text (tree, tvb, offset+7, 1, "RR_TOV: %u", - tvb_get_guint8 (tvb, offset+7)); + flags = tvb_get_guint8(tvb, offset+3); + proto_tree_add_text(tree, tvb, offset+3, 1, + "DTFD: %u, PLPB: %u, DDIS: %u, DLM: %u, RHA: %u, ALWI: %u, DTIPE: %u, DTOLI:%u", + (flags & 0x80) >> 7, (flags & 0x40) >> 6, + (flags & 0x20) >> 5, (flags & 0x10) >> 4, + (flags & 0x08) >> 3, (flags & 0x04) >> 2, + (flags & 0x02) >> 1, (flags & 0x1)); + proto_tree_add_text(tree, tvb, offset+6, 1, "RR_TOV Units: %s", + val_to_str(tvb_get_guint8(tvb, offset+6) & 0x7, + scsi_fcp_rrtov_val, + "Unknown (0x%02x)")); + proto_tree_add_text(tree, tvb, offset+7, 1, "RR_TOV: %u", + tvb_get_guint8(tvb, offset+7)); } else if (proto == SCSI_PROTO_iSCSI) { return FALSE; @@ -2933,125 +2934,125 @@ dissect_scsi_spc_modepage (tvbuff_t *tvb, packet_info *pinfo _U_, } static gboolean -dissect_scsi_sbc_modepage (tvbuff_t *tvb, packet_info *pinfo _U_, - proto_tree *tree, guint offset, guint8 pcode) +dissect_scsi_sbc_modepage(tvbuff_t *tvb, packet_info *pinfo _U_, + proto_tree *tree, guint offset, guint8 pcode) { guint8 flags; switch (pcode) { case SCSI_SBC_MODEPAGE_FMTDEV: - proto_tree_add_text (tree, tvb, offset+2, 2, "Tracks Per Zone: %u", - tvb_get_ntohs (tvb, offset+2)); - proto_tree_add_text (tree, tvb, offset+4, 2, - "Alternate Sectors Per Zone: %u", - tvb_get_ntohs (tvb, offset+4)); - proto_tree_add_text (tree, tvb, offset+6, 2, - "Alternate Tracks Per Zone: %u", - tvb_get_ntohs (tvb, offset+6)); - proto_tree_add_text (tree, tvb, offset+8, 2, - "Alternate Tracks Per LU: %u", - tvb_get_ntohs (tvb, offset+8)); - proto_tree_add_text (tree, tvb, offset+10, 2, "Sectors Per Track: %u", - tvb_get_ntohs (tvb, offset+10)); - proto_tree_add_text (tree, tvb, offset+12, 2, - "Data Bytes Per Physical Sector: %u", - tvb_get_ntohs (tvb, offset+12)); - proto_tree_add_text (tree, tvb, offset+14, 2, "Interleave: %u", - tvb_get_ntohs (tvb, offset+14)); - proto_tree_add_text (tree, tvb, offset+16, 2, "Track Skew Factor: %u", - tvb_get_ntohs (tvb, offset+16)); - proto_tree_add_text (tree, tvb, offset+18, 2, - "Cylinder Skew Factor: %u", - tvb_get_ntohs (tvb, offset+18)); - flags = tvb_get_guint8 (tvb, offset+20); - proto_tree_add_text (tree, tvb, offset+20, 1, - "SSEC: %u, HSEC: %u, RMB: %u, SURF: %u", - (flags & 0x80) >> 7, (flags & 0x40) >> 6, - (flags & 0x20) >> 5, (flags & 0x10) >> 4); + proto_tree_add_text(tree, tvb, offset+2, 2, "Tracks Per Zone: %u", + tvb_get_ntohs(tvb, offset+2)); + proto_tree_add_text(tree, tvb, offset+4, 2, + "Alternate Sectors Per Zone: %u", + tvb_get_ntohs(tvb, offset+4)); + proto_tree_add_text(tree, tvb, offset+6, 2, + "Alternate Tracks Per Zone: %u", + tvb_get_ntohs(tvb, offset+6)); + proto_tree_add_text(tree, tvb, offset+8, 2, + "Alternate Tracks Per LU: %u", + tvb_get_ntohs(tvb, offset+8)); + proto_tree_add_text(tree, tvb, offset+10, 2, "Sectors Per Track: %u", + tvb_get_ntohs(tvb, offset+10)); + proto_tree_add_text(tree, tvb, offset+12, 2, + "Data Bytes Per Physical Sector: %u", + tvb_get_ntohs(tvb, offset+12)); + proto_tree_add_text(tree, tvb, offset+14, 2, "Interleave: %u", + tvb_get_ntohs(tvb, offset+14)); + proto_tree_add_text(tree, tvb, offset+16, 2, "Track Skew Factor: %u", + tvb_get_ntohs(tvb, offset+16)); + proto_tree_add_text(tree, tvb, offset+18, 2, + "Cylinder Skew Factor: %u", + tvb_get_ntohs(tvb, offset+18)); + flags = tvb_get_guint8(tvb, offset+20); + proto_tree_add_text(tree, tvb, offset+20, 1, + "SSEC: %u, HSEC: %u, RMB: %u, SURF: %u", + (flags & 0x80) >> 7, (flags & 0x40) >> 6, + (flags & 0x20) >> 5, (flags & 0x10) >> 4); break; case SCSI_SBC_MODEPAGE_RDWRERR: - flags = tvb_get_guint8 (tvb, offset+2); - proto_tree_add_text (tree, tvb, offset+2, 1, - "AWRE: %u, ARRE: %u, TB: %u, RC: %u, EER: %u, PER: %u, DTE: %u, DCR: %u", - (flags & 0x80) >> 7, (flags & 0x40) >> 6, - (flags & 0x20) >> 5, (flags & 0x10) >> 4, - (flags & 0x08) >> 3, (flags & 0x04) >> 2, - (flags & 0x02) >> 1, (flags & 0x01)); - proto_tree_add_text (tree, tvb, offset+3, 1, "Read Retry Count: %u", - tvb_get_guint8 (tvb, offset+3)); - proto_tree_add_text (tree, tvb, offset+4, 1, "Correction Span: %u", - tvb_get_guint8 (tvb, offset+4)); - proto_tree_add_text (tree, tvb, offset+5, 1, "Head Offset Count: %u", - tvb_get_guint8 (tvb, offset+5)); - proto_tree_add_text (tree, tvb, offset+6, 1, - "Data Strobe Offset Count: %u", - tvb_get_guint8 (tvb, offset+6)); - proto_tree_add_text (tree, tvb, offset+8, 1, "Write Retry Count: %u", - tvb_get_guint8 (tvb, offset+8)); - proto_tree_add_text (tree, tvb, offset+10, 2, - "Recovery Time Limit: %u ms", - tvb_get_ntohs (tvb, offset+10)); + flags = tvb_get_guint8(tvb, offset+2); + proto_tree_add_text(tree, tvb, offset+2, 1, + "AWRE: %u, ARRE: %u, TB: %u, RC: %u, EER: %u, PER: %u, DTE: %u, DCR: %u", + (flags & 0x80) >> 7, (flags & 0x40) >> 6, + (flags & 0x20) >> 5, (flags & 0x10) >> 4, + (flags & 0x08) >> 3, (flags & 0x04) >> 2, + (flags & 0x02) >> 1, (flags & 0x01)); + proto_tree_add_text(tree, tvb, offset+3, 1, "Read Retry Count: %u", + tvb_get_guint8(tvb, offset+3)); + proto_tree_add_text(tree, tvb, offset+4, 1, "Correction Span: %u", + tvb_get_guint8(tvb, offset+4)); + proto_tree_add_text(tree, tvb, offset+5, 1, "Head Offset Count: %u", + tvb_get_guint8(tvb, offset+5)); + proto_tree_add_text(tree, tvb, offset+6, 1, + "Data Strobe Offset Count: %u", + tvb_get_guint8(tvb, offset+6)); + proto_tree_add_text(tree, tvb, offset+8, 1, "Write Retry Count: %u", + tvb_get_guint8(tvb, offset+8)); + proto_tree_add_text(tree, tvb, offset+10, 2, + "Recovery Time Limit: %u ms", + tvb_get_ntohs(tvb, offset+10)); break; - case SCSI_SBC_MODEPAGE_DISKGEOM: - proto_tree_add_text (tree, tvb, offset+2, 3, "Number of Cylinders: %u", - tvb_get_ntoh24 (tvb, offset+2)); - proto_tree_add_text (tree, tvb, offset+5, 1, "Number of Heads: %u", - tvb_get_guint8 (tvb, offset+5)); - proto_tree_add_text (tree, tvb, offset+6, 3, - "Starting Cyl Pre-compensation: %u", - tvb_get_ntoh24 (tvb, offset+6)); - proto_tree_add_text (tree, tvb, offset+9, 3, - "Starting Cyl-reduced Write Current: %u", - tvb_get_ntoh24 (tvb, offset+9)); - proto_tree_add_text (tree, tvb, offset+12, 2, "Device Step Rate: %u", - tvb_get_ntohs (tvb, offset+12)); - proto_tree_add_text (tree, tvb, offset+14, 3, "Landing Zone Cyl: %u", - tvb_get_ntoh24 (tvb, offset+14)); - proto_tree_add_text (tree, tvb, offset+18, 1, "Rotational Offset: %u", - tvb_get_guint8 (tvb, offset+18)); - proto_tree_add_text (tree, tvb, offset+20, 2, - "Medium Rotation Rate: %u", - tvb_get_ntohs (tvb, offset+20)); + case SCSI_SBC_MODEPAGE_DISKGEOM: + proto_tree_add_text(tree, tvb, offset+2, 3, "Number of Cylinders: %u", + tvb_get_ntoh24(tvb, offset+2)); + proto_tree_add_text(tree, tvb, offset+5, 1, "Number of Heads: %u", + tvb_get_guint8(tvb, offset+5)); + proto_tree_add_text(tree, tvb, offset+6, 3, + "Starting Cyl Pre-compensation: %u", + tvb_get_ntoh24(tvb, offset+6)); + proto_tree_add_text(tree, tvb, offset+9, 3, + "Starting Cyl-reduced Write Current: %u", + tvb_get_ntoh24(tvb, offset+9)); + proto_tree_add_text(tree, tvb, offset+12, 2, "Device Step Rate: %u", + tvb_get_ntohs(tvb, offset+12)); + proto_tree_add_text(tree, tvb, offset+14, 3, "Landing Zone Cyl: %u", + tvb_get_ntoh24(tvb, offset+14)); + proto_tree_add_text(tree, tvb, offset+18, 1, "Rotational Offset: %u", + tvb_get_guint8(tvb, offset+18)); + proto_tree_add_text(tree, tvb, offset+20, 2, + "Medium Rotation Rate: %u", + tvb_get_ntohs(tvb, offset+20)); break; case SCSI_SBC_MODEPAGE_FLEXDISK: return FALSE; case SCSI_SBC_MODEPAGE_VERERR: return FALSE; case SCSI_SBC_MODEPAGE_CACHE: - flags = tvb_get_guint8 (tvb, offset+2); - proto_tree_add_text (tree, tvb, offset+2, 1, - "IC: %u, ABPF: %u, CAP %u, Disc: %u, Size: %u, WCE: %u, MF: %u, RCD: %u", - (flags & 0x80) >> 7, (flags & 0x40) >> 6, - (flags & 0x20) >> 5, (flags & 0x10) >> 4, - (flags & 0x08) >> 3, (flags & 0x04) >> 2, - (flags & 0x02) >> 1, (flags & 0x01)); - flags = tvb_get_guint8 (tvb, offset+3); - proto_tree_add_text (tree, tvb, offset+3, 1, - "Demand Read Retention Priority: %u, Write Retention Priority: %u", - (flags & 0xF0) >> 4, (flags & 0x0F)); - proto_tree_add_text (tree, tvb, offset+4, 2, - "Disable Pre-fetch Xfer Len: %u", - tvb_get_ntohs (tvb, offset+4)); - proto_tree_add_text (tree, tvb, offset+6, 2, "Minimum Pre-Fetch: %u", - tvb_get_ntohs (tvb, offset+6)); - proto_tree_add_text (tree, tvb, offset+8, 2, "Maximum Pre-Fetch: %u", - tvb_get_ntohs (tvb, offset+8)); - proto_tree_add_text (tree, tvb, offset+10, 2, - "Maximum Pre-Fetch Ceiling: %u", - tvb_get_ntohs (tvb, offset+10)); - flags = tvb_get_guint8 (tvb, offset+12); - proto_tree_add_text (tree, tvb, offset+12, 1, - "FSW: %u, LBCSS: %u, DRA: %u, Vendor Specific: %u", - (flags & 0x80) >> 7, (flags & 0x40) >> 6, - (flags & 0x20) >> 5, (flags & 0x1F) >> 4); - proto_tree_add_text (tree, tvb, offset+13, 1, - "Number of Cache Segments: %u", - tvb_get_guint8 (tvb, offset+13)); - proto_tree_add_text (tree, tvb, offset+14, 2, "Cache Segment Size: %u", - tvb_get_ntohs (tvb, offset+14)); - proto_tree_add_text (tree, tvb, offset+17, 3, - "Non-Cache Segment Size: %u", - tvb_get_ntoh24 (tvb, offset+17)); + flags = tvb_get_guint8(tvb, offset+2); + proto_tree_add_text(tree, tvb, offset+2, 1, + "IC: %u, ABPF: %u, CAP %u, Disc: %u, Size: %u, WCE: %u, MF: %u, RCD: %u", + (flags & 0x80) >> 7, (flags & 0x40) >> 6, + (flags & 0x20) >> 5, (flags & 0x10) >> 4, + (flags & 0x08) >> 3, (flags & 0x04) >> 2, + (flags & 0x02) >> 1, (flags & 0x01)); + flags = tvb_get_guint8(tvb, offset+3); + proto_tree_add_text(tree, tvb, offset+3, 1, + "Demand Read Retention Priority: %u, Write Retention Priority: %u", + (flags & 0xF0) >> 4, (flags & 0x0F)); + proto_tree_add_text(tree, tvb, offset+4, 2, + "Disable Pre-fetch Xfer Len: %u", + tvb_get_ntohs(tvb, offset+4)); + proto_tree_add_text(tree, tvb, offset+6, 2, "Minimum Pre-Fetch: %u", + tvb_get_ntohs(tvb, offset+6)); + proto_tree_add_text(tree, tvb, offset+8, 2, "Maximum Pre-Fetch: %u", + tvb_get_ntohs(tvb, offset+8)); + proto_tree_add_text(tree, tvb, offset+10, 2, + "Maximum Pre-Fetch Ceiling: %u", + tvb_get_ntohs(tvb, offset+10)); + flags = tvb_get_guint8(tvb, offset+12); + proto_tree_add_text(tree, tvb, offset+12, 1, + "FSW: %u, LBCSS: %u, DRA: %u, Vendor Specific: %u", + (flags & 0x80) >> 7, (flags & 0x40) >> 6, + (flags & 0x20) >> 5, (flags & 0x1F) >> 4); + proto_tree_add_text(tree, tvb, offset+13, 1, + "Number of Cache Segments: %u", + tvb_get_guint8(tvb, offset+13)); + proto_tree_add_text(tree, tvb, offset+14, 2, "Cache Segment Size: %u", + tvb_get_ntohs(tvb, offset+14)); + proto_tree_add_text(tree, tvb, offset+17, 3, + "Non-Cache Segment Size: %u", + tvb_get_ntoh24(tvb, offset+17)); break; case SCSI_SBC_MODEPAGE_MEDTYPE: return FALSE; @@ -3078,111 +3079,111 @@ static const value_string compression_algorithm_vals[] = { }; static gboolean -dissect_scsi_ssc2_modepage (tvbuff_t *tvb _U_, packet_info *pinfo _U_, - proto_tree *tree _U_, guint offset _U_, - guint8 pcode) +dissect_scsi_ssc2_modepage(tvbuff_t *tvb _U_, packet_info *pinfo _U_, + proto_tree *tree _U_, guint offset _U_, + guint8 pcode) { guint8 flags; switch (pcode) { case SCSI_SSC2_MODEPAGE_DATACOMP: - flags = tvb_get_guint8 (tvb, offset+2); - proto_tree_add_text (tree, tvb, offset+2, 1, - "DCE: %u, DCC: %u", - (flags & 0x80) >> 7, (flags & 0x40) >> 6); - flags = tvb_get_guint8 (tvb, offset+3); - proto_tree_add_text (tree, tvb, offset+3, 1, - "DDE: %u, RED: %u", - (flags & 0x80) >> 7, (flags & 0x60) >> 5); - proto_tree_add_text (tree, tvb, offset+4, 4, - "Compression algorithm: %s", - val_to_str (tvb_get_ntohl (tvb, offset+4), - compression_algorithm_vals, - "Unknown (0x%08x)")); - proto_tree_add_text (tree, tvb, offset+8, 4, - "Decompression algorithm: %s", - val_to_str (tvb_get_ntohl (tvb, offset+4), - compression_algorithm_vals, - "Unknown (0x%08x)")); + flags = tvb_get_guint8(tvb, offset+2); + proto_tree_add_text(tree, tvb, offset+2, 1, + "DCE: %u, DCC: %u", + (flags & 0x80) >> 7, (flags & 0x40) >> 6); + flags = tvb_get_guint8(tvb, offset+3); + proto_tree_add_text(tree, tvb, offset+3, 1, + "DDE: %u, RED: %u", + (flags & 0x80) >> 7, (flags & 0x60) >> 5); + proto_tree_add_text(tree, tvb, offset+4, 4, + "Compression algorithm: %s", + val_to_str(tvb_get_ntohl(tvb, offset+4), + compression_algorithm_vals, + "Unknown (0x%08x)")); + proto_tree_add_text(tree, tvb, offset+8, 4, + "Decompression algorithm: %s", + val_to_str(tvb_get_ntohl(tvb, offset+4), + compression_algorithm_vals, + "Unknown (0x%08x)")); break; case SCSI_SSC2_MODEPAGE_DEVCONF: - flags = tvb_get_guint8 (tvb, offset+2); - proto_tree_add_text (tree, tvb, offset+2, 1, - "CAF: %u, Active Format: %u", - (flags & 0x20) >> 5, (flags & 0x1f)); - flags = tvb_get_guint8 (tvb, offset+3); - proto_tree_add_text (tree, tvb, offset+3, 1, - "Active Partition: %u", - flags); - flags = tvb_get_guint8 (tvb, offset+4); - proto_tree_add_text (tree, tvb, offset+4, 1, - "Write Object Buffer Full Ratio: %u", - flags); - flags = tvb_get_guint8 (tvb, offset+5); - proto_tree_add_text (tree, tvb, offset+5, 1, - "Read Object Buffer Empty Ratio: %u", - flags); - proto_tree_add_text (tree, tvb, offset+6, 2, - "Write Delay time: %u 100ms", - tvb_get_ntohs (tvb, offset+6)); - flags = tvb_get_guint8 (tvb, offset+8); - proto_tree_add_text (tree, tvb, offset+8, 1, - "OBR: %u, LOIS: %u, RSMK: %u, AVC: %u, SOCF: %u, ROBO: %u, REW: %u", - (flags & 0x80) >> 7, (flags & 0x40) >> 6, - (flags & 0x20) >> 5, (flags & 0x10) >> 4, - (flags & 0x0c) >> 2, (flags & 0x02) >> 1, - (flags & 0x01)); - flags = tvb_get_guint8 (tvb, offset+9); - proto_tree_add_text (tree, tvb, offset+9, 1, - "Gap Size: %u", - flags); - flags = tvb_get_guint8 (tvb, offset+10); - proto_tree_add_text (tree, tvb, offset+10, 1, - "EOD Defined: %u, EEG: %u, SEW: %u, SWP: %u, BAML: %u, BAM: %u", - (flags & 0xe0) >> 5, (flags & 0x10) >> 4, - (flags & 0x08) >> 3, (flags & 0x04) >> 2, - (flags & 0x02) >> 1, (flags & 0x01)); - proto_tree_add_text (tree, tvb, offset+11, 3, - "Object Buffer Size At Early Warning: %u", - tvb_get_ntoh24 (tvb, offset+11)); - flags = tvb_get_guint8 (tvb, offset+14); - proto_tree_add_text (tree, tvb, offset+14, 1, - "Select Data Compression Algorithm: %u", - flags); - flags = tvb_get_guint8 (tvb, offset+15); - proto_tree_add_text (tree, tvb, offset+15, 1, - "OIR: %u, ReWind on Reset: %u, ASOCWP: %u, PERSWP: %u, PRMWP: %u", - (flags & 0x20) >> 5, (flags & 0x18) >> 3, - (flags & 0x04) >> 2, (flags & 0x02) >> 1, - (flags & 0x01)); + flags = tvb_get_guint8(tvb, offset+2); + proto_tree_add_text(tree, tvb, offset+2, 1, + "CAF: %u, Active Format: %u", + (flags & 0x20) >> 5, (flags & 0x1f)); + flags = tvb_get_guint8(tvb, offset+3); + proto_tree_add_text(tree, tvb, offset+3, 1, + "Active Partition: %u", + flags); + flags = tvb_get_guint8(tvb, offset+4); + proto_tree_add_text(tree, tvb, offset+4, 1, + "Write Object Buffer Full Ratio: %u", + flags); + flags = tvb_get_guint8(tvb, offset+5); + proto_tree_add_text(tree, tvb, offset+5, 1, + "Read Object Buffer Empty Ratio: %u", + flags); + proto_tree_add_text(tree, tvb, offset+6, 2, + "Write Delay time: %u 100ms", + tvb_get_ntohs(tvb, offset+6)); + flags = tvb_get_guint8(tvb, offset+8); + proto_tree_add_text(tree, tvb, offset+8, 1, + "OBR: %u, LOIS: %u, RSMK: %u, AVC: %u, SOCF: %u, ROBO: %u, REW: %u", + (flags & 0x80) >> 7, (flags & 0x40) >> 6, + (flags & 0x20) >> 5, (flags & 0x10) >> 4, + (flags & 0x0c) >> 2, (flags & 0x02) >> 1, + (flags & 0x01)); + flags = tvb_get_guint8(tvb, offset+9); + proto_tree_add_text(tree, tvb, offset+9, 1, + "Gap Size: %u", + flags); + flags = tvb_get_guint8(tvb, offset+10); + proto_tree_add_text(tree, tvb, offset+10, 1, + "EOD Defined: %u, EEG: %u, SEW: %u, SWP: %u, BAML: %u, BAM: %u", + (flags & 0xe0) >> 5, (flags & 0x10) >> 4, + (flags & 0x08) >> 3, (flags & 0x04) >> 2, + (flags & 0x02) >> 1, (flags & 0x01)); + proto_tree_add_text(tree, tvb, offset+11, 3, + "Object Buffer Size At Early Warning: %u", + tvb_get_ntoh24(tvb, offset+11)); + flags = tvb_get_guint8(tvb, offset+14); + proto_tree_add_text(tree, tvb, offset+14, 1, + "Select Data Compression Algorithm: %u", + flags); + flags = tvb_get_guint8(tvb, offset+15); + proto_tree_add_text(tree, tvb, offset+15, 1, + "OIR: %u, ReWind on Reset: %u, ASOCWP: %u, PERSWP: %u, PRMWP: %u", + (flags & 0x20) >> 5, (flags & 0x18) >> 3, + (flags & 0x04) >> 2, (flags & 0x02) >> 1, + (flags & 0x01)); break; case SCSI_SSC2_MODEPAGE_MEDPAR1: - flags = tvb_get_guint8 (tvb, offset+2); - proto_tree_add_text (tree, tvb, offset+2, 1, - "Maximum Additional Partitions: %u", - flags); - flags = tvb_get_guint8 (tvb, offset+3); - proto_tree_add_text (tree, tvb, offset+3, 1, - "Additional Partitions Defined: %u", - flags); - flags = tvb_get_guint8 (tvb, offset+4); - proto_tree_add_text (tree, tvb, offset+4, 1, - "FDP: %u, DSP: %u, IDP: %u, PSUM: %u, POFM: %u, CLEAR: %u, ADDP: %u", - (flags & 0x80) >> 7, (flags & 0x40) >> 6, - (flags & 0x20) >> 5, (flags & 0x18) >> 3, - (flags & 0x04) >> 2, (flags & 0x02) >> 1, - (flags & 0x01)); - flags = tvb_get_guint8 (tvb, offset+5); - proto_tree_add_text (tree, tvb, offset+5, 1, - "Media Format Recognition: %u", - flags); - flags = tvb_get_guint8 (tvb, offset+6); - proto_tree_add_text (tree, tvb, offset+6, 1, - "Partition Units: %u", - flags & 0x0f); - proto_tree_add_text (tree, tvb, offset+8, 2, - "Partition Size: %u", - tvb_get_ntohs (tvb, offset+8)); + flags = tvb_get_guint8(tvb, offset+2); + proto_tree_add_text(tree, tvb, offset+2, 1, + "Maximum Additional Partitions: %u", + flags); + flags = tvb_get_guint8(tvb, offset+3); + proto_tree_add_text(tree, tvb, offset+3, 1, + "Additional Partitions Defined: %u", + flags); + flags = tvb_get_guint8(tvb, offset+4); + proto_tree_add_text(tree, tvb, offset+4, 1, + "FDP: %u, DSP: %u, IDP: %u, PSUM: %u, POFM: %u, CLEAR: %u, ADDP: %u", + (flags & 0x80) >> 7, (flags & 0x40) >> 6, + (flags & 0x20) >> 5, (flags & 0x18) >> 3, + (flags & 0x04) >> 2, (flags & 0x02) >> 1, + (flags & 0x01)); + flags = tvb_get_guint8(tvb, offset+5); + proto_tree_add_text(tree, tvb, offset+5, 1, + "Media Format Recognition: %u", + flags); + flags = tvb_get_guint8(tvb, offset+6); + proto_tree_add_text(tree, tvb, offset+6, 1, + "Partition Units: %u", + flags & 0x0f); + proto_tree_add_text(tree, tvb, offset+8, 2, + "Partition Size: %u", + tvb_get_ntohs(tvb, offset+8)); break; case SCSI_SSC2_MODEPAGE_MEDPAR2: return FALSE; @@ -3197,130 +3198,130 @@ dissect_scsi_ssc2_modepage (tvbuff_t *tvb _U_, packet_info *pinfo _U_, } static gboolean -dissect_scsi_mmc5_modepage (tvbuff_t *tvb _U_, packet_info *pinfo _U_, - proto_tree *tree _U_, guint offset _U_, guint8 pcode) +dissect_scsi_mmc5_modepage(tvbuff_t *tvb _U_, packet_info *pinfo _U_, + proto_tree *tree _U_, guint offset _U_, guint8 pcode) { - guint8 flags; - guint8 i; + guint8 flags; + guint8 i; guint16 n; switch (pcode) { case SCSI_MMC5_MODEPAGE_MRW: - flags = tvb_get_guint8 (tvb, offset+3); - proto_tree_add_text (tree, tvb, offset+3, 1, - "LBA Space: %u", - (flags & 0x01)); + flags = tvb_get_guint8(tvb, offset+3); + proto_tree_add_text(tree, tvb, offset+3, 1, + "LBA Space: %u", + (flags & 0x01)); break; case SCSI_MMC5_MODEPAGE_WRPARAM: - flags = tvb_get_guint8 (tvb, offset+2); - proto_tree_add_text (tree, tvb, offset+2, 1, - "BUFE: %u, LS_V: %u, Test Write: %u, Write Type: %u", - (flags & 0x40) >> 6, (flags & 0x20) >> 5, (flags & 0x10) >> 4, (flags & 0x0f)); - flags = tvb_get_guint8 (tvb, offset+3); - proto_tree_add_text (tree, tvb, offset+3, 1, - "Multi-session: %u, FP: %u, Copy: %u, Track Mode: %u", - (flags & 0xc0) >> 6, (flags & 0x20) >> 5, (flags & 0x10) >> 4, (flags & 0x0f)); - flags = tvb_get_guint8 (tvb, offset+4); - proto_tree_add_text (tree, tvb, offset+4, 1, - "Data Block Type: %u", - (flags & 0x0f)); - flags = tvb_get_guint8 (tvb, offset+5); - proto_tree_add_text (tree, tvb, offset+5, 1, - "Link Size: %u", - flags); - flags = tvb_get_guint8 (tvb, offset+7); - proto_tree_add_text (tree, tvb, offset+7, 1, - "Initiator Application Code: %u", - (flags & 0x3f)); - flags = tvb_get_guint8 (tvb, offset+8); - proto_tree_add_text (tree, tvb, offset+8, 1, - "Session Format: %u", - flags); - proto_tree_add_text (tree, tvb, offset+10, 4, - "Packet Size: %u", - tvb_get_ntohl (tvb, offset+10)); - proto_tree_add_text (tree, tvb, offset+14, 2, - "Audio Pause Length: %u", - tvb_get_ntohs (tvb, offset+14)); - proto_tree_add_text (tree, tvb, offset+16, 16, - "Media Catalog Number: %s", - tvb_format_stringzpad (tvb, offset+16, 16)); - proto_tree_add_text (tree, tvb, offset+32, 16, - "International Standard Recording Code: %s", - tvb_format_stringzpad (tvb, offset+32, 16)); + flags = tvb_get_guint8(tvb, offset+2); + proto_tree_add_text(tree, tvb, offset+2, 1, + "BUFE: %u, LS_V: %u, Test Write: %u, Write Type: %u", + (flags & 0x40) >> 6, (flags & 0x20) >> 5, (flags & 0x10) >> 4, (flags & 0x0f)); + flags = tvb_get_guint8(tvb, offset+3); + proto_tree_add_text(tree, tvb, offset+3, 1, + "Multi-session: %u, FP: %u, Copy: %u, Track Mode: %u", + (flags & 0xc0) >> 6, (flags & 0x20) >> 5, (flags & 0x10) >> 4, (flags & 0x0f)); + flags = tvb_get_guint8(tvb, offset+4); + proto_tree_add_text(tree, tvb, offset+4, 1, + "Data Block Type: %u", + (flags & 0x0f)); + flags = tvb_get_guint8(tvb, offset+5); + proto_tree_add_text(tree, tvb, offset+5, 1, + "Link Size: %u", + flags); + flags = tvb_get_guint8(tvb, offset+7); + proto_tree_add_text(tree, tvb, offset+7, 1, + "Initiator Application Code: %u", + (flags & 0x3f)); + flags = tvb_get_guint8(tvb, offset+8); + proto_tree_add_text(tree, tvb, offset+8, 1, + "Session Format: %u", + flags); + proto_tree_add_text(tree, tvb, offset+10, 4, + "Packet Size: %u", + tvb_get_ntohl(tvb, offset+10)); + proto_tree_add_text(tree, tvb, offset+14, 2, + "Audio Pause Length: %u", + tvb_get_ntohs(tvb, offset+14)); + proto_tree_add_text(tree, tvb, offset+16, 16, + "Media Catalog Number: %s", + tvb_format_stringzpad(tvb, offset+16, 16)); + proto_tree_add_text(tree, tvb, offset+32, 16, + "International Standard Recording Code: %s", + tvb_format_stringzpad(tvb, offset+32, 16)); for (i = 0; i < 4; i++) { - flags = tvb_get_guint8 (tvb, offset+48+i); - proto_tree_add_text (tree, tvb, offset+48+i, 1, - "Sub-header Byte %u: %u", - i, flags); + flags = tvb_get_guint8(tvb, offset+48+i); + proto_tree_add_text(tree, tvb, offset+48+i, 1, + "Sub-header Byte %u: %u", + i, flags); } - if (0x36 == tvb_get_guint8 (tvb, offset+1)) - proto_tree_add_text (tree, tvb, offset+52, 4, - "Vendor Specific: %u", - tvb_get_ntohl (tvb, offset+52)); + if (0x36 == tvb_get_guint8(tvb, offset+1)) + proto_tree_add_text(tree, tvb, offset+52, 4, + "Vendor Specific: %u", + tvb_get_ntohl(tvb, offset+52)); break; case SCSI_MMC3_MODEPAGE_MMCAP: - flags = tvb_get_guint8 (tvb, offset+2); - proto_tree_add_text (tree, tvb, offset+2, 1, - "DVD-RAM Read: %u, DVD-R Read: %u, DVD-ROM Read: %u," - "Method 2: %u, CD-RW Read: %u, CD-R Read: %u", - (flags & 0x20) >> 5, (flags & 0x10) >> 4, (flags & 0x08) >> 3, - (flags & 0x04) >> 2, (flags & 0x02) >> 1, (flags & 0x01)); - flags = tvb_get_guint8 (tvb, offset+3); - proto_tree_add_text (tree, tvb, offset+3, 1, - "DVD-RAM Write: %u, DVD-R Write: %u, DVD-ROM Write: %u," - "Test Write: %u, CD-RW Write: %u, CD-R Write: %u", - (flags & 0x20) >> 5, (flags & 0x10) >> 4, (flags & 0x08) >> 3, - (flags & 0x04) >> 2, (flags & 0x02) >> 1, (flags & 0x01)); - flags = tvb_get_guint8 (tvb, offset+4); - proto_tree_add_text (tree, tvb, offset+4, 1, - "BUF: %u, Multi Session: %u, Mode 2 Form 2: %u, Mode 2 Form 1: %u," - "Digital Port (2): %u, Digital Port (1): %u, Composite: %u, Audio Play: %u", - (flags & 0x80) >> 7, (flags & 0x40) >> 6, (flags & 0x20) >> 5, (flags & 0x10) >> 4, - (flags & 0x08) >> 3, (flags & 0x04) >> 2, (flags & 0x02) >> 1, (flags & 0x01)); - flags = tvb_get_guint8 (tvb, offset+5); - proto_tree_add_text (tree, tvb, offset+5, 1, - "Read Bar Code: %u, UPC: %u, ISRC: %u, C2 Pointers supported: %u," - "R-W Deinterleaved & corrected: %u, R-W Supported: %u, CD-DA Stream is Accurate: %u, CD-DA Cmds Supported: %u", - (flags & 0x80) >> 7, (flags & 0x40) >> 6, (flags & 0x20) >> 5, (flags & 0x10) >> 4, - (flags & 0x08) >> 3, (flags & 0x04) >> 2, (flags & 0x02) >> 1, (flags & 0x01)); - flags = tvb_get_guint8 (tvb, offset+6); - proto_tree_add_text (tree, tvb, offset+6, 1, - "Loading Mechanism Type: %u, Eject: %u, Prevent Jumper: %u," - "Lock State: %u, Lock: %u", - (flags & 0xe0) >> 5, (flags & 0x08) >> 3, - (flags & 0x04) >> 2, (flags & 0x02) >> 1, (flags & 0x01)); - flags = tvb_get_guint8 (tvb, offset+7); - proto_tree_add_text (tree, tvb, offset+7, 1, - "R-W in Lead-in: %u, Side Change Capable: %u, S/W Slot Selection: %u," - "Changer Supports Disc Present: %u, Separate Channel Mute: %u, Separate volume levels: %u", - (flags & 0x20) >> 5, (flags & 0x10) >> 4, (flags & 0x08) >> 3, - (flags & 0x04) >> 2, (flags & 0x02) >> 1, (flags & 0x01)); - proto_tree_add_text (tree, tvb, offset+10, 2, - "Number of Volume Levels Supported: %u", - tvb_get_ntohs (tvb, offset+10)); - proto_tree_add_text (tree, tvb, offset+12, 2, - "Buffer Size Supported: %u", - tvb_get_ntohs (tvb, offset+12)); - flags = tvb_get_guint8 (tvb, offset+17); - proto_tree_add_text (tree, tvb, offset+17, 1, - "Length: %u, LSBF: %u, RCK: %u, BCKF: %u", - (flags & 0x30) >> 4, (flags & 0x08) >> 3, - (flags & 0x04) >> 2, (flags & 0x02) >> 1); - proto_tree_add_text (tree, tvb, offset+22, 2, - "Copy Management Revision Support: %u", - tvb_get_ntohs (tvb, offset+22)); - flags = tvb_get_guint8 (tvb, offset+27); - proto_tree_add_text (tree, tvb, offset+27, 1, - "Rotation Control Selected: %u", - (flags & 0x03)); - proto_tree_add_text (tree, tvb, offset+28, 2, - "Current Write Speed Selected: %u", - tvb_get_ntohs (tvb, offset+28)); - n = tvb_get_ntohs (tvb, offset+30); - proto_tree_add_text (tree, tvb, offset+30, 2, - "Number of Logical Unit Write Speed Performance Descriptor Tables: %u", - n); + flags = tvb_get_guint8(tvb, offset+2); + proto_tree_add_text(tree, tvb, offset+2, 1, + "DVD-RAM Read: %u, DVD-R Read: %u, DVD-ROM Read: %u," + "Method 2: %u, CD-RW Read: %u, CD-R Read: %u", + (flags & 0x20) >> 5, (flags & 0x10) >> 4, (flags & 0x08) >> 3, + (flags & 0x04) >> 2, (flags & 0x02) >> 1, (flags & 0x01)); + flags = tvb_get_guint8(tvb, offset+3); + proto_tree_add_text(tree, tvb, offset+3, 1, + "DVD-RAM Write: %u, DVD-R Write: %u, DVD-ROM Write: %u," + "Test Write: %u, CD-RW Write: %u, CD-R Write: %u", + (flags & 0x20) >> 5, (flags & 0x10) >> 4, (flags & 0x08) >> 3, + (flags & 0x04) >> 2, (flags & 0x02) >> 1, (flags & 0x01)); + flags = tvb_get_guint8(tvb, offset+4); + proto_tree_add_text(tree, tvb, offset+4, 1, + "BUF: %u, Multi Session: %u, Mode 2 Form 2: %u, Mode 2 Form 1: %u," + "Digital Port (2): %u, Digital Port (1): %u, Composite: %u, Audio Play: %u", + (flags & 0x80) >> 7, (flags & 0x40) >> 6, (flags & 0x20) >> 5, (flags & 0x10) >> 4, + (flags & 0x08) >> 3, (flags & 0x04) >> 2, (flags & 0x02) >> 1, (flags & 0x01)); + flags = tvb_get_guint8(tvb, offset+5); + proto_tree_add_text(tree, tvb, offset+5, 1, + "Read Bar Code: %u, UPC: %u, ISRC: %u, C2 Pointers supported: %u," + "R-W Deinterleaved & corrected: %u, R-W Supported: %u, CD-DA Stream is Accurate: %u, CD-DA Cmds Supported: %u", + (flags & 0x80) >> 7, (flags & 0x40) >> 6, (flags & 0x20) >> 5, (flags & 0x10) >> 4, + (flags & 0x08) >> 3, (flags & 0x04) >> 2, (flags & 0x02) >> 1, (flags & 0x01)); + flags = tvb_get_guint8(tvb, offset+6); + proto_tree_add_text(tree, tvb, offset+6, 1, + "Loading Mechanism Type: %u, Eject: %u, Prevent Jumper: %u," + "Lock State: %u, Lock: %u", + (flags & 0xe0) >> 5, (flags & 0x08) >> 3, + (flags & 0x04) >> 2, (flags & 0x02) >> 1, (flags & 0x01)); + flags = tvb_get_guint8(tvb, offset+7); + proto_tree_add_text(tree, tvb, offset+7, 1, + "R-W in Lead-in: %u, Side Change Capable: %u, S/W Slot Selection: %u," + "Changer Supports Disc Present: %u, Separate Channel Mute: %u, Separate volume levels: %u", + (flags & 0x20) >> 5, (flags & 0x10) >> 4, (flags & 0x08) >> 3, + (flags & 0x04) >> 2, (flags & 0x02) >> 1, (flags & 0x01)); + proto_tree_add_text(tree, tvb, offset+10, 2, + "Number of Volume Levels Supported: %u", + tvb_get_ntohs(tvb, offset+10)); + proto_tree_add_text(tree, tvb, offset+12, 2, + "Buffer Size Supported: %u", + tvb_get_ntohs(tvb, offset+12)); + flags = tvb_get_guint8(tvb, offset+17); + proto_tree_add_text(tree, tvb, offset+17, 1, + "Length: %u, LSBF: %u, RCK: %u, BCKF: %u", + (flags & 0x30) >> 4, (flags & 0x08) >> 3, + (flags & 0x04) >> 2, (flags & 0x02) >> 1); + proto_tree_add_text(tree, tvb, offset+22, 2, + "Copy Management Revision Support: %u", + tvb_get_ntohs(tvb, offset+22)); + flags = tvb_get_guint8(tvb, offset+27); + proto_tree_add_text(tree, tvb, offset+27, 1, + "Rotation Control Selected: %u", + (flags & 0x03)); + proto_tree_add_text(tree, tvb, offset+28, 2, + "Current Write Speed Selected: %u", + tvb_get_ntohs(tvb, offset+28)); + n = tvb_get_ntohs(tvb, offset+30); + proto_tree_add_text(tree, tvb, offset+30, 2, + "Number of Logical Unit Write Speed Performance Descriptor Tables: %u", + n); break; default: return FALSE; @@ -3329,105 +3330,105 @@ dissect_scsi_mmc5_modepage (tvbuff_t *tvb _U_, packet_info *pinfo _U_, } static gboolean -dissect_scsi_smc_modepage (tvbuff_t *tvb, packet_info *pinfo _U_, - proto_tree *tree, guint offset, guint8 pcode) +dissect_scsi_smc_modepage(tvbuff_t *tvb, packet_info *pinfo _U_, + proto_tree *tree, guint offset, guint8 pcode) { guint8 flags; guint8 param_list_len; switch (pcode) { case SCSI_SMC_MODEPAGE_EAA: - param_list_len = tvb_get_guint8 (tvb, offset+2); - proto_tree_add_text (tree, tvb, offset+2, 1, "Parameter List Length: %u", - param_list_len); + param_list_len = tvb_get_guint8(tvb, offset+2); + proto_tree_add_text(tree, tvb, offset+2, 1, "Parameter List Length: %u", + param_list_len); if (param_list_len < 2) break; - proto_tree_add_text (tree, tvb, offset+3, 2, "First Medium Transport Element Address: %u", - tvb_get_ntohs (tvb, offset+3)); + proto_tree_add_text(tree, tvb, offset+3, 2, "First Medium Transport Element Address: %u", + tvb_get_ntohs(tvb, offset+3)); param_list_len -= 2; if (param_list_len < 2) break; - proto_tree_add_text (tree, tvb, offset+5, 2, "Number of Medium Transport Elements: %u", - tvb_get_ntohs (tvb, offset+5)); + proto_tree_add_text(tree, tvb, offset+5, 2, "Number of Medium Transport Elements: %u", + tvb_get_ntohs(tvb, offset+5)); param_list_len -= 2; if (param_list_len < 2) break; - proto_tree_add_text (tree, tvb, offset+7, 2, "First Storage Element Address: %u", - tvb_get_ntohs (tvb, offset+7)); + proto_tree_add_text(tree, tvb, offset+7, 2, "First Storage Element Address: %u", + tvb_get_ntohs(tvb, offset+7)); param_list_len -= 2; if (param_list_len < 2) break; - proto_tree_add_text (tree, tvb, offset+9, 2, "Number of Storage Elements: %u", - tvb_get_ntohs (tvb, offset+9)); + proto_tree_add_text(tree, tvb, offset+9, 2, "Number of Storage Elements: %u", + tvb_get_ntohs(tvb, offset+9)); param_list_len -= 2; if (param_list_len < 2) break; - proto_tree_add_text (tree, tvb, offset+11, 2, "First Import/Export Element Address: %u", - tvb_get_ntohs (tvb, offset+11)); + proto_tree_add_text(tree, tvb, offset+11, 2, "First Import/Export Element Address: %u", + tvb_get_ntohs(tvb, offset+11)); param_list_len -= 2; if (param_list_len < 2) break; - proto_tree_add_text (tree, tvb, offset+13, 2, "Number of Import/Export Elements: %u", - tvb_get_ntohs (tvb, offset+13)); + proto_tree_add_text(tree, tvb, offset+13, 2, "Number of Import/Export Elements: %u", + tvb_get_ntohs(tvb, offset+13)); param_list_len -= 2; if (param_list_len < 2) break; - proto_tree_add_text (tree, tvb, offset+15, 2, "First Data Transfer Element Address: %u", - tvb_get_ntohs (tvb, offset+15)); + proto_tree_add_text(tree, tvb, offset+15, 2, "First Data Transfer Element Address: %u", + tvb_get_ntohs(tvb, offset+15)); param_list_len -= 2; if (param_list_len < 2) break; - proto_tree_add_text (tree, tvb, offset+17, 2, "Number of Data Transfer Elements: %u", - tvb_get_ntohs (tvb, offset+17)); + proto_tree_add_text(tree, tvb, offset+17, 2, "Number of Data Transfer Elements: %u", + tvb_get_ntohs(tvb, offset+17)); break; case SCSI_SMC_MODEPAGE_TRANGEOM: return FALSE; case SCSI_SMC_MODEPAGE_DEVCAP: - flags = tvb_get_guint8 (tvb, offset+2); - proto_tree_add_text (tree, tvb, offset+2, 1, - "STORDT: %u, STORI/E: %u, STORST: %u, STORMT: %u", - (flags & 0x08) >> 3, (flags & 0x04) >> 2, - (flags & 0x02) >> 1, (flags & 0x01)); - flags = tvb_get_guint8 (tvb, offset+4); - proto_tree_add_text (tree, tvb, offset+4, 1, - "MT->DT: %u, MT->I/E: %u, MT->ST: %u, MT->MT: %u", - (flags & 0x08) >> 3, (flags & 0x04) >> 2, - (flags & 0x02) >> 1, (flags & 0x01)); - flags = tvb_get_guint8 (tvb, offset+5); - proto_tree_add_text (tree, tvb, offset+5, 1, - "ST->DT: %u, ST->I/E: %u, ST->ST: %u, ST->MT: %u", - (flags & 0x08) >> 3, (flags & 0x04) >> 2, - (flags & 0x02) >> 1, (flags & 0x01)); - flags = tvb_get_guint8 (tvb, offset+6); - proto_tree_add_text (tree, tvb, offset+6, 1, - "I/E->DT: %u, I/E->I/E: %u, I/E->ST: %u, I/E->MT: %u", - (flags & 0x08) >> 3, (flags & 0x04) >> 2, - (flags & 0x02) >> 1, (flags & 0x01)); - flags = tvb_get_guint8 (tvb, offset+7); - proto_tree_add_text (tree, tvb, offset+7, 1, - "DT->DT: %u, DT->I/E: %u, DT->ST: %u, DT->MT: %u", - (flags & 0x08) >> 3, (flags & 0x04) >> 2, - (flags & 0x02) >> 1, (flags & 0x01)); - flags = tvb_get_guint8 (tvb, offset+12); - proto_tree_add_text (tree, tvb, offset+12, 1, - "MT<>DT: %u, MT<>I/E: %u, MT<>ST: %u, MT<>MT: %u", - (flags & 0x08) >> 3, (flags & 0x04) >> 2, - (flags & 0x02) >> 1, (flags & 0x01)); - flags = tvb_get_guint8 (tvb, offset+13); - proto_tree_add_text (tree, tvb, offset+13, 1, - "ST<>DT: %u, ST<>I/E: %u, ST<>ST: %u, ST<>MT: %u", - (flags & 0x08) >> 3, (flags & 0x04) >> 2, - (flags & 0x02) >> 1, (flags & 0x01)); - flags = tvb_get_guint8 (tvb, offset+14); - proto_tree_add_text (tree, tvb, offset+14, 1, - "I/E<>DT: %u, I/E<>I/E: %u, I/E<>ST: %u, I/E<>MT: %u", - (flags & 0x08) >> 3, (flags & 0x04) >> 2, - (flags & 0x02) >> 1, (flags & 0x01)); - flags = tvb_get_guint8 (tvb, offset+15); - proto_tree_add_text (tree, tvb, offset+15, 1, - "DT<>DT: %u, DT<>I/E: %u, DT<>ST: %u, DT<>MT: %u", - (flags & 0x08) >> 3, (flags & 0x04) >> 2, - (flags & 0x02) >> 1, (flags & 0x01)); + flags = tvb_get_guint8(tvb, offset+2); + proto_tree_add_text(tree, tvb, offset+2, 1, + "STORDT: %u, STORI/E: %u, STORST: %u, STORMT: %u", + (flags & 0x08) >> 3, (flags & 0x04) >> 2, + (flags & 0x02) >> 1, (flags & 0x01)); + flags = tvb_get_guint8(tvb, offset+4); + proto_tree_add_text(tree, tvb, offset+4, 1, + "MT->DT: %u, MT->I/E: %u, MT->ST: %u, MT->MT: %u", + (flags & 0x08) >> 3, (flags & 0x04) >> 2, + (flags & 0x02) >> 1, (flags & 0x01)); + flags = tvb_get_guint8(tvb, offset+5); + proto_tree_add_text(tree, tvb, offset+5, 1, + "ST->DT: %u, ST->I/E: %u, ST->ST: %u, ST->MT: %u", + (flags & 0x08) >> 3, (flags & 0x04) >> 2, + (flags & 0x02) >> 1, (flags & 0x01)); + flags = tvb_get_guint8(tvb, offset+6); + proto_tree_add_text(tree, tvb, offset+6, 1, + "I/E->DT: %u, I/E->I/E: %u, I/E->ST: %u, I/E->MT: %u", + (flags & 0x08) >> 3, (flags & 0x04) >> 2, + (flags & 0x02) >> 1, (flags & 0x01)); + flags = tvb_get_guint8(tvb, offset+7); + proto_tree_add_text(tree, tvb, offset+7, 1, + "DT->DT: %u, DT->I/E: %u, DT->ST: %u, DT->MT: %u", + (flags & 0x08) >> 3, (flags & 0x04) >> 2, + (flags & 0x02) >> 1, (flags & 0x01)); + flags = tvb_get_guint8(tvb, offset+12); + proto_tree_add_text(tree, tvb, offset+12, 1, + "MT<>DT: %u, MT<>I/E: %u, MT<>ST: %u, MT<>MT: %u", + (flags & 0x08) >> 3, (flags & 0x04) >> 2, + (flags & 0x02) >> 1, (flags & 0x01)); + flags = tvb_get_guint8(tvb, offset+13); + proto_tree_add_text(tree, tvb, offset+13, 1, + "ST<>DT: %u, ST<>I/E: %u, ST<>ST: %u, ST<>MT: %u", + (flags & 0x08) >> 3, (flags & 0x04) >> 2, + (flags & 0x02) >> 1, (flags & 0x01)); + flags = tvb_get_guint8(tvb, offset+14); + proto_tree_add_text(tree, tvb, offset+14, 1, + "I/E<>DT: %u, I/E<>I/E: %u, I/E<>ST: %u, I/E<>MT: %u", + (flags & 0x08) >> 3, (flags & 0x04) >> 2, + (flags & 0x02) >> 1, (flags & 0x01)); + flags = tvb_get_guint8(tvb, offset+15); + proto_tree_add_text(tree, tvb, offset+15, 1, + "DT<>DT: %u, DT<>I/E: %u, DT<>ST: %u, DT<>MT: %u", + (flags & 0x08) >> 3, (flags & 0x04) >> 2, + (flags & 0x02) >> 1, (flags & 0x01)); break; default: return FALSE; @@ -3436,23 +3437,23 @@ dissect_scsi_smc_modepage (tvbuff_t *tvb, packet_info *pinfo _U_, } static guint -dissect_scsi_modepage (tvbuff_t *tvb, packet_info *pinfo, - proto_tree *scsi_tree, guint offset, - scsi_device_type devtype) +dissect_scsi_modepage(tvbuff_t *tvb, packet_info *pinfo, + proto_tree *scsi_tree, guint offset, + scsi_device_type devtype) { - guint8 pcode, plen; - proto_tree *tree; - proto_item *ti; + guint8 pcode, plen; + proto_tree *tree; + proto_item *ti; const value_string *modepage_val; - int hf_pagecode; + int hf_pagecode; gboolean (*dissect_modepage)(tvbuff_t *, packet_info *, proto_tree *, guint, guint8); - pcode = tvb_get_guint8 (tvb, offset); - plen = tvb_get_guint8 (tvb, offset+1); + pcode = tvb_get_guint8(tvb, offset); + plen = tvb_get_guint8(tvb, offset+1); - if (match_strval (pcode & SCSI_MS_PCODE_BITS, - scsi_spc_modepage_val) == NULL) { + if (match_strval(pcode & SCSI_MS_PCODE_BITS, + scsi_spc_modepage_val) == NULL) { /* * This isn't a generic mode page that applies to all SCSI * device types; try to interpret it based on what we deduced, @@ -3499,50 +3500,50 @@ dissect_scsi_modepage (tvbuff_t *tvb, packet_info *pinfo, hf_pagecode = hf_scsi_spcpagecode; dissect_modepage = dissect_scsi_spc_modepage; } - ti = proto_tree_add_text (scsi_tree, tvb, offset, plen+2, "%s Mode Page", - val_to_str (pcode & SCSI_MS_PCODE_BITS, - modepage_val, "Unknown (0x%08x)")); - tree = proto_item_add_subtree (ti, ett_scsi_page); - proto_tree_add_text (tree, tvb, offset, 1, "PS: %u", (pcode & 0x80) >> 7); + ti = proto_tree_add_text(scsi_tree, tvb, offset, plen+2, "%s Mode Page", + val_to_str(pcode & SCSI_MS_PCODE_BITS, + modepage_val, "Unknown (0x%08x)")); + tree = proto_item_add_subtree(ti, ett_scsi_page); + proto_tree_add_text(tree, tvb, offset, 1, "PS: %u", (pcode & 0x80) >> 7); - proto_tree_add_item (tree, hf_pagecode, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_text (tree, tvb, offset+1, 1, "Page Length: %u", - plen); + proto_tree_add_item(tree, hf_pagecode, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_text(tree, tvb, offset+1, 1, "Page Length: %u", + plen); - if (!tvb_bytes_exist (tvb, offset, plen)) { + if (!tvb_bytes_exist(tvb, offset, plen)) { /* XXX - why not just drive on and throw an exception? */ return (plen + 2); } if (!(*dissect_modepage)(tvb, pinfo, tree, offset, (guint8) (pcode & SCSI_MS_PCODE_BITS))) { - proto_tree_add_text (tree, tvb, offset+2, plen, - "Unknown Page"); + proto_tree_add_text(tree, tvb, offset+2, plen, + "Unknown Page"); } return (plen+2); } void -dissect_spc_modeselect6 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - guint offset, gboolean isreq, gboolean iscdb, - guint payload_len, scsi_task_data_t *cdata) +dissect_spc_modeselect6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + guint offset, gboolean isreq, gboolean iscdb, + guint payload_len, scsi_task_data_t *cdata) { - guint8 flags; - guint plen; - gint tot_len, desclen; + guint8 flags; + guint plen; + gint tot_len, desclen; tvbuff_t *blockdesc_tvb; if (!tree) return; if (isreq && iscdb) { - flags = tvb_get_guint8 (tvb, offset); - proto_tree_add_uint_format (tree, hf_scsi_modesel_flags, tvb, offset, 1, - flags, "PF = %u, SP = %u", flags & 0x10, - flags & 0x1); - proto_tree_add_item (tree, hf_scsi_paramlen, tvb, offset+3, 1, ENC_BIG_ENDIAN); + flags = tvb_get_guint8(tvb, offset); + proto_tree_add_uint_format(tree, hf_scsi_modesel_flags, tvb, offset, 1, + flags, "PF = %u, SP = %u", flags & 0x10, + flags & 0x1); + proto_tree_add_item(tree, hf_scsi_paramlen, tvb, offset+3, 1, ENC_BIG_ENDIAN); proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control, - ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); + ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); } else { /* Mode Parameter has the following format: @@ -3556,9 +3557,9 @@ dissect_spc_modeselect6 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, */ if (payload_len < 1) return; - tot_len = tvb_get_guint8 (tvb, offset); - proto_tree_add_text (tree, tvb, offset, 1, "Mode Data Length: %d", - tot_len); + tot_len = tvb_get_guint8(tvb, offset); + proto_tree_add_text(tree, tvb, offset, 1, "Mode Data Length: %d", + tot_len); offset += 1; payload_len -= 1; /* The mode data length is reserved for MODE SELECT, so we just @@ -3569,15 +3570,15 @@ dissect_spc_modeselect6 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, switch (cdata->itl->cmdset&SCSI_CMDSET_MASK) { case SCSI_DEV_SBC: - proto_tree_add_text (tree, tvb, offset, 1, "Medium Type: %s", - val_to_str(tvb_get_guint8 (tvb, offset), - scsi_modesense_medtype_sbc_val, - "Unknown (0x%02x)")); + proto_tree_add_text(tree, tvb, offset, 1, "Medium Type: %s", + val_to_str(tvb_get_guint8(tvb, offset), + scsi_modesense_medtype_sbc_val, + "Unknown (0x%02x)")); break; default: - proto_tree_add_text (tree, tvb, offset, 1, "Medium Type: 0x%02x", - tvb_get_guint8 (tvb, offset)); + proto_tree_add_text(tree, tvb, offset, 1, "Medium Type: 0x%02x", + tvb_get_guint8(tvb, offset)); break; } offset += 1; @@ -3585,30 +3586,30 @@ dissect_spc_modeselect6 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (payload_len < 1) return; - proto_tree_add_text (tree, tvb, offset, 1, - "Device-Specific Parameter: 0x%02x", - tvb_get_guint8 (tvb, offset)); + proto_tree_add_text(tree, tvb, offset, 1, + "Device-Specific Parameter: 0x%02x", + tvb_get_guint8(tvb, offset)); offset += 1; payload_len -= 1; if (payload_len < 1) return; - desclen = tvb_get_guint8 (tvb, offset); - proto_tree_add_text (tree, tvb, offset, 1, - "Block Descriptor Length: %d", desclen); + desclen = tvb_get_guint8(tvb, offset); + proto_tree_add_text(tree, tvb, offset, 1, + "Block Descriptor Length: %d", desclen); offset += 1; payload_len -= 1; - if(tvb_length_remaining(tvb, offset)>0){ - blockdesc_tvb=tvb_new_subset(tvb, offset, MIN(tvb_length_remaining(tvb, offset),desclen), desclen); - dissect_scsi_blockdescs (blockdesc_tvb, pinfo, tree, cdata, FALSE); + if (tvb_length_remaining(tvb, offset)>0) { + blockdesc_tvb = tvb_new_subset(tvb, offset, MIN(tvb_length_remaining(tvb, offset),desclen), desclen); + dissect_scsi_blockdescs(blockdesc_tvb, pinfo, tree, cdata, FALSE); } offset += desclen; payload_len -= desclen; /* offset points to the start of the mode page */ - while ((payload_len > 0) && tvb_bytes_exist (tvb, offset, 2)) { - plen = dissect_scsi_modepage (tvb, pinfo, tree, offset, cdata->itl->cmdset&SCSI_CMDSET_MASK); + while ((payload_len > 0) && tvb_bytes_exist(tvb, offset, 2)) { + plen = dissect_scsi_modepage(tvb, pinfo, tree, offset, cdata->itl->cmdset&SCSI_CMDSET_MASK); offset += plen; payload_len -= plen; } @@ -3616,27 +3617,27 @@ dissect_spc_modeselect6 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } void -dissect_spc_modeselect10 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - guint offset, gboolean isreq, gboolean iscdb, - guint payload_len, scsi_task_data_t *cdata) +dissect_spc_modeselect10(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + guint offset, gboolean isreq, gboolean iscdb, + guint payload_len, scsi_task_data_t *cdata) { - guint8 flags; - gboolean longlba; - gint tot_len, desclen; - guint plen; + guint8 flags; + gboolean longlba; + gint tot_len, desclen; + guint plen; tvbuff_t *blockdesc_tvb; if (!tree) return; if (isreq && iscdb) { - flags = tvb_get_guint8 (tvb, offset); - proto_tree_add_uint_format (tree, hf_scsi_modesel_flags, tvb, offset, 1, - flags, "PF = %u, SP = %u", flags & 0x10, - flags & 0x1); - proto_tree_add_item (tree, hf_scsi_paramlen16, tvb, offset+6, 2, ENC_BIG_ENDIAN); + flags = tvb_get_guint8(tvb, offset); + proto_tree_add_uint_format(tree, hf_scsi_modesel_flags, tvb, offset, 1, + flags, "PF = %u, SP = %u", flags & 0x10, + flags & 0x1); + proto_tree_add_item(tree, hf_scsi_paramlen16, tvb, offset+6, 2, ENC_BIG_ENDIAN); proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control, - ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); + ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); } else { /* Mode Parameter has the following format: @@ -3650,9 +3651,9 @@ dissect_spc_modeselect10 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, */ if (payload_len < 1) return; - tot_len = tvb_get_ntohs (tvb, offset); - proto_tree_add_text (tree, tvb, offset, 2, "Mode Data Length: %u", - tot_len); + tot_len = tvb_get_ntohs(tvb, offset); + proto_tree_add_text(tree, tvb, offset, 2, "Mode Data Length: %u", + tot_len); offset += 2; payload_len -= 2; /* The mode data length is reserved for MODE SELECT, so we just @@ -3660,20 +3661,20 @@ dissect_spc_modeselect10 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (payload_len < 1) return; - if(!cdata->itl) + if (!cdata->itl) return; switch (cdata->itl->cmdset&SCSI_CMDSET_MASK) { case SCSI_DEV_SBC: - proto_tree_add_text (tree, tvb, offset, 1, "Medium Type: %s", - val_to_str(tvb_get_guint8 (tvb, offset), - scsi_modesense_medtype_sbc_val, - "Unknown (0x%02x)")); + proto_tree_add_text(tree, tvb, offset, 1, "Medium Type: %s", + val_to_str(tvb_get_guint8(tvb, offset), + scsi_modesense_medtype_sbc_val, + "Unknown (0x%02x)")); break; default: - proto_tree_add_text (tree, tvb, offset, 1, "Medium Type: 0x%02x", - tvb_get_guint8 (tvb, offset)); + proto_tree_add_text(tree, tvb, offset, 1, "Medium Type: 0x%02x", + tvb_get_guint8(tvb, offset)); break; } offset += 1; @@ -3681,37 +3682,37 @@ dissect_spc_modeselect10 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (payload_len < 1) return; - proto_tree_add_text (tree, tvb, offset, 1, - "Device-Specific Parameter: 0x%02x", - tvb_get_guint8 (tvb, offset)); + proto_tree_add_text(tree, tvb, offset, 1, + "Device-Specific Parameter: 0x%02x", + tvb_get_guint8(tvb, offset)); offset += 1; payload_len -= 1; if (payload_len < 1) return; - longlba = tvb_get_guint8 (tvb, offset) & 0x1; - proto_tree_add_text (tree, tvb, offset, 1, "LongLBA: %u", longlba); + longlba = tvb_get_guint8(tvb, offset) & 0x1; + proto_tree_add_text(tree, tvb, offset, 1, "LongLBA: %u", longlba); offset += 2; /* skip LongLBA byte and reserved byte */ payload_len -= 2; if (payload_len < 1) return; - desclen = tvb_get_ntohs (tvb, offset); - proto_tree_add_text (tree, tvb, offset, 2, - "Block Descriptor Length: %u", desclen); + desclen = tvb_get_ntohs(tvb, offset); + proto_tree_add_text(tree, tvb, offset, 2, + "Block Descriptor Length: %u", desclen); offset += 2; payload_len -= 2; - if(tvb_length_remaining(tvb, offset)>0){ - blockdesc_tvb=tvb_new_subset(tvb, offset, MIN(tvb_length_remaining(tvb, offset),desclen), desclen); - dissect_scsi_blockdescs (blockdesc_tvb, pinfo, tree, cdata, longlba); + if (tvb_length_remaining(tvb, offset)>0) { + blockdesc_tvb = tvb_new_subset(tvb, offset, MIN(tvb_length_remaining(tvb, offset),desclen), desclen); + dissect_scsi_blockdescs(blockdesc_tvb, pinfo, tree, cdata, longlba); } offset += desclen; payload_len -= desclen; /* offset points to the start of the mode page */ - while ((payload_len > 0) && tvb_bytes_exist (tvb, offset, 2)) { - plen = dissect_scsi_modepage (tvb, pinfo, tree, offset, cdata->itl->cmdset&SCSI_CMDSET_MASK); + while ((payload_len > 0) && tvb_bytes_exist(tvb, offset, 2)) { + plen = dissect_scsi_modepage(tvb, pinfo, tree, offset, cdata->itl->cmdset&SCSI_CMDSET_MASK); offset += plen; payload_len -= plen; } @@ -3719,20 +3720,20 @@ dissect_spc_modeselect10 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } static void -dissect_scsi_pagecode (tvbuff_t *tvb, packet_info *pinfo _U_, - proto_tree *tree, guint offset, - scsi_task_data_t *cdata) +dissect_scsi_pagecode(tvbuff_t *tvb, packet_info *pinfo _U_, + proto_tree *tree, guint offset, + scsi_task_data_t *cdata) { guint8 pcode; - int hf_pagecode; + int hf_pagecode; /* unless we have cdata there is not much point in continuing */ if (!cdata) return; - pcode = tvb_get_guint8 (tvb, offset); - if (match_strval (pcode & SCSI_MS_PCODE_BITS, - scsi_spc_modepage_val) == NULL) { + pcode = tvb_get_guint8(tvb, offset); + if (match_strval(pcode & SCSI_MS_PCODE_BITS, + scsi_spc_modepage_val) == NULL) { /* * This isn't a generic mode page that applies to all SCSI * device types; try to interpret it based on what we deduced, @@ -3762,31 +3763,31 @@ dissect_scsi_pagecode (tvbuff_t *tvb, packet_info *pinfo _U_, } else { hf_pagecode = hf_scsi_spcpagecode; } - proto_tree_add_uint (tree, hf_pagecode, tvb, offset, 1, pcode); + proto_tree_add_uint(tree, hf_pagecode, tvb, offset, 1, pcode); } void -dissect_spc_modesense6 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - guint offset, gboolean isreq, gboolean iscdb, - guint payload_len, scsi_task_data_t *cdata) +dissect_spc_modesense6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + guint offset, gboolean isreq, gboolean iscdb, + guint payload_len, scsi_task_data_t *cdata) { - guint8 flags; - guint plen; - gint tot_len, desclen; + guint8 flags; + guint plen; + gint tot_len, desclen; tvbuff_t *blockdesc_tvb; if (!tree) return; if (isreq && iscdb) { - flags = tvb_get_guint8 (tvb, offset); - proto_tree_add_uint_format (tree, hf_scsi_modesns_flags, tvb, offset, 1, - flags, "DBD = %u", flags & 0x8); - proto_tree_add_item (tree, hf_scsi_modesns_pc, tvb, offset+1, 1, ENC_BIG_ENDIAN); - dissect_scsi_pagecode (tvb, pinfo, tree, offset+1, cdata); - proto_tree_add_item (tree, hf_scsi_alloclen, tvb, offset+3, 1, ENC_BIG_ENDIAN); + flags = tvb_get_guint8(tvb, offset); + proto_tree_add_uint_format(tree, hf_scsi_modesns_flags, tvb, offset, 1, + flags, "DBD = %u", flags & 0x8); + proto_tree_add_item(tree, hf_scsi_modesns_pc, tvb, offset+1, 1, ENC_BIG_ENDIAN); + dissect_scsi_pagecode(tvb, pinfo, tree, offset+1, cdata); + proto_tree_add_item(tree, hf_scsi_alloclen, tvb, offset+3, 1, ENC_BIG_ENDIAN); proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control, - ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); + ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); } else { /* Mode sense response has the following format: @@ -3798,9 +3799,9 @@ dissect_spc_modesense6 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, * Page (s) * - Page code, Page length, Page Parameters */ - tot_len = tvb_get_guint8 (tvb, offset); - proto_tree_add_text (tree, tvb, offset, 1, "Mode Data Length: %u", - tot_len); + tot_len = tvb_get_guint8(tvb, offset); + proto_tree_add_text(tree, tvb, offset, 1, "Mode Data Length: %u", + tot_len); offset += 1; /* The actual payload is the min of the length in the response & the @@ -3815,38 +3816,38 @@ dissect_spc_modesense6 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (tot_len < 1) return; - proto_tree_add_text (tree, tvb, offset, 1, "Medium Type: 0x%02x", - tvb_get_guint8 (tvb, offset)); + proto_tree_add_text(tree, tvb, offset, 1, "Medium Type: 0x%02x", + tvb_get_guint8(tvb, offset)); offset += 1; tot_len -= 1; if (tot_len < 1) return; - proto_tree_add_text (tree, tvb, offset, 1, - "Device-Specific Parameter: 0x%02x", - tvb_get_guint8 (tvb, offset)); + proto_tree_add_text(tree, tvb, offset, 1, + "Device-Specific Parameter: 0x%02x", + tvb_get_guint8(tvb, offset)); offset += 1; tot_len -= 1; if (tot_len < 1) return; - desclen = tvb_get_guint8 (tvb, offset); - proto_tree_add_text (tree, tvb, offset, 1, - "Block Descriptor Length: %d", desclen); + desclen = tvb_get_guint8(tvb, offset); + proto_tree_add_text(tree, tvb, offset, 1, + "Block Descriptor Length: %d", desclen); offset += 1; tot_len -= 1; - if(tvb_length_remaining(tvb, offset)>0){ - blockdesc_tvb=tvb_new_subset(tvb, offset, MIN(tvb_length_remaining(tvb, offset),desclen), desclen); - dissect_scsi_blockdescs (blockdesc_tvb, pinfo, tree, cdata, FALSE); + if (tvb_length_remaining(tvb, offset)>0) { + blockdesc_tvb = tvb_new_subset(tvb, offset, MIN(tvb_length_remaining(tvb, offset),desclen), desclen); + dissect_scsi_blockdescs(blockdesc_tvb, pinfo, tree, cdata, FALSE); } offset += desclen; tot_len -= desclen; /* offset points to the start of the mode page */ - while ((tot_len > 0) && tvb_bytes_exist (tvb, offset, 2)) { - plen = dissect_scsi_modepage (tvb, pinfo, tree, offset, cdata->itl->cmdset&SCSI_CMDSET_MASK); + while ((tot_len > 0) && tvb_bytes_exist(tvb, offset, 2)) { + plen = dissect_scsi_modepage(tvb, pinfo, tree, offset, cdata->itl->cmdset&SCSI_CMDSET_MASK); offset += plen; tot_len -= plen; } @@ -3854,29 +3855,29 @@ dissect_spc_modesense6 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } void -dissect_spc_modesense10 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - guint offset, gboolean isreq, gboolean iscdb, - guint payload_len, scsi_task_data_t *cdata) +dissect_spc_modesense10(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + guint offset, gboolean isreq, gboolean iscdb, + guint payload_len, scsi_task_data_t *cdata) { - guint8 flags; - gboolean longlba; - gint tot_len, desclen; - guint plen; + guint8 flags; + gboolean longlba; + gint tot_len, desclen; + guint plen; tvbuff_t *blockdesc_tvb; if (!tree) return; if (isreq && iscdb) { - flags = tvb_get_guint8 (tvb, offset); - proto_tree_add_uint_format (tree, hf_scsi_modesns_flags, tvb, offset, 1, - flags, "LLBAA = %u, DBD = %u", flags & 0x10, - flags & 0x8); - proto_tree_add_item (tree, hf_scsi_modesns_pc, tvb, offset+1, 1, ENC_BIG_ENDIAN); - dissect_scsi_pagecode (tvb, pinfo, tree, offset+1, cdata); - proto_tree_add_item (tree, hf_scsi_alloclen16, tvb, offset+6, 2, ENC_BIG_ENDIAN); + flags = tvb_get_guint8(tvb, offset); + proto_tree_add_uint_format(tree, hf_scsi_modesns_flags, tvb, offset, 1, + flags, "LLBAA = %u, DBD = %u", flags & 0x10, + flags & 0x8); + proto_tree_add_item(tree, hf_scsi_modesns_pc, tvb, offset+1, 1, ENC_BIG_ENDIAN); + dissect_scsi_pagecode(tvb, pinfo, tree, offset+1, cdata); + proto_tree_add_item(tree, hf_scsi_alloclen16, tvb, offset+6, 2, ENC_BIG_ENDIAN); proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control, - ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); + ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); } else { /* Mode sense response has the following format: @@ -3888,9 +3889,9 @@ dissect_spc_modesense10 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, * Page (s) * - Page code, Page length, Page Parameters */ - tot_len = tvb_get_ntohs (tvb, offset); - proto_tree_add_text (tree, tvb, offset, 2, "Mode Data Length: %u", - tot_len); + tot_len = tvb_get_ntohs(tvb, offset); + proto_tree_add_text(tree, tvb, offset, 2, "Mode Data Length: %u", + tot_len); offset += 2; /* The actual payload is the min of the length in the response & the * space allocated by the initiator as specified in the request. @@ -3904,44 +3905,44 @@ dissect_spc_modesense10 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (tot_len < 1) return; - proto_tree_add_text (tree, tvb, offset, 1, "Medium Type: 0x%02x", - tvb_get_guint8 (tvb, offset)); + proto_tree_add_text(tree, tvb, offset, 1, "Medium Type: 0x%02x", + tvb_get_guint8(tvb, offset)); offset += 1; tot_len -= 1; if (tot_len < 1) return; - proto_tree_add_text (tree, tvb, offset, 1, - "Device-Specific Parameter: 0x%02x", - tvb_get_guint8 (tvb, offset)); + proto_tree_add_text(tree, tvb, offset, 1, + "Device-Specific Parameter: 0x%02x", + tvb_get_guint8(tvb, offset)); offset += 1; tot_len -= 1; if (tot_len < 1) return; - longlba = tvb_get_guint8 (tvb, offset) & 0x1; - proto_tree_add_text (tree, tvb, offset, 1, "LongLBA: %u", longlba); + longlba = tvb_get_guint8(tvb, offset) & 0x1; + proto_tree_add_text(tree, tvb, offset, 1, "LongLBA: %u", longlba); offset += 2; /* skip LongLBA byte and reserved byte */ tot_len -= 2; if (tot_len < 1) return; - desclen = tvb_get_guint8 (tvb, offset); - proto_tree_add_text (tree, tvb, offset, 1, - "Block Descriptor Length: %u", desclen); + desclen = tvb_get_guint8(tvb, offset); + proto_tree_add_text(tree, tvb, offset, 1, + "Block Descriptor Length: %u", desclen); offset += 2; tot_len -= 2; - if(tvb_length_remaining(tvb, offset)>0){ - blockdesc_tvb=tvb_new_subset(tvb, offset, MIN(tvb_length_remaining(tvb, offset),desclen), desclen); - dissect_scsi_blockdescs (blockdesc_tvb, pinfo, tree, cdata, longlba); + if (tvb_length_remaining(tvb, offset)>0) { + blockdesc_tvb = tvb_new_subset(tvb, offset, MIN(tvb_length_remaining(tvb, offset),desclen), desclen); + dissect_scsi_blockdescs(blockdesc_tvb, pinfo, tree, cdata, longlba); } offset += desclen; tot_len -= desclen; /* offset points to the start of the mode page */ - while ((tot_len > 0) && tvb_bytes_exist (tvb, offset, 2)) { - plen = dissect_scsi_modepage (tvb, pinfo, tree, offset, cdata->itl->cmdset&SCSI_CMDSET_MASK); + while ((tot_len > 0) && tvb_bytes_exist(tvb, offset, 2)) { + plen = dissect_scsi_modepage(tvb, pinfo, tree, offset, cdata->itl->cmdset&SCSI_CMDSET_MASK); offset += plen; tot_len -= plen; } @@ -3949,9 +3950,9 @@ dissect_spc_modesense10 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } void -dissect_spc_preventallowmediaremoval (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - guint offset, gboolean isreq, gboolean iscdb, - guint payload_len _U_, scsi_task_data_t *cdata _U_) +dissect_spc_preventallowmediaremoval(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, + guint offset, gboolean isreq, gboolean iscdb, + guint payload_len _U_, scsi_task_data_t *cdata _U_) { guint8 flags; @@ -3959,34 +3960,34 @@ dissect_spc_preventallowmediaremoval (tvbuff_t *tvb, packet_info *pinfo _U_, pro return; if (isreq && iscdb) { - flags = tvb_get_guint8 (tvb, offset+3); - proto_tree_add_text (tree, tvb, offset+3, 1, - "Persistent: %u, Prevent: %u", - flags & 0x02, flags & 0x01); + flags = tvb_get_guint8(tvb, offset+3); + proto_tree_add_text(tree, tvb, offset+3, 1, + "Persistent: %u, Prevent: %u", + flags & 0x02, flags & 0x01); proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control, - ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); + ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); } } void -dissect_spc_persistentreservein (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - guint offset, gboolean isreq, gboolean iscdb, - guint payload_len, scsi_task_data_t *cdata) +dissect_spc_persistentreservein(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, + guint offset, gboolean isreq, gboolean iscdb, + guint payload_len, scsi_task_data_t *cdata) { guint16 flags; - int numrec, i; - guint len; + int numrec, i; + guint len; if (!tree) return; if (isreq && iscdb) { - proto_tree_add_item (tree, hf_scsi_persresvin_svcaction, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item (tree, hf_scsi_alloclen16, tvb, offset+6, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_persresvin_svcaction, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_alloclen16, tvb, offset+6, 2, ENC_BIG_ENDIAN); proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control, - ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); + ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); /* We store the service action since we want to interpret the data */ - cdata->itlq->flags = tvb_get_guint8 (tvb, offset); + cdata->itlq->flags = tvb_get_guint8(tvb, offset); } else { if (cdata) { @@ -3995,11 +3996,11 @@ dissect_spc_persistentreservein (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr else { flags = 0xFF; } - proto_tree_add_text (tree, tvb, offset, 4, "Generation Number: 0x%08x", - tvb_get_ntohl (tvb, offset)); - len = tvb_get_ntohl (tvb, offset+4); - proto_tree_add_text (tree, tvb, offset+4, 4, "Additional Length: %u", - len); + proto_tree_add_text(tree, tvb, offset, 4, "Generation Number: 0x%08x", + tvb_get_ntohl(tvb, offset)); + len = tvb_get_ntohl(tvb, offset+4); + proto_tree_add_text(tree, tvb, offset+4, 4, "Additional Length: %u", + len); len = (payload_len > len) ? len : payload_len; if ((flags & 0x1F) == SCSI_SPC_RESVIN_SVCA_RDKEYS) { @@ -4009,47 +4010,47 @@ dissect_spc_persistentreservein (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr offset += 8; for (i = 0; i < numrec; i++) { - proto_tree_add_item (tree, hf_scsi_persresv_key, tvb, offset, - 8, ENC_NA); + proto_tree_add_item(tree, hf_scsi_persresv_key, tvb, offset, + 8, ENC_NA); offset += 8; } } else if ((flags & 0x1F) == SCSI_SPC_RESVIN_SVCA_RDRESV) { - proto_tree_add_item (tree, hf_scsi_persresv_key, tvb, offset+8, - 8, ENC_NA); - proto_tree_add_item (tree, hf_scsi_persresv_scopeaddr, tvb, - offset+8, 4, ENC_NA); - proto_tree_add_item (tree, hf_scsi_persresv_scope, tvb, offset+13, - 1, ENC_BIG_ENDIAN); - proto_tree_add_item (tree, hf_scsi_persresv_type, tvb, offset+13, - 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_persresv_key, tvb, offset+8, + 8, ENC_NA); + proto_tree_add_item(tree, hf_scsi_persresv_scopeaddr, tvb, + offset+8, 4, ENC_NA); + proto_tree_add_item(tree, hf_scsi_persresv_scope, tvb, offset+13, + 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_persresv_type, tvb, offset+13, + 1, ENC_BIG_ENDIAN); } } } void -dissect_spc_persistentreserveout (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - guint offset, gboolean isreq, gboolean iscdb, - guint payload_len _U_, scsi_task_data_t *cdata _U_) +dissect_spc_persistentreserveout(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, + guint offset, gboolean isreq, gboolean iscdb, + guint payload_len _U_, scsi_task_data_t *cdata _U_) { if (!tree) return; if (isreq && iscdb) { - proto_tree_add_item (tree, hf_scsi_persresvout_svcaction, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item (tree, hf_scsi_persresv_scope, tvb, offset+1, 1, ENC_BIG_ENDIAN); - proto_tree_add_item (tree, hf_scsi_persresv_type, tvb, offset+1, 1, ENC_BIG_ENDIAN); - proto_tree_add_item (tree, hf_scsi_paramlen16, tvb, offset+6, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_persresvout_svcaction, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_persresv_scope, tvb, offset+1, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_persresv_type, tvb, offset+1, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_paramlen16, tvb, offset+6, 2, ENC_BIG_ENDIAN); proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control, - ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); + ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); /* We store the service action since we want to interpret the params */ - cdata->itlq->flags = tvb_get_guint8 (tvb, offset); + cdata->itlq->flags = tvb_get_guint8(tvb, offset); } else if (isreq && !iscdb) { - proto_tree_add_item (tree, hf_scsi_persresvout_reskey, tvb, offset, - 8, ENC_NA); - proto_tree_add_item (tree, hf_scsi_persresvout_sareskey, tvb, - offset +8, 8, ENC_NA); + proto_tree_add_item(tree, hf_scsi_persresvout_reskey, tvb, offset, + 8, ENC_NA); + proto_tree_add_item(tree, hf_scsi_persresvout_sareskey, tvb, + offset +8, 8, ENC_NA); if (cdata->itlq->flags == 0x07) { const int *persresv_fields[] = { &hf_scsi_persresv_control_rsvd, @@ -4057,11 +4058,11 @@ dissect_spc_persistentreserveout (tvbuff_t *tvb, packet_info *pinfo _U_, proto_t &hf_scsi_persresv_control_aptpl, NULL }; - proto_tree_add_item (tree, hf_scsi_persresvout_obsolete, tvb, - offset+16, 1, ENC_NA); + proto_tree_add_item(tree, hf_scsi_persresvout_obsolete, tvb, + offset+16, 1, ENC_NA); proto_tree_add_bitmask(tree, tvb, offset+17, - hf_scsi_persresvout_control, ett_persresv_control, - persresv_fields, ENC_BIG_ENDIAN); + hf_scsi_persresvout_control, ett_persresv_control, + persresv_fields, ENC_BIG_ENDIAN); } else { const int *persresv_fields[] = { @@ -4073,11 +4074,11 @@ dissect_spc_persistentreserveout (tvbuff_t *tvb, packet_info *pinfo _U_, proto_t NULL }; - proto_tree_add_item (tree, hf_scsi_persresvout_obsolete, tvb, - offset+16, 4, ENC_NA); + proto_tree_add_item(tree, hf_scsi_persresvout_obsolete, tvb, + offset+16, 4, ENC_NA); proto_tree_add_bitmask(tree, tvb, offset+20, - hf_scsi_persresvout_control, ett_persresv_control, - persresv_fields, ENC_BIG_ENDIAN); + hf_scsi_persresvout_control, ett_persresv_control, + persresv_fields, ENC_BIG_ENDIAN); } } else { @@ -4085,23 +4086,23 @@ dissect_spc_persistentreserveout (tvbuff_t *tvb, packet_info *pinfo _U_, proto_t } void -dissect_spc_release6 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - guint offset, gboolean isreq, gboolean iscdb, - guint payload_len _U_, scsi_task_data_t *cdata _U_) +dissect_spc_release6(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, + guint offset, gboolean isreq, gboolean iscdb, + guint payload_len _U_, scsi_task_data_t *cdata _U_) { if (!tree) return; if (isreq && iscdb) { proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control, - ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); + ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); } } void -dissect_spc_release10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - guint offset, gboolean isreq, gboolean iscdb, - guint payload_len _U_, scsi_task_data_t *cdata _U_) +dissect_spc_release10(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, + guint offset, gboolean isreq, gboolean iscdb, + guint payload_len _U_, scsi_task_data_t *cdata _U_) { guint8 flags; @@ -4109,48 +4110,48 @@ dissect_spc_release10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, return; if (isreq && iscdb) { - flags = tvb_get_guint8 (tvb, offset); - proto_tree_add_uint_format (tree, hf_scsi_release_flags, tvb, offset, 1, - flags, - "Flags: 3rd Party ID = %u, LongID = %u", - flags & 0x10, flags & 0x2); + flags = tvb_get_guint8(tvb, offset); + proto_tree_add_uint_format(tree, hf_scsi_release_flags, tvb, offset, 1, + flags, + "Flags: 3rd Party ID = %u, LongID = %u", + flags & 0x10, flags & 0x2); if ((flags & 0x12) == 0x10) { - proto_tree_add_item (tree, hf_scsi_release_thirdpartyid, tvb, - offset+2, 1, ENC_NA); + proto_tree_add_item(tree, hf_scsi_release_thirdpartyid, tvb, + offset+2, 1, ENC_NA); } - proto_tree_add_item (tree, hf_scsi_paramlen16, tvb, offset+6, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_paramlen16, tvb, offset+6, 2, ENC_BIG_ENDIAN); proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control, - ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); + ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); } } static void -dissect_spc_reportdeviceidentifier (tvbuff_t *tvb _U_, packet_info *pinfo _U_, -proto_tree *tree _U_, - guint offset _U_, gboolean isreq _U_, gboolean iscdb _U_, - guint payload_len _U_, scsi_task_data_t *cdata _U_) +dissect_spc_reportdeviceidentifier(tvbuff_t *tvb _U_, packet_info *pinfo _U_, + proto_tree *tree _U_, + guint offset _U_, gboolean isreq _U_, gboolean iscdb _U_, + guint payload_len _U_, scsi_task_data_t *cdata _U_) { } void -dissect_spc_reportluns (tvbuff_t *tvb, packet_info *pinfo _U_, - proto_tree *tree, guint offset, - gboolean isreq, gboolean iscdb, guint payload_len _U_, - scsi_task_data_t *cdata _U_) +dissect_spc_reportluns(tvbuff_t *tvb, packet_info *pinfo _U_, + proto_tree *tree, guint offset, + gboolean isreq, gboolean iscdb, guint payload_len _U_, + scsi_task_data_t *cdata _U_) { - gint listlen; - tvbuff_t *volatile tvb_v = tvb; - volatile guint offset_v = offset; + gint listlen; + tvbuff_t *volatile tvb_v = tvb; + volatile guint offset_v = offset; if (isreq && iscdb) { - proto_tree_add_item (tree, hf_scsi_select_report, tvb_v, offset_v+1, 1, ENC_BIG_ENDIAN); - proto_tree_add_item (tree, hf_scsi_alloclen32, tvb_v, offset_v+5, 4, ENC_BIG_ENDIAN); - if(cdata){ - cdata->itlq->alloc_len=tvb_get_ntohl(tvb_v, offset_v+5); + proto_tree_add_item(tree, hf_scsi_select_report, tvb_v, offset_v+1, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_alloclen32, tvb_v, offset_v+5, 4, ENC_BIG_ENDIAN); + if (cdata) { + cdata->itlq->alloc_len = tvb_get_ntohl(tvb_v, offset_v+5); } proto_tree_add_bitmask(tree, tvb, offset_v+10, hf_scsi_control, - ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); + ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); } else if (!isreq) { if (!cdata) { return; @@ -4158,17 +4159,17 @@ dissect_spc_reportluns (tvbuff_t *tvb, packet_info *pinfo _U_, TRY_SCSI_CDB_ALLOC_LEN(pinfo, tvb_v, offset_v, cdata->itlq->alloc_len); listlen = tvb_get_ntohl(tvb_v, offset_v); - proto_tree_add_text (tree, tvb_v, offset_v, 4, "LUN List Length: %u", - listlen); + proto_tree_add_text(tree, tvb_v, offset_v, 4, "LUN List Length: %u", + listlen); offset_v += 8; - while(listlen>0){ - if (!tvb_get_guint8 (tvb_v, offset_v)) - proto_tree_add_item (tree, hf_scsi_rluns_lun, tvb_v, offset_v+1, 1, - ENC_BIG_ENDIAN); + while(listlen>0) { + if (!tvb_get_guint8(tvb_v, offset_v)) + proto_tree_add_item(tree, hf_scsi_rluns_lun, tvb_v, offset_v+1, 1, + ENC_BIG_ENDIAN); else - proto_tree_add_item (tree, hf_scsi_rluns_multilun, tvb_v, offset_v, - 8, ENC_NA); + proto_tree_add_item(tree, hf_scsi_rluns_multilun, tvb_v, offset_v, + 8, ENC_NA); offset_v+=8; listlen-=8; } @@ -4177,73 +4178,73 @@ dissect_spc_reportluns (tvbuff_t *tvb, packet_info *pinfo _U_, } static void -dissect_scsi_fix_snsinfo (tvbuff_t *tvb, proto_tree *sns_tree, guint offset) +dissect_scsi_fix_snsinfo(tvbuff_t *tvb, proto_tree *sns_tree, guint offset) { proto_item *hidden_item; - guint8 flags; + guint8 flags; - flags = tvb_get_guint8 (tvb, offset); - proto_tree_add_text (sns_tree, tvb, offset, 1, "Valid: %u", - (flags & 0x80) >> 7); - proto_tree_add_item (sns_tree, hf_scsi_sns_errtype, tvb, offset, 1, ENC_BIG_ENDIAN); - flags = tvb_get_guint8 (tvb, offset+2); - proto_tree_add_text (sns_tree, tvb, offset+2, 1, - "Filemark: %u, EOM: %u, ILI: %u", - (flags & 0x80) >> 7, (flags & 0x40) >> 6, - (flags & 0x20) >> 5); - proto_tree_add_item (sns_tree, hf_scsi_snskey, tvb, offset+2, 1, ENC_BIG_ENDIAN); - proto_tree_add_item (sns_tree, hf_scsi_snsinfo, tvb, offset+3, 4, ENC_BIG_ENDIAN); - proto_tree_add_item (sns_tree, hf_scsi_addlsnslen, tvb, offset+7, 1, ENC_BIG_ENDIAN); - proto_tree_add_text (sns_tree, tvb, offset+8, 4, - "Command-Specific Information: %s", - tvb_bytes_to_str (tvb, offset+8, 4)); - proto_tree_add_item (sns_tree, hf_scsi_ascascq, tvb, offset+12, 2, ENC_BIG_ENDIAN); - hidden_item = proto_tree_add_item (sns_tree, hf_scsi_asc, tvb, offset+12, 1, ENC_BIG_ENDIAN); + flags = tvb_get_guint8(tvb, offset); + proto_tree_add_text(sns_tree, tvb, offset, 1, "Valid: %u", + (flags & 0x80) >> 7); + proto_tree_add_item(sns_tree, hf_scsi_sns_errtype, tvb, offset, 1, ENC_BIG_ENDIAN); + flags = tvb_get_guint8(tvb, offset+2); + proto_tree_add_text(sns_tree, tvb, offset+2, 1, + "Filemark: %u, EOM: %u, ILI: %u", + (flags & 0x80) >> 7, (flags & 0x40) >> 6, + (flags & 0x20) >> 5); + proto_tree_add_item(sns_tree, hf_scsi_snskey, tvb, offset+2, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(sns_tree, hf_scsi_snsinfo, tvb, offset+3, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(sns_tree, hf_scsi_addlsnslen, tvb, offset+7, 1, ENC_BIG_ENDIAN); + proto_tree_add_text(sns_tree, tvb, offset+8, 4, + "Command-Specific Information: %s", + tvb_bytes_to_str(tvb, offset+8, 4)); + proto_tree_add_item(sns_tree, hf_scsi_ascascq, tvb, offset+12, 2, ENC_BIG_ENDIAN); + hidden_item = proto_tree_add_item(sns_tree, hf_scsi_asc, tvb, offset+12, 1, ENC_BIG_ENDIAN); PROTO_ITEM_SET_HIDDEN(hidden_item); - hidden_item = proto_tree_add_item (sns_tree, hf_scsi_ascq, tvb, offset+13, 1, ENC_BIG_ENDIAN); + hidden_item = proto_tree_add_item(sns_tree, hf_scsi_ascq, tvb, offset+13, 1, ENC_BIG_ENDIAN); PROTO_ITEM_SET_HIDDEN(hidden_item); - proto_tree_add_item (sns_tree, hf_scsi_fru, tvb, offset+14, 1, ENC_BIG_ENDIAN); - proto_tree_add_item (sns_tree, hf_scsi_sksv, tvb, offset+15, 1, ENC_BIG_ENDIAN); - proto_tree_add_text (sns_tree, tvb, offset+15, 3, - "Sense Key Specific: %s", - tvb_bytes_to_str (tvb, offset+15, 3)); + proto_tree_add_item(sns_tree, hf_scsi_fru, tvb, offset+14, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(sns_tree, hf_scsi_sksv, tvb, offset+15, 1, ENC_BIG_ENDIAN); + proto_tree_add_text(sns_tree, tvb, offset+15, 3, + "Sense Key Specific: %s", + tvb_bytes_to_str(tvb, offset+15, 3)); } void -dissect_spc_requestsense (tvbuff_t * tvb, packet_info *pinfo _U_, proto_tree *tree, - guint offset, gboolean isreq, gboolean iscdb, - guint payload_len _U_, scsi_task_data_t *cdata _U_) +dissect_spc_requestsense(tvbuff_t * tvb, packet_info *pinfo _U_, proto_tree *tree, + guint offset, gboolean isreq, gboolean iscdb, + guint payload_len _U_, scsi_task_data_t *cdata _U_) { if (!tree) return; if (isreq && iscdb) { - proto_tree_add_item (tree, hf_scsi_alloclen, tvb, offset+3, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_alloclen, tvb, offset+3, 1, ENC_BIG_ENDIAN); proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control, - ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); + ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); } else if (!isreq) dissect_scsi_fix_snsinfo(tvb, tree, offset); } void -dissect_spc_reserve6 (tvbuff_t * tvb, packet_info *pinfo _U_, proto_tree *tree, - guint offset, gboolean isreq, gboolean iscdb, - guint payload_len _U_, scsi_task_data_t *cdata _U_) +dissect_spc_reserve6(tvbuff_t * tvb, packet_info *pinfo _U_, proto_tree *tree, + guint offset, gboolean isreq, gboolean iscdb, + guint payload_len _U_, scsi_task_data_t *cdata _U_) { if (!tree) return; if (isreq && iscdb) { proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control, - ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); + ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); } } void -dissect_spc_reserve10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - guint offset, gboolean isreq, gboolean iscdb, - guint payload_len _U_, scsi_task_data_t *cdata _U_) +dissect_spc_reserve10(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, + guint offset, gboolean isreq, gboolean iscdb, + guint payload_len _U_, scsi_task_data_t *cdata _U_) { guint8 flags; @@ -4251,23 +4252,23 @@ dissect_spc_reserve10 (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, return; if (isreq && iscdb) { - flags = tvb_get_guint8 (tvb, offset); - proto_tree_add_uint_format (tree, hf_scsi_release_flags, tvb, offset, 1, - flags, - "Flags: 3rd Party ID = %u, LongID = %u", - flags & 0x10, flags & 0x2); + flags = tvb_get_guint8(tvb, offset); + proto_tree_add_uint_format(tree, hf_scsi_release_flags, tvb, offset, 1, + flags, + "Flags: 3rd Party ID = %u, LongID = %u", + flags & 0x10, flags & 0x2); if ((flags & 0x12) == 0x10) { - proto_tree_add_item (tree, hf_scsi_release_thirdpartyid, tvb, - offset+2, 1, ENC_NA); + proto_tree_add_item(tree, hf_scsi_release_thirdpartyid, tvb, + offset+2, 1, ENC_NA); } - proto_tree_add_item (tree, hf_scsi_paramlen16, tvb, offset+6, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_paramlen16, tvb, offset+6, 2, ENC_BIG_ENDIAN); proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control, - ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); + ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); } } void -dissect_spc_testunitready (tvbuff_t * tvb, packet_info *pinfo _U_, proto_tree *tree, +dissect_spc_testunitready(tvbuff_t * tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset, gboolean isreq, gboolean iscdb, guint payload_len _U_, scsi_task_data_t *cdata _U_) { @@ -4277,7 +4278,7 @@ dissect_spc_testunitready (tvbuff_t * tvb, packet_info *pinfo _U_, proto_tree *t if (isreq && iscdb) { proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control, - ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); + ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); } } @@ -4287,450 +4288,450 @@ dissect_spc_testunitready (tvbuff_t * tvb, packet_info *pinfo _U_, proto_tree *t void -dissect_spc_senddiagnostic (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - guint offset, gboolean isreq, gboolean iscdb _U_, - guint payload_len _U_, scsi_task_data_t *cdata _U_) +dissect_spc_senddiagnostic(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, + guint offset, gboolean isreq, gboolean iscdb _U_, + guint payload_len _U_, scsi_task_data_t *cdata _U_) { if (!tree && !isreq) return; - proto_tree_add_uint (tree, hf_scsi_senddiag_st_code, tvb, offset, 1, 0); - proto_tree_add_boolean (tree, hf_scsi_senddiag_pf, tvb, offset, 1, 0); - proto_tree_add_boolean (tree, hf_scsi_senddiag_st, tvb, offset, 1, 0); - proto_tree_add_boolean (tree, hf_scsi_senddiag_devoff, tvb, offset, 1, 0); - proto_tree_add_boolean (tree, hf_scsi_senddiag_unitoff, tvb, offset, 1, 0); - proto_tree_add_uint (tree, hf_scsi_paramlen16, tvb, offset+2, 2, 0); + proto_tree_add_uint(tree, hf_scsi_senddiag_st_code, tvb, offset, 1, 0); + proto_tree_add_boolean(tree, hf_scsi_senddiag_pf, tvb, offset, 1, 0); + proto_tree_add_boolean(tree, hf_scsi_senddiag_st, tvb, offset, 1, 0); + proto_tree_add_boolean(tree, hf_scsi_senddiag_devoff, tvb, offset, 1, 0); + proto_tree_add_boolean(tree, hf_scsi_senddiag_unitoff, tvb, offset, 1, 0); + proto_tree_add_uint(tree, hf_scsi_paramlen16, tvb, offset+2, 2, 0); proto_tree_add_bitmask(tree, tvb, offset+4, hf_scsi_control, - ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); + ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); } void -dissect_spc_writebuffer (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - guint offset, gboolean isreq, gboolean iscdb _U_, - guint payload_len _U_, scsi_task_data_t *cdata _U_) +dissect_spc_writebuffer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, + guint offset, gboolean isreq, gboolean iscdb _U_, + guint payload_len _U_, scsi_task_data_t *cdata _U_) { if (!tree && !isreq) return; - proto_tree_add_uint (tree, hf_scsi_wb_mode, tvb, offset, 1, 0); - proto_tree_add_uint (tree, hf_scsi_wb_bufferid, tvb, offset+1, 1, 0); - proto_tree_add_uint (tree, hf_scsi_wb_bufoffset, tvb, offset+2, 3, 0); - proto_tree_add_uint (tree, hf_scsi_paramlen24, tvb, offset+5, 3, 0); + proto_tree_add_uint(tree, hf_scsi_wb_mode, tvb, offset, 1, 0); + proto_tree_add_uint(tree, hf_scsi_wb_bufferid, tvb, offset+1, 1, 0); + proto_tree_add_uint(tree, hf_scsi_wb_bufoffset, tvb, offset+2, 3, 0); + proto_tree_add_uint(tree, hf_scsi_paramlen24, tvb, offset+5, 3, 0); proto_tree_add_bitmask(tree, tvb, offset+8, hf_scsi_control, - ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); + ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN); } static void -dissect_scsi_varlencdb (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, - guint offset, gboolean isreq, gboolean iscdb, - guint payload_len _U_, scsi_task_data_t *cdata _U_) +dissect_scsi_varlencdb(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, + guint offset, gboolean isreq, gboolean iscdb, + guint payload_len _U_, scsi_task_data_t *cdata _U_) { if (!tree) return; if (isreq && iscdb) { - proto_tree_add_item (tree, hf_scsi_control, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_item (tree, hf_scsi_add_cdblen, tvb, offset+6, 1, ENC_BIG_ENDIAN); - proto_tree_add_item (tree, hf_scsi_svcaction, tvb, offset+7, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_control, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_add_cdblen, tvb, offset+6, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_scsi_svcaction, tvb, offset+7, 2, ENC_BIG_ENDIAN); } } void -dissect_scsi_rsp (tvbuff_t *tvb, packet_info *pinfo, - proto_tree *tree, itlq_nexus_t *itlq, itl_nexus_t *itl, - guint8 scsi_status) +dissect_scsi_rsp(tvbuff_t *tvb, packet_info *pinfo, + proto_tree *tree, itlq_nexus_t *itlq, itl_nexus_t *itl, + guint8 scsi_status) { - proto_item *ti; - proto_tree *scsi_tree = NULL; - cmdset_t *csdata; + proto_item *ti; + proto_tree *scsi_tree = NULL; + cmdset_t *csdata; scsi_task_data_t *cdata; cdata = ep_alloc(sizeof(scsi_task_data_t)); - cdata->itl=itl; - cdata->itlq=itlq; - cdata->type=SCSI_PDU_TYPE_RSP; + cdata->itl = itl; + cdata->itlq = itlq; + cdata->type = SCSI_PDU_TYPE_RSP; tap_queue_packet(scsi_tap, pinfo, cdata); - csdata=get_cmdset_data(itlq, itl); /* will g_assert if itlq is null */ + csdata = get_cmdset_data(itlq, itl); /* will g_assert if itlq is null */ /* Nothing really to do here, just print some stuff passed to us */ if (tree) { - ti = proto_tree_add_protocol_format (tree, proto_scsi, tvb, 0, - 0, "SCSI Response (%s)", - val_to_str (itlq->scsi_opcode, - csdata->cdb_vals, - "CDB:0x%02x")); - scsi_tree = proto_item_add_subtree (ti, ett_scsi); + ti = proto_tree_add_protocol_format(tree, proto_scsi, tvb, 0, + 0, "SCSI Response (%s)", + val_to_str(itlq->scsi_opcode, + csdata->cdb_vals, + "CDB:0x%02x")); + scsi_tree = proto_item_add_subtree(ti, ett_scsi); } - ti=proto_tree_add_uint(scsi_tree, hf_scsi_lun, tvb, 0, 0, itlq->lun); + ti = proto_tree_add_uint(scsi_tree, hf_scsi_lun, tvb, 0, 0, itlq->lun); PROTO_ITEM_SET_GENERATED(ti); - if(itl){ - ti=proto_tree_add_uint_format(scsi_tree, hf_scsi_inq_devtype, tvb, 0, 0, itl->cmdset&SCSI_CMDSET_MASK, "Command Set:%s (0x%02x) %s", val_to_str(itl->cmdset&SCSI_CMDSET_MASK, scsi_devtype_val, "Unknown (%d)"), itl->cmdset&SCSI_CMDSET_MASK,itl->cmdset&SCSI_CMDSET_DEFAULT?"(Using default commandset)":""); + if (itl) { + ti = proto_tree_add_uint_format(scsi_tree, hf_scsi_inq_devtype, tvb, 0, 0, itl->cmdset&SCSI_CMDSET_MASK, "Command Set:%s (0x%02x) %s", val_to_str(itl->cmdset&SCSI_CMDSET_MASK, scsi_devtype_val, "Unknown (%d)"), itl->cmdset&SCSI_CMDSET_MASK,itl->cmdset&SCSI_CMDSET_DEFAULT?"(Using default commandset)":""); PROTO_ITEM_SET_GENERATED(ti); - if(itlq->scsi_opcode!=0xffff){ - ti=proto_tree_add_uint(scsi_tree, csdata->hf_opcode, tvb, 0, 0, itlq->scsi_opcode); + if (itlq->scsi_opcode != 0xffff) { + ti = proto_tree_add_uint(scsi_tree, csdata->hf_opcode, tvb, 0, 0, itlq->scsi_opcode); PROTO_ITEM_SET_GENERATED(ti); } } - if(itlq->first_exchange_frame){ + if (itlq->first_exchange_frame) { nstime_t delta_time; - ti=proto_tree_add_uint(scsi_tree, hf_scsi_request_frame, tvb, 0, 0, itlq->first_exchange_frame); + ti = proto_tree_add_uint(scsi_tree, hf_scsi_request_frame, tvb, 0, 0, itlq->first_exchange_frame); PROTO_ITEM_SET_GENERATED(ti); nstime_delta(&delta_time, &pinfo->fd->abs_ts, &itlq->fc_time); - ti=proto_tree_add_time(scsi_tree, hf_scsi_time, tvb, 0, 0, &delta_time); + ti = proto_tree_add_time(scsi_tree, hf_scsi_time, tvb, 0, 0, &delta_time); PROTO_ITEM_SET_GENERATED(ti); } - ti=proto_tree_add_uint(scsi_tree, hf_scsi_status, tvb, 0, 0, scsi_status); + ti = proto_tree_add_uint(scsi_tree, hf_scsi_status, tvb, 0, 0, scsi_status); PROTO_ITEM_SET_GENERATED(ti); - if (check_col (pinfo->cinfo, COL_INFO)) { - col_add_fstr (pinfo->cinfo, COL_INFO, "SCSI: Response LUN: 0x%02x (%s) (%s)", itlq->lun, - val_to_str(itlq->scsi_opcode, csdata->cdb_vals, "CDB:0x%02x"), - val_to_str(scsi_status, scsi_status_val, "Unknown (0x%08x)")); + if (check_col(pinfo->cinfo, COL_INFO)) { + col_add_fstr(pinfo->cinfo, COL_INFO, "SCSI: Response LUN: 0x%02x (%s) (%s)", itlq->lun, + val_to_str(itlq->scsi_opcode, csdata->cdb_vals, "CDB:0x%02x"), + val_to_str(scsi_status, scsi_status_val, "Unknown (0x%08x)")); - col_set_fence(pinfo->cinfo, COL_INFO); - } + col_set_fence(pinfo->cinfo, COL_INFO); + } } void -dissect_scsi_snsinfo (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - guint offset, guint snslen, itlq_nexus_t *itlq, itl_nexus_t *itl) +dissect_scsi_snsinfo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + guint offset, guint snslen, itlq_nexus_t *itlq, itl_nexus_t *itl) { - proto_item *ti; - proto_tree *sns_tree=NULL; - const char *old_proto; + proto_item *ti; + proto_tree *sns_tree = NULL; + const char *old_proto; scsi_task_data_t *cdata; cdata = ep_alloc(sizeof(scsi_task_data_t)); - cdata->itl=itl; - cdata->itlq=itlq; - cdata->type=SCSI_PDU_TYPE_SNS; + cdata->itl = itl; + cdata->itlq = itlq; + cdata->type = SCSI_PDU_TYPE_SNS; tap_queue_packet(scsi_tap, pinfo, cdata); - old_proto=pinfo->current_proto; + old_proto = pinfo->current_proto; pinfo->current_proto="SCSI"; if (tree) { - ti = proto_tree_add_protocol_format (tree, proto_scsi, tvb, offset, - snslen, "SCSI: SNS Info"); - sns_tree = proto_item_add_subtree (ti, ett_scsi); + ti = proto_tree_add_protocol_format(tree, proto_scsi, tvb, offset, + snslen, "SCSI: SNS Info"); + sns_tree = proto_item_add_subtree(ti, ett_scsi); } - ti=proto_tree_add_uint(sns_tree, hf_scsi_lun, tvb, 0, 0, itlq->lun); + ti = proto_tree_add_uint(sns_tree, hf_scsi_lun, tvb, 0, 0, itlq->lun); PROTO_ITEM_SET_GENERATED(ti); - if (check_col (pinfo->cinfo, COL_INFO)) { - col_append_fstr (pinfo->cinfo, COL_INFO, " LUN:0x%02x ", itlq->lun); + if (check_col(pinfo->cinfo, COL_INFO)) { + col_append_fstr(pinfo->cinfo, COL_INFO, " LUN:0x%02x ", itlq->lun); - col_set_fence(pinfo->cinfo, COL_INFO); + col_set_fence(pinfo->cinfo, COL_INFO); } - dissect_scsi_fix_snsinfo (tvb, sns_tree, offset); + dissect_scsi_fix_snsinfo(tvb, sns_tree, offset); - pinfo->current_proto=old_proto; + pinfo->current_proto = old_proto; } static scsi_cdb_table_t spc[256] = { -/*SPC 0x00*/{dissect_spc_testunitready}, -/*SPC 0x01*/{NULL}, -/*SPC 0x02*/{NULL}, -/*SPC 0x03*/{dissect_spc_requestsense}, -/*SPC 0x04*/{NULL}, -/*SPC 0x05*/{NULL}, -/*SPC 0x06*/{NULL}, -/*SPC 0x07*/{NULL}, -/*SPC 0x08*/{NULL}, -/*SPC 0x09*/{NULL}, -/*SPC 0x0a*/{NULL}, -/*SPC 0x0b*/{NULL}, -/*SPC 0x0c*/{NULL}, -/*SPC 0x0d*/{NULL}, -/*SPC 0x0e*/{NULL}, -/*SPC 0x0f*/{NULL}, -/*SPC 0x10*/{NULL}, -/*SPC 0x11*/{NULL}, -/*SPC 0x12*/{dissect_spc_inquiry}, -/*SPC 0x13*/{NULL}, -/*SPC 0x14*/{NULL}, -/*SPC 0x15*/{dissect_spc_modeselect6}, -/*SPC 0x16*/{dissect_spc_reserve6}, -/*SPC 0x17*/{dissect_spc_release6}, -/*SPC 0x18*/{NULL}, -/*SPC 0x19*/{NULL}, -/*SPC 0x1a*/{dissect_spc_modesense6}, -/*SPC 0x1b*/{NULL}, -/*SPC 0x1c*/{NULL}, -/*SPC 0x1d*/{dissect_spc_senddiagnostic}, -/*SPC 0x1e*/{dissect_spc_preventallowmediaremoval}, -/*SPC 0x1f*/{NULL}, -/*SPC 0x20*/{NULL}, -/*SPC 0x21*/{NULL}, -/*SPC 0x22*/{NULL}, -/*SPC 0x23*/{NULL}, -/*SPC 0x24*/{NULL}, -/*SPC 0x25*/{NULL}, -/*SPC 0x26*/{NULL}, -/*SPC 0x27*/{NULL}, -/*SPC 0x28*/{NULL}, -/*SPC 0x29*/{NULL}, -/*SPC 0x2a*/{NULL}, -/*SPC 0x2b*/{NULL}, -/*SPC 0x2c*/{NULL}, -/*SPC 0x2d*/{NULL}, -/*SPC 0x2e*/{NULL}, -/*SPC 0x2f*/{NULL}, -/*SPC 0x30*/{NULL}, -/*SPC 0x31*/{NULL}, -/*SPC 0x32*/{NULL}, -/*SPC 0x33*/{NULL}, -/*SPC 0x34*/{NULL}, -/*SPC 0x35*/{NULL}, -/*SPC 0x36*/{NULL}, -/*SPC 0x37*/{NULL}, -/*SPC 0x38*/{NULL}, -/*SPC 0x39*/{NULL}, -/*SPC 0x3a*/{NULL}, -/*SPC 0x3b*/{dissect_spc_writebuffer}, -/*SPC 0x3c*/{NULL}, -/*SPC 0x3d*/{NULL}, -/*SPC 0x3e*/{NULL}, -/*SPC 0x3f*/{NULL}, -/*SPC 0x40*/{NULL}, -/*SPC 0x41*/{NULL}, -/*SPC 0x42*/{NULL}, -/*SPC 0x43*/{NULL}, -/*SPC 0x44*/{NULL}, -/*SPC 0x45*/{NULL}, -/*SPC 0x46*/{NULL}, -/*SPC 0x47*/{NULL}, -/*SPC 0x48*/{NULL}, -/*SPC 0x49*/{NULL}, -/*SPC 0x4a*/{NULL}, -/*SPC 0x4b*/{NULL}, -/*SPC 0x4c*/{dissect_spc_logselect}, -/*SPC 0x4d*/{dissect_spc_logsense}, -/*SPC 0x4e*/{NULL}, -/*SPC 0x4f*/{NULL}, -/*SPC 0x50*/{NULL}, -/*SPC 0x51*/{NULL}, -/*SPC 0x52*/{NULL}, -/*SPC 0x53*/{NULL}, -/*SPC 0x54*/{NULL}, -/*SPC 0x55*/{dissect_spc_modeselect10}, -/*SPC 0x56*/{dissect_spc_reserve10}, -/*SPC 0x57*/{dissect_spc_release10}, -/*SPC 0x58*/{NULL}, -/*SPC 0x59*/{NULL}, -/*SPC 0x5a*/{dissect_spc_modesense10}, -/*SPC 0x5b*/{NULL}, -/*SPC 0x5c*/{NULL}, -/*SPC 0x5d*/{NULL}, -/*SPC 0x5e*/{dissect_spc_persistentreservein}, -/*SPC 0x5f*/{dissect_spc_persistentreserveout}, -/*SPC 0x60*/{NULL}, -/*SPC 0x61*/{NULL}, -/*SPC 0x62*/{NULL}, -/*SPC 0x63*/{NULL}, -/*SPC 0x64*/{NULL}, -/*SPC 0x65*/{NULL}, -/*SPC 0x66*/{NULL}, -/*SPC 0x67*/{NULL}, -/*SPC 0x68*/{NULL}, -/*SPC 0x69*/{NULL}, -/*SPC 0x6a*/{NULL}, -/*SPC 0x6b*/{NULL}, -/*SPC 0x6c*/{NULL}, -/*SPC 0x6d*/{NULL}, -/*SPC 0x6e*/{NULL}, -/*SPC 0x6f*/{NULL}, -/*SPC 0x70*/{NULL}, -/*SPC 0x71*/{NULL}, -/*SPC 0x72*/{NULL}, -/*SPC 0x73*/{NULL}, -/*SPC 0x74*/{NULL}, -/*SPC 0x75*/{NULL}, -/*SPC 0x76*/{NULL}, -/*SPC 0x77*/{NULL}, -/*SPC 0x78*/{NULL}, -/*SPC 0x79*/{NULL}, -/*SPC 0x7a*/{NULL}, -/*SPC 0x7b*/{NULL}, -/*SPC 0x7c*/{NULL}, -/*SPC 0x7d*/{NULL}, -/*SPC 0x7e*/{NULL}, -/*SPC 0x7f*/{dissect_scsi_varlencdb}, -/*SPC 0x80*/{NULL}, -/*SPC 0x81*/{NULL}, -/*SPC 0x82*/{NULL}, -/*SPC 0x83*/{dissect_spc_extcopy}, -/*SPC 0x84*/{NULL}, -/*SPC 0x85*/{NULL}, -/*SPC 0x86*/{NULL}, -/*SPC 0x87*/{NULL}, -/*SPC 0x88*/{NULL}, -/*SPC 0x89*/{NULL}, -/*SPC 0x8a*/{NULL}, -/*SPC 0x8b*/{NULL}, -/*SPC 0x8c*/{NULL}, -/*SPC 0x8d*/{NULL}, -/*SPC 0x8e*/{NULL}, -/*SPC 0x8f*/{NULL}, -/*SPC 0x90*/{NULL}, -/*SPC 0x91*/{NULL}, -/*SPC 0x92*/{NULL}, -/*SPC 0x93*/{NULL}, -/*SPC 0x94*/{NULL}, -/*SPC 0x95*/{NULL}, -/*SPC 0x96*/{NULL}, -/*SPC 0x97*/{NULL}, -/*SPC 0x98*/{NULL}, -/*SPC 0x99*/{NULL}, -/*SPC 0x9a*/{NULL}, -/*SPC 0x9b*/{NULL}, -/*SPC 0x9c*/{NULL}, -/*SPC 0x9d*/{NULL}, -/*SPC 0x9e*/{NULL}, -/*SPC 0x9f*/{NULL}, -/*SPC 0xa0*/{dissect_spc_reportluns}, -/*SPC 0xa1*/{NULL}, -/*SPC 0xa2*/{NULL}, -/*SPC 0xa3*/{dissect_spc_reportdeviceidentifier}, -/*SPC 0xa4*/{NULL}, -/*SPC 0xa5*/{NULL}, -/*SPC 0xa6*/{NULL}, -/*SPC 0xa7*/{NULL}, -/*SPC 0xa8*/{NULL}, -/*SPC 0xa9*/{NULL}, -/*SPC 0xaa*/{NULL}, -/*SPC 0xab*/{NULL}, -/*SPC 0xac*/{NULL}, -/*SPC 0xad*/{NULL}, -/*SPC 0xae*/{NULL}, -/*SPC 0xaf*/{NULL}, -/*SPC 0xb0*/{NULL}, -/*SPC 0xb1*/{NULL}, -/*SPC 0xb2*/{NULL}, -/*SPC 0xb3*/{NULL}, -/*SPC 0xb4*/{NULL}, -/*SPC 0xb5*/{NULL}, -/*SPC 0xb6*/{NULL}, -/*SPC 0xb7*/{NULL}, -/*SPC 0xb8*/{NULL}, -/*SPC 0xb9*/{NULL}, -/*SPC 0xba*/{NULL}, -/*SPC 0xbb*/{NULL}, -/*SPC 0xbc*/{NULL}, -/*SPC 0xbd*/{NULL}, -/*SPC 0xbe*/{NULL}, -/*SPC 0xbf*/{NULL}, -/*SPC 0xc0*/{NULL}, -/*SPC 0xc1*/{NULL}, -/*SPC 0xc2*/{NULL}, -/*SPC 0xc3*/{NULL}, -/*SPC 0xc4*/{NULL}, -/*SPC 0xc5*/{NULL}, -/*SPC 0xc6*/{NULL}, -/*SPC 0xc7*/{NULL}, -/*SPC 0xc8*/{NULL}, -/*SPC 0xc9*/{NULL}, -/*SPC 0xca*/{NULL}, -/*SPC 0xcb*/{NULL}, -/*SPC 0xcc*/{NULL}, -/*SPC 0xcd*/{NULL}, -/*SPC 0xce*/{NULL}, -/*SPC 0xcf*/{NULL}, -/*SPC 0xd0*/{NULL}, -/*SPC 0xd1*/{NULL}, -/*SPC 0xd2*/{NULL}, -/*SPC 0xd3*/{NULL}, -/*SPC 0xd4*/{NULL}, -/*SPC 0xd5*/{NULL}, -/*SPC 0xd6*/{NULL}, -/*SPC 0xd7*/{NULL}, -/*SPC 0xd8*/{NULL}, -/*SPC 0xd9*/{NULL}, -/*SPC 0xda*/{NULL}, -/*SPC 0xdb*/{NULL}, -/*SPC 0xdc*/{NULL}, -/*SPC 0xdd*/{NULL}, -/*SPC 0xde*/{NULL}, -/*SPC 0xdf*/{NULL}, -/*SPC 0xe0*/{NULL}, -/*SPC 0xe1*/{NULL}, -/*SPC 0xe2*/{NULL}, -/*SPC 0xe3*/{NULL}, -/*SPC 0xe4*/{NULL}, -/*SPC 0xe5*/{NULL}, -/*SPC 0xe6*/{NULL}, -/*SPC 0xe7*/{NULL}, -/*SPC 0xe8*/{NULL}, -/*SPC 0xe9*/{NULL}, -/*SPC 0xea*/{NULL}, -/*SPC 0xeb*/{NULL}, -/*SPC 0xec*/{NULL}, -/*SPC 0xed*/{NULL}, -/*SPC 0xee*/{NULL}, -/*SPC 0xef*/{NULL}, -/*SPC 0xf0*/{NULL}, -/*SPC 0xf1*/{NULL}, -/*SPC 0xf2*/{NULL}, -/*SPC 0xf3*/{NULL}, -/*SPC 0xf4*/{NULL}, -/*SPC 0xf5*/{NULL}, -/*SPC 0xf6*/{NULL}, -/*SPC 0xf7*/{NULL}, -/*SPC 0xf8*/{NULL}, -/*SPC 0xf9*/{NULL}, -/*SPC 0xfa*/{NULL}, -/*SPC 0xfb*/{NULL}, -/*SPC 0xfc*/{NULL}, -/*SPC 0xfd*/{NULL}, -/*SPC 0xfe*/{NULL}, -/*SPC 0xff*/{NULL} + /*SPC 0x00*/{dissect_spc_testunitready}, + /*SPC 0x01*/{NULL}, + /*SPC 0x02*/{NULL}, + /*SPC 0x03*/{dissect_spc_requestsense}, + /*SPC 0x04*/{NULL}, + /*SPC 0x05*/{NULL}, + /*SPC 0x06*/{NULL}, + /*SPC 0x07*/{NULL}, + /*SPC 0x08*/{NULL}, + /*SPC 0x09*/{NULL}, + /*SPC 0x0a*/{NULL}, + /*SPC 0x0b*/{NULL}, + /*SPC 0x0c*/{NULL}, + /*SPC 0x0d*/{NULL}, + /*SPC 0x0e*/{NULL}, + /*SPC 0x0f*/{NULL}, + /*SPC 0x10*/{NULL}, + /*SPC 0x11*/{NULL}, + /*SPC 0x12*/{dissect_spc_inquiry}, + /*SPC 0x13*/{NULL}, + /*SPC 0x14*/{NULL}, + /*SPC 0x15*/{dissect_spc_modeselect6}, + /*SPC 0x16*/{dissect_spc_reserve6}, + /*SPC 0x17*/{dissect_spc_release6}, + /*SPC 0x18*/{NULL}, + /*SPC 0x19*/{NULL}, + /*SPC 0x1a*/{dissect_spc_modesense6}, + /*SPC 0x1b*/{NULL}, + /*SPC 0x1c*/{NULL}, + /*SPC 0x1d*/{dissect_spc_senddiagnostic}, + /*SPC 0x1e*/{dissect_spc_preventallowmediaremoval}, + /*SPC 0x1f*/{NULL}, + /*SPC 0x20*/{NULL}, + /*SPC 0x21*/{NULL}, + /*SPC 0x22*/{NULL}, + /*SPC 0x23*/{NULL}, + /*SPC 0x24*/{NULL}, + /*SPC 0x25*/{NULL}, + /*SPC 0x26*/{NULL}, + /*SPC 0x27*/{NULL}, + /*SPC 0x28*/{NULL}, + /*SPC 0x29*/{NULL}, + /*SPC 0x2a*/{NULL}, + /*SPC 0x2b*/{NULL}, + /*SPC 0x2c*/{NULL}, + /*SPC 0x2d*/{NULL}, + /*SPC 0x2e*/{NULL}, + /*SPC 0x2f*/{NULL}, + /*SPC 0x30*/{NULL}, + /*SPC 0x31*/{NULL}, + /*SPC 0x32*/{NULL}, + /*SPC 0x33*/{NULL}, + /*SPC 0x34*/{NULL}, + /*SPC 0x35*/{NULL}, + /*SPC 0x36*/{NULL}, + /*SPC 0x37*/{NULL}, + /*SPC 0x38*/{NULL}, + /*SPC 0x39*/{NULL}, + /*SPC 0x3a*/{NULL}, + /*SPC 0x3b*/{dissect_spc_writebuffer}, + /*SPC 0x3c*/{NULL}, + /*SPC 0x3d*/{NULL}, + /*SPC 0x3e*/{NULL}, + /*SPC 0x3f*/{NULL}, + /*SPC 0x40*/{NULL}, + /*SPC 0x41*/{NULL}, + /*SPC 0x42*/{NULL}, + /*SPC 0x43*/{NULL}, + /*SPC 0x44*/{NULL}, + /*SPC 0x45*/{NULL}, + /*SPC 0x46*/{NULL}, + /*SPC 0x47*/{NULL}, + /*SPC 0x48*/{NULL}, + /*SPC 0x49*/{NULL}, + /*SPC 0x4a*/{NULL}, + /*SPC 0x4b*/{NULL}, + /*SPC 0x4c*/{dissect_spc_logselect}, + /*SPC 0x4d*/{dissect_spc_logsense}, + /*SPC 0x4e*/{NULL}, + /*SPC 0x4f*/{NULL}, + /*SPC 0x50*/{NULL}, + /*SPC 0x51*/{NULL}, + /*SPC 0x52*/{NULL}, + /*SPC 0x53*/{NULL}, + /*SPC 0x54*/{NULL}, + /*SPC 0x55*/{dissect_spc_modeselect10}, + /*SPC 0x56*/{dissect_spc_reserve10}, + /*SPC 0x57*/{dissect_spc_release10}, + /*SPC 0x58*/{NULL}, + /*SPC 0x59*/{NULL}, + /*SPC 0x5a*/{dissect_spc_modesense10}, + /*SPC 0x5b*/{NULL}, + /*SPC 0x5c*/{NULL}, + /*SPC 0x5d*/{NULL}, + /*SPC 0x5e*/{dissect_spc_persistentreservein}, + /*SPC 0x5f*/{dissect_spc_persistentreserveout}, + /*SPC 0x60*/{NULL}, + /*SPC 0x61*/{NULL}, + /*SPC 0x62*/{NULL}, + /*SPC 0x63*/{NULL}, + /*SPC 0x64*/{NULL}, + /*SPC 0x65*/{NULL}, + /*SPC 0x66*/{NULL}, + /*SPC 0x67*/{NULL}, + /*SPC 0x68*/{NULL}, + /*SPC 0x69*/{NULL}, + /*SPC 0x6a*/{NULL}, + /*SPC 0x6b*/{NULL}, + /*SPC 0x6c*/{NULL}, + /*SPC 0x6d*/{NULL}, + /*SPC 0x6e*/{NULL}, + /*SPC 0x6f*/{NULL}, + /*SPC 0x70*/{NULL}, + /*SPC 0x71*/{NULL}, + /*SPC 0x72*/{NULL}, + /*SPC 0x73*/{NULL}, + /*SPC 0x74*/{NULL}, + /*SPC 0x75*/{NULL}, + /*SPC 0x76*/{NULL}, + /*SPC 0x77*/{NULL}, + /*SPC 0x78*/{NULL}, + /*SPC 0x79*/{NULL}, + /*SPC 0x7a*/{NULL}, + /*SPC 0x7b*/{NULL}, + /*SPC 0x7c*/{NULL}, + /*SPC 0x7d*/{NULL}, + /*SPC 0x7e*/{NULL}, + /*SPC 0x7f*/{dissect_scsi_varlencdb}, + /*SPC 0x80*/{NULL}, + /*SPC 0x81*/{NULL}, + /*SPC 0x82*/{NULL}, + /*SPC 0x83*/{dissect_spc_extcopy}, + /*SPC 0x84*/{NULL}, + /*SPC 0x85*/{NULL}, + /*SPC 0x86*/{NULL}, + /*SPC 0x87*/{NULL}, + /*SPC 0x88*/{NULL}, + /*SPC 0x89*/{NULL}, + /*SPC 0x8a*/{NULL}, + /*SPC 0x8b*/{NULL}, + /*SPC 0x8c*/{NULL}, + /*SPC 0x8d*/{NULL}, + /*SPC 0x8e*/{NULL}, + /*SPC 0x8f*/{NULL}, + /*SPC 0x90*/{NULL}, + /*SPC 0x91*/{NULL}, + /*SPC 0x92*/{NULL}, + /*SPC 0x93*/{NULL}, + /*SPC 0x94*/{NULL}, + /*SPC 0x95*/{NULL}, + /*SPC 0x96*/{NULL}, + /*SPC 0x97*/{NULL}, + /*SPC 0x98*/{NULL}, + /*SPC 0x99*/{NULL}, + /*SPC 0x9a*/{NULL}, + /*SPC 0x9b*/{NULL}, + /*SPC 0x9c*/{NULL}, + /*SPC 0x9d*/{NULL}, + /*SPC 0x9e*/{NULL}, + /*SPC 0x9f*/{NULL}, + /*SPC 0xa0*/{dissect_spc_reportluns}, + /*SPC 0xa1*/{NULL}, + /*SPC 0xa2*/{NULL}, + /*SPC 0xa3*/{dissect_spc_reportdeviceidentifier}, + /*SPC 0xa4*/{NULL}, + /*SPC 0xa5*/{NULL}, + /*SPC 0xa6*/{NULL}, + /*SPC 0xa7*/{NULL}, + /*SPC 0xa8*/{NULL}, + /*SPC 0xa9*/{NULL}, + /*SPC 0xaa*/{NULL}, + /*SPC 0xab*/{NULL}, + /*SPC 0xac*/{NULL}, + /*SPC 0xad*/{NULL}, + /*SPC 0xae*/{NULL}, + /*SPC 0xaf*/{NULL}, + /*SPC 0xb0*/{NULL}, + /*SPC 0xb1*/{NULL}, + /*SPC 0xb2*/{NULL}, + /*SPC 0xb3*/{NULL}, + /*SPC 0xb4*/{NULL}, + /*SPC 0xb5*/{NULL}, + /*SPC 0xb6*/{NULL}, + /*SPC 0xb7*/{NULL}, + /*SPC 0xb8*/{NULL}, + /*SPC 0xb9*/{NULL}, + /*SPC 0xba*/{NULL}, + /*SPC 0xbb*/{NULL}, + /*SPC 0xbc*/{NULL}, + /*SPC 0xbd*/{NULL}, + /*SPC 0xbe*/{NULL}, + /*SPC 0xbf*/{NULL}, + /*SPC 0xc0*/{NULL}, + /*SPC 0xc1*/{NULL}, + /*SPC 0xc2*/{NULL}, + /*SPC 0xc3*/{NULL}, + /*SPC 0xc4*/{NULL}, + /*SPC 0xc5*/{NULL}, + /*SPC 0xc6*/{NULL}, + /*SPC 0xc7*/{NULL}, + /*SPC 0xc8*/{NULL}, + /*SPC 0xc9*/{NULL}, + /*SPC 0xca*/{NULL}, + /*SPC 0xcb*/{NULL}, + /*SPC 0xcc*/{NULL}, + /*SPC 0xcd*/{NULL}, + /*SPC 0xce*/{NULL}, + /*SPC 0xcf*/{NULL}, + /*SPC 0xd0*/{NULL}, + /*SPC 0xd1*/{NULL}, + /*SPC 0xd2*/{NULL}, + /*SPC 0xd3*/{NULL}, + /*SPC 0xd4*/{NULL}, + /*SPC 0xd5*/{NULL}, + /*SPC 0xd6*/{NULL}, + /*SPC 0xd7*/{NULL}, + /*SPC 0xd8*/{NULL}, + /*SPC 0xd9*/{NULL}, + /*SPC 0xda*/{NULL}, + /*SPC 0xdb*/{NULL}, + /*SPC 0xdc*/{NULL}, + /*SPC 0xdd*/{NULL}, + /*SPC 0xde*/{NULL}, + /*SPC 0xdf*/{NULL}, + /*SPC 0xe0*/{NULL}, + /*SPC 0xe1*/{NULL}, + /*SPC 0xe2*/{NULL}, + /*SPC 0xe3*/{NULL}, + /*SPC 0xe4*/{NULL}, + /*SPC 0xe5*/{NULL}, + /*SPC 0xe6*/{NULL}, + /*SPC 0xe7*/{NULL}, + /*SPC 0xe8*/{NULL}, + /*SPC 0xe9*/{NULL}, + /*SPC 0xea*/{NULL}, + /*SPC 0xeb*/{NULL}, + /*SPC 0xec*/{NULL}, + /*SPC 0xed*/{NULL}, + /*SPC 0xee*/{NULL}, + /*SPC 0xef*/{NULL}, + /*SPC 0xf0*/{NULL}, + /*SPC 0xf1*/{NULL}, + /*SPC 0xf2*/{NULL}, + /*SPC 0xf3*/{NULL}, + /*SPC 0xf4*/{NULL}, + /*SPC 0xf5*/{NULL}, + /*SPC 0xf6*/{NULL}, + /*SPC 0xf7*/{NULL}, + /*SPC 0xf8*/{NULL}, + /*SPC 0xf9*/{NULL}, + /*SPC 0xfa*/{NULL}, + /*SPC 0xfb*/{NULL}, + /*SPC 0xfc*/{NULL}, + /*SPC 0xfd*/{NULL}, + /*SPC 0xfe*/{NULL}, + /*SPC 0xff*/{NULL} }; /* This function must be called with valid pointers for both itlq and itl */ void -dissect_scsi_cdb (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - gint devtype_arg _U_, itlq_nexus_t *itlq, itl_nexus_t *itl) +dissect_scsi_cdb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + gint devtype_arg _U_, itlq_nexus_t *itlq, itl_nexus_t *itl) { - int offset = 0; - proto_item *ti; - proto_tree *scsi_tree = NULL; - guint8 opcode; + int offset = 0; + proto_item *ti; + proto_tree *scsi_tree = NULL; + guint8 opcode; #if 0 - scsi_device_type devtype; + scsi_device_type devtype; #endif - const gchar *valstr; + const gchar *valstr; scsi_task_data_t *cdata; - const char *old_proto; - cmdset_t *csdata; + const char *old_proto; + cmdset_t *csdata; - old_proto=pinfo->current_proto; + old_proto = pinfo->current_proto; pinfo->current_proto="SCSI"; - if(!itlq){ + if (!itlq) { DISSECTOR_ASSERT_NOT_REACHED(); } - if(!itl){ + if (!itl) { DISSECTOR_ASSERT_NOT_REACHED(); } - opcode = tvb_get_guint8 (tvb, offset); - itlq->scsi_opcode=opcode; - csdata=get_cmdset_data(itlq, itl); + opcode = tvb_get_guint8(tvb, offset); + itlq->scsi_opcode = opcode; + csdata = get_cmdset_data(itlq, itl); #if 0 /* XXX: devtype never actually used ?? */ if (devtype_arg != SCSI_DEV_UNKNOWN) { @@ -4744,156 +4745,161 @@ dissect_scsi_cdb (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } #endif - if ((valstr = match_strval (opcode, scsi_spc_vals)) == NULL) { + if ((valstr = match_strval(opcode, scsi_spc_vals)) == NULL) { valstr = match_strval(opcode, csdata->cdb_vals); } - if (check_col (pinfo->cinfo, COL_INFO)) { + if (check_col(pinfo->cinfo, COL_INFO)) { if (valstr != NULL) { - col_add_fstr (pinfo->cinfo, COL_INFO, "SCSI: %s LUN: 0x%02x ", valstr, itlq->lun); + col_add_fstr(pinfo->cinfo, COL_INFO, "SCSI: %s LUN: 0x%02x ", valstr, itlq->lun); } else { - col_add_fstr (pinfo->cinfo, COL_INFO, "SCSI Command: 0x%02x LUN:0x%02x ", opcode, itlq->lun); + col_add_fstr(pinfo->cinfo, COL_INFO, "SCSI Command: 0x%02x LUN:0x%02x ", opcode, itlq->lun); } /* make sure no one will overwrite this in the info column */ col_set_fence(pinfo->cinfo, COL_INFO); } cdata = ep_alloc(sizeof(scsi_task_data_t)); - cdata->itl=itl; - cdata->itlq=itlq; - cdata->type=SCSI_PDU_TYPE_CDB; + cdata->itl = itl; + cdata->itlq = itlq; + cdata->type = SCSI_PDU_TYPE_CDB; tap_queue_packet(scsi_tap, pinfo, cdata); if (tree) { - ti = proto_tree_add_protocol_format (tree, proto_scsi, tvb, 0, - -1, "SCSI CDB %s", - val_to_str (opcode, - csdata->cdb_vals, - "0x%02x") - ); - scsi_tree = proto_item_add_subtree (ti, ett_scsi); + ti = proto_tree_add_protocol_format(tree, proto_scsi, tvb, 0, + -1, "SCSI CDB %s", + val_to_str(opcode, + csdata->cdb_vals, + "0x%02x") + ); + scsi_tree = proto_item_add_subtree(ti, ett_scsi); } - ti=proto_tree_add_uint(scsi_tree, hf_scsi_lun, tvb, 0, 0, itlq->lun); + ti = proto_tree_add_uint(scsi_tree, hf_scsi_lun, tvb, 0, 0, itlq->lun); PROTO_ITEM_SET_GENERATED(ti); - if(itl){ - ti=proto_tree_add_uint_format(scsi_tree, hf_scsi_inq_devtype, tvb, 0, 0, itl->cmdset&SCSI_CMDSET_MASK, "Command Set:%s (0x%02x) %s", val_to_str(itl->cmdset&SCSI_CMDSET_MASK, scsi_devtype_val, "Unknown (%d)"), itl->cmdset&SCSI_CMDSET_MASK,itl->cmdset&SCSI_CMDSET_DEFAULT?"(Using default commandset)":""); + if (itl) { + ti = proto_tree_add_uint_format(scsi_tree, hf_scsi_inq_devtype, tvb, 0, 0, itl->cmdset&SCSI_CMDSET_MASK, "Command Set:%s (0x%02x) %s", val_to_str(itl->cmdset&SCSI_CMDSET_MASK, scsi_devtype_val, "Unknown (%d)"), itl->cmdset&SCSI_CMDSET_MASK,itl->cmdset&SCSI_CMDSET_DEFAULT?"(Using default commandset)":""); PROTO_ITEM_SET_GENERATED(ti); } - if(itlq->last_exchange_frame){ - ti=proto_tree_add_uint(scsi_tree, hf_scsi_response_frame, tvb, 0, 0, itlq->last_exchange_frame); + if (itlq->last_exchange_frame) { + ti = proto_tree_add_uint(scsi_tree, hf_scsi_response_frame, tvb, 0, 0, itlq->last_exchange_frame); PROTO_ITEM_SET_GENERATED(ti); } if (valstr != NULL) { - proto_tree_add_uint_format (scsi_tree, csdata->hf_opcode, tvb, - offset, 1, - tvb_get_guint8 (tvb, offset), - "Opcode: %s (0x%02x)", valstr, - opcode); + proto_tree_add_uint_format(scsi_tree, csdata->hf_opcode, tvb, + offset, 1, + tvb_get_guint8(tvb, offset), + "Opcode: %s (0x%02x)", valstr, + opcode); } else { - proto_tree_add_item (scsi_tree, hf_scsi_spcopcode, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(scsi_tree, hf_scsi_spcopcode, tvb, offset, 1, ENC_BIG_ENDIAN); } - if(csdata->cdb_table[opcode].func){ + if (csdata->cdb_table[opcode].func) { csdata->cdb_table[opcode].func(tvb, pinfo, scsi_tree, offset+1, - TRUE, TRUE, 0, cdata); - } else if(spc[opcode].func){ + TRUE, TRUE, 0, cdata); + } else if (spc[opcode].func) { spc[opcode].func(tvb, pinfo, scsi_tree, offset+1, - TRUE, TRUE, 0, cdata); + TRUE, TRUE, 0, cdata); } else { - call_dissector (data_handle, tvb, pinfo, scsi_tree); + call_dissector(data_handle, tvb, pinfo, scsi_tree); } - pinfo->current_proto=old_proto; + pinfo->current_proto = old_proto; } void -dissect_scsi_payload (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - gboolean isreq, itlq_nexus_t *itlq, itl_nexus_t *itl, - guint32 relative_offset) +dissect_scsi_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + gboolean isreq, itlq_nexus_t *itlq, itl_nexus_t *itl, + guint32 relative_offset) { - int offset=0; - proto_item *ti; - proto_tree *scsi_tree = NULL; - guint8 opcode; + int offset = 0; + proto_item *ti; + proto_tree *scsi_tree = NULL; + guint8 opcode; scsi_task_data_t *cdata; - int payload_len; - const char *old_proto; - cmdset_t *csdata; - guint32 expected_length; - fragment_data *ipfd_head; - tvbuff_t *next_tvb=tvb; - gboolean update_col_info = TRUE, more_frags = FALSE; + int payload_len; + const char *old_proto; + cmdset_t *csdata; + guint32 expected_length; + fragment_data *ipfd_head; + tvbuff_t *next_tvb = tvb; + gboolean update_col_info = TRUE; + gboolean more_frags = FALSE; - if(!itlq || !itl){ + if (!itlq || !itl) { /* we have no record of this exchange and so we can't dissect the * payload */ - proto_tree_add_text(tree, tvb, offset, 0, "Unknown SCSI exchange, can not decode SCSI data"); + proto_tree_add_text(tree, tvb, offset, 0, "Unknown SCSI exchange, can not decode SCSI data"); return; } - payload_len=tvb_length(tvb); + payload_len = tvb_length(tvb); cdata = ep_alloc(sizeof(scsi_task_data_t)); - cdata->itl=itl; - cdata->itlq=itlq; - cdata->type=SCSI_PDU_TYPE_CDB; + cdata->itl = itl; + cdata->itlq = itlq; + cdata->type = SCSI_PDU_TYPE_CDB; tap_queue_packet(scsi_tap, pinfo, cdata); - csdata=get_cmdset_data(itlq, itl); + csdata = get_cmdset_data(itlq, itl); - old_proto=pinfo->current_proto; + old_proto = pinfo->current_proto; pinfo->current_proto="SCSI"; opcode = (guint8) cdata->itlq->scsi_opcode; if (tree) { - ti = proto_tree_add_protocol_format (tree, proto_scsi, tvb, offset, - payload_len, - "SCSI Payload (%s %s)", - val_to_str (opcode, - csdata->cdb_vals, - "CDB:0x%02x"), - isreq ? "Request Data" : "Response Data"); - scsi_tree = proto_item_add_subtree (ti, ett_scsi); + ti = proto_tree_add_protocol_format(tree, proto_scsi, tvb, offset, + payload_len, + "SCSI Payload (%s %s)", + val_to_str(opcode, + csdata->cdb_vals, + "CDB:0x%02x"), + isreq ? "Request Data" : "Response Data"); + scsi_tree = proto_item_add_subtree(ti, ett_scsi); } - if (check_col (pinfo->cinfo, COL_INFO)) { - col_add_fstr (pinfo->cinfo, COL_INFO, - "SCSI: Data %s LUN: 0x%02x (%s %s) ", - isreq ? "Out" : "In", - itlq->lun, - val_to_str (opcode, csdata->cdb_vals, "0x%02x"), - isreq ? "Request Data" : "Response Data"); + if (check_col(pinfo->cinfo, COL_INFO)) { + col_add_fstr(pinfo->cinfo, COL_INFO, + "SCSI: Data %s LUN: 0x%02x (%s %s) ", + isreq ? "Out" : "In", + itlq->lun, + val_to_str(opcode, csdata->cdb_vals, "0x%02x"), + isreq ? "Request Data" : "Response Data"); col_set_fence(pinfo->cinfo, COL_INFO); } - ti=proto_tree_add_uint(scsi_tree, hf_scsi_lun, tvb, 0, 0, itlq->lun); + ti = proto_tree_add_uint(scsi_tree, hf_scsi_lun, tvb, 0, 0, itlq->lun); PROTO_ITEM_SET_GENERATED(ti); - if(itl){ - ti=proto_tree_add_uint_format(scsi_tree, hf_scsi_inq_devtype, tvb, 0, 0, itl->cmdset&SCSI_CMDSET_MASK, "Command Set:%s (0x%02x) %s", val_to_str(itl->cmdset&SCSI_CMDSET_MASK, scsi_devtype_val, "Unknown (%d)"), itl->cmdset&SCSI_CMDSET_MASK,itl->cmdset&SCSI_CMDSET_DEFAULT?"(Using default commandset)":""); + if (itl) { + ti = proto_tree_add_uint_format(scsi_tree, hf_scsi_inq_devtype, tvb, 0, 0, itl->cmdset&SCSI_CMDSET_MASK, + "Command Set:%s (0x%02x) %s", + val_to_str(itl->cmdset&SCSI_CMDSET_MASK, scsi_devtype_val, "Unknown (%d)"), + itl->cmdset&SCSI_CMDSET_MASK, + itl->cmdset&SCSI_CMDSET_DEFAULT ? "(Using default commandset)" : ""); PROTO_ITEM_SET_GENERATED(ti); - if(itlq && itlq->scsi_opcode!=0xffff){ - ti=proto_tree_add_uint(scsi_tree, csdata->hf_opcode, tvb, 0, 0, itlq->scsi_opcode); + if (itlq && (itlq->scsi_opcode != 0xffff)) { + ti = proto_tree_add_uint(scsi_tree, csdata->hf_opcode, tvb, 0, 0, itlq->scsi_opcode); PROTO_ITEM_SET_GENERATED(ti); } } - if(itlq->first_exchange_frame){ - ti=proto_tree_add_uint(scsi_tree, hf_scsi_request_frame, tvb, 0, 0, itlq->first_exchange_frame); + if (itlq->first_exchange_frame) { + ti = proto_tree_add_uint(scsi_tree, hf_scsi_request_frame, tvb, 0, 0, itlq->first_exchange_frame); PROTO_ITEM_SET_GENERATED(ti); } - if(itlq->last_exchange_frame){ - ti=proto_tree_add_uint(scsi_tree, hf_scsi_response_frame, tvb, 0, 0, itlq->last_exchange_frame); + if (itlq->last_exchange_frame) { + ti = proto_tree_add_uint(scsi_tree, hf_scsi_response_frame, tvb, 0, 0, itlq->last_exchange_frame); PROTO_ITEM_SET_GENERATED(ti); } @@ -4901,8 +4907,8 @@ dissect_scsi_payload (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* If we dont know the CDB opcode there is no point in trying to * dissect the data. */ - if( !itlq->first_exchange_frame ){ - call_dissector (data_handle, tvb, pinfo, scsi_tree); + if ( !itlq->first_exchange_frame ) { + call_dissector(data_handle, tvb, pinfo, scsi_tree); goto end_of_payload; } @@ -4911,7 +4917,7 @@ dissect_scsi_payload (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, */ if (!scsi_defragment) { if (relative_offset) { - call_dissector (data_handle, tvb, pinfo, scsi_tree); + call_dissector(data_handle, tvb, pinfo, scsi_tree); goto end_of_payload; } else { goto dissect_the_payload; @@ -4921,9 +4927,9 @@ dissect_scsi_payload (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* If we dont have the entire PDU there is no point in even trying * reassembly */ - if(tvb_length_remaining(tvb, offset)!=tvb_reported_length_remaining(tvb, offset)){ + if (tvb_length_remaining(tvb, offset) != tvb_reported_length_remaining(tvb, offset)) { if (relative_offset) { - call_dissector (data_handle, tvb, pinfo, scsi_tree); + call_dissector(data_handle, tvb, pinfo, scsi_tree); goto end_of_payload; } else { goto dissect_the_payload; @@ -4932,22 +4938,22 @@ dissect_scsi_payload (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* What is the expected data length for this transfer */ - if( (itlq->task_flags&(SCSI_DATA_READ|SCSI_DATA_WRITE))==(SCSI_DATA_READ|SCSI_DATA_WRITE) ){ + if ( (itlq->task_flags&(SCSI_DATA_READ|SCSI_DATA_WRITE)) == (SCSI_DATA_READ|SCSI_DATA_WRITE) ) { /* This is a bidirectional transfer */ - if(isreq){ - expected_length=itlq->data_length; + if (isreq) { + expected_length = itlq->data_length; } else { - expected_length=itlq->bidir_data_length; + expected_length = itlq->bidir_data_length; } } else { /* This is a unidirectional transfer */ - expected_length=itlq->data_length; + expected_length = itlq->data_length; } /* If this PDU already contains all the expected data we dont have to do * reassembly. */ - if( (!relative_offset) && ((guint32)tvb_length_remaining(tvb, offset) == expected_length) ){ + if ( (!relative_offset) && ((guint32)tvb_length_remaining(tvb, offset) == expected_length) ) { goto dissect_the_payload; } @@ -4961,24 +4967,24 @@ dissect_scsi_payload (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, more_frags = TRUE; } ipfd_head = fragment_add_check(tvb, offset, pinfo, - itlq->first_exchange_frame, /* key */ - scsi_fragment_table, - scsi_reassembled_table, - relative_offset, - tvb_length_remaining(tvb, offset), - more_frags); + itlq->first_exchange_frame, /* key */ + scsi_fragment_table, + scsi_reassembled_table, + relative_offset, + tvb_length_remaining(tvb, offset), + more_frags); next_tvb = process_reassembled_data(tvb, offset, pinfo, "Reassembled SCSI DATA", ipfd_head, &scsi_frag_items, &update_col_info, tree); - if( ipfd_head && ipfd_head->reassembled_in != pinfo->fd->num ){ + if ( ipfd_head && (ipfd_head->reassembled_in != pinfo->fd->num) ) { if (check_col(pinfo->cinfo, COL_INFO)) { col_prepend_fstr(pinfo->cinfo, COL_INFO, "[Reassembled in #%u] ", - ipfd_head->reassembled_in); + ipfd_head->reassembled_in); } } dissect_the_payload: - if(!next_tvb){ + if (!next_tvb) { /* reassembly has not yet finished so we dont have a tvb yet */ goto end_of_payload; } @@ -4994,80 +5000,80 @@ dissect_the_payload: * commandset used. */ if (opcode == SCSI_SPC_INQUIRY) { - dissect_spc_inquiry (next_tvb, pinfo, scsi_tree, offset, isreq, - FALSE, payload_len, cdata); + dissect_spc_inquiry(next_tvb, pinfo, scsi_tree, offset, isreq, + FALSE, payload_len, cdata); } } else { /* - All commandsets support SPC? + All commandsets support SPC? */ - if(csdata->cdb_table && (csdata->cdb_table)[opcode].func){ + if (csdata->cdb_table && (csdata->cdb_table)[opcode].func) { (csdata->cdb_table)[opcode].func(next_tvb, pinfo, scsi_tree, offset, - isreq, FALSE, payload_len, cdata); - } else if(spc[opcode].func){ + isreq, FALSE, payload_len, cdata); + } else if (spc[opcode].func) { spc[opcode].func(next_tvb, pinfo, scsi_tree, offset, - isreq, FALSE, payload_len, cdata); + isreq, FALSE, payload_len, cdata); } else { /* dont know this CDB */ - call_dissector (data_handle, next_tvb, pinfo, scsi_tree); + call_dissector(data_handle, next_tvb, pinfo, scsi_tree); } } end_of_payload: - pinfo->current_proto=old_proto; + pinfo->current_proto = old_proto; } static cmdset_t * get_cmdset_data(itlq_nexus_t *itlq, itl_nexus_t *itl) { cmdset_t *csdata; - guint8 cmdset; + guint8 cmdset; /* we must have an itlq structure */ - if(!itlq){ + if (!itlq) { DISSECTOR_ASSERT_NOT_REACHED(); } - if(itl){ - if(itl->cmdset==0xff){ - itl->cmdset=scsi_def_devtype|SCSI_CMDSET_DEFAULT; + if (itl) { + if (itl->cmdset == 0xff) { + itl->cmdset = scsi_def_devtype|SCSI_CMDSET_DEFAULT; } - cmdset=itl->cmdset; + cmdset = itl->cmdset; } else { - cmdset=scsi_def_devtype; + cmdset = scsi_def_devtype; } - csdata=ep_alloc(sizeof(cmdset_t)); + csdata = ep_alloc(sizeof(cmdset_t)); - switch(cmdset&SCSI_CMDSET_MASK){ + switch(cmdset&SCSI_CMDSET_MASK) { case SCSI_DEV_SBC: - csdata->hf_opcode=hf_scsi_sbc_opcode; - csdata->cdb_vals=scsi_sbc_vals; - csdata->cdb_table=scsi_sbc_table; + csdata->hf_opcode = hf_scsi_sbc_opcode; + csdata->cdb_vals = scsi_sbc_vals; + csdata->cdb_table = scsi_sbc_table; break; case SCSI_DEV_CDROM: - csdata->hf_opcode=hf_scsi_mmc_opcode; - csdata->cdb_vals=scsi_mmc_vals; - csdata->cdb_table=scsi_mmc_table; + csdata->hf_opcode = hf_scsi_mmc_opcode; + csdata->cdb_vals = scsi_mmc_vals; + csdata->cdb_table = scsi_mmc_table; break; case SCSI_DEV_SSC: - csdata->hf_opcode=hf_scsi_ssc_opcode; - csdata->cdb_vals=scsi_ssc_vals; - csdata->cdb_table=scsi_ssc_table; + csdata->hf_opcode = hf_scsi_ssc_opcode; + csdata->cdb_vals = scsi_ssc_vals; + csdata->cdb_table = scsi_ssc_table; break; case SCSI_DEV_SMC: - csdata->hf_opcode=hf_scsi_smc_opcode; - csdata->cdb_vals=scsi_smc_vals; - csdata->cdb_table=scsi_smc_table; + csdata->hf_opcode = hf_scsi_smc_opcode; + csdata->cdb_vals = scsi_smc_vals; + csdata->cdb_table = scsi_smc_table; break; case SCSI_DEV_OSD: - csdata->hf_opcode=hf_scsi_osd_opcode; - csdata->cdb_vals=scsi_osd_vals; - csdata->cdb_table=scsi_osd_table; + csdata->hf_opcode = hf_scsi_osd_opcode; + csdata->cdb_vals = scsi_osd_vals; + csdata->cdb_table = scsi_osd_table; break; default: - csdata->hf_opcode=hf_scsi_spcopcode; - csdata->cdb_vals=scsi_spc_vals; - csdata->cdb_table=spc; + csdata->hf_opcode = hf_scsi_spcopcode; + csdata->cdb_vals = scsi_spc_vals; + csdata->cdb_table = spc; break; } @@ -5076,21 +5082,20 @@ get_cmdset_data(itlq_nexus_t *itlq, itl_nexus_t *itl) void -proto_register_scsi (void) +proto_register_scsi(void) { - /* Setup list of header fields See Section 1.6.1 for details*/ static hf_register_info hf[] = { - /*16 bit to print something useful for weirdo - volume set addressing hosts*/ + /* 16 bit to print something useful for weirdo + volume set addressing hosts */ { &hf_scsi_lun, {"LUN", "scsi.lun", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}}, { &hf_scsi_status, { "Status", "scsi.status", FT_UINT8, BASE_HEX, - VALS(scsi_status_val), 0, "SCSI command status value", HFILL }}, + VALS(scsi_status_val), 0, "SCSI command status value", HFILL }}, { &hf_scsi_spcopcode, {"SPC-2 Opcode", "scsi.spc.opcode", FT_UINT8, BASE_HEX, - VALS (scsi_spc_vals), 0x0, NULL, HFILL}}, + VALS(scsi_spc_vals), 0x0, NULL, HFILL}}, { &hf_scsi_control, {"Control", "scsi.cdb.control", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}}, @@ -5117,7 +5122,7 @@ proto_register_scsi (void) HFILL}}, { &hf_scsi_inquiry_evpd_page, {"EVPD Page Code", "scsi.inquiry.evpd.pagecode", FT_UINT8, BASE_HEX, - VALS (scsi_evpd_pagecode_val), 0x0, NULL, HFILL}}, + VALS(scsi_evpd_pagecode_val), 0x0, NULL, HFILL}}, { &hf_scsi_inquiry_cmdt_page, {"CMDT Page Code", "scsi.inquiry.cmdt.pagecode", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}}, @@ -5129,10 +5134,10 @@ proto_register_scsi (void) 0x0, NULL, HFILL}}, { &hf_scsi_log_pc, {"Page Control", "scsi.log.pc", FT_UINT8, BASE_DEC, - VALS (scsi_log_pc_val), 0xC0, NULL, HFILL}}, + VALS(scsi_log_pc_val), 0xC0, NULL, HFILL}}, { &hf_scsi_log_pagecode, {"Page Code", "scsi.log.pagecode", FT_UINT8, BASE_HEX, - VALS (scsi_log_page_val), 0x3F, NULL, HFILL}}, + VALS(scsi_log_page_val), 0x3F, NULL, HFILL}}, { &hf_scsi_paramlen16, {"Parameter Length", "scsi.cdb.paramlen16", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}}, @@ -5144,46 +5149,46 @@ proto_register_scsi (void) NULL, 0x0, NULL, HFILL}}, { &hf_scsi_modesns_pc, {"Page Control", "scsi.mode.pc", FT_UINT8, BASE_DEC, - VALS (scsi_modesns_pc_val), 0xC0, NULL, HFILL}}, + VALS(scsi_modesns_pc_val), 0xC0, NULL, HFILL}}, { &hf_scsi_spcpagecode, {"SPC-2 Page Code", "scsi.mode.spc.pagecode", FT_UINT8, BASE_HEX, - VALS (scsi_spc_modepage_val), 0x3F, NULL, HFILL}}, + VALS(scsi_spc_modepage_val), 0x3F, NULL, HFILL}}, { &hf_scsi_sbcpagecode, {"SBC-2 Page Code", "scsi.mode.sbc.pagecode", FT_UINT8, BASE_HEX, - VALS (scsi_sbc_modepage_val), 0x3F, NULL, HFILL}}, + VALS(scsi_sbc_modepage_val), 0x3F, NULL, HFILL}}, { &hf_scsi_sscpagecode, {"SSC-2 Page Code", "scsi.mode.ssc.pagecode", FT_UINT8, BASE_HEX, - VALS (scsi_ssc2_modepage_val), 0x3F, NULL, HFILL}}, + VALS(scsi_ssc2_modepage_val), 0x3F, NULL, HFILL}}, { &hf_scsi_mmcpagecode, {"MMC-5 Page Code", "scsi.mode.mmc.pagecode", FT_UINT8, BASE_HEX, - VALS (scsi_mmc5_modepage_val), 0x3F, NULL, HFILL}}, + VALS(scsi_mmc5_modepage_val), 0x3F, NULL, HFILL}}, { &hf_scsi_smcpagecode, {"SMC-2 Page Code", "scsi.mode.smc.pagecode", FT_UINT8, BASE_HEX, - VALS (scsi_smc_modepage_val), 0x3F, NULL, HFILL}}, + VALS(scsi_smc_modepage_val), 0x3F, NULL, HFILL}}, { &hf_scsi_modesns_flags, {"Mode Sense Flags", "scsi.mode.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}}, { &hf_scsi_persresvin_svcaction, {"Service Action", "scsi.persresvin.svcaction", FT_UINT8, BASE_HEX, - VALS (scsi_persresvin_svcaction_val), 0x0F, NULL, HFILL}}, + VALS(scsi_persresvin_svcaction_val), 0x0F, NULL, HFILL}}, { &hf_scsi_persresvout_svcaction, {"Service Action", "scsi.persresvout.svcaction", FT_UINT8, BASE_HEX, - VALS (scsi_persresvout_svcaction_val), 0x0F, NULL, HFILL}}, + VALS(scsi_persresvout_svcaction_val), 0x0F, NULL, HFILL}}, { &hf_scsi_persresv_scope, {"Reservation Scope", "scsi.persresv.scope", FT_UINT8, BASE_HEX, - VALS (scsi_persresv_scope_val), 0xF0, NULL, HFILL}}, + VALS(scsi_persresv_scope_val), 0xF0, NULL, HFILL}}, { &hf_scsi_persresv_type, {"Reservation Type", "scsi.persresv.type", FT_UINT8, BASE_HEX, - VALS (scsi_persresv_type_val), 0x0F, NULL, HFILL}}, + VALS(scsi_persresv_type_val), 0x0F, NULL, HFILL}}, { &hf_scsi_persresvout_reskey, {"Reservation Key", "scsi.persresv.reskey", FT_BYTES, BASE_NONE, - NULL, 0x0, NULL, HFILL}}, + NULL, 0x0, NULL, HFILL}}, { &hf_scsi_persresvout_sareskey, {"Service Action Reservation Key", "scsi.persresv.sareskey", FT_BYTES, - BASE_NONE, NULL, 0x0, NULL, HFILL}}, + BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_scsi_persresvout_obsolete, {"Obsolete", "scsi.presresv.obs", FT_BYTES, BASE_NONE, NULL, 0x0, - NULL, HFILL}}, + NULL, HFILL}}, { &hf_scsi_persresvout_control, {"Control", "scsi.presresv.control", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}}, @@ -5192,19 +5197,19 @@ proto_register_scsi (void) NULL, 0xFC, NULL, HFILL}}, { &hf_scsi_persresv_control_rsvd1, {"Reserved", "scsi.persresv.control.reserved1", FT_UINT8, BASE_HEX, - NULL, 0xF0, NULL, HFILL}}, + NULL, 0xF0, NULL, HFILL}}, { &hf_scsi_persresv_control_rsvd2, {"Reserved", "scsi.persresv.control.reserved2", FT_UINT8, BASE_HEX, - NULL, 0x02, NULL, HFILL}}, + NULL, 0x02, NULL, HFILL}}, { &hf_scsi_persresv_control_spec_i_pt, {"SPEC_I_PT", "scsi.persresv.control.spec_i_pt", FT_BOOLEAN, 8, - TFS(&scsi_spec_i_pt_tfs), 0x08, NULL, HFILL}}, + TFS(&scsi_spec_i_pt_tfs), 0x08, NULL, HFILL}}, { &hf_scsi_persresv_control_all_tg_pt, {"ALL_TG_PT", "scsi.persresv.control.all_tg_pt", FT_BOOLEAN, 8, - TFS(&scsi_all_tg_pt_tfs), 0x04, NULL, HFILL}}, + TFS(&scsi_all_tg_pt_tfs), 0x04, NULL, HFILL}}, { &hf_scsi_persresv_control_aptpl, {"aptpl", "scsi.persresv.control.aptpl", FT_BOOLEAN, 8, - TFS(&scsi_aptpl_tfs), 0x01, NULL, HFILL}}, + TFS(&scsi_aptpl_tfs), 0x01, NULL, HFILL}}, { &hf_scsi_release_flags, {"Release Flags", "scsi.release.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}}, @@ -5219,7 +5224,7 @@ proto_register_scsi (void) NULL, 0, NULL, HFILL}}, { &hf_scsi_inq_qualifier, {"Qualifier", "scsi.inquiry.qualifier", FT_UINT8, BASE_HEX, - VALS (scsi_qualifier_val), 0xE0, NULL, HFILL}}, + VALS(scsi_qualifier_val), 0xE0, NULL, HFILL}}, { &hf_scsi_inq_peripheral, {"Peripheral", "scsi.inquiry.peripheral", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL}}, @@ -5243,13 +5248,13 @@ proto_register_scsi (void) &scsi_verdesc_val_ext, 0, NULL, HFILL}}, { &hf_scsi_inq_devtype, {"Device Type", "scsi.inquiry.devtype", FT_UINT8, BASE_HEX, - VALS (scsi_devtype_val), SCSI_DEV_BITS, NULL, HFILL}}, + VALS(scsi_devtype_val), SCSI_DEV_BITS, NULL, HFILL}}, { &hf_scsi_inq_rmb, {"Removable", "scsi.inquiry.removable", FT_BOOLEAN, 8, - TFS (&scsi_removable_val), 0x80, NULL, HFILL}}, + TFS(&scsi_removable_val), 0x80, NULL, HFILL}}, { & hf_scsi_inq_version, {"Version", "scsi.inquiry.version", FT_UINT8, BASE_HEX, - VALS (scsi_inquiry_vers_val), 0x0, NULL, HFILL}}, + VALS(scsi_inquiry_vers_val), 0x0, NULL, HFILL}}, { &hf_scsi_inq_reladrflags, {"Inquiry RelAdr Flags", "scsi.inquiry.reladrflags", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL}}, @@ -5342,31 +5347,31 @@ proto_register_scsi (void) 0x0, NULL, HFILL}}, { &hf_scsi_modesns_errrep, {"MRIE", "scsi.mode.mrie", FT_UINT8, BASE_HEX, - VALS (scsi_modesns_mrie_val), 0x0F, NULL, HFILL}}, + VALS(scsi_modesns_mrie_val), 0x0F, NULL, HFILL}}, { &hf_scsi_modesns_tst, {"Task Set Type", "scsi.mode.tst", FT_UINT8, BASE_DEC, - VALS (scsi_modesns_tst_val), 0xE0, NULL, HFILL}}, + VALS(scsi_modesns_tst_val), 0xE0, NULL, HFILL}}, { &hf_scsi_modesns_qmod, {"Queue Algorithm Modifier", "scsi.mode.qmod", FT_UINT8, BASE_HEX, - VALS (scsi_modesns_qmod_val), 0xF0, NULL, HFILL}}, + VALS(scsi_modesns_qmod_val), 0xF0, NULL, HFILL}}, { &hf_scsi_modesns_qerr, {"Queue Error Management", "scsi.mode.qerr", FT_BOOLEAN, 8, - TFS (&scsi_modesns_qerr_val), 0x2, NULL, HFILL}}, + TFS(&scsi_modesns_qerr_val), 0x2, NULL, HFILL}}, { &hf_scsi_modesns_tas, {"Task Aborted Status", "scsi.mode.tac", FT_BOOLEAN, 8, - TFS (&scsi_modesns_tas_val), 0x80, NULL, HFILL}}, + TFS(&scsi_modesns_tas_val), 0x80, NULL, HFILL}}, { &hf_scsi_modesns_rac, {"Report a Check", "scsi.mode.rac", FT_BOOLEAN, 8, - TFS (&scsi_modesns_rac_val), 0x40, NULL, HFILL}}, + TFS(&scsi_modesns_rac_val), 0x40, NULL, HFILL}}, { &hf_scsi_protocol, - {"Protocol", "scsi.proto", FT_UINT8, BASE_DEC, VALS (scsi_proto_val), + {"Protocol", "scsi.proto", FT_UINT8, BASE_DEC, VALS(scsi_proto_val), 0x0F, NULL, HFILL}}, { &hf_scsi_sns_errtype, {"SNS Error Type", "scsi.sns.errtype", FT_UINT8, BASE_HEX, - VALS (scsi_sns_errtype_val), 0x7F, NULL, HFILL}}, + VALS(scsi_sns_errtype_val), 0x7F, NULL, HFILL}}, { &hf_scsi_snskey, {"Sense Key", "scsi.sns.key", FT_UINT8, BASE_HEX, - VALS (scsi_sensekey_val), 0x0F, NULL, HFILL}}, + VALS(scsi_sensekey_val), 0x0F, NULL, HFILL}}, { &hf_scsi_snsinfo, {"Sense Info", "scsi.sns.info", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}}, @@ -5402,7 +5407,7 @@ proto_register_scsi (void) 0x0, NULL, HFILL}}, { &hf_scsi_wb_mode, {"Mode", "scsi.spc.wb.mode", FT_UINT8, BASE_HEX, - VALS (scsi_wb_mode_val), 0xF, NULL, HFILL}}, + VALS(scsi_wb_mode_val), 0xF, NULL, HFILL}}, { &hf_scsi_wb_bufferid, {"Buffer ID", "scsi.spc.sb.bufid", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}}, @@ -5414,13 +5419,13 @@ proto_register_scsi (void) NULL, 0x0, NULL, HFILL}}, { &hf_scsi_senddiag_st_code, {"Self-Test Code", "scsi.spc.senddiag.code", FT_UINT8, BASE_HEX, - VALS (scsi_senddiag_st_code_val), 0xE0, NULL, HFILL}}, + VALS(scsi_senddiag_st_code_val), 0xE0, NULL, HFILL}}, { &hf_scsi_select_report, {"Select Report", "scsi.spc.select_report", FT_UINT8, BASE_HEX, - VALS (scsi_select_report_val), 0x00, NULL, HFILL}}, + VALS(scsi_select_report_val), 0x00, NULL, HFILL}}, { &hf_scsi_senddiag_pf, {"PF", "scsi.spc.senddiag.pf", FT_BOOLEAN, 8, - TFS (&scsi_senddiag_pf_val), 0x10, NULL, HFILL}}, + TFS(&scsi_senddiag_pf_val), 0x10, NULL, HFILL}}, { &hf_scsi_senddiag_st, {"Self Test", "scsi.spc.senddiag.st", FT_BOOLEAN, 8, NULL, 0x4, NULL, HFILL}}, @@ -5432,55 +5437,55 @@ proto_register_scsi (void) NULL, 0x1, NULL, HFILL}}, { &hf_scsi_request_frame, { "Request in", "scsi.request_frame", FT_FRAMENUM, BASE_NONE, NULL, 0, - "The request to this transaction is in this frame", HFILL }}, + "The request to this transaction is in this frame", HFILL }}, { &hf_scsi_time, { "Time from request", "scsi.time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0, - "Time between the Command and the Response", HFILL }}, + "Time between the Command and the Response", HFILL }}, { &hf_scsi_response_frame, { "Response in", "scsi.response_frame", FT_FRAMENUM, BASE_NONE, NULL, 0, - "The response to this transaction is in this frame", HFILL }}, + "The response to this transaction is in this frame", HFILL }}, { &hf_scsi_fragments, { "SCSI Fragments", "scsi.fragments", FT_NONE, BASE_NONE, NULL, 0x0, - NULL, HFILL }}, + NULL, HFILL }}, { &hf_scsi_fragment_overlap, { "Fragment overlap", "scsi.fragment.overlap", FT_BOOLEAN, BASE_NONE, NULL, 0x0, - "Fragment overlaps with other fragments", HFILL }}, + "Fragment overlaps with other fragments", HFILL }}, { &hf_scsi_fragment_overlap_conflict, { "Conflicting data in fragment overlap", "scsi.fragment.overlap.conflict", FT_BOOLEAN, BASE_NONE, NULL, 0x0, - "Overlapping fragments contained conflicting data", HFILL }}, + "Overlapping fragments contained conflicting data", HFILL }}, { &hf_scsi_fragment_multiple_tails, { "Multiple tail fragments found", "scsi.fragment.multipletails", FT_BOOLEAN, BASE_NONE, NULL, 0x0, - "Several tails were found when defragmenting the packet", HFILL }}, + "Several tails were found when defragmenting the packet", HFILL }}, { &hf_scsi_fragment_too_long_fragment, { "Fragment too long", "scsi.fragment.toolongfragment", FT_BOOLEAN, BASE_NONE, NULL, 0x0, - "Fragment contained data past end of packet", HFILL }}, + "Fragment contained data past end of packet", HFILL }}, { &hf_scsi_fragment_error, { "Defragmentation error", "scsi.fragment.error", FT_FRAMENUM, BASE_NONE, NULL, 0x0, - "Defragmentation error due to illegal fragments", HFILL }}, + "Defragmentation error due to illegal fragments", HFILL }}, { &hf_scsi_fragment_count, { "Fragment count", "scsi.fragment.count", FT_UINT32, BASE_DEC, NULL, 0x0, - NULL, HFILL }}, + NULL, HFILL }}, { &hf_scsi_fragment, { "SCSI DATA Fragment", "scsi.fragment", FT_FRAMENUM, BASE_NONE, NULL, 0x0, - NULL, HFILL }}, + NULL, HFILL }}, { &hf_scsi_reassembled_in, { "Reassembled SCSI DATA in frame", "scsi.reassembled_in", FT_FRAMENUM, BASE_NONE, NULL, 0x0, - "This SCSI DATA packet is reassembled in this frame", HFILL }}, + "This SCSI DATA packet is reassembled in this frame", HFILL }}, { &hf_scsi_reassembled_length, { "Reassembled SCSI DATA length", "scsi.reassembled.length", FT_UINT32, BASE_DEC, NULL, 0x0, - "The total length of the reassembled payload", HFILL }}, + "The total length of the reassembled payload", HFILL }}, { &hf_scsi_log_ppc_flags, {"PPC Flags", "scsi.log.ppc.flags", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL}}, { &hf_scsi_log_ppc, {"PPC", "scsi.log.ppc", FT_BOOLEAN, 8, - TFS (&scsi_log_ppc_tfs), 0x02, NULL, HFILL}}, + TFS(&scsi_log_ppc_tfs), 0x02, NULL, HFILL}}, { &hf_scsi_log_pcr, {"PCR", "scsi.log.pcr", FT_BOOLEAN, 8, - TFS (&scsi_log_pcr_tfs), 0x02, NULL, HFILL}}, + TFS(&scsi_log_pcr_tfs), 0x02, NULL, HFILL}}, { &hf_scsi_log_sp, {"SP", "scsi.log.sp", FT_BOOLEAN, 8, - TFS (&scsi_log_sp_tfs), 0x01, NULL, HFILL}}, + TFS(&scsi_log_sp_tfs), 0x01, NULL, HFILL}}, { &hf_scsi_log_pc_flags, {"PC Flags", "scsi.log.pc.flags", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL}}, @@ -5697,40 +5702,40 @@ proto_register_scsi (void) { &hf_scsi_sbc_ptype, {"Provisioning Type", "scsi.sbc.ptype", FT_UINT8, BASE_DEC, VALS(provisioning_vals), 0x07, NULL, HFILL}}, - { &hf_scsi_block_limits_wsnz, + { &hf_scsi_block_limits_wsnz, {"WSNZ", "scsi.sbc.bl.wsnz", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL}}, - { &hf_scsi_block_limits_mcawl, + { &hf_scsi_block_limits_mcawl, {"Maximum Compare And Write Length", "scsi.sbc.bl.mcawl", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL}}, - { &hf_scsi_block_limits_otlg, + { &hf_scsi_block_limits_otlg, {"Optimal Transfer Length Granularity", "scsi.sbc.bl.otlg", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL}}, - { &hf_scsi_block_limits_mtl, + { &hf_scsi_block_limits_mtl, {"Maximum Transfer Length", "scsi.sbc.bl.mtl", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL}}, - { &hf_scsi_block_limits_otl, + { &hf_scsi_block_limits_otl, {"Optimal Transfer Length", "scsi.sbc.bl.otl", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL}}, - { &hf_scsi_block_limits_mpl, + { &hf_scsi_block_limits_mpl, {"Optimal Prefetch/Xdread/Xdwrite Transfer Length", "scsi.sbc.bl.mpl", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL}}, - { &hf_scsi_block_limits_mulc, + { &hf_scsi_block_limits_mulc, {"Maximum Unmap LBA Count", "scsi.sbc.bl.mulc", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL}}, - { &hf_scsi_block_limits_mubdc, + { &hf_scsi_block_limits_mubdc, {"Maximum Unmap Block Descriptor Count", "scsi.sbc.bl.mubdc", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL}}, - { &hf_scsi_block_limits_oug, + { &hf_scsi_block_limits_oug, {"Optimal Unmap Block Granularity", "scsi.sbc.bl.oug", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL}}, - { &hf_scsi_block_limits_ugavalid, + { &hf_scsi_block_limits_ugavalid, {"UGAVALID", "scsi.sbc.bl.ugavalid", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL}}, - { &hf_scsi_block_limits_uga, + { &hf_scsi_block_limits_uga, {"Unmap Granularity Alignment", "scsi.sbc.bl.uga", FT_UINT32, BASE_DEC, NULL, 0x7fffffff, NULL, HFILL}}, - { &hf_scsi_block_limits_mwsl, + { &hf_scsi_block_limits_mwsl, {"Maximum Write Same Length", "scsi.sbc.bl.mwsl", FT_UINT64, BASE_DEC, NULL, 0, NULL, HFILL}}, }; @@ -5765,24 +5770,24 @@ proto_register_scsi (void) proto_register_subtree_array(ett, array_length(ett)); /* add preferences to decode SCSI message */ - scsi_module = prefs_register_protocol (proto_scsi, NULL); - prefs_register_enum_preference (scsi_module, "decode_scsi_messages_as", - "Decode SCSI Messages As", - "When Target Cannot Be Identified, Decode SCSI Messages As", - &scsi_def_devtype, - scsi_devtype_options, - FALSE); + scsi_module = prefs_register_protocol(proto_scsi, NULL); + prefs_register_enum_preference(scsi_module, "decode_scsi_messages_as", + "Decode SCSI Messages As", + "When Target Cannot Be Identified, Decode SCSI Messages As", + &scsi_def_devtype, + scsi_devtype_options, + FALSE); prefs_register_bool_preference(scsi_module, "defragment", - "Reassemble fragmented SCSI DATA IN/OUT transfers", - "Whether fragmented SCSI DATA IN/OUT transfers should be reassembled", - &scsi_defragment); + "Reassemble fragmented SCSI DATA IN/OUT transfers", + "Whether fragmented SCSI DATA IN/OUT transfers should be reassembled", + &scsi_defragment); register_init_routine(scsi_defragment_init); } void proto_reg_handoff_scsi(void) { - scsi_tap = register_tap("scsi"); - data_handle = find_dissector ("data"); + scsi_tap = register_tap("scsi"); + data_handle = find_dissector("data"); } diff --git a/epan/dissectors/packet-smpp.c b/epan/dissectors/packet-smpp.c index 175985c7ac..f00cf767ca 100644 --- a/epan/dissectors/packet-smpp.c +++ b/epan/dissectors/packet-smpp.c @@ -15,7 +15,7 @@ * introduced by Abhik Sarkar * * Support for Huawei SMPP+ extensions - * introduced by Xu Bo and enhance by Abhik Sarkar + * introduced by Xu Bo and enhanced by Abhik Sarkar * * Enhanced error code handling * provided by Stipe Tolj from Kannel. @@ -42,6 +42,7 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * * ---------- * * Dissector of an SMPP (Short Message Peer to Peer) PDU, as defined by the @@ -53,8 +54,6 @@ # include "config.h" #endif -#include -#include #include #include @@ -95,182 +94,182 @@ static void dissect_smpp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree * * Fixed header section */ -static int proto_smpp = -1; +static int proto_smpp = -1; -static int st_smpp_ops = -1; -static int st_smpp_req = -1; -static int st_smpp_res = -1; -static int st_smpp_res_status = -1; +static int st_smpp_ops = -1; +static int st_smpp_req = -1; +static int st_smpp_res = -1; +static int st_smpp_res_status = -1; -static int hf_smpp_command_id = -1; -static int hf_smpp_command_length = -1; -static int hf_smpp_command_status = -1; -static int hf_smpp_sequence_number = -1; +static int hf_smpp_command_id = -1; +static int hf_smpp_command_length = -1; +static int hf_smpp_command_status = -1; +static int hf_smpp_sequence_number = -1; /* * Fixed body section */ -static int hf_smpp_system_id = -1; -static int hf_smpp_password = -1; -static int hf_smpp_system_type = -1; -static int hf_smpp_interface_version = -1; -static int hf_smpp_addr_ton = -1; -static int hf_smpp_addr_npi = -1; -static int hf_smpp_address_range = -1; -static int hf_smpp_service_type = -1; -static int hf_smpp_source_addr_ton = -1; -static int hf_smpp_source_addr_npi = -1; -static int hf_smpp_source_addr = -1; -static int hf_smpp_dest_addr_ton = -1; -static int hf_smpp_dest_addr_npi = -1; -static int hf_smpp_destination_addr = -1; -static int hf_smpp_esm_submit_msg_mode = -1; -static int hf_smpp_esm_submit_msg_type = -1; -static int hf_smpp_esm_submit_features = -1; -static int hf_smpp_protocol_id = -1; -static int hf_smpp_priority_flag = -1; -static int hf_smpp_schedule_delivery_time = -1; -static int hf_smpp_schedule_delivery_time_r = -1; -static int hf_smpp_validity_period = -1; -static int hf_smpp_validity_period_r = -1; -static int hf_smpp_regdel_receipt = -1; -static int hf_smpp_regdel_acks = -1; -static int hf_smpp_regdel_notif = -1; -static int hf_smpp_replace_if_present_flag = -1; -static int hf_smpp_data_coding = -1; -static int hf_smpp_sm_default_msg_id = -1; -static int hf_smpp_sm_length = -1; -static int hf_smpp_short_message = -1; -static int hf_smpp_message_id = -1; -static int hf_smpp_dlist = -1; -static int hf_smpp_dlist_resp = -1; -static int hf_smpp_dl_name = -1; -static int hf_smpp_final_date = -1; -static int hf_smpp_final_date_r = -1; -static int hf_smpp_message_state = -1; -static int hf_smpp_error_code = -1; -static int hf_smpp_error_status_code = -1; -static int hf_smpp_esme_addr_ton = -1; -static int hf_smpp_esme_addr_npi = -1; -static int hf_smpp_esme_addr = -1; +static int hf_smpp_system_id = -1; +static int hf_smpp_password = -1; +static int hf_smpp_system_type = -1; +static int hf_smpp_interface_version = -1; +static int hf_smpp_addr_ton = -1; +static int hf_smpp_addr_npi = -1; +static int hf_smpp_address_range = -1; +static int hf_smpp_service_type = -1; +static int hf_smpp_source_addr_ton = -1; +static int hf_smpp_source_addr_npi = -1; +static int hf_smpp_source_addr = -1; +static int hf_smpp_dest_addr_ton = -1; +static int hf_smpp_dest_addr_npi = -1; +static int hf_smpp_destination_addr = -1; +static int hf_smpp_esm_submit_msg_mode = -1; +static int hf_smpp_esm_submit_msg_type = -1; +static int hf_smpp_esm_submit_features = -1; +static int hf_smpp_protocol_id = -1; +static int hf_smpp_priority_flag = -1; +static int hf_smpp_schedule_delivery_time = -1; +static int hf_smpp_schedule_delivery_time_r = -1; +static int hf_smpp_validity_period = -1; +static int hf_smpp_validity_period_r = -1; +static int hf_smpp_regdel_receipt = -1; +static int hf_smpp_regdel_acks = -1; +static int hf_smpp_regdel_notif = -1; +static int hf_smpp_replace_if_present_flag = -1; +static int hf_smpp_data_coding = -1; +static int hf_smpp_sm_default_msg_id = -1; +static int hf_smpp_sm_length = -1; +static int hf_smpp_short_message = -1; +static int hf_smpp_message_id = -1; +static int hf_smpp_dlist = -1; +static int hf_smpp_dlist_resp = -1; +static int hf_smpp_dl_name = -1; +static int hf_smpp_final_date = -1; +static int hf_smpp_final_date_r = -1; +static int hf_smpp_message_state = -1; +static int hf_smpp_error_code = -1; +static int hf_smpp_error_status_code = -1; +static int hf_smpp_esme_addr_ton = -1; +static int hf_smpp_esme_addr_npi = -1; +static int hf_smpp_esme_addr = -1; /* * Optional parameter section */ -static int hf_smpp_opt_params = -1; -static int hf_smpp_opt_param = -1; -static int hf_smpp_opt_param_tag = -1; -static int hf_smpp_opt_param_len = -1; -static int hf_smpp_vendor_op = -1; -static int hf_smpp_reserved_op = -1; +static int hf_smpp_opt_params = -1; +static int hf_smpp_opt_param = -1; +static int hf_smpp_opt_param_tag = -1; +static int hf_smpp_opt_param_len = -1; +static int hf_smpp_vendor_op = -1; +static int hf_smpp_reserved_op = -1; -static int hf_smpp_dest_addr_subunit = -1; -static int hf_smpp_dest_network_type = -1; -static int hf_smpp_dest_bearer_type = -1; -static int hf_smpp_dest_telematics_id = -1; -static int hf_smpp_source_addr_subunit = -1; -static int hf_smpp_source_network_type = -1; -static int hf_smpp_source_bearer_type = -1; -static int hf_smpp_source_telematics_id = -1; -static int hf_smpp_qos_time_to_live = -1; -static int hf_smpp_payload_type = -1; -static int hf_smpp_additional_status_info_text = -1; -static int hf_smpp_receipted_message_id = -1; -static int hf_smpp_msg_wait_ind = -1; -static int hf_smpp_msg_wait_type = -1; -static int hf_smpp_privacy_indicator = -1; -static int hf_smpp_source_subaddress = -1; -static int hf_smpp_dest_subaddress = -1; -static int hf_smpp_user_message_reference = -1; -static int hf_smpp_user_response_code = -1; -static int hf_smpp_source_port = -1; -static int hf_smpp_destination_port = -1; -static int hf_smpp_sar_msg_ref_num = -1; -static int hf_smpp_language_indicator = -1; -static int hf_smpp_sar_total_segments = -1; -static int hf_smpp_sar_segment_seqnum = -1; -static int hf_smpp_SC_interface_version = -1; -static int hf_smpp_callback_num_pres = -1; -static int hf_smpp_callback_num_scrn = -1; -static int hf_smpp_callback_num_atag = -1; -static int hf_smpp_number_of_messages = -1; -static int hf_smpp_callback_num = -1; -static int hf_smpp_dpf_result = -1; -static int hf_smpp_set_dpf = -1; -static int hf_smpp_ms_availability_status = -1; -static int hf_smpp_network_error_type = -1; -static int hf_smpp_network_error_code = -1; -static int hf_smpp_message_payload = -1; -static int hf_smpp_delivery_failure_reason = -1; -static int hf_smpp_more_messages_to_send = -1; -static int hf_smpp_ussd_service_op = -1; -static int hf_smpp_display_time = -1; -static int hf_smpp_sms_signal = -1; -static int hf_smpp_ms_validity = -1; -static int hf_smpp_alert_on_message_delivery_null = -1; -static int hf_smpp_alert_on_message_delivery = -1; -static int hf_smpp_its_reply_type = -1; -static int hf_smpp_its_session_number = -1; -static int hf_smpp_its_session_sequence = -1; -static int hf_smpp_its_session_ind = -1; +static int hf_smpp_dest_addr_subunit = -1; +static int hf_smpp_dest_network_type = -1; +static int hf_smpp_dest_bearer_type = -1; +static int hf_smpp_dest_telematics_id = -1; +static int hf_smpp_source_addr_subunit = -1; +static int hf_smpp_source_network_type = -1; +static int hf_smpp_source_bearer_type = -1; +static int hf_smpp_source_telematics_id = -1; +static int hf_smpp_qos_time_to_live = -1; +static int hf_smpp_payload_type = -1; +static int hf_smpp_additional_status_info_text = -1; +static int hf_smpp_receipted_message_id = -1; +static int hf_smpp_msg_wait_ind = -1; +static int hf_smpp_msg_wait_type = -1; +static int hf_smpp_privacy_indicator = -1; +static int hf_smpp_source_subaddress = -1; +static int hf_smpp_dest_subaddress = -1; +static int hf_smpp_user_message_reference = -1; +static int hf_smpp_user_response_code = -1; +static int hf_smpp_source_port = -1; +static int hf_smpp_destination_port = -1; +static int hf_smpp_sar_msg_ref_num = -1; +static int hf_smpp_language_indicator = -1; +static int hf_smpp_sar_total_segments = -1; +static int hf_smpp_sar_segment_seqnum = -1; +static int hf_smpp_SC_interface_version = -1; +static int hf_smpp_callback_num_pres = -1; +static int hf_smpp_callback_num_scrn = -1; +static int hf_smpp_callback_num_atag = -1; +static int hf_smpp_number_of_messages = -1; +static int hf_smpp_callback_num = -1; +static int hf_smpp_dpf_result = -1; +static int hf_smpp_set_dpf = -1; +static int hf_smpp_ms_availability_status = -1; +static int hf_smpp_network_error_type = -1; +static int hf_smpp_network_error_code = -1; +static int hf_smpp_message_payload = -1; +static int hf_smpp_delivery_failure_reason = -1; +static int hf_smpp_more_messages_to_send = -1; +static int hf_smpp_ussd_service_op = -1; +static int hf_smpp_display_time = -1; +static int hf_smpp_sms_signal = -1; +static int hf_smpp_ms_validity = -1; +static int hf_smpp_alert_on_message_delivery_null = -1; +static int hf_smpp_alert_on_message_delivery = -1; +static int hf_smpp_its_reply_type = -1; +static int hf_smpp_its_session_number = -1; +static int hf_smpp_its_session_sequence = -1; +static int hf_smpp_its_session_ind = -1; /* Optional Parameters introduced in SMPP 5.0 */ -static int hf_smpp_congestion_state = -1; -static int hf_smpp_billing_identification = -1; -static int hf_smpp_dest_addr_np_country = -1; -static int hf_smpp_dest_addr_np_information = -1; -static int hf_smpp_dest_addr_np_resolution = -1; -static int hf_smpp_source_network_id = -1; -static int hf_smpp_source_node_id = -1; -static int hf_smpp_dest_network_id = -1; -static int hf_smpp_dest_node_id = -1; +static int hf_smpp_congestion_state = -1; +static int hf_smpp_billing_identification = -1; +static int hf_smpp_dest_addr_np_country = -1; +static int hf_smpp_dest_addr_np_information = -1; +static int hf_smpp_dest_addr_np_resolution = -1; +static int hf_smpp_source_network_id = -1; +static int hf_smpp_source_node_id = -1; +static int hf_smpp_dest_network_id = -1; +static int hf_smpp_dest_node_id = -1; /* Optional Parameters for Cell Broadcast Operations */ -static int hf_smpp_broadcast_channel_indicator = -1; -static int hf_smpp_broadcast_content_type_nw = -1; -static int hf_smpp_broadcast_content_type_type = -1; -static int hf_smpp_broadcast_content_type_info = -1; -static int hf_smpp_broadcast_message_class = -1; -static int hf_smpp_broadcast_rep_num = -1; -static int hf_smpp_broadcast_frequency_interval_unit = -1; -static int hf_smpp_broadcast_frequency_interval_value = -1; -static int hf_smpp_broadcast_area_identifier = -1; -static int hf_smpp_broadcast_area_identifier_format = -1; -static int hf_smpp_broadcast_error_status = -1; -static int hf_smpp_broadcast_area_success = -1; -static int hf_smpp_broadcast_end_time = -1; -static int hf_smpp_broadcast_end_time_r = -1; -static int hf_smpp_broadcast_service_group = -1; +static int hf_smpp_broadcast_channel_indicator = -1; +static int hf_smpp_broadcast_content_type_nw = -1; +static int hf_smpp_broadcast_content_type_type = -1; +static int hf_smpp_broadcast_content_type_info = -1; +static int hf_smpp_broadcast_message_class = -1; +static int hf_smpp_broadcast_rep_num = -1; +static int hf_smpp_broadcast_frequency_interval_unit = -1; +static int hf_smpp_broadcast_frequency_interval_value = -1; +static int hf_smpp_broadcast_area_identifier = -1; +static int hf_smpp_broadcast_area_identifier_format = -1; +static int hf_smpp_broadcast_error_status = -1; +static int hf_smpp_broadcast_area_success = -1; +static int hf_smpp_broadcast_end_time = -1; +static int hf_smpp_broadcast_end_time_r = -1; +static int hf_smpp_broadcast_service_group = -1; /* * Data Coding Scheme section */ -static int hf_smpp_dcs = -1; -static int hf_smpp_dcs_sms_coding_group = -1; -static int hf_smpp_dcs_text_compression = -1; -static int hf_smpp_dcs_class_present = -1; -static int hf_smpp_dcs_charset = -1; -static int hf_smpp_dcs_class = -1; -static int hf_smpp_dcs_cbs_coding_group = -1; -static int hf_smpp_dcs_cbs_language = -1; -static int hf_smpp_dcs_wap_charset = -1; -static int hf_smpp_dcs_wap_class = -1; -static int hf_smpp_dcs_cbs_class = -1; +static int hf_smpp_dcs = -1; +static int hf_smpp_dcs_sms_coding_group = -1; +static int hf_smpp_dcs_text_compression = -1; +static int hf_smpp_dcs_class_present = -1; +static int hf_smpp_dcs_charset = -1; +static int hf_smpp_dcs_class = -1; +static int hf_smpp_dcs_cbs_coding_group = -1; +static int hf_smpp_dcs_cbs_language = -1; +static int hf_smpp_dcs_wap_charset = -1; +static int hf_smpp_dcs_wap_class = -1; +static int hf_smpp_dcs_cbs_class = -1; /* * Huawei SMPP+ extensions */ -static int hf_huawei_smpp_version = -1; -static int hf_huawei_smpp_smsc_addr = -1; -static int hf_huawei_smpp_msc_addr_noa = -1; -static int hf_huawei_smpp_msc_addr_npi = -1; -static int hf_huawei_smpp_msc_addr = -1; -static int hf_huawei_smpp_mo_mt_flag = -1; -static int hf_huawei_smpp_length_auth = -1; -static int hf_huawei_smpp_sm_id = -1; -static int hf_huawei_smpp_service_id = -1; -static int hf_huawei_smpp_operation_result = -1; -static int hf_huawei_smpp_notify_mode = -1; -static int hf_huawei_smpp_delivery_result = -1; +static int hf_huawei_smpp_version = -1; +static int hf_huawei_smpp_smsc_addr = -1; +static int hf_huawei_smpp_msc_addr_noa = -1; +static int hf_huawei_smpp_msc_addr_npi = -1; +static int hf_huawei_smpp_msc_addr = -1; +static int hf_huawei_smpp_mo_mt_flag = -1; +static int hf_huawei_smpp_length_auth = -1; +static int hf_huawei_smpp_sm_id = -1; +static int hf_huawei_smpp_service_id = -1; +static int hf_huawei_smpp_operation_result = -1; +static int hf_huawei_smpp_notify_mode = -1; +static int hf_huawei_smpp_delivery_result = -1; /* Initialize the subtree pointers */ static gint ett_smpp = -1; @@ -584,16 +583,16 @@ static const value_string vals_replace_if_present_flag[] = { }; static const value_string vals_data_coding[] = { - { 0, "SMSC default alphabet" }, - { 1, "IA5 (CCITT T.50/ASCII (ANSI X3.4)" }, - { 2, "Octet unspecified (8-bit binary)" }, - { 3, "Latin 1 (ISO-8859-1)" }, - { 4, "Octet unspecified (8-bit binary)" }, - { 5, "JIS (X 0208-1990)" }, - { 6, "Cyrillic (ISO-8859-5)" }, - { 7, "Latin/Hebrew (ISO-8859-8)" }, - { 8, "UCS2 (ISO/IEC-10646)" }, - { 9, "Pictogram encoding" }, + { 0, "SMSC default alphabet" }, + { 1, "IA5 (CCITT T.50/ASCII (ANSI X3.4)" }, + { 2, "Octet unspecified (8-bit binary)" }, + { 3, "Latin 1 (ISO-8859-1)" }, + { 4, "Octet unspecified (8-bit binary)" }, + { 5, "JIS (X 0208-1990)" }, + { 6, "Cyrillic (ISO-8859-5)" }, + { 7, "Latin/Hebrew (ISO-8859-8)" }, + { 8, "UCS2 (ISO/IEC-10646)" }, + { 9, "Pictogram encoding" }, { 10, "ISO-2022-JP (Music codes)" }, { 11, "reserved" }, { 12, "reserved" }, @@ -1030,9 +1029,9 @@ static const value_string vals_dest_addr_np_resolution[] = { }; static const range_string vals_broadcast_area_identifier_format[] = { - {0, 0, "Alias / Name"}, - {1, 1, "Ellipsoid Arc"}, - {2, 2, "Polygon"}, + {0, 0, "Alias / Name"}, + {1, 1, "Ellipsoid Arc"}, + {2, 2, "Polygon"}, {3, 255, "[Reserved]"}, {0, 0, NULL } }; @@ -1179,35 +1178,35 @@ smpp_mktime(const char *datestr, time_t *secs, int *nsecs) r_time.tm_isdst = -1; if (relative == FALSE) { - struct tm *gm, *local_time; - int gm_hour, gm_min; - time_t current_time; + struct tm *gm, *local_time; + int gm_hour, gm_min; + time_t current_time; *secs = mktime(&r_time); - /* Subtract out the timezone information since we will adjust for - * the presented time's timezone below and then display in UTC. - * - * To do that, first determine the current timezone's offset to UTC. - */ - current_time = time(NULL); - gm = gmtime(¤t_time); - gm_hour = gm->tm_hour; - gm_min = gm->tm_min; - local_time = localtime(¤t_time); - /* Then subtract out that difference (whether the difference is - * measured in hours, minutes, or both). - */ - *secs -= 3600*(gm_hour - local_time->tm_hour); - *secs -= 60*(gm_min - local_time->tm_min); + /* Subtract out the timezone information since we will adjust for + * the presented time's timezone below and then display in UTC. + * + * To do that, first determine the current timezone's offset to UTC. + */ + current_time = time(NULL); + gm = gmtime(¤t_time); + gm_hour = gm->tm_hour; + gm_min = gm->tm_min; + local_time = localtime(¤t_time); + /* Then subtract out that difference (whether the difference is + * measured in hours, minutes, or both). + */ + *secs -= 3600*(gm_hour - local_time->tm_hour); + *secs -= 60*(gm_min - local_time->tm_min); *nsecs = (datestr[12] - '0') * 100000000; t_diff = (10 * (datestr[13] - '0') + (datestr[14] - '0')) * 900; if (datestr[15] == '-') - /* Represented time is behind UTC, shift it forward to UTC */ + /* Represented time is behind UTC, shift it forward to UTC */ *secs += t_diff; else if (datestr[15] == '+') - /* Represented time is ahead of UTC, shift it backward to UTC */ + /* Represented time is ahead of UTC, shift it backward to UTC */ *secs -= t_diff; } else { *secs = r_time.tm_sec + 60 * @@ -1309,9 +1308,9 @@ static void smpp_handle_time(proto_tree *tree, tvbuff_t *tvb, int field, int field_R, int *offset) { - char *strval; - gint len; - nstime_t tmptime; + char *strval; + gint len; + nstime_t tmptime; strval = (char *) tvb_get_ephemeral_stringz(tvb, *offset, &len); if (*strval) @@ -1794,8 +1793,8 @@ smpp_handle_tlv(proto_tree *tree, tvbuff_t *tvb, int *offset) void smpp_handle_dcs(proto_tree *tree, tvbuff_t *tvb, int *offset) { - guint8 val; - int off = *offset; + guint8 val; + int off = *offset; proto_tree *subtree = NULL; proto_item *pi; @@ -1881,7 +1880,7 @@ bind_receiver(proto_tree *tree, tvbuff_t *tvb) int offset = 0; guint8 field; guint8 major, minor; - char *strval; + char *strval; smpp_handle_string(tree, tvb, hf_smpp_system_id, &offset); smpp_handle_string(tree, tvb, hf_smpp_password, &offset); @@ -1925,13 +1924,13 @@ static void submit_sm(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree) { - tvbuff_t *tvb_msg; - int offset = 0; - guint8 flag, udhi; - guint8 length; - char *src_str = NULL; - char *dst_str = NULL; - address save_src, save_dst; + tvbuff_t *tvb_msg; + int offset = 0; + guint8 flag, udhi; + guint8 length; + char *src_str = NULL; + char *dst_str = NULL; + address save_src, save_dst; smpp_handle_string_z(tree, tvb, hf_smpp_service_type, &offset, "(Default)"); smpp_handle_int1(tree, tvb, hf_smpp_source_addr_ton, &offset); @@ -2289,7 +2288,7 @@ query_broadcast_sm_resp(proto_tree *tree, tvbuff_t *tvb) static void huawei_auth_acc(proto_tree *tree, tvbuff_t *tvb) { - int offset = 0; + int offset = 0; guint8 version = 0; smpp_handle_int1(tree, tvb, hf_huawei_smpp_version, &offset); @@ -2320,7 +2319,7 @@ huawei_auth_acc_resp(proto_tree *tree, tvbuff_t *tvb) static void huawei_sm_result_notify(proto_tree *tree, tvbuff_t *tvb) { - int offset = 0; + int offset = 0; guint8 version = 0; smpp_handle_int1(tree, tvb, hf_huawei_smpp_version, &offset); @@ -2377,7 +2376,7 @@ dissect_smpp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) return FALSE; command_status = tvb_get_ntohl(tvb, 8); /* ..with known status */ if (match_strval(command_status, vals_command_status) == NULL && - match_strrval(command_status, reserved_command_status) == NULL) + match_strrval(command_status, reserved_command_status) == NULL) return FALSE; dissect_smpp(tvb, pinfo, tree); return TRUE; @@ -2436,17 +2435,17 @@ dissect_smpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) static void dissect_smpp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - int offset = 0; /* Offset within tvbuff */ - guint command_length; /* length of PDU */ - guint command_id; /* SMPP command */ - guint command_status; /* Status code */ - guint sequence_number; /* ...of command */ - smpp_tap_rec_t* tap_rec; /* Tap record */ - const gchar *command_str; - const gchar *command_status_str = NULL; + int offset = 0; /* Offset within tvbuff */ + guint command_length; /* length of PDU */ + guint command_id; /* SMPP command */ + guint command_status; /* Status code */ + guint sequence_number; /* ...of command */ + smpp_tap_rec_t *tap_rec; /* Tap record */ + const gchar *command_str; + const gchar *command_status_str = NULL; /* Set up structures needed to add the protocol subtree and manage it */ - proto_item *ti = NULL; - proto_tree *smpp_tree = NULL; + proto_item *ti = NULL; + proto_tree *smpp_tree = NULL; /* * Safety: don't even try to dissect the PDU @@ -2463,13 +2462,13 @@ dissect_smpp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) command_status = tvb_get_ntohl(tvb, offset); if (command_id & 0x80000000) { /* PDU is a response. */ - command_status_str = match_strval(command_status, vals_command_status); - if (command_status_str == NULL) { - /* Check if the reserved value is in the vendor-specific range. */ - command_status_str = (command_status >= 0x400 && command_status <= 0x4FF ? - ep_strdup_printf("Vendor-specific Error (0x%08X)", command_status) : - ep_strdup_printf("(Reserved Error 0x%08X)", command_status)); - } + command_status_str = match_strval(command_status, vals_command_status); + if (command_status_str == NULL) { + /* Check if the reserved value is in the vendor-specific range. */ + command_status_str = (command_status >= 0x400 && command_status <= 0x4FF ? + ep_strdup_printf("Vendor-specific Error (0x%08X)", command_status) : + ep_strdup_printf("(Reserved Error 0x%08X)", command_status)); + } } offset += 4; sequence_number = tvb_get_ntohl(tvb, offset); @@ -3788,11 +3787,6 @@ proto_register_smpp(void) &reassemble_over_tcp); } -/* - * If dissector uses sub-dissector registration add a registration routine. - * This format is required because a script is used to find these routines and - * create the code that calls these routines. - */ void proto_reg_handoff_smpp(void) { diff --git a/epan/dissectors/packet-ssl-utils.c b/epan/dissectors/packet-ssl-utils.c index 552a537e57..2302a071ab 100644 --- a/epan/dissectors/packet-ssl-utils.c +++ b/epan/dissectors/packet-ssl-utils.c @@ -351,15 +351,15 @@ value_string_ext ssl_20_cipher_suites_ext = VALUE_STRING_EXT_INIT(ssl_20_cipher_ const value_string ssl_extension_curves[] = { - { 1, "sect163k1" }, - { 2, "sect163r1" }, - { 3, "sect163r2" }, - { 4, "sect193r1" }, - { 5, "sect193r2" }, - { 6, "sect233k1" }, - { 7, "sect233r1" }, - { 8, "sect239k1" }, - { 9, "sect283k1" }, + { 1, "sect163k1" }, + { 2, "sect163r1" }, + { 3, "sect163r2" }, + { 4, "sect193r1" }, + { 5, "sect193r2" }, + { 6, "sect233k1" }, + { 7, "sect233r1" }, + { 8, "sect239k1" }, + { 9, "sect283k1" }, { 10, "sect283r1" }, { 11, "sect409k1" }, { 12, "sect409r1" }, @@ -438,29 +438,29 @@ const value_string ssl_31_alert_level[] = { }; const value_string ssl_31_alert_description[] = { - { 0, "Close Notify" }, - { 10, "Unexpected Message" }, - { 20, "Bad Record MAC" }, - { 21, "Decryption Failed" }, - { 22, "Record Overflow" }, - { 30, "Decompression Failure" }, - { 40, "Handshake Failure" }, - { 41, "No Certificate" }, - { 42, "Bad Certificate" }, - { 43, "Unsupported Certificate" }, - { 44, "Certificate Revoked" }, - { 45, "Certificate Expired" }, - { 46, "Certificate Unknown" }, - { 47, "Illegal Parameter" }, - { 48, "Unknown CA" }, - { 49, "Access Denied" }, - { 50, "Decode Error" }, - { 51, "Decrypt Error" }, - { 60, "Export Restriction" }, - { 70, "Protocol Version" }, - { 71, "Insufficient Security" }, - { 80, "Internal Error" }, - { 90, "User Canceled" }, + { 0, "Close Notify" }, + { 10, "Unexpected Message" }, + { 20, "Bad Record MAC" }, + { 21, "Decryption Failed" }, + { 22, "Record Overflow" }, + { 30, "Decompression Failure" }, + { 40, "Handshake Failure" }, + { 41, "No Certificate" }, + { 42, "Bad Certificate" }, + { 43, "Unsupported Certificate" }, + { 44, "Certificate Revoked" }, + { 45, "Certificate Expired" }, + { 46, "Certificate Unknown" }, + { 47, "Illegal Parameter" }, + { 48, "Unknown CA" }, + { 49, "Access Denied" }, + { 50, "Decode Error" }, + { 51, "Decrypt Error" }, + { 60, "Export Restriction" }, + { 70, "Protocol Version" }, + { 71, "Insufficient Security" }, + { 80, "Internal Error" }, + { 90, "User Canceled" }, { 100, "No Renegotiation" }, { 110, "Unsupported Extension" }, { 111, "Certificate Unobtainable" }, @@ -501,8 +501,8 @@ const value_string tls_heartbeat_mode[] = { }; const value_string ssl_31_compression_method[] = { - { 0, "null" }, - { 1, "DEFLATE" }, + { 0, "null" }, + { 1, "DEFLATE" }, { 64, "LZS" }, { 0x00, NULL } }; @@ -975,192 +975,192 @@ struct _SslDecompress { 0 indicates unknown */ gint ssl_get_keyex_alg(gint cipher) { - switch(cipher) { - case 0x0001: - case 0x0002: - case 0x0003: - case 0x0004: - case 0x0005: - case 0x0006: - case 0x0007: - case 0x0008: - case 0x0009: - case 0x000a: - case 0x002e: - case 0x002f: - case 0x0035: - case 0x003b: - case 0x003c: - case 0x003d: - case 0x0041: - case 0x0060: - case 0x0061: - case 0x0062: - case 0x0064: - case 0x0084: - case 0x0092: - case 0x0093: - case 0x0094: - case 0x0095: - case 0x0096: - case 0x009c: - case 0x009d: - case 0x00ac: - case 0x00ad: - case 0x00b6: - case 0x00b7: - case 0x00b8: - case 0x00b9: - case 0x00ba: - case 0x00c0: - case 0xfefe: - case 0xfeff: - case 0xffe0: - case 0xffe1: - return KEX_RSA; - case 0x000b: - case 0x000c: - case 0x000d: - case 0x000e: - case 0x000f: - case 0x0010: - case 0x0011: - case 0x0012: - case 0x0013: - case 0x0014: - case 0x0015: - case 0x0016: - case 0x0017: - case 0x0018: - case 0x0019: - case 0x001a: - case 0x001b: - case 0x002d: - case 0x0030: - case 0x0031: - case 0x0032: - case 0x0033: - case 0x0034: - case 0x0036: - case 0x0037: - case 0x0038: - case 0x0039: - case 0x003a: - case 0x003e: - case 0x003f: - case 0x0040: - case 0x0042: - case 0x0043: - case 0x0044: - case 0x0045: - case 0x0046: - case 0x0063: - case 0x0065: - case 0x0066: - case 0x0067: - case 0x0068: - case 0x0069: - case 0x006a: - case 0x006b: - case 0x006c: - case 0x006d: - case 0x0085: - case 0x0086: - case 0x0087: - case 0x0088: - case 0x0089: - case 0x008e: - case 0x008f: - case 0x0090: - case 0x0091: - case 0x0097: - case 0x0098: - case 0x0099: - case 0x009a: - case 0x009b: - case 0x009e: - case 0x009f: - case 0x00a0: - case 0x00a1: - case 0x00a2: - case 0x00a3: - case 0x00a4: - case 0x00a5: - case 0x00a6: - case 0x00a7: - case 0x00aa: - case 0x00ab: - case 0x00b2: - case 0x00b3: - case 0x00b4: - case 0x00b5: - case 0x00bb: - case 0x00bc: - case 0x00bd: - case 0x00be: - case 0x00bf: - case 0x00c1: - case 0x00c2: - case 0x00c3: - case 0x00c4: - case 0x00c5: - return KEX_DH; - case 0xc001: - case 0xc002: - case 0xc003: - case 0xc004: - case 0xc005: - case 0xc006: - case 0xc007: - case 0xc008: - case 0xc009: - case 0xc00a: - case 0xc00b: - case 0xc00c: - case 0xc00d: - case 0xc00e: - case 0xc00f: - case 0xc010: - case 0xc011: - case 0xc012: - case 0xc013: - case 0xc014: - case 0xc015: - case 0xc016: - case 0xc017: - case 0xc018: - case 0xc019: - case 0xc023: - case 0xc024: - case 0xc025: - case 0xc026: - case 0xc027: - case 0xc028: - case 0xc029: - case 0xc02a: - case 0xc02b: - case 0xc02c: - case 0xc02d: - case 0xc02e: - case 0xc02f: - case 0xc030: - case 0xc031: - case 0xc032: - case 0xc033: - case 0xc034: - case 0xc035: - case 0xc036: - case 0xc037: - case 0xc038: - case 0xc039: - case 0xc03a: - case 0xc03b: - return KEX_ECDH; - default: - break; - } + switch(cipher) { + case 0x0001: + case 0x0002: + case 0x0003: + case 0x0004: + case 0x0005: + case 0x0006: + case 0x0007: + case 0x0008: + case 0x0009: + case 0x000a: + case 0x002e: + case 0x002f: + case 0x0035: + case 0x003b: + case 0x003c: + case 0x003d: + case 0x0041: + case 0x0060: + case 0x0061: + case 0x0062: + case 0x0064: + case 0x0084: + case 0x0092: + case 0x0093: + case 0x0094: + case 0x0095: + case 0x0096: + case 0x009c: + case 0x009d: + case 0x00ac: + case 0x00ad: + case 0x00b6: + case 0x00b7: + case 0x00b8: + case 0x00b9: + case 0x00ba: + case 0x00c0: + case 0xfefe: + case 0xfeff: + case 0xffe0: + case 0xffe1: + return KEX_RSA; + case 0x000b: + case 0x000c: + case 0x000d: + case 0x000e: + case 0x000f: + case 0x0010: + case 0x0011: + case 0x0012: + case 0x0013: + case 0x0014: + case 0x0015: + case 0x0016: + case 0x0017: + case 0x0018: + case 0x0019: + case 0x001a: + case 0x001b: + case 0x002d: + case 0x0030: + case 0x0031: + case 0x0032: + case 0x0033: + case 0x0034: + case 0x0036: + case 0x0037: + case 0x0038: + case 0x0039: + case 0x003a: + case 0x003e: + case 0x003f: + case 0x0040: + case 0x0042: + case 0x0043: + case 0x0044: + case 0x0045: + case 0x0046: + case 0x0063: + case 0x0065: + case 0x0066: + case 0x0067: + case 0x0068: + case 0x0069: + case 0x006a: + case 0x006b: + case 0x006c: + case 0x006d: + case 0x0085: + case 0x0086: + case 0x0087: + case 0x0088: + case 0x0089: + case 0x008e: + case 0x008f: + case 0x0090: + case 0x0091: + case 0x0097: + case 0x0098: + case 0x0099: + case 0x009a: + case 0x009b: + case 0x009e: + case 0x009f: + case 0x00a0: + case 0x00a1: + case 0x00a2: + case 0x00a3: + case 0x00a4: + case 0x00a5: + case 0x00a6: + case 0x00a7: + case 0x00aa: + case 0x00ab: + case 0x00b2: + case 0x00b3: + case 0x00b4: + case 0x00b5: + case 0x00bb: + case 0x00bc: + case 0x00bd: + case 0x00be: + case 0x00bf: + case 0x00c1: + case 0x00c2: + case 0x00c3: + case 0x00c4: + case 0x00c5: + return KEX_DH; + case 0xc001: + case 0xc002: + case 0xc003: + case 0xc004: + case 0xc005: + case 0xc006: + case 0xc007: + case 0xc008: + case 0xc009: + case 0xc00a: + case 0xc00b: + case 0xc00c: + case 0xc00d: + case 0xc00e: + case 0xc00f: + case 0xc010: + case 0xc011: + case 0xc012: + case 0xc013: + case 0xc014: + case 0xc015: + case 0xc016: + case 0xc017: + case 0xc018: + case 0xc019: + case 0xc023: + case 0xc024: + case 0xc025: + case 0xc026: + case 0xc027: + case 0xc028: + case 0xc029: + case 0xc02a: + case 0xc02b: + case 0xc02c: + case 0xc02d: + case 0xc02e: + case 0xc02f: + case 0xc030: + case 0xc031: + case 0xc032: + case 0xc033: + case 0xc034: + case 0xc035: + case 0xc036: + case 0xc037: + case 0xc038: + case 0xc039: + case 0xc03a: + case 0xc03b: + return KEX_ECDH; + default: + break; + } - return 0; + return 0; } @@ -1195,8 +1195,9 @@ static gint ver_major, ver_minor, ver_patch; static inline gint ssl_hmac_init(SSL_HMAC* md, const void * key, gint len, gint algo) { - gcry_error_t err; - const char *err_str, *err_src; + gcry_error_t err; + const char *err_str, *err_src; + err = gcry_md_open(md,algo, GCRY_MD_FLAG_HMAC); if (err != 0) { err_str = gcry_strerror(err); @@ -1215,12 +1216,13 @@ ssl_hmac_update(SSL_HMAC* md, const void* data, gint len) static inline void ssl_hmac_final(SSL_HMAC* md, guchar* data, guint* datalen) { - gint algo; + gint algo; guint len; + algo = gcry_md_get_algo (*(md)); - len = gcry_md_get_algo_dlen(algo); + len = gcry_md_get_algo_dlen(algo); memcpy(data, gcry_md_read(*(md), algo), len); - *datalen =len; + *datalen = len; } static inline void ssl_hmac_cleanup(SSL_HMAC* md) @@ -1234,8 +1236,8 @@ ssl_hmac_cleanup(SSL_HMAC* md) static inline gint ssl_md_init(SSL_MD* md, gint algo) { - gcry_error_t err; - const char *err_str, *err_src; + gcry_error_t err; + const char *err_str, *err_src; err = gcry_md_open(md,algo, 0); if (err != 0) { err_str = gcry_strerror(err); @@ -1284,7 +1286,7 @@ static inline void ssl_sha_final(guchar* buf, SSL_SHA_CTX* md) { memcpy(buf, gcry_md_read(*(md), GCRY_MD_SHA1), - gcry_md_get_algo_dlen(GCRY_MD_SHA1)); + gcry_md_get_algo_dlen(GCRY_MD_SHA1)); } static inline void ssl_sha_cleanup(SSL_SHA_CTX* md) @@ -1306,7 +1308,7 @@ static inline void ssl_md5_final(guchar* buf, SSL_MD5_CTX* md) { memcpy(buf, gcry_md_read(*(md), GCRY_MD_MD5), - gcry_md_get_algo_dlen(GCRY_MD_MD5)); + gcry_md_get_algo_dlen(GCRY_MD_MD5)); } static inline void ssl_md5_cleanup(SSL_MD5_CTX* md) @@ -1317,27 +1319,30 @@ ssl_md5_cleanup(SSL_MD5_CTX* md) gint ssl_cipher_setiv(SSL_CIPHER_CTX *cipher, guchar* iv, gint iv_len) { - /* guchar * ivp; */ gint ret; - /* gint i; */ - /* gcry_cipher_hd_t c; */ - /*c=(gcry_cipher_hd_t)*cipher;*/ - +#if 0 + guchar *ivp; + gint i; + gcry_cipher_hd_t c; + c=(gcry_cipher_hd_t)*cipher; +#endif ssl_debug_printf("--------------------------------------------------------------------"); - /*for(ivp=c->iv,i=0; i < iv_len; i++ ) +#if 0 + for(ivp=c->iv,i=0; i < iv_len; i++ ) { ssl_debug_printf("%d ",ivp[i]); i++; } - */ +#endif ssl_debug_printf("--------------------------------------------------------------------"); ret = gcry_cipher_setiv(*(cipher), iv, iv_len); - /*for(ivp=c->iv,i=0; i < iv_len; i++ ) +#if 0 + for(ivp=c->iv,i=0; i < iv_len; i++ ) { ssl_debug_printf("%d ",ivp[i]); i++; } - */ +#endif ssl_debug_printf("--------------------------------------------------------------------"); return ret; } @@ -1408,9 +1413,9 @@ _gcry_rsa_decrypt (int algo, gcry_mpi_t *result, gcry_mpi_t *data, const gchar* ssl_private_key_to_str(SSL_PRIVATE_KEY* pk) { - const gchar *str="NULL"; - size_t n; - gchar *buf; + const gchar *str = "NULL"; + size_t n; + gchar *buf; if (!pk) return str; #ifndef SSL_FAST @@ -1430,16 +1435,16 @@ ssl_private_key_to_str(SSL_PRIVATE_KEY* pk) int ssl_private_decrypt(guint len, guchar* encr_data, SSL_PRIVATE_KEY* pk) { - gint rc; - size_t decr_len; - gcry_sexp_t s_data, s_plain; - gcry_mpi_t encr_mpi; - size_t i, encr_len; - guchar* decr_data_ptr; - gcry_mpi_t text; + gint rc; + size_t decr_len; + gcry_sexp_t s_data, s_plain; + gcry_mpi_t encr_mpi; + size_t i, encr_len; + guchar* decr_data_ptr; + gcry_mpi_t text; decr_len = 0; encr_len = len; - text=NULL; + text = NULL; /* build up a mpi rappresentation for encrypted data */ rc = gcry_mpi_scan(&encr_mpi, GCRYMPI_FMT_USG,encr_data, encr_len, &encr_len); @@ -1693,15 +1698,15 @@ ssl_find_cipher(int num,SslCipherSuite* cs) static gint tls_hash(StringInfo* secret, StringInfo* seed, gint md, StringInfo* out) { - guint8 *ptr; - guint left; - gint tocpy; - guint8 *A; - guint8 _A[48],tmp[48]; - guint A_l,tmp_l; - SSL_HMAC hm; - ptr=out->data; - left=out->data_len; + guint8 *ptr; + guint left; + gint tocpy; + guint8 *A; + guint8 _A[48],tmp[48]; + guint A_l,tmp_l; + SSL_HMAC hm; + ptr = out->data; + left = out->data_len; ssl_print_string("tls_hash: hash secret", secret); @@ -1736,12 +1741,12 @@ static gint tls_prf(StringInfo* secret, const gchar *usage, StringInfo* rnd1, StringInfo* rnd2, StringInfo* out) { - StringInfo seed, sha_out, md5_out; - guint8 *ptr; - StringInfo s1, s2; - guint i,s_l, r; - size_t usage_len; - r=-1; + StringInfo seed, sha_out, md5_out; + guint8 *ptr; + StringInfo s1, s2; + guint i,s_l, r; + size_t usage_len; + r = -1; usage_len = strlen(usage); /* initalize buffer for sha, md5 random seed*/ @@ -1810,7 +1815,7 @@ static gint tls12_prf(gint md, StringInfo* secret, const gchar* usage, StringInfo* rnd1, StringInfo* rnd2, StringInfo* out) { StringInfo label_seed; - size_t usage_len; + size_t usage_len; usage_len = strlen(usage); if (ssl_data_alloc(&label_seed, usage_len+rnd1->data_len+rnd2->data_len) < 0) { @@ -1835,7 +1840,7 @@ ssl3_generate_export_iv(StringInfo* r1, StringInfo* r2, StringInfo* out) { SSL_MD5_CTX md5; - guint8 tmp[16]; + guint8 tmp[16]; ssl_md5_init(&md5); ssl_md5_update(&md5,r1->data,r1->data_len); @@ -1854,12 +1859,12 @@ ssl3_prf(StringInfo* secret, const gchar* usage, StringInfo* r1, StringInfo* r2,StringInfo* out) { - SSL_MD5_CTX md5; - SSL_SHA_CTX sha; - StringInfo *rnd1,*rnd2; - guint off; - gint i=0,j; - guint8 buf[20]; + SSL_MD5_CTX md5; + SSL_SHA_CTX sha; + StringInfo *rnd1,*rnd2; + guint off; + gint i = 0,j; + guint8 buf[20]; rnd1=r1; rnd2=r2; @@ -1989,7 +1994,7 @@ ssl_create_decoder(SslCipherSuite *cipher_suite, gint compression, guint8 *mk, guint8 *sk, guint8 *iv) { SslDecoder *dec; - gint ciph; + gint ciph; dec = se_alloc0(sizeof(SslDecoder)); /* Find the SSLeay cipher */ @@ -2032,11 +2037,11 @@ ssl_create_decoder(SslCipherSuite *cipher_suite, gint compression, int ssl_generate_keyring_material(SslDecryptSession*ssl_session) { - StringInfo key_block; - guint8 _iv_c[MAX_BLOCK_SIZE],_iv_s[MAX_BLOCK_SIZE]; - guint8 _key_c[MAX_KEY_SIZE],_key_s[MAX_KEY_SIZE]; - gint needed; - guint8 *ptr,*c_wk,*s_wk,*c_mk,*s_mk,*c_iv = _iv_c,*s_iv = _iv_s; + StringInfo key_block; + guint8 _iv_c[MAX_BLOCK_SIZE],_iv_s[MAX_BLOCK_SIZE]; + guint8 _key_c[MAX_KEY_SIZE],_key_s[MAX_KEY_SIZE]; + gint needed; + guint8 *ptr,*c_wk,*s_wk,*c_mk,*s_mk,*c_iv = _iv_c,*s_iv = _iv_s; /* check for enough info to proced */ guint need_all = SSL_CIPHER|SSL_CLIENT_RANDOM|SSL_SERVER_RANDOM|SSL_VERSION; @@ -2327,10 +2332,10 @@ tls_check_mac(SslDecoder*decoder, gint ct, gint ver, guint8* data, guint32 datalen, guint8* mac) { SSL_HMAC hm; - gint md; - guint32 len; - guint8 buf[48]; - gint16 temp; + gint md; + guint32 len; + guint8 buf[48]; + gint16 temp; md=ssl_get_digest_by_name(digests[decoder->cipher_suite->dig-0x40]); ssl_debug_printf("tls_check_mac mac type:%s md %d\n", @@ -2376,12 +2381,12 @@ int ssl3_check_mac(SslDecoder*decoder,int ct,guint8* data, guint32 datalen, guint8* mac) { - SSL_MD mc; - gint md; + SSL_MD mc; + gint md; guint32 len; - guint8 buf[64],dgst[20]; - gint pad_ct; - gint16 temp; + guint8 buf[64],dgst[20]; + gint pad_ct; + gint16 temp; pad_ct=(decoder->cipher_suite->dig==DIG_SHA)?40:48; @@ -2441,10 +2446,10 @@ dtls_check_mac(SslDecoder*decoder, gint ct,int ver, guint8* data, guint32 datalen, guint8* mac) { SSL_HMAC hm; - gint md; - guint32 len; - guint8 buf[20]; - gint16 temp; + gint md; + guint32 len; + guint8 buf[20]; + gint16 temp; md=ssl_get_digest_by_name(digests[decoder->cipher_suite->dig-0x40]); ssl_debug_printf("dtls_check_mac mac type:%s md %d\n", @@ -2526,7 +2531,7 @@ int ssl_decrypt_record(SslDecryptSession*ssl,SslDecoder* decoder, gint ct, const guchar* in, guint inl, StringInfo* comp_str, StringInfo* out_str, guint* outl) { - guint pad, worklen, uncomplen; + guint pad, worklen, uncomplen; guint8 *mac; ssl_debug_printf("ssl_decrypt_record ciphertext len %d\n", inl); @@ -2584,13 +2589,13 @@ ssl_decrypt_record(SslDecryptSession*ssl,SslDecoder* decoder, gint ct, worklen, ssl->version_netorder, ct, decoder->seq); if(ssl->version_netorder==SSLV3_VERSION){ if(ssl3_check_mac(decoder,ct,out_str->data,worklen,mac) < 0) { - if(ssl_ignore_mac_failed) { - ssl_debug_printf("ssl_decrypt_record: mac failed, but ignored for troubleshooting ;-)\n"); + if(ssl_ignore_mac_failed) { + ssl_debug_printf("ssl_decrypt_record: mac failed, but ignored for troubleshooting ;-)\n"); + } + else{ + ssl_debug_printf("ssl_decrypt_record: mac failed\n"); + return -1; } - else{ - ssl_debug_printf("ssl_decrypt_record: mac failed\n"); - return -1; - } } else{ ssl_debug_printf("ssl_decrypt_record: mac ok\n"); @@ -2598,13 +2603,13 @@ ssl_decrypt_record(SslDecryptSession*ssl,SslDecoder* decoder, gint ct, } else if(ssl->version_netorder==TLSV1_VERSION || ssl->version_netorder==TLSV1DOT1_VERSION || ssl->version_netorder==TLSV1DOT2_VERSION){ if(tls_check_mac(decoder,ct,ssl->version_netorder,out_str->data,worklen,mac)< 0) { - if(ssl_ignore_mac_failed) { - ssl_debug_printf("ssl_decrypt_record: mac failed, but ignored for troubleshooting ;-)\n"); + if(ssl_ignore_mac_failed) { + ssl_debug_printf("ssl_decrypt_record: mac failed, but ignored for troubleshooting ;-)\n"); + } + else{ + ssl_debug_printf("ssl_decrypt_record: mac failed\n"); + return -1; } - else{ - ssl_debug_printf("ssl_decrypt_record: mac failed\n"); - return -1; - } } else{ ssl_debug_printf("ssl_decrypt_record: mac ok\n"); @@ -2629,19 +2634,19 @@ ssl_decrypt_record(SslDecryptSession*ssl,SslDecoder* decoder, gint ct, } } - *outl = worklen; + *outl = worklen; if (decoder->compression > 0) { - ssl_debug_printf("ssl_decrypt_record: compression method %d\n", decoder->compression); - ssl_data_copy(comp_str, out_str); - ssl_print_data("Plaintext compressed", comp_str->data, worklen); - if (!decoder->decomp) { - ssl_debug_printf("decrypt_ssl3_record: no decoder available\n"); - return -1; - } - if (ssl_decompress_record(decoder->decomp, comp_str->data, worklen, out_str, &uncomplen) < 0) return -1; - ssl_print_data("Plaintext uncompressed", out_str->data, uncomplen); - *outl = uncomplen; + ssl_debug_printf("ssl_decrypt_record: compression method %d\n", decoder->compression); + ssl_data_copy(comp_str, out_str); + ssl_print_data("Plaintext compressed", comp_str->data, worklen); + if (!decoder->decomp) { + ssl_debug_printf("decrypt_ssl3_record: no decoder available\n"); + return -1; + } + if (ssl_decompress_record(decoder->decomp, comp_str->data, worklen, out_str, &uncomplen) < 0) return -1; + ssl_print_data("Plaintext uncompressed", out_str->data, uncomplen); + *outl = uncomplen; } return 0; @@ -2660,13 +2665,13 @@ SSL_PRIVATE_KEY* ssl_privkey_to_sexp(struct gnutls_x509_privkey_int* priv_key) { gnutls_datum_t rsa_datum[RSA_PARS]; /* m, e, d, p, q, u */ - size_t tmp_size; - gcry_sexp_t rsa_priv_key = NULL; - gint major, minor, patch; - gint i, p_idx, q_idx; - int ret; - size_t buf_len; - unsigned char buf_keyid[32]; + size_t tmp_size; + gcry_sexp_t rsa_priv_key = NULL; + gint major, minor, patch; + gint i, p_idx, q_idx; + int ret; + size_t buf_len; + unsigned char buf_keyid[32]; #ifdef SSL_FAST gcry_mpi_t* rsa_params = g_malloc(sizeof(gcry_mpi_t)*RSA_PARS); @@ -2722,7 +2727,7 @@ ssl_privkey_to_sexp(struct gnutls_x509_privkey_int* priv_key) ssl_get_version(&major, &minor, &patch); /* certain versions of gnutls require swap of rsa params 'p' and 'q' */ - if ((major <= 1) && (minor <= 0) && (patch <=13)) + if ((major <= 1) && (minor <= 0) && (patch <= 13)) { gcry_mpi_t tmp; ssl_debug_printf("ssl_load_key: swapping p and q parameters\n"); @@ -2755,14 +2760,14 @@ ssl_privkey_to_sexp(struct gnutls_x509_privkey_int* priv_key) Ssl_private_key_t * ssl_load_key(FILE* fp) { - /* gnutls make our work much harded, since we have to work internally with - * s-exp formatted data, but PEM loader export only in "gnutls_datum" + /* gnutls makes our work much harder, since we have to work internally with + * s-exp formatted data, but PEM loader exports only in "gnutls_datum" * format, and a datum -> s-exp convertion function does not exist. */ gnutls_x509_privkey_t priv_key; - gnutls_datum key; - gint size; - guint bytes; + gnutls_datum key; + gint size; + guint bytes; Ssl_private_key_t *private_key = g_malloc0(sizeof(Ssl_private_key_t)); @@ -2839,16 +2844,16 @@ BAGTYPE(gnutls_pkcs12_bag_type_t x) { Ssl_private_key_t * ssl_load_pkcs12(FILE* fp, const gchar *cert_passwd) { - int i, j, ret; - int rest; - unsigned char *p; - gnutls_datum_t data; - gnutls_pkcs12_bag_t bag = NULL; - gnutls_pkcs12_bag_type_t bag_type; - size_t len, buf_len; - static char buf_name[256]; - static char buf_email[128]; - unsigned char buf_keyid[32]; + int i, j, ret; + int rest; + unsigned char *p; + gnutls_datum_t data; + gnutls_pkcs12_bag_t bag = NULL; + gnutls_pkcs12_bag_type_t bag_type; + size_t len, buf_len; + static char buf_name[256]; + static char buf_email[128]; + unsigned char buf_keyid[32]; gnutls_pkcs12_t ssl_p12 = NULL; gnutls_x509_crt_t ssl_cert = NULL; @@ -3016,8 +3021,8 @@ void ssl_free_key(Ssl_private_key_t* key) gint ssl_find_private_key(SslDecryptSession *ssl_session, GHashTable *key_hash, GTree* associations, packet_info *pinfo) { SslService dummy; - char ip_addr_any[] = {0,0,0,0}; - guint32 port = 0; + char ip_addr_any[] = {0,0,0,0}; + guint32 port = 0; Ssl_private_key_t * private_key; /* we need to know which side of the conversation is speaking */ @@ -3249,12 +3254,13 @@ guint ssl_private_key_hash (gconstpointer v) { const SslService *key; - guint l, hash, len ; + guint l, hash, len ; const guint* cur; - key = (const SslService *)v; + + key = (const SslService *)v; hash = key->port; - len = key->addr.len; - cur = (const guint*) key->addr.data; + len = key->addr.len; + cur = (const guint*) key->addr.data; for (l=4; (lfd, proto); @@ -3455,7 +3461,7 @@ ssl_add_data_info(gint proto, packet_info *pinfo, guchar* data, gint data_len, g SslDataInfo* ssl_get_data_info(int proto, packet_info *pinfo, gint key) { - SslDataInfo* rec; + SslDataInfo* rec; SslPacketInfo* pi; pi = p_get_proto_data(pinfo->fd, proto); @@ -3489,11 +3495,11 @@ ssl_common_init(GHashTable **session_hash, StringInfo *decrypted_data, StringInf void ssl_parse_key_list(const ssldecrypt_assoc_t * uats, GHashTable *key_hash, GTree* associations, dissector_handle_t handle, gboolean tcp) { - SslService* service; - Ssl_private_key_t * private_key, *tmp_private_key; - FILE* fp = NULL; - guint32 addr_data[4]; - int addr_len, at; + SslService* service; + Ssl_private_key_t* private_key, *tmp_private_key; + FILE* fp = NULL; + guint32 addr_data[4]; + int addr_len, at; address_type addr_type[2] = { AT_IPv4, AT_IPv6 }; /* try to load keys file first */ @@ -3614,7 +3620,7 @@ ssl_restore_session(SslDecryptSession* ssl, GHashTable *session_hash) int ssl_is_valid_content_type(guint8 type) { - if (type >= 0x14 && type <= 0x18) + if ((type >= 0x14) && (type <= 0x18)) { return 1; } @@ -3624,11 +3630,11 @@ ssl_is_valid_content_type(guint8 type) static guint8 from_hex_char(gchar c) { - if (c >= '0' && c <= '9') + if ((c >= '0') && (c <= '9')) return c - '0'; - if (c >= 'A' && c <= 'F') + if ((c >= 'A') && (c <= 'F')) return c - 'A' + 10; - if (c >= 'a' && c <= 'f') + if ((c >= 'a') && (c <= 'f')) return c - 'a' + 10; return 16; } @@ -3637,10 +3643,11 @@ int ssl_keylog_lookup(SslDecryptSession* ssl_session, const gchar* ssl_keylog_filename, StringInfo* encrypted_pre_master) { + static const unsigned int kRSAPremasterLength = 48; /* RFC5246 7.4.7.1 */ FILE* ssl_keylog; gsize bytes_read; - int ret = -1; + int ret = -1; ssl_debug_printf("trying to use SSL keylog in %s\n", ssl_keylog_filename); @@ -3686,7 +3693,7 @@ ssl_keylog_lookup(SslDecryptSession* ssl_session, offset = 4; - if ( ssl_session->session_id.data_len>0 && memcmp(line+offset,"Session-ID:",11) == 0 ) { + if ( (ssl_session->session_id.data_len > 0) && (memcmp(line+offset,"Session-ID:",11) == 0) ) { offset += 11; for (i = 0; i < ssl_session->session_id.data_len; i++) { if (from_hex_char(line[offset + i*2]) != (ssl_session->session_id.data[i] >> 4) || @@ -3792,9 +3799,10 @@ void ssl_set_debug(const gchar* name) { static gint debug_file_must_be_closed; - gint use_stderr; + gint use_stderr; + debug_file_must_be_closed = 0; - use_stderr = name?(strcmp(name, SSL_DEBUG_USE_STDERR) == 0):0; + use_stderr = name?(strcmp(name, SSL_DEBUG_USE_STDERR) == 0):0; if (debug_file_must_be_closed) fclose(ssl_debug_file); @@ -3849,7 +3857,7 @@ ssl_print_data(const gchar* name, const guchar* data, size_t len) return; fprintf(ssl_debug_file,"%s[%d]:\n",name, (int) len); for (i=0; i< len; i++) { - if ((i>0) && (i%16 == 0)) + if ((i > 0) && (i%16 == 0)) fprintf(ssl_debug_file,"\n"); fprintf(ssl_debug_file,"%.2x ",data[i]&255); } @@ -3934,12 +3942,12 @@ ssldecrypt_uat_fld_fileopen_chk_cb(void* r _U_, const char* p, unsigned len _U_, } gboolean -ssldecrypt_uat_fld_password_chk_cb(void* r _U_, const char* p, unsigned len _U_, const void* u1 _U_, const void* u2 _U_, const char** err) +ssldecrypt_uat_fld_password_chk_cb(void* r _U_, const char* p, unsigned len _U_, const void* u1 _U_, const void* u2 _U_, const char ** err) { - ssldecrypt_assoc_t* f = r; - FILE *fp = NULL; + ssldecrypt_assoc_t* f = r; + FILE *fp = NULL; - if (p && strlen(p) > 0u) { + if (p && (strlen(p) > 0u)) { fp = ws_fopen(f->keyfile, "rb"); if (fp) { if (!ssl_load_pkcs12(fp, p)) {