00001 /* 00002 * SpanDSP - a series of DSP components for telephony 00003 * 00004 * private/v42.h 00005 * 00006 * Written by Steve Underwood <steveu@coppice.org> 00007 * 00008 * Copyright (C) 2003 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 * $Id: v42.h,v 1.1 2008/11/15 14:43:08 steveu Exp $ 00026 */ 00027 00028 #if !defined(_SPANDSP_PRIVATE_V42_H_) 00029 #define _SPANDSP_PRIVATE_V42_H_ 00030 00031 /*! 00032 LAP-M descriptor. This defines the working state for a single instance of LAP-M. 00033 */ 00034 struct lapm_state_s 00035 { 00036 int handle; 00037 hdlc_rx_state_t hdlc_rx; 00038 hdlc_tx_state_t hdlc_tx; 00039 00040 v42_frame_handler_t iframe_receive; 00041 void *iframe_receive_user_data; 00042 00043 v42_status_func_t status_callback; 00044 void *status_callback_user_data; 00045 00046 int state; 00047 int tx_waiting; 00048 int debug; 00049 /*! TRUE if originator. FALSE if answerer */ 00050 int we_are_originator; 00051 /*! Remote network type (unknown, answerer. originator) */ 00052 int peer_is_originator; 00053 /*! Next N(S) for transmission */ 00054 int next_tx_frame; 00055 /*! The last of our frames which the peer acknowledged */ 00056 int last_frame_peer_acknowledged; 00057 /*! Next N(R) for reception */ 00058 int next_expected_frame; 00059 /*! The last of the peer's frames which we acknowledged */ 00060 int last_frame_we_acknowledged; 00061 /*! TRUE if we sent an I or S frame with the F-bit set */ 00062 int solicit_f_bit; 00063 /*! Retransmission count */ 00064 int retransmissions; 00065 /*! TRUE if peer is busy */ 00066 int busy; 00067 00068 /*! Acknowledgement timer */ 00069 int t401_timer; 00070 /*! Reply delay timer - optional */ 00071 int t402_timer; 00072 /*! Inactivity timer - optional */ 00073 int t403_timer; 00074 /*! Maximum number of octets in an information field */ 00075 int n401; 00076 /*! Window size */ 00077 int window_size_k; 00078 00079 lapm_frame_queue_t *txqueue; 00080 lapm_frame_queue_t *tx_next; 00081 lapm_frame_queue_t *tx_last; 00082 queue_state_t *tx_queue; 00083 00084 span_sched_state_t sched; 00085 /*! \brief Error and flow logging control */ 00086 logging_state_t logging; 00087 }; 00088 00089 /*! 00090 V.42 descriptor. This defines the working state for a single instance of V.42. 00091 */ 00092 struct v42_state_s 00093 { 00094 /*! TRUE if we are the calling party, otherwise FALSE */ 00095 int caller; 00096 /*! TRUE if we should detect whether the far end is V.42 capable. FALSE if we go 00097 directly to protocol establishment */ 00098 int detect; 00099 00100 /*! Stage in negotiating V.42 support */ 00101 int rx_negotiation_step; 00102 int rxbits; 00103 int rxstream; 00104 int rxoks; 00105 int odp_seen; 00106 int txbits; 00107 int txstream; 00108 int txadps; 00109 /*! The LAP.M context */ 00110 lapm_state_t lapm; 00111 00112 /*! V.42 support detection timer */ 00113 int t400_timer; 00114 /*! \brief Error and flow logging control */ 00115 logging_state_t logging; 00116 }; 00117 00118 #endif 00119 /*- End of file ------------------------------------------------------------*/