aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2020-12-29 16:07:17 +0100
committerDaniel Willmann <dwillmann@sysmocom.de>2020-12-29 16:41:43 +0100
commit00c1f91ed795c643fcb2c71fe22819d702a57fb3 (patch)
tree5f2fb20b644af94569f7ef165e24e1b120740615
parent8d382c5337b6166b8799c6c14dcade1a5376bd89 (diff)
gbproxy: Add comments to sgsn functions
-rw-r--r--src/gbproxy/gb_proxy_main.c2
-rw-r--r--src/gbproxy/gb_proxy_peer.c23
2 files changed, 24 insertions, 1 deletions
diff --git a/src/gbproxy/gb_proxy_main.c b/src/gbproxy/gb_proxy_main.c
index e85e9515b..c660edef8 100644
--- a/src/gbproxy/gb_proxy_main.c
+++ b/src/gbproxy/gb_proxy_main.c
@@ -303,6 +303,8 @@ int main(int argc, char **argv)
gprs_ns2_vty_create();
+ /* TODO: Warn if we create a gbproxy_nse for an NSEI which we don't have a bind */
+
/* start telnet after reading config for vty_get_bind_addr() */
rc = telnet_init_dynif(tall_sgsn_ctx, NULL,
vty_get_bind_addr(), OSMO_VTY_PORT_GBPROXY);
diff --git a/src/gbproxy/gb_proxy_peer.c b/src/gbproxy/gb_proxy_peer.c
index 595e2a654..a966c6ce6 100644
--- a/src/gbproxy/gb_proxy_peer.c
+++ b/src/gbproxy/gb_proxy_peer.c
@@ -343,7 +343,15 @@ struct gbproxy_nse *gbproxy_nse_by_nsei_or_new(struct gbproxy_config *cfg, uint1
return nse;
}
-/* SGSN */
+/***********************************************************************
+ * SGSN - Serving GPRS Support Node
+ ***********************************************************************/
+
+/*! Allocate a new SGSN. This ensures the corresponding gbproxy_nse is allocated as well
+ * \param[in] cfg The gbproxy configuration
+ * \param[in] nsei The nsei where the SGSN can be reached
+ * \return The SGSN, NULL if it couldn't be allocated
+ */
struct gbproxy_sgsn *gbproxy_sgsn_alloc(struct gbproxy_config *cfg, uint16_t nsei)
{
struct gbproxy_sgsn *sgsn;
@@ -381,6 +389,9 @@ static void _sgsn_free(struct gbproxy_sgsn *sgsn) {
talloc_free(sgsn);
}
+/*! Free the SGSN. This ensures the corresponding gbproxy_nse is freed as well
+ * \param[in] sgsn The SGSN
+ */
void gbproxy_sgsn_free(struct gbproxy_sgsn *sgsn)
{
if (!sgsn)
@@ -392,6 +403,11 @@ void gbproxy_sgsn_free(struct gbproxy_sgsn *sgsn)
_sgsn_free(sgsn);
}
+/*! Return the SGSN for a given NSEI
+ * \param[in] cfg The gbproxy configuration
+ * \param[in] nsei The nsei where the SGSN can be reached
+ * \return Returns the matching SGSN or NULL if it couldn't be found
+ */
struct gbproxy_sgsn *gbproxy_sgsn_by_nsei(struct gbproxy_config *cfg, uint16_t nsei)
{
struct gbproxy_sgsn *sgsn;
@@ -405,6 +421,11 @@ struct gbproxy_sgsn *gbproxy_sgsn_by_nsei(struct gbproxy_config *cfg, uint16_t n
return NULL;
}
+/*! Return the SGSN for a given NSEI, creating a new one if none exists
+ * \param[in] cfg The gbproxy configuration
+ * \param[in] nsei The nsei where the SGSN can be reached
+ * \return Returns the SGSN
+ */
struct gbproxy_sgsn *gbproxy_sgsn_by_nsei_or_new(struct gbproxy_config *cfg, uint16_t nsei)
{
struct gbproxy_sgsn *sgsn;