msvcspmon_lib.h File Reference

Contains defines, structures, and function prototypes for managing heartbeats and service resolution. More...

#include <jnx/pconn.h>

Data Structures

struct  msvcspmon_hb_setup_info
 Heartbeat setup information for the health monitor. More...
struct  msvcspmon_monitor_info
 Heartbeat monitoring request information from health monitor. More...
struct  msvcspmon_service_info
 Service information data structure information from health monitor. More...
struct  msvcspmon_client_info
 Functional data structure to maintain client operational information with health monitor. More...

Defines

#define MSVCSPMON_MIN_POLLING_TIME   500
 Minimum heartbeat polling time in milliseconds.
#define MSVCSPMON_MAX_HB   1024
 msppmond maximum number of heartbeat entries.
#define HB_FILE_LENGTH   4096
 msppmond heartbeat file size.
#define MSVCSPMON_FILE_NAME   "/var/run/msvcspmon_hb"
 msppmond heartbeat file.
#define MSVCSPMON_PROC_NAME_LEN   128
 Maximum process name length in the heartbeat request.
#define MSVCSPMON_LOC_NAME_LEN   256
 Location where the client is running.
#define MSVCSPMON_SERVICE_LOCATION_MASTER   "RE"
 Service location name for master.
#define MSVCSPMON_ACTION_NOP   0x1
 Take no action on heartbeat failure.
#define MSVCSPMON_ACTION_KILL   0x2
 Kill the process on heartbeat failure.
#define MSVCSPMON_ACTION_KILL_CORE   0x4
 Kill the process and generate core on heartbeat failure.
#define MSVCSPMON_ACTION_LOG   0x8
 Log on heartbeat failure.
#define MSVCSPMON_ACTION_RTS_POST   0x10
 Post an rtsock message on heartbeat failure.
#define MSVCSPMON_ACTION_HA_SWITCHOVER   0x20
 Switch over to other PIC on heartbeat failure when HA is enabled.
#define MSVCSPMON_ACTION_DEFAULT   (MSVCSPMON_ACTION_KILL | MSVCSPMON_ACTION_LOG)
 Default action on heartbeat failure.

Typedefs

typedef void(* msvcspmon_connection_t )(msvcspmon_connection_status_t status)
 Callback for the connection status.
typedef void(* msvcspmon_heartbeat_setup_status_t )(msvcspmon_hb_setup_status_t status)
 Callback for the heartbeat setup information.
typedef void(* msvcspmon_heartbeat_monitor_setup_status_t )(msvcspmon_heartbeat_mon_setup_status_t status, struct msvcspmon_monitor_info *mon_info)
 Callback for the heartbeat monitoring status.
typedef void(* msvcspmon_heartbeat_monitor_failed_t )(struct msvcspmon_monitor_info *mon_info)
 Callback for the heartbeat monitoring status.
typedef void(* msvcspmon_add_serice_status_t )(msvcspmon_service_status_t status, struct msvcspmon_service_info *service_info)
 Callback for the get service.
typedef void(* msvcspmon_delete_serice_status_t )(msvcspmon_service_status_t status, struct msvcspmon_service_info *service_info)
 Callback for the get service.
typedef void(* msvcspmon_get_serice_t )(msvcspmon_service_status_t status, struct msvcspmon_service_info *service_info)
 Callback for the get service.
typedef void(* msvcspmon_ha_info_monitor_setup_status_t )(msvcspmon_ha_info_mon_setup_status_t status)
 Callback for high availability monitoring status.
typedef void(* msvcspmon_ha_info_monitor_failed_t )(struct kcom_ifdev_redundancy_info_s *option)
 Callback for switchover notification.

Enumerations

enum  msvcspmon_heartbeat_state_t { MSVCSPMON_HEARTBEAT_OFF = 0x0, MSVCSPMON_HEARTBEAT_ON = 0x1 }
enum  msvcspmon_heartbeat_mon_setup_status_t { MSVCSPMON_HEARTBEAT_MON_SETUP_SUCCESS = 1, MSVCSPMON_HEARTBEAT_MON_SETUP_FAILURE }
enum  msvcspmon_connection_status_t { MSVCSPMON_REGISTER_SUCCESS = 1, MSVCSPMON_CLOSED, MSVCSPMON_FAILED }
enum  msvcspmon_hb_setup_status_t { MSVCSPMON_HB_SETUP_SUCCESS = 1, MSVCSPMON_HB_SETUP_FAILED }
enum  msvcspmon_service_status_t { MSVCSPMON_SERVICE_SUCCESS = 1, MSVCSPMON_SERVICE_FAILED }
enum  msvcspmon_ha_info_mon_setup_status_t { MSVCSPMON_HA_INFO_MON_SETUP_SUCCESS = 1, MSVCSPMON_HA_INFO_MON_SETUP_FAILED }

Functions

msvcspmon_client_infomsvcspmon_register (evContext ev_context, msvcspmon_connection_t connection_status)
 Functional registration function for the health monitor clients.
int msvcspmon_unregister (struct msvcspmon_client_info *client_info)
 Functional unregistration function for health monitor clients.
int msvcspmon_setup_heartbeat (struct msvcspmon_client_info *client_info, struct msvcspmon_hb_setup_info *msvcspmon_hb_info, msvcspmon_heartbeat_setup_status_t setup_status)
 Configures heartbeat parameters with the health monitoring process.
int msvcspmon_heartbeat_state (struct msvcspmon_client_info *client_info, msvcspmon_heartbeat_state_t state)
 Start/stop heartbeat.
void msvcspmon_heartbeat (struct msvcspmon_client_info *client_info)
 Heartbeat for a process/thread.
int msvcspmon_setup_heartbeat_monitor (struct msvcspmon_client_info *client_info, struct msvcspmon_monitor_info *msvcspmon_monitor, msvcspmon_heartbeat_monitor_setup_status_t hb_mon_setup_status, msvcspmon_heartbeat_monitor_failed_t hb_monitor)
 Setup function that monitors the health of other processes.
int msvcspmon_add_service (struct msvcspmon_client_info *client_info, struct msvcspmon_service_info *msvcspmon_service, msvcspmon_add_serice_status_t add_service_status)
 Adds a service to be advertised.
int msvcspmon_delete_service (struct msvcspmon_client_info *client_info, struct msvcspmon_service_info *msvcspmon_service, msvcspmon_delete_serice_status_t delete_service_status)
 Deletes a service.
int msvcspmon_get_service (struct msvcspmon_client_info *client_info, char *service_name, msvcspmon_get_serice_t get_service)
 Gets service information (IP address and port) asynchronously.
int msvcspmon_setup_ha_info_monitor (struct msvcspmon_client_info *client_info, msvcspmon_ha_info_monitor_setup_status_t ha_mon_setup_status, msvcspmon_ha_info_monitor_failed_t ha_mon_failed)
 Registers for async notification of switchover in the rms interface.
kcom_ifdev_redundancy_info_s * msvcspmon_get_redundancy_info (void)
 Gets the current redundancy information corresponding to the rms interface.
int msvcspmon_ha_switch (void)
 Triggers switchover from active to backup Multiservices PIC configured under the rms interface.
int msvcspmon_ha_acquire (void)
 Acquires the active status by the backup Multiservices PIC.
int msvcspmon_ha_release (void)
 Releases the active status by currently active Multiservices PIC.


Detailed Description

Contains defines, structures, and function prototypes for managing heartbeats and service resolution.


Enumeration Type Documentation

enum msvcspmon_connection_status_t
 

Enumerator:
MSVCSPMON_REGISTER_SUCCESS  Registration success status with health monitor process.
MSVCSPMON_CLOSED  Connection closed status with health monitor process.
MSVCSPMON_FAILED  Failed connection status with health monitor process.

enum msvcspmon_ha_info_mon_setup_status_t
 

Enumerator:
MSVCSPMON_HA_INFO_MON_SETUP_SUCCESS  Success status for high availability monitoring request.
MSVCSPMON_HA_INFO_MON_SETUP_FAILED  Failure status for high availability monitoring request.

enum msvcspmon_hb_setup_status_t
 

Enumerator:
MSVCSPMON_HB_SETUP_SUCCESS  Success status for heartbeat setup.
MSVCSPMON_HB_SETUP_FAILED  Failure status for heartbeat setup.

enum msvcspmon_heartbeat_mon_setup_status_t
 

Enumerator:
MSVCSPMON_HEARTBEAT_MON_SETUP_SUCCESS  Success status for the heartbeat monitoring request.
MSVCSPMON_HEARTBEAT_MON_SETUP_FAILURE  Failure status for the heartbeat monitoring request.

enum msvcspmon_heartbeat_state_t
 

Enumerator:
MSVCSPMON_HEARTBEAT_OFF  Heartbeat state to stop counting heartbeat.
MSVCSPMON_HEARTBEAT_ON  Heartbeat state to start counting heartbeat.

enum msvcspmon_service_status_t
 

Enumerator:
MSVCSPMON_SERVICE_SUCCESS  Success status for service request.
MSVCSPMON_SERVICE_FAILED  Failure status for service request.


Function Documentation

int msvcspmon_add_service struct msvcspmon_client_info client_info,
struct msvcspmon_service_info msvcspmon_service,
msvcspmon_add_serice_status_t  add_service_status
 

Adds a service to be advertised.

Parameters:
[in] client_info Pointer to msvcspmon_client_info structure.
[in] msvcspmon_service Information about the service to be added.
[in] add_service_status Callback to notify service add status.
Returns:
The following return codes are possible: -1 Error with errno set. 0 when health monitor request is successful.

int msvcspmon_delete_service struct msvcspmon_client_info client_info,
struct msvcspmon_service_info msvcspmon_service,
msvcspmon_delete_serice_status_t  delete_service_status
 

Deletes a service.

Parameters:
[in] client_info Pointer to msvcspmon_client_info structure.
[in] msvcspmon_service Information about the service to be deleted.
[in] delete_service_status Callback to notify service delete status.
Returns:
The following return codes are possible: -1 Error with errno set. 0 when health monitor request is successful.

struct kcom_ifdev_redundancy_info_s* msvcspmon_get_redundancy_info void   ) 
 

Gets the current redundancy information corresponding to the rms interface.

Returns:
Pointer to the redundancy info structure if the request is successful. It is the responsibility of the caller to free the memory allocated for the redundancy info structure. NULL if the request failed.

int msvcspmon_get_service struct msvcspmon_client_info client_info,
char *  service_name,
msvcspmon_get_serice_t  get_service
 

Gets service information (IP address and port) asynchronously.

Parameters:
[in] client_info Pointer to msvcspmon_client_info structure.
[in] service_name Information about the service to be resolved.
[in] get_service Callback to notify service information.
Returns:
The following return codes are possible: -1 Error with errno set. 0 when health monitor request is successful.

int msvcspmon_ha_acquire void   ) 
 

Acquires the active status by the backup Multiservices PIC.

This request is valid only on backup.

Returns:
The following return codes are possible:
  • -1 Error with errno set.
  • 0 When request is successful.
  • EINVAL - Invalid request.

int msvcspmon_ha_release void   ) 
 

Releases the active status by currently active Multiservices PIC.

This request is valid only on active.

Returns:
The following return codes are possible:
  • -1 Error with errno set.
  • 0 When request is successful.
  • EINVAL - Invalid request.

int msvcspmon_ha_switch void   ) 
 

Triggers switchover from active to backup Multiservices PIC configured under the rms interface.

This function can be called from either active or backup.

Returns:
The following return codes are possible:
  • -1 Error with errno set.
  • 0 When request is successful.
  • EINVAL - Invalid request.

void msvcspmon_heartbeat struct msvcspmon_client_info client_info  ) 
 

Heartbeat for a process/thread.

Parameters:
[in] client_info Pointer to msvcspmon_client_info structure.

int msvcspmon_heartbeat_state struct msvcspmon_client_info client_info,
msvcspmon_heartbeat_state_t  state
 

Start/stop heartbeat.

Parameters:
[in] client_info Pointer to msvcspmon_client_info structure.
[in] state Heartbeat state information to be updated.
Returns:
Status of the health monitor request:
  • -1 Error, with errno set.
  • 0 when health monitor request is successful.

struct msvcspmon_client_info* msvcspmon_register evContext  ev_context,
msvcspmon_connection_t  connection_status
 

Functional registration function for the health monitor clients.

Parameters:
[in] ev_context Event library context.
[in] connection_status Callback to get the connection status with the heartbeat monitoring process.
Returns:
The following return codes are possible:

int msvcspmon_setup_ha_info_monitor struct msvcspmon_client_info client_info,
msvcspmon_ha_info_monitor_setup_status_t  ha_mon_setup_status,
msvcspmon_ha_info_monitor_failed_t  ha_mon_failed
 

Registers for async notification of switchover in the rms interface.

Parameters:
[in] client_info Pointer to msvcspmon_client_info structure.
[in] ha_mon_setup_status Callback to get the status of the HA monitor request.
[in] ha_mon_failed Callback to notify about switchover. It is the responsibility of the caller to free the memory allocated for the redundancy info structure returned in the callback.
Returns:
0 when HA info monitor request is successful; otherwise -1.

int msvcspmon_setup_heartbeat struct msvcspmon_client_info client_info,
struct msvcspmon_hb_setup_info msvcspmon_hb_info,
msvcspmon_heartbeat_setup_status_t  setup_status
 

Configures heartbeat parameters with the health monitoring process.

Parameters:
[in] client_info Pointer to msvcspmon_client_info structure.
[in] msvcspmon_hb_info Pointer to the heartbeat setup information structure.
[in] setup_status Callback to get the heartbeat setup status.
Returns:
Status of the health monitor request: -1 Error, with errno set. > 1 when health monitor request is successful

int msvcspmon_setup_heartbeat_monitor struct msvcspmon_client_info client_info,
struct msvcspmon_monitor_info msvcspmon_monitor,
msvcspmon_heartbeat_monitor_setup_status_t  hb_mon_setup_status,
msvcspmon_heartbeat_monitor_failed_t  hb_monitor
 

Setup function that monitors the health of other processes.

Parameters:
[in] client_info Pointer to msvcspmon_client_info structure.
[in] msvcspmon_monitor Information about the processes to monitor.
[in] hb_mon_setup_status Callback to get the status of the monitoring request.
[in] hb_monitor Callback to get the update about the process health.
Returns:
The following return codes are possible: -1 Error with errno set. 0 when health monitor request is successful.

int msvcspmon_unregister struct msvcspmon_client_info client_info  ) 
 

Functional unregistration function for health monitor clients.

Parameters:
[in] client_info Pointer to msvcspmon_client_info structure.
Returns:
Status of the health monitor unregistration request:
  • -1 Error, with errno set.
  • > 0 when connection close request is successful.


2007-2009 Juniper Networks, Inc. All rights reserved. The information contained herein is confidential information of Juniper Networks, Inc., and may not be used, disclosed, distributed, modified, or copied without the prior written consent of Juniper Networks, Inc. in an express license. This information is subject to change by Juniper Networks, Inc. Juniper Networks, the Juniper Networks logo, and JUNOS are registered trademarks of Juniper Networks, Inc. in the United States and other countries. All other trademarks, service marks, registered trademarks, or registered service marks are the property of their respective owners.
Generated on Sun May 30 20:24:41 2010 for MSVCS-PMON API by Doxygen 1.4.5