spandsp 3.0.0
v42.h
1/*
2 * SpanDSP - a series of DSP components for telephony
3 *
4 * v42.h
5 *
6 * Written by Steve Underwood <steveu@coppice.org>
7 *
8 * Copyright (C) 2003, 2011 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 Lesser General Public License version 2.1,
14 * as 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 Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26/*! \page v42_page V.42 modem error correction
27\section v42_page_sec_1 What does it do?
28The V.42 specification defines an error correcting protocol for PSTN modems, based on
29HDLC and LAP. This makes it similar to an X.25 link. A special variant of LAP, known
30as LAP-M, is defined in the V.42 specification. A means for modems to determine if the
31far modem supports V.42 is also defined.
32
33\section v42_page_sec_2 How does it work?
34*/
35
36#if !defined(_SPANDSP_V42_H_)
37#define _SPANDSP_V42_H_
38
39typedef struct v42_state_s v42_state_t;
40
41#if defined(__cplusplus)
42extern "C"
43{
44#endif
45
46SPAN_DECLARE(const char *) lapm_status_to_str(int status);
47
48SPAN_DECLARE(void) lapm_receive(void *user_data, const uint8_t *frame, int len, int ok);
49
50SPAN_DECLARE(void) v42_start(v42_state_t *s);
51
52SPAN_DECLARE(void) v42_stop(v42_state_t *s);
53
54/*! Set the busy status of the local end of a V.42 context.
55 \param s The V.42 context.
56 \param busy The new local end busy status.
57 \return The previous local end busy status.
58*/
59SPAN_DECLARE(int) v42_set_local_busy_status(v42_state_t *s, int busy);
60
61/*! Get the busy status of the far end of a V.42 context.
62 \param s The V.42 context.
63 \return The far end busy status.
64*/
65SPAN_DECLARE(int) v42_get_far_busy_status(v42_state_t *s);
66
67SPAN_DECLARE(void) v42_rx_bit(void *user_data, int bit);
68
69SPAN_DECLARE(int) v42_tx_bit(void *user_data);
70
71SPAN_DECLARE(void) v42_set_status_callback(v42_state_t *s, modem_status_func_t callback, void *user_data);
72
73/*! Get the logging context associated with a V.42 context.
74 \brief Get the logging context associated with a V.42 context.
75 \param s The V.42 context.
76 \return A pointer to the logging context */
77SPAN_DECLARE(logging_state_t *) v42_get_logging_state(v42_state_t *s);
78
79/*! Initialise a V.42 context.
80 \param s The V.42 context.
81 \param calling_party True if caller mode, else answerer mode.
82 \param detect True to perform the V.42 detection, else go straight into LAP.M
83 \param iframe_get A callback function to handle received frames of data.
84 \param iframe_put A callback function to get frames of data for transmission.
85 \param user_data An opaque pointer passed to the frame handler routines.
86 \return ???
87*/
88SPAN_DECLARE(v42_state_t *) v42_init(v42_state_t *s,
89 bool calling_party,
90 bool detect,
91 get_msg_func_t iframe_get,
92 put_msg_func_t iframe_put,
93 void *user_data);
94
95/*! Restart a V.42 context.
96 \param s The V.42 context.
97*/
98SPAN_DECLARE(void) v42_restart(v42_state_t *s);
99
100/*! Release a V.42 context.
101 \param s The V.42 context.
102 \return 0 if OK */
103SPAN_DECLARE(int) v42_release(v42_state_t *s);
104
105/*! Free a V.42 context.
106 \param s The V.42 context.
107 \return 0 if OK */
108SPAN_DECLARE(int) v42_free(v42_state_t *s);
109
110#if defined(__cplusplus)
111}
112#endif
113
114#endif
115/*- End of file ------------------------------------------------------------*/
int(* get_msg_func_t)(void *user_data, uint8_t *msg, int max_len)
Definition: async.h:98
void(* modem_status_func_t)(void *user_data, int status)
Definition: async.h:113
void(* put_msg_func_t)(void *user_data, const uint8_t *msg, int len)
Definition: async.h:95
Definition: private/logging.h:34
Definition: private/v42.h:133
bool detect
Definition: private/v42.h:138
bool calling_party
Definition: private/v42.h:135