1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef _CAN_CORE_H
15#define _CAN_CORE_H
16
17#include <linux/can.h>
18#include <linux/skbuff.h>
19#include <linux/netdevice.h>
20
21#define DNAME(dev) ((dev) ? (dev)->name : "any")
22
23
24
25
26
27
28
29
30struct can_proto {
31 int type;
32 int protocol;
33 const struct proto_ops *ops;
34 struct proto *prot;
35};
36
37
38
39
40
41#define CAN_REQUIRED_SIZE(struct_type, member) \
42 (offsetof(typeof(struct_type), member) + \
43 sizeof(((typeof(struct_type) *)(NULL))->member))
44
45
46
47extern int can_proto_register(const struct can_proto *cp);
48extern void can_proto_unregister(const struct can_proto *cp);
49
50int can_rx_register(struct net *net, struct net_device *dev,
51 canid_t can_id, canid_t mask,
52 void (*func)(struct sk_buff *, void *),
53 void *data, char *ident, struct sock *sk);
54
55extern void can_rx_unregister(struct net *net, struct net_device *dev,
56 canid_t can_id, canid_t mask,
57 void (*func)(struct sk_buff *, void *),
58 void *data);
59
60extern int can_send(struct sk_buff *skb, int loop);
61void can_sock_destruct(struct sock *sk);
62
63#endif
64