sc.c File Reference

Windows Service Control. More...

#include <stdio.h>
#include <string.h>
#include <yaz/xmalloc.h>
#include <yaz/log.h>
#include <yaz/sc.h>
#include <yaz/wrbuf.h>

Go to the source code of this file.

Data Structures

struct  sc_s

Functions

yaz_sc_t yaz_sc_create (const char *service_name, const char *display_name)
 creates service handle
void yaz_sc_running (yaz_sc_t s)
 signals that sc_main applicatio starts running
int yaz_sc_program (yaz_sc_t s, int argc, char **argv, int(*sc_main)(yaz_sc_t s, int argc, char **argv), void(*sc_stop)(yaz_sc_t s))
 registers service controlled program
void yaz_sc_destroy (yaz_sc_t *s)
 frees service control handle

Detailed Description

Windows Service Control.

Definition in file sc.c.


Function Documentation

yaz_sc_t yaz_sc_create ( const char *  service_name,
const char *  display_name 
)

creates service handle

Parameters:
service_name Service Name
display_name Display Name
Returns:
service control handle

This function does not activate the service. Only creates handle.

Definition at line 42 of file sc.c.

References sc_s::display_name, sc_s::install_flag, sc_s::remove_flag, sc_s::run_flag, sc_s::sc_main, sc_s::sc_stop, sc_s::service_name, sc_s::start_flag, xmalloc, and xstrdup.

Referenced by main(), and statserv_main().

void yaz_sc_destroy ( yaz_sc_t s  ) 

frees service control handle

Parameters:
s service control handle

Definition at line 369 of file sc.c.

References xfree.

Referenced by main(), and statserv_main().

int yaz_sc_program ( yaz_sc_t  s,
int  argc,
char **  argv,
int(*)(yaz_sc_t s, int argc, char **argv)  sc_main,
void(*)(yaz_sc_t s)  sc_stop 
)

registers service controlled program

Parameters:
s service control handle
argc argc as given from main
argv argv as given from main
sc_main service main function
sc_stop service stop function
Returns:
sc_main return value

sc_main is the main program of the application. It should initialize the application.. Function yaz_sc_running MUST be called before the application operates (after initialization)

Definition at line 231 of file sc.c.

References sc_s::argc, sc_s::argv, sc_s::display_name, sc_s::install_flag, sc_s::remove_flag, sc_s::run_flag, sc_s::sc_main, sc_s::sc_stop, sc_s::service_name, sc_s::start_flag, wrbuf_alloc(), wrbuf_cstr(), wrbuf_destroy(), wrbuf_puts(), yaz_log(), YLOG_ERRNO, YLOG_FATAL, and YLOG_LOG.

Referenced by main(), and statserv_main().

void yaz_sc_running ( yaz_sc_t  s  ) 

signals that sc_main applicatio starts running

Parameters:
s service control handle

Definition at line 224 of file sc.c.

Referenced by statserv_sc_main().

Generated on Tue Aug 17 13:13:20 2010 for YAZ by  doxygen 1.6.3