aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/netif/channel.h
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2011-11-06 20:47:08 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2011-11-08 11:17:44 +0100
commit2b5d3ce7c69e1149bb2af815ab8b8534026063ca (patch)
treeadf544975a45d2bbcc7e46f3269aff101f1ed0bb /include/osmocom/netif/channel.h
parentffe3cb3ef93483c45d23ba7ea7fe156d5bb4dbc6 (diff)
src: add generic channel infrastructure and A-bis IPA server support
This patch adds the generic channel infrastructure that allows to create channel of different types. Each channel has their own configuration functions. struct osmo_chan *chan; chan = osmo_chan_create(tall_example, CHAN_ABIS_IPA_SERVER); ... /* specific configuration functions per supported channel. */ osmo_chan_abis_ipa_server_set_cb_signalmsg(chan, signal_msg_cb); osmo_chan_abis_ipa_unit_add(chan, 1801, 0); /* open channel. */ osmo_chan_open(chan); The input path requires a callback to be registered. The output path is handled through: int osmo_chan_enqueue(struct osmo_chan *c, struct msgb *msg); The msg->dst must be set (it can be taken from the original message to route one reply). This patch also adds A-bis IPA server support. It has been tested with e1inp_ipa_bsc_test available in libosmo-abis.
Diffstat (limited to 'include/osmocom/netif/channel.h')
-rw-r--r--include/osmocom/netif/channel.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/include/osmocom/netif/channel.h b/include/osmocom/netif/channel.h
new file mode 100644
index 0000000..65955e8
--- /dev/null
+++ b/include/osmocom/netif/channel.h
@@ -0,0 +1,49 @@
+#ifndef _CHANNEL_H_
+#define _CHANNEL_H_
+
+#include <stdint.h>
+
+#define CHAN_SIGN_OML 0
+#define CHAN_SIGN_RSL 1
+
+enum {
+ CHAN_NONE,
+ CHAN_ABIS_IPA_SERVER,
+ CHAN_MAX,
+};
+
+#define CHAN_F_DEFAULT (1 << 0)
+#define CHAN_F_BUFFERED (1 << 1)
+#define CHAN_F_STREAM (1 << 2)
+#define CHAN_F_ERRORS (1 << 3)
+#define CHAN_F_MAX (1 << 4)
+
+struct osmo_chan;
+struct msgb;
+
+struct osmo_chan_type {
+ int type;
+ int datasiz;
+
+ int (*create)(struct osmo_chan *chan);
+ void (*destroy)(struct osmo_chan *chan);
+ int (*open)(struct osmo_chan *chan);
+ void (*close)(struct osmo_chan *chan);
+ int (*enqueue)(struct osmo_chan *chan, struct msgb *msg);
+};
+
+struct osmo_chan {
+ void *ctx;
+ struct osmo_chan_type *ops;
+ char data[0];
+};
+
+struct osmo_chan *osmo_chan_create(void *ctx, int type);
+void osmo_chan_destroy(struct osmo_chan *c);
+
+int osmo_chan_open(struct osmo_chan *c);
+void osmo_chan_close(struct osmo_chan *c);
+
+int osmo_chan_enqueue(struct osmo_chan *c, struct msgb *msg);
+
+#endif /* _CHANNEL_H_ */