Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
UROUTE(3)	       FreeBSD Library Functions Manual		     UROUTE(3)

NAME
     uroute -- networking route	objects

LIBRARY
     PDEL Library (libpdel, -lpdel)

SYNOPSIS
     #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);

DESCRIPTION
     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 ta-
     ble.

     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 ar-
     ray itself	is allocated with typed_mem(3) type mtype, and the caller is
     responsible for eventually	freeing	it (as well as destroying the indi-
     vidudal uroute objects).

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

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

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

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

AUTHORS
     Archie Cobbs <archie@freebsd.org>

FreeBSD	13.0			April 22, 2002			  FreeBSD 13.0

NAME | LIBRARY | SYNOPSIS | DESCRIPTION | RETURN VALUES | SEE ALSO | HISTORY | AUTHORS

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=uroute&sektion=3&manpath=FreeBSD+13.0-RELEASE+and+Ports>

home | help