Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
core.h File Reference
#include <linux/can.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>

Go to the source code of this file.

Data Structures

struct  can_proto
 

Macros

#define CAN_VERSION   "20120528"
 
#define CAN_ABI_VERSION   "9"
 
#define CAN_VERSION_STRING   "rev " CAN_VERSION " abi " CAN_ABI_VERSION
 
#define DNAME(dev)   ((dev) ? (dev)->name : "any")
 

Functions

int can_proto_register (const struct can_proto *cp)
 
void can_proto_unregister (const struct can_proto *cp)
 
int can_rx_register (struct net_device *dev, canid_t can_id, canid_t mask, void(*func)(struct sk_buff *, void *), void *data, char *ident)
 
void can_rx_unregister (struct net_device *dev, canid_t can_id, canid_t mask, void(*func)(struct sk_buff *, void *), void *data)
 
int can_send (struct sk_buff *skb, int loop)
 
int can_ioctl (struct socket *sock, unsigned int cmd, unsigned long arg)
 

Macro Definition Documentation

#define CAN_ABI_VERSION   "9"

Definition at line 23 of file core.h.

#define CAN_VERSION   "20120528"

Definition at line 20 of file core.h.

#define CAN_VERSION_STRING   "rev " CAN_VERSION " abi " CAN_ABI_VERSION

Definition at line 25 of file core.h.

#define DNAME (   dev)    ((dev) ? (dev)->name : "any")

Definition at line 27 of file core.h.

Function Documentation

int can_ioctl ( struct socket sock,
unsigned int  cmd,
unsigned long  arg 
)

Definition at line 98 of file af_can.c.

int can_proto_register ( const struct can_proto cp)

can_proto_register - register CAN transport protocol : pointer to CAN protocol structure

Return: 0 on success -EINVAL invalid (out of range) protocol number -EBUSY protocol already in use -ENOBUF if proto_register() fails

Definition at line 748 of file af_can.c.

void can_proto_unregister ( const struct can_proto cp)

can_proto_unregister - unregister CAN transport protocol : pointer to CAN protocol structure

Definition at line 785 of file af_can.c.

int can_rx_register ( struct net_device dev,
canid_t  can_id,
canid_t  mask,
void(*)(struct sk_buff *, void *)  func,
void data,
char ident 
)

can_rx_register - subscribe CAN frames from a specific interface : pointer to netdevice (NULL => subcribe from 'all' CAN devices list) : CAN identifier (see description) : CAN mask (see description) : callback function on filter match : returned parameter for callback function : string for calling module indentification

Description: Invokes the callback function with the received sk_buff and the given parameter 'data' on a matching receive filter. A filter matches, when

    <received_can_id> & mask == can_id & mask

The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can filter for error message frames (CAN_ERR_FLAG bit set in mask).

The provided pointer to the sk_buff is guaranteed to be valid as long as the callback function is running. The callback function must not free the given sk_buff while processing it's task. When the given sk_buff is needed after the end of the callback function it must be cloned inside the callback function with skb_clone().

Return: 0 on success -ENOMEM on missing cache mem to create subscription entry -ENODEV unknown device

Definition at line 445 of file af_can.c.

void can_rx_unregister ( struct net_device dev,
canid_t  can_id,
canid_t  mask,
void(*)(struct sk_buff *, void *)  func,
void data 
)

can_rx_unregister - unsubscribe CAN frames from a specific interface : pointer to netdevice (NULL => unsubcribe from 'all' CAN devices list) : CAN identifier : CAN mask : callback function on filter match : returned parameter for callback function

Description: Removes subscription entry depending on given (subscription) values.

Definition at line 514 of file af_can.c.

int can_send ( struct sk_buff skb,
int  loop 
)

can_send - transmit a CAN frame (optional with local loopback) : pointer to socket buffer with CAN frame in data section : loopback for listeners on local CAN sockets (recommended default!)

Due to the loopback this routine must not be called from hardirq context.

Return: 0 on success -ENETDOWN when the selected interface is down -ENOBUFS on full driver queue (see net_xmit_errno()) -ENOMEM when local loopback failed at calling skb_clone() -EPERM when trying to send on a non-CAN interface -EMSGSIZE CAN frame size is bigger than CAN interface MTU -EINVAL when the skb->data does not contain a valid CAN frame

Definition at line 227 of file af_can.c.