gsm_rlcmac: improve dissection of MS RA Capability IE

Port from wireshark.git de028e81c53f9c45ccc5adb3bffd2f16ae2017bf

This commit breaks transcoding of the test vectors containing
the MS RA Capability IE due to the reasons explained in [1].

The more fields we add, the longer gets the output of the CSN.1
encoder. This is not critical, since we never need to encode
messages containing the MS RA Capability IE on practice.

[1] Ibb4cbd3f5865415fd547e95fc24ff31df1aed4c0

Ported-by: Pau Espin Pedrol <pespin@sysmocom.de>
Change-Id: Ibb4cbd3f5865415fd547e95fc24ff31df1aed4c0
diff --git a/src/gsm_rlcmac.cpp b/src/gsm_rlcmac.cpp
index 92466f5..e8ce2ef 100644
--- a/src/gsm_rlcmac.cpp
+++ b/src/gsm_rlcmac.cpp
@@ -777,6 +777,12 @@
 CSN_DESCR_END         (DTM_EGPRS_HighMultislotClass_t)
 
 static const
+CSN_DESCR_BEGIN       (DownlinkDualCarrierCapability_r7_t)
+  M_NEXT_EXIST        (DownlinkDualCarrierCapability_r7_t, MultislotCapabilityReductionForDL_DualCarrier, 1),
+  M_UINT              (DownlinkDualCarrierCapability_r7_t, DL_DualCarrierForDTM,  3),
+CSN_DESCR_END         (DownlinkDualCarrierCapability_r7_t)
+
+static const
 CSN_DESCR_BEGIN       (Multislot_capability_t)
   M_NEXT_EXIST_OR_NULL(Multislot_capability_t, Exist_HSCSD_multislot_class, 1),
   M_UINT              (Multislot_capability_t,  HSCSD_multislot_class,  5),
@@ -854,6 +860,25 @@
   M_TYPE              (Content_t, DTM_EGPRS_HighMultislotClass, DTM_EGPRS_HighMultislotClass_t),
 
   M_UINT_OR_NULL      (Content_t,  PS_HandoverCapability,  1),
+
+  /* additions in release 7 */
+  M_UINT_OR_NULL      (Content_t,  DTM_Handover_Capability,  1),
+  M_NEXT_EXIST_OR_NULL(Content_t, Exist_DownlinkDualCarrierCapability_r7, 1),
+  M_TYPE              (Content_t, DownlinkDualCarrierCapability_r7, DownlinkDualCarrierCapability_r7_t),
+
+  M_UINT_OR_NULL      (Content_t,  FlexibleTimeslotAssignment,  1),
+  M_UINT_OR_NULL      (Content_t,  GAN_PS_HandoverCapability,  1),
+  M_UINT_OR_NULL      (Content_t,  RLC_Non_persistentMode,  1),
+  M_UINT_OR_NULL      (Content_t,  ReducedLatencyCapability,  1),
+  M_UINT_OR_NULL      (Content_t,  UplinkEGPRS2,  2),
+  M_UINT_OR_NULL      (Content_t,  DownlinkEGPRS2,  2),
+
+  /* additions in release 8 */
+  M_UINT_OR_NULL      (Content_t,  EUTRA_FDD_Support,  1),
+  M_UINT_OR_NULL      (Content_t,  EUTRA_TDD_Support,  1),
+  M_UINT_OR_NULL      (Content_t,  GERAN_To_EUTRAN_supportInGERAN_PTM,  2),
+  M_UINT_OR_NULL      (Content_t,  PriorityBasedReselectionSupport,  1),
+
 CSN_DESCR_END         (Content_t)
 
 gint16 Content_Dissector(csnStream_t* ar, bitvec *vector, unsigned *readIndex, void* data)
@@ -897,9 +922,18 @@
 {
   {4, AccTech_GSMP,     0, M_SERIALIZE (MS_RA_capability_value_t, u.Content, 7, Content_Dissector)}, /* Long Form */
   {4, AccTech_GSME,     0, M_SERIALIZE (MS_RA_capability_value_t, u.Content, 7, Content_Dissector)}, /* Long Form */
+  {4, AccTech_GSMR,     0, M_SERIALIZE (MS_RA_capability_value_t, u.Content, 7, Content_Dissector)}, /* Long Form */
   {4, AccTech_GSM1800,  0, M_SERIALIZE (MS_RA_capability_value_t, u.Content, 7, Content_Dissector)}, /* Long Form */
   {4, AccTech_GSM1900,  0, M_SERIALIZE (MS_RA_capability_value_t, u.Content, 7, Content_Dissector)}, /* Long Form */
+  {4, AccTech_GSM450,   0, M_SERIALIZE (MS_RA_capability_value_t, u.Content, 7, Content_Dissector)}, /* Long Form */
+  {4, AccTech_GSM480,   0, M_SERIALIZE (MS_RA_capability_value_t, u.Content, 7, Content_Dissector)}, /* Long Form */
   {4, AccTech_GSM850,   0, M_SERIALIZE (MS_RA_capability_value_t, u.Content, 7, Content_Dissector)}, /* Long Form */
+  {4, AccTech_GSM750,   0, M_SERIALIZE (MS_RA_capability_value_t, u.Content, 7, Content_Dissector)}, /* Long Form */
+  {4, AccTech_GSMT830,  0, M_SERIALIZE (MS_RA_capability_value_t, u.Content, 7, Content_Dissector)}, /* Long Form */
+  {4, AccTech_GSMT410,  0, M_SERIALIZE (MS_RA_capability_value_t, u.Content, 7, Content_Dissector)}, /* Long Form */
+  {4, AccTech_GSMT900,  0, M_SERIALIZE (MS_RA_capability_value_t, u.Content, 7, Content_Dissector)}, /* Long Form */
+  {4, AccTech_GSM710,   0, M_SERIALIZE (MS_RA_capability_value_t, u.Content, 7, Content_Dissector)}, /* Long Form */
+  {4, AccTech_GSMT810,  0, M_SERIALIZE (MS_RA_capability_value_t, u.Content, 7, Content_Dissector)}, /* Long Form */
   {4, AccTech_GSMOther, 0, M_SERIALIZE (MS_RA_capability_value_t, u.Additional_access_technologies, 7, Additional_access_technologies_Dissector)}, /* Short Form */
 };
 
diff --git a/src/gsm_rlcmac.h b/src/gsm_rlcmac.h
index 9db6a99..10bb6af 100644
--- a/src/gsm_rlcmac.h
+++ b/src/gsm_rlcmac.h
@@ -1112,6 +1112,12 @@
 
 typedef struct
 {
+  guint8 MultislotCapabilityReductionForDL_DualCarrier;
+  guint8 DL_DualCarrierForDTM;
+} DownlinkDualCarrierCapability_r7_t;
+
+typedef struct
+{
   guint8 Exist_HSCSD_multislot_class;
   guint8 HSCSD_multislot_class;
 
@@ -1197,6 +1203,25 @@
   guint8 DTM_GPRS_HighMultislotClass;
   DTM_EGPRS_HighMultislotClass_t DTM_EGPRS_HighMultislotClass;
   guint8 PS_HandoverCapability;
+
+  /* -------- R7 additions */
+  guint8 DTM_Handover_Capability;
+  guint8 Exist_DownlinkDualCarrierCapability_r7;
+  DownlinkDualCarrierCapability_r7_t DownlinkDualCarrierCapability_r7;
+
+  guint8 FlexibleTimeslotAssignment;
+  guint8 GAN_PS_HandoverCapability;
+  guint8 RLC_Non_persistentMode;
+  guint8 ReducedLatencyCapability;
+  guint8 UplinkEGPRS2;
+  guint8 DownlinkEGPRS2;
+
+  /* -------- R8 additions */
+  guint8 EUTRA_FDD_Support;
+  guint8 EUTRA_TDD_Support;
+  guint8 GERAN_To_EUTRAN_supportInGERAN_PTM;
+  guint8 PriorityBasedReselectionSupport;
+
 } Content_t;
 
 #define ABSOLUTE_MAX_BANDS            2 /*  New fields for R4 extend the length of the capabilities message so we can only send 2 */
@@ -1204,12 +1229,21 @@
 #define MAX_ACCESS_TECHNOLOGIES_COUNT 16 /* No more than 16 instances */
 
 typedef enum
-{/* See TS 24.008 table 10.5.146, GSM R and GSM 450/480 excluded */
+{/* See TS 24.008 table 10.5.146 */
   AccTech_GSMP     = 0x0,
   AccTech_GSME     = 0x1,
+  AccTech_GSMR     = 0x2,
   AccTech_GSM1800  = 0x3,
   AccTech_GSM1900  = 0x4,
+  AccTech_GSM450   = 0x5,
+  AccTech_GSM480   = 0x6,
   AccTech_GSM850   = 0x7,
+  AccTech_GSM750   = 0x8,
+  AccTech_GSMT830  = 0x9,
+  AccTech_GSMT410  = 0xa,
+  AccTech_GSMT900  = 0xb,
+  AccTech_GSM710   = 0xc,
+  AccTech_GSMT810  = 0xd,
   AccTech_GSMOther = 0xf
 } AccessTechnology_t;