aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2013-03-11 18:26:19 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2013-03-18 19:03:55 +0100
commit2031c9510cfdc6cdece77ed7e6d902449369e8eb (patch)
treeb397602dda5f2542b283a1e005b1e584813e262e
parentd93c84f96e7b7e652ac5a937c1f27df0913fca18 (diff)
sctp: Rename sctp_m2ua_transport to mtp_transport as it will be shared
This structure can be shared with the upcoming SCCP-lite handling.
-rw-r--r--include/bsc_data.h6
-rw-r--r--include/mtp_data.h11
-rw-r--r--include/sctp_m2ua.h20
-rw-r--r--src/main.c2
-rw-r--r--src/sctp_m2ua.c18
5 files changed, 29 insertions, 28 deletions
diff --git a/include/bsc_data.h b/include/bsc_data.h
index b1e0fbe..9c1145f 100644
--- a/include/bsc_data.h
+++ b/include/bsc_data.h
@@ -36,7 +36,6 @@
struct bsc_data;
struct snmp_mtp_session;
struct msc_connection;
-struct mtp_m2ua_transport;
struct mtp_udp_data {
struct osmo_wqueue write_queue;
@@ -76,8 +75,6 @@ struct bsc_data {
char *udp_ip;
int udp_nr_links;
- int m2ua_src_port;
-
/* MTP Links */
struct llist_head linksets;
int num_linksets;
@@ -87,7 +84,8 @@ struct bsc_data {
struct osmo_fd inject_fd;
/* m2ua code */
- struct sctp_m2ua_transport *m2ua_trans;
+ struct mtp_transport *m2ua_trans;
+ int m2ua_src_port;
/* MSCs */
struct llist_head mscs;
diff --git a/include/mtp_data.h b/include/mtp_data.h
index 69db8f7..295afb2 100644
--- a/include/mtp_data.h
+++ b/include/mtp_data.h
@@ -23,6 +23,7 @@
#include <osmocom/core/msgb.h>
#include <osmocom/core/timer.h>
#include <osmocom/core/utils.h>
+#include <osmocom/core/select.h>
struct bsc_data;
struct mtp_link;
@@ -150,6 +151,16 @@ struct mtp_link {
void *data;
};
+/**
+ * @brief Base structure shared by SCTP/M2UA and SCCP-lite
+ */
+struct mtp_transport {
+ int started;
+ struct llist_head conns;
+ struct osmo_fd bsc;
+
+ struct llist_head links;
+};
void mtp_link_set_stop(struct mtp_link_set *set);
void mtp_link_set_reset(struct mtp_link_set *set);
diff --git a/include/sctp_m2ua.h b/include/sctp_m2ua.h
index ee46a66..cf89379 100644
--- a/include/sctp_m2ua.h
+++ b/include/sctp_m2ua.h
@@ -33,14 +33,6 @@ struct mtp_link;
* Drive M2UA over a SCTP link. Right now we have no
* real concept for failover and such for the link.
*/
-struct sctp_m2ua_transport {
- int started;
- struct llist_head conns;
- struct osmo_fd bsc;
-
- struct llist_head links;
-};
-
struct mtp_m2ua_link {
struct mtp_link *base;
@@ -56,7 +48,7 @@ struct mtp_m2ua_link {
int link_index;
struct llist_head entry;
- struct sctp_m2ua_transport *transport;
+ struct mtp_transport *transport;
char *as;
};
@@ -70,16 +62,16 @@ struct sctp_m2ua_conn {
int asp_up;
struct osmo_wqueue queue;
- struct sctp_m2ua_transport *trans;
+ struct mtp_transport *trans;
};
-struct sctp_m2ua_transport *sctp_m2ua_transp_create(struct bsc_data *bsc);
-int sctp_m2ua_transport_bind(struct sctp_m2ua_transport *, const char *ip, int port);
-struct mtp_m2ua_link *mtp_m2ua_link_create(struct sctp_m2ua_transport *transport,
+struct mtp_transport *sctp_m2ua_transp_create(struct bsc_data *bsc);
+int sctp_m2ua_transport_bind(struct mtp_transport *, const char *ip, int port);
+struct mtp_m2ua_link *mtp_m2ua_link_create(struct mtp_transport *transport,
struct mtp_link_set *);
struct mtp_m2ua_link *mtp_m2ua_link_init(struct mtp_link *link);
-int sctp_m2ua_conn_count(struct sctp_m2ua_transport *tran);
+int sctp_m2ua_conn_count(struct mtp_transport *tran);
#endif
diff --git a/src/main.c b/src/main.c
index 5f5611b..fa11d79 100644
--- a/src/main.c
+++ b/src/main.c
@@ -133,7 +133,7 @@ int main(int argc, char **argv)
return 0;
}
-int sctp_m2ua_conn_count(struct sctp_m2ua_transport *trans)
+int sctp_m2ua_conn_count(struct mtp_transport *trans)
{
return 0;
}
diff --git a/src/sctp_m2ua.c b/src/sctp_m2ua.c
index 43deb52..e458325 100644
--- a/src/sctp_m2ua.c
+++ b/src/sctp_m2ua.c
@@ -33,7 +33,7 @@
#define SCTP_PPID_M2UA 2
-int sctp_m2ua_conn_count(struct sctp_m2ua_transport *trans)
+int sctp_m2ua_conn_count(struct mtp_transport *trans)
{
int count = 0;
struct sctp_m2ua_conn *conn;
@@ -44,7 +44,7 @@ int sctp_m2ua_conn_count(struct sctp_m2ua_transport *trans)
return count;
}
-static struct mtp_m2ua_link *find_m2ua_link(struct sctp_m2ua_transport *trans, int link_index)
+static struct mtp_m2ua_link *find_m2ua_link(struct mtp_transport *trans, int link_index)
{
struct mtp_m2ua_link *link;
@@ -150,7 +150,7 @@ static int m2ua_handle_asp_ack(struct sctp_m2ua_conn *conn,
struct m2ua_msg *m2ua,
struct sctp_sndrcvinfo *info)
{
- struct sctp_m2ua_transport *trans = conn->trans;
+ struct mtp_transport *trans = conn->trans;
struct sctp_m2ua_conn *tmp;
struct m2ua_msg_part *asp_ident;
struct m2ua_msg *ack;
@@ -665,7 +665,7 @@ static int m2ua_conn_write(struct osmo_fd *fd, struct msgb *msg)
static int sctp_trans_accept(struct osmo_fd *fd, unsigned int what)
{
struct sctp_event_subscribe events;
- struct sctp_m2ua_transport *trans;
+ struct mtp_transport *trans;
struct sctp_m2ua_conn *conn;
struct sockaddr_in addr;
socklen_t len;
@@ -757,11 +757,11 @@ static int sctp_m2ua_reset(struct mtp_link *_link)
return 0;
}
-struct sctp_m2ua_transport *sctp_m2ua_transp_create(struct bsc_data *bsc)
+struct mtp_transport *sctp_m2ua_transp_create(struct bsc_data *bsc)
{
- struct sctp_m2ua_transport *trans;
+ struct mtp_transport *trans;
- trans = talloc_zero(bsc, struct sctp_m2ua_transport);
+ trans = talloc_zero(bsc, struct mtp_transport);
if (!trans) {
LOGP(DINP, LOGL_ERROR, "Remove the talloc.\n");
return NULL;
@@ -774,7 +774,7 @@ struct sctp_m2ua_transport *sctp_m2ua_transp_create(struct bsc_data *bsc)
return trans;
}
-int sctp_m2ua_transport_bind(struct sctp_m2ua_transport *trans,
+int sctp_m2ua_transport_bind(struct mtp_transport *trans,
const char *ip, int port)
{
int sctp;
@@ -819,7 +819,7 @@ int sctp_m2ua_transport_bind(struct sctp_m2ua_transport *trans,
struct mtp_m2ua_link *mtp_m2ua_link_init(struct mtp_link *blnk)
{
- struct sctp_m2ua_transport *trans;
+ struct mtp_transport *trans;
struct mtp_m2ua_link *lnk;
lnk = talloc_zero(blnk, struct mtp_m2ua_link);