libsocketcan  v0.0.5
Interally used callbacks and structures

Functions

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

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
fdsocket file descriptor to a priorly opened netlink socket
acquirewhich parameter we want to get
namename 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"
respointer 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

Referenced by get_link().

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
fdsocket file descriptor to a priorly opened netlink socket
if_statestate 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
namename 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_inforequest 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

Referenced by set_link().

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
namename 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"
acquirewhich parameter we want to get
respointer 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
fddecriptor to a priorly opened netlink socket
namenetwork interface name, null means all interfaces
familyrt_gen message family
typenetlink message header type
Returns
0 if success
negativ if failed

◆ send_mod_request()

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

send_mod_request - send a linkinfo modification request

Parameters
fddecriptor to a priorly opened netlink socket
nnetlink 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

◆ 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
namename 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_statestate 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_inforequest 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: