Oliver Hartkopp | 0d66548 | 2007-11-16 15:52:17 -0800 | [diff] [blame] | 1 | /* |
| 2 | * linux/can/core.h |
| 3 | * |
| 4 | * Protoypes and definitions for CAN protocol modules using the PF_CAN core |
| 5 | * |
| 6 | * Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> |
| 7 | * Urs Thuermann <urs.thuermann@volkswagen.de> |
| 8 | * Copyright (c) 2002-2007 Volkswagen Group Electronic Research |
| 9 | * All rights reserved. |
| 10 | * |
Oliver Hartkopp | 0d66548 | 2007-11-16 15:52:17 -0800 | [diff] [blame] | 11 | */ |
| 12 | |
| 13 | #ifndef CAN_CORE_H |
| 14 | #define CAN_CORE_H |
| 15 | |
| 16 | #include <linux/can.h> |
| 17 | #include <linux/skbuff.h> |
| 18 | #include <linux/netdevice.h> |
| 19 | |
Oliver Hartkopp | 8b01939 | 2012-06-13 20:33:02 +0200 | [diff] [blame] | 20 | #define CAN_VERSION "20120528" |
Oliver Hartkopp | 0d66548 | 2007-11-16 15:52:17 -0800 | [diff] [blame] | 21 | |
| 22 | /* increment this number each time you change some user-space interface */ |
Oliver Hartkopp | 8b01939 | 2012-06-13 20:33:02 +0200 | [diff] [blame] | 23 | #define CAN_ABI_VERSION "9" |
Oliver Hartkopp | 0d66548 | 2007-11-16 15:52:17 -0800 | [diff] [blame] | 24 | |
| 25 | #define CAN_VERSION_STRING "rev " CAN_VERSION " abi " CAN_ABI_VERSION |
| 26 | |
| 27 | #define DNAME(dev) ((dev) ? (dev)->name : "any") |
| 28 | |
| 29 | /** |
| 30 | * struct can_proto - CAN protocol structure |
| 31 | * @type: type argument in socket() syscall, e.g. SOCK_DGRAM. |
| 32 | * @protocol: protocol number in socket() syscall. |
Oliver Hartkopp | 0d66548 | 2007-11-16 15:52:17 -0800 | [diff] [blame] | 33 | * @ops: pointer to struct proto_ops for sock->ops. |
| 34 | * @prot: pointer to struct proto structure. |
| 35 | */ |
| 36 | struct can_proto { |
Oliver Hartkopp | 53914b6 | 2011-03-22 08:27:25 +0000 | [diff] [blame] | 37 | int type; |
| 38 | int protocol; |
| 39 | const struct proto_ops *ops; |
| 40 | struct proto *prot; |
Oliver Hartkopp | 0d66548 | 2007-11-16 15:52:17 -0800 | [diff] [blame] | 41 | }; |
| 42 | |
| 43 | /* function prototypes for the CAN networklayer core (af_can.c) */ |
| 44 | |
Kurt Van Dijck | 1650629 | 2011-05-03 18:40:57 +0000 | [diff] [blame] | 45 | extern int can_proto_register(const struct can_proto *cp); |
| 46 | extern void can_proto_unregister(const struct can_proto *cp); |
Oliver Hartkopp | 0d66548 | 2007-11-16 15:52:17 -0800 | [diff] [blame] | 47 | |
| 48 | extern int can_rx_register(struct net_device *dev, canid_t can_id, |
| 49 | canid_t mask, |
| 50 | void (*func)(struct sk_buff *, void *), |
| 51 | void *data, char *ident); |
| 52 | |
| 53 | extern void can_rx_unregister(struct net_device *dev, canid_t can_id, |
| 54 | canid_t mask, |
| 55 | void (*func)(struct sk_buff *, void *), |
| 56 | void *data); |
| 57 | |
| 58 | extern int can_send(struct sk_buff *skb, int loop); |
Oliver Hartkopp | 53914b6 | 2011-03-22 08:27:25 +0000 | [diff] [blame] | 59 | extern int can_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); |
Oliver Hartkopp | 0d66548 | 2007-11-16 15:52:17 -0800 | [diff] [blame] | 60 | |
| 61 | #endif /* CAN_CORE_H */ |