diff options
author | Anders Broman <anders.broman@ericsson.com> | 2012-07-31 06:56:13 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2012-07-31 06:56:13 +0000 |
commit | ad95fa259bc98ff9ed5cce2c3bd1eeaec9aa125e (patch) | |
tree | 083cb550068ced3425c447a259cdf6b0c15a4f76 /asn1/nbap | |
parent | 51b40ed15078fda06fb0d2299c22002ea0a96105 (diff) |
From Jacob Nordgren and Rishie Sharma:
NBAP: added preferences to change logical channel id to mac content type mapping.
svn path=/trunk/; revision=44151
Diffstat (limited to 'asn1/nbap')
-rw-r--r-- | asn1/nbap/packet-nbap-template.c | 249 | ||||
-rw-r--r-- | asn1/nbap/packet-nbap-template.h | 34 |
2 files changed, 144 insertions, 139 deletions
diff --git a/asn1/nbap/packet-nbap-template.c b/asn1/nbap/packet-nbap-template.c index 2514d40b72..c79ff8910a 100644 --- a/asn1/nbap/packet-nbap-template.c +++ b/asn1/nbap/packet-nbap-template.c @@ -36,6 +36,8 @@ #include <epan/asn1.h> #include <epan/conversation.h> #include <epan/expert.h> +#include <epan/prefs.h> +#include <epan/uat.h> #include "packet-per.h" #include "packet-isup.h" @@ -56,7 +58,7 @@ #define NBAP_IGNORE_PORT 255 - + /* Debug */ #if 0 #define nbap_debug0(str) g_warning(str) @@ -124,7 +126,7 @@ typedef struct nbap_dch_channel_info_t nbap_dch_chnl_info[maxNrOfDCHs]; -/* Struct to collect E-DCH data in a packet +/* Struct to collect E-DCH data in a packet * As the address data comes before the ddi entries * we save the address to be able to find the conversation and update the * conversation data. @@ -190,7 +192,7 @@ static guint32 ProcedureCode; static guint32 ProtocolIE_ID; static guint32 ddMode; static const gchar *ProcedureID; -static guint32 t_dch_id, dch_id, prev_dch_id, commonphysicalchannelid, e_dch_macdflow_id, hsdsch_macdflow_id=3, +static guint32 t_dch_id, dch_id, prev_dch_id, commonphysicalchannelid, e_dch_macdflow_id, hsdsch_macdflow_id=3, e_dch_ddi_value,logical_channel_id,common_macdflow_id; static guint32 MACdPDU_Size, commontransportchannelid; static guint num_items; @@ -208,15 +210,79 @@ enum TransportFormatSet_type_enum enum TransportFormatSet_type_enum transportFormatSet_type; -/****************************/ -/* GUI Stuff */ -typedef struct _attribute_type_t { - gchar* attribute_type; - gchar* attribute_desc; -} attribute_type_t; -/*static attribute_type_t* attribute_types = NULL; -static guint num_attribute_types = 0; -static GHashTable* attribute_types_hash = NULL;*/ +/* This table is used externally from FP, MAC and such, TODO: merge this with + * lch_contents[] */ +guint8 lchId_type_table[]= { + MAC_CONTENT_UNKNOWN, /*Should't happen*/ + MAC_CONTENT_DCCH, /* 1 to 4 SRB => DCCH*/ + MAC_CONTENT_DCCH, + MAC_CONTENT_DCCH, + MAC_CONTENT_DCCH, + MAC_CONTENT_CS_DTCH, /* 5 to 7 Conv CS speech => ?*/ + MAC_CONTENT_CS_DTCH, + MAC_CONTENT_CS_DTCH, + MAC_CONTENT_DCCH, /* 8 SRB => DCCH*/ + MAC_CONTENT_PS_DTCH, /* 9 maps to DTCH*/ + MAC_CONTENT_UNKNOWN, /* 10 Conv CS unknown*/ + MAC_CONTENT_PS_DTCH, /* 11 Interactive PS => DTCH*/ + MAC_CONTENT_PS_DTCH, /* 12 Streaming PS => DTCH*/ + MAC_CONTENT_CS_DTCH, /* 13 Streaming CS*/ + MAC_CONTENT_PS_DTCH, /* 14 Interatictive PS => DTCH*/ + MAC_CONTENT_CCCH /* This is CCCH? */ +}; +/* Preference variables */ +static int lch1_content = MAC_CONTENT_DCCH; +static int lch2_content = MAC_CONTENT_DCCH; +static int lch3_content = MAC_CONTENT_DCCH; +static int lch4_content = MAC_CONTENT_DCCH; +static int lch5_content = MAC_CONTENT_CS_DTCH; +static int lch6_content = MAC_CONTENT_CS_DTCH; +static int lch7_content = MAC_CONTENT_CS_DTCH; +static int lch8_content = MAC_CONTENT_DCCH; +static int lch9_content = MAC_CONTENT_PS_DTCH; +static int lch10_content = MAC_CONTENT_UNKNOWN; +static int lch11_content = MAC_CONTENT_PS_DTCH; +static int lch12_content = MAC_CONTENT_PS_DTCH; +static int lch13_content = MAC_CONTENT_CS_DTCH; +static int lch14_content = MAC_CONTENT_PS_DTCH; +static int lch15_content = MAC_CONTENT_CCCH; +static int lch16_content = MAC_CONTENT_DCCH; +/* Array with preference variables for easy looping, TODO: merge this with + * lchId_type_table[] */ +static int * lch_contents[] = {&lch1_content, &lch2_content, &lch3_content, + &lch4_content, &lch5_content, &lch6_content, &lch7_content, &lch8_content, + &lch9_content, &lch10_content, &lch11_content, &lch12_content, &lch13_content, + &lch14_content, &lch15_content, &lch16_content}; +static const enum_val_t content_types[] = { + {"MAC_CONTENT_UNKNOWN", "MAC_CONTENT_UNKNOWN", MAC_CONTENT_UNKNOWN}, + {"MAC_CONTENT_DCCH", "MAC_CONTENT_DCCH", MAC_CONTENT_DCCH}, + {"MAC_CONTENT_PS_DTCH", "MAC_CONTENT_PS_DTCH", MAC_CONTENT_PS_DTCH}, + {"MAC_CONTENT_CS_DTCH", "MAC_CONTENT_CS_DTCH", MAC_CONTENT_CS_DTCH}, + {"MAC_CONTENT_CCCH", "MAC_CONTENT_CCCH", MAC_CONTENT_CCCH}, + {NULL, NULL, -1}}; +typedef struct { + const char *name; + const char *title; + const char *description; +} preference_strings; +/* This is used when registering preferences, name, title, description */ +static const preference_strings ch_strings[] = { + {"lch1_content", "Logical Channel 1 Content", "foo"}, + {"lch2_content", "Logical Channel 2 Content", "foo"}, + {"lch3_content", "Logical Channel 3 Content", "foo"}, + {"lch4_content", "Logical Channel 4 Content", "foo"}, + {"lch5_content", "Logical Channel 5 Content", "foo"}, + {"lch6_content", "Logical Channel 6 Content", "foo"}, + {"lch7_content", "Logical Channel 7 Content", "foo"}, + {"lch8_content", "Logical Channel 8 Content", "foo"}, + {"lch9_content", "Logical Channel 9 Content", "foo"}, + {"lch10_content", "Logical Channel 10 Content", "foo"}, + {"lch11_content", "Logical Channel 11 Content", "foo"}, + {"lch12_content", "Logical Channel 12 Content", "foo"}, + {"lch13_content", "Logical Channel 13 Content", "foo"}, + {"lch14_content", "Logical Channel 14 Content", "foo"}, + {"lch15_content", "Logical Channel 15 Content", "foo"}, + {"lch16_content", "Logical Channel 16 Content", "foo"}}; /* Dissector tables */ static dissector_table_t nbap_ies_dissector_table; @@ -281,7 +347,7 @@ static void add_hsdsch_bind(packet_info *pinfo, proto_tree * tree){ PT_UDP, nbap_hsdsch_channel_info[i].crnc_port, 0, NO_ADDR_B); - + if (conversation == NULL) { /* It's not part of any conversation - create a new one. */ conversation = conversation_new(pinfo->fd->num, &(nbap_hsdsch_channel_info[i].crnc_address), @@ -290,7 +356,7 @@ static void add_hsdsch_bind(packet_info *pinfo, proto_tree * tree){ /* Set dissector */ conversation_set_dissector(conversation, fp_handle); - + if(pinfo->link_dir==P2P_DIR_DL){ umts_fp_conversation_info = se_new0(umts_fp_conversation_info_t); /* Fill in the HSDSCH relevant data */ @@ -302,15 +368,15 @@ static void add_hsdsch_bind(packet_info *pinfo, proto_tree * tree){ umts_fp_conversation_info->ul_frame_number = pinfo->fd->num; SE_COPY_ADDRESS(&(umts_fp_conversation_info->crnc_address), &nbap_hsdsch_channel_info[i].crnc_address); umts_fp_conversation_info->crnc_port = nbap_hsdsch_channel_info[i].crnc_port; - + /*Added june 3, normally just the iterator variable*/ umts_fp_conversation_info->hsdsch_macdflow_id = i ; /*hsdsch_macdflow_ids[i];*/ /* hsdsch_macdflow_id;*/ - + /* Cheat and use the DCH entries */ umts_fp_conversation_info->num_dch_in_flow++; umts_fp_conversation_info->dchs_in_flow_list[umts_fp_conversation_info->num_dch_in_flow -1] = i; - /*XXX: Is this craziness, what is physical_layer? */ + /*XXX: Is this craziness, what is physical_layer? */ if(nbap_hsdsch_channel_info[i].entity == entity_not_specified ){ /*Error*/ expert_add_info_format(pinfo, tree, PI_MALFORMED,PI_ERROR, "HSDSCH Entity not specified!"); @@ -338,9 +404,9 @@ static void nbap_free_key(gpointer key ){ static void nbap_free_value(gpointer value ){ g_free(value); } - + static void nbap_init(void){ - + guint8 i; /*Cleanup*/ if(com_context_map){ g_tree_destroy(com_context_map); @@ -350,6 +416,9 @@ static void nbap_init(void){ NULL, /* data pointer, optional */ nbap_free_key, nbap_free_value); + for (i = 0; i < 15; i++) { + lchId_type_table[i+1] = *lch_contents[i]; + } } static void dissect_nbap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) @@ -368,111 +437,65 @@ dissect_nbap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) for (i = 0; i < maxNrOfMACdFlows; i++) { nbap_hsdsch_channel_info[i].entity = hs; } - - dissect_NBAP_PDU_PDU(tvb, pinfo, nbap_tree); -} - -/*static void -attribute_types_initialize_cb(void) -{ -} -static void -attribute_types_free_cb(void*r _U_) -{ -} -static void -attribute_types_update_cb(void *r _U_, const char **err _U_) -{ - g_warning("Running attr types update"); - + dissect_NBAP_PDU_PDU(tvb, pinfo, nbap_tree); } -static void * -attribute_types_copy_cb(void* n _U_, const void* o _U_, size_t siz _U_) +/*--- proto_register_nbap -------------------------------------------*/ +void proto_register_nbap(void) { + module_t *nbap_module; + guint8 i; + + /* List of fields */ + static hf_register_info hf[] = { + { &hf_nbap_transportLayerAddress_ipv4, + { "transportLayerAddress IPv4", "nbap.transportLayerAddress_ipv4", + FT_IPv4, BASE_NONE, NULL, 0, + NULL, HFILL }}, + { &hf_nbap_transportLayerAddress_ipv6, + { "transportLayerAddress IPv6", "nbap.transportLayerAddress_ipv6", + FT_IPv6, BASE_NONE, NULL, 0, + NULL, HFILL }}, + { &hf_nbap_transportLayerAddress_nsap, + { "transportLayerAddress NSAP", "nbap.transportLayerAddress_NSAP", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL }}, + #include "packet-nbap-hfarr.c" + }; + + /* List of subtrees */ + static gint *ett[] = { + &ett_nbap, + &ett_nbap_TransportLayerAddress, + &ett_nbap_TransportLayerAddress_nsap, + &ett_nbap_ib_sg_data, + #include "packet-nbap-ettarr.c" + }; + + /* Register protocol */ + proto_nbap = proto_register_protocol(PNAME, PSNAME, PFNAME); + /* Register fields and subtrees */ + proto_register_field_array(proto_nbap, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + + /* Register dissector */ + register_dissector("nbap", dissect_nbap, proto_nbap); + + nbap_module = prefs_register_protocol(proto_nbap, NULL); + + /* Register preferences for mapping logical channel IDs to MAC content types. */ + for (i = 0; i < 16; i++) { + prefs_register_enum_preference(nbap_module, ch_strings[i].name, ch_strings[i].title, ch_strings[i].description, lch_contents[i], content_types, FALSE); + } - - return NULL; -}*/ - -/*--- proto_register_nbap -------------------------------------------*/ -void proto_register_nbap(void) { - - /* List of fields */ - - static hf_register_info hf[] = { - { &hf_nbap_transportLayerAddress_ipv4, - { "transportLayerAddress IPv4", "nbap.transportLayerAddress_ipv4", - FT_IPv4, BASE_NONE, NULL, 0, - NULL, HFILL }}, - { &hf_nbap_transportLayerAddress_ipv6, - { "transportLayerAddress IPv6", "nbap.transportLayerAddress_ipv6", - FT_IPv6, BASE_NONE, NULL, 0, - NULL, HFILL }}, - { &hf_nbap_transportLayerAddress_nsap, - { "transportLayerAddress NSAP", "nbap.transportLayerAddress_NSAP", - FT_BYTES, BASE_NONE, NULL, 0, - NULL, HFILL }}, -#include "packet-nbap-hfarr.c" - }; - - /* List of subtrees */ - static gint *ett[] = { - &ett_nbap, - &ett_nbap_TransportLayerAddress, - &ett_nbap_TransportLayerAddress_nsap, - &ett_nbap_ib_sg_data, -#include "packet-nbap-ettarr.c" - }; - - /* UAT for header fields */ - /* static uat_field_t custom_attribute_types_uat_fields[] = { - UAT_FLD_CSTRING(attribute_types, attribute_type, "Attribute type", "Attribute type"), - UAT_FLD_CSTRING(attribute_types, attribute_desc, "Description", "Description of the value matching type"), - UAT_END_FIELDS - }; - */ - /*uat_t *attributes_uat;*/ - - /* Register protocol */ - proto_nbap = proto_register_protocol(PNAME, PSNAME, PFNAME); - /* Register fields and subtrees */ - proto_register_field_array(proto_nbap, hf, array_length(hf)); - proto_register_subtree_array(ett, array_length(ett)); - - /* Register dissector */ - register_dissector("nbap", dissect_nbap, proto_nbap); - - /* Setting up GUI stuff*/ - /* UAT */ - /*attributes_uat = uat_new("Custom NBAP maps", - sizeof(attribute_type_t), - "custom_ldap_attribute_types", - TRUE, - (void*) &attribute_types, - &num_attribute_types, - UAT_CAT_FIELDS, - NULL, - attribute_types_copy_cb, - attribute_types_update_cb, - attribute_types_free_cb, - attribute_types_initialize_cb, - custom_attribute_types_uat_fields);*/ - - /*prefs_register_uat_preference(nbap_module, "custom_ldap_attribute_types", - "Custom AttributeValue types", - "A table to define custom LDAP attribute type values for which fields can be setup and used for filtering/data extraction etc.", - attributes_uat);*/ - - /* Register dissector tables */ + /* Register dissector tables */ nbap_ies_dissector_table = register_dissector_table("nbap.ies", "NBAP-PROTOCOL-IES", FT_UINT32, BASE_DEC); nbap_extension_dissector_table = register_dissector_table("nbap.extension", "NBAP-PROTOCOL-EXTENSION", FT_UINT32, BASE_DEC); nbap_proc_imsg_dissector_table = register_dissector_table("nbap.proc.imsg", "NBAP-ELEMENTARY-PROCEDURE InitiatingMessage", FT_STRING, BASE_NONE); nbap_proc_sout_dissector_table = register_dissector_table("nbap.proc.sout", "NBAP-ELEMENTARY-PROCEDURE SuccessfulOutcome", FT_STRING, BASE_NONE); nbap_proc_uout_dissector_table = register_dissector_table("nbap.proc.uout", "NBAP-ELEMENTARY-PROCEDURE UnsuccessfulOutcome", FT_STRING, BASE_NONE); - register_init_routine(nbap_init); } diff --git a/asn1/nbap/packet-nbap-template.h b/asn1/nbap/packet-nbap-template.h index f0208c3c7c..659e5ec555 100644 --- a/asn1/nbap/packet-nbap-template.h +++ b/asn1/nbap/packet-nbap-template.h @@ -26,30 +26,12 @@ /* * Ericsson specific mapping for various dissector settings. - * Must be altered for other equipment. + * Must be altered for other equipment. */ - + /*Array are indexed on logical channel id, meaning they need to be defined for 1-15*/ /* Mapping from logical channel id to MAC content type ie. DCCH or DTCH*/ -static const guint8 lchId_type_table[]= { - MAC_CONTENT_UNKNOWN, /*Should't happen*/ - MAC_CONTENT_DCCH, /* 1 to 4 SRB => DCCH*/ - MAC_CONTENT_DCCH, - MAC_CONTENT_DCCH, - MAC_CONTENT_DCCH, - MAC_CONTENT_CS_DTCH, /* 5 to 7 Conv CS speech => ?*/ - MAC_CONTENT_CS_DTCH, - MAC_CONTENT_CS_DTCH, - MAC_CONTENT_DCCH, /* 8 SRB => DCCH*/ - MAC_CONTENT_PS_DTCH, /* 9 maps to DTCH*/ - MAC_CONTENT_UNKNOWN, /* 10 Conv CS unknown*/ - MAC_CONTENT_PS_DTCH, /* 11 Interactive PS => DTCH*/ - MAC_CONTENT_PS_DTCH, /* 12 Streaming PS => DTCH*/ - MAC_CONTENT_CS_DTCH, /* 13 Streaming CS*/ - MAC_CONTENT_PS_DTCH, /* 14 Interatictive PS => DTCH*/ - MAC_CONTENT_CCCH /* This is CCCH? */ - -}; +extern guint8 lchId_type_table[]; /* Mapping logicalchannel id to RLC_MODE */ static const guint8 lchId_rlc_map[] = { @@ -70,7 +52,7 @@ static const guint8 lchId_rlc_map[] = { RLC_AM, RLC_AM, /* This is CCCH which is UM?, probably not */ }; - + /* 1 to 8*/ static const guint8 hsdsch_macdflow_id_rlc_map[] = { RLC_UM, /*1 SRB */ @@ -81,7 +63,7 @@ static const guint8 hsdsch_macdflow_id_rlc_map[] = { RLC_UNKNOWN_MODE, RLC_UNKNOWN_MODE }; - + /* Mapping hsdsch MACd-FlowId to MAC_CONTENT, basically flowid = 1 (0) => SRB*/ /* 1 to 8*/ static const guint8 hsdsch_macdflow_id_mac_content_map[] = { @@ -92,14 +74,14 @@ static const guint8 hsdsch_macdflow_id_mac_content_map[] = { MAC_CONTENT_PS_DTCH, /*5 Streaming PS*/ RLC_UNKNOWN_MODE, RLC_UNKNOWN_MODE, - RLC_UNKNOWN_MODE + RLC_UNKNOWN_MODE }; - + /* Make fake logical channel id's based on MACdFlow-ID's*/ static const guint8 fake_lchid_macd_flow[] = {1,9,14,11,0,12}; static const value_string lchid_name_resolve[] = { - {1,"DCCH"}, /* 1 to 4 SRB => DCCH*/ + {1,"DCCH"}, /* 1 to 4 SRB => DCCH*/ {2,"DCCH"}, {3,"DCCH"}, {4,"DCCH"}, |