1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21#ifndef __CONNECTOR_H
22#define __CONNECTOR_H
23
24
25#include <linux/atomic.h>
26
27#include <linux/list.h>
28#include <linux/workqueue.h>
29
30#include <net/sock.h>
31#include <uapi/linux/connector.h>
32
33#define CN_CBQ_NAMELEN 32
34
35struct cn_queue_dev {
36 atomic_t refcnt;
37 unsigned char name[CN_CBQ_NAMELEN];
38
39 struct list_head queue_list;
40 spinlock_t queue_lock;
41
42 struct sock *nls;
43};
44
45struct cn_callback_id {
46 unsigned char name[CN_CBQ_NAMELEN];
47 struct cb_id id;
48};
49
50struct cn_callback_entry {
51 struct list_head callback_entry;
52 atomic_t refcnt;
53 struct cn_queue_dev *pdev;
54
55 struct cn_callback_id id;
56 void (*callback) (struct cn_msg *, struct netlink_skb_parms *);
57
58 u32 seq, group;
59};
60
61struct cn_dev {
62 struct cb_id id;
63
64 u32 seq, groups;
65 struct sock *nls;
66 void (*input) (struct sk_buff *skb);
67
68 struct cn_queue_dev *cbdev;
69};
70
71int cn_add_callback(struct cb_id *id, const char *name,
72 void (*callback)(struct cn_msg *, struct netlink_skb_parms *));
73void cn_del_callback(struct cb_id *);
74int cn_netlink_send(struct cn_msg *, u32, gfp_t);
75
76int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name,
77 struct cb_id *id,
78 void (*callback)(struct cn_msg *, struct netlink_skb_parms *));
79void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id);
80void cn_queue_release_callback(struct cn_callback_entry *);
81
82struct cn_queue_dev *cn_queue_alloc_dev(const char *name, struct sock *);
83void cn_queue_free_dev(struct cn_queue_dev *dev);
84
85int cn_cb_equal(struct cb_id *, struct cb_id *);
86
87#endif
88