]>
Commit | Line | Data |
---|---|---|
1a59d1b8 | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
7672d0b5 EP |
2 | /* |
3 | * connector.h | |
4 | * | |
a8018766 | 5 | * 2004-2005 Copyright (c) Evgeniy Polyakov <zbr@ioremap.net> |
7672d0b5 | 6 | * All rights reserved. |
7672d0b5 | 7 | */ |
7672d0b5 EP |
8 | #ifndef __CONNECTOR_H |
9 | #define __CONNECTOR_H | |
10 | ||
7672d0b5 | 11 | |
e65f7ee3 | 12 | #include <linux/refcount.h> |
7672d0b5 EP |
13 | |
14 | #include <linux/list.h> | |
15 | #include <linux/workqueue.h> | |
16 | ||
17 | #include <net/sock.h> | |
607ca46e | 18 | #include <uapi/linux/connector.h> |
7672d0b5 EP |
19 | |
20 | #define CN_CBQ_NAMELEN 32 | |
21 | ||
22 | struct cn_queue_dev { | |
23 | atomic_t refcnt; | |
24 | unsigned char name[CN_CBQ_NAMELEN]; | |
25 | ||
7672d0b5 EP |
26 | struct list_head queue_list; |
27 | spinlock_t queue_lock; | |
28 | ||
7672d0b5 EP |
29 | struct sock *nls; |
30 | }; | |
31 | ||
acd042bb | 32 | struct cn_callback_id { |
7672d0b5 | 33 | unsigned char name[CN_CBQ_NAMELEN]; |
7672d0b5 | 34 | struct cb_id id; |
acd042bb EP |
35 | }; |
36 | ||
7672d0b5 EP |
37 | struct cn_callback_entry { |
38 | struct list_head callback_entry; | |
e65f7ee3 | 39 | refcount_t refcnt; |
7672d0b5 EP |
40 | struct cn_queue_dev *pdev; |
41 | ||
acd042bb | 42 | struct cn_callback_id id; |
04f482fa | 43 | void (*callback) (struct cn_msg *, struct netlink_skb_parms *); |
7672d0b5 | 44 | |
6e32814b | 45 | u32 seq, group; |
7672d0b5 EP |
46 | }; |
47 | ||
7672d0b5 EP |
48 | struct cn_dev { |
49 | struct cb_id id; | |
50 | ||
51 | u32 seq, groups; | |
52 | struct sock *nls; | |
cd40b7d3 | 53 | void (*input) (struct sk_buff *skb); |
7672d0b5 EP |
54 | |
55 | struct cn_queue_dev *cbdev; | |
56 | }; | |
57 | ||
008536e8 JP |
58 | int cn_add_callback(struct cb_id *id, const char *name, |
59 | void (*callback)(struct cn_msg *, struct netlink_skb_parms *)); | |
7672d0b5 | 60 | void cn_del_callback(struct cb_id *); |
34470e0b | 61 | int cn_netlink_send_mult(struct cn_msg *msg, u16 len, u32 portid, u32 group, gfp_t gfp_mask); |
ac8f7330 | 62 | int cn_netlink_send(struct cn_msg *msg, u32 portid, u32 group, gfp_t gfp_mask); |
7672d0b5 | 63 | |
008536e8 JP |
64 | int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name, |
65 | struct cb_id *id, | |
66 | void (*callback)(struct cn_msg *, struct netlink_skb_parms *)); | |
7672d0b5 | 67 | void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id); |
04f482fa | 68 | void cn_queue_release_callback(struct cn_callback_entry *); |
7672d0b5 | 69 | |
008536e8 | 70 | struct cn_queue_dev *cn_queue_alloc_dev(const char *name, struct sock *); |
7672d0b5 EP |
71 | void cn_queue_free_dev(struct cn_queue_dev *dev); |
72 | ||
73 | int cn_cb_equal(struct cb_id *, struct cb_id *); | |
74 | ||
7672d0b5 | 75 | #endif /* __CONNECTOR_H */ |