spandsp  3.0.0
socket_harness.h
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 
26 typedef int (*termio_update_func_t)(void *user_data, struct termios *termios);
27 
28 typedef int (*put_msg_free_space_func_t)(void *user_data);
29 
30 typedef struct socket_harness_state_s
31 {
32  void *user_data;
33 
34  put_msg_func_t terminal_callback;
35  termio_update_func_t termios_callback;
36  modem_status_func_t hangup_callback;
37  put_msg_free_space_func_t terminal_free_space_callback;
38 
39  span_rx_handler_t rx_callback;
40  span_rx_fillin_handler_t rx_fillin_callback;
41  span_tx_handler_t tx_callback;
42 
43  int audio_fd;
44  int pty_fd;
45  logging_state_t logging;
46  struct termios termios;
47 
48  unsigned int delay;
49  unsigned int started;
50  unsigned pty_closed;
51  unsigned close_count;
52 
53  modem_t modem;
55 
56 int socket_harness_run(socket_harness_state_t *s, int kick);
57 
58 int terminal_write(void *user_data, const char *buf, int len);
59 
60 socket_harness_state_t *socket_harness_init(socket_harness_state_t *s,
61  const char *socket_name,
62  const char *tag,
63  int caller,
64  put_msg_func_t terminal_callback,
65  termio_update_func_t termios_callback,
66  modem_status_func_t hangup_callback,
67  put_msg_free_space_func_t terminal_free_space_callback,
68  span_rx_handler_t rx_callback,
69  span_rx_fillin_handler_t rx_fillin_callback,
70  span_tx_handler_t tx_callback,
71  void *user_data);
72 
73 int socket_harness_release(socket_harness_state_t *s);
74 
75 int socket_harness_free(socket_harness_state_t *s);
void(* put_msg_func_t)(void *user_data, const uint8_t *msg, int len)
Definition: async.h:95
Definition: pseudo_terminals.h:30
Definition: socket_harness.h:30
void(* modem_status_func_t)(void *user_data, int status)
Definition: async.h:113
Definition: private/logging.h:33