/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* 61haes_r714 src/43haes/inc/cluster/clinfo.H 1.7                        */
/*                                                                        */
/* Licensed Materials - Property of IBM                                   */
/*                                                                        */
/* Restricted Materials of IBM                                            */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 1990,2011              */
/* All Rights Reserved                                                    */
/*                                                                        */
/* US Government Users Restricted Rights - Use, duplication or            */
/* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.      */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
// @(#)76	1.7  src/43haes/inc/cluster/clinfo.H, hacmp.clinclude, 61haes_r714 11/28/11 14:52:53
//
//   COMPONENT_NAME: INCCLUSTER include file for clinfo.C
//
//   FUNCTIONS: none
//
//   ORIGINS: 27
//
//

#ifndef CLINFOCPP_H
#define CLINFOCPP_H 1

#include <sys/types.h>
#include <netinet/in.h>
#include <netdb.h>
#include <sys/socket.h>
#include "clinfo.h"

typedef int CL_clusterid;
class CL_clustername {public: char name[CL_MAXNAMELEN]; };

class CL_nodename {public: char name[CL_MAXNAMELEN]; };
typedef int CL_nodeid;

typedef int CL_ifid;
class CL_ifname {public: char name[CL_MAXNAMELEN]; };
typedef struct sockaddr_in CL_ifaddr;
typedef struct sockaddr_storage CL_ifaddr6;
class CL_route {
	public:
	CL_ifaddr localaddr;
	CL_ifaddr remoteaddr;
};
class CL_route6 {
	public:
	CL_ifaddr6 localaddr;
	CL_ifaddr6 remoteaddr;
};

class CL_groupname {public: char name[CL_MAXNAMELEN]; };
class CL_user_policy_name {public: char name[CL_MAXNAMELEN]; };
typedef int CL_groupid;

typedef enum cls_state CL_state;
typedef enum cls_substate CL_substate;
typedef enum cl_rg_policies CL_rg_policies;
typedef enum cl_resource_states CL_resource_states;
typedef int CL_status;

class CL_cluster;
class CL_node;
class CL_group;

//
// Class containing information relating to an interface.
// 
class CL_netif  {
	public:
	CL_clusterid cli_clusterid;	// Cluster Id
	CL_nodeid cli_nodeid;		// Cluster node Id
	CL_nodename cli_nodename;	// Cluster node name
	CL_ifid cli_interfaceid;	// Cluster Node Interface Id
	CL_state cli_state;		// Cluster Node Interface State
	CL_ifname cli_name;		// Cluster Node Interface Name
	CL_ifaddr cli_addr;		// Cluster Node Interface IP Address
	CL_node *cli_pnode;		// pointer to parent Node object
	CL_ifaddr6 cli_addr6;	// Cluster Node Interface IP Address

	CL_clusterid CL_getclusterid(CL_status&);
	CL_clusterid CL_getclusterid6(CL_status&);
	CL_ifaddr CL_getifaddr(CL_status&); 
	CL_ifaddr6 CL_getifaddr6(CL_status &s);
	CL_ifname CL_getifname(CL_status&);
	CL_ifname CL_getifname6(CL_status &);
	CL_ifaddr CL_getnodeaddr(CL_status&);
	CL_ifaddr6 CL_getnodeaddr6(CL_status&);
	CL_nodename CL_getnodenamebyif(CL_status&);
	CL_nodename CL_getnodenamebyif6(CL_status &);
	CL_status CL_isavail();
	CL_status CL_isavail6();
	CL_netif& operator=(const struct cl_netif&);
};


//
//   Class containing information relating to a node.
//
class CL_node  {
	public:
	CL_clusterid cln_clusterid;	// Cluster Id
	CL_nodeid cln_nodeid;	        // Cluster node id - used internally
	CL_nodename cln_nodename;	// Cluster node name
	CL_state cln_state;		// Cluster Node State
	int cln_nif;			// Cluster Node Number of Interfaces
	CL_netif *cln_if;	        // Cluster Node interfaces
	CL_cluster *cln_pcluster;	// pointer to parent cluster object

	CL_route CL_bestroute(CL_status&);
	CL_route6 CL_bestroute6(CL_status&);
	CL_node CL_getinfo(CL_status&);
	CL_status CL_isavail();
	
	CL_node& operator=(const struct cl_node&);
};


//
//   Class containing information relating to a cluster.
//
class CL_cluster  {
	public:
	CL_clusterid clc_clusterid;	// Cluster Id
	CL_state clc_state;		// Cluster State
	CL_substate clc_substate;	// Cluster Substate
	CL_nodename clc_primary;	// Cluster Primary Node
	CL_clustername clc_name;	// Cluster Name
	CL_node *clc_node;		// pointer to child node array
	CL_group *clc_group;		// pointer to child resource group array

	int CL_getallinfo(CL_node*, CL_status&);
	int CL_getgroupinfo(CL_group*, CL_status&);
	CL_clusterid CL_getclusterid(CL_status&);
	CL_cluster CL_getinfo(CL_status&);
	CL_status CL_getprimary(CL_status&);
	CL_status CL_isavail();
	CL_cluster& operator=(const struct cl_cluster&);
};

//
//   Class containing information relating to a resource group.
//
class CL_group  {
	public:
        CL_clusterid clg_clusterid;     // Cluster Id
        CL_groupid clg_group_id;    	// Resource Group Id
        CL_groupname clg_name;     	// Resource group name

        /* The following field is deprecated in PowerHA SystemMirror 5.2 and will not be
         * used. The data field itself is not removed from the data
         * structures to maintain the backword compatibility */
	    CL_rg_policies clg_policy;	 // Resource Group Policy
	
	
		CL_rg_policies clg_startup_policy; 
		CL_rg_policies clg_fallover_policy;
		CL_rg_policies clg_fallback_policy;
    
		CL_rg_policies clg_site_policy; // Resource Group site policy
		CL_user_policy_name clg_user_policy_name; // User defined policy 
		int clg_num_nodes;
		int clg_node_ids[MAXNODES];	// Node ids in this group
		CL_resource_states clg_node_states[MAXNODES]; //and their state
		CL_cluster *cln_pcluster;	// pointer to parent cluster object
	
        CL_group CL_getinfo(CL_status&);
        CL_group& operator=(const struct cl_group&);
};

//
// these functions do not operate on objects,
// so they are not member fucntions.
//

// getallinfo returns info about all clusters
int CL_getallinfo(CL_cluster *, CL_status&);
// getlocalid returns info about the machine it is running on.
CL_node CL_getlocalid(CL_status&);

#endif /* !CLINFOCPP_H */