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 | * |
| 11 | * Send feedback to <socketcan-users@lists.berlios.de> |
| 12 | * |
| 13 | */ |
| 14 | |
| 15 | #ifndef CAN_CORE_H |
| 16 | #define CAN_CORE_H |
| 17 | |
| 18 | #include <linux/can.h> |
| 19 | #include <linux/skbuff.h> |
| 20 | #include <linux/netdevice.h> |
| 21 | |
| 22 | #define CAN_VERSION "20071116" |
| 23 | |
| 24 | /* increment this number each time you change some user-space interface */ |
| 25 | #define CAN_ABI_VERSION "8" |
| 26 | |
| 27 | #define CAN_VERSION_STRING "rev " CAN_VERSION " abi " CAN_ABI_VERSION |
| 28 | |
| 29 | #define DNAME(dev) ((dev) ? (dev)->name : "any") |
| 30 | |
| 31 | /** |
| 32 | * struct can_proto - CAN protocol structure |
| 33 | * @type: type argument in socket() syscall, e.g. SOCK_DGRAM. |
| 34 | * @protocol: protocol number in socket() syscall. |
| 35 | * @capability: capability needed to open the socket, or -1 for no restriction. |
| 36 | * @ops: pointer to struct proto_ops for sock->ops. |
| 37 | * @prot: pointer to struct proto structure. |
| 38 | */ |
| 39 | struct can_proto { |
| 40 | int type; |
| 41 | int protocol; |
| 42 | int capability; |
| 43 | struct proto_ops *ops; |
| 44 | struct proto *prot; |
| 45 | }; |
| 46 | |
| 47 | /* function prototypes for the CAN networklayer core (af_can.c) */ |
| 48 | |
| 49 | extern int can_proto_register(struct can_proto *cp); |
| 50 | extern void can_proto_unregister(struct can_proto *cp); |
| 51 | |
| 52 | extern int can_rx_register(struct net_device *dev, canid_t can_id, |
| 53 | canid_t mask, |
| 54 | void (*func)(struct sk_buff *, void *), |
| 55 | void *data, char *ident); |
| 56 | |
| 57 | extern void can_rx_unregister(struct net_device *dev, canid_t can_id, |
| 58 | canid_t mask, |
| 59 | void (*func)(struct sk_buff *, void *), |
| 60 | void *data); |
| 61 | |
| 62 | extern int can_send(struct sk_buff *skb, int loop); |
| 63 | |
| 64 | #endif /* CAN_CORE_H */ |