blob: 5ce6b5d62ecc3efcca78b2d0a7021c312fc9009b [file] [log] [blame]
Oliver Hartkopp0d665482007-11-16 15:52:17 -08001/*
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
Oliver Hartkopp1fa17d42009-01-06 11:07:54 -080022#define CAN_VERSION "20090105"
Oliver Hartkopp0d665482007-11-16 15:52:17 -080023
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.
Oliver Hartkopp0d665482007-11-16 15:52:17 -080035 * @ops: pointer to struct proto_ops for sock->ops.
36 * @prot: pointer to struct proto structure.
37 */
38struct can_proto {
Oliver Hartkopp53914b62011-03-22 08:27:25 +000039 int type;
40 int protocol;
41 const struct proto_ops *ops;
42 struct proto *prot;
Oliver Hartkopp0d665482007-11-16 15:52:17 -080043};
44
45/* function prototypes for the CAN networklayer core (af_can.c) */
46
Kurt Van Dijck16506292011-05-03 18:40:57 +000047extern int can_proto_register(const struct can_proto *cp);
48extern void can_proto_unregister(const struct can_proto *cp);
Oliver Hartkopp0d665482007-11-16 15:52:17 -080049
50extern int can_rx_register(struct net_device *dev, canid_t can_id,
51 canid_t mask,
52 void (*func)(struct sk_buff *, void *),
53 void *data, char *ident);
54
55extern void can_rx_unregister(struct net_device *dev, canid_t can_id,
56 canid_t mask,
57 void (*func)(struct sk_buff *, void *),
58 void *data);
59
60extern int can_send(struct sk_buff *skb, int loop);
Oliver Hartkopp53914b62011-03-22 08:27:25 +000061extern int can_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
Oliver Hartkopp0d665482007-11-16 15:52:17 -080062
63#endif /* CAN_CORE_H */