rename mgcpgw_client_* to mgcp_client_*

The name "mgcpgw_client" referred to an MGCP gateway, which is rather an MGW
(Media Gateway). But this client code is more generally a client for the MGCP
protocol, independently from what the server program is called.

Rename the files as well as the function prefixes to drop the "gw". It is
purely cosmetic and not strictly necessary, but a good point in time for fixes
like this.

osmo-msc build will be adjusted by I093ad02ca0e532f659447c785e09678b3e6f220d.
osmo-bsc build will be adjusted by I6402c7cbe58dacae7630f7f03819f8102e54c699.
These should be applied right after this here is merged to avoid fallout.

Change-Id: I99f7faab637cfcc22ece64a1dbcbe590f2042187
This commit is contained in:
Neels Hofmeyr 2017-09-04 01:02:56 +02:00 committed by Neels Hofmeyr
parent 97df691307
commit 3a8e723a0d
13 changed files with 175 additions and 175 deletions

View File

@ -6,5 +6,5 @@ nobase_include_HEADERS = \
osmocom/legacy_mgcp/mgcp.h \
osmocom/legacy_mgcp/mgcp_internal.h \
osmocom/legacy_mgcp/osmux.h \
osmocom/mgcp_client/mgcpgw_client.h \
osmocom/mgcp_client/mgcp_client.h \
$(NULL)

View File

@ -1,3 +1,3 @@
noinst_HEADERS = \
mgcpgw_client_internal.h \
mgcp_client_internal.h \
$(NULL)

View File

@ -0,0 +1,73 @@
#pragma once
#include <stdint.h>
#define MGCP_CLIENT_LOCAL_ADDR_DEFAULT "0.0.0.0"
#define MGCP_CLIENT_LOCAL_PORT_DEFAULT 0
#define MGCP_CLIENT_REMOTE_ADDR_DEFAULT "127.0.0.1"
#define MGCP_CLIENT_REMOTE_PORT_DEFAULT 2427
struct msgb;
struct vty;
struct mgcp_client;
struct mgcp_client_conf {
const char *local_addr;
int local_port;
const char *remote_addr;
int remote_port;
uint16_t first_endpoint;
uint16_t last_endpoint;
uint16_t bts_base;
};
typedef unsigned int mgcp_trans_id_t;
struct mgcp_response_head {
int response_code;
mgcp_trans_id_t trans_id;
const char *comment;
};
struct mgcp_response {
char *body;
struct mgcp_response_head head;
uint16_t audio_port;
};
void mgcp_client_conf_init(struct mgcp_client_conf *conf);
void mgcp_client_vty_init(void *talloc_ctx, int node, struct mgcp_client_conf *conf);
int mgcp_client_config_write(struct vty *vty, const char *indent);
struct mgcp_client_conf *mgcp_client_conf_actual(struct mgcp_client *mgcp);
struct mgcp_client *mgcp_client_init(void *ctx,
struct mgcp_client_conf *conf);
int mgcp_client_connect(struct mgcp_client *mgcp);
const char *mgcp_client_remote_addr_str(struct mgcp_client *mgcp);
uint16_t mgcp_client_remote_port(struct mgcp_client *mgcp);
uint32_t mgcp_client_remote_addr_n(struct mgcp_client *mgcp);
int mgcp_client_next_endpoint(struct mgcp_client *client);
void mgcp_client_release_endpoint(uint16_t id, struct mgcp_client *client);
/* Invoked when an MGCP response is received or sending failed. When the
* response is passed as NULL, this indicates failure during transmission. */
typedef void (* mgcp_response_cb_t )(struct mgcp_response *response, void *priv);
int mgcp_response_parse_params(struct mgcp_response *r);
int mgcp_client_tx(struct mgcp_client *mgcp, struct msgb *msg,
mgcp_response_cb_t response_cb, void *priv);
enum mgcp_connection_mode;
struct msgb *mgcp_msg_crcx(struct mgcp_client *mgcp,
uint16_t rtp_endpoint, unsigned int call_id,
enum mgcp_connection_mode mode);
struct msgb *mgcp_msg_mdcx(struct mgcp_client *mgcp,
uint16_t rtp_endpoint, const char *rtp_conn_addr,
uint16_t rtp_port, enum mgcp_connection_mode mode);
struct msgb *mgcp_msg_dlcx(struct mgcp_client *mgcp, uint16_t rtp_endpoint,
unsigned int call_id);

View File

@ -2,8 +2,8 @@
#define MSGB_CB_MGCP_TRANS_ID 0
struct mgcpgw_client {
struct mgcpgw_client_conf actual;
struct mgcp_client {
struct mgcp_client_conf actual;
uint32_t remote_addr;
struct osmo_wqueue wq;
mgcp_trans_id_t next_trans_id;
@ -24,10 +24,10 @@ struct mgcp_response_pending {
void *priv;
};
int mgcpgw_client_rx(struct mgcpgw_client *mgcp, struct msgb *msg);
int mgcp_client_rx(struct mgcp_client *mgcp, struct msgb *msg);
struct mgcp_response_pending * mgcpgw_client_pending_add(
struct mgcpgw_client *mgcp,
struct mgcp_response_pending * mgcp_client_pending_add(
struct mgcp_client *mgcp,
mgcp_trans_id_t trans_id,
mgcp_response_cb_t response_cb,
void *priv);

View File

@ -1,73 +0,0 @@
#pragma once
#include <stdint.h>
#define MGCPGW_CLIENT_LOCAL_ADDR_DEFAULT "0.0.0.0"
#define MGCPGW_CLIENT_LOCAL_PORT_DEFAULT 0
#define MGCPGW_CLIENT_REMOTE_ADDR_DEFAULT "127.0.0.1"
#define MGCPGW_CLIENT_REMOTE_PORT_DEFAULT 2427
struct msgb;
struct vty;
struct mgcpgw_client;
struct mgcpgw_client_conf {
const char *local_addr;
int local_port;
const char *remote_addr;
int remote_port;
uint16_t first_endpoint;
uint16_t last_endpoint;
uint16_t bts_base;
};
typedef unsigned int mgcp_trans_id_t;
struct mgcp_response_head {
int response_code;
mgcp_trans_id_t trans_id;
const char *comment;
};
struct mgcp_response {
char *body;
struct mgcp_response_head head;
uint16_t audio_port;
};
void mgcpgw_client_conf_init(struct mgcpgw_client_conf *conf);
void mgcpgw_client_vty_init(void *talloc_ctx, int node, struct mgcpgw_client_conf *conf);
int mgcpgw_client_config_write(struct vty *vty, const char *indent);
struct mgcpgw_client_conf *mgcpgw_client_conf_actual(struct mgcpgw_client *mgcp);
struct mgcpgw_client *mgcpgw_client_init(void *ctx,
struct mgcpgw_client_conf *conf);
int mgcpgw_client_connect(struct mgcpgw_client *mgcp);
const char *mgcpgw_client_remote_addr_str(struct mgcpgw_client *mgcp);
uint16_t mgcpgw_client_remote_port(struct mgcpgw_client *mgcp);
uint32_t mgcpgw_client_remote_addr_n(struct mgcpgw_client *mgcp);
int mgcpgw_client_next_endpoint(struct mgcpgw_client *client);
void mgcpgw_client_release_endpoint(uint16_t id, struct mgcpgw_client *client);
/* Invoked when an MGCP response is received or sending failed. When the
* response is passed as NULL, this indicates failure during transmission. */
typedef void (* mgcp_response_cb_t )(struct mgcp_response *response, void *priv);
int mgcp_response_parse_params(struct mgcp_response *r);
int mgcpgw_client_tx(struct mgcpgw_client *mgcp, struct msgb *msg,
mgcp_response_cb_t response_cb, void *priv);
enum mgcp_connection_mode;
struct msgb *mgcp_msg_crcx(struct mgcpgw_client *mgcp,
uint16_t rtp_endpoint, unsigned int call_id,
enum mgcp_connection_mode mode);
struct msgb *mgcp_msg_mdcx(struct mgcpgw_client *mgcp,
uint16_t rtp_endpoint, const char *rtp_conn_addr,
uint16_t rtp_port, enum mgcp_connection_mode mode);
struct msgb *mgcp_msg_dlcx(struct mgcpgw_client *mgcp, uint16_t rtp_endpoint,
unsigned int call_id);

View File

@ -29,8 +29,8 @@ lib_LTLIBRARIES = \
$(NULL)
libosmo_mgcp_client_la_SOURCES = \
mgcpgw_client.c \
mgcpgw_client_vty.c \
mgcp_client.c \
mgcp_client_vty.c \
../libosmo-legacy-mgcp/mgcp_common.c \
$(NULL)

View File

@ -26,8 +26,8 @@
#include <osmocom/legacy_mgcp/mgcp.h>
#include <osmocom/legacy_mgcp/mgcp_internal.h>
#include <osmocom/mgcp_client/mgcpgw_client.h>
#include <osmocom/mgcp_client/mgcpgw_client_internal.h>
#include <osmocom/mgcp_client/mgcp_client.h>
#include <osmocom/mgcp_client/mgcp_client_internal.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@ -36,10 +36,10 @@
#include <unistd.h>
#include <string.h>
void mgcpgw_client_conf_init(struct mgcpgw_client_conf *conf)
void mgcp_client_conf_init(struct mgcp_client_conf *conf)
{
/* NULL and -1 default to MGCPGW_CLIENT_*_DEFAULT values */
*conf = (struct mgcpgw_client_conf){
/* NULL and -1 default to MGCP_CLIENT_*_DEFAULT values */
*conf = (struct mgcp_client_conf){
.local_addr = NULL,
.local_port = -1,
.remote_addr = NULL,
@ -51,7 +51,7 @@ void mgcpgw_client_conf_init(struct mgcpgw_client_conf *conf)
}
/* Test if a given endpoint id is currently in use */
static bool endpoint_in_use(uint16_t id, struct mgcpgw_client *client)
static bool endpoint_in_use(uint16_t id, struct mgcp_client *client)
{
struct mgcp_inuse_endpoint *endpoint;
llist_for_each_entry(endpoint, &client->inuse_endpoints, entry) {
@ -63,7 +63,7 @@ static bool endpoint_in_use(uint16_t id, struct mgcpgw_client *client)
}
/* Find and seize an unsused endpoint id */
int mgcpgw_client_next_endpoint(struct mgcpgw_client *client)
int mgcp_client_next_endpoint(struct mgcp_client *client)
{
int i;
uint16_t first_endpoint = client->actual.first_endpoint;
@ -96,7 +96,7 @@ int mgcpgw_client_next_endpoint(struct mgcpgw_client *client)
}
/* Release a seized endpoint id to make it available again for other calls */
void mgcpgw_client_release_endpoint(uint16_t id, struct mgcpgw_client *client)
void mgcp_client_release_endpoint(uint16_t id, struct mgcp_client *client)
{
struct mgcp_inuse_endpoint *endpoint;
struct mgcp_inuse_endpoint *endpoint_tmp;
@ -108,9 +108,9 @@ void mgcpgw_client_release_endpoint(uint16_t id, struct mgcpgw_client *client)
}
}
static void mgcpgw_client_handle_response(struct mgcpgw_client *mgcp,
struct mgcp_response_pending *pending,
struct mgcp_response *response)
static void mgcp_client_handle_response(struct mgcp_client *mgcp,
struct mgcp_response_pending *pending,
struct mgcp_response *response)
{
if (!pending) {
LOGP(DLMGCP, LOGL_ERROR,
@ -226,8 +226,8 @@ int mgcp_response_parse_params(struct mgcp_response *r)
return 0;
}
static struct mgcp_response_pending *mgcpgw_client_response_pending_get(
struct mgcpgw_client *mgcp,
static struct mgcp_response_pending *mgcp_client_response_pending_get(
struct mgcp_client *mgcp,
struct mgcp_response *r)
{
struct mgcp_response_pending *pending;
@ -248,7 +248,7 @@ static struct mgcp_response_pending *mgcpgw_client_response_pending_get(
* mgcp_do_read that reads from the socket connected to the MGCP gateway. This
* function is published mainly to be able to feed data from the test suite.
*/
int mgcpgw_client_rx(struct mgcpgw_client *mgcp, struct msgb *msg)
int mgcp_client_rx(struct mgcp_client *mgcp, struct msgb *msg)
{
struct mgcp_response r = { 0 };
struct mgcp_response_pending *pending;
@ -260,7 +260,7 @@ int mgcpgw_client_rx(struct mgcpgw_client *mgcp, struct msgb *msg)
return -1;
}
pending = mgcpgw_client_response_pending_get(mgcp, &r);
pending = mgcp_client_response_pending_get(mgcp, &r);
if (!pending) {
LOGP(DLMGCP, LOGL_ERROR,
"Cannot find matching MGCP transaction for trans_id %d\n",
@ -268,13 +268,13 @@ int mgcpgw_client_rx(struct mgcpgw_client *mgcp, struct msgb *msg)
return -1;
}
mgcpgw_client_handle_response(mgcp, pending, &r);
mgcp_client_handle_response(mgcp, pending, &r);
return 0;
}
static int mgcp_do_read(struct osmo_fd *fd)
{
struct mgcpgw_client *mgcp = fd->data;
struct mgcp_client *mgcp = fd->data;
struct msgb *msg;
int ret;
@ -296,7 +296,7 @@ static int mgcp_do_read(struct osmo_fd *fd)
}
msg->l2h = msgb_put(msg, ret);
ret = mgcpgw_client_rx(mgcp, msg);
ret = mgcp_client_rx(mgcp, msg);
talloc_free(msg);
return ret;
}
@ -327,12 +327,12 @@ static int mgcp_do_write(struct osmo_fd *fd, struct msgb *msg)
return ret;
}
struct mgcpgw_client *mgcpgw_client_init(void *ctx,
struct mgcpgw_client_conf *conf)
struct mgcp_client *mgcp_client_init(void *ctx,
struct mgcp_client_conf *conf)
{
struct mgcpgw_client *mgcp;
struct mgcp_client *mgcp;
mgcp = talloc_zero(ctx, struct mgcpgw_client);
mgcp = talloc_zero(ctx, struct mgcp_client);
INIT_LLIST_HEAD(&mgcp->responses_pending);
INIT_LLIST_HEAD(&mgcp->inuse_endpoints);
@ -340,14 +340,14 @@ struct mgcpgw_client *mgcpgw_client_init(void *ctx,
mgcp->next_trans_id = 1;
mgcp->actual.local_addr = conf->local_addr ? conf->local_addr :
MGCPGW_CLIENT_LOCAL_ADDR_DEFAULT;
MGCP_CLIENT_LOCAL_ADDR_DEFAULT;
mgcp->actual.local_port = conf->local_port >= 0 ? (uint16_t)conf->local_port :
MGCPGW_CLIENT_LOCAL_PORT_DEFAULT;
MGCP_CLIENT_LOCAL_PORT_DEFAULT;
mgcp->actual.remote_addr = conf->remote_addr ? conf->remote_addr :
MGCPGW_CLIENT_REMOTE_ADDR_DEFAULT;
MGCP_CLIENT_REMOTE_ADDR_DEFAULT;
mgcp->actual.remote_port = conf->remote_port >= 0 ? (uint16_t)conf->remote_port :
MGCPGW_CLIENT_REMOTE_PORT_DEFAULT;
MGCP_CLIENT_REMOTE_PORT_DEFAULT;
mgcp->actual.first_endpoint = conf->first_endpoint > 0 ? (uint16_t)conf->first_endpoint : 0;
mgcp->actual.last_endpoint = conf->last_endpoint > 0 ? (uint16_t)conf->last_endpoint : 0;
@ -356,7 +356,7 @@ struct mgcpgw_client *mgcpgw_client_init(void *ctx,
return mgcp;
}
int mgcpgw_client_connect(struct mgcpgw_client *mgcp)
int mgcp_client_connect(struct mgcp_client *mgcp)
{
int on;
struct sockaddr_in addr;
@ -434,24 +434,24 @@ error_close_fd:
return rc;
}
const char *mgcpgw_client_remote_addr_str(struct mgcpgw_client *mgcp)
const char *mgcp_client_remote_addr_str(struct mgcp_client *mgcp)
{
return mgcp->actual.remote_addr;
}
uint16_t mgcpgw_client_remote_port(struct mgcpgw_client *mgcp)
uint16_t mgcp_client_remote_port(struct mgcp_client *mgcp)
{
return mgcp->actual.remote_port;
}
/* Return the MGCP GW binary IPv4 address in network byte order. */
uint32_t mgcpgw_client_remote_addr_n(struct mgcpgw_client *mgcp)
uint32_t mgcp_client_remote_addr_n(struct mgcp_client *mgcp)
{
return mgcp->remote_addr;
}
struct mgcp_response_pending * mgcpgw_client_pending_add(
struct mgcpgw_client *mgcp,
struct mgcp_response_pending * mgcp_client_pending_add(
struct mgcp_client *mgcp,
mgcp_trans_id_t trans_id,
mgcp_response_cb_t response_cb,
void *priv)
@ -472,8 +472,8 @@ struct mgcp_response_pending * mgcpgw_client_pending_add(
* mgcp_response_parse_params(response) to get the parsed parameters -- to
* potentially save some CPU cycles, only the head line has been parsed when
* the response_cb is invoked. */
int mgcpgw_client_tx(struct mgcpgw_client *mgcp, struct msgb *msg,
mgcp_response_cb_t response_cb, void *priv)
int mgcp_client_tx(struct mgcp_client *mgcp, struct msgb *msg,
mgcp_response_cb_t response_cb, void *priv)
{
struct mgcp_response_pending *pending;
mgcp_trans_id_t trans_id;
@ -487,7 +487,7 @@ int mgcpgw_client_tx(struct mgcpgw_client *mgcp, struct msgb *msg,
return -EINVAL;
}
pending = mgcpgw_client_pending_add(mgcp, trans_id, response_cb, priv);
pending = mgcp_client_pending_add(mgcp, trans_id, response_cb, priv);
if (msgb_l2len(msg) > 4096) {
LOGP(DLMGCP, LOGL_ERROR,
@ -510,7 +510,7 @@ int mgcpgw_client_tx(struct mgcpgw_client *mgcp, struct msgb *msg,
mgcp_tx_error:
/* Pass NULL to response cb to indicate an error */
mgcpgw_client_handle_response(mgcp, pending, NULL);
mgcp_client_handle_response(mgcp, pending, NULL);
return -1;
}
@ -562,7 +562,7 @@ static struct msgb *mgcp_msg_from_str(mgcp_trans_id_t trans_id,
return mgcp_msg_from_buf(trans_id, compose, len);
}
static mgcp_trans_id_t mgcpgw_client_next_trans_id(struct mgcpgw_client *mgcp)
static mgcp_trans_id_t mgcp_client_next_trans_id(struct mgcp_client *mgcp)
{
/* avoid zero trans_id to distinguish from unset trans_id */
if (!mgcp->next_trans_id)
@ -570,11 +570,11 @@ static mgcp_trans_id_t mgcpgw_client_next_trans_id(struct mgcpgw_client *mgcp)
return mgcp->next_trans_id ++;
}
struct msgb *mgcp_msg_crcx(struct mgcpgw_client *mgcp,
struct msgb *mgcp_msg_crcx(struct mgcp_client *mgcp,
uint16_t rtp_endpoint, unsigned int call_id,
enum mgcp_connection_mode mode)
{
mgcp_trans_id_t trans_id = mgcpgw_client_next_trans_id(mgcp);
mgcp_trans_id_t trans_id = mgcp_client_next_trans_id(mgcp);
return mgcp_msg_from_str(trans_id,
"CRCX %u %x@mgw MGCP 1.0\r\n"
"C: %x\r\n"
@ -587,12 +587,12 @@ struct msgb *mgcp_msg_crcx(struct mgcpgw_client *mgcp,
mgcp_cmode_name(mode));
}
struct msgb *mgcp_msg_mdcx(struct mgcpgw_client *mgcp,
struct msgb *mgcp_msg_mdcx(struct mgcp_client *mgcp,
uint16_t rtp_endpoint, const char *rtp_conn_addr,
uint16_t rtp_port, enum mgcp_connection_mode mode)
{
mgcp_trans_id_t trans_id = mgcpgw_client_next_trans_id(mgcp);
mgcp_trans_id_t trans_id = mgcp_client_next_trans_id(mgcp);
return mgcp_msg_from_str(trans_id,
"MDCX %u %x@mgw MGCP 1.0\r\n"
"M: %s\r\n"
@ -607,16 +607,16 @@ struct msgb *mgcp_msg_mdcx(struct mgcpgw_client *mgcp,
rtp_port);
}
struct msgb *mgcp_msg_dlcx(struct mgcpgw_client *mgcp, uint16_t rtp_endpoint,
struct msgb *mgcp_msg_dlcx(struct mgcp_client *mgcp, uint16_t rtp_endpoint,
unsigned int call_id)
{
mgcp_trans_id_t trans_id = mgcpgw_client_next_trans_id(mgcp);
mgcp_trans_id_t trans_id = mgcp_client_next_trans_id(mgcp);
return mgcp_msg_from_str(trans_id,
"DLCX %u %x@mgw MGCP 1.0\r\n"
"C: %x\r\n", trans_id, rtp_endpoint, call_id);
}
struct mgcpgw_client_conf *mgcpgw_client_conf_actual(struct mgcpgw_client *mgcp)
struct mgcp_client_conf *mgcp_client_conf_actual(struct mgcp_client *mgcp)
{
return &mgcp->actual;
}

View File

@ -28,23 +28,23 @@
#include <osmocom/core/utils.h>
#include <osmocom/legacy_mgcp/vty.h>
#include <osmocom/mgcp_client/mgcpgw_client.h>
#include <osmocom/mgcp_client/mgcp_client.h>
#define MGCPGW_STR "MGCP gateway configuration for RTP streams\n"
void *global_mgcpgw_client_ctx = NULL;
struct mgcpgw_client_conf *global_mgcpgw_client_conf = NULL;
void *global_mgcp_client_ctx = NULL;
struct mgcp_client_conf *global_mgcp_client_conf = NULL;
DEFUN(cfg_mgcpgw_local_ip, cfg_mgcpgw_local_ip_cmd,
"mgcpgw local-ip A.B.C.D",
MGCPGW_STR "local bind to connect to MGCP gateway with\n"
"local bind IP address\n")
{
if (!global_mgcpgw_client_conf)
if (!global_mgcp_client_conf)
return CMD_ERR_NOTHING_TODO;
OSMO_ASSERT(global_mgcpgw_client_ctx);
global_mgcpgw_client_conf->local_addr =
talloc_strdup(global_mgcpgw_client_ctx, argv[0]);
OSMO_ASSERT(global_mgcp_client_ctx);
global_mgcp_client_conf->local_addr =
talloc_strdup(global_mgcp_client_ctx, argv[0]);
return CMD_SUCCESS;
}
@ -53,9 +53,9 @@ DEFUN(cfg_mgcpgw_local_port, cfg_mgcpgw_local_port_cmd,
MGCPGW_STR "local bind to connect to MGCP gateway with\n"
"local bind port\n")
{
if (!global_mgcpgw_client_conf)
if (!global_mgcp_client_conf)
return CMD_ERR_NOTHING_TODO;
global_mgcpgw_client_conf->local_port = atoi(argv[0]);
global_mgcp_client_conf->local_port = atoi(argv[0]);
return CMD_SUCCESS;
}
@ -64,11 +64,11 @@ DEFUN(cfg_mgcpgw_remote_ip, cfg_mgcpgw_remote_ip_cmd,
MGCPGW_STR "remote bind to connect to MGCP gateway with\n"
"remote bind IP address\n")
{
if (!global_mgcpgw_client_conf)
if (!global_mgcp_client_conf)
return CMD_ERR_NOTHING_TODO;
OSMO_ASSERT(global_mgcpgw_client_ctx);
global_mgcpgw_client_conf->remote_addr =
talloc_strdup(global_mgcpgw_client_ctx, argv[0]);
OSMO_ASSERT(global_mgcp_client_ctx);
global_mgcp_client_conf->remote_addr =
talloc_strdup(global_mgcp_client_ctx, argv[0]);
return CMD_SUCCESS;
}
@ -77,9 +77,9 @@ DEFUN(cfg_mgcpgw_remote_port, cfg_mgcpgw_remote_port_cmd,
MGCPGW_STR "remote bind to connect to MGCP gateway with\n"
"remote bind port\n")
{
if (!global_mgcpgw_client_conf)
if (!global_mgcp_client_conf)
return CMD_ERR_NOTHING_TODO;
global_mgcpgw_client_conf->remote_port = atoi(argv[0]);
global_mgcp_client_conf->remote_port = atoi(argv[0]);
return CMD_SUCCESS;
}
@ -98,8 +98,8 @@ DEFUN(cfg_mgcpgw_endpoint_range, cfg_mgcpgw_endpoint_range_cmd,
return CMD_SUCCESS;
}
global_mgcpgw_client_conf->first_endpoint = first_endpoint;
global_mgcpgw_client_conf->last_endpoint = last_endpoint;
global_mgcp_client_conf->first_endpoint = first_endpoint;
global_mgcp_client_conf->last_endpoint = last_endpoint;
return CMD_SUCCESS;
}
@ -112,11 +112,11 @@ DEFUN(cfg_mgcp_rtp_bts_base_port,
BTS_START_STR
UDP_PORT_STR)
{
global_mgcpgw_client_conf->bts_base = atoi(argv[0]);
global_mgcp_client_conf->bts_base = atoi(argv[0]);
return CMD_SUCCESS;
}
int mgcpgw_client_config_write(struct vty *vty, const char *indent)
int mgcp_client_config_write(struct vty *vty, const char *indent)
{
const char *addr;
int port;
@ -124,32 +124,32 @@ int mgcpgw_client_config_write(struct vty *vty, const char *indent)
uint16_t last_endpoint;
uint16_t bts_base;
addr = global_mgcpgw_client_conf->local_addr;
addr = global_mgcp_client_conf->local_addr;
if (addr)
vty_out(vty, "%smgcpgw local-ip %s%s", indent, addr,
VTY_NEWLINE);
port = global_mgcpgw_client_conf->local_port;
port = global_mgcp_client_conf->local_port;
if (port >= 0)
vty_out(vty, "%smgcpgw local-port %u%s", indent,
(uint16_t)port, VTY_NEWLINE);
addr = global_mgcpgw_client_conf->remote_addr;
addr = global_mgcp_client_conf->remote_addr;
if (addr)
vty_out(vty, "%smgcpgw remote-ip %s%s", indent, addr,
VTY_NEWLINE);
port = global_mgcpgw_client_conf->remote_port;
port = global_mgcp_client_conf->remote_port;
if (port >= 0)
vty_out(vty, "%smgcpgw remote-port %u%s", indent,
(uint16_t)port, VTY_NEWLINE);
first_endpoint = global_mgcpgw_client_conf->first_endpoint;
last_endpoint = global_mgcpgw_client_conf->last_endpoint;
first_endpoint = global_mgcp_client_conf->first_endpoint;
last_endpoint = global_mgcp_client_conf->last_endpoint;
if (last_endpoint != 0) {
vty_out(vty, "%smgcpgw endpoint-range %u %u%s", indent,
first_endpoint, last_endpoint, VTY_NEWLINE);
}
bts_base = global_mgcpgw_client_conf->bts_base;
bts_base = global_mgcp_client_conf->bts_base;
if (bts_base) {
vty_out(vty, "%smgcpgw bts-base %u%s", indent,
bts_base, VTY_NEWLINE);
@ -158,10 +158,10 @@ int mgcpgw_client_config_write(struct vty *vty, const char *indent)
return CMD_SUCCESS;
}
void mgcpgw_client_vty_init(void *talloc_ctx, int node, struct mgcpgw_client_conf *conf)
void mgcp_client_vty_init(void *talloc_ctx, int node, struct mgcp_client_conf *conf)
{
global_mgcpgw_client_ctx = talloc_ctx;
global_mgcpgw_client_conf = conf;
global_mgcp_client_ctx = talloc_ctx;
global_mgcp_client_conf = conf;
install_element(node, &cfg_mgcpgw_local_ip_cmd);
install_element(node, &cfg_mgcpgw_local_port_cmd);

View File

@ -17,19 +17,19 @@ AM_LDFLAGS = \
$(NULL)
EXTRA_DIST = \
mgcpgw_client_test.ok \
mgcpgw_client_test.err \
mgcp_client_test.ok \
mgcp_client_test.err \
$(NULL)
noinst_PROGRAMS = \
mgcpgw_client_test \
mgcp_client_test \
$(NULL)
mgcpgw_client_test_SOURCES = \
mgcpgw_client_test.c \
mgcp_client_test_SOURCES = \
mgcp_client_test.c \
$(NULL)
mgcpgw_client_test_LDADD = \
mgcp_client_test_LDADD = \
$(top_builddir)/src/libosmo-mgcp-client/libosmo-mgcp-client.la \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOVTY_LIBS) \

View File

@ -23,8 +23,8 @@
#include <osmocom/core/msgb.h>
#include <osmocom/core/application.h>
#include <osmocom/legacy_mgcp/mgcp.h>
#include <osmocom/mgcp_client/mgcpgw_client.h>
#include <osmocom/mgcp_client/mgcpgw_client_internal.h>
#include <osmocom/mgcp_client/mgcp_client.h>
#include <osmocom/mgcp_client/mgcp_client_internal.h>
void *ctx;
@ -71,8 +71,8 @@ static struct msgb *from_str(const char *str)
return msg;
}
static struct mgcpgw_client_conf conf;
struct mgcpgw_client *mgcp = NULL;
static struct mgcp_client_conf conf;
struct mgcp_client *mgcp = NULL;
static void reply_to(mgcp_trans_id_t trans_id, int code, const char *comment,
int conn_id, const char *params)
@ -88,7 +88,7 @@ static void reply_to(mgcp_trans_id_t trans_id, int code, const char *comment,
printf("composed response:\n-----\n%s\n-----\n",
compose);
mgcpgw_client_rx(mgcp, from_str(compose));
mgcp_client_rx(mgcp, from_str(compose));
}
void test_response_cb(struct mgcp_response *response, void *priv)
@ -114,7 +114,7 @@ mgcp_trans_id_t dummy_mgcp_send(struct msgb *msg)
trans_id = msg->cb[MSGB_CB_MGCP_TRANS_ID];
char *end;
OSMO_ASSERT(mgcpgw_client_pending_add(mgcp, trans_id, test_response_cb, mgcp));
OSMO_ASSERT(mgcp_client_pending_add(mgcp, trans_id, test_response_cb, mgcp));
end = (char*)msgb_put(msg, 1);
*end = '\0';
@ -134,7 +134,7 @@ void test_crcx(void)
if (mgcp)
talloc_free(mgcp);
mgcp = mgcpgw_client_init(ctx, &conf);
mgcp = mgcp_client_init(ctx, &conf);
msg = mgcp_msg_crcx(mgcp, 23, 42, MGCP_CONN_LOOPBACK);
trans_id = dummy_mgcp_send(msg);
@ -161,11 +161,11 @@ const struct log_info log_info = {
int main(int argc, char **argv)
{
ctx = talloc_named_const(NULL, 1, "mgcpgw_client_test");
ctx = talloc_named_const(NULL, 1, "mgcp_client_test");
msgb_talloc_ctx_init(ctx, 0);
osmo_init_logging(&log_info);
mgcpgw_client_conf_init(&conf);
mgcp_client_conf_init(&conf);
test_crcx();

View File

@ -14,9 +14,9 @@ cat $abs_srcdir/legacy_mgcp/mgcp_transcoding_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/legacy_mgcp/mgcp_transcoding_test], [], [expout], [ignore])
AT_CLEANUP
AT_SETUP([mgcpgw_client])
AT_KEYWORDS([mgcpgw_client])
cat $abs_srcdir/mgcp_client/mgcpgw_client_test.ok > expout
cat $abs_srcdir/mgcp_client/mgcpgw_client_test.err > experr
AT_CHECK([$abs_top_builddir/tests/mgcp_client/mgcpgw_client_test], [], [expout], [experr])
AT_SETUP([mgcp_client])
AT_KEYWORDS([mgcp_client])
cat $abs_srcdir/mgcp_client/mgcp_client_test.ok > expout
cat $abs_srcdir/mgcp_client/mgcp_client_test.err > experr
AT_CHECK([$abs_top_builddir/tests/mgcp_client/mgcp_client_test], [], [expout], [experr])
AT_CLEANUP