NCDUdevMonitor.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /**
  2. * @file NCDUdevMonitor.h
  3. * @author Ambroz Bizjak <ambrop7@gmail.com>
  4. *
  5. * @section LICENSE
  6. *
  7. * This file is part of BadVPN.
  8. *
  9. * BadVPN is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2
  11. * as published by the Free Software Foundation.
  12. *
  13. * BadVPN is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along
  19. * with this program; if not, write to the Free Software Foundation, Inc.,
  20. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  21. */
  22. #ifndef BADVPN_UDEVMONITOR_NCDUDEVMONITOR_H
  23. #define BADVPN_UDEVMONITOR_NCDUDEVMONITOR_H
  24. #include <misc/debug.h>
  25. #include <misc/debugerror.h>
  26. #include <flow/StreamRecvConnector.h>
  27. #include <inputprocess/BInputProcess.h>
  28. #include <udevmonitor/NCDUdevMonitorParser.h>
  29. typedef void (*NCDUdevMonitor_handler_event) (void *user);
  30. typedef void (*NCDUdevMonitor_handler_error) (void *user, int is_error);
  31. typedef struct {
  32. void *user;
  33. NCDUdevMonitor_handler_event handler_event;
  34. NCDUdevMonitor_handler_error handler_error;
  35. BInputProcess process;
  36. int process_running;
  37. int process_was_error;
  38. int input_running;
  39. int input_was_error;
  40. StreamRecvConnector connector;
  41. NCDUdevMonitorParser parser;
  42. DebugObject d_obj;
  43. DebugError d_err;
  44. } NCDUdevMonitor;
  45. int NCDUdevMonitor_Init (NCDUdevMonitor *o, BReactor *reactor, BProcessManager *manager, int is_info_mode, void *user,
  46. NCDUdevMonitor_handler_event handler_event,
  47. NCDUdevMonitor_handler_error handler_error) WARN_UNUSED;
  48. void NCDUdevMonitor_Free (NCDUdevMonitor *o);
  49. void NCDUdevMonitor_Done (NCDUdevMonitor *o);
  50. void NCDUdevMonitor_AssertReady (NCDUdevMonitor *o);
  51. int NCDUdevMonitor_IsReadyEvent (NCDUdevMonitor *o);
  52. int NCDUdevMonitor_GetNumProperties (NCDUdevMonitor *o);
  53. void NCDUdevMonitor_GetProperty (NCDUdevMonitor *o, int index, const char **name, const char **value);
  54. #endif