]> rtime.felk.cvut.cz Git - socketcan-devel.git/blob - kernel/2.6/include/socketcan/can/gw.h
Consistently rename LOOPBACK to ECHO to meet IFF_ECHO for CAN.
[socketcan-devel.git] / kernel / 2.6 / include / socketcan / can / gw.h
1 /*
2  * socketcan/can/gw.h
3  *
4  * Definitions for CAN frame Gateway/Router/Bridge 
5  *
6  * $Id$
7  *
8  * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
9  * Copyright (c) 2002-2010 Volkswagen Group Electronic Research
10  * All rights reserved.
11  *
12  * Send feedback to <socketcan-users@lists.berlios.de>
13  *
14  */
15
16 #ifndef CAN_GW_H
17 #define CAN_GW_H
18
19 #include <socketcan/can.h>
20
21 struct rtcanmsg {
22         __u8  can_family;
23         __u8  can_txflags;
24         __u16 pad;
25         __u32 src_ifindex;
26         __u32 dst_ifindex;
27 };
28
29 #define CAN_GW_TXFLAGS_ECHO 0x01
30 #define CAN_GW_TXFLAGS_SRC_TSTAMP 0x02
31
32 /* CAN rtnetlink attribute definitions */
33 enum {
34         CGW_UNSPEC,
35         CGW_FILTER,     /* specify struct can_filter on source CAN device */
36         CGW_MOD_AND,    /* CAN frame modification binary AND */
37         CGW_MOD_OR,     /* CAN frame modification binary OR */
38         CGW_MOD_XOR,    /* CAN frame modification binary XOR */
39         CGW_MOD_SET,    /* CAN frame modification set alternate values */
40         __CGW_MAX
41 };
42
43 #define CGW_MAX (__CGW_MAX - 1)
44
45 #define CGW_MOD_FUNCS 4 /* AND OR XOR SET */
46
47 /* CAN frame elements that are affected by curr. 3 CAN frame modifications */
48 #define CGW_MOD_ID      0x01
49 #define CGW_MOD_DLC     0x02
50 #define CGW_MOD_DATA    0x04
51
52 #define CGW_FRAME_MODS 3 /* ID DLC DATA */
53
54 #define MAX_MODFUNCTIONS (CGW_MOD_FUNCS * CGW_FRAME_MODS)
55
56 #define CGW_MODATTR_LEN (sizeof(struct can_frame) + 1)
57
58 /*
59  * CAN rtnetlink attribute contents in detail
60  *
61  * CGW_FILTER (length 8 bytes):
62  * Sets a CAN receive filter for the gateway job specified by the
63  * struct can_filter described in include/linux/can.h
64  *
65  * CGW_MOD_XXX (length 17 bytes):
66  * Specifies a modification that's done to a received CAN frame before it is
67  * send out to the destination interface.
68  *
69  * <struct can_frame> data used as operator
70  * <u8> affected CAN frame elements
71  *
72  * Remark: The attribute data is a linear buffer. Beware of sending structs!
73  */
74
75 #endif