uaddr2taddr()--Translate a Universal Address


  Syntax

 #include <netdir.h>

 struct netbuf *uaddr2taddr(struct netconfig *nconf,
                            char *uaddr);

  Service Program Name: QZNFTRPC

  Default Public Authority: *USE

  Threadsafe: No

The uaddr2taddr() function translates a transport-independent (universal) address to a transport-specific (local) address (netbuf structure).


Parameters

nconf  (Input) 
The transport for which the address is valid.

uaddr  (Input) 
The address to be translated to the netbuf structure.

Authorities

No authorization is required.


Return Value

netbuf structure uaddr2taddr() was successful.
NULL uaddr2taddr() was not successful. The nd_errno (defined in <netdir.h>) is set to indicate the error.


Error Conditions

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.


Error Messages

Message ID Error Message Text
CPF9872 E Program or service program &1 in library &2 ended. Reason code &3.


Usage Notes

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.


Example

The following example shows how uaddr2taddr() is used.

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.

#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;
}



API introduced: V4R2

[ Back to top | Remote Procedure Call (RPC) APIs | APIs by category ]