]> rtime.felk.cvut.cz Git - socketcan-devel.git/blob - kernel/2.6/include/socketcan/can/core.h
b8a17b126c5761a85ea2cdf8a744e0304985b9e4
[socketcan-devel.git] / kernel / 2.6 / include / socketcan / can / core.h
1 /*
2  * socketcan/can/core.h
3  *
4  * Protoypes and definitions for CAN protocol modules using the PF_CAN core
5  *
6  * $Id$
7  *
8  * Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
9  *          Urs Thuermann   <urs.thuermann@volkswagen.de>
10  * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
11  * All rights reserved.
12  *
13  * Send feedback to <socketcan-users@lists.berlios.de>
14  *
15  */
16
17 #ifndef CAN_CORE_H
18 #define CAN_CORE_H
19
20 #include <socketcan/can.h>
21 #include <linux/skbuff.h>
22 #include <linux/netdevice.h>
23
24 #define CAN_VERSION "20090105"
25
26 /* increment this number each time you change some user-space interface */
27 #define CAN_ABI_VERSION "8"
28
29 #define CAN_VERSION_STRING "rev " CAN_VERSION " abi " CAN_ABI_VERSION
30
31 #define DNAME(dev) ((dev) ? (dev)->name : "any")
32
33 /**
34  * struct can_proto - CAN protocol structure
35  * @type:       type argument in socket() syscall, e.g. SOCK_DGRAM.
36  * @protocol:   protocol number in socket() syscall.
37  * @capability: capability needed to open the socket, or -1 for no restriction.
38  * @ops:        pointer to struct proto_ops for sock->ops.
39  * @prot:       pointer to struct proto structure.
40  */
41 struct can_proto {
42         int              type;
43         int              protocol;
44 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
45         int              capability;
46 #endif
47         struct proto_ops *ops;
48 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
49         struct proto     *prot;
50 #else
51         struct module    *owner;
52         int              (*init)(struct sock *sk);
53         size_t           obj_size;
54 #endif
55 };
56
57 /* function prototypes for the CAN networklayer core (af_can.c) */
58
59 extern int  can_proto_register(struct can_proto *cp);
60 extern void can_proto_unregister(struct can_proto *cp);
61
62 extern int  can_rx_register(struct net_device *dev, canid_t can_id,
63                             canid_t mask,
64                             void (*func)(struct sk_buff *, void *),
65                             void *data, char *ident);
66
67 extern void can_rx_unregister(struct net_device *dev, canid_t can_id,
68                               canid_t mask,
69                               void (*func)(struct sk_buff *, void *),
70                               void *data);
71
72 extern int can_send(struct sk_buff *skb, int loop);
73
74 #endif /* CAN_CORE_H */