netdir_options()--Access Transport-Specific Capabilities


  Syntax

 #include <netdir.h>

 int netdir_options(struct netconfig *nconf,
                    int option,
                    int fd,
                    char *point_to_args);

  Service Program Name: QZNFTRPC

  Default Public Authority: *USE

  Threadsafe: No

The netdir_options() function provides interfaces to transport-specific capabilities such as the broadcast address and reserved port facilities of TCP and UDP.


Parameters

nconf  (Input) 
A pointer to a netconfig structure that specifies a transport.

option  (Input) 
Specifies the transport-specific action to take. The following values may be used for option:


fd (Input)
The file descriptor that may or may not be used based on the option. The only value supported for this field is RPC_ANYFD. The file descriptor value is used only if the specified option is ND_SET_BROADCAST or ND_SET_RESERVEDPORT.

point_to_args (Input)
A pointer to the operation-specific data.

Authorities

The caller must have the *IOSYSCFG special authority to bind to a reserved port.


Return Value



Error Conditions

If netdir_options() is not successful, nd_errno indicates one of the following errors:



Error Messages



Example

The following example shows how netdir_options() is used.

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

#include <netdir.h>
#include <rpc/rpc_com.h>   /* for RPC_ANYFD definition */

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

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

  /* Get a netconfig structure from the netconfig file */
  if ((nconf = getnetconfig(handlep)) == (struct netconf *)NULL)
  {
     printf("Unable to obtain a netconfig structure\n");
  }

  /* Set the protocol specific negotiation for broadcast */
  if (netdir_options(nconf, ND_SET_BROADCAST, RPC_ANYFD, NULL))
  {
     printf("Error setting the broadcasting option\n");
  }

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



API introduced: V4R2

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