Linux Kernel
3.7.1
|
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) |
#define CAN_VERSION_STRING "rev " CAN_VERSION " abi " CAN_ABI_VERSION |
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
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.
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