cosmetic: hnbgw: addr related renames, move define, move comment
Prepare for parameterization of IuCS and IuPS addresses:
Conform internal variable naming to local-ip, local-port, remote-ip,
remote-port (instead of bind-ip).
Rename HNBGW_IUH_LOCAL_IP_DEFAULT to HNGGW_LOCAL_IP_DEFAULT to be more general
and move it to the top.
Move a function doc comment to the .c file.
Change-Id: Ice85941c978498e3ddf41d151248507e7f56cb5d
diff --git a/src/hnbgw.c b/src/hnbgw.c
index 8d6dbb1..eb36367 100644
--- a/src/hnbgw.c
+++ b/src/hnbgw.c
@@ -76,7 +76,7 @@
{
struct hnb_gw *gw = talloc_zero(ctx, struct hnb_gw);
- gw->config.iuh_listen_port = IUH_DEFAULT_SCTP_PORT;
+ gw->config.iuh_local_port = IUH_DEFAULT_SCTP_PORT;
gw->next_ue_ctx_id = 23;
INIT_LLIST_HEAD(&gw->hnb_list);
@@ -308,11 +308,15 @@
return 0;
}
-const char *hnbgw_get_iuh_bind_addr(struct hnb_gw *gw)
+/*
+ * Return IP address passed to the hnbgw/iuh/local-ip command, or
+ * HNBGW_LOCAL_IP_DEFAULT.
+ */
+const char *hnbgw_get_iuh_local_ip(struct hnb_gw *gw)
{
- const char *addr = gw->config.iuh_bind_addr;
+ const char *addr = gw->config.iuh_local_ip;
if (!addr)
- addr = HNBGW_IUH_LOCAL_IP_DEFAULT;
+ addr = HNBGW_LOCAL_IP_DEFAULT;
return addr;
}
@@ -507,8 +511,8 @@
g_hnb_gw->cnlink_ps = hnbgw_cnlink_init(g_hnb_gw, "127.0.0.2", SUA_PORT, 1);
LOGP(DMAIN, LOGL_NOTICE, "Listening for Iuh at %s %d\n",
- hnbgw_get_iuh_bind_addr(g_hnb_gw),
- g_hnb_gw->config.iuh_listen_port);
+ hnbgw_get_iuh_local_ip(g_hnb_gw),
+ g_hnb_gw->config.iuh_local_port);
srv = osmo_stream_srv_link_create(tall_hnb_ctx);
if (!srv) {
perror("cannot create server");
@@ -516,8 +520,8 @@
}
osmo_stream_srv_link_set_data(srv, g_hnb_gw);
osmo_stream_srv_link_set_proto(srv, IPPROTO_SCTP);
- osmo_stream_srv_link_set_addr(srv, hnbgw_get_iuh_bind_addr(g_hnb_gw));
- osmo_stream_srv_link_set_port(srv, g_hnb_gw->config.iuh_listen_port);
+ osmo_stream_srv_link_set_addr(srv, hnbgw_get_iuh_local_ip(g_hnb_gw));
+ osmo_stream_srv_link_set_port(srv, g_hnb_gw->config.iuh_local_port);
osmo_stream_srv_link_set_accept_cb(srv, accept_cb);
if (osmo_stream_srv_link_open(srv) < 0) {