#include <netdir.h> struct netbuf *uaddr2taddr(struct netconfig *nconf, char *uaddr);
The uaddr2taddr() function translates a transport-independent (universal) address to a transport-specific (local) address (netbuf structure).
No authorization is required.
netbuf structure | uaddr2taddr() was successful. |
NULL | uaddr2taddr() was not successful. The nd_errno (defined in <netdir.h>) is set to indicate the error. |
If uaddr2taddr() is not successful, nd_errno usually indicates one of the following errors:
[ND_BADARG] | Bad argument passed. |
[ND_NOMEM] | Not enough memory left. |
[ND_NO_RECOVERY] | An unrecoverable error has occurred. |
[ND_SYSTEM] | A damaged object was encountered. The damaged object cannot be used. |
Message ID | Error Message Text |
---|---|
CPF9872 E | Program or service program &1 in library &2 ended. Reason code &3. |
uaddr2taddr() translates the universal address pointed to by addr and returns a pointer to a netbuf structure.
It is the caller's responsibility to free the returned netbuf structure when done using the netdir_free() function.
See Code disclaimer information for information pertaining to code examples.
The following example shows how uaddr2taddr() is used:
#include <netconfig.h> #include <netdir.h> Void sample (void) { void *handlep; struct netconfig *nconf; struct netbuf *netbufp; char universal_addr[24]; int i; /* Initialize the network selection mechanism */ if (handlep = setnetconfig()) == (void *)NULL) { exit(1); } /* Get the transport information */ if ((nconf = getnetconfig(handlep)) == (struct netconf *)NULL) { printf("Error in getting the transport information\n"E); exit(1); } memset(universal_addr,24,NULL); printf("EEnter the IP address appended by low and high order port numbers:\n"E); scanf(%s, universal_addr); /* Convert the input universal address to its local representation */ if ((netbufp = uaddr2taddr(nconf, universal_addr)) == (struct netbuf *) NULL) { printf("Euaddr2taddr() failed\n"E); } /*Free the netbuf structure returned from uaddr2taddr() */ netdir_free((char *)netbufp, ND_ADDR); /* Release the netconfig handle allocated by setnetconfig() */ endnetconfig(handlep); return; }
Top | Remote Procedure Call (RPC) APIs | APIs by category |