libosmo-netif  0.2.0-dirty
Osmocom network interface library
include/osmocom/netif/channel.h
00001 #ifndef _CHANNEL_H_
00002 #define _CHANNEL_H_
00003 
00004 #include <stdint.h>
00005 
00006 /* channel types */
00007 enum {
00008         OSMO_CHAN_NONE,
00009         OSMO_CHAN_ABIS_IPA_SRV,
00010         OSMO_CHAN_ABIS_IPA_CLI,
00011         OSMO_CHAN_MAX,
00012 };
00013 
00014 /* channel subtypes */
00015 enum {
00016         OSMO_SUBCHAN_STREAM,
00017         OSMO_SUBCHAN_MAX,
00018 };
00019 
00020 struct osmo_chan;
00021 struct msgb;
00022 
00023 struct osmo_chan_type {
00024         struct llist_head head;
00025 
00026         char    *name;
00027         int     type;
00028         int     subtype;
00029         int     datasiz;
00030 
00031         int     (*create)(struct osmo_chan *chan);
00032         void    (*destroy)(struct osmo_chan *chan);
00033         int     (*open)(struct osmo_chan *chan);
00034         void    (*close)(struct osmo_chan *chan);
00035         int     (*enqueue)(struct osmo_chan *chan, struct msgb *msg);
00036 };
00037 
00038 struct osmo_chan {
00039         void                    *ctx;
00040         struct osmo_chan_type   *ops;
00041         char                    data[0];
00042 };
00043 
00044 void osmo_chan_init(void *ctx);
00045 
00046 struct osmo_chan *osmo_chan_create(int type, int subtype);
00047 void osmo_chan_destroy(struct osmo_chan *c);
00048 
00049 int osmo_chan_open(struct osmo_chan *c);
00050 void osmo_chan_close(struct osmo_chan *c);
00051 
00052 int osmo_chan_enqueue(struct osmo_chan *c, struct msgb *msg);
00053 
00054 #endif /* _CHANNEL_H_ */
 All Data Structures Files Functions