DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

gettos(SLIB)


gettos: endtosent, gettosbyname, gettosent, parsetos, settosent -- get network Type Of Service information

Syntax

cc ... -lsocket

#include <netdb.h>
#include <errno.h>

int endtosent()

struct tosent * gettosbyname (name, proto) const char *name; const char *proto;

struct tosent *gettosent ()

int parsetos (name, proto) char *name, *proto;

void settosent (stayopen) int stayopen

Description

The gettosbyname and gettosent routines each return a pointer to an object describing a Type Of Service (TOS) entry. The information in the TOS entry is obtained from the file /etc/iptos . The following structure describes a Type Of Service entry:
struct  tosent {
     char     *t_name;       /* name */
     char    **t_aliases;    /* alias list */
     char     *t_proto;      /* protocol */
     int       t_tos;        /* Type Of Service bits */
};

The members of this structure are as follows:


t_name
Official name of the Type Of Service.

t_aliases
Zero-terminated array of alternative names for the Type Of Service.

t_proto
Type of the address being returned; the only address types currently supported are AF_INET and AF_OSI.

t_tos
The actual TOS bits for this entry.

The settosent routine opens and rewinds the /etc/iptos file. If the stayopen flag is nonzero, successive calls to gettosbyname will not close and reopen the /etc/iptos file.

The endtosent routine closes the /etc/iptos file.

The gettosbyname routine fetches information for the Type Of Service with name (or alias) name for the protocol proto. If proto is NULL or the string * (a single asterisk), the gettosbyname routine fetches information for the first encountered Type Of Service with name name, regardless of protocol. The gettosbyname routine uses the settosent and endtosent routines, thereby opening and closing the file, if the stayopen flag is 0.

The gettosent routine returns the next entry in the /etc/iptos database, opening the file if necessary.

The parsetos routine returns the actual t_tos TOS value from the tosent structure for the specified ``name'' and ``proto'' fields, as returned by gettosbyname. If the gettosbyname routine does not find an appropriate tosent value, the parsetos routine returns the presumed numeric value specified in the string name.

Files

/etc/iptos

Return values

The gettosbyname routine returns a null pointer (0) at end-of-file or when an error occurs. When the null pointer is returned at end-of-file, this indicates that gettosbyname did not find the specified name or address in the file.

The parsetos routine returns the actual Type Of Service value, or returns -1 and sets errno if it detects an error. If errno is set to EINVAL, no TOS entry for the name name was found, and name was not a numeric string. If errno is set to ERANGE, the specified TOS value is outside the legal range of TOS values (0 to 255).

Limitations

All information is contained in a static area that must be copied if it is to be saved.

See also

iptos(SFF)
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003