From 03ad002c28073b347b92bcde16d5af80a06389e4 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Wed, 6 Jul 2016 15:51:36 +0200 Subject: cosmetic: rename osmo_sua_link and osmo_sua_user to osmo_sccp_* hwelte requested this change for the addition of libiu in openbsc. In a conversation we came to the conclusion that a rename of these two opaque structs would suffice. This is the "upstream" rename and will require adaptation of: * the sysmocom/iu branch in this repository * the iu related branches in openbsc.git * the hnbgw and dummy_cn code in osmo-iuh.git See https://gerrit.osmocom.org/#/c/192/2/openbsc/src/libiu/iu.c@57 Change-Id: Icbf64dd96f8e0e27695df73d1144519b88360b94 --- include/osmocom/sigtran/sua.h | 16 ++++---- src/sua.c | 82 ++++++++++++++++++++--------------------- tests/sigtran/sua_client_test.c | 4 +- tests/sigtran/sua_server_test.c | 2 +- tests/sigtran/sua_test_common.c | 4 +- tests/sigtran/sua_test_common.h | 4 +- 6 files changed, 56 insertions(+), 56 deletions(-) diff --git a/include/osmocom/sigtran/sua.h b/include/osmocom/sigtran/sua.h index 2aa99f4..935a4c0 100644 --- a/include/osmocom/sigtran/sua.h +++ b/include/osmocom/sigtran/sua.h @@ -3,19 +3,19 @@ #include #include -struct osmo_sua_user; -struct osmo_sua_link; +struct osmo_sccp_user; +struct osmo_sccp_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); +struct osmo_sccp_user *osmo_sua_user_create(void *ctx, osmo_prim_cb prim_cb); +void osmo_sua_user_destroy(struct osmo_sccp_user *user); -int osmo_sua_server_listen(struct osmo_sua_user *user, const char *hostname, uint16_t port); +int osmo_sua_server_listen(struct osmo_sccp_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_sua_link *osmo_sua_client_get_link(struct osmo_sua_user *user); +int osmo_sua_client_connect(struct osmo_sccp_user *user, const char *hostname, uint16_t port); +struct osmo_sccp_link *osmo_sua_client_get_link(struct osmo_sccp_user *user); /* user hands us a SCCP-USER SAP primitive down into the stack */ -int osmo_sua_user_link_down(struct osmo_sua_link *link, struct osmo_prim_hdr *oph); +int osmo_sua_user_link_down(struct osmo_sccp_link *link, struct osmo_prim_hdr *oph); diff --git a/src/sua.c b/src/sua.c index 5575d58..898a257 100644 --- a/src/sua.c +++ b/src/sua.c @@ -50,7 +50,7 @@ static int DSUA = -1; -struct osmo_sua_user { +struct osmo_sccp_user { /* global list of SUA users? */ struct llist_head list; /* set if we are a server */ @@ -61,11 +61,11 @@ struct osmo_sua_user { osmo_prim_cb prim_cb; }; -struct osmo_sua_link { +struct osmo_sccp_link { /* list of SUA links per sua_user */ struct llist_head list; /* sua user to which we belong */ - struct osmo_sua_user *user; + struct osmo_sccp_user *user; /* local list of (SCCP) connections in this link */ struct llist_head connections; /* next connection local reference */ @@ -101,7 +101,7 @@ static const struct value_string conn_state_names[] = { struct sua_connection { struct llist_head list; - struct osmo_sua_link *link; + struct osmo_sccp_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 osmo_sua_link *sua_link_new(struct osmo_sua_user *user, int is_server) +static struct osmo_sccp_link *sua_link_new(struct osmo_sccp_user *user, int is_server) { - struct osmo_sua_link *link; + struct osmo_sccp_link *link; - link = talloc_zero(user, struct osmo_sua_link); + link = talloc_zero(user, struct osmo_sccp_link); if (!link) return NULL; @@ -223,7 +223,7 @@ static struct osmo_sua_link *sua_link_new(struct osmo_sua_user *user, int is_ser static void conn_destroy(struct sua_connection *conn); -static void sua_link_destroy(struct osmo_sua_link *link) +static void sua_link_destroy(struct osmo_sccp_link *link) { struct sua_connection *conn; @@ -237,7 +237,7 @@ static void sua_link_destroy(struct osmo_sua_link *link) talloc_free(link); } -static int sua_link_send(struct osmo_sua_link *link, struct msgb *msg) +static int sua_link_send(struct osmo_sccp_link *link, struct msgb *msg) { msgb_sctp_ppid(msg) = SUA_PPID; @@ -249,7 +249,7 @@ static int sua_link_send(struct osmo_sua_link *link, struct msgb *msg) return 0; } -static struct sua_connection *conn_find_by_id(struct osmo_sua_link *link, uint32_t id) +static struct sua_connection *conn_find_by_id(struct osmo_sccp_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 osmo_sua_link *link, uint32_t conn_id) +static struct sua_connection *conn_create_id(struct osmo_sccp_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 osmo_sua_link *link, uint32_ return conn; } -static struct sua_connection *conn_create(struct osmo_sua_link *link) +static struct sua_connection *conn_create(struct osmo_sccp_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 osmo_sua_link *link, struct osmo_scu_prim *prim) +static int sua_connect_req(struct osmo_sccp_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 osmo_sua_link *link, struct osmo_scu_prim *pri /* user program sends us a N-CONNNECT.resp, presumably against a * N-CONNECT.ind */ -static int sua_connect_resp(struct osmo_sua_link *link, struct osmo_scu_prim *prim) +static int sua_connect_resp(struct osmo_sccp_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 osmo_sua_link *link, struct osmo_scu_prim *pr } /* user wants to send connection-oriented data */ -static int sua_data_req(struct osmo_sua_link *link, struct osmo_scu_prim *prim) +static int sua_data_req(struct osmo_sccp_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 osmo_sua_link *link, struct osmo_scu_prim *prim) } /* user wants to disconnect a connection */ -static int sua_disconnect_req(struct osmo_sua_link *link, struct osmo_scu_prim *prim) +static int sua_disconnect_req(struct osmo_sccp_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 osmo_sua_link *link, struct osmo_scu_prim * } /* user wants to send connectionless data */ -static int sua_unitdata_req(struct osmo_sua_link *link, struct osmo_scu_prim *prim) +static int sua_unitdata_req(struct osmo_sccp_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 osmo_sua_link *link, struct osmo_scu_prim *pr } /* user hands us a SCCP-USER SAP primitive down into the stack */ -int osmo_sua_user_link_down(struct osmo_sua_link *link, struct osmo_prim_hdr *oph) +int osmo_sua_user_link_down(struct osmo_sccp_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 osmo_sua_link *link, struct xua_msg *xua) +static int sua_rx_cldt(struct osmo_sccp_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 osmo_sua_link *link, struct xua_msg *xua) /* connectioness messages received from socket */ -static int sua_rx_cl(struct osmo_sua_link *link, +static int sua_rx_cl(struct osmo_sccp_link *link, struct xua_msg *xua, struct msgb *msg) { int rc = -1; @@ -786,7 +786,7 @@ static int sua_rx_cl(struct osmo_sua_link *link, } /* RFC 3868 3.3.3 / SCCP CR */ -static int sua_rx_core(struct osmo_sua_link *link, struct xua_msg *xua) +static int sua_rx_core(struct osmo_sccp_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 osmo_sua_link *link, struct xua_msg *xua) } /* RFC 3868 3.3.4 / SCCP CC */ -static int sua_rx_coak(struct osmo_sua_link *link, struct xua_msg *xua) +static int sua_rx_coak(struct osmo_sccp_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 osmo_sua_link *link, struct xua_msg *xua) } /* RFC 3868 3.3.5 / SCCP CREF */ -static int sua_rx_coref(struct osmo_sua_link *link, struct xua_msg *xua) +static int sua_rx_coref(struct osmo_sccp_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 osmo_sua_link *link, struct xua_msg *xua) } /* RFC 3868 3.3.6 / SCCP RLSD */ -static int sua_rx_relre(struct osmo_sua_link *link, struct xua_msg *xua) +static int sua_rx_relre(struct osmo_sccp_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 osmo_sua_link *link, struct xua_msg *xua) } /* RFC 3868 3.3.7 / SCCP RLC */ -static int sua_rx_relco(struct osmo_sua_link *link, struct xua_msg *xua) +static int sua_rx_relco(struct osmo_sccp_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 osmo_sua_link *link, struct xua_msg *xua) } /* RFC3868 3.3.1 / SCCP DT1 */ -static int sua_rx_codt(struct osmo_sua_link *link, struct xua_msg *xua) +static int sua_rx_codt(struct osmo_sccp_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 osmo_sua_link *link, struct xua_msg *xua) /* connection-oriented messages received from socket */ -static int sua_rx_co(struct osmo_sua_link *link, +static int sua_rx_co(struct osmo_sccp_link *link, struct xua_msg *xua, struct msgb *msg) { int rc = -1; @@ -1134,7 +1134,7 @@ static int sua_rx_co(struct osmo_sua_link *link, } /* process SUA message received from socket */ -static int sua_rx_msg(struct osmo_sua_link *link, struct msgb *msg) +static int sua_rx_msg(struct osmo_sccp_link *link, struct msgb *msg) { struct xua_msg *xua; int rc = -1; @@ -1182,7 +1182,7 @@ static int sua_rx_msg(struct osmo_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 osmo_sua_link *link = osmo_stream_srv_get_data(conn); + struct osmo_sccp_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 osmo_sua_link *sual = osmo_stream_srv_get_data(srv); + struct osmo_sccp_link *sual = osmo_stream_srv_get_data(srv); struct sua_connection *conn; LOGP(DSUA, LOGL_INFO, "SCTP connection closed\n"); @@ -1254,9 +1254,9 @@ static int sua_srv_conn_closed_cb(struct osmo_stream_srv *srv) 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_sccp_user *user = osmo_stream_srv_link_get_data(link); struct osmo_stream_srv *srv; - struct osmo_sua_link *sual; + struct osmo_sccp_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 osmo_sua_server_listen(struct osmo_sua_user *user, const char *hostname, uint16_t port) +int osmo_sua_server_listen(struct osmo_sccp_user *user, const char *hostname, uint16_t port) { int rc; @@ -1308,7 +1308,7 @@ int osmo_sua_server_listen(struct osmo_sua_user *user, const char *hostname, uin static int sua_cli_conn_cb(struct osmo_stream_cli *conn) { struct osmo_fd *ofd = osmo_stream_cli_get_ofd(conn); - struct osmo_sua_link *link = osmo_stream_cli_get_data(conn); + struct osmo_sccp_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 osmo_sua_client_connect(struct osmo_sua_user *user, const char *hostname, uint16_t port) +int osmo_sua_client_connect(struct osmo_sccp_user *user, const char *hostname, uint16_t port) { struct osmo_stream_cli *cli; - struct osmo_sua_link *sual; + struct osmo_sccp_link *sual; int rc; cli = osmo_stream_cli_create(user); @@ -1394,16 +1394,16 @@ int osmo_sua_client_connect(struct osmo_sua_user *user, const char *hostname, ui return 0; } -struct osmo_sua_link *osmo_sua_client_get_link(struct osmo_sua_user *user) +struct osmo_sccp_link *osmo_sua_client_get_link(struct osmo_sccp_user *user) { return osmo_stream_cli_get_data(user->client); } static LLIST_HEAD(sua_users); -struct osmo_sua_user *osmo_sua_user_create(void *ctx, osmo_prim_cb prim_cb) +struct osmo_sccp_user *osmo_sua_user_create(void *ctx, osmo_prim_cb prim_cb) { - struct osmo_sua_user *user = talloc_zero(ctx, struct osmo_sua_user); + struct osmo_sccp_user *user = talloc_zero(ctx, struct osmo_sccp_user); user->prim_cb = prim_cb; INIT_LLIST_HEAD(&user->links); @@ -1413,9 +1413,9 @@ struct osmo_sua_user *osmo_sua_user_create(void *ctx, osmo_prim_cb prim_cb) return user; } -void osmo_sua_user_destroy(struct osmo_sua_user *user) +void osmo_sua_user_destroy(struct osmo_sccp_user *user) { - struct osmo_sua_link *link; + struct osmo_sccp_link *link; llist_del(&user->list); diff --git a/tests/sigtran/sua_client_test.c b/tests/sigtran/sua_client_test.c index 3a5391f..5ea7714 100644 --- a/tests/sigtran/sua_client_test.c +++ b/tests/sigtran/sua_client_test.c @@ -1,7 +1,7 @@ #include "sua_test_common.h" -struct osmo_sua_user *g_user; -struct osmo_sua_link *g_link; +struct osmo_sccp_user *g_user; +struct osmo_sccp_link *g_link; static int sccp_sap_up(struct osmo_prim_hdr *oph, void *link) { diff --git a/tests/sigtran/sua_server_test.c b/tests/sigtran/sua_server_test.c index 1fccf01..0e8d9ca 100644 --- a/tests/sigtran/sua_server_test.c +++ b/tests/sigtran/sua_server_test.c @@ -57,7 +57,7 @@ static int sccp_sap_up(struct osmo_prim_hdr *oph, void *link) int main(int argc, char **argv) { - struct osmo_sua_user *user; + struct osmo_sccp_user *user; void *ctx = talloc_named_const(NULL, 1, "root"); int rc; diff --git a/tests/sigtran/sua_test_common.c b/tests/sigtran/sua_test_common.c index 66fade0..db1f5f3 100644 --- a/tests/sigtran/sua_test_common.c +++ b/tests/sigtran/sua_test_common.c @@ -18,7 +18,7 @@ const struct log_info test_log_info = { .num_cat = ARRAY_SIZE(log_cat), }; -int tx_unitdata(struct osmo_sua_link *link) +int tx_unitdata(struct osmo_sccp_link *link) { struct msgb *msg = msgb_alloc(1024, "tx_unitdata"); struct osmo_scu_prim *prim; @@ -62,7 +62,7 @@ struct osmo_prim_hdr *make_conn_req(uint32_t conn_id) return &prim->oph; } -int tx_conn_req(struct osmo_sua_link *link, uint32_t conn_id) +int tx_conn_req(struct osmo_sccp_link *link, uint32_t conn_id) { struct osmo_prim_hdr *prim = make_conn_req(conn_id); return osmo_sua_user_link_down(link, prim); diff --git a/tests/sigtran/sua_test_common.h b/tests/sigtran/sua_test_common.h index 34524db..b1883cd 100644 --- a/tests/sigtran/sua_test_common.h +++ b/tests/sigtran/sua_test_common.h @@ -25,8 +25,8 @@ enum log_cat { extern const struct log_info test_log_info; -int tx_unitdata(struct osmo_sua_link *link); -int tx_conn_req(struct osmo_sua_link *link, uint32_t conn_id); +int tx_unitdata(struct osmo_sccp_link *link); +int tx_conn_req(struct osmo_sccp_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); -- cgit v1.2.3