INtime SDK Help
getprotoent (legacy networking)
INtime Help

The getprotobyname( ), getprotobynumber( ), setprotoent( ), getprotoent( ), and endprotoent( ) functions return an entry from the PROTOSFILE (protocols) database file.

You can access this database file via the INtime Configuration utility:

  1. Start>Programs>INtime>INtime Configuration
  2. Select your node in Node Management.
  3. Click the Advanced tab.
  4. Ensure you are in the CLIB section. The database file displays in the listbox.

Parameters

Syntax
#include <netdb.h>
struct protoent *getprotobyname(name)
    char *name;
struct protoent *getprotobynumber(proto)
    int proto;
void setprotoent(stayopen)
    int stayopen;
struct protoent *getprotoent( )
void endprotoent( )  

Remarks

All returned information is contained in a static area, so it must be copied if it is to be saved. Only Internet protocols are understood.

A specific entry can be retrieved by the protocol name with getprotobyname( ), or by its number with getprotobynumber( ). Both functions sequentially search the database for the specified entry. The protocol number used in the getprotobynumber( ) call should be in host order.

To retrieve a sequential series of protocol entries, it is more efficient to use the setprotoent( ), getprotoent( ), and endprotoent( ) functions. You must pair the calls to setprotoent( ) and endprotoent( ).

The setprotoent( ) function opens or rewinds (sets the file pointer to 0) the protocols database.

If passed a 0 value for the argument stayopen, setprotoent( ) opens the :config:protocols file. Subsequent calls to the getprotoent( ) function return the next entry in the protocols database until end of file, opening it if necessary. The endprotoent( ) function closes the database.

If passed a non-zero value for the argument stayopen, setprotoent( ) rewinds the :config:protocols file or opens it, if it is not already open. Subsequent calls to the getprotoent( ) function return the next entry in the protocols database until end of file, opening it if necessary. The protocols database remains open until the application executes exit( ). Calling endprotoent( ) does not close the database.

The returned protocol entry has this structure:

struct protoent {
    char * p_name;
    char ** p_aliases;
    unsigned long  p_proto 
}; 

Where:

p_name
The official name of the protocol.
p_aliases
A list of alternate names for the protocol. The list is terminated by a null string.
p_proto
The protocol number in host byte order.

Return Values

A null pointer is returned by getprotobynumber( ), getprotobyname( ), and getprotoent( ) on an EOF or on an error.

Requirements

Versions Defined in Include Link to
INtime 3.1 intime/rt/include/netdb.h net.db.h netiff3m.lib
See Also