pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/29746 )
Change subject: mgcp-client: Move internal API acting on mgcp_client_pool to the correct file section ......................................................................
mgcp-client: Move internal API acting on mgcp_client_pool to the correct file section
Change-Id: Ia0cccb783918eea72c4a77861dac4b60ad369b95 --- M src/libosmo-mgcp-client/mgcp_client_pool.c 1 file changed, 26 insertions(+), 26 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/46/29746/1
diff --git a/src/libosmo-mgcp-client/mgcp_client_pool.c b/src/libosmo-mgcp-client/mgcp_client_pool.c index c8282fe..72962ac 100644 --- a/src/libosmo-mgcp-client/mgcp_client_pool.c +++ b/src/libosmo-mgcp-client/mgcp_client_pool.c @@ -27,32 +27,6 @@ #define LOGPPMGW(pool_member, level, fmt, args...) \ LOGP(DLMGCP, level, "MGW-pool(%s) " fmt, mgcp_client_pool_member_name(pool_member), ## args)
-/* Get a human readable name for a given pool member. */ -const char *mgcp_client_pool_member_name(const struct mgcp_client_pool_member *pool_member) -{ - const struct mgcp_client *mpcp_client; - struct mgcp_client mpcp_client_dummy; - static char name[512]; - const char *description; - - if (!pool_member) - return "(null)"; - - /* It is not guranteed that a pool_member has an MGCP client. The client may not yet be initialized or the - * initalization may have been failed. In this case we will generate a dummy MGCP client to work with. */ - if (!pool_member->client) { - memcpy(&mpcp_client_dummy.actual, &pool_member->conf, sizeof(mpcp_client_dummy.actual)); - mpcp_client = &mpcp_client_dummy; - } else { - mpcp_client = pool_member->client; - } - - description = mgcp_client_name(mpcp_client); - snprintf(name, sizeof(name), "%d:%s", pool_member->nr, description); - - return name; -} - /*! Allocate MGCP client pool. This is called once on startup and before the pool is used with * mgcp_client_pool_vty_init(). Since the pool is linked with the VTY it must exist througout the entire runtime. * \param[in] talloc_ctx talloc context. */ @@ -263,3 +237,29 @@ } talloc_free(pool_member); } + +/* Get a human readable name for a given pool member. */ +const char *mgcp_client_pool_member_name(const struct mgcp_client_pool_member *pool_member) +{ + const struct mgcp_client *mpcp_client; + struct mgcp_client mpcp_client_dummy; + static char name[512]; + const char *description; + + if (!pool_member) + return "(null)"; + + /* It is not guranteed that a pool_member has an MGCP client. The client may not yet be initialized or the + * initalization may have been failed. In this case we will generate a dummy MGCP client to work with. */ + if (!pool_member->client) { + memcpy(&mpcp_client_dummy.actual, &pool_member->conf, sizeof(mpcp_client_dummy.actual)); + mpcp_client = &mpcp_client_dummy; + } else { + mpcp_client = pool_member->client; + } + + description = mgcp_client_name(mpcp_client); + snprintf(name, sizeof(name), "%d:%s", pool_member->nr, description); + + return name; +} \ No newline at end of file