libnl: Utilities

libnl 3.10.0

Utilities
Routing Library (libnl-route) » Routing

## Routing Metrices Translations
char * | rtnl_route_metric2str (int metric, char *buf, size_t size)
int | rtnl_route_str2metric (const char *name)

## Routing Table Identifier Translations
int | rtnl_route_read_table_names (const char *path)
char * | rtnl_route_table2str (int table, char *buf, size_t size)
int | rtnl_route_str2table (const char *name)

## Routing Protocol Translations
int | rtnl_route_read_protocol_names (const char *path)
char * | rtnl_route_proto2str (int proto, char *buf, size_t size)
int | rtnl_route_str2proto (const char *name)

## Detailed Description

Routing Utility Functions

1) Translating Routing Table Names
  // libnl is only aware of the de facto standard routing table names.
  // Additional name <-> identifier associations have to be read in via
  // a configuration file, f.e. /etc/iproute2/rt_tables
  err = rtnl_route_read_table_names("/etc/iproute2/rt_tables");
  // Translating a table name to its idenfier
  int table = rtnl_route_str2table("main");
  // ... and the other way around.
  char buf[32];
  printf("Name: %s\n",
  rtnl_route_table2str(table, buf, sizeof(buf)));

## Function Documentation

## ◆ rtnl_route_read_table_names()

int rtnl_route_read_table_names | ( | const char * | path | ) |

Definition at line 69 of file route_utils.c.

## ◆ rtnl_route_table2str()

char * rtnl_route_table2str | ( | int | table,
|  | char * | buf,
|  | size_t | size )

Definition at line 76 of file route_utils.c.

## ◆ rtnl_route_str2table()

int rtnl_route_str2table | ( | const char * | name | ) |

Definition at line 81 of file route_utils.c.

## ◆ rtnl_route_read_protocol_names()

int rtnl_route_read_protocol_names | ( | const char * | path | ) |

Definition at line 115 of file route_utils.c.

## ◆ rtnl_route_proto2str()

char * rtnl_route_proto2str | ( | int | proto,
|  | char * | buf,
|  | size_t | size )

Definition at line 122 of file route_utils.c.

## ◆ rtnl_route_str2proto()

int rtnl_route_str2proto | ( | const char * | name | ) |

Definition at line 127 of file route_utils.c.

## ◆ rtnl_route_metric2str()

char * rtnl_route_metric2str | ( | int | metric,
|  | char * | buf,
|  | size_t | size )

Definition at line 155 of file route_utils.c.

## ◆ rtnl_route_str2metric()

int rtnl_route_str2metric | ( | const char * | name | ) |

Definition at line 161 of file route_utils.c.