signal.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. /*
  20. * Signal handler
  21. *
  22. * This is used to create a signal handler which can broadcast events
  23. * to one or more callbacks connected to a signal.
  24. */
  25. struct signal_handler;
  26. typedef struct signal_handler *signal_handler_t;
  27. signal_handler_t signal_handler_create(void);
  28. void signal_handler_destroy(signal_handler_t handler);
  29. void signal_handler_connect(signal_handler_t handler, const char *signal,
  30. void (*callback)(calldata_t, void*), void *param);
  31. void signal_handler_disconnect(signal_handler_t handler, const char *signal,
  32. void (*callback)(calldata_t. void*), void *param);
  33. void signal_handler_signal(signal_handler_t handler, const char *name,
  34. calldata_t params);