IBM Books

Group Services Programming Guide and Reference

ha_gs_get_adapter_info subroutine

Purpose

ha_gs_get_adapter_info - Get the node number and the adapter interface name corresponding to a given IP address.

Library

GSAPI Thread-Safe Library (libha_gs_r.a)

GSAPI Library (not thread-safe) (libha_gs.a)

Syntax

#include <ha_gs.h>
#include <netinet/in.h>
 
ha_gs_rc_t ha_gs_get_adapter_info( ha_gs_adapter_info *adapter)               

Parameters

typedef union {
    struct in_addr      ip4;
    struct in6_addr     ip6;
} ha_gs_ip_addr;
         

where the following structures

struct in_addr {
        in_addr_t s_addr;        /* 32-bit IPv4 address, network byte ordered */
};
 
struct in6_addr{
        uint8_t   s6_addr[16];  /* 128-bit IPv6 address, network byte ordered */
};         

are defined by including the <netinet/in.h> header. in_addr_t in IPv4 address is normally uint32_t.

Here IPv6 is included for completeness. Only IPv4 is currently supported.

typedef struct {
    ha_gs_ip_addr       ip_addr;
        short      node_number;
        const char         *interface_name;
        ha_gs_provider_t               gs_member_id;      /* not used yet */
        const ha_gs_group_name_t       gs_group_name;     /* not used yet   */
} ha_gs_adapter_info;

Input
adapter->ip_addr, an input IP address parameter.

Output
adapter->node_number and adapter->interface_name which are the node number and the adapter interface name returned from this function call corresponding to the given IP address.

The other two parameters, gs_member_id and gs_group_name, are currently not used, and should not be referenced.

Description

This function gives the node number and the adapter interface name corresponding to a given IP address. When this function is called, the Group Services library will send back the node number and the adapter interface name corresponding to the given IP address, if the mapping is available to the caller. The function will return HA_GS_OK.

If the adapter information is not available yet, the function will return HA_GS_NULL_ADAPTER_INFO.

If the global adapter configuration is available, but the adapter information corresponding to the specified IP address is not found, it will return HA_GS_ADAPTER_INFO_NOT_FOUND.

If the library is not initialized yet, it will return HA_GS_NO_INIT.

If the library is not initialized well, it will return HA_GS_NOT_OK.

If the user passed a NULL pointer to the function, (fox example, adapter = NULL), the function also returns HA_GS_NOT_OK.

Before calling this function, the user must first call ha_gs_init() with a flag set as in the following description:

ha_gs_rc_t ha_gs_init(ha_gs_descriptor              *ha_gs_descriptor,    
                      const ha_gs_socket_ctrl       socket_options, 
                      const ha_gs_responsiveness_t  *responsiveness_control,  
                      const char                    *deactivate_script,         
                      ha_gs_responsiveness_cb_t     *responsiveness_callback, 
                      ha_gs_delayed_error_cb_t      *delayed_error_callback, 
                      ha_gs_query_cb_t              *query_callback)             
 typedef enum{
    HA_GS_SOCKET_NO_SIGNAL  = 0x00,
    HA_GS_SOCKET_SIGNAL   = 0x01,
    HA_GS_ENABLE_ADAPTER_INFO = 0x02
} ha_gs_socket_ctrl_t;          /* Socket Control */

If the adapter information is needed, HA_GS_ENABLE_ADAPTER_INFO must be OR'd in addition to the existing option HA_GS_SOCKET_NO_SIGNAL such as:

socket_options = HA_GS_SOCKET_NO_SIGNAL|HA_GS_ENABLE_ADAPTER_INFO
 
Note:
HA_GS_SOCKET_SIGNAL is obsolete and not supported.

When the GS daemon receives the ha_gs_init() call message, it will check this flag. If HA_GS_ENABLE_ADAPTER_INFO is set, it will send the adapter information table to the GSAPI library. Otherwise, the daemon will not send the table to the GSAPI library. This is to minimize the traffic between the daemon and the library.

Note:
In order to use this API function, the user must include the header file <netinet/in.h>. Also, the input IP address is network byte ordered.

Return Values

HA_GS_OK -- The function call is successful.

HA_GS_NOT_OK-- The library is not initialized well, or the user input a NULL pointer.

HA_GS_NO_INIT-- The library is not initialized yet. Call ha_gs_init() first.

HA_GS_NULL_ADAPTER_INFO-- The GS daemon has sent a NULL adapter table since there is no adapter configuration information available yet.

HA_GS_ADAPTER_INFO_NOT_FOUND-- The adapter information corresponding to the given IP address is not found in the current adapter table.

Asynchronous Errors

None.

Files

ha_gs.h

Prerequisite Information

Understanding Group Services.

Related Information

Subroutines: ha_gs_init, ha_gs_get_node_number.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]