aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-01-17 11:54:39 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-01-17 14:11:26 +0100
commit0e2f9116f846968d5eaf90cf21b7648f1964ae8b (patch)
tree5b197a8a0dcec12b9842f85f3a704782dbb90ba2 /include
parent4a3743440bd77aa0cec240e103aa2c7ce954b714 (diff)
mtp: Rename link_data to mtp_link and move out the transport specific things
Rename link_data to mtp_link and move it into the mtp_data header file, also remove the union to ease creating more of the subtypes. This is done in preparation to the linkset knowing more about the link (e.g. having a link test per link instead of per link).
Diffstat (limited to 'include')
-rw-r--r--include/bsc_data.h49
-rw-r--r--include/mtp_data.h33
2 files changed, 42 insertions, 40 deletions
diff --git a/include/bsc_data.h b/include/bsc_data.h
index fa04c3a..932b229 100644
--- a/include/bsc_data.h
+++ b/include/bsc_data.h
@@ -22,6 +22,8 @@
#ifndef BSC_DATA_H
#define BSC_DATA_H
+#include "mtp_data.h"
+
#include <osmocore/linuxlist.h>
#include <osmocore/select.h>
#include <osmocore/timer.h>
@@ -38,40 +40,17 @@
struct bsc_data;
struct snmp_mtp_session;
-/**
- * A link to the underlying MTP2 library or such
- */
-struct link_data {
- struct llist_head entry;
-
- union {
- struct {
- struct thread_notifier *notifier;
- struct llist_head mtp_queue;
- struct timer_list mtp_timeout;
- } c7;
- struct {
- struct write_queue write_queue;
- struct sockaddr_in remote;
- struct snmp_mtp_session *session;
- int link_index;
- int reset_timeout;
- } udp;
- };
+struct mtp_udp_link {
+ /* subclass */
+ struct mtp_link base;
- int pcap_fd;
+ /* UDP specific stuff */
struct bsc_data *bsc;
- struct mtp_link_set *the_link;
-
- int available;
-
- struct timer_list link_activate;
-
- int (*start)(struct link_data *);
- int (*write)(struct link_data *, struct msgb *msg);
- int (*shutdown)(struct link_data *);
- int (*reset)(struct link_data *data);
- int (*clear_queue)(struct link_data *data);
+ struct write_queue write_queue;
+ struct sockaddr_in remote;
+ struct snmp_mtp_session *session;
+ int link_index;
+ int reset_timeout;
};
@@ -131,8 +110,8 @@ struct bsc_data {
/* bsc related functions */
void release_bsc_resources(struct bsc_data *bsc);
-void mtp_link_down(struct link_data *data);
-void mtp_link_up(struct link_data *data);
+void mtp_link_down(struct mtp_link *data);
+void mtp_link_up(struct mtp_link *data);
void mtp_linkset_down(struct mtp_link_set *);
void mtp_linkset_up(struct mtp_link_set *);
@@ -150,7 +129,7 @@ void update_con_state(struct mtp_link_set *link, int rc, struct sccp_parse_resul
unsigned int sls_for_src_ref(struct sccp_source_reference *ref);
/* udp init */
-int link_udp_init(struct link_data *data, int src_port, const char *dest_ip, int port);
+int link_udp_init(struct mtp_udp_link *data, int src_port, const char *dest_ip, int port);
int link_init(struct bsc_data *bsc);
int link_shutdown_all(struct mtp_link_set *);
int link_reset_all(struct mtp_link_set *);
diff --git a/include/mtp_data.h b/include/mtp_data.h
index 349bf7a..fd886a1 100644
--- a/include/mtp_data.h
+++ b/include/mtp_data.h
@@ -25,7 +25,7 @@
#include <osmocore/utils.h>
struct bsc_data;
-struct link_data;
+struct mtp_link;
/* MTP Level3 timers */
@@ -65,12 +65,35 @@ struct mtp_link_set {
struct timer_list delay_timer;
struct llist_head links;
- struct link_data *slc[16];
+ struct mtp_link *slc[16];
/* custom data */
struct bsc_data *bsc;
};
+/**
+ * One physical link to somewhere. This is the base
+ * with the interface used by the mtp_link_set. There
+ * will be specific implementations for M2UA, UDP and
+ * other transport means.
+ */
+struct mtp_link {
+ struct llist_head entry;
+
+ int pcap_fd;
+ struct mtp_link_set *the_link;
+
+ int available;
+
+ struct timer_list link_activate;
+
+ int (*start)(struct mtp_link *);
+ int (*write)(struct mtp_link *, struct msgb *msg);
+ int (*shutdown)(struct mtp_link *);
+ int (*reset)(struct mtp_link *data);
+ int (*clear_queue)(struct mtp_link *data);
+};
+
struct mtp_link_set *mtp_link_set_alloc(void);
void mtp_link_set_stop(struct mtp_link_set *link);
@@ -80,16 +103,16 @@ int mtp_link_set_submit_sccp_data(struct mtp_link_set *link, int sls, const uint
int mtp_link_set_submit_isup_data(struct mtp_link_set *link, int sls, const uint8_t *data, unsigned int length);
void mtp_link_set_init_slc(struct mtp_link_set *set);
-void mtp_link_set_add_link(struct mtp_link_set *set, struct link_data *link);
+void mtp_link_set_add_link(struct mtp_link_set *set, struct mtp_link *link);
/* one time init function */
void mtp_link_set_init(void);
/* to be implemented for MSU sending */
-void mtp_link_set_submit(struct link_data *link, struct msgb *msg);
+void mtp_link_set_submit(struct mtp_link *link, struct msgb *msg);
void mtp_link_set_forward_sccp(struct mtp_link_set *link, struct msgb *msg, int sls);
-void mtp_link_restart(struct link_data *link);
+void mtp_link_restart(struct mtp_link *link);
void mtp_link_set_sccp_down(struct mtp_link_set *link);
#endif