/*
 * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
 *
 * U.S. Government Rights - Commercial software. Government users are subject
 * to the Sun Microsystems, Inc. standard license agreement and applicable
 * provisions of the FAR and its supplements.
 *
 *
 * This distribution may include materials developed by third parties. Sun,
 * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
 * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
 *
 */

/*
 * Note: this file originally auto-generated by mib2c using
 *        : mib2c.scalar.conf,v 1.5 2002/07/18 14:18:52 dts12 Exp $
 */


#ifndef HEALTHMONITOR_H
#define HEALTHMONITOR_H

/* function declarations */
void init_healthMonitor(void);
Netsnmp_Node_Handler get_hmSpinsOnMutexes;
Netsnmp_Node_Handler get_hmTotProcInRunQueue;
Netsnmp_Node_Handler get_hmTotRPCCalls;
Netsnmp_Node_Handler get_hmUsedSwapSpace;
Netsnmp_Node_Handler get_hmDNLCMisses;
Netsnmp_Node_Handler get_hmReservedSwapSpace;
Netsnmp_Node_Handler get_hmTotMemAllocFails;
Netsnmp_Node_Handler get_hmAvailableSwapSpace;
Netsnmp_Node_Handler get_hmDNLCHitRate;
Netsnmp_Node_Handler get_hmDNLCHits;
Netsnmp_Node_Handler get_hmAllocatedSwapSpace;
Netsnmp_Node_Handler get_hmTotNumOfCPUs;
Netsnmp_Node_Handler get_hmPageScanRate;
Netsnmp_Node_Handler get_hmTimers;
Netsnmp_Node_Handler get_hmTotBadRPCCalls;
Netsnmp_Node_Handler get_hmDNLCRefRate;
Netsnmp_Node_Handler get_hmTotSendFails;
Netsnmp_Node_Handler get_hmTotFailedCallsBV;
Netsnmp_Node_Handler get_hmTotNumOfAuthRefresh;
Netsnmp_Node_Handler get_hmHandspread;
Netsnmp_Node_Handler get_hmTotRPCRetransmissions;
Netsnmp_Node_Handler get_hmKmemFreeMem;
Netsnmp_Node_Handler get_hmTotBadRPCReplies;
Netsnmp_Node_Handler get_hmKmemErrors;
Netsnmp_Node_Handler get_hmTotProcReadyInSwap;
Netsnmp_Node_Handler get_hmTotProcBlocked;
Netsnmp_Node_Handler get_hmTotRPCCallsTimedOut;


/* Additions to the template generated by mib2c */

/* Define node alarm states */

#define OK 0
#define INFO 1
#define WARNING 2
#define ERROR 3

/* Defile various rule states */

#define NOTINIT 0
#define INIT 1
#define OPEN 2
#define CONTINUE 3
#define CLOSE 4
#define CONDITION 5

/* Forward Function declarations */

int hm_post_read_config(int a, int b, void *c, void *d);
void read_health_monitor_thresholds(const char *token, char *cptr);
void send_trap(u_char *host , u_char *mod , u_char* con, oid *asdf, int size, u_char *stat , u_char *desc , u_char* dvalue, int dtype);
void hm_handle_rule(int* rule_state, int (*rule) (int action));

int SWAP_rule(int action);
int Kernel_rule(int action);
int NFS_rule(int action);
int CPU_rule(int action);
int RAM_rule(int action);
int KMEM_rule(int action);
int DNLC_rule(int action);

void refresh_all_HM_data(unsigned int clientreg, void *clientarg);
void refresh_SWAP_data();
void refresh_Kernel_data();
void refresh_NFS_data();
void refresh_CPU_data();
void refresh_RAM_data();
void refresh_KMEM_data();
void refresh_DNLC_data();

char* conv_alarm_state(int);

/*
 * Additions from hmDiskGroup.h required for implementing hmDiskGroup
 *
 */

/* function declarations */
void initialize_table_hmDiskTable(void);
Netsnmp_Node_Handler hmDiskTable_handler;

Netsnmp_First_Data_Point  hmDiskTable_get_first_data_point;
Netsnmp_Next_Data_Point   hmDiskTable_get_next_data_point;

/* column number definitions for table hmDiskTable */
       #define COLUMN_HMDISKNAME                1
       #define COLUMN_HMDISKALIASNAME           2
       #define COLUMN_HMAVGWAITTRANSACTIONS             3
       #define COLUMN_HMDISKBUSYPCNT            4
       #define COLUMN_HMAVGDISKSVCTIME          5

typedef struct HmDiskEntry {
    char *hmDiskName;
    char *hmDiskAliasName;
    char *hmAvgWaitTransactions;
    char *hmDiskBusyPcnt;
    char *hmAvgDiskSvcTime;
    int  hmDiskState;
    int  hmTraversed;

    struct HmDiskEntry* pNext;
} hmDiskTable;

#define DISK_DATA_LEN 8

/* Function prototypes */

void  construct_DISK_table();
void refresh_DISK_table(unsigned int clientreg, void *clientarg);
hmDiskTable* get_first_node();
void check_state_DISK();

#endif /* HEALTHMONITOR_H */
