lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

September 2022

  • 2 participants
  • 1860 discussions
Change in osmo-hlr[master]: Debian: bump compatibility level
by msuraev 18 Sep '22

18 Sep '22
Attention is currently required from: laforge, fixeria. msuraev has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hlr/+/29381 ) Change subject: Debian: bump compatibility level ...................................................................... Patch Set 3: (2 comments) File debian/not-installed: https://gerrit.osmocom.org/c/osmo-hlr/+/29381/comment/11586821_4477d769 PS1, Line 2: osmo-hlr-dgsm.cfg > Sorry for not stating this explicitly, but I believe this should have been done in a separate change […] Done File debian/osmo-hlr.install: https://gerrit.osmocom.org/c/osmo-hlr/+/29381/comment/6ac7543e_5a5b406d PS3, Line 9: usr/share/doc/osmo-hlr/examples/osmo-hlr-dgsm.cfg usr/share/doc/osmo-hlr/examples > For consistency with the other entries, please: […] Done -- To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/29381 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Change-Id: Id1557cd07b5d28dbb6018cbf972ce41008b65867 Gerrit-Change-Number: 29381 Gerrit-PatchSet: 3 Gerrit-Owner: msuraev <msuraev(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Sun, 18 Sep 2022 13:26:10 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: laforge <laforge(a)osmocom.org> Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de> Comment-In-Reply-To: msuraev <msuraev(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
Change in osmo-hlr[master]: Debian: bump compatibility level
by msuraev 18 Sep '22

18 Sep '22
Attention is currently required from: laforge, msuraev. Hello Jenkins Builder, fixeria, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-hlr/+/29381 to look at the new patch set (#5). Change subject: Debian: bump compatibility level ...................................................................... Debian: bump compatibility level See https://manpages.debian.org/bullseye/debhelper/debhelper.7.en.html for exact changes between versions Related: OS#4107 Change-Id: Id1557cd07b5d28dbb6018cbf972ce41008b65867 --- M .gitignore M debian/compat A debian/not-installed 3 files changed, 4 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/81/29381/5 -- To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/29381 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Change-Id: Id1557cd07b5d28dbb6018cbf972ce41008b65867 Gerrit-Change-Number: 29381 Gerrit-PatchSet: 5 Gerrit-Owner: msuraev <msuraev(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: msuraev <msuraev(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
Change in osmo-hlr[master]: Debian: bump compatibility level
by fixeria 18 Sep '22

18 Sep '22
Attention is currently required from: laforge, msuraev. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hlr/+/29381 ) Change subject: Debian: bump compatibility level ...................................................................... Patch Set 4: Code-Review+2 (2 comments) File debian/not-installed: https://gerrit.osmocom.org/c/osmo-hlr/+/29381/comment/2413afd1_79563a56 PS1, Line 2: osmo-hlr-dgsm.cfg > Sorry for not stating this explicitly, but I believe this should have been done in a separate change […] Done, see https://gerrit.osmocom.org/c/osmo-hlr/+/29391. File debian/osmo-hlr.install: https://gerrit.osmocom.org/c/osmo-hlr/+/29381/comment/769eece9_6952965a PS3, Line 9: usr/share/doc/osmo-hlr/examples/osmo-hlr-dgsm.cfg usr/share/doc/osmo-hlr/examples > For consistency with the other entries, please: […] Done, thanks! -- To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/29381 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Change-Id: Id1557cd07b5d28dbb6018cbf972ce41008b65867 Gerrit-Change-Number: 29381 Gerrit-PatchSet: 4 Gerrit-Owner: msuraev <msuraev(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: msuraev <msuraev(a)sysmocom.de> Gerrit-Comment-Date: Sun, 18 Sep 2022 13:21:51 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Comment-In-Reply-To: laforge <laforge(a)osmocom.org> Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de> Comment-In-Reply-To: msuraev <msuraev(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
Change in libosmo-gprs[master]: llc: implement LLC PDU codec based on code from osmo-sgsn.git
by Jenkins Builder 18 Sep '22

18 Sep '22
Jenkins Builder has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/29402 ) Change subject: llc: implement LLC PDU codec based on code from osmo-sgsn.git ...................................................................... Patch Set 1: (3 comments) File include/osmocom/gprs/llc/llc.h: Robot Comment from checkpatch (run ID jenkins-gerrit-libosmo-gprs-lint-39): https://gerrit.osmocom.org/c/libosmo-gprs/+/29402/comment/463ef40d_f375ef55 PS1, Line 135: #define OSMO_GPRS_LLC_PDU_F_ACK_REQ (1 << 2) /* 6.3.5.2 Acknowledgement request bit (A) */ 'Acknowledgement' may be misspelled - perhaps 'Acknowledgment'? File src/llc/llc_pdu.c: Robot Comment from checkpatch (run ID jenkins-gerrit-libosmo-gprs-lint-39): https://gerrit.osmocom.org/c/libosmo-gprs/+/29402/comment/3cb32e07_fd1188e4 PS1, Line 277: #define check_len(len, text) \ Macros with flow control statements should be avoided File tests/llc_pdu_codec/pdu_codec_test.c: Robot Comment from checkpatch (run ID jenkins-gerrit-libosmo-gprs-lint-39): https://gerrit.osmocom.org/c/libosmo-gprs/+/29402/comment/d82258a0_8c32cbc7 PS1, Line 31: static const char *testData[] = { static const char * array should probably be static const char * const -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/29402 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: I61d7e2e6d0a8f2cdfc2113e637e447dc428cc70d Gerrit-Change-Number: 29402 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-CC: Jenkins Builder Gerrit-Comment-Date: Sun, 18 Sep 2022 13:21:48 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
Change in libosmo-gprs[master]: llc: ensure all symbols have 'osmo_gprs_llc_' prefix
by Jenkins Builder 18 Sep '22

18 Sep '22
Jenkins Builder has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/29394 ) Change subject: llc: ensure all symbols have 'osmo_gprs_llc_' prefix ...................................................................... Patch Set 1: (1 comment) File include/osmocom/gprs/llc/llc.h: Robot Comment from checkpatch (run ID jenkins-gerrit-libosmo-gprs-lint-31): https://gerrit.osmocom.org/c/libosmo-gprs/+/29394/comment/2518e57a_a0f7cd9c PS1, Line 77: OSMO_GPRS_LLC_LLES_TIMER_REC = 7, /* Timer Recovery */ please, no space before tabs -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/29394 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: I569d8023d701bd14ee78baa9394b6983d9cafca8 Gerrit-Change-Number: 29394 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-CC: Jenkins Builder Gerrit-Comment-Date: Sun, 18 Sep 2022 13:21:38 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
Change in libosmo-gprs[master]: llc: check-in basic LLC definitions from osmo-sgsn.git
by Jenkins Builder 18 Sep '22

18 Sep '22
Jenkins Builder has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/29393 ) Change subject: llc: check-in basic LLC definitions from osmo-sgsn.git ...................................................................... Patch Set 1: (1 comment) File include/osmocom/gprs/llc/llc.h: Robot Comment from checkpatch (run ID jenkins-gerrit-libosmo-gprs-lint-30): https://gerrit.osmocom.org/c/libosmo-gprs/+/29393/comment/b3dbb7ca_65b2d6ac PS1, Line 77: GPRS_LLES_TIMER_REC = 7, /* Timer Recovery */ please, no space before tabs -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/29393 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: I6ed0f4820b3a12a00be71ce63757765551743101 Gerrit-Change-Number: 29393 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-CC: Jenkins Builder Gerrit-Comment-Date: Sun, 18 Sep 2022 13:21:36 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
Change in libosmo-gprs[master]: llc: osmo_gprs_llc_hdr_dump[_buf](): also print SAPI name
by fixeria 18 Sep '22

18 Sep '22
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/29404 ) Change subject: llc: osmo_gprs_llc_hdr_dump[_buf](): also print SAPI name ...................................................................... llc: osmo_gprs_llc_hdr_dump[_buf](): also print SAPI name Change-Id: I95763e622bb3c3678c06901ddaecfc200d359d8d --- M src/llc/llc_pdu.c M tests/llc_pdu_codec/pdu_codec_test.ok 2 files changed, 7 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/04/29404/1 diff --git a/src/llc/llc_pdu.c b/src/llc/llc_pdu.c index 8d4d760..586fc75 100644 --- a/src/llc/llc_pdu.c +++ b/src/llc/llc_pdu.c @@ -94,8 +94,8 @@ { struct osmo_strbuf sb = { .buf = buf, .len = buf_size }; - OSMO_STRBUF_PRINTF(sb, "SAPI=%u, %s func=%s C/R=%c", - pdu->sapi, /* TODO: print value_string */ + OSMO_STRBUF_PRINTF(sb, "SAPI=%u (%s), %s func=%s C/R=%c", + pdu->sapi, osmo_gprs_llc_sapi_name(pdu->sapi), osmo_gprs_llc_frame_fmt_name(pdu->fmt), osmo_gprs_llc_frame_func_name(pdu->func), pdu->flags & OSMO_GPRS_LLC_PDU_F_CMD_RSP ? '1' : '0'); diff --git a/tests/llc_pdu_codec/pdu_codec_test.ok b/tests/llc_pdu_codec/pdu_codec_test.ok index 5eb5045..691e983 100644 --- a/tests/llc_pdu_codec/pdu_codec_test.ok +++ b/tests/llc_pdu_codec/pdu_codec_test.ok @@ -1,6 +1,6 @@ test_pdu_dec_enc(): decoding testData[0] = 01c010080509afe633 osmo_gprs_llc_pdu_decode() returns 0 - osmo_gprs_llc_pdu_hdr_dump(): SAPI=1, UI func=UI C/R=0 PM=0 E=0 IP=0 N(U)=4 FCS=33e6af + osmo_gprs_llc_pdu_hdr_dump(): SAPI=1 (GMM), UI func=UI C/R=0 PM=0 E=0 IP=0 N(U)=4 FCS=33e6af hdr.data[] (len=3): 080509 test_pdu_dec_enc(): encoding decoded testData[0] osmo_gprs_llc_pdu_encode() returns 0 @@ -8,7 +8,7 @@ memcmp() returns 0 test_pdu_dec_enc(): decoding testData[1] = 41c001081502de8e9a osmo_gprs_llc_pdu_decode() returns 0 - osmo_gprs_llc_pdu_hdr_dump(): SAPI=1, UI func=UI C/R=1 PM=1 E=0 IP=0 N(U)=0 FCS=9a8ede + osmo_gprs_llc_pdu_hdr_dump(): SAPI=1 (GMM), UI func=UI C/R=1 PM=1 E=0 IP=0 N(U)=0 FCS=9a8ede hdr.data[] (len=3): 081502 test_pdu_dec_enc(): encoding decoded testData[1] osmo_gprs_llc_pdu_encode() returns 0 @@ -16,14 +16,14 @@ memcmp() returns 0 test_pdu_dec_enc(): decoding testData[2] = 01e01ca2b3 osmo_gprs_llc_pdu_decode() returns 0 - osmo_gprs_llc_pdu_hdr_dump(): SAPI=1, U func=NULL C/R=0 P/F=0 FCS=b3a21c + osmo_gprs_llc_pdu_hdr_dump(): SAPI=1 (GMM), U func=NULL C/R=0 P/F=0 FCS=b3a21c test_pdu_dec_enc(): encoding decoded testData[2] osmo_gprs_llc_pdu_encode() returns 0 osmo_gprs_llc_pdu_encode(): 01e01ca2b3 memcmp() returns 0 test_pdu_dec_enc(): decoding testData[3] = 43fb01001601f41a05df8c7c4e osmo_gprs_llc_pdu_decode() returns 0 - osmo_gprs_llc_pdu_hdr_dump(): SAPI=3, U func=XID C/R=1 P/F=1 FCS=4e7c8c + osmo_gprs_llc_pdu_hdr_dump(): SAPI=3 (SNDCP3), U func=XID C/R=1 P/F=1 FCS=4e7c8c hdr.data[] (len=8): 01001601f41a05df test_pdu_dec_enc(): encoding decoded testData[3] osmo_gprs_llc_pdu_encode() returns 0 @@ -31,7 +31,7 @@ memcmp() returns 0 test_pdu_dec_enc(): decoding testData[4] = 03fb1604d216f984 osmo_gprs_llc_pdu_decode() returns 0 - osmo_gprs_llc_pdu_hdr_dump(): SAPI=3, U func=XID C/R=0 P/F=1 FCS=84f916 + osmo_gprs_llc_pdu_hdr_dump(): SAPI=3 (SNDCP3), U func=XID C/R=0 P/F=1 FCS=84f916 hdr.data[] (len=3): 1604d2 test_pdu_dec_enc(): encoding decoded testData[4] osmo_gprs_llc_pdu_encode() returns 0 -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/29404 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: I95763e622bb3c3678c06901ddaecfc200d359d8d Gerrit-Change-Number: 29404 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in libosmo-gprs[master]: llc: add struct value_string osmo_gprs_llc_sapi_names[]
by fixeria 18 Sep '22

18 Sep '22
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/29403 ) Change subject: llc: add struct value_string osmo_gprs_llc_sapi_names[] ...................................................................... llc: add struct value_string osmo_gprs_llc_sapi_names[] Change-Id: I8ae048ab9e6b63697951fa3f74ce671c88328f5f --- M include/osmocom/gprs/llc/llc.h M src/llc/llc_pdu.c 2 files changed, 17 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/03/29403/1 diff --git a/include/osmocom/gprs/llc/llc.h b/include/osmocom/gprs/llc/llc.h index 4155e8e..ebb9aa9 100644 --- a/include/osmocom/gprs/llc/llc.h +++ b/include/osmocom/gprs/llc/llc.h @@ -17,6 +17,11 @@ OSMO_GPRS_LLC_SAPI_SNDCP12 = 11, }; +extern const struct value_string osmo_gprs_llc_sapi_names[]; + +#define osmo_gprs_llc_sapi_name(val) \ + get_value_string(osmo_gprs_llc_sapi_names, val) + /* Section 6.3.0 Control field formats */ enum osmo_gprs_llc_frame_fmt { OSMO_GPRS_LLC_FMT_I, /* 6.3.1 Information transfer format - I */ diff --git a/src/llc/llc_pdu.c b/src/llc/llc_pdu.c index d769f30..8d4d760 100644 --- a/src/llc/llc_pdu.c +++ b/src/llc/llc_pdu.c @@ -36,6 +36,18 @@ #define N202 4 #define CRC24_LENGTH 3 +const struct value_string osmo_gprs_llc_sapi_names[] = { + { OSMO_GPRS_LLC_SAPI_GMM, "GMM" }, + { OSMO_GPRS_LLC_SAPI_TOM2, "TOM2" }, + { OSMO_GPRS_LLC_SAPI_SNDCP3, "SNDCP3" }, + { OSMO_GPRS_LLC_SAPI_SNDCP5, "SNDCP5" }, + { OSMO_GPRS_LLC_SAPI_SMS, "SMS" }, + { OSMO_GPRS_LLC_SAPI_TOM8, "TOM8" }, + { OSMO_GPRS_LLC_SAPI_SNDCP9, "SNDCP9" }, + { OSMO_GPRS_LLC_SAPI_SNDCP12, "SNDCP12" }, + { 0, NULL } +}; + const struct value_string osmo_gprs_llc_frame_fmt_names[] = { { OSMO_GPRS_LLC_FMT_I, "I" }, { OSMO_GPRS_LLC_FMT_S, "U" }, -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/29403 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: I8ae048ab9e6b63697951fa3f74ce671c88328f5f Gerrit-Change-Number: 29403 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in libosmo-gprs[master]: llc: implement LLC PDU codec based on code from osmo-sgsn.git
by fixeria 18 Sep '22

18 Sep '22
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/29402 ) Change subject: llc: implement LLC PDU codec based on code from osmo-sgsn.git ...................................................................... llc: implement LLC PDU codec based on code from osmo-sgsn.git Change-Id: I61d7e2e6d0a8f2cdfc2113e637e447dc428cc70d --- M configure.ac M include/osmocom/gprs/llc/llc.h M src/llc/llc_pdu.c M tests/Makefile.am A tests/llc_pdu_codec/Makefile.am A tests/llc_pdu_codec/pdu_codec_test.c A tests/llc_pdu_codec/pdu_codec_test.err A tests/llc_pdu_codec/pdu_codec_test.ok M tests/testsuite.at 9 files changed, 618 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/02/29402/1 diff --git a/configure.ac b/configure.ac index 6e9bcb4..b9b2d81 100644 --- a/configure.ac +++ b/configure.ac @@ -86,6 +86,7 @@ src/llc/Makefile src/rlcmac/Makefile tests/Makefile + tests/llc_pdu_codec/Makefile tests/ts_44_018/Makefile tests/ts_44_060/Makefile Makefile diff --git a/include/osmocom/gprs/llc/llc.h b/include/osmocom/gprs/llc/llc.h index 92a0045..4155e8e 100644 --- a/include/osmocom/gprs/llc/llc.h +++ b/include/osmocom/gprs/llc/llc.h @@ -130,4 +130,36 @@ uint16_t kU; }; +#define OSMO_GPRS_LLC_PDU_F_CMD_RSP (1 << 0) /* 6.2.2 Commmand/Response bit (C/R) */ +#define OSMO_GPRS_LLC_PDU_F_FOLL_FIN (1 << 1) /* 6.3.5.1 Poll/Final bit (P/F) */ +#define OSMO_GPRS_LLC_PDU_F_ACK_REQ (1 << 2) /* 6.3.5.2 Acknowledgement request bit (A) */ +#define OSMO_GPRS_LLC_PDU_F_MAC_PRES (1 << 3) /* 6.3.5.2a Integrity Protection bit (IP) */ +#define OSMO_GPRS_LLC_PDU_F_ENC_MODE (1 << 4) /* 6.3.5.5.1 Encryption mode bit (E) */ +#define OSMO_GPRS_LLC_PDU_F_PROT_MODE (1 << 5) /* 6.3.5.5.2 Protected Mode bit (PM) */ + +struct osmo_gprs_llc_pdu_decoded { + enum osmo_gprs_llc_sapi sapi; + enum osmo_gprs_llc_frame_fmt fmt; + enum osmo_gprs_llc_frame_func func; + uint32_t flags; /* see OSMO_GPRS_LLC_PDU_F_* above */ + uint32_t seq_rx; /* 6.3.5.4.5 Receive sequence number N(R) */ + uint32_t seq_tx; /* 6.3.5.4.3 Send sequence number N(S) */ + uint32_t fcs; /* 5.5 Frame Check Sequence (FCS) field */ + uint32_t mac; /* 5.5a Message Authentication Code (MAC) field */ + struct { + uint8_t len; /* Indicates the number of octets in the bitmap */ + uint8_t r[32]; /* The R(n) bitmap */ + } sack; /* 6.3.5.4.6 SACK bitmap R(n) */ + size_t data_len; + const uint8_t *data; +}; + +void osmo_gprs_llc_pdu_hdr_dump_buf(const struct osmo_gprs_llc_pdu_decoded *pdu, + char *buf, size_t buf_size); +const char *osmo_gprs_llc_pdu_hdr_dump(const struct osmo_gprs_llc_pdu_decoded *pdu); + +int osmo_gprs_llc_pdu_decode(struct osmo_gprs_llc_pdu_decoded *pdu, + const uint8_t *data, size_t data_len); +int osmo_gprs_llc_pdu_encode(struct msgb *msg, const struct osmo_gprs_llc_pdu_decoded *pdu); + uint32_t osmo_gprs_llc_fcs(const uint8_t *data, size_t len); diff --git a/src/llc/llc_pdu.c b/src/llc/llc_pdu.c index 0a936a8..d769f30 100644 --- a/src/llc/llc_pdu.c +++ b/src/llc/llc_pdu.c @@ -20,10 +20,22 @@ * */ +#include <stdint.h> +#include <errno.h> + +#include <osmocom/core/msgb.h> #include <osmocom/core/utils.h> +#include <osmocom/core/logging.h> #include <osmocom/gprs/llc/llc.h> +/* TODO: make logging category configurable */ +#define DLLC DLGLOBAL + +#define UI_HDR_LEN 3 +#define N202 4 +#define CRC24_LENGTH 3 + const struct value_string osmo_gprs_llc_frame_fmt_names[] = { { OSMO_GPRS_LLC_FMT_I, "I" }, { OSMO_GPRS_LLC_FMT_S, "U" }, @@ -64,3 +76,403 @@ return fcs_calc; } + +void osmo_gprs_llc_pdu_hdr_dump_buf(const struct osmo_gprs_llc_pdu_decoded *pdu, + char *buf, size_t buf_size) +{ + struct osmo_strbuf sb = { .buf = buf, .len = buf_size }; + + OSMO_STRBUF_PRINTF(sb, "SAPI=%u, %s func=%s C/R=%c", + pdu->sapi, /* TODO: print value_string */ + osmo_gprs_llc_frame_fmt_name(pdu->fmt), + osmo_gprs_llc_frame_func_name(pdu->func), + pdu->flags & OSMO_GPRS_LLC_PDU_F_CMD_RSP ? '1' : '0'); + + switch (pdu->fmt) { + case OSMO_GPRS_LLC_FMT_I: + OSMO_STRBUF_PRINTF(sb, " A=%c N(R)=%u N(S)=%u", + pdu->flags & OSMO_GPRS_LLC_PDU_F_ACK_REQ ? '1' : '0', + pdu->seq_rx, pdu->seq_tx); + break; + case OSMO_GPRS_LLC_FMT_S: + OSMO_STRBUF_PRINTF(sb, " A=%c N(R)=%u", + pdu->flags & OSMO_GPRS_LLC_PDU_F_ACK_REQ ? '1' : '0', + pdu->seq_rx); + break; + case OSMO_GPRS_LLC_FMT_UI: + OSMO_STRBUF_PRINTF(sb, " PM=%c E=%c IP=%c N(U)=%u", + pdu->flags & OSMO_GPRS_LLC_PDU_F_PROT_MODE ? '1' : '0', + pdu->flags & OSMO_GPRS_LLC_PDU_F_ENC_MODE ? '1' : '0', + pdu->flags & OSMO_GPRS_LLC_PDU_F_MAC_PRES ? '1' : '0', + pdu->seq_tx); + break; + case OSMO_GPRS_LLC_FMT_U: + OSMO_STRBUF_PRINTF(sb, " P/F=%c", + pdu->flags & OSMO_GPRS_LLC_PDU_F_FOLL_FIN ? '1' : '0'); + break; + } + + if (pdu->flags & OSMO_GPRS_LLC_PDU_F_MAC_PRES) + OSMO_STRBUF_PRINTF(sb, " MAC=%08x", pdu->mac); + OSMO_STRBUF_PRINTF(sb, " FCS=%06x", pdu->fcs); +} + +const char *osmo_gprs_llc_pdu_hdr_dump(const struct osmo_gprs_llc_pdu_decoded *pdu) +{ + static __thread char buf[256]; + osmo_gprs_llc_pdu_hdr_dump_buf(pdu, &buf[0], sizeof(buf)); + return buf; +} + +/* 6.4.1 Unnumbered (U) frames */ +#define GPRS_LLC_U_NULL_CMD 0x00 +#define GPRS_LLC_U_DM_RESP 0x01 +#define GPRS_LLC_U_DISC_CMD 0x04 +#define GPRS_LLC_U_UA_RESP 0x06 +#define GPRS_LLC_U_SABM_CMD 0x07 +#define GPRS_LLC_U_FRMR_RESP 0x08 +#define GPRS_LLC_U_XID 0x0b + +int osmo_gprs_llc_pdu_encode(struct msgb *msg, const struct osmo_gprs_llc_pdu_decoded *pdu) +{ + uint8_t *addr = msgb_put(msg, 1); + uint8_t *ctrl = NULL; + size_t crc_len; + uint32_t fcs; + + /* 6.2.3 Service Access Point Identifier (SAPI) */ + addr[0] |= pdu->sapi & 0x0f; + + /* 6.2.2 Commmand/Response bit (C/R) */ + if (pdu->flags & OSMO_GPRS_LLC_PDU_F_CMD_RSP) + addr[0] |= (1 << 6); + + switch (pdu->fmt) { + case OSMO_GPRS_LLC_FMT_I: + ctrl = msgb_put(msg, 3); + + if (pdu->flags & OSMO_GPRS_LLC_PDU_F_ACK_REQ) + ctrl[0] |= (1 << 6); + + ctrl[0] |= (pdu->seq_tx >> 4) & 0x1f; + ctrl[1] |= (pdu->seq_tx & 0x0f) << 4; + + ctrl[1] |= (pdu->seq_rx >> 6) & 0x07; + ctrl[2] |= (pdu->seq_rx & 0x3f) << 2; + + ctrl[2] |= (pdu->func - OSMO_GPRS_LLC_FUNC_RR) & 0x03; + + if (pdu->func == OSMO_GPRS_LLC_FUNC_SACK) { + OSMO_ASSERT(pdu->sack.len > 0); + msgb_put_u8(msg, pdu->sack.len - 1); + memcpy(msgb_put(msg, pdu->sack.len), + &pdu->sack.r[0], pdu->sack.len); + } + break; + case OSMO_GPRS_LLC_FMT_S: + ctrl = msgb_put(msg, 2); + + ctrl[0] |= 0x80; /* 10xxxxxx */ + + if (pdu->flags & OSMO_GPRS_LLC_PDU_F_ACK_REQ) + ctrl[1] |= 0x20; + + ctrl[0] |= (pdu->seq_rx >> 6) & 0x07; + ctrl[1] |= (pdu->seq_rx & 0x3f) << 2; + + ctrl[1] |= (pdu->func - OSMO_GPRS_LLC_FUNC_RR) & 0x03; + + if (pdu->func == OSMO_GPRS_LLC_FUNC_SACK) { + OSMO_ASSERT(pdu->sack.len > 0); + memcpy(msgb_put(msg, pdu->sack.len), + &pdu->sack.r[0], pdu->sack.len); + } + break; + case OSMO_GPRS_LLC_FMT_UI: + ctrl = msgb_put(msg, 2); + + ctrl[0] |= 0xc0; /* 110xxxxx */ + + if (pdu->flags & OSMO_GPRS_LLC_PDU_F_MAC_PRES) + ctrl[0] |= (1 << 4); + + ctrl[0] |= (pdu->seq_tx >> 6) & 0x07; + ctrl[1] |= (pdu->seq_tx & 0x3f) << 2; + + if (pdu->flags & OSMO_GPRS_LLC_PDU_F_ENC_MODE) + ctrl[1] |= (1 << 1); + if (pdu->flags & OSMO_GPRS_LLC_PDU_F_PROT_MODE) + ctrl[1] |= (1 << 0); + break; + case OSMO_GPRS_LLC_FMT_U: + ctrl = msgb_put(msg, 1); + + ctrl[0] |= 0xe0; /* 111xxxxx */ + + if (pdu->flags & OSMO_GPRS_LLC_PDU_F_FOLL_FIN) + ctrl[0] |= (1 << 4); + + switch (pdu->func) { + case OSMO_GPRS_LLC_FUNC_NULL: + ctrl[0] |= GPRS_LLC_U_NULL_CMD; + break; + case OSMO_GPRS_LLC_FUNC_DM: + ctrl[0] |= GPRS_LLC_U_DM_RESP; + break; + case OSMO_GPRS_LLC_FUNC_DISC: + ctrl[0] |= GPRS_LLC_U_DISC_CMD; + break; + case OSMO_GPRS_LLC_FUNC_UA: + ctrl[0] |= GPRS_LLC_U_UA_RESP; + break; + case OSMO_GPRS_LLC_FUNC_SABM: + ctrl[0] |= GPRS_LLC_U_SABM_CMD; + break; + case OSMO_GPRS_LLC_FUNC_FRMR: + ctrl[0] |= GPRS_LLC_U_FRMR_RESP; + break; + case OSMO_GPRS_LLC_FUNC_XID: + ctrl[0] |= GPRS_LLC_U_XID; + break; + default: + LOGP(DLLC, LOGL_ERROR, + "Unknown UI func=0x%02x\n", pdu->func); + return -EINVAL; + } + break; + } + + if (pdu->data_len > 0) { + uint8_t *data = msgb_put(msg, pdu->data_len); + memcpy(data, pdu->data, pdu->data_len); + } + + /* 5.5a Message Authentication Code (MAC) field */ + if (pdu->flags & OSMO_GPRS_LLC_PDU_F_MAC_PRES) { + /* TODO: calculate MAC (see 3GPP TS 43.020) */ + LOGP(DLLC, LOGL_ERROR, + "Message Authentication Code (MAC) is not implemented\n"); + return -ENOTSUP; + } + + /* 5.5 Frame Check Sequence (FCS) field */ + crc_len = msg->tail - addr; + if (~pdu->flags & OSMO_GPRS_LLC_PDU_F_PROT_MODE) + crc_len = OSMO_MIN(crc_len, UI_HDR_LEN + N202); + fcs = osmo_gprs_llc_fcs(addr, crc_len); + + msgb_put_u8(msg, fcs & 0xff); + msgb_put_u8(msg, (fcs >> 8) & 0xff); + msgb_put_u8(msg, (fcs >> 16) & 0xff); + + return 0; +} + +int osmo_gprs_llc_pdu_decode(struct osmo_gprs_llc_pdu_decoded *pdu, + const uint8_t *data, size_t data_len) +{ + const uint8_t *addr = &data[0]; + const uint8_t *ctrl = &data[1]; + +#define check_len(len, text) \ + do { \ + if (data_len < (len)) { \ + LOGP(DLLC, LOGL_ERROR, "Failed to parse LLC PDU: %s\n", text); \ + return -EINVAL; \ + } \ + } while (0) + + /* 5.5 Frame Check Sequence (FCS) field */ + check_len(CRC24_LENGTH, "missing Frame Check Sequence (FCS) field"); + pdu->fcs = data[data_len - 3]; + pdu->fcs |= data[data_len - 2] << 8; + pdu->fcs |= data[data_len - 1] << 16; + data_len -= CRC24_LENGTH; + + /* 6.2.0 Address field format */ + check_len(sizeof(*addr), "missing Address field"); + data_len -= sizeof(*addr); + + /* Initial assumption: FCS covers hdr + all inf fields */ + pdu->flags |= OSMO_GPRS_LLC_PDU_F_PROT_MODE; + + /* 6.2.1 Protocol Discriminator bit (PD): shall be 0 */ + if (*addr & 0x80) { + LOGP(DLLC, LOGL_ERROR, "Protocol Discriminator shall be 0\n"); + return -EINVAL; + } + + /* 6.2.2 Commmand/Response bit (C/R) */ + if (*addr & 0x40) + pdu->flags |= OSMO_GPRS_LLC_PDU_F_CMD_RSP; + + /* 6.2.3 Service Access Point Identifier (SAPI) */ + pdu->sapi = *addr & 0x0f; + + /* Check for reserved SAPI */ + switch (*addr & 0x0f) { + case 0x00: + case 0x04: + case 0x06: + case 0x0a: + case 0x0c: + case 0x0d: + case 0x0f: + LOGP(DLLC, LOGL_ERROR, "Unknown SAPI=%u\n", pdu->sapi); + return -EINVAL; + } + + /* U format has the shortest control field length=1 */ + check_len(sizeof(*ctrl), "missing Control field"); + + /* 6.3.0 Control field formats */ + if ((ctrl[0] & 0x80) == 0) { + /* 6.3.1 Information transfer format - I */ + pdu->fmt = OSMO_GPRS_LLC_FMT_I; + + check_len(3, "I format Control field is too short"); + data_len -= 3; + + pdu->data = ctrl + 3; + /* pdu->data_len is set below */ + + if (ctrl[0] & 0x40) + pdu->flags |= OSMO_GPRS_LLC_PDU_F_ACK_REQ; + + pdu->seq_tx = (ctrl[0] & 0x1f) << 4; + pdu->seq_tx |= (ctrl[1] >> 4); + + pdu->seq_rx = (ctrl[1] & 0x7) << 6; + pdu->seq_rx |= (ctrl[2] >> 2); + + switch (ctrl[2] & 0x03) { + case 0: + pdu->func = OSMO_GPRS_LLC_FUNC_RR; + break; + case 1: + pdu->func = OSMO_GPRS_LLC_FUNC_ACK; + break; + case 2: + pdu->func = OSMO_GPRS_LLC_FUNC_RNR; + break; + case 3: + pdu->func = OSMO_GPRS_LLC_FUNC_SACK; + check_len(1, "I func=SACK is too short"); + pdu->sack.len = (ctrl[3] & 0x1f) + 1; /* 1 .. 32 */ + /* The R(n) bitmask takes len=(K + 1) octets */ + check_len(pdu->sack.len, "I func=SACK is too short"); + memcpy(&pdu->sack.r[0], ctrl + 4, pdu->sack.len); + pdu->data += 1 + pdu->sack.len; + data_len -= 1 + pdu->sack.len; + break; + } + pdu->data_len = data_len; + } else if ((ctrl[0] & 0xc0) == 0x80) { + /* 6.3.2 Supervisory format - S */ + pdu->fmt = OSMO_GPRS_LLC_FMT_S; + + check_len(2, "S format Control field is too short"); + data_len -= 2; + + pdu->data = NULL; + pdu->data_len = 0; + + if (ctrl[0] & 0x20) + pdu->flags |= OSMO_GPRS_LLC_PDU_F_ACK_REQ; + + pdu->seq_rx = (ctrl[0] & 0x7) << 6; + pdu->seq_rx |= (ctrl[1] >> 2); + + switch (ctrl[1] & 0x03) { + case 0: + pdu->func = OSMO_GPRS_LLC_FUNC_RR; + break; + case 1: + pdu->func = OSMO_GPRS_LLC_FUNC_ACK; + break; + case 2: + pdu->func = OSMO_GPRS_LLC_FUNC_RNR; + break; + case 3: + pdu->func = OSMO_GPRS_LLC_FUNC_SACK; + /* The R(n) bitmask takes all remaining octets */ + check_len(1, "S func=SACK is too short"); + pdu->sack.len = data_len; /* 1 .. 32 */ + memcpy(&pdu->sack.r[0], ctrl + 2, pdu->sack.len); + break; + } + } else if ((ctrl[0] & 0xe0) == 0xc0) { + /* 6.3.3 Unconfirmed Information format - UI */ + pdu->fmt = OSMO_GPRS_LLC_FMT_UI; + pdu->func = OSMO_GPRS_LLC_FUNC_UI; + + check_len(2, "UI format Control field is too short"); + data_len -= 2; + + pdu->data = ctrl + 2; + pdu->data_len = data_len; + + pdu->seq_tx = (ctrl[0] & 0x7) << 6; + pdu->seq_tx |= (ctrl[1] >> 2); + + if (ctrl[0] & 0x10) { + check_len(sizeof(pdu->mac), "missing MAC field"); + pdu->data_len -= sizeof(pdu->mac); + data_len -= sizeof(pdu->mac); + + pdu->mac = osmo_load32le(&pdu->data[data_len]); + pdu->flags |= OSMO_GPRS_LLC_PDU_F_MAC_PRES; + } + + if (ctrl[1] & 0x02) + pdu->flags |= OSMO_GPRS_LLC_PDU_F_ENC_MODE; + + if (~ctrl[1] & 0x01) /* FCS covers hdr + N202 octets */ + pdu->flags &= ~OSMO_GPRS_LLC_PDU_F_PROT_MODE; + } else { + /* 6.3.4 Unnumbered format - U */ + pdu->fmt = OSMO_GPRS_LLC_FMT_U; + + check_len(1, "U format Control field is too short"); + data_len -= 1; + + pdu->data = NULL; + pdu->data_len = 0; + + if (ctrl[0] & 0x10) + pdu->flags |= OSMO_GPRS_LLC_PDU_F_FOLL_FIN; + + switch (ctrl[0] & 0x0f) { + case GPRS_LLC_U_NULL_CMD: + pdu->func = OSMO_GPRS_LLC_FUNC_NULL; + break; + case GPRS_LLC_U_DM_RESP: + pdu->func = OSMO_GPRS_LLC_FUNC_DM; + break; + case GPRS_LLC_U_DISC_CMD: + pdu->func = OSMO_GPRS_LLC_FUNC_DISC; + break; + case GPRS_LLC_U_UA_RESP: + pdu->func = OSMO_GPRS_LLC_FUNC_UA; + break; + case GPRS_LLC_U_SABM_CMD: + pdu->func = OSMO_GPRS_LLC_FUNC_SABM; + break; + case GPRS_LLC_U_FRMR_RESP: + pdu->func = OSMO_GPRS_LLC_FUNC_FRMR; + break; + case GPRS_LLC_U_XID: + pdu->func = OSMO_GPRS_LLC_FUNC_XID; + pdu->data = ctrl + 1; + pdu->data_len = data_len; + break; + default: + LOGP(DLLC, LOGL_ERROR, "Unknown U func=0x%02x\n", ctrl[0] & 0x0f); + return -ENOTSUP; + } + } + +#undef check_len + + return 0; +} diff --git a/tests/Makefile.am b/tests/Makefile.am index f4b4dbf..15660c9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,4 +1,5 @@ SUBDIRS = \ + llc_pdu_codec \ ts_44_018 \ ts_44_060 \ $(NULL) diff --git a/tests/llc_pdu_codec/Makefile.am b/tests/llc_pdu_codec/Makefile.am new file mode 100644 index 0000000..0079964 --- /dev/null +++ b/tests/llc_pdu_codec/Makefile.am @@ -0,0 +1,24 @@ +AM_CFLAGS = \ + -Wall \ + $(LIBOSMOCORE_CFLAGS) \ + -I$(top_srcdir)/include/ \ + $(NULL) + +AM_LDFLAGS = \ + -no-install \ + $(NULL) + +check_PROGRAMS = \ + pdu_codec_test \ + $(NULL) + +EXTRA_DIST = \ + pdu_codec_test.ok \ + pdu_codec_test.err \ + $(NULL) + +pdu_codec_test_SOURCES = pdu_codec_test.c +pdu_codec_test_LDADD = \ + $(LIBOSMOCORE_LIBS) \ + $(top_builddir)/src/llc/libosmo-gprs-llc.la \ + $(NULL) diff --git a/tests/llc_pdu_codec/pdu_codec_test.c b/tests/llc_pdu_codec/pdu_codec_test.c new file mode 100644 index 0000000..e7f2c5b --- /dev/null +++ b/tests/llc_pdu_codec/pdu_codec_test.c @@ -0,0 +1,101 @@ +/* LLC PDU codec tests + * + * (C) 2022 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> + * Author: Vadim Yanitskiy <vyanitskiy(a)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. + */ + +#include <stdint.h> +#include <stdio.h> + +#include <osmocom/core/application.h> +#include <osmocom/core/logging.h> +#include <osmocom/core/utils.h> +#include <osmocom/core/msgb.h> + +#include <osmocom/gprs/llc/llc.h> + +static void *tall_ctx = NULL; + +static void test_pdu_dec_enc(void) +{ + static const char *testData[] = { + /* SAPI=1 (GMM), UI func=UI C/R=0 PM=0 N(U)=4 */ + "01c010080509afe633", + /* SAPI=1 (GMM), UI func=UI C/R=1 PM=1 N(U)=0 */ + "41c001081502de8e9a", + /* SAPI=1 (GMM), U func=NULL C/R=0 P/F=0 */ + "01e01ca2b3", + /* SAPI=3 (SNDCP3), U func=XID C/R=1 P/F=1 */ + "43fb01001601f41a05df8c7c4e", + /* SAPI=3 (SNDCP3), U func=XID C/R=1 P/F=1 */ + "03fb1604d216f984", + }; + + for (unsigned int i = 0; i < ARRAY_SIZE(testData); i++) { + struct osmo_gprs_llc_pdu_decoded hdr = { 0 }; + uint8_t pdu[256]; + size_t pdu_len; + int rc; + + printf("%s(): decoding testData[%u] = %s\n", __func__, i, testData[i]); + + rc = osmo_hexparse(testData[i], &pdu[0], sizeof(pdu)); + pdu_len = strlen(testData[i]) / 2; + OSMO_ASSERT(rc == pdu_len); + + rc = osmo_gprs_llc_pdu_decode(&hdr, &pdu[0], pdu_len); + printf(" osmo_gprs_llc_pdu_decode() returns %d\n", rc); + printf(" osmo_gprs_llc_pdu_hdr_dump(): %s\n", osmo_gprs_llc_pdu_hdr_dump(&hdr)); + if (hdr.data_len > 0) { + printf(" hdr.data[] (len=%zu): %s\n", hdr.data_len, + osmo_hexdump_nospc(hdr.data, hdr.data_len)); + } + + printf("%s(): encoding decoded testData[%u]\n", __func__, i); + + struct msgb *msg = msgb_alloc(1024, "LLC-PDU"); + OSMO_ASSERT(msg != NULL); + + rc = osmo_gprs_llc_pdu_encode(msg, &hdr); + printf(" osmo_gprs_llc_pdu_encode() returns %d\n", rc); + printf(" osmo_gprs_llc_pdu_encode(): %s\n", osmo_hexdump_nospc(msg->data, msg->len)); + printf(" memcmp() returns %d\n", memcmp(&pdu, msg->data, pdu_len)); + msgb_free(msg); + } + + printf("\n"); +} + +static const struct log_info_cat test_log_categories[] = { }; +static const struct log_info test_log_info = { + .cat = test_log_categories, + .num_cat = ARRAY_SIZE(test_log_categories), +}; + +int main(int argc, char *argv[]) +{ + tall_ctx = talloc_named_const(NULL, 1, __FILE__); + + osmo_init_logging2(tall_ctx, &test_log_info); + log_parse_category_mask(osmo_stderr_target, "DLGLOBAL,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); + + test_pdu_dec_enc(); + + talloc_free(tall_ctx); +} diff --git a/tests/llc_pdu_codec/pdu_codec_test.err b/tests/llc_pdu_codec/pdu_codec_test.err new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/llc_pdu_codec/pdu_codec_test.err diff --git a/tests/llc_pdu_codec/pdu_codec_test.ok b/tests/llc_pdu_codec/pdu_codec_test.ok new file mode 100644 index 0000000..5eb5045 --- /dev/null +++ b/tests/llc_pdu_codec/pdu_codec_test.ok @@ -0,0 +1,40 @@ +test_pdu_dec_enc(): decoding testData[0] = 01c010080509afe633 + osmo_gprs_llc_pdu_decode() returns 0 + osmo_gprs_llc_pdu_hdr_dump(): SAPI=1, UI func=UI C/R=0 PM=0 E=0 IP=0 N(U)=4 FCS=33e6af + hdr.data[] (len=3): 080509 +test_pdu_dec_enc(): encoding decoded testData[0] + osmo_gprs_llc_pdu_encode() returns 0 + osmo_gprs_llc_pdu_encode(): 01c010080509afe633 + memcmp() returns 0 +test_pdu_dec_enc(): decoding testData[1] = 41c001081502de8e9a + osmo_gprs_llc_pdu_decode() returns 0 + osmo_gprs_llc_pdu_hdr_dump(): SAPI=1, UI func=UI C/R=1 PM=1 E=0 IP=0 N(U)=0 FCS=9a8ede + hdr.data[] (len=3): 081502 +test_pdu_dec_enc(): encoding decoded testData[1] + osmo_gprs_llc_pdu_encode() returns 0 + osmo_gprs_llc_pdu_encode(): 41c001081502de8e9a + memcmp() returns 0 +test_pdu_dec_enc(): decoding testData[2] = 01e01ca2b3 + osmo_gprs_llc_pdu_decode() returns 0 + osmo_gprs_llc_pdu_hdr_dump(): SAPI=1, U func=NULL C/R=0 P/F=0 FCS=b3a21c +test_pdu_dec_enc(): encoding decoded testData[2] + osmo_gprs_llc_pdu_encode() returns 0 + osmo_gprs_llc_pdu_encode(): 01e01ca2b3 + memcmp() returns 0 +test_pdu_dec_enc(): decoding testData[3] = 43fb01001601f41a05df8c7c4e + osmo_gprs_llc_pdu_decode() returns 0 + osmo_gprs_llc_pdu_hdr_dump(): SAPI=3, U func=XID C/R=1 P/F=1 FCS=4e7c8c + hdr.data[] (len=8): 01001601f41a05df +test_pdu_dec_enc(): encoding decoded testData[3] + osmo_gprs_llc_pdu_encode() returns 0 + osmo_gprs_llc_pdu_encode(): 43fb01001601f41a05df8c7c4e + memcmp() returns 0 +test_pdu_dec_enc(): decoding testData[4] = 03fb1604d216f984 + osmo_gprs_llc_pdu_decode() returns 0 + osmo_gprs_llc_pdu_hdr_dump(): SAPI=3, U func=XID C/R=0 P/F=1 FCS=84f916 + hdr.data[] (len=3): 1604d2 +test_pdu_dec_enc(): encoding decoded testData[4] + osmo_gprs_llc_pdu_encode() returns 0 + osmo_gprs_llc_pdu_encode(): 03fb1604d216f984 + memcmp() returns 0 + diff --git a/tests/testsuite.at b/tests/testsuite.at index 53e5ab2..703fd7a 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -1,6 +1,13 @@ AT_INIT AT_BANNER([Regression tests]) +AT_SETUP([llc/pdu_codec]) +AT_KEYWORDS([llc pdu codec]) +cat $abs_srcdir/llc_pdu_codec/pdu_codec_test.ok > expout +cat $abs_srcdir/llc_pdu_codec/pdu_codec_test.err > experr +AT_CHECK([$abs_top_builddir/tests/llc_pdu_codec/pdu_codec_test], [0], [expout], [experr]) +AT_CLEANUP + AT_SETUP([rlcmac/ts_44_018]) AT_KEYWORDS([rlcmac ts_44_018]) cat $abs_srcdir/ts_44_018/ts_44_018_test.ok > expout -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/29402 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: I61d7e2e6d0a8f2cdfc2113e637e447dc428cc70d Gerrit-Change-Number: 29402 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in libosmo-gprs[master]: llc: add definitions from 3GPP TS 44.064 section 6.4
by fixeria 18 Sep '22

18 Sep '22
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/29399 ) Change subject: llc: add definitions from 3GPP TS 44.064 section 6.4 ...................................................................... llc: add definitions from 3GPP TS 44.064 section 6.4 Change-Id: I6d0e1a878fb80c57a901da08798620a6ea4471a4 --- M include/osmocom/gprs/llc/llc.h M src/llc/Makefile.am A src/llc/llc_pdu.c 3 files changed, 92 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/99/29399/1 diff --git a/include/osmocom/gprs/llc/llc.h b/include/osmocom/gprs/llc/llc.h index 71b0aed..3afaf3b 100644 --- a/include/osmocom/gprs/llc/llc.h +++ b/include/osmocom/gprs/llc/llc.h @@ -16,6 +16,44 @@ OSMO_GPRS_LLC_SAPI_SNDCP12 = 11, }; +/* Section 6.3.0 Control field formats */ +enum osmo_gprs_llc_frame_fmt { + OSMO_GPRS_LLC_FMT_I, /* 6.3.1 Information transfer format - I */ + OSMO_GPRS_LLC_FMT_S, /* 6.3.2 Supervisory format - S */ + OSMO_GPRS_LLC_FMT_UI, /* 6.3.3 Unconfirmed Information format - UI */ + OSMO_GPRS_LLC_FMT_U, /* 6.3.4 Unnumbered format - U */ +}; + +extern const struct value_string osmo_gprs_llc_frame_fmt_names[]; + +#define osmo_gprs_llc_frame_fmt_name(val) \ + get_value_string(osmo_gprs_llc_frame_fmt_names, val) + +/* Section 6.4 Commands and responses */ +enum osmo_gprs_llc_frame_func { + /* 6.4.1 Unnumbered (U) frames */ + OSMO_GPRS_LLC_FUNC_SABM, /* 6.4.1.1 */ + OSMO_GPRS_LLC_FUNC_DISC, /* 6.4.1.2 */ + OSMO_GPRS_LLC_FUNC_UA, /* 6.4.1.3 */ + OSMO_GPRS_LLC_FUNC_DM, /* 6.4.1.4 */ + OSMO_GPRS_LLC_FUNC_FRMR, /* 6.4.1.5 */ + OSMO_GPRS_LLC_FUNC_XID, /* 6.4.1.6 */ + OSMO_GPRS_LLC_FUNC_NULL, /* 6.4.1.7 */ + /* 6.4.2 Unconfirmed Information (UI) frame */ + OSMO_GPRS_LLC_FUNC_UI, /* 6.4.2.1 */ + OSMO_GPRS_LLC_FUNC_UI_DUMMY, /* 6.4.2.2 */ + /* 6.4.3 Combined Information (I) and Supervisory (S) frames */ + OSMO_GPRS_LLC_FUNC_RR, /* 6.4.3.1 */ + OSMO_GPRS_LLC_FUNC_ACK, /* 6.4.3.2 */ + OSMO_GPRS_LLC_FUNC_SACK, /* 6.4.3.3 */ + OSMO_GPRS_LLC_FUNC_RNR, /* 6.4.3.4 */ +}; + +extern const struct value_string osmo_gprs_llc_frame_func_names[]; + +#define osmo_gprs_llc_frame_func_name(val) \ + get_value_string(osmo_gprs_llc_frame_func_names, val) + /* Section 6.4.1.6 / Table 6 */ enum osmo_gprs_llc_xid_type { OSMO_GPRS_LLC_XID_T_VERSION = 0, diff --git a/src/llc/Makefile.am b/src/llc/Makefile.am index 5f9fac3..5a4ad72 100644 --- a/src/llc/Makefile.am +++ b/src/llc/Makefile.am @@ -22,6 +22,7 @@ $(NULL) libosmo_gprs_llc_la_SOURCES = \ + llc_pdu.c \ $(NULL) # TODO: -export-symbols-regex '^osmo_' diff --git a/src/llc/llc_pdu.c b/src/llc/llc_pdu.c new file mode 100644 index 0000000..0a98416 --- /dev/null +++ b/src/llc/llc_pdu.c @@ -0,0 +1,53 @@ +/* GPRS LLC protocol implementation as per 3GPP TS 44.064 */ + +/* (C) 2009-2010 by Harald Welte <laforge(a)gnumonks.org> + * (C) 2022 by Sysmocom s.f.m.c. GmbH + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#include <osmocom/core/utils.h> + +#include <osmocom/gprs/llc/llc.h> + +const struct value_string osmo_gprs_llc_frame_fmt_names[] = { + { OSMO_GPRS_LLC_FMT_I, "I" }, + { OSMO_GPRS_LLC_FMT_S, "U" }, + { OSMO_GPRS_LLC_FMT_UI, "UI" }, + { OSMO_GPRS_LLC_FMT_U, "U" }, + { 0, NULL } +}; + +const struct value_string osmo_gprs_llc_frame_func_names[] = { + /* 6.4.1 Unnumbered (U) frames */ + { OSMO_GPRS_LLC_FUNC_SABM, "SABM" }, + { OSMO_GPRS_LLC_FUNC_DISC, "DISC" }, + { OSMO_GPRS_LLC_FUNC_UA, "UA" }, + { OSMO_GPRS_LLC_FUNC_DM, "DM" }, + { OSMO_GPRS_LLC_FUNC_FRMR, "FRMR" }, + { OSMO_GPRS_LLC_FUNC_XID, "XID" }, + { OSMO_GPRS_LLC_FUNC_NULL, "NULL" }, + /* 6.4.2 Unconfirmed Information (UI) frame */ + { OSMO_GPRS_LLC_FUNC_UI, "UI" }, + { OSMO_GPRS_LLC_FUNC_UI_DUMMY, "UI Dummy" }, + /* 6.4.3 Combined Information (I) and Supervisory (S) frames */ + { OSMO_GPRS_LLC_FUNC_RR, "RR" }, + { OSMO_GPRS_LLC_FUNC_ACK, "ACK" }, + { OSMO_GPRS_LLC_FUNC_SACK, "SACK" }, + { OSMO_GPRS_LLC_FUNC_RNR, "RNR" }, + { 0, NULL } +}; -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/29399 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: I6d0e1a878fb80c57a901da08798620a6ea4471a4 Gerrit-Change-Number: 29399 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • ...
  • 186
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.