diff options
author | Harald Welte <laforge@gnumonks.org> | 2017-02-12 19:46:02 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-02-13 15:09:17 +0100 |
commit | 0dd089f17dfa6ea2a092cd76d9e65ac96b923635 (patch) | |
tree | 7adfde4e9d6a5d66eb100afda4a3b7e5068ae782 /src/xua_msg.c | |
parent | f17725a86f0c895ca1d73f73a95754de20a4c7ad (diff) |
Move xua_msg_add_sccp_addr() to xua_msg.h and export it
Change-Id: I07fa00dd71d8ecdf1542734598fab8ecad5a7b53
Diffstat (limited to 'src/xua_msg.c')
-rw-r--r-- | src/xua_msg.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/xua_msg.c b/src/xua_msg.c index 8610621..3d335d9 100644 --- a/src/xua_msg.c +++ b/src/xua_msg.c @@ -17,6 +17,8 @@ */ #include <osmocom/sigtran/xua_msg.h> +#include <osmocom/sigtran/protocol/sua.h> +#include <osmocom/sigtran/sccp_sap.h> #include <osmocom/core/msgb.h> #include <osmocom/core/logging.h> @@ -236,3 +238,34 @@ uint32_t xua_msg_get_u32(struct xua_msg *xua, uint16_t iei) rc = ntohl(*(uint32_t *)part->dat); return rc; } + +int xua_msg_add_sccp_addr(struct xua_msg *xua, uint16_t iei, const struct osmo_sccp_addr *addr) +{ + struct msgb *tmp = msgb_alloc(128, "SCCP Address"); + int rc; + + if (!tmp) + return -ENOMEM; + + msgb_put_u16(tmp, SUA_RI_SSN_PC); /* route on SSN + PC */ + msgb_put_u16(tmp, 7); /* always put all addresses on SCCP side */ + + if (addr->presence & OSMO_SCCP_ADDR_T_GT) { + /* FIXME */ + } + if (addr->presence & OSMO_SCCP_ADDR_T_PC) { + msgb_t16l16vp_put_u32(tmp, SUA_IEI_PC, addr->pc); + } + if (addr->presence & OSMO_SCCP_ADDR_T_SSN) { + msgb_t16l16vp_put_u32(tmp, SUA_IEI_SSN, addr->ssn); + } + if (addr->presence & OSMO_SCCP_ADDR_T_IPv4) { + /* FIXME: IPv4 address */ + } else if (addr->presence & OSMO_SCCP_ADDR_T_IPv6) { + /* FIXME: IPv6 address */ + } + rc = xua_msg_add_data(xua, iei, msgb_length(tmp), tmp->data); + msgb_free(tmp); + + return rc; +} |