00001 /* 00002 * SpanDSP - a series of DSP components for telephony 00003 * 00004 * v42.h 00005 * 00006 * Written by Steve Underwood <steveu@coppice.org> 00007 * 00008 * Copyright (C) 2003, 2011 Steve Underwood 00009 * 00010 * All rights reserved. 00011 * 00012 * This program is free software; you can redistribute it and/or modify 00013 * it under the terms of the GNU Lesser General Public License version 2.1, 00014 * as published by the Free Software Foundation. 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Lesser General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public 00022 * License along with this program; if not, write to the Free Software 00023 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00024 */ 00025 00026 /*! \page v42_page V.42 modem error correction 00027 \section v42_page_sec_1 What does it do? 00028 The V.42 specification defines an error correcting protocol for PSTN modems, based on 00029 HDLC and LAP. This makes it similar to an X.25 link. A special variant of LAP, known 00030 as LAP-M, is defined in the V.42 specification. A means for modems to determine if the 00031 far modem supports V.42 is also defined. 00032 00033 \section v42_page_sec_2 How does it work? 00034 */ 00035 00036 #if !defined(_SPANDSP_V42_H_) 00037 #define _SPANDSP_V42_H_ 00038 00039 typedef struct v42_state_s v42_state_t; 00040 00041 #if defined(__cplusplus) 00042 extern "C" 00043 { 00044 #endif 00045 00046 SPAN_DECLARE(const char *) lapm_status_to_str(int status); 00047 00048 SPAN_DECLARE_NONSTD(void) lapm_receive(void *user_data, const uint8_t *frame, int len, int ok); 00049 00050 SPAN_DECLARE(void) v42_start(v42_state_t *s); 00051 00052 SPAN_DECLARE(void) v42_stop(v42_state_t *s); 00053 00054 /*! Set the busy status of the local end of a V.42 context. 00055 \param s The V.42 context. 00056 \param busy The new local end busy status. 00057 \return The previous local end busy status. 00058 */ 00059 SPAN_DECLARE(int) v42_set_local_busy_status(v42_state_t *s, int busy); 00060 00061 /*! Get the busy status of the far end of a V.42 context. 00062 \param s The V.42 context. 00063 \return The far end busy status. 00064 */ 00065 SPAN_DECLARE(int) v42_get_far_busy_status(v42_state_t *s); 00066 00067 SPAN_DECLARE(void) v42_rx_bit(void *user_data, int bit); 00068 00069 SPAN_DECLARE(int) v42_tx_bit(void *user_data); 00070 00071 SPAN_DECLARE(void) v42_set_status_callback(v42_state_t *s, modem_status_func_t callback, void *user_data); 00072 00073 /*! Initialise a V.42 context. 00074 \param s The V.42 context. 00075 \param calling_party TRUE if caller mode, else answerer mode. 00076 \param detect TRUE to perform the V.42 detection, else go straight into LAP.M 00077 \param iframe_get A callback function to handle received frames of data. 00078 \param iframe_put A callback function to get frames of data for transmission. 00079 \param user_data An opaque pointer passed to the frame handler routines. 00080 \return ??? 00081 */ 00082 SPAN_DECLARE(v42_state_t *) v42_init(v42_state_t *s, 00083 int calling_party, 00084 int detect, 00085 get_msg_func_t iframe_get, 00086 put_msg_func_t iframe_put, 00087 void *user_data); 00088 00089 /*! Restart a V.42 context. 00090 \param s The V.42 context. 00091 */ 00092 SPAN_DECLARE(void) v42_restart(v42_state_t *s); 00093 00094 /*! Release a V.42 context. 00095 \param s The V.42 context. 00096 \return 0 if OK */ 00097 SPAN_DECLARE(void) v42_release(v42_state_t *s); 00098 00099 /*! Free a V.42 context. 00100 \param s The V.42 context. 00101 \return 0 if OK */ 00102 SPAN_DECLARE(void) v42_free(v42_state_t *s); 00103 00104 #if defined(__cplusplus) 00105 } 00106 #endif 00107 00108 #endif 00109 /*- End of file ------------------------------------------------------------*/
1.6.1