winservice.h 1.6 KB

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