libosmo-netif  0.0.7.20171026
Osmocom network interface library
channel.h
1 #ifndef _CHANNEL_H_
2 #define _CHANNEL_H_
3 
4 #include <stdint.h>
5 
6 /* channel types */
7 enum {
8  OSMO_CHAN_NONE,
9  OSMO_CHAN_ABIS_IPA_SRV,
10  OSMO_CHAN_ABIS_IPA_CLI,
11  OSMO_CHAN_MAX,
12 };
13 
14 /* channel subtypes */
15 enum {
16  OSMO_SUBCHAN_STREAM,
17  OSMO_SUBCHAN_MAX,
18 };
19 
20 struct osmo_chan;
21 struct msgb;
22 
24  struct llist_head head;
25 
26  char *name;
27  int type;
28  int subtype;
29  int datasiz;
30 
31  int (*create)(struct osmo_chan *chan);
32  void (*destroy)(struct osmo_chan *chan);
33  int (*open)(struct osmo_chan *chan);
34  void (*close)(struct osmo_chan *chan);
35  int (*enqueue)(struct osmo_chan *chan, struct msgb *msg);
36 };
37 
38 struct osmo_chan {
39  void *ctx;
40  struct osmo_chan_type *ops;
41  char data[0];
42 };
43 
44 void osmo_chan_init(void *ctx);
45 
46 struct osmo_chan *osmo_chan_create(int type, int subtype);
47 void osmo_chan_destroy(struct osmo_chan *c);
48 
49 int osmo_chan_open(struct osmo_chan *c);
50 void osmo_chan_close(struct osmo_chan *c);
51 
52 int osmo_chan_enqueue(struct osmo_chan *c, struct msgb *msg);
53 
54 #endif /* _CHANNEL_H_ */
Definition: channel.h:23
Definition: channel.h:38