[MERGED] libosmocore[master]: gsm0808: Add AoIP specific elements to gsm0808_create_... fu...
Harald Welte has submitted this change and it was merged. Change subject: gsm0808: Add AoIP specific elements to gsm0808_create_... functions .. gsm0808: Add AoIP specific elements to gsm0808_create_... functions the classic A implementation in libosmocore lacks support for AoIP message elements. This patch adds support for AoIP by adding a set of new gsm0808_create_..., which support the missing AoIP message elements Change-Id: I77f866abec1822d19871052f3c647ad782785b34 --- M include/osmocom/gsm/gsm0808.h M src/gsm/gsm0808.c M src/gsm/libosmogsm.map M tests/gsm0808/gsm0808_test.c M tests/gsm0808/gsm0808_test.ok 5 files changed, 195 insertions(+), 7 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h index a7e102c..fd73376 100644 --- a/include/osmocom/gsm/gsm0808.h +++ b/include/osmocom/gsm/gsm0808.h @@ -20,10 +20,17 @@ #pragma once #include "tlv.h" +#include +#include struct msgb; -struct msgb *gsm0808_create_layer3(struct msgb *msg, uint16_t netcode, uint16_t countrycode, int lac, uint16_t ci); +struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, + uint16_t cc, int lac, uint16_t _ci); +struct msgb *gsm0808_create_layer3_aoip(const struct msgb *msg_l3, uint16_t nc, + uint16_t cc, int lac, uint16_t _ci, + const struct gsm0808_speech_codec_list + *scl); struct msgb *gsm0808_create_reset(void); struct msgb *gsm0808_create_reset_ack(void); struct msgb *gsm0808_create_clear_command(uint8_t reason); @@ -33,9 +40,19 @@ struct msgb *gsm0808_create_classmark_update(const uint8_t *cm2, uint8_t cm2_len, const uint8_t *cm3, uint8_t cm3_len); struct msgb *gsm0808_create_sapi_reject(uint8_t link_id); +struct msgb *gsm0808_create_ass_compl(uint8_t rr_cause, uint8_t chosen_channel, + uint8_t encr_alg_id, uint8_t speech_mode, + const struct sockaddr_storage *ss, + const struct gsm0808_speech_codec *sc, + const struct gsm0808_speech_codec_list + *scl); struct msgb *gsm0808_create_assignment_completed(uint8_t rr_cause, -uint8_t chosen_channel, uint8_t encr_alg_id, +uint8_t chosen_channel, +uint8_t encr_alg_id, uint8_t speech_mode); +struct msgb *gsm0808_create_ass_fail(uint8_t cause, const uint8_t *rr_cause, +const struct gsm0808_speech_codec_list +*scl); struct msgb *gsm0808_create_assignment_failure(uint8_t cause, uint8_t *rr_cause); struct msgb *gsm0808_create_clear_rqst(uint8_t cause); diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c index de80006..b8ab79b 100644 --- a/src/gsm/gsm0808.c +++ b/src/gsm/gsm0808.c @@ -19,6 +19,7 @@ */ #include +#include #include #include @@ -27,7 +28,10 @@ #define BSSMAP_MSG_SIZE 512 #define BSSMAP_MSG_HEADROOM 128 -struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, uint16_t cc, int lac, uint16_t _ci) +struct msgb *gsm0808_create_layer3_aoip(const struct msgb *msg_l3, uint16_t nc, + uint16_t cc, int lac, uint16_t _ci, + const struct gsm0808_speech_codec_list + *scl) { struct msgb* msg; struct { @@ -55,10 +59,20 @@ msgb_tlv_put(msg, GSM0808_IE_LAYER_3_INFORMATION, msgb_l3len(msg_l3), msg_l3->l3h); + /* AoIP: add Codec List (BSS Supported) 3.2.2.103 */ + if (scl) + gsm0808_enc_speech_codec_list(msg, scl); + /* push the bssmap header */ msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); return msg; +} + +struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, + uint16_t cc, int lac, uint16_t _ci) +{ + return gsm0808_create_layer3_aoip(msg_l3, nc, cc, lac, _ci, NULL); } struct msgb *gsm0808_create_reset(void) @@ -191,9 +205,12 @@ return msg; } -struct msgb *gsm0808_create_assignment_completed(uint8_t rr_cause, -uint8_t chosen_channel, uint8_t encr_alg_id, -uint8_t speech_mode) +struct msgb *gsm0808_create_ass_compl(uint8_t rr_cause, uint8_t chosen_channel, + uint8_t
[PATCH] libosmocore[master]: gsm0808: Add AoIP specific elements to gsm0808_create_... fu...
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2178 to look at the new patch set (#5). gsm0808: Add AoIP specific elements to gsm0808_create_... functions the classic A implementation in libosmocore lacks support for AoIP message elements. This patch adds support for AoIP by adding a set of new gsm0808_create_..., which support the missing AoIP message elements Change-Id: I77f866abec1822d19871052f3c647ad782785b34 --- M include/osmocom/gsm/gsm0808.h M src/gsm/gsm0808.c M src/gsm/libosmogsm.map M tests/gsm0808/gsm0808_test.c M tests/gsm0808/gsm0808_test.ok 5 files changed, 195 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/78/2178/5 diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h index a7e102c..fd73376 100644 --- a/include/osmocom/gsm/gsm0808.h +++ b/include/osmocom/gsm/gsm0808.h @@ -20,10 +20,17 @@ #pragma once #include "tlv.h" +#include +#include struct msgb; -struct msgb *gsm0808_create_layer3(struct msgb *msg, uint16_t netcode, uint16_t countrycode, int lac, uint16_t ci); +struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, + uint16_t cc, int lac, uint16_t _ci); +struct msgb *gsm0808_create_layer3_aoip(const struct msgb *msg_l3, uint16_t nc, + uint16_t cc, int lac, uint16_t _ci, + const struct gsm0808_speech_codec_list + *scl); struct msgb *gsm0808_create_reset(void); struct msgb *gsm0808_create_reset_ack(void); struct msgb *gsm0808_create_clear_command(uint8_t reason); @@ -33,9 +40,19 @@ struct msgb *gsm0808_create_classmark_update(const uint8_t *cm2, uint8_t cm2_len, const uint8_t *cm3, uint8_t cm3_len); struct msgb *gsm0808_create_sapi_reject(uint8_t link_id); +struct msgb *gsm0808_create_ass_compl(uint8_t rr_cause, uint8_t chosen_channel, + uint8_t encr_alg_id, uint8_t speech_mode, + const struct sockaddr_storage *ss, + const struct gsm0808_speech_codec *sc, + const struct gsm0808_speech_codec_list + *scl); struct msgb *gsm0808_create_assignment_completed(uint8_t rr_cause, -uint8_t chosen_channel, uint8_t encr_alg_id, +uint8_t chosen_channel, +uint8_t encr_alg_id, uint8_t speech_mode); +struct msgb *gsm0808_create_ass_fail(uint8_t cause, const uint8_t *rr_cause, +const struct gsm0808_speech_codec_list +*scl); struct msgb *gsm0808_create_assignment_failure(uint8_t cause, uint8_t *rr_cause); struct msgb *gsm0808_create_clear_rqst(uint8_t cause); diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c index de80006..b8ab79b 100644 --- a/src/gsm/gsm0808.c +++ b/src/gsm/gsm0808.c @@ -19,6 +19,7 @@ */ #include +#include #include #include @@ -27,7 +28,10 @@ #define BSSMAP_MSG_SIZE 512 #define BSSMAP_MSG_HEADROOM 128 -struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, uint16_t cc, int lac, uint16_t _ci) +struct msgb *gsm0808_create_layer3_aoip(const struct msgb *msg_l3, uint16_t nc, + uint16_t cc, int lac, uint16_t _ci, + const struct gsm0808_speech_codec_list + *scl) { struct msgb* msg; struct { @@ -55,10 +59,20 @@ msgb_tlv_put(msg, GSM0808_IE_LAYER_3_INFORMATION, msgb_l3len(msg_l3), msg_l3->l3h); + /* AoIP: add Codec List (BSS Supported) 3.2.2.103 */ + if (scl) + gsm0808_enc_speech_codec_list(msg, scl); + /* push the bssmap header */ msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg)); return msg; +} + +struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, + uint16_t cc, int lac, uint16_t _ci) +{ + return gsm0808_create_layer3_aoip(msg_l3, nc, cc, lac, _ci, NULL); } struct msgb *gsm0808_create_reset(void) @@ -191,9 +205,12 @@ return msg; } -struct msgb *gsm0808_create_assignment_completed(uint8_t rr_cause, -uint8_t chosen_channel, uint8_t encr_alg_id, -uint8_t speech_mode) +struct msgb *gsm0808_create_ass_compl(uint8_t rr_cause, uint8_t chosen_channel, + uint8_t encr_alg_id, uint8_t speech_mode, +
libosmocore[master]: gsm0808: Add AoIP specific elements to gsm0808_create_... fu...
Patch Set 3: Code-Review+1 (2 comments) https://gerrit.osmocom.org/#/c/2178/3/src/gsm/gsm0808.c File src/gsm/gsm0808.c: Line 55: (uint8_t *) & lai_ci); we normally don't mix cosmetic and non-cosmetic changes in a single patch. This one has already three cosmetic changes. Line 208: struct msgb *gsm0808_create_assignment_completed_aoip(uint8_t rr_cause, as we're changing the signature anyway, we might as well shorten the naming. "gsm0808_create_ass_compl" or if you like to prevent the "ass" use "assgn" -- To view, visit https://gerrit.osmocom.org/2178 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I77f866abec1822d19871052f3c647ad782785b34 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: dexterGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes
[PATCH] libosmocore[master]: gsm0808: Add AoIP specific elements to gsm0808_create_... fu...
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/2178 to look at the new patch set (#3). gsm0808: Add AoIP specific elements to gsm0808_create_... functions the classic A implementation in libosmocore lacks support for AoIP message elements. This patch adds support for AoIP by adding a set of new gsm0808_create_..., which support the missing AoIP message elements Change-Id: I77f866abec1822d19871052f3c647ad782785b34 --- M include/osmocom/gsm/gsm0808.h M src/gsm/gsm0808.c M src/gsm/libosmogsm.map M tests/gsm0808/gsm0808_test.c M tests/gsm0808/gsm0808_test.ok 5 files changed, 225 insertions(+), 18 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/78/2178/3 diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h index a7e102c..fd0d5ee 100644 --- a/include/osmocom/gsm/gsm0808.h +++ b/include/osmocom/gsm/gsm0808.h @@ -20,10 +20,16 @@ #pragma once #include "tlv.h" +#include +#include struct msgb; -struct msgb *gsm0808_create_layer3(struct msgb *msg, uint16_t netcode, uint16_t countrycode, int lac, uint16_t ci); +struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, + uint16_t cc, int lac, uint16_t _ci); +struct msgb *gsm0808_create_layer3_aoip(struct msgb *msg_l3, uint16_t nc, + uint16_t cc, int lac, uint16_t _ci, + struct gsm0808_speech_codec_list *scl); struct msgb *gsm0808_create_reset(void); struct msgb *gsm0808_create_reset_ack(void); struct msgb *gsm0808_create_clear_command(uint8_t reason); @@ -33,9 +39,25 @@ struct msgb *gsm0808_create_classmark_update(const uint8_t *cm2, uint8_t cm2_len, const uint8_t *cm3, uint8_t cm3_len); struct msgb *gsm0808_create_sapi_reject(uint8_t link_id); +struct msgb *gsm0808_create_assignment_completed_aoip(uint8_t rr_cause, + uint8_t chosen_channel, + uint8_t encr_alg_id, + uint8_t speech_mode, + struct sockaddr_storage + *ss, struct + gsm0808_speech_codec *sc, + struct + gsm0808_speech_codec_list + *scl); struct msgb *gsm0808_create_assignment_completed(uint8_t rr_cause, -uint8_t chosen_channel, uint8_t encr_alg_id, +uint8_t chosen_channel, +uint8_t encr_alg_id, uint8_t speech_mode); +struct msgb *gsm0808_create_assignment_failure_aoip(uint8_t cause, + uint8_t *rr_cause, + struct + gsm0808_speech_codec_list + *scl); struct msgb *gsm0808_create_assignment_failure(uint8_t cause, uint8_t *rr_cause); struct msgb *gsm0808_create_clear_rqst(uint8_t cause); diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c index de80006..0dc7b8e 100644 --- a/src/gsm/gsm0808.c +++ b/src/gsm/gsm0808.c @@ -19,6 +19,7 @@ */ #include +#include #include #include @@ -27,17 +28,19 @@ #define BSSMAP_MSG_SIZE 512 #define BSSMAP_MSG_HEADROOM 128 -struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, uint16_t cc, int lac, uint16_t _ci) +struct msgb *gsm0808_create_layer3_aoip(struct msgb *msg_l3, uint16_t nc, + uint16_t cc, int lac, uint16_t _ci, + struct gsm0808_speech_codec_list *scl) { - struct msgb* msg; + struct msgb *msg; struct { uint8_t ident; struct gsm48_loc_area_id lai; uint16_t ci; } __attribute__ ((packed)) lai_ci; - msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, - "bssmap cmpl l3"); + msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, + "bssmap cmpl l3"); if (!msg) return NULL; @@ -49,16 +52,27 @@ gsm48_generate_lai(_ci.lai, cc, nc, lac); lai_ci.ci = htons(_ci); msgb_tlv_put(msg, GSM0808_IE_CELL_IDENTIFIER, sizeof(lai_ci), -(uint8_t *) _ci); +(uint8_t *) & lai_ci); /* copy the layer3 data */ msgb_tlv_put(msg, GSM0808_IE_LAYER_3_INFORMATION,
libosmocore[master]: gsm0808: Add AoIP specific elements to gsm0808_create_... fu...
Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/2178/2/src/gsm/gsm0808.c File src/gsm/gsm0808.c: Line 64:scl_encoded = gsm0808_enc_speech_codec_list(scl); why not simply pass the msgb into the gsm0808_enc_speech_codec_list() function, so that function will msgb_put() it at the [current] end of the message? -- To view, visit https://gerrit.osmocom.org/2178 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I77f866abec1822d19871052f3c647ad782785b34 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: dexterGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes
[PATCH] libosmocore[master]: gsm0808: Add AoIP specific elements to gsm0808_create_... fu...
Review at https://gerrit.osmocom.org/2178 gsm0808: Add AoIP specific elements to gsm0808_create_... functions the classic A implementation in libosmocore lacks support for AoIP message elements. This patch adds support for AoIP by adding a set of new gsm0808_create_..., which support the missing AoIP message elements Change-Id: I77f866abec1822d19871052f3c647ad782785b34 --- M include/osmocom/gsm/gsm0808.h M src/gsm/gsm0808.c M src/gsm/libosmogsm.map M tests/gsm0808/gsm0808_test.c M tests/gsm0808/gsm0808_test.ok 5 files changed, 284 insertions(+), 18 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/78/2178/1 diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h index a7e102c..7ef62b2 100644 --- a/include/osmocom/gsm/gsm0808.h +++ b/include/osmocom/gsm/gsm0808.h @@ -20,10 +20,16 @@ #pragma once #include "tlv.h" +#include +#include struct msgb; -struct msgb *gsm0808_create_layer3(struct msgb *msg, uint16_t netcode, uint16_t countrycode, int lac, uint16_t ci); +struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, + uint16_t cc, int lac, uint16_t _ci); +struct msgb *gsm0808_create_layer3_aoip(struct msgb *msg_l3, uint16_t nc, + uint16_t cc, int lac, uint16_t _ci, + struct llist_head *scl); struct msgb *gsm0808_create_reset(void); struct msgb *gsm0808_create_reset_ack(void); struct msgb *gsm0808_create_clear_command(uint8_t reason); @@ -33,9 +39,22 @@ struct msgb *gsm0808_create_classmark_update(const uint8_t *cm2, uint8_t cm2_len, const uint8_t *cm3, uint8_t cm3_len); struct msgb *gsm0808_create_sapi_reject(uint8_t link_id); +struct msgb *gsm0808_create_assignment_completed_aoip(uint8_t rr_cause, + uint8_t chosen_channel, + uint8_t encr_alg_id, + uint8_t speech_mode, + struct sockaddr_storage + *ss, + struct + gsm0808_speech_codec *sc, + struct llist_head *scl); struct msgb *gsm0808_create_assignment_completed(uint8_t rr_cause, -uint8_t chosen_channel, uint8_t encr_alg_id, +uint8_t chosen_channel, +uint8_t encr_alg_id, uint8_t speech_mode); +struct msgb *gsm0808_create_assignment_failure_aoip(uint8_t cause, + uint8_t *rr_cause, + struct llist_head *scl); struct msgb *gsm0808_create_assignment_failure(uint8_t cause, uint8_t *rr_cause); struct msgb *gsm0808_create_clear_rqst(uint8_t cause); diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c index de80006..c37ce3e 100644 --- a/src/gsm/gsm0808.c +++ b/src/gsm/gsm0808.c @@ -19,6 +19,7 @@ */ #include +#include #include #include @@ -27,17 +28,20 @@ #define BSSMAP_MSG_SIZE 512 #define BSSMAP_MSG_HEADROOM 128 -struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, uint16_t cc, int lac, uint16_t _ci) +struct msgb *gsm0808_create_layer3_aoip(struct msgb *msg_l3, uint16_t nc, + uint16_t cc, int lac, uint16_t _ci, + struct llist_head *scl) { - struct msgb* msg; + struct msgb *msg; + struct msgb *scl_encoded; struct { uint8_t ident; struct gsm48_loc_area_id lai; uint16_t ci; } __attribute__ ((packed)) lai_ci; - msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, - "bssmap cmpl l3"); + msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, + "bssmap cmpl l3"); if (!msg) return NULL; @@ -49,16 +53,35 @@ gsm48_generate_lai(_ci.lai, cc, nc, lac); lai_ci.ci = htons(_ci); msgb_tlv_put(msg, GSM0808_IE_CELL_IDENTIFIER, sizeof(lai_ci), -(uint8_t *) _ci); +(uint8_t *) & lai_ci); /* copy the layer3 data */ msgb_tlv_put(msg, GSM0808_IE_LAYER_3_INFORMATION, msgb_l3len(msg_l3), msg_l3->l3h); + /* AoIP: add Codec List (BSS Supported) 3.2.2.103 */ + if (scl) { + scl_encoded = gsm0808_enc_speech_codec_list(scl); + if (!scl_encoded) { + msgb_free(msg); +