/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/*                                                                        */
/*                                                                        */
/* Licensed Materials - Property of IBM                                   */
/*                                                                        */
/* Restricted Materials of IBM                                            */
/*                                                                        */
/* (C) COPYRIGHT International Business Machines Corp. 1996,2019          */
/* 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                                                     */
/*                                                         vi:set tabstop=4: */
/*===========================================================================*/
/*                                                                           */
/* Module Name:  ha_emapi_base.h                                             */
/*                                                                           */
/* Description:                                                              */
/*                                                                           */
/*     Interface definitions of the Event Manager API needed by              */
/* Event Manager API clients, the Event Manager API library, and the         */
/* Event Manager daemon.                                                     */
/*                                                                           */
/*     This file is formatted to be viewed with tab stops set to 4.          */
/*===========================================================================*/

/* sccsid = "@(#)42   1.28   src/rsct/pem/emcommon/ha_emapi_base.h, emcommon, rsct_rady, rady2035a 2/13/19 17:05:07" */

#ifndef _HA_EMAPI_BASE_H
#define _HA_EMAPI_BASE_H

#include <sys/time.h>
#include <ha_emcommon.h>

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */


/*---------------------------------------------------------------------------*/
/*  Event Manager API constants.                                             */
/*---------------------------------------------------------------------------*/

/*
 *  Event Manager Commands.
 */

#define HA_EM_CMD_REG		1	/* Register for events                       */
#define HA_EM_CMD_REG2		2	/* Register for events from both expressions */
#define HA_EM_CMD_UNREG		3	/* Unregister events                         */
#define HA_EM_CMD_QUERY		4	/* Query for information                     */

#define HA_EM_CMD_RERR		5	/* Returned for registration command errors  */
#define HA_EM_CMD_R2ERR		6	/* Returned for registration 2 command errors*/
#define HA_EM_CMD_QERR		7	/* Returned for query command errors         */

/*
 *  Event Manager Subcommands for the HA_EM_CMD_REG and HA_EM_CMD_REG2 commands.
 *  The HA_EM_SCMD_REVAL and HA_EM_SCMD_RACK subcommands may be bitwise OR'ed
 *  if both functions are desired.
 */

#define HA_EM_SCMD_REVAL	1	/* Evaluate expression at first observation  */
								/*    and return result as an event          */
#define HA_EM_SCMD_RACK		2	/* Return 0 error code if registration req   */
								/*    has no errors, as part of              */
								/*    HA_EM_CMD_RERR or HA_EM_CMD_R2ERR      */
								/*    response                               */

/*
 *  Event Manager Subcommands for the HA_EM_CMD_QUERY command. These are also
 *  returned with HA_EM_CMD_QERR to indicate the query subcommand that 
 *  resulted in errors.
 */

#define HA_EM_SCMD_QCUR		1	/* Query current resource variable values    */
#define HA_EM_SCMD_QDEF		2	/* Query for defined resource variables and  */
								/*     their default expressions             */
#define HA_EM_SCMD_QINST	3	/* Query for resource variable instances in  */
								/*     order to obtain their resource IDs    */
								/*     (the returned values are last known)  */

/*
 *  Event Manager Error Codes, returned in em_error of the various response
 *  structures. General error codes indicate the nature of the operation that
 *  resulted in the error. Specific error codes detail the actual error.
 */

#define HA_EM_RSP_EGEN_COMMAND	1	/* This general error code indicates an  */
									/* error was detected in the             */
									/* specification of a command            */
/*---------------------------------------------------------------------------*/
/*  Specific error codes associated with HA_EM_RSP_EGEN_COMMAND              */
/*---------------------------------------------------------------------------*/
#define HA_EM_RSP_ENOVARENT		1	/* The specified variable name does not  */
									/* exist in the EM data base             */
#define HA_EM_RSP_EEXPR			2	/* The specified expression could not be */
									/* correctly parsed. The expression      */
									/* parsing error is contained in the     */
									/* em_errinfo0 field of the              */
									/* ha_em_rpb_rerr structure; the         */
									/* position of the error within the      */
									/* expression is contained in the        */
									/* em_errinfo1 field of the              */
									/* ha_em_rpb_rerr structure.             */
#define HA_EM_RSP_ERAEXPR		3	/* The specified re-arm expression could */
									/* not be correctly parsed. The returned */
									/* value is encoded as for the           */
									/* HA_EM_RSP_EEXPR error.                */
#define HA_EM_RSP_ENODFLTEXPR	4	/* No expression was specified and no    */
									/* default expression is configured      */
#define HA_EM_RSP_ENORIDNAME	5	/* the specified resource ID was missing */
									/* a resource ID element name            */
#define HA_EM_RSP_ENORIDVALUE	6	/* the specified resource ID was missing */
									/* a resource ID element value           */
#define HA_EM_RSP_ERIDSYNTAX	7	/* the specified resource ID contained   */
									/* a syntax error.                       */
#define HA_EM_RSP_ERIDVALLENGTH	8	/* a resource ID value length was longer */
									/* including the terminating NULL, than  */
									/* HA_EM_RSRC_ID_ELEM_VALUE_LEN_MAX      */
#define HA_EM_RSP_EMISSINGRID	9	/* the specified resource ID was missing */
									/* a required element.                   */
#define HA_EM_RSP_EDUPRIDENT	10	/* the specified resource ID contained   */
									/* a duplicate element.                  */
#define HA_EM_RSP_ENORIDENT		11	/* the specified resource ID contained   */
									/* an element that is not defined for    */
									/* the specified variable.               */ 
#define HA_EM_RSP_EINVALEID		12	/* An invalid event ID was specified.    */
#define HA_EM_RSP_ECLASSMISMATCH	13	/* The specified class does not      */
										/* match the class defined for the   */
										/* specified variable.               */
#define HA_EM_RSP_ERIDMISMATCH	14	/* The specified resource ID does not    */
									/* match the resource ID defined for     */
									/* the specified variable(s).            */
#define HA_EM_RSP_EWCRMISMATCH	15	/* The class, if specified, and/or the   */
									/* resource ID, if specified, do not     */
									/* match the class and/or resource ID    */
									/* defined for any of the variables that */
									/* matched the specified wildcarded      */
									/* variable name.                        */
#define HA_EM_RSP_ENOCLASS		16	/* The specified class name does not     */
									/* exist in the EM data base             */
#define HA_EM_RSP_ERIDTOOLONG	17	/* The specified resource ID string is   */
									/* too long.                             */
#define HA_EM_RSP_EINVALNODENUM	18	/* A node number implied in a resource   */
									/* ID isn't within the range supported   */
									/* by the Event Manager                  */
#define HA_EM_RSP_EINVALRIDVAL	19	/* A resource ID value of type 'int' is  */
									/* invalid, i.e. less than 0, greater    */
									/* than 4096 or, if the second value in  */
									/* a value range, it is less than the    */
									/* first value in the range              */
#define HA_EM_RSP_EPRED			HA_EM_RSP_EEXPR			/* for compatibility */
#define HA_EM_RSP_ERAPRED		HA_EM_RSP_ERAEXPR		/* for compatibility */
#define HA_EM_RSP_ENODFLTPRED	HA_EM_RSP_ENODFLTEXPR	/* for compatibility */
#define HA_EM_RSP_ENOVECNAME	HA_EM_RSP_ENORIDNAME	/* for compatibility */
#define HA_EM_RSP_ENOVECVALUE	HA_EM_RSP_ENORIDVALUE	/* for compatibility */
#define HA_EM_RSP_EVECSYNTAX	HA_EM_RSP_ERIDSYNTAX	/* for compatibility */
#define HA_EM_RSP_EVECVALLENGTH	HA_EM_RSP_ERIDVALLENGTH	/* for compatibility */
#define HA_EM_RSP_EMISSINGVEC	HA_EM_RSP_EMISSINGRID	/* for compatibility */
#define HA_EM_RSP_EDUPVECENT	HA_EM_RSP_EDUPRIDENT	/* for compatibility */
#define HA_EM_RSP_ENOVECENT		HA_EM_RSP_ENORIDENT		/* for compatibility */
#define HA_EM_RSP_EVECMISMATCH	HA_EM_RSP_ERIDMISMATCH	/* for compatibility */
#define HA_EM_RSP_EWCVMISMATCH	HA_EM_RSP_EWCRMISMATCH	/* for compatibility */
#define HA_EM_RSP_EVECTOOLONG	HA_EM_RSP_ERIDTOOLONG	/* for compatibility */
#define HA_EM_RSP_EINVALVECVAL	HA_EM_RSP_EINVALRIDVAL	/* for compatibility */



#define HA_EM_RSP_EGEN_RESOURCE	2	/* This general error code indicates an  */
									/* error was due to the temporary        */
									/* unavailability of an internal Event   */
									/* Manager resource.                     */
/*---------------------------------------------------------------------------*/
/*  Specific error codes associated with HA_EM_RSP_EGEN_RESOURCE             */
/*---------------------------------------------------------------------------*/
#define HA_EM_RSP_EQNONE		1	/* No response could be generated for    */
									/* this individual query request.        */
#define HA_EM_RSP_EQCOMPLETE	2	/* The query is complete; all data was   */
									/* returned in previous message(es)      */
#define HA_EM_RSP_EINSTNOTAVAIL	3	/* Variable instance not available       */
#define HA_EM_RSP_EINSTSTALE	4	/* Variable instance is stale, i.e. the  */
									/* resource monitor supplying the        */
									/* instance has terminated unexpectedly. */
#define HA_EM_RSP_EDAEMONGONE	5	/* the Event Manager daemon supplying    */
									/* instances matching the resource ID    */
									/* has terminated.                       */
#define HA_EM_RSP_ESHMEM		6	/* Variable instance value cannot be     */
									/* obtained due to a shared memory error */



#define HA_EM_RSP_EGEN_RESMON	3	/* This general error code indicates an  */
									/* error resulted from starting or       */
									/* communicating with a resource monitor */
/*---------------------------------------------------------------------------*/
/*  Specific error codes associated with HA_EM_RSP_EGEN_RESMON               */
/*---------------------------------------------------------------------------*/
#define HA_EM_RSP_ERMLOCKSTATUS	1	/* Error in obtaining resource monitor   */
									/* lock status.                          */
#define HA_EM_RSP_ERMNOTRUNNING	2	/* a resource monitor is not running and */
									/* it cannot be started by Event Mgt     */
#define HA_EM_RSP_ENOSTARTRM	3	/* a resource monitor could not be       */
									/* started by Event Management           */
#define HA_EM_RSP_ENORMCONNECT	4	/* the Event Management daemon could not */
									/* connect to a resource monitor.        */



#define HA_EM_RSP_EGEN_EVALERR	4	/* This general error code indicates an  */
									/* error was detected in the evaluation  */
									/* of a expression                       */
/*---------------------------------------------------------------------------*/
/*  Specific error codes associated with HA_EM_RSP_EGEN_EVALERR are defined  */
/*  in ha_emcommon.h using names of the form HA_EM_EXPR_*.                   */
/*---------------------------------------------------------------------------*/



#define HA_EM_RSP_EGEN_SEC		5	/* This general error code indicates a   */
									/* security error was detected when      */
									/* starting/restarting a session.  An    */
									/* EMAPI client does not see these error */
									/* codes.  An EMAPI client sees security */
									/* errors through error codes returned   */
									/* by EMAPI routines.  Those codes are   */
									/* defined in ha_emapi.h                 */
/*---------------------------------------------------------------------------*/
/*  Specific error codes associated with HA_EM_RSP_EGEN_SEC                  */
/*---------------------------------------------------------------------------*/
#define HA_EM_RSP_ENODCECLIENT	1	/* DCE is not configured as a security   */
									/* method in the client but it is        */
									/* required by the daemon                */
#define HA_EM_RSP_ENODCEDAEMON	2	/* DCE is not configured as a security   */
									/* method in the daemon but it is        */
									/* required by the client                */
#define HA_EM_RSP_ENOAUTHENT	3	/* The client cannot be authenticated    */
#define HA_EM_RSP_ENOAUTHOR		4	/* The client is not authorized          */
#define HA_EM_RSP_ESECFUNC		5	/* Error detected in security function   */



/*---------------------------------------------------------------------------*/
/*  Event Manager API type and structure definitions.                        */
/*---------------------------------------------------------------------------*/

/*
 *  Event command group identifiers are of type ha_em_ecgid_t
 *  (Event Manager Event Command Group IDentifier).
 */

typedef unsigned int ha_em_ecgid_t;

/*
 *  Event identifiers are of type ha_em_eid_t (Event Manager Event IDentifier).
 */

typedef unsigned int ha_em_eid_t;

/*
 *  Query identifiers are of type ha_em_qid_t (Event Manager Query IDentifier).
 */

typedef unsigned int ha_em_qid_t;

/*
 *  One query request is made through a ha_em_rb_query
 *  (Event Manager Request Block: QUERY) structure.  This structure is
 *  included in the ha_em_res_blk union, defined in ha_emapi.h.
 */

struct ha_em_rb_query {
	char *			em_class;		/* input:  resource variable class name  */
	char *			em_name;		/* input:  resource variable name        */
	char *			em_rsrc_ID;		/* input:  resource ID                   */
};

struct ha_em_rb_query_32 {
	unsigned int	em_class;		/* input:  resource variable class name  */
	unsigned int	em_name;		/* input:  resource variable name        */
	unsigned int	em_rsrc_ID;		/* input:  resource ID                   */
};

/*
 *  Resource variables can have one of three types of values, signed long
 *  integer, float, or structured byte string.  The ha_em_val (Event Manager
 *  VALue) union reflects these possibilities.
 */

union ha_em_val {
	long	em_vall;				/* output: long integer value            */
	float	em_valf;				/* output: floating point value          */
	void	*em_valsbs;				/* output: structured byte string value  */
};

#ifdef __64BIT__
union ha_em_val_32 {
	int 			em_vall;				/* output: long integer value            */
	float	 		em_valf;				/* output: floating point value          */
	unsigned int	em_valsbs;				/* output: structured byte string value  */
};
#endif

/*
 *  Event Manager error codes consist of a general error code and a specific
 *  error code, encoded in the ha_em_errnum union.
 */

union ha_em_errnum {
	unsigned int	em_error_number;
	unsigned short	em_error_codes[2];
};

#define em_errnum	em_error.em_error_number		/* for quick tests       */
#define em_generr	em_error.em_error_codes[0]		/* general error code    */
#define em_specerr	em_error.em_error_codes[1]		/* specific error code   */

/*
 *  The occurrence of an event, or the unregistration of an event, is reported
 *  through a ha_em_rpb_event (Event Manager ResPonse Block: EVENT) structure.
 *  This structure is included in the ha_em_resp_blk union, defined later in
 *  this file.
 */

struct ha_em_rpb_event {
	union ha_em_errnum	em_error;		/* output: error number              */
	ha_em_eid_t			em_event_id;	/* output: event identifier          */
	unsigned long		em_event_flags;	/* output: event flags. See below    */
	struct timeval		em_timestamp;	/* output: time of event             */
	int 				em_location;	/* output: node generating event     */
	char				*em_name;		/* output: resource variable name    */
	char				*em_rsrc_ID;	/* output: resource ID               */
	enum ha_emData_Type	em_data_type;	/* output: resource var. data type   */
	union ha_em_val		em_val;			/* output: resource variable value   */
};

#ifdef __64BIT__
struct ha_em_rpb_event_32 {
	union ha_em_errnum	em_error;		/* output: error number              */
	ha_em_eid_t 		em_event_id;	/* output: event identifier          */
	unsigned int	 	em_event_flags;	/* output: event flags. See below    */
	struct timeval32		em_timestamp;	/* output: time of event             */
	int 				em_location;	/* output: node generating event     */
	unsigned int		em_name;		/* output: resource variable name    */
	unsigned int		em_rsrc_ID;		/* output: resource ID               */
	enum ha_emData_Type	em_data_type;	/* output: resource var. data type   */
	union ha_em_val_32	em_val;			/* output: resource variable value   */
};
#endif

#define HA_EM_EVENT_RE_ARM		0x0001	/* event generated from re-arm       */
										/*     expression.                   */
#define HA_EM_EVENT_EXPR_FALSE	0x0002	/* expression evaluated to FALSE.    */
										/*     (response to HA_EM_SCMD_REVAL */
										/*     subcommand)                   */
#define HA_EM_EVENT_UNREG		0x0004	/* event has been unregistered       */
#define HA_EM_EVENT_PRED_FALSE	HA_EM_EVENT_EXPR_FALSE	/* for compatibility */

/*
 *  When the current value of a resource variable is queried, it is reported
 *  through a ha_em_rpb_qcur (Event Manager ResPonse Block: Query CURrent)
 *  structure.  This structure is included in the ha_em_resp_blk union,
 *  defined later in this file.
 *
 *  This structure is also used to return the resource IDs of variables
 *  when the current value is not required (although the last known value
 *  is returned).
 */

struct ha_em_rpb_qcur {
	union ha_em_errnum	em_error;		/* output: error number              */
	int 				em_location;	/* output: node containing variable  */
	char				*em_name;		/* output: name of resource variable */
	char				*em_rsrc_ID;	/* output: resource ID               */
	enum ha_emData_Type em_data_type;	/* output: resource var. data type   */
	union ha_em_val		em_val;			/* output: resource variable value   */
};

#ifdef __64BIT__
struct ha_em_rpb_qcur_32 {
	union ha_em_errnum	em_error;		/* output: error number              */
	int 				em_location;	/* output: node containing variable  */
	unsigned int		em_name;		/* output: name of resource variable */
	unsigned int		em_rsrc_ID;		/* output: resource ID               */
	enum ha_emData_Type em_data_type;	/* output: resource var. data type   */
	union ha_em_val_32	em_val;			/* output: resource variable value   */
};
#endif

/*
 *  When defined resource variables and expressions are queried, they are
 *  reported through ha_em_rpb_qdef (Event Manager ResPonse Block: Query
 *  DEFined) structure.  This structure is included in the ha_em_resp_blk union,
 *  defined later in this file.
 */

struct ha_em_rpb_qdef {
	union ha_em_errnum	em_error;	/* output: error number                  */
	char				*em_name;	/* output: name of resource variable     */
	char				*em_descrp;	/* output: resource variable description */
	enum ha_emValue_Type em_value_type;	/* output: Counter, Quantity, or     */
										/*         State                     */
	enum ha_emData_Type	 em_data_type;	/* output: long, float, or structured*/
										/*         byte string (SBS)         */
	char	*em_sbs_format;			/* output: description of SBS format     */
	char	*em_init_value;			/* output: initial value of variable     */
	char	*em_class;				/* output: variable's resource class     */
	char	*em_rsrc_ID;			/* output: resource ID definition        */
	char	*em_rsrc_ID_descrp;		/* output: resource ID description       */
	char	*em_ptx_name;			/* output: PTX shared memory name        */
	char	*em_dflt_expr;			/* output: default expression            */
	char	*em_event_descrp;		/* output: event description             */
	char	*em_locator;			/* output: location indicator            */
	char	*em_order_group;		/* output: resource variable order group */
};

#ifdef __64BIT__
struct ha_em_rpb_qdef_32 {
	union ha_em_errnum	em_error;	/* output: error number                  */
	unsigned int	em_name;	/* output: name of resource variable     */
	unsigned int	em_descrp;	/* output: resource variable description */
	enum ha_emValue_Type em_value_type;	/* output: Counter, Quantity, or     */
										/*         State                     */
	enum ha_emData_Type	 em_data_type;	/* output: long, float, or structured*/
										/*         byte string (SBS)         */
	unsigned int em_sbs_format;		 	/* output: description of SBS format     */
	unsigned int em_init_value;			/* output: initial value of variable     */
	unsigned int em_class;				/* output: variable's resource class     */
	unsigned int em_rsrc_ID;			/* output: resource ID definition        */
	unsigned int em_rsrc_ID_descrp;		/* output: resource ID description       */
	unsigned int em_ptx_name;			/* output: PTX shared memory name        */
	unsigned int em_dflt_expr;			/* output: default expression            */
	unsigned int em_event_descrp;		/* output: event description             */
	unsigned int em_locator;			/* output: location indicator            */
	unsigned int em_order_group;		/* output: resource variable order group */
};
#endif

/*
 *  When the parsing of an element in an event registration request results in
 *  an error, it is reported through a ha_em_rpb_rerr (Event Manager ResPonse
 *  Block: Registration ERRor) structure.  This structure is included in the
 *  ha_em_resp_blk union, defined later in this file.
 *
 *  The fields in this structure are a reflection of the information in the
 *  request in error.
 */

struct ha_em_rpb_rerr {
	union ha_em_errnum	em_error;	/* output:  error number                 */
	char				*em_name;	/* output:  resource variable name       */
	char				*em_rsrc_ID;/* output:  resource ID                  */
	char				*em_expr;	/* output:  expression                   */
	char				*em_raexpr;	/* output:  re-arm expression            */
	short				em_errinfo0;/* output: additional error info         */
	unsigned short		em_errinfo1;/* output: additional error info         */
	ha_em_eid_t			em_event_id;	/* output:  event identifier         */
};

#ifdef __64BIT__
struct ha_em_rpb_rerr_32 {
	union ha_em_errnum	em_error;	/* output:  error number                 */
	unsigned int		em_name;	/* output:  resource variable name       */
	unsigned int		em_rsrc_ID;	/* output:  resource ID                  */
	unsigned int		em_expr;	/* output:  expression                   */
	unsigned int		em_raexpr;	/* output:  re-arm expression            */
	short				em_errinfo0;/* output: additional error info         */
	unsigned short		em_errinfo1;/* output: additional error info         */
	ha_em_eid_t 		em_event_id;	/* output:  event identifier         */
};
#endif

#define em_expr_err	em_errinfo0		/* output: expression parsing error      */
#define em_expr_pos	em_errinfo1		/* output: position of parsing error */
#define em_pred_err	em_expr_err		/* for compatibility     */
#define em_pred_pos	em_expr_pos		/* for compatibility     */

/*
 *  When the parsing of an element in a query request results in an error, it
 *  is reported through a ha_em_rpb_qerr (Event Manager ResPonse Block: Query
 *  ERRor) structure.  This structure is included in the ha_em_resp_blk union,
 *  defined later in this file.
 *
 *  The fields in this structure are a reflection of the information in the
 *  request in error.
 */

struct ha_em_rpb_qerr {
	union ha_em_errnum	em_error;	/* output:  error number                  */
	char				*em_class;	/* output:  resource variable class name  */
	char				*em_name;	/* output:  resource variable name        */
	char				*em_rsrc_ID;/* output:  resource ID                   */
	unsigned short		em_errinfo;	/* output: additional error info          */
};

#ifdef __64BIT__
struct ha_em_rpb_qerr_32 {
	union ha_em_errnum	em_error;	/* output:  error number                  */
	unsigned int		em_class;	/* output:  resource variable class name  */
	unsigned int		em_name;	/* output:  resource variable name        */
	unsigned int		em_rsrc_ID;	/* output:  resource ID                   */
	unsigned short		em_errinfo;	/* output: additional error info          */
};
#endif

/*
 *  When Event Manager daemon server credentials are returned, they are returned
 *  through a ha_em_rpb_creds (Event Manager ResPonse Block: CREDentialS)
 *  structure.  This structure is included in the ha_em_resp_blk union,
 *  defined later in this file.
 */

struct ha_em_rpb_creds {
	union ha_em_errnum	em_error;			/* output:  error number         */
	int					em_cred_len;		/* output: length of credentials */
	char				em_cred_data[1];	/* output: the user credentials  */
};

/*
 *  Multiple responses of a particular type are made through a ha_em_resp_blk
 *  (Event Manager RESPonse BLocK) union.  All the responses are of the
 *  same type.  The number of elements in the array depends on the number
 *  of responses being made.  This union is included in the ha_em_rsp_blk
 *  structure, defined later in this file.
 */

union ha_em_resp_blk {
	struct ha_em_rpb_event	em_rpb_event[1];	/* Used for events           */
	struct ha_em_rpb_qcur	em_rpb_qcur[1];		/* Used for current values   */
	struct ha_em_rpb_qdef	em_rpb_qdef[1];		/* Used for defined variables*/
	struct ha_em_rpb_rerr	em_rpb_rerr[1];		/* Used for reg cmd errors   */
	struct ha_em_rpb_qerr	em_rpb_qerr[1];		/* Used for query cmd errors */
	struct ha_em_rpb_creds	em_rpb_creds;		/* Used for credentials		 */
};

#ifdef __64BIT__
union ha_em_resp_blk_32 {
	struct ha_em_rpb_event_32	em_rpb_event[1];/* Used for events           */
	struct ha_em_rpb_qcur_32	em_rpb_qcur[1];	/* Used for current values   */
	struct ha_em_rpb_qdef_32	em_rpb_qdef[1];	/* Used for defined variables*/
	struct ha_em_rpb_rerr_32	em_rpb_rerr[1];	/* Used for reg cmd errors   */
	struct ha_em_rpb_qerr_32	em_rpb_qerr[1];	/* Used for query cmd errors */
	struct ha_em_rpb_creds		em_rpb_creds;	/* Used for credentials		 */
};
#endif

/*
 *  A block of responses of a particular type are delivered through a
 *  ha_em_rsp_blk (Event Manager ReSPonse BLocK) structure passed through
 *  the ha_em_receive_command() routine. All the responses are of the same type.
 *  The type of the requests are identified in the em_cmd and em_subcmd
 *  fields.  The responses themselves are in an array within the ha_em_resp_blk
 *  union.
 */

struct ha_em_rsp_blk {
	int 					em_rsp_blk_len;	/* output: length of responses   */
	int 					em_rsp_num_resp;/* output: number of responses   */
	short					em_cmd;			/* output: type of responses     */
	short					em_subcmd;		/* output: subtype of responses  */
	ha_em_qid_t				em_qid;			/* output: query identifier      */
	int 					em_qend;		/* output: query response end    */
	union ha_em_resp_blk	em_resp_blk;	/* output: the array of responses*/
};

#ifdef __64BIT__
struct ha_em_rsp_blk_32 {
	int 					em_rsp_blk_len;	/* output: length of responses   */
	int 					em_rsp_num_resp;/* output: number of responses   */
	short					em_cmd;			/* output: type of responses     */
	short					em_subcmd;		/* output: subtype of responses  */
	ha_em_qid_t				em_qid;			/* output: query identifier      */
	int 					em_qend;		/* output: query response end    */
	union ha_em_resp_blk_32	em_resp_blk;	/* output: the array of responses*/
};
#endif


/*---------------------------------------------------------------------------*/
/*  Event Manager API compatibility definitions.                             */
/*                                                                           */
/*  These definitions are provided to maintain source compatibility with     */
/*  programs written using prior versions of this header file.               */
/*  If these definitions result in inappropriate substitutions, then define  */
/*  the symbol HA_EM_NO_NAME_COMPAT prior to inclusion of this header file.  */
/*  If HA_EM_NO_NAME_COMPAT is defined, the source files that include this   */
/*  header file must be modified to use the new symbol names if the old      */
/*  symbol names are referenced therein.                                     */
/*---------------------------------------------------------------------------*/

#ifndef HA_EM_NO_NAME_COMPAT
#ifndef em_ivector
#define em_ivector em_rsrc_ID		/* replace em_ivector by em_rsrc_ID   */
#endif
#ifndef em_ivector_descrp
#define em_ivector_descrp em_rsrc_ID_descrp
									/* replace em_ivector_descrp by
									   em_rsrc_ID_descrp                  */
#endif
#ifndef em_dflt_pred
#define em_dflt_pred    em_dflt_expr
									/* replace em_dflt_pred by em_dflt_expr */
#endif
#ifndef em_pred
#define em_pred    em_expr			/* replace em_pred by em_expr         */
#endif
#ifndef em_rapred
#define em_rapred  em_raexpr		/* replace em_rapred by em_raexpr     */
#endif
#endif	/* HA_EM_NO_NAME_COMPAT */


#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif  /* _HA_EMAPI_BASE_H */