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