signal.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright (c) 2013 Hugh Bailey <[email protected]>
  3. *
  4. * Permission to use, copy, modify, and distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #pragma once
  17. #include "../util/c99defs.h"
  18. #include "calldata.h"
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. /*
  23. * Signal handler
  24. *
  25. * This is used to create a signal handler which can broadcast events
  26. * to one or more callbacks connected to a signal.
  27. */
  28. struct signal_handler;
  29. typedef struct signal_handler *signal_handler_t;
  30. EXPORT signal_handler_t signal_handler_create(void);
  31. EXPORT void signal_handler_destroy(signal_handler_t handler);
  32. EXPORT void signal_handler_connect(signal_handler_t handler, const char *signal,
  33. void (*callback)(void*, calldata_t), void *data);
  34. EXPORT void signal_handler_disconnect(signal_handler_t handler,
  35. const char *signal, void (*callback)(void*, calldata_t),
  36. void *data);
  37. EXPORT void signal_handler_signal(signal_handler_t handler, const char *signal,
  38. calldata_t params);
  39. #ifdef __cplusplus
  40. }
  41. #endif