inet6_is_srcaddr()--Validate the Given Address Based on Address Selection Preferences


  BSD 4.3 Syntax

  #include <netinet/in.h>

 int16_t inet6_is_srcaddr(struct sockaddr_in6 *source_address,
                      uint32_t flags)

  Service Program Name: QSOSRV1IP6

  Default Public Authority: *USE

  Threadsafe: Yes



  UNIX 98 Compatible Syntax
  #define _XOPEN_SOURCE 520
  #include <netinet/in.h>

int16_t inet6_is_srcaddr(struct sockaddr_in6 *source_address,
                     uint32_t flags)

  Service Program Name: QSOSRV1IP6

  Default Public Authority: *USE

  Threadsafe: Yes


The inet6_is_srcaddr() function is used to determine if the specified address satisfies the address selection preference flags.

There are two versions of the API, as shown above. The base IBM i® API uses BSD 4.3 structures and syntax. The other uses syntax and structures compatible with the UNIX® 98 programming interface specifications. You can select the UNIX 98 compatible interface with the _XOPEN_SOURCE macro.


Parameters

source_address
(Input) A pointer to a buffer of type struct sockaddr_in6 that contains the source address to determine if it satisfies the address selection preference flags. The structure sockaddr_in6 is defined in <netinet/in.h>.
flags
(Input) The source address selection preference flags to be satisfied.

The valid source address selection preference flags are defined in <in.h>:

      #define IPV6_PREFER_SRC_HOME   0x00000001 /* Prefer Home addr    */
      #define IPV6_PREFER_SRC_COA    0x00000002 /* Prefer Care-of addr */
      #define IPV6_PREFER_SRC_TMP    0x00000004 /* Prefer Temp addr    */
      #define IPV6_PREFER_SRC_PUBLIC 0x00000008 /* Prefer Public addr  */
      #define IPV6_PREFER_SRC_CGA    0x00000010 /* Prefer CGA addr     */
      #define IPV6_PREFER_SRC_NONCGA 0x00000020 /* Prefer non-CGA addr */

Authorities


Return Value

inet6_is_srcaddr() returns an integer. Possible values are:


Error Conditions

When a inet6_is_srcaddr() fails, errno can be set to one of the following:



Error Messages



Usage Notes

  1. This API is only valid for an address family of AF_INET6.

    The BSD 4.3 structure is:

          typedef unsigned short sa_family_t;
          typedef unsigned short in_port_t;
    
          struct sockaddr_in6 {
             sa_family_t     sin6_family;
             in_port_t       sin6_port;
             uint32_t        sin6_flowinfo;
             struct in6_addr sin6_addr;
             uint32_t        sin6_scope_id;
          };
    

    The BSD 4.4/UNIX 98 compatible structure is:

          typedef uchar   sa_family_t;
          typedef unsigned short in_port_t;
    
          struct sockaddr_in6 {
             uint8_t         sin6_len;
             sa_family_t     sin6_family;
             in_port_t       sin6_port;
             uint32_t        sin6_flowinfo;
             struct in6_addr sin6_addr;
             uint32_t        sin6_scope_id;
          };
    

    The BSD 4.4 sin6_len field is the length of the address. The sin6_family is the address family (AF_INET6 in this case), sin6_port is the port number, and sin6_addr is the internet address. The sin6_flowinfo field contains two pieces of information: the traffic class and the flow label. Note: This field is currently not supported and should be set to zero for upward compatibility. The sin6_scope_id field identifies a set of interfaces as appropriate for the scope of the address carried in the sin6_addr field. Note: This field must be set if the address is link-local.

  2. When you develop in C-based languages and an application is compiled with the _XOPEN_SOURCE macro defined to the value 520 or greater, the inet6_is_srcaddr() API is mapped to qso_inet6_is_srcaddr98().

Related Information



API introduced: IBM® i 7.1

[ Back to top | UNIX-Type APIs | APIs by category ]