Initializes or reinitializes a network address. The storage for the network address structure is allocated by, and remains the responsibility of, the calling client.
#include <prnetdb.h> PRStatus PR_InitializeNetAddr( PRNetAddrValue val, PRUint16 port, PRNetAddr *addr);
The function has the following parameters:
valPR_IpAddrNull, PR_IpAddrAny, or PR_IpAddrLoopback.portaddrPRNetAddr structure to be manipulated.The function returns one of the following values:
PR_SUCCESS.PR_FAILURE. This may occur, for example, if the value of val is not within the ranges defined by PRNetAddrValue. You can retrieve the reason for the failure by calling PR_GetError.PR_InitializeNetAddr allows the assignment of special network address values and the port number, while also setting the state that indicates the version of the address being used.
The special network address values are identified by the enum PRNetAddrValue:
typedef enum PRNetAddrValue{
PR_IpAddrNull,
PR_IpAddrAny,
PR_IpAddrLoopback
} PRNetAddrValue;
The enum has the following enumerators:
PR_IpAddrNullPR_IpAddrAnyPR_INADDR_ANY to IP address. This wildcard value is typically used to establish a socket on which to listen for incoming connection requests.PR_IpAddrLoopbackPR_INADDR_LOOPBACK. A client can use this value to connect to itself without knowing the host's network address.