GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
UROUTE(3) FreeBSD Library Functions Manual UROUTE(3)

uroute
networking route objects

PDEL Library (libpdel, -lpdel)

#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
#include <pdel/net/uroute.h>

struct uroute *
uroute_create(const struct sockaddr *dest, const struct sockaddr *gateway, const struct sockaddr *netmask);

void
uroute_destroy(struct uroute **routep);

const struct sockaddr *
uroute_get_dest(struct uroute *route);

const struct sockaddr *
uroute_get_gateway(struct uroute *route);

const struct sockaddr *
uroute_get_netmask(struct uroute *route);

int
uroute_get_flags(struct uroute *route);

void
uroute_set_flags(struct uroute *route, int flags);

int
uroute_add(struct uroute *route);

int
uroute_delete(struct uroute *route);

struct uroute *
uroute_get(const struct sockaddr *dest);

int
uroute_get_all(struct uroute ***listp, const char *mtype);

void
uroute_print(struct uroute *route, FILE *fp);

These functions support uroute objects, used for representing kernel routes in user code. Each uroute instance is represented by a struct uroute.

uroute_create() creates a new uroute object using copies of the supplied dest, gateway, and netmask. The netmask should be NULL to specify a host route instead of a network route.

uroute_destroy() destroys the object pointed to by *routep. Upon return, *routep will be set to NULL. If *routep is already NULL when uroute_destroy() is invoked, nothing happens.

uroute_get_dest(), uroute_get_gateway(), and uroute_get_netmask() return the addresses associated with the route. Note that uroute_get_netmask() returns NULL to indicate that route is a host route.

uroute_get_flags() and uroute_set_flags() are used to access or modify the flags associated with the route; these flags are defined in the header file <net/route.h>. The only flag set for a newly created route is RTF_STATIC.

uroute_add() attempts to add the route to the kernel routing table.

uroute_delete() attempts to remove the route from the kernel routing table.

uroute_get() attempts to retrieve the route matching dest from the kernel routing table.

uroute_get_all() retrieves the entire kernel routing table. Zero or more uroute objects are constructed and pointed to by the elements of a newly allocated array of pointers. The length of the array is returned by uroute_get_all() and a pointer to the array is stored in *listp. The array itself is allocated with typed_mem(3) type mtype, and the caller is responsible for eventually freeing it (as well as destroying the individudal uroute objects).

uroute_print() prints out uroute to the stream fp for debugging purposes.

uroute_create(), uroute_add(), uroute_delete(), uroute_get(), and uroute_get_all() return -1 or NULL to indicate an error, with errno set appropriately.

if_util(3), libpdel(3), typed_mem(3), route_msg(3), route(4)

The PDEL library was developed at Packet Design, LLC. http://www.packetdesign.com/

Archie Cobbs ⟨archie@freebsd.org⟩
April 22, 2002 FreeBSD 13.1-RELEASE

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.