]> rtime.felk.cvut.cz Git - socketcan-devel.git/blob - kernel/2.6/include/linux/can/core.h
d483797c30bd9d11417b97a0e11e72a9aaf61df0
[socketcan-devel.git] / kernel / 2.6 / include / linux / can / core.h
1 /*
2  * linux/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 <linux/can.h>
21 #include <linux/skbuff.h>
22 #include <linux/netdevice.h>
23
24 #define DNAME(dev) ((dev) ? (dev)->name : "any")
25
26 #define CAN_PROC_DIR "net/can" /* /proc/... */
27
28 /**
29  * struct can_proto - CAN protocol structure
30  * @type:       type argument in socket() syscall, e.g. SOCK_DGRAM.
31  * @protocol:   protocol number in socket() syscall.
32  * @capability: capability needed to open the socket, or -1 for no restriction.
33  * @ops:        pointer to struct proto_ops for sock->ops.
34  * @prot:       pointer to struct proto structure.
35  */
36
37 struct can_proto {
38         int              type;
39         int              protocol;
40         int              capability;
41         struct proto_ops *ops;
42 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
43         struct proto     *prot;
44 #else
45         struct module    *owner;
46         int              (*init)(struct sock *sk);
47         size_t           obj_size;
48 #endif
49 };
50
51 /* function prototypes for the CAN networklayer core (af_can.c) */
52
53 void can_debug_skb(struct sk_buff *skb);
54 void can_debug_cframe(const char *msg, struct can_frame *cframe, ...);
55
56 int can_proto_register(struct can_proto *cp);
57 int can_proto_unregister(struct can_proto *cp);
58
59 int can_rx_register(struct net_device *dev, canid_t can_id, canid_t mask,
60                     void (*func)(struct sk_buff *, void *), void *data,
61                     char *ident);
62 int can_rx_unregister(struct net_device *dev, canid_t can_id, canid_t mask,
63                       void (*func)(struct sk_buff *, void *), void *data);
64
65 int can_dev_register(struct net_device *dev,
66                      void (*func)(unsigned long msg, void *), void *data);
67 int can_dev_unregister(struct net_device *dev,
68                        void (*func)(unsigned long msg, void *), void *data);
69
70 int can_send(struct sk_buff *skb, int loop);
71
72 unsigned long timeval2jiffies(struct timeval *tv, int round_up);
73
74 #endif /* CAN_CORE_H */