The Sequence Toolkit
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
stk_service_api.h File Reference
#include "stk_env.h"
#include "stk_service.h"
#include "stk_sequence.h"
#include "stk_data_flow.h"
#include "stk_common.h"
#include "stk_smartbeat.h"
Include dependency graph for stk_service_api.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


stk_service_tstk_create_service (stk_env_t *env, char *name, stk_service_id id, stk_service_type type, stk_options_t *options)
stk_ret stk_destroy_service (stk_service_t *svc, stk_service_state *last_state)
stk_ret stk_set_service_state (stk_service_t *svc, stk_service_state state)
stk_service_state stk_get_service_state (stk_service_t *svc)
stk_uint32 stk_get_service_activity_tmo (stk_service_t *svc)
char * stk_get_service_name (stk_service_t *svc)
stk_service_id stk_get_service_id (stk_service_t *svc)
stk_service_type stk_get_service_type (stk_service_t *svc)
void stk_service_update_smartbeat (stk_service_t *svc, stk_smartbeat_t *smartbeat)
void stk_service_update_smartbeat_checkpoint (stk_service_t *svc, stk_checkpoint_t checkpoint)
stk_data_flow_t ** stk_svc_get_smartbeat_flows (stk_service_t *svc)
void stk_get_service_smartbeat (stk_service_t *svc, stk_smartbeat_t *smb)
stk_data_flow_tstk_get_monitoring_df (stk_service_t *svc)
stk_data_flow_tstk_get_notification_df (stk_service_t *svc)
stk_env_tstk_env_from_service (stk_service_t *svc)
void stk_get_service_state_str (stk_service_t *svc, stk_service_state state, char *state_str, size_t size)
void stk_set_service_state_str (stk_service_t *svc, stk_service_state state, char *state_str, size_t size)
stk_options_tstk_get_service_options (stk_service_t *svc)

Detailed Description

The Service API defines the mechanism by which services can comme in to existance and subsequently be destroyed.

Function Documentation

stk_service_t* stk_create_service ( stk_env_t env,
char *  name,
stk_service_id  id,
stk_service_type  type,
stk_options_t options 

Create a Sequence Service

A handle to the service or NULL
stk_ret stk_destroy_service ( stk_service_t svc,
stk_service_state last_state 

Destroy a Sequence Service

svcThe service to be destroyed
last_stateAn optional pointer to the last state to be reported for this service. If NULL, STOPPED will be used as the last state
Whether the service was successfully destroyed
stk_env_t* stk_env_from_service ( stk_service_t svc)

Get the STK env from a service

stk_data_flow_t* stk_get_monitoring_df ( stk_service_t svc)

Get the services monitoring df

stk_data_flow_t* stk_get_notification_df ( stk_service_t svc)

Get the services notification df

stk_uint32 stk_get_service_activity_tmo ( stk_service_t svc)

Get the activity timeout for this service

The number of milliseconds before the service is determined inactive
stk_service_id stk_get_service_id ( stk_service_t svc)

Get the Service ID

The ID of the service
char* stk_get_service_name ( stk_service_t svc)

Get the name of a Service

A reference pointer to the Service name
stk_options_t* stk_get_service_options ( stk_service_t svc)

Get the options for a service

Pointer to the options array for the service
void stk_get_service_smartbeat ( stk_service_t svc,
stk_smartbeat_t smb 

Get a copy of the service's current smartbeat

stk_service_state stk_get_service_state ( stk_service_t svc)

Get the state of a Service

The Service state
void stk_get_service_state_str ( stk_service_t svc,
stk_service_state  state,
char *  state_str,
size_t  size 

Get a copy of the string associated with a state for a service. Will return an int (decimal) in string form if there is no known name.

See Also
stk_service_type stk_get_service_type ( stk_service_t svc)

Get the type of a Service

The Service type
void stk_service_update_smartbeat ( stk_service_t svc,
stk_smartbeat_t smartbeat 

The stk_service_update_smartbeat() function updates the services smartbeat with the value passed in

void stk_service_update_smartbeat_checkpoint ( stk_service_t svc,
stk_checkpoint_t  checkpoint 

The stk_service_update_smartbeat_checkpoint() function updates the last checkpoint.

stk_ret stk_set_service_state ( stk_service_t svc,
stk_service_state  state 

Set the state of a Service

Whether the Service could be changed to the desired state
void stk_set_service_state_str ( stk_service_t svc,
stk_service_state  state,
char *  state_str,
size_t  size 

Add a state name to the state table for a service. This will replace any existing entry. It is the application responsibility to track any dynamic memory used to store names (and detect when they are replaced).

See Also
stk_data_flow_t** stk_svc_get_smartbeat_flows ( stk_service_t svc)

Get array of flows that need to be sent to for heartbeats. Array ends with NULL Caller must free returned data with free()