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:

ND_SET_BROADCAST Set the transport for broadcast if supported.
ND_SET_RESERVEDPORT Let the application bind to a reserved port if allowed by the transport.
ND_CHECK_RESERVEDPORT Verify that an address corresponds to a reserved port if the transport supports reserved ports.
ND_MERGEADDR Transform a locally meaningful address into an address that the client host can connect to.

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

0 netdir_options() was successful.
-1 netdir_options() was not successful. The nd_errno global variable (defined in <netdir.h>) is set to indicate the error.


Error Conditions

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

[ND_ACCESS] The user does not have permission to use the specified address.
[ND_BADARG] Bad argument passed.

A file descriptor that was not valid was passed to the API.

[ND_FAILCTRL] Control operation failed.
[ND_NO_ADDRESS] Bad address.
[ND_NOCONVERT] Conversion error. One or more characters could not be converted from the source CCSID to the target CCSID.
[ND_NOCTRL] The function was used in the wrong sequence.

An incorrect option was specified.

[ND_NO_DATA] Incorret amount of data.
[ND_NOHOST] The host that was specified by the host name was not found.
[ND_NOMEM] Not enough memory left.
[ND_NO_RECOVERY] An unrecoverable error has occurred.
[ND_OPEN] File could not be opened.
[ND_SYSTEM] A damaged object was encountered. The damaged object cannot be used.

The system detected an address that was not valid.

[ND_TRY_AGAIN] The local server did not receive a response from an authoritative server. An attempt at a later time may succeed.


Error Messages

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


Example

See Code disclaimer information for information pertaining to code examples.

The following example shows how netdir_options() is used:

#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
Top | Remote Procedure Call (RPC) APIs | APIs by category