GATE
services.h File Reference

OS service and daemon management utilities. More...

#include "gate/system/gate_system_api.h"
#include "gate/gatetypes.h"
#include "gate/strings.h"
#include "gate/arrays.h"

Classes

struct  gate_service_class
 
struct  gate_service_config_class
 

Macros

#define GATE_SERVICE_STATE_UNKNOWN   0
 
#define GATE_SERVICE_STATE_STOPPED   1
 
#define GATE_SERVICE_STATE_RUNNING   2
 
#define GATE_SERVICE_STATE_ERROR   3
 
#define GATE_SERVICE_STATE_PAUSED   4
 
#define GATE_SERVICE_STATE_STARTING   5
 
#define GATE_SERVICE_STATE_STOPPING   6
 
#define GATE_SERVICE_FLAG_AUTOSTART   1
 
#define GATE_SERVICE_FLAG_DISABLED   2
 

Typedefs

typedef struct gate_service_class gate_service_t
 
typedef struct gate_service_config_class gate_service_config_t
 
typedef gate_bool_t(* gate_service_enum_callback_t) (gate_service_t const *service, void *user_param)
 
typedef void(* gate_service_message_callback_t) (gate_string_t const *message, void *user_param)
 

Functions

GATE_SYSTEM_API gate_result_t gate_services_enum (gate_service_enum_callback_t callback, void *user_param)
 
GATE_SYSTEM_API gate_result_t gate_service_start (gate_string_t const *name, gate_service_message_callback_t msg_callback, void *user_param)
 
GATE_SYSTEM_API gate_result_t gate_service_stop (gate_string_t const *name, gate_uint32_t wait_timeout, gate_bool_t force, gate_service_message_callback_t msg_callback, void *user_param)
 
GATE_SYSTEM_API gate_result_t gate_service_get_config (gate_string_t const *name, gate_service_config_t *config)
 
GATE_SYSTEM_API gate_result_t gate_service_get_status (gate_string_t const *name, gate_enumint_t *state, gate_string_t *process_id)
 
GATE_SYSTEM_API gate_result_t gate_service_register (gate_string_t const *name, gate_string_t const *command, gate_string_t const *descr, gate_uint32_t flags, gate_string_t const *dependencies, gate_service_message_callback_t msg_callback, void *user_param)
 
GATE_SYSTEM_API gate_result_t gate_service_unregister (gate_string_t const *name, gate_service_message_callback_t msg_callback, void *user_param)
 
GATE_SYSTEM_API char const * gate_service_print_state (gate_enumint_t state)
 

Detailed Description

OS service and daemon management utilities.

Macro Definition Documentation

◆ GATE_SERVICE_FLAG_AUTOSTART

#define GATE_SERVICE_FLAG_AUTOSTART   1

service is automatically started

◆ GATE_SERVICE_FLAG_DISABLED

#define GATE_SERVICE_FLAG_DISABLED   2

service is disabled and cannot be started

◆ GATE_SERVICE_STATE_ERROR

#define GATE_SERVICE_STATE_ERROR   3

service is in error state and not functional

◆ GATE_SERVICE_STATE_PAUSED

#define GATE_SERVICE_STATE_PAUSED   4

service was started and is currently paused

◆ GATE_SERVICE_STATE_RUNNING

#define GATE_SERVICE_STATE_RUNNING   2

service is running (online)

◆ GATE_SERVICE_STATE_STARTING

#define GATE_SERVICE_STATE_STARTING   5

service is starting but not yet ready to be used

◆ GATE_SERVICE_STATE_STOPPED

#define GATE_SERVICE_STATE_STOPPED   1

service is NOT running (offline)

◆ GATE_SERVICE_STATE_STOPPING

#define GATE_SERVICE_STATE_STOPPING   6

service is running but currently shuting down

◆ GATE_SERVICE_STATE_UNKNOWN

#define GATE_SERVICE_STATE_UNKNOWN   0

state of service is unknown

Typedef Documentation

◆ gate_service_enum_callback_t

typedef gate_bool_t(* gate_service_enum_callback_t) (gate_service_t const *service, void *user_param)

function callback type to receive enumerated services

◆ gate_service_message_callback_t

typedef void(* gate_service_message_callback_t) (gate_string_t const *message, void *user_param)

function callback that receives progress messages during operation