SUA: Ensure osmo_ prefix is used on all global symbols

This commit is contained in:
Harald Welte 2015-12-21 23:51:08 +01:00
parent 70e84ab5f9
commit 8960704d1c
6 changed files with 51 additions and 50 deletions

View File

@ -61,7 +61,7 @@ struct osmo_sua_user {
osmo_prim_cb prim_cb;
};
struct sua_link {
struct osmo_sua_link {
/* list of SUA links per sua_user */
struct llist_head list;
/* sua user to which we belong */
@ -101,7 +101,7 @@ static const struct value_string conn_state_names[] = {
struct sua_connection {
struct llist_head list;
struct sua_link *link;
struct osmo_sua_link *link;
struct osmo_sccp_addr calling_addr;
struct osmo_sccp_addr called_addr;
uint32_t conn_id;
@ -204,11 +204,11 @@ static int xua_msg_add_sccp_addr(struct xua_msg *xua, uint16_t iei, const struct
* SUA Link and Connection handling
***********************************************************************/
static struct sua_link *sua_link_new(struct osmo_sua_user *user, int is_server)
static struct osmo_sua_link *sua_link_new(struct osmo_sua_user *user, int is_server)
{
struct sua_link *link;
struct osmo_sua_link *link;
link = talloc_zero(user, struct sua_link);
link = talloc_zero(user, struct osmo_sua_link);
if (!link)
return NULL;
@ -223,7 +223,7 @@ static struct sua_link *sua_link_new(struct osmo_sua_user *user, int is_server)
static void conn_destroy(struct sua_connection *conn);
static void sua_link_destroy(struct sua_link *link)
static void sua_link_destroy(struct osmo_sua_link *link)
{
struct sua_connection *conn;
@ -237,7 +237,7 @@ static void sua_link_destroy(struct sua_link *link)
talloc_free(link);
}
static int sua_link_send(struct sua_link *link, struct msgb *msg)
static int sua_link_send(struct osmo_sua_link *link, struct msgb *msg)
{
msgb_sctp_ppid(msg) = SUA_PPID;
@ -249,7 +249,7 @@ static int sua_link_send(struct sua_link *link, struct msgb *msg)
return 0;
}
static struct sua_connection *conn_find_by_id(struct sua_link *link, uint32_t id)
static struct sua_connection *conn_find_by_id(struct osmo_sua_link *link, uint32_t id)
{
struct sua_connection *conn;
@ -291,7 +291,7 @@ static void rx_inact_tmr_cb(void *data)
}
static struct sua_connection *conn_create_id(struct sua_link *link, uint32_t conn_id)
static struct sua_connection *conn_create_id(struct osmo_sua_link *link, uint32_t conn_id)
{
struct sua_connection *conn = talloc_zero(link, struct sua_connection);
@ -309,7 +309,7 @@ static struct sua_connection *conn_create_id(struct sua_link *link, uint32_t con
return conn;
}
static struct sua_connection *conn_create(struct sua_link *link)
static struct sua_connection *conn_create(struct osmo_sua_link *link)
{
uint32_t conn_id;
@ -369,7 +369,7 @@ static struct msgb *sua_msgb_alloc(void)
***********************************************************************/
/* user program sends us a N-CONNNECT.req to initiate a new connection */
static int sua_connect_req(struct sua_link *link, struct osmo_scu_prim *prim)
static int sua_connect_req(struct osmo_sua_link *link, struct osmo_scu_prim *prim)
{
struct osmo_scu_connect_param *par = &prim->u.connect;
struct xua_msg *xua = xua_msg_alloc();
@ -420,7 +420,7 @@ static int sua_connect_req(struct sua_link *link, struct osmo_scu_prim *prim)
/* user program sends us a N-CONNNECT.resp, presumably against a
* N-CONNECT.ind */
static int sua_connect_resp(struct sua_link *link, struct osmo_scu_prim *prim)
static int sua_connect_resp(struct osmo_sua_link *link, struct osmo_scu_prim *prim)
{
struct osmo_scu_connect_param *par = &prim->u.connect;
struct xua_msg *xua = xua_msg_alloc();
@ -473,7 +473,7 @@ static int sua_connect_resp(struct sua_link *link, struct osmo_scu_prim *prim)
}
/* user wants to send connection-oriented data */
static int sua_data_req(struct sua_link *link, struct osmo_scu_prim *prim)
static int sua_data_req(struct osmo_sua_link *link, struct osmo_scu_prim *prim)
{
struct osmo_scu_data_param *par = &prim->u.data;
struct xua_msg *xua;
@ -515,7 +515,7 @@ static int sua_data_req(struct sua_link *link, struct osmo_scu_prim *prim)
}
/* user wants to disconnect a connection */
static int sua_disconnect_req(struct sua_link *link, struct osmo_scu_prim *prim)
static int sua_disconnect_req(struct osmo_sua_link *link, struct osmo_scu_prim *prim)
{
struct osmo_scu_disconn_param *par = &prim->u.disconnect;
struct xua_msg *xua;
@ -552,7 +552,7 @@ static int sua_disconnect_req(struct sua_link *link, struct osmo_scu_prim *prim)
}
/* user wants to send connectionless data */
static int sua_unitdata_req(struct sua_link *link, struct osmo_scu_prim *prim)
static int sua_unitdata_req(struct osmo_sua_link *link, struct osmo_scu_prim *prim)
{
struct osmo_scu_unitdata_param *par = &prim->u.unitdata;
struct xua_msg *xua = xua_msg_alloc();
@ -576,7 +576,7 @@ static int sua_unitdata_req(struct sua_link *link, struct osmo_scu_prim *prim)
}
/* user hands us a SCCP-USER SAP primitive down into the stack */
int osmo_osmo_sua_user_link_down(struct sua_link *link, struct osmo_prim_hdr *oph)
int osmo_sua_user_link_down(struct osmo_sua_link *link, struct osmo_prim_hdr *oph)
{
struct osmo_scu_prim *prim = (struct osmo_scu_prim *) oph;
struct msgb *msg = prim->oph.msg;
@ -732,7 +732,7 @@ static int sua_parse_addr(struct osmo_sccp_addr *out,
return 0;
}
static int sua_rx_cldt(struct sua_link *link, struct xua_msg *xua)
static int sua_rx_cldt(struct osmo_sua_link *link, struct xua_msg *xua)
{
struct osmo_scu_prim *prim;
struct osmo_scu_unitdata_param *param;
@ -765,7 +765,7 @@ static int sua_rx_cldt(struct sua_link *link, struct xua_msg *xua)
/* connectioness messages received from socket */
static int sua_rx_cl(struct sua_link *link,
static int sua_rx_cl(struct osmo_sua_link *link,
struct xua_msg *xua, struct msgb *msg)
{
int rc = -1;
@ -786,7 +786,7 @@ static int sua_rx_cl(struct sua_link *link,
}
/* RFC 3868 3.3.3 / SCCP CR */
static int sua_rx_core(struct sua_link *link, struct xua_msg *xua)
static int sua_rx_core(struct osmo_sua_link *link, struct xua_msg *xua)
{
struct osmo_scu_prim *prim;
struct osmo_scu_connect_param *param;
@ -832,7 +832,7 @@ static int sua_rx_core(struct sua_link *link, struct xua_msg *xua)
}
/* RFC 3868 3.3.4 / SCCP CC */
static int sua_rx_coak(struct sua_link *link, struct xua_msg *xua)
static int sua_rx_coak(struct osmo_sua_link *link, struct xua_msg *xua)
{
struct osmo_scu_prim *prim;
struct sua_connection *conn;
@ -893,7 +893,7 @@ static int sua_rx_coak(struct sua_link *link, struct xua_msg *xua)
}
/* RFC 3868 3.3.5 / SCCP CREF */
static int sua_rx_coref(struct sua_link *link, struct xua_msg *xua)
static int sua_rx_coref(struct osmo_sua_link *link, struct xua_msg *xua)
{
struct osmo_scu_prim *prim;
struct sua_connection *conn;
@ -946,7 +946,7 @@ static int sua_rx_coref(struct sua_link *link, struct xua_msg *xua)
}
/* RFC 3868 3.3.6 / SCCP RLSD */
static int sua_rx_relre(struct sua_link *link, struct xua_msg *xua)
static int sua_rx_relre(struct osmo_sua_link *link, struct xua_msg *xua)
{
struct osmo_scu_prim *prim;
struct sua_connection *conn;
@ -998,7 +998,7 @@ static int sua_rx_relre(struct sua_link *link, struct xua_msg *xua)
}
/* RFC 3868 3.3.7 / SCCP RLC */
static int sua_rx_relco(struct sua_link *link, struct xua_msg *xua)
static int sua_rx_relco(struct osmo_sua_link *link, struct xua_msg *xua)
{
struct osmo_scu_prim *prim;
struct sua_connection *conn;
@ -1043,7 +1043,7 @@ static int sua_rx_relco(struct sua_link *link, struct xua_msg *xua)
}
/* RFC3868 3.3.1 / SCCP DT1 */
static int sua_rx_codt(struct sua_link *link, struct xua_msg *xua)
static int sua_rx_codt(struct osmo_sua_link *link, struct xua_msg *xua)
{
struct osmo_scu_prim *prim;
struct sua_connection *conn;
@ -1093,7 +1093,7 @@ static int sua_rx_codt(struct sua_link *link, struct xua_msg *xua)
/* connection-oriented messages received from socket */
static int sua_rx_co(struct sua_link *link,
static int sua_rx_co(struct osmo_sua_link *link,
struct xua_msg *xua, struct msgb *msg)
{
int rc = -1;
@ -1134,7 +1134,7 @@ static int sua_rx_co(struct sua_link *link,
}
/* process SUA message received from socket */
static int sua_rx_msg(struct sua_link *link, struct msgb *msg)
static int sua_rx_msg(struct osmo_sua_link *link, struct msgb *msg)
{
struct xua_msg *xua;
int rc = -1;
@ -1182,7 +1182,7 @@ static int sua_rx_msg(struct sua_link *link, struct msgb *msg)
static int sua_srv_conn_cb(struct osmo_stream_srv *conn)
{
struct osmo_fd *ofd = osmo_stream_srv_get_ofd(conn);
struct sua_link *link = osmo_stream_srv_get_data(conn);
struct osmo_sua_link *link = osmo_stream_srv_get_data(conn);
struct msgb *msg = msgb_alloc(SUA_MSGB_SIZE, "SUA Server Rx");
struct sctp_sndrcvinfo sinfo;
unsigned int ppid;
@ -1235,7 +1235,7 @@ static int sua_srv_conn_cb(struct osmo_stream_srv *conn)
static int sua_srv_conn_closed_cb(struct osmo_stream_srv *srv)
{
struct sua_link *sual = osmo_stream_srv_get_data(srv);
struct osmo_sua_link *sual = osmo_stream_srv_get_data(srv);
struct sua_connection *conn;
LOGP(DSUA, LOGL_INFO, "SCTP connection closed\n");
@ -1256,7 +1256,7 @@ static int sua_accept_cb(struct osmo_stream_srv_link *link, int fd)
{
struct osmo_sua_user *user = osmo_stream_srv_link_get_data(link);
struct osmo_stream_srv *srv;
struct sua_link *sual;
struct osmo_sua_link *sual;
LOGP(DSUA, LOGL_INFO, "New SCTP connection accepted\n");
@ -1278,7 +1278,7 @@ static int sua_accept_cb(struct osmo_stream_srv_link *link, int fd)
return 0;
}
int sua_server_listen(struct osmo_sua_user *user, const char *hostname, uint16_t port)
int osmo_sua_server_listen(struct osmo_sua_user *user, const char *hostname, uint16_t port)
{
int rc;
@ -1308,7 +1308,7 @@ int sua_server_listen(struct osmo_sua_user *user, const char *hostname, uint16_t
static int sua_cli_conn_cb(struct osmo_stream_cli *conn)
{
struct osmo_fd *ofd = osmo_stream_cli_get_ofd(conn);
struct sua_link *link = osmo_stream_cli_get_data(conn);
struct osmo_sua_link *link = osmo_stream_cli_get_data(conn);
struct msgb *msg = msgb_alloc(SUA_MSGB_SIZE, "SUA Client Rx");
struct sctp_sndrcvinfo sinfo;
unsigned int ppid;
@ -1359,10 +1359,10 @@ static int sua_cli_conn_cb(struct osmo_stream_cli *conn)
return rc;
}
int sua_client_connect(struct osmo_sua_user *user, const char *hostname, uint16_t port)
int osmo_sua_client_connect(struct osmo_sua_user *user, const char *hostname, uint16_t port)
{
struct osmo_stream_cli *cli;
struct sua_link *sual;
struct osmo_sua_link *sual;
int rc;
cli = osmo_stream_cli_create(user);
@ -1394,7 +1394,7 @@ int sua_client_connect(struct osmo_sua_user *user, const char *hostname, uint16_
return 0;
}
struct sua_link *sua_client_get_link(struct osmo_sua_user *user)
struct osmo_sua_link *osmo_sua_client_get_link(struct osmo_sua_user *user)
{
return osmo_stream_cli_get_data(user->client);
}
@ -1415,7 +1415,7 @@ struct osmo_sua_user *osmo_sua_user_create(void *ctx, osmo_prim_cb prim_cb)
void osmo_sua_user_destroy(struct osmo_sua_user *user)
{
struct sua_link *link;
struct osmo_sua_link *link;
llist_del(&user->list);

View File

@ -4,17 +4,18 @@
#include <osmocom/core/prim.h>
struct osmo_sua_user;
struct osmo_sua_link;
void osmo_sua_set_log_area(int area);
struct osmo_sua_user *osmo_sua_user_create(void *ctx, osmo_prim_cb prim_cb);
void osmo_sua_user_destroy(struct osmo_sua_user *user);
int sua_server_listen(struct osmo_sua_user *user, const char *hostname, uint16_t port);
int osmo_sua_server_listen(struct osmo_sua_user *user, const char *hostname, uint16_t port);
int sua_client_connect(struct osmo_sua_user *user, const char *hostname, uint16_t port);
struct sua_link *sua_client_get_link(struct osmo_sua_user *user);
int osmo_sua_client_connect(struct osmo_sua_user *user, const char *hostname, uint16_t port);
struct osmo_sua_link *osmo_sua_client_get_link(struct osmo_sua_user *user);
/* user hands us a SCCP-USER SAP primitive down into the stack */
int osmo_osmo_sua_user_link_down(struct sua_link *link, struct osmo_prim_hdr *oph);
int osmo_sua_user_link_down(struct osmo_sua_link *link, struct osmo_prim_hdr *oph);

View File

@ -20,7 +20,7 @@ static int sccp_sap_up(struct osmo_prim_hdr *oph, void *link)
}
if (resp)
osmo_osmo_sua_user_link_down(link, resp);
osmo_sua_user_link_down(link, resp);
msgb_free(oph->msg);
return 0;
@ -39,12 +39,12 @@ int main(int argc, char **argv)
g_user = osmo_sua_user_create(ctx, sccp_sap_up);
rc = sua_client_connect(g_user, "127.0.0.1", 2342);
rc = osmo_sua_client_connect(g_user, "127.0.0.1", 2342);
if (rc < 0) {
exit(1);
}
g_link = sua_client_get_link(g_user);
g_link = osmo_sua_client_get_link(g_user);
int i = 8000;

View File

@ -49,7 +49,7 @@ static int sccp_sap_up(struct osmo_prim_hdr *oph, void *link)
}
if (resp)
osmo_osmo_sua_user_link_down(link, resp);
osmo_sua_user_link_down(link, resp);
msgb_free(oph->msg);
return 0;
@ -68,7 +68,7 @@ int main(int argc, char **argv)
user = osmo_sua_user_create(ctx, sccp_sap_up);
rc = sua_server_listen(user, "127.0.0.1", 2342);
rc = osmo_sua_server_listen(user, "127.0.0.1", 2342);
if (rc < 0) {
exit(1);
}

View File

@ -24,7 +24,7 @@ const struct log_info test_log_info = {
.num_cat = ARRAY_SIZE(log_cat),
};
int tx_unitdata(struct sua_link *link)
int tx_unitdata(struct osmo_sua_link *link)
{
struct msgb *msg = msgb_alloc(1024, "tx_unitdata");
struct osmo_scu_prim *prim;
@ -40,7 +40,7 @@ int tx_unitdata(struct sua_link *link)
cur = msg->l2h = msgb_put(msg, 3);
cur[0] = 1; cur[1] = 2; cur[2] = 3;
return osmo_osmo_sua_user_link_down(link, &prim->oph);
return osmo_sua_user_link_down(link, &prim->oph);
}
static void sccp_make_addr_pc_ssn(struct osmo_sccp_addr *addr, uint32_t pc, uint32_t ssn)
@ -70,10 +70,10 @@ struct osmo_prim_hdr *make_conn_req(uint32_t conn_id)
return &prim->oph;
}
int tx_conn_req(struct sua_link *link, uint32_t conn_id)
int tx_conn_req(struct osmo_sua_link *link, uint32_t conn_id)
{
struct osmo_prim_hdr *prim = make_conn_req(conn_id);
return osmo_osmo_sua_user_link_down(link, prim);
return osmo_sua_user_link_down(link, prim);
}
struct osmo_prim_hdr *

View File

@ -24,8 +24,8 @@ enum log_cat {
extern const struct log_info test_log_info;
int tx_unitdata(struct sua_link *link);
int tx_conn_req(struct sua_link *link, uint32_t conn_id);
int tx_unitdata(struct osmo_sua_link *link);
int tx_conn_req(struct osmo_sua_link *link, uint32_t conn_id);
struct osmo_prim_hdr *make_conn_req(uint32_t conn_id);
struct osmo_prim_hdr *make_dt1_req(uint32_t conn_id, const uint8_t *data, unsigned int len);