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

November 2024

  • 1 participants
  • 2209 discussions
[S] Change in libosmo-pfcp[master]: pfcp: Add APIs to access struct osmo_pfcp_cp_peer
by pespin 05 Nov '24

05 Nov '24
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-pfcp/+/38622?usp=email ) Change subject: pfcp: Add APIs to access struct osmo_pfcp_cp_peer ...................................................................... pfcp: Add APIs to access struct osmo_pfcp_cp_peer Provide APIs so that users don't need to know the struct layout. Change-Id: Ic8a5d5ec4237aa8520d426252c924c9617d1d08a --- M TODO-RELEASE M include/osmocom/pfcp/pfcp_cp_peer.h M src/libosmo-pfcp/pfcp_cp_peer.c 3 files changed, 28 insertions(+), 0 deletions(-) Approvals: osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified pespin: Looks good to me, approved diff --git a/TODO-RELEASE b/TODO-RELEASE index 8f3b43c..a73a0e0 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -8,3 +8,5 @@ # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line libosmo-pfcp add API osmo_pfcp_cp_peer_set_associated_cb() +libosmo-pfcp add API osmo_pfcp_cp_peer_get_remote_addr(), osmo_pfcp_cp_peer_next_seid() + osmo_pfcp_cp_peer_get_priv(), osmo_pfcp_cp_peer_set_priv() diff --git a/include/osmocom/pfcp/pfcp_cp_peer.h b/include/osmocom/pfcp/pfcp_cp_peer.h index 4f34139..01f0838 100644 --- a/include/osmocom/pfcp/pfcp_cp_peer.h +++ b/include/osmocom/pfcp/pfcp_cp_peer.h @@ -59,6 +59,13 @@ int osmo_pfcp_cp_peer_associate(struct osmo_pfcp_cp_peer *cp_peer); bool osmo_pfcp_cp_peer_is_associated(const struct osmo_pfcp_cp_peer *cp_peer); int osmo_pfcp_cp_peer_set_associated_cb(struct osmo_pfcp_cp_peer *cp_peer, osmo_pfcp_cp_peer_assoc_cb assoc_cb); + +uint64_t osmo_pfcp_cp_peer_next_seid(struct osmo_pfcp_cp_peer *cp_peer); +const struct osmo_sockaddr *osmo_pfcp_cp_peer_get_remote_addr(const struct osmo_pfcp_cp_peer *cp_peer); + +void *osmo_pfcp_cp_peer_get_priv(struct osmo_pfcp_cp_peer *cp_peer); +void osmo_pfcp_cp_peer_set_priv(struct osmo_pfcp_cp_peer *cp_peer, void *priv); + struct osmo_pfcp_msg *osmo_pfcp_cp_peer_new_req(struct osmo_pfcp_cp_peer *cp_peer, enum osmo_pfcp_message_type msg_type); struct osmo_pfcp_msg *osmo_pfcp_cp_peer_new_resp(struct osmo_pfcp_cp_peer *cp_peer, diff --git a/src/libosmo-pfcp/pfcp_cp_peer.c b/src/libosmo-pfcp/pfcp_cp_peer.c index 0fb0f75..b146dad 100644 --- a/src/libosmo-pfcp/pfcp_cp_peer.c +++ b/src/libosmo-pfcp/pfcp_cp_peer.c @@ -145,6 +145,25 @@ return 0; } +uint64_t osmo_pfcp_cp_peer_next_seid(struct osmo_pfcp_cp_peer *cp_peer) +{ + return osmo_pfcp_next_seid(&cp_peer->next_seid_state); +} + +const struct osmo_sockaddr *osmo_pfcp_cp_peer_get_remote_addr(const struct osmo_pfcp_cp_peer *cp_peer) +{ + return &cp_peer->remote_addr; +} + +void *osmo_pfcp_cp_peer_get_priv(struct osmo_pfcp_cp_peer *cp_peer) +{ + return cp_peer->priv; +} +void osmo_pfcp_cp_peer_set_priv(struct osmo_pfcp_cp_peer *cp_peer, void *priv) +{ + cp_peer->priv = priv; +} + static int pfcp_cp_peer_fsm_timer_cb(struct osmo_fsm_inst *fi) { switch (fi->state) { -- To view, visit https://gerrit.osmocom.org/c/libosmo-pfcp/+/38622?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: libosmo-pfcp Gerrit-Branch: master Gerrit-Change-Id: Ic8a5d5ec4237aa8520d426252c924c9617d1d08a Gerrit-Change-Number: 38622 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[M] Change in libosmo-pfcp[master]: pfcp: Make struct osmo_pfcp_cp_peer private
by pespin 05 Nov '24

05 Nov '24
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-pfcp/+/38612?usp=email ) Change subject: pfcp: Make struct osmo_pfcp_cp_peer private ...................................................................... pfcp: Make struct osmo_pfcp_cp_peer private Only user of this lib so far, osmo-hnbgw, will get patches so that it doesn't access the struct. Make it private before anybody else starts using it. Change-Id: I7f79ce239cb3c57bae2cf5846edf71e1aa03fa95 --- M TODO-RELEASE M include/osmocom/pfcp/Makefile.am M include/osmocom/pfcp/pfcp_cp_peer.h A include/osmocom/pfcp/pfcp_cp_peer_private.h M src/libosmo-pfcp/pfcp_cp_peer.c 5 files changed, 57 insertions(+), 18 deletions(-) Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve diff --git a/TODO-RELEASE b/TODO-RELEASE index a73a0e0..d705483 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -10,3 +10,4 @@ libosmo-pfcp add API osmo_pfcp_cp_peer_set_associated_cb() libosmo-pfcp add API osmo_pfcp_cp_peer_get_remote_addr(), osmo_pfcp_cp_peer_next_seid() osmo_pfcp_cp_peer_get_priv(), osmo_pfcp_cp_peer_set_priv() +libosmo-pfcp API break struct osmo_pfcp_cp_peer fields become private diff --git a/include/osmocom/pfcp/Makefile.am b/include/osmocom/pfcp/Makefile.am index 898113f..2693be5 100644 --- a/include/osmocom/pfcp/Makefile.am +++ b/include/osmocom/pfcp/Makefile.am @@ -1,3 +1,7 @@ +noinst_HEADERS = \ + pfcp_cp_peer_private.h \ + $(NULL) + pfcp_HEADERS = \ pfcp_endpoint.h \ pfcp_ies_custom.h \ diff --git a/include/osmocom/pfcp/pfcp_cp_peer.h b/include/osmocom/pfcp/pfcp_cp_peer.h index 01f0838..739526e 100644 --- a/include/osmocom/pfcp/pfcp_cp_peer.h +++ b/include/osmocom/pfcp/pfcp_cp_peer.h @@ -36,23 +36,6 @@ typedef void (*osmo_pfcp_cp_peer_assoc_cb)(struct osmo_pfcp_cp_peer *cp_peer, bool associated); -struct osmo_pfcp_cp_peer { - struct osmo_fsm_inst *fi; - struct osmo_pfcp_endpoint *ep; - struct osmo_sockaddr remote_addr; - uint64_t next_seid_state; - - /* If non-NULL, called whenever the peer completes a PFCP Association, and when it loses association. - * Argument associated == true means the peer has just associated; - * associated == false means the association has been lost. */ - osmo_pfcp_cp_peer_assoc_cb assoc_cb; - /* Application private data for assoc_cb, in case ep->priv does not suffice. */ - void *priv; - - struct osmo_use_count use_count; - struct osmo_use_count_entry use_count_buf[128]; -}; - struct osmo_pfcp_cp_peer *osmo_pfcp_cp_peer_alloc(void *ctx, struct osmo_pfcp_endpoint *ep, const struct osmo_sockaddr *remote_addr); diff --git a/include/osmocom/pfcp/pfcp_cp_peer_private.h b/include/osmocom/pfcp/pfcp_cp_peer_private.h new file mode 100644 index 0000000..b8b0af7 --- /dev/null +++ b/include/osmocom/pfcp/pfcp_cp_peer_private.h @@ -0,0 +1,51 @@ +/* + * (C) 2021-2022 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> + * All Rights Reserved. + * + * Author: Neels Janosch Hofmeyr <nhofmeyr(a)sysmocom.de> + * + * SPDX-License-Identifier: GPL-2.0+ + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#pragma once + +#include <stdint.h> +#include <stdbool.h> + +#include <osmocom/core/socket.h> +#include <osmocom/core/use_count.h> +#include <osmocom/pfcp/pfcp_cp_peer.h> + +struct osmo_fsm_inst; +struct osmo_pfcp_endpoint; + +struct osmo_pfcp_cp_peer { + struct osmo_fsm_inst *fi; + struct osmo_pfcp_endpoint *ep; + struct osmo_sockaddr remote_addr; + uint64_t next_seid_state; + + /* If non-NULL, called whenever the peer completes a PFCP Association, and when it loses association. + * Argument associated == true means the peer has just associated; + * associated == false means the association has been lost. */ + osmo_pfcp_cp_peer_assoc_cb assoc_cb; + /* Application private data for assoc_cb, in case ep->priv does not suffice. */ + void *priv; + + struct osmo_use_count use_count; + struct osmo_use_count_entry use_count_buf[128]; +}; diff --git a/src/libosmo-pfcp/pfcp_cp_peer.c b/src/libosmo-pfcp/pfcp_cp_peer.c index b146dad..c88c6d1 100644 --- a/src/libosmo-pfcp/pfcp_cp_peer.c +++ b/src/libosmo-pfcp/pfcp_cp_peer.c @@ -28,7 +28,7 @@ #include <osmocom/core/tdef.h> #include <osmocom/pfcp/pfcp_endpoint.h> -#include <osmocom/pfcp/pfcp_cp_peer.h> +#include <osmocom/pfcp/pfcp_cp_peer_private.h> #define LOG_CP_PEER(CP_PEER, LOGLEVEL, FMT, ARGS...) \ LOGPFSML((CP_PEER)->fi, LOGLEVEL, FMT, ##ARGS) -- To view, visit https://gerrit.osmocom.org/c/libosmo-pfcp/+/38612?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: libosmo-pfcp Gerrit-Branch: master Gerrit-Change-Id: I7f79ce239cb3c57bae2cf5846edf71e1aa03fa95 Gerrit-Change-Number: 38612 Gerrit-PatchSet: 5 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[M] Change in libosmo-pfcp[master]: pfcp: Make struct osmo_pfcp_cp_peer private
by pespin 05 Nov '24

05 Nov '24
Attention is currently required from: fixeria, laforge. pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/libosmo-pfcp/+/38612?usp=email ) Change subject: pfcp: Make struct osmo_pfcp_cp_peer private ...................................................................... Patch Set 5: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/libosmo-pfcp/+/38612?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: libosmo-pfcp Gerrit-Branch: master Gerrit-Change-Id: I7f79ce239cb3c57bae2cf5846edf71e1aa03fa95 Gerrit-Change-Number: 38612 Gerrit-PatchSet: 5 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Tue, 05 Nov 2024 09:55:32 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[S] Change in libosmo-pfcp[master]: pfcp: Add APIs to access struct osmo_pfcp_cp_peer
by pespin 05 Nov '24

05 Nov '24
Attention is currently required from: fixeria, laforge. pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/libosmo-pfcp/+/38622?usp=email ) Change subject: pfcp: Add APIs to access struct osmo_pfcp_cp_peer ...................................................................... Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/libosmo-pfcp/+/38622?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: libosmo-pfcp Gerrit-Branch: master Gerrit-Change-Id: Ic8a5d5ec4237aa8520d426252c924c9617d1d08a Gerrit-Change-Number: 38622 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Tue, 05 Nov 2024 09:55:27 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[S] Change in libosmo-sigtran[master]: sigtran: Add API osmo_ss7_route_get_dest_as()
by pespin 05 Nov '24

05 Nov '24
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/38627?usp=email ) Change subject: sigtran: Add API osmo_ss7_route_get_dest_as() ...................................................................... sigtran: Add API osmo_ss7_route_get_dest_as() This is needed by users willing to get the AS from a routing entry, i.e. osmo-bsc needs to access this information in order to inject MGCP into the IPA multiplex conn transporting the SCCPLite signalling. Change-Id: Ife63bd384d247a761e0b89505ea71c41a4a16d9b --- M TODO-RELEASE M include/osmocom/sigtran/osmo_ss7.h M src/osmo_ss7.c 3 files changed, 12 insertions(+), 1 deletion(-) Approvals: laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified osmith: Looks good to me, approved diff --git a/TODO-RELEASE b/TODO-RELEASE index 6d8cb80..06d4f53 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -9,3 +9,4 @@ #library what description / commit summary line libosmo-sigtran API change struct osmo_ss7_instance has new member 'secondary_pc' libosmo-sigtran add API osmo_sccp_{release,return,reset,error,refusal}_cause_name(s), osmo_sua_sccp_cause_name +libosmo-sigtran add API osmo_ss7_route_get_dest_as() \ No newline at end of file diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h index d009958..3b5aa4f 100644 --- a/include/osmocom/sigtran/osmo_ss7.h +++ b/include/osmocom/sigtran/osmo_ss7.h @@ -214,7 +214,8 @@ void osmo_ss7_route_destroy(struct osmo_ss7_route *rt); const char *osmo_ss7_route_print(const struct osmo_ss7_route *rt); const char *osmo_ss7_route_name(struct osmo_ss7_route *rt, bool list_asps); - +struct osmo_ss7_as * +osmo_ss7_route_get_dest_as(struct osmo_ss7_route *rt); /*********************************************************************** * SS7 Application Servers diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c index 38b07da..95e58a7 100644 --- a/src/osmo_ss7.c +++ b/src/osmo_ss7.c @@ -882,6 +882,15 @@ return buf; } +/*! \brief Get destination AS of route + * \param[in] rt Route entry holding the AS destination + * \returns pointer to Application Server on success; NULL if rt doesn't route + * to an AS (i.e. routes to a linkset). */ +struct osmo_ss7_as * +osmo_ss7_route_get_dest_as(struct osmo_ss7_route *rt) +{ + return rt->dest.as; +} /*********************************************************************** * SS7 Application Server -- To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/38627?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: libosmo-sigtran Gerrit-Branch: master Gerrit-Change-Id: Ife63bd384d247a761e0b89505ea71c41a4a16d9b Gerrit-Change-Number: 38627 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[S] Change in libosmo-sigtran[master]: Move include sigtran/m2ua_types.h -> sigtran/protocol/m2ua.h
by pespin 05 Nov '24

05 Nov '24
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/38624?usp=email ) Change subject: Move include sigtran/m2ua_types.h -> sigtran/protocol/m2ua.h ...................................................................... Move include sigtran/m2ua_types.h -> sigtran/protocol/m2ua.h That file contains only protocol (over-the-wire) related values, similar to already existing sigtran/protocol/m3ua.h. Hence, move it where it should be. This is fine since there's no user of such a header, it's only used internally by m2ua_test. Change-Id: I66d8a335bbd1c55edab8a120d85e6aee1922433c --- M include/osmocom/sigtran/Makefile.am R include/osmocom/sigtran/protocol/m2ua.h M tests/m2ua/m2ua_test.c 3 files changed, 11 insertions(+), 8 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve osmith: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/sigtran/Makefile.am b/include/osmocom/sigtran/Makefile.am index d9cc20c..8d90b0b 100644 --- a/include/osmocom/sigtran/Makefile.am +++ b/include/osmocom/sigtran/Makefile.am @@ -1,8 +1,14 @@ -sigtran_HEADERS = xua_types.h xua_msg.h m2ua_types.h sccp_sap.h \ +sigtran_HEADERS = xua_types.h xua_msg.h sccp_sap.h \ sigtran_sap.h sccp_helpers.h mtp_sap.h osmo_ss7.h sigtrandir = $(includedir)/osmocom/sigtran -sigtran_prot_HEADERS = protocol/sua.h protocol/m3ua.h protocol/mtp.h \ - protocol/sccp_scmg.h +sigtran_prot_HEADERS = \ + protocol/sua.h \ + protocol/m2ua.h \ + protocol/m3ua.h \ + protocol/mtp.h \ + protocol/sccp_scmg.h \ + $(NULL) + sigtran_protdir = $(includedir)/osmocom/sigtran/protocol diff --git a/include/osmocom/sigtran/m2ua_types.h b/include/osmocom/sigtran/protocol/m2ua.h similarity index 98% rename from include/osmocom/sigtran/m2ua_types.h rename to include/osmocom/sigtran/protocol/m2ua.h index 7184f54..bf25086 100644 --- a/include/osmocom/sigtran/m2ua_types.h +++ b/include/osmocom/sigtran/protocol/m2ua.h @@ -1,5 +1,4 @@ -#ifndef m2ua_types_h -#define m2ua_types_h +#pragma once /** * Types found in the M2UA RFC 3331 @@ -251,5 +250,3 @@ M2UA_DEREG_ERR_PERM_DENIED, /* Error - Permission Denied */ M2UA_DEREG_ERR_NOT_REG, /* Error - Not Registered */ }; - -#endif diff --git a/tests/m2ua/m2ua_test.c b/tests/m2ua/m2ua_test.c index 12d5d7c..3469f11 100644 --- a/tests/m2ua/m2ua_test.c +++ b/tests/m2ua/m2ua_test.c @@ -16,7 +16,7 @@ */ #include <osmocom/sigtran/xua_msg.h> -#include <osmocom/sigtran/m2ua_types.h> +#include <osmocom/sigtran/protocol/m2ua.h> #include <osmocom/core/utils.h> #include <osmocom/core/msgb.h> -- To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/38624?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: libosmo-sigtran Gerrit-Branch: master Gerrit-Change-Id: I66d8a335bbd1c55edab8a120d85e6aee1922433c Gerrit-Change-Number: 38624 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[M] Change in libosmo-sigtran[master]: sigtran: xua_msg.h,msg_types.h: Make headers private
by pespin 05 Nov '24

05 Nov '24
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/38625?usp=email ) Change subject: sigtran: xua_msg.h,msg_types.h: Make headers private ...................................................................... sigtran: xua_msg.h,msg_types.h: Make headers private Those headers are only used internally in libosmo-sigtran, since those objects have no real use outside of it. Mark the headers as no-install, which implicitly makes them private. Only API osmo_xua_msg_tall_ctx_init() is used by osmo-bsc, hence why it's left in the existing public header. This decreases the amount of public APIs the libosmo-sigtran has. Change-Id: Icd23bf9c9364c33ea2ba709e3ef4439813a168f4 --- M include/osmocom/sigtran/Makefile.am M include/osmocom/sigtran/xua_msg.h M src/Makefile.am M src/ipa.c M src/m3ua.c M src/sccp2sua.c M src/sua.c M src/xua_as_fsm.c M src/xua_asp_fsm.c M src/xua_internal.h M src/xua_msg.c A src/xua_msg.h M src/xua_rkm.c M src/xua_shared.c R src/xua_types.h M tests/m2ua/m2ua_test.c M tests/xua/xua_test.c 17 files changed, 131 insertions(+), 103 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve osmith: Looks good to me, approved diff --git a/include/osmocom/sigtran/Makefile.am b/include/osmocom/sigtran/Makefile.am index 8d90b0b..69895bc 100644 --- a/include/osmocom/sigtran/Makefile.am +++ b/include/osmocom/sigtran/Makefile.am @@ -1,5 +1,11 @@ -sigtran_HEADERS = xua_types.h xua_msg.h sccp_sap.h \ - sigtran_sap.h sccp_helpers.h mtp_sap.h osmo_ss7.h +sigtran_HEADERS = \ + mtp_sap.h \ + osmo_ss7.h \ + sccp_helpers.h \ + sccp_sap.h \ + sigtran_sap.h \ + xua_msg.h \ + $(NULL) sigtrandir = $(includedir)/osmocom/sigtran diff --git a/include/osmocom/sigtran/xua_msg.h b/include/osmocom/sigtran/xua_msg.h index 5f877ed..9eb2d0c 100644 --- a/include/osmocom/sigtran/xua_msg.h +++ b/include/osmocom/sigtran/xua_msg.h @@ -17,93 +17,4 @@ */ #pragma once -#include "xua_types.h" - -#include <osmocom/core/linuxlist.h> -#include <osmocom/sigtran/mtp_sap.h> - -#define XUA_HDR(class, type) ((struct xua_common_hdr) { .spare = 0, .msg_class = (class), .msg_type = (type) }) - -struct msgb; -struct osmo_sccp_addr; -struct osmo_sccp_gt; - -struct xua_msg { - struct xua_common_hdr hdr; - struct osmo_mtp_transfer_param mtp; - - struct llist_head headers; -}; - -struct xua_msg_part { - struct llist_head entry; - - uint16_t tag; - uint16_t len; - uint8_t *dat; - - /* TODO: keep small data in the struct for perf reasons */ -}; - -struct xua_msg_class { - const char *name; - const struct value_string *msgt_names; - const struct value_string *iei_names; - const uint16_t *mand_ies[256]; -}; - -struct xua_dialect { - const char *name; - uint16_t port; - uint16_t ppid; - int log_subsys; - const struct xua_msg_class *class[256]; -}; - -struct xua_msg_event_map { - uint8_t msg_class; - uint8_t msg_type; - int event; -}; - -extern const struct xua_dialect xua_dialect_sua; -extern const struct xua_dialect xua_dialect_m3ua; - void osmo_xua_msg_tall_ctx_init(void *ctx); - -struct xua_msg *xua_msg_alloc(void); -void xua_msg_free(struct xua_msg *msg); - -int xua_msg_add_data(struct xua_msg *msg, uint16_t tag, uint16_t len, const uint8_t *dat); - -struct xua_msg_part *xua_msg_find_tag(const struct xua_msg *msg, uint16_t tag); -int xua_msg_free_tag(struct xua_msg *xua, uint16_t tag); -int xua_msg_copy_part(struct xua_msg *xua_out, uint16_t tag_out, - const struct xua_msg *xua_in, uint16_t tag_in); - -struct xua_msg *xua_from_msg(const int version, uint16_t len, uint8_t *data); -struct msgb *xua_to_msg(const int version, struct xua_msg *msg); - -struct xua_msg *xua_from_nested(struct xua_msg_part *outer); - -int msgb_t16l16vp_put(struct msgb *msg, uint16_t tag, uint16_t len, const uint8_t *data); -int msgb_t16l16vp_put_u32(struct msgb *msg, uint16_t tag, uint32_t val); -int xua_msg_add_u32(struct xua_msg *xua, uint16_t iei, uint32_t val); -uint32_t xua_msg_part_get_u32(const struct xua_msg_part *part); -uint32_t xua_msg_get_u32(const struct xua_msg *xua, uint16_t iei); -const uint32_t *xua_msg_get_u32p(const struct xua_msg *xua, uint16_t iei, uint32_t *out); -const char *xua_msg_part_get_str(const struct xua_msg_part *part); -const char *xua_msg_get_str(const struct xua_msg *xua, uint16_t iei); -int xua_msg_get_len(const struct xua_msg *xua, uint16_t iei); -void xua_part_add_gt(struct msgb *msg, const struct osmo_sccp_gt *gt); -int xua_msg_add_sccp_addr(struct xua_msg *xua, uint16_t iei, const struct osmo_sccp_addr *addr); - -const char *xua_class_msg_name(const struct xua_msg_class *xmc, uint16_t msg_type); -const char *xua_class_iei_name(const struct xua_msg_class *xmc, uint16_t iei); -char *xua_hdr_dump(struct xua_msg *xua, const struct xua_dialect *dialect); -char *xua_msg_dump(struct xua_msg *xua, const struct xua_dialect *dialect); -int xua_dialect_check_all_mand_ies(const struct xua_dialect *dialect, struct xua_msg *xua); - -int xua_msg_event_map(const struct xua_msg *xua, - const struct xua_msg_event_map *maps, - unsigned int num_maps); diff --git a/src/Makefile.am b/src/Makefile.am index 90b791b..2a257ae 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -8,6 +8,8 @@ xua_asp_fsm.h \ xua_as_fsm.h \ xua_internal.h \ + xua_msg.h \ + xua_types.h \ $(NULL) noinst_LIBRARIES = libxua.a diff --git a/src/ipa.c b/src/ipa.c index 82ece8b..64eb4d4 100644 --- a/src/ipa.c +++ b/src/ipa.c @@ -37,7 +37,7 @@ //#include <osmocom/netif/stream.h> #include <osmocom/netif/ipa.h> -#include <osmocom/sigtran/xua_msg.h> +#include "xua_msg.h" #include <osmocom/sigtran/mtp_sap.h> #include <osmocom/sigtran/sccp_sap.h> diff --git a/src/m3ua.c b/src/m3ua.c index af81da9..05680ea 100644 --- a/src/m3ua.c +++ b/src/m3ua.c @@ -33,7 +33,7 @@ #include <osmocom/core/socket.h> #include <osmocom/netif/stream.h> -#include <osmocom/sigtran/xua_msg.h> +#include "xua_msg.h" #include <osmocom/sigtran/mtp_sap.h> #include <osmocom/sigtran/sccp_sap.h> diff --git a/src/sccp2sua.c b/src/sccp2sua.c index 930b837..ffbfd2a 100644 --- a/src/sccp2sua.c +++ b/src/sccp2sua.c @@ -34,7 +34,7 @@ #include <osmocom/sigtran/sccp_sap.h> #include <osmocom/sigtran/sccp_helpers.h> #include <osmocom/sigtran/protocol/sua.h> -#include <osmocom/sigtran/xua_msg.h> +#include "xua_msg.h" #include "xua_internal.h" #include "sccp_internal.h" diff --git a/src/sua.c b/src/sua.c index d8eb9e5..a69f3b5 100644 --- a/src/sua.c +++ b/src/sua.c @@ -34,7 +34,7 @@ #include <osmocom/core/fsm.h> #include <osmocom/netif/stream.h> -#include <osmocom/sigtran/xua_msg.h> +#include "xua_msg.h" #include <osmocom/sigtran/sccp_sap.h> #include <osmocom/sigtran/protocol/mtp.h> diff --git a/src/xua_as_fsm.c b/src/xua_as_fsm.c index e239c74..65f723c 100644 --- a/src/xua_as_fsm.c +++ b/src/xua_as_fsm.c @@ -19,7 +19,7 @@ #include <osmocom/sigtran/osmo_ss7.h> #include <osmocom/sigtran/sigtran_sap.h> -#include <osmocom/sigtran/xua_msg.h> +#include "xua_msg.h" #include <osmocom/sigtran/protocol/sua.h> #include <osmocom/sigtran/protocol/m3ua.h> diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c index 97391bb..ec4edb0 100644 --- a/src/xua_asp_fsm.c +++ b/src/xua_asp_fsm.c @@ -24,7 +24,7 @@ #include <osmocom/sigtran/osmo_ss7.h> #include <osmocom/sigtran/sigtran_sap.h> -#include <osmocom/sigtran/xua_msg.h> +#include "xua_msg.h" #include <osmocom/sigtran/protocol/sua.h> #include "xua_asp_fsm.h" diff --git a/src/xua_internal.h b/src/xua_internal.h index d4b16f9..4f6e931 100644 --- a/src/xua_internal.h +++ b/src/xua_internal.h @@ -2,7 +2,7 @@ #include <osmocom/core/tdef.h> #include <osmocom/sigtran/osmo_ss7.h> -#include <osmocom/sigtran/xua_msg.h> +#include "xua_msg.h" #define M3UA_MSG_SIZE 2048 #define M3UA_MSG_HEADROOM 512 diff --git a/src/xua_msg.c b/src/xua_msg.c index 067c8dd..5584b82 100644 --- a/src/xua_msg.c +++ b/src/xua_msg.c @@ -19,7 +19,7 @@ * */ -#include <osmocom/sigtran/xua_msg.h> +#include "xua_msg.h" #include <osmocom/sigtran/protocol/sua.h> #include <osmocom/sigtran/sccp_sap.h> diff --git a/src/xua_msg.h b/src/xua_msg.h new file mode 100644 index 0000000..5f877ed --- /dev/null +++ b/src/xua_msg.h @@ -0,0 +1,109 @@ +/* Routines for generating and parsing messages */ +/* (C) 2011 by Holger Hans Peter Freyther <zecke(a)selfish.org> + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +#pragma once + +#include "xua_types.h" + +#include <osmocom/core/linuxlist.h> +#include <osmocom/sigtran/mtp_sap.h> + +#define XUA_HDR(class, type) ((struct xua_common_hdr) { .spare = 0, .msg_class = (class), .msg_type = (type) }) + +struct msgb; +struct osmo_sccp_addr; +struct osmo_sccp_gt; + +struct xua_msg { + struct xua_common_hdr hdr; + struct osmo_mtp_transfer_param mtp; + + struct llist_head headers; +}; + +struct xua_msg_part { + struct llist_head entry; + + uint16_t tag; + uint16_t len; + uint8_t *dat; + + /* TODO: keep small data in the struct for perf reasons */ +}; + +struct xua_msg_class { + const char *name; + const struct value_string *msgt_names; + const struct value_string *iei_names; + const uint16_t *mand_ies[256]; +}; + +struct xua_dialect { + const char *name; + uint16_t port; + uint16_t ppid; + int log_subsys; + const struct xua_msg_class *class[256]; +}; + +struct xua_msg_event_map { + uint8_t msg_class; + uint8_t msg_type; + int event; +}; + +extern const struct xua_dialect xua_dialect_sua; +extern const struct xua_dialect xua_dialect_m3ua; + +void osmo_xua_msg_tall_ctx_init(void *ctx); + +struct xua_msg *xua_msg_alloc(void); +void xua_msg_free(struct xua_msg *msg); + +int xua_msg_add_data(struct xua_msg *msg, uint16_t tag, uint16_t len, const uint8_t *dat); + +struct xua_msg_part *xua_msg_find_tag(const struct xua_msg *msg, uint16_t tag); +int xua_msg_free_tag(struct xua_msg *xua, uint16_t tag); +int xua_msg_copy_part(struct xua_msg *xua_out, uint16_t tag_out, + const struct xua_msg *xua_in, uint16_t tag_in); + +struct xua_msg *xua_from_msg(const int version, uint16_t len, uint8_t *data); +struct msgb *xua_to_msg(const int version, struct xua_msg *msg); + +struct xua_msg *xua_from_nested(struct xua_msg_part *outer); + +int msgb_t16l16vp_put(struct msgb *msg, uint16_t tag, uint16_t len, const uint8_t *data); +int msgb_t16l16vp_put_u32(struct msgb *msg, uint16_t tag, uint32_t val); +int xua_msg_add_u32(struct xua_msg *xua, uint16_t iei, uint32_t val); +uint32_t xua_msg_part_get_u32(const struct xua_msg_part *part); +uint32_t xua_msg_get_u32(const struct xua_msg *xua, uint16_t iei); +const uint32_t *xua_msg_get_u32p(const struct xua_msg *xua, uint16_t iei, uint32_t *out); +const char *xua_msg_part_get_str(const struct xua_msg_part *part); +const char *xua_msg_get_str(const struct xua_msg *xua, uint16_t iei); +int xua_msg_get_len(const struct xua_msg *xua, uint16_t iei); +void xua_part_add_gt(struct msgb *msg, const struct osmo_sccp_gt *gt); +int xua_msg_add_sccp_addr(struct xua_msg *xua, uint16_t iei, const struct osmo_sccp_addr *addr); + +const char *xua_class_msg_name(const struct xua_msg_class *xmc, uint16_t msg_type); +const char *xua_class_iei_name(const struct xua_msg_class *xmc, uint16_t iei); +char *xua_hdr_dump(struct xua_msg *xua, const struct xua_dialect *dialect); +char *xua_msg_dump(struct xua_msg *xua, const struct xua_dialect *dialect); +int xua_dialect_check_all_mand_ies(const struct xua_dialect *dialect, struct xua_msg *xua); + +int xua_msg_event_map(const struct xua_msg *xua, + const struct xua_msg_event_map *maps, + unsigned int num_maps); diff --git a/src/xua_rkm.c b/src/xua_rkm.c index 914cb01..007f4f7 100644 --- a/src/xua_rkm.c +++ b/src/xua_rkm.c @@ -24,7 +24,7 @@ #include <osmocom/core/logging.h> #include <osmocom/core/linuxlist.h> -#include <osmocom/sigtran/xua_msg.h> +#include "xua_msg.h" #include <osmocom/sigtran/osmo_ss7.h> #include <osmocom/sigtran/protocol/m3ua.h> diff --git a/src/xua_shared.c b/src/xua_shared.c index cdd6f7f..45f78d4 100644 --- a/src/xua_shared.c +++ b/src/xua_shared.c @@ -28,7 +28,7 @@ #include <osmocom/core/linuxlist.h> #include <osmocom/core/logging.h> -#include <osmocom/sigtran/xua_msg.h> +#include "xua_msg.h" #include <osmocom/sigtran/osmo_ss7.h> #include <osmocom/sigtran/protocol/m3ua.h> diff --git a/include/osmocom/sigtran/xua_types.h b/src/xua_types.h similarity index 100% rename from include/osmocom/sigtran/xua_types.h rename to src/xua_types.h diff --git a/tests/m2ua/m2ua_test.c b/tests/m2ua/m2ua_test.c index 3469f11..ef981f4 100644 --- a/tests/m2ua/m2ua_test.c +++ b/tests/m2ua/m2ua_test.c @@ -15,7 +15,7 @@ * */ -#include <osmocom/sigtran/xua_msg.h> +#include "../src/xua_msg.h" #include <osmocom/sigtran/protocol/m2ua.h> #include <osmocom/core/utils.h> diff --git a/tests/xua/xua_test.c b/tests/xua/xua_test.c index f957369..e3d9ac5 100644 --- a/tests/xua/xua_test.c +++ b/tests/xua/xua_test.c @@ -18,9 +18,9 @@ #include "sccp_test_data.h" +#include "../src/xua_msg.h" #include "../src/xua_internal.h" -#include <osmocom/sigtran/xua_msg.h> #include <osmocom/sigtran/protocol/sua.h> #include <osmocom/sigtran/protocol/m3ua.h> #include <osmocom/sigtran/sccp_sap.h> -- To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/38625?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: libosmo-sigtran Gerrit-Branch: master Gerrit-Change-Id: Icd23bf9c9364c33ea2ba709e3ef4439813a168f4 Gerrit-Change-Number: 38625 Gerrit-PatchSet: 4 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[L] Change in libosmo-sigtran[master]: sigtran: Make osmo_ss7_route_table APIs private
by pespin 05 Nov '24

05 Nov '24
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/38626?usp=email ) Change subject: sigtran: Make osmo_ss7_route_table APIs private ...................................................................... sigtran: Make osmo_ss7_route_table APIs private The routing table is actually handled internally through VTY and no user is making use of it. Make it private, to ease extension in the future (it will be extended to eg. support combined link load sharing). Change-Id: Ie7c709c9849ef3d50aef94f79751c9c4a010c92a --- M include/osmocom/sigtran/osmo_ss7.h M src/Makefile.am M src/osmo_ss7.c M src/osmo_ss7_as.c M src/osmo_ss7_hmrt.c A src/osmo_ss7_route_table.c M src/osmo_ss7_vty.c M src/sccp_user.c A src/ss7_route_table.h M src/xua_as_fsm.c M src/xua_rkm.c M tests/ss7/ss7_test.c 12 files changed, 188 insertions(+), 142 deletions(-) Approvals: Jenkins Builder: Verified osmith: Looks good to me, approved laforge: Looks good to me, but someone else must approve diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h index 049c7d8..d009958 100644 --- a/include/osmocom/sigtran/osmo_ss7.h +++ b/include/osmocom/sigtran/osmo_ss7.h @@ -18,6 +18,7 @@ struct osmo_sccp_instance; struct osmo_mtp_prim; struct osmo_xua_layer_manager; +struct osmo_ss7_route_table; int osmo_ss7_init(void); int osmo_ss7_find_free_rctx(struct osmo_ss7_instance *inst); @@ -38,30 +39,6 @@ } /*********************************************************************** - * SS7 Routing Tables - ***********************************************************************/ - -struct osmo_ss7_route_table { - /*! member in list of routing tables */ - struct llist_head list; - /*! \ref osmo_ss7_instance to which we belong */ - struct osmo_ss7_instance *inst; - /*! list of \ref osmo_ss7_route */ - struct llist_head routes; - - struct { - char *name; - char *description; - } cfg; -}; - -struct osmo_ss7_route_table * -osmo_ss7_route_table_find(struct osmo_ss7_instance *inst, const char *name); -struct osmo_ss7_route_table * -osmo_ss7_route_table_find_or_create(struct osmo_ss7_instance *inst, const char *name); -void osmo_ss7_route_table_destroy(struct osmo_ss7_route_table *rtbl); - -/*********************************************************************** * SS7 Instances ***********************************************************************/ @@ -230,11 +207,6 @@ }; struct osmo_ss7_route * -osmo_ss7_route_find_dpc(struct osmo_ss7_route_table *rtbl, uint32_t dpc); -struct osmo_ss7_route * -osmo_ss7_route_find_dpc_mask(struct osmo_ss7_route_table *rtbl, uint32_t dpc, - uint32_t mask); -struct osmo_ss7_route * osmo_ss7_route_lookup(struct osmo_ss7_instance *inst, uint32_t dpc); struct osmo_ss7_route * osmo_ss7_route_create(struct osmo_ss7_route_table *rtbl, uint32_t dpc, diff --git a/src/Makefile.am b/src/Makefile.am index 2a257ae..5dddb05 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,6 +5,7 @@ noinst_HEADERS = \ sccp_internal.h \ ss7_internal.h \ + ss7_route_table.h \ xua_asp_fsm.h \ xua_as_fsm.h \ xua_internal.h \ @@ -37,6 +38,7 @@ osmo_ss7_hmrt.c \ osmo_ss7_vty.c \ osmo_ss7_xua_srv.c \ + osmo_ss7_route_table.c \ sccp2sua.c \ sccp_helpers.c \ sccp_lbcs.c \ diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c index 93bcfc2..38b07da 100644 --- a/src/osmo_ss7.c +++ b/src/osmo_ss7.c @@ -51,6 +51,7 @@ #include "sccp_internal.h" #include "xua_internal.h" #include "ss7_internal.h" +#include "ss7_route_table.h" #include "xua_asp_fsm.h" #include "xua_as_fsm.h" @@ -342,7 +343,7 @@ INIT_LLIST_HEAD(&inst->asp_list); INIT_LLIST_HEAD(&inst->rtable_list); INIT_LLIST_HEAD(&inst->xua_servers); - inst->rtable_system = osmo_ss7_route_table_find_or_create(inst, "system"); + inst->rtable_system = ss7_route_table_find_or_create(inst, "system"); /* default point code structure + formatting */ inst->cfg.pc_fmt.delimiter = '.'; @@ -610,49 +611,6 @@ return link; } - -/*********************************************************************** - * SS7 Route Tables - ***********************************************************************/ - -struct osmo_ss7_route_table * -osmo_ss7_route_table_find(struct osmo_ss7_instance *inst, const char *name) -{ - struct osmo_ss7_route_table *rtbl; - OSMO_ASSERT(ss7_initialized); - llist_for_each_entry(rtbl, &inst->rtable_list, list) { - if (!strcmp(rtbl->cfg.name, name)) - return rtbl; - } - return NULL; -} - -struct osmo_ss7_route_table * -osmo_ss7_route_table_find_or_create(struct osmo_ss7_instance *inst, const char *name) -{ - struct osmo_ss7_route_table *rtbl; - - OSMO_ASSERT(ss7_initialized); - rtbl = osmo_ss7_route_table_find(inst, name); - if (!rtbl) { - LOGSS7(inst, LOGL_INFO, "Creating Route Table %s\n", name); - rtbl = talloc_zero(inst, struct osmo_ss7_route_table); - rtbl->inst = inst; - rtbl->cfg.name = talloc_strdup(rtbl, name); - INIT_LLIST_HEAD(&rtbl->routes); - llist_add_tail(&rtbl->list, &inst->rtable_list); - } - return rtbl; -} - -void osmo_ss7_route_table_destroy(struct osmo_ss7_route_table *rtbl) -{ - llist_del(&rtbl->list); - /* routes are allocated as children of route table, will be - * automatically freed() */ - talloc_free(rtbl); -} - /*********************************************************************** * SS7 Routes ***********************************************************************/ @@ -752,53 +710,12 @@ return 0; } -/*! \brief Find a SS7 route for given destination point code in given table */ -struct osmo_ss7_route * -osmo_ss7_route_find_dpc(struct osmo_ss7_route_table *rtbl, uint32_t dpc) -{ - struct osmo_ss7_route *rt; - - OSMO_ASSERT(ss7_initialized); - - dpc = osmo_ss7_pc_normalize(&rtbl->inst->cfg.pc_fmt, dpc); - - /* we assume the routes are sorted by mask length, i.e. more - * specific routes first, and less specific routes with shorter - * mask later */ - llist_for_each_entry(rt, &rtbl->routes, list) { - if ((dpc & rt->cfg.mask) == rt->cfg.pc) - return rt; - } - return NULL; -} - -/*! \brief Find a SS7 route for given destination point code + mask in given table */ -struct osmo_ss7_route * -osmo_ss7_route_find_dpc_mask(struct osmo_ss7_route_table *rtbl, uint32_t dpc, - uint32_t mask) -{ - struct osmo_ss7_route *rt; - - OSMO_ASSERT(ss7_initialized); - mask = osmo_ss7_pc_normalize(&rtbl->inst->cfg.pc_fmt, mask); - dpc = osmo_ss7_pc_normalize(&rtbl->inst->cfg.pc_fmt, dpc); - - /* we assume the routes are sorted by mask length, i.e. more - * specific routes first, and less specific routes with shorter - * mask later */ - llist_for_each_entry(rt, &rtbl->routes, list) { - if (dpc == rt->cfg.pc && mask == rt->cfg.mask) - return rt; - } - return NULL; -} - /*! \brief Find a SS7 route for given destination point code in given SS7 */ struct osmo_ss7_route * osmo_ss7_route_lookup(struct osmo_ss7_instance *inst, uint32_t dpc) { OSMO_ASSERT(ss7_initialized); - return osmo_ss7_route_find_dpc(inst->rtable_system, dpc); + return ss7_route_table_find_route_by_dpc(inst->rtable_system, dpc); } /* insert the route in the ordered list of routes. The list is sorted by @@ -853,7 +770,7 @@ } /* check for duplicates */ - prev_rt = osmo_ss7_route_find_dpc_mask(rtbl, rt->cfg.pc, rt->cfg.mask); + prev_rt = ss7_route_table_find_route_by_dpc_mask(rtbl, rt->cfg.pc, rt->cfg.mask); if (prev_rt && !strcmp(prev_rt->cfg.linkset_name, rt->cfg.linkset_name)) { LOGSS7(rtbl->inst, LOGL_ERROR, "Refusing to create route with existing linkset name: pc=%u=%s mask=0x%x via linkset/AS '%s'\n", @@ -899,7 +816,7 @@ /* Keep old behavior, return already existing route: */ if (rc == -EADDRINUSE) { talloc_free(rt); - return osmo_ss7_route_find_dpc_mask(rtbl, rt->cfg.pc, rt->cfg.mask); + return ss7_route_table_find_route_by_dpc_mask(rtbl, rt->cfg.pc, rt->cfg.mask); } return rt; diff --git a/src/osmo_ss7_as.c b/src/osmo_ss7_as.c index 9683e94..87e7e04 100644 --- a/src/osmo_ss7_as.c +++ b/src/osmo_ss7_as.c @@ -33,6 +33,7 @@ #include <osmocom/core/talloc.h> #include <osmocom/core/logging.h> +#include "ss7_route_table.h" #include "ss7_internal.h" #include "xua_as_fsm.h" #include "xua_asp_fsm.h" diff --git a/src/osmo_ss7_hmrt.c b/src/osmo_ss7_hmrt.c index 3ac43b8..57d7388 100644 --- a/src/osmo_ss7_hmrt.c +++ b/src/osmo_ss7_hmrt.c @@ -35,6 +35,7 @@ #include <osmocom/sigtran/protocol/m3ua.h> #include "xua_internal.h" +#include "ss7_route_table.h" #include "ss7_internal.h" /* convert from M3UA message to MTP-TRANSFER.ind osmo_mtp_prim */ diff --git a/src/osmo_ss7_route_table.c b/src/osmo_ss7_route_table.c new file mode 100644 index 0000000..2939bf4 --- /dev/null +++ b/src/osmo_ss7_route_table.c @@ -0,0 +1,112 @@ +/* (C) 2015-2017 by Harald Welte <laforge(a)gnumonks.org> + * (C) 2023-2024 by sysmocom s.f.m.c. GmbH <info(a)sysmocom.de> + * All Rights Reserved + * + * SPDX-License-Identifier: GPL-2.0+ + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#include <osmocom/core/linuxlist.h> +#include <osmocom/core/logging.h> +#include <osmocom/sigtran/mtp_sap.h> +#include <osmocom/sigtran/osmo_ss7.h> + +#include "ss7_route_table.h" +#include "ss7_internal.h" + +/*********************************************************************** + * SS7 Route Tables + ***********************************************************************/ + +struct osmo_ss7_route_table * +ss7_route_table_find(struct osmo_ss7_instance *inst, const char *name) +{ + struct osmo_ss7_route_table *rtbl; + OSMO_ASSERT(ss7_initialized); + llist_for_each_entry(rtbl, &inst->rtable_list, list) { + if (!strcmp(rtbl->cfg.name, name)) + return rtbl; + } + return NULL; +} + +struct osmo_ss7_route_table * +ss7_route_table_find_or_create(struct osmo_ss7_instance *inst, const char *name) +{ + struct osmo_ss7_route_table *rtbl; + + OSMO_ASSERT(ss7_initialized); + rtbl = ss7_route_table_find(inst, name); + if (!rtbl) { + LOGSS7(inst, LOGL_INFO, "Creating Route Table %s\n", name); + rtbl = talloc_zero(inst, struct osmo_ss7_route_table); + rtbl->inst = inst; + rtbl->cfg.name = talloc_strdup(rtbl, name); + INIT_LLIST_HEAD(&rtbl->routes); + llist_add_tail(&rtbl->list, &inst->rtable_list); + } + return rtbl; +} + +void +ss7_route_table_destroy(struct osmo_ss7_route_table *rtbl) +{ + llist_del(&rtbl->list); + /* routes are allocated as children of route table, will be + * automatically freed() */ + talloc_free(rtbl); +} + +/*! \brief Find a SS7 route for given destination point code in given table */ +struct osmo_ss7_route * +ss7_route_table_find_route_by_dpc(struct osmo_ss7_route_table *rtbl, uint32_t dpc) +{ + struct osmo_ss7_route *rt; + + OSMO_ASSERT(ss7_initialized); + + dpc = osmo_ss7_pc_normalize(&rtbl->inst->cfg.pc_fmt, dpc); + + /* we assume the routes are sorted by mask length, i.e. more + * specific routes first, and less specific routes with shorter + * mask later */ + llist_for_each_entry(rt, &rtbl->routes, list) { + if ((dpc & rt->cfg.mask) == rt->cfg.pc) + return rt; + } + return NULL; +} + +/*! \brief Find a SS7 route for given destination point code + mask in given table */ +struct osmo_ss7_route * +ss7_route_table_find_route_by_dpc_mask(struct osmo_ss7_route_table *rtbl, uint32_t dpc, + uint32_t mask) +{ + struct osmo_ss7_route *rt; + + OSMO_ASSERT(ss7_initialized); + mask = osmo_ss7_pc_normalize(&rtbl->inst->cfg.pc_fmt, mask); + dpc = osmo_ss7_pc_normalize(&rtbl->inst->cfg.pc_fmt, dpc); + + /* we assume the routes are sorted by mask length, i.e. more + * specific routes first, and less specific routes with shorter + * mask later */ + llist_for_each_entry(rt, &rtbl->routes, list) { + if (dpc == rt->cfg.pc && mask == rt->cfg.mask) + return rt; + } + return NULL; +} diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c index e3142c7..aa8c9bc 100644 --- a/src/osmo_ss7_vty.c +++ b/src/osmo_ss7_vty.c @@ -46,6 +46,7 @@ #include "xua_internal.h" #include <osmocom/sigtran/sccp_sap.h> #include "sccp_internal.h" +#include "ss7_route_table.h" #include "ss7_internal.h" #include <netinet/tcp.h> @@ -470,7 +471,7 @@ return CMD_WARNING; } - rt = osmo_ss7_route_find_dpc_mask(rtable, dpc, mask); + rt = ss7_route_table_find_route_by_dpc_mask(rtable, dpc, mask); if (!rt) { vty_out(vty, "cannot find route to be deleted%s", VTY_NEWLINE); return CMD_WARNING; @@ -2022,7 +2023,7 @@ * (users may change the routing key via VTY during runtime) and then * putting a new route (see below). */ if (cs7_role == CS7_ROLE_ASP) { - rt = osmo_ss7_route_find_dpc_mask(as->inst->rtable_system, rkey->pc, 0xffffff); + rt = ss7_route_table_find_route_by_dpc_mask(as->inst->rtable_system, rkey->pc, 0xffffff); if (rt) osmo_ss7_route_destroy(rt); } diff --git a/src/sccp_user.c b/src/sccp_user.c index 1dd3b30..277ca5f 100644 --- a/src/sccp_user.c +++ b/src/sccp_user.c @@ -39,6 +39,7 @@ #include "sccp_internal.h" #include "xua_internal.h" +#include "ss7_route_table.h" #include "ss7_internal.h" /*! \brief Find a SCCP User registered for given PC+SSN or SSN only @@ -585,7 +586,7 @@ as->cfg.name); /* Create a default route if necessary */ - rt = osmo_ss7_route_find_dpc_mask(ss7->rtable_system, 0, 0); + rt = ss7_route_table_find_route_by_dpc_mask(ss7->rtable_system, 0, 0); if (!rt) { LOGP(DLSCCP, LOGL_NOTICE, "%s: Creating default route\n", name); rt = osmo_ss7_route_create(ss7->rtable_system, 0, 0, diff --git a/src/ss7_route_table.h b/src/ss7_route_table.h new file mode 100644 index 0000000..5c70c4c --- /dev/null +++ b/src/ss7_route_table.h @@ -0,0 +1,36 @@ +#pragma once + +#include <stdint.h> +#include <osmocom/core/linuxlist.h> + +/*********************************************************************** + * SS7 Routing Tables + ***********************************************************************/ + +struct osmo_ss7_instance; + +struct osmo_ss7_route_table { + /*! member in list of routing tables */ + struct llist_head list; + /*! \ref osmo_ss7_instance to which we belong */ + struct osmo_ss7_instance *inst; + /*! list of \ref osmo_ss7_route */ + struct llist_head routes; + + struct { + char *name; + char *description; + } cfg; +}; + +struct osmo_ss7_route_table * +ss7_route_table_find(struct osmo_ss7_instance *inst, const char *name); +struct osmo_ss7_route_table * +ss7_route_table_find_or_create(struct osmo_ss7_instance *inst, const char *name); +void ss7_route_table_destroy(struct osmo_ss7_route_table *rtbl); + +struct osmo_ss7_route * +ss7_route_table_find_route_by_dpc(struct osmo_ss7_route_table *rtbl, uint32_t dpc); +struct osmo_ss7_route * +ss7_route_table_find_route_by_dpc_mask(struct osmo_ss7_route_table *rtbl, uint32_t dpc, + uint32_t mask); diff --git a/src/xua_as_fsm.c b/src/xua_as_fsm.c index 65f723c..2083ca0 100644 --- a/src/xua_as_fsm.c +++ b/src/xua_as_fsm.c @@ -23,6 +23,7 @@ #include <osmocom/sigtran/protocol/sua.h> #include <osmocom/sigtran/protocol/m3ua.h> +#include "ss7_route_table.h" #include "xua_asp_fsm.h" #include "xua_as_fsm.h" #include "xua_internal.h" @@ -230,7 +231,7 @@ struct osmo_ss7_as *as = xafp->as; struct osmo_ss7_instance *inst = as->inst; - if (osmo_ss7_route_find_dpc_mask(inst->rtable_system, as->cfg.routing_key.pc, 0xffffff)) + if (ss7_route_table_find_route_by_dpc_mask(inst->rtable_system, as->cfg.routing_key.pc, 0xffffff)) return; /* As opposed to M3UA, there is no RKM and we have to implicitly @@ -251,7 +252,7 @@ return; /* find the route which we have created if we ever reached ipa_asp_fsm_wait_id_ack2 */ - rt = osmo_ss7_route_find_dpc_mask(inst->rtable_system, as->cfg.routing_key.pc, 0xffffff); + rt = ss7_route_table_find_route_by_dpc_mask(inst->rtable_system, as->cfg.routing_key.pc, 0xffffff); /* no route found, bail out */ if (!rt) { LOGPFSML(fi, LOGL_NOTICE, "Attempting to delete route for this IPA AS, but cannot " diff --git a/src/xua_rkm.c b/src/xua_rkm.c index 007f4f7..774cf3a 100644 --- a/src/xua_rkm.c +++ b/src/xua_rkm.c @@ -28,6 +28,7 @@ #include <osmocom/sigtran/osmo_ss7.h> #include <osmocom/sigtran/protocol/m3ua.h> +#include "ss7_route_table.h" #include "xua_internal.h" #include "xua_as_fsm.h" #include "xua_asp_fsm.h" @@ -372,7 +373,7 @@ return -1; } - rt = osmo_ss7_route_find_dpc(inst->rtable_system, as->cfg.routing_key.pc); + rt = ss7_route_table_find_route_by_dpc(inst->rtable_system, as->cfg.routing_key.pc); if (!rt) { msgb_append_dereg_res(resp, M3UA_RKM_DEREG_ERR_UNKNOWN, 0); return -1; diff --git a/tests/ss7/ss7_test.c b/tests/ss7/ss7_test.c index ad8dc77..5f00f78 100644 --- a/tests/ss7/ss7_test.c +++ b/tests/ss7/ss7_test.c @@ -1,3 +1,4 @@ +#include "../src/ss7_route_table.h" #include "../src/xua_internal.h" #include "../src/xua_asp_fsm.h" @@ -143,15 +144,15 @@ printf("Testing SS7 routing\n"); /* creation / destruction */ - OSMO_ASSERT(osmo_ss7_route_table_find(s7i, "foobar") == NULL); - rtbl = osmo_ss7_route_table_find_or_create(s7i, "foobar"); + OSMO_ASSERT(ss7_route_table_find(s7i, "foobar") == NULL); + rtbl = ss7_route_table_find_or_create(s7i, "foobar"); OSMO_ASSERT(rtbl); - OSMO_ASSERT(osmo_ss7_route_table_find_or_create(s7i, "foobar") == rtbl); - osmo_ss7_route_table_destroy(rtbl); - OSMO_ASSERT(osmo_ss7_route_table_find(s7i, "foobar") == NULL); + OSMO_ASSERT(ss7_route_table_find_or_create(s7i, "foobar") == rtbl); + ss7_route_table_destroy(rtbl); + OSMO_ASSERT(ss7_route_table_find(s7i, "foobar") == NULL); /* we now work with system route table */ - rtbl = osmo_ss7_route_table_find(s7i, "system"); + rtbl = ss7_route_table_find(s7i, "system"); OSMO_ASSERT(rtbl && rtbl == s7i->rtable_system); lset_a = osmo_ss7_linkset_find_or_create(s7i, "a", 100); @@ -160,32 +161,32 @@ OSMO_ASSERT(lset_b); /* route with full mask */ - OSMO_ASSERT(osmo_ss7_route_find_dpc(rtbl, 12) == NULL); + OSMO_ASSERT(ss7_route_table_find_route_by_dpc(rtbl, 12) == NULL); rt = osmo_ss7_route_create(rtbl, 12, 0xffff, "a"); printf("route with full mask: %s\n", osmo_ss7_route_print(rt)); OSMO_ASSERT(rt); - OSMO_ASSERT(osmo_ss7_route_find_dpc(rtbl, 12) == rt); + OSMO_ASSERT(ss7_route_table_find_route_by_dpc(rtbl, 12) == rt); osmo_ss7_route_destroy(rt); /* route with partial mask */ rt = osmo_ss7_route_create(rtbl, 8, 0xfff8, "a"); printf("route with partial mask: %s\n", osmo_ss7_route_print(rt)); - OSMO_ASSERT(osmo_ss7_route_find_dpc(rtbl, 8) == rt); - OSMO_ASSERT(osmo_ss7_route_find_dpc(rtbl, 9) == rt); - OSMO_ASSERT(osmo_ss7_route_find_dpc(rtbl, 12) == rt); - OSMO_ASSERT(osmo_ss7_route_find_dpc(rtbl, 15) == rt); - OSMO_ASSERT(osmo_ss7_route_find_dpc(rtbl, 16) == NULL); + OSMO_ASSERT(ss7_route_table_find_route_by_dpc(rtbl, 8) == rt); + OSMO_ASSERT(ss7_route_table_find_route_by_dpc(rtbl, 9) == rt); + OSMO_ASSERT(ss7_route_table_find_route_by_dpc(rtbl, 12) == rt); + OSMO_ASSERT(ss7_route_table_find_route_by_dpc(rtbl, 15) == rt); + OSMO_ASSERT(ss7_route_table_find_route_by_dpc(rtbl, 16) == NULL); /* insert more specific route for 12, must have higher priority * than existing one */ rt12 = osmo_ss7_route_create(rtbl, 12, 0xffff, "b"); - OSMO_ASSERT(osmo_ss7_route_find_dpc(rtbl, 12) == rt12); - OSMO_ASSERT(osmo_ss7_route_find_dpc(rtbl, 15) == rt); - OSMO_ASSERT(osmo_ss7_route_find_dpc(rtbl, 16) == NULL); + OSMO_ASSERT(ss7_route_table_find_route_by_dpc(rtbl, 12) == rt12); + OSMO_ASSERT(ss7_route_table_find_route_by_dpc(rtbl, 15) == rt); + OSMO_ASSERT(ss7_route_table_find_route_by_dpc(rtbl, 16) == NULL); /* add a default route, which should have lowest precedence */ rtdef = osmo_ss7_route_create(rtbl, 0, 0, "a"); - OSMO_ASSERT(osmo_ss7_route_find_dpc(rtbl, 12) == rt12); - OSMO_ASSERT(osmo_ss7_route_find_dpc(rtbl, 15) == rt); - OSMO_ASSERT(osmo_ss7_route_find_dpc(rtbl, 16) == rtdef); + OSMO_ASSERT(ss7_route_table_find_route_by_dpc(rtbl, 12) == rt12); + OSMO_ASSERT(ss7_route_table_find_route_by_dpc(rtbl, 15) == rt); + OSMO_ASSERT(ss7_route_table_find_route_by_dpc(rtbl, 16) == rtdef); osmo_ss7_route_destroy(rtdef); osmo_ss7_route_destroy(rt12); -- To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/38626?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: libosmo-sigtran Gerrit-Branch: master Gerrit-Change-Id: Ie7c709c9849ef3d50aef94f79751c9c4a010c92a Gerrit-Change-Number: 38626 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
[M] Change in libosmo-pfcp[master]: pfcp: Make struct osmo_pfcp_cp_peer private
by osmith 05 Nov '24

05 Nov '24
Attention is currently required from: fixeria, laforge, pespin. osmith has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/libosmo-pfcp/+/38612?usp=email ) Change subject: pfcp: Make struct osmo_pfcp_cp_peer private ...................................................................... Patch Set 5: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmo-pfcp/+/38612?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: libosmo-pfcp Gerrit-Branch: master Gerrit-Change-Id: I7f79ce239cb3c57bae2cf5846edf71e1aa03fa95 Gerrit-Change-Number: 38612 Gerrit-PatchSet: 5 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Tue, 05 Nov 2024 09:53:15 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[S] Change in libosmo-pfcp[master]: pfcp: Add APIs to access struct osmo_pfcp_cp_peer
by osmith 05 Nov '24

05 Nov '24
Attention is currently required from: fixeria, laforge, pespin. osmith has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/libosmo-pfcp/+/38622?usp=email ) Change subject: pfcp: Add APIs to access struct osmo_pfcp_cp_peer ...................................................................... Patch Set 3: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmo-pfcp/+/38622?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: libosmo-pfcp Gerrit-Branch: master Gerrit-Change-Id: Ic8a5d5ec4237aa8520d426252c924c9617d1d08a Gerrit-Change-Number: 38622 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Tue, 05 Nov 2024 09:52:04 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • ...
  • 221
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.