/*
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it would be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement
* or the like. Any license provided herein, whether implied or
* otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
*
* Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
* Mountain View, CA 94043, or:
*
* http://www.sgi.com
*
* For further information regarding this notice, see:
*
* http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
/*
* gcs_server.h
*
* what's in this file?
*/
#ifndef GCS_SERVER_H
#define GCS_SERVER_H
#ident "$Id: gcs_server.h,v 1.1 2000/08/31 19:16:32 vasa Exp $"
#include <suite_gcs.h> /* Test suite include. */
#include <ci_security.h>
typedef struct gcs_ver {
int32_t version_major;
int32_t version_minor;
} gcs_ver_t;
typedef struct gcd_err {
ci_err_t gcd_errno;
int32_t unix_errno;
} gcd_err_t;
/* state of the message in the 2-phase protocol */
typedef enum {
GCSSTATE_INITIATE,
GCSSTATE_PROPOSAL,
GCSSTATE_COMMIT
} msg_st_t;
/* Any message consists of message header and message_body.
* The message header is of type of message_hdr_t.
* The message body can be membrship_msg_t or ....
*/
typedef struct msg_hdr {
ci_security_elems_t security_hdr; /* Used in cluster security. */
ci_instid_t sender_instid;
ci_instid_t dest_instid;
msg_type_t msg_type; /* NEWGCD|MEMBERSHIP|CLIENT|ADMIN */
size_t msg_size; /* sizeof message body */
msg_st_t msg_state; /* COMMIT|PROPOSAL|INITIATE */
int32_t msg_groupid;
int32_t msg_seqno;
int32_t group_msg_seqno;
gcs_ver_t msg_version;
int32_t msg_ltime;
int32_t incarnation; /* sender gcd's incarnation number. */
uint64_t cms_seqno; /* seqno of a CMS node membership msg,
used in GCSMSG_DOWN_MEMBERSHIP. */
} msg_hdr_t;
#define MSG_HDR_SIZE sizeof(msg_hdr_t)
/* server side membership data structures */
typedef struct membership {
int32_t group_id; /* == -1, entry not used */
int32_t num_instances;
ci_instid_t inst_ids[MAX_INSTANCES];
} membership_t;
typedef struct membr_msg {
int32_t num_instid;
/* INSTANCE_FAILURE|INSTANCE_UNREGISTER |INSTANCE_JOIN|
INSTANCE_UNKNOWN
*/
membr_chng_t cause;
/* there can be MAX_INSTANCES per group */
ci_instid_t ids[MAX_INSTANCES];
} membr_msg_t;
typedef struct membr_msg membr_diff_t;
typedef struct membership_msg{
membership_t membr;
membr_diff_t diff;
} mbrship_msg_t;
/* end of server side membership data structs */
typedef struct admin_msg {
gcs_admin_action_t admin_type; /* SHUTDOWN|FREEZE */
int32_t admin_size;
union {
gcs_group_params_t group_params; /* tunable params */
gcs_groupid_t group_id;
g_stimulus_t stimulus;
} admin_data;
} admin_msg_t;
typedef struct admin_reply_msg {
gcs_admin_action_t admin_type; /* SHUTDOWN|FREEZE */
int32_t reply_size;
ci_err_t error; /* unable to give a reply - incorrect query */
union {
g_state_t response[MAX_GROUPS];
gcs_info_t info;
gcs_group_local_info_t group_local;
gcs_group_global_info_t group_global;/* info for a group */
gcs_group_params_t group_params; /* tunable params */
} admin_data;
} admin_reply_msg_t;
typedef gcs_params_t gcs_query_msg_t;
typedef gcs_params_t gcs_query_reply_msg_t;
typedef struct register_msg {
int32_t num_instid;
membr_chng_t cause; /* INSTANCE_JOIN */
ci_instid_t inst_id;
} register_msg_t;
typedef struct register_reply_msg {
int32_t status; /* SUCCESS|FAILURE */
ci_instid_t inst_id;
size_t max_msg_size;
gcd_err_t register_err;
membership_t grp_mbrs;
} register_reply_msg_t;
typedef union gcs_client_msg {
register_msg_t reg_msg;
gcs_query_msg_t query_msg;
} gcs_client_msg_t;
typedef struct unregister_msg {
int32_t num_instid;
membr_chng_t cause; /* INSTANCE_UNREGISTER */
ci_instid_t inst_id;
} unregister_msg_t;
typedef struct unregister_reply_msg {
ci_instid_t inst_id;
int32_t status; /* SUCCESS|FAILURE */
gcd_err_t register_err;
} unregister_reply_msg_t;
/* Initial registration mmap file */
#define GCS_IPC_FILE "ipc"
/* instid of any of the daemons is 0. */
#define GCD_INSTID 0
/* Connection status in gcca conn_status */
typedef enum {
GCSATTACHED,
GCSDETACHED,
GCSFREEZE,
GCSSHUTDOWN,
GCSERROR
} conn_stat_t;
#define SUCCESS 0
#define FAILURE 1
/* macros */
#define MSG_TYPE(msg) ((msg_hdr_t *)msg)->msg_type
#define MSG_STATE(msg) ((msg_hdr_t *)msg)->msg_state
#endif /* GCS_SERVER_H */
#ifdef PATS_STUFF
typedef struct conn_req_t {
int32_t shm_id;
int32_t group_id;
int32_t inst_id;
int32_t shm_size;
char mmap_file[GCD_MAX_MMAP_NAMELEN];
} conn_req_t;
typedef struct conn_rsp_t {
int32_t return_code;
} conn_rsp_t;
typedef struct comm_buf_t {
ci_instid_t global_inst_id;
int32_t conn_updown;
__uint64_t next_heartbeat_time;
__uint64_t curr_time;
} comm_buf_t;
typedef struct ipc_anchor_t {
char *shm_addr;
int32_t shm_id;
int32_t shm_size;
int32_t cl_s;
int32_t group_id;
ci_instid_t global_inst_id;
char mmap_file[GCD_MAX_MMAP_NAMELEN];
} ipc_anchor_t;
#endif /* pat's stuff */