winservice.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #pragma once
  2. #ifndef WINSERVICE_H
  3. #define WINSERVICE_H
  4. /* Windows Service related function declarations. */
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #elif 0
  8. }
  9. #endif /* */
  10. /*
  11. * Define Constants for Register, De-register , Run As service or Console mode
  12. */
  13. enum net_snmp_cmd_line_action {
  14. REGISTER_SERVICE = 0,
  15. UN_REGISTER_SERVICE = 1,
  16. RUN_AS_SERVICE = 2,
  17. RUN_AS_CONSOLE = 3,
  18. };
  19. /*
  20. * Input parameter structure to thread
  21. */
  22. typedef struct _InputParams {
  23. DWORD Argc;
  24. char **Argv;
  25. } InputParams;
  26. /*
  27. * Define Service Related functions
  28. */
  29. /*
  30. * To register application as windows service with SCM
  31. */
  32. int RegisterService(const char *lpszServiceName,
  33. const char *lpszServiceDisplayName,
  34. const char *lpszServiceDescription,
  35. InputParams *StartUpArg, int quiet);
  36. /*
  37. * To unregister service
  38. */
  39. int UnregisterService(const char *lpszServiceName, int quiet);
  40. /*
  41. * To parse command line for startup option
  42. */
  43. enum net_snmp_cmd_line_action
  44. ParseCmdLineForServiceOption(int argc, char *argv[],
  45. int *quiet);
  46. /*
  47. * To start Service
  48. */
  49. BOOL RunAsService(int(*ServiceFunction)(int, char **));
  50. /*
  51. * Service STOP function registration with this framewrok
  52. * * this function must be invoked before calling RunAsService
  53. */
  54. void RegisterStopFunction(void(*StopFunc)(void));
  55. #if 0
  56. {
  57. #elif defined(__cplusplus)
  58. }
  59. #endif /* */
  60. #endif /* WINSERVICE_H */