Frame Relay Library Documentation
Introduction
Network Lookup Overview
Host Lookup Overview
Frame Reception Overview
Functions
Example
Multiplexing DLCIs Example
Error Codes
Tags
Copyright © 1997 The Software Group Limited
Introduction
The Frame Relay library provides a comprehensive application program
interface to allow transmission and reception of data frames within
the context of the Frame Relay protocol. The library is based on a
concept called Tags which it uses to obtain parameters for some
functions. Tags should always be passed in pairs: the tag itself and
its value. (An exception to this is the last tag, which should ALWAYS
be TAG_END!) The first of the pair is a manifest constant defined in
the Frame Relay library header file libfr.h. The second is
the tag dependent parameter.
Whenever a function specifies that it accepts a TAG LIST, a
variable length argument list of the above described tag pairs is
expected to be passed to it. A variation on this is to pass a pointer
to the first element of an array of TAG structures to the ...tags()
variant of the function.
An Example:
FCALLT *fcallt;
int rc, netid = 0;
char *buf = "Hello World";
fcallt = fr_open(netid, FT_DLCI, 222, TAG_END);
rc = fr_write(fcallt,
FT_BUFFER, buf,
FT_BUFLEN, strlen(buf),
TAG_END);
Alternatively using tag arrays:
FCALLT *fcallt;
int netid = 0;
TAGS opentags[] = {{FT_DLCI, 222}, {TAG_END, 0}};
fcallt = fr_opentags(netid, &opentags[0]);
This example obtains a handle for DLCI 222 on Network ID 0, and then
writes "Hello World" on this PVC. Notice that hard-coding
the value of netid and DLCI is not usually a good idea. The host file
access functions exist in order to read a remote host's information
such as on which network ID and DLCI it exists. This way the
frelhosts
file may change but the program will not have to be recompiled.
A Network ID, or netid, specifies which board & link on which an
action is to take place.
Most functions will return 0 for success or -1 for failure.
Error handling is done by looking at the value of the
variable frerrno. fr_error()
or fr_errorstr() may be called to
translate this error value into words.
[ Functions | Contents |
Tags | Errors ]
Overview of Network Lookup Functions
The Frame Relay library requires that a Netid be used to identify a
particular board and link combination. The following group of
functions enable access to the database which contains the Netid
information.
Before using fr_getnetent, the
function fr_setnetent must be
called which allocates necessary resources and enables the library to
access the configuration database. At this
point fr_getnetent
can be used to scan through the list of Frame Relay netids in the
system. An optional filter can be specified
using fr_setfilter
to limit or increase the types of Netids returned by
fr_getnetent.
To release the resources allocated by
fr_setnetent,
call fr_endnetent.
The functions fr_getnetbynetid
and fr_getnetbyname use the
above functions to search through the configuration database to
locate the desired Netid. These functions do not require the calling
application to use fr_setnetent or
fr_endnetent.
Host File Lookup
The frhostent structure is defined in libfr.h It contains the
name of the host, the DLCI, the network ID, as well as flags
specifying special options for the host.
All host file access functions will return a pointer to a static area
which will be overwritten by the next call to a host file access
function.
The functions to enumerate hosts in the frelhosts file are:
fr_sethostent
to initialize file access, fr_gethostent
to retrieve one host from the file, and
fr_endhostent
to terminate file access. Functions to search for a specific host
are: fr_gethostbyaddr to
retrieve a frhostent structure associated with a given DLCI and
Network ID, and fr_gethostbyname
to retrieve a frhostent structure associated with a logical host name.
Frame Reception Status Function Overview
The library has two mechanisms to determine the availability of data
frames on one or more circuits.
If only one circuit is to be monitored, then using
fr_look
is the simplest method. However, this approach does not easily scale
when 2 or more circuits require monitoring.
The recommended method for multi-circuit applications is to use the
fr_lookxxxx series of functions. This set of functions is used to
manipulate and monitor a list of circuits.
fr_lookinit
initializes the list, fr_lookadd
and fr_lookdel
manipulate list entries, fr_looksel
queries the list for available data frames and
fr_lookclose
frees the list.
Frame Relay Library Functions
The following routines are contained within the Frame Relay library:
- fr_open
- Open frame relay connection
- fr_close
- Close frame relay connection
- fr_read
- Read data from a frame relay circuit
- fr_write
- Write data to a frame relay circuit
- fr_look
- Check for frames
- fr_lookinit
- Initialize the selection list
- fr_looksel
- Check for datagrams on multiple links
- fr_lookadd
- Add an FCALLT to the selection list
- fr_lookclose
- Close/Free the selection list
- fr_isactive
- Check if a PVC is active
These functions manipulate the packetnets database which
stores network IDs and their network types (protocols) for each
communications link available on the system.
- fr_setnetent
- Start Network file lookup operations
- fr_endnetent
- Stop Network file lookup operations
- fr_getnetent
- Get Network entry
- fr_getnetbynetid
- Lookup Network by Network ID
- fr_getnetbyname
- Lookup Network by Name
- fr_setfilter
- Sets the Network type filter for the Network Lookup Functions.
These functions manipulate the frelhosts file which stores
frame relay host names and their associated DLCIs and Network IDs.
- fr_sethostent
- Start Hosts file lookup operations
- fr_endhostent
- Stop Hosts file lookup operations
- fr_gethostent
- Get Hosts entry
- fr_gethostbyaddr
- Lookup Hosts by Address (DLCI & Netid)
- fr_gethostbyname
- Lookup Hosts by Name
- fr_error
- Print Error Information
- fr_errorstr
- Copy Error Information into a buffer
- fr_getopts
- Obtain Global Tags
- fr_setopts
- Set Global Tags
- fr_logmsg
- Log Message to a file or stderr
- fr_getdevtype
- Obtain Physical device type
- fr_setuservalue
- Set the value associated with a FCALLT
- fr_getuservalue
- Get the value associated with a FCALLT
- fr_findtag
- Find Tag given Tag list
Macros
ct is a pointer to a valid FCALLT structure as returned by
fr_open().
- FR_FD(ct)
- file descriptor for FCALLT
- FR_DEVNAME(ct)
- device name for this call
- FR_DLCI(ct)
- Data link connection identifier
- FR_NETID(ct)
- Network ID for this call
- FR_ISINIT(ct)
- Is the FCALLT structure initialized?
[ Functions | Contents |
Tags | Errors ]
Example Program
/***********************************************************************
* Module Name: libtest.c
*
* Description:
* Sends a string NUMPACKETS times over a frame relay link
***********************************************************************/
#include <stdio.h>
#include "libfr.h"
#define NUMPACKETS100
main(int argc, char **argv)
{
FCALLT *ct;
int i, netid = 0;
char *buf = "This is the string being sent across the frame relay link";
if (argc > 1)
netid = atoi(argv[1]);
/*
* Prior to any frame relay activity, obtain a handle for operating
* the virtual circuit.
*/
if (!(ct = fr_open(netid, FT_DLCI, 222, TAG_END)))
{
fr_error("test");
exit(1);
}
/*
* Send the same string to the remote machine NUMPACKETS times
*/
for (i = 0; i < NUMPACKETS; i ++)
{
if (fr_write(ct, FT_BUFFER, buf,
FT_BUFLEN, strlen(buf),
TAG_END) < 0)
{
fr_error("test");
break;
}
}
/*
* Now we're done with frame relay. Close and exit.
*/
fr_close(ct);
exit(0);
}
[ Functions | Contents
| Tags | Errors ]
Example Program for Multiplexed DLCIs
/***********************************************************************
* Module Name: libmtest.c
*
* Description:
* Sends a string NUMPACKETS times on 50 DLCIs
***********************************************************************/
#include <stdio.h>
#include "libfr.h"
#define START_DLCI200
#define END_DLCI250
main(int argc, char **argv)
{
FCALLT *ct;
int dlci, netid = 0;
char *outbuf = "This is the string being sent across the frame relay link";
char buf[1600];
if (argc > 1)
netid = atoi(argv[1]);
/*
* Prior to any frame relay activity, obtain a handle for operating on.
*/
if (!(ct = fr_open(netid,
FT_DLCI, VFT_MULTI_DLCI,
TAG_END)))
{
fr_error("test");
exit(1);
}
/*
* Send the same string to the 50 remote DLCIs
*/
for (dlci = START_DLCI; dlci < END_DLCI; dlci ++)
{
if (fr_write(ct, FT_BUFFER, outbuf,
FT_BUFLEN, strlen(outbuf),
FT_DLCI, dlci,
TAG_END) < 0)
{
fr_error("test");
break;
}
}
/*
* Read frames from the network until an error occurs
*/
while (1)
{
if (fr_read(ct, FT_BUFFER, buf,
FT_BUFLEN, sizeof(buf),
FT_DLCI, &dlci,
TAG_END) < 0)
{
fr_error("test");
break;
}
printf("Received frame on DLCI: %d = %s\n", dlci, buf);
}
/*
* Now we're done with frame relay. Close and exit.
*/
fr_close(ct);
exit(0);
}
[ Functions | Contents
| Tags | Errors ]
Frame Relay Library Error Codes
The following is a list of error codes which frerrno can take. If
frerrno is set to FRSYSERR check errno for more details.
fr_error()
will print out the error message associated with both frame relay
library errors and system errors. Output will be written to the file
associated with the FT_LOGFILE file. The default is to write error
information to stderr.
- FRSYSERR
- System Error Message; check errno
- FRBADMSG
- Unexpected Message from Driver
- FRBADERRMSG
- Unknown Error Message
- FROUTSTATE
- Driver received message Out of State
- FRUSERDATA
- Bad User Data
- FROPTERR
- Option error
- FRFILEFMT
- file format is wrong
- FRBADFCALLT
- Bad FCALLT Structure
- FRBADBUFFER
- Bad Buffer specified
- FRBADNETID
- Bad Network ID
- FRNOTFOUND
- File not found
- FRBADDLCI
- Bad DLCI
- FRBADMODE
- Bad Connection Mode
- FRBADINIT
- Bad Physical Initialization
- FRUNSUPPORTED
- Service known but not supported
[ Functions | Contents |
Tags | Errors ]
Frame Relay Library Tags
This is a list of currently supported tags and an explanation of
their meaning.
Special Tags:
- TAG_END
- Signifies end of Tag List
- TAG_DONE
- Synonym for TAG_END
- TAG_IGNORE
- Ignore this tag and its value
Global tags:
(can be passed to any function expecting tags)
- FT_VERBOSE
- Comment on progress (to stdout if available)
- FT_OUTERR
- FILE *ptr for error messages
- FT_LOGFILE
- Log file to use (defaults to stderr)
- FT_BLOCK
- Blocking call?
Function Specific Tags:
- FT_DEVICE
- Device name - Not Usually required
- FT_NETNAME
- Network Name
- FT_BUFFER
- Pointer to Buffer
- FT_BUFLEN
- Size of Buffer
- FT_DLCI
- Data Link Connection Identifier
- FT_FLAGS
- Flags to pass to open()
[ Functions | Contents
| Tags | Errors ]
General Functions
fr_open
- Function Prototype:
- FCALLT *fr_open(int netid, TAG LIST);
- FCALLT *fr_opentags(int netid, TAGS *tags)
- Description:
- Open up a frame relay connection.
- This call will set up the association between a FCALLT and a
specific DLCI or set of DLCIs and the Network ID. netid must be valid
or this call will fail.
- To multiplex DLCIs on one FCALLT call this function with the tag
pair (FT_DLCI, VFT_MULTI_DLCI). Subsequent reads and writes may then
specify the FT_DLCI tag to retrieve the DLCI of the received frame or
set the DLCI of an outgoing frame respectively.
- Tags recognized:
- FT_DLCI
- FT_NETNAME
- FT_FLAGS
- all tags recognized by fr_setopts
- Arguments:
- netid - Network ID to access
- TAG LIST - tag pair list ending with TAG_END
- tags - pointer to TAGS list
- Returns:
- A pointer to a FCALLT structure - on success
- NULL - on failure
- Possible Errors:
- FRSYSERR
- FRBADNETID
- FRBADDLCI
- FRBADMODE
- FRBADPRIM
- See Also:
- fr_close
- fr_read
- fr_write
- fr_setopts
[ Functions | Contents
| Tags | Errors ]
fr_close
- Function Prototype:
- void fr_close(FCALLT *ct)
- Description:
- Closes down the FCALLT associated with a given DLCI and network
ID. Closes the file descriptor associated with a specific call.
- Frees all internally allocated memory for a specific call.
- After this call ct should no longer be considered a valid pointer.
- Arguments:
- ct - pointer to FCALLT structure
- Returns:
- NONE
- See Also:
- fr_open
[ Functions | Contents
| Tags | Errors ]
fr_read
- Function Prototype:
- int fr_read(FCALLT *ct, TAG LIST);
- int fr_readtags(FCALLT *ct, TAGS *tags)
- Description:
- Receive characters from a frame relay connection.
- The function expects a buffer big enough to hold the largest
frame. If the frame is larger than the buffer, this buffer is
returned full, and the next fr_read will return the next bytes of the
frame. This function returns the number of bytes in the received frame.
- It is a good idea to check the frerrno
variable for more information when a -1 is returned. This function
will wait for FT_MAXTRIES (default 20) EAGAIN errors and then return
-1. It sleeps 1 second for each retry.
- To check for interrupts (i.e. EINTR check if
frerrno == FRSYSERR and errno == EINTR):
- On a multiplexed FCALLT the tag FT_DLCI with a pointer to an
integer will retrieve the DLCI of the incoming frame. Omitting the
FT_DLCI tag on multiplexed FCALLTs will set an error of FRBADDLCI.
- Tags recognized:
- FT_BUFFER
- FT_BUFLEN
- FT_DLCI
- FT_MAXTRIES
- all tags recognized by fr_setopts
- Arguments:
- ct - pointer to FCALLT structure
- TAG LIST - tag pair list ending with TAG_END
- tags - pointer to TAGS list
- Returns:
- number of characters read - on success
- -1 - on failure
- Possible Errors:
- FRBADBUFFER
- FRSYSERR
- FRBADDLCI
- See Also:
- fr_open
- fr_write
- fr_setopts
[ Functions | Contents
| Tags | Errors ]
fr_write
- Function Prototype:
- int fr_write(FCALLT *ct, TAG LIST)
- int fr_writetags(FCALLT *ct, TAGS *tags);
- Description:
- Send 1 frame of data over an established frame relay connection.
- This function returns the number of bytes written and it is the
user's responsibility to handle the condition in which this count
does not equal the buffer length.
- A good way to accomplish this would be to look at
the frerrno
global variable and decide on a proper action.
- This function will sleep one second after receiving EAGAIN and
then try again for FT_MAXTRIES (default 20) times.
- On a multiplexed FCALLT the tag FT_DLCI with an integer will set
the DLCI of the outgoing frame. Including the FT_DLCI on non
multiplexed FCALLTs has no effect. Omitting this tag on multiplexed
FCALLTs will return an error of FRBADDLCI.
- Tags recognized:
- FT_BUFFER
- FT_BUFLEN
- FT_DLCI
- FT_MAXTRIES
- all tags recognized by fr_setopts
- Arguments:
- ct - pointer to FCALLT structure
- TAG LIST - tag pair list ending with TAG_END
- tags - pointer to TAGS list
- Returns:
- Number of bytes written - on success
- -1 - on failure
- Possible Errors:
- FRBADBUFFER
- FRSYSERR
- FRUNDELIVERED
- FRUSERDATA
- FRBADDLCI
- See Also:
- fr_open
- fr_read
- fr_setopts
[ Functions | Contents
| Tags | Errors ]
fr_lookinit
- Function Prototype:
- fr_lookent *fr_lookinit(int maxdlcis);
- Description:
- Initializes the selection mechanism for file descriptors.
Currently the limit for the number of file descriptors to listen on
is imposed by the operating system to be FRMAXLOOKFDS as defined in
libfr.h.
If maxdlcis is specified to be more than FRMAXLOOKFDS the call will
succeed, but still only FRMAXLOOKFDS file descriptors are allowed.
The pointer returned by this function must be used in all the other
"look" functions expecting a fr_lookent.
- Arguments:
- maxdlcis - maximum number of dlcis (< FRMAXLOOKFDS)
- Returns:
- fr_lookent pointer on success
- NULL - on failure (out of memory)
- See Also:
- fr_lookadd
- fr_lookdel
- fr_looksel
- fr_lookclose
[ Functions | Contents
| Tags | Errors ]
fr_lookadd
- Function Prototype:
- int fr_lookadd(fr_lookent *look, FCALLT *ct);
- Description:
- Add the file descriptor associated with ct to the selection list
contained in look.
- Arguments:
- look - pointer to fr_lookent structure
- ct - pointer to FCALLT to add
- Returns:
- 0 - on success
- -1 - on failure
- See Also:
- fr_lookinit
- fr_lookdel
- fr_look
- fr_looksel
- fr_lookclose
[ Functions | Contents
| Tags | Errors ]
fr_lookdel
- Function Prototype:
- int fr_lookdel(fr_lookent *look, CALLT *ct);
- Description:
- Remove the file descriptor associated with ct from the selection
list contained in look.
- Arguments:
- look - pointer to fr_lookent structure
- ct - pointer to FCALLT to delete
- Returns:
- 0 - on success
- -1 - on failure
- See Also:
- fr_lookinit
- fr_lookadd
- fr_look
- fr_looksel
- fr_lookclose
[ Functions | Contents
| Tags | Errors ]
fr_looksel
- Function Prototype:
- FCALLT *fr_looksel(fr_lookent *look, int tmout);
- Description:
- Checks for availability of datagrams for the DLCIs in the
selection list specified through fr_lookadds.
- Arguments:
- look - pointer to fr_lookent structure
- tmout - millisecs to wait (use -1 for infinity, 0 for no wait)
- Returns:
- ct - pointer to FCALLT if there is a datagram to be read on the
file descriptor associated with this FCALLT
- NULL - nothing to read, or time-out
- See Also:
- fr_lookadd
- fr_lookdel
- fr_looksel
- fr_lookclose
[ Functions | Contents
| Tags | Errors ]
fr_lookclose
- Function Prototype:
- FCALLT *fr_lookclose(fr_lookent *look);
- Description:
- Closes the selection mechanism for look.
- Arguments:
- look - pointer to fr_lookent structure
- Returns:
- NONE
- See Also:
- fr_lookinit
- fr_lookadd
- fr_lookdel
- fr_looksel
[ Functions | Contents
| Tags | Errors ]
fr_look
- Function Prototype:
- int fr_look(FCALLT *ct, int tmout);
- Description:
- Checks for availability of datagrams for the DLCI associated with
ct.
- Arguments:
- ct - pointer to FCALLT structure
- tmout - millisecs to wait (use -1 for infinity, 0 for no wait)
- Returns:
- 1 - if there is a datagram to be read
- 0 - nothing to read
- See Also:
- fr_looksel
[ Functions | Contents
| Tags | Errors ]
fr_isactive
- Function Prototype:
- int fr_isactive(FCALLT *ct, TAG LIST);
- int fr_isactivetags(FCALLT *ct, TAGS *tags);
- Description:
- Finds out if a PVC is active or not. The ct must be open, but the
DLCI to check can be any DLCI. If the FT_DLCI tag is not specified
then the DLCI associated with ct is queried. If the FT_NETID or
FT_NETNAME is not specified then the function assumes the Network ID
associated with ct. Also note that if no LMI protocol is specified
this function always returns 1. If the DLCI for this ct is a
multiplexed DLCI (ie. opened with VFT_DLCI_MULTI then FT_DLCI must
always be specified.
- Arguments:
- ct - pointer to FCALLT structure
- TAG LIST - tag pair list ending with TAG_END
- tags - pointer to TAGS list
- Returns:
- 1 - if the DLCI is active
- 0 - if the DLCI is not active
- Tags recognized:
- FT_DLCI
- FT_NETNAME
- FT_NETID
- all tags recognized by fr_setopts
- Possible Errors:
- FRBADNETID
- FRBADDLCI
- FRSYSERR
- See Also:
- fr_open
[ Functions | Contents
| Tags | Errors ]
Network Lookup Functions
fr_setnetent
- Function Prototype:
- void fr_setnetent(void)
- Description:
- Initialize packetnets database for reading. This is only
required for fr_getnetent(), but not for
other fr_getnetby... functions. After fr_getnetent() returns NULL, a
call to fr_endnetent() is required.
- So a typical use would be to enumerate all the available network
IDs (ie. communications links):
- frnetent *net;
- fr_setnetent();
- while (net = fr_getnetent())
- {
- process this link
- }
- fr_endnetent();
- Arguments:
- NONE
- Returns:
- NONE
- See Also:
- fr_getnetent
- fr_endnetent
[ Functions | Contents
| Tags | Errors ]
fr_endnetent
- Function Prototype:
- void fr_endnetent(void)
- Description:
- Ends packetnets database operations.
- Arguments:
- NONE
- Returns:
- NONE
- See Also:
- fr_setnetent
- fr_getnetent
[ Functions | Contents
| Tags | Errors ]
fr_getnetent
- Function Prototype:
- frnetent *fr_getnetent(void)
- Description:
- Obtains next frnetent entry from the packetnets database.
- Arguments:
- NONE
- Returns:
- pointer to frnetent - on success
- NULL - on failure
- See Also:
- fr_setnetent
- fr_endnetent
- fr_setfilter
[ Functions | Contents
| Tags | Errors ]
fr_getnetbyname
- Function Prototype:
- frnetent *fr_getnetbyname(char *name)
- Description:
- Looks up a packetnets entry given a name.
- Arguments:
- name - network name to find
- Returns:
- pointer to frnetent - on success
- NULL - on failure
- See Also:
- fr_getnetbynetid
[ Functions | Contents
| Tags | Errors ]
fr_getnetbynetid
- Function Prototype:
- frnetent *fr_getnetbynetid(int netid)
- Description:
- Looks up a packetnets entry given a network ID.
- Arguments:
- netid - network ID to find
- Returns:
- pointer to frnetent - on success
- NULL - on failure
- See Also:
- fr_getnetbyname
[ Functions | Contents
| Tags | Errors ]
fr_setfilter
- Function Prototype:
- void fr_setfilter(int typemask)
- Description:
- Sets a network type filter for all accesses to the packetnets
database so that the functions fr_getnetent(),
fr_getnetby...() will return only the
specified network types. The default type for the fr_getnet..()
functions is NETFREL_TYPE. fr_open resets the
default type to NETFREL_TYPE.
- Arguments:
- typemask - Mask for Network types. ie. NETFREL_TYPE | NETX25_TYPE
- NETALL_TYPE will select all network types.
- Returns:
- NONE
- See Also:
- fr_getnetent
- fr_getnetbyname
- fr_getnetbynetid
[ Functions | Contents
| Tags | Errors ]
Host Lookup Functions
fr_sethostent
- Function Prototype:
- void fr_sethostent(void)
- Description:
- Initialized Frame Relay hosts file for reading.
- Arguments:
- NONE
- Returns:
- NONE
- See Also:
- fr_endhostent
- fr_gethostent
[ Functions | Contents |
Tags | Errors ]
fr_endhostent
- Function Prototype:
- void fr_endhostent(void)
- Description:
- Ends Frame Relay hosts file operations.
- Arguments:
- NONE
- Returns:
- NONE
- See Also:
- fr_sethostent
- fr_gethostent
[ Functions | Contents |
Tags | Errors ]
fr_gethostent
- Function Prototype:
- frhostent *fr_gethostent(void)
- Description:
- Obtains next frhostent entry from the Frame Relay hosts file.
- Arguments:
- NONE
- Returns:
- pointer to frhostent - on success
- NULL - on failure
- Possible Errors:
- FRNOTFOUND
- FRFILEFMT
- See Also:
- fr_sethostent
- fr_endhostent
[ Functions | Contents
| Tags | Errors ]
fr_gethostbyname
- Function Prototype:
- frhostent *fr_gethostbyname(char *name)
- Description:
- Looks up a Frame Relay hosts entry given a name .
- Arguments:
- name - host name to find
- Returns:
- pointer to frhostent - on success
- NULL - on failure
- Possible Errors:
- FRNOTFOUND
- FRFILEFMT
- See Also:
- fr_gethostbyaddr
- fr_gethostent
[ Functions | Contents |
Tags | Errors ]
fr_gethostbyaddr
- Function Prototype:
- frhostent *fr_gethostbyaddr(unsigned int dlci, int netid)
- Description:
- Looks up a Frame Relay hosts entry given a DLCI and network ID .
- Arguments:
- dlci - DLCI to find
- netid - network ID to find
- Returns:
- pointer to frhostent - on success
- NULL - on failure
- Possible Errors:
- FRNOTFOUND
- FRFILEFMT
- See Also:
- fr_gethostbyname
- fr_gethostent
[ Functions | Contents
| Tags | Errors ]
Miscellaneous Functions
fr_logmsg
- Function Prototype:
- void fr_logmsg(char *format, ...)
- Description:
- Logs messages to standard error.
- Arguments:
- format - printf type format specifier
- Returns:
- NONE
[ Functions | Contents
| Tags | Errors ]
fr_setopts
- Function Prototype:
- int fr_setoptstags(FCALLT *ct, TAGS *tags)
- int fr_setopts(FCALLT *ct, TAG LIST)
- Description:
- Sets global Frame Relay library parameters.
- Any function using tags arguments will call this function.
- Tags recognized:
- FT_OUTERR
- FT_TIME-OUT
- FT_VERBOSE
- FT_LOGFILE
- Arguments:
- ct - pointer to FCALLT
- TAG LIST - tag pair list ending with TAG_END
- tags - pointer to TAGS list
- Returns:
- 0
- See Also:
- fr_getopts
[ Functions | Contents |
Tags | Errors ]
fr_getopts
- Function Prototype:
- int fr_getoptstags(FCALLT *ct, TAGS *tags)
- int fr_getopts(FCALLT *ct, TAG LIST)
- Description:
- Obtains the value of global Frame Relay library parameters or
parameters associated with a specific connection.
- Arguments:
- ct - pointer to FCALLT
- TAG LIST - tag pair list ending with TAG_END
- tags - pointer to TAGS list containing pointer to variables to
hold information requested.
- Tags recognized:
- FT_OUTERR
- FT_TIME-OUT
- FT_VERBOSE
- FT_LOGFILE
- Returns:
- 0
- See Also:
- fr_setopts
[ Functions | Contents
| Tags | Errors ]
fr_findtag
- Function Prototype:
- int fr_findtag(TAGS *tags, unsigned long item)
- Description:
- Finds the tag item in the tags array pointed to by tags.
- Arguments:
- tags - pointer to TAGS list
- item - item to find in tags
- Returns:
- Index of the required tag item in the tags list
- -1 - if not found.
[ Functions | Contents |
Tags | Errors ]
fr_error
- Function Prototype:
- void fr_error(char *errstring)
- Description:
- Prints error message associated with a Frame Relay Library Error.
- Output is much like perror().
- Also prints out the error string associated with a system error
(in errno.)
- Arguments:
- errstring - pointer to a string to print or NULL
- Returns:
- NONE
- See Also:
- fr_errorstr
[ Functions | Contents
| Tags | Errors ]
fr_errorstr
- Function Prototype:
- int fr_errorstr(char *buf, int buflen)
- Description:
- Copies the error message associated with a the current Frame
Relay library error in frerrno into buf.
- Arguments:
- buf - pointer to a string to hold the error message
- buflen - length of buf
- Returns:
- 0 - on success
- -1 - on failure (not enough room in buf)
- See Also:
- fr_error
[ Functions | Contents |
Tags | Errors ]
fr_geterror
- Function Prototype:
- int fr_geterror(void)
- Description:
- Retrieves the current library error code. If the result of this
call is FRSYSERR, a call to fr_getsyserror()
will retrieve the system error defined in errno.h.
- Arguments:
- NONE
- Returns:
- 0 - no error
- error code defined in libfr.h
- See Also:
- fr_error
- fr_errorstr
- fr_getsyserror
[ Functions | Contents |
Tags | Errors ]
fr_getsyserror
- Function Prototype:
- int fr_getsyserror(void)
- Description:
- Retrieves the current system error code.
- Arguments:
- NONE
- Returns:
- 0 - no error
- error code defined in errno.h
- See Also:
- fr_error
- fr_errorstr
- fr_geterror
[ Functions | Contents |
Tags | Errors ]
fr_getdevtype
- Function Prototype:
- int fr_getdevtype(int netid)
- Description:
- Get the type of physical device for Network netid.
- Arguments:
- netid - Network ID
- Returns:
- SGE, ARNET, etc. - declared in libfr.h
- 0- not found or not available
[ Functions | Contents |
Tags | Errors ]
fr_setuservalue
- Function Prototype:
- void fr_setuservalue(FCALLT *ct, unsigned long value)
- Description:
- Associate a value with a FCALLT. This value may be retrieved by
calling fr_getuservalue().
- Arguments:
- ct - pointer to FCALLT
-
- value - the value to associate with ct
- Returns:
- NONE
- See Also:
- fr_getuservalue
[ Functions | Contents |
Tags | Errors ]
fr_getuservalue
- Function Prototype:
- unsigned long fr_getuservalue(FCALLT *ct)
- Description:
- Retrieve the value associated with FCALLT, set with
fr_setuservalue().
- Arguments:
- ct - pointer to FCALLT
- Returns:
- NONE
- value - the value to associate with ct
- See Also:
- fr_setuservalue
[ Functions | Contents |
Tags | Errors ]