diff options
author | Anders Broman <anders.broman@ericsson.com> | 2010-12-26 21:06:08 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2010-12-26 21:06:08 +0000 |
commit | 356aced5bf207de000a51609a4c7d84da56b2938 (patch) | |
tree | 0fd91d420faa30e08952d96b08485af403bde9ac /epan | |
parent | c7f11d2926b6e7ec2a8ae5d73381831e3b7a2440 (diff) |
Start of a SGSAP (TS 29.118) dissector for LTE.
svn path=/trunk/; revision=35266
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/Makefile.common | 1 | ||||
-rw-r--r-- | epan/dissectors/packet-gsm_a_bssmap.c | 166 | ||||
-rw-r--r-- | epan/dissectors/packet-gsm_a_common.c | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-gsm_a_common.h | 25 | ||||
-rw-r--r-- | epan/dissectors/packet-sgsap.c | 1232 |
5 files changed, 1340 insertions, 90 deletions
diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common index 9f9a602b40..de763ee9a2 100644 --- a/epan/dissectors/Makefile.common +++ b/epan/dissectors/Makefile.common @@ -148,6 +148,7 @@ ASN1_DISSECTOR_SRC = \ packet-s1ap.c \ packet-s4406.c \ packet-sabp.c \ + packet-sgsap.c \ packet-smrse.c \ packet-spnego.c \ packet-sv.c \ diff --git a/epan/dissectors/packet-gsm_a_bssmap.c b/epan/dissectors/packet-gsm_a_bssmap.c index 5b9a8fe019..eb50c3dd2e 100644 --- a/epan/dissectors/packet-gsm_a_bssmap.c +++ b/epan/dissectors/packet-gsm_a_bssmap.c @@ -61,6 +61,10 @@ const value_string gsm_a_bssmap_msg_strings[] = { { 0x01, "Assignment Request" }, { 0x02, "Assignment Complete" }, { 0x03, "Assignment Failure" }, + { 0x04, "VGCS/VBS Setup" }, + { 0x05, "VGCS/VBS Setup Ack" }, + { 0x06, "VGCS/VBS Setup Refuse" }, + { 0x07, "VGCS/VBS Assignment Request" }, { 0x08, "Channel Modify request" }, { 0x10, "Handover Request" }, { 0x11, "Handover Required" }, @@ -85,6 +89,7 @@ const value_string gsm_a_bssmap_msg_strings[] = { { 0x24, "Reserved" }, { 0x25, "SAPI 'n' Reject" }, { 0x26, "Confusion" }, + { 0x27, "Uplink Request Acknowledge" }, { 0x28, "Suspend" }, { 0x29, "Resume" }, { 0x2a, "Connection Oriented Information" }, @@ -113,6 +118,11 @@ const value_string gsm_a_bssmap_msg_strings[] = { { 0x46, "Circuit Group Unblock" }, { 0x47, "Circuit Group Unblocking Acknowledge" }, { 0x48, "Unequipped Circuit" }, + { 0x49, "Uplink Request Confirmation" }, + { 0x4a, "Uplink Release Indication" }, + { 0x4b, "Uplink Reject Command" }, + { 0x4c, "Uplink Release Command" }, + { 0x4d, "Uplink Seized Command" }, { 0x4e, "Change Circuit" }, { 0x4f, "Change Circuit Acknowledge" }, { 0x50, "Resource Request" }, @@ -126,20 +136,10 @@ const value_string gsm_a_bssmap_msg_strings[] = { { 0x58, "Classmark Request" }, { 0x59, "Cipher Mode Reject" }, { 0x5a, "Load Indication" }, - { 0x04, "VGCS/VBS Setup" }, - { 0x05, "VGCS/VBS Setup Ack" }, - { 0x06, "VGCS/VBS Setup Refuse" }, - { 0x07, "VGCS/VBS Assignment Request" }, { 0x1c, "VGCS/VBS Assignment Result" }, { 0x1d, "VGCS/VBS Assignment Failure" }, { 0x1e, "VGCS/VBS Queuing Indication" }, { 0x1f, "Uplink Request" }, - { 0x27, "Uplink Request Acknowledge" }, - { 0x49, "Uplink Request Confirmation" }, - { 0x4a, "Uplink Release Indication" }, - { 0x4b, "Uplink Reject Command" }, - { 0x4c, "Uplink Release Command" }, - { 0x4d, "Uplink Seized Command" }, { 0x50, "VGCS Additional Information" }, { 0x51, "VGCS SMS" }, { 0x52, "Notification Data" }, @@ -6127,92 +6127,92 @@ bssmap_reset_res_ack(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) static gint ett_gsm_bssmap_msg[NUM_GSM_BSSMAP_MSG]; static void (*bssmap_msg_fcn[])(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) = { - bssmap_ass_req, /* Assignment Request */ - bssmap_ass_complete, /* Assignment Complete */ - bssmap_ass_failure, /* Assignment Failure */ - bssmap_chan_mod_req, /* Channel Modify request */ - bssmap_ho_req, /* Handover Request */ - bssmap_ho_reqd, /* Handover Required */ - bssmap_ho_req_ack, /* Handover Request Acknowledge */ - bssmap_ho_cmd, /* Handover Command */ - bssmap_ho_complete, /* Handover Complete */ - bssmap_ho_succ , /* Handover Succeeded */ - bssmap_ho_failure, /* Handover Failure */ - bssmap_ho_performed, /* Handover Performed */ - bssmap_ho_cand_enq, /* Handover Candidate Enquire */ - bssmap_ho_cand_resp, /* Handover Candidate Response */ - bssmap_ho_reqd_rej, /* Handover Required Reject */ - bssmap_ho_det, /* Handover Detect */ - bssmap_int_ho_req, /* Internal Handover Required */ - bssmap_int_ho_req_rej, /* Internal Handover Required Reject */ - bssmap_int_ho_cmd, /* Internal Handover Command */ - bssmap_int_ho_enq, /* Internal Handover Enquiry */ - bssmap_clear_cmd, /* Clear Command */ + bssmap_ass_req, /* Assignment Request */ + bssmap_ass_complete, /* Assignment Complete */ + bssmap_ass_failure, /* Assignment Failure */ + bssmap_vgcs_vbs_setup, /* VGCS/VBS Setup */ + bssmap_vgcs_vbs_setup_ack, /* VGCS/VBS Setup Ack */ + bssmap_vgcs_vbs_setup_refuse, /* VGCS/VBS Setup Refuse */ + bssmap_vgcs_vbs_ass_req, /* VGCS/VBS Assignment Request */ + bssmap_chan_mod_req, /* Channel Modify request */ + bssmap_ho_req, /* Handover Request */ + bssmap_ho_reqd, /* Handover Required */ + bssmap_ho_req_ack, /* Handover Request Acknowledge */ + bssmap_ho_cmd, /* Handover Command */ + bssmap_ho_complete, /* Handover Complete */ + bssmap_ho_succ , /* Handover Succeeded */ + bssmap_ho_failure, /* Handover Failure */ + bssmap_ho_performed, /* Handover Performed */ + bssmap_ho_cand_enq, /* Handover Candidate Enquire */ + bssmap_ho_cand_resp, /* Handover Candidate Response */ + bssmap_ho_reqd_rej, /* Handover Required Reject */ + bssmap_ho_det, /* Handover Detect */ + bssmap_int_ho_req, /* Internal Handover Required */ + bssmap_int_ho_req_rej, /* Internal Handover Required Reject */ + bssmap_int_ho_cmd, /* Internal Handover Command */ + bssmap_int_ho_enq, /* Internal Handover Enquiry */ + bssmap_clear_cmd, /* Clear Command */ NULL /* no associated data */, /* Clear Complete */ - bssmap_clear_req, /* Clear Request */ - NULL, /* Reserved */ - NULL, /* Reserved */ - bssmap_sapi_rej, /* SAPI 'n' Reject */ - bssmap_confusion, /* Confusion */ - bssmap_sus, /* Suspend */ - bssmap_res, /* Resume */ - bssmap_conn_oriented, /* Connection Oriented Information */ - bssmap_perf_loc_req, /* Perform Location Request */ - bssmap_lsa_info, /* LSA Information */ - bssmap_perf_loc_res, /* Perform Location Response */ - bssmap_perf_loc_abort, /* Perform Location Abort */ - bssmap_common_id, /* Common Id */ - bssmap_reset, /* Reset */ + bssmap_clear_req, /* Clear Request */ + NULL, /* Reserved */ + NULL, /* Reserved */ + bssmap_sapi_rej, /* SAPI 'n' Reject */ + bssmap_confusion, /* Confusion */ + bssmap_uplink_req_ack, /* Uplink Request Acknowledge */ + bssmap_sus, /* Suspend */ + bssmap_res, /* Resume */ + bssmap_conn_oriented, /* Connection Oriented Information */ + bssmap_perf_loc_req, /* Perform Location Request */ + bssmap_lsa_info, /* LSA Information */ + bssmap_perf_loc_res, /* Perform Location Response */ + bssmap_perf_loc_abort, /* Perform Location Abort */ + bssmap_common_id, /* Common Id */ + bssmap_reset, /* Reset */ NULL /* no associated data */, /* Reset Acknowledge */ - bssmap_overload, /* Overload */ - NULL, /* Reserved */ - bssmap_reset_cct, /* Reset Circuit */ - bssmap_reset_cct_ack, /* Reset Circuit Acknowledge */ + bssmap_overload, /* Overload */ + NULL, /* Reserved */ + bssmap_reset_cct, /* Reset Circuit */ + bssmap_reset_cct_ack, /* Reset Circuit Acknowledge */ bssmap_msc_invoke_trace, /* MSC Invoke Trace */ bssmap_bss_invoke_trace, /* BSS Invoke Trace */ - NULL, /* Connectionless Information */ - bssmap_reset_res, /* Reset Resource */ - bssmap_reset_res_ack, /* Reset Resource Acknowledge */ - bssmap_block, /* Block */ - bssmap_block_ack, /* Blocking Acknowledge */ - bssmap_unblock, /* Unblock */ - bssmap_unblock_ack, /* Unblocking Acknowledge */ - bssmap_cct_group_block, /* Circuit Group Block */ + NULL, /* Connectionless Information */ + bssmap_reset_res, /* Reset Resource */ + bssmap_reset_res_ack, /* Reset Resource Acknowledge */ + bssmap_block, /* Block */ + bssmap_block_ack, /* Blocking Acknowledge */ + bssmap_unblock, /* Unblock */ + bssmap_unblock_ack, /* Unblocking Acknowledge */ + bssmap_cct_group_block, /* Circuit Group Block */ bssmap_cct_group_block_ack, /* Circuit Group Blocking Acknowledge */ bssmap_cct_group_unblock, /* Circuit Group Unblock */ bssmap_cct_group_unblock_ack, /* Circuit Group Unblocking Acknowledge */ - bssmap_unequipped_cct, /* Unequipped Circuit */ - bssmap_change_cct, /* Change Circuit */ - bssmap_change_cct_ack, /* Change Circuit Acknowledge */ - bssmap_res_req, /* Resource Request */ - bssmap_res_ind, /* Resource Indication */ - bssmap_paging, /* Paging */ - bssmap_ciph_mode_cmd, /* Cipher Mode Command */ - bssmap_cm_upd, /* Classmark Update */ + bssmap_unequipped_cct, /* Unequipped Circuit */ + bssmap_uplink_req_conf, /* Uplink Request Confirmation */ + bssmap_uplink_rel_ind, /* Uplink Release Indication */ + bssmap_uplink_rej_cmd, /* Uplink Reject Command */ + bssmap_uplink_rel_cmd, /* Uplink Release Command */ + bssmap_uplink_seized_cmd, /* Uplink Seized Command */ + bssmap_change_cct, /* Change Circuit */ + bssmap_change_cct_ack, /* Change Circuit Acknowledge */ + bssmap_res_req, /* Resource Request */ + bssmap_res_ind, /* Resource Indication */ + bssmap_paging, /* Paging */ + bssmap_ciph_mode_cmd, /* Cipher Mode Command */ + bssmap_cm_upd, /* Classmark Update */ bssmap_ciph_mode_complete, /* Cipher Mode Complete */ NULL /* no associated data */, /* Queuing Indication */ - bssmap_cl3_info, /* Complete Layer 3 Information */ + bssmap_cl3_info, /* Complete Layer 3 Information */ bssmap_cls_m_req /* no associated data */, /* Classmark Request */ - bssmap_ciph_mode_rej, /* Cipher Mode Reject */ - bssmap_load_ind, /* Load Indication */ - bssmap_vgcs_vbs_setup, /* VGCS/VBS Setup */ - bssmap_vgcs_vbs_setup_ack, /* VGCS/VBS Setup Ack */ - bssmap_vgcs_vbs_setup_refuse, /* VGCS/VBS Setup Refuse */ - bssmap_vgcs_vbs_ass_req, /* VGCS/VBS Assignment Request */ + bssmap_ciph_mode_rej, /* Cipher Mode Reject */ + bssmap_load_ind, /* Load Indication */ bssmap_vgcs_vbs_ass_res, /* VGCS/VBS Assignment Result */ bssmap_vgcs_vbs_ass_fail, /* VGCS/VBS Assignment Failure */ - NULL, /* No dsta VGCS/VBS Queuing Indication */ - bssmap_uplink_req, /* Uplink Request */ - bssmap_uplink_req_ack, /* Uplink Request Acknowledge */ - bssmap_uplink_req_conf, /* Uplink Request Confirmation */ - bssmap_uplink_rel_ind, /* Uplink Release Indication */ - bssmap_uplink_rej_cmd, /* Uplink Reject Command */ - bssmap_uplink_rel_cmd, /* Uplink Release Command */ - bssmap_uplink_seized_cmd, /* Uplink Seized Command */ - bssmap_vgcs_add_inf, /* VGCS Additional Information */ - bssmap_vgcs_sms, /* VGCS SMS */ + NULL, /* No dsta VGCS/VBS Queuing Indication */ + bssmap_uplink_req, /* Uplink Request */ + bssmap_vgcs_add_inf, /* VGCS Additional Information */ + bssmap_vgcs_sms, /* VGCS SMS */ bssmap_notification_data, /* Notification Data*/ - bssmap_uplink_app_data, /* Uplink Application Data */ + bssmap_uplink_app_data, /* Uplink Application Data */ NULL, /* NONE */ }; diff --git a/epan/dissectors/packet-gsm_a_common.c b/epan/dissectors/packet-gsm_a_common.c index d94f654c13..068b91cd5b 100644 --- a/epan/dissectors/packet-gsm_a_common.c +++ b/epan/dissectors/packet-gsm_a_common.c @@ -942,6 +942,9 @@ const char* get_gsm_a_msg_string(int pdu_type, int idx) case NAS_PDU_TYPE_ESM: msg_string = nas_esm_elem_strings[idx].strptr; break; + case SGSAP_PDU_TYPE: + msg_string = sgsap_elem_strings[idx].strptr; + break; default: DISSECTOR_ASSERT_NOT_REACHED(); } @@ -987,6 +990,9 @@ static int get_hf_elem_id(int pdu_type) case NAS_PDU_TYPE_ESM: hf_elem_id = hf_nas_eps_esm_elem_id; break; + case SGSAP_PDU_TYPE: + hf_elem_id = hf_sgsap_elem_id; + break; default: DISSECTOR_ASSERT_NOT_REACHED(); } diff --git a/epan/dissectors/packet-gsm_a_common.h b/epan/dissectors/packet-gsm_a_common.h index d8bb0de7ff..1a4cdf6380 100644 --- a/epan/dissectors/packet-gsm_a_common.h +++ b/epan/dissectors/packet-gsm_a_common.h @@ -140,6 +140,11 @@ extern gint ett_nas_eps_esm_elem[]; extern elem_fcn esm_elem_fcn[]; extern int hf_nas_eps_esm_elem_id; +extern const value_string sgsap_elem_strings[]; +extern gint ett_sgsap_elem[]; +extern elem_fcn sgsap_elem_fcn[]; +extern int hf_sgsap_elem_id; + extern sccp_msg_info_t* sccp_msg; extern sccp_assoc_info_t* sccp_assoc; @@ -167,17 +172,18 @@ extern int hf_gsm_a_lac; /* flags for the packet-gsm_a_common routines */ #define GSM_A_PDU_TYPE_BSSMAP 0 /* BSSAP_PDU_TYPE_BSSMAP i.e. 0 - until split complete at least! */ -#define GSM_A_PDU_TYPE_DTAP 1 /* BSSAP_PDU_TYPE_DTAP i.e. 1 - until split complete at least! */ -#define GSM_A_PDU_TYPE_RP 2 -#define GSM_A_PDU_TYPE_RR 3 +#define GSM_A_PDU_TYPE_DTAP 1 /* BSSAP_PDU_TYPE_DTAP i.e. 1 - until split complete at least! */ +#define GSM_A_PDU_TYPE_RP 2 +#define GSM_A_PDU_TYPE_RR 3 #define GSM_A_PDU_TYPE_COMMON 4 -#define GSM_A_PDU_TYPE_GM 5 +#define GSM_A_PDU_TYPE_GM 5 #define GSM_A_PDU_TYPE_BSSLAP 6 #define GSM_A_PDU_TYPE_SACCH 7 #define GSM_PDU_TYPE_BSSMAP_LE 8 -#define NAS_PDU_TYPE_COMMON 9 -#define NAS_PDU_TYPE_EMM 10 -#define NAS_PDU_TYPE_ESM 11 +#define NAS_PDU_TYPE_COMMON 9 +#define NAS_PDU_TYPE_EMM 10 +#define NAS_PDU_TYPE_ESM 11 +#define SGSAP_PDU_TYPE 12 extern const char* get_gsm_a_msg_string(int pdu_type, int idx); @@ -287,6 +293,11 @@ extern const char* get_gsm_a_msg_string(int pdu_type, int idx); SEV_elem_ett = ett_nas_eps_esm_elem; \ SEV_elem_funcs = esm_elem_fcn; \ break; \ + case SGSAP_PDU_TYPE: \ + SEV_elem_names = sgsap_elem_strings; \ + SEV_elem_ett = ett_sgsap_elem; \ + SEV_elem_funcs = sgsap_elem_fcn; \ + break; \ default: \ proto_tree_add_text(tree, \ tvb, curr_offset, -1, \ diff --git a/epan/dissectors/packet-sgsap.c b/epan/dissectors/packet-sgsap.c new file mode 100644 index 0000000000..265a3727da --- /dev/null +++ b/epan/dissectors/packet-sgsap.c @@ -0,0 +1,1232 @@ +/* packet-sgsap.c + * Routines for SGs Application Part (SGsAP) protocol dissection + * + * Copyright 2010, Anders Broman <anders.broman@ericsson.com> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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. + * + * References: 3GPP TS 29.118 V10.2.0 (2010-12) + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include <glib.h> +#include <epan/packet.h> +#include <epan/asn1.h> + +#include "packet-gsm_a_common.h" + +#define PNAME "SGs Application Part (SGsAP)" +#define PSNAME "SGSAP" +#define PFNAME "sgsap" + +/* The registered SCTP port number for SGsAP is 29118. + * The payload protocol identifier to be used for SGsAP is 0. + */ +#define SCTP_PORT_SGSAP 29118 + + +/* Global variables */ +static guint gbl_sgsapSctpPort=SCTP_PORT_SGSAP; + + +/* Initialize the protocol and registered fields */ +static int proto_sgsap = -1; + +static int hf_sgsap_msg_type = -1; +int hf_sgsap_elem_id = -1; +static int hf_sgsap_eps_location_update_type = -1; +static int hf_sgsap_service_indicator_value = -1; +static int hf_sgsap_sgs_cause = -1; + +static int ett_sgsap = -1; + +/* + * 9.4 Information elements + */ +/* + * 9.4.1 CLI + */ + +/* + * Octets 3 to 14 contain the value part of the Calling party BCD number information element + * defined in subclause 10.5.4.9 of 3GPP TS 24.008 [8] (octets 3 to 14, i.e. not including + * 3GPP TS 24.008 IEI and 3GPP TS 24.008 length indicator) + * ( packet-gsm_a_dtap.c ) + */ +/* + * 9.4.2 EPS location update type + */ + +/* EPS location update type value (octet 3) */ +static const value_string sgsap_eps_location_update_type_values[] = { + { 0x00, "Shall not be sent in this version of the protocol" }, + { 0x01, "IMSI attach" }, + { 0x02, "Normal location update" }, + { 0, NULL } +}; + +static guint16 +de_sgsap_eps_loc_upd_type(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) +{ + guint32 curr_offset; + + curr_offset = offset; + + /* Octet 3 EPS location update type value */ + proto_tree_add_item(tree, hf_sgsap_eps_location_update_type, tvb, offset, 1, FALSE); + curr_offset++; + + return(curr_offset - offset); +} +/* + * 9.4.3 Erroneous message + * + * See subclause 18.4.5 in 3GPP TS 29.018 [16]. + */ +static guint16 +de_sgsap_err_msg(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) +{ + guint32 curr_offset; + + curr_offset = offset; + + proto_tree_add_text(tree, tvb, curr_offset, len, "IE data not dissected yet"); + + return(len); +} +/* + * 9.4.3a E-UTRAN Cell Global Identity + * + * The coding of the E-UTRAN Cell Global Identity value is according to ECGI field information element + * as specified in subclause 8.21.5 of 3GPP TS 29.274 [17A] + */ +/* + * 9.4.4 Global CN-Id + * + * See subclause 18.4.27 in 3GPP TS 29.018 [16]. + */ +/* + * 9.4.5 IMEISV + * See subclause 18.4.9 in 3GPP TS 29.018 [16]. + */ +/* + * 9.4.6 IMSI + * See subclause 18.4.10 in 3GPP TS 29.018 [16]. + */ +/* + * 9.4.7 IMSI detach from EPS service type + */ +/* + * 9.4.8 IMSI detach from non-EPS service type + */ +/* + * 9.4.9 LCS client identity + */ +/* + * 9.4.10 LCS indicator + */ +/* + * 9.4.11 Location area identifier + * + * Octets 3 to 7 contain the value part of the Location area identification information element + * defined in 3GPP TS 24.008 [8] (starting with octet 2, i.e. not including 3GPP TS 24.008 IEI) + */ +/* + * 9.4.12 MM information + */ +/* + * 9.4.13 MME name + */ +static guint16 +de_sgsap_mme_name(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) +{ + guint32 curr_offset; + + curr_offset = offset; + + proto_tree_add_text(tree, tvb, curr_offset, len, "IE data not dissected yet"); + + return(len); +} +/* + * 9.4.14 Mobile identity + * See subclause 18.4.17 in 3GPP TS 29.018 [16]. + */ +/* + * 9.4.14a Mobile Station Classmark 2 + * With the exception of the IEI, the contents are specified in subclause 10.5.1.6 in 3GPP TS 24.008 [8]. + */ +/* + * 9.4.15 NAS message container + * Octets 3 to 253 contain the SMS message (i.e. CP DATA, CP ACK or CP ERROR) as defined in subclause 7.2 of 3GPP TS 24.011 [10] + */ +/* + * 9.4.16 Reject cause + * See subclause 18.4.21 in 3GPP TS 29.018 [16]. + */ +/* + * 9.4.17 Service indicator + */ + +/* Octet 3 Service indicator value */ +static const value_string sgsap_service_indicator_values[] = { + { 0x00, "Shall not be sent in this version of the protocol" }, + { 0x01, "CS call indicator" }, + { 0x02, "SMS indicator" }, + { 0, NULL } +}; + +static guint16 +de_sgsap_serv_indic(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) +{ + guint32 curr_offset; + + curr_offset = offset; + + /* Octet 3 Service indicator value */ + proto_tree_add_item(tree, hf_sgsap_service_indicator_value, tvb, offset, 1, FALSE); + curr_offset++; + + return(curr_offset - offset); +} +/* + * 9.4.18 SGs cause + */ + +/* SGs cause value (octet 3) */ +static const value_string sgsap_sgs_cause_values[] = { + { 0x00, "Normal, unspecified in this version of the protocol" }, + { 0x01, "IMSI detached for EPS services" }, + { 0x02, "IMSI detached for EPS and non-EPS services" }, + { 0x03, "IMSI unknown" }, + { 0x04, "IMSI detached for non-EPS services" }, + { 0x05, "IMSI implicitly detached for non-EPS services" }, + { 0x06, "UE unreachable" }, + { 0x07, "Message not compatible with the protocol state" }, + { 0x08, "Missing mandatory information element" }, + { 0x09, "Invalid mandatory information" }, + { 0x0a, "Conditional information element error" }, + { 0x0b, "Semantically incorrect message" }, + { 0x0c, "Message unknown" }, + { 0x0d, "Mobile terminating CS fallback call rejected by the user" }, + { 0, NULL } +}; + +static guint16 +de_sgsap_sgs_cause(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) +{ + guint32 curr_offset; + + curr_offset = offset; + + /* Octet 3 Service indicator value */ + proto_tree_add_item(tree, hf_sgsap_sgs_cause, tvb, offset, 1, FALSE); + curr_offset++; + + return(curr_offset - offset); +} +/* + * 9.4.19 SS code + * The coding of the SS code value is according to SS-Code as specified in subclause 17.7.5 of 3GPP TS 29.002 [15] + */ +/* + * 9.4.20 TMSI + * See subclause 18.4.23 in 3GPP TS 29.018 [16]. + */ +/* + * 9.4.21 TMSI status + * + * See subclause 18.4.24 in 3GPP TS 29.018 [16]. + */ +/* + * 9.4.21a Tracking Area Identity + * Octets 3 to 7 contain the value part of the Tracking Area Identity information element defined in 3GPP TS 24.301 [14] + * (starting with octet 2, i.e. not including 3GPP TS 24.301 IEI) + */ +/* + * 9.4.21b UE Time Zone + * The coding of the UE Time Zone value is according to value part of the Time Zone information element as specified + * in subclause 10.5.3.8 of 3GPP TS 24.008 [8] (i.e. not including 3GPP TS 24.008 IEI) + */ +/* + * 9.4.21c UE EMM mode + */ +/* + * 9.4.22 VLR name + */ +static guint16 +de_sgsap_vlr_name(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) +{ + guint32 curr_offset; + + curr_offset = offset; + /* The VLR name information element specifies the VLR name and is coded as shown in figure 9.4.22.1. + * Octets 3 through n contain the VLR name in the form of a fully qualified domain name (FQDN) + * as specified in IETF RFC 1035 [21]. + */ + proto_tree_add_text(tree, tvb, curr_offset, len, "IE data not dissected yet"); + + return(len); +} + +/* + * 9.4.23 Channel needed + */ +/* + * 9.4.24 eMLPP priority + */ + +const value_string sgsap_elem_strings[] = { + { 0x01, "IMSI" }, /* 9.4.6 */ + { 0x02, "VLR name" }, /* 9.4.22 */ + { 0x03, "TMSI" }, /* 9.4.20 */ + { 0x04, "Location area identifier" }, /* 9.4.11 */ + { 0x05, "Channel Needed" }, /* 9.4.23 */ + { 0x06, "eMLPP Priority" }, /* 9.4.24 */ + { 0x07, "TMSI status" }, /* 9.4.21 */ + { 0x08, "SGs cause" }, /* 9.4.18 */ + { 0x09, "MME name" }, /* 9.4.13 */ + { 0x0a, "EPS location update type" }, /* 9.4.2 */ + { 0x0b, "Global CN-Id" }, /* 9.4.4 */ + + { 0x0c, "Undefined" }, /* */ + { 0x0d, "Undefined" }, /* */ + + { 0x0e, "Mobile identity" }, /* 9.4.14 */ + { 0x0f, "Reject cause" }, /* 9.4.16 */ + { 0x10, "IMSI detach from EPS service type" }, /* 9.4.7 */ + { 0x11, "IMSI detach from non-EPS service type" }, /* 9.4.8 */ + + { 0x15, "IMEISV" }, /* 9.4.5 */ + { 0x16, "NAS message container" }, /* 9.4.15 */ + { 0x17, "MM information" }, /* 9.4.12 */ + + { 0x18, "Undefined" }, /* */ + { 0x19, "Undefined" }, /* */ + { 0x1a, "Undefined" }, /* */ + + { 0x1b, "Erroneous message" }, /* 9.4.3 */ + { 0x1c, "CLI" }, /* 9.4.1 */ + { 0x1d, "LCS client identity" }, /* 9.4.9 */ + { 0x1e, "LCS indicator" }, /* 9.4.10 */ + { 0x1f, "SS code" }, /* 9.4.19 */ + { 0x20, "Service indicator" }, /* 9.4.17 */ + { 0x21, "UE Time Zone" }, /* 9.4.21b */ + { 0x22, "Mobile Station Classmark 2" }, /* 9.4.14a */ + { 0x23, "Tracking Area Identity" }, /* 9.4.21a */ + { 0x24, "E-UTRAN Cell Global Identity" }, /* 9.4.3a */ + { 0x25, "UE EMM mode" }, /* 9.4.21c */ + + { 0, NULL } +}; + +#define NUM_SGSAP_ELEM (sizeof(sgsap_elem_strings)/sizeof(value_string)) +gint ett_sgsap_elem[NUM_SGSAP_ELEM]; + +typedef enum +{ + + DE_SGSAP_IMSI, /* 9.4.6 IMSI*/ + DE_SGSAP_VLR_NAME, /* 9.4.22 VLR name*/ + DE_SGSAP_TMSI, /* 9.4.20 TMSI */ + DE_SGSAP_LOC_AREA_ID, /* 9.4.11 Location area identifier */ + DE_SGSAP_CH_NEEDED, /* 9.4.23 Channel Needed */ + DE_SGSAP_EMLPP_PRIO, /* 9.4.24 eMLPP Priority*/ + DE_SGSAP_TMSI_STATUS, /* 9.4.21 TMSI status */ + DE_SGSAP_SGS_CAUSE, /* 9.4.18 SGs cause*/ + DE_SGSAP_MME_NAME, /* 9.4.13 MME name*/ + DE_SGSAP_EPS_LOC_UPD_TYPE, /* 9.4.2 EPS location update type*/ + DE_SGSAP_GLOBAL_CN_ID, /* 9.4.4 Global CN-Id*/ + + DE_SGSAP_UDEF_12, /* Undefined */ + DE_SGSAP_UDEF_13, /* Undefined */ + + DE_SGSAP_MID, /* 9.4.14 Mobile identity*/ + DE_SGSAP_REJ_CAUSE, /* 9.4.16 Reject cause */ + DE_SGSAP_IMSI_DET_EPS, /* 9.4.7 IMSI detach from EPS service type */ + DE_SGSAP_IMSI_DET_NON_EPS, /* 9.4.8 IMSI detach from non-EPS service type */ + + DE_SGSAP_IMEISV, /* 9.4.5 IMEISV */ + DE_SGSAP_NAS_MSG_CONTAINER, /* 9.4.15 NAS message container*/ + DE_SGSAP_MM_INFO, /* 9.4.12 MM information*/ + + DE_SGSAP_UDEF_24, /* Undefined */ + DE_SGSAP_UDEF_25, /* Undefined */ + DE_SGSAP_UDEF_26, /* Undefined */ + + DE_SGSAP_ERR_MSG, /* 9.4.3 Erroneous message*/ + DE_SGSAP_CLI, /* 9.4.1 CLI */ + DE_SGSAP_LCS_CLIENT_ID, /* 9.4.9 LCS client identity */ + DE_SGSAP_LCS_INDIC, /* 9.4.10 LCS indicator */ + DE_SGSAP_SS_CODE, /* 9.4.19 SS code */ + DE_SGSAP_SERV_INDIC, /* 9.4.17 Service indicator */ + DE_SGSAP_UE_TZ, /* 9.4.21b UE Time Zone */ + DE_SGSAP_MSC_2, /* 9.4.14a Mobile Station Classmark 2 */ + DE_SGSAP_TAID, /* 9.4.21a Tracking Area Identity */ + DE_SGSAP_E_UTRAN_CGI, /* 9.4.3a E-UTRAN Cell Global Identity */ + DE_SGSAP_UE_EMM_MODE, /* 9.4.21c UE EMM mode*/ + + DE_SGAP_NONE /* NONE */ +} +sgsap_elem_idx_t; + +guint16 (*sgsap_elem_fcn[])(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_string, int string_len) = { + NULL/*DE_SGSAP_IMSI*/, /* 9.4.6 IMSI*/ + de_sgsap_vlr_name, /* 9.4.22 VLR name*/ + NULL/*DE_SGSAP_TMSI*/, /* 9.4.20 TMSI */ + NULL/*DE_SGSAP_LOC_AREA_ID*/, /* 9.4.11 Location area identifier */ + NULL/*DE_SGSAP_CH_NEEDED*/, /* 9.4.23 Channel Needed */ + NULL/*DE_SGSAP_EMLPP_PRIO*/, /* 9.4.24 eMLPP Priority*/ + NULL/*DE_SGSAP_TMSI_STATUS*/, /* 9.4.21 TMSI status */ + de_sgsap_sgs_cause, /* 9.4.18 SGs cause*/ + de_sgsap_mme_name, /* 9.4.13 MME name*/ + de_sgsap_eps_loc_upd_type, /* 9.4.2 EPS location update type*/ + NULL/*DE_SGSAP_GLOBAL_CN-ID*/, /* 9.4.4 Global CN-Id*/ + + NULL/*DE_SGSAP_UDEF_12*/, /* Undefined */ + NULL/*DE_SGSAP_UDEF_13*/, /* Undefined */ + + NULL/*DE_SGSAP_MID*/, /* 9.4.14 Mobile identity*/ + NULL/*DE_SGSAP_REJ_CAUSE*/, /* 9.4.16 Reject cause */ + NULL/*DE_SGSAP_IMSI_DET_EPS*/, /* 9.4.7 IMSI detach from EPS service type */ + NULL/*DE_SGSAP_IMSI_DET_NON_EPS*/, /* 9.4.8 IMSI detach from non-EPS service type */ + + NULL/*DE_SGSAP_IMEISV*/, /* 9.4.5 IMEISV */ + NULL/*DE_SGSAP_NAS_MSG_CONTAINER*/, /* 9.4.15 NAS message container*/ + NULL/*DE_SGSAP_MM_INFO*/, /* 9.4.12 MM information*/ + + NULL/*DE_SGSAP_UDEF_24*/, /* Undefined */ + NULL/*DE_SGSAP_UDEF_25*/, /* Undefined */ + NULL/*DE_SGSAP_UDEF_26*/, /* Undefined */ + + de_sgsap_err_msg, /* 9.4.3 Erroneous message*/ + NULL/*DE_SGSAP_CLI*/, /* 9.4.1 CLI */ + NULL/*DE_SGSAP_LCS_CLIENT_ID*/, /* 9.4.9 LCS client identity */ + NULL/*DE_SGSAP_LCS_INDIC*/, /* 9.4.10 LCS indicator */ + NULL/*DE_SGSAP_SS_CODE*/, /* 9.4.19 SS code */ + de_sgsap_serv_indic, /* 9.4.17 Service indicator */ + NULL/*DE_SGSAP_UE_TZ*/, /* 9.4.21b UE Time Zone */ + NULL/*DE_SGSAP_MSC_2*/, /* 9.4.14a Mobile Station Classmark 2 */ + NULL/*DE_SGSAP_TAID*/, /* 9.4.21a Tracking Area Identity */ + NULL/*DE_SGSAP_E_UTRAN_CGI*/, /* 9.4.3a E-UTRAN Cell Global Identity */ + NULL/*DE_SGSAP_UE_EMM_MODE*/, /* 9.4.21c UE EMM mode*/ + + NULL, /* NONE */ +}; + +/* MESSAGE FUNCTIONS */ + +/* + * 8.1 SGsAP-ALERT-ACK message + */ +static void +sgsap_alert_ack(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) +{ + guint32 curr_offset; + guint32 consumed; + guint curr_len; + + curr_offset = offset; + curr_len = len; + + /* IMSI IMSI 9.4.6 M TLV 6-10 */ + ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL); + + EXTRANEOUS_DATA_CHECK(curr_len, 0); +} + +/* + * 8.2 SGsAP-ALERT-REJECT message + */ +static void +sgsap_alert_rej(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) +{ + guint32 curr_offset; + guint32 consumed; + guint curr_len; + + curr_offset = offset; + curr_len = len; + + /* IMSI IMSI 9.4.6 M TLV 6-10 */ + ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL); + /* SGs Cause SGs cause 9.4.18 M TLV 3 */ + ELEM_MAND_TLV(0x08, SGSAP_PDU_TYPE, DE_SGSAP_SGS_CAUSE, NULL); + + EXTRANEOUS_DATA_CHECK(curr_len, 0); +} + +/* + * 8.3 SGsAP-ALERT-REQUEST message + */ +static void +sgsap_alert_req(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) +{ + guint32 curr_offset; + guint32 consumed; + guint curr_len; + + curr_offset = offset; + curr_len = len; + + /* IMSI IMSI 9.4.6 M TLV 6-10 */ + ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL); + + EXTRANEOUS_DATA_CHECK(curr_len, 0); +} + +/* + * 8.4 SGsAP-DOWNLINK-UNITDATA message + */ +static void +sgsap_dl_unitdata(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) +{ + guint32 curr_offset; + guint32 consumed; + guint curr_len; + + curr_offset = offset; + curr_len = len; + + + /* IMSI IMSI 9.4.6 M TLV 6-10 */ + ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL); + /* NAS message container NAS message container 9.4.15 M TLV 4-253 */ + + EXTRANEOUS_DATA_CHECK(curr_len, 0); +} + +/* + * 8.5 SGsAP-EPS-DETACH-ACK message + */ + +static void +sgsap_eps_det_ack(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) +{ + guint32 curr_offset; + guint32 consumed; + guint curr_len; + + curr_offset = offset; + curr_len = len; + + /* IMSI IMSI 9.4.6 M TLV 6-10 */ + ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL); + + EXTRANEOUS_DATA_CHECK(curr_len, 0); +} +/* + * 8.6 SGsAP-EPS-DETACH-INDICATION message + */ + +static void +sgsap_eps_det_ind(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) +{ + guint32 curr_offset; + guint32 consumed; + guint curr_len; + + curr_offset = offset; + curr_len = len; + + /* IMSI IMSI 9.4.6 M TLV 6-10 */ + ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL); + /* MME name MME name 9.4.13 M TLV 57 */ + /* IMSI detach from EPS service type IMSI detach from EPS service type 9.4.7 M TLV 3 */ + + EXTRANEOUS_DATA_CHECK(curr_len, 0); +} + +/* + * 8.7 SGsAP-IMSI-DETACH-ACK message + */ +static void +sgsap_imsi_det_ack(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) +{ + guint32 curr_offset; + guint32 consumed; + guint curr_len; + + curr_offset = offset; + curr_len = len; + + /* IMSI IMSI 9.4.6 M TLV 6-10 */ + ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL); + + EXTRANEOUS_DATA_CHECK(curr_len, 0); +} +/* + * 8.8 SGsAP-IMSI-DETACH-INDICATION message + */ +static void +sgsap_imsi_det_ind(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) +{ + guint32 curr_offset; + guint32 consumed; + guint curr_len; + + curr_offset = offset; + curr_len = len; + + /* IMSI IMSI 9.4.6 M TLV 6-10 */ + ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL); + /* MME name MME name 9.4.13 M TLV 57 */ + /* IMSI Detach from non-EPS service type IMSI detach from non-EPS service type 9.4.8 M TLV 3 */ + + EXTRANEOUS_DATA_CHECK(curr_len, 0); +} + +/* + * 8.9 SGsAP-LOCATION-UPDATE-ACCEPT message + */ +static void +sgsap_imsi_loc_update_acc(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) +{ + guint32 curr_offset; + guint32 consumed; + guint curr_len; + + curr_offset = offset; + curr_len = len; + + /* IMSI IMSI 9.4.6 M TLV 6-10 */ + ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL); + /* Location area identifier Location area identifier 9.4.11 M TLV 7 */ + ELEM_MAND_TLV(0x04, GSM_A_PDU_TYPE_COMMON, DE_LAI, NULL); + /* New TMSI, or IMSI Mobile identity 9.4.14 O TLV 6-10 */ + ELEM_OPT_TLV(0x0e,GSM_A_PDU_TYPE_COMMON, DE_MID, " - New TMSI, or IMSI"); + + EXTRANEOUS_DATA_CHECK(curr_len, 0); +} + +/* + * 8.10 SGsAP-LOCATION-UPDATE-REJECT message + */ +static void +sgsap_imsi_loc_update_rej(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) +{ + guint32 curr_offset; + guint32 consumed; + guint curr_len; + + curr_offset = offset; + curr_len = len; + + /* IMSI IMSI 9.4.6 M TLV 6-10 */ + ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL); + /* Reject cause Reject cause 9.4.16 M TLV 3 */ + /* Location area identifier Location area identifier 9.4.11 O TLV 7 */ + ELEM_OPT_TLV(0x04, GSM_A_PDU_TYPE_COMMON, DE_LAI, NULL); + + EXTRANEOUS_DATA_CHECK(curr_len, 0); +} + +/* + * 8.11 SGsAP-LOCATION-UPDATE-REQUEST message + */ + +static void +sgsap_imsi_loc_update_req(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) +{ + guint32 curr_offset; + guint32 consumed; + guint curr_len; + + curr_offset = offset; + curr_len = len; + + /* IMSI IMSI 9.4.6 M TLV 6-10 */ + ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL); + /* MME name MME name 9.4.13 M TLV 57 */ + ELEM_MAND_TLV(0x09, SGSAP_PDU_TYPE, DE_SGSAP_MME_NAME, NULL); + /* EPS location update type EPS location update type 9.4.2 M TLV 3 */ + ELEM_MAND_TLV(0x0a, SGSAP_PDU_TYPE, DE_SGSAP_EPS_LOC_UPD_TYPE, NULL); + /* New location area identifier Location area identifier 9.4.11 M TLV 7 */ + ELEM_MAND_TLV(0x04, GSM_A_PDU_TYPE_COMMON, DE_LAI, NULL); + /* Old location area identifier Location area identifier 9.4.11 O TLV 7 */ + ELEM_OPT_TLV(0x04, GSM_A_PDU_TYPE_COMMON, DE_LAI, " - Old location area identifier"); + /* TMSI status TMSI status 9.4.21 O TLV 3 */ + ELEM_OPT_TLV( 0x07 , GSM_A_PDU_TYPE_GM, DE_TMSI_STAT , NULL ); + /* IMEISV IMEISV 9.4.5 O TLV 10 */ + + EXTRANEOUS_DATA_CHECK(curr_len, 0); +} + +/* + * 8.12 SGsAP-MM-INFORMATION-REQUEST + */ +static void +sgsap_mm_info_req(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) +{ + guint32 curr_offset; + guint32 consumed; + guint curr_len; + + curr_offset = offset; + curr_len = len; + + /* IMSI IMSI 9.4.6 M TLV 6-10 */ + ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL); + /* MM information MM information 9.4.12 M TLV 3-n */ + + EXTRANEOUS_DATA_CHECK(curr_len, 0); +} + +/* + * 8.13 SGsAP-PAGING-REJECT message + */ +static void +sgsap_paging_rej(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) +{ + guint32 curr_offset; + guint32 consumed; + guint curr_len; + + curr_offset = offset; + curr_len = len; + + /* IMSI IMSI 9.4.6 M TLV 6-10 */ + ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL); + /* SGs Cause SGs Cause 9.4.18 M TLV 3 */ + ELEM_MAND_TLV(0x08, SGSAP_PDU_TYPE, DE_SGSAP_SGS_CAUSE, NULL); + + EXTRANEOUS_DATA_CHECK(curr_len, 0); +} +/* + * 8.14 SGsAP-PAGING-REQUEST message + */ +static void +sgsap_paging_req(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) +{ + guint32 curr_offset; + guint32 consumed; + guint curr_len; + + curr_offset = offset; + curr_len = len; + + /* IMSI IMSI 9.4.6 M TLV 6-10 */ + ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL); + /* VLR name VLR name 9.4.22 M TLV 3-n */ + ELEM_MAND_TLV(0x02, SGSAP_PDU_TYPE, DE_SGSAP_VLR_NAME, NULL); + /* Service indicator Service indicator 9.4.17 M TLV 3 */ + ELEM_MAND_TLV(0x20, SGSAP_PDU_TYPE, DE_SGSAP_SERV_INDIC, NULL); + /* TMSI TMSI 9.4.20 O TLV 6 */ + ELEM_OPT_TLV(0x03, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL); + /* CLI CLI 9.4.1 O TLV 3-14 */ + ELEM_OPT_TLV(0x1c, GSM_A_PDU_TYPE_DTAP, DE_CLG_PARTY_BCD_NUM, " - CLI"); + /* Location area identifier Location area identifier 9.4.11 O TLV 7 */ + ELEM_OPT_TLV(0x04, GSM_A_PDU_TYPE_COMMON, DE_LAI, NULL); + /* Global CN-Id Global CN-Id 9.4.4 O TLV 7 */ + /* SS code SS code 9.4.19 O TLV 3 */ + /* LCS indicator LCS indicator 9.4.10 O TLV 3 */ + /* LCS client identity LCS client identity 9.4.9 O TLV 3-n */ + /* Channel needed Channel needed 9.4.23 O TLV 3 */ + /* eMLPP Priority eMLPP Priority 9.4.24 O TLV 3 */ + + EXTRANEOUS_DATA_CHECK(curr_len, 0); +} +/* + * 8.15 SGsAP-RESET-ACK message + */ +static void +sgsap_reset_ack(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) +{ + guint32 curr_offset; + guint32 consumed; + guint curr_len; + + curr_offset = offset; + curr_len = len; + + /* MME name MME name 9.4.13 C TLV 57 */ + ELEM_OPT_TLV(0x09, SGSAP_PDU_TYPE, DE_SGSAP_MME_NAME, NULL); + /* VLR name VLR name 9.4.22 C TLV 3-n */ + ELEM_OPT_TLV(0x02, SGSAP_PDU_TYPE, DE_SGSAP_VLR_NAME, NULL); + + EXTRANEOUS_DATA_CHECK(curr_len, 0); +} + +/* + * 8.16 SGsAP-RESET-INDICATION message + */ +static void +sgsap_reset_ind(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) +{ + guint32 curr_offset; + guint32 consumed; + guint curr_len; + + curr_offset = offset; + curr_len = len; + + /* MME name MME name 9.4.13 C TLV 57 */ + ELEM_OPT_TLV(0x09, SGSAP_PDU_TYPE, DE_SGSAP_MME_NAME, NULL); + /* VLR name VLR name 9.4.22 C TLV 3-n */ + ELEM_OPT_TLV(0x02, SGSAP_PDU_TYPE, DE_SGSAP_VLR_NAME, NULL); + + EXTRANEOUS_DATA_CHECK(curr_len, 0); +} +/* + * 8.17 SGsAP-SERVICE-REQUEST message + */ +static void +sgsap_service_req(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) +{ + guint32 curr_offset; + guint32 consumed; + guint curr_len; + + curr_offset = offset; + curr_len = len; + + /*IMSI IMSI 9.4.6 M TLV 6-10 */ + ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL); + /* Service indicator Service indicator 9.4.17 M TLV 3 */ + ELEM_MAND_TLV(0x20, SGSAP_PDU_TYPE, DE_SGSAP_SERV_INDIC, NULL); + /* IMEISV IMEISV 9.4.5 O TLV 10 */ + /* UE Time Zone UE Time Zone 9.4.21b O TLV 3 */ + /* Mobile Station Classmark 2 Mobile Station Classmark 2 9.4.14a O TLV 5 */ + /* TAI Tracking Area Identity 9.4.21a O TLV 7 */ + ELEM_OPT_TLV(0x23, NAS_PDU_TYPE_EMM, DE_EMM_TRAC_AREA_ID, NULL); + /* E-CGI E-UTRAN Cell Global Identity 9.4.3a O TLV 9 */ + /* UE EMM Mode UE EMM mode 9.4.21c O TLV 3 */ + + EXTRANEOUS_DATA_CHECK(curr_len, 0); +} + +/* + * 8.18 SGsAP-STATUS message + */ +static void +sgsap_status(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) +{ + guint32 curr_offset; + guint32 consumed; + guint curr_len; + + curr_offset = offset; + curr_len = len; + + /* IMSI IMSI 9.4.6 O TLV 6-10 */ + ELEM_OPT_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL); + /* SGs cause SGs cause 9.4.18 M TLV 3 */ + ELEM_MAND_TLV(0x08, SGSAP_PDU_TYPE, DE_SGSAP_SGS_CAUSE, NULL); + /* Erroneous message Erroneous message 9.4.3 M TLV 3-n */ + ELEM_OPT_TLV(0x1e, SGSAP_PDU_TYPE, DE_SGSAP_ERR_MSG, NULL); + + EXTRANEOUS_DATA_CHECK(curr_len, 0); +} + +/* + * 8.19 SGsAP-TMSI-REALLOCATION-COMPLETE message + */ +static void +sgsap_tmsi_realloc_comp(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) +{ + guint32 curr_offset; + guint32 consumed; + guint curr_len; + + curr_offset = offset; + curr_len = len; + + /*IMSI IMSI 9.4.6 M TLV 6-10 */ + ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL); + + EXTRANEOUS_DATA_CHECK(curr_len, 0); +} + +/* + * 8.20 SGsAP-UE-ACTIVITY-INDICATION message + */ +static void +sgsap_ue_act_ind(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) +{ + guint32 curr_offset; + guint32 consumed; + guint curr_len; + + curr_offset = offset; + curr_len = len; + + /* IMSI IMSI 9.4.6 M TLV 6-10 */ + ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL); + + EXTRANEOUS_DATA_CHECK(curr_len, 0); +} + +/* + * 8.21 SGsAP-UE-UNREACHABLE message + */ +static void +sgsap_ue_unreachable(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) +{ + guint32 curr_offset; + guint32 consumed; + guint curr_len; + + curr_offset = offset; + curr_len = len; + + + /* IMSI IMSI 9.4.6 M TLV 6-10 */ + ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL); + /* SGs cause SGs cause 9.4.18 M TLV 3 */ + ELEM_MAND_TLV(0x08, SGSAP_PDU_TYPE, DE_SGSAP_SGS_CAUSE, NULL); + + EXTRANEOUS_DATA_CHECK(curr_len, 0); +} +/* + * 8.22 SGsAP-UPLINK-UNITDATA message + */ +static void +sgsap_ue_ul_unitdata(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) +{ + guint32 curr_offset; + guint32 consumed; + guint curr_len; + + curr_offset = offset; + curr_len = len; + + /* IMSI IMSI 9.4.6 M TLV 6-10 */ + ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL); + /* NAS message container NAS message container 9.4.15 M TLV 4-253 */ + /* IMEISV IMEISV 9.4.5 O TLV 10 */ + /* UE Time Zone UE Time Zone 9.4.21b O TLV 3 */ + /* Mobile Station Classmark 2 Mobile Station Classmark 2 9.4.14a O TLV 5 */ + /* TAI Tracking Area Identity 9.4.21a O TLV 7 */ + ELEM_OPT_TLV(0x23, NAS_PDU_TYPE_EMM, DE_EMM_TRAC_AREA_ID, NULL); + /* E-CGI E-UTRAN Cell Global Identity 9.4.3a O TLV 9 */ + + EXTRANEOUS_DATA_CHECK(curr_len, 0); +} +/* + * 8.23 SGsAP-RELEASE-REQUEST message + */ +static void +sgsap_release_req(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) +{ + guint32 curr_offset; + guint32 consumed; + guint curr_len; + + curr_offset = offset; + curr_len = len; + + /* IMSI IMSI 9.4.6 M TLV 6-10 */ + ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL); + /* SGs cause SGs cause 9.4.18 O TLV 3 */ + ELEM_MAND_TLV(0x08, SGSAP_PDU_TYPE, DE_SGSAP_SGS_CAUSE, NULL); + + EXTRANEOUS_DATA_CHECK(curr_len, 0); +} + +/* + * 8.24 SGsAP-SERVICE-ABORT-REQUEST message + */ +/* No IE's */ + +/* + * 9.2 Message type + */ +static const value_string sgsap_msg_strings[] = { + { 0x01, "SGsAP-PAGING-REQUEST"}, /* 8.14 */ + { 0x02, "SGsAP-PAGING-REJECT"}, /* 8.13 */ +/* + * 0 0 0 0 0 0 1 1 + * to + * 0 0 0 0 0 1 0 1 + * Unassigned: treated as an unknown Message type + */ + { 0x03, "Unassigned"}, /* 7 */ + { 0x04, "Unassigned"}, /* 7 */ + { 0x05, "Unassigned"}, /* 7 */ + + { 0x06, "SGsAP-SERVICE-REQUEST"}, /* 8.17 */ + { 0x07, "SGsAP-DOWNLINK-UNITDATA"}, /* 8.4 */ + { 0x08, "SGsAP-UPLINK-UNITDATA"}, /* 8.22 */ + { 0x09, "SGsAP-LOCATION-UPDATE-REQUEST"}, /* 8.11 */ + { 0x0a, "SGsAP-LOCATION-UPDATE-ACCEPT"}, /* 8.9 */ + { 0x0b, "SGsAP-LOCATION-UPDATE-REJECT"}, /* 8.10 */ + { 0x0c, "SGsAP-TMSI-REALLOCATION-COMPLETE"}, /* 8.19 */ + { 0x0d, "SGsAP-ALERT-REQUEST"}, /* 8.3 */ + { 0x0e, "SGsAP-ALERT-ACK"}, /* 8.1 */ + { 0x0f, "SGsAP-ALERT-REJECT"}, /* 8.2 */ + { 0x10, "SGsAP-UE-ACTIVITY-INDICATION"}, /* 8.20 */ + { 0x11, "SGsAP-EPS-DETACH-INDICATION"}, /* 8.6 */ + { 0x12, "SGsAP-EPS-DETACH-ACK"}, /* 8.5 */ + { 0x13, "SGsAP-IMSI-DETACH-INDICATION"}, /* 8.8 */ + { 0x14, "SGsAP-IMSI-DETACH-ACK"}, /* 8.7 */ + { 0x15, "SGsAP-RESET-INDICATION"}, /* 8.16 */ + { 0x16, "SGsAP-RESET-ACK"}, /* 8.15 */ + { 0x17, "SGsAP-SERVICE-ABORT-REQUEST"}, /* 8.24 */ +/* + * 0 0 0 1 1 0 0 0 + * to + * 0 0 0 1 1 0 0 1 + * Unassigned: treated as an unknown Message type + */ + { 0x18, "Unassigned"}, + { 0x19, "Unassigned"}, + + { 0x1a, "SGsAP-MM-INFORMATION-REQUEST"}, /* 8.12 */ + { 0x1b, "SGsAP-RELEASE-REQUEST"}, /* 8.23 */ +/* + * 0 0 0 1 1 1 0 0 Unassigned: treated as an unknown Message type 7 + */ + { 0x1c, "Unassigned"}, /* 8.12 */ + + { 0x1d, "SGsAP-STATUS"}, /* 8.18 */ + { 0x1e, "Unassigned"}, + { 0x1f, "SGsAP-UE-UNREACHABLE"}, /* 8.21 */ + { 0, NULL } +}; + +#define NUM_SGSAP_MSG (sizeof(sgsap_msg_strings)/sizeof(value_string)) +static gint ett_sgsap_msg[NUM_SGSAP_MSG]; +static void (*sgsap_msg_fcn[])(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len) = { + sgsap_paging_req, /* 0x01, "SGsAP-PAGING-REQUEST" 8.14 */ + sgsap_paging_rej, /* 0x02, "SGsAP-PAGING-REJECT" 8.13 */ +/* + * 0 0 0 0 0 0 1 1 + * to + * 0 0 0 0 0 1 0 1 + * Unassigned: treated as an unknown Message type + */ + NULL, /* 0x03, "Unassigned" 7 */ + NULL, /* 0x04, "Unassigned" 7 */ + NULL, /* 0x05, "Unassigned" 7 */ + + sgsap_service_req, /* 0x06, "SGsAP-SERVICE-REQUEST" 8.17 */ + sgsap_dl_unitdata, /* 0x07, "SGsAP-DOWNLINK-UNITDATA" 8.4 */ + sgsap_ue_ul_unitdata, /* 0x08, "SGsAP-UPLINK-UNITDATA" 8.22 */ + sgsap_imsi_loc_update_req, /* 0x09, "SGsAP-LOCATION-UPDATE-REQUEST" 8.11 */ + sgsap_imsi_loc_update_acc, /* 0x0a, "SGsAP-LOCATION-UPDATE-ACCEPT" 8.9 */ + sgsap_imsi_loc_update_rej, /* 0x0b, "SGsAP-LOCATION-UPDATE-REJECT" 8.10 */ + sgsap_tmsi_realloc_comp, /* 0x0c, "SGsAP-TMSI-REALLOCATION-COMPLETE" 8.19 */ + sgsap_alert_req, /* 0x0d, "SGsAP-ALERT-REQUEST" 8.3 */ + sgsap_alert_ack, /* 0x0e, "SGsAP-ALERT-ACK" 8.1 */ + sgsap_alert_rej, /* 0x0f, "SGsAP-ALERT-REJECT" 8.2 */ + sgsap_ue_act_ind, /* 0x10, "SGsAP-UE-ACTIVITY-INDICATION" 8.20 */ + sgsap_eps_det_ind, /* 0x11, "SGsAP-EPS-DETACH-INDICATION" 8.6 */ + sgsap_eps_det_ack, /* 0x12, "SGsAP-EPS-DETACH-ACK" 8.5 */ + sgsap_imsi_det_ind, /* 0x13, "SGsAP-IMSI-DETACH-INDICATION" 8.8 */ + sgsap_imsi_det_ack, /* 0x14, "SGsAP-IMSI-DETACH-ACK" 8.7 */ + sgsap_reset_ind, /* 0x15, "SGsAP-RESET-INDICATION" 8.16 */ + sgsap_reset_ack, /* 0x16, "SGsAP-RESET-ACK" 8.15 */ + NULL,/* No IE's */ /* 0x17, "SGsAP-SERVICE-ABORT-REQUEST" 8.24 */ +/* + * 0 0 0 1 1 0 0 0 + * to + * 0 0 0 1 1 0 0 1 + * Unassigned: treated as an unknown Message type + */ + NULL, /* 0x18, "Unassigned" */ + NULL, /* 0x19, "Unassigned" */ + + sgsap_mm_info_req, /* 0x1a, "SGsAP-MM-INFORMATION-REQUEST" 8.12 */ + sgsap_release_req, /* 0x1b, "SGsAP-RELEASE-REQUEST" 8.23 */ +/* + * 0 0 0 1 1 1 0 0 Unassigned: treated as an unknown Message type 7 + */ + NULL, /* 0x1c, "Unassigned" */ + + sgsap_status, /* 0x1d, "SGsAP-STATUS" 8.18 */ + NULL, /* 0x1e, "Unassigned" */ + sgsap_ue_unreachable, /* 0x1f, "SGsAP-UE-UNREACHABLE" 8.21 */ + + NULL, /* NONE */ +}; + +void get_sgsap_msg_params(guint8 oct, const gchar **msg_str, int *ett_tree, int *hf_idx, msg_fcn *msg_fcn) +{ + gint idx; + + *msg_str = match_strval_idx((guint32) (oct & 0xff), sgsap_msg_strings, &idx); + *ett_tree = ett_sgsap_msg[idx]; + *hf_idx = hf_sgsap_msg_type; + *msg_fcn = sgsap_msg_fcn[idx]; + + return; +} + + +static void +dissect_sgsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + proto_item *item; + proto_tree *sgsap_tree; + int offset = 0; + guint32 len; + const gchar *msg_str; + gint ett_tree; + int hf_idx; + void (*msg_fcn)(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len); + guint8 oct; + + /* Save pinfo gpinfo = pinfo;*/ + len = tvb_length(tvb); + + /* Make entry in the Protocol column on summary display */ + col_set_str(pinfo->cinfo, COL_PROTOCOL, PSNAME); + + item = proto_tree_add_item(tree, proto_sgsap, tvb, 0, -1, FALSE); + sgsap_tree = proto_item_add_subtree(item, ett_sgsap); + + /* Messge type IE*/ + oct = tvb_get_guint8(tvb,offset); + msg_fcn = NULL; + ett_tree = -1; + hf_idx = -1; + msg_str = NULL; + + get_sgsap_msg_params(oct, &msg_str, &ett_tree, &hf_idx, &msg_fcn); + + if(msg_str){ + col_add_fstr(pinfo->cinfo, COL_INFO, "%s", msg_str); + }else{ + proto_tree_add_text(tree, tvb, offset, 1,"Unknown message 0x%x",oct); + return; + } + + /* + * Add SGSAP message name + */ + proto_tree_add_item(tree, hf_idx, tvb, offset, 1, FALSE); + offset++; + + + /* + * decode elements + */ + if (msg_fcn == NULL) + { + proto_tree_add_text(tree, tvb, offset, len - offset, + "Message Elements"); + } + else + { + /* If calling any "gsm" ie dissectors needing pinfo */ + gsm_a_dtap_pinfo = pinfo; + (*msg_fcn)(tvb, tree, offset, len - offset); + } + +} + + + +void proto_register_sgsap(void) { + guint i; + guint last_offset; + + /* List of fields */ + + static hf_register_info hf[] = { + { &hf_sgsap_msg_type, + { "SGSAP Message Type", "sgsap.msg_type", + FT_UINT8, BASE_HEX, VALS(sgsap_msg_strings), 0x0, + NULL, HFILL } + }, + { &hf_sgsap_elem_id, + { "Element ID", "sgsap.elem_id", + FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, + { &hf_sgsap_eps_location_update_type, + { "EPS location update type", "sgsap.eps_location_update_type", + FT_UINT8, BASE_DEC, VALS(sgsap_eps_location_update_type_values),0x0, + NULL, HFILL } + }, + { &hf_sgsap_service_indicator_value, + { "Service indicator", "sgsap.service_indicator", + FT_UINT8, BASE_DEC, VALS(sgsap_service_indicator_values),0x0, + NULL, HFILL } + }, + { &hf_sgsap_sgs_cause, + { "SGs cause", "sgsap.sgs_cause", + FT_UINT8, BASE_DEC, VALS(sgsap_sgs_cause_values),0x0, + NULL, HFILL } + }, + }; + + /* Setup protocol subtree array */ +#define NUM_INDIVIDUAL_ELEMS 1 + gint *ett[NUM_INDIVIDUAL_ELEMS + + NUM_SGSAP_ELEM + + NUM_SGSAP_MSG]; + + ett[0] = &ett_sgsap; + + last_offset = NUM_INDIVIDUAL_ELEMS; + + for (i=0; i < NUM_SGSAP_ELEM; i++, last_offset++) + { + ett_sgsap_elem[i] = -1; + ett[last_offset] = &ett_sgsap_elem[i]; + } + + for (i=0; i < NUM_SGSAP_MSG; i++, last_offset++) + { + ett_sgsap_msg[i] = -1; + ett[last_offset] = &ett_sgsap_msg[i]; + } + + /* Register protocol */ + proto_sgsap = proto_register_protocol(PNAME, PSNAME, PFNAME); + /* Register fields and subtrees */ + proto_register_field_array(proto_sgsap, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + + /* Register dissector */ + register_dissector(PFNAME, dissect_sgsap, proto_sgsap); +} + +void +proto_reg_handoff_sgsap(void) +{ + /* The registered SCTP port number for SGsAP is 29118. + * The payload protocol identifier to be used for SGsAP is 0. + */ + static gboolean Initialized=FALSE; + static dissector_handle_t sgsap_handle; + static guint SctpPort; + + sgsap_handle = find_dissector("sgsap"); + + if (!Initialized) { + dissector_add_handle("sctp.port", sgsap_handle); /* for "decode-as" */ + Initialized=TRUE; + } else { + if (SctpPort != 0) { + dissector_delete_uint("sctp.port", SctpPort, sgsap_handle); + } + } + + SctpPort=gbl_sgsapSctpPort; + if (SctpPort != 0) { + dissector_add_uint("sctp.port", SctpPort, sgsap_handle); + } +} |