Skip to content

Commit

Permalink
[CAN]: Add raw protocol
Browse files Browse the repository at this point in the history
This patch adds the CAN raw protocol.

Signed-off-by: Oliver Hartkopp <[email protected]>
Signed-off-by: Urs Thuermann <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Oliver Hartkopp authored and davem330 committed Jan 28, 2008
1 parent 0d66548 commit c18ce10
Show file tree
Hide file tree
Showing 4 changed files with 808 additions and 0 deletions.
31 changes: 31 additions & 0 deletions include/linux/can/raw.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* linux/can/raw.h
*
* Definitions for raw CAN sockets
*
* Authors: Oliver Hartkopp <[email protected]>
* Urs Thuermann <[email protected]>
* Copyright (c) 2002-2007 Volkswagen Group Electronic Research
* All rights reserved.
*
* Send feedback to <[email protected]>
*
*/

#ifndef CAN_RAW_H
#define CAN_RAW_H

#include <linux/can.h>

#define SOL_CAN_RAW (SOL_CAN_BASE + CAN_RAW)

/* for socket options affecting the socket (not the global system) */

enum {
CAN_RAW_FILTER = 1, /* set 0 .. n can_filter(s) */
CAN_RAW_ERR_FILTER, /* set filter for error frames */
CAN_RAW_LOOPBACK, /* local loopback (default:on) */
CAN_RAW_RECV_OWN_MSGS /* receive my own msgs (default:off) */
};

#endif
11 changes: 11 additions & 0 deletions net/can/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,14 @@ menuconfig CAN

If you want CAN support you should say Y here and also to the
specific driver for your controller(s) below.

config CAN_RAW
tristate "Raw CAN Protocol (raw access with CAN-ID filtering)"
depends on CAN
default N
---help---
The raw CAN protocol option offers access to the CAN bus via
the BSD socket API. You probably want to use the raw socket in
most cases where no higher level protocol is being used. The raw
socket has several filter options e.g. ID masking / error frames.
To receive/send raw CAN messages, use AF_CAN with protocol CAN_RAW.
3 changes: 3 additions & 0 deletions net/can/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@

obj-$(CONFIG_CAN) += can.o
can-objs := af_can.o proc.o

obj-$(CONFIG_CAN_RAW) += can-raw.o
can-raw-objs := raw.o
Loading

0 comments on commit c18ce10

Please sign in to comment.