Interface & Address Introspection

Interface & Address Vector Management.

Functions

bool trfValidRouteUpdate(PTRFInterface clientIf, char *address)

Mark an address in an interface list as valid and reachable.

Parameters:
  • addr – Address to mark

  • clientIf – Interface List

Returns:

True on success, False on failure

int trfRemoveInvalid(PTRFInterface ifs, PTRFInterface *out_ifs, int *n_ifs)

Remove invalid or unreachable addresses from an interface list.

Parameters:
  • ifs – PTRFInterface for client

  • out_ifs – new interface to return to client

  • n_ifs – Number of interfaces in the new list

Returns:

0 on success, negative error code on failure

void trfFreeAddrV(PTRFAddrV av)

Free an address vector.

Parameters:

av – Address vector to free

Returns:

no return value

PTRFAddrV trfSortAddrV(PTRFAddrV av)

Sort an address vector.

Parameters:

av – Address vector to sort

Returns:

int

int trfCreateAddrV(PTRFInterface src, PTRFInterface dest, PTRFAddrV *av_out)

Create an address vector list containing viable links between two interface lists.

Parameters:
  • src – Souce addresses

  • dest – Destination addresses

  • av_out – Output address vector list

Returns:

0 on success, -errno on failure

void trfFreeInterfaceList(PTRFInterface ifaces)

Free an interface list.

This call frees a linked list of struct TRFInterface, typically allocated using the trfGetInterfaceList() call.

Parameters:
  • ifaces – Interfaces list to free

  • ifaces – Interface list to free.

Returns:

no return value

int trfGetInterfaceList(PTRFInterface *list_out, uint32_t *length, uint64_t flags)

Create an interface list containing all interfaces on the system.

Parameters:
  • list_out – Output interface list

  • length – Output interface list length

  • flags – Flags used to limit interfaces returned

Returns:

0 on success, negative error code on failure

PTRFInterface trfSortInterfaceList(PTRFInterface list)

Sort an interface list.

Parameters:

list – Interface list

int trfGetFastestLink(PTRFAddrV av, PTRFAddrV *av_out)

Determine the fastest interface in the address vector.

Parameters:
  • av – Addess vector to search

  • av_out – Pointer to the node inside av containing the fastest interface

Returns:

0 on success, negative error code on failure

int trfGetLinkSpeed(char *ifname, int32_t *speed_out)

Get the link speed of an interface.

Parameters:
  • iface – Interface name

  • speed_out – Speed

Returns:

0 on success, negative error code on failure

static inline int trfGetInterfaceListLength(PTRFInterface list)

Get the length of an interface list.

Parameters:

list

Returns:

int