z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


INET6ISSRCADDR

z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference
SC27-3660-00

Use the INET6ISSRCADDR command to indicate whether an input IPV6 socket address matches an address that is defined to the stack, which conforms to one or more input IPV6_ADDR_PREFERENCES flags.

A client or server program can use the INET6ISSRCADDR command when it strictly requires the IP addresses that it uses to have one or more specific attributes before allowing network activity. Such a program can perform the following actions:
  1. (Optional) Issue the SETSOCKOPT macro with option IPV6_ADDR_PREFERENCES to set source IP address selection preferences for the socket.
  2. Issue the BIND2ADDRSEL command to bind a socket to a local IP address. The BIND2ADDRSEL command attempts to assign a local IP address that matches the IPv6_ADDR_PREFERENCES flags that are specified with the SETSOCKOPT command, but does not guarantee that the local IP address that it selects satisfies all preferences.
  3. Issue the GETSOCKNAME command to obtain the local IP address that is bound to the socket.
  4. Issue the INET6ISSRCADDR command to verify whether the local IP address has the correct attributes.
The command returns a string that contains the return code and the result. The return code can be 0, a REXX socket API error number, or the REXX TCP/IP error number that is set by the socket command. The return code 0 indicates that the requested socket command was completed successfully and indicates one of the following results:
TRUE
The IP address is an address that is known to the TCP/IP stack and satisfies the preference flags.
FALSE
The IP address is an address known to the TCP/IP stack but does not satisfy the preference flags.

You can specify more than one IPV6_ADDR_PREFERENCES flags on this command. All flags must be satisfied for the result to be TRUE. Some IPV6_ADDR_PREFERENCES flags are contradictory. If you specify contradictory flags on a single command invocation, the result is FALSE.

Format

Read syntax diagramSkip visual syntax diagram
>>-SOCKET--(--"INET6ISSRCADDR"--,--name--,--flags--)-----------><

Parameters

name
The socket address that is to be tested.

name = "domain portid flowinfo ipaddress scopeid"

where:
  • The domain value must be the decimal number 19 or AF_INET6.
  • The portid value is not used by the INET6ISSRCADDR command.
    Requirement: You must specify a decimal numeral between 0 and 65535 for the portid value.
  • The flowinfo value is not used by the INET6ISSRCADDR command.
    Requirement: You must specify a decimal numeral between 0 and 2147483647 for the flowinfo value.
  • The ipaddress value is the IP address to be tested.
    Rule: You can specify an IPv6 address or an IPv4-mapped IPv6 address.
  • The scopeid value identifies the interfaces that are applicable for the scope of the address that is specified in the ipaddress field. For a link-local IP address, the scopeid field can specify a link index, which identifies a set of interfaces. For all other scopes, the scopeid field must be set to 0.
flags
A space-delimited string that contains one or more of the following values:
IPV6_PREFER_SRC_HOME
Tests whether the IP address is a home address. Any valid address that is known to the TCP/IP stack satisfies this flag.
IPV6_PREFER_SRC_COA
Tests whether the IP address is a care-of address. This type of address is not supported and the command always returns FALSE if this flag is specified.
IPV6_PREFER_SRC_PUBLIC
Tests whether the IP address is a public address.
IPV6_PREFER_SRC_TMP
Tests whether the IP address is a temporary address.
IPV6_PREFER_SRC_CGA
Tests whether the IP address is a cryptographically generated address. This type of address is not supported and the command always returns FALSE if this flag is specified.
IPV6_PREFER_SRC_NONCGA
Tests whether the IP address is not cryptographically generated. Any valid address that is known to the TCP/IP stack satisfies this flag.

Any flags specification that contains values other than 0 or the options listed above causes an EINVALIDRXSOCKETCALL error to be returned.

Tip: Some of these flags are contradictory. For example:
  • The flag IPV6_PREFER_SRC_HOME contradicts the flag IPV6_PREFER_SRC_COA.
  • The flag IPV6_PREFER_SRC_CGA contradicts the flag IPV6_PREFER_SRC_NONCGA.
  • The flag IPV6_PREFER_SRC_TMP contradicts the flags IPV6_PREFER_SRC_PUBLIC.
Result: If you specify contradictory flags on the macro, the result is FALSE.

Returned value

The command returns a string that contains the return code and the result. The return code can be 0, a REXX socket API error number, or the REXX TCP/IP error number that is set by the socket command. The return code 0 indicates that the requested socket command was completed successfully. The result is TRUE if the IP address is an address that is known to the TCP/IP stack and satisfies the preference flags, or FALSE if the IP address is an address that is known to the TCP/IP stack but does not satisfy the preference flags.

See Socket call error return codes for additional information about the numeric error codes that are returned by this command.

The following REXX TCP/IP error numbers can be returned:
  • 1 EPERM
  • 22 EINVAL
  • 47 EAFNOSUPPORT
  • 49 EADDRNOTAVAIL
The following REXX socket API error numbers can be returned:
  • 2001 EINVALIDRXSOCKETCALL
  • 2005 ESUBTASKNOTACTIVE
  • 006 ESOCKETNOTALLOCATED

LE C/C++ equivalent

short inet6_is_srcaddr(struct sockaddr_in6 *srcaddr, uint32_t flags); 

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014