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 libosmo-gprs[master]: llc: fix warning: 'struct msgb' declared inside parameter list
by fixeria 26 Sep '22

26 Sep '22
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/29479 ) Change subject: llc: fix warning: 'struct msgb' declared inside parameter list ...................................................................... llc: fix warning: 'struct msgb' declared inside parameter list Change-Id: Idecb64f4838106a166f6a5cba5536a61de71c152 --- M include/osmocom/gprs/llc/llc.h 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/79/29479/1 diff --git a/include/osmocom/gprs/llc/llc.h b/include/osmocom/gprs/llc/llc.h index 510b11c..7a4ac03 100644 --- a/include/osmocom/gprs/llc/llc.h +++ b/include/osmocom/gprs/llc/llc.h @@ -5,6 +5,8 @@ #include <stdint.h> #include <stddef.h> +#include <osmocom/core/msgb.h> + /* Section 6.2.3 Service Access Point Identifier (SAPI) */ enum osmo_gprs_llc_sapi { OSMO_GPRS_LLC_SAPI_GMM = 1, -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/29479 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: Idecb64f4838106a166f6a5cba5536a61de71c152 Gerrit-Change-Number: 29479 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in libosmo-gprs[master]: llc: add value-string for enum osmo_gprs_llc_xid_type
by fixeria 26 Sep '22

26 Sep '22
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/29480 ) Change subject: llc: add value-string for enum osmo_gprs_llc_xid_type ...................................................................... llc: add value-string for enum osmo_gprs_llc_xid_type Change-Id: I90b6a1aa4e13984f4c43245df1308d0c3f82636f --- M include/osmocom/gprs/llc/llc.h M src/llc/Makefile.am A src/llc/llc_xid.c 3 files changed, 50 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/80/29480/1 diff --git a/include/osmocom/gprs/llc/llc.h b/include/osmocom/gprs/llc/llc.h index 7a4ac03..7c4ea45 100644 --- a/include/osmocom/gprs/llc/llc.h +++ b/include/osmocom/gprs/llc/llc.h @@ -85,6 +85,13 @@ OSMO_GPRS_LLC_XID_T_RESET = 12, }; +extern const struct value_string osmo_gprs_llc_xid_type_names[]; + +static inline const char *osmo_gprs_llc_xid_type_name(enum osmo_gprs_llc_xid_type val) +{ + return get_value_string(osmo_gprs_llc_xid_type_names, val); +} + /* Section 4.5.2 Logical Link States + Annex C.2 */ enum osmo_gprs_llc_lle_state { OSMO_GPRS_LLC_LLES_UNASSIGNED = 1, /* No TLLI yet */ diff --git a/src/llc/Makefile.am b/src/llc/Makefile.am index a301a89..6c0e680 100644 --- a/src/llc/Makefile.am +++ b/src/llc/Makefile.am @@ -24,6 +24,7 @@ libosmo_gprs_llc_la_SOURCES = \ crc24.c \ llc_pdu.c \ + llc_xid.c \ misc.c \ $(NULL) diff --git a/src/llc/llc_xid.c b/src/llc/llc_xid.c new file mode 100644 index 0000000..1705e5d --- /dev/null +++ b/src/llc/llc_xid.c @@ -0,0 +1,42 @@ +/* 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_xid_type_names[] = { + { OSMO_GPRS_LLC_XID_T_VERSION, "LLC-Version" }, + { OSMO_GPRS_LLC_XID_T_IOV_UI, "IOV-UI" }, + { OSMO_GPRS_LLC_XID_T_IOV_I, "IOV-I" }, + { OSMO_GPRS_LLC_XID_T_T200, "T200" }, + { OSMO_GPRS_LLC_XID_T_N200, "N200" }, + { OSMO_GPRS_LLC_XID_T_N201_U, "N201-U" }, + { OSMO_GPRS_LLC_XID_T_N201_I, "N201-I" }, + { OSMO_GPRS_LLC_XID_T_mD, "mD" }, + { OSMO_GPRS_LLC_XID_T_mU, "mU" }, + { OSMO_GPRS_LLC_XID_T_kD, "kD" }, + { OSMO_GPRS_LLC_XID_T_kU, "kU" }, + { OSMO_GPRS_LLC_XID_T_L3_PAR, "L3-Params" }, + { OSMO_GPRS_LLC_XID_T_RESET, "Reset" }, + { 0, NULL } +}; -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/29480 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: I90b6a1aa4e13984f4c43245df1308d0c3f82636f Gerrit-Change-Number: 29480 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in libosmo-gprs[master]: .gitignore: add missing debian/libosmo-gprs-llc*
by fixeria 26 Sep '22

26 Sep '22
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/29478 ) Change subject: .gitignore: add missing debian/libosmo-gprs-llc* ...................................................................... .gitignore: add missing debian/libosmo-gprs-llc* Change-Id: I31ad48b75a5e2dfdce05731ab90146d66c776581 --- M .gitignore 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/78/29478/1 diff --git a/.gitignore b/.gitignore index 6efb54d..ee800c0 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ # debian build products debian/libosmo-gprs-rlcmac* +debian/libosmo-gprs-llc* debian/libosmo-csn1* debian/autoreconf.* debian/.debhelper -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/29478 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: I31ad48b75a5e2dfdce05731ab90146d66c776581 Gerrit-Change-Number: 29478 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-bsc[master]: pcu_sock: check size of primitive
by Jenkins Builder 26 Sep '22

26 Sep '22
Attention is currently required from: pespin, dexter. Jenkins Builder has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/29361 ) Change subject: pcu_sock: check size of primitive ...................................................................... Patch Set 2: (4 comments) File include/osmocom/bsc/pcu_if.h: Robot Comment from checkpatch (run ID jenkins-gerrit-osmo-bsc-lint-905): https://gerrit.osmocom.org/c/osmo-bsc/+/29361/comment/dd66f43b_0c3d8c58 PS2, Line 8: #define PCUIF_HDR_SIZE ( sizeof(struct gsm_pcu_if) - sizeof(((struct gsm_pcu_if *)0)->u) ) space prohibited after that open parenthesis '(' Robot Comment from checkpatch (run ID jenkins-gerrit-osmo-bsc-lint-905): https://gerrit.osmocom.org/c/osmo-bsc/+/29361/comment/583033d3_c0498f1f PS2, Line 8: #define PCUIF_HDR_SIZE ( sizeof(struct gsm_pcu_if) - sizeof(((struct gsm_pcu_if *)0)->u) ) space prohibited before that close parenthesis ')' File src/osmo-bsc/pcu_sock.c: Robot Comment from checkpatch (run ID jenkins-gerrit-osmo-bsc-lint-905): https://gerrit.osmocom.org/c/osmo-bsc/+/29361/comment/8666ecb5_4dafd5ed PS2, Line 451: #define CHECK_IF_MSG_SIZE(prim_len, prim_msg) \ do {} while (0) macros should not be semicolon terminated Robot Comment from checkpatch (run ID jenkins-gerrit-osmo-bsc-lint-905): https://gerrit.osmocom.org/c/osmo-bsc/+/29361/comment/5e7c14f0_983bc394 PS2, Line 459: } while(0); space required before the open parenthesis '(' -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/29361 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I247c6f4b5a7a22d17a060a558c4ceb9221ca7351 Gerrit-Change-Number: 29361 Gerrit-PatchSet: 2 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Mon, 26 Sep 2022 09:39:05 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
Change in osmo-msc[master]: Use libsmpputil functions in smpp_mirror tool
by msuraev 26 Sep '22

26 Sep '22
msuraev has submitted this change. ( https://gerrit.osmocom.org/c/osmo-msc/+/28847 ) Change subject: Use libsmpputil functions in smpp_mirror tool ...................................................................... Use libsmpputil functions in smpp_mirror tool Related: OS#5568 Change-Id: Icb046570803acb3eff89e2a4eb979c4899d485f7 --- M include/osmocom/smpp/smpp.h M src/libsmpputil/smpp_smsc.c M src/utils/smpp_mirror.c 3 files changed, 4 insertions(+), 33 deletions(-) Approvals: Jenkins Builder: Verified neels: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve dexter: Looks good to me, but someone else must approve laforge: Looks good to me, approved diff --git a/include/osmocom/smpp/smpp.h b/include/osmocom/smpp/smpp.h index db4101d..54e5de7 100644 --- a/include/osmocom/smpp/smpp.h +++ b/include/osmocom/smpp/smpp.h @@ -49,5 +49,7 @@ struct esme *esme_alloc(void *ctx); uint32_t smpp_msgb_cmdid(struct msgb *msg); +uint32_t esme_inc_seq_nr(struct esme *esme); +int pack_and_send(struct esme *esme, uint32_t type, void *ptr); int smpp_openbsc_alloc_init(void *ctx); int smpp_openbsc_start(struct gsm_network *net); diff --git a/src/libsmpputil/smpp_smsc.c b/src/libsmpputil/smpp_smsc.c index bb559cd..a1f2b2f 100644 --- a/src/libsmpputil/smpp_smsc.c +++ b/src/libsmpputil/smpp_smsc.c @@ -250,7 +250,7 @@ talloc_free(esme); } -static uint32_t esme_inc_seq_nr(struct esme *esme) +uint32_t esme_inc_seq_nr(struct esme *esme) { esme->own_seq_nr++; if (esme->own_seq_nr > 0x7fffffff) @@ -326,7 +326,7 @@ } /*! \brief pack a libsmpp34 data strcutrure and send it to the ESME */ -static int pack_and_send(struct esme *esme, uint32_t type, void *ptr) +int pack_and_send(struct esme *esme, uint32_t type, void *ptr) { struct msgb *msg; int rc, rlen; diff --git a/src/utils/smpp_mirror.c b/src/utils/smpp_mirror.c index 076b434..48b9ea2 100644 --- a/src/utils/smpp_mirror.c +++ b/src/utils/smpp_mirror.c @@ -23,37 +23,6 @@ /* FIXME: merge with smpp_smsc.c */ -static uint32_t esme_inc_seq_nr(struct esme *esme) -{ - esme->own_seq_nr++; - if (esme->own_seq_nr > 0x7fffffff) - esme->own_seq_nr = 1; - - return esme->own_seq_nr; -} -static int pack_and_send(struct esme *esme, uint32_t type, void *ptr) -{ - struct msgb *msg = msgb_alloc(4096, "SMPP_Tx"); - int rc, rlen; - if (!msg) - return -ENOMEM; - - rc = smpp34_pack(type, msg->tail, msgb_tailroom(msg), &rlen, ptr); - if (rc != 0) { - LOGPESMERR(esme, "during smpp34_pack()\n"); - msgb_free(msg); - return -EINVAL; - } - msgb_put(msg, rlen); - - if (osmo_wqueue_enqueue(&esme->wqueue, msg) != 0) { - LOGPESME(esme, LOGL_ERROR, "Write queue full. Dropping message\n"); - msgb_free(msg); - return -EAGAIN; - } - return 0; -} -/* FIXME: merge with smpp_smsc.c */ static struct tlv_t *find_tlv(struct tlv_t *head, uint16_t tag) { 23 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/28847 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: Icb046570803acb3eff89e2a4eb979c4899d485f7 Gerrit-Change-Number: 28847 Gerrit-PatchSet: 29 Gerrit-Owner: msuraev <msuraev(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: msuraev <msuraev(a)sysmocom.de> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-msc[master]: cosmetic: use proper name for SMPP handlers
by msuraev 26 Sep '22

26 Sep '22
msuraev has submitted this change. ( https://gerrit.osmocom.org/c/osmo-msc/+/28840 ) Change subject: cosmetic: use proper name for SMPP handlers ...................................................................... cosmetic: use proper name for SMPP handlers Change-Id: I0d714e927e287a0ea9362008ed050a492510e22b --- M include/osmocom/smpp/smpp.h M src/libsmpputil/smpp_msc.c M src/osmo-msc/msc_main.c 3 files changed, 8 insertions(+), 8 deletions(-) Approvals: Jenkins Builder: Verified neels: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve dexter: Looks good to me, approved diff --git a/include/osmocom/smpp/smpp.h b/include/osmocom/smpp/smpp.h index 54e5de7..a2832d3 100644 --- a/include/osmocom/smpp/smpp.h +++ b/include/osmocom/smpp/smpp.h @@ -51,5 +51,5 @@ uint32_t smpp_msgb_cmdid(struct msgb *msg); uint32_t esme_inc_seq_nr(struct esme *esme); int pack_and_send(struct esme *esme, uint32_t type, void *ptr); -int smpp_openbsc_alloc_init(void *ctx); -int smpp_openbsc_start(struct gsm_network *net); +int smpp_msc_alloc_init(void *ctx); +int smpp_msc_start(struct gsm_network *net); diff --git a/src/libsmpputil/smpp_msc.c b/src/libsmpputil/smpp_msc.c index 1e0ccdd..4a980ab 100644 --- a/src/libsmpputil/smpp_msc.c +++ b/src/libsmpputil/smpp_msc.c @@ -824,8 +824,8 @@ return g_smsc; } -/*! \brief Allocate the OpenBSC SMPP interface struct and init VTY. */ -int smpp_openbsc_alloc_init(void *ctx) +/*! \brief Allocate the OsmoMSC SMPP interface struct and init VTY. */ +int smpp_msc_alloc_init(void *ctx) { g_smsc = smpp_smsc_alloc_init(ctx); if (!g_smsc) { @@ -836,9 +836,9 @@ return smpp_vty_init(); } -/*! \brief Launch the OpenBSC SMPP interface with the parameters set from VTY. +/*! \brief Launch the OsmoMSC SMPP interface with the parameters set from VTY. */ -int smpp_openbsc_start(struct gsm_network *net) +int smpp_msc_start(struct gsm_network *net) { int rc; g_smsc->priv = net; diff --git a/src/osmo-msc/msc_main.c b/src/osmo-msc/msc_main.c index 4ef5948..9cc4120 100644 --- a/src/osmo-msc/msc_main.c +++ b/src/osmo-msc/msc_main.c @@ -608,7 +608,7 @@ } #ifdef BUILD_SMPP - if (smpp_openbsc_alloc_init(tall_msc_ctx) < 0) + if (smpp_msc_alloc_init(tall_msc_ctx) < 0) return -1; #endif sgs_iface_init(tall_msc_ctx, msc_network); @@ -652,7 +652,7 @@ * following code until iu_init() is legacy. */ #ifdef BUILD_SMPP - smpp_openbsc_start(msc_network); + smpp_msc_start(msc_network); #endif /* start control interface after reading config for 22 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/28840 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: I0d714e927e287a0ea9362008ed050a492510e22b Gerrit-Change-Number: 28840 Gerrit-PatchSet: 28 Gerrit-Owner: msuraev <msuraev(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: msuraev <msuraev(a)sysmocom.de> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-msc[master]: Make esme struct shared
by msuraev 26 Sep '22

26 Sep '22
msuraev has submitted this change. ( https://gerrit.osmocom.org/c/osmo-msc/+/28846 ) Change subject: Make esme struct shared ...................................................................... Make esme struct shared This helps to merge similar code from smpp_mirror and smpp_* in follow-up patches. Related: OS#5568 Change-Id: I8f7ac2c00d16660925dd0b03aa1a0973edf9eb70 --- M include/osmocom/msc/gsm_data.h M include/osmocom/smpp/smpp.h M include/osmocom/smpp/smpp_smsc.h M src/libsmpputil/smpp_msc.c M src/libsmpputil/smpp_smsc.c M src/libsmpputil/smpp_vty.c M src/utils/Makefile.am M src/utils/smpp_mirror.c M tests/stubs.c 9 files changed, 162 insertions(+), 144 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve pespin: Looks good to me, approved Objections: neels: I would prefer this is not merged as is diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h index 78b9c9a..43944e7 100644 --- a/include/osmocom/msc/gsm_data.h +++ b/include/osmocom/msc/gsm_data.h @@ -268,7 +268,7 @@ struct sms_queue_config *sms_queue_cfg; }; -struct osmo_esme; +struct smpp_esme; enum gsm_sms_source_id { SMS_SOURCE_UNKNOWN = 0, @@ -297,7 +297,7 @@ } gsm411; struct { - struct osmo_esme *esme; + struct smpp_esme *esme; uint32_t sequence_nr; int transaction_mode; char msg_id[16]; diff --git a/include/osmocom/smpp/smpp.h b/include/osmocom/smpp/smpp.h index df5e163..db4101d 100644 --- a/include/osmocom/smpp/smpp.h +++ b/include/osmocom/smpp/smpp.h @@ -11,6 +11,21 @@ READ_ST_IN_MSG = 1, }; +/* struct representing SMPP's External Short Messaging Entity */ +struct esme { + uint32_t own_seq_nr; + + struct osmo_wqueue wqueue; + enum esme_read_state read_state; + uint32_t read_len; + uint32_t read_idx; + struct msgb *read_msg; + + uint8_t smpp_version; + char system_id[SMPP_SYS_ID_LEN + 1]; + char password[SMPP_SYS_ID_LEN + 1]; +}; + #define LOGPESME(ESME, LEVEL, FMT, ARGS...) \ LOGP(DSMPP, LEVEL, "[%s] " FMT, (ESME)->system_id, ##ARGS) @@ -32,6 +47,7 @@ (resp)->command_status = ESME_ROK; \ (resp)->sequence_number = (req)->sequence_number; } +struct esme *esme_alloc(void *ctx); uint32_t smpp_msgb_cmdid(struct msgb *msg); int smpp_openbsc_alloc_init(void *ctx); int smpp_openbsc_start(struct gsm_network *net); diff --git a/include/osmocom/smpp/smpp_smsc.h b/include/osmocom/smpp/smpp_smsc.h index fb5164f..9607079 100644 --- a/include/osmocom/smpp/smpp_smsc.h +++ b/include/osmocom/smpp/smpp_smsc.h @@ -26,33 +26,24 @@ char addr[21+1]; }; -struct osmo_esme { +/* struct wrapping ESME struct with additional SMSC-specific things like ACL, command list etc */ +struct smpp_esme { struct llist_head list; struct smsc *smsc; + struct esme *esme; struct osmo_smpp_acl *acl; int use; struct llist_head smpp_cmd_list; - uint32_t own_seq_nr; - - struct osmo_wqueue wqueue; - - enum esme_read_state read_state; - uint32_t read_len; - uint32_t read_idx; - struct msgb *read_msg; - uint8_t smpp_version; - char system_id[SMPP_SYS_ID_LEN+1]; - uint8_t bind_flags; }; struct osmo_smpp_acl { struct llist_head list; struct smsc *smsc; - struct osmo_esme *esme; + struct smpp_esme *esme; char *description; char system_id[SMPP_SYS_ID_LEN+1]; char passwd[SMPP_PASSWD_LEN+1]; @@ -89,11 +80,11 @@ struct osmo_timer_list response_timer; }; -struct osmo_smpp_cmd *smpp_cmd_find_by_seqnum(struct osmo_esme *esme, +struct osmo_smpp_cmd *smpp_cmd_find_by_seqnum(struct smpp_esme *esme, uint32_t sequence_number); void smpp_cmd_ack(struct osmo_smpp_cmd *cmd); void smpp_cmd_err(struct osmo_smpp_cmd *cmd, uint32_t status); -void smpp_cmd_flush_pending(struct osmo_esme *esme); +void smpp_cmd_flush_pending(struct smpp_esme *esme); struct smsc { struct osmo_fd listen_ofd; @@ -118,25 +109,25 @@ int smpp_smsc_restart(struct smsc *smsc, const char *bind_addr, uint16_t port); void smpp_smsc_stop(struct smsc *smsc); -void smpp_esme_get(struct osmo_esme *esme); -void smpp_esme_put(struct osmo_esme *esme); +void smpp_esme_get(struct smpp_esme *esme); +void smpp_esme_put(struct smpp_esme *esme); -int smpp_route(const struct smsc *smsc, const struct osmo_smpp_addr *dest, struct osmo_esme **emse); +int smpp_route(const struct smsc *smsc, const struct osmo_smpp_addr *dest, struct smpp_esme **emse); struct osmo_smpp_acl *smpp_acl_alloc(struct smsc *smsc, const char *sys_id); struct osmo_smpp_acl *smpp_acl_by_system_id(struct smsc *smsc, const char *sys_id); void smpp_acl_delete(struct osmo_smpp_acl *acl); -int smpp_tx_submit_r(struct osmo_esme *esme, uint32_t sequence_nr, +int smpp_tx_submit_r(struct smpp_esme *esme, uint32_t sequence_nr, uint32_t command_status, char *msg_id); -int smpp_tx_alert(struct osmo_esme *esme, uint8_t ton, uint8_t npi, +int smpp_tx_alert(struct smpp_esme *esme, uint8_t ton, uint8_t npi, const char *addr, uint8_t avail_status); -int smpp_tx_deliver(struct osmo_esme *esme, struct deliver_sm_t *deliver); +int smpp_tx_deliver(struct smpp_esme *esme, struct deliver_sm_t *deliver); -int handle_smpp_submit(struct osmo_esme *esme, struct submit_sm_t *submit, +int handle_smpp_submit(struct smpp_esme *esme, struct submit_sm_t *submit, struct submit_sm_resp_t *submit_r); int smpp_route_pfx_add(struct osmo_smpp_acl *acl, diff --git a/src/libsmpputil/smpp_msc.c b/src/libsmpputil/smpp_msc.c index cc618cd..1e0ccdd 100644 --- a/src/libsmpputil/smpp_msc.c +++ b/src/libsmpputil/smpp_msc.c @@ -278,7 +278,7 @@ } /*! \brief handle incoming libsmpp34 ssubmit_sm_t from remote ESME */ -int handle_smpp_submit(struct osmo_esme *esme, struct submit_sm_t *submit, +int handle_smpp_submit(struct smpp_esme *esme, struct submit_sm_t *submit, struct submit_sm_resp_t *submit_r) { struct gsm_sms *sms; @@ -329,7 +329,7 @@ static void alert_all_esme(struct smsc *smsc, struct vlr_subscr *vsub, uint8_t smpp_avail_status) { - struct osmo_esme *esme; + struct smpp_esme *esme; llist_for_each_entry(esme, &smsc->esme_list, list) { /* we currently send an alert notification to each ESME that is @@ -341,7 +341,7 @@ continue; } if (esme->acl && !esme->acl->alert_notifications) { - LOGPESME(esme, LOGL_DEBUG, "is not set to receive Alert Notifications\n"); + LOGPESME(esme->esme, LOGL_DEBUG, "is not set to receive Alert Notifications\n"); continue; } if (esme->acl && esme->acl->deliver_src_imsi) { @@ -585,7 +585,7 @@ talloc_free(cmd); } -void smpp_cmd_flush_pending(struct osmo_esme *esme) +void smpp_cmd_flush_pending(struct smpp_esme *esme) { struct osmo_smpp_cmd *cmd, *next; @@ -653,7 +653,7 @@ smpp_cmd_err(data, ESME_RSYSERR); } -static int smpp_cmd_enqueue(struct osmo_esme *esme, +static int smpp_cmd_enqueue(struct smpp_esme *esme, struct vlr_subscr *vsub, struct gsm_sms *sms, uint32_t sequence_number) { @@ -682,7 +682,7 @@ return 0; } -struct osmo_smpp_cmd *smpp_cmd_find_by_seqnum(struct osmo_esme *esme, +struct osmo_smpp_cmd *smpp_cmd_find_by_seqnum(struct smpp_esme *esme, uint32_t sequence_nr) { struct osmo_smpp_cmd *cmd; @@ -694,7 +694,7 @@ return NULL; } -static int deliver_to_esme(struct osmo_esme *esme, struct gsm_sms *sms, +static int deliver_to_esme(struct smpp_esme *esme, struct gsm_sms *sms, struct msc_a *msc_a) { struct deliver_sm_t deliver; @@ -802,7 +802,7 @@ int smpp_try_deliver(struct gsm_sms *sms, struct msc_a *msc_a) { - struct osmo_esme *esme; + struct smpp_esme *esme; struct osmo_smpp_addr dst; int rc; diff --git a/src/libsmpputil/smpp_smsc.c b/src/libsmpputil/smpp_smsc.c index 4cc76f5..bb559cd 100644 --- a/src/libsmpputil/smpp_smsc.c +++ b/src/libsmpputil/smpp_smsc.c @@ -159,12 +159,12 @@ /* kill any active ESMEs */ if (acl->esme) { - struct osmo_esme *esme = acl->esme; + struct esme *esme = acl->esme->esme; osmo_fd_unregister(&esme->wqueue.bfd); close(esme->wqueue.bfd.fd); esme->wqueue.bfd.fd = -1; - esme->acl = NULL; - smpp_esme_put(esme); + acl->esme = NULL; + smpp_esme_put(acl->esme); } /* delete all routes for this ACL */ @@ -231,17 +231,17 @@ /*! \brief increaes the use/reference count */ -void smpp_esme_get(struct osmo_esme *esme) +void smpp_esme_get(struct smpp_esme *esme) { esme->use++; } -static void esme_destroy(struct osmo_esme *esme) +static void esme_destroy(struct smpp_esme *esme) { - osmo_wqueue_clear(&esme->wqueue); - if (esme->wqueue.bfd.fd >= 0) { - osmo_fd_unregister(&esme->wqueue.bfd); - close(esme->wqueue.bfd.fd); + osmo_wqueue_clear(&esme->esme->wqueue); + if (esme->esme->wqueue.bfd.fd >= 0) { + osmo_fd_unregister(&esme->esme->wqueue.bfd); + close(esme->esme->wqueue.bfd.fd); } smpp_cmd_flush_pending(esme); llist_del(&esme->list); @@ -250,7 +250,7 @@ talloc_free(esme); } -static uint32_t esme_inc_seq_nr(struct osmo_esme *esme) +static uint32_t esme_inc_seq_nr(struct esme *esme) { esme->own_seq_nr++; if (esme->own_seq_nr > 0x7fffffff) @@ -260,7 +260,7 @@ } /*! \brief decrease the use/reference count, free if it is 0 */ -void smpp_esme_put(struct osmo_esme *esme) +void smpp_esme_put(struct smpp_esme *esme) { esme->use--; if (esme->use <= 0) @@ -268,7 +268,7 @@ } /*! \brief try to find a SMPP route (ESME) for given destination */ -int smpp_route(const struct smsc *smsc, const struct osmo_smpp_addr *dest, struct osmo_esme **pesme) +int smpp_route(const struct smsc *smsc, const struct osmo_smpp_addr *dest, struct smpp_esme **pesme) { struct osmo_smpp_route *r; struct osmo_smpp_acl *acl = NULL; @@ -308,14 +308,14 @@ } if (acl && acl->esme) { - struct osmo_esme *esme; + struct smpp_esme *esme; DEBUGP(DSMPP, "ACL even has ESME, we can route to it!\n"); esme = acl->esme; if (esme->bind_flags & ESME_BIND_RX) { *pesme = esme; return 0; } else - LOGPESME(esme, LOGL_NOTICE, "is matching route, but not bound for Rx, discarding MO SMS\n"); + LOGPESME(esme->esme, LOGL_NOTICE, "is matching route, but not bound for Rx, discarding MO SMS\n"); } *pesme = NULL; @@ -326,7 +326,7 @@ } /*! \brief pack a libsmpp34 data strcutrure and send it to the ESME */ -static int pack_and_send(struct osmo_esme *esme, uint32_t type, void *ptr) +static int pack_and_send(struct esme *esme, uint32_t type, void *ptr) { struct msgb *msg; int rc, rlen; @@ -357,7 +357,7 @@ } /*! \brief transmit a generic NACK to a remote ESME */ -static int smpp_tx_gen_nack(struct osmo_esme *esme, uint32_t seq, uint32_t status) +static int smpp_tx_gen_nack(struct esme *esme, uint32_t seq, uint32_t status) { struct generic_nack_t nack; char buf[SMALL_BUFF]; @@ -380,7 +380,7 @@ } /*! \brief handle an incoming SMPP generic NACK */ -static int smpp_handle_gen_nack(struct osmo_esme *esme, struct msgb *msg) +static int smpp_handle_gen_nack(struct esme *esme, struct msgb *msg) { struct generic_nack_t nack; char buf[SMALL_BUFF]; @@ -398,7 +398,7 @@ return 0; } -static int _process_bind(struct osmo_esme *esme, uint8_t if_version, +static int _process_bind(struct smpp_esme *esme, uint8_t if_version, uint32_t bind_flags, const char *sys_id, const char *passwd) { @@ -411,9 +411,9 @@ return ESME_RALYBND; esme->smpp_version = if_version; - snprintf(esme->system_id, sizeof(esme->system_id), "%s", sys_id); + snprintf(esme->esme->system_id, sizeof(esme->esme->system_id), "%s", sys_id); - acl = smpp_acl_by_system_id(esme->smsc, esme->system_id); + acl = smpp_acl_by_system_id(esme->smsc, esme->esme->system_id); if (!esme->smsc->accept_all) { if (!acl) { /* This system is unknown */ @@ -437,7 +437,7 @@ /*! \brief handle an incoming SMPP BIND RECEIVER */ -static int smpp_handle_bind_rx(struct osmo_esme *esme, struct msgb *msg) +static int smpp_handle_bind_rx(struct smpp_esme *esme, struct msgb *msg) { struct bind_receiver_t bind; struct bind_receiver_resp_t bind_r; @@ -446,7 +446,7 @@ SMPP34_UNPACK(rc, BIND_RECEIVER, &bind, msgb_data(msg), msgb_length(msg)); if (rc < 0) { - LOGPESMERR(esme, "in smpp34_unpack()\n"); + LOGPESMERR(esme->esme, "in smpp34_unpack()\n"); return rc; } @@ -459,11 +459,11 @@ (const char *)bind.system_id, (const char *)bind.password); bind_r.command_status = rc; - return PACK_AND_SEND(esme, &bind_r); + return PACK_AND_SEND(esme->esme, &bind_r); } /*! \brief handle an incoming SMPP BIND TRANSMITTER */ -static int smpp_handle_bind_tx(struct osmo_esme *esme, struct msgb *msg) +static int smpp_handle_bind_tx(struct smpp_esme *esme, struct msgb *msg) { struct bind_transmitter_t bind; struct bind_transmitter_resp_t bind_r; @@ -473,7 +473,7 @@ SMPP34_UNPACK(rc, BIND_TRANSMITTER, &bind, msgb_data(msg), msgb_length(msg)); if (rc < 0) { - LOGPESMERR(esme, "in smpp34_unpack()\n"); + LOGPESMERR(esme->esme, "in smpp34_unpack()\n"); return rc; } @@ -495,13 +495,13 @@ tlv.value.val16 = esme->smpp_version; build_tlv(&bind_r.tlv, &tlv); - rc = PACK_AND_SEND(esme, &bind_r); + rc = PACK_AND_SEND(esme->esme, &bind_r); destroy_tlv(bind_r.tlv); return rc; } /*! \brief handle an incoming SMPP BIND TRANSCEIVER */ -static int smpp_handle_bind_trx(struct osmo_esme *esme, struct msgb *msg) +static int smpp_handle_bind_trx(struct smpp_esme *esme, struct msgb *msg) { struct bind_transceiver_t bind; struct bind_transceiver_resp_t bind_r; @@ -510,7 +510,7 @@ SMPP34_UNPACK(rc, BIND_TRANSCEIVER, &bind, msgb_data(msg), msgb_length(msg)); if (rc < 0) { - LOGPESMERR(esme, "in smpp34_unpack()\n"); + LOGPESMERR(esme->esme, "in smpp34_unpack()\n"); return rc; } @@ -523,11 +523,11 @@ (const char *)bind.system_id, (const char *)bind.password); bind_r.command_status = rc; - return PACK_AND_SEND(esme, &bind_r); + return PACK_AND_SEND(esme->esme, &bind_r); } /*! \brief handle an incoming SMPP UNBIND */ -static int smpp_handle_unbind(struct osmo_esme *esme, struct msgb *msg) +static int smpp_handle_unbind(struct smpp_esme *esme, struct msgb *msg) { struct unbind_t unbind; struct unbind_resp_t unbind_r; @@ -536,13 +536,13 @@ SMPP34_UNPACK(rc, UNBIND, &unbind, msgb_data(msg), msgb_length(msg)); if (rc < 0) { - LOGPESMERR(esme, "in smpp34_unpack()\n"); + LOGPESMERR(esme->esme, "in smpp34_unpack()\n"); return rc; } INIT_RESP(UNBIND_RESP, &unbind_r, &unbind); - LOGPESME(esme, LOGL_INFO, "Rx UNBIND\n"); + LOGPESME(esme->esme, LOGL_INFO, "Rx UNBIND\n"); if (esme->bind_flags == 0) { unbind_r.command_status = ESME_RINVBNDSTS; @@ -551,11 +551,11 @@ esme->bind_flags = 0; err: - return PACK_AND_SEND(esme, &unbind_r); + return PACK_AND_SEND(esme->esme, &unbind_r); } /*! \brief handle an incoming SMPP ENQUIRE LINK */ -static int smpp_handle_enq_link(struct osmo_esme *esme, struct msgb *msg) +static int smpp_handle_enq_link(struct smpp_esme *esme, struct msgb *msg) { struct enquire_link_t enq; struct enquire_link_resp_t enq_r; @@ -564,21 +564,21 @@ SMPP34_UNPACK(rc, ENQUIRE_LINK, &enq, msgb_data(msg), msgb_length(msg)); if (rc < 0) { - LOGPESMERR(esme, "in smpp34_unpack()\n"); + LOGPESMERR(esme->esme, "in smpp34_unpack()\n"); return rc; } - LOGPESME(esme, LOGL_DEBUG, "Rx Enquire Link\n"); + LOGPESME(esme->esme, LOGL_DEBUG, "Rx Enquire Link\n"); INIT_RESP(ENQUIRE_LINK_RESP, &enq_r, &enq); - LOGPESME(esme, LOGL_DEBUG, "Tx Enquire Link Response\n"); + LOGPESME(esme->esme, LOGL_DEBUG, "Tx Enquire Link Response\n"); - return PACK_AND_SEND(esme, &enq_r); + return PACK_AND_SEND(esme->esme, &enq_r); } /*! \brief send a SUBMIT-SM RESPONSE to a remote ESME */ -int smpp_tx_submit_r(struct osmo_esme *esme, uint32_t sequence_nr, +int smpp_tx_submit_r(struct smpp_esme *esme, uint32_t sequence_nr, uint32_t command_status, char *msg_id) { struct submit_sm_resp_t submit_r; @@ -590,7 +590,7 @@ submit_r.sequence_number= sequence_nr; snprintf((char *) submit_r.message_id, sizeof(submit_r.message_id), "%s", msg_id); - return PACK_AND_SEND(esme, &submit_r); + return PACK_AND_SEND(esme->esme, &submit_r); } static const struct value_string smpp_avail_strs[] = { @@ -601,7 +601,7 @@ }; /*! \brief send an ALERT_NOTIFICATION to a remote ESME */ -int smpp_tx_alert(struct osmo_esme *esme, uint8_t ton, uint8_t npi, +int smpp_tx_alert(struct smpp_esme *esme, uint8_t ton, uint8_t npi, const char *addr, uint8_t avail_status) { struct alert_notification_t alert; @@ -612,7 +612,7 @@ alert.command_length = 0; alert.command_id = ALERT_NOTIFICATION; alert.command_status = ESME_ROK; - alert.sequence_number = esme_inc_seq_nr(esme); + alert.sequence_number = esme_inc_seq_nr(esme->esme); alert.source_addr_ton = ton; alert.source_addr_npi = npi; snprintf((char *)alert.source_addr, sizeof(alert.source_addr), "%s", addr); @@ -622,28 +622,28 @@ tlv.value.val08 = avail_status; build_tlv(&alert.tlv, &tlv); - LOGPESME(esme, LOGL_DEBUG, "Tx ALERT_NOTIFICATION (%s/%u/%u): %s\n", + LOGPESME(esme->esme, LOGL_DEBUG, "Tx ALERT_NOTIFICATION (%s/%u/%u): %s\n", alert.source_addr, alert.source_addr_ton, alert.source_addr_npi, get_value_string(smpp_avail_strs, avail_status)); - rc = PACK_AND_SEND(esme, &alert); + rc = PACK_AND_SEND(esme->esme, &alert); destroy_tlv(alert.tlv); return rc; } /* \brief send a DELIVER-SM message to given ESME */ -int smpp_tx_deliver(struct osmo_esme *esme, struct deliver_sm_t *deliver) +int smpp_tx_deliver(struct smpp_esme *esme, struct deliver_sm_t *deliver) { - deliver->sequence_number = esme_inc_seq_nr(esme); + deliver->sequence_number = esme_inc_seq_nr(esme->esme); - LOGPESME(esme, LOGL_DEBUG, "Tx DELIVER-SM (from %s)\n", deliver->source_addr); + LOGPESME(esme->esme, LOGL_DEBUG, "Tx DELIVER-SM (from %s)\n", deliver->source_addr); - return PACK_AND_SEND(esme, deliver); + return PACK_AND_SEND(esme->esme, deliver); } /*! \brief handle an incoming SMPP DELIVER-SM RESPONSE */ -static int smpp_handle_deliver_resp(struct osmo_esme *esme, struct msgb *msg) +static int smpp_handle_deliver_resp(struct smpp_esme *esme, struct msgb *msg) { struct deliver_sm_resp_t deliver_r; struct osmo_smpp_cmd *cmd; @@ -653,13 +653,13 @@ SMPP34_UNPACK(rc, DELIVER_SM_RESP, &deliver_r, msgb_data(msg), msgb_length(msg)); if (rc < 0) { - LOGPESMERR(esme, "in smpp34_unpack()\n"); + LOGPESMERR(esme->esme, "in smpp34_unpack()\n"); return rc; } cmd = smpp_cmd_find_by_seqnum(esme, deliver_r.sequence_number); if (!cmd) { - LOGPESME(esme, LOGL_ERROR, "Rx DELIVER-SM RESP !? (%s)\n", + LOGPESME(esme->esme, LOGL_ERROR, "Rx DELIVER-SM RESP !? (%s)\n", get_value_string(smpp_status_strs, deliver_r.command_status)); return -1; } @@ -669,14 +669,14 @@ else smpp_cmd_err(cmd, deliver_r.command_status); - LOGPESME(esme, LOGL_INFO, "Rx DELIVER-SM RESP (%s)\n", + LOGPESME(esme->esme, LOGL_INFO, "Rx DELIVER-SM RESP (%s)\n", get_value_string(smpp_status_strs, deliver_r.command_status)); return 0; } /*! \brief handle an incoming SMPP SUBMIT-SM */ -static int smpp_handle_submit(struct osmo_esme *esme, struct msgb *msg) +static int smpp_handle_submit(struct smpp_esme *esme, struct msgb *msg) { struct submit_sm_t submit; struct submit_sm_resp_t submit_r; @@ -686,7 +686,7 @@ SMPP34_UNPACK(rc, SUBMIT_SM, &submit, msgb_data(msg), msgb_length(msg)); if (rc < 0) { - LOGPESMERR(esme, "in smpp34_unpack()\n"); + LOGPESMERR(esme->esme, "in smpp34_unpack()\n"); return rc; } @@ -694,32 +694,32 @@ if (!(esme->bind_flags & ESME_BIND_TX)) { submit_r.command_status = ESME_RINVBNDSTS; - return PACK_AND_SEND(esme, &submit_r); + return PACK_AND_SEND(esme->esme, &submit_r); } - LOGPESME(esme, LOGL_INFO, "Rx SUBMIT-SM (%s/%u/%u)\n", + LOGPESME(esme->esme, LOGL_INFO, "Rx SUBMIT-SM (%s/%u/%u)\n", submit.destination_addr, submit.dest_addr_ton, submit.dest_addr_npi); INIT_RESP(SUBMIT_SM_RESP, &submit_r, &submit); rc = handle_smpp_submit(esme, &submit, &submit_r); if (rc == 0) - return PACK_AND_SEND(esme, &submit_r); + return PACK_AND_SEND(esme->esme, &submit_r); return rc; } /*! \brief one complete SMPP PDU from the ESME has been received */ -static int smpp_pdu_rx(struct osmo_esme *esme, struct msgb *msg __uses) +static int smpp_pdu_rx(struct smpp_esme *esme, struct msgb *msg __uses) { uint32_t cmd_id = smpp_msgb_cmdid(msg); int rc = 0; - LOGPESME(esme, LOGL_DEBUG, "smpp_pdu_rx(%s)\n", msgb_hexdump(msg)); + LOGPESME(esme->esme, LOGL_DEBUG, "smpp_pdu_rx(%s)\n", msgb_hexdump(msg)); switch (cmd_id) { case GENERIC_NACK: - rc = smpp_handle_gen_nack(esme, msg); + rc = smpp_handle_gen_nack(esme->esme, msg); break; case BIND_RECEIVER: rc = smpp_handle_bind_rx(esme, msg); @@ -750,11 +750,11 @@ case QUERY_SM: case REPLACE_SM: case SUBMIT_MULTI: - LOGPESME(esme, LOGL_NOTICE, "Unimplemented PDU Command 0x%08x\n", cmd_id); + LOGPESME(esme->esme, LOGL_NOTICE, "Unimplemented PDU Command 0x%08x\n", cmd_id); break; default: - LOGPESME(esme, LOGL_ERROR, "Unknown PDU Command 0x%08x\n", cmd_id); - rc = smpp_tx_gen_nack(esme, smpp_msgb_seq(msg), ESME_RINVCMDID); + LOGPESME(esme->esme, LOGL_ERROR, "Unknown PDU Command 0x%08x\n", cmd_id); + rc = smpp_tx_gen_nack(esme->esme, smpp_msgb_seq(msg), ESME_RINVCMDID); break; } @@ -781,7 +781,8 @@ /* !\brief call-back when per-ESME TCP socket has some data to be read */ static int esme_link_read_cb(struct osmo_fd *ofd) { - struct osmo_esme *esme = ofd->data; + struct smpp_esme *e = ofd->data; + struct esme *esme = e->esme; uint32_t len; uint8_t *lenptr = (uint8_t *) &len; uint8_t *cur; @@ -828,7 +829,7 @@ msgb_put(msg, rc); if (esme->read_idx >= esme->read_len) { - rc = smpp_pdu_rx(esme, esme->read_msg); + rc = smpp_pdu_rx(e, esme->read_msg); msgb_free(esme->read_msg); esme->read_msg = NULL; esme->read_idx = 0; @@ -844,9 +845,9 @@ osmo_fd_unregister(&esme->wqueue.bfd); close(esme->wqueue.bfd.fd); esme->wqueue.bfd.fd = -1; - if (esme->acl) - esme->acl->esme = NULL; - smpp_esme_put(esme); + if (e->acl) + e->acl->esme = NULL; + smpp_esme_put(e); return -EBADF; } @@ -854,51 +855,67 @@ /* call-back of write queue once it wishes to write a message to the socket */ static int esme_link_write_cb(struct osmo_fd *ofd, struct msgb *msg) { - struct osmo_esme *esme = ofd->data; + struct smpp_esme *esme = ofd->data; int rc; rc = write(ofd->fd, msgb_data(msg), msgb_length(msg)); if (rc == 0) { - osmo_fd_unregister(&esme->wqueue.bfd); - close(esme->wqueue.bfd.fd); - esme->wqueue.bfd.fd = -1; + osmo_fd_unregister(&esme->esme->wqueue.bfd); + close(esme->esme->wqueue.bfd.fd); + esme->esme->wqueue.bfd.fd = -1; if (esme->acl) esme->acl->esme = NULL; smpp_esme_put(esme); } else if (rc < msgb_length(msg)) { - LOGPESME(esme, LOGL_ERROR, "Short write\n"); + LOGPESME(esme->esme, LOGL_ERROR, "Short write\n"); return -1; } return 0; } +struct esme *esme_alloc(void *ctx) +{ + struct esme *e = talloc_zero(ctx, struct esme); + if (!e) + return NULL; + + e->own_seq_nr = rand(); + esme_inc_seq_nr(e); + osmo_wqueue_init(&e->wqueue, 10); + + return e; +} + /* callback for already-accepted new TCP socket */ static int link_accept_cb(struct smsc *smsc, int fd, struct sockaddr_storage *s, socklen_t s_len) { - struct osmo_esme *esme = talloc_zero(smsc, struct osmo_esme); + struct smpp_esme *esme = talloc_zero(smsc, struct smpp_esme); if (!esme) { close(fd); return -ENOMEM; } + esme->esme = esme_alloc(esme); + if (!esme->esme) { + close(fd); + return -ENOMEM; + } + INIT_LLIST_HEAD(&esme->smpp_cmd_list); smpp_esme_get(esme); - esme->own_seq_nr = rand(); - esme_inc_seq_nr(esme); esme->smsc = smsc; - osmo_wqueue_init(&esme->wqueue, 10); - osmo_fd_setup(&esme->wqueue.bfd, fd, OSMO_FD_READ, osmo_wqueue_bfd_cb, esme, 0); + osmo_fd_setup(&esme->esme->wqueue.bfd, fd, OSMO_FD_READ, osmo_wqueue_bfd_cb, esme, 0); - if (osmo_fd_register(&esme->wqueue.bfd) != 0) { + if (osmo_fd_register(&esme->esme->wqueue.bfd) != 0) { close(fd); talloc_free(esme); return -EIO; } - esme->wqueue.read_cb = esme_link_read_cb; - esme->wqueue.write_cb = esme_link_write_cb; + esme->esme->wqueue.read_cb = esme_link_read_cb; + esme->esme->wqueue.write_cb = esme_link_write_cb; llist_add_tail(&esme->list, &smsc->esme_list); diff --git a/src/libsmpputil/smpp_vty.c b/src/libsmpputil/smpp_vty.c index 40514d4..fe5c22a 100644 --- a/src/libsmpputil/smpp_vty.c +++ b/src/libsmpputil/smpp_vty.c @@ -522,12 +522,12 @@ } -static void dump_one_esme(struct vty *vty, struct osmo_esme *esme) +static void dump_one_esme(struct vty *vty, struct smpp_esme *esme) { vty_out(vty, "ESME System ID: %s, Password: %s, SMPP Version %02x%s", - esme->system_id, esme->acl ? esme->acl->passwd : "", + esme->esme->system_id, esme->acl ? esme->acl->passwd : "", esme->smpp_version, VTY_NEWLINE); - vty_out(vty, " Connection %s%s", osmo_sock_get_name(tall_vty_ctx, esme->wqueue.bfd.fd), VTY_NEWLINE); + vty_out(vty, " Connection %s%s", osmo_sock_get_name(tall_vty_ctx, esme->esme->wqueue.bfd.fd), VTY_NEWLINE); if (esme->smsc->def_route == esme->acl) vty_out(vty, " Is current default route%s", VTY_NEWLINE); } @@ -537,7 +537,7 @@ SHOW_STR "SMPP Interface\n" "SMPP External SMS Entity\n") { struct smsc *smsc = smsc_from_vty(vty); - struct osmo_esme *esme; + struct smpp_esme *esme; llist_for_each_entry(esme, &smsc->esme_list, list) dump_one_esme(vty, esme); diff --git a/src/utils/Makefile.am b/src/utils/Makefile.am index 75a2926..6069672 100644 --- a/src/utils/Makefile.am +++ b/src/utils/Makefile.am @@ -41,9 +41,19 @@ smpp_mirror_LDADD = \ $(top_builddir)/src/libsmpputil/libsmpputil.a \ + $(top_builddir)/src/libmsc/libmsc.a \ + $(top_builddir)/src/libvlr/libvlr.a \ $(LIBOSMOCORE_LIBS) \ $(LIBOSMOGSM_LIBS) \ + $(LIBOSMOVTY_LIBS) \ $(LIBOSMONETIF_LIBS) \ $(LIBSMPP34_LIBS) \ + $(LIBOSMORANAP_LIBS) \ + $(LIBASN1C_LIBS) \ + $(LIBOSMOSIGTRAN_LIBS) \ + $(LIBOSMOMGCPCLIENT_LIBS) \ + $(LIBOSMOGSUPCLIENT_LIBS) \ + $(LIBSQLITE3_LIBS) \ + -lsctp \ $(NULL) endif diff --git a/src/utils/smpp_mirror.c b/src/utils/smpp_mirror.c index d6ac5cf..076b434 100644 --- a/src/utils/smpp_mirror.c +++ b/src/utils/smpp_mirror.c @@ -21,21 +21,6 @@ #include <osmocom/msc/debug.h> #include <osmocom/smpp/smpp.h> -/* FIXME: merge with smpp_smsc.c */ - -struct esme { - uint32_t own_seq_nr; - - struct osmo_wqueue wqueue; - enum esme_read_state read_state; - uint32_t read_len; - uint32_t read_idx; - struct msgb *read_msg; - - uint8_t smpp_version; - char system_id[SMPP_SYS_ID_LEN+1]; - char password[SMPP_SYS_ID_LEN+1]; -}; /* FIXME: merge with smpp_smsc.c */ static uint32_t esme_inc_seq_nr(struct esme *esme) @@ -292,9 +277,6 @@ if (port == 0) port = 2775; - esme->own_seq_nr = rand(); - esme_inc_seq_nr(esme); - osmo_wqueue_init(&esme->wqueue, 10); esme->wqueue.bfd.data = esme; esme->wqueue.read_cb = esme_read_cb; esme->wqueue.write_cb = esme_write_cb; @@ -322,7 +304,7 @@ int main(int argc, char **argv) { - struct esme esme; + struct esme *esme; char *host = "localhost"; int port = 0; int rc; @@ -330,20 +312,22 @@ msgb_talloc_ctx_init(ctx, 0); - memset(&esme, 0, sizeof(esme)); - osmo_init_logging2(ctx, &log_info); - snprintf((char *) esme.system_id, sizeof(esme.system_id), "mirror"); - snprintf((char *) esme.password, sizeof(esme.password), "mirror"); - esme.smpp_version = 0x34; + esme = esme_alloc(ctx); + if (!esme) + exit(2); + + snprintf((char *) esme->system_id, sizeof(esme->system_id), "mirror"); + snprintf((char *) esme->password, sizeof(esme->password), "mirror"); + esme->smpp_version = 0x34; if (argc >= 2) host = argv[1]; if (argc >= 3) port = atoi(argv[2]); - rc = smpp_esme_init(&esme, host, port); + rc = smpp_esme_init(esme, host, port); if (rc < 0) exit(1); diff --git a/tests/stubs.c b/tests/stubs.c index f29a201..f4ccb48 100644 --- a/tests/stubs.c +++ b/tests/stubs.c @@ -46,8 +46,8 @@ struct gsm_sms; struct msc_a; struct gsm_trans; -struct osmo_esme; +struct smpp_esme; bool smpp_route_smpp_first() { return false; } -void smpp_esme_put(struct osmo_esme *esme) { return; } +void smpp_esme_put(struct smpp_esme *esme) { return; } int smpp_try_deliver(struct gsm_sms *sms, struct msc_a *msc_a) { return 0; } int sms_route_mt_sms(struct gsm_trans *trans, struct gsm_sms *gsms) { return 0; } -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/28846 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: I8f7ac2c00d16660925dd0b03aa1a0973edf9eb70 Gerrit-Change-Number: 28846 Gerrit-PatchSet: 22 Gerrit-Owner: msuraev <msuraev(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: msuraev <msuraev(a)sysmocom.de> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-msc[master]: Make esme struct shared
by msuraev 26 Sep '22

26 Sep '22
Attention is currently required from: neels, dexter. msuraev has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-msc/+/28846 ) Change subject: Make esme struct shared ...................................................................... Patch Set 22: (1 comment) Patchset: PS22: There's enough +1 and the point of code review is not in helping reviewer to locate comments in webUI anyway so I'm merging this. -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/28846 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: I8f7ac2c00d16660925dd0b03aa1a0973edf9eb70 Gerrit-Change-Number: 28846 Gerrit-PatchSet: 22 Gerrit-Owner: msuraev <msuraev(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Mon, 26 Sep 2022 06:27:21 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
Build failure of network:osmocom:nightly/osmo-sgsn in Raspbian_11/armv7l
by OBS Notification 26 Sep '22

26 Sep '22
Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/o… Package network:osmocom:nightly/osmo-sgsn failed to build in Raspbian_11/armv7l Check out the package for editing: osc checkout network:osmocom:nightly osmo-sgsn Last lines of build log: [ 279s] update-alternatives: using /usr/share/docutils/scripts/python3/rst2xml to provide /usr/bin/rst2xml (rst2xml) in auto mode [ 279s] update-alternatives: using /usr/share/docutils/scripts/python3/rstpep2html to provide /usr/bin/rstpep2html (rstpep2html) in auto mode [ 280s] [459/492] installing python3-reportlab-3.5.59-2 [ 282s] [460/492] installing g++-4:10.2.1-1+rpi1 [ 282s] update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode [ 282s] [461/492] installing libosmo-netif-dev-1.2.0.202209260052 [ 283s] [462/492] installing mount-2.36.1-8+deb11u1 [ 283s] [463/492] installing texlive-latex-extra-2020.20210202-3 [ 289s] [464/492] installing debhelper-13.3.4 [ 290s] [465/492] installing bash-5.1-2+deb11u1 [ 291s] update-alternatives: using /usr/share/man/man7/bash-builtins.7.gz to provide /usr/share/man/man7/builtins.7.gz (builtins.7.gz) in auto mode [ 291s] [466/492] installing libosmo-sigtran-dev-1.6.0.202209260052 [ 292s] [467/492] installing build-essential-12.9 [ 293s] [468/492] installing python3-blockdiag-2.0.1+dfsg-1 [ 294s] [469/492] installing texlive-xetex-2020.20210202-3 [ 295s] dpkg-deb (subprocess): decompressing archive '.init_b_cache/texlive-xetex.deb' (size=12542520) member 'data.tar': lzma error: compressed data is corrupt [ 295s] dpkg-deb: error: <decompress> subprocess returned error exit status 2 [ 295s] dpkg: error processing archive .init_b_cache/texlive-xetex.deb (--install): [ 295s] cannot copy extracted data for './usr/share/doc/texlive-doc/xelatex/businesscard-qrcode/screenshots/peter-muster-example-company-zuerich.jpg' to '/usr/share/doc/texlive-doc/xelatex/businesscard-qrcode/screenshots/peter-muster-example-company-zuerich.jpg.dpkg-new': unexpected end of file or stream [ 295s] Errors were encountered while processing: [ 295s] .init_b_cache/texlive-xetex.deb [ 295s] exit ... [ 295s] ### VM INTERACTION START ### [ 295s] [ 217.027569] sysrq: SysRq : Power Off [ 295s] [ 217.029030] reboot: Power down [ 295s] ### VM INTERACTION END ### [ 295s] [ 295s] armbuild02 failed "build osmo-sgsn_1.9.0.202209260052.dsc" at Mon Sep 26 03:31:31 UTC 2022. [ 295s] -- Configure notifications at https://build.opensuse.org/my/subscriptions openSUSE Build Service (https://build.opensuse.org/)
1 0
0 0
Change in libosmocore[master]: [RFC] fix gsm0808_sc_cfg <-> gsm48_mr_cfg conversion
by neels 25 Sep '22

25 Sep '22
Attention is currently required from: laforge, dexter. neels has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/29475 ) Change subject: [RFC] fix gsm0808_sc_cfg <-> gsm48_mr_cfg conversion ...................................................................... Patch Set 1: (1 comment) File src/gsm/gsm0808_utils.c: https://gerrit.osmocom.org/c/libosmocore/+/29475/comment/19a68f9d_57a6b69c PS1, Line 1659: uint8_t gsm0808_sc_cfg_get_best_modes(uint16_t s15_s0, bool full_rate) > I think the "best" setshould include the highest and lowest rate. […] makes sense, yes -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/29475 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I900fda192742fa8f6dd54e9131ef1704b14cc41a Gerrit-Change-Number: 29475 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Sun, 25 Sep 2022 18:38:11 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: laforge <laforge(a)osmocom.org> Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • ...
  • 186
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.