T.31 now has basically functional T.38 mode - needs more testing, though

Various modules which lacked routines to get at the sub-structures now
have them.
The tests have been tweaked so they only access internals where essential.
This commit is contained in:
Steve Underwood committed 2013-01-01 23:07:55 +08:00
1 parent 8859eb0b23
commit c6c03827b8
99 files changed
+2662 -1274

No files matched your search

+12
View File
@@ -413,6 +413,12 @@ SPAN_DECLARE(int) adsi_rx(adsi_rx_state_t *s, const int16_t amp[], int len)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(logging_state_t *) adsi_rx_get_logging_state(adsi_rx_state_t *s)
{
return &s->logging;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(adsi_rx_state_t *) adsi_rx_init(adsi_rx_state_t *s,
int standard,
put_msg_func_t put_msg,
@@ -642,6 +648,12 @@ SPAN_DECLARE(int) adsi_tx_put_message(adsi_tx_state_t *s, const uint8_t *msg, in
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(logging_state_t *) adsi_tx_get_logging_state(adsi_tx_state_t *s)
{
return &s->logging;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(adsi_tx_state_t *) adsi_tx_init(adsi_tx_state_t *s, int standard)
{
if (s == NULL)
+115 -96
View File
@@ -898,7 +898,7 @@ static const char *at_cmd_dummy(at_state_t *s, const char *t)
static const char *at_cmd_A(at_state_t *s, const char *t)
{
/* V.250 6.3.5 - Answer (abortable) */
/* V.250 6.3.5 - Answer (abortable) */
t += 1;
if (!answer_call(s))
return NULL;
@@ -913,7 +913,7 @@ static const char *at_cmd_D(at_state_t *s, const char *t)
char num[100 + 1];
char ch;
/* V.250 6.3.1 - Dial (abortable) */
/* V.250 6.3.1 - Dial (abortable) */
at_reset_call_info(s);
s->do_hangup = FALSE;
s->silent_dial = FALSE;
@@ -1023,7 +1023,7 @@ static const char *at_cmd_E(at_state_t *s, const char *t)
{
int val;
/* V.250 6.2.4 - Command echo */
/* V.250 6.2.4 - Command echo */
t += 1;
if ((val = parse_num(&t, 1)) < 0)
return NULL;
@@ -1036,7 +1036,7 @@ static const char *at_cmd_H(at_state_t *s, const char *t)
{
int val;
/* V.250 6.3.6 - Hook control */
/* V.250 6.3.6 - Hook control */
t += 1;
if ((val = parse_num(&t, 1)) < 0)
return NULL;
@@ -1068,7 +1068,7 @@ static const char *at_cmd_I(at_state_t *s, const char *t)
{
int val;
/* V.250 6.1.3 - Request identification information */
/* V.250 6.1.3 - Request identification information */
/* N.B. The information supplied in response to an ATIx command is very
variable. It was widely used in different ways before the AT command
set was standardised by the ITU. */
@@ -1106,7 +1106,7 @@ static const char *at_cmd_M(at_state_t *s, const char *t)
{
int val;
/* V.250 6.3.14 - Monitor speaker mode */
/* V.250 6.3.14 - Monitor speaker mode */
/* Just absorb this command, as we have no speaker */
t += 1;
if ((val = parse_num(&t, 255)) < 0)
@@ -1120,7 +1120,7 @@ static const char *at_cmd_O(at_state_t *s, const char *t)
{
int val;
/* V.250 6.3.7 - Return to online data state */
/* V.250 6.3.7 - Return to online data state */
t += 1;
if ((val = parse_num(&t, 1)) < 0)
return NULL;
@@ -1135,7 +1135,7 @@ static const char *at_cmd_O(at_state_t *s, const char *t)
static const char *at_cmd_P(at_state_t *s, const char *t)
{
/* V.250 6.3.3 - Select pulse dialling (command) */
/* V.250 6.3.3 - Select pulse dialling (command) */
t += 1;
s->p.pulse_dial = TRUE;
return t;
@@ -1146,7 +1146,7 @@ static const char *at_cmd_Q(at_state_t *s, const char *t)
{
int val;
/* V.250 6.2.5 - Result code suppression */
/* V.250 6.2.5 - Result code suppression */
t += 1;
if ((val = parse_num(&t, 1)) < 0)
return NULL;
@@ -1165,7 +1165,7 @@ static const char *at_cmd_Q(at_state_t *s, const char *t)
static const char *at_cmd_S0(at_state_t *s, const char *t)
{
/* V.250 6.3.8 - Automatic answer */
/* V.250 6.3.8 - Automatic answer */
t += 2;
return s_reg_handler(s, t, 0);
}
@@ -1173,7 +1173,7 @@ static const char *at_cmd_S0(at_state_t *s, const char *t)
static const char *at_cmd_S10(at_state_t *s, const char *t)
{
/* V.250 6.3.12 - Automatic disconnect delay */
/* V.250 6.3.12 - Automatic disconnect delay */
t += 3;
return s_reg_handler(s, t, 10);
}
@@ -1181,7 +1181,7 @@ static const char *at_cmd_S10(at_state_t *s, const char *t)
static const char *at_cmd_S3(at_state_t *s, const char *t)
{
/* V.250 6.2.1 - Command line termination character */
/* V.250 6.2.1 - Command line termination character */
t += 2;
return s_reg_handler(s, t, 3);
}
@@ -1189,7 +1189,7 @@ static const char *at_cmd_S3(at_state_t *s, const char *t)
static const char *at_cmd_S4(at_state_t *s, const char *t)
{
/* V.250 6.2.2 - Response formatting character */
/* V.250 6.2.2 - Response formatting character */
t += 2;
return s_reg_handler(s, t, 4);
}
@@ -1197,7 +1197,7 @@ static const char *at_cmd_S4(at_state_t *s, const char *t)
static const char *at_cmd_S5(at_state_t *s, const char *t)
{
/* V.250 6.2.3 - Command line editing character */
/* V.250 6.2.3 - Command line editing character */
t += 2;
return s_reg_handler(s, t, 5);
}
@@ -1205,7 +1205,7 @@ static const char *at_cmd_S5(at_state_t *s, const char *t)
static const char *at_cmd_S6(at_state_t *s, const char *t)
{
/* V.250 6.3.9 - Pause before blind dialling */
/* V.250 6.3.9 - Pause before blind dialling */
t += 2;
return s_reg_handler(s, t, 6);
}
@@ -1213,7 +1213,7 @@ static const char *at_cmd_S6(at_state_t *s, const char *t)
static const char *at_cmd_S7(at_state_t *s, const char *t)
{
/* V.250 6.3.10 - Connection completion timeout */
/* V.250 6.3.10 - Connection completion timeout */
t += 2;
return s_reg_handler(s, t, 7);
}
@@ -1221,7 +1221,7 @@ static const char *at_cmd_S7(at_state_t *s, const char *t)
static const char *at_cmd_S8(at_state_t *s, const char *t)
{
/* V.250 6.3.11 - Comma dial modifier time */
/* V.250 6.3.11 - Comma dial modifier time */
t += 2;
return s_reg_handler(s, t, 8);
}
@@ -1229,7 +1229,7 @@ static const char *at_cmd_S8(at_state_t *s, const char *t)
static const char *at_cmd_T(at_state_t *s, const char *t)
{
/* V.250 6.3.2 - Select tone dialling (command) */
/* V.250 6.3.2 - Select tone dialling (command) */
t += 1;
s->p.pulse_dial = FALSE;
return t;
@@ -1240,7 +1240,7 @@ static const char *at_cmd_V(at_state_t *s, const char *t)
{
int val;
/* V.250 6.2.6 - DCE response format */
/* V.250 6.2.6 - DCE response format */
t += 1;
if ((val = parse_num(&t, 1)) < 0)
return NULL;
@@ -1278,7 +1278,7 @@ static const char *at_cmd_Z(at_state_t *s, const char *t)
{
int val;
/* V.250 6.1.1 - Reset to default configuration */
/* V.250 6.1.1 - Reset to default configuration */
t += 1;
if ((val = parse_num(&t, sizeof(profiles)/sizeof(profiles[0]) - 1)) < 0)
return NULL;
@@ -1295,7 +1295,7 @@ static const char *at_cmd_amp_C(at_state_t *s, const char *t)
{
int val;
/* V.250 6.2.8 - Circuit 109 (received line signal detector) behaviour */
/* V.250 6.2.8 - Circuit 109 (received line signal detector) behaviour */
/* We have no RLSD pin, so just absorb this. */
t += 2;
if ((val = parse_num(&t, 1)) < 0)
@@ -1309,7 +1309,7 @@ static const char *at_cmd_amp_D(at_state_t *s, const char *t)
{
int val;
/* V.250 6.2.9 - Circuit 108 (data terminal ready) behaviour */
/* V.250 6.2.9 - Circuit 108 (data terminal ready) behaviour */
t += 2;
if ((val = parse_num(&t, 2)) < 0)
return NULL;
@@ -1324,7 +1324,7 @@ static const char *at_cmd_amp_F(at_state_t *s, const char *t)
{
t += 2;
/* V.250 6.1.2 - Set to factory-defined configuration */
/* V.250 6.1.2 - Set to factory-defined configuration */
/* Just make sure we are on hook */
at_modem_control(s, AT_MODEM_CONTROL_HANGUP, NULL);
at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
@@ -1474,7 +1474,7 @@ static const char *at_cmd_plus_A8T(at_state_t *s, const char *t)
static const char *at_cmd_plus_ASTO(at_state_t *s, const char *t)
{
/* V.250 6.3.15 - Store telephone number */
/* V.250 6.3.15 - Store telephone number */
/* TODO: */
t += 5;
if (!parse_out(s, &t, NULL, 1, "+ASTO:", ""))
@@ -3250,7 +3250,7 @@ static const char *at_cmd_plus_CXT(at_state_t *s, const char *t)
static const char *at_cmd_plus_DR(at_state_t *s, const char *t)
{
/* V.250 6.6.2 - Data compression reporting */
/* V.250 6.6.2 - Data compression reporting */
/* TODO: */
t += 3;
if (!parse_out(s, &t, NULL, 1, "+DR:", ""))
@@ -3261,7 +3261,7 @@ static const char *at_cmd_plus_DR(at_state_t *s, const char *t)
static const char *at_cmd_plus_DS(at_state_t *s, const char *t)
{
/* V.250 6.6.1 - Data compression */
/* V.250 6.6.1 - Data compression */
/* TODO: */
t += 3;
if (!parse_out(s, &t, NULL, 1, "+DS:", ""))
@@ -3281,7 +3281,7 @@ static const char *at_cmd_plus_DS44(at_state_t *s, const char *t)
static const char *at_cmd_plus_EB(at_state_t *s, const char *t)
{
/* V.250 6.5.2 - Break handling in error control operation */
/* V.250 6.5.2 - Break handling in error control operation */
/* TODO: */
t += 3;
if (!parse_out(s, &t, NULL, 1, "+EB:", ""))
@@ -3292,7 +3292,7 @@ static const char *at_cmd_plus_EB(at_state_t *s, const char *t)
static const char *at_cmd_plus_EFCS(at_state_t *s, const char *t)
{
/* V.250 6.5.4 - 32-bit frame check sequence */
/* V.250 6.5.4 - 32-bit frame check sequence */
/* TODO: */
t += 5;
if (!parse_out(s, &t, NULL, 2, "+EFCS:", "(0-2)"))
@@ -3303,7 +3303,7 @@ static const char *at_cmd_plus_EFCS(at_state_t *s, const char *t)
static const char *at_cmd_plus_EFRAM(at_state_t *s, const char *t)
{
/* V.250 6.5.8 - Frame length */
/* V.250 6.5.8 - Frame length */
/* TODO: */
t += 6;
if (!parse_2_out(s, &t, NULL, 65535, NULL, 65535, "+EFRAM:", "(1-65535),(1-65535)"))
@@ -3314,7 +3314,7 @@ static const char *at_cmd_plus_EFRAM(at_state_t *s, const char *t)
static const char *at_cmd_plus_ER(at_state_t *s, const char *t)
{
/* V.250 6.5.5 - Error control reporting */
/* V.250 6.5.5 - Error control reporting */
/* 0 Error control reporting disabled (no +ER intermediate result code transmitted)
1 Error control reporting enabled (+ER intermediate result code transmitted) */
/* TODO: */
@@ -3333,7 +3333,7 @@ static const char *at_cmd_plus_ES(at_state_t *s, const char *t)
};
int *locations[3];
/* V.250 6.5.1 - Error control selection */
/* V.250 6.5.1 - Error control selection */
/* orig_rqst
0: Direct mode
@@ -3403,7 +3403,7 @@ static const char *at_cmd_plus_ESA(at_state_t *s, const char *t)
static const char *at_cmd_plus_ESR(at_state_t *s, const char *t)
{
/* V.250 6.5.3 - Selective repeat */
/* V.250 6.5.3 - Selective repeat */
/* TODO: */
t += 4;
return t;
@@ -3412,7 +3412,7 @@ static const char *at_cmd_plus_ESR(at_state_t *s, const char *t)
static const char *at_cmd_plus_ETBM(at_state_t *s, const char *t)
{
/* V.250 6.5.6 - Call termination buffer management */
/* V.250 6.5.6 - Call termination buffer management */
/* TODO: */
t += 5;
if (!parse_2_out(s, &t, NULL, 2, NULL, 2, "+ETBM:", "(0-2),(0-2),(0-30)"))
@@ -3423,7 +3423,7 @@ static const char *at_cmd_plus_ETBM(at_state_t *s, const char *t)
static const char *at_cmd_plus_EWIND(at_state_t *s, const char *t)
{
/* V.250 6.5.7 - Window size */
/* V.250 6.5.7 - Window size */
/* TODO: */
t += 6;
if (!parse_2_out(s, &t, &s->rx_window, 127, &s->tx_window, 127, "+EWIND:", "(1-127),(1-127)"))
@@ -3473,7 +3473,7 @@ static const char *at_cmd_plus_FAP(at_state_t *s, const char *t)
static const char *at_cmd_plus_FAR(at_state_t *s, const char *t)
{
/* T.31 8.5.1 - Adaptive reception control */
/* T.31 8.5.1 - Adaptive reception control */
t += 4;
if (!parse_out(s, &t, &s->p.adaptive_receive, 1, NULL, "0,1"))
return NULL;
@@ -3519,7 +3519,7 @@ static const char *at_cmd_plus_FCC(at_state_t *s, const char *t)
static const char *at_cmd_plus_FCL(at_state_t *s, const char *t)
{
/* T.31 8.5.2 - Carrier loss timeout */
/* T.31 8.5.2 - Carrier loss timeout */
t += 4;
if (!parse_out(s, &t, &s->carrier_loss_timeout, 255, NULL, "(0-255)"))
return NULL;
@@ -3529,7 +3529,7 @@ static const char *at_cmd_plus_FCL(at_state_t *s, const char *t)
static const char *at_cmd_plus_FCLASS(at_state_t *s, const char *t)
{
/* T.31 8.2 - Capabilities identification and control */
/* T.31 8.2 - Capabilities identification and control */
t += 7;
/* T.31 says the reply string should be "0,1.0", however making
it "0,1,1.0" makes things compatible with a lot more software
@@ -3578,7 +3578,7 @@ static const char *at_cmd_plus_FCT(at_state_t *s, const char *t)
static const char *at_cmd_plus_FDD(at_state_t *s, const char *t)
{
/* T.31 8.5.3 - Double escape character replacement */
/* T.31 8.5.3 - Double escape character replacement */
t += 4;
if (!parse_out(s, &t, &s->p.double_escape, 1, NULL, "(0,1)"))
return NULL;
@@ -3668,7 +3668,7 @@ static const char *at_cmd_plus_FIS(at_state_t *s, const char *t)
static const char *at_cmd_plus_FIT(at_state_t *s, const char *t)
{
/* T.31 8.5.4 - DTE inactivity timeout */
/* T.31 8.5.4 - DTE inactivity timeout */
t += 4;
if (!parse_2_out(s, &t, &s->dte_inactivity_timeout, 255, &s->dte_inactivity_action, 1, "+FIT:", "(0-255),(0-1)"))
return NULL;
@@ -3696,10 +3696,16 @@ static const char *at_cmd_plus_FLI(at_state_t *s, const char *t)
static const char *at_cmd_plus_FLO(at_state_t *s, const char *t)
{
/* T.31 Annex A */
/* Implement something similar to the V.250 +IFC command */
/* TODO: */
/* T.31 Annex A */
/* Implement something similar to the V.250 +IFC command */
/* 0: None.
1: XON/XOFF.
2: Hardware (default) */
t += 4;
span_log(&s->logging, SPAN_LOG_FLOW, "+FLO received\n");
if (!parse_out(s, &t, &s->dte_dce_flow_control, 2, "+FLO:", "(0-2)"))
return NULL;
s->dce_dte_flow_control = s->dte_dce_flow_control;
return t;
}
/*- End of function --------------------------------------------------------*/
@@ -3715,7 +3721,7 @@ static const char *at_cmd_plus_FLP(at_state_t *s, const char *t)
static const char *at_cmd_plus_FMI(at_state_t *s, const char *t)
{
/* T.31 says to duplicate +GMI */
/* T.31 says to duplicate +GMI */
t += 4;
if (t[0] == '?')
{
@@ -3728,7 +3734,7 @@ static const char *at_cmd_plus_FMI(at_state_t *s, const char *t)
static const char *at_cmd_plus_FMM(at_state_t *s, const char *t)
{
/* T.31 says to duplicate +GMM */
/* T.31 says to duplicate +GMM */
t += 4;
if (t[0] == '?')
{
@@ -3741,7 +3747,7 @@ static const char *at_cmd_plus_FMM(at_state_t *s, const char *t)
static const char *at_cmd_plus_FMR(at_state_t *s, const char *t)
{
/* T.31 says to duplicate +GMR */
/* T.31 says to duplicate +GMR */
t += 4;
if (t[0] == '?')
{
@@ -3810,8 +3816,8 @@ static const char *at_cmd_plus_FPP(at_state_t *s, const char *t)
static const char *at_cmd_plus_FPR(at_state_t *s, const char *t)
{
/* T.31 Annex A */
/* Implement something similar to the V.250 +IPR command */
/* T.31 Annex A */
/* Implement something similar to the V.250 +IPR command */
t += 4;
if (!parse_out(s, &t, &s->dte_rate, 115200, NULL, "115200"))
return NULL;
@@ -3837,7 +3843,7 @@ static const char *at_cmd_plus_FPW(at_state_t *s, const char *t)
static const char *at_cmd_plus_FRH(at_state_t *s, const char *t)
{
/* T.31 8.3.6 - HDLC receive */
/* T.31 8.3.6 - HDLC receive */
if (!process_class1_cmd(s, &t))
return NULL;
return t;
@@ -3846,7 +3852,7 @@ static const char *at_cmd_plus_FRH(at_state_t *s, const char *t)
static const char *at_cmd_plus_FRM(at_state_t *s, const char *t)
{
/* T.31 8.3.4 - Facsimile receive */
/* T.31 8.3.4 - Facsimile receive */
if (!process_class1_cmd(s, &t))
return NULL;
return t;
@@ -3864,7 +3870,7 @@ static const char *at_cmd_plus_FRQ(at_state_t *s, const char *t)
static const char *at_cmd_plus_FRS(at_state_t *s, const char *t)
{
/* T.31 8.3.2 - Receive silence */
/* T.31 8.3.2 - Receive silence */
if (!process_class1_cmd(s, &t))
return NULL;
return t;
@@ -3900,7 +3906,7 @@ static const char *at_cmd_plus_FSP(at_state_t *s, const char *t)
static const char *at_cmd_plus_FTH(at_state_t *s, const char *t)
{
/* T.31 8.3.5 - HDLC transmit */
/* T.31 8.3.5 - HDLC transmit */
if (!process_class1_cmd(s, &t))
return NULL;
return t;
@@ -3909,7 +3915,7 @@ static const char *at_cmd_plus_FTH(at_state_t *s, const char *t)
static const char *at_cmd_plus_FTM(at_state_t *s, const char *t)
{
/* T.31 8.3.3 - Facsimile transmit */
/* T.31 8.3.3 - Facsimile transmit */
if (!process_class1_cmd(s, &t))
return NULL;
return t;
@@ -3918,7 +3924,7 @@ static const char *at_cmd_plus_FTM(at_state_t *s, const char *t)
static const char *at_cmd_plus_FTS(at_state_t *s, const char *t)
{
/* T.31 8.3.1 - Transmit silence */
/* T.31 8.3.1 - Transmit silence */
if (!process_class1_cmd(s, &t))
return NULL;
return t;
@@ -3947,7 +3953,7 @@ static const char *at_cmd_plus_GCAP(at_state_t *s, const char *t)
static const char *at_cmd_plus_GCI(at_state_t *s, const char *t)
{
/* V.250 6.1.10 - Country of installation, */
/* V.250 6.1.10 - Country of installation, */
t += 4;
if (!parse_hex_out(s, &t, &s->country_of_installation, 255, "+GCI:", "(00-FF)"))
return NULL;
@@ -3957,7 +3963,7 @@ static const char *at_cmd_plus_GCI(at_state_t *s, const char *t)
static const char *at_cmd_plus_GMI(at_state_t *s, const char *t)
{
/* V.250 6.1.4 - Request manufacturer identification */
/* V.250 6.1.4 - Request manufacturer identification */
t += 4;
if (t[0] == '?')
{
@@ -3970,7 +3976,7 @@ static const char *at_cmd_plus_GMI(at_state_t *s, const char *t)
static const char *at_cmd_plus_GMM(at_state_t *s, const char *t)
{
/* V.250 6.1.5 - Request model identification */
/* V.250 6.1.5 - Request model identification */
t += 4;
if (t[0] == '?')
{
@@ -3983,7 +3989,7 @@ static const char *at_cmd_plus_GMM(at_state_t *s, const char *t)
static const char *at_cmd_plus_GMR(at_state_t *s, const char *t)
{
/* V.250 6.1.6 - Request revision identification */
/* V.250 6.1.6 - Request revision identification */
t += 4;
if (t[0] == '?')
{
@@ -3996,7 +4002,7 @@ static const char *at_cmd_plus_GMR(at_state_t *s, const char *t)
static const char *at_cmd_plus_GOI(at_state_t *s, const char *t)
{
/* V.250 6.1.8 - Request global object identification */
/* V.250 6.1.8 - Request global object identification */
/* TODO: */
t += 4;
if (t[0] == '?')
@@ -4010,7 +4016,7 @@ static const char *at_cmd_plus_GOI(at_state_t *s, const char *t)
static const char *at_cmd_plus_GSN(at_state_t *s, const char *t)
{
/* V.250 6.1.7 - Request product serial number identification */
/* V.250 6.1.7 - Request product serial number identification */
/* TODO: */
t += 4;
if (t[0] == '?')
@@ -4090,7 +4096,7 @@ static const char *at_cmd_plus_IBM(at_state_t *s, const char *t)
static const char *at_cmd_plus_ICF(at_state_t *s, const char *t)
{
/* V.250 6.2.11 - DTE-DCE character framing */
/* V.250 6.2.11 - DTE-DCE character framing */
t += 4;
/* Character format
0: auto detect
@@ -4114,7 +4120,7 @@ static const char *at_cmd_plus_ICF(at_state_t *s, const char *t)
static const char *at_cmd_plus_ICLOK(at_state_t *s, const char *t)
{
/* V.250 6.2.14 - Select sync transmit clock source */
/* V.250 6.2.14 - Select sync transmit clock source */
t += 6;
if (!parse_out(s, &t, &s->sync_tx_clock_source, 2, "+ICLOK:", "(0-2)"))
return NULL;
@@ -4124,7 +4130,7 @@ static const char *at_cmd_plus_ICLOK(at_state_t *s, const char *t)
static const char *at_cmd_plus_IDSR(at_state_t *s, const char *t)
{
/* V.250 6.2.16 - Select data set ready option */
/* V.250 6.2.16 - Select data set ready option */
t += 5;
if (!parse_out(s, &t, &s->dsr_option, 2, "+IDSR:", "(0-2)"))
return NULL;
@@ -4134,16 +4140,21 @@ static const char *at_cmd_plus_IDSR(at_state_t *s, const char *t)
static const char *at_cmd_plus_IFC(at_state_t *s, const char *t)
{
/* V.250 6.2.12 - DTE-DCE local flow control */
/* TODO: */
/* V.250 6.2.12 - DTE-DCE local flow control */
/* 0: None.
1: XON/XOFF.
2: Hardware (default) */
span_log(&s->logging, SPAN_LOG_FLOW, "+IFC received\n");
t += 4;
if (!parse_2_out(s, &t, &s->dte_dce_flow_control, 2, &s->dce_dte_flow_control, 2, "+IFC:", "(0-2),(0-2)"))
return NULL;
return t;
}
/*- End of function --------------------------------------------------------*/
static const char *at_cmd_plus_ILRR(at_state_t *s, const char *t)
{
/* V.250 6.2.13 - DTE-DCE local rate reporting */
/* V.250 6.2.13 - DTE-DCE local rate reporting */
/* TODO: */
t += 5;
return t;
@@ -4152,7 +4163,7 @@ static const char *at_cmd_plus_ILRR(at_state_t *s, const char *t)
static const char *at_cmd_plus_ILSD(at_state_t *s, const char *t)
{
/* V.250 6.2.15 - Select long space disconnect option */
/* V.250 6.2.15 - Select long space disconnect option */
t += 5;
if (!parse_out(s, &t, &s->long_space_disconnect_option, 2, "+ILSD:", "(0,1)"))
return NULL;
@@ -4162,7 +4173,7 @@ static const char *at_cmd_plus_ILSD(at_state_t *s, const char *t)
static const char *at_cmd_plus_IPR(at_state_t *s, const char *t)
{
/* V.250 6.2.10 - Fixed DTE rate */
/* V.250 6.2.10 - Fixed DTE rate */
/* TODO: */
t += 4;
if (!parse_out(s, &t, &s->dte_rate, 115200, "+IPR:", "(115200),(115200)"))
@@ -4173,7 +4184,7 @@ static const char *at_cmd_plus_IPR(at_state_t *s, const char *t)
static const char *at_cmd_plus_IRTS(at_state_t *s, const char *t)
{
/* V.250 6.2.17 - Select synchronous mode RTS option */
/* V.250 6.2.17 - Select synchronous mode RTS option */
t += 5;
if (!parse_out(s, &t, NULL, 1, "+IRTS:", "(0,1)"))
return NULL;
@@ -4192,7 +4203,7 @@ static const char *at_cmd_plus_ITF(at_state_t *s, const char *t)
static const char *at_cmd_plus_MA(at_state_t *s, const char *t)
{
/* V.250 6.4.2 - Modulation automode control */
/* V.250 6.4.2 - Modulation automode control */
/* TODO: */
t += 3;
return t;
@@ -4201,9 +4212,9 @@ static const char *at_cmd_plus_MA(at_state_t *s, const char *t)
static const char *at_cmd_plus_MR(at_state_t *s, const char *t)
{
/* V.250 6.4.3 - Modulation reporting control */
/* 0 Disables reporting of modulation connection (+MCR: and +MRR: are not transmitted)
1 Enables reporting of modulation connection (+MCR: and +MRR: are transmitted) */
/* V.250 6.4.3 - Modulation reporting control */
/* 0: Disables reporting of modulation connection (+MCR: and +MRR: are not transmitted)
1: Enables reporting of modulation connection (+MCR: and +MRR: are transmitted) */
/* TODO: */
t += 3;
if (!parse_out(s, &t, NULL, 1, "+MR:", "(0,1)"))
@@ -4214,7 +4225,7 @@ static const char *at_cmd_plus_MR(at_state_t *s, const char *t)
static const char *at_cmd_plus_MS(at_state_t *s, const char *t)
{
/* V.250 6.4.1 - Modulation selection */
/* V.250 6.4.1 - Modulation selection */
/* TODO: */
t += 3;
return t;
@@ -4223,7 +4234,7 @@ static const char *at_cmd_plus_MS(at_state_t *s, const char *t)
static const char *at_cmd_plus_MSC(at_state_t *s, const char *t)
{
/* V.250 6.4.8 - Seamless rate change enable */
/* V.250 6.4.8 - Seamless rate change enable */
/* 0 Disables V.34 seamless rate change
1 Enables V.34 seamless rate change */
/* TODO: */
@@ -4236,7 +4247,7 @@ static const char *at_cmd_plus_MSC(at_state_t *s, const char *t)
static const char *at_cmd_plus_MV18AM(at_state_t *s, const char *t)
{
/* V.250 6.4.6 - V.18 answering message editing */
/* V.250 6.4.6 - V.18 answering message editing */
/* TODO: */
t += 7;
return t;
@@ -4245,7 +4256,7 @@ static const char *at_cmd_plus_MV18AM(at_state_t *s, const char *t)
static const char *at_cmd_plus_MV18P(at_state_t *s, const char *t)
{
/* V.250 6.4.7 - Order of probes */
/* V.250 6.4.7 - Order of probes */
/* 2 Send probe message in 5-bit (Baudot) mode
3 Send probe message in DTMF mode
4 Send probe message in EDT mode
@@ -4262,7 +4273,7 @@ static const char *at_cmd_plus_MV18P(at_state_t *s, const char *t)
static const char *at_cmd_plus_MV18R(at_state_t *s, const char *t)
{
/* V.250 6.4.5 - V.18 reporting control */
/* V.250 6.4.5 - V.18 reporting control */
/* TODO: */
t += 6;
if (!parse_out(s, &t, NULL, 1, "+MV18R:", "(0,1)"))
@@ -4273,7 +4284,7 @@ static const char *at_cmd_plus_MV18R(at_state_t *s, const char *t)
static const char *at_cmd_plus_MV18S(at_state_t *s, const char *t)
{
/* V.250 6.4.4 - V.18 selection */
/* V.250 6.4.4 - V.18 selection */
/* mode:
0 Disables V.18 operation
1 V.18 operation, auto detect mode
@@ -4536,7 +4547,7 @@ static const char *at_cmd_plus_SVT(at_state_t *s, const char *t)
static const char *at_cmd_plus_TADR(at_state_t *s, const char *t)
{
/* V.250 6.7.2.9 - Local V.54 address */
/* V.250 6.7.2.9 - Local V.54 address */
/* TODO: */
t += 5;
return t;
@@ -4545,7 +4556,7 @@ static const char *at_cmd_plus_TADR(at_state_t *s, const char *t)
static const char *at_cmd_plus_TAL(at_state_t *s, const char *t)
{
/* V.250 6.7.2.15 - Local analogue loop */
/* V.250 6.7.2.15 - Local analogue loop */
/* Action
0 Disable analogue loop
1 Enable analogue loop
@@ -4562,7 +4573,7 @@ static const char *at_cmd_plus_TAL(at_state_t *s, const char *t)
static const char *at_cmd_plus_TALS(at_state_t *s, const char *t)
{
/* V.250 6.7.2.6 - Analogue loop status */
/* V.250 6.7.2.6 - Analogue loop status */
/* 0 Inactive
1 V.24 circuit 141 invoked
2 Front panel invoked
@@ -4577,7 +4588,7 @@ static const char *at_cmd_plus_TALS(at_state_t *s, const char *t)
static const char *at_cmd_plus_TDLS(at_state_t *s, const char *t)
{
/* V.250 6.7.2.7 - Local digital loop status */
/* V.250 6.7.2.7 - Local digital loop status */
/* 0 Disabled
1 Enabled, inactive
2 Front panel invoked
@@ -4593,7 +4604,7 @@ static const char *at_cmd_plus_TDLS(at_state_t *s, const char *t)
static const char *at_cmd_plus_TE140(at_state_t *s, const char *t)
{
/* V.250 6.7.2.1 - Enable ckt 140 */
/* V.250 6.7.2.1 - Enable ckt 140 */
/* 0 Disabled
1 Enabled */
/* TODO: */
@@ -4606,7 +4617,7 @@ static const char *at_cmd_plus_TE140(at_state_t *s, const char *t)
static const char *at_cmd_plus_TE141(at_state_t *s, const char *t)
{
/* V.250 6.7.2.2 - Enable ckt 141 */
/* V.250 6.7.2.2 - Enable ckt 141 */
/* 0 Response is disabled
1 Response is enabled */
/* TODO: */
@@ -4619,7 +4630,7 @@ static const char *at_cmd_plus_TE141(at_state_t *s, const char *t)
static const char *at_cmd_plus_TEPAL(at_state_t *s, const char *t)
{
/* V.250 6.7.2.5 - Enable front panel analogue loop */
/* V.250 6.7.2.5 - Enable front panel analogue loop */
/* 0 Disabled
1 Enabled */
/* TODO: */
@@ -4632,7 +4643,7 @@ static const char *at_cmd_plus_TEPAL(at_state_t *s, const char *t)
static const char *at_cmd_plus_TEPDL(at_state_t *s, const char *t)
{
/* V.250 6.7.2.4 - Enable front panel RDL */
/* V.250 6.7.2.4 - Enable front panel RDL */
/* 0 Disabled
1 Enabled */
/* TODO: */
@@ -4645,7 +4656,7 @@ static const char *at_cmd_plus_TEPDL(at_state_t *s, const char *t)
static const char *at_cmd_plus_TERDL(at_state_t *s, const char *t)
{
/* V.250 6.7.2.3 - Enable RDL from remote */
/* V.250 6.7.2.3 - Enable RDL from remote */
/* 0 Local DCE will ignore command from remote
1 Local DCE will obey command from remote */
/* TODO: */
@@ -4680,7 +4691,7 @@ static const char *at_cmd_plus_TMO(at_state_t *s, const char *t)
static const char *at_cmd_plus_TMODE(at_state_t *s, const char *t)
{
/* V.250 6.7.2.10 - Set V.54 mode */
/* V.250 6.7.2.10 - Set V.54 mode */
/* TODO: */
t += 6;
if (!parse_out(s, &t, NULL, 1, "+TMODE:", "(0,1)"))
@@ -4691,7 +4702,7 @@ static const char *at_cmd_plus_TMODE(at_state_t *s, const char *t)
static const char *at_cmd_plus_TNUM(at_state_t *s, const char *t)
{
/* V.250 6.7.2.12 - Errored bit and block counts */
/* V.250 6.7.2.12 - Errored bit and block counts */
/* TODO: */
t += 5;
return t;
@@ -4700,7 +4711,7 @@ static const char *at_cmd_plus_TNUM(at_state_t *s, const char *t)
static const char *at_cmd_plus_TRDL(at_state_t *s, const char *t)
{
/* V.250 6.7.2.14 - Request remote digital loop */
/* V.250 6.7.2.14 - Request remote digital loop */
/* 0 Stop RDL
1 Start RDL */
/* TODO: */
@@ -4713,7 +4724,7 @@ static const char *at_cmd_plus_TRDL(at_state_t *s, const char *t)
static const char *at_cmd_plus_TRDLS(at_state_t *s, const char *t)
{
/* V.250 6.7.2.8 - Remote digital loop status */
/* V.250 6.7.2.8 - Remote digital loop status */
/* TODO: */
t += 6;
return t;
@@ -4722,7 +4733,7 @@ static const char *at_cmd_plus_TRDLS(at_state_t *s, const char *t)
static const char *at_cmd_plus_TRES(at_state_t *s, const char *t)
{
/* V.250 6.7.2.17 - Self test result */
/* V.250 6.7.2.17 - Self test result */
/* 0 No test
1 Pass
2 Fail */
@@ -4736,7 +4747,7 @@ static const char *at_cmd_plus_TRES(at_state_t *s, const char *t)
static const char *at_cmd_plus_TSELF(at_state_t *s, const char *t)
{
/* V.250 6.7.2.16 - Self test */
/* V.250 6.7.2.16 - Self test */
/* 0 Intrusive full test
1 Safe partial test */
/* TODO: */
@@ -4749,7 +4760,7 @@ static const char *at_cmd_plus_TSELF(at_state_t *s, const char *t)
static const char *at_cmd_plus_TTER(at_state_t *s, const char *t)
{
/* V.250 6.7.2.11 - Test error rate */
/* V.250 6.7.2.11 - Test error rate */
/* TODO: */
t += 5;
if (!parse_2_out(s, &t, NULL, 65535, NULL, 65535, "+TTER:", "(0-65535),(0-65535)"))
@@ -5057,7 +5068,7 @@ static const char *at_cmd_plus_VSP(at_state_t *s, const char *t)
static const char *at_cmd_plus_VTA(at_state_t *s, const char *t)
{
/* V.253 10.5.4 - Train acoustic echo-canceller */
/* V.253 10.5.4 - Train acoustic echo-canceller */
/* TODO: */
t += 4;
return t;
@@ -5084,7 +5095,7 @@ static const char *at_cmd_plus_VTER(at_state_t *s, const char *t)
static const char *at_cmd_plus_VTH(at_state_t *s, const char *t)
{
/* V.253 10.5.5 - Train line echo-canceller */
/* V.253 10.5.5 - Train line echo-canceller */
/* TODO: */
t += 4;
return t;
@@ -5562,6 +5573,12 @@ SPAN_DECLARE(void) at_set_class1_handler(at_state_t *s, at_class1_handler_t hand
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(logging_state_t *) at_get_logging_state(at_state_t *s)
{
return &s->logging;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(at_state_t *) at_init(at_state_t *s,
at_tx_handler_t at_tx_handler,
void *at_tx_user_data,
@@ -5583,6 +5600,8 @@ SPAN_DECLARE(at_state_t *) at_init(at_state_t *s,
s->call_id = NULL;
s->local_id = NULL;
s->display_call_info = 0;
s->dte_dce_flow_control = 2;
s->dce_dte_flow_control = 2;
at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
s->p = profiles[0];
return s;
+93 -93
View File
@@ -38,9 +38,9 @@
const char *wordlist[] =
{
" ", /* Dummy to absorb spaces in commands */
"&C", /* V.250 6.2.8 - Circuit 109 (received line signal detector), behaviour */
"&D", /* V.250 6.2.9 - Circuit 108 (data terminal ready) behaviour */
"&F", /* V.250 6.1.2 - Set to factory-defined configuration */
"&C", /* V.250 6.2.8 - Circuit 109 (received line signal detector), behaviour */
"&D", /* V.250 6.2.9 - Circuit 108 (data terminal ready) behaviour */
"&F", /* V.250 6.1.2 - Set to factory-defined configuration */
"+A8A", /* V.251 6.3 - V.8 calling tone indication */
"+A8C", /* V.251 6.2 - V.8 answer signal indication */
"+A8E", /* V.251 5.1 - V.8 and V.8bis operation controls */
@@ -49,7 +49,7 @@ const char *wordlist[] =
"+A8M", /* V.251 5.2 - Send V.8 menu signals */
"+A8R", /* V.251 6.6 - V.8bis signal and message reporting */
"+A8T", /* V.251 5.3 - Send V.8bis signal and/or message(s) */
"+ASTO", /* V.250 6.3.15 - Store telephone number */
"+ASTO", /* V.250 6.3.15 - Store telephone number */
"+CAAP", /* 3GPP TS 27.007 7.25 - Automatic answer for eMLPP Service */
"+CACM", /* 3GPP TS 27.007 8.25 - Accumulated call meter */
"+CACSP", /* 3GPP TS 27.007 11.1.7 - Voice Group or Voice Broadcast Call State Attribute Presentation */
@@ -217,33 +217,33 @@ const char *wordlist[] =
"+CVHU", /* 3GPP TS 27.007 6.20 - Voice Hangup Control */
"+CVIB", /* 3GPP TS 27.007 8.22 - Vibrator mode */
"+CXT", /* IS-99 5.6 - Cellular extension */
"+DR", /* V.250 6.6.2 - Data compression reporting */
"+DS", /* V.250 6.6.1 - Data compression */
"+DR", /* V.250 6.6.2 - Data compression reporting */
"+DS", /* V.250 6.6.1 - Data compression */
"+DS44", /* V.250 6.6.2 - V.44 data compression */
"+EB", /* V.250 6.5.2 - Break handling in error control operation */
"+EFCS", /* V.250 6.5.4 - 32-bit frame check sequence */
"+EFRAM", /* V.250 6.5.8 - Frame length */
"+ER", /* V.250 6.5.5 - Error control reporting */
"+ES", /* V.250 6.5.1 - Error control selection */
"+ESA", /* V.80 8.2 - Synchronous access mode configuration */
"+ESR", /* V.250 6.5.3 - Selective repeat */
"+ETBM", /* V.250 6.5.6 - Call termination buffer management */
"+EWIND", /* V.250 6.5.7 - Window size */
"+EB", /* V.250 6.5.2 - Break handling in error control operation */
"+EFCS", /* V.250 6.5.4 - 32-bit frame check sequence */
"+EFRAM", /* V.250 6.5.8 - Frame length */
"+ER", /* V.250 6.5.5 - Error control reporting */
"+ES", /* V.250 6.5.1 - Error control selection */
"+ESA", /* V.80 8.2 - Synchronous access mode configuration */
"+ESR", /* V.250 6.5.3 - Selective repeat */
"+ETBM", /* V.250 6.5.6 - Call termination buffer management */
"+EWIND", /* V.250 6.5.7 - Window size */
"+F34", /* T.31 B.6.1 - Initial V.34 rate controls for FAX */
"+FAA", /* T.32 8.5.2.5 - Adaptive Answer parameter */
"+FAP", /* T.32 8.5.1.12 - Addressing and polling capabilities parameter */
"+FAR", /* T.31 8.5.1 - Adaptive reception control */
"+FAR", /* T.31 8.5.1 - Adaptive reception control */
"+FBO", /* T.32 8.5.3.4 - Phase C data bit order */
"+FBS", /* T.32 8.5.3.2 - Buffer Size, read only parameter */
"+FBU", /* T.32 8.5.1.10 - HDLC Frame Reporting parameter */
"+FCC", /* T.32 8.5.1.1 - DCE capabilities parameters */
"+FCL", /* T.31 8.5.2 - Carrier loss timeout */
"+FCLASS", /* T.31 8.2 - Capabilities identification and control */
"+FCL", /* T.31 8.5.2 - Carrier loss timeout */
"+FCLASS", /* T.31 8.2 - Capabilities identification and control */
"+FCQ", /* T.32 8.5.2.3 - Copy quality checking parameter */
"+FCR", /* T.32 8.5.1.9 - Capability to receive parameter */
"+FCS", /* T.32 8.5.1.3 - Current Session Results parameters */
"+FCT", /* T.32 8.5.2.6 - DTE phase C timeout parameter */
"+FDD", /* T.31 8.5.3 - Double escape character replacement */
"+FDD", /* T.31 8.5.3 - Double escape character replacement */
"+FDR", /* T.32 8.3.4 - Data reception command */
"+FDT", /* T.32 8.3.3 - Data transmission command */
"+FEA", /* T.32 8.5.3.5 - Phase C received EOL alignment parameter */
@@ -253,14 +253,14 @@ const char *wordlist[] =
"+FIE", /* T.32 8.5.2.1 - Procedure interrupt enable parameter */
"+FIP", /* T.32 8.3.6 - Initialize facsimile parameters */
"+FIS", /* T.32 8.5.1.2 - Current session parameters */
"+FIT", /* T.31 8.5.4 - DTE inactivity timeout */
"+FIT", /* T.31 8.5.4 - DTE inactivity timeout */
"+FKS", /* T.32 8.3.5 - Session termination command */
"+FLI", /* T.32 8.5.1.5 - Local ID string parameter, TSI or CSI */
"+FLO", /* T.31 says to implement something similar to +IFC */
"+FLO", /* T.31 says to implement something similar to +IFC */
"+FLP", /* T.32 8.5.1.7 - Indicate document to poll parameter */
"+FMI", /* T.31 says to duplicate +GMI */
"+FMM", /* T.31 says to duplicate +GMM */
"+FMR", /* T.31 says to duplicate +GMR */
"+FMI", /* T.31 says to duplicate +GMI */
"+FMM", /* T.31 says to duplicate +GMM */
"+FMR", /* T.31 says to duplicate +GMR */
"+FMS", /* T.32 8.5.2.9 - Minimum phase C speed parameter */
"+FND", /* T.32 8.5.2.10 - Non-Standard Message Data Indication parameter */
"+FNR", /* T.32 8.5.1.11 - Negotiation message reporting control parameters */
@@ -268,44 +268,44 @@ const char *wordlist[] =
"+FPA", /* T.32 8.5.1.13 - Selective polling address parameter */
"+FPI", /* T.32 8.5.1.5 - Local Polling ID String parameter */
"+FPP", /* T.32 8.5.3 - Facsimile packet protocol */
"+FPR", /* T.31 says to implement something similar to +IPR */
"+FPR", /* T.31 says to implement something similar to +IPR */
"+FPS", /* T.32 8.5.2.2 - Page Status parameter */
"+FPW", /* T.32 8.5.1.13 - PassWord parameter (Sending or Polling) */
"+FRH", /* T.31 8.3.6 - HDLC receive */
"+FRM", /* T.31 8.3.4 - Facsimile receive */
"+FRH", /* T.31 8.3.6 - HDLC receive */
"+FRM", /* T.31 8.3.4 - Facsimile receive */
"+FRQ", /* T.32 8.5.2.4 - Receive Quality Thresholds parameters */
"+FRS", /* T.31 8.3.2 - Receive silence */
"+FRS", /* T.31 8.3.2 - Receive silence */
"+FRY", /* T.32 8.5.2.8 - ECM Retry Value parameter */
"+FSA", /* T.32 8.5.1.13 - Subaddress parameter */
"+FSP", /* T.32 8.5.1.8 - Request to poll parameter */
"+FTH", /* T.31 8.3.5 - HDLC transmit */
"+FTM", /* T.31 8.3.3 - Facsimile transmit */
"+FTS", /* T.31 8.3.1 - Transmit silence */
"+GCAP", /* V.250 6.1.9 - Request complete capabilities list */
"+GCI", /* V.250 6.1.10 - Country of installation, */
"+GMI", /* V.250 6.1.4 - Request manufacturer identification */
"+GMM", /* V.250 6.1.5 - Request model identification */
"+GMR", /* V.250 6.1.6 - Request revision identification */
"+GOI", /* V.250 6.1.8 - Request global object identification */
"+GSN", /* V.250 6.1.7 - Request product serial number identification */
"+FTH", /* T.31 8.3.5 - HDLC transmit */
"+FTM", /* T.31 8.3.3 - Facsimile transmit */
"+FTS", /* T.31 8.3.1 - Transmit silence */
"+GCAP", /* V.250 6.1.9 - Request complete capabilities list */
"+GCI", /* V.250 6.1.10 - Country of installation, */
"+GMI", /* V.250 6.1.4 - Request manufacturer identification */
"+GMM", /* V.250 6.1.5 - Request model identification */
"+GMR", /* V.250 6.1.6 - Request revision identification */
"+GOI", /* V.250 6.1.8 - Request global object identification */
"+GSN", /* V.250 6.1.7 - Request product serial number identification */
"+IBC", /* V.80 7.9 - Control of in-band control */
"+IBM", /* V.80 7.10 - In-band MARK idle reporting control */
"+ICF", /* V.250 6.2.11 - DTE-DCE character framing */
"+ICLOK", /* V.250 6.2.14 - Select sync transmit clock source */
"+IDSR", /* V.250 6.2.16 - Select data set ready option */
"+IFC", /* V.250 6.2.12 - DTE-DCE local flow control */
"+ILRR", /* V.250 6.2.13 - DTE-DCE local rate reporting */
"+ILSD", /* V.250 6.2.15 - Select long space disconnect option */
"+IPR", /* V.250 6.2.10 - Fixed DTE rate */
"+IRTS", /* V.250 6.2.17 - Select synchronous mode RTS option */
"+ICF", /* V.250 6.2.11 - DTE-DCE character framing */
"+ICLOK", /* V.250 6.2.14 - Select sync transmit clock source */
"+IDSR", /* V.250 6.2.16 - Select data set ready option */
"+IFC", /* V.250 6.2.12 - DTE-DCE local flow control */
"+ILRR", /* V.250 6.2.13 - DTE-DCE local rate reporting */
"+ILSD", /* V.250 6.2.15 - Select long space disconnect option */
"+IPR", /* V.250 6.2.10 - Fixed DTE rate */
"+IRTS", /* V.250 6.2.17 - Select synchronous mode RTS option */
"+ITF", /* V.80 8.4 - Transmit flow control thresholds */
"+MA", /* V.250 6.4.2 - Modulation automode control */
"+MR", /* V.250 6.4.3 - Modulation reporting control */
"+MS", /* V.250 6.4.1 - Modulation selection */
"+MSC", /* V.250 6.4.8 - Seamless rate change enable */
"+MV18AM", /* V.250 6.4.6 - V.18 answering message editing */
"+MV18P", /* V.250 6.4.7 - Order of probes */
"+MV18R", /* V.250 6.4.5 - V.18 reporting control */
"+MA", /* V.250 6.4.2 - Modulation automode control */
"+MR", /* V.250 6.4.3 - Modulation reporting control */
"+MS", /* V.250 6.4.1 - Modulation selection */
"+MSC", /* V.250 6.4.8 - Seamless rate change enable */
"+MV18AM", /* V.250 6.4.6 - V.18 answering message editing */
"+MV18P", /* V.250 6.4.7 - Order of probes */
"+MV18R", /* V.250 6.4.5 - V.18 reporting control */
"+MV18S", /* V.250 6.4.4 - V.18 selection */
"+PCW", /* V.250 6.8.1 - Call waiting enable (V.92 DCE) */
"+PIG", /* V.250 6.8.5 - PCM upstream ignore */
@@ -332,24 +332,24 @@ const char *wordlist[] =
"+SVR", /* V.252 5.5 - Video receive channel indication */
"+SVRR", /* V.252 3.10 - Video indication reporting */
"+SVT", /* V.252 5.6 - Video transmit channel indication */
"+TADR", /* V.250 6.7.2.9 - Local V.54 address */
"+TAL", /* V.250 6.7.2.15 - Local analogue loop */
"+TALS", /* V.250 6.7.2.6 - Analogue loop status */
"+TDLS", /* V.250 6.7.2.7 - Local digital loop status */
"+TE140", /* V.250 6.7.2.1 - Enable ckt 140 */
"+TE141", /* V.250 6.7.2.2 - Enable ckt 141 */
"+TEPAL", /* V.250 6.7.2.5 - Enable front panel analogue loop */
"+TEPDL", /* V.250 6.7.2.4 - Enable front panel RDL */
"+TERDL", /* V.250 6.7.2.3 - Enable RDL from remote */
"+TLDL", /* V.250 6.7.2.13 - Local digital loop */
"+TADR", /* V.250 6.7.2.9 - Local V.54 address */
"+TAL", /* V.250 6.7.2.15 - Local analogue loop */
"+TALS", /* V.250 6.7.2.6 - Analogue loop status */
"+TDLS", /* V.250 6.7.2.7 - Local digital loop status */
"+TE140", /* V.250 6.7.2.1 - Enable ckt 140 */
"+TE141", /* V.250 6.7.2.2 - Enable ckt 141 */
"+TEPAL", /* V.250 6.7.2.5 - Enable front panel analogue loop */
"+TEPDL", /* V.250 6.7.2.4 - Enable front panel RDL */
"+TERDL", /* V.250 6.7.2.3 - Enable RDL from remote */
"+TLDL", /* V.250 6.7.2.13 - Local digital loop */
"+TMO", /* V.250 6.9 - V.59 command */
"+TMODE", /* V.250 6.7.2.10 - Set V.54 mode */
"+TNUM", /* V.250 6.7.2.12 - Errored bit and block counts */
"+TRDL", /* V.250 6.7.2.14 - Request remote digital loop */
"+TRDLS", /* V.250 6.7.2.8 - Remote digital loop status */
"+TRES", /* V.250 6.7.2.17 - Self test result */
"+TSELF", /* V.250 6.7.2.16 - Self test */
"+TTER", /* V.250 6.7.2.11 - Test error rate */
"+TMODE", /* V.250 6.7.2.10 - Set V.54 mode */
"+TNUM", /* V.250 6.7.2.12 - Errored bit and block counts */
"+TRDL", /* V.250 6.7.2.14 - Request remote digital loop */
"+TRDLS", /* V.250 6.7.2.8 - Remote digital loop status */
"+TRES", /* V.250 6.7.2.17 - Self test result */
"+TSELF", /* V.250 6.7.2.16 - Self test */
"+TTER", /* V.250 6.7.2.11 - Test error rate */
"+VAC", /* V.252 4.1 - Set audio code */
"+VACR", /* V.252 6.1 - Audio code report */
"+VBT", /* 3GPP TS 27.007 C.2.2 - Buffer threshold setting */
@@ -382,10 +382,10 @@ const char *wordlist[] =
"+VSID", /* Extension - Set the originating number */
"+VSM", /* V.253 10.2.8 - Compression method selection */
"+VSP", /* V.253 10.5.1 - Voice speakerphone state */
"+VTA", /* V.253 10.5.4 - Train acoustic echo-canceller */
"+VTA", /* V.253 10.5.4 - Train acoustic echo-canceller */
"+VTD", /* V.253 10.2.9 - Beep tone duration timer */
"+VTER", /* V.252 6.4 - Simple telephony event report */
"+VTH", /* V.253 10.5.5 - Train line echo-canceller */
"+VTH", /* V.253 10.5.5 - Train line echo-canceller */
"+VTR", /* V.253 10.1.4 - Voice duplex state */
"+VTS", /* V.253 10.1.5 - DTMF and tone generation in voice */
"+VTX", /* V.253 10.1.6 - Transmit data state */
@@ -417,27 +417,27 @@ const char *wordlist[] =
"+WS58", /* TIA-678 B.3.1.8 Idle time-out value */
"+WSTL", /* TIA-678 C.5.2 Call session time limit */
";", /* Dummy to absorb semi-colon delimiters in commands */
"A", /* V.250 6.3.5 - Answer */
"D", /* V.250 6.3.1 - Dial */
"E", /* V.250 6.2.4 - Command echo */
"H", /* V.250 6.3.6 - Hook control */
"I", /* V.250 6.1.3 - Request identification information */
"L", /* V.250 6.3.13 - Monitor speaker loudness */
"M", /* V.250 6.3.14 - Monitor speaker mode */
"O", /* V.250 6.3.7 - Return to online data state */
"P", /* V.250 6.3.3 - Select pulse dialling (command) */
"Q", /* V.250 6.2.5 - Result code suppression */
"S0", /* V.250 6.3.8 - Automatic answer */
"S10", /* V.250 6.3.12 - Automatic disconnect delay */
"S3", /* V.250 6.2.1 - Command line termination character */
"S4", /* V.250 6.2.2 - Response formatting character */
"S5", /* V.250 6.2.3 - Command line editing character */
"S6", /* V.250 6.3.9 - Pause before blind dialling */
"S7", /* V.250 6.3.10 - Connection completion timeout */
"S8", /* V.250 6.3.11 - Comma dial modifier time */
"T", /* V.250 6.3.2 - Select tone dialling (command) */
"V", /* V.250 6.2.6 - DCE response format */
"X", /* V.250 6.2.7 - Result code selection and call progress monitoring control */
"A", /* V.250 6.3.5 - Answer */
"D", /* V.250 6.3.1 - Dial */
"E", /* V.250 6.2.4 - Command echo */
"H", /* V.250 6.3.6 - Hook control */
"I", /* V.250 6.1.3 - Request identification information */
"L", /* V.250 6.3.13 - Monitor speaker loudness */
"M", /* V.250 6.3.14 - Monitor speaker mode */
"O", /* V.250 6.3.7 - Return to online data state */
"P", /* V.250 6.3.3 - Select pulse dialling (command) */
"Q", /* V.250 6.2.5 - Result code suppression */
"S0", /* V.250 6.3.8 - Automatic answer */
"S10", /* V.250 6.3.12 - Automatic disconnect delay */
"S3", /* V.250 6.2.1 - Command line termination character */
"S4", /* V.250 6.2.2 - Response formatting character */
"S5", /* V.250 6.2.3 - Command line editing character */
"S6", /* V.250 6.3.9 - Pause before blind dialling */
"S7", /* V.250 6.3.10 - Connection completion timeout */
"S8", /* V.250 6.3.11 - Comma dial modifier time */
"T", /* V.250 6.3.2 - Select tone dialling (command) */
"V", /* V.250 6.2.6 - DCE response format */
"X", /* V.250 6.2.7 - Result code selection and call progress monitoring control */
"Z", /* V.250 6.1.1 - Reset to default configuration */
NULL
};
+12
View File
@@ -390,6 +390,12 @@ extern "C"
{
#endif
/*! Get the logging context associated with an ADSI receive context.
\brief Get the logging context associated with an ADSI receive context.
\param s The ADSI receive context.
\return A pointer to the logging context */
SPAN_DECLARE(logging_state_t *) adsi_rx_get_logging_state(adsi_rx_state_t *s);
/*! \brief Initialise an ADSI receive context.
\param s The ADSI receive context.
\param standard The code for the ADSI standard to be used.
@@ -423,6 +429,12 @@ SPAN_DECLARE(int) adsi_rx_free(adsi_rx_state_t *s);
*/
SPAN_DECLARE(int) adsi_rx(adsi_rx_state_t *s, const int16_t amp[], int len);
/*! Get the logging context associated with an ADSI transmit context.
\brief Get the logging context associated with an ADSI transmit context.
\param s The ADSI transmit context.
\return A pointer to the logging context */
SPAN_DECLARE(logging_state_t *) adsi_tx_get_logging_state(adsi_tx_state_t *s);
/*! \brief Initialise an ADSI transmit context.
\param s The ADSI transmit context.
\param standard The code for the ADSI standard to be used.
@@ -167,6 +167,12 @@ SPAN_DECLARE(void) at_interpreter(at_state_t *s, const char *cmd, int len);
SPAN_DECLARE(void) at_set_class1_handler(at_state_t *s, at_class1_handler_t handler, void *user_data);
/*! Get the logging context associated with an AT interpreter context.
\brief Get the logging context associated with an AT interpreter context.
\param s The AT context.
\return A pointer to the logging context */
SPAN_DECLARE(logging_state_t *) at_get_logging_state(at_state_t *s);
/*! Initialise an AT interpreter context.
\brief Initialise an AT interpreter context.
\param s The AT context.
@@ -91,6 +91,8 @@ struct at_state_s
uint8_t rx_data[256];
int rx_data_bytes;
int dte_dce_flow_control;
int dce_dte_flow_control;
int display_call_info;
int call_info_displayed;
at_call_id_t *call_id;
@@ -131,8 +131,8 @@ struct fax_modems_state_s
span_tx_handler_t tx_handler;
void *tx_user_data;
/*! The next transmit signal handler, for two stage transmit operations.
E.g. a short silence followed by a modem signal. */
/*! \brief The next transmit signal handler, for two stage transmit operations.
E.g. a short silence followed by a modem signal. */
span_tx_handler_t next_tx_handler;
void *next_tx_user_data;
+40 -2
View File
@@ -26,6 +26,40 @@
#if !defined(_SPANDSP_PRIVATE_T31_H_)
#define _SPANDSP_PRIVATE_T31_H_
#define T31_TX_BUF_LEN (4096)
#define T31_TX_BUF_HIGH_TIDE (4096 - 1024)
#define T31_TX_BUF_LOW_TIDE (1024)
#define T31_MAX_HDLC_LEN 284
/*! The maximum length of an HDLC frame buffer. This must be big enough for ECM frames. */
#define T31_T38_MAX_HDLC_LEN 260
/*! The number of HDLC transmit buffers */
#define T31_TX_HDLC_BUFS 256
/*!
T.31 T.38 HDLC buffer.
*/
typedef struct
{
/*! \brief HDLC message buffers. */
uint8_t buf[T31_MAX_HDLC_LEN];
/*! \brief HDLC message lengths. */
int16_t len;
} t31_hdlc_buf_t;
/*!
T.31 T.38 HDLC state.
*/
typedef struct
{
/*! \brief HDLC message buffers. */
t31_hdlc_buf_t buf[T31_TX_HDLC_BUFS];
/*! \brief HDLC buffer number for input. */
int in;
/*! \brief HDLC buffer number for output. */
int out;
} t31_hdlc_state_t;
/*!
Analogue FAX front end channel descriptor. This defines the state of a single working
instance of an analogue line FAX front end.
@@ -102,6 +136,8 @@ typedef struct
int extra_bits;
} hdlc_tx;
t31_hdlc_state_t hdlc_from_t31;
/*! \brief TRUE if we are using ECM mode. This is used to select HDLC faking, necessary
with clunky class 1 modems. */
int ecm_mode;
@@ -149,6 +185,7 @@ struct t31_state_s
/*! HDLC buffer, for composing an HDLC frame from the computer to the channel. */
struct
{
/*! \brief The HDLC transmit buffer. */
uint8_t buf[T31_MAX_HDLC_LEN];
int len;
int ptr;
@@ -158,8 +195,9 @@ struct t31_state_s
/*! Buffer for data from the computer to the channel. */
struct
{
/*! \brief The transmit buffer. */
uint8_t data[T31_TX_BUF_LEN];
/*! \brief The number of bytes stored in transmit buffer. */
/*! \brief The number of bytes stored in the transmit buffer. */
int in_bytes;
/*! \brief The number of bytes sent from the transmit buffer. */
int out_bytes;
@@ -169,7 +207,7 @@ struct t31_state_s
int holding;
/*! \brief TRUE when the end of non-ECM data from the computer has been detected. */
int final;
} tx;
} non_ecm_tx;
/*! TRUE if DLE prefix just used */
int dled;
+14 -17
View File
@@ -28,6 +28,13 @@
#if !defined(_SPANDSP_PRIVATE_T38_GATEWAY_H_)
#define _SPANDSP_PRIVATE_T38_GATEWAY_H_
/*! The number of HDLC transmit buffers */
#define T38_TX_HDLC_BUFS 256
/*! The maximum length of an HDLC frame buffer. This must be big enough for ECM frames. */
#define T38_MAX_HDLC_LEN 260
/*! The receive buffer length */
#define T38_RX_BUF_LEN 2048
/*!
T.38 gateway T.38 side channel descriptor.
*/
@@ -71,9 +78,9 @@ typedef struct
/*! \brief Current pointer into the data buffer. */
int data_ptr;
/*! \brief The current octet being received as non-ECM data. */
unsigned int bit_stream;
uint16_t bit_stream;
/*! \brief The number of bits taken from the modem for the current scan row. This
is used during non-ECM transmission will fill bit removal to see that
is used during non-ECM transmission with fill bit removal to see that
T.38 packet transmissions do not stretch too far apart. */
int bits_absorbed;
/*! \brief The current bit number in the current non-ECM octet. */
@@ -86,9 +93,9 @@ typedef struct
the current rate and the current specified packet interval. */
int octets_per_data_packet;
/*! \brief Bits into the non-ECM buffer */
/*! \brief The number of bits into the non-ECM buffer */
int in_bits;
/*! \brief Octets fed out from the non-ECM buffer */
/*! \brief The number of octets fed out from the non-ECM buffer */
int out_octets;
} t38_gateway_to_t38_state_t;
@@ -100,11 +107,11 @@ typedef struct
/*! \brief HDLC message buffers. */
uint8_t buf[T38_MAX_HDLC_LEN];
/*! \brief HDLC message lengths. */
int len;
int16_t len;
/*! \brief HDLC message status flags. */
int flags;
uint16_t flags;
/*! \brief HDLC buffer contents. */
int contents;
int16_t contents;
} t38_gateway_hdlc_buf_t;
/*!
@@ -114,16 +121,6 @@ typedef struct
{
/*! \brief HDLC message buffers. */
t38_gateway_hdlc_buf_t buf[T38_TX_HDLC_BUFS];
#if 0
/*! \brief HDLC message buffers. */
uint8_t buf[T38_TX_HDLC_BUFS][T38_MAX_HDLC_LEN];
/*! \brief HDLC message lengths. */
int len[T38_TX_HDLC_BUFS];
/*! \brief HDLC message status flags. */
int flags[T38_TX_HDLC_BUFS];
/*! \brief HDLC buffer contents. */
int contents[T38_TX_HDLC_BUFS];
#endif
/*! \brief HDLC buffer number for input. */
int in;
/*! \brief HDLC buffer number for output. */
+1 -1
View File
@@ -247,7 +247,7 @@ static __inline__ int16_t saturated_add16(int16_t a, int16_t b)
int16_t z;
__asm__ __volatile__(
" qsub16 %[z],%[a],%[b];\n"
" qadd16 %[z],%[a],%[b];\n"
: [z] "=r" (z)
: [a] "r" (a), [b] "r" (b)
);
+17 -6
View File
@@ -44,12 +44,6 @@ typedef struct t31_state_s t31_state_t;
typedef int (*t31_modem_control_handler_t)(t31_state_t *s, void *user_data, int op, const char *num);
#define T31_TX_BUF_LEN (4096)
#define T31_TX_BUF_HIGH_TIDE (4096 - 1024)
#define T31_TX_BUF_LOW_TIDE (1024)
#define T31_MAX_HDLC_LEN 284
#define T31_T38_MAX_HDLC_LEN 260
#if defined(__cplusplus)
extern "C"
{
@@ -116,6 +110,11 @@ SPAN_DECLARE(void) t31_set_tep_mode(t31_state_t *s, int use_tep);
*/
SPAN_DECLARE(void) t31_set_t38_config(t31_state_t *s, int without_pacing);
/*! Set audio or T.38 mode.
\brief Set audio or T.38 mode.
\param s The T.31 modem context.
\param t38_mode TRUE for T.38 mode operation. FALSE for audio mode operation.
*/
SPAN_DECLARE(void) t31_set_mode(t31_state_t *s, int t38_mode);
/*! Get a pointer to the logging context associated with a T.31 context.
@@ -125,6 +124,18 @@ SPAN_DECLARE(void) t31_set_mode(t31_state_t *s, int t38_mode);
*/
SPAN_DECLARE(logging_state_t *) t31_get_logging_state(t31_state_t *s);
/*! Get a pointer to the AT interpreter context associated with a T.31 context.
\brief Get a pointer to the AT interpreter context associated with a T.31 context.
\param s The T.31 context.
\return A pointer to the AT interpreter context, or NULL.
*/
SPAN_DECLARE(at_state_t *) t31_get_at_state(t31_state_t *s);
/*! Get a pointer to the T.38 core context associated with a T.31 context.
\brief Get a pointer to the T.38 core context associated with a T.31 context.
\param s The T.31 context.
\return A pointer to the T.38 core context, or NULL.
*/
SPAN_DECLARE(t38_core_state_t *) t31_get_t38_core_state(t31_state_t *s);
/*! Initialise a T.31 context. This must be called before the first
-7
View File
@@ -38,13 +38,6 @@ to maximum the tolerance of jitter and packet loss on the IP network.
\section t38_gateway_page_sec_2 How does it work?
*/
/*! The receive buffer length */
#define T38_RX_BUF_LEN 2048
/*! The number of HDLC transmit buffers */
#define T38_TX_HDLC_BUFS 256
/*! The maximum length of an HDLC frame buffer. This must be big enough for ECM frames. */
#define T38_MAX_HDLC_LEN 260
typedef struct t38_gateway_state_s t38_gateway_state_t;
/*!
+6
View File
@@ -254,6 +254,12 @@ typedef struct
extern "C" {
#endif
/*! Get the logging context associated with a T.4 receive context.
\brief Get the logging context associated with a T.4 receive context.
\param s The T.4 receive context.
\return A pointer to the logging context */
SPAN_DECLARE(logging_state_t *) t4_rx_get_logging_state(t4_rx_state_t *s);
/*! \brief Prepare for reception of a document.
\param s The T.4 context.
\param file The name of the file to be received.
+6
View File
@@ -86,6 +86,12 @@ SPAN_DECLARE(uint32_t) t4_t6_decode_get_image_length(t4_t6_decode_state_t *s);
\return The size of the compressed image, in bits. */
SPAN_DECLARE(int) t4_t6_decode_get_compressed_image_size(t4_t6_decode_state_t *s);
/*! Get the logging context associated with a T.4 or T.6 decode context.
\brief Get the logging context associated with a T.4 or T.6 decode context.
\param s The T.4/T.6 context.
\return A pointer to the logging context */
SPAN_DECLARE(logging_state_t *) t4_t6_decode_get_logging_state(t4_t6_decode_state_t *s);
SPAN_DECLARE(int) t4_t6_decode_restart(t4_t6_decode_state_t *s, int image_width);
/*! \brief Prepare to decode an image in T.4 or T.6 format.
+6
View File
@@ -106,6 +106,12 @@ SPAN_DECLARE(void) t4_t6_encode_set_min_bits_per_row(t4_t6_encode_state_t *s, in
greater than the maximum number of 2D rows between each 1D row. */
SPAN_DECLARE(void) t4_t6_encode_set_max_2d_rows_per_1d_row(t4_t6_encode_state_t *s, int max);
/*! Get the logging context associated with a T.4 or T.6 encode context.
\brief Get the logging context associated with a T.4 or T.6 encode context.
\param s The T.4/T.6 context.
\return A pointer to the logging context */
SPAN_DECLARE(logging_state_t *) t4_t6_encode_get_logging_state(t4_t6_encode_state_t *s);
/*! \brief Restart a T.4 or T.6 encode context.
\param s The T.4/T.6 context.
\param image width The image width, in pixels.
+6
View File
@@ -217,6 +217,12 @@ extern "C" {
SPAN_DECLARE(void) TIFF_FX_init(void);
#endif
/*! Get the logging context associated with a T.4 transmit context.
\brief Get the logging context associated with a T.4 transmit context.
\param s The T.4 transmit context.
\return A pointer to the logging context */
SPAN_DECLARE(logging_state_t *) t4_tx_get_logging_state(t4_tx_state_t *s);
/*! \brief Prepare for transmission of a document.
\param s The T.4 context.
\param file The name of the file to be sent.
+6
View File
@@ -70,6 +70,12 @@ SPAN_DECLARE(int) v42_tx_bit(void *user_data);
SPAN_DECLARE(void) v42_set_status_callback(v42_state_t *s, modem_status_func_t callback, void *user_data);
/*! Get the logging context associated with a V.42 context.
\brief Get the logging context associated with a V.42 context.
\param s The V.42 context.
\return A pointer to the logging context */
SPAN_DECLARE(logging_state_t *) v42_get_logging_state(v42_state_t *s);
/*! Initialise a V.42 context.
\param s The V.42 context.
\param calling_party TRUE if caller mode, else answerer mode.
+6
View File
@@ -99,6 +99,12 @@ SPAN_DECLARE(int) v42bis_decompress_flush(v42bis_state_t *s);
V42BIS_COMPRESSION_MODE_NEVER */
SPAN_DECLARE(void) v42bis_compression_control(v42bis_state_t *s, int mode);
/*! Get the logging context associated with a V.42bis context.
\brief Get the logging context associated with a V.42bis context.
\param s The V.42bis context.
\return A pointer to the logging context */
SPAN_DECLARE(logging_state_t *) v42bis_get_logging_state(v42bis_state_t *s);
/*! Initialise a V.42bis context.
\param s The V.42bis context.
\param negotiated_p0 The negotiated P0 parameter, from the V.42bis spec.
+377 -109
View File
@@ -173,22 +173,19 @@ enum
T38_TIMED_STEP_HDLC_MODEM_3 = 0x22,
T38_TIMED_STEP_HDLC_MODEM_4 = 0x23,
T38_TIMED_STEP_HDLC_MODEM_5 = 0x24,
T38_TIMED_STEP_FAKE_HDLC_MODEM = 0x30,
T38_TIMED_STEP_FAKE_HDLC_MODEM_2 = 0x31,
T38_TIMED_STEP_FAKE_HDLC_MODEM_3 = 0x32,
T38_TIMED_STEP_FAKE_HDLC_MODEM_4 = 0x33,
T38_TIMED_STEP_FAKE_HDLC_MODEM_5 = 0x34,
T38_TIMED_STEP_CED = 0x40,
T38_TIMED_STEP_CED_2 = 0x41,
T38_TIMED_STEP_CED_3 = 0x42,
T38_TIMED_STEP_CNG = 0x50,
T38_TIMED_STEP_CNG_2 = 0x51,
T38_TIMED_STEP_PAUSE = 0x60,
T38_TIMED_STEP_NO_SIGNAL = 0x70
T38_TIMED_STEP_CED = 0x30,
T38_TIMED_STEP_CED_2 = 0x31,
T38_TIMED_STEP_CED_3 = 0x32,
T38_TIMED_STEP_CNG = 0x40,
T38_TIMED_STEP_CNG_2 = 0x41,
T38_TIMED_STEP_PAUSE = 0x50,
T38_TIMED_STEP_NO_SIGNAL = 0x60
};
static int restart_modem(t31_state_t *s, int new_modem);
static void hdlc_accept_frame(void *user_data, const uint8_t *msg, int len, int ok);
static void hdlc_accept_frame2(void *user_data, const uint8_t *msg, int len, int ok);
static void hdlc_accept_frame3(void *user_data, const uint8_t *msg, int len, int ok);
static int silence_rx(void *user_data, const int16_t amp[], int len);
static int cng_rx(void *user_data, const int16_t amp[], int len);
static void non_ecm_put_bit(void *user_data, int bit);
@@ -482,15 +479,31 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC OK (%s)\n", (fe->hdlc_rx.len >= 3) ? t30_frametype(fe->hdlc_rx.buf[2]) : "???", (fe->rx_data_missing) ? "missing octets" : "clean");
if (fe->hdlc_rx.len >= 3 && (fe->hdlc_rx.buf[2] & 0xFE) == T30_DCS)
if (data_type == T38_DATA_V21)
{
/* We need to know if ECM is about to be used, so we can fake HDLC stuff. */
fe->ecm_mode = (fe->hdlc_rx.len >= 7 && (fe->hdlc_rx.buf[6] & DISBIT3));
span_log(&s->logging, SPAN_LOG_FLOW, "ECM mode: %d\n", fe->ecm_mode);
if (fe->hdlc_rx.len >= 3)
{
if ((fe->hdlc_rx.buf[2] & 0xFE) == T30_DCS)
{
/* We need to know if ECM is about to be used, so we can fake HDLC stuff. */
fe->ecm_mode = (fe->hdlc_rx.len >= 7 && (fe->hdlc_rx.buf[6] & DISBIT3)) ? 1 : 0;
span_log(&s->logging, SPAN_LOG_FLOW, "ECM mode: %d\n", fe->ecm_mode);
}
else if (s->t38_fe.ecm_mode == 1 && (fe->hdlc_rx.buf[2] & 0xFE) == T30_CFR)
{
s->t38_fe.ecm_mode = 2;
}
/*endif*/
}
/*endif*/
crc_itu16_append(fe->hdlc_rx.buf, fe->hdlc_rx.len);
hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, !fe->rx_data_missing);
}
else
{
hdlc_accept_frame2(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, !fe->rx_data_missing);
}
/*endif*/
crc_itu16_append(fe->hdlc_rx.buf, fe->hdlc_rx.len);
hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, !fe->rx_data_missing);
}
/*endif*/
fe->hdlc_rx.len = 0;
@@ -511,7 +524,11 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC bad (%s)\n", (fe->hdlc_rx.len >= 3) ? t30_frametype(fe->hdlc_rx.buf[2]) : "???", (fe->rx_data_missing) ? "missing octets" : "clean");
hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, FALSE);
if (data_type == T38_DATA_V21)
hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, FALSE);
else
hdlc_accept_frame2(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, FALSE);
/*endif*/
}
/*endif*/
fe->hdlc_rx.len = 0;
@@ -532,16 +549,33 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC OK, sig end (%s)\n", (fe->hdlc_rx.len >= 3) ? t30_frametype(fe->hdlc_rx.buf[2]) : "???", (fe->rx_data_missing) ? "missing octets" : "clean");
if (fe->hdlc_rx.len >= 3 && (fe->hdlc_rx.buf[2] & 0xFE) == T30_DCS)
if (data_type == T38_DATA_V21)
{
/* We need to know if ECM is about to be used, so we can fake HDLC stuff. */
fe->ecm_mode = (fe->hdlc_rx.len >= 7 && (fe->hdlc_rx.buf[6] & DISBIT3));
span_log(&s->logging, SPAN_LOG_FLOW, "ECM mode: %d\n", fe->ecm_mode);
if (fe->hdlc_rx.len >= 3)
{
if ((fe->hdlc_rx.buf[2] & 0xFE) == T30_DCS)
{
/* We need to know if ECM is about to be used, so we can fake HDLC stuff. */
fe->ecm_mode = (fe->hdlc_rx.len >= 7 && (fe->hdlc_rx.buf[6] & DISBIT3)) ? 1 : 0;
span_log(&s->logging, SPAN_LOG_FLOW, "ECM mode: %d\n", fe->ecm_mode);
}
else if (s->t38_fe.ecm_mode == 1 && (fe->hdlc_rx.buf[2] & 0xFE) == T30_CFR)
{
s->t38_fe.ecm_mode = 2;
}
/*endif*/
}
/*endif*/
crc_itu16_append(fe->hdlc_rx.buf, fe->hdlc_rx.len);
hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, !fe->rx_data_missing);
hdlc_rx_status(s, SIG_STATUS_CARRIER_DOWN);
}
else
{
hdlc_accept_frame2(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, !fe->rx_data_missing);
non_ecm_rx_status(s, SIG_STATUS_CARRIER_DOWN);
}
/*endif*/
crc_itu16_append(fe->hdlc_rx.buf, fe->hdlc_rx.len);
hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, !fe->rx_data_missing);
hdlc_rx_status(s, SIG_STATUS_CARRIER_DOWN);
}
/*endif*/
fe->hdlc_rx.len = 0;
@@ -562,8 +596,17 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC bad, sig end (%s)\n", (fe->hdlc_rx.len >= 3) ? t30_frametype(fe->hdlc_rx.buf[2]) : "???", (fe->rx_data_missing) ? "missing octets" : "clean");
hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, FALSE);
hdlc_rx_status(s, SIG_STATUS_CARRIER_DOWN);
if (data_type == T38_DATA_V21)
{
hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, FALSE);
hdlc_rx_status(s, SIG_STATUS_CARRIER_DOWN);
}
else
{
hdlc_accept_frame2(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, FALSE);
non_ecm_rx_status(s, SIG_STATUS_CARRIER_DOWN);
}
/*endif*/
}
/*endif*/
fe->hdlc_rx.len = 0;
@@ -592,19 +635,23 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
fe->hdlc_rx.len = 0;
fe->rx_data_missing = FALSE;
fe->timeout_rx_samples = 0;
hdlc_rx_status(s, SIG_STATUS_CARRIER_DOWN);
if (data_type == T38_DATA_V21)
hdlc_rx_status(s, SIG_STATUS_CARRIER_DOWN);
else
non_ecm_rx_status(s, SIG_STATUS_CARRIER_DOWN);
/*endif*/
}
/*endif*/
break;
case T38_FIELD_T4_NON_ECM_DATA:
if (!s->at_state.rx_signal_present)
{
non_ecm_rx_status(s, SIG_STATUS_TRAINING_SUCCEEDED);
s->at_state.rx_signal_present = TRUE;
}
/*endif*/
if (len > 0)
{
if (!s->at_state.rx_signal_present)
{
non_ecm_rx_status(s, SIG_STATUS_TRAINING_SUCCEEDED);
s->at_state.rx_signal_present = TRUE;
}
/*endif*/
bit_reverse(buf2, buf, len);
non_ecm_put(s, buf2, len);
}
@@ -691,11 +738,19 @@ static void send_hdlc(void *user_data, const uint8_t *msg, int len)
}
else
{
if (len >= 3 && (s->hdlc_tx.buf[2] & 0xFE) == T30_DCS)
if (len >= 3)
{
/* We need to know if ECM is about to be used, so we can fake HDLC stuff. */
s->t38_fe.ecm_mode = (len >= 7 && (s->hdlc_tx.buf[6] & DISBIT3));
span_log(&s->logging, SPAN_LOG_FLOW, "ECM mode: %d\n", s->t38_fe.ecm_mode);
if ((s->hdlc_tx.buf[2] & 0xFE) == T30_DCS)
{
/* We need to know if ECM is about to be used, so we can fake HDLC stuff. */
s->t38_fe.ecm_mode = (len >= 7 && (s->hdlc_tx.buf[6] & DISBIT3)) ? 1 : 0;
span_log(&s->logging, SPAN_LOG_FLOW, "ECM mode: %d\n", s->t38_fe.ecm_mode);
}
else if (s->t38_fe.ecm_mode == 1 && (s->hdlc_tx.buf[2] & 0xFE) == T30_CFR)
{
s->t38_fe.ecm_mode = 2;
}
/*endif*/
}
/*endif*/
s->t38_fe.hdlc_tx.extra_bits = extra_bits_in_stuffed_frame(msg, len);
@@ -973,7 +1028,9 @@ static int stream_hdlc(t31_state_t *s)
return delay;
/*endif*/
delay += t38_core_send_flags_delay(&fe->t38, fe->next_tx_indicator);
at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT);
if (fe->current_tx_data_type == T38_DATA_V21)
at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT);
/*endif*/
fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3;
break;
case T38_TIMED_STEP_HDLC_MODEM_3:
@@ -981,8 +1038,26 @@ static int stream_hdlc(t31_state_t *s)
if (s->hdlc_tx.len == 0)
{
/* We don't have a frame ready yet, so wait a little */
delay = US_PER_TX_CHUNK;
break;
if (fe->current_tx_data_type != T38_DATA_V21
&&
s->t38_fe.hdlc_from_t31.in != s->t38_fe.hdlc_from_t31.out)
{
bit_reverse(s->hdlc_tx.buf, s->t38_fe.hdlc_from_t31.buf[s->t38_fe.hdlc_from_t31.out].buf, s->t38_fe.hdlc_from_t31.buf[s->t38_fe.hdlc_from_t31.out].len);
s->hdlc_tx.len = s->t38_fe.hdlc_from_t31.buf[s->t38_fe.hdlc_from_t31.out].len;
s->hdlc_tx.ptr = 0;
if (++s->t38_fe.hdlc_from_t31.out >= T31_TX_HDLC_BUFS)
s->t38_fe.hdlc_from_t31.out = 0;
/*endif*/
if (s->t38_fe.hdlc_from_t31.in == s->t38_fe.hdlc_from_t31.out)
s->hdlc_tx.final = s->non_ecm_tx.final;
/*endif*/
}
else
{
delay = US_PER_TX_CHUNK;
break;
}
/*endif*/
}
/*endif*/
i = s->hdlc_tx.len - s->hdlc_tx.ptr;
@@ -1015,7 +1090,9 @@ static int stream_hdlc(t31_state_t *s)
/*endif*/
fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3;
delay = bits_to_us(s, i*8 + fe->hdlc_tx.extra_bits);
at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT);
if (fe->current_tx_data_type == T38_DATA_V21)
at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT);
/*endif*/
}
else
{
@@ -1071,7 +1148,9 @@ static int stream_hdlc(t31_state_t *s)
return res;
/*endif*/
fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3;
at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT);
if (fe->current_tx_data_type == T38_DATA_V21)
at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT);
/*endif*/
/* We should now wait enough time for everything to clear through an analogue modem at the far end. */
delay = bits_to_us(s, fe->hdlc_tx.extra_bits);
}
@@ -1112,12 +1191,6 @@ static int stream_hdlc(t31_state_t *s)
}
/*- End of function --------------------------------------------------------*/
static int stream_fake_hdlc(t31_state_t *s)
{
return 0;
}
/*- End of function --------------------------------------------------------*/
static int stream_ced(t31_state_t *s)
{
t31_t38_front_end_state_t *fe;
@@ -1237,9 +1310,6 @@ SPAN_DECLARE(int) t31_t38_send_timeout(t31_state_t *s, int samples)
case T38_TIMED_STEP_HDLC_MODEM:
delay = stream_hdlc(s);
break;
case T38_TIMED_STEP_FAKE_HDLC_MODEM:
delay = stream_fake_hdlc(s);
break;
case T38_TIMED_STEP_CED:
delay = stream_ced(s);
break;
@@ -1275,9 +1345,9 @@ static int t31_modem_control_handler(at_state_t *s, void *user_data, int op, con
t->call_samples = 0;
break;
case AT_MODEM_CONTROL_ONHOOK:
if (t->tx.holding)
if (t->non_ecm_tx.holding)
{
t->tx.holding = FALSE;
t->non_ecm_tx.holding = FALSE;
/* Tell the application to release further data */
at_modem_control(&t->at_state, AT_MODEM_CONTROL_CTS, (void *) 1);
}
@@ -1401,6 +1471,12 @@ static void non_ecm_put(void *user_data, const uint8_t buf[], int len)
int i;
s = (t31_state_t *) user_data;
if (!s->at_state.rx_signal_present)
{
non_ecm_rx_status(s, SIG_STATUS_TRAINING_SUCCEEDED);
s->at_state.rx_signal_present = TRUE;
}
/*endif*/
/* Ignore any fractional bytes which may have accumulated */
for (i = 0; i < len; i++)
{
@@ -1432,36 +1508,36 @@ static int non_ecm_get_bit(void *user_data)
s = (t31_state_t *) user_data;
if (s->audio.bit_no <= 0)
{
if (s->tx.out_bytes != s->tx.in_bytes)
if (s->non_ecm_tx.out_bytes != s->non_ecm_tx.in_bytes)
{
/* There is real data available to send */
s->audio.current_byte = s->tx.data[s->tx.out_bytes++];
if (s->tx.out_bytes > T31_TX_BUF_LEN - 1)
s->audio.current_byte = s->non_ecm_tx.data[s->non_ecm_tx.out_bytes++];
if (s->non_ecm_tx.out_bytes > T31_TX_BUF_LEN - 1)
{
s->tx.out_bytes = T31_TX_BUF_LEN - 1;
s->non_ecm_tx.out_bytes = T31_TX_BUF_LEN - 1;
span_log(&s->logging, SPAN_LOG_FLOW, "End of transmit buffer reached!\n");
}
/*endif*/
if (s->tx.holding)
if (s->non_ecm_tx.holding)
{
/* See if the buffer is approaching empty. It might be time to
release flow control. */
if (s->tx.out_bytes > T31_TX_BUF_LOW_TIDE)
if (s->non_ecm_tx.out_bytes > T31_TX_BUF_LOW_TIDE)
{
s->tx.holding = FALSE;
s->non_ecm_tx.holding = FALSE;
/* Tell the application to release further data */
at_modem_control(&s->at_state, AT_MODEM_CONTROL_CTS, (void *) 1);
}
/*endif*/
}
/*endif*/
s->tx.data_started = TRUE;
s->non_ecm_tx.data_started = TRUE;
}
else
{
if (s->tx.final)
if (s->non_ecm_tx.final)
{
s->tx.final = FALSE;
s->non_ecm_tx.final = FALSE;
/* This will put the modem into its shutdown sequence. When
it has finally shut down, an OK response will be sent. */
return SIG_STATUS_END_OF_DATA;
@@ -1469,7 +1545,7 @@ static int non_ecm_get_bit(void *user_data)
/*endif*/
/* Fill with 0xFF bytes at the start of transmission, or 0x00 if we are in
the middle of transmission. This follows T.31 and T.30 practice. */
s->audio.current_byte = (s->tx.data_started) ? 0x00 : 0xFF;
s->audio.current_byte = (s->non_ecm_tx.data_started) ? 0x00 : 0xFF;
}
/*endif*/
s->audio.bit_no = 8;
@@ -1490,35 +1566,35 @@ static int non_ecm_get(void *user_data, uint8_t buf[], int len)
s = (t31_state_t *) user_data;
for (i = 0; i < len; i++)
{
if (s->tx.out_bytes != s->tx.in_bytes)
if (s->non_ecm_tx.out_bytes != s->non_ecm_tx.in_bytes)
{
/* There is real data available to send */
buf[i] = s->tx.data[s->tx.out_bytes++];
if (s->tx.out_bytes > T31_TX_BUF_LEN - 1)
buf[i] = s->non_ecm_tx.data[s->non_ecm_tx.out_bytes++];
if (s->non_ecm_tx.out_bytes > T31_TX_BUF_LEN - 1)
{
s->tx.out_bytes = T31_TX_BUF_LEN - 1;
s->non_ecm_tx.out_bytes = T31_TX_BUF_LEN - 1;
span_log(&s->logging, SPAN_LOG_FLOW, "End of transmit buffer reached!\n");
}
/*endif*/
if (s->tx.holding)
if (s->non_ecm_tx.holding)
{
/* See if the buffer is approaching empty. It might be time to release flow control. */
if (s->tx.out_bytes > T31_TX_BUF_LOW_TIDE)
if (s->non_ecm_tx.out_bytes > T31_TX_BUF_LOW_TIDE)
{
s->tx.holding = FALSE;
s->non_ecm_tx.holding = FALSE;
/* Tell the application to release further data */
at_modem_control(&s->at_state, AT_MODEM_CONTROL_CTS, (void *) 1);
}
/*endif*/
}
/*endif*/
s->tx.data_started = TRUE;
s->non_ecm_tx.data_started = TRUE;
}
else
{
if (s->tx.final)
if (s->non_ecm_tx.final)
{
s->tx.final = FALSE;
s->non_ecm_tx.final = FALSE;
/* This will put the modem into its shutdown sequence. When
it has finally shut down, an OK response will be sent. */
//return SIG_STATUS_END_OF_DATA;
@@ -1527,7 +1603,7 @@ static int non_ecm_get(void *user_data, uint8_t buf[], int len)
/*endif*/
/* Fill with 0xFF bytes at the start of transmission, or 0x00 if we are in
the middle of transmission. This follows T.31 and T.30 practice. */
buf[i] = (s->tx.data_started) ? 0x00 : 0xFF;
buf[i] = (s->non_ecm_tx.data_started) ? 0x00 : 0xFF;
}
/*endif*/
}
@@ -1575,6 +1651,11 @@ static void hdlc_tx_underflow(void *user_data)
}
/*- End of function --------------------------------------------------------*/
static void hdlc_tx_underflow2(void *user_data)
{
}
/*- End of function --------------------------------------------------------*/
static void hdlc_rx_status(void *user_data, int status)
{
t31_state_t *s;
@@ -1784,6 +1865,131 @@ static void hdlc_accept_frame(void *user_data, const uint8_t *msg, int len, int
}
/*- End of function --------------------------------------------------------*/
static void hdlc_accept_frame2(void *user_data, const uint8_t *msg, int len, int ok)
{
t31_state_t *s;
int i;
int byte_in_progress;
int txbyte;
int pos;
int ptr;
uint16_t crc;
#if defined(_MSC_VER)
uint8_t *buf2 = (uint8_t *) _alloca(2*len + 20);
#else
uint8_t buf2[2*len + 20];
#endif
/* Accept an ECM image mode HDLC frame received as T.38 */
if (len < 0)
return;
/*endif*/
s = (t31_state_t *) user_data;
span_log(&s->logging, SPAN_LOG_FLOW, "Accept2 %d %d\n", len, ok);
crc = crc_itu16_calc(msg, len, 0xFFFF);
/* If the frame is not good, don't flip the CRC to the correct value */
if (ok)
crc ^= 0xFFFF;
/*endif*/
ptr = 0;
buf2[ptr++] = s->t38_fe.hdlc_tx_term.idle_octet;
buf2[ptr++] = s->t38_fe.hdlc_tx_term.idle_octet;
for (pos = 0; pos < len; pos++)
{
byte_in_progress = msg[pos];
i = bottom_bit(byte_in_progress | 0x100);
s->t38_fe.hdlc_tx_term.octets_in_progress <<= i;
byte_in_progress >>= i;
for ( ; i < 8; i++)
{
s->t38_fe.hdlc_tx_term.octets_in_progress = (s->t38_fe.hdlc_tx_term.octets_in_progress << 1) | (byte_in_progress & 0x01);
byte_in_progress >>= 1;
if ((s->t38_fe.hdlc_tx_term.octets_in_progress & 0x1F) == 0x1F)
{
/* There are 5 ones - stuff */
s->t38_fe.hdlc_tx_term.octets_in_progress <<= 1;
s->t38_fe.hdlc_tx_term.num_bits++;
}
/*endif*/
}
/*endfor*/
/* An input byte will generate between 8 and 10 output bits */
buf2[ptr++] = (s->t38_fe.hdlc_tx_term.octets_in_progress >> s->t38_fe.hdlc_tx_term.num_bits) & 0xFF;
if (s->t38_fe.hdlc_tx_term.num_bits >= 8)
{
s->t38_fe.hdlc_tx_term.num_bits -= 8;
buf2[ptr++] = (s->t38_fe.hdlc_tx_term.octets_in_progress >> s->t38_fe.hdlc_tx_term.num_bits) & 0xFF;
}
/*endif*/
}
/*endfor*/
for (pos = 0; pos < 2; pos++)
{
byte_in_progress = crc & 0xFF;
crc >>= 8;
i = bottom_bit(byte_in_progress | 0x100);
s->t38_fe.hdlc_tx_term.octets_in_progress <<= i;
byte_in_progress >>= i;
for ( ; i < 8; i++)
{
s->t38_fe.hdlc_tx_term.octets_in_progress = (s->t38_fe.hdlc_tx_term.octets_in_progress << 1) | (byte_in_progress & 0x01);
byte_in_progress >>= 1;
if ((s->t38_fe.hdlc_tx_term.octets_in_progress & 0x1F) == 0x1F)
{
/* There are 5 ones - stuff */
s->t38_fe.hdlc_tx_term.octets_in_progress <<= 1;
s->t38_fe.hdlc_tx_term.num_bits++;
}
/*endif*/
}
/*endfor*/
/* An input byte will generate between 8 and 10 output bits */
buf2[ptr++] = (s->t38_fe.hdlc_tx_term.octets_in_progress >> s->t38_fe.hdlc_tx_term.num_bits) & 0xFF;
if (s->t38_fe.hdlc_tx_term.num_bits >= 8)
{
s->t38_fe.hdlc_tx_term.num_bits -= 8;
buf2[ptr++] = (s->t38_fe.hdlc_tx_term.octets_in_progress >> s->t38_fe.hdlc_tx_term.num_bits) & 0xFF;
}
/*endif*/
}
/*endif*/
/* Finish off the current byte with some flag bits. If we are at the
start of a byte we need a at least one whole byte of flag to ensure
we cannot end up with back to back frames, and no flag octet at all */
txbyte = (uint8_t) ((s->t38_fe.hdlc_tx_term.octets_in_progress << (8 - s->t38_fe.hdlc_tx_term.num_bits)) | (0x7E >> s->t38_fe.hdlc_tx_term.num_bits));
/* Create a rotated octet of flag for idling... */
s->t38_fe.hdlc_tx_term.idle_octet = (0x7E7E >> s->t38_fe.hdlc_tx_term.num_bits) & 0xFF;
/* ...and the partial flag octet needed to start off the next message. */
s->t38_fe.hdlc_tx_term.octets_in_progress = s->t38_fe.hdlc_tx_term.idle_octet >> (8 - s->t38_fe.hdlc_tx_term.num_bits);
buf2[ptr++] = txbyte;
buf2[ptr++] = s->t38_fe.hdlc_tx_term.idle_octet;
buf2[ptr++] = s->t38_fe.hdlc_tx_term.idle_octet;
bit_reverse(buf2, buf2, ptr);
non_ecm_put(s, buf2, ptr);
}
/*- End of function --------------------------------------------------------*/
static void hdlc_accept_frame3(void *user_data, const uint8_t *msg, int len, int ok)
{
t31_state_t *s;
/* Accept an ECM image mode HDLC frame received as a bit stream from the FAX software,
and to be send as T.38 HDLC data. */
if (len < 0)
return;
/*endif*/
s = (t31_state_t *) user_data;
memcpy(s->t38_fe.hdlc_from_t31.buf[s->t38_fe.hdlc_from_t31.in].buf, msg, len);
s->t38_fe.hdlc_from_t31.buf[s->t38_fe.hdlc_from_t31.in].len = len;
if (++s->t38_fe.hdlc_from_t31.in >= T31_TX_HDLC_BUFS)
s->t38_fe.hdlc_from_t31.in = 0;
/*endif*/
}
/*- End of function --------------------------------------------------------*/
static void t31_v21_rx(t31_state_t *s)
{
s->at_state.ok_is_pending = FALSE;
@@ -1809,7 +2015,7 @@ static int restart_modem(t31_state_t *s, int new_modem)
/*endif*/
queue_flush(s->rx_queue);
s->modem = new_modem;
s->tx.final = FALSE;
s->non_ecm_tx.final = FALSE;
s->at_state.rx_signal_present = FALSE;
s->at_state.rx_trained = FALSE;
s->audio.modems.rx_trained = FALSE;
@@ -1943,15 +2149,15 @@ static int restart_modem(t31_state_t *s, int new_modem)
}
/*endswitch*/
set_octets_per_data_packet(s, s->bit_rate);
s->t38_fe.timed_step = (s->t38_fe.ecm_mode) ? T38_TIMED_STEP_FAKE_HDLC_MODEM : T38_TIMED_STEP_NON_ECM_MODEM;
s->t38_fe.timed_step = (s->t38_fe.ecm_mode == 2) ? T38_TIMED_STEP_HDLC_MODEM : T38_TIMED_STEP_NON_ECM_MODEM;
}
else
{
fax_modems_start_fast_modem(t, s->modem, s->bit_rate, s->short_train, use_hdlc);
}
/*endif*/
s->tx.out_bytes = 0;
s->tx.data_started = FALSE;
s->non_ecm_tx.out_bytes = 0;
s->non_ecm_tx.data_started = FALSE;
s->at_state.transmit = TRUE;
break;
case FAX_MODEM_V27TER_TX:
@@ -1970,15 +2176,15 @@ static int restart_modem(t31_state_t *s, int new_modem)
}
/*endswitch*/
set_octets_per_data_packet(s, s->bit_rate);
s->t38_fe.timed_step = (s->t38_fe.ecm_mode) ? T38_TIMED_STEP_FAKE_HDLC_MODEM : T38_TIMED_STEP_NON_ECM_MODEM;
s->t38_fe.timed_step = (s->t38_fe.ecm_mode == 2) ? T38_TIMED_STEP_HDLC_MODEM : T38_TIMED_STEP_NON_ECM_MODEM;
}
else
{
fax_modems_start_fast_modem(t, s->modem, s->bit_rate, s->short_train, use_hdlc);
}
/*endif*/
s->tx.out_bytes = 0;
s->tx.data_started = FALSE;
s->non_ecm_tx.out_bytes = 0;
s->non_ecm_tx.data_started = FALSE;
s->at_state.transmit = TRUE;
break;
case FAX_MODEM_V29_TX:
@@ -1997,15 +2203,15 @@ static int restart_modem(t31_state_t *s, int new_modem)
}
/*endswitch*/
set_octets_per_data_packet(s, s->bit_rate);
s->t38_fe.timed_step = (s->t38_fe.ecm_mode) ? T38_TIMED_STEP_FAKE_HDLC_MODEM : T38_TIMED_STEP_NON_ECM_MODEM;
s->t38_fe.timed_step = (s->t38_fe.ecm_mode == 2) ? T38_TIMED_STEP_HDLC_MODEM : T38_TIMED_STEP_NON_ECM_MODEM;
}
else
{
fax_modems_start_fast_modem(t, s->modem, s->bit_rate, s->short_train, use_hdlc);
}
/*endif*/
s->tx.out_bytes = 0;
s->tx.data_started = FALSE;
s->non_ecm_tx.out_bytes = 0;
s->non_ecm_tx.data_started = FALSE;
s->at_state.transmit = TRUE;
break;
case FAX_MODEM_SILENCE_TX:
@@ -2060,8 +2266,8 @@ static int restart_modem(t31_state_t *s, int new_modem)
/*endswitch*/
s->audio.bit_no = 0;
s->audio.current_byte = 0xFF;
s->tx.in_bytes = 0;
s->tx.out_bytes = 0;
s->non_ecm_tx.in_bytes = 0;
s->non_ecm_tx.out_bytes = 0;
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -2089,7 +2295,7 @@ static __inline__ void dle_unstuff_hdlc(t31_state_t *s, const char *stuffed, int
}
/*endif*/
}
else if (stuffed[i] == SUB)
else if (s->at_state.p.double_escape && stuffed[i] == SUB)
{
s->hdlc_tx.buf[s->hdlc_tx.len++] = DLE;
s->hdlc_tx.buf[s->hdlc_tx.len++] = DLE;
@@ -2114,10 +2320,10 @@ static __inline__ void dle_unstuff_hdlc(t31_state_t *s, const char *stuffed, int
}
/*- End of function --------------------------------------------------------*/
static __inline__ void dle_unstuff(t31_state_t *s, const char *stuffed, int len)
static __inline__ void dle_unstuff_fake_hdlc(t31_state_t *s, const char *stuffed, int len)
{
int i;
for (i = 0; i < len; i++)
{
if (s->dled)
@@ -2125,20 +2331,72 @@ static __inline__ void dle_unstuff(t31_state_t *s, const char *stuffed, int len)
s->dled = FALSE;
if (stuffed[i] == ETX)
{
s->tx.final = TRUE;
s->non_ecm_tx.final = TRUE;
t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND);
return;
}
else if (s->at_state.p.double_escape && stuffed[i] == SUB)
{
hdlc_rx_put_byte(&s->t38_fe.hdlc_rx_term, bit_reverse8(DLE));
hdlc_rx_put_byte(&s->t38_fe.hdlc_rx_term, bit_reverse8(DLE));
}
else
{
hdlc_rx_put_byte(&s->t38_fe.hdlc_rx_term, bit_reverse8(stuffed[i]));
}
/*endif*/
}
else
{
if (stuffed[i] == DLE)
s->dled = TRUE;
else
hdlc_rx_put_byte(&s->t38_fe.hdlc_rx_term, bit_reverse8(stuffed[i]));
/*endif*/
}
/*endif*/
}
/*endfor*/
}
/*- End of function --------------------------------------------------------*/
static __inline__ void dle_unstuff(t31_state_t *s, const char *stuffed, int len)
{
int i;
for (i = 0; i < len; i++)
{
if (s->dled)
{
s->dled = FALSE;
if (stuffed[i] == ETX)
{
s->non_ecm_tx.final = TRUE;
t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND);
return;
}
/*endif*/
if (s->at_state.p.double_escape && stuffed[i] == SUB)
{
s->non_ecm_tx.data[s->non_ecm_tx.in_bytes++] = DLE;
s->non_ecm_tx.data[s->non_ecm_tx.in_bytes++] = DLE;
}
else
{
s->non_ecm_tx.data[s->non_ecm_tx.in_bytes++] = stuffed[i];
}
/*endif*/
}
else if (stuffed[i] == DLE)
else
{
s->dled = TRUE;
continue;
if (stuffed[i] == DLE)
s->dled = TRUE;
else
s->non_ecm_tx.data[s->non_ecm_tx.in_bytes++] = stuffed[i];
/*endif*/
}
/*endif*/
s->tx.data[s->tx.in_bytes++] = stuffed[i];
if (s->tx.in_bytes > T31_TX_BUF_LEN - 1)
if (s->non_ecm_tx.in_bytes > T31_TX_BUF_LEN - 2)
{
/* Oops. We hit the end of the buffer. Give up. Loose stuff. :-( */
span_log(&s->logging, SPAN_LOG_FLOW, "No room in buffer for new data!\n");
@@ -2147,12 +2405,12 @@ static __inline__ void dle_unstuff(t31_state_t *s, const char *stuffed, int len)
/*endif*/
}
/*endfor*/
if (!s->tx.holding)
if (!s->non_ecm_tx.holding)
{
/* See if the buffer is approaching full. We might need to apply flow control. */
if (s->tx.in_bytes > T31_TX_BUF_HIGH_TIDE)
if (s->non_ecm_tx.in_bytes > T31_TX_BUF_HIGH_TIDE)
{
s->tx.holding = TRUE;
s->non_ecm_tx.holding = TRUE;
/* Tell the application to hold further data */
at_modem_control(&s->at_state, AT_MODEM_CONTROL_CTS, (void *) 0);
}
@@ -2402,7 +2660,7 @@ SPAN_DECLARE(void) t31_call_event(t31_state_t *s, int event)
SPAN_DECLARE(int) t31_at_rx_free_space(t31_state_t *s)
{
return T31_TX_BUF_LEN - (s->tx.in_bytes - s->tx.out_bytes) - 1;
return T31_TX_BUF_LEN - (s->non_ecm_tx.in_bytes - s->non_ecm_tx.out_bytes) - 1;
}
/*- End of function --------------------------------------------------------*/
@@ -2441,15 +2699,19 @@ SPAN_DECLARE(int) t31_at_rx(t31_state_t *s, const char *t, int len)
dle_unstuff_hdlc(s, t, len);
break;
case AT_MODE_STUFFED:
if (s->tx.out_bytes)
if (s->non_ecm_tx.out_bytes)
{
/* Make room for new data in existing data buffer. */
s->tx.in_bytes -= s->tx.out_bytes;
memmove(&s->tx.data[0], &s->tx.data[s->tx.out_bytes], s->tx.in_bytes);
s->tx.out_bytes = 0;
s->non_ecm_tx.in_bytes -= s->non_ecm_tx.out_bytes;
memmove(&s->non_ecm_tx.data[0], &s->non_ecm_tx.data[s->non_ecm_tx.out_bytes], s->non_ecm_tx.in_bytes);
s->non_ecm_tx.out_bytes = 0;
}
/*endif*/
dle_unstuff(s, t, len);
if (s->t38_fe.ecm_mode == 2)
dle_unstuff_fake_hdlc(s, t, len);
else
dle_unstuff(s, t, len);
/*endif*/
break;
case AT_MODE_CONNECTED:
/* TODO: Implement for data modem operation */
@@ -2674,6 +2936,12 @@ SPAN_DECLARE(logging_state_t *) t31_get_logging_state(t31_state_t *s)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(at_state_t *) t31_get_at_state(t31_state_t *s)
{
return &s->at_state;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(t38_core_state_t *) t31_get_t38_core_state(t31_state_t *s)
{
return &s->t38_fe.t38;
@@ -2707,8 +2975,8 @@ static int t31_t38_fe_init(t31_state_t *t,
t->hdlc_tx.ptr = 0;
hdlc_tx_init(&s->hdlc_tx_term, FALSE, 1, FALSE, NULL, NULL);
hdlc_rx_init(&s->hdlc_rx_term, FALSE, TRUE, 2, NULL, NULL);
hdlc_tx_init(&s->hdlc_tx_term, FALSE, 1, FALSE, hdlc_tx_underflow2, s);
hdlc_rx_init(&s->hdlc_rx_term, FALSE, TRUE, 2, hdlc_accept_frame3, t);
return 0;
}
/*- End of function --------------------------------------------------------*/
+3 -3
View File
@@ -1075,7 +1075,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */
if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type)
{
span_log(&s->logging, SPAN_LOG_FLOW, "HDLC frame type %s - CRC good\n", t30_frametype(hdlc_buf->buf[2]));
span_log(&s->logging, SPAN_LOG_FLOW, "HDLC frame type %s - CRC OK\n", t30_frametype(hdlc_buf->buf[2]));
if (hdlc_buf->contents != (data_type | FLAG_DATA))
{
queue_missing_indicator(s, data_type);
@@ -1593,7 +1593,7 @@ static void non_ecm_put_bit(void *user_data, int bit)
{
t38_gateway_state_t *t;
t38_gateway_to_t38_state_t *s;
if (bit < 0)
{
non_ecm_rx_status(user_data, bit);
@@ -1622,7 +1622,7 @@ static void non_ecm_remove_fill_and_put_bit(void *user_data, int bit)
{
t38_gateway_state_t *t;
t38_gateway_to_t38_state_t *s;
if (bit < 0)
{
non_ecm_rx_status(user_data, bit);
+6
View File
@@ -711,6 +711,12 @@ SPAN_DECLARE(int) t4_rx_end_page(t4_rx_state_t *s)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(logging_state_t *) t4_rx_get_logging_state(t4_rx_state_t *s)
{
return &s->logging;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(t4_rx_state_t *) t4_rx_init(t4_rx_state_t *s, const char *file, int output_encoding)
{
int allocated;
+6
View File
@@ -806,6 +806,12 @@ SPAN_DECLARE(int) t4_t6_decode_get_compressed_image_size(t4_t6_decode_state_t *s
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(logging_state_t *) t4_t6_decode_get_logging_state(t4_t6_decode_state_t *s)
{
return &s->logging;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) t4_t6_decode_restart(t4_t6_decode_state_t *s, int image_width)
{
int bytes_per_row;
+6
View File
@@ -1088,6 +1088,12 @@ SPAN_DECLARE(void) t4_t6_encode_set_max_2d_rows_per_1d_row(t4_t6_encode_state_t
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(logging_state_t *) t4_t6_encode_get_logging_state(t4_t6_encode_state_t *s)
{
return &s->logging;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) t4_t6_encode_restart(t4_t6_encode_state_t *s, int image_width)
{
/* Allow for pages being of different width. */
+6
View File
@@ -1136,6 +1136,12 @@ SPAN_DECLARE(int) t4_tx_end_page(t4_tx_state_t *s)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(logging_state_t *) t4_tx_get_logging_state(t4_tx_state_t *s)
{
return &s->logging;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(t4_tx_state_t *) t4_tx_init(t4_tx_state_t *s, const char *file, int start_page, int stop_page)
{
int allocated;
+5 -5
View File
@@ -62,7 +62,7 @@ static __inline__ int flag_is_changeable_p(uint32_t flag)
uint32_t f1;
uint32_t f2;
__asm__ __volatile__ (
__asm__ __volatile__(
" pushfl\n"
" pushfl\n"
" popl %0\n"
@@ -94,7 +94,7 @@ int has_MMX(void)
if (!have_cpuid_p())
return 0;
/*endif*/
__asm__ __volatile__ (
__asm__ __volatile__(
" push %%ebx;\n"
" mov $1,%%eax;\n"
" cpuid;\n"
@@ -118,7 +118,7 @@ int has_SIMD(void)
if (!have_cpuid_p())
return 0;
/*endif*/
__asm__ __volatile__ (
__asm__ __volatile__(
" push %%ebx;\n"
" mov $1,%%eax;\n"
" cpuid;\n"
@@ -142,7 +142,7 @@ int has_SIMD2(void)
if (!have_cpuid_p())
return 0;
/*endif*/
__asm__ __volatile__ (
__asm__ __volatile__(
" push %%ebx;\n"
" mov $1,%%eax;\n"
" cpuid;\n"
@@ -166,7 +166,7 @@ int has_3DNow(void)
if (!have_cpuid_p())
return 0;
/*endif*/
__asm__ __volatile__ (
__asm__ __volatile__(
" push %%ebx;\n"
" mov $0x80000000,%%eax;\n"
" cpuid;\n"
+6
View File
@@ -1456,6 +1456,12 @@ SPAN_DECLARE(int) v42_get_far_busy_status(v42_state_t *s)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(logging_state_t *) v42_get_logging_state(v42_state_t *s)
{
return &s->logging;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) v42_set_status_callback(v42_state_t *s, modem_status_func_t status_handler, void *user_data)
{
s->lapm.status_handler = status_handler;
+6
View File
@@ -708,6 +708,12 @@ SPAN_DECLARE(void) v42bis_compression_control(v42bis_state_t *s, int mode)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(logging_state_t *) v42bis_get_logging_state(v42bis_state_t *s)
{
return &s->logging;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(v42bis_state_t *) v42bis_init(v42bis_state_t *s,
int negotiated_p0,
int negotiated_p1,