Gate — C Library Procedures
NAME
Gate_ByDesc, Gate_ByInetAddr, Gate_ByNetAddr, Gate_End, Gate_Next, Gate_SetFile, Gate_Start − return information about network gateways.
SYNOPSIS
#include <gate.h>
Gate_Entry ∗
Gate_ByDesc(desc)
Gate_Entry ∗
Gate_ByInetAddr(inetAddr)
Gate_Entry ∗
Gate_ByNetAddr(addrPtr)
int
Gate_SetFile(fileName)
int
Gate_Start()
Gate_Entry ∗
Gate_Next()
void
Gate_End()
ARGUMENTS
char ∗desc (in) Description of the gateway for which information is desired.
Net_Address ∗addrPtr (in) The local network address of the gateway for which information is desired.
Net_InetAddress inetAddr (in) The internet address of the gateway for which information is desired.
char ∗fileName (in) The name of a gateway description file.
DESCRIPTION
These functions are used to access the database of network gateways.
A Gate_Entry structure is defined as follows: typedef struct Gate_Entry { char ∗desc; /∗ Description of gateway ∗/ Net_Address netAddr; /∗ Physical address. ∗/ Net_InetAddress inetAddr; /∗ Internet address. ∗/ } Gate_Entry; The Gate_Entry structures returned by the routines are statically allocated and may change on the next call to any Gate_ procedure. Be sure to copy out any information you need before calling a Gate_ procedure again.
Gate_ByDesc() returns a Gate_Entry based on the description (name) of the gateway.
Gate_ByNetAddr() returns the Gate_Entry for the gateway with the given local-area-network address.
Gate_ByInetAddr() returns the Gate_Entry for the gateway with the given internet address.
Gate_SetFile() specifies a different gateway information file to use (the file normally used is /etc/gateway).
Gate_Start() opens the current gateway-description file (if it isn’t already open), while Gate_End() closes it. The Gate_By... procedures automatically call Gate_Start.
Gate_Next() may be used to step through the current gateway-description file. The gateway-description file must have been opened using Gate_Start() or one of the Gate_By functions.
DIAGNOSTICS
Gate_SetFile() and Gate_Start() return zero if all went well. Otherwise they return -1 and the errno variable contains additional information about what error occurred. Gate_Next() returns NULL on end-of-file. Gate_ByDesc(), Gate_ByNetAddr() and Gate_ByInetAddr() return NULL if the given gateway could not be found.
FILES
/etc/gatewayThe default gateway-description file.
KEYWORDS
internet, local net, gateway
Sprite version 1.0 — June 04, 1992