Interally used callbacks and structures

## Functions

static int | send_mod_request (int fd, struct nlmsghdr *n)
| send_mod_request - send a linkinfo modification request
static int | send_dump_request (int fd, const char *name, int family, int type)
| send_dump_request - send a dump linkinfo request
static int | open_nl_sock ()
| open_nl_sock - open a netlink socket
static int | do_get_nl_link (int fd, __u8 acquire, const char *name, void *res)
| do_get_nl_link - get linkinfo
static int | get_link (const char *name, __u8 acquire, void *res)
| get_link - get linkinfo
static int | do_set_nl_link (int fd, __u8 if_state, const char *name, struct req_info *req_info)
| do_set_nl_link - setup linkinfo
static int | set_link (const char *name, __u8 if_state, struct req_info *req_info)
| set_link - open a netlink socket and setup linkinfo

## Detailed Description

## Function Documentation

## do_get_nl_link()

static int do_get_nl_link | ( | int | fd,
|  | __u8 | acquire,
|  | const char * | name,
|  | void * | res
| ) |  |

static

do_get_nl_link - get linkinfo

Parameters

  fd | socket file descriptor to a priorly opened netlink socket
  acquire | which parameter we want to get
  name | name of the can device. This is the netdev name, as ifconfig -a shows in your system. usually it contains prefix "can" and the numer of the can line. e.g. "can0"
  res | pointer to store the result

This callback send a dump request into the netlink layer, collect the packet containing the linkinfo and fill the pointer res points to depending on the acquire mode set in param acquire.

Returns
  0 if success
  -1 if failed

References parse_rtattr(), and send_dump_request().

Referenced by get_link().

Here is the call graph for this function:
Here is the caller graph for this function:

## do_set_nl_link()

static int do_set_nl_link | ( | int | fd,
|  | __u8 | if_state,
|  | const char * | name,
|  | struct req_info * | req_info
| ) |  |

static

do_set_nl_link - setup linkinfo

Parameters

  fd | socket file descriptor to a priorly opened netlink socket
  if_state | state of the interface we want to put the device into. this parameter is only set if you want to use the callback to driver up/down the device
  name | name of the can device. This is the netdev name, as ifconfig -a shows in your system. usually it contains prefix "can" and the numer of the can line. e.g. "can0"
  req_info | request parameters

This callback can do two different tasks:

- bring up/down the interface
- set up a netlink packet with request, as set up in req_info Which task this callback will do depends on which parameters are set.

Returns
  0 if success
  -1 if failed

References send_mod_request().

Referenced by set_link().

Here is the call graph for this function:
Here is the caller graph for this function:

## get_link()

static int get_link | ( | const char * | name,
|  | __u8 | acquire,
|  | void * | res
| ) |  |

static

get_link - get linkinfo

Parameters

  name | name of the can device. This is the netdev name, as ifconfig -a shows in your system. usually it contains prefix "can" and the numer of the can line. e.g. "can0"
  acquire | which parameter we want to get
  res | pointer to store the result

This is a wrapper for do_get_nl_link

Returns
  0 if success
  -1 if failed

References do_get_nl_link(), and open_nl_sock().

Referenced by can_get_berr_counter(), can_get_bittiming(), can_get_bittiming_const(), can_get_clock(), can_get_ctrlmode(), can_get_device_stats(), can_get_link_stats(), can_get_restart_ms(), and can_get_state().

Here is the call graph for this function:
Here is the caller graph for this function:

## open_nl_sock()

static int open_nl_sock | ( |  | ) |

static

open_nl_sock - open a netlink socket

opens a netlink socket and returns the socket descriptor

Returns
  0 if success
  negativ if failed

Referenced by get_link(), and set_link().

Here is the caller graph for this function:

## send_dump_request()

static int send_dump_request | ( | int | fd,
|  | const char * | name,
|  | int | family,
|  | int | type
| ) |  |

static

send_dump_request - send a dump linkinfo request

Parameters

  fd | decriptor to a priorly opened netlink socket
  name | network interface name, null means all interfaces
  family | rt_gen message family
  type | netlink message header type

Returns
  0 if success
  negativ if failed

Referenced by do_get_nl_link().

Here is the caller graph for this function:

## send_mod_request()

static int send_mod_request | ( | int | fd,
|  | struct nlmsghdr * | n
| ) |  |

static

send_mod_request - send a linkinfo modification request

Parameters

  fd | decriptor to a priorly opened netlink socket
  n | netlink message containing the request

sends a request to setup the the linkinfo to netlink layer and awaits the status.

Returns
  0 if success
  negativ if failed

Referenced by do_set_nl_link().

Here is the caller graph for this function:

## set_link()

static int set_link | ( | const char * | name,
|  | __u8 | if_state,
|  | struct req_info * | req_info
| ) |  |

static

set_link - open a netlink socket and setup linkinfo

Parameters

  name | name of the can device. This is the netdev name, as ifconfig -a shows in your system. usually it contains prefix "can" and the numer of the can line. e.g. "can0"
  if_state | state of the interface we want to put the device into. this parameter is only set if you want to use the callback to driver up/down the device
  req_info | request parameters

This is a wrapper for do_set_nl_link. It opens a netlink socket and sends down the requests.

Returns
  0 if success
  -1 if failed

References do_set_nl_link(), and open_nl_sock().

Referenced by can_do_restart(), can_do_start(), can_do_stop(), can_set_bittiming(), can_set_ctrlmode(), and can_set_restart_ms().

Here is the call graph for this function:
Here is the caller graph for this function: