From c5187a1824b61add1cd216ef5c432d8abaab1222 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 14 Jun 2012 20:48:19 +0800 Subject: move everything to src/ subdirectory The code corresponds to commit a9aa4777cc1144897a77dfb6c5c3d7325705251e in openbts-p2.8.git (Tue Jun 12 18:14:49 2012 +0400) --- Makefile.am | 89 - RLCMACTest.cpp | 205 -- bitvector.cpp | 118 -- bitvector.h | 45 - csn1.cpp | 2603 ----------------------- csn1.h | 574 ----- gprs_bssgp_pcu.cpp | 244 --- gprs_bssgp_pcu.h | 69 - gprs_debug.cpp | 81 - gprs_debug.h | 68 - gprs_rlcmac.cpp | 840 -------- gprs_rlcmac.h | 108 - gsmL1prim.h | 415 ---- gsm_rlcmac.cpp | 5430 ------------------------------------------------ gsm_rlcmac.h | 5130 --------------------------------------------- gsm_timer.cpp | 226 -- gsm_timer.h | 84 - pcu_l1_if.cpp | 213 -- pcu_l1_if.h | 79 - pcu_main.cpp | 191 -- src/Makefile.am | 89 + src/RLCMACTest.cpp | 205 ++ src/bitvector.cpp | 118 ++ src/bitvector.h | 45 + src/csn1.cpp | 2603 +++++++++++++++++++++++ src/csn1.h | 574 +++++ src/gprs_bssgp_pcu.cpp | 244 +++ src/gprs_bssgp_pcu.h | 69 + src/gprs_debug.cpp | 81 + src/gprs_debug.h | 68 + src/gprs_rlcmac.cpp | 840 ++++++++ src/gprs_rlcmac.h | 108 + src/gsmL1prim.h | 415 ++++ src/gsm_rlcmac.cpp | 5430 ++++++++++++++++++++++++++++++++++++++++++++++++ src/gsm_rlcmac.h | 5130 +++++++++++++++++++++++++++++++++++++++++++++ src/gsm_timer.cpp | 226 ++ src/gsm_timer.h | 84 + src/pcu_l1_if.cpp | 213 ++ src/pcu_l1_if.h | 79 + src/pcu_main.cpp | 191 ++ 40 files changed, 16812 insertions(+), 16812 deletions(-) delete mode 100644 Makefile.am delete mode 100644 RLCMACTest.cpp delete mode 100644 bitvector.cpp delete mode 100644 bitvector.h delete mode 100644 csn1.cpp delete mode 100644 csn1.h delete mode 100644 gprs_bssgp_pcu.cpp delete mode 100644 gprs_bssgp_pcu.h delete mode 100644 gprs_debug.cpp delete mode 100644 gprs_debug.h delete mode 100644 gprs_rlcmac.cpp delete mode 100644 gprs_rlcmac.h delete mode 100644 gsmL1prim.h delete mode 100644 gsm_rlcmac.cpp delete mode 100644 gsm_rlcmac.h delete mode 100644 gsm_timer.cpp delete mode 100644 gsm_timer.h delete mode 100644 pcu_l1_if.cpp delete mode 100644 pcu_l1_if.h delete mode 100644 pcu_main.cpp create mode 100644 src/Makefile.am create mode 100644 src/RLCMACTest.cpp create mode 100644 src/bitvector.cpp create mode 100644 src/bitvector.h create mode 100644 src/csn1.cpp create mode 100644 src/csn1.h create mode 100644 src/gprs_bssgp_pcu.cpp create mode 100644 src/gprs_bssgp_pcu.h create mode 100644 src/gprs_debug.cpp create mode 100644 src/gprs_debug.h create mode 100644 src/gprs_rlcmac.cpp create mode 100644 src/gprs_rlcmac.h create mode 100644 src/gsmL1prim.h create mode 100644 src/gsm_rlcmac.cpp create mode 100644 src/gsm_rlcmac.h create mode 100644 src/gsm_timer.cpp create mode 100644 src/gsm_timer.h create mode 100644 src/pcu_l1_if.cpp create mode 100644 src/pcu_l1_if.h create mode 100644 src/pcu_main.cpp diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index d113b2fb..00000000 --- a/Makefile.am +++ /dev/null @@ -1,89 +0,0 @@ -# -# Copyright 2008, 2009 Free Software Foundation, Inc. -# -# This software is distributed under the terms of the GNU Public License. -# See the COPYING file in the main directory for details. -# -# 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 3 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, see . -# - -include $(top_srcdir)/Makefile.common - -AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) -AM_CXXFLAGS = -Wall -ldl -pthread - -noinst_LTLIBRARIES = libgprs.la - -libgprs_la_SOURCES = \ - gprs_debug.cpp \ - csn1.cpp \ - gsm_rlcmac.cpp \ - gprs_bssgp_pcu.cpp \ - gprs_rlcmac.cpp \ - pcu_l1_if.cpp \ - gsm_timer.cpp \ - bitvector.cpp - -noinst_PROGRAMS = \ - RLCMACTest \ - pcu - -noinst_HEADERS = \ - gprs_debug.h \ - csn1.h \ - gsm_rlcmac.h \ - gprs_bssgp_pcu.h \ - gprs_rlcmac.h \ - pcu_l1_if.h \ - gsm_timer.h \ - bitvector.h - -OPENBSC_DIR = /home/ivan/work/openbsc/openbsc/openbsc -OPENGGSN_DIR = /home/ivan/work/openbsc/openggsn -OSMOCORE_DIR = /home/ivan/work/openbsc/libosmocore - -RLCMACTest_SOURCES = RLCMACTest.cpp -RLCMACTest_LDADD = \ - libgprs.la \ - -losmocore \ - $(COMMON_LA) - -pcu_SOURCES = pcu_main.cpp -pcu_LDADD = \ - libgprs.la \ - $(OPENBSC_DIR)/src/libgb/gprs_ns.o \ - $(OPENBSC_DIR)/src/libgb/gprs_bssgp.o \ - $(OPENBSC_DIR)/src/libgb/gprs_bssgp_bss.o \ - $(OPENBSC_DIR)/src/libgb/gprs_bssgp_util.o \ - $(OPENBSC_DIR)/src/libgb/gprs_ns_frgre.o \ - $(OPENGGSN_DIR)/gtp/queue.o \ - $(OPENGGSN_DIR)/gtp/lookupa.o \ - $(OPENGGSN_DIR)/gtp/pdp.o \ - $(OPENGGSN_DIR)/gtp/gtpie.o \ - $(OPENGGSN_DIR)/gtp/gtp.o \ - $(OPENBSC_DIR)/src/gprs/sgsn_libgtp.o \ - $(OPENBSC_DIR)/src/gprs/gprs_sndcp.o \ - $(OPENBSC_DIR)/src/gprs/crc24.o \ - $(OPENBSC_DIR)/src/gprs/gprs_llc.o \ - $(OPENBSC_DIR)/src/gprs/gprs_gmm.o \ - $(OPENBSC_DIR)/src/gprs/gprs_sgsn.o \ - $(OPENBSC_DIR)/src/libcommon/socket.o \ - $(OPENBSC_DIR)/src/libcommon/debug.o \ - $(OSMOCORE_DIR)/src/bitvec.o \ - $(OSMOCORE_DIR)/src/talloc.o \ - -losmocore \ - -losmogsm \ - $(COMMON_LA) - -#MOSTLYCLEANFILES += testSource testDestination diff --git a/RLCMACTest.cpp b/RLCMACTest.cpp deleted file mode 100644 index 2b819b75..00000000 --- a/RLCMACTest.cpp +++ /dev/null @@ -1,205 +0,0 @@ -/* RLCMACTest.cpp - * - * Copyright (C) 2011 Ivan Klyuchnikov - * - * 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. - */ - - - -//#include -#include -#include -#include -#include "csn1.h" -#include "gsm_rlcmac.h" -using namespace std; - -void printSizeofRLCMAC() -{ - cout << "sizeof RlcMacUplink_t " << sizeof(RlcMacUplink_t) << endl; - cout << "sizeof Packet_Cell_Change_Failure_t " << sizeof(Packet_Cell_Change_Failure_t) << endl; - cout << "sizeof Packet_Control_Acknowledgement_t " << sizeof(Packet_Control_Acknowledgement_t) << endl; - cout << "sizeof Packet_Downlink_Ack_Nack_t " << sizeof(Packet_Downlink_Ack_Nack_t) << endl; - cout << "sizeof EGPRS_PD_AckNack_t " << sizeof(EGPRS_PD_AckNack_t) << endl; - cout << "sizeof Packet_Uplink_Dummy_Control_Block_t " << sizeof(Packet_Uplink_Dummy_Control_Block_t) << endl; - cout << "sizeof Packet_Measurement_Report_t " << sizeof(Packet_Measurement_Report_t) << endl; - cout << "sizeof Packet_Resource_Request_t " << sizeof(Packet_Resource_Request_t) << endl; - cout << "sizeof Packet_Mobile_TBF_Status_t " << sizeof(Packet_Mobile_TBF_Status_t) << endl; - cout << "sizeof Packet_PSI_Status_t " << sizeof(Packet_PSI_Status_t) << endl; - cout << "sizeof Packet_Enh_Measurement_Report_t " << sizeof(Packet_Enh_Measurement_Report_t) << endl; - cout << "sizeof Packet_Cell_Change_Notification_t " << sizeof(Packet_Cell_Change_Notification_t) << endl; - cout << "sizeof Packet_SI_Status_t " << sizeof(Packet_SI_Status_t) << endl; - cout << "sizeof Additional_MS_Rad_Access_Cap_t " << sizeof(Additional_MS_Rad_Access_Cap_t) << endl; - cout << "sizeof Packet_Pause_t " << sizeof(Packet_Pause_t) << endl; - - cout << "sizeof RlcMacDownlink_t " << sizeof(RlcMacDownlink_t) << endl; - cout << "sizeof Packet_Access_Reject_t " << sizeof(Packet_Access_Reject_t) << endl; - cout << "sizeof Packet_Cell_Change_Order_t " << sizeof(Packet_Cell_Change_Order_t) << endl; - cout << "sizeof Packet_Downlink_Assignment_t " << sizeof(Packet_Downlink_Assignment_t) << endl; - cout << "sizeof Packet_Measurement_Order_Reduced_t " << sizeof(Packet_Measurement_Order_Reduced_t) << endl; - cout << "sizeof Packet_Neighbour_Cell_Data_t " << sizeof(Packet_Neighbour_Cell_Data_t) << endl; - cout << "sizeof Packet_Serving_Cell_Data_t " << sizeof(Packet_Serving_Cell_Data_t) << endl; - cout << "sizeof Packet_Paging_Request_t " << sizeof(Packet_Paging_Request_t) << endl; - cout << "sizeof Packet_PDCH_Release_t " << sizeof(Packet_PDCH_Release_t) << endl; - cout << "sizeof Packet_Polling_Request_t " << sizeof(Packet_Polling_Request_t) << endl; - cout << "sizeof Packet_Power_Control_Timing_Advance_t " << sizeof(Packet_Power_Control_Timing_Advance_t) << endl; - cout << "sizeof Packet_PRACH_Parameters_t " << sizeof(Packet_PRACH_Parameters_t) << endl; - cout << "sizeof Packet_Queueing_Notification_t " << sizeof(Packet_Queueing_Notification_t) << endl; - cout << "sizeof Packet_Timeslot_Reconfigure_t " << sizeof(Packet_Timeslot_Reconfigure_t) << endl; - cout << "sizeof Packet_TBF_Release_t " << sizeof(Packet_TBF_Release_t) << endl; - cout << "sizeof Packet_Uplink_Ack_Nack_t " << sizeof(Packet_Uplink_Ack_Nack_t) << endl; - cout << "sizeof Packet_Uplink_Assignment_t " << sizeof(Packet_Uplink_Assignment_t) << endl; - cout << "sizeof Packet_Cell_Change_Continue_t " << sizeof(Packet_Cell_Change_Continue_t) << endl; - cout << "sizeof Packet_Handover_Command_t " << sizeof(Packet_Handover_Command_t) << endl; - cout << "sizeof Packet_PhysicalInformation_t " << sizeof(Packet_PhysicalInformation_t) << endl; - cout << "sizeof Packet_Downlink_Dummy_Control_Block_t " << sizeof(Packet_Downlink_Dummy_Control_Block_t) << endl; - cout << "sizeof PSI1_t " << sizeof(PSI1_t) << endl; - cout << "sizeof PSI2_t " << sizeof(PSI2_t) << endl; - cout << "sizeof PSI3_t " << sizeof(PSI3_t) << endl; - cout << "sizeof PSI3_BIS_t " << sizeof(PSI3_BIS_t) << endl; - cout << "sizeof PSI4_t " << sizeof(PSI4_t) << endl; - cout << "sizeof PSI13_t " << sizeof(PSI13_t) << endl; - cout << "sizeof PSI5_t " << sizeof(PSI5_t) << endl; -} - -void testRlcMacDownlink() -{ - struct bitvec *resultVector = bitvec_alloc(23); - bitvec_unhex(resultVector, "2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b"); - - std::string testData[] = { - "4e082500e3f1a81d080820800b2b2b2b2b2b2b2b2b2b2b", // Packet Downlink Assignment - "48282407a6a074227201000b2b2b2b2b2b2b2b2b2b2b2b", // Packet Uplink Assignment - "47240c00400000000000000079eb2ac9402b2b2b2b2b2b", // Packet Uplink Ack Nack - "47283c367513ba333004242b2b2b2b2b2b2b2b2b2b2b2b" // Packet Uplink Assignment - "4913e00850884013a8048b2b2b2b2b2b2b2b2b2b2b2b2b" - "412430007fffffffffffffffefd19c7ba12b2b2b2b2b2b" - "41942b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b" - }; - - int testDataSize = sizeof(testData)/sizeof(testData[0]); - - cout << " DOWNLINK " << endl; - for (int i = 0; i < testDataSize; i++) - { - bitvec *vector = bitvec_alloc(23); - bitvec_unhex(vector, testData[i].c_str()); - cout << "vector1 = "; - for (int i = 0; i < 23; i++) - { - cout << hex << (unsigned)*(vector->data + i); - } - cout << endl; - RlcMacDownlink_t * data = (RlcMacDownlink_t *)malloc(sizeof(RlcMacDownlink_t)); - cout << "=========Start DECODE===========" << endl; - decode_gsm_rlcmac_downlink(vector, data); - cout << "+++++++++Finish DECODE++++++++++" << endl; - cout << "=========Start ENCODE=============" << endl; - encode_gsm_rlcmac_downlink(resultVector, data); - cout << "+++++++++Finish ENCODE+++++++++++" << endl; - cout << "vector1 = "; - for (int i = 0; i < 23; i++) - { - cout << (unsigned)*(vector->data + i); - } - cout << endl; - cout << "vector2 = "; - for (int i = 0; i < 23; i++) - { - cout << (unsigned)*(resultVector->data + i); - } - cout << endl; - if (memcmp(vector->data, resultVector->data, 23) == 0) - { - cout << "vector1 == vector2 : TRUE" << endl; - } - else - { - cout << "vector1 == vector2 : FALSE" << endl; - } - bitvec_unhex(resultVector, "2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b"); - bitvec_free(vector); - free(data); - } -} - - -void testRlcMacUplink() -{ - struct bitvec *resultVector = bitvec_alloc(23); - bitvec_unhex(resultVector, "2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b"); - - std::string testData[] = { - "400e1e61d11f2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b", // Packet Uplink Dummy Control Block - "400b8020000000000000002480e00b2b2b2b2b2b2b2b2b", // Packet Downlink Ack/Nack - "4016713dc094270ca2ae57ef909006aa0fc0001f80222b" // Packet Resource Request - "400a9020000000000000003010012a0800132b2b2b2b2b" - }; - - int testDataSize = sizeof(testData)/sizeof(testData[0]); - - - cout << " UPLINK " << endl; - for (int i = 0; i < testDataSize; i++) - { - bitvec *vector = bitvec_alloc(23); - bitvec_unhex(vector, testData[i].c_str()); - cout << "vector1 = "; - for (int i = 0; i < 23; i++) - { - cout << hex << (unsigned)*(vector->data + i); - } - cout << endl; - RlcMacUplink_t * data = (RlcMacUplink_t *)malloc(sizeof(RlcMacUplink_t)); - cout << "=========Start DECODE===========" << endl; - decode_gsm_rlcmac_uplink(vector, data); - cout << "+++++++++Finish DECODE++++++++++" << endl; - cout << "=========Start ENCODE=============" << endl; - encode_gsm_rlcmac_uplink(resultVector, data); - cout << "+++++++++Finish ENCODE+++++++++++" << endl; - cout << "vector1 = "; - for (int i = 0; i < 23; i++) - { - cout << (unsigned)*(vector->data + i); - } - cout << endl; - cout << "vector2 = "; - for (int i = 0; i < 23; i++) - { - cout << (unsigned)*(resultVector->data + i); - } - cout << endl; - if (memcmp(vector->data, resultVector->data, 23) == 0) - { - cout << "vector1 == vector2 : TRUE" << endl; - } - else - { - cout << "vector1 == vector2 : FALSE" << endl; - } - bitvec_unhex(resultVector, "2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b"); - bitvec_free(vector); - free(data); - } -} - -int main(int argc, char *argv[]) -{ - //printSizeofRLCMAC(); - testRlcMacDownlink(); - testRlcMacUplink(); - -} diff --git a/bitvector.cpp b/bitvector.cpp deleted file mode 100644 index 36ef7988..00000000 --- a/bitvector.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* bitvector.cpp - * - * Copyright (C) 2012 Ivan Klyuchnikov - * - * 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. - */ - -/*! \addtogroup bitvector - * @{ - */ - -/*! \file bitvector.cpp - * \brief Additional functions for Osmocom bit vector abstraction. - */ - -#include -extern "C" { -#include -} - -void *bv_tall_ctx; - -struct bitvec *bitvec_alloc(unsigned size) -{ - struct bitvec *bv = talloc_zero(bv_tall_ctx, struct bitvec); - bv->data_len = size; - bv->cur_bit = 0; - bv->data = talloc_zero_array(bv_tall_ctx, uint8_t, size); - return bv; -} - -void bitvec_free(struct bitvec *bv) -{ - talloc_free(bv->data); - talloc_free(bv); -} - -int bitvec_pack(struct bitvec *bv, uint8_t *buffer) -{ - int i = 0; - for (i = 0; i < bv->data_len; i++) - { - buffer[i] = bv->data[i]; - } - return i; -} - -int bitvec_unpack(struct bitvec *bv, uint8_t *buffer) -{ - int i = 0; - for (i = 0; i < bv->data_len; i++) - { - bv->data[i] = buffer[i]; - } - return i; -} - - -int bitvec_unhex(struct bitvec *bv, const char* src) -{ - unsigned val; - unsigned write_index = 0; - unsigned digits = bv->data_len*2; - for (unsigned i=0; icur_bit = read_index; - - for (i = 0; i < len; i++) { - int bit = bitvec_get_bit_pos((const struct bitvec *)bv, bv->cur_bit); - if (bit < 0) - return bit; - if (bit) - ui |= ((uint64_t)1 << (len - i - 1)); - bv->cur_bit++; - } - read_index += len; - return ui; -} - - -int bitvec_write_field(struct bitvec *bv, unsigned& write_index, uint64_t val, unsigned len) -{ - int i, rc; - bv->cur_bit = write_index; - for (i = 0; i < len; i++) { - int bit = 0; - if (val & ((uint64_t)1 << (len - i - 1))) - bit = 1; - rc = bitvec_set_bit(bv, (bit_value)bit); - if (rc) - return rc; - } - write_index += len; - return 0; -} diff --git a/bitvector.h b/bitvector.h deleted file mode 100644 index 7409d551..00000000 --- a/bitvector.h +++ /dev/null @@ -1,45 +0,0 @@ -/* bitvector.h - * - * Copyright (C) 2012 Ivan Klyuchnikov - * - * 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. - */ - -#ifndef BITVECTOR_H -#define BITVECTOR_H - -/*! \defgroup bitvector Bit vectors - * @{ - */ - -/*! \file bitvector.h - * \brief Additional functions for Osmocom bit vector abstraction. - */ - -extern "C" { -#include -} - -struct bitvec *bitvec_alloc(unsigned size); -void bitvec_free(struct bitvec *bv); -int bitvec_unhex(struct bitvec *bv, const char* src); -int bitvec_pack(struct bitvec *bv, uint8_t *buffer); -int bitvec_unpack(struct bitvec *bv, uint8_t *buffer); -uint64_t bitvec_read_field(struct bitvec *bv, unsigned& read_index, unsigned len); -int bitvec_write_field(struct bitvec *bv, unsigned& write_index, uint64_t val, unsigned len); - -/*! }@ */ - -#endif // BITVECTOR_H diff --git a/csn1.cpp b/csn1.cpp deleted file mode 100644 index e30eb353..00000000 --- a/csn1.cpp +++ /dev/null @@ -1,2603 +0,0 @@ -/* csn1.cpp - * Routines for CSN1 dissection in wireshark. - * - * Copyright (C) 2011 Ivan Klyuchnikov - * - * By Vincent Helfre, based on original code by Jari Sassi - * with the gracious authorization of STE - * Copyright (c) 2011 ST-Ericsson - * - * $Id: packet-csn1.c 39140 2011-09-25 22:01:50Z wmeier $ - * - * Wireshark - Network traffic analyzer - * By Gerald Combs - * 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. - */ - -#include -#include -#include -#include -#include "csn1.h" -#include - - -#define pvDATA(_pv, _offset) ((void*) ((unsigned char*)_pv + _offset)) -#define pui8DATA(_pv, _offset) ((guint8*) pvDATA(_pv, _offset)) -#define pui16DATA(_pv, _offset) ((guint16*) pvDATA(_pv, _offset)) -#define pui32DATA(_pv, _offset) ((guint32*) pvDATA(_pv, _offset)) -#define pui64DATA(_pv, _offset) ((guint64*) pvDATA(_pv, _offset)) -/* used to tag existence of next element in variable length lists */ -#define STANDARD_TAG 1 -#define REVERSED_TAG 0 - -using namespace std; -static const unsigned char ixBitsTab[] = {0, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5}; - - -/* Returns no_of_bits (up to 8) masked with 0x2B */ - -static guint8 -get_masked_bits8( bitvec *vector, size_t& readIndex, gint bit_offset, const gint no_of_bits) -{ - static const guint8 maskBits[] = {0x00, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF}; - //gint byte_offset = bit_offset >> 3; /* divide by 8 */ - gint relative_bit_offset = bit_offset & 0x07; /* modulo 8 */ - guint8 result; - gint bit_shift = 8 - relative_bit_offset - (gint) no_of_bits; - readIndex -= relative_bit_offset; - if (bit_shift >= 0) - { - result = (0x2B ^ ((guint8)bitvec_read_field(vector, readIndex, 8))) >> bit_shift; - readIndex-= bit_shift; - result &= maskBits[no_of_bits]; - } - else - { - guint8 hight_part = (0x2B ^ ((guint8)bitvec_read_field(vector, readIndex, 8))) & maskBits[8 - relative_bit_offset]; - hight_part = (guint8) (hight_part << (-bit_shift)); - result = (0x2B ^ ((guint8)bitvec_read_field(vector, readIndex, 8))) >> (8 + bit_shift); - readIndex = readIndex - (8 - (-bit_shift)); - result |= hight_part; - } - return result; -} - -/** - * ================================================================================================ - * set initial/start values in help data structure used for packing/unpacking operation - * ================================================================================================ - */ -void -csnStreamInit(csnStream_t* ar, gint bit_offset, gint remaining_bits_len) -{ - ar->remaining_bits_len = remaining_bits_len; - ar->bit_offset = bit_offset; -} - -static const char* ErrCodes[] = -{ - "General 0", - "General -1", - "DATA_NOT VALID", - "IN SCRIPT", - "INVALID UNION INDEX", - "NEED_MORE BITS TO UNPACK", - "ILLEGAL BIT VALUE", - "Internal", - "STREAM_NOT_SUPPORTED", - "MESSAGE_TOO_LONG" -}; - -static gint16 -ProcessError( size_t readIndex, const char* sz, gint16 err, const CSN_DESCR* pDescr) -{ - gint16 i = MIN(-err, ((gint16) ElementsOf(ErrCodes)-1)); - if (i >= 0) - { - //LOG(ERR) << sz << "Error code: "<< ErrCodes[i] << pDescr?(pDescr->sz):"-"; - } - else - { - //LOG(ERR) << sz << ": " << pDescr?(pDescr->sz):"-"; - } - return err; -} - -//#if 0 -static const char* CSN_DESCR_type[]= -{ - "CSN_END", - "CSN_BIT", - "CSN_UINT", - "CSN_TYPE", - "CSN_CHOICE", - "CSN_UNION", - "CSN_UNION_LH", - "CSN_UINT_ARRAY", - "CSN_TYPE_ARRAY", - "CSN_BITMAP", - "CSN_VARIABLE_BITMAP", - "CSN_VARIABLE_BITMAP_1", - "CSN_LEFT_ALIGNED_VAR_BMP", - "CSN_LEFT_ALIGNED_VAR_BMP_1", - "CSN_VARIABLE_ARRAY", - "CSN_VARIABLE_TARRAY", - "CSN_VARIABLE_TARRAY_OFFSET", - "CSN_RECURSIVE_ARRAY", - "CSN_RECURSIVE_TARRAY", - "CSN_RECURSIVE_TARRAY_1", - "CSN_RECURSIVE_TARRAY_2", - "CSN_EXIST", - "CSN_EXIST_LH", - "CSN_NEXT_EXIST", - "CSN_NEXT_EXIST_LH", - "CSN_NULL", - "CSN_FIXED", - "CSN_CALLBACK", - "CSN_UINT_OFFSET", - "CSN_UINT_LH", - "CSN_SERIALIZE", - "CSN_TRAP_ERROR" - "CSN_???" -}; -//#endif - -/** - * ================================================================================================ - * Return TRUE if tag in bit stream indicates existence of next list element, - * otherwise return FALSE. - * Will work for tag values equal to both 0 and 1. - * ================================================================================================ - */ - -static gboolean -existNextElement(bitvec *vector, size_t& readIndex, guint8 Tag) -{ - guint8 res = bitvec_read_field(vector, readIndex, 1); - if (Tag == STANDARD_TAG) - { - return (res > 0); - } - return (res == 0); -} - - -gint16 -csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector, size_t& readIndex, void* data) -{ - gint remaining_bits_len = ar->remaining_bits_len; - gint bit_offset = ar->bit_offset; - guint8* pui8; - guint16* pui16; - guint32* pui32; - guint64* pui64; - guint8 Tag = STANDARD_TAG; - - if (remaining_bits_len <= 0) - { - return 0; - } - - do - { - switch (pDescr->type) - { - case CSN_BIT: - { - if (remaining_bits_len > 0) - { - pui8 = pui8DATA(data, pDescr->offset); - *pui8 = bitvec_read_field(vector, readIndex, 1); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - /* end add the bit value to protocol tree */ - } - else - { - return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - - pDescr++; - remaining_bits_len--; - bit_offset++; - break; - } - - case CSN_NULL: - { /* Empty member! */ - pDescr++; - break; - } - - case CSN_UINT: - { - guint8 no_of_bits = (guint8) pDescr->i; - - if (remaining_bits_len >= no_of_bits) - { - if (no_of_bits <= 8) - { - guint8 ui8 = bitvec_read_field(vector, readIndex, no_of_bits); - pui8 = pui8DATA(data, pDescr->offset); - *pui8 = ui8; - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - } - else if (no_of_bits <= 16) - { - guint16 ui16 = bitvec_read_field(vector, readIndex, no_of_bits); - pui16 = pui16DATA(data, pDescr->offset); - *pui16 = ui16; - LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui16); - } - else if (no_of_bits <= 32) - { - guint32 ui32 = bitvec_read_field(vector, readIndex, no_of_bits); - pui32 = pui32DATA(data, pDescr->offset); - *pui32 = ui32; - LOGPC(DCSN1, LOGL_NOTICE, "%s = 0x%08x | ", pDescr->sz , *pui32); - } - else - { - return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_GENERAL, pDescr); - } - } - else - { - return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - - remaining_bits_len -= no_of_bits; - bit_offset += no_of_bits; - pDescr++; - break; - } - - case CSN_UINT_OFFSET: - { - guint8 no_of_bits = (guint8) pDescr->i; - - if (remaining_bits_len >= no_of_bits) - { - if (no_of_bits <= 8) - { - guint8 ui8 = bitvec_read_field(vector, readIndex, no_of_bits); - pui8 = pui8DATA(data, pDescr->offset); - *pui8 = ui8 + (guint8)pDescr->descr.value; - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - } - else if (no_of_bits <= 16) - { - guint16 ui16 = bitvec_read_field(vector, readIndex, no_of_bits); - pui16 = pui16DATA(data, pDescr->offset); - *pui16 = ui16 + (guint16)pDescr->descr.value; - LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui16); - } - else if (no_of_bits <= 32) - { - guint32 ui32 = bitvec_read_field(vector, readIndex, no_of_bits); - pui32 = pui32DATA(data, pDescr->offset); - *pui32 = ui32 + (guint16)pDescr->descr.value; - LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui32); - } - else - { - return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_GENERAL, pDescr); - } - } - else - { - return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - - remaining_bits_len -= no_of_bits; - bit_offset += no_of_bits; - pDescr++; - break; - } - - case CSN_UINT_LH: - { - guint8 no_of_bits = (guint8) pDescr->i; - - if (remaining_bits_len >= no_of_bits) - { - remaining_bits_len -= no_of_bits; - if (no_of_bits <= 8) - { - guint8 ui8 = get_masked_bits8(vector, readIndex, bit_offset, no_of_bits); - pui8 = pui8DATA(data, pDescr->offset); - *pui8 = ui8; - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - } - else - {/* Maybe we should support more than 8 bits ? */ - return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_GENERAL, pDescr); - } - } - else - { - return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - - remaining_bits_len -= no_of_bits; - bit_offset += no_of_bits; - pDescr++; - break; - } - - case CSN_UINT_ARRAY: - { - guint8 no_of_bits = (guint8) pDescr->i; - guint16 nCount = (guint16)pDescr->descr.value; /* nCount supplied by value i.e. M_UINT_ARRAY(...) */ - - if (pDescr->serialize.value != 0) - { /* nCount specified by a reference to field holding value i.e. M_VAR_UINT_ARRAY(...) */ - nCount = *pui16DATA(data, nCount); - } - - if (remaining_bits_len >= no_of_bits) - { - remaining_bits_len -= (no_of_bits*nCount); - if (no_of_bits <= 8) - { - pui8 = pui8DATA(data, pDescr->offset); - do - { - *pui8 = bitvec_read_field(vector, readIndex, no_of_bits); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - pui8++; - bit_offset += no_of_bits; - } while (--nCount > 0); - } - else if (no_of_bits <= 16) - { - return ProcessError(readIndex,"csnStreamDecoder NOTIMPLEMENTED", 999, pDescr); - } - else if (no_of_bits <= 32) - { - return ProcessError(readIndex,"csnStreamDecoder NOTIMPLEMENTED", 999, pDescr); - } - else - { - return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_GENERAL, pDescr); - } - } - else - { - return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - pDescr++; - break; - } - - case CSN_VARIABLE_TARRAY_OFFSET: - case CSN_VARIABLE_TARRAY: - case CSN_TYPE_ARRAY: - { - gint16 Status; - csnStream_t arT = *ar; - gint16 nCount = pDescr->i; - guint16 nSize = (guint16)(gint32)pDescr->serialize.value; - - pui8 = pui8DATA(data, pDescr->offset); - if (pDescr->type == CSN_VARIABLE_TARRAY) - { /* Count specified in field */ - nCount = *pui8DATA(data, pDescr->i); - } - else if (pDescr->type == CSN_VARIABLE_TARRAY_OFFSET) - { /* Count specified in field */ - nCount = *pui8DATA(data, pDescr->i); - /* nCount--; the 1 offset is already taken into account in CSN_UINT_OFFSET */ - } - - while (nCount > 0) - { /* resulting array of length 0 is possible - * but no bits shall be read from bitstream - */ - - LOGPC(DCSN1, LOGL_NOTICE, "%s | ", pDescr->sz); - csnStreamInit(&arT, bit_offset, remaining_bits_len); - Status = csnStreamDecoder(&arT, (const CSN_DESCR*)pDescr->descr.ptr, vector, readIndex, pui8); - if (Status >= 0) - { - pui8 += nSize; - remaining_bits_len = arT.remaining_bits_len; - bit_offset = arT.bit_offset; - } - else - { - return Status; - } - nCount--; - } - - pDescr++; - break; - } - - case CSN_BITMAP: - { /* bitmap with given length. The result is left aligned! */ - guint8 no_of_bits = (guint8) pDescr->i; /* length of bitmap */ - - if (no_of_bits > 0) - { - - if (no_of_bits <= 32) - { - for(unsigned ib = 0; ib < 4; ib++) - { - guint8 ui8 = bitvec_read_field(vector, readIndex, 8); - pui8 = pui8DATA(data, pDescr->offset+ib); - *pui8 = ui8; - LOGPC(DCSN1, LOGL_NOTICE, "%s[%u] = %u | ", pDescr->sz , ib, (unsigned)*pui8); - } - } - else if (no_of_bits <= 64) - { - for(unsigned ib = 0; ib < 8; ib++) - { - guint8 ui8 = bitvec_read_field(vector, readIndex, 8); - pui8 = pui8DATA(data, pDescr->offset+ib); - *pui8 = ui8; - LOGPC(DCSN1, LOGL_NOTICE, "%s[%u] = %u | ", pDescr->sz , ib, (unsigned)*pui8); - } - } - else - { - return ProcessError(readIndex,"csnStreamDecoder NOT IMPLEMENTED", 999, pDescr); - } - - remaining_bits_len -= no_of_bits; - assert(remaining_bits_len >= 0); - bit_offset += no_of_bits; - } - /* bitmap was successfully extracted or it was empty */ - - pDescr++; - break; - } - - case CSN_TYPE: - { - gint16 Status; - csnStream_t arT = *ar; - LOGPC(DCSN1, LOGL_NOTICE, " : %s | ", pDescr->sz); - csnStreamInit(&arT, bit_offset, remaining_bits_len); - Status = csnStreamDecoder(&arT, (const CSN_DESCR*)pDescr->descr.ptr, vector, readIndex, pvDATA(data, pDescr->offset)); - LOGPC(DCSN1, LOGL_NOTICE, ": End %s | ", pDescr->sz); - if (Status >= 0) - { - remaining_bits_len = arT.remaining_bits_len; - bit_offset = arT.bit_offset; - pDescr++; - } - else - { - /* Has already been processed: ProcessError("csnStreamDecoder", Status, pDescr); */ - return Status; - } - - break; - } - - case CSN_CHOICE: - { - gint16 count = pDescr->i; - guint8 i = 0; - CSN_ChoiceElement_t* pChoice = (CSN_ChoiceElement_t*) pDescr->descr.ptr; - - while (count > 0) - { - guint8 no_of_bits = pChoice->bits; - guint8 value = bitvec_read_field(vector, readIndex, no_of_bits); - if (value == pChoice->value) - { - CSN_DESCR descr[2]; - gint16 Status; - csnStream_t arT = *ar; - - descr[0] = pChoice->descr; - memset(&descr[1], 0x00, sizeof(CSN_DESCR)); - descr[1].type = CSN_END; - pui8 = pui8DATA(data, pDescr->offset); - *pui8 = i; - LOGPC(DCSN1, LOGL_NOTICE, "Choice %s = %u | ", pDescr->sz , (unsigned)value); - bit_offset += no_of_bits; - remaining_bits_len -= no_of_bits; - - csnStreamInit(&arT, bit_offset, remaining_bits_len); - Status = csnStreamDecoder(&arT, descr, vector, readIndex, data); - - if (Status >= 0) - { - remaining_bits_len = arT.remaining_bits_len; - bit_offset = arT.bit_offset; - } - else - { - return Status; - } - break; - } - - readIndex -= no_of_bits; - count--; - pChoice++; - i++; - } - - pDescr++; - break; - } - - case CSN_SERIALIZE: - { - StreamSerializeFcn_t serialize = pDescr->serialize.fcn; - csnStream_t arT = *ar; - gint16 Status = -1; - - LOGPC(DCSN1, LOGL_NOTICE, "%s length = %d | ", pDescr->sz , (int)bitvec_read_field(vector, readIndex, 7)); - arT.direction = 1; - bit_offset += 7; - remaining_bits_len -= 7; - - csnStreamInit(&arT, bit_offset, remaining_bits_len); - Status = serialize(&arT, vector, readIndex, pvDATA(data, pDescr->offset)); - - if (Status >= 0) - { - remaining_bits_len = arT.remaining_bits_len; - bit_offset = arT.bit_offset; - pDescr++; - } - else - { - /* Has already been processed: */ - return Status; - } - - break; - } - - case CSN_UNION_LH: - case CSN_UNION: - { - gint16 Bits; - guint8 index; - gint16 count = pDescr->i; - const CSN_DESCR* pDescrNext = pDescr; - - pDescrNext += count + 1; /* now this is next after the union */ - if ((count <= 0) || (count > 16)) - { - return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_INVALID_UNION_INDEX, pDescr); - } - - /* Now get the bits to extract the index */ - Bits = ixBitsTab[count]; - index = 0; - - while (Bits > 0) - { - index <<= 1; - - if (CSN_UNION_LH == pDescr->type) - { - index |= get_masked_bits8(vector,readIndex, bit_offset, 1); - } - else - { - index |= bitvec_read_field(vector, readIndex, 1); - } - remaining_bits_len--; - bit_offset++; - Bits--; - } - - /* Assign UnionType */ - pui8 = pui8DATA(data, pDescr->offset); - *pui8 = index; - - - /* script index to continue on, limited in case we do not have a power of 2 */ - pDescr += (MIN(index + 1, count)); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - - switch (pDescr->type) - { /* get the right element of the union based on computed index */ - - case CSN_BIT: - { - pui8 = pui8DATA(data, pDescr->offset); - *pui8 = 0x00; - if (bitvec_read_field(vector, readIndex, 1) > 0) - { - *pui8 = 0x01; - } - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - remaining_bits_len -= 1; - bit_offset++; - pDescr++; - break; - } - - case CSN_NULL: - { /* Empty member! */ - pDescr++; - break; - } - - case CSN_UINT: - { - guint8 no_of_bits = (guint8) pDescr->i; - if (remaining_bits_len >= no_of_bits) - { - remaining_bits_len -= no_of_bits; - - if (no_of_bits <= 8) - { - guint8 ui8 = bitvec_read_field(vector, readIndex, no_of_bits); - pui8 = pui8DATA(data, pDescr->offset); - *pui8 = ui8; - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - } - else if (no_of_bits <= 16) - { - guint16 ui16 = bitvec_read_field(vector, readIndex, no_of_bits); - pui16 = pui16DATA(data, pDescr->offset); - *pui16 = ui16; - LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui16); - } - else if (no_of_bits <= 32) - { - guint32 ui32 = bitvec_read_field(vector, readIndex, no_of_bits); - pui32 = pui32DATA(data, pDescr->offset); - *pui32 = ui32; - LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui32); - } - else - { - return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_GENERAL, pDescr); - } - } - else - { - return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_GENERAL, pDescr); - } - - bit_offset += no_of_bits; - pDescr++; - break; - } - - case CSN_UINT_OFFSET: - { - guint8 no_of_bits = (guint8) pDescr->i; - - if (remaining_bits_len >= no_of_bits) - { - if (no_of_bits <= 8) - { - guint8 ui8 = bitvec_read_field(vector, readIndex, no_of_bits); - pui8 = pui8DATA(data, pDescr->offset); - *pui8 = ui8 + (guint8)pDescr->descr.value; - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - } - else if (no_of_bits <= 16) - { - guint16 ui16 = bitvec_read_field(vector, readIndex, no_of_bits); - pui16 = pui16DATA(data, pDescr->offset); - *pui16 = ui16 + (guint16)pDescr->descr.value; - LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui16); - } - else if (no_of_bits <= 32) - { - guint32 ui32 = bitvec_read_field(vector, readIndex, no_of_bits); - pui32 = pui32DATA(data, pDescr->offset); - *pui32 = ui32 + (guint16)pDescr->descr.value; - LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui32); - } - else - { - return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_GENERAL, pDescr); - } - } - else - { - return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - - bit_offset += no_of_bits; - pDescr++; - break; - } - - case CSN_UINT_LH: - { - guint8 no_of_bits = (guint8) pDescr->i; - - if (remaining_bits_len >= no_of_bits) - { - if (no_of_bits <= 8) - { - guint8 ui8 = get_masked_bits8(vector, readIndex, bit_offset, no_of_bits); - pui8 = pui8DATA(data, pDescr->offset); - *pui8 = ui8; - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - } - else - { /* Maybe we should support more than 8 bits ? */ - return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_GENERAL, pDescr); - } - } - else - { - return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - - bit_offset += no_of_bits; - pDescr++; - break; - } - - case CSN_UINT_ARRAY: - { - guint8 no_of_bits = (guint8) pDescr->i; - guint16 nCount = (guint16)pDescr->descr.value; /* nCount supplied by value i.e. M_UINT_ARRAY(...) */ - - if (pDescr->serialize.value != 0) - { /* nCount specified by a reference to field holding value i.e. M_VAR_UINT_ARRAY(...) */ - nCount = *pui16DATA(data, nCount); - } - - if (remaining_bits_len >= no_of_bits) - { - remaining_bits_len -= (no_of_bits * nCount); - if (no_of_bits <= 8) - { - pui8 = pui8DATA(data, pDescr->offset); - - while (nCount > 0) - { - *pui8 = bitvec_read_field(vector, readIndex, no_of_bits); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - pui8++; - bit_offset += no_of_bits; - nCount--; - } - } - else if (no_of_bits <= 16) - { - pui16 = pui16DATA(data, pDescr->offset); - - while (nCount > 0) - { - *pui16 = bitvec_read_field(vector, readIndex, no_of_bits); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , *pui16); - pui16++; - bit_offset += no_of_bits; - nCount--; - } - } - else if (no_of_bits <= 32) - { /* not supported */ - return ProcessError(readIndex,"csnStreamDecoder NOT IMPLEMENTED", 999, pDescr); - } - else - { - return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_GENERAL, pDescr); - } - } - else - { - return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - - pDescr++; - break; - } - - case CSN_VARIABLE_TARRAY_OFFSET: - case CSN_VARIABLE_TARRAY: - case CSN_TYPE_ARRAY: - { - gint16 Status; - csnStream_t arT = *ar; - guint16 nCount = (guint16) pDescr->i; - guint16 nSize = (guint16)(guint32)pDescr->serialize.value; - - pui8 = pui8DATA(data, pDescr->offset); - - if (CSN_VARIABLE_TARRAY == pDescr->type) - { /* Count specified in field */ - nCount = *pui8DATA(data, pDescr->i); - } - else if (CSN_VARIABLE_TARRAY_OFFSET == pDescr->type) - { /* Count specified in field */ - nCount = *pui8DATA(data, pDescr->i); - nCount--; /* Offset 1 */ - } - - while (nCount--) /* Changed to handle length = 0. */ - { - LOGPC(DCSN1, LOGL_NOTICE, "%s | ", pDescr->sz); - csnStreamInit(&arT, bit_offset, remaining_bits_len); - Status = csnStreamDecoder(&arT, (const CSN_DESCR*)pDescr->descr.ptr, vector, readIndex, pui8); - if (Status >= 0) - { - pui8 += nSize; - remaining_bits_len = arT.remaining_bits_len; - bit_offset = arT.bit_offset; - } - else - { - return Status; - } - } - - pDescr++; - break; - } - - case CSN_BITMAP: - { /* bitmap with given length. The result is left aligned! */ - guint8 no_of_bits = (guint8) pDescr->i; /* length of bitmap */ - - if (no_of_bits > 0) - { - - if (no_of_bits <= 32) - { - guint32 ui32 = bitvec_read_field(vector, readIndex, no_of_bits); - pui32 = pui32DATA(data, pDescr->offset); - *pui32 = ui32; - } - else if (no_of_bits <= 64) - { - guint64 ui64 = bitvec_read_field(vector, readIndex, no_of_bits); - pui64 = pui64DATA(data, pDescr->offset); - *pui64 = ui64; - LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui64); - } - else - { - return ProcessError(readIndex,"csnStreamDecoder NOT IMPLEMENTED", 999, pDescr); - } - - remaining_bits_len -= no_of_bits; - assert(remaining_bits_len >= 0); - bit_offset += no_of_bits; - } - /* bitmap was successfully extracted or it was empty */ - - pDescr++; - break; - } - - case CSN_TYPE: - { - gint16 Status; - csnStream_t arT = *ar; - LOGPC(DCSN1, LOGL_NOTICE, " : %s | ", pDescr->sz); - csnStreamInit(&arT, bit_offset, remaining_bits_len); - Status = csnStreamDecoder(&arT, (const CSN_DESCR*)pDescr->descr.ptr, vector, readIndex, pvDATA(data, pDescr->offset)); - LOGPC(DCSN1, LOGL_NOTICE, " : End %s | ", pDescr->sz); - if (Status >= 0) - { - remaining_bits_len = arT.remaining_bits_len; - bit_offset = arT.bit_offset; - pDescr++; - } - else - { /* return error code Has already been processed: */ - return Status; - } - - break; - } - - default: - { /* descriptions of union elements other than above are illegal */ - return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_IN_SCRIPT, pDescr); - } - } - - pDescr = pDescrNext; - break; - } - - case CSN_EXIST: - case CSN_EXIST_LH: - { - guint8 fExist; - - pui8 = pui8DATA(data, pDescr->offset); - - if (CSN_EXIST_LH == pDescr->type) - { - fExist = get_masked_bits8(vector, readIndex, bit_offset, 1); - } - else - { - fExist = bitvec_read_field(vector, readIndex, 1); - } - - *pui8 = fExist; - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - pDescr++; - remaining_bits_len -= 1; - - if (!fExist) - { - ar->remaining_bits_len = remaining_bits_len; - ar->bit_offset = bit_offset; - return remaining_bits_len; - } - - break; - } - - case CSN_NEXT_EXIST: - { - guint8 fExist; - - pui8 = pui8DATA(data, pDescr->offset); - - /* this if-statement represents the M_NEXT_EXIST_OR_NULL description element */ - if ((pDescr->descr.ptr != NULL) && (remaining_bits_len == 0)) - { /* no more bits to decode is fine here - end of message detected and allowed */ - - /* Skip i entries + this entry */ - pDescr += pDescr->i + 1; - - /* pDescr now must be pointing to a CSN_END entry, if not this is an error */ - if ( pDescr->type != CSN_END ) - { /* Substract one more bit from remaining_bits_len to make the "not enough bits" error to be triggered */ - remaining_bits_len--; - } - - /* Set the data member to "not exist" */ - *pui8 = 0; - break; - } - - /* the "regular" M_NEXT_EXIST description element */ - - fExist = 0x00; - if (bitvec_read_field(vector, readIndex, 1)) - { - fExist = 0x01; - } - - *pui8 = fExist; - remaining_bits_len -= 1; - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - ++bit_offset; - - if (fExist == 0) - { /* Skip 'i' entries */ - pDescr += pDescr->i; - } - - pDescr++; - break; - } - - case CSN_NEXT_EXIST_LH: - { - guint8 fExist; - pui8 = pui8DATA(data, pDescr->offset); - - /* this if-statement represents the M_NEXT_EXIST_OR_NULL_LH description element */ - if ((pDescr->descr.ptr != NULL) && (remaining_bits_len == 0)) - { /* no more bits to decode is fine here - end of message detected and allowed */ - - /* skip 'i' entries + this entry */ - pDescr += pDescr->i + 1; - - /* pDescr now must be pointing to a CSN_END entry, if not this is an error */ - if ( pDescr->type != CSN_END ) - { /* substract one more bit from remaining_bits_len to make the "not enough bits" error to be triggered */ - remaining_bits_len--; - } - - /* set the data member to "not exist" */ - *pui8 = 0; - break; - } - - /* the "regular" M_NEXT_EXIST_LH description element */ - fExist = get_masked_bits8(vector,readIndex,bit_offset, 1); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)fExist); - *pui8++ = fExist; - remaining_bits_len -= 1; - - bit_offset++; - - if (fExist == 0) - { /* Skip 'i' entries */ - pDescr += pDescr->i; - } - pDescr++; - - break; - } - - case CSN_VARIABLE_BITMAP_1: - { /* Bitmap from here and to the end of message */ - - *pui8DATA(data, (gint16)pDescr->descr.value) = (guint8) remaining_bits_len; /* length of bitmap == remaining bits */ - - /*no break - - * with a length set we have a regular variable length bitmap so we continue */ - } - - case CSN_VARIABLE_BITMAP: - { /* {CSN_VARIABLE_BITMAP, 0, offsetof(_STRUCT, _ElementCountField), offsetof(_STRUCT, _MEMBER), #_MEMBER} - * - * Bit array with length (in bits) specified in parameter (pDescr->descr) - * The result is right aligned! - */ - gint16 no_of_bits = *pui8DATA(data, (gint16)pDescr->descr.value); - - no_of_bits += pDescr->i; /* adjusted by offset */ - - if (no_of_bits > 0) - { - remaining_bits_len -= no_of_bits; - - if (remaining_bits_len < 0) - { - return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - - { /* extract bits */ - guint8* pui8 = pui8DATA(data, pDescr->offset); - gint16 nB1 = no_of_bits & 0x07;/* no_of_bits Mod 8 */ - - if (nB1 > 0) - { /* take care of the first byte - it will be right aligned */ - *pui8 = bitvec_read_field(vector, readIndex, nB1); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - pui8++; - no_of_bits -= nB1; - bit_offset += nB1; /* (nB1 is no_of_bits Mod 8) */ - } - - /* remaining no_of_bits is a multiple of 8 or 0 */ - while (no_of_bits > 0) - { - *pui8 = bitvec_read_field(vector, readIndex, 8); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - pui8++; - no_of_bits -= 8; - } - } - } - pDescr++; - break; - } - - case CSN_LEFT_ALIGNED_VAR_BMP_1: - { /* Bitmap from here and to the end of message */ - - *pui8DATA(data, (gint16)pDescr->descr.value) = (guint8) remaining_bits_len; /* length of bitmap == remaining bits */ - - /* no break - - * with a length set we have a regular left aligned variable length bitmap so we continue - */ - } - - case CSN_LEFT_ALIGNED_VAR_BMP: - { /* {CSN_LEFT_ALIGNED_VAR_BMP, _OFFSET, (void*)offsetof(_STRUCT, _ElementCountField), offsetof(_STRUCT, _MEMBER), #_MEMBER} - * - * bit array with length (in bits) specified in parameter (pDescr->descr) - */ - gint16 no_of_bits = *pui8DATA(data, (gint16)pDescr->descr.value);/* Size of bitmap */ - - no_of_bits += pDescr->i;/* size adjusted by offset */ - - if (no_of_bits > 0) - { - remaining_bits_len -= no_of_bits; - - if (remaining_bits_len < 0) - { - return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - - { /* extract bits */ - guint8* pui8 = pui8DATA(data, pDescr->offset); - gint16 nB1 = no_of_bits & 0x07;/* no_of_bits Mod 8 */ - - while (no_of_bits > 0) - { - *pui8 = bitvec_read_field(vector, readIndex, 8); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - pui8++; - no_of_bits -= 8; - } - if (nB1 > 0) - { - *pui8 = bitvec_read_field(vector, readIndex, nB1); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - pui8++; - no_of_bits -= nB1; - bit_offset += nB1; /* (nB1 is no_of_bits Mod 8) */ - } - } - } - - /* bitmap was successfully extracted or it was empty */ - pDescr++; - break; - } - - case CSN_VARIABLE_ARRAY: - { /* {int type; int i; void* descr; int offset; const char* sz; } CSN_DESCR; - * {CSN_VARIABLE_ARRAY, _OFFSET, (void*)offsetof(_STRUCT, _ElementCountField), offsetof(_STRUCT, _MEMBER), #_MEMBER} - * Array with length specified in parameter: - * - * - */ - gint16 count = *pui8DATA(data, (gint16)pDescr->descr.value); - - count += pDescr->i; /* Adjusted by offset */ - - if (count > 0) - { - remaining_bits_len -= count * 8; - - if (remaining_bits_len < 0) - { - return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - - pui8 = pui8DATA(data, pDescr->offset); - - while (count > 0) - { - readIndex -= 8; - *pui8 = bitvec_read_field(vector, readIndex, 8); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - pui8++; - bit_offset += 8; - count--; - } - } - - pDescr++; - break; - } - - case CSN_RECURSIVE_ARRAY: - { /* Recursive way to specify an array: ::= {1 | 0} - * or more generally: ::= { | } - * where ::= bit(value) - * ::= 0 | 1 - * ::= reversed tag i.e. tag == 1 -> EndTag == 0 and vice versa - * {CSN_RECURSIVE_ARRAY, _BITS, (void*)offsetof(_STRUCT, _ElementCountField), offsetof(_STRUCT, _MEMBER), #_MEMBER} - * REMARK: recursive way to specify an array but an iterative implementation! - */ - gint16 no_of_bits = pDescr->i; - guint8 ElementCount = 0; - - pui8 = pui8DATA(data, pDescr->offset); - - while (existNextElement(vector, readIndex, Tag)) - { /* tag control shows existence of next list elements */ - LOGPC(DCSN1, LOGL_NOTICE, "%s = Exist | ", pDescr->sz); - bit_offset++; - remaining_bits_len--; - - /* extract and store no_of_bits long element from bitstream */ - *pui8 = bitvec_read_field(vector, readIndex, no_of_bits); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - pui8++; - remaining_bits_len -= no_of_bits; - ElementCount++; - - if (remaining_bits_len < 0) - { - return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - - bit_offset += no_of_bits; - } - - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)bitvec_read_field(vector, readIndex, 1)); - /* existNextElement() returned FALSE, 1 bit consumed */ - bit_offset++; - - /* Store the counted number of elements of the array */ - *pui8DATA(data, (gint16)pDescr->descr.value) = ElementCount; - - pDescr++; - break; - } - - case CSN_RECURSIVE_TARRAY: - { /* Recursive way to specify an array of type: ::= { 1 } ** 0 ; - * M_REC_TARRAY(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField) - * {t, offsetof(_STRUCT, _ElementCountField), (void*)CSNDESCR_##_MEMBER_TYPE, offsetof(_STRUCT, _MEMBER), #_MEMBER, (StreamSerializeFcn_t)sizeof(_MEMBER_TYPE)} - */ - gint16 nSizeElement = (gint16)(gint32)pDescr->serialize.value; - guint8 ElementCount = 0; - pui8 = pui8DATA(data, pDescr->offset); - - while (existNextElement(vector, readIndex, Tag)) - { /* tag control shows existence of next list elements */ - LOGPC(DCSN1, LOGL_NOTICE, "%s = Exist | ", pDescr->sz); - /* existNextElement() returned TRUE, 1 bit consumed */ - bit_offset++; - remaining_bits_len--; - ElementCount++; - - { /* unpack the following data structure */ - csnStream_t arT = *ar; - gint16 Status; - csnStreamInit(&arT, bit_offset, remaining_bits_len); - Status = csnStreamDecoder(&arT, (const CSN_DESCR*)pDescr->descr.ptr, vector, readIndex, pvDATA(data, pDescr->offset)); - - if (Status >= 0) - { /* successful completion */ - pui8 += nSizeElement; /* -> to next data element */ - remaining_bits_len = arT.remaining_bits_len; - bit_offset = arT.bit_offset; - } - else - { /* something went awry */ - return Status; - } - } - - if (remaining_bits_len < 0) - { - return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - } - - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)bitvec_read_field(vector, readIndex, 1)); - - /* existNextElement() returned FALSE, 1 bit consumed */ - bit_offset++; - - /* Store the counted number of elements of the array */ - *pui8DATA(data, (gint16)(gint32)pDescr->i) = ElementCount; - - pDescr++; - break; - } - - case CSN_RECURSIVE_TARRAY_2: - { /* Recursive way to specify an array of type: ::= { 0 } ** 1 ; */ - - Tag = REVERSED_TAG; - - /* NO break - - * handling is exactly the same as for CSN_RECURSIVE_TARRAY_1 so we continue - */ - } - - case CSN_RECURSIVE_TARRAY_1: - { /* Recursive way to specify an array of type: ::= { 1 } ** 0 ; - * M_REC_TARRAY(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField) - * {t, offsetof(_STRUCT, _ElementCountField), (void*)CSNDESCR_##_MEMBER_TYPE, offsetof(_STRUCT, _MEMBER), #_MEMBER, (StreamSerializeFcn_t)sizeof(_MEMBER_TYPE)} - */ - gint16 nSizeElement = (gint16)(gint32)pDescr->serialize.value; - guint8 ElementCount = 0; - csnStream_t arT = *ar; - gboolean EndOfList = FALSE; - gint16 Status; - pui8 = pui8DATA(data, pDescr->offset); - - do - { /* get data element */ - ElementCount++; - - LOGPC(DCSN1, LOGL_NOTICE, "%s { | ", pDescr->sz); - - csnStreamInit(&arT, bit_offset, remaining_bits_len); - Status = csnStreamDecoder(&arT, (const CSN_DESCR*)pDescr->descr.ptr, vector, readIndex, pvDATA(data, pDescr->offset)); - - if (Status >= 0) - { /* successful completion */ - pui8 += nSizeElement; /* -> to next */ - remaining_bits_len = arT.remaining_bits_len; - bit_offset = arT.bit_offset; - } - else - { /* something went awry */ - return Status; - } - - if (remaining_bits_len < 0) - { - return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - - /* control of next element's tag */ - LOGPC(DCSN1, LOGL_NOTICE, "%s } | ", pDescr->sz); - EndOfList = !(existNextElement(vector, readIndex, Tag)); - - bit_offset++; - remaining_bits_len--; /* 1 bit consumed (tag) */ - } while (!EndOfList); - - - /* Store the count of the array */ - *pui8DATA(data, pDescr->i) = ElementCount; - Tag = STANDARD_TAG; /* in case it was set to "reversed" */ - pDescr++; - break; - } - - case CSN_FIXED: - { /* Verify the fixed bits */ - guint8 no_of_bits = (guint8) pDescr->i; - guint32 ui32; - - if (no_of_bits <= 32) - { - ui32 = bitvec_read_field(vector, readIndex, no_of_bits); - } - else - { - return ProcessError(readIndex,"no_of_bits > 32", -1, pDescr); - } - if (ui32 != (unsigned)(gint32)pDescr->offset) - { - return ProcessError(readIndex,"csnStreamDecoder FIXED value does not match", -1, pDescr); - } - - LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , (unsigned int)ui32); - remaining_bits_len -= no_of_bits; - bit_offset += no_of_bits; - pDescr++; - break; - } - - case CSN_CALLBACK: - { - return ProcessError(readIndex,"csnStreamDecoder Callback not implemented", -1, pDescr); - break; - } - - case CSN_TRAP_ERROR: - { - return ProcessError(readIndex,"csnStreamDecoder", pDescr->i, pDescr); - } - - case CSN_END: - { - ar->remaining_bits_len = remaining_bits_len; - ar->bit_offset = bit_offset; - return remaining_bits_len; - } - - default: - { - assert(0); - } - - - } - - } while (remaining_bits_len >= 0); - - return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); -} - - - - -gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector, size_t& writeIndex, void* data) -{ - gint remaining_bits_len = ar->remaining_bits_len; - gint bit_offset = ar->bit_offset; - guint8* pui8; - guint16* pui16; - guint32* pui32; - guint64* pui64; - - guint8 Tag = STANDARD_TAG; - - if (remaining_bits_len <= 0) - { - return 0; - } - - do - { - switch (pDescr->type) - { - case CSN_BIT: - { - if (remaining_bits_len > 0) - { - pui8 = pui8DATA(data, pDescr->offset); - bitvec_write_field(vector, writeIndex, *pui8, 1); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - /* end add the bit value to protocol tree */ - } - else - { - return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - - pDescr++; - remaining_bits_len--; - bit_offset++; - break; - } - - case CSN_NULL: - { /* Empty member! */ - pDescr++; - break; - } - - case CSN_UINT: - { - guint8 no_of_bits = (guint8) pDescr->i; - - if (remaining_bits_len >= no_of_bits) - { - if (no_of_bits <= 8) - { - pui8 = pui8DATA(data, pDescr->offset); - bitvec_write_field(vector, writeIndex, *pui8, no_of_bits); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - } - else if (no_of_bits <= 16) - { - pui16 = pui16DATA(data, pDescr->offset); - bitvec_write_field(vector, writeIndex, *pui16, no_of_bits); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui16); - } - else if (no_of_bits <= 32) - { - pui32 = pui32DATA(data, pDescr->offset); - bitvec_write_field(vector, writeIndex, *pui32, no_of_bits); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui32); - } - else - { - return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_GENERAL, pDescr); - } - } - else - { - return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - - remaining_bits_len -= no_of_bits; - bit_offset += no_of_bits; - pDescr++; - break; - } - - case CSN_UINT_OFFSET: - { - guint8 no_of_bits = (guint8) pDescr->i; - - if (remaining_bits_len >= no_of_bits) - { - if (no_of_bits <= 8) - { - pui8 = pui8DATA(data, pDescr->offset); - bitvec_write_field(vector, writeIndex, *pui8 - (guint8)pDescr->descr.value, no_of_bits); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)(*pui8 - (guint8)pDescr->descr.value)); - } - else if (no_of_bits <= 16) - { - pui16 = pui16DATA(data, pDescr->offset); - bitvec_write_field(vector, writeIndex, *pui16 - (guint16)pDescr->descr.value, no_of_bits); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , (unsigned short)(*pui16 - (guint16)pDescr->descr.value)); - } - else if (no_of_bits <= 32) - { - pui32 = pui32DATA(data, pDescr->offset); - bitvec_write_field(vector, writeIndex, *pui32 - (guint16)pDescr->descr.value, no_of_bits); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , (unsigned int)(*pui32 - (guint16)pDescr->descr.value)); - } - else - { - return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_GENERAL, pDescr); - } - } - else - { - return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - - remaining_bits_len -= no_of_bits; - bit_offset += no_of_bits; - pDescr++; - break; - } - - case CSN_UINT_LH: - { - guint8 no_of_bits = (guint8) pDescr->i; - - if (remaining_bits_len >= no_of_bits) - { - remaining_bits_len -= no_of_bits; - if (no_of_bits <= 8) - { - pui8 = pui8DATA(data, pDescr->offset); - bitvec_write_field(vector, writeIndex, *pui8, no_of_bits); - // TODO : Change get_masked_bits8() - writeIndex -= no_of_bits; - guint8 ui8 = get_masked_bits8(vector, writeIndex, bit_offset, no_of_bits); - writeIndex -= no_of_bits; - bitvec_write_field(vector, writeIndex, ui8, no_of_bits); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - - } - else - {/* Maybe we should support more than 8 bits ? */ - return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_GENERAL, pDescr); - } - } - else - { - return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - - remaining_bits_len -= no_of_bits; - bit_offset += no_of_bits; - pDescr++; - break; - } - - case CSN_UINT_ARRAY: - { - guint8 no_of_bits = (guint8) pDescr->i; - guint16 nCount = (guint16)pDescr->descr.value; /* nCount supplied by value i.e. M_UINT_ARRAY(...) */ - - if (pDescr->serialize.value != 0) - { /* nCount specified by a reference to field holding value i.e. M_VAR_UINT_ARRAY(...) */ - nCount = *pui16DATA(data, nCount); - } - - if (remaining_bits_len >= no_of_bits) - { - remaining_bits_len -= (no_of_bits*nCount); - if (no_of_bits <= 8) - { - pui8 = pui8DATA(data, pDescr->offset); - do - { - bitvec_write_field(vector, writeIndex, *pui8, no_of_bits); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - pui8++; - bit_offset += no_of_bits; - } while (--nCount > 0); - } - else if (no_of_bits <= 16) - { - return ProcessError(writeIndex,"csnStreamEncoder NOTIMPLEMENTED", 999, pDescr); - } - else if (no_of_bits <= 32) - { - return ProcessError(writeIndex,"csnStreamEncoder NOTIMPLEMENTED", 999, pDescr); - } - else - { - return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_GENERAL, pDescr); - } - } - else - { - return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - pDescr++; - break; - } - - case CSN_VARIABLE_TARRAY_OFFSET: - case CSN_VARIABLE_TARRAY: - case CSN_TYPE_ARRAY: - { - gint16 Status; - csnStream_t arT = *ar; - gint16 nCount = pDescr->i; - guint16 nSize = (guint16)(gint32)pDescr->serialize.value; - - pui8 = pui8DATA(data, pDescr->offset); - if (pDescr->type == CSN_VARIABLE_TARRAY) - { /* Count specified in field */ - nCount = *pui8DATA(data, pDescr->i); - } - else if (pDescr->type == CSN_VARIABLE_TARRAY_OFFSET) - { /* Count specified in field */ - nCount = *pui8DATA(data, pDescr->i); - /* nCount--; the 1 offset is already taken into account in CSN_UINT_OFFSET */ - } - - while (nCount > 0) - { /* resulting array of length 0 is possible - * but no bits shall be read from bitstream - */ - - LOGPC(DCSN1, LOGL_NOTICE, "%s : | ", pDescr->sz); - csnStreamInit(&arT, bit_offset, remaining_bits_len); - Status = csnStreamEncoder(&arT, (const CSN_DESCR*)pDescr->descr.ptr, vector, writeIndex, pui8); - if (Status >= 0) - { - pui8 += nSize; - remaining_bits_len = arT.remaining_bits_len; - bit_offset = arT.bit_offset; - - } - else - { - return Status; - } - nCount--; - } - - pDescr++; - break; - } - - case CSN_BITMAP: - { /* bitmap with given length. The result is left aligned! */ - guint8 no_of_bits = (guint8) pDescr->i; /* length of bitmap */ - - if (no_of_bits > 0) - { - - if (no_of_bits <= 32) - { - for(unsigned ib = 0; ib < 4; ib++) - { - pui8 = pui8DATA(data, pDescr->offset+ib); - bitvec_write_field(vector, writeIndex, *pui8, 8); - LOGPC(DCSN1, LOGL_NOTICE, "%s[%u] = %u | ", pDescr->sz , ib, (unsigned)*pui8); - } - } - else if (no_of_bits <= 64) - { - for(unsigned ib = 0; ib < 8; ib++) - { - pui8 = pui8DATA(data, pDescr->offset+ib); - bitvec_write_field(vector, writeIndex, *pui8, 8); - LOGPC(DCSN1, LOGL_NOTICE, "%s[%u] = %u | ", pDescr->sz , ib, (unsigned)*pui8); - } - } - else - { - return ProcessError(writeIndex,"csnStreamEncoder NOT IMPLEMENTED", 999, pDescr); - } - - remaining_bits_len -= no_of_bits; - assert(remaining_bits_len >= 0); - bit_offset += no_of_bits; - } - /* bitmap was successfully extracted or it was empty */ - - pDescr++; - break; - } - - case CSN_TYPE: - { - gint16 Status; - csnStream_t arT = *ar; - LOGPC(DCSN1, LOGL_NOTICE, " : %s | ", pDescr->sz); - csnStreamInit(&arT, bit_offset, remaining_bits_len); - Status = csnStreamEncoder(&arT, (const CSN_DESCR*)pDescr->descr.ptr, vector, writeIndex, pvDATA(data, pDescr->offset)); - LOGPC(DCSN1, LOGL_NOTICE, " : End %s | ", pDescr->sz); - if (Status >= 0) - { - - remaining_bits_len = arT.remaining_bits_len; - bit_offset = arT.bit_offset; - pDescr++; - } - else - { - /* Has already been processed: ProcessError("csnStreamEncoder", Status, pDescr); */ - return Status; - } - - break; - } - - case CSN_CHOICE: - { - //gint16 count = pDescr->i; - guint8 i = 0; - CSN_ChoiceElement_t* pChoice = (CSN_ChoiceElement_t*) pDescr->descr.ptr; - - pui8 = pui8DATA(data, pDescr->offset); - i = *pui8; - pChoice += i; - guint8 no_of_bits = pChoice->bits; - guint8 value = pChoice->value; - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pChoice->descr.sz , (unsigned)value); - bitvec_write_field(vector, writeIndex, value, no_of_bits); - - CSN_DESCR descr[2]; - gint16 Status; - csnStream_t arT = *ar; - - descr[0] = pChoice->descr; - memset(&descr[1], 0x00, sizeof(CSN_DESCR)); - descr[1].type = CSN_END; - bit_offset += no_of_bits; - remaining_bits_len -= no_of_bits; - - csnStreamInit(&arT, bit_offset, remaining_bits_len); - Status = csnStreamEncoder(&arT, descr, vector, writeIndex, data); - - if (Status >= 0) - { - remaining_bits_len = arT.remaining_bits_len; - bit_offset = arT.bit_offset; - } - else - { - return Status; - } - - pDescr++; - break; - } - - case CSN_SERIALIZE: - { - StreamSerializeFcn_t serialize = pDescr->serialize.fcn; - csnStream_t arT = *ar; - gint16 Status = -1; - size_t lengthIndex; - - // store writeIndex for length value (7 bit) - lengthIndex = writeIndex; - writeIndex += 7; - bit_offset += 7; - remaining_bits_len -= 7; - arT.direction = 0; - csnStreamInit(&arT, bit_offset, remaining_bits_len); - Status = serialize(&arT, vector, writeIndex, pvDATA(data, pDescr->offset)); - - bitvec_write_field(vector, lengthIndex, writeIndex-lengthIndex-7, 7); - LOGPC(DCSN1, LOGL_NOTICE, "%s length = %u | ", pDescr->sz , (unsigned)(writeIndex-lengthIndex)); - - if (Status >= 0) - { - remaining_bits_len = arT.remaining_bits_len; - bit_offset = arT.bit_offset; - pDescr++; - } - else - { - // Has already been processed: - return Status; - } - - break; - } - - case CSN_UNION_LH: - case CSN_UNION: - { - gint16 Bits; - guint8 index; - gint16 count = pDescr->i; - const CSN_DESCR* pDescrNext = pDescr; - - pDescrNext += count + 1; /* now this is next after the union */ - if ((count <= 0) || (count > 16)) - { - return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_INVALID_UNION_INDEX, pDescr); - } - - /* Now get the bits to extract the index */ - Bits = ixBitsTab[count]; - index = 0; - - /* Assign UnionType */ - pui8 = pui8DATA(data, pDescr->offset); - //read index from data and write to vector - bitvec_write_field(vector, writeIndex, *pui8, Bits); - - //decode index - writeIndex -= Bits; - - while (Bits > 0) - { - index <<= 1; - - if (CSN_UNION_LH == pDescr->type) - { - index |= get_masked_bits8(vector,writeIndex, bit_offset, 1); - } - else - { - index |= bitvec_read_field(vector, writeIndex, 1); - } - - remaining_bits_len--; - bit_offset++; - Bits--; - } - - writeIndex -= Bits; - bitvec_write_field(vector, writeIndex, index, Bits); - - - /* script index to continue on, limited in case we do not have a power of 2 */ - pDescr += (MIN(index + 1, count)); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)index); - - switch (pDescr->type) - { /* get the right element of the union based on computed index */ - - case CSN_BIT: - { - pui8 = pui8DATA(data, pDescr->offset); - bitvec_write_field(vector, writeIndex, *pui8, 1); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - remaining_bits_len -= 1; - bit_offset++; - pDescr++; - break; - } - - case CSN_NULL: - { /* Empty member! */ - pDescr++; - break; - } - - case CSN_UINT: - { - guint8 no_of_bits = (guint8) pDescr->i; - if (remaining_bits_len >= no_of_bits) - { - remaining_bits_len -= no_of_bits; - - if (no_of_bits <= 8) - { - pui8 = pui8DATA(data, pDescr->offset); - bitvec_write_field(vector, writeIndex, *pui8, no_of_bits); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - } - else if (no_of_bits <= 16) - { - pui16 = pui16DATA(data, pDescr->offset); - bitvec_write_field(vector, writeIndex, *pui16, no_of_bits); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui16); - } - else if (no_of_bits <= 32) - { - pui32 = pui32DATA(data, pDescr->offset); - bitvec_write_field(vector, writeIndex, *pui32, no_of_bits); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui32); - } - else - { - return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_GENERAL, pDescr); - } - } - else - { - return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_GENERAL, pDescr); - } - - bit_offset += no_of_bits; - pDescr++; - break; - } - - case CSN_UINT_OFFSET: - { - guint8 no_of_bits = (guint8) pDescr->i; - - if (remaining_bits_len >= no_of_bits) - { - if (no_of_bits <= 8) - { - pui8 = pui8DATA(data, pDescr->offset); - bitvec_write_field(vector, writeIndex, *pui8 - (guint8)pDescr->descr.value, no_of_bits); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)(*pui8 - (guint8)pDescr->descr.value)); - } - else if (no_of_bits <= 16) - { - pui16 = pui16DATA(data, pDescr->offset); - bitvec_write_field(vector, writeIndex, *pui16 - (guint16)pDescr->descr.value, no_of_bits); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , (unsigned short)(*pui16 - (guint16)pDescr->descr.value)); - } - else if (no_of_bits <= 32) - { - pui32 = pui32DATA(data, pDescr->offset); - bitvec_write_field(vector, writeIndex, *pui32 - (guint16)pDescr->descr.value, no_of_bits); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , (unsigned int)(*pui32 - (guint16)pDescr->descr.value)); - } - else - { - return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_GENERAL, pDescr); - } - } - else - { - return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - - remaining_bits_len -= no_of_bits; - bit_offset += no_of_bits; - pDescr++; - break; - } - - case CSN_UINT_LH: - { - guint8 no_of_bits = (guint8) pDescr->i; - - if (remaining_bits_len >= no_of_bits) - { - remaining_bits_len -= no_of_bits; - if (no_of_bits <= 8) - { - pui8 = pui8DATA(data, pDescr->offset); - bitvec_write_field(vector, writeIndex, *pui8, no_of_bits); - // TODO : Change get_masked_bits8() - writeIndex -= no_of_bits; - guint8 ui8 = get_masked_bits8(vector, writeIndex, bit_offset, no_of_bits); - writeIndex -= no_of_bits; - bitvec_write_field(vector, writeIndex, ui8, no_of_bits); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - - } - else - {/* Maybe we should support more than 8 bits ? */ - return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_GENERAL, pDescr); - } - } - else - { - return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - - remaining_bits_len -= no_of_bits; - bit_offset += no_of_bits; - pDescr++; - break; - } - - case CSN_UINT_ARRAY: - { - guint8 no_of_bits = (guint8) pDescr->i; - guint16 nCount = (guint16)pDescr->descr.value; /* nCount supplied by value i.e. M_UINT_ARRAY(...) */ - - if (pDescr->serialize.value != 0) - { /* nCount specified by a reference to field holding value i.e. M_VAR_UINT_ARRAY(...) */ - nCount = *pui16DATA(data, nCount); - } - - if (remaining_bits_len >= no_of_bits) - { - remaining_bits_len -= (no_of_bits*nCount); - if (no_of_bits <= 8) - { - pui8 = pui8DATA(data, pDescr->offset); - do - { - bitvec_write_field(vector, writeIndex, *pui8, no_of_bits); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - pui8++; - bit_offset += no_of_bits; - } while (--nCount > 0); - } - else if (no_of_bits <= 16) - { - return ProcessError(writeIndex,"csnStreamEncoder NOTIMPLEMENTED", 999, pDescr); - } - else if (no_of_bits <= 32) - { - return ProcessError(writeIndex,"csnStreamEncoder NOTIMPLEMENTED", 999, pDescr); - } - else - { - return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_GENERAL, pDescr); - } - } - else - { - return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - pDescr++; - break; - } - - case CSN_VARIABLE_TARRAY_OFFSET: - case CSN_VARIABLE_TARRAY: - case CSN_TYPE_ARRAY: - { - gint16 Status; - csnStream_t arT = *ar; - gint16 nCount = pDescr->i; - guint16 nSize = (guint16)(gint32)pDescr->serialize.value; - - pui8 = pui8DATA(data, pDescr->offset); - if (pDescr->type == CSN_VARIABLE_TARRAY) - { /* Count specified in field */ - nCount = *pui8DATA(data, pDescr->i); - } - else if (pDescr->type == CSN_VARIABLE_TARRAY_OFFSET) - { /* Count specified in field */ - nCount = *pui8DATA(data, pDescr->i); - /* nCount--; the 1 offset is already taken into account in CSN_UINT_OFFSET */ - } - - while (nCount > 0) - { /* resulting array of length 0 is possible - * but no bits shall be read from bitstream - */ - - LOGPC(DCSN1, LOGL_NOTICE, "%s : | ", pDescr->sz); - csnStreamInit(&arT, bit_offset, remaining_bits_len); - Status = csnStreamEncoder(&arT, (const CSN_DESCR*)pDescr->descr.ptr, vector, writeIndex, pui8); - if (Status >= 0) - { - pui8 += nSize; - remaining_bits_len = arT.remaining_bits_len; - bit_offset = arT.bit_offset; - } - else - { - return Status; - } - nCount--; - } - - pDescr++; - break; - } - - case CSN_BITMAP: - { /* bitmap with given length. The result is left aligned! */ - guint8 no_of_bits = (guint8) pDescr->i; /* length of bitmap */ - - if (no_of_bits > 0) - { - - if (no_of_bits <= 32) - { - pui32 = pui32DATA(data, pDescr->offset); - bitvec_write_field(vector, writeIndex, *pui32, no_of_bits); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui32); - } - else if (no_of_bits <= 64) - { - pui64 = pui64DATA(data, pDescr->offset); - bitvec_write_field(vector, writeIndex, *pui64, no_of_bits); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui64); - } - else - { - return ProcessError(writeIndex,"csnStreamEncoder NOT IMPLEMENTED", 999, pDescr); - } - - remaining_bits_len -= no_of_bits; - assert(remaining_bits_len >= 0); - bit_offset += no_of_bits; - } - /* bitmap was successfully extracted or it was empty */ - - pDescr++; - break; - } - - case CSN_TYPE: - { - gint16 Status; - csnStream_t arT = *ar; - LOGPC(DCSN1, LOGL_NOTICE, " : %s | ", pDescr->sz); - csnStreamInit(&arT, bit_offset, remaining_bits_len); - Status = csnStreamEncoder(&arT, (const CSN_DESCR*)pDescr->descr.ptr, vector, writeIndex, pvDATA(data, pDescr->offset)); - LOGPC(DCSN1, LOGL_NOTICE, " : End %s | ", pDescr->sz); - if (Status >= 0) - { - remaining_bits_len = arT.remaining_bits_len; - bit_offset = arT.bit_offset; - pDescr++; - } - else - { - /* Has already been processed: ProcessError("csnStreamEncoder", Status, pDescr); */ - return Status; - } - - break; - } - - default: - { /* descriptions of union elements other than above are illegal */ - return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_IN_SCRIPT, pDescr); - } - } - - pDescr = pDescrNext; - break; - } - - case CSN_EXIST: - case CSN_EXIST_LH: - { - guint8 fExist; - unsigned exist = 0; - pui8 = pui8DATA(data, pDescr->offset); - exist = *pui8; - bitvec_write_field(vector, writeIndex, *pui8, 1); - writeIndex--; - if (CSN_EXIST_LH == pDescr->type) - { - fExist = get_masked_bits8(vector, writeIndex, bit_offset, 1); - } - else - { - fExist = bitvec_read_field(vector, writeIndex, 1); - } - writeIndex--; - bitvec_write_field(vector, writeIndex, fExist, 1); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz, (unsigned)fExist); - pDescr++; - remaining_bits_len -= 1; - - if (!exist) - { - ar->remaining_bits_len = remaining_bits_len; - ar->bit_offset = bit_offset; - return remaining_bits_len; - } - break; - } - - case CSN_NEXT_EXIST: - { - guint8 fExist; - - pui8 = pui8DATA(data, pDescr->offset); - - /* this if-statement represents the M_NEXT_EXIST_OR_NULL description element */ - if ((pDescr->descr.ptr != NULL) && (remaining_bits_len == 0)) - { /* no more bits to decode is fine here - end of message detected and allowed */ - - /* Skip i entries + this entry */ - pDescr += pDescr->i + 1; - - /* pDescr now must be pointing to a CSN_END entry, if not this is an error */ - if ( pDescr->type != CSN_END ) - { /* Substract one more bit from remaining_bits_len to make the "not enough bits" error to be triggered */ - remaining_bits_len--; - } - - break; - } - - bitvec_write_field(vector, writeIndex, *pui8, 1); - fExist = *pui8; - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - remaining_bits_len -= 1; - - ++bit_offset; - - if (fExist == 0) - { /* Skip 'i' entries */ - pDescr += pDescr->i; - } - - pDescr++; - break; - } - - case CSN_NEXT_EXIST_LH: - { - guint8 fExist; - pui8 = pui8DATA(data, pDescr->offset); - - /* this if-statement represents the M_NEXT_EXIST_OR_NULL_LH description element */ - if ((pDescr->descr.ptr != NULL) && (remaining_bits_len == 0)) - { /* no more bits to decode is fine here - end of message detected and allowed */ - - /* skip 'i' entries + this entry */ - pDescr += pDescr->i + 1; - - /* pDescr now must be pointing to a CSN_END entry, if not this is an error */ - if ( pDescr->type != CSN_END ) - { /* substract one more bit from remaining_bits_len to make the "not enough bits" error to be triggered */ - remaining_bits_len--; - } - - /* set the data member to "not exist" */ - //*pui8 = 0; - break; - } - - /* the "regular" M_NEXT_EXIST_LH description element */ - bitvec_write_field(vector, writeIndex, *pui8, 1); - writeIndex--; - fExist = get_masked_bits8(vector,writeIndex, bit_offset, 1); - writeIndex--; - bitvec_write_field(vector, writeIndex, fExist, 1); - pui8++; - remaining_bits_len -= 1; - - bit_offset++; - - if (fExist == 0) - { /* Skip 'i' entries */ - pDescr += pDescr->i; - } - pDescr++; - - break; - } - - case CSN_VARIABLE_BITMAP_1: - { /* Bitmap from here and to the end of message */ - - //*pui8DATA(data, (gint16)pDescr->descr.value) = (guint8) remaining_bits_len; /* length of bitmap == remaining bits */ - - /*no break - - * with a length set we have a regular variable length bitmap so we continue */ - } - - case CSN_VARIABLE_BITMAP: - { /* {CSN_VARIABLE_BITMAP, 0, offsetof(_STRUCT, _ElementCountField), offsetof(_STRUCT, _MEMBER), #_MEMBER} - * - * Bit array with length (in bits) specified in parameter (pDescr->descr) - * The result is right aligned! - */ - gint16 no_of_bits = *pui8DATA(data, (gint16)pDescr->descr.value); - - no_of_bits += pDescr->i; /* adjusted by offset */ - - if (no_of_bits > 0) - { - remaining_bits_len -= no_of_bits; - - if (remaining_bits_len < 0) - { - return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - - { /* extract bits */ - guint8* pui8 = pui8DATA(data, pDescr->offset); - gint16 nB1 = no_of_bits & 0x07;/* no_of_bits Mod 8 */ - - if (nB1 > 0) - { /* take care of the first byte - it will be right aligned */ - bitvec_write_field(vector, writeIndex, *pui8, nB1); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - pui8++; - no_of_bits -= nB1; - bit_offset += nB1; /* (nB1 is no_of_bits Mod 8) */ - } - - /* remaining no_of_bits is a multiple of 8 or 0 */ - while (no_of_bits > 0) - { - bitvec_write_field(vector, writeIndex, *pui8, 8); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - pui8++; - no_of_bits -= 8; - } - } - } - pDescr++; - break; - } - - case CSN_LEFT_ALIGNED_VAR_BMP_1: - { /* Bitmap from here and to the end of message */ - - //*pui8DATA(data, (gint16)pDescr->descr.value) = (guint8) remaining_bits_len; /* length of bitmap == remaining bits */ - - /* no break - - * with a length set we have a regular left aligned variable length bitmap so we continue - */ - } - - case CSN_LEFT_ALIGNED_VAR_BMP: - { /* {CSN_LEFT_ALIGNED_VAR_BMP, _OFFSET, (void*)offsetof(_STRUCT, _ElementCountField), offsetof(_STRUCT, _MEMBER), #_MEMBER} - * - * bit array with length (in bits) specified in parameter (pDescr->descr) - */ - - gint16 no_of_bits = *pui8DATA(data, (gint16)pDescr->descr.value);/* Size of bitmap */ - - no_of_bits += pDescr->i;/* size adjusted by offset */ - - if (no_of_bits > 0) - { - remaining_bits_len -= no_of_bits; - - if (remaining_bits_len < 0) - { - return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - - { /* extract bits */ - guint8* pui8 = pui8DATA(data, pDescr->offset); - gint16 nB1 = no_of_bits & 0x07;/* no_of_bits Mod 8 */ - - while (no_of_bits > 0) - { - bitvec_write_field(vector, writeIndex, *pui8, 8); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - pui8++; - no_of_bits -= 8; - } - if (nB1 > 0) - { - bitvec_write_field(vector, writeIndex, *pui8, nB1); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - pui8++; - no_of_bits -= nB1; - bit_offset += nB1; /* (nB1 is no_of_bits Mod 8) */ - } - } - - } - - /* bitmap was successfully extracted or it was empty */ - pDescr++; - break; - } - - case CSN_VARIABLE_ARRAY: - { /* {int type; int i; void* descr; int offset; const char* sz; } CSN_DESCR; - * {CSN_VARIABLE_ARRAY, _OFFSET, (void*)offsetof(_STRUCT, _ElementCountField), offsetof(_STRUCT, _MEMBER), #_MEMBER} - * Array with length specified in parameter: - * - * - */ - gint16 count = *pui8DATA(data, (gint16)pDescr->descr.value); - - count += pDescr->i; /* Adjusted by offset */ - - if (count > 0) - { - remaining_bits_len -= count * 8; - - if (remaining_bits_len < 0) - { - return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - - pui8 = pui8DATA(data, pDescr->offset); - - while (count > 0) - { - bitvec_write_field(vector, writeIndex, *pui8, 8); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - pui8++; - bit_offset += 8; - count--; - } - } - - pDescr++; - break; - } - - case CSN_RECURSIVE_ARRAY: - { /* Recursive way to specify an array: ::= {1 | 0} - * or more generally: ::= { | } - * where ::= bit(value) - * ::= 0 | 1 - * ::= reversed tag i.e. tag == 1 -> EndTag == 0 and vice versa - * {CSN_RECURSIVE_ARRAY, _BITS, (void*)offsetof(_STRUCT, _ElementCountField), offsetof(_STRUCT, _MEMBER), #_MEMBER} - * REMARK: recursive way to specify an array but an iterative implementation! - */ - gint16 no_of_bits = pDescr->i; - guint8 ElementCount = 0; - pui8 = pui8DATA(data, pDescr->offset); - ElementCount = *pui8DATA(data, (gint16)pDescr->descr.value); - while (ElementCount > 0) - { /* tag control shows existence of next list elements */ - bitvec_write_field(vector, writeIndex, Tag, 1); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)Tag); - bit_offset++; - remaining_bits_len--; - - /* extract and store no_of_bits long element from bitstream */ - bitvec_write_field(vector, writeIndex, *pui8, no_of_bits); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); - pui8++; - remaining_bits_len -= no_of_bits; - ElementCount--; - - if (remaining_bits_len < 0) - { - return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - - bit_offset += no_of_bits; - } - - bitvec_write_field(vector, writeIndex, !Tag, 1); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)(!Tag)); - bit_offset++; - - pDescr++; - break; - } - - case CSN_RECURSIVE_TARRAY: - { /* Recursive way to specify an array of type: ::= { 1 } ** 0 ; - * M_REC_TARRAY(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField) - * {t, offsetof(_STRUCT, _ElementCountField), (void*)CSNDESCR_##_MEMBER_TYPE, offsetof(_STRUCT, _MEMBER), #_MEMBER, (StreamSerializeFcn_t)sizeof(_MEMBER_TYPE)} - */ - gint16 nSizeElement = (gint16)(gint32)pDescr->serialize.value; - guint8 ElementCount = 0; - pui8 = pui8DATA(data, pDescr->offset); - /* Store the counted number of elements of the array */ - ElementCount = *pui8DATA(data, (gint16)(gint32)pDescr->i); - - while (ElementCount > 0) - { /* tag control shows existence of next list elements */ - bitvec_write_field(vector, writeIndex, Tag, 1); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)Tag); - bit_offset++; - - remaining_bits_len--; - ElementCount--; - - { /* unpack the following data structure */ - csnStream_t arT = *ar; - gint16 Status; - csnStreamInit(&arT, bit_offset, remaining_bits_len); - Status = csnStreamEncoder(&arT, (const CSN_DESCR*)pDescr->descr.ptr, vector, writeIndex, pvDATA(data, pDescr->offset)); - - if (Status >= 0) - { /* successful completion */ - pui8 += nSizeElement; /* -> to next data element */ - remaining_bits_len = arT.remaining_bits_len; - bit_offset = arT.bit_offset; - } - else - { /* something went awry */ - return Status; - } - } - - if (remaining_bits_len < 0) - { - return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - } - - bitvec_write_field(vector, writeIndex, !Tag, 1); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)(!Tag)); - bit_offset++; - - pDescr++; - break; - } - - case CSN_RECURSIVE_TARRAY_2: - { /* Recursive way to specify an array of type: ::= { 0 } ** 1 ; */ - - Tag = REVERSED_TAG; - - /* NO break - - * handling is exactly the same as for CSN_RECURSIVE_TARRAY_1 so we continue - */ - } - - case CSN_RECURSIVE_TARRAY_1: - { /* Recursive way to specify an array of type: ::= { 1 } ** 0 ; - * M_REC_TARRAY(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField) - * {t, offsetof(_STRUCT, _ElementCountField), (void*)CSNDESCR_##_MEMBER_TYPE, offsetof(_STRUCT, _MEMBER), #_MEMBER, (StreamSerializeFcn_t)sizeof(_MEMBER_TYPE)} - */ - gint16 nSizeElement = (gint16)(gint32)pDescr->serialize.value; - guint8 ElementCount = 0; - guint8 ElementNum = 0; - csnStream_t arT = *ar; - gint16 Status; - - pui8 = pui8DATA(data, pDescr->offset); - /* Store the count of the array */ - ElementCount = *pui8DATA(data, pDescr->i); - ElementNum = ElementCount; - - while (ElementCount > 0) - { /* get data element */ - if (ElementCount != ElementNum) - { - bitvec_write_field(vector, writeIndex, Tag, 1); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)Tag); - bit_offset++; - remaining_bits_len--; - } - ElementCount--; - LOGPC(DCSN1, LOGL_NOTICE, "%s { | ", pDescr->sz); - csnStreamInit(&arT, bit_offset, remaining_bits_len); - Status = csnStreamEncoder(&arT, (const CSN_DESCR*)pDescr->descr.ptr, vector, writeIndex, pvDATA(data, pDescr->offset)); - LOGPC(DCSN1, LOGL_NOTICE, "%s } | ", pDescr->sz); - if (Status >= 0) - { /* successful completion */ - pui8 += nSizeElement; /* -> to next */ - remaining_bits_len = arT.remaining_bits_len; - bit_offset = arT.bit_offset; - } - else - { /* something went awry */ - return Status; - } - - if (remaining_bits_len < 0) - { - return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); - } - - } - bitvec_write_field(vector, writeIndex, !Tag, 1); - bit_offset++; - Tag = STANDARD_TAG; /* in case it was set to "reversed" */ - pDescr++; - break; - } - - case CSN_FIXED: - { /* Verify the fixed bits */ - guint8 no_of_bits = (guint8) pDescr->i; - bitvec_write_field(vector, writeIndex, pDescr->offset, no_of_bits); - LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)pDescr->offset); - remaining_bits_len -= no_of_bits; - bit_offset += no_of_bits; - pDescr++; - break; - } - - case CSN_CALLBACK: - { - return ProcessError(writeIndex,"csnStreamEncoder Callback not implemented", -1, pDescr); - break; - } - - case CSN_TRAP_ERROR: - { - return ProcessError(writeIndex,"csnStreamEncoder", pDescr->i, pDescr); - } - - case CSN_END: - { - ar->remaining_bits_len = remaining_bits_len; - ar->bit_offset = bit_offset; - return remaining_bits_len; - } - - default: - { - assert(0); - } - - } - - } while (remaining_bits_len >= 0); - - return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); -} - diff --git a/csn1.h b/csn1.h deleted file mode 100644 index a50b6cd3..00000000 --- a/csn1.h +++ /dev/null @@ -1,574 +0,0 @@ -/* csn1.h - * Declarations and types for CSN1 dissection in wireshark. - * By Vincent Helfre, based on original code by Jari Sassi - * with the gracious authorization of STE - * Copyright (c) 2011 ST-Ericsson - * - * $Id: packet-csn1.h 36306 2011-03-24 09:20:14Z etxrab $ - * - * Wireshark - Network traffic analyzer - * By Gerald Combs - * 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. - */ - -#include -#include -#include -#ifndef _PACKET_CSN1_H_ -#define _PACKET_CSN1_H_ - - -#define MIN(a,b) (((a)<(b))?(a):(b)) -//#define max(a,b) (((a)>(b))?(a):(b)) - -/* Error codes */ -#define CSN_OK 0 -#define CSN_ERROR_GENERAL -1 -#define CSN_ERROR_DATA_NOT_VALID -2 -#define CSN_ERROR_IN_SCRIPT -3 -#define CSN_ERROR_INVALID_UNION_INDEX -4 -#define CSN_ERROR_NEED_MORE_BITS_TO_UNPACK -5 -#define CSN_ERROR_ILLEGAL_BIT_VALUE -6 -#define CSN_ERROR_INTERNAL -7 -#define CSN_ERROR_STREAM_NOT_SUPPORTED -8 -#define CSN_ERROR_MESSAGE_TOO_LONG -9 -#define CSN_ERROR_ -10 - -#define FALSE (0) -typedef signed int gint32; -typedef signed short gint16; -typedef int gint; -typedef gint gboolean; -typedef unsigned char guint8; -typedef unsigned short guint16; -typedef unsigned int guint32; -typedef unsigned long guint64; -/* CallBack return status */ -typedef gint16 CSN_CallBackStatus_t; - -#define CSNCBS_OK 0 -#define CSNCBS_NOT_OK -10 -#define CSNCBS_NOT_TO_US -11 -#define CSNCBS_NOT_COMPLETE -12 - -#define CSNCBS_REVISION_LIMIT_STOP -20 /* Stop packing/unpacking - revision limit */ -#define CSNCBS_NOT_SUPPORTED_IE -21 /* Handling of the unpacked IE is not supported by MS-software */ - - - -#ifndef ElementsOf -#define ElementsOf(array) (sizeof(array) / sizeof(array[0])) -#endif - -/* Context holding CSN1 parameters */ -typedef struct -{ - gint remaining_bits_len; /* IN to an csn stream operation */ - gint bit_offset; /* IN/OUT to an csn stream operation */ - gint direction; /* 0 - decode; 1 - encode */ -} csnStream_t; - -typedef gint16 (*StreamSerializeFcn_t)(csnStream_t* ar, bitvec *vector, size_t& readIndex, void* data); -typedef enum -{ - CSN_END = 0, - CSN_BIT, - CSN_UINT, - CSN_TYPE, - CSN_CHOICE, - CSN_UNION, - CSN_UNION_LH, - CSN_UINT_ARRAY, - CSN_TYPE_ARRAY, - CSN_BITMAP, /* Bitmap with constant: */ - CSN_VARIABLE_BITMAP, /* */ - CSN_VARIABLE_BITMAP_1, /* i.e. to the end of message (R99) */ - CSN_LEFT_ALIGNED_VAR_BMP, /* As variable bitmap but the result is left aligned (R99) */ - CSN_LEFT_ALIGNED_VAR_BMP_1,/* As above only size is to the end of message (R99) */ - CSN_VARIABLE_ARRAY, /* Array with length specified in parameter: */ - CSN_VARIABLE_TARRAY, /* Type Array with length specified in parameter: *N */ - CSN_VARIABLE_TARRAY_OFFSET,/* As above but with offset. The offset is stored as third parameter of CSN_DESCR (descr.value) */ - CSN_RECURSIVE_ARRAY, /* Recursive way to specify an array of uint: ::= {1 |0}; */ - CSN_RECURSIVE_TARRAY, /* Recursive way to specify an array of type: ::= {1 } ** 0 ; */ - CSN_RECURSIVE_TARRAY_1, /* same as above but first element always exist: ::= {1 } ** 0 ; */ - CSN_RECURSIVE_TARRAY_2, /* same as above but with reversed separators : ::= { 0 } ** 1 ; */ - CSN_EXIST, - CSN_EXIST_LH, - CSN_NEXT_EXIST, - CSN_NEXT_EXIST_LH, - CSN_NULL, - CSN_FIXED, - CSN_CALLBACK, - CSN_UINT_OFFSET, /* unpack will add offset, inverse pack will subtract offset */ - CSN_UINT_LH, /* Low High extraction of int */ - CSN_SERIALIZE, - CSN_TRAP_ERROR -} csn_type_t; - -/****************************************************************************************** - * CSN_DESCR structure: - * - * type: - * This is the CSN type. All existing types are specified in the section above. - * - * i: - * Depending on the contents of the type parameter, the parameter "i" may have following meaning: - * - specifies the number of bits for the CSN_UINT type - * - the offset for an array size by which the size is incremented - * for the CSN_VAR_ARRAY type - * - the length of each element of an array for the CSN_REC_ARRAY type - * - the number of the elements in an array for the CSN_TYPE_ARRAY type - * - the offset to the variable keeping the number of elements of an array for in the CSN_VAR_TARRAY type - * - the number of different data types in a union for the CSN_UNION, CSN_UNION_LH, and for the CSN_CHOICE types - * - the length in bits of the fixed number defined for the CSN_FIXED type - * - the number of lines to skip in the CSN_DESCR type specified for the CSN_NEXT_EXIST, CSN_NEXT_EXIST_LH, - * CSN_NEXT_EXIST_OR_NULL, and CSN_NEXT_EXIST_OR_NULL_LH types - * - the number of bits in a bitmap for the CSN_BITMAP type - * - the value by which the number of bits in a bitmap has to be incremented or decremented for the - * CSN_VAR_BITMAP, CSN_LEFT_VAR_BMP, and CSN_LEFT_BMP_1 types - * - the offset to param1 for the CSN_CALLBACK type - * - ERRORCODE used by the CSN_ERROR type - * - * descr - * This parameter has different meaning depending on the value of the type parameter: - * - the offset for the CSN_UINT_OFFSET type - * - the number of the elements in an array of the CSN_UINT_ARRAY type - * - the offset to the parameter where the size of the array has to be stored for the CSN_REC_ARRAY type - * - the address of the internal structure, describing the member type (by means of the CSN_DESCR type) in the - * CSN_TYPE_ARRAY, CSN_VAR_TARRAY, and CSN_TYPE types - * - the address of the variable of type CSN_ChoiceElement_t describing all elements in the CSN_CHOICE type union - * - the offset to the variable where the number of bits has to be or is stored for the CSN_VAR_BITMAP, - * CSN_LEFT_VAR_BMP, and CSN_LEFT_BMP_1 types - * - the function number (case number) for the CSN_CALLBACK and CSN_CALLBACK_NO_ARGS types - * - the free text used by the CSN_TRAP_ERROR - * - * offset - * This is an offset to the _MEMBER parameter counting from the beginning of struct - * where the unpacked or packed value shall be stored or fetched. The meaning of the _MEMBER parameter - * varies depending on the type which is specified and so is the meaning of the offset parameter. - * Some types (and corresponding macros) do not have the _MEMBER parameter and then the offset parameter - * is not used or is different from the offset to the _MEMBER. - * - the fixed value for the CSN_FIXED type - * - an offset to the variable UnionType for CSN_UNION and CSN_UNION_LH types - * - an offset to the variable Exist for CSN_NEXT_EXIST and CSN_NEXT_EXIST_LH types - * - an offset to param2 in the CSN_CALLBACK type - * - * sz - * - is the name of the parameter within the descr where their unpacked or packed value shall be stored or fetched. - * This paramater is pointed out by the offset parameter in the same CSN_DESCR variable as the sz. - * - the free text used by the CSN_TRAP_ERROR (the same as parameter "i") - * - * serialize - * - stores the size of _MEMBER type in case of the M_TYPE_ARRAY and M_VAR_TARRAY, - * - the address of the function which is provided by the M_SERIALIZE type. - ******************************************************************************************/ - - -typedef struct -{ - gint16 type; - gint16 i; - union - { - void* ptr; - guint32 value; - } descr; - size_t offset; - const char* sz; - union - { - StreamSerializeFcn_t fcn; - guint32 value; - int* hf_ptr; - } serialize; -} CSN_DESCR; - -typedef struct -{ - guint8 bits; - guint8 value; - CSN_DESCR descr; -} CSN_ChoiceElement_t; - -void csnStreamInit(csnStream_t* ar,gint BitOffset,gint BitCount); - -/****************************************************************************** -* FUNCTION: csnStreamDecoder -* DESCRIPTION: -* UnPacks data from bit stream. According to CSN description. -* ARGS: -* ar stream will hold the parameters to the pack function -* ar->remaining_bits_len [IN] Number of bits to unpack [OUT] number of bits left to unpack. -* ar->bit_offset [IN/OUT] is the current bit where to proceed with the next bit to unpack. - -* pDescr CSN description. -* tvb buffer containing the bit stream to unpack. -* data unpacked data. -* ett_csn1 tree -* -* RETURNS: int Number of bits left to be unpacked. Negative Error code if failed to unpack all bits -******************************************************************************/ - -gint16 csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector, size_t& readIndex, void* data); - -gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector, size_t& readIndex, void* data); - -/* CSN struct macro's */ -#define CSN_DESCR_BEGIN(_STRUCT)\ - CSN_DESCR CSNDESCR_##_STRUCT[] = { - -#define CSN_DESCR_END(_STRUCT)\ - {CSN_END, 0, {0}, 0, "", {(StreamSerializeFcn_t)0}} }; - -/****************************************************************************** - * CSN_ERROR(Par1, Par2, Par3) - * May be called at any time when an abort of packing or unpacking of a message - * is desired - * Par1: C structure name - * Par2: free text which will appear in the error handler - * Par3: Error code - *****************************************************************************/ -#define CSN_ERROR(_STRUCT, _Text, _ERRCODE)\ - {CSN_TRAP_ERROR, _ERRCODE, {(void*)_Text}, 0, _Text, {(StreamSerializeFcn_t)0}} - -/****************************************************************************** - * M_BIT(Par1, Par2) - * Defines one bit element in the CSN1 syntax. - * Par1: C structure name - * Par2: C structure element name - *****************************************************************************/ -#define M_BIT(_STRUCT, _MEMBER)\ - {CSN_BIT, 0, {0}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} - -/****************************************************************************** - * M_NEXT_EXIST(Par1, Par2, Par3) - * Indicates whether the next element or a group of elements defined in the - * structure is present or not. - * Par1: C structure name - * Par2: C structure element name - * Par3: number of lines to skip in the CSN_DESCR type specified if the - * element(s) does not exist - *****************************************************************************/ -#define M_NEXT_EXIST(_STRUCT, _MEMBER, _NoOfExisting)\ - {CSN_NEXT_EXIST, _NoOfExisting, {0}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} - -/****************************************************************************** - * M_NEXT_EXIST_LH(Par1, Par2, Par3) - * similar to the M_NEXT_EXIST except that instead of bit 0/1 which is fetched - * from the message in order to find out whether the next element/elements are - * present in the message, the logical operation XOR with the background - * pattern 0x2B is performed on the read bit before the decision is made. - *****************************************************************************/ -#define M_NEXT_EXIST_LH(_STRUCT, _MEMBER, _NoOfExisting)\ - {CSN_NEXT_EXIST_LH, _NoOfExisting, {0}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} - -/****************************************************************************** - * M_NEXT_EXIST_OR_NULL(Par1, Par2, Par3) - * Similar to the M_NEXT_EXIST except that not only bit 0 or 1 but also the end - * of the message may be encountered when looking for the next element in the - * message. - * Covers the case {null | 0 | 1 < IE >} - *****************************************************************************/ -#define M_NEXT_EXIST_OR_NULL(_STRUCT, _MEMBER, _NoOfExisting)\ - {CSN_NEXT_EXIST, _NoOfExisting, {(void*)1}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} - -/****************************************************************************** - * M_NEXT_EXIST_OR_NULL_LH(Par1, Par2, Par3) - * Similar to the M_NEXT_EXIST_LH except that not only bit 0 or 1 but also the - * end of the message may be encountered when looking for the next element in - * the message. - * Covers the case {null | L | H < IE >} - *****************************************************************************/ -#define M_NEXT_EXIST_OR_NULL_LH(_STRUCT, _MEMBER, _NoOfExisting)\ - {CSN_NEXT_EXIST_LH, _NoOfExisting, {(void*)1}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} - -/****************************************************************************** - * M_UINT(Par1, Par2, Par3) - * Defines an integer number. - * Par1: C structure name - * Par2: C structure element name - * Par3: number of bits used to code the element (between 1 and 32) - *****************************************************************************/ -#define M_UINT(_STRUCT, _MEMBER, _BITS)\ - {CSN_UINT, _BITS, {(void*)1}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} - -/****************************************************************************** - * M_UINT(Par1, Par2, Par3) - * This macro has the same functionality as M_UINT except that in addition the - * logical "exclusive or" operation with the background value "0x2B" is - * performed before the final value of the integer number is delivered from the - * received CSN.1 message - *****************************************************************************/ -#define M_UINT_LH(_STRUCT, _MEMBER, _BITS)\ - {CSN_UINT_LH, _BITS, {(void*)1}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} - -/****************************************************************************** - * M_UINT_OFFSET(Par1, Par2, Par3, Par4) - * Defines an integer number. - * Par1: C structure name - * Par2: C structure element name - * Par3: number of bits used to code the element (between 1 and 32) - * Par4: value added to the returned integer (offset) - *****************************************************************************/ -#define M_UINT_OFFSET(_STRUCT, _MEMBER, _BITS, _OFFSET)\ - {CSN_UINT_OFFSET, _BITS, {(void*)_OFFSET}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} - -/****************************************************************************** - * M_UINT_ARRAY(Par1, Par2, Par3, Par4) - * Defines an array of integer numbers. The size of the array is fixed. - * Par1: C structure name - * Par2: C structure element name - * Par3: number of bits used to code the each integer element (between 1 and 32) - * Par4: number of elements in the array (fixed integer value) - *****************************************************************************/ -#define M_UINT_ARRAY(_STRUCT, _MEMBER, _BITS, _ElementCount)\ - {CSN_UINT_ARRAY, _BITS, {(void*)_ElementCount}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} - -/****************************************************************************** - * M_VAR_UINT_ARRAY(Par1, Par2, Par3, Par4) - * Defines an array of integer numbers. The size of the array is variable. - * Par1: C structure name - * Par2: C structure element name - * Par3: number of bits used to code the each integer element (between 1 and 32) - * Par4: number of elements in the array supplied by reference to the - * structure member holding the length value - *****************************************************************************/ -#define M_VAR_UINT_ARRAY(_STRUCT, _MEMBER, _BITS, _ElementCountField)\ - {CSN_UINT_ARRAY, _BITS, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)1}} - -/****************************************************************************** - * M_VAR_ARRAY(Par1, Par2, Par3, Par4) - * Defines an array of 8 bit large integer numbers. The size of the array is variable. - * Par1: C structure name - * Par2: C structure element name - * Par3: name of the structure member holding the size of the array - * Par4: offset that is added to the Par3 to get the actual size of the array - *****************************************************************************/ -#define M_VAR_ARRAY(_STRUCT, _MEMBER, _ElementCountField, _OFFSET)\ - {CSN_VARIABLE_ARRAY, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} - -/****************************************************************************** - * M_VAR_TARRAY(Par1, Par2, Par3, Par4) - * Similar to M_TYPE_ARRAY except that the size of the array is variable. - * Par1: C structure name - * Par2: C structure element name - * Par3: the type of each element of the array - * Par4: name of the structure member holding the size of the array - *****************************************************************************/ -#define M_VAR_TARRAY(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField)\ - {CSN_VARIABLE_TARRAY, offsetof(_STRUCT, _ElementCountField), {(void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)sizeof(_MEMBER_TYPE)}} - -/****************************************************************************** - * M_VAR_TARRAY_OFFSET(Par1, Par2, Par3, Par4) - * Same as M_VAR_TARRAY with offset - *****************************************************************************/ -#define M_VAR_TARRAY_OFFSET(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField)\ - {CSN_VARIABLE_TARRAY_OFFSET, offsetof(_STRUCT, _ElementCountField), {(void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)sizeof(_MEMBER_TYPE)}} - -/****************************************************************************** - * M_REC_ARRAY(Par1, Par2, Par3, Par4) - * similar to the M_VAR_ARRAY. The difference is that the size of the array is - * not known in advance and it has to be calculated during unpacking. Its value - * is stored in a variable which belongs to the same structure as the array. - * A zero element terminates the array. The CSN.1 syntax describes it - * recursively as: - * ::={1 | 0} - * - * Par1: C structure name - * Par2: C structure element name - * Par3: name of the structure member where the calculated the size of the - * array will be stored - * Par4: length of each element in bits - *****************************************************************************/ -#define M_REC_ARRAY(_STRUCT, _MEMBER, _ElementCountField, _BITS)\ - {CSN_RECURSIVE_ARRAY, _BITS, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} - -/****************************************************************************** - * M_VAR_TYPE_ARRAY(Par1, Par2, Par3, Par4) - * Defines an array of structures. The size of the array is variable. - * Par1: C structure name - * Par2: C structure element name - * Par3: name of the structure - * Par4: number of elements in the array (fixed integer value) - *****************************************************************************/ -#define M_TYPE_ARRAY(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCount)\ - {CSN_TYPE_ARRAY, _ElementCount, {(void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)sizeof(_MEMBER_TYPE)}} - -/****************************************************************************** - * M_REC_TARRAY(Par1, Par2, Par3, Par4) - * Defines an recursive array of structures. The size of the array is variable. - * ::= {1 } ** 0 ; - * Par1: C structure name - * Par2: C structure element name - * Par3: name of the structure - * Par4: will hold the number of element in the array after unpacking - *****************************************************************************/ -#define M_REC_TARRAY(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField)\ - {CSN_RECURSIVE_TARRAY, offsetof(_STRUCT, _ElementCountField), {(void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)sizeof(_MEMBER_TYPE)}} - -/****************************************************************************** - * M_REC_TARRAY1(Par1, Par2, Par3, Par4) - * Same as M_REC_TARRAY but first element always exist: - * ::= {1 } ** 0 ; - *****************************************************************************/ -#define M_REC_TARRAY_1(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField)\ - {CSN_RECURSIVE_TARRAY_1, offsetof(_STRUCT, _ElementCountField), {(void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)sizeof(_MEMBER_TYPE)}} - -/****************************************************************************** - * M_REC_TARRAY2(Par1, Par2, Par3, Par4) - * Same as M_REC_TARRAY but with reversed separators : - * ::= { 0 } ** 1 ; - *****************************************************************************/ -#define M_REC_TARRAY_2(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField)\ - {CSN_RECURSIVE_TARRAY_2, offsetof(_STRUCT, _ElementCountField), {(void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)sizeof(_MEMBER_TYPE)}} - -/****************************************************************************** - * M_TYPE(Par1, Par2, Par3) - * Defines a reference to a structure which is described elsewhere - * ::= {1 } ** 0 ; - * Par1: C structure name - * Par2: C structure element name - * Par3: type of member - *****************************************************************************/ -#define M_TYPE(_STRUCT, _MEMBER, _MEMBER_TYPE)\ - {CSN_TYPE, 0, {(void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} - -/****************************************************************************** - * M_UNION(Par1, Par2) - * Informs the CSN.1 library that a union follows and how many possible choices - * there are in the union. The actual value of the choice, which points out the - * chosen element of the union is stored in the uint8 variable and is usually - * called UnionType. The elements of the union have to be listed directly after - * the M_UNION statement. - * Par1: C structure name - * Par2: number of possible choice in the union - *****************************************************************************/ -#define M_UNION(_STRUCT, _COUNT)\ - {CSN_UNION, _COUNT, {0}, offsetof(_STRUCT, UnionType), "UnionType", {(StreamSerializeFcn_t)0}} - -/****************************************************************************** - * M_UNION_LH(Par1, Par2) - * Same as M_UNION but masked with background value 0x2B - *****************************************************************************/ -#define M_UNION_LH(_STRUCT, _COUNT)\ - {CSN_UNION_LH, _COUNT, {0}, offsetof(_STRUCT, UnionType), "UnionType", {(StreamSerializeFcn_t)0}} - -/****************************************************************************** - * M_CHOICE(Par1, Par2, Par3, Par4) - * Similar to the M_UNION. In the M_UNION the selected element of all possible - * choices in the union is referred as a sequential numbers, i.e., the first - * choice is addressed as choice 0 the second as choice 1, the third as choice - * 2 and so on, both in the encoded message and in the variable UnionType which - * is the part of the message. In the CSN_CHOICE case, this rule does not - * apply. There is free but predefined mapping of the element of the union and - * the value which addresses this element. - * The value of the address is called a selector. - * After unpacking, this value is then converted to the sequential number of the - * element in the union and stored in the UnionType variable. - * Par1: C structure name - * Par2: C structure element name - * Par3: address of an array of type CSN_ChoiceElement_t where all possible - * values of the selector are provided, together with the selector - * length expressed in bits and the address of the CSN_DESCR type - * where the element is defined. For every element in the union - * there is one line in the Choice variable. These lines have to - * appear in the _CHOICE in the same order as the elements in the - * union. The element of the union selected in the message through - * the _CHOICE parameter is after unpacking translated to the - * corresponding sequential number of this element and stored in - * the variable pointed out by the _MEMBER - * Par4: number of possible choices in the union - *****************************************************************************/ -#define M_CHOICE(_STRUCT, _MEMBER, _CHOICE, _ElementCount)\ - {CSN_CHOICE, _ElementCount, {(void*)_CHOICE}, offsetof(_STRUCT, _MEMBER), #_CHOICE, {(StreamSerializeFcn_t)0}} - -/****************************************************************************** - * M_FIXED(Par1, Par2, Par3) - * Defines a fixed value of type integer which should be fetched from or stored - * in the message - * Par1: C structure name - * Par2: gives the length of the fixed number in bits. - * Par3: the value of the number. If the expected value is not present in -* the message the unpacking procedure is aborted - *****************************************************************************/ -#define M_FIXED(_STRUCT, _BITS, _BITVALUE)\ - {CSN_FIXED, _BITS, {0}, _BITVALUE, #_BITVALUE, {(StreamSerializeFcn_t)0}} - -/****************************************************************************** - * M_SERIALIZE(Par1, Par2, Par3) - * Allows using a complete free format of data being encoded or decoded. - * When the M_SERIALIZE is uncounted during encoding or decoding of a message - * the CSNstream program passes the control over to the specified function - * together with all necessary parameters about the current position within - * the message being unpacked or packed. When transferring of "serialized" - * data to or from the message is finished by the function the CSNstream gets - * back control over the data stream and continues to work with the message. - *****************************************************************************/ -#define M_SERIALIZE(_STRUCT, _MEMBER, _SERIALIZEFCN)\ - {CSN_SERIALIZE, 1, {0}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {_SERIALIZEFCN}} - -#define M_CALLBACK(_STRUCT, _CSNCALLBACKFCN, _PARAM1, _PARAM2)\ - {CSN_CALLBACK, offsetof(_STRUCT, _PARAM1), {_CSNCALLBACKFCN}, offsetof(_STRUCT, _PARAM2), "CallBack_"#_CSNCALLBACKFCN, {(StreamSerializeFcn_t)0}} - -/****************************************************************************** - * M_BITMAP(Par1, Par2, Par3) - * Defines a type which consists of a bitmap. The size of the bitmap in bits - * is fixed and provided by the parameter Par3 - * Par1: C structure name - * Par2: C structure element name - * Par3: length of the bitmap expressed in bits - *****************************************************************************/ -#define M_BITMAP(_STRUCT, _MEMBER, _BITS)\ - {CSN_BITMAP, _BITS, {0}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} - -/* variable length, right aligned bitmap i.e. _ElementCountField = 11 => 00000111 11111111 */ -#define M_VAR_BITMAP(_STRUCT, _MEMBER, _ElementCountField, _OFFSET)\ - {CSN_VARIABLE_BITMAP, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} - -/* variable length, right aligned bitmap filling the rest of message - * - when unpacking the _ElementCountField will be set in runtime - * - when packing _ElementCountField contains the size of bitmap - */ -#define M_VAR_BITMAP_1(_STRUCT, _MEMBER, _ElementCountField, _OFFSET)\ - {CSN_VARIABLE_BITMAP_1, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} - -/* variable length, left aligned bitmap i.e. _ElementCountField = 11 => 11111111 11100000 */ -#define M_LEFT_VAR_BMP(_STRUCT, _MEMBER, _ElementCountField, _OFFSET)\ - {CSN_LEFT_ALIGNED_VAR_BMP, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} - -/* variable length, left aligned bitmap filling the rest of message - *- when unpacking the _ElementCountField will be set in runtime - * - when packing _ElementCountField contains the size of bitmap - */ -#define M_LEFT_VAR_BMP_1(_STRUCT, _MEMBER, _ElementCountField, _OFFSET)\ - {CSN_LEFT_ALIGNED_VAR_BMP_1, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} - -#define M_NULL(_STRUCT, _MEMBER)\ - {CSN_NULL, 0, {0}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} - -#define M_THIS_EXIST(_STRUCT)\ - {CSN_EXIST, 0, {0}, offsetof(_STRUCT, Exist), "Exist", {(StreamSerializeFcn_t)0}} - -#define M_THIS_EXIST_LH(_STRUCT)\ - {CSN_EXIST_LH, 0, {0}, offsetof(_STRUCT, Exist), "Exist", {(StreamSerializeFcn_t)0}} - -/* return value 0 if ok else discontionue the unpacking */ -typedef gint16 (*CsnCallBackFcn_t)(void* pv ,...); - -#define CSNDESCR(_FuncType) CSNDESCR_##_FuncType - -#endif /*_PACKET_CSN1_H_*/ diff --git a/gprs_bssgp_pcu.cpp b/gprs_bssgp_pcu.cpp deleted file mode 100644 index f0f71d89..00000000 --- a/gprs_bssgp_pcu.cpp +++ /dev/null @@ -1,244 +0,0 @@ -/* gprs_bssgp_pcu.cpp - * - * Copyright (C) 2012 Ivan Klyuchnikov - * - * 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. - */ - -#include -#include -#include - -struct sgsn_instance *sgsn; -void *tall_bsc_ctx; -struct bssgp_bvc_ctx *bctx = btsctx_alloc(BVCI, NSEI); - -int gprs_bssgp_pcu_rx_dl_ud(struct msgb *msg, struct tlv_parsed *tp) -{ - struct bssgp_ud_hdr *budh; - int tfi; - int i = 0; - - budh = (struct bssgp_ud_hdr *)msgb_bssgph(msg); - struct gprs_rlcmac_tbf *tbf; - // Create new TBF - tfi = tfi_alloc(); - if (tfi < 0) { - return tfi; - } - tbf = tbf_alloc(tfi); - tbf->direction = GPRS_RLCMAC_DL_TBF; - tbf->state = GPRS_RLCMAC_WAIT_DATA_SEQ_START; - tbf->tlli = ntohl(budh->tlli); - LOGP(DRLCMAC, LOGL_NOTICE, "TBF: [DOWNLINK] START TFI: %u TLLI: 0x%08x \n", tbf->tfi, tbf->tlli); - - /* LLC_PDU is mandatory IE */ - if (!TLVP_PRESENT(tp, BSSGP_IE_LLC_PDU)) - { - LOGP(DBSSGP, LOGL_ERROR, "BSSGP TLLI=0x%08x Rx UL-UD missing mandatory IE\n", tbf->tlli); - return bssgp_tx_status(BSSGP_CAUSE_MISSING_MAND_IE, NULL, msg); - } - - uint8_t *llc_pdu = (uint8_t *) TLVP_VAL(tp, BSSGP_IE_LLC_PDU); - tbf->data_index = TLVP_LEN(tp, BSSGP_IE_LLC_PDU); - - LOGP(DBSSGP, LOGL_NOTICE, "LLC PDU = "); - for (i = 0; i < tbf->data_index; i++) - { - tbf->rlc_data[i] = llc_pdu[i]; - LOGPC(DBSSGP, LOGL_NOTICE, "%02x", tbf->rlc_data[i]); - } - - uint16_t imsi_len = 0; - uint8_t *imsi; - if (TLVP_PRESENT(tp, BSSGP_IE_IMSI)) - { - imsi_len = TLVP_LEN(tp, BSSGP_IE_IMSI); - imsi = (uint8_t *) TLVP_VAL(tp, BSSGP_IE_IMSI); - - LOGPC(DBSSGP, LOGL_NOTICE, " IMSI = "); - for (i = 0; i < imsi_len; i++) - { - LOGPC(DBSSGP, LOGL_NOTICE, "%02x", imsi[i]); - } - LOGPC(DBSSGP, LOGL_NOTICE, "\n"); - } - - gsmtap_send_llc(tbf->rlc_data,tbf->data_index); - gprs_rlcmac_packet_downlink_assignment(tbf); - -} -/* Receive a BSSGP PDU from a BSS on a PTP BVCI */ -int gprs_bssgp_pcu_rx_ptp(struct msgb *msg, struct tlv_parsed *tp, struct bssgp_bvc_ctx *bctx) -{ - struct bssgp_normal_hdr *bgph = (struct bssgp_normal_hdr *) msgb_bssgph(msg); - uint8_t pdu_type = bgph->pdu_type; - unsigned rc = 0; - - /* If traffic is received on a BVC that is marked as blocked, the - * received PDU shall not be accepted and a STATUS PDU (Cause value: - * BVC Blocked) shall be sent to the peer entity on the signalling BVC */ - if (bctx->state & BVC_S_BLOCKED && pdu_type != BSSGP_PDUT_STATUS) - { - uint16_t bvci = msgb_bvci(msg); - LOGP(DBSSGP, LOGL_NOTICE, "rx BVC_S_BLOCKED\n"); - return bssgp_tx_status(BSSGP_CAUSE_BVCI_BLOCKED, &bvci, msg); - } - - switch (pdu_type) { - case BSSGP_PDUT_DL_UNITDATA: - LOGP(DBSSGP, LOGL_NOTICE, "RX: [SGSN->PCU] BSSGP_PDUT_DL_UNITDATA\n"); - gprs_bssgp_pcu_rx_dl_ud(msg, tp); - break; - case BSSGP_PDUT_PAGING_PS: - LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_PAGING_PS\n"); - break; - case BSSGP_PDUT_PAGING_CS: - LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_PAGING_CS\n"); - break; - case BSSGP_PDUT_RA_CAPA_UPDATE_ACK: - LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_RA_CAPA_UPDATE_ACK\n"); - break; - case BSSGP_PDUT_FLOW_CONTROL_BVC_ACK: - LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_FLOW_CONTROL_BVC_ACK\n"); - break; - case BSSGP_PDUT_FLOW_CONTROL_MS_ACK: - LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_FLOW_CONTROL_MS_ACK\n"); - break; - default: - DEBUGP(DBSSGP, "BSSGP BVCI=%u PDU type 0x%02x unknown\n", bctx->bvci, pdu_type); - rc = bssgp_tx_status(BSSGP_CAUSE_PROTO_ERR_UNSPEC, NULL, msg); - break; - } - return rc; -} - -/* Receive a BSSGP PDU from a SGSN on a SIGNALLING BVCI */ -int gprs_bssgp_pcu_rx_sign(struct msgb *msg, struct tlv_parsed *tp, struct bssgp_bvc_ctx *bctx) -{ - struct bssgp_normal_hdr *bgph = (struct bssgp_normal_hdr *) msgb_bssgph(msg); - int rc = 0; - switch (bgph->pdu_type) { - case BSSGP_PDUT_STATUS: - /* Some exception has occurred */ - DEBUGP(DBSSGP, "BSSGP BVCI=%u Rx BVC STATUS\n", bctx->bvci); - /* FIXME: send NM_STATUS.ind to NM */ - break; - case BSSGP_PDUT_SUSPEND_ACK: - LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_SUSPEND_ACK\n"); - break; - case BSSGP_PDUT_SUSPEND_NACK: - LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_SUSPEND_NACK\n"); - break; - case BSSGP_PDUT_BVC_RESET_ACK: - LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_BVC_RESET_ACK\n"); - break; - case BSSGP_PDUT_PAGING_PS: - LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_PAGING_PS\n"); - break; - case BSSGP_PDUT_PAGING_CS: - LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_PAGING_CS\n"); - break; - case BSSGP_PDUT_RESUME_ACK: - LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_RESUME_ACK\n"); - break; - case BSSGP_PDUT_RESUME_NACK: - LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_RESUME_NACK\n"); - break; - case BSSGP_PDUT_FLUSH_LL: - LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_FLUSH_LL\n"); - break; - case BSSGP_PDUT_BVC_BLOCK_ACK: - LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_SUSPEND_ACK\n"); - break; - case BSSGP_PDUT_BVC_UNBLOCK_ACK: - LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_BVC_UNBLOCK_ACK\n"); - break; - case BSSGP_PDUT_SGSN_INVOKE_TRACE: - LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_SGSN_INVOKE_TRACE\n"); - break; - default: - DEBUGP(DBSSGP, "BSSGP BVCI=%u Rx PDU type 0x%02x unknown\n", bctx->bvci, bgph->pdu_type); - rc = bssgp_tx_status(BSSGP_CAUSE_PROTO_ERR_UNSPEC, NULL, msg); - break; - } - return rc; -} - -int gprs_bssgp_pcu_rcvmsg(struct msgb *msg) -{ - struct bssgp_normal_hdr *bgph = (struct bssgp_normal_hdr *) msgb_bssgph(msg); - struct bssgp_ud_hdr *budh = (struct bssgp_ud_hdr *) msgb_bssgph(msg); - struct tlv_parsed tp; - uint8_t pdu_type = bgph->pdu_type; - uint16_t ns_bvci = msgb_bvci(msg); - int data_len; - int rc = 0; - - /* Identifiers from DOWN: NSEI, BVCI (both in msg->cb) */ - - /* UNITDATA BSSGP headers have TLLI in front */ - if (pdu_type != BSSGP_PDUT_UL_UNITDATA && pdu_type != BSSGP_PDUT_DL_UNITDATA) - { - data_len = msgb_bssgp_len(msg) - sizeof(*bgph); - rc = bssgp_tlv_parse(&tp, bgph->data, data_len); - } - else - { - data_len = msgb_bssgp_len(msg) - sizeof(*budh); - rc = bssgp_tlv_parse(&tp, budh->data, data_len); - } - - /* look-up or create the BTS context for this BVC */ - bctx = btsctx_by_bvci_nsei(ns_bvci, msgb_nsei(msg)); - - /* Only a RESET PDU can create a new BVC context */ - if (!bctx) - { - bctx = btsctx_alloc(ns_bvci, msgb_nsei(msg)); - } - - if (!bctx && pdu_type != BSSGP_PDUT_BVC_RESET_ACK) - { - LOGP(DBSSGP, LOGL_NOTICE, "NSEI=%u/BVCI=%u Rejecting PDU " - "type %u for unknown BVCI\n", msgb_nsei(msg), ns_bvci, - pdu_type); - return bssgp_tx_status(BSSGP_CAUSE_UNKNOWN_BVCI, NULL, msg); - } - - if (bctx) - { - log_set_context(BSC_CTX_BVC, bctx); - rate_ctr_inc(&bctx->ctrg->ctr[BSSGP_CTR_PKTS_IN]); - rate_ctr_add(&bctx->ctrg->ctr[BSSGP_CTR_BYTES_IN], msgb_bssgp_len(msg)); - } - - if (ns_bvci == BVCI_SIGNALLING) - { - LOGP(DBSSGP, LOGL_NOTICE, "rx BVCI_SIGNALLING gprs_bssgp_rx_sign\n"); - rc = gprs_bssgp_pcu_rx_sign(msg, &tp, bctx); - } - else if (ns_bvci == BVCI_PTM) - { - LOGP(DBSSGP, LOGL_NOTICE, "rx BVCI_PTM bssgp_tx_status\n"); - rc = bssgp_tx_status(BSSGP_CAUSE_PDU_INCOMP_FEAT, NULL, msg); - } - else - { - LOGP(DBSSGP, LOGL_NOTICE, "rx BVCI_PTP gprs_bssgp_rx_ptp\n"); - rc = gprs_bssgp_pcu_rx_ptp(msg, &tp, bctx); - } - return rc; -} diff --git a/gprs_bssgp_pcu.h b/gprs_bssgp_pcu.h deleted file mode 100644 index 02d85ce9..00000000 --- a/gprs_bssgp_pcu.h +++ /dev/null @@ -1,69 +0,0 @@ -/* gprs_bssgp_pcu.h - * - * Copyright (C) 2012 Ivan Klyuchnikov - * - * 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. - */ - -#ifndef GPRS_BSSGP_PCU_H -#define GPRS_BSSGP_PCU_H - - -extern "C" { -#include -#include -#include -#include -#include -#include -#include - -int bssgp_tx_bvc_reset(struct bssgp_bvc_ctx *bctx, uint16_t bvci, uint8_t cause); - -int bssgp_tx_ul_ud(struct bssgp_bvc_ctx *bctx, uint32_t tlli, const uint8_t *qos_profile, struct msgb *llc_pdu); - -struct bssgp_bvc_ctx *btsctx_alloc(uint16_t bvci, uint16_t nsei); -} -#include - -#define BVCI 7 -#define NSEI 3 - -#define QOS_PROFILE 0 -#define BSSGP_HDR_LEN 53 -#define NS_HDR_LEN 4 -#define MAX_LEN_PDU 60 -#define IE_LLC_PDU 14 -#define BLOCK_DATA_LEN 20 -#define BLOCK_LEN 23 - -#define CELL_ID 3 -#define MNC 55 -#define MCC 905 -#define PCU_LAC 1000 -#define PCU_RAC 1 - - -extern struct bssgp_bvc_ctx *bctx; - -int gprs_bssgp_pcu_rx_dl_ud(struct msgb *msg, struct tlv_parsed *tp); - -int gprs_bssgp_pcu_rx_ptp(struct msgb *msg, struct tlv_parsed *tp, struct bssgp_bvc_ctx *bctx); - -int gprs_bssgp_pcu_rx_sign(struct msgb *msg, struct tlv_parsed *tp, struct bssgp_bvc_ctx *bctx); - -int gprs_bssgp_pcu_rcvmsg(struct msgb *msg); - -#endif // GPRS_BSSGP_PCU_H diff --git a/gprs_debug.cpp b/gprs_debug.cpp deleted file mode 100644 index 479e9886..00000000 --- a/gprs_debug.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* gprs_debug.cpp - * - * Copyright (C) 2012 Ivan Klyuchnikov - * - * 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. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -/* default categories */ - -static const struct log_info_cat default_categories[] = { - {"DCSN1", "\033[1;31m", "Concrete Syntax Notation One (CSN1)", LOGL_NOTICE, 1}, - {"DL1IF", "\033[1;32m", "GPRS PCU L1 interface (L1IF)", LOGL_NOTICE, 1}, - {"DRLCMAC", "\033[1;33m", "GPRS RLC/MAC layer (RLCMAC)", LOGL_NOTICE, 1}, - {"DRLCMACDATA", "\033[1;36m", "GPRS RLC/MAC layer Data (RLCMAC)", LOGL_NOTICE, 1}, - {"DBSSGP", "\033[1;34m", "GPRS BSS Gateway Protocol (BSSGP)", LOGL_NOTICE , 1}, - {"DPCU", "\033[1;35m", "GPRS Packet Control Unit (PCU)", LOGL_NOTICE, 1} -}; - -enum { - _FLT_ALL = LOG_FILTER_ALL, /* libosmocore */ - FLT_IMSI = 1, - FLT_NSVC = 2, - FLT_BVC = 3, -}; - -static int filter_fn(const struct log_context *ctx, - struct log_target *tar) -{ - struct gsm_subscriber *subscr = (struct gsm_subscriber*)ctx->ctx[BSC_CTX_SUBSCR]; - const struct gprs_nsvc *nsvc = (const struct gprs_nsvc*)ctx->ctx[BSC_CTX_NSVC]; - const struct gprs_nsvc *bvc = (const struct gprs_nsvc*)ctx->ctx[BSC_CTX_BVC]; - - if ((tar->filter_map & (1 << FLT_IMSI)) != 0 - && subscr && strcmp(subscr->imsi, (const char*)tar->filter_data[FLT_IMSI]) == 0) - return 1; - - /* Filter on the NS Virtual Connection */ - if ((tar->filter_map & (1 << FLT_NSVC)) != 0 - && nsvc && (nsvc == tar->filter_data[FLT_NSVC])) - return 1; - - /* Filter on the BVC */ - if ((tar->filter_map & (1 << FLT_BVC)) != 0 - && bvc && (bvc == tar->filter_data[FLT_BVC])) - return 1; - - return 0; -} - -const struct log_info gprs_log_info = { - filter_fn, - (struct log_info_cat*)default_categories, - ARRAY_SIZE(default_categories), -}; diff --git a/gprs_debug.h b/gprs_debug.h deleted file mode 100644 index ee95e19d..00000000 --- a/gprs_debug.h +++ /dev/null @@ -1,68 +0,0 @@ -/* gprs_debug.h - * - * Copyright (C) 2012 Ivan Klyuchnikov - * - * 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. - */ - -#ifndef GPRS_DEBUG_H -#define GPRS_DEBUG_H - -#include -extern "C" { -#include -#include -}; -/* Debug Areas of the code */ -enum { - DCSN1, - DL1IF, - DRLCMAC, - DRLCMACDATA, - DBSSGP, - DPCU, - aDebug_LastEntry -}; - -/* context */ -#define BSC_CTX_SUBSCR 1 -#define BSC_CTX_NSVC 4 -#define BSC_CTX_BVC 5 - -/* target */ - -enum { - //DEBUG_FILTER_ALL = 1 << 0, - LOG_FILTER_IMSI = 1 << 1, - LOG_FILTER_NSVC = 1 << 2, - LOG_FILTER_BVC = 1 << 3, -}; - -/* we don't need a header dependency for this... */ - -struct gprs_nsvc; -struct bssgp_bvc_ctx; - -void log_set_imsi_filter(struct log_target *target, const char *imsi); -void log_set_nsvc_filter(struct log_target *target, - struct gprs_nsvc *nsvc); -void log_set_bvc_filter(struct log_target *target, - struct bssgp_bvc_ctx *bctx); - -extern const struct log_info gprs_log_info; - - - -#endif // GPRS_DEBUG_H diff --git a/gprs_rlcmac.cpp b/gprs_rlcmac.cpp deleted file mode 100644 index b0aa4a1e..00000000 --- a/gprs_rlcmac.cpp +++ /dev/null @@ -1,840 +0,0 @@ -/* gprs_rlcmac.cpp - * - * Copyright (C) 2012 Ivan Klyuchnikov - * - * 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. - */ - -#include -#include -#include -#include -#include - -LLIST_HEAD(gprs_rlcmac_tbfs); -void *rlcmac_tall_ctx; - -int tfi_alloc() -{ - struct gprs_rlcmac_tbf *tbf; - uint32_t tfi_map = 0; - uint32_t tfi_ind = 0; - uint32_t mask = 1; - uint8_t i; - - llist_for_each_entry(tbf, &gprs_rlcmac_tbfs, list) { - tfi_ind = 1 << tbf->tfi; - tfi_map = tfi_map|tfi_ind; - } - - for (i = 0; i < 32; i++) { - if(((tfi_map >> i) & mask) == 0) { - return i; - } - } - return -1; -} - -/* lookup TBF Entity (by TFI) */ -static struct gprs_rlcmac_tbf *tbf_by_tfi(uint8_t tfi) -{ - struct gprs_rlcmac_tbf *tbf; - - llist_for_each_entry(tbf, &gprs_rlcmac_tbfs, list) { - if (tbf->tfi == tfi) - return tbf; - } - return NULL; -} - -static struct gprs_rlcmac_tbf *tbf_by_tlli(uint32_t tlli) -{ - struct gprs_rlcmac_tbf *tbf; - llist_for_each_entry(tbf, &gprs_rlcmac_tbfs, list) { - if ((tbf->tlli == tlli)&&(tbf->direction == GPRS_RLCMAC_UL_TBF)) - return tbf; - } - return NULL; -} - -struct gprs_rlcmac_tbf *tbf_alloc(uint8_t tfi) -{ - struct gprs_rlcmac_tbf *tbf; - - tbf = talloc_zero(rlcmac_tall_ctx, struct gprs_rlcmac_tbf); - if (!tbf) - return NULL; - - tbf->tfi = tfi; - llist_add(&tbf->list, &gprs_rlcmac_tbfs); - - return tbf; -} - -static void tbf_free(struct gprs_rlcmac_tbf *tbf) -{ - llist_del(&tbf->list); - talloc_free(tbf); -} - - -static void tbf_timer_cb(void *_tbf) -{ - struct gprs_rlcmac_tbf *tbf = (struct gprs_rlcmac_tbf *)_tbf; - - tbf->num_T_exp++; - - switch (tbf->T) { - case 1111: - // TODO: We should add timers for TBF. - break; - default: - COUT("Timer expired in unknown mode" << tbf->T); - } -} - -static void tbf_timer_start(struct gprs_rlcmac_tbf *tbf, unsigned int T, - unsigned int seconds) -{ - if (osmo_timer_pending(&tbf->timer)) - COUT("Starting TBF timer %u while old timer %u pending" << T << tbf->T); - tbf->T = T; - tbf->num_T_exp = 0; - - /* FIXME: we should do this only once ? */ - tbf->timer.data = tbf; - tbf->timer.cb = &tbf_timer_cb; - - osmo_timer_schedule(&tbf->timer, seconds, 0); -} - - -static void tbf_gsm_timer_cb(void *_tbf) -{ - struct gprs_rlcmac_tbf *tbf = (struct gprs_rlcmac_tbf *)_tbf; - - tbf->num_fT_exp++; - - switch (tbf->fT) { - case 0: - // This is timer for delay RLC/MAC data sending after Downlink Immediate Assignment on CCCH. - gprs_rlcmac_segment_llc_pdu(tbf); - LOGP(DRLCMAC, LOGL_NOTICE, "TBF: [DOWNLINK] END TFI: %u TLLI: 0x%08x \n", tbf->tfi, tbf->tlli); - tbf_free(tbf); - break; - default: - COUT("Timer expired in unknown mode" << tbf->fT); - } -} - -static void tbf_gsm_timer_start(struct gprs_rlcmac_tbf *tbf, unsigned int fT, - int frames) -{ - if (osmo_gsm_timer_pending(&tbf->gsm_timer)) - COUT("Starting TBF timer %u while old timer %u pending" << fT << tbf->fT); - tbf->fT = fT; - tbf->num_fT_exp = 0; - - /* FIXME: we should do this only once ? */ - tbf->gsm_timer.data = tbf; - tbf->gsm_timer.cb = &tbf_gsm_timer_cb; - - osmo_gsm_timer_schedule(&tbf->gsm_timer, frames); -} - -void write_packet_downlink_assignment(bitvec * dest, uint8_t tfi, uint32_t tlli, uint8_t tn, uint8_t ta, uint8_t tsc) -{ - // TODO We should use our implementation of encode RLC/MAC Control messages. - unsigned wp = 0; - bitvec_write_field(dest, wp,0x1,2); // Payload Type - bitvec_write_field(dest, wp,0x0,2); // Uplink block with TDMA framenumber - bitvec_write_field(dest, wp,0x1,1); // Suppl/Polling Bit - bitvec_write_field(dest, wp,0x1,3); // Uplink state flag - bitvec_write_field(dest, wp,0x2,6); // MESSAGE TYPE - bitvec_write_field(dest, wp,0x0,2); // Page Mode - - bitvec_write_field(dest, wp,0x0,1); // switch PERSIST_LEVEL: off - bitvec_write_field(dest, wp,0x0,1); // switch TFI : on - bitvec_write_field(dest, wp,0x0,1); // switch UPLINK TFI : on - bitvec_write_field(dest, wp,tfi-1,5); // TFI - - bitvec_write_field(dest, wp,0x0,1); // Message escape - bitvec_write_field(dest, wp,0x0,2); // Medium Access Method: Dynamic Allocation - bitvec_write_field(dest, wp,0x0,1); // RLC acknowledged mode - - bitvec_write_field(dest, wp,0x0,1); // the network establishes no new downlink TBF for the mobile station - bitvec_write_field(dest, wp,0x1,8); // timeslot 7 - - bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_VALUE = on - bitvec_write_field(dest, wp,ta,6); // TIMING_ADVANCE_VALUE - bitvec_write_field(dest, wp,0x0,1); // switch TIMING_ADVANCE_INDEX = off - - bitvec_write_field(dest, wp,0x0,1); // switch POWER CONTROL = off - bitvec_write_field(dest, wp,0x1,1); // Frequency Parameters information elements = present - - bitvec_write_field(dest, wp,tsc,3); // Training Sequence Code (TSC) = 2 - bitvec_write_field(dest, wp,0x0,2); // ARFCN = present - bitvec_write_field(dest, wp,599,10); // ARFCN - - bitvec_write_field(dest, wp,0x1,1); // switch TFI : on - bitvec_write_field(dest, wp,tfi,5);// TFI - - bitvec_write_field(dest, wp,0x1,1); // Power Control Parameters IE = present - bitvec_write_field(dest, wp,0x0,4); // ALPHA power control parameter - bitvec_write_field(dest, wp,0x0,1); // switch GAMMA_TN0 = off - bitvec_write_field(dest, wp,0x0,1); // switch GAMMA_TN1 = off - bitvec_write_field(dest, wp,0x0,1); // switch GAMMA_TN2 = off - bitvec_write_field(dest, wp,0x0,1); // switch GAMMA_TN3 = off - bitvec_write_field(dest, wp,0x0,1); // switch GAMMA_TN4 = off - bitvec_write_field(dest, wp,0x0,1); // switch GAMMA_TN5 = off - bitvec_write_field(dest, wp,0x0,1); // switch GAMMA_TN6 = off - bitvec_write_field(dest, wp,0x1,1); // switch GAMMA_TN7 = on - bitvec_write_field(dest, wp,0x0,5); // GAMMA_TN7 - - bitvec_write_field(dest, wp,0x0,1); // TBF Starting TIME IE not present - bitvec_write_field(dest, wp,0x0,1); // Measurement Mapping struct not present - bitvec_write_field(dest, wp,0x0,1); -} - -void write_packet_uplink_assignment(bitvec * dest, uint8_t tfi, uint32_t tlli) -{ - // TODO We should use our implementation of encode RLC/MAC Control messages. - unsigned wp = 0; - bitvec_write_field(dest, wp,0x1,2); // Payload Type - bitvec_write_field(dest, wp,0x0,2); // Uplink block with TDMA framenumber - bitvec_write_field(dest, wp,0x1,1); // Suppl/Polling Bit - bitvec_write_field(dest, wp,0x1,3); // Uplink state flag - - - bitvec_write_field(dest, wp,0xa,6); // MESSAGE TYPE - - bitvec_write_field(dest, wp,0x0,2); // Page Mode - - bitvec_write_field(dest, wp,0x0,1); // switch PERSIST_LEVEL: off - bitvec_write_field(dest, wp,0x2,2); // switch TLLI : on - bitvec_write_field(dest, wp,tlli,32); // TLLI - - bitvec_write_field(dest, wp,0x0,1); // Message escape - bitvec_write_field(dest, wp,0x0,2); // CHANNEL_CODING_COMMAND - bitvec_write_field(dest, wp,0x0,1); // TLLI_BLOCK_CHANNEL_CODING - - bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_VALUE = on - bitvec_write_field(dest, wp,0x0,6); // TIMING_ADVANCE_VALUE - bitvec_write_field(dest, wp,0x0,1); // switch TIMING_ADVANCE_INDEX = off - - bitvec_write_field(dest, wp,0x0,1); // Frequency Parameters = off - - bitvec_write_field(dest, wp,0x1,2); // Dynamic Allocation = off - - bitvec_write_field(dest, wp,0x0,1); // Dynamic Allocation - bitvec_write_field(dest, wp,0x0,1); // P0 = off - - bitvec_write_field(dest, wp,0x1,1); // USF_GRANULARITY - bitvec_write_field(dest, wp,0x1,1); // switch TFI : on - bitvec_write_field(dest, wp,tfi,5);// TFI - - bitvec_write_field(dest, wp,0x0,1); // - bitvec_write_field(dest, wp,0x0,1); // TBF Starting Time = off - bitvec_write_field(dest, wp,0x0,1); // Timeslot Allocation - - bitvec_write_field(dest, wp,0x0,5); // USF_TN 0 - 4 - bitvec_write_field(dest, wp,0x1,1); // USF_TN 5 - bitvec_write_field(dest, wp,0x1,3); // USF_TN 5 - bitvec_write_field(dest, wp,0x0,2); // USF_TN 6 - 7 -// bitvec_write_field(dest, wp,0x0,1); // Measurement Mapping struct not present -} - - -// GSM 04.08 9.1.18 Immediate assignment -int write_immediate_assignment(bitvec * dest, uint8_t downlink, uint8_t ra, uint32_t fn, - uint8_t ta, uint8_t tfi = 0, uint32_t tlli = 0) -{ - unsigned wp = 0; - - bitvec_write_field(dest, wp,0x0,4); // Skip Indicator - bitvec_write_field(dest, wp,0x6,4); // Protocol Discriminator - bitvec_write_field(dest, wp,0x3F,8); // Immediate Assignment Message Type - - // 10.5.2.25b Dedicated mode or TBF - bitvec_write_field(dest, wp,0x0,1); // spare - bitvec_write_field(dest, wp,0x0,1); // TMA : Two-message assignment: No meaning - bitvec_write_field(dest, wp,downlink,1); // Downlink : Downlink assignment to mobile in packet idle mode - bitvec_write_field(dest, wp,0x1,1); // T/D : TBF or dedicated mode: this message assigns a Temporary Block Flow (TBF). - - bitvec_write_field(dest, wp,0x0,4); // Page Mode - - // GSM 04.08 10.5.2.25a Packet Channel Description - bitvec_write_field(dest, wp,0x1,5); // Channel type - bitvec_write_field(dest, wp,(l1fh->fl1h)->channel_info.tn,3); // TN - bitvec_write_field(dest, wp,(l1fh->fl1h)->channel_info.tsc,3); // TSC - bitvec_write_field(dest, wp,0x0,3); // non-hopping RF channel configuraion - bitvec_write_field(dest, wp,(l1fh->fl1h)->channel_info.arfcn,10); // ARFCN - - //10.5.2.30 Request Reference - bitvec_write_field(dest, wp,ra,8); // RA - bitvec_write_field(dest, wp,(fn / (26 * 51)) % 32,5); // T1' - bitvec_write_field(dest, wp,fn % 51,6); // T3 - bitvec_write_field(dest, wp,fn % 26,5); // T2 - - // 10.5.2.40 Timing Advance - bitvec_write_field(dest, wp,0x0,2); // spare - bitvec_write_field(dest, wp,ta,6); // Timing Advance value - - // No mobile allocation in non-hopping systems. - // A zero-length LV. Just write L=0. - bitvec_write_field(dest, wp,0,8); - - if (downlink) - { - // GSM 04.08 10.5.2.16 IA Rest Octets - bitvec_write_field(dest, wp, 3, 2); // "HH" - bitvec_write_field(dest, wp, 1, 2); // "01" Packet Downlink Assignment - bitvec_write_field(dest, wp,tlli,32); // TLLI - bitvec_write_field(dest, wp,0x1,1); // switch TFI : on - bitvec_write_field(dest, wp,tfi,5); // TFI - bitvec_write_field(dest, wp,0x0,1); // RLC acknowledged mode - bitvec_write_field(dest, wp,0x0,1); // ALPHA = present - bitvec_write_field(dest, wp,0x0,5); // GAMMA power control parameter - bitvec_write_field(dest, wp,0x0,1); // Polling Bit - bitvec_write_field(dest, wp,0x1,1); // TA_VALID ??? - bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_INDEX = on - bitvec_write_field(dest, wp,0x0,4); // TIMING_ADVANCE_INDEX - bitvec_write_field(dest, wp,0x0,1); // TBF Starting TIME present - bitvec_write_field(dest, wp,0x0,1); // P0 not present - bitvec_write_field(dest, wp,0x1,1); // P0 not present - bitvec_write_field(dest, wp,0xb,4); - } - else - { - // GMS 04.08 10.5.2.37b 10.5.2.16 - bitvec_write_field(dest, wp, 3, 2); // "HH" - bitvec_write_field(dest, wp, 0, 2); // "0" Packet Uplink Assignment - bitvec_write_field(dest, wp, 1, 1); // Block Allocation : Not Single Block Allocation - bitvec_write_field(dest, wp, tfi, 5); // TFI_ASSIGNMENT Temporary Flow Identity - bitvec_write_field(dest, wp, 0, 1); // POLLING - bitvec_write_field(dest, wp, 0, 1); // ALLOCATION_TYPE: dynamic - bitvec_write_field(dest, wp, 1, 3); // USF - bitvec_write_field(dest, wp, 1, 1); // USF_GRANULARITY - bitvec_write_field(dest, wp, 0 , 1); // "0" power control: Not Present - bitvec_write_field(dest, wp, 0, 2); // CHANNEL_CODING_COMMAND - bitvec_write_field(dest, wp, 1, 1); // TLLI_BLOCK_CHANNEL_CODING - bitvec_write_field(dest, wp, 1 , 1); // "1" Alpha : Present - bitvec_write_field(dest, wp, 0, 4); // Alpha - bitvec_write_field(dest, wp, 0, 5); // Gamma - bitvec_write_field(dest, wp, 0, 1); // TIMING_ADVANCE_INDEX_FLAG - bitvec_write_field(dest, wp, 0, 1); // TBF_STARTING_TIME_FLAG - } - - if (wp%8) - return wp/8+1; - else - return wp/8; -} - - -void write_ia_rest_octets_downlink_assignment(bitvec * dest, uint8_t tfi, uint32_t tlli) -{ - // GSM 04.08 10.5.2.16 - unsigned wp = 0; - bitvec_write_field(dest, wp, 3, 2); // "HH" - bitvec_write_field(dest, wp, 1, 2); // "01" Packet Downlink Assignment - bitvec_write_field(dest, wp,tlli,32); // TLLI - bitvec_write_field(dest, wp,0x1,1); // switch TFI : on - bitvec_write_field(dest, wp,tfi,5); // TFI - bitvec_write_field(dest, wp,0x0,1); // RLC acknowledged mode - bitvec_write_field(dest, wp,0x0,1); // ALPHA = present - bitvec_write_field(dest, wp,0x0,5); // GAMMA power control parameter - bitvec_write_field(dest, wp,0x0,1); // Polling Bit - bitvec_write_field(dest, wp,0x1,1); // TA_VALID ??? - bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_INDEX = on - bitvec_write_field(dest, wp,0x0,4); // TIMING_ADVANCE_INDEX - bitvec_write_field(dest, wp,0x0,1); // TBF Starting TIME present - bitvec_write_field(dest, wp,0x0,1); // P0 not present - bitvec_write_field(dest, wp,0x1,1); // P0 not present - bitvec_write_field(dest, wp,0xb,4); -} - -void write_packet_uplink_ack(bitvec * dest, uint8_t tfi, uint32_t tlli, unsigned cv, unsigned bsn) -{ - // TODO We should use our implementation of encode RLC/MAC Control messages. - unsigned wp = 0; - bitvec_write_field(dest, wp,0x1,2); // payload - bitvec_write_field(dest, wp,0x0,2); // Uplink block with TDMA framenumber - if (cv == 0) bitvec_write_field(dest, wp,0x1,1); // Suppl/Polling Bit - else bitvec_write_field(dest, wp,0x0,1); //Suppl/Polling Bit - bitvec_write_field(dest, wp,0x1,3); // Uplink state flag - - //bitvec_write_field(dest, wp,0x0,1); // Reduced block sequence number - //bitvec_write_field(dest, wp,BSN+6,5); // Radio transaction identifier - //bitvec_write_field(dest, wp,0x1,1); // Final segment - //bitvec_write_field(dest, wp,0x1,1); // Address control - - //bitvec_write_field(dest, wp,0x0,2); // Power reduction: 0 - //bitvec_write_field(dest, wp,TFI,5); // Temporary flow identifier - //bitvec_write_field(dest, wp,0x1,1); // Direction - - bitvec_write_field(dest, wp,0x09,6); // MESSAGE TYPE - bitvec_write_field(dest, wp,0x0,2); // Page Mode - - bitvec_write_field(dest, wp,0x0,2); - bitvec_write_field(dest, wp,tfi,5); // Uplink TFI - bitvec_write_field(dest, wp,0x0,1); - - bitvec_write_field(dest, wp,0x0,2); // CS1 - if (cv == 0) bitvec_write_field(dest, wp,0x1,1); // FINAL_ACK_INDICATION - else bitvec_write_field(dest, wp,0x0,1); // FINAL_ACK_INDICATION - bitvec_write_field(dest, wp,bsn + 1,7); // STARTING_SEQUENCE_NUMBER - // RECEIVE_BLOCK_BITMAP - for (unsigned i=0; i<8; i++) { - bitvec_write_field(dest, wp,0xff,8); - } - bitvec_write_field(dest, wp,0x1,1); // CONTENTION_RESOLUTION_TLLI = present - bitvec_write_field(dest, wp,tlli,8*4); - bitvec_write_field(dest, wp,0x00,4); //spare - bitvec_write_field(dest, wp,0x5,4); //0101 -} - -void gprs_rlcmac_tx_ul_ack(uint8_t tfi, uint32_t tlli, RlcMacUplinkDataBlock_t * ul_data_block) -{ - bitvec *packet_uplink_ack_vec = bitvec_alloc(23); - bitvec_unhex(packet_uplink_ack_vec, "2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b"); - write_packet_uplink_ack(packet_uplink_ack_vec, tfi, tlli, ul_data_block->CV, ul_data_block->BSN); - LOGP(DRLCMAC, LOGL_NOTICE, "TX: [PCU -> BTS] TFI: %u TLLI: 0x%08x Packet Uplink Ack\n", tfi, tlli); - RlcMacDownlink_t * packet_uplink_ack = (RlcMacDownlink_t *)malloc(sizeof(RlcMacDownlink_t)); - LOGP(DRLCMAC, LOGL_NOTICE, "+++++++++++++++++++++++++ TX : Packet Uplink Ack +++++++++++++++++++++++++\n"); - decode_gsm_rlcmac_downlink(packet_uplink_ack_vec, packet_uplink_ack); - LOGPC(DRLCMAC, LOGL_NOTICE, "\n"); - LOGP(DRLCMAC, LOGL_NOTICE, "------------------------- TX : Packet Uplink Ack -------------------------\n"); - free(packet_uplink_ack); - pcu_l1if_tx(packet_uplink_ack_vec, GsmL1_Sapi_Pacch); - bitvec_free(packet_uplink_ack_vec); -} - -void gprs_rlcmac_data_block_parse(gprs_rlcmac_tbf* tbf, RlcMacUplinkDataBlock_t * ul_data_block) -{ - // 1. Count the number of octets in header and number of LLC PDU in uplink data block. - unsigned data_block_hdr_len = 3; // uplink data block header length: 3 mandatory octets - unsigned llc_pdu_num = 0; // number of LLC PDU in data block - - - if (ul_data_block->E_1 == 0) // Extension octet follows immediately - { - unsigned i = -1; - do - { - i++; - data_block_hdr_len += 1; - llc_pdu_num++; - - // Singular case, TS 44.060 10.4.14 - if (ul_data_block->LENGTH_INDICATOR[i] == 0) - { - break; - } - - // New LLC PDU starts after the current LLC PDU and continues until - // the end of the RLC information field, no more extension octets. - if ((ul_data_block->M[i] == 1)&&(ul_data_block->E[i] == 1)) - { - llc_pdu_num++; - } - } while(ul_data_block->E[i] == 0); // there is another extension octet, which delimits the new LLC PDU - } - else - { - llc_pdu_num++; - } - if(ul_data_block->TI == 1) // TLLI field is present - { - tbf->tlli = ul_data_block->TLLI; - data_block_hdr_len += 4; // TLLI length : 4 octets - if (ul_data_block->PI == 1) // PFI is present if TI field indicates presence of TLLI - { - data_block_hdr_len += 1; // PFI length : 1 octet - } - } - - // 2. Extract all LLC PDU from uplink data block and send them to SGSN. - unsigned llc_pdu_len = 0; - unsigned data_octet_num = 0; - - for (unsigned num = 0; num < llc_pdu_num; num ++) - { - if (ul_data_block->E_1 == 0) // Extension octet follows immediately - { - // Singular case, TS 44.060 10.4.14 - if (ul_data_block->LENGTH_INDICATOR[num] == 0) - { - llc_pdu_len = UL_RLC_DATA_BLOCK_LEN - data_block_hdr_len; - } - else - { - llc_pdu_len = ul_data_block->LENGTH_INDICATOR[num]; - } - } - else - { - llc_pdu_len = UL_RLC_DATA_BLOCK_LEN - data_block_hdr_len; - } - - for (unsigned i = tbf->data_index; i < tbf->data_index + llc_pdu_len; i++) - { - tbf->rlc_data[i] = ul_data_block->RLC_DATA[data_octet_num]; - data_octet_num++; - } - tbf->data_index += llc_pdu_len; - - if (ul_data_block->E_1 == 0) // Extension octet follows immediately - { - // New LLC PDU starts after the current LLC PDU - if (ul_data_block->M[num] == 1) - { - gsmtap_send_llc(tbf->rlc_data, tbf->data_index); - gprs_rlcmac_tx_ul_ud(tbf); - tbf->data_index = 0; - // New LLC PDU continues until the end of the RLC information field, no more extension octets. - if ((ul_data_block->E[num] == 1)) - { - llc_pdu_len = UL_RLC_DATA_BLOCK_LEN - data_block_hdr_len - data_octet_num; - for (unsigned i = tbf->data_index; i < tbf->data_index + llc_pdu_len; i++) - { - tbf->rlc_data[i] = ul_data_block->RLC_DATA[data_octet_num]; - data_octet_num++; - } - tbf->data_index += llc_pdu_len; - num++; - } - } - } - } -} - -/* Received Uplink RLC data block. */ -int gprs_rlcmac_rcv_data_block(bitvec *rlc_block) -{ - struct gprs_rlcmac_tbf *tbf; - - LOGP(DRLCMAC, LOGL_NOTICE, "RX: [PCU <- BTS] Uplink Data Block\n"); - RlcMacUplinkDataBlock_t * ul_data_block = (RlcMacUplinkDataBlock_t *)malloc(sizeof(RlcMacUplinkDataBlock_t)); - LOGP(DRLCMAC, LOGL_NOTICE, "+++++++++++++++++++++++++ RX : Uplink Data Block +++++++++++++++++++++++++\n"); - decode_gsm_rlcmac_uplink_data(rlc_block, ul_data_block); - LOGP(DRLCMAC, LOGL_NOTICE, "------------------------- RX : Uplink Data Block -------------------------\n"); - tbf = tbf_by_tfi(ul_data_block->TFI); - if (!tbf) { - return 0; - } - - if (ul_data_block->TI == 1) - { - tbf->tlli = ul_data_block->TLLI; - } - - switch (tbf->state) { - case GPRS_RLCMAC_WAIT_DATA_SEQ_START: - if (ul_data_block->BSN == 0) { - tbf->data_index = 0; - gprs_rlcmac_data_block_parse(tbf, ul_data_block); - gprs_rlcmac_tx_ul_ack(tbf->tfi, tbf->tlli, ul_data_block); - if (ul_data_block->CV == 0) { - // Recieved last Data Block in this sequence. - gsmtap_send_llc(tbf->rlc_data, tbf->data_index); - tbf->state = GPRS_RLCMAC_WAIT_NEXT_DATA_SEQ; - gprs_rlcmac_tx_ul_ud(tbf); - } else { - tbf->bsn = ul_data_block->BSN; - tbf->state = GPRS_RLCMAC_WAIT_NEXT_DATA_BLOCK; - } - } - break; - case GPRS_RLCMAC_WAIT_NEXT_DATA_BLOCK: - if (tbf->bsn == (ul_data_block->BSN - 1)) { - gprs_rlcmac_data_block_parse(tbf, ul_data_block); - gprs_rlcmac_tx_ul_ack(tbf->tfi, tbf->tlli, ul_data_block); - if (ul_data_block->CV == 0) { - // Recieved last Data Block in this sequence. - gsmtap_send_llc(tbf->rlc_data, tbf->data_index); - tbf->state = GPRS_RLCMAC_WAIT_NEXT_DATA_SEQ; - gprs_rlcmac_tx_ul_ud(tbf); - } else { - tbf->bsn = ul_data_block->BSN; - tbf->state = GPRS_RLCMAC_WAIT_NEXT_DATA_BLOCK; - } - } else { - // Recieved Data Block with unexpected BSN. - // We should try to find nesessary Data Block. - tbf->state = GPRS_RLCMAC_WAIT_NEXT_DATA_BLOCK; - } - break; - case GPRS_RLCMAC_WAIT_NEXT_DATA_SEQ: - // Now we just ignore all Data Blocks and wait next Uplink TBF - break; - } - - free(ul_data_block); - return 1; -} - -/* Received Uplink RLC control block. */ -int gprs_rlcmac_rcv_control_block(bitvec *rlc_block) -{ - uint8_t tfi = 0; - uint32_t tlli = 0; - struct gprs_rlcmac_tbf *tbf; - struct gprs_rlcmac_tbf *ul_tbf; - - RlcMacUplink_t * ul_control_block = (RlcMacUplink_t *)malloc(sizeof(RlcMacUplink_t)); - LOGP(DRLCMAC, LOGL_NOTICE, "+++++++++++++++++++++++++ RX : Uplink Control Block +++++++++++++++++++++++++\n"); - decode_gsm_rlcmac_uplink(rlc_block, ul_control_block); - LOGPC(DRLCMAC, LOGL_NOTICE, "\n"); - LOGP(DRLCMAC, LOGL_NOTICE, "------------------------- RX : Uplink Control Block -------------------------\n"); - switch (ul_control_block->u.MESSAGE_TYPE) { - case MT_PACKET_CONTROL_ACK: - tlli = ul_control_block->u.Packet_Control_Acknowledgement.TLLI; - tbf = tbf_by_tlli(tlli); - if (!tbf) { - return 0; - } - LOGP(DRLCMAC, LOGL_NOTICE, "RX: [PCU <- BTS] TFI: %u TLLI: 0x%08x Packet Control Ack\n", tbf->tfi, tbf->tlli); - LOGP(DRLCMAC, LOGL_NOTICE, "TBF: [UPLINK] END TFI: %u TLLI: 0x%08x \n", tbf->tfi, tbf->tlli); - tbf_free(tbf); - break; - case MT_PACKET_DOWNLINK_ACK_NACK: - tfi = ul_control_block->u.Packet_Downlink_Ack_Nack.DOWNLINK_TFI; - tbf = tbf_by_tfi(tfi); - if (!tbf) { - return 0; - } - LOGP(DRLCMAC, LOGL_NOTICE, "RX: [PCU <- BTS] TFI: %u TLLI: 0x%08x Packet Downlink Ack/Nack\n", tbf->tfi, tbf->tlli); - tlli = tbf->tlli; - LOGP(DRLCMAC, LOGL_NOTICE, "TBF: [DOWNLINK] END TFI: %u TLLI: 0x%08x \n", tbf->tfi, tbf->tlli); - tbf_free(tbf); - break; - } - free(ul_control_block); - return 1; -} - -void gprs_rlcmac_rcv_block(bitvec *rlc_block) -{ - unsigned readIndex = 0; - unsigned payload = bitvec_read_field(rlc_block, readIndex, 2); - - switch (payload) { - case GPRS_RLCMAC_DATA_BLOCK: - gprs_rlcmac_rcv_data_block(rlc_block); - break; - case GPRS_RLCMAC_CONTROL_BLOCK: - gprs_rlcmac_rcv_control_block(rlc_block); - break; - case GPRS_RLCMAC_CONTROL_BLOCK_OPT: - COUT("GPRS_RLCMAC_CONTROL_BLOCK_OPT block payload is not supported.\n"); - default: - COUT("Unknown RLCMAC block payload.\n"); - } -} - -int gprs_rlcmac_rcv_rach(uint8_t ra, uint32_t Fn, uint16_t ta) -{ - struct gprs_rlcmac_tbf *tbf; - - // Create new TBF - int tfi = tfi_alloc(); - if (tfi < 0) { - return tfi; - } - tbf = tbf_alloc(tfi); - tbf->direction = GPRS_RLCMAC_UL_TBF; - tbf->state = GPRS_RLCMAC_WAIT_DATA_SEQ_START; - LOGP(DRLCMAC, LOGL_NOTICE, "TBF: [UPLINK] START TFI: %u\n", tbf->tfi); - LOGP(DRLCMAC, LOGL_NOTICE, "RX: [PCU <- BTS] TFI: %u RACH\n", tbf->tfi); - LOGP(DRLCMAC, LOGL_NOTICE, "TX: [PCU -> BTS] TFI: %u Packet Immidiate Assignment\n", tbf->tfi); - bitvec *immediate_assignment = bitvec_alloc(23); - bitvec_unhex(immediate_assignment, "2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b"); - int len = write_immediate_assignment(immediate_assignment, 0, ra, Fn, ta, tbf->tfi); - pcu_l1if_tx(immediate_assignment, GsmL1_Sapi_Agch, len); - bitvec_free(immediate_assignment); -} - -// Send RLC data to OpenBTS. -void gprs_rlcmac_tx_dl_data_block(uint32_t tlli, uint8_t tfi, uint8_t *pdu, int start_index, int end_index, uint8_t bsn, uint8_t fbi) -{ - int spare_len = 0; - bitvec *data_block_vector = bitvec_alloc(BLOCK_LEN); - bitvec_unhex(data_block_vector, "2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b"); - RlcMacDownlinkDataBlock_t * data_block = (RlcMacDownlinkDataBlock_t *)malloc(sizeof(RlcMacDownlinkDataBlock_t)); - data_block->PAYLOAD_TYPE = 0; - data_block->RRBP = 0; - data_block->SP = 1; - data_block->USF = 1; - data_block->PR = 0; - data_block->TFI = tfi; - data_block->FBI = fbi; - data_block->BSN = bsn; - - // Last RLC data block of current LLC PDU - if (fbi == 1) - { - data_block->E_1 = 0; - data_block->M[0] = 0; - data_block->E[0] = 1; - // Singular case, TS 44.060 10.4.14 - if ((end_index - start_index) == (BLOCK_LEN - 3)) - { - data_block->FBI = 0; - data_block->LENGTH_INDICATOR[0] = 0; - spare_len = 0; - end_index--; - } - else - { - data_block->LENGTH_INDICATOR[0] = end_index-start_index; - spare_len = BLOCK_LEN - 4 - data_block->LENGTH_INDICATOR[0]; - } - } - else - { - data_block->E_1 = 1; - } - - int data_oct_num = 0; - int i = 0; - // Pack LLC PDU into RLC data field - for(i = start_index; i < end_index; i++) { - data_block->RLC_DATA[data_oct_num] = pdu[i]; - data_oct_num++; - } - // Fill spare bits - for(i = data_oct_num; i < data_oct_num + spare_len; i++) { - data_block->RLC_DATA[i] = 0x2b; - } - LOGP(DRLCMAC, LOGL_NOTICE, "TX: [PCU -> BTS] Downlink Data Block\n"); - LOGP(DRLCMAC, LOGL_NOTICE, "+++++++++++++++++++++++++ TX : Downlink Data Block +++++++++++++++++++++++++\n"); - encode_gsm_rlcmac_downlink_data(data_block_vector, data_block); - LOGP(DRLCMAC, LOGL_NOTICE, "------------------------- TX : Downlink Data Block -------------------------\n"); - free(data_block); - pcu_l1if_tx(data_block_vector, GsmL1_Sapi_Pdtch); - bitvec_free(data_block_vector); - - // Singular case, TS 44.060 10.4.14 - if ((fbi == 1)&&((end_index + 1 - start_index) == (BLOCK_LEN - 3))) - { - gprs_rlcmac_tx_dl_data_block(tlli, tfi, pdu, end_index, end_index+1, bsn+1, fbi); - } -} - -int gprs_rlcmac_segment_llc_pdu(struct gprs_rlcmac_tbf *tbf) -{ - int fbi = 0; - int bsn = 0; - int num_blocks = 0; // number of RLC data blocks necessary for LLC PDU transmission - - - // LLC PDU fits into one RLC data block with optional LI field. - if (tbf->data_index < BLOCK_LEN - 4) - { - fbi = 1; - gprs_rlcmac_tx_dl_data_block(tbf->tlli, tbf->tfi, tbf->rlc_data, 0, tbf->data_index, bsn, fbi); - } - // Necessary several RLC data blocks for transmit LLC PDU. - else - { - // length of RLC data field in block (no optional octets) - int block_data_len = BLOCK_LEN - 3; - - // number of blocks with 20 octets length RLC data field - num_blocks = tbf->data_index/block_data_len; - - // rest of LLC PDU, which doesn't fit into data blocks with 20 octets RLC data field - int rest_len = tbf->data_index%BLOCK_DATA_LEN; - if (rest_len > 0) - { - // add one block for transmission rest of LLC PDU - num_blocks++; - } - - int start_index = 0; - int end_index = 0; - - // Transmit all RLC data blocks of current LLC PDU to MS - for (bsn = 0; bsn < num_blocks; bsn++) - { - if (bsn == num_blocks-1) - { - if (rest_len > 0) - { - block_data_len = rest_len; - } - fbi = 1; - } - end_index = start_index + block_data_len; - gprs_rlcmac_tx_dl_data_block(tbf->tlli, tbf->tfi, tbf->rlc_data, start_index, end_index, bsn, fbi); - start_index += block_data_len; - } - } -} - -/* Send Uplink unit-data to SGSN. */ -void gprs_rlcmac_tx_ul_ud(gprs_rlcmac_tbf *tbf) -{ - const uint8_t qos_profile = QOS_PROFILE; - struct msgb *llc_pdu; - unsigned msg_len = NS_HDR_LEN + BSSGP_HDR_LEN + tbf->data_index; - - LOGP(DBSSGP, LOGL_NOTICE, "TX: [PCU -> SGSN ] TFI: %u TLLI: 0x%08x DataLen: %u", tbf->tfi, tbf->tlli, tbf->data_index); - //LOGP(DBSSGP, LOGL_NOTICE, " Data = "); - //for (unsigned i = 0; i < tbf->data_index; i++) - // LOGPC(DBSSGP, LOGL_NOTICE, "%02x ", tbf->rlc_data[i]); - - bctx->cell_id = CELL_ID; - bctx->nsei = NSEI; - bctx->ra_id.mnc = MNC; - bctx->ra_id.mcc = MCC; - bctx->ra_id.lac = PCU_LAC; - bctx->ra_id.rac = PCU_RAC; - bctx->bvci = BVCI; - - llc_pdu = msgb_alloc_headroom(msg_len, msg_len,"llc_pdu"); - msgb_tvlv_push(llc_pdu, BSSGP_IE_LLC_PDU, sizeof(uint8_t)*tbf->data_index, tbf->rlc_data); - bssgp_tx_ul_ud(bctx, tbf->tlli, &qos_profile, llc_pdu); -} - -void gprs_rlcmac_downlink_assignment(gprs_rlcmac_tbf *tbf) -{ - LOGP(DRLCMAC, LOGL_NOTICE, "TX: [PCU -> BTS] TFI: %u TLLI: 0x%08x Immidiate Assignment (CCCH)\n", tbf->tfi, tbf->tlli); - bitvec *immediate_assignment = bitvec_alloc(23); - bitvec_unhex(immediate_assignment, "2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b"); - int len = write_immediate_assignment(immediate_assignment, 1, 125, get_current_fn(), (l1fh->fl1h)->channel_info.ta, tbf->tfi, tbf->tlli); - pcu_l1if_tx(immediate_assignment, GsmL1_Sapi_Agch, len); - bitvec_free(immediate_assignment); - tbf_gsm_timer_start(tbf, 0, 120); -} - -void gprs_rlcmac_packet_downlink_assignment(gprs_rlcmac_tbf *tbf) -{ - LOGP(DRLCMAC, LOGL_NOTICE, "TX: [PCU -> BTS] TFI: %u TLLI: 0x%08x Packet DL Assignment\n", tbf->tfi, tbf->tlli); - bitvec *packet_downlink_assignment_vec = bitvec_alloc(23); - bitvec_unhex(packet_downlink_assignment_vec, "2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b"); - write_packet_downlink_assignment(packet_downlink_assignment_vec, tbf->tfi, tbf->tlli, (l1fh->fl1h)->channel_info.tn, - (l1fh->fl1h)->channel_info.ta, (l1fh->fl1h)->channel_info.tsc); - RlcMacDownlink_t * packet_downlink_assignment = (RlcMacDownlink_t *)malloc(sizeof(RlcMacDownlink_t)); - LOGP(DRLCMAC, LOGL_NOTICE, "+++++++++++++++++++++++++ TX : Packet Downlink Assignment +++++++++++++++++++++++++\n"); - decode_gsm_rlcmac_downlink(packet_downlink_assignment_vec, packet_downlink_assignment); - LOGPC(DRLCMAC, LOGL_NOTICE, "\n"); - LOGP(DRLCMAC, LOGL_NOTICE, "------------------------- TX : Packet Downlink Assignment -------------------------\n"); - free(packet_downlink_assignment); - pcu_l1if_tx(packet_downlink_assignment_vec, GsmL1_Sapi_Pacch); - bitvec_free(packet_downlink_assignment_vec); - tbf_gsm_timer_start(tbf, 0, 120); -} diff --git a/gprs_rlcmac.h b/gprs_rlcmac.h deleted file mode 100644 index eb651c61..00000000 --- a/gprs_rlcmac.h +++ /dev/null @@ -1,108 +0,0 @@ -/* gprs_rlcmac.h - * - * Copyright (C) 2012 Ivan Klyuchnikov - * - * 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. - */ - -#ifndef GPRS_RLCMAC_H -#define GPRS_RLCMAC_H - -#include -#include -#include - -extern "C" { -#include -#include -} - -#define LLC_MAX_LEN 1543 -#define UL_RLC_DATA_BLOCK_LEN 23 - -enum gprs_rlcmac_tbf_state { - GPRS_RLCMAC_WAIT_DATA_SEQ_START, - GPRS_RLCMAC_WAIT_NEXT_DATA_BLOCK, - GPRS_RLCMAC_WAIT_NEXT_DATA_SEQ -}; - -enum gprs_rlcmac_tbf_direction { - GPRS_RLCMAC_DL_TBF, - GPRS_RLCMAC_UL_TBF -}; - -struct gprs_rlcmac_tbf { - struct llist_head list; - enum gprs_rlcmac_tbf_state state; - enum gprs_rlcmac_tbf_direction direction; - uint8_t tfi; - uint32_t tlli; - uint8_t rlc_data[LLC_MAX_LEN]; - uint16_t data_index; - uint8_t bsn; - - struct osmo_timer_list timer; - unsigned int T; /* Txxxx number */ - unsigned int num_T_exp; /* number of consecutive T expirations */ - - struct osmo_gsm_timer_list gsm_timer; - unsigned int fT; /* fTxxxx number */ - unsigned int num_fT_exp; /* number of consecutive fT expirations */ -}; - -extern struct llist_head gprs_rlcmac_tbfs; - -int tfi_alloc(); - -struct gprs_rlcmac_tbf *tbf_alloc(uint8_t tfi); - -static struct gprs_rlcmac_tbf *tbf_by_tfi(uint8_t tfi); - -static struct gprs_rlcmac_tbf *tbf_by_tlli(uint8_t tlli); - -static void tbf_free(struct gprs_rlcmac_tbf *tbf); - -/* TS 44.060 Section 10.4.7 Table 10.4.7.1: Payload Type field */ -enum gprs_rlcmac_block_type { - GPRS_RLCMAC_DATA_BLOCK = 0x0, - GPRS_RLCMAC_CONTROL_BLOCK = 0x1, - GPRS_RLCMAC_CONTROL_BLOCK_OPT = 0x2, - GPRS_RLCMAC_RESERVED = 0x3 -}; - -void gprs_rlcmac_tx_ul_ack(uint8_t tfi, uint32_t tlli, RlcMacUplinkDataBlock_t * ul_data_block); - -void gprs_rlcmac_data_block_parse(gprs_rlcmac_tbf* tbf, RlcMacUplinkDataBlock_t * ul_data_block); - -int gprs_rlcmac_rcv_data_block(bitvec *rlc_block); - -int gprs_rlcmac_rcv_control_block(bitvec *rlc_block); - -void gprs_rlcmac_rcv_block(bitvec *rlc_block); - -int gprs_rlcmac_rcv_rach(uint8_t ra, uint32_t Fn, uint16_t ta); - -void gprs_rlcmac_tx_dl_data_block(uint32_t tlli, uint8_t tfi, uint8_t *pdu, int start_index, int end_index, uint8_t bsn, uint8_t fbi); - -int gprs_rlcmac_segment_llc_pdu(struct gprs_rlcmac_tbf *tbf); - -void gprs_rlcmac_tx_ul_ud(gprs_rlcmac_tbf *tbf); - -void gprs_rlcmac_downlink_assignment(gprs_rlcmac_tbf *tbf); - -void gprs_rlcmac_packet_downlink_assignment(gprs_rlcmac_tbf *tbf); - - -#endif // GPRS_RLCMAC_H diff --git a/gsmL1prim.h b/gsmL1prim.h deleted file mode 100644 index b348a1a4..00000000 --- a/gsmL1prim.h +++ /dev/null @@ -1,415 +0,0 @@ -/* -* Copyright 2012 Thomas Cooper -* -* This software is distributed under the terms of the GNU Affero Public License. -* See the COPYING file in the main directory for details. -* -* This use of this software may be subject to additional restrictions. -* See the LEGAL file in the main directory for details. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 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 Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see . - -*/ - -#ifndef GSML1PRIM_H -#define GSML1PRIM_H - -#include - -typedef enum GsmL1_SubCh_t { -GsmL1_SubCh_NA, -} GsmL1_SubCh_t; - -typedef enum GsmL1_Sapi_t { -GsmL1_Sapi_Fcch, -GsmL1_Sapi_Sch, -GsmL1_Sapi_Sacch, -GsmL1_Sapi_Sdcch, -GsmL1_Sapi_Bcch, -GsmL1_Sapi_Pch, -GsmL1_Sapi_Agch, -GsmL1_Sapi_Cbch, -GsmL1_Sapi_Rach, -GsmL1_Sapi_TchF, -GsmL1_Sapi_FacchF, -GsmL1_Sapi_TchH, -GsmL1_Sapi_FacchH, -GsmL1_Sapi_Nch, -GsmL1_Sapi_Pdtch, -GsmL1_Sapi_Pacch, -GsmL1_Sapi_Pbcch, -GsmL1_Sapi_Pagch, -GsmL1_Sapi_Ppch, -GsmL1_Sapi_Pnch, -GsmL1_Sapi_Ptcch, -GsmL1_Sapi_Prach, -GsmL1_Sapi_Idle, -GsmL1_Sapi_NUM, -} GsmL1_Sapi_t; - -typedef enum GsmL1_Status_t { -GsmL1_Status_Success, -GsmL1_Status_Generic, -GsmL1_Status_NoMemory, -GsmL1_Status_Timeout, -GsmL1_Status_InvalidParam, -GsmL1_Status_Busy, -GsmL1_Status_NoRessource, -GsmL1_Status_Uninitialized, -GsmL1_Status_NullInterface, -GsmL1_Status_NullFctnPtr, -GsmL1_Status_BadCrc, -GsmL1_Status_BadUsf, -GsmL1_Status_InvalidCPS, -GsmL1_Status_UnexpectedBurst, -GsmL1_Status_UnavailCodec, -GsmL1_Status_CriticalError, -GsmL1_Status_OverheatError, -GsmL1_Status_DeviceError, -GsmL1_Status_FacchError, -GsmL1_Status_AlreadyDeactivated, -GsmL1_Status_TxBurstFifoOvrn, -GsmL1_Status_TxBurstFifoUndr, -GsmL1_Status_NotSynchronized, -GsmL1_Status_Unsupported, -GSML1_STATUS_NUM, -} GsmL1_Status_t; - -typedef enum GsmL1_PrimId_t { -GsmL1_PrimId_MphInitReq, -GsmL1_PrimId_MphCloseReq, -GsmL1_PrimId_MphConnectReq, -GsmL1_PrimId_MphDisconnectReq, -GsmL1_PrimId_MphActivateReq, -GsmL1_PrimId_MphDeactivateReq, -GsmL1_PrimId_MphConfigReq, -GsmL1_PrimId_MphMeasureReq, -GsmL1_PrimId_MphInitCnf, -GsmL1_PrimId_MphCloseCnf, -GsmL1_PrimId_MphConnectCnf, -GsmL1_PrimId_MphDisconnectCnf, -GsmL1_PrimId_MphActivateCnf, -GsmL1_PrimId_MphDeactivateCnf, -GsmL1_PrimId_MphConfigCnf, -GsmL1_PrimId_MphMeasureCnf, -GsmL1_PrimId_MphTimeInd, -GsmL1_PrimId_MphSyncInd, -GsmL1_PrimId_PhEmptyFrameReq, -GsmL1_PrimId_PhDataReq, -GsmL1_PrimId_PhConnectInd, -GsmL1_PrimId_PhReadyToSendInd, -GsmL1_PrimId_PhDataInd, -GsmL1_PrimId_PhRaInd, -GsmL1_PrimId_NUM, -} GsmL1_PrimId_t; - -typedef enum GsmL1_Dir_t { -GsmL1_Dir_TxDownlink, -GsmL1_Dir_RxUplink, -} GsmL1_Dir_t; - -typedef enum GsmL1_DevType_t { -GsmL1_DevType_TxdRxu, -} GsmL1_DevType_t; - -typedef enum GsmL1_TchPlType_t { -GsmL1_TchPlType_NA, -GsmL1_TchPlType_Efr, -GsmL1_TchPlType_Fr, -GsmL1_TchPlType_Hr, -GsmL1_TchPlType_Amr, -GsmL1_TchPlType_Amr_SidBad, -GsmL1_TchPlType_Amr_Onset, -GsmL1_TchPlType_Amr_Ratscch, -GsmL1_TchPlType_Amr_SidUpdateInH, -GsmL1_TchPlType_Amr_SidFirstP1, -GsmL1_TchPlType_Amr_SidFirstP2, -GsmL1_TchPlType_Amr_SidFirstInH, -GsmL1_TchPlType_Amr_RatscchMarker, -GsmL1_TchPlType_Amr_RatscchData, -} GsmL1_TchPlType_t; - -typedef enum GsmL1_ConfigParamId_t { -GsmL1_ConfigParamId_SetNbTsc, -GsmL1_ConfigParamId_SetTxPowerLevel, -GsmL1_ConfigParamId_SetLogChParams, -GsmL1_ConfigParamId_SetCipheringParams, -} GsmL1_ConfigParamId_t; - -typedef struct GsmL1_DeviceParam_t { -enum GsmL1_DevType_t devType; -int freqBand; -uint16_t u16Arfcn; -uint16_t u16BcchArfcn; -uint8_t u8NbTsc; -uint8_t u8Ncc; -float fRxPowerLevel; -float fTxPowerLevel; -} GsmL1_DeviceParam_t; - -typedef struct GsmL1_MsgUnitParam_t { -uint8_t u8Buffer[256]; -uint8_t u8Size; -} GsmL1_MsgUnitParam_t; - -typedef struct GsmL1_MeasParam_t { -float fRssi; -float fLinkQuality; -float fBer; -int16_t i16BurstTiming; -} GsmL1_MeasParam_t; - -typedef struct GsmL1_LogChParam_t { -union { -struct { -enum GsmL1_TchPlType_t tchPlType; - -enum { -GsmL1_AmrCmiPhase_NA, -GsmL1_AmrCmiPhase_Odd, -} amrCmiPhase; - -enum { -GsmL1_AmrCodecMode_Unset, -} amrInitCodecMode; - -enum { -GsmL1_AmrCodec_Unset, -GsmL1_AmrCodec_4_75, -GsmL1_AmrCodec_5_15, -GsmL1_AmrCodec_5_9, -GsmL1_AmrCodec_6_7, -GsmL1_AmrCodec_7_4, -GsmL1_AmrCodec_7_95, -GsmL1_AmrCodec_10_2, -GsmL1_AmrCodec_12_2, -} amrActiveCodecSet[8]; -} tch; - -struct { -uint8_t u8Bsic; -uint8_t u8NbrOfAgch; -} rach; - -struct { -uint8_t u8MsPowerLevel; -} sacch; - -struct { -uint8_t u8NbrOfAgch; -} agch; -}; -} GsmL1_LogChParam_t; - -typedef enum GsmL1_LogChComb_t { -GsmL1_LogChComb_0, -GsmL1_LogChComb_I, -GsmL1_LogChComb_II, -GsmL1_LogChComb_IV, -GsmL1_LogChComb_V, -GsmL1_LogChComb_VII, -GsmL1_LogChComb_XIII, -} GsmL1_LogChComb_t; - -enum { -GsmL1_FreqBand_850, -GsmL1_FreqBand_900, -GsmL1_FreqBand_1800, -GsmL1_FreqBand_1900, -}; - -typedef struct GsmL1_MphInitReq_t { -struct GsmL1_DeviceParam_t deviceParam; -} GsmL1_MphInitReq_t; - -typedef struct GsmL1_MphCloseReq_t { -uint32_t hLayer1; -} GsmL1_MphCloseReq_t; - -typedef struct GsmL1_MphConnectReq_t { -uint32_t hLayer1; -uint8_t u8Tn; -enum GsmL1_LogChComb_t logChComb; -} GsmL1_MphConnectReq_t; - -typedef struct GsmL1_MphDisconnectReq_t { -uint32_t hLayer1; -} GsmL1_MphDisconnectReq_t; - -typedef struct GsmL1_MphActivateReq_t { -uint32_t hLayer1; -struct GsmL1_LogChParam_t logChPrm; -uint8_t u8Tn; -enum GsmL1_SubCh_t subCh; -enum GsmL1_Dir_t dir; -enum GsmL1_Sapi_t sapi; -uint32_t hLayer2; -float fBFILevel; -} GsmL1_MphActivateReq_t; - -typedef struct GsmL1_MphDeactivateReq_t { -uint32_t hLayer1; -uint8_t u8Tn; -enum GsmL1_SubCh_t subCh; -enum GsmL1_Dir_t dir; -enum GsmL1_Sapi_t sapi; -} GsmL1_MphDeactivateReq_t; - -typedef struct GsmL1_ConfigParam_t { -struct { -enum GsmL1_Sapi_t sapi; -uint8_t u8Tn; -enum GsmL1_SubCh_t subCh; -enum GsmL1_Dir_t dir; -struct GsmL1_LogChParam_t logChParams; -} setLogChParams; -} GsmL1_ConfigParam_t; - -typedef struct GsmL1_MphConfigReq_t { -uint32_t hLayer1; -enum GsmL1_ConfigParamId_t cfgParamId; -struct GsmL1_ConfigParam_t cfgParams; -} GsmL1_MphConfigReq_t; - -typedef struct GsmL1_MphConfigCnf_t { -enum GsmL1_Status_t status; -enum GsmL1_ConfigParamId_t cfgParamId; -struct GsmL1_ConfigParam_t cfgParams; -} GsmL1_MphConfigCnf_t; - -typedef struct GsmL1_MphMeasureReq_t { -uint32_t hLayer1; -} GsmL1_MphMeasureReq_t; - -typedef struct GsmL1_MphInitCnf_t { -uint32_t hLayer1; -enum GsmL1_Status_t status; -} GsmL1_MphInitCnf_t; - -typedef struct GsmL1_MphCloseCnf_t { -enum GsmL1_Status_t status; -} GsmL1_MphCloseCnf_t; - -typedef struct GsmL1_MphConnectCnf_t { -enum GsmL1_Status_t status; -} GsmL1_MphConnectCnf_t; - -typedef struct GsmL1_MphDisconnectCnf_t { -enum GsmL1_Status_t status; -} GsmL1_MphDisconnectCnf_t; - -typedef struct GsmL1_MphActivateCnf_t { -enum GsmL1_Status_t status; -uint8_t u8Tn; -int sapi; -} GsmL1_MphActivateCnf_t; - -typedef struct GsmL1_MphDeactivateCnf_t { -enum GsmL1_Status_t status; -uint8_t u8Tn; -enum GsmL1_Sapi_t sapi; -} GsmL1_MphDeactivateCnf_t; - -typedef struct GsmL1_MphMeasureCnf_t { -enum GsmL1_Status_t status; -} GsmL1_MphMeasureCnf_t; - -typedef struct GsmL1_MphTimeInd_t { -uint32_t u32Fn; -} GsmL1_MphTimeInd_t; - -typedef struct GsmL1_MphSyncInd_t { -} GsmL1_MphSyncInd_t; - -typedef struct GsmL1_PhEmptyFrameReq_t { -uint32_t hLayer1; -uint8_t u8Tn; -uint32_t u32Fn; -enum GsmL1_Sapi_t sapi; -enum GsmL1_SubCh_t subCh; -uint8_t u8BlockNbr; -} GsmL1_PhEmptyFrameReq_t; - -typedef struct GsmL1_PhDataReq_t { -uint32_t hLayer1; -uint8_t u8Tn; -uint32_t u32Fn; -enum GsmL1_Sapi_t sapi; -enum GsmL1_SubCh_t subCh; -uint8_t u8BlockNbr; -struct GsmL1_MsgUnitParam_t msgUnitParam; -} GsmL1_PhDataReq_t; - -typedef struct GsmL1_PhConnectInd_t { -uint8_t u8Tn; -uint8_t u8Tsc; -uint16_t u16Arfcn; -} GsmL1_PhConnectInd_t; - -typedef struct GsmL1_PhReadyToSendInd_t { -uint32_t hLayer1; -uint8_t u8Tn; -uint32_t u32Fn; -enum GsmL1_Sapi_t sapi; -enum GsmL1_SubCh_t subCh; -uint8_t u8BlockNbr; -uint32_t hLayer2; -} GsmL1_PhReadyToSendInd_t; - -typedef struct GsmL1_PhDataInd_t { -struct GsmL1_MeasParam_t measParam; -struct GsmL1_MsgUnitParam_t msgUnitParam; -enum GsmL1_Sapi_t sapi; -uint32_t hLayer2; -} GsmL1_PhDataInd_t; - -typedef struct GsmL1_PhRaInd_t { -struct GsmL1_MeasParam_t measParam; -struct GsmL1_MsgUnitParam_t msgUnitParam; -uint32_t u32Fn; -uint32_t hLayer2; -} GsmL1_PhRaInd_t; - -typedef struct GsmL1_Prim_t { -union { -struct GsmL1_MphInitReq_t mphInitReq; -struct GsmL1_MphCloseReq_t mphCloseReq; -struct GsmL1_MphConnectReq_t mphConnectReq; -struct GsmL1_MphDisconnectReq_t mphDisconnectReq; -struct GsmL1_MphActivateReq_t mphActivateReq; -struct GsmL1_MphDeactivateReq_t mphDeactivateReq; -struct GsmL1_MphConfigReq_t mphConfigReq; -struct GsmL1_MphMeasureReq_t mphMeasureReq; -struct GsmL1_MphInitCnf_t mphInitCnf; -struct GsmL1_MphCloseCnf_t mphCloseCnf; -struct GsmL1_MphConnectCnf_t mphConnectCnf; -struct GsmL1_MphDisconnectCnf_t mphDisconnectCnf; -struct GsmL1_MphActivateCnf_t mphActivateCnf; -struct GsmL1_MphDeactivateCnf_t mphDeactivateCnf; -struct GsmL1_MphConfigCnf_t mphConfigCnf; -struct GsmL1_MphMeasureCnf_t mphMeasureCnf; -struct GsmL1_MphTimeInd_t mphTimeInd; -struct GsmL1_MphSyncInd_t mphSyncInd; -struct GsmL1_PhEmptyFrameReq_t phEmptyFrameReq; -struct GsmL1_PhDataReq_t phDataReq; -struct GsmL1_PhConnectInd_t phConnectInd; -struct GsmL1_PhReadyToSendInd_t phReadyToSendInd; -struct GsmL1_PhDataInd_t phDataInd; -struct GsmL1_PhRaInd_t phRaInd; -} u; - -enum GsmL1_PrimId_t id; -} GsmL1_Prim_t; - -#endif diff --git a/gsm_rlcmac.cpp b/gsm_rlcmac.cpp deleted file mode 100644 index 211d7af3..00000000 --- a/gsm_rlcmac.cpp +++ /dev/null @@ -1,5430 +0,0 @@ -/* gsm_rlcmac.c - * Routines for GSM RLC MAC control plane message dissection in wireshark. - * TS 44.060 and 24.008 - * - * Copyright (C) 2011 Ivan Klyuchnikov - * - * By Vincent Helfre, based on original code by Jari Sassi - * with the gracious authorization of STE - * Copyright (c) 2011 ST-Ericsson - * - * $Id: packet-gsm_rlcmac.c 39164 2011-09-27 12:05:32Z etxrab $ - * - * Wireshark - Network traffic analyzer - * By Gerald Combs - * 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. - */ - -#include "gsm_rlcmac.h" -/* Initialize the protocol and registered fields -*/ -#include -#include -#include -using namespace std; - -/* Payload type as defined in TS 44.060 / 10.4.7 */ -#define PAYLOAD_TYPE_DATA 0 -#define PAYLOAD_TYPE_CTRL_NO_OPT_OCTET 1 -#define PAYLOAD_TYPE_CTRL_OPT_OCTET 2 -#define PAYLOAD_TYPE_RESERVED 3 - -/* CSN1 structures */ -/*(not all parts of CSN_DESCR structure are always initialized.)*/ -static const -CSN_DESCR_BEGIN(PLMN_t) - M_UINT (PLMN_t, MCC2, 4), - M_UINT (PLMN_t, MCC1, 4), - M_UINT (PLMN_t, MNC3, 4), - M_UINT (PLMN_t, MCC3, 4), - M_UINT (PLMN_t, MNC2, 4), - M_UINT (PLMN_t, MNC1, 4), -CSN_DESCR_END (PLMN_t) - -static const -CSN_DESCR_BEGIN(StartingTime_t) - M_UINT (StartingTime_t, N32, 5), - M_UINT (StartingTime_t, N51, 6), - M_UINT (StartingTime_t, N26, 5), -CSN_DESCR_END (StartingTime_t) - -/*< Global TFI IE >*/ -static const -CSN_DESCR_BEGIN(Global_TFI_t) - M_UNION (Global_TFI_t, 2), - M_UINT (Global_TFI_t, u.UPLINK_TFI, 5), - M_UINT (Global_TFI_t, u.DOWNLINK_TFI, 5), -CSN_DESCR_END (Global_TFI_t) - -/*< Starting Frame Number Description IE >*/ -static const -CSN_DESCR_BEGIN(Starting_Frame_Number_t) - M_UNION (Starting_Frame_Number_t, 2), - M_TYPE (Starting_Frame_Number_t, u.StartingTime, StartingTime_t), - M_UINT (Starting_Frame_Number_t, u.k, 13), -CSN_DESCR_END(Starting_Frame_Number_t) - -/*< Ack/Nack Description IE >*/ -static const -CSN_DESCR_BEGIN(Ack_Nack_Description_t) - M_UINT (Ack_Nack_Description_t, FINAL_ACK_INDICATION, 1), - M_UINT (Ack_Nack_Description_t, STARTING_SEQUENCE_NUMBER, 7), - M_BITMAP (Ack_Nack_Description_t, RECEIVED_BLOCK_BITMAP, 64), -CSN_DESCR_END (Ack_Nack_Description_t) - -/*< Packet Timing Advance IE >*/ -static const -CSN_DESCR_BEGIN(Packet_Timing_Advance_t) - M_NEXT_EXIST (Packet_Timing_Advance_t, Exist_TIMING_ADVANCE_VALUE, 1), - M_UINT (Packet_Timing_Advance_t, TIMING_ADVANCE_VALUE, 6), - - M_NEXT_EXIST (Packet_Timing_Advance_t, Exist_IndexAndtimeSlot, 2), - M_UINT (Packet_Timing_Advance_t, TIMING_ADVANCE_INDEX, 4), - M_UINT (Packet_Timing_Advance_t, TIMING_ADVANCE_TIMESLOT_NUMBER, 3), -CSN_DESCR_END (Packet_Timing_Advance_t) - -/*< Power Control Parameters IE >*/ -static const -CSN_DESCR_BEGIN(GPRS_Power_Control_Parameters_t) - M_UINT (GPRS_Power_Control_Parameters_t, ALPHA, 4), - M_UINT (GPRS_Power_Control_Parameters_t, T_AVG_W, 5), - M_UINT (GPRS_Power_Control_Parameters_t, T_AVG_T, 5), - M_BIT (GPRS_Power_Control_Parameters_t, PC_MEAS_CHAN), - M_UINT (GPRS_Power_Control_Parameters_t, N_AVG_I, 4), -CSN_DESCR_END (GPRS_Power_Control_Parameters_t) - -/*< Global Power Control Parameters IE >*/ -static const -CSN_DESCR_BEGIN(Global_Power_Control_Parameters_t) - M_UINT (Global_Power_Control_Parameters_t, ALPHA, 4), - M_UINT (Global_Power_Control_Parameters_t, T_AVG_W, 5), - M_UINT (Global_Power_Control_Parameters_t, T_AVG_T, 5), - M_UINT (Global_Power_Control_Parameters_t, Pb, 4), - M_UINT (Global_Power_Control_Parameters_t, PC_MEAS_CHAN, 1), - M_UINT (Global_Power_Control_Parameters_t, INT_MEAS_CHANNEL_LIST_AVAIL, 1), - M_UINT (Global_Power_Control_Parameters_t, N_AVG_I, 4), -CSN_DESCR_END (Global_Power_Control_Parameters_t) - -/*< Global Packet Timing Advance IE >*/ -static const -CSN_DESCR_BEGIN(Global_Packet_Timing_Advance_t) - M_NEXT_EXIST (Global_Packet_Timing_Advance_t, Exist_TIMING_ADVANCE_VALUE, 1), - M_UINT (Global_Packet_Timing_Advance_t, TIMING_ADVANCE_VALUE, 6), - - M_NEXT_EXIST (Global_Packet_Timing_Advance_t, Exist_UPLINK_TIMING_ADVANCE, 2), - M_UINT (Global_Packet_Timing_Advance_t, UPLINK_TIMING_ADVANCE_INDEX, 4), - M_UINT (Global_Packet_Timing_Advance_t, UPLINK_TIMING_ADVANCE_TIMESLOT_NUMBER, 3), - - M_NEXT_EXIST (Global_Packet_Timing_Advance_t, Exist_DOWNLINK_TIMING_ADVANCE, 2), - M_UINT (Global_Packet_Timing_Advance_t, DOWNLINK_TIMING_ADVANCE_INDEX, 4), - M_UINT (Global_Packet_Timing_Advance_t, DOWNLINK_TIMING_ADVANCE_TIMESLOT_NUMBER, 3), -CSN_DESCR_END (Global_Packet_Timing_Advance_t) - -/*< Channel Quality Report struct >*/ -static const -CSN_DESCR_BEGIN(Channel_Quality_Report_t) - M_UINT (Channel_Quality_Report_t, C_VALUE, 6), - M_UINT (Channel_Quality_Report_t, RXQUAL, 3), - M_UINT (Channel_Quality_Report_t, SIGN_VAR, 6), - - M_NEXT_EXIST (Channel_Quality_Report_t, Slot[0].Exist, 1), - M_UINT (Channel_Quality_Report_t, Slot[0].I_LEVEL_TN, 4), - - M_NEXT_EXIST (Channel_Quality_Report_t, Slot[1].Exist, 1), - M_UINT (Channel_Quality_Report_t, Slot[1].I_LEVEL_TN, 4), - - M_NEXT_EXIST (Channel_Quality_Report_t, Slot[2].Exist, 1), - M_UINT (Channel_Quality_Report_t, Slot[2].I_LEVEL_TN, 4), - - M_NEXT_EXIST (Channel_Quality_Report_t, Slot[3].Exist, 1), - M_UINT (Channel_Quality_Report_t, Slot[3].I_LEVEL_TN, 4), - - M_NEXT_EXIST (Channel_Quality_Report_t, Slot[4].Exist, 1), - M_UINT (Channel_Quality_Report_t, Slot[4].I_LEVEL_TN, 4), - - M_NEXT_EXIST (Channel_Quality_Report_t, Slot[5].Exist, 1), - M_UINT (Channel_Quality_Report_t, Slot[5].I_LEVEL_TN, 4), - - M_NEXT_EXIST (Channel_Quality_Report_t, Slot[6].Exist, 1), - M_UINT (Channel_Quality_Report_t, Slot[6].I_LEVEL_TN, 4), - - M_NEXT_EXIST (Channel_Quality_Report_t, Slot[7].Exist, 1), - M_UINT (Channel_Quality_Report_t, Slot[7].I_LEVEL_TN, 4), -CSN_DESCR_END (Channel_Quality_Report_t) - -/*< EGPRS Ack/Nack Description >*/ -static const -CSN_DESCR_BEGIN (EGPRS_AckNack_t) - M_NEXT_EXIST (EGPRS_AckNack_t, Exist_LENGTH, 1), - M_UINT (EGPRS_AckNack_t, LENGTH, 8), - - M_UINT (EGPRS_AckNack_t, FINAL_ACK_INDICATION, 1), - M_UINT (EGPRS_AckNack_t, BEGINNING_OF_WINDOW, 1), - M_UINT (EGPRS_AckNack_t, END_OF_WINDOW, 1), - M_UINT (EGPRS_AckNack_t, STARTING_SEQUENCE_NUMBER, 11), - - M_NEXT_EXIST (EGPRS_AckNack_t, Exist_CRBB, 3), - M_UINT (EGPRS_AckNack_t, CRBB_LENGTH, 7), - M_UINT (EGPRS_AckNack_t, CRBB_STARTING_COLOR_CODE, 1), - M_LEFT_VAR_BMP (EGPRS_AckNack_t, CRBB, CRBB_LENGTH, 0), -CSN_DESCR_END (EGPRS_AckNack_t) - -/**/ -/**/ -static const -CSN_DESCR_BEGIN(MobileAllocationIE_t) - M_UINT (MobileAllocationIE_t, Length, 8), - M_VAR_ARRAY (MobileAllocationIE_t, MA, Length, 0), -CSN_DESCR_END (MobileAllocationIE_t) - -static const -CSN_DESCR_BEGIN(SingleRFChannel_t) - M_UINT (SingleRFChannel_t, spare, 2), - M_UINT (SingleRFChannel_t, ARFCN, 10), -CSN_DESCR_END (SingleRFChannel_t) - -static const -CSN_DESCR_BEGIN(RFHoppingChannel_t) - M_UINT (RFHoppingChannel_t, MAIO, 6), - M_UINT (RFHoppingChannel_t, HSN, 6), -CSN_DESCR_END (RFHoppingChannel_t) - -static const -CSN_DESCR_BEGIN(MobileAllocation_or_Frequency_Short_List_t) - M_UNION (MobileAllocation_or_Frequency_Short_List_t, 2), - M_BITMAP (MobileAllocation_or_Frequency_Short_List_t, u.Frequency_Short_List, 64), - M_TYPE (MobileAllocation_or_Frequency_Short_List_t, u.MA, MobileAllocationIE_t), -CSN_DESCR_END (MobileAllocation_or_Frequency_Short_List_t) - -static const -CSN_DESCR_BEGIN(Channel_Description_t) - M_UINT (Channel_Description_t, Channel_type_and_TDMA_offset, 5), - M_UINT (Channel_Description_t, TN, 3), - M_UINT (Channel_Description_t, TSC, 3), - - M_UNION (Channel_Description_t, 2), - M_TYPE (Channel_Description_t, u.SingleRFChannel, SingleRFChannel_t), - M_TYPE (Channel_Description_t, u.RFHoppingChannel, RFHoppingChannel_t), -CSN_DESCR_END(Channel_Description_t) - -static const -CSN_DESCR_BEGIN(Group_Channel_Description_t) - M_TYPE (Group_Channel_Description_t, Channel_Description, Channel_Description_t), - - M_NEXT_EXIST (Group_Channel_Description_t, Exist_Hopping, 1), - M_TYPE (Group_Channel_Description_t, MA_or_Frequency_Short_List, MobileAllocation_or_Frequency_Short_List_t), -CSN_DESCR_END (Group_Channel_Description_t) - -static const -CSN_DESCR_BEGIN(Group_Call_Reference_t) - M_UINT (Group_Call_Reference_t, value, 27), - M_BIT (Group_Call_Reference_t, SF), - M_BIT (Group_Call_Reference_t, AF), - M_UINT (Group_Call_Reference_t, call_priority, 3), - M_UINT (Group_Call_Reference_t, Ciphering_information, 4), -CSN_DESCR_END (Group_Call_Reference_t) - -static const -CSN_DESCR_BEGIN(Group_Call_information_t) - M_TYPE (Group_Call_information_t, Group_Call_Reference, Group_Call_Reference_t), - - M_NEXT_EXIST (Group_Call_information_t, Exist_Group_Channel_Description, 1), - M_TYPE (Group_Call_information_t, Group_Channel_Description, Group_Channel_Description_t), -CSN_DESCR_END (Group_Call_information_t) - -static const -CSN_DESCR_BEGIN (P1_Rest_Octets_t) - M_NEXT_EXIST_LH(P1_Rest_Octets_t, Exist_NLN_PCH_and_NLN_status, 2), - M_UINT (P1_Rest_Octets_t, NLN_PCH, 2), - M_UINT (P1_Rest_Octets_t, NLN_status, 1), - - M_NEXT_EXIST_LH(P1_Rest_Octets_t, Exist_Priority1, 1), - M_UINT (P1_Rest_Octets_t, Priority1, 3), - - M_NEXT_EXIST_LH(P1_Rest_Octets_t, Exist_Priority2, 1), - M_UINT (P1_Rest_Octets_t, Priority2, 3), - - M_NEXT_EXIST_LH(P1_Rest_Octets_t, Exist_Group_Call_information, 1), - M_TYPE (P1_Rest_Octets_t, Group_Call_information, Group_Call_information_t), - - M_UINT_LH (P1_Rest_Octets_t, Packet_Page_Indication_1, 1), - M_UINT_LH (P1_Rest_Octets_t, Packet_Page_Indication_2, 1), -CSN_DESCR_END (P1_Rest_Octets_t) - -static const -CSN_DESCR_BEGIN (P2_Rest_Octets_t) - M_NEXT_EXIST_LH(P2_Rest_Octets_t, Exist_CN3, 1), - M_UINT (P2_Rest_Octets_t, CN3, 2), - - M_NEXT_EXIST_LH(P2_Rest_Octets_t, Exist_NLN_and_status, 2), - M_UINT (P2_Rest_Octets_t, NLN, 2), - M_UINT (P2_Rest_Octets_t, NLN_status, 1), - - M_NEXT_EXIST_LH(P2_Rest_Octets_t, Exist_Priority1, 1), - M_UINT (P2_Rest_Octets_t, Priority1, 3), - - M_NEXT_EXIST_LH(P2_Rest_Octets_t, Exist_Priority2, 1), - M_UINT (P2_Rest_Octets_t, Priority2, 3), - - M_NEXT_EXIST_LH(P2_Rest_Octets_t, Exist_Priority3, 1), - M_UINT (P2_Rest_Octets_t, Priority3, 3), - - M_UINT_LH (P2_Rest_Octets_t, Packet_Page_Indication_3, 1), -CSN_DESCR_END (P2_Rest_Octets_t) - - -/* - * Note!! - * - first two bits skipped and frequencyparameters skipped - * - additions for R99 and EGPRS added - */ -static const -CSN_DESCR_BEGIN(DynamicAllocation_t) - M_UINT (DynamicAllocation_t, USF, 3), - M_UINT (DynamicAllocation_t, USF_GRANULARITY, 1), - - M_NEXT_EXIST (DynamicAllocation_t, Exist_P0_PR_MODE, 2), - M_UINT (DynamicAllocation_t, P0, 4), - M_UINT (DynamicAllocation_t, PR_MODE, 1), -CSN_DESCR_END (DynamicAllocation_t) - -static const -CSN_DESCR_BEGIN(EGPRS_TwoPhaseAccess_t) - M_NEXT_EXIST (EGPRS_TwoPhaseAccess_t, Exist_ALPHA, 1), - M_UINT (EGPRS_TwoPhaseAccess_t, ALPHA, 4), - - M_UINT (EGPRS_TwoPhaseAccess_t, GAMMA, 5), - M_TYPE (EGPRS_TwoPhaseAccess_t, TBF_STARTING_TIME, StartingTime_t), - M_UINT (EGPRS_TwoPhaseAccess_t, NR_OF_RADIO_BLOCKS_ALLOCATED, 2), - - M_NEXT_EXIST (EGPRS_TwoPhaseAccess_t, Exist_P0_BTS_PWR_CTRL_PR_MODE, 3), - M_UINT (EGPRS_TwoPhaseAccess_t, P0, 4), - M_UINT (EGPRS_TwoPhaseAccess_t, BTS_PWR_CTRL_MODE, 1), - M_UINT (EGPRS_TwoPhaseAccess_t, PR_MODE, 1), -CSN_DESCR_END (EGPRS_TwoPhaseAccess_t) - -static const -CSN_DESCR_BEGIN(EGPRS_OnePhaseAccess_t) - M_UINT (EGPRS_OnePhaseAccess_t, TFI_ASSIGNMENT, 5), - M_UINT (EGPRS_OnePhaseAccess_t, POLLING, 1), - - M_UNION (EGPRS_OnePhaseAccess_t, 2), - M_TYPE (EGPRS_OnePhaseAccess_t, Allocation.DynamicAllocation, DynamicAllocation_t), - CSN_ERROR (EGPRS_OnePhaseAccess_t, "1 ", CSN_ERROR_STREAM_NOT_SUPPORTED), - - M_UINT (EGPRS_OnePhaseAccess_t, EGPRS_CHANNEL_CODING_COMMAND, 4), - M_UINT (EGPRS_OnePhaseAccess_t, TLLI_BLOCK_CHANNEL_CODING, 1), - - M_NEXT_EXIST (EGPRS_OnePhaseAccess_t, Exist_BEP_PERIOD2, 1), - M_UINT (EGPRS_OnePhaseAccess_t, BEP_PERIOD2, 4), - - M_UINT (EGPRS_OnePhaseAccess_t, RESEGMENT, 1), - M_UINT (EGPRS_OnePhaseAccess_t, EGPRS_WindowSize, 5), - - M_NEXT_EXIST (EGPRS_OnePhaseAccess_t, Exist_ALPHA, 1), - M_UINT (EGPRS_OnePhaseAccess_t, ALPHA, 4), - - M_UINT (EGPRS_OnePhaseAccess_t, GAMMA, 5), - - M_NEXT_EXIST (EGPRS_OnePhaseAccess_t, Exist_TIMING_ADVANCE_INDEX, 1), - M_UINT (EGPRS_OnePhaseAccess_t, TIMING_ADVANCE_INDEX, 4), - - M_NEXT_EXIST (EGPRS_OnePhaseAccess_t, Exist_TBF_STARTING_TIME, 1), - M_TYPE (EGPRS_OnePhaseAccess_t, TBF_STARTING_TIME, StartingTime_t), -CSN_DESCR_END (EGPRS_OnePhaseAccess_t) - -static const -CSN_DESCR_BEGIN(IA_EGPRS_00_t) - M_UINT (IA_EGPRS_00_t, ExtendedRA, 5), - - M_REC_ARRAY (IA_EGPRS_00_t, AccessTechnologyType, NrOfAccessTechnologies, 4), - - M_UNION (IA_EGPRS_00_t, 2), - M_TYPE (IA_EGPRS_00_t, Access.TwoPhaseAccess, EGPRS_TwoPhaseAccess_t), - M_TYPE (IA_EGPRS_00_t, Access.OnePhaseAccess, EGPRS_OnePhaseAccess_t), -CSN_DESCR_END (IA_EGPRS_00_t) - -static const -CSN_ChoiceElement_t IA_EGPRS_Choice[] = -{ - {2, 0x00, M_TYPE (IA_EGPRS_t, u.IA_EGPRS_PUA, IA_EGPRS_00_t)}, - {2, 0x01, CSN_ERROR(IA_EGPRS_t, "01 ", CSN_ERROR_STREAM_NOT_SUPPORTED)}, - {1, 0x01, CSN_ERROR(IA_EGPRS_t, "1 ", CSN_ERROR_STREAM_NOT_SUPPORTED)} -}; - -/* Please observe the double usage of UnionType element. - * First, it is used to store the second bit of LL/LH identification of EGPRS contents. - * Thereafter, UnionType will be used to store the index to detected choice. - */ -static const -CSN_DESCR_BEGIN(IA_EGPRS_t) - M_UINT (IA_EGPRS_t, UnionType , 1 ), - M_CHOICE (IA_EGPRS_t, UnionType, IA_EGPRS_Choice, ElementsOf(IA_EGPRS_Choice)), -CSN_DESCR_END (IA_EGPRS_t) - -static const -CSN_DESCR_BEGIN(IA_FreqParamsBeforeTime_t) - M_UINT (IA_FreqParamsBeforeTime_t, Length, 6), - M_UINT (IA_FreqParamsBeforeTime_t, MAIO, 6), - M_VAR_ARRAY (IA_FreqParamsBeforeTime_t, MobileAllocation, Length, 8), -CSN_DESCR_END (IA_FreqParamsBeforeTime_t) - -static const -CSN_DESCR_BEGIN (GPRS_SingleBlockAllocation_t) - M_NEXT_EXIST (GPRS_SingleBlockAllocation_t, Exist_ALPHA, 1), - M_UINT (GPRS_SingleBlockAllocation_t, ALPHA, 4), - - M_UINT (GPRS_SingleBlockAllocation_t, GAMMA, 5), - M_FIXED (GPRS_SingleBlockAllocation_t, 2, 0x01), - M_TYPE (GPRS_SingleBlockAllocation_t, TBF_STARTING_TIME, StartingTime_t), /*bit(16)*/ - - M_NEXT_EXIST_LH(GPRS_SingleBlockAllocation_t, Exist_P0_BTS_PWR_CTRL_PR_MODE, 3), - M_UINT (GPRS_SingleBlockAllocation_t, P0, 4), - M_UINT (GPRS_SingleBlockAllocation_t, BTS_PWR_CTRL_MODE, 1), - M_UINT (GPRS_SingleBlockAllocation_t, PR_MODE, 1), -CSN_DESCR_END (GPRS_SingleBlockAllocation_t) - -static const -CSN_DESCR_BEGIN (GPRS_DynamicOrFixedAllocation_t) - M_UINT (GPRS_DynamicOrFixedAllocation_t, TFI_ASSIGNMENT, 5), - M_UINT (GPRS_DynamicOrFixedAllocation_t, POLLING, 1), - - M_UNION (GPRS_DynamicOrFixedAllocation_t, 2), - M_TYPE (GPRS_DynamicOrFixedAllocation_t, Allocation.DynamicAllocation, DynamicAllocation_t), - CSN_ERROR (GPRS_DynamicOrFixedAllocation_t, "1 ", CSN_ERROR_STREAM_NOT_SUPPORTED), - - M_UINT (GPRS_DynamicOrFixedAllocation_t, CHANNEL_CODING_COMMAND, 2), - M_UINT (GPRS_DynamicOrFixedAllocation_t, TLLI_BLOCK_CHANNEL_CODING, 1), - - M_NEXT_EXIST (GPRS_DynamicOrFixedAllocation_t, Exist_ALPHA, 1), - M_UINT (GPRS_DynamicOrFixedAllocation_t, ALPHA, 4), - - M_UINT (GPRS_DynamicOrFixedAllocation_t, GAMMA, 5), - - M_NEXT_EXIST (GPRS_DynamicOrFixedAllocation_t, Exist_TIMING_ADVANCE_INDEX, 1), - M_UINT (GPRS_DynamicOrFixedAllocation_t, TIMING_ADVANCE_INDEX, 4), - - M_NEXT_EXIST (GPRS_DynamicOrFixedAllocation_t, Exist_TBF_STARTING_TIME, 1), - M_TYPE (GPRS_DynamicOrFixedAllocation_t, TBF_STARTING_TIME, StartingTime_t), -CSN_DESCR_END (GPRS_DynamicOrFixedAllocation_t) - -static const -CSN_DESCR_BEGIN(PU_IA_AdditionsR99_t) - M_NEXT_EXIST (PU_IA_AdditionsR99_t, Exist_ExtendedRA, 1), - M_UINT (PU_IA_AdditionsR99_t, ExtendedRA, 5), -CSN_DESCR_END (PU_IA_AdditionsR99_t) - -static const -CSN_DESCR_BEGIN (Packet_Uplink_ImmAssignment_t) - M_UNION (Packet_Uplink_ImmAssignment_t, 2), - M_TYPE (Packet_Uplink_ImmAssignment_t, Access.SingleBlockAllocation, GPRS_SingleBlockAllocation_t), - M_TYPE (Packet_Uplink_ImmAssignment_t, Access.DynamicOrFixedAllocation, GPRS_DynamicOrFixedAllocation_t), - - M_NEXT_EXIST_OR_NULL_LH(Packet_Uplink_ImmAssignment_t, Exist_AdditionsR99, 1), - M_TYPE (Packet_Uplink_ImmAssignment_t, AdditionsR99, PU_IA_AdditionsR99_t), -CSN_DESCR_END (Packet_Uplink_ImmAssignment_t) - -static const -CSN_DESCR_BEGIN(PD_IA_AdditionsR99_t) - M_UINT (PD_IA_AdditionsR99_t, EGPRS_WindowSize, 5), - M_UINT (PD_IA_AdditionsR99_t, LINK_QUALITY_MEASUREMENT_MODE, 2), - - M_NEXT_EXIST (PD_IA_AdditionsR99_t, Exist_BEP_PERIOD2, 1), - M_UINT (PD_IA_AdditionsR99_t, BEP_PERIOD2, 4), -CSN_DESCR_END (PD_IA_AdditionsR99_t) - -static const -CSN_DESCR_BEGIN(Packet_Downlink_ImmAssignment_t) - M_UINT (Packet_Downlink_ImmAssignment_t, TLLI, 32), - - M_NEXT_EXIST (Packet_Downlink_ImmAssignment_t, Exist_TFI_to_TA_VALID, 6 + 1), - M_UINT (Packet_Downlink_ImmAssignment_t, TFI_ASSIGNMENT, 5), - M_UINT (Packet_Downlink_ImmAssignment_t, RLC_MODE, 1), - M_NEXT_EXIST (Packet_Downlink_ImmAssignment_t, Exist_ALPHA, 1), - M_UINT (Packet_Downlink_ImmAssignment_t, ALPHA, 4), - M_UINT (Packet_Downlink_ImmAssignment_t, GAMMA, 5), - M_UINT (Packet_Downlink_ImmAssignment_t, POLLING, 1), - M_UINT (Packet_Downlink_ImmAssignment_t, TA_VALID, 1), - - M_NEXT_EXIST (Packet_Downlink_ImmAssignment_t, Exist_TIMING_ADVANCE_INDEX, 1), - M_UINT (Packet_Downlink_ImmAssignment_t, TIMING_ADVANCE_INDEX, 4), - - M_NEXT_EXIST (Packet_Downlink_ImmAssignment_t, Exist_TBF_STARTING_TIME, 1), - M_TYPE (Packet_Downlink_ImmAssignment_t, TBF_STARTING_TIME, StartingTime_t), - - M_NEXT_EXIST (Packet_Downlink_ImmAssignment_t, Exist_P0_PR_MODE, 3), - M_UINT (Packet_Downlink_ImmAssignment_t, P0, 4), - M_UINT (Packet_Downlink_ImmAssignment_t, BTS_PWR_CTRL_MODE, 1), - M_UINT (Packet_Downlink_ImmAssignment_t, PR_MODE, 1), - - M_NEXT_EXIST_OR_NULL_LH(Packet_Downlink_ImmAssignment_t, Exist_AdditionsR99, 1), - M_TYPE (Packet_Downlink_ImmAssignment_t, AdditionsR99, PD_IA_AdditionsR99_t), -CSN_DESCR_END (Packet_Downlink_ImmAssignment_t) - -static const -CSN_DESCR_BEGIN (Second_Part_Packet_Assignment_t) - M_NEXT_EXIST_OR_NULL_LH(Second_Part_Packet_Assignment_t, Exist_SecondPart, 2), - M_NEXT_EXIST (Second_Part_Packet_Assignment_t, Exist_ExtendedRA, 1), - M_UINT (Second_Part_Packet_Assignment_t, ExtendedRA, 5), -CSN_DESCR_END (Second_Part_Packet_Assignment_t) - -static const -CSN_DESCR_BEGIN(IA_PacketAssignment_UL_DL_t) - M_UNION (IA_PacketAssignment_UL_DL_t, 2), - M_TYPE (IA_PacketAssignment_UL_DL_t, ul_dl.Packet_Uplink_ImmAssignment, Packet_Uplink_ImmAssignment_t), - M_TYPE (IA_PacketAssignment_UL_DL_t, ul_dl.Packet_Downlink_ImmAssignment, Packet_Downlink_ImmAssignment_t), -CSN_DESCR_END (IA_PacketAssignment_UL_DL_t) - -static const -CSN_DESCR_BEGIN(IA_PacketAssignment_t) - M_UNION (IA_PacketAssignment_t, 2), - M_TYPE (IA_PacketAssignment_t, u.UplinkDownlinkAssignment, IA_PacketAssignment_UL_DL_t), - M_TYPE (IA_PacketAssignment_t, u.UplinkDownlinkAssignment, Second_Part_Packet_Assignment_t), -CSN_DESCR_END (IA_PacketAssignment_t) - -/* */ -static const -CSN_ChoiceElement_t PacketPollingID[] = -{ - {1, 0, M_TYPE(PacketPollingID_t, u.Global_TFI, Global_TFI_t)}, - {2, 0x02, M_UINT(PacketPollingID_t, u.TLLI, 32)}, - {3, 0x06, M_UINT(PacketPollingID_t, u.TQI, 16)}, -/*{3, 0x07 , M_TYPE(PacketUplinkID_t, u.Packet_Request_Reference, Packet_Request_Reference_t)},*/ -}; - -static const -CSN_DESCR_BEGIN(PacketPollingID_t) - M_CHOICE (PacketPollingID_t, UnionType, PacketPollingID, ElementsOf(PacketPollingID)), -CSN_DESCR_END (PacketPollingID_t) - -static const -CSN_DESCR_BEGIN(Packet_Polling_Request_t) - M_UINT (Packet_Polling_Request_t, MESSAGE_TYPE, 6), - M_UINT (Packet_Polling_Request_t, PAGE_MODE, 2), - M_TYPE (Packet_Polling_Request_t, ID, PacketPollingID_t), - M_BIT (Packet_Polling_Request_t, TYPE_OF_ACK), -CSN_DESCR_END (Packet_Polling_Request_t) - -static const -CSN_DESCR_BEGIN(MobileAllocation_t) - M_UINT_OFFSET(MobileAllocation_t, MA_BitLength, 6, 1), - M_VAR_BITMAP (MobileAllocation_t, MA_BITMAP, MA_BitLength, 0), -CSN_DESCR_END (MobileAllocation_t) - -static const -CSN_DESCR_BEGIN(ARFCN_index_list_t) - M_REC_ARRAY (ARFCN_index_list_t, ARFCN_INDEX, ElementsOf_ARFCN_INDEX, 6), -CSN_DESCR_END (ARFCN_index_list_t) - -static const -CSN_DESCR_BEGIN(GPRS_Mobile_Allocation_t) - M_UINT (GPRS_Mobile_Allocation_t, HSN, 6), - M_REC_ARRAY (GPRS_Mobile_Allocation_t, RFL_NUMBER, ElementsOf_RFL_NUMBER, 4), - M_UNION (GPRS_Mobile_Allocation_t, 2), - M_TYPE (GPRS_Mobile_Allocation_t, u.MA, MobileAllocation_t), - M_TYPE (GPRS_Mobile_Allocation_t, u.ARFCN_index_list, ARFCN_index_list_t), -CSN_DESCR_END (GPRS_Mobile_Allocation_t) - -/*< SI 13 Rest Octets >*/ -static const -CSN_DESCR_BEGIN (Extension_Bits_t) - M_UINT_OFFSET (Extension_Bits_t, extension_length, 6, 1), - M_LEFT_VAR_BMP(Extension_Bits_t, Extension_Info, extension_length, 0), -CSN_DESCR_END (Extension_Bits_t) - -static const -CSN_DESCR_BEGIN(GPRS_Cell_Options_t) - M_UINT (GPRS_Cell_Options_t, NMO, 2), - M_UINT_OFFSET(GPRS_Cell_Options_t, T3168, 3, 1), - M_UINT_OFFSET(GPRS_Cell_Options_t, T3192, 3, 1), - M_UINT (GPRS_Cell_Options_t, DRX_TIMER_MAX, 3), - M_BIT (GPRS_Cell_Options_t, ACCESS_BURST_TYPE), - M_BIT (GPRS_Cell_Options_t, CONTROL_ACK_TYPE), - M_UINT (GPRS_Cell_Options_t, BS_CV_MAX, 4), - - M_NEXT_EXIST (GPRS_Cell_Options_t, Exist_PAN, 3), - M_UINT (GPRS_Cell_Options_t, PAN_DEC, 3), - M_UINT (GPRS_Cell_Options_t, PAN_INC, 3), - M_UINT (GPRS_Cell_Options_t, PAN_MAX, 3), - - M_NEXT_EXIST (GPRS_Cell_Options_t, Exist_Extension_Bits, 1), - M_TYPE (GPRS_Cell_Options_t, Extension_Bits, Extension_Bits_t), -CSN_DESCR_END (GPRS_Cell_Options_t) - -static const -CSN_DESCR_BEGIN(PBCCH_Not_present_t) - M_UINT (PBCCH_Not_present_t, RAC, 8), - M_BIT (PBCCH_Not_present_t, SPGC_CCCH_SUP), - M_UINT (PBCCH_Not_present_t, PRIORITY_ACCESS_THR, 3), - M_UINT (PBCCH_Not_present_t, NETWORK_CONTROL_ORDER, 2), - M_TYPE (PBCCH_Not_present_t, GPRS_Cell_Options, GPRS_Cell_Options_t), - M_TYPE (PBCCH_Not_present_t, GPRS_Power_Control_Parameters, GPRS_Power_Control_Parameters_t), -CSN_DESCR_END (PBCCH_Not_present_t) - -static const -CSN_ChoiceElement_t SI13_PBCCH_Description_Channel[] = -{/* this one is used in SI13*/ - {2, 0x00 , M_NULL(PBCCH_Description_t, u.dummy)},/*Default to BCCH carrier*/ - {2, 0x01 , M_UINT(PBCCH_Description_t, u.ARFCN, 10)}, - {1, 0x01 , M_UINT(PBCCH_Description_t, u.MAIO, 6)}, -}; - -static const -CSN_DESCR_BEGIN(PBCCH_Description_t)/*SI13*/ - M_UINT (PBCCH_Description_t, Pb, 4), - M_UINT (PBCCH_Description_t, TSC, 3), - M_UINT (PBCCH_Description_t, TN, 3), - - M_CHOICE (PBCCH_Description_t, UnionType, SI13_PBCCH_Description_Channel, ElementsOf(SI13_PBCCH_Description_Channel)), -CSN_DESCR_END (PBCCH_Description_t) - -static const -CSN_DESCR_BEGIN(PBCCH_present_t) - M_UINT (PBCCH_present_t, PSI1_REPEAT_PERIOD, 4), - M_TYPE (PBCCH_present_t, PBCCH_Description, PBCCH_Description_t), -CSN_DESCR_END (PBCCH_present_t) - -static const -CSN_DESCR_BEGIN(SI13_AdditionsR6) - M_NEXT_EXIST (SI13_AdditionsR6, Exist_LB_MS_TXPWR_MAX_CCH, 1), - M_UINT (SI13_AdditionsR6, LB_MS_TXPWR_MAX_CCH, 5), - M_UINT (SI13_AdditionsR6, SI2n_SUPPORT, 2), -CSN_DESCR_END (SI13_AdditionsR6) - -static const -CSN_DESCR_BEGIN(SI13_AdditionsR4) - M_UINT (SI13_AdditionsR4, SI_STATUS_IND, 1), - M_NEXT_EXIST_OR_NULL_LH (SI13_AdditionsR4, Exist_AdditionsR6, 1), - M_TYPE (SI13_AdditionsR4, AdditionsR6, SI13_AdditionsR6), -CSN_DESCR_END (SI13_AdditionsR4) - -static const -CSN_DESCR_BEGIN(SI13_AdditionR99) - M_UINT (SI13_AdditionR99, SGSNR, 1), - M_NEXT_EXIST_OR_NULL_LH (SI13_AdditionR99, Exist_AdditionsR4, 1), - M_TYPE (SI13_AdditionR99, AdditionsR4, SI13_AdditionsR4), -CSN_DESCR_END (SI13_AdditionR99) - -static const -CSN_DESCR_BEGIN (SI_13_t) - M_THIS_EXIST_LH (SI_13_t), - - M_UINT (SI_13_t, BCCH_CHANGE_MARK, 3), - M_UINT (SI_13_t, SI_CHANGE_FIELD, 4), - - M_NEXT_EXIST (SI_13_t, Exist_MA, 2), - M_UINT (SI_13_t, SI13_CHANGE_MARK, 2), - M_TYPE (SI_13_t, GPRS_Mobile_Allocation, GPRS_Mobile_Allocation_t), - - M_UNION (SI_13_t, 2), - M_TYPE (SI_13_t, u.PBCCH_Not_present, PBCCH_Not_present_t), - M_TYPE (SI_13_t, u.PBCCH_present, PBCCH_present_t), - - M_NEXT_EXIST_OR_NULL_LH(SI_13_t, Exist_AdditionsR99, 1), - M_TYPE (SI_13_t, AdditionsR99, SI13_AdditionR99), -CSN_DESCR_END (SI_13_t) - -/************************************************************/ -/* TS 44.060 messages */ -/************************************************************/ - -/*< Packet TBF Release message content >*/ -static const -CSN_DESCR_BEGIN(Packet_TBF_Release_t) - M_UINT (Packet_TBF_Release_t, MESSAGE_TYPE, 6), - M_UINT (Packet_TBF_Release_t, PAGE_MODE, 2), - M_FIXED (Packet_TBF_Release_t, 1, 0x00), - M_TYPE (Packet_TBF_Release_t, Global_TFI, Global_TFI_t), - M_BIT (Packet_TBF_Release_t, UPLINK_RELEASE), - M_BIT (Packet_TBF_Release_t, DOWNLINK_RELEASE), - M_UINT (Packet_TBF_Release_t, TBF_RELEASE_CAUSE, 4), -CSN_DESCR_END (Packet_TBF_Release_t) - -/*< Packet Control Acknowledgement message content >*/ - -static const -CSN_DESCR_BEGIN (Packet_Control_Acknowledgement_AdditionsR6_t) - M_NEXT_EXIST (Packet_Control_Acknowledgement_AdditionsR6_t, Exist_CTRL_ACK_Extension, 1), - M_UINT (Packet_Control_Acknowledgement_AdditionsR6_t, CTRL_ACK_Extension, 9), -CSN_DESCR_END (Packet_Control_Acknowledgement_AdditionsR6_t) - -static const -CSN_DESCR_BEGIN (Packet_Control_Acknowledgement_AdditionsR5_t) - M_NEXT_EXIST (Packet_Control_Acknowledgement_AdditionsR5_t, Exist_TN_RRBP, 1), - M_UINT (Packet_Control_Acknowledgement_AdditionsR5_t, TN_RRBP, 3), - M_NEXT_EXIST (Packet_Control_Acknowledgement_AdditionsR5_t, Exist_G_RNTI_Extension, 1), - M_UINT (Packet_Control_Acknowledgement_AdditionsR5_t, G_RNTI_Extension, 4), - - M_NEXT_EXIST_OR_NULL (Packet_Control_Acknowledgement_AdditionsR5_t, Exist_AdditionsR6, 1), - M_TYPE (Packet_Control_Acknowledgement_AdditionsR5_t, AdditionsR6, Packet_Control_Acknowledgement_AdditionsR6_t), -CSN_DESCR_END (Packet_Control_Acknowledgement_AdditionsR5_t) - -static const -CSN_DESCR_BEGIN (Packet_Control_Acknowledgement_t) - M_UINT (Packet_Control_Acknowledgement_t, PayloadType, 2), - M_UINT (Packet_Control_Acknowledgement_t, spare, 5), - M_BIT (Packet_Control_Acknowledgement_t, R), - - M_UINT (Packet_Control_Acknowledgement_t, MESSAGE_TYPE, 6), - M_UINT (Packet_Control_Acknowledgement_t, TLLI, 32), - M_UINT (Packet_Control_Acknowledgement_t, CTRL_ACK, 2), - M_NEXT_EXIST_OR_NULL (Packet_Control_Acknowledgement_t, Exist_AdditionsR5, 1), - M_TYPE (Packet_Control_Acknowledgement_t, AdditionsR5, Packet_Control_Acknowledgement_AdditionsR5_t), -CSN_DESCR_END (Packet_Control_Acknowledgement_t) - -/*< Packet Downlink Dummy Control Block message content >*/ -static const -CSN_DESCR_BEGIN(Packet_Downlink_Dummy_Control_Block_t) - M_UINT (Packet_Downlink_Dummy_Control_Block_t, MESSAGE_TYPE, 6), - M_UINT (Packet_Downlink_Dummy_Control_Block_t, PAGE_MODE, 2), - - M_NEXT_EXIST (Packet_Downlink_Dummy_Control_Block_t, Exist_PERSISTENCE_LEVEL, 1), - M_UINT_ARRAY (Packet_Downlink_Dummy_Control_Block_t, PERSISTENCE_LEVEL, 4, 4), -CSN_DESCR_END (Packet_Downlink_Dummy_Control_Block_t) - -/*< Packet Uplink Dummy Control Block message content >*/ -static const -CSN_DESCR_BEGIN(Packet_Uplink_Dummy_Control_Block_t) - M_UINT (Packet_Uplink_Dummy_Control_Block_t, PayloadType, 2), - M_UINT (Packet_Uplink_Dummy_Control_Block_t, spare, 5), - M_BIT (Packet_Uplink_Dummy_Control_Block_t, R), - - M_UINT (Packet_Uplink_Dummy_Control_Block_t, MESSAGE_TYPE, 6), - M_UINT (Packet_Uplink_Dummy_Control_Block_t, TLLI, 32), -/*M_FIXED (Packet_Uplink_Dummy_Control_Block_t, 1, 0),*/ -CSN_DESCR_END (Packet_Uplink_Dummy_Control_Block_t) - -static const -CSN_DESCR_BEGIN(Receive_N_PDU_Number_t) - M_UINT (Receive_N_PDU_Number_t, nsapi, 4), - M_UINT (Receive_N_PDU_Number_t, value, 8), -CSN_DESCR_END (Receive_N_PDU_Number_t) - -gint16 Receive_N_PDU_Number_list_Dissector(csnStream_t* ar, bitvec *vector, size_t& readIndex, void* data) -{ - if (ar->direction == 0) - { - return csnStreamEncoder(ar, CSNDESCR(Receive_N_PDU_Number_t), vector, readIndex, data); - } - else - { - return csnStreamDecoder(ar, CSNDESCR(Receive_N_PDU_Number_t), vector, readIndex, data); - } -} - -static const -CSN_DESCR_BEGIN(Receive_N_PDU_Number_list_t) - M_SERIALIZE (Receive_N_PDU_Number_list_t, IEI, Receive_N_PDU_Number_list_Dissector), - M_VAR_TARRAY (Receive_N_PDU_Number_list_t, Receive_N_PDU_Number, Receive_N_PDU_Number_t, Count_Receive_N_PDU_Number), -CSN_DESCR_END (Receive_N_PDU_Number_list_t) - -/*< MS Radio Access capability IE >*/ -static const -CSN_DESCR_BEGIN (DTM_EGPRS_t) - M_NEXT_EXIST (DTM_EGPRS_t, Exist_DTM_EGPRS_multislot_class, 1), - M_UINT (DTM_EGPRS_t, DTM_EGPRS_multislot_class, 2), -CSN_DESCR_END (DTM_EGPRS_t) - -static const -CSN_DESCR_BEGIN (DTM_EGPRS_HighMultislotClass_t) - M_NEXT_EXIST (DTM_EGPRS_HighMultislotClass_t, Exist_DTM_EGPRS_HighMultislotClass, 1), - M_UINT (DTM_EGPRS_HighMultislotClass_t, DTM_EGPRS_HighMultislotClass, 3), -CSN_DESCR_END (DTM_EGPRS_HighMultislotClass_t) - -static const -CSN_DESCR_BEGIN (Multislot_capability_t) - M_NEXT_EXIST (Multislot_capability_t, Exist_HSCSD_multislot_class, 1), - M_UINT (Multislot_capability_t, HSCSD_multislot_class, 5), - - M_NEXT_EXIST (Multislot_capability_t, Exist_GPRS_multislot_class, 2), - M_UINT (Multislot_capability_t, GPRS_multislot_class, 5), - M_UINT (Multislot_capability_t, GPRS_Extended_Dynamic_Allocation_Capability, 1), - - M_NEXT_EXIST (Multislot_capability_t, Exist_SM, 2), - M_UINT (Multislot_capability_t, SMS_VALUE, 4), - M_UINT (Multislot_capability_t, SM_VALUE, 4), - - M_NEXT_EXIST (Multislot_capability_t, Exist_ECSD_multislot_class, 1), - M_UINT (Multislot_capability_t, ECSD_multislot_class, 5), - - M_NEXT_EXIST (Multislot_capability_t, Exist_EGPRS_multislot_class, 2), - M_UINT (Multislot_capability_t, EGPRS_multislot_class, 5), - M_UINT (Multislot_capability_t, EGPRS_Extended_Dynamic_Allocation_Capability, 1), - - M_NEXT_EXIST (Multislot_capability_t, Exist_DTM_GPRS_multislot_class, 3), - M_UINT (Multislot_capability_t, DTM_GPRS_multislot_class, 2), - M_UINT (Multislot_capability_t, Single_Slot_DTM, 1), - M_TYPE (Multislot_capability_t, DTM_EGPRS_Params, DTM_EGPRS_t), -CSN_DESCR_END (Multislot_capability_t) - -static const -CSN_DESCR_BEGIN (Content_t) - M_UINT (Content_t, RF_Power_Capability, 3), - - M_NEXT_EXIST (Content_t, Exist_A5_bits, 1), - M_UINT (Content_t, A5_bits, 7), - - M_UINT (Content_t, ES_IND, 1), - M_UINT (Content_t, PS, 1), - M_UINT (Content_t, VGCS, 1), - M_UINT (Content_t, VBS, 1), - - M_NEXT_EXIST_OR_NULL(Content_t, Exist_Multislot_capability, 1), - M_TYPE (Content_t, Multislot_capability, Multislot_capability_t), - - M_NEXT_EXIST (Content_t, Exist_Eight_PSK_Power_Capability, 1), - M_UINT (Content_t, Eight_PSK_Power_Capability, 2), - - M_UINT (Content_t, COMPACT_Interference_Measurement_Capability, 1), - M_UINT (Content_t, Revision_Level_Indicator, 1), - M_UINT (Content_t, UMTS_FDD_Radio_Access_Technology_Capability, 1), - M_UINT (Content_t, UMTS_384_TDD_Radio_Access_Technology_Capability, 1), - M_UINT (Content_t, CDMA2000_Radio_Access_Technology_Capability, 1), - - M_UINT (Content_t, UMTS_128_TDD_Radio_Access_Technology_Capability, 1), - M_UINT (Content_t, GERAN_Feature_Package_1, 1), - - M_NEXT_EXIST (Content_t, Exist_Extended_DTM_multislot_class, 2), - M_UINT (Content_t, Extended_DTM_GPRS_multislot_class, 2), - M_UINT (Content_t, Extended_DTM_EGPRS_multislot_class, 2), - - M_UINT (Content_t, Modulation_based_multislot_class_support, 1), - - M_NEXT_EXIST (Content_t, Exist_HighMultislotCapability, 1), - M_UINT (Content_t, HighMultislotCapability, 2), - - M_NEXT_EXIST (Content_t, Exist_GERAN_lu_ModeCapability, 1), - M_UINT (Content_t, GERAN_lu_ModeCapability, 4), - - M_UINT (Content_t, GMSK_MultislotPowerProfile, 2), - M_UINT (Content_t, EightPSK_MultislotProfile, 2), - - M_UINT (Content_t, MultipleTBF_Capability, 1), - M_UINT (Content_t, DownlinkAdvancedReceiverPerformance, 2), - M_UINT (Content_t, ExtendedRLC_MAC_ControlMessageSegmentionsCapability, 1), - M_UINT (Content_t, DTM_EnhancementsCapability, 1), - - M_NEXT_EXIST (Content_t, Exist_DTM_GPRS_HighMultislotClass, 2), - M_UINT (Content_t, DTM_GPRS_HighMultislotClass, 3), - M_TYPE (Content_t, DTM_EGPRS_HighMultislotClass, DTM_EGPRS_HighMultislotClass_t), - - M_UINT (Content_t, PS_HandoverCapability, 1), -CSN_DESCR_END (Content_t) - -gint16 Content_Dissector(csnStream_t* ar, bitvec *vector, size_t& readIndex, void* data) -{ - if (ar->direction == 0) - { - return csnStreamEncoder(ar, CSNDESCR(Content_t), vector, readIndex, data); - } - else - { - return csnStreamDecoder(ar, CSNDESCR(Content_t), vector, readIndex, data); - } -} - -static const -CSN_DESCR_BEGIN (Additional_access_technologies_struct_t) - M_UINT (Additional_access_technologies_struct_t, Access_Technology_Type, 4), - M_UINT (Additional_access_technologies_struct_t, GMSK_Power_class, 3), - M_UINT (Additional_access_technologies_struct_t, Eight_PSK_Power_class, 2), -CSN_DESCR_END (Additional_access_technologies_struct_t) - -static const -CSN_DESCR_BEGIN (Additional_access_technologies_t) - M_REC_TARRAY (Additional_access_technologies_t, Additional_access_technologies[0], Additional_access_technologies_struct_t, Count_additional_access_technologies), -CSN_DESCR_END (Additional_access_technologies_t) - -gint16 Additional_access_technologies_Dissector(csnStream_t* ar, bitvec* vector, size_t& readIndex, void* data) -{ - if (ar->direction == 0) - { - return csnStreamEncoder(ar, CSNDESCR(Additional_access_technologies_t), vector, readIndex, data); - } - else - { - return csnStreamDecoder(ar, CSNDESCR(Additional_access_technologies_t), vector, readIndex, data); - } -} - -static const -CSN_ChoiceElement_t MS_RA_capability_value_Choice[] = -{ - {4, AccTech_GSMP, M_SERIALIZE (MS_RA_capability_value_t, u.Content, Content_Dissector)}, /* Long Form */ - {4, AccTech_GSME, M_SERIALIZE (MS_RA_capability_value_t, u.Content, Content_Dissector)}, /* Long Form */ - {4, AccTech_GSM1800, M_SERIALIZE (MS_RA_capability_value_t, u.Content, Content_Dissector)}, /* Long Form */ - {4, AccTech_GSM1900, M_SERIALIZE (MS_RA_capability_value_t, u.Content, Content_Dissector)}, /* Long Form */ - {4, AccTech_GSM850, M_SERIALIZE (MS_RA_capability_value_t, u.Content, Content_Dissector)}, /* Long Form */ - {4, AccTech_GSMOther, M_SERIALIZE (MS_RA_capability_value_t, u.Additional_access_technologies, Additional_access_technologies_Dissector)}, /* Short Form */ -}; - -static const -CSN_DESCR_BEGIN(MS_RA_capability_value_t) - M_CHOICE (MS_RA_capability_value_t, IndexOfAccTech, MS_RA_capability_value_Choice, ElementsOf(MS_RA_capability_value_Choice)), -CSN_DESCR_END (MS_RA_capability_value_t) - -static const -CSN_DESCR_BEGIN (MS_Radio_Access_capability_t) -/*Will be done in the main routines:*/ -/*M_UINT (MS_Radio_Access_capability_t, IEI, 8),*/ -/*M_UINT (MS_Radio_Access_capability_t, Length, 8),*/ - - M_REC_TARRAY_1(MS_Radio_Access_capability_t, MS_RA_capability_value[0], MS_RA_capability_value_t, Count_MS_RA_capability_value), -CSN_DESCR_END (MS_Radio_Access_capability_t) - -/*< MS Classmark 3 IE >*/ -static const -CSN_DESCR_BEGIN(ARC_t) - M_UINT (ARC_t, A5_Bits, 4), - M_UINT (ARC_t, Arc2_Spare, 4), - M_UINT (ARC_t, Arc1, 4), -CSN_DESCR_END (ARC_t) - -static const -CSN_ChoiceElement_t MultibandChoice[] = -{ - {3, 0x00, M_UINT(Multiband_t, u.A5_Bits, 4)}, - {3, 0x05, M_TYPE(Multiband_t, u.ARC, ARC_t)}, - {3, 0x06, M_TYPE(Multiband_t, u.ARC, ARC_t)}, - {3, 0x01, M_TYPE(Multiband_t, u.ARC, ARC_t)}, - {3, 0x02, M_TYPE(Multiband_t, u.ARC, ARC_t)}, - {3, 0x04, M_TYPE(Multiband_t, u.ARC, ARC_t)}, -}; - -static const -CSN_DESCR_BEGIN(Multiband_t) - M_CHOICE (Multiband_t, Multiband, MultibandChoice, ElementsOf(MultibandChoice)), -CSN_DESCR_END (Multiband_t) - -static const -CSN_DESCR_BEGIN(EDGE_RF_Pwr_t) - M_NEXT_EXIST (EDGE_RF_Pwr_t, ExistEDGE_RF_PwrCap1, 1), - M_UINT (EDGE_RF_Pwr_t, EDGE_RF_PwrCap1, 2), - - M_NEXT_EXIST (EDGE_RF_Pwr_t, ExistEDGE_RF_PwrCap2, 1), - M_UINT (EDGE_RF_Pwr_t, EDGE_RF_PwrCap2, 2), -CSN_DESCR_END (EDGE_RF_Pwr_t) - -static const -CSN_DESCR_BEGIN(MS_Class3_Unpacked_t) - M_UINT (MS_Class3_Unpacked_t, Spare1, 1), - M_TYPE (MS_Class3_Unpacked_t, Multiband, Multiband_t), - - M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_R_Support, 1), - M_UINT (MS_Class3_Unpacked_t, R_GSM_Arc, 3), - - M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_MultiSlotCapability, 1), - M_UINT (MS_Class3_Unpacked_t, MultiSlotClass, 5), - - M_UINT (MS_Class3_Unpacked_t, UCS2, 1), - M_UINT (MS_Class3_Unpacked_t, ExtendedMeasurementCapability, 1), - - M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_MS_MeasurementCapability, 2), - M_UINT (MS_Class3_Unpacked_t, SMS_VALUE, 4), - M_UINT (MS_Class3_Unpacked_t, SM_VALUE, 4), - - M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_MS_PositioningMethodCapability, 1), - M_UINT (MS_Class3_Unpacked_t, MS_PositioningMethod, 5), - - M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_EDGE_MultiSlotCapability, 1), - M_UINT (MS_Class3_Unpacked_t, EDGE_MultiSlotClass, 5), - - M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_EDGE_Struct, 2), - M_UINT (MS_Class3_Unpacked_t, ModulationCapability, 1), - M_TYPE (MS_Class3_Unpacked_t, EDGE_RF_PwrCaps, EDGE_RF_Pwr_t), - - M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_GSM400_Info, 2), - M_UINT (MS_Class3_Unpacked_t, GSM400_Bands, 2), - M_UINT (MS_Class3_Unpacked_t, GSM400_Arc, 4), - - M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_GSM850_Arc, 1), - M_UINT (MS_Class3_Unpacked_t, GSM850_Arc, 4), - - M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_PCS1900_Arc, 1), - M_UINT (MS_Class3_Unpacked_t, PCS1900_Arc, 4), - - M_UINT (MS_Class3_Unpacked_t, UMTS_FDD_Radio_Access_Technology_Capability, 1), - M_UINT (MS_Class3_Unpacked_t, UMTS_384_TDD_Radio_Access_Technology_Capability, 1), - M_UINT (MS_Class3_Unpacked_t, CDMA2000_Radio_Access_Technology_Capability, 1), - - M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_DTM_GPRS_multislot_class, 3), - M_UINT (MS_Class3_Unpacked_t, DTM_GPRS_multislot_class, 2), - M_UINT (MS_Class3_Unpacked_t, Single_Slot_DTM, 1), - M_TYPE (MS_Class3_Unpacked_t, DTM_EGPRS_Params, DTM_EGPRS_t), - - M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_SingleBandSupport, 1), - M_UINT (MS_Class3_Unpacked_t, GSM_Band, 4), - - M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_GSM_700_Associated_Radio_Capability, 1), - M_UINT (MS_Class3_Unpacked_t, GSM_700_Associated_Radio_Capability, 4), - - M_UINT (MS_Class3_Unpacked_t, UMTS_128_TDD_Radio_Access_Technology_Capability, 1), - M_UINT (MS_Class3_Unpacked_t, GERAN_Feature_Package_1, 1), - - M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_Extended_DTM_multislot_class, 2), - M_UINT (MS_Class3_Unpacked_t, Extended_DTM_GPRS_multislot_class, 2), - M_UINT (MS_Class3_Unpacked_t, Extended_DTM_EGPRS_multislot_class, 2), - - M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_HighMultislotCapability, 1), - M_UINT (MS_Class3_Unpacked_t, HighMultislotCapability, 2), - - M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_GERAN_lu_ModeCapability, 1), - M_UINT (MS_Class3_Unpacked_t, GERAN_lu_ModeCapability, 4), - - M_UINT (MS_Class3_Unpacked_t, GERAN_FeaturePackage_2, 1), - - M_UINT (MS_Class3_Unpacked_t, GMSK_MultislotPowerProfile, 2), - M_UINT (MS_Class3_Unpacked_t, EightPSK_MultislotProfile, 2), - - M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_TGSM_400_Bands, 2), - M_UINT (MS_Class3_Unpacked_t, TGSM_400_BandsSupported, 2), - M_UINT (MS_Class3_Unpacked_t, TGSM_400_AssociatedRadioCapability, 4), - - M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_TGSM_900_AssociatedRadioCapability, 1), - M_UINT (MS_Class3_Unpacked_t, TGSM_900_AssociatedRadioCapability, 4), - - M_UINT (MS_Class3_Unpacked_t, DownlinkAdvancedReceiverPerformance, 2), - M_UINT (MS_Class3_Unpacked_t, DTM_EnhancementsCapability, 1), - - M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_DTM_GPRS_HighMultislotClass, 3), - M_UINT (MS_Class3_Unpacked_t, DTM_GPRS_HighMultislotClass, 3), - M_UINT (MS_Class3_Unpacked_t, OffsetRequired, 1), - M_TYPE (MS_Class3_Unpacked_t, DTM_EGPRS_HighMultislotClass, DTM_EGPRS_HighMultislotClass_t), - - M_UINT (MS_Class3_Unpacked_t, RepeatedSACCH_Capability, 1), - M_UINT (MS_Class3_Unpacked_t, Spare2, 1), -CSN_DESCR_END (MS_Class3_Unpacked_t) - -static const -CSN_DESCR_BEGIN(Channel_Request_Description_t) - M_UINT (Channel_Request_Description_t, PEAK_THROUGHPUT_CLASS, 4), - M_UINT (Channel_Request_Description_t, RADIO_PRIORITY, 2), - M_BIT (Channel_Request_Description_t, RLC_MODE), - M_BIT (Channel_Request_Description_t, LLC_PDU_TYPE), - M_UINT (Channel_Request_Description_t, RLC_OCTET_COUNT, 16), -CSN_DESCR_END (Channel_Request_Description_t) - -/* < Packet Resource Request message content > */ -static const -CSN_ChoiceElement_t PacketResourceRequestID[] = -{ - {1, 0, M_TYPE(PacketResourceRequestID_t, u.Global_TFI, Global_TFI_t)}, - {1, 0x01, M_UINT(PacketResourceRequestID_t, u.TLLI, 32)}, -}; - -static const -CSN_DESCR_BEGIN(PacketResourceRequestID_t) - M_CHOICE (PacketResourceRequestID_t, UnionType, PacketResourceRequestID, ElementsOf(PacketResourceRequestID)), -CSN_DESCR_END (PacketResourceRequestID_t) - -static const -CSN_DESCR_BEGIN(BEP_MeasurementReport_t) - M_NEXT_EXIST (BEP_MeasurementReport_t, Exist, 3), - M_UNION (BEP_MeasurementReport_t, 2), - M_UINT (BEP_MeasurementReport_t, u.MEAN_BEP_GMSK, 4), - M_UINT (BEP_MeasurementReport_t, u.MEAN_BEP_8PSK, 4), -CSN_DESCR_END (BEP_MeasurementReport_t) - -static const -CSN_DESCR_BEGIN(InterferenceMeasurementReport_t) - M_NEXT_EXIST (InterferenceMeasurementReport_t, Exist, 1), - M_UINT (InterferenceMeasurementReport_t, I_LEVEL, 4), -CSN_DESCR_END (InterferenceMeasurementReport_t) - -static const -CSN_DESCR_BEGIN(EGPRS_TimeslotLinkQualityMeasurements_t) - M_NEXT_EXIST (EGPRS_TimeslotLinkQualityMeasurements_t, Exist_BEP_MEASUREMENTS, 1), - M_TYPE_ARRAY (EGPRS_TimeslotLinkQualityMeasurements_t, BEP_MEASUREMENTS, BEP_MeasurementReport_t, 8), - - M_NEXT_EXIST (EGPRS_TimeslotLinkQualityMeasurements_t, Exist_INTERFERENCE_MEASUREMENTS, 1), - M_TYPE_ARRAY (EGPRS_TimeslotLinkQualityMeasurements_t, INTERFERENCE_MEASUREMENTS, InterferenceMeasurementReport_t, 8), -CSN_DESCR_END (EGPRS_TimeslotLinkQualityMeasurements_t) - -static const -CSN_DESCR_BEGIN(EGPRS_BEP_LinkQualityMeasurements_t) - M_NEXT_EXIST (EGPRS_BEP_LinkQualityMeasurements_t, Exist_MEAN_CV_BEP_GMSK, 2), - M_UINT (EGPRS_BEP_LinkQualityMeasurements_t, MEAN_BEP_GMSK, 5), - M_UINT (EGPRS_BEP_LinkQualityMeasurements_t, CV_BEP_GMSK, 3), - - M_NEXT_EXIST (EGPRS_BEP_LinkQualityMeasurements_t, Exist_MEAN_CV_BEP_8PSK, 2), - M_UINT (EGPRS_BEP_LinkQualityMeasurements_t, MEAN_BEP_8PSK, 5), - M_UINT (EGPRS_BEP_LinkQualityMeasurements_t, CV_BEP_8PSK, 3), -CSN_DESCR_END (EGPRS_BEP_LinkQualityMeasurements_t) - -static const -CSN_DESCR_BEGIN(PRR_AdditionsR99_t) - M_NEXT_EXIST (PRR_AdditionsR99_t, Exist_EGPRS_BEP_LinkQualityMeasurements, 1), - M_TYPE (PRR_AdditionsR99_t, EGPRS_BEP_LinkQualityMeasurements, EGPRS_BEP_LinkQualityMeasurements_t), - - M_NEXT_EXIST (PRR_AdditionsR99_t, Exist_EGPRS_TimeslotLinkQualityMeasurements, 1), - M_TYPE (PRR_AdditionsR99_t, EGPRS_TimeslotLinkQualityMeasurements, EGPRS_TimeslotLinkQualityMeasurements_t), - - M_NEXT_EXIST (PRR_AdditionsR99_t, Exist_PFI, 1), - M_UINT (PRR_AdditionsR99_t, PFI, 7), - - M_UINT (PRR_AdditionsR99_t, MS_RAC_AdditionalInformationAvailable, 1), - M_UINT (PRR_AdditionsR99_t, RetransmissionOfPRR, 1), -CSN_DESCR_END (PRR_AdditionsR99_t) - -static const -CSN_DESCR_BEGIN (Packet_Resource_Request_t) - /* Mac header */ - M_UINT (Packet_Resource_Request_t, PayloadType, 2), - M_UINT (Packet_Resource_Request_t, spare, 5), - M_UINT (Packet_Resource_Request_t, R, 1), - M_UINT (Packet_Resource_Request_t, MESSAGE_TYPE, 6), - /* Mac header */ - - M_NEXT_EXIST (Packet_Resource_Request_t, Exist_ACCESS_TYPE, 1), - M_UINT (Packet_Resource_Request_t, ACCESS_TYPE, 2), - - M_TYPE (Packet_Resource_Request_t, ID, PacketResourceRequestID_t), - - M_NEXT_EXIST (Packet_Resource_Request_t, Exist_MS_Radio_Access_capability, 1), - M_TYPE (Packet_Resource_Request_t, MS_Radio_Access_capability, MS_Radio_Access_capability_t), - - M_TYPE (Packet_Resource_Request_t, Channel_Request_Description, Channel_Request_Description_t), - - M_NEXT_EXIST (Packet_Resource_Request_t, Exist_CHANGE_MARK, 1), - M_UINT (Packet_Resource_Request_t, CHANGE_MARK, 2), - - M_UINT (Packet_Resource_Request_t, C_VALUE, 6), - - M_NEXT_EXIST (Packet_Resource_Request_t, Exist_SIGN_VAR, 1), - M_UINT (Packet_Resource_Request_t, SIGN_VAR, 6), - - M_TYPE_ARRAY (Packet_Resource_Request_t, Slot, InterferenceMeasurementReport_t, 8), - - M_NEXT_EXIST_OR_NULL(Packet_Resource_Request_t, Exist_AdditionsR99, 1), - M_TYPE (Packet_Resource_Request_t, AdditionsR99, PRR_AdditionsR99_t), -CSN_DESCR_END (Packet_Resource_Request_t) - -/*< Packet Mobile TBF Status message content > */ -static const -CSN_DESCR_BEGIN(Packet_Mobile_TBF_Status_t) - /* Mac header */ - M_UINT (Packet_Mobile_TBF_Status_t, PayloadType, 2), - M_UINT (Packet_Mobile_TBF_Status_t, spare, 5), - M_UINT (Packet_Mobile_TBF_Status_t, R, 1), - M_UINT (Packet_Mobile_TBF_Status_t, MESSAGE_TYPE, 6), - /* Mac header */ - - M_TYPE (Packet_Mobile_TBF_Status_t, Global_TFI, Global_TFI_t), - M_UINT (Packet_Mobile_TBF_Status_t, TBF_CAUSE, 3), - - M_NEXT_EXIST (Packet_Mobile_TBF_Status_t, Exist_STATUS_MESSAGE_TYPE, 1), - M_UINT (Packet_Mobile_TBF_Status_t, STATUS_MESSAGE_TYPE, 6), -CSN_DESCR_END (Packet_Mobile_TBF_Status_t) - -/*< Packet PSI Status message content > */ -static const -CSN_DESCR_BEGIN(PSI_Message_t) - M_UINT (PSI_Message_t, PSI_MESSAGE_TYPE, 6), - M_UINT (PSI_Message_t, PSIX_CHANGE_MARK, 2), - M_NEXT_EXIST (PSI_Message_t, Exist_PSIX_COUNT_and_Instance_Bitmap, 2), - M_FIXED (PSI_Message_t, 4, 0), /* Placeholder for PSIX_COUNT (4 bits) */ - M_FIXED (PSI_Message_t, 1, 0), /* Placeholder for Instance bitmap (1 bit) */ -CSN_DESCR_END (PSI_Message_t) - -static const -CSN_DESCR_BEGIN(PSI_Message_List_t) - M_REC_TARRAY (PSI_Message_List_t, PSI_Message[0], PSI_Message_t, Count_PSI_Message), - M_FIXED (PSI_Message_List_t, 1, 0x00), - M_UINT (PSI_Message_List_t, ADDITIONAL_MSG_TYPE, 1), -CSN_DESCR_END (PSI_Message_List_t) - -static const -CSN_DESCR_BEGIN(Unknown_PSI_Message_List_t) - M_FIXED (Unknown_PSI_Message_List_t, 1, 0x00), - M_UINT (Unknown_PSI_Message_List_t, ADDITIONAL_MSG_TYPE, 1), -CSN_DESCR_END (Unknown_PSI_Message_List_t) - -static const -CSN_DESCR_BEGIN(Packet_PSI_Status_t) - /* Mac header */ - M_UINT (Packet_PSI_Status_t, PayloadType, 2), - M_UINT (Packet_PSI_Status_t, spare, 5), - M_UINT (Packet_PSI_Status_t, R, 1), - M_UINT (Packet_PSI_Status_t, MESSAGE_TYPE, 6), - /* Mac header */ - - M_TYPE (Packet_PSI_Status_t, Global_TFI, Global_TFI_t), - M_UINT (Packet_PSI_Status_t, PBCCH_CHANGE_MARK, 3), - M_TYPE (Packet_PSI_Status_t, PSI_Message_List, PSI_Message_List_t), - M_TYPE (Packet_PSI_Status_t, Unknown_PSI_Message_List, Unknown_PSI_Message_List_t), -CSN_DESCR_END (Packet_PSI_Status_t) - -/* < Packet SI Status message content > */ - -static const -CSN_DESCR_BEGIN(SI_Message_t) - M_UINT (SI_Message_t, SI_MESSAGE_TYPE, 8), - M_UINT (SI_Message_t, MESS_REC, 2), -CSN_DESCR_END (SI_Message_t) - -static const -CSN_DESCR_BEGIN(SI_Message_List_t) - M_REC_TARRAY (SI_Message_List_t, SI_Message[0], SI_Message_t, Count_SI_Message), - M_FIXED (SI_Message_List_t, 1, 0x00), - M_UINT (SI_Message_List_t, ADDITIONAL_MSG_TYPE, 1), -CSN_DESCR_END (SI_Message_List_t) - -static const -CSN_DESCR_BEGIN(Unknown_SI_Message_List_t) - M_FIXED (Unknown_SI_Message_List_t, 1, 0x00), - M_UINT (Unknown_SI_Message_List_t, ADDITIONAL_MSG_TYPE, 1), -CSN_DESCR_END (Unknown_SI_Message_List_t) - -static const -CSN_DESCR_BEGIN(Packet_SI_Status_t) - /* Mac header */ - M_UINT (Packet_SI_Status_t, PayloadType, 2), - M_UINT (Packet_SI_Status_t, spare, 5), - M_UINT (Packet_SI_Status_t, R, 1), - M_UINT (Packet_SI_Status_t, MESSAGE_TYPE, 6), - /* Mac header */ - - M_TYPE (Packet_SI_Status_t, Global_TFI, Global_TFI_t), - M_UINT (Packet_SI_Status_t, BCCH_CHANGE_MARK, 3), - M_TYPE (Packet_SI_Status_t, SI_Message_List, SI_Message_List_t), - M_TYPE (Packet_SI_Status_t, Unknown_SI_Message_List, Unknown_SI_Message_List_t), -CSN_DESCR_END (Packet_SI_Status_t) - -/* < Packet Downlink Ack/Nack message content > */ -static const -CSN_DESCR_BEGIN(PD_AckNack_AdditionsR99_t) - M_NEXT_EXIST (PD_AckNack_AdditionsR99_t, Exist_PFI, 1), - M_UINT (PD_AckNack_AdditionsR99_t, PFI, 7), -CSN_DESCR_END (PD_AckNack_AdditionsR99_t) - -static const -CSN_DESCR_BEGIN (Packet_Downlink_Ack_Nack_t) - M_UINT (Packet_Downlink_Ack_Nack_t, PayloadType, 2), - M_UINT (Packet_Downlink_Ack_Nack_t, spare, 5), - M_BIT (Packet_Downlink_Ack_Nack_t, R), - M_UINT (Packet_Downlink_Ack_Nack_t, MESSAGE_TYPE, 6), - M_UINT (Packet_Downlink_Ack_Nack_t, DOWNLINK_TFI, 5), - M_TYPE (Packet_Downlink_Ack_Nack_t, Ack_Nack_Description, Ack_Nack_Description_t), - - M_NEXT_EXIST (Packet_Downlink_Ack_Nack_t, Exist_Channel_Request_Description, 1), - M_TYPE (Packet_Downlink_Ack_Nack_t, Channel_Request_Description, Channel_Request_Description_t), - - M_TYPE (Packet_Downlink_Ack_Nack_t, Channel_Quality_Report, Channel_Quality_Report_t), - - M_NEXT_EXIST_OR_NULL(Packet_Downlink_Ack_Nack_t, Exist_AdditionsR99, 1), - M_TYPE (Packet_Downlink_Ack_Nack_t, AdditionsR99, PD_AckNack_AdditionsR99_t), -CSN_DESCR_END (Packet_Downlink_Ack_Nack_t) - - -/*< EGPRS Packet Downlink Ack/Nack message content > */ -static const -CSN_DESCR_BEGIN(EGPRS_ChannelQualityReport_t) - M_TYPE (EGPRS_ChannelQualityReport_t, EGPRS_BEP_LinkQualityMeasurements, EGPRS_BEP_LinkQualityMeasurements_t), - M_UINT (EGPRS_ChannelQualityReport_t, C_VALUE, 6), - M_TYPE (EGPRS_ChannelQualityReport_t, EGPRS_TimeslotLinkQualityMeasurements, EGPRS_TimeslotLinkQualityMeasurements_t), -CSN_DESCR_END (EGPRS_ChannelQualityReport_t) - -static const -CSN_DESCR_BEGIN(EGPRS_PD_AckNack_t) -/* M_CALLBACK (EGPRS_PD_AckNack_t, (void*)21, IsSupported, IsSupported), */ - M_UINT (EGPRS_PD_AckNack_t, PayloadType, 2), - M_UINT (EGPRS_PD_AckNack_t, spare, 5), - M_BIT (EGPRS_PD_AckNack_t, R), - - M_UINT (EGPRS_PD_AckNack_t, MESSAGE_TYPE, 6), - M_UINT (EGPRS_PD_AckNack_t, DOWNLINK_TFI, 5), - M_UINT (EGPRS_PD_AckNack_t, MS_OUT_OF_MEMORY, 1), - - M_NEXT_EXIST (EGPRS_PD_AckNack_t, Exist_EGPRS_ChannelQualityReport, 1), - M_TYPE (EGPRS_PD_AckNack_t, EGPRS_ChannelQualityReport, EGPRS_ChannelQualityReport_t), - - M_NEXT_EXIST (EGPRS_PD_AckNack_t, Exist_ChannelRequestDescription, 1), - M_TYPE (EGPRS_PD_AckNack_t, ChannelRequestDescription, Channel_Request_Description_t), - - M_NEXT_EXIST (EGPRS_PD_AckNack_t, Exist_PFI, 1), - M_UINT (EGPRS_PD_AckNack_t, PFI, 7), - - M_NEXT_EXIST (EGPRS_PD_AckNack_t, Exist_ExtensionBits, 1), - M_TYPE (EGPRS_PD_AckNack_t, ExtensionBits, Extension_Bits_t), - - M_TYPE (EGPRS_PD_AckNack_t, EGPRS_AckNack, EGPRS_AckNack_t), -/* M_CALLBACK (EGPRS_PD_AckNack_t, (void*)24, EGPRS_AckNack, EGPRS_AckNack), */ - M_LEFT_VAR_BMP (EGPRS_PD_AckNack_t, EGPRS_AckNack.URBB, EGPRS_AckNack.URBB_LENGTH, 0), - -CSN_DESCR_END (EGPRS_PD_AckNack_t) - -static const -CSN_DESCR_BEGIN(FDD_Target_Cell_t) - M_UINT (FDD_Target_Cell_t, FDD_ARFCN, 14), - M_UINT (FDD_Target_Cell_t, DIVERSITY, 1), - M_NEXT_EXIST (FDD_Target_Cell_t, Exist_Bandwith_FDD, 1), - M_UINT (FDD_Target_Cell_t, BANDWITH_FDD, 3), - M_UINT (FDD_Target_Cell_t, SCRAMBLING_CODE, 9), -CSN_DESCR_END (FDD_Target_Cell_t) - -static const -CSN_DESCR_BEGIN(TDD_Target_Cell_t) - M_UINT (TDD_Target_Cell_t, TDD_ARFCN, 14), - M_UINT (TDD_Target_Cell_t, DIVERSITY_TDD, 1), - M_NEXT_EXIST (TDD_Target_Cell_t, Exist_Bandwith_TDD, 1), - M_UINT (TDD_Target_Cell_t, BANDWITH_TDD, 3), - M_UINT (TDD_Target_Cell_t, CELL_PARAMETER, 7), - M_UINT (TDD_Target_Cell_t, Sync_Case_TSTD, 1), -CSN_DESCR_END (TDD_Target_Cell_t) - -static const -CSN_DESCR_BEGIN(EUTRAN_Target_Cell_t) - M_UINT (EUTRAN_Target_Cell_t, EARFCN, 16), - M_NEXT_EXIST (EUTRAN_Target_Cell_t, Exist_Measurement_Bandwidth, 1), - M_UINT (EUTRAN_Target_Cell_t, Measurement_Bandwidth, 3), - M_UINT (EUTRAN_Target_Cell_t, Physical_Layer_Cell_Identity, 9), -CSN_DESCR_END (EUTRAN_Target_Cell_t) - -static const -CSN_DESCR_BEGIN(UTRAN_CSG_Target_Cell_t) - M_UINT (UTRAN_CSG_Target_Cell_t, UTRAN_CI, 28), - M_NEXT_EXIST (UTRAN_CSG_Target_Cell_t, Exist_PLMN_ID, 1), - M_TYPE (UTRAN_CSG_Target_Cell_t, PLMN_ID, PLMN_t), -CSN_DESCR_END (UTRAN_CSG_Target_Cell_t) - -static const -CSN_DESCR_BEGIN(EUTRAN_CSG_Target_Cell_t) - M_UINT (EUTRAN_CSG_Target_Cell_t, EUTRAN_CI, 28), - M_UINT (EUTRAN_CSG_Target_Cell_t, Tracking_Area_Code, 16), - M_NEXT_EXIST (EUTRAN_CSG_Target_Cell_t, Exist_PLMN_ID, 1), - M_TYPE (EUTRAN_CSG_Target_Cell_t, PLMN_ID, PLMN_t), -CSN_DESCR_END (EUTRAN_CSG_Target_Cell_t) - -static const -CSN_DESCR_BEGIN(PCCF_AdditionsR9_t) - M_NEXT_EXIST (PCCF_AdditionsR9_t, Exist_UTRAN_CSG_Target_Cell, 1), - M_TYPE (PCCF_AdditionsR9_t, UTRAN_CSG_Target_Cell, UTRAN_CSG_Target_Cell_t), - M_NEXT_EXIST (PCCF_AdditionsR9_t, Exist_EUTRAN_CSG_Target_Cell, 1), - M_TYPE (PCCF_AdditionsR9_t, EUTRAN_CSG_Target_Cell, EUTRAN_CSG_Target_Cell_t), -CSN_DESCR_END (PCCF_AdditionsR9_t) - -static const -CSN_DESCR_BEGIN(PCCF_AdditionsR8_t) - M_NEXT_EXIST (PCCF_AdditionsR8_t, Exist_EUTRAN_Target_Cell, 1), - M_TYPE (PCCF_AdditionsR8_t, EUTRAN_Target_Cell, EUTRAN_Target_Cell_t), - M_NEXT_EXIST_OR_NULL(PCCF_AdditionsR8_t, Exist_AdditionsR9, 1), - M_TYPE (PCCF_AdditionsR8_t, AdditionsR9, PCCF_AdditionsR9_t), -CSN_DESCR_END (PCCF_AdditionsR8_t) - -static const -CSN_DESCR_BEGIN(PCCF_AdditionsR5_t) - M_NEXT_EXIST (PCCF_AdditionsR5_t, Exist_G_RNTI_extention, 1), - M_UINT (PCCF_AdditionsR5_t, G_RNTI_extention, 4), - M_NEXT_EXIST_OR_NULL(PCCF_AdditionsR5_t, Exist_AdditionsR8, 1), - M_TYPE (PCCF_AdditionsR5_t, AdditionsR8, PCCF_AdditionsR8_t), -CSN_DESCR_END (PCCF_AdditionsR5_t) - -static const -CSN_DESCR_BEGIN(PCCF_AdditionsR99_t) - M_NEXT_EXIST (PCCF_AdditionsR99_t, Exist_FDD_Description, 1), - M_TYPE (PCCF_AdditionsR99_t, FDD_Target_Cell, FDD_Target_Cell_t), - M_NEXT_EXIST (PCCF_AdditionsR99_t, Exist_TDD_Description, 1), - M_TYPE (PCCF_AdditionsR99_t, TDD_Target_Cell, TDD_Target_Cell_t), - M_NEXT_EXIST_OR_NULL(PCCF_AdditionsR99_t, Exist_AdditionsR5, 1), - M_TYPE (PCCF_AdditionsR99_t, AdditionsR5, PCCF_AdditionsR5_t), -CSN_DESCR_END (PCCF_AdditionsR99_t) - -/*< Packet Cell Change Failure message content > */ -static const -CSN_DESCR_BEGIN(Packet_Cell_Change_Failure_t) - /* Mac header */ - M_UINT (Packet_Cell_Change_Failure_t, PayloadType, 2), - M_UINT (Packet_Cell_Change_Failure_t, spare, 5), - M_UINT (Packet_Cell_Change_Failure_t, R, 1), - M_UINT (Packet_Cell_Change_Failure_t, MESSAGE_TYPE, 6), - /* Mac header */ - - M_UINT (Packet_Cell_Change_Failure_t, TLLI, 32), - M_UINT (Packet_Cell_Change_Failure_t, ARFCN, 10), - M_UINT (Packet_Cell_Change_Failure_t, BSIC, 6), - M_UINT (Packet_Cell_Change_Failure_t, CAUSE, 4), - - M_NEXT_EXIST_OR_NULL (Packet_Cell_Change_Failure_t, Exist_AdditionsR99, 1), - M_TYPE (Packet_Cell_Change_Failure_t, AdditionsR99, PCCF_AdditionsR99_t), -CSN_DESCR_END (Packet_Cell_Change_Failure_t) - -/*< Packet Uplink Ack/Nack message content > */ -static const -CSN_DESCR_BEGIN(Power_Control_Parameters_t) - M_UINT (Power_Control_Parameters_t, ALPHA, 4), - - M_NEXT_EXIST (Power_Control_Parameters_t, Slot[0].Exist, 1), - M_UINT (Power_Control_Parameters_t, Slot[0].GAMMA_TN, 5), - - M_NEXT_EXIST (Power_Control_Parameters_t, Slot[1].Exist, 1), - M_UINT (Power_Control_Parameters_t, Slot[1].GAMMA_TN, 5), - - M_NEXT_EXIST (Power_Control_Parameters_t, Slot[2].Exist, 1), - M_UINT (Power_Control_Parameters_t, Slot[2].GAMMA_TN, 5), - - M_NEXT_EXIST (Power_Control_Parameters_t, Slot[3].Exist, 1), - M_UINT (Power_Control_Parameters_t, Slot[3].GAMMA_TN, 5), - - M_NEXT_EXIST (Power_Control_Parameters_t, Slot[4].Exist, 1), - M_UINT (Power_Control_Parameters_t, Slot[4].GAMMA_TN, 5), - - M_NEXT_EXIST (Power_Control_Parameters_t, Slot[5].Exist, 1), - M_UINT (Power_Control_Parameters_t, Slot[5].GAMMA_TN, 5), - - M_NEXT_EXIST (Power_Control_Parameters_t, Slot[6].Exist, 1), - M_UINT (Power_Control_Parameters_t, Slot[6].GAMMA_TN, 5), - - M_NEXT_EXIST (Power_Control_Parameters_t, Slot[7].Exist, 1), - M_UINT (Power_Control_Parameters_t, Slot[7].GAMMA_TN, 5), -CSN_DESCR_END (Power_Control_Parameters_t) - -static const -CSN_DESCR_BEGIN(PU_AckNack_GPRS_AdditionsR99_t) - M_NEXT_EXIST (PU_AckNack_GPRS_AdditionsR99_t, Exist_PacketExtendedTimingAdvance, 1), - M_UINT (PU_AckNack_GPRS_AdditionsR99_t, PacketExtendedTimingAdvance, 2), - - M_UINT (PU_AckNack_GPRS_AdditionsR99_t, TBF_EST, 1), -CSN_DESCR_END (PU_AckNack_GPRS_AdditionsR99_t) - -static const -CSN_DESCR_BEGIN (PU_AckNack_GPRS_t) - M_UINT (PU_AckNack_GPRS_t, CHANNEL_CODING_COMMAND, 2), - M_TYPE (PU_AckNack_GPRS_t, Ack_Nack_Description, Ack_Nack_Description_t), - - M_NEXT_EXIST (PU_AckNack_GPRS_t, Common_Uplink_Ack_Nack_Data.Exist_CONTENTION_RESOLUTION_TLLI, 1), - M_UINT (PU_AckNack_GPRS_t, Common_Uplink_Ack_Nack_Data.CONTENTION_RESOLUTION_TLLI, 32), - - M_NEXT_EXIST (PU_AckNack_GPRS_t, Common_Uplink_Ack_Nack_Data.Exist_Packet_Timing_Advance, 1), - M_TYPE (PU_AckNack_GPRS_t, Common_Uplink_Ack_Nack_Data.Packet_Timing_Advance, Packet_Timing_Advance_t), - - M_NEXT_EXIST (PU_AckNack_GPRS_t, Common_Uplink_Ack_Nack_Data.Exist_Power_Control_Parameters, 1), - M_TYPE (PU_AckNack_GPRS_t, Common_Uplink_Ack_Nack_Data.Power_Control_Parameters, Power_Control_Parameters_t), - - M_NEXT_EXIST (PU_AckNack_GPRS_t, Common_Uplink_Ack_Nack_Data.Exist_Extension_Bits, 1), - M_TYPE (PU_AckNack_GPRS_t, Common_Uplink_Ack_Nack_Data.Extension_Bits, Extension_Bits_t), - - M_UNION (PU_AckNack_GPRS_t, 2), /* Fixed Allocation was removed */ - M_UINT (PU_AckNack_GPRS_t, u.FixedAllocationDummy, 1), - CSN_ERROR (PU_AckNack_GPRS_t, "01 ", CSN_ERROR_STREAM_NOT_SUPPORTED), - - M_NEXT_EXIST_OR_NULL(PU_AckNack_GPRS_t, Exist_AdditionsR99, 1), - M_TYPE (PU_AckNack_GPRS_t, AdditionsR99, PU_AckNack_GPRS_AdditionsR99_t), -CSN_DESCR_END (PU_AckNack_GPRS_t) - -static const -CSN_DESCR_BEGIN(PU_AckNack_EGPRS_00_t) - M_UINT (PU_AckNack_EGPRS_00_t, EGPRS_ChannelCodingCommand, 4), - M_UINT (PU_AckNack_EGPRS_00_t, RESEGMENT, 1), - M_UINT (PU_AckNack_EGPRS_00_t, PRE_EMPTIVE_TRANSMISSION, 1), - M_UINT (PU_AckNack_EGPRS_00_t, PRR_RETRANSMISSION_REQUEST, 1), - M_UINT (PU_AckNack_EGPRS_00_t, ARAC_RETRANSMISSION_REQUEST, 1), - - M_NEXT_EXIST (PU_AckNack_EGPRS_00_t, Common_Uplink_Ack_Nack_Data.Exist_CONTENTION_RESOLUTION_TLLI, 1), - M_UINT (PU_AckNack_EGPRS_00_t, Common_Uplink_Ack_Nack_Data.CONTENTION_RESOLUTION_TLLI, 32), - - M_UINT (PU_AckNack_EGPRS_00_t, TBF_EST, 1), - - M_NEXT_EXIST (PU_AckNack_EGPRS_00_t, Common_Uplink_Ack_Nack_Data.Exist_Packet_Timing_Advance, 1), - M_TYPE (PU_AckNack_EGPRS_00_t, Common_Uplink_Ack_Nack_Data.Packet_Timing_Advance, Packet_Timing_Advance_t), - - M_NEXT_EXIST (PU_AckNack_EGPRS_00_t, Exist_Packet_Extended_Timing_Advance, 1), - M_UINT (PU_AckNack_EGPRS_00_t, Packet_Extended_Timing_Advance, 2), - - M_NEXT_EXIST (PU_AckNack_EGPRS_00_t, Common_Uplink_Ack_Nack_Data.Exist_Power_Control_Parameters, 1), - M_TYPE (PU_AckNack_EGPRS_00_t, Common_Uplink_Ack_Nack_Data.Power_Control_Parameters, Power_Control_Parameters_t), - - M_NEXT_EXIST (PU_AckNack_EGPRS_00_t, Common_Uplink_Ack_Nack_Data.Exist_Extension_Bits, 1), - M_TYPE (PU_AckNack_EGPRS_00_t, Common_Uplink_Ack_Nack_Data.Extension_Bits, Extension_Bits_t), - - M_TYPE (PU_AckNack_EGPRS_00_t, EGPRS_AckNack, EGPRS_AckNack_t), -/* M_CALLBACK (PU_AckNack_EGPRS_00_t, (void*)24, EGPRS_AckNack, EGPRS_AckNack), */ - M_LEFT_VAR_BMP (PU_AckNack_EGPRS_00_t, EGPRS_AckNack.URBB, EGPRS_AckNack.URBB_LENGTH, 0), -CSN_DESCR_END (PU_AckNack_EGPRS_00_t) - -static const -CSN_DESCR_BEGIN(PU_AckNack_EGPRS_t) -/* M_CALLBACK (PU_AckNack_EGPRS_t, (void*)21, IsSupported, IsSupported), */ - M_UNION (PU_AckNack_EGPRS_t, 4), - M_TYPE (PU_AckNack_EGPRS_t, u.PU_AckNack_EGPRS_00, PU_AckNack_EGPRS_00_t), - CSN_ERROR (PU_AckNack_EGPRS_t, "01 ", CSN_ERROR_STREAM_NOT_SUPPORTED), - CSN_ERROR (PU_AckNack_EGPRS_t, "10 ", CSN_ERROR_STREAM_NOT_SUPPORTED), - CSN_ERROR (PU_AckNack_EGPRS_t, "11 ", CSN_ERROR_STREAM_NOT_SUPPORTED), -CSN_DESCR_END (PU_AckNack_EGPRS_t) - -static const -CSN_DESCR_BEGIN(Packet_Uplink_Ack_Nack_t) - M_UINT (Packet_Uplink_Ack_Nack_t, MESSAGE_TYPE, 6), - M_UINT (Packet_Uplink_Ack_Nack_t, PAGE_MODE, 2), - M_FIXED (Packet_Uplink_Ack_Nack_t, 2, 0x00), - M_UINT (Packet_Uplink_Ack_Nack_t, UPLINK_TFI, 5), - - M_UNION (Packet_Uplink_Ack_Nack_t, 2), - M_TYPE (Packet_Uplink_Ack_Nack_t, u.PU_AckNack_GPRS_Struct, PU_AckNack_GPRS_t), - M_TYPE (Packet_Uplink_Ack_Nack_t, u.PU_AckNack_EGPRS_Struct, PU_AckNack_EGPRS_t), -CSN_DESCR_END (Packet_Uplink_Ack_Nack_t) - -/*< Packet Uplink Assignment message content > */ -static const -CSN_DESCR_BEGIN(CHANGE_MARK_t) - M_UINT (CHANGE_MARK_t, CHANGE_MARK_1, 2), - - M_NEXT_EXIST (CHANGE_MARK_t, Exist_CHANGE_MARK_2, 1), - M_UINT (CHANGE_MARK_t, CHANGE_MARK_2, 2), -CSN_DESCR_END (CHANGE_MARK_t) - -static const -CSN_DESCR_BEGIN(Indirect_encoding_t) - M_UINT (Indirect_encoding_t, MAIO, 6), - M_UINT (Indirect_encoding_t, MA_NUMBER, 4), - - M_NEXT_EXIST (Indirect_encoding_t, Exist_CHANGE_MARK, 1), - M_TYPE (Indirect_encoding_t, CHANGE_MARK, CHANGE_MARK_t), -CSN_DESCR_END (Indirect_encoding_t) - -static const -CSN_DESCR_BEGIN(Direct_encoding_1_t) - M_UINT (Direct_encoding_1_t, MAIO, 6), - M_TYPE (Direct_encoding_1_t, GPRS_Mobile_Allocation, GPRS_Mobile_Allocation_t), -CSN_DESCR_END (Direct_encoding_1_t) - -static const -CSN_DESCR_BEGIN(Direct_encoding_2_t) - M_UINT (Direct_encoding_2_t, MAIO, 6), - M_UINT (Direct_encoding_2_t, HSN, 6), - M_UINT_OFFSET(Direct_encoding_2_t, Length_of_MA_Frequency_List, 4, 3), - M_VAR_ARRAY (Direct_encoding_2_t, MA_Frequency_List, Length_of_MA_Frequency_List, 0), -CSN_DESCR_END (Direct_encoding_2_t) - -static const -CSN_DESCR_BEGIN(Frequency_Parameters_t) - M_UINT (Frequency_Parameters_t, TSC, 3), - - M_UNION (Frequency_Parameters_t, 4), - M_UINT (Frequency_Parameters_t, u.ARFCN, 10), - M_TYPE (Frequency_Parameters_t, u.Indirect_encoding, Indirect_encoding_t), - M_TYPE (Frequency_Parameters_t, u.Direct_encoding_1, Direct_encoding_1_t), - M_TYPE (Frequency_Parameters_t, u.Direct_encoding_2, Direct_encoding_2_t), -CSN_DESCR_END (Frequency_Parameters_t) - -static const -CSN_DESCR_BEGIN(Packet_Request_Reference_t) - M_UINT (Packet_Request_Reference_t, RANDOM_ACCESS_INFORMATION, 11), - M_UINT_ARRAY (Packet_Request_Reference_t, FRAME_NUMBER, 8, 2), -CSN_DESCR_END (Packet_Request_Reference_t) - -static const -CSN_DESCR_BEGIN(Timeslot_Allocation_t) - M_NEXT_EXIST (Timeslot_Allocation_t, Exist, 1), - M_UINT (Timeslot_Allocation_t, USF_TN, 3), -CSN_DESCR_END (Timeslot_Allocation_t) - -static const -CSN_DESCR_BEGIN(Timeslot_Allocation_Power_Ctrl_Param_t) - M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, ALPHA, 4), - - M_NEXT_EXIST (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[0].Exist, 2), - M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[0].USF_TN, 3), - M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[0].GAMMA_TN, 5), - - M_NEXT_EXIST (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[1].Exist, 2), - M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[1].USF_TN, 3), - M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[1].GAMMA_TN, 5), - - M_NEXT_EXIST (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[2].Exist, 2), - M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[2].USF_TN, 3), - M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[2].GAMMA_TN, 5), - - M_NEXT_EXIST (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[3].Exist, 2), - M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[3].USF_TN, 3), - M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[3].GAMMA_TN, 5), - - M_NEXT_EXIST (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[4].Exist, 2), - M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[4].USF_TN, 3), - M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[4].GAMMA_TN, 5), - - M_NEXT_EXIST (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[5].Exist, 2), - M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[5].USF_TN, 3), - M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[5].GAMMA_TN, 5), - - M_NEXT_EXIST (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[6].Exist, 2), - M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[6].USF_TN, 3), - M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[6].GAMMA_TN, 5), - - M_NEXT_EXIST (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[7].Exist, 2), - M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[7].USF_TN, 3), - M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[7].GAMMA_TN, 5), -CSN_DESCR_END (Timeslot_Allocation_Power_Ctrl_Param_t) - -/* USED in */ -static const -CSN_DESCR_BEGIN(Dynamic_Allocation_t) - M_UINT (Dynamic_Allocation_t, Extended_Dynamic_Allocation, 1), - - M_NEXT_EXIST (Dynamic_Allocation_t, Exist_P0, 2), - M_UINT (Dynamic_Allocation_t, P0, 4), - M_UINT (Dynamic_Allocation_t, PR_MODE, 1), - - M_UINT (Dynamic_Allocation_t, USF_GRANULARITY, 1), - - M_NEXT_EXIST (Dynamic_Allocation_t, Exist_UPLINK_TFI_ASSIGNMENT, 1), - M_UINT (Dynamic_Allocation_t, UPLINK_TFI_ASSIGNMENT, 5), - - M_NEXT_EXIST (Dynamic_Allocation_t, Exist_RLC_DATA_BLOCKS_GRANTED, 1), - M_UINT (Dynamic_Allocation_t, RLC_DATA_BLOCKS_GRANTED, 8), - - M_NEXT_EXIST (Dynamic_Allocation_t, Exist_TBF_Starting_Time, 1), - M_TYPE (Dynamic_Allocation_t, TBF_Starting_Time, Starting_Frame_Number_t), - - M_UNION (Dynamic_Allocation_t, 2), - M_TYPE_ARRAY (Dynamic_Allocation_t, u.Timeslot_Allocation, Timeslot_Allocation_t, 8), - M_TYPE (Dynamic_Allocation_t, u.Timeslot_Allocation_Power_Ctrl_Param, Timeslot_Allocation_Power_Ctrl_Param_t), -CSN_DESCR_END (Dynamic_Allocation_t) - -static const -CSN_DESCR_BEGIN(Single_Block_Allocation_t) - M_UINT (Single_Block_Allocation_t, TIMESLOT_NUMBER, 3), - - M_NEXT_EXIST (Single_Block_Allocation_t, Exist_ALPHA_and_GAMMA_TN, 2), - M_UINT (Single_Block_Allocation_t, ALPHA, 4), - M_UINT (Single_Block_Allocation_t, GAMMA_TN, 5), - - M_NEXT_EXIST (Single_Block_Allocation_t, Exist_P0, 3), - M_UINT (Single_Block_Allocation_t, P0, 4), - M_UINT (Single_Block_Allocation_t, BTS_PWR_CTRL_MODE, 1), - M_UINT (Single_Block_Allocation_t, PR_MODE, 1), - - M_TYPE (Single_Block_Allocation_t, TBF_Starting_Time, Starting_Frame_Number_t), -CSN_DESCR_END (Single_Block_Allocation_t) - -static const -CSN_DESCR_BEGIN(DTM_Dynamic_Allocation_t) - M_UINT (DTM_Dynamic_Allocation_t, Extended_Dynamic_Allocation, 1), - - M_NEXT_EXIST (DTM_Dynamic_Allocation_t, Exist_P0, 2), - M_UINT (DTM_Dynamic_Allocation_t, P0, 4), - M_UINT (DTM_Dynamic_Allocation_t, PR_MODE, 1), - - M_UINT (DTM_Dynamic_Allocation_t, USF_GRANULARITY, 1), - - M_NEXT_EXIST (DTM_Dynamic_Allocation_t, Exist_UPLINK_TFI_ASSIGNMENT, 1), - M_UINT (DTM_Dynamic_Allocation_t, UPLINK_TFI_ASSIGNMENT, 5), - - M_NEXT_EXIST (DTM_Dynamic_Allocation_t, Exist_RLC_DATA_BLOCKS_GRANTED, 1), - M_UINT (DTM_Dynamic_Allocation_t, RLC_DATA_BLOCKS_GRANTED, 8), - - M_UNION (DTM_Dynamic_Allocation_t, 2), - M_TYPE_ARRAY (DTM_Dynamic_Allocation_t, u.Timeslot_Allocation, Timeslot_Allocation_t, 8), - M_TYPE (DTM_Dynamic_Allocation_t, u.Timeslot_Allocation_Power_Ctrl_Param, Timeslot_Allocation_Power_Ctrl_Param_t), -CSN_DESCR_END (DTM_Dynamic_Allocation_t) - -static const -CSN_DESCR_BEGIN(DTM_Single_Block_Allocation_t) - M_UINT (DTM_Single_Block_Allocation_t, TIMESLOT_NUMBER, 3), - - M_NEXT_EXIST (DTM_Single_Block_Allocation_t, Exist_ALPHA_and_GAMMA_TN, 2), - M_UINT (DTM_Single_Block_Allocation_t, ALPHA, 4), - M_UINT (DTM_Single_Block_Allocation_t, GAMMA_TN, 5), - - M_NEXT_EXIST (DTM_Single_Block_Allocation_t, Exist_P0, 3), - M_UINT (DTM_Single_Block_Allocation_t, P0, 4), - M_UINT (DTM_Single_Block_Allocation_t, BTS_PWR_CTRL_MODE, 1), - M_UINT (DTM_Single_Block_Allocation_t, PR_MODE, 1), -CSN_DESCR_END (DTM_Single_Block_Allocation_t) - - -/* Help structures */ -typedef struct -{ - Global_TFI_t Global_TFI; /* 0 < Global TFI : < Global TFI IE > > */ -} h0_Global_TFI_t; - -static const -CSN_DESCR_BEGIN(h0_Global_TFI_t) - M_FIXED (h0_Global_TFI_t, 1, 0x00), - M_TYPE (h0_Global_TFI_t, Global_TFI, Global_TFI_t), -CSN_DESCR_END (h0_Global_TFI_t) - -typedef struct -{ - guint32 TLLI;/* | 10 < TLLI : bit (32) >*/ -} h10_TLLI_t; - -static const -CSN_DESCR_BEGIN(h10_TLLI_t) - M_FIXED (h10_TLLI_t, 2, 0x02), - M_UINT (h10_TLLI_t, TLLI, 32), -CSN_DESCR_END (h10_TLLI_t) - -typedef struct -{ - guint16 TQI;/*| 110 < TQI : bit (16) > */ -} h110_TQI_t; - -static const -CSN_DESCR_BEGIN(h110_TQI_t) - M_FIXED (h110_TQI_t, 3, 0x06), - M_UINT (h110_TQI_t, TQI, 16), -CSN_DESCR_END (h110_TQI_t) - -typedef struct -{ - Packet_Request_Reference_t Packet_Request_Reference;/*| 111 < Packet Request Reference : < Packet Request Reference IE > > }*/ -} h111_Packet_Request_Reference_t; - -static const -CSN_DESCR_BEGIN(h111_Packet_Request_Reference_t) - M_FIXED (h111_Packet_Request_Reference_t, 3, 0x07), - M_TYPE (h111_Packet_Request_Reference_t, Packet_Request_Reference, Packet_Request_Reference_t), -CSN_DESCR_END (h111_Packet_Request_Reference_t) - -static const -CSN_ChoiceElement_t PacketUplinkID[] = -{ - {1, 0 , M_TYPE(PacketUplinkID_t, u.Global_TFI, Global_TFI_t)}, - {2, 0x02 , M_UINT(PacketUplinkID_t, u.TLLI, 32)}, - {3, 0x06 , M_UINT(PacketUplinkID_t, u.TQI, 16)}, - {3, 0x07 , M_TYPE(PacketUplinkID_t, u.Packet_Request_Reference, Packet_Request_Reference_t)}, -}; - -static const -CSN_DESCR_BEGIN(PacketUplinkID_t) - M_CHOICE (PacketUplinkID_t, UnionType, PacketUplinkID, ElementsOf(PacketUplinkID)), -CSN_DESCR_END (PacketUplinkID_t) - -static const -CSN_DESCR_BEGIN(PUA_GPRS_AdditionsR99_t) - M_NEXT_EXIST (PUA_GPRS_AdditionsR99_t, Exist_Packet_Extended_Timing_Advance, 1), - M_UINT (PUA_GPRS_AdditionsR99_t, Packet_Extended_Timing_Advance, 2), -CSN_DESCR_END (PUA_GPRS_AdditionsR99_t) - -static const -CSN_DESCR_BEGIN (PUA_GPRS_t) - M_UINT (PUA_GPRS_t, CHANNEL_CODING_COMMAND, 2), - M_BIT (PUA_GPRS_t, TLLI_BLOCK_CHANNEL_CODING), - M_TYPE (PUA_GPRS_t, Packet_Timing_Advance, Packet_Timing_Advance_t), - - M_NEXT_EXIST (PUA_GPRS_t, Exist_Frequency_Parameters, 1), - M_TYPE (PUA_GPRS_t, Frequency_Parameters, Frequency_Parameters_t), - - M_UNION (PUA_GPRS_t, 4), - CSN_ERROR (PUA_GPRS_t, "00 not implemented", CSN_ERROR_STREAM_NOT_SUPPORTED), - M_TYPE (PUA_GPRS_t, u.Dynamic_Allocation, Dynamic_Allocation_t), - M_TYPE (PUA_GPRS_t, u.Single_Block_Allocation, Single_Block_Allocation_t), - CSN_ERROR (PUA_GPRS_t, "11 not supported", CSN_ERROR_STREAM_NOT_SUPPORTED), - - M_NEXT_EXIST_OR_NULL(PUA_GPRS_t, Exist_AdditionsR99, 1), - M_TYPE (PUA_GPRS_t, AdditionsR99, PUA_GPRS_AdditionsR99_t), -CSN_DESCR_END (PUA_GPRS_t) - -static const -CSN_DESCR_BEGIN(COMPACT_ReducedMA_t) - M_UINT (COMPACT_ReducedMA_t, BitmapLength, 7), - M_VAR_BITMAP (COMPACT_ReducedMA_t, ReducedMA_Bitmap, BitmapLength, 0), - - M_NEXT_EXIST (COMPACT_ReducedMA_t, Exist_MAIO_2, 1), - M_UINT (COMPACT_ReducedMA_t, MAIO_2, 6), -CSN_DESCR_END (COMPACT_TeducedMA_t) - -static const -CSN_DESCR_BEGIN(MultiBlock_Allocation_t) - M_UINT (MultiBlock_Allocation_t, TIMESLOT_NUMBER, 3), - - M_NEXT_EXIST (MultiBlock_Allocation_t, Exist_ALPHA_GAMMA_TN, 2), - M_UINT (MultiBlock_Allocation_t, ALPHA, 4), - M_UINT (MultiBlock_Allocation_t, GAMMA_TN, 5), - - M_NEXT_EXIST (MultiBlock_Allocation_t, Exist_P0_BTS_PWR_CTRL_PR_MODE, 3), - M_UINT (MultiBlock_Allocation_t, P0, 4), - M_UINT (MultiBlock_Allocation_t, BTS_PWR_CTRL_MODE, 1), - M_UINT (MultiBlock_Allocation_t, PR_MODE, 1), - - M_TYPE (MultiBlock_Allocation_t, TBF_Starting_Time, Starting_Frame_Number_t), - M_UINT (MultiBlock_Allocation_t, NUMBER_OF_RADIO_BLOCKS_ALLOCATED, 2), -CSN_DESCR_END (MultiBlock_Allocation_t) - -static const -CSN_DESCR_BEGIN (PUA_EGPRS_00_t) - M_NEXT_EXIST (PUA_EGPRS_00_t, Exist_CONTENTION_RESOLUTION_TLLI, 1), - M_UINT (PUA_EGPRS_00_t, CONTENTION_RESOLUTION_TLLI, 32), - - M_NEXT_EXIST (PUA_EGPRS_00_t, Exist_COMPACT_ReducedMA, 1), - M_TYPE (PUA_EGPRS_00_t, COMPACT_ReducedMA, COMPACT_ReducedMA_t), - - M_UINT (PUA_EGPRS_00_t, EGPRS_CHANNEL_CODING_COMMAND, 4), - M_UINT (PUA_EGPRS_00_t, RESEGMENT, 1), - M_UINT (PUA_EGPRS_00_t, EGPRS_WindowSize, 5), - - M_REC_ARRAY (PUA_EGPRS_00_t, AccessTechnologyType, NrOfAccessTechnologies, 4), - - M_UINT (PUA_EGPRS_00_t, ARAC_RETRANSMISSION_REQUEST, 1), - M_UINT (PUA_EGPRS_00_t, TLLI_BLOCK_CHANNEL_CODING, 1), - - M_NEXT_EXIST (PUA_EGPRS_00_t, Exist_BEP_PERIOD2, 1), - M_UINT (PUA_EGPRS_00_t, BEP_PERIOD2, 4), - - M_TYPE (PUA_EGPRS_00_t, PacketTimingAdvance, Packet_Timing_Advance_t), - - M_NEXT_EXIST (PUA_EGPRS_00_t, Exist_Packet_Extended_Timing_Advance, 1), - M_UINT (PUA_EGPRS_00_t, Packet_Extended_Timing_Advance, 2), - - M_NEXT_EXIST (PUA_EGPRS_00_t, Exist_Frequency_Parameters, 1), - M_TYPE (PUA_EGPRS_00_t, Frequency_Parameters, Frequency_Parameters_t), - - M_UNION (PUA_EGPRS_00_t, 4), - CSN_ERROR (PUA_EGPRS_00_t, "00 ", CSN_ERROR_STREAM_NOT_SUPPORTED), - M_TYPE (PUA_EGPRS_00_t, u.Dynamic_Allocation, Dynamic_Allocation_t), - M_TYPE (PUA_EGPRS_00_t, u.MultiBlock_Allocation, MultiBlock_Allocation_t), - CSN_ERROR (PUA_EGPRS_00_t, "11 ", CSN_ERROR_STREAM_NOT_SUPPORTED), -CSN_DESCR_END (PUA_EGPRS_00_t) - -static const -CSN_DESCR_BEGIN(PUA_EGPRS_t) - M_UNION (PUA_EGPRS_t, 4), - M_TYPE (PUA_EGPRS_t, u.PUA_EGPRS_00, PUA_EGPRS_00_t), - CSN_ERROR (PUA_EGPRS_t, "01 ", CSN_ERROR_STREAM_NOT_SUPPORTED), - CSN_ERROR (PUA_EGPRS_t, "10 ", CSN_ERROR_STREAM_NOT_SUPPORTED), - CSN_ERROR (PUA_EGPRS_t, "11 ", CSN_ERROR_STREAM_NOT_SUPPORTED), -CSN_DESCR_END (PUA_EGPRS_t) - -static const -CSN_DESCR_BEGIN(Packet_Uplink_Assignment_t) - M_UINT (Packet_Uplink_Assignment_t, MESSAGE_TYPE, 6), - M_UINT (Packet_Uplink_Assignment_t, PAGE_MODE, 2), - - M_NEXT_EXIST (Packet_Uplink_Assignment_t, Exist_PERSISTENCE_LEVEL, 1), - M_UINT_ARRAY (Packet_Uplink_Assignment_t, PERSISTENCE_LEVEL, 4, 4), - - M_TYPE (Packet_Uplink_Assignment_t, ID, PacketUplinkID_t), - - M_UNION (Packet_Uplink_Assignment_t, 2), - M_TYPE (Packet_Uplink_Assignment_t, u.PUA_GPRS_Struct, PUA_GPRS_t), - M_TYPE (Packet_Uplink_Assignment_t, u.PUA_EGPRS_Struct, PUA_EGPRS_t), -CSN_DESCR_END (Packet_Uplink_Assignment_t) - -/*< Packet Downlink Assignment message content > */ -static const -CSN_DESCR_BEGIN(Measurement_Mapping_struct_t) - M_TYPE (Measurement_Mapping_struct_t, Measurement_Starting_Time, Starting_Frame_Number_t), - M_UINT (Measurement_Mapping_struct_t, MEASUREMENT_INTERVAL, 5), - M_UINT (Measurement_Mapping_struct_t, MEASUREMENT_BITMAP, 8), -CSN_DESCR_END (Measurement_Mapping_struct_t) - -static const -CSN_ChoiceElement_t PacketDownlinkID[] = -{ - {1, 0, M_TYPE(PacketDownlinkID_t, u.Global_TFI, Global_TFI_t)}, - {2, 0x02, M_UINT(PacketDownlinkID_t, u.TLLI, 32)}, -}; - -static const -CSN_DESCR_BEGIN(PacketDownlinkID_t) - M_CHOICE (PacketDownlinkID_t, UnionType, PacketDownlinkID, ElementsOf(PacketDownlinkID)), -CSN_DESCR_END (PacketDownlinkID_t) - -static const -CSN_DESCR_BEGIN(PDA_AdditionsR99_t) - M_NEXT_EXIST (PDA_AdditionsR99_t, Exist_EGPRS_Params, 4), /*if Exist_EGPRS_Params == FALSE then none of the following 4 vars exist */ - M_UINT (PDA_AdditionsR99_t, EGPRS_WindowSize, 5), - M_UINT (PDA_AdditionsR99_t, LINK_QUALITY_MEASUREMENT_MODE, 2), - M_NEXT_EXIST (PDA_AdditionsR99_t, Exist_BEP_PERIOD2, 1), - M_UINT (PDA_AdditionsR99_t, BEP_PERIOD2, 4), - - M_NEXT_EXIST (PDA_AdditionsR99_t, Exist_Packet_Extended_Timing_Advance, 1), - M_UINT (PDA_AdditionsR99_t, Packet_Extended_Timing_Advance, 2), - - M_NEXT_EXIST (PDA_AdditionsR99_t, Exist_COMPACT_ReducedMA, 1), - M_TYPE (PDA_AdditionsR99_t, COMPACT_ReducedMA, COMPACT_ReducedMA_t), -CSN_DESCR_END (PDA_AdditionsR99_t) - -static const -CSN_DESCR_BEGIN (Packet_Downlink_Assignment_t) - M_UINT (Packet_Downlink_Assignment_t, MESSAGE_TYPE, 6), - M_UINT (Packet_Downlink_Assignment_t, PAGE_MODE, 2), - - M_NEXT_EXIST (Packet_Downlink_Assignment_t, Exist_PERSISTENCE_LEVEL, 1), - M_UINT_ARRAY (Packet_Downlink_Assignment_t, PERSISTENCE_LEVEL, 4, 4), - - M_TYPE (Packet_Downlink_Assignment_t, ID, PacketDownlinkID_t), - - M_FIXED (Packet_Downlink_Assignment_t, 1, 0x00),/*-- Message escape */ - - M_UINT (Packet_Downlink_Assignment_t, MAC_MODE, 2), - M_BIT (Packet_Downlink_Assignment_t, RLC_MODE), - M_BIT (Packet_Downlink_Assignment_t, CONTROL_ACK), - M_UINT (Packet_Downlink_Assignment_t, TIMESLOT_ALLOCATION, 8), - M_TYPE (Packet_Downlink_Assignment_t, Packet_Timing_Advance, Packet_Timing_Advance_t), - - M_NEXT_EXIST (Packet_Downlink_Assignment_t, Exist_P0_and_BTS_PWR_CTRL_MODE, 3), - M_UINT (Packet_Downlink_Assignment_t, P0, 4), - M_BIT (Packet_Downlink_Assignment_t, BTS_PWR_CTRL_MODE), - M_UINT (Packet_Downlink_Assignment_t, PR_MODE, 1), - - M_NEXT_EXIST (Packet_Downlink_Assignment_t, Exist_Frequency_Parameters, 1), - M_TYPE (Packet_Downlink_Assignment_t, Frequency_Parameters, Frequency_Parameters_t), - - M_NEXT_EXIST (Packet_Downlink_Assignment_t, Exist_DOWNLINK_TFI_ASSIGNMENT, 1), - M_UINT (Packet_Downlink_Assignment_t, DOWNLINK_TFI_ASSIGNMENT, 5), - - M_NEXT_EXIST (Packet_Downlink_Assignment_t, Exist_Power_Control_Parameters, 1), - M_TYPE (Packet_Downlink_Assignment_t, Power_Control_Parameters, Power_Control_Parameters_t), - - M_NEXT_EXIST (Packet_Downlink_Assignment_t, Exist_TBF_Starting_Time, 1), - M_TYPE (Packet_Downlink_Assignment_t, TBF_Starting_Time, Starting_Frame_Number_t), - - M_NEXT_EXIST (Packet_Downlink_Assignment_t, Exist_Measurement_Mapping, 1), - M_TYPE (Packet_Downlink_Assignment_t, Measurement_Mapping, Measurement_Mapping_struct_t), - - M_NEXT_EXIST_OR_NULL(Packet_Downlink_Assignment_t, Exist_AdditionsR99, 1), - M_TYPE (Packet_Downlink_Assignment_t, AdditionsR99, PDA_AdditionsR99_t), -CSN_DESCR_END (Packet_Downlink_Assignment_t) - -typedef Packet_Downlink_Assignment_t pdlaCheck_t; - -static const -CSN_DESCR_BEGIN(pdlaCheck_t) - M_UINT (pdlaCheck_t, MESSAGE_TYPE, 6), - M_UINT (pdlaCheck_t, PAGE_MODE, 2), - - M_NEXT_EXIST (pdlaCheck_t, Exist_PERSISTENCE_LEVEL, 1), - M_UINT_ARRAY (pdlaCheck_t, PERSISTENCE_LEVEL, 4, 4), - - M_TYPE (pdlaCheck_t, ID, PacketDownlinkID_t), -CSN_DESCR_END (pdlaCheck_t) - -/* DTM Packet UL Assignment */ -static const -CSN_DESCR_BEGIN(DTM_Packet_Uplink_Assignment_t) - M_UINT (DTM_Packet_Uplink_Assignment_t, CHANNEL_CODING_COMMAND, 2), - M_BIT (DTM_Packet_Uplink_Assignment_t, TLLI_BLOCK_CHANNEL_CODING), - M_TYPE (DTM_Packet_Uplink_Assignment_t, Packet_Timing_Advance, Packet_Timing_Advance_t), - - M_UNION (DTM_Packet_Uplink_Assignment_t, 3), - CSN_ERROR (DTM_Packet_Uplink_Assignment_t, "Not Implemented", CSN_ERROR_STREAM_NOT_SUPPORTED), - M_TYPE (DTM_Packet_Uplink_Assignment_t, u.DTM_Dynamic_Allocation, DTM_Dynamic_Allocation_t), - M_TYPE (DTM_Packet_Uplink_Assignment_t, u.DTM_Single_Block_Allocation, DTM_Single_Block_Allocation_t), - M_NEXT_EXIST_OR_NULL (DTM_Packet_Uplink_Assignment_t, Exist_EGPRS_Parameters, 3), - M_UINT (DTM_Packet_Uplink_Assignment_t, EGPRS_CHANNEL_CODING_COMMAND, 4), - M_UINT (DTM_Packet_Uplink_Assignment_t, RESEGMENT, 1), - M_UINT (DTM_Packet_Uplink_Assignment_t, EGPRS_WindowSize, 5), - M_NEXT_EXIST (DTM_Packet_Uplink_Assignment_t, Exist_Packet_Extended_Timing_Advance, 1), - M_UINT (DTM_Packet_Uplink_Assignment_t, Packet_Extended_Timing_Advance, 2), -CSN_DESCR_END(DTM_Packet_Uplink_Assignment_t) - -static const -CSN_DESCR_BEGIN(DTM_UL_t) - M_TYPE (DTM_UL_t, DTM_Packet_Uplink_Assignment, DTM_Packet_Uplink_Assignment_t), -CSN_DESCR_END(DTM_UL_t) - -/* DTM Packet DL Assignment */ -static const -CSN_DESCR_BEGIN(DTM_Packet_Downlink_Assignment_t) - M_UINT (DTM_Packet_Downlink_Assignment_t, MAC_MODE, 2), - M_BIT (DTM_Packet_Downlink_Assignment_t, RLC_MODE), - M_UINT (DTM_Packet_Downlink_Assignment_t, TIMESLOT_ALLOCATION, 8), - M_TYPE (DTM_Packet_Downlink_Assignment_t, Packet_Timing_Advance, Packet_Timing_Advance_t), - - M_NEXT_EXIST (DTM_Packet_Downlink_Assignment_t, Exist_P0_and_BTS_PWR_CTRL_MODE, 3), - M_UINT (DTM_Packet_Downlink_Assignment_t, P0, 4), - M_BIT (DTM_Packet_Downlink_Assignment_t, BTS_PWR_CTRL_MODE), - M_UINT (DTM_Packet_Downlink_Assignment_t, PR_MODE, 1), - - M_NEXT_EXIST (DTM_Packet_Downlink_Assignment_t, Exist_Power_Control_Parameters, 1), - M_TYPE (DTM_Packet_Downlink_Assignment_t, Power_Control_Parameters, Power_Control_Parameters_t), - - M_NEXT_EXIST (DTM_Packet_Downlink_Assignment_t, Exist_DOWNLINK_TFI_ASSIGNMENT, 1), - M_UINT (DTM_Packet_Downlink_Assignment_t, DOWNLINK_TFI_ASSIGNMENT, 5), - - M_NEXT_EXIST (DTM_Packet_Downlink_Assignment_t, Exist_Measurement_Mapping, 1), - M_TYPE (DTM_Packet_Downlink_Assignment_t, Measurement_Mapping, Measurement_Mapping_struct_t), - M_NEXT_EXIST_OR_NULL (DTM_Packet_Downlink_Assignment_t, EGPRS_Mode, 2), - M_UINT (DTM_Packet_Downlink_Assignment_t, EGPRS_WindowSize, 5), - M_UINT (DTM_Packet_Downlink_Assignment_t, LINK_QUALITY_MEASUREMENT_MODE, 2), - M_NEXT_EXIST (DTM_Packet_Downlink_Assignment_t, Exist_Packet_Extended_Timing_Advance, 1), - M_UINT (DTM_Packet_Downlink_Assignment_t, Packet_Extended_Timing_Advance, 2), -CSN_DESCR_END(DTM_Packet_Downlink_Assignment_t) - -static const -CSN_DESCR_BEGIN(DTM_DL_t) - M_TYPE (DTM_DL_t, DTM_Packet_Downlink_Assignment, DTM_Packet_Downlink_Assignment_t), -CSN_DESCR_END(DTM_DL_t) - -/* GPRS Broadcast Information */ -static const -CSN_DESCR_BEGIN(DTM_GPRS_Broadcast_Information_t) - M_TYPE (DTM_GPRS_Broadcast_Information_t, GPRS_Cell_Options, GPRS_Cell_Options_t), - M_TYPE (DTM_GPRS_Broadcast_Information_t, GPRS_Power_Control_Parameters, GPRS_Power_Control_Parameters_t), -CSN_DESCR_END(DTM_GPRS_Broadcast_Information_t) - -static const -CSN_DESCR_BEGIN(DTM_GPRS_B_t) - M_TYPE (DTM_GPRS_B_t, DTM_GPRS_Broadcast_Information, DTM_GPRS_Broadcast_Information_t), -CSN_DESCR_END(DTM_GPRS_B_t) - -static const -CSN_DESCR_BEGIN(DTM_Channel_Request_Description_t) - M_UINT (DTM_Channel_Request_Description_t, DTM_Pkt_Est_Cause, 2), - M_TYPE (DTM_Channel_Request_Description_t, Channel_Request_Description, Channel_Request_Description_t), - M_NEXT_EXIST (DTM_Channel_Request_Description_t, Exist_PFI, 1), - M_UINT (DTM_Channel_Request_Description_t, PFI, 7), -CSN_DESCR_END(DTM_Channel_Request_Description_t) -/* DTM */ - -/*< Packet Paging Request message content > */ -typedef struct -{ - guint8 Length_of_Mobile_Identity_contents;/* bit (4) */ - guint8 Mobile_Identity[8];/* octet (val (Length of Mobile Identity contents)) */ -} Mobile_Identity_t; /* helper */ - -static const -CSN_DESCR_BEGIN(Mobile_Identity_t) - M_UINT (Mobile_Identity_t, Length_of_Mobile_Identity_contents, 4), - M_VAR_ARRAY (Mobile_Identity_t, Mobile_Identity, Length_of_Mobile_Identity_contents, 0), -CSN_DESCR_END (Mobile_Identity_t) - -static const -CSN_DESCR_BEGIN(Page_request_for_TBF_establishment_t) - M_UNION (Page_request_for_TBF_establishment_t, 2), - M_UINT_ARRAY (Page_request_for_TBF_establishment_t, u.PTMSI, 8, 4),/* bit (32) == 8*4 */ - M_TYPE (Page_request_for_TBF_establishment_t, u.Mobile_Identity, Mobile_Identity_t), -CSN_DESCR_END (Page_request_for_TBF_establishment_t) - -static const -CSN_DESCR_BEGIN(Page_request_for_RR_conn_t) - M_UNION (Page_request_for_RR_conn_t, 2), - M_UINT_ARRAY (Page_request_for_RR_conn_t, u.TMSI, 8, 4),/* bit (32) == 8*4 */ - M_TYPE (Page_request_for_RR_conn_t, u.Mobile_Identity, Mobile_Identity_t), - - M_UINT (Page_request_for_RR_conn_t, CHANNEL_NEEDED, 2), - - M_NEXT_EXIST (Page_request_for_RR_conn_t, Exist_eMLPP_PRIORITY, 1), - M_UINT (Page_request_for_RR_conn_t, eMLPP_PRIORITY, 3), -CSN_DESCR_END (Page_request_for_RR_conn_t) - -static const -CSN_DESCR_BEGIN(Repeated_Page_info_t) - M_UNION (Repeated_Page_info_t, 2), - M_TYPE (Repeated_Page_info_t, u.Page_req_TBF, Page_request_for_TBF_establishment_t), - M_TYPE (Repeated_Page_info_t, u.Page_req_RR, Page_request_for_RR_conn_t), -CSN_DESCR_END (Repeated_Page_info_t) - -static const -CSN_DESCR_BEGIN(Packet_Paging_Request_t) - M_UINT (Packet_Paging_Request_t, MESSAGE_TYPE, 6), - M_UINT (Packet_Paging_Request_t, PAGE_MODE, 2), - - M_NEXT_EXIST (Packet_Paging_Request_t, Exist_PERSISTENCE_LEVEL, 1), - M_UINT_ARRAY (Packet_Paging_Request_t, PERSISTENCE_LEVEL, 4, 4), /* 4bit*4 */ - - M_NEXT_EXIST (Packet_Paging_Request_t, Exist_NLN, 1), - M_UINT (Packet_Paging_Request_t, NLN, 2), - - M_REC_TARRAY (Packet_Paging_Request_t, Repeated_Page_info, Repeated_Page_info_t, Count_Repeated_Page_info), -CSN_DESCR_END (Packet_Paging_Request_t) - -static const -CSN_DESCR_BEGIN(Packet_PDCH_Release_t) - M_UINT (Packet_PDCH_Release_t, MESSAGE_TYPE, 6), - M_UINT (Packet_PDCH_Release_t, PAGE_MODE, 2), - - M_FIXED (Packet_PDCH_Release_t, 1, 0x01), - M_UINT (Packet_PDCH_Release_t, TIMESLOTS_AVAILABLE, 8), -CSN_DESCR_END (Packet_PDCH_Release_t) - -/*< Packet Power Control/Timing Advance message content >*/ -static const -CSN_DESCR_BEGIN(GlobalTimingAndPower_t) - M_TYPE (GlobalTimingAndPower_t, Global_Packet_Timing_Advance, Global_Packet_Timing_Advance_t), - M_TYPE (GlobalTimingAndPower_t, Power_Control_Parameters, Power_Control_Parameters_t), -CSN_DESCR_END (GlobalTimingAndPower_t) - -static const -CSN_DESCR_BEGIN(GlobalTimingOrPower_t) - M_UNION (GlobalTimingOrPower_t, 2), - M_TYPE (GlobalTimingOrPower_t, u.Global_Packet_Timing_Advance, Global_Packet_Timing_Advance_t), - M_TYPE (GlobalTimingOrPower_t, u.Power_Control_Parameters, Power_Control_Parameters_t), -CSN_DESCR_END (GlobalTimingOrPower_t) - -static const -CSN_ChoiceElement_t PacketPowerControlTimingAdvanceID[] = -{ - {1, 0, M_TYPE(PacketPowerControlTimingAdvanceID_t, u.Global_TFI, Global_TFI_t)}, - {3, 0x06, M_UINT(PacketPowerControlTimingAdvanceID_t, u.TQI, 16)}, - {3, 0x07, M_TYPE(PacketPowerControlTimingAdvanceID_t, u.Packet_Request_Reference, Packet_Request_Reference_t)}, -}; - -static const -CSN_DESCR_BEGIN(PacketPowerControlTimingAdvanceID_t) - M_CHOICE (PacketPowerControlTimingAdvanceID_t, UnionType, PacketPowerControlTimingAdvanceID, ElementsOf(PacketPowerControlTimingAdvanceID)), -CSN_DESCR_END (PacketPowerControlTimingAdvanceID_t) - -static const -CSN_DESCR_BEGIN(Packet_Power_Control_Timing_Advance_t) - M_UINT (Packet_Power_Control_Timing_Advance_t, MESSAGE_TYPE, 6), - M_UINT (Packet_Power_Control_Timing_Advance_t, PAGE_MODE, 2), - - M_TYPE (Packet_Power_Control_Timing_Advance_t, ID, PacketPowerControlTimingAdvanceID_t), - - /*-- Message escape*/ - M_FIXED (Packet_Power_Control_Timing_Advance_t, 1, 0x00), - - M_NEXT_EXIST (Packet_Power_Control_Timing_Advance_t, Exist_Global_Power_Control_Parameters, 1), - M_TYPE (Packet_Power_Control_Timing_Advance_t, Global_Power_Control_Parameters, Global_Power_Control_Parameters_t), - - M_UNION (Packet_Power_Control_Timing_Advance_t, 2), - M_TYPE (Packet_Power_Control_Timing_Advance_t, u.GlobalTimingAndPower, GlobalTimingAndPower_t), - M_TYPE (Packet_Power_Control_Timing_Advance_t, u.GlobalTimingOrPower, GlobalTimingOrPower_t), -CSN_DESCR_END (Packet_Power_Control_Timing_Advance_t) - -/*< Packet Queueing Notification message content > */ -static const -CSN_DESCR_BEGIN(Packet_Queueing_Notification_t) - M_UINT (Packet_Queueing_Notification_t, MESSAGE_TYPE, 6), - M_UINT (Packet_Queueing_Notification_t, PAGE_MODE, 2), - - M_FIXED (Packet_Queueing_Notification_t, 3, 0x07),/* 111 Fixed */ - M_TYPE (Packet_Queueing_Notification_t, Packet_Request_Reference, Packet_Request_Reference_t), - - M_UINT (Packet_Queueing_Notification_t, TQI, 16), -CSN_DESCR_END (Packet_Queueing_Notification_t) - -/* USED in Packet Timeslot Reconfigure message content - * This is almost the same structure as used in - * but UPLINK_TFI_ASSIGNMENT is removed. - */ -static const -CSN_DESCR_BEGIN(TRDynamic_Allocation_t) - M_UINT (TRDynamic_Allocation_t, Extended_Dynamic_Allocation, 1), - - M_NEXT_EXIST (TRDynamic_Allocation_t, Exist_P0, 2), - M_UINT (TRDynamic_Allocation_t, P0, 4), - M_UINT (TRDynamic_Allocation_t, PR_MODE, 1), - - M_UINT (TRDynamic_Allocation_t, USF_GRANULARITY, 1), - - M_NEXT_EXIST (TRDynamic_Allocation_t, Exist_RLC_DATA_BLOCKS_GRANTED, 1), - M_UINT (TRDynamic_Allocation_t, RLC_DATA_BLOCKS_GRANTED, 8), - - M_NEXT_EXIST (TRDynamic_Allocation_t, Exist_TBF_Starting_Time, 1), - M_TYPE (TRDynamic_Allocation_t, TBF_Starting_Time, Starting_Frame_Number_t), - - M_UNION (TRDynamic_Allocation_t, 2), - M_TYPE_ARRAY (TRDynamic_Allocation_t, u.Timeslot_Allocation, Timeslot_Allocation_t, 8), - M_TYPE (TRDynamic_Allocation_t, u.Timeslot_Allocation_Power_Ctrl_Param, Timeslot_Allocation_Power_Ctrl_Param_t), -CSN_DESCR_END (TRDynamic_Allocation_t) - -/*< Packet Timeslot Reconfigure message content > */ -static const -CSN_DESCR_BEGIN(PTR_GPRS_AdditionsR99_t) - M_NEXT_EXIST (PTR_GPRS_AdditionsR99_t, Exist_Packet_Extended_Timing_Advance, 1), - M_UINT (PTR_GPRS_AdditionsR99_t, Packet_Extended_Timing_Advance, 2), -CSN_DESCR_END (PTR_GPRS_AdditionsR99_t) - -static const -CSN_DESCR_BEGIN (PTR_GPRS_t) - M_UINT (PTR_GPRS_t, CHANNEL_CODING_COMMAND, 2), - M_TYPE (PTR_GPRS_t, Common_Timeslot_Reconfigure_Data.Global_Packet_Timing_Advance, Global_Packet_Timing_Advance_t), - M_UINT (PTR_GPRS_t, Common_Timeslot_Reconfigure_Data.DOWNLINK_RLC_MODE, 1), - M_UINT (PTR_GPRS_t, Common_Timeslot_Reconfigure_Data.CONTROL_ACK, 1), - - M_NEXT_EXIST (PTR_GPRS_t, Common_Timeslot_Reconfigure_Data.Exist_DOWNLINK_TFI_ASSIGNMENT, 1), - M_UINT (PTR_GPRS_t, Common_Timeslot_Reconfigure_Data.DOWNLINK_TFI_ASSIGNMENT, 5), - - M_NEXT_EXIST (PTR_GPRS_t, Common_Timeslot_Reconfigure_Data.Exist_UPLINK_TFI_ASSIGNMENT, 1), - M_UINT (PTR_GPRS_t, Common_Timeslot_Reconfigure_Data.UPLINK_TFI_ASSIGNMENT, 5), - - M_UINT (PTR_GPRS_t, Common_Timeslot_Reconfigure_Data.DOWNLINK_TIMESLOT_ALLOCATION, 8), - - M_NEXT_EXIST (PTR_GPRS_t, Common_Timeslot_Reconfigure_Data.Exist_Frequency_Parameters, 1), - M_TYPE (PTR_GPRS_t, Common_Timeslot_Reconfigure_Data.Frequency_Parameters, Frequency_Parameters_t), - - M_UNION (PTR_GPRS_t, 2), - M_TYPE (PTR_GPRS_t, u.Dynamic_Allocation, TRDynamic_Allocation_t), - CSN_ERROR (PTR_GPRS_t, "1 - Fixed Allocation was removed", CSN_ERROR_STREAM_NOT_SUPPORTED), - - M_NEXT_EXIST_OR_NULL(PTR_GPRS_t, Exist_AdditionsR99, 1), - M_TYPE (PTR_GPRS_t, AdditionsR99, PTR_GPRS_AdditionsR99_t), -CSN_DESCR_END (PTR_GPRS_t) - -static const -CSN_DESCR_BEGIN(PTR_EGPRS_00_t) - M_NEXT_EXIST (PTR_EGPRS_00_t, Exist_COMPACT_ReducedMA, 1), - M_TYPE (PTR_EGPRS_00_t, COMPACT_ReducedMA, COMPACT_ReducedMA_t), - - M_UINT (PTR_EGPRS_00_t, EGPRS_ChannelCodingCommand, 4), - M_UINT (PTR_EGPRS_00_t, RESEGMENT, 1), - - M_NEXT_EXIST (PTR_EGPRS_00_t, Exist_DOWNLINK_EGPRS_WindowSize, 1), - M_UINT (PTR_EGPRS_00_t, DOWNLINK_EGPRS_WindowSize, 5), - - M_NEXT_EXIST (PTR_EGPRS_00_t, Exist_UPLINK_EGPRS_WindowSize, 1), - M_UINT (PTR_EGPRS_00_t, UPLINK_EGPRS_WindowSize, 5), - - M_UINT (PTR_EGPRS_00_t, LINK_QUALITY_MEASUREMENT_MODE, 2), - - M_TYPE (PTR_EGPRS_00_t, Common_Timeslot_Reconfigure_Data.Global_Packet_Timing_Advance, Global_Packet_Timing_Advance_t), - - M_NEXT_EXIST (PTR_EGPRS_00_t, Exist_Packet_Extended_Timing_Advance, 1), - M_UINT (PTR_EGPRS_00_t, Packet_Extended_Timing_Advance, 2), - - M_UINT (PTR_EGPRS_00_t, Common_Timeslot_Reconfigure_Data.DOWNLINK_RLC_MODE, 1), - M_UINT (PTR_EGPRS_00_t, Common_Timeslot_Reconfigure_Data.CONTROL_ACK, 1), - - M_NEXT_EXIST (PTR_EGPRS_00_t, Common_Timeslot_Reconfigure_Data.Exist_DOWNLINK_TFI_ASSIGNMENT, 1), - M_UINT (PTR_EGPRS_00_t, Common_Timeslot_Reconfigure_Data.DOWNLINK_TFI_ASSIGNMENT, 5), - - M_NEXT_EXIST (PTR_EGPRS_00_t, Common_Timeslot_Reconfigure_Data.Exist_UPLINK_TFI_ASSIGNMENT, 1), - M_UINT (PTR_EGPRS_00_t, Common_Timeslot_Reconfigure_Data.UPLINK_TFI_ASSIGNMENT, 5), - - M_UINT (PTR_EGPRS_00_t, Common_Timeslot_Reconfigure_Data.DOWNLINK_TIMESLOT_ALLOCATION, 8), - - M_NEXT_EXIST (PTR_EGPRS_00_t, Common_Timeslot_Reconfigure_Data.Exist_Frequency_Parameters, 1), - M_TYPE (PTR_EGPRS_00_t, Common_Timeslot_Reconfigure_Data.Frequency_Parameters, Frequency_Parameters_t), - - M_UNION (PTR_EGPRS_00_t, 2), - M_TYPE (PTR_EGPRS_00_t, u.Dynamic_Allocation, TRDynamic_Allocation_t), - CSN_ERROR (PTR_EGPRS_00_t, "1 ", CSN_ERROR_STREAM_NOT_SUPPORTED), -CSN_DESCR_END (PTR_EGPRS_00_t) - -static const -CSN_DESCR_BEGIN(PTR_EGPRS_t) - M_UNION (PTR_EGPRS_t, 4), - M_TYPE (PTR_EGPRS_t, u.PTR_EGPRS_00, PTR_EGPRS_00_t), - CSN_ERROR (PTR_EGPRS_t, "01 ", CSN_ERROR_STREAM_NOT_SUPPORTED), - CSN_ERROR (PTR_EGPRS_t, "10 ", CSN_ERROR_STREAM_NOT_SUPPORTED), - CSN_ERROR (PTR_EGPRS_t, "11 ", CSN_ERROR_STREAM_NOT_SUPPORTED), -CSN_DESCR_END (PTR_EGPRS_t) - -static const -CSN_DESCR_BEGIN(Packet_Timeslot_Reconfigure_t) - M_UINT (Packet_Timeslot_Reconfigure_t, MESSAGE_TYPE, 6), - M_UINT (Packet_Timeslot_Reconfigure_t, PAGE_MODE, 2), - - M_FIXED (Packet_Timeslot_Reconfigure_t, 1, 0x00), - M_TYPE (Packet_Timeslot_Reconfigure_t, Global_TFI, Global_TFI_t), - - M_UNION (Packet_Timeslot_Reconfigure_t, 2), - M_TYPE (Packet_Timeslot_Reconfigure_t, u.PTR_GPRS_Struct, PTR_GPRS_t), - M_TYPE (Packet_Timeslot_Reconfigure_t, u.PTR_EGPRS_Struct, PTR_EGPRS_t), -CSN_DESCR_END (Packet_Timeslot_Reconfigure_t) - -typedef Packet_Timeslot_Reconfigure_t PTRCheck_t; - -static const -CSN_DESCR_BEGIN(PTRCheck_t) - M_UINT (PTRCheck_t, MESSAGE_TYPE, 6), - M_UINT (PTRCheck_t, PAGE_MODE, 2), - M_FIXED (PTRCheck_t, 1, 0x00),/* 0 fixed */ - M_TYPE (PTRCheck_t, Global_TFI, Global_TFI_t), -CSN_DESCR_END (PTRCheck_t) - -/*< Packet PRACH Parameters message content > */ -static const -CSN_DESCR_BEGIN(PRACH_Control_t) - M_UINT_ARRAY (PRACH_Control_t, ACC_CONTR_CLASS, 8, 2), /* bit (16) == 8bit*2 */ - M_UINT_ARRAY (PRACH_Control_t, MAX_RETRANS, 2, 4), /* bit (2) * 4 */ - M_UINT (PRACH_Control_t, S, 4), - M_UINT (PRACH_Control_t, TX_INT, 4), - M_NEXT_EXIST (PRACH_Control_t, Exist_PERSISTENCE_LEVEL, 1), - M_UINT_ARRAY (PRACH_Control_t, PERSISTENCE_LEVEL, 4, 4), -CSN_DESCR_END (PRACH_Control_t) - -static const -CSN_DESCR_BEGIN(Cell_Allocation_t) - M_REC_ARRAY (Cell_Allocation_t, RFL_Number, NoOfRFLs, 4), -CSN_DESCR_END (Cell_Allocation_t) - -static const -CSN_DESCR_BEGIN(HCS_t) - M_UINT (HCS_t, PRIORITY_CLASS, 3), - M_UINT (HCS_t, HCS_THR, 5), -CSN_DESCR_END (HCS_t) - -static const -CSN_DESCR_BEGIN(Location_Repeat_t) - M_UINT (Location_Repeat_t, PBCCH_LOCATION, 2), - M_UINT (Location_Repeat_t, PSI1_REPEAT_PERIOD, 4), -CSN_DESCR_END (Location_Repeat_t) - -static const -CSN_DESCR_BEGIN(SI13_PBCCH_Location_t) - M_UNION (SI13_PBCCH_Location_t, 2), - M_UINT (SI13_PBCCH_Location_t, u.SI13_LOCATION, 1), - M_TYPE (SI13_PBCCH_Location_t, u.lr, Location_Repeat_t), -CSN_DESCR_END (SI13_PBCCH_Location_t) - -static const -CSN_DESCR_BEGIN(Cell_Selection_t) - M_UINT (Cell_Selection_t, BSIC, 6), - M_UINT (Cell_Selection_t, CELL_BAR_ACCESS_2, 1), - M_UINT (Cell_Selection_t, EXC_ACC, 1), - M_UINT (Cell_Selection_t, SAME_RA_AS_SERVING_CELL, 1), - M_NEXT_EXIST (Cell_Selection_t, Exist_RXLEV_and_TXPWR, 2), - M_UINT (Cell_Selection_t, GPRS_RXLEV_ACCESS_MIN, 6), - M_UINT (Cell_Selection_t, GPRS_MS_TXPWR_MAX_CCH, 5), - M_NEXT_EXIST (Cell_Selection_t, Exist_OFFSET_and_TIME, 2), - M_UINT (Cell_Selection_t, GPRS_TEMPORARY_OFFSET, 3), - M_UINT (Cell_Selection_t, GPRS_PENALTY_TIME, 5), - M_NEXT_EXIST (Cell_Selection_t, Exist_GPRS_RESELECT_OFFSET, 1), - M_UINT (Cell_Selection_t, GPRS_RESELECT_OFFSET, 5), - M_NEXT_EXIST (Cell_Selection_t, Exist_HCS, 1), - M_TYPE (Cell_Selection_t, HCS, HCS_t), - M_NEXT_EXIST (Cell_Selection_t, Exist_SI13_PBCCH_Location, 1), - M_TYPE (Cell_Selection_t, SI13_PBCCH_Location, SI13_PBCCH_Location_t), -CSN_DESCR_END (Cell_Selection_t) - -static const -CSN_DESCR_BEGIN(Cell_Selection_Params_With_FreqDiff_t) - M_VAR_BITMAP (Cell_Selection_Params_With_FreqDiff_t, FREQUENCY_DIFF, FREQ_DIFF_LENGTH, 0), - M_TYPE (Cell_Selection_Params_With_FreqDiff_t, Cell_SelectionParams, Cell_Selection_t), -CSN_DESCR_END (Cell_Selection_Params_With_FreqDiff_t) - -static const -CSN_DESCR_BEGIN(NeighbourCellParameters_t) - M_UINT (NeighbourCellParameters_t, START_FREQUENCY, 10), - M_TYPE (NeighbourCellParameters_t, Cell_Selection, Cell_Selection_t), - M_UINT (NeighbourCellParameters_t, NR_OF_REMAINING_CELLS, 4), - M_UINT_OFFSET(NeighbourCellParameters_t, FREQ_DIFF_LENGTH, 3, 1),/* offset 1 */ - M_VAR_TARRAY (NeighbourCellParameters_t, Cell_Selection_Params_With_FreqDiff, Cell_Selection_Params_With_FreqDiff_t, NR_OF_REMAINING_CELLS), -CSN_DESCR_END (NeighbourCellParameters_t) - -static const -CSN_DESCR_BEGIN(NeighbourCellList_t) - M_REC_TARRAY (NeighbourCellList_t, Parameters, NeighbourCellParameters_t, Count), -CSN_DESCR_END (NeighbourCellList_t) - -static const -CSN_DESCR_BEGIN(Cell_Selection_2_t) - M_UINT (Cell_Selection_2_t, CELL_BAR_ACCESS_2, 1), - M_UINT (Cell_Selection_2_t, EXC_ACC, 1), - M_UINT (Cell_Selection_2_t, SAME_RA_AS_SERVING_CELL, 1), - M_NEXT_EXIST (Cell_Selection_2_t, Exist_RXLEV_and_TXPWR, 2), - M_UINT (Cell_Selection_2_t, GPRS_RXLEV_ACCESS_MIN, 6), - M_UINT (Cell_Selection_2_t, GPRS_MS_TXPWR_MAX_CCH, 5), - M_NEXT_EXIST (Cell_Selection_2_t, Exist_OFFSET_and_TIME, 2), - M_UINT (Cell_Selection_2_t, GPRS_TEMPORARY_OFFSET, 3), - M_UINT (Cell_Selection_2_t, GPRS_PENALTY_TIME, 5), - M_NEXT_EXIST (Cell_Selection_2_t, Exist_GPRS_RESELECT_OFFSET, 1), - M_UINT (Cell_Selection_2_t, GPRS_RESELECT_OFFSET, 5), - M_NEXT_EXIST (Cell_Selection_2_t, Exist_HCS, 1), - M_TYPE (Cell_Selection_2_t, HCS, HCS_t), - M_NEXT_EXIST (Cell_Selection_2_t, Exist_SI13_PBCCH_Location, 1), - M_TYPE (Cell_Selection_2_t, SI13_PBCCH_Location, SI13_PBCCH_Location_t), -CSN_DESCR_END (Cell_Selection_2_t) - -static const -CSN_DESCR_BEGIN(Packet_PRACH_Parameters_t) - M_UINT (Packet_PRACH_Parameters_t, MESSAGE_TYPE, 6), - M_UINT (Packet_PRACH_Parameters_t, PAGE_MODE, 2), - - M_TYPE (Packet_PRACH_Parameters_t, PRACH_Control, PRACH_Control_t), -CSN_DESCR_END (Packet_PRACH_Parameters_t) - -/* < Packet Access Reject message content > */ -static const -CSN_ChoiceElement_t RejectID[] = -{ - {1, 0x00, M_UINT(RejectID_t, u.TLLI, 32)}, - {2, 0x02, M_TYPE(RejectID_t, u.Packet_Request_Reference, Packet_Request_Reference_t)}, - {2, 0x03, M_TYPE(RejectID_t, u.Global_TFI, Global_TFI_t)}, -}; - -static const -CSN_DESCR_BEGIN(RejectID_t) - M_CHOICE (RejectID_t, UnionType, RejectID, ElementsOf(RejectID)), -CSN_DESCR_END (RejectID_t) - -static const -CSN_DESCR_BEGIN(Reject_t) - M_TYPE (Reject_t, ID, RejectID_t), - - M_NEXT_EXIST (Reject_t, Exist_Wait, 2), - M_UINT (Reject_t, WAIT_INDICATION, 8), - M_UINT (Reject_t, WAIT_INDICATION_SIZE, 1), -CSN_DESCR_END (Reject_t) - -static const -CSN_DESCR_BEGIN(Packet_Access_Reject_t) - M_UINT (Packet_Access_Reject_t, MESSAGE_TYPE, 6), - M_UINT (Packet_Access_Reject_t, PAGE_MODE, 2), - - M_TYPE (Packet_Access_Reject_t, Reject, Reject_t), - M_REC_TARRAY (Packet_Access_Reject_t, Reject[1], Reject_t, Count_Reject), -CSN_DESCR_END (Packet_Access_Reject_t) - -/* < Packet Cell Change Order message content > */ -static const -CSN_ChoiceElement_t PacketCellChangeOrderID[] = -{ - {1, 0, M_TYPE(PacketCellChangeOrderID_t, u.Global_TFI, Global_TFI_t)}, - {2, 0x02, M_UINT(PacketCellChangeOrderID_t, u.TLLI, 32)}, -}; -/* PacketCellChangeOrderID_t; */ - -static const -CSN_DESCR_BEGIN(PacketCellChangeOrderID_t) - M_CHOICE (PacketCellChangeOrderID_t, UnionType, PacketCellChangeOrderID, ElementsOf(PacketCellChangeOrderID)), -CSN_DESCR_END (PacketCellChangeOrderID_t) - -static const -CSN_DESCR_BEGIN(h_FreqBsicCell_t) - M_UINT (h_FreqBsicCell_t, BSIC, 6), - M_TYPE (h_FreqBsicCell_t, Cell_Selection, Cell_Selection_t), -CSN_DESCR_END (h_FreqBsicCell_t) - -static const CSN_DESCR_BEGIN(CellSelectionParamsWithFreqDiff_t) - /*FREQUENCY_DIFF is really an integer but the number of bits to decode it are stored in FREQ_DIFF_LENGTH*/ - M_VAR_BITMAP (CellSelectionParamsWithFreqDiff_t, FREQUENCY_DIFF, FREQ_DIFF_LENGTH, 0), - M_UINT (CellSelectionParamsWithFreqDiff_t, BSIC, 6), - M_NEXT_EXIST (CellSelectionParamsWithFreqDiff_t, Exist_CellSelectionParams, 1), - M_TYPE (CellSelectionParamsWithFreqDiff_t, CellSelectionParams, Cell_Selection_2_t), -CSN_DESCR_END (CellSelectionParamsWithFreqDiff_t) - -static const -CSN_DESCR_BEGIN(Add_Frequency_list_t) - M_UINT (Add_Frequency_list_t, START_FREQUENCY, 10), - M_UINT (Add_Frequency_list_t, BSIC, 6), - - M_NEXT_EXIST (Add_Frequency_list_t, Exist_Cell_Selection, 1), - M_TYPE (Add_Frequency_list_t, Cell_Selection, Cell_Selection_2_t), - - M_UINT (Add_Frequency_list_t, NR_OF_FREQUENCIES, 5), - M_UINT_OFFSET(Add_Frequency_list_t, FREQ_DIFF_LENGTH, 3, 1),/*offset 1*/ - - M_VAR_TARRAY (Add_Frequency_list_t, CellSelectionParamsWithFreqDiff, CellSelectionParamsWithFreqDiff_t, NR_OF_FREQUENCIES), -CSN_DESCR_END (Add_Frequency_list_t) - -static const CSN_DESCR_BEGIN(Removed_Freq_Index_t) - M_UINT(Removed_Freq_Index_t, REMOVED_FREQ_INDEX, 6), -CSN_DESCR_END(Removed_Freq_Index_t) - -static const -CSN_DESCR_BEGIN(NC_Frequency_list_t) - M_NEXT_EXIST (NC_Frequency_list_t, Exist_REMOVED_FREQ, 2), - M_UINT_OFFSET(NC_Frequency_list_t, NR_OF_REMOVED_FREQ, 5, 1),/*offset 1*/ - M_VAR_TARRAY (NC_Frequency_list_t, Removed_Freq_Index, Removed_Freq_Index_t, NR_OF_REMOVED_FREQ), - M_REC_TARRAY (NC_Frequency_list_t, Add_Frequency, Add_Frequency_list_t, Count_Add_Frequency), -CSN_DESCR_END (NC_Frequency_list_t) - -static const -CSN_DESCR_BEGIN(NC_Measurement_Parameters_t) - M_UINT (NC_Measurement_Parameters_t, NETWORK_CONTROL_ORDER, 2), - - M_NEXT_EXIST (NC_Measurement_Parameters_t, Exist_NC, 3), - M_UINT (NC_Measurement_Parameters_t, NC_NON_DRX_PERIOD, 3), - M_UINT (NC_Measurement_Parameters_t, NC_REPORTING_PERIOD_I, 3), - M_UINT (NC_Measurement_Parameters_t, NC_REPORTING_PERIOD_T, 3), -CSN_DESCR_END (NC_Measurement_Parameters_t) - -static const -CSN_DESCR_BEGIN(NC_Measurement_Parameters_with_Frequency_List_t) - M_UINT (NC_Measurement_Parameters_with_Frequency_List_t, NETWORK_CONTROL_ORDER, 2), - - M_NEXT_EXIST (NC_Measurement_Parameters_with_Frequency_List_t, Exist_NC, 3), - M_UINT (NC_Measurement_Parameters_with_Frequency_List_t, NC_NON_DRX_PERIOD, 3), - M_UINT (NC_Measurement_Parameters_with_Frequency_List_t, NC_REPORTING_PERIOD_I, 3), - M_UINT (NC_Measurement_Parameters_with_Frequency_List_t, NC_REPORTING_PERIOD_T, 3), - - M_NEXT_EXIST (NC_Measurement_Parameters_with_Frequency_List_t, Exist_NC_FREQUENCY_LIST, 1), - M_TYPE (NC_Measurement_Parameters_with_Frequency_List_t, NC_Frequency_list, NC_Frequency_list_t), -CSN_DESCR_END (NC_Measurement_Parameters_with_Frequency_List_t) - -/*< Packet Cell Change Order message contents >*/ -static const -CSN_DESCR_BEGIN(BA_IND_t) - M_UINT (BA_IND_t, BA_IND, 1), - M_UINT (BA_IND_t, BA_IND_3G, 1), -CSN_DESCR_END (BA_IND_t) - -static const -CSN_DESCR_BEGIN(GPRSReportPriority_t) - M_UINT (GPRSReportPriority_t, NUMBER_CELLS, 7), - M_VAR_BITMAP (GPRSReportPriority_t, REPORT_PRIORITY, NUMBER_CELLS, 0), -CSN_DESCR_END (GPRSReportPriority_t) - -static const -CSN_DESCR_BEGIN(OffsetThreshold_t) - M_UINT (OffsetThreshold_t, REPORTING_OFFSET, 3), - M_UINT (OffsetThreshold_t, REPORTING_THRESHOLD, 3), -CSN_DESCR_END (OffsetThreshold_t) - -static const -CSN_DESCR_BEGIN(GPRSMeasurementParams_PMO_PCCO_t) - M_NEXT_EXIST (GPRSMeasurementParams_PMO_PCCO_t, Exist_MULTI_BAND_REPORTING, 1), - M_UINT (GPRSMeasurementParams_PMO_PCCO_t, MULTI_BAND_REPORTING, 2), - - M_NEXT_EXIST (GPRSMeasurementParams_PMO_PCCO_t, Exist_SERVING_BAND_REPORTING, 1), - M_UINT (GPRSMeasurementParams_PMO_PCCO_t, SERVING_BAND_REPORTING, 2), - - M_UINT (GPRSMeasurementParams_PMO_PCCO_t, SCALE_ORD, 2), - - M_NEXT_EXIST (GPRSMeasurementParams_PMO_PCCO_t, Exist_OffsetThreshold900, 1), - M_TYPE (GPRSMeasurementParams_PMO_PCCO_t, OffsetThreshold900, OffsetThreshold_t), - - M_NEXT_EXIST (GPRSMeasurementParams_PMO_PCCO_t, Exist_OffsetThreshold1800, 1), - M_TYPE (GPRSMeasurementParams_PMO_PCCO_t, OffsetThreshold1800, OffsetThreshold_t), - - M_NEXT_EXIST (GPRSMeasurementParams_PMO_PCCO_t, Exist_OffsetThreshold400, 1), - M_TYPE (GPRSMeasurementParams_PMO_PCCO_t, OffsetThreshold400, OffsetThreshold_t), - - M_NEXT_EXIST (GPRSMeasurementParams_PMO_PCCO_t, Exist_OffsetThreshold1900, 1), - M_TYPE (GPRSMeasurementParams_PMO_PCCO_t, OffsetThreshold1900, OffsetThreshold_t), - - M_NEXT_EXIST (GPRSMeasurementParams_PMO_PCCO_t, Exist_OffsetThreshold850, 1), - M_TYPE (GPRSMeasurementParams_PMO_PCCO_t, OffsetThreshold850, OffsetThreshold_t), -CSN_DESCR_END (GPRSMeasurementParams_PMO_PCCO_t) - -static const -CSN_DESCR_BEGIN(GPRSMeasurementParams3G_t) - M_UINT (GPRSMeasurementParams3G_t, Qsearch_p, 4), - M_UINT (GPRSMeasurementParams3G_t, SearchPrio3G, 1), - - M_NEXT_EXIST (GPRSMeasurementParams3G_t, existRepParamsFDD, 2), - M_UINT (GPRSMeasurementParams3G_t, RepQuantFDD, 1), - M_UINT (GPRSMeasurementParams3G_t, MultiratReportingFDD, 2), - - M_NEXT_EXIST (GPRSMeasurementParams3G_t, existReportingParamsFDD, 2), - M_UINT (GPRSMeasurementParams3G_t, ReportingOffsetFDD, 3), - M_UINT (GPRSMeasurementParams3G_t, ReportingThresholdFDD, 3), - - M_NEXT_EXIST (GPRSMeasurementParams3G_t, existMultiratReportingTDD, 1), - M_UINT (GPRSMeasurementParams3G_t, MultiratReportingTDD, 2), - - M_NEXT_EXIST (GPRSMeasurementParams3G_t, existOffsetThresholdTDD, 2), - M_UINT (GPRSMeasurementParams3G_t, ReportingOffsetTDD, 3), - M_UINT (GPRSMeasurementParams3G_t, ReportingThresholdTDD, 3), -CSN_DESCR_END (GPRSMeasurementParams3G_t) - -static const -CSN_DESCR_BEGIN(MultiratParams3G_t) - M_NEXT_EXIST (MultiratParams3G_t, existMultiratReporting, 1), - M_UINT (MultiratParams3G_t, MultiratReporting, 2), - - M_NEXT_EXIST (MultiratParams3G_t, existOffsetThreshold, 1), - M_TYPE (MultiratParams3G_t, OffsetThreshold, OffsetThreshold_t), -CSN_DESCR_END (MultiratParams3G_t) - -static const -CSN_DESCR_BEGIN(ENH_GPRSMeasurementParams3G_PMO_t) - M_UINT (ENH_GPRSMeasurementParams3G_PMO_t, Qsearch_P, 4), - M_UINT (ENH_GPRSMeasurementParams3G_PMO_t, SearchPrio3G, 1), - - M_NEXT_EXIST (ENH_GPRSMeasurementParams3G_PMO_t, existRepParamsFDD, 2), - M_UINT (ENH_GPRSMeasurementParams3G_PMO_t, RepQuantFDD, 1), - M_UINT (ENH_GPRSMeasurementParams3G_PMO_t, MultiratReportingFDD, 2), - - M_NEXT_EXIST (ENH_GPRSMeasurementParams3G_PMO_t, existOffsetThreshold, 1), - M_TYPE (ENH_GPRSMeasurementParams3G_PMO_t, OffsetThreshold, OffsetThreshold_t), - - M_TYPE (ENH_GPRSMeasurementParams3G_PMO_t, ParamsTDD, MultiratParams3G_t), - M_TYPE (ENH_GPRSMeasurementParams3G_PMO_t, ParamsCDMA2000, MultiratParams3G_t), -CSN_DESCR_END (ENH_GPRSMeasurementParams3G_PMO_t) - -static const -CSN_DESCR_BEGIN(ENH_GPRSMeasurementParams3G_PCCO_t) - M_UINT (ENH_GPRSMeasurementParams3G_PCCO_t, Qsearch_P, 4), - M_UINT (ENH_GPRSMeasurementParams3G_PCCO_t, SearchPrio3G, 1), - - M_NEXT_EXIST (ENH_GPRSMeasurementParams3G_PCCO_t, existRepParamsFDD, 2), - M_UINT (ENH_GPRSMeasurementParams3G_PCCO_t, RepQuantFDD, 1), - M_UINT (ENH_GPRSMeasurementParams3G_PCCO_t, MultiratReportingFDD, 2), - - M_NEXT_EXIST (ENH_GPRSMeasurementParams3G_PCCO_t, existOffsetThreshold, 1), - M_TYPE (ENH_GPRSMeasurementParams3G_PCCO_t, OffsetThreshold, OffsetThreshold_t), - - M_TYPE (ENH_GPRSMeasurementParams3G_PCCO_t, ParamsTDD, MultiratParams3G_t), -CSN_DESCR_END (ENH_GPRSMeasurementParams3G_PCCO_t) - -static const -CSN_DESCR_BEGIN(N2_t) - M_UINT (N2_t, REMOVED_3GCELL_INDEX, 7), - M_UINT (N2_t, CELL_DIFF_LENGTH_3G, 3), - M_VAR_BITMAP (N2_t, CELL_DIFF_3G, CELL_DIFF_LENGTH_3G, 0), -CSN_DESCR_END (N2_t) - -static const -CSN_DESCR_BEGIN (N1_t) - M_UINT_OFFSET (N1_t, N2_Count, 5, 1), /*offset 1*/ - M_VAR_TARRAY (N1_t, N2s, N2_t, N2_Count), -CSN_DESCR_END (N1_t) - -static const -CSN_DESCR_BEGIN (Removed3GCellDescription_t) - M_UINT_OFFSET (Removed3GCellDescription_t, N1_Count, 2, 1), /* offset 1 */ - M_VAR_TARRAY (Removed3GCellDescription_t, N1s, N1_t, N1_Count), -CSN_DESCR_END (Removed3GCellDescription_t) - -static const -CSN_DESCR_BEGIN(CDMA2000_Description_t) - M_UINT (CDMA2000_Description_t, Complete_This, 1), - CSN_ERROR (CDMA2000_Description_t, "Not Implemented", CSN_ERROR_STREAM_NOT_SUPPORTED), -CSN_DESCR_END (CDMA2000_Description_t) - -static const -CSN_DESCR_BEGIN(UTRAN_FDD_NeighbourCells_t) - M_UINT (UTRAN_FDD_NeighbourCells_t, ZERO, 1), - M_UINT (UTRAN_FDD_NeighbourCells_t, UARFCN, 14), - M_UINT (UTRAN_FDD_NeighbourCells_t, Indic0, 1), - M_UINT (UTRAN_FDD_NeighbourCells_t, NrOfCells, 5), -/* M_CALLBACK (UTRAN_FDD_NeighbourCells_t, (void*) 14, NrOfCells, BitsInCellInfo), */ - M_VAR_BITMAP (UTRAN_FDD_NeighbourCells_t, CellInfo, BitsInCellInfo, 0), -CSN_DESCR_END (UTRAN_FDD_NeighbourCells_t) - -static const -CSN_DESCR_BEGIN(UTRAN_FDD_Description_t) - M_NEXT_EXIST (UTRAN_FDD_Description_t, existBandwidth, 1), - M_UINT (UTRAN_FDD_Description_t, Bandwidth, 3), - M_REC_TARRAY (UTRAN_FDD_Description_t, CellParams, UTRAN_FDD_NeighbourCells_t, NrOfFrequencies), -CSN_DESCR_END (UTRAN_FDD_Description_t) - -static const -CSN_DESCR_BEGIN(UTRAN_TDD_NeighbourCells_t) - M_UINT (UTRAN_TDD_NeighbourCells_t, ZERO, 1), - M_UINT (UTRAN_TDD_NeighbourCells_t, UARFCN, 14), - M_UINT (UTRAN_TDD_NeighbourCells_t, Indic0, 1), - M_UINT (UTRAN_TDD_NeighbourCells_t, NrOfCells, 5), -/* M_CALLBACK (UTRAN_TDD_NeighbourCells_t, (void*) 23, NrOfCells, BitsInCellInfo), */ - M_VAR_BITMAP (UTRAN_TDD_NeighbourCells_t, CellInfo, BitsInCellInfo, 0), -CSN_DESCR_END (UTRAN_TDD_NeighbourCells_t) - -static const -CSN_DESCR_BEGIN(UTRAN_TDD_Description_t) - M_NEXT_EXIST (UTRAN_TDD_Description_t, existBandwidth, 1), - M_UINT (UTRAN_TDD_Description_t, Bandwidth, 3), - M_REC_TARRAY (UTRAN_TDD_Description_t, CellParams, UTRAN_TDD_NeighbourCells_t, NrOfFrequencies), -CSN_DESCR_END (UTRAN_TDD_Description_t) - -static const -CSN_DESCR_BEGIN(NeighbourCellDescription3G_PMO_t) - M_NEXT_EXIST (NeighbourCellDescription3G_PMO_t, Exist_Index_Start_3G, 1), - M_UINT (NeighbourCellDescription3G_PMO_t, Index_Start_3G, 7), - M_NEXT_EXIST (NeighbourCellDescription3G_PMO_t, Exist_Absolute_Index_Start_EMR, 1), - M_UINT (NeighbourCellDescription3G_PMO_t, Absolute_Index_Start_EMR, 7), - M_NEXT_EXIST (NeighbourCellDescription3G_PMO_t, Exist_UTRAN_FDD_Description, 1), - M_TYPE (NeighbourCellDescription3G_PMO_t, UTRAN_FDD_Description, UTRAN_FDD_Description_t), - M_NEXT_EXIST (NeighbourCellDescription3G_PMO_t, Exist_UTRAN_TDD_Description, 1), - M_TYPE (NeighbourCellDescription3G_PMO_t, UTRAN_TDD_Description, UTRAN_TDD_Description_t), - M_NEXT_EXIST (NeighbourCellDescription3G_PMO_t, Exist_CDMA2000_Description, 1), - M_TYPE (NeighbourCellDescription3G_PMO_t, CDMA2000_Description, CDMA2000_Description_t), - M_NEXT_EXIST (NeighbourCellDescription3G_PMO_t, Exist_Removed3GCellDescription, 1), - M_TYPE (NeighbourCellDescription3G_PMO_t, Removed3GCellDescription, Removed3GCellDescription_t), -CSN_DESCR_END (NeighbourCellDescription3G_PMO_t) - -static const -CSN_DESCR_BEGIN(NeighbourCellDescription3G_PCCO_t) - M_NEXT_EXIST (NeighbourCellDescription3G_PCCO_t, Exist_Index_Start_3G, 1), - M_UINT (NeighbourCellDescription3G_PCCO_t, Index_Start_3G, 7), - M_NEXT_EXIST (NeighbourCellDescription3G_PCCO_t, Exist_Absolute_Index_Start_EMR, 1), - M_UINT (NeighbourCellDescription3G_PCCO_t, Absolute_Index_Start_EMR, 7), - M_NEXT_EXIST (NeighbourCellDescription3G_PCCO_t, Exist_UTRAN_FDD_Description, 1), - M_TYPE (NeighbourCellDescription3G_PCCO_t, UTRAN_FDD_Description, UTRAN_FDD_Description_t), - M_NEXT_EXIST (NeighbourCellDescription3G_PCCO_t, Exist_UTRAN_TDD_Description, 1), - M_TYPE (NeighbourCellDescription3G_PCCO_t, UTRAN_TDD_Description, UTRAN_TDD_Description_t), - M_NEXT_EXIST (NeighbourCellDescription3G_PCCO_t, Exist_Removed3GCellDescription, 1), - M_TYPE (NeighbourCellDescription3G_PCCO_t, Removed3GCellDescription, Removed3GCellDescription_t), -CSN_DESCR_END (NeighbourCellDescription3G_PCCO_t) - -static const -CSN_DESCR_BEGIN(ENH_Measurement_Parameters_PMO_t) - M_UNION (ENH_Measurement_Parameters_PMO_t, 2), - M_TYPE (ENH_Measurement_Parameters_PMO_t, u.BA_IND, BA_IND_t), - M_UINT (ENH_Measurement_Parameters_PMO_t, u.PSI3_CHANGE_MARK, 2), - M_UINT (ENH_Measurement_Parameters_PMO_t, PMO_IND, 1), - - M_UINT (ENH_Measurement_Parameters_PMO_t, REPORT_TYPE, 1), - M_UINT (ENH_Measurement_Parameters_PMO_t, REPORTING_RATE, 1), - M_UINT (ENH_Measurement_Parameters_PMO_t, INVALID_BSIC_REPORTING, 1), - - M_NEXT_EXIST (ENH_Measurement_Parameters_PMO_t, Exist_NeighbourCellDescription3G, 1), - M_TYPE (ENH_Measurement_Parameters_PMO_t, NeighbourCellDescription3G, NeighbourCellDescription3G_PMO_t), - - M_NEXT_EXIST (ENH_Measurement_Parameters_PMO_t, Exist_GPRSReportPriority, 1), - M_TYPE (ENH_Measurement_Parameters_PMO_t, GPRSReportPriority, GPRSReportPriority_t), - - M_NEXT_EXIST (ENH_Measurement_Parameters_PMO_t, Exist_GPRSMeasurementParams, 1), - M_TYPE (ENH_Measurement_Parameters_PMO_t, GPRSMeasurementParams, GPRSMeasurementParams_PMO_PCCO_t), - - M_NEXT_EXIST (ENH_Measurement_Parameters_PMO_t, Exist_GPRSMeasurementParams3G, 1), - M_TYPE (ENH_Measurement_Parameters_PMO_t, GPRSMeasurementParams3G, ENH_GPRSMeasurementParams3G_PMO_t), -CSN_DESCR_END (ENH_Measurement_Parameters_PMO_t) - -static const -CSN_DESCR_BEGIN(ENH_Measurement_Parameters_PCCO_t) - M_UNION (ENH_Measurement_Parameters_PCCO_t, 2), - M_TYPE (ENH_Measurement_Parameters_PCCO_t, u.BA_IND, BA_IND_t), - M_UINT (ENH_Measurement_Parameters_PCCO_t, u.PSI3_CHANGE_MARK, 2), - M_UINT (ENH_Measurement_Parameters_PCCO_t, PMO_IND, 1), - - M_UINT (ENH_Measurement_Parameters_PCCO_t, REPORT_TYPE, 1), - M_UINT (ENH_Measurement_Parameters_PCCO_t, REPORTING_RATE, 1), - M_UINT (ENH_Measurement_Parameters_PCCO_t, INVALID_BSIC_REPORTING, 1), - - M_NEXT_EXIST (ENH_Measurement_Parameters_PCCO_t, Exist_NeighbourCellDescription3G, 1), - M_TYPE (ENH_Measurement_Parameters_PCCO_t, NeighbourCellDescription3G, NeighbourCellDescription3G_PCCO_t), - - M_NEXT_EXIST (ENH_Measurement_Parameters_PCCO_t, Exist_GPRSReportPriority, 1), - M_TYPE (ENH_Measurement_Parameters_PCCO_t, GPRSReportPriority, GPRSReportPriority_t), - - M_NEXT_EXIST (ENH_Measurement_Parameters_PCCO_t, Exist_GPRSMeasurementParams, 1), - M_TYPE (ENH_Measurement_Parameters_PCCO_t, GPRSMeasurementParams, GPRSMeasurementParams_PMO_PCCO_t), - - M_NEXT_EXIST (ENH_Measurement_Parameters_PCCO_t, Exist_GPRSMeasurementParams3G, 1), - M_TYPE (ENH_Measurement_Parameters_PCCO_t, GPRSMeasurementParams3G, ENH_GPRSMeasurementParams3G_PCCO_t), -CSN_DESCR_END (ENH_Measurement_Parameters_PCCO_t) - -static const -CSN_DESCR_BEGIN(CCN_Support_Description_t) - M_UINT (CCN_Support_Description_t, NUMBER_CELLS, 7), - M_VAR_BITMAP (CCN_Support_Description_t, CCN_SUPPORTED, NUMBER_CELLS, 0), -CSN_DESCR_END (CCN_Support_Description_t) - -static const -CSN_DESCR_BEGIN(lu_ModeCellSelectionParameters_t) - M_UINT (lu_ModeCellSelectionParameters_t, CELL_BAR_QUALIFY_3, 2), - M_NEXT_EXIST (lu_ModeCellSelectionParameters_t, Exist_SI13_Alt_PBCCH_Location, 1), - M_TYPE (lu_ModeCellSelectionParameters_t, SI13_Alt_PBCCH_Location, SI13_PBCCH_Location_t), -CSN_DESCR_END (lu_ModeCellSelectionParameters_t) - -static const -CSN_DESCR_BEGIN(lu_ModeCellSelectionParams_t) - M_NEXT_EXIST (lu_ModeCellSelectionParams_t, Exist_lu_ModeCellSelectionParams, 1), - M_TYPE (lu_ModeCellSelectionParams_t, lu_ModeCellSelectionParameters, lu_ModeCellSelectionParameters_t), -CSN_DESCR_END (lu_ModeCellSelectionParams_t) - -static const -CSN_DESCR_BEGIN(lu_ModeNeighbourCellParams_t) - M_TYPE (lu_ModeNeighbourCellParams_t, lu_ModeCellSelectionParameters, lu_ModeCellSelectionParams_t), - M_UINT (lu_ModeNeighbourCellParams_t, NR_OF_FREQUENCIES, 5), - M_VAR_TARRAY (lu_ModeNeighbourCellParams_t, lu_ModeCellSelectionParams, lu_ModeCellSelectionParams_t, NR_OF_FREQUENCIES), -CSN_DESCR_END (lu_ModeNeighbourCellParams_t) - -static const -CSN_DESCR_BEGIN(lu_ModeOnlyCellSelection_t) - M_UINT (lu_ModeOnlyCellSelection_t, CELL_BAR_QUALIFY_3, 2), - M_UINT (lu_ModeOnlyCellSelection_t, SAME_RA_AS_SERVING_CELL, 1), - - M_NEXT_EXIST (lu_ModeOnlyCellSelection_t, Exist_RXLEV_and_TXPWR, 2), - M_UINT (lu_ModeOnlyCellSelection_t, GPRS_RXLEV_ACCESS_MIN, 6), - M_UINT (lu_ModeOnlyCellSelection_t, GPRS_MS_TXPWR_MAX_CCH, 5), - - M_NEXT_EXIST (lu_ModeOnlyCellSelection_t, Exist_OFFSET_and_TIME, 2), - M_UINT (lu_ModeOnlyCellSelection_t, GPRS_TEMPORARY_OFFSET, 3), - M_UINT (lu_ModeOnlyCellSelection_t, GPRS_PENALTY_TIME, 5), - - M_NEXT_EXIST (lu_ModeOnlyCellSelection_t, Exist_GPRS_RESELECT_OFFSET, 1), - M_UINT (lu_ModeOnlyCellSelection_t, GPRS_RESELECT_OFFSET, 5), - - M_NEXT_EXIST (lu_ModeOnlyCellSelection_t, Exist_HCS, 1), - M_TYPE (lu_ModeOnlyCellSelection_t, HCS, HCS_t), - - M_NEXT_EXIST (lu_ModeOnlyCellSelection_t, Exist_SI13_Alt_PBCCH_Location, 1), - M_TYPE (lu_ModeOnlyCellSelection_t, SI13_Alt_PBCCH_Location, SI13_PBCCH_Location_t), -CSN_DESCR_END (lu_ModeOnlyCellSelection_t) - -static const -CSN_DESCR_BEGIN(lu_ModeOnlyCellSelectionParamsWithFreqDiff_t) - /*FREQUENCY_DIFF is really an integer but the number of bits to decode it are stored in FREQ_DIFF_LENGTH*/ - M_VAR_BITMAP (lu_ModeOnlyCellSelectionParamsWithFreqDiff_t, FREQUENCY_DIFF, FREQ_DIFF_LENGTH, 0), - M_UINT (lu_ModeOnlyCellSelectionParamsWithFreqDiff_t, BSIC, 6), - M_NEXT_EXIST (lu_ModeOnlyCellSelectionParamsWithFreqDiff_t, Exist_lu_ModeOnlyCellSelectionParams, 1), - M_TYPE (lu_ModeOnlyCellSelectionParamsWithFreqDiff_t, lu_ModeOnlyCellSelectionParams, lu_ModeOnlyCellSelection_t), -CSN_DESCR_END (lu_ModeOnlyCellSelectionParamsWithFreqDiff_t) - -static const -CSN_DESCR_BEGIN(Add_lu_ModeOnlyFrequencyList_t) - M_UINT (Add_lu_ModeOnlyFrequencyList_t, START_FREQUENCY, 10), - M_UINT (Add_lu_ModeOnlyFrequencyList_t, BSIC, 6), - - M_NEXT_EXIST (Add_lu_ModeOnlyFrequencyList_t, Exist_lu_ModeCellSelection, 1), - M_TYPE (Add_lu_ModeOnlyFrequencyList_t, lu_ModeOnlyCellSelection, lu_ModeOnlyCellSelection_t), - - M_UINT (Add_lu_ModeOnlyFrequencyList_t, NR_OF_FREQUENCIES, 5), - M_UINT (Add_lu_ModeOnlyFrequencyList_t, FREQ_DIFF_LENGTH, 3), - - M_VAR_TARRAY (Add_lu_ModeOnlyFrequencyList_t, lu_ModeOnlyCellSelectionParamsWithFreqDiff, lu_ModeOnlyCellSelectionParamsWithFreqDiff_t, NR_OF_FREQUENCIES), -CSN_DESCR_END (Add_lu_ModeOnlyFrequencyList_t) - -static const -CSN_DESCR_BEGIN(NC_lu_ModeOnlyCapableCellList_t) - M_REC_TARRAY (NC_lu_ModeOnlyCapableCellList_t, Add_lu_ModeOnlyFrequencyList, Add_lu_ModeOnlyFrequencyList_t, Count_Add_lu_ModeOnlyFrequencyList), -CSN_DESCR_END (NC_lu_ModeOnlyCapableCellList_t) - -static const -CSN_DESCR_BEGIN(GPRS_AdditionalMeasurementParams3G_t) - M_NEXT_EXIST (GPRS_AdditionalMeasurementParams3G_t, Exist_FDD_REPORTING_THRESHOLD_2, 1), - M_UINT (GPRS_AdditionalMeasurementParams3G_t, FDD_REPORTING_THRESHOLD_2, 6), -CSN_DESCR_END (GPRS_AdditionalMeasurementParams3G_t) - -static const -CSN_DESCR_BEGIN(ServingCellPriorityParametersDescription_t) - M_UINT (ServingCellPriorityParametersDescription_t, GERAN_PRIORITY, 3), - M_UINT (ServingCellPriorityParametersDescription_t, THRESH_Priority_Search, 4), - M_UINT (ServingCellPriorityParametersDescription_t, THRESH_GSM_low, 4), - M_UINT (ServingCellPriorityParametersDescription_t, H_PRIO, 2), - M_UINT (ServingCellPriorityParametersDescription_t, T_Reselection, 2), -CSN_DESCR_END (ServingCellPriorityParametersDescription_t) - -static const -CSN_DESCR_BEGIN(RepeatedUTRAN_PriorityParameters_t) - M_REC_ARRAY (RepeatedUTRAN_PriorityParameters_t, UTRAN_FREQUENCY_INDEX_a, NumberOfFrequencyIndexes, 5), - - M_NEXT_EXIST (RepeatedUTRAN_PriorityParameters_t, existUTRAN_PRIORITY, 1), - M_UINT (RepeatedUTRAN_PriorityParameters_t, UTRAN_PRIORITY, 3), - - M_UINT (RepeatedUTRAN_PriorityParameters_t, THRESH_UTRAN_high, 5), - - M_NEXT_EXIST (RepeatedUTRAN_PriorityParameters_t, existTHRESH_UTRAN_low, 1), - M_UINT (RepeatedUTRAN_PriorityParameters_t, THRESH_UTRAN_low, 5), - - M_NEXT_EXIST (RepeatedUTRAN_PriorityParameters_t, existUTRAN_QRXLEVMIN, 1), - M_UINT (RepeatedUTRAN_PriorityParameters_t, UTRAN_QRXLEVMIN, 5), -CSN_DESCR_END (RepeatedUTRAN_PriorityParameters_t) - -static const -CSN_DESCR_BEGIN(PriorityParametersDescription3G_PMO_t) - - M_NEXT_EXIST (PriorityParametersDescription3G_PMO_t, existDEFAULT_UTRAN_Parameters, 3), - M_UINT (PriorityParametersDescription3G_PMO_t, DEFAULT_UTRAN_PRIORITY, 3), - M_UINT (PriorityParametersDescription3G_PMO_t, DEFAULT_THRESH_UTRAN, 5), - M_UINT (PriorityParametersDescription3G_PMO_t, DEFAULT_UTRAN_QRXLEVMIN, 5), - - M_REC_TARRAY (PriorityParametersDescription3G_PMO_t, RepeatedUTRAN_PriorityParameters_a, RepeatedUTRAN_PriorityParameters_t, NumberOfPriorityParameters), -CSN_DESCR_END (PriorityParametersDescription3G_PMO_t) - -static const -CSN_DESCR_BEGIN(EUTRAN_REPORTING_THRESHOLD_OFFSET_t) - M_NEXT_EXIST (EUTRAN_REPORTING_THRESHOLD_OFFSET_t, existEUTRAN_FDD_REPORTING_THRESHOLD_OFFSET, 5), - M_UINT (EUTRAN_REPORTING_THRESHOLD_OFFSET_t, EUTRAN_FDD_REPORTING_THRESHOLD, 3), - M_NEXT_EXIST (EUTRAN_REPORTING_THRESHOLD_OFFSET_t, existEUTRAN_FDD_REPORTING_THRESHOLD_2, 1), - M_UINT (EUTRAN_REPORTING_THRESHOLD_OFFSET_t, EUTRAN_FDD_REPORTING_THRESHOLD_2, 6), - M_NEXT_EXIST (EUTRAN_REPORTING_THRESHOLD_OFFSET_t, existEUTRAN_FDD_REPORTING_OFFSET, 1), - M_UINT (EUTRAN_REPORTING_THRESHOLD_OFFSET_t, EUTRAN_FDD_REPORTING_OFFSET, 3), - - M_NEXT_EXIST (EUTRAN_REPORTING_THRESHOLD_OFFSET_t, existEUTRAN_TDD_REPORTING_THRESHOLD_OFFSET, 5), - M_UINT (EUTRAN_REPORTING_THRESHOLD_OFFSET_t, EUTRAN_TDD_REPORTING_THRESHOLD, 3), - M_NEXT_EXIST (EUTRAN_REPORTING_THRESHOLD_OFFSET_t, existEUTRAN_TDD_REPORTING_THRESHOLD_2, 1), - M_UINT (EUTRAN_REPORTING_THRESHOLD_OFFSET_t, EUTRAN_TDD_REPORTING_THRESHOLD_2, 6), - M_NEXT_EXIST (EUTRAN_REPORTING_THRESHOLD_OFFSET_t, existEUTRAN_TDD_REPORTING_OFFSET, 1), - M_UINT (EUTRAN_REPORTING_THRESHOLD_OFFSET_t, EUTRAN_TDD_REPORTING_OFFSET, 3), -CSN_DESCR_END (EUTRAN_REPORTING_THRESHOLD_OFFSET_t) - -static const -CSN_DESCR_BEGIN(GPRS_EUTRAN_MeasurementParametersDescription_t) - M_UINT (GPRS_EUTRAN_MeasurementParametersDescription_t, Qsearch_P_EUTRAN, 4), - M_BIT (GPRS_EUTRAN_MeasurementParametersDescription_t, EUTRAN_REP_QUANT), - M_UINT (GPRS_EUTRAN_MeasurementParametersDescription_t, EUTRAN_MULTIRAT_REPORTING, 2), - M_TYPE (GPRS_EUTRAN_MeasurementParametersDescription_t, EUTRAN_REPORTING_THRESHOLD_OFFSET, EUTRAN_REPORTING_THRESHOLD_OFFSET_t), -CSN_DESCR_END (GPRS_EUTRAN_MeasurementParametersDescription_t) - -static const -CSN_DESCR_BEGIN(RepeatedEUTRAN_Cells_t) - M_UINT (RepeatedEUTRAN_Cells_t, EARFCN, 16), - M_NEXT_EXIST (RepeatedEUTRAN_Cells_t, existMeasurementBandwidth, 1), - M_UINT (RepeatedEUTRAN_Cells_t, MeasurementBandwidth, 3), -CSN_DESCR_END (RepeatedEUTRAN_Cells_t) - -static const -CSN_DESCR_BEGIN(RepeatedEUTRAN_NeighbourCells_t) - M_REC_TARRAY (RepeatedEUTRAN_NeighbourCells_t, EUTRAN_Cells_a, RepeatedEUTRAN_Cells_t, nbrOfEUTRAN_Cells), - - M_NEXT_EXIST (RepeatedEUTRAN_NeighbourCells_t, existEUTRAN_PRIORITY, 1), - M_UINT (RepeatedEUTRAN_NeighbourCells_t, EUTRAN_PRIORITY, 3), - - M_UINT (RepeatedEUTRAN_NeighbourCells_t, THRESH_EUTRAN_high, 5), - - M_NEXT_EXIST (RepeatedEUTRAN_NeighbourCells_t, existTHRESH_EUTRAN_low, 1), - M_UINT (RepeatedEUTRAN_NeighbourCells_t, THRESH_EUTRAN_low, 5), - - M_NEXT_EXIST (RepeatedEUTRAN_NeighbourCells_t, existEUTRAN_QRXLEVMIN, 1), - M_UINT (RepeatedEUTRAN_NeighbourCells_t, EUTRAN_QRXLEVMIN, 5), -CSN_DESCR_END (RepeatedEUTRAN_NeighbourCells_t) - -static const -CSN_DESCR_BEGIN(PCID_Pattern_t) - M_UINT (PCID_Pattern_t, PCID_Pattern_length, 3), - M_VAR_BITMAP (PCID_Pattern_t, PCID_Pattern, PCID_Pattern_length, 1), /* offset 1, 44.060 12.57 */ - M_UINT (PCID_Pattern_t, PCID_Pattern_sense, 1), -CSN_DESCR_END (PCID_Pattern_t) - -static const -CSN_DESCR_BEGIN(PCID_Group_IE_t) - - M_REC_ARRAY (PCID_Group_IE_t, PCID_a, NumberOfPCIDs, 9), - - M_NEXT_EXIST (PCID_Group_IE_t, existPCID_BITMAP_GROUP, 1), - M_UINT (PCID_Group_IE_t, PCID_BITMAP_GROUP, 6), - - M_REC_TARRAY (PCID_Group_IE_t, PCID_Pattern_a, PCID_Pattern_t, NumberOfPCID_Patterns), -CSN_DESCR_END (PCID_Group_IE_t) - -static const -CSN_DESCR_BEGIN(EUTRAN_FREQUENCY_INDEX_t) - M_UINT (EUTRAN_FREQUENCY_INDEX_t, EUTRAN_FREQUENCY_INDEX, 3), -CSN_DESCR_END (EUTRAN_FREQUENCY_INDEX_t) - -static const -CSN_DESCR_BEGIN(RepeatedEUTRAN_NotAllowedCells_t) - M_TYPE (RepeatedEUTRAN_NotAllowedCells_t, NotAllowedCells, PCID_Group_IE_t), - - M_REC_TARRAY (RepeatedEUTRAN_NotAllowedCells_t, EUTRAN_FREQUENCY_INDEX_a, EUTRAN_FREQUENCY_INDEX_t, NumberOfFrequencyIndexes), -CSN_DESCR_END (RepeatedEUTRAN_NotAllowedCells_t) - -static const -CSN_DESCR_BEGIN(RepeatedEUTRAN_PCID_to_TA_mapping_t) - M_REC_TARRAY (RepeatedEUTRAN_PCID_to_TA_mapping_t, PCID_ToTA_Mapping_a, PCID_Group_IE_t, NumberOfMappings), - M_REC_TARRAY (RepeatedEUTRAN_PCID_to_TA_mapping_t, EUTRAN_FREQUENCY_INDEX_a, EUTRAN_FREQUENCY_INDEX_t, NumberOfFrequencyIndexes), -CSN_DESCR_END (RepeatedEUTRAN_PCID_to_TA_mapping_t) - -static const -CSN_DESCR_BEGIN(EUTRAN_ParametersDescription_PMO_t) - M_BIT (EUTRAN_ParametersDescription_PMO_t, EUTRAN_CCN_ACTIVE), - - M_NEXT_EXIST (EUTRAN_ParametersDescription_PMO_t, existGPRS_EUTRAN_MeasurementParametersDescription, 1), - M_TYPE (EUTRAN_ParametersDescription_PMO_t, GPRS_EUTRAN_MeasurementParametersDescription, GPRS_EUTRAN_MeasurementParametersDescription_t), - - M_REC_TARRAY (EUTRAN_ParametersDescription_PMO_t, RepeatedEUTRAN_NeighbourCells_a, RepeatedEUTRAN_NeighbourCells_t, nbrOfRepeatedEUTRAN_NeighbourCellsStructs), - M_REC_TARRAY (EUTRAN_ParametersDescription_PMO_t, RepeatedEUTRAN_NotAllowedCells_a, RepeatedEUTRAN_NotAllowedCells_t, NumberOfNotAllowedCells), - M_REC_TARRAY (EUTRAN_ParametersDescription_PMO_t, RepeatedEUTRAN_PCID_to_TA_mapping_a, RepeatedEUTRAN_PCID_to_TA_mapping_t, NumberOfMappings), -CSN_DESCR_END (EUTRAN_ParametersDescription_PMO_t) - -static const -CSN_DESCR_BEGIN(PSC_Pattern_t) - M_UINT (PSC_Pattern_t, PSC_Pattern_length, 3), - M_VAR_BITMAP (PSC_Pattern_t, PSC_Pattern, PSC_Pattern_length, 1), - M_BIT (PSC_Pattern_t, PSC_Pattern_sense), -CSN_DESCR_END (PSC_Pattern_t) - -static const -CSN_DESCR_BEGIN(PSC_Group_t) - M_REC_ARRAY (PSC_Group_t, PSC, PSC_Count, 9), - M_REC_TARRAY (PSC_Group_t, PSC_Pattern, PSC_Pattern_t, PSC_Pattern_Count), -CSN_DESCR_END (PSC_Group_t) - -static const -CSN_DESCR_BEGIN(ThreeG_CSG_Description_Body_t) - M_TYPE (ThreeG_CSG_Description_Body_t, CSG_PSC_SPLIT, PSC_Group_t), - M_REC_ARRAY (ThreeG_CSG_Description_Body_t, UTRAN_FREQUENCY_INDEX, Count, 5), -CSN_DESCR_END (ThreeG_CSG_Description_Body_t) - -static const -CSN_DESCR_BEGIN(ThreeG_CSG_Description_t) - M_REC_TARRAY (ThreeG_CSG_Description_t, ThreeG_CSG_Description_Body, ThreeG_CSG_Description_Body_t, Count), -CSN_DESCR_END (ThreeG_CSG_Description_t) - -static const -CSN_DESCR_BEGIN(EUTRAN_CSG_Description_Body_t) - M_TYPE (EUTRAN_CSG_Description_Body_t, CSG_PCI_SPLIT, PSC_Group_t), - M_REC_ARRAY (EUTRAN_CSG_Description_Body_t, EUTRAN_FREQUENCY_INDEX, Count, 3), -CSN_DESCR_END (EUTRAN_CSG_Description_Body_t) - -static const -CSN_DESCR_BEGIN(EUTRAN_CSG_Description_t) - M_REC_TARRAY (EUTRAN_CSG_Description_t, EUTRAN_CSG_Description_Body, EUTRAN_CSG_Description_Body_t, Count), -CSN_DESCR_END (EUTRAN_CSG_Description_t) - -static const -CSN_DESCR_BEGIN(Meas_Ctrl_Param_Desp_t) - M_NEXT_EXIST (Meas_Ctrl_Param_Desp_t, existMeasurement_Control_EUTRAN, 3), - M_BIT (Meas_Ctrl_Param_Desp_t, Measurement_Control_EUTRAN), - M_UINT (Meas_Ctrl_Param_Desp_t, EUTRAN_FREQUENCY_INDEX_top, 3), - M_REC_ARRAY (Meas_Ctrl_Param_Desp_t, EUTRAN_FREQUENCY_INDEX, Count_EUTRAN_FREQUENCY_INDEX, 3), - M_NEXT_EXIST (Meas_Ctrl_Param_Desp_t, existMeasurement_Control_UTRAN, 1), - M_BIT (Meas_Ctrl_Param_Desp_t, Measurement_Control_UTRAN), - M_UINT (Meas_Ctrl_Param_Desp_t, UTRAN_FREQUENCY_INDEX_top, 5), - M_REC_ARRAY (Meas_Ctrl_Param_Desp_t, UTRAN_FREQUENCY_INDEX, Count_UTRAN_FREQUENCY_INDEX, 5), -CSN_DESCR_END (Meas_Ctrl_Param_Desp_t) - -static const -CSN_DESCR_BEGIN(Reselection_Based_On_RSRQ_t) - M_UINT (Reselection_Based_On_RSRQ_t, THRESH_EUTRAN_high_Q, 5), - M_NEXT_EXIST (Reselection_Based_On_RSRQ_t, existTHRESH_EUTRAN_low_Q, 1), - M_UINT (Reselection_Based_On_RSRQ_t, THRESH_EUTRAN_low_Q, 5), - M_NEXT_EXIST (Reselection_Based_On_RSRQ_t, existEUTRAN_QQUALMIN, 1), - M_UINT (Reselection_Based_On_RSRQ_t, EUTRAN_QQUALMIN, 4), - M_NEXT_EXIST (Reselection_Based_On_RSRQ_t, existEUTRAN_RSRPmin, 1), - M_UINT (Reselection_Based_On_RSRQ_t, EUTRAN_RSRPmin, 5), -CSN_DESCR_END (Reselection_Based_On_RSRQ_t) - -static const -CSN_DESCR_BEGIN(Rept_EUTRAN_Enh_Cell_Resel_Param_t) - M_REC_ARRAY (Rept_EUTRAN_Enh_Cell_Resel_Param_t, EUTRAN_FREQUENCY_INDEX, Count_EUTRAN_FREQUENCY_INDEX, 3), - M_UNION (Rept_EUTRAN_Enh_Cell_Resel_Param_t, 2), - M_UINT (Rept_EUTRAN_Enh_Cell_Resel_Param_t, u.EUTRAN_Qmin, 4), - M_TYPE (Rept_EUTRAN_Enh_Cell_Resel_Param_t, u.Reselection_Based_On_RSRQ, Reselection_Based_On_RSRQ_t), -CSN_DESCR_END (Rept_EUTRAN_Enh_Cell_Resel_Param_t) - -static const -CSN_DESCR_BEGIN(Enh_Cell_Reselect_Param_Desp_t) - M_REC_TARRAY (Enh_Cell_Reselect_Param_Desp_t, Repeated_EUTRAN_Enhanced_Cell_Reselection_Parameters, Rept_EUTRAN_Enh_Cell_Resel_Param_t, Count), -CSN_DESCR_END (Enh_Cell_Reselect_Param_Desp_t) - -static const -CSN_DESCR_BEGIN(UTRAN_CSG_Cells_Reporting_Desp_t) - M_NEXT_EXIST (UTRAN_CSG_Cells_Reporting_Desp_t, existUTRAN_CSG_FDD_REPORTING_THRESHOLD, 2), - M_UINT (UTRAN_CSG_Cells_Reporting_Desp_t, UTRAN_CSG_FDD_REPORTING_THRESHOLD, 3), - M_UINT (UTRAN_CSG_Cells_Reporting_Desp_t, UTRAN_CSG_FDD_REPORTING_THRESHOLD_2, 6), - M_NEXT_EXIST (UTRAN_CSG_Cells_Reporting_Desp_t, existUTRAN_CSG_TDD_REPORTING_THRESHOLD, 1), - M_UINT (UTRAN_CSG_Cells_Reporting_Desp_t, UTRAN_CSG_TDD_REPORTING_THRESHOLD, 3), -CSN_DESCR_END (UTRAN_CSG_Cells_Reporting_Desp_t) - -static const -CSN_DESCR_BEGIN(EUTRAN_CSG_Cells_Reporting_Desp_t) - M_NEXT_EXIST (EUTRAN_CSG_Cells_Reporting_Desp_t, existEUTRAN_CSG_FDD_REPORTING_THRESHOLD, 2), - M_UINT (EUTRAN_CSG_Cells_Reporting_Desp_t, EUTRAN_CSG_FDD_REPORTING_THRESHOLD, 3), - M_UINT (EUTRAN_CSG_Cells_Reporting_Desp_t, EUTRAN_CSG_FDD_REPORTING_THRESHOLD_2, 6), - M_NEXT_EXIST (EUTRAN_CSG_Cells_Reporting_Desp_t, existEUTRAN_CSG_TDD_REPORTING_THRESHOLD, 2), - M_UINT (EUTRAN_CSG_Cells_Reporting_Desp_t, EUTRAN_CSG_TDD_REPORTING_THRESHOLD, 3), - M_UINT (EUTRAN_CSG_Cells_Reporting_Desp_t, EUTRAN_CSG_TDD_REPORTING_THRESHOLD_2, 6), -CSN_DESCR_END (EUTRAN_CSG_Cells_Reporting_Desp_t) - - -static const -CSN_DESCR_BEGIN(CSG_Cells_Reporting_Desp_t) - M_NEXT_EXIST (CSG_Cells_Reporting_Desp_t, existUTRAN_CSG_Cells_Reporting_Description, 1), - M_TYPE (CSG_Cells_Reporting_Desp_t, UTRAN_CSG_Cells_Reporting_Description, UTRAN_CSG_Cells_Reporting_Desp_t), - M_NEXT_EXIST (CSG_Cells_Reporting_Desp_t, existEUTRAN_CSG_Cells_Reporting_Description, 1), - M_TYPE (CSG_Cells_Reporting_Desp_t, EUTRAN_CSG_Cells_Reporting_Description, EUTRAN_CSG_Cells_Reporting_Desp_t), -CSN_DESCR_END (CSG_Cells_Reporting_Desp_t) - -static const -CSN_DESCR_BEGIN (PriorityAndEUTRAN_ParametersDescription_PMO_t) - M_NEXT_EXIST (PriorityAndEUTRAN_ParametersDescription_PMO_t, existServingCellPriorityParametersDescription, 1), - M_TYPE (PriorityAndEUTRAN_ParametersDescription_PMO_t, ServingCellPriorityParametersDescription, ServingCellPriorityParametersDescription_t), - M_NEXT_EXIST (PriorityAndEUTRAN_ParametersDescription_PMO_t, existPriorityParametersDescription3G_PMO, 1), - M_TYPE (PriorityAndEUTRAN_ParametersDescription_PMO_t, PriorityParametersDescription3G_PMO, PriorityParametersDescription3G_PMO_t), - M_NEXT_EXIST (PriorityAndEUTRAN_ParametersDescription_PMO_t, existEUTRAN_ParametersDescription_PMO, 1), - M_TYPE (PriorityAndEUTRAN_ParametersDescription_PMO_t, EUTRAN_ParametersDescription_PMO, EUTRAN_ParametersDescription_PMO_t), -CSN_DESCR_END (PriorityAndEUTRAN_ParametersDescription_PMO_t) - - -static const -CSN_DESCR_BEGIN (Delete_All_Stored_Individual_Priorities_t) - M_NULL (Delete_All_Stored_Individual_Priorities_t, dummy), -CSN_DESCR_END (Delete_All_Stored_Individual_Priorities_t) - -static const -CSN_DESCR_BEGIN (Individual_UTRAN_Priority_FDD_t) - M_REC_ARRAY (Individual_UTRAN_Priority_FDD_t, FDD_ARFCN, Count, 14), -CSN_DESCR_END (Individual_UTRAN_Priority_FDD_t) - -static const -CSN_DESCR_BEGIN (Individual_UTRAN_Priority_TDD_t) - M_REC_ARRAY (Individual_UTRAN_Priority_TDD_t, TDD_ARFCN, Count, 14), -CSN_DESCR_END (Individual_UTRAN_Priority_TDD_t) - -static const -CSN_DESCR_BEGIN (Repeated_Individual_UTRAN_Priority_Parameters_t) - M_UNION (Repeated_Individual_UTRAN_Priority_Parameters_t, 2), - M_TYPE (Repeated_Individual_UTRAN_Priority_Parameters_t, u.Individual_UTRAN_Priority_FDD, Individual_UTRAN_Priority_FDD_t), - M_TYPE (Repeated_Individual_UTRAN_Priority_Parameters_t, u.Individual_UTRAN_Priority_TDD, Individual_UTRAN_Priority_TDD_t), - M_UINT (Repeated_Individual_UTRAN_Priority_Parameters_t, UTRAN_PRIORITY, 3), -CSN_DESCR_END (Repeated_Individual_UTRAN_Priority_Parameters_t) - -static const -CSN_DESCR_BEGIN (ThreeG_Individual_Priority_Parameters_Description_t) - M_NEXT_EXIST (ThreeG_Individual_Priority_Parameters_Description_t, Exist_DEFAULT_UTRAN_PRIORITY, 1), - M_UINT (ThreeG_Individual_Priority_Parameters_Description_t, DEFAULT_UTRAN_PRIORITY, 3), - M_REC_TARRAY (ThreeG_Individual_Priority_Parameters_Description_t, Repeated_Individual_UTRAN_Priority_Parameters, Repeated_Individual_UTRAN_Priority_Parameters_t, Repeated_Individual_UTRAN_Priority_Parameters_Count), -CSN_DESCR_END (ThreeG_Individual_Priority_Parameters_Description_t) - -static const -CSN_DESCR_BEGIN (Repeated_Individual_EUTRAN_Priority_Parameters_t) - M_REC_ARRAY (Repeated_Individual_EUTRAN_Priority_Parameters_t, EARFCN, Count, 16), - M_UINT (Repeated_Individual_EUTRAN_Priority_Parameters_t, EUTRAN_PRIORITY, 3), -CSN_DESCR_END (Repeated_Individual_EUTRAN_Priority_Parameters_t) - -static const -CSN_DESCR_BEGIN (EUTRAN_Individual_Priority_Parameters_Description_t) - M_NEXT_EXIST (EUTRAN_Individual_Priority_Parameters_Description_t, Exist_DEFAULT_EUTRAN_PRIORITY, 1), - M_UINT (EUTRAN_Individual_Priority_Parameters_Description_t, DEFAULT_EUTRAN_PRIORITY, 3), - M_REC_TARRAY (EUTRAN_Individual_Priority_Parameters_Description_t, Repeated_Individual_EUTRAN_Priority_Parameters, Repeated_Individual_EUTRAN_Priority_Parameters_t, Count), -CSN_DESCR_END (EUTRAN_Individual_Priority_Parameters_Description_t) - -static const -CSN_DESCR_BEGIN (Provide_Individual_Priorities_t) - M_UINT (Provide_Individual_Priorities_t, GERAN_PRIORITY, 3), - M_NEXT_EXIST (Provide_Individual_Priorities_t, Exist_3G_Individual_Priority_Parameters_Description, 1), - M_TYPE (Provide_Individual_Priorities_t, ThreeG_Individual_Priority_Parameters_Description, ThreeG_Individual_Priority_Parameters_Description_t), - M_NEXT_EXIST (Provide_Individual_Priorities_t, Exist_EUTRAN_Individual_Priority_Parameters_Description, 1), - M_TYPE (Provide_Individual_Priorities_t, EUTRAN_Individual_Priority_Parameters_Description, EUTRAN_Individual_Priority_Parameters_Description_t), - M_NEXT_EXIST (Provide_Individual_Priorities_t, Exist_T3230_timeout_value, 1), - M_UINT (Provide_Individual_Priorities_t, T3230_timeout_value, 3), -CSN_DESCR_END (Provide_Individual_Priorities_t) - -static const -CSN_DESCR_BEGIN (Individual_Priorities_t) - M_UNION (Individual_Priorities_t, 2), - M_TYPE (Individual_Priorities_t, u.Delete_All_Stored_Individual_Priorities, Delete_All_Stored_Individual_Priorities_t), - M_TYPE (Individual_Priorities_t, u.Provide_Individual_Priorities, Provide_Individual_Priorities_t), -CSN_DESCR_END (Individual_Priorities_t) - -static const -CSN_DESCR_BEGIN (PMO_AdditionsR9_t) - M_NEXT_EXIST (PMO_AdditionsR9_t, existEnhanced_Cell_Reselection_Parameters_Description, 1), - M_TYPE (PMO_AdditionsR9_t, Enhanced_Cell_Reselection_Parameters_Description, Enh_Cell_Reselect_Param_Desp_t), - M_NEXT_EXIST (PMO_AdditionsR9_t, existCSG_Cells_Reporting_Description, 1), - M_TYPE (PMO_AdditionsR9_t, CSG_Cells_Reporting_Description, CSG_Cells_Reporting_Desp_t), -CSN_DESCR_END (PMO_AdditionsR9_t) - -static const -CSN_DESCR_BEGIN (PMO_AdditionsR8_t) - M_NEXT_EXIST (PMO_AdditionsR8_t, existBA_IND_3G_PMO_IND, 2), - M_BIT (PMO_AdditionsR8_t, BA_IND_3G), - M_BIT (PMO_AdditionsR8_t, PMO_IND), - M_NEXT_EXIST (PMO_AdditionsR8_t, existPriorityAndEUTRAN_ParametersDescription_PMO, 1), - M_TYPE (PMO_AdditionsR8_t, PriorityAndEUTRAN_ParametersDescription_PMO, PriorityAndEUTRAN_ParametersDescription_PMO_t), - M_NEXT_EXIST (PMO_AdditionsR8_t, existIndividualPriorities_PMO, 1), - M_TYPE (PMO_AdditionsR8_t, IndividualPriorities_PMO, Individual_Priorities_t), - M_NEXT_EXIST (PMO_AdditionsR8_t, existThreeG_CSG_Description, 1), - M_TYPE (PMO_AdditionsR8_t, ThreeG_CSG_Description_PMO, ThreeG_CSG_Description_t), - M_NEXT_EXIST (PMO_AdditionsR8_t, existEUTRAN_CSG_Description, 1), - M_TYPE (PMO_AdditionsR8_t, EUTRAN_CSG_Description_PMO, EUTRAN_CSG_Description_t), - M_NEXT_EXIST (PMO_AdditionsR8_t, existMeasurement_Control_Parameters_Description, 1), - M_TYPE (PMO_AdditionsR8_t, Measurement_Control_Parameters_Description_PMO, Meas_Ctrl_Param_Desp_t), - M_NEXT_EXIST_OR_NULL (PMO_AdditionsR8_t, existAdditionsR9, 1), - M_TYPE (PMO_AdditionsR8_t, AdditionsR9, PMO_AdditionsR9_t), -CSN_DESCR_END (PMO_AdditionsR8_t) - -static const -CSN_DESCR_BEGIN (PMO_AdditionsR7_t) - M_NEXT_EXIST (PMO_AdditionsR7_t, existREPORTING_OFFSET_THRESHOLD_700, 2), - M_UINT (PMO_AdditionsR7_t, REPORTING_OFFSET_700, 3), - M_UINT (PMO_AdditionsR7_t, REPORTING_THRESHOLD_700, 3), - - M_NEXT_EXIST (PMO_AdditionsR7_t, existREPORTING_OFFSET_THRESHOLD_810, 2), - M_UINT (PMO_AdditionsR7_t, REPORTING_OFFSET_810, 3), - M_UINT (PMO_AdditionsR7_t, REPORTING_THRESHOLD_810, 3), - - M_NEXT_EXIST_OR_NULL (PMO_AdditionsR7_t, existAdditionsR8, 1), - M_TYPE (PMO_AdditionsR7_t, additionsR8, PMO_AdditionsR8_t), -CSN_DESCR_END (PMO_AdditionsR7_t) - -static const -CSN_DESCR_BEGIN (PMO_AdditionsR6_t) - M_UINT (PMO_AdditionsR6_t, CCN_ACTIVE_3G, 1), - M_NEXT_EXIST_OR_NULL (PMO_AdditionsR6_t, existAdditionsR7, 1), - M_TYPE (PMO_AdditionsR6_t, additionsR7, PMO_AdditionsR7_t), -CSN_DESCR_END (PMO_AdditionsR6_t) - -static const -CSN_DESCR_BEGIN(PCCO_AdditionsR6_t) - M_UINT (PCCO_AdditionsR6_t, CCN_ACTIVE_3G, 1), -CSN_DESCR_END (PCCO_AdditionsR6_t) - -static const -CSN_DESCR_BEGIN (PMO_AdditionsR5_t) - M_NEXT_EXIST (PMO_AdditionsR5_t, existGRNTI_Extension, 1), - M_UINT (PMO_AdditionsR5_t, GRNTI, 4), - M_NEXT_EXIST (PMO_AdditionsR5_t, exist_lu_ModeNeighbourCellParams, 1), - M_REC_TARRAY (PMO_AdditionsR5_t, lu_ModeNeighbourCellParams, lu_ModeNeighbourCellParams_t, count_lu_ModeNeighbourCellParams), - M_NEXT_EXIST (PMO_AdditionsR5_t, existNC_lu_ModeOnlyCapableCellList, 1), - M_TYPE (PMO_AdditionsR5_t, NC_lu_ModeOnlyCapableCellList, NC_lu_ModeOnlyCapableCellList_t), - M_NEXT_EXIST (PMO_AdditionsR5_t, existGPRS_AdditionalMeasurementParams3G, 1), - M_TYPE (PMO_AdditionsR5_t, GPRS_AdditionalMeasurementParams3G, GPRS_AdditionalMeasurementParams3G_t), - M_NEXT_EXIST_OR_NULL (PMO_AdditionsR5_t, existAdditionsR6, 1), - M_TYPE (PMO_AdditionsR5_t, additionsR6, PMO_AdditionsR6_t), -CSN_DESCR_END (PMO_AdditionsR5_t) - -static const -CSN_DESCR_BEGIN (PCCO_AdditionsR5_t) - M_NEXT_EXIST (PCCO_AdditionsR5_t, existGRNTI_Extension, 1), - M_UINT (PCCO_AdditionsR5_t, GRNTI, 4), - M_NEXT_EXIST (PCCO_AdditionsR5_t, exist_lu_ModeNeighbourCellParams, 1), - M_REC_TARRAY (PCCO_AdditionsR5_t, lu_ModeNeighbourCellParams, lu_ModeNeighbourCellParams_t, count_lu_ModeNeighbourCellParams), - M_NEXT_EXIST (PCCO_AdditionsR5_t, existNC_lu_ModeOnlyCapableCellList, 1), - M_TYPE (PCCO_AdditionsR5_t, NC_lu_ModeOnlyCapableCellList, NC_lu_ModeOnlyCapableCellList_t), - M_NEXT_EXIST (PCCO_AdditionsR5_t, existGPRS_AdditionalMeasurementParams3G, 1), - M_TYPE (PCCO_AdditionsR5_t, GPRS_AdditionalMeasurementParams3G, GPRS_AdditionalMeasurementParams3G_t), - M_NEXT_EXIST_OR_NULL (PCCO_AdditionsR5_t, existAdditionsR6, 1), - M_TYPE (PCCO_AdditionsR5_t, additionsR6, PCCO_AdditionsR6_t), -CSN_DESCR_END (PCCO_AdditionsR5_t) - -static const -CSN_DESCR_BEGIN (PMO_AdditionsR4_t) - M_UINT (PMO_AdditionsR4_t, CCN_ACTIVE, 1), - M_NEXT_EXIST (PMO_AdditionsR4_t, Exist_CCN_Support_Description_ID, 1), - M_TYPE (PMO_AdditionsR4_t, CCN_Support_Description, CCN_Support_Description_t), - M_NEXT_EXIST_OR_NULL (PMO_AdditionsR4_t, Exist_AdditionsR5, 1), - M_TYPE (PMO_AdditionsR4_t, AdditionsR5, PMO_AdditionsR5_t), -CSN_DESCR_END (PMO_AdditionsR4_t) - -static const -CSN_DESCR_BEGIN (PMO_AdditionsR99_t) - M_NEXT_EXIST (PMO_AdditionsR99_t, Exist_ENH_Measurement_Parameters, 1), - M_TYPE (PMO_AdditionsR99_t, ENH_Measurement_Parameters, ENH_Measurement_Parameters_PMO_t), - M_NEXT_EXIST_OR_NULL (PMO_AdditionsR99_t, Exist_AdditionsR4, 1), - M_TYPE (PMO_AdditionsR99_t, AdditionsR4, PMO_AdditionsR4_t), -CSN_DESCR_END (PMO_AdditionsR99_t) - -static const -CSN_DESCR_BEGIN (PCCO_AdditionsR4_t) - M_UINT (PCCO_AdditionsR4_t, CCN_ACTIVE, 1), - M_NEXT_EXIST (PCCO_AdditionsR4_t, Exist_Container_ID, 1), - M_UINT (PCCO_AdditionsR4_t, CONTAINER_ID, 2), - M_NEXT_EXIST (PCCO_AdditionsR4_t, Exist_CCN_Support_Description_ID, 1), - M_TYPE (PCCO_AdditionsR4_t, CCN_Support_Description, CCN_Support_Description_t), - M_NEXT_EXIST_OR_NULL (PCCO_AdditionsR4_t, Exist_AdditionsR5, 1), - M_TYPE (PCCO_AdditionsR4_t, AdditionsR5, PCCO_AdditionsR5_t), -CSN_DESCR_END (PCCO_AdditionsR4_t) - -static const -CSN_DESCR_BEGIN (PCCO_AdditionsR99_t) - M_TYPE (PCCO_AdditionsR99_t, ENH_Measurement_Parameters, ENH_Measurement_Parameters_PCCO_t), - M_NEXT_EXIST_OR_NULL (PCCO_AdditionsR99_t, Exist_AdditionsR4, 1), - M_TYPE (PCCO_AdditionsR99_t, AdditionsR4, PCCO_AdditionsR4_t), -CSN_DESCR_END (PCCO_AdditionsR99_t) - -static const -CSN_DESCR_BEGIN(LSA_ID_Info_Element_t) - M_UNION (LSA_ID_Info_Element_t, 2), - M_UINT (LSA_ID_Info_Element_t, u.LSA_ID, 24), - M_UINT (LSA_ID_Info_Element_t, u.ShortLSA_ID, 10), -CSN_DESCR_END (LSA_ID_Info_Element_t) - -static const -CSN_DESCR_BEGIN(LSA_ID_Info_t) - M_REC_TARRAY (LSA_ID_Info_t, LSA_ID_Info_Elements, LSA_ID_Info_Element_t, Count_LSA_ID_Info_Element), -CSN_DESCR_END (LSA_ID_Info_t) - -static const -CSN_DESCR_BEGIN(LSA_Parameters_t) - M_UINT (LSA_Parameters_t, NR_OF_FREQ_OR_CELLS, 5), - M_VAR_TARRAY (LSA_Parameters_t, LSA_ID_Info, LSA_ID_Info_t, NR_OF_FREQ_OR_CELLS), -CSN_DESCR_END (LSA_Parameters_t) - -static const -CSN_DESCR_BEGIN (PMO_AdditionsR98_t) - M_NEXT_EXIST (PMO_AdditionsR98_t, Exist_LSA_Parameters, 1), - M_TYPE (PMO_AdditionsR98_t, LSA_Parameters, LSA_Parameters_t), - - M_NEXT_EXIST_OR_NULL (PMO_AdditionsR98_t, Exist_AdditionsR99, 1), - M_TYPE (PMO_AdditionsR98_t, AdditionsR99, PMO_AdditionsR99_t), -CSN_DESCR_END (PMO_AdditionsR98_t) - -static const -CSN_DESCR_BEGIN (PCCO_AdditionsR98_t) - M_NEXT_EXIST (PCCO_AdditionsR98_t, Exist_LSA_Parameters, 1), - M_TYPE (PCCO_AdditionsR98_t, LSA_Parameters, LSA_Parameters_t), - - M_NEXT_EXIST_OR_NULL (PCCO_AdditionsR98_t, Exist_AdditionsR99, 1), - M_TYPE (PCCO_AdditionsR98_t, AdditionsR99, PCCO_AdditionsR99_t), -CSN_DESCR_END (PCCO_AdditionsR98_t) - -static const -CSN_DESCR_BEGIN (Target_Cell_GSM_t) - M_UINT (Target_Cell_GSM_t, IMMEDIATE_REL, 1), - M_UINT (Target_Cell_GSM_t, ARFCN, 10), - M_UINT (Target_Cell_GSM_t, BSIC, 6), - M_TYPE (Target_Cell_GSM_t, NC_Measurement_Parameters, NC_Measurement_Parameters_with_Frequency_List_t), - M_NEXT_EXIST_OR_NULL (Target_Cell_GSM_t, Exist_AdditionsR98, 1), - M_TYPE (Target_Cell_GSM_t, AdditionsR98, PCCO_AdditionsR98_t), -CSN_DESCR_END (Target_Cell_GSM_t) - -static const -CSN_DESCR_BEGIN (Target_Cell_3G_AdditionsR8_t) - M_NEXT_EXIST (Target_Cell_3G_AdditionsR8_t, Exist_EUTRAN_Target_Cell, 1), - M_TYPE (Target_Cell_3G_AdditionsR8_t, EUTRAN_Target_Cell, EUTRAN_Target_Cell_t), - M_NEXT_EXIST (Target_Cell_3G_AdditionsR8_t, Exist_Individual_Priorities, 1), - M_TYPE (Target_Cell_3G_AdditionsR8_t, Individual_Priorities, Individual_Priorities_t), -CSN_DESCR_END (Target_Cell_3G_AdditionsR8_t) - -static const -CSN_DESCR_BEGIN (Target_Cell_3G_AdditionsR5_t) - M_NEXT_EXIST (Target_Cell_3G_AdditionsR5_t, Exist_G_RNTI_Extention, 1), - M_UINT (Target_Cell_3G_AdditionsR5_t, G_RNTI_Extention, 4), - M_NEXT_EXIST_OR_NULL (Target_Cell_3G_AdditionsR5_t, Exist_AdditionsR8, 1), - M_TYPE (Target_Cell_3G_AdditionsR5_t, AdditionsR8, Target_Cell_3G_AdditionsR8_t), -CSN_DESCR_END (Target_Cell_3G_AdditionsR5_t) - -static const -CSN_DESCR_BEGIN(Target_Cell_3G_t) - /* 00 -- Message escape */ - M_FIXED (Target_Cell_3G_t, 2, 0x00), - M_UINT (Target_Cell_3G_t, IMMEDIATE_REL, 1), - M_NEXT_EXIST (Target_Cell_3G_t, Exist_FDD_Description, 1), - M_TYPE (Target_Cell_3G_t, FDD_Target_Cell, FDD_Target_Cell_t), - M_NEXT_EXIST (Target_Cell_3G_t, Exist_TDD_Description, 1), - M_TYPE (Target_Cell_3G_t, TDD_Target_Cell, TDD_Target_Cell_t), - M_NEXT_EXIST_OR_NULL (Target_Cell_3G_t, Exist_AdditionsR5, 1), - M_TYPE (Target_Cell_3G_t, AdditionsR5, Target_Cell_3G_AdditionsR5_t), -CSN_DESCR_END (Target_Cell_3G_t) - -static const -CSN_DESCR_BEGIN(Packet_Cell_Change_Order_t) - M_UINT (Packet_Cell_Change_Order_t, MESSAGE_TYPE, 6), - M_UINT (Packet_Cell_Change_Order_t, PAGE_MODE, 2), - - M_TYPE (Packet_Cell_Change_Order_t, ID, PacketCellChangeOrderID_t), - - M_UNION (Packet_Cell_Change_Order_t, 2), - M_TYPE (Packet_Cell_Change_Order_t, u.Target_Cell_GSM, Target_Cell_GSM_t), - M_TYPE (Packet_Cell_Change_Order_t, u.Target_Cell_3G, Target_Cell_3G_t), -CSN_DESCR_END (Packet_Cell_Change_Order_t) - -/*< Packet (Enhanced) Measurement Report message contents > */ -static const -CSN_DESCR_BEGIN(BA_USED_t) - M_UINT (BA_USED_t, BA_USED, 1), - M_UINT (BA_USED_t, BA_USED_3G, 1), -CSN_DESCR_END (BA_USED_t) - -static const -CSN_DESCR_BEGIN(Serving_Cell_Data_t) - M_UINT (Serving_Cell_Data_t, RXLEV_SERVING_CELL, 6), - M_FIXED (Serving_Cell_Data_t, 1, 0), -CSN_DESCR_END (Serving_Cell_Data_t) - -static const -CSN_DESCR_BEGIN(NC_Measurements_t) - M_UINT (NC_Measurements_t, FREQUENCY_N, 6), - - M_NEXT_EXIST (NC_Measurements_t, Exist_BSIC_N, 1), - M_UINT (NC_Measurements_t, BSIC_N, 6), - M_UINT (NC_Measurements_t, RXLEV_N, 6), -CSN_DESCR_END (NC_Measurements_t) - -static const -CSN_DESCR_BEGIN(RepeatedInvalid_BSIC_Info_t) - M_UINT (RepeatedInvalid_BSIC_Info_t, BCCH_FREQ_N, 5), - M_UINT (RepeatedInvalid_BSIC_Info_t, BSIC_N, 6), - M_UINT (RepeatedInvalid_BSIC_Info_t, RXLEV_N, 6), -CSN_DESCR_END (RepeatedInvalid_BSIC_Info_t) - -static const -CSN_DESCR_BEGIN(REPORTING_QUANTITY_Instance_t) - M_NEXT_EXIST (REPORTING_QUANTITY_Instance_t, Exist_REPORTING_QUANTITY, 1), - M_UINT (REPORTING_QUANTITY_Instance_t, REPORTING_QUANTITY, 6), -CSN_DESCR_END (REPORTING_QUANTITY_Instance_t) - -static const -CSN_DESCR_BEGIN(NC_Measurement_Report_t) - M_UINT (NC_Measurement_Report_t, NC_MODE, 1), - M_TYPE (NC_Measurement_Report_t, Serving_Cell_Data, Serving_Cell_Data_t), - M_UINT (NC_Measurement_Report_t, NUMBER_OF_NC_MEASUREMENTS, 3), - M_VAR_TARRAY (NC_Measurement_Report_t, NC_Measurements, NC_Measurements_t, NUMBER_OF_NC_MEASUREMENTS), -CSN_DESCR_END (NC_Measurement_Report_t) - -static const -CSN_DESCR_BEGIN(ENH_NC_Measurement_Report_t) - M_UINT (ENH_NC_Measurement_Report_t, NC_MODE, 1), - M_UNION (ENH_NC_Measurement_Report_t, 2), - M_TYPE (ENH_NC_Measurement_Report_t, u.BA_USED, BA_USED_t), - M_UINT (ENH_NC_Measurement_Report_t, u.PSI3_CHANGE_MARK, 2), - M_UINT (ENH_NC_Measurement_Report_t, PMO_USED, 1), - M_UINT (ENH_NC_Measurement_Report_t, BSIC_Seen, 1), - M_UINT (ENH_NC_Measurement_Report_t, SCALE, 1), - M_NEXT_EXIST (ENH_NC_Measurement_Report_t, Exist_Serving_Cell_Data, 1), - M_TYPE (ENH_NC_Measurement_Report_t, Serving_Cell_Data, Serving_Cell_Data_t), - M_REC_TARRAY (ENH_NC_Measurement_Report_t, RepeatedInvalid_BSIC_Info[0], RepeatedInvalid_BSIC_Info_t, Count_RepeatedInvalid_BSIC_Info), - M_NEXT_EXIST (ENH_NC_Measurement_Report_t, Exist_ReportBitmap, 1), - M_VAR_TARRAY (ENH_NC_Measurement_Report_t, REPORTING_QUANTITY_Instances, REPORTING_QUANTITY_Instance_t, Count_REPORTING_QUANTITY_Instances), -CSN_DESCR_END (ENH_NC_Measurement_Report_t) - - -static const -CSN_DESCR_BEGIN(EXT_Measurement_Report_t) - M_UINT (EXT_Measurement_Report_t, EXT_REPORTING_TYPE, 2), - - M_NEXT_EXIST (EXT_Measurement_Report_t, Exist_I_LEVEL, 1), - - M_NEXT_EXIST (EXT_Measurement_Report_t, Slot[0].Exist, 1), - M_UINT (EXT_Measurement_Report_t, Slot[0].I_LEVEL, 6), - - M_NEXT_EXIST (EXT_Measurement_Report_t, Slot[1].Exist, 1), - M_UINT (EXT_Measurement_Report_t, Slot[1].I_LEVEL, 6), - - M_NEXT_EXIST (EXT_Measurement_Report_t, Slot[2].Exist, 1), - M_UINT (EXT_Measurement_Report_t, Slot[2].I_LEVEL, 6), - - M_NEXT_EXIST (EXT_Measurement_Report_t, Slot[3].Exist, 1), - M_UINT (EXT_Measurement_Report_t, Slot[3].I_LEVEL, 6), - - M_NEXT_EXIST (EXT_Measurement_Report_t, Slot[4].Exist, 1), - M_UINT (EXT_Measurement_Report_t, Slot[4].I_LEVEL, 6), - - M_NEXT_EXIST (EXT_Measurement_Report_t, Slot[5].Exist, 1), - M_UINT (EXT_Measurement_Report_t, Slot[5].I_LEVEL, 6), - - M_NEXT_EXIST (EXT_Measurement_Report_t, Slot[6].Exist, 1), - M_UINT (EXT_Measurement_Report_t, Slot[6].I_LEVEL, 6), - - M_NEXT_EXIST (EXT_Measurement_Report_t, Slot[7].Exist, 1), - M_UINT (EXT_Measurement_Report_t, Slot[7].I_LEVEL, 6), - - M_UINT (EXT_Measurement_Report_t, NUMBER_OF_EXT_MEASUREMENTS, 5), - M_VAR_TARRAY (EXT_Measurement_Report_t, EXT_Measurements, NC_Measurements_t, NUMBER_OF_EXT_MEASUREMENTS), -CSN_DESCR_END (EXT_Measurement_Report_t) - -static const -CSN_DESCR_BEGIN (Measurements_3G_t) - M_UINT (Measurements_3G_t, CELL_LIST_INDEX_3G, 7), - M_UINT (Measurements_3G_t, REPORTING_QUANTITY, 6), -CSN_DESCR_END (Measurements_3G_t) - -static const -CSN_DESCR_BEGIN (EUTRAN_Measurement_Report_Body_t) - M_UINT (EUTRAN_Measurement_Report_Body_t, EUTRAN_FREQUENCY_INDEX, 3), - M_UINT (EUTRAN_Measurement_Report_Body_t, CELL_IDENTITY, 9), - M_UINT (EUTRAN_Measurement_Report_Body_t, REPORTING_QUANTITY, 6), -CSN_DESCR_END (EUTRAN_Measurement_Report_Body_t) - -static const -CSN_DESCR_BEGIN (EUTRAN_Measurement_Report_t) - M_UINT_OFFSET (EUTRAN_Measurement_Report_t, N_EUTRAN, 2, 1), - M_VAR_TARRAY (EUTRAN_Measurement_Report_t, Report, EUTRAN_Measurement_Report_Body_t, N_EUTRAN), -CSN_DESCR_END (EUTRAN_Measurement_Report_t) - -static const -CSN_DESCR_BEGIN(UTRAN_CSG_Measurement_Report_t) - M_UINT (UTRAN_CSG_Measurement_Report_t, UTRAN_CGI, 28), - M_NEXT_EXIST (UTRAN_CSG_Measurement_Report_t, Exist_PLMN_ID, 1), - M_TYPE (UTRAN_CSG_Measurement_Report_t, Plmn_ID, PLMN_t), - M_UINT (UTRAN_CSG_Measurement_Report_t, CSG_ID, 27), - M_BIT (UTRAN_CSG_Measurement_Report_t, Access_Mode), - M_UINT (UTRAN_CSG_Measurement_Report_t, REPORTING_QUANTITY, 6), -CSN_DESCR_END (UTRAN_CSG_Measurement_Report_t) - -static const -CSN_DESCR_BEGIN(EUTRAN_CSG_Measurement_Report_t) - M_UINT (EUTRAN_CSG_Measurement_Report_t, EUTRAN_CGI, 28), - M_UINT (EUTRAN_CSG_Measurement_Report_t, Tracking_Area_Code, 16), - M_NEXT_EXIST (EUTRAN_CSG_Measurement_Report_t, Exist_PLMN_ID, 1), - M_TYPE (EUTRAN_CSG_Measurement_Report_t, Plmn_ID, PLMN_t), - M_UINT (EUTRAN_CSG_Measurement_Report_t, CSG_ID, 27), - M_BIT (EUTRAN_CSG_Measurement_Report_t, Access_Mode), - M_UINT (EUTRAN_CSG_Measurement_Report_t, REPORTING_QUANTITY, 6), -CSN_DESCR_END (EUTRAN_CSG_Measurement_Report_t) - -static const -CSN_DESCR_BEGIN (PMR_AdditionsR9_t) - M_NEXT_EXIST (PMR_AdditionsR9_t, Exist_UTRAN_CSG_Meas_Rpt, 1), - M_TYPE (PMR_AdditionsR9_t, UTRAN_CSG_Meas_Rpt, UTRAN_CSG_Measurement_Report_t), - M_NEXT_EXIST (PMR_AdditionsR9_t, Exist_EUTRAN_CSG_Meas_Rpt, 1), - M_TYPE (PMR_AdditionsR9_t, EUTRAN_CSG_Meas_Rpt, EUTRAN_CSG_Measurement_Report_t), -CSN_DESCR_END (PMR_AdditionsR9_t) - -static const -CSN_DESCR_BEGIN (PMR_AdditionsR8_t) - M_NEXT_EXIST (PMR_AdditionsR8_t, Exist_EUTRAN_Meas_Rpt, 1), - M_TYPE (PMR_AdditionsR8_t, EUTRAN_Meas_Rpt, EUTRAN_Measurement_Report_t), - M_NEXT_EXIST_OR_NULL(PMR_AdditionsR8_t, Exist_AdditionsR9, 1), - M_TYPE (PMR_AdditionsR8_t, AdditionsR9, PMR_AdditionsR9_t), -CSN_DESCR_END (PMR_AdditionsR8_t) - -static const -CSN_DESCR_BEGIN (PMR_AdditionsR5_t) - M_NEXT_EXIST (PMR_AdditionsR5_t, Exist_GRNTI, 4), - M_UINT (PMR_AdditionsR5_t, GRNTI, 4), - M_NEXT_EXIST_OR_NULL (PMR_AdditionsR5_t, Exist_AdditionsR8, 1), - M_TYPE (PMR_AdditionsR5_t, AdditionsR8, PMR_AdditionsR8_t), -CSN_DESCR_END (PMR_AdditionsR5_t) - -static const -CSN_DESCR_BEGIN (PMR_AdditionsR99_t) - M_NEXT_EXIST (PMR_AdditionsR99_t, Exist_Info3G, 4), - M_UNION (PMR_AdditionsR99_t, 2), - M_TYPE (PMR_AdditionsR99_t, u.BA_USED, BA_USED_t), - M_UINT (PMR_AdditionsR99_t, u.PSI3_CHANGE_MARK, 2), - M_UINT (PMR_AdditionsR99_t, PMO_USED, 1), - - M_NEXT_EXIST (PMR_AdditionsR99_t, Exist_MeasurementReport3G, 2), - M_UINT_OFFSET (PMR_AdditionsR99_t, N_3G, 3, 1), /* offset 1 */ - M_VAR_TARRAY_OFFSET (PMR_AdditionsR99_t, Measurements_3G, Measurements_3G_t, N_3G), - - M_NEXT_EXIST_OR_NULL (PMR_AdditionsR99_t, Exist_AdditionsR5, 1), - M_TYPE (PMR_AdditionsR99_t, AdditionsR5, PMR_AdditionsR5_t), -CSN_DESCR_END (PMR_AdditionsR99_t) - -static const -CSN_DESCR_BEGIN(EMR_ServingCell_t) - /*CSN_MEMBER_BIT (EMR_ServingCell_t, DTX_USED),*/ - M_BIT (EMR_ServingCell_t, DTX_USED), - M_UINT (EMR_ServingCell_t, RXLEV_VAL, 6), - M_UINT (EMR_ServingCell_t, RX_QUAL_FULL, 3), - M_UINT (EMR_ServingCell_t, MEAN_BEP, 5), - M_UINT (EMR_ServingCell_t, CV_BEP, 3), - M_UINT (EMR_ServingCell_t, NBR_RCVD_BLOCKS, 5), -CSN_DESCR_END(EMR_ServingCell_t) - -static const -CSN_DESCR_BEGIN (EnhancedMeasurementReport_t) - M_UINT (EnhancedMeasurementReport_t, RR_Short_PD, 1), - M_UINT (EnhancedMeasurementReport_t, MESSAGE_TYPE, 5), - M_UINT (EnhancedMeasurementReport_t, ShortLayer2_Header, 2), - M_TYPE (EnhancedMeasurementReport_t, BA_USED, BA_USED_t), - M_UINT (EnhancedMeasurementReport_t, BSIC_Seen, 1), - M_UINT (EnhancedMeasurementReport_t, SCALE, 1), - M_NEXT_EXIST (EnhancedMeasurementReport_t, Exist_ServingCellData, 1), - M_TYPE (EnhancedMeasurementReport_t, ServingCellData, EMR_ServingCell_t), - M_REC_TARRAY (EnhancedMeasurementReport_t, RepeatedInvalid_BSIC_Info[0], RepeatedInvalid_BSIC_Info_t, - Count_RepeatedInvalid_BSIC_Info), - M_NEXT_EXIST (EnhancedMeasurementReport_t, Exist_ReportBitmap, 1), - M_VAR_TARRAY (EnhancedMeasurementReport_t, REPORTING_QUANTITY_Instances, REPORTING_QUANTITY_Instance_t, Count_REPORTING_QUANTITY_Instances), -CSN_DESCR_END (EnhancedMeasurementReport_t) - -static const -CSN_DESCR_BEGIN (Packet_Measurement_Report_t) - /* Mac header */ - M_UINT (Packet_Measurement_Report_t, PayloadType, 2), - M_UINT (Packet_Measurement_Report_t, spare, 5), - M_UINT (Packet_Measurement_Report_t, R, 1), - M_UINT (Packet_Measurement_Report_t, MESSAGE_TYPE, 6), - /* Mac header */ - - M_UINT (Packet_Measurement_Report_t, TLLI, 32), - - M_NEXT_EXIST (Packet_Measurement_Report_t, Exist_PSI5_CHANGE_MARK, 1), - M_UINT (Packet_Measurement_Report_t, PSI5_CHANGE_MARK, 2), - - M_UNION (Packet_Measurement_Report_t, 2), - M_TYPE (Packet_Measurement_Report_t, u.NC_Measurement_Report, NC_Measurement_Report_t), - M_TYPE (Packet_Measurement_Report_t, u.EXT_Measurement_Report, EXT_Measurement_Report_t), - - M_NEXT_EXIST_OR_NULL(Packet_Measurement_Report_t, Exist_AdditionsR99, 1), - M_TYPE (Packet_Measurement_Report_t, AdditionsR99, PMR_AdditionsR99_t), -CSN_DESCR_END (Packet_Measurement_Report_t) - -static const -CSN_DESCR_BEGIN (PEMR_AdditionsR9_t) - M_NEXT_EXIST (PEMR_AdditionsR9_t, Exist_UTRAN_CSG_Target_Cell, 1), - M_TYPE (PEMR_AdditionsR9_t, UTRAN_CSG_Target_Cell, UTRAN_CSG_Target_Cell_t), - M_NEXT_EXIST (PEMR_AdditionsR9_t, Exist_EUTRAN_CSG_Target_Cell, 1), - M_TYPE (PEMR_AdditionsR9_t, EUTRAN_CSG_Target_Cell, EUTRAN_CSG_Target_Cell_t), -CSN_DESCR_END (PEMR_AdditionsR9_t) - -static const -CSN_DESCR_BEGIN (Bitmap_Report_Quantity_t) - M_NEXT_EXIST (Bitmap_Report_Quantity_t, Exist_REPORTING_QUANTITY, 1), - M_UINT (Bitmap_Report_Quantity_t, REPORTING_QUANTITY, 6), -CSN_DESCR_END (Bitmap_Report_Quantity_t) - -static const -CSN_DESCR_BEGIN (PEMR_AdditionsR8_t) - M_UINT_OFFSET (PEMR_AdditionsR8_t, BITMAP_LENGTH, 7, 1), - M_VAR_TARRAY (PEMR_AdditionsR8_t, Bitmap_Report_Quantity, Bitmap_Report_Quantity_t, BITMAP_LENGTH), - M_NEXT_EXIST (PEMR_AdditionsR8_t, Exist_EUTRAN_Meas_Rpt, 1), - M_TYPE (PEMR_AdditionsR8_t, EUTRAN_Meas_Rpt, EUTRAN_Measurement_Report_t), - M_NEXT_EXIST_OR_NULL(PEMR_AdditionsR8_t, Exist_AdditionsR9, 1), - M_TYPE (PEMR_AdditionsR8_t, AdditionsR9, PEMR_AdditionsR9_t), -CSN_DESCR_END (PEMR_AdditionsR8_t) - -static const -CSN_DESCR_BEGIN (PEMR_AdditionsR5_t) - M_NEXT_EXIST (PEMR_AdditionsR5_t, Exist_GRNTI_Ext, 1), - M_UINT (PEMR_AdditionsR5_t, GRNTI_Ext, 4), - M_NEXT_EXIST_OR_NULL(PEMR_AdditionsR5_t, Exist_AdditionsR8, 1), - M_TYPE (PEMR_AdditionsR5_t, AdditionsR8, PEMR_AdditionsR8_t), -CSN_DESCR_END (PEMR_AdditionsR5_t) - - -static const -CSN_DESCR_BEGIN (Packet_Enh_Measurement_Report_t) - /* Mac header */ - M_UINT (Packet_Enh_Measurement_Report_t, PayloadType, 2), - M_UINT (Packet_Enh_Measurement_Report_t, spare, 5), - M_UINT (Packet_Enh_Measurement_Report_t, R, 1), - M_UINT (Packet_Enh_Measurement_Report_t, MESSAGE_TYPE, 6), - /* Mac header */ - - M_UINT (Packet_Enh_Measurement_Report_t, TLLI, 32), - - M_TYPE (Packet_Enh_Measurement_Report_t, Measurements, ENH_NC_Measurement_Report_t), - - M_NEXT_EXIST_OR_NULL(Packet_Enh_Measurement_Report_t, Exist_AdditionsR5, 1), - M_TYPE (Packet_Enh_Measurement_Report_t, AdditionsR5, PEMR_AdditionsR5_t), -CSN_DESCR_END (Packet_Enh_Measurement_Report_t) - -/*< Packet Measurement Order message contents >*/ -static const -CSN_DESCR_BEGIN(EXT_Frequency_List_t) - M_UINT (EXT_Frequency_List_t, START_FREQUENCY, 10), - M_UINT (EXT_Frequency_List_t, NR_OF_FREQUENCIES, 5), - M_UINT (EXT_Frequency_List_t, FREQ_DIFF_LENGTH, 3), - -/* TBD: Count_FREQUENCY_DIFF - * guint8 FREQUENCY_DIFF[31]; - * bit (FREQ_DIFF_LENGTH) * NR_OF_FREQUENCIES --> MAX is bit(7) * 31 - */ -CSN_DESCR_END (EXT_Frequency_List_t) - -static const -CSN_DESCR_BEGIN (Packet_Measurement_Order_t) - M_UINT (Packet_Measurement_Order_t, MESSAGE_TYPE, 6), - M_UINT (Packet_Measurement_Order_t, PAGE_MODE, 2), - - M_TYPE (Packet_Measurement_Order_t, ID, PacketDownlinkID_t), /* reuse the PDA ID type */ - - M_UINT (Packet_Measurement_Order_t, PMO_INDEX, 3), - M_UINT (Packet_Measurement_Order_t, PMO_COUNT, 3), - - M_NEXT_EXIST (Packet_Measurement_Order_t, Exist_NC_Measurement_Parameters, 1), - M_TYPE (Packet_Measurement_Order_t, NC_Measurement_Parameters, NC_Measurement_Parameters_with_Frequency_List_t), - - M_NEXT_EXIST (Packet_Measurement_Order_t, Exist_EXT_Measurement_Parameters, 1), - M_FIXED (Packet_Measurement_Order_t, 2, 0x0), /* EXT_Measurement_Parameters not handled */ - - M_NEXT_EXIST_OR_NULL (Packet_Measurement_Order_t, Exist_AdditionsR98, 1), - M_TYPE (Packet_Measurement_Order_t, AdditionsR98, PMO_AdditionsR98_t), -CSN_DESCR_END (Packet_Measurement_Order_t) - -static const -CSN_DESCR_BEGIN(CCN_Measurement_Report_t) - M_UINT (CCN_Measurement_Report_t, RXLEV_SERVING_CELL, 6), - M_FIXED (CCN_Measurement_Report_t, 1, 0), - M_UINT (CCN_Measurement_Report_t, NUMBER_OF_NC_MEASUREMENTS, 3), - M_VAR_TARRAY (CCN_Measurement_Report_t, NC_Measurements, NC_Measurements_t, NUMBER_OF_NC_MEASUREMENTS), -CSN_DESCR_END (CCN_Measurement_Report_t) - -static const -CSN_DESCR_BEGIN(Target_Cell_GSM_Notif_t) - M_UINT (Target_Cell_GSM_Notif_t, ARFCN, 10), - M_UINT (Target_Cell_GSM_Notif_t, BSIC, 6), -CSN_DESCR_END (Target_Cell_GSM_Notif_t) - -static const -CSN_DESCR_BEGIN(FDD_Target_Cell_Notif_t) - M_UINT (FDD_Target_Cell_Notif_t, FDD_ARFCN, 14), - M_NEXT_EXIST (FDD_Target_Cell_Notif_t, Exist_Bandwith_FDD, 1), - M_UINT (FDD_Target_Cell_Notif_t, BANDWITH_FDD, 3), - M_UINT (FDD_Target_Cell_Notif_t, SCRAMBLING_CODE, 9), -CSN_DESCR_END (FDD_Target_Cell_Notif_t) - -static const -CSN_DESCR_BEGIN(TDD_Target_Cell_Notif_t) - M_UINT (TDD_Target_Cell_Notif_t, TDD_ARFCN, 14), - M_NEXT_EXIST (TDD_Target_Cell_Notif_t, Exist_Bandwith_TDD, 1), - M_UINT (TDD_Target_Cell_Notif_t, BANDWITH_TDD, 3), - M_UINT (TDD_Target_Cell_Notif_t, CELL_PARAMETER, 7), - M_UINT (TDD_Target_Cell_Notif_t, Sync_Case_TSTD, 1), -CSN_DESCR_END (TDD_Target_Cell_Notif_t) - -static const -CSN_DESCR_BEGIN(Target_Cell_3G_Notif_t) - M_NEXT_EXIST (Target_Cell_3G_Notif_t, Exist_FDD_Description, 1), - M_TYPE (Target_Cell_3G_Notif_t, FDD_Target_Cell_Notif, FDD_Target_Cell_Notif_t), - M_NEXT_EXIST (Target_Cell_3G_Notif_t, Exist_TDD_Description, 1), - M_TYPE (Target_Cell_3G_Notif_t, TDD_Target_Cell, TDD_Target_Cell_Notif_t), - M_UINT (Target_Cell_3G_Notif_t, REPORTING_QUANTITY, 6), -CSN_DESCR_END (Target_Cell_3G_Notif_t) - -static const -CSN_DESCR_BEGIN(Target_EUTRAN_Cell_Notif_t) - M_UINT (Target_EUTRAN_Cell_Notif_t, EARFCN, 16), - M_NEXT_EXIST (Target_EUTRAN_Cell_Notif_t, Exist_Measurement_Bandwidth, 1), - M_UINT (Target_EUTRAN_Cell_Notif_t, Measurement_Bandwidth, 3), - M_UINT (Target_EUTRAN_Cell_Notif_t, Physical_Layer_Cell_Identity, 9), - M_UINT (Target_EUTRAN_Cell_Notif_t, Reporting_Quantity, 6), -CSN_DESCR_END (Target_EUTRAN_Cell_Notif_t) - -static const -CSN_DESCR_BEGIN(Eutran_Ccn_Measurement_Report_Cell_t) - M_UINT (Eutran_Ccn_Measurement_Report_Cell_t, EUTRAN_FREQUENCY_INDEX, 3), - M_UINT (Eutran_Ccn_Measurement_Report_Cell_t, CELL_IDENTITY, 9), - M_UINT (Eutran_Ccn_Measurement_Report_Cell_t, REPORTING_QUANTITY, 6), -CSN_DESCR_END (Eutran_Ccn_Measurement_Report_Cell_t) - - -static const -CSN_DESCR_BEGIN(Eutran_Ccn_Measurement_Report_t) - M_BIT (Eutran_Ccn_Measurement_Report_t, ThreeG_BA_USED), - M_UINT_OFFSET(Eutran_Ccn_Measurement_Report_t, N_EUTRAN, 2, 1), - M_VAR_TARRAY (Eutran_Ccn_Measurement_Report_t, Eutran_Ccn_Measurement_Report_Cell, Eutran_Ccn_Measurement_Report_Cell_t, N_EUTRAN), -CSN_DESCR_END (Eutran_Ccn_Measurement_Report_t) - -static const -CSN_DESCR_BEGIN(Target_Cell_4G_Notif_t) - M_NEXT_EXIST (Target_Cell_4G_Notif_t, Exist_Arfcn, 2), - M_UINT (Target_Cell_4G_Notif_t, Arfcn, 10), - M_UINT (Target_Cell_4G_Notif_t, bsic, 6), - M_NEXT_EXIST (Target_Cell_4G_Notif_t, Exist_3G_Target_Cell, 1), - M_TYPE (Target_Cell_4G_Notif_t, Target_Cell_3G_Notif, Target_Cell_3G_Notif_t), - M_NEXT_EXIST (Target_Cell_4G_Notif_t, Exist_Eutran_Target_Cell, 1), - M_TYPE (Target_Cell_4G_Notif_t, Target_EUTRAN_Cell, Target_EUTRAN_Cell_Notif_t), - M_NEXT_EXIST (Target_Cell_4G_Notif_t, Exist_Eutran_Ccn_Measurement_Report, 1), - M_TYPE (Target_Cell_4G_Notif_t, Eutran_Ccn_Measurement_Report, Eutran_Ccn_Measurement_Report_t), -CSN_DESCR_END (Target_Cell_4G_Notif_t) - -static const -CSN_DESCR_BEGIN(Target_Cell_CSG_Notif_t) - M_FIXED (Target_Cell_CSG_Notif_t, 1, 0x00), - M_UNION (Target_Cell_CSG_Notif_t, 2), - M_TYPE (Target_Cell_CSG_Notif_t, u.UTRAN_CSG_Measurement_Report, UTRAN_CSG_Measurement_Report_t), - M_TYPE (Target_Cell_CSG_Notif_t, u.EUTRAN_CSG_Measurement_Report, EUTRAN_CSG_Measurement_Report_t), - M_NEXT_EXIST (Target_Cell_CSG_Notif_t, Exist_Eutran_Ccn_Measurement_Report, 1), - M_TYPE (Target_Cell_CSG_Notif_t, Eutran_Ccn_Measurement_Report, Eutran_Ccn_Measurement_Report_t), -CSN_DESCR_END (Target_Cell_CSG_Notif_t) - -static const -CSN_DESCR_BEGIN(Target_Other_RAT_2_Notif_t) - /* 110 vs 1110 */ - M_UNION (Target_Other_RAT_2_Notif_t, 2), - M_TYPE (Target_Other_RAT_2_Notif_t, u.Target_Cell_4G_Notif, Target_Cell_4G_Notif_t), - M_TYPE (Target_Other_RAT_2_Notif_t, u.Target_Cell_CSG_Notif, Target_Cell_CSG_Notif_t), -CSN_DESCR_END (Target_Other_RAT_2_Notif_t) - -static const -CSN_DESCR_BEGIN(Target_Other_RAT_Notif_t) - /* 10 vs 110 */ - M_UNION (Target_Other_RAT_Notif_t, 2), - M_TYPE (Target_Other_RAT_Notif_t, u.Target_Cell_3G_Notif, Target_Cell_3G_Notif_t), - M_TYPE (Target_Other_RAT_Notif_t, u.Target_Other_RAT_2_Notif, Target_Other_RAT_2_Notif_t), -CSN_DESCR_END (Target_Other_RAT_Notif_t) - -static const -CSN_DESCR_BEGIN(Target_Cell_t) - /* 0 vs 10 */ - M_UNION (Target_Cell_t, 2), - M_TYPE (Target_Cell_t, u.Target_Cell_GSM_Notif, Target_Cell_GSM_Notif_t), - M_TYPE (Target_Cell_t, u.Target_Other_RAT_Notif, Target_Other_RAT_Notif_t), -CSN_DESCR_END (Target_Cell_t) - -static const -CSN_DESCR_BEGIN (PCCN_AdditionsR6_t) - M_NEXT_EXIST (PCCN_AdditionsR6_t, Exist_BA_USED_3G, 1), - M_UINT (PCCN_AdditionsR6_t, BA_USED_3G, 1), - - M_UINT_OFFSET (PCCN_AdditionsR6_t, N_3G, 3, 1), /* offset 1 */ - M_VAR_TARRAY_OFFSET (PCCN_AdditionsR6_t, Measurements_3G, Measurements_3G_t, N_3G), -CSN_DESCR_END (PCCN_AdditionsR6_t) - -/*< Packet Cell Change Notification message contents > */ -static const -CSN_DESCR_BEGIN(Packet_Cell_Change_Notification_t) - /* Mac header */ - M_UINT (Packet_Cell_Change_Notification_t, PayloadType, 2), - M_UINT (Packet_Cell_Change_Notification_t, spare, 5), - M_UINT (Packet_Cell_Change_Notification_t, R, 1), - M_UINT (Packet_Cell_Change_Notification_t, MESSAGE_TYPE, 6), - /* Mac header */ - - M_TYPE (Packet_Cell_Change_Notification_t, Global_TFI, Global_TFI_t), - M_TYPE (Packet_Cell_Change_Notification_t, Target_Cell, Target_Cell_t), - - M_UNION (Packet_Cell_Change_Notification_t, 2), - M_UINT (Packet_Cell_Change_Notification_t, u.BA_IND, 1), - M_UINT (Packet_Cell_Change_Notification_t, u.PSI3_CHANGE_MARK, 2), - - M_UINT (Packet_Cell_Change_Notification_t, PMO_USED, 1), - M_UINT (Packet_Cell_Change_Notification_t, PCCN_SENDING, 1), - M_TYPE (Packet_Cell_Change_Notification_t, CCN_Measurement_Report, CCN_Measurement_Report_t), - - M_NEXT_EXIST_OR_NULL(Packet_Cell_Change_Notification_t, Exist_AdditionsR6, 1), - M_TYPE (Packet_Cell_Change_Notification_t, AdditionsR6, PCCN_AdditionsR6_t), -CSN_DESCR_END (Packet_Cell_Change_Notification_t) - -/*< Packet Cell Change Continue message contents > */ -static const -CSN_DESCR_BEGIN(Packet_Cell_Change_Continue_t) - M_UINT (Packet_Cell_Change_Continue_t, MESSAGE_TYPE, 6), - M_UINT (Packet_Cell_Change_Continue_t, PAGE_MODE, 2), - M_FIXED (Packet_Cell_Change_Continue_t, 1, 0x00), - M_TYPE (Packet_Cell_Change_Continue_t, Global_TFI, Global_TFI_t), - - M_NEXT_EXIST (Packet_Cell_Change_Continue_t, Exist_ID, 3), - M_UINT (Packet_Cell_Change_Continue_t, ARFCN, 10), - M_UINT (Packet_Cell_Change_Continue_t, BSIC, 6), - M_UINT (Packet_Cell_Change_Continue_t, CONTAINER_ID, 2), -CSN_DESCR_END (Packet_Cell_Change_Continue_t) - -/*< Packet Neighbour Cell Data message contents > */ -static const -CSN_DESCR_BEGIN(PNCD_Container_With_ID_t) - M_UINT (PNCD_Container_With_ID_t, ARFCN, 10), - M_UINT (PNCD_Container_With_ID_t, BSIC, 6), - M_UINT_ARRAY (PNCD_Container_With_ID_t, CONTAINER, 8, 17),/* 8*17 bits */ -CSN_DESCR_END (PNCD_Container_With_ID_t) - -static const -CSN_DESCR_BEGIN(PNCD_Container_Without_ID_t) - M_UINT_ARRAY (PNCD_Container_Without_ID_t, CONTAINER, 8, 19),/* 8*19 bits */ -CSN_DESCR_END (PNCD_Container_Without_ID_t) - -static const -CSN_ChoiceElement_t PNCDContainer[] = -{ - {1, 0x0, M_TYPE(PNCDContainer_t, u.PNCD_Container_Without_ID, PNCD_Container_Without_ID_t)}, - {1, 0x1, M_TYPE(PNCDContainer_t, u.PNCD_Container_With_ID, PNCD_Container_With_ID_t)}, -}; - -static const -CSN_DESCR_BEGIN(PNCDContainer_t) - M_CHOICE (PNCDContainer_t, UnionType, PNCDContainer, ElementsOf(PNCDContainer)), -CSN_DESCR_END (PNCDContainer_t) - -static const -CSN_DESCR_BEGIN(Packet_Neighbour_Cell_Data_t) - M_UINT (Packet_Neighbour_Cell_Data_t, MESSAGE_TYPE, 6), - M_UINT (Packet_Neighbour_Cell_Data_t, PAGE_MODE, 2), - M_FIXED (Packet_Neighbour_Cell_Data_t, 1, 0x00), - M_TYPE (Packet_Neighbour_Cell_Data_t, Global_TFI, Global_TFI_t), - - M_UINT (Packet_Neighbour_Cell_Data_t, CONTAINER_ID, 2), - M_UINT (Packet_Neighbour_Cell_Data_t, spare, 1), - M_UINT (Packet_Neighbour_Cell_Data_t, CONTAINER_INDEX, 5), - - M_TYPE (Packet_Neighbour_Cell_Data_t, Container, PNCDContainer_t), -CSN_DESCR_END (Packet_Neighbour_Cell_Data_t) - -/*< Packet Serving Cell Data message contents > */ -static const -CSN_DESCR_BEGIN(Packet_Serving_Cell_Data_t) - M_UINT (Packet_Serving_Cell_Data_t, MESSAGE_TYPE, 6), - M_UINT (Packet_Serving_Cell_Data_t, PAGE_MODE, 2), - M_FIXED (Packet_Serving_Cell_Data_t, 1, 0x00), - M_TYPE (Packet_Serving_Cell_Data_t, Global_TFI, Global_TFI_t), - - M_UINT (Packet_Serving_Cell_Data_t, spare, 4), - M_UINT (Packet_Serving_Cell_Data_t, CONTAINER_INDEX, 5), - M_UINT_ARRAY (Packet_Serving_Cell_Data_t, CONTAINER, 8, 19),/* 8*19 bits */ -CSN_DESCR_END (Packet_Serving_Cell_Data_t) - - -/* Enhanced Measurement Report */ -static const -CSN_DESCR_BEGIN (ServingCellData_t) - M_UINT (ServingCellData_t, RXLEV_SERVING_CELL, 6), - M_FIXED (ServingCellData_t, 1, 0), -CSN_DESCR_END (ServingCellData_t) - -static const -CSN_DESCR_BEGIN (Repeated_Invalid_BSIC_Info_t) - M_UINT (Repeated_Invalid_BSIC_Info_t, BCCH_FREQ_NCELL, 5), - M_UINT (Repeated_Invalid_BSIC_Info_t, BSIC, 6), - M_UINT (Repeated_Invalid_BSIC_Info_t, RXLEV_NCELL, 5), -CSN_DESCR_END (Repeated_Invalid_BSIC_Info_t) - -static const -CSN_DESCR_BEGIN (REPORTING_QUANTITY_t) - M_NEXT_EXIST (REPORTING_QUANTITY_t, Exist_REPORTING_QUANTITY, 1), - M_UINT (REPORTING_QUANTITY_t, REPORTING_QUANTITY, 6), -CSN_DESCR_END (REPORTING_QUANTITY_t) - - -static const -CSN_DESCR_BEGIN (NC_MeasurementReport_t) - M_BIT (NC_MeasurementReport_t, NC_MODE), - M_UNION (NC_MeasurementReport_t, 2), - M_TYPE (NC_MeasurementReport_t, u.BA_USED, BA_USED_t), - M_UINT (NC_MeasurementReport_t, u.PSI3_CHANGE_MARK, 2), - M_BIT (NC_MeasurementReport_t, PMO_USED), - M_BIT (NC_MeasurementReport_t, SCALE), - - M_NEXT_EXIST (NC_MeasurementReport_t, Exist_ServingCellData, 1), - M_TYPE (NC_MeasurementReport_t, ServingCellData, ServingCellData_t), - - M_REC_TARRAY (NC_MeasurementReport_t, Repeated_Invalid_BSIC_Info, Repeated_Invalid_BSIC_Info_t, Count_Repeated_Invalid_BSIC_Info), - - M_NEXT_EXIST (NC_MeasurementReport_t, Exist_Repeated_REPORTING_QUANTITY, 1), - M_VAR_TARRAY (NC_MeasurementReport_t, Repeated_REPORTING_QUANTITY, REPORTING_QUANTITY_t, Count_Repeated_Reporting_Quantity), -CSN_DESCR_END (NC_MeasurementReport_t) - - - -/*< Packet Handover Command message content > */ -static const -CSN_DESCR_BEGIN (GlobalTimeslotDescription_t) - M_UNION (GlobalTimeslotDescription_t, 2), - M_UINT (GlobalTimeslotDescription_t, u.MS_TimeslotAllocation, 8), - M_TYPE (GlobalTimeslotDescription_t, u.Power_Control_Parameters, Power_Control_Parameters_t), -CSN_DESCR_END (GlobalTimeslotDescription_t) - -static const -CSN_DESCR_BEGIN (PHO_DownlinkAssignment_t) - M_UINT (PHO_DownlinkAssignment_t, TimeslotAllocation, 8), - M_UINT (PHO_DownlinkAssignment_t, PFI, 7), - M_BIT (PHO_DownlinkAssignment_t, RLC_Mode), - M_UINT (PHO_DownlinkAssignment_t, TFI_Assignment, 5), - M_BIT (PHO_DownlinkAssignment_t, ControlACK), - - M_NEXT_EXIST (PHO_DownlinkAssignment_t, Exist_EGPRS_WindowSize, 1), - M_UINT (PHO_DownlinkAssignment_t, EGPRS_WindowSize, 5), -CSN_DESCR_END (PHO_DownlinkAssignment_t) - -static const -CSN_DESCR_BEGIN (PHO_USF_1_7_t) - M_NEXT_EXIST (PHO_USF_1_7_t, Exist_USF, 1), - M_UINT (PHO_USF_1_7_t, USF, 3), -CSN_DESCR_END (PHO_USF_1_7_t) - -static const -CSN_DESCR_BEGIN (USF_AllocationArray_t) - M_UINT (USF_AllocationArray_t, USF_0, 3), - M_VAR_TARRAY_OFFSET (USF_AllocationArray_t, USF_1_7, PHO_USF_1_7_t, NBR_OfAllocatedTimeslots), -CSN_DESCR_END (USF_AllocationArray_t) - -static const -CSN_DESCR_BEGIN (PHO_UplinkAssignment_t) - M_UINT (PHO_UplinkAssignment_t, PFI, 7), - M_BIT (PHO_UplinkAssignment_t, RLC_Mode), - M_UINT (PHO_UplinkAssignment_t, TFI_Assignment, 5), - - M_NEXT_EXIST (PHO_UplinkAssignment_t, Exist_ChannelCodingCommand, 1), - M_UINT (PHO_UplinkAssignment_t, ChannelCodingCommand, 2), - - M_NEXT_EXIST (PHO_UplinkAssignment_t, Exist_EGPRS_ChannelCodingCommand, 1), - M_UINT (PHO_UplinkAssignment_t, EGPRS_ChannelCodingCommand, 4), - - M_NEXT_EXIST (PHO_UplinkAssignment_t, Exist_EGPRS_WindowSize, 1), - M_UINT (PHO_UplinkAssignment_t, EGPRS_WindowSize, 5), - - M_BIT (PHO_UplinkAssignment_t, USF_Granularity), - - M_NEXT_EXIST (PHO_UplinkAssignment_t, Exist_TBF_TimeslotAllocation, 1), - M_LEFT_VAR_BMP (PHO_UplinkAssignment_t, TBF_TimeslotAllocation, u.USF_AllocationArray.NBR_OfAllocatedTimeslots, 0), - - M_UNION (PHO_UplinkAssignment_t, 2), - M_UINT (PHO_UplinkAssignment_t, u.USF_SingleAllocation, 3), - M_TYPE (PHO_UplinkAssignment_t, u.USF_AllocationArray, USF_AllocationArray_t), -CSN_DESCR_END (PHO_UplinkAssignment_t) - -static const -CSN_DESCR_BEGIN (GlobalTimeslotDescription_UA_t) - M_TYPE (GlobalTimeslotDescription_UA_t, GlobalTimeslotDescription, GlobalTimeslotDescription_t), - M_NEXT_EXIST (GlobalTimeslotDescription_UA_t, Exist_PHO_UA, 3), /* Don't use M_REC_TARRAY as we don't support multiple TBFs */ - - M_TYPE (GlobalTimeslotDescription_UA_t, PHO_UA, PHO_UplinkAssignment_t), - M_FIXED (GlobalTimeslotDescription_UA_t, 1, 0x0), /* Escape recursive */ -CSN_DESCR_END (GlobalTimeslotDescription_UA_t) - -static const -CSN_DESCR_BEGIN (PHO_GPRS_t) - M_NEXT_EXIST (PHO_GPRS_t, Exist_ChannelCodingCommand, 1), - M_UINT (PHO_GPRS_t, ChannelCodingCommand, 2), - - M_NEXT_EXIST (PHO_GPRS_t, Exist_GlobalTimeslotDescription_UA, 1), - M_TYPE (PHO_GPRS_t, GTD_UA, GlobalTimeslotDescription_UA_t), - - M_NEXT_EXIST (PHO_GPRS_t, Exist_DownlinkAssignment, 2), /* Don't use M_REC_TARRAY as we don't support multiple TBFs */ - M_TYPE (PHO_GPRS_t, DownlinkAssignment, PHO_DownlinkAssignment_t), - M_FIXED (PHO_GPRS_t, 1, 0x0), /* Escape recursive */ -CSN_DESCR_END (PHO_GPRS_t) - -static const -CSN_DESCR_BEGIN (EGPRS_Description_t) - M_NEXT_EXIST (EGPRS_Description_t, Exist_EGPRS_WindowSize, 1), - M_UINT (EGPRS_Description_t, EGPRS_WindowSize, 5), - - M_UINT (EGPRS_Description_t, LinkQualityMeasurementMode, 2), - M_NEXT_EXIST (EGPRS_Description_t, Exist_BEP_Period2, 1), - M_UINT (EGPRS_Description_t, BEP_Period2, 4), -CSN_DESCR_END (EGPRS_Description_t) - -static const -CSN_DESCR_BEGIN (DownlinkTBF_t) - M_NEXT_EXIST (DownlinkTBF_t, Exist_EGPRS_Description, 1), - M_TYPE (DownlinkTBF_t, EGPRS_Description, EGPRS_Description_t), - - M_NEXT_EXIST (DownlinkTBF_t, Exist_DownlinkAssignment, 2), /* Don't use M_REC_TARRAY as we don't support multiple TBFs */ - M_TYPE (DownlinkTBF_t, DownlinkAssignment, PHO_DownlinkAssignment_t), - M_FIXED (DownlinkTBF_t, 1, 0x0), /* Escape recursive */ -CSN_DESCR_END (DownlinkTBF_t) - -static const -CSN_DESCR_BEGIN (PHO_EGPRS_t) - M_NEXT_EXIST (PHO_EGPRS_t, Exist_EGPRS_WindowSize, 1), - M_UINT (PHO_EGPRS_t, EGPRS_WindowSize, 5), - - M_NEXT_EXIST (PHO_EGPRS_t, Exist_EGPRS_ChannelCodingCommand, 1), - M_UINT (PHO_EGPRS_t, EGPRS_ChannelCodingCommand, 4), - - M_NEXT_EXIST (PHO_EGPRS_t, Exist_BEP_Period2, 1), - M_UINT (PHO_EGPRS_t, BEP_Period2, 4), - - M_NEXT_EXIST (PHO_EGPRS_t, Exist_GlobalTimeslotDescription_UA, 1), - M_TYPE (PHO_EGPRS_t, GTD_UA, GlobalTimeslotDescription_UA_t), - - M_NEXT_EXIST (PHO_EGPRS_t, Exist_DownlinkTBF, 2), - M_TYPE (PHO_EGPRS_t, DownlinkTBF, DownlinkTBF_t), -CSN_DESCR_END (PHO_EGPRS_t) - -static const -CSN_DESCR_BEGIN(PHO_TimingAdvance_t) - M_TYPE (PHO_TimingAdvance_t, GlobalPacketTimingAdvance, Global_Packet_Timing_Advance_t), - M_NEXT_EXIST (PHO_TimingAdvance_t, Exist_PacketExtendedTimingAdvance, 1), - M_UINT (PHO_TimingAdvance_t, PacketExtendedTimingAdvance, 2), -CSN_DESCR_END (PHO_TimingAdvance_t) - -static const -CSN_DESCR_BEGIN(NAS_Container_t) - M_UINT (NAS_Container_t, NAS_ContainerLength, 7), - M_VAR_ARRAY (NAS_Container_t, NAS_Container, NAS_ContainerLength, 0), -CSN_DESCR_END (NAS_Container_t) - -static const -CSN_DESCR_BEGIN(PS_HandoverTo_UTRAN_Payload_t) - M_UINT (PS_HandoverTo_UTRAN_Payload_t, RRC_ContainerLength, 8), - M_VAR_ARRAY (PS_HandoverTo_UTRAN_Payload_t, RRC_Container, RRC_ContainerLength, 0), -CSN_DESCR_END (PS_HandoverTo_UTRAN_Payload_t) - - -static const -CSN_DESCR_BEGIN(PHO_RadioResources_t) - M_NEXT_EXIST (PHO_RadioResources_t, Exist_HandoverReference, 1), - M_UINT (PHO_RadioResources_t, HandoverReference, 8), - - M_UINT (PHO_RadioResources_t, ARFCN, 10), - M_UINT (PHO_RadioResources_t, SI, 2), - M_BIT (PHO_RadioResources_t, NCI), - M_UINT (PHO_RadioResources_t, BSIC, 6), - M_NEXT_EXIST (PHO_RadioResources_t, Exist_CCN_Active, 1), - M_BIT (PHO_RadioResources_t, CCN_Active), - - M_NEXT_EXIST (PHO_RadioResources_t, Exist_CCN_Active_3G, 1), - M_BIT (PHO_RadioResources_t, CCN_Active_3G), - - M_NEXT_EXIST (PHO_RadioResources_t, Exist_CCN_Support_Description, 1), - M_TYPE (PHO_RadioResources_t, CCN_Support_Description, CCN_Support_Description_t), - - M_TYPE (PHO_RadioResources_t, Frequency_Parameters, Frequency_Parameters_t), - M_UINT (PHO_RadioResources_t, NetworkControlOrder, 2), - M_NEXT_EXIST (PHO_RadioResources_t, Exist_PHO_TimingAdvance, 1), - M_TYPE (PHO_RadioResources_t, PHO_TimingAdvance, PHO_TimingAdvance_t), - - M_BIT (PHO_RadioResources_t, Extended_Dynamic_Allocation), - M_BIT (PHO_RadioResources_t, RLC_Reset), - M_NEXT_EXIST (PHO_RadioResources_t, Exist_PO_PR, 2), - M_UINT (PHO_RadioResources_t, PO, 4), - M_BIT (PHO_RadioResources_t, PR_Mode), - - - M_NEXT_EXIST (PHO_RadioResources_t, Exist_UplinkControlTimeslot, 1), - M_UINT (PHO_RadioResources_t, UplinkControlTimeslot, 3), - - M_UNION (PHO_RadioResources_t, 2), - M_TYPE (PHO_RadioResources_t, u.PHO_GPRS_Mode, PHO_GPRS_t), - M_TYPE (PHO_RadioResources_t, u.PHO_EGPRS_Mode, PHO_EGPRS_t), -CSN_DESCR_END (PHO_RadioResources_t) - -static const -CSN_DESCR_BEGIN(PS_HandoverTo_A_GB_ModePayload_t) - M_FIXED (PS_HandoverTo_A_GB_ModePayload_t, 2, 0x00), /* For future extension to enum. */ - M_TYPE (PS_HandoverTo_A_GB_ModePayload_t, PHO_RadioResources, PHO_RadioResources_t), - - M_NEXT_EXIST (PS_HandoverTo_A_GB_ModePayload_t, Exist_NAS_Container, 1), - M_TYPE (PS_HandoverTo_A_GB_ModePayload_t, NAS_Container, NAS_Container_t), -CSN_DESCR_END (PS_HandoverTo_A_GB_ModePayload_t) - -static const -CSN_DESCR_BEGIN(Packet_Handover_Command_t) - M_UINT (Packet_Handover_Command_t, MessageType, 6), - M_UINT (Packet_Handover_Command_t, PageMode, 2), - - M_FIXED (Packet_Handover_Command_t, 1, 0x00), /* 0 fixed */ - M_TYPE (Packet_Handover_Command_t, Global_TFI, Global_TFI_t), - - M_UINT (Packet_Handover_Command_t, ContainerID, 2), - - M_UNION (Packet_Handover_Command_t, 4), - M_TYPE (Packet_Handover_Command_t, u.PS_HandoverTo_A_GB_ModePayload, PS_HandoverTo_A_GB_ModePayload_t), - M_TYPE (Packet_Handover_Command_t, u.PS_HandoverTo_UTRAN_Payload, PS_HandoverTo_UTRAN_Payload_t), - CSN_ERROR (Packet_Handover_Command_t, "10 not implemented", CSN_ERROR_STREAM_NOT_SUPPORTED), - CSN_ERROR (Packet_Handover_Command_t, "11 not implemented", CSN_ERROR_STREAM_NOT_SUPPORTED), -CSN_DESCR_END (Packet_Handover_Command_t) - -/*< End Packet Handover Command >*/ - -/*< Packet Physical Information message content > */ - -static const -CSN_DESCR_BEGIN(Packet_PhysicalInformation_t) - M_UINT (Packet_PhysicalInformation_t, MessageType, 6), - M_UINT (Packet_PhysicalInformation_t, PageMode, 2), - - M_TYPE (Packet_PhysicalInformation_t, Global_TFI, Global_TFI_t), - - M_UINT (Packet_PhysicalInformation_t, TimingAdvance, 8), -CSN_DESCR_END (Packet_PhysicalInformation_t) - -/*< End Packet Physical Information > */ - - -/*< ADDITIONAL MS RADIO ACCESS CAPABILITIES content > */ -static const -CSN_ChoiceElement_t AdditionalMsRadAccessCapID[] = -{ - {1, 0, M_TYPE(AdditionalMsRadAccessCapID_t, u.Global_TFI, Global_TFI_t)}, - {1, 0x01, M_UINT(AdditionalMsRadAccessCapID_t, u.TLLI, 32)}, -}; - -static const -CSN_DESCR_BEGIN(AdditionalMsRadAccessCapID_t) - M_CHOICE (AdditionalMsRadAccessCapID_t, UnionType, AdditionalMsRadAccessCapID, ElementsOf(AdditionalMsRadAccessCapID)), -CSN_DESCR_END (AdditionalMsRadAccessCapID_t) - - -static const -CSN_DESCR_BEGIN (Additional_MS_Rad_Access_Cap_t) - /* Mac header */ - M_UINT (Additional_MS_Rad_Access_Cap_t, PayloadType, 2), - M_UINT (Additional_MS_Rad_Access_Cap_t, spare, 5), - M_UINT (Additional_MS_Rad_Access_Cap_t, R, 1), - M_UINT (Additional_MS_Rad_Access_Cap_t, MESSAGE_TYPE, 6), - /* Mac header */ - - M_TYPE (Additional_MS_Rad_Access_Cap_t, ID, AdditionalMsRadAccessCapID_t), - M_TYPE (Additional_MS_Rad_Access_Cap_t, MS_Radio_Access_capability, MS_Radio_Access_capability_t), -CSN_DESCR_END (Additional_MS_Rad_Access_Cap_t) - - -/*< End ADDITIONAL MS RADIO ACCESS CAPABILITIES > */ - - -/*< Packet Pause content > */ - -static const -CSN_DESCR_BEGIN (Packet_Pause_t) - M_UINT (Packet_Pause_t, MESSAGE_TYPE, 2), - M_UINT (Packet_Pause_t, TLLI, 32), - M_BITMAP (Packet_Pause_t, RAI, 48), -CSN_DESCR_END (Packet_Pause_t) - - -/*< End Packet Pause > */ - - -/*< Packet System Information Type 1 message content >*/ -static const -CSN_DESCR_BEGIN(PSI1_AdditionsR99_t) - M_UINT (PSI1_AdditionsR99_t, MSCR, 1), - M_UINT (PSI1_AdditionsR99_t, SGSNR, 1), - M_UINT (PSI1_AdditionsR99_t, BandIndicator, 1), -CSN_DESCR_END (PSI1_AdditionsR99_t) - -static const -CSN_DESCR_BEGIN(PCCCH_Organization_t) - M_UINT (PCCCH_Organization_t, BS_PCC_REL, 1), - M_UINT (PCCCH_Organization_t, BS_PBCCH_BLKS, 2), - M_UINT (PCCCH_Organization_t, BS_PAG_BLKS_RES, 4), - M_UINT (PCCCH_Organization_t, BS_PRACH_BLKS, 4), -CSN_DESCR_END (PCCCH_Organization_t) - - -static const -CSN_DESCR_BEGIN(PSI1_t) - M_UINT (PSI1_t, MESSAGE_TYPE, 6), - M_UINT (PSI1_t, PAGE_MODE, 2), - - M_UINT (PSI1_t, PBCCH_CHANGE_MARK, 3), - M_UINT (PSI1_t, PSI_CHANGE_FIELD, 4), - M_UINT (PSI1_t, PSI1_REPEAT_PERIOD, 4), - M_UINT (PSI1_t, PSI_COUNT_LR, 6), - - M_NEXT_EXIST (PSI1_t, Exist_PSI_COUNT_HR, 1), - M_UINT (PSI1_t, PSI_COUNT_HR, 4), - - M_UINT (PSI1_t, MEASUREMENT_ORDER, 1), - M_TYPE (PSI1_t, GPRS_Cell_Options, GPRS_Cell_Options_t), - M_TYPE (PSI1_t, PRACH_Control, PRACH_Control_t), - M_TYPE (PSI1_t, PCCCH_Organization, PCCCH_Organization_t), - M_TYPE (PSI1_t, Global_Power_Control_Parameters, Global_Power_Control_Parameters_t), - M_UINT (PSI1_t, PSI_STATUS_IND, 1), - - M_NEXT_EXIST (PSI1_t, Exist_AdditionsR99, 1), - M_TYPE (PSI1_t, AdditionsR99, PSI1_AdditionsR99_t), -CSN_DESCR_END (PSI1_t) -/*< End Packet System Information Type 1 message content >*/ - - -/*< Packet System Information Type 2 message content >*/ - -static const -CSN_DESCR_BEGIN(LAI_t) - M_TYPE (LAI_t, PLMN, PLMN_t), - M_UINT (LAI_t, LAC, 16), -CSN_DESCR_END (LAI_t) - -static const -CSN_DESCR_BEGIN(Cell_Identification_t) - M_TYPE (Cell_Identification_t, LAI, LAI_t), - M_UINT (Cell_Identification_t, RAC, 8), - M_UINT (Cell_Identification_t, Cell_Identity, 16), -CSN_DESCR_END (Cell_Identification_t) - -static const -CSN_DESCR_BEGIN(Non_GPRS_Cell_Options_t) - M_BIT (Non_GPRS_Cell_Options_t, ATT), - - M_NEXT_EXIST (Non_GPRS_Cell_Options_t, Exist_T3212, 1), - M_UINT (Non_GPRS_Cell_Options_t, T3212, 8), - - M_BIT (Non_GPRS_Cell_Options_t, NECI), - M_BIT (Non_GPRS_Cell_Options_t, PWRC), - M_UINT (Non_GPRS_Cell_Options_t, DTX, 2), - M_UINT (Non_GPRS_Cell_Options_t, RADIO_LINK_TIMEOUT, 4), - M_UINT (Non_GPRS_Cell_Options_t, BS_AG_BLKS_RES, 3), - M_UINT (Non_GPRS_Cell_Options_t, CCCH_CONF, 3), - M_UINT (Non_GPRS_Cell_Options_t, BS_PA_MFRMS, 3), - M_UINT (Non_GPRS_Cell_Options_t, MAX_RETRANS, 2), - M_UINT (Non_GPRS_Cell_Options_t, TX_INTEGER, 4), - M_BIT (Non_GPRS_Cell_Options_t, EC), - M_UINT (Non_GPRS_Cell_Options_t, MS_TXPWR_MAX_CCCH, 5), - - M_NEXT_EXIST (Non_GPRS_Cell_Options_t, Exist_Extension_Bits, 1), - M_TYPE (Non_GPRS_Cell_Options_t, Extension_Bits, Extension_Bits_t), -CSN_DESCR_END (Non_GPRS_Cell_Options_t) - -static const -CSN_DESCR_BEGIN(Reference_Frequency_t) - M_UINT(Reference_Frequency_t, NUMBER, 4), - M_UINT_OFFSET(Reference_Frequency_t, Length, 4, 3), - M_VAR_ARRAY (Reference_Frequency_t, Contents[0], Length, 0), -CSN_DESCR_END (Reference_Frequency_t) - -static const -CSN_DESCR_BEGIN(PSI2_MA_t) - M_UINT(PSI2_MA_t, NUMBER, 4), - M_TYPE(PSI2_MA_t, Mobile_Allocation, GPRS_Mobile_Allocation_t), -CSN_DESCR_END (PSI2_MA_t) - -static const -CSN_DESCR_BEGIN(Non_Hopping_PCCCH_Carriers_t) - M_UINT(Non_Hopping_PCCCH_Carriers_t, ARFCN, 10), - M_UINT(Non_Hopping_PCCCH_Carriers_t, TIMESLOT_ALLOCATION, 8), -CSN_DESCR_END (Non_Hopping_PCCCH_Carriers_t) - -static const -CSN_DESCR_BEGIN(NonHoppingPCCCH_t) - M_REC_TARRAY (NonHoppingPCCCH_t, Carriers[0], Non_Hopping_PCCCH_Carriers_t, Count_Carriers), -CSN_DESCR_END (NonHoppingPCCCH_t) - -static const -CSN_DESCR_BEGIN(Hopping_PCCCH_Carriers_t) - M_UINT(Hopping_PCCCH_Carriers_t, MAIO, 6), - M_UINT(Hopping_PCCCH_Carriers_t, TIMESLOT_ALLOCATION, 8), -CSN_DESCR_END (Hopping_PCCCH_Carriers_t) - -static const -CSN_DESCR_BEGIN(HoppingPCCCH_t) - M_UINT(HoppingPCCCH_t, MA_NUMBER, 4), - M_REC_TARRAY (HoppingPCCCH_t, Carriers[0], Hopping_PCCCH_Carriers_t, Count_Carriers), -CSN_DESCR_END (HoppingPCCCH_t) - -static const -CSN_DESCR_BEGIN(PCCCH_Description_t) - M_UINT(PCCCH_Description_t, TSC, 3), - M_UNION (PCCCH_Description_t, 2), - M_TYPE (PCCCH_Description_t, u.NonHopping, NonHoppingPCCCH_t), - M_TYPE (PCCCH_Description_t, u.Hopping, HoppingPCCCH_t), -CSN_DESCR_END (PCCCH_Description_t) - -static const -CSN_DESCR_BEGIN(PSI2_t) - M_UINT (PSI2_t, MESSAGE_TYPE, 6), - M_UINT (PSI2_t, PAGE_MODE, 2), - - M_UINT (PSI2_t, CHANGE_MARK, 2), - M_UINT (PSI2_t, INDEX, 3), - M_UINT (PSI2_t, COUNT, 3), - - M_NEXT_EXIST (PSI2_t, Exist_Cell_Identification, 1), - M_TYPE (PSI2_t, Cell_Identification, Cell_Identification_t), - - M_NEXT_EXIST (PSI2_t, Exist_Non_GPRS_Cell_Options, 1), - M_TYPE (PSI2_t, Non_GPRS_Cell_Options, Non_GPRS_Cell_Options_t), - - M_REC_TARRAY (PSI2_t, Reference_Frequency[0], Reference_Frequency_t, Count_Reference_Frequency), - M_TYPE (PSI2_t, Cell_Allocation, Cell_Allocation_t), - M_REC_TARRAY (PSI2_t, GPRS_MA[0], PSI2_MA_t, Count_GPRS_MA), - M_REC_TARRAY (PSI2_t, PCCCH_Description[0], PCCCH_Description_t, Count_PCCCH_Description), -CSN_DESCR_END (PSI2_t) -/*< End Packet System Information Type 2 message content >*/ - - - -/*< Packet System Information Type 3 message content >*/ -static const -CSN_DESCR_BEGIN(Serving_Cell_params_t) - M_BIT (Serving_Cell_params_t, CELL_BAR_ACCESS_2), - M_BIT (Serving_Cell_params_t, EXC_ACC), - M_UINT (Serving_Cell_params_t, GPRS_RXLEV_ACCESS_MIN, 6), - M_UINT (Serving_Cell_params_t, GPRS_MS_TXPWR_MAX_CCH, 5), - M_NEXT_EXIST (Serving_Cell_params_t, Exist_HCS, 1), - M_TYPE (Serving_Cell_params_t, HCS, HCS_t), - M_UINT (Serving_Cell_params_t, MULTIBAND_REPORTING, 2), -CSN_DESCR_END (Serving_Cell_params_t) - - -static const -CSN_DESCR_BEGIN(Gen_Cell_Sel_t) - M_UINT (Gen_Cell_Sel_t, GPRS_CELL_RESELECT_HYSTERESIS, 3), - M_BIT (Gen_Cell_Sel_t, C31_HYST), - M_BIT (Gen_Cell_Sel_t, C32_QUAL), - M_FIXED (Gen_Cell_Sel_t, 1, 0x01), - - M_NEXT_EXIST (Gen_Cell_Sel_t, Exist_T_RESEL, 1), - M_UINT (Gen_Cell_Sel_t, T_RESEL, 3), - - M_NEXT_EXIST (Gen_Cell_Sel_t, Exist_RA_RESELECT_HYSTERESIS, 1), - M_UINT (Gen_Cell_Sel_t, RA_RESELECT_HYSTERESIS, 3), -CSN_DESCR_END (Gen_Cell_Sel_t) - - -static const -CSN_DESCR_BEGIN(COMPACT_Cell_Sel_t) - M_UINT (COMPACT_Cell_Sel_t, bsic, 6), - M_BIT (COMPACT_Cell_Sel_t, CELL_BAR_ACCESS_2), - M_BIT (COMPACT_Cell_Sel_t, EXC_ACC), - M_BIT (COMPACT_Cell_Sel_t, SAME_RA_AS_SERVING_CELL), - M_NEXT_EXIST (COMPACT_Cell_Sel_t, Exist_GPRS_RXLEV_ACCESS_MIN, 2), - M_UINT (COMPACT_Cell_Sel_t, GPRS_RXLEV_ACCESS_MIN, 6), - M_UINT (COMPACT_Cell_Sel_t, GPRS_MS_TXPWR_MAX_CCH, 5), - M_NEXT_EXIST (COMPACT_Cell_Sel_t, Exist_GPRS_TEMPORARY_OFFSET, 2), - M_UINT (COMPACT_Cell_Sel_t, GPRS_TEMPORARY_OFFSET, 3), - M_UINT (COMPACT_Cell_Sel_t, GPRS_PENALTY_TIME, 5), - M_NEXT_EXIST (COMPACT_Cell_Sel_t, Exist_GPRS_RESELECT_OFFSET, 1), - M_UINT (COMPACT_Cell_Sel_t, GPRS_RESELECT_OFFSET, 5), - M_NEXT_EXIST (COMPACT_Cell_Sel_t, Exist_Hcs_Parm, 1), - M_TYPE (COMPACT_Cell_Sel_t, HCS_Param, HCS_t), - M_NEXT_EXIST (COMPACT_Cell_Sel_t, Exist_TIME_GROUP, 1), - M_UINT (COMPACT_Cell_Sel_t, TIME_GROUP, 2), - M_NEXT_EXIST (COMPACT_Cell_Sel_t, Exist_GUAR_CONSTANT_PWR_BLKS, 1), - M_UINT (COMPACT_Cell_Sel_t, GUAR_CONSTANT_PWR_BLKS, 2), -CSN_DESCR_END (COMPACT_Cell_Sel_t) - -static const -CSN_DESCR_BEGIN(COMPACT_Neighbour_Cell_Param_Remaining_t) - /* this FREQ_DIFF_LENGTH is not initialised, it should be the SAME as COMPACT_Neighbour_Cell_Param_t.FREQ_DIFF_LENGTH. - * So it is buggy, but there is no way to handle it. Same issue is in Cell_Selection_Params_With_FreqDiff_t.FREQ_DIFF_LENGTH. - */ - M_VAR_BITMAP (COMPACT_Neighbour_Cell_Param_Remaining_t, FREQUENCY_DIFF, FREQ_DIFF_LENGTH, 0), - M_TYPE (COMPACT_Neighbour_Cell_Param_Remaining_t, COMPACT_Cell_Sel_Remain_Cells, COMPACT_Cell_Sel_t), -CSN_DESCR_END (COMPACT_Neighbour_Cell_Param_Remaining_t) - - -static const -CSN_DESCR_BEGIN(COMPACT_Neighbour_Cell_Param_t) - M_UINT (COMPACT_Neighbour_Cell_Param_t, START_FREQUENCY, 10), - M_TYPE (COMPACT_Neighbour_Cell_Param_t, COMPACT_Cell_Sel, COMPACT_Cell_Sel_t), - M_UINT (COMPACT_Neighbour_Cell_Param_t, NR_OF_REMAINING_CELLS, 4), - M_UINT_OFFSET(COMPACT_Neighbour_Cell_Param_t, FREQ_DIFF_LENGTH, 3, 1), - M_VAR_TARRAY (COMPACT_Neighbour_Cell_Param_t, COMPACT_Neighbour_Cell_Param_Remaining, COMPACT_Neighbour_Cell_Param_Remaining_t, NR_OF_REMAINING_CELLS), -CSN_DESCR_END (COMPACT_Neighbour_Cell_Param_t) - - -static const -CSN_DESCR_BEGIN(COMPACT_Info_t) - M_TYPE (COMPACT_Info_t, Cell_Identification, Cell_Identification_t), - M_REC_TARRAY (COMPACT_Info_t, COMPACT_Neighbour_Cell_Param, COMPACT_Neighbour_Cell_Param_t, COMPACT_Neighbour_Cell_Param_Count), -CSN_DESCR_END (COMPACT_Info_t) - - -static const -CSN_DESCR_BEGIN(PSI3_AdditionR4_t) - M_NEXT_EXIST (PSI3_AdditionR4_t, Exist_CCN_Support_Desc, 1), - M_TYPE (PSI3_AdditionR4_t, CCN_Support_Desc, CCN_Support_Description_t), -CSN_DESCR_END (PSI3_AdditionR4_t) - - -static const -CSN_DESCR_BEGIN(PSI3_AdditionR99_t) - M_FIXED (PSI3_AdditionR99_t, 2, 0x00), - M_NEXT_EXIST (PSI3_AdditionR99_t, Exist_COMPACT_Info, 1), - M_TYPE (PSI3_AdditionR99_t, COMPACT_Info, COMPACT_Info_t), - M_FIXED (PSI3_AdditionR99_t, 1, 0x00), - M_NEXT_EXIST (PSI3_AdditionR99_t, Exist_AdditionR4, 1), - M_TYPE (PSI3_AdditionR99_t, AdditionR4, PSI3_AdditionR4_t), -CSN_DESCR_END (PSI3_AdditionR99_t) - - -static const -CSN_DESCR_BEGIN(PSI3_AdditionR98_t) - M_TYPE (PSI3_AdditionR98_t, Scell_LSA_ID_Info, LSA_ID_Info_t), - - M_NEXT_EXIST (PSI3_AdditionR98_t, Exist_LSA_Parameters, 1), - M_TYPE (PSI3_AdditionR98_t, LSA_Parameters, LSA_Parameters_t), - - M_NEXT_EXIST (PSI3_AdditionR98_t, Exist_AdditionR99, 1), - M_TYPE (PSI3_AdditionR98_t, AdditionR99, PSI3_AdditionR99_t), -CSN_DESCR_END (PSI3_AdditionR98_t) - - -static const -CSN_DESCR_BEGIN(PSI3_t) - M_UINT (PSI3_t, MESSAGE_TYPE, 6), - M_UINT (PSI3_t, PAGE_MODE, 2), - M_UINT (PSI3_t, CHANGE_MARK, 2), - M_UINT (PSI3_t, BIS_COUNT, 4), - M_TYPE (PSI3_t, Serving_Cell_params, Serving_Cell_params_t), - M_TYPE (PSI3_t, General_Cell_Selection, Gen_Cell_Sel_t), - M_TYPE (PSI3_t, NeighbourCellList, NeighbourCellList_t), - - M_NEXT_EXIST (PSI3_t, Exist_AdditionR98, 1), - M_TYPE (PSI3_t, AdditionR98, PSI3_AdditionR98_t), -CSN_DESCR_END (PSI3_t) -/*< End Packet System Information Type 3 message content >*/ - - -/*< Packet System Information Type 5 message content >*/ -static const -CSN_DESCR_BEGIN(MeasurementParams_t) - M_NEXT_EXIST (MeasurementParams_t, Exist_MULTI_BAND_REPORTING, 1), - M_UINT (MeasurementParams_t, MULTI_BAND_REPORTING, 2), - - M_NEXT_EXIST (MeasurementParams_t, Exist_SERVING_BAND_REPORTING, 1), - M_UINT (MeasurementParams_t, SERVING_BAND_REPORTING, 2), - - M_NEXT_EXIST (MeasurementParams_t, Exist_SCALE_ORD, 1), - M_UINT (MeasurementParams_t, SCALE_ORD, 2), - - M_NEXT_EXIST (MeasurementParams_t, Exist_OffsetThreshold900, 1), - M_TYPE (MeasurementParams_t, OffsetThreshold900, OffsetThreshold_t), - - M_NEXT_EXIST (MeasurementParams_t, Exist_OffsetThreshold1800, 1), - M_TYPE (MeasurementParams_t, OffsetThreshold1800, OffsetThreshold_t), - - M_NEXT_EXIST (MeasurementParams_t, Exist_OffsetThreshold400, 1), - M_TYPE (MeasurementParams_t, OffsetThreshold400, OffsetThreshold_t), - - M_NEXT_EXIST (MeasurementParams_t, Exist_OffsetThreshold1900, 1), - M_TYPE (MeasurementParams_t, OffsetThreshold1900, OffsetThreshold_t), - - M_NEXT_EXIST (MeasurementParams_t, Exist_OffsetThreshold850, 1), - M_TYPE (MeasurementParams_t, OffsetThreshold850, OffsetThreshold_t), -CSN_DESCR_END (MeasurementParams_t) - -static const -CSN_DESCR_BEGIN(GPRSMeasurementParams3G_PSI5_t) - M_NEXT_EXIST (GPRSMeasurementParams3G_PSI5_t, existRepParamsFDD, 2), - M_UINT (GPRSMeasurementParams3G_PSI5_t, RepQuantFDD, 1), - M_UINT (GPRSMeasurementParams3G_PSI5_t, MultiratReportingFDD, 2), - - M_NEXT_EXIST (GPRSMeasurementParams3G_PSI5_t, existReportingParamsFDD, 2), - M_UINT (GPRSMeasurementParams3G_PSI5_t, ReportingOffsetFDD, 3), - M_UINT (GPRSMeasurementParams3G_PSI5_t, ReportingThresholdFDD, 3), - - M_NEXT_EXIST (GPRSMeasurementParams3G_PSI5_t, existMultiratReportingTDD, 1), - M_UINT (GPRSMeasurementParams3G_PSI5_t, MultiratReportingTDD, 2), - - M_NEXT_EXIST (GPRSMeasurementParams3G_PSI5_t, existOffsetThresholdTDD, 2), - M_UINT (GPRSMeasurementParams3G_PSI5_t, ReportingOffsetTDD, 3), - M_UINT (GPRSMeasurementParams3G_PSI5_t, ReportingThresholdTDD, 3), -CSN_DESCR_END (GPRSMeasurementParams3G_PSI5_t) - -static const -CSN_DESCR_BEGIN(ENH_Reporting_Parameters_t) - M_UINT (ENH_Reporting_Parameters_t, REPORT_TYPE, 1), - M_UINT (ENH_Reporting_Parameters_t, REPORTING_RATE, 1), - M_UINT (ENH_Reporting_Parameters_t, INVALID_BSIC_REPORTING, 1), - - M_NEXT_EXIST (ENH_Reporting_Parameters_t, Exist_NCC_PERMITTED, 1), - M_UINT (ENH_Reporting_Parameters_t, NCC_PERMITTED, 8), - - M_NEXT_EXIST (ENH_Reporting_Parameters_t, Exist_GPRSMeasurementParams, 1), - M_TYPE (ENH_Reporting_Parameters_t, GPRSMeasurementParams, MeasurementParams_t), - - M_NEXT_EXIST (ENH_Reporting_Parameters_t, Exist_GPRSMeasurementParams3G, 1), - M_TYPE (ENH_Reporting_Parameters_t, GPRSMeasurementParams3G, GPRSMeasurementParams3G_PSI5_t), -CSN_DESCR_END (ENH_Reporting_Parameters_t) - -static const -CSN_DESCR_BEGIN(PSI5_AdditionsR7) - M_NEXT_EXIST (PSI5_AdditionsR7, Exist_OffsetThreshold_700, 1), - M_TYPE (PSI5_AdditionsR7, OffsetThreshold_700, OffsetThreshold_t), - - M_NEXT_EXIST (PSI5_AdditionsR7, Exist_OffsetThreshold_810, 1), - M_TYPE (PSI5_AdditionsR7, OffsetThreshold_810, OffsetThreshold_t), -CSN_DESCR_END (PSI5_AdditionsR7) - -static const -CSN_DESCR_BEGIN(PSI5_AdditionsR5) - M_NEXT_EXIST (PSI5_AdditionsR5, Exist_GPRS_AdditionalMeasurementParams3G, 1), - M_TYPE (PSI5_AdditionsR5, GPRS_AdditionalMeasurementParams3G, GPRS_AdditionalMeasurementParams3G_t), - - M_NEXT_EXIST (PSI5_AdditionsR5, Exist_AdditionsR7, 1), - M_TYPE (PSI5_AdditionsR5, AdditionsR7, PSI5_AdditionsR7), -CSN_DESCR_END (PSI5_AdditionsR5) - -static const -CSN_DESCR_BEGIN(PSI5_AdditionsR99) - M_NEXT_EXIST (PSI5_AdditionsR99, Exist_ENH_Reporting_Param, 1), - M_TYPE (PSI5_AdditionsR99, ENH_Reporting_Param, ENH_Reporting_Parameters_t), - - M_NEXT_EXIST (PSI5_AdditionsR99, Exist_AdditionsR5, 1), - M_TYPE (PSI5_AdditionsR99, AdditionisR5, PSI5_AdditionsR5), -CSN_DESCR_END (PSI5_AdditionsR99) - -static const -CSN_DESCR_BEGIN(PSI5_t) - M_UINT (PSI5_t, MESSAGE_TYPE, 6), - M_UINT (PSI5_t, PAGE_MODE, 2), - M_UINT (PSI5_t, CHANGE_MARK, 2), - M_UINT (PSI5_t, INDEX, 3), - M_UINT (PSI5_t, COUNT, 3), - - M_NEXT_EXIST (PSI5_t, Eixst_NC_Meas_Param, 1), - M_TYPE (PSI5_t, NC_Meas_Param, NC_Measurement_Parameters_t), - - M_FIXED (PSI5_t, 1, 0x00), - - M_NEXT_EXIST (PSI5_t, Exist_AdditionsR99, 1), - M_TYPE (PSI5_t, AdditionsR99, PSI5_AdditionsR99), -CSN_DESCR_END (PSI5_t) -/*< End Packet System Information Type 5 message content >*/ - - -/*< Packet System Information Type 13 message content >*/ -static const -CSN_DESCR_BEGIN(PSI13_AdditionsR6) - M_NEXT_EXIST (PSI13_AdditionsR6, Exist_LB_MS_TXPWR_MAX_CCH, 1), - M_UINT (PSI13_AdditionsR6, LB_MS_TXPWR_MAX_CCH, 5), - M_UINT (PSI13_AdditionsR6, SI2n_SUPPORT, 2), -CSN_DESCR_END (PSI13_AdditionsR6) - -static const -CSN_DESCR_BEGIN(PSI13_AdditionsR4) - M_UINT (PSI13_AdditionsR4, SI_STATUS_IND, 1), - M_NEXT_EXIST (PSI13_AdditionsR4, Exist_AdditionsR6, 1), - M_TYPE (PSI13_AdditionsR4, AdditionsR6, PSI13_AdditionsR6), -CSN_DESCR_END (PSI13_AdditionsR4) - -static const -CSN_DESCR_BEGIN(PSI13_AdditionR99) - M_UINT (PSI13_AdditionR99, SGSNR, 1), - M_NEXT_EXIST (PSI13_AdditionR99, Exist_AdditionsR4, 1), - M_TYPE (PSI13_AdditionR99, AdditionsR4, PSI13_AdditionsR4), -CSN_DESCR_END (PSI13_AdditionR99) - -static const -CSN_DESCR_BEGIN(PSI13_t) - M_UINT (PSI13_t, MESSAGE_TYPE, 6), - M_UINT (PSI13_t, PAGE_MODE, 2), - M_UINT (PSI13_t, BCCH_CHANGE_MARK, 3), - M_UINT (PSI13_t, SI_CHANGE_FIELD, 4), - - M_NEXT_EXIST (PSI13_t, Exist_MA, 2), - M_UINT (PSI13_t, SI13_CHANGE_MARK, 2), - M_TYPE (PSI13_t, GPRS_Mobile_Allocation, GPRS_Mobile_Allocation_t), - - M_UNION (PSI13_t, 2), - M_TYPE (PSI13_t, u.PBCCH_Not_present, PBCCH_Not_present_t), - M_TYPE (PSI13_t, u.PBCCH_present, PBCCH_present_t), - - M_NEXT_EXIST (PSI13_t, Exist_AdditionsR99, 1), - M_TYPE (PSI13_t, AdditionsR99, PSI13_AdditionR99), -CSN_DESCR_END (PSI13_t) -/*< End Packet System Information Type 13 message content >*/ - - - -//typedef char* MT_Strings_t; - -static const char* szMT_Downlink[] = { - "Invalid Message Type", /* 0x00 */ - "PACKET_CELL_CHANGE_ORDER", /* 0x01 */ - "PACKET_DOWNLINK_ASSIGNMENT", /* 0x02 */ - "PACKET_MEASUREMENT_ORDER", /* 0x03 */ - "PACKET_POLLING_REQUEST", /* 0x04 */ - "PACKET_POWER_CONTROL_TIMING_ADVANCE", /* 0x05 */ - "PACKET_QUEUEING_NOTIFICATION", /* 0x06 */ - "PACKET_TIMESLOT_RECONFIGURE", /* 0x07 */ - "PACKET_TBF_RELEASE", /* 0x08 */ - "PACKET_UPLINK_ACK_NACK", /* 0x09 */ - "PACKET_UPLINK_ASSIGNMENT", /* 0x0A */ - "PACKET_CELL_CHANGE_CONTINUE", /* 0x0B */ - "PACKET_NEIGHBOUR_CELL_DATA", /* 0x0C */ - "PACKET_SERVING_CELL_DATA", /* 0x0D */ - "Invalid Message Type", /* 0x0E */ - "Invalid Message Type", /* 0x0F */ - "Invalid Message Type", /* 0x10 */ - "Invalid Message Type", /* 0x11 */ - "Invalid Message Type", /* 0x12 */ - "Invalid Message Type", /* 0x13 */ - "Invalid Message Type", /* 0x14 */ - "PACKET_HANDOVER_COMMAND", /* 0x15 */ - "PACKET_PHYSICAL_INFORMATION", /* 0x16 */ - "Invalid Message Type", /* 0x17 */ - "Invalid Message Type", /* 0x18 */ - "Invalid Message Type", /* 0x19 */ - "Invalid Message Type", /* 0x1A */ - "Invalid Message Type", /* 0x1B */ - "Invalid Message Type", /* 0x1C */ - "Invalid Message Type", /* 0x1D */ - "Invalid Message Type", /* 0x1E */ - "Invalid Message Type", /* 0x1F */ - "Invalid Message Type", /* 0x20 */ - "PACKET_ACCESS_REJECT", /* 0x21 */ - "PACKET_PAGING_REQUEST", /* 0x22 */ - "PACKET_PDCH_RELEASE", /* 0x23 */ - "PACKET_PRACH_PARAMETERS", /* 0x24 */ - "PACKET_DOWNLINK_DUMMY_CONTROL_BLOCK", /* 0x25 */ - "Invalid Message Type", /* 0x26 */ - "Invalid Message Type", /* 0x27 */ - "Invalid Message Type", /* 0x28 */ - "Invalid Message Type", /* 0x29 */ - "Invalid Message Type", /* 0x2A */ - "Invalid Message Type", /* 0x2B */ - "Invalid Message Type", /* 0x2C */ - "Invalid Message Type", /* 0x2D */ - "Invalid Message Type", /* 0x2E */ - "Invalid Message Type", /* 0x2F */ - "PACKET_SYSTEM_INFO_6", /* 0x30 */ - "PACKET_SYSTEM_INFO_1", /* 0x31 */ - "PACKET_SYSTEM_INFO_2", /* 0x32 */ - "PACKET_SYSTEM_INFO_3", /* 0x33 */ - "PACKET_SYSTEM_INFO_3_BIS", /* 0x34 */ - "PACKET_SYSTEM_INFO_4", /* 0x35 */ - "PACKET_SYSTEM_INFO_5", /* 0x36 */ - "PACKET_SYSTEM_INFO_13", /* 0x37 */ - "PACKET_SYSTEM_INFO_7", /* 0x38 */ - "PACKET_SYSTEM_INFO_8", /* 0x39 */ - "PACKET_SYSTEM_INFO_14", /* 0x3A */ - "Invalid Message Type", /* 0x3B */ - "PACKET_SYSTEM_INFO_3_TER", /* 0x3C */ - "PACKET_SYSTEM_INFO_3_QUATER", /* 0x3D */ - "PACKET_SYSTEM_INFO_15" /* 0x3E */ -}; - -static const char* szMT_Uplink[] = { - "PACKET_CELL_CHANGE_FAILURE", /* 0x00 */ - "PACKET_CONTROL_ACKNOWLEDGEMENT", /* 0x01 */ - "PACKET_DOWNLINK_ACK_NACK", /* 0x02 */ - "PACKET_UPLINK_DUMMY_CONTROL_BLOCK", /* 0x03 */ - "PACKET_MEASUREMENT_REPORT", /* 0x04 */ - "PACKET_RESOURCE_REQUEST", /* 0x05 */ - "PACKET_MOBILE_TBF_STATUS", /* 0x06 */ - "PACKET_PSI_STATUS", /* 0x07 */ - "EGPRS_PACKET_DOWNLINK_ACK_NACK", /* 0x08 */ - "PACKET_PAUSE", /* 0x09 */ - "PACKET_ENHANCED_MEASUREMENT_REPORT", /* 0x0A */ - "ADDITIONAL_MS_RAC", /* 0x0B */ - "PACKET_CELL_CHANGE_NOTIFICATION", /* 0x0C */ - "PACKET_SI_STATUS", /* 0x0D */ -}; - -const char* -MT_DL_TextGet(guint8 mt) -{ - if (mt < ElementsOf(szMT_Downlink)) - { - return(szMT_Downlink[mt]); - } - else - { - return("Unknown message type"); - } -} - -const char* -MT_UL_TextGet(guint8 mt) -{ - if (mt < ElementsOf(szMT_Uplink)) - { - return(szMT_Uplink[mt]); - } - else - { - return("Unknown message type"); - } -} - - -/* SI1_RestOctet_t */ - -static const -CSN_DESCR_BEGIN (SI1_RestOctet_t) - M_NEXT_EXIST_LH(SI1_RestOctet_t, Exist_NCH_Position, 1), - M_UINT (SI1_RestOctet_t, NCH_Position, 5), - - M_UINT_LH (SI1_RestOctet_t, BandIndicator, 1), -CSN_DESCR_END (SI1_RestOctet_t) - -/* SI3_Rest_Octet_t */ -static const -CSN_DESCR_BEGIN(Selection_Parameters_t) - M_UINT (Selection_Parameters_t, CBQ, 1), - M_UINT (Selection_Parameters_t, CELL_RESELECT_OFFSET, 6), - M_UINT (Selection_Parameters_t, TEMPORARY_OFFSET, 3), - M_UINT (Selection_Parameters_t, PENALTY_TIME, 5), -CSN_DESCR_END (Selection_Parameters_t) - -static const -CSN_DESCR_BEGIN (SI3_Rest_Octet_t) - M_NEXT_EXIST_LH(SI3_Rest_Octet_t, Exist_Selection_Parameters, 1), - M_TYPE (SI3_Rest_Octet_t, Selection_Parameters, Selection_Parameters_t), - - M_NEXT_EXIST_LH(SI3_Rest_Octet_t, Exist_Power_Offset, 1), - M_UINT (SI3_Rest_Octet_t, Power_Offset, 2), - - M_UINT_LH (SI3_Rest_Octet_t, System_Information_2ter_Indicator, 1), - M_UINT_LH (SI3_Rest_Octet_t, Early_Classmark_Sending_Control, 1), - - M_NEXT_EXIST_LH(SI3_Rest_Octet_t, Exist_WHERE, 1), - M_UINT (SI3_Rest_Octet_t, WHERE, 3), - - M_NEXT_EXIST_LH(SI3_Rest_Octet_t, Exist_GPRS_Indicator, 2), - M_UINT (SI3_Rest_Octet_t, RA_COLOUR, 3), - M_UINT (SI3_Rest_Octet_t, SI13_POSITION, 1), - - M_UINT_LH (SI3_Rest_Octet_t, ECS_Restriction3G, 1), - - M_NEXT_EXIST_LH(SI3_Rest_Octet_t, ExistSI2quaterIndicator, 1), - M_UINT (SI3_Rest_Octet_t, SI2quaterIndicator, 1), -CSN_DESCR_END (SI3_Rest_Octet_t) - -static const -CSN_DESCR_BEGIN (SI4_Rest_Octet_t) - M_NEXT_EXIST_LH(SI4_Rest_Octet_t, Exist_Selection_Parameters, 1), - M_TYPE (SI4_Rest_Octet_t, Selection_Parameters, Selection_Parameters_t), - - M_NEXT_EXIST_LH(SI4_Rest_Octet_t, Exist_Power_Offset, 1), - M_UINT (SI4_Rest_Octet_t, Power_Offset, 2), - - M_NEXT_EXIST_LH(SI4_Rest_Octet_t, Exist_GPRS_Indicator, 2), - M_UINT (SI4_Rest_Octet_t, RA_COLOUR, 3), - M_UINT (SI4_Rest_Octet_t, SI13_POSITION, 1), -CSN_DESCR_END (SI4_Rest_Octet_t) - -/* SI6_RestOctet_t */ - -static const -CSN_DESCR_BEGIN(PCH_and_NCH_Info_t) - M_UINT (PCH_and_NCH_Info_t, PagingChannelRestructuring, 1), - M_UINT (PCH_and_NCH_Info_t, NLN_SACCH, 2), - - M_NEXT_EXIST (PCH_and_NCH_Info_t, Exist_CallPriority, 1), - M_UINT (PCH_and_NCH_Info_t, CallPriority, 3), - - M_UINT (PCH_and_NCH_Info_t, NLN_Status, 1), -CSN_DESCR_END (PCH_and_NCH_Info_t) - -static const -CSN_DESCR_BEGIN (SI6_RestOctet_t) - M_NEXT_EXIST_LH(SI6_RestOctet_t, Exist_PCH_and_NCH_Info, 1), - M_TYPE (SI6_RestOctet_t, PCH_and_NCH_Info, PCH_and_NCH_Info_t), - - M_NEXT_EXIST_LH(SI6_RestOctet_t, Exist_VBS_VGCS_Options, 1), - M_UINT (SI6_RestOctet_t, VBS_VGCS_Options, 2), - - M_NEXT_EXIST_LH(SI6_RestOctet_t, Exist_DTM_Support, 2), - M_UINT (SI6_RestOctet_t, RAC, 8), - M_UINT (SI6_RestOctet_t, MAX_LAPDm, 3), - - M_UINT_LH (SI6_RestOctet_t, BandIndicator, 1), -CSN_DESCR_END (SI6_RestOctet_t) - -void decode_gsm_rlcmac_uplink(bitvec * vector, RlcMacUplink_t * data) -{ - csnStream_t ar; - size_t readIndex = 0; - guint8 payload_type = bitvec_read_field(vector, readIndex, 2); - - if (payload_type == PAYLOAD_TYPE_DATA) - { - LOGPC(DRLCMACDATA, LOGL_NOTICE, "Payload Type: DATA (0), not implemented"); - return; - } - else if (payload_type == PAYLOAD_TYPE_RESERVED) - { - LOGPC(DRLCMACDATA, LOGL_NOTICE, "Payload Type: RESERVED (3)"); - return; - } - data->NrOfBits = (23 - 1) * 8; - csnStreamInit(&ar, 0, data->NrOfBits); - readIndex += 6; - data->u.MESSAGE_TYPE = bitvec_read_field(vector, readIndex, 6); - readIndex = 0; - switch (data->u.MESSAGE_TYPE) - { - case MT_PACKET_CELL_CHANGE_FAILURE: - { - /* - * data is the pointer to the unpack struct that hold the unpack value - * CSNDESCR is an array that holds the different element types - * ar is the csn context holding the bitcount, offset and output - */ - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Cell_Change_Failure_t), vector, readIndex, &data->u.Packet_Cell_Change_Failure); - break; - } - case MT_PACKET_CONTROL_ACK: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Control_Acknowledgement_t), vector, readIndex, &data->u.Packet_Control_Acknowledgement); - break; - } - case MT_PACKET_DOWNLINK_ACK_NACK: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Downlink_Ack_Nack_t), vector, readIndex, &data->u.Packet_Downlink_Ack_Nack); - break; - } - case MT_PACKET_UPLINK_DUMMY_CONTROL_BLOCK: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Uplink_Dummy_Control_Block_t), vector, readIndex, &data->u.Packet_Uplink_Dummy_Control_Block); - break; - } - case MT_PACKET_MEASUREMENT_REPORT: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Measurement_Report_t), vector, readIndex, &data->u.Packet_Measurement_Report); - break; - } - case MT_PACKET_RESOURCE_REQUEST: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Resource_Request_t), vector, readIndex, &data->u.Packet_Resource_Request); - break; - } - - case MT_PACKET_MOBILE_TBF_STATUS: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Mobile_TBF_Status_t), vector, readIndex, &data->u.Packet_Mobile_TBF_Status); - break; - } - case MT_PACKET_PSI_STATUS: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_PSI_Status_t), vector, readIndex, &data->u.Packet_PSI_Status); - break; - } - case MT_EGPRS_PACKET_DOWNLINK_ACK_NACK: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(EGPRS_PD_AckNack_t), vector, readIndex, &data->u.Egprs_Packet_Downlink_Ack_Nack); - break; - } - case MT_PACKET_PAUSE: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Pause_t), vector, readIndex, &data->u.Packet_Pause); - break; - } - case MT_PACKET_ENHANCED_MEASUREMENT_REPORT: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Enh_Measurement_Report_t), vector, readIndex, &data->u.Packet_Enh_Measurement_Report); - break; - } - case MT_ADDITIONAL_MS_RAC: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Additional_MS_Rad_Access_Cap_t), vector, readIndex, &data->u.Additional_MS_Rad_Access_Cap); - break; - } - case MT_PACKET_CELL_CHANGE_NOTIFICATION: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Cell_Change_Notification_t), vector, readIndex, &data->u.Packet_Cell_Change_Notification); - break; - } - case MT_PACKET_SI_STATUS: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_SI_Status_t), vector, readIndex, &data->u.Packet_SI_Status); - break; - } - default: - /*ret = -1;*/ - break; - } -} - -void decode_gsm_rlcmac_downlink(bitvec * vector, RlcMacDownlink_t * data) -{ - csnStream_t ar; - /* See RLC/MAC downlink control block structure in TS 44.060 / 10.3.1 */ - gint bit_offset = 0; - gint bit_length; - size_t readIndex = 0; - data->PAYLOAD_TYPE = bitvec_read_field(vector, readIndex, 2); - data->RRBP = bitvec_read_field(vector, readIndex, 2); - data->SP = bitvec_read_field(vector, readIndex, 1); - data->USF = bitvec_read_field(vector, readIndex, 3); - - if (data->PAYLOAD_TYPE == PAYLOAD_TYPE_DATA) - { - LOGPC(DRLCMACDATA, LOGL_NOTICE, "Payload Type: DATA (0), not implemented"); - return; - } - else if (data->PAYLOAD_TYPE == PAYLOAD_TYPE_RESERVED) - { - LOGPC(DRLCMACDATA, LOGL_NOTICE, "Payload Type: RESERVED (3)"); - return; - } - /* We can decode the message */ - else - { - /* First print the message type and create a tree item */ - bit_offset = 8; - if (data->PAYLOAD_TYPE == PAYLOAD_TYPE_CTRL_OPT_OCTET) - { - data->RBSN = bitvec_read_field(vector, readIndex, 1); - data->RTI = bitvec_read_field(vector, readIndex, 5); - data->FS = bitvec_read_field(vector, readIndex, 1); - data->AC = bitvec_read_field(vector, readIndex, 1); - bit_offset += 8; - if (data->AC == 1) - { - data->PR = bitvec_read_field(vector, readIndex, 2); - data->TFI = bitvec_read_field(vector, readIndex, 5); - data->D = bitvec_read_field(vector, readIndex, 1); - bit_offset += 8; - } - if ((data->RBSN == 1) && (data->FS == 0)) - { - data->RBSNe = bitvec_read_field(vector, readIndex, 3); - data->FSe = bitvec_read_field(vector, readIndex, 1); - data->spare = bitvec_read_field(vector, readIndex, 4); - bit_offset += 8; - } - } - data->u.MESSAGE_TYPE = bitvec_read_field(vector, readIndex, 6); - } - - /* Initialize the contexts */ - bit_length = 23*8 - bit_offset; - data->NrOfBits = bit_length; - readIndex = bit_offset; - - csnStreamInit(&ar, bit_offset, bit_length); - - switch (data->u.MESSAGE_TYPE) - { - case MT_PACKET_ACCESS_REJECT: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Access_Reject_t), vector, readIndex, &data->u.Packet_Access_Reject); - break; - } - case MT_PACKET_CELL_CHANGE_ORDER: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Cell_Change_Order_t), vector, readIndex, &data->u.Packet_Cell_Change_Order); - break; - } - case MT_PACKET_CELL_CHANGE_CONTINUE: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Cell_Change_Continue_t), vector, readIndex, &data->u.Packet_Cell_Change_Continue); - break; - } - case MT_PACKET_DOWNLINK_ASSIGNMENT: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Downlink_Assignment_t), vector, readIndex, &data->u.Packet_Downlink_Assignment); - break; - } - case MT_PACKET_MEASUREMENT_ORDER: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Measurement_Order_t), vector, readIndex, &data->u.Packet_Measurement_Order); - break; - } - case MT_PACKET_NEIGHBOUR_CELL_DATA: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Neighbour_Cell_Data_t), vector, readIndex, &data->u.Packet_Neighbour_Cell_Data); - break; - } - case MT_PACKET_SERVING_CELL_DATA: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Serving_Cell_Data_t), vector, readIndex, &data->u.Packet_Serving_Cell_Data); - break; - } - case MT_PACKET_PAGING_REQUEST: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Paging_Request_t), vector, readIndex, &data->u.Packet_Paging_Request); - break; - } - case MT_PACKET_PDCH_RELEASE: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_PDCH_Release_t), vector, readIndex, &data->u.Packet_PDCH_Release); - break; - } - case MT_PACKET_POLLING_REQ: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Polling_Request_t), vector, readIndex, &data->u.Packet_Polling_Request); - break; - } - case MT_PACKET_POWER_CONTROL_TIMING_ADVANCE: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Power_Control_Timing_Advance_t), vector, readIndex, &data->u.Packet_Power_Control_Timing_Advance); - break; - } - case MT_PACKET_PRACH_PARAMETERS: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_PRACH_Parameters_t), vector, readIndex, &data->u.Packet_PRACH_Parameters); - break; - } - case MT_PACKET_QUEUEING_NOTIFICATION: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Queueing_Notification_t), vector, readIndex, &data->u.Packet_Queueing_Notification); - break; - } - case MT_PACKET_TIMESLOT_RECONFIGURE: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Timeslot_Reconfigure_t), vector, readIndex, &data->u.Packet_Timeslot_Reconfigure); - break; - } - case MT_PACKET_TBF_RELEASE: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_TBF_Release_t), vector, readIndex, &data->u.Packet_TBF_Release); - break; - } - case MT_PACKET_UPLINK_ACK_NACK: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Uplink_Ack_Nack_t), vector, readIndex, &data->u.Packet_Uplink_Ack_Nack); - break; - } - case MT_PACKET_UPLINK_ASSIGNMENT: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Uplink_Assignment_t), vector, readIndex, &data->u.Packet_Uplink_Assignment); - break; - } - case MT_PACKET_HANDOVER_COMMAND: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Handover_Command_t), vector, readIndex, &data->u.Packet_Handover_Command); - break; - } - case MT_PACKET_PHYSICAL_INFORMATION: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_PhysicalInformation_t), vector, readIndex, &data->u.Packet_Handover_Command); - break; - } - case MT_PACKET_DOWNLINK_DUMMY_CONTROL_BLOCK: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Downlink_Dummy_Control_Block_t), vector, readIndex, &data->u.Packet_Downlink_Dummy_Control_Block); - break; - } - case MT_PACKET_SYSTEM_INFO_1: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(PSI1_t), vector, readIndex, &data->u.PSI1); - break; - } - case MT_PACKET_SYSTEM_INFO_2: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(PSI2_t), vector, readIndex, &data->u.PSI2); - break; - } - case MT_PACKET_SYSTEM_INFO_3: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(PSI3_t), vector, readIndex, &data->u.PSI3); - break; - } - case MT_PACKET_SYSTEM_INFO_5: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(PSI5_t), vector, readIndex, &data->u.PSI5); - break; - } - case MT_PACKET_SYSTEM_INFO_13: - { - /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(PSI13_t), vector, readIndex, &data->u.PSI13); - break; - } - default: - /*ret = -1;*/ - break; - } -} - -void encode_gsm_rlcmac_uplink(bitvec * vector, RlcMacUplink_t * data) -{ - csnStream_t ar; - size_t writeIndex = 0; - data->NrOfBits = (23 - 1) * 8; - csnStreamInit(&ar, 0, data->NrOfBits); - writeIndex = 0; - switch (data->u.MESSAGE_TYPE) - { - case MT_PACKET_CELL_CHANGE_FAILURE: - { - /* - * data is the pointer to the unpack struct that hold the unpack value - * CSNDESCR is an array that holds the different element types - * ar is the csn context holding the bitcount, offset and output - */ - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Cell_Change_Failure_t), vector, writeIndex, &data->u.Packet_Cell_Change_Failure); - break; - } - case MT_PACKET_CONTROL_ACK: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Control_Acknowledgement_t), vector, writeIndex, &data->u.Packet_Control_Acknowledgement); - break; - } - case MT_PACKET_DOWNLINK_ACK_NACK: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Downlink_Ack_Nack_t), vector, writeIndex, &data->u.Packet_Downlink_Ack_Nack); - break; - } - case MT_PACKET_UPLINK_DUMMY_CONTROL_BLOCK: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Uplink_Dummy_Control_Block_t), vector, writeIndex, &data->u.Packet_Uplink_Dummy_Control_Block); - break; - } - case MT_PACKET_MEASUREMENT_REPORT: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Measurement_Report_t), vector, writeIndex, &data->u.Packet_Measurement_Report); - break; - } - case MT_PACKET_RESOURCE_REQUEST: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Resource_Request_t), vector, writeIndex, &data->u.Packet_Resource_Request); - break; - } - - case MT_PACKET_MOBILE_TBF_STATUS: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Mobile_TBF_Status_t), vector, writeIndex, &data->u.Packet_Mobile_TBF_Status); - break; - } - case MT_PACKET_PSI_STATUS: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_PSI_Status_t), vector, writeIndex, &data->u.Packet_PSI_Status); - break; - } - case MT_EGPRS_PACKET_DOWNLINK_ACK_NACK: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(EGPRS_PD_AckNack_t), vector, writeIndex, &data->u.Egprs_Packet_Downlink_Ack_Nack); - break; - } - case MT_PACKET_PAUSE: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Pause_t), vector, writeIndex, &data->u.Packet_Pause); - break; - } - case MT_PACKET_ENHANCED_MEASUREMENT_REPORT: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Enh_Measurement_Report_t), vector, writeIndex, &data->u.Packet_Enh_Measurement_Report); - break; - } - case MT_ADDITIONAL_MS_RAC: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Additional_MS_Rad_Access_Cap_t), vector, writeIndex, &data->u.Additional_MS_Rad_Access_Cap); - break; - } - case MT_PACKET_CELL_CHANGE_NOTIFICATION: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Cell_Change_Notification_t), vector, writeIndex, &data->u.Packet_Cell_Change_Notification); - break; - } - case MT_PACKET_SI_STATUS: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_SI_Status_t), vector, writeIndex, &data->u.Packet_SI_Status); - break; - } - default: - /*ret = -1;*/ - break; - } -} - -void encode_gsm_rlcmac_downlink(bitvec * vector, RlcMacDownlink_t * data) -{ - csnStream_t ar; - - /* See RLC/MAC downlink control block structure in TS 44.060 / 10.3.1 */ - gint bit_offset = 0; - gint bit_length; - size_t writeIndex = 0; - - if (data->PAYLOAD_TYPE == PAYLOAD_TYPE_DATA) - { - LOGPC(DRLCMACDATA, LOGL_NOTICE, "Payload Type: DATA (0), not implemented"); - return; - } - else if (data->PAYLOAD_TYPE == PAYLOAD_TYPE_RESERVED) - { - LOGPC(DRLCMACDATA, LOGL_NOTICE, "Payload Type: RESERVED (3)"); - return; - } - /* We can decode the message */ - else - { - /* First print the message type and create a tree item */ - bitvec_write_field(vector, writeIndex, data->PAYLOAD_TYPE, 2); - bitvec_write_field(vector, writeIndex, data->RRBP, 2); - bitvec_write_field(vector, writeIndex, data->SP, 1); - bitvec_write_field(vector, writeIndex, data->USF, 3); - bit_offset = 8; - if (data->PAYLOAD_TYPE == PAYLOAD_TYPE_CTRL_OPT_OCTET) - { - bitvec_write_field(vector, writeIndex, data->RBSN, 1); - bitvec_write_field(vector, writeIndex, data->RTI, 5); - bitvec_write_field(vector, writeIndex, data->FS, 1); - bitvec_write_field(vector, writeIndex, data->AC, 1); - bit_offset += 8; - if (data->AC == 1) - { - bitvec_write_field(vector, writeIndex, data->PR, 2); - bitvec_write_field(vector, writeIndex, data->TFI, 5); - bitvec_write_field(vector, writeIndex, data->D, 1); - bit_offset += 8; - } - if ((data->RBSN == 1) && (data->FS == 0)) - { - bitvec_write_field(vector, writeIndex, data->RBSNe, 3); - bitvec_write_field(vector, writeIndex, data->FSe, 1); - bitvec_write_field(vector, writeIndex, data->spare, 4); - bit_offset += 8; - } - } - } - - /* Initialize the contexts */ - bit_length = 23*8 - bit_offset; - data->NrOfBits = bit_length; - - csnStreamInit(&ar, bit_offset, bit_length); - - switch (data->u.MESSAGE_TYPE) - { - case MT_PACKET_ACCESS_REJECT: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Access_Reject_t), vector, writeIndex, &data->u.Packet_Access_Reject); - break; - } - case MT_PACKET_CELL_CHANGE_ORDER: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Cell_Change_Order_t), vector, writeIndex, &data->u.Packet_Cell_Change_Order); - break; - } - case MT_PACKET_CELL_CHANGE_CONTINUE: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Cell_Change_Continue_t), vector, writeIndex, &data->u.Packet_Cell_Change_Continue); - break; - } - case MT_PACKET_DOWNLINK_ASSIGNMENT: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Downlink_Assignment_t), vector, writeIndex, &data->u.Packet_Downlink_Assignment); - break; - } - case MT_PACKET_MEASUREMENT_ORDER: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Measurement_Order_t), vector, writeIndex, &data->u.Packet_Measurement_Order); - break; - } - case MT_PACKET_NEIGHBOUR_CELL_DATA: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Neighbour_Cell_Data_t), vector, writeIndex, &data->u.Packet_Neighbour_Cell_Data); - break; - } - case MT_PACKET_SERVING_CELL_DATA: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Serving_Cell_Data_t), vector, writeIndex, &data->u.Packet_Serving_Cell_Data); - break; - } - case MT_PACKET_PAGING_REQUEST: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Paging_Request_t), vector, writeIndex, &data->u.Packet_Paging_Request); - break; - } - case MT_PACKET_PDCH_RELEASE: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_PDCH_Release_t), vector, writeIndex, &data->u.Packet_PDCH_Release); - break; - } - case MT_PACKET_POLLING_REQ: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Polling_Request_t), vector, writeIndex, &data->u.Packet_Polling_Request); - break; - } - case MT_PACKET_POWER_CONTROL_TIMING_ADVANCE: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Power_Control_Timing_Advance_t), vector, writeIndex, &data->u.Packet_Power_Control_Timing_Advance); - break; - } - case MT_PACKET_PRACH_PARAMETERS: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_PRACH_Parameters_t), vector, writeIndex, &data->u.Packet_PRACH_Parameters); - break; - } - case MT_PACKET_QUEUEING_NOTIFICATION: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Queueing_Notification_t), vector, writeIndex, &data->u.Packet_Queueing_Notification); - break; - } - case MT_PACKET_TIMESLOT_RECONFIGURE: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Timeslot_Reconfigure_t), vector, writeIndex, &data->u.Packet_Timeslot_Reconfigure); - break; - } - case MT_PACKET_TBF_RELEASE: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_TBF_Release_t), vector, writeIndex, &data->u.Packet_TBF_Release); - break; - } - case MT_PACKET_UPLINK_ACK_NACK: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Uplink_Ack_Nack_t), vector, writeIndex, &data->u.Packet_Uplink_Ack_Nack); - break; - } - case MT_PACKET_UPLINK_ASSIGNMENT: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Uplink_Assignment_t), vector, writeIndex, &data->u.Packet_Uplink_Assignment); - break; - } - case MT_PACKET_HANDOVER_COMMAND: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Handover_Command_t), vector, writeIndex, &data->u.Packet_Handover_Command); - break; - } - case MT_PACKET_PHYSICAL_INFORMATION: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_PhysicalInformation_t), vector, writeIndex, &data->u.Packet_Handover_Command); - break; - } - case MT_PACKET_DOWNLINK_DUMMY_CONTROL_BLOCK: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Downlink_Dummy_Control_Block_t), vector, writeIndex, &data->u.Packet_Downlink_Dummy_Control_Block); - break; - } - case MT_PACKET_SYSTEM_INFO_1: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(PSI1_t), vector, writeIndex, &data->u.PSI1); - break; - } - case MT_PACKET_SYSTEM_INFO_2: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(PSI2_t), vector, writeIndex, &data->u.PSI2); - break; - } - case MT_PACKET_SYSTEM_INFO_3: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(PSI3_t), vector, writeIndex, &data->u.PSI3); - break; - } - case MT_PACKET_SYSTEM_INFO_5: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(PSI5_t), vector, writeIndex, &data->u.PSI5); - break; - } - case MT_PACKET_SYSTEM_INFO_13: - { - /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(PSI13_t), vector, writeIndex, &data->u.PSI13); - break; - } - default: - /*ret = -1;*/ - break; - } -} - -void decode_gsm_rlcmac_uplink_data(bitvec * vector, RlcMacUplinkDataBlock_t * data) -{ - size_t readIndex = 0; - //unsigned dataLen = 0; - guint8 payload_type = bitvec_read_field(vector, readIndex, 2); - if (payload_type == PAYLOAD_TYPE_DATA) - { - readIndex = 0; - // MAC header - data->PAYLOAD_TYPE = bitvec_read_field(vector, readIndex, 2); - data->CV = bitvec_read_field(vector, readIndex, 4); - data->SI = bitvec_read_field(vector, readIndex, 1); - data->R = bitvec_read_field(vector, readIndex, 1); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "PAYLOAD_TYPE = %u ", (unsigned)(data->PAYLOAD_TYPE)); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "CV = %u ", (unsigned)(data->CV)); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "SI = %u ", (unsigned)(data->SI)); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "R = %u ", (unsigned)(data->R)); - // Octet 1 - data->spare = bitvec_read_field(vector, readIndex, 1); - data->PI = bitvec_read_field(vector, readIndex, 1); - data->TFI = bitvec_read_field(vector, readIndex, 5); - data->TI = bitvec_read_field(vector, readIndex, 1); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "spare = %u ", (unsigned)(data->spare)); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "PI = %u ", (unsigned)(data->PI)); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "TFI = %u ", (unsigned)(data->TFI)); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "TI = %u ", (unsigned)(data->TI)); - - // Octet 2 - data->BSN = bitvec_read_field(vector, readIndex, 7); - data->E_1 = bitvec_read_field(vector, readIndex, 1); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "BSN = %u ", (unsigned)(data->BSN)); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "E_1 = %u ", (unsigned)(data->E_1)); - - - if(data->E_1 == 0) // Extension octet follows immediately - { - // Octet 3 (optional) - unsigned i = 0; - do - { - data->LENGTH_INDICATOR[i] = bitvec_read_field(vector, readIndex, 6); - data->M[i] = bitvec_read_field(vector, readIndex, 1); - data->E[i] = bitvec_read_field(vector, readIndex, 1); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "LENGTH_INDICATOR[%u] = %u ", i, (unsigned)(data->LENGTH_INDICATOR[i])); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "M[%u] = %u ", i, (unsigned)(data->M[i])); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "E[%u] = %u ", i, (unsigned)(data->E[i])); - i++; - } while((data->M[i-1] == 1)&&(data->E[i-1] == 0)); - } - if(data->TI == 1) // TLLI field is present - { - data->TLLI = bitvec_read_field(vector, readIndex, 32); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "TLLI = %08x ", data->TLLI); - if (data->PI == 1) // PFI is present if TI field indicates presence of TLLI - { - data->PFI = bitvec_read_field(vector, readIndex, 7); - data->E_2 = bitvec_read_field(vector, readIndex, 1); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "PFI = %u ", (unsigned)(data->PFI)); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "E_2 = %u ", (unsigned)(data->E_2)); - } - } - unsigned dataLen = 23 - readIndex/8; - LOGPC(DRLCMACDATA, LOGL_NOTICE, "DATA[%u] = ", dataLen); - for (unsigned i = 0; i < dataLen; i++) - { - data->RLC_DATA[i] = bitvec_read_field(vector, readIndex, 8); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "%02x", (unsigned)(data->RLC_DATA[i])); - } - LOGPC(DRLCMACDATA, LOGL_NOTICE, "\n"); - } - else - { - LOGPC(DRLCMACDATA, LOGL_NOTICE, "Payload Type: RESERVED (3)"); - return; - } -} - -void encode_gsm_rlcmac_downlink_data(bitvec * vector, RlcMacDownlinkDataBlock_t * data) -{ - size_t writeIndex = 0; - - if (data->PAYLOAD_TYPE == PAYLOAD_TYPE_DATA) - { - // MAC header - bitvec_write_field(vector, writeIndex, data->PAYLOAD_TYPE, 2); - bitvec_write_field(vector, writeIndex, data->RRBP, 2); - bitvec_write_field(vector, writeIndex, data->SP, 1); - bitvec_write_field(vector, writeIndex, data->USF, 3); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "PAYLOAD_TYPE = %u ", (unsigned)(data->PAYLOAD_TYPE)); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "RRBP = %u ", (unsigned)(data->RRBP)); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "SP = %u ", (unsigned)(data->SP)); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "USF = %u ", (unsigned)(data->USF)); - - // Octet 1 - bitvec_write_field(vector, writeIndex, data->PR, 2); - bitvec_write_field(vector, writeIndex, data->TFI, 5); - bitvec_write_field(vector, writeIndex, data->FBI, 1); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "PR = %u ", (unsigned)(data->PR)); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "TFI = %u ", (unsigned)(data->TFI)); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "FBI = %u ", (unsigned)(data->FBI)); - - // Octet 2 - bitvec_write_field(vector, writeIndex, data->BSN, 7); - bitvec_write_field(vector, writeIndex, data->E_1, 1); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "BSN = %u ", (unsigned)(data->BSN)); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "E_1 = %u ", (unsigned)(data->E_1)); - - // Octet 3 (optional) - if(data->E_1 == 0) - { - unsigned i = 0; - do - { - bitvec_write_field(vector, writeIndex, data->LENGTH_INDICATOR[i], 6); - bitvec_write_field(vector, writeIndex, data->M[i], 1); - bitvec_write_field(vector, writeIndex, data->E[i], 1); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "LENGTH_INDICATOR[%u] = %u ", i, (unsigned)(data->LENGTH_INDICATOR[i])); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "M[%u] = %u ", i, (unsigned)(data->M[i])); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "E[%u] = %u ", i, (unsigned)(data->E[i])); - i++; - } - while ((data->M[i-1] == 1) && (data->E[i-1] == 0)); - } - unsigned dataNumOctets = 23 - writeIndex/8; - LOGPC(DRLCMACDATA, LOGL_NOTICE, "DATA[%u] = ", dataNumOctets); - for (unsigned i = 0; i < dataNumOctets; i++) - { - bitvec_write_field(vector, writeIndex, data->RLC_DATA[i], 8); - LOGPC(DRLCMACDATA, LOGL_NOTICE, "%02x", (unsigned)(data->RLC_DATA[i])); - } - LOGPC(DRLCMACDATA, LOGL_NOTICE, "\n"); - } -} diff --git a/gsm_rlcmac.h b/gsm_rlcmac.h deleted file mode 100644 index afec1468..00000000 --- a/gsm_rlcmac.h +++ /dev/null @@ -1,5130 +0,0 @@ -/* gsm_rlcmac.h - * Definitions for GSM RLC MAC control plane message dissection in wireshark. - * TS 44.060 and 24.008 - * - * Copyright (C) 2011 Ivan Klyuchnikov - * - * By Vincent Helfre, based on original code by Jari Sassi - * with the gracious authorization of STE - * Copyright (c) 2011 ST-Ericsson - * - * $Id: packet-gsm_rlcmac.h 38909 2011-09-07 04:54:19Z etxrab $ - * - * Wireshark - Network traffic analyzer - * By Gerald Combs - * 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. - */ - -#include "csn1.h" -#include -#include -#ifndef __PACKET_GSM_RLCMAC_H__ -#define __PACKET_GSM_RLCMAC_H__ - -#ifndef PRE_PACKED -#define PRE_PACKED -#endif - -#ifndef POST_PACKED -#define POST_PACKED -#endif - -//TODO Check this number -#define MAX_NUMBER_LLC_PDU 5 - -typedef guint8 TFI_t; - -typedef guint8 N32_t; -typedef guint8 N51_t; -typedef guint8 N26_t; - -/* Starting Time IE as specified in 04.08 */ -typedef struct -{ - N32_t N32; /* 04.08 refers to T1' := (FN div 1326) mod 32 */ - N51_t N51; /* 04.08 refers to T3 := FN mod 51 */ - N26_t N26; /* 04.08 refers to T2 := FN mod 26 */ -} StartingTime_t; - -typedef struct -{ - guint8 UnionType;/* UnionType is index */ - union - { - guint8 UPLINK_TFI; - guint8 DOWNLINK_TFI; - } u; -} Global_TFI_t; - -typedef struct -{ - guint8 UnionType; - union - { - StartingTime_t StartingTime; - guint16 k; - } u; -} Starting_Frame_Number_t; - -typedef struct -{ - guint8 FINAL_ACK_INDICATION; - guint8 STARTING_SEQUENCE_NUMBER; - guint8 RECEIVED_BLOCK_BITMAP[64/8]; -} Ack_Nack_Description_t; - - -typedef struct -{ - guint8 Exist_TIMING_ADVANCE_VALUE; - guint8 TIMING_ADVANCE_VALUE; - - guint8 Exist_IndexAndtimeSlot; - guint8 TIMING_ADVANCE_INDEX; - guint8 TIMING_ADVANCE_TIMESLOT_NUMBER; -} Packet_Timing_Advance_t; - -typedef struct -{ - guint8 ALPHA; - - struct - { - guint8 Exist; - guint8 GAMMA_TN; - } Slot[8]; -} Power_Control_Parameters_t; - -typedef struct -{ - guint8 ALPHA; - guint8 T_AVG_W; - guint8 T_AVG_T; - guint8 Pb; - guint8 PC_MEAS_CHAN; - guint8 INT_MEAS_CHANNEL_LIST_AVAIL; - guint8 N_AVG_I; -} Global_Power_Control_Parameters_t; - -typedef struct -{ - guint8 Exist_TIMING_ADVANCE_VALUE; - guint8 TIMING_ADVANCE_VALUE; - - guint8 Exist_UPLINK_TIMING_ADVANCE; - guint8 UPLINK_TIMING_ADVANCE_INDEX; - guint8 UPLINK_TIMING_ADVANCE_TIMESLOT_NUMBER; - - guint8 Exist_DOWNLINK_TIMING_ADVANCE; - guint8 DOWNLINK_TIMING_ADVANCE_INDEX; - guint8 DOWNLINK_TIMING_ADVANCE_TIMESLOT_NUMBER; -} Global_Packet_Timing_Advance_t; - - -typedef struct -{ - guint8 C_VALUE; - guint8 RXQUAL; - guint8 SIGN_VAR; - - struct - { - guint8 Exist; - guint8 I_LEVEL_TN; - } Slot[8]; -} Channel_Quality_Report_t; - -typedef enum -{ - RLC_MODE_ACKNOWLEDGED = 0, - RLC_MODE_UNACKNOWLEDGED = 1 -} RLC_MODE_t; - -typedef struct -{ - guint8 PEAK_THROUGHPUT_CLASS; - guint8 RADIO_PRIORITY; - RLC_MODE_t RLC_MODE; - guint8 LLC_PDU_TYPE; - guint16 RLC_OCTET_COUNT; -} Channel_Request_Description_t; - -typedef struct -{ - guint16 RANDOM_ACCESS_INFORMATION; - guint8 FRAME_NUMBER[2]; -} Packet_Request_Reference_t; - -typedef PRE_PACKED struct -{ - guint8 nsapi; - guint8 value; -} Receive_N_PDU_Number_t POST_PACKED; - -typedef PRE_PACKED struct -{ - guint8 IEI; - guint8 Length; - - guint8 Count_Receive_N_PDU_Number; - Receive_N_PDU_Number_t Receive_N_PDU_Number[11]; -} Receive_N_PDU_Number_list_t POST_PACKED; - -/** IMSI length */ -#define IMSI_LEN 9 - -/** TMSI length */ -#define TMSI_LEN 4 - -typedef struct -{ - guint8 MCC1; - guint8 MCC2; - guint8 MCC3; - guint8 MNC3; - guint8 MNC1; - guint8 MNC2; -} PLMN_t; - - -/** This type is used to describe LAI codes */ -typedef PRE_PACKED struct -{ - PLMN_t PLMN; - guint16 LAC; -} LAI_t POST_PACKED; - - -/** Length of LAI */ -#define LAI_LEN (sizeof(LAI_t)) - -typedef struct -{ - guint8 TMSI[TMSI_LEN]; -}TMSI_t; - -typedef guint16 CellId_t; - - -#define CKSN_NOT_VALID 7 - -#define IMEI_LEN 9 - -#define IMEISV_LEN 10 - -#define MAX_ELEMENTS_IN_EQPLMN_LIST 16 - - -typedef struct -{ - guint8 NUMBER_CELLS; - guint8 CCN_SUPPORTED[16]; /* bit (1), max size: 16 x 8 => 128 bits */ -} CCN_Support_Description_t; - -typedef struct -{ - guint8 UnionType; - union - { - guint8 LSA_ID; - guint8 ShortLSA_ID; - } u; -} LSA_ID_Info_Element_t; - -#define LSA_ID_INFO_ELEMENTS_MAX (16) - -typedef struct -{ - guint8 Count_LSA_ID_Info_Element; - LSA_ID_Info_Element_t LSA_ID_Info_Elements[LSA_ID_INFO_ELEMENTS_MAX]; -} LSA_ID_Info_t; - -#define NR_OF_FREQ_OR_CELLS_MAX (32) - -typedef struct -{ - guint8 NR_OF_FREQ_OR_CELLS; - LSA_ID_Info_t LSA_ID_Info[NR_OF_FREQ_OR_CELLS_MAX]; -} LSA_Parameters_t; - -#define MAX_REPORT_PRIORITY_CELLS (16) - -typedef struct -{ - guint8 NUMBER_CELLS; - guint8 REPORT_PRIORITY[MAX_REPORT_PRIORITY_CELLS]; -} ReportPriority_t; - -typedef ReportPriority_t GPRSReportPriority_t; - -typedef struct -{ - guint8 REPORTING_OFFSET; - guint8 REPORTING_THRESHOLD; -} OffsetThreshold_t; - - -typedef struct -{ - guint8 Exist_MULTI_BAND_REPORTING; - guint8 MULTI_BAND_REPORTING; - - guint8 Exist_SERVING_BAND_REPORTING; - guint8 SERVING_BAND_REPORTING; - - /* Warning: - * - * SI2quater, MI, PMO, and PCCO always specify Scale Ord. There is no - * "exist SCALE_ORD" bit in the CSN.1 descriptions for these messages. - * However, this struct is shared with the PSI5 message which may or may - * not specify SCALE_ORD, thus necessitating the inclusion of member - * Exist_SCALE_ORD in the struct. This member is never set for SI2quater, MI, - * PMO, and PCCO so to check it (in these cases) would be erroneous. - */ - guint8 Exist_SCALE_ORD; - guint8 SCALE_ORD; - - guint8 Exist_OffsetThreshold900; - OffsetThreshold_t OffsetThreshold900; - - guint8 Exist_OffsetThreshold1800; - OffsetThreshold_t OffsetThreshold1800; - - guint8 Exist_OffsetThreshold400; - OffsetThreshold_t OffsetThreshold400; - - guint8 Exist_OffsetThreshold1900; - OffsetThreshold_t OffsetThreshold1900; - - guint8 Exist_OffsetThreshold850; - OffsetThreshold_t OffsetThreshold850; - -} MeasurementParams_t; - -typedef struct -{ - guint8 Exist_FDD_REPORTING_THRESHOLD_2; - guint8 FDD_REPORTING_THRESHOLD_2; -} GPRS_AdditionalMeasurementParams3G_t; - - -typedef struct -{ - guint8 NETWORK_CONTROL_ORDER; - - guint8 Exist_NC; - guint8 NC_NON_DRX_PERIOD; - guint8 NC_REPORTING_PERIOD_I; - guint8 NC_REPORTING_PERIOD_T; -} NC_Measurement_Parameters_t; - - -/* -**======================================================================== -** Global types -**======================================================================== -*/ - -struct MobileId /* Mobile id, -> TMSI, IMEI or IMSI */ -{ - guint8 Length:8; - guint8 IdType:3; - guint8 OddEven:1; - guint8 Dig1:4; - union - { - unsigned char TMSI[TMSI_LEN]; - unsigned char IMEI[IMEI_LEN - 2]; - unsigned char IMSI[IMEI_LEN - 2]; - unsigned char IMEISV[IMEISV_LEN - 2]; - } Id; -}; - -struct OV_MobileId /* Struct for optional mobile identity */ -{ - unsigned char IEI; - struct MobileId MV; -}; - -#define LAC_INVALID 0xFEFF - -typedef enum -{ - LAI_PRIORITY_AVAILABLE, - LAI_PRIORITY_FORBIDDEN, - LAI_PRIORITY_FORCED -}LAI_Priority_t; - -typedef enum -{ - NOM_I, - NOM_II, - NOM_III, - NOM_GSM, - NOM_PS_ONLY, - NOM_UNKNOWN -}NMO_t; - -typedef enum -{ - COMBINED, - NOT_COMBINED, - SAME_AS_BEFORE -}ProcedureMode_t; - -typedef struct -{ - guint8 Cause; - LAI_t LAI; - struct OV_MobileId MobileId; -}CombinedResult_t; - -typedef enum -{ - R97, - R99 -}MSCR_t, SGSNR_t; - -typedef struct -{ - guint8 NbrOfElements; - PLMN_t Element[MAX_ELEMENTS_IN_EQPLMN_LIST]; -}EqPLMN_List_t; - -#define MAX_PCCCH 16 -#define MAX_RFL_LENGTH 16 /* length of RFL in PSI2 */ -#define MAX_RFLS 4 /* Max number of RFLs */ -#define MAX_MA_LISTS_IN_PSI2 8 /* MAX MA lists = 8 */ -#define MAX_ALLOCATION_BITMAP_LENGTH 128 /* max length of Fixed Allocation bitmap in BITS (2^7) */ -#define MAX_VAR_LENGTH_BITMAP_LENGTH 176 /* max length ever possible for variable length fixed allocation bitmap */ -#define MAX_RRC_CONTAINER_LENGTH 255 -#define MAX_NAS_CONTAINER_LENGTH 127 - - -typedef struct -{ - guint8 MA_LENGTH;/* =(MA_BitLength +7) MA_BitLength_ converted to bytes */ - guint8 MA_BITMAP[(63+1)/8];/* : bit (val (MA_LENGTH) + 1) > */ - /* The above should not change order! */ - guint8 MA_BitLength; -} MobileAllocation_t; - -typedef struct -{ - guint8 ElementsOf_ARFCN_INDEX; - guint8 ARFCN_INDEX[16]; -} ARFCN_index_list_t; - -typedef struct -{ - guint8 HSN; - - guint8 ElementsOf_RFL_NUMBER; - guint8 RFL_NUMBER[4]; - - guint8 UnionType; - union - { - MobileAllocation_t MA; - ARFCN_index_list_t ARFCN_index_list; - } u; -} GPRS_Mobile_Allocation_t; - -/* < EGPRS Ack/Nack Description > - * CRBB - Compressed Received Blocks Bitmap - * URBB - Uncompressed Received Blocks Bitmap - */ -#define EGPRS_ACK_NACK_MAX_BITS 0x0FF /* 255 bits/32 bytes */ -#define CRBB_MAX_BITS 0x07F /* 127 bits/16 bytes */ -#define URBB_MAX_BITS 0x150 /* 336 bits/42 bytes */ - -typedef struct -{ - gboolean Exist_LENGTH; - guint8 LENGTH; - - guint8 FINAL_ACK_INDICATION; - guint8 BEGINNING_OF_WINDOW; - guint8 END_OF_WINDOW; - guint16 STARTING_SEQUENCE_NUMBER; - - gboolean Exist_CRBB; - guint8 CRBB_LENGTH; - guint8 CRBB_STARTING_COLOR_CODE; - guint8 CRBB[CRBB_MAX_BITS/8 + 1]; - - guint16 URBB_LENGTH; - guint8 URBB[URBB_MAX_BITS/8]; -} EGPRS_AckNack_t; - - -/* - * - */ -#define SF_VBS 0 /* VBS (broadcast call reference) */ -#define SF_VGCS 1 /* VGCS (group call reference) */ - -#define AF_AckIsNotRequired 0 /* acknowledgement is not required */ -#define AF_AckIsRequired 1 /* acknowledgement is required */ - -typedef struct -{ - guint32 value; - guint8 SF; - guint8 AF; - guint8 call_priority; - guint8 Ciphering_information; -} Group_Call_Reference_t; - -/* Mobile allocation is coded differently but uses the same type! */ -typedef struct -{ - guint8 Length; - guint8 MA[8]; -} MobileAllocationIE_t; - -typedef struct -{ - guint8 UnionType; - union - { - MobileAllocationIE_t MA; - guint8 Frequency_Short_List[64/8]; - } u; -} MobileAllocation_or_Frequency_Short_List_t; - -typedef struct -{ - guint8 spare; - guint16 ARFCN; -} SingleRFChannel_t; - -typedef struct -{ - guint8 MAIO; - guint8 HSN; -} RFHoppingChannel_t; - -typedef struct -{ - guint8 Channel_type_and_TDMA_offset; - guint8 TN; - guint8 TSC; - - guint8 UnionType; - union - { - SingleRFChannel_t SingleRFChannel; - RFHoppingChannel_t RFHoppingChannel; - } u; -} Channel_Description_t; - -typedef struct -{ - Channel_Description_t Channel_Description; - - guint8 Exist_Hopping; - MobileAllocation_or_Frequency_Short_List_t MA_or_Frequency_Short_List; - -} Group_Channel_Description_t; - -typedef struct -{ - Group_Call_Reference_t Group_Call_Reference; - - guint8 Exist_Group_Channel_Description; - Group_Channel_Description_t Group_Channel_Description; -} Group_Call_information_t; - -typedef struct -{ - guint8 Exist_NLN_PCH_and_NLN_status; - guint8 NLN_PCH; - guint8 NLN_status; - - guint8 Exist_Priority1; - guint8 Priority1; - - guint8 Exist_Priority2; - guint8 Priority2; - - guint8 Exist_Group_Call_information; - Group_Call_information_t Group_Call_information; - - guint8 Packet_Page_Indication_1; - guint8 Packet_Page_Indication_2; -} P1_Rest_Octets_t; - -typedef struct -{ - guint8 Exist_CN3; - guint8 CN3; - - guint8 Exist_NLN_and_status; - guint8 NLN; - guint8 NLN_status; - - guint8 Exist_Priority1; - guint8 Priority1; - - guint8 Exist_Priority2; - guint8 Priority2; - - guint8 Exist_Priority3; - guint8 Priority3; - - guint8 Packet_Page_Indication_3; -} P2_Rest_Octets_t; - -/* incl additions for R99 and EGPRS */ - -typedef struct -{ - guint8 USF; - guint8 USF_GRANULARITY; - - guint8 Exist_P0_PR_MODE; - guint8 P0; - guint8 PR_MODE; -} DynamicAllocation_t; - -typedef struct -{ - gboolean Exist_ALPHA; - guint8 ALPHA; - - guint8 GAMMA; - StartingTime_t TBF_STARTING_TIME; - guint8 NR_OF_RADIO_BLOCKS_ALLOCATED; - - gboolean Exist_P0_BTS_PWR_CTRL_PR_MODE; - guint8 P0; - guint8 BTS_PWR_CTRL_MODE; - guint8 PR_MODE; -} EGPRS_TwoPhaseAccess_t; - -typedef struct -{ - guint8 TFI_ASSIGNMENT; - guint8 POLLING; - - guint8 UnionType; - union - { - DynamicAllocation_t DynamicAllocation; - guint8 FixedAllocationDummy; /* Fixed Allocation was removed */ - } Allocation; - - guint8 EGPRS_CHANNEL_CODING_COMMAND; - guint8 TLLI_BLOCK_CHANNEL_CODING; - - gboolean Exist_BEP_PERIOD2; - guint8 BEP_PERIOD2; - - guint8 RESEGMENT; - guint8 EGPRS_WindowSize; - - gboolean Exist_ALPHA; - guint8 ALPHA; - - guint8 GAMMA; - - gboolean Exist_TIMING_ADVANCE_INDEX; - guint8 TIMING_ADVANCE_INDEX; - - gboolean Exist_TBF_STARTING_TIME; - StartingTime_t TBF_STARTING_TIME; -} EGPRS_OnePhaseAccess_t; - -#define MAX_ACCESS_TECHOLOGY_TYPES 12 - -typedef struct -{ - guint8 ExtendedRA; - - guint8 NrOfAccessTechnologies; - guint8 AccessTechnologyType[MAX_ACCESS_TECHOLOGY_TYPES]; - - guint8 UnionType; - union - { - EGPRS_TwoPhaseAccess_t TwoPhaseAccess; /* 04.18/10.5.2.16 Multiblock allocation */ - EGPRS_OnePhaseAccess_t OnePhaseAccess; /* 04.60/10.5.2.16 TFI using Dynamic or Fixed Allocation */ - } Access; -} IA_EGPRS_00_t; - -typedef struct -{ - guint8 UnionType; - union - { - IA_EGPRS_00_t IA_EGPRS_PUA; /* 00 < EGPRS Packet Uplink Assignment >*/ - guint8 IA_EGPRS_01; /* 01 reserved for future use */ - guint8 IA_EGPRS_1; /* 1 reserved for future use */ - } u; -} IA_EGPRS_t; - -typedef struct -{ - guint8 Length; - guint8 MAIO; - guint8 MobileAllocation[62]; -} IA_FreqParamsBeforeTime_t; - -typedef struct -{ - gboolean Exist_ALPHA; - guint8 ALPHA; - - guint8 GAMMA; - guint8 R97_CompatibilityBits; - StartingTime_t TBF_STARTING_TIME; - - gboolean Exist_P0_BTS_PWR_CTRL_PR_MODE; - guint8 P0; - guint8 BTS_PWR_CTRL_MODE; - guint8 PR_MODE; -} GPRS_SingleBlockAllocation_t; - -typedef struct -{ - guint8 TFI_ASSIGNMENT; - guint8 POLLING; - - guint8 UnionType; - union - { - DynamicAllocation_t DynamicAllocation; - guint8 FixedAllocationDummy; - } Allocation; - - guint8 CHANNEL_CODING_COMMAND; - guint8 TLLI_BLOCK_CHANNEL_CODING; - - guint8 Exist_ALPHA; - guint8 ALPHA; - - guint8 GAMMA; - - guint8 Exist_TIMING_ADVANCE_INDEX; - guint8 TIMING_ADVANCE_INDEX; - - guint8 Exist_TBF_STARTING_TIME; - StartingTime_t TBF_STARTING_TIME; -} GPRS_DynamicOrFixedAllocation_t; - -typedef struct -{ - gboolean Exist_ExtendedRA; - guint8 ExtendedRA; -} PU_IA_AdditionsR99_t; - -typedef struct -{ - guint8 UnionType; - union - { - GPRS_SingleBlockAllocation_t SingleBlockAllocation; - GPRS_DynamicOrFixedAllocation_t DynamicOrFixedAllocation; - } Access; - - gboolean Exist_AdditionsR99; - PU_IA_AdditionsR99_t AdditionsR99; -} Packet_Uplink_ImmAssignment_t; - -typedef struct -{ - guint8 EGPRS_WindowSize; - guint8 LINK_QUALITY_MEASUREMENT_MODE; - - gboolean Exist_BEP_PERIOD2; - guint8 BEP_PERIOD2; -} PD_IA_AdditionsR99_t; - -typedef struct -{ - guint32 TLLI; - - guint8 Exist_TFI_to_TA_VALID; - guint8 TFI_ASSIGNMENT; - guint8 RLC_MODE; - guint8 Exist_ALPHA; - guint8 ALPHA; - guint8 GAMMA; - guint8 POLLING; - guint8 TA_VALID; - - guint8 Exist_TIMING_ADVANCE_INDEX; - guint8 TIMING_ADVANCE_INDEX; - - guint8 Exist_TBF_STARTING_TIME; - StartingTime_t TBF_STARTING_TIME; - - guint8 Exist_P0_PR_MODE; - guint8 P0; - guint8 BTS_PWR_CTRL_MODE; - guint8 PR_MODE; - - gboolean Exist_AdditionsR99; - PD_IA_AdditionsR99_t AdditionsR99; -} Packet_Downlink_ImmAssignment_t; - -typedef struct -{ - gboolean Exist_SecondPart; - - gboolean Exist_ExtendedRA; - guint8 ExtendedRA; -} Second_Part_Packet_Assignment_t; - -typedef struct -{ - guint8 UnionType; - union - { - Packet_Uplink_ImmAssignment_t Packet_Uplink_ImmAssignment; - Packet_Downlink_ImmAssignment_t Packet_Downlink_ImmAssignment; - } ul_dl; -} IA_PacketAssignment_UL_DL_t; - -typedef struct -{ - guint8 UnionType; - union - { - IA_PacketAssignment_UL_DL_t UplinkDownlinkAssignment; - Second_Part_Packet_Assignment_t Second_Part_Packet_Assignment; - } u; -} IA_PacketAssignment_t; - -typedef struct -{ - guint8 UnionType; - union - { - IA_FreqParamsBeforeTime_t IA_FrequencyParams; - IA_PacketAssignment_t IA_PacketAssignment; - } u; -} IA_GPRS_t; - -typedef struct -{ - guint8 UnionType; - union - { - IA_EGPRS_t IA_EGPRS_Struct; - IA_GPRS_t IA_GPRS_Struct; - } u; -} IA_t; - - -/* ref: 04.18/10.5.2.17 */ -typedef struct -{ - guint8 Exist_ExtendedRA; - guint8 ExtendedRA; -} ExtendedRA_Info_t; - -typedef ExtendedRA_Info_t ExtendedRA_Info_Array_t[4]; - -typedef struct -{ - ExtendedRA_Info_Array_t ExtendedRA_Info; -} IAR_t; - - -/* Packet Polling Request */ -typedef struct -{ - guint8 UnionType; - union - { - Global_TFI_t Global_TFI; - guint32 TLLI; - guint16 TQI; - } u; -} PacketPollingID_t; - -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PAGE_MODE; - PacketPollingID_t ID; - guint8 TYPE_OF_ACK; -} Packet_Polling_Request_t; - -/* < SI 13 Rest Octets > */ -#define MAX_EXTENSION_LENGTH_IN_BYTES (8) /* max value = 64 (coded on 6 bits) */ - -typedef struct -{ - guint8 extension_length; - guint8 Extension_Info[MAX_EXTENSION_LENGTH_IN_BYTES];/* ( val (extension length)+1 ) 04.60/12.26 */ -} Extension_Bits_t; - -typedef struct -{ - guint8 DTM_SUPPORT : 1; - guint8 PFC_FEATURE_MODE : 1; - guint8 BEP_PERIOD : 4; - guint8 EGPRS_PACKET_CHANNEL_REQUEST : 1; - guint8 EGPRS_Support : 1; - - guint8 NotUsed : 3; - guint8 EXT_UTBF_NODATA : 1; - guint8 MULTIPLE_TBF_CAPABILITY : 1; - guint8 NW_EXT_UTBF : 1; - guint8 CCN_ACTIVE : 1; - guint8 BSS_PAGING_COORDINATION : 1; -} GPRS_ExtensionInfoWithEGPRS_t; - -typedef struct -{ - guint8 EXT_UTBF_NODATA : 1; - guint8 MULTIPLE_TBF_CAPABILITY : 1; - guint8 NW_EXT_UTBF : 1; - guint8 CCN_ACTIVE : 1; - guint8 BSS_PAGING_COORDINATION : 1; - guint8 DTM_SUPPORT : 1; - guint8 PFC_FEATURE_MODE : 1; - guint8 EGPRS_Support : 1; -} GPRS_ExtensionInfoWithoutEGPRS_t; - -typedef struct -{ - guint8 NotUsed : 7; - guint8 EGPRS_Support : 1; -} EGPRS_Support_t; - -typedef struct -{ - guint8 ECSC : 1; - guint8 ECSR_3G : 1; -} NonGPRS_ExtensionInfo_t; - -typedef struct -{ - guint8 Extension_Length; - union - { - EGPRS_Support_t EGPRS_Support; - GPRS_ExtensionInfoWithEGPRS_t GPRS_ExtensionInfoWithEGPRS; - GPRS_ExtensionInfoWithoutEGPRS_t GPRS_ExtensionInfoWithoutEGPRS; - NonGPRS_ExtensionInfo_t NonGPRS_ExtensionInfo; - guint8 Extension_Information[MAX_EXTENSION_LENGTH_IN_BYTES]; - } u; -} Optional_Extension_Information_t; - -typedef struct -{ - gboolean EGPRS_Support; - guint8 BEP_PERIOD; - gboolean EGPRS_PACKET_CHANNEL_REQUEST; -} EGPRS_OptionalExtensionInformation_t; - - -typedef struct -{ - guint8 NMO; - guint8 T3168; - guint8 T3192; - guint8 DRX_TIMER_MAX; - guint8 ACCESS_BURST_TYPE; - guint8 CONTROL_ACK_TYPE; - guint8 BS_CV_MAX; - - guint8 Exist_PAN; - guint8 PAN_DEC; - guint8 PAN_INC; - guint8 PAN_MAX; - - guint8 Exist_Extension_Bits; - Extension_Bits_t Extension_Bits; -} GPRS_Cell_Options_t; - -typedef struct -{ - guint8 ALPHA; - guint8 T_AVG_W; - guint8 T_AVG_T; - guint8 PC_MEAS_CHAN; - guint8 N_AVG_I; -} GPRS_Power_Control_Parameters_t; - -typedef struct -{ - guint8 RAC; - guint8 SPGC_CCCH_SUP; - guint8 PRIORITY_ACCESS_THR; - guint8 NETWORK_CONTROL_ORDER; - GPRS_Cell_Options_t GPRS_Cell_Options; - GPRS_Power_Control_Parameters_t GPRS_Power_Control_Parameters; -} PBCCH_Not_present_t; - -typedef struct -{ - guint8 Pb; - guint8 TSC; - guint8 TN; - - guint8 UnionType; - union - { - guint8 dummy; - guint16 ARFCN; - guint8 MAIO; - } u; -} PBCCH_Description_t; - -typedef struct -{ - guint8 PSI1_REPEAT_PERIOD; - PBCCH_Description_t PBCCH_Description; -} PBCCH_present_t; - - - -/* < Packet TBF Release message content > */ -typedef guint8 TBF_RELEASE_CAUSE_t; -#define TBF_RELEASE_CAUSE_NORMAL (0x00) -#define TBF_RELEASE_CAUSE_ABNORMAL (0x02) - -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PAGE_MODE; - Global_TFI_t Global_TFI; - guint8 UPLINK_RELEASE; - guint8 DOWNLINK_RELEASE; - TBF_RELEASE_CAUSE_t TBF_RELEASE_CAUSE; -} Packet_TBF_Release_t; - -/* < Packet Control Acknowledgement message content > */ -typedef struct -{ - guint8 Exist_CTRL_ACK_Extension; - guint16 CTRL_ACK_Extension; -} Packet_Control_Acknowledgement_AdditionsR6_t; - -typedef struct -{ - guint8 Exist_TN_RRBP; - guint8 TN_RRBP; - guint8 Exist_G_RNTI_Extension; - guint8 G_RNTI_Extension; - gboolean Exist_AdditionsR6; - Packet_Control_Acknowledgement_AdditionsR6_t AdditionsR6; -} Packet_Control_Acknowledgement_AdditionsR5_t; - -typedef struct -{ /* Mac header */ - guint8 MESSAGE_TYPE; - guint8 PayloadType; - guint8 spare; - guint8 R; - - guint32 TLLI; - guint8 CTRL_ACK; - gboolean Exist_AdditionsR5; - Packet_Control_Acknowledgement_AdditionsR5_t AdditionsR5; -} Packet_Control_Acknowledgement_t; - -typedef Packet_Control_Acknowledgement_t Packet_Ctrl_Ack_t; - -typedef struct -{ - guint8 CTRL_ACK; -} Packet_Control_Acknowledgement_11_bit_t, Packet_Control_Acknowledgement_8_bit_t; - -/* < Packet Downlink Dummy Control Block message content > */ -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PAGE_MODE; - - guint8 Exist_PERSISTENCE_LEVEL; - guint8 PERSISTENCE_LEVEL[4]; -} Packet_Downlink_Dummy_Control_Block_t; - -/* < Packet Uplink Dummy Control Block message content > */ -typedef struct -{ /* Mac header */ - guint8 MESSAGE_TYPE; - guint8 PayloadType; - guint8 spare; - guint8 R; - - guint32 TLLI; -} Packet_Uplink_Dummy_Control_Block_t; - -/*< MS Radio Access capability IE > - * 24.008 (10.5.5.12a) - */ -typedef guint8 A5_bits_t;/* ::= < A5/1 : bit> ; -- bits for circuit mode ciphering algorithms */ - -typedef struct -{ - guint8 Exist_DTM_EGPRS_multislot_class; - guint8 DTM_EGPRS_multislot_class; -} DTM_EGPRS_t; - -typedef struct -{ - guint8 Exist_DTM_EGPRS_HighMultislotClass; - guint8 DTM_EGPRS_HighMultislotClass; -} DTM_EGPRS_HighMultislotClass_t; - -typedef struct -{ - guint8 Exist_HSCSD_multislot_class; - guint8 HSCSD_multislot_class; - - guint8 Exist_GPRS_multislot_class; - guint8 GPRS_multislot_class; - guint8 GPRS_Extended_Dynamic_Allocation_Capability; - - guint8 Exist_SM; - guint8 SMS_VALUE; - guint8 SM_VALUE; - -/*-------- Rel 99 additions */ - guint8 Exist_ECSD_multislot_class; - guint8 ECSD_multislot_class; - - guint8 Exist_EGPRS_multislot_class; - guint8 EGPRS_multislot_class; - guint8 EGPRS_Extended_Dynamic_Allocation_Capability; - - guint8 Exist_DTM_GPRS_multislot_class; - guint8 DTM_GPRS_multislot_class; - guint8 Single_Slot_DTM; - DTM_EGPRS_t DTM_EGPRS_Params; -} Multislot_capability_t; - -typedef struct -{ - guint8 RF_Power_Capability; - - guint8 Exist_A5_bits; - A5_bits_t A5_bits; - /*-- zero means that the same values apply for parameters as in the immediately preceeding Access capabilities field within this IE - *-- The presence of the A5 bits is mandatory in the 1st Access capabilies struct within this IE. - */ - - guint8 ES_IND; - guint8 PS; - guint8 VGCS; - guint8 VBS; - - guint8 Exist_Multislot_capability; - Multislot_capability_t Multislot_capability; - /* -- zero means that the same values apply for multislot parameters as in the immediately preceeding Access capabilities field within this IE. - * -- The presence of the Multislot capability struct is mandatory in the 1st Access capabilites struct within this IE. - */ - /* -------- Rel 99 additions */ - guint8 Exist_Eight_PSK_Power_Capability; - guint8 Eight_PSK_Power_Capability; - - guint8 COMPACT_Interference_Measurement_Capability; - guint8 Revision_Level_Indicator; - guint8 UMTS_FDD_Radio_Access_Technology_Capability; - guint8 UMTS_384_TDD_Radio_Access_Technology_Capability; - guint8 CDMA2000_Radio_Access_Technology_Capability; - - /* -------- R4 additions */ - guint8 UMTS_128_TDD_Radio_Access_Technology_Capability; - guint8 GERAN_Feature_Package_1; - - guint8 Exist_Extended_DTM_multislot_class; - guint8 Extended_DTM_GPRS_multislot_class; - guint8 Extended_DTM_EGPRS_multislot_class; - - guint8 Modulation_based_multislot_class_support; - - /* -------- R5 additions */ - guint8 Exist_HighMultislotCapability; - guint8 HighMultislotCapability; - - guint8 Exist_GERAN_lu_ModeCapability; - guint8 GERAN_lu_ModeCapability; - - guint8 GMSK_MultislotPowerProfile; - guint8 EightPSK_MultislotProfile; - - /* -------- R6 additions */ - guint8 MultipleTBF_Capability; - guint8 DownlinkAdvancedReceiverPerformance; - guint8 ExtendedRLC_MAC_ControlMessageSegmentionsCapability; - guint8 DTM_EnhancementsCapability; - - guint8 Exist_DTM_GPRS_HighMultislotClass; - guint8 DTM_GPRS_HighMultislotClass; - DTM_EGPRS_HighMultislotClass_t DTM_EGPRS_HighMultislotClass; - guint8 PS_HandoverCapability; -} Content_t; - -#define ABSOLUTE_MAX_BANDS 2 /* New fields for R4 extend the length of the capabilities message so we can only send 2 */ - -#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 */ - AccTech_GSMP = 0x0, - AccTech_GSME = 0x1, - AccTech_GSM1800 = 0x3, - AccTech_GSM1900 = 0x4, - AccTech_GSM850 = 0x7, - AccTech_GSMOther = 0xf -} AccessTechnology_t; - -typedef struct -{ - guint8 CountAccessTechnologies; - AccessTechnology_t AccessTechnologies[MAX_ACCESS_TECHNOLOGIES_COUNT]; -} AccessTechnologiesRequest_t; - -typedef struct -{ - AccessTechnology_t Access_Technology_Type; - guint8 GMSK_Power_class; - guint8 Eight_PSK_Power_class; -} Additional_access_technologies_struct_t; - -typedef struct -{ - guint8 Count_additional_access_technologies; - /* The value 0xf cannot be set for the first ATT, therefore we can only have - ABSOLUTE_MAX_BANDS-1 additional access technologies. */ - Additional_access_technologies_struct_t Additional_access_technologies[ABSOLUTE_MAX_BANDS-1]; -} Additional_access_technologies_t; - -typedef struct -{ - guint8 IndexOfAccTech; /* Position in AccessTechnology_t */ - union - { - /* Long Form */ - Content_t Content; - /* Short Form */ - Additional_access_technologies_t Additional_access_technologies; - } u; -} MS_RA_capability_value_t; - -typedef struct -{ - guint8 Count_MS_RA_capability_value; /* Recursive */ - MS_RA_capability_value_t MS_RA_capability_value[ABSOLUTE_MAX_BANDS]; -} MS_Radio_Access_capability_t; - - -typedef struct -{ - guint8 ExistEDGE_RF_PwrCap1; - guint8 EDGE_RF_PwrCap1; - guint8 ExistEDGE_RF_PwrCap2; - guint8 EDGE_RF_PwrCap2; -} EDGE_RF_Pwr_t; - -typedef struct -{ - guint8 A5_Bits; - guint8 Arc2_Spare; - guint8 Arc1; -} ARC_t; - -typedef struct -{ - guint8 Multiband; - union - { - guint8 A5_Bits; - ARC_t ARC; - } u; -} Multiband_t; - -typedef struct /* MS classmark 3 R99 */ -{ - guint8 Spare1; - Multiband_t Multiband; - - guint8 Exist_R_Support; - guint8 R_GSM_Arc; - - guint8 Exist_MultiSlotCapability; - guint8 MultiSlotClass; - - guint8 UCS2; - guint8 ExtendedMeasurementCapability; - - guint8 Exist_MS_MeasurementCapability; - guint8 SMS_VALUE; - guint8 SM_VALUE; - - guint8 Exist_MS_PositioningMethodCapability; - guint8 MS_PositioningMethod; - - guint8 Exist_EDGE_MultiSlotCapability; - guint8 EDGE_MultiSlotClass; - - guint8 Exist_EDGE_Struct; - guint8 ModulationCapability; - EDGE_RF_Pwr_t EDGE_RF_PwrCaps; - - guint8 Exist_GSM400_Info; - guint8 GSM400_Bands; - guint8 GSM400_Arc; - - guint8 Exist_GSM850_Arc; - guint8 GSM850_Arc; - - guint8 Exist_PCS1900_Arc; - guint8 PCS1900_Arc; - - guint8 UMTS_FDD_Radio_Access_Technology_Capability; - guint8 UMTS_384_TDD_Radio_Access_Technology_Capability; - guint8 CDMA2000_Radio_Access_Technology_Capability; - - guint8 Exist_DTM_GPRS_multislot_class; - guint8 DTM_GPRS_multislot_class; - guint8 Single_Slot_DTM; - DTM_EGPRS_t DTM_EGPRS_Params; - - /* -------- R4 additions */ - guint8 Exist_SingleBandSupport; - guint8 GSM_Band; - - guint8 Exist_GSM_700_Associated_Radio_Capability; - guint8 GSM_700_Associated_Radio_Capability; - - guint8 UMTS_128_TDD_Radio_Access_Technology_Capability; - guint8 GERAN_Feature_Package_1; - - guint8 Exist_Extended_DTM_multislot_class; - guint8 Extended_DTM_GPRS_multislot_class; - guint8 Extended_DTM_EGPRS_multislot_class; - - /* -------- R5 additions */ - guint8 Exist_HighMultislotCapability; - guint8 HighMultislotCapability; - - guint8 Exist_GERAN_lu_ModeCapability; - guint8 GERAN_lu_ModeCapability; - - guint8 GERAN_FeaturePackage_2; - - guint8 GMSK_MultislotPowerProfile; - guint8 EightPSK_MultislotProfile; - - /* -------- R6 additions */ - guint8 Exist_TGSM_400_Bands; - guint8 TGSM_400_BandsSupported; - guint8 TGSM_400_AssociatedRadioCapability; - - guint8 Exist_TGSM_900_AssociatedRadioCapability; - guint8 TGSM_900_AssociatedRadioCapability; - - guint8 DownlinkAdvancedReceiverPerformance; - guint8 DTM_EnhancementsCapability; - - guint8 Exist_DTM_GPRS_HighMultislotClass; - guint8 DTM_GPRS_HighMultislotClass; - guint8 OffsetRequired; - DTM_EGPRS_HighMultislotClass_t DTM_EGPRS_HighMultislotClass; - guint8 RepeatedSACCH_Capability; - - guint8 Spare2; -} MS_Class3_Unpacked_t; - - -/* < Packet Resource Request message content > */ -typedef struct -{ - gboolean Exist; - guint8 UnionType; - union - { - guint8 MEAN_BEP_GMSK; - guint8 MEAN_BEP_8PSK; - } u; -} BEP_MeasurementReport_t; - -typedef struct -{ - gboolean Exist; - guint8 I_LEVEL; -} InterferenceMeasurementReport_t; - -typedef struct -{ - gboolean Exist_BEP_MEASUREMENTS; - BEP_MeasurementReport_t BEP_MEASUREMENTS[8]; - - gboolean Exist_INTERFERENCE_MEASUREMENTS; - InterferenceMeasurementReport_t INTERFERENCE_MEASUREMENTS[8]; -} EGPRS_TimeslotLinkQualityMeasurements_t; - -typedef struct -{ - gboolean Exist_MEAN_CV_BEP_GMSK; - guint8 MEAN_BEP_GMSK; - guint8 CV_BEP_GMSK; - - gboolean Exist_MEAN_CV_BEP_8PSK; - guint8 MEAN_BEP_8PSK; - guint8 CV_BEP_8PSK; -} EGPRS_BEP_LinkQualityMeasurements_t; - -typedef struct -{ - gboolean Exist_EGPRS_BEP_LinkQualityMeasurements; - EGPRS_BEP_LinkQualityMeasurements_t EGPRS_BEP_LinkQualityMeasurements; - - gboolean Exist_EGPRS_TimeslotLinkQualityMeasurements; - EGPRS_TimeslotLinkQualityMeasurements_t EGPRS_TimeslotLinkQualityMeasurements; - - gboolean Exist_PFI; - guint8 PFI; - - guint8 MS_RAC_AdditionalInformationAvailable; - guint8 RetransmissionOfPRR; -} PRR_AdditionsR99_t; - -typedef struct -{ - guint8 UnionType; - union - { - Global_TFI_t Global_TFI; - guint32 TLLI; - } u; -} PacketResourceRequestID_t; - -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PayloadType; - guint8 spare; - guint8 R; - - guint8 Exist_ACCESS_TYPE; - guint8 ACCESS_TYPE; - - PacketResourceRequestID_t ID; - - guint8 Exist_MS_Radio_Access_capability; - MS_Radio_Access_capability_t MS_Radio_Access_capability; - - Channel_Request_Description_t Channel_Request_Description; - - guint8 Exist_CHANGE_MARK; - guint8 CHANGE_MARK; - - guint8 C_VALUE; - - guint8 Exist_SIGN_VAR; - guint8 SIGN_VAR; - - InterferenceMeasurementReport_t Slot[8]; - - guint8 Exist_AdditionsR99; - PRR_AdditionsR99_t AdditionsR99; -} Packet_Resource_Request_t; - -/* < Packet Mobile TBF Status message content >*/ -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PayloadType; - guint8 spare; - guint8 R; - - Global_TFI_t Global_TFI; - guint8 TBF_CAUSE; - - guint8 Exist_STATUS_MESSAGE_TYPE; - guint8 STATUS_MESSAGE_TYPE; -} Packet_Mobile_TBF_Status_t; - -/* < Packet PSI Status message content >*/ -typedef struct -{ - guint8 PSI_MESSAGE_TYPE; - guint8 PSIX_CHANGE_MARK; - guint8 Exist_PSIX_COUNT_and_Instance_Bitmap; -} PSI_Message_t; - -typedef struct -{ - guint8 Count_PSI_Message; - PSI_Message_t PSI_Message[10]; - - guint8 ADDITIONAL_MSG_TYPE; -} PSI_Message_List_t; - -typedef struct -{ - guint8 ADDITIONAL_MSG_TYPE; -} Unknown_PSI_Message_List_t; - -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PayloadType; - guint8 spare; - guint8 R; - - Global_TFI_t Global_TFI; - guint8 PBCCH_CHANGE_MARK; - - PSI_Message_List_t PSI_Message_List; - Unknown_PSI_Message_List_t Unknown_PSI_Message_List; -} Packet_PSI_Status_t; - -/* < Packet SI Status message content > */ -typedef struct -{ - guint8 SI_MESSAGE_TYPE; - guint8 MESS_REC; - guint8 SIX_CHANGE_MARK; - - guint8 SIX_COUNT; - guint8 Instance_bitmap[2]; -} SI_Message_t; - -typedef struct -{ - guint8 Count_SI_Message; - SI_Message_t SI_Message[10]; - - guint8 ADDITIONAL_MSG_TYPE; -} SI_Message_List_t; - -typedef struct -{ - guint8 ADDITIONAL_MSG_TYPE; -} Unknown_SI_Message_List_t; - -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PayloadType; - guint8 spare; - guint8 R; - - Global_TFI_t Global_TFI; - guint8 BCCH_CHANGE_MARK; - - SI_Message_List_t SI_Message_List; - Unknown_SI_Message_List_t Unknown_SI_Message_List; -} Packet_SI_Status_t; - -typedef struct -{ - guint16 FDD_ARFCN; - guint8 DIVERSITY; - guint8 Exist_Bandwith_FDD; - guint8 BANDWITH_FDD; - guint16 SCRAMBLING_CODE; -} FDD_Target_Cell_t; - -typedef struct -{ - guint16 TDD_ARFCN; - guint8 DIVERSITY_TDD; - guint8 Exist_Bandwith_TDD; - guint8 BANDWITH_TDD; - guint16 CELL_PARAMETER; - guint8 Sync_Case_TSTD; -} TDD_Target_Cell_t; - -typedef struct -{ - guint16 EARFCN; - guint8 Exist_Measurement_Bandwidth; - guint8 Measurement_Bandwidth; - guint16 Physical_Layer_Cell_Identity; -}EUTRAN_Target_Cell_t; - -typedef struct -{ - guint32 UTRAN_CI; - guint8 Exist_PLMN_ID; - PLMN_t PLMN_ID; -}UTRAN_CSG_Target_Cell_t; - -typedef struct -{ - guint32 EUTRAN_CI; - guint16 Tracking_Area_Code; - guint8 Exist_PLMN_ID; - PLMN_t PLMN_ID; -}EUTRAN_CSG_Target_Cell_t; - -typedef struct -{ - guint8 Exist_UTRAN_CSG_Target_Cell; - UTRAN_CSG_Target_Cell_t UTRAN_CSG_Target_Cell; - guint8 Exist_EUTRAN_CSG_Target_Cell; - EUTRAN_CSG_Target_Cell_t EUTRAN_CSG_Target_Cell; -}PCCF_AdditionsR9_t; - -typedef struct -{ - guint8 Exist_EUTRAN_Target_Cell; - EUTRAN_Target_Cell_t EUTRAN_Target_Cell; - guint8 Exist_AdditionsR9; - PCCF_AdditionsR9_t AdditionsR9; -}PCCF_AdditionsR8_t; - -typedef struct -{ - guint8 Exist_G_RNTI_extention; - guint8 G_RNTI_extention; - guint8 Exist_AdditionsR8; - PCCF_AdditionsR8_t AdditionsR8; -} PCCF_AdditionsR5_t; - -typedef struct -{ - guint8 Exist_FDD_Description; - FDD_Target_Cell_t FDD_Target_Cell; - guint8 Exist_TDD_Description; - TDD_Target_Cell_t TDD_Target_Cell; - guint8 Exist_AdditionsR5; - PCCF_AdditionsR5_t AdditionsR5; -} PCCF_AdditionsR99_t; - -/* < Packet Cell Change Failure message content > */ -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PayloadType; - guint8 spare; - guint8 R; - - guint32 TLLI; - guint16 ARFCN; - guint8 BSIC; - guint8 CAUSE; - gboolean Exist_AdditionsR99; - PCCF_AdditionsR99_t AdditionsR99; -} Packet_Cell_Change_Failure_t; - -/* < Packet Downlink Ack/Nack message content > */ -typedef struct -{ - gboolean Exist_PFI; - guint8 PFI; -} PD_AckNack_AdditionsR99_t; - -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PayloadType; - guint8 spare; - guint8 R; - - guint8 DOWNLINK_TFI; - Ack_Nack_Description_t Ack_Nack_Description; - - guint8 Exist_Channel_Request_Description; - Channel_Request_Description_t Channel_Request_Description; - - Channel_Quality_Report_t Channel_Quality_Report; - - gboolean Exist_AdditionsR99; - PD_AckNack_AdditionsR99_t AdditionsR99; -} Packet_Downlink_Ack_Nack_t; - -/* < EGPRS Packet Downlink Ack/Nack message content > */ -typedef struct -{ - EGPRS_BEP_LinkQualityMeasurements_t EGPRS_BEP_LinkQualityMeasurements; - guint8 C_VALUE; - EGPRS_TimeslotLinkQualityMeasurements_t EGPRS_TimeslotLinkQualityMeasurements; -} EGPRS_ChannelQualityReport_t; - -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PayloadType; - guint8 spare; - guint8 R; - - guint8 DOWNLINK_TFI; - guint8 MS_OUT_OF_MEMORY; - - gboolean Exist_EGPRS_ChannelQualityReport; - EGPRS_ChannelQualityReport_t EGPRS_ChannelQualityReport; - - gboolean Exist_ChannelRequestDescription; - Channel_Request_Description_t ChannelRequestDescription; - - gboolean Exist_PFI; - guint8 PFI; - - gboolean Exist_ExtensionBits; - Extension_Bits_t ExtensionBits; - - EGPRS_AckNack_t EGPRS_AckNack; -} EGPRS_PD_AckNack_t; - -/* < Packet Uplink Ack/Nack message content 04.60 sec.11.2.28 > */ - -typedef struct -{ - guint8 Exist_CONTENTION_RESOLUTION_TLLI; - guint32 CONTENTION_RESOLUTION_TLLI; - - guint8 Exist_Packet_Timing_Advance; - Packet_Timing_Advance_t Packet_Timing_Advance; - - guint8 Exist_Extension_Bits; - Extension_Bits_t Extension_Bits; - - guint8 Exist_Power_Control_Parameters; - Power_Control_Parameters_t Power_Control_Parameters; -} Common_Uplink_Ack_Nack_Data_t; - -typedef struct -{ - gboolean Exist_PacketExtendedTimingAdvance; - guint8 PacketExtendedTimingAdvance; - guint8 TBF_EST; -} PU_AckNack_GPRS_AdditionsR99_t; - -typedef struct -{ - guint8 CHANNEL_CODING_COMMAND; - Ack_Nack_Description_t Ack_Nack_Description; - - guint8 UnionType; - union - { - guint8 FixedAllocationDummy; - guint8 Error; - } u; - - gboolean Exist_AdditionsR99; - PU_AckNack_GPRS_AdditionsR99_t AdditionsR99; - - - Common_Uplink_Ack_Nack_Data_t Common_Uplink_Ack_Nack_Data; -} PU_AckNack_GPRS_t; - -typedef struct -{ - guint8 EGPRS_ChannelCodingCommand; - guint8 RESEGMENT; - guint8 PRE_EMPTIVE_TRANSMISSION; - guint8 PRR_RETRANSMISSION_REQUEST; - guint8 ARAC_RETRANSMISSION_REQUEST; - - guint8 TBF_EST; - - gboolean Exist_Packet_Extended_Timing_Advance; - guint8 Packet_Extended_Timing_Advance; - - EGPRS_AckNack_t EGPRS_AckNack; - - - Common_Uplink_Ack_Nack_Data_t Common_Uplink_Ack_Nack_Data; -} PU_AckNack_EGPRS_00_t; - -typedef struct -{ - guint8 UnionType; - union - { - PU_AckNack_EGPRS_00_t PU_AckNack_EGPRS_00; - guint8 extension_01; - guint8 extension_10; - guint8 extension_11; - } u; -} PU_AckNack_EGPRS_t; - -enum PUAN_Type -{ - PUAN_GPRS, - PUAN_EGPRS -}; - -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PAGE_MODE; - guint8 UPLINK_TFI; - - guint8 UnionType; - union - { - PU_AckNack_GPRS_t PU_AckNack_GPRS_Struct; - PU_AckNack_EGPRS_t PU_AckNack_EGPRS_Struct; - } u; -} Packet_Uplink_Ack_Nack_t; - -/* < Packet Uplink Assignment message content > */ -typedef struct -{ - guint8 CHANGE_MARK_1; - guint8 Exist_CHANGE_MARK_2; - guint8 CHANGE_MARK_2; -} CHANGE_MARK_t; - -typedef struct -{ - guint8 MAIO; - guint8 MA_NUMBER; - - guint8 Exist_CHANGE_MARK; - CHANGE_MARK_t CHANGE_MARK; -} Indirect_encoding_t; - -typedef struct -{ - guint8 MAIO; - GPRS_Mobile_Allocation_t GPRS_Mobile_Allocation; -} Direct_encoding_1_t; - -typedef struct -{ - guint8 MAIO; - guint8 HSN; - guint8 Length_of_MA_Frequency_List; - guint8 MA_Frequency_List[15+3]; -} Direct_encoding_2_t; - -typedef struct -{ - guint8 TSC; - guint8 UnionType; - union - { - guint16 ARFCN; - Indirect_encoding_t Indirect_encoding; - Direct_encoding_1_t Direct_encoding_1; - Direct_encoding_2_t Direct_encoding_2; - } u; -} Frequency_Parameters_t; - -typedef struct -{ - guint8 Exist; - guint8 USF_TN; -} Timeslot_Allocation_t; - -typedef struct -{ - guint8 ALPHA; - - struct - { - guint8 Exist; - guint8 USF_TN; - guint8 GAMMA_TN; - } Slot[8]; -} Timeslot_Allocation_Power_Ctrl_Param_t; - -typedef struct -{ - guint8 Extended_Dynamic_Allocation; - - guint8 Exist_P0; - guint8 P0; - guint8 PR_MODE; - - guint8 USF_GRANULARITY; - - guint8 Exist_UPLINK_TFI_ASSIGNMENT; - guint8 UPLINK_TFI_ASSIGNMENT; - - guint8 Exist_RLC_DATA_BLOCKS_GRANTED; - guint8 RLC_DATA_BLOCKS_GRANTED; - - guint8 Exist_TBF_Starting_Time; - Starting_Frame_Number_t TBF_Starting_Time; - - guint8 UnionType; - union - { - Timeslot_Allocation_t Timeslot_Allocation[8]; - Timeslot_Allocation_Power_Ctrl_Param_t Timeslot_Allocation_Power_Ctrl_Param; - } u; -} Dynamic_Allocation_t; - -typedef struct -{ - guint8 Extended_Dynamic_Allocation; - - guint8 Exist_P0; - guint8 P0; - guint8 PR_MODE; - - guint8 USF_GRANULARITY; - - guint8 Exist_UPLINK_TFI_ASSIGNMENT; - guint8 UPLINK_TFI_ASSIGNMENT; - - guint8 Exist_RLC_DATA_BLOCKS_GRANTED; - guint8 RLC_DATA_BLOCKS_GRANTED; - - guint8 UnionType; - union - { - Timeslot_Allocation_t Timeslot_Allocation[8]; - Timeslot_Allocation_Power_Ctrl_Param_t Timeslot_Allocation_Power_Ctrl_Param; - } u; -} DTM_Dynamic_Allocation_t; - -typedef struct -{ - guint8 TIMESLOT_NUMBER; - - guint8 Exist_ALPHA_and_GAMMA_TN; - guint8 ALPHA; - guint8 GAMMA_TN; - - guint8 Exist_P0; - guint8 P0; - guint8 BTS_PWR_CTRL_MODE; - guint8 PR_MODE; - - Starting_Frame_Number_t TBF_Starting_Time; -} Single_Block_Allocation_t; - -typedef struct -{ - guint8 TIMESLOT_NUMBER; - - guint8 Exist_ALPHA_and_GAMMA_TN; - guint8 ALPHA; - guint8 GAMMA_TN; - - guint8 Exist_P0; - guint8 P0; - guint8 BTS_PWR_CTRL_MODE; - guint8 PR_MODE; - -} DTM_Single_Block_Allocation_t; - -typedef struct -{ - guint8 UnionType; - union - { - Global_TFI_t Global_TFI; - guint32 TLLI; - guint16 TQI; - Packet_Request_Reference_t Packet_Request_Reference; - } u; -} PacketUplinkID_t; - -typedef struct -{ - gboolean Exist_Packet_Extended_Timing_Advance; - guint8 Packet_Extended_Timing_Advance; -} PUA_GPRS_AdditionsR99_t; - -typedef struct -{ - guint8 CHANNEL_CODING_COMMAND; - guint8 TLLI_BLOCK_CHANNEL_CODING; - Packet_Timing_Advance_t Packet_Timing_Advance; - - guint8 Exist_Frequency_Parameters; - Frequency_Parameters_t Frequency_Parameters; - - guint8 UnionType; - union - { - guint8 extension; - Dynamic_Allocation_t Dynamic_Allocation; - Single_Block_Allocation_t Single_Block_Allocation; - guint8 FixedAllocationDummy; - } u; - - gboolean Exist_AdditionsR99; - PUA_GPRS_AdditionsR99_t AdditionsR99; -} PUA_GPRS_t; - -typedef struct -{ - guint8 BitmapLength; - guint8 ReducedMA_Bitmap[127 / 8 + 1]; - - gboolean Exist_MAIO_2; - guint8 MAIO_2; -} COMPACT_ReducedMA_t; - -typedef struct -{ - guint8 TIMESLOT_NUMBER; - - gboolean Exist_ALPHA_GAMMA_TN; - guint8 ALPHA; - guint8 GAMMA_TN; - - gboolean Exist_P0_BTS_PWR_CTRL_PR_MODE; - guint8 P0; - guint8 BTS_PWR_CTRL_MODE; - guint8 PR_MODE; - - Starting_Frame_Number_t TBF_Starting_Time; - guint8 NUMBER_OF_RADIO_BLOCKS_ALLOCATED; -} MultiBlock_Allocation_t; - -typedef struct -{ - gboolean Exist_CONTENTION_RESOLUTION_TLLI; - guint32 CONTENTION_RESOLUTION_TLLI; - - gboolean Exist_COMPACT_ReducedMA; - COMPACT_ReducedMA_t COMPACT_ReducedMA; - - guint8 EGPRS_CHANNEL_CODING_COMMAND; - guint8 RESEGMENT; - guint8 EGPRS_WindowSize; - - guint8 NrOfAccessTechnologies; /* will hold the number of list elements */ - guint8 AccessTechnologyType[MAX_ACCESS_TECHOLOGY_TYPES]; /* for max size of array see 24.008/Table 10.5.146 */ - - guint8 ARAC_RETRANSMISSION_REQUEST; - guint8 TLLI_BLOCK_CHANNEL_CODING; - - gboolean Exist_BEP_PERIOD2; - guint8 BEP_PERIOD2; - - Packet_Timing_Advance_t PacketTimingAdvance; - - gboolean Exist_Packet_Extended_Timing_Advance; - guint8 Packet_Extended_Timing_Advance; - - gboolean Exist_Frequency_Parameters; - Frequency_Parameters_t Frequency_Parameters; - - guint8 UnionType; - union - { - guint8 extension; - Dynamic_Allocation_t Dynamic_Allocation; - MultiBlock_Allocation_t MultiBlock_Allocation; - guint8 FixedAllocationDummy;/* Fixed Allocation is not used */ - } u; -} PUA_EGPRS_00_t; - -typedef struct -{ - guint8 UnionType; - union - { - PUA_EGPRS_00_t PUA_EGPRS_00; - guint8 PUA_EGPRS_01; - guint8 PUA_EGPRS_10; - guint8 PUA_EGPRS_11; - } u; -} PUA_EGPRS_t; - -enum PUA_Type -{ - PUA_GPRS, - PUA_EGPRS -}; - -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PAGE_MODE; - - guint8 Exist_PERSISTENCE_LEVEL; - guint8 PERSISTENCE_LEVEL[4]; - - PacketUplinkID_t ID; - - guint8 UnionType; - union - { - PUA_GPRS_t PUA_GPRS_Struct; - PUA_EGPRS_t PUA_EGPRS_Struct; - } u; -} Packet_Uplink_Assignment_t; - - -/* < DTM Packet Uplink Assignment message content > */ -typedef struct -{ - guint8 CHANNEL_CODING_COMMAND; - guint8 TLLI_BLOCK_CHANNEL_CODING; - Packet_Timing_Advance_t Packet_Timing_Advance; - - guint8 UnionType; - union - { - guint8 extension; - DTM_Dynamic_Allocation_t DTM_Dynamic_Allocation; - DTM_Single_Block_Allocation_t DTM_Single_Block_Allocation; - } u; - gboolean Exist_EGPRS_Parameters; - guint8 EGPRS_CHANNEL_CODING_COMMAND; - guint8 RESEGMENT; - guint8 EGPRS_WindowSize; - gboolean Exist_Packet_Extended_Timing_Advance; - guint8 Packet_Extended_Timing_Advance; -} DTM_Packet_Uplink_Assignment_t; - -typedef struct -{ - DTM_Packet_Uplink_Assignment_t DTM_Packet_Uplink_Assignment; -}DTM_UL_t; - -/* < DTM Packet Channel Request message content > */ -typedef struct -{ - guint8 DTM_Pkt_Est_Cause; - Channel_Request_Description_t Channel_Request_Description; - gboolean Exist_PFI; - guint8 PFI; -}DTM_Channel_Request_Description_t; - -/* < Packet Downlink Assignment message content > */ -typedef struct -{ - Starting_Frame_Number_t Measurement_Starting_Time; - guint8 MEASUREMENT_INTERVAL; - guint8 MEASUREMENT_BITMAP; -} Measurement_Mapping_struct_t; - -typedef struct -{ - guint8 UnionType; - union - { - Global_TFI_t Global_TFI; - guint32 TLLI; - } u; -} PacketDownlinkID_t; - -typedef struct -{ - gboolean Exist_EGPRS_Params; /* if Exist_EGPRS_Params == FALSE then none of the following 4 vars exist */ - guint8 EGPRS_WindowSize; - guint8 LINK_QUALITY_MEASUREMENT_MODE; - gboolean Exist_BEP_PERIOD2; - guint8 BEP_PERIOD2; - - gboolean Exist_Packet_Extended_Timing_Advance; - guint8 Packet_Extended_Timing_Advance; - - gboolean Exist_COMPACT_ReducedMA; - COMPACT_ReducedMA_t COMPACT_ReducedMA; -} PDA_AdditionsR99_t; - -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PAGE_MODE; - - gboolean Exist_PERSISTENCE_LEVEL; - guint8 PERSISTENCE_LEVEL[4]; - - PacketDownlinkID_t ID; - - guint8 MAC_MODE; - guint8 RLC_MODE; - guint8 CONTROL_ACK; - guint8 TIMESLOT_ALLOCATION; - Packet_Timing_Advance_t Packet_Timing_Advance; - - gboolean Exist_P0_and_BTS_PWR_CTRL_MODE; - guint8 P0; - guint8 BTS_PWR_CTRL_MODE; - guint8 PR_MODE; - - gboolean Exist_Frequency_Parameters; - Frequency_Parameters_t Frequency_Parameters; - - gboolean Exist_DOWNLINK_TFI_ASSIGNMENT; - guint8 DOWNLINK_TFI_ASSIGNMENT; - - gboolean Exist_Power_Control_Parameters; - Power_Control_Parameters_t Power_Control_Parameters; - - gboolean Exist_TBF_Starting_Time; - Starting_Frame_Number_t TBF_Starting_Time; - - guint8 Exist_Measurement_Mapping; - Measurement_Mapping_struct_t Measurement_Mapping; - - gboolean Exist_AdditionsR99; - PDA_AdditionsR99_t AdditionsR99; -} Packet_Downlink_Assignment_t; - -/* < DTM Packet Downlink Assignment message content > */ -typedef struct -{ - guint8 MAC_MODE; - guint8 RLC_MODE; - guint8 TIMESLOT_ALLOCATION; - Packet_Timing_Advance_t Packet_Timing_Advance; - - guint8 Exist_P0_and_BTS_PWR_CTRL_MODE; - guint8 P0; - guint8 BTS_PWR_CTRL_MODE; - guint8 PR_MODE; - - guint8 Exist_Power_Control_Parameters; - Power_Control_Parameters_t Power_Control_Parameters; - - guint8 Exist_DOWNLINK_TFI_ASSIGNMENT; - guint8 DOWNLINK_TFI_ASSIGNMENT; - - guint8 Exist_Measurement_Mapping; - Measurement_Mapping_struct_t Measurement_Mapping; - gboolean EGPRS_Mode; - guint8 EGPRS_WindowSize; - guint8 LINK_QUALITY_MEASUREMENT_MODE; - gboolean Exist_Packet_Extended_Timing_Advance; - guint8 Packet_Extended_Timing_Advance; -} DTM_Packet_Downlink_Assignment_t; - -typedef struct -{ - DTM_Packet_Downlink_Assignment_t DTM_Packet_Downlink_Assignment; -}DTM_DL_t; - -typedef struct -{ - GPRS_Cell_Options_t GPRS_Cell_Options; - GPRS_Power_Control_Parameters_t GPRS_Power_Control_Parameters; -}DTM_GPRS_Broadcast_Information_t; - -typedef struct -{ - DTM_GPRS_Broadcast_Information_t DTM_GPRS_Broadcast_Information; -}DTM_GPRS_B_t; - -/* < Packet Paging Request message content > */ -typedef struct -{ - guint8 UnionType; - union - { - TMSI_t PTMSI; - struct MobileId Mobile_Identity; - } u; -} Page_request_for_TBF_establishment_t; - -typedef struct -{ - guint8 UnionType; - union - { - TMSI_t TMSI; - struct MobileId Mobile_Identity; - } u; - - guint8 CHANNEL_NEEDED; - - guint8 Exist_eMLPP_PRIORITY; - guint8 eMLPP_PRIORITY; -} Page_request_for_RR_conn_t; - -typedef struct -{ - guint8 UnionType; - union - { - Page_request_for_TBF_establishment_t Page_req_TBF; - Page_request_for_RR_conn_t Page_req_RR; - } u; -} Repeated_Page_info_t; - -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PAGE_MODE; - - guint8 Exist_PERSISTENCE_LEVEL; - guint8 PERSISTENCE_LEVEL[4]; - - guint8 Exist_NLN; - guint8 NLN; - - guint8 Count_Repeated_Page_info; - Repeated_Page_info_t Repeated_Page_info[5]; -} Packet_Paging_Request_t; - -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PAGE_MODE; - - guint8 TIMESLOTS_AVAILABLE; -} Packet_PDCH_Release_t; - -/* < Packet Power Control/Timing Advance message content > */ -typedef struct -{ - guint8 UnionType; - union - { - Global_TFI_t Global_TFI; - guint16 TQI; - Packet_Request_Reference_t Packet_Request_Reference; - } u; -} PacketPowerControlTimingAdvanceID_t; - -typedef struct -{ - Global_Packet_Timing_Advance_t Global_Packet_Timing_Advance; - Power_Control_Parameters_t Power_Control_Parameters; -} GlobalTimingAndPower_t; - -typedef struct -{ - guint8 UnionType; - union - { - Global_Packet_Timing_Advance_t Global_Packet_Timing_Advance; - Power_Control_Parameters_t Power_Control_Parameters; - } u; -} GlobalTimingOrPower_t; - -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PAGE_MODE; - - PacketPowerControlTimingAdvanceID_t ID; - - /* -- Message escape */ - guint8 Exist_Global_Power_Control_Parameters; - Global_Power_Control_Parameters_t Global_Power_Control_Parameters; - - guint8 UnionType; - union - { - GlobalTimingAndPower_t GlobalTimingAndPower; - GlobalTimingOrPower_t GlobalTimingOrPower; - } u; -} Packet_Power_Control_Timing_Advance_t; - -/* < Packet Queueing Notification message content > */ -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PAGE_MODE; - - /* 111 Fixed */ - Packet_Request_Reference_t Packet_Request_Reference; - guint16 TQI; -} Packet_Queueing_Notification_t; - -/* < Packet Timeslot Reconfigure message content 04.60 sec. 11.2.31> */ - -typedef Dynamic_Allocation_t TRDynamic_Allocation_t; - -typedef struct -{ - Global_Packet_Timing_Advance_t Global_Packet_Timing_Advance; - - guint8 DOWNLINK_RLC_MODE; - guint8 CONTROL_ACK; - - guint8 Exist_DOWNLINK_TFI_ASSIGNMENT; - guint8 DOWNLINK_TFI_ASSIGNMENT; - - guint8 Exist_UPLINK_TFI_ASSIGNMENT; - guint8 UPLINK_TFI_ASSIGNMENT; - - guint8 DOWNLINK_TIMESLOT_ALLOCATION; - - guint8 Exist_Frequency_Parameters; - Frequency_Parameters_t Frequency_Parameters; -} Common_Timeslot_Reconfigure_t; - -typedef struct -{ - gboolean Exist_Packet_Extended_Timing_Advance; - guint8 Packet_Extended_Timing_Advance; -} PTR_GPRS_AdditionsR99_t; - -typedef struct -{ - guint8 CHANNEL_CODING_COMMAND; - - Common_Timeslot_Reconfigure_t Common_Timeslot_Reconfigure_Data; - - guint8 UnionType; - union - { - TRDynamic_Allocation_t Dynamic_Allocation; - guint8 Fixed_AllocationDummy; - } u; - - gboolean Exist_AdditionsR99; - PTR_GPRS_AdditionsR99_t AdditionsR99; -} PTR_GPRS_t; - -typedef struct -{ - gboolean Exist_COMPACT_ReducedMA; - COMPACT_ReducedMA_t COMPACT_ReducedMA; - - guint8 EGPRS_ChannelCodingCommand; - guint8 RESEGMENT; - - gboolean Exist_DOWNLINK_EGPRS_WindowSize; - guint8 DOWNLINK_EGPRS_WindowSize; - - gboolean Exist_UPLINK_EGPRS_WindowSize; - guint8 UPLINK_EGPRS_WindowSize; - - guint8 LINK_QUALITY_MEASUREMENT_MODE; - - gboolean Exist_Packet_Extended_Timing_Advance; - guint8 Packet_Extended_Timing_Advance; - - Common_Timeslot_Reconfigure_t Common_Timeslot_Reconfigure_Data; - - guint8 UnionType; - union - { - TRDynamic_Allocation_t Dynamic_Allocation; - guint8 FixedAllocationDummy; - } u; -} PTR_EGPRS_00_t; - -typedef struct -{ - guint8 UnionType; - union - { - PTR_EGPRS_00_t PTR_EGPRS_00; - guint8 extension_01; - guint8 extension_10; - guint8 extension_11; - } u; -} PTR_EGPRS_t; - -enum PTR_Type -{ - PTR_GPRS, - PTR_EGPRS -}; - -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PAGE_MODE; - - Global_TFI_t Global_TFI; - - guint8 UnionType; - union - { - PTR_GPRS_t PTR_GPRS_Struct; - PTR_EGPRS_t PTR_EGPRS_Struct; - } u; -} Packet_Timeslot_Reconfigure_t; - - -/* < PSI1 message content > */ -typedef struct -{ - guint8 ACC_CONTR_CLASS[2]; - guint8 MAX_RETRANS[4]; - guint8 S; - guint8 TX_INT; - - guint8 Exist_PERSISTENCE_LEVEL; - guint8 PERSISTENCE_LEVEL[4]; -} PRACH_Control_t; - -typedef struct -{ - guint8 BS_PCC_REL; - guint8 BS_PBCCH_BLKS; - guint8 BS_PAG_BLKS_RES; - guint8 BS_PRACH_BLKS; -} PCCCH_Organization_t; - -typedef struct -{ - guint8 MSCR; - guint8 SGSNR; - guint8 BandIndicator; -} PSI1_AdditionsR99_t; - -typedef struct -{ - guint8 MESSAGE_TYPE; - - guint8 PAGE_MODE; - guint8 PBCCH_CHANGE_MARK; - guint8 PSI_CHANGE_FIELD; - guint8 PSI1_REPEAT_PERIOD; - guint8 PSI_COUNT_LR; - - guint8 Exist_PSI_COUNT_HR; - guint8 PSI_COUNT_HR; - - guint8 MEASUREMENT_ORDER; - GPRS_Cell_Options_t GPRS_Cell_Options; - PRACH_Control_t PRACH_Control; - PCCCH_Organization_t PCCCH_Organization; - Global_Power_Control_Parameters_t Global_Power_Control_Parameters; - guint8 PSI_STATUS_IND; - - gboolean Exist_AdditionsR99; - PSI1_AdditionsR99_t AdditionsR99; -} PSI1_t; - -/* < PSI2 message content > */ -typedef struct -{ - guint8 NUMBER; - - guint8 Length; - guint8 Contents[15 + 3];/* octet (val(Length of RFL contents) + 3) */ -} Reference_Frequency_t; - -typedef struct -{ - guint8 NoOfRFLs; - guint8 RFL_Number[MAX_RFLS]; -} Cell_Allocation_t; - -typedef struct -{ - guint8 NUMBER; - GPRS_Mobile_Allocation_t Mobile_Allocation; -} PSI2_MA_t; - -typedef struct -{ - guint16 ARFCN; - guint8 TIMESLOT_ALLOCATION; -} Non_Hopping_PCCCH_Carriers_t; - -typedef struct -{ - guint8 Count_Carriers; - Non_Hopping_PCCCH_Carriers_t Carriers[7]; -} NonHoppingPCCCH_t; - -typedef struct -{ - guint8 MAIO; - guint8 TIMESLOT_ALLOCATION; -} Hopping_PCCCH_Carriers_t; - -typedef struct -{ - guint8 MA_NUMBER; - - guint8 Count_Carriers; - Hopping_PCCCH_Carriers_t Carriers[10];/* MAX_PCCCH but 10 is theoretical max. */ -} HoppingPCCCH_t; - -typedef struct -{ - guint8 TSC; - - guint8 UnionType; - union - { - NonHoppingPCCCH_t NonHopping; - HoppingPCCCH_t Hopping; - } u; -} PCCCH_Description_t; - -typedef struct -{ - LAI_t LAI; - guint8 RAC; - CellId_t Cell_Identity; -} Cell_Identification_t; - -typedef struct -{ - guint8 ATT; - - guint8 Exist_T3212; - guint8 T3212; - - guint8 NECI; - guint8 PWRC; - guint8 DTX; - guint8 RADIO_LINK_TIMEOUT; - guint8 BS_AG_BLKS_RES; - guint8 CCCH_CONF; - guint8 BS_PA_MFRMS; - guint8 MAX_RETRANS; - guint8 TX_INTEGER; - guint8 EC; - guint8 MS_TXPWR_MAX_CCCH; - - guint8 Exist_Extension_Bits; - Extension_Bits_t Extension_Bits; -} Non_GPRS_Cell_Options_t; - -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PAGE_MODE; - guint8 CHANGE_MARK; - guint8 INDEX; - guint8 COUNT; - - guint8 Exist_Cell_Identification; - Cell_Identification_t Cell_Identification; - - guint8 Exist_Non_GPRS_Cell_Options; - Non_GPRS_Cell_Options_t Non_GPRS_Cell_Options; - - guint8 Count_Reference_Frequency; - Reference_Frequency_t Reference_Frequency[MAX_RFLS]; - - Cell_Allocation_t Cell_Allocation; - - guint8 Count_GPRS_MA; - PSI2_MA_t GPRS_MA[MAX_MA_LISTS_IN_PSI2]; - - guint8 Count_PCCCH_Description; - PCCCH_Description_t PCCCH_Description[7];/* MAX_PCCCH but it is impossible that more than 7 can be decoded */ -} PSI2_t; - -/* < PSI3 message content > */ -typedef struct -{ - guint8 PRIORITY_CLASS; - guint8 HCS_THR; -} HCS_t; - -typedef struct -{ - guint8 CELL_BAR_ACCESS_2; - guint8 EXC_ACC; - guint8 GPRS_RXLEV_ACCESS_MIN; - guint8 GPRS_MS_TXPWR_MAX_CCH; - - guint8 Exist_HCS; - HCS_t HCS; - guint8 MULTIBAND_REPORTING; -} Serving_Cell_params_t; - -typedef struct -{ - guint8 GPRS_CELL_RESELECT_HYSTERESIS; - guint8 C31_HYST; - guint8 C32_QUAL; - guint8 RANDOM_ACCESS_RETRY; - - guint8 Exist_T_RESEL; - guint8 T_RESEL; - - guint8 Exist_RA_RESELECT_HYSTERESIS; - guint8 RA_RESELECT_HYSTERESIS; -} Gen_Cell_Sel_t; - -typedef struct -{ - guint8 PBCCH_LOCATION; - guint8 PSI1_REPEAT_PERIOD; -} Location_Repeat_t; - -typedef struct -{ - guint8 UnionType; - union - { - guint8 SI13_LOCATION; - Location_Repeat_t lr; - } u; -} SI13_PBCCH_Location_t; - -typedef struct -{ - guint8 BSIC; - guint8 CELL_BAR_ACCESS_2; - guint8 EXC_ACC; - guint8 SAME_RA_AS_SERVING_CELL; - - guint8 Exist_RXLEV_and_TXPWR; - guint8 GPRS_RXLEV_ACCESS_MIN; - guint8 GPRS_MS_TXPWR_MAX_CCH; - - guint8 Exist_OFFSET_and_TIME; - guint8 GPRS_TEMPORARY_OFFSET; - guint8 GPRS_PENALTY_TIME; - - guint8 Exist_GPRS_RESELECT_OFFSET; - guint8 GPRS_RESELECT_OFFSET; - - guint8 Exist_HCS; - HCS_t HCS; - - guint8 Exist_SI13_PBCCH_Location; - SI13_PBCCH_Location_t SI13_PBCCH_Location; -} Cell_Selection_t; - -/* Neigbour cell list as used in PSI3 and PSI3bis */ -typedef struct -{ - guint8 FREQ_DIFF_LENGTH; - guint8 FREQUENCY_DIFF; - - Cell_Selection_t Cell_SelectionParams; -} Cell_Selection_Params_With_FreqDiff_t; - -typedef struct -{ - guint16 START_FREQUENCY; - Cell_Selection_t Cell_Selection; - guint8 NR_OF_REMAINING_CELLS; - guint8 FREQ_DIFF_LENGTH; - - Cell_Selection_Params_With_FreqDiff_t Cell_Selection_Params_With_FreqDiff[16]; -} NeighbourCellParameters_t; - -typedef struct -{ - guint8 Count; - NeighbourCellParameters_t Parameters[32]; -} NeighbourCellList_t; - -/* < PSI3 message content > */ - -typedef struct -{ - guint8 bsic; - guint8 CELL_BAR_ACCESS_2; - guint8 EXC_ACC; - guint8 SAME_RA_AS_SERVING_CELL; - guint8 Exist_GPRS_RXLEV_ACCESS_MIN; - guint8 GPRS_RXLEV_ACCESS_MIN; - guint8 GPRS_MS_TXPWR_MAX_CCH; - guint8 Exist_GPRS_TEMPORARY_OFFSET; - guint8 GPRS_TEMPORARY_OFFSET; - guint8 GPRS_PENALTY_TIME; - guint8 Exist_GPRS_RESELECT_OFFSET; - guint8 GPRS_RESELECT_OFFSET; - guint8 Exist_Hcs_Parm; - HCS_t HCS_Param; - guint8 Exist_TIME_GROUP; - guint8 TIME_GROUP; - guint8 Exist_GUAR_CONSTANT_PWR_BLKS; - guint8 GUAR_CONSTANT_PWR_BLKS; -}COMPACT_Cell_Sel_t; - -typedef struct -{ - guint8 FREQ_DIFF_LENGTH; - guint16 FREQUENCY_DIFF; - COMPACT_Cell_Sel_t COMPACT_Cell_Sel_Remain_Cells; -}COMPACT_Neighbour_Cell_Param_Remaining_t; - -typedef struct -{ - guint16 START_FREQUENCY; - COMPACT_Cell_Sel_t COMPACT_Cell_Sel; - guint8 NR_OF_REMAINING_CELLS; - guint8 FREQ_DIFF_LENGTH; - COMPACT_Neighbour_Cell_Param_Remaining_t COMPACT_Neighbour_Cell_Param_Remaining[16]; -}COMPACT_Neighbour_Cell_Param_t; - -typedef struct -{ - Cell_Identification_t Cell_Identification; - guint8 COMPACT_Neighbour_Cell_Param_Count; - COMPACT_Neighbour_Cell_Param_t COMPACT_Neighbour_Cell_Param[8]; -}COMPACT_Info_t; - -typedef struct -{ - guint8 Exist_CCN_Support_Desc; - CCN_Support_Description_t CCN_Support_Desc; -}PSI3_AdditionR4_t; - -typedef struct -{ - guint8 Exist_COMPACT_Info; - COMPACT_Info_t COMPACT_Info; - guint8 Exist_AdditionR4; - PSI3_AdditionR4_t AdditionR4; -}PSI3_AdditionR99_t; - -typedef struct -{ - LSA_ID_Info_t Scell_LSA_ID_Info; - guint8 Exist_LSA_Parameters; - LSA_Parameters_t LSA_Parameters; - guint8 Exist_AdditionR99; - PSI3_AdditionR99_t AdditionR99; -}PSI3_AdditionR98_t; - -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PAGE_MODE; - guint8 CHANGE_MARK; - guint8 BIS_COUNT; - - Serving_Cell_params_t Serving_Cell_params; - - Gen_Cell_Sel_t General_Cell_Selection; - NeighbourCellList_t NeighbourCellList; - - guint8 Exist_AdditionR98; - PSI3_AdditionR98_t AdditionR98; -} PSI3_t; - -/* < PSI3_BIS message content > */ -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PAGE_MODE; - guint8 CHANGE_MARK; - guint8 BIS_INDEX; - guint8 BIS_COUNT; - - NeighbourCellList_t NeighbourCellList; -} PSI3_BIS_t; - -/* < PSI4 message content > */ -typedef struct -{ - guint8 MA_NUMBER; - guint8 MAIO; -} h_CG_t; - -typedef struct -{ - guint8 UnionType; - union - { - guint16 ARFCN; - h_CG_t h_CG; - } u; - - guint8 TIMESLOT_ALLOCATION; -} Channel_Group_t; - -typedef struct -{ - /* Channel_Group_t Channel_Group - * At least one - * the first one is unpacked in the index - */ - guint8 Count_Channel_Group; - Channel_Group_t Channel_Group[8]; -} Channel_List_t; - -typedef struct -{ - guint8 MESSAGE_TYPE; - - guint8 PAGE_MODE; - guint8 CHANGE_MARK; - guint8 INDEX; - guint8 COUNT; - - Channel_List_t Channel_List; - -} PSI4_t; - - -/* < PSI5 message content > */ -typedef struct -{ - guint8 existRepParamsFDD; - guint8 RepQuantFDD; - guint8 MultiratReportingFDD; - - guint8 existReportingParamsFDD; - guint8 ReportingOffsetFDD; - guint8 ReportingThresholdFDD; - - guint8 existMultiratReportingTDD; - guint8 MultiratReportingTDD; - - guint8 existOffsetThresholdTDD; - guint8 ReportingOffsetTDD; - guint8 ReportingThresholdTDD; -} GPRSMeasurementParams3G_PSI5_t; - -typedef struct -{ - guint8 REPORT_TYPE; - guint8 REPORTING_RATE; - guint8 INVALID_BSIC_REPORTING; - guint8 Exist_NCC_PERMITTED; - guint8 NCC_PERMITTED; - - gboolean Exist_GPRSMeasurementParams; - MeasurementParams_t GPRSMeasurementParams; - gboolean Exist_GPRSMeasurementParams3G; - GPRSMeasurementParams3G_PSI5_t GPRSMeasurementParams3G; -} ENH_Reporting_Parameters_t; - -typedef struct -{ - guint8 Exist_OffsetThreshold_700; - OffsetThreshold_t OffsetThreshold_700; - guint8 Exist_OffsetThreshold_810; - OffsetThreshold_t OffsetThreshold_810; -}PSI5_AdditionsR7; - -typedef struct -{ - guint8 Exist_GPRS_AdditionalMeasurementParams3G; - GPRS_AdditionalMeasurementParams3G_t GPRS_AdditionalMeasurementParams3G; - guint8 Exist_AdditionsR7; - PSI5_AdditionsR7 AdditionsR7; -}PSI5_AdditionsR5; - -typedef struct -{ - guint8 Exist_ENH_Reporting_Param; - ENH_Reporting_Parameters_t ENH_Reporting_Param; - guint8 Exist_AdditionsR5; - PSI5_AdditionsR5 AdditionisR5; -}PSI5_AdditionsR99; - -typedef struct -{ - guint8 MESSAGE_TYPE; - - guint8 PAGE_MODE; - guint8 CHANGE_MARK; - guint8 INDEX; - guint8 COUNT; - - guint8 Eixst_NC_Meas_Param; - NC_Measurement_Parameters_t NC_Meas_Param; - guint8 Exist_AdditionsR99; - PSI5_AdditionsR99 AdditionsR99; -} PSI5_t; - - - - -/* < PSI13 message content > - * Combined with SI13 - */ -typedef struct -{ - guint8 Exist_LB_MS_TXPWR_MAX_CCH; - guint8 LB_MS_TXPWR_MAX_CCH; - guint8 SI2n_SUPPORT; -}PSI13_AdditionsR6; - -typedef PSI13_AdditionsR6 SI13_AdditionsR6; - -typedef struct -{ - guint8 SI_STATUS_IND; - guint8 Exist_AdditionsR6; - PSI13_AdditionsR6 AdditionsR6; -}PSI13_AdditionsR4; - -typedef PSI13_AdditionsR4 SI13_AdditionsR4; - -typedef struct -{ - guint8 SGSNR; - gboolean Exist_AdditionsR4; - PSI13_AdditionsR4 AdditionsR4; -}PSI13_AdditionR99; - -typedef PSI13_AdditionR99 SI13_AdditionR99; - -typedef struct -{ - guint8 Exist; - guint8 MESSAGE_TYPE; - - guint8 PAGE_MODE; - guint8 BCCH_CHANGE_MARK; - guint8 SI_CHANGE_FIELD; - - guint8 Exist_MA; - guint8 SI13_CHANGE_MARK; - GPRS_Mobile_Allocation_t GPRS_Mobile_Allocation; - - guint8 UnionType; - union - { - PBCCH_Not_present_t PBCCH_Not_present; - PBCCH_present_t PBCCH_present; - } u; - - gboolean Exist_AdditionsR99; - PSI13_AdditionR99 AdditionsR99; -} PSI13_t; - -/* SI_13_t is combined in the PSI13 structure */ -typedef PSI13_t SI_13_t; - -/* < Packet PRACH Parameters message content > */ -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PAGE_MODE; - - - PRACH_Control_t PRACH_Control; -} Packet_PRACH_Parameters_t; - -/* < Packet Access Reject message content > */ -typedef struct -{ - guint8 UnionType; - union - { - guint32 TLLI; - Packet_Request_Reference_t Packet_Request_Reference; - Global_TFI_t Global_TFI; - } u; -} RejectID_t; - -typedef struct -{ - RejectID_t ID; - - guint8 Exist_Wait; - guint8 WAIT_INDICATION; - guint8 WAIT_INDICATION_SIZE; -} Reject_t; - -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PAGE_MODE; - - guint8 IndexToOur; - guint8 Count_Reject; - Reject_t Reject[5]; -} Packet_Access_Reject_t; - -/* < Packet Cell Change Order message content > */ -typedef struct -{ - guint8 CELL_BAR_ACCESS_2; - guint8 EXC_ACC; - guint8 SAME_RA_AS_SERVING_CELL; - - guint8 Exist_RXLEV_and_TXPWR; - guint8 GPRS_RXLEV_ACCESS_MIN; - guint8 GPRS_MS_TXPWR_MAX_CCH; - - guint8 Exist_OFFSET_and_TIME; - guint8 GPRS_TEMPORARY_OFFSET; - guint8 GPRS_PENALTY_TIME; - - guint8 Exist_GPRS_RESELECT_OFFSET; - guint8 GPRS_RESELECT_OFFSET; - - guint8 Exist_HCS; - HCS_t HCS; - - guint8 Exist_SI13_PBCCH_Location; - SI13_PBCCH_Location_t SI13_PBCCH_Location; -} Cell_Selection_2_t; - -typedef struct -{ - guint8 FREQUENCY_DIFF; - guint8 BSIC; - Cell_Selection_t Cell_Selection; -} h_FreqBsicCell_t; - -typedef struct -{ - guint8 FREQ_DIFF_LENGTH; - guint8 FREQUENCY_DIFF; - guint8 BSIC; - - gboolean Exist_CellSelectionParams; - Cell_Selection_2_t CellSelectionParams; -} CellSelectionParamsWithFreqDiff_t; - -typedef struct -{ - guint16 START_FREQUENCY; - guint8 BSIC; - - guint8 Exist_Cell_Selection; - Cell_Selection_2_t Cell_Selection; - - guint8 NR_OF_FREQUENCIES; - guint8 FREQ_DIFF_LENGTH; - - - CellSelectionParamsWithFreqDiff_t CellSelectionParamsWithFreqDiff[32]; -} Add_Frequency_list_t; - -typedef struct -{ - guint8 REMOVED_FREQ_INDEX; -} Removed_Freq_Index_t; - -typedef struct -{ - guint8 Exist_REMOVED_FREQ; - guint8 NR_OF_REMOVED_FREQ; - Removed_Freq_Index_t Removed_Freq_Index[32]; - - guint8 Count_Add_Frequency; - Add_Frequency_list_t Add_Frequency[32]; -} NC_Frequency_list_t; - - -typedef struct -{ - guint8 NETWORK_CONTROL_ORDER; - - guint8 Exist_NC; - guint8 NC_NON_DRX_PERIOD; - guint8 NC_REPORTING_PERIOD_I; - guint8 NC_REPORTING_PERIOD_T; - - guint8 Exist_NC_FREQUENCY_LIST; - NC_Frequency_list_t NC_Frequency_list; -} NC_Measurement_Parameters_with_Frequency_List_t; - - -typedef struct -{ - guint8 BA_IND; - guint8 BA_IND_3G; -} BA_IND_t; - -typedef struct -{ - guint8 BA_USED; - guint8 BA_USED_3G; -} BA_USED_t; - -typedef struct -{ - guint8 RXLEV_SERVING_CELL; -} Serving_Cell_Data_t; - -typedef struct -{ - guint8 FREQUENCY_N; - guint8 Exist_BSIC_N; - guint8 BSIC_N; - guint8 RXLEV_N; -} NC_Measurements_t; - -typedef struct -{ - guint8 BCCH_FREQ_N; - guint8 BSIC_N; - guint8 RXLEV_N; -} RepeatedInvalid_BSIC_Info_t; - -typedef struct -{ - guint8 Exist_REPORTING_QUANTITY; - guint8 REPORTING_QUANTITY; -} REPORTING_QUANTITY_Instance_t; - -typedef struct -{ - guint8 NC_MODE; - Serving_Cell_Data_t Serving_Cell_Data; - - guint8 NUMBER_OF_NC_MEASUREMENTS; - NC_Measurements_t NC_Measurements[6]; /* NC_Measurements * (val(NUMBER_OF_NC_MEASUREMENTS)) - Max 7 NC Measurements in one PACKET MEASUREMENT REPORT, - but only 6 cells are updated in PACKET IDLE. */ -} NC_Measurement_Report_t; - -typedef struct -{ - guint8 EXT_REPORTING_TYPE; - - guint8 Exist_I_LEVEL; - struct - { - guint8 Exist; - guint8 I_LEVEL; - } Slot[8]; - - guint8 NUMBER_OF_EXT_MEASUREMENTS; - NC_Measurements_t EXT_Measurements[9]; /* EXT_Measurements * (val(NUMBER_OF_NC_MEASUREMENTS)) - Max 9 Ext Measurements in one PACKET MEASUREMENT REPORT */ -} EXT_Measurement_Report_t; - -typedef struct -{ - guint8 CELL_LIST_INDEX_3G; - guint8 REPORTING_QUANTITY; -} Measurements_3G_t; - -typedef struct -{ - guint32 UTRAN_CGI; - guint8 Exist_PLMN_ID; - PLMN_t Plmn_ID; - guint32 CSG_ID; - gboolean Access_Mode; - guint8 REPORTING_QUANTITY; -}UTRAN_CSG_Measurement_Report_t; - -typedef struct -{ - guint32 EUTRAN_CGI; - guint16 Tracking_Area_Code; - guint8 Exist_PLMN_ID; - PLMN_t Plmn_ID; - guint32 CSG_ID; - gboolean Access_Mode; - guint8 REPORTING_QUANTITY; -}EUTRAN_CSG_Measurement_Report_t; - -typedef struct -{ - gboolean Exist_UTRAN_CSG_Meas_Rpt; - UTRAN_CSG_Measurement_Report_t UTRAN_CSG_Meas_Rpt; - gboolean Exist_EUTRAN_CSG_Meas_Rpt; - EUTRAN_CSG_Measurement_Report_t EUTRAN_CSG_Meas_Rpt; -}PMR_AdditionsR9_t; - -typedef struct -{ - guint8 EUTRAN_FREQUENCY_INDEX; - guint16 CELL_IDENTITY; - guint8 REPORTING_QUANTITY; -}EUTRAN_Measurement_Report_Body_t; - -typedef struct -{ - guint8 N_EUTRAN; - EUTRAN_Measurement_Report_Body_t Report[4]; -}EUTRAN_Measurement_Report_t; - -typedef struct -{ - gboolean Exist_EUTRAN_Meas_Rpt; - EUTRAN_Measurement_Report_t EUTRAN_Meas_Rpt; - gboolean Exist_AdditionsR9; - PMR_AdditionsR9_t AdditionsR9; -}PMR_AdditionsR8_t; - -typedef struct -{ - gboolean Exist_GRNTI; - guint8 GRNTI; - gboolean Exist_AdditionsR8; - PMR_AdditionsR8_t AdditionsR8; -}PMR_AdditionsR5_t; - -typedef struct -{ - gboolean Exist_Info3G; - guint8 UnionType; - union - { - BA_USED_t BA_USED; - guint8 PSI3_CHANGE_MARK; - } u; - guint8 PMO_USED; - - /* N_3G bit(3): max value 7 - * Report part (csn): {<3G_CELL_LIST_INDEX:bit(7)>}*(val(N_3G + 1)) - * Max 6 3G measurement structs in one PMR - */ - gboolean Exist_MeasurementReport3G; - guint8 N_3G; - Measurements_3G_t Measurements_3G[6]; - - gboolean Exist_AdditionsR5; - PMR_AdditionsR5_t AdditionsR5; -} PMR_AdditionsR99_t; - -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PayloadType; - guint8 spare; - guint8 R; - - guint32 TLLI; - guint8 Exist_PSI5_CHANGE_MARK; - guint8 PSI5_CHANGE_MARK; - - guint8 UnionType; - union - { - NC_Measurement_Report_t NC_Measurement_Report; - EXT_Measurement_Report_t EXT_Measurement_Report; - } u; - - gboolean Exist_AdditionsR99; - PMR_AdditionsR99_t AdditionsR99; -} Packet_Measurement_Report_t; - -#define INV_BSIC_LIST_LEN (16) - -#define REPORT_QUANTITY_LIST_LEN (96) /* Specification specified up to 96 */ - -typedef struct -{ - guint8 NC_MODE; - guint8 UnionType; - union - { - BA_USED_t BA_USED; - guint8 PSI3_CHANGE_MARK; - } u; - - guint8 PMO_USED; - guint8 BSIC_Seen; - guint8 SCALE; - - guint8 Exist_Serving_Cell_Data; - Serving_Cell_Data_t Serving_Cell_Data; - - guint8 Count_RepeatedInvalid_BSIC_Info; - RepeatedInvalid_BSIC_Info_t RepeatedInvalid_BSIC_Info[INV_BSIC_LIST_LEN]; - - guint8 Exist_ReportBitmap; - guint8 Count_REPORTING_QUANTITY_Instances; - REPORTING_QUANTITY_Instance_t REPORTING_QUANTITY_Instances[REPORT_QUANTITY_LIST_LEN]; - -} ENH_NC_Measurement_Report_t; - -typedef struct -{ - guint8 Exist_UTRAN_CSG_Target_Cell; - UTRAN_CSG_Target_Cell_t UTRAN_CSG_Target_Cell; - guint8 Exist_EUTRAN_CSG_Target_Cell; - EUTRAN_CSG_Target_Cell_t EUTRAN_CSG_Target_Cell; -}PEMR_AdditionsR9_t; - -typedef struct -{ - gboolean Exist_REPORTING_QUANTITY; - guint8 REPORTING_QUANTITY; -}Bitmap_Report_Quantity_t; - -typedef struct -{ - guint8 BITMAP_LENGTH; - Bitmap_Report_Quantity_t Bitmap_Report_Quantity[128]; - gboolean Exist_EUTRAN_Meas_Rpt; - EUTRAN_Measurement_Report_t EUTRAN_Meas_Rpt; - gboolean Exist_AdditionsR9; - PEMR_AdditionsR9_t AdditionsR9; -}PEMR_AdditionsR8_t; - -typedef struct -{ - gboolean Exist_GRNTI_Ext; - guint8 GRNTI_Ext; - gboolean Exist_AdditionsR8; - PEMR_AdditionsR8_t AdditionsR8; -}PEMR_AdditionsR5_t; - -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PayloadType; - guint8 spare; - guint8 R; - - guint32 TLLI; - - ENH_NC_Measurement_Report_t Measurements; - - gboolean Exist_AdditionsR5; - PEMR_AdditionsR5_t AdditionsR5; -} Packet_Enh_Measurement_Report_t; - -typedef struct -{ - guint8 RXLEV_SERVING_CELL; - - guint8 NUMBER_OF_NC_MEASUREMENTS; - NC_Measurements_t NC_Measurements[6]; /* NC_Measurements * (val(NUMBER_OF_NC_MEASUREMENTS)) - Max 7 NC Measurements in one PACKET MEASUREMENT REPORT, - but only 6 cells are updated in PACKET IDLE. */ -} CCN_Measurement_Report_t; - -typedef struct -{ - guint16 ARFCN; - guint8 BSIC; -} Target_Cell_GSM_Notif_t; - -typedef struct -{ - guint16 FDD_ARFCN; - guint8 Exist_Bandwith_FDD; - guint8 BANDWITH_FDD; - guint16 SCRAMBLING_CODE; -} FDD_Target_Cell_Notif_t; - -typedef struct -{ - guint16 TDD_ARFCN; - guint8 Exist_Bandwith_TDD; - guint8 BANDWITH_TDD; - guint8 CELL_PARAMETER; - guint8 Sync_Case_TSTD; -}TDD_Target_Cell_Notif_t; - -typedef struct -{ - guint8 Exist_FDD_Description; - FDD_Target_Cell_Notif_t FDD_Target_Cell_Notif; - guint8 Exist_TDD_Description; - TDD_Target_Cell_Notif_t TDD_Target_Cell; - guint8 REPORTING_QUANTITY; -} Target_Cell_3G_Notif_t; - -typedef struct -{ - guint16 EARFCN; - guint8 Exist_Measurement_Bandwidth; - guint8 Measurement_Bandwidth; - guint16 Physical_Layer_Cell_Identity; - guint8 Reporting_Quantity; -}Target_EUTRAN_Cell_Notif_t; - -typedef struct -{ - guint8 EUTRAN_FREQUENCY_INDEX; - guint16 CELL_IDENTITY; - guint8 REPORTING_QUANTITY; -}Eutran_Ccn_Measurement_Report_Cell_t; - -typedef struct -{ - gboolean ThreeG_BA_USED; - guint8 N_EUTRAN; - Eutran_Ccn_Measurement_Report_Cell_t Eutran_Ccn_Measurement_Report_Cell[4]; -}Eutran_Ccn_Measurement_Report_t; - -typedef struct -{ - guint8 Exist_Arfcn; - guint16 Arfcn; - guint8 bsic; - guint8 Exist_3G_Target_Cell; - Target_Cell_3G_Notif_t Target_Cell_3G_Notif; - guint8 Exist_Eutran_Target_Cell; - Target_EUTRAN_Cell_Notif_t Target_EUTRAN_Cell; - guint8 Exist_Eutran_Ccn_Measurement_Report; - Eutran_Ccn_Measurement_Report_t Eutran_Ccn_Measurement_Report; -}Target_Cell_4G_Notif_t; - -typedef struct -{ - guint8 UnionType; - union - { - UTRAN_CSG_Measurement_Report_t UTRAN_CSG_Measurement_Report; - EUTRAN_CSG_Measurement_Report_t EUTRAN_CSG_Measurement_Report; - } u; - guint8 Exist_Eutran_Ccn_Measurement_Report; - Eutran_Ccn_Measurement_Report_t Eutran_Ccn_Measurement_Report; -}Target_Cell_CSG_Notif_t; - -typedef struct -{ - guint8 UnionType; - union - { - Target_Cell_4G_Notif_t Target_Cell_4G_Notif; - Target_Cell_CSG_Notif_t Target_Cell_CSG_Notif; - } u; -}Target_Other_RAT_2_Notif_t; - -typedef struct -{ - guint8 UnionType; - union - { - Target_Cell_3G_Notif_t Target_Cell_3G_Notif; - Target_Other_RAT_2_Notif_t Target_Other_RAT_2_Notif; - } u; - -}Target_Other_RAT_Notif_t; - -typedef struct -{ - guint8 UnionType; - union - { - Target_Cell_GSM_Notif_t Target_Cell_GSM_Notif; - Target_Other_RAT_Notif_t Target_Other_RAT_Notif; - } u; -} Target_Cell_t; - -typedef struct -{ - guint8 Exist_BA_USED_3G; - guint8 BA_USED_3G; - - guint8 N_3G; - Measurements_3G_t Measurements_3G[6]; -} PCCN_AdditionsR6_t; - -/* < Packet Cell Change Notification message contents > */ -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PayloadType; - guint8 spare; - guint8 R; - - Global_TFI_t Global_TFI; - - Target_Cell_t Target_Cell; - - guint8 UnionType; - union - { - guint8 BA_IND; - guint8 PSI3_CHANGE_MARK; - } u; - guint8 PMO_USED; - guint8 PCCN_SENDING; - CCN_Measurement_Report_t CCN_Measurement_Report; - - gboolean Exist_AdditionsR6; - PCCN_AdditionsR6_t AdditionsR6; -} Packet_Cell_Change_Notification_t; - -/* < Packet Cell Change Order message contents > */ - - -typedef struct -{ - guint8 FrequencyScrolling; - guint8 BSIC; -} BSICDesc_t; - - -#define MAX_BSIC_DESCS (19) /* Due to message size (23 bytes) and header etc, - * there cannot be more than 19 DESCS. - */ - -typedef struct -{ - gboolean Exist_IndexStartBA; - guint8 IndexStartBA; - guint8 BSIC; - guint8 NumRemainingBSICs; - BSICDesc_t BSICDesc[MAX_BSIC_DESCS]; -} BSICList_t; - -typedef BSICList_t GPRSBSICList_t; - -#define MAX_RTD_VALUES (6) - -typedef struct -{ - guint8 NumRTDValues; - guint16 RTD[MAX_RTD_VALUES]; -} RTDValues_t; - -typedef struct -{ - gboolean Exist_StartValue; - guint8 StartValue; -} BAIndexStartRTD_t; - -#define MAX_RTD_FREQS (32) - -typedef struct -{ - BAIndexStartRTD_t BAIndexStart; - guint8 NumFreqs; - RTDValues_t RTD_s[MAX_RTD_FREQS]; -} RTDList_t; - -typedef struct -{ - gboolean Exist_ListRTD6; - RTDList_t ListRTD6; - - gboolean Exist_ListRTD12; - RTDList_t ListRTD12; -} RealTimeDiffs_t; - - -typedef MeasurementParams_t GPRSMeasurementParams_PMO_PCCO_t; - -typedef struct { - gboolean existMultiratReporting; - guint8 MultiratReporting; - - gboolean existOffsetThreshold; - OffsetThreshold_t OffsetThreshold; -} MultiratParams3G_t; - -typedef struct -{ - guint8 Qsearch_P; - guint8 SearchPrio3G; - - gboolean existRepParamsFDD; - guint8 RepQuantFDD; - guint8 MultiratReportingFDD; - - gboolean existOffsetThreshold; - OffsetThreshold_t OffsetThreshold; - - MultiratParams3G_t ParamsTDD; - MultiratParams3G_t ParamsCDMA2000; -} ENH_GPRSMeasurementParams3G_PMO_t; - - -typedef struct -{ - guint8 Qsearch_P; - guint8 SearchPrio3G; - - gboolean existRepParamsFDD; - guint8 RepQuantFDD; - guint8 MultiratReportingFDD; - - gboolean existOffsetThreshold; - OffsetThreshold_t OffsetThreshold; - - MultiratParams3G_t ParamsTDD; -} ENH_GPRSMeasurementParams3G_PCCO_t; - - -typedef struct -{ - guint8 Qsearch_p; - guint8 SearchPrio3G; - - guint8 existRepParamsFDD; - guint8 RepQuantFDD; - guint8 MultiratReportingFDD; - - guint8 existReportingParamsFDD; - guint8 ReportingOffsetFDD; - guint8 ReportingThresholdFDD; - - guint8 existMultiratReportingTDD; - guint8 MultiratReportingTDD; - - guint8 existOffsetThresholdTDD; - guint8 ReportingOffsetTDD; - guint8 ReportingThresholdTDD; -} GPRSMeasurementParams3G_t; - -typedef struct -{ - guint8 REMOVED_3GCELL_INDEX; - guint8 CELL_DIFF_LENGTH_3G; - guint8 CELL_DIFF_3G; -} N2_t; - -typedef struct -{ - guint8 N2_Count; - N2_t N2s[32]; -} N1_t; - -typedef struct -{ - guint8 N1_Count; - N1_t N1s[4]; -} Removed3GCellDescription_t; - -typedef struct -{ - guint8 Complete_This; -} CDMA2000_Description_t; - -typedef struct { - guint8 ZERO; - guint16 UARFCN; - guint8 Indic0; - guint8 NrOfCells; - guint8 BitsInCellInfo; - guint8 CellInfo[16]; /* bitmap compressed according to "Range 1024" algorithm (04.18/9.1.54) */ -} UTRAN_FDD_NeighbourCells_t; - -typedef struct { - gboolean existBandwidth; - guint8 Bandwidth; - guint8 NrOfFrequencies; - UTRAN_FDD_NeighbourCells_t CellParams[8]; -} UTRAN_FDD_Description_t; - -typedef struct { - guint8 ZERO; - guint16 UARFCN; - guint8 Indic0; - guint8 NrOfCells; - guint8 BitsInCellInfo; - guint8 CellInfo[16]; /* bitmap compressed according to "Range 512" algorithm */ -} UTRAN_TDD_NeighbourCells_t; - -typedef struct { - gboolean existBandwidth; - guint8 Bandwidth; - guint8 NrOfFrequencies; - UTRAN_TDD_NeighbourCells_t CellParams[8]; -} UTRAN_TDD_Description_t; - -typedef struct -{ - guint8 Exist_Index_Start_3G; - guint8 Index_Start_3G; - guint8 Exist_Absolute_Index_Start_EMR; - guint8 Absolute_Index_Start_EMR; - guint8 Exist_UTRAN_FDD_Description; - UTRAN_FDD_Description_t UTRAN_FDD_Description; - guint8 Exist_UTRAN_TDD_Description; - UTRAN_TDD_Description_t UTRAN_TDD_Description; - guint8 Exist_CDMA2000_Description; - CDMA2000_Description_t CDMA2000_Description; - guint8 Exist_Removed3GCellDescription; - Removed3GCellDescription_t Removed3GCellDescription; -} NeighbourCellDescription3G_PMO_t; - -typedef struct -{ - guint8 Exist_Index_Start_3G; - guint8 Index_Start_3G; - guint8 Exist_Absolute_Index_Start_EMR; - guint8 Absolute_Index_Start_EMR; - guint8 Exist_UTRAN_FDD_Description; - UTRAN_FDD_Description_t UTRAN_FDD_Description; - guint8 Exist_UTRAN_TDD_Description; - UTRAN_TDD_Description_t UTRAN_TDD_Description; - guint8 Exist_Removed3GCellDescription; - Removed3GCellDescription_t Removed3GCellDescription; -} NeighbourCellDescription3G_PCCO_t; - -typedef struct -{ - guint8 UnionType; - union - { - BA_IND_t BA_IND; - guint8 PSI3_CHANGE_MARK; - } u; - - guint8 PMO_IND; - - guint8 REPORT_TYPE; - guint8 REPORTING_RATE; - guint8 INVALID_BSIC_REPORTING; - - gboolean Exist_NeighbourCellDescription3G; - NeighbourCellDescription3G_PMO_t NeighbourCellDescription3G; - - gboolean Exist_GPRSReportPriority; - GPRSReportPriority_t GPRSReportPriority; - - gboolean Exist_GPRSMeasurementParams; - GPRSMeasurementParams_PMO_PCCO_t GPRSMeasurementParams; - gboolean Exist_GPRSMeasurementParams3G; - ENH_GPRSMeasurementParams3G_PMO_t GPRSMeasurementParams3G; -} ENH_Measurement_Parameters_PMO_t; - -typedef struct -{ - guint8 UnionType; - union - { - BA_IND_t BA_IND; - guint8 PSI3_CHANGE_MARK; - } u; - - guint8 PMO_IND; - - guint8 REPORT_TYPE; - guint8 REPORTING_RATE; - guint8 INVALID_BSIC_REPORTING; - - gboolean Exist_NeighbourCellDescription3G; - NeighbourCellDescription3G_PCCO_t NeighbourCellDescription3G; - - gboolean Exist_GPRSReportPriority; - GPRSReportPriority_t GPRSReportPriority; - - gboolean Exist_GPRSMeasurementParams; - GPRSMeasurementParams_PMO_PCCO_t GPRSMeasurementParams; - gboolean Exist_GPRSMeasurementParams3G; - ENH_GPRSMeasurementParams3G_PCCO_t GPRSMeasurementParams3G; -} ENH_Measurement_Parameters_PCCO_t; - -typedef struct -{ - guint8 UnionType; - union - { - Global_TFI_t Global_TFI; - guint32 TLLI; - } u; -} PacketCellChangeOrderID_t; - -typedef struct -{ - guint8 CELL_BAR_QUALIFY_3; - guint8 Exist_SI13_Alt_PBCCH_Location; - SI13_PBCCH_Location_t SI13_Alt_PBCCH_Location; -} lu_ModeCellSelectionParameters_t; - -typedef struct -{ - guint8 Exist_lu_ModeCellSelectionParams; - lu_ModeCellSelectionParameters_t lu_ModeCellSelectionParameters; -} lu_ModeCellSelectionParams_t; - -typedef struct -{ - lu_ModeCellSelectionParams_t lu_ModeCellSelectionParameters; - guint8 NR_OF_FREQUENCIES; - lu_ModeCellSelectionParams_t lu_ModeCellSelectionParams[32]; -} lu_ModeNeighbourCellParams_t; - -typedef struct -{ - guint8 CELL_BAR_QUALIFY_3; - guint8 SAME_RA_AS_SERVING_CELL; - - guint8 Exist_RXLEV_and_TXPWR; - guint8 GPRS_RXLEV_ACCESS_MIN; - guint8 GPRS_MS_TXPWR_MAX_CCH; - - guint8 Exist_OFFSET_and_TIME; - guint8 GPRS_TEMPORARY_OFFSET; - guint8 GPRS_PENALTY_TIME; - - guint8 Exist_GPRS_RESELECT_OFFSET; - guint8 GPRS_RESELECT_OFFSET; - - guint8 Exist_HCS; - HCS_t HCS; - - guint8 Exist_SI13_Alt_PBCCH_Location; - SI13_PBCCH_Location_t SI13_Alt_PBCCH_Location; -} lu_ModeOnlyCellSelection_t; - -typedef struct -{ - guint8 FREQ_DIFF_LENGTH; - guint8 FREQUENCY_DIFF; - guint8 BSIC; - - gboolean Exist_lu_ModeOnlyCellSelectionParams; - lu_ModeOnlyCellSelection_t lu_ModeOnlyCellSelectionParams; -} lu_ModeOnlyCellSelectionParamsWithFreqDiff_t; - -typedef struct -{ - guint16 START_FREQUENCY; - guint8 BSIC; - - guint8 Exist_lu_ModeCellSelection; - lu_ModeOnlyCellSelection_t lu_ModeOnlyCellSelection; - - guint8 NR_OF_FREQUENCIES; - guint8 FREQ_DIFF_LENGTH; - - lu_ModeOnlyCellSelectionParamsWithFreqDiff_t lu_ModeOnlyCellSelectionParamsWithFreqDiff[32]; -} Add_lu_ModeOnlyFrequencyList_t; - -typedef struct -{ - guint8 Count_Add_lu_ModeOnlyFrequencyList; - Add_lu_ModeOnlyFrequencyList_t Add_lu_ModeOnlyFrequencyList[32]; -} NC_lu_ModeOnlyCapableCellList_t; - - -typedef struct -{ - guint8 NumberOfFrequencyIndexes; - guint8 UTRAN_FREQUENCY_INDEX_a[18]; - - gboolean existUTRAN_PRIORITY; - guint8 UTRAN_PRIORITY; - - guint8 THRESH_UTRAN_high; - - gboolean existTHRESH_UTRAN_low; - guint8 THRESH_UTRAN_low; - - gboolean existUTRAN_QRXLEVMIN; - guint8 UTRAN_QRXLEVMIN; -} RepeatedUTRAN_PriorityParameters_t; - -typedef struct -{ - gboolean existDEFAULT_UTRAN_Parameters; - guint8 DEFAULT_UTRAN_PRIORITY; - guint8 DEFAULT_THRESH_UTRAN; - guint8 DEFAULT_UTRAN_QRXLEVMIN; - - guint8 NumberOfPriorityParameters; - RepeatedUTRAN_PriorityParameters_t RepeatedUTRAN_PriorityParameters_a[8]; -} PriorityParametersDescription3G_PMO_t; - -typedef struct -{ - gboolean existEUTRAN_FDD_REPORTING_THRESHOLD_OFFSET; - guint8 EUTRAN_FDD_REPORTING_THRESHOLD; - gboolean existEUTRAN_FDD_REPORTING_THRESHOLD_2; - guint8 EUTRAN_FDD_REPORTING_THRESHOLD_2; - gboolean existEUTRAN_FDD_REPORTING_OFFSET; - guint8 EUTRAN_FDD_REPORTING_OFFSET; - - gboolean existEUTRAN_TDD_REPORTING_THRESHOLD_OFFSET; - guint8 EUTRAN_TDD_REPORTING_THRESHOLD; - gboolean existEUTRAN_TDD_REPORTING_THRESHOLD_2; - guint8 EUTRAN_TDD_REPORTING_THRESHOLD_2; - gboolean existEUTRAN_TDD_REPORTING_OFFSET; - guint8 EUTRAN_TDD_REPORTING_OFFSET; -} EUTRAN_REPORTING_THRESHOLD_OFFSET_t; - -typedef struct -{ - guint8 Qsearch_P_EUTRAN; - guint8 EUTRAN_REP_QUANT; - guint8 EUTRAN_MULTIRAT_REPORTING; - EUTRAN_REPORTING_THRESHOLD_OFFSET_t EUTRAN_REPORTING_THRESHOLD_OFFSET; -} GPRS_EUTRAN_MeasurementParametersDescription_t; - -typedef struct -{ - guint16 EARFCN; - gboolean existMeasurementBandwidth; - guint8 MeasurementBandwidth; -} RepeatedEUTRAN_Cells_t; - -typedef struct -{ - guint8 nbrOfEUTRAN_Cells; - RepeatedEUTRAN_Cells_t EUTRAN_Cells_a[6]; - - gboolean existEUTRAN_PRIORITY; - guint8 EUTRAN_PRIORITY; - - guint8 THRESH_EUTRAN_high; - - gboolean existTHRESH_EUTRAN_low; - guint8 THRESH_EUTRAN_low; - - gboolean existEUTRAN_QRXLEVMIN; - guint8 EUTRAN_QRXLEVMIN; -} RepeatedEUTRAN_NeighbourCells_t; - -typedef struct -{ - guint16 PCID; -} PCID_t; - -typedef struct -{ - guint8 PCID_Pattern_length; - guint8 PCID_Pattern; - guint8 PCID_Pattern_sense; -} PCID_Pattern_t; - -typedef struct -{ - guint8 NumberOfPCIDs; - guint16 PCID_a[11]; - - gboolean existPCID_BITMAP_GROUP; - guint8 PCID_BITMAP_GROUP; - - guint8 NumberOfPCID_Patterns; - PCID_Pattern_t PCID_Pattern_a[19]; -} PCID_Group_IE_t; - -typedef struct -{ - guint8 EUTRAN_FREQUENCY_INDEX; -} EUTRAN_FREQUENCY_INDEX_t; - -typedef struct -{ - PCID_Group_IE_t NotAllowedCells; - guint8 NumberOfFrequencyIndexes; - EUTRAN_FREQUENCY_INDEX_t EUTRAN_FREQUENCY_INDEX_a[28]; -} RepeatedEUTRAN_NotAllowedCells_t; - -typedef struct -{ - guint8 NumberOfMappings; - PCID_Group_IE_t PCID_ToTA_Mapping_a[14]; - - guint8 NumberOfFrequencyIndexes; - EUTRAN_FREQUENCY_INDEX_t EUTRAN_FREQUENCY_INDEX_a[28]; -} RepeatedEUTRAN_PCID_to_TA_mapping_t; - -typedef struct -{ - guint8 EUTRAN_CCN_ACTIVE; - - gboolean existGPRS_EUTRAN_MeasurementParametersDescription; - GPRS_EUTRAN_MeasurementParametersDescription_t GPRS_EUTRAN_MeasurementParametersDescription; - - guint8 nbrOfRepeatedEUTRAN_NeighbourCellsStructs; - RepeatedEUTRAN_NeighbourCells_t RepeatedEUTRAN_NeighbourCells_a[4]; - - guint8 NumberOfNotAllowedCells; - RepeatedEUTRAN_NotAllowedCells_t RepeatedEUTRAN_NotAllowedCells_a[14]; - - guint8 NumberOfMappings; - RepeatedEUTRAN_PCID_to_TA_mapping_t RepeatedEUTRAN_PCID_to_TA_mapping_a[19]; -} EUTRAN_ParametersDescription_PMO_t; - -typedef struct -{ - guint8 GERAN_PRIORITY; - guint8 THRESH_Priority_Search; - guint8 THRESH_GSM_low; - guint8 H_PRIO; - guint8 T_Reselection; -} ServingCellPriorityParametersDescription_t; - -typedef struct -{ - gboolean existServingCellPriorityParametersDescription; - ServingCellPriorityParametersDescription_t ServingCellPriorityParametersDescription; - - gboolean existPriorityParametersDescription3G_PMO; - PriorityParametersDescription3G_PMO_t PriorityParametersDescription3G_PMO; - - gboolean existEUTRAN_ParametersDescription_PMO; - EUTRAN_ParametersDescription_PMO_t EUTRAN_ParametersDescription_PMO; -} PriorityAndEUTRAN_ParametersDescription_PMO_t; - -typedef struct -{ - guint8 PSC_Pattern_length; - guint8 PSC_Pattern; - gboolean PSC_Pattern_sense; -}PSC_Pattern_t; - -typedef struct -{ - guint8 PSC_Count; - guint16 PSC[32]; - guint8 PSC_Pattern_Count; - PSC_Pattern_t PSC_Pattern[32]; -}PSC_Group_t; - -typedef struct -{ - PSC_Group_t CSG_PSC_SPLIT; - guint8 Count; - guint8 UTRAN_FREQUENCY_INDEX[32]; -}ThreeG_CSG_Description_Body_t; - -typedef struct -{ - guint8 Count; - ThreeG_CSG_Description_Body_t ThreeG_CSG_Description_Body[32]; -}ThreeG_CSG_Description_t; - -typedef struct -{ - PSC_Group_t CSG_PCI_SPLIT; - guint8 Count; - guint8 EUTRAN_FREQUENCY_INDEX[32]; -}EUTRAN_CSG_Description_Body_t; - -typedef struct -{ - guint8 Count; - EUTRAN_CSG_Description_Body_t EUTRAN_CSG_Description_Body[32]; -}EUTRAN_CSG_Description_t; - -typedef struct -{ - gboolean existMeasurement_Control_EUTRAN; - gboolean Measurement_Control_EUTRAN; - guint8 EUTRAN_FREQUENCY_INDEX_top; - guint8 Count_EUTRAN_FREQUENCY_INDEX; - guint8 EUTRAN_FREQUENCY_INDEX[32]; - - gboolean existMeasurement_Control_UTRAN; - gboolean Measurement_Control_UTRAN; - guint8 UTRAN_FREQUENCY_INDEX_top; - guint8 Count_UTRAN_FREQUENCY_INDEX; - guint8 UTRAN_FREQUENCY_INDEX[32]; -}Meas_Ctrl_Param_Desp_t; - -typedef struct -{ - guint8 THRESH_EUTRAN_high_Q; - gboolean existTHRESH_EUTRAN_low_Q; - guint8 THRESH_EUTRAN_low_Q; - gboolean existEUTRAN_QQUALMIN; - guint8 EUTRAN_QQUALMIN; - gboolean existEUTRAN_RSRPmin; - guint8 EUTRAN_RSRPmin; -}Reselection_Based_On_RSRQ_t; - -typedef struct -{ - guint8 Count_EUTRAN_FREQUENCY_INDEX; - guint8 EUTRAN_FREQUENCY_INDEX[32]; - guint8 UnionType; - union - { - guint8 EUTRAN_Qmin; - Reselection_Based_On_RSRQ_t Reselection_Based_On_RSRQ; - } u; -}Rept_EUTRAN_Enh_Cell_Resel_Param_t; - -typedef struct -{ - guint8 Count; - Rept_EUTRAN_Enh_Cell_Resel_Param_t Repeated_EUTRAN_Enhanced_Cell_Reselection_Parameters[32]; -}Enh_Cell_Reselect_Param_Desp_t; - -typedef struct -{ - gboolean existUTRAN_CSG_FDD_REPORTING_THRESHOLD; - guint8 UTRAN_CSG_FDD_REPORTING_THRESHOLD; - guint8 UTRAN_CSG_FDD_REPORTING_THRESHOLD_2; - gboolean existUTRAN_CSG_TDD_REPORTING_THRESHOLD; - guint8 UTRAN_CSG_TDD_REPORTING_THRESHOLD; -}UTRAN_CSG_Cells_Reporting_Desp_t; - -typedef struct -{ - gboolean existEUTRAN_CSG_FDD_REPORTING_THRESHOLD; - guint8 EUTRAN_CSG_FDD_REPORTING_THRESHOLD; - guint8 EUTRAN_CSG_FDD_REPORTING_THRESHOLD_2; - gboolean existEUTRAN_CSG_TDD_REPORTING_THRESHOLD; - guint8 EUTRAN_CSG_TDD_REPORTING_THRESHOLD; - guint8 EUTRAN_CSG_TDD_REPORTING_THRESHOLD_2; -}EUTRAN_CSG_Cells_Reporting_Desp_t; - -typedef struct -{ - gboolean existUTRAN_CSG_Cells_Reporting_Description; - UTRAN_CSG_Cells_Reporting_Desp_t UTRAN_CSG_Cells_Reporting_Description; - gboolean existEUTRAN_CSG_Cells_Reporting_Description; - EUTRAN_CSG_Cells_Reporting_Desp_t EUTRAN_CSG_Cells_Reporting_Description; -}CSG_Cells_Reporting_Desp_t; - -typedef struct -{ - gboolean existEnhanced_Cell_Reselection_Parameters_Description; - Enh_Cell_Reselect_Param_Desp_t Enhanced_Cell_Reselection_Parameters_Description; - - gboolean existCSG_Cells_Reporting_Description; - CSG_Cells_Reporting_Desp_t CSG_Cells_Reporting_Description; -}PMO_AdditionsR9_t; - -typedef struct -{ - guint8 dummy; -}Delete_All_Stored_Individual_Priorities_t; - -typedef struct -{ - guint8 Count; - guint16 FDD_ARFCN[32]; -}Individual_UTRAN_Priority_FDD_t; - -typedef struct -{ - guint8 Count; - guint16 TDD_ARFCN[32]; -}Individual_UTRAN_Priority_TDD_t; - -typedef struct -{ - guint8 UnionType; - union - { - Individual_UTRAN_Priority_FDD_t Individual_UTRAN_Priority_FDD; - Individual_UTRAN_Priority_TDD_t Individual_UTRAN_Priority_TDD; - } u; - guint8 UTRAN_PRIORITY; -}Repeated_Individual_UTRAN_Priority_Parameters_t; - -typedef struct -{ - guint8 Exist_DEFAULT_UTRAN_PRIORITY; - guint8 DEFAULT_UTRAN_PRIORITY; - guint8 Repeated_Individual_UTRAN_Priority_Parameters_Count; - Repeated_Individual_UTRAN_Priority_Parameters_t Repeated_Individual_UTRAN_Priority_Parameters[32]; -}ThreeG_Individual_Priority_Parameters_Description_t; - -typedef struct -{ - guint8 Count; - guint16 EARFCN[32]; - guint8 EUTRAN_PRIORITY; -}Repeated_Individual_EUTRAN_Priority_Parameters_t; - -typedef struct -{ - guint8 Exist_DEFAULT_EUTRAN_PRIORITY; - guint8 DEFAULT_EUTRAN_PRIORITY; - guint8 Count; - Repeated_Individual_EUTRAN_Priority_Parameters_t Repeated_Individual_EUTRAN_Priority_Parameters[32]; -}EUTRAN_Individual_Priority_Parameters_Description_t; - -typedef struct -{ - guint8 GERAN_PRIORITY; - guint8 Exist_3G_Individual_Priority_Parameters_Description; - ThreeG_Individual_Priority_Parameters_Description_t ThreeG_Individual_Priority_Parameters_Description; - guint8 Exist_EUTRAN_Individual_Priority_Parameters_Description; - EUTRAN_Individual_Priority_Parameters_Description_t EUTRAN_Individual_Priority_Parameters_Description; - guint8 Exist_T3230_timeout_value; - guint8 T3230_timeout_value; -}Provide_Individual_Priorities_t; - -typedef struct -{ - guint8 UnionType; - union - { - Delete_All_Stored_Individual_Priorities_t Delete_All_Stored_Individual_Priorities; - Provide_Individual_Priorities_t Provide_Individual_Priorities; - } u; -}Individual_Priorities_t; - -typedef struct -{ - gboolean existBA_IND_3G_PMO_IND; - guint8 BA_IND_3G; - guint8 PMO_IND; - - gboolean existPriorityAndEUTRAN_ParametersDescription_PMO; - PriorityAndEUTRAN_ParametersDescription_PMO_t PriorityAndEUTRAN_ParametersDescription_PMO; - - gboolean existIndividualPriorities_PMO; - Individual_Priorities_t IndividualPriorities_PMO; - - gboolean existThreeG_CSG_Description; - ThreeG_CSG_Description_t ThreeG_CSG_Description_PMO; - - gboolean existEUTRAN_CSG_Description; - EUTRAN_CSG_Description_t EUTRAN_CSG_Description_PMO; - - gboolean existMeasurement_Control_Parameters_Description; - Meas_Ctrl_Param_Desp_t Measurement_Control_Parameters_Description_PMO; - - gboolean existAdditionsR9; - PMO_AdditionsR9_t AdditionsR9; -} PMO_AdditionsR8_t; - -typedef struct -{ - gboolean existREPORTING_OFFSET_THRESHOLD_700; - guint8 REPORTING_OFFSET_700; - guint8 REPORTING_THRESHOLD_700; - - gboolean existREPORTING_OFFSET_THRESHOLD_810; - guint8 REPORTING_OFFSET_810; - guint8 REPORTING_THRESHOLD_810; - - guint8 existAdditionsR8; - PMO_AdditionsR8_t additionsR8; -} PMO_AdditionsR7_t; - -typedef struct -{ - guint8 CCN_ACTIVE_3G; - guint8 existAdditionsR7; - PMO_AdditionsR7_t additionsR7; -} PMO_AdditionsR6_t; - -typedef struct -{ - guint8 CCN_ACTIVE_3G; -} PCCO_AdditionsR6_t; - -typedef struct -{ - guint8 existGRNTI_Extension; - guint8 GRNTI; - guint8 exist_lu_ModeNeighbourCellParams; - guint8 count_lu_ModeNeighbourCellParams; - lu_ModeNeighbourCellParams_t lu_ModeNeighbourCellParams[32]; - guint8 existNC_lu_ModeOnlyCapableCellList; - NC_lu_ModeOnlyCapableCellList_t NC_lu_ModeOnlyCapableCellList; - guint8 existGPRS_AdditionalMeasurementParams3G; - GPRS_AdditionalMeasurementParams3G_t GPRS_AdditionalMeasurementParams3G; - guint8 existAdditionsR6; - PMO_AdditionsR6_t additionsR6; -} PMO_AdditionsR5_t; - -typedef struct -{ - guint8 existGRNTI_Extension; - guint8 GRNTI; - guint8 exist_lu_ModeNeighbourCellParams; - guint8 count_lu_ModeNeighbourCellParams; - lu_ModeNeighbourCellParams_t lu_ModeNeighbourCellParams[32]; - guint8 existNC_lu_ModeOnlyCapableCellList; - NC_lu_ModeOnlyCapableCellList_t NC_lu_ModeOnlyCapableCellList; - guint8 existGPRS_AdditionalMeasurementParams3G; - GPRS_AdditionalMeasurementParams3G_t GPRS_AdditionalMeasurementParams3G; - guint8 existAdditionsR6; - PCCO_AdditionsR6_t additionsR6; -} PCCO_AdditionsR5_t; - -typedef struct -{ - guint8 CCN_ACTIVE; - guint8 Exist_CCN_Support_Description_ID; - CCN_Support_Description_t CCN_Support_Description; - guint8 Exist_AdditionsR5; - PMO_AdditionsR5_t AdditionsR5; -} PMO_AdditionsR4_t; - -typedef struct -{ - guint8 CCN_ACTIVE; - guint8 Exist_Container_ID; - guint8 CONTAINER_ID; - guint8 Exist_CCN_Support_Description_ID; - CCN_Support_Description_t CCN_Support_Description; - guint8 Exist_AdditionsR5; - PCCO_AdditionsR5_t AdditionsR5; -} PCCO_AdditionsR4_t; - -typedef struct -{ - ENH_Measurement_Parameters_PCCO_t ENH_Measurement_Parameters; - guint8 Exist_AdditionsR4; - PCCO_AdditionsR4_t AdditionsR4; -} PCCO_AdditionsR99_t; - -typedef struct -{ - guint8 Exist_ENH_Measurement_Parameters; - ENH_Measurement_Parameters_PMO_t ENH_Measurement_Parameters; - guint8 Exist_AdditionsR4; - PMO_AdditionsR4_t AdditionsR4; -} PMO_AdditionsR99_t; - -typedef struct -{ - guint8 Exist_LSA_Parameters; - LSA_Parameters_t LSA_Parameters; - - guint8 Exist_AdditionsR99; - PMO_AdditionsR99_t AdditionsR99; -} PMO_AdditionsR98_t; - -typedef struct -{ - guint8 Exist_LSA_Parameters; - LSA_Parameters_t LSA_Parameters; - - guint8 Exist_AdditionsR99; - PCCO_AdditionsR99_t AdditionsR99; -} PCCO_AdditionsR98_t; - -typedef struct -{ - guint8 IMMEDIATE_REL; - guint16 ARFCN; - guint8 BSIC; - NC_Measurement_Parameters_with_Frequency_List_t NC_Measurement_Parameters; - - guint8 Exist_AdditionsR98; - PCCO_AdditionsR98_t AdditionsR98; -} Target_Cell_GSM_t; - -typedef struct -{ - guint8 Exist_EUTRAN_Target_Cell; - EUTRAN_Target_Cell_t EUTRAN_Target_Cell; - guint8 Exist_Individual_Priorities; - Individual_Priorities_t Individual_Priorities; -}Target_Cell_3G_AdditionsR8_t; - -typedef struct -{ - guint8 Exist_G_RNTI_Extention; - guint8 G_RNTI_Extention; - guint8 Exist_AdditionsR8; - Target_Cell_3G_AdditionsR8_t AdditionsR8; -}Target_Cell_3G_AdditionsR5_t; - -typedef struct -{ - /* 00 -- Message escape */ - guint8 IMMEDIATE_REL; - guint8 Exist_FDD_Description; - FDD_Target_Cell_t FDD_Target_Cell; - guint8 Exist_TDD_Description; - TDD_Target_Cell_t TDD_Target_Cell; - guint8 Exist_AdditionsR5; - Target_Cell_3G_AdditionsR5_t AdditionsR5; -} Target_Cell_3G_t; - -#define TARGET_CELL_GSM 0 -#define TARGET_CELL_3G 1 - -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PAGE_MODE; - - PacketCellChangeOrderID_t ID; - - guint8 UnionType; - union - { - Target_Cell_GSM_t Target_Cell_GSM; - Target_Cell_3G_t Target_Cell_3G; - } u; - -} Packet_Cell_Change_Order_t; - -/* < Packet Cell Change Continue message contents > */ -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PAGE_MODE; - - Global_TFI_t Global_TFI; - guint8 Exist_ID; - guint16 ARFCN; - guint8 BSIC; - guint8 CONTAINER_ID; -} Packet_Cell_Change_Continue_t; - - -/* < Packet Neighbour Cell Data message contents > */ -typedef struct -{ - guint16 ARFCN; - guint8 BSIC; - guint8 CONTAINER[17]; /* PD (3 bits) + CD_LENGTH (5 bits) + 16 bytes of CONTAINER_DATA (max!) */ -} PNCD_Container_With_ID_t; - -typedef struct -{ - guint8 CONTAINER[19]; /* PD (3 bits) + CD_LENGTH (5 bits) + 18 bytes of CONTAINER_DATA (max!) */ -} PNCD_Container_Without_ID_t; - -typedef struct -{ - guint8 UnionType; - union - { - PNCD_Container_Without_ID_t PNCD_Container_Without_ID; - PNCD_Container_With_ID_t PNCD_Container_With_ID; - } u; -} PNCDContainer_t; - -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PAGE_MODE; - /* Fixed 0 */ - Global_TFI_t Global_TFI; - guint8 CONTAINER_ID; - guint8 spare; - guint8 CONTAINER_INDEX; - - PNCDContainer_t Container; -} Packet_Neighbour_Cell_Data_t; - -/* < Packet Serving Cell Data message contents > */ -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PAGE_MODE; - /* Fixed 0 */ - Global_TFI_t Global_TFI; - guint8 spare; - guint8 CONTAINER_INDEX; - guint8 CONTAINER[19]; /* PD (3 bits) + CD_LENGTH (5 bits) + 18 bytes of CONTAINER_DATA (max!) */ -} Packet_Serving_Cell_Data_t; - -/* < Packet Measurement Order message contents > */ -typedef struct -{ - guint16 START_FREQUENCY; - guint8 NR_OF_FREQUENCIES; - guint8 FREQ_DIFF_LENGTH; - - guint8 Count_FREQUENCY_DIFF; - guint8 FREQUENCY_DIFF[31];/* bit (FREQ_DIFF_LENGTH) * NR_OF_FREQUENCIES --> MAX is bit(7) * 31 */ -} EXT_Frequency_List_t; - -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PAGE_MODE; - - PacketDownlinkID_t ID; /* use the PDA ID as it is the same as as the PMO */ - - guint8 PMO_INDEX; - guint8 PMO_COUNT; - - guint8 Exist_NC_Measurement_Parameters; - NC_Measurement_Parameters_with_Frequency_List_t NC_Measurement_Parameters; - - guint8 Exist_EXT_Measurement_Parameters; - - guint8 Exist_AdditionsR98; - PMO_AdditionsR98_t AdditionsR98; -} Packet_Measurement_Order_t; - -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PAGE_MODE; - PacketDownlinkID_t ID; -} Packet_Measurement_Order_Reduced_t; - -/* Enhanced measurement report */ - -typedef struct -{ - guint8 RXLEV_SERVING_CELL; -} ServingCellData_t; - -typedef struct -{ - guint8 BCCH_FREQ_NCELL; - guint8 BSIC; - guint8 RXLEV_NCELL; -} Repeated_Invalid_BSIC_Info_t; - -typedef struct -{ - gboolean Exist_REPORTING_QUANTITY; - guint8 REPORTING_QUANTITY; -} REPORTING_QUANTITY_t; - -typedef struct -{ - guint8 NC_MODE; - guint8 UnionType; - union - { - BA_USED_t BA_USED; - guint8 PSI3_CHANGE_MARK; - } u; - guint8 PMO_USED; - guint8 SCALE; - guint8 Exist_ServingCellData; - ServingCellData_t ServingCellData; - guint8 Count_Repeated_Invalid_BSIC_Info; - Repeated_Invalid_BSIC_Info_t Repeated_Invalid_BSIC_Info[32]; - - gboolean Exist_Repeated_REPORTING_QUANTITY; - guint8 Count_Repeated_Reporting_Quantity; - REPORTING_QUANTITY_t Repeated_REPORTING_QUANTITY[96]; -} NC_MeasurementReport_t; - -/* Packet Handover PHO ----------------- */ - -typedef struct -{ - guint8 UnionType; - union - { - guint8 MS_TimeslotAllocation; - Power_Control_Parameters_t Power_Control_Parameters; - } u; -} GlobalTimeslotDescription_t; - -typedef struct -{ - guint8 TimeslotAllocation; - guint8 PFI; - guint8 RLC_Mode; - guint8 TFI_Assignment; - guint8 ControlACK; - guint8 Exist_EGPRS_WindowSize; - guint8 EGPRS_WindowSize; -} PHO_DownlinkAssignment_t; - -typedef struct -{ - gboolean Exist_USF; - guint8 USF; -} PHO_USF_1_7_t; - -typedef struct -{ - guint8 USF_0; - PHO_USF_1_7_t USF_1_7[7]; - guint8 NBR_OfAllocatedTimeslots; -} USF_AllocationArray_t; - -typedef struct -{ - guint8 PFI; - guint8 RLC_Mode; - guint8 TFI_Assignment; - guint8 Exist_ChannelCodingCommand; - guint8 ChannelCodingCommand; - guint8 Exist_EGPRS_ChannelCodingCommand; - guint8 EGPRS_ChannelCodingCommand; - guint8 Exist_EGPRS_WindowSize; - guint8 EGPRS_WindowSize; - guint8 USF_Granularity; - guint8 Exist_TBF_TimeslotAllocation; - guint8 TBF_TimeslotAllocation; - guint8 UnionType; - union - { - guint8 USF_SingleAllocation; - USF_AllocationArray_t USF_AllocationArray; - } u; -} PHO_UplinkAssignment_t; - -typedef struct -{ - GlobalTimeslotDescription_t GlobalTimeslotDescription; - guint8 Exist_PHO_UA; - PHO_UplinkAssignment_t PHO_UA; -} GlobalTimeslotDescription_UA_t; - -typedef struct -{ - guint8 Exist_ChannelCodingCommand; - guint8 ChannelCodingCommand; - guint8 Exist_GlobalTimeslotDescription_UA; - GlobalTimeslotDescription_UA_t GTD_UA; - guint8 Exist_DownlinkAssignment; - PHO_DownlinkAssignment_t DownlinkAssignment; -} PHO_GPRS_t; - - -typedef struct -{ - guint8 Exist_EGPRS_WindowSize; - guint8 EGPRS_WindowSize; - guint8 LinkQualityMeasurementMode; - guint8 Exist_BEP_Period2; - guint8 BEP_Period2; -} EGPRS_Description_t; - -typedef struct -{ - guint8 Exist_EGPRS_Description; - EGPRS_Description_t EGPRS_Description; - guint8 Exist_DownlinkAssignment; - PHO_DownlinkAssignment_t DownlinkAssignment; -} DownlinkTBF_t; - -typedef struct -{ - guint8 Exist_EGPRS_WindowSize; - guint8 EGPRS_WindowSize; - guint8 Exist_EGPRS_ChannelCodingCommand; - guint8 EGPRS_ChannelCodingCommand; - guint8 Exist_BEP_Period2; - guint8 BEP_Period2; - guint8 Exist_GlobalTimeslotDescription_UA; - GlobalTimeslotDescription_UA_t GTD_UA; - guint8 Exist_DownlinkTBF; - DownlinkTBF_t DownlinkTBF; -}PHO_EGPRS_t; - -typedef struct -{ - Global_Packet_Timing_Advance_t GlobalPacketTimingAdvance; - guint8 Exist_PacketExtendedTimingAdvance; - guint8 PacketExtendedTimingAdvance; -} PHO_TimingAdvance_t; - -typedef struct -{ - guint8 NAS_ContainerLength; - guint8 NAS_Container[MAX_NAS_CONTAINER_LENGTH]; -} NAS_Container_t; - -typedef struct -{ - guint8 RRC_ContainerLength; - guint8 RRC_Container[MAX_RRC_CONTAINER_LENGTH]; -} PS_HandoverTo_UTRAN_Payload_t; - - -typedef struct -{ - guint8 Exist_HandoverReference; - guint8 HandoverReference; - guint8 ARFCN; - guint8 SI; - guint8 NCI; - guint8 BSIC; - guint8 Exist_CCN_Active; - guint8 CCN_Active; - guint8 Exist_CCN_Active_3G; - guint8 CCN_Active_3G; - guint8 Exist_CCN_Support_Description; - CCN_Support_Description_t CCN_Support_Description; - Frequency_Parameters_t Frequency_Parameters; - guint8 NetworkControlOrder; - guint8 Exist_PHO_TimingAdvance; - PHO_TimingAdvance_t PHO_TimingAdvance; - guint8 Extended_Dynamic_Allocation; - guint8 RLC_Reset; - guint8 Exist_PO_PR; - guint8 PO; - guint8 PR_Mode; - guint8 Exist_UplinkControlTimeslot; - guint8 UplinkControlTimeslot; - guint8 UnionType; - union - { - PHO_GPRS_t PHO_GPRS_Mode; - PHO_EGPRS_t PHO_EGPRS_Mode; - } u; -} PHO_RadioResources_t; - -typedef struct -{ - PHO_RadioResources_t PHO_RadioResources; - guint8 Exist_NAS_Container; - NAS_Container_t NAS_Container; -} PS_HandoverTo_A_GB_ModePayload_t; - -typedef struct -{ - guint8 MessageType; - guint8 PageMode; - Global_TFI_t Global_TFI; - guint8 ContainerID; - guint8 UnionType; - union - { - PS_HandoverTo_A_GB_ModePayload_t PS_HandoverTo_A_GB_ModePayload; - PS_HandoverTo_UTRAN_Payload_t PS_HandoverTo_UTRAN_Payload; - } u; -} Packet_Handover_Command_t; - -/* End Packet Handover */ - -/* Packet Physical Information ----------------- */ - -typedef struct -{ - guint8 MessageType; - guint8 PageMode; - Global_TFI_t Global_TFI; - guint8 TimingAdvance; -} Packet_PhysicalInformation_t; - -/* End Packet Physical Information */ - - - -/* ADDITIONAL MS RADIO ACCESS CAPABILITIES -----------------*/ -typedef struct -{ - guint8 UnionType; - union - { - Global_TFI_t Global_TFI; - guint32 TLLI; - } u; -} AdditionalMsRadAccessCapID_t; - - -typedef struct -{ - guint8 MESSAGE_TYPE; - guint8 PayloadType; - guint8 spare; - guint8 R; - - AdditionalMsRadAccessCapID_t ID; - MS_Radio_Access_capability_t MS_Radio_Access_capability; -} Additional_MS_Rad_Access_Cap_t; - -/* End ADDITIONAL MS RADIO ACCESS CAPABILITIES */ - - -/* Packet Pause -----------------*/ - -typedef struct -{ - guint8 MESSAGE_TYPE; - - guint32 TLLI; - guint8 RAI[48/8]; -} Packet_Pause_t; - -/* End Packet Pause */ - - -/* -< NC Measurement Parameters struct > ::= - < NETWORK_CONTROL_ORDER : bit (2) > - { 0 | 1 < NC_ NON_DRX_PERIOD : bit (3) > - < NC_REPORTING_PERIOD_I : bit (3) > - < NC_REPORTING_PERIOD_T : bit (3) > } ; -< Cell Selection struct > ::= - < EXC_ACC : bit > - < CELL_BAR_ACCESS_2 : bit (1) > - < SAME_RA_AS_SERVING_CELL : bit (1) > - { 0 | 1 < GPRS_RXLEV_ACCESS_MIN : bit (6) > - < GPRS_MS_TXPWR_MAX_CCH : bit (5) > } -{ 0 | 1 < GPRS_TEMPORARY_OFFSET : bit (3) > - < GPRS_PENALTY_TIME : bit (5) > } -Table 25 (concluded): PACKET CELL CHANGE ORDER message content - { 0 | 1 < GPRS_RESELECT_OFFSET : bit (5) > } -{ 0 | 1 < HCS params : < HCS struct > > } -{ 0 | 1 < SI13_PBCCH_LOCATION : < SI13_PBCCH_LOCATION struct > > } ; - -< SI13_PBCCH_LOCATION struct > ::= - { 0 < SI13_LOCATION : bit (1) > - | 1 < PBCCH_LOCATION : bit (2) > - < PSI1_REPEAT_PERIOD : bit (4) > } ; - -< HCS struct > ::= - < GPRS_PRIORITY_CLASS : bit (3) > - < GPRS_HCS_THR : bit (5) > ; -*/ - -/* < Downlink RLC/MAC control message > */ -#define MT_PACKET_CELL_CHANGE_ORDER 0x01 -#define MT_PACKET_DOWNLINK_ASSIGNMENT 0x02 -#define MT_PACKET_MEASUREMENT_ORDER 0x03 -#define MT_PACKET_POLLING_REQ 0x04 -#define MT_PACKET_POWER_CONTROL_TIMING_ADVANCE 0x05 -#define MT_PACKET_QUEUEING_NOTIFICATION 0x06 -#define MT_PACKET_TIMESLOT_RECONFIGURE 0x07 -#define MT_PACKET_TBF_RELEASE 0x08 -#define MT_PACKET_UPLINK_ACK_NACK 0x09 -#define MT_PACKET_UPLINK_ASSIGNMENT 0x0A -#define MT_PACKET_CELL_CHANGE_CONTINUE 0x0B -#define MT_PACKET_NEIGHBOUR_CELL_DATA 0x0C -#define MT_PACKET_SERVING_CELL_DATA 0x0D -#define MT_PACKET_HANDOVER_COMMAND 0x15 -#define MT_PACKET_PHYSICAL_INFORMATION 0x16 -#define MT_PACKET_ACCESS_REJECT 0x21 -#define MT_PACKET_PAGING_REQUEST 0x22 -#define MT_PACKET_PDCH_RELEASE 0x23 -#define MT_PACKET_PRACH_PARAMETERS 0x24 -#define MT_PACKET_DOWNLINK_DUMMY_CONTROL_BLOCK 0x25 -#define MT_PACKET_SYSTEM_INFO_6 0x30 -#define MT_PACKET_SYSTEM_INFO_1 0x31 -#define MT_PACKET_SYSTEM_INFO_2 0x32 -#define MT_PACKET_SYSTEM_INFO_3 0x33 -#define MT_PACKET_SYSTEM_INFO_3_BIS 0x34 -#define MT_PACKET_SYSTEM_INFO_4 0x35 -#define MT_PACKET_SYSTEM_INFO_5 0x36 -#define MT_PACKET_SYSTEM_INFO_13 0x37 -#define MT_PACKET_SYSTEM_INFO_7 0x38 -#define MT_PACKET_SYSTEM_INFO_8 0x39 -#define MT_PACKET_SYSTEM_INFO_14 0x3A -#define MT_PACKET_SYSTEM_INFO_3_TER 0x3C -#define MT_PACKET_SYSTEM_INFO_3_QUATER 0x3D -#define MT_PACKET_SYSTEM_INFO_15 0x3E - -/* < Uplink RLC/MAC control message > */ -#define MT_PACKET_CELL_CHANGE_FAILURE 0x00 -#define MT_PACKET_CONTROL_ACK 0x01 -#define MT_PACKET_DOWNLINK_ACK_NACK 0x02 -#define MT_PACKET_UPLINK_DUMMY_CONTROL_BLOCK 0x03 -#define MT_PACKET_MEASUREMENT_REPORT 0x04 -#define MT_PACKET_RESOURCE_REQUEST 0x05 -#define MT_PACKET_MOBILE_TBF_STATUS 0x06 -#define MT_PACKET_PSI_STATUS 0x07 -#define MT_EGPRS_PACKET_DOWNLINK_ACK_NACK 0x08 -#define MT_PACKET_PAUSE 0x09 -#define MT_PACKET_ENHANCED_MEASUREMENT_REPORT 0x0A -#define MT_ADDITIONAL_MS_RAC 0x0B -#define MT_PACKET_CELL_CHANGE_NOTIFICATION 0x0C -#define MT_PACKET_SI_STATUS 0x0D -#define MT_ENHANCED_MEASUREMENT_REPORT 0x04 - -/* < Downlink RLC/MAC control message > */ -typedef struct -{ - union - { - guint8 MESSAGE_TYPE; - - Packet_Access_Reject_t Packet_Access_Reject; - Packet_Cell_Change_Order_t Packet_Cell_Change_Order; - Packet_Downlink_Assignment_t Packet_Downlink_Assignment; - Packet_Measurement_Order_Reduced_t Packet_Measurement_Order; - Packet_Neighbour_Cell_Data_t Packet_Neighbour_Cell_Data; - Packet_Serving_Cell_Data_t Packet_Serving_Cell_Data; - Packet_Paging_Request_t Packet_Paging_Request; - Packet_PDCH_Release_t Packet_PDCH_Release; - Packet_Polling_Request_t Packet_Polling_Request; - Packet_Power_Control_Timing_Advance_t Packet_Power_Control_Timing_Advance; - Packet_PRACH_Parameters_t Packet_PRACH_Parameters; - Packet_Queueing_Notification_t Packet_Queueing_Notification; - Packet_Timeslot_Reconfigure_t Packet_Timeslot_Reconfigure; - Packet_TBF_Release_t Packet_TBF_Release; - Packet_Uplink_Ack_Nack_t Packet_Uplink_Ack_Nack; - Packet_Uplink_Assignment_t Packet_Uplink_Assignment; - Packet_Cell_Change_Continue_t Packet_Cell_Change_Continue; - Packet_Handover_Command_t Packet_Handover_Command; - Packet_PhysicalInformation_t Packet_PhysicalInformation; - Packet_Downlink_Dummy_Control_Block_t Packet_Downlink_Dummy_Control_Block; - - PSI1_t PSI1; - PSI2_t PSI2; - PSI3_t PSI3; - PSI3_BIS_t PSI3_BIS; - PSI4_t PSI4; - PSI13_t PSI13; - PSI5_t PSI5; - } u; - - /* NrOfBits is placed after union to avoid unnecessary code changes when addressing the union members - * NrOfBits serves dual purpose: - * 1. before unpacking it will hold the max number of bits for the CSN.1 unpacking function - * 2. after successful unpacking it will hold the number of bits unpacked from a message. - * This will be needed for some EGPRS messages to compute the length of included variable bitmap - */ - guint8 PAYLOAD_TYPE; - guint8 RRBP; - guint8 SP; - guint8 USF; - guint8 RBSN; - guint8 RTI; - guint8 FS; - guint8 AC; - guint8 PR; - guint8 TFI; - guint8 D; - guint8 RBSNe; - guint8 FSe; - guint8 spare; - gint16 NrOfBits; -} RlcMacDownlink_t; - -typedef gint16 MSGGPRS_Status_t; -/* < Uplink RLC/MAC control message > */ -typedef struct -{ - union - { - guint8 MESSAGE_TYPE; - Packet_Cell_Change_Failure_t Packet_Cell_Change_Failure; - Packet_Control_Acknowledgement_t Packet_Control_Acknowledgement; - Packet_Downlink_Ack_Nack_t Packet_Downlink_Ack_Nack; - EGPRS_PD_AckNack_t Egprs_Packet_Downlink_Ack_Nack; - Packet_Uplink_Dummy_Control_Block_t Packet_Uplink_Dummy_Control_Block; - Packet_Measurement_Report_t Packet_Measurement_Report; - Packet_Resource_Request_t Packet_Resource_Request; - Packet_Mobile_TBF_Status_t Packet_Mobile_TBF_Status; - Packet_PSI_Status_t Packet_PSI_Status; - Packet_Enh_Measurement_Report_t Packet_Enh_Measurement_Report; - Packet_Cell_Change_Notification_t Packet_Cell_Change_Notification; - Packet_SI_Status_t Packet_SI_Status; - Additional_MS_Rad_Access_Cap_t Additional_MS_Rad_Access_Cap; - Packet_Pause_t Packet_Pause; - } u; - gint16 NrOfBits; -} RlcMacUplink_t; - -/* < Uplink RLC/MAC data block message > */ -typedef struct -{ - guint8 PAYLOAD_TYPE; - guint8 CV; - guint8 SI; - guint8 R; - guint8 spare; - guint8 PI; - guint8 TFI; - guint8 TI; - guint8 BSN; - guint8 E_1; - guint8 LENGTH_INDICATOR[MAX_NUMBER_LLC_PDU]; - guint8 M[MAX_NUMBER_LLC_PDU]; - guint8 E[MAX_NUMBER_LLC_PDU]; - guint32 TLLI; - guint8 PFI; - guint8 E_2; - guint8 RLC_DATA[20]; - guint8 MESSAGE_TYPE; -} RlcMacUplinkDataBlock_t; - - -/* < Downlink RLC/MAC data block message > */ -typedef struct -{ - guint8 PAYLOAD_TYPE; - guint8 RRBP; - guint8 SP; - guint8 USF; - guint8 PR; - guint8 TFI; - guint8 FBI; - guint8 BSN; - guint8 E_1; - guint8 LENGTH_INDICATOR[MAX_NUMBER_LLC_PDU]; - guint8 M[MAX_NUMBER_LLC_PDU]; - guint8 E[MAX_NUMBER_LLC_PDU]; - guint8 RLC_DATA[20]; - guint8 MESSAGE_TYPE; -} RlcMacDownlinkDataBlock_t; - -void GPRSMSG_Profile(gint16 i); - -/* SI1_RestOctet_t */ - -typedef struct -{ - gboolean Exist_NCH_Position; - guint8 NCH_Position; - - guint8 BandIndicator; -} SI1_RestOctet_t; - -/* SI3_Rest_Octet_t */ -typedef struct -{ - guint8 CBQ; - guint8 CELL_RESELECT_OFFSET; - guint8 TEMPORARY_OFFSET; - guint8 PENALTY_TIME; -} Selection_Parameters_t; - -typedef struct -{ - guint8 Exist_Selection_Parameters; - Selection_Parameters_t Selection_Parameters; - - guint8 Exist_Power_Offset; - guint8 Power_Offset; - - guint8 System_Information_2ter_Indicator; - guint8 Early_Classmark_Sending_Control; - - guint8 Exist_WHERE; - guint8 WHERE; - - guint8 Exist_GPRS_Indicator; - guint8 RA_COLOUR; - guint8 SI13_POSITION; - guint8 ECS_Restriction3G; - guint8 ExistSI2quaterIndicator; - guint8 SI2quaterIndicator; -} SI3_Rest_Octet_t; - -typedef struct -{ - guint8 Exist_Selection_Parameters; - Selection_Parameters_t Selection_Parameters; - - guint8 Exist_Power_Offset; - guint8 Power_Offset; - - guint8 Exist_GPRS_Indicator; - guint8 RA_COLOUR; - guint8 SI13_POSITION; -} SI4_Rest_Octet_t; - -typedef SI4_Rest_Octet_t SI7_Rest_Octet_t; -typedef SI4_Rest_Octet_t SI8_Rest_Octet_t; - - -/* SI6_RestOctet_t */ - -typedef struct -{ - guint8 PagingChannelRestructuring; - guint8 NLN_SACCH; - - gboolean Exist_CallPriority; - guint8 CallPriority; - - guint8 NLN_Status; -} PCH_and_NCH_Info_t; - -typedef struct -{ - gboolean Exist_PCH_and_NCH_Info; - PCH_and_NCH_Info_t PCH_and_NCH_Info; - - gboolean Exist_VBS_VGCS_Options; - guint8 VBS_VGCS_Options; - - /* The meaning of Exist_DTM_Support is as follows: - * FALSE => DTM is not supported in the serving cell, RAC and MAX_LAPDm are absent in bitstream - * TRUE => DTM is supported in the serving cell, RAC and MAX_LAPDm are present in bitstream - */ - gboolean Exist_DTM_Support; - guint8 RAC; - guint8 MAX_LAPDm; - - guint8 BandIndicator; /* bit(1) L/H, L => ARFCN in 1800 band H => ARFCN in 1900 band */ -} SI6_RestOctet_t; - -/************************************************* - * Enhanced Measurement Report. TS 04.18 9.1.55. * - *************************************************/ - -typedef struct -{ - guint8 DTX_USED; - guint8 RXLEV_VAL; - guint8 RX_QUAL_FULL; - guint8 MEAN_BEP; - guint8 CV_BEP; - guint8 NBR_RCVD_BLOCKS; -} EMR_ServingCell_t; - -typedef struct -{ - guint8 RR_Short_PD; - guint8 MESSAGE_TYPE; - guint8 ShortLayer2_Header; - - BA_USED_t BA_USED; - guint8 BSIC_Seen; - - guint8 SCALE; - - guint8 Exist_ServingCellData; - EMR_ServingCell_t ServingCellData; - - guint8 Count_RepeatedInvalid_BSIC_Info; /* Number of instances */ - RepeatedInvalid_BSIC_Info_t RepeatedInvalid_BSIC_Info[INV_BSIC_LIST_LEN]; - - guint8 Exist_ReportBitmap; - guint8 Count_REPORTING_QUANTITY_Instances; /* Number of instances */ - REPORTING_QUANTITY_Instance_t REPORTING_QUANTITY_Instances[REPORT_QUANTITY_LIST_LEN]; - -} EnhancedMeasurementReport_t; - - void decode_gsm_rlcmac_uplink(bitvec * vector, RlcMacUplink_t * data); - void decode_gsm_rlcmac_downlink(bitvec * vector, RlcMacDownlink_t * data); - void encode_gsm_rlcmac_downlink(bitvec * vector, RlcMacDownlink_t * data); - void encode_gsm_rlcmac_uplink(bitvec * vector, RlcMacUplink_t * data); - void decode_gsm_rlcmac_uplink_data(bitvec * vector, RlcMacUplinkDataBlock_t * data); - void encode_gsm_rlcmac_downlink_data(bitvec * vector, RlcMacDownlinkDataBlock_t * data); -#endif /* __PACKET_GSM_RLCMAC_H__ */ diff --git a/gsm_timer.cpp b/gsm_timer.cpp deleted file mode 100644 index 95513b47..00000000 --- a/gsm_timer.cpp +++ /dev/null @@ -1,226 +0,0 @@ -/* gsm_timer.cpp - * - * Copyright (C) 2012 Ivan Klyuchnikov - * - * 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. - */ - -/* These store the amount of frame number that we wait until next timer expires. */ -static int nearest; -static int *nearest_p; - -/*! \addtogroup gsm_timer - * @{ - */ - -/*! \file gsm_timer.cpp - */ - -#include -#include -#include -#include -#include - -static struct rb_root timer_root = RB_ROOT; - -static void __add_gsm_timer(struct osmo_gsm_timer_list *timer) -{ - struct rb_node **new_node = &(timer_root.rb_node); - struct rb_node *parent = NULL; - - while (*new_node) { - struct osmo_gsm_timer_list *this_timer; - - this_timer = container_of(*new_node, struct osmo_gsm_timer_list, node); - - parent = *new_node; - if (timer->fn < this_timer->fn) - new_node = &((*new_node)->rb_left); - else - new_node = &((*new_node)->rb_right); - } - - rb_link_node(&timer->node, parent, new_node); - rb_insert_color(&timer->node, &timer_root); -} - -/*! \brief add a new timer to the timer management - * \param[in] timer the timer that should be added - */ -void osmo_gsm_timer_add(struct osmo_gsm_timer_list *timer) -{ - osmo_gsm_timer_del(timer); - timer->active = 1; - INIT_LLIST_HEAD(&timer->list); - __add_gsm_timer(timer); -} - -/*! \brief schedule a gsm timer at a given future relative time - * \param[in] timer the to-be-added timer - * \param[in] number of frames from now - * - * This function can be used to (re-)schedule a given timer at a - * specified number of frames in the future. It will - * internally add it to the timer management data structures, thus - * osmo_timer_add() is automatically called. - */ -void -osmo_gsm_timer_schedule(struct osmo_gsm_timer_list *timer, int fn) -{ - int current_fn; - - current_fn = get_current_fn(); - timer->fn = current_fn + fn; - osmo_gsm_timer_add(timer); -} - -/*! \brief delete a gsm timer from timer management - * \param[in] timer the to-be-deleted timer - * - * This function can be used to delete a previously added/scheduled - * timer from the timer management code. - */ -void osmo_gsm_timer_del(struct osmo_gsm_timer_list *timer) -{ - if (timer->active) { - timer->active = 0; - rb_erase(&timer->node, &timer_root); - /* make sure this is not already scheduled for removal. */ - if (!llist_empty(&timer->list)) - llist_del_init(&timer->list); - } -} - -/*! \brief check if given timer is still pending - * \param[in] timer the to-be-checked timer - * \return 1 if pending, 0 otherwise - * - * This function can be used to determine whether a given timer - * has alredy expired (returns 0) or is still pending (returns 1) - */ -int osmo_gsm_timer_pending(struct osmo_gsm_timer_list *timer) -{ - return timer->active; -} - -/* - * if we have a nearest frame number return the delta between the current - * FN and the FN of the nearest timer. - * If the nearest timer timed out return NULL and then we will - * dispatch everything after the select - */ -int *osmo_gsm_timers_nearest(void) -{ - /* nearest_p is exactly what we need already: NULL if nothing is - * waiting, {0,0} if we must dispatch immediately, and the correct - * delay if we need to wait */ - return nearest_p; -} - -static void update_nearest(int *cand, int *current) -{ - if (*cand != LONG_MAX) { - if (*cand > *current) - nearest = *cand - *current; - else { - /* loop again inmediately */ - nearest = 0; - } - nearest_p = &nearest; - } else { - nearest_p = NULL; - } -} - -/* - * Find the nearest FN and update s_nearest_time - */ -void osmo_gsm_timers_prepare(void) -{ - struct rb_node *node; - int current_fn; - - current_fn = get_current_fn(); - - node = rb_first(&timer_root); - if (node) { - struct osmo_gsm_timer_list *this_timer; - this_timer = container_of(node, struct osmo_gsm_timer_list, node); - update_nearest(&this_timer->fn, ¤t_fn); - } else { - nearest_p = NULL; - } -} - -/* - * fire all timers... and remove them - */ -int osmo_gsm_timers_update(void) -{ - int current_fn; - struct rb_node *node; - struct llist_head timer_eviction_list; - struct osmo_gsm_timer_list *this_timer; - int work = 0; - - current_fn = get_current_fn(); - - INIT_LLIST_HEAD(&timer_eviction_list); - for (node = rb_first(&timer_root); node; node = rb_next(node)) { - this_timer = container_of(node, struct osmo_gsm_timer_list, node); - - if (this_timer->fn > current_fn) - break; - - llist_add(&this_timer->list, &timer_eviction_list); - } - - /* - * The callbacks might mess with our list and in this case - * even llist_for_each_entry_safe is not safe to use. To allow - * osmo_gsm_timer_del to be called from within the callback we need - * to restart the iteration for each element scheduled for removal. - * - * The problematic scenario is the following: Given two timers A - * and B that have expired at the same time. Thus, they are both - * in the eviction list in this order: A, then B. If we remove - * timer B from the A's callback, we continue with B in the next - * iteration step, leading to an access-after-release. - */ -restart: - llist_for_each_entry(this_timer, &timer_eviction_list, list) { - osmo_gsm_timer_del(this_timer); - this_timer->cb(this_timer->data); - work = 1; - goto restart; - } - - return work; -} - -int osmo_gsm_timers_check(void) -{ - struct rb_node *node; - int i = 0; - - for (node = rb_first(&timer_root); node; node = rb_next(node)) { - i++; - } - return i; -} - -/*! }@ */ - diff --git a/gsm_timer.h b/gsm_timer.h deleted file mode 100644 index fc42cafe..00000000 --- a/gsm_timer.h +++ /dev/null @@ -1,84 +0,0 @@ -/* gsm_timer.h - * - * Copyright (C) 2012 Ivan Klyuchnikov - * - * 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. - */ - -/*! \defgroup timer GSM timers - * @{ - */ - -/*! \file gsm_timer.h - * \brief GSM timer handling routines - */ -#ifndef GSM_TIMER_H -#define GSM_TIMER_H - -extern "C" { -#include -#include -} -/** - * Timer management: - * - Create a struct osmo_gsm_timer_list - * - Fill out timeout and use add_gsm_timer or - * use schedule_gsm_timer to schedule a timer in - * x frames from now... - * - Use del_gsm_timer to remove the timer - * - * Internally: - * - We hook into select.c to give a frame number of the - * nearest timer. On already passed timers we give - * it a 0 to immediately fire after the select. - * - update_gsm_timers will call the callbacks and remove - * the timers. - * - */ -/*! \brief A structure representing a single instance of a gsm timer */ -struct osmo_gsm_timer_list { - struct rb_node node; /*!< \brief rb-tree node header */ - struct llist_head list; /*!< \brief internal list header */ - int fn; /*!< \brief expiration frame number */ - unsigned int active : 1; /*!< \brief is it active? */ - - void (*cb)(void*); /*!< \brief call-back called at timeout */ - void *data; /*!< \brief user data for callback */ -}; - -/** - * timer management - */ - -void osmo_gsm_timer_add(struct osmo_gsm_timer_list *timer); - -void osmo_gsm_timer_schedule(struct osmo_gsm_timer_list *timer, int fn); - -void osmo_gsm_timer_del(struct osmo_gsm_timer_list *timer); - -int osmo_gsm_timer_pending(struct osmo_gsm_timer_list *timer); - - -/* - * internal timer list management - */ -int *osmo_gsm_timers_nearest(void); -void osmo_gsm_timers_prepare(void); -int osmo_gsm_timers_update(void); -int osmo_gsm_timers_check(void); - -/*! }@ */ - -#endif // GSM_TIMER_H diff --git a/pcu_l1_if.cpp b/pcu_l1_if.cpp deleted file mode 100644 index b95c512a..00000000 --- a/pcu_l1_if.cpp +++ /dev/null @@ -1,213 +0,0 @@ -/* pcu_l1_if.cpp - * - * Copyright (C) 2012 Ivan Klyuchnikov - * - * 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. - */ - -#include -#include -#include -#include -#include - -#define MAX_UDP_LENGTH 1500 - -// TODO: We should take ports and IP from config. -UDPSocket pcu_gsmtap_socket(5077, "127.0.0.1", 4729); - -// Variable for storage current FN. -int frame_number; - -int get_current_fn() -{ - return frame_number; -} - -void set_current_fn(int fn) -{ - frame_number = fn; -} - -struct msgb *l1p_msgb_alloc(void) -{ - struct msgb *msg = msgb_alloc(sizeof(GsmL1_Prim_t), "l1_prim"); - - if (msg) - msg->l1h = msgb_put(msg, sizeof(GsmL1_Prim_t)); - - return msg; -} - -struct msgb *gen_dummy_msg(void) -{ - struct msgb *msg = l1p_msgb_alloc(); - GsmL1_Prim_t *prim = msgb_l1prim(msg); - // RLC/MAC filler with USF=1 - bitvec *filler = bitvec_alloc(23); - bitvec_unhex(filler, "41942b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b"); - prim->id = GsmL1_PrimId_PhDataReq; - prim->u.phDataReq.sapi = GsmL1_Sapi_Pacch; - bitvec_pack(filler, prim->u.phDataReq.msgUnitParam.u8Buffer); - prim->u.phDataReq.msgUnitParam.u8Size = filler->data_len; - bitvec_free(filler); - return msg; -} - -// Send RLC/MAC block to OpenBTS. -void pcu_l1if_tx(bitvec * block, GsmL1_Sapi_t sapi, int len) -{ - struct msgb *msg = l1p_msgb_alloc(); - struct osmo_wqueue * queue; - queue = &((l1fh->fl1h)->write_q); - GsmL1_Prim_t *prim = msgb_l1prim(msg); - - prim->id = GsmL1_PrimId_PhDataReq; - prim->u.phDataReq.sapi = sapi; - bitvec_pack(block, prim->u.phDataReq.msgUnitParam.u8Buffer); - prim->u.phDataReq.msgUnitParam.u8Size = len; - osmo_wqueue_enqueue(queue, msg); -} - -int pcu_l1if_rx_pdch(GsmL1_PhDataInd_t *data_ind) -{ - bitvec *block = bitvec_alloc(data_ind->msgUnitParam.u8Size); - bitvec_unpack(block, data_ind->msgUnitParam.u8Buffer); - gprs_rlcmac_rcv_block(block); - bitvec_free(block); -} - -static int handle_ph_connect_ind(struct femtol1_hdl *fl1, GsmL1_PhConnectInd_t *connect_ind) -{ - (l1fh->fl1h)->channel_info.arfcn = connect_ind->u16Arfcn; - (l1fh->fl1h)->channel_info.tn = connect_ind->u8Tn; - (l1fh->fl1h)->channel_info.tsc = connect_ind->u8Tsc; - LOGP(DL1IF, LOGL_NOTICE, "RX: [ PCU <- BTS ] PhConnectInd: ARFCN: %u TN: %u TSC: %u \n", - connect_ind->u16Arfcn, (unsigned)connect_ind->u8Tn, (unsigned)connect_ind->u8Tsc); -} - -static int handle_ph_readytosend_ind(struct femtol1_hdl *fl1, GsmL1_PhReadyToSendInd_t *readytosend_ind) -{ - struct msgb *resp_msg; - struct osmo_wqueue * queue; - queue = &((l1fh->fl1h)->write_q); - - set_current_fn(readytosend_ind->u32Fn); - resp_msg = msgb_dequeue(&queue->msg_queue); - if (!resp_msg) { - resp_msg = gen_dummy_msg(); - if (!resp_msg) - return 0; - } - osmo_wqueue_enqueue(&l1fh->udp_wq, resp_msg); - return 1; -} - -static int handle_ph_data_ind(struct femtol1_hdl *fl1, GsmL1_PhDataInd_t *data_ind) -{ - int rc = 0; - switch (data_ind->sapi) { - case GsmL1_Sapi_Rach: - break; - case GsmL1_Sapi_Pdtch: - case GsmL1_Sapi_Pacch: - pcu_l1if_rx_pdch(data_ind); - break; - case GsmL1_Sapi_Pbcch: - case GsmL1_Sapi_Pagch: - case GsmL1_Sapi_Ppch: - case GsmL1_Sapi_Pnch: - case GsmL1_Sapi_Ptcch: - case GsmL1_Sapi_Prach: - break; - default: - LOGP(DL1IF, LOGL_NOTICE, "Rx PH-DATA.ind for unknown L1 SAPI %u \n", data_ind->sapi); - break; - } - - return rc; -} - -static int handle_ph_ra_ind(struct femtol1_hdl *fl1, GsmL1_PhRaInd_t *ra_ind) -{ - int rc = 0; - (l1fh->fl1h)->channel_info.ta = ra_ind->measParam.i16BurstTiming; - rc = gprs_rlcmac_rcv_rach(ra_ind->msgUnitParam.u8Buffer[0], ra_ind->u32Fn, ra_ind->measParam.i16BurstTiming); - return rc; -} - -/* handle any random indication from the L1 */ -int pcu_l1if_handle_l1prim(struct femtol1_hdl *fl1, struct msgb *msg) -{ - GsmL1_Prim_t *l1p = msgb_l1prim(msg); - int rc = 0; - - switch (l1p->id) { - case GsmL1_PrimId_PhConnectInd: - rc = handle_ph_connect_ind(fl1, &l1p->u.phConnectInd); - break; - case GsmL1_PrimId_PhReadyToSendInd: - rc = handle_ph_readytosend_ind(fl1, &l1p->u.phReadyToSendInd); - break; - case GsmL1_PrimId_PhDataInd: - rc = handle_ph_data_ind(fl1, &l1p->u.phDataInd); - break; - case GsmL1_PrimId_PhRaInd: - rc = handle_ph_ra_ind(fl1, &l1p->u.phRaInd); - break; - default: - break; - } - - /* Special return value '1' means: do not free */ - if (rc != 1) - msgb_free(msg); - - return rc; -} - -void gsmtap_send_llc(uint8_t * data, unsigned len) -{ - char buffer[MAX_UDP_LENGTH]; - int ofs = 0; - - // Build header - struct gsmtap_hdr *header = (struct gsmtap_hdr *)buffer; - header->version = 2; - header->hdr_len = sizeof(struct gsmtap_hdr) >> 2; - header->type = 0x08; - header->timeslot = 5; - header->arfcn = 0; - header->signal_dbm = 0; - header->snr_db = 0; - header->frame_number = 0; - header->sub_type = 0; - header->antenna_nr = 0; - header->sub_slot = 0; - header->res = 0; - - ofs += sizeof(*header); - - // Add frame data - unsigned j = 0; - for (unsigned i = ofs; i < len+ofs; i++) - { - buffer[i] = (char)data[j]; - j++; - } - ofs += len; - // Write the GSMTAP packet - pcu_gsmtap_socket.write(buffer, ofs); -} diff --git a/pcu_l1_if.h b/pcu_l1_if.h deleted file mode 100644 index 60bc72bf..00000000 --- a/pcu_l1_if.h +++ /dev/null @@ -1,79 +0,0 @@ -/* pcu_l1_if.h - * - * Copyright (C) 2012 Ivan Klyuchnikov - * - * 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. - */ - -#ifndef PCU_L1_IF_H -#define PCU_L1_IF_H - - -#include -#include -#include -extern "C" { -#include -#include -#include -#include -} - -#define msgb_l1prim(msg) ((GsmL1_Prim_t *)(msg)->l1h) - -struct femtol1_hdl { - struct gsm_time gsm_time; - uint32_t hLayer1; /* handle to the L1 instance in the DSP */ - uint32_t dsp_trace_f; - uint16_t clk_cal; - struct llist_head wlc_list; - - void *priv; /* user reference */ - - struct osmo_timer_list alive_timer; - unsigned int alive_prim_cnt; - - struct osmo_fd read_ofd; /* osmo file descriptors */ - struct osmo_wqueue write_q; - - struct { - uint16_t arfcn; - uint8_t tn; - uint8_t tsc; - uint16_t ta; - } channel_info; - -}; - -struct l1fwd_hdl { - struct sockaddr_storage remote_sa; - socklen_t remote_sa_len; - - struct osmo_wqueue udp_wq; - - struct femtol1_hdl *fl1h; -}; - -extern struct l1fwd_hdl *l1fh; - -int get_current_fn(); - -void pcu_l1if_tx(bitvec * block, GsmL1_Sapi_t sapi, int len = 23); - -int pcu_l1if_handle_l1prim(struct femtol1_hdl *fl1h, struct msgb *msg); - -void gsmtap_send_llc(uint8_t * data, unsigned len); - -#endif // PCU_L1_IF_H diff --git a/pcu_main.cpp b/pcu_main.cpp deleted file mode 100644 index f26c6d86..00000000 --- a/pcu_main.cpp +++ /dev/null @@ -1,191 +0,0 @@ -/* pcu_main.cpp - * - * Copyright (C) 2012 Ivan Klyuchnikov - * - * 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. - */ - -#include -#include -#include -#include -#include - -// TODO: We should move this parameters to config file. -#define SGSN_IP "127.0.0.1" -#define SGSN_PORT 23000 -#define NSVCI 4 -#define PCU_L1_IF_PORT 5944 - -struct l1fwd_hdl *l1fh = talloc_zero(NULL, struct l1fwd_hdl); - -int sgsn_ns_cb(enum gprs_ns_evt event, struct gprs_nsvc *nsvc, struct msgb *msg, uint16_t bvci) -{ - int rc = 0; - switch (event) { - case GPRS_NS_EVT_UNIT_DATA: - /* hand the message into the BSSGP implementation */ - rc = gprs_bssgp_pcu_rcvmsg(msg); - break; - default: - LOGP(DPCU, LOGL_ERROR, "RLCMAC: Unknown event %u from NS\n", event); - if (msg) - talloc_free(msg); - rc = -EIO; - break; - } - return rc; -} - -/* data has arrived on the udp socket */ -static int udp_read_cb(struct osmo_fd *ofd) -{ - struct msgb *msg = msgb_alloc_headroom(2048, 128, "udp_rx"); - struct l1fwd_hdl *l1fh = (l1fwd_hdl *)ofd->data; - struct femtol1_hdl *fl1h = l1fh->fl1h; - int rc; - - if (!msg) - return -ENOMEM; - - msg->l1h = msg->data; - - l1fh->remote_sa_len = sizeof(l1fh->remote_sa); - rc = recvfrom(ofd->fd, msg->l1h, msgb_tailroom(msg), 0, - (struct sockaddr *) &l1fh->remote_sa, &l1fh->remote_sa_len); - if (rc < 0) { - perror("read from udp"); - msgb_free(msg); - return rc; - } else if (rc == 0) { - perror("len=0 read from udp"); - msgb_free(msg); - return rc; - } - msgb_put(msg, rc); - - rc = pcu_l1if_handle_l1prim(fl1h, msg); - return rc; -} - -/* callback when we can write to the UDP socket */ -static int udp_write_cb(struct osmo_fd *ofd, struct msgb *msg) -{ - int rc; - struct l1fwd_hdl *l1fh = (l1fwd_hdl *)ofd->data; - - //DEBUGP(DGPRS, "UDP: Writing %u bytes for MQ_L1_WRITE queue\n", msgb_l1len(msg)); - - rc = sendto(ofd->fd, msg->l1h, msgb_l1len(msg), 0, - (const struct sockaddr *)&l1fh->remote_sa, l1fh->remote_sa_len); - if (rc < 0) { - LOGP(DPCU, LOGL_ERROR, "error writing to L1 msg_queue: %s\n", - strerror(errno)); - return rc; - } else if (rc < msgb_l1len(msg)) { - LOGP(DPCU, LOGL_ERROR, "short write to L1 msg_queue: " - "%u < %u\n", rc, msgb_l1len(msg)); - return -EIO; - } - - return 0; -} - -int pcu_l1if_open() -{ - //struct l1fwd_hdl *l1fh; - struct femtol1_hdl *fl1h; - int rc; - - /* allocate new femtol1_handle */ - fl1h = talloc_zero(NULL, struct femtol1_hdl); - INIT_LLIST_HEAD(&fl1h->wlc_list); - - l1fh->fl1h = fl1h; - fl1h->priv = l1fh; - - struct osmo_wqueue * queue = &((l1fh->fl1h)->write_q); - osmo_wqueue_init(queue, 10); - queue->bfd.when |= BSC_FD_READ; - queue->bfd.data = l1fh; - queue->bfd.priv_nr = 0; - - /* Open UDP */ - struct osmo_wqueue *wq = &l1fh->udp_wq; - - osmo_wqueue_init(wq, 10); - wq->write_cb = udp_write_cb; - wq->read_cb = udp_read_cb; - wq->bfd.when |= BSC_FD_READ; - wq->bfd.data = l1fh; - wq->bfd.priv_nr = 0; - rc = osmo_sock_init_ofd(&wq->bfd, AF_UNSPEC, SOCK_DGRAM, - IPPROTO_UDP, NULL, PCU_L1_IF_PORT, - OSMO_SOCK_F_BIND); - if (rc < 0) { - perror("sock_init"); - exit(1); - } -} - -int main(int argc, char *argv[]) -{ - uint16_t nsvci = NSVCI; - struct gprs_ns_inst *sgsn_nsi; - struct gprs_nsvc *nsvc; - osmo_init_logging(&gprs_log_info); - pcu_l1if_open(); - - sgsn_nsi = gprs_ns_instantiate(&sgsn_ns_cb); - bssgp_nsi = sgsn_nsi; - - if (!bssgp_nsi) - { - LOGP(DPCU, LOGL_ERROR, "Unable to instantiate NS\n"); - exit(1); - } - bctx = btsctx_alloc(BVCI, NSEI); - bctx->cell_id = CELL_ID; - bctx->nsei = NSEI; - bctx->ra_id.mnc = MNC; - bctx->ra_id.mcc = MCC; - bctx->ra_id.lac = PCU_LAC; - bctx->ra_id.rac = PCU_RAC; - bctx->bvci = BVCI; - uint8_t cause = 39; - gprs_ns_nsip_listen(sgsn_nsi); - - struct sockaddr_in dest; - dest.sin_family = AF_INET; - dest.sin_port = htons(SGSN_PORT); - inet_aton(SGSN_IP, &dest.sin_addr); - - nsvc = nsip_connect(sgsn_nsi, &dest, NSEI, nsvci); - unsigned i = 0; - while (1) - { - osmo_gsm_timers_check(); - osmo_gsm_timers_prepare(); - osmo_gsm_timers_update(); - - osmo_select_main(0); - if (i == 7) - { - bssgp_tx_bvc_reset(bctx, BVCI, cause); - } - i++; - } -} - diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 00000000..d113b2fb --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,89 @@ +# +# Copyright 2008, 2009 Free Software Foundation, Inc. +# +# This software is distributed under the terms of the GNU Public License. +# See the COPYING file in the main directory for details. +# +# 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 3 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, see . +# + +include $(top_srcdir)/Makefile.common + +AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) +AM_CXXFLAGS = -Wall -ldl -pthread + +noinst_LTLIBRARIES = libgprs.la + +libgprs_la_SOURCES = \ + gprs_debug.cpp \ + csn1.cpp \ + gsm_rlcmac.cpp \ + gprs_bssgp_pcu.cpp \ + gprs_rlcmac.cpp \ + pcu_l1_if.cpp \ + gsm_timer.cpp \ + bitvector.cpp + +noinst_PROGRAMS = \ + RLCMACTest \ + pcu + +noinst_HEADERS = \ + gprs_debug.h \ + csn1.h \ + gsm_rlcmac.h \ + gprs_bssgp_pcu.h \ + gprs_rlcmac.h \ + pcu_l1_if.h \ + gsm_timer.h \ + bitvector.h + +OPENBSC_DIR = /home/ivan/work/openbsc/openbsc/openbsc +OPENGGSN_DIR = /home/ivan/work/openbsc/openggsn +OSMOCORE_DIR = /home/ivan/work/openbsc/libosmocore + +RLCMACTest_SOURCES = RLCMACTest.cpp +RLCMACTest_LDADD = \ + libgprs.la \ + -losmocore \ + $(COMMON_LA) + +pcu_SOURCES = pcu_main.cpp +pcu_LDADD = \ + libgprs.la \ + $(OPENBSC_DIR)/src/libgb/gprs_ns.o \ + $(OPENBSC_DIR)/src/libgb/gprs_bssgp.o \ + $(OPENBSC_DIR)/src/libgb/gprs_bssgp_bss.o \ + $(OPENBSC_DIR)/src/libgb/gprs_bssgp_util.o \ + $(OPENBSC_DIR)/src/libgb/gprs_ns_frgre.o \ + $(OPENGGSN_DIR)/gtp/queue.o \ + $(OPENGGSN_DIR)/gtp/lookupa.o \ + $(OPENGGSN_DIR)/gtp/pdp.o \ + $(OPENGGSN_DIR)/gtp/gtpie.o \ + $(OPENGGSN_DIR)/gtp/gtp.o \ + $(OPENBSC_DIR)/src/gprs/sgsn_libgtp.o \ + $(OPENBSC_DIR)/src/gprs/gprs_sndcp.o \ + $(OPENBSC_DIR)/src/gprs/crc24.o \ + $(OPENBSC_DIR)/src/gprs/gprs_llc.o \ + $(OPENBSC_DIR)/src/gprs/gprs_gmm.o \ + $(OPENBSC_DIR)/src/gprs/gprs_sgsn.o \ + $(OPENBSC_DIR)/src/libcommon/socket.o \ + $(OPENBSC_DIR)/src/libcommon/debug.o \ + $(OSMOCORE_DIR)/src/bitvec.o \ + $(OSMOCORE_DIR)/src/talloc.o \ + -losmocore \ + -losmogsm \ + $(COMMON_LA) + +#MOSTLYCLEANFILES += testSource testDestination diff --git a/src/RLCMACTest.cpp b/src/RLCMACTest.cpp new file mode 100644 index 00000000..2b819b75 --- /dev/null +++ b/src/RLCMACTest.cpp @@ -0,0 +1,205 @@ +/* RLCMACTest.cpp + * + * Copyright (C) 2011 Ivan Klyuchnikov + * + * 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. + */ + + + +//#include +#include +#include +#include +#include "csn1.h" +#include "gsm_rlcmac.h" +using namespace std; + +void printSizeofRLCMAC() +{ + cout << "sizeof RlcMacUplink_t " << sizeof(RlcMacUplink_t) << endl; + cout << "sizeof Packet_Cell_Change_Failure_t " << sizeof(Packet_Cell_Change_Failure_t) << endl; + cout << "sizeof Packet_Control_Acknowledgement_t " << sizeof(Packet_Control_Acknowledgement_t) << endl; + cout << "sizeof Packet_Downlink_Ack_Nack_t " << sizeof(Packet_Downlink_Ack_Nack_t) << endl; + cout << "sizeof EGPRS_PD_AckNack_t " << sizeof(EGPRS_PD_AckNack_t) << endl; + cout << "sizeof Packet_Uplink_Dummy_Control_Block_t " << sizeof(Packet_Uplink_Dummy_Control_Block_t) << endl; + cout << "sizeof Packet_Measurement_Report_t " << sizeof(Packet_Measurement_Report_t) << endl; + cout << "sizeof Packet_Resource_Request_t " << sizeof(Packet_Resource_Request_t) << endl; + cout << "sizeof Packet_Mobile_TBF_Status_t " << sizeof(Packet_Mobile_TBF_Status_t) << endl; + cout << "sizeof Packet_PSI_Status_t " << sizeof(Packet_PSI_Status_t) << endl; + cout << "sizeof Packet_Enh_Measurement_Report_t " << sizeof(Packet_Enh_Measurement_Report_t) << endl; + cout << "sizeof Packet_Cell_Change_Notification_t " << sizeof(Packet_Cell_Change_Notification_t) << endl; + cout << "sizeof Packet_SI_Status_t " << sizeof(Packet_SI_Status_t) << endl; + cout << "sizeof Additional_MS_Rad_Access_Cap_t " << sizeof(Additional_MS_Rad_Access_Cap_t) << endl; + cout << "sizeof Packet_Pause_t " << sizeof(Packet_Pause_t) << endl; + + cout << "sizeof RlcMacDownlink_t " << sizeof(RlcMacDownlink_t) << endl; + cout << "sizeof Packet_Access_Reject_t " << sizeof(Packet_Access_Reject_t) << endl; + cout << "sizeof Packet_Cell_Change_Order_t " << sizeof(Packet_Cell_Change_Order_t) << endl; + cout << "sizeof Packet_Downlink_Assignment_t " << sizeof(Packet_Downlink_Assignment_t) << endl; + cout << "sizeof Packet_Measurement_Order_Reduced_t " << sizeof(Packet_Measurement_Order_Reduced_t) << endl; + cout << "sizeof Packet_Neighbour_Cell_Data_t " << sizeof(Packet_Neighbour_Cell_Data_t) << endl; + cout << "sizeof Packet_Serving_Cell_Data_t " << sizeof(Packet_Serving_Cell_Data_t) << endl; + cout << "sizeof Packet_Paging_Request_t " << sizeof(Packet_Paging_Request_t) << endl; + cout << "sizeof Packet_PDCH_Release_t " << sizeof(Packet_PDCH_Release_t) << endl; + cout << "sizeof Packet_Polling_Request_t " << sizeof(Packet_Polling_Request_t) << endl; + cout << "sizeof Packet_Power_Control_Timing_Advance_t " << sizeof(Packet_Power_Control_Timing_Advance_t) << endl; + cout << "sizeof Packet_PRACH_Parameters_t " << sizeof(Packet_PRACH_Parameters_t) << endl; + cout << "sizeof Packet_Queueing_Notification_t " << sizeof(Packet_Queueing_Notification_t) << endl; + cout << "sizeof Packet_Timeslot_Reconfigure_t " << sizeof(Packet_Timeslot_Reconfigure_t) << endl; + cout << "sizeof Packet_TBF_Release_t " << sizeof(Packet_TBF_Release_t) << endl; + cout << "sizeof Packet_Uplink_Ack_Nack_t " << sizeof(Packet_Uplink_Ack_Nack_t) << endl; + cout << "sizeof Packet_Uplink_Assignment_t " << sizeof(Packet_Uplink_Assignment_t) << endl; + cout << "sizeof Packet_Cell_Change_Continue_t " << sizeof(Packet_Cell_Change_Continue_t) << endl; + cout << "sizeof Packet_Handover_Command_t " << sizeof(Packet_Handover_Command_t) << endl; + cout << "sizeof Packet_PhysicalInformation_t " << sizeof(Packet_PhysicalInformation_t) << endl; + cout << "sizeof Packet_Downlink_Dummy_Control_Block_t " << sizeof(Packet_Downlink_Dummy_Control_Block_t) << endl; + cout << "sizeof PSI1_t " << sizeof(PSI1_t) << endl; + cout << "sizeof PSI2_t " << sizeof(PSI2_t) << endl; + cout << "sizeof PSI3_t " << sizeof(PSI3_t) << endl; + cout << "sizeof PSI3_BIS_t " << sizeof(PSI3_BIS_t) << endl; + cout << "sizeof PSI4_t " << sizeof(PSI4_t) << endl; + cout << "sizeof PSI13_t " << sizeof(PSI13_t) << endl; + cout << "sizeof PSI5_t " << sizeof(PSI5_t) << endl; +} + +void testRlcMacDownlink() +{ + struct bitvec *resultVector = bitvec_alloc(23); + bitvec_unhex(resultVector, "2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b"); + + std::string testData[] = { + "4e082500e3f1a81d080820800b2b2b2b2b2b2b2b2b2b2b", // Packet Downlink Assignment + "48282407a6a074227201000b2b2b2b2b2b2b2b2b2b2b2b", // Packet Uplink Assignment + "47240c00400000000000000079eb2ac9402b2b2b2b2b2b", // Packet Uplink Ack Nack + "47283c367513ba333004242b2b2b2b2b2b2b2b2b2b2b2b" // Packet Uplink Assignment + "4913e00850884013a8048b2b2b2b2b2b2b2b2b2b2b2b2b" + "412430007fffffffffffffffefd19c7ba12b2b2b2b2b2b" + "41942b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b" + }; + + int testDataSize = sizeof(testData)/sizeof(testData[0]); + + cout << " DOWNLINK " << endl; + for (int i = 0; i < testDataSize; i++) + { + bitvec *vector = bitvec_alloc(23); + bitvec_unhex(vector, testData[i].c_str()); + cout << "vector1 = "; + for (int i = 0; i < 23; i++) + { + cout << hex << (unsigned)*(vector->data + i); + } + cout << endl; + RlcMacDownlink_t * data = (RlcMacDownlink_t *)malloc(sizeof(RlcMacDownlink_t)); + cout << "=========Start DECODE===========" << endl; + decode_gsm_rlcmac_downlink(vector, data); + cout << "+++++++++Finish DECODE++++++++++" << endl; + cout << "=========Start ENCODE=============" << endl; + encode_gsm_rlcmac_downlink(resultVector, data); + cout << "+++++++++Finish ENCODE+++++++++++" << endl; + cout << "vector1 = "; + for (int i = 0; i < 23; i++) + { + cout << (unsigned)*(vector->data + i); + } + cout << endl; + cout << "vector2 = "; + for (int i = 0; i < 23; i++) + { + cout << (unsigned)*(resultVector->data + i); + } + cout << endl; + if (memcmp(vector->data, resultVector->data, 23) == 0) + { + cout << "vector1 == vector2 : TRUE" << endl; + } + else + { + cout << "vector1 == vector2 : FALSE" << endl; + } + bitvec_unhex(resultVector, "2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b"); + bitvec_free(vector); + free(data); + } +} + + +void testRlcMacUplink() +{ + struct bitvec *resultVector = bitvec_alloc(23); + bitvec_unhex(resultVector, "2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b"); + + std::string testData[] = { + "400e1e61d11f2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b", // Packet Uplink Dummy Control Block + "400b8020000000000000002480e00b2b2b2b2b2b2b2b2b", // Packet Downlink Ack/Nack + "4016713dc094270ca2ae57ef909006aa0fc0001f80222b" // Packet Resource Request + "400a9020000000000000003010012a0800132b2b2b2b2b" + }; + + int testDataSize = sizeof(testData)/sizeof(testData[0]); + + + cout << " UPLINK " << endl; + for (int i = 0; i < testDataSize; i++) + { + bitvec *vector = bitvec_alloc(23); + bitvec_unhex(vector, testData[i].c_str()); + cout << "vector1 = "; + for (int i = 0; i < 23; i++) + { + cout << hex << (unsigned)*(vector->data + i); + } + cout << endl; + RlcMacUplink_t * data = (RlcMacUplink_t *)malloc(sizeof(RlcMacUplink_t)); + cout << "=========Start DECODE===========" << endl; + decode_gsm_rlcmac_uplink(vector, data); + cout << "+++++++++Finish DECODE++++++++++" << endl; + cout << "=========Start ENCODE=============" << endl; + encode_gsm_rlcmac_uplink(resultVector, data); + cout << "+++++++++Finish ENCODE+++++++++++" << endl; + cout << "vector1 = "; + for (int i = 0; i < 23; i++) + { + cout << (unsigned)*(vector->data + i); + } + cout << endl; + cout << "vector2 = "; + for (int i = 0; i < 23; i++) + { + cout << (unsigned)*(resultVector->data + i); + } + cout << endl; + if (memcmp(vector->data, resultVector->data, 23) == 0) + { + cout << "vector1 == vector2 : TRUE" << endl; + } + else + { + cout << "vector1 == vector2 : FALSE" << endl; + } + bitvec_unhex(resultVector, "2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b"); + bitvec_free(vector); + free(data); + } +} + +int main(int argc, char *argv[]) +{ + //printSizeofRLCMAC(); + testRlcMacDownlink(); + testRlcMacUplink(); + +} diff --git a/src/bitvector.cpp b/src/bitvector.cpp new file mode 100644 index 00000000..36ef7988 --- /dev/null +++ b/src/bitvector.cpp @@ -0,0 +1,118 @@ +/* bitvector.cpp + * + * Copyright (C) 2012 Ivan Klyuchnikov + * + * 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. + */ + +/*! \addtogroup bitvector + * @{ + */ + +/*! \file bitvector.cpp + * \brief Additional functions for Osmocom bit vector abstraction. + */ + +#include +extern "C" { +#include +} + +void *bv_tall_ctx; + +struct bitvec *bitvec_alloc(unsigned size) +{ + struct bitvec *bv = talloc_zero(bv_tall_ctx, struct bitvec); + bv->data_len = size; + bv->cur_bit = 0; + bv->data = talloc_zero_array(bv_tall_ctx, uint8_t, size); + return bv; +} + +void bitvec_free(struct bitvec *bv) +{ + talloc_free(bv->data); + talloc_free(bv); +} + +int bitvec_pack(struct bitvec *bv, uint8_t *buffer) +{ + int i = 0; + for (i = 0; i < bv->data_len; i++) + { + buffer[i] = bv->data[i]; + } + return i; +} + +int bitvec_unpack(struct bitvec *bv, uint8_t *buffer) +{ + int i = 0; + for (i = 0; i < bv->data_len; i++) + { + bv->data[i] = buffer[i]; + } + return i; +} + + +int bitvec_unhex(struct bitvec *bv, const char* src) +{ + unsigned val; + unsigned write_index = 0; + unsigned digits = bv->data_len*2; + for (unsigned i=0; icur_bit = read_index; + + for (i = 0; i < len; i++) { + int bit = bitvec_get_bit_pos((const struct bitvec *)bv, bv->cur_bit); + if (bit < 0) + return bit; + if (bit) + ui |= ((uint64_t)1 << (len - i - 1)); + bv->cur_bit++; + } + read_index += len; + return ui; +} + + +int bitvec_write_field(struct bitvec *bv, unsigned& write_index, uint64_t val, unsigned len) +{ + int i, rc; + bv->cur_bit = write_index; + for (i = 0; i < len; i++) { + int bit = 0; + if (val & ((uint64_t)1 << (len - i - 1))) + bit = 1; + rc = bitvec_set_bit(bv, (bit_value)bit); + if (rc) + return rc; + } + write_index += len; + return 0; +} diff --git a/src/bitvector.h b/src/bitvector.h new file mode 100644 index 00000000..7409d551 --- /dev/null +++ b/src/bitvector.h @@ -0,0 +1,45 @@ +/* bitvector.h + * + * Copyright (C) 2012 Ivan Klyuchnikov + * + * 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. + */ + +#ifndef BITVECTOR_H +#define BITVECTOR_H + +/*! \defgroup bitvector Bit vectors + * @{ + */ + +/*! \file bitvector.h + * \brief Additional functions for Osmocom bit vector abstraction. + */ + +extern "C" { +#include +} + +struct bitvec *bitvec_alloc(unsigned size); +void bitvec_free(struct bitvec *bv); +int bitvec_unhex(struct bitvec *bv, const char* src); +int bitvec_pack(struct bitvec *bv, uint8_t *buffer); +int bitvec_unpack(struct bitvec *bv, uint8_t *buffer); +uint64_t bitvec_read_field(struct bitvec *bv, unsigned& read_index, unsigned len); +int bitvec_write_field(struct bitvec *bv, unsigned& write_index, uint64_t val, unsigned len); + +/*! }@ */ + +#endif // BITVECTOR_H diff --git a/src/csn1.cpp b/src/csn1.cpp new file mode 100644 index 00000000..e30eb353 --- /dev/null +++ b/src/csn1.cpp @@ -0,0 +1,2603 @@ +/* csn1.cpp + * Routines for CSN1 dissection in wireshark. + * + * Copyright (C) 2011 Ivan Klyuchnikov + * + * By Vincent Helfre, based on original code by Jari Sassi + * with the gracious authorization of STE + * Copyright (c) 2011 ST-Ericsson + * + * $Id: packet-csn1.c 39140 2011-09-25 22:01:50Z wmeier $ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs + * 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. + */ + +#include +#include +#include +#include +#include "csn1.h" +#include + + +#define pvDATA(_pv, _offset) ((void*) ((unsigned char*)_pv + _offset)) +#define pui8DATA(_pv, _offset) ((guint8*) pvDATA(_pv, _offset)) +#define pui16DATA(_pv, _offset) ((guint16*) pvDATA(_pv, _offset)) +#define pui32DATA(_pv, _offset) ((guint32*) pvDATA(_pv, _offset)) +#define pui64DATA(_pv, _offset) ((guint64*) pvDATA(_pv, _offset)) +/* used to tag existence of next element in variable length lists */ +#define STANDARD_TAG 1 +#define REVERSED_TAG 0 + +using namespace std; +static const unsigned char ixBitsTab[] = {0, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5}; + + +/* Returns no_of_bits (up to 8) masked with 0x2B */ + +static guint8 +get_masked_bits8( bitvec *vector, size_t& readIndex, gint bit_offset, const gint no_of_bits) +{ + static const guint8 maskBits[] = {0x00, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF}; + //gint byte_offset = bit_offset >> 3; /* divide by 8 */ + gint relative_bit_offset = bit_offset & 0x07; /* modulo 8 */ + guint8 result; + gint bit_shift = 8 - relative_bit_offset - (gint) no_of_bits; + readIndex -= relative_bit_offset; + if (bit_shift >= 0) + { + result = (0x2B ^ ((guint8)bitvec_read_field(vector, readIndex, 8))) >> bit_shift; + readIndex-= bit_shift; + result &= maskBits[no_of_bits]; + } + else + { + guint8 hight_part = (0x2B ^ ((guint8)bitvec_read_field(vector, readIndex, 8))) & maskBits[8 - relative_bit_offset]; + hight_part = (guint8) (hight_part << (-bit_shift)); + result = (0x2B ^ ((guint8)bitvec_read_field(vector, readIndex, 8))) >> (8 + bit_shift); + readIndex = readIndex - (8 - (-bit_shift)); + result |= hight_part; + } + return result; +} + +/** + * ================================================================================================ + * set initial/start values in help data structure used for packing/unpacking operation + * ================================================================================================ + */ +void +csnStreamInit(csnStream_t* ar, gint bit_offset, gint remaining_bits_len) +{ + ar->remaining_bits_len = remaining_bits_len; + ar->bit_offset = bit_offset; +} + +static const char* ErrCodes[] = +{ + "General 0", + "General -1", + "DATA_NOT VALID", + "IN SCRIPT", + "INVALID UNION INDEX", + "NEED_MORE BITS TO UNPACK", + "ILLEGAL BIT VALUE", + "Internal", + "STREAM_NOT_SUPPORTED", + "MESSAGE_TOO_LONG" +}; + +static gint16 +ProcessError( size_t readIndex, const char* sz, gint16 err, const CSN_DESCR* pDescr) +{ + gint16 i = MIN(-err, ((gint16) ElementsOf(ErrCodes)-1)); + if (i >= 0) + { + //LOG(ERR) << sz << "Error code: "<< ErrCodes[i] << pDescr?(pDescr->sz):"-"; + } + else + { + //LOG(ERR) << sz << ": " << pDescr?(pDescr->sz):"-"; + } + return err; +} + +//#if 0 +static const char* CSN_DESCR_type[]= +{ + "CSN_END", + "CSN_BIT", + "CSN_UINT", + "CSN_TYPE", + "CSN_CHOICE", + "CSN_UNION", + "CSN_UNION_LH", + "CSN_UINT_ARRAY", + "CSN_TYPE_ARRAY", + "CSN_BITMAP", + "CSN_VARIABLE_BITMAP", + "CSN_VARIABLE_BITMAP_1", + "CSN_LEFT_ALIGNED_VAR_BMP", + "CSN_LEFT_ALIGNED_VAR_BMP_1", + "CSN_VARIABLE_ARRAY", + "CSN_VARIABLE_TARRAY", + "CSN_VARIABLE_TARRAY_OFFSET", + "CSN_RECURSIVE_ARRAY", + "CSN_RECURSIVE_TARRAY", + "CSN_RECURSIVE_TARRAY_1", + "CSN_RECURSIVE_TARRAY_2", + "CSN_EXIST", + "CSN_EXIST_LH", + "CSN_NEXT_EXIST", + "CSN_NEXT_EXIST_LH", + "CSN_NULL", + "CSN_FIXED", + "CSN_CALLBACK", + "CSN_UINT_OFFSET", + "CSN_UINT_LH", + "CSN_SERIALIZE", + "CSN_TRAP_ERROR" + "CSN_???" +}; +//#endif + +/** + * ================================================================================================ + * Return TRUE if tag in bit stream indicates existence of next list element, + * otherwise return FALSE. + * Will work for tag values equal to both 0 and 1. + * ================================================================================================ + */ + +static gboolean +existNextElement(bitvec *vector, size_t& readIndex, guint8 Tag) +{ + guint8 res = bitvec_read_field(vector, readIndex, 1); + if (Tag == STANDARD_TAG) + { + return (res > 0); + } + return (res == 0); +} + + +gint16 +csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector, size_t& readIndex, void* data) +{ + gint remaining_bits_len = ar->remaining_bits_len; + gint bit_offset = ar->bit_offset; + guint8* pui8; + guint16* pui16; + guint32* pui32; + guint64* pui64; + guint8 Tag = STANDARD_TAG; + + if (remaining_bits_len <= 0) + { + return 0; + } + + do + { + switch (pDescr->type) + { + case CSN_BIT: + { + if (remaining_bits_len > 0) + { + pui8 = pui8DATA(data, pDescr->offset); + *pui8 = bitvec_read_field(vector, readIndex, 1); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + /* end add the bit value to protocol tree */ + } + else + { + return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + + pDescr++; + remaining_bits_len--; + bit_offset++; + break; + } + + case CSN_NULL: + { /* Empty member! */ + pDescr++; + break; + } + + case CSN_UINT: + { + guint8 no_of_bits = (guint8) pDescr->i; + + if (remaining_bits_len >= no_of_bits) + { + if (no_of_bits <= 8) + { + guint8 ui8 = bitvec_read_field(vector, readIndex, no_of_bits); + pui8 = pui8DATA(data, pDescr->offset); + *pui8 = ui8; + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + } + else if (no_of_bits <= 16) + { + guint16 ui16 = bitvec_read_field(vector, readIndex, no_of_bits); + pui16 = pui16DATA(data, pDescr->offset); + *pui16 = ui16; + LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui16); + } + else if (no_of_bits <= 32) + { + guint32 ui32 = bitvec_read_field(vector, readIndex, no_of_bits); + pui32 = pui32DATA(data, pDescr->offset); + *pui32 = ui32; + LOGPC(DCSN1, LOGL_NOTICE, "%s = 0x%08x | ", pDescr->sz , *pui32); + } + else + { + return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_GENERAL, pDescr); + } + } + else + { + return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + + remaining_bits_len -= no_of_bits; + bit_offset += no_of_bits; + pDescr++; + break; + } + + case CSN_UINT_OFFSET: + { + guint8 no_of_bits = (guint8) pDescr->i; + + if (remaining_bits_len >= no_of_bits) + { + if (no_of_bits <= 8) + { + guint8 ui8 = bitvec_read_field(vector, readIndex, no_of_bits); + pui8 = pui8DATA(data, pDescr->offset); + *pui8 = ui8 + (guint8)pDescr->descr.value; + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + } + else if (no_of_bits <= 16) + { + guint16 ui16 = bitvec_read_field(vector, readIndex, no_of_bits); + pui16 = pui16DATA(data, pDescr->offset); + *pui16 = ui16 + (guint16)pDescr->descr.value; + LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui16); + } + else if (no_of_bits <= 32) + { + guint32 ui32 = bitvec_read_field(vector, readIndex, no_of_bits); + pui32 = pui32DATA(data, pDescr->offset); + *pui32 = ui32 + (guint16)pDescr->descr.value; + LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui32); + } + else + { + return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_GENERAL, pDescr); + } + } + else + { + return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + + remaining_bits_len -= no_of_bits; + bit_offset += no_of_bits; + pDescr++; + break; + } + + case CSN_UINT_LH: + { + guint8 no_of_bits = (guint8) pDescr->i; + + if (remaining_bits_len >= no_of_bits) + { + remaining_bits_len -= no_of_bits; + if (no_of_bits <= 8) + { + guint8 ui8 = get_masked_bits8(vector, readIndex, bit_offset, no_of_bits); + pui8 = pui8DATA(data, pDescr->offset); + *pui8 = ui8; + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + } + else + {/* Maybe we should support more than 8 bits ? */ + return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_GENERAL, pDescr); + } + } + else + { + return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + + remaining_bits_len -= no_of_bits; + bit_offset += no_of_bits; + pDescr++; + break; + } + + case CSN_UINT_ARRAY: + { + guint8 no_of_bits = (guint8) pDescr->i; + guint16 nCount = (guint16)pDescr->descr.value; /* nCount supplied by value i.e. M_UINT_ARRAY(...) */ + + if (pDescr->serialize.value != 0) + { /* nCount specified by a reference to field holding value i.e. M_VAR_UINT_ARRAY(...) */ + nCount = *pui16DATA(data, nCount); + } + + if (remaining_bits_len >= no_of_bits) + { + remaining_bits_len -= (no_of_bits*nCount); + if (no_of_bits <= 8) + { + pui8 = pui8DATA(data, pDescr->offset); + do + { + *pui8 = bitvec_read_field(vector, readIndex, no_of_bits); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + pui8++; + bit_offset += no_of_bits; + } while (--nCount > 0); + } + else if (no_of_bits <= 16) + { + return ProcessError(readIndex,"csnStreamDecoder NOTIMPLEMENTED", 999, pDescr); + } + else if (no_of_bits <= 32) + { + return ProcessError(readIndex,"csnStreamDecoder NOTIMPLEMENTED", 999, pDescr); + } + else + { + return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_GENERAL, pDescr); + } + } + else + { + return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + pDescr++; + break; + } + + case CSN_VARIABLE_TARRAY_OFFSET: + case CSN_VARIABLE_TARRAY: + case CSN_TYPE_ARRAY: + { + gint16 Status; + csnStream_t arT = *ar; + gint16 nCount = pDescr->i; + guint16 nSize = (guint16)(gint32)pDescr->serialize.value; + + pui8 = pui8DATA(data, pDescr->offset); + if (pDescr->type == CSN_VARIABLE_TARRAY) + { /* Count specified in field */ + nCount = *pui8DATA(data, pDescr->i); + } + else if (pDescr->type == CSN_VARIABLE_TARRAY_OFFSET) + { /* Count specified in field */ + nCount = *pui8DATA(data, pDescr->i); + /* nCount--; the 1 offset is already taken into account in CSN_UINT_OFFSET */ + } + + while (nCount > 0) + { /* resulting array of length 0 is possible + * but no bits shall be read from bitstream + */ + + LOGPC(DCSN1, LOGL_NOTICE, "%s | ", pDescr->sz); + csnStreamInit(&arT, bit_offset, remaining_bits_len); + Status = csnStreamDecoder(&arT, (const CSN_DESCR*)pDescr->descr.ptr, vector, readIndex, pui8); + if (Status >= 0) + { + pui8 += nSize; + remaining_bits_len = arT.remaining_bits_len; + bit_offset = arT.bit_offset; + } + else + { + return Status; + } + nCount--; + } + + pDescr++; + break; + } + + case CSN_BITMAP: + { /* bitmap with given length. The result is left aligned! */ + guint8 no_of_bits = (guint8) pDescr->i; /* length of bitmap */ + + if (no_of_bits > 0) + { + + if (no_of_bits <= 32) + { + for(unsigned ib = 0; ib < 4; ib++) + { + guint8 ui8 = bitvec_read_field(vector, readIndex, 8); + pui8 = pui8DATA(data, pDescr->offset+ib); + *pui8 = ui8; + LOGPC(DCSN1, LOGL_NOTICE, "%s[%u] = %u | ", pDescr->sz , ib, (unsigned)*pui8); + } + } + else if (no_of_bits <= 64) + { + for(unsigned ib = 0; ib < 8; ib++) + { + guint8 ui8 = bitvec_read_field(vector, readIndex, 8); + pui8 = pui8DATA(data, pDescr->offset+ib); + *pui8 = ui8; + LOGPC(DCSN1, LOGL_NOTICE, "%s[%u] = %u | ", pDescr->sz , ib, (unsigned)*pui8); + } + } + else + { + return ProcessError(readIndex,"csnStreamDecoder NOT IMPLEMENTED", 999, pDescr); + } + + remaining_bits_len -= no_of_bits; + assert(remaining_bits_len >= 0); + bit_offset += no_of_bits; + } + /* bitmap was successfully extracted or it was empty */ + + pDescr++; + break; + } + + case CSN_TYPE: + { + gint16 Status; + csnStream_t arT = *ar; + LOGPC(DCSN1, LOGL_NOTICE, " : %s | ", pDescr->sz); + csnStreamInit(&arT, bit_offset, remaining_bits_len); + Status = csnStreamDecoder(&arT, (const CSN_DESCR*)pDescr->descr.ptr, vector, readIndex, pvDATA(data, pDescr->offset)); + LOGPC(DCSN1, LOGL_NOTICE, ": End %s | ", pDescr->sz); + if (Status >= 0) + { + remaining_bits_len = arT.remaining_bits_len; + bit_offset = arT.bit_offset; + pDescr++; + } + else + { + /* Has already been processed: ProcessError("csnStreamDecoder", Status, pDescr); */ + return Status; + } + + break; + } + + case CSN_CHOICE: + { + gint16 count = pDescr->i; + guint8 i = 0; + CSN_ChoiceElement_t* pChoice = (CSN_ChoiceElement_t*) pDescr->descr.ptr; + + while (count > 0) + { + guint8 no_of_bits = pChoice->bits; + guint8 value = bitvec_read_field(vector, readIndex, no_of_bits); + if (value == pChoice->value) + { + CSN_DESCR descr[2]; + gint16 Status; + csnStream_t arT = *ar; + + descr[0] = pChoice->descr; + memset(&descr[1], 0x00, sizeof(CSN_DESCR)); + descr[1].type = CSN_END; + pui8 = pui8DATA(data, pDescr->offset); + *pui8 = i; + LOGPC(DCSN1, LOGL_NOTICE, "Choice %s = %u | ", pDescr->sz , (unsigned)value); + bit_offset += no_of_bits; + remaining_bits_len -= no_of_bits; + + csnStreamInit(&arT, bit_offset, remaining_bits_len); + Status = csnStreamDecoder(&arT, descr, vector, readIndex, data); + + if (Status >= 0) + { + remaining_bits_len = arT.remaining_bits_len; + bit_offset = arT.bit_offset; + } + else + { + return Status; + } + break; + } + + readIndex -= no_of_bits; + count--; + pChoice++; + i++; + } + + pDescr++; + break; + } + + case CSN_SERIALIZE: + { + StreamSerializeFcn_t serialize = pDescr->serialize.fcn; + csnStream_t arT = *ar; + gint16 Status = -1; + + LOGPC(DCSN1, LOGL_NOTICE, "%s length = %d | ", pDescr->sz , (int)bitvec_read_field(vector, readIndex, 7)); + arT.direction = 1; + bit_offset += 7; + remaining_bits_len -= 7; + + csnStreamInit(&arT, bit_offset, remaining_bits_len); + Status = serialize(&arT, vector, readIndex, pvDATA(data, pDescr->offset)); + + if (Status >= 0) + { + remaining_bits_len = arT.remaining_bits_len; + bit_offset = arT.bit_offset; + pDescr++; + } + else + { + /* Has already been processed: */ + return Status; + } + + break; + } + + case CSN_UNION_LH: + case CSN_UNION: + { + gint16 Bits; + guint8 index; + gint16 count = pDescr->i; + const CSN_DESCR* pDescrNext = pDescr; + + pDescrNext += count + 1; /* now this is next after the union */ + if ((count <= 0) || (count > 16)) + { + return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_INVALID_UNION_INDEX, pDescr); + } + + /* Now get the bits to extract the index */ + Bits = ixBitsTab[count]; + index = 0; + + while (Bits > 0) + { + index <<= 1; + + if (CSN_UNION_LH == pDescr->type) + { + index |= get_masked_bits8(vector,readIndex, bit_offset, 1); + } + else + { + index |= bitvec_read_field(vector, readIndex, 1); + } + remaining_bits_len--; + bit_offset++; + Bits--; + } + + /* Assign UnionType */ + pui8 = pui8DATA(data, pDescr->offset); + *pui8 = index; + + + /* script index to continue on, limited in case we do not have a power of 2 */ + pDescr += (MIN(index + 1, count)); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + + switch (pDescr->type) + { /* get the right element of the union based on computed index */ + + case CSN_BIT: + { + pui8 = pui8DATA(data, pDescr->offset); + *pui8 = 0x00; + if (bitvec_read_field(vector, readIndex, 1) > 0) + { + *pui8 = 0x01; + } + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + remaining_bits_len -= 1; + bit_offset++; + pDescr++; + break; + } + + case CSN_NULL: + { /* Empty member! */ + pDescr++; + break; + } + + case CSN_UINT: + { + guint8 no_of_bits = (guint8) pDescr->i; + if (remaining_bits_len >= no_of_bits) + { + remaining_bits_len -= no_of_bits; + + if (no_of_bits <= 8) + { + guint8 ui8 = bitvec_read_field(vector, readIndex, no_of_bits); + pui8 = pui8DATA(data, pDescr->offset); + *pui8 = ui8; + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + } + else if (no_of_bits <= 16) + { + guint16 ui16 = bitvec_read_field(vector, readIndex, no_of_bits); + pui16 = pui16DATA(data, pDescr->offset); + *pui16 = ui16; + LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui16); + } + else if (no_of_bits <= 32) + { + guint32 ui32 = bitvec_read_field(vector, readIndex, no_of_bits); + pui32 = pui32DATA(data, pDescr->offset); + *pui32 = ui32; + LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui32); + } + else + { + return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_GENERAL, pDescr); + } + } + else + { + return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_GENERAL, pDescr); + } + + bit_offset += no_of_bits; + pDescr++; + break; + } + + case CSN_UINT_OFFSET: + { + guint8 no_of_bits = (guint8) pDescr->i; + + if (remaining_bits_len >= no_of_bits) + { + if (no_of_bits <= 8) + { + guint8 ui8 = bitvec_read_field(vector, readIndex, no_of_bits); + pui8 = pui8DATA(data, pDescr->offset); + *pui8 = ui8 + (guint8)pDescr->descr.value; + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + } + else if (no_of_bits <= 16) + { + guint16 ui16 = bitvec_read_field(vector, readIndex, no_of_bits); + pui16 = pui16DATA(data, pDescr->offset); + *pui16 = ui16 + (guint16)pDescr->descr.value; + LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui16); + } + else if (no_of_bits <= 32) + { + guint32 ui32 = bitvec_read_field(vector, readIndex, no_of_bits); + pui32 = pui32DATA(data, pDescr->offset); + *pui32 = ui32 + (guint16)pDescr->descr.value; + LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui32); + } + else + { + return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_GENERAL, pDescr); + } + } + else + { + return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + + bit_offset += no_of_bits; + pDescr++; + break; + } + + case CSN_UINT_LH: + { + guint8 no_of_bits = (guint8) pDescr->i; + + if (remaining_bits_len >= no_of_bits) + { + if (no_of_bits <= 8) + { + guint8 ui8 = get_masked_bits8(vector, readIndex, bit_offset, no_of_bits); + pui8 = pui8DATA(data, pDescr->offset); + *pui8 = ui8; + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + } + else + { /* Maybe we should support more than 8 bits ? */ + return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_GENERAL, pDescr); + } + } + else + { + return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + + bit_offset += no_of_bits; + pDescr++; + break; + } + + case CSN_UINT_ARRAY: + { + guint8 no_of_bits = (guint8) pDescr->i; + guint16 nCount = (guint16)pDescr->descr.value; /* nCount supplied by value i.e. M_UINT_ARRAY(...) */ + + if (pDescr->serialize.value != 0) + { /* nCount specified by a reference to field holding value i.e. M_VAR_UINT_ARRAY(...) */ + nCount = *pui16DATA(data, nCount); + } + + if (remaining_bits_len >= no_of_bits) + { + remaining_bits_len -= (no_of_bits * nCount); + if (no_of_bits <= 8) + { + pui8 = pui8DATA(data, pDescr->offset); + + while (nCount > 0) + { + *pui8 = bitvec_read_field(vector, readIndex, no_of_bits); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + pui8++; + bit_offset += no_of_bits; + nCount--; + } + } + else if (no_of_bits <= 16) + { + pui16 = pui16DATA(data, pDescr->offset); + + while (nCount > 0) + { + *pui16 = bitvec_read_field(vector, readIndex, no_of_bits); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , *pui16); + pui16++; + bit_offset += no_of_bits; + nCount--; + } + } + else if (no_of_bits <= 32) + { /* not supported */ + return ProcessError(readIndex,"csnStreamDecoder NOT IMPLEMENTED", 999, pDescr); + } + else + { + return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_GENERAL, pDescr); + } + } + else + { + return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + + pDescr++; + break; + } + + case CSN_VARIABLE_TARRAY_OFFSET: + case CSN_VARIABLE_TARRAY: + case CSN_TYPE_ARRAY: + { + gint16 Status; + csnStream_t arT = *ar; + guint16 nCount = (guint16) pDescr->i; + guint16 nSize = (guint16)(guint32)pDescr->serialize.value; + + pui8 = pui8DATA(data, pDescr->offset); + + if (CSN_VARIABLE_TARRAY == pDescr->type) + { /* Count specified in field */ + nCount = *pui8DATA(data, pDescr->i); + } + else if (CSN_VARIABLE_TARRAY_OFFSET == pDescr->type) + { /* Count specified in field */ + nCount = *pui8DATA(data, pDescr->i); + nCount--; /* Offset 1 */ + } + + while (nCount--) /* Changed to handle length = 0. */ + { + LOGPC(DCSN1, LOGL_NOTICE, "%s | ", pDescr->sz); + csnStreamInit(&arT, bit_offset, remaining_bits_len); + Status = csnStreamDecoder(&arT, (const CSN_DESCR*)pDescr->descr.ptr, vector, readIndex, pui8); + if (Status >= 0) + { + pui8 += nSize; + remaining_bits_len = arT.remaining_bits_len; + bit_offset = arT.bit_offset; + } + else + { + return Status; + } + } + + pDescr++; + break; + } + + case CSN_BITMAP: + { /* bitmap with given length. The result is left aligned! */ + guint8 no_of_bits = (guint8) pDescr->i; /* length of bitmap */ + + if (no_of_bits > 0) + { + + if (no_of_bits <= 32) + { + guint32 ui32 = bitvec_read_field(vector, readIndex, no_of_bits); + pui32 = pui32DATA(data, pDescr->offset); + *pui32 = ui32; + } + else if (no_of_bits <= 64) + { + guint64 ui64 = bitvec_read_field(vector, readIndex, no_of_bits); + pui64 = pui64DATA(data, pDescr->offset); + *pui64 = ui64; + LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui64); + } + else + { + return ProcessError(readIndex,"csnStreamDecoder NOT IMPLEMENTED", 999, pDescr); + } + + remaining_bits_len -= no_of_bits; + assert(remaining_bits_len >= 0); + bit_offset += no_of_bits; + } + /* bitmap was successfully extracted or it was empty */ + + pDescr++; + break; + } + + case CSN_TYPE: + { + gint16 Status; + csnStream_t arT = *ar; + LOGPC(DCSN1, LOGL_NOTICE, " : %s | ", pDescr->sz); + csnStreamInit(&arT, bit_offset, remaining_bits_len); + Status = csnStreamDecoder(&arT, (const CSN_DESCR*)pDescr->descr.ptr, vector, readIndex, pvDATA(data, pDescr->offset)); + LOGPC(DCSN1, LOGL_NOTICE, " : End %s | ", pDescr->sz); + if (Status >= 0) + { + remaining_bits_len = arT.remaining_bits_len; + bit_offset = arT.bit_offset; + pDescr++; + } + else + { /* return error code Has already been processed: */ + return Status; + } + + break; + } + + default: + { /* descriptions of union elements other than above are illegal */ + return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_IN_SCRIPT, pDescr); + } + } + + pDescr = pDescrNext; + break; + } + + case CSN_EXIST: + case CSN_EXIST_LH: + { + guint8 fExist; + + pui8 = pui8DATA(data, pDescr->offset); + + if (CSN_EXIST_LH == pDescr->type) + { + fExist = get_masked_bits8(vector, readIndex, bit_offset, 1); + } + else + { + fExist = bitvec_read_field(vector, readIndex, 1); + } + + *pui8 = fExist; + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + pDescr++; + remaining_bits_len -= 1; + + if (!fExist) + { + ar->remaining_bits_len = remaining_bits_len; + ar->bit_offset = bit_offset; + return remaining_bits_len; + } + + break; + } + + case CSN_NEXT_EXIST: + { + guint8 fExist; + + pui8 = pui8DATA(data, pDescr->offset); + + /* this if-statement represents the M_NEXT_EXIST_OR_NULL description element */ + if ((pDescr->descr.ptr != NULL) && (remaining_bits_len == 0)) + { /* no more bits to decode is fine here - end of message detected and allowed */ + + /* Skip i entries + this entry */ + pDescr += pDescr->i + 1; + + /* pDescr now must be pointing to a CSN_END entry, if not this is an error */ + if ( pDescr->type != CSN_END ) + { /* Substract one more bit from remaining_bits_len to make the "not enough bits" error to be triggered */ + remaining_bits_len--; + } + + /* Set the data member to "not exist" */ + *pui8 = 0; + break; + } + + /* the "regular" M_NEXT_EXIST description element */ + + fExist = 0x00; + if (bitvec_read_field(vector, readIndex, 1)) + { + fExist = 0x01; + } + + *pui8 = fExist; + remaining_bits_len -= 1; + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + ++bit_offset; + + if (fExist == 0) + { /* Skip 'i' entries */ + pDescr += pDescr->i; + } + + pDescr++; + break; + } + + case CSN_NEXT_EXIST_LH: + { + guint8 fExist; + pui8 = pui8DATA(data, pDescr->offset); + + /* this if-statement represents the M_NEXT_EXIST_OR_NULL_LH description element */ + if ((pDescr->descr.ptr != NULL) && (remaining_bits_len == 0)) + { /* no more bits to decode is fine here - end of message detected and allowed */ + + /* skip 'i' entries + this entry */ + pDescr += pDescr->i + 1; + + /* pDescr now must be pointing to a CSN_END entry, if not this is an error */ + if ( pDescr->type != CSN_END ) + { /* substract one more bit from remaining_bits_len to make the "not enough bits" error to be triggered */ + remaining_bits_len--; + } + + /* set the data member to "not exist" */ + *pui8 = 0; + break; + } + + /* the "regular" M_NEXT_EXIST_LH description element */ + fExist = get_masked_bits8(vector,readIndex,bit_offset, 1); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)fExist); + *pui8++ = fExist; + remaining_bits_len -= 1; + + bit_offset++; + + if (fExist == 0) + { /* Skip 'i' entries */ + pDescr += pDescr->i; + } + pDescr++; + + break; + } + + case CSN_VARIABLE_BITMAP_1: + { /* Bitmap from here and to the end of message */ + + *pui8DATA(data, (gint16)pDescr->descr.value) = (guint8) remaining_bits_len; /* length of bitmap == remaining bits */ + + /*no break - + * with a length set we have a regular variable length bitmap so we continue */ + } + + case CSN_VARIABLE_BITMAP: + { /* {CSN_VARIABLE_BITMAP, 0, offsetof(_STRUCT, _ElementCountField), offsetof(_STRUCT, _MEMBER), #_MEMBER} + * + * Bit array with length (in bits) specified in parameter (pDescr->descr) + * The result is right aligned! + */ + gint16 no_of_bits = *pui8DATA(data, (gint16)pDescr->descr.value); + + no_of_bits += pDescr->i; /* adjusted by offset */ + + if (no_of_bits > 0) + { + remaining_bits_len -= no_of_bits; + + if (remaining_bits_len < 0) + { + return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + + { /* extract bits */ + guint8* pui8 = pui8DATA(data, pDescr->offset); + gint16 nB1 = no_of_bits & 0x07;/* no_of_bits Mod 8 */ + + if (nB1 > 0) + { /* take care of the first byte - it will be right aligned */ + *pui8 = bitvec_read_field(vector, readIndex, nB1); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + pui8++; + no_of_bits -= nB1; + bit_offset += nB1; /* (nB1 is no_of_bits Mod 8) */ + } + + /* remaining no_of_bits is a multiple of 8 or 0 */ + while (no_of_bits > 0) + { + *pui8 = bitvec_read_field(vector, readIndex, 8); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + pui8++; + no_of_bits -= 8; + } + } + } + pDescr++; + break; + } + + case CSN_LEFT_ALIGNED_VAR_BMP_1: + { /* Bitmap from here and to the end of message */ + + *pui8DATA(data, (gint16)pDescr->descr.value) = (guint8) remaining_bits_len; /* length of bitmap == remaining bits */ + + /* no break - + * with a length set we have a regular left aligned variable length bitmap so we continue + */ + } + + case CSN_LEFT_ALIGNED_VAR_BMP: + { /* {CSN_LEFT_ALIGNED_VAR_BMP, _OFFSET, (void*)offsetof(_STRUCT, _ElementCountField), offsetof(_STRUCT, _MEMBER), #_MEMBER} + * + * bit array with length (in bits) specified in parameter (pDescr->descr) + */ + gint16 no_of_bits = *pui8DATA(data, (gint16)pDescr->descr.value);/* Size of bitmap */ + + no_of_bits += pDescr->i;/* size adjusted by offset */ + + if (no_of_bits > 0) + { + remaining_bits_len -= no_of_bits; + + if (remaining_bits_len < 0) + { + return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + + { /* extract bits */ + guint8* pui8 = pui8DATA(data, pDescr->offset); + gint16 nB1 = no_of_bits & 0x07;/* no_of_bits Mod 8 */ + + while (no_of_bits > 0) + { + *pui8 = bitvec_read_field(vector, readIndex, 8); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + pui8++; + no_of_bits -= 8; + } + if (nB1 > 0) + { + *pui8 = bitvec_read_field(vector, readIndex, nB1); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + pui8++; + no_of_bits -= nB1; + bit_offset += nB1; /* (nB1 is no_of_bits Mod 8) */ + } + } + } + + /* bitmap was successfully extracted or it was empty */ + pDescr++; + break; + } + + case CSN_VARIABLE_ARRAY: + { /* {int type; int i; void* descr; int offset; const char* sz; } CSN_DESCR; + * {CSN_VARIABLE_ARRAY, _OFFSET, (void*)offsetof(_STRUCT, _ElementCountField), offsetof(_STRUCT, _MEMBER), #_MEMBER} + * Array with length specified in parameter: + * + * + */ + gint16 count = *pui8DATA(data, (gint16)pDescr->descr.value); + + count += pDescr->i; /* Adjusted by offset */ + + if (count > 0) + { + remaining_bits_len -= count * 8; + + if (remaining_bits_len < 0) + { + return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + + pui8 = pui8DATA(data, pDescr->offset); + + while (count > 0) + { + readIndex -= 8; + *pui8 = bitvec_read_field(vector, readIndex, 8); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + pui8++; + bit_offset += 8; + count--; + } + } + + pDescr++; + break; + } + + case CSN_RECURSIVE_ARRAY: + { /* Recursive way to specify an array: ::= {1 | 0} + * or more generally: ::= { | } + * where ::= bit(value) + * ::= 0 | 1 + * ::= reversed tag i.e. tag == 1 -> EndTag == 0 and vice versa + * {CSN_RECURSIVE_ARRAY, _BITS, (void*)offsetof(_STRUCT, _ElementCountField), offsetof(_STRUCT, _MEMBER), #_MEMBER} + * REMARK: recursive way to specify an array but an iterative implementation! + */ + gint16 no_of_bits = pDescr->i; + guint8 ElementCount = 0; + + pui8 = pui8DATA(data, pDescr->offset); + + while (existNextElement(vector, readIndex, Tag)) + { /* tag control shows existence of next list elements */ + LOGPC(DCSN1, LOGL_NOTICE, "%s = Exist | ", pDescr->sz); + bit_offset++; + remaining_bits_len--; + + /* extract and store no_of_bits long element from bitstream */ + *pui8 = bitvec_read_field(vector, readIndex, no_of_bits); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + pui8++; + remaining_bits_len -= no_of_bits; + ElementCount++; + + if (remaining_bits_len < 0) + { + return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + + bit_offset += no_of_bits; + } + + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)bitvec_read_field(vector, readIndex, 1)); + /* existNextElement() returned FALSE, 1 bit consumed */ + bit_offset++; + + /* Store the counted number of elements of the array */ + *pui8DATA(data, (gint16)pDescr->descr.value) = ElementCount; + + pDescr++; + break; + } + + case CSN_RECURSIVE_TARRAY: + { /* Recursive way to specify an array of type: ::= { 1 } ** 0 ; + * M_REC_TARRAY(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField) + * {t, offsetof(_STRUCT, _ElementCountField), (void*)CSNDESCR_##_MEMBER_TYPE, offsetof(_STRUCT, _MEMBER), #_MEMBER, (StreamSerializeFcn_t)sizeof(_MEMBER_TYPE)} + */ + gint16 nSizeElement = (gint16)(gint32)pDescr->serialize.value; + guint8 ElementCount = 0; + pui8 = pui8DATA(data, pDescr->offset); + + while (existNextElement(vector, readIndex, Tag)) + { /* tag control shows existence of next list elements */ + LOGPC(DCSN1, LOGL_NOTICE, "%s = Exist | ", pDescr->sz); + /* existNextElement() returned TRUE, 1 bit consumed */ + bit_offset++; + remaining_bits_len--; + ElementCount++; + + { /* unpack the following data structure */ + csnStream_t arT = *ar; + gint16 Status; + csnStreamInit(&arT, bit_offset, remaining_bits_len); + Status = csnStreamDecoder(&arT, (const CSN_DESCR*)pDescr->descr.ptr, vector, readIndex, pvDATA(data, pDescr->offset)); + + if (Status >= 0) + { /* successful completion */ + pui8 += nSizeElement; /* -> to next data element */ + remaining_bits_len = arT.remaining_bits_len; + bit_offset = arT.bit_offset; + } + else + { /* something went awry */ + return Status; + } + } + + if (remaining_bits_len < 0) + { + return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + } + + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)bitvec_read_field(vector, readIndex, 1)); + + /* existNextElement() returned FALSE, 1 bit consumed */ + bit_offset++; + + /* Store the counted number of elements of the array */ + *pui8DATA(data, (gint16)(gint32)pDescr->i) = ElementCount; + + pDescr++; + break; + } + + case CSN_RECURSIVE_TARRAY_2: + { /* Recursive way to specify an array of type: ::= { 0 } ** 1 ; */ + + Tag = REVERSED_TAG; + + /* NO break - + * handling is exactly the same as for CSN_RECURSIVE_TARRAY_1 so we continue + */ + } + + case CSN_RECURSIVE_TARRAY_1: + { /* Recursive way to specify an array of type: ::= { 1 } ** 0 ; + * M_REC_TARRAY(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField) + * {t, offsetof(_STRUCT, _ElementCountField), (void*)CSNDESCR_##_MEMBER_TYPE, offsetof(_STRUCT, _MEMBER), #_MEMBER, (StreamSerializeFcn_t)sizeof(_MEMBER_TYPE)} + */ + gint16 nSizeElement = (gint16)(gint32)pDescr->serialize.value; + guint8 ElementCount = 0; + csnStream_t arT = *ar; + gboolean EndOfList = FALSE; + gint16 Status; + pui8 = pui8DATA(data, pDescr->offset); + + do + { /* get data element */ + ElementCount++; + + LOGPC(DCSN1, LOGL_NOTICE, "%s { | ", pDescr->sz); + + csnStreamInit(&arT, bit_offset, remaining_bits_len); + Status = csnStreamDecoder(&arT, (const CSN_DESCR*)pDescr->descr.ptr, vector, readIndex, pvDATA(data, pDescr->offset)); + + if (Status >= 0) + { /* successful completion */ + pui8 += nSizeElement; /* -> to next */ + remaining_bits_len = arT.remaining_bits_len; + bit_offset = arT.bit_offset; + } + else + { /* something went awry */ + return Status; + } + + if (remaining_bits_len < 0) + { + return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + + /* control of next element's tag */ + LOGPC(DCSN1, LOGL_NOTICE, "%s } | ", pDescr->sz); + EndOfList = !(existNextElement(vector, readIndex, Tag)); + + bit_offset++; + remaining_bits_len--; /* 1 bit consumed (tag) */ + } while (!EndOfList); + + + /* Store the count of the array */ + *pui8DATA(data, pDescr->i) = ElementCount; + Tag = STANDARD_TAG; /* in case it was set to "reversed" */ + pDescr++; + break; + } + + case CSN_FIXED: + { /* Verify the fixed bits */ + guint8 no_of_bits = (guint8) pDescr->i; + guint32 ui32; + + if (no_of_bits <= 32) + { + ui32 = bitvec_read_field(vector, readIndex, no_of_bits); + } + else + { + return ProcessError(readIndex,"no_of_bits > 32", -1, pDescr); + } + if (ui32 != (unsigned)(gint32)pDescr->offset) + { + return ProcessError(readIndex,"csnStreamDecoder FIXED value does not match", -1, pDescr); + } + + LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , (unsigned int)ui32); + remaining_bits_len -= no_of_bits; + bit_offset += no_of_bits; + pDescr++; + break; + } + + case CSN_CALLBACK: + { + return ProcessError(readIndex,"csnStreamDecoder Callback not implemented", -1, pDescr); + break; + } + + case CSN_TRAP_ERROR: + { + return ProcessError(readIndex,"csnStreamDecoder", pDescr->i, pDescr); + } + + case CSN_END: + { + ar->remaining_bits_len = remaining_bits_len; + ar->bit_offset = bit_offset; + return remaining_bits_len; + } + + default: + { + assert(0); + } + + + } + + } while (remaining_bits_len >= 0); + + return ProcessError(readIndex,"csnStreamDecoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); +} + + + + +gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector, size_t& writeIndex, void* data) +{ + gint remaining_bits_len = ar->remaining_bits_len; + gint bit_offset = ar->bit_offset; + guint8* pui8; + guint16* pui16; + guint32* pui32; + guint64* pui64; + + guint8 Tag = STANDARD_TAG; + + if (remaining_bits_len <= 0) + { + return 0; + } + + do + { + switch (pDescr->type) + { + case CSN_BIT: + { + if (remaining_bits_len > 0) + { + pui8 = pui8DATA(data, pDescr->offset); + bitvec_write_field(vector, writeIndex, *pui8, 1); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + /* end add the bit value to protocol tree */ + } + else + { + return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + + pDescr++; + remaining_bits_len--; + bit_offset++; + break; + } + + case CSN_NULL: + { /* Empty member! */ + pDescr++; + break; + } + + case CSN_UINT: + { + guint8 no_of_bits = (guint8) pDescr->i; + + if (remaining_bits_len >= no_of_bits) + { + if (no_of_bits <= 8) + { + pui8 = pui8DATA(data, pDescr->offset); + bitvec_write_field(vector, writeIndex, *pui8, no_of_bits); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + } + else if (no_of_bits <= 16) + { + pui16 = pui16DATA(data, pDescr->offset); + bitvec_write_field(vector, writeIndex, *pui16, no_of_bits); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui16); + } + else if (no_of_bits <= 32) + { + pui32 = pui32DATA(data, pDescr->offset); + bitvec_write_field(vector, writeIndex, *pui32, no_of_bits); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui32); + } + else + { + return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_GENERAL, pDescr); + } + } + else + { + return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + + remaining_bits_len -= no_of_bits; + bit_offset += no_of_bits; + pDescr++; + break; + } + + case CSN_UINT_OFFSET: + { + guint8 no_of_bits = (guint8) pDescr->i; + + if (remaining_bits_len >= no_of_bits) + { + if (no_of_bits <= 8) + { + pui8 = pui8DATA(data, pDescr->offset); + bitvec_write_field(vector, writeIndex, *pui8 - (guint8)pDescr->descr.value, no_of_bits); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)(*pui8 - (guint8)pDescr->descr.value)); + } + else if (no_of_bits <= 16) + { + pui16 = pui16DATA(data, pDescr->offset); + bitvec_write_field(vector, writeIndex, *pui16 - (guint16)pDescr->descr.value, no_of_bits); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , (unsigned short)(*pui16 - (guint16)pDescr->descr.value)); + } + else if (no_of_bits <= 32) + { + pui32 = pui32DATA(data, pDescr->offset); + bitvec_write_field(vector, writeIndex, *pui32 - (guint16)pDescr->descr.value, no_of_bits); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , (unsigned int)(*pui32 - (guint16)pDescr->descr.value)); + } + else + { + return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_GENERAL, pDescr); + } + } + else + { + return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + + remaining_bits_len -= no_of_bits; + bit_offset += no_of_bits; + pDescr++; + break; + } + + case CSN_UINT_LH: + { + guint8 no_of_bits = (guint8) pDescr->i; + + if (remaining_bits_len >= no_of_bits) + { + remaining_bits_len -= no_of_bits; + if (no_of_bits <= 8) + { + pui8 = pui8DATA(data, pDescr->offset); + bitvec_write_field(vector, writeIndex, *pui8, no_of_bits); + // TODO : Change get_masked_bits8() + writeIndex -= no_of_bits; + guint8 ui8 = get_masked_bits8(vector, writeIndex, bit_offset, no_of_bits); + writeIndex -= no_of_bits; + bitvec_write_field(vector, writeIndex, ui8, no_of_bits); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + + } + else + {/* Maybe we should support more than 8 bits ? */ + return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_GENERAL, pDescr); + } + } + else + { + return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + + remaining_bits_len -= no_of_bits; + bit_offset += no_of_bits; + pDescr++; + break; + } + + case CSN_UINT_ARRAY: + { + guint8 no_of_bits = (guint8) pDescr->i; + guint16 nCount = (guint16)pDescr->descr.value; /* nCount supplied by value i.e. M_UINT_ARRAY(...) */ + + if (pDescr->serialize.value != 0) + { /* nCount specified by a reference to field holding value i.e. M_VAR_UINT_ARRAY(...) */ + nCount = *pui16DATA(data, nCount); + } + + if (remaining_bits_len >= no_of_bits) + { + remaining_bits_len -= (no_of_bits*nCount); + if (no_of_bits <= 8) + { + pui8 = pui8DATA(data, pDescr->offset); + do + { + bitvec_write_field(vector, writeIndex, *pui8, no_of_bits); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + pui8++; + bit_offset += no_of_bits; + } while (--nCount > 0); + } + else if (no_of_bits <= 16) + { + return ProcessError(writeIndex,"csnStreamEncoder NOTIMPLEMENTED", 999, pDescr); + } + else if (no_of_bits <= 32) + { + return ProcessError(writeIndex,"csnStreamEncoder NOTIMPLEMENTED", 999, pDescr); + } + else + { + return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_GENERAL, pDescr); + } + } + else + { + return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + pDescr++; + break; + } + + case CSN_VARIABLE_TARRAY_OFFSET: + case CSN_VARIABLE_TARRAY: + case CSN_TYPE_ARRAY: + { + gint16 Status; + csnStream_t arT = *ar; + gint16 nCount = pDescr->i; + guint16 nSize = (guint16)(gint32)pDescr->serialize.value; + + pui8 = pui8DATA(data, pDescr->offset); + if (pDescr->type == CSN_VARIABLE_TARRAY) + { /* Count specified in field */ + nCount = *pui8DATA(data, pDescr->i); + } + else if (pDescr->type == CSN_VARIABLE_TARRAY_OFFSET) + { /* Count specified in field */ + nCount = *pui8DATA(data, pDescr->i); + /* nCount--; the 1 offset is already taken into account in CSN_UINT_OFFSET */ + } + + while (nCount > 0) + { /* resulting array of length 0 is possible + * but no bits shall be read from bitstream + */ + + LOGPC(DCSN1, LOGL_NOTICE, "%s : | ", pDescr->sz); + csnStreamInit(&arT, bit_offset, remaining_bits_len); + Status = csnStreamEncoder(&arT, (const CSN_DESCR*)pDescr->descr.ptr, vector, writeIndex, pui8); + if (Status >= 0) + { + pui8 += nSize; + remaining_bits_len = arT.remaining_bits_len; + bit_offset = arT.bit_offset; + + } + else + { + return Status; + } + nCount--; + } + + pDescr++; + break; + } + + case CSN_BITMAP: + { /* bitmap with given length. The result is left aligned! */ + guint8 no_of_bits = (guint8) pDescr->i; /* length of bitmap */ + + if (no_of_bits > 0) + { + + if (no_of_bits <= 32) + { + for(unsigned ib = 0; ib < 4; ib++) + { + pui8 = pui8DATA(data, pDescr->offset+ib); + bitvec_write_field(vector, writeIndex, *pui8, 8); + LOGPC(DCSN1, LOGL_NOTICE, "%s[%u] = %u | ", pDescr->sz , ib, (unsigned)*pui8); + } + } + else if (no_of_bits <= 64) + { + for(unsigned ib = 0; ib < 8; ib++) + { + pui8 = pui8DATA(data, pDescr->offset+ib); + bitvec_write_field(vector, writeIndex, *pui8, 8); + LOGPC(DCSN1, LOGL_NOTICE, "%s[%u] = %u | ", pDescr->sz , ib, (unsigned)*pui8); + } + } + else + { + return ProcessError(writeIndex,"csnStreamEncoder NOT IMPLEMENTED", 999, pDescr); + } + + remaining_bits_len -= no_of_bits; + assert(remaining_bits_len >= 0); + bit_offset += no_of_bits; + } + /* bitmap was successfully extracted or it was empty */ + + pDescr++; + break; + } + + case CSN_TYPE: + { + gint16 Status; + csnStream_t arT = *ar; + LOGPC(DCSN1, LOGL_NOTICE, " : %s | ", pDescr->sz); + csnStreamInit(&arT, bit_offset, remaining_bits_len); + Status = csnStreamEncoder(&arT, (const CSN_DESCR*)pDescr->descr.ptr, vector, writeIndex, pvDATA(data, pDescr->offset)); + LOGPC(DCSN1, LOGL_NOTICE, " : End %s | ", pDescr->sz); + if (Status >= 0) + { + + remaining_bits_len = arT.remaining_bits_len; + bit_offset = arT.bit_offset; + pDescr++; + } + else + { + /* Has already been processed: ProcessError("csnStreamEncoder", Status, pDescr); */ + return Status; + } + + break; + } + + case CSN_CHOICE: + { + //gint16 count = pDescr->i; + guint8 i = 0; + CSN_ChoiceElement_t* pChoice = (CSN_ChoiceElement_t*) pDescr->descr.ptr; + + pui8 = pui8DATA(data, pDescr->offset); + i = *pui8; + pChoice += i; + guint8 no_of_bits = pChoice->bits; + guint8 value = pChoice->value; + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pChoice->descr.sz , (unsigned)value); + bitvec_write_field(vector, writeIndex, value, no_of_bits); + + CSN_DESCR descr[2]; + gint16 Status; + csnStream_t arT = *ar; + + descr[0] = pChoice->descr; + memset(&descr[1], 0x00, sizeof(CSN_DESCR)); + descr[1].type = CSN_END; + bit_offset += no_of_bits; + remaining_bits_len -= no_of_bits; + + csnStreamInit(&arT, bit_offset, remaining_bits_len); + Status = csnStreamEncoder(&arT, descr, vector, writeIndex, data); + + if (Status >= 0) + { + remaining_bits_len = arT.remaining_bits_len; + bit_offset = arT.bit_offset; + } + else + { + return Status; + } + + pDescr++; + break; + } + + case CSN_SERIALIZE: + { + StreamSerializeFcn_t serialize = pDescr->serialize.fcn; + csnStream_t arT = *ar; + gint16 Status = -1; + size_t lengthIndex; + + // store writeIndex for length value (7 bit) + lengthIndex = writeIndex; + writeIndex += 7; + bit_offset += 7; + remaining_bits_len -= 7; + arT.direction = 0; + csnStreamInit(&arT, bit_offset, remaining_bits_len); + Status = serialize(&arT, vector, writeIndex, pvDATA(data, pDescr->offset)); + + bitvec_write_field(vector, lengthIndex, writeIndex-lengthIndex-7, 7); + LOGPC(DCSN1, LOGL_NOTICE, "%s length = %u | ", pDescr->sz , (unsigned)(writeIndex-lengthIndex)); + + if (Status >= 0) + { + remaining_bits_len = arT.remaining_bits_len; + bit_offset = arT.bit_offset; + pDescr++; + } + else + { + // Has already been processed: + return Status; + } + + break; + } + + case CSN_UNION_LH: + case CSN_UNION: + { + gint16 Bits; + guint8 index; + gint16 count = pDescr->i; + const CSN_DESCR* pDescrNext = pDescr; + + pDescrNext += count + 1; /* now this is next after the union */ + if ((count <= 0) || (count > 16)) + { + return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_INVALID_UNION_INDEX, pDescr); + } + + /* Now get the bits to extract the index */ + Bits = ixBitsTab[count]; + index = 0; + + /* Assign UnionType */ + pui8 = pui8DATA(data, pDescr->offset); + //read index from data and write to vector + bitvec_write_field(vector, writeIndex, *pui8, Bits); + + //decode index + writeIndex -= Bits; + + while (Bits > 0) + { + index <<= 1; + + if (CSN_UNION_LH == pDescr->type) + { + index |= get_masked_bits8(vector,writeIndex, bit_offset, 1); + } + else + { + index |= bitvec_read_field(vector, writeIndex, 1); + } + + remaining_bits_len--; + bit_offset++; + Bits--; + } + + writeIndex -= Bits; + bitvec_write_field(vector, writeIndex, index, Bits); + + + /* script index to continue on, limited in case we do not have a power of 2 */ + pDescr += (MIN(index + 1, count)); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)index); + + switch (pDescr->type) + { /* get the right element of the union based on computed index */ + + case CSN_BIT: + { + pui8 = pui8DATA(data, pDescr->offset); + bitvec_write_field(vector, writeIndex, *pui8, 1); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + remaining_bits_len -= 1; + bit_offset++; + pDescr++; + break; + } + + case CSN_NULL: + { /* Empty member! */ + pDescr++; + break; + } + + case CSN_UINT: + { + guint8 no_of_bits = (guint8) pDescr->i; + if (remaining_bits_len >= no_of_bits) + { + remaining_bits_len -= no_of_bits; + + if (no_of_bits <= 8) + { + pui8 = pui8DATA(data, pDescr->offset); + bitvec_write_field(vector, writeIndex, *pui8, no_of_bits); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + } + else if (no_of_bits <= 16) + { + pui16 = pui16DATA(data, pDescr->offset); + bitvec_write_field(vector, writeIndex, *pui16, no_of_bits); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui16); + } + else if (no_of_bits <= 32) + { + pui32 = pui32DATA(data, pDescr->offset); + bitvec_write_field(vector, writeIndex, *pui32, no_of_bits); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui32); + } + else + { + return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_GENERAL, pDescr); + } + } + else + { + return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_GENERAL, pDescr); + } + + bit_offset += no_of_bits; + pDescr++; + break; + } + + case CSN_UINT_OFFSET: + { + guint8 no_of_bits = (guint8) pDescr->i; + + if (remaining_bits_len >= no_of_bits) + { + if (no_of_bits <= 8) + { + pui8 = pui8DATA(data, pDescr->offset); + bitvec_write_field(vector, writeIndex, *pui8 - (guint8)pDescr->descr.value, no_of_bits); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)(*pui8 - (guint8)pDescr->descr.value)); + } + else if (no_of_bits <= 16) + { + pui16 = pui16DATA(data, pDescr->offset); + bitvec_write_field(vector, writeIndex, *pui16 - (guint16)pDescr->descr.value, no_of_bits); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , (unsigned short)(*pui16 - (guint16)pDescr->descr.value)); + } + else if (no_of_bits <= 32) + { + pui32 = pui32DATA(data, pDescr->offset); + bitvec_write_field(vector, writeIndex, *pui32 - (guint16)pDescr->descr.value, no_of_bits); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , (unsigned int)(*pui32 - (guint16)pDescr->descr.value)); + } + else + { + return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_GENERAL, pDescr); + } + } + else + { + return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + + remaining_bits_len -= no_of_bits; + bit_offset += no_of_bits; + pDescr++; + break; + } + + case CSN_UINT_LH: + { + guint8 no_of_bits = (guint8) pDescr->i; + + if (remaining_bits_len >= no_of_bits) + { + remaining_bits_len -= no_of_bits; + if (no_of_bits <= 8) + { + pui8 = pui8DATA(data, pDescr->offset); + bitvec_write_field(vector, writeIndex, *pui8, no_of_bits); + // TODO : Change get_masked_bits8() + writeIndex -= no_of_bits; + guint8 ui8 = get_masked_bits8(vector, writeIndex, bit_offset, no_of_bits); + writeIndex -= no_of_bits; + bitvec_write_field(vector, writeIndex, ui8, no_of_bits); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + + } + else + {/* Maybe we should support more than 8 bits ? */ + return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_GENERAL, pDescr); + } + } + else + { + return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + + remaining_bits_len -= no_of_bits; + bit_offset += no_of_bits; + pDescr++; + break; + } + + case CSN_UINT_ARRAY: + { + guint8 no_of_bits = (guint8) pDescr->i; + guint16 nCount = (guint16)pDescr->descr.value; /* nCount supplied by value i.e. M_UINT_ARRAY(...) */ + + if (pDescr->serialize.value != 0) + { /* nCount specified by a reference to field holding value i.e. M_VAR_UINT_ARRAY(...) */ + nCount = *pui16DATA(data, nCount); + } + + if (remaining_bits_len >= no_of_bits) + { + remaining_bits_len -= (no_of_bits*nCount); + if (no_of_bits <= 8) + { + pui8 = pui8DATA(data, pDescr->offset); + do + { + bitvec_write_field(vector, writeIndex, *pui8, no_of_bits); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + pui8++; + bit_offset += no_of_bits; + } while (--nCount > 0); + } + else if (no_of_bits <= 16) + { + return ProcessError(writeIndex,"csnStreamEncoder NOTIMPLEMENTED", 999, pDescr); + } + else if (no_of_bits <= 32) + { + return ProcessError(writeIndex,"csnStreamEncoder NOTIMPLEMENTED", 999, pDescr); + } + else + { + return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_GENERAL, pDescr); + } + } + else + { + return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + pDescr++; + break; + } + + case CSN_VARIABLE_TARRAY_OFFSET: + case CSN_VARIABLE_TARRAY: + case CSN_TYPE_ARRAY: + { + gint16 Status; + csnStream_t arT = *ar; + gint16 nCount = pDescr->i; + guint16 nSize = (guint16)(gint32)pDescr->serialize.value; + + pui8 = pui8DATA(data, pDescr->offset); + if (pDescr->type == CSN_VARIABLE_TARRAY) + { /* Count specified in field */ + nCount = *pui8DATA(data, pDescr->i); + } + else if (pDescr->type == CSN_VARIABLE_TARRAY_OFFSET) + { /* Count specified in field */ + nCount = *pui8DATA(data, pDescr->i); + /* nCount--; the 1 offset is already taken into account in CSN_UINT_OFFSET */ + } + + while (nCount > 0) + { /* resulting array of length 0 is possible + * but no bits shall be read from bitstream + */ + + LOGPC(DCSN1, LOGL_NOTICE, "%s : | ", pDescr->sz); + csnStreamInit(&arT, bit_offset, remaining_bits_len); + Status = csnStreamEncoder(&arT, (const CSN_DESCR*)pDescr->descr.ptr, vector, writeIndex, pui8); + if (Status >= 0) + { + pui8 += nSize; + remaining_bits_len = arT.remaining_bits_len; + bit_offset = arT.bit_offset; + } + else + { + return Status; + } + nCount--; + } + + pDescr++; + break; + } + + case CSN_BITMAP: + { /* bitmap with given length. The result is left aligned! */ + guint8 no_of_bits = (guint8) pDescr->i; /* length of bitmap */ + + if (no_of_bits > 0) + { + + if (no_of_bits <= 32) + { + pui32 = pui32DATA(data, pDescr->offset); + bitvec_write_field(vector, writeIndex, *pui32, no_of_bits); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui32); + } + else if (no_of_bits <= 64) + { + pui64 = pui64DATA(data, pDescr->offset); + bitvec_write_field(vector, writeIndex, *pui64, no_of_bits); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui64); + } + else + { + return ProcessError(writeIndex,"csnStreamEncoder NOT IMPLEMENTED", 999, pDescr); + } + + remaining_bits_len -= no_of_bits; + assert(remaining_bits_len >= 0); + bit_offset += no_of_bits; + } + /* bitmap was successfully extracted or it was empty */ + + pDescr++; + break; + } + + case CSN_TYPE: + { + gint16 Status; + csnStream_t arT = *ar; + LOGPC(DCSN1, LOGL_NOTICE, " : %s | ", pDescr->sz); + csnStreamInit(&arT, bit_offset, remaining_bits_len); + Status = csnStreamEncoder(&arT, (const CSN_DESCR*)pDescr->descr.ptr, vector, writeIndex, pvDATA(data, pDescr->offset)); + LOGPC(DCSN1, LOGL_NOTICE, " : End %s | ", pDescr->sz); + if (Status >= 0) + { + remaining_bits_len = arT.remaining_bits_len; + bit_offset = arT.bit_offset; + pDescr++; + } + else + { + /* Has already been processed: ProcessError("csnStreamEncoder", Status, pDescr); */ + return Status; + } + + break; + } + + default: + { /* descriptions of union elements other than above are illegal */ + return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_IN_SCRIPT, pDescr); + } + } + + pDescr = pDescrNext; + break; + } + + case CSN_EXIST: + case CSN_EXIST_LH: + { + guint8 fExist; + unsigned exist = 0; + pui8 = pui8DATA(data, pDescr->offset); + exist = *pui8; + bitvec_write_field(vector, writeIndex, *pui8, 1); + writeIndex--; + if (CSN_EXIST_LH == pDescr->type) + { + fExist = get_masked_bits8(vector, writeIndex, bit_offset, 1); + } + else + { + fExist = bitvec_read_field(vector, writeIndex, 1); + } + writeIndex--; + bitvec_write_field(vector, writeIndex, fExist, 1); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz, (unsigned)fExist); + pDescr++; + remaining_bits_len -= 1; + + if (!exist) + { + ar->remaining_bits_len = remaining_bits_len; + ar->bit_offset = bit_offset; + return remaining_bits_len; + } + break; + } + + case CSN_NEXT_EXIST: + { + guint8 fExist; + + pui8 = pui8DATA(data, pDescr->offset); + + /* this if-statement represents the M_NEXT_EXIST_OR_NULL description element */ + if ((pDescr->descr.ptr != NULL) && (remaining_bits_len == 0)) + { /* no more bits to decode is fine here - end of message detected and allowed */ + + /* Skip i entries + this entry */ + pDescr += pDescr->i + 1; + + /* pDescr now must be pointing to a CSN_END entry, if not this is an error */ + if ( pDescr->type != CSN_END ) + { /* Substract one more bit from remaining_bits_len to make the "not enough bits" error to be triggered */ + remaining_bits_len--; + } + + break; + } + + bitvec_write_field(vector, writeIndex, *pui8, 1); + fExist = *pui8; + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + remaining_bits_len -= 1; + + ++bit_offset; + + if (fExist == 0) + { /* Skip 'i' entries */ + pDescr += pDescr->i; + } + + pDescr++; + break; + } + + case CSN_NEXT_EXIST_LH: + { + guint8 fExist; + pui8 = pui8DATA(data, pDescr->offset); + + /* this if-statement represents the M_NEXT_EXIST_OR_NULL_LH description element */ + if ((pDescr->descr.ptr != NULL) && (remaining_bits_len == 0)) + { /* no more bits to decode is fine here - end of message detected and allowed */ + + /* skip 'i' entries + this entry */ + pDescr += pDescr->i + 1; + + /* pDescr now must be pointing to a CSN_END entry, if not this is an error */ + if ( pDescr->type != CSN_END ) + { /* substract one more bit from remaining_bits_len to make the "not enough bits" error to be triggered */ + remaining_bits_len--; + } + + /* set the data member to "not exist" */ + //*pui8 = 0; + break; + } + + /* the "regular" M_NEXT_EXIST_LH description element */ + bitvec_write_field(vector, writeIndex, *pui8, 1); + writeIndex--; + fExist = get_masked_bits8(vector,writeIndex, bit_offset, 1); + writeIndex--; + bitvec_write_field(vector, writeIndex, fExist, 1); + pui8++; + remaining_bits_len -= 1; + + bit_offset++; + + if (fExist == 0) + { /* Skip 'i' entries */ + pDescr += pDescr->i; + } + pDescr++; + + break; + } + + case CSN_VARIABLE_BITMAP_1: + { /* Bitmap from here and to the end of message */ + + //*pui8DATA(data, (gint16)pDescr->descr.value) = (guint8) remaining_bits_len; /* length of bitmap == remaining bits */ + + /*no break - + * with a length set we have a regular variable length bitmap so we continue */ + } + + case CSN_VARIABLE_BITMAP: + { /* {CSN_VARIABLE_BITMAP, 0, offsetof(_STRUCT, _ElementCountField), offsetof(_STRUCT, _MEMBER), #_MEMBER} + * + * Bit array with length (in bits) specified in parameter (pDescr->descr) + * The result is right aligned! + */ + gint16 no_of_bits = *pui8DATA(data, (gint16)pDescr->descr.value); + + no_of_bits += pDescr->i; /* adjusted by offset */ + + if (no_of_bits > 0) + { + remaining_bits_len -= no_of_bits; + + if (remaining_bits_len < 0) + { + return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + + { /* extract bits */ + guint8* pui8 = pui8DATA(data, pDescr->offset); + gint16 nB1 = no_of_bits & 0x07;/* no_of_bits Mod 8 */ + + if (nB1 > 0) + { /* take care of the first byte - it will be right aligned */ + bitvec_write_field(vector, writeIndex, *pui8, nB1); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + pui8++; + no_of_bits -= nB1; + bit_offset += nB1; /* (nB1 is no_of_bits Mod 8) */ + } + + /* remaining no_of_bits is a multiple of 8 or 0 */ + while (no_of_bits > 0) + { + bitvec_write_field(vector, writeIndex, *pui8, 8); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + pui8++; + no_of_bits -= 8; + } + } + } + pDescr++; + break; + } + + case CSN_LEFT_ALIGNED_VAR_BMP_1: + { /* Bitmap from here and to the end of message */ + + //*pui8DATA(data, (gint16)pDescr->descr.value) = (guint8) remaining_bits_len; /* length of bitmap == remaining bits */ + + /* no break - + * with a length set we have a regular left aligned variable length bitmap so we continue + */ + } + + case CSN_LEFT_ALIGNED_VAR_BMP: + { /* {CSN_LEFT_ALIGNED_VAR_BMP, _OFFSET, (void*)offsetof(_STRUCT, _ElementCountField), offsetof(_STRUCT, _MEMBER), #_MEMBER} + * + * bit array with length (in bits) specified in parameter (pDescr->descr) + */ + + gint16 no_of_bits = *pui8DATA(data, (gint16)pDescr->descr.value);/* Size of bitmap */ + + no_of_bits += pDescr->i;/* size adjusted by offset */ + + if (no_of_bits > 0) + { + remaining_bits_len -= no_of_bits; + + if (remaining_bits_len < 0) + { + return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + + { /* extract bits */ + guint8* pui8 = pui8DATA(data, pDescr->offset); + gint16 nB1 = no_of_bits & 0x07;/* no_of_bits Mod 8 */ + + while (no_of_bits > 0) + { + bitvec_write_field(vector, writeIndex, *pui8, 8); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + pui8++; + no_of_bits -= 8; + } + if (nB1 > 0) + { + bitvec_write_field(vector, writeIndex, *pui8, nB1); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + pui8++; + no_of_bits -= nB1; + bit_offset += nB1; /* (nB1 is no_of_bits Mod 8) */ + } + } + + } + + /* bitmap was successfully extracted or it was empty */ + pDescr++; + break; + } + + case CSN_VARIABLE_ARRAY: + { /* {int type; int i; void* descr; int offset; const char* sz; } CSN_DESCR; + * {CSN_VARIABLE_ARRAY, _OFFSET, (void*)offsetof(_STRUCT, _ElementCountField), offsetof(_STRUCT, _MEMBER), #_MEMBER} + * Array with length specified in parameter: + * + * + */ + gint16 count = *pui8DATA(data, (gint16)pDescr->descr.value); + + count += pDescr->i; /* Adjusted by offset */ + + if (count > 0) + { + remaining_bits_len -= count * 8; + + if (remaining_bits_len < 0) + { + return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + + pui8 = pui8DATA(data, pDescr->offset); + + while (count > 0) + { + bitvec_write_field(vector, writeIndex, *pui8, 8); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + pui8++; + bit_offset += 8; + count--; + } + } + + pDescr++; + break; + } + + case CSN_RECURSIVE_ARRAY: + { /* Recursive way to specify an array: ::= {1 | 0} + * or more generally: ::= { | } + * where ::= bit(value) + * ::= 0 | 1 + * ::= reversed tag i.e. tag == 1 -> EndTag == 0 and vice versa + * {CSN_RECURSIVE_ARRAY, _BITS, (void*)offsetof(_STRUCT, _ElementCountField), offsetof(_STRUCT, _MEMBER), #_MEMBER} + * REMARK: recursive way to specify an array but an iterative implementation! + */ + gint16 no_of_bits = pDescr->i; + guint8 ElementCount = 0; + pui8 = pui8DATA(data, pDescr->offset); + ElementCount = *pui8DATA(data, (gint16)pDescr->descr.value); + while (ElementCount > 0) + { /* tag control shows existence of next list elements */ + bitvec_write_field(vector, writeIndex, Tag, 1); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)Tag); + bit_offset++; + remaining_bits_len--; + + /* extract and store no_of_bits long element from bitstream */ + bitvec_write_field(vector, writeIndex, *pui8, no_of_bits); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)*pui8); + pui8++; + remaining_bits_len -= no_of_bits; + ElementCount--; + + if (remaining_bits_len < 0) + { + return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + + bit_offset += no_of_bits; + } + + bitvec_write_field(vector, writeIndex, !Tag, 1); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)(!Tag)); + bit_offset++; + + pDescr++; + break; + } + + case CSN_RECURSIVE_TARRAY: + { /* Recursive way to specify an array of type: ::= { 1 } ** 0 ; + * M_REC_TARRAY(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField) + * {t, offsetof(_STRUCT, _ElementCountField), (void*)CSNDESCR_##_MEMBER_TYPE, offsetof(_STRUCT, _MEMBER), #_MEMBER, (StreamSerializeFcn_t)sizeof(_MEMBER_TYPE)} + */ + gint16 nSizeElement = (gint16)(gint32)pDescr->serialize.value; + guint8 ElementCount = 0; + pui8 = pui8DATA(data, pDescr->offset); + /* Store the counted number of elements of the array */ + ElementCount = *pui8DATA(data, (gint16)(gint32)pDescr->i); + + while (ElementCount > 0) + { /* tag control shows existence of next list elements */ + bitvec_write_field(vector, writeIndex, Tag, 1); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)Tag); + bit_offset++; + + remaining_bits_len--; + ElementCount--; + + { /* unpack the following data structure */ + csnStream_t arT = *ar; + gint16 Status; + csnStreamInit(&arT, bit_offset, remaining_bits_len); + Status = csnStreamEncoder(&arT, (const CSN_DESCR*)pDescr->descr.ptr, vector, writeIndex, pvDATA(data, pDescr->offset)); + + if (Status >= 0) + { /* successful completion */ + pui8 += nSizeElement; /* -> to next data element */ + remaining_bits_len = arT.remaining_bits_len; + bit_offset = arT.bit_offset; + } + else + { /* something went awry */ + return Status; + } + } + + if (remaining_bits_len < 0) + { + return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + } + + bitvec_write_field(vector, writeIndex, !Tag, 1); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)(!Tag)); + bit_offset++; + + pDescr++; + break; + } + + case CSN_RECURSIVE_TARRAY_2: + { /* Recursive way to specify an array of type: ::= { 0 } ** 1 ; */ + + Tag = REVERSED_TAG; + + /* NO break - + * handling is exactly the same as for CSN_RECURSIVE_TARRAY_1 so we continue + */ + } + + case CSN_RECURSIVE_TARRAY_1: + { /* Recursive way to specify an array of type: ::= { 1 } ** 0 ; + * M_REC_TARRAY(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField) + * {t, offsetof(_STRUCT, _ElementCountField), (void*)CSNDESCR_##_MEMBER_TYPE, offsetof(_STRUCT, _MEMBER), #_MEMBER, (StreamSerializeFcn_t)sizeof(_MEMBER_TYPE)} + */ + gint16 nSizeElement = (gint16)(gint32)pDescr->serialize.value; + guint8 ElementCount = 0; + guint8 ElementNum = 0; + csnStream_t arT = *ar; + gint16 Status; + + pui8 = pui8DATA(data, pDescr->offset); + /* Store the count of the array */ + ElementCount = *pui8DATA(data, pDescr->i); + ElementNum = ElementCount; + + while (ElementCount > 0) + { /* get data element */ + if (ElementCount != ElementNum) + { + bitvec_write_field(vector, writeIndex, Tag, 1); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)Tag); + bit_offset++; + remaining_bits_len--; + } + ElementCount--; + LOGPC(DCSN1, LOGL_NOTICE, "%s { | ", pDescr->sz); + csnStreamInit(&arT, bit_offset, remaining_bits_len); + Status = csnStreamEncoder(&arT, (const CSN_DESCR*)pDescr->descr.ptr, vector, writeIndex, pvDATA(data, pDescr->offset)); + LOGPC(DCSN1, LOGL_NOTICE, "%s } | ", pDescr->sz); + if (Status >= 0) + { /* successful completion */ + pui8 += nSizeElement; /* -> to next */ + remaining_bits_len = arT.remaining_bits_len; + bit_offset = arT.bit_offset; + } + else + { /* something went awry */ + return Status; + } + + if (remaining_bits_len < 0) + { + return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + + } + bitvec_write_field(vector, writeIndex, !Tag, 1); + bit_offset++; + Tag = STANDARD_TAG; /* in case it was set to "reversed" */ + pDescr++; + break; + } + + case CSN_FIXED: + { /* Verify the fixed bits */ + guint8 no_of_bits = (guint8) pDescr->i; + bitvec_write_field(vector, writeIndex, pDescr->offset, no_of_bits); + LOGPC(DCSN1, LOGL_NOTICE, "%s = %u | ", pDescr->sz , (unsigned)pDescr->offset); + remaining_bits_len -= no_of_bits; + bit_offset += no_of_bits; + pDescr++; + break; + } + + case CSN_CALLBACK: + { + return ProcessError(writeIndex,"csnStreamEncoder Callback not implemented", -1, pDescr); + break; + } + + case CSN_TRAP_ERROR: + { + return ProcessError(writeIndex,"csnStreamEncoder", pDescr->i, pDescr); + } + + case CSN_END: + { + ar->remaining_bits_len = remaining_bits_len; + ar->bit_offset = bit_offset; + return remaining_bits_len; + } + + default: + { + assert(0); + } + + } + + } while (remaining_bits_len >= 0); + + return ProcessError(writeIndex,"csnStreamEncoder", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); +} + diff --git a/src/csn1.h b/src/csn1.h new file mode 100644 index 00000000..a50b6cd3 --- /dev/null +++ b/src/csn1.h @@ -0,0 +1,574 @@ +/* csn1.h + * Declarations and types for CSN1 dissection in wireshark. + * By Vincent Helfre, based on original code by Jari Sassi + * with the gracious authorization of STE + * Copyright (c) 2011 ST-Ericsson + * + * $Id: packet-csn1.h 36306 2011-03-24 09:20:14Z etxrab $ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs + * 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. + */ + +#include +#include +#include +#ifndef _PACKET_CSN1_H_ +#define _PACKET_CSN1_H_ + + +#define MIN(a,b) (((a)<(b))?(a):(b)) +//#define max(a,b) (((a)>(b))?(a):(b)) + +/* Error codes */ +#define CSN_OK 0 +#define CSN_ERROR_GENERAL -1 +#define CSN_ERROR_DATA_NOT_VALID -2 +#define CSN_ERROR_IN_SCRIPT -3 +#define CSN_ERROR_INVALID_UNION_INDEX -4 +#define CSN_ERROR_NEED_MORE_BITS_TO_UNPACK -5 +#define CSN_ERROR_ILLEGAL_BIT_VALUE -6 +#define CSN_ERROR_INTERNAL -7 +#define CSN_ERROR_STREAM_NOT_SUPPORTED -8 +#define CSN_ERROR_MESSAGE_TOO_LONG -9 +#define CSN_ERROR_ -10 + +#define FALSE (0) +typedef signed int gint32; +typedef signed short gint16; +typedef int gint; +typedef gint gboolean; +typedef unsigned char guint8; +typedef unsigned short guint16; +typedef unsigned int guint32; +typedef unsigned long guint64; +/* CallBack return status */ +typedef gint16 CSN_CallBackStatus_t; + +#define CSNCBS_OK 0 +#define CSNCBS_NOT_OK -10 +#define CSNCBS_NOT_TO_US -11 +#define CSNCBS_NOT_COMPLETE -12 + +#define CSNCBS_REVISION_LIMIT_STOP -20 /* Stop packing/unpacking - revision limit */ +#define CSNCBS_NOT_SUPPORTED_IE -21 /* Handling of the unpacked IE is not supported by MS-software */ + + + +#ifndef ElementsOf +#define ElementsOf(array) (sizeof(array) / sizeof(array[0])) +#endif + +/* Context holding CSN1 parameters */ +typedef struct +{ + gint remaining_bits_len; /* IN to an csn stream operation */ + gint bit_offset; /* IN/OUT to an csn stream operation */ + gint direction; /* 0 - decode; 1 - encode */ +} csnStream_t; + +typedef gint16 (*StreamSerializeFcn_t)(csnStream_t* ar, bitvec *vector, size_t& readIndex, void* data); +typedef enum +{ + CSN_END = 0, + CSN_BIT, + CSN_UINT, + CSN_TYPE, + CSN_CHOICE, + CSN_UNION, + CSN_UNION_LH, + CSN_UINT_ARRAY, + CSN_TYPE_ARRAY, + CSN_BITMAP, /* Bitmap with constant: */ + CSN_VARIABLE_BITMAP, /* */ + CSN_VARIABLE_BITMAP_1, /* i.e. to the end of message (R99) */ + CSN_LEFT_ALIGNED_VAR_BMP, /* As variable bitmap but the result is left aligned (R99) */ + CSN_LEFT_ALIGNED_VAR_BMP_1,/* As above only size is to the end of message (R99) */ + CSN_VARIABLE_ARRAY, /* Array with length specified in parameter: */ + CSN_VARIABLE_TARRAY, /* Type Array with length specified in parameter: *N */ + CSN_VARIABLE_TARRAY_OFFSET,/* As above but with offset. The offset is stored as third parameter of CSN_DESCR (descr.value) */ + CSN_RECURSIVE_ARRAY, /* Recursive way to specify an array of uint: ::= {1 |0}; */ + CSN_RECURSIVE_TARRAY, /* Recursive way to specify an array of type: ::= {1 } ** 0 ; */ + CSN_RECURSIVE_TARRAY_1, /* same as above but first element always exist: ::= {1 } ** 0 ; */ + CSN_RECURSIVE_TARRAY_2, /* same as above but with reversed separators : ::= { 0 } ** 1 ; */ + CSN_EXIST, + CSN_EXIST_LH, + CSN_NEXT_EXIST, + CSN_NEXT_EXIST_LH, + CSN_NULL, + CSN_FIXED, + CSN_CALLBACK, + CSN_UINT_OFFSET, /* unpack will add offset, inverse pack will subtract offset */ + CSN_UINT_LH, /* Low High extraction of int */ + CSN_SERIALIZE, + CSN_TRAP_ERROR +} csn_type_t; + +/****************************************************************************************** + * CSN_DESCR structure: + * + * type: + * This is the CSN type. All existing types are specified in the section above. + * + * i: + * Depending on the contents of the type parameter, the parameter "i" may have following meaning: + * - specifies the number of bits for the CSN_UINT type + * - the offset for an array size by which the size is incremented + * for the CSN_VAR_ARRAY type + * - the length of each element of an array for the CSN_REC_ARRAY type + * - the number of the elements in an array for the CSN_TYPE_ARRAY type + * - the offset to the variable keeping the number of elements of an array for in the CSN_VAR_TARRAY type + * - the number of different data types in a union for the CSN_UNION, CSN_UNION_LH, and for the CSN_CHOICE types + * - the length in bits of the fixed number defined for the CSN_FIXED type + * - the number of lines to skip in the CSN_DESCR type specified for the CSN_NEXT_EXIST, CSN_NEXT_EXIST_LH, + * CSN_NEXT_EXIST_OR_NULL, and CSN_NEXT_EXIST_OR_NULL_LH types + * - the number of bits in a bitmap for the CSN_BITMAP type + * - the value by which the number of bits in a bitmap has to be incremented or decremented for the + * CSN_VAR_BITMAP, CSN_LEFT_VAR_BMP, and CSN_LEFT_BMP_1 types + * - the offset to param1 for the CSN_CALLBACK type + * - ERRORCODE used by the CSN_ERROR type + * + * descr + * This parameter has different meaning depending on the value of the type parameter: + * - the offset for the CSN_UINT_OFFSET type + * - the number of the elements in an array of the CSN_UINT_ARRAY type + * - the offset to the parameter where the size of the array has to be stored for the CSN_REC_ARRAY type + * - the address of the internal structure, describing the member type (by means of the CSN_DESCR type) in the + * CSN_TYPE_ARRAY, CSN_VAR_TARRAY, and CSN_TYPE types + * - the address of the variable of type CSN_ChoiceElement_t describing all elements in the CSN_CHOICE type union + * - the offset to the variable where the number of bits has to be or is stored for the CSN_VAR_BITMAP, + * CSN_LEFT_VAR_BMP, and CSN_LEFT_BMP_1 types + * - the function number (case number) for the CSN_CALLBACK and CSN_CALLBACK_NO_ARGS types + * - the free text used by the CSN_TRAP_ERROR + * + * offset + * This is an offset to the _MEMBER parameter counting from the beginning of struct + * where the unpacked or packed value shall be stored or fetched. The meaning of the _MEMBER parameter + * varies depending on the type which is specified and so is the meaning of the offset parameter. + * Some types (and corresponding macros) do not have the _MEMBER parameter and then the offset parameter + * is not used or is different from the offset to the _MEMBER. + * - the fixed value for the CSN_FIXED type + * - an offset to the variable UnionType for CSN_UNION and CSN_UNION_LH types + * - an offset to the variable Exist for CSN_NEXT_EXIST and CSN_NEXT_EXIST_LH types + * - an offset to param2 in the CSN_CALLBACK type + * + * sz + * - is the name of the parameter within the descr where their unpacked or packed value shall be stored or fetched. + * This paramater is pointed out by the offset parameter in the same CSN_DESCR variable as the sz. + * - the free text used by the CSN_TRAP_ERROR (the same as parameter "i") + * + * serialize + * - stores the size of _MEMBER type in case of the M_TYPE_ARRAY and M_VAR_TARRAY, + * - the address of the function which is provided by the M_SERIALIZE type. + ******************************************************************************************/ + + +typedef struct +{ + gint16 type; + gint16 i; + union + { + void* ptr; + guint32 value; + } descr; + size_t offset; + const char* sz; + union + { + StreamSerializeFcn_t fcn; + guint32 value; + int* hf_ptr; + } serialize; +} CSN_DESCR; + +typedef struct +{ + guint8 bits; + guint8 value; + CSN_DESCR descr; +} CSN_ChoiceElement_t; + +void csnStreamInit(csnStream_t* ar,gint BitOffset,gint BitCount); + +/****************************************************************************** +* FUNCTION: csnStreamDecoder +* DESCRIPTION: +* UnPacks data from bit stream. According to CSN description. +* ARGS: +* ar stream will hold the parameters to the pack function +* ar->remaining_bits_len [IN] Number of bits to unpack [OUT] number of bits left to unpack. +* ar->bit_offset [IN/OUT] is the current bit where to proceed with the next bit to unpack. + +* pDescr CSN description. +* tvb buffer containing the bit stream to unpack. +* data unpacked data. +* ett_csn1 tree +* +* RETURNS: int Number of bits left to be unpacked. Negative Error code if failed to unpack all bits +******************************************************************************/ + +gint16 csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector, size_t& readIndex, void* data); + +gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector, size_t& readIndex, void* data); + +/* CSN struct macro's */ +#define CSN_DESCR_BEGIN(_STRUCT)\ + CSN_DESCR CSNDESCR_##_STRUCT[] = { + +#define CSN_DESCR_END(_STRUCT)\ + {CSN_END, 0, {0}, 0, "", {(StreamSerializeFcn_t)0}} }; + +/****************************************************************************** + * CSN_ERROR(Par1, Par2, Par3) + * May be called at any time when an abort of packing or unpacking of a message + * is desired + * Par1: C structure name + * Par2: free text which will appear in the error handler + * Par3: Error code + *****************************************************************************/ +#define CSN_ERROR(_STRUCT, _Text, _ERRCODE)\ + {CSN_TRAP_ERROR, _ERRCODE, {(void*)_Text}, 0, _Text, {(StreamSerializeFcn_t)0}} + +/****************************************************************************** + * M_BIT(Par1, Par2) + * Defines one bit element in the CSN1 syntax. + * Par1: C structure name + * Par2: C structure element name + *****************************************************************************/ +#define M_BIT(_STRUCT, _MEMBER)\ + {CSN_BIT, 0, {0}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} + +/****************************************************************************** + * M_NEXT_EXIST(Par1, Par2, Par3) + * Indicates whether the next element or a group of elements defined in the + * structure is present or not. + * Par1: C structure name + * Par2: C structure element name + * Par3: number of lines to skip in the CSN_DESCR type specified if the + * element(s) does not exist + *****************************************************************************/ +#define M_NEXT_EXIST(_STRUCT, _MEMBER, _NoOfExisting)\ + {CSN_NEXT_EXIST, _NoOfExisting, {0}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} + +/****************************************************************************** + * M_NEXT_EXIST_LH(Par1, Par2, Par3) + * similar to the M_NEXT_EXIST except that instead of bit 0/1 which is fetched + * from the message in order to find out whether the next element/elements are + * present in the message, the logical operation XOR with the background + * pattern 0x2B is performed on the read bit before the decision is made. + *****************************************************************************/ +#define M_NEXT_EXIST_LH(_STRUCT, _MEMBER, _NoOfExisting)\ + {CSN_NEXT_EXIST_LH, _NoOfExisting, {0}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} + +/****************************************************************************** + * M_NEXT_EXIST_OR_NULL(Par1, Par2, Par3) + * Similar to the M_NEXT_EXIST except that not only bit 0 or 1 but also the end + * of the message may be encountered when looking for the next element in the + * message. + * Covers the case {null | 0 | 1 < IE >} + *****************************************************************************/ +#define M_NEXT_EXIST_OR_NULL(_STRUCT, _MEMBER, _NoOfExisting)\ + {CSN_NEXT_EXIST, _NoOfExisting, {(void*)1}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} + +/****************************************************************************** + * M_NEXT_EXIST_OR_NULL_LH(Par1, Par2, Par3) + * Similar to the M_NEXT_EXIST_LH except that not only bit 0 or 1 but also the + * end of the message may be encountered when looking for the next element in + * the message. + * Covers the case {null | L | H < IE >} + *****************************************************************************/ +#define M_NEXT_EXIST_OR_NULL_LH(_STRUCT, _MEMBER, _NoOfExisting)\ + {CSN_NEXT_EXIST_LH, _NoOfExisting, {(void*)1}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} + +/****************************************************************************** + * M_UINT(Par1, Par2, Par3) + * Defines an integer number. + * Par1: C structure name + * Par2: C structure element name + * Par3: number of bits used to code the element (between 1 and 32) + *****************************************************************************/ +#define M_UINT(_STRUCT, _MEMBER, _BITS)\ + {CSN_UINT, _BITS, {(void*)1}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} + +/****************************************************************************** + * M_UINT(Par1, Par2, Par3) + * This macro has the same functionality as M_UINT except that in addition the + * logical "exclusive or" operation with the background value "0x2B" is + * performed before the final value of the integer number is delivered from the + * received CSN.1 message + *****************************************************************************/ +#define M_UINT_LH(_STRUCT, _MEMBER, _BITS)\ + {CSN_UINT_LH, _BITS, {(void*)1}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} + +/****************************************************************************** + * M_UINT_OFFSET(Par1, Par2, Par3, Par4) + * Defines an integer number. + * Par1: C structure name + * Par2: C structure element name + * Par3: number of bits used to code the element (between 1 and 32) + * Par4: value added to the returned integer (offset) + *****************************************************************************/ +#define M_UINT_OFFSET(_STRUCT, _MEMBER, _BITS, _OFFSET)\ + {CSN_UINT_OFFSET, _BITS, {(void*)_OFFSET}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} + +/****************************************************************************** + * M_UINT_ARRAY(Par1, Par2, Par3, Par4) + * Defines an array of integer numbers. The size of the array is fixed. + * Par1: C structure name + * Par2: C structure element name + * Par3: number of bits used to code the each integer element (between 1 and 32) + * Par4: number of elements in the array (fixed integer value) + *****************************************************************************/ +#define M_UINT_ARRAY(_STRUCT, _MEMBER, _BITS, _ElementCount)\ + {CSN_UINT_ARRAY, _BITS, {(void*)_ElementCount}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} + +/****************************************************************************** + * M_VAR_UINT_ARRAY(Par1, Par2, Par3, Par4) + * Defines an array of integer numbers. The size of the array is variable. + * Par1: C structure name + * Par2: C structure element name + * Par3: number of bits used to code the each integer element (between 1 and 32) + * Par4: number of elements in the array supplied by reference to the + * structure member holding the length value + *****************************************************************************/ +#define M_VAR_UINT_ARRAY(_STRUCT, _MEMBER, _BITS, _ElementCountField)\ + {CSN_UINT_ARRAY, _BITS, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)1}} + +/****************************************************************************** + * M_VAR_ARRAY(Par1, Par2, Par3, Par4) + * Defines an array of 8 bit large integer numbers. The size of the array is variable. + * Par1: C structure name + * Par2: C structure element name + * Par3: name of the structure member holding the size of the array + * Par4: offset that is added to the Par3 to get the actual size of the array + *****************************************************************************/ +#define M_VAR_ARRAY(_STRUCT, _MEMBER, _ElementCountField, _OFFSET)\ + {CSN_VARIABLE_ARRAY, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} + +/****************************************************************************** + * M_VAR_TARRAY(Par1, Par2, Par3, Par4) + * Similar to M_TYPE_ARRAY except that the size of the array is variable. + * Par1: C structure name + * Par2: C structure element name + * Par3: the type of each element of the array + * Par4: name of the structure member holding the size of the array + *****************************************************************************/ +#define M_VAR_TARRAY(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField)\ + {CSN_VARIABLE_TARRAY, offsetof(_STRUCT, _ElementCountField), {(void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)sizeof(_MEMBER_TYPE)}} + +/****************************************************************************** + * M_VAR_TARRAY_OFFSET(Par1, Par2, Par3, Par4) + * Same as M_VAR_TARRAY with offset + *****************************************************************************/ +#define M_VAR_TARRAY_OFFSET(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField)\ + {CSN_VARIABLE_TARRAY_OFFSET, offsetof(_STRUCT, _ElementCountField), {(void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)sizeof(_MEMBER_TYPE)}} + +/****************************************************************************** + * M_REC_ARRAY(Par1, Par2, Par3, Par4) + * similar to the M_VAR_ARRAY. The difference is that the size of the array is + * not known in advance and it has to be calculated during unpacking. Its value + * is stored in a variable which belongs to the same structure as the array. + * A zero element terminates the array. The CSN.1 syntax describes it + * recursively as: + * ::={1 | 0} + * + * Par1: C structure name + * Par2: C structure element name + * Par3: name of the structure member where the calculated the size of the + * array will be stored + * Par4: length of each element in bits + *****************************************************************************/ +#define M_REC_ARRAY(_STRUCT, _MEMBER, _ElementCountField, _BITS)\ + {CSN_RECURSIVE_ARRAY, _BITS, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} + +/****************************************************************************** + * M_VAR_TYPE_ARRAY(Par1, Par2, Par3, Par4) + * Defines an array of structures. The size of the array is variable. + * Par1: C structure name + * Par2: C structure element name + * Par3: name of the structure + * Par4: number of elements in the array (fixed integer value) + *****************************************************************************/ +#define M_TYPE_ARRAY(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCount)\ + {CSN_TYPE_ARRAY, _ElementCount, {(void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)sizeof(_MEMBER_TYPE)}} + +/****************************************************************************** + * M_REC_TARRAY(Par1, Par2, Par3, Par4) + * Defines an recursive array of structures. The size of the array is variable. + * ::= {1 } ** 0 ; + * Par1: C structure name + * Par2: C structure element name + * Par3: name of the structure + * Par4: will hold the number of element in the array after unpacking + *****************************************************************************/ +#define M_REC_TARRAY(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField)\ + {CSN_RECURSIVE_TARRAY, offsetof(_STRUCT, _ElementCountField), {(void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)sizeof(_MEMBER_TYPE)}} + +/****************************************************************************** + * M_REC_TARRAY1(Par1, Par2, Par3, Par4) + * Same as M_REC_TARRAY but first element always exist: + * ::= {1 } ** 0 ; + *****************************************************************************/ +#define M_REC_TARRAY_1(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField)\ + {CSN_RECURSIVE_TARRAY_1, offsetof(_STRUCT, _ElementCountField), {(void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)sizeof(_MEMBER_TYPE)}} + +/****************************************************************************** + * M_REC_TARRAY2(Par1, Par2, Par3, Par4) + * Same as M_REC_TARRAY but with reversed separators : + * ::= { 0 } ** 1 ; + *****************************************************************************/ +#define M_REC_TARRAY_2(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField)\ + {CSN_RECURSIVE_TARRAY_2, offsetof(_STRUCT, _ElementCountField), {(void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)sizeof(_MEMBER_TYPE)}} + +/****************************************************************************** + * M_TYPE(Par1, Par2, Par3) + * Defines a reference to a structure which is described elsewhere + * ::= {1 } ** 0 ; + * Par1: C structure name + * Par2: C structure element name + * Par3: type of member + *****************************************************************************/ +#define M_TYPE(_STRUCT, _MEMBER, _MEMBER_TYPE)\ + {CSN_TYPE, 0, {(void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} + +/****************************************************************************** + * M_UNION(Par1, Par2) + * Informs the CSN.1 library that a union follows and how many possible choices + * there are in the union. The actual value of the choice, which points out the + * chosen element of the union is stored in the uint8 variable and is usually + * called UnionType. The elements of the union have to be listed directly after + * the M_UNION statement. + * Par1: C structure name + * Par2: number of possible choice in the union + *****************************************************************************/ +#define M_UNION(_STRUCT, _COUNT)\ + {CSN_UNION, _COUNT, {0}, offsetof(_STRUCT, UnionType), "UnionType", {(StreamSerializeFcn_t)0}} + +/****************************************************************************** + * M_UNION_LH(Par1, Par2) + * Same as M_UNION but masked with background value 0x2B + *****************************************************************************/ +#define M_UNION_LH(_STRUCT, _COUNT)\ + {CSN_UNION_LH, _COUNT, {0}, offsetof(_STRUCT, UnionType), "UnionType", {(StreamSerializeFcn_t)0}} + +/****************************************************************************** + * M_CHOICE(Par1, Par2, Par3, Par4) + * Similar to the M_UNION. In the M_UNION the selected element of all possible + * choices in the union is referred as a sequential numbers, i.e., the first + * choice is addressed as choice 0 the second as choice 1, the third as choice + * 2 and so on, both in the encoded message and in the variable UnionType which + * is the part of the message. In the CSN_CHOICE case, this rule does not + * apply. There is free but predefined mapping of the element of the union and + * the value which addresses this element. + * The value of the address is called a selector. + * After unpacking, this value is then converted to the sequential number of the + * element in the union and stored in the UnionType variable. + * Par1: C structure name + * Par2: C structure element name + * Par3: address of an array of type CSN_ChoiceElement_t where all possible + * values of the selector are provided, together with the selector + * length expressed in bits and the address of the CSN_DESCR type + * where the element is defined. For every element in the union + * there is one line in the Choice variable. These lines have to + * appear in the _CHOICE in the same order as the elements in the + * union. The element of the union selected in the message through + * the _CHOICE parameter is after unpacking translated to the + * corresponding sequential number of this element and stored in + * the variable pointed out by the _MEMBER + * Par4: number of possible choices in the union + *****************************************************************************/ +#define M_CHOICE(_STRUCT, _MEMBER, _CHOICE, _ElementCount)\ + {CSN_CHOICE, _ElementCount, {(void*)_CHOICE}, offsetof(_STRUCT, _MEMBER), #_CHOICE, {(StreamSerializeFcn_t)0}} + +/****************************************************************************** + * M_FIXED(Par1, Par2, Par3) + * Defines a fixed value of type integer which should be fetched from or stored + * in the message + * Par1: C structure name + * Par2: gives the length of the fixed number in bits. + * Par3: the value of the number. If the expected value is not present in +* the message the unpacking procedure is aborted + *****************************************************************************/ +#define M_FIXED(_STRUCT, _BITS, _BITVALUE)\ + {CSN_FIXED, _BITS, {0}, _BITVALUE, #_BITVALUE, {(StreamSerializeFcn_t)0}} + +/****************************************************************************** + * M_SERIALIZE(Par1, Par2, Par3) + * Allows using a complete free format of data being encoded or decoded. + * When the M_SERIALIZE is uncounted during encoding or decoding of a message + * the CSNstream program passes the control over to the specified function + * together with all necessary parameters about the current position within + * the message being unpacked or packed. When transferring of "serialized" + * data to or from the message is finished by the function the CSNstream gets + * back control over the data stream and continues to work with the message. + *****************************************************************************/ +#define M_SERIALIZE(_STRUCT, _MEMBER, _SERIALIZEFCN)\ + {CSN_SERIALIZE, 1, {0}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {_SERIALIZEFCN}} + +#define M_CALLBACK(_STRUCT, _CSNCALLBACKFCN, _PARAM1, _PARAM2)\ + {CSN_CALLBACK, offsetof(_STRUCT, _PARAM1), {_CSNCALLBACKFCN}, offsetof(_STRUCT, _PARAM2), "CallBack_"#_CSNCALLBACKFCN, {(StreamSerializeFcn_t)0}} + +/****************************************************************************** + * M_BITMAP(Par1, Par2, Par3) + * Defines a type which consists of a bitmap. The size of the bitmap in bits + * is fixed and provided by the parameter Par3 + * Par1: C structure name + * Par2: C structure element name + * Par3: length of the bitmap expressed in bits + *****************************************************************************/ +#define M_BITMAP(_STRUCT, _MEMBER, _BITS)\ + {CSN_BITMAP, _BITS, {0}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} + +/* variable length, right aligned bitmap i.e. _ElementCountField = 11 => 00000111 11111111 */ +#define M_VAR_BITMAP(_STRUCT, _MEMBER, _ElementCountField, _OFFSET)\ + {CSN_VARIABLE_BITMAP, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} + +/* variable length, right aligned bitmap filling the rest of message + * - when unpacking the _ElementCountField will be set in runtime + * - when packing _ElementCountField contains the size of bitmap + */ +#define M_VAR_BITMAP_1(_STRUCT, _MEMBER, _ElementCountField, _OFFSET)\ + {CSN_VARIABLE_BITMAP_1, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} + +/* variable length, left aligned bitmap i.e. _ElementCountField = 11 => 11111111 11100000 */ +#define M_LEFT_VAR_BMP(_STRUCT, _MEMBER, _ElementCountField, _OFFSET)\ + {CSN_LEFT_ALIGNED_VAR_BMP, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} + +/* variable length, left aligned bitmap filling the rest of message + *- when unpacking the _ElementCountField will be set in runtime + * - when packing _ElementCountField contains the size of bitmap + */ +#define M_LEFT_VAR_BMP_1(_STRUCT, _MEMBER, _ElementCountField, _OFFSET)\ + {CSN_LEFT_ALIGNED_VAR_BMP_1, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} + +#define M_NULL(_STRUCT, _MEMBER)\ + {CSN_NULL, 0, {0}, offsetof(_STRUCT, _MEMBER), #_MEMBER, {(StreamSerializeFcn_t)0}} + +#define M_THIS_EXIST(_STRUCT)\ + {CSN_EXIST, 0, {0}, offsetof(_STRUCT, Exist), "Exist", {(StreamSerializeFcn_t)0}} + +#define M_THIS_EXIST_LH(_STRUCT)\ + {CSN_EXIST_LH, 0, {0}, offsetof(_STRUCT, Exist), "Exist", {(StreamSerializeFcn_t)0}} + +/* return value 0 if ok else discontionue the unpacking */ +typedef gint16 (*CsnCallBackFcn_t)(void* pv ,...); + +#define CSNDESCR(_FuncType) CSNDESCR_##_FuncType + +#endif /*_PACKET_CSN1_H_*/ diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp new file mode 100644 index 00000000..f0f71d89 --- /dev/null +++ b/src/gprs_bssgp_pcu.cpp @@ -0,0 +1,244 @@ +/* gprs_bssgp_pcu.cpp + * + * Copyright (C) 2012 Ivan Klyuchnikov + * + * 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. + */ + +#include +#include +#include + +struct sgsn_instance *sgsn; +void *tall_bsc_ctx; +struct bssgp_bvc_ctx *bctx = btsctx_alloc(BVCI, NSEI); + +int gprs_bssgp_pcu_rx_dl_ud(struct msgb *msg, struct tlv_parsed *tp) +{ + struct bssgp_ud_hdr *budh; + int tfi; + int i = 0; + + budh = (struct bssgp_ud_hdr *)msgb_bssgph(msg); + struct gprs_rlcmac_tbf *tbf; + // Create new TBF + tfi = tfi_alloc(); + if (tfi < 0) { + return tfi; + } + tbf = tbf_alloc(tfi); + tbf->direction = GPRS_RLCMAC_DL_TBF; + tbf->state = GPRS_RLCMAC_WAIT_DATA_SEQ_START; + tbf->tlli = ntohl(budh->tlli); + LOGP(DRLCMAC, LOGL_NOTICE, "TBF: [DOWNLINK] START TFI: %u TLLI: 0x%08x \n", tbf->tfi, tbf->tlli); + + /* LLC_PDU is mandatory IE */ + if (!TLVP_PRESENT(tp, BSSGP_IE_LLC_PDU)) + { + LOGP(DBSSGP, LOGL_ERROR, "BSSGP TLLI=0x%08x Rx UL-UD missing mandatory IE\n", tbf->tlli); + return bssgp_tx_status(BSSGP_CAUSE_MISSING_MAND_IE, NULL, msg); + } + + uint8_t *llc_pdu = (uint8_t *) TLVP_VAL(tp, BSSGP_IE_LLC_PDU); + tbf->data_index = TLVP_LEN(tp, BSSGP_IE_LLC_PDU); + + LOGP(DBSSGP, LOGL_NOTICE, "LLC PDU = "); + for (i = 0; i < tbf->data_index; i++) + { + tbf->rlc_data[i] = llc_pdu[i]; + LOGPC(DBSSGP, LOGL_NOTICE, "%02x", tbf->rlc_data[i]); + } + + uint16_t imsi_len = 0; + uint8_t *imsi; + if (TLVP_PRESENT(tp, BSSGP_IE_IMSI)) + { + imsi_len = TLVP_LEN(tp, BSSGP_IE_IMSI); + imsi = (uint8_t *) TLVP_VAL(tp, BSSGP_IE_IMSI); + + LOGPC(DBSSGP, LOGL_NOTICE, " IMSI = "); + for (i = 0; i < imsi_len; i++) + { + LOGPC(DBSSGP, LOGL_NOTICE, "%02x", imsi[i]); + } + LOGPC(DBSSGP, LOGL_NOTICE, "\n"); + } + + gsmtap_send_llc(tbf->rlc_data,tbf->data_index); + gprs_rlcmac_packet_downlink_assignment(tbf); + +} +/* Receive a BSSGP PDU from a BSS on a PTP BVCI */ +int gprs_bssgp_pcu_rx_ptp(struct msgb *msg, struct tlv_parsed *tp, struct bssgp_bvc_ctx *bctx) +{ + struct bssgp_normal_hdr *bgph = (struct bssgp_normal_hdr *) msgb_bssgph(msg); + uint8_t pdu_type = bgph->pdu_type; + unsigned rc = 0; + + /* If traffic is received on a BVC that is marked as blocked, the + * received PDU shall not be accepted and a STATUS PDU (Cause value: + * BVC Blocked) shall be sent to the peer entity on the signalling BVC */ + if (bctx->state & BVC_S_BLOCKED && pdu_type != BSSGP_PDUT_STATUS) + { + uint16_t bvci = msgb_bvci(msg); + LOGP(DBSSGP, LOGL_NOTICE, "rx BVC_S_BLOCKED\n"); + return bssgp_tx_status(BSSGP_CAUSE_BVCI_BLOCKED, &bvci, msg); + } + + switch (pdu_type) { + case BSSGP_PDUT_DL_UNITDATA: + LOGP(DBSSGP, LOGL_NOTICE, "RX: [SGSN->PCU] BSSGP_PDUT_DL_UNITDATA\n"); + gprs_bssgp_pcu_rx_dl_ud(msg, tp); + break; + case BSSGP_PDUT_PAGING_PS: + LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_PAGING_PS\n"); + break; + case BSSGP_PDUT_PAGING_CS: + LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_PAGING_CS\n"); + break; + case BSSGP_PDUT_RA_CAPA_UPDATE_ACK: + LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_RA_CAPA_UPDATE_ACK\n"); + break; + case BSSGP_PDUT_FLOW_CONTROL_BVC_ACK: + LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_FLOW_CONTROL_BVC_ACK\n"); + break; + case BSSGP_PDUT_FLOW_CONTROL_MS_ACK: + LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_FLOW_CONTROL_MS_ACK\n"); + break; + default: + DEBUGP(DBSSGP, "BSSGP BVCI=%u PDU type 0x%02x unknown\n", bctx->bvci, pdu_type); + rc = bssgp_tx_status(BSSGP_CAUSE_PROTO_ERR_UNSPEC, NULL, msg); + break; + } + return rc; +} + +/* Receive a BSSGP PDU from a SGSN on a SIGNALLING BVCI */ +int gprs_bssgp_pcu_rx_sign(struct msgb *msg, struct tlv_parsed *tp, struct bssgp_bvc_ctx *bctx) +{ + struct bssgp_normal_hdr *bgph = (struct bssgp_normal_hdr *) msgb_bssgph(msg); + int rc = 0; + switch (bgph->pdu_type) { + case BSSGP_PDUT_STATUS: + /* Some exception has occurred */ + DEBUGP(DBSSGP, "BSSGP BVCI=%u Rx BVC STATUS\n", bctx->bvci); + /* FIXME: send NM_STATUS.ind to NM */ + break; + case BSSGP_PDUT_SUSPEND_ACK: + LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_SUSPEND_ACK\n"); + break; + case BSSGP_PDUT_SUSPEND_NACK: + LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_SUSPEND_NACK\n"); + break; + case BSSGP_PDUT_BVC_RESET_ACK: + LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_BVC_RESET_ACK\n"); + break; + case BSSGP_PDUT_PAGING_PS: + LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_PAGING_PS\n"); + break; + case BSSGP_PDUT_PAGING_CS: + LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_PAGING_CS\n"); + break; + case BSSGP_PDUT_RESUME_ACK: + LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_RESUME_ACK\n"); + break; + case BSSGP_PDUT_RESUME_NACK: + LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_RESUME_NACK\n"); + break; + case BSSGP_PDUT_FLUSH_LL: + LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_FLUSH_LL\n"); + break; + case BSSGP_PDUT_BVC_BLOCK_ACK: + LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_SUSPEND_ACK\n"); + break; + case BSSGP_PDUT_BVC_UNBLOCK_ACK: + LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_BVC_UNBLOCK_ACK\n"); + break; + case BSSGP_PDUT_SGSN_INVOKE_TRACE: + LOGP(DBSSGP, LOGL_NOTICE, "rx BSSGP_PDUT_SGSN_INVOKE_TRACE\n"); + break; + default: + DEBUGP(DBSSGP, "BSSGP BVCI=%u Rx PDU type 0x%02x unknown\n", bctx->bvci, bgph->pdu_type); + rc = bssgp_tx_status(BSSGP_CAUSE_PROTO_ERR_UNSPEC, NULL, msg); + break; + } + return rc; +} + +int gprs_bssgp_pcu_rcvmsg(struct msgb *msg) +{ + struct bssgp_normal_hdr *bgph = (struct bssgp_normal_hdr *) msgb_bssgph(msg); + struct bssgp_ud_hdr *budh = (struct bssgp_ud_hdr *) msgb_bssgph(msg); + struct tlv_parsed tp; + uint8_t pdu_type = bgph->pdu_type; + uint16_t ns_bvci = msgb_bvci(msg); + int data_len; + int rc = 0; + + /* Identifiers from DOWN: NSEI, BVCI (both in msg->cb) */ + + /* UNITDATA BSSGP headers have TLLI in front */ + if (pdu_type != BSSGP_PDUT_UL_UNITDATA && pdu_type != BSSGP_PDUT_DL_UNITDATA) + { + data_len = msgb_bssgp_len(msg) - sizeof(*bgph); + rc = bssgp_tlv_parse(&tp, bgph->data, data_len); + } + else + { + data_len = msgb_bssgp_len(msg) - sizeof(*budh); + rc = bssgp_tlv_parse(&tp, budh->data, data_len); + } + + /* look-up or create the BTS context for this BVC */ + bctx = btsctx_by_bvci_nsei(ns_bvci, msgb_nsei(msg)); + + /* Only a RESET PDU can create a new BVC context */ + if (!bctx) + { + bctx = btsctx_alloc(ns_bvci, msgb_nsei(msg)); + } + + if (!bctx && pdu_type != BSSGP_PDUT_BVC_RESET_ACK) + { + LOGP(DBSSGP, LOGL_NOTICE, "NSEI=%u/BVCI=%u Rejecting PDU " + "type %u for unknown BVCI\n", msgb_nsei(msg), ns_bvci, + pdu_type); + return bssgp_tx_status(BSSGP_CAUSE_UNKNOWN_BVCI, NULL, msg); + } + + if (bctx) + { + log_set_context(BSC_CTX_BVC, bctx); + rate_ctr_inc(&bctx->ctrg->ctr[BSSGP_CTR_PKTS_IN]); + rate_ctr_add(&bctx->ctrg->ctr[BSSGP_CTR_BYTES_IN], msgb_bssgp_len(msg)); + } + + if (ns_bvci == BVCI_SIGNALLING) + { + LOGP(DBSSGP, LOGL_NOTICE, "rx BVCI_SIGNALLING gprs_bssgp_rx_sign\n"); + rc = gprs_bssgp_pcu_rx_sign(msg, &tp, bctx); + } + else if (ns_bvci == BVCI_PTM) + { + LOGP(DBSSGP, LOGL_NOTICE, "rx BVCI_PTM bssgp_tx_status\n"); + rc = bssgp_tx_status(BSSGP_CAUSE_PDU_INCOMP_FEAT, NULL, msg); + } + else + { + LOGP(DBSSGP, LOGL_NOTICE, "rx BVCI_PTP gprs_bssgp_rx_ptp\n"); + rc = gprs_bssgp_pcu_rx_ptp(msg, &tp, bctx); + } + return rc; +} diff --git a/src/gprs_bssgp_pcu.h b/src/gprs_bssgp_pcu.h new file mode 100644 index 00000000..02d85ce9 --- /dev/null +++ b/src/gprs_bssgp_pcu.h @@ -0,0 +1,69 @@ +/* gprs_bssgp_pcu.h + * + * Copyright (C) 2012 Ivan Klyuchnikov + * + * 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. + */ + +#ifndef GPRS_BSSGP_PCU_H +#define GPRS_BSSGP_PCU_H + + +extern "C" { +#include +#include +#include +#include +#include +#include +#include + +int bssgp_tx_bvc_reset(struct bssgp_bvc_ctx *bctx, uint16_t bvci, uint8_t cause); + +int bssgp_tx_ul_ud(struct bssgp_bvc_ctx *bctx, uint32_t tlli, const uint8_t *qos_profile, struct msgb *llc_pdu); + +struct bssgp_bvc_ctx *btsctx_alloc(uint16_t bvci, uint16_t nsei); +} +#include + +#define BVCI 7 +#define NSEI 3 + +#define QOS_PROFILE 0 +#define BSSGP_HDR_LEN 53 +#define NS_HDR_LEN 4 +#define MAX_LEN_PDU 60 +#define IE_LLC_PDU 14 +#define BLOCK_DATA_LEN 20 +#define BLOCK_LEN 23 + +#define CELL_ID 3 +#define MNC 55 +#define MCC 905 +#define PCU_LAC 1000 +#define PCU_RAC 1 + + +extern struct bssgp_bvc_ctx *bctx; + +int gprs_bssgp_pcu_rx_dl_ud(struct msgb *msg, struct tlv_parsed *tp); + +int gprs_bssgp_pcu_rx_ptp(struct msgb *msg, struct tlv_parsed *tp, struct bssgp_bvc_ctx *bctx); + +int gprs_bssgp_pcu_rx_sign(struct msgb *msg, struct tlv_parsed *tp, struct bssgp_bvc_ctx *bctx); + +int gprs_bssgp_pcu_rcvmsg(struct msgb *msg); + +#endif // GPRS_BSSGP_PCU_H diff --git a/src/gprs_debug.cpp b/src/gprs_debug.cpp new file mode 100644 index 00000000..479e9886 --- /dev/null +++ b/src/gprs_debug.cpp @@ -0,0 +1,81 @@ +/* gprs_debug.cpp + * + * Copyright (C) 2012 Ivan Klyuchnikov + * + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/* default categories */ + +static const struct log_info_cat default_categories[] = { + {"DCSN1", "\033[1;31m", "Concrete Syntax Notation One (CSN1)", LOGL_NOTICE, 1}, + {"DL1IF", "\033[1;32m", "GPRS PCU L1 interface (L1IF)", LOGL_NOTICE, 1}, + {"DRLCMAC", "\033[1;33m", "GPRS RLC/MAC layer (RLCMAC)", LOGL_NOTICE, 1}, + {"DRLCMACDATA", "\033[1;36m", "GPRS RLC/MAC layer Data (RLCMAC)", LOGL_NOTICE, 1}, + {"DBSSGP", "\033[1;34m", "GPRS BSS Gateway Protocol (BSSGP)", LOGL_NOTICE , 1}, + {"DPCU", "\033[1;35m", "GPRS Packet Control Unit (PCU)", LOGL_NOTICE, 1} +}; + +enum { + _FLT_ALL = LOG_FILTER_ALL, /* libosmocore */ + FLT_IMSI = 1, + FLT_NSVC = 2, + FLT_BVC = 3, +}; + +static int filter_fn(const struct log_context *ctx, + struct log_target *tar) +{ + struct gsm_subscriber *subscr = (struct gsm_subscriber*)ctx->ctx[BSC_CTX_SUBSCR]; + const struct gprs_nsvc *nsvc = (const struct gprs_nsvc*)ctx->ctx[BSC_CTX_NSVC]; + const struct gprs_nsvc *bvc = (const struct gprs_nsvc*)ctx->ctx[BSC_CTX_BVC]; + + if ((tar->filter_map & (1 << FLT_IMSI)) != 0 + && subscr && strcmp(subscr->imsi, (const char*)tar->filter_data[FLT_IMSI]) == 0) + return 1; + + /* Filter on the NS Virtual Connection */ + if ((tar->filter_map & (1 << FLT_NSVC)) != 0 + && nsvc && (nsvc == tar->filter_data[FLT_NSVC])) + return 1; + + /* Filter on the BVC */ + if ((tar->filter_map & (1 << FLT_BVC)) != 0 + && bvc && (bvc == tar->filter_data[FLT_BVC])) + return 1; + + return 0; +} + +const struct log_info gprs_log_info = { + filter_fn, + (struct log_info_cat*)default_categories, + ARRAY_SIZE(default_categories), +}; diff --git a/src/gprs_debug.h b/src/gprs_debug.h new file mode 100644 index 00000000..ee95e19d --- /dev/null +++ b/src/gprs_debug.h @@ -0,0 +1,68 @@ +/* gprs_debug.h + * + * Copyright (C) 2012 Ivan Klyuchnikov + * + * 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. + */ + +#ifndef GPRS_DEBUG_H +#define GPRS_DEBUG_H + +#include +extern "C" { +#include +#include +}; +/* Debug Areas of the code */ +enum { + DCSN1, + DL1IF, + DRLCMAC, + DRLCMACDATA, + DBSSGP, + DPCU, + aDebug_LastEntry +}; + +/* context */ +#define BSC_CTX_SUBSCR 1 +#define BSC_CTX_NSVC 4 +#define BSC_CTX_BVC 5 + +/* target */ + +enum { + //DEBUG_FILTER_ALL = 1 << 0, + LOG_FILTER_IMSI = 1 << 1, + LOG_FILTER_NSVC = 1 << 2, + LOG_FILTER_BVC = 1 << 3, +}; + +/* we don't need a header dependency for this... */ + +struct gprs_nsvc; +struct bssgp_bvc_ctx; + +void log_set_imsi_filter(struct log_target *target, const char *imsi); +void log_set_nsvc_filter(struct log_target *target, + struct gprs_nsvc *nsvc); +void log_set_bvc_filter(struct log_target *target, + struct bssgp_bvc_ctx *bctx); + +extern const struct log_info gprs_log_info; + + + +#endif // GPRS_DEBUG_H diff --git a/src/gprs_rlcmac.cpp b/src/gprs_rlcmac.cpp new file mode 100644 index 00000000..b0aa4a1e --- /dev/null +++ b/src/gprs_rlcmac.cpp @@ -0,0 +1,840 @@ +/* gprs_rlcmac.cpp + * + * Copyright (C) 2012 Ivan Klyuchnikov + * + * 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. + */ + +#include +#include +#include +#include +#include + +LLIST_HEAD(gprs_rlcmac_tbfs); +void *rlcmac_tall_ctx; + +int tfi_alloc() +{ + struct gprs_rlcmac_tbf *tbf; + uint32_t tfi_map = 0; + uint32_t tfi_ind = 0; + uint32_t mask = 1; + uint8_t i; + + llist_for_each_entry(tbf, &gprs_rlcmac_tbfs, list) { + tfi_ind = 1 << tbf->tfi; + tfi_map = tfi_map|tfi_ind; + } + + for (i = 0; i < 32; i++) { + if(((tfi_map >> i) & mask) == 0) { + return i; + } + } + return -1; +} + +/* lookup TBF Entity (by TFI) */ +static struct gprs_rlcmac_tbf *tbf_by_tfi(uint8_t tfi) +{ + struct gprs_rlcmac_tbf *tbf; + + llist_for_each_entry(tbf, &gprs_rlcmac_tbfs, list) { + if (tbf->tfi == tfi) + return tbf; + } + return NULL; +} + +static struct gprs_rlcmac_tbf *tbf_by_tlli(uint32_t tlli) +{ + struct gprs_rlcmac_tbf *tbf; + llist_for_each_entry(tbf, &gprs_rlcmac_tbfs, list) { + if ((tbf->tlli == tlli)&&(tbf->direction == GPRS_RLCMAC_UL_TBF)) + return tbf; + } + return NULL; +} + +struct gprs_rlcmac_tbf *tbf_alloc(uint8_t tfi) +{ + struct gprs_rlcmac_tbf *tbf; + + tbf = talloc_zero(rlcmac_tall_ctx, struct gprs_rlcmac_tbf); + if (!tbf) + return NULL; + + tbf->tfi = tfi; + llist_add(&tbf->list, &gprs_rlcmac_tbfs); + + return tbf; +} + +static void tbf_free(struct gprs_rlcmac_tbf *tbf) +{ + llist_del(&tbf->list); + talloc_free(tbf); +} + + +static void tbf_timer_cb(void *_tbf) +{ + struct gprs_rlcmac_tbf *tbf = (struct gprs_rlcmac_tbf *)_tbf; + + tbf->num_T_exp++; + + switch (tbf->T) { + case 1111: + // TODO: We should add timers for TBF. + break; + default: + COUT("Timer expired in unknown mode" << tbf->T); + } +} + +static void tbf_timer_start(struct gprs_rlcmac_tbf *tbf, unsigned int T, + unsigned int seconds) +{ + if (osmo_timer_pending(&tbf->timer)) + COUT("Starting TBF timer %u while old timer %u pending" << T << tbf->T); + tbf->T = T; + tbf->num_T_exp = 0; + + /* FIXME: we should do this only once ? */ + tbf->timer.data = tbf; + tbf->timer.cb = &tbf_timer_cb; + + osmo_timer_schedule(&tbf->timer, seconds, 0); +} + + +static void tbf_gsm_timer_cb(void *_tbf) +{ + struct gprs_rlcmac_tbf *tbf = (struct gprs_rlcmac_tbf *)_tbf; + + tbf->num_fT_exp++; + + switch (tbf->fT) { + case 0: + // This is timer for delay RLC/MAC data sending after Downlink Immediate Assignment on CCCH. + gprs_rlcmac_segment_llc_pdu(tbf); + LOGP(DRLCMAC, LOGL_NOTICE, "TBF: [DOWNLINK] END TFI: %u TLLI: 0x%08x \n", tbf->tfi, tbf->tlli); + tbf_free(tbf); + break; + default: + COUT("Timer expired in unknown mode" << tbf->fT); + } +} + +static void tbf_gsm_timer_start(struct gprs_rlcmac_tbf *tbf, unsigned int fT, + int frames) +{ + if (osmo_gsm_timer_pending(&tbf->gsm_timer)) + COUT("Starting TBF timer %u while old timer %u pending" << fT << tbf->fT); + tbf->fT = fT; + tbf->num_fT_exp = 0; + + /* FIXME: we should do this only once ? */ + tbf->gsm_timer.data = tbf; + tbf->gsm_timer.cb = &tbf_gsm_timer_cb; + + osmo_gsm_timer_schedule(&tbf->gsm_timer, frames); +} + +void write_packet_downlink_assignment(bitvec * dest, uint8_t tfi, uint32_t tlli, uint8_t tn, uint8_t ta, uint8_t tsc) +{ + // TODO We should use our implementation of encode RLC/MAC Control messages. + unsigned wp = 0; + bitvec_write_field(dest, wp,0x1,2); // Payload Type + bitvec_write_field(dest, wp,0x0,2); // Uplink block with TDMA framenumber + bitvec_write_field(dest, wp,0x1,1); // Suppl/Polling Bit + bitvec_write_field(dest, wp,0x1,3); // Uplink state flag + bitvec_write_field(dest, wp,0x2,6); // MESSAGE TYPE + bitvec_write_field(dest, wp,0x0,2); // Page Mode + + bitvec_write_field(dest, wp,0x0,1); // switch PERSIST_LEVEL: off + bitvec_write_field(dest, wp,0x0,1); // switch TFI : on + bitvec_write_field(dest, wp,0x0,1); // switch UPLINK TFI : on + bitvec_write_field(dest, wp,tfi-1,5); // TFI + + bitvec_write_field(dest, wp,0x0,1); // Message escape + bitvec_write_field(dest, wp,0x0,2); // Medium Access Method: Dynamic Allocation + bitvec_write_field(dest, wp,0x0,1); // RLC acknowledged mode + + bitvec_write_field(dest, wp,0x0,1); // the network establishes no new downlink TBF for the mobile station + bitvec_write_field(dest, wp,0x1,8); // timeslot 7 + + bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_VALUE = on + bitvec_write_field(dest, wp,ta,6); // TIMING_ADVANCE_VALUE + bitvec_write_field(dest, wp,0x0,1); // switch TIMING_ADVANCE_INDEX = off + + bitvec_write_field(dest, wp,0x0,1); // switch POWER CONTROL = off + bitvec_write_field(dest, wp,0x1,1); // Frequency Parameters information elements = present + + bitvec_write_field(dest, wp,tsc,3); // Training Sequence Code (TSC) = 2 + bitvec_write_field(dest, wp,0x0,2); // ARFCN = present + bitvec_write_field(dest, wp,599,10); // ARFCN + + bitvec_write_field(dest, wp,0x1,1); // switch TFI : on + bitvec_write_field(dest, wp,tfi,5);// TFI + + bitvec_write_field(dest, wp,0x1,1); // Power Control Parameters IE = present + bitvec_write_field(dest, wp,0x0,4); // ALPHA power control parameter + bitvec_write_field(dest, wp,0x0,1); // switch GAMMA_TN0 = off + bitvec_write_field(dest, wp,0x0,1); // switch GAMMA_TN1 = off + bitvec_write_field(dest, wp,0x0,1); // switch GAMMA_TN2 = off + bitvec_write_field(dest, wp,0x0,1); // switch GAMMA_TN3 = off + bitvec_write_field(dest, wp,0x0,1); // switch GAMMA_TN4 = off + bitvec_write_field(dest, wp,0x0,1); // switch GAMMA_TN5 = off + bitvec_write_field(dest, wp,0x0,1); // switch GAMMA_TN6 = off + bitvec_write_field(dest, wp,0x1,1); // switch GAMMA_TN7 = on + bitvec_write_field(dest, wp,0x0,5); // GAMMA_TN7 + + bitvec_write_field(dest, wp,0x0,1); // TBF Starting TIME IE not present + bitvec_write_field(dest, wp,0x0,1); // Measurement Mapping struct not present + bitvec_write_field(dest, wp,0x0,1); +} + +void write_packet_uplink_assignment(bitvec * dest, uint8_t tfi, uint32_t tlli) +{ + // TODO We should use our implementation of encode RLC/MAC Control messages. + unsigned wp = 0; + bitvec_write_field(dest, wp,0x1,2); // Payload Type + bitvec_write_field(dest, wp,0x0,2); // Uplink block with TDMA framenumber + bitvec_write_field(dest, wp,0x1,1); // Suppl/Polling Bit + bitvec_write_field(dest, wp,0x1,3); // Uplink state flag + + + bitvec_write_field(dest, wp,0xa,6); // MESSAGE TYPE + + bitvec_write_field(dest, wp,0x0,2); // Page Mode + + bitvec_write_field(dest, wp,0x0,1); // switch PERSIST_LEVEL: off + bitvec_write_field(dest, wp,0x2,2); // switch TLLI : on + bitvec_write_field(dest, wp,tlli,32); // TLLI + + bitvec_write_field(dest, wp,0x0,1); // Message escape + bitvec_write_field(dest, wp,0x0,2); // CHANNEL_CODING_COMMAND + bitvec_write_field(dest, wp,0x0,1); // TLLI_BLOCK_CHANNEL_CODING + + bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_VALUE = on + bitvec_write_field(dest, wp,0x0,6); // TIMING_ADVANCE_VALUE + bitvec_write_field(dest, wp,0x0,1); // switch TIMING_ADVANCE_INDEX = off + + bitvec_write_field(dest, wp,0x0,1); // Frequency Parameters = off + + bitvec_write_field(dest, wp,0x1,2); // Dynamic Allocation = off + + bitvec_write_field(dest, wp,0x0,1); // Dynamic Allocation + bitvec_write_field(dest, wp,0x0,1); // P0 = off + + bitvec_write_field(dest, wp,0x1,1); // USF_GRANULARITY + bitvec_write_field(dest, wp,0x1,1); // switch TFI : on + bitvec_write_field(dest, wp,tfi,5);// TFI + + bitvec_write_field(dest, wp,0x0,1); // + bitvec_write_field(dest, wp,0x0,1); // TBF Starting Time = off + bitvec_write_field(dest, wp,0x0,1); // Timeslot Allocation + + bitvec_write_field(dest, wp,0x0,5); // USF_TN 0 - 4 + bitvec_write_field(dest, wp,0x1,1); // USF_TN 5 + bitvec_write_field(dest, wp,0x1,3); // USF_TN 5 + bitvec_write_field(dest, wp,0x0,2); // USF_TN 6 - 7 +// bitvec_write_field(dest, wp,0x0,1); // Measurement Mapping struct not present +} + + +// GSM 04.08 9.1.18 Immediate assignment +int write_immediate_assignment(bitvec * dest, uint8_t downlink, uint8_t ra, uint32_t fn, + uint8_t ta, uint8_t tfi = 0, uint32_t tlli = 0) +{ + unsigned wp = 0; + + bitvec_write_field(dest, wp,0x0,4); // Skip Indicator + bitvec_write_field(dest, wp,0x6,4); // Protocol Discriminator + bitvec_write_field(dest, wp,0x3F,8); // Immediate Assignment Message Type + + // 10.5.2.25b Dedicated mode or TBF + bitvec_write_field(dest, wp,0x0,1); // spare + bitvec_write_field(dest, wp,0x0,1); // TMA : Two-message assignment: No meaning + bitvec_write_field(dest, wp,downlink,1); // Downlink : Downlink assignment to mobile in packet idle mode + bitvec_write_field(dest, wp,0x1,1); // T/D : TBF or dedicated mode: this message assigns a Temporary Block Flow (TBF). + + bitvec_write_field(dest, wp,0x0,4); // Page Mode + + // GSM 04.08 10.5.2.25a Packet Channel Description + bitvec_write_field(dest, wp,0x1,5); // Channel type + bitvec_write_field(dest, wp,(l1fh->fl1h)->channel_info.tn,3); // TN + bitvec_write_field(dest, wp,(l1fh->fl1h)->channel_info.tsc,3); // TSC + bitvec_write_field(dest, wp,0x0,3); // non-hopping RF channel configuraion + bitvec_write_field(dest, wp,(l1fh->fl1h)->channel_info.arfcn,10); // ARFCN + + //10.5.2.30 Request Reference + bitvec_write_field(dest, wp,ra,8); // RA + bitvec_write_field(dest, wp,(fn / (26 * 51)) % 32,5); // T1' + bitvec_write_field(dest, wp,fn % 51,6); // T3 + bitvec_write_field(dest, wp,fn % 26,5); // T2 + + // 10.5.2.40 Timing Advance + bitvec_write_field(dest, wp,0x0,2); // spare + bitvec_write_field(dest, wp,ta,6); // Timing Advance value + + // No mobile allocation in non-hopping systems. + // A zero-length LV. Just write L=0. + bitvec_write_field(dest, wp,0,8); + + if (downlink) + { + // GSM 04.08 10.5.2.16 IA Rest Octets + bitvec_write_field(dest, wp, 3, 2); // "HH" + bitvec_write_field(dest, wp, 1, 2); // "01" Packet Downlink Assignment + bitvec_write_field(dest, wp,tlli,32); // TLLI + bitvec_write_field(dest, wp,0x1,1); // switch TFI : on + bitvec_write_field(dest, wp,tfi,5); // TFI + bitvec_write_field(dest, wp,0x0,1); // RLC acknowledged mode + bitvec_write_field(dest, wp,0x0,1); // ALPHA = present + bitvec_write_field(dest, wp,0x0,5); // GAMMA power control parameter + bitvec_write_field(dest, wp,0x0,1); // Polling Bit + bitvec_write_field(dest, wp,0x1,1); // TA_VALID ??? + bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_INDEX = on + bitvec_write_field(dest, wp,0x0,4); // TIMING_ADVANCE_INDEX + bitvec_write_field(dest, wp,0x0,1); // TBF Starting TIME present + bitvec_write_field(dest, wp,0x0,1); // P0 not present + bitvec_write_field(dest, wp,0x1,1); // P0 not present + bitvec_write_field(dest, wp,0xb,4); + } + else + { + // GMS 04.08 10.5.2.37b 10.5.2.16 + bitvec_write_field(dest, wp, 3, 2); // "HH" + bitvec_write_field(dest, wp, 0, 2); // "0" Packet Uplink Assignment + bitvec_write_field(dest, wp, 1, 1); // Block Allocation : Not Single Block Allocation + bitvec_write_field(dest, wp, tfi, 5); // TFI_ASSIGNMENT Temporary Flow Identity + bitvec_write_field(dest, wp, 0, 1); // POLLING + bitvec_write_field(dest, wp, 0, 1); // ALLOCATION_TYPE: dynamic + bitvec_write_field(dest, wp, 1, 3); // USF + bitvec_write_field(dest, wp, 1, 1); // USF_GRANULARITY + bitvec_write_field(dest, wp, 0 , 1); // "0" power control: Not Present + bitvec_write_field(dest, wp, 0, 2); // CHANNEL_CODING_COMMAND + bitvec_write_field(dest, wp, 1, 1); // TLLI_BLOCK_CHANNEL_CODING + bitvec_write_field(dest, wp, 1 , 1); // "1" Alpha : Present + bitvec_write_field(dest, wp, 0, 4); // Alpha + bitvec_write_field(dest, wp, 0, 5); // Gamma + bitvec_write_field(dest, wp, 0, 1); // TIMING_ADVANCE_INDEX_FLAG + bitvec_write_field(dest, wp, 0, 1); // TBF_STARTING_TIME_FLAG + } + + if (wp%8) + return wp/8+1; + else + return wp/8; +} + + +void write_ia_rest_octets_downlink_assignment(bitvec * dest, uint8_t tfi, uint32_t tlli) +{ + // GSM 04.08 10.5.2.16 + unsigned wp = 0; + bitvec_write_field(dest, wp, 3, 2); // "HH" + bitvec_write_field(dest, wp, 1, 2); // "01" Packet Downlink Assignment + bitvec_write_field(dest, wp,tlli,32); // TLLI + bitvec_write_field(dest, wp,0x1,1); // switch TFI : on + bitvec_write_field(dest, wp,tfi,5); // TFI + bitvec_write_field(dest, wp,0x0,1); // RLC acknowledged mode + bitvec_write_field(dest, wp,0x0,1); // ALPHA = present + bitvec_write_field(dest, wp,0x0,5); // GAMMA power control parameter + bitvec_write_field(dest, wp,0x0,1); // Polling Bit + bitvec_write_field(dest, wp,0x1,1); // TA_VALID ??? + bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_INDEX = on + bitvec_write_field(dest, wp,0x0,4); // TIMING_ADVANCE_INDEX + bitvec_write_field(dest, wp,0x0,1); // TBF Starting TIME present + bitvec_write_field(dest, wp,0x0,1); // P0 not present + bitvec_write_field(dest, wp,0x1,1); // P0 not present + bitvec_write_field(dest, wp,0xb,4); +} + +void write_packet_uplink_ack(bitvec * dest, uint8_t tfi, uint32_t tlli, unsigned cv, unsigned bsn) +{ + // TODO We should use our implementation of encode RLC/MAC Control messages. + unsigned wp = 0; + bitvec_write_field(dest, wp,0x1,2); // payload + bitvec_write_field(dest, wp,0x0,2); // Uplink block with TDMA framenumber + if (cv == 0) bitvec_write_field(dest, wp,0x1,1); // Suppl/Polling Bit + else bitvec_write_field(dest, wp,0x0,1); //Suppl/Polling Bit + bitvec_write_field(dest, wp,0x1,3); // Uplink state flag + + //bitvec_write_field(dest, wp,0x0,1); // Reduced block sequence number + //bitvec_write_field(dest, wp,BSN+6,5); // Radio transaction identifier + //bitvec_write_field(dest, wp,0x1,1); // Final segment + //bitvec_write_field(dest, wp,0x1,1); // Address control + + //bitvec_write_field(dest, wp,0x0,2); // Power reduction: 0 + //bitvec_write_field(dest, wp,TFI,5); // Temporary flow identifier + //bitvec_write_field(dest, wp,0x1,1); // Direction + + bitvec_write_field(dest, wp,0x09,6); // MESSAGE TYPE + bitvec_write_field(dest, wp,0x0,2); // Page Mode + + bitvec_write_field(dest, wp,0x0,2); + bitvec_write_field(dest, wp,tfi,5); // Uplink TFI + bitvec_write_field(dest, wp,0x0,1); + + bitvec_write_field(dest, wp,0x0,2); // CS1 + if (cv == 0) bitvec_write_field(dest, wp,0x1,1); // FINAL_ACK_INDICATION + else bitvec_write_field(dest, wp,0x0,1); // FINAL_ACK_INDICATION + bitvec_write_field(dest, wp,bsn + 1,7); // STARTING_SEQUENCE_NUMBER + // RECEIVE_BLOCK_BITMAP + for (unsigned i=0; i<8; i++) { + bitvec_write_field(dest, wp,0xff,8); + } + bitvec_write_field(dest, wp,0x1,1); // CONTENTION_RESOLUTION_TLLI = present + bitvec_write_field(dest, wp,tlli,8*4); + bitvec_write_field(dest, wp,0x00,4); //spare + bitvec_write_field(dest, wp,0x5,4); //0101 +} + +void gprs_rlcmac_tx_ul_ack(uint8_t tfi, uint32_t tlli, RlcMacUplinkDataBlock_t * ul_data_block) +{ + bitvec *packet_uplink_ack_vec = bitvec_alloc(23); + bitvec_unhex(packet_uplink_ack_vec, "2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b"); + write_packet_uplink_ack(packet_uplink_ack_vec, tfi, tlli, ul_data_block->CV, ul_data_block->BSN); + LOGP(DRLCMAC, LOGL_NOTICE, "TX: [PCU -> BTS] TFI: %u TLLI: 0x%08x Packet Uplink Ack\n", tfi, tlli); + RlcMacDownlink_t * packet_uplink_ack = (RlcMacDownlink_t *)malloc(sizeof(RlcMacDownlink_t)); + LOGP(DRLCMAC, LOGL_NOTICE, "+++++++++++++++++++++++++ TX : Packet Uplink Ack +++++++++++++++++++++++++\n"); + decode_gsm_rlcmac_downlink(packet_uplink_ack_vec, packet_uplink_ack); + LOGPC(DRLCMAC, LOGL_NOTICE, "\n"); + LOGP(DRLCMAC, LOGL_NOTICE, "------------------------- TX : Packet Uplink Ack -------------------------\n"); + free(packet_uplink_ack); + pcu_l1if_tx(packet_uplink_ack_vec, GsmL1_Sapi_Pacch); + bitvec_free(packet_uplink_ack_vec); +} + +void gprs_rlcmac_data_block_parse(gprs_rlcmac_tbf* tbf, RlcMacUplinkDataBlock_t * ul_data_block) +{ + // 1. Count the number of octets in header and number of LLC PDU in uplink data block. + unsigned data_block_hdr_len = 3; // uplink data block header length: 3 mandatory octets + unsigned llc_pdu_num = 0; // number of LLC PDU in data block + + + if (ul_data_block->E_1 == 0) // Extension octet follows immediately + { + unsigned i = -1; + do + { + i++; + data_block_hdr_len += 1; + llc_pdu_num++; + + // Singular case, TS 44.060 10.4.14 + if (ul_data_block->LENGTH_INDICATOR[i] == 0) + { + break; + } + + // New LLC PDU starts after the current LLC PDU and continues until + // the end of the RLC information field, no more extension octets. + if ((ul_data_block->M[i] == 1)&&(ul_data_block->E[i] == 1)) + { + llc_pdu_num++; + } + } while(ul_data_block->E[i] == 0); // there is another extension octet, which delimits the new LLC PDU + } + else + { + llc_pdu_num++; + } + if(ul_data_block->TI == 1) // TLLI field is present + { + tbf->tlli = ul_data_block->TLLI; + data_block_hdr_len += 4; // TLLI length : 4 octets + if (ul_data_block->PI == 1) // PFI is present if TI field indicates presence of TLLI + { + data_block_hdr_len += 1; // PFI length : 1 octet + } + } + + // 2. Extract all LLC PDU from uplink data block and send them to SGSN. + unsigned llc_pdu_len = 0; + unsigned data_octet_num = 0; + + for (unsigned num = 0; num < llc_pdu_num; num ++) + { + if (ul_data_block->E_1 == 0) // Extension octet follows immediately + { + // Singular case, TS 44.060 10.4.14 + if (ul_data_block->LENGTH_INDICATOR[num] == 0) + { + llc_pdu_len = UL_RLC_DATA_BLOCK_LEN - data_block_hdr_len; + } + else + { + llc_pdu_len = ul_data_block->LENGTH_INDICATOR[num]; + } + } + else + { + llc_pdu_len = UL_RLC_DATA_BLOCK_LEN - data_block_hdr_len; + } + + for (unsigned i = tbf->data_index; i < tbf->data_index + llc_pdu_len; i++) + { + tbf->rlc_data[i] = ul_data_block->RLC_DATA[data_octet_num]; + data_octet_num++; + } + tbf->data_index += llc_pdu_len; + + if (ul_data_block->E_1 == 0) // Extension octet follows immediately + { + // New LLC PDU starts after the current LLC PDU + if (ul_data_block->M[num] == 1) + { + gsmtap_send_llc(tbf->rlc_data, tbf->data_index); + gprs_rlcmac_tx_ul_ud(tbf); + tbf->data_index = 0; + // New LLC PDU continues until the end of the RLC information field, no more extension octets. + if ((ul_data_block->E[num] == 1)) + { + llc_pdu_len = UL_RLC_DATA_BLOCK_LEN - data_block_hdr_len - data_octet_num; + for (unsigned i = tbf->data_index; i < tbf->data_index + llc_pdu_len; i++) + { + tbf->rlc_data[i] = ul_data_block->RLC_DATA[data_octet_num]; + data_octet_num++; + } + tbf->data_index += llc_pdu_len; + num++; + } + } + } + } +} + +/* Received Uplink RLC data block. */ +int gprs_rlcmac_rcv_data_block(bitvec *rlc_block) +{ + struct gprs_rlcmac_tbf *tbf; + + LOGP(DRLCMAC, LOGL_NOTICE, "RX: [PCU <- BTS] Uplink Data Block\n"); + RlcMacUplinkDataBlock_t * ul_data_block = (RlcMacUplinkDataBlock_t *)malloc(sizeof(RlcMacUplinkDataBlock_t)); + LOGP(DRLCMAC, LOGL_NOTICE, "+++++++++++++++++++++++++ RX : Uplink Data Block +++++++++++++++++++++++++\n"); + decode_gsm_rlcmac_uplink_data(rlc_block, ul_data_block); + LOGP(DRLCMAC, LOGL_NOTICE, "------------------------- RX : Uplink Data Block -------------------------\n"); + tbf = tbf_by_tfi(ul_data_block->TFI); + if (!tbf) { + return 0; + } + + if (ul_data_block->TI == 1) + { + tbf->tlli = ul_data_block->TLLI; + } + + switch (tbf->state) { + case GPRS_RLCMAC_WAIT_DATA_SEQ_START: + if (ul_data_block->BSN == 0) { + tbf->data_index = 0; + gprs_rlcmac_data_block_parse(tbf, ul_data_block); + gprs_rlcmac_tx_ul_ack(tbf->tfi, tbf->tlli, ul_data_block); + if (ul_data_block->CV == 0) { + // Recieved last Data Block in this sequence. + gsmtap_send_llc(tbf->rlc_data, tbf->data_index); + tbf->state = GPRS_RLCMAC_WAIT_NEXT_DATA_SEQ; + gprs_rlcmac_tx_ul_ud(tbf); + } else { + tbf->bsn = ul_data_block->BSN; + tbf->state = GPRS_RLCMAC_WAIT_NEXT_DATA_BLOCK; + } + } + break; + case GPRS_RLCMAC_WAIT_NEXT_DATA_BLOCK: + if (tbf->bsn == (ul_data_block->BSN - 1)) { + gprs_rlcmac_data_block_parse(tbf, ul_data_block); + gprs_rlcmac_tx_ul_ack(tbf->tfi, tbf->tlli, ul_data_block); + if (ul_data_block->CV == 0) { + // Recieved last Data Block in this sequence. + gsmtap_send_llc(tbf->rlc_data, tbf->data_index); + tbf->state = GPRS_RLCMAC_WAIT_NEXT_DATA_SEQ; + gprs_rlcmac_tx_ul_ud(tbf); + } else { + tbf->bsn = ul_data_block->BSN; + tbf->state = GPRS_RLCMAC_WAIT_NEXT_DATA_BLOCK; + } + } else { + // Recieved Data Block with unexpected BSN. + // We should try to find nesessary Data Block. + tbf->state = GPRS_RLCMAC_WAIT_NEXT_DATA_BLOCK; + } + break; + case GPRS_RLCMAC_WAIT_NEXT_DATA_SEQ: + // Now we just ignore all Data Blocks and wait next Uplink TBF + break; + } + + free(ul_data_block); + return 1; +} + +/* Received Uplink RLC control block. */ +int gprs_rlcmac_rcv_control_block(bitvec *rlc_block) +{ + uint8_t tfi = 0; + uint32_t tlli = 0; + struct gprs_rlcmac_tbf *tbf; + struct gprs_rlcmac_tbf *ul_tbf; + + RlcMacUplink_t * ul_control_block = (RlcMacUplink_t *)malloc(sizeof(RlcMacUplink_t)); + LOGP(DRLCMAC, LOGL_NOTICE, "+++++++++++++++++++++++++ RX : Uplink Control Block +++++++++++++++++++++++++\n"); + decode_gsm_rlcmac_uplink(rlc_block, ul_control_block); + LOGPC(DRLCMAC, LOGL_NOTICE, "\n"); + LOGP(DRLCMAC, LOGL_NOTICE, "------------------------- RX : Uplink Control Block -------------------------\n"); + switch (ul_control_block->u.MESSAGE_TYPE) { + case MT_PACKET_CONTROL_ACK: + tlli = ul_control_block->u.Packet_Control_Acknowledgement.TLLI; + tbf = tbf_by_tlli(tlli); + if (!tbf) { + return 0; + } + LOGP(DRLCMAC, LOGL_NOTICE, "RX: [PCU <- BTS] TFI: %u TLLI: 0x%08x Packet Control Ack\n", tbf->tfi, tbf->tlli); + LOGP(DRLCMAC, LOGL_NOTICE, "TBF: [UPLINK] END TFI: %u TLLI: 0x%08x \n", tbf->tfi, tbf->tlli); + tbf_free(tbf); + break; + case MT_PACKET_DOWNLINK_ACK_NACK: + tfi = ul_control_block->u.Packet_Downlink_Ack_Nack.DOWNLINK_TFI; + tbf = tbf_by_tfi(tfi); + if (!tbf) { + return 0; + } + LOGP(DRLCMAC, LOGL_NOTICE, "RX: [PCU <- BTS] TFI: %u TLLI: 0x%08x Packet Downlink Ack/Nack\n", tbf->tfi, tbf->tlli); + tlli = tbf->tlli; + LOGP(DRLCMAC, LOGL_NOTICE, "TBF: [DOWNLINK] END TFI: %u TLLI: 0x%08x \n", tbf->tfi, tbf->tlli); + tbf_free(tbf); + break; + } + free(ul_control_block); + return 1; +} + +void gprs_rlcmac_rcv_block(bitvec *rlc_block) +{ + unsigned readIndex = 0; + unsigned payload = bitvec_read_field(rlc_block, readIndex, 2); + + switch (payload) { + case GPRS_RLCMAC_DATA_BLOCK: + gprs_rlcmac_rcv_data_block(rlc_block); + break; + case GPRS_RLCMAC_CONTROL_BLOCK: + gprs_rlcmac_rcv_control_block(rlc_block); + break; + case GPRS_RLCMAC_CONTROL_BLOCK_OPT: + COUT("GPRS_RLCMAC_CONTROL_BLOCK_OPT block payload is not supported.\n"); + default: + COUT("Unknown RLCMAC block payload.\n"); + } +} + +int gprs_rlcmac_rcv_rach(uint8_t ra, uint32_t Fn, uint16_t ta) +{ + struct gprs_rlcmac_tbf *tbf; + + // Create new TBF + int tfi = tfi_alloc(); + if (tfi < 0) { + return tfi; + } + tbf = tbf_alloc(tfi); + tbf->direction = GPRS_RLCMAC_UL_TBF; + tbf->state = GPRS_RLCMAC_WAIT_DATA_SEQ_START; + LOGP(DRLCMAC, LOGL_NOTICE, "TBF: [UPLINK] START TFI: %u\n", tbf->tfi); + LOGP(DRLCMAC, LOGL_NOTICE, "RX: [PCU <- BTS] TFI: %u RACH\n", tbf->tfi); + LOGP(DRLCMAC, LOGL_NOTICE, "TX: [PCU -> BTS] TFI: %u Packet Immidiate Assignment\n", tbf->tfi); + bitvec *immediate_assignment = bitvec_alloc(23); + bitvec_unhex(immediate_assignment, "2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b"); + int len = write_immediate_assignment(immediate_assignment, 0, ra, Fn, ta, tbf->tfi); + pcu_l1if_tx(immediate_assignment, GsmL1_Sapi_Agch, len); + bitvec_free(immediate_assignment); +} + +// Send RLC data to OpenBTS. +void gprs_rlcmac_tx_dl_data_block(uint32_t tlli, uint8_t tfi, uint8_t *pdu, int start_index, int end_index, uint8_t bsn, uint8_t fbi) +{ + int spare_len = 0; + bitvec *data_block_vector = bitvec_alloc(BLOCK_LEN); + bitvec_unhex(data_block_vector, "2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b"); + RlcMacDownlinkDataBlock_t * data_block = (RlcMacDownlinkDataBlock_t *)malloc(sizeof(RlcMacDownlinkDataBlock_t)); + data_block->PAYLOAD_TYPE = 0; + data_block->RRBP = 0; + data_block->SP = 1; + data_block->USF = 1; + data_block->PR = 0; + data_block->TFI = tfi; + data_block->FBI = fbi; + data_block->BSN = bsn; + + // Last RLC data block of current LLC PDU + if (fbi == 1) + { + data_block->E_1 = 0; + data_block->M[0] = 0; + data_block->E[0] = 1; + // Singular case, TS 44.060 10.4.14 + if ((end_index - start_index) == (BLOCK_LEN - 3)) + { + data_block->FBI = 0; + data_block->LENGTH_INDICATOR[0] = 0; + spare_len = 0; + end_index--; + } + else + { + data_block->LENGTH_INDICATOR[0] = end_index-start_index; + spare_len = BLOCK_LEN - 4 - data_block->LENGTH_INDICATOR[0]; + } + } + else + { + data_block->E_1 = 1; + } + + int data_oct_num = 0; + int i = 0; + // Pack LLC PDU into RLC data field + for(i = start_index; i < end_index; i++) { + data_block->RLC_DATA[data_oct_num] = pdu[i]; + data_oct_num++; + } + // Fill spare bits + for(i = data_oct_num; i < data_oct_num + spare_len; i++) { + data_block->RLC_DATA[i] = 0x2b; + } + LOGP(DRLCMAC, LOGL_NOTICE, "TX: [PCU -> BTS] Downlink Data Block\n"); + LOGP(DRLCMAC, LOGL_NOTICE, "+++++++++++++++++++++++++ TX : Downlink Data Block +++++++++++++++++++++++++\n"); + encode_gsm_rlcmac_downlink_data(data_block_vector, data_block); + LOGP(DRLCMAC, LOGL_NOTICE, "------------------------- TX : Downlink Data Block -------------------------\n"); + free(data_block); + pcu_l1if_tx(data_block_vector, GsmL1_Sapi_Pdtch); + bitvec_free(data_block_vector); + + // Singular case, TS 44.060 10.4.14 + if ((fbi == 1)&&((end_index + 1 - start_index) == (BLOCK_LEN - 3))) + { + gprs_rlcmac_tx_dl_data_block(tlli, tfi, pdu, end_index, end_index+1, bsn+1, fbi); + } +} + +int gprs_rlcmac_segment_llc_pdu(struct gprs_rlcmac_tbf *tbf) +{ + int fbi = 0; + int bsn = 0; + int num_blocks = 0; // number of RLC data blocks necessary for LLC PDU transmission + + + // LLC PDU fits into one RLC data block with optional LI field. + if (tbf->data_index < BLOCK_LEN - 4) + { + fbi = 1; + gprs_rlcmac_tx_dl_data_block(tbf->tlli, tbf->tfi, tbf->rlc_data, 0, tbf->data_index, bsn, fbi); + } + // Necessary several RLC data blocks for transmit LLC PDU. + else + { + // length of RLC data field in block (no optional octets) + int block_data_len = BLOCK_LEN - 3; + + // number of blocks with 20 octets length RLC data field + num_blocks = tbf->data_index/block_data_len; + + // rest of LLC PDU, which doesn't fit into data blocks with 20 octets RLC data field + int rest_len = tbf->data_index%BLOCK_DATA_LEN; + if (rest_len > 0) + { + // add one block for transmission rest of LLC PDU + num_blocks++; + } + + int start_index = 0; + int end_index = 0; + + // Transmit all RLC data blocks of current LLC PDU to MS + for (bsn = 0; bsn < num_blocks; bsn++) + { + if (bsn == num_blocks-1) + { + if (rest_len > 0) + { + block_data_len = rest_len; + } + fbi = 1; + } + end_index = start_index + block_data_len; + gprs_rlcmac_tx_dl_data_block(tbf->tlli, tbf->tfi, tbf->rlc_data, start_index, end_index, bsn, fbi); + start_index += block_data_len; + } + } +} + +/* Send Uplink unit-data to SGSN. */ +void gprs_rlcmac_tx_ul_ud(gprs_rlcmac_tbf *tbf) +{ + const uint8_t qos_profile = QOS_PROFILE; + struct msgb *llc_pdu; + unsigned msg_len = NS_HDR_LEN + BSSGP_HDR_LEN + tbf->data_index; + + LOGP(DBSSGP, LOGL_NOTICE, "TX: [PCU -> SGSN ] TFI: %u TLLI: 0x%08x DataLen: %u", tbf->tfi, tbf->tlli, tbf->data_index); + //LOGP(DBSSGP, LOGL_NOTICE, " Data = "); + //for (unsigned i = 0; i < tbf->data_index; i++) + // LOGPC(DBSSGP, LOGL_NOTICE, "%02x ", tbf->rlc_data[i]); + + bctx->cell_id = CELL_ID; + bctx->nsei = NSEI; + bctx->ra_id.mnc = MNC; + bctx->ra_id.mcc = MCC; + bctx->ra_id.lac = PCU_LAC; + bctx->ra_id.rac = PCU_RAC; + bctx->bvci = BVCI; + + llc_pdu = msgb_alloc_headroom(msg_len, msg_len,"llc_pdu"); + msgb_tvlv_push(llc_pdu, BSSGP_IE_LLC_PDU, sizeof(uint8_t)*tbf->data_index, tbf->rlc_data); + bssgp_tx_ul_ud(bctx, tbf->tlli, &qos_profile, llc_pdu); +} + +void gprs_rlcmac_downlink_assignment(gprs_rlcmac_tbf *tbf) +{ + LOGP(DRLCMAC, LOGL_NOTICE, "TX: [PCU -> BTS] TFI: %u TLLI: 0x%08x Immidiate Assignment (CCCH)\n", tbf->tfi, tbf->tlli); + bitvec *immediate_assignment = bitvec_alloc(23); + bitvec_unhex(immediate_assignment, "2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b"); + int len = write_immediate_assignment(immediate_assignment, 1, 125, get_current_fn(), (l1fh->fl1h)->channel_info.ta, tbf->tfi, tbf->tlli); + pcu_l1if_tx(immediate_assignment, GsmL1_Sapi_Agch, len); + bitvec_free(immediate_assignment); + tbf_gsm_timer_start(tbf, 0, 120); +} + +void gprs_rlcmac_packet_downlink_assignment(gprs_rlcmac_tbf *tbf) +{ + LOGP(DRLCMAC, LOGL_NOTICE, "TX: [PCU -> BTS] TFI: %u TLLI: 0x%08x Packet DL Assignment\n", tbf->tfi, tbf->tlli); + bitvec *packet_downlink_assignment_vec = bitvec_alloc(23); + bitvec_unhex(packet_downlink_assignment_vec, "2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b"); + write_packet_downlink_assignment(packet_downlink_assignment_vec, tbf->tfi, tbf->tlli, (l1fh->fl1h)->channel_info.tn, + (l1fh->fl1h)->channel_info.ta, (l1fh->fl1h)->channel_info.tsc); + RlcMacDownlink_t * packet_downlink_assignment = (RlcMacDownlink_t *)malloc(sizeof(RlcMacDownlink_t)); + LOGP(DRLCMAC, LOGL_NOTICE, "+++++++++++++++++++++++++ TX : Packet Downlink Assignment +++++++++++++++++++++++++\n"); + decode_gsm_rlcmac_downlink(packet_downlink_assignment_vec, packet_downlink_assignment); + LOGPC(DRLCMAC, LOGL_NOTICE, "\n"); + LOGP(DRLCMAC, LOGL_NOTICE, "------------------------- TX : Packet Downlink Assignment -------------------------\n"); + free(packet_downlink_assignment); + pcu_l1if_tx(packet_downlink_assignment_vec, GsmL1_Sapi_Pacch); + bitvec_free(packet_downlink_assignment_vec); + tbf_gsm_timer_start(tbf, 0, 120); +} diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h new file mode 100644 index 00000000..eb651c61 --- /dev/null +++ b/src/gprs_rlcmac.h @@ -0,0 +1,108 @@ +/* gprs_rlcmac.h + * + * Copyright (C) 2012 Ivan Klyuchnikov + * + * 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. + */ + +#ifndef GPRS_RLCMAC_H +#define GPRS_RLCMAC_H + +#include +#include +#include + +extern "C" { +#include +#include +} + +#define LLC_MAX_LEN 1543 +#define UL_RLC_DATA_BLOCK_LEN 23 + +enum gprs_rlcmac_tbf_state { + GPRS_RLCMAC_WAIT_DATA_SEQ_START, + GPRS_RLCMAC_WAIT_NEXT_DATA_BLOCK, + GPRS_RLCMAC_WAIT_NEXT_DATA_SEQ +}; + +enum gprs_rlcmac_tbf_direction { + GPRS_RLCMAC_DL_TBF, + GPRS_RLCMAC_UL_TBF +}; + +struct gprs_rlcmac_tbf { + struct llist_head list; + enum gprs_rlcmac_tbf_state state; + enum gprs_rlcmac_tbf_direction direction; + uint8_t tfi; + uint32_t tlli; + uint8_t rlc_data[LLC_MAX_LEN]; + uint16_t data_index; + uint8_t bsn; + + struct osmo_timer_list timer; + unsigned int T; /* Txxxx number */ + unsigned int num_T_exp; /* number of consecutive T expirations */ + + struct osmo_gsm_timer_list gsm_timer; + unsigned int fT; /* fTxxxx number */ + unsigned int num_fT_exp; /* number of consecutive fT expirations */ +}; + +extern struct llist_head gprs_rlcmac_tbfs; + +int tfi_alloc(); + +struct gprs_rlcmac_tbf *tbf_alloc(uint8_t tfi); + +static struct gprs_rlcmac_tbf *tbf_by_tfi(uint8_t tfi); + +static struct gprs_rlcmac_tbf *tbf_by_tlli(uint8_t tlli); + +static void tbf_free(struct gprs_rlcmac_tbf *tbf); + +/* TS 44.060 Section 10.4.7 Table 10.4.7.1: Payload Type field */ +enum gprs_rlcmac_block_type { + GPRS_RLCMAC_DATA_BLOCK = 0x0, + GPRS_RLCMAC_CONTROL_BLOCK = 0x1, + GPRS_RLCMAC_CONTROL_BLOCK_OPT = 0x2, + GPRS_RLCMAC_RESERVED = 0x3 +}; + +void gprs_rlcmac_tx_ul_ack(uint8_t tfi, uint32_t tlli, RlcMacUplinkDataBlock_t * ul_data_block); + +void gprs_rlcmac_data_block_parse(gprs_rlcmac_tbf* tbf, RlcMacUplinkDataBlock_t * ul_data_block); + +int gprs_rlcmac_rcv_data_block(bitvec *rlc_block); + +int gprs_rlcmac_rcv_control_block(bitvec *rlc_block); + +void gprs_rlcmac_rcv_block(bitvec *rlc_block); + +int gprs_rlcmac_rcv_rach(uint8_t ra, uint32_t Fn, uint16_t ta); + +void gprs_rlcmac_tx_dl_data_block(uint32_t tlli, uint8_t tfi, uint8_t *pdu, int start_index, int end_index, uint8_t bsn, uint8_t fbi); + +int gprs_rlcmac_segment_llc_pdu(struct gprs_rlcmac_tbf *tbf); + +void gprs_rlcmac_tx_ul_ud(gprs_rlcmac_tbf *tbf); + +void gprs_rlcmac_downlink_assignment(gprs_rlcmac_tbf *tbf); + +void gprs_rlcmac_packet_downlink_assignment(gprs_rlcmac_tbf *tbf); + + +#endif // GPRS_RLCMAC_H diff --git a/src/gsmL1prim.h b/src/gsmL1prim.h new file mode 100644 index 00000000..b348a1a4 --- /dev/null +++ b/src/gsmL1prim.h @@ -0,0 +1,415 @@ +/* +* Copyright 2012 Thomas Cooper +* +* This software is distributed under the terms of the GNU Affero Public License. +* See the COPYING file in the main directory for details. +* +* This use of this software may be subject to additional restrictions. +* See the LEGAL file in the main directory for details. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 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 Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . + +*/ + +#ifndef GSML1PRIM_H +#define GSML1PRIM_H + +#include + +typedef enum GsmL1_SubCh_t { +GsmL1_SubCh_NA, +} GsmL1_SubCh_t; + +typedef enum GsmL1_Sapi_t { +GsmL1_Sapi_Fcch, +GsmL1_Sapi_Sch, +GsmL1_Sapi_Sacch, +GsmL1_Sapi_Sdcch, +GsmL1_Sapi_Bcch, +GsmL1_Sapi_Pch, +GsmL1_Sapi_Agch, +GsmL1_Sapi_Cbch, +GsmL1_Sapi_Rach, +GsmL1_Sapi_TchF, +GsmL1_Sapi_FacchF, +GsmL1_Sapi_TchH, +GsmL1_Sapi_FacchH, +GsmL1_Sapi_Nch, +GsmL1_Sapi_Pdtch, +GsmL1_Sapi_Pacch, +GsmL1_Sapi_Pbcch, +GsmL1_Sapi_Pagch, +GsmL1_Sapi_Ppch, +GsmL1_Sapi_Pnch, +GsmL1_Sapi_Ptcch, +GsmL1_Sapi_Prach, +GsmL1_Sapi_Idle, +GsmL1_Sapi_NUM, +} GsmL1_Sapi_t; + +typedef enum GsmL1_Status_t { +GsmL1_Status_Success, +GsmL1_Status_Generic, +GsmL1_Status_NoMemory, +GsmL1_Status_Timeout, +GsmL1_Status_InvalidParam, +GsmL1_Status_Busy, +GsmL1_Status_NoRessource, +GsmL1_Status_Uninitialized, +GsmL1_Status_NullInterface, +GsmL1_Status_NullFctnPtr, +GsmL1_Status_BadCrc, +GsmL1_Status_BadUsf, +GsmL1_Status_InvalidCPS, +GsmL1_Status_UnexpectedBurst, +GsmL1_Status_UnavailCodec, +GsmL1_Status_CriticalError, +GsmL1_Status_OverheatError, +GsmL1_Status_DeviceError, +GsmL1_Status_FacchError, +GsmL1_Status_AlreadyDeactivated, +GsmL1_Status_TxBurstFifoOvrn, +GsmL1_Status_TxBurstFifoUndr, +GsmL1_Status_NotSynchronized, +GsmL1_Status_Unsupported, +GSML1_STATUS_NUM, +} GsmL1_Status_t; + +typedef enum GsmL1_PrimId_t { +GsmL1_PrimId_MphInitReq, +GsmL1_PrimId_MphCloseReq, +GsmL1_PrimId_MphConnectReq, +GsmL1_PrimId_MphDisconnectReq, +GsmL1_PrimId_MphActivateReq, +GsmL1_PrimId_MphDeactivateReq, +GsmL1_PrimId_MphConfigReq, +GsmL1_PrimId_MphMeasureReq, +GsmL1_PrimId_MphInitCnf, +GsmL1_PrimId_MphCloseCnf, +GsmL1_PrimId_MphConnectCnf, +GsmL1_PrimId_MphDisconnectCnf, +GsmL1_PrimId_MphActivateCnf, +GsmL1_PrimId_MphDeactivateCnf, +GsmL1_PrimId_MphConfigCnf, +GsmL1_PrimId_MphMeasureCnf, +GsmL1_PrimId_MphTimeInd, +GsmL1_PrimId_MphSyncInd, +GsmL1_PrimId_PhEmptyFrameReq, +GsmL1_PrimId_PhDataReq, +GsmL1_PrimId_PhConnectInd, +GsmL1_PrimId_PhReadyToSendInd, +GsmL1_PrimId_PhDataInd, +GsmL1_PrimId_PhRaInd, +GsmL1_PrimId_NUM, +} GsmL1_PrimId_t; + +typedef enum GsmL1_Dir_t { +GsmL1_Dir_TxDownlink, +GsmL1_Dir_RxUplink, +} GsmL1_Dir_t; + +typedef enum GsmL1_DevType_t { +GsmL1_DevType_TxdRxu, +} GsmL1_DevType_t; + +typedef enum GsmL1_TchPlType_t { +GsmL1_TchPlType_NA, +GsmL1_TchPlType_Efr, +GsmL1_TchPlType_Fr, +GsmL1_TchPlType_Hr, +GsmL1_TchPlType_Amr, +GsmL1_TchPlType_Amr_SidBad, +GsmL1_TchPlType_Amr_Onset, +GsmL1_TchPlType_Amr_Ratscch, +GsmL1_TchPlType_Amr_SidUpdateInH, +GsmL1_TchPlType_Amr_SidFirstP1, +GsmL1_TchPlType_Amr_SidFirstP2, +GsmL1_TchPlType_Amr_SidFirstInH, +GsmL1_TchPlType_Amr_RatscchMarker, +GsmL1_TchPlType_Amr_RatscchData, +} GsmL1_TchPlType_t; + +typedef enum GsmL1_ConfigParamId_t { +GsmL1_ConfigParamId_SetNbTsc, +GsmL1_ConfigParamId_SetTxPowerLevel, +GsmL1_ConfigParamId_SetLogChParams, +GsmL1_ConfigParamId_SetCipheringParams, +} GsmL1_ConfigParamId_t; + +typedef struct GsmL1_DeviceParam_t { +enum GsmL1_DevType_t devType; +int freqBand; +uint16_t u16Arfcn; +uint16_t u16BcchArfcn; +uint8_t u8NbTsc; +uint8_t u8Ncc; +float fRxPowerLevel; +float fTxPowerLevel; +} GsmL1_DeviceParam_t; + +typedef struct GsmL1_MsgUnitParam_t { +uint8_t u8Buffer[256]; +uint8_t u8Size; +} GsmL1_MsgUnitParam_t; + +typedef struct GsmL1_MeasParam_t { +float fRssi; +float fLinkQuality; +float fBer; +int16_t i16BurstTiming; +} GsmL1_MeasParam_t; + +typedef struct GsmL1_LogChParam_t { +union { +struct { +enum GsmL1_TchPlType_t tchPlType; + +enum { +GsmL1_AmrCmiPhase_NA, +GsmL1_AmrCmiPhase_Odd, +} amrCmiPhase; + +enum { +GsmL1_AmrCodecMode_Unset, +} amrInitCodecMode; + +enum { +GsmL1_AmrCodec_Unset, +GsmL1_AmrCodec_4_75, +GsmL1_AmrCodec_5_15, +GsmL1_AmrCodec_5_9, +GsmL1_AmrCodec_6_7, +GsmL1_AmrCodec_7_4, +GsmL1_AmrCodec_7_95, +GsmL1_AmrCodec_10_2, +GsmL1_AmrCodec_12_2, +} amrActiveCodecSet[8]; +} tch; + +struct { +uint8_t u8Bsic; +uint8_t u8NbrOfAgch; +} rach; + +struct { +uint8_t u8MsPowerLevel; +} sacch; + +struct { +uint8_t u8NbrOfAgch; +} agch; +}; +} GsmL1_LogChParam_t; + +typedef enum GsmL1_LogChComb_t { +GsmL1_LogChComb_0, +GsmL1_LogChComb_I, +GsmL1_LogChComb_II, +GsmL1_LogChComb_IV, +GsmL1_LogChComb_V, +GsmL1_LogChComb_VII, +GsmL1_LogChComb_XIII, +} GsmL1_LogChComb_t; + +enum { +GsmL1_FreqBand_850, +GsmL1_FreqBand_900, +GsmL1_FreqBand_1800, +GsmL1_FreqBand_1900, +}; + +typedef struct GsmL1_MphInitReq_t { +struct GsmL1_DeviceParam_t deviceParam; +} GsmL1_MphInitReq_t; + +typedef struct GsmL1_MphCloseReq_t { +uint32_t hLayer1; +} GsmL1_MphCloseReq_t; + +typedef struct GsmL1_MphConnectReq_t { +uint32_t hLayer1; +uint8_t u8Tn; +enum GsmL1_LogChComb_t logChComb; +} GsmL1_MphConnectReq_t; + +typedef struct GsmL1_MphDisconnectReq_t { +uint32_t hLayer1; +} GsmL1_MphDisconnectReq_t; + +typedef struct GsmL1_MphActivateReq_t { +uint32_t hLayer1; +struct GsmL1_LogChParam_t logChPrm; +uint8_t u8Tn; +enum GsmL1_SubCh_t subCh; +enum GsmL1_Dir_t dir; +enum GsmL1_Sapi_t sapi; +uint32_t hLayer2; +float fBFILevel; +} GsmL1_MphActivateReq_t; + +typedef struct GsmL1_MphDeactivateReq_t { +uint32_t hLayer1; +uint8_t u8Tn; +enum GsmL1_SubCh_t subCh; +enum GsmL1_Dir_t dir; +enum GsmL1_Sapi_t sapi; +} GsmL1_MphDeactivateReq_t; + +typedef struct GsmL1_ConfigParam_t { +struct { +enum GsmL1_Sapi_t sapi; +uint8_t u8Tn; +enum GsmL1_SubCh_t subCh; +enum GsmL1_Dir_t dir; +struct GsmL1_LogChParam_t logChParams; +} setLogChParams; +} GsmL1_ConfigParam_t; + +typedef struct GsmL1_MphConfigReq_t { +uint32_t hLayer1; +enum GsmL1_ConfigParamId_t cfgParamId; +struct GsmL1_ConfigParam_t cfgParams; +} GsmL1_MphConfigReq_t; + +typedef struct GsmL1_MphConfigCnf_t { +enum GsmL1_Status_t status; +enum GsmL1_ConfigParamId_t cfgParamId; +struct GsmL1_ConfigParam_t cfgParams; +} GsmL1_MphConfigCnf_t; + +typedef struct GsmL1_MphMeasureReq_t { +uint32_t hLayer1; +} GsmL1_MphMeasureReq_t; + +typedef struct GsmL1_MphInitCnf_t { +uint32_t hLayer1; +enum GsmL1_Status_t status; +} GsmL1_MphInitCnf_t; + +typedef struct GsmL1_MphCloseCnf_t { +enum GsmL1_Status_t status; +} GsmL1_MphCloseCnf_t; + +typedef struct GsmL1_MphConnectCnf_t { +enum GsmL1_Status_t status; +} GsmL1_MphConnectCnf_t; + +typedef struct GsmL1_MphDisconnectCnf_t { +enum GsmL1_Status_t status; +} GsmL1_MphDisconnectCnf_t; + +typedef struct GsmL1_MphActivateCnf_t { +enum GsmL1_Status_t status; +uint8_t u8Tn; +int sapi; +} GsmL1_MphActivateCnf_t; + +typedef struct GsmL1_MphDeactivateCnf_t { +enum GsmL1_Status_t status; +uint8_t u8Tn; +enum GsmL1_Sapi_t sapi; +} GsmL1_MphDeactivateCnf_t; + +typedef struct GsmL1_MphMeasureCnf_t { +enum GsmL1_Status_t status; +} GsmL1_MphMeasureCnf_t; + +typedef struct GsmL1_MphTimeInd_t { +uint32_t u32Fn; +} GsmL1_MphTimeInd_t; + +typedef struct GsmL1_MphSyncInd_t { +} GsmL1_MphSyncInd_t; + +typedef struct GsmL1_PhEmptyFrameReq_t { +uint32_t hLayer1; +uint8_t u8Tn; +uint32_t u32Fn; +enum GsmL1_Sapi_t sapi; +enum GsmL1_SubCh_t subCh; +uint8_t u8BlockNbr; +} GsmL1_PhEmptyFrameReq_t; + +typedef struct GsmL1_PhDataReq_t { +uint32_t hLayer1; +uint8_t u8Tn; +uint32_t u32Fn; +enum GsmL1_Sapi_t sapi; +enum GsmL1_SubCh_t subCh; +uint8_t u8BlockNbr; +struct GsmL1_MsgUnitParam_t msgUnitParam; +} GsmL1_PhDataReq_t; + +typedef struct GsmL1_PhConnectInd_t { +uint8_t u8Tn; +uint8_t u8Tsc; +uint16_t u16Arfcn; +} GsmL1_PhConnectInd_t; + +typedef struct GsmL1_PhReadyToSendInd_t { +uint32_t hLayer1; +uint8_t u8Tn; +uint32_t u32Fn; +enum GsmL1_Sapi_t sapi; +enum GsmL1_SubCh_t subCh; +uint8_t u8BlockNbr; +uint32_t hLayer2; +} GsmL1_PhReadyToSendInd_t; + +typedef struct GsmL1_PhDataInd_t { +struct GsmL1_MeasParam_t measParam; +struct GsmL1_MsgUnitParam_t msgUnitParam; +enum GsmL1_Sapi_t sapi; +uint32_t hLayer2; +} GsmL1_PhDataInd_t; + +typedef struct GsmL1_PhRaInd_t { +struct GsmL1_MeasParam_t measParam; +struct GsmL1_MsgUnitParam_t msgUnitParam; +uint32_t u32Fn; +uint32_t hLayer2; +} GsmL1_PhRaInd_t; + +typedef struct GsmL1_Prim_t { +union { +struct GsmL1_MphInitReq_t mphInitReq; +struct GsmL1_MphCloseReq_t mphCloseReq; +struct GsmL1_MphConnectReq_t mphConnectReq; +struct GsmL1_MphDisconnectReq_t mphDisconnectReq; +struct GsmL1_MphActivateReq_t mphActivateReq; +struct GsmL1_MphDeactivateReq_t mphDeactivateReq; +struct GsmL1_MphConfigReq_t mphConfigReq; +struct GsmL1_MphMeasureReq_t mphMeasureReq; +struct GsmL1_MphInitCnf_t mphInitCnf; +struct GsmL1_MphCloseCnf_t mphCloseCnf; +struct GsmL1_MphConnectCnf_t mphConnectCnf; +struct GsmL1_MphDisconnectCnf_t mphDisconnectCnf; +struct GsmL1_MphActivateCnf_t mphActivateCnf; +struct GsmL1_MphDeactivateCnf_t mphDeactivateCnf; +struct GsmL1_MphConfigCnf_t mphConfigCnf; +struct GsmL1_MphMeasureCnf_t mphMeasureCnf; +struct GsmL1_MphTimeInd_t mphTimeInd; +struct GsmL1_MphSyncInd_t mphSyncInd; +struct GsmL1_PhEmptyFrameReq_t phEmptyFrameReq; +struct GsmL1_PhDataReq_t phDataReq; +struct GsmL1_PhConnectInd_t phConnectInd; +struct GsmL1_PhReadyToSendInd_t phReadyToSendInd; +struct GsmL1_PhDataInd_t phDataInd; +struct GsmL1_PhRaInd_t phRaInd; +} u; + +enum GsmL1_PrimId_t id; +} GsmL1_Prim_t; + +#endif diff --git a/src/gsm_rlcmac.cpp b/src/gsm_rlcmac.cpp new file mode 100644 index 00000000..211d7af3 --- /dev/null +++ b/src/gsm_rlcmac.cpp @@ -0,0 +1,5430 @@ +/* gsm_rlcmac.c + * Routines for GSM RLC MAC control plane message dissection in wireshark. + * TS 44.060 and 24.008 + * + * Copyright (C) 2011 Ivan Klyuchnikov + * + * By Vincent Helfre, based on original code by Jari Sassi + * with the gracious authorization of STE + * Copyright (c) 2011 ST-Ericsson + * + * $Id: packet-gsm_rlcmac.c 39164 2011-09-27 12:05:32Z etxrab $ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs + * 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. + */ + +#include "gsm_rlcmac.h" +/* Initialize the protocol and registered fields +*/ +#include +#include +#include +using namespace std; + +/* Payload type as defined in TS 44.060 / 10.4.7 */ +#define PAYLOAD_TYPE_DATA 0 +#define PAYLOAD_TYPE_CTRL_NO_OPT_OCTET 1 +#define PAYLOAD_TYPE_CTRL_OPT_OCTET 2 +#define PAYLOAD_TYPE_RESERVED 3 + +/* CSN1 structures */ +/*(not all parts of CSN_DESCR structure are always initialized.)*/ +static const +CSN_DESCR_BEGIN(PLMN_t) + M_UINT (PLMN_t, MCC2, 4), + M_UINT (PLMN_t, MCC1, 4), + M_UINT (PLMN_t, MNC3, 4), + M_UINT (PLMN_t, MCC3, 4), + M_UINT (PLMN_t, MNC2, 4), + M_UINT (PLMN_t, MNC1, 4), +CSN_DESCR_END (PLMN_t) + +static const +CSN_DESCR_BEGIN(StartingTime_t) + M_UINT (StartingTime_t, N32, 5), + M_UINT (StartingTime_t, N51, 6), + M_UINT (StartingTime_t, N26, 5), +CSN_DESCR_END (StartingTime_t) + +/*< Global TFI IE >*/ +static const +CSN_DESCR_BEGIN(Global_TFI_t) + M_UNION (Global_TFI_t, 2), + M_UINT (Global_TFI_t, u.UPLINK_TFI, 5), + M_UINT (Global_TFI_t, u.DOWNLINK_TFI, 5), +CSN_DESCR_END (Global_TFI_t) + +/*< Starting Frame Number Description IE >*/ +static const +CSN_DESCR_BEGIN(Starting_Frame_Number_t) + M_UNION (Starting_Frame_Number_t, 2), + M_TYPE (Starting_Frame_Number_t, u.StartingTime, StartingTime_t), + M_UINT (Starting_Frame_Number_t, u.k, 13), +CSN_DESCR_END(Starting_Frame_Number_t) + +/*< Ack/Nack Description IE >*/ +static const +CSN_DESCR_BEGIN(Ack_Nack_Description_t) + M_UINT (Ack_Nack_Description_t, FINAL_ACK_INDICATION, 1), + M_UINT (Ack_Nack_Description_t, STARTING_SEQUENCE_NUMBER, 7), + M_BITMAP (Ack_Nack_Description_t, RECEIVED_BLOCK_BITMAP, 64), +CSN_DESCR_END (Ack_Nack_Description_t) + +/*< Packet Timing Advance IE >*/ +static const +CSN_DESCR_BEGIN(Packet_Timing_Advance_t) + M_NEXT_EXIST (Packet_Timing_Advance_t, Exist_TIMING_ADVANCE_VALUE, 1), + M_UINT (Packet_Timing_Advance_t, TIMING_ADVANCE_VALUE, 6), + + M_NEXT_EXIST (Packet_Timing_Advance_t, Exist_IndexAndtimeSlot, 2), + M_UINT (Packet_Timing_Advance_t, TIMING_ADVANCE_INDEX, 4), + M_UINT (Packet_Timing_Advance_t, TIMING_ADVANCE_TIMESLOT_NUMBER, 3), +CSN_DESCR_END (Packet_Timing_Advance_t) + +/*< Power Control Parameters IE >*/ +static const +CSN_DESCR_BEGIN(GPRS_Power_Control_Parameters_t) + M_UINT (GPRS_Power_Control_Parameters_t, ALPHA, 4), + M_UINT (GPRS_Power_Control_Parameters_t, T_AVG_W, 5), + M_UINT (GPRS_Power_Control_Parameters_t, T_AVG_T, 5), + M_BIT (GPRS_Power_Control_Parameters_t, PC_MEAS_CHAN), + M_UINT (GPRS_Power_Control_Parameters_t, N_AVG_I, 4), +CSN_DESCR_END (GPRS_Power_Control_Parameters_t) + +/*< Global Power Control Parameters IE >*/ +static const +CSN_DESCR_BEGIN(Global_Power_Control_Parameters_t) + M_UINT (Global_Power_Control_Parameters_t, ALPHA, 4), + M_UINT (Global_Power_Control_Parameters_t, T_AVG_W, 5), + M_UINT (Global_Power_Control_Parameters_t, T_AVG_T, 5), + M_UINT (Global_Power_Control_Parameters_t, Pb, 4), + M_UINT (Global_Power_Control_Parameters_t, PC_MEAS_CHAN, 1), + M_UINT (Global_Power_Control_Parameters_t, INT_MEAS_CHANNEL_LIST_AVAIL, 1), + M_UINT (Global_Power_Control_Parameters_t, N_AVG_I, 4), +CSN_DESCR_END (Global_Power_Control_Parameters_t) + +/*< Global Packet Timing Advance IE >*/ +static const +CSN_DESCR_BEGIN(Global_Packet_Timing_Advance_t) + M_NEXT_EXIST (Global_Packet_Timing_Advance_t, Exist_TIMING_ADVANCE_VALUE, 1), + M_UINT (Global_Packet_Timing_Advance_t, TIMING_ADVANCE_VALUE, 6), + + M_NEXT_EXIST (Global_Packet_Timing_Advance_t, Exist_UPLINK_TIMING_ADVANCE, 2), + M_UINT (Global_Packet_Timing_Advance_t, UPLINK_TIMING_ADVANCE_INDEX, 4), + M_UINT (Global_Packet_Timing_Advance_t, UPLINK_TIMING_ADVANCE_TIMESLOT_NUMBER, 3), + + M_NEXT_EXIST (Global_Packet_Timing_Advance_t, Exist_DOWNLINK_TIMING_ADVANCE, 2), + M_UINT (Global_Packet_Timing_Advance_t, DOWNLINK_TIMING_ADVANCE_INDEX, 4), + M_UINT (Global_Packet_Timing_Advance_t, DOWNLINK_TIMING_ADVANCE_TIMESLOT_NUMBER, 3), +CSN_DESCR_END (Global_Packet_Timing_Advance_t) + +/*< Channel Quality Report struct >*/ +static const +CSN_DESCR_BEGIN(Channel_Quality_Report_t) + M_UINT (Channel_Quality_Report_t, C_VALUE, 6), + M_UINT (Channel_Quality_Report_t, RXQUAL, 3), + M_UINT (Channel_Quality_Report_t, SIGN_VAR, 6), + + M_NEXT_EXIST (Channel_Quality_Report_t, Slot[0].Exist, 1), + M_UINT (Channel_Quality_Report_t, Slot[0].I_LEVEL_TN, 4), + + M_NEXT_EXIST (Channel_Quality_Report_t, Slot[1].Exist, 1), + M_UINT (Channel_Quality_Report_t, Slot[1].I_LEVEL_TN, 4), + + M_NEXT_EXIST (Channel_Quality_Report_t, Slot[2].Exist, 1), + M_UINT (Channel_Quality_Report_t, Slot[2].I_LEVEL_TN, 4), + + M_NEXT_EXIST (Channel_Quality_Report_t, Slot[3].Exist, 1), + M_UINT (Channel_Quality_Report_t, Slot[3].I_LEVEL_TN, 4), + + M_NEXT_EXIST (Channel_Quality_Report_t, Slot[4].Exist, 1), + M_UINT (Channel_Quality_Report_t, Slot[4].I_LEVEL_TN, 4), + + M_NEXT_EXIST (Channel_Quality_Report_t, Slot[5].Exist, 1), + M_UINT (Channel_Quality_Report_t, Slot[5].I_LEVEL_TN, 4), + + M_NEXT_EXIST (Channel_Quality_Report_t, Slot[6].Exist, 1), + M_UINT (Channel_Quality_Report_t, Slot[6].I_LEVEL_TN, 4), + + M_NEXT_EXIST (Channel_Quality_Report_t, Slot[7].Exist, 1), + M_UINT (Channel_Quality_Report_t, Slot[7].I_LEVEL_TN, 4), +CSN_DESCR_END (Channel_Quality_Report_t) + +/*< EGPRS Ack/Nack Description >*/ +static const +CSN_DESCR_BEGIN (EGPRS_AckNack_t) + M_NEXT_EXIST (EGPRS_AckNack_t, Exist_LENGTH, 1), + M_UINT (EGPRS_AckNack_t, LENGTH, 8), + + M_UINT (EGPRS_AckNack_t, FINAL_ACK_INDICATION, 1), + M_UINT (EGPRS_AckNack_t, BEGINNING_OF_WINDOW, 1), + M_UINT (EGPRS_AckNack_t, END_OF_WINDOW, 1), + M_UINT (EGPRS_AckNack_t, STARTING_SEQUENCE_NUMBER, 11), + + M_NEXT_EXIST (EGPRS_AckNack_t, Exist_CRBB, 3), + M_UINT (EGPRS_AckNack_t, CRBB_LENGTH, 7), + M_UINT (EGPRS_AckNack_t, CRBB_STARTING_COLOR_CODE, 1), + M_LEFT_VAR_BMP (EGPRS_AckNack_t, CRBB, CRBB_LENGTH, 0), +CSN_DESCR_END (EGPRS_AckNack_t) + +/**/ +/**/ +static const +CSN_DESCR_BEGIN(MobileAllocationIE_t) + M_UINT (MobileAllocationIE_t, Length, 8), + M_VAR_ARRAY (MobileAllocationIE_t, MA, Length, 0), +CSN_DESCR_END (MobileAllocationIE_t) + +static const +CSN_DESCR_BEGIN(SingleRFChannel_t) + M_UINT (SingleRFChannel_t, spare, 2), + M_UINT (SingleRFChannel_t, ARFCN, 10), +CSN_DESCR_END (SingleRFChannel_t) + +static const +CSN_DESCR_BEGIN(RFHoppingChannel_t) + M_UINT (RFHoppingChannel_t, MAIO, 6), + M_UINT (RFHoppingChannel_t, HSN, 6), +CSN_DESCR_END (RFHoppingChannel_t) + +static const +CSN_DESCR_BEGIN(MobileAllocation_or_Frequency_Short_List_t) + M_UNION (MobileAllocation_or_Frequency_Short_List_t, 2), + M_BITMAP (MobileAllocation_or_Frequency_Short_List_t, u.Frequency_Short_List, 64), + M_TYPE (MobileAllocation_or_Frequency_Short_List_t, u.MA, MobileAllocationIE_t), +CSN_DESCR_END (MobileAllocation_or_Frequency_Short_List_t) + +static const +CSN_DESCR_BEGIN(Channel_Description_t) + M_UINT (Channel_Description_t, Channel_type_and_TDMA_offset, 5), + M_UINT (Channel_Description_t, TN, 3), + M_UINT (Channel_Description_t, TSC, 3), + + M_UNION (Channel_Description_t, 2), + M_TYPE (Channel_Description_t, u.SingleRFChannel, SingleRFChannel_t), + M_TYPE (Channel_Description_t, u.RFHoppingChannel, RFHoppingChannel_t), +CSN_DESCR_END(Channel_Description_t) + +static const +CSN_DESCR_BEGIN(Group_Channel_Description_t) + M_TYPE (Group_Channel_Description_t, Channel_Description, Channel_Description_t), + + M_NEXT_EXIST (Group_Channel_Description_t, Exist_Hopping, 1), + M_TYPE (Group_Channel_Description_t, MA_or_Frequency_Short_List, MobileAllocation_or_Frequency_Short_List_t), +CSN_DESCR_END (Group_Channel_Description_t) + +static const +CSN_DESCR_BEGIN(Group_Call_Reference_t) + M_UINT (Group_Call_Reference_t, value, 27), + M_BIT (Group_Call_Reference_t, SF), + M_BIT (Group_Call_Reference_t, AF), + M_UINT (Group_Call_Reference_t, call_priority, 3), + M_UINT (Group_Call_Reference_t, Ciphering_information, 4), +CSN_DESCR_END (Group_Call_Reference_t) + +static const +CSN_DESCR_BEGIN(Group_Call_information_t) + M_TYPE (Group_Call_information_t, Group_Call_Reference, Group_Call_Reference_t), + + M_NEXT_EXIST (Group_Call_information_t, Exist_Group_Channel_Description, 1), + M_TYPE (Group_Call_information_t, Group_Channel_Description, Group_Channel_Description_t), +CSN_DESCR_END (Group_Call_information_t) + +static const +CSN_DESCR_BEGIN (P1_Rest_Octets_t) + M_NEXT_EXIST_LH(P1_Rest_Octets_t, Exist_NLN_PCH_and_NLN_status, 2), + M_UINT (P1_Rest_Octets_t, NLN_PCH, 2), + M_UINT (P1_Rest_Octets_t, NLN_status, 1), + + M_NEXT_EXIST_LH(P1_Rest_Octets_t, Exist_Priority1, 1), + M_UINT (P1_Rest_Octets_t, Priority1, 3), + + M_NEXT_EXIST_LH(P1_Rest_Octets_t, Exist_Priority2, 1), + M_UINT (P1_Rest_Octets_t, Priority2, 3), + + M_NEXT_EXIST_LH(P1_Rest_Octets_t, Exist_Group_Call_information, 1), + M_TYPE (P1_Rest_Octets_t, Group_Call_information, Group_Call_information_t), + + M_UINT_LH (P1_Rest_Octets_t, Packet_Page_Indication_1, 1), + M_UINT_LH (P1_Rest_Octets_t, Packet_Page_Indication_2, 1), +CSN_DESCR_END (P1_Rest_Octets_t) + +static const +CSN_DESCR_BEGIN (P2_Rest_Octets_t) + M_NEXT_EXIST_LH(P2_Rest_Octets_t, Exist_CN3, 1), + M_UINT (P2_Rest_Octets_t, CN3, 2), + + M_NEXT_EXIST_LH(P2_Rest_Octets_t, Exist_NLN_and_status, 2), + M_UINT (P2_Rest_Octets_t, NLN, 2), + M_UINT (P2_Rest_Octets_t, NLN_status, 1), + + M_NEXT_EXIST_LH(P2_Rest_Octets_t, Exist_Priority1, 1), + M_UINT (P2_Rest_Octets_t, Priority1, 3), + + M_NEXT_EXIST_LH(P2_Rest_Octets_t, Exist_Priority2, 1), + M_UINT (P2_Rest_Octets_t, Priority2, 3), + + M_NEXT_EXIST_LH(P2_Rest_Octets_t, Exist_Priority3, 1), + M_UINT (P2_Rest_Octets_t, Priority3, 3), + + M_UINT_LH (P2_Rest_Octets_t, Packet_Page_Indication_3, 1), +CSN_DESCR_END (P2_Rest_Octets_t) + + +/* + * Note!! + * - first two bits skipped and frequencyparameters skipped + * - additions for R99 and EGPRS added + */ +static const +CSN_DESCR_BEGIN(DynamicAllocation_t) + M_UINT (DynamicAllocation_t, USF, 3), + M_UINT (DynamicAllocation_t, USF_GRANULARITY, 1), + + M_NEXT_EXIST (DynamicAllocation_t, Exist_P0_PR_MODE, 2), + M_UINT (DynamicAllocation_t, P0, 4), + M_UINT (DynamicAllocation_t, PR_MODE, 1), +CSN_DESCR_END (DynamicAllocation_t) + +static const +CSN_DESCR_BEGIN(EGPRS_TwoPhaseAccess_t) + M_NEXT_EXIST (EGPRS_TwoPhaseAccess_t, Exist_ALPHA, 1), + M_UINT (EGPRS_TwoPhaseAccess_t, ALPHA, 4), + + M_UINT (EGPRS_TwoPhaseAccess_t, GAMMA, 5), + M_TYPE (EGPRS_TwoPhaseAccess_t, TBF_STARTING_TIME, StartingTime_t), + M_UINT (EGPRS_TwoPhaseAccess_t, NR_OF_RADIO_BLOCKS_ALLOCATED, 2), + + M_NEXT_EXIST (EGPRS_TwoPhaseAccess_t, Exist_P0_BTS_PWR_CTRL_PR_MODE, 3), + M_UINT (EGPRS_TwoPhaseAccess_t, P0, 4), + M_UINT (EGPRS_TwoPhaseAccess_t, BTS_PWR_CTRL_MODE, 1), + M_UINT (EGPRS_TwoPhaseAccess_t, PR_MODE, 1), +CSN_DESCR_END (EGPRS_TwoPhaseAccess_t) + +static const +CSN_DESCR_BEGIN(EGPRS_OnePhaseAccess_t) + M_UINT (EGPRS_OnePhaseAccess_t, TFI_ASSIGNMENT, 5), + M_UINT (EGPRS_OnePhaseAccess_t, POLLING, 1), + + M_UNION (EGPRS_OnePhaseAccess_t, 2), + M_TYPE (EGPRS_OnePhaseAccess_t, Allocation.DynamicAllocation, DynamicAllocation_t), + CSN_ERROR (EGPRS_OnePhaseAccess_t, "1 ", CSN_ERROR_STREAM_NOT_SUPPORTED), + + M_UINT (EGPRS_OnePhaseAccess_t, EGPRS_CHANNEL_CODING_COMMAND, 4), + M_UINT (EGPRS_OnePhaseAccess_t, TLLI_BLOCK_CHANNEL_CODING, 1), + + M_NEXT_EXIST (EGPRS_OnePhaseAccess_t, Exist_BEP_PERIOD2, 1), + M_UINT (EGPRS_OnePhaseAccess_t, BEP_PERIOD2, 4), + + M_UINT (EGPRS_OnePhaseAccess_t, RESEGMENT, 1), + M_UINT (EGPRS_OnePhaseAccess_t, EGPRS_WindowSize, 5), + + M_NEXT_EXIST (EGPRS_OnePhaseAccess_t, Exist_ALPHA, 1), + M_UINT (EGPRS_OnePhaseAccess_t, ALPHA, 4), + + M_UINT (EGPRS_OnePhaseAccess_t, GAMMA, 5), + + M_NEXT_EXIST (EGPRS_OnePhaseAccess_t, Exist_TIMING_ADVANCE_INDEX, 1), + M_UINT (EGPRS_OnePhaseAccess_t, TIMING_ADVANCE_INDEX, 4), + + M_NEXT_EXIST (EGPRS_OnePhaseAccess_t, Exist_TBF_STARTING_TIME, 1), + M_TYPE (EGPRS_OnePhaseAccess_t, TBF_STARTING_TIME, StartingTime_t), +CSN_DESCR_END (EGPRS_OnePhaseAccess_t) + +static const +CSN_DESCR_BEGIN(IA_EGPRS_00_t) + M_UINT (IA_EGPRS_00_t, ExtendedRA, 5), + + M_REC_ARRAY (IA_EGPRS_00_t, AccessTechnologyType, NrOfAccessTechnologies, 4), + + M_UNION (IA_EGPRS_00_t, 2), + M_TYPE (IA_EGPRS_00_t, Access.TwoPhaseAccess, EGPRS_TwoPhaseAccess_t), + M_TYPE (IA_EGPRS_00_t, Access.OnePhaseAccess, EGPRS_OnePhaseAccess_t), +CSN_DESCR_END (IA_EGPRS_00_t) + +static const +CSN_ChoiceElement_t IA_EGPRS_Choice[] = +{ + {2, 0x00, M_TYPE (IA_EGPRS_t, u.IA_EGPRS_PUA, IA_EGPRS_00_t)}, + {2, 0x01, CSN_ERROR(IA_EGPRS_t, "01 ", CSN_ERROR_STREAM_NOT_SUPPORTED)}, + {1, 0x01, CSN_ERROR(IA_EGPRS_t, "1 ", CSN_ERROR_STREAM_NOT_SUPPORTED)} +}; + +/* Please observe the double usage of UnionType element. + * First, it is used to store the second bit of LL/LH identification of EGPRS contents. + * Thereafter, UnionType will be used to store the index to detected choice. + */ +static const +CSN_DESCR_BEGIN(IA_EGPRS_t) + M_UINT (IA_EGPRS_t, UnionType , 1 ), + M_CHOICE (IA_EGPRS_t, UnionType, IA_EGPRS_Choice, ElementsOf(IA_EGPRS_Choice)), +CSN_DESCR_END (IA_EGPRS_t) + +static const +CSN_DESCR_BEGIN(IA_FreqParamsBeforeTime_t) + M_UINT (IA_FreqParamsBeforeTime_t, Length, 6), + M_UINT (IA_FreqParamsBeforeTime_t, MAIO, 6), + M_VAR_ARRAY (IA_FreqParamsBeforeTime_t, MobileAllocation, Length, 8), +CSN_DESCR_END (IA_FreqParamsBeforeTime_t) + +static const +CSN_DESCR_BEGIN (GPRS_SingleBlockAllocation_t) + M_NEXT_EXIST (GPRS_SingleBlockAllocation_t, Exist_ALPHA, 1), + M_UINT (GPRS_SingleBlockAllocation_t, ALPHA, 4), + + M_UINT (GPRS_SingleBlockAllocation_t, GAMMA, 5), + M_FIXED (GPRS_SingleBlockAllocation_t, 2, 0x01), + M_TYPE (GPRS_SingleBlockAllocation_t, TBF_STARTING_TIME, StartingTime_t), /*bit(16)*/ + + M_NEXT_EXIST_LH(GPRS_SingleBlockAllocation_t, Exist_P0_BTS_PWR_CTRL_PR_MODE, 3), + M_UINT (GPRS_SingleBlockAllocation_t, P0, 4), + M_UINT (GPRS_SingleBlockAllocation_t, BTS_PWR_CTRL_MODE, 1), + M_UINT (GPRS_SingleBlockAllocation_t, PR_MODE, 1), +CSN_DESCR_END (GPRS_SingleBlockAllocation_t) + +static const +CSN_DESCR_BEGIN (GPRS_DynamicOrFixedAllocation_t) + M_UINT (GPRS_DynamicOrFixedAllocation_t, TFI_ASSIGNMENT, 5), + M_UINT (GPRS_DynamicOrFixedAllocation_t, POLLING, 1), + + M_UNION (GPRS_DynamicOrFixedAllocation_t, 2), + M_TYPE (GPRS_DynamicOrFixedAllocation_t, Allocation.DynamicAllocation, DynamicAllocation_t), + CSN_ERROR (GPRS_DynamicOrFixedAllocation_t, "1 ", CSN_ERROR_STREAM_NOT_SUPPORTED), + + M_UINT (GPRS_DynamicOrFixedAllocation_t, CHANNEL_CODING_COMMAND, 2), + M_UINT (GPRS_DynamicOrFixedAllocation_t, TLLI_BLOCK_CHANNEL_CODING, 1), + + M_NEXT_EXIST (GPRS_DynamicOrFixedAllocation_t, Exist_ALPHA, 1), + M_UINT (GPRS_DynamicOrFixedAllocation_t, ALPHA, 4), + + M_UINT (GPRS_DynamicOrFixedAllocation_t, GAMMA, 5), + + M_NEXT_EXIST (GPRS_DynamicOrFixedAllocation_t, Exist_TIMING_ADVANCE_INDEX, 1), + M_UINT (GPRS_DynamicOrFixedAllocation_t, TIMING_ADVANCE_INDEX, 4), + + M_NEXT_EXIST (GPRS_DynamicOrFixedAllocation_t, Exist_TBF_STARTING_TIME, 1), + M_TYPE (GPRS_DynamicOrFixedAllocation_t, TBF_STARTING_TIME, StartingTime_t), +CSN_DESCR_END (GPRS_DynamicOrFixedAllocation_t) + +static const +CSN_DESCR_BEGIN(PU_IA_AdditionsR99_t) + M_NEXT_EXIST (PU_IA_AdditionsR99_t, Exist_ExtendedRA, 1), + M_UINT (PU_IA_AdditionsR99_t, ExtendedRA, 5), +CSN_DESCR_END (PU_IA_AdditionsR99_t) + +static const +CSN_DESCR_BEGIN (Packet_Uplink_ImmAssignment_t) + M_UNION (Packet_Uplink_ImmAssignment_t, 2), + M_TYPE (Packet_Uplink_ImmAssignment_t, Access.SingleBlockAllocation, GPRS_SingleBlockAllocation_t), + M_TYPE (Packet_Uplink_ImmAssignment_t, Access.DynamicOrFixedAllocation, GPRS_DynamicOrFixedAllocation_t), + + M_NEXT_EXIST_OR_NULL_LH(Packet_Uplink_ImmAssignment_t, Exist_AdditionsR99, 1), + M_TYPE (Packet_Uplink_ImmAssignment_t, AdditionsR99, PU_IA_AdditionsR99_t), +CSN_DESCR_END (Packet_Uplink_ImmAssignment_t) + +static const +CSN_DESCR_BEGIN(PD_IA_AdditionsR99_t) + M_UINT (PD_IA_AdditionsR99_t, EGPRS_WindowSize, 5), + M_UINT (PD_IA_AdditionsR99_t, LINK_QUALITY_MEASUREMENT_MODE, 2), + + M_NEXT_EXIST (PD_IA_AdditionsR99_t, Exist_BEP_PERIOD2, 1), + M_UINT (PD_IA_AdditionsR99_t, BEP_PERIOD2, 4), +CSN_DESCR_END (PD_IA_AdditionsR99_t) + +static const +CSN_DESCR_BEGIN(Packet_Downlink_ImmAssignment_t) + M_UINT (Packet_Downlink_ImmAssignment_t, TLLI, 32), + + M_NEXT_EXIST (Packet_Downlink_ImmAssignment_t, Exist_TFI_to_TA_VALID, 6 + 1), + M_UINT (Packet_Downlink_ImmAssignment_t, TFI_ASSIGNMENT, 5), + M_UINT (Packet_Downlink_ImmAssignment_t, RLC_MODE, 1), + M_NEXT_EXIST (Packet_Downlink_ImmAssignment_t, Exist_ALPHA, 1), + M_UINT (Packet_Downlink_ImmAssignment_t, ALPHA, 4), + M_UINT (Packet_Downlink_ImmAssignment_t, GAMMA, 5), + M_UINT (Packet_Downlink_ImmAssignment_t, POLLING, 1), + M_UINT (Packet_Downlink_ImmAssignment_t, TA_VALID, 1), + + M_NEXT_EXIST (Packet_Downlink_ImmAssignment_t, Exist_TIMING_ADVANCE_INDEX, 1), + M_UINT (Packet_Downlink_ImmAssignment_t, TIMING_ADVANCE_INDEX, 4), + + M_NEXT_EXIST (Packet_Downlink_ImmAssignment_t, Exist_TBF_STARTING_TIME, 1), + M_TYPE (Packet_Downlink_ImmAssignment_t, TBF_STARTING_TIME, StartingTime_t), + + M_NEXT_EXIST (Packet_Downlink_ImmAssignment_t, Exist_P0_PR_MODE, 3), + M_UINT (Packet_Downlink_ImmAssignment_t, P0, 4), + M_UINT (Packet_Downlink_ImmAssignment_t, BTS_PWR_CTRL_MODE, 1), + M_UINT (Packet_Downlink_ImmAssignment_t, PR_MODE, 1), + + M_NEXT_EXIST_OR_NULL_LH(Packet_Downlink_ImmAssignment_t, Exist_AdditionsR99, 1), + M_TYPE (Packet_Downlink_ImmAssignment_t, AdditionsR99, PD_IA_AdditionsR99_t), +CSN_DESCR_END (Packet_Downlink_ImmAssignment_t) + +static const +CSN_DESCR_BEGIN (Second_Part_Packet_Assignment_t) + M_NEXT_EXIST_OR_NULL_LH(Second_Part_Packet_Assignment_t, Exist_SecondPart, 2), + M_NEXT_EXIST (Second_Part_Packet_Assignment_t, Exist_ExtendedRA, 1), + M_UINT (Second_Part_Packet_Assignment_t, ExtendedRA, 5), +CSN_DESCR_END (Second_Part_Packet_Assignment_t) + +static const +CSN_DESCR_BEGIN(IA_PacketAssignment_UL_DL_t) + M_UNION (IA_PacketAssignment_UL_DL_t, 2), + M_TYPE (IA_PacketAssignment_UL_DL_t, ul_dl.Packet_Uplink_ImmAssignment, Packet_Uplink_ImmAssignment_t), + M_TYPE (IA_PacketAssignment_UL_DL_t, ul_dl.Packet_Downlink_ImmAssignment, Packet_Downlink_ImmAssignment_t), +CSN_DESCR_END (IA_PacketAssignment_UL_DL_t) + +static const +CSN_DESCR_BEGIN(IA_PacketAssignment_t) + M_UNION (IA_PacketAssignment_t, 2), + M_TYPE (IA_PacketAssignment_t, u.UplinkDownlinkAssignment, IA_PacketAssignment_UL_DL_t), + M_TYPE (IA_PacketAssignment_t, u.UplinkDownlinkAssignment, Second_Part_Packet_Assignment_t), +CSN_DESCR_END (IA_PacketAssignment_t) + +/* */ +static const +CSN_ChoiceElement_t PacketPollingID[] = +{ + {1, 0, M_TYPE(PacketPollingID_t, u.Global_TFI, Global_TFI_t)}, + {2, 0x02, M_UINT(PacketPollingID_t, u.TLLI, 32)}, + {3, 0x06, M_UINT(PacketPollingID_t, u.TQI, 16)}, +/*{3, 0x07 , M_TYPE(PacketUplinkID_t, u.Packet_Request_Reference, Packet_Request_Reference_t)},*/ +}; + +static const +CSN_DESCR_BEGIN(PacketPollingID_t) + M_CHOICE (PacketPollingID_t, UnionType, PacketPollingID, ElementsOf(PacketPollingID)), +CSN_DESCR_END (PacketPollingID_t) + +static const +CSN_DESCR_BEGIN(Packet_Polling_Request_t) + M_UINT (Packet_Polling_Request_t, MESSAGE_TYPE, 6), + M_UINT (Packet_Polling_Request_t, PAGE_MODE, 2), + M_TYPE (Packet_Polling_Request_t, ID, PacketPollingID_t), + M_BIT (Packet_Polling_Request_t, TYPE_OF_ACK), +CSN_DESCR_END (Packet_Polling_Request_t) + +static const +CSN_DESCR_BEGIN(MobileAllocation_t) + M_UINT_OFFSET(MobileAllocation_t, MA_BitLength, 6, 1), + M_VAR_BITMAP (MobileAllocation_t, MA_BITMAP, MA_BitLength, 0), +CSN_DESCR_END (MobileAllocation_t) + +static const +CSN_DESCR_BEGIN(ARFCN_index_list_t) + M_REC_ARRAY (ARFCN_index_list_t, ARFCN_INDEX, ElementsOf_ARFCN_INDEX, 6), +CSN_DESCR_END (ARFCN_index_list_t) + +static const +CSN_DESCR_BEGIN(GPRS_Mobile_Allocation_t) + M_UINT (GPRS_Mobile_Allocation_t, HSN, 6), + M_REC_ARRAY (GPRS_Mobile_Allocation_t, RFL_NUMBER, ElementsOf_RFL_NUMBER, 4), + M_UNION (GPRS_Mobile_Allocation_t, 2), + M_TYPE (GPRS_Mobile_Allocation_t, u.MA, MobileAllocation_t), + M_TYPE (GPRS_Mobile_Allocation_t, u.ARFCN_index_list, ARFCN_index_list_t), +CSN_DESCR_END (GPRS_Mobile_Allocation_t) + +/*< SI 13 Rest Octets >*/ +static const +CSN_DESCR_BEGIN (Extension_Bits_t) + M_UINT_OFFSET (Extension_Bits_t, extension_length, 6, 1), + M_LEFT_VAR_BMP(Extension_Bits_t, Extension_Info, extension_length, 0), +CSN_DESCR_END (Extension_Bits_t) + +static const +CSN_DESCR_BEGIN(GPRS_Cell_Options_t) + M_UINT (GPRS_Cell_Options_t, NMO, 2), + M_UINT_OFFSET(GPRS_Cell_Options_t, T3168, 3, 1), + M_UINT_OFFSET(GPRS_Cell_Options_t, T3192, 3, 1), + M_UINT (GPRS_Cell_Options_t, DRX_TIMER_MAX, 3), + M_BIT (GPRS_Cell_Options_t, ACCESS_BURST_TYPE), + M_BIT (GPRS_Cell_Options_t, CONTROL_ACK_TYPE), + M_UINT (GPRS_Cell_Options_t, BS_CV_MAX, 4), + + M_NEXT_EXIST (GPRS_Cell_Options_t, Exist_PAN, 3), + M_UINT (GPRS_Cell_Options_t, PAN_DEC, 3), + M_UINT (GPRS_Cell_Options_t, PAN_INC, 3), + M_UINT (GPRS_Cell_Options_t, PAN_MAX, 3), + + M_NEXT_EXIST (GPRS_Cell_Options_t, Exist_Extension_Bits, 1), + M_TYPE (GPRS_Cell_Options_t, Extension_Bits, Extension_Bits_t), +CSN_DESCR_END (GPRS_Cell_Options_t) + +static const +CSN_DESCR_BEGIN(PBCCH_Not_present_t) + M_UINT (PBCCH_Not_present_t, RAC, 8), + M_BIT (PBCCH_Not_present_t, SPGC_CCCH_SUP), + M_UINT (PBCCH_Not_present_t, PRIORITY_ACCESS_THR, 3), + M_UINT (PBCCH_Not_present_t, NETWORK_CONTROL_ORDER, 2), + M_TYPE (PBCCH_Not_present_t, GPRS_Cell_Options, GPRS_Cell_Options_t), + M_TYPE (PBCCH_Not_present_t, GPRS_Power_Control_Parameters, GPRS_Power_Control_Parameters_t), +CSN_DESCR_END (PBCCH_Not_present_t) + +static const +CSN_ChoiceElement_t SI13_PBCCH_Description_Channel[] = +{/* this one is used in SI13*/ + {2, 0x00 , M_NULL(PBCCH_Description_t, u.dummy)},/*Default to BCCH carrier*/ + {2, 0x01 , M_UINT(PBCCH_Description_t, u.ARFCN, 10)}, + {1, 0x01 , M_UINT(PBCCH_Description_t, u.MAIO, 6)}, +}; + +static const +CSN_DESCR_BEGIN(PBCCH_Description_t)/*SI13*/ + M_UINT (PBCCH_Description_t, Pb, 4), + M_UINT (PBCCH_Description_t, TSC, 3), + M_UINT (PBCCH_Description_t, TN, 3), + + M_CHOICE (PBCCH_Description_t, UnionType, SI13_PBCCH_Description_Channel, ElementsOf(SI13_PBCCH_Description_Channel)), +CSN_DESCR_END (PBCCH_Description_t) + +static const +CSN_DESCR_BEGIN(PBCCH_present_t) + M_UINT (PBCCH_present_t, PSI1_REPEAT_PERIOD, 4), + M_TYPE (PBCCH_present_t, PBCCH_Description, PBCCH_Description_t), +CSN_DESCR_END (PBCCH_present_t) + +static const +CSN_DESCR_BEGIN(SI13_AdditionsR6) + M_NEXT_EXIST (SI13_AdditionsR6, Exist_LB_MS_TXPWR_MAX_CCH, 1), + M_UINT (SI13_AdditionsR6, LB_MS_TXPWR_MAX_CCH, 5), + M_UINT (SI13_AdditionsR6, SI2n_SUPPORT, 2), +CSN_DESCR_END (SI13_AdditionsR6) + +static const +CSN_DESCR_BEGIN(SI13_AdditionsR4) + M_UINT (SI13_AdditionsR4, SI_STATUS_IND, 1), + M_NEXT_EXIST_OR_NULL_LH (SI13_AdditionsR4, Exist_AdditionsR6, 1), + M_TYPE (SI13_AdditionsR4, AdditionsR6, SI13_AdditionsR6), +CSN_DESCR_END (SI13_AdditionsR4) + +static const +CSN_DESCR_BEGIN(SI13_AdditionR99) + M_UINT (SI13_AdditionR99, SGSNR, 1), + M_NEXT_EXIST_OR_NULL_LH (SI13_AdditionR99, Exist_AdditionsR4, 1), + M_TYPE (SI13_AdditionR99, AdditionsR4, SI13_AdditionsR4), +CSN_DESCR_END (SI13_AdditionR99) + +static const +CSN_DESCR_BEGIN (SI_13_t) + M_THIS_EXIST_LH (SI_13_t), + + M_UINT (SI_13_t, BCCH_CHANGE_MARK, 3), + M_UINT (SI_13_t, SI_CHANGE_FIELD, 4), + + M_NEXT_EXIST (SI_13_t, Exist_MA, 2), + M_UINT (SI_13_t, SI13_CHANGE_MARK, 2), + M_TYPE (SI_13_t, GPRS_Mobile_Allocation, GPRS_Mobile_Allocation_t), + + M_UNION (SI_13_t, 2), + M_TYPE (SI_13_t, u.PBCCH_Not_present, PBCCH_Not_present_t), + M_TYPE (SI_13_t, u.PBCCH_present, PBCCH_present_t), + + M_NEXT_EXIST_OR_NULL_LH(SI_13_t, Exist_AdditionsR99, 1), + M_TYPE (SI_13_t, AdditionsR99, SI13_AdditionR99), +CSN_DESCR_END (SI_13_t) + +/************************************************************/ +/* TS 44.060 messages */ +/************************************************************/ + +/*< Packet TBF Release message content >*/ +static const +CSN_DESCR_BEGIN(Packet_TBF_Release_t) + M_UINT (Packet_TBF_Release_t, MESSAGE_TYPE, 6), + M_UINT (Packet_TBF_Release_t, PAGE_MODE, 2), + M_FIXED (Packet_TBF_Release_t, 1, 0x00), + M_TYPE (Packet_TBF_Release_t, Global_TFI, Global_TFI_t), + M_BIT (Packet_TBF_Release_t, UPLINK_RELEASE), + M_BIT (Packet_TBF_Release_t, DOWNLINK_RELEASE), + M_UINT (Packet_TBF_Release_t, TBF_RELEASE_CAUSE, 4), +CSN_DESCR_END (Packet_TBF_Release_t) + +/*< Packet Control Acknowledgement message content >*/ + +static const +CSN_DESCR_BEGIN (Packet_Control_Acknowledgement_AdditionsR6_t) + M_NEXT_EXIST (Packet_Control_Acknowledgement_AdditionsR6_t, Exist_CTRL_ACK_Extension, 1), + M_UINT (Packet_Control_Acknowledgement_AdditionsR6_t, CTRL_ACK_Extension, 9), +CSN_DESCR_END (Packet_Control_Acknowledgement_AdditionsR6_t) + +static const +CSN_DESCR_BEGIN (Packet_Control_Acknowledgement_AdditionsR5_t) + M_NEXT_EXIST (Packet_Control_Acknowledgement_AdditionsR5_t, Exist_TN_RRBP, 1), + M_UINT (Packet_Control_Acknowledgement_AdditionsR5_t, TN_RRBP, 3), + M_NEXT_EXIST (Packet_Control_Acknowledgement_AdditionsR5_t, Exist_G_RNTI_Extension, 1), + M_UINT (Packet_Control_Acknowledgement_AdditionsR5_t, G_RNTI_Extension, 4), + + M_NEXT_EXIST_OR_NULL (Packet_Control_Acknowledgement_AdditionsR5_t, Exist_AdditionsR6, 1), + M_TYPE (Packet_Control_Acknowledgement_AdditionsR5_t, AdditionsR6, Packet_Control_Acknowledgement_AdditionsR6_t), +CSN_DESCR_END (Packet_Control_Acknowledgement_AdditionsR5_t) + +static const +CSN_DESCR_BEGIN (Packet_Control_Acknowledgement_t) + M_UINT (Packet_Control_Acknowledgement_t, PayloadType, 2), + M_UINT (Packet_Control_Acknowledgement_t, spare, 5), + M_BIT (Packet_Control_Acknowledgement_t, R), + + M_UINT (Packet_Control_Acknowledgement_t, MESSAGE_TYPE, 6), + M_UINT (Packet_Control_Acknowledgement_t, TLLI, 32), + M_UINT (Packet_Control_Acknowledgement_t, CTRL_ACK, 2), + M_NEXT_EXIST_OR_NULL (Packet_Control_Acknowledgement_t, Exist_AdditionsR5, 1), + M_TYPE (Packet_Control_Acknowledgement_t, AdditionsR5, Packet_Control_Acknowledgement_AdditionsR5_t), +CSN_DESCR_END (Packet_Control_Acknowledgement_t) + +/*< Packet Downlink Dummy Control Block message content >*/ +static const +CSN_DESCR_BEGIN(Packet_Downlink_Dummy_Control_Block_t) + M_UINT (Packet_Downlink_Dummy_Control_Block_t, MESSAGE_TYPE, 6), + M_UINT (Packet_Downlink_Dummy_Control_Block_t, PAGE_MODE, 2), + + M_NEXT_EXIST (Packet_Downlink_Dummy_Control_Block_t, Exist_PERSISTENCE_LEVEL, 1), + M_UINT_ARRAY (Packet_Downlink_Dummy_Control_Block_t, PERSISTENCE_LEVEL, 4, 4), +CSN_DESCR_END (Packet_Downlink_Dummy_Control_Block_t) + +/*< Packet Uplink Dummy Control Block message content >*/ +static const +CSN_DESCR_BEGIN(Packet_Uplink_Dummy_Control_Block_t) + M_UINT (Packet_Uplink_Dummy_Control_Block_t, PayloadType, 2), + M_UINT (Packet_Uplink_Dummy_Control_Block_t, spare, 5), + M_BIT (Packet_Uplink_Dummy_Control_Block_t, R), + + M_UINT (Packet_Uplink_Dummy_Control_Block_t, MESSAGE_TYPE, 6), + M_UINT (Packet_Uplink_Dummy_Control_Block_t, TLLI, 32), +/*M_FIXED (Packet_Uplink_Dummy_Control_Block_t, 1, 0),*/ +CSN_DESCR_END (Packet_Uplink_Dummy_Control_Block_t) + +static const +CSN_DESCR_BEGIN(Receive_N_PDU_Number_t) + M_UINT (Receive_N_PDU_Number_t, nsapi, 4), + M_UINT (Receive_N_PDU_Number_t, value, 8), +CSN_DESCR_END (Receive_N_PDU_Number_t) + +gint16 Receive_N_PDU_Number_list_Dissector(csnStream_t* ar, bitvec *vector, size_t& readIndex, void* data) +{ + if (ar->direction == 0) + { + return csnStreamEncoder(ar, CSNDESCR(Receive_N_PDU_Number_t), vector, readIndex, data); + } + else + { + return csnStreamDecoder(ar, CSNDESCR(Receive_N_PDU_Number_t), vector, readIndex, data); + } +} + +static const +CSN_DESCR_BEGIN(Receive_N_PDU_Number_list_t) + M_SERIALIZE (Receive_N_PDU_Number_list_t, IEI, Receive_N_PDU_Number_list_Dissector), + M_VAR_TARRAY (Receive_N_PDU_Number_list_t, Receive_N_PDU_Number, Receive_N_PDU_Number_t, Count_Receive_N_PDU_Number), +CSN_DESCR_END (Receive_N_PDU_Number_list_t) + +/*< MS Radio Access capability IE >*/ +static const +CSN_DESCR_BEGIN (DTM_EGPRS_t) + M_NEXT_EXIST (DTM_EGPRS_t, Exist_DTM_EGPRS_multislot_class, 1), + M_UINT (DTM_EGPRS_t, DTM_EGPRS_multislot_class, 2), +CSN_DESCR_END (DTM_EGPRS_t) + +static const +CSN_DESCR_BEGIN (DTM_EGPRS_HighMultislotClass_t) + M_NEXT_EXIST (DTM_EGPRS_HighMultislotClass_t, Exist_DTM_EGPRS_HighMultislotClass, 1), + M_UINT (DTM_EGPRS_HighMultislotClass_t, DTM_EGPRS_HighMultislotClass, 3), +CSN_DESCR_END (DTM_EGPRS_HighMultislotClass_t) + +static const +CSN_DESCR_BEGIN (Multislot_capability_t) + M_NEXT_EXIST (Multislot_capability_t, Exist_HSCSD_multislot_class, 1), + M_UINT (Multislot_capability_t, HSCSD_multislot_class, 5), + + M_NEXT_EXIST (Multislot_capability_t, Exist_GPRS_multislot_class, 2), + M_UINT (Multislot_capability_t, GPRS_multislot_class, 5), + M_UINT (Multislot_capability_t, GPRS_Extended_Dynamic_Allocation_Capability, 1), + + M_NEXT_EXIST (Multislot_capability_t, Exist_SM, 2), + M_UINT (Multislot_capability_t, SMS_VALUE, 4), + M_UINT (Multislot_capability_t, SM_VALUE, 4), + + M_NEXT_EXIST (Multislot_capability_t, Exist_ECSD_multislot_class, 1), + M_UINT (Multislot_capability_t, ECSD_multislot_class, 5), + + M_NEXT_EXIST (Multislot_capability_t, Exist_EGPRS_multislot_class, 2), + M_UINT (Multislot_capability_t, EGPRS_multislot_class, 5), + M_UINT (Multislot_capability_t, EGPRS_Extended_Dynamic_Allocation_Capability, 1), + + M_NEXT_EXIST (Multislot_capability_t, Exist_DTM_GPRS_multislot_class, 3), + M_UINT (Multislot_capability_t, DTM_GPRS_multislot_class, 2), + M_UINT (Multislot_capability_t, Single_Slot_DTM, 1), + M_TYPE (Multislot_capability_t, DTM_EGPRS_Params, DTM_EGPRS_t), +CSN_DESCR_END (Multislot_capability_t) + +static const +CSN_DESCR_BEGIN (Content_t) + M_UINT (Content_t, RF_Power_Capability, 3), + + M_NEXT_EXIST (Content_t, Exist_A5_bits, 1), + M_UINT (Content_t, A5_bits, 7), + + M_UINT (Content_t, ES_IND, 1), + M_UINT (Content_t, PS, 1), + M_UINT (Content_t, VGCS, 1), + M_UINT (Content_t, VBS, 1), + + M_NEXT_EXIST_OR_NULL(Content_t, Exist_Multislot_capability, 1), + M_TYPE (Content_t, Multislot_capability, Multislot_capability_t), + + M_NEXT_EXIST (Content_t, Exist_Eight_PSK_Power_Capability, 1), + M_UINT (Content_t, Eight_PSK_Power_Capability, 2), + + M_UINT (Content_t, COMPACT_Interference_Measurement_Capability, 1), + M_UINT (Content_t, Revision_Level_Indicator, 1), + M_UINT (Content_t, UMTS_FDD_Radio_Access_Technology_Capability, 1), + M_UINT (Content_t, UMTS_384_TDD_Radio_Access_Technology_Capability, 1), + M_UINT (Content_t, CDMA2000_Radio_Access_Technology_Capability, 1), + + M_UINT (Content_t, UMTS_128_TDD_Radio_Access_Technology_Capability, 1), + M_UINT (Content_t, GERAN_Feature_Package_1, 1), + + M_NEXT_EXIST (Content_t, Exist_Extended_DTM_multislot_class, 2), + M_UINT (Content_t, Extended_DTM_GPRS_multislot_class, 2), + M_UINT (Content_t, Extended_DTM_EGPRS_multislot_class, 2), + + M_UINT (Content_t, Modulation_based_multislot_class_support, 1), + + M_NEXT_EXIST (Content_t, Exist_HighMultislotCapability, 1), + M_UINT (Content_t, HighMultislotCapability, 2), + + M_NEXT_EXIST (Content_t, Exist_GERAN_lu_ModeCapability, 1), + M_UINT (Content_t, GERAN_lu_ModeCapability, 4), + + M_UINT (Content_t, GMSK_MultislotPowerProfile, 2), + M_UINT (Content_t, EightPSK_MultislotProfile, 2), + + M_UINT (Content_t, MultipleTBF_Capability, 1), + M_UINT (Content_t, DownlinkAdvancedReceiverPerformance, 2), + M_UINT (Content_t, ExtendedRLC_MAC_ControlMessageSegmentionsCapability, 1), + M_UINT (Content_t, DTM_EnhancementsCapability, 1), + + M_NEXT_EXIST (Content_t, Exist_DTM_GPRS_HighMultislotClass, 2), + M_UINT (Content_t, DTM_GPRS_HighMultislotClass, 3), + M_TYPE (Content_t, DTM_EGPRS_HighMultislotClass, DTM_EGPRS_HighMultislotClass_t), + + M_UINT (Content_t, PS_HandoverCapability, 1), +CSN_DESCR_END (Content_t) + +gint16 Content_Dissector(csnStream_t* ar, bitvec *vector, size_t& readIndex, void* data) +{ + if (ar->direction == 0) + { + return csnStreamEncoder(ar, CSNDESCR(Content_t), vector, readIndex, data); + } + else + { + return csnStreamDecoder(ar, CSNDESCR(Content_t), vector, readIndex, data); + } +} + +static const +CSN_DESCR_BEGIN (Additional_access_technologies_struct_t) + M_UINT (Additional_access_technologies_struct_t, Access_Technology_Type, 4), + M_UINT (Additional_access_technologies_struct_t, GMSK_Power_class, 3), + M_UINT (Additional_access_technologies_struct_t, Eight_PSK_Power_class, 2), +CSN_DESCR_END (Additional_access_technologies_struct_t) + +static const +CSN_DESCR_BEGIN (Additional_access_technologies_t) + M_REC_TARRAY (Additional_access_technologies_t, Additional_access_technologies[0], Additional_access_technologies_struct_t, Count_additional_access_technologies), +CSN_DESCR_END (Additional_access_technologies_t) + +gint16 Additional_access_technologies_Dissector(csnStream_t* ar, bitvec* vector, size_t& readIndex, void* data) +{ + if (ar->direction == 0) + { + return csnStreamEncoder(ar, CSNDESCR(Additional_access_technologies_t), vector, readIndex, data); + } + else + { + return csnStreamDecoder(ar, CSNDESCR(Additional_access_technologies_t), vector, readIndex, data); + } +} + +static const +CSN_ChoiceElement_t MS_RA_capability_value_Choice[] = +{ + {4, AccTech_GSMP, M_SERIALIZE (MS_RA_capability_value_t, u.Content, Content_Dissector)}, /* Long Form */ + {4, AccTech_GSME, M_SERIALIZE (MS_RA_capability_value_t, u.Content, Content_Dissector)}, /* Long Form */ + {4, AccTech_GSM1800, M_SERIALIZE (MS_RA_capability_value_t, u.Content, Content_Dissector)}, /* Long Form */ + {4, AccTech_GSM1900, M_SERIALIZE (MS_RA_capability_value_t, u.Content, Content_Dissector)}, /* Long Form */ + {4, AccTech_GSM850, M_SERIALIZE (MS_RA_capability_value_t, u.Content, Content_Dissector)}, /* Long Form */ + {4, AccTech_GSMOther, M_SERIALIZE (MS_RA_capability_value_t, u.Additional_access_technologies, Additional_access_technologies_Dissector)}, /* Short Form */ +}; + +static const +CSN_DESCR_BEGIN(MS_RA_capability_value_t) + M_CHOICE (MS_RA_capability_value_t, IndexOfAccTech, MS_RA_capability_value_Choice, ElementsOf(MS_RA_capability_value_Choice)), +CSN_DESCR_END (MS_RA_capability_value_t) + +static const +CSN_DESCR_BEGIN (MS_Radio_Access_capability_t) +/*Will be done in the main routines:*/ +/*M_UINT (MS_Radio_Access_capability_t, IEI, 8),*/ +/*M_UINT (MS_Radio_Access_capability_t, Length, 8),*/ + + M_REC_TARRAY_1(MS_Radio_Access_capability_t, MS_RA_capability_value[0], MS_RA_capability_value_t, Count_MS_RA_capability_value), +CSN_DESCR_END (MS_Radio_Access_capability_t) + +/*< MS Classmark 3 IE >*/ +static const +CSN_DESCR_BEGIN(ARC_t) + M_UINT (ARC_t, A5_Bits, 4), + M_UINT (ARC_t, Arc2_Spare, 4), + M_UINT (ARC_t, Arc1, 4), +CSN_DESCR_END (ARC_t) + +static const +CSN_ChoiceElement_t MultibandChoice[] = +{ + {3, 0x00, M_UINT(Multiband_t, u.A5_Bits, 4)}, + {3, 0x05, M_TYPE(Multiband_t, u.ARC, ARC_t)}, + {3, 0x06, M_TYPE(Multiband_t, u.ARC, ARC_t)}, + {3, 0x01, M_TYPE(Multiband_t, u.ARC, ARC_t)}, + {3, 0x02, M_TYPE(Multiband_t, u.ARC, ARC_t)}, + {3, 0x04, M_TYPE(Multiband_t, u.ARC, ARC_t)}, +}; + +static const +CSN_DESCR_BEGIN(Multiband_t) + M_CHOICE (Multiband_t, Multiband, MultibandChoice, ElementsOf(MultibandChoice)), +CSN_DESCR_END (Multiband_t) + +static const +CSN_DESCR_BEGIN(EDGE_RF_Pwr_t) + M_NEXT_EXIST (EDGE_RF_Pwr_t, ExistEDGE_RF_PwrCap1, 1), + M_UINT (EDGE_RF_Pwr_t, EDGE_RF_PwrCap1, 2), + + M_NEXT_EXIST (EDGE_RF_Pwr_t, ExistEDGE_RF_PwrCap2, 1), + M_UINT (EDGE_RF_Pwr_t, EDGE_RF_PwrCap2, 2), +CSN_DESCR_END (EDGE_RF_Pwr_t) + +static const +CSN_DESCR_BEGIN(MS_Class3_Unpacked_t) + M_UINT (MS_Class3_Unpacked_t, Spare1, 1), + M_TYPE (MS_Class3_Unpacked_t, Multiband, Multiband_t), + + M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_R_Support, 1), + M_UINT (MS_Class3_Unpacked_t, R_GSM_Arc, 3), + + M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_MultiSlotCapability, 1), + M_UINT (MS_Class3_Unpacked_t, MultiSlotClass, 5), + + M_UINT (MS_Class3_Unpacked_t, UCS2, 1), + M_UINT (MS_Class3_Unpacked_t, ExtendedMeasurementCapability, 1), + + M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_MS_MeasurementCapability, 2), + M_UINT (MS_Class3_Unpacked_t, SMS_VALUE, 4), + M_UINT (MS_Class3_Unpacked_t, SM_VALUE, 4), + + M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_MS_PositioningMethodCapability, 1), + M_UINT (MS_Class3_Unpacked_t, MS_PositioningMethod, 5), + + M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_EDGE_MultiSlotCapability, 1), + M_UINT (MS_Class3_Unpacked_t, EDGE_MultiSlotClass, 5), + + M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_EDGE_Struct, 2), + M_UINT (MS_Class3_Unpacked_t, ModulationCapability, 1), + M_TYPE (MS_Class3_Unpacked_t, EDGE_RF_PwrCaps, EDGE_RF_Pwr_t), + + M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_GSM400_Info, 2), + M_UINT (MS_Class3_Unpacked_t, GSM400_Bands, 2), + M_UINT (MS_Class3_Unpacked_t, GSM400_Arc, 4), + + M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_GSM850_Arc, 1), + M_UINT (MS_Class3_Unpacked_t, GSM850_Arc, 4), + + M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_PCS1900_Arc, 1), + M_UINT (MS_Class3_Unpacked_t, PCS1900_Arc, 4), + + M_UINT (MS_Class3_Unpacked_t, UMTS_FDD_Radio_Access_Technology_Capability, 1), + M_UINT (MS_Class3_Unpacked_t, UMTS_384_TDD_Radio_Access_Technology_Capability, 1), + M_UINT (MS_Class3_Unpacked_t, CDMA2000_Radio_Access_Technology_Capability, 1), + + M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_DTM_GPRS_multislot_class, 3), + M_UINT (MS_Class3_Unpacked_t, DTM_GPRS_multislot_class, 2), + M_UINT (MS_Class3_Unpacked_t, Single_Slot_DTM, 1), + M_TYPE (MS_Class3_Unpacked_t, DTM_EGPRS_Params, DTM_EGPRS_t), + + M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_SingleBandSupport, 1), + M_UINT (MS_Class3_Unpacked_t, GSM_Band, 4), + + M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_GSM_700_Associated_Radio_Capability, 1), + M_UINT (MS_Class3_Unpacked_t, GSM_700_Associated_Radio_Capability, 4), + + M_UINT (MS_Class3_Unpacked_t, UMTS_128_TDD_Radio_Access_Technology_Capability, 1), + M_UINT (MS_Class3_Unpacked_t, GERAN_Feature_Package_1, 1), + + M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_Extended_DTM_multislot_class, 2), + M_UINT (MS_Class3_Unpacked_t, Extended_DTM_GPRS_multislot_class, 2), + M_UINT (MS_Class3_Unpacked_t, Extended_DTM_EGPRS_multislot_class, 2), + + M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_HighMultislotCapability, 1), + M_UINT (MS_Class3_Unpacked_t, HighMultislotCapability, 2), + + M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_GERAN_lu_ModeCapability, 1), + M_UINT (MS_Class3_Unpacked_t, GERAN_lu_ModeCapability, 4), + + M_UINT (MS_Class3_Unpacked_t, GERAN_FeaturePackage_2, 1), + + M_UINT (MS_Class3_Unpacked_t, GMSK_MultislotPowerProfile, 2), + M_UINT (MS_Class3_Unpacked_t, EightPSK_MultislotProfile, 2), + + M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_TGSM_400_Bands, 2), + M_UINT (MS_Class3_Unpacked_t, TGSM_400_BandsSupported, 2), + M_UINT (MS_Class3_Unpacked_t, TGSM_400_AssociatedRadioCapability, 4), + + M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_TGSM_900_AssociatedRadioCapability, 1), + M_UINT (MS_Class3_Unpacked_t, TGSM_900_AssociatedRadioCapability, 4), + + M_UINT (MS_Class3_Unpacked_t, DownlinkAdvancedReceiverPerformance, 2), + M_UINT (MS_Class3_Unpacked_t, DTM_EnhancementsCapability, 1), + + M_NEXT_EXIST (MS_Class3_Unpacked_t, Exist_DTM_GPRS_HighMultislotClass, 3), + M_UINT (MS_Class3_Unpacked_t, DTM_GPRS_HighMultislotClass, 3), + M_UINT (MS_Class3_Unpacked_t, OffsetRequired, 1), + M_TYPE (MS_Class3_Unpacked_t, DTM_EGPRS_HighMultislotClass, DTM_EGPRS_HighMultislotClass_t), + + M_UINT (MS_Class3_Unpacked_t, RepeatedSACCH_Capability, 1), + M_UINT (MS_Class3_Unpacked_t, Spare2, 1), +CSN_DESCR_END (MS_Class3_Unpacked_t) + +static const +CSN_DESCR_BEGIN(Channel_Request_Description_t) + M_UINT (Channel_Request_Description_t, PEAK_THROUGHPUT_CLASS, 4), + M_UINT (Channel_Request_Description_t, RADIO_PRIORITY, 2), + M_BIT (Channel_Request_Description_t, RLC_MODE), + M_BIT (Channel_Request_Description_t, LLC_PDU_TYPE), + M_UINT (Channel_Request_Description_t, RLC_OCTET_COUNT, 16), +CSN_DESCR_END (Channel_Request_Description_t) + +/* < Packet Resource Request message content > */ +static const +CSN_ChoiceElement_t PacketResourceRequestID[] = +{ + {1, 0, M_TYPE(PacketResourceRequestID_t, u.Global_TFI, Global_TFI_t)}, + {1, 0x01, M_UINT(PacketResourceRequestID_t, u.TLLI, 32)}, +}; + +static const +CSN_DESCR_BEGIN(PacketResourceRequestID_t) + M_CHOICE (PacketResourceRequestID_t, UnionType, PacketResourceRequestID, ElementsOf(PacketResourceRequestID)), +CSN_DESCR_END (PacketResourceRequestID_t) + +static const +CSN_DESCR_BEGIN(BEP_MeasurementReport_t) + M_NEXT_EXIST (BEP_MeasurementReport_t, Exist, 3), + M_UNION (BEP_MeasurementReport_t, 2), + M_UINT (BEP_MeasurementReport_t, u.MEAN_BEP_GMSK, 4), + M_UINT (BEP_MeasurementReport_t, u.MEAN_BEP_8PSK, 4), +CSN_DESCR_END (BEP_MeasurementReport_t) + +static const +CSN_DESCR_BEGIN(InterferenceMeasurementReport_t) + M_NEXT_EXIST (InterferenceMeasurementReport_t, Exist, 1), + M_UINT (InterferenceMeasurementReport_t, I_LEVEL, 4), +CSN_DESCR_END (InterferenceMeasurementReport_t) + +static const +CSN_DESCR_BEGIN(EGPRS_TimeslotLinkQualityMeasurements_t) + M_NEXT_EXIST (EGPRS_TimeslotLinkQualityMeasurements_t, Exist_BEP_MEASUREMENTS, 1), + M_TYPE_ARRAY (EGPRS_TimeslotLinkQualityMeasurements_t, BEP_MEASUREMENTS, BEP_MeasurementReport_t, 8), + + M_NEXT_EXIST (EGPRS_TimeslotLinkQualityMeasurements_t, Exist_INTERFERENCE_MEASUREMENTS, 1), + M_TYPE_ARRAY (EGPRS_TimeslotLinkQualityMeasurements_t, INTERFERENCE_MEASUREMENTS, InterferenceMeasurementReport_t, 8), +CSN_DESCR_END (EGPRS_TimeslotLinkQualityMeasurements_t) + +static const +CSN_DESCR_BEGIN(EGPRS_BEP_LinkQualityMeasurements_t) + M_NEXT_EXIST (EGPRS_BEP_LinkQualityMeasurements_t, Exist_MEAN_CV_BEP_GMSK, 2), + M_UINT (EGPRS_BEP_LinkQualityMeasurements_t, MEAN_BEP_GMSK, 5), + M_UINT (EGPRS_BEP_LinkQualityMeasurements_t, CV_BEP_GMSK, 3), + + M_NEXT_EXIST (EGPRS_BEP_LinkQualityMeasurements_t, Exist_MEAN_CV_BEP_8PSK, 2), + M_UINT (EGPRS_BEP_LinkQualityMeasurements_t, MEAN_BEP_8PSK, 5), + M_UINT (EGPRS_BEP_LinkQualityMeasurements_t, CV_BEP_8PSK, 3), +CSN_DESCR_END (EGPRS_BEP_LinkQualityMeasurements_t) + +static const +CSN_DESCR_BEGIN(PRR_AdditionsR99_t) + M_NEXT_EXIST (PRR_AdditionsR99_t, Exist_EGPRS_BEP_LinkQualityMeasurements, 1), + M_TYPE (PRR_AdditionsR99_t, EGPRS_BEP_LinkQualityMeasurements, EGPRS_BEP_LinkQualityMeasurements_t), + + M_NEXT_EXIST (PRR_AdditionsR99_t, Exist_EGPRS_TimeslotLinkQualityMeasurements, 1), + M_TYPE (PRR_AdditionsR99_t, EGPRS_TimeslotLinkQualityMeasurements, EGPRS_TimeslotLinkQualityMeasurements_t), + + M_NEXT_EXIST (PRR_AdditionsR99_t, Exist_PFI, 1), + M_UINT (PRR_AdditionsR99_t, PFI, 7), + + M_UINT (PRR_AdditionsR99_t, MS_RAC_AdditionalInformationAvailable, 1), + M_UINT (PRR_AdditionsR99_t, RetransmissionOfPRR, 1), +CSN_DESCR_END (PRR_AdditionsR99_t) + +static const +CSN_DESCR_BEGIN (Packet_Resource_Request_t) + /* Mac header */ + M_UINT (Packet_Resource_Request_t, PayloadType, 2), + M_UINT (Packet_Resource_Request_t, spare, 5), + M_UINT (Packet_Resource_Request_t, R, 1), + M_UINT (Packet_Resource_Request_t, MESSAGE_TYPE, 6), + /* Mac header */ + + M_NEXT_EXIST (Packet_Resource_Request_t, Exist_ACCESS_TYPE, 1), + M_UINT (Packet_Resource_Request_t, ACCESS_TYPE, 2), + + M_TYPE (Packet_Resource_Request_t, ID, PacketResourceRequestID_t), + + M_NEXT_EXIST (Packet_Resource_Request_t, Exist_MS_Radio_Access_capability, 1), + M_TYPE (Packet_Resource_Request_t, MS_Radio_Access_capability, MS_Radio_Access_capability_t), + + M_TYPE (Packet_Resource_Request_t, Channel_Request_Description, Channel_Request_Description_t), + + M_NEXT_EXIST (Packet_Resource_Request_t, Exist_CHANGE_MARK, 1), + M_UINT (Packet_Resource_Request_t, CHANGE_MARK, 2), + + M_UINT (Packet_Resource_Request_t, C_VALUE, 6), + + M_NEXT_EXIST (Packet_Resource_Request_t, Exist_SIGN_VAR, 1), + M_UINT (Packet_Resource_Request_t, SIGN_VAR, 6), + + M_TYPE_ARRAY (Packet_Resource_Request_t, Slot, InterferenceMeasurementReport_t, 8), + + M_NEXT_EXIST_OR_NULL(Packet_Resource_Request_t, Exist_AdditionsR99, 1), + M_TYPE (Packet_Resource_Request_t, AdditionsR99, PRR_AdditionsR99_t), +CSN_DESCR_END (Packet_Resource_Request_t) + +/*< Packet Mobile TBF Status message content > */ +static const +CSN_DESCR_BEGIN(Packet_Mobile_TBF_Status_t) + /* Mac header */ + M_UINT (Packet_Mobile_TBF_Status_t, PayloadType, 2), + M_UINT (Packet_Mobile_TBF_Status_t, spare, 5), + M_UINT (Packet_Mobile_TBF_Status_t, R, 1), + M_UINT (Packet_Mobile_TBF_Status_t, MESSAGE_TYPE, 6), + /* Mac header */ + + M_TYPE (Packet_Mobile_TBF_Status_t, Global_TFI, Global_TFI_t), + M_UINT (Packet_Mobile_TBF_Status_t, TBF_CAUSE, 3), + + M_NEXT_EXIST (Packet_Mobile_TBF_Status_t, Exist_STATUS_MESSAGE_TYPE, 1), + M_UINT (Packet_Mobile_TBF_Status_t, STATUS_MESSAGE_TYPE, 6), +CSN_DESCR_END (Packet_Mobile_TBF_Status_t) + +/*< Packet PSI Status message content > */ +static const +CSN_DESCR_BEGIN(PSI_Message_t) + M_UINT (PSI_Message_t, PSI_MESSAGE_TYPE, 6), + M_UINT (PSI_Message_t, PSIX_CHANGE_MARK, 2), + M_NEXT_EXIST (PSI_Message_t, Exist_PSIX_COUNT_and_Instance_Bitmap, 2), + M_FIXED (PSI_Message_t, 4, 0), /* Placeholder for PSIX_COUNT (4 bits) */ + M_FIXED (PSI_Message_t, 1, 0), /* Placeholder for Instance bitmap (1 bit) */ +CSN_DESCR_END (PSI_Message_t) + +static const +CSN_DESCR_BEGIN(PSI_Message_List_t) + M_REC_TARRAY (PSI_Message_List_t, PSI_Message[0], PSI_Message_t, Count_PSI_Message), + M_FIXED (PSI_Message_List_t, 1, 0x00), + M_UINT (PSI_Message_List_t, ADDITIONAL_MSG_TYPE, 1), +CSN_DESCR_END (PSI_Message_List_t) + +static const +CSN_DESCR_BEGIN(Unknown_PSI_Message_List_t) + M_FIXED (Unknown_PSI_Message_List_t, 1, 0x00), + M_UINT (Unknown_PSI_Message_List_t, ADDITIONAL_MSG_TYPE, 1), +CSN_DESCR_END (Unknown_PSI_Message_List_t) + +static const +CSN_DESCR_BEGIN(Packet_PSI_Status_t) + /* Mac header */ + M_UINT (Packet_PSI_Status_t, PayloadType, 2), + M_UINT (Packet_PSI_Status_t, spare, 5), + M_UINT (Packet_PSI_Status_t, R, 1), + M_UINT (Packet_PSI_Status_t, MESSAGE_TYPE, 6), + /* Mac header */ + + M_TYPE (Packet_PSI_Status_t, Global_TFI, Global_TFI_t), + M_UINT (Packet_PSI_Status_t, PBCCH_CHANGE_MARK, 3), + M_TYPE (Packet_PSI_Status_t, PSI_Message_List, PSI_Message_List_t), + M_TYPE (Packet_PSI_Status_t, Unknown_PSI_Message_List, Unknown_PSI_Message_List_t), +CSN_DESCR_END (Packet_PSI_Status_t) + +/* < Packet SI Status message content > */ + +static const +CSN_DESCR_BEGIN(SI_Message_t) + M_UINT (SI_Message_t, SI_MESSAGE_TYPE, 8), + M_UINT (SI_Message_t, MESS_REC, 2), +CSN_DESCR_END (SI_Message_t) + +static const +CSN_DESCR_BEGIN(SI_Message_List_t) + M_REC_TARRAY (SI_Message_List_t, SI_Message[0], SI_Message_t, Count_SI_Message), + M_FIXED (SI_Message_List_t, 1, 0x00), + M_UINT (SI_Message_List_t, ADDITIONAL_MSG_TYPE, 1), +CSN_DESCR_END (SI_Message_List_t) + +static const +CSN_DESCR_BEGIN(Unknown_SI_Message_List_t) + M_FIXED (Unknown_SI_Message_List_t, 1, 0x00), + M_UINT (Unknown_SI_Message_List_t, ADDITIONAL_MSG_TYPE, 1), +CSN_DESCR_END (Unknown_SI_Message_List_t) + +static const +CSN_DESCR_BEGIN(Packet_SI_Status_t) + /* Mac header */ + M_UINT (Packet_SI_Status_t, PayloadType, 2), + M_UINT (Packet_SI_Status_t, spare, 5), + M_UINT (Packet_SI_Status_t, R, 1), + M_UINT (Packet_SI_Status_t, MESSAGE_TYPE, 6), + /* Mac header */ + + M_TYPE (Packet_SI_Status_t, Global_TFI, Global_TFI_t), + M_UINT (Packet_SI_Status_t, BCCH_CHANGE_MARK, 3), + M_TYPE (Packet_SI_Status_t, SI_Message_List, SI_Message_List_t), + M_TYPE (Packet_SI_Status_t, Unknown_SI_Message_List, Unknown_SI_Message_List_t), +CSN_DESCR_END (Packet_SI_Status_t) + +/* < Packet Downlink Ack/Nack message content > */ +static const +CSN_DESCR_BEGIN(PD_AckNack_AdditionsR99_t) + M_NEXT_EXIST (PD_AckNack_AdditionsR99_t, Exist_PFI, 1), + M_UINT (PD_AckNack_AdditionsR99_t, PFI, 7), +CSN_DESCR_END (PD_AckNack_AdditionsR99_t) + +static const +CSN_DESCR_BEGIN (Packet_Downlink_Ack_Nack_t) + M_UINT (Packet_Downlink_Ack_Nack_t, PayloadType, 2), + M_UINT (Packet_Downlink_Ack_Nack_t, spare, 5), + M_BIT (Packet_Downlink_Ack_Nack_t, R), + M_UINT (Packet_Downlink_Ack_Nack_t, MESSAGE_TYPE, 6), + M_UINT (Packet_Downlink_Ack_Nack_t, DOWNLINK_TFI, 5), + M_TYPE (Packet_Downlink_Ack_Nack_t, Ack_Nack_Description, Ack_Nack_Description_t), + + M_NEXT_EXIST (Packet_Downlink_Ack_Nack_t, Exist_Channel_Request_Description, 1), + M_TYPE (Packet_Downlink_Ack_Nack_t, Channel_Request_Description, Channel_Request_Description_t), + + M_TYPE (Packet_Downlink_Ack_Nack_t, Channel_Quality_Report, Channel_Quality_Report_t), + + M_NEXT_EXIST_OR_NULL(Packet_Downlink_Ack_Nack_t, Exist_AdditionsR99, 1), + M_TYPE (Packet_Downlink_Ack_Nack_t, AdditionsR99, PD_AckNack_AdditionsR99_t), +CSN_DESCR_END (Packet_Downlink_Ack_Nack_t) + + +/*< EGPRS Packet Downlink Ack/Nack message content > */ +static const +CSN_DESCR_BEGIN(EGPRS_ChannelQualityReport_t) + M_TYPE (EGPRS_ChannelQualityReport_t, EGPRS_BEP_LinkQualityMeasurements, EGPRS_BEP_LinkQualityMeasurements_t), + M_UINT (EGPRS_ChannelQualityReport_t, C_VALUE, 6), + M_TYPE (EGPRS_ChannelQualityReport_t, EGPRS_TimeslotLinkQualityMeasurements, EGPRS_TimeslotLinkQualityMeasurements_t), +CSN_DESCR_END (EGPRS_ChannelQualityReport_t) + +static const +CSN_DESCR_BEGIN(EGPRS_PD_AckNack_t) +/* M_CALLBACK (EGPRS_PD_AckNack_t, (void*)21, IsSupported, IsSupported), */ + M_UINT (EGPRS_PD_AckNack_t, PayloadType, 2), + M_UINT (EGPRS_PD_AckNack_t, spare, 5), + M_BIT (EGPRS_PD_AckNack_t, R), + + M_UINT (EGPRS_PD_AckNack_t, MESSAGE_TYPE, 6), + M_UINT (EGPRS_PD_AckNack_t, DOWNLINK_TFI, 5), + M_UINT (EGPRS_PD_AckNack_t, MS_OUT_OF_MEMORY, 1), + + M_NEXT_EXIST (EGPRS_PD_AckNack_t, Exist_EGPRS_ChannelQualityReport, 1), + M_TYPE (EGPRS_PD_AckNack_t, EGPRS_ChannelQualityReport, EGPRS_ChannelQualityReport_t), + + M_NEXT_EXIST (EGPRS_PD_AckNack_t, Exist_ChannelRequestDescription, 1), + M_TYPE (EGPRS_PD_AckNack_t, ChannelRequestDescription, Channel_Request_Description_t), + + M_NEXT_EXIST (EGPRS_PD_AckNack_t, Exist_PFI, 1), + M_UINT (EGPRS_PD_AckNack_t, PFI, 7), + + M_NEXT_EXIST (EGPRS_PD_AckNack_t, Exist_ExtensionBits, 1), + M_TYPE (EGPRS_PD_AckNack_t, ExtensionBits, Extension_Bits_t), + + M_TYPE (EGPRS_PD_AckNack_t, EGPRS_AckNack, EGPRS_AckNack_t), +/* M_CALLBACK (EGPRS_PD_AckNack_t, (void*)24, EGPRS_AckNack, EGPRS_AckNack), */ + M_LEFT_VAR_BMP (EGPRS_PD_AckNack_t, EGPRS_AckNack.URBB, EGPRS_AckNack.URBB_LENGTH, 0), + +CSN_DESCR_END (EGPRS_PD_AckNack_t) + +static const +CSN_DESCR_BEGIN(FDD_Target_Cell_t) + M_UINT (FDD_Target_Cell_t, FDD_ARFCN, 14), + M_UINT (FDD_Target_Cell_t, DIVERSITY, 1), + M_NEXT_EXIST (FDD_Target_Cell_t, Exist_Bandwith_FDD, 1), + M_UINT (FDD_Target_Cell_t, BANDWITH_FDD, 3), + M_UINT (FDD_Target_Cell_t, SCRAMBLING_CODE, 9), +CSN_DESCR_END (FDD_Target_Cell_t) + +static const +CSN_DESCR_BEGIN(TDD_Target_Cell_t) + M_UINT (TDD_Target_Cell_t, TDD_ARFCN, 14), + M_UINT (TDD_Target_Cell_t, DIVERSITY_TDD, 1), + M_NEXT_EXIST (TDD_Target_Cell_t, Exist_Bandwith_TDD, 1), + M_UINT (TDD_Target_Cell_t, BANDWITH_TDD, 3), + M_UINT (TDD_Target_Cell_t, CELL_PARAMETER, 7), + M_UINT (TDD_Target_Cell_t, Sync_Case_TSTD, 1), +CSN_DESCR_END (TDD_Target_Cell_t) + +static const +CSN_DESCR_BEGIN(EUTRAN_Target_Cell_t) + M_UINT (EUTRAN_Target_Cell_t, EARFCN, 16), + M_NEXT_EXIST (EUTRAN_Target_Cell_t, Exist_Measurement_Bandwidth, 1), + M_UINT (EUTRAN_Target_Cell_t, Measurement_Bandwidth, 3), + M_UINT (EUTRAN_Target_Cell_t, Physical_Layer_Cell_Identity, 9), +CSN_DESCR_END (EUTRAN_Target_Cell_t) + +static const +CSN_DESCR_BEGIN(UTRAN_CSG_Target_Cell_t) + M_UINT (UTRAN_CSG_Target_Cell_t, UTRAN_CI, 28), + M_NEXT_EXIST (UTRAN_CSG_Target_Cell_t, Exist_PLMN_ID, 1), + M_TYPE (UTRAN_CSG_Target_Cell_t, PLMN_ID, PLMN_t), +CSN_DESCR_END (UTRAN_CSG_Target_Cell_t) + +static const +CSN_DESCR_BEGIN(EUTRAN_CSG_Target_Cell_t) + M_UINT (EUTRAN_CSG_Target_Cell_t, EUTRAN_CI, 28), + M_UINT (EUTRAN_CSG_Target_Cell_t, Tracking_Area_Code, 16), + M_NEXT_EXIST (EUTRAN_CSG_Target_Cell_t, Exist_PLMN_ID, 1), + M_TYPE (EUTRAN_CSG_Target_Cell_t, PLMN_ID, PLMN_t), +CSN_DESCR_END (EUTRAN_CSG_Target_Cell_t) + +static const +CSN_DESCR_BEGIN(PCCF_AdditionsR9_t) + M_NEXT_EXIST (PCCF_AdditionsR9_t, Exist_UTRAN_CSG_Target_Cell, 1), + M_TYPE (PCCF_AdditionsR9_t, UTRAN_CSG_Target_Cell, UTRAN_CSG_Target_Cell_t), + M_NEXT_EXIST (PCCF_AdditionsR9_t, Exist_EUTRAN_CSG_Target_Cell, 1), + M_TYPE (PCCF_AdditionsR9_t, EUTRAN_CSG_Target_Cell, EUTRAN_CSG_Target_Cell_t), +CSN_DESCR_END (PCCF_AdditionsR9_t) + +static const +CSN_DESCR_BEGIN(PCCF_AdditionsR8_t) + M_NEXT_EXIST (PCCF_AdditionsR8_t, Exist_EUTRAN_Target_Cell, 1), + M_TYPE (PCCF_AdditionsR8_t, EUTRAN_Target_Cell, EUTRAN_Target_Cell_t), + M_NEXT_EXIST_OR_NULL(PCCF_AdditionsR8_t, Exist_AdditionsR9, 1), + M_TYPE (PCCF_AdditionsR8_t, AdditionsR9, PCCF_AdditionsR9_t), +CSN_DESCR_END (PCCF_AdditionsR8_t) + +static const +CSN_DESCR_BEGIN(PCCF_AdditionsR5_t) + M_NEXT_EXIST (PCCF_AdditionsR5_t, Exist_G_RNTI_extention, 1), + M_UINT (PCCF_AdditionsR5_t, G_RNTI_extention, 4), + M_NEXT_EXIST_OR_NULL(PCCF_AdditionsR5_t, Exist_AdditionsR8, 1), + M_TYPE (PCCF_AdditionsR5_t, AdditionsR8, PCCF_AdditionsR8_t), +CSN_DESCR_END (PCCF_AdditionsR5_t) + +static const +CSN_DESCR_BEGIN(PCCF_AdditionsR99_t) + M_NEXT_EXIST (PCCF_AdditionsR99_t, Exist_FDD_Description, 1), + M_TYPE (PCCF_AdditionsR99_t, FDD_Target_Cell, FDD_Target_Cell_t), + M_NEXT_EXIST (PCCF_AdditionsR99_t, Exist_TDD_Description, 1), + M_TYPE (PCCF_AdditionsR99_t, TDD_Target_Cell, TDD_Target_Cell_t), + M_NEXT_EXIST_OR_NULL(PCCF_AdditionsR99_t, Exist_AdditionsR5, 1), + M_TYPE (PCCF_AdditionsR99_t, AdditionsR5, PCCF_AdditionsR5_t), +CSN_DESCR_END (PCCF_AdditionsR99_t) + +/*< Packet Cell Change Failure message content > */ +static const +CSN_DESCR_BEGIN(Packet_Cell_Change_Failure_t) + /* Mac header */ + M_UINT (Packet_Cell_Change_Failure_t, PayloadType, 2), + M_UINT (Packet_Cell_Change_Failure_t, spare, 5), + M_UINT (Packet_Cell_Change_Failure_t, R, 1), + M_UINT (Packet_Cell_Change_Failure_t, MESSAGE_TYPE, 6), + /* Mac header */ + + M_UINT (Packet_Cell_Change_Failure_t, TLLI, 32), + M_UINT (Packet_Cell_Change_Failure_t, ARFCN, 10), + M_UINT (Packet_Cell_Change_Failure_t, BSIC, 6), + M_UINT (Packet_Cell_Change_Failure_t, CAUSE, 4), + + M_NEXT_EXIST_OR_NULL (Packet_Cell_Change_Failure_t, Exist_AdditionsR99, 1), + M_TYPE (Packet_Cell_Change_Failure_t, AdditionsR99, PCCF_AdditionsR99_t), +CSN_DESCR_END (Packet_Cell_Change_Failure_t) + +/*< Packet Uplink Ack/Nack message content > */ +static const +CSN_DESCR_BEGIN(Power_Control_Parameters_t) + M_UINT (Power_Control_Parameters_t, ALPHA, 4), + + M_NEXT_EXIST (Power_Control_Parameters_t, Slot[0].Exist, 1), + M_UINT (Power_Control_Parameters_t, Slot[0].GAMMA_TN, 5), + + M_NEXT_EXIST (Power_Control_Parameters_t, Slot[1].Exist, 1), + M_UINT (Power_Control_Parameters_t, Slot[1].GAMMA_TN, 5), + + M_NEXT_EXIST (Power_Control_Parameters_t, Slot[2].Exist, 1), + M_UINT (Power_Control_Parameters_t, Slot[2].GAMMA_TN, 5), + + M_NEXT_EXIST (Power_Control_Parameters_t, Slot[3].Exist, 1), + M_UINT (Power_Control_Parameters_t, Slot[3].GAMMA_TN, 5), + + M_NEXT_EXIST (Power_Control_Parameters_t, Slot[4].Exist, 1), + M_UINT (Power_Control_Parameters_t, Slot[4].GAMMA_TN, 5), + + M_NEXT_EXIST (Power_Control_Parameters_t, Slot[5].Exist, 1), + M_UINT (Power_Control_Parameters_t, Slot[5].GAMMA_TN, 5), + + M_NEXT_EXIST (Power_Control_Parameters_t, Slot[6].Exist, 1), + M_UINT (Power_Control_Parameters_t, Slot[6].GAMMA_TN, 5), + + M_NEXT_EXIST (Power_Control_Parameters_t, Slot[7].Exist, 1), + M_UINT (Power_Control_Parameters_t, Slot[7].GAMMA_TN, 5), +CSN_DESCR_END (Power_Control_Parameters_t) + +static const +CSN_DESCR_BEGIN(PU_AckNack_GPRS_AdditionsR99_t) + M_NEXT_EXIST (PU_AckNack_GPRS_AdditionsR99_t, Exist_PacketExtendedTimingAdvance, 1), + M_UINT (PU_AckNack_GPRS_AdditionsR99_t, PacketExtendedTimingAdvance, 2), + + M_UINT (PU_AckNack_GPRS_AdditionsR99_t, TBF_EST, 1), +CSN_DESCR_END (PU_AckNack_GPRS_AdditionsR99_t) + +static const +CSN_DESCR_BEGIN (PU_AckNack_GPRS_t) + M_UINT (PU_AckNack_GPRS_t, CHANNEL_CODING_COMMAND, 2), + M_TYPE (PU_AckNack_GPRS_t, Ack_Nack_Description, Ack_Nack_Description_t), + + M_NEXT_EXIST (PU_AckNack_GPRS_t, Common_Uplink_Ack_Nack_Data.Exist_CONTENTION_RESOLUTION_TLLI, 1), + M_UINT (PU_AckNack_GPRS_t, Common_Uplink_Ack_Nack_Data.CONTENTION_RESOLUTION_TLLI, 32), + + M_NEXT_EXIST (PU_AckNack_GPRS_t, Common_Uplink_Ack_Nack_Data.Exist_Packet_Timing_Advance, 1), + M_TYPE (PU_AckNack_GPRS_t, Common_Uplink_Ack_Nack_Data.Packet_Timing_Advance, Packet_Timing_Advance_t), + + M_NEXT_EXIST (PU_AckNack_GPRS_t, Common_Uplink_Ack_Nack_Data.Exist_Power_Control_Parameters, 1), + M_TYPE (PU_AckNack_GPRS_t, Common_Uplink_Ack_Nack_Data.Power_Control_Parameters, Power_Control_Parameters_t), + + M_NEXT_EXIST (PU_AckNack_GPRS_t, Common_Uplink_Ack_Nack_Data.Exist_Extension_Bits, 1), + M_TYPE (PU_AckNack_GPRS_t, Common_Uplink_Ack_Nack_Data.Extension_Bits, Extension_Bits_t), + + M_UNION (PU_AckNack_GPRS_t, 2), /* Fixed Allocation was removed */ + M_UINT (PU_AckNack_GPRS_t, u.FixedAllocationDummy, 1), + CSN_ERROR (PU_AckNack_GPRS_t, "01 ", CSN_ERROR_STREAM_NOT_SUPPORTED), + + M_NEXT_EXIST_OR_NULL(PU_AckNack_GPRS_t, Exist_AdditionsR99, 1), + M_TYPE (PU_AckNack_GPRS_t, AdditionsR99, PU_AckNack_GPRS_AdditionsR99_t), +CSN_DESCR_END (PU_AckNack_GPRS_t) + +static const +CSN_DESCR_BEGIN(PU_AckNack_EGPRS_00_t) + M_UINT (PU_AckNack_EGPRS_00_t, EGPRS_ChannelCodingCommand, 4), + M_UINT (PU_AckNack_EGPRS_00_t, RESEGMENT, 1), + M_UINT (PU_AckNack_EGPRS_00_t, PRE_EMPTIVE_TRANSMISSION, 1), + M_UINT (PU_AckNack_EGPRS_00_t, PRR_RETRANSMISSION_REQUEST, 1), + M_UINT (PU_AckNack_EGPRS_00_t, ARAC_RETRANSMISSION_REQUEST, 1), + + M_NEXT_EXIST (PU_AckNack_EGPRS_00_t, Common_Uplink_Ack_Nack_Data.Exist_CONTENTION_RESOLUTION_TLLI, 1), + M_UINT (PU_AckNack_EGPRS_00_t, Common_Uplink_Ack_Nack_Data.CONTENTION_RESOLUTION_TLLI, 32), + + M_UINT (PU_AckNack_EGPRS_00_t, TBF_EST, 1), + + M_NEXT_EXIST (PU_AckNack_EGPRS_00_t, Common_Uplink_Ack_Nack_Data.Exist_Packet_Timing_Advance, 1), + M_TYPE (PU_AckNack_EGPRS_00_t, Common_Uplink_Ack_Nack_Data.Packet_Timing_Advance, Packet_Timing_Advance_t), + + M_NEXT_EXIST (PU_AckNack_EGPRS_00_t, Exist_Packet_Extended_Timing_Advance, 1), + M_UINT (PU_AckNack_EGPRS_00_t, Packet_Extended_Timing_Advance, 2), + + M_NEXT_EXIST (PU_AckNack_EGPRS_00_t, Common_Uplink_Ack_Nack_Data.Exist_Power_Control_Parameters, 1), + M_TYPE (PU_AckNack_EGPRS_00_t, Common_Uplink_Ack_Nack_Data.Power_Control_Parameters, Power_Control_Parameters_t), + + M_NEXT_EXIST (PU_AckNack_EGPRS_00_t, Common_Uplink_Ack_Nack_Data.Exist_Extension_Bits, 1), + M_TYPE (PU_AckNack_EGPRS_00_t, Common_Uplink_Ack_Nack_Data.Extension_Bits, Extension_Bits_t), + + M_TYPE (PU_AckNack_EGPRS_00_t, EGPRS_AckNack, EGPRS_AckNack_t), +/* M_CALLBACK (PU_AckNack_EGPRS_00_t, (void*)24, EGPRS_AckNack, EGPRS_AckNack), */ + M_LEFT_VAR_BMP (PU_AckNack_EGPRS_00_t, EGPRS_AckNack.URBB, EGPRS_AckNack.URBB_LENGTH, 0), +CSN_DESCR_END (PU_AckNack_EGPRS_00_t) + +static const +CSN_DESCR_BEGIN(PU_AckNack_EGPRS_t) +/* M_CALLBACK (PU_AckNack_EGPRS_t, (void*)21, IsSupported, IsSupported), */ + M_UNION (PU_AckNack_EGPRS_t, 4), + M_TYPE (PU_AckNack_EGPRS_t, u.PU_AckNack_EGPRS_00, PU_AckNack_EGPRS_00_t), + CSN_ERROR (PU_AckNack_EGPRS_t, "01 ", CSN_ERROR_STREAM_NOT_SUPPORTED), + CSN_ERROR (PU_AckNack_EGPRS_t, "10 ", CSN_ERROR_STREAM_NOT_SUPPORTED), + CSN_ERROR (PU_AckNack_EGPRS_t, "11 ", CSN_ERROR_STREAM_NOT_SUPPORTED), +CSN_DESCR_END (PU_AckNack_EGPRS_t) + +static const +CSN_DESCR_BEGIN(Packet_Uplink_Ack_Nack_t) + M_UINT (Packet_Uplink_Ack_Nack_t, MESSAGE_TYPE, 6), + M_UINT (Packet_Uplink_Ack_Nack_t, PAGE_MODE, 2), + M_FIXED (Packet_Uplink_Ack_Nack_t, 2, 0x00), + M_UINT (Packet_Uplink_Ack_Nack_t, UPLINK_TFI, 5), + + M_UNION (Packet_Uplink_Ack_Nack_t, 2), + M_TYPE (Packet_Uplink_Ack_Nack_t, u.PU_AckNack_GPRS_Struct, PU_AckNack_GPRS_t), + M_TYPE (Packet_Uplink_Ack_Nack_t, u.PU_AckNack_EGPRS_Struct, PU_AckNack_EGPRS_t), +CSN_DESCR_END (Packet_Uplink_Ack_Nack_t) + +/*< Packet Uplink Assignment message content > */ +static const +CSN_DESCR_BEGIN(CHANGE_MARK_t) + M_UINT (CHANGE_MARK_t, CHANGE_MARK_1, 2), + + M_NEXT_EXIST (CHANGE_MARK_t, Exist_CHANGE_MARK_2, 1), + M_UINT (CHANGE_MARK_t, CHANGE_MARK_2, 2), +CSN_DESCR_END (CHANGE_MARK_t) + +static const +CSN_DESCR_BEGIN(Indirect_encoding_t) + M_UINT (Indirect_encoding_t, MAIO, 6), + M_UINT (Indirect_encoding_t, MA_NUMBER, 4), + + M_NEXT_EXIST (Indirect_encoding_t, Exist_CHANGE_MARK, 1), + M_TYPE (Indirect_encoding_t, CHANGE_MARK, CHANGE_MARK_t), +CSN_DESCR_END (Indirect_encoding_t) + +static const +CSN_DESCR_BEGIN(Direct_encoding_1_t) + M_UINT (Direct_encoding_1_t, MAIO, 6), + M_TYPE (Direct_encoding_1_t, GPRS_Mobile_Allocation, GPRS_Mobile_Allocation_t), +CSN_DESCR_END (Direct_encoding_1_t) + +static const +CSN_DESCR_BEGIN(Direct_encoding_2_t) + M_UINT (Direct_encoding_2_t, MAIO, 6), + M_UINT (Direct_encoding_2_t, HSN, 6), + M_UINT_OFFSET(Direct_encoding_2_t, Length_of_MA_Frequency_List, 4, 3), + M_VAR_ARRAY (Direct_encoding_2_t, MA_Frequency_List, Length_of_MA_Frequency_List, 0), +CSN_DESCR_END (Direct_encoding_2_t) + +static const +CSN_DESCR_BEGIN(Frequency_Parameters_t) + M_UINT (Frequency_Parameters_t, TSC, 3), + + M_UNION (Frequency_Parameters_t, 4), + M_UINT (Frequency_Parameters_t, u.ARFCN, 10), + M_TYPE (Frequency_Parameters_t, u.Indirect_encoding, Indirect_encoding_t), + M_TYPE (Frequency_Parameters_t, u.Direct_encoding_1, Direct_encoding_1_t), + M_TYPE (Frequency_Parameters_t, u.Direct_encoding_2, Direct_encoding_2_t), +CSN_DESCR_END (Frequency_Parameters_t) + +static const +CSN_DESCR_BEGIN(Packet_Request_Reference_t) + M_UINT (Packet_Request_Reference_t, RANDOM_ACCESS_INFORMATION, 11), + M_UINT_ARRAY (Packet_Request_Reference_t, FRAME_NUMBER, 8, 2), +CSN_DESCR_END (Packet_Request_Reference_t) + +static const +CSN_DESCR_BEGIN(Timeslot_Allocation_t) + M_NEXT_EXIST (Timeslot_Allocation_t, Exist, 1), + M_UINT (Timeslot_Allocation_t, USF_TN, 3), +CSN_DESCR_END (Timeslot_Allocation_t) + +static const +CSN_DESCR_BEGIN(Timeslot_Allocation_Power_Ctrl_Param_t) + M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, ALPHA, 4), + + M_NEXT_EXIST (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[0].Exist, 2), + M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[0].USF_TN, 3), + M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[0].GAMMA_TN, 5), + + M_NEXT_EXIST (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[1].Exist, 2), + M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[1].USF_TN, 3), + M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[1].GAMMA_TN, 5), + + M_NEXT_EXIST (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[2].Exist, 2), + M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[2].USF_TN, 3), + M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[2].GAMMA_TN, 5), + + M_NEXT_EXIST (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[3].Exist, 2), + M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[3].USF_TN, 3), + M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[3].GAMMA_TN, 5), + + M_NEXT_EXIST (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[4].Exist, 2), + M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[4].USF_TN, 3), + M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[4].GAMMA_TN, 5), + + M_NEXT_EXIST (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[5].Exist, 2), + M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[5].USF_TN, 3), + M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[5].GAMMA_TN, 5), + + M_NEXT_EXIST (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[6].Exist, 2), + M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[6].USF_TN, 3), + M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[6].GAMMA_TN, 5), + + M_NEXT_EXIST (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[7].Exist, 2), + M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[7].USF_TN, 3), + M_UINT (Timeslot_Allocation_Power_Ctrl_Param_t, Slot[7].GAMMA_TN, 5), +CSN_DESCR_END (Timeslot_Allocation_Power_Ctrl_Param_t) + +/* USED in */ +static const +CSN_DESCR_BEGIN(Dynamic_Allocation_t) + M_UINT (Dynamic_Allocation_t, Extended_Dynamic_Allocation, 1), + + M_NEXT_EXIST (Dynamic_Allocation_t, Exist_P0, 2), + M_UINT (Dynamic_Allocation_t, P0, 4), + M_UINT (Dynamic_Allocation_t, PR_MODE, 1), + + M_UINT (Dynamic_Allocation_t, USF_GRANULARITY, 1), + + M_NEXT_EXIST (Dynamic_Allocation_t, Exist_UPLINK_TFI_ASSIGNMENT, 1), + M_UINT (Dynamic_Allocation_t, UPLINK_TFI_ASSIGNMENT, 5), + + M_NEXT_EXIST (Dynamic_Allocation_t, Exist_RLC_DATA_BLOCKS_GRANTED, 1), + M_UINT (Dynamic_Allocation_t, RLC_DATA_BLOCKS_GRANTED, 8), + + M_NEXT_EXIST (Dynamic_Allocation_t, Exist_TBF_Starting_Time, 1), + M_TYPE (Dynamic_Allocation_t, TBF_Starting_Time, Starting_Frame_Number_t), + + M_UNION (Dynamic_Allocation_t, 2), + M_TYPE_ARRAY (Dynamic_Allocation_t, u.Timeslot_Allocation, Timeslot_Allocation_t, 8), + M_TYPE (Dynamic_Allocation_t, u.Timeslot_Allocation_Power_Ctrl_Param, Timeslot_Allocation_Power_Ctrl_Param_t), +CSN_DESCR_END (Dynamic_Allocation_t) + +static const +CSN_DESCR_BEGIN(Single_Block_Allocation_t) + M_UINT (Single_Block_Allocation_t, TIMESLOT_NUMBER, 3), + + M_NEXT_EXIST (Single_Block_Allocation_t, Exist_ALPHA_and_GAMMA_TN, 2), + M_UINT (Single_Block_Allocation_t, ALPHA, 4), + M_UINT (Single_Block_Allocation_t, GAMMA_TN, 5), + + M_NEXT_EXIST (Single_Block_Allocation_t, Exist_P0, 3), + M_UINT (Single_Block_Allocation_t, P0, 4), + M_UINT (Single_Block_Allocation_t, BTS_PWR_CTRL_MODE, 1), + M_UINT (Single_Block_Allocation_t, PR_MODE, 1), + + M_TYPE (Single_Block_Allocation_t, TBF_Starting_Time, Starting_Frame_Number_t), +CSN_DESCR_END (Single_Block_Allocation_t) + +static const +CSN_DESCR_BEGIN(DTM_Dynamic_Allocation_t) + M_UINT (DTM_Dynamic_Allocation_t, Extended_Dynamic_Allocation, 1), + + M_NEXT_EXIST (DTM_Dynamic_Allocation_t, Exist_P0, 2), + M_UINT (DTM_Dynamic_Allocation_t, P0, 4), + M_UINT (DTM_Dynamic_Allocation_t, PR_MODE, 1), + + M_UINT (DTM_Dynamic_Allocation_t, USF_GRANULARITY, 1), + + M_NEXT_EXIST (DTM_Dynamic_Allocation_t, Exist_UPLINK_TFI_ASSIGNMENT, 1), + M_UINT (DTM_Dynamic_Allocation_t, UPLINK_TFI_ASSIGNMENT, 5), + + M_NEXT_EXIST (DTM_Dynamic_Allocation_t, Exist_RLC_DATA_BLOCKS_GRANTED, 1), + M_UINT (DTM_Dynamic_Allocation_t, RLC_DATA_BLOCKS_GRANTED, 8), + + M_UNION (DTM_Dynamic_Allocation_t, 2), + M_TYPE_ARRAY (DTM_Dynamic_Allocation_t, u.Timeslot_Allocation, Timeslot_Allocation_t, 8), + M_TYPE (DTM_Dynamic_Allocation_t, u.Timeslot_Allocation_Power_Ctrl_Param, Timeslot_Allocation_Power_Ctrl_Param_t), +CSN_DESCR_END (DTM_Dynamic_Allocation_t) + +static const +CSN_DESCR_BEGIN(DTM_Single_Block_Allocation_t) + M_UINT (DTM_Single_Block_Allocation_t, TIMESLOT_NUMBER, 3), + + M_NEXT_EXIST (DTM_Single_Block_Allocation_t, Exist_ALPHA_and_GAMMA_TN, 2), + M_UINT (DTM_Single_Block_Allocation_t, ALPHA, 4), + M_UINT (DTM_Single_Block_Allocation_t, GAMMA_TN, 5), + + M_NEXT_EXIST (DTM_Single_Block_Allocation_t, Exist_P0, 3), + M_UINT (DTM_Single_Block_Allocation_t, P0, 4), + M_UINT (DTM_Single_Block_Allocation_t, BTS_PWR_CTRL_MODE, 1), + M_UINT (DTM_Single_Block_Allocation_t, PR_MODE, 1), +CSN_DESCR_END (DTM_Single_Block_Allocation_t) + + +/* Help structures */ +typedef struct +{ + Global_TFI_t Global_TFI; /* 0 < Global TFI : < Global TFI IE > > */ +} h0_Global_TFI_t; + +static const +CSN_DESCR_BEGIN(h0_Global_TFI_t) + M_FIXED (h0_Global_TFI_t, 1, 0x00), + M_TYPE (h0_Global_TFI_t, Global_TFI, Global_TFI_t), +CSN_DESCR_END (h0_Global_TFI_t) + +typedef struct +{ + guint32 TLLI;/* | 10 < TLLI : bit (32) >*/ +} h10_TLLI_t; + +static const +CSN_DESCR_BEGIN(h10_TLLI_t) + M_FIXED (h10_TLLI_t, 2, 0x02), + M_UINT (h10_TLLI_t, TLLI, 32), +CSN_DESCR_END (h10_TLLI_t) + +typedef struct +{ + guint16 TQI;/*| 110 < TQI : bit (16) > */ +} h110_TQI_t; + +static const +CSN_DESCR_BEGIN(h110_TQI_t) + M_FIXED (h110_TQI_t, 3, 0x06), + M_UINT (h110_TQI_t, TQI, 16), +CSN_DESCR_END (h110_TQI_t) + +typedef struct +{ + Packet_Request_Reference_t Packet_Request_Reference;/*| 111 < Packet Request Reference : < Packet Request Reference IE > > }*/ +} h111_Packet_Request_Reference_t; + +static const +CSN_DESCR_BEGIN(h111_Packet_Request_Reference_t) + M_FIXED (h111_Packet_Request_Reference_t, 3, 0x07), + M_TYPE (h111_Packet_Request_Reference_t, Packet_Request_Reference, Packet_Request_Reference_t), +CSN_DESCR_END (h111_Packet_Request_Reference_t) + +static const +CSN_ChoiceElement_t PacketUplinkID[] = +{ + {1, 0 , M_TYPE(PacketUplinkID_t, u.Global_TFI, Global_TFI_t)}, + {2, 0x02 , M_UINT(PacketUplinkID_t, u.TLLI, 32)}, + {3, 0x06 , M_UINT(PacketUplinkID_t, u.TQI, 16)}, + {3, 0x07 , M_TYPE(PacketUplinkID_t, u.Packet_Request_Reference, Packet_Request_Reference_t)}, +}; + +static const +CSN_DESCR_BEGIN(PacketUplinkID_t) + M_CHOICE (PacketUplinkID_t, UnionType, PacketUplinkID, ElementsOf(PacketUplinkID)), +CSN_DESCR_END (PacketUplinkID_t) + +static const +CSN_DESCR_BEGIN(PUA_GPRS_AdditionsR99_t) + M_NEXT_EXIST (PUA_GPRS_AdditionsR99_t, Exist_Packet_Extended_Timing_Advance, 1), + M_UINT (PUA_GPRS_AdditionsR99_t, Packet_Extended_Timing_Advance, 2), +CSN_DESCR_END (PUA_GPRS_AdditionsR99_t) + +static const +CSN_DESCR_BEGIN (PUA_GPRS_t) + M_UINT (PUA_GPRS_t, CHANNEL_CODING_COMMAND, 2), + M_BIT (PUA_GPRS_t, TLLI_BLOCK_CHANNEL_CODING), + M_TYPE (PUA_GPRS_t, Packet_Timing_Advance, Packet_Timing_Advance_t), + + M_NEXT_EXIST (PUA_GPRS_t, Exist_Frequency_Parameters, 1), + M_TYPE (PUA_GPRS_t, Frequency_Parameters, Frequency_Parameters_t), + + M_UNION (PUA_GPRS_t, 4), + CSN_ERROR (PUA_GPRS_t, "00 not implemented", CSN_ERROR_STREAM_NOT_SUPPORTED), + M_TYPE (PUA_GPRS_t, u.Dynamic_Allocation, Dynamic_Allocation_t), + M_TYPE (PUA_GPRS_t, u.Single_Block_Allocation, Single_Block_Allocation_t), + CSN_ERROR (PUA_GPRS_t, "11 not supported", CSN_ERROR_STREAM_NOT_SUPPORTED), + + M_NEXT_EXIST_OR_NULL(PUA_GPRS_t, Exist_AdditionsR99, 1), + M_TYPE (PUA_GPRS_t, AdditionsR99, PUA_GPRS_AdditionsR99_t), +CSN_DESCR_END (PUA_GPRS_t) + +static const +CSN_DESCR_BEGIN(COMPACT_ReducedMA_t) + M_UINT (COMPACT_ReducedMA_t, BitmapLength, 7), + M_VAR_BITMAP (COMPACT_ReducedMA_t, ReducedMA_Bitmap, BitmapLength, 0), + + M_NEXT_EXIST (COMPACT_ReducedMA_t, Exist_MAIO_2, 1), + M_UINT (COMPACT_ReducedMA_t, MAIO_2, 6), +CSN_DESCR_END (COMPACT_TeducedMA_t) + +static const +CSN_DESCR_BEGIN(MultiBlock_Allocation_t) + M_UINT (MultiBlock_Allocation_t, TIMESLOT_NUMBER, 3), + + M_NEXT_EXIST (MultiBlock_Allocation_t, Exist_ALPHA_GAMMA_TN, 2), + M_UINT (MultiBlock_Allocation_t, ALPHA, 4), + M_UINT (MultiBlock_Allocation_t, GAMMA_TN, 5), + + M_NEXT_EXIST (MultiBlock_Allocation_t, Exist_P0_BTS_PWR_CTRL_PR_MODE, 3), + M_UINT (MultiBlock_Allocation_t, P0, 4), + M_UINT (MultiBlock_Allocation_t, BTS_PWR_CTRL_MODE, 1), + M_UINT (MultiBlock_Allocation_t, PR_MODE, 1), + + M_TYPE (MultiBlock_Allocation_t, TBF_Starting_Time, Starting_Frame_Number_t), + M_UINT (MultiBlock_Allocation_t, NUMBER_OF_RADIO_BLOCKS_ALLOCATED, 2), +CSN_DESCR_END (MultiBlock_Allocation_t) + +static const +CSN_DESCR_BEGIN (PUA_EGPRS_00_t) + M_NEXT_EXIST (PUA_EGPRS_00_t, Exist_CONTENTION_RESOLUTION_TLLI, 1), + M_UINT (PUA_EGPRS_00_t, CONTENTION_RESOLUTION_TLLI, 32), + + M_NEXT_EXIST (PUA_EGPRS_00_t, Exist_COMPACT_ReducedMA, 1), + M_TYPE (PUA_EGPRS_00_t, COMPACT_ReducedMA, COMPACT_ReducedMA_t), + + M_UINT (PUA_EGPRS_00_t, EGPRS_CHANNEL_CODING_COMMAND, 4), + M_UINT (PUA_EGPRS_00_t, RESEGMENT, 1), + M_UINT (PUA_EGPRS_00_t, EGPRS_WindowSize, 5), + + M_REC_ARRAY (PUA_EGPRS_00_t, AccessTechnologyType, NrOfAccessTechnologies, 4), + + M_UINT (PUA_EGPRS_00_t, ARAC_RETRANSMISSION_REQUEST, 1), + M_UINT (PUA_EGPRS_00_t, TLLI_BLOCK_CHANNEL_CODING, 1), + + M_NEXT_EXIST (PUA_EGPRS_00_t, Exist_BEP_PERIOD2, 1), + M_UINT (PUA_EGPRS_00_t, BEP_PERIOD2, 4), + + M_TYPE (PUA_EGPRS_00_t, PacketTimingAdvance, Packet_Timing_Advance_t), + + M_NEXT_EXIST (PUA_EGPRS_00_t, Exist_Packet_Extended_Timing_Advance, 1), + M_UINT (PUA_EGPRS_00_t, Packet_Extended_Timing_Advance, 2), + + M_NEXT_EXIST (PUA_EGPRS_00_t, Exist_Frequency_Parameters, 1), + M_TYPE (PUA_EGPRS_00_t, Frequency_Parameters, Frequency_Parameters_t), + + M_UNION (PUA_EGPRS_00_t, 4), + CSN_ERROR (PUA_EGPRS_00_t, "00 ", CSN_ERROR_STREAM_NOT_SUPPORTED), + M_TYPE (PUA_EGPRS_00_t, u.Dynamic_Allocation, Dynamic_Allocation_t), + M_TYPE (PUA_EGPRS_00_t, u.MultiBlock_Allocation, MultiBlock_Allocation_t), + CSN_ERROR (PUA_EGPRS_00_t, "11 ", CSN_ERROR_STREAM_NOT_SUPPORTED), +CSN_DESCR_END (PUA_EGPRS_00_t) + +static const +CSN_DESCR_BEGIN(PUA_EGPRS_t) + M_UNION (PUA_EGPRS_t, 4), + M_TYPE (PUA_EGPRS_t, u.PUA_EGPRS_00, PUA_EGPRS_00_t), + CSN_ERROR (PUA_EGPRS_t, "01 ", CSN_ERROR_STREAM_NOT_SUPPORTED), + CSN_ERROR (PUA_EGPRS_t, "10 ", CSN_ERROR_STREAM_NOT_SUPPORTED), + CSN_ERROR (PUA_EGPRS_t, "11 ", CSN_ERROR_STREAM_NOT_SUPPORTED), +CSN_DESCR_END (PUA_EGPRS_t) + +static const +CSN_DESCR_BEGIN(Packet_Uplink_Assignment_t) + M_UINT (Packet_Uplink_Assignment_t, MESSAGE_TYPE, 6), + M_UINT (Packet_Uplink_Assignment_t, PAGE_MODE, 2), + + M_NEXT_EXIST (Packet_Uplink_Assignment_t, Exist_PERSISTENCE_LEVEL, 1), + M_UINT_ARRAY (Packet_Uplink_Assignment_t, PERSISTENCE_LEVEL, 4, 4), + + M_TYPE (Packet_Uplink_Assignment_t, ID, PacketUplinkID_t), + + M_UNION (Packet_Uplink_Assignment_t, 2), + M_TYPE (Packet_Uplink_Assignment_t, u.PUA_GPRS_Struct, PUA_GPRS_t), + M_TYPE (Packet_Uplink_Assignment_t, u.PUA_EGPRS_Struct, PUA_EGPRS_t), +CSN_DESCR_END (Packet_Uplink_Assignment_t) + +/*< Packet Downlink Assignment message content > */ +static const +CSN_DESCR_BEGIN(Measurement_Mapping_struct_t) + M_TYPE (Measurement_Mapping_struct_t, Measurement_Starting_Time, Starting_Frame_Number_t), + M_UINT (Measurement_Mapping_struct_t, MEASUREMENT_INTERVAL, 5), + M_UINT (Measurement_Mapping_struct_t, MEASUREMENT_BITMAP, 8), +CSN_DESCR_END (Measurement_Mapping_struct_t) + +static const +CSN_ChoiceElement_t PacketDownlinkID[] = +{ + {1, 0, M_TYPE(PacketDownlinkID_t, u.Global_TFI, Global_TFI_t)}, + {2, 0x02, M_UINT(PacketDownlinkID_t, u.TLLI, 32)}, +}; + +static const +CSN_DESCR_BEGIN(PacketDownlinkID_t) + M_CHOICE (PacketDownlinkID_t, UnionType, PacketDownlinkID, ElementsOf(PacketDownlinkID)), +CSN_DESCR_END (PacketDownlinkID_t) + +static const +CSN_DESCR_BEGIN(PDA_AdditionsR99_t) + M_NEXT_EXIST (PDA_AdditionsR99_t, Exist_EGPRS_Params, 4), /*if Exist_EGPRS_Params == FALSE then none of the following 4 vars exist */ + M_UINT (PDA_AdditionsR99_t, EGPRS_WindowSize, 5), + M_UINT (PDA_AdditionsR99_t, LINK_QUALITY_MEASUREMENT_MODE, 2), + M_NEXT_EXIST (PDA_AdditionsR99_t, Exist_BEP_PERIOD2, 1), + M_UINT (PDA_AdditionsR99_t, BEP_PERIOD2, 4), + + M_NEXT_EXIST (PDA_AdditionsR99_t, Exist_Packet_Extended_Timing_Advance, 1), + M_UINT (PDA_AdditionsR99_t, Packet_Extended_Timing_Advance, 2), + + M_NEXT_EXIST (PDA_AdditionsR99_t, Exist_COMPACT_ReducedMA, 1), + M_TYPE (PDA_AdditionsR99_t, COMPACT_ReducedMA, COMPACT_ReducedMA_t), +CSN_DESCR_END (PDA_AdditionsR99_t) + +static const +CSN_DESCR_BEGIN (Packet_Downlink_Assignment_t) + M_UINT (Packet_Downlink_Assignment_t, MESSAGE_TYPE, 6), + M_UINT (Packet_Downlink_Assignment_t, PAGE_MODE, 2), + + M_NEXT_EXIST (Packet_Downlink_Assignment_t, Exist_PERSISTENCE_LEVEL, 1), + M_UINT_ARRAY (Packet_Downlink_Assignment_t, PERSISTENCE_LEVEL, 4, 4), + + M_TYPE (Packet_Downlink_Assignment_t, ID, PacketDownlinkID_t), + + M_FIXED (Packet_Downlink_Assignment_t, 1, 0x00),/*-- Message escape */ + + M_UINT (Packet_Downlink_Assignment_t, MAC_MODE, 2), + M_BIT (Packet_Downlink_Assignment_t, RLC_MODE), + M_BIT (Packet_Downlink_Assignment_t, CONTROL_ACK), + M_UINT (Packet_Downlink_Assignment_t, TIMESLOT_ALLOCATION, 8), + M_TYPE (Packet_Downlink_Assignment_t, Packet_Timing_Advance, Packet_Timing_Advance_t), + + M_NEXT_EXIST (Packet_Downlink_Assignment_t, Exist_P0_and_BTS_PWR_CTRL_MODE, 3), + M_UINT (Packet_Downlink_Assignment_t, P0, 4), + M_BIT (Packet_Downlink_Assignment_t, BTS_PWR_CTRL_MODE), + M_UINT (Packet_Downlink_Assignment_t, PR_MODE, 1), + + M_NEXT_EXIST (Packet_Downlink_Assignment_t, Exist_Frequency_Parameters, 1), + M_TYPE (Packet_Downlink_Assignment_t, Frequency_Parameters, Frequency_Parameters_t), + + M_NEXT_EXIST (Packet_Downlink_Assignment_t, Exist_DOWNLINK_TFI_ASSIGNMENT, 1), + M_UINT (Packet_Downlink_Assignment_t, DOWNLINK_TFI_ASSIGNMENT, 5), + + M_NEXT_EXIST (Packet_Downlink_Assignment_t, Exist_Power_Control_Parameters, 1), + M_TYPE (Packet_Downlink_Assignment_t, Power_Control_Parameters, Power_Control_Parameters_t), + + M_NEXT_EXIST (Packet_Downlink_Assignment_t, Exist_TBF_Starting_Time, 1), + M_TYPE (Packet_Downlink_Assignment_t, TBF_Starting_Time, Starting_Frame_Number_t), + + M_NEXT_EXIST (Packet_Downlink_Assignment_t, Exist_Measurement_Mapping, 1), + M_TYPE (Packet_Downlink_Assignment_t, Measurement_Mapping, Measurement_Mapping_struct_t), + + M_NEXT_EXIST_OR_NULL(Packet_Downlink_Assignment_t, Exist_AdditionsR99, 1), + M_TYPE (Packet_Downlink_Assignment_t, AdditionsR99, PDA_AdditionsR99_t), +CSN_DESCR_END (Packet_Downlink_Assignment_t) + +typedef Packet_Downlink_Assignment_t pdlaCheck_t; + +static const +CSN_DESCR_BEGIN(pdlaCheck_t) + M_UINT (pdlaCheck_t, MESSAGE_TYPE, 6), + M_UINT (pdlaCheck_t, PAGE_MODE, 2), + + M_NEXT_EXIST (pdlaCheck_t, Exist_PERSISTENCE_LEVEL, 1), + M_UINT_ARRAY (pdlaCheck_t, PERSISTENCE_LEVEL, 4, 4), + + M_TYPE (pdlaCheck_t, ID, PacketDownlinkID_t), +CSN_DESCR_END (pdlaCheck_t) + +/* DTM Packet UL Assignment */ +static const +CSN_DESCR_BEGIN(DTM_Packet_Uplink_Assignment_t) + M_UINT (DTM_Packet_Uplink_Assignment_t, CHANNEL_CODING_COMMAND, 2), + M_BIT (DTM_Packet_Uplink_Assignment_t, TLLI_BLOCK_CHANNEL_CODING), + M_TYPE (DTM_Packet_Uplink_Assignment_t, Packet_Timing_Advance, Packet_Timing_Advance_t), + + M_UNION (DTM_Packet_Uplink_Assignment_t, 3), + CSN_ERROR (DTM_Packet_Uplink_Assignment_t, "Not Implemented", CSN_ERROR_STREAM_NOT_SUPPORTED), + M_TYPE (DTM_Packet_Uplink_Assignment_t, u.DTM_Dynamic_Allocation, DTM_Dynamic_Allocation_t), + M_TYPE (DTM_Packet_Uplink_Assignment_t, u.DTM_Single_Block_Allocation, DTM_Single_Block_Allocation_t), + M_NEXT_EXIST_OR_NULL (DTM_Packet_Uplink_Assignment_t, Exist_EGPRS_Parameters, 3), + M_UINT (DTM_Packet_Uplink_Assignment_t, EGPRS_CHANNEL_CODING_COMMAND, 4), + M_UINT (DTM_Packet_Uplink_Assignment_t, RESEGMENT, 1), + M_UINT (DTM_Packet_Uplink_Assignment_t, EGPRS_WindowSize, 5), + M_NEXT_EXIST (DTM_Packet_Uplink_Assignment_t, Exist_Packet_Extended_Timing_Advance, 1), + M_UINT (DTM_Packet_Uplink_Assignment_t, Packet_Extended_Timing_Advance, 2), +CSN_DESCR_END(DTM_Packet_Uplink_Assignment_t) + +static const +CSN_DESCR_BEGIN(DTM_UL_t) + M_TYPE (DTM_UL_t, DTM_Packet_Uplink_Assignment, DTM_Packet_Uplink_Assignment_t), +CSN_DESCR_END(DTM_UL_t) + +/* DTM Packet DL Assignment */ +static const +CSN_DESCR_BEGIN(DTM_Packet_Downlink_Assignment_t) + M_UINT (DTM_Packet_Downlink_Assignment_t, MAC_MODE, 2), + M_BIT (DTM_Packet_Downlink_Assignment_t, RLC_MODE), + M_UINT (DTM_Packet_Downlink_Assignment_t, TIMESLOT_ALLOCATION, 8), + M_TYPE (DTM_Packet_Downlink_Assignment_t, Packet_Timing_Advance, Packet_Timing_Advance_t), + + M_NEXT_EXIST (DTM_Packet_Downlink_Assignment_t, Exist_P0_and_BTS_PWR_CTRL_MODE, 3), + M_UINT (DTM_Packet_Downlink_Assignment_t, P0, 4), + M_BIT (DTM_Packet_Downlink_Assignment_t, BTS_PWR_CTRL_MODE), + M_UINT (DTM_Packet_Downlink_Assignment_t, PR_MODE, 1), + + M_NEXT_EXIST (DTM_Packet_Downlink_Assignment_t, Exist_Power_Control_Parameters, 1), + M_TYPE (DTM_Packet_Downlink_Assignment_t, Power_Control_Parameters, Power_Control_Parameters_t), + + M_NEXT_EXIST (DTM_Packet_Downlink_Assignment_t, Exist_DOWNLINK_TFI_ASSIGNMENT, 1), + M_UINT (DTM_Packet_Downlink_Assignment_t, DOWNLINK_TFI_ASSIGNMENT, 5), + + M_NEXT_EXIST (DTM_Packet_Downlink_Assignment_t, Exist_Measurement_Mapping, 1), + M_TYPE (DTM_Packet_Downlink_Assignment_t, Measurement_Mapping, Measurement_Mapping_struct_t), + M_NEXT_EXIST_OR_NULL (DTM_Packet_Downlink_Assignment_t, EGPRS_Mode, 2), + M_UINT (DTM_Packet_Downlink_Assignment_t, EGPRS_WindowSize, 5), + M_UINT (DTM_Packet_Downlink_Assignment_t, LINK_QUALITY_MEASUREMENT_MODE, 2), + M_NEXT_EXIST (DTM_Packet_Downlink_Assignment_t, Exist_Packet_Extended_Timing_Advance, 1), + M_UINT (DTM_Packet_Downlink_Assignment_t, Packet_Extended_Timing_Advance, 2), +CSN_DESCR_END(DTM_Packet_Downlink_Assignment_t) + +static const +CSN_DESCR_BEGIN(DTM_DL_t) + M_TYPE (DTM_DL_t, DTM_Packet_Downlink_Assignment, DTM_Packet_Downlink_Assignment_t), +CSN_DESCR_END(DTM_DL_t) + +/* GPRS Broadcast Information */ +static const +CSN_DESCR_BEGIN(DTM_GPRS_Broadcast_Information_t) + M_TYPE (DTM_GPRS_Broadcast_Information_t, GPRS_Cell_Options, GPRS_Cell_Options_t), + M_TYPE (DTM_GPRS_Broadcast_Information_t, GPRS_Power_Control_Parameters, GPRS_Power_Control_Parameters_t), +CSN_DESCR_END(DTM_GPRS_Broadcast_Information_t) + +static const +CSN_DESCR_BEGIN(DTM_GPRS_B_t) + M_TYPE (DTM_GPRS_B_t, DTM_GPRS_Broadcast_Information, DTM_GPRS_Broadcast_Information_t), +CSN_DESCR_END(DTM_GPRS_B_t) + +static const +CSN_DESCR_BEGIN(DTM_Channel_Request_Description_t) + M_UINT (DTM_Channel_Request_Description_t, DTM_Pkt_Est_Cause, 2), + M_TYPE (DTM_Channel_Request_Description_t, Channel_Request_Description, Channel_Request_Description_t), + M_NEXT_EXIST (DTM_Channel_Request_Description_t, Exist_PFI, 1), + M_UINT (DTM_Channel_Request_Description_t, PFI, 7), +CSN_DESCR_END(DTM_Channel_Request_Description_t) +/* DTM */ + +/*< Packet Paging Request message content > */ +typedef struct +{ + guint8 Length_of_Mobile_Identity_contents;/* bit (4) */ + guint8 Mobile_Identity[8];/* octet (val (Length of Mobile Identity contents)) */ +} Mobile_Identity_t; /* helper */ + +static const +CSN_DESCR_BEGIN(Mobile_Identity_t) + M_UINT (Mobile_Identity_t, Length_of_Mobile_Identity_contents, 4), + M_VAR_ARRAY (Mobile_Identity_t, Mobile_Identity, Length_of_Mobile_Identity_contents, 0), +CSN_DESCR_END (Mobile_Identity_t) + +static const +CSN_DESCR_BEGIN(Page_request_for_TBF_establishment_t) + M_UNION (Page_request_for_TBF_establishment_t, 2), + M_UINT_ARRAY (Page_request_for_TBF_establishment_t, u.PTMSI, 8, 4),/* bit (32) == 8*4 */ + M_TYPE (Page_request_for_TBF_establishment_t, u.Mobile_Identity, Mobile_Identity_t), +CSN_DESCR_END (Page_request_for_TBF_establishment_t) + +static const +CSN_DESCR_BEGIN(Page_request_for_RR_conn_t) + M_UNION (Page_request_for_RR_conn_t, 2), + M_UINT_ARRAY (Page_request_for_RR_conn_t, u.TMSI, 8, 4),/* bit (32) == 8*4 */ + M_TYPE (Page_request_for_RR_conn_t, u.Mobile_Identity, Mobile_Identity_t), + + M_UINT (Page_request_for_RR_conn_t, CHANNEL_NEEDED, 2), + + M_NEXT_EXIST (Page_request_for_RR_conn_t, Exist_eMLPP_PRIORITY, 1), + M_UINT (Page_request_for_RR_conn_t, eMLPP_PRIORITY, 3), +CSN_DESCR_END (Page_request_for_RR_conn_t) + +static const +CSN_DESCR_BEGIN(Repeated_Page_info_t) + M_UNION (Repeated_Page_info_t, 2), + M_TYPE (Repeated_Page_info_t, u.Page_req_TBF, Page_request_for_TBF_establishment_t), + M_TYPE (Repeated_Page_info_t, u.Page_req_RR, Page_request_for_RR_conn_t), +CSN_DESCR_END (Repeated_Page_info_t) + +static const +CSN_DESCR_BEGIN(Packet_Paging_Request_t) + M_UINT (Packet_Paging_Request_t, MESSAGE_TYPE, 6), + M_UINT (Packet_Paging_Request_t, PAGE_MODE, 2), + + M_NEXT_EXIST (Packet_Paging_Request_t, Exist_PERSISTENCE_LEVEL, 1), + M_UINT_ARRAY (Packet_Paging_Request_t, PERSISTENCE_LEVEL, 4, 4), /* 4bit*4 */ + + M_NEXT_EXIST (Packet_Paging_Request_t, Exist_NLN, 1), + M_UINT (Packet_Paging_Request_t, NLN, 2), + + M_REC_TARRAY (Packet_Paging_Request_t, Repeated_Page_info, Repeated_Page_info_t, Count_Repeated_Page_info), +CSN_DESCR_END (Packet_Paging_Request_t) + +static const +CSN_DESCR_BEGIN(Packet_PDCH_Release_t) + M_UINT (Packet_PDCH_Release_t, MESSAGE_TYPE, 6), + M_UINT (Packet_PDCH_Release_t, PAGE_MODE, 2), + + M_FIXED (Packet_PDCH_Release_t, 1, 0x01), + M_UINT (Packet_PDCH_Release_t, TIMESLOTS_AVAILABLE, 8), +CSN_DESCR_END (Packet_PDCH_Release_t) + +/*< Packet Power Control/Timing Advance message content >*/ +static const +CSN_DESCR_BEGIN(GlobalTimingAndPower_t) + M_TYPE (GlobalTimingAndPower_t, Global_Packet_Timing_Advance, Global_Packet_Timing_Advance_t), + M_TYPE (GlobalTimingAndPower_t, Power_Control_Parameters, Power_Control_Parameters_t), +CSN_DESCR_END (GlobalTimingAndPower_t) + +static const +CSN_DESCR_BEGIN(GlobalTimingOrPower_t) + M_UNION (GlobalTimingOrPower_t, 2), + M_TYPE (GlobalTimingOrPower_t, u.Global_Packet_Timing_Advance, Global_Packet_Timing_Advance_t), + M_TYPE (GlobalTimingOrPower_t, u.Power_Control_Parameters, Power_Control_Parameters_t), +CSN_DESCR_END (GlobalTimingOrPower_t) + +static const +CSN_ChoiceElement_t PacketPowerControlTimingAdvanceID[] = +{ + {1, 0, M_TYPE(PacketPowerControlTimingAdvanceID_t, u.Global_TFI, Global_TFI_t)}, + {3, 0x06, M_UINT(PacketPowerControlTimingAdvanceID_t, u.TQI, 16)}, + {3, 0x07, M_TYPE(PacketPowerControlTimingAdvanceID_t, u.Packet_Request_Reference, Packet_Request_Reference_t)}, +}; + +static const +CSN_DESCR_BEGIN(PacketPowerControlTimingAdvanceID_t) + M_CHOICE (PacketPowerControlTimingAdvanceID_t, UnionType, PacketPowerControlTimingAdvanceID, ElementsOf(PacketPowerControlTimingAdvanceID)), +CSN_DESCR_END (PacketPowerControlTimingAdvanceID_t) + +static const +CSN_DESCR_BEGIN(Packet_Power_Control_Timing_Advance_t) + M_UINT (Packet_Power_Control_Timing_Advance_t, MESSAGE_TYPE, 6), + M_UINT (Packet_Power_Control_Timing_Advance_t, PAGE_MODE, 2), + + M_TYPE (Packet_Power_Control_Timing_Advance_t, ID, PacketPowerControlTimingAdvanceID_t), + + /*-- Message escape*/ + M_FIXED (Packet_Power_Control_Timing_Advance_t, 1, 0x00), + + M_NEXT_EXIST (Packet_Power_Control_Timing_Advance_t, Exist_Global_Power_Control_Parameters, 1), + M_TYPE (Packet_Power_Control_Timing_Advance_t, Global_Power_Control_Parameters, Global_Power_Control_Parameters_t), + + M_UNION (Packet_Power_Control_Timing_Advance_t, 2), + M_TYPE (Packet_Power_Control_Timing_Advance_t, u.GlobalTimingAndPower, GlobalTimingAndPower_t), + M_TYPE (Packet_Power_Control_Timing_Advance_t, u.GlobalTimingOrPower, GlobalTimingOrPower_t), +CSN_DESCR_END (Packet_Power_Control_Timing_Advance_t) + +/*< Packet Queueing Notification message content > */ +static const +CSN_DESCR_BEGIN(Packet_Queueing_Notification_t) + M_UINT (Packet_Queueing_Notification_t, MESSAGE_TYPE, 6), + M_UINT (Packet_Queueing_Notification_t, PAGE_MODE, 2), + + M_FIXED (Packet_Queueing_Notification_t, 3, 0x07),/* 111 Fixed */ + M_TYPE (Packet_Queueing_Notification_t, Packet_Request_Reference, Packet_Request_Reference_t), + + M_UINT (Packet_Queueing_Notification_t, TQI, 16), +CSN_DESCR_END (Packet_Queueing_Notification_t) + +/* USED in Packet Timeslot Reconfigure message content + * This is almost the same structure as used in + * but UPLINK_TFI_ASSIGNMENT is removed. + */ +static const +CSN_DESCR_BEGIN(TRDynamic_Allocation_t) + M_UINT (TRDynamic_Allocation_t, Extended_Dynamic_Allocation, 1), + + M_NEXT_EXIST (TRDynamic_Allocation_t, Exist_P0, 2), + M_UINT (TRDynamic_Allocation_t, P0, 4), + M_UINT (TRDynamic_Allocation_t, PR_MODE, 1), + + M_UINT (TRDynamic_Allocation_t, USF_GRANULARITY, 1), + + M_NEXT_EXIST (TRDynamic_Allocation_t, Exist_RLC_DATA_BLOCKS_GRANTED, 1), + M_UINT (TRDynamic_Allocation_t, RLC_DATA_BLOCKS_GRANTED, 8), + + M_NEXT_EXIST (TRDynamic_Allocation_t, Exist_TBF_Starting_Time, 1), + M_TYPE (TRDynamic_Allocation_t, TBF_Starting_Time, Starting_Frame_Number_t), + + M_UNION (TRDynamic_Allocation_t, 2), + M_TYPE_ARRAY (TRDynamic_Allocation_t, u.Timeslot_Allocation, Timeslot_Allocation_t, 8), + M_TYPE (TRDynamic_Allocation_t, u.Timeslot_Allocation_Power_Ctrl_Param, Timeslot_Allocation_Power_Ctrl_Param_t), +CSN_DESCR_END (TRDynamic_Allocation_t) + +/*< Packet Timeslot Reconfigure message content > */ +static const +CSN_DESCR_BEGIN(PTR_GPRS_AdditionsR99_t) + M_NEXT_EXIST (PTR_GPRS_AdditionsR99_t, Exist_Packet_Extended_Timing_Advance, 1), + M_UINT (PTR_GPRS_AdditionsR99_t, Packet_Extended_Timing_Advance, 2), +CSN_DESCR_END (PTR_GPRS_AdditionsR99_t) + +static const +CSN_DESCR_BEGIN (PTR_GPRS_t) + M_UINT (PTR_GPRS_t, CHANNEL_CODING_COMMAND, 2), + M_TYPE (PTR_GPRS_t, Common_Timeslot_Reconfigure_Data.Global_Packet_Timing_Advance, Global_Packet_Timing_Advance_t), + M_UINT (PTR_GPRS_t, Common_Timeslot_Reconfigure_Data.DOWNLINK_RLC_MODE, 1), + M_UINT (PTR_GPRS_t, Common_Timeslot_Reconfigure_Data.CONTROL_ACK, 1), + + M_NEXT_EXIST (PTR_GPRS_t, Common_Timeslot_Reconfigure_Data.Exist_DOWNLINK_TFI_ASSIGNMENT, 1), + M_UINT (PTR_GPRS_t, Common_Timeslot_Reconfigure_Data.DOWNLINK_TFI_ASSIGNMENT, 5), + + M_NEXT_EXIST (PTR_GPRS_t, Common_Timeslot_Reconfigure_Data.Exist_UPLINK_TFI_ASSIGNMENT, 1), + M_UINT (PTR_GPRS_t, Common_Timeslot_Reconfigure_Data.UPLINK_TFI_ASSIGNMENT, 5), + + M_UINT (PTR_GPRS_t, Common_Timeslot_Reconfigure_Data.DOWNLINK_TIMESLOT_ALLOCATION, 8), + + M_NEXT_EXIST (PTR_GPRS_t, Common_Timeslot_Reconfigure_Data.Exist_Frequency_Parameters, 1), + M_TYPE (PTR_GPRS_t, Common_Timeslot_Reconfigure_Data.Frequency_Parameters, Frequency_Parameters_t), + + M_UNION (PTR_GPRS_t, 2), + M_TYPE (PTR_GPRS_t, u.Dynamic_Allocation, TRDynamic_Allocation_t), + CSN_ERROR (PTR_GPRS_t, "1 - Fixed Allocation was removed", CSN_ERROR_STREAM_NOT_SUPPORTED), + + M_NEXT_EXIST_OR_NULL(PTR_GPRS_t, Exist_AdditionsR99, 1), + M_TYPE (PTR_GPRS_t, AdditionsR99, PTR_GPRS_AdditionsR99_t), +CSN_DESCR_END (PTR_GPRS_t) + +static const +CSN_DESCR_BEGIN(PTR_EGPRS_00_t) + M_NEXT_EXIST (PTR_EGPRS_00_t, Exist_COMPACT_ReducedMA, 1), + M_TYPE (PTR_EGPRS_00_t, COMPACT_ReducedMA, COMPACT_ReducedMA_t), + + M_UINT (PTR_EGPRS_00_t, EGPRS_ChannelCodingCommand, 4), + M_UINT (PTR_EGPRS_00_t, RESEGMENT, 1), + + M_NEXT_EXIST (PTR_EGPRS_00_t, Exist_DOWNLINK_EGPRS_WindowSize, 1), + M_UINT (PTR_EGPRS_00_t, DOWNLINK_EGPRS_WindowSize, 5), + + M_NEXT_EXIST (PTR_EGPRS_00_t, Exist_UPLINK_EGPRS_WindowSize, 1), + M_UINT (PTR_EGPRS_00_t, UPLINK_EGPRS_WindowSize, 5), + + M_UINT (PTR_EGPRS_00_t, LINK_QUALITY_MEASUREMENT_MODE, 2), + + M_TYPE (PTR_EGPRS_00_t, Common_Timeslot_Reconfigure_Data.Global_Packet_Timing_Advance, Global_Packet_Timing_Advance_t), + + M_NEXT_EXIST (PTR_EGPRS_00_t, Exist_Packet_Extended_Timing_Advance, 1), + M_UINT (PTR_EGPRS_00_t, Packet_Extended_Timing_Advance, 2), + + M_UINT (PTR_EGPRS_00_t, Common_Timeslot_Reconfigure_Data.DOWNLINK_RLC_MODE, 1), + M_UINT (PTR_EGPRS_00_t, Common_Timeslot_Reconfigure_Data.CONTROL_ACK, 1), + + M_NEXT_EXIST (PTR_EGPRS_00_t, Common_Timeslot_Reconfigure_Data.Exist_DOWNLINK_TFI_ASSIGNMENT, 1), + M_UINT (PTR_EGPRS_00_t, Common_Timeslot_Reconfigure_Data.DOWNLINK_TFI_ASSIGNMENT, 5), + + M_NEXT_EXIST (PTR_EGPRS_00_t, Common_Timeslot_Reconfigure_Data.Exist_UPLINK_TFI_ASSIGNMENT, 1), + M_UINT (PTR_EGPRS_00_t, Common_Timeslot_Reconfigure_Data.UPLINK_TFI_ASSIGNMENT, 5), + + M_UINT (PTR_EGPRS_00_t, Common_Timeslot_Reconfigure_Data.DOWNLINK_TIMESLOT_ALLOCATION, 8), + + M_NEXT_EXIST (PTR_EGPRS_00_t, Common_Timeslot_Reconfigure_Data.Exist_Frequency_Parameters, 1), + M_TYPE (PTR_EGPRS_00_t, Common_Timeslot_Reconfigure_Data.Frequency_Parameters, Frequency_Parameters_t), + + M_UNION (PTR_EGPRS_00_t, 2), + M_TYPE (PTR_EGPRS_00_t, u.Dynamic_Allocation, TRDynamic_Allocation_t), + CSN_ERROR (PTR_EGPRS_00_t, "1 ", CSN_ERROR_STREAM_NOT_SUPPORTED), +CSN_DESCR_END (PTR_EGPRS_00_t) + +static const +CSN_DESCR_BEGIN(PTR_EGPRS_t) + M_UNION (PTR_EGPRS_t, 4), + M_TYPE (PTR_EGPRS_t, u.PTR_EGPRS_00, PTR_EGPRS_00_t), + CSN_ERROR (PTR_EGPRS_t, "01 ", CSN_ERROR_STREAM_NOT_SUPPORTED), + CSN_ERROR (PTR_EGPRS_t, "10 ", CSN_ERROR_STREAM_NOT_SUPPORTED), + CSN_ERROR (PTR_EGPRS_t, "11 ", CSN_ERROR_STREAM_NOT_SUPPORTED), +CSN_DESCR_END (PTR_EGPRS_t) + +static const +CSN_DESCR_BEGIN(Packet_Timeslot_Reconfigure_t) + M_UINT (Packet_Timeslot_Reconfigure_t, MESSAGE_TYPE, 6), + M_UINT (Packet_Timeslot_Reconfigure_t, PAGE_MODE, 2), + + M_FIXED (Packet_Timeslot_Reconfigure_t, 1, 0x00), + M_TYPE (Packet_Timeslot_Reconfigure_t, Global_TFI, Global_TFI_t), + + M_UNION (Packet_Timeslot_Reconfigure_t, 2), + M_TYPE (Packet_Timeslot_Reconfigure_t, u.PTR_GPRS_Struct, PTR_GPRS_t), + M_TYPE (Packet_Timeslot_Reconfigure_t, u.PTR_EGPRS_Struct, PTR_EGPRS_t), +CSN_DESCR_END (Packet_Timeslot_Reconfigure_t) + +typedef Packet_Timeslot_Reconfigure_t PTRCheck_t; + +static const +CSN_DESCR_BEGIN(PTRCheck_t) + M_UINT (PTRCheck_t, MESSAGE_TYPE, 6), + M_UINT (PTRCheck_t, PAGE_MODE, 2), + M_FIXED (PTRCheck_t, 1, 0x00),/* 0 fixed */ + M_TYPE (PTRCheck_t, Global_TFI, Global_TFI_t), +CSN_DESCR_END (PTRCheck_t) + +/*< Packet PRACH Parameters message content > */ +static const +CSN_DESCR_BEGIN(PRACH_Control_t) + M_UINT_ARRAY (PRACH_Control_t, ACC_CONTR_CLASS, 8, 2), /* bit (16) == 8bit*2 */ + M_UINT_ARRAY (PRACH_Control_t, MAX_RETRANS, 2, 4), /* bit (2) * 4 */ + M_UINT (PRACH_Control_t, S, 4), + M_UINT (PRACH_Control_t, TX_INT, 4), + M_NEXT_EXIST (PRACH_Control_t, Exist_PERSISTENCE_LEVEL, 1), + M_UINT_ARRAY (PRACH_Control_t, PERSISTENCE_LEVEL, 4, 4), +CSN_DESCR_END (PRACH_Control_t) + +static const +CSN_DESCR_BEGIN(Cell_Allocation_t) + M_REC_ARRAY (Cell_Allocation_t, RFL_Number, NoOfRFLs, 4), +CSN_DESCR_END (Cell_Allocation_t) + +static const +CSN_DESCR_BEGIN(HCS_t) + M_UINT (HCS_t, PRIORITY_CLASS, 3), + M_UINT (HCS_t, HCS_THR, 5), +CSN_DESCR_END (HCS_t) + +static const +CSN_DESCR_BEGIN(Location_Repeat_t) + M_UINT (Location_Repeat_t, PBCCH_LOCATION, 2), + M_UINT (Location_Repeat_t, PSI1_REPEAT_PERIOD, 4), +CSN_DESCR_END (Location_Repeat_t) + +static const +CSN_DESCR_BEGIN(SI13_PBCCH_Location_t) + M_UNION (SI13_PBCCH_Location_t, 2), + M_UINT (SI13_PBCCH_Location_t, u.SI13_LOCATION, 1), + M_TYPE (SI13_PBCCH_Location_t, u.lr, Location_Repeat_t), +CSN_DESCR_END (SI13_PBCCH_Location_t) + +static const +CSN_DESCR_BEGIN(Cell_Selection_t) + M_UINT (Cell_Selection_t, BSIC, 6), + M_UINT (Cell_Selection_t, CELL_BAR_ACCESS_2, 1), + M_UINT (Cell_Selection_t, EXC_ACC, 1), + M_UINT (Cell_Selection_t, SAME_RA_AS_SERVING_CELL, 1), + M_NEXT_EXIST (Cell_Selection_t, Exist_RXLEV_and_TXPWR, 2), + M_UINT (Cell_Selection_t, GPRS_RXLEV_ACCESS_MIN, 6), + M_UINT (Cell_Selection_t, GPRS_MS_TXPWR_MAX_CCH, 5), + M_NEXT_EXIST (Cell_Selection_t, Exist_OFFSET_and_TIME, 2), + M_UINT (Cell_Selection_t, GPRS_TEMPORARY_OFFSET, 3), + M_UINT (Cell_Selection_t, GPRS_PENALTY_TIME, 5), + M_NEXT_EXIST (Cell_Selection_t, Exist_GPRS_RESELECT_OFFSET, 1), + M_UINT (Cell_Selection_t, GPRS_RESELECT_OFFSET, 5), + M_NEXT_EXIST (Cell_Selection_t, Exist_HCS, 1), + M_TYPE (Cell_Selection_t, HCS, HCS_t), + M_NEXT_EXIST (Cell_Selection_t, Exist_SI13_PBCCH_Location, 1), + M_TYPE (Cell_Selection_t, SI13_PBCCH_Location, SI13_PBCCH_Location_t), +CSN_DESCR_END (Cell_Selection_t) + +static const +CSN_DESCR_BEGIN(Cell_Selection_Params_With_FreqDiff_t) + M_VAR_BITMAP (Cell_Selection_Params_With_FreqDiff_t, FREQUENCY_DIFF, FREQ_DIFF_LENGTH, 0), + M_TYPE (Cell_Selection_Params_With_FreqDiff_t, Cell_SelectionParams, Cell_Selection_t), +CSN_DESCR_END (Cell_Selection_Params_With_FreqDiff_t) + +static const +CSN_DESCR_BEGIN(NeighbourCellParameters_t) + M_UINT (NeighbourCellParameters_t, START_FREQUENCY, 10), + M_TYPE (NeighbourCellParameters_t, Cell_Selection, Cell_Selection_t), + M_UINT (NeighbourCellParameters_t, NR_OF_REMAINING_CELLS, 4), + M_UINT_OFFSET(NeighbourCellParameters_t, FREQ_DIFF_LENGTH, 3, 1),/* offset 1 */ + M_VAR_TARRAY (NeighbourCellParameters_t, Cell_Selection_Params_With_FreqDiff, Cell_Selection_Params_With_FreqDiff_t, NR_OF_REMAINING_CELLS), +CSN_DESCR_END (NeighbourCellParameters_t) + +static const +CSN_DESCR_BEGIN(NeighbourCellList_t) + M_REC_TARRAY (NeighbourCellList_t, Parameters, NeighbourCellParameters_t, Count), +CSN_DESCR_END (NeighbourCellList_t) + +static const +CSN_DESCR_BEGIN(Cell_Selection_2_t) + M_UINT (Cell_Selection_2_t, CELL_BAR_ACCESS_2, 1), + M_UINT (Cell_Selection_2_t, EXC_ACC, 1), + M_UINT (Cell_Selection_2_t, SAME_RA_AS_SERVING_CELL, 1), + M_NEXT_EXIST (Cell_Selection_2_t, Exist_RXLEV_and_TXPWR, 2), + M_UINT (Cell_Selection_2_t, GPRS_RXLEV_ACCESS_MIN, 6), + M_UINT (Cell_Selection_2_t, GPRS_MS_TXPWR_MAX_CCH, 5), + M_NEXT_EXIST (Cell_Selection_2_t, Exist_OFFSET_and_TIME, 2), + M_UINT (Cell_Selection_2_t, GPRS_TEMPORARY_OFFSET, 3), + M_UINT (Cell_Selection_2_t, GPRS_PENALTY_TIME, 5), + M_NEXT_EXIST (Cell_Selection_2_t, Exist_GPRS_RESELECT_OFFSET, 1), + M_UINT (Cell_Selection_2_t, GPRS_RESELECT_OFFSET, 5), + M_NEXT_EXIST (Cell_Selection_2_t, Exist_HCS, 1), + M_TYPE (Cell_Selection_2_t, HCS, HCS_t), + M_NEXT_EXIST (Cell_Selection_2_t, Exist_SI13_PBCCH_Location, 1), + M_TYPE (Cell_Selection_2_t, SI13_PBCCH_Location, SI13_PBCCH_Location_t), +CSN_DESCR_END (Cell_Selection_2_t) + +static const +CSN_DESCR_BEGIN(Packet_PRACH_Parameters_t) + M_UINT (Packet_PRACH_Parameters_t, MESSAGE_TYPE, 6), + M_UINT (Packet_PRACH_Parameters_t, PAGE_MODE, 2), + + M_TYPE (Packet_PRACH_Parameters_t, PRACH_Control, PRACH_Control_t), +CSN_DESCR_END (Packet_PRACH_Parameters_t) + +/* < Packet Access Reject message content > */ +static const +CSN_ChoiceElement_t RejectID[] = +{ + {1, 0x00, M_UINT(RejectID_t, u.TLLI, 32)}, + {2, 0x02, M_TYPE(RejectID_t, u.Packet_Request_Reference, Packet_Request_Reference_t)}, + {2, 0x03, M_TYPE(RejectID_t, u.Global_TFI, Global_TFI_t)}, +}; + +static const +CSN_DESCR_BEGIN(RejectID_t) + M_CHOICE (RejectID_t, UnionType, RejectID, ElementsOf(RejectID)), +CSN_DESCR_END (RejectID_t) + +static const +CSN_DESCR_BEGIN(Reject_t) + M_TYPE (Reject_t, ID, RejectID_t), + + M_NEXT_EXIST (Reject_t, Exist_Wait, 2), + M_UINT (Reject_t, WAIT_INDICATION, 8), + M_UINT (Reject_t, WAIT_INDICATION_SIZE, 1), +CSN_DESCR_END (Reject_t) + +static const +CSN_DESCR_BEGIN(Packet_Access_Reject_t) + M_UINT (Packet_Access_Reject_t, MESSAGE_TYPE, 6), + M_UINT (Packet_Access_Reject_t, PAGE_MODE, 2), + + M_TYPE (Packet_Access_Reject_t, Reject, Reject_t), + M_REC_TARRAY (Packet_Access_Reject_t, Reject[1], Reject_t, Count_Reject), +CSN_DESCR_END (Packet_Access_Reject_t) + +/* < Packet Cell Change Order message content > */ +static const +CSN_ChoiceElement_t PacketCellChangeOrderID[] = +{ + {1, 0, M_TYPE(PacketCellChangeOrderID_t, u.Global_TFI, Global_TFI_t)}, + {2, 0x02, M_UINT(PacketCellChangeOrderID_t, u.TLLI, 32)}, +}; +/* PacketCellChangeOrderID_t; */ + +static const +CSN_DESCR_BEGIN(PacketCellChangeOrderID_t) + M_CHOICE (PacketCellChangeOrderID_t, UnionType, PacketCellChangeOrderID, ElementsOf(PacketCellChangeOrderID)), +CSN_DESCR_END (PacketCellChangeOrderID_t) + +static const +CSN_DESCR_BEGIN(h_FreqBsicCell_t) + M_UINT (h_FreqBsicCell_t, BSIC, 6), + M_TYPE (h_FreqBsicCell_t, Cell_Selection, Cell_Selection_t), +CSN_DESCR_END (h_FreqBsicCell_t) + +static const CSN_DESCR_BEGIN(CellSelectionParamsWithFreqDiff_t) + /*FREQUENCY_DIFF is really an integer but the number of bits to decode it are stored in FREQ_DIFF_LENGTH*/ + M_VAR_BITMAP (CellSelectionParamsWithFreqDiff_t, FREQUENCY_DIFF, FREQ_DIFF_LENGTH, 0), + M_UINT (CellSelectionParamsWithFreqDiff_t, BSIC, 6), + M_NEXT_EXIST (CellSelectionParamsWithFreqDiff_t, Exist_CellSelectionParams, 1), + M_TYPE (CellSelectionParamsWithFreqDiff_t, CellSelectionParams, Cell_Selection_2_t), +CSN_DESCR_END (CellSelectionParamsWithFreqDiff_t) + +static const +CSN_DESCR_BEGIN(Add_Frequency_list_t) + M_UINT (Add_Frequency_list_t, START_FREQUENCY, 10), + M_UINT (Add_Frequency_list_t, BSIC, 6), + + M_NEXT_EXIST (Add_Frequency_list_t, Exist_Cell_Selection, 1), + M_TYPE (Add_Frequency_list_t, Cell_Selection, Cell_Selection_2_t), + + M_UINT (Add_Frequency_list_t, NR_OF_FREQUENCIES, 5), + M_UINT_OFFSET(Add_Frequency_list_t, FREQ_DIFF_LENGTH, 3, 1),/*offset 1*/ + + M_VAR_TARRAY (Add_Frequency_list_t, CellSelectionParamsWithFreqDiff, CellSelectionParamsWithFreqDiff_t, NR_OF_FREQUENCIES), +CSN_DESCR_END (Add_Frequency_list_t) + +static const CSN_DESCR_BEGIN(Removed_Freq_Index_t) + M_UINT(Removed_Freq_Index_t, REMOVED_FREQ_INDEX, 6), +CSN_DESCR_END(Removed_Freq_Index_t) + +static const +CSN_DESCR_BEGIN(NC_Frequency_list_t) + M_NEXT_EXIST (NC_Frequency_list_t, Exist_REMOVED_FREQ, 2), + M_UINT_OFFSET(NC_Frequency_list_t, NR_OF_REMOVED_FREQ, 5, 1),/*offset 1*/ + M_VAR_TARRAY (NC_Frequency_list_t, Removed_Freq_Index, Removed_Freq_Index_t, NR_OF_REMOVED_FREQ), + M_REC_TARRAY (NC_Frequency_list_t, Add_Frequency, Add_Frequency_list_t, Count_Add_Frequency), +CSN_DESCR_END (NC_Frequency_list_t) + +static const +CSN_DESCR_BEGIN(NC_Measurement_Parameters_t) + M_UINT (NC_Measurement_Parameters_t, NETWORK_CONTROL_ORDER, 2), + + M_NEXT_EXIST (NC_Measurement_Parameters_t, Exist_NC, 3), + M_UINT (NC_Measurement_Parameters_t, NC_NON_DRX_PERIOD, 3), + M_UINT (NC_Measurement_Parameters_t, NC_REPORTING_PERIOD_I, 3), + M_UINT (NC_Measurement_Parameters_t, NC_REPORTING_PERIOD_T, 3), +CSN_DESCR_END (NC_Measurement_Parameters_t) + +static const +CSN_DESCR_BEGIN(NC_Measurement_Parameters_with_Frequency_List_t) + M_UINT (NC_Measurement_Parameters_with_Frequency_List_t, NETWORK_CONTROL_ORDER, 2), + + M_NEXT_EXIST (NC_Measurement_Parameters_with_Frequency_List_t, Exist_NC, 3), + M_UINT (NC_Measurement_Parameters_with_Frequency_List_t, NC_NON_DRX_PERIOD, 3), + M_UINT (NC_Measurement_Parameters_with_Frequency_List_t, NC_REPORTING_PERIOD_I, 3), + M_UINT (NC_Measurement_Parameters_with_Frequency_List_t, NC_REPORTING_PERIOD_T, 3), + + M_NEXT_EXIST (NC_Measurement_Parameters_with_Frequency_List_t, Exist_NC_FREQUENCY_LIST, 1), + M_TYPE (NC_Measurement_Parameters_with_Frequency_List_t, NC_Frequency_list, NC_Frequency_list_t), +CSN_DESCR_END (NC_Measurement_Parameters_with_Frequency_List_t) + +/*< Packet Cell Change Order message contents >*/ +static const +CSN_DESCR_BEGIN(BA_IND_t) + M_UINT (BA_IND_t, BA_IND, 1), + M_UINT (BA_IND_t, BA_IND_3G, 1), +CSN_DESCR_END (BA_IND_t) + +static const +CSN_DESCR_BEGIN(GPRSReportPriority_t) + M_UINT (GPRSReportPriority_t, NUMBER_CELLS, 7), + M_VAR_BITMAP (GPRSReportPriority_t, REPORT_PRIORITY, NUMBER_CELLS, 0), +CSN_DESCR_END (GPRSReportPriority_t) + +static const +CSN_DESCR_BEGIN(OffsetThreshold_t) + M_UINT (OffsetThreshold_t, REPORTING_OFFSET, 3), + M_UINT (OffsetThreshold_t, REPORTING_THRESHOLD, 3), +CSN_DESCR_END (OffsetThreshold_t) + +static const +CSN_DESCR_BEGIN(GPRSMeasurementParams_PMO_PCCO_t) + M_NEXT_EXIST (GPRSMeasurementParams_PMO_PCCO_t, Exist_MULTI_BAND_REPORTING, 1), + M_UINT (GPRSMeasurementParams_PMO_PCCO_t, MULTI_BAND_REPORTING, 2), + + M_NEXT_EXIST (GPRSMeasurementParams_PMO_PCCO_t, Exist_SERVING_BAND_REPORTING, 1), + M_UINT (GPRSMeasurementParams_PMO_PCCO_t, SERVING_BAND_REPORTING, 2), + + M_UINT (GPRSMeasurementParams_PMO_PCCO_t, SCALE_ORD, 2), + + M_NEXT_EXIST (GPRSMeasurementParams_PMO_PCCO_t, Exist_OffsetThreshold900, 1), + M_TYPE (GPRSMeasurementParams_PMO_PCCO_t, OffsetThreshold900, OffsetThreshold_t), + + M_NEXT_EXIST (GPRSMeasurementParams_PMO_PCCO_t, Exist_OffsetThreshold1800, 1), + M_TYPE (GPRSMeasurementParams_PMO_PCCO_t, OffsetThreshold1800, OffsetThreshold_t), + + M_NEXT_EXIST (GPRSMeasurementParams_PMO_PCCO_t, Exist_OffsetThreshold400, 1), + M_TYPE (GPRSMeasurementParams_PMO_PCCO_t, OffsetThreshold400, OffsetThreshold_t), + + M_NEXT_EXIST (GPRSMeasurementParams_PMO_PCCO_t, Exist_OffsetThreshold1900, 1), + M_TYPE (GPRSMeasurementParams_PMO_PCCO_t, OffsetThreshold1900, OffsetThreshold_t), + + M_NEXT_EXIST (GPRSMeasurementParams_PMO_PCCO_t, Exist_OffsetThreshold850, 1), + M_TYPE (GPRSMeasurementParams_PMO_PCCO_t, OffsetThreshold850, OffsetThreshold_t), +CSN_DESCR_END (GPRSMeasurementParams_PMO_PCCO_t) + +static const +CSN_DESCR_BEGIN(GPRSMeasurementParams3G_t) + M_UINT (GPRSMeasurementParams3G_t, Qsearch_p, 4), + M_UINT (GPRSMeasurementParams3G_t, SearchPrio3G, 1), + + M_NEXT_EXIST (GPRSMeasurementParams3G_t, existRepParamsFDD, 2), + M_UINT (GPRSMeasurementParams3G_t, RepQuantFDD, 1), + M_UINT (GPRSMeasurementParams3G_t, MultiratReportingFDD, 2), + + M_NEXT_EXIST (GPRSMeasurementParams3G_t, existReportingParamsFDD, 2), + M_UINT (GPRSMeasurementParams3G_t, ReportingOffsetFDD, 3), + M_UINT (GPRSMeasurementParams3G_t, ReportingThresholdFDD, 3), + + M_NEXT_EXIST (GPRSMeasurementParams3G_t, existMultiratReportingTDD, 1), + M_UINT (GPRSMeasurementParams3G_t, MultiratReportingTDD, 2), + + M_NEXT_EXIST (GPRSMeasurementParams3G_t, existOffsetThresholdTDD, 2), + M_UINT (GPRSMeasurementParams3G_t, ReportingOffsetTDD, 3), + M_UINT (GPRSMeasurementParams3G_t, ReportingThresholdTDD, 3), +CSN_DESCR_END (GPRSMeasurementParams3G_t) + +static const +CSN_DESCR_BEGIN(MultiratParams3G_t) + M_NEXT_EXIST (MultiratParams3G_t, existMultiratReporting, 1), + M_UINT (MultiratParams3G_t, MultiratReporting, 2), + + M_NEXT_EXIST (MultiratParams3G_t, existOffsetThreshold, 1), + M_TYPE (MultiratParams3G_t, OffsetThreshold, OffsetThreshold_t), +CSN_DESCR_END (MultiratParams3G_t) + +static const +CSN_DESCR_BEGIN(ENH_GPRSMeasurementParams3G_PMO_t) + M_UINT (ENH_GPRSMeasurementParams3G_PMO_t, Qsearch_P, 4), + M_UINT (ENH_GPRSMeasurementParams3G_PMO_t, SearchPrio3G, 1), + + M_NEXT_EXIST (ENH_GPRSMeasurementParams3G_PMO_t, existRepParamsFDD, 2), + M_UINT (ENH_GPRSMeasurementParams3G_PMO_t, RepQuantFDD, 1), + M_UINT (ENH_GPRSMeasurementParams3G_PMO_t, MultiratReportingFDD, 2), + + M_NEXT_EXIST (ENH_GPRSMeasurementParams3G_PMO_t, existOffsetThreshold, 1), + M_TYPE (ENH_GPRSMeasurementParams3G_PMO_t, OffsetThreshold, OffsetThreshold_t), + + M_TYPE (ENH_GPRSMeasurementParams3G_PMO_t, ParamsTDD, MultiratParams3G_t), + M_TYPE (ENH_GPRSMeasurementParams3G_PMO_t, ParamsCDMA2000, MultiratParams3G_t), +CSN_DESCR_END (ENH_GPRSMeasurementParams3G_PMO_t) + +static const +CSN_DESCR_BEGIN(ENH_GPRSMeasurementParams3G_PCCO_t) + M_UINT (ENH_GPRSMeasurementParams3G_PCCO_t, Qsearch_P, 4), + M_UINT (ENH_GPRSMeasurementParams3G_PCCO_t, SearchPrio3G, 1), + + M_NEXT_EXIST (ENH_GPRSMeasurementParams3G_PCCO_t, existRepParamsFDD, 2), + M_UINT (ENH_GPRSMeasurementParams3G_PCCO_t, RepQuantFDD, 1), + M_UINT (ENH_GPRSMeasurementParams3G_PCCO_t, MultiratReportingFDD, 2), + + M_NEXT_EXIST (ENH_GPRSMeasurementParams3G_PCCO_t, existOffsetThreshold, 1), + M_TYPE (ENH_GPRSMeasurementParams3G_PCCO_t, OffsetThreshold, OffsetThreshold_t), + + M_TYPE (ENH_GPRSMeasurementParams3G_PCCO_t, ParamsTDD, MultiratParams3G_t), +CSN_DESCR_END (ENH_GPRSMeasurementParams3G_PCCO_t) + +static const +CSN_DESCR_BEGIN(N2_t) + M_UINT (N2_t, REMOVED_3GCELL_INDEX, 7), + M_UINT (N2_t, CELL_DIFF_LENGTH_3G, 3), + M_VAR_BITMAP (N2_t, CELL_DIFF_3G, CELL_DIFF_LENGTH_3G, 0), +CSN_DESCR_END (N2_t) + +static const +CSN_DESCR_BEGIN (N1_t) + M_UINT_OFFSET (N1_t, N2_Count, 5, 1), /*offset 1*/ + M_VAR_TARRAY (N1_t, N2s, N2_t, N2_Count), +CSN_DESCR_END (N1_t) + +static const +CSN_DESCR_BEGIN (Removed3GCellDescription_t) + M_UINT_OFFSET (Removed3GCellDescription_t, N1_Count, 2, 1), /* offset 1 */ + M_VAR_TARRAY (Removed3GCellDescription_t, N1s, N1_t, N1_Count), +CSN_DESCR_END (Removed3GCellDescription_t) + +static const +CSN_DESCR_BEGIN(CDMA2000_Description_t) + M_UINT (CDMA2000_Description_t, Complete_This, 1), + CSN_ERROR (CDMA2000_Description_t, "Not Implemented", CSN_ERROR_STREAM_NOT_SUPPORTED), +CSN_DESCR_END (CDMA2000_Description_t) + +static const +CSN_DESCR_BEGIN(UTRAN_FDD_NeighbourCells_t) + M_UINT (UTRAN_FDD_NeighbourCells_t, ZERO, 1), + M_UINT (UTRAN_FDD_NeighbourCells_t, UARFCN, 14), + M_UINT (UTRAN_FDD_NeighbourCells_t, Indic0, 1), + M_UINT (UTRAN_FDD_NeighbourCells_t, NrOfCells, 5), +/* M_CALLBACK (UTRAN_FDD_NeighbourCells_t, (void*) 14, NrOfCells, BitsInCellInfo), */ + M_VAR_BITMAP (UTRAN_FDD_NeighbourCells_t, CellInfo, BitsInCellInfo, 0), +CSN_DESCR_END (UTRAN_FDD_NeighbourCells_t) + +static const +CSN_DESCR_BEGIN(UTRAN_FDD_Description_t) + M_NEXT_EXIST (UTRAN_FDD_Description_t, existBandwidth, 1), + M_UINT (UTRAN_FDD_Description_t, Bandwidth, 3), + M_REC_TARRAY (UTRAN_FDD_Description_t, CellParams, UTRAN_FDD_NeighbourCells_t, NrOfFrequencies), +CSN_DESCR_END (UTRAN_FDD_Description_t) + +static const +CSN_DESCR_BEGIN(UTRAN_TDD_NeighbourCells_t) + M_UINT (UTRAN_TDD_NeighbourCells_t, ZERO, 1), + M_UINT (UTRAN_TDD_NeighbourCells_t, UARFCN, 14), + M_UINT (UTRAN_TDD_NeighbourCells_t, Indic0, 1), + M_UINT (UTRAN_TDD_NeighbourCells_t, NrOfCells, 5), +/* M_CALLBACK (UTRAN_TDD_NeighbourCells_t, (void*) 23, NrOfCells, BitsInCellInfo), */ + M_VAR_BITMAP (UTRAN_TDD_NeighbourCells_t, CellInfo, BitsInCellInfo, 0), +CSN_DESCR_END (UTRAN_TDD_NeighbourCells_t) + +static const +CSN_DESCR_BEGIN(UTRAN_TDD_Description_t) + M_NEXT_EXIST (UTRAN_TDD_Description_t, existBandwidth, 1), + M_UINT (UTRAN_TDD_Description_t, Bandwidth, 3), + M_REC_TARRAY (UTRAN_TDD_Description_t, CellParams, UTRAN_TDD_NeighbourCells_t, NrOfFrequencies), +CSN_DESCR_END (UTRAN_TDD_Description_t) + +static const +CSN_DESCR_BEGIN(NeighbourCellDescription3G_PMO_t) + M_NEXT_EXIST (NeighbourCellDescription3G_PMO_t, Exist_Index_Start_3G, 1), + M_UINT (NeighbourCellDescription3G_PMO_t, Index_Start_3G, 7), + M_NEXT_EXIST (NeighbourCellDescription3G_PMO_t, Exist_Absolute_Index_Start_EMR, 1), + M_UINT (NeighbourCellDescription3G_PMO_t, Absolute_Index_Start_EMR, 7), + M_NEXT_EXIST (NeighbourCellDescription3G_PMO_t, Exist_UTRAN_FDD_Description, 1), + M_TYPE (NeighbourCellDescription3G_PMO_t, UTRAN_FDD_Description, UTRAN_FDD_Description_t), + M_NEXT_EXIST (NeighbourCellDescription3G_PMO_t, Exist_UTRAN_TDD_Description, 1), + M_TYPE (NeighbourCellDescription3G_PMO_t, UTRAN_TDD_Description, UTRAN_TDD_Description_t), + M_NEXT_EXIST (NeighbourCellDescription3G_PMO_t, Exist_CDMA2000_Description, 1), + M_TYPE (NeighbourCellDescription3G_PMO_t, CDMA2000_Description, CDMA2000_Description_t), + M_NEXT_EXIST (NeighbourCellDescription3G_PMO_t, Exist_Removed3GCellDescription, 1), + M_TYPE (NeighbourCellDescription3G_PMO_t, Removed3GCellDescription, Removed3GCellDescription_t), +CSN_DESCR_END (NeighbourCellDescription3G_PMO_t) + +static const +CSN_DESCR_BEGIN(NeighbourCellDescription3G_PCCO_t) + M_NEXT_EXIST (NeighbourCellDescription3G_PCCO_t, Exist_Index_Start_3G, 1), + M_UINT (NeighbourCellDescription3G_PCCO_t, Index_Start_3G, 7), + M_NEXT_EXIST (NeighbourCellDescription3G_PCCO_t, Exist_Absolute_Index_Start_EMR, 1), + M_UINT (NeighbourCellDescription3G_PCCO_t, Absolute_Index_Start_EMR, 7), + M_NEXT_EXIST (NeighbourCellDescription3G_PCCO_t, Exist_UTRAN_FDD_Description, 1), + M_TYPE (NeighbourCellDescription3G_PCCO_t, UTRAN_FDD_Description, UTRAN_FDD_Description_t), + M_NEXT_EXIST (NeighbourCellDescription3G_PCCO_t, Exist_UTRAN_TDD_Description, 1), + M_TYPE (NeighbourCellDescription3G_PCCO_t, UTRAN_TDD_Description, UTRAN_TDD_Description_t), + M_NEXT_EXIST (NeighbourCellDescription3G_PCCO_t, Exist_Removed3GCellDescription, 1), + M_TYPE (NeighbourCellDescription3G_PCCO_t, Removed3GCellDescription, Removed3GCellDescription_t), +CSN_DESCR_END (NeighbourCellDescription3G_PCCO_t) + +static const +CSN_DESCR_BEGIN(ENH_Measurement_Parameters_PMO_t) + M_UNION (ENH_Measurement_Parameters_PMO_t, 2), + M_TYPE (ENH_Measurement_Parameters_PMO_t, u.BA_IND, BA_IND_t), + M_UINT (ENH_Measurement_Parameters_PMO_t, u.PSI3_CHANGE_MARK, 2), + M_UINT (ENH_Measurement_Parameters_PMO_t, PMO_IND, 1), + + M_UINT (ENH_Measurement_Parameters_PMO_t, REPORT_TYPE, 1), + M_UINT (ENH_Measurement_Parameters_PMO_t, REPORTING_RATE, 1), + M_UINT (ENH_Measurement_Parameters_PMO_t, INVALID_BSIC_REPORTING, 1), + + M_NEXT_EXIST (ENH_Measurement_Parameters_PMO_t, Exist_NeighbourCellDescription3G, 1), + M_TYPE (ENH_Measurement_Parameters_PMO_t, NeighbourCellDescription3G, NeighbourCellDescription3G_PMO_t), + + M_NEXT_EXIST (ENH_Measurement_Parameters_PMO_t, Exist_GPRSReportPriority, 1), + M_TYPE (ENH_Measurement_Parameters_PMO_t, GPRSReportPriority, GPRSReportPriority_t), + + M_NEXT_EXIST (ENH_Measurement_Parameters_PMO_t, Exist_GPRSMeasurementParams, 1), + M_TYPE (ENH_Measurement_Parameters_PMO_t, GPRSMeasurementParams, GPRSMeasurementParams_PMO_PCCO_t), + + M_NEXT_EXIST (ENH_Measurement_Parameters_PMO_t, Exist_GPRSMeasurementParams3G, 1), + M_TYPE (ENH_Measurement_Parameters_PMO_t, GPRSMeasurementParams3G, ENH_GPRSMeasurementParams3G_PMO_t), +CSN_DESCR_END (ENH_Measurement_Parameters_PMO_t) + +static const +CSN_DESCR_BEGIN(ENH_Measurement_Parameters_PCCO_t) + M_UNION (ENH_Measurement_Parameters_PCCO_t, 2), + M_TYPE (ENH_Measurement_Parameters_PCCO_t, u.BA_IND, BA_IND_t), + M_UINT (ENH_Measurement_Parameters_PCCO_t, u.PSI3_CHANGE_MARK, 2), + M_UINT (ENH_Measurement_Parameters_PCCO_t, PMO_IND, 1), + + M_UINT (ENH_Measurement_Parameters_PCCO_t, REPORT_TYPE, 1), + M_UINT (ENH_Measurement_Parameters_PCCO_t, REPORTING_RATE, 1), + M_UINT (ENH_Measurement_Parameters_PCCO_t, INVALID_BSIC_REPORTING, 1), + + M_NEXT_EXIST (ENH_Measurement_Parameters_PCCO_t, Exist_NeighbourCellDescription3G, 1), + M_TYPE (ENH_Measurement_Parameters_PCCO_t, NeighbourCellDescription3G, NeighbourCellDescription3G_PCCO_t), + + M_NEXT_EXIST (ENH_Measurement_Parameters_PCCO_t, Exist_GPRSReportPriority, 1), + M_TYPE (ENH_Measurement_Parameters_PCCO_t, GPRSReportPriority, GPRSReportPriority_t), + + M_NEXT_EXIST (ENH_Measurement_Parameters_PCCO_t, Exist_GPRSMeasurementParams, 1), + M_TYPE (ENH_Measurement_Parameters_PCCO_t, GPRSMeasurementParams, GPRSMeasurementParams_PMO_PCCO_t), + + M_NEXT_EXIST (ENH_Measurement_Parameters_PCCO_t, Exist_GPRSMeasurementParams3G, 1), + M_TYPE (ENH_Measurement_Parameters_PCCO_t, GPRSMeasurementParams3G, ENH_GPRSMeasurementParams3G_PCCO_t), +CSN_DESCR_END (ENH_Measurement_Parameters_PCCO_t) + +static const +CSN_DESCR_BEGIN(CCN_Support_Description_t) + M_UINT (CCN_Support_Description_t, NUMBER_CELLS, 7), + M_VAR_BITMAP (CCN_Support_Description_t, CCN_SUPPORTED, NUMBER_CELLS, 0), +CSN_DESCR_END (CCN_Support_Description_t) + +static const +CSN_DESCR_BEGIN(lu_ModeCellSelectionParameters_t) + M_UINT (lu_ModeCellSelectionParameters_t, CELL_BAR_QUALIFY_3, 2), + M_NEXT_EXIST (lu_ModeCellSelectionParameters_t, Exist_SI13_Alt_PBCCH_Location, 1), + M_TYPE (lu_ModeCellSelectionParameters_t, SI13_Alt_PBCCH_Location, SI13_PBCCH_Location_t), +CSN_DESCR_END (lu_ModeCellSelectionParameters_t) + +static const +CSN_DESCR_BEGIN(lu_ModeCellSelectionParams_t) + M_NEXT_EXIST (lu_ModeCellSelectionParams_t, Exist_lu_ModeCellSelectionParams, 1), + M_TYPE (lu_ModeCellSelectionParams_t, lu_ModeCellSelectionParameters, lu_ModeCellSelectionParameters_t), +CSN_DESCR_END (lu_ModeCellSelectionParams_t) + +static const +CSN_DESCR_BEGIN(lu_ModeNeighbourCellParams_t) + M_TYPE (lu_ModeNeighbourCellParams_t, lu_ModeCellSelectionParameters, lu_ModeCellSelectionParams_t), + M_UINT (lu_ModeNeighbourCellParams_t, NR_OF_FREQUENCIES, 5), + M_VAR_TARRAY (lu_ModeNeighbourCellParams_t, lu_ModeCellSelectionParams, lu_ModeCellSelectionParams_t, NR_OF_FREQUENCIES), +CSN_DESCR_END (lu_ModeNeighbourCellParams_t) + +static const +CSN_DESCR_BEGIN(lu_ModeOnlyCellSelection_t) + M_UINT (lu_ModeOnlyCellSelection_t, CELL_BAR_QUALIFY_3, 2), + M_UINT (lu_ModeOnlyCellSelection_t, SAME_RA_AS_SERVING_CELL, 1), + + M_NEXT_EXIST (lu_ModeOnlyCellSelection_t, Exist_RXLEV_and_TXPWR, 2), + M_UINT (lu_ModeOnlyCellSelection_t, GPRS_RXLEV_ACCESS_MIN, 6), + M_UINT (lu_ModeOnlyCellSelection_t, GPRS_MS_TXPWR_MAX_CCH, 5), + + M_NEXT_EXIST (lu_ModeOnlyCellSelection_t, Exist_OFFSET_and_TIME, 2), + M_UINT (lu_ModeOnlyCellSelection_t, GPRS_TEMPORARY_OFFSET, 3), + M_UINT (lu_ModeOnlyCellSelection_t, GPRS_PENALTY_TIME, 5), + + M_NEXT_EXIST (lu_ModeOnlyCellSelection_t, Exist_GPRS_RESELECT_OFFSET, 1), + M_UINT (lu_ModeOnlyCellSelection_t, GPRS_RESELECT_OFFSET, 5), + + M_NEXT_EXIST (lu_ModeOnlyCellSelection_t, Exist_HCS, 1), + M_TYPE (lu_ModeOnlyCellSelection_t, HCS, HCS_t), + + M_NEXT_EXIST (lu_ModeOnlyCellSelection_t, Exist_SI13_Alt_PBCCH_Location, 1), + M_TYPE (lu_ModeOnlyCellSelection_t, SI13_Alt_PBCCH_Location, SI13_PBCCH_Location_t), +CSN_DESCR_END (lu_ModeOnlyCellSelection_t) + +static const +CSN_DESCR_BEGIN(lu_ModeOnlyCellSelectionParamsWithFreqDiff_t) + /*FREQUENCY_DIFF is really an integer but the number of bits to decode it are stored in FREQ_DIFF_LENGTH*/ + M_VAR_BITMAP (lu_ModeOnlyCellSelectionParamsWithFreqDiff_t, FREQUENCY_DIFF, FREQ_DIFF_LENGTH, 0), + M_UINT (lu_ModeOnlyCellSelectionParamsWithFreqDiff_t, BSIC, 6), + M_NEXT_EXIST (lu_ModeOnlyCellSelectionParamsWithFreqDiff_t, Exist_lu_ModeOnlyCellSelectionParams, 1), + M_TYPE (lu_ModeOnlyCellSelectionParamsWithFreqDiff_t, lu_ModeOnlyCellSelectionParams, lu_ModeOnlyCellSelection_t), +CSN_DESCR_END (lu_ModeOnlyCellSelectionParamsWithFreqDiff_t) + +static const +CSN_DESCR_BEGIN(Add_lu_ModeOnlyFrequencyList_t) + M_UINT (Add_lu_ModeOnlyFrequencyList_t, START_FREQUENCY, 10), + M_UINT (Add_lu_ModeOnlyFrequencyList_t, BSIC, 6), + + M_NEXT_EXIST (Add_lu_ModeOnlyFrequencyList_t, Exist_lu_ModeCellSelection, 1), + M_TYPE (Add_lu_ModeOnlyFrequencyList_t, lu_ModeOnlyCellSelection, lu_ModeOnlyCellSelection_t), + + M_UINT (Add_lu_ModeOnlyFrequencyList_t, NR_OF_FREQUENCIES, 5), + M_UINT (Add_lu_ModeOnlyFrequencyList_t, FREQ_DIFF_LENGTH, 3), + + M_VAR_TARRAY (Add_lu_ModeOnlyFrequencyList_t, lu_ModeOnlyCellSelectionParamsWithFreqDiff, lu_ModeOnlyCellSelectionParamsWithFreqDiff_t, NR_OF_FREQUENCIES), +CSN_DESCR_END (Add_lu_ModeOnlyFrequencyList_t) + +static const +CSN_DESCR_BEGIN(NC_lu_ModeOnlyCapableCellList_t) + M_REC_TARRAY (NC_lu_ModeOnlyCapableCellList_t, Add_lu_ModeOnlyFrequencyList, Add_lu_ModeOnlyFrequencyList_t, Count_Add_lu_ModeOnlyFrequencyList), +CSN_DESCR_END (NC_lu_ModeOnlyCapableCellList_t) + +static const +CSN_DESCR_BEGIN(GPRS_AdditionalMeasurementParams3G_t) + M_NEXT_EXIST (GPRS_AdditionalMeasurementParams3G_t, Exist_FDD_REPORTING_THRESHOLD_2, 1), + M_UINT (GPRS_AdditionalMeasurementParams3G_t, FDD_REPORTING_THRESHOLD_2, 6), +CSN_DESCR_END (GPRS_AdditionalMeasurementParams3G_t) + +static const +CSN_DESCR_BEGIN(ServingCellPriorityParametersDescription_t) + M_UINT (ServingCellPriorityParametersDescription_t, GERAN_PRIORITY, 3), + M_UINT (ServingCellPriorityParametersDescription_t, THRESH_Priority_Search, 4), + M_UINT (ServingCellPriorityParametersDescription_t, THRESH_GSM_low, 4), + M_UINT (ServingCellPriorityParametersDescription_t, H_PRIO, 2), + M_UINT (ServingCellPriorityParametersDescription_t, T_Reselection, 2), +CSN_DESCR_END (ServingCellPriorityParametersDescription_t) + +static const +CSN_DESCR_BEGIN(RepeatedUTRAN_PriorityParameters_t) + M_REC_ARRAY (RepeatedUTRAN_PriorityParameters_t, UTRAN_FREQUENCY_INDEX_a, NumberOfFrequencyIndexes, 5), + + M_NEXT_EXIST (RepeatedUTRAN_PriorityParameters_t, existUTRAN_PRIORITY, 1), + M_UINT (RepeatedUTRAN_PriorityParameters_t, UTRAN_PRIORITY, 3), + + M_UINT (RepeatedUTRAN_PriorityParameters_t, THRESH_UTRAN_high, 5), + + M_NEXT_EXIST (RepeatedUTRAN_PriorityParameters_t, existTHRESH_UTRAN_low, 1), + M_UINT (RepeatedUTRAN_PriorityParameters_t, THRESH_UTRAN_low, 5), + + M_NEXT_EXIST (RepeatedUTRAN_PriorityParameters_t, existUTRAN_QRXLEVMIN, 1), + M_UINT (RepeatedUTRAN_PriorityParameters_t, UTRAN_QRXLEVMIN, 5), +CSN_DESCR_END (RepeatedUTRAN_PriorityParameters_t) + +static const +CSN_DESCR_BEGIN(PriorityParametersDescription3G_PMO_t) + + M_NEXT_EXIST (PriorityParametersDescription3G_PMO_t, existDEFAULT_UTRAN_Parameters, 3), + M_UINT (PriorityParametersDescription3G_PMO_t, DEFAULT_UTRAN_PRIORITY, 3), + M_UINT (PriorityParametersDescription3G_PMO_t, DEFAULT_THRESH_UTRAN, 5), + M_UINT (PriorityParametersDescription3G_PMO_t, DEFAULT_UTRAN_QRXLEVMIN, 5), + + M_REC_TARRAY (PriorityParametersDescription3G_PMO_t, RepeatedUTRAN_PriorityParameters_a, RepeatedUTRAN_PriorityParameters_t, NumberOfPriorityParameters), +CSN_DESCR_END (PriorityParametersDescription3G_PMO_t) + +static const +CSN_DESCR_BEGIN(EUTRAN_REPORTING_THRESHOLD_OFFSET_t) + M_NEXT_EXIST (EUTRAN_REPORTING_THRESHOLD_OFFSET_t, existEUTRAN_FDD_REPORTING_THRESHOLD_OFFSET, 5), + M_UINT (EUTRAN_REPORTING_THRESHOLD_OFFSET_t, EUTRAN_FDD_REPORTING_THRESHOLD, 3), + M_NEXT_EXIST (EUTRAN_REPORTING_THRESHOLD_OFFSET_t, existEUTRAN_FDD_REPORTING_THRESHOLD_2, 1), + M_UINT (EUTRAN_REPORTING_THRESHOLD_OFFSET_t, EUTRAN_FDD_REPORTING_THRESHOLD_2, 6), + M_NEXT_EXIST (EUTRAN_REPORTING_THRESHOLD_OFFSET_t, existEUTRAN_FDD_REPORTING_OFFSET, 1), + M_UINT (EUTRAN_REPORTING_THRESHOLD_OFFSET_t, EUTRAN_FDD_REPORTING_OFFSET, 3), + + M_NEXT_EXIST (EUTRAN_REPORTING_THRESHOLD_OFFSET_t, existEUTRAN_TDD_REPORTING_THRESHOLD_OFFSET, 5), + M_UINT (EUTRAN_REPORTING_THRESHOLD_OFFSET_t, EUTRAN_TDD_REPORTING_THRESHOLD, 3), + M_NEXT_EXIST (EUTRAN_REPORTING_THRESHOLD_OFFSET_t, existEUTRAN_TDD_REPORTING_THRESHOLD_2, 1), + M_UINT (EUTRAN_REPORTING_THRESHOLD_OFFSET_t, EUTRAN_TDD_REPORTING_THRESHOLD_2, 6), + M_NEXT_EXIST (EUTRAN_REPORTING_THRESHOLD_OFFSET_t, existEUTRAN_TDD_REPORTING_OFFSET, 1), + M_UINT (EUTRAN_REPORTING_THRESHOLD_OFFSET_t, EUTRAN_TDD_REPORTING_OFFSET, 3), +CSN_DESCR_END (EUTRAN_REPORTING_THRESHOLD_OFFSET_t) + +static const +CSN_DESCR_BEGIN(GPRS_EUTRAN_MeasurementParametersDescription_t) + M_UINT (GPRS_EUTRAN_MeasurementParametersDescription_t, Qsearch_P_EUTRAN, 4), + M_BIT (GPRS_EUTRAN_MeasurementParametersDescription_t, EUTRAN_REP_QUANT), + M_UINT (GPRS_EUTRAN_MeasurementParametersDescription_t, EUTRAN_MULTIRAT_REPORTING, 2), + M_TYPE (GPRS_EUTRAN_MeasurementParametersDescription_t, EUTRAN_REPORTING_THRESHOLD_OFFSET, EUTRAN_REPORTING_THRESHOLD_OFFSET_t), +CSN_DESCR_END (GPRS_EUTRAN_MeasurementParametersDescription_t) + +static const +CSN_DESCR_BEGIN(RepeatedEUTRAN_Cells_t) + M_UINT (RepeatedEUTRAN_Cells_t, EARFCN, 16), + M_NEXT_EXIST (RepeatedEUTRAN_Cells_t, existMeasurementBandwidth, 1), + M_UINT (RepeatedEUTRAN_Cells_t, MeasurementBandwidth, 3), +CSN_DESCR_END (RepeatedEUTRAN_Cells_t) + +static const +CSN_DESCR_BEGIN(RepeatedEUTRAN_NeighbourCells_t) + M_REC_TARRAY (RepeatedEUTRAN_NeighbourCells_t, EUTRAN_Cells_a, RepeatedEUTRAN_Cells_t, nbrOfEUTRAN_Cells), + + M_NEXT_EXIST (RepeatedEUTRAN_NeighbourCells_t, existEUTRAN_PRIORITY, 1), + M_UINT (RepeatedEUTRAN_NeighbourCells_t, EUTRAN_PRIORITY, 3), + + M_UINT (RepeatedEUTRAN_NeighbourCells_t, THRESH_EUTRAN_high, 5), + + M_NEXT_EXIST (RepeatedEUTRAN_NeighbourCells_t, existTHRESH_EUTRAN_low, 1), + M_UINT (RepeatedEUTRAN_NeighbourCells_t, THRESH_EUTRAN_low, 5), + + M_NEXT_EXIST (RepeatedEUTRAN_NeighbourCells_t, existEUTRAN_QRXLEVMIN, 1), + M_UINT (RepeatedEUTRAN_NeighbourCells_t, EUTRAN_QRXLEVMIN, 5), +CSN_DESCR_END (RepeatedEUTRAN_NeighbourCells_t) + +static const +CSN_DESCR_BEGIN(PCID_Pattern_t) + M_UINT (PCID_Pattern_t, PCID_Pattern_length, 3), + M_VAR_BITMAP (PCID_Pattern_t, PCID_Pattern, PCID_Pattern_length, 1), /* offset 1, 44.060 12.57 */ + M_UINT (PCID_Pattern_t, PCID_Pattern_sense, 1), +CSN_DESCR_END (PCID_Pattern_t) + +static const +CSN_DESCR_BEGIN(PCID_Group_IE_t) + + M_REC_ARRAY (PCID_Group_IE_t, PCID_a, NumberOfPCIDs, 9), + + M_NEXT_EXIST (PCID_Group_IE_t, existPCID_BITMAP_GROUP, 1), + M_UINT (PCID_Group_IE_t, PCID_BITMAP_GROUP, 6), + + M_REC_TARRAY (PCID_Group_IE_t, PCID_Pattern_a, PCID_Pattern_t, NumberOfPCID_Patterns), +CSN_DESCR_END (PCID_Group_IE_t) + +static const +CSN_DESCR_BEGIN(EUTRAN_FREQUENCY_INDEX_t) + M_UINT (EUTRAN_FREQUENCY_INDEX_t, EUTRAN_FREQUENCY_INDEX, 3), +CSN_DESCR_END (EUTRAN_FREQUENCY_INDEX_t) + +static const +CSN_DESCR_BEGIN(RepeatedEUTRAN_NotAllowedCells_t) + M_TYPE (RepeatedEUTRAN_NotAllowedCells_t, NotAllowedCells, PCID_Group_IE_t), + + M_REC_TARRAY (RepeatedEUTRAN_NotAllowedCells_t, EUTRAN_FREQUENCY_INDEX_a, EUTRAN_FREQUENCY_INDEX_t, NumberOfFrequencyIndexes), +CSN_DESCR_END (RepeatedEUTRAN_NotAllowedCells_t) + +static const +CSN_DESCR_BEGIN(RepeatedEUTRAN_PCID_to_TA_mapping_t) + M_REC_TARRAY (RepeatedEUTRAN_PCID_to_TA_mapping_t, PCID_ToTA_Mapping_a, PCID_Group_IE_t, NumberOfMappings), + M_REC_TARRAY (RepeatedEUTRAN_PCID_to_TA_mapping_t, EUTRAN_FREQUENCY_INDEX_a, EUTRAN_FREQUENCY_INDEX_t, NumberOfFrequencyIndexes), +CSN_DESCR_END (RepeatedEUTRAN_PCID_to_TA_mapping_t) + +static const +CSN_DESCR_BEGIN(EUTRAN_ParametersDescription_PMO_t) + M_BIT (EUTRAN_ParametersDescription_PMO_t, EUTRAN_CCN_ACTIVE), + + M_NEXT_EXIST (EUTRAN_ParametersDescription_PMO_t, existGPRS_EUTRAN_MeasurementParametersDescription, 1), + M_TYPE (EUTRAN_ParametersDescription_PMO_t, GPRS_EUTRAN_MeasurementParametersDescription, GPRS_EUTRAN_MeasurementParametersDescription_t), + + M_REC_TARRAY (EUTRAN_ParametersDescription_PMO_t, RepeatedEUTRAN_NeighbourCells_a, RepeatedEUTRAN_NeighbourCells_t, nbrOfRepeatedEUTRAN_NeighbourCellsStructs), + M_REC_TARRAY (EUTRAN_ParametersDescription_PMO_t, RepeatedEUTRAN_NotAllowedCells_a, RepeatedEUTRAN_NotAllowedCells_t, NumberOfNotAllowedCells), + M_REC_TARRAY (EUTRAN_ParametersDescription_PMO_t, RepeatedEUTRAN_PCID_to_TA_mapping_a, RepeatedEUTRAN_PCID_to_TA_mapping_t, NumberOfMappings), +CSN_DESCR_END (EUTRAN_ParametersDescription_PMO_t) + +static const +CSN_DESCR_BEGIN(PSC_Pattern_t) + M_UINT (PSC_Pattern_t, PSC_Pattern_length, 3), + M_VAR_BITMAP (PSC_Pattern_t, PSC_Pattern, PSC_Pattern_length, 1), + M_BIT (PSC_Pattern_t, PSC_Pattern_sense), +CSN_DESCR_END (PSC_Pattern_t) + +static const +CSN_DESCR_BEGIN(PSC_Group_t) + M_REC_ARRAY (PSC_Group_t, PSC, PSC_Count, 9), + M_REC_TARRAY (PSC_Group_t, PSC_Pattern, PSC_Pattern_t, PSC_Pattern_Count), +CSN_DESCR_END (PSC_Group_t) + +static const +CSN_DESCR_BEGIN(ThreeG_CSG_Description_Body_t) + M_TYPE (ThreeG_CSG_Description_Body_t, CSG_PSC_SPLIT, PSC_Group_t), + M_REC_ARRAY (ThreeG_CSG_Description_Body_t, UTRAN_FREQUENCY_INDEX, Count, 5), +CSN_DESCR_END (ThreeG_CSG_Description_Body_t) + +static const +CSN_DESCR_BEGIN(ThreeG_CSG_Description_t) + M_REC_TARRAY (ThreeG_CSG_Description_t, ThreeG_CSG_Description_Body, ThreeG_CSG_Description_Body_t, Count), +CSN_DESCR_END (ThreeG_CSG_Description_t) + +static const +CSN_DESCR_BEGIN(EUTRAN_CSG_Description_Body_t) + M_TYPE (EUTRAN_CSG_Description_Body_t, CSG_PCI_SPLIT, PSC_Group_t), + M_REC_ARRAY (EUTRAN_CSG_Description_Body_t, EUTRAN_FREQUENCY_INDEX, Count, 3), +CSN_DESCR_END (EUTRAN_CSG_Description_Body_t) + +static const +CSN_DESCR_BEGIN(EUTRAN_CSG_Description_t) + M_REC_TARRAY (EUTRAN_CSG_Description_t, EUTRAN_CSG_Description_Body, EUTRAN_CSG_Description_Body_t, Count), +CSN_DESCR_END (EUTRAN_CSG_Description_t) + +static const +CSN_DESCR_BEGIN(Meas_Ctrl_Param_Desp_t) + M_NEXT_EXIST (Meas_Ctrl_Param_Desp_t, existMeasurement_Control_EUTRAN, 3), + M_BIT (Meas_Ctrl_Param_Desp_t, Measurement_Control_EUTRAN), + M_UINT (Meas_Ctrl_Param_Desp_t, EUTRAN_FREQUENCY_INDEX_top, 3), + M_REC_ARRAY (Meas_Ctrl_Param_Desp_t, EUTRAN_FREQUENCY_INDEX, Count_EUTRAN_FREQUENCY_INDEX, 3), + M_NEXT_EXIST (Meas_Ctrl_Param_Desp_t, existMeasurement_Control_UTRAN, 1), + M_BIT (Meas_Ctrl_Param_Desp_t, Measurement_Control_UTRAN), + M_UINT (Meas_Ctrl_Param_Desp_t, UTRAN_FREQUENCY_INDEX_top, 5), + M_REC_ARRAY (Meas_Ctrl_Param_Desp_t, UTRAN_FREQUENCY_INDEX, Count_UTRAN_FREQUENCY_INDEX, 5), +CSN_DESCR_END (Meas_Ctrl_Param_Desp_t) + +static const +CSN_DESCR_BEGIN(Reselection_Based_On_RSRQ_t) + M_UINT (Reselection_Based_On_RSRQ_t, THRESH_EUTRAN_high_Q, 5), + M_NEXT_EXIST (Reselection_Based_On_RSRQ_t, existTHRESH_EUTRAN_low_Q, 1), + M_UINT (Reselection_Based_On_RSRQ_t, THRESH_EUTRAN_low_Q, 5), + M_NEXT_EXIST (Reselection_Based_On_RSRQ_t, existEUTRAN_QQUALMIN, 1), + M_UINT (Reselection_Based_On_RSRQ_t, EUTRAN_QQUALMIN, 4), + M_NEXT_EXIST (Reselection_Based_On_RSRQ_t, existEUTRAN_RSRPmin, 1), + M_UINT (Reselection_Based_On_RSRQ_t, EUTRAN_RSRPmin, 5), +CSN_DESCR_END (Reselection_Based_On_RSRQ_t) + +static const +CSN_DESCR_BEGIN(Rept_EUTRAN_Enh_Cell_Resel_Param_t) + M_REC_ARRAY (Rept_EUTRAN_Enh_Cell_Resel_Param_t, EUTRAN_FREQUENCY_INDEX, Count_EUTRAN_FREQUENCY_INDEX, 3), + M_UNION (Rept_EUTRAN_Enh_Cell_Resel_Param_t, 2), + M_UINT (Rept_EUTRAN_Enh_Cell_Resel_Param_t, u.EUTRAN_Qmin, 4), + M_TYPE (Rept_EUTRAN_Enh_Cell_Resel_Param_t, u.Reselection_Based_On_RSRQ, Reselection_Based_On_RSRQ_t), +CSN_DESCR_END (Rept_EUTRAN_Enh_Cell_Resel_Param_t) + +static const +CSN_DESCR_BEGIN(Enh_Cell_Reselect_Param_Desp_t) + M_REC_TARRAY (Enh_Cell_Reselect_Param_Desp_t, Repeated_EUTRAN_Enhanced_Cell_Reselection_Parameters, Rept_EUTRAN_Enh_Cell_Resel_Param_t, Count), +CSN_DESCR_END (Enh_Cell_Reselect_Param_Desp_t) + +static const +CSN_DESCR_BEGIN(UTRAN_CSG_Cells_Reporting_Desp_t) + M_NEXT_EXIST (UTRAN_CSG_Cells_Reporting_Desp_t, existUTRAN_CSG_FDD_REPORTING_THRESHOLD, 2), + M_UINT (UTRAN_CSG_Cells_Reporting_Desp_t, UTRAN_CSG_FDD_REPORTING_THRESHOLD, 3), + M_UINT (UTRAN_CSG_Cells_Reporting_Desp_t, UTRAN_CSG_FDD_REPORTING_THRESHOLD_2, 6), + M_NEXT_EXIST (UTRAN_CSG_Cells_Reporting_Desp_t, existUTRAN_CSG_TDD_REPORTING_THRESHOLD, 1), + M_UINT (UTRAN_CSG_Cells_Reporting_Desp_t, UTRAN_CSG_TDD_REPORTING_THRESHOLD, 3), +CSN_DESCR_END (UTRAN_CSG_Cells_Reporting_Desp_t) + +static const +CSN_DESCR_BEGIN(EUTRAN_CSG_Cells_Reporting_Desp_t) + M_NEXT_EXIST (EUTRAN_CSG_Cells_Reporting_Desp_t, existEUTRAN_CSG_FDD_REPORTING_THRESHOLD, 2), + M_UINT (EUTRAN_CSG_Cells_Reporting_Desp_t, EUTRAN_CSG_FDD_REPORTING_THRESHOLD, 3), + M_UINT (EUTRAN_CSG_Cells_Reporting_Desp_t, EUTRAN_CSG_FDD_REPORTING_THRESHOLD_2, 6), + M_NEXT_EXIST (EUTRAN_CSG_Cells_Reporting_Desp_t, existEUTRAN_CSG_TDD_REPORTING_THRESHOLD, 2), + M_UINT (EUTRAN_CSG_Cells_Reporting_Desp_t, EUTRAN_CSG_TDD_REPORTING_THRESHOLD, 3), + M_UINT (EUTRAN_CSG_Cells_Reporting_Desp_t, EUTRAN_CSG_TDD_REPORTING_THRESHOLD_2, 6), +CSN_DESCR_END (EUTRAN_CSG_Cells_Reporting_Desp_t) + + +static const +CSN_DESCR_BEGIN(CSG_Cells_Reporting_Desp_t) + M_NEXT_EXIST (CSG_Cells_Reporting_Desp_t, existUTRAN_CSG_Cells_Reporting_Description, 1), + M_TYPE (CSG_Cells_Reporting_Desp_t, UTRAN_CSG_Cells_Reporting_Description, UTRAN_CSG_Cells_Reporting_Desp_t), + M_NEXT_EXIST (CSG_Cells_Reporting_Desp_t, existEUTRAN_CSG_Cells_Reporting_Description, 1), + M_TYPE (CSG_Cells_Reporting_Desp_t, EUTRAN_CSG_Cells_Reporting_Description, EUTRAN_CSG_Cells_Reporting_Desp_t), +CSN_DESCR_END (CSG_Cells_Reporting_Desp_t) + +static const +CSN_DESCR_BEGIN (PriorityAndEUTRAN_ParametersDescription_PMO_t) + M_NEXT_EXIST (PriorityAndEUTRAN_ParametersDescription_PMO_t, existServingCellPriorityParametersDescription, 1), + M_TYPE (PriorityAndEUTRAN_ParametersDescription_PMO_t, ServingCellPriorityParametersDescription, ServingCellPriorityParametersDescription_t), + M_NEXT_EXIST (PriorityAndEUTRAN_ParametersDescription_PMO_t, existPriorityParametersDescription3G_PMO, 1), + M_TYPE (PriorityAndEUTRAN_ParametersDescription_PMO_t, PriorityParametersDescription3G_PMO, PriorityParametersDescription3G_PMO_t), + M_NEXT_EXIST (PriorityAndEUTRAN_ParametersDescription_PMO_t, existEUTRAN_ParametersDescription_PMO, 1), + M_TYPE (PriorityAndEUTRAN_ParametersDescription_PMO_t, EUTRAN_ParametersDescription_PMO, EUTRAN_ParametersDescription_PMO_t), +CSN_DESCR_END (PriorityAndEUTRAN_ParametersDescription_PMO_t) + + +static const +CSN_DESCR_BEGIN (Delete_All_Stored_Individual_Priorities_t) + M_NULL (Delete_All_Stored_Individual_Priorities_t, dummy), +CSN_DESCR_END (Delete_All_Stored_Individual_Priorities_t) + +static const +CSN_DESCR_BEGIN (Individual_UTRAN_Priority_FDD_t) + M_REC_ARRAY (Individual_UTRAN_Priority_FDD_t, FDD_ARFCN, Count, 14), +CSN_DESCR_END (Individual_UTRAN_Priority_FDD_t) + +static const +CSN_DESCR_BEGIN (Individual_UTRAN_Priority_TDD_t) + M_REC_ARRAY (Individual_UTRAN_Priority_TDD_t, TDD_ARFCN, Count, 14), +CSN_DESCR_END (Individual_UTRAN_Priority_TDD_t) + +static const +CSN_DESCR_BEGIN (Repeated_Individual_UTRAN_Priority_Parameters_t) + M_UNION (Repeated_Individual_UTRAN_Priority_Parameters_t, 2), + M_TYPE (Repeated_Individual_UTRAN_Priority_Parameters_t, u.Individual_UTRAN_Priority_FDD, Individual_UTRAN_Priority_FDD_t), + M_TYPE (Repeated_Individual_UTRAN_Priority_Parameters_t, u.Individual_UTRAN_Priority_TDD, Individual_UTRAN_Priority_TDD_t), + M_UINT (Repeated_Individual_UTRAN_Priority_Parameters_t, UTRAN_PRIORITY, 3), +CSN_DESCR_END (Repeated_Individual_UTRAN_Priority_Parameters_t) + +static const +CSN_DESCR_BEGIN (ThreeG_Individual_Priority_Parameters_Description_t) + M_NEXT_EXIST (ThreeG_Individual_Priority_Parameters_Description_t, Exist_DEFAULT_UTRAN_PRIORITY, 1), + M_UINT (ThreeG_Individual_Priority_Parameters_Description_t, DEFAULT_UTRAN_PRIORITY, 3), + M_REC_TARRAY (ThreeG_Individual_Priority_Parameters_Description_t, Repeated_Individual_UTRAN_Priority_Parameters, Repeated_Individual_UTRAN_Priority_Parameters_t, Repeated_Individual_UTRAN_Priority_Parameters_Count), +CSN_DESCR_END (ThreeG_Individual_Priority_Parameters_Description_t) + +static const +CSN_DESCR_BEGIN (Repeated_Individual_EUTRAN_Priority_Parameters_t) + M_REC_ARRAY (Repeated_Individual_EUTRAN_Priority_Parameters_t, EARFCN, Count, 16), + M_UINT (Repeated_Individual_EUTRAN_Priority_Parameters_t, EUTRAN_PRIORITY, 3), +CSN_DESCR_END (Repeated_Individual_EUTRAN_Priority_Parameters_t) + +static const +CSN_DESCR_BEGIN (EUTRAN_Individual_Priority_Parameters_Description_t) + M_NEXT_EXIST (EUTRAN_Individual_Priority_Parameters_Description_t, Exist_DEFAULT_EUTRAN_PRIORITY, 1), + M_UINT (EUTRAN_Individual_Priority_Parameters_Description_t, DEFAULT_EUTRAN_PRIORITY, 3), + M_REC_TARRAY (EUTRAN_Individual_Priority_Parameters_Description_t, Repeated_Individual_EUTRAN_Priority_Parameters, Repeated_Individual_EUTRAN_Priority_Parameters_t, Count), +CSN_DESCR_END (EUTRAN_Individual_Priority_Parameters_Description_t) + +static const +CSN_DESCR_BEGIN (Provide_Individual_Priorities_t) + M_UINT (Provide_Individual_Priorities_t, GERAN_PRIORITY, 3), + M_NEXT_EXIST (Provide_Individual_Priorities_t, Exist_3G_Individual_Priority_Parameters_Description, 1), + M_TYPE (Provide_Individual_Priorities_t, ThreeG_Individual_Priority_Parameters_Description, ThreeG_Individual_Priority_Parameters_Description_t), + M_NEXT_EXIST (Provide_Individual_Priorities_t, Exist_EUTRAN_Individual_Priority_Parameters_Description, 1), + M_TYPE (Provide_Individual_Priorities_t, EUTRAN_Individual_Priority_Parameters_Description, EUTRAN_Individual_Priority_Parameters_Description_t), + M_NEXT_EXIST (Provide_Individual_Priorities_t, Exist_T3230_timeout_value, 1), + M_UINT (Provide_Individual_Priorities_t, T3230_timeout_value, 3), +CSN_DESCR_END (Provide_Individual_Priorities_t) + +static const +CSN_DESCR_BEGIN (Individual_Priorities_t) + M_UNION (Individual_Priorities_t, 2), + M_TYPE (Individual_Priorities_t, u.Delete_All_Stored_Individual_Priorities, Delete_All_Stored_Individual_Priorities_t), + M_TYPE (Individual_Priorities_t, u.Provide_Individual_Priorities, Provide_Individual_Priorities_t), +CSN_DESCR_END (Individual_Priorities_t) + +static const +CSN_DESCR_BEGIN (PMO_AdditionsR9_t) + M_NEXT_EXIST (PMO_AdditionsR9_t, existEnhanced_Cell_Reselection_Parameters_Description, 1), + M_TYPE (PMO_AdditionsR9_t, Enhanced_Cell_Reselection_Parameters_Description, Enh_Cell_Reselect_Param_Desp_t), + M_NEXT_EXIST (PMO_AdditionsR9_t, existCSG_Cells_Reporting_Description, 1), + M_TYPE (PMO_AdditionsR9_t, CSG_Cells_Reporting_Description, CSG_Cells_Reporting_Desp_t), +CSN_DESCR_END (PMO_AdditionsR9_t) + +static const +CSN_DESCR_BEGIN (PMO_AdditionsR8_t) + M_NEXT_EXIST (PMO_AdditionsR8_t, existBA_IND_3G_PMO_IND, 2), + M_BIT (PMO_AdditionsR8_t, BA_IND_3G), + M_BIT (PMO_AdditionsR8_t, PMO_IND), + M_NEXT_EXIST (PMO_AdditionsR8_t, existPriorityAndEUTRAN_ParametersDescription_PMO, 1), + M_TYPE (PMO_AdditionsR8_t, PriorityAndEUTRAN_ParametersDescription_PMO, PriorityAndEUTRAN_ParametersDescription_PMO_t), + M_NEXT_EXIST (PMO_AdditionsR8_t, existIndividualPriorities_PMO, 1), + M_TYPE (PMO_AdditionsR8_t, IndividualPriorities_PMO, Individual_Priorities_t), + M_NEXT_EXIST (PMO_AdditionsR8_t, existThreeG_CSG_Description, 1), + M_TYPE (PMO_AdditionsR8_t, ThreeG_CSG_Description_PMO, ThreeG_CSG_Description_t), + M_NEXT_EXIST (PMO_AdditionsR8_t, existEUTRAN_CSG_Description, 1), + M_TYPE (PMO_AdditionsR8_t, EUTRAN_CSG_Description_PMO, EUTRAN_CSG_Description_t), + M_NEXT_EXIST (PMO_AdditionsR8_t, existMeasurement_Control_Parameters_Description, 1), + M_TYPE (PMO_AdditionsR8_t, Measurement_Control_Parameters_Description_PMO, Meas_Ctrl_Param_Desp_t), + M_NEXT_EXIST_OR_NULL (PMO_AdditionsR8_t, existAdditionsR9, 1), + M_TYPE (PMO_AdditionsR8_t, AdditionsR9, PMO_AdditionsR9_t), +CSN_DESCR_END (PMO_AdditionsR8_t) + +static const +CSN_DESCR_BEGIN (PMO_AdditionsR7_t) + M_NEXT_EXIST (PMO_AdditionsR7_t, existREPORTING_OFFSET_THRESHOLD_700, 2), + M_UINT (PMO_AdditionsR7_t, REPORTING_OFFSET_700, 3), + M_UINT (PMO_AdditionsR7_t, REPORTING_THRESHOLD_700, 3), + + M_NEXT_EXIST (PMO_AdditionsR7_t, existREPORTING_OFFSET_THRESHOLD_810, 2), + M_UINT (PMO_AdditionsR7_t, REPORTING_OFFSET_810, 3), + M_UINT (PMO_AdditionsR7_t, REPORTING_THRESHOLD_810, 3), + + M_NEXT_EXIST_OR_NULL (PMO_AdditionsR7_t, existAdditionsR8, 1), + M_TYPE (PMO_AdditionsR7_t, additionsR8, PMO_AdditionsR8_t), +CSN_DESCR_END (PMO_AdditionsR7_t) + +static const +CSN_DESCR_BEGIN (PMO_AdditionsR6_t) + M_UINT (PMO_AdditionsR6_t, CCN_ACTIVE_3G, 1), + M_NEXT_EXIST_OR_NULL (PMO_AdditionsR6_t, existAdditionsR7, 1), + M_TYPE (PMO_AdditionsR6_t, additionsR7, PMO_AdditionsR7_t), +CSN_DESCR_END (PMO_AdditionsR6_t) + +static const +CSN_DESCR_BEGIN(PCCO_AdditionsR6_t) + M_UINT (PCCO_AdditionsR6_t, CCN_ACTIVE_3G, 1), +CSN_DESCR_END (PCCO_AdditionsR6_t) + +static const +CSN_DESCR_BEGIN (PMO_AdditionsR5_t) + M_NEXT_EXIST (PMO_AdditionsR5_t, existGRNTI_Extension, 1), + M_UINT (PMO_AdditionsR5_t, GRNTI, 4), + M_NEXT_EXIST (PMO_AdditionsR5_t, exist_lu_ModeNeighbourCellParams, 1), + M_REC_TARRAY (PMO_AdditionsR5_t, lu_ModeNeighbourCellParams, lu_ModeNeighbourCellParams_t, count_lu_ModeNeighbourCellParams), + M_NEXT_EXIST (PMO_AdditionsR5_t, existNC_lu_ModeOnlyCapableCellList, 1), + M_TYPE (PMO_AdditionsR5_t, NC_lu_ModeOnlyCapableCellList, NC_lu_ModeOnlyCapableCellList_t), + M_NEXT_EXIST (PMO_AdditionsR5_t, existGPRS_AdditionalMeasurementParams3G, 1), + M_TYPE (PMO_AdditionsR5_t, GPRS_AdditionalMeasurementParams3G, GPRS_AdditionalMeasurementParams3G_t), + M_NEXT_EXIST_OR_NULL (PMO_AdditionsR5_t, existAdditionsR6, 1), + M_TYPE (PMO_AdditionsR5_t, additionsR6, PMO_AdditionsR6_t), +CSN_DESCR_END (PMO_AdditionsR5_t) + +static const +CSN_DESCR_BEGIN (PCCO_AdditionsR5_t) + M_NEXT_EXIST (PCCO_AdditionsR5_t, existGRNTI_Extension, 1), + M_UINT (PCCO_AdditionsR5_t, GRNTI, 4), + M_NEXT_EXIST (PCCO_AdditionsR5_t, exist_lu_ModeNeighbourCellParams, 1), + M_REC_TARRAY (PCCO_AdditionsR5_t, lu_ModeNeighbourCellParams, lu_ModeNeighbourCellParams_t, count_lu_ModeNeighbourCellParams), + M_NEXT_EXIST (PCCO_AdditionsR5_t, existNC_lu_ModeOnlyCapableCellList, 1), + M_TYPE (PCCO_AdditionsR5_t, NC_lu_ModeOnlyCapableCellList, NC_lu_ModeOnlyCapableCellList_t), + M_NEXT_EXIST (PCCO_AdditionsR5_t, existGPRS_AdditionalMeasurementParams3G, 1), + M_TYPE (PCCO_AdditionsR5_t, GPRS_AdditionalMeasurementParams3G, GPRS_AdditionalMeasurementParams3G_t), + M_NEXT_EXIST_OR_NULL (PCCO_AdditionsR5_t, existAdditionsR6, 1), + M_TYPE (PCCO_AdditionsR5_t, additionsR6, PCCO_AdditionsR6_t), +CSN_DESCR_END (PCCO_AdditionsR5_t) + +static const +CSN_DESCR_BEGIN (PMO_AdditionsR4_t) + M_UINT (PMO_AdditionsR4_t, CCN_ACTIVE, 1), + M_NEXT_EXIST (PMO_AdditionsR4_t, Exist_CCN_Support_Description_ID, 1), + M_TYPE (PMO_AdditionsR4_t, CCN_Support_Description, CCN_Support_Description_t), + M_NEXT_EXIST_OR_NULL (PMO_AdditionsR4_t, Exist_AdditionsR5, 1), + M_TYPE (PMO_AdditionsR4_t, AdditionsR5, PMO_AdditionsR5_t), +CSN_DESCR_END (PMO_AdditionsR4_t) + +static const +CSN_DESCR_BEGIN (PMO_AdditionsR99_t) + M_NEXT_EXIST (PMO_AdditionsR99_t, Exist_ENH_Measurement_Parameters, 1), + M_TYPE (PMO_AdditionsR99_t, ENH_Measurement_Parameters, ENH_Measurement_Parameters_PMO_t), + M_NEXT_EXIST_OR_NULL (PMO_AdditionsR99_t, Exist_AdditionsR4, 1), + M_TYPE (PMO_AdditionsR99_t, AdditionsR4, PMO_AdditionsR4_t), +CSN_DESCR_END (PMO_AdditionsR99_t) + +static const +CSN_DESCR_BEGIN (PCCO_AdditionsR4_t) + M_UINT (PCCO_AdditionsR4_t, CCN_ACTIVE, 1), + M_NEXT_EXIST (PCCO_AdditionsR4_t, Exist_Container_ID, 1), + M_UINT (PCCO_AdditionsR4_t, CONTAINER_ID, 2), + M_NEXT_EXIST (PCCO_AdditionsR4_t, Exist_CCN_Support_Description_ID, 1), + M_TYPE (PCCO_AdditionsR4_t, CCN_Support_Description, CCN_Support_Description_t), + M_NEXT_EXIST_OR_NULL (PCCO_AdditionsR4_t, Exist_AdditionsR5, 1), + M_TYPE (PCCO_AdditionsR4_t, AdditionsR5, PCCO_AdditionsR5_t), +CSN_DESCR_END (PCCO_AdditionsR4_t) + +static const +CSN_DESCR_BEGIN (PCCO_AdditionsR99_t) + M_TYPE (PCCO_AdditionsR99_t, ENH_Measurement_Parameters, ENH_Measurement_Parameters_PCCO_t), + M_NEXT_EXIST_OR_NULL (PCCO_AdditionsR99_t, Exist_AdditionsR4, 1), + M_TYPE (PCCO_AdditionsR99_t, AdditionsR4, PCCO_AdditionsR4_t), +CSN_DESCR_END (PCCO_AdditionsR99_t) + +static const +CSN_DESCR_BEGIN(LSA_ID_Info_Element_t) + M_UNION (LSA_ID_Info_Element_t, 2), + M_UINT (LSA_ID_Info_Element_t, u.LSA_ID, 24), + M_UINT (LSA_ID_Info_Element_t, u.ShortLSA_ID, 10), +CSN_DESCR_END (LSA_ID_Info_Element_t) + +static const +CSN_DESCR_BEGIN(LSA_ID_Info_t) + M_REC_TARRAY (LSA_ID_Info_t, LSA_ID_Info_Elements, LSA_ID_Info_Element_t, Count_LSA_ID_Info_Element), +CSN_DESCR_END (LSA_ID_Info_t) + +static const +CSN_DESCR_BEGIN(LSA_Parameters_t) + M_UINT (LSA_Parameters_t, NR_OF_FREQ_OR_CELLS, 5), + M_VAR_TARRAY (LSA_Parameters_t, LSA_ID_Info, LSA_ID_Info_t, NR_OF_FREQ_OR_CELLS), +CSN_DESCR_END (LSA_Parameters_t) + +static const +CSN_DESCR_BEGIN (PMO_AdditionsR98_t) + M_NEXT_EXIST (PMO_AdditionsR98_t, Exist_LSA_Parameters, 1), + M_TYPE (PMO_AdditionsR98_t, LSA_Parameters, LSA_Parameters_t), + + M_NEXT_EXIST_OR_NULL (PMO_AdditionsR98_t, Exist_AdditionsR99, 1), + M_TYPE (PMO_AdditionsR98_t, AdditionsR99, PMO_AdditionsR99_t), +CSN_DESCR_END (PMO_AdditionsR98_t) + +static const +CSN_DESCR_BEGIN (PCCO_AdditionsR98_t) + M_NEXT_EXIST (PCCO_AdditionsR98_t, Exist_LSA_Parameters, 1), + M_TYPE (PCCO_AdditionsR98_t, LSA_Parameters, LSA_Parameters_t), + + M_NEXT_EXIST_OR_NULL (PCCO_AdditionsR98_t, Exist_AdditionsR99, 1), + M_TYPE (PCCO_AdditionsR98_t, AdditionsR99, PCCO_AdditionsR99_t), +CSN_DESCR_END (PCCO_AdditionsR98_t) + +static const +CSN_DESCR_BEGIN (Target_Cell_GSM_t) + M_UINT (Target_Cell_GSM_t, IMMEDIATE_REL, 1), + M_UINT (Target_Cell_GSM_t, ARFCN, 10), + M_UINT (Target_Cell_GSM_t, BSIC, 6), + M_TYPE (Target_Cell_GSM_t, NC_Measurement_Parameters, NC_Measurement_Parameters_with_Frequency_List_t), + M_NEXT_EXIST_OR_NULL (Target_Cell_GSM_t, Exist_AdditionsR98, 1), + M_TYPE (Target_Cell_GSM_t, AdditionsR98, PCCO_AdditionsR98_t), +CSN_DESCR_END (Target_Cell_GSM_t) + +static const +CSN_DESCR_BEGIN (Target_Cell_3G_AdditionsR8_t) + M_NEXT_EXIST (Target_Cell_3G_AdditionsR8_t, Exist_EUTRAN_Target_Cell, 1), + M_TYPE (Target_Cell_3G_AdditionsR8_t, EUTRAN_Target_Cell, EUTRAN_Target_Cell_t), + M_NEXT_EXIST (Target_Cell_3G_AdditionsR8_t, Exist_Individual_Priorities, 1), + M_TYPE (Target_Cell_3G_AdditionsR8_t, Individual_Priorities, Individual_Priorities_t), +CSN_DESCR_END (Target_Cell_3G_AdditionsR8_t) + +static const +CSN_DESCR_BEGIN (Target_Cell_3G_AdditionsR5_t) + M_NEXT_EXIST (Target_Cell_3G_AdditionsR5_t, Exist_G_RNTI_Extention, 1), + M_UINT (Target_Cell_3G_AdditionsR5_t, G_RNTI_Extention, 4), + M_NEXT_EXIST_OR_NULL (Target_Cell_3G_AdditionsR5_t, Exist_AdditionsR8, 1), + M_TYPE (Target_Cell_3G_AdditionsR5_t, AdditionsR8, Target_Cell_3G_AdditionsR8_t), +CSN_DESCR_END (Target_Cell_3G_AdditionsR5_t) + +static const +CSN_DESCR_BEGIN(Target_Cell_3G_t) + /* 00 -- Message escape */ + M_FIXED (Target_Cell_3G_t, 2, 0x00), + M_UINT (Target_Cell_3G_t, IMMEDIATE_REL, 1), + M_NEXT_EXIST (Target_Cell_3G_t, Exist_FDD_Description, 1), + M_TYPE (Target_Cell_3G_t, FDD_Target_Cell, FDD_Target_Cell_t), + M_NEXT_EXIST (Target_Cell_3G_t, Exist_TDD_Description, 1), + M_TYPE (Target_Cell_3G_t, TDD_Target_Cell, TDD_Target_Cell_t), + M_NEXT_EXIST_OR_NULL (Target_Cell_3G_t, Exist_AdditionsR5, 1), + M_TYPE (Target_Cell_3G_t, AdditionsR5, Target_Cell_3G_AdditionsR5_t), +CSN_DESCR_END (Target_Cell_3G_t) + +static const +CSN_DESCR_BEGIN(Packet_Cell_Change_Order_t) + M_UINT (Packet_Cell_Change_Order_t, MESSAGE_TYPE, 6), + M_UINT (Packet_Cell_Change_Order_t, PAGE_MODE, 2), + + M_TYPE (Packet_Cell_Change_Order_t, ID, PacketCellChangeOrderID_t), + + M_UNION (Packet_Cell_Change_Order_t, 2), + M_TYPE (Packet_Cell_Change_Order_t, u.Target_Cell_GSM, Target_Cell_GSM_t), + M_TYPE (Packet_Cell_Change_Order_t, u.Target_Cell_3G, Target_Cell_3G_t), +CSN_DESCR_END (Packet_Cell_Change_Order_t) + +/*< Packet (Enhanced) Measurement Report message contents > */ +static const +CSN_DESCR_BEGIN(BA_USED_t) + M_UINT (BA_USED_t, BA_USED, 1), + M_UINT (BA_USED_t, BA_USED_3G, 1), +CSN_DESCR_END (BA_USED_t) + +static const +CSN_DESCR_BEGIN(Serving_Cell_Data_t) + M_UINT (Serving_Cell_Data_t, RXLEV_SERVING_CELL, 6), + M_FIXED (Serving_Cell_Data_t, 1, 0), +CSN_DESCR_END (Serving_Cell_Data_t) + +static const +CSN_DESCR_BEGIN(NC_Measurements_t) + M_UINT (NC_Measurements_t, FREQUENCY_N, 6), + + M_NEXT_EXIST (NC_Measurements_t, Exist_BSIC_N, 1), + M_UINT (NC_Measurements_t, BSIC_N, 6), + M_UINT (NC_Measurements_t, RXLEV_N, 6), +CSN_DESCR_END (NC_Measurements_t) + +static const +CSN_DESCR_BEGIN(RepeatedInvalid_BSIC_Info_t) + M_UINT (RepeatedInvalid_BSIC_Info_t, BCCH_FREQ_N, 5), + M_UINT (RepeatedInvalid_BSIC_Info_t, BSIC_N, 6), + M_UINT (RepeatedInvalid_BSIC_Info_t, RXLEV_N, 6), +CSN_DESCR_END (RepeatedInvalid_BSIC_Info_t) + +static const +CSN_DESCR_BEGIN(REPORTING_QUANTITY_Instance_t) + M_NEXT_EXIST (REPORTING_QUANTITY_Instance_t, Exist_REPORTING_QUANTITY, 1), + M_UINT (REPORTING_QUANTITY_Instance_t, REPORTING_QUANTITY, 6), +CSN_DESCR_END (REPORTING_QUANTITY_Instance_t) + +static const +CSN_DESCR_BEGIN(NC_Measurement_Report_t) + M_UINT (NC_Measurement_Report_t, NC_MODE, 1), + M_TYPE (NC_Measurement_Report_t, Serving_Cell_Data, Serving_Cell_Data_t), + M_UINT (NC_Measurement_Report_t, NUMBER_OF_NC_MEASUREMENTS, 3), + M_VAR_TARRAY (NC_Measurement_Report_t, NC_Measurements, NC_Measurements_t, NUMBER_OF_NC_MEASUREMENTS), +CSN_DESCR_END (NC_Measurement_Report_t) + +static const +CSN_DESCR_BEGIN(ENH_NC_Measurement_Report_t) + M_UINT (ENH_NC_Measurement_Report_t, NC_MODE, 1), + M_UNION (ENH_NC_Measurement_Report_t, 2), + M_TYPE (ENH_NC_Measurement_Report_t, u.BA_USED, BA_USED_t), + M_UINT (ENH_NC_Measurement_Report_t, u.PSI3_CHANGE_MARK, 2), + M_UINT (ENH_NC_Measurement_Report_t, PMO_USED, 1), + M_UINT (ENH_NC_Measurement_Report_t, BSIC_Seen, 1), + M_UINT (ENH_NC_Measurement_Report_t, SCALE, 1), + M_NEXT_EXIST (ENH_NC_Measurement_Report_t, Exist_Serving_Cell_Data, 1), + M_TYPE (ENH_NC_Measurement_Report_t, Serving_Cell_Data, Serving_Cell_Data_t), + M_REC_TARRAY (ENH_NC_Measurement_Report_t, RepeatedInvalid_BSIC_Info[0], RepeatedInvalid_BSIC_Info_t, Count_RepeatedInvalid_BSIC_Info), + M_NEXT_EXIST (ENH_NC_Measurement_Report_t, Exist_ReportBitmap, 1), + M_VAR_TARRAY (ENH_NC_Measurement_Report_t, REPORTING_QUANTITY_Instances, REPORTING_QUANTITY_Instance_t, Count_REPORTING_QUANTITY_Instances), +CSN_DESCR_END (ENH_NC_Measurement_Report_t) + + +static const +CSN_DESCR_BEGIN(EXT_Measurement_Report_t) + M_UINT (EXT_Measurement_Report_t, EXT_REPORTING_TYPE, 2), + + M_NEXT_EXIST (EXT_Measurement_Report_t, Exist_I_LEVEL, 1), + + M_NEXT_EXIST (EXT_Measurement_Report_t, Slot[0].Exist, 1), + M_UINT (EXT_Measurement_Report_t, Slot[0].I_LEVEL, 6), + + M_NEXT_EXIST (EXT_Measurement_Report_t, Slot[1].Exist, 1), + M_UINT (EXT_Measurement_Report_t, Slot[1].I_LEVEL, 6), + + M_NEXT_EXIST (EXT_Measurement_Report_t, Slot[2].Exist, 1), + M_UINT (EXT_Measurement_Report_t, Slot[2].I_LEVEL, 6), + + M_NEXT_EXIST (EXT_Measurement_Report_t, Slot[3].Exist, 1), + M_UINT (EXT_Measurement_Report_t, Slot[3].I_LEVEL, 6), + + M_NEXT_EXIST (EXT_Measurement_Report_t, Slot[4].Exist, 1), + M_UINT (EXT_Measurement_Report_t, Slot[4].I_LEVEL, 6), + + M_NEXT_EXIST (EXT_Measurement_Report_t, Slot[5].Exist, 1), + M_UINT (EXT_Measurement_Report_t, Slot[5].I_LEVEL, 6), + + M_NEXT_EXIST (EXT_Measurement_Report_t, Slot[6].Exist, 1), + M_UINT (EXT_Measurement_Report_t, Slot[6].I_LEVEL, 6), + + M_NEXT_EXIST (EXT_Measurement_Report_t, Slot[7].Exist, 1), + M_UINT (EXT_Measurement_Report_t, Slot[7].I_LEVEL, 6), + + M_UINT (EXT_Measurement_Report_t, NUMBER_OF_EXT_MEASUREMENTS, 5), + M_VAR_TARRAY (EXT_Measurement_Report_t, EXT_Measurements, NC_Measurements_t, NUMBER_OF_EXT_MEASUREMENTS), +CSN_DESCR_END (EXT_Measurement_Report_t) + +static const +CSN_DESCR_BEGIN (Measurements_3G_t) + M_UINT (Measurements_3G_t, CELL_LIST_INDEX_3G, 7), + M_UINT (Measurements_3G_t, REPORTING_QUANTITY, 6), +CSN_DESCR_END (Measurements_3G_t) + +static const +CSN_DESCR_BEGIN (EUTRAN_Measurement_Report_Body_t) + M_UINT (EUTRAN_Measurement_Report_Body_t, EUTRAN_FREQUENCY_INDEX, 3), + M_UINT (EUTRAN_Measurement_Report_Body_t, CELL_IDENTITY, 9), + M_UINT (EUTRAN_Measurement_Report_Body_t, REPORTING_QUANTITY, 6), +CSN_DESCR_END (EUTRAN_Measurement_Report_Body_t) + +static const +CSN_DESCR_BEGIN (EUTRAN_Measurement_Report_t) + M_UINT_OFFSET (EUTRAN_Measurement_Report_t, N_EUTRAN, 2, 1), + M_VAR_TARRAY (EUTRAN_Measurement_Report_t, Report, EUTRAN_Measurement_Report_Body_t, N_EUTRAN), +CSN_DESCR_END (EUTRAN_Measurement_Report_t) + +static const +CSN_DESCR_BEGIN(UTRAN_CSG_Measurement_Report_t) + M_UINT (UTRAN_CSG_Measurement_Report_t, UTRAN_CGI, 28), + M_NEXT_EXIST (UTRAN_CSG_Measurement_Report_t, Exist_PLMN_ID, 1), + M_TYPE (UTRAN_CSG_Measurement_Report_t, Plmn_ID, PLMN_t), + M_UINT (UTRAN_CSG_Measurement_Report_t, CSG_ID, 27), + M_BIT (UTRAN_CSG_Measurement_Report_t, Access_Mode), + M_UINT (UTRAN_CSG_Measurement_Report_t, REPORTING_QUANTITY, 6), +CSN_DESCR_END (UTRAN_CSG_Measurement_Report_t) + +static const +CSN_DESCR_BEGIN(EUTRAN_CSG_Measurement_Report_t) + M_UINT (EUTRAN_CSG_Measurement_Report_t, EUTRAN_CGI, 28), + M_UINT (EUTRAN_CSG_Measurement_Report_t, Tracking_Area_Code, 16), + M_NEXT_EXIST (EUTRAN_CSG_Measurement_Report_t, Exist_PLMN_ID, 1), + M_TYPE (EUTRAN_CSG_Measurement_Report_t, Plmn_ID, PLMN_t), + M_UINT (EUTRAN_CSG_Measurement_Report_t, CSG_ID, 27), + M_BIT (EUTRAN_CSG_Measurement_Report_t, Access_Mode), + M_UINT (EUTRAN_CSG_Measurement_Report_t, REPORTING_QUANTITY, 6), +CSN_DESCR_END (EUTRAN_CSG_Measurement_Report_t) + +static const +CSN_DESCR_BEGIN (PMR_AdditionsR9_t) + M_NEXT_EXIST (PMR_AdditionsR9_t, Exist_UTRAN_CSG_Meas_Rpt, 1), + M_TYPE (PMR_AdditionsR9_t, UTRAN_CSG_Meas_Rpt, UTRAN_CSG_Measurement_Report_t), + M_NEXT_EXIST (PMR_AdditionsR9_t, Exist_EUTRAN_CSG_Meas_Rpt, 1), + M_TYPE (PMR_AdditionsR9_t, EUTRAN_CSG_Meas_Rpt, EUTRAN_CSG_Measurement_Report_t), +CSN_DESCR_END (PMR_AdditionsR9_t) + +static const +CSN_DESCR_BEGIN (PMR_AdditionsR8_t) + M_NEXT_EXIST (PMR_AdditionsR8_t, Exist_EUTRAN_Meas_Rpt, 1), + M_TYPE (PMR_AdditionsR8_t, EUTRAN_Meas_Rpt, EUTRAN_Measurement_Report_t), + M_NEXT_EXIST_OR_NULL(PMR_AdditionsR8_t, Exist_AdditionsR9, 1), + M_TYPE (PMR_AdditionsR8_t, AdditionsR9, PMR_AdditionsR9_t), +CSN_DESCR_END (PMR_AdditionsR8_t) + +static const +CSN_DESCR_BEGIN (PMR_AdditionsR5_t) + M_NEXT_EXIST (PMR_AdditionsR5_t, Exist_GRNTI, 4), + M_UINT (PMR_AdditionsR5_t, GRNTI, 4), + M_NEXT_EXIST_OR_NULL (PMR_AdditionsR5_t, Exist_AdditionsR8, 1), + M_TYPE (PMR_AdditionsR5_t, AdditionsR8, PMR_AdditionsR8_t), +CSN_DESCR_END (PMR_AdditionsR5_t) + +static const +CSN_DESCR_BEGIN (PMR_AdditionsR99_t) + M_NEXT_EXIST (PMR_AdditionsR99_t, Exist_Info3G, 4), + M_UNION (PMR_AdditionsR99_t, 2), + M_TYPE (PMR_AdditionsR99_t, u.BA_USED, BA_USED_t), + M_UINT (PMR_AdditionsR99_t, u.PSI3_CHANGE_MARK, 2), + M_UINT (PMR_AdditionsR99_t, PMO_USED, 1), + + M_NEXT_EXIST (PMR_AdditionsR99_t, Exist_MeasurementReport3G, 2), + M_UINT_OFFSET (PMR_AdditionsR99_t, N_3G, 3, 1), /* offset 1 */ + M_VAR_TARRAY_OFFSET (PMR_AdditionsR99_t, Measurements_3G, Measurements_3G_t, N_3G), + + M_NEXT_EXIST_OR_NULL (PMR_AdditionsR99_t, Exist_AdditionsR5, 1), + M_TYPE (PMR_AdditionsR99_t, AdditionsR5, PMR_AdditionsR5_t), +CSN_DESCR_END (PMR_AdditionsR99_t) + +static const +CSN_DESCR_BEGIN(EMR_ServingCell_t) + /*CSN_MEMBER_BIT (EMR_ServingCell_t, DTX_USED),*/ + M_BIT (EMR_ServingCell_t, DTX_USED), + M_UINT (EMR_ServingCell_t, RXLEV_VAL, 6), + M_UINT (EMR_ServingCell_t, RX_QUAL_FULL, 3), + M_UINT (EMR_ServingCell_t, MEAN_BEP, 5), + M_UINT (EMR_ServingCell_t, CV_BEP, 3), + M_UINT (EMR_ServingCell_t, NBR_RCVD_BLOCKS, 5), +CSN_DESCR_END(EMR_ServingCell_t) + +static const +CSN_DESCR_BEGIN (EnhancedMeasurementReport_t) + M_UINT (EnhancedMeasurementReport_t, RR_Short_PD, 1), + M_UINT (EnhancedMeasurementReport_t, MESSAGE_TYPE, 5), + M_UINT (EnhancedMeasurementReport_t, ShortLayer2_Header, 2), + M_TYPE (EnhancedMeasurementReport_t, BA_USED, BA_USED_t), + M_UINT (EnhancedMeasurementReport_t, BSIC_Seen, 1), + M_UINT (EnhancedMeasurementReport_t, SCALE, 1), + M_NEXT_EXIST (EnhancedMeasurementReport_t, Exist_ServingCellData, 1), + M_TYPE (EnhancedMeasurementReport_t, ServingCellData, EMR_ServingCell_t), + M_REC_TARRAY (EnhancedMeasurementReport_t, RepeatedInvalid_BSIC_Info[0], RepeatedInvalid_BSIC_Info_t, + Count_RepeatedInvalid_BSIC_Info), + M_NEXT_EXIST (EnhancedMeasurementReport_t, Exist_ReportBitmap, 1), + M_VAR_TARRAY (EnhancedMeasurementReport_t, REPORTING_QUANTITY_Instances, REPORTING_QUANTITY_Instance_t, Count_REPORTING_QUANTITY_Instances), +CSN_DESCR_END (EnhancedMeasurementReport_t) + +static const +CSN_DESCR_BEGIN (Packet_Measurement_Report_t) + /* Mac header */ + M_UINT (Packet_Measurement_Report_t, PayloadType, 2), + M_UINT (Packet_Measurement_Report_t, spare, 5), + M_UINT (Packet_Measurement_Report_t, R, 1), + M_UINT (Packet_Measurement_Report_t, MESSAGE_TYPE, 6), + /* Mac header */ + + M_UINT (Packet_Measurement_Report_t, TLLI, 32), + + M_NEXT_EXIST (Packet_Measurement_Report_t, Exist_PSI5_CHANGE_MARK, 1), + M_UINT (Packet_Measurement_Report_t, PSI5_CHANGE_MARK, 2), + + M_UNION (Packet_Measurement_Report_t, 2), + M_TYPE (Packet_Measurement_Report_t, u.NC_Measurement_Report, NC_Measurement_Report_t), + M_TYPE (Packet_Measurement_Report_t, u.EXT_Measurement_Report, EXT_Measurement_Report_t), + + M_NEXT_EXIST_OR_NULL(Packet_Measurement_Report_t, Exist_AdditionsR99, 1), + M_TYPE (Packet_Measurement_Report_t, AdditionsR99, PMR_AdditionsR99_t), +CSN_DESCR_END (Packet_Measurement_Report_t) + +static const +CSN_DESCR_BEGIN (PEMR_AdditionsR9_t) + M_NEXT_EXIST (PEMR_AdditionsR9_t, Exist_UTRAN_CSG_Target_Cell, 1), + M_TYPE (PEMR_AdditionsR9_t, UTRAN_CSG_Target_Cell, UTRAN_CSG_Target_Cell_t), + M_NEXT_EXIST (PEMR_AdditionsR9_t, Exist_EUTRAN_CSG_Target_Cell, 1), + M_TYPE (PEMR_AdditionsR9_t, EUTRAN_CSG_Target_Cell, EUTRAN_CSG_Target_Cell_t), +CSN_DESCR_END (PEMR_AdditionsR9_t) + +static const +CSN_DESCR_BEGIN (Bitmap_Report_Quantity_t) + M_NEXT_EXIST (Bitmap_Report_Quantity_t, Exist_REPORTING_QUANTITY, 1), + M_UINT (Bitmap_Report_Quantity_t, REPORTING_QUANTITY, 6), +CSN_DESCR_END (Bitmap_Report_Quantity_t) + +static const +CSN_DESCR_BEGIN (PEMR_AdditionsR8_t) + M_UINT_OFFSET (PEMR_AdditionsR8_t, BITMAP_LENGTH, 7, 1), + M_VAR_TARRAY (PEMR_AdditionsR8_t, Bitmap_Report_Quantity, Bitmap_Report_Quantity_t, BITMAP_LENGTH), + M_NEXT_EXIST (PEMR_AdditionsR8_t, Exist_EUTRAN_Meas_Rpt, 1), + M_TYPE (PEMR_AdditionsR8_t, EUTRAN_Meas_Rpt, EUTRAN_Measurement_Report_t), + M_NEXT_EXIST_OR_NULL(PEMR_AdditionsR8_t, Exist_AdditionsR9, 1), + M_TYPE (PEMR_AdditionsR8_t, AdditionsR9, PEMR_AdditionsR9_t), +CSN_DESCR_END (PEMR_AdditionsR8_t) + +static const +CSN_DESCR_BEGIN (PEMR_AdditionsR5_t) + M_NEXT_EXIST (PEMR_AdditionsR5_t, Exist_GRNTI_Ext, 1), + M_UINT (PEMR_AdditionsR5_t, GRNTI_Ext, 4), + M_NEXT_EXIST_OR_NULL(PEMR_AdditionsR5_t, Exist_AdditionsR8, 1), + M_TYPE (PEMR_AdditionsR5_t, AdditionsR8, PEMR_AdditionsR8_t), +CSN_DESCR_END (PEMR_AdditionsR5_t) + + +static const +CSN_DESCR_BEGIN (Packet_Enh_Measurement_Report_t) + /* Mac header */ + M_UINT (Packet_Enh_Measurement_Report_t, PayloadType, 2), + M_UINT (Packet_Enh_Measurement_Report_t, spare, 5), + M_UINT (Packet_Enh_Measurement_Report_t, R, 1), + M_UINT (Packet_Enh_Measurement_Report_t, MESSAGE_TYPE, 6), + /* Mac header */ + + M_UINT (Packet_Enh_Measurement_Report_t, TLLI, 32), + + M_TYPE (Packet_Enh_Measurement_Report_t, Measurements, ENH_NC_Measurement_Report_t), + + M_NEXT_EXIST_OR_NULL(Packet_Enh_Measurement_Report_t, Exist_AdditionsR5, 1), + M_TYPE (Packet_Enh_Measurement_Report_t, AdditionsR5, PEMR_AdditionsR5_t), +CSN_DESCR_END (Packet_Enh_Measurement_Report_t) + +/*< Packet Measurement Order message contents >*/ +static const +CSN_DESCR_BEGIN(EXT_Frequency_List_t) + M_UINT (EXT_Frequency_List_t, START_FREQUENCY, 10), + M_UINT (EXT_Frequency_List_t, NR_OF_FREQUENCIES, 5), + M_UINT (EXT_Frequency_List_t, FREQ_DIFF_LENGTH, 3), + +/* TBD: Count_FREQUENCY_DIFF + * guint8 FREQUENCY_DIFF[31]; + * bit (FREQ_DIFF_LENGTH) * NR_OF_FREQUENCIES --> MAX is bit(7) * 31 + */ +CSN_DESCR_END (EXT_Frequency_List_t) + +static const +CSN_DESCR_BEGIN (Packet_Measurement_Order_t) + M_UINT (Packet_Measurement_Order_t, MESSAGE_TYPE, 6), + M_UINT (Packet_Measurement_Order_t, PAGE_MODE, 2), + + M_TYPE (Packet_Measurement_Order_t, ID, PacketDownlinkID_t), /* reuse the PDA ID type */ + + M_UINT (Packet_Measurement_Order_t, PMO_INDEX, 3), + M_UINT (Packet_Measurement_Order_t, PMO_COUNT, 3), + + M_NEXT_EXIST (Packet_Measurement_Order_t, Exist_NC_Measurement_Parameters, 1), + M_TYPE (Packet_Measurement_Order_t, NC_Measurement_Parameters, NC_Measurement_Parameters_with_Frequency_List_t), + + M_NEXT_EXIST (Packet_Measurement_Order_t, Exist_EXT_Measurement_Parameters, 1), + M_FIXED (Packet_Measurement_Order_t, 2, 0x0), /* EXT_Measurement_Parameters not handled */ + + M_NEXT_EXIST_OR_NULL (Packet_Measurement_Order_t, Exist_AdditionsR98, 1), + M_TYPE (Packet_Measurement_Order_t, AdditionsR98, PMO_AdditionsR98_t), +CSN_DESCR_END (Packet_Measurement_Order_t) + +static const +CSN_DESCR_BEGIN(CCN_Measurement_Report_t) + M_UINT (CCN_Measurement_Report_t, RXLEV_SERVING_CELL, 6), + M_FIXED (CCN_Measurement_Report_t, 1, 0), + M_UINT (CCN_Measurement_Report_t, NUMBER_OF_NC_MEASUREMENTS, 3), + M_VAR_TARRAY (CCN_Measurement_Report_t, NC_Measurements, NC_Measurements_t, NUMBER_OF_NC_MEASUREMENTS), +CSN_DESCR_END (CCN_Measurement_Report_t) + +static const +CSN_DESCR_BEGIN(Target_Cell_GSM_Notif_t) + M_UINT (Target_Cell_GSM_Notif_t, ARFCN, 10), + M_UINT (Target_Cell_GSM_Notif_t, BSIC, 6), +CSN_DESCR_END (Target_Cell_GSM_Notif_t) + +static const +CSN_DESCR_BEGIN(FDD_Target_Cell_Notif_t) + M_UINT (FDD_Target_Cell_Notif_t, FDD_ARFCN, 14), + M_NEXT_EXIST (FDD_Target_Cell_Notif_t, Exist_Bandwith_FDD, 1), + M_UINT (FDD_Target_Cell_Notif_t, BANDWITH_FDD, 3), + M_UINT (FDD_Target_Cell_Notif_t, SCRAMBLING_CODE, 9), +CSN_DESCR_END (FDD_Target_Cell_Notif_t) + +static const +CSN_DESCR_BEGIN(TDD_Target_Cell_Notif_t) + M_UINT (TDD_Target_Cell_Notif_t, TDD_ARFCN, 14), + M_NEXT_EXIST (TDD_Target_Cell_Notif_t, Exist_Bandwith_TDD, 1), + M_UINT (TDD_Target_Cell_Notif_t, BANDWITH_TDD, 3), + M_UINT (TDD_Target_Cell_Notif_t, CELL_PARAMETER, 7), + M_UINT (TDD_Target_Cell_Notif_t, Sync_Case_TSTD, 1), +CSN_DESCR_END (TDD_Target_Cell_Notif_t) + +static const +CSN_DESCR_BEGIN(Target_Cell_3G_Notif_t) + M_NEXT_EXIST (Target_Cell_3G_Notif_t, Exist_FDD_Description, 1), + M_TYPE (Target_Cell_3G_Notif_t, FDD_Target_Cell_Notif, FDD_Target_Cell_Notif_t), + M_NEXT_EXIST (Target_Cell_3G_Notif_t, Exist_TDD_Description, 1), + M_TYPE (Target_Cell_3G_Notif_t, TDD_Target_Cell, TDD_Target_Cell_Notif_t), + M_UINT (Target_Cell_3G_Notif_t, REPORTING_QUANTITY, 6), +CSN_DESCR_END (Target_Cell_3G_Notif_t) + +static const +CSN_DESCR_BEGIN(Target_EUTRAN_Cell_Notif_t) + M_UINT (Target_EUTRAN_Cell_Notif_t, EARFCN, 16), + M_NEXT_EXIST (Target_EUTRAN_Cell_Notif_t, Exist_Measurement_Bandwidth, 1), + M_UINT (Target_EUTRAN_Cell_Notif_t, Measurement_Bandwidth, 3), + M_UINT (Target_EUTRAN_Cell_Notif_t, Physical_Layer_Cell_Identity, 9), + M_UINT (Target_EUTRAN_Cell_Notif_t, Reporting_Quantity, 6), +CSN_DESCR_END (Target_EUTRAN_Cell_Notif_t) + +static const +CSN_DESCR_BEGIN(Eutran_Ccn_Measurement_Report_Cell_t) + M_UINT (Eutran_Ccn_Measurement_Report_Cell_t, EUTRAN_FREQUENCY_INDEX, 3), + M_UINT (Eutran_Ccn_Measurement_Report_Cell_t, CELL_IDENTITY, 9), + M_UINT (Eutran_Ccn_Measurement_Report_Cell_t, REPORTING_QUANTITY, 6), +CSN_DESCR_END (Eutran_Ccn_Measurement_Report_Cell_t) + + +static const +CSN_DESCR_BEGIN(Eutran_Ccn_Measurement_Report_t) + M_BIT (Eutran_Ccn_Measurement_Report_t, ThreeG_BA_USED), + M_UINT_OFFSET(Eutran_Ccn_Measurement_Report_t, N_EUTRAN, 2, 1), + M_VAR_TARRAY (Eutran_Ccn_Measurement_Report_t, Eutran_Ccn_Measurement_Report_Cell, Eutran_Ccn_Measurement_Report_Cell_t, N_EUTRAN), +CSN_DESCR_END (Eutran_Ccn_Measurement_Report_t) + +static const +CSN_DESCR_BEGIN(Target_Cell_4G_Notif_t) + M_NEXT_EXIST (Target_Cell_4G_Notif_t, Exist_Arfcn, 2), + M_UINT (Target_Cell_4G_Notif_t, Arfcn, 10), + M_UINT (Target_Cell_4G_Notif_t, bsic, 6), + M_NEXT_EXIST (Target_Cell_4G_Notif_t, Exist_3G_Target_Cell, 1), + M_TYPE (Target_Cell_4G_Notif_t, Target_Cell_3G_Notif, Target_Cell_3G_Notif_t), + M_NEXT_EXIST (Target_Cell_4G_Notif_t, Exist_Eutran_Target_Cell, 1), + M_TYPE (Target_Cell_4G_Notif_t, Target_EUTRAN_Cell, Target_EUTRAN_Cell_Notif_t), + M_NEXT_EXIST (Target_Cell_4G_Notif_t, Exist_Eutran_Ccn_Measurement_Report, 1), + M_TYPE (Target_Cell_4G_Notif_t, Eutran_Ccn_Measurement_Report, Eutran_Ccn_Measurement_Report_t), +CSN_DESCR_END (Target_Cell_4G_Notif_t) + +static const +CSN_DESCR_BEGIN(Target_Cell_CSG_Notif_t) + M_FIXED (Target_Cell_CSG_Notif_t, 1, 0x00), + M_UNION (Target_Cell_CSG_Notif_t, 2), + M_TYPE (Target_Cell_CSG_Notif_t, u.UTRAN_CSG_Measurement_Report, UTRAN_CSG_Measurement_Report_t), + M_TYPE (Target_Cell_CSG_Notif_t, u.EUTRAN_CSG_Measurement_Report, EUTRAN_CSG_Measurement_Report_t), + M_NEXT_EXIST (Target_Cell_CSG_Notif_t, Exist_Eutran_Ccn_Measurement_Report, 1), + M_TYPE (Target_Cell_CSG_Notif_t, Eutran_Ccn_Measurement_Report, Eutran_Ccn_Measurement_Report_t), +CSN_DESCR_END (Target_Cell_CSG_Notif_t) + +static const +CSN_DESCR_BEGIN(Target_Other_RAT_2_Notif_t) + /* 110 vs 1110 */ + M_UNION (Target_Other_RAT_2_Notif_t, 2), + M_TYPE (Target_Other_RAT_2_Notif_t, u.Target_Cell_4G_Notif, Target_Cell_4G_Notif_t), + M_TYPE (Target_Other_RAT_2_Notif_t, u.Target_Cell_CSG_Notif, Target_Cell_CSG_Notif_t), +CSN_DESCR_END (Target_Other_RAT_2_Notif_t) + +static const +CSN_DESCR_BEGIN(Target_Other_RAT_Notif_t) + /* 10 vs 110 */ + M_UNION (Target_Other_RAT_Notif_t, 2), + M_TYPE (Target_Other_RAT_Notif_t, u.Target_Cell_3G_Notif, Target_Cell_3G_Notif_t), + M_TYPE (Target_Other_RAT_Notif_t, u.Target_Other_RAT_2_Notif, Target_Other_RAT_2_Notif_t), +CSN_DESCR_END (Target_Other_RAT_Notif_t) + +static const +CSN_DESCR_BEGIN(Target_Cell_t) + /* 0 vs 10 */ + M_UNION (Target_Cell_t, 2), + M_TYPE (Target_Cell_t, u.Target_Cell_GSM_Notif, Target_Cell_GSM_Notif_t), + M_TYPE (Target_Cell_t, u.Target_Other_RAT_Notif, Target_Other_RAT_Notif_t), +CSN_DESCR_END (Target_Cell_t) + +static const +CSN_DESCR_BEGIN (PCCN_AdditionsR6_t) + M_NEXT_EXIST (PCCN_AdditionsR6_t, Exist_BA_USED_3G, 1), + M_UINT (PCCN_AdditionsR6_t, BA_USED_3G, 1), + + M_UINT_OFFSET (PCCN_AdditionsR6_t, N_3G, 3, 1), /* offset 1 */ + M_VAR_TARRAY_OFFSET (PCCN_AdditionsR6_t, Measurements_3G, Measurements_3G_t, N_3G), +CSN_DESCR_END (PCCN_AdditionsR6_t) + +/*< Packet Cell Change Notification message contents > */ +static const +CSN_DESCR_BEGIN(Packet_Cell_Change_Notification_t) + /* Mac header */ + M_UINT (Packet_Cell_Change_Notification_t, PayloadType, 2), + M_UINT (Packet_Cell_Change_Notification_t, spare, 5), + M_UINT (Packet_Cell_Change_Notification_t, R, 1), + M_UINT (Packet_Cell_Change_Notification_t, MESSAGE_TYPE, 6), + /* Mac header */ + + M_TYPE (Packet_Cell_Change_Notification_t, Global_TFI, Global_TFI_t), + M_TYPE (Packet_Cell_Change_Notification_t, Target_Cell, Target_Cell_t), + + M_UNION (Packet_Cell_Change_Notification_t, 2), + M_UINT (Packet_Cell_Change_Notification_t, u.BA_IND, 1), + M_UINT (Packet_Cell_Change_Notification_t, u.PSI3_CHANGE_MARK, 2), + + M_UINT (Packet_Cell_Change_Notification_t, PMO_USED, 1), + M_UINT (Packet_Cell_Change_Notification_t, PCCN_SENDING, 1), + M_TYPE (Packet_Cell_Change_Notification_t, CCN_Measurement_Report, CCN_Measurement_Report_t), + + M_NEXT_EXIST_OR_NULL(Packet_Cell_Change_Notification_t, Exist_AdditionsR6, 1), + M_TYPE (Packet_Cell_Change_Notification_t, AdditionsR6, PCCN_AdditionsR6_t), +CSN_DESCR_END (Packet_Cell_Change_Notification_t) + +/*< Packet Cell Change Continue message contents > */ +static const +CSN_DESCR_BEGIN(Packet_Cell_Change_Continue_t) + M_UINT (Packet_Cell_Change_Continue_t, MESSAGE_TYPE, 6), + M_UINT (Packet_Cell_Change_Continue_t, PAGE_MODE, 2), + M_FIXED (Packet_Cell_Change_Continue_t, 1, 0x00), + M_TYPE (Packet_Cell_Change_Continue_t, Global_TFI, Global_TFI_t), + + M_NEXT_EXIST (Packet_Cell_Change_Continue_t, Exist_ID, 3), + M_UINT (Packet_Cell_Change_Continue_t, ARFCN, 10), + M_UINT (Packet_Cell_Change_Continue_t, BSIC, 6), + M_UINT (Packet_Cell_Change_Continue_t, CONTAINER_ID, 2), +CSN_DESCR_END (Packet_Cell_Change_Continue_t) + +/*< Packet Neighbour Cell Data message contents > */ +static const +CSN_DESCR_BEGIN(PNCD_Container_With_ID_t) + M_UINT (PNCD_Container_With_ID_t, ARFCN, 10), + M_UINT (PNCD_Container_With_ID_t, BSIC, 6), + M_UINT_ARRAY (PNCD_Container_With_ID_t, CONTAINER, 8, 17),/* 8*17 bits */ +CSN_DESCR_END (PNCD_Container_With_ID_t) + +static const +CSN_DESCR_BEGIN(PNCD_Container_Without_ID_t) + M_UINT_ARRAY (PNCD_Container_Without_ID_t, CONTAINER, 8, 19),/* 8*19 bits */ +CSN_DESCR_END (PNCD_Container_Without_ID_t) + +static const +CSN_ChoiceElement_t PNCDContainer[] = +{ + {1, 0x0, M_TYPE(PNCDContainer_t, u.PNCD_Container_Without_ID, PNCD_Container_Without_ID_t)}, + {1, 0x1, M_TYPE(PNCDContainer_t, u.PNCD_Container_With_ID, PNCD_Container_With_ID_t)}, +}; + +static const +CSN_DESCR_BEGIN(PNCDContainer_t) + M_CHOICE (PNCDContainer_t, UnionType, PNCDContainer, ElementsOf(PNCDContainer)), +CSN_DESCR_END (PNCDContainer_t) + +static const +CSN_DESCR_BEGIN(Packet_Neighbour_Cell_Data_t) + M_UINT (Packet_Neighbour_Cell_Data_t, MESSAGE_TYPE, 6), + M_UINT (Packet_Neighbour_Cell_Data_t, PAGE_MODE, 2), + M_FIXED (Packet_Neighbour_Cell_Data_t, 1, 0x00), + M_TYPE (Packet_Neighbour_Cell_Data_t, Global_TFI, Global_TFI_t), + + M_UINT (Packet_Neighbour_Cell_Data_t, CONTAINER_ID, 2), + M_UINT (Packet_Neighbour_Cell_Data_t, spare, 1), + M_UINT (Packet_Neighbour_Cell_Data_t, CONTAINER_INDEX, 5), + + M_TYPE (Packet_Neighbour_Cell_Data_t, Container, PNCDContainer_t), +CSN_DESCR_END (Packet_Neighbour_Cell_Data_t) + +/*< Packet Serving Cell Data message contents > */ +static const +CSN_DESCR_BEGIN(Packet_Serving_Cell_Data_t) + M_UINT (Packet_Serving_Cell_Data_t, MESSAGE_TYPE, 6), + M_UINT (Packet_Serving_Cell_Data_t, PAGE_MODE, 2), + M_FIXED (Packet_Serving_Cell_Data_t, 1, 0x00), + M_TYPE (Packet_Serving_Cell_Data_t, Global_TFI, Global_TFI_t), + + M_UINT (Packet_Serving_Cell_Data_t, spare, 4), + M_UINT (Packet_Serving_Cell_Data_t, CONTAINER_INDEX, 5), + M_UINT_ARRAY (Packet_Serving_Cell_Data_t, CONTAINER, 8, 19),/* 8*19 bits */ +CSN_DESCR_END (Packet_Serving_Cell_Data_t) + + +/* Enhanced Measurement Report */ +static const +CSN_DESCR_BEGIN (ServingCellData_t) + M_UINT (ServingCellData_t, RXLEV_SERVING_CELL, 6), + M_FIXED (ServingCellData_t, 1, 0), +CSN_DESCR_END (ServingCellData_t) + +static const +CSN_DESCR_BEGIN (Repeated_Invalid_BSIC_Info_t) + M_UINT (Repeated_Invalid_BSIC_Info_t, BCCH_FREQ_NCELL, 5), + M_UINT (Repeated_Invalid_BSIC_Info_t, BSIC, 6), + M_UINT (Repeated_Invalid_BSIC_Info_t, RXLEV_NCELL, 5), +CSN_DESCR_END (Repeated_Invalid_BSIC_Info_t) + +static const +CSN_DESCR_BEGIN (REPORTING_QUANTITY_t) + M_NEXT_EXIST (REPORTING_QUANTITY_t, Exist_REPORTING_QUANTITY, 1), + M_UINT (REPORTING_QUANTITY_t, REPORTING_QUANTITY, 6), +CSN_DESCR_END (REPORTING_QUANTITY_t) + + +static const +CSN_DESCR_BEGIN (NC_MeasurementReport_t) + M_BIT (NC_MeasurementReport_t, NC_MODE), + M_UNION (NC_MeasurementReport_t, 2), + M_TYPE (NC_MeasurementReport_t, u.BA_USED, BA_USED_t), + M_UINT (NC_MeasurementReport_t, u.PSI3_CHANGE_MARK, 2), + M_BIT (NC_MeasurementReport_t, PMO_USED), + M_BIT (NC_MeasurementReport_t, SCALE), + + M_NEXT_EXIST (NC_MeasurementReport_t, Exist_ServingCellData, 1), + M_TYPE (NC_MeasurementReport_t, ServingCellData, ServingCellData_t), + + M_REC_TARRAY (NC_MeasurementReport_t, Repeated_Invalid_BSIC_Info, Repeated_Invalid_BSIC_Info_t, Count_Repeated_Invalid_BSIC_Info), + + M_NEXT_EXIST (NC_MeasurementReport_t, Exist_Repeated_REPORTING_QUANTITY, 1), + M_VAR_TARRAY (NC_MeasurementReport_t, Repeated_REPORTING_QUANTITY, REPORTING_QUANTITY_t, Count_Repeated_Reporting_Quantity), +CSN_DESCR_END (NC_MeasurementReport_t) + + + +/*< Packet Handover Command message content > */ +static const +CSN_DESCR_BEGIN (GlobalTimeslotDescription_t) + M_UNION (GlobalTimeslotDescription_t, 2), + M_UINT (GlobalTimeslotDescription_t, u.MS_TimeslotAllocation, 8), + M_TYPE (GlobalTimeslotDescription_t, u.Power_Control_Parameters, Power_Control_Parameters_t), +CSN_DESCR_END (GlobalTimeslotDescription_t) + +static const +CSN_DESCR_BEGIN (PHO_DownlinkAssignment_t) + M_UINT (PHO_DownlinkAssignment_t, TimeslotAllocation, 8), + M_UINT (PHO_DownlinkAssignment_t, PFI, 7), + M_BIT (PHO_DownlinkAssignment_t, RLC_Mode), + M_UINT (PHO_DownlinkAssignment_t, TFI_Assignment, 5), + M_BIT (PHO_DownlinkAssignment_t, ControlACK), + + M_NEXT_EXIST (PHO_DownlinkAssignment_t, Exist_EGPRS_WindowSize, 1), + M_UINT (PHO_DownlinkAssignment_t, EGPRS_WindowSize, 5), +CSN_DESCR_END (PHO_DownlinkAssignment_t) + +static const +CSN_DESCR_BEGIN (PHO_USF_1_7_t) + M_NEXT_EXIST (PHO_USF_1_7_t, Exist_USF, 1), + M_UINT (PHO_USF_1_7_t, USF, 3), +CSN_DESCR_END (PHO_USF_1_7_t) + +static const +CSN_DESCR_BEGIN (USF_AllocationArray_t) + M_UINT (USF_AllocationArray_t, USF_0, 3), + M_VAR_TARRAY_OFFSET (USF_AllocationArray_t, USF_1_7, PHO_USF_1_7_t, NBR_OfAllocatedTimeslots), +CSN_DESCR_END (USF_AllocationArray_t) + +static const +CSN_DESCR_BEGIN (PHO_UplinkAssignment_t) + M_UINT (PHO_UplinkAssignment_t, PFI, 7), + M_BIT (PHO_UplinkAssignment_t, RLC_Mode), + M_UINT (PHO_UplinkAssignment_t, TFI_Assignment, 5), + + M_NEXT_EXIST (PHO_UplinkAssignment_t, Exist_ChannelCodingCommand, 1), + M_UINT (PHO_UplinkAssignment_t, ChannelCodingCommand, 2), + + M_NEXT_EXIST (PHO_UplinkAssignment_t, Exist_EGPRS_ChannelCodingCommand, 1), + M_UINT (PHO_UplinkAssignment_t, EGPRS_ChannelCodingCommand, 4), + + M_NEXT_EXIST (PHO_UplinkAssignment_t, Exist_EGPRS_WindowSize, 1), + M_UINT (PHO_UplinkAssignment_t, EGPRS_WindowSize, 5), + + M_BIT (PHO_UplinkAssignment_t, USF_Granularity), + + M_NEXT_EXIST (PHO_UplinkAssignment_t, Exist_TBF_TimeslotAllocation, 1), + M_LEFT_VAR_BMP (PHO_UplinkAssignment_t, TBF_TimeslotAllocation, u.USF_AllocationArray.NBR_OfAllocatedTimeslots, 0), + + M_UNION (PHO_UplinkAssignment_t, 2), + M_UINT (PHO_UplinkAssignment_t, u.USF_SingleAllocation, 3), + M_TYPE (PHO_UplinkAssignment_t, u.USF_AllocationArray, USF_AllocationArray_t), +CSN_DESCR_END (PHO_UplinkAssignment_t) + +static const +CSN_DESCR_BEGIN (GlobalTimeslotDescription_UA_t) + M_TYPE (GlobalTimeslotDescription_UA_t, GlobalTimeslotDescription, GlobalTimeslotDescription_t), + M_NEXT_EXIST (GlobalTimeslotDescription_UA_t, Exist_PHO_UA, 3), /* Don't use M_REC_TARRAY as we don't support multiple TBFs */ + + M_TYPE (GlobalTimeslotDescription_UA_t, PHO_UA, PHO_UplinkAssignment_t), + M_FIXED (GlobalTimeslotDescription_UA_t, 1, 0x0), /* Escape recursive */ +CSN_DESCR_END (GlobalTimeslotDescription_UA_t) + +static const +CSN_DESCR_BEGIN (PHO_GPRS_t) + M_NEXT_EXIST (PHO_GPRS_t, Exist_ChannelCodingCommand, 1), + M_UINT (PHO_GPRS_t, ChannelCodingCommand, 2), + + M_NEXT_EXIST (PHO_GPRS_t, Exist_GlobalTimeslotDescription_UA, 1), + M_TYPE (PHO_GPRS_t, GTD_UA, GlobalTimeslotDescription_UA_t), + + M_NEXT_EXIST (PHO_GPRS_t, Exist_DownlinkAssignment, 2), /* Don't use M_REC_TARRAY as we don't support multiple TBFs */ + M_TYPE (PHO_GPRS_t, DownlinkAssignment, PHO_DownlinkAssignment_t), + M_FIXED (PHO_GPRS_t, 1, 0x0), /* Escape recursive */ +CSN_DESCR_END (PHO_GPRS_t) + +static const +CSN_DESCR_BEGIN (EGPRS_Description_t) + M_NEXT_EXIST (EGPRS_Description_t, Exist_EGPRS_WindowSize, 1), + M_UINT (EGPRS_Description_t, EGPRS_WindowSize, 5), + + M_UINT (EGPRS_Description_t, LinkQualityMeasurementMode, 2), + M_NEXT_EXIST (EGPRS_Description_t, Exist_BEP_Period2, 1), + M_UINT (EGPRS_Description_t, BEP_Period2, 4), +CSN_DESCR_END (EGPRS_Description_t) + +static const +CSN_DESCR_BEGIN (DownlinkTBF_t) + M_NEXT_EXIST (DownlinkTBF_t, Exist_EGPRS_Description, 1), + M_TYPE (DownlinkTBF_t, EGPRS_Description, EGPRS_Description_t), + + M_NEXT_EXIST (DownlinkTBF_t, Exist_DownlinkAssignment, 2), /* Don't use M_REC_TARRAY as we don't support multiple TBFs */ + M_TYPE (DownlinkTBF_t, DownlinkAssignment, PHO_DownlinkAssignment_t), + M_FIXED (DownlinkTBF_t, 1, 0x0), /* Escape recursive */ +CSN_DESCR_END (DownlinkTBF_t) + +static const +CSN_DESCR_BEGIN (PHO_EGPRS_t) + M_NEXT_EXIST (PHO_EGPRS_t, Exist_EGPRS_WindowSize, 1), + M_UINT (PHO_EGPRS_t, EGPRS_WindowSize, 5), + + M_NEXT_EXIST (PHO_EGPRS_t, Exist_EGPRS_ChannelCodingCommand, 1), + M_UINT (PHO_EGPRS_t, EGPRS_ChannelCodingCommand, 4), + + M_NEXT_EXIST (PHO_EGPRS_t, Exist_BEP_Period2, 1), + M_UINT (PHO_EGPRS_t, BEP_Period2, 4), + + M_NEXT_EXIST (PHO_EGPRS_t, Exist_GlobalTimeslotDescription_UA, 1), + M_TYPE (PHO_EGPRS_t, GTD_UA, GlobalTimeslotDescription_UA_t), + + M_NEXT_EXIST (PHO_EGPRS_t, Exist_DownlinkTBF, 2), + M_TYPE (PHO_EGPRS_t, DownlinkTBF, DownlinkTBF_t), +CSN_DESCR_END (PHO_EGPRS_t) + +static const +CSN_DESCR_BEGIN(PHO_TimingAdvance_t) + M_TYPE (PHO_TimingAdvance_t, GlobalPacketTimingAdvance, Global_Packet_Timing_Advance_t), + M_NEXT_EXIST (PHO_TimingAdvance_t, Exist_PacketExtendedTimingAdvance, 1), + M_UINT (PHO_TimingAdvance_t, PacketExtendedTimingAdvance, 2), +CSN_DESCR_END (PHO_TimingAdvance_t) + +static const +CSN_DESCR_BEGIN(NAS_Container_t) + M_UINT (NAS_Container_t, NAS_ContainerLength, 7), + M_VAR_ARRAY (NAS_Container_t, NAS_Container, NAS_ContainerLength, 0), +CSN_DESCR_END (NAS_Container_t) + +static const +CSN_DESCR_BEGIN(PS_HandoverTo_UTRAN_Payload_t) + M_UINT (PS_HandoverTo_UTRAN_Payload_t, RRC_ContainerLength, 8), + M_VAR_ARRAY (PS_HandoverTo_UTRAN_Payload_t, RRC_Container, RRC_ContainerLength, 0), +CSN_DESCR_END (PS_HandoverTo_UTRAN_Payload_t) + + +static const +CSN_DESCR_BEGIN(PHO_RadioResources_t) + M_NEXT_EXIST (PHO_RadioResources_t, Exist_HandoverReference, 1), + M_UINT (PHO_RadioResources_t, HandoverReference, 8), + + M_UINT (PHO_RadioResources_t, ARFCN, 10), + M_UINT (PHO_RadioResources_t, SI, 2), + M_BIT (PHO_RadioResources_t, NCI), + M_UINT (PHO_RadioResources_t, BSIC, 6), + M_NEXT_EXIST (PHO_RadioResources_t, Exist_CCN_Active, 1), + M_BIT (PHO_RadioResources_t, CCN_Active), + + M_NEXT_EXIST (PHO_RadioResources_t, Exist_CCN_Active_3G, 1), + M_BIT (PHO_RadioResources_t, CCN_Active_3G), + + M_NEXT_EXIST (PHO_RadioResources_t, Exist_CCN_Support_Description, 1), + M_TYPE (PHO_RadioResources_t, CCN_Support_Description, CCN_Support_Description_t), + + M_TYPE (PHO_RadioResources_t, Frequency_Parameters, Frequency_Parameters_t), + M_UINT (PHO_RadioResources_t, NetworkControlOrder, 2), + M_NEXT_EXIST (PHO_RadioResources_t, Exist_PHO_TimingAdvance, 1), + M_TYPE (PHO_RadioResources_t, PHO_TimingAdvance, PHO_TimingAdvance_t), + + M_BIT (PHO_RadioResources_t, Extended_Dynamic_Allocation), + M_BIT (PHO_RadioResources_t, RLC_Reset), + M_NEXT_EXIST (PHO_RadioResources_t, Exist_PO_PR, 2), + M_UINT (PHO_RadioResources_t, PO, 4), + M_BIT (PHO_RadioResources_t, PR_Mode), + + + M_NEXT_EXIST (PHO_RadioResources_t, Exist_UplinkControlTimeslot, 1), + M_UINT (PHO_RadioResources_t, UplinkControlTimeslot, 3), + + M_UNION (PHO_RadioResources_t, 2), + M_TYPE (PHO_RadioResources_t, u.PHO_GPRS_Mode, PHO_GPRS_t), + M_TYPE (PHO_RadioResources_t, u.PHO_EGPRS_Mode, PHO_EGPRS_t), +CSN_DESCR_END (PHO_RadioResources_t) + +static const +CSN_DESCR_BEGIN(PS_HandoverTo_A_GB_ModePayload_t) + M_FIXED (PS_HandoverTo_A_GB_ModePayload_t, 2, 0x00), /* For future extension to enum. */ + M_TYPE (PS_HandoverTo_A_GB_ModePayload_t, PHO_RadioResources, PHO_RadioResources_t), + + M_NEXT_EXIST (PS_HandoverTo_A_GB_ModePayload_t, Exist_NAS_Container, 1), + M_TYPE (PS_HandoverTo_A_GB_ModePayload_t, NAS_Container, NAS_Container_t), +CSN_DESCR_END (PS_HandoverTo_A_GB_ModePayload_t) + +static const +CSN_DESCR_BEGIN(Packet_Handover_Command_t) + M_UINT (Packet_Handover_Command_t, MessageType, 6), + M_UINT (Packet_Handover_Command_t, PageMode, 2), + + M_FIXED (Packet_Handover_Command_t, 1, 0x00), /* 0 fixed */ + M_TYPE (Packet_Handover_Command_t, Global_TFI, Global_TFI_t), + + M_UINT (Packet_Handover_Command_t, ContainerID, 2), + + M_UNION (Packet_Handover_Command_t, 4), + M_TYPE (Packet_Handover_Command_t, u.PS_HandoverTo_A_GB_ModePayload, PS_HandoverTo_A_GB_ModePayload_t), + M_TYPE (Packet_Handover_Command_t, u.PS_HandoverTo_UTRAN_Payload, PS_HandoverTo_UTRAN_Payload_t), + CSN_ERROR (Packet_Handover_Command_t, "10 not implemented", CSN_ERROR_STREAM_NOT_SUPPORTED), + CSN_ERROR (Packet_Handover_Command_t, "11 not implemented", CSN_ERROR_STREAM_NOT_SUPPORTED), +CSN_DESCR_END (Packet_Handover_Command_t) + +/*< End Packet Handover Command >*/ + +/*< Packet Physical Information message content > */ + +static const +CSN_DESCR_BEGIN(Packet_PhysicalInformation_t) + M_UINT (Packet_PhysicalInformation_t, MessageType, 6), + M_UINT (Packet_PhysicalInformation_t, PageMode, 2), + + M_TYPE (Packet_PhysicalInformation_t, Global_TFI, Global_TFI_t), + + M_UINT (Packet_PhysicalInformation_t, TimingAdvance, 8), +CSN_DESCR_END (Packet_PhysicalInformation_t) + +/*< End Packet Physical Information > */ + + +/*< ADDITIONAL MS RADIO ACCESS CAPABILITIES content > */ +static const +CSN_ChoiceElement_t AdditionalMsRadAccessCapID[] = +{ + {1, 0, M_TYPE(AdditionalMsRadAccessCapID_t, u.Global_TFI, Global_TFI_t)}, + {1, 0x01, M_UINT(AdditionalMsRadAccessCapID_t, u.TLLI, 32)}, +}; + +static const +CSN_DESCR_BEGIN(AdditionalMsRadAccessCapID_t) + M_CHOICE (AdditionalMsRadAccessCapID_t, UnionType, AdditionalMsRadAccessCapID, ElementsOf(AdditionalMsRadAccessCapID)), +CSN_DESCR_END (AdditionalMsRadAccessCapID_t) + + +static const +CSN_DESCR_BEGIN (Additional_MS_Rad_Access_Cap_t) + /* Mac header */ + M_UINT (Additional_MS_Rad_Access_Cap_t, PayloadType, 2), + M_UINT (Additional_MS_Rad_Access_Cap_t, spare, 5), + M_UINT (Additional_MS_Rad_Access_Cap_t, R, 1), + M_UINT (Additional_MS_Rad_Access_Cap_t, MESSAGE_TYPE, 6), + /* Mac header */ + + M_TYPE (Additional_MS_Rad_Access_Cap_t, ID, AdditionalMsRadAccessCapID_t), + M_TYPE (Additional_MS_Rad_Access_Cap_t, MS_Radio_Access_capability, MS_Radio_Access_capability_t), +CSN_DESCR_END (Additional_MS_Rad_Access_Cap_t) + + +/*< End ADDITIONAL MS RADIO ACCESS CAPABILITIES > */ + + +/*< Packet Pause content > */ + +static const +CSN_DESCR_BEGIN (Packet_Pause_t) + M_UINT (Packet_Pause_t, MESSAGE_TYPE, 2), + M_UINT (Packet_Pause_t, TLLI, 32), + M_BITMAP (Packet_Pause_t, RAI, 48), +CSN_DESCR_END (Packet_Pause_t) + + +/*< End Packet Pause > */ + + +/*< Packet System Information Type 1 message content >*/ +static const +CSN_DESCR_BEGIN(PSI1_AdditionsR99_t) + M_UINT (PSI1_AdditionsR99_t, MSCR, 1), + M_UINT (PSI1_AdditionsR99_t, SGSNR, 1), + M_UINT (PSI1_AdditionsR99_t, BandIndicator, 1), +CSN_DESCR_END (PSI1_AdditionsR99_t) + +static const +CSN_DESCR_BEGIN(PCCCH_Organization_t) + M_UINT (PCCCH_Organization_t, BS_PCC_REL, 1), + M_UINT (PCCCH_Organization_t, BS_PBCCH_BLKS, 2), + M_UINT (PCCCH_Organization_t, BS_PAG_BLKS_RES, 4), + M_UINT (PCCCH_Organization_t, BS_PRACH_BLKS, 4), +CSN_DESCR_END (PCCCH_Organization_t) + + +static const +CSN_DESCR_BEGIN(PSI1_t) + M_UINT (PSI1_t, MESSAGE_TYPE, 6), + M_UINT (PSI1_t, PAGE_MODE, 2), + + M_UINT (PSI1_t, PBCCH_CHANGE_MARK, 3), + M_UINT (PSI1_t, PSI_CHANGE_FIELD, 4), + M_UINT (PSI1_t, PSI1_REPEAT_PERIOD, 4), + M_UINT (PSI1_t, PSI_COUNT_LR, 6), + + M_NEXT_EXIST (PSI1_t, Exist_PSI_COUNT_HR, 1), + M_UINT (PSI1_t, PSI_COUNT_HR, 4), + + M_UINT (PSI1_t, MEASUREMENT_ORDER, 1), + M_TYPE (PSI1_t, GPRS_Cell_Options, GPRS_Cell_Options_t), + M_TYPE (PSI1_t, PRACH_Control, PRACH_Control_t), + M_TYPE (PSI1_t, PCCCH_Organization, PCCCH_Organization_t), + M_TYPE (PSI1_t, Global_Power_Control_Parameters, Global_Power_Control_Parameters_t), + M_UINT (PSI1_t, PSI_STATUS_IND, 1), + + M_NEXT_EXIST (PSI1_t, Exist_AdditionsR99, 1), + M_TYPE (PSI1_t, AdditionsR99, PSI1_AdditionsR99_t), +CSN_DESCR_END (PSI1_t) +/*< End Packet System Information Type 1 message content >*/ + + +/*< Packet System Information Type 2 message content >*/ + +static const +CSN_DESCR_BEGIN(LAI_t) + M_TYPE (LAI_t, PLMN, PLMN_t), + M_UINT (LAI_t, LAC, 16), +CSN_DESCR_END (LAI_t) + +static const +CSN_DESCR_BEGIN(Cell_Identification_t) + M_TYPE (Cell_Identification_t, LAI, LAI_t), + M_UINT (Cell_Identification_t, RAC, 8), + M_UINT (Cell_Identification_t, Cell_Identity, 16), +CSN_DESCR_END (Cell_Identification_t) + +static const +CSN_DESCR_BEGIN(Non_GPRS_Cell_Options_t) + M_BIT (Non_GPRS_Cell_Options_t, ATT), + + M_NEXT_EXIST (Non_GPRS_Cell_Options_t, Exist_T3212, 1), + M_UINT (Non_GPRS_Cell_Options_t, T3212, 8), + + M_BIT (Non_GPRS_Cell_Options_t, NECI), + M_BIT (Non_GPRS_Cell_Options_t, PWRC), + M_UINT (Non_GPRS_Cell_Options_t, DTX, 2), + M_UINT (Non_GPRS_Cell_Options_t, RADIO_LINK_TIMEOUT, 4), + M_UINT (Non_GPRS_Cell_Options_t, BS_AG_BLKS_RES, 3), + M_UINT (Non_GPRS_Cell_Options_t, CCCH_CONF, 3), + M_UINT (Non_GPRS_Cell_Options_t, BS_PA_MFRMS, 3), + M_UINT (Non_GPRS_Cell_Options_t, MAX_RETRANS, 2), + M_UINT (Non_GPRS_Cell_Options_t, TX_INTEGER, 4), + M_BIT (Non_GPRS_Cell_Options_t, EC), + M_UINT (Non_GPRS_Cell_Options_t, MS_TXPWR_MAX_CCCH, 5), + + M_NEXT_EXIST (Non_GPRS_Cell_Options_t, Exist_Extension_Bits, 1), + M_TYPE (Non_GPRS_Cell_Options_t, Extension_Bits, Extension_Bits_t), +CSN_DESCR_END (Non_GPRS_Cell_Options_t) + +static const +CSN_DESCR_BEGIN(Reference_Frequency_t) + M_UINT(Reference_Frequency_t, NUMBER, 4), + M_UINT_OFFSET(Reference_Frequency_t, Length, 4, 3), + M_VAR_ARRAY (Reference_Frequency_t, Contents[0], Length, 0), +CSN_DESCR_END (Reference_Frequency_t) + +static const +CSN_DESCR_BEGIN(PSI2_MA_t) + M_UINT(PSI2_MA_t, NUMBER, 4), + M_TYPE(PSI2_MA_t, Mobile_Allocation, GPRS_Mobile_Allocation_t), +CSN_DESCR_END (PSI2_MA_t) + +static const +CSN_DESCR_BEGIN(Non_Hopping_PCCCH_Carriers_t) + M_UINT(Non_Hopping_PCCCH_Carriers_t, ARFCN, 10), + M_UINT(Non_Hopping_PCCCH_Carriers_t, TIMESLOT_ALLOCATION, 8), +CSN_DESCR_END (Non_Hopping_PCCCH_Carriers_t) + +static const +CSN_DESCR_BEGIN(NonHoppingPCCCH_t) + M_REC_TARRAY (NonHoppingPCCCH_t, Carriers[0], Non_Hopping_PCCCH_Carriers_t, Count_Carriers), +CSN_DESCR_END (NonHoppingPCCCH_t) + +static const +CSN_DESCR_BEGIN(Hopping_PCCCH_Carriers_t) + M_UINT(Hopping_PCCCH_Carriers_t, MAIO, 6), + M_UINT(Hopping_PCCCH_Carriers_t, TIMESLOT_ALLOCATION, 8), +CSN_DESCR_END (Hopping_PCCCH_Carriers_t) + +static const +CSN_DESCR_BEGIN(HoppingPCCCH_t) + M_UINT(HoppingPCCCH_t, MA_NUMBER, 4), + M_REC_TARRAY (HoppingPCCCH_t, Carriers[0], Hopping_PCCCH_Carriers_t, Count_Carriers), +CSN_DESCR_END (HoppingPCCCH_t) + +static const +CSN_DESCR_BEGIN(PCCCH_Description_t) + M_UINT(PCCCH_Description_t, TSC, 3), + M_UNION (PCCCH_Description_t, 2), + M_TYPE (PCCCH_Description_t, u.NonHopping, NonHoppingPCCCH_t), + M_TYPE (PCCCH_Description_t, u.Hopping, HoppingPCCCH_t), +CSN_DESCR_END (PCCCH_Description_t) + +static const +CSN_DESCR_BEGIN(PSI2_t) + M_UINT (PSI2_t, MESSAGE_TYPE, 6), + M_UINT (PSI2_t, PAGE_MODE, 2), + + M_UINT (PSI2_t, CHANGE_MARK, 2), + M_UINT (PSI2_t, INDEX, 3), + M_UINT (PSI2_t, COUNT, 3), + + M_NEXT_EXIST (PSI2_t, Exist_Cell_Identification, 1), + M_TYPE (PSI2_t, Cell_Identification, Cell_Identification_t), + + M_NEXT_EXIST (PSI2_t, Exist_Non_GPRS_Cell_Options, 1), + M_TYPE (PSI2_t, Non_GPRS_Cell_Options, Non_GPRS_Cell_Options_t), + + M_REC_TARRAY (PSI2_t, Reference_Frequency[0], Reference_Frequency_t, Count_Reference_Frequency), + M_TYPE (PSI2_t, Cell_Allocation, Cell_Allocation_t), + M_REC_TARRAY (PSI2_t, GPRS_MA[0], PSI2_MA_t, Count_GPRS_MA), + M_REC_TARRAY (PSI2_t, PCCCH_Description[0], PCCCH_Description_t, Count_PCCCH_Description), +CSN_DESCR_END (PSI2_t) +/*< End Packet System Information Type 2 message content >*/ + + + +/*< Packet System Information Type 3 message content >*/ +static const +CSN_DESCR_BEGIN(Serving_Cell_params_t) + M_BIT (Serving_Cell_params_t, CELL_BAR_ACCESS_2), + M_BIT (Serving_Cell_params_t, EXC_ACC), + M_UINT (Serving_Cell_params_t, GPRS_RXLEV_ACCESS_MIN, 6), + M_UINT (Serving_Cell_params_t, GPRS_MS_TXPWR_MAX_CCH, 5), + M_NEXT_EXIST (Serving_Cell_params_t, Exist_HCS, 1), + M_TYPE (Serving_Cell_params_t, HCS, HCS_t), + M_UINT (Serving_Cell_params_t, MULTIBAND_REPORTING, 2), +CSN_DESCR_END (Serving_Cell_params_t) + + +static const +CSN_DESCR_BEGIN(Gen_Cell_Sel_t) + M_UINT (Gen_Cell_Sel_t, GPRS_CELL_RESELECT_HYSTERESIS, 3), + M_BIT (Gen_Cell_Sel_t, C31_HYST), + M_BIT (Gen_Cell_Sel_t, C32_QUAL), + M_FIXED (Gen_Cell_Sel_t, 1, 0x01), + + M_NEXT_EXIST (Gen_Cell_Sel_t, Exist_T_RESEL, 1), + M_UINT (Gen_Cell_Sel_t, T_RESEL, 3), + + M_NEXT_EXIST (Gen_Cell_Sel_t, Exist_RA_RESELECT_HYSTERESIS, 1), + M_UINT (Gen_Cell_Sel_t, RA_RESELECT_HYSTERESIS, 3), +CSN_DESCR_END (Gen_Cell_Sel_t) + + +static const +CSN_DESCR_BEGIN(COMPACT_Cell_Sel_t) + M_UINT (COMPACT_Cell_Sel_t, bsic, 6), + M_BIT (COMPACT_Cell_Sel_t, CELL_BAR_ACCESS_2), + M_BIT (COMPACT_Cell_Sel_t, EXC_ACC), + M_BIT (COMPACT_Cell_Sel_t, SAME_RA_AS_SERVING_CELL), + M_NEXT_EXIST (COMPACT_Cell_Sel_t, Exist_GPRS_RXLEV_ACCESS_MIN, 2), + M_UINT (COMPACT_Cell_Sel_t, GPRS_RXLEV_ACCESS_MIN, 6), + M_UINT (COMPACT_Cell_Sel_t, GPRS_MS_TXPWR_MAX_CCH, 5), + M_NEXT_EXIST (COMPACT_Cell_Sel_t, Exist_GPRS_TEMPORARY_OFFSET, 2), + M_UINT (COMPACT_Cell_Sel_t, GPRS_TEMPORARY_OFFSET, 3), + M_UINT (COMPACT_Cell_Sel_t, GPRS_PENALTY_TIME, 5), + M_NEXT_EXIST (COMPACT_Cell_Sel_t, Exist_GPRS_RESELECT_OFFSET, 1), + M_UINT (COMPACT_Cell_Sel_t, GPRS_RESELECT_OFFSET, 5), + M_NEXT_EXIST (COMPACT_Cell_Sel_t, Exist_Hcs_Parm, 1), + M_TYPE (COMPACT_Cell_Sel_t, HCS_Param, HCS_t), + M_NEXT_EXIST (COMPACT_Cell_Sel_t, Exist_TIME_GROUP, 1), + M_UINT (COMPACT_Cell_Sel_t, TIME_GROUP, 2), + M_NEXT_EXIST (COMPACT_Cell_Sel_t, Exist_GUAR_CONSTANT_PWR_BLKS, 1), + M_UINT (COMPACT_Cell_Sel_t, GUAR_CONSTANT_PWR_BLKS, 2), +CSN_DESCR_END (COMPACT_Cell_Sel_t) + +static const +CSN_DESCR_BEGIN(COMPACT_Neighbour_Cell_Param_Remaining_t) + /* this FREQ_DIFF_LENGTH is not initialised, it should be the SAME as COMPACT_Neighbour_Cell_Param_t.FREQ_DIFF_LENGTH. + * So it is buggy, but there is no way to handle it. Same issue is in Cell_Selection_Params_With_FreqDiff_t.FREQ_DIFF_LENGTH. + */ + M_VAR_BITMAP (COMPACT_Neighbour_Cell_Param_Remaining_t, FREQUENCY_DIFF, FREQ_DIFF_LENGTH, 0), + M_TYPE (COMPACT_Neighbour_Cell_Param_Remaining_t, COMPACT_Cell_Sel_Remain_Cells, COMPACT_Cell_Sel_t), +CSN_DESCR_END (COMPACT_Neighbour_Cell_Param_Remaining_t) + + +static const +CSN_DESCR_BEGIN(COMPACT_Neighbour_Cell_Param_t) + M_UINT (COMPACT_Neighbour_Cell_Param_t, START_FREQUENCY, 10), + M_TYPE (COMPACT_Neighbour_Cell_Param_t, COMPACT_Cell_Sel, COMPACT_Cell_Sel_t), + M_UINT (COMPACT_Neighbour_Cell_Param_t, NR_OF_REMAINING_CELLS, 4), + M_UINT_OFFSET(COMPACT_Neighbour_Cell_Param_t, FREQ_DIFF_LENGTH, 3, 1), + M_VAR_TARRAY (COMPACT_Neighbour_Cell_Param_t, COMPACT_Neighbour_Cell_Param_Remaining, COMPACT_Neighbour_Cell_Param_Remaining_t, NR_OF_REMAINING_CELLS), +CSN_DESCR_END (COMPACT_Neighbour_Cell_Param_t) + + +static const +CSN_DESCR_BEGIN(COMPACT_Info_t) + M_TYPE (COMPACT_Info_t, Cell_Identification, Cell_Identification_t), + M_REC_TARRAY (COMPACT_Info_t, COMPACT_Neighbour_Cell_Param, COMPACT_Neighbour_Cell_Param_t, COMPACT_Neighbour_Cell_Param_Count), +CSN_DESCR_END (COMPACT_Info_t) + + +static const +CSN_DESCR_BEGIN(PSI3_AdditionR4_t) + M_NEXT_EXIST (PSI3_AdditionR4_t, Exist_CCN_Support_Desc, 1), + M_TYPE (PSI3_AdditionR4_t, CCN_Support_Desc, CCN_Support_Description_t), +CSN_DESCR_END (PSI3_AdditionR4_t) + + +static const +CSN_DESCR_BEGIN(PSI3_AdditionR99_t) + M_FIXED (PSI3_AdditionR99_t, 2, 0x00), + M_NEXT_EXIST (PSI3_AdditionR99_t, Exist_COMPACT_Info, 1), + M_TYPE (PSI3_AdditionR99_t, COMPACT_Info, COMPACT_Info_t), + M_FIXED (PSI3_AdditionR99_t, 1, 0x00), + M_NEXT_EXIST (PSI3_AdditionR99_t, Exist_AdditionR4, 1), + M_TYPE (PSI3_AdditionR99_t, AdditionR4, PSI3_AdditionR4_t), +CSN_DESCR_END (PSI3_AdditionR99_t) + + +static const +CSN_DESCR_BEGIN(PSI3_AdditionR98_t) + M_TYPE (PSI3_AdditionR98_t, Scell_LSA_ID_Info, LSA_ID_Info_t), + + M_NEXT_EXIST (PSI3_AdditionR98_t, Exist_LSA_Parameters, 1), + M_TYPE (PSI3_AdditionR98_t, LSA_Parameters, LSA_Parameters_t), + + M_NEXT_EXIST (PSI3_AdditionR98_t, Exist_AdditionR99, 1), + M_TYPE (PSI3_AdditionR98_t, AdditionR99, PSI3_AdditionR99_t), +CSN_DESCR_END (PSI3_AdditionR98_t) + + +static const +CSN_DESCR_BEGIN(PSI3_t) + M_UINT (PSI3_t, MESSAGE_TYPE, 6), + M_UINT (PSI3_t, PAGE_MODE, 2), + M_UINT (PSI3_t, CHANGE_MARK, 2), + M_UINT (PSI3_t, BIS_COUNT, 4), + M_TYPE (PSI3_t, Serving_Cell_params, Serving_Cell_params_t), + M_TYPE (PSI3_t, General_Cell_Selection, Gen_Cell_Sel_t), + M_TYPE (PSI3_t, NeighbourCellList, NeighbourCellList_t), + + M_NEXT_EXIST (PSI3_t, Exist_AdditionR98, 1), + M_TYPE (PSI3_t, AdditionR98, PSI3_AdditionR98_t), +CSN_DESCR_END (PSI3_t) +/*< End Packet System Information Type 3 message content >*/ + + +/*< Packet System Information Type 5 message content >*/ +static const +CSN_DESCR_BEGIN(MeasurementParams_t) + M_NEXT_EXIST (MeasurementParams_t, Exist_MULTI_BAND_REPORTING, 1), + M_UINT (MeasurementParams_t, MULTI_BAND_REPORTING, 2), + + M_NEXT_EXIST (MeasurementParams_t, Exist_SERVING_BAND_REPORTING, 1), + M_UINT (MeasurementParams_t, SERVING_BAND_REPORTING, 2), + + M_NEXT_EXIST (MeasurementParams_t, Exist_SCALE_ORD, 1), + M_UINT (MeasurementParams_t, SCALE_ORD, 2), + + M_NEXT_EXIST (MeasurementParams_t, Exist_OffsetThreshold900, 1), + M_TYPE (MeasurementParams_t, OffsetThreshold900, OffsetThreshold_t), + + M_NEXT_EXIST (MeasurementParams_t, Exist_OffsetThreshold1800, 1), + M_TYPE (MeasurementParams_t, OffsetThreshold1800, OffsetThreshold_t), + + M_NEXT_EXIST (MeasurementParams_t, Exist_OffsetThreshold400, 1), + M_TYPE (MeasurementParams_t, OffsetThreshold400, OffsetThreshold_t), + + M_NEXT_EXIST (MeasurementParams_t, Exist_OffsetThreshold1900, 1), + M_TYPE (MeasurementParams_t, OffsetThreshold1900, OffsetThreshold_t), + + M_NEXT_EXIST (MeasurementParams_t, Exist_OffsetThreshold850, 1), + M_TYPE (MeasurementParams_t, OffsetThreshold850, OffsetThreshold_t), +CSN_DESCR_END (MeasurementParams_t) + +static const +CSN_DESCR_BEGIN(GPRSMeasurementParams3G_PSI5_t) + M_NEXT_EXIST (GPRSMeasurementParams3G_PSI5_t, existRepParamsFDD, 2), + M_UINT (GPRSMeasurementParams3G_PSI5_t, RepQuantFDD, 1), + M_UINT (GPRSMeasurementParams3G_PSI5_t, MultiratReportingFDD, 2), + + M_NEXT_EXIST (GPRSMeasurementParams3G_PSI5_t, existReportingParamsFDD, 2), + M_UINT (GPRSMeasurementParams3G_PSI5_t, ReportingOffsetFDD, 3), + M_UINT (GPRSMeasurementParams3G_PSI5_t, ReportingThresholdFDD, 3), + + M_NEXT_EXIST (GPRSMeasurementParams3G_PSI5_t, existMultiratReportingTDD, 1), + M_UINT (GPRSMeasurementParams3G_PSI5_t, MultiratReportingTDD, 2), + + M_NEXT_EXIST (GPRSMeasurementParams3G_PSI5_t, existOffsetThresholdTDD, 2), + M_UINT (GPRSMeasurementParams3G_PSI5_t, ReportingOffsetTDD, 3), + M_UINT (GPRSMeasurementParams3G_PSI5_t, ReportingThresholdTDD, 3), +CSN_DESCR_END (GPRSMeasurementParams3G_PSI5_t) + +static const +CSN_DESCR_BEGIN(ENH_Reporting_Parameters_t) + M_UINT (ENH_Reporting_Parameters_t, REPORT_TYPE, 1), + M_UINT (ENH_Reporting_Parameters_t, REPORTING_RATE, 1), + M_UINT (ENH_Reporting_Parameters_t, INVALID_BSIC_REPORTING, 1), + + M_NEXT_EXIST (ENH_Reporting_Parameters_t, Exist_NCC_PERMITTED, 1), + M_UINT (ENH_Reporting_Parameters_t, NCC_PERMITTED, 8), + + M_NEXT_EXIST (ENH_Reporting_Parameters_t, Exist_GPRSMeasurementParams, 1), + M_TYPE (ENH_Reporting_Parameters_t, GPRSMeasurementParams, MeasurementParams_t), + + M_NEXT_EXIST (ENH_Reporting_Parameters_t, Exist_GPRSMeasurementParams3G, 1), + M_TYPE (ENH_Reporting_Parameters_t, GPRSMeasurementParams3G, GPRSMeasurementParams3G_PSI5_t), +CSN_DESCR_END (ENH_Reporting_Parameters_t) + +static const +CSN_DESCR_BEGIN(PSI5_AdditionsR7) + M_NEXT_EXIST (PSI5_AdditionsR7, Exist_OffsetThreshold_700, 1), + M_TYPE (PSI5_AdditionsR7, OffsetThreshold_700, OffsetThreshold_t), + + M_NEXT_EXIST (PSI5_AdditionsR7, Exist_OffsetThreshold_810, 1), + M_TYPE (PSI5_AdditionsR7, OffsetThreshold_810, OffsetThreshold_t), +CSN_DESCR_END (PSI5_AdditionsR7) + +static const +CSN_DESCR_BEGIN(PSI5_AdditionsR5) + M_NEXT_EXIST (PSI5_AdditionsR5, Exist_GPRS_AdditionalMeasurementParams3G, 1), + M_TYPE (PSI5_AdditionsR5, GPRS_AdditionalMeasurementParams3G, GPRS_AdditionalMeasurementParams3G_t), + + M_NEXT_EXIST (PSI5_AdditionsR5, Exist_AdditionsR7, 1), + M_TYPE (PSI5_AdditionsR5, AdditionsR7, PSI5_AdditionsR7), +CSN_DESCR_END (PSI5_AdditionsR5) + +static const +CSN_DESCR_BEGIN(PSI5_AdditionsR99) + M_NEXT_EXIST (PSI5_AdditionsR99, Exist_ENH_Reporting_Param, 1), + M_TYPE (PSI5_AdditionsR99, ENH_Reporting_Param, ENH_Reporting_Parameters_t), + + M_NEXT_EXIST (PSI5_AdditionsR99, Exist_AdditionsR5, 1), + M_TYPE (PSI5_AdditionsR99, AdditionisR5, PSI5_AdditionsR5), +CSN_DESCR_END (PSI5_AdditionsR99) + +static const +CSN_DESCR_BEGIN(PSI5_t) + M_UINT (PSI5_t, MESSAGE_TYPE, 6), + M_UINT (PSI5_t, PAGE_MODE, 2), + M_UINT (PSI5_t, CHANGE_MARK, 2), + M_UINT (PSI5_t, INDEX, 3), + M_UINT (PSI5_t, COUNT, 3), + + M_NEXT_EXIST (PSI5_t, Eixst_NC_Meas_Param, 1), + M_TYPE (PSI5_t, NC_Meas_Param, NC_Measurement_Parameters_t), + + M_FIXED (PSI5_t, 1, 0x00), + + M_NEXT_EXIST (PSI5_t, Exist_AdditionsR99, 1), + M_TYPE (PSI5_t, AdditionsR99, PSI5_AdditionsR99), +CSN_DESCR_END (PSI5_t) +/*< End Packet System Information Type 5 message content >*/ + + +/*< Packet System Information Type 13 message content >*/ +static const +CSN_DESCR_BEGIN(PSI13_AdditionsR6) + M_NEXT_EXIST (PSI13_AdditionsR6, Exist_LB_MS_TXPWR_MAX_CCH, 1), + M_UINT (PSI13_AdditionsR6, LB_MS_TXPWR_MAX_CCH, 5), + M_UINT (PSI13_AdditionsR6, SI2n_SUPPORT, 2), +CSN_DESCR_END (PSI13_AdditionsR6) + +static const +CSN_DESCR_BEGIN(PSI13_AdditionsR4) + M_UINT (PSI13_AdditionsR4, SI_STATUS_IND, 1), + M_NEXT_EXIST (PSI13_AdditionsR4, Exist_AdditionsR6, 1), + M_TYPE (PSI13_AdditionsR4, AdditionsR6, PSI13_AdditionsR6), +CSN_DESCR_END (PSI13_AdditionsR4) + +static const +CSN_DESCR_BEGIN(PSI13_AdditionR99) + M_UINT (PSI13_AdditionR99, SGSNR, 1), + M_NEXT_EXIST (PSI13_AdditionR99, Exist_AdditionsR4, 1), + M_TYPE (PSI13_AdditionR99, AdditionsR4, PSI13_AdditionsR4), +CSN_DESCR_END (PSI13_AdditionR99) + +static const +CSN_DESCR_BEGIN(PSI13_t) + M_UINT (PSI13_t, MESSAGE_TYPE, 6), + M_UINT (PSI13_t, PAGE_MODE, 2), + M_UINT (PSI13_t, BCCH_CHANGE_MARK, 3), + M_UINT (PSI13_t, SI_CHANGE_FIELD, 4), + + M_NEXT_EXIST (PSI13_t, Exist_MA, 2), + M_UINT (PSI13_t, SI13_CHANGE_MARK, 2), + M_TYPE (PSI13_t, GPRS_Mobile_Allocation, GPRS_Mobile_Allocation_t), + + M_UNION (PSI13_t, 2), + M_TYPE (PSI13_t, u.PBCCH_Not_present, PBCCH_Not_present_t), + M_TYPE (PSI13_t, u.PBCCH_present, PBCCH_present_t), + + M_NEXT_EXIST (PSI13_t, Exist_AdditionsR99, 1), + M_TYPE (PSI13_t, AdditionsR99, PSI13_AdditionR99), +CSN_DESCR_END (PSI13_t) +/*< End Packet System Information Type 13 message content >*/ + + + +//typedef char* MT_Strings_t; + +static const char* szMT_Downlink[] = { + "Invalid Message Type", /* 0x00 */ + "PACKET_CELL_CHANGE_ORDER", /* 0x01 */ + "PACKET_DOWNLINK_ASSIGNMENT", /* 0x02 */ + "PACKET_MEASUREMENT_ORDER", /* 0x03 */ + "PACKET_POLLING_REQUEST", /* 0x04 */ + "PACKET_POWER_CONTROL_TIMING_ADVANCE", /* 0x05 */ + "PACKET_QUEUEING_NOTIFICATION", /* 0x06 */ + "PACKET_TIMESLOT_RECONFIGURE", /* 0x07 */ + "PACKET_TBF_RELEASE", /* 0x08 */ + "PACKET_UPLINK_ACK_NACK", /* 0x09 */ + "PACKET_UPLINK_ASSIGNMENT", /* 0x0A */ + "PACKET_CELL_CHANGE_CONTINUE", /* 0x0B */ + "PACKET_NEIGHBOUR_CELL_DATA", /* 0x0C */ + "PACKET_SERVING_CELL_DATA", /* 0x0D */ + "Invalid Message Type", /* 0x0E */ + "Invalid Message Type", /* 0x0F */ + "Invalid Message Type", /* 0x10 */ + "Invalid Message Type", /* 0x11 */ + "Invalid Message Type", /* 0x12 */ + "Invalid Message Type", /* 0x13 */ + "Invalid Message Type", /* 0x14 */ + "PACKET_HANDOVER_COMMAND", /* 0x15 */ + "PACKET_PHYSICAL_INFORMATION", /* 0x16 */ + "Invalid Message Type", /* 0x17 */ + "Invalid Message Type", /* 0x18 */ + "Invalid Message Type", /* 0x19 */ + "Invalid Message Type", /* 0x1A */ + "Invalid Message Type", /* 0x1B */ + "Invalid Message Type", /* 0x1C */ + "Invalid Message Type", /* 0x1D */ + "Invalid Message Type", /* 0x1E */ + "Invalid Message Type", /* 0x1F */ + "Invalid Message Type", /* 0x20 */ + "PACKET_ACCESS_REJECT", /* 0x21 */ + "PACKET_PAGING_REQUEST", /* 0x22 */ + "PACKET_PDCH_RELEASE", /* 0x23 */ + "PACKET_PRACH_PARAMETERS", /* 0x24 */ + "PACKET_DOWNLINK_DUMMY_CONTROL_BLOCK", /* 0x25 */ + "Invalid Message Type", /* 0x26 */ + "Invalid Message Type", /* 0x27 */ + "Invalid Message Type", /* 0x28 */ + "Invalid Message Type", /* 0x29 */ + "Invalid Message Type", /* 0x2A */ + "Invalid Message Type", /* 0x2B */ + "Invalid Message Type", /* 0x2C */ + "Invalid Message Type", /* 0x2D */ + "Invalid Message Type", /* 0x2E */ + "Invalid Message Type", /* 0x2F */ + "PACKET_SYSTEM_INFO_6", /* 0x30 */ + "PACKET_SYSTEM_INFO_1", /* 0x31 */ + "PACKET_SYSTEM_INFO_2", /* 0x32 */ + "PACKET_SYSTEM_INFO_3", /* 0x33 */ + "PACKET_SYSTEM_INFO_3_BIS", /* 0x34 */ + "PACKET_SYSTEM_INFO_4", /* 0x35 */ + "PACKET_SYSTEM_INFO_5", /* 0x36 */ + "PACKET_SYSTEM_INFO_13", /* 0x37 */ + "PACKET_SYSTEM_INFO_7", /* 0x38 */ + "PACKET_SYSTEM_INFO_8", /* 0x39 */ + "PACKET_SYSTEM_INFO_14", /* 0x3A */ + "Invalid Message Type", /* 0x3B */ + "PACKET_SYSTEM_INFO_3_TER", /* 0x3C */ + "PACKET_SYSTEM_INFO_3_QUATER", /* 0x3D */ + "PACKET_SYSTEM_INFO_15" /* 0x3E */ +}; + +static const char* szMT_Uplink[] = { + "PACKET_CELL_CHANGE_FAILURE", /* 0x00 */ + "PACKET_CONTROL_ACKNOWLEDGEMENT", /* 0x01 */ + "PACKET_DOWNLINK_ACK_NACK", /* 0x02 */ + "PACKET_UPLINK_DUMMY_CONTROL_BLOCK", /* 0x03 */ + "PACKET_MEASUREMENT_REPORT", /* 0x04 */ + "PACKET_RESOURCE_REQUEST", /* 0x05 */ + "PACKET_MOBILE_TBF_STATUS", /* 0x06 */ + "PACKET_PSI_STATUS", /* 0x07 */ + "EGPRS_PACKET_DOWNLINK_ACK_NACK", /* 0x08 */ + "PACKET_PAUSE", /* 0x09 */ + "PACKET_ENHANCED_MEASUREMENT_REPORT", /* 0x0A */ + "ADDITIONAL_MS_RAC", /* 0x0B */ + "PACKET_CELL_CHANGE_NOTIFICATION", /* 0x0C */ + "PACKET_SI_STATUS", /* 0x0D */ +}; + +const char* +MT_DL_TextGet(guint8 mt) +{ + if (mt < ElementsOf(szMT_Downlink)) + { + return(szMT_Downlink[mt]); + } + else + { + return("Unknown message type"); + } +} + +const char* +MT_UL_TextGet(guint8 mt) +{ + if (mt < ElementsOf(szMT_Uplink)) + { + return(szMT_Uplink[mt]); + } + else + { + return("Unknown message type"); + } +} + + +/* SI1_RestOctet_t */ + +static const +CSN_DESCR_BEGIN (SI1_RestOctet_t) + M_NEXT_EXIST_LH(SI1_RestOctet_t, Exist_NCH_Position, 1), + M_UINT (SI1_RestOctet_t, NCH_Position, 5), + + M_UINT_LH (SI1_RestOctet_t, BandIndicator, 1), +CSN_DESCR_END (SI1_RestOctet_t) + +/* SI3_Rest_Octet_t */ +static const +CSN_DESCR_BEGIN(Selection_Parameters_t) + M_UINT (Selection_Parameters_t, CBQ, 1), + M_UINT (Selection_Parameters_t, CELL_RESELECT_OFFSET, 6), + M_UINT (Selection_Parameters_t, TEMPORARY_OFFSET, 3), + M_UINT (Selection_Parameters_t, PENALTY_TIME, 5), +CSN_DESCR_END (Selection_Parameters_t) + +static const +CSN_DESCR_BEGIN (SI3_Rest_Octet_t) + M_NEXT_EXIST_LH(SI3_Rest_Octet_t, Exist_Selection_Parameters, 1), + M_TYPE (SI3_Rest_Octet_t, Selection_Parameters, Selection_Parameters_t), + + M_NEXT_EXIST_LH(SI3_Rest_Octet_t, Exist_Power_Offset, 1), + M_UINT (SI3_Rest_Octet_t, Power_Offset, 2), + + M_UINT_LH (SI3_Rest_Octet_t, System_Information_2ter_Indicator, 1), + M_UINT_LH (SI3_Rest_Octet_t, Early_Classmark_Sending_Control, 1), + + M_NEXT_EXIST_LH(SI3_Rest_Octet_t, Exist_WHERE, 1), + M_UINT (SI3_Rest_Octet_t, WHERE, 3), + + M_NEXT_EXIST_LH(SI3_Rest_Octet_t, Exist_GPRS_Indicator, 2), + M_UINT (SI3_Rest_Octet_t, RA_COLOUR, 3), + M_UINT (SI3_Rest_Octet_t, SI13_POSITION, 1), + + M_UINT_LH (SI3_Rest_Octet_t, ECS_Restriction3G, 1), + + M_NEXT_EXIST_LH(SI3_Rest_Octet_t, ExistSI2quaterIndicator, 1), + M_UINT (SI3_Rest_Octet_t, SI2quaterIndicator, 1), +CSN_DESCR_END (SI3_Rest_Octet_t) + +static const +CSN_DESCR_BEGIN (SI4_Rest_Octet_t) + M_NEXT_EXIST_LH(SI4_Rest_Octet_t, Exist_Selection_Parameters, 1), + M_TYPE (SI4_Rest_Octet_t, Selection_Parameters, Selection_Parameters_t), + + M_NEXT_EXIST_LH(SI4_Rest_Octet_t, Exist_Power_Offset, 1), + M_UINT (SI4_Rest_Octet_t, Power_Offset, 2), + + M_NEXT_EXIST_LH(SI4_Rest_Octet_t, Exist_GPRS_Indicator, 2), + M_UINT (SI4_Rest_Octet_t, RA_COLOUR, 3), + M_UINT (SI4_Rest_Octet_t, SI13_POSITION, 1), +CSN_DESCR_END (SI4_Rest_Octet_t) + +/* SI6_RestOctet_t */ + +static const +CSN_DESCR_BEGIN(PCH_and_NCH_Info_t) + M_UINT (PCH_and_NCH_Info_t, PagingChannelRestructuring, 1), + M_UINT (PCH_and_NCH_Info_t, NLN_SACCH, 2), + + M_NEXT_EXIST (PCH_and_NCH_Info_t, Exist_CallPriority, 1), + M_UINT (PCH_and_NCH_Info_t, CallPriority, 3), + + M_UINT (PCH_and_NCH_Info_t, NLN_Status, 1), +CSN_DESCR_END (PCH_and_NCH_Info_t) + +static const +CSN_DESCR_BEGIN (SI6_RestOctet_t) + M_NEXT_EXIST_LH(SI6_RestOctet_t, Exist_PCH_and_NCH_Info, 1), + M_TYPE (SI6_RestOctet_t, PCH_and_NCH_Info, PCH_and_NCH_Info_t), + + M_NEXT_EXIST_LH(SI6_RestOctet_t, Exist_VBS_VGCS_Options, 1), + M_UINT (SI6_RestOctet_t, VBS_VGCS_Options, 2), + + M_NEXT_EXIST_LH(SI6_RestOctet_t, Exist_DTM_Support, 2), + M_UINT (SI6_RestOctet_t, RAC, 8), + M_UINT (SI6_RestOctet_t, MAX_LAPDm, 3), + + M_UINT_LH (SI6_RestOctet_t, BandIndicator, 1), +CSN_DESCR_END (SI6_RestOctet_t) + +void decode_gsm_rlcmac_uplink(bitvec * vector, RlcMacUplink_t * data) +{ + csnStream_t ar; + size_t readIndex = 0; + guint8 payload_type = bitvec_read_field(vector, readIndex, 2); + + if (payload_type == PAYLOAD_TYPE_DATA) + { + LOGPC(DRLCMACDATA, LOGL_NOTICE, "Payload Type: DATA (0), not implemented"); + return; + } + else if (payload_type == PAYLOAD_TYPE_RESERVED) + { + LOGPC(DRLCMACDATA, LOGL_NOTICE, "Payload Type: RESERVED (3)"); + return; + } + data->NrOfBits = (23 - 1) * 8; + csnStreamInit(&ar, 0, data->NrOfBits); + readIndex += 6; + data->u.MESSAGE_TYPE = bitvec_read_field(vector, readIndex, 6); + readIndex = 0; + switch (data->u.MESSAGE_TYPE) + { + case MT_PACKET_CELL_CHANGE_FAILURE: + { + /* + * data is the pointer to the unpack struct that hold the unpack value + * CSNDESCR is an array that holds the different element types + * ar is the csn context holding the bitcount, offset and output + */ + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Cell_Change_Failure_t), vector, readIndex, &data->u.Packet_Cell_Change_Failure); + break; + } + case MT_PACKET_CONTROL_ACK: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Control_Acknowledgement_t), vector, readIndex, &data->u.Packet_Control_Acknowledgement); + break; + } + case MT_PACKET_DOWNLINK_ACK_NACK: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Downlink_Ack_Nack_t), vector, readIndex, &data->u.Packet_Downlink_Ack_Nack); + break; + } + case MT_PACKET_UPLINK_DUMMY_CONTROL_BLOCK: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Uplink_Dummy_Control_Block_t), vector, readIndex, &data->u.Packet_Uplink_Dummy_Control_Block); + break; + } + case MT_PACKET_MEASUREMENT_REPORT: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Measurement_Report_t), vector, readIndex, &data->u.Packet_Measurement_Report); + break; + } + case MT_PACKET_RESOURCE_REQUEST: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Resource_Request_t), vector, readIndex, &data->u.Packet_Resource_Request); + break; + } + + case MT_PACKET_MOBILE_TBF_STATUS: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Mobile_TBF_Status_t), vector, readIndex, &data->u.Packet_Mobile_TBF_Status); + break; + } + case MT_PACKET_PSI_STATUS: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_PSI_Status_t), vector, readIndex, &data->u.Packet_PSI_Status); + break; + } + case MT_EGPRS_PACKET_DOWNLINK_ACK_NACK: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(EGPRS_PD_AckNack_t), vector, readIndex, &data->u.Egprs_Packet_Downlink_Ack_Nack); + break; + } + case MT_PACKET_PAUSE: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Pause_t), vector, readIndex, &data->u.Packet_Pause); + break; + } + case MT_PACKET_ENHANCED_MEASUREMENT_REPORT: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Enh_Measurement_Report_t), vector, readIndex, &data->u.Packet_Enh_Measurement_Report); + break; + } + case MT_ADDITIONAL_MS_RAC: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Additional_MS_Rad_Access_Cap_t), vector, readIndex, &data->u.Additional_MS_Rad_Access_Cap); + break; + } + case MT_PACKET_CELL_CHANGE_NOTIFICATION: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Cell_Change_Notification_t), vector, readIndex, &data->u.Packet_Cell_Change_Notification); + break; + } + case MT_PACKET_SI_STATUS: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_SI_Status_t), vector, readIndex, &data->u.Packet_SI_Status); + break; + } + default: + /*ret = -1;*/ + break; + } +} + +void decode_gsm_rlcmac_downlink(bitvec * vector, RlcMacDownlink_t * data) +{ + csnStream_t ar; + /* See RLC/MAC downlink control block structure in TS 44.060 / 10.3.1 */ + gint bit_offset = 0; + gint bit_length; + size_t readIndex = 0; + data->PAYLOAD_TYPE = bitvec_read_field(vector, readIndex, 2); + data->RRBP = bitvec_read_field(vector, readIndex, 2); + data->SP = bitvec_read_field(vector, readIndex, 1); + data->USF = bitvec_read_field(vector, readIndex, 3); + + if (data->PAYLOAD_TYPE == PAYLOAD_TYPE_DATA) + { + LOGPC(DRLCMACDATA, LOGL_NOTICE, "Payload Type: DATA (0), not implemented"); + return; + } + else if (data->PAYLOAD_TYPE == PAYLOAD_TYPE_RESERVED) + { + LOGPC(DRLCMACDATA, LOGL_NOTICE, "Payload Type: RESERVED (3)"); + return; + } + /* We can decode the message */ + else + { + /* First print the message type and create a tree item */ + bit_offset = 8; + if (data->PAYLOAD_TYPE == PAYLOAD_TYPE_CTRL_OPT_OCTET) + { + data->RBSN = bitvec_read_field(vector, readIndex, 1); + data->RTI = bitvec_read_field(vector, readIndex, 5); + data->FS = bitvec_read_field(vector, readIndex, 1); + data->AC = bitvec_read_field(vector, readIndex, 1); + bit_offset += 8; + if (data->AC == 1) + { + data->PR = bitvec_read_field(vector, readIndex, 2); + data->TFI = bitvec_read_field(vector, readIndex, 5); + data->D = bitvec_read_field(vector, readIndex, 1); + bit_offset += 8; + } + if ((data->RBSN == 1) && (data->FS == 0)) + { + data->RBSNe = bitvec_read_field(vector, readIndex, 3); + data->FSe = bitvec_read_field(vector, readIndex, 1); + data->spare = bitvec_read_field(vector, readIndex, 4); + bit_offset += 8; + } + } + data->u.MESSAGE_TYPE = bitvec_read_field(vector, readIndex, 6); + } + + /* Initialize the contexts */ + bit_length = 23*8 - bit_offset; + data->NrOfBits = bit_length; + readIndex = bit_offset; + + csnStreamInit(&ar, bit_offset, bit_length); + + switch (data->u.MESSAGE_TYPE) + { + case MT_PACKET_ACCESS_REJECT: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Access_Reject_t), vector, readIndex, &data->u.Packet_Access_Reject); + break; + } + case MT_PACKET_CELL_CHANGE_ORDER: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Cell_Change_Order_t), vector, readIndex, &data->u.Packet_Cell_Change_Order); + break; + } + case MT_PACKET_CELL_CHANGE_CONTINUE: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Cell_Change_Continue_t), vector, readIndex, &data->u.Packet_Cell_Change_Continue); + break; + } + case MT_PACKET_DOWNLINK_ASSIGNMENT: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Downlink_Assignment_t), vector, readIndex, &data->u.Packet_Downlink_Assignment); + break; + } + case MT_PACKET_MEASUREMENT_ORDER: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Measurement_Order_t), vector, readIndex, &data->u.Packet_Measurement_Order); + break; + } + case MT_PACKET_NEIGHBOUR_CELL_DATA: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Neighbour_Cell_Data_t), vector, readIndex, &data->u.Packet_Neighbour_Cell_Data); + break; + } + case MT_PACKET_SERVING_CELL_DATA: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Serving_Cell_Data_t), vector, readIndex, &data->u.Packet_Serving_Cell_Data); + break; + } + case MT_PACKET_PAGING_REQUEST: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Paging_Request_t), vector, readIndex, &data->u.Packet_Paging_Request); + break; + } + case MT_PACKET_PDCH_RELEASE: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_PDCH_Release_t), vector, readIndex, &data->u.Packet_PDCH_Release); + break; + } + case MT_PACKET_POLLING_REQ: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Polling_Request_t), vector, readIndex, &data->u.Packet_Polling_Request); + break; + } + case MT_PACKET_POWER_CONTROL_TIMING_ADVANCE: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Power_Control_Timing_Advance_t), vector, readIndex, &data->u.Packet_Power_Control_Timing_Advance); + break; + } + case MT_PACKET_PRACH_PARAMETERS: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_PRACH_Parameters_t), vector, readIndex, &data->u.Packet_PRACH_Parameters); + break; + } + case MT_PACKET_QUEUEING_NOTIFICATION: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Queueing_Notification_t), vector, readIndex, &data->u.Packet_Queueing_Notification); + break; + } + case MT_PACKET_TIMESLOT_RECONFIGURE: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Timeslot_Reconfigure_t), vector, readIndex, &data->u.Packet_Timeslot_Reconfigure); + break; + } + case MT_PACKET_TBF_RELEASE: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_TBF_Release_t), vector, readIndex, &data->u.Packet_TBF_Release); + break; + } + case MT_PACKET_UPLINK_ACK_NACK: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Uplink_Ack_Nack_t), vector, readIndex, &data->u.Packet_Uplink_Ack_Nack); + break; + } + case MT_PACKET_UPLINK_ASSIGNMENT: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Uplink_Assignment_t), vector, readIndex, &data->u.Packet_Uplink_Assignment); + break; + } + case MT_PACKET_HANDOVER_COMMAND: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Handover_Command_t), vector, readIndex, &data->u.Packet_Handover_Command); + break; + } + case MT_PACKET_PHYSICAL_INFORMATION: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_PhysicalInformation_t), vector, readIndex, &data->u.Packet_Handover_Command); + break; + } + case MT_PACKET_DOWNLINK_DUMMY_CONTROL_BLOCK: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(Packet_Downlink_Dummy_Control_Block_t), vector, readIndex, &data->u.Packet_Downlink_Dummy_Control_Block); + break; + } + case MT_PACKET_SYSTEM_INFO_1: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(PSI1_t), vector, readIndex, &data->u.PSI1); + break; + } + case MT_PACKET_SYSTEM_INFO_2: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(PSI2_t), vector, readIndex, &data->u.PSI2); + break; + } + case MT_PACKET_SYSTEM_INFO_3: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(PSI3_t), vector, readIndex, &data->u.PSI3); + break; + } + case MT_PACKET_SYSTEM_INFO_5: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(PSI5_t), vector, readIndex, &data->u.PSI5); + break; + } + case MT_PACKET_SYSTEM_INFO_13: + { + /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(PSI13_t), vector, readIndex, &data->u.PSI13); + break; + } + default: + /*ret = -1;*/ + break; + } +} + +void encode_gsm_rlcmac_uplink(bitvec * vector, RlcMacUplink_t * data) +{ + csnStream_t ar; + size_t writeIndex = 0; + data->NrOfBits = (23 - 1) * 8; + csnStreamInit(&ar, 0, data->NrOfBits); + writeIndex = 0; + switch (data->u.MESSAGE_TYPE) + { + case MT_PACKET_CELL_CHANGE_FAILURE: + { + /* + * data is the pointer to the unpack struct that hold the unpack value + * CSNDESCR is an array that holds the different element types + * ar is the csn context holding the bitcount, offset and output + */ + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Cell_Change_Failure_t), vector, writeIndex, &data->u.Packet_Cell_Change_Failure); + break; + } + case MT_PACKET_CONTROL_ACK: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Control_Acknowledgement_t), vector, writeIndex, &data->u.Packet_Control_Acknowledgement); + break; + } + case MT_PACKET_DOWNLINK_ACK_NACK: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Downlink_Ack_Nack_t), vector, writeIndex, &data->u.Packet_Downlink_Ack_Nack); + break; + } + case MT_PACKET_UPLINK_DUMMY_CONTROL_BLOCK: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Uplink_Dummy_Control_Block_t), vector, writeIndex, &data->u.Packet_Uplink_Dummy_Control_Block); + break; + } + case MT_PACKET_MEASUREMENT_REPORT: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Measurement_Report_t), vector, writeIndex, &data->u.Packet_Measurement_Report); + break; + } + case MT_PACKET_RESOURCE_REQUEST: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Resource_Request_t), vector, writeIndex, &data->u.Packet_Resource_Request); + break; + } + + case MT_PACKET_MOBILE_TBF_STATUS: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Mobile_TBF_Status_t), vector, writeIndex, &data->u.Packet_Mobile_TBF_Status); + break; + } + case MT_PACKET_PSI_STATUS: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_PSI_Status_t), vector, writeIndex, &data->u.Packet_PSI_Status); + break; + } + case MT_EGPRS_PACKET_DOWNLINK_ACK_NACK: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(EGPRS_PD_AckNack_t), vector, writeIndex, &data->u.Egprs_Packet_Downlink_Ack_Nack); + break; + } + case MT_PACKET_PAUSE: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Pause_t), vector, writeIndex, &data->u.Packet_Pause); + break; + } + case MT_PACKET_ENHANCED_MEASUREMENT_REPORT: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Enh_Measurement_Report_t), vector, writeIndex, &data->u.Packet_Enh_Measurement_Report); + break; + } + case MT_ADDITIONAL_MS_RAC: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Additional_MS_Rad_Access_Cap_t), vector, writeIndex, &data->u.Additional_MS_Rad_Access_Cap); + break; + } + case MT_PACKET_CELL_CHANGE_NOTIFICATION: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Cell_Change_Notification_t), vector, writeIndex, &data->u.Packet_Cell_Change_Notification); + break; + } + case MT_PACKET_SI_STATUS: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_SI_Status_t), vector, writeIndex, &data->u.Packet_SI_Status); + break; + } + default: + /*ret = -1;*/ + break; + } +} + +void encode_gsm_rlcmac_downlink(bitvec * vector, RlcMacDownlink_t * data) +{ + csnStream_t ar; + + /* See RLC/MAC downlink control block structure in TS 44.060 / 10.3.1 */ + gint bit_offset = 0; + gint bit_length; + size_t writeIndex = 0; + + if (data->PAYLOAD_TYPE == PAYLOAD_TYPE_DATA) + { + LOGPC(DRLCMACDATA, LOGL_NOTICE, "Payload Type: DATA (0), not implemented"); + return; + } + else if (data->PAYLOAD_TYPE == PAYLOAD_TYPE_RESERVED) + { + LOGPC(DRLCMACDATA, LOGL_NOTICE, "Payload Type: RESERVED (3)"); + return; + } + /* We can decode the message */ + else + { + /* First print the message type and create a tree item */ + bitvec_write_field(vector, writeIndex, data->PAYLOAD_TYPE, 2); + bitvec_write_field(vector, writeIndex, data->RRBP, 2); + bitvec_write_field(vector, writeIndex, data->SP, 1); + bitvec_write_field(vector, writeIndex, data->USF, 3); + bit_offset = 8; + if (data->PAYLOAD_TYPE == PAYLOAD_TYPE_CTRL_OPT_OCTET) + { + bitvec_write_field(vector, writeIndex, data->RBSN, 1); + bitvec_write_field(vector, writeIndex, data->RTI, 5); + bitvec_write_field(vector, writeIndex, data->FS, 1); + bitvec_write_field(vector, writeIndex, data->AC, 1); + bit_offset += 8; + if (data->AC == 1) + { + bitvec_write_field(vector, writeIndex, data->PR, 2); + bitvec_write_field(vector, writeIndex, data->TFI, 5); + bitvec_write_field(vector, writeIndex, data->D, 1); + bit_offset += 8; + } + if ((data->RBSN == 1) && (data->FS == 0)) + { + bitvec_write_field(vector, writeIndex, data->RBSNe, 3); + bitvec_write_field(vector, writeIndex, data->FSe, 1); + bitvec_write_field(vector, writeIndex, data->spare, 4); + bit_offset += 8; + } + } + } + + /* Initialize the contexts */ + bit_length = 23*8 - bit_offset; + data->NrOfBits = bit_length; + + csnStreamInit(&ar, bit_offset, bit_length); + + switch (data->u.MESSAGE_TYPE) + { + case MT_PACKET_ACCESS_REJECT: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Access_Reject_t), vector, writeIndex, &data->u.Packet_Access_Reject); + break; + } + case MT_PACKET_CELL_CHANGE_ORDER: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Cell_Change_Order_t), vector, writeIndex, &data->u.Packet_Cell_Change_Order); + break; + } + case MT_PACKET_CELL_CHANGE_CONTINUE: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Cell_Change_Continue_t), vector, writeIndex, &data->u.Packet_Cell_Change_Continue); + break; + } + case MT_PACKET_DOWNLINK_ASSIGNMENT: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Downlink_Assignment_t), vector, writeIndex, &data->u.Packet_Downlink_Assignment); + break; + } + case MT_PACKET_MEASUREMENT_ORDER: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Measurement_Order_t), vector, writeIndex, &data->u.Packet_Measurement_Order); + break; + } + case MT_PACKET_NEIGHBOUR_CELL_DATA: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Neighbour_Cell_Data_t), vector, writeIndex, &data->u.Packet_Neighbour_Cell_Data); + break; + } + case MT_PACKET_SERVING_CELL_DATA: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Serving_Cell_Data_t), vector, writeIndex, &data->u.Packet_Serving_Cell_Data); + break; + } + case MT_PACKET_PAGING_REQUEST: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Paging_Request_t), vector, writeIndex, &data->u.Packet_Paging_Request); + break; + } + case MT_PACKET_PDCH_RELEASE: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_PDCH_Release_t), vector, writeIndex, &data->u.Packet_PDCH_Release); + break; + } + case MT_PACKET_POLLING_REQ: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Polling_Request_t), vector, writeIndex, &data->u.Packet_Polling_Request); + break; + } + case MT_PACKET_POWER_CONTROL_TIMING_ADVANCE: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Power_Control_Timing_Advance_t), vector, writeIndex, &data->u.Packet_Power_Control_Timing_Advance); + break; + } + case MT_PACKET_PRACH_PARAMETERS: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_PRACH_Parameters_t), vector, writeIndex, &data->u.Packet_PRACH_Parameters); + break; + } + case MT_PACKET_QUEUEING_NOTIFICATION: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Queueing_Notification_t), vector, writeIndex, &data->u.Packet_Queueing_Notification); + break; + } + case MT_PACKET_TIMESLOT_RECONFIGURE: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Timeslot_Reconfigure_t), vector, writeIndex, &data->u.Packet_Timeslot_Reconfigure); + break; + } + case MT_PACKET_TBF_RELEASE: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_TBF_Release_t), vector, writeIndex, &data->u.Packet_TBF_Release); + break; + } + case MT_PACKET_UPLINK_ACK_NACK: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Uplink_Ack_Nack_t), vector, writeIndex, &data->u.Packet_Uplink_Ack_Nack); + break; + } + case MT_PACKET_UPLINK_ASSIGNMENT: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Uplink_Assignment_t), vector, writeIndex, &data->u.Packet_Uplink_Assignment); + break; + } + case MT_PACKET_HANDOVER_COMMAND: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Handover_Command_t), vector, writeIndex, &data->u.Packet_Handover_Command); + break; + } + case MT_PACKET_PHYSICAL_INFORMATION: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_PhysicalInformation_t), vector, writeIndex, &data->u.Packet_Handover_Command); + break; + } + case MT_PACKET_DOWNLINK_DUMMY_CONTROL_BLOCK: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(Packet_Downlink_Dummy_Control_Block_t), vector, writeIndex, &data->u.Packet_Downlink_Dummy_Control_Block); + break; + } + case MT_PACKET_SYSTEM_INFO_1: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(PSI1_t), vector, writeIndex, &data->u.PSI1); + break; + } + case MT_PACKET_SYSTEM_INFO_2: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(PSI2_t), vector, writeIndex, &data->u.PSI2); + break; + } + case MT_PACKET_SYSTEM_INFO_3: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(PSI3_t), vector, writeIndex, &data->u.PSI3); + break; + } + case MT_PACKET_SYSTEM_INFO_5: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(PSI5_t), vector, writeIndex, &data->u.PSI5); + break; + } + case MT_PACKET_SYSTEM_INFO_13: + { + /*ret =*/ csnStreamEncoder(&ar, CSNDESCR(PSI13_t), vector, writeIndex, &data->u.PSI13); + break; + } + default: + /*ret = -1;*/ + break; + } +} + +void decode_gsm_rlcmac_uplink_data(bitvec * vector, RlcMacUplinkDataBlock_t * data) +{ + size_t readIndex = 0; + //unsigned dataLen = 0; + guint8 payload_type = bitvec_read_field(vector, readIndex, 2); + if (payload_type == PAYLOAD_TYPE_DATA) + { + readIndex = 0; + // MAC header + data->PAYLOAD_TYPE = bitvec_read_field(vector, readIndex, 2); + data->CV = bitvec_read_field(vector, readIndex, 4); + data->SI = bitvec_read_field(vector, readIndex, 1); + data->R = bitvec_read_field(vector, readIndex, 1); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "PAYLOAD_TYPE = %u ", (unsigned)(data->PAYLOAD_TYPE)); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "CV = %u ", (unsigned)(data->CV)); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "SI = %u ", (unsigned)(data->SI)); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "R = %u ", (unsigned)(data->R)); + // Octet 1 + data->spare = bitvec_read_field(vector, readIndex, 1); + data->PI = bitvec_read_field(vector, readIndex, 1); + data->TFI = bitvec_read_field(vector, readIndex, 5); + data->TI = bitvec_read_field(vector, readIndex, 1); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "spare = %u ", (unsigned)(data->spare)); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "PI = %u ", (unsigned)(data->PI)); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "TFI = %u ", (unsigned)(data->TFI)); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "TI = %u ", (unsigned)(data->TI)); + + // Octet 2 + data->BSN = bitvec_read_field(vector, readIndex, 7); + data->E_1 = bitvec_read_field(vector, readIndex, 1); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "BSN = %u ", (unsigned)(data->BSN)); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "E_1 = %u ", (unsigned)(data->E_1)); + + + if(data->E_1 == 0) // Extension octet follows immediately + { + // Octet 3 (optional) + unsigned i = 0; + do + { + data->LENGTH_INDICATOR[i] = bitvec_read_field(vector, readIndex, 6); + data->M[i] = bitvec_read_field(vector, readIndex, 1); + data->E[i] = bitvec_read_field(vector, readIndex, 1); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "LENGTH_INDICATOR[%u] = %u ", i, (unsigned)(data->LENGTH_INDICATOR[i])); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "M[%u] = %u ", i, (unsigned)(data->M[i])); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "E[%u] = %u ", i, (unsigned)(data->E[i])); + i++; + } while((data->M[i-1] == 1)&&(data->E[i-1] == 0)); + } + if(data->TI == 1) // TLLI field is present + { + data->TLLI = bitvec_read_field(vector, readIndex, 32); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "TLLI = %08x ", data->TLLI); + if (data->PI == 1) // PFI is present if TI field indicates presence of TLLI + { + data->PFI = bitvec_read_field(vector, readIndex, 7); + data->E_2 = bitvec_read_field(vector, readIndex, 1); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "PFI = %u ", (unsigned)(data->PFI)); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "E_2 = %u ", (unsigned)(data->E_2)); + } + } + unsigned dataLen = 23 - readIndex/8; + LOGPC(DRLCMACDATA, LOGL_NOTICE, "DATA[%u] = ", dataLen); + for (unsigned i = 0; i < dataLen; i++) + { + data->RLC_DATA[i] = bitvec_read_field(vector, readIndex, 8); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "%02x", (unsigned)(data->RLC_DATA[i])); + } + LOGPC(DRLCMACDATA, LOGL_NOTICE, "\n"); + } + else + { + LOGPC(DRLCMACDATA, LOGL_NOTICE, "Payload Type: RESERVED (3)"); + return; + } +} + +void encode_gsm_rlcmac_downlink_data(bitvec * vector, RlcMacDownlinkDataBlock_t * data) +{ + size_t writeIndex = 0; + + if (data->PAYLOAD_TYPE == PAYLOAD_TYPE_DATA) + { + // MAC header + bitvec_write_field(vector, writeIndex, data->PAYLOAD_TYPE, 2); + bitvec_write_field(vector, writeIndex, data->RRBP, 2); + bitvec_write_field(vector, writeIndex, data->SP, 1); + bitvec_write_field(vector, writeIndex, data->USF, 3); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "PAYLOAD_TYPE = %u ", (unsigned)(data->PAYLOAD_TYPE)); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "RRBP = %u ", (unsigned)(data->RRBP)); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "SP = %u ", (unsigned)(data->SP)); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "USF = %u ", (unsigned)(data->USF)); + + // Octet 1 + bitvec_write_field(vector, writeIndex, data->PR, 2); + bitvec_write_field(vector, writeIndex, data->TFI, 5); + bitvec_write_field(vector, writeIndex, data->FBI, 1); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "PR = %u ", (unsigned)(data->PR)); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "TFI = %u ", (unsigned)(data->TFI)); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "FBI = %u ", (unsigned)(data->FBI)); + + // Octet 2 + bitvec_write_field(vector, writeIndex, data->BSN, 7); + bitvec_write_field(vector, writeIndex, data->E_1, 1); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "BSN = %u ", (unsigned)(data->BSN)); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "E_1 = %u ", (unsigned)(data->E_1)); + + // Octet 3 (optional) + if(data->E_1 == 0) + { + unsigned i = 0; + do + { + bitvec_write_field(vector, writeIndex, data->LENGTH_INDICATOR[i], 6); + bitvec_write_field(vector, writeIndex, data->M[i], 1); + bitvec_write_field(vector, writeIndex, data->E[i], 1); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "LENGTH_INDICATOR[%u] = %u ", i, (unsigned)(data->LENGTH_INDICATOR[i])); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "M[%u] = %u ", i, (unsigned)(data->M[i])); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "E[%u] = %u ", i, (unsigned)(data->E[i])); + i++; + } + while ((data->M[i-1] == 1) && (data->E[i-1] == 0)); + } + unsigned dataNumOctets = 23 - writeIndex/8; + LOGPC(DRLCMACDATA, LOGL_NOTICE, "DATA[%u] = ", dataNumOctets); + for (unsigned i = 0; i < dataNumOctets; i++) + { + bitvec_write_field(vector, writeIndex, data->RLC_DATA[i], 8); + LOGPC(DRLCMACDATA, LOGL_NOTICE, "%02x", (unsigned)(data->RLC_DATA[i])); + } + LOGPC(DRLCMACDATA, LOGL_NOTICE, "\n"); + } +} diff --git a/src/gsm_rlcmac.h b/src/gsm_rlcmac.h new file mode 100644 index 00000000..afec1468 --- /dev/null +++ b/src/gsm_rlcmac.h @@ -0,0 +1,5130 @@ +/* gsm_rlcmac.h + * Definitions for GSM RLC MAC control plane message dissection in wireshark. + * TS 44.060 and 24.008 + * + * Copyright (C) 2011 Ivan Klyuchnikov + * + * By Vincent Helfre, based on original code by Jari Sassi + * with the gracious authorization of STE + * Copyright (c) 2011 ST-Ericsson + * + * $Id: packet-gsm_rlcmac.h 38909 2011-09-07 04:54:19Z etxrab $ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs + * 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. + */ + +#include "csn1.h" +#include +#include +#ifndef __PACKET_GSM_RLCMAC_H__ +#define __PACKET_GSM_RLCMAC_H__ + +#ifndef PRE_PACKED +#define PRE_PACKED +#endif + +#ifndef POST_PACKED +#define POST_PACKED +#endif + +//TODO Check this number +#define MAX_NUMBER_LLC_PDU 5 + +typedef guint8 TFI_t; + +typedef guint8 N32_t; +typedef guint8 N51_t; +typedef guint8 N26_t; + +/* Starting Time IE as specified in 04.08 */ +typedef struct +{ + N32_t N32; /* 04.08 refers to T1' := (FN div 1326) mod 32 */ + N51_t N51; /* 04.08 refers to T3 := FN mod 51 */ + N26_t N26; /* 04.08 refers to T2 := FN mod 26 */ +} StartingTime_t; + +typedef struct +{ + guint8 UnionType;/* UnionType is index */ + union + { + guint8 UPLINK_TFI; + guint8 DOWNLINK_TFI; + } u; +} Global_TFI_t; + +typedef struct +{ + guint8 UnionType; + union + { + StartingTime_t StartingTime; + guint16 k; + } u; +} Starting_Frame_Number_t; + +typedef struct +{ + guint8 FINAL_ACK_INDICATION; + guint8 STARTING_SEQUENCE_NUMBER; + guint8 RECEIVED_BLOCK_BITMAP[64/8]; +} Ack_Nack_Description_t; + + +typedef struct +{ + guint8 Exist_TIMING_ADVANCE_VALUE; + guint8 TIMING_ADVANCE_VALUE; + + guint8 Exist_IndexAndtimeSlot; + guint8 TIMING_ADVANCE_INDEX; + guint8 TIMING_ADVANCE_TIMESLOT_NUMBER; +} Packet_Timing_Advance_t; + +typedef struct +{ + guint8 ALPHA; + + struct + { + guint8 Exist; + guint8 GAMMA_TN; + } Slot[8]; +} Power_Control_Parameters_t; + +typedef struct +{ + guint8 ALPHA; + guint8 T_AVG_W; + guint8 T_AVG_T; + guint8 Pb; + guint8 PC_MEAS_CHAN; + guint8 INT_MEAS_CHANNEL_LIST_AVAIL; + guint8 N_AVG_I; +} Global_Power_Control_Parameters_t; + +typedef struct +{ + guint8 Exist_TIMING_ADVANCE_VALUE; + guint8 TIMING_ADVANCE_VALUE; + + guint8 Exist_UPLINK_TIMING_ADVANCE; + guint8 UPLINK_TIMING_ADVANCE_INDEX; + guint8 UPLINK_TIMING_ADVANCE_TIMESLOT_NUMBER; + + guint8 Exist_DOWNLINK_TIMING_ADVANCE; + guint8 DOWNLINK_TIMING_ADVANCE_INDEX; + guint8 DOWNLINK_TIMING_ADVANCE_TIMESLOT_NUMBER; +} Global_Packet_Timing_Advance_t; + + +typedef struct +{ + guint8 C_VALUE; + guint8 RXQUAL; + guint8 SIGN_VAR; + + struct + { + guint8 Exist; + guint8 I_LEVEL_TN; + } Slot[8]; +} Channel_Quality_Report_t; + +typedef enum +{ + RLC_MODE_ACKNOWLEDGED = 0, + RLC_MODE_UNACKNOWLEDGED = 1 +} RLC_MODE_t; + +typedef struct +{ + guint8 PEAK_THROUGHPUT_CLASS; + guint8 RADIO_PRIORITY; + RLC_MODE_t RLC_MODE; + guint8 LLC_PDU_TYPE; + guint16 RLC_OCTET_COUNT; +} Channel_Request_Description_t; + +typedef struct +{ + guint16 RANDOM_ACCESS_INFORMATION; + guint8 FRAME_NUMBER[2]; +} Packet_Request_Reference_t; + +typedef PRE_PACKED struct +{ + guint8 nsapi; + guint8 value; +} Receive_N_PDU_Number_t POST_PACKED; + +typedef PRE_PACKED struct +{ + guint8 IEI; + guint8 Length; + + guint8 Count_Receive_N_PDU_Number; + Receive_N_PDU_Number_t Receive_N_PDU_Number[11]; +} Receive_N_PDU_Number_list_t POST_PACKED; + +/** IMSI length */ +#define IMSI_LEN 9 + +/** TMSI length */ +#define TMSI_LEN 4 + +typedef struct +{ + guint8 MCC1; + guint8 MCC2; + guint8 MCC3; + guint8 MNC3; + guint8 MNC1; + guint8 MNC2; +} PLMN_t; + + +/** This type is used to describe LAI codes */ +typedef PRE_PACKED struct +{ + PLMN_t PLMN; + guint16 LAC; +} LAI_t POST_PACKED; + + +/** Length of LAI */ +#define LAI_LEN (sizeof(LAI_t)) + +typedef struct +{ + guint8 TMSI[TMSI_LEN]; +}TMSI_t; + +typedef guint16 CellId_t; + + +#define CKSN_NOT_VALID 7 + +#define IMEI_LEN 9 + +#define IMEISV_LEN 10 + +#define MAX_ELEMENTS_IN_EQPLMN_LIST 16 + + +typedef struct +{ + guint8 NUMBER_CELLS; + guint8 CCN_SUPPORTED[16]; /* bit (1), max size: 16 x 8 => 128 bits */ +} CCN_Support_Description_t; + +typedef struct +{ + guint8 UnionType; + union + { + guint8 LSA_ID; + guint8 ShortLSA_ID; + } u; +} LSA_ID_Info_Element_t; + +#define LSA_ID_INFO_ELEMENTS_MAX (16) + +typedef struct +{ + guint8 Count_LSA_ID_Info_Element; + LSA_ID_Info_Element_t LSA_ID_Info_Elements[LSA_ID_INFO_ELEMENTS_MAX]; +} LSA_ID_Info_t; + +#define NR_OF_FREQ_OR_CELLS_MAX (32) + +typedef struct +{ + guint8 NR_OF_FREQ_OR_CELLS; + LSA_ID_Info_t LSA_ID_Info[NR_OF_FREQ_OR_CELLS_MAX]; +} LSA_Parameters_t; + +#define MAX_REPORT_PRIORITY_CELLS (16) + +typedef struct +{ + guint8 NUMBER_CELLS; + guint8 REPORT_PRIORITY[MAX_REPORT_PRIORITY_CELLS]; +} ReportPriority_t; + +typedef ReportPriority_t GPRSReportPriority_t; + +typedef struct +{ + guint8 REPORTING_OFFSET; + guint8 REPORTING_THRESHOLD; +} OffsetThreshold_t; + + +typedef struct +{ + guint8 Exist_MULTI_BAND_REPORTING; + guint8 MULTI_BAND_REPORTING; + + guint8 Exist_SERVING_BAND_REPORTING; + guint8 SERVING_BAND_REPORTING; + + /* Warning: + * + * SI2quater, MI, PMO, and PCCO always specify Scale Ord. There is no + * "exist SCALE_ORD" bit in the CSN.1 descriptions for these messages. + * However, this struct is shared with the PSI5 message which may or may + * not specify SCALE_ORD, thus necessitating the inclusion of member + * Exist_SCALE_ORD in the struct. This member is never set for SI2quater, MI, + * PMO, and PCCO so to check it (in these cases) would be erroneous. + */ + guint8 Exist_SCALE_ORD; + guint8 SCALE_ORD; + + guint8 Exist_OffsetThreshold900; + OffsetThreshold_t OffsetThreshold900; + + guint8 Exist_OffsetThreshold1800; + OffsetThreshold_t OffsetThreshold1800; + + guint8 Exist_OffsetThreshold400; + OffsetThreshold_t OffsetThreshold400; + + guint8 Exist_OffsetThreshold1900; + OffsetThreshold_t OffsetThreshold1900; + + guint8 Exist_OffsetThreshold850; + OffsetThreshold_t OffsetThreshold850; + +} MeasurementParams_t; + +typedef struct +{ + guint8 Exist_FDD_REPORTING_THRESHOLD_2; + guint8 FDD_REPORTING_THRESHOLD_2; +} GPRS_AdditionalMeasurementParams3G_t; + + +typedef struct +{ + guint8 NETWORK_CONTROL_ORDER; + + guint8 Exist_NC; + guint8 NC_NON_DRX_PERIOD; + guint8 NC_REPORTING_PERIOD_I; + guint8 NC_REPORTING_PERIOD_T; +} NC_Measurement_Parameters_t; + + +/* +**======================================================================== +** Global types +**======================================================================== +*/ + +struct MobileId /* Mobile id, -> TMSI, IMEI or IMSI */ +{ + guint8 Length:8; + guint8 IdType:3; + guint8 OddEven:1; + guint8 Dig1:4; + union + { + unsigned char TMSI[TMSI_LEN]; + unsigned char IMEI[IMEI_LEN - 2]; + unsigned char IMSI[IMEI_LEN - 2]; + unsigned char IMEISV[IMEISV_LEN - 2]; + } Id; +}; + +struct OV_MobileId /* Struct for optional mobile identity */ +{ + unsigned char IEI; + struct MobileId MV; +}; + +#define LAC_INVALID 0xFEFF + +typedef enum +{ + LAI_PRIORITY_AVAILABLE, + LAI_PRIORITY_FORBIDDEN, + LAI_PRIORITY_FORCED +}LAI_Priority_t; + +typedef enum +{ + NOM_I, + NOM_II, + NOM_III, + NOM_GSM, + NOM_PS_ONLY, + NOM_UNKNOWN +}NMO_t; + +typedef enum +{ + COMBINED, + NOT_COMBINED, + SAME_AS_BEFORE +}ProcedureMode_t; + +typedef struct +{ + guint8 Cause; + LAI_t LAI; + struct OV_MobileId MobileId; +}CombinedResult_t; + +typedef enum +{ + R97, + R99 +}MSCR_t, SGSNR_t; + +typedef struct +{ + guint8 NbrOfElements; + PLMN_t Element[MAX_ELEMENTS_IN_EQPLMN_LIST]; +}EqPLMN_List_t; + +#define MAX_PCCCH 16 +#define MAX_RFL_LENGTH 16 /* length of RFL in PSI2 */ +#define MAX_RFLS 4 /* Max number of RFLs */ +#define MAX_MA_LISTS_IN_PSI2 8 /* MAX MA lists = 8 */ +#define MAX_ALLOCATION_BITMAP_LENGTH 128 /* max length of Fixed Allocation bitmap in BITS (2^7) */ +#define MAX_VAR_LENGTH_BITMAP_LENGTH 176 /* max length ever possible for variable length fixed allocation bitmap */ +#define MAX_RRC_CONTAINER_LENGTH 255 +#define MAX_NAS_CONTAINER_LENGTH 127 + + +typedef struct +{ + guint8 MA_LENGTH;/* =(MA_BitLength +7) MA_BitLength_ converted to bytes */ + guint8 MA_BITMAP[(63+1)/8];/* : bit (val (MA_LENGTH) + 1) > */ + /* The above should not change order! */ + guint8 MA_BitLength; +} MobileAllocation_t; + +typedef struct +{ + guint8 ElementsOf_ARFCN_INDEX; + guint8 ARFCN_INDEX[16]; +} ARFCN_index_list_t; + +typedef struct +{ + guint8 HSN; + + guint8 ElementsOf_RFL_NUMBER; + guint8 RFL_NUMBER[4]; + + guint8 UnionType; + union + { + MobileAllocation_t MA; + ARFCN_index_list_t ARFCN_index_list; + } u; +} GPRS_Mobile_Allocation_t; + +/* < EGPRS Ack/Nack Description > + * CRBB - Compressed Received Blocks Bitmap + * URBB - Uncompressed Received Blocks Bitmap + */ +#define EGPRS_ACK_NACK_MAX_BITS 0x0FF /* 255 bits/32 bytes */ +#define CRBB_MAX_BITS 0x07F /* 127 bits/16 bytes */ +#define URBB_MAX_BITS 0x150 /* 336 bits/42 bytes */ + +typedef struct +{ + gboolean Exist_LENGTH; + guint8 LENGTH; + + guint8 FINAL_ACK_INDICATION; + guint8 BEGINNING_OF_WINDOW; + guint8 END_OF_WINDOW; + guint16 STARTING_SEQUENCE_NUMBER; + + gboolean Exist_CRBB; + guint8 CRBB_LENGTH; + guint8 CRBB_STARTING_COLOR_CODE; + guint8 CRBB[CRBB_MAX_BITS/8 + 1]; + + guint16 URBB_LENGTH; + guint8 URBB[URBB_MAX_BITS/8]; +} EGPRS_AckNack_t; + + +/* + * + */ +#define SF_VBS 0 /* VBS (broadcast call reference) */ +#define SF_VGCS 1 /* VGCS (group call reference) */ + +#define AF_AckIsNotRequired 0 /* acknowledgement is not required */ +#define AF_AckIsRequired 1 /* acknowledgement is required */ + +typedef struct +{ + guint32 value; + guint8 SF; + guint8 AF; + guint8 call_priority; + guint8 Ciphering_information; +} Group_Call_Reference_t; + +/* Mobile allocation is coded differently but uses the same type! */ +typedef struct +{ + guint8 Length; + guint8 MA[8]; +} MobileAllocationIE_t; + +typedef struct +{ + guint8 UnionType; + union + { + MobileAllocationIE_t MA; + guint8 Frequency_Short_List[64/8]; + } u; +} MobileAllocation_or_Frequency_Short_List_t; + +typedef struct +{ + guint8 spare; + guint16 ARFCN; +} SingleRFChannel_t; + +typedef struct +{ + guint8 MAIO; + guint8 HSN; +} RFHoppingChannel_t; + +typedef struct +{ + guint8 Channel_type_and_TDMA_offset; + guint8 TN; + guint8 TSC; + + guint8 UnionType; + union + { + SingleRFChannel_t SingleRFChannel; + RFHoppingChannel_t RFHoppingChannel; + } u; +} Channel_Description_t; + +typedef struct +{ + Channel_Description_t Channel_Description; + + guint8 Exist_Hopping; + MobileAllocation_or_Frequency_Short_List_t MA_or_Frequency_Short_List; + +} Group_Channel_Description_t; + +typedef struct +{ + Group_Call_Reference_t Group_Call_Reference; + + guint8 Exist_Group_Channel_Description; + Group_Channel_Description_t Group_Channel_Description; +} Group_Call_information_t; + +typedef struct +{ + guint8 Exist_NLN_PCH_and_NLN_status; + guint8 NLN_PCH; + guint8 NLN_status; + + guint8 Exist_Priority1; + guint8 Priority1; + + guint8 Exist_Priority2; + guint8 Priority2; + + guint8 Exist_Group_Call_information; + Group_Call_information_t Group_Call_information; + + guint8 Packet_Page_Indication_1; + guint8 Packet_Page_Indication_2; +} P1_Rest_Octets_t; + +typedef struct +{ + guint8 Exist_CN3; + guint8 CN3; + + guint8 Exist_NLN_and_status; + guint8 NLN; + guint8 NLN_status; + + guint8 Exist_Priority1; + guint8 Priority1; + + guint8 Exist_Priority2; + guint8 Priority2; + + guint8 Exist_Priority3; + guint8 Priority3; + + guint8 Packet_Page_Indication_3; +} P2_Rest_Octets_t; + +/* incl additions for R99 and EGPRS */ + +typedef struct +{ + guint8 USF; + guint8 USF_GRANULARITY; + + guint8 Exist_P0_PR_MODE; + guint8 P0; + guint8 PR_MODE; +} DynamicAllocation_t; + +typedef struct +{ + gboolean Exist_ALPHA; + guint8 ALPHA; + + guint8 GAMMA; + StartingTime_t TBF_STARTING_TIME; + guint8 NR_OF_RADIO_BLOCKS_ALLOCATED; + + gboolean Exist_P0_BTS_PWR_CTRL_PR_MODE; + guint8 P0; + guint8 BTS_PWR_CTRL_MODE; + guint8 PR_MODE; +} EGPRS_TwoPhaseAccess_t; + +typedef struct +{ + guint8 TFI_ASSIGNMENT; + guint8 POLLING; + + guint8 UnionType; + union + { + DynamicAllocation_t DynamicAllocation; + guint8 FixedAllocationDummy; /* Fixed Allocation was removed */ + } Allocation; + + guint8 EGPRS_CHANNEL_CODING_COMMAND; + guint8 TLLI_BLOCK_CHANNEL_CODING; + + gboolean Exist_BEP_PERIOD2; + guint8 BEP_PERIOD2; + + guint8 RESEGMENT; + guint8 EGPRS_WindowSize; + + gboolean Exist_ALPHA; + guint8 ALPHA; + + guint8 GAMMA; + + gboolean Exist_TIMING_ADVANCE_INDEX; + guint8 TIMING_ADVANCE_INDEX; + + gboolean Exist_TBF_STARTING_TIME; + StartingTime_t TBF_STARTING_TIME; +} EGPRS_OnePhaseAccess_t; + +#define MAX_ACCESS_TECHOLOGY_TYPES 12 + +typedef struct +{ + guint8 ExtendedRA; + + guint8 NrOfAccessTechnologies; + guint8 AccessTechnologyType[MAX_ACCESS_TECHOLOGY_TYPES]; + + guint8 UnionType; + union + { + EGPRS_TwoPhaseAccess_t TwoPhaseAccess; /* 04.18/10.5.2.16 Multiblock allocation */ + EGPRS_OnePhaseAccess_t OnePhaseAccess; /* 04.60/10.5.2.16 TFI using Dynamic or Fixed Allocation */ + } Access; +} IA_EGPRS_00_t; + +typedef struct +{ + guint8 UnionType; + union + { + IA_EGPRS_00_t IA_EGPRS_PUA; /* 00 < EGPRS Packet Uplink Assignment >*/ + guint8 IA_EGPRS_01; /* 01 reserved for future use */ + guint8 IA_EGPRS_1; /* 1 reserved for future use */ + } u; +} IA_EGPRS_t; + +typedef struct +{ + guint8 Length; + guint8 MAIO; + guint8 MobileAllocation[62]; +} IA_FreqParamsBeforeTime_t; + +typedef struct +{ + gboolean Exist_ALPHA; + guint8 ALPHA; + + guint8 GAMMA; + guint8 R97_CompatibilityBits; + StartingTime_t TBF_STARTING_TIME; + + gboolean Exist_P0_BTS_PWR_CTRL_PR_MODE; + guint8 P0; + guint8 BTS_PWR_CTRL_MODE; + guint8 PR_MODE; +} GPRS_SingleBlockAllocation_t; + +typedef struct +{ + guint8 TFI_ASSIGNMENT; + guint8 POLLING; + + guint8 UnionType; + union + { + DynamicAllocation_t DynamicAllocation; + guint8 FixedAllocationDummy; + } Allocation; + + guint8 CHANNEL_CODING_COMMAND; + guint8 TLLI_BLOCK_CHANNEL_CODING; + + guint8 Exist_ALPHA; + guint8 ALPHA; + + guint8 GAMMA; + + guint8 Exist_TIMING_ADVANCE_INDEX; + guint8 TIMING_ADVANCE_INDEX; + + guint8 Exist_TBF_STARTING_TIME; + StartingTime_t TBF_STARTING_TIME; +} GPRS_DynamicOrFixedAllocation_t; + +typedef struct +{ + gboolean Exist_ExtendedRA; + guint8 ExtendedRA; +} PU_IA_AdditionsR99_t; + +typedef struct +{ + guint8 UnionType; + union + { + GPRS_SingleBlockAllocation_t SingleBlockAllocation; + GPRS_DynamicOrFixedAllocation_t DynamicOrFixedAllocation; + } Access; + + gboolean Exist_AdditionsR99; + PU_IA_AdditionsR99_t AdditionsR99; +} Packet_Uplink_ImmAssignment_t; + +typedef struct +{ + guint8 EGPRS_WindowSize; + guint8 LINK_QUALITY_MEASUREMENT_MODE; + + gboolean Exist_BEP_PERIOD2; + guint8 BEP_PERIOD2; +} PD_IA_AdditionsR99_t; + +typedef struct +{ + guint32 TLLI; + + guint8 Exist_TFI_to_TA_VALID; + guint8 TFI_ASSIGNMENT; + guint8 RLC_MODE; + guint8 Exist_ALPHA; + guint8 ALPHA; + guint8 GAMMA; + guint8 POLLING; + guint8 TA_VALID; + + guint8 Exist_TIMING_ADVANCE_INDEX; + guint8 TIMING_ADVANCE_INDEX; + + guint8 Exist_TBF_STARTING_TIME; + StartingTime_t TBF_STARTING_TIME; + + guint8 Exist_P0_PR_MODE; + guint8 P0; + guint8 BTS_PWR_CTRL_MODE; + guint8 PR_MODE; + + gboolean Exist_AdditionsR99; + PD_IA_AdditionsR99_t AdditionsR99; +} Packet_Downlink_ImmAssignment_t; + +typedef struct +{ + gboolean Exist_SecondPart; + + gboolean Exist_ExtendedRA; + guint8 ExtendedRA; +} Second_Part_Packet_Assignment_t; + +typedef struct +{ + guint8 UnionType; + union + { + Packet_Uplink_ImmAssignment_t Packet_Uplink_ImmAssignment; + Packet_Downlink_ImmAssignment_t Packet_Downlink_ImmAssignment; + } ul_dl; +} IA_PacketAssignment_UL_DL_t; + +typedef struct +{ + guint8 UnionType; + union + { + IA_PacketAssignment_UL_DL_t UplinkDownlinkAssignment; + Second_Part_Packet_Assignment_t Second_Part_Packet_Assignment; + } u; +} IA_PacketAssignment_t; + +typedef struct +{ + guint8 UnionType; + union + { + IA_FreqParamsBeforeTime_t IA_FrequencyParams; + IA_PacketAssignment_t IA_PacketAssignment; + } u; +} IA_GPRS_t; + +typedef struct +{ + guint8 UnionType; + union + { + IA_EGPRS_t IA_EGPRS_Struct; + IA_GPRS_t IA_GPRS_Struct; + } u; +} IA_t; + + +/* ref: 04.18/10.5.2.17 */ +typedef struct +{ + guint8 Exist_ExtendedRA; + guint8 ExtendedRA; +} ExtendedRA_Info_t; + +typedef ExtendedRA_Info_t ExtendedRA_Info_Array_t[4]; + +typedef struct +{ + ExtendedRA_Info_Array_t ExtendedRA_Info; +} IAR_t; + + +/* Packet Polling Request */ +typedef struct +{ + guint8 UnionType; + union + { + Global_TFI_t Global_TFI; + guint32 TLLI; + guint16 TQI; + } u; +} PacketPollingID_t; + +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PAGE_MODE; + PacketPollingID_t ID; + guint8 TYPE_OF_ACK; +} Packet_Polling_Request_t; + +/* < SI 13 Rest Octets > */ +#define MAX_EXTENSION_LENGTH_IN_BYTES (8) /* max value = 64 (coded on 6 bits) */ + +typedef struct +{ + guint8 extension_length; + guint8 Extension_Info[MAX_EXTENSION_LENGTH_IN_BYTES];/* ( val (extension length)+1 ) 04.60/12.26 */ +} Extension_Bits_t; + +typedef struct +{ + guint8 DTM_SUPPORT : 1; + guint8 PFC_FEATURE_MODE : 1; + guint8 BEP_PERIOD : 4; + guint8 EGPRS_PACKET_CHANNEL_REQUEST : 1; + guint8 EGPRS_Support : 1; + + guint8 NotUsed : 3; + guint8 EXT_UTBF_NODATA : 1; + guint8 MULTIPLE_TBF_CAPABILITY : 1; + guint8 NW_EXT_UTBF : 1; + guint8 CCN_ACTIVE : 1; + guint8 BSS_PAGING_COORDINATION : 1; +} GPRS_ExtensionInfoWithEGPRS_t; + +typedef struct +{ + guint8 EXT_UTBF_NODATA : 1; + guint8 MULTIPLE_TBF_CAPABILITY : 1; + guint8 NW_EXT_UTBF : 1; + guint8 CCN_ACTIVE : 1; + guint8 BSS_PAGING_COORDINATION : 1; + guint8 DTM_SUPPORT : 1; + guint8 PFC_FEATURE_MODE : 1; + guint8 EGPRS_Support : 1; +} GPRS_ExtensionInfoWithoutEGPRS_t; + +typedef struct +{ + guint8 NotUsed : 7; + guint8 EGPRS_Support : 1; +} EGPRS_Support_t; + +typedef struct +{ + guint8 ECSC : 1; + guint8 ECSR_3G : 1; +} NonGPRS_ExtensionInfo_t; + +typedef struct +{ + guint8 Extension_Length; + union + { + EGPRS_Support_t EGPRS_Support; + GPRS_ExtensionInfoWithEGPRS_t GPRS_ExtensionInfoWithEGPRS; + GPRS_ExtensionInfoWithoutEGPRS_t GPRS_ExtensionInfoWithoutEGPRS; + NonGPRS_ExtensionInfo_t NonGPRS_ExtensionInfo; + guint8 Extension_Information[MAX_EXTENSION_LENGTH_IN_BYTES]; + } u; +} Optional_Extension_Information_t; + +typedef struct +{ + gboolean EGPRS_Support; + guint8 BEP_PERIOD; + gboolean EGPRS_PACKET_CHANNEL_REQUEST; +} EGPRS_OptionalExtensionInformation_t; + + +typedef struct +{ + guint8 NMO; + guint8 T3168; + guint8 T3192; + guint8 DRX_TIMER_MAX; + guint8 ACCESS_BURST_TYPE; + guint8 CONTROL_ACK_TYPE; + guint8 BS_CV_MAX; + + guint8 Exist_PAN; + guint8 PAN_DEC; + guint8 PAN_INC; + guint8 PAN_MAX; + + guint8 Exist_Extension_Bits; + Extension_Bits_t Extension_Bits; +} GPRS_Cell_Options_t; + +typedef struct +{ + guint8 ALPHA; + guint8 T_AVG_W; + guint8 T_AVG_T; + guint8 PC_MEAS_CHAN; + guint8 N_AVG_I; +} GPRS_Power_Control_Parameters_t; + +typedef struct +{ + guint8 RAC; + guint8 SPGC_CCCH_SUP; + guint8 PRIORITY_ACCESS_THR; + guint8 NETWORK_CONTROL_ORDER; + GPRS_Cell_Options_t GPRS_Cell_Options; + GPRS_Power_Control_Parameters_t GPRS_Power_Control_Parameters; +} PBCCH_Not_present_t; + +typedef struct +{ + guint8 Pb; + guint8 TSC; + guint8 TN; + + guint8 UnionType; + union + { + guint8 dummy; + guint16 ARFCN; + guint8 MAIO; + } u; +} PBCCH_Description_t; + +typedef struct +{ + guint8 PSI1_REPEAT_PERIOD; + PBCCH_Description_t PBCCH_Description; +} PBCCH_present_t; + + + +/* < Packet TBF Release message content > */ +typedef guint8 TBF_RELEASE_CAUSE_t; +#define TBF_RELEASE_CAUSE_NORMAL (0x00) +#define TBF_RELEASE_CAUSE_ABNORMAL (0x02) + +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PAGE_MODE; + Global_TFI_t Global_TFI; + guint8 UPLINK_RELEASE; + guint8 DOWNLINK_RELEASE; + TBF_RELEASE_CAUSE_t TBF_RELEASE_CAUSE; +} Packet_TBF_Release_t; + +/* < Packet Control Acknowledgement message content > */ +typedef struct +{ + guint8 Exist_CTRL_ACK_Extension; + guint16 CTRL_ACK_Extension; +} Packet_Control_Acknowledgement_AdditionsR6_t; + +typedef struct +{ + guint8 Exist_TN_RRBP; + guint8 TN_RRBP; + guint8 Exist_G_RNTI_Extension; + guint8 G_RNTI_Extension; + gboolean Exist_AdditionsR6; + Packet_Control_Acknowledgement_AdditionsR6_t AdditionsR6; +} Packet_Control_Acknowledgement_AdditionsR5_t; + +typedef struct +{ /* Mac header */ + guint8 MESSAGE_TYPE; + guint8 PayloadType; + guint8 spare; + guint8 R; + + guint32 TLLI; + guint8 CTRL_ACK; + gboolean Exist_AdditionsR5; + Packet_Control_Acknowledgement_AdditionsR5_t AdditionsR5; +} Packet_Control_Acknowledgement_t; + +typedef Packet_Control_Acknowledgement_t Packet_Ctrl_Ack_t; + +typedef struct +{ + guint8 CTRL_ACK; +} Packet_Control_Acknowledgement_11_bit_t, Packet_Control_Acknowledgement_8_bit_t; + +/* < Packet Downlink Dummy Control Block message content > */ +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PAGE_MODE; + + guint8 Exist_PERSISTENCE_LEVEL; + guint8 PERSISTENCE_LEVEL[4]; +} Packet_Downlink_Dummy_Control_Block_t; + +/* < Packet Uplink Dummy Control Block message content > */ +typedef struct +{ /* Mac header */ + guint8 MESSAGE_TYPE; + guint8 PayloadType; + guint8 spare; + guint8 R; + + guint32 TLLI; +} Packet_Uplink_Dummy_Control_Block_t; + +/*< MS Radio Access capability IE > + * 24.008 (10.5.5.12a) + */ +typedef guint8 A5_bits_t;/* ::= < A5/1 : bit> ; -- bits for circuit mode ciphering algorithms */ + +typedef struct +{ + guint8 Exist_DTM_EGPRS_multislot_class; + guint8 DTM_EGPRS_multislot_class; +} DTM_EGPRS_t; + +typedef struct +{ + guint8 Exist_DTM_EGPRS_HighMultislotClass; + guint8 DTM_EGPRS_HighMultislotClass; +} DTM_EGPRS_HighMultislotClass_t; + +typedef struct +{ + guint8 Exist_HSCSD_multislot_class; + guint8 HSCSD_multislot_class; + + guint8 Exist_GPRS_multislot_class; + guint8 GPRS_multislot_class; + guint8 GPRS_Extended_Dynamic_Allocation_Capability; + + guint8 Exist_SM; + guint8 SMS_VALUE; + guint8 SM_VALUE; + +/*-------- Rel 99 additions */ + guint8 Exist_ECSD_multislot_class; + guint8 ECSD_multislot_class; + + guint8 Exist_EGPRS_multislot_class; + guint8 EGPRS_multislot_class; + guint8 EGPRS_Extended_Dynamic_Allocation_Capability; + + guint8 Exist_DTM_GPRS_multislot_class; + guint8 DTM_GPRS_multislot_class; + guint8 Single_Slot_DTM; + DTM_EGPRS_t DTM_EGPRS_Params; +} Multislot_capability_t; + +typedef struct +{ + guint8 RF_Power_Capability; + + guint8 Exist_A5_bits; + A5_bits_t A5_bits; + /*-- zero means that the same values apply for parameters as in the immediately preceeding Access capabilities field within this IE + *-- The presence of the A5 bits is mandatory in the 1st Access capabilies struct within this IE. + */ + + guint8 ES_IND; + guint8 PS; + guint8 VGCS; + guint8 VBS; + + guint8 Exist_Multislot_capability; + Multislot_capability_t Multislot_capability; + /* -- zero means that the same values apply for multislot parameters as in the immediately preceeding Access capabilities field within this IE. + * -- The presence of the Multislot capability struct is mandatory in the 1st Access capabilites struct within this IE. + */ + /* -------- Rel 99 additions */ + guint8 Exist_Eight_PSK_Power_Capability; + guint8 Eight_PSK_Power_Capability; + + guint8 COMPACT_Interference_Measurement_Capability; + guint8 Revision_Level_Indicator; + guint8 UMTS_FDD_Radio_Access_Technology_Capability; + guint8 UMTS_384_TDD_Radio_Access_Technology_Capability; + guint8 CDMA2000_Radio_Access_Technology_Capability; + + /* -------- R4 additions */ + guint8 UMTS_128_TDD_Radio_Access_Technology_Capability; + guint8 GERAN_Feature_Package_1; + + guint8 Exist_Extended_DTM_multislot_class; + guint8 Extended_DTM_GPRS_multislot_class; + guint8 Extended_DTM_EGPRS_multislot_class; + + guint8 Modulation_based_multislot_class_support; + + /* -------- R5 additions */ + guint8 Exist_HighMultislotCapability; + guint8 HighMultislotCapability; + + guint8 Exist_GERAN_lu_ModeCapability; + guint8 GERAN_lu_ModeCapability; + + guint8 GMSK_MultislotPowerProfile; + guint8 EightPSK_MultislotProfile; + + /* -------- R6 additions */ + guint8 MultipleTBF_Capability; + guint8 DownlinkAdvancedReceiverPerformance; + guint8 ExtendedRLC_MAC_ControlMessageSegmentionsCapability; + guint8 DTM_EnhancementsCapability; + + guint8 Exist_DTM_GPRS_HighMultislotClass; + guint8 DTM_GPRS_HighMultislotClass; + DTM_EGPRS_HighMultislotClass_t DTM_EGPRS_HighMultislotClass; + guint8 PS_HandoverCapability; +} Content_t; + +#define ABSOLUTE_MAX_BANDS 2 /* New fields for R4 extend the length of the capabilities message so we can only send 2 */ + +#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 */ + AccTech_GSMP = 0x0, + AccTech_GSME = 0x1, + AccTech_GSM1800 = 0x3, + AccTech_GSM1900 = 0x4, + AccTech_GSM850 = 0x7, + AccTech_GSMOther = 0xf +} AccessTechnology_t; + +typedef struct +{ + guint8 CountAccessTechnologies; + AccessTechnology_t AccessTechnologies[MAX_ACCESS_TECHNOLOGIES_COUNT]; +} AccessTechnologiesRequest_t; + +typedef struct +{ + AccessTechnology_t Access_Technology_Type; + guint8 GMSK_Power_class; + guint8 Eight_PSK_Power_class; +} Additional_access_technologies_struct_t; + +typedef struct +{ + guint8 Count_additional_access_technologies; + /* The value 0xf cannot be set for the first ATT, therefore we can only have + ABSOLUTE_MAX_BANDS-1 additional access technologies. */ + Additional_access_technologies_struct_t Additional_access_technologies[ABSOLUTE_MAX_BANDS-1]; +} Additional_access_technologies_t; + +typedef struct +{ + guint8 IndexOfAccTech; /* Position in AccessTechnology_t */ + union + { + /* Long Form */ + Content_t Content; + /* Short Form */ + Additional_access_technologies_t Additional_access_technologies; + } u; +} MS_RA_capability_value_t; + +typedef struct +{ + guint8 Count_MS_RA_capability_value; /* Recursive */ + MS_RA_capability_value_t MS_RA_capability_value[ABSOLUTE_MAX_BANDS]; +} MS_Radio_Access_capability_t; + + +typedef struct +{ + guint8 ExistEDGE_RF_PwrCap1; + guint8 EDGE_RF_PwrCap1; + guint8 ExistEDGE_RF_PwrCap2; + guint8 EDGE_RF_PwrCap2; +} EDGE_RF_Pwr_t; + +typedef struct +{ + guint8 A5_Bits; + guint8 Arc2_Spare; + guint8 Arc1; +} ARC_t; + +typedef struct +{ + guint8 Multiband; + union + { + guint8 A5_Bits; + ARC_t ARC; + } u; +} Multiband_t; + +typedef struct /* MS classmark 3 R99 */ +{ + guint8 Spare1; + Multiband_t Multiband; + + guint8 Exist_R_Support; + guint8 R_GSM_Arc; + + guint8 Exist_MultiSlotCapability; + guint8 MultiSlotClass; + + guint8 UCS2; + guint8 ExtendedMeasurementCapability; + + guint8 Exist_MS_MeasurementCapability; + guint8 SMS_VALUE; + guint8 SM_VALUE; + + guint8 Exist_MS_PositioningMethodCapability; + guint8 MS_PositioningMethod; + + guint8 Exist_EDGE_MultiSlotCapability; + guint8 EDGE_MultiSlotClass; + + guint8 Exist_EDGE_Struct; + guint8 ModulationCapability; + EDGE_RF_Pwr_t EDGE_RF_PwrCaps; + + guint8 Exist_GSM400_Info; + guint8 GSM400_Bands; + guint8 GSM400_Arc; + + guint8 Exist_GSM850_Arc; + guint8 GSM850_Arc; + + guint8 Exist_PCS1900_Arc; + guint8 PCS1900_Arc; + + guint8 UMTS_FDD_Radio_Access_Technology_Capability; + guint8 UMTS_384_TDD_Radio_Access_Technology_Capability; + guint8 CDMA2000_Radio_Access_Technology_Capability; + + guint8 Exist_DTM_GPRS_multislot_class; + guint8 DTM_GPRS_multislot_class; + guint8 Single_Slot_DTM; + DTM_EGPRS_t DTM_EGPRS_Params; + + /* -------- R4 additions */ + guint8 Exist_SingleBandSupport; + guint8 GSM_Band; + + guint8 Exist_GSM_700_Associated_Radio_Capability; + guint8 GSM_700_Associated_Radio_Capability; + + guint8 UMTS_128_TDD_Radio_Access_Technology_Capability; + guint8 GERAN_Feature_Package_1; + + guint8 Exist_Extended_DTM_multislot_class; + guint8 Extended_DTM_GPRS_multislot_class; + guint8 Extended_DTM_EGPRS_multislot_class; + + /* -------- R5 additions */ + guint8 Exist_HighMultislotCapability; + guint8 HighMultislotCapability; + + guint8 Exist_GERAN_lu_ModeCapability; + guint8 GERAN_lu_ModeCapability; + + guint8 GERAN_FeaturePackage_2; + + guint8 GMSK_MultislotPowerProfile; + guint8 EightPSK_MultislotProfile; + + /* -------- R6 additions */ + guint8 Exist_TGSM_400_Bands; + guint8 TGSM_400_BandsSupported; + guint8 TGSM_400_AssociatedRadioCapability; + + guint8 Exist_TGSM_900_AssociatedRadioCapability; + guint8 TGSM_900_AssociatedRadioCapability; + + guint8 DownlinkAdvancedReceiverPerformance; + guint8 DTM_EnhancementsCapability; + + guint8 Exist_DTM_GPRS_HighMultislotClass; + guint8 DTM_GPRS_HighMultislotClass; + guint8 OffsetRequired; + DTM_EGPRS_HighMultislotClass_t DTM_EGPRS_HighMultislotClass; + guint8 RepeatedSACCH_Capability; + + guint8 Spare2; +} MS_Class3_Unpacked_t; + + +/* < Packet Resource Request message content > */ +typedef struct +{ + gboolean Exist; + guint8 UnionType; + union + { + guint8 MEAN_BEP_GMSK; + guint8 MEAN_BEP_8PSK; + } u; +} BEP_MeasurementReport_t; + +typedef struct +{ + gboolean Exist; + guint8 I_LEVEL; +} InterferenceMeasurementReport_t; + +typedef struct +{ + gboolean Exist_BEP_MEASUREMENTS; + BEP_MeasurementReport_t BEP_MEASUREMENTS[8]; + + gboolean Exist_INTERFERENCE_MEASUREMENTS; + InterferenceMeasurementReport_t INTERFERENCE_MEASUREMENTS[8]; +} EGPRS_TimeslotLinkQualityMeasurements_t; + +typedef struct +{ + gboolean Exist_MEAN_CV_BEP_GMSK; + guint8 MEAN_BEP_GMSK; + guint8 CV_BEP_GMSK; + + gboolean Exist_MEAN_CV_BEP_8PSK; + guint8 MEAN_BEP_8PSK; + guint8 CV_BEP_8PSK; +} EGPRS_BEP_LinkQualityMeasurements_t; + +typedef struct +{ + gboolean Exist_EGPRS_BEP_LinkQualityMeasurements; + EGPRS_BEP_LinkQualityMeasurements_t EGPRS_BEP_LinkQualityMeasurements; + + gboolean Exist_EGPRS_TimeslotLinkQualityMeasurements; + EGPRS_TimeslotLinkQualityMeasurements_t EGPRS_TimeslotLinkQualityMeasurements; + + gboolean Exist_PFI; + guint8 PFI; + + guint8 MS_RAC_AdditionalInformationAvailable; + guint8 RetransmissionOfPRR; +} PRR_AdditionsR99_t; + +typedef struct +{ + guint8 UnionType; + union + { + Global_TFI_t Global_TFI; + guint32 TLLI; + } u; +} PacketResourceRequestID_t; + +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PayloadType; + guint8 spare; + guint8 R; + + guint8 Exist_ACCESS_TYPE; + guint8 ACCESS_TYPE; + + PacketResourceRequestID_t ID; + + guint8 Exist_MS_Radio_Access_capability; + MS_Radio_Access_capability_t MS_Radio_Access_capability; + + Channel_Request_Description_t Channel_Request_Description; + + guint8 Exist_CHANGE_MARK; + guint8 CHANGE_MARK; + + guint8 C_VALUE; + + guint8 Exist_SIGN_VAR; + guint8 SIGN_VAR; + + InterferenceMeasurementReport_t Slot[8]; + + guint8 Exist_AdditionsR99; + PRR_AdditionsR99_t AdditionsR99; +} Packet_Resource_Request_t; + +/* < Packet Mobile TBF Status message content >*/ +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PayloadType; + guint8 spare; + guint8 R; + + Global_TFI_t Global_TFI; + guint8 TBF_CAUSE; + + guint8 Exist_STATUS_MESSAGE_TYPE; + guint8 STATUS_MESSAGE_TYPE; +} Packet_Mobile_TBF_Status_t; + +/* < Packet PSI Status message content >*/ +typedef struct +{ + guint8 PSI_MESSAGE_TYPE; + guint8 PSIX_CHANGE_MARK; + guint8 Exist_PSIX_COUNT_and_Instance_Bitmap; +} PSI_Message_t; + +typedef struct +{ + guint8 Count_PSI_Message; + PSI_Message_t PSI_Message[10]; + + guint8 ADDITIONAL_MSG_TYPE; +} PSI_Message_List_t; + +typedef struct +{ + guint8 ADDITIONAL_MSG_TYPE; +} Unknown_PSI_Message_List_t; + +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PayloadType; + guint8 spare; + guint8 R; + + Global_TFI_t Global_TFI; + guint8 PBCCH_CHANGE_MARK; + + PSI_Message_List_t PSI_Message_List; + Unknown_PSI_Message_List_t Unknown_PSI_Message_List; +} Packet_PSI_Status_t; + +/* < Packet SI Status message content > */ +typedef struct +{ + guint8 SI_MESSAGE_TYPE; + guint8 MESS_REC; + guint8 SIX_CHANGE_MARK; + + guint8 SIX_COUNT; + guint8 Instance_bitmap[2]; +} SI_Message_t; + +typedef struct +{ + guint8 Count_SI_Message; + SI_Message_t SI_Message[10]; + + guint8 ADDITIONAL_MSG_TYPE; +} SI_Message_List_t; + +typedef struct +{ + guint8 ADDITIONAL_MSG_TYPE; +} Unknown_SI_Message_List_t; + +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PayloadType; + guint8 spare; + guint8 R; + + Global_TFI_t Global_TFI; + guint8 BCCH_CHANGE_MARK; + + SI_Message_List_t SI_Message_List; + Unknown_SI_Message_List_t Unknown_SI_Message_List; +} Packet_SI_Status_t; + +typedef struct +{ + guint16 FDD_ARFCN; + guint8 DIVERSITY; + guint8 Exist_Bandwith_FDD; + guint8 BANDWITH_FDD; + guint16 SCRAMBLING_CODE; +} FDD_Target_Cell_t; + +typedef struct +{ + guint16 TDD_ARFCN; + guint8 DIVERSITY_TDD; + guint8 Exist_Bandwith_TDD; + guint8 BANDWITH_TDD; + guint16 CELL_PARAMETER; + guint8 Sync_Case_TSTD; +} TDD_Target_Cell_t; + +typedef struct +{ + guint16 EARFCN; + guint8 Exist_Measurement_Bandwidth; + guint8 Measurement_Bandwidth; + guint16 Physical_Layer_Cell_Identity; +}EUTRAN_Target_Cell_t; + +typedef struct +{ + guint32 UTRAN_CI; + guint8 Exist_PLMN_ID; + PLMN_t PLMN_ID; +}UTRAN_CSG_Target_Cell_t; + +typedef struct +{ + guint32 EUTRAN_CI; + guint16 Tracking_Area_Code; + guint8 Exist_PLMN_ID; + PLMN_t PLMN_ID; +}EUTRAN_CSG_Target_Cell_t; + +typedef struct +{ + guint8 Exist_UTRAN_CSG_Target_Cell; + UTRAN_CSG_Target_Cell_t UTRAN_CSG_Target_Cell; + guint8 Exist_EUTRAN_CSG_Target_Cell; + EUTRAN_CSG_Target_Cell_t EUTRAN_CSG_Target_Cell; +}PCCF_AdditionsR9_t; + +typedef struct +{ + guint8 Exist_EUTRAN_Target_Cell; + EUTRAN_Target_Cell_t EUTRAN_Target_Cell; + guint8 Exist_AdditionsR9; + PCCF_AdditionsR9_t AdditionsR9; +}PCCF_AdditionsR8_t; + +typedef struct +{ + guint8 Exist_G_RNTI_extention; + guint8 G_RNTI_extention; + guint8 Exist_AdditionsR8; + PCCF_AdditionsR8_t AdditionsR8; +} PCCF_AdditionsR5_t; + +typedef struct +{ + guint8 Exist_FDD_Description; + FDD_Target_Cell_t FDD_Target_Cell; + guint8 Exist_TDD_Description; + TDD_Target_Cell_t TDD_Target_Cell; + guint8 Exist_AdditionsR5; + PCCF_AdditionsR5_t AdditionsR5; +} PCCF_AdditionsR99_t; + +/* < Packet Cell Change Failure message content > */ +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PayloadType; + guint8 spare; + guint8 R; + + guint32 TLLI; + guint16 ARFCN; + guint8 BSIC; + guint8 CAUSE; + gboolean Exist_AdditionsR99; + PCCF_AdditionsR99_t AdditionsR99; +} Packet_Cell_Change_Failure_t; + +/* < Packet Downlink Ack/Nack message content > */ +typedef struct +{ + gboolean Exist_PFI; + guint8 PFI; +} PD_AckNack_AdditionsR99_t; + +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PayloadType; + guint8 spare; + guint8 R; + + guint8 DOWNLINK_TFI; + Ack_Nack_Description_t Ack_Nack_Description; + + guint8 Exist_Channel_Request_Description; + Channel_Request_Description_t Channel_Request_Description; + + Channel_Quality_Report_t Channel_Quality_Report; + + gboolean Exist_AdditionsR99; + PD_AckNack_AdditionsR99_t AdditionsR99; +} Packet_Downlink_Ack_Nack_t; + +/* < EGPRS Packet Downlink Ack/Nack message content > */ +typedef struct +{ + EGPRS_BEP_LinkQualityMeasurements_t EGPRS_BEP_LinkQualityMeasurements; + guint8 C_VALUE; + EGPRS_TimeslotLinkQualityMeasurements_t EGPRS_TimeslotLinkQualityMeasurements; +} EGPRS_ChannelQualityReport_t; + +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PayloadType; + guint8 spare; + guint8 R; + + guint8 DOWNLINK_TFI; + guint8 MS_OUT_OF_MEMORY; + + gboolean Exist_EGPRS_ChannelQualityReport; + EGPRS_ChannelQualityReport_t EGPRS_ChannelQualityReport; + + gboolean Exist_ChannelRequestDescription; + Channel_Request_Description_t ChannelRequestDescription; + + gboolean Exist_PFI; + guint8 PFI; + + gboolean Exist_ExtensionBits; + Extension_Bits_t ExtensionBits; + + EGPRS_AckNack_t EGPRS_AckNack; +} EGPRS_PD_AckNack_t; + +/* < Packet Uplink Ack/Nack message content 04.60 sec.11.2.28 > */ + +typedef struct +{ + guint8 Exist_CONTENTION_RESOLUTION_TLLI; + guint32 CONTENTION_RESOLUTION_TLLI; + + guint8 Exist_Packet_Timing_Advance; + Packet_Timing_Advance_t Packet_Timing_Advance; + + guint8 Exist_Extension_Bits; + Extension_Bits_t Extension_Bits; + + guint8 Exist_Power_Control_Parameters; + Power_Control_Parameters_t Power_Control_Parameters; +} Common_Uplink_Ack_Nack_Data_t; + +typedef struct +{ + gboolean Exist_PacketExtendedTimingAdvance; + guint8 PacketExtendedTimingAdvance; + guint8 TBF_EST; +} PU_AckNack_GPRS_AdditionsR99_t; + +typedef struct +{ + guint8 CHANNEL_CODING_COMMAND; + Ack_Nack_Description_t Ack_Nack_Description; + + guint8 UnionType; + union + { + guint8 FixedAllocationDummy; + guint8 Error; + } u; + + gboolean Exist_AdditionsR99; + PU_AckNack_GPRS_AdditionsR99_t AdditionsR99; + + + Common_Uplink_Ack_Nack_Data_t Common_Uplink_Ack_Nack_Data; +} PU_AckNack_GPRS_t; + +typedef struct +{ + guint8 EGPRS_ChannelCodingCommand; + guint8 RESEGMENT; + guint8 PRE_EMPTIVE_TRANSMISSION; + guint8 PRR_RETRANSMISSION_REQUEST; + guint8 ARAC_RETRANSMISSION_REQUEST; + + guint8 TBF_EST; + + gboolean Exist_Packet_Extended_Timing_Advance; + guint8 Packet_Extended_Timing_Advance; + + EGPRS_AckNack_t EGPRS_AckNack; + + + Common_Uplink_Ack_Nack_Data_t Common_Uplink_Ack_Nack_Data; +} PU_AckNack_EGPRS_00_t; + +typedef struct +{ + guint8 UnionType; + union + { + PU_AckNack_EGPRS_00_t PU_AckNack_EGPRS_00; + guint8 extension_01; + guint8 extension_10; + guint8 extension_11; + } u; +} PU_AckNack_EGPRS_t; + +enum PUAN_Type +{ + PUAN_GPRS, + PUAN_EGPRS +}; + +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PAGE_MODE; + guint8 UPLINK_TFI; + + guint8 UnionType; + union + { + PU_AckNack_GPRS_t PU_AckNack_GPRS_Struct; + PU_AckNack_EGPRS_t PU_AckNack_EGPRS_Struct; + } u; +} Packet_Uplink_Ack_Nack_t; + +/* < Packet Uplink Assignment message content > */ +typedef struct +{ + guint8 CHANGE_MARK_1; + guint8 Exist_CHANGE_MARK_2; + guint8 CHANGE_MARK_2; +} CHANGE_MARK_t; + +typedef struct +{ + guint8 MAIO; + guint8 MA_NUMBER; + + guint8 Exist_CHANGE_MARK; + CHANGE_MARK_t CHANGE_MARK; +} Indirect_encoding_t; + +typedef struct +{ + guint8 MAIO; + GPRS_Mobile_Allocation_t GPRS_Mobile_Allocation; +} Direct_encoding_1_t; + +typedef struct +{ + guint8 MAIO; + guint8 HSN; + guint8 Length_of_MA_Frequency_List; + guint8 MA_Frequency_List[15+3]; +} Direct_encoding_2_t; + +typedef struct +{ + guint8 TSC; + guint8 UnionType; + union + { + guint16 ARFCN; + Indirect_encoding_t Indirect_encoding; + Direct_encoding_1_t Direct_encoding_1; + Direct_encoding_2_t Direct_encoding_2; + } u; +} Frequency_Parameters_t; + +typedef struct +{ + guint8 Exist; + guint8 USF_TN; +} Timeslot_Allocation_t; + +typedef struct +{ + guint8 ALPHA; + + struct + { + guint8 Exist; + guint8 USF_TN; + guint8 GAMMA_TN; + } Slot[8]; +} Timeslot_Allocation_Power_Ctrl_Param_t; + +typedef struct +{ + guint8 Extended_Dynamic_Allocation; + + guint8 Exist_P0; + guint8 P0; + guint8 PR_MODE; + + guint8 USF_GRANULARITY; + + guint8 Exist_UPLINK_TFI_ASSIGNMENT; + guint8 UPLINK_TFI_ASSIGNMENT; + + guint8 Exist_RLC_DATA_BLOCKS_GRANTED; + guint8 RLC_DATA_BLOCKS_GRANTED; + + guint8 Exist_TBF_Starting_Time; + Starting_Frame_Number_t TBF_Starting_Time; + + guint8 UnionType; + union + { + Timeslot_Allocation_t Timeslot_Allocation[8]; + Timeslot_Allocation_Power_Ctrl_Param_t Timeslot_Allocation_Power_Ctrl_Param; + } u; +} Dynamic_Allocation_t; + +typedef struct +{ + guint8 Extended_Dynamic_Allocation; + + guint8 Exist_P0; + guint8 P0; + guint8 PR_MODE; + + guint8 USF_GRANULARITY; + + guint8 Exist_UPLINK_TFI_ASSIGNMENT; + guint8 UPLINK_TFI_ASSIGNMENT; + + guint8 Exist_RLC_DATA_BLOCKS_GRANTED; + guint8 RLC_DATA_BLOCKS_GRANTED; + + guint8 UnionType; + union + { + Timeslot_Allocation_t Timeslot_Allocation[8]; + Timeslot_Allocation_Power_Ctrl_Param_t Timeslot_Allocation_Power_Ctrl_Param; + } u; +} DTM_Dynamic_Allocation_t; + +typedef struct +{ + guint8 TIMESLOT_NUMBER; + + guint8 Exist_ALPHA_and_GAMMA_TN; + guint8 ALPHA; + guint8 GAMMA_TN; + + guint8 Exist_P0; + guint8 P0; + guint8 BTS_PWR_CTRL_MODE; + guint8 PR_MODE; + + Starting_Frame_Number_t TBF_Starting_Time; +} Single_Block_Allocation_t; + +typedef struct +{ + guint8 TIMESLOT_NUMBER; + + guint8 Exist_ALPHA_and_GAMMA_TN; + guint8 ALPHA; + guint8 GAMMA_TN; + + guint8 Exist_P0; + guint8 P0; + guint8 BTS_PWR_CTRL_MODE; + guint8 PR_MODE; + +} DTM_Single_Block_Allocation_t; + +typedef struct +{ + guint8 UnionType; + union + { + Global_TFI_t Global_TFI; + guint32 TLLI; + guint16 TQI; + Packet_Request_Reference_t Packet_Request_Reference; + } u; +} PacketUplinkID_t; + +typedef struct +{ + gboolean Exist_Packet_Extended_Timing_Advance; + guint8 Packet_Extended_Timing_Advance; +} PUA_GPRS_AdditionsR99_t; + +typedef struct +{ + guint8 CHANNEL_CODING_COMMAND; + guint8 TLLI_BLOCK_CHANNEL_CODING; + Packet_Timing_Advance_t Packet_Timing_Advance; + + guint8 Exist_Frequency_Parameters; + Frequency_Parameters_t Frequency_Parameters; + + guint8 UnionType; + union + { + guint8 extension; + Dynamic_Allocation_t Dynamic_Allocation; + Single_Block_Allocation_t Single_Block_Allocation; + guint8 FixedAllocationDummy; + } u; + + gboolean Exist_AdditionsR99; + PUA_GPRS_AdditionsR99_t AdditionsR99; +} PUA_GPRS_t; + +typedef struct +{ + guint8 BitmapLength; + guint8 ReducedMA_Bitmap[127 / 8 + 1]; + + gboolean Exist_MAIO_2; + guint8 MAIO_2; +} COMPACT_ReducedMA_t; + +typedef struct +{ + guint8 TIMESLOT_NUMBER; + + gboolean Exist_ALPHA_GAMMA_TN; + guint8 ALPHA; + guint8 GAMMA_TN; + + gboolean Exist_P0_BTS_PWR_CTRL_PR_MODE; + guint8 P0; + guint8 BTS_PWR_CTRL_MODE; + guint8 PR_MODE; + + Starting_Frame_Number_t TBF_Starting_Time; + guint8 NUMBER_OF_RADIO_BLOCKS_ALLOCATED; +} MultiBlock_Allocation_t; + +typedef struct +{ + gboolean Exist_CONTENTION_RESOLUTION_TLLI; + guint32 CONTENTION_RESOLUTION_TLLI; + + gboolean Exist_COMPACT_ReducedMA; + COMPACT_ReducedMA_t COMPACT_ReducedMA; + + guint8 EGPRS_CHANNEL_CODING_COMMAND; + guint8 RESEGMENT; + guint8 EGPRS_WindowSize; + + guint8 NrOfAccessTechnologies; /* will hold the number of list elements */ + guint8 AccessTechnologyType[MAX_ACCESS_TECHOLOGY_TYPES]; /* for max size of array see 24.008/Table 10.5.146 */ + + guint8 ARAC_RETRANSMISSION_REQUEST; + guint8 TLLI_BLOCK_CHANNEL_CODING; + + gboolean Exist_BEP_PERIOD2; + guint8 BEP_PERIOD2; + + Packet_Timing_Advance_t PacketTimingAdvance; + + gboolean Exist_Packet_Extended_Timing_Advance; + guint8 Packet_Extended_Timing_Advance; + + gboolean Exist_Frequency_Parameters; + Frequency_Parameters_t Frequency_Parameters; + + guint8 UnionType; + union + { + guint8 extension; + Dynamic_Allocation_t Dynamic_Allocation; + MultiBlock_Allocation_t MultiBlock_Allocation; + guint8 FixedAllocationDummy;/* Fixed Allocation is not used */ + } u; +} PUA_EGPRS_00_t; + +typedef struct +{ + guint8 UnionType; + union + { + PUA_EGPRS_00_t PUA_EGPRS_00; + guint8 PUA_EGPRS_01; + guint8 PUA_EGPRS_10; + guint8 PUA_EGPRS_11; + } u; +} PUA_EGPRS_t; + +enum PUA_Type +{ + PUA_GPRS, + PUA_EGPRS +}; + +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PAGE_MODE; + + guint8 Exist_PERSISTENCE_LEVEL; + guint8 PERSISTENCE_LEVEL[4]; + + PacketUplinkID_t ID; + + guint8 UnionType; + union + { + PUA_GPRS_t PUA_GPRS_Struct; + PUA_EGPRS_t PUA_EGPRS_Struct; + } u; +} Packet_Uplink_Assignment_t; + + +/* < DTM Packet Uplink Assignment message content > */ +typedef struct +{ + guint8 CHANNEL_CODING_COMMAND; + guint8 TLLI_BLOCK_CHANNEL_CODING; + Packet_Timing_Advance_t Packet_Timing_Advance; + + guint8 UnionType; + union + { + guint8 extension; + DTM_Dynamic_Allocation_t DTM_Dynamic_Allocation; + DTM_Single_Block_Allocation_t DTM_Single_Block_Allocation; + } u; + gboolean Exist_EGPRS_Parameters; + guint8 EGPRS_CHANNEL_CODING_COMMAND; + guint8 RESEGMENT; + guint8 EGPRS_WindowSize; + gboolean Exist_Packet_Extended_Timing_Advance; + guint8 Packet_Extended_Timing_Advance; +} DTM_Packet_Uplink_Assignment_t; + +typedef struct +{ + DTM_Packet_Uplink_Assignment_t DTM_Packet_Uplink_Assignment; +}DTM_UL_t; + +/* < DTM Packet Channel Request message content > */ +typedef struct +{ + guint8 DTM_Pkt_Est_Cause; + Channel_Request_Description_t Channel_Request_Description; + gboolean Exist_PFI; + guint8 PFI; +}DTM_Channel_Request_Description_t; + +/* < Packet Downlink Assignment message content > */ +typedef struct +{ + Starting_Frame_Number_t Measurement_Starting_Time; + guint8 MEASUREMENT_INTERVAL; + guint8 MEASUREMENT_BITMAP; +} Measurement_Mapping_struct_t; + +typedef struct +{ + guint8 UnionType; + union + { + Global_TFI_t Global_TFI; + guint32 TLLI; + } u; +} PacketDownlinkID_t; + +typedef struct +{ + gboolean Exist_EGPRS_Params; /* if Exist_EGPRS_Params == FALSE then none of the following 4 vars exist */ + guint8 EGPRS_WindowSize; + guint8 LINK_QUALITY_MEASUREMENT_MODE; + gboolean Exist_BEP_PERIOD2; + guint8 BEP_PERIOD2; + + gboolean Exist_Packet_Extended_Timing_Advance; + guint8 Packet_Extended_Timing_Advance; + + gboolean Exist_COMPACT_ReducedMA; + COMPACT_ReducedMA_t COMPACT_ReducedMA; +} PDA_AdditionsR99_t; + +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PAGE_MODE; + + gboolean Exist_PERSISTENCE_LEVEL; + guint8 PERSISTENCE_LEVEL[4]; + + PacketDownlinkID_t ID; + + guint8 MAC_MODE; + guint8 RLC_MODE; + guint8 CONTROL_ACK; + guint8 TIMESLOT_ALLOCATION; + Packet_Timing_Advance_t Packet_Timing_Advance; + + gboolean Exist_P0_and_BTS_PWR_CTRL_MODE; + guint8 P0; + guint8 BTS_PWR_CTRL_MODE; + guint8 PR_MODE; + + gboolean Exist_Frequency_Parameters; + Frequency_Parameters_t Frequency_Parameters; + + gboolean Exist_DOWNLINK_TFI_ASSIGNMENT; + guint8 DOWNLINK_TFI_ASSIGNMENT; + + gboolean Exist_Power_Control_Parameters; + Power_Control_Parameters_t Power_Control_Parameters; + + gboolean Exist_TBF_Starting_Time; + Starting_Frame_Number_t TBF_Starting_Time; + + guint8 Exist_Measurement_Mapping; + Measurement_Mapping_struct_t Measurement_Mapping; + + gboolean Exist_AdditionsR99; + PDA_AdditionsR99_t AdditionsR99; +} Packet_Downlink_Assignment_t; + +/* < DTM Packet Downlink Assignment message content > */ +typedef struct +{ + guint8 MAC_MODE; + guint8 RLC_MODE; + guint8 TIMESLOT_ALLOCATION; + Packet_Timing_Advance_t Packet_Timing_Advance; + + guint8 Exist_P0_and_BTS_PWR_CTRL_MODE; + guint8 P0; + guint8 BTS_PWR_CTRL_MODE; + guint8 PR_MODE; + + guint8 Exist_Power_Control_Parameters; + Power_Control_Parameters_t Power_Control_Parameters; + + guint8 Exist_DOWNLINK_TFI_ASSIGNMENT; + guint8 DOWNLINK_TFI_ASSIGNMENT; + + guint8 Exist_Measurement_Mapping; + Measurement_Mapping_struct_t Measurement_Mapping; + gboolean EGPRS_Mode; + guint8 EGPRS_WindowSize; + guint8 LINK_QUALITY_MEASUREMENT_MODE; + gboolean Exist_Packet_Extended_Timing_Advance; + guint8 Packet_Extended_Timing_Advance; +} DTM_Packet_Downlink_Assignment_t; + +typedef struct +{ + DTM_Packet_Downlink_Assignment_t DTM_Packet_Downlink_Assignment; +}DTM_DL_t; + +typedef struct +{ + GPRS_Cell_Options_t GPRS_Cell_Options; + GPRS_Power_Control_Parameters_t GPRS_Power_Control_Parameters; +}DTM_GPRS_Broadcast_Information_t; + +typedef struct +{ + DTM_GPRS_Broadcast_Information_t DTM_GPRS_Broadcast_Information; +}DTM_GPRS_B_t; + +/* < Packet Paging Request message content > */ +typedef struct +{ + guint8 UnionType; + union + { + TMSI_t PTMSI; + struct MobileId Mobile_Identity; + } u; +} Page_request_for_TBF_establishment_t; + +typedef struct +{ + guint8 UnionType; + union + { + TMSI_t TMSI; + struct MobileId Mobile_Identity; + } u; + + guint8 CHANNEL_NEEDED; + + guint8 Exist_eMLPP_PRIORITY; + guint8 eMLPP_PRIORITY; +} Page_request_for_RR_conn_t; + +typedef struct +{ + guint8 UnionType; + union + { + Page_request_for_TBF_establishment_t Page_req_TBF; + Page_request_for_RR_conn_t Page_req_RR; + } u; +} Repeated_Page_info_t; + +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PAGE_MODE; + + guint8 Exist_PERSISTENCE_LEVEL; + guint8 PERSISTENCE_LEVEL[4]; + + guint8 Exist_NLN; + guint8 NLN; + + guint8 Count_Repeated_Page_info; + Repeated_Page_info_t Repeated_Page_info[5]; +} Packet_Paging_Request_t; + +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PAGE_MODE; + + guint8 TIMESLOTS_AVAILABLE; +} Packet_PDCH_Release_t; + +/* < Packet Power Control/Timing Advance message content > */ +typedef struct +{ + guint8 UnionType; + union + { + Global_TFI_t Global_TFI; + guint16 TQI; + Packet_Request_Reference_t Packet_Request_Reference; + } u; +} PacketPowerControlTimingAdvanceID_t; + +typedef struct +{ + Global_Packet_Timing_Advance_t Global_Packet_Timing_Advance; + Power_Control_Parameters_t Power_Control_Parameters; +} GlobalTimingAndPower_t; + +typedef struct +{ + guint8 UnionType; + union + { + Global_Packet_Timing_Advance_t Global_Packet_Timing_Advance; + Power_Control_Parameters_t Power_Control_Parameters; + } u; +} GlobalTimingOrPower_t; + +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PAGE_MODE; + + PacketPowerControlTimingAdvanceID_t ID; + + /* -- Message escape */ + guint8 Exist_Global_Power_Control_Parameters; + Global_Power_Control_Parameters_t Global_Power_Control_Parameters; + + guint8 UnionType; + union + { + GlobalTimingAndPower_t GlobalTimingAndPower; + GlobalTimingOrPower_t GlobalTimingOrPower; + } u; +} Packet_Power_Control_Timing_Advance_t; + +/* < Packet Queueing Notification message content > */ +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PAGE_MODE; + + /* 111 Fixed */ + Packet_Request_Reference_t Packet_Request_Reference; + guint16 TQI; +} Packet_Queueing_Notification_t; + +/* < Packet Timeslot Reconfigure message content 04.60 sec. 11.2.31> */ + +typedef Dynamic_Allocation_t TRDynamic_Allocation_t; + +typedef struct +{ + Global_Packet_Timing_Advance_t Global_Packet_Timing_Advance; + + guint8 DOWNLINK_RLC_MODE; + guint8 CONTROL_ACK; + + guint8 Exist_DOWNLINK_TFI_ASSIGNMENT; + guint8 DOWNLINK_TFI_ASSIGNMENT; + + guint8 Exist_UPLINK_TFI_ASSIGNMENT; + guint8 UPLINK_TFI_ASSIGNMENT; + + guint8 DOWNLINK_TIMESLOT_ALLOCATION; + + guint8 Exist_Frequency_Parameters; + Frequency_Parameters_t Frequency_Parameters; +} Common_Timeslot_Reconfigure_t; + +typedef struct +{ + gboolean Exist_Packet_Extended_Timing_Advance; + guint8 Packet_Extended_Timing_Advance; +} PTR_GPRS_AdditionsR99_t; + +typedef struct +{ + guint8 CHANNEL_CODING_COMMAND; + + Common_Timeslot_Reconfigure_t Common_Timeslot_Reconfigure_Data; + + guint8 UnionType; + union + { + TRDynamic_Allocation_t Dynamic_Allocation; + guint8 Fixed_AllocationDummy; + } u; + + gboolean Exist_AdditionsR99; + PTR_GPRS_AdditionsR99_t AdditionsR99; +} PTR_GPRS_t; + +typedef struct +{ + gboolean Exist_COMPACT_ReducedMA; + COMPACT_ReducedMA_t COMPACT_ReducedMA; + + guint8 EGPRS_ChannelCodingCommand; + guint8 RESEGMENT; + + gboolean Exist_DOWNLINK_EGPRS_WindowSize; + guint8 DOWNLINK_EGPRS_WindowSize; + + gboolean Exist_UPLINK_EGPRS_WindowSize; + guint8 UPLINK_EGPRS_WindowSize; + + guint8 LINK_QUALITY_MEASUREMENT_MODE; + + gboolean Exist_Packet_Extended_Timing_Advance; + guint8 Packet_Extended_Timing_Advance; + + Common_Timeslot_Reconfigure_t Common_Timeslot_Reconfigure_Data; + + guint8 UnionType; + union + { + TRDynamic_Allocation_t Dynamic_Allocation; + guint8 FixedAllocationDummy; + } u; +} PTR_EGPRS_00_t; + +typedef struct +{ + guint8 UnionType; + union + { + PTR_EGPRS_00_t PTR_EGPRS_00; + guint8 extension_01; + guint8 extension_10; + guint8 extension_11; + } u; +} PTR_EGPRS_t; + +enum PTR_Type +{ + PTR_GPRS, + PTR_EGPRS +}; + +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PAGE_MODE; + + Global_TFI_t Global_TFI; + + guint8 UnionType; + union + { + PTR_GPRS_t PTR_GPRS_Struct; + PTR_EGPRS_t PTR_EGPRS_Struct; + } u; +} Packet_Timeslot_Reconfigure_t; + + +/* < PSI1 message content > */ +typedef struct +{ + guint8 ACC_CONTR_CLASS[2]; + guint8 MAX_RETRANS[4]; + guint8 S; + guint8 TX_INT; + + guint8 Exist_PERSISTENCE_LEVEL; + guint8 PERSISTENCE_LEVEL[4]; +} PRACH_Control_t; + +typedef struct +{ + guint8 BS_PCC_REL; + guint8 BS_PBCCH_BLKS; + guint8 BS_PAG_BLKS_RES; + guint8 BS_PRACH_BLKS; +} PCCCH_Organization_t; + +typedef struct +{ + guint8 MSCR; + guint8 SGSNR; + guint8 BandIndicator; +} PSI1_AdditionsR99_t; + +typedef struct +{ + guint8 MESSAGE_TYPE; + + guint8 PAGE_MODE; + guint8 PBCCH_CHANGE_MARK; + guint8 PSI_CHANGE_FIELD; + guint8 PSI1_REPEAT_PERIOD; + guint8 PSI_COUNT_LR; + + guint8 Exist_PSI_COUNT_HR; + guint8 PSI_COUNT_HR; + + guint8 MEASUREMENT_ORDER; + GPRS_Cell_Options_t GPRS_Cell_Options; + PRACH_Control_t PRACH_Control; + PCCCH_Organization_t PCCCH_Organization; + Global_Power_Control_Parameters_t Global_Power_Control_Parameters; + guint8 PSI_STATUS_IND; + + gboolean Exist_AdditionsR99; + PSI1_AdditionsR99_t AdditionsR99; +} PSI1_t; + +/* < PSI2 message content > */ +typedef struct +{ + guint8 NUMBER; + + guint8 Length; + guint8 Contents[15 + 3];/* octet (val(Length of RFL contents) + 3) */ +} Reference_Frequency_t; + +typedef struct +{ + guint8 NoOfRFLs; + guint8 RFL_Number[MAX_RFLS]; +} Cell_Allocation_t; + +typedef struct +{ + guint8 NUMBER; + GPRS_Mobile_Allocation_t Mobile_Allocation; +} PSI2_MA_t; + +typedef struct +{ + guint16 ARFCN; + guint8 TIMESLOT_ALLOCATION; +} Non_Hopping_PCCCH_Carriers_t; + +typedef struct +{ + guint8 Count_Carriers; + Non_Hopping_PCCCH_Carriers_t Carriers[7]; +} NonHoppingPCCCH_t; + +typedef struct +{ + guint8 MAIO; + guint8 TIMESLOT_ALLOCATION; +} Hopping_PCCCH_Carriers_t; + +typedef struct +{ + guint8 MA_NUMBER; + + guint8 Count_Carriers; + Hopping_PCCCH_Carriers_t Carriers[10];/* MAX_PCCCH but 10 is theoretical max. */ +} HoppingPCCCH_t; + +typedef struct +{ + guint8 TSC; + + guint8 UnionType; + union + { + NonHoppingPCCCH_t NonHopping; + HoppingPCCCH_t Hopping; + } u; +} PCCCH_Description_t; + +typedef struct +{ + LAI_t LAI; + guint8 RAC; + CellId_t Cell_Identity; +} Cell_Identification_t; + +typedef struct +{ + guint8 ATT; + + guint8 Exist_T3212; + guint8 T3212; + + guint8 NECI; + guint8 PWRC; + guint8 DTX; + guint8 RADIO_LINK_TIMEOUT; + guint8 BS_AG_BLKS_RES; + guint8 CCCH_CONF; + guint8 BS_PA_MFRMS; + guint8 MAX_RETRANS; + guint8 TX_INTEGER; + guint8 EC; + guint8 MS_TXPWR_MAX_CCCH; + + guint8 Exist_Extension_Bits; + Extension_Bits_t Extension_Bits; +} Non_GPRS_Cell_Options_t; + +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PAGE_MODE; + guint8 CHANGE_MARK; + guint8 INDEX; + guint8 COUNT; + + guint8 Exist_Cell_Identification; + Cell_Identification_t Cell_Identification; + + guint8 Exist_Non_GPRS_Cell_Options; + Non_GPRS_Cell_Options_t Non_GPRS_Cell_Options; + + guint8 Count_Reference_Frequency; + Reference_Frequency_t Reference_Frequency[MAX_RFLS]; + + Cell_Allocation_t Cell_Allocation; + + guint8 Count_GPRS_MA; + PSI2_MA_t GPRS_MA[MAX_MA_LISTS_IN_PSI2]; + + guint8 Count_PCCCH_Description; + PCCCH_Description_t PCCCH_Description[7];/* MAX_PCCCH but it is impossible that more than 7 can be decoded */ +} PSI2_t; + +/* < PSI3 message content > */ +typedef struct +{ + guint8 PRIORITY_CLASS; + guint8 HCS_THR; +} HCS_t; + +typedef struct +{ + guint8 CELL_BAR_ACCESS_2; + guint8 EXC_ACC; + guint8 GPRS_RXLEV_ACCESS_MIN; + guint8 GPRS_MS_TXPWR_MAX_CCH; + + guint8 Exist_HCS; + HCS_t HCS; + guint8 MULTIBAND_REPORTING; +} Serving_Cell_params_t; + +typedef struct +{ + guint8 GPRS_CELL_RESELECT_HYSTERESIS; + guint8 C31_HYST; + guint8 C32_QUAL; + guint8 RANDOM_ACCESS_RETRY; + + guint8 Exist_T_RESEL; + guint8 T_RESEL; + + guint8 Exist_RA_RESELECT_HYSTERESIS; + guint8 RA_RESELECT_HYSTERESIS; +} Gen_Cell_Sel_t; + +typedef struct +{ + guint8 PBCCH_LOCATION; + guint8 PSI1_REPEAT_PERIOD; +} Location_Repeat_t; + +typedef struct +{ + guint8 UnionType; + union + { + guint8 SI13_LOCATION; + Location_Repeat_t lr; + } u; +} SI13_PBCCH_Location_t; + +typedef struct +{ + guint8 BSIC; + guint8 CELL_BAR_ACCESS_2; + guint8 EXC_ACC; + guint8 SAME_RA_AS_SERVING_CELL; + + guint8 Exist_RXLEV_and_TXPWR; + guint8 GPRS_RXLEV_ACCESS_MIN; + guint8 GPRS_MS_TXPWR_MAX_CCH; + + guint8 Exist_OFFSET_and_TIME; + guint8 GPRS_TEMPORARY_OFFSET; + guint8 GPRS_PENALTY_TIME; + + guint8 Exist_GPRS_RESELECT_OFFSET; + guint8 GPRS_RESELECT_OFFSET; + + guint8 Exist_HCS; + HCS_t HCS; + + guint8 Exist_SI13_PBCCH_Location; + SI13_PBCCH_Location_t SI13_PBCCH_Location; +} Cell_Selection_t; + +/* Neigbour cell list as used in PSI3 and PSI3bis */ +typedef struct +{ + guint8 FREQ_DIFF_LENGTH; + guint8 FREQUENCY_DIFF; + + Cell_Selection_t Cell_SelectionParams; +} Cell_Selection_Params_With_FreqDiff_t; + +typedef struct +{ + guint16 START_FREQUENCY; + Cell_Selection_t Cell_Selection; + guint8 NR_OF_REMAINING_CELLS; + guint8 FREQ_DIFF_LENGTH; + + Cell_Selection_Params_With_FreqDiff_t Cell_Selection_Params_With_FreqDiff[16]; +} NeighbourCellParameters_t; + +typedef struct +{ + guint8 Count; + NeighbourCellParameters_t Parameters[32]; +} NeighbourCellList_t; + +/* < PSI3 message content > */ + +typedef struct +{ + guint8 bsic; + guint8 CELL_BAR_ACCESS_2; + guint8 EXC_ACC; + guint8 SAME_RA_AS_SERVING_CELL; + guint8 Exist_GPRS_RXLEV_ACCESS_MIN; + guint8 GPRS_RXLEV_ACCESS_MIN; + guint8 GPRS_MS_TXPWR_MAX_CCH; + guint8 Exist_GPRS_TEMPORARY_OFFSET; + guint8 GPRS_TEMPORARY_OFFSET; + guint8 GPRS_PENALTY_TIME; + guint8 Exist_GPRS_RESELECT_OFFSET; + guint8 GPRS_RESELECT_OFFSET; + guint8 Exist_Hcs_Parm; + HCS_t HCS_Param; + guint8 Exist_TIME_GROUP; + guint8 TIME_GROUP; + guint8 Exist_GUAR_CONSTANT_PWR_BLKS; + guint8 GUAR_CONSTANT_PWR_BLKS; +}COMPACT_Cell_Sel_t; + +typedef struct +{ + guint8 FREQ_DIFF_LENGTH; + guint16 FREQUENCY_DIFF; + COMPACT_Cell_Sel_t COMPACT_Cell_Sel_Remain_Cells; +}COMPACT_Neighbour_Cell_Param_Remaining_t; + +typedef struct +{ + guint16 START_FREQUENCY; + COMPACT_Cell_Sel_t COMPACT_Cell_Sel; + guint8 NR_OF_REMAINING_CELLS; + guint8 FREQ_DIFF_LENGTH; + COMPACT_Neighbour_Cell_Param_Remaining_t COMPACT_Neighbour_Cell_Param_Remaining[16]; +}COMPACT_Neighbour_Cell_Param_t; + +typedef struct +{ + Cell_Identification_t Cell_Identification; + guint8 COMPACT_Neighbour_Cell_Param_Count; + COMPACT_Neighbour_Cell_Param_t COMPACT_Neighbour_Cell_Param[8]; +}COMPACT_Info_t; + +typedef struct +{ + guint8 Exist_CCN_Support_Desc; + CCN_Support_Description_t CCN_Support_Desc; +}PSI3_AdditionR4_t; + +typedef struct +{ + guint8 Exist_COMPACT_Info; + COMPACT_Info_t COMPACT_Info; + guint8 Exist_AdditionR4; + PSI3_AdditionR4_t AdditionR4; +}PSI3_AdditionR99_t; + +typedef struct +{ + LSA_ID_Info_t Scell_LSA_ID_Info; + guint8 Exist_LSA_Parameters; + LSA_Parameters_t LSA_Parameters; + guint8 Exist_AdditionR99; + PSI3_AdditionR99_t AdditionR99; +}PSI3_AdditionR98_t; + +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PAGE_MODE; + guint8 CHANGE_MARK; + guint8 BIS_COUNT; + + Serving_Cell_params_t Serving_Cell_params; + + Gen_Cell_Sel_t General_Cell_Selection; + NeighbourCellList_t NeighbourCellList; + + guint8 Exist_AdditionR98; + PSI3_AdditionR98_t AdditionR98; +} PSI3_t; + +/* < PSI3_BIS message content > */ +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PAGE_MODE; + guint8 CHANGE_MARK; + guint8 BIS_INDEX; + guint8 BIS_COUNT; + + NeighbourCellList_t NeighbourCellList; +} PSI3_BIS_t; + +/* < PSI4 message content > */ +typedef struct +{ + guint8 MA_NUMBER; + guint8 MAIO; +} h_CG_t; + +typedef struct +{ + guint8 UnionType; + union + { + guint16 ARFCN; + h_CG_t h_CG; + } u; + + guint8 TIMESLOT_ALLOCATION; +} Channel_Group_t; + +typedef struct +{ + /* Channel_Group_t Channel_Group + * At least one + * the first one is unpacked in the index + */ + guint8 Count_Channel_Group; + Channel_Group_t Channel_Group[8]; +} Channel_List_t; + +typedef struct +{ + guint8 MESSAGE_TYPE; + + guint8 PAGE_MODE; + guint8 CHANGE_MARK; + guint8 INDEX; + guint8 COUNT; + + Channel_List_t Channel_List; + +} PSI4_t; + + +/* < PSI5 message content > */ +typedef struct +{ + guint8 existRepParamsFDD; + guint8 RepQuantFDD; + guint8 MultiratReportingFDD; + + guint8 existReportingParamsFDD; + guint8 ReportingOffsetFDD; + guint8 ReportingThresholdFDD; + + guint8 existMultiratReportingTDD; + guint8 MultiratReportingTDD; + + guint8 existOffsetThresholdTDD; + guint8 ReportingOffsetTDD; + guint8 ReportingThresholdTDD; +} GPRSMeasurementParams3G_PSI5_t; + +typedef struct +{ + guint8 REPORT_TYPE; + guint8 REPORTING_RATE; + guint8 INVALID_BSIC_REPORTING; + guint8 Exist_NCC_PERMITTED; + guint8 NCC_PERMITTED; + + gboolean Exist_GPRSMeasurementParams; + MeasurementParams_t GPRSMeasurementParams; + gboolean Exist_GPRSMeasurementParams3G; + GPRSMeasurementParams3G_PSI5_t GPRSMeasurementParams3G; +} ENH_Reporting_Parameters_t; + +typedef struct +{ + guint8 Exist_OffsetThreshold_700; + OffsetThreshold_t OffsetThreshold_700; + guint8 Exist_OffsetThreshold_810; + OffsetThreshold_t OffsetThreshold_810; +}PSI5_AdditionsR7; + +typedef struct +{ + guint8 Exist_GPRS_AdditionalMeasurementParams3G; + GPRS_AdditionalMeasurementParams3G_t GPRS_AdditionalMeasurementParams3G; + guint8 Exist_AdditionsR7; + PSI5_AdditionsR7 AdditionsR7; +}PSI5_AdditionsR5; + +typedef struct +{ + guint8 Exist_ENH_Reporting_Param; + ENH_Reporting_Parameters_t ENH_Reporting_Param; + guint8 Exist_AdditionsR5; + PSI5_AdditionsR5 AdditionisR5; +}PSI5_AdditionsR99; + +typedef struct +{ + guint8 MESSAGE_TYPE; + + guint8 PAGE_MODE; + guint8 CHANGE_MARK; + guint8 INDEX; + guint8 COUNT; + + guint8 Eixst_NC_Meas_Param; + NC_Measurement_Parameters_t NC_Meas_Param; + guint8 Exist_AdditionsR99; + PSI5_AdditionsR99 AdditionsR99; +} PSI5_t; + + + + +/* < PSI13 message content > + * Combined with SI13 + */ +typedef struct +{ + guint8 Exist_LB_MS_TXPWR_MAX_CCH; + guint8 LB_MS_TXPWR_MAX_CCH; + guint8 SI2n_SUPPORT; +}PSI13_AdditionsR6; + +typedef PSI13_AdditionsR6 SI13_AdditionsR6; + +typedef struct +{ + guint8 SI_STATUS_IND; + guint8 Exist_AdditionsR6; + PSI13_AdditionsR6 AdditionsR6; +}PSI13_AdditionsR4; + +typedef PSI13_AdditionsR4 SI13_AdditionsR4; + +typedef struct +{ + guint8 SGSNR; + gboolean Exist_AdditionsR4; + PSI13_AdditionsR4 AdditionsR4; +}PSI13_AdditionR99; + +typedef PSI13_AdditionR99 SI13_AdditionR99; + +typedef struct +{ + guint8 Exist; + guint8 MESSAGE_TYPE; + + guint8 PAGE_MODE; + guint8 BCCH_CHANGE_MARK; + guint8 SI_CHANGE_FIELD; + + guint8 Exist_MA; + guint8 SI13_CHANGE_MARK; + GPRS_Mobile_Allocation_t GPRS_Mobile_Allocation; + + guint8 UnionType; + union + { + PBCCH_Not_present_t PBCCH_Not_present; + PBCCH_present_t PBCCH_present; + } u; + + gboolean Exist_AdditionsR99; + PSI13_AdditionR99 AdditionsR99; +} PSI13_t; + +/* SI_13_t is combined in the PSI13 structure */ +typedef PSI13_t SI_13_t; + +/* < Packet PRACH Parameters message content > */ +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PAGE_MODE; + + + PRACH_Control_t PRACH_Control; +} Packet_PRACH_Parameters_t; + +/* < Packet Access Reject message content > */ +typedef struct +{ + guint8 UnionType; + union + { + guint32 TLLI; + Packet_Request_Reference_t Packet_Request_Reference; + Global_TFI_t Global_TFI; + } u; +} RejectID_t; + +typedef struct +{ + RejectID_t ID; + + guint8 Exist_Wait; + guint8 WAIT_INDICATION; + guint8 WAIT_INDICATION_SIZE; +} Reject_t; + +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PAGE_MODE; + + guint8 IndexToOur; + guint8 Count_Reject; + Reject_t Reject[5]; +} Packet_Access_Reject_t; + +/* < Packet Cell Change Order message content > */ +typedef struct +{ + guint8 CELL_BAR_ACCESS_2; + guint8 EXC_ACC; + guint8 SAME_RA_AS_SERVING_CELL; + + guint8 Exist_RXLEV_and_TXPWR; + guint8 GPRS_RXLEV_ACCESS_MIN; + guint8 GPRS_MS_TXPWR_MAX_CCH; + + guint8 Exist_OFFSET_and_TIME; + guint8 GPRS_TEMPORARY_OFFSET; + guint8 GPRS_PENALTY_TIME; + + guint8 Exist_GPRS_RESELECT_OFFSET; + guint8 GPRS_RESELECT_OFFSET; + + guint8 Exist_HCS; + HCS_t HCS; + + guint8 Exist_SI13_PBCCH_Location; + SI13_PBCCH_Location_t SI13_PBCCH_Location; +} Cell_Selection_2_t; + +typedef struct +{ + guint8 FREQUENCY_DIFF; + guint8 BSIC; + Cell_Selection_t Cell_Selection; +} h_FreqBsicCell_t; + +typedef struct +{ + guint8 FREQ_DIFF_LENGTH; + guint8 FREQUENCY_DIFF; + guint8 BSIC; + + gboolean Exist_CellSelectionParams; + Cell_Selection_2_t CellSelectionParams; +} CellSelectionParamsWithFreqDiff_t; + +typedef struct +{ + guint16 START_FREQUENCY; + guint8 BSIC; + + guint8 Exist_Cell_Selection; + Cell_Selection_2_t Cell_Selection; + + guint8 NR_OF_FREQUENCIES; + guint8 FREQ_DIFF_LENGTH; + + + CellSelectionParamsWithFreqDiff_t CellSelectionParamsWithFreqDiff[32]; +} Add_Frequency_list_t; + +typedef struct +{ + guint8 REMOVED_FREQ_INDEX; +} Removed_Freq_Index_t; + +typedef struct +{ + guint8 Exist_REMOVED_FREQ; + guint8 NR_OF_REMOVED_FREQ; + Removed_Freq_Index_t Removed_Freq_Index[32]; + + guint8 Count_Add_Frequency; + Add_Frequency_list_t Add_Frequency[32]; +} NC_Frequency_list_t; + + +typedef struct +{ + guint8 NETWORK_CONTROL_ORDER; + + guint8 Exist_NC; + guint8 NC_NON_DRX_PERIOD; + guint8 NC_REPORTING_PERIOD_I; + guint8 NC_REPORTING_PERIOD_T; + + guint8 Exist_NC_FREQUENCY_LIST; + NC_Frequency_list_t NC_Frequency_list; +} NC_Measurement_Parameters_with_Frequency_List_t; + + +typedef struct +{ + guint8 BA_IND; + guint8 BA_IND_3G; +} BA_IND_t; + +typedef struct +{ + guint8 BA_USED; + guint8 BA_USED_3G; +} BA_USED_t; + +typedef struct +{ + guint8 RXLEV_SERVING_CELL; +} Serving_Cell_Data_t; + +typedef struct +{ + guint8 FREQUENCY_N; + guint8 Exist_BSIC_N; + guint8 BSIC_N; + guint8 RXLEV_N; +} NC_Measurements_t; + +typedef struct +{ + guint8 BCCH_FREQ_N; + guint8 BSIC_N; + guint8 RXLEV_N; +} RepeatedInvalid_BSIC_Info_t; + +typedef struct +{ + guint8 Exist_REPORTING_QUANTITY; + guint8 REPORTING_QUANTITY; +} REPORTING_QUANTITY_Instance_t; + +typedef struct +{ + guint8 NC_MODE; + Serving_Cell_Data_t Serving_Cell_Data; + + guint8 NUMBER_OF_NC_MEASUREMENTS; + NC_Measurements_t NC_Measurements[6]; /* NC_Measurements * (val(NUMBER_OF_NC_MEASUREMENTS)) + Max 7 NC Measurements in one PACKET MEASUREMENT REPORT, + but only 6 cells are updated in PACKET IDLE. */ +} NC_Measurement_Report_t; + +typedef struct +{ + guint8 EXT_REPORTING_TYPE; + + guint8 Exist_I_LEVEL; + struct + { + guint8 Exist; + guint8 I_LEVEL; + } Slot[8]; + + guint8 NUMBER_OF_EXT_MEASUREMENTS; + NC_Measurements_t EXT_Measurements[9]; /* EXT_Measurements * (val(NUMBER_OF_NC_MEASUREMENTS)) + Max 9 Ext Measurements in one PACKET MEASUREMENT REPORT */ +} EXT_Measurement_Report_t; + +typedef struct +{ + guint8 CELL_LIST_INDEX_3G; + guint8 REPORTING_QUANTITY; +} Measurements_3G_t; + +typedef struct +{ + guint32 UTRAN_CGI; + guint8 Exist_PLMN_ID; + PLMN_t Plmn_ID; + guint32 CSG_ID; + gboolean Access_Mode; + guint8 REPORTING_QUANTITY; +}UTRAN_CSG_Measurement_Report_t; + +typedef struct +{ + guint32 EUTRAN_CGI; + guint16 Tracking_Area_Code; + guint8 Exist_PLMN_ID; + PLMN_t Plmn_ID; + guint32 CSG_ID; + gboolean Access_Mode; + guint8 REPORTING_QUANTITY; +}EUTRAN_CSG_Measurement_Report_t; + +typedef struct +{ + gboolean Exist_UTRAN_CSG_Meas_Rpt; + UTRAN_CSG_Measurement_Report_t UTRAN_CSG_Meas_Rpt; + gboolean Exist_EUTRAN_CSG_Meas_Rpt; + EUTRAN_CSG_Measurement_Report_t EUTRAN_CSG_Meas_Rpt; +}PMR_AdditionsR9_t; + +typedef struct +{ + guint8 EUTRAN_FREQUENCY_INDEX; + guint16 CELL_IDENTITY; + guint8 REPORTING_QUANTITY; +}EUTRAN_Measurement_Report_Body_t; + +typedef struct +{ + guint8 N_EUTRAN; + EUTRAN_Measurement_Report_Body_t Report[4]; +}EUTRAN_Measurement_Report_t; + +typedef struct +{ + gboolean Exist_EUTRAN_Meas_Rpt; + EUTRAN_Measurement_Report_t EUTRAN_Meas_Rpt; + gboolean Exist_AdditionsR9; + PMR_AdditionsR9_t AdditionsR9; +}PMR_AdditionsR8_t; + +typedef struct +{ + gboolean Exist_GRNTI; + guint8 GRNTI; + gboolean Exist_AdditionsR8; + PMR_AdditionsR8_t AdditionsR8; +}PMR_AdditionsR5_t; + +typedef struct +{ + gboolean Exist_Info3G; + guint8 UnionType; + union + { + BA_USED_t BA_USED; + guint8 PSI3_CHANGE_MARK; + } u; + guint8 PMO_USED; + + /* N_3G bit(3): max value 7 + * Report part (csn): {<3G_CELL_LIST_INDEX:bit(7)>}*(val(N_3G + 1)) + * Max 6 3G measurement structs in one PMR + */ + gboolean Exist_MeasurementReport3G; + guint8 N_3G; + Measurements_3G_t Measurements_3G[6]; + + gboolean Exist_AdditionsR5; + PMR_AdditionsR5_t AdditionsR5; +} PMR_AdditionsR99_t; + +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PayloadType; + guint8 spare; + guint8 R; + + guint32 TLLI; + guint8 Exist_PSI5_CHANGE_MARK; + guint8 PSI5_CHANGE_MARK; + + guint8 UnionType; + union + { + NC_Measurement_Report_t NC_Measurement_Report; + EXT_Measurement_Report_t EXT_Measurement_Report; + } u; + + gboolean Exist_AdditionsR99; + PMR_AdditionsR99_t AdditionsR99; +} Packet_Measurement_Report_t; + +#define INV_BSIC_LIST_LEN (16) + +#define REPORT_QUANTITY_LIST_LEN (96) /* Specification specified up to 96 */ + +typedef struct +{ + guint8 NC_MODE; + guint8 UnionType; + union + { + BA_USED_t BA_USED; + guint8 PSI3_CHANGE_MARK; + } u; + + guint8 PMO_USED; + guint8 BSIC_Seen; + guint8 SCALE; + + guint8 Exist_Serving_Cell_Data; + Serving_Cell_Data_t Serving_Cell_Data; + + guint8 Count_RepeatedInvalid_BSIC_Info; + RepeatedInvalid_BSIC_Info_t RepeatedInvalid_BSIC_Info[INV_BSIC_LIST_LEN]; + + guint8 Exist_ReportBitmap; + guint8 Count_REPORTING_QUANTITY_Instances; + REPORTING_QUANTITY_Instance_t REPORTING_QUANTITY_Instances[REPORT_QUANTITY_LIST_LEN]; + +} ENH_NC_Measurement_Report_t; + +typedef struct +{ + guint8 Exist_UTRAN_CSG_Target_Cell; + UTRAN_CSG_Target_Cell_t UTRAN_CSG_Target_Cell; + guint8 Exist_EUTRAN_CSG_Target_Cell; + EUTRAN_CSG_Target_Cell_t EUTRAN_CSG_Target_Cell; +}PEMR_AdditionsR9_t; + +typedef struct +{ + gboolean Exist_REPORTING_QUANTITY; + guint8 REPORTING_QUANTITY; +}Bitmap_Report_Quantity_t; + +typedef struct +{ + guint8 BITMAP_LENGTH; + Bitmap_Report_Quantity_t Bitmap_Report_Quantity[128]; + gboolean Exist_EUTRAN_Meas_Rpt; + EUTRAN_Measurement_Report_t EUTRAN_Meas_Rpt; + gboolean Exist_AdditionsR9; + PEMR_AdditionsR9_t AdditionsR9; +}PEMR_AdditionsR8_t; + +typedef struct +{ + gboolean Exist_GRNTI_Ext; + guint8 GRNTI_Ext; + gboolean Exist_AdditionsR8; + PEMR_AdditionsR8_t AdditionsR8; +}PEMR_AdditionsR5_t; + +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PayloadType; + guint8 spare; + guint8 R; + + guint32 TLLI; + + ENH_NC_Measurement_Report_t Measurements; + + gboolean Exist_AdditionsR5; + PEMR_AdditionsR5_t AdditionsR5; +} Packet_Enh_Measurement_Report_t; + +typedef struct +{ + guint8 RXLEV_SERVING_CELL; + + guint8 NUMBER_OF_NC_MEASUREMENTS; + NC_Measurements_t NC_Measurements[6]; /* NC_Measurements * (val(NUMBER_OF_NC_MEASUREMENTS)) + Max 7 NC Measurements in one PACKET MEASUREMENT REPORT, + but only 6 cells are updated in PACKET IDLE. */ +} CCN_Measurement_Report_t; + +typedef struct +{ + guint16 ARFCN; + guint8 BSIC; +} Target_Cell_GSM_Notif_t; + +typedef struct +{ + guint16 FDD_ARFCN; + guint8 Exist_Bandwith_FDD; + guint8 BANDWITH_FDD; + guint16 SCRAMBLING_CODE; +} FDD_Target_Cell_Notif_t; + +typedef struct +{ + guint16 TDD_ARFCN; + guint8 Exist_Bandwith_TDD; + guint8 BANDWITH_TDD; + guint8 CELL_PARAMETER; + guint8 Sync_Case_TSTD; +}TDD_Target_Cell_Notif_t; + +typedef struct +{ + guint8 Exist_FDD_Description; + FDD_Target_Cell_Notif_t FDD_Target_Cell_Notif; + guint8 Exist_TDD_Description; + TDD_Target_Cell_Notif_t TDD_Target_Cell; + guint8 REPORTING_QUANTITY; +} Target_Cell_3G_Notif_t; + +typedef struct +{ + guint16 EARFCN; + guint8 Exist_Measurement_Bandwidth; + guint8 Measurement_Bandwidth; + guint16 Physical_Layer_Cell_Identity; + guint8 Reporting_Quantity; +}Target_EUTRAN_Cell_Notif_t; + +typedef struct +{ + guint8 EUTRAN_FREQUENCY_INDEX; + guint16 CELL_IDENTITY; + guint8 REPORTING_QUANTITY; +}Eutran_Ccn_Measurement_Report_Cell_t; + +typedef struct +{ + gboolean ThreeG_BA_USED; + guint8 N_EUTRAN; + Eutran_Ccn_Measurement_Report_Cell_t Eutran_Ccn_Measurement_Report_Cell[4]; +}Eutran_Ccn_Measurement_Report_t; + +typedef struct +{ + guint8 Exist_Arfcn; + guint16 Arfcn; + guint8 bsic; + guint8 Exist_3G_Target_Cell; + Target_Cell_3G_Notif_t Target_Cell_3G_Notif; + guint8 Exist_Eutran_Target_Cell; + Target_EUTRAN_Cell_Notif_t Target_EUTRAN_Cell; + guint8 Exist_Eutran_Ccn_Measurement_Report; + Eutran_Ccn_Measurement_Report_t Eutran_Ccn_Measurement_Report; +}Target_Cell_4G_Notif_t; + +typedef struct +{ + guint8 UnionType; + union + { + UTRAN_CSG_Measurement_Report_t UTRAN_CSG_Measurement_Report; + EUTRAN_CSG_Measurement_Report_t EUTRAN_CSG_Measurement_Report; + } u; + guint8 Exist_Eutran_Ccn_Measurement_Report; + Eutran_Ccn_Measurement_Report_t Eutran_Ccn_Measurement_Report; +}Target_Cell_CSG_Notif_t; + +typedef struct +{ + guint8 UnionType; + union + { + Target_Cell_4G_Notif_t Target_Cell_4G_Notif; + Target_Cell_CSG_Notif_t Target_Cell_CSG_Notif; + } u; +}Target_Other_RAT_2_Notif_t; + +typedef struct +{ + guint8 UnionType; + union + { + Target_Cell_3G_Notif_t Target_Cell_3G_Notif; + Target_Other_RAT_2_Notif_t Target_Other_RAT_2_Notif; + } u; + +}Target_Other_RAT_Notif_t; + +typedef struct +{ + guint8 UnionType; + union + { + Target_Cell_GSM_Notif_t Target_Cell_GSM_Notif; + Target_Other_RAT_Notif_t Target_Other_RAT_Notif; + } u; +} Target_Cell_t; + +typedef struct +{ + guint8 Exist_BA_USED_3G; + guint8 BA_USED_3G; + + guint8 N_3G; + Measurements_3G_t Measurements_3G[6]; +} PCCN_AdditionsR6_t; + +/* < Packet Cell Change Notification message contents > */ +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PayloadType; + guint8 spare; + guint8 R; + + Global_TFI_t Global_TFI; + + Target_Cell_t Target_Cell; + + guint8 UnionType; + union + { + guint8 BA_IND; + guint8 PSI3_CHANGE_MARK; + } u; + guint8 PMO_USED; + guint8 PCCN_SENDING; + CCN_Measurement_Report_t CCN_Measurement_Report; + + gboolean Exist_AdditionsR6; + PCCN_AdditionsR6_t AdditionsR6; +} Packet_Cell_Change_Notification_t; + +/* < Packet Cell Change Order message contents > */ + + +typedef struct +{ + guint8 FrequencyScrolling; + guint8 BSIC; +} BSICDesc_t; + + +#define MAX_BSIC_DESCS (19) /* Due to message size (23 bytes) and header etc, + * there cannot be more than 19 DESCS. + */ + +typedef struct +{ + gboolean Exist_IndexStartBA; + guint8 IndexStartBA; + guint8 BSIC; + guint8 NumRemainingBSICs; + BSICDesc_t BSICDesc[MAX_BSIC_DESCS]; +} BSICList_t; + +typedef BSICList_t GPRSBSICList_t; + +#define MAX_RTD_VALUES (6) + +typedef struct +{ + guint8 NumRTDValues; + guint16 RTD[MAX_RTD_VALUES]; +} RTDValues_t; + +typedef struct +{ + gboolean Exist_StartValue; + guint8 StartValue; +} BAIndexStartRTD_t; + +#define MAX_RTD_FREQS (32) + +typedef struct +{ + BAIndexStartRTD_t BAIndexStart; + guint8 NumFreqs; + RTDValues_t RTD_s[MAX_RTD_FREQS]; +} RTDList_t; + +typedef struct +{ + gboolean Exist_ListRTD6; + RTDList_t ListRTD6; + + gboolean Exist_ListRTD12; + RTDList_t ListRTD12; +} RealTimeDiffs_t; + + +typedef MeasurementParams_t GPRSMeasurementParams_PMO_PCCO_t; + +typedef struct { + gboolean existMultiratReporting; + guint8 MultiratReporting; + + gboolean existOffsetThreshold; + OffsetThreshold_t OffsetThreshold; +} MultiratParams3G_t; + +typedef struct +{ + guint8 Qsearch_P; + guint8 SearchPrio3G; + + gboolean existRepParamsFDD; + guint8 RepQuantFDD; + guint8 MultiratReportingFDD; + + gboolean existOffsetThreshold; + OffsetThreshold_t OffsetThreshold; + + MultiratParams3G_t ParamsTDD; + MultiratParams3G_t ParamsCDMA2000; +} ENH_GPRSMeasurementParams3G_PMO_t; + + +typedef struct +{ + guint8 Qsearch_P; + guint8 SearchPrio3G; + + gboolean existRepParamsFDD; + guint8 RepQuantFDD; + guint8 MultiratReportingFDD; + + gboolean existOffsetThreshold; + OffsetThreshold_t OffsetThreshold; + + MultiratParams3G_t ParamsTDD; +} ENH_GPRSMeasurementParams3G_PCCO_t; + + +typedef struct +{ + guint8 Qsearch_p; + guint8 SearchPrio3G; + + guint8 existRepParamsFDD; + guint8 RepQuantFDD; + guint8 MultiratReportingFDD; + + guint8 existReportingParamsFDD; + guint8 ReportingOffsetFDD; + guint8 ReportingThresholdFDD; + + guint8 existMultiratReportingTDD; + guint8 MultiratReportingTDD; + + guint8 existOffsetThresholdTDD; + guint8 ReportingOffsetTDD; + guint8 ReportingThresholdTDD; +} GPRSMeasurementParams3G_t; + +typedef struct +{ + guint8 REMOVED_3GCELL_INDEX; + guint8 CELL_DIFF_LENGTH_3G; + guint8 CELL_DIFF_3G; +} N2_t; + +typedef struct +{ + guint8 N2_Count; + N2_t N2s[32]; +} N1_t; + +typedef struct +{ + guint8 N1_Count; + N1_t N1s[4]; +} Removed3GCellDescription_t; + +typedef struct +{ + guint8 Complete_This; +} CDMA2000_Description_t; + +typedef struct { + guint8 ZERO; + guint16 UARFCN; + guint8 Indic0; + guint8 NrOfCells; + guint8 BitsInCellInfo; + guint8 CellInfo[16]; /* bitmap compressed according to "Range 1024" algorithm (04.18/9.1.54) */ +} UTRAN_FDD_NeighbourCells_t; + +typedef struct { + gboolean existBandwidth; + guint8 Bandwidth; + guint8 NrOfFrequencies; + UTRAN_FDD_NeighbourCells_t CellParams[8]; +} UTRAN_FDD_Description_t; + +typedef struct { + guint8 ZERO; + guint16 UARFCN; + guint8 Indic0; + guint8 NrOfCells; + guint8 BitsInCellInfo; + guint8 CellInfo[16]; /* bitmap compressed according to "Range 512" algorithm */ +} UTRAN_TDD_NeighbourCells_t; + +typedef struct { + gboolean existBandwidth; + guint8 Bandwidth; + guint8 NrOfFrequencies; + UTRAN_TDD_NeighbourCells_t CellParams[8]; +} UTRAN_TDD_Description_t; + +typedef struct +{ + guint8 Exist_Index_Start_3G; + guint8 Index_Start_3G; + guint8 Exist_Absolute_Index_Start_EMR; + guint8 Absolute_Index_Start_EMR; + guint8 Exist_UTRAN_FDD_Description; + UTRAN_FDD_Description_t UTRAN_FDD_Description; + guint8 Exist_UTRAN_TDD_Description; + UTRAN_TDD_Description_t UTRAN_TDD_Description; + guint8 Exist_CDMA2000_Description; + CDMA2000_Description_t CDMA2000_Description; + guint8 Exist_Removed3GCellDescription; + Removed3GCellDescription_t Removed3GCellDescription; +} NeighbourCellDescription3G_PMO_t; + +typedef struct +{ + guint8 Exist_Index_Start_3G; + guint8 Index_Start_3G; + guint8 Exist_Absolute_Index_Start_EMR; + guint8 Absolute_Index_Start_EMR; + guint8 Exist_UTRAN_FDD_Description; + UTRAN_FDD_Description_t UTRAN_FDD_Description; + guint8 Exist_UTRAN_TDD_Description; + UTRAN_TDD_Description_t UTRAN_TDD_Description; + guint8 Exist_Removed3GCellDescription; + Removed3GCellDescription_t Removed3GCellDescription; +} NeighbourCellDescription3G_PCCO_t; + +typedef struct +{ + guint8 UnionType; + union + { + BA_IND_t BA_IND; + guint8 PSI3_CHANGE_MARK; + } u; + + guint8 PMO_IND; + + guint8 REPORT_TYPE; + guint8 REPORTING_RATE; + guint8 INVALID_BSIC_REPORTING; + + gboolean Exist_NeighbourCellDescription3G; + NeighbourCellDescription3G_PMO_t NeighbourCellDescription3G; + + gboolean Exist_GPRSReportPriority; + GPRSReportPriority_t GPRSReportPriority; + + gboolean Exist_GPRSMeasurementParams; + GPRSMeasurementParams_PMO_PCCO_t GPRSMeasurementParams; + gboolean Exist_GPRSMeasurementParams3G; + ENH_GPRSMeasurementParams3G_PMO_t GPRSMeasurementParams3G; +} ENH_Measurement_Parameters_PMO_t; + +typedef struct +{ + guint8 UnionType; + union + { + BA_IND_t BA_IND; + guint8 PSI3_CHANGE_MARK; + } u; + + guint8 PMO_IND; + + guint8 REPORT_TYPE; + guint8 REPORTING_RATE; + guint8 INVALID_BSIC_REPORTING; + + gboolean Exist_NeighbourCellDescription3G; + NeighbourCellDescription3G_PCCO_t NeighbourCellDescription3G; + + gboolean Exist_GPRSReportPriority; + GPRSReportPriority_t GPRSReportPriority; + + gboolean Exist_GPRSMeasurementParams; + GPRSMeasurementParams_PMO_PCCO_t GPRSMeasurementParams; + gboolean Exist_GPRSMeasurementParams3G; + ENH_GPRSMeasurementParams3G_PCCO_t GPRSMeasurementParams3G; +} ENH_Measurement_Parameters_PCCO_t; + +typedef struct +{ + guint8 UnionType; + union + { + Global_TFI_t Global_TFI; + guint32 TLLI; + } u; +} PacketCellChangeOrderID_t; + +typedef struct +{ + guint8 CELL_BAR_QUALIFY_3; + guint8 Exist_SI13_Alt_PBCCH_Location; + SI13_PBCCH_Location_t SI13_Alt_PBCCH_Location; +} lu_ModeCellSelectionParameters_t; + +typedef struct +{ + guint8 Exist_lu_ModeCellSelectionParams; + lu_ModeCellSelectionParameters_t lu_ModeCellSelectionParameters; +} lu_ModeCellSelectionParams_t; + +typedef struct +{ + lu_ModeCellSelectionParams_t lu_ModeCellSelectionParameters; + guint8 NR_OF_FREQUENCIES; + lu_ModeCellSelectionParams_t lu_ModeCellSelectionParams[32]; +} lu_ModeNeighbourCellParams_t; + +typedef struct +{ + guint8 CELL_BAR_QUALIFY_3; + guint8 SAME_RA_AS_SERVING_CELL; + + guint8 Exist_RXLEV_and_TXPWR; + guint8 GPRS_RXLEV_ACCESS_MIN; + guint8 GPRS_MS_TXPWR_MAX_CCH; + + guint8 Exist_OFFSET_and_TIME; + guint8 GPRS_TEMPORARY_OFFSET; + guint8 GPRS_PENALTY_TIME; + + guint8 Exist_GPRS_RESELECT_OFFSET; + guint8 GPRS_RESELECT_OFFSET; + + guint8 Exist_HCS; + HCS_t HCS; + + guint8 Exist_SI13_Alt_PBCCH_Location; + SI13_PBCCH_Location_t SI13_Alt_PBCCH_Location; +} lu_ModeOnlyCellSelection_t; + +typedef struct +{ + guint8 FREQ_DIFF_LENGTH; + guint8 FREQUENCY_DIFF; + guint8 BSIC; + + gboolean Exist_lu_ModeOnlyCellSelectionParams; + lu_ModeOnlyCellSelection_t lu_ModeOnlyCellSelectionParams; +} lu_ModeOnlyCellSelectionParamsWithFreqDiff_t; + +typedef struct +{ + guint16 START_FREQUENCY; + guint8 BSIC; + + guint8 Exist_lu_ModeCellSelection; + lu_ModeOnlyCellSelection_t lu_ModeOnlyCellSelection; + + guint8 NR_OF_FREQUENCIES; + guint8 FREQ_DIFF_LENGTH; + + lu_ModeOnlyCellSelectionParamsWithFreqDiff_t lu_ModeOnlyCellSelectionParamsWithFreqDiff[32]; +} Add_lu_ModeOnlyFrequencyList_t; + +typedef struct +{ + guint8 Count_Add_lu_ModeOnlyFrequencyList; + Add_lu_ModeOnlyFrequencyList_t Add_lu_ModeOnlyFrequencyList[32]; +} NC_lu_ModeOnlyCapableCellList_t; + + +typedef struct +{ + guint8 NumberOfFrequencyIndexes; + guint8 UTRAN_FREQUENCY_INDEX_a[18]; + + gboolean existUTRAN_PRIORITY; + guint8 UTRAN_PRIORITY; + + guint8 THRESH_UTRAN_high; + + gboolean existTHRESH_UTRAN_low; + guint8 THRESH_UTRAN_low; + + gboolean existUTRAN_QRXLEVMIN; + guint8 UTRAN_QRXLEVMIN; +} RepeatedUTRAN_PriorityParameters_t; + +typedef struct +{ + gboolean existDEFAULT_UTRAN_Parameters; + guint8 DEFAULT_UTRAN_PRIORITY; + guint8 DEFAULT_THRESH_UTRAN; + guint8 DEFAULT_UTRAN_QRXLEVMIN; + + guint8 NumberOfPriorityParameters; + RepeatedUTRAN_PriorityParameters_t RepeatedUTRAN_PriorityParameters_a[8]; +} PriorityParametersDescription3G_PMO_t; + +typedef struct +{ + gboolean existEUTRAN_FDD_REPORTING_THRESHOLD_OFFSET; + guint8 EUTRAN_FDD_REPORTING_THRESHOLD; + gboolean existEUTRAN_FDD_REPORTING_THRESHOLD_2; + guint8 EUTRAN_FDD_REPORTING_THRESHOLD_2; + gboolean existEUTRAN_FDD_REPORTING_OFFSET; + guint8 EUTRAN_FDD_REPORTING_OFFSET; + + gboolean existEUTRAN_TDD_REPORTING_THRESHOLD_OFFSET; + guint8 EUTRAN_TDD_REPORTING_THRESHOLD; + gboolean existEUTRAN_TDD_REPORTING_THRESHOLD_2; + guint8 EUTRAN_TDD_REPORTING_THRESHOLD_2; + gboolean existEUTRAN_TDD_REPORTING_OFFSET; + guint8 EUTRAN_TDD_REPORTING_OFFSET; +} EUTRAN_REPORTING_THRESHOLD_OFFSET_t; + +typedef struct +{ + guint8 Qsearch_P_EUTRAN; + guint8 EUTRAN_REP_QUANT; + guint8 EUTRAN_MULTIRAT_REPORTING; + EUTRAN_REPORTING_THRESHOLD_OFFSET_t EUTRAN_REPORTING_THRESHOLD_OFFSET; +} GPRS_EUTRAN_MeasurementParametersDescription_t; + +typedef struct +{ + guint16 EARFCN; + gboolean existMeasurementBandwidth; + guint8 MeasurementBandwidth; +} RepeatedEUTRAN_Cells_t; + +typedef struct +{ + guint8 nbrOfEUTRAN_Cells; + RepeatedEUTRAN_Cells_t EUTRAN_Cells_a[6]; + + gboolean existEUTRAN_PRIORITY; + guint8 EUTRAN_PRIORITY; + + guint8 THRESH_EUTRAN_high; + + gboolean existTHRESH_EUTRAN_low; + guint8 THRESH_EUTRAN_low; + + gboolean existEUTRAN_QRXLEVMIN; + guint8 EUTRAN_QRXLEVMIN; +} RepeatedEUTRAN_NeighbourCells_t; + +typedef struct +{ + guint16 PCID; +} PCID_t; + +typedef struct +{ + guint8 PCID_Pattern_length; + guint8 PCID_Pattern; + guint8 PCID_Pattern_sense; +} PCID_Pattern_t; + +typedef struct +{ + guint8 NumberOfPCIDs; + guint16 PCID_a[11]; + + gboolean existPCID_BITMAP_GROUP; + guint8 PCID_BITMAP_GROUP; + + guint8 NumberOfPCID_Patterns; + PCID_Pattern_t PCID_Pattern_a[19]; +} PCID_Group_IE_t; + +typedef struct +{ + guint8 EUTRAN_FREQUENCY_INDEX; +} EUTRAN_FREQUENCY_INDEX_t; + +typedef struct +{ + PCID_Group_IE_t NotAllowedCells; + guint8 NumberOfFrequencyIndexes; + EUTRAN_FREQUENCY_INDEX_t EUTRAN_FREQUENCY_INDEX_a[28]; +} RepeatedEUTRAN_NotAllowedCells_t; + +typedef struct +{ + guint8 NumberOfMappings; + PCID_Group_IE_t PCID_ToTA_Mapping_a[14]; + + guint8 NumberOfFrequencyIndexes; + EUTRAN_FREQUENCY_INDEX_t EUTRAN_FREQUENCY_INDEX_a[28]; +} RepeatedEUTRAN_PCID_to_TA_mapping_t; + +typedef struct +{ + guint8 EUTRAN_CCN_ACTIVE; + + gboolean existGPRS_EUTRAN_MeasurementParametersDescription; + GPRS_EUTRAN_MeasurementParametersDescription_t GPRS_EUTRAN_MeasurementParametersDescription; + + guint8 nbrOfRepeatedEUTRAN_NeighbourCellsStructs; + RepeatedEUTRAN_NeighbourCells_t RepeatedEUTRAN_NeighbourCells_a[4]; + + guint8 NumberOfNotAllowedCells; + RepeatedEUTRAN_NotAllowedCells_t RepeatedEUTRAN_NotAllowedCells_a[14]; + + guint8 NumberOfMappings; + RepeatedEUTRAN_PCID_to_TA_mapping_t RepeatedEUTRAN_PCID_to_TA_mapping_a[19]; +} EUTRAN_ParametersDescription_PMO_t; + +typedef struct +{ + guint8 GERAN_PRIORITY; + guint8 THRESH_Priority_Search; + guint8 THRESH_GSM_low; + guint8 H_PRIO; + guint8 T_Reselection; +} ServingCellPriorityParametersDescription_t; + +typedef struct +{ + gboolean existServingCellPriorityParametersDescription; + ServingCellPriorityParametersDescription_t ServingCellPriorityParametersDescription; + + gboolean existPriorityParametersDescription3G_PMO; + PriorityParametersDescription3G_PMO_t PriorityParametersDescription3G_PMO; + + gboolean existEUTRAN_ParametersDescription_PMO; + EUTRAN_ParametersDescription_PMO_t EUTRAN_ParametersDescription_PMO; +} PriorityAndEUTRAN_ParametersDescription_PMO_t; + +typedef struct +{ + guint8 PSC_Pattern_length; + guint8 PSC_Pattern; + gboolean PSC_Pattern_sense; +}PSC_Pattern_t; + +typedef struct +{ + guint8 PSC_Count; + guint16 PSC[32]; + guint8 PSC_Pattern_Count; + PSC_Pattern_t PSC_Pattern[32]; +}PSC_Group_t; + +typedef struct +{ + PSC_Group_t CSG_PSC_SPLIT; + guint8 Count; + guint8 UTRAN_FREQUENCY_INDEX[32]; +}ThreeG_CSG_Description_Body_t; + +typedef struct +{ + guint8 Count; + ThreeG_CSG_Description_Body_t ThreeG_CSG_Description_Body[32]; +}ThreeG_CSG_Description_t; + +typedef struct +{ + PSC_Group_t CSG_PCI_SPLIT; + guint8 Count; + guint8 EUTRAN_FREQUENCY_INDEX[32]; +}EUTRAN_CSG_Description_Body_t; + +typedef struct +{ + guint8 Count; + EUTRAN_CSG_Description_Body_t EUTRAN_CSG_Description_Body[32]; +}EUTRAN_CSG_Description_t; + +typedef struct +{ + gboolean existMeasurement_Control_EUTRAN; + gboolean Measurement_Control_EUTRAN; + guint8 EUTRAN_FREQUENCY_INDEX_top; + guint8 Count_EUTRAN_FREQUENCY_INDEX; + guint8 EUTRAN_FREQUENCY_INDEX[32]; + + gboolean existMeasurement_Control_UTRAN; + gboolean Measurement_Control_UTRAN; + guint8 UTRAN_FREQUENCY_INDEX_top; + guint8 Count_UTRAN_FREQUENCY_INDEX; + guint8 UTRAN_FREQUENCY_INDEX[32]; +}Meas_Ctrl_Param_Desp_t; + +typedef struct +{ + guint8 THRESH_EUTRAN_high_Q; + gboolean existTHRESH_EUTRAN_low_Q; + guint8 THRESH_EUTRAN_low_Q; + gboolean existEUTRAN_QQUALMIN; + guint8 EUTRAN_QQUALMIN; + gboolean existEUTRAN_RSRPmin; + guint8 EUTRAN_RSRPmin; +}Reselection_Based_On_RSRQ_t; + +typedef struct +{ + guint8 Count_EUTRAN_FREQUENCY_INDEX; + guint8 EUTRAN_FREQUENCY_INDEX[32]; + guint8 UnionType; + union + { + guint8 EUTRAN_Qmin; + Reselection_Based_On_RSRQ_t Reselection_Based_On_RSRQ; + } u; +}Rept_EUTRAN_Enh_Cell_Resel_Param_t; + +typedef struct +{ + guint8 Count; + Rept_EUTRAN_Enh_Cell_Resel_Param_t Repeated_EUTRAN_Enhanced_Cell_Reselection_Parameters[32]; +}Enh_Cell_Reselect_Param_Desp_t; + +typedef struct +{ + gboolean existUTRAN_CSG_FDD_REPORTING_THRESHOLD; + guint8 UTRAN_CSG_FDD_REPORTING_THRESHOLD; + guint8 UTRAN_CSG_FDD_REPORTING_THRESHOLD_2; + gboolean existUTRAN_CSG_TDD_REPORTING_THRESHOLD; + guint8 UTRAN_CSG_TDD_REPORTING_THRESHOLD; +}UTRAN_CSG_Cells_Reporting_Desp_t; + +typedef struct +{ + gboolean existEUTRAN_CSG_FDD_REPORTING_THRESHOLD; + guint8 EUTRAN_CSG_FDD_REPORTING_THRESHOLD; + guint8 EUTRAN_CSG_FDD_REPORTING_THRESHOLD_2; + gboolean existEUTRAN_CSG_TDD_REPORTING_THRESHOLD; + guint8 EUTRAN_CSG_TDD_REPORTING_THRESHOLD; + guint8 EUTRAN_CSG_TDD_REPORTING_THRESHOLD_2; +}EUTRAN_CSG_Cells_Reporting_Desp_t; + +typedef struct +{ + gboolean existUTRAN_CSG_Cells_Reporting_Description; + UTRAN_CSG_Cells_Reporting_Desp_t UTRAN_CSG_Cells_Reporting_Description; + gboolean existEUTRAN_CSG_Cells_Reporting_Description; + EUTRAN_CSG_Cells_Reporting_Desp_t EUTRAN_CSG_Cells_Reporting_Description; +}CSG_Cells_Reporting_Desp_t; + +typedef struct +{ + gboolean existEnhanced_Cell_Reselection_Parameters_Description; + Enh_Cell_Reselect_Param_Desp_t Enhanced_Cell_Reselection_Parameters_Description; + + gboolean existCSG_Cells_Reporting_Description; + CSG_Cells_Reporting_Desp_t CSG_Cells_Reporting_Description; +}PMO_AdditionsR9_t; + +typedef struct +{ + guint8 dummy; +}Delete_All_Stored_Individual_Priorities_t; + +typedef struct +{ + guint8 Count; + guint16 FDD_ARFCN[32]; +}Individual_UTRAN_Priority_FDD_t; + +typedef struct +{ + guint8 Count; + guint16 TDD_ARFCN[32]; +}Individual_UTRAN_Priority_TDD_t; + +typedef struct +{ + guint8 UnionType; + union + { + Individual_UTRAN_Priority_FDD_t Individual_UTRAN_Priority_FDD; + Individual_UTRAN_Priority_TDD_t Individual_UTRAN_Priority_TDD; + } u; + guint8 UTRAN_PRIORITY; +}Repeated_Individual_UTRAN_Priority_Parameters_t; + +typedef struct +{ + guint8 Exist_DEFAULT_UTRAN_PRIORITY; + guint8 DEFAULT_UTRAN_PRIORITY; + guint8 Repeated_Individual_UTRAN_Priority_Parameters_Count; + Repeated_Individual_UTRAN_Priority_Parameters_t Repeated_Individual_UTRAN_Priority_Parameters[32]; +}ThreeG_Individual_Priority_Parameters_Description_t; + +typedef struct +{ + guint8 Count; + guint16 EARFCN[32]; + guint8 EUTRAN_PRIORITY; +}Repeated_Individual_EUTRAN_Priority_Parameters_t; + +typedef struct +{ + guint8 Exist_DEFAULT_EUTRAN_PRIORITY; + guint8 DEFAULT_EUTRAN_PRIORITY; + guint8 Count; + Repeated_Individual_EUTRAN_Priority_Parameters_t Repeated_Individual_EUTRAN_Priority_Parameters[32]; +}EUTRAN_Individual_Priority_Parameters_Description_t; + +typedef struct +{ + guint8 GERAN_PRIORITY; + guint8 Exist_3G_Individual_Priority_Parameters_Description; + ThreeG_Individual_Priority_Parameters_Description_t ThreeG_Individual_Priority_Parameters_Description; + guint8 Exist_EUTRAN_Individual_Priority_Parameters_Description; + EUTRAN_Individual_Priority_Parameters_Description_t EUTRAN_Individual_Priority_Parameters_Description; + guint8 Exist_T3230_timeout_value; + guint8 T3230_timeout_value; +}Provide_Individual_Priorities_t; + +typedef struct +{ + guint8 UnionType; + union + { + Delete_All_Stored_Individual_Priorities_t Delete_All_Stored_Individual_Priorities; + Provide_Individual_Priorities_t Provide_Individual_Priorities; + } u; +}Individual_Priorities_t; + +typedef struct +{ + gboolean existBA_IND_3G_PMO_IND; + guint8 BA_IND_3G; + guint8 PMO_IND; + + gboolean existPriorityAndEUTRAN_ParametersDescription_PMO; + PriorityAndEUTRAN_ParametersDescription_PMO_t PriorityAndEUTRAN_ParametersDescription_PMO; + + gboolean existIndividualPriorities_PMO; + Individual_Priorities_t IndividualPriorities_PMO; + + gboolean existThreeG_CSG_Description; + ThreeG_CSG_Description_t ThreeG_CSG_Description_PMO; + + gboolean existEUTRAN_CSG_Description; + EUTRAN_CSG_Description_t EUTRAN_CSG_Description_PMO; + + gboolean existMeasurement_Control_Parameters_Description; + Meas_Ctrl_Param_Desp_t Measurement_Control_Parameters_Description_PMO; + + gboolean existAdditionsR9; + PMO_AdditionsR9_t AdditionsR9; +} PMO_AdditionsR8_t; + +typedef struct +{ + gboolean existREPORTING_OFFSET_THRESHOLD_700; + guint8 REPORTING_OFFSET_700; + guint8 REPORTING_THRESHOLD_700; + + gboolean existREPORTING_OFFSET_THRESHOLD_810; + guint8 REPORTING_OFFSET_810; + guint8 REPORTING_THRESHOLD_810; + + guint8 existAdditionsR8; + PMO_AdditionsR8_t additionsR8; +} PMO_AdditionsR7_t; + +typedef struct +{ + guint8 CCN_ACTIVE_3G; + guint8 existAdditionsR7; + PMO_AdditionsR7_t additionsR7; +} PMO_AdditionsR6_t; + +typedef struct +{ + guint8 CCN_ACTIVE_3G; +} PCCO_AdditionsR6_t; + +typedef struct +{ + guint8 existGRNTI_Extension; + guint8 GRNTI; + guint8 exist_lu_ModeNeighbourCellParams; + guint8 count_lu_ModeNeighbourCellParams; + lu_ModeNeighbourCellParams_t lu_ModeNeighbourCellParams[32]; + guint8 existNC_lu_ModeOnlyCapableCellList; + NC_lu_ModeOnlyCapableCellList_t NC_lu_ModeOnlyCapableCellList; + guint8 existGPRS_AdditionalMeasurementParams3G; + GPRS_AdditionalMeasurementParams3G_t GPRS_AdditionalMeasurementParams3G; + guint8 existAdditionsR6; + PMO_AdditionsR6_t additionsR6; +} PMO_AdditionsR5_t; + +typedef struct +{ + guint8 existGRNTI_Extension; + guint8 GRNTI; + guint8 exist_lu_ModeNeighbourCellParams; + guint8 count_lu_ModeNeighbourCellParams; + lu_ModeNeighbourCellParams_t lu_ModeNeighbourCellParams[32]; + guint8 existNC_lu_ModeOnlyCapableCellList; + NC_lu_ModeOnlyCapableCellList_t NC_lu_ModeOnlyCapableCellList; + guint8 existGPRS_AdditionalMeasurementParams3G; + GPRS_AdditionalMeasurementParams3G_t GPRS_AdditionalMeasurementParams3G; + guint8 existAdditionsR6; + PCCO_AdditionsR6_t additionsR6; +} PCCO_AdditionsR5_t; + +typedef struct +{ + guint8 CCN_ACTIVE; + guint8 Exist_CCN_Support_Description_ID; + CCN_Support_Description_t CCN_Support_Description; + guint8 Exist_AdditionsR5; + PMO_AdditionsR5_t AdditionsR5; +} PMO_AdditionsR4_t; + +typedef struct +{ + guint8 CCN_ACTIVE; + guint8 Exist_Container_ID; + guint8 CONTAINER_ID; + guint8 Exist_CCN_Support_Description_ID; + CCN_Support_Description_t CCN_Support_Description; + guint8 Exist_AdditionsR5; + PCCO_AdditionsR5_t AdditionsR5; +} PCCO_AdditionsR4_t; + +typedef struct +{ + ENH_Measurement_Parameters_PCCO_t ENH_Measurement_Parameters; + guint8 Exist_AdditionsR4; + PCCO_AdditionsR4_t AdditionsR4; +} PCCO_AdditionsR99_t; + +typedef struct +{ + guint8 Exist_ENH_Measurement_Parameters; + ENH_Measurement_Parameters_PMO_t ENH_Measurement_Parameters; + guint8 Exist_AdditionsR4; + PMO_AdditionsR4_t AdditionsR4; +} PMO_AdditionsR99_t; + +typedef struct +{ + guint8 Exist_LSA_Parameters; + LSA_Parameters_t LSA_Parameters; + + guint8 Exist_AdditionsR99; + PMO_AdditionsR99_t AdditionsR99; +} PMO_AdditionsR98_t; + +typedef struct +{ + guint8 Exist_LSA_Parameters; + LSA_Parameters_t LSA_Parameters; + + guint8 Exist_AdditionsR99; + PCCO_AdditionsR99_t AdditionsR99; +} PCCO_AdditionsR98_t; + +typedef struct +{ + guint8 IMMEDIATE_REL; + guint16 ARFCN; + guint8 BSIC; + NC_Measurement_Parameters_with_Frequency_List_t NC_Measurement_Parameters; + + guint8 Exist_AdditionsR98; + PCCO_AdditionsR98_t AdditionsR98; +} Target_Cell_GSM_t; + +typedef struct +{ + guint8 Exist_EUTRAN_Target_Cell; + EUTRAN_Target_Cell_t EUTRAN_Target_Cell; + guint8 Exist_Individual_Priorities; + Individual_Priorities_t Individual_Priorities; +}Target_Cell_3G_AdditionsR8_t; + +typedef struct +{ + guint8 Exist_G_RNTI_Extention; + guint8 G_RNTI_Extention; + guint8 Exist_AdditionsR8; + Target_Cell_3G_AdditionsR8_t AdditionsR8; +}Target_Cell_3G_AdditionsR5_t; + +typedef struct +{ + /* 00 -- Message escape */ + guint8 IMMEDIATE_REL; + guint8 Exist_FDD_Description; + FDD_Target_Cell_t FDD_Target_Cell; + guint8 Exist_TDD_Description; + TDD_Target_Cell_t TDD_Target_Cell; + guint8 Exist_AdditionsR5; + Target_Cell_3G_AdditionsR5_t AdditionsR5; +} Target_Cell_3G_t; + +#define TARGET_CELL_GSM 0 +#define TARGET_CELL_3G 1 + +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PAGE_MODE; + + PacketCellChangeOrderID_t ID; + + guint8 UnionType; + union + { + Target_Cell_GSM_t Target_Cell_GSM; + Target_Cell_3G_t Target_Cell_3G; + } u; + +} Packet_Cell_Change_Order_t; + +/* < Packet Cell Change Continue message contents > */ +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PAGE_MODE; + + Global_TFI_t Global_TFI; + guint8 Exist_ID; + guint16 ARFCN; + guint8 BSIC; + guint8 CONTAINER_ID; +} Packet_Cell_Change_Continue_t; + + +/* < Packet Neighbour Cell Data message contents > */ +typedef struct +{ + guint16 ARFCN; + guint8 BSIC; + guint8 CONTAINER[17]; /* PD (3 bits) + CD_LENGTH (5 bits) + 16 bytes of CONTAINER_DATA (max!) */ +} PNCD_Container_With_ID_t; + +typedef struct +{ + guint8 CONTAINER[19]; /* PD (3 bits) + CD_LENGTH (5 bits) + 18 bytes of CONTAINER_DATA (max!) */ +} PNCD_Container_Without_ID_t; + +typedef struct +{ + guint8 UnionType; + union + { + PNCD_Container_Without_ID_t PNCD_Container_Without_ID; + PNCD_Container_With_ID_t PNCD_Container_With_ID; + } u; +} PNCDContainer_t; + +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PAGE_MODE; + /* Fixed 0 */ + Global_TFI_t Global_TFI; + guint8 CONTAINER_ID; + guint8 spare; + guint8 CONTAINER_INDEX; + + PNCDContainer_t Container; +} Packet_Neighbour_Cell_Data_t; + +/* < Packet Serving Cell Data message contents > */ +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PAGE_MODE; + /* Fixed 0 */ + Global_TFI_t Global_TFI; + guint8 spare; + guint8 CONTAINER_INDEX; + guint8 CONTAINER[19]; /* PD (3 bits) + CD_LENGTH (5 bits) + 18 bytes of CONTAINER_DATA (max!) */ +} Packet_Serving_Cell_Data_t; + +/* < Packet Measurement Order message contents > */ +typedef struct +{ + guint16 START_FREQUENCY; + guint8 NR_OF_FREQUENCIES; + guint8 FREQ_DIFF_LENGTH; + + guint8 Count_FREQUENCY_DIFF; + guint8 FREQUENCY_DIFF[31];/* bit (FREQ_DIFF_LENGTH) * NR_OF_FREQUENCIES --> MAX is bit(7) * 31 */ +} EXT_Frequency_List_t; + +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PAGE_MODE; + + PacketDownlinkID_t ID; /* use the PDA ID as it is the same as as the PMO */ + + guint8 PMO_INDEX; + guint8 PMO_COUNT; + + guint8 Exist_NC_Measurement_Parameters; + NC_Measurement_Parameters_with_Frequency_List_t NC_Measurement_Parameters; + + guint8 Exist_EXT_Measurement_Parameters; + + guint8 Exist_AdditionsR98; + PMO_AdditionsR98_t AdditionsR98; +} Packet_Measurement_Order_t; + +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PAGE_MODE; + PacketDownlinkID_t ID; +} Packet_Measurement_Order_Reduced_t; + +/* Enhanced measurement report */ + +typedef struct +{ + guint8 RXLEV_SERVING_CELL; +} ServingCellData_t; + +typedef struct +{ + guint8 BCCH_FREQ_NCELL; + guint8 BSIC; + guint8 RXLEV_NCELL; +} Repeated_Invalid_BSIC_Info_t; + +typedef struct +{ + gboolean Exist_REPORTING_QUANTITY; + guint8 REPORTING_QUANTITY; +} REPORTING_QUANTITY_t; + +typedef struct +{ + guint8 NC_MODE; + guint8 UnionType; + union + { + BA_USED_t BA_USED; + guint8 PSI3_CHANGE_MARK; + } u; + guint8 PMO_USED; + guint8 SCALE; + guint8 Exist_ServingCellData; + ServingCellData_t ServingCellData; + guint8 Count_Repeated_Invalid_BSIC_Info; + Repeated_Invalid_BSIC_Info_t Repeated_Invalid_BSIC_Info[32]; + + gboolean Exist_Repeated_REPORTING_QUANTITY; + guint8 Count_Repeated_Reporting_Quantity; + REPORTING_QUANTITY_t Repeated_REPORTING_QUANTITY[96]; +} NC_MeasurementReport_t; + +/* Packet Handover PHO ----------------- */ + +typedef struct +{ + guint8 UnionType; + union + { + guint8 MS_TimeslotAllocation; + Power_Control_Parameters_t Power_Control_Parameters; + } u; +} GlobalTimeslotDescription_t; + +typedef struct +{ + guint8 TimeslotAllocation; + guint8 PFI; + guint8 RLC_Mode; + guint8 TFI_Assignment; + guint8 ControlACK; + guint8 Exist_EGPRS_WindowSize; + guint8 EGPRS_WindowSize; +} PHO_DownlinkAssignment_t; + +typedef struct +{ + gboolean Exist_USF; + guint8 USF; +} PHO_USF_1_7_t; + +typedef struct +{ + guint8 USF_0; + PHO_USF_1_7_t USF_1_7[7]; + guint8 NBR_OfAllocatedTimeslots; +} USF_AllocationArray_t; + +typedef struct +{ + guint8 PFI; + guint8 RLC_Mode; + guint8 TFI_Assignment; + guint8 Exist_ChannelCodingCommand; + guint8 ChannelCodingCommand; + guint8 Exist_EGPRS_ChannelCodingCommand; + guint8 EGPRS_ChannelCodingCommand; + guint8 Exist_EGPRS_WindowSize; + guint8 EGPRS_WindowSize; + guint8 USF_Granularity; + guint8 Exist_TBF_TimeslotAllocation; + guint8 TBF_TimeslotAllocation; + guint8 UnionType; + union + { + guint8 USF_SingleAllocation; + USF_AllocationArray_t USF_AllocationArray; + } u; +} PHO_UplinkAssignment_t; + +typedef struct +{ + GlobalTimeslotDescription_t GlobalTimeslotDescription; + guint8 Exist_PHO_UA; + PHO_UplinkAssignment_t PHO_UA; +} GlobalTimeslotDescription_UA_t; + +typedef struct +{ + guint8 Exist_ChannelCodingCommand; + guint8 ChannelCodingCommand; + guint8 Exist_GlobalTimeslotDescription_UA; + GlobalTimeslotDescription_UA_t GTD_UA; + guint8 Exist_DownlinkAssignment; + PHO_DownlinkAssignment_t DownlinkAssignment; +} PHO_GPRS_t; + + +typedef struct +{ + guint8 Exist_EGPRS_WindowSize; + guint8 EGPRS_WindowSize; + guint8 LinkQualityMeasurementMode; + guint8 Exist_BEP_Period2; + guint8 BEP_Period2; +} EGPRS_Description_t; + +typedef struct +{ + guint8 Exist_EGPRS_Description; + EGPRS_Description_t EGPRS_Description; + guint8 Exist_DownlinkAssignment; + PHO_DownlinkAssignment_t DownlinkAssignment; +} DownlinkTBF_t; + +typedef struct +{ + guint8 Exist_EGPRS_WindowSize; + guint8 EGPRS_WindowSize; + guint8 Exist_EGPRS_ChannelCodingCommand; + guint8 EGPRS_ChannelCodingCommand; + guint8 Exist_BEP_Period2; + guint8 BEP_Period2; + guint8 Exist_GlobalTimeslotDescription_UA; + GlobalTimeslotDescription_UA_t GTD_UA; + guint8 Exist_DownlinkTBF; + DownlinkTBF_t DownlinkTBF; +}PHO_EGPRS_t; + +typedef struct +{ + Global_Packet_Timing_Advance_t GlobalPacketTimingAdvance; + guint8 Exist_PacketExtendedTimingAdvance; + guint8 PacketExtendedTimingAdvance; +} PHO_TimingAdvance_t; + +typedef struct +{ + guint8 NAS_ContainerLength; + guint8 NAS_Container[MAX_NAS_CONTAINER_LENGTH]; +} NAS_Container_t; + +typedef struct +{ + guint8 RRC_ContainerLength; + guint8 RRC_Container[MAX_RRC_CONTAINER_LENGTH]; +} PS_HandoverTo_UTRAN_Payload_t; + + +typedef struct +{ + guint8 Exist_HandoverReference; + guint8 HandoverReference; + guint8 ARFCN; + guint8 SI; + guint8 NCI; + guint8 BSIC; + guint8 Exist_CCN_Active; + guint8 CCN_Active; + guint8 Exist_CCN_Active_3G; + guint8 CCN_Active_3G; + guint8 Exist_CCN_Support_Description; + CCN_Support_Description_t CCN_Support_Description; + Frequency_Parameters_t Frequency_Parameters; + guint8 NetworkControlOrder; + guint8 Exist_PHO_TimingAdvance; + PHO_TimingAdvance_t PHO_TimingAdvance; + guint8 Extended_Dynamic_Allocation; + guint8 RLC_Reset; + guint8 Exist_PO_PR; + guint8 PO; + guint8 PR_Mode; + guint8 Exist_UplinkControlTimeslot; + guint8 UplinkControlTimeslot; + guint8 UnionType; + union + { + PHO_GPRS_t PHO_GPRS_Mode; + PHO_EGPRS_t PHO_EGPRS_Mode; + } u; +} PHO_RadioResources_t; + +typedef struct +{ + PHO_RadioResources_t PHO_RadioResources; + guint8 Exist_NAS_Container; + NAS_Container_t NAS_Container; +} PS_HandoverTo_A_GB_ModePayload_t; + +typedef struct +{ + guint8 MessageType; + guint8 PageMode; + Global_TFI_t Global_TFI; + guint8 ContainerID; + guint8 UnionType; + union + { + PS_HandoverTo_A_GB_ModePayload_t PS_HandoverTo_A_GB_ModePayload; + PS_HandoverTo_UTRAN_Payload_t PS_HandoverTo_UTRAN_Payload; + } u; +} Packet_Handover_Command_t; + +/* End Packet Handover */ + +/* Packet Physical Information ----------------- */ + +typedef struct +{ + guint8 MessageType; + guint8 PageMode; + Global_TFI_t Global_TFI; + guint8 TimingAdvance; +} Packet_PhysicalInformation_t; + +/* End Packet Physical Information */ + + + +/* ADDITIONAL MS RADIO ACCESS CAPABILITIES -----------------*/ +typedef struct +{ + guint8 UnionType; + union + { + Global_TFI_t Global_TFI; + guint32 TLLI; + } u; +} AdditionalMsRadAccessCapID_t; + + +typedef struct +{ + guint8 MESSAGE_TYPE; + guint8 PayloadType; + guint8 spare; + guint8 R; + + AdditionalMsRadAccessCapID_t ID; + MS_Radio_Access_capability_t MS_Radio_Access_capability; +} Additional_MS_Rad_Access_Cap_t; + +/* End ADDITIONAL MS RADIO ACCESS CAPABILITIES */ + + +/* Packet Pause -----------------*/ + +typedef struct +{ + guint8 MESSAGE_TYPE; + + guint32 TLLI; + guint8 RAI[48/8]; +} Packet_Pause_t; + +/* End Packet Pause */ + + +/* +< NC Measurement Parameters struct > ::= + < NETWORK_CONTROL_ORDER : bit (2) > + { 0 | 1 < NC_ NON_DRX_PERIOD : bit (3) > + < NC_REPORTING_PERIOD_I : bit (3) > + < NC_REPORTING_PERIOD_T : bit (3) > } ; +< Cell Selection struct > ::= + < EXC_ACC : bit > + < CELL_BAR_ACCESS_2 : bit (1) > + < SAME_RA_AS_SERVING_CELL : bit (1) > + { 0 | 1 < GPRS_RXLEV_ACCESS_MIN : bit (6) > + < GPRS_MS_TXPWR_MAX_CCH : bit (5) > } +{ 0 | 1 < GPRS_TEMPORARY_OFFSET : bit (3) > + < GPRS_PENALTY_TIME : bit (5) > } +Table 25 (concluded): PACKET CELL CHANGE ORDER message content + { 0 | 1 < GPRS_RESELECT_OFFSET : bit (5) > } +{ 0 | 1 < HCS params : < HCS struct > > } +{ 0 | 1 < SI13_PBCCH_LOCATION : < SI13_PBCCH_LOCATION struct > > } ; + +< SI13_PBCCH_LOCATION struct > ::= + { 0 < SI13_LOCATION : bit (1) > + | 1 < PBCCH_LOCATION : bit (2) > + < PSI1_REPEAT_PERIOD : bit (4) > } ; + +< HCS struct > ::= + < GPRS_PRIORITY_CLASS : bit (3) > + < GPRS_HCS_THR : bit (5) > ; +*/ + +/* < Downlink RLC/MAC control message > */ +#define MT_PACKET_CELL_CHANGE_ORDER 0x01 +#define MT_PACKET_DOWNLINK_ASSIGNMENT 0x02 +#define MT_PACKET_MEASUREMENT_ORDER 0x03 +#define MT_PACKET_POLLING_REQ 0x04 +#define MT_PACKET_POWER_CONTROL_TIMING_ADVANCE 0x05 +#define MT_PACKET_QUEUEING_NOTIFICATION 0x06 +#define MT_PACKET_TIMESLOT_RECONFIGURE 0x07 +#define MT_PACKET_TBF_RELEASE 0x08 +#define MT_PACKET_UPLINK_ACK_NACK 0x09 +#define MT_PACKET_UPLINK_ASSIGNMENT 0x0A +#define MT_PACKET_CELL_CHANGE_CONTINUE 0x0B +#define MT_PACKET_NEIGHBOUR_CELL_DATA 0x0C +#define MT_PACKET_SERVING_CELL_DATA 0x0D +#define MT_PACKET_HANDOVER_COMMAND 0x15 +#define MT_PACKET_PHYSICAL_INFORMATION 0x16 +#define MT_PACKET_ACCESS_REJECT 0x21 +#define MT_PACKET_PAGING_REQUEST 0x22 +#define MT_PACKET_PDCH_RELEASE 0x23 +#define MT_PACKET_PRACH_PARAMETERS 0x24 +#define MT_PACKET_DOWNLINK_DUMMY_CONTROL_BLOCK 0x25 +#define MT_PACKET_SYSTEM_INFO_6 0x30 +#define MT_PACKET_SYSTEM_INFO_1 0x31 +#define MT_PACKET_SYSTEM_INFO_2 0x32 +#define MT_PACKET_SYSTEM_INFO_3 0x33 +#define MT_PACKET_SYSTEM_INFO_3_BIS 0x34 +#define MT_PACKET_SYSTEM_INFO_4 0x35 +#define MT_PACKET_SYSTEM_INFO_5 0x36 +#define MT_PACKET_SYSTEM_INFO_13 0x37 +#define MT_PACKET_SYSTEM_INFO_7 0x38 +#define MT_PACKET_SYSTEM_INFO_8 0x39 +#define MT_PACKET_SYSTEM_INFO_14 0x3A +#define MT_PACKET_SYSTEM_INFO_3_TER 0x3C +#define MT_PACKET_SYSTEM_INFO_3_QUATER 0x3D +#define MT_PACKET_SYSTEM_INFO_15 0x3E + +/* < Uplink RLC/MAC control message > */ +#define MT_PACKET_CELL_CHANGE_FAILURE 0x00 +#define MT_PACKET_CONTROL_ACK 0x01 +#define MT_PACKET_DOWNLINK_ACK_NACK 0x02 +#define MT_PACKET_UPLINK_DUMMY_CONTROL_BLOCK 0x03 +#define MT_PACKET_MEASUREMENT_REPORT 0x04 +#define MT_PACKET_RESOURCE_REQUEST 0x05 +#define MT_PACKET_MOBILE_TBF_STATUS 0x06 +#define MT_PACKET_PSI_STATUS 0x07 +#define MT_EGPRS_PACKET_DOWNLINK_ACK_NACK 0x08 +#define MT_PACKET_PAUSE 0x09 +#define MT_PACKET_ENHANCED_MEASUREMENT_REPORT 0x0A +#define MT_ADDITIONAL_MS_RAC 0x0B +#define MT_PACKET_CELL_CHANGE_NOTIFICATION 0x0C +#define MT_PACKET_SI_STATUS 0x0D +#define MT_ENHANCED_MEASUREMENT_REPORT 0x04 + +/* < Downlink RLC/MAC control message > */ +typedef struct +{ + union + { + guint8 MESSAGE_TYPE; + + Packet_Access_Reject_t Packet_Access_Reject; + Packet_Cell_Change_Order_t Packet_Cell_Change_Order; + Packet_Downlink_Assignment_t Packet_Downlink_Assignment; + Packet_Measurement_Order_Reduced_t Packet_Measurement_Order; + Packet_Neighbour_Cell_Data_t Packet_Neighbour_Cell_Data; + Packet_Serving_Cell_Data_t Packet_Serving_Cell_Data; + Packet_Paging_Request_t Packet_Paging_Request; + Packet_PDCH_Release_t Packet_PDCH_Release; + Packet_Polling_Request_t Packet_Polling_Request; + Packet_Power_Control_Timing_Advance_t Packet_Power_Control_Timing_Advance; + Packet_PRACH_Parameters_t Packet_PRACH_Parameters; + Packet_Queueing_Notification_t Packet_Queueing_Notification; + Packet_Timeslot_Reconfigure_t Packet_Timeslot_Reconfigure; + Packet_TBF_Release_t Packet_TBF_Release; + Packet_Uplink_Ack_Nack_t Packet_Uplink_Ack_Nack; + Packet_Uplink_Assignment_t Packet_Uplink_Assignment; + Packet_Cell_Change_Continue_t Packet_Cell_Change_Continue; + Packet_Handover_Command_t Packet_Handover_Command; + Packet_PhysicalInformation_t Packet_PhysicalInformation; + Packet_Downlink_Dummy_Control_Block_t Packet_Downlink_Dummy_Control_Block; + + PSI1_t PSI1; + PSI2_t PSI2; + PSI3_t PSI3; + PSI3_BIS_t PSI3_BIS; + PSI4_t PSI4; + PSI13_t PSI13; + PSI5_t PSI5; + } u; + + /* NrOfBits is placed after union to avoid unnecessary code changes when addressing the union members + * NrOfBits serves dual purpose: + * 1. before unpacking it will hold the max number of bits for the CSN.1 unpacking function + * 2. after successful unpacking it will hold the number of bits unpacked from a message. + * This will be needed for some EGPRS messages to compute the length of included variable bitmap + */ + guint8 PAYLOAD_TYPE; + guint8 RRBP; + guint8 SP; + guint8 USF; + guint8 RBSN; + guint8 RTI; + guint8 FS; + guint8 AC; + guint8 PR; + guint8 TFI; + guint8 D; + guint8 RBSNe; + guint8 FSe; + guint8 spare; + gint16 NrOfBits; +} RlcMacDownlink_t; + +typedef gint16 MSGGPRS_Status_t; +/* < Uplink RLC/MAC control message > */ +typedef struct +{ + union + { + guint8 MESSAGE_TYPE; + Packet_Cell_Change_Failure_t Packet_Cell_Change_Failure; + Packet_Control_Acknowledgement_t Packet_Control_Acknowledgement; + Packet_Downlink_Ack_Nack_t Packet_Downlink_Ack_Nack; + EGPRS_PD_AckNack_t Egprs_Packet_Downlink_Ack_Nack; + Packet_Uplink_Dummy_Control_Block_t Packet_Uplink_Dummy_Control_Block; + Packet_Measurement_Report_t Packet_Measurement_Report; + Packet_Resource_Request_t Packet_Resource_Request; + Packet_Mobile_TBF_Status_t Packet_Mobile_TBF_Status; + Packet_PSI_Status_t Packet_PSI_Status; + Packet_Enh_Measurement_Report_t Packet_Enh_Measurement_Report; + Packet_Cell_Change_Notification_t Packet_Cell_Change_Notification; + Packet_SI_Status_t Packet_SI_Status; + Additional_MS_Rad_Access_Cap_t Additional_MS_Rad_Access_Cap; + Packet_Pause_t Packet_Pause; + } u; + gint16 NrOfBits; +} RlcMacUplink_t; + +/* < Uplink RLC/MAC data block message > */ +typedef struct +{ + guint8 PAYLOAD_TYPE; + guint8 CV; + guint8 SI; + guint8 R; + guint8 spare; + guint8 PI; + guint8 TFI; + guint8 TI; + guint8 BSN; + guint8 E_1; + guint8 LENGTH_INDICATOR[MAX_NUMBER_LLC_PDU]; + guint8 M[MAX_NUMBER_LLC_PDU]; + guint8 E[MAX_NUMBER_LLC_PDU]; + guint32 TLLI; + guint8 PFI; + guint8 E_2; + guint8 RLC_DATA[20]; + guint8 MESSAGE_TYPE; +} RlcMacUplinkDataBlock_t; + + +/* < Downlink RLC/MAC data block message > */ +typedef struct +{ + guint8 PAYLOAD_TYPE; + guint8 RRBP; + guint8 SP; + guint8 USF; + guint8 PR; + guint8 TFI; + guint8 FBI; + guint8 BSN; + guint8 E_1; + guint8 LENGTH_INDICATOR[MAX_NUMBER_LLC_PDU]; + guint8 M[MAX_NUMBER_LLC_PDU]; + guint8 E[MAX_NUMBER_LLC_PDU]; + guint8 RLC_DATA[20]; + guint8 MESSAGE_TYPE; +} RlcMacDownlinkDataBlock_t; + +void GPRSMSG_Profile(gint16 i); + +/* SI1_RestOctet_t */ + +typedef struct +{ + gboolean Exist_NCH_Position; + guint8 NCH_Position; + + guint8 BandIndicator; +} SI1_RestOctet_t; + +/* SI3_Rest_Octet_t */ +typedef struct +{ + guint8 CBQ; + guint8 CELL_RESELECT_OFFSET; + guint8 TEMPORARY_OFFSET; + guint8 PENALTY_TIME; +} Selection_Parameters_t; + +typedef struct +{ + guint8 Exist_Selection_Parameters; + Selection_Parameters_t Selection_Parameters; + + guint8 Exist_Power_Offset; + guint8 Power_Offset; + + guint8 System_Information_2ter_Indicator; + guint8 Early_Classmark_Sending_Control; + + guint8 Exist_WHERE; + guint8 WHERE; + + guint8 Exist_GPRS_Indicator; + guint8 RA_COLOUR; + guint8 SI13_POSITION; + guint8 ECS_Restriction3G; + guint8 ExistSI2quaterIndicator; + guint8 SI2quaterIndicator; +} SI3_Rest_Octet_t; + +typedef struct +{ + guint8 Exist_Selection_Parameters; + Selection_Parameters_t Selection_Parameters; + + guint8 Exist_Power_Offset; + guint8 Power_Offset; + + guint8 Exist_GPRS_Indicator; + guint8 RA_COLOUR; + guint8 SI13_POSITION; +} SI4_Rest_Octet_t; + +typedef SI4_Rest_Octet_t SI7_Rest_Octet_t; +typedef SI4_Rest_Octet_t SI8_Rest_Octet_t; + + +/* SI6_RestOctet_t */ + +typedef struct +{ + guint8 PagingChannelRestructuring; + guint8 NLN_SACCH; + + gboolean Exist_CallPriority; + guint8 CallPriority; + + guint8 NLN_Status; +} PCH_and_NCH_Info_t; + +typedef struct +{ + gboolean Exist_PCH_and_NCH_Info; + PCH_and_NCH_Info_t PCH_and_NCH_Info; + + gboolean Exist_VBS_VGCS_Options; + guint8 VBS_VGCS_Options; + + /* The meaning of Exist_DTM_Support is as follows: + * FALSE => DTM is not supported in the serving cell, RAC and MAX_LAPDm are absent in bitstream + * TRUE => DTM is supported in the serving cell, RAC and MAX_LAPDm are present in bitstream + */ + gboolean Exist_DTM_Support; + guint8 RAC; + guint8 MAX_LAPDm; + + guint8 BandIndicator; /* bit(1) L/H, L => ARFCN in 1800 band H => ARFCN in 1900 band */ +} SI6_RestOctet_t; + +/************************************************* + * Enhanced Measurement Report. TS 04.18 9.1.55. * + *************************************************/ + +typedef struct +{ + guint8 DTX_USED; + guint8 RXLEV_VAL; + guint8 RX_QUAL_FULL; + guint8 MEAN_BEP; + guint8 CV_BEP; + guint8 NBR_RCVD_BLOCKS; +} EMR_ServingCell_t; + +typedef struct +{ + guint8 RR_Short_PD; + guint8 MESSAGE_TYPE; + guint8 ShortLayer2_Header; + + BA_USED_t BA_USED; + guint8 BSIC_Seen; + + guint8 SCALE; + + guint8 Exist_ServingCellData; + EMR_ServingCell_t ServingCellData; + + guint8 Count_RepeatedInvalid_BSIC_Info; /* Number of instances */ + RepeatedInvalid_BSIC_Info_t RepeatedInvalid_BSIC_Info[INV_BSIC_LIST_LEN]; + + guint8 Exist_ReportBitmap; + guint8 Count_REPORTING_QUANTITY_Instances; /* Number of instances */ + REPORTING_QUANTITY_Instance_t REPORTING_QUANTITY_Instances[REPORT_QUANTITY_LIST_LEN]; + +} EnhancedMeasurementReport_t; + + void decode_gsm_rlcmac_uplink(bitvec * vector, RlcMacUplink_t * data); + void decode_gsm_rlcmac_downlink(bitvec * vector, RlcMacDownlink_t * data); + void encode_gsm_rlcmac_downlink(bitvec * vector, RlcMacDownlink_t * data); + void encode_gsm_rlcmac_uplink(bitvec * vector, RlcMacUplink_t * data); + void decode_gsm_rlcmac_uplink_data(bitvec * vector, RlcMacUplinkDataBlock_t * data); + void encode_gsm_rlcmac_downlink_data(bitvec * vector, RlcMacDownlinkDataBlock_t * data); +#endif /* __PACKET_GSM_RLCMAC_H__ */ diff --git a/src/gsm_timer.cpp b/src/gsm_timer.cpp new file mode 100644 index 00000000..95513b47 --- /dev/null +++ b/src/gsm_timer.cpp @@ -0,0 +1,226 @@ +/* gsm_timer.cpp + * + * Copyright (C) 2012 Ivan Klyuchnikov + * + * 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. + */ + +/* These store the amount of frame number that we wait until next timer expires. */ +static int nearest; +static int *nearest_p; + +/*! \addtogroup gsm_timer + * @{ + */ + +/*! \file gsm_timer.cpp + */ + +#include +#include +#include +#include +#include + +static struct rb_root timer_root = RB_ROOT; + +static void __add_gsm_timer(struct osmo_gsm_timer_list *timer) +{ + struct rb_node **new_node = &(timer_root.rb_node); + struct rb_node *parent = NULL; + + while (*new_node) { + struct osmo_gsm_timer_list *this_timer; + + this_timer = container_of(*new_node, struct osmo_gsm_timer_list, node); + + parent = *new_node; + if (timer->fn < this_timer->fn) + new_node = &((*new_node)->rb_left); + else + new_node = &((*new_node)->rb_right); + } + + rb_link_node(&timer->node, parent, new_node); + rb_insert_color(&timer->node, &timer_root); +} + +/*! \brief add a new timer to the timer management + * \param[in] timer the timer that should be added + */ +void osmo_gsm_timer_add(struct osmo_gsm_timer_list *timer) +{ + osmo_gsm_timer_del(timer); + timer->active = 1; + INIT_LLIST_HEAD(&timer->list); + __add_gsm_timer(timer); +} + +/*! \brief schedule a gsm timer at a given future relative time + * \param[in] timer the to-be-added timer + * \param[in] number of frames from now + * + * This function can be used to (re-)schedule a given timer at a + * specified number of frames in the future. It will + * internally add it to the timer management data structures, thus + * osmo_timer_add() is automatically called. + */ +void +osmo_gsm_timer_schedule(struct osmo_gsm_timer_list *timer, int fn) +{ + int current_fn; + + current_fn = get_current_fn(); + timer->fn = current_fn + fn; + osmo_gsm_timer_add(timer); +} + +/*! \brief delete a gsm timer from timer management + * \param[in] timer the to-be-deleted timer + * + * This function can be used to delete a previously added/scheduled + * timer from the timer management code. + */ +void osmo_gsm_timer_del(struct osmo_gsm_timer_list *timer) +{ + if (timer->active) { + timer->active = 0; + rb_erase(&timer->node, &timer_root); + /* make sure this is not already scheduled for removal. */ + if (!llist_empty(&timer->list)) + llist_del_init(&timer->list); + } +} + +/*! \brief check if given timer is still pending + * \param[in] timer the to-be-checked timer + * \return 1 if pending, 0 otherwise + * + * This function can be used to determine whether a given timer + * has alredy expired (returns 0) or is still pending (returns 1) + */ +int osmo_gsm_timer_pending(struct osmo_gsm_timer_list *timer) +{ + return timer->active; +} + +/* + * if we have a nearest frame number return the delta between the current + * FN and the FN of the nearest timer. + * If the nearest timer timed out return NULL and then we will + * dispatch everything after the select + */ +int *osmo_gsm_timers_nearest(void) +{ + /* nearest_p is exactly what we need already: NULL if nothing is + * waiting, {0,0} if we must dispatch immediately, and the correct + * delay if we need to wait */ + return nearest_p; +} + +static void update_nearest(int *cand, int *current) +{ + if (*cand != LONG_MAX) { + if (*cand > *current) + nearest = *cand - *current; + else { + /* loop again inmediately */ + nearest = 0; + } + nearest_p = &nearest; + } else { + nearest_p = NULL; + } +} + +/* + * Find the nearest FN and update s_nearest_time + */ +void osmo_gsm_timers_prepare(void) +{ + struct rb_node *node; + int current_fn; + + current_fn = get_current_fn(); + + node = rb_first(&timer_root); + if (node) { + struct osmo_gsm_timer_list *this_timer; + this_timer = container_of(node, struct osmo_gsm_timer_list, node); + update_nearest(&this_timer->fn, ¤t_fn); + } else { + nearest_p = NULL; + } +} + +/* + * fire all timers... and remove them + */ +int osmo_gsm_timers_update(void) +{ + int current_fn; + struct rb_node *node; + struct llist_head timer_eviction_list; + struct osmo_gsm_timer_list *this_timer; + int work = 0; + + current_fn = get_current_fn(); + + INIT_LLIST_HEAD(&timer_eviction_list); + for (node = rb_first(&timer_root); node; node = rb_next(node)) { + this_timer = container_of(node, struct osmo_gsm_timer_list, node); + + if (this_timer->fn > current_fn) + break; + + llist_add(&this_timer->list, &timer_eviction_list); + } + + /* + * The callbacks might mess with our list and in this case + * even llist_for_each_entry_safe is not safe to use. To allow + * osmo_gsm_timer_del to be called from within the callback we need + * to restart the iteration for each element scheduled for removal. + * + * The problematic scenario is the following: Given two timers A + * and B that have expired at the same time. Thus, they are both + * in the eviction list in this order: A, then B. If we remove + * timer B from the A's callback, we continue with B in the next + * iteration step, leading to an access-after-release. + */ +restart: + llist_for_each_entry(this_timer, &timer_eviction_list, list) { + osmo_gsm_timer_del(this_timer); + this_timer->cb(this_timer->data); + work = 1; + goto restart; + } + + return work; +} + +int osmo_gsm_timers_check(void) +{ + struct rb_node *node; + int i = 0; + + for (node = rb_first(&timer_root); node; node = rb_next(node)) { + i++; + } + return i; +} + +/*! }@ */ + diff --git a/src/gsm_timer.h b/src/gsm_timer.h new file mode 100644 index 00000000..fc42cafe --- /dev/null +++ b/src/gsm_timer.h @@ -0,0 +1,84 @@ +/* gsm_timer.h + * + * Copyright (C) 2012 Ivan Klyuchnikov + * + * 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. + */ + +/*! \defgroup timer GSM timers + * @{ + */ + +/*! \file gsm_timer.h + * \brief GSM timer handling routines + */ +#ifndef GSM_TIMER_H +#define GSM_TIMER_H + +extern "C" { +#include +#include +} +/** + * Timer management: + * - Create a struct osmo_gsm_timer_list + * - Fill out timeout and use add_gsm_timer or + * use schedule_gsm_timer to schedule a timer in + * x frames from now... + * - Use del_gsm_timer to remove the timer + * + * Internally: + * - We hook into select.c to give a frame number of the + * nearest timer. On already passed timers we give + * it a 0 to immediately fire after the select. + * - update_gsm_timers will call the callbacks and remove + * the timers. + * + */ +/*! \brief A structure representing a single instance of a gsm timer */ +struct osmo_gsm_timer_list { + struct rb_node node; /*!< \brief rb-tree node header */ + struct llist_head list; /*!< \brief internal list header */ + int fn; /*!< \brief expiration frame number */ + unsigned int active : 1; /*!< \brief is it active? */ + + void (*cb)(void*); /*!< \brief call-back called at timeout */ + void *data; /*!< \brief user data for callback */ +}; + +/** + * timer management + */ + +void osmo_gsm_timer_add(struct osmo_gsm_timer_list *timer); + +void osmo_gsm_timer_schedule(struct osmo_gsm_timer_list *timer, int fn); + +void osmo_gsm_timer_del(struct osmo_gsm_timer_list *timer); + +int osmo_gsm_timer_pending(struct osmo_gsm_timer_list *timer); + + +/* + * internal timer list management + */ +int *osmo_gsm_timers_nearest(void); +void osmo_gsm_timers_prepare(void); +int osmo_gsm_timers_update(void); +int osmo_gsm_timers_check(void); + +/*! }@ */ + +#endif // GSM_TIMER_H diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp new file mode 100644 index 00000000..b95c512a --- /dev/null +++ b/src/pcu_l1_if.cpp @@ -0,0 +1,213 @@ +/* pcu_l1_if.cpp + * + * Copyright (C) 2012 Ivan Klyuchnikov + * + * 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. + */ + +#include +#include +#include +#include +#include + +#define MAX_UDP_LENGTH 1500 + +// TODO: We should take ports and IP from config. +UDPSocket pcu_gsmtap_socket(5077, "127.0.0.1", 4729); + +// Variable for storage current FN. +int frame_number; + +int get_current_fn() +{ + return frame_number; +} + +void set_current_fn(int fn) +{ + frame_number = fn; +} + +struct msgb *l1p_msgb_alloc(void) +{ + struct msgb *msg = msgb_alloc(sizeof(GsmL1_Prim_t), "l1_prim"); + + if (msg) + msg->l1h = msgb_put(msg, sizeof(GsmL1_Prim_t)); + + return msg; +} + +struct msgb *gen_dummy_msg(void) +{ + struct msgb *msg = l1p_msgb_alloc(); + GsmL1_Prim_t *prim = msgb_l1prim(msg); + // RLC/MAC filler with USF=1 + bitvec *filler = bitvec_alloc(23); + bitvec_unhex(filler, "41942b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b"); + prim->id = GsmL1_PrimId_PhDataReq; + prim->u.phDataReq.sapi = GsmL1_Sapi_Pacch; + bitvec_pack(filler, prim->u.phDataReq.msgUnitParam.u8Buffer); + prim->u.phDataReq.msgUnitParam.u8Size = filler->data_len; + bitvec_free(filler); + return msg; +} + +// Send RLC/MAC block to OpenBTS. +void pcu_l1if_tx(bitvec * block, GsmL1_Sapi_t sapi, int len) +{ + struct msgb *msg = l1p_msgb_alloc(); + struct osmo_wqueue * queue; + queue = &((l1fh->fl1h)->write_q); + GsmL1_Prim_t *prim = msgb_l1prim(msg); + + prim->id = GsmL1_PrimId_PhDataReq; + prim->u.phDataReq.sapi = sapi; + bitvec_pack(block, prim->u.phDataReq.msgUnitParam.u8Buffer); + prim->u.phDataReq.msgUnitParam.u8Size = len; + osmo_wqueue_enqueue(queue, msg); +} + +int pcu_l1if_rx_pdch(GsmL1_PhDataInd_t *data_ind) +{ + bitvec *block = bitvec_alloc(data_ind->msgUnitParam.u8Size); + bitvec_unpack(block, data_ind->msgUnitParam.u8Buffer); + gprs_rlcmac_rcv_block(block); + bitvec_free(block); +} + +static int handle_ph_connect_ind(struct femtol1_hdl *fl1, GsmL1_PhConnectInd_t *connect_ind) +{ + (l1fh->fl1h)->channel_info.arfcn = connect_ind->u16Arfcn; + (l1fh->fl1h)->channel_info.tn = connect_ind->u8Tn; + (l1fh->fl1h)->channel_info.tsc = connect_ind->u8Tsc; + LOGP(DL1IF, LOGL_NOTICE, "RX: [ PCU <- BTS ] PhConnectInd: ARFCN: %u TN: %u TSC: %u \n", + connect_ind->u16Arfcn, (unsigned)connect_ind->u8Tn, (unsigned)connect_ind->u8Tsc); +} + +static int handle_ph_readytosend_ind(struct femtol1_hdl *fl1, GsmL1_PhReadyToSendInd_t *readytosend_ind) +{ + struct msgb *resp_msg; + struct osmo_wqueue * queue; + queue = &((l1fh->fl1h)->write_q); + + set_current_fn(readytosend_ind->u32Fn); + resp_msg = msgb_dequeue(&queue->msg_queue); + if (!resp_msg) { + resp_msg = gen_dummy_msg(); + if (!resp_msg) + return 0; + } + osmo_wqueue_enqueue(&l1fh->udp_wq, resp_msg); + return 1; +} + +static int handle_ph_data_ind(struct femtol1_hdl *fl1, GsmL1_PhDataInd_t *data_ind) +{ + int rc = 0; + switch (data_ind->sapi) { + case GsmL1_Sapi_Rach: + break; + case GsmL1_Sapi_Pdtch: + case GsmL1_Sapi_Pacch: + pcu_l1if_rx_pdch(data_ind); + break; + case GsmL1_Sapi_Pbcch: + case GsmL1_Sapi_Pagch: + case GsmL1_Sapi_Ppch: + case GsmL1_Sapi_Pnch: + case GsmL1_Sapi_Ptcch: + case GsmL1_Sapi_Prach: + break; + default: + LOGP(DL1IF, LOGL_NOTICE, "Rx PH-DATA.ind for unknown L1 SAPI %u \n", data_ind->sapi); + break; + } + + return rc; +} + +static int handle_ph_ra_ind(struct femtol1_hdl *fl1, GsmL1_PhRaInd_t *ra_ind) +{ + int rc = 0; + (l1fh->fl1h)->channel_info.ta = ra_ind->measParam.i16BurstTiming; + rc = gprs_rlcmac_rcv_rach(ra_ind->msgUnitParam.u8Buffer[0], ra_ind->u32Fn, ra_ind->measParam.i16BurstTiming); + return rc; +} + +/* handle any random indication from the L1 */ +int pcu_l1if_handle_l1prim(struct femtol1_hdl *fl1, struct msgb *msg) +{ + GsmL1_Prim_t *l1p = msgb_l1prim(msg); + int rc = 0; + + switch (l1p->id) { + case GsmL1_PrimId_PhConnectInd: + rc = handle_ph_connect_ind(fl1, &l1p->u.phConnectInd); + break; + case GsmL1_PrimId_PhReadyToSendInd: + rc = handle_ph_readytosend_ind(fl1, &l1p->u.phReadyToSendInd); + break; + case GsmL1_PrimId_PhDataInd: + rc = handle_ph_data_ind(fl1, &l1p->u.phDataInd); + break; + case GsmL1_PrimId_PhRaInd: + rc = handle_ph_ra_ind(fl1, &l1p->u.phRaInd); + break; + default: + break; + } + + /* Special return value '1' means: do not free */ + if (rc != 1) + msgb_free(msg); + + return rc; +} + +void gsmtap_send_llc(uint8_t * data, unsigned len) +{ + char buffer[MAX_UDP_LENGTH]; + int ofs = 0; + + // Build header + struct gsmtap_hdr *header = (struct gsmtap_hdr *)buffer; + header->version = 2; + header->hdr_len = sizeof(struct gsmtap_hdr) >> 2; + header->type = 0x08; + header->timeslot = 5; + header->arfcn = 0; + header->signal_dbm = 0; + header->snr_db = 0; + header->frame_number = 0; + header->sub_type = 0; + header->antenna_nr = 0; + header->sub_slot = 0; + header->res = 0; + + ofs += sizeof(*header); + + // Add frame data + unsigned j = 0; + for (unsigned i = ofs; i < len+ofs; i++) + { + buffer[i] = (char)data[j]; + j++; + } + ofs += len; + // Write the GSMTAP packet + pcu_gsmtap_socket.write(buffer, ofs); +} diff --git a/src/pcu_l1_if.h b/src/pcu_l1_if.h new file mode 100644 index 00000000..60bc72bf --- /dev/null +++ b/src/pcu_l1_if.h @@ -0,0 +1,79 @@ +/* pcu_l1_if.h + * + * Copyright (C) 2012 Ivan Klyuchnikov + * + * 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. + */ + +#ifndef PCU_L1_IF_H +#define PCU_L1_IF_H + + +#include +#include +#include +extern "C" { +#include +#include +#include +#include +} + +#define msgb_l1prim(msg) ((GsmL1_Prim_t *)(msg)->l1h) + +struct femtol1_hdl { + struct gsm_time gsm_time; + uint32_t hLayer1; /* handle to the L1 instance in the DSP */ + uint32_t dsp_trace_f; + uint16_t clk_cal; + struct llist_head wlc_list; + + void *priv; /* user reference */ + + struct osmo_timer_list alive_timer; + unsigned int alive_prim_cnt; + + struct osmo_fd read_ofd; /* osmo file descriptors */ + struct osmo_wqueue write_q; + + struct { + uint16_t arfcn; + uint8_t tn; + uint8_t tsc; + uint16_t ta; + } channel_info; + +}; + +struct l1fwd_hdl { + struct sockaddr_storage remote_sa; + socklen_t remote_sa_len; + + struct osmo_wqueue udp_wq; + + struct femtol1_hdl *fl1h; +}; + +extern struct l1fwd_hdl *l1fh; + +int get_current_fn(); + +void pcu_l1if_tx(bitvec * block, GsmL1_Sapi_t sapi, int len = 23); + +int pcu_l1if_handle_l1prim(struct femtol1_hdl *fl1h, struct msgb *msg); + +void gsmtap_send_llc(uint8_t * data, unsigned len); + +#endif // PCU_L1_IF_H diff --git a/src/pcu_main.cpp b/src/pcu_main.cpp new file mode 100644 index 00000000..f26c6d86 --- /dev/null +++ b/src/pcu_main.cpp @@ -0,0 +1,191 @@ +/* pcu_main.cpp + * + * Copyright (C) 2012 Ivan Klyuchnikov + * + * 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. + */ + +#include +#include +#include +#include +#include + +// TODO: We should move this parameters to config file. +#define SGSN_IP "127.0.0.1" +#define SGSN_PORT 23000 +#define NSVCI 4 +#define PCU_L1_IF_PORT 5944 + +struct l1fwd_hdl *l1fh = talloc_zero(NULL, struct l1fwd_hdl); + +int sgsn_ns_cb(enum gprs_ns_evt event, struct gprs_nsvc *nsvc, struct msgb *msg, uint16_t bvci) +{ + int rc = 0; + switch (event) { + case GPRS_NS_EVT_UNIT_DATA: + /* hand the message into the BSSGP implementation */ + rc = gprs_bssgp_pcu_rcvmsg(msg); + break; + default: + LOGP(DPCU, LOGL_ERROR, "RLCMAC: Unknown event %u from NS\n", event); + if (msg) + talloc_free(msg); + rc = -EIO; + break; + } + return rc; +} + +/* data has arrived on the udp socket */ +static int udp_read_cb(struct osmo_fd *ofd) +{ + struct msgb *msg = msgb_alloc_headroom(2048, 128, "udp_rx"); + struct l1fwd_hdl *l1fh = (l1fwd_hdl *)ofd->data; + struct femtol1_hdl *fl1h = l1fh->fl1h; + int rc; + + if (!msg) + return -ENOMEM; + + msg->l1h = msg->data; + + l1fh->remote_sa_len = sizeof(l1fh->remote_sa); + rc = recvfrom(ofd->fd, msg->l1h, msgb_tailroom(msg), 0, + (struct sockaddr *) &l1fh->remote_sa, &l1fh->remote_sa_len); + if (rc < 0) { + perror("read from udp"); + msgb_free(msg); + return rc; + } else if (rc == 0) { + perror("len=0 read from udp"); + msgb_free(msg); + return rc; + } + msgb_put(msg, rc); + + rc = pcu_l1if_handle_l1prim(fl1h, msg); + return rc; +} + +/* callback when we can write to the UDP socket */ +static int udp_write_cb(struct osmo_fd *ofd, struct msgb *msg) +{ + int rc; + struct l1fwd_hdl *l1fh = (l1fwd_hdl *)ofd->data; + + //DEBUGP(DGPRS, "UDP: Writing %u bytes for MQ_L1_WRITE queue\n", msgb_l1len(msg)); + + rc = sendto(ofd->fd, msg->l1h, msgb_l1len(msg), 0, + (const struct sockaddr *)&l1fh->remote_sa, l1fh->remote_sa_len); + if (rc < 0) { + LOGP(DPCU, LOGL_ERROR, "error writing to L1 msg_queue: %s\n", + strerror(errno)); + return rc; + } else if (rc < msgb_l1len(msg)) { + LOGP(DPCU, LOGL_ERROR, "short write to L1 msg_queue: " + "%u < %u\n", rc, msgb_l1len(msg)); + return -EIO; + } + + return 0; +} + +int pcu_l1if_open() +{ + //struct l1fwd_hdl *l1fh; + struct femtol1_hdl *fl1h; + int rc; + + /* allocate new femtol1_handle */ + fl1h = talloc_zero(NULL, struct femtol1_hdl); + INIT_LLIST_HEAD(&fl1h->wlc_list); + + l1fh->fl1h = fl1h; + fl1h->priv = l1fh; + + struct osmo_wqueue * queue = &((l1fh->fl1h)->write_q); + osmo_wqueue_init(queue, 10); + queue->bfd.when |= BSC_FD_READ; + queue->bfd.data = l1fh; + queue->bfd.priv_nr = 0; + + /* Open UDP */ + struct osmo_wqueue *wq = &l1fh->udp_wq; + + osmo_wqueue_init(wq, 10); + wq->write_cb = udp_write_cb; + wq->read_cb = udp_read_cb; + wq->bfd.when |= BSC_FD_READ; + wq->bfd.data = l1fh; + wq->bfd.priv_nr = 0; + rc = osmo_sock_init_ofd(&wq->bfd, AF_UNSPEC, SOCK_DGRAM, + IPPROTO_UDP, NULL, PCU_L1_IF_PORT, + OSMO_SOCK_F_BIND); + if (rc < 0) { + perror("sock_init"); + exit(1); + } +} + +int main(int argc, char *argv[]) +{ + uint16_t nsvci = NSVCI; + struct gprs_ns_inst *sgsn_nsi; + struct gprs_nsvc *nsvc; + osmo_init_logging(&gprs_log_info); + pcu_l1if_open(); + + sgsn_nsi = gprs_ns_instantiate(&sgsn_ns_cb); + bssgp_nsi = sgsn_nsi; + + if (!bssgp_nsi) + { + LOGP(DPCU, LOGL_ERROR, "Unable to instantiate NS\n"); + exit(1); + } + bctx = btsctx_alloc(BVCI, NSEI); + bctx->cell_id = CELL_ID; + bctx->nsei = NSEI; + bctx->ra_id.mnc = MNC; + bctx->ra_id.mcc = MCC; + bctx->ra_id.lac = PCU_LAC; + bctx->ra_id.rac = PCU_RAC; + bctx->bvci = BVCI; + uint8_t cause = 39; + gprs_ns_nsip_listen(sgsn_nsi); + + struct sockaddr_in dest; + dest.sin_family = AF_INET; + dest.sin_port = htons(SGSN_PORT); + inet_aton(SGSN_IP, &dest.sin_addr); + + nsvc = nsip_connect(sgsn_nsi, &dest, NSEI, nsvci); + unsigned i = 0; + while (1) + { + osmo_gsm_timers_check(); + osmo_gsm_timers_prepare(); + osmo_gsm_timers_update(); + + osmo_select_main(0); + if (i == 7) + { + bssgp_tx_bvc_reset(bctx, BVCI, cause); + } + i++; + } +} + -- cgit v1.2.3