endnetconfig()--Release the Pointer in the Netconfig File


  Syntax

 #include <netconfig.h>

 int endnetconfig (void *);

  Service Program Name: QZNFTRPC

  Default Public Authority: *USE


  Threadsafe: No


The endnetconfig() function releases the pointer to the records stored in the netconfig file.


Parameters

void pointer (Input) 
A void pointer that is set by a call to the setnetconfig() function.

Authorities

No authorization is required.


Return Value

0 endnetconfig() was successful. The pointer to the netconfig structure in the netconfig file is released. This function is always successful.


Error Conditions

When an exception occurs, endnetconfig() is trying to free the handle to the /etc/netconfig file. If endnetconfig() is not successful, errno indicates the following error.

[EUNKNOWN] Unknown system state.

The operation failed because of an unknown system state. See any messages in the job log and correct any errors that are indicated. Then retry the operation.



Error Messages

Message ID Error Message Text
CPF3CF2 E Error(s) occurred during running of &1 API.
CPF9872 E Program or service program &1 in library &2 ended. Reason code &3.


Usage Notes

endnetconfig() API must be used to release the pointer to the netconfig structure obtained by a call to the setnetconfig() API.


Example

See Code disclaimer information for information pertaining to code examples.

The following example shows how endnetconfig() is used:

#include <netconfig.h>

main()
{
 void *handlep;
 struct netconfig *nconf;

 /* Initialize the network selection mechanism */
 if ((handlep = setnetconfig()) == (void *)NULL)
 {
   exit(1);
 }

 /* Loop through the transport providers */
 while ((nconf = getnetconfig(handlep)) != (struct netconfig *) NULL)
 {
    /* Print out the information associated with the */
    /* transport providers described in the          */
    /* "netconfig" structure.                        */
    printf("Transport provider name: %s\n", nconf->nc_netid);
    switch(nconf->nc_semantics)
    {
       case NC_TPI_CLTS:
          printf("Transport type name: TPI_CLTS\n");
          break;
       case NC_TPI_COTS:
          printf("Transport type name: TPI_COTS\n");
          break;
       case NC_TPI_COTS_ORD:
          printf("Transport type name: TPI_COTS_ORD\n");
          break;
       default:
          break;
    }
    switch(nconf->nc_flag)
    {
       case 0:
          printf("Transport flag name: N\n");
          break;
       case 1:
          printf("Transport flag name: V\n");
          break;
       default:
          break;
    }
    printf("Transport family name: %s\n", nconf->nc_protofmly);
    printf("Transport protocol name: %s\n", nconf->nc_proto);
 }

 /*Release the netconfig handle allocated by setnetconfig() */
 endnetconfig(handlep);
}



API introduced: V4R2
Top | Remote Procedure Call (RPC) APIs | APIs by category