spandsp  0.0.6
private/v8.h
1 /*
2  * SpanDSP - a series of DSP components for telephony
3  *
4  * private/v8.h - V.8 modem negotiation processing.
5  *
6  * Written by Steve Underwood <steveu@coppice.org>
7  *
8  * Copyright (C) 2004 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 #if !defined(_SPANDSP_PRIVATE_V8_H_)
27 #define _SPANDSP_PRIVATE_V8_H_
28 
29 struct v8_state_s
30 {
31  /*! \brief TRUE if we are the calling party */
33 
34  /*! \brief A handler to process the V.8 signals */
35  v8_result_handler_t result_handler;
36  /*! \brief An opaque pointer passed to result_handler */
38 
39  /*! \brief The current state of the V.8 protocol */
40  int state;
41  int fsk_tx_on;
42  int modem_connect_tone_tx_on;
43  int negotiation_timer;
44  int ci_timer;
45  int ci_count;
46  fsk_tx_state_t v21tx;
47  fsk_rx_state_t v21rx;
48  queue_state_t *tx_queue;
51 
52  v8_parms_t parms;
53  v8_parms_t result;
54 
55  /*! \brief The number of modulation bytes to use when sending. */
57 
58  /* V.8 data parsing */
59  uint32_t bit_stream;
60  int bit_cnt;
61  /* Indicates the type of message coming up */
62  int preamble_type;
63  uint8_t rx_data[64];
64  int rx_data_ptr;
65 
66  /*! \brief a reference copy of the last CM or JM message, used when
67  testing for matches. */
68  uint8_t cm_jm_data[64];
69  int cm_jm_len;
70  int got_cm_jm;
71  int got_cj;
72  int zero_byte_count;
73  /*! \brief Error and flow logging control */
75 };
76 
77 #endif
78 /*- End of file ------------------------------------------------------------*/
MODEM_CONNECT_TONES_ANSAM_PR
@ MODEM_CONNECT_TONES_ANSAM_PR
The ANSam with phase reversals tone is a version of ANS_PR with 20% of 15Hz+-0.1Hz AM modulation,...
Definition: modem_connect_tones.h:72
tone_generate.h
queue_state_s
Definition: private/queue.h:34
modem_connect_tones.h
v8_state_s::result_handler
v8_result_handler_t result_handler
A handler to process the V.8 signals.
Definition: private/v8.h:35
v8_state_s::calling_party
int calling_party
TRUE if we are the calling party.
Definition: private/v8.h:32
v42bis_state_s
Definition: private/v42bis.h:116
v42bis_compress
int v42bis_compress(v42bis_state_t *ss, const uint8_t buf[], int len)
Definition: v42bis.c:428
span_log_test
int span_log_test(logging_state_t *s, int level)
Test if logging of a specified severity level is enabled.
Definition: logging.c:76
v8_state_s::state
int state
The current state of the V.8 protocol.
Definition: private/v8.h:40
SIG_STATUS_CARRIER_UP
@ SIG_STATUS_CARRIER_UP
The carrier signal is up. This merely indicates that carrier energy has been seen....
Definition: async.h:58
async.h
v8_state_s::logging
logging_state_t logging
Error and flow logging control.
Definition: private/v8.h:74
MODEM_CONNECT_TONES_ANSAM
@ MODEM_CONNECT_TONES_ANSAM
The ANSam tone is a version of ANS with 20% of 15Hz+-0.1Hz AM modulation, as per V....
Definition: modem_connect_tones.h:69
V8_STATUS_V8_CALL
@ V8_STATUS_V8_CALL
Definition: v8.h:108
v42bis_init
v42bis_state_t * v42bis_init(v42bis_state_t *s, int negotiated_p0, int negotiated_p1, int negotiated_p2, put_msg_func_t encode_handler, void *encode_user_data, int max_encode_len, put_msg_func_t decode_handler, void *decode_user_data, int max_decode_len)
Definition: v42bis.c:711
v8_log_supported_modulations
void v8_log_supported_modulations(v8_state_t *s, int modulation_schemes)
Log the list of supported modulations.
Definition: v8.c:270
V8_STATUS_V8_OFFERED
@ V8_STATUS_V8_OFFERED
Definition: v8.h:104
v8_init
v8_state_t * v8_init(v8_state_t *s, int calling_party, v8_parms_t *parms, v8_result_handler_t result_handler, void *user_data)
Initialise a V.8 context.
Definition: v8.c:1073
SPAN_DECLARE_NONSTD
SPAN_DECLARE_NONSTD(int) async_tx_get_bit(void *user_data)
Get the next bit of a transmitted serial bit stream.
complex.h
v8_state_s::result_handler_user_data
void * result_handler_user_data
An opaque pointer passed to result_handler.
Definition: private/v8.h:37
MODEM_CONNECT_TONES_NONE
@ MODEM_CONNECT_TONES_NONE
This is reported when a tone stops.
Definition: modem_connect_tones.h:59
queue_contents
int queue_contents(queue_state_t *s)
Check the contents of a queue.
Definition: queue.c:63
v42bis_state_s::logging
logging_state_t logging
Error and flow logging control.
Definition: private/v42bis.h:123
queue_read
int queue_read(queue_state_t *s, uint8_t *buf, int len)
Read bytes from a queue.
Definition: queue.c:130
MODEM_CONNECT_TONES_ANS_PR
@ MODEM_CONNECT_TONES_ANS_PR
ANS with phase reversals tone is a 2100Hz+-15Hz tone for 3.3s+-0.7s, with a 180 degree phase jump eve...
Definition: modem_connect_tones.h:67
SIG_STATUS_TRAINING_FAILED
@ SIG_STATUS_TRAINING_FAILED
The modem has failed to train.
Definition: async.h:67
V8_STATUS_IN_PROGRESS
@ V8_STATUS_IN_PROGRESS
Definition: v8.h:102
v8_state_s
Definition: private/v8.h:30
queue_init
queue_state_t * queue_init(queue_state_t *s, int len, int flags)
Initialise a queue.
Definition: queue.c:394
v8_release
int v8_release(v8_state_t *s)
Release a V.8 context.
Definition: v8.c:1095
modem_connect_tones_tx_state_s
Definition: private/modem_connect_tones.h:38
SIG_STATUS_CARRIER_DOWN
@ SIG_STATUS_CARRIER_DOWN
The carrier signal has dropped.
Definition: async.h:54
V8_STATUS_FAILED
@ V8_STATUS_FAILED
Definition: v8.h:112
queue.h
modem_connect_tones_rx_state_s
Definition: private/modem_connect_tones.h:58
span_log
int span_log(logging_state_t *s, int level, const char *format,...)
Generate a log entry.
Definition: logging.c:84
modem_connect_tones_tx_init
modem_connect_tones_tx_state_t * modem_connect_tones_tx_init(modem_connect_tones_tx_state_t *s, int tone_type)
Initialise an instance of the modem connect tones generator.
Definition: modem_connect_tones.c:253
v42bis_compress_flush
int v42bis_compress_flush(v42bis_state_t *ss)
Definition: v42bis.c:488
v42bis_decompress
int v42bis_decompress(v42bis_state_t *ss, const uint8_t buf[], int len)
Definition: v42bis.c:515
v42bis_decompress_flush
int v42bis_decompress_flush(v42bis_state_t *ss)
Definition: v42bis.c:691
fsk_rx_init
fsk_rx_state_t * fsk_rx_init(fsk_rx_state_t *s, const fsk_spec_t *spec, int framing_mode, put_bit_func_t put_bit, void *user_data)
Initialise an FSK modem receive context.
Definition: fsk.c:314
queue_write
int queue_write(queue_state_t *s, const uint8_t *buf, int len)
Write bytes to a queue.
Definition: queue.c:214
fsk_tx_init
fsk_tx_state_t * fsk_tx_init(fsk_tx_state_t *s, const fsk_spec_t *spec, get_bit_func_t get_bit, void *user_data)
Initialise an FSK modem transmit context.
Definition: fsk.c:153
V8_STATUS_NON_V8_CALL
@ V8_STATUS_NON_V8_CALL
Definition: v8.h:110
fsk.h
fsk_rx_signal_cutoff
void fsk_rx_signal_cutoff(fsk_rx_state_t *s, float cutoff)
Adjust an FSK modem receive context's carrier detect power threshold.
Definition: fsk.c:238
logging.h
queue_flush
void queue_flush(queue_state_t *s)
Flush the contents of a queue.
Definition: queue.c:74
v8_state_s::cm_jm_data
uint8_t cm_jm_data[64]
a reference copy of the last CM or JM message, used when testing for matches.
Definition: private/v8.h:68
span_log_buf
int span_log_buf(logging_state_t *s, int level, const char *tag, const uint8_t *buf, int len)
Generate a log entry displaying the contents of a buffer.
Definition: logging.c:158
v8.h
modem_connect_tones_rx_get
int modem_connect_tones_rx_get(modem_connect_tones_rx_state_t *s)
Test if a modem_connect tone has been detected.
Definition: modem_connect_tones.c:696
fsk_tx_state_s
Definition: private/fsk.h:34
modem_connect_tones_rx_init
modem_connect_tones_rx_state_t * modem_connect_tones_rx_init(modem_connect_tones_rx_state_t *s, int tone_type, tone_report_func_t tone_callback, void *user_data)
Initialise an instance of the modem connect tones detector.
Definition: modem_connect_tones.c:706
queue_free
int queue_free(queue_state_t *s)
Delete a queue.
Definition: queue.c:415
SIG_STATUS_TRAINING_SUCCEEDED
@ SIG_STATUS_TRAINING_SUCCEEDED
The modem has trained, and is ready for data exchange.
Definition: async.h:65
v8_free
int v8_free(v8_state_t *s)
Release a V.8 context.
Definition: v8.c:1101
logging_state_s
Definition: private/logging.h:34
v8_state_s::modulation_bytes
int modulation_bytes
The number of modulation bytes to use when sending.
Definition: private/v8.h:56
modem_connect_tones.h
fsk_rx_state_s
Definition: private/fsk.h:59
v8_parms_s
Definition: v8.h:118
SIG_STATUS_END_OF_DATA
@ SIG_STATUS_END_OF_DATA
The data stream has ended.
Definition: async.h:71
dds.h