This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has submitted this change and it was merged. Change subject: xua: move notfiy parameters from xua_internal to sigtran_sap and rename them ...................................................................... xua: move notfiy parameters from xua_internal to sigtran_sap and rename them Change-Id: I295b9d6755a4bb52a817d2791a302bdd9fc775dd --- M include/osmocom/sigtran/sigtran_sap.h M src/m3ua.c M src/sua.c M src/xua_as_fsm.c M src/xua_asp_fsm.c M src/xua_internal.h 6 files changed, 55 insertions(+), 44 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/sigtran/sigtran_sap.h b/include/osmocom/sigtran/sigtran_sap.h index d29c37d..d18aa3d 100644 --- a/include/osmocom/sigtran/sigtran_sap.h +++ b/include/osmocom/sigtran/sigtran_sap.h @@ -1,6 +1,7 @@ #pragma once #include <osmocom/core/prim.h> + enum osmo_sigtran_sap { SCCP_SAP_USER = _SAP_SS7_BASE, /* xUA Layer Manager */ @@ -29,10 +30,27 @@ OSMO_XLM_PRIM_M_RK_DEREG, }; +#define NOTIFY_PAR_P_ASP_ID (1 << 0) +#define NOTIFY_PAR_P_ROUTE_CTX (1 << 1) + +struct osmo_xlm_prim_notify { + uint32_t presence; + uint16_t status_type; + uint16_t status_info; + uint32_t asp_id; + uint32_t route_ctx; + char *info_string; +}; + +struct osmo_xlm_prim_error { + uint32_t code; +}; struct osmo_xlm_prim { struct osmo_prim_hdr oph; union { + struct osmo_xlm_prim_notify notify; + struct osmo_xlm_prim_error error; } u; }; diff --git a/src/m3ua.c b/src/m3ua.c index 031e5cd..0ec4529 100644 --- a/src/m3ua.c +++ b/src/m3ua.c @@ -350,7 +350,7 @@ ***********************************************************************/ /* RFC4666 Ch. 3.8.2. Notify */ -struct xua_msg *m3ua_encode_notify(const struct m3ua_notify_params *npar) +struct xua_msg *m3ua_encode_notify(const struct osmo_xlm_prim_notify *npar) { struct xua_msg *xua = xua_msg_alloc(); uint32_t status; @@ -379,7 +379,7 @@ } /* RFC4666 Ch. 3.8.2. Notify */ -int m3ua_decode_notify(struct m3ua_notify_params *npar, void *ctx, +int m3ua_decode_notify(struct osmo_xlm_prim_notify *npar, void *ctx, const struct xua_msg *xua) { struct xua_msg_part *info_ie, *aspid_ie, *status_ie, *rctx_ie; @@ -538,7 +538,7 @@ static int m3ua_rx_mgmt_ntfy(struct osmo_ss7_asp *asp, struct xua_msg *xua) { - struct m3ua_notify_params ntfy; + struct osmo_xlm_prim_notify ntfy; const char *type_name, *info_name; m3ua_decode_notify(&ntfy, asp, xua); diff --git a/src/sua.c b/src/sua.c index 2f8acf2..881191e 100644 --- a/src/sua.c +++ b/src/sua.c @@ -507,7 +507,7 @@ static int sua_rx_mgmt_ntfy(struct osmo_ss7_asp *asp, struct xua_msg *xua) { - struct m3ua_notify_params ntfy; + struct osmo_xlm_prim_notify ntfy; const char *type_name, *info_name; m3ua_decode_notify(&ntfy, asp, xua); diff --git a/src/xua_as_fsm.c b/src/xua_as_fsm.c index d73f793..740070b 100644 --- a/src/xua_as_fsm.c +++ b/src/xua_as_fsm.c @@ -25,7 +25,7 @@ #include "xua_as_fsm.h" #include "xua_internal.h" -static struct msgb *encode_notify(const struct m3ua_notify_params *npar) +static struct msgb *encode_notify(const struct osmo_xlm_prim_notify *npar) { struct xua_msg *xua = m3ua_encode_notify(npar); struct msgb *msg = xua_to_msg(M3UA_VERSION, xua); @@ -33,7 +33,7 @@ return msg; } -static int asp_notify_all_as(struct osmo_ss7_as *as, struct m3ua_notify_params *npar) +static int asp_notify_all_as(struct osmo_ss7_as *as, struct osmo_xlm_prim_notify *npar) { struct msgb *msg; unsigned int i, sent = 0; @@ -150,7 +150,7 @@ { struct xua_as_fsm_priv *xafp = (struct xua_as_fsm_priv *) fi->priv; struct osmo_ss7_as *as = xafp->as; - struct m3ua_notify_params npar = { + struct osmo_xlm_prim_notify npar = { .status_type = M3UA_NOTIFY_T_STATCHG, }; diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c index aafc09f..d38a18a 100644 --- a/src/xua_asp_fsm.c +++ b/src/xua_asp_fsm.c @@ -89,42 +89,42 @@ } t_ack; }; -static struct msgb *xlm_msgb_alloc(void) +struct osmo_xlm_prim *xua_xlm_prim_alloc(enum osmo_xlm_prim_type prim_type, + enum osmo_prim_operation op) { - return msgb_alloc_headroom(2048+128, 128, "xua_asp-xlm msgb"); + struct osmo_xlm_prim *prim; + struct msgb *msg = msgb_alloc_headroom(2048+128, 128, "xua_asp-xlm msgb"); + if (!msg) + return NULL; + + prim = (struct osmo_xlm_prim *) msgb_put(msg, sizeof(*prim)); + osmo_prim_init(&prim->oph, XUA_SAP_LM, prim_type, op, msg); + + return prim; } /* Send a XUA LM Primitive to the XUA Layer Manager (LM) */ -static int send_xlm_prim(struct osmo_fsm_inst *fi, - enum osmo_xlm_prim_type prim_type, - enum osmo_prim_operation op, - const uint8_t *data, unsigned int data_len) +void xua_asp_send_xlm_prim(struct osmo_ss7_asp *asp, struct osmo_xlm_prim *prim) { - struct xua_asp_fsm_priv *xafp = fi->priv; - struct msgb *xlmsg; - struct osmo_xlm_prim *prim; + struct xua_asp_fsm_priv *xafp = asp->fi->priv; struct xua_layer_manager *lm = xafp->lm; - if (!lm || !lm->prim_cb) - return 0; + if (lm && lm->prim_cb) + lm->prim_cb(&prim->oph, xafp->asp); - xlmsg = xlm_msgb_alloc(); - if (!xlmsg) - return -ENOMEM; - prim = (struct osmo_xlm_prim *) msgb_put(xlmsg, sizeof(*prim)); - osmo_prim_init(&prim->oph, XUA_SAP_LM, prim_type, op, xlmsg); - - lm->prim_cb(&prim->oph, xafp->asp); - - return 0; + msgb_free(prim->oph.msg); } /* wrapper around send_xlm_prim for primitives without data */ -static int send_xlm_prim_simple(struct osmo_fsm_inst *fi, - enum osmo_xlm_prim_type prim, +static void send_xlm_prim_simple(struct osmo_fsm_inst *fi, + enum osmo_xlm_prim_type prim_type, enum osmo_prim_operation op) { - return send_xlm_prim(fi, prim, op, NULL, 0); + struct osmo_xlm_prim *prim = xua_xlm_prim_alloc(prim_type, op); + struct xua_asp_fsm_priv *xafp = fi->priv; + if (!prim) + return; + xua_asp_send_xlm_prim(xafp->asp, prim); } /* ask the xUA implementation to transmit a specific message */ diff --git a/src/xua_internal.h b/src/xua_internal.h index 24fcb1c..6a3f723 100644 --- a/src/xua_internal.h +++ b/src/xua_internal.h @@ -43,19 +43,12 @@ extern const struct value_string m3ua_ntfy_stchg_names[]; extern const struct value_string m3ua_ntfy_other_names[]; -#define NOTIFY_PAR_P_ASP_ID (1 << 0) -#define NOTIFY_PAR_P_ROUTE_CTX (1 << 1) - -struct m3ua_notify_params { - uint32_t presence; - uint16_t status_type; - uint16_t status_info; - uint32_t asp_id; - uint32_t route_ctx; - char *info_string; -}; - -struct xua_msg *m3ua_encode_notify(const struct m3ua_notify_params *npar); -int m3ua_decode_notify(struct m3ua_notify_params *npar, void *ctx, +struct xua_msg *m3ua_encode_notify(const struct osmo_xlm_prim_notify *npar); +int m3ua_decode_notify(struct osmo_xlm_prim_notify *npar, void *ctx, const struct xua_msg *xua); int m3ua_rx_rkm(struct osmo_ss7_asp *asp, struct xua_msg *xua); + +struct osmo_xlm_prim *xua_xlm_prim_alloc(enum osmo_xlm_prim_type prim_type, + enum osmo_prim_operation op); + +void xua_asp_send_xlm_prim(struct osmo_ss7_asp *asp, struct osmo_xlm_prim *prim); -- To view, visit https://gerrit.osmocom.org/2261 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I295b9d6755a4bb52a817d2791a302bdd9fc775dd Gerrit-PatchSet: 7 Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Owner: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder