spandsp 0.0.6
private/v8.h
00001 /*
00002  * SpanDSP - a series of DSP components for telephony
00003  *
00004  * private/v8.h - V.8 modem negotiation processing.
00005  *
00006  * Written by Steve Underwood <steveu@coppice.org>
00007  *
00008  * Copyright (C) 2004 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 #if !defined(_SPANDSP_PRIVATE_V8_H_)
00027 #define _SPANDSP_PRIVATE_V8_H_
00028 
00029 struct v8_state_s
00030 {
00031     /*! \brief TRUE if we are the calling party */
00032     int calling_party;
00033 
00034     /*! \brief A handler to process the V.8 signals */
00035     v8_result_handler_t *result_handler;
00036     /*! \brief An opaque pointer passed to result_handler */
00037     void *result_handler_user_data;
00038 
00039     /*! \brief The current state of the V.8 protocol */
00040     int state;
00041     int fsk_tx_on;
00042     int modem_connect_tone_tx_on;
00043     int negotiation_timer;
00044     int ci_timer;
00045     int ci_count;
00046     fsk_tx_state_t v21tx;
00047     fsk_rx_state_t v21rx;
00048     queue_state_t *tx_queue;
00049     modem_connect_tones_tx_state_t ansam_tx;
00050     modem_connect_tones_rx_state_t ansam_rx;
00051 
00052     v8_parms_t parms;
00053     v8_parms_t result;
00054 
00055     /*! \brief The number of modulation bytes to use when sending. */
00056     int modulation_bytes;
00057 
00058     /* V.8 data parsing */
00059     uint32_t bit_stream;
00060     int bit_cnt;
00061     /* Indicates the type of message coming up */
00062     int preamble_type;
00063     uint8_t rx_data[64];
00064     int rx_data_ptr;
00065     
00066     /*! \brief a reference copy of the last CM or JM message, used when
00067                testing for matches. */
00068     uint8_t cm_jm_data[64];
00069     int cm_jm_len;
00070     int got_cm_jm;
00071     int got_cj;
00072     int zero_byte_count;
00073     /*! \brief Error and flow logging control */
00074     logging_state_t logging;
00075 };
00076 
00077 #endif
00078 /*- End of file ------------------------------------------------------------*/