aboutsummaryrefslogtreecommitdiffstats
path: root/src/gsm_rlcmac.h
AgeCommit message (Collapse)AuthorFilesLines
2020-08-24gsm_rlcmac: use consistent naming for [Extended] Packet Timing AdvanceVadim Yanitskiy1-6/+6
Change-Id: I6382c81f7569b4c5a68521c04f6b03a34bfc39dd
2020-05-23RLC/MAC: implement decoding of EGPRS Packet Channel RequestVadim Yanitskiy1-0/+43
According to 3GPP TS 44.004, section 7.4a, two alternative RACH block formats are specified: 8 bit (1 octet) and 11 bit. This change adds CSN.1 definitions for 11 bit EGPRS Packet Channel Request as per 3GPP TS 44.060, table 11.2.5a.2. Change-Id: I96df3352856933c9140177b2801a2c71f4134183 Related: OS#1548
2020-05-23csn1: fix: never use enumerated types in codec structuresVadim Yanitskiy1-2/+2
I faced a problem while working on EGPRS Packet Channel Request coding support: the unit test I wrote for it was passing when compiled with AddressSanitizer, but failing when compiled without it o_O. Somehow this was observed only with GCC 10. Here is a part the standard output diff for that unit test: *** testEGPRSPktChReq *** decode_egprs_pkt_ch_req(0x2b5) returns 0 - ==> One Phase Access + ==> unknown 0xdd5f4e00 decode_egprs_pkt_ch_req(0x14a) returns 0 - ==> One Phase Access + ==> unknown 0xdd5f4e00 decode_egprs_pkt_ch_req(0x428) returns 0 - ==> Short Access + ==> unknown 0xdd5f4e01 At the same time, debug output of the CSN.1 decoder looked fine. So WYSINWYG (What You See Is *NOT* What You Get)! As it turned out, this was happening because I used an enumerated type to represent the sub-type of EGPRS Packet Channel Request. typedef struct { EGPRS_PacketChannelRequestType_t Type; // <-- enum EGPRS_PacketChannelRequestContent_t Content; } EGPRS_PacketChannelRequest_t; The problem is that length of an enumerated field, more precisely the amount of bytes it takes in the memory, is compiler/machine dependent. While the CSN.1 decoder assumes that the field holding sequential number of the chosen element is one octet long, so its address is getting casted to (guint8 *) and the value is written to the first MSB. // csnStreamDecoder(), case CSN_CHOICE: pui8 = pui8DATA(data, pDescr->offset); *pui8 = i; // [ --> xx .. .. .. ] Let's make sure that none of the existing RLC/MAC definitions is using enumerated types, and add a warning comment to CSN_CHOICE. Affected CSN.1 definitions (unit test output adjusted): - Additional_access_technologies_struct_t, - Channel_Request_Description_t. Change-Id: I917a40647480c6f6f3b0e68674ce9894379a9e7f
2020-03-30rlcmac: add dissection of 2G->3G/4G PS handoverPau Espin Pedrol1-0/+6
Port from wireshark.git 428ee66ae1c524b49f9043729b1f1e9b4f52f409, from Pascal Quantin. The original commit is also changing the RRC_Container field to M_CALLBACK, but we leave them as M_VAR_ARRAY since the callback is basically used to add more dissection information in wireshark. Change-Id: I0f374e78300efddff00c4df26a401adcdee18a12
2020-03-30Move gsm_rlcmac.cpp -> .cPau Espin Pedrol1-6/+2
Original file from wireshark.git (packet-gsm_csn1.c) is being built and maintained as a C file. There's no real need for us to maintain it as a C++, and doing so will make both files derive over time (as already happened). Let's keep it as a C compiler (which btw seems to be more strict) to make it easier to port patches back and forth wireshark.git. Take the chance to move some declarations we added to csn1.h to be able to build it out of wireshark. Let's keep those in a separate header file to ease looking for differences. Change-Id: I818a8ae947f002d35142f9f5473454cfd80e1830
2020-03-26gsm_rlcmac: Use 'struct bitvec' instead of 'bitvec'Pau Espin Pedrol1-7/+7
The later is only accepted when compiling as c++. Change-Id: Ib5004643d4eff3bc9d11b66ddaf262f1c0d2aef6
2020-03-25rlcmac: Rename field to MS RA Cap2 in Additional_MS_Rad_Access_Cap_tPau Espin Pedrol1-1/+1
This fix was spotted by wireshark.git developers while reviewing port of osmo-pcu commit e50ce6e45c4509805807d599cadf1a1b23d37f63. Related: https://code.wireshark.org/review/c/36574/ Fixes: e50ce6e45c4509805807d599cadf1a1b23d37f63 Change-Id: Ic5fc3252f61b6a042d9c3def7a6a32b311dd9d9e
2020-03-25cosmetic: rlcmac: Fix comment typo and whitespace introduced recentlyPau Espin Pedrol1-1/+2
Change-Id: Ie56898e11e2c9426393af0f6558d340c454fe6c4
2020-03-23rlcmac: Introduce MS Radio Access Capabilities 2 to fix related spare bitsPau Espin Pedrol1-2/+2
There's two variants for the Ms Radio Access Capabilities. * The usual encoding with spare bits (usually to fill up to octet boundary) as defined in TS 24.008 Table 10.5.146 And there's too: * MS Radio Access Capabilities 2 IE from TS44.060 section 12.30, which is the same but removing all spare bits, and which is used in messages like Packet Resource Request and Additional MS RAC messages. The later is used basically for messages having extra IEs after the MS Radio Access capabilities IE, since they are encoded immediatelly afterwards. So this patch does: * Adds the expected spare bits (M_PADDING) to MS_Radio_Access_capability_t * Creates a new MS_Radio_Access_capability2_t without padding * Updates code to use the new "2" version where needed. Note RLCMACTest long de/encoding line logs change only because the name of the struct changes (the "2" is added). Change-Id: Ibd756f80a03452a651e2771dbc628d701e55ac4b
2020-03-23rlcmac: Fix bug receiving RA capPau Espin Pedrol1-15/+6
It seems the assumptions regarding maximum number of RA capabilitites in one message were wrong. Doing some rough calculations, each RA capabilitiy value (without extensions) can take around 20ish bits, which means for a message containing up to 52 bytes that quite a lot of different values could be theoretically fed in. Let's be safe and increase the array size to be able to handle all different access technologies listed in See TS 24.008 table 10.5.146 following restrictions: * "The MS Radio Access capability is a type 4 information element, with a maximum length of 52 octets." * "Among the three Access Type Technologies GSM 900-P, GSM 900-E and GSM 900-R only one shall be present." * "the mobile station should provide the relevant radio access capability for either GSM 1800 band OR GSM 1900 band, not both". Wireshark requires similar fix (it's not important though because it currently uses another ad-hoc decoder for RAcap). Related: OS#4463 Change-Id: I5334eaacfbc238fae8bea50c9e9667c2117f81ff
2020-03-07gsm_rlcmac: improve dissection of MS RA Capability IEVincent Helfre1-1/+35
Port from wireshark.git de028e81c53f9c45ccc5adb3bffd2f16ae2017bf This commit breaks transcoding of the test vectors containing the MS RA Capability IE due to the reasons explained in [1]. The more fields we add, the longer gets the output of the CSN.1 encoder. This is not critical, since we never need to encode messages containing the MS RA Capability IE on practice. [1] Ibb4cbd3f5865415fd547e95fc24ff31df1aed4c0 Ported-by: Pau Espin Pedrol <pespin@sysmocom.de> Change-Id: Ibb4cbd3f5865415fd547e95fc24ff31df1aed4c0
2020-03-02gsm_rlcmac: fix Packet_Resource_Request_t: s/Slot/I_LEVEL_TN/Pau Espin Pedrol1-1/+1
This is how this field is named in Wireshark. Change-Id: I140443c48af8e4bb1b6279e6de986879b7d9c276
2020-02-17csn1: get rid of C++ specific code, compile with GCCVadim Yanitskiy1-0/+3
The implementation of CSN.1 codec was taken from Wireshark, where it's implemented in pure C. For some reason it was mixed with C++ specific features, mostly using references in parameter declaration. Not sure what are the benefits. Change-Id: I56d8b7fbd2f9f4e0bdd6b09d0366fe7eb7aa327a
2020-02-14gsm_rlcmac: Update : PACKET RESOURCE REQUEST to Release 14.0.0AndersBroman1-0/+145
Port from wireshark.git 07fc801684ebff7aff02505cdb2c120caea846e0. Ported-by: Pau Espin Pedrol <pespin@sysmocom.de> Change-Id: Iceb59c58406180bc57fe6eb27127b4d11a0a3df7
2020-02-05rlcmac: Return error code from csn1 encoder/decoderPau Espin Pedrol1-4/+4
Change-Id: I0c5e1b870608b0622b239791effd5c5878e230bc
2020-01-28gsm_rlcmac: add dissection of NAS containerVincent Helfre1-4/+9
Port from wireshark.git 575e4df4aa3392ffd09ca372859573f09f0a5c57 Ported-by: Pau Espin Pedrol <pespin@sysmocom.de> Change-Id: I2a05a057b6f441364502a96f9f34872c7e251a36
2020-01-28gsm_rlcmac: Enhance dissection of PSI1Pascal Quantin1-3/+10
Port of wireshark.git 7e9411fee3a101b53693210f7a38789fd4c70ba2. Ported-by: Pau Espin Pedrol <pespin@sysmocom.de> Change-Id: I89d488c1f349c556e40a9d13895b1309d5140212
2020-01-28gsm_rlcmac.h: Remove Uplink messages from the RlcMacDownlink_t structurePascal Quantin1-36/+16
(as they are part of the RlcMacUplink_t structure that is also used to call csnStreamDissector function). Port from wireshark.git commit 9f8b638cfa8a660fb64c54dcadb83e6747db0a15. Ported-by: Pau Espin Pedrol <pespin@sysmocom.de> Change-Id: If46f8cc3f21f527f911dcac6ff1b78f182104a00
2020-01-28gsm_rlcmac.h: Make sure we have a corresponding 'u' member to ↵Gerald Combs1-18/+28
RlcMacDownlink_t for every call Port from wireshark.git commit 6c32ba5ff1a5f5ec2426d1d2c4f4f37fd136bab0. Ported-by: Pau Espin Pedrol <pespin@sysmocom.de> Change-Id: I989befc56fa37b8f982301f4f9aa4f4533e3e87a
2020-01-28gsm_rlcmac.h: #if 0 unused stuffBill Meier1-86/+107
Port of wireshark.git 2ef0c615946cd290aa9463c637169da0a1ca7972. Ported-by: Pau Espin Pedrol <pespin@sysmocom.de> Change-Id: Ia2e80664d293a2a95372213b4164c3e72259e0bb
2020-01-28tests/rlcmac: Add test to showcase that decode_gsm_ra_cap() failsPau Espin Pedrol1-1/+1
Currently code using that function in osmo-pcu is disabled, allegadly because SGSN was sending incorrect values, but it looks more like a CSN1 issue. Related: OS#1525, OS#3499 Change-Id: I92c86397f988afaa791871d823a45fa85054f3bb
2019-07-17fix spelling errors detected by lintianThorsten Alteholz1-2/+2
Change-Id: I381618eb55cc513cfa9c2e384c27cead0935c8bf
2018-02-19Move include guard to the topMax1-2/+3
Having explicit include above the douible-include guard defines is potential source for hard to track bugs. Let's move it inside the guard statement. Change-Id: I5114a63ce00b03c8eed23565d52969250bd505cc Related: OS#1539
2016-02-08rlc: Add decode_gsm_ra_cap to decode Radio Access CapsJacob Erlbeck1-0/+1
This uses the CSN.1 decoder to fully parse the radio access capabilities as defined by TS 24.008, 10.5.5.12a. Sponsored-by: On-Waves ehf
2016-02-05edge: Workaround to fix decoding of EGPRS_AckNack_w_len_tJacob Erlbeck1-1/+1
The presence of the LENGTH field adds an additional offset which breaks the related M_SERIALIZE in gsm_rlcmac.cpp. In that case, the Desc in EGPRS_AckNack_t is being cast to EGPRS_AckNack_w_len_t and then ((EGPRS_AckNack_w_len_t *)Desc)->Desc is filled with the parsed data, which is a platform dependant number of bytes apart the real Desc struct. Remove LENGTH field from EGPRS_AckNack_w_len_t so that the Desc field is the first field. Note that this is not a real fix. The rlcmac wireshark dissector still has the same declaration but doesn't seem to suffer from this problem. Sponsored-by: On-Waves ehf
2012-10-10Ported fixes and improvements from Wireshark for RLC/MAC control block ↵Ivan Kluchnikov1-3/+12
decoding. Part 1. Generic improvements to the csn.1 dissector include: • Added a flag to the type descriptor structure so that any type can (potentially) flagged as xxx_OR_NULL. This was specifically needed for UINT_OR_NULL for the ms capabilities struct. • Changed the CSN_SERIALIZE so that the length of the length field can be specified. • For CSN_NEXT_EXIST removed the requirement that the next type be CSN_END, to allow truncation of multiple IEs. • For CSN_LEFT_ALIGNED_VAR_BITMAP corrected the handling of bit_offset. • Added a new type CSN_PADDING_BITS to make inspection of padding bits more convenient. • Improved the CSN_RECURSIVE_TARRAY_1 to show the array index. Improvements to the gsm_rlcmac dissector include: • Rework the definition of EGPRS Ack/Nack Description so that the length IE (and absence thereof) is handled correctly. • Added Padding Bits definitions to all PDUs • Change the Multislot_capability_t and Content_t definitions to allow truncation at any IE
2012-06-14move everything to src/ subdirectoryHarald Welte1-0/+5130
The code corresponds to commit a9aa4777cc1144897a77dfb6c5c3d7325705251e in openbts-p2.8.git (Tue Jun 12 18:14:49 2012 +0400)