move MGW endpoint FSM from osmo-bsc to here
Move mgw_endpoint_fsm from osmo-bsc here as osmo_mgcpc_ep_fsm. Apply various
renames for consistency. Use osmo_tdef from libosmocore instead of osmo-bsc's
(so far) local T_defs API.
Change T23042 to T2427001, which is a slightly less arbitrary number and
slightly more extendable in the future (2427 corresponds to the default MGCP
port at osmo-mgw, 001 is the first MGCP timer and so far the only one).
Change-Id: I9a3effd38e72841529df6c135c077116981dea36
diff --git a/src/libosmo-mgcp-client/mgcp_client_fsm.c b/src/libosmo-mgcp-client/mgcp_client_fsm.c
index 71f4310..75d583b 100644
--- a/src/libosmo-mgcp-client/mgcp_client_fsm.c
+++ b/src/libosmo-mgcp-client/mgcp_client_fsm.c
@@ -700,3 +700,25 @@
}
osmo_fsm_inst_dispatch(fi, EV_DLCX, mgcp_ctx);
}
+
+const char *osmo_mgcpc_conn_peer_name(const struct mgcp_conn_peer *info)
+{
+ /* I'd be fine with a smaller buffer and accept truncation, but gcc possibly refuses to build if
+ * this buffer is too small. */
+ static char buf[1024];
+
+ if (!info)
+ return "NULL";
+
+ if (info->endpoint[0]
+ && info->addr[0])
+ snprintf(buf, sizeof(buf), "%s:%s:%u",
+ info->endpoint, info->addr, info->port);
+ else if (info->endpoint[0])
+ snprintf(buf, sizeof(buf), "%s", info->endpoint);
+ else if (info->addr[0])
+ snprintf(buf, sizeof(buf), "%s:%u", info->addr, info->port);
+ else
+ return "empty";
+ return buf;
+}