spandsp: v42.h Source File

spandsp 0.0.6

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
48 SPAN_DECLARE_NONSTD(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/*! Initialise a V.42 context.
74 \param s The V.42 context.
75 \param calling_party TRUE if caller mode, else answerer mode.
76 \param detect TRUE to perform the V.42 detection, else go straight into LAP.M
77 \param iframe_get A callback function to handle received frames of data.
78 \param iframe_put A callback function to get frames of data for transmission.
79 \param user_data An opaque pointer passed to the frame handler routines.
80 \return ???
81*/
82SPAN_DECLARE(v42_state_t *) v42_init(v42_state_t *s,
83 int calling_party,
84 int detect,
85 get_msg_func_t iframe_get,
86 put_msg_func_t iframe_put,
87 void *user_data);
88
89/*! Restart a V.42 context.
90 \param s The V.42 context.
91*/
92SPAN_DECLARE(void) v42_restart(v42_state_t *s);
93
94/*! Release a V.42 context.
95 \param s The V.42 context.
96 \return 0 if OK */
97SPAN_DECLARE(int) v42_release(v42_state_t *s);
98
99/*! Free a V.42 context.
100 \param s The V.42 context.
101 \return 0 if OK */
102SPAN_DECLARE(int) v42_free(v42_state_t *s);
103
104#if defined(__cplusplus)
105}
106#endif
107
108#endif
109/*- End of file ------------------------------------------------------------*/
get_msg_func_t
int(* get_msg_func_t)(void *user_data, uint8_t *msg, int max_len)
Definition async.h:96
modem_status_func_t
void(* modem_status_func_t)(void *user_data, int status)
Definition async.h:114
SPAN_DECLARE_NONSTD
SPAN_DECLARE_NONSTD(void) async_rx_put_bit(void *user_data
Accept a bit from a received serial bit stream.
put_msg_func_t
void(* put_msg_func_t)(void *user_data, const uint8_t *msg, int len)
Definition async.h:93
v42_state_s
Definition private/v42.h:133
v42_state_s::calling_party
int calling_party
Definition private/v42.h:135
v42_state_s::detect
int detect
Definition private/v42.h:138