Migrate to libosmocsn1 and libosmo-gprs-rlcmac

Change-Id: Icba62ad8649e78acab711392dfd74fe571474381
This commit is contained in:
Vadim Yanitskiy 2022-08-07 19:53:04 +07:00
parent 4f29fe7d1f
commit bb072bacb0
35 changed files with 63 additions and 16286 deletions

View File

@ -87,6 +87,7 @@ PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.7.0)
PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.7.0)
PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.7.0)
PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 1.7.0)
PKG_CHECK_MODULES(LIBOSMOGPRSRLCMAC, libosmo-gprs-rlcmac)
AC_MSG_CHECKING([whether to enable direct DSP access for PDCH of sysmocom-bts])
AC_ARG_ENABLE(sysmocom-dsp,

View File

@ -73,13 +73,14 @@ fi
verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]")
# Build deps
osmo-build-dep.sh libosmocore "" --disable-doxygen
export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH"
export LD_LIBRARY_PATH="$inst/lib"
export PATH="$inst/bin:$PATH"
# Build deps
osmo-build-dep.sh libosmocore "" --disable-doxygen
osmo-build-dep.sh libosmo-gprs
if [ "$WITH_MANUALS" = "1" ]; then
PCU_CONFIG="$PCU_CONFIG --enable-manuals"
fi

View File

@ -33,6 +33,7 @@ BuildRequires: pkgconfig(libosmogb) >= 1.7.0
BuildRequires: pkgconfig(libosmogsm) >= 1.7.0
BuildRequires: pkgconfig(libosmovty) >= 1.7.0
BuildRequires: pkgconfig(libosmoctrl) >= 1.7.0
BuildRequires: pkgconfig(libosmo-gprs-rlcmac)
%{?systemd_requires}
%description

2
debian/control vendored
View File

@ -6,6 +6,8 @@ Build-Depends: debhelper (>= 9),
dh-autoreconf,
autotools-dev,
pkg-config,
libosmo-csn1-dev,
libosmo-gprs-rlcmac-dev,
libosmocore-dev (>= 1.7.0),
osmo-gsm-manuals-dev (>= 1.3.0)
Standards-Version: 3.9.8

10
debian/copyright vendored
View File

@ -81,16 +81,6 @@ Files: src/pcu_l1_if.cpp
Copyright: 2012 Andreas Eversberg <jolly@eversberg.eu>
License: GPL-2.0+
Files: src/csn1.h
src/csn1.c
src/csn1_dec.c
src/csn1_enc.c
src/gsm_rlcmac.cpp
src/gsm_rlcmac.h
Copyright: 2011 Vincent Helfre
2011 ST-Ericsson (Jari Sassi)
License: GPL-2.0+
License: AGPL-3.0+
All rights not specifically granted under this license are reserved.
.

View File

@ -19,7 +19,15 @@
#
AUTOMAKE_OPTIONS = subdir-objects
AM_CPPFLAGS = -I$(top_srcdir)/include $(STD_DEFINES_AND_INCLUDES) $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGB_CFLAGS) $(LIBOSMOCTRL_CFLAGS) $(LIBOSMOGSM_CFLAGS)
AM_CPPFLAGS = \
-I$(top_srcdir)/include \
$(STD_DEFINES_AND_INCLUDES) \
$(LIBOSMOCORE_CFLAGS) \
$(LIBOSMOGB_CFLAGS) \
$(LIBOSMOCTRL_CFLAGS) \
$(LIBOSMOGSM_CFLAGS) \
$(LIBOSMOGPRSRLCMAC_CFLAGS) \
$(NULL)
if ENABLE_SYSMODSP
AM_CPPFLAGS += -DENABLE_DIRECT_PHY
@ -40,10 +48,6 @@ noinst_LTLIBRARIES = libgprs.la
libgprs_la_SOURCES = \
gprs_debug.c \
csn1.c \
csn1_dec.c \
csn1_enc.c \
gsm_rlcmac.c \
gprs_bssgp_pcu.c \
gprs_bssgp_rim.c \
gprs_rlcmac.cpp \
@ -90,8 +94,6 @@ noinst_PROGRAMS =
noinst_HEADERS = \
gprs_debug.h \
csn1.h \
gsm_rlcmac.h \
gprs_bssgp_pcu.h \
gprs_bssgp_rim.h \
gprs_rlcmac.h \
@ -125,7 +127,7 @@ noinst_HEADERS = \
gprs_codel.h \
coding_scheme.h \
egprs_rlc_compression.h \
wireshark_compat.h
$(NULL)
osmo_pcu_SOURCES = pcu_main.cpp
@ -163,6 +165,7 @@ osmo_pcu_remote_LDADD = \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOCTRL_LIBS) \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOGPRSRLCMAC_LIBS) \
$(NULL)
endif
@ -212,6 +215,7 @@ osmo_pcu_LDADD = \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOCTRL_LIBS) \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOGPRSRLCMAC_LIBS) \
$(NULL)
#MOSTLYCLEANFILES += testSource testDestination

View File

@ -780,7 +780,7 @@ static int parse_egprs_pkt_ch_req(uint16_t ra11, struct chan_req_params *chan_re
EGPRS_PacketChannelRequest_t req;
int rc;
rc = decode_egprs_pkt_ch_req(ra11, &req);
rc = osmo_gprs_rlcmac_decode_egprs_pkt_ch_req(ra11, &req);
if (rc) {
LOGP(DRLCMAC, LOGL_NOTICE, "Failed to decode "
"EGPRS Packet Channel Request: rc=%d\n", rc);
@ -788,7 +788,7 @@ static int parse_egprs_pkt_ch_req(uint16_t ra11, struct chan_req_params *chan_re
}
LOGP(DRLCMAC, LOGL_INFO, "Rx EGPRS Packet Channel Request: %s\n",
get_value_string(egprs_pkt_ch_req_type_names, req.Type));
get_value_string(osmo_gprs_rlcmac_egprs_pkt_ch_req_type_names, req.Type));
switch (req.Type) {
case EGPRS_PKT_CHAN_REQ_ONE_PHASE:
@ -820,7 +820,7 @@ static int parse_egprs_pkt_ch_req(uint16_t ra11, struct chan_req_params *chan_re
case EGPRS_PKT_CHAN_REQ_EMERGENCY_CALL:
case EGPRS_PKT_CHAN_REQ_DEDICATED_CHANNEL:
LOGP(DRLCMAC, LOGL_NOTICE, "%s is not supported, rejecting\n",
get_value_string(egprs_pkt_ch_req_type_names, req.Type));
get_value_string(osmo_gprs_rlcmac_egprs_pkt_ch_req_type_names, req.Type));
return -ENOTSUP;
default:

View File

@ -35,7 +35,6 @@ extern "C" {
#include <osmocom/gsm/gsm48_rest_octets.h>
#include <osmocom/gsm/gsm48.h>
#include "mslot_class.h"
#include "gsm_rlcmac.h"
#include "gprs_pcu.h"
#ifdef __cplusplus
}

View File

@ -1,103 +0,0 @@
/* csn1_enc.c
* 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 <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <assert.h>
#include <string.h>
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include "csn1.h"
#include <gprs_debug.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/utils.h>
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 */
guint8
get_masked_bits8(struct bitvec *vector, unsigned *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;
ar->direction = 0;
}
static const struct value_string csn1_error_names[] = {
{ CSN_OK, "General 0" },
{ CSN_ERROR_GENERAL, "General -1" },
{ CSN_ERROR_DATA_NOT_VALID, "DATA_NOT VALID" },
{ CSN_ERROR_IN_SCRIPT, "IN SCRIPT" },
{ CSN_ERROR_INVALID_UNION_INDEX, "INVALID UNION INDEX" },
{ CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, "NEED_MORE BITS TO UNPACK" },
{ CSN_ERROR_ILLEGAL_BIT_VALUE, "ILLEGAL BIT VALUE" },
{ CSN_ERROR_INTERNAL, "INTERNAL" },
{ CSN_ERROR_STREAM_NOT_SUPPORTED, "STREAM_NOT_SUPPORTED" },
{ CSN_ERROR_MESSAGE_TOO_LONG, "MESSAGE_TOO_LONG" },
{ 0, NULL }
};
gint16 ProcessError_impl(const char *file, int line, unsigned *readIndex,
const char* sz, gint16 err, const CSN_DESCR* pDescr)
{
/* Don't add trailing newline, top caller is responsible for appending it */
if (err != CSN_OK)
LOGPSRC(DCSN1, LOGL_ERROR, file, line, "%s: error %s (%d) at %s (idx %u)",
sz, get_value_string(csn1_error_names, err), err,
pDescr ? pDescr->sz : "-", *readIndex);
return err;
}

View File

@ -1,615 +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 <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _PACKET_CSN1_H_
#define _PACKET_CSN1_H_
#include <osmocom/core/bitvec.h>
#include "wireshark_compat.h"
/* 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
/* 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
typedef void(*void_fn_t)(void);
/* 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, struct bitvec *vector, unsigned *readIndex, void* data);
typedef CSN_CallBackStatus_t (*DissectorCallbackFcn_t)(struct bitvec *vector, unsigned *readIndex, void* param1, void* param2);
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: <bitmap: bit(64)> */
CSN_VARIABLE_BITMAP, /* <N: bit (5)> <bitmap: bit(N + offset)> */
CSN_VARIABLE_BITMAP_1, /* <bitmap: bit**> 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_PADDING_BITS, /* Padding bits fill to the end of the buffer */
CSN_VARIABLE_ARRAY, /* Array with length specified in parameter: <N: bit(4)> <list: octet(N + offset)> */
CSN_VARIABLE_TARRAY, /* Type Array with length specified in parameter: <N: bit(x)> <Type>*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: <list> ::= {1 <number: bit(4) <list>|0}; */
CSN_RECURSIVE_TARRAY, /* Recursive way to specify an array of type: <list> ::= {1 <type>} ** 0 ; */
CSN_RECURSIVE_TARRAY_1, /* same as above but first element always exist:<list> ::= <type> {1 <type>} ** 0 ; */
CSN_RECURSIVE_TARRAY_2, /* same as above but with reversed separators :<lists> ::= <type> { 0 <type> } ** 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 or CSN_UINT_OR_NULL types
* - 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
* - the bit-length of the LENGTH field in a CSN_SERIALISE 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
*
* may_be_null
* TRUE: if dissection may be attempted at an offset beyond the length of existing data bits
* FALSE: othewise
*
* 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
{
const void* ptr;
guint32 value;
} descr;
unsigned offset;
gboolean may_be_null;
const char* sz;
guint32 value;
void_fn_t aux_fn;
} CSN_DESCR;
typedef struct
{
guint8 bits;
guint8 value;
gboolean keep_bits;
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, struct bitvec *vector, unsigned *readIndex, void* data);
gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, struct bitvec *vector, unsigned *writeIndex, 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, FALSE, "", 0, NULL} };
/******************************************************************************
* 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, {_Text}, 0, FALSE, _Text, 0, NULL}
/******************************************************************************
* 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), FALSE, #_MEMBER, 0, NULL}
/******************************************************************************
* M_BIT_OR_NULL(Par1, Par2)
* Similar to the M_BIT 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}
*****************************************************************************/
#define M_BIT_OR_NULL(_STRUCT, _MEMBER)\
{CSN_BIT, 0, {0}, offsetof(_STRUCT, _MEMBER), TRUE, #_MEMBER, 0, NULL}
/******************************************************************************
* 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), FALSE, #_MEMBER, 0, NULL}
/******************************************************************************
* 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), FALSE, #_MEMBER, 0, NULL}
/******************************************************************************
* 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, {0}, offsetof(_STRUCT, _MEMBER), TRUE, #_MEMBER, 0, NULL}
/******************************************************************************
* 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), TRUE, #_MEMBER, 0, NULL}
/******************************************************************************
* 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, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, 0, NULL}
/******************************************************************************
* M_UINT_OR_NULL(Par1, Par2, Par3)
* Similar to the M_UINT except that not only the request set of bits 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_UINT_OR_NULL(_STRUCT, _MEMBER, _BITS)\
{CSN_UINT, _BITS, {0}, offsetof(_STRUCT, _MEMBER), TRUE, #_MEMBER, 0, NULL}
/******************************************************************************
* 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, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, 0, NULL}
/******************************************************************************
* 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), FALSE, #_MEMBER, 0, NULL}
/******************************************************************************
* 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), FALSE, #_MEMBER, 0, NULL}
/******************************************************************************
* 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), FALSE, #_MEMBER, 1, NULL}
/******************************************************************************
* 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), FALSE, #_MEMBER, 0, NULL}
/******************************************************************************
* 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), {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, sizeof(_MEMBER_TYPE), NULL}
/******************************************************************************
* 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), {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, sizeof(_MEMBER_TYPE), NULL}
/******************************************************************************
* 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:
* <array> ::={1 <element> <array>| 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, {(const void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, 0, NULL}
/******************************************************************************
* 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, {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, sizeof(_MEMBER_TYPE), NULL}
/******************************************************************************
* M_REC_TARRAY(Par1, Par2, Par3, Par4)
* Defines an recursive array of structures. The size of the array is variable.
* <list> ::= {1 <type>} ** 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), {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, sizeof(_MEMBER_TYPE), (void_fn_t)ElementsOf(((_STRUCT*)0)->_MEMBER)}
/******************************************************************************
* M_REC_TARRAY1(Par1, Par2, Par3, Par4)
* Same as M_REC_TARRAY but first element always exist:
* <list> ::= <type> {1 <type>} ** 0 ;
*****************************************************************************/
#define M_REC_TARRAY_1(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField)\
{CSN_RECURSIVE_TARRAY_1, offsetof(_STRUCT, _ElementCountField), {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, sizeof(_MEMBER_TYPE), (void_fn_t)ElementsOf(((_STRUCT*)0)->_MEMBER)}
/******************************************************************************
* M_REC_TARRAY2(Par1, Par2, Par3, Par4)
* Same as M_REC_TARRAY but with reversed separators :
* <lists> ::= <type> { 0 <type> } ** 1 ;
*****************************************************************************/
#define M_REC_TARRAY_2(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField)\
{CSN_RECURSIVE_TARRAY_2, offsetof(_STRUCT, _ElementCountField), {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, sizeof(_MEMBER_TYPE), (void_fn_t)ElementsOf(((_STRUCT*)0)->_MEMBER)}
/******************************************************************************
* M_TYPE(Par1, Par2, Par3)
* Defines a reference to a structure which is described elsewhere
* <list> ::= {1 <type>} ** 0 ;
* Par1: C structure name
* Par2: C structure element name
* Par3: type of member
*****************************************************************************/
#define M_TYPE(_STRUCT, _MEMBER, _MEMBER_TYPE)\
{CSN_TYPE, 0, {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, 0, NULL}
/******************************************************************************
* M_TYPE_OR_NULL(Par1, Par2, Par3)
* Similar to the M_TYPE except that not only the request set of bits 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_TYPE_OR_NULL(_STRUCT, _MEMBER, _MEMBER_TYPE)\
{CSN_TYPE, 0, {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), TRUE, #_MEMBER, 0, NULL}
/******************************************************************************
* 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), FALSE, "UnionType", 0, NULL}
/******************************************************************************
* 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), FALSE, "UnionType", 0, NULL}
/******************************************************************************
* 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. Up to 256 (UCHAR_MAX) unique
* selectors can be handled, longer choice list would cause CSN_ERROR_IN_SCRIPT.
* After unpacking, this value is then converted to the sequential number of the
* element in the union and stored in the UnionType variable (Par2).
* Par1: C structure name
* Par2: C structure field name holding sequential number of the chosen element.
* BEWARE! Never use an enumerated type here, because its length is
* compiler/machine dependent, while decoder would cast it to guint8.
* 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, {(const void*)_CHOICE}, offsetof(_STRUCT, _MEMBER), FALSE, #_CHOICE, 0, NULL}
/******************************************************************************
* 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, FALSE, #_BITVALUE, 0, NULL}
/******************************************************************************
* M_SERIALIZE(Par1, Par2, Par3)
* Allows using a complete free format of data being encoded or decoded.
* When the M_SERIALIZE is encounted 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, _LENGTH_LEN, _SERIALIZEFCN)\
{CSN_SERIALIZE, _LENGTH_LEN, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, 0, (void_fn_t)_SERIALIZEFCN}
#define M_CALLBACK(_STRUCT, _CSNCALLBACKFCN, _PARAM1, _PARAM2)\
{CSN_CALLBACK, offsetof(_STRUCT, _PARAM1), {0}, offsetof(_STRUCT, _PARAM2), FALSE, "CallBack_"#_CSNCALLBACKFCN, 0, (void_fn_t)_CSNCALLBACKFCN}
/******************************************************************************
* 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), FALSE, #_MEMBER, 0, NULL}
/* 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), FALSE, #_MEMBER, 0, NULL}
/* 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), FALSE, #_MEMBER, 0, NULL}
/* 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), FALSE, #_MEMBER, 0, NULL}
/* 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), FALSE, #_MEMBER, 0, NULL}
/* todo: dissect padding bits looking for unexpected extensions */
#define M_PADDING_BITS(_STRUCT)\
{CSN_PADDING_BITS, 0, {0}, 0, TRUE, "Padding", 0, NULL}
#define M_NULL(_STRUCT, _MEMBER, _SKIP_BITS)\
{CSN_NULL, _SKIP_BITS, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, 0, NULL}
#define M_THIS_EXIST(_STRUCT)\
{CSN_EXIST, 0, {0}, offsetof(_STRUCT, Exist), FALSE, "Exist", 0, NULL}
#define M_THIS_EXIST_LH(_STRUCT)\
{CSN_EXIST_LH, 0, {0}, offsetof(_STRUCT, Exist), FALSE, "Exist", 0, NULL}
/* return value 0 if ok else discontionue the unpacking */
typedef gint16 (*CsnCallBackFcn_t)(void* pv ,...);
#define CSNDESCR(_FuncType) CSNDESCR_##_FuncType
#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
gint16 ProcessError_impl(const char *file, int line, unsigned *readIndex,
const char* sz, gint16 err, const CSN_DESCR* pDescr);
#define ProcessError(readIndex, sz, err, pDescr) \
ProcessError_impl(__FILE__, __LINE__, readIndex, sz, err, pDescr)
#endif /*_PACKET_CSN1_H_*/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,7 @@
extern "C" {
#endif
#include "gsm_rlcmac.h"
#include <osmocom/gprs/rlcmac/gprs_rlcmac.h>
#include "coding_scheme.h"
#ifdef __cplusplus

View File

@ -21,9 +21,9 @@
#ifdef __cplusplus
extern "C" {
#endif
#include <osmocom/gprs/rlcmac/gprs_rlcmac.h>
#include <osmocom/gsm/l1sap.h>
#include "coding_scheme.h"
#include "gsm_rlcmac.h"
#ifdef __cplusplus
}
#endif

View File

@ -86,7 +86,7 @@ static int parse_ra_cap(struct tlv_parsed *tp, MS_Radio_Access_capability_t *rac
bitvec_unpack(block, cap);
/* TS 24.008, 10.5.5.12a */
decode_gsm_ra_cap(block, rac);
osmo_gprs_rlcmac_decode_ms_ra_cap(block, rac);
bitvec_free(block);
return 0;

View File

@ -23,13 +23,6 @@
/* default categories */
static const struct log_info_cat default_categories[] = {
[DCSN1] = {
.name = "DCSN1",
.color = "\033[1;31m",
.description = "Concrete Syntax Notation One (CSN1)",
.loglevel = LOGL_NOTICE,
.enabled = 0,
},
[DL1IF] = {
.name = "DL1IF",
.color = "\033[1;32m",

View File

@ -26,7 +26,6 @@ extern "C" {
/* Debug Areas of the code */
enum {
DCSN1,
DL1IF,
DRLCMAC,
DRLCMACDATA,

View File

@ -32,11 +32,11 @@ extern "C" {
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/rate_ctr.h>
#include <osmocom/gprs/rlcmac/gprs_rlcmac.h>
#include <osmocom/gsm/protocol/gsm_23_003.h>
#include <osmocom/gsm/gsm48.h>
#include "coding_scheme.h"
#include <gsm_rlcmac.h>
#include <stdint.h>
#include <stddef.h>

View File

@ -30,7 +30,6 @@ extern "C" {
#include <osmocom/core/bitvec.h>
#include <osmocom/gsm/gsm48.h>
#include <osmocom/pcu/pcuif_proto.h>
#include "gsm_rlcmac.h"
#ifdef __cplusplus
}
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -137,7 +137,7 @@ static struct msgb *create_packet_neighbour_cell_data(struct nacc_fsm_ctx *ctx,
tfi_is_dl, tfi, container_id,
ctx->container_idx, &container);
LOGP(DNACC, LOGL_DEBUG, "+++++++++++++++++++++++++ TX : Packet Neighbour Cell Data +++++++++++++++++++++++++\n");
rc = encode_gsm_rlcmac_downlink(&bv, mac_control_block);
rc = osmo_gprs_rlcmac_encode_downlink(&bv, mac_control_block);
if (rc < 0) {
LOGP(DTBF, LOGL_ERROR, "Encoding of Packet Neighbour Cell Data failed (%d)\n", rc);
goto free_ret;
@ -194,7 +194,7 @@ static struct msgb *create_packet_cell_chg_continue(const struct nacc_fsm_ctx *c
write_packet_cell_change_continue(mac_control_block, 1, rrbp, tfi_is_dl, tfi, true,
ctx->neigh_key.tgt_arfcn, ctx->neigh_key.tgt_bsic, container_id);
LOGP(DNACC, LOGL_DEBUG, "+++++++++++++++++++++++++ TX : Packet Cell Change Continue +++++++++++++++++++++++++\n");
rc = encode_gsm_rlcmac_downlink(&bv, mac_control_block);
rc = osmo_gprs_rlcmac_encode_downlink(&bv, mac_control_block);
if (rc < 0) {
LOGP(DTBF, LOGL_ERROR, "Encoding of Packet Cell Change Continue failed (%d)\n", rc);
goto free_ret;

View File

@ -248,6 +248,9 @@ int main(int argc, char *argv[])
pcu_vty_init();
osmo_cpu_sched_vty_init(tall_pcu_ctx);
logging_vty_add_deprecated_subsys(tall_pcu_ctx, "bssgp");
logging_vty_add_deprecated_subsys(tall_pcu_ctx, "csn1");
osmo_gprs_rlcmac_set_log_cat(DRLCMACDATA);
handle_options(argc, argv);
if ((!!spoof_mcc) + (!!spoof_mnc) == 1) {

View File

@ -46,7 +46,6 @@ extern "C" {
#include <osmocom/core/utils.h>
#include "coding_scheme.h"
#include "gsm_rlcmac.h"
#include "nacc_fsm.h"
}
@ -295,7 +294,7 @@ continue_next:
bitvec_pack(pag_vec, msgb_put(msg, 23));
mac_control_block = (RlcMacDownlink_t *)talloc_zero(tall_pcu_ctx, RlcMacDownlink_t);
LOGPDCH(this, DRLCMAC, LOGL_DEBUG, "+++++++++++++++++++++++++ TX : Packet Paging Request +++++++++++++++++++++++++\n");
rc = decode_gsm_rlcmac_downlink(pag_vec, mac_control_block);
rc = osmo_gprs_rlcmac_decode_downlink(pag_vec, mac_control_block);
if (rc < 0) {
LOGPDCH(this, DRLCMAC, LOGL_ERROR, "Decoding of Downlink Packet Paging Request failed (%d): %s\n",
rc, osmo_hexdump(msgb_data(msg), msgb_length(msg)));
@ -899,7 +898,7 @@ int gprs_rlcmac_pdch::rcv_control_block(const uint8_t *data, uint8_t data_len,
LOGPDCH(this, DRLCMAC, LOGL_DEBUG, "FN=%u +++++++++++++++++++++++++ RX : Uplink Control Block +++++++++++++++++++++++++\n", fn);
rc = decode_gsm_rlcmac_uplink(rlc_block, ul_control_block);
rc = osmo_gprs_rlcmac_decode_uplink(rlc_block, ul_control_block);
if (ul_control_block->u.MESSAGE_TYPE == MT_PACKET_UPLINK_DUMMY_CONTROL_BLOCK)
bts_send_gsmtap_meas(bts(), PCU_GSMTAP_C_UL_DUMMY, true, trx_no(), ts_no, GSMTAP_CHANNEL_PACCH, fn, data, data_len, meas);
else

View File

@ -22,7 +22,7 @@
#ifdef __cplusplus
extern "C" {
#include <osmocom/core/linuxlist.h>
#include "gsm_rlcmac.h"
#include <osmocom/gprs/rlcmac/gprs_rlcmac.h>
#include "coding_scheme.h"
#include "pdch_ul_controller.h"
}

View File

@ -43,7 +43,6 @@ extern "C" {
#include <osmocom/core/rate_ctr.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
#include "gsm_rlcmac.h"
#include "coding_scheme.h"
#include "nacc_fsm.h"
}

View File

@ -105,7 +105,7 @@ struct msgb *create_packet_dl_assign(const struct tbf_dl_ass_fsm_ctx *ctx,
bts_get_ms_pwr_alpha(ms->bts), the_pcu->vty.gamma, -1, 0,
tbf_is_egprs_enabled(ctx->tbf), tbf_state(ctx->tbf) == TBF_ST_WAIT_RELEASE);
LOGP(DTBF, LOGL_DEBUG, "+++++++++++++++++++++++++ TX : Packet Downlink Assignment +++++++++++++++++++++++++\n");
rc = encode_gsm_rlcmac_downlink(&bv, mac_control_block);
rc = osmo_gprs_rlcmac_encode_downlink(&bv, mac_control_block);
if (rc < 0) {
LOGP(DTBF, LOGL_ERROR, "Encoding of Packet Downlink Ass failed (%d)\n", rc);
goto free_ret;

View File

@ -120,7 +120,7 @@ struct msgb *create_packet_ul_assign(const struct tbf_ul_ass_fsm_ctx *ctx,
the_pcu->vty.gamma, -1, tbf_is_egprs_enabled(ctx->tbf));
LOGP(DTBF, LOGL_DEBUG, "+++++++++++++++++++++++++ TX : Packet Uplink Assignment +++++++++++++++++++++++++\n");
rc = encode_gsm_rlcmac_downlink(&bv, mac_control_block);
rc = osmo_gprs_rlcmac_encode_downlink(&bv, mac_control_block);
if (rc < 0) {
LOGP(DTBF, LOGL_ERROR, "Encoding of Packet Uplink Ass failed (%d)\n", rc);
goto free_ret;

View File

@ -1,34 +0,0 @@
/* wireshark_compat.h
* Copyright (C) 2020 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
*
* 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.
*/
/* This header contains a few definitions required by rlcmac and csn1 files
* originally imported from wireshark packet-gsm_rlcmac.* and package-csn1.*,
* in order to keep code as similar as possible to ease maintainability and port
* of patches.
*/
#pragma once
#define MIN(a,b) (((a)<(b))?(a):(b))
#define FALSE (0)
#define TRUE (1)
typedef signed int gint32;
typedef signed short gint16;
typedef int gint;
typedef unsigned int guint;
typedef gint gboolean;
typedef unsigned char guint8;
typedef unsigned short guint16;
typedef unsigned int guint32;
typedef unsigned long guint64;

View File

@ -1,8 +1,16 @@
AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(LIBOSMOCORE_CFLAGS) $(LIBOSMOCTRL_CFLAGS) $(LIBOSMOGB_CFLAGS) $(LIBOSMOGSM_CFLAGS) -I$(top_srcdir)/src/ -I$(top_srcdir)/include/
AM_CPPFLAGS = \
$(STD_DEFINES_AND_INCLUDES) \
$(LIBOSMOCORE_CFLAGS) \
$(LIBOSMOCTRL_CFLAGS) \
$(LIBOSMOGB_CFLAGS) \
$(LIBOSMOGSM_CFLAGS) \
$(LIBOSMOGPRSRLCMAC_CFLAGS) \
-I$(top_srcdir)/src/ \
-I$(top_srcdir)/include/ \
$(NULL)
AM_LDFLAGS = -lrt -no-install
check_PROGRAMS = \
rlcmac/RLCMACTest \
alloc/AllocTest \
alloc/MslotTest \
tbf/TbfTest \
@ -20,12 +28,6 @@ check_PROGRAMS = \
noinst_PROGRAMS = emu/pcu_emu
rlcmac_RLCMACTest_SOURCES = rlcmac/RLCMACTest.cpp
rlcmac_RLCMACTest_LDADD = \
$(top_builddir)/src/libgprs.la \
$(LIBOSMOCORE_LIBS) \
$(NULL)
alloc_AllocTest_SOURCES = alloc/AllocTest.cpp
alloc_AllocTest_LDADD = \
$(top_builddir)/src/libgprs.la \
@ -33,6 +35,7 @@ alloc_AllocTest_LDADD = \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOCTRL_LIBS) \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGPRSRLCMAC_LIBS) \
$(NULL)
alloc_MslotTest_SOURCES = alloc/MslotTest.cpp
@ -42,6 +45,7 @@ alloc_MslotTest_LDADD = \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOCTRL_LIBS) \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGPRSRLCMAC_LIBS) \
$(NULL)
tbf_TbfTest_SOURCES = tbf/TbfTest.cpp
@ -51,6 +55,7 @@ tbf_TbfTest_LDADD = \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOCTRL_LIBS) \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGPRSRLCMAC_LIBS) \
$(NULL)
tbf_TbfTest_LDFLAGS = -Wl,--wrap=pcu_sock_send
@ -59,6 +64,7 @@ bitcomp_BitcompTest_LDADD = \
$(top_builddir)/src/libgprs.la \
$(LIBOSMOCTRL_LIBS) \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGPRSRLCMAC_LIBS) \
$(NULL)
edge_EdgeTest_SOURCES = edge/EdgeTest.cpp
@ -68,6 +74,7 @@ edge_EdgeTest_LDADD = \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOCTRL_LIBS) \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGPRSRLCMAC_LIBS) \
$(NULL)
emu_pcu_emu_SOURCES = emu/pcu_emu.cpp emu/test_replay_gprs_attach.cpp \
@ -79,6 +86,7 @@ emu_pcu_emu_LDADD = \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOCTRL_LIBS) \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGPRSRLCMAC_LIBS) \
$(NULL)
types_TypesTest_SOURCES = types/TypesTest.cpp
@ -88,6 +96,7 @@ types_TypesTest_LDADD = \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOCTRL_LIBS) \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGPRSRLCMAC_LIBS) \
$(NULL)
ms_MsTest_SOURCES = ms/MsTest.cpp
@ -97,6 +106,7 @@ ms_MsTest_LDADD = \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOCTRL_LIBS) \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGPRSRLCMAC_LIBS) \
$(NULL)
ms_MsTest_LDFLAGS = \
@ -109,6 +119,7 @@ llc_LlcTest_LDADD = \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOCTRL_LIBS) \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGPRSRLCMAC_LIBS) \
$(NULL)
llc_LlcTest_LDFLAGS = \
@ -117,6 +128,7 @@ llc_LlcTest_LDFLAGS = \
llist_LListTest_SOURCES = llist/LListTest.cpp
llist_LListTest_LDADD = \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGPRSRLCMAC_LIBS) \
$(NULL)
codel_codel_test_SOURCES = codel/codel_test.c
@ -124,6 +136,7 @@ codel_codel_test_LDADD = \
$(top_builddir)/src/libgprs.la \
$(LIBOSMOCTRL_LIBS) \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGPRSRLCMAC_LIBS) \
$(NULL)
fn_FnTest_SOURCES = fn/FnTest.cpp
@ -133,6 +146,7 @@ fn_FnTest_LDADD = \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOCTRL_LIBS) \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGPRSRLCMAC_LIBS) \
$(NULL)
app_info_AppInfoTest_SOURCES = app_info/AppInfoTest.cpp
@ -142,6 +156,7 @@ app_info_AppInfoTest_LDADD = \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOCTRL_LIBS) \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGPRSRLCMAC_LIBS) \
$(NULL)
ulc_PdchUlcTest_SOURCES = ulc/PdchUlcTest.cpp
@ -151,6 +166,7 @@ ulc_PdchUlcTest_LDADD = \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOCTRL_LIBS) \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGPRSRLCMAC_LIBS) \
$(NULL)
# The `:;' works around a Bash 3.2 bug when the output is not writeable.
@ -175,7 +191,6 @@ EXTRA_DIST = \
testsuite.at \
$(srcdir)/package.m4 \
$(TESTSUITE) \
rlcmac/RLCMACTest.ok rlcmac/RLCMACTest.err \
alloc/AllocTest.ok alloc/AllocTest.err \
tbf/TbfTest.err \
bitcomp/BitcompTest.ok bitcomp/BitcompTest.err \
@ -195,9 +210,6 @@ DISTCLEANFILES = atconfig
TESTSUITE = $(srcdir)/testsuite
update_exp: $(check_PROGRAMS)
rlcmac/RLCMACTest \
>$(srcdir)/rlcmac/RLCMACTest.ok \
2>$(srcdir)/rlcmac/RLCMACTest.err
alloc/MslotTest \
>$(srcdir)/alloc/MslotTest.ok
alloc/AllocTest \

View File

@ -1,835 +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.
*/
#include <iostream>
#include <cstring>
#include "gprs_rlcmac.h"
#include "decoding.h"
extern "C" {
#include <osmocom/core/utils.h>
#include <osmocom/core/msgb.h>
#include "csn1.h"
#include "gsm_rlcmac.h"
}
using namespace std;
#include "gprs_debug.h"
void *tall_pcu_ctx;
static void testRlcMacDownlink(void *test_ctx)
{
printf("*** %s ***\n", __func__);
int rc;
struct bitvec *resultVector = bitvec_alloc(23, test_ctx);
bitvec_unhex(resultVector, DUMMY_VEC);
std::string testData[] = {
"4e082500e3f1a81d080820800b2b2b2b2b2b2b2b2b2b2b", // Packet Downlink Assignment
"48282407a6a07422720100032b2b2b2b2b2b2b2b2b2b2b", // Packet Uplink Assignment
"47240c00400000000000000079eb2ac9402b2b2b2b2b2b", // Packet Uplink Ack Nack
"47283c367513ba333004242b2b2b2b2b2b2b2b2b2b2b2b", // Packet Uplink Assignment
"400820001a3904df0680efb3300b2b2b2b2b2b2b2b2b2b", // Packet Downlink Assignment (EGPRS)
"40284f0000001009810c826f4406809dcecb2b2b2b2b2b", // Packet Uplink Assignment (EGPRS)
"4024030f2f0000000087b0042b2b2b2b2b2b2b2b2b2b2b", // Packet Uplink Ack Nack (EGPRS)
"4913e00850884013a8048b2b2b2b2b2b2b2b2b2b2b2b2b", // Polling Request (malformed)
"412430007fffffffffffffffefd19c7ba12b2b2b2b2b2b", // Packet Uplink Ack Nack?
"41942b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b", // System Info 13?
"40883c1493120000000012002b2b2b2b2b2b2b2b2b2b2b", // Pkt Paging Request (OS#4838)
};
cout << " DOWNLINK " << endl;
for (unsigned int i = 0; i < ARRAY_SIZE(testData); i++)
{
cout << "vector1 = " << testData[i] << endl;
bitvec *vector = bitvec_alloc(23, test_ctx);
bitvec_unhex(vector, testData[i].c_str());
RlcMacDownlink_t data;
memset(&data, 0, sizeof(data));
cout << "=========Start DECODE===========" << endl;
rc = decode_gsm_rlcmac_downlink(vector, &data);
cout << "+++++++++Finish DECODE ("<< rc <<")++++++++++" << endl;
cout << "=========Start ENCODE=============" << endl;
rc = encode_gsm_rlcmac_downlink(resultVector, &data);
cout << "+++++++++Finish ENCODE ("<< rc <<")+++++++++++" << endl;
cout << "vector1 = " << osmo_hexdump(vector->data, 23) << endl;
cout << "vector2 = " << osmo_hexdump(resultVector->data, 23) << endl;
if (memcmp(vector->data, resultVector->data, 23) == 0)
cout << "vector1 == vector2 : TRUE" << endl;
else
cout << "vector1 == vector2 : FALSE" << endl;
bitvec_unhex(resultVector, DUMMY_VEC);
bitvec_free(vector);
}
bitvec_free(resultVector);
}
static void testRlcMacUplink(void *test_ctx)
{
printf("*** %s ***\n", __func__);
int rc;
struct bitvec *resultVector = bitvec_alloc(23, test_ctx);
bitvec_unhex(resultVector, DUMMY_VEC);
std::string testData[] = {
"400e1e61d11d2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b", // Packet Uplink Dummy Control Block
"400b8020000000000000002480e0032b2b2b2b2b2b2b2b", // Packet Downlink Ack/Nack
"4016713dc094270ca2ae57ef909006aa0fc0001f80222b", // Packet Resource Request
"401673c87f24af2632b25964200600000091000b780080", // Packet Resource Request (from keith)
"40200ffc0021ec010b2b2b2b2b2b2b2b2b2b2b2b2b2b2b", // EPDAN
"400a9020000000000000003010012a0800132b2b2b2b2b", // Packet Downlink Ack/Nack ?
/* Packet Resource Request (see OS#4955, mistakes in 3GPP TS 44.060) */
"4117ea1b903eaeb2686564b2330820078000102b2b2b2b",
"40167e49f7f8ef2632b2596620060000806d00541c0080",
"4017787174d92eba686564b2ccc30800a000040b2b2b2b",
"4017e5b2cd5a2eca68655e44aec84880139300412b2b2b",
};
cout << " UPLINK " << endl;
for (unsigned int i = 0; i < ARRAY_SIZE(testData); i++)
{
cout << "vector1 = " << testData[i] << endl;
bitvec *vector = bitvec_alloc(23, test_ctx);
bitvec_unhex(vector, testData[i].c_str());
RlcMacUplink_t data;
memset(&data, 0, sizeof(data));
cout << "=========Start DECODE===========" << endl;
rc = decode_gsm_rlcmac_uplink(vector, &data);
cout << "+++++++++Finish DECODE ("<< rc << ")++++++++++" << endl;
cout << "=========Start ENCODE=============" << endl;
rc = encode_gsm_rlcmac_uplink(resultVector, &data);
cout << "+++++++++Finish ENCODE ("<< rc <<")+++++++++++" << endl;
cout << "vector1 = " << osmo_hexdump(vector->data, 23) << endl;
cout << "vector2 = " << osmo_hexdump(resultVector->data, 23) << endl;
if (memcmp(vector->data, resultVector->data, 23) == 0)
cout << "vector1 == vector2 : TRUE" << endl;
else
cout << "vector1 == vector2 : FALSE" << endl;
bitvec_unhex(resultVector, DUMMY_VEC);
bitvec_free(vector);
}
bitvec_free(resultVector);
}
static void testCsnLeftAlignedVarBmpBounds(void *test_ctx)
{
printf("*** %s ***\n", __func__);
struct msgb *m = msgb_alloc(80, "test");
static uint8_t exp[] = { 0x7f, 0xff, 0xff, 0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
bitvec *vector = bitvec_alloc(23, test_ctx);
int rc;
bitvec_unhex(vector, "40200bffd161003e0e519ffffffb800000000000000000");
RlcMacUplink_t data;
memset(&data, 0, sizeof(data));
EGPRS_AckNack_Desc_t *urbb =
&data.u.Egprs_Packet_Downlink_Ack_Nack.EGPRS_AckNack.Desc;
rc = decode_gsm_rlcmac_uplink(vector, &data);
OSMO_ASSERT(rc == 0);
memcpy(msgb_put(m, 13), urbb->URBB, 13);
if (!msgb_eq_data_print(m, exp, 13))
printf("%s failed!\n", __func__);
msgb_free(m);
}
extern "C" {
int encode_gsm_ra_cap(struct bitvec *vector, MS_Radio_Access_capability_t * data);
}
static void testRAcap(void *test_ctx)
{
printf("*** %s ***\n", __func__);
MS_Radio_Access_capability_t data;
memset(&data, 0, sizeof(data));
bitvec *bv_dec = bitvec_alloc(23, test_ctx);
bitvec *bv_enc = bitvec_alloc(23, test_ctx);
unsigned int len_dec, len_enc;
int rc;
/*
MS RA capability 1
0001 .... = Access Technology Type: GSM E --note that GSM E covers GSM P (1)
.... 0011 011. .... = Length in bits: 0x1b (27)
...0 01.. RF Power Capability, GMSK Power Class: Not specified (1)
A5 Bits: Same values apply for parameters as in the immediately preceding Access capabilities field within this IE (0)
.... ...1 = Controlled early Classmark Sending: Implemented
0... .... = Pseudo Synchronisation: Not Present
.0.. .... = Voice Group Call Service: no VGCS capability or no notifications wanted
..0. .... = Voice Broadcast Service: no VBS capability or no notifications wanted
...1 .... = Multislot capability struct: Present
HSCSD multislot class: Bits are not available (0)
SMS_VALUE (Switch-Measure-Switch): Bits are not available (0)
ECSD multislot class: Bits are not available (0)
DTM GPRS Multi Slot Class: Bits are not available (0)
.... ..00 011. .... = GPRS multislot class: Max Rx-Slot/TDMA:2 Max Tx-Slot/TDMA:2 Max-Sum-Slot/TDMA:3 Tta:3 Ttb:2 Tra:3 Trb:1 Type:1 (3)
...0 .... = GPRS Extended Dynamic Allocation Capability: Not Implemented
.... ...0 0011 .... = EGPRS multislot class: Max Rx-Slot/TDMA:2 Max Tx-Slot/TDMA:2 Max-Sum-Slot/TDMA:3 Tta:3 Ttb:2 Tra:3 Trb:1 Type:1 (3)
.... 0... = EGPRS Extended Dynamic Allocation Capability: Not Implemented
*/
bitvec_unhex(bv_dec, "1365146230");
printf("=== Test decoding of MS RA Capability ===\n");
rc = decode_gsm_ra_cap(bv_dec, &data);
OSMO_ASSERT(rc == 0);
/* Make sure there's 1 value (currently fails due to failed decoding) */
OSMO_ASSERT(data.Count_MS_RA_capability_value == 1);
/* Make sure GPRS / EGPRS multislot class is parsed correctly */
printf("GPRS multislot class = %u\n", get_ms_class_by_capability(&data));
printf("EGPRS multislot class = %u\n", get_egprs_ms_class_by_capability(&data));
/* Test encoding of decoded MS RA Capability */
printf("=== Test encoding of MS RA Capability ===\n");
rc = encode_gsm_ra_cap(bv_enc, &data);
printf("encode_gsm_ra_cap() returns %d\n", rc);
bv_dec->cur_bit = 4;
len_dec = bitvec_get_uint(bv_dec, 7);
bv_enc->cur_bit = 4;
len_enc = bitvec_get_uint(bv_enc, 7);
/* NOTE: vector2 is expected to be different because there is actually no
* way to distinguish between NULL and 0 in MS_Radio_Access_capability_t.
* The difference is in length indicator: 27 bits vs 65 bits. */
printf("vector1 (len_ind=%u) = %s\n", len_dec, osmo_hexdump(bv_dec->data, bv_dec->data_len));
printf("vector2 (len_ind=%u) = %s\n", len_enc, osmo_hexdump(bv_enc->data, bv_enc->data_len));
/* Mangle the length indicator (set it to 21) */
unsigned int writeIndex = 4;
rc = bitvec_write_field(bv_dec, &writeIndex, 21, 7);
OSMO_ASSERT(rc == 0);
/* Make sure decoding attempt fails */
printf("=== Test decoding of a malformed vector (short length indicator) ===\n");
rc = decode_gsm_ra_cap(bv_dec, &data);
printf("decode_gsm_ra_cap() returns %d\n", rc);
}
static void testMalformedRAcap(void *test_ctx)
{
printf("*** %s ***\n", __func__);
MS_Radio_Access_capability_t data;
memset(&data, 0, sizeof(data));
bitvec *bv_dec = bitvec_alloc(23, test_ctx);
int rc;
/*
MS RA capability 1
0001 .... = Access Technology Type: GSM E --note that GSM E covers GSM P (1)
.... 0011 101. .... = Length in bits: 0x1d (29)
...0 01.. RF Power Capability, GMSK Power Class: Not specified (1)
A5 Bits: Same values apply for parameters as in the immediately preceding Access capabilities field within this IE (0)
.... ...1 = Controlled early Classmark Sending: Implemented
0... .... = Pseudo Synchronisation: Not Present
.0.. .... = Voice Group Call Service: no VGCS capability or no notifications wanted
..0. .... = Voice Broadcast Service: no VBS capability or no notifications wanted
...1 .... = Multislot capability struct: Present
.... ..00 011. .... = GPRS multislot class: Max Rx-Slot/TDMA:2 Max Tx-Slot/TDMA:2 Max-Sum-Slot/TDMA:3 Tta:3 Ttb:2 Tra:3 Trb:1 Type:1 (3)
...0 .... = GPRS Extended Dynamic Allocation Capability: Not Implemented
It doesn't show up in wireshark's tree above because specific parser is
used, but this RA Cap bitstream has Exist_EGPRS_multislot_class = 1 but
it provides no struct with the expected data (malformed, generated
erroneusly through TTCN3). The CSN.1 dceoder should ideally return an
error here, but it doesn't (it returns a >0 value which we convert to 0
in decode_gsm_ra_cap()).
*/
bitvec_unhex(bv_dec, "13a5146200");
printf("=== Test decoding of MS RA Capability ===\n");
rc = decode_gsm_ra_cap(bv_dec, &data);
printf("decode_gsm_ra_cap() returns %d\n", rc);
OSMO_ASSERT(rc == 0);
/* For sake of completeness, check if the decoder could find 1 value
before failing to decode it */
OSMO_ASSERT(data.Count_MS_RA_capability_value == 1);
bitvec_free(bv_dec);
}
/* Reproduce crash from ticket OS#4463 */
static void testRAcap2(void *test_ctx)
{
printf("*** %s ***\n", __func__);
MS_Radio_Access_capability_t data;
memset(&data, 0, sizeof(data));
bitvec *bv_dec = bitvec_alloc(23, test_ctx);
int rc;
/*
MS Radio Access Capability
Element ID: 0x13
1... .... = ext: 1
Length: 23
------------------------------------------- Hex bitstream starts here:
MS RA capability 1
0001 .... = Access Technology Type: GSM E --note that GSM E covers GSM P (1)
.... 1001 001. .... = Length in bits: 0x49 (73)
...1 00.. RF Power Capability, GMSK Power Class: 2 W (33 dBm) (4)
A5 Bits: A5 bits follow (1)
A5/1: encryption algorithm available (1)
A5/2: encryption algorithm not available (0)
A5/3: encryption algorithm available (1)
A5/4: encryption algorithm not available (0)
A5/5: encryption algorithm not available (0)
A5/6: encryption algorithm not available (0)
A5/7: encryption algorithm not available (0)
.... ..1. = Controlled early Classmark Sending: Implemented
.... ...1 = Pseudo Synchronisation: Present
0... .... = Voice Group Call Service: no VGCS capability or no notifications wanted
.0.. .... = Voice Broadcast Service: no VBS capability or no notifications wanted
..1. .... = Multislot capability struct: Present
HSCSD multislot class: Bits are not available (0)
.... 0111 = SMS_VALUE (Switch-Measure-Switch): 8/4 timeslot (~1154 microseconds) (7)
0001 .... = (SM_VALUE) Switch-Measure: 2/4 timeslot (~288 microseconds) (1)
ECSD multislot class: Bits are not available (0)
.... ...0 = Single Slot DTM: Not supported
1... .... = DTM EGPRS Multi Slot Class: Present
.... .011 00.. .... = GPRS multislot class: Max Rx-Slot/TDMA:4 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:5 Tta:2 Ttb:1 Tra:2 Trb:1 Type:1 (12)
..1. .... = GPRS Extended Dynamic Allocation Capability: Implemented
.... ..01 100. .... = EGPRS multislot class: Max Rx-Slot/TDMA:4 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:5 Tta:2 Ttb:1 Tra:2 Trb:1 Type:1 (12)
...1 .... = EGPRS Extended Dynamic Allocation Capability: Implemented
.... .11. = DTM GPRS Multi Slot Class: Multislot class 11 supported (3)
.11. .... = DTM EGPRS Multi Slot Class: Multislot class 11 supported (3)
...1 .... = 8PSK Power Capability Bits: Present
8PSK Power Capability: Power class E2 (2)
.... ..0. = COMPACT Interference Measurement Capability: Not Implemented
.... ...1 = Revision Level Indicator: The ME is Release '99 onwards
0... .... = UMTS FDD Radio Access Technology Capability: Not supported
.0.. .... = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported
..0. .... = CDMA 2000 Radio Access Technology Capability: Not supported
...0 .... = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported
.... 1... = GERAN Feature Package 1: Supported
Extended DTM EGPRS Multi Slot Class: Bits are not available (0)
.... ..0. = Modulation based multislot class support: Not supported
High Multislot Capability: Bits are not available (0)
0... .... = GERAN Iu mode: Not supported
GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 3 (3)
8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 3 (3)
.... .0.. = Multiple TBF Capability: Not supported
.... ..01 = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance - phase I supported (1)
1... .... = Extended RLC/MAC Control Message Segmentation Capability: Supported
.1.. .... = DTM Enhancements Capability: The mobile station supports enhanced DTM CS establishment and enhanced DTM CS release procedures
...0 .... = PS Handover Capability: Not supported
MS RA capability 2
.... .011 1... .... = Access Technology Type: GSM 850 (7)
.010 0010 = Length in bits: 0x22 (34)
100. .... RF Power Capability, GMSK Power Class: 2 W (33 dBm) (4)
A5 Bits: Same values apply for parameters as in the immediately preceding Access capabilities field within this IE (0)
.... 1... = Controlled early Classmark Sending: Implemented
.... .1.. = Pseudo Synchronisation: Present
.... ..0. = Voice Group Call Service: no VGCS capability or no notifications wanted
.... ...0 = Voice Broadcast Service: no VBS capability or no notifications wanted
0... .... = Multislot capability struct: Not Present
.1.. .... = 8PSK Power Capability Bits: Present
8PSK Power Capability: Power class E2 (2)
.... 0... = COMPACT Interference Measurement Capability: Not Implemented
.... .1.. = Revision Level Indicator: The ME is Release '99 onwards
.... ..0. = UMTS FDD Radio Access Technology Capability: Not supported
.... ...0 = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported
0... .... = CDMA 2000 Radio Access Technology Capability: Not supported
.0.. .... = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported
..1. .... = GERAN Feature Package 1: Supported
Extended DTM EGPRS Multi Slot Class: Bits are not available (0)
.... 0... = Modulation based multislot class support: Not supported
High Multislot Capability: Bits are not available (0)
.... ..0. = GERAN Iu mode: Not supported
GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 3 (3)
8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 3 (3)
...0 .... = Multiple TBF Capability: Not supported
.... 01.. = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance - phase I supported (1)
.... ..1. = Extended RLC/MAC Control Message Segmentation Capability: Supported
.... ...1 = DTM Enhancements Capability: The mobile station supports enhanced DTM CS establishment and enhanced DTM CS release procedures
.0.. .... = PS Handover Capability: Not supported
MS RA capability 3
...0 011. = Access Technology Type: GSM 1800 (3)
.... ...0 1000 10.. = Length in bits: 0x22 (34)
.... ..00 1... .... RF Power Capability, GMSK Power Class: 1 W (30 dBm) (1)
A5 Bits: Same values apply for parameters as in the immediately preceding Access capabilities field within this IE (0)
..1. .... = Controlled early Classmark Sending: Implemented
...1 .... = Pseudo Synchronisation: Present
.... 0... = Voice Group Call Service: no VGCS capability or no notifications wanted
.... .0.. = Voice Broadcast Service: no VBS capability or no notifications wanted
.... ..0. = Multislot capability struct: Not Present
.... ...1 = 8PSK Power Capability Bits: Present
8PSK Power Capability: Power class E2 (2)
..0. .... = COMPACT Interference Measurement Capability: Not Implemented
...1 .... = Revision Level Indicator: The ME is Release '99 onwards
.... 0... = UMTS FDD Radio Access Technology Capability: Not supported
.... .0.. = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported
.... ..0. = CDMA 2000 Radio Access Technology Capability: Not supported
.... ...0 = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported
1... .... = GERAN Feature Package 1: Supported
Extended DTM EGPRS Multi Slot Class: Bits are not available (0)
..0. .... = Modulation based multislot class support: Not supported
High Multislot Capability: Bits are not available (0)
.... 0... = GERAN Iu mode: Not supported
GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 3 (3)
8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 3 (3)
.0.. .... = Multiple TBF Capability: Not supported
..01 .... = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance - phase I supported (1)
.... 1... = Extended RLC/MAC Control Message Segmentation Capability: Supported
.... .1.. = DTM Enhancements Capability: The mobile station supports enhanced DTM CS establishment and enhanced DTM CS release procedures
.... ...0 = PS Handover Capability: Not supported
*/
bitvec_unhex(bv_dec, "1933432b37159ef90879cba28c6421e72688b190879c00");
printf("=== Test decoding of multi-band MS RA Capability ===\n");
rc = decode_gsm_ra_cap(bv_dec, &data);
printf("decode_gsm_ra_cap() returns %d\n", rc);
OSMO_ASSERT(rc == 0);
/* Make sure there's 3 values */
OSMO_ASSERT(data.Count_MS_RA_capability_value == 3);
/* Make sure GPRS / EGPRS multislot class is parsed correctly */
printf("GPRS multislot class = %u\n", get_ms_class_by_capability(&data));
printf("EGPRS multislot class = %u\n", get_egprs_ms_class_by_capability(&data));
bitvec_free(bv_dec);
}
/* RAcap larger than 23 bytes */
static void testRAcap3(void *test_ctx)
{
printf("*** %s ***\n", __func__);
MS_Radio_Access_capability_t data;
memset(&data, 0, sizeof(data));
bitvec *bv_dec = bitvec_alloc(31, test_ctx);
int rc;
/*
MS Radio Access Capability
Element ID: 0x13
1... .... = ext: 1
Length: 31
------------------------------------------- Hex bitstream starts here:
MS RA capability 1
0001 .... = Access Technology Type: GSM E --note that GSM E covers GSM P (1)
.... 1010 111. .... = Length in bits: 0x57 (87)
...1 00.. RF Power Capability, GMSK Power Class: 2 W (33 dBm) (4)
A5 Bits: A5 bits follow (1)
A5/1: encryption algorithm available (1)
A5/2: encryption algorithm not available (0)
A5/3: encryption algorithm available (1)
A5/4: encryption algorithm not available (0)
A5/5: encryption algorithm not available (0)
A5/6: encryption algorithm not available (0)
A5/7: encryption algorithm not available (0)
.... ..1. = Controlled early Classmark Sending: Implemented
.... ...1 = Pseudo Synchronisation: Present
0... .... = Voice Group Call Service: no VGCS capability or no notifications wanted
.0.. .... = Voice Broadcast Service: no VBS capability or no notifications wanted
..1. .... = Multislot capability struct: Present
HSCSD multislot class: Bits are not available (0)
SMS_VALUE (Switch-Measure-Switch): Bits are not available (0)
ECSD multislot class: Bits are not available (0)
DTM GPRS Multi Slot Class: Bits are not available (0)
.... .011 00.. .... = GPRS multislot class: Max Rx-Slot/TDMA:4 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:5 Tta:2 Ttb:1 Tra:2 Trb:1 Type:1 (12)
..1. .... = GPRS Extended Dynamic Allocation Capability: Implemented
.... ..01 100. .... = EGPRS multislot class: Max Rx-Slot/TDMA:4 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:5 Tta:2 Ttb:1 Tra:2 Trb:1 Type:1 (12)
...1 .... = EGPRS Extended Dynamic Allocation Capability: Implemented
.... .1.. = 8PSK Power Capability Bits: Present
8PSK Power Capability: Power class E2 (2)
0... .... = COMPACT Interference Measurement Capability: Not Implemented
.1.. .... = Revision Level Indicator: The ME is Release '99 onwards
..0. .... = UMTS FDD Radio Access Technology Capability: Not supported
...0 .... = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported
.... 0... = CDMA 2000 Radio Access Technology Capability: Not supported
.... .0.. = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported
.... ..1. = GERAN Feature Package 1: Supported
Extended DTM EGPRS Multi Slot Class: Bits are not available (0)
0... .... = Modulation based multislot class support: Not supported
High Multislot Capability: 0x00 (0) - This field effect all other multislot fields. To understand the value please read TS 24.008 5.6.0 Release 5 Chap 10.5.5.12 Page 406
.... 0... = GERAN Iu mode: Not supported
GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 0 (0)
8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 0 (0)
.0.. .... = Multiple TBF Capability: Not supported
..01 .... = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance - phase I supported (1)
.... 0... = Extended RLC/MAC Control Message Segmentation Capability: Not supported
.... .0.. = DTM Enhancements Capability: The mobile station does not support enhanced DTM CS establishment and enhanced DTM CS release procedures
.... ...0 = PS Handover Capability: Not supported
0... .... = DTM Handover Capability: Not supported
..0. .... = Flexible Timeslot Assignment: Not supported
...0 .... = GAN PS Handover Capability: Not supported
.... 0... = RLC Non-persistent Mode: Not supported
.... .0.. = Reduced Latency Capability: Not supported
.... ..00 = Uplink EGPRS2: The mobile station does not support either EGPRS2-A or EGPRS2-B in the uplink (0)
00.. .... = Downlink EGPRS2: The mobile station does not support either EGPRS2-A or EGPRS2-B in the downlink (0)
..0. .... = E-UTRA FDD support: Not supported
...0 .... = E-UTRA TDD support: Not supported
.... 00.. = GERAN to E-UTRA support in GERAN packet transfer mode: None (0)
.... ..0. = Priority-based reselection support: Not supported
0... .... = Indication of Upper Layer PDU Start Capability for RLC UM: Not supported
.0.. .... = Enhanced Multiplexing for Single TBF Capability: Not supported
..0. .... = Multiple TTI Capability: Not supported
...0 .... = Reporting of UTRAN CSG cells in packet transfer mode: Not supported
.... 0... = Reporting of E-UTRAN CSG cells in packet transfer mode: Not supported
.... .0.. = Dynamic Timeslot Reduction Capability: Not supported
.... ..0. = Enhanced Multiplexing for Single RLC Entity Capability: Not supported
.... ...0 = Fast Downlink Frequency Switching Capability: Not supported
01.. .... = TIGHTER Capability: TIGHTER supported for speech and signalling channels only (1)
MS RA capability 2
...0 111. = Access Technology Type: GSM 850 (7)
.... ...0 1111 10.. = Length in bits: 0x3e (62)
.... ..10 0... .... RF Power Capability, GMSK Power Class: 2 W (33 dBm) (4)
A5 Bits: Same values apply for parameters as in the immediately preceding Access capabilities field within this IE (0)
..1. .... = Controlled early Classmark Sending: Implemented
...1 .... = Pseudo Synchronisation: Present
.... 0... = Voice Group Call Service: no VGCS capability or no notifications wanted
.... .0.. = Voice Broadcast Service: no VBS capability or no notifications wanted
.... ..0. = Multislot capability struct: Not Present
.... ...1 = 8PSK Power Capability Bits: Present
8PSK Power Capability: Power class E2 (2)
..0. .... = COMPACT Interference Measurement Capability: Not Implemented
...1 .... = Revision Level Indicator: The ME is Release '99 onwards
.... 0... = UMTS FDD Radio Access Technology Capability: Not supported
.... .0.. = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported
.... ..0. = CDMA 2000 Radio Access Technology Capability: Not supported
.... ...0 = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported
1... .... = GERAN Feature Package 1: Supported
Extended DTM EGPRS Multi Slot Class: Bits are not available (0)
..0. .... = Modulation based multislot class support: Not supported
High Multislot Capability: 0x00 (0) - This field effect all other multislot fields. To understand the value please read TS 24.008 5.6.0 Release 5 Chap 10.5.5.12 Page 406
.... ..0. = GERAN Iu mode: Not supported
GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 0 (0)
8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 0 (0)
...0 .... = Multiple TBF Capability: Not supported
.... 01.. = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance - phase I supported (1)
.... ..0. = Extended RLC/MAC Control Message Segmentation Capability: Not supported
.... ...0 = DTM Enhancements Capability: The mobile station does not support enhanced DTM CS establishment and enhanced DTM CS release procedures
.0.. .... = PS Handover Capability: Not supported
..0. .... = DTM Handover Capability: Not supported
.... 0... = Flexible Timeslot Assignment: Not supported
.... .0.. = GAN PS Handover Capability: Not supported
.... ..0. = RLC Non-persistent Mode: Not supported
.... ...0 = Reduced Latency Capability: Not supported
00.. .... = Uplink EGPRS2: The mobile station does not support either EGPRS2-A or EGPRS2-B in the uplink (0)
..00 .... = Downlink EGPRS2: The mobile station does not support either EGPRS2-A or EGPRS2-B in the downlink (0)
.... 0... = E-UTRA FDD support: Not supported
.... .0.. = E-UTRA TDD support: Not supported
.... ..00 = GERAN to E-UTRA support in GERAN packet transfer mode: None (0)
0... .... = Priority-based reselection support: Not supported
..0. .... = Indication of Upper Layer PDU Start Capability for RLC UM: Not supported
...0 .... = Enhanced Multiplexing for Single TBF Capability: Not supported
.... 0... = Multiple TTI Capability: Not supported
.... .0.. = Reporting of UTRAN CSG cells in packet transfer mode: Not supported
.... ..0. = Reporting of E-UTRAN CSG cells in packet transfer mode: Not supported
.... ...0 = Dynamic Timeslot Reduction Capability: Not supported
0... .... = Enhanced Multiplexing for Single RLC Entity Capability: Not supported
.0.. .... = Fast Downlink Frequency Switching Capability: Not supported
..01 .... = TIGHTER Capability: TIGHTER supported for speech and signalling channels only (1)
MS RA capability 3
.... .010 0... .... = Access Technology Type: GSM 1900 (4)
.011 1110 = Length in bits: 0x3e (62)
001. .... RF Power Capability, GMSK Power Class: 1 W (30 dBm) (1)
A5 Bits: Same values apply for parameters as in the immediately preceding Access capabilities field within this IE (0)
.... 1... = Controlled early Classmark Sending: Implemented
.... .1.. = Pseudo Synchronisation: Present
.... ..0. = Voice Group Call Service: no VGCS capability or no notifications wanted
.... ...0 = Voice Broadcast Service: no VBS capability or no notifications wanted
0... .... = Multislot capability struct: Not Present
.1.. .... = 8PSK Power Capability Bits: Present
8PSK Power Capability: Power class E2 (2)
.... 0... = COMPACT Interference Measurement Capability: Not Implemented
.... .1.. = Revision Level Indicator: The ME is Release '99 onwards
.... ..0. = UMTS FDD Radio Access Technology Capability: Not supported
.... ...0 = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported
0... .... = CDMA 2000 Radio Access Technology Capability: Not supported
.0.. .... = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported
..1. .... = GERAN Feature Package 1: Supported
Extended DTM EGPRS Multi Slot Class: Bits are not available (0)
.... 0... = Modulation based multislot class support: Not supported
High Multislot Capability: 0x00 (0) - This field effect all other multislot fields. To understand the value please read TS 24.008 5.6.0 Release 5 Chap 10.5.5.12 Page 406
0... .... = GERAN Iu mode: Not supported
GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 0 (0)
8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 0 (0)
.... .0.. = Multiple TBF Capability: Not supported
.... ..01 = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance - phase I supported (1)
0... .... = Extended RLC/MAC Control Message Segmentation Capability: Not supported
.0.. .... = DTM Enhancements Capability: The mobile station does not support enhanced DTM CS establishment and enhanced DTM CS release procedures
...0 .... = PS Handover Capability: Not supported
.... 0... = DTM Handover Capability: Not supported
.... ..0. = Flexible Timeslot Assignment: Not supported
.... ...0 = GAN PS Handover Capability: Not supported
0... .... = RLC Non-persistent Mode: Not supported
.0.. .... = Reduced Latency Capability: Not supported
..00 .... = Uplink EGPRS2: The mobile station does not support either EGPRS2-A or EGPRS2-B in the uplink (0)
.... 00.. = Downlink EGPRS2: The mobile station does not support either EGPRS2-A or EGPRS2-B in the downlink (0)
.... ..0. = E-UTRA FDD support: Not supported
.... ...0 = E-UTRA TDD support: Not supported
00.. .... = GERAN to E-UTRA support in GERAN packet transfer mode: None (0)
..0. .... = Priority-based reselection support: Not supported
.... 0... = Indication of Upper Layer PDU Start Capability for RLC UM: Not supported
.... .0.. = Enhanced Multiplexing for Single TBF Capability: Not supported
.... ..0. = Multiple TTI Capability: Not supported
.... ...0 = Reporting of UTRAN CSG cells in packet transfer mode: Not supported
0... .... = Reporting of E-UTRAN CSG cells in packet transfer mode: Not supported
.0.. .... = Dynamic Timeslot Reduction Capability: Not supported
..0. .... = Enhanced Multiplexing for Single RLC Entity Capability: Not supported
...0 .... = Fast Downlink Frequency Switching Capability: Not supported
.... 01.. = TIGHTER Capability: TIGHTER supported for speech and signalling channels only (1)
*/
bitvec_unhex(bv_dec, "1af3432b25964240100000006efa319090040000001a3e2c64240100000004");
printf("=== Test decoding of MS RA Capability 3===\n");
rc = decode_gsm_ra_cap(bv_dec, &data);
printf("decode_gsm_ra_cap() returns %d\n", rc);
OSMO_ASSERT(rc == 0);
/* Make sure there's 3 values */
OSMO_ASSERT(data.Count_MS_RA_capability_value == 3);
/* Make sure GPRS / EGPRS multislot class is parsed correctly */
printf("GPRS multislot class = %u\n", get_ms_class_by_capability(&data));
printf("EGPRS multislot class = %u\n", get_egprs_ms_class_by_capability(&data));
bitvec_free(bv_dec);
}
/* RAcap larger than 23 bytes */
static void testRAcap4(void *test_ctx)
{
printf("*** %s ***\n", __func__);
MS_Radio_Access_capability_t data;
memset(&data, 0, sizeof(data));
bitvec *bv_dec = bitvec_alloc(22, test_ctx);
int rc;
/*
MS Radio Access Capability
Element ID: 0x13
1... .... = ext: 1
Length: 22
------------------------------------------- Hex bitstream starts here:
MS RA capability 1
0001 .... = Access Technology Type: GSM E --note that GSM E covers GSM P (1)
.... 0111 101. .... = Length in bits: 0x3d (61)
...1 00.. RF Power Capability, GMSK Power Class: 2 W (33 dBm) (4)
A5 Bits: A5 bits follow (1)
A5/1: encryption algorithm available (1)
A5/2: encryption algorithm not available (0)
A5/3: encryption algorithm available (1)
A5/4: encryption algorithm not available (0)
A5/5: encryption algorithm not available (0)
A5/6: encryption algorithm not available (0)
A5/7: encryption algorithm not available (0)
.... ..1. = Controlled early Classmark Sending: Implemented
.... ...1 = Pseudo Synchronisation: Present
0... .... = Voice Group Call Service: no VGCS capability or no notifications wanted
.0.. .... = Voice Broadcast Service: no VBS capability or no notifications wanted
..1. .... = Multislot capability struct: Present
HSCSD multislot class: Bits are not available (0)
SMS_VALUE (Switch-Measure-Switch): Bits are not available (0)
ECSD multislot class: Bits are not available (0)
DTM GPRS Multi Slot Class: Bits are not available (0)
.... .011 00.. .... = GPRS multislot class: Max Rx-Slot/TDMA:4 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:5 Tta:2 Ttb:1 Tra:2 Trb:1 Type:1 (12)
..1. .... = GPRS Extended Dynamic Allocation Capability: Implemented
.... ..01 100. .... = EGPRS multislot class: Max Rx-Slot/TDMA:4 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:5 Tta:2 Ttb:1 Tra:2 Trb:1 Type:1 (12)
...1 .... = EGPRS Extended Dynamic Allocation Capability: Implemented
.... .1.. = 8PSK Power Capability Bits: Present
8PSK Power Capability: Power class E2 (2)
0... .... = COMPACT Interference Measurement Capability: Not Implemented
.1.. .... = Revision Level Indicator: The ME is Release '99 onwards
..1. .... = UMTS FDD Radio Access Technology Capability: Supported
...0 .... = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported
.... 0... = CDMA 2000 Radio Access Technology Capability: Not supported
.... .0.. = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported
.... ..1. = GERAN Feature Package 1: Supported
Extended DTM EGPRS Multi Slot Class: Bits are not available (0)
0... .... = Modulation based multislot class support: Not supported
High Multislot Capability: Bits are not available (0)
..0. .... = GERAN Iu mode: Not supported
GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 0 (0)
8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 0 (0)
.... ...0 = Multiple TBF Capability: Not supported
00.. .... = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance not supported (0)
..0. .... = Extended RLC/MAC Control Message Segmentation Capability: Not supported
...0 .... = DTM Enhancements Capability: The mobile station does not support enhanced DTM CS establishment and enhanced DTM CS release procedures
.... .0.. = PS Handover Capability: Not supported
.... ..0. = DTM Handover Capability: Not supported
MS RA capability 2
.001 1... = Access Technology Type: GSM 1800 (3)
.... .010 0100 .... = Length in bits: 0x24 (36)
.... 001. RF Power Capability, GMSK Power Class: 1 W (30 dBm) (1)
A5 Bits: Same values apply for parameters as in the immediately preceding Access capabilities field within this IE (0)
1... .... = Controlled early Classmark Sending: Implemented
.1.. .... = Pseudo Synchronisation: Present
..0. .... = Voice Group Call Service: no VGCS capability or no notifications wanted
...0 .... = Voice Broadcast Service: no VBS capability or no notifications wanted
.... 0... = Multislot capability struct: Not Present
.... .1.. = 8PSK Power Capability Bits: Present
8PSK Power Capability: Power class E2 (2)
0... .... = COMPACT Interference Measurement Capability: Not Implemented
.1.. .... = Revision Level Indicator: The ME is Release '99 onwards
..1. .... = UMTS FDD Radio Access Technology Capability: Supported
...0 .... = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported
.... 0... = CDMA 2000 Radio Access Technology Capability: Not supported
.... .0.. = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported
.... ..1. = GERAN Feature Package 1: Supported
Extended DTM EGPRS Multi Slot Class: Bits are not available (0)
0... .... = Modulation based multislot class support: Not supported
High Multislot Capability: Bits are not available (0)
..0. .... = GERAN Iu mode: Not supported
GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 0 (0)
8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 0 (0)
.... ...0 = Multiple TBF Capability: Not supported
00.. .... = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance not supported (0)
..0. .... = Extended RLC/MAC Control Message Segmentation Capability: Not supported
...0 .... = DTM Enhancements Capability: The mobile station does not support enhanced DTM CS establishment and enhanced DTM CS release procedures
.... .0.. = PS Handover Capability: Not supported
.... ..0. = DTM Handover Capability: Not supported
MS RA capability 3
.011 1... = Access Technology Type: GSM 850 (7)
.... .010 0100 .... = Length in bits: 0x24 (36)
.... 100. RF Power Capability, GMSK Power Class: 2 W (33 dBm) (4)
A5 Bits: Same values apply for parameters as in the immediately preceding Access capabilities field within this IE (0)
1... .... = Controlled early Classmark Sending: Implemented
.1.. .... = Pseudo Synchronisation: Present
..0. .... = Voice Group Call Service: no VGCS capability or no notifications wanted
...0 .... = Voice Broadcast Service: no VBS capability or no notifications wanted
.... 0... = Multislot capability struct: Not Present
.... .1.. = 8PSK Power Capability Bits: Present
8PSK Power Capability: Power class E2 (2)
0... .... = COMPACT Interference Measurement Capability: Not Implemented
.1.. .... = Revision Level Indicator: The ME is Release '99 onwards
..1. .... = UMTS FDD Radio Access Technology Capability: Supported
...0 .... = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported
.... 0... = CDMA 2000 Radio Access Technology Capability: Not supported
.... .0.. = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported
.... ..1. = GERAN Feature Package 1: Supported
Extended DTM EGPRS Multi Slot Class: Bits are not available (0)
0... .... = Modulation based multislot class support: Not supported
High Multislot Capability: Bits are not available (0)
..0. .... = GERAN Iu mode: Not supported
GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 0 (0)
8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 0 (0)
.... ...0 = Multiple TBF Capability: Not supported
00.. .... = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance not supported (0)
..0. .... = Extended RLC/MAC Control Message Segmentation Capability: Not supported
...0 .... = DTM Enhancements Capability: The mobile station does not support enhanced DTM CS establishment and enhanced DTM CS release procedures
.... .0.. = PS Handover Capability: Not supported
.... ..0. = DTM Handover Capability: Not supported
*/
bitvec_unhex(bv_dec, "17b3432b25966200019a42c6620001ba48c662000100");
printf("=== Test decoding of MS RA Capability 4===\n");
rc = decode_gsm_ra_cap(bv_dec, &data);
printf("decode_gsm_ra_cap() returns %d\n", rc);
OSMO_ASSERT(rc == 0);
/* Make sure there's 3 values */
OSMO_ASSERT(data.Count_MS_RA_capability_value == 3);
/* Make sure GPRS / EGPRS multislot class is parsed correctly */
printf("GPRS multislot class = %u\n", get_ms_class_by_capability(&data));
printf("EGPRS multislot class = %u\n", get_egprs_ms_class_by_capability(&data));
bitvec_free(bv_dec);
}
static void testEGPRSPktChReq(void *test_ctx)
{
EGPRS_PacketChannelRequest_t req;
int rc;
printf("*** %s ***\n", __func__);
static const uint16_t EGPRSPktChReqs[] = {
/* < One Phase Access Request : '0'B
< MultislotClass : '10101'B >
< Priority : '10'B >
< RandomBits : '101'B > > */
0x2b5,
/* < One Phase Access Request : '0'B
< MultislotClass : '01010'B >
< Priority : '01'B >
< RandomBits : '010'B > > */
0x14a,
/* < Short Access Request : '100'B
< NumberOfBlocks : '001'B >
< Priority : '01'B >
< RandomBits : '000'B > > */
0x428,
/* < Two Phase Access Request : '110000'B
< Priority : '00'B >
< RandomBits : '000'B > > */
0x600,
/* < Two Phase Access Request : '110000'B
< Priority : '11'B >
< RandomBits : '111'B > > */
0x61f,
/* < Signalling : '110011'B
< RandomBits : '10101'B > > */
0x675,
/* < Signalling : '110011'B
< RandomBits : '10001'B > > */
0x671,
/* < Emergency call : '110111'B
< RandomBits : '11001'B > > */
0x6f9,
/* < Unknown (test) : '111111'B
< RandomBits : '01010'B > > */
0x7ea,
};
for (size_t i = 0; i < ARRAY_SIZE(EGPRSPktChReqs); i++) {
rc = decode_egprs_pkt_ch_req(EGPRSPktChReqs[i], &req);
printf("decode_egprs_pkt_ch_req(0x%03x) returns %d\n", EGPRSPktChReqs[i], rc);
if (rc == 0)
printf(" ==> %s\n", get_value_string(egprs_pkt_ch_req_type_names, req.Type));
}
}
int main(int argc, char *argv[])
{
void *ctx = talloc_named_const(NULL, 1, "RLCMACTest");
osmo_init_logging2(ctx, &gprs_log_info);
log_parse_category_mask(osmo_stderr_target, "DPCU,3:DLGLOBAL,1:DRLCMACDATA,2:DCSN1,1:");
log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_NONE);
log_set_print_category_hex(osmo_stderr_target, 0);
log_set_print_category(osmo_stderr_target, 1);
log_set_print_level(osmo_stderr_target, 1);
log_set_use_color(osmo_stderr_target, 0);
testRlcMacDownlink(ctx);
testRlcMacUplink(ctx);
testCsnLeftAlignedVarBmpBounds(ctx);
testRAcap(ctx);
testMalformedRAcap(ctx);
testRAcap2(ctx);
testRAcap3(ctx);
testEGPRSPktChReq(ctx);
testRAcap4(ctx);
talloc_free(ctx);
}

File diff suppressed because one or more lines are too long

View File

@ -1,219 +0,0 @@
*** testRlcMacDownlink ***
DOWNLINK
vector1 = 4e082500e3f1a81d080820800b2b2b2b2b2b2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 4e 08 25 00 e3 f1 a8 1d 08 08 20 80 0b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector2 = 4e 08 25 00 e3 f1 a8 1d 08 08 20 80 0b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector1 == vector2 : TRUE
vector1 = 48282407a6a07422720100032b2b2b2b2b2b2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 48 28 24 07 a6 a0 74 22 72 01 00 03 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector2 = 48 28 24 07 a6 a0 74 22 72 01 00 03 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector1 == vector2 : TRUE
vector1 = 47240c00400000000000000079eb2ac9402b2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 47 24 0c 00 40 00 00 00 00 00 00 00 79 eb 2a c9 40 2b 2b 2b 2b 2b 2b
vector2 = 47 24 0c 00 40 00 00 00 00 00 00 00 79 eb 2a c9 40 2b 2b 2b 2b 2b 2b
vector1 == vector2 : TRUE
vector1 = 47283c367513ba333004242b2b2b2b2b2b2b2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 47 28 3c 36 75 13 ba 33 30 04 24 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector2 = 47 28 3c 36 75 13 ba 33 30 04 24 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector1 == vector2 : TRUE
vector1 = 400820001a3904df0680efb3300b2b2b2b2b2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 40 08 20 00 1a 39 04 df 06 80 ef b3 30 0b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector2 = 40 08 20 00 1a 39 04 df 06 80 ef b3 30 0b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector1 == vector2 : TRUE
vector1 = 40284f0000001009810c826f4406809dcecb2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 40 28 4f 00 00 00 10 09 81 0c 82 6f 44 06 80 9d ce cb 2b 2b 2b 2b 2b
vector2 = 40 28 4f 00 00 00 10 09 81 0c 82 6f 44 06 80 9d ce cb 2b 2b 2b 2b 2b
vector1 == vector2 : TRUE
vector1 = 4024030f2f0000000087b0042b2b2b2b2b2b2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 40 24 03 0f 2f 00 00 00 00 87 b0 04 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector2 = 40 24 03 0f 2f 00 00 00 00 87 b0 04 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector1 == vector2 : TRUE
vector1 = 4913e00850884013a8048b2b2b2b2b2b2b2b2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (-8)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 49 13 e0 08 50 88 40 13 a8 04 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector2 = 49 13 00 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector1 == vector2 : FALSE
vector1 = 412430007fffffffffffffffefd19c7ba12b2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 41 24 30 00 7f ff ff ff ff ff ff ff ef d1 9c 7b a1 2b 2b 2b 2b 2b 2b
vector2 = 41 24 30 00 7f ff ff ff ff ff ff ff ef d1 9c 7b a1 2b 2b 2b 2b 2b 2b
vector1 == vector2 : TRUE
vector1 = 41942b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 41 94 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector2 = 41 94 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector1 == vector2 : TRUE
vector1 = 40883c1493120000000012002b2b2b2b2b2b2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 40 88 3c 14 93 12 00 00 00 00 12 00 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector2 = 40 88 3c 14 93 12 00 00 00 00 12 01 95 95 95 95 95 95 95 95 95 95 95
vector1 == vector2 : FALSE
*** testRlcMacUplink ***
UPLINK
vector1 = 400e1e61d11d2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 40 0e 1e 61 d1 1d 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector2 = 40 0e 1e 61 d1 1d 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector1 == vector2 : TRUE
vector1 = 400b8020000000000000002480e0032b2b2b2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 40 0b 80 20 00 00 00 00 00 00 00 24 80 e0 03 2b 2b 2b 2b 2b 2b 2b 2b
vector2 = 40 0b 80 20 00 00 00 00 00 00 00 24 80 e0 03 2b 2b 2b 2b 2b 2b 2b 2b
vector1 == vector2 : TRUE
vector1 = 4016713dc094270ca2ae57ef909006aa0fc0001f80222b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (-5)+++++++++++
vector1 = 40 16 71 3d c0 94 27 0c a2 ae 57 ef 90 90 06 aa 0f c0 00 1f 80 22 2b
vector2 = 40 16 71 3d c0 94 27 48 a2 ae 57 ef 90 90 06 aa 00 00 1f 80 00 3f 00
vector1 == vector2 : FALSE
vector1 = 401673c87f24af2632b25964200600000091000b780080
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 40 16 73 c8 7f 24 af 26 32 b2 59 64 20 06 00 00 00 91 00 0b 78 00 80
vector2 = 40 16 73 c8 7f 24 af 0e 32 b2 59 64 20 06 00 00 24 40 02 de 00 20 2b
vector1 == vector2 : FALSE
vector1 = 40200ffc0021ec010b2b2b2b2b2b2b2b2b2b2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 40 20 0f fc 00 21 ec 01 0b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector2 = 40 20 0f fc 00 21 ec 01 0b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector1 == vector2 : TRUE
vector1 = 400a9020000000000000003010012a0800132b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 40 0a 90 20 00 00 00 00 00 00 00 30 10 01 2a 08 00 13 2b 2b 2b 2b 2b
vector2 = 40 0a 90 20 00 00 00 00 00 00 00 30 10 01 2a 08 00 13 2b 2b 2b 2b 2b
vector1 == vector2 : TRUE
vector1 = 4117ea1b903eaeb2686564b2330820078000102b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 41 17 ea 1b 90 3e ae b2 68 65 64 b2 33 08 20 07 80 00 10 2b 2b 2b 2b
vector2 = 41 17 ea 1b 90 3e af 22 68 65 64 b2 33 00 00 00 00 82 00 78 00 01 01
vector1 == vector2 : FALSE
vector1 = 40167e49f7f8ef2632b2596620060000806d00541c0080
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 40 16 7e 49 f7 f8 ef 26 32 b2 59 66 20 06 00 00 80 6d 00 54 1c 00 80
vector2 = 40 16 7e 49 f7 f8 ef 0e 32 b2 59 66 20 06 00 00 9b 40 15 07 00 20 2b
vector1 == vector2 : FALSE
vector1 = 4017787174d92eba686564b2ccc30800a000040b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 40 17 78 71 74 d9 2e ba 68 65 64 b2 cc c3 08 00 a0 00 04 0b 2b 2b 2b
vector2 = 40 17 78 71 74 d9 2f 2a 68 65 64 b2 cc c0 00 00 00 30 80 0a 00 00 40
vector1 == vector2 : FALSE
vector1 = 4017e5b2cd5a2eca68655e44aec84880139300412b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (-5)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (-5)+++++++++++
vector1 = 40 17 e5 b2 cd 5a 2e ca 68 65 5e 44 ae c8 48 80 13 93 00 41 2b 2b 2b
vector2 = 40 17 e5 b2 cd 5a 2f 4a 68 65 5e 44 ae c8 00 00 00 00 48 80 13 93 00
vector1 == vector2 : FALSE
*** testCsnLeftAlignedVarBmpBounds ***
*** testRAcap ***
=== Test decoding of MS RA Capability ===
GPRS multislot class = 3
EGPRS multislot class = 3
=== Test encoding of MS RA Capability ===
encode_gsm_ra_cap() returns 0
vector1 (len_ind=27) = 13 65 14 62 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
vector2 (len_ind=65) = 18 25 14 62 30 00 00 00 00 03 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
=== Test decoding of a malformed vector (short length indicator) ===
decode_gsm_ra_cap() returns -5
*** testMalformedRAcap ***
=== Test decoding of MS RA Capability ===
decode_gsm_ra_cap() returns 0
*** testRAcap2 ***
=== Test decoding of multi-band MS RA Capability ===
decode_gsm_ra_cap() returns 0
GPRS multislot class = 12
EGPRS multislot class = 12
*** testRAcap3 ***
=== Test decoding of MS RA Capability 3===
decode_gsm_ra_cap() returns 0
GPRS multislot class = 12
EGPRS multislot class = 12
*** testEGPRSPktChReq ***
decode_egprs_pkt_ch_req(0x2b5) returns 0
==> One Phase Access
decode_egprs_pkt_ch_req(0x14a) returns 0
==> One Phase Access
decode_egprs_pkt_ch_req(0x428) returns 0
==> Short Access
decode_egprs_pkt_ch_req(0x600) returns 0
==> Two Phase Access
decode_egprs_pkt_ch_req(0x61f) returns 0
==> Two Phase Access
decode_egprs_pkt_ch_req(0x675) returns 0
==> Signalling
decode_egprs_pkt_ch_req(0x671) returns 0
==> Signalling
decode_egprs_pkt_ch_req(0x6f9) returns 0
==> Emergency call
decode_egprs_pkt_ch_req(0x7ea) returns -8
*** testRAcap4 ***
=== Test decoding of MS RA Capability 4===
decode_gsm_ra_cap() returns 0
GPRS multislot class = 12
EGPRS multislot class = 12

View File

@ -680,7 +680,7 @@ static void send_ul_mac_block(struct gprs_rlcmac_bts *bts, unsigned trx_no, unsi
rlc_block = bitvec_alloc(23, tall_pcu_ctx);
OSMO_ASSERT(encode_gsm_rlcmac_uplink(rlc_block, ulreq) == 0);
OSMO_ASSERT(osmo_gprs_rlcmac_encode_uplink(rlc_block, ulreq) == 0);
num_bytes = bitvec_pack(rlc_block, &buf[0]);
OSMO_ASSERT(size_t(num_bytes) < sizeof(buf));
bitvec_free(rlc_block);
@ -2656,7 +2656,7 @@ static void test_tbf_epdan_out_of_rx_window(void)
bits.data_len = sizeof(bits_data);
bits.cur_bit = 0;
rc = decode_gsm_rlcmac_uplink(block, &ul_control_block);
rc = osmo_gprs_rlcmac_decode_uplink(block, &ul_control_block);
OSMO_ASSERT(rc == 0);
ack_nack = &ul_control_block.u.Egprs_Packet_Downlink_Ack_Nack;

View File

@ -2,13 +2,6 @@ AT_INIT
AT_BANNER([Regression tests])
AT_SETUP([rlcmac])
AT_KEYWORDS([rlcmac])
cat $abs_srcdir/rlcmac/RLCMACTest.ok > expout
cat $abs_srcdir/rlcmac/RLCMACTest.err > experr
AT_CHECK([$OSMO_QEMU $abs_top_builddir/tests/rlcmac/RLCMACTest], [0], [expout], [experr])
AT_CLEANUP
AT_SETUP([multi_slot])
AT_KEYWORDS([multi_slot])
cat $abs_srcdir/alloc/MslotTest.ok > expout