endprotoent(), getprotobyname(), getprotobynumber(), getprotoent(), setprotoent()

manipulate network protocol database 

Function


SYNOPSIS

#include <netdb.h>

void endprotoent();

struct protoent *getprotobyname(const char *name);

struct protoent *getprotobynumber(int proto);

struct protoent *getprotoent(void);

void setprotoent(int stayopen);


DESCRIPTION

The getprotoent(), getprotobyname() and getprotobynumber() functions each return a pointer to a protoent structure, the members of which contain the fields of an entry in the network protocol database, as follows:

p_name  

Official name of the protocol.

p_aliases  

A null-terminated array of alternate names.

p_proto  

The protocol number.

The getprotoent() function reads the next entry of the database, opening a connection to the database if necessary.

The getprotobyname() function searches the database and finds an entry which matches the specified protocol name, opening a connection to the database if necessary.

The getprotobynumber() function searches the database and finds an entry which matches the specified protocol number, opening a connection to the database if necessary.

The setprotoent() function opens a connection to the network host database, and sets the position of the next entry to the first entry. If its parameter is non-zero, the connection to the database is not closed after each call to getprotoent() (either directly, or indirectly through getprotobyname() or getprotobynumber()).

The endprotoent() function closes the connection to the database.


PARAMETERS

name 

Is the protocol name for the protocol whose entry is to be returned.

proto 

Is the protocol number for the protocol whose entry is to be returned.

stayopen 

When non-zero, the connection to the database is not closed after each call to getprotoent().


RETURN VALUES

If successful, getprotobyaddr(), getprotobyname() and getprotoent() return a pointer to the protoent structure described in the DESCRIPTION section. On failure, they return a null pointer.

The pointer that is returned points to a structure that is allocated by the NuTCRACKER Platform. The application must never attempt to modify this structure or to free any of its components. Furthermore, only one copy of this structure is allocated per thread; therefore, the application should copy any information it needs before issuing any other socket calls.


CONFORMANCE

UNIX 98


MULTITHREAD SAFETY LEVEL

endprotoent(), getprotoent(), setprotoent(): Unsafe.

getprotobyname(), getprotobynumber(): MT-Safe.


PORTING ISSUES

On 2012/8.1/2012R2/10/2016/2019, the protocols file (often truncated to protocol) is in the drivers/etc directory under the 2012/8.1/2012R2/10/2016/2019 system directory. The _NutQueryWinNetFileDir() function returns the path in which the network database files are located, regardless of platform.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
_NutQueryWinNetFileDir(), endhostent(), endnetent(), endservent(), gethostbyaddr(), gethostbyname(), gethostent(), getnetbyaddr(), getnetbyname(), getnetent(), getservbyname(), getservbyport(), getservent(), sethostent(), setnetent(), setservent()


PTC MKS Toolkit 10.3 Documentation Build 39.