socket_harness.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * SpanDSP - a series of DSP components for telephony
  3. *
  4. * socket_harness.h
  5. *
  6. * Written by Steve Underwood <steveu@coppice.org>
  7. *
  8. * Copyright (C) 2012 Steve Underwood
  9. *
  10. * All rights reserved.
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License version 2, as
  14. * published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24. */
  25. typedef int (*termio_update_func_t)(void *user_data, struct termios *termios);
  26. typedef int (*put_msg_free_space_func_t)(void *user_data);
  27. typedef struct socket_harness_state_s
  28. {
  29. void *user_data;
  30. put_msg_func_t terminal_callback;
  31. termio_update_func_t termios_callback;
  32. modem_status_func_t hangup_callback;
  33. put_msg_free_space_func_t terminal_free_space_callback;
  34. span_rx_handler_t rx_callback;
  35. span_rx_fillin_handler_t rx_fillin_callback;
  36. span_tx_handler_t tx_callback;
  37. int audio_fd;
  38. int pty_fd;
  39. logging_state_t logging;
  40. struct termios termios;
  41. unsigned int delay;
  42. unsigned int started;
  43. unsigned pty_closed;
  44. unsigned close_count;
  45. modem_t modem;
  46. } socket_harness_state_t;
  47. int socket_harness_run(socket_harness_state_t *s);
  48. socket_harness_state_t *socket_harness_init(socket_harness_state_t *s,
  49. const char *socket_name,
  50. const char *tag,
  51. int caller,
  52. put_msg_func_t terminal_callback,
  53. termio_update_func_t termios_callback,
  54. modem_status_func_t hangup_callback,
  55. put_msg_free_space_func_t terminal_free_space_callback,
  56. span_rx_handler_t rx_callback,
  57. span_rx_fillin_handler_t rx_fillin_callback,
  58. span_tx_handler_t tx_callback,
  59. void *user_data);
  60. int socket_harness_release(socket_harness_state_t *s);
  61. int socket_harness_free(socket_harness_state_t *s);