diff options
author | Andreas Baumann <abaumann@yahoo.com> | 2009-03-27 15:18:58 +0100 |
---|---|---|
committer | Andreas Baumann <abaumann@yahoo.com> | 2009-03-27 15:18:58 +0100 |
commit | f83210c88e7376e12b5cf0e86a073c59e4185efb (patch) | |
tree | 43441baf7060b9385cc7b0316551e1aae21c9af0 /include | |
parent | 1e30a5d2d995ab51cc27c00917cda37ef24295ff (diff) | |
download | wolfbones-f83210c88e7376e12b5cf0e86a073c59e4185efb.tar.gz wolfbones-f83210c88e7376e12b5cf0e86a073c59e4185efb.tar.bz2 |
started to add usefull Windows service documentation, started with wolf_service_start_console
Diffstat (limited to 'include')
-rw-r--r-- | include/wolf/service/service.h | 53 |
1 files changed, 35 insertions, 18 deletions
diff --git a/include/wolf/service/service.h b/include/wolf/service/service.h index 1275d0b..2033117 100644 --- a/include/wolf/service/service.h +++ b/include/wolf/service/service.h @@ -67,6 +67,38 @@ typedef struct wolf_service_params_t { */ wolf_error_t wolf_service_install( wolf_service_params_t params ); +/** + * Uninstalls the current binary as a Windows service. + * + * @param service_name the name of the service to remove from the service infrastructure + * + * @return WOLF_OK if the service was removed, or an WOLF_ERR_INTERNAL + * (which also gets logged with wolf_log) + */ +wolf_error_t wolf_service_remove( LPCTSTR service_name ); + +/** + * Start the service + * + * @param service_name the name of the service previously registered with + * wolf_service_install + * @param service_main the main function (which should implement startup/shutdown + * and the main processing loop) + * + * @return When the main thread terminates after a service shutdown. + * You should not do much after this point in the code.. + */ +wolf_error_t wolf_service_start( LPTSTR service_name, + LPSERVICE_MAIN_FUNCTION service_main ); + +wolf_error_t wolf_service_start_console( LPTSTR service_name, + LPSERVICE_MAIN_FUNCTION service_main, + DWORD argc, + LPTSTR *argv ); + +/** + * @brief events which can happen in a service + */ typedef enum wolf_service_event_t { WOLF_SERVICE_NO_EVENT, /**< no event happened */ WOLF_SERVICE_EVENT_TERMINATE /**< terminate the service now */ @@ -77,30 +109,15 @@ typedef enum wolf_service_event_t { * we only get the SERVICE_EVENT_TERMINATE event. * * @param timeout wait at most timeout seconds, then return also - * without an event happening + * without an event happening, error is set to + * WOLF_ERR_TIMEOUT in this case * @param error WOLF_OK if an event occured, WOLF_ERR_TIMEOUT if * no signal happened after timeout seconds + * * @return the event which happened */ wolf_service_event_t wolf_service_events_suspend( int timeout, wolf_error_t *error ); -/** - * The main service function. - * - * @param argc number of arguments as in main() - * @param argv arguments as in main() - * - * Note: Must be exported as it gets called from the SCM in a service thread/process. - */ -void WINAPI wolf_service_main( DWORD argc, LPTSTR *argv ); - -void wolf_service_register_main( LPSERVICE_MAIN_FUNCTION service_main ); - -int wolf_service_run( LPTSTR service_name, - wolf_error_t *error ); - - - #ifdef __cplusplus } #endif |