4 * Protoypes and definitions for CAN protocol modules using the PF_CAN core
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.
13 * Send feedback to <socketcan-users@lists.berlios.de>
20 #include <linux/can.h>
21 #include <linux/skbuff.h>
22 #include <linux/netdevice.h>
24 #define CAN_VERSION "2.0.0-pre7"
26 /* increment this number each time you change some user-space interface */
27 #define CAN_ABI_VERSION "8"
29 #define CAN_VERSION_STRING "rev " CAN_VERSION " abi " CAN_ABI_VERSION
31 #define DNAME(dev) ((dev) ? (dev)->name : "any")
33 #define CAN_PROC_DIR "net/can" /* /proc/... */
36 * struct can_proto - CAN protocol structure
37 * @type: type argument in socket() syscall, e.g. SOCK_DGRAM.
38 * @protocol: protocol number in socket() syscall.
39 * @capability: capability needed to open the socket, or -1 for no restriction.
40 * @ops: pointer to struct proto_ops for sock->ops.
41 * @prot: pointer to struct proto structure.
47 struct proto_ops *ops;
48 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
52 int (*init)(struct sock *sk);
57 /* function prototypes for the CAN networklayer core (af_can.c) */
59 extern int can_proto_register(struct can_proto *cp);
60 extern int can_proto_unregister(struct can_proto *cp);
62 extern int can_rx_register(struct net_device *dev, canid_t can_id,
64 void (*func)(struct sk_buff *, void *),
65 void *data, char *ident);
67 extern int can_rx_unregister(struct net_device *dev, canid_t can_id,
69 void (*func)(struct sk_buff *, void *),
72 extern int can_dev_register(struct net_device *dev,
73 void (*func)(unsigned long msg, void *),
76 extern int can_dev_unregister(struct net_device *dev,
77 void (*func)(unsigned long msg, void *),
80 extern int can_send(struct sk_buff *skb, int loop);
82 #ifdef CONFIG_CAN_DEBUG_CORE
83 extern void can_debug_skb(struct sk_buff *skb);
84 extern void can_debug_cframe(const char *msg, struct can_frame *cframe, ...);
85 #define DBG(args...) (debug & 1 ? \
86 (printk(KERN_DEBUG "can-%s %s: ", \
87 IDENT, __func__), printk(args)) : 0)
88 #define DBG_FRAME(args...) (debug & 2 ? can_debug_cframe(args) : 0)
89 #define DBG_SKB(skb) (debug & 4 ? can_debug_skb(skb) : 0)
92 #define DBG_FRAME(args...)
96 #endif /* CAN_CORE_H */