libnl 3.5.0

CAN
Routing Library (libnl-route) » Links (Interfaces)

Controller Area Network link module. More...

## CAN Object
int | rtnl_link_is_can (struct rtnl_link *link)
| Check if link is a CAN link. More...
int | rtnl_link_can_restart (struct rtnl_link *link)
| Restart CAN device. More...
int | rtnl_link_can_freq (struct rtnl_link *link, uint32_t *freq)
| Get CAN base frequency. More...
int | rtnl_link_can_state (struct rtnl_link *link, uint32_t *state)
| Get CAN state. More...
int | rtnl_link_can_berr_rx (struct rtnl_link *link)
| Get CAN RX bus error count. More...
int | rtnl_link_can_berr_tx (struct rtnl_link *link)
| Get CAN TX bus error count. More...
int | rtnl_link_can_berr (struct rtnl_link *link, struct can_berr_counter *berr)
| Get CAN bus error count. More...
int | rtnl_link_can_get_bt_const (struct rtnl_link *link, struct can_bittiming_const *bt_const)
| Get CAN harware-dependent bit-timing constant. More...
int | rtnl_link_can_get_bittiming (struct rtnl_link *link, struct can_bittiming *bit_timing)
| Get CAN device bit-timing. More...
int | rtnl_link_can_set_bittiming (struct rtnl_link *link, struct can_bittiming *bit_timing)
| Set CAN device bit-timing. More...
int | rtnl_link_can_get_bitrate (struct rtnl_link *link, uint32_t *bitrate)
| Get CAN device bit-timing. More...
int | rtnl_link_can_set_bitrate (struct rtnl_link *link, uint32_t bitrate)
| Set CAN device bit-rate. More...
int | rtnl_link_can_get_sample_point (struct rtnl_link *link, uint32_t *sp)
| Get CAN device sample point. More...
int | rtnl_link_can_set_sample_point (struct rtnl_link *link, uint32_t sp)
| Set CAN device sample point. More...
int | rtnl_link_can_get_restart_ms (struct rtnl_link *link, uint32_t *interval)
| Get CAN device restart intervall. More...
int | rtnl_link_can_set_restart_ms (struct rtnl_link *link, uint32_t interval)
| Set CAN device restart intervall. More...
int | rtnl_link_can_get_ctrlmode (struct rtnl_link *link, uint32_t *ctrlmode)
| Get CAN control mode. More...
int | rtnl_link_can_set_ctrlmode (struct rtnl_link *link, uint32_t ctrlmode)
| Set a CAN Control Mode. More...
int | rtnl_link_can_unset_ctrlmode (struct rtnl_link *link, uint32_t ctrlmode)
| Unset a CAN Control Mode. More...

## Control Mode Translation
char * | rtnl_link_can_ctrlmode2str (int ctrlmode, char *buf, size_t len)
int | rtnl_link_can_str2ctrlmode (const char *name)

## Detailed Description

Controller Area Network link module.

Link Type Name: "can"

CAN Documentation (Netlink Routing Development Guide)

## Function Documentation

## ◆ rtnl_link_is_can()

int rtnl_link_is_can | ( | struct rtnl_link * | link | ) |

Check if link is a CAN link.

Parameters

  link | Link object

Returns
  True if link is a CAN link, otherwise false is returned.

Definition at line 367 of file can.c.

## ◆ rtnl_link_can_restart()

int rtnl_link_can_restart | ( | struct rtnl_link * | link | ) |

Restart CAN device.

Parameters

  link | Link object

Returns
  0 on success or a negative error code

Definition at line 378 of file can.c.

## ◆ rtnl_link_can_freq()

int rtnl_link_can_freq | ( | struct rtnl_link * | link,
|  | uint32_t * | freq
| ) |  |

Get CAN base frequency.

Parameters

  link | Link object
  freq | frequency in Hz

Returns
  0 on success or a negative error code

Definition at line 397 of file can.c.

## ◆ rtnl_link_can_state()

int rtnl_link_can_state | ( | struct rtnl_link * | link,
|  | uint32_t * | state
| ) |  |

Get CAN state.

Parameters

  link | Link object
  state | CAN bus state

Returns
  0 on success or a negative error code

Definition at line 419 of file can.c.

## ◆ rtnl_link_can_berr_rx()

int rtnl_link_can_berr_rx | ( | struct rtnl_link * | link | ) |

Get CAN RX bus error count.

Parameters

  link | Link object

Returns
  RX bus error count on success or a negative error code

Definition at line 438 of file can.c.

## ◆ rtnl_link_can_berr_tx()

int rtnl_link_can_berr_tx | ( | struct rtnl_link * | link | ) |

Get CAN TX bus error count.

Parameters

  link | Link object

Returns
  TX bus error count on success or a negative error code

Definition at line 456 of file can.c.

## ◆ rtnl_link_can_berr()

int rtnl_link_can_berr | ( | struct rtnl_link * | link,
|  | struct can_berr_counter * | berr
| ) |  |

Get CAN bus error count.

Parameters

  link | Link object
  berr | Bus error count

Returns
  0 on success or a negative error code

Definition at line 475 of file can.c.

## ◆ rtnl_link_can_get_bt_const()

int rtnl_link_can_get_bt_const | ( | struct rtnl_link * | link,
|  | struct can_bittiming_const * | bt_const
| ) |  |

Get CAN harware-dependent bit-timing constant.

Parameters

  link | Link object
  bt_const | Bit-timing constant

Returns
  0 on success or a negative error code

Definition at line 498 of file can.c.

## ◆ rtnl_link_can_get_bittiming()

int rtnl_link_can_get_bittiming | ( | struct rtnl_link * | link,
|  | struct can_bittiming * | bit_timing
| ) |  |

Get CAN device bit-timing.

Parameters

  link | Link object
  bit_timing | CAN bit-timing

Returns
  0 on success or a negative error code

Definition at line 522 of file can.c.

## ◆ rtnl_link_can_set_bittiming()

int rtnl_link_can_set_bittiming | ( | struct rtnl_link * | link,
|  | struct can_bittiming * | bit_timing
| ) |  |

Set CAN device bit-timing.

Parameters

  link | Link object
  bit_timing | CAN bit-timing

Returns
  0 on success or a negative error code

Definition at line 546 of file can.c.

## ◆ rtnl_link_can_get_bitrate()

int rtnl_link_can_get_bitrate | ( | struct rtnl_link * | link,
|  | uint32_t * | bitrate
| ) |  |

Get CAN device bit-timing.

Parameters

  link | Link object
  bitrate | CAN bitrate

Returns
  0 on success or a negative error code

Definition at line 568 of file can.c.

## ◆ rtnl_link_can_set_bitrate()

int rtnl_link_can_set_bitrate | ( | struct rtnl_link * | link,
|  | uint32_t | bitrate
| ) |  |

Set CAN device bit-rate.

Parameters

  link | Link object
  bitrate | CAN bitrate

Returns
  0 on success or a negative error code

Definition at line 591 of file can.c.

## ◆ rtnl_link_can_get_sample_point()

int rtnl_link_can_get_sample_point | ( | struct rtnl_link * | link,
|  | uint32_t * | sp
| ) |  |

Get CAN device sample point.

Parameters

  link | Link object
  sp | CAN sample point

Returns
  0 on success or a negative error code

Definition at line 610 of file can.c.

## ◆ rtnl_link_can_set_sample_point()

int rtnl_link_can_set_sample_point | ( | struct rtnl_link * | link,
|  | uint32_t | sp
| ) |  |

Set CAN device sample point.

Parameters

  link | Link object
  sp | CAN sample point

Returns
  0 on success or a negative error code

Definition at line 633 of file can.c.

## ◆ rtnl_link_can_get_restart_ms()

int rtnl_link_can_get_restart_ms | ( | struct rtnl_link * | link,
|  | uint32_t * | interval
| ) |  |

Get CAN device restart intervall.

Parameters

  link | Link object
  interval | Restart intervall in ms

Returns
  0 on success or a negative error code

Definition at line 652 of file can.c.

## ◆ rtnl_link_can_set_restart_ms()

int rtnl_link_can_set_restart_ms | ( | struct rtnl_link * | link,
|  | uint32_t | interval
| ) |  |

Set CAN device restart intervall.

Parameters

  link | Link object
  interval | Restart intervall in ms

Returns
  0 on success or a negative error code

Definition at line 675 of file can.c.

## ◆ rtnl_link_can_get_ctrlmode()

int rtnl_link_can_get_ctrlmode | ( | struct rtnl_link * | link,
|  | uint32_t * | ctrlmode
| ) |  |

Get CAN control mode.

Parameters

  link | Link object
  ctrlmode | CAN control mode

Returns
  0 on success or a negative error code

Definition at line 694 of file can.c.

## ◆ rtnl_link_can_set_ctrlmode()

int rtnl_link_can_set_ctrlmode | ( | struct rtnl_link * | link,
|  | uint32_t | ctrlmode
| ) |  |

Set a CAN Control Mode.

Parameters

  link | Link object
  ctrlmode | CAN control mode

Returns
  0 on success or a negative error code

Definition at line 717 of file can.c.

## ◆ rtnl_link_can_unset_ctrlmode()

int rtnl_link_can_unset_ctrlmode | ( | struct rtnl_link * | link,
|  | uint32_t | ctrlmode
| ) |  |

Unset a CAN Control Mode.

Parameters

  link | Link object
  ctrlmode | CAN control mode

Returns
  0 on success or a negative error code

Definition at line 737 of file can.c.