Prosody data communications: API

The following functions are provided by the Prosody data communications API:

API call W Description
smdc_channel_config()   Configure a channel (or half a channel) for data communications
smdc_line_control()   Perform a general control operation on a data communications channel
smdc_line_control_v34()   Perform a general control operation on a V.34 data communications channel
smdc_line_status()   Check general status on a data communications channel
smdc_line_status_v34()   Check general status on a V.34 data communications channel
smdc_rx_config_t38()   Configure a channel's input for T.38 data communications
smdc_rx_config_v34()   Configure a channel's input for V.34 data communications
smdc_rx_control()   Perform a control operation on the input half of a data communications channel
smdc_rx_data()   Read data from a channel configured for data communications
smdc_rx_encoding()   Configure the receive encoding used by a channel for data communications
smdc_rx_status()   Check the status of the input half of a data communication channel.
smdc_rx_status_t38()   Check the status of the input half of a T.38 data communication channel.
smdc_rx_stop()   Stop the receive data communications protocol on a channel.
smdc_stop()   Stop data communications protocols on a channel.
smdc_tx_config_t38()   Configure a channel's output for T.38 data communications
smdc_tx_config_v34()   Configure a channel's output for V.34 data communications
smdc_tx_control()   Perform a control operation on the output half of a data communications channel
smdc_tx_data()   Write data to a channel configured for data communications
smdc_tx_encoding()   Configure the transmit encoding used by a channel for data communications
smdc_tx_status()   Check the status of the output half of a data communication channel.
smdc_tx_stop()   Stop the transmit data communications protocol on a channel.
smdc_tx_tone_indicator_t38()   Sends a T.38 tone indicator on the output half of a T.38 data communication channel
smdc_tx_v34_indicator_t38()   Sends a T.38 v34 indicator on the output half of a T.38 data communication channel
smdc_tx_v34_line_control_t38()   Control a channel's output for V34 over T.38 data communications

This document is also available as separate pages for each function.


Prosody data communications: API: smdc_channel_config

Prototype Definition

int smdc_channel_config(struct smdc_channel_config_parms *configp)

Parameters

*configp
a structure of the following type:
typedef struct smdc_channel_config_parms {
	tSMChannelId channel;					/* in */
	tSM_INT protocol;					/* in */
	tSM_INT config_length;					/* in */
	void *config_data;					/* in */
	tSM_INT encoding;					/* in */
	tSM_INT encoding_config_length;				/* in */
	void *encoding_config_data;				/* in */
} SMDC_CHANNEL_CONFIG_PARMS;

Description

Configures a channel (or half a channel) for data communications using a specified protocol and preparing it to transfer data encoded according to the encoding type over that protocol.

For details of what protocols and encodings are available, and the format of their configuration data, see the document Prosody Data Communcations Protocols and Encodings.

Channels can have two halves: an input half and an output half. A protocol may occupy either or both of these. It is possible to configure a channel for two protocols if one is input-only and the other is output-only. In that case the channel operates as if it were two separate channels, one for each direction.

The input half of a channel is reserved for this data communications configuration until smdc_rx_status() returns the status kSMDCRxStatusFinished. No other activity can take place on the input half of the channel during this time.

The output half of a channel is reserved for this data communications configuration until smdc_tx_status() returns the status kSMDCTxStatusFinished. No other activity can take place on the output half of the channel during this time.

While the output half of a channel is configured for data communications, a write event associated with this channel using sm_channel_set_event() will be set while the channel is ready to accept more data or there may be a status change to report. See smdc_tx_control() for details of how this works. When an application discovers that this event is set, it may check the status using smdc_tx_status(). However, an application may simply try smdc_tx_data() immediately and check status when it refuses to accept data.

While the input half of a channel is configured for data communications, a read event associated with this channel using sm_channel_set_event() will be set while the channel is ready to allow data to be read or there may be a status change to report. See smdc_rx_control() for details of how this works. When an application discovers that this event is set, it should attempt to read data using smdc_rx_data(). See its description to see how this interacts with status changes.

Requires firmware modules applicable to protocol and encoding to have been downloaded. See Prosody Data Communcations Protocols and Encodings

Fields

channel
The channel to configure.
protocol
The desired data communications protocol. The value zero (kSMDCProtocolNone) is reserved and guaranteed never to select a valid protocol.
config_length
The length of the protocol-specific configuration data pointed to by config_data.
config_data
Protocol-specific configuration data.
encoding
The desired encoding for data transferred with the selected protocol.
encoding_config_length
The length of the encoding-specific configuration data pointed to by encoding_config_data
encoding_config_data
Encoding-specific configuration data.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody data communications: API: smdc_line_control

Prototype Definition

int smdc_line_control(struct smdc_line_control_parms *controlp)

Parameters

*controlp
a structure of the following type:
typedef struct smdc_line_control_parms {
	tSMChannelId channel;					/* in */
	enum kSMDCLineCtlCmd {
		kSMDCLineCtlCmdInitiatorConnect,
		kSMDCLineCtlCmdResponderConnect,
		kSMDCLineCtlCmdDisconnect,
		kSMDCLineCtlCmdAssertRTS,
		kSMDCLineCtlCmdUnassertRTS,
		kSMDCLineCtlCmdSetAux,
		kSMDCLineCtlCmdSetPrefixSuffix,
		kSMDCLineCtlCmdSuspend,
		kSMDCLineCtlCmdResume,
		kSMDCLineCtlCmdResumeMonitorCarrier,
		kSMDCLineCtlCmdRetrain,
	} cmd;							/* in */
	tSM_UT32 aux_mask;					/* in */
	tSM_UT32 aux_toggle;					/* in */
	tSM_UT32 shorttrain;					/* in */
	tSM_INT tep;						/* in */
	tSM_UT32 prefix_bitlength;				/* in */
	tSM_UT32 *prefix_data;					/* in */
	tSM_UT32 suffix_bitlength;				/* in */
	tSM_UT32 *suffix_data;					/* in */
	tSM_UT32 retrain_speed;					/* in */
} SMDC_LINE_CONTROL_PARMS;

Description

Perform a command on the halves of a channel which have been configured for data communications. If the channel has been configured with independent input and output halves, the operation requested by cmd is performed separately on both. It is an error to attempt to perform a command on a protocol which does not implement it.

If a protocol has an auxiliary configuration value, the aux_mask and aux_toggle fields are used by the kSMDCLineCtlCmdSetAux command to modify this value as shown in this table:

bit in aux_mask bit in aux_toggle effect on configuration bit
0 0 clear it
0 1 set it
1 0 leave it unchanged
1 1 invert it

See also the document Prosody Data Communcations Protocols and Encodings for details of behaviour specific to individual protocols and encodings.

Fields

channel
The channel which has been configured for data communications.
cmd
The control operation to perform. One of these values:
kSMDCLineCtlCmdInitiatorConnect
Initiate the connection handshake required by the configured protocol. If the protocol distinguishes between an originator (or caller) and a responder (or answerer), then act as the originator.
kSMDCLineCtlCmdResponderConnect
For a protocol which distinguishes between an originator (or caller) and a responder (or answerer), initiate the connection handshake acting as responder.
kSMDCLineCtlCmdDisconnect
Initiate the disconnection procedures for the configured protocol.
kSMDCLineCtlCmdAssertRTS
For a protocol which uses a carrier or equivalent mechanism, turn on the carrier. If there is more than one way to do this (e.g. a long or a short training sequence) then the field shorttrain selects the one to use. If a protocol specification requires RTS to be used, the Prosody implementation may provide automatic RTS. Automatic RTS control is triggered when data is presented for transmission without RTS being asserted. The protocol acts as if RTS had been asserted, sends the data, and acts as if RTS was then deasserted.
kSMDCLineCtlCmdUnassertRTS
For a protocol which uses a carrier or equivalent mechanism, turn off the carrier. The effect of this command is delayed while the transmitter sends data which is queued.
kSMDCLineCtlCmdSetAux
For a protocol which has auxiliary configuration, modify the current configuration value by ANDing with aux_mask and XORing aux_toggle.
kSMDCLineCtlCmdSetPrefixSuffix
Set the bit patterns to be used as a prefix and a suffix on transmissions. The prefix is set to prefix_bitlength bits of data at prefix_data and the suffix is set to suffix_bitlength bits of data at suffix_data. These are arbitrary sequences of bits which are added when the normal data has been encoded and, therefore, are not affected by the type of encoding in use. The prefix is sent as soon as the protocol is ready to transmit (which is typically when the kSMDCLineCtlCmdAssertRTS command is issued), and the suffix is sent just before the carrier is turned off (which is typically when the kSMDCLineCtlCmdUnassertRTS command is issued). If a protocol has no RTS control, the prefix is sent as soon as possible, and the suffix is never sent. If the protocol permits RTS to be turned on automatically when data is ready to be sent, then the prefix is sent as soon as there is data ready to be sent and the suffix is sent when there is no remaining data to be sent. See the documentation for each protocol to determine which protocols support this feature. Requires the module prefsuf.
kSMDCLineCtlCmdSuspend
Suspend modem receiver. The modem no longer processes the incoming signal. This command is only valid for the modem types which state they support it.
kSMDCLineCtlCmdResume
Resume modem receiver. The modem must have been suspended with kSMDCLineCtlCmdSuspend and it now resumes processing the incoming signal. Typically, this allows the modem to make use of a shorter training sequence as some of the signal analysis saved when the modem was suspended can be re-used.
kSMDCLineCtlCmdResumeMonitorCarrier
Resume modem receiver but only for purposes of monitoring signal following a previous loss of synchronisation. The modem must have been suspended with kSMDCLineCtlCmdSuspend when the previous loss of carrier occurred and it is now resumed but solely to monitor the nature/energy of following signal. The application will notified with a carrier on and carrier off notification if what looks like an additional segment of modem modulated signal is present - so an application can determine where modem modulated signal ended following any dropout. Demodulated data will not be supplied. Typically, this allows the application to avoid a timeout following a fax modem dropout. The modem must be suspended again, using kSMDCLineCtlCmdSuspend, before kSMDCLineCtlCmdResume is used to resume wait for a shorter training sequence.
kSMDCLineCtlCmdRetrain
Initiate a modem retrain. This command is only valid for the modem types which state they support it.
aux_mask
A bitmask used with the kSMDCLineCtlCmdSetAux command.
aux_toggle
A bitmask used with the kSMDCLineCtlCmdSetAux command.
shorttrain
Select whether the protocol should use short training (non-zero) or long training (zero). Only valid when the cmd field is kSMDCLineCtlCmdAssertRTS.
tep
Indicator of whether the transmitter should use Talker Echo Protection tone (non-zero) or not (zero). Only valid when the cmd field is kSMDCLineCtlCmdAssertRTS.
prefix_bitlength
The number of bits in the prefix. Must be zero or a multiple of 8. Only valid when the cmd field is kSMDCLineCtlCmdSetPrefixSuffix.
prefix_data
The prefix to be used with transmission. Only valid when the cmd field is kSMDCLineCtlCmdSetPrefixSuffix. The data is sent least significant bit first, and any extra bits in the last word are ignored.
suffix_bitlength
The number of bits in the suffix. Must be zero or a multiple of 8. Only valid when the cmd field is kSMDCLineCtlCmdSetPrefixSuffix.
suffix_data
The suffix to be used with transmission. Only valid when the cmd field is kSMDCLineCtlCmdSetPrefixSuffix. The data is sent least significant bit first, and any extra bits in the last word are ignored.
retrain_speed
The speed to retrain to. Only valid when the cmd field is kSMDCLineCtlCmdRetrain.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody data communications: API: smdc_line_control_v34

Prototype Definition

int smdc_line_control_v34(struct smdc_line_control_v34_parms *controlp)

Parameters

*controlp
a structure of the following type:
typedef struct smdc_line_control_v34_parms {
	tSMChannelId channel;					/* in */
	enum kSMDCV34LineCtlCmd {
		kSMDCV34LineCtlCmdRetrain,
		kSMDCV34LineCtlCmdRenegotiateUp,
		kSMDCV34LineCtlCmdRenegotiateDown,
		kSMDCV34LineCtlCmdEnablePrimary,
		kSMDCV34LineCtlCmdEnableControl,
		kSMDCV34LineCtlCmdBitrateTx,
		kSMDCV34LineCtlCmdBitrateRx,
	} cmd;							/* in */
	union {
		struct {
			tSM_INT min_bitrate;			/* in */
			tSM_INT max_bitrate;			/* in */
		} bitrate;					/* in */
	} u;							/* in */
} SMDC_LINE_CONTROL_V34_PARMS;

Description

Perform a command on a channel which has been configured for V.34 data communications.

Fields

channel
The channel which has been configured for data communications.
cmd
The control operation to perform. One of these values:
kSMDCV34LineCtlCmdRetrain
Initiate a full retrain procedure on the line, negotiating the best new data rate for the primary channel.
kSMDCV34LineCtlCmdRenegotiateUp
Performs a short renegotiation procedure to increase the data rate on the primary channel. This is typically done when the snr_status parameter of smdc_line_status_v34() is greater than zero.
kSMDCV34LineCtlCmdRenegotiateDown
Performs a short renegotiation procedure to decrease the data rate on the primary channel. This is typically done when the snr_status parameter of smdc_line_status_v34() is less than zero.
kSMDCV34LineCtlCmdEnablePrimary
Switches the modem to transmit on the primary channel. Both originating and answering modem must send this command at the appropriate time, as negotiated by a higher-level protocol. This message is only available on the half-duplex V.34 modem; the full-duplex modem always runs on the primary channel.
kSMDCV34LineCtlCmdEnableControl
Switches the modem to transmit on the control channel. Both originating and answering modem must send this command at the appropriate time, as negotiated by a higher-level protocol. This message is only available on the half-duplex V.34 modem; the full-duplex modem always runs on the primary channel. The half-duplex modem is using the control channel when it first returns control to the user after negotiation.
kSMDCV34LineCtlCmdBitrateTx
Change the bitrate limits on the transmitter.
kSMDCV34LineCtlCmdBitrateRx
Change the bitrate limits on the receiver.
u
bitrate
This field is only valid if the cmd is kSMDCV34LineCtlCmdBitrateTx or kSMDCV34LineCtlCmdBitrateRx.
min_bitrate
The minimum bitrate to negotiate for the primary channel, in bits/second.
max_bitrate
The maximum bitrate to negotiate for the primary channel, in bits/second.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody data communications: API: smdc_line_status

Prototype Definition

int smdc_line_status(struct smdc_line_status_parms *statusp)

Parameters

*statusp
a structure of the following type:
typedef struct smdc_line_status_parms {
	tSMChannelId channel;					/* in */
	enum kSMDCLinkStatus {
		kSMDCLinkStatusNotConnected,
		kSMDCLinkStatusConnecting,
		kSMDCLinkStatusConnected,
		kSMDCLinkStatusDisconnecting,
	} link_status;						/* out */
	enum kSMDCLineRxStatus {
		kSMDCRxStatusNoCarrier,
		kSMDCRxStatusCarrierPresent,
		kSMDCRxStatusReceivingData,
	} rx_status;						/* out */
	enum kSMDCLineTxStatus {
		kSMDCTxStatusSilent,
		kSMDCTxStatusSendingCarrier,
		kSMDCTxStatusSendingData,
	} tx_status;						/* out */
	tSM_INT tx_cts;						/* out */
} SMDC_LINE_STATUS_PARMS;

Description

This function is deprecated in favour of using smdc_rx_status() and smdc_tx_status().

Reports the status of a channel used for data communications. If its input half has not been configured for data communications, then the field rx_status will contain the value kSMDCRxStatusNoCarrier, otherwise it indicates status of the input half of the channel. Note that it is not normally appropriate to distinguish between kSMDCRxStatusCarrierPresent and kSMDCRxStatusReceivingData since protocols can typically switch between them very quickly and the system only reports approximately to avoid the status changing very rapidly.

If the channel's output half has not been configured for data communications, then the field tx_status will contain the value kSMDCTxStatusSilent, otherwise it indicates the output half status. Note that it is not normally appropriate to distinguish between kSMDCTxStatusSendingCarrier and kSMDCTxStatusSendingData since protocols can typically switch between them very quickly and the system only reports approximately to avoid the status changing very rapidly.

The overall channel status is reported in link_status. Where the input half and output half have been configured with independent protocols, the status is reported as kSMDCLinkStatusConnected if either is connected. The status kSMDCLinkStatusNotConnected is reported only if both have finished data communications.

See also the document Prosody Data Communcations Protocols and Encodings for details of behaviour specific to individual protocols and encodings.

Fields

channel
The channel which has been configured for data communications.
link_status
The channel status. One of these values:
kSMDCLinkStatusNotConnected
The channel has finished with data communications. When this status is reported, the channel reverts to the idle state that it was in before smdc_channel_config() was used. Therefore it can be re-configured or used for another purpose and a subsequent call to smdc_line_status() will report the error ERR_SM_WRONG_CHANNEL_STATE.
kSMDCLinkStatusConnecting
Channel is waiting to connect. Either the appropriate command (kSMDCLineCtlCmdInitiatorConnect or kSMDCLineCtlCmdResponderConnect) has not yet been used in a call to smdc_line_control() or the connection handshake procedures have not yet completed.
kSMDCLinkStatusConnected
Connection handshake procedures have been completed or are not applicable.
kSMDCLinkStatusDisconnecting
The channel is in the process of disconnecting.
rx_status
One of these values:
kSMDCRxStatusNoCarrier
The input half is not receiving a meaningful signal.
kSMDCRxStatusCarrierPresent
The input half is receiving a meaningful signal, but it does not contain data.
kSMDCRxStatusReceivingData
The input half is receiving a meaningful signal, and it contains data.
tx_status
One of these values:
kSMDCTxStatusSilent
The output half is not sending any signal.
kSMDCTxStatusSendingCarrier
The output half is sending a signal which does not contain data (e.g. a carrier or framing pattern).
kSMDCTxStatusSendingData
The output half is sending a signal which contains data.
tx_cts
Indicator of whether the transmitter is ready to transmit (non-zero) or not (zero).

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody data communications: API: smdc_line_status_v34

Prototype Definition

int smdc_line_status_v34(struct smdc_line_status_v34_parms *statusp)

Parameters

*statusp
a structure of the following type:
typedef struct smdc_line_status_v34_parms {
	tSMChannelId channel;					/* in */
	enum kSMDCLinkStatus link_status;			/* out */
	enum kSMDCLineRxStatus rx_status;			/* out */
	enum kSMDCLineTxStatus tx_status;			/* out */
	tSM_INT control_bitrate;				/* out */
	tSM_INT primary_bitrate;				/* out */
	tSM_INT snr_status;					/* out */
	tSM_INT fdx_rx_bitrate;					/* out */
	tSM_INT fdx_tx_bitrate;					/* out */
} SMDC_LINE_STATUS_V34_PARMS;

Description

Reports the status of a channel used for data communications with the V.34 protocol. V.34 is a full-duplex modem so both the input and output halves of the channel must have been configured for data communications.

The field rx_status will indicate the status of the input half of the channel. Note that it is not normally appropriate to distinguish between kSMDCRxStatusCarrierPresent and kSMDCRxStatusReceivingData since protocols can typically switch between them very quickly and the system only reports approximately to avoid the status changing very rapidly.

The field tx_status will indicate the output half status. Note that it is not normally appropriate to distinguish between kSMDCTxStatusSendingCarrier and kSMDCTxStatusSendingData since protocols can typically switch between them very quickly and the system only reports approximately to avoid the status changing very rapidly.

The overall channel status is reported in link_status.

See also the document Prosody Data Communcations Protocols and Encodings for details of behaviour specific to individual protocols and encodings.

Fields

channel
The channel which has been configured for data communications.
link_status
The channel status. One of these values:
kSMDCLinkStatusNotConnected
The channel has finished with data communications. When this status is reported, the channel reverts to the idle state that it was in before smdc_channel_config() was used. Therefore it can be re-configured or used for another purpose and a subsequent call to smdc_line_status() will report the error ERR_SM_WRONG_CHANNEL_STATE.
kSMDCLinkStatusConnecting
Channel is waiting to connect. Either the appropriate command (kSMDCLineCtlCmdInitiatorConnect or kSMDCLineCtlCmdResponderConnect) has not yet been used in a call to smdc_line_control() or the connection handshake procedures have not yet completed.
kSMDCLinkStatusConnected
Connection handshake procedures have been completed or are not applicable.
kSMDCLinkStatusDisconnecting
The channel is in the process of disconnecting.
rx_status
One of these values:
kSMDCRxStatusNoCarrier
The input half is not receiving a meaningful signal.
kSMDCRxStatusCarrierPresent
The input half is receiving a meaningful signal, but it does not contain data.
kSMDCRxStatusReceivingData
The input half is receiving a meaningful signal, and it contains data.
tx_status
One of these values:
kSMDCTxStatusSilent
The output half is not sending any signal.
kSMDCTxStatusSendingCarrier
The output half is sending a signal which does not contain data (e.g. a carrier or framing pattern).
kSMDCTxStatusSendingData
The output half is sending a signal which contains data.
control_bitrate
In half-duplex mode, the currently-negotiated data rate of the control channel, in bits/second. This value will be zero before the rate has been negotiated, while the modem is in state kSMDCLinkStatusConnecting.
primary_bitrate
In half-duplex mode, the currently-negotiated data rate of the primary channel, in bits/second. This value will be zero before the rate has been negotiated, while the modem is in state kSMDCLinkStatusConnecting.
snr_status
A value representing the signal-to-noise ratio on the line, as an arbitrary integer representing quality. Numbers less than zero indicate a low SNR and indicate that it may be advisable to reduce the data rate. Numbers greater than zero indicate that the data rate could be safely increased.
fdx_rx_bitrate
In full-duplex mode, the currently-negotiated receive data rate of the primary channel, in bits/second. This value will be zero before the rate has been negotiated, while the modem is in state kSMDCLinkStatusConnecting.
fdx_tx_bitrate
In full-duplex mode, the currently-negotiated transmit data rate of the primary channel, in bits/second. This value will be zero before the rate has been negotiated, while the modem is in state kSMDCLinkStatusConnecting.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody data communications: API: smdc_rx_config_t38

Prototype Definition

int smdc_rx_config_t38(struct smdc_rx_config_t38_parms *configp)

Parameters

*configp
a structure of the following type:
typedef struct smdc_rx_config_t38_parms {
	tSMChannelId channel;					/* in */
	tSM_INT PreCorrigendum;					/* in */
	tSM_INT Protocol;					/* in */
} SMDC_RX_CONFIG_T38_PARMS;

Description

Configures a channel's input for data communications using the T.38 protocol.

The input half of a channel is reserved for this data communications configuration until smdc_rx_status_t38() returns the status kSMDCRxT38StatusFinished. No other activity can take place on the input half of the channel during this time.

While the input half of a channel is configured for data communications, a read event associated with this channel using sm_channel_set_event() will be set while the channel is ready to allow data to be read or there may be a status change to report. See smdc_rx_control() for details of how this works. When an application discovers that this event is set, it should attempt to read data using smdc_rx_data(). See its description to see how this interacts with status changes.

Requires the module ifprx to have been downloaded.

Fields

channel
The channel to configure.
PreCorrigendum
Selects the version of T.38 to use. Non-zero selects the pre-Corrigendum (1998) version, zero selects the updated version (2002).
Protocol
A value from Table 4/T.38 which is used in packets indicating which kind of modulation is being described. Incoming packets are discarded if they are incompatible with the value selected. The value kSMDCT38ProtocolAll may be used to allow all received data to be read. In this case, smdc_rx_status_t38() will report the protocol being received and all data read will be in the appropriate format until a new protocol is reported.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody data communications: API: smdc_rx_config_v34

Prototype Definition

int smdc_rx_config_v34(struct smdc_rx_config_v34_parms *configp)

Parameters

*configp
a structure of the following type:
typedef struct smdc_rx_config_v34_parms {
	tSMChannelId channel;					/* in */
	enum kSMDCV34Duplex {
		kSMDCV34HalfDuplex,
		kSMDCV34FullDuplex,
	} duplex;						/* in */
	tSM_INT min_bitrate;					/* in */
	tSM_INT max_bitrate;					/* in */
	tSM_INT v8fsk_metric;					/* in */
} SMDC_RX_CONFIG_V34_PARMS;

Description

Configures a channel's input for data communications using the V.34 protocol. The V.34 modem operates in a duplex manner (even when duplex is kSMDCV34HalfDuplex), so channel must be a full-duplex channel and its output half must also be configured using smdc_tx_config_v34().

The channel input is reserved for this data communications configuration until smdc_line_status_v34() returns the status kSMDCLinkStatusNotConnected. No other activity can take place on the channel during this time.

While the input half of a channel is configured for data communications, a read event associated with this channel using sm_channel_set_event() will be set while the channel is ready to allow data to be read or there may be a status change to report. See smdc_rx_control() for details of how this works. When an application discovers that this event is set, it should attempt to read data using smdc_rx_data(). See its description to see how this interacts with status changes.

Requires the module v34fdx to have been downloaded if configuring for full duplex operation.

Requires the module v34 to have been downloaded if configuring for half duplex operation.

Fields

channel
The channel to configure.
duplex
Selects full-duplex or half-duplex operation. The transmitter and receiver must both be configured with the same value for this parameter. One of these values:
kSMDCV34HalfDuplex
Configures the channel for half-duplex. Only one channel may transmit at the full modem speed at a time, or both may transmit on a much slower control channel.
kSMDCV34FullDuplex
Configures the channel for full-duplex. Both channels may transmit at the full modem speed simultaneously.
min_bitrate
The minimum bitrate to negotiate for the primary channel when it is receiving data, in bits/second.
max_bitrate
The maximum bitrate to negotiate for the primary channel when it is receiving data, in bits/second.
v8fsk_metric
A measure of expected peer signal power derived from prior V.8 FSK demodulation. Should be configured to a value obtained from FSK receiver, or zero if such information not available.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody data communications: API: smdc_rx_control

Prototype Definition

int smdc_rx_control(struct smdc_rx_control_parms *controlp)

Parameters

*controlp
a structure of the following type:
typedef struct smdc_rx_control_parms {
	tSMChannelId channel;					/* in */
	enum kSMDCRxCtl {
		kSMDCRxCtlDiscard,
		kSMDCRxCtlNotifyOnData,
		kSMDCRxCtlStop,
		kSMDCRxCtlResume,
	} cmd;							/* in */
	tSM_INT min_to_collect;					/* in */
	tSM_INT min_idle;					/* in */
	tSM_INT blocking;					/* in */
} SMDC_RX_CONTROL_PARMS;

Description

Performs a control operation on the input half of a data communications channel.

When the cmd field holds kSMDCRxCtlNotifyOnData, the values min_to_collect and min_idle configure the criteria used to determine when the input half of the channel is ready. There are two cases:

min_idle Meaning
0 The channel is ready when at least min_to_collect octets of data are waiting. It ceases to be ready when the amount waiting falls below min_to_collect.
T != 0 The channel is ready when any data can be collected. Data becomes ready for collection when either min_to_collect octets of data are waiting, or data is waiting and no further data has been received for a period of T mS.

Note that, although times can be specified to the nearest millisecond, the measurement of time is limited to the epoch period of the Prosody device.

When the input half of a channel is ready:

See also the document Prosody Data Communcations Protocols and Encodings for details of behaviour specific to individual protocols and encodings.

Fields

channel
The data communication channel.
cmd
The operations to perform. One of these values:
kSMDCRxCtlDiscard
Discard any buffered data not yet collected.
kSMDCRxCtlNotifyOnData
Set the criteria for determining when the input half of the channel is ready.
kSMDCRxCtlStop
Use any flow control mechanism available in the configured protocol to stop the incoming data flow.
kSMDCRxCtlResume
Use any flow control mechanism available in the configured protocol to resume the incoming data flow.
min_to_collect
Channel ready threshold (in octets). The input half of the channel is ready when at least this much data is buffered. This field is only used when the cmd field holds kSMDCRxCtlNotifyOnData. If this value is negative, it represents the amount of space remaining. For example, the value -256 means that the threshold is reached when there is space available for no more than 256 further octets. See also the document Prosody application note: considerations for data transfer thresholds.
min_idle
Channel ready timeout (in mS). This field is only used when the cmd field holds kSMDCRxCtlNotifyOnData. The value zero indicates that no timer is to be used.
blocking
Indicator of whether smdc_rx_data() should block if it attempts to read data when the channel is not ready. A non-zero value indicates that the function should block until the channel is ready. The value zero indicates that it should return immediately indicating that no data was read. Only valid when the cmd field is kSMDCRxCtlNotifyOnData. [Not currently implemented - reserved for future use]

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody data communications: API: smdc_rx_data

Prototype Definition

int smdc_rx_data(struct smdc_data_parms *datap)

Parameters

*datap
a structure of the following type:
typedef struct smdc_data_parms {
	tSMChannelId channel;					/* in */
	char *data;						/* in */
	tSM_INT max_length;					/* in */
	tSM_INT done_length;					/* out */
} SMDC_DATA_PARMS;

Description

Attempt to read data from a channel whose input half has been configured for a data communications protocol. Less than the maximum will be read when either:

To permit maximum system throughput, this function refuses to read from a channel whose status has changed since it was last checked. This allows an application to avoid checking the status during bulk data transfer. The application only needs to check the status when a call to smdc_rx_data() returns with done_length equal to zero. This also ensures that status changes are reported at the point in the data at which they occurred, which may be important for some applications.

If an error is reported, the done_length field indicates the amount of data which was read before the error occurred.

Any amount of data (up to max_length) may be returned - even less than configured with the min_to_collect, parameter set with smdc_rx_control(), which only controls when the channel is declared ready. Once a channel is ready, it may remain so until all the data is read from it. This means that if the first read does not read all the data (i.e. the buffer supplied is too small), the next read will return immediately with more.

See also the document Prosody Data Communcations Protocols and Encodings for details of behaviour specific to individual protocols and encodings.

Fields

channel
The data communication channel.
data
A pointer to the buffer into which data should be read.
max_length
The amount of space in the buffer.
done_length
The amount of data actually read.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody data communications: API: smdc_rx_encoding

Prototype Definition

int smdc_rx_encoding(struct smdc_encoding_parms *encp)

Parameters

*encp
a structure of the following type:
typedef struct smdc_encoding_parms {
	tSMChannelId channel;					/* in */
	tSM_INT encoding;					/* in */
	tSM_INT encoding_config_length;				/* in */
	void *encoding_config_data;				/* in */
} SMDC_ENCODING_PARMS;

Description

Configures the receive encoding for the input half of a channel which must have been already configured for data communications using smdc_channel_config().

For details of what encodings are available, and the format of their configuration data, see the document Prosody data communications Encodings.

Fields

channel
The channel to configure.
encoding
The desired encoding for data received by the channel.
encoding_config_length
The length of the encoding-specific configuration data pointed to by encoding_config_data
encoding_config_data
Encoding-specific configuration data.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody data communications: API: smdc_rx_status

Prototype Definition

int smdc_rx_status(struct smdc_rx_status_parms *statusp)

Parameters

*statusp
a structure of the following type:
typedef struct smdc_rx_status_parms {
	tSMChannelId channel;					/* in */
	tSM_INT available_octets;				/* out */
	enum kSMDCRxStatus {
		kSMDCRxStatusEmpty,
		kSMDCRxStatusData,
		kSMDCRxStatusOverrun,
		kSMDCRxStatusCarrier,
		kSMDCRxStatusFinished,
		kSMDCRxStatusSigMetric,
	} status;						/* out */
	tSM_INT flow;						/* out */
	union {
		struct {
			tSM_INT carrier;			/* out */
		} carrier;					/* out */
		struct {
			tSM_INT metric;				/* out */
		} metric;					/* out */
	} u;							/* out */
} SMDC_RX_STATUS_PARMS;

Description

Reports the status of a channel whose input half has been configured for data communications.

See also the document Prosody Data Communcations Protocols and Encodings for details of behaviour specific to individual protocols and encodings.

Fields

channel
The data communication channel.
available_octets
The amount of data currently buffered in this channel. Only valid if the status field reports kSMDCRxStatusData.
status
The receiver status. One of these values:
kSMDCRxStatusEmpty
No data is available for reading.
kSMDCRxStatusData
Some data is available for reading.
kSMDCRxStatusOverrun
Data has been lost because the buffer has overflowed.
kSMDCRxStatusCarrier
The input half has begun or stopped receiving a meaningful signal.
kSMDCRxStatusFinished
The receiver has finished with data communications. When this status is reported, the channel's input half reverts to the idle state that it was in before smdc_channel_config() was used. Therefore it can be re-configured or used for another purpose and a subsequent call to smdc_rx_status() will report the error ERR_SM_WRONG_CHANNEL_STATE.
kSMDCRxStatusSigMetric
The receiver is reporting a measurement relating to received signal prior to receiver termination. This status only occurs if receiver has been configured to report this metric.
flow
Indicator of whether the receiver has stopped incoming data by using flow control (non-zero) or not (zero).
u
Additional information specifying the current status
carrier
This field is only valid if the status is kSMDCRxStatusCarrier
carrier
The current carrier status: zero=off, non-zero=on.
metric
This field is only valid if the status is kSMDCRxStatusSigMetric
metric
A measure of received signal.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody data communications: API: smdc_rx_status_t38

Prototype Definition

int smdc_rx_status_t38(struct smdc_rx_status_t38_parms *statusp)

Parameters

*statusp
a structure of the following type:
typedef struct smdc_rx_status_t38_parms {
	tSMChannelId channel;					/* in */
	tSM_INT available_octets;				/* out */
	enum kSMDCRxT38Status {
		kSMDCRxT38StatusEmpty,
		kSMDCRxT38StatusTone,
		kSMDCRxT38StatusV34,
		kSMDCRxT38StatusData,
		kSMDCRxT38StatusOverrun,
		kSMDCRxT38StatusCarrier,
		kSMDCRxT38StatusFinished,
		kSMDCRxT38StatusProtocol,
		kSMDCRxT38StatusRate,
	} status;						/* out */
	tSM_INT flow;						/* out */
	union {
		struct {
			enum kSMDCT38ToneType tone_type;	/* out */
		} tone;						/* out */
		struct {
			enum kSMDCT38_V34Type {
				kSMDCT38_V34Type_V34_CC_1200,
				kSMDCT38_V34Type_V34_PRI_CHAN,
				kSMDCT38_V34Type_V34_CC_RETRAIN,
			} v34_type;				/* out */
		} v34;						/* out */
		struct {
			tSM_INT carrier;			/* out */
		} carrier;					/* out */
		struct {
			tSM_INT rate;				/* out */
		} rate;						/* out */
		struct {
			tSM_INT protocol;			/* out */
		} protocol;					/* out */
	} u;							/* out */
} SMDC_RX_STATUS_T38_PARMS;

Description

Reports the status of a channel whose input half has been configured for T.38 data communications.

Fields

channel
The T.38 data communication channel.
available_octets
The amount of data currently buffered in this channel. Only valid if the status field reports kSMDCRxT38StatusData.
status
The receiver status. One of these values:
kSMDCRxT38StatusEmpty
No data is available for reading.
kSMDCRxT38StatusTone
A T.38 tone indicator was received on this channel
kSMDCRxT38StatusV34
A T.38 v34 indicator was received on this channel
kSMDCRxT38StatusData
Some data is available for reading.
kSMDCRxT38StatusOverrun
Data has been lost because the buffer has overflowed.
kSMDCRxT38StatusCarrier
The input half is not receiving a meaningful signal.
kSMDCRxT38StatusFinished
The receiver has finished with data communications. When this status is reported, the channel's input half reverts to the idle state that it was in before smdc_rx_config_t38() was used. Therefore it can be re-configured or used for another purpose and a subsequent call to smdc_rx_status_t38() will report the error ERR_SM_WRONG_CHANNEL_STATE.
kSMDCRxT38StatusProtocol
The protocol of the data received has changed. This status is only possible when the channel has been configured to receive all protocols.
kSMDCRxT38StatusRate
v34 primary bit-rate in bits/s.
flow
Indicator of whether the receiver has stopped incoming data by using flow control (non-zero) or not (zero).
u
tone
This field is only valid if the status is kSMDCRxT38StatusTone
tone_type
The type of tone that was reported on this channel. One of these values:
kSMDCT38ToneTypeCNG
A CNG tone
kSMDCT38ToneTypeCED
A CED tone
kSMDCT38ToneTypeANSAM
An ANSAM tone
v34
This field is only valid if the status is kSMDCRxT38StatusV34
v34_type
The type of v34 action that was requested on this channel. This may be a switch from primary to control channel, or switch from control to primary channel or control channel retrain due to a synchronisation problem or a need for a new primary channel bitrate. One of these values:
kSMDCT38_V34Type_V34_CC_1200
A Control Channel
kSMDCT38_V34Type_V34_PRI_CHAN
A Primary Channel
kSMDCT38_V34Type_V34_CC_RETRAIN
A Control Channel Retrain
carrier
This field is only valid if the status is kSMDCRxT38StatusCarrier
carrier
The current carrier status: 0=off, 1=on.
rate
This field is only valid if the status is kSMDCRxT38StatusRate
rate
The primary bitrate value, anything from 2400 bps to 33600 bps.
protocol
This field is only valid if the status is kSMDCRxT38StatusProtocol
protocol
The protocol, from Table 4/T.38, of the data being received

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody data communications: API: smdc_rx_stop

Prototype Definition

int smdc_rx_stop(struct smdc_stop_parms *pp)

Parameters

*pp
a structure of the following type:
typedef struct smdc_stop_parms {
	tSMChannelId channel;					/* in */
} SMDC_STOP_PARMS;

Description

This stops the receive protocol configured on a channel. Unlike the kSMDCLineCtlCmdDisconnect command of smdc_line_control(), this does not use any disconnection procedures of the protocol - it simply stops immediately. It is intended for situations where there is no need to disconnect properly, such as when call control indicates that the remote party has cleared the call.

When the input half of a channel has stopped, smdc_rx_status() returns the status kSMDCRxStatusFinished.

See also the document Prosody Data Communcations Protocols and Encodings for details of behaviour specific to individual protocols and encodings.

Fields

channel
The data communication channel.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody data communications: API: smdc_stop

Prototype Definition

int smdc_stop(struct smdc_stop_parms *pp)

Parameters

*pp
a structure of the following type:
typedef struct smdc_stop_parms {
	tSMChannelId channel;					/* in */
} SMDC_STOP_PARMS;

Description

This stops any protocol configured on a channel. If the input half and the output half are configured with independent protocols, both are stopped. Unlike the kSMDCLineCtlCmdDisconnect command of smdc_line_control(), this does not use any disconnection procedures of the protocols - it simply stops immediately. It is intended for situations where there is no need to disconnect properly, such as when call control indicates that the remote party has cleared the call.

This function is equivalent to calling both smdc_rx_stop() and smdc_tx_stop() on the channel, except that it does not report an error if only one half of the channel is configured with a protocol.

When the input half of a channel has stopped, smdc_rx_status() returns the status kSMDCRxStatusFinished. When the output half of a channel has stopped smdc_tx_status() returns the status kSMDCTxStatusFinished.

See also the document Prosody Data Communcations Protocols and Encodings for details of behaviour specific to individual protocols and encodings.

Fields

channel
The data communication channel.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody data communications: API: smdc_tx_config_t38

Prototype Definition

int smdc_tx_config_t38(struct smdc_tx_config_t38_parms *configp)

Parameters

*configp
a structure of the following type:
typedef struct smdc_tx_config_t38_parms {
	tSMChannelId channel;					/* in */
	tSM_INT PreCorrigendum;					/* in */
	tSM_INT Protocol;					/* in */
	tSM_UT32 max_packet_length;				/* in */
} SMDC_TX_CONFIG_T38_PARMS;

Description

Configures a channel's output for data communications using the T.38 protocol.

The output half of a channel is reserved for this data communications configuration until smdc_tx_status() returns the status kSMDCTxStatusFinished. No other activity can take place on the output half of the channel during this time.

While the output half of a channel is configured for data communications, a write event associated with this channel using sm_channel_set_event() will be set while the channel is ready to allow data to be written or there may be a status change to report. See smdc_tx_control() for details of how this works. When an application discovers that this event is set, it should attempt to write data using smdc_tx_data(). See its description to see how this interacts with status changes.

The max_packet_length field is used to restrict the size of the IFP packet data produced by the channel. A value of zero will cause the maximum size to be the maximum permitted by the firmware, as will any value above that maximum.

Requires the module ifptx to have been downloaded.

Fields

channel
The channel to configure.
PreCorrigendum
Selects the version of T.38 to use. Non-zero selects the pre-Corrigendum (1998) version, zero selects the updated version (2002).
Protocol
A value from Table 4/T.38 which is sent in packets indicating which kind of modulation is being described.
max_packet_length
The maximum number of octets in the output IFP packets

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody data communications: API: smdc_tx_config_v34

Prototype Definition

int smdc_tx_config_v34(struct smdc_tx_config_v34_parms *configp)

Parameters

*configp
a structure of the following type:
typedef struct smdc_tx_config_v34_parms {
	tSMChannelId channel;					/* in */
	enum kSMDCV34Mode {
		kSMDCV34ModeOriginating,
		kSMDCV34ModeAnswering,
	} mode;							/* in */
	enum kSMDCV34Polling {
		kSMDCV34ModeNormal,
		kSMDCV34ModePolling,
	} polling;						/* in */
	enum kSMDCV34Duplex duplex;				/* in */
	tSM_INT min_bitrate;					/* in */
	tSM_INT max_bitrate;					/* in */
} SMDC_TX_CONFIG_V34_PARMS;

Description

Configures a channel's output for data communications using the V.34 protocol. The V.34 modem operates in a duplex manner (even when duplex is kSMDCV34HalfDuplex), so channel must be a full-duplex channel and its input half must also be configured using smdc_rx_config_v34().

The channel output is reserved for this data communications configuration until smdc_line_status_v34() returns the status kSMDCLinkStatusNotConnected. No other activity can take place on the channel during this time.

While the output half of a channel is configured for data communications, a write event associated with this channel using sm_channel_set_event() will be set while the channel is ready to accept more data or there may be a status change to report. See smdc_tx_control() for details of how this works. When an application discovers that this event is set, it may check the status using smdc_tx_status(). However, an application may simply try smdc_tx_data() immediately and check status when it refuses to accept data.

Requires the module v34fdx to have been downloaded if configuring for full duplex operation.

Requires the module v34 to have been downloaded if configuring for half duplex operation.

Fields

channel
The channel to configure.
mode
The negotiation procedure for V.34 modems requires that one modem be nominated as the originator and the other is the answerer. In half-duplex mode the originating modem is the one which can transmit on the primary channel. One of these values:
kSMDCV34ModeOriginating
This modem is the originating modem.
kSMDCV34ModeAnswering
This modem is the answering modem.
polling
V.34 half-duplex mode can only transmit data on the primary channel in one direction. There is no turnaround procedure, so to reverse the data flow the modem must be destroyed and a new modem created. One of these values:
kSMDCV34ModeNormal
Primary channel data is transferred from the originating modem to the answering modem.
kSMDCV34ModePolling
Primary channel data is transferred from the answering modem to the originating modem.
duplex
Selects full-duplex or half-duplex operation. The transmitter and receiver must both be configured with the same value for this parameter. One of these values:
kSMDCV34HalfDuplex
Configures the channel for half-duplex. Only one channel may transmit at the full modem speed at a time, or both may transmit on a much slower control channel.
kSMDCV34FullDuplex
Configures the channel for full-duplex. Both channels may transmit at the full modem speed simultaneously.
min_bitrate
The minimum bitrate to negotiate for the primary channel when it is transmitting data, in bits/second.
max_bitrate
The maximum bitrate to negotiate for the primary channel when it is transmitting data, in bits/second.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody data communications: API: smdc_tx_control

Prototype Definition

int smdc_tx_control(struct smdc_tx_control_parms *controlp)

Parameters

*controlp
a structure of the following type:
typedef struct smdc_tx_control_parms {
	tSMChannelId channel;					/* in */
	enum kSMDCTxCtl {
		kSMDCTxCtlDiscard,
		kSMDCTxCtlNotifyOnCapacity,
		kSMDCTxCtlNotifyOnEmpty,
		kSMDCTxCtlNoNotifyOnEmpty,
		kSMDCTxCtlFinish,
	} cmd;							/* in */
	tSM_INT capacity;					/* in */
	tSM_INT blocking;					/* in */
} SMDC_TX_CONTROL_PARMS;

Description

Performs a control operation on the output half of a data communications channel.

If the cmd field holds kSMDCTxCtlNotifyOnCapacity, the criterion is set for determining when the output half of the channel is ready. A channel is ready when there is space to buffer the amount of data specified by capacity. It ceases to be ready when the space falls below this value. When the output half of a channel is ready:

See also the document Prosody Data Communcations Protocols and Encodings for details of behaviour specific to individual protocols and encodings.

Fields

channel
The data communication channel.
cmd
The operation to perform. One of these values:
kSMDCTxCtlDiscard
Attempt to discard all data which has been buffered but has not yet been sent.
kSMDCTxCtlNotifyOnCapacity
Set the parameter which controls when this output reports that there is capacity for more data. The value is taken from the capacity field. Also enable notification of the presence of capacity. The blocking indicator is also set from the blocking field.
kSMDCTxCtlNotifyOnEmpty
Reserved value.
kSMDCTxCtlNoNotifyOnEmpty
Reserved value.
kSMDCTxCtlFinish
Indicate that there is no more data to be sent and that the transmitter should cease transmission when it has sent any data currently buffered. The channel's tx status becomes kSMDCTxStatusFinishing and any associated event will no longer be set by space being available for more data. It is an error to attempt to send more data after using this command.
capacity
The capacity (in octets) for the notification threshold. Only valid when the cmd field is kSMDCTxCtlNotifyOnCapacity. If this value is greater than zero, notification occurs when that number of octets of space is available. If it is less than zero, notification occurs when the amount of buffered data falls below that value. For example, the value -128 means that notification is to happen when only 128 octets of data is waiting to be sent. If it is zero, then any associated event will only be set when smdc_tx_status() needs to be called. See also the document Prosody application note: considerations for data transfer thresholds.
blocking
This field is currently ignored.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody data communications: API: smdc_tx_data

Prototype Definition

int smdc_tx_data(struct smdc_data_parms *datap)

Parameters

*datap
a structure of the following type:
typedef struct smdc_data_parms {
	tSMChannelId channel;					/* in */
	char *data;						/* in */
	tSM_INT max_length;					/* in */
	tSM_INT done_length;					/* out */
} SMDC_DATA_PARMS;

Description

Attempt to write data to a channel whose output half has been configured for a data commuications protocol. Less than the maximum will be written when either:

To permit maximum system throughput, this function refuses to write to a channel whose status has changed since it was last checked. This allows an application to avoid checking the status during bulk data transfer. The application only needs to check the status (using smdc_tx_status()) when a call to smdc_tx_data() returns with done_length equal to zero. If a status change occurs while writing data, done_length may indicate that some, but not all, of the data was written. In this case, the most convenient way for an application to react is often to note how much data has been sent, and to try to send more. Since the new attempt will indicate that no data was written, it means that the application does not need to have different cases to handle a status change at the beginning of the data buffer and a status change after a partial write.

See also the document Prosody Data Communcations Protocols and Encodings for details of behaviour specific to individual protocols and encodings.

Fields

channel
The data communication channel.
data
A pointer to the data to be written.
max_length
The amount of data in the buffer.
done_length
The amount of data actually written.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody data communications: API: smdc_tx_encoding

Prototype Definition

int smdc_tx_encoding(struct smdc_encoding_parms *encp)

Parameters

*encp
a structure of the following type:
typedef struct smdc_encoding_parms {
	tSMChannelId channel;					/* in */
	tSM_INT encoding;					/* in */
	tSM_INT encoding_config_length;				/* in */
	void *encoding_config_data;				/* in */
} SMDC_ENCODING_PARMS;

Description

Configures the transmit encoding for the output half of a channel which must have been already configured for data communications using smdc_channel_config().

For details of what encodings are available, and the format of their configuration data, see the document Prosody data communications Encodings.

Fields

channel
The channel to configure.
encoding
The desired encoding for data transmitted by the channel.
encoding_config_length
The length of the encoding-specific configuration data pointed to by encoding_config_data
encoding_config_data
Encoding-specific configuration data.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody data communications: API: smdc_tx_status

Prototype Definition

int smdc_tx_status(struct smdc_tx_status_parms *statusp)

Parameters

*statusp
a structure of the following type:
typedef struct smdc_tx_status_parms {
	tSMChannelId channel;					/* in */
	tSM_INT capacity;					/* out */
	enum kSMDCTxStatus {
		kSMDCTxStatusEmpty,
		kSMDCTxStatusHasCapacity,
		kSMDCTxStatusNoCapacity,
		kSMDCTxStatusUnderrun,
		kSMDCTxStatusFinishing,
		kSMDCTxStatusFinished,
	} status;						/* out */
	tSM_INT flow;						/* out */
} SMDC_TX_STATUS_PARMS;

Description

Report the status of the output half of a channel.

See also the document Prosody Data Communcations Protocols and Encodings for details of behaviour specific to individual protocols and encodings.

Fields

channel
The data communication channel.
capacity
The currently available capacity (in octets) to buffer more output data. Only valid if the status field reports kSMDCTxStatusHasCapacity.
status
The output status. One of these values:
kSMDCTxStatusEmpty
The transmitter has sent all data and is ready for more. This status is only reported where explicitly stated in the documentation of individual protocols
kSMDCTxStatusHasCapacity
The transmitter has some capacity to buffer more data, but has not yet sent all data previously buffered.
kSMDCTxStatusNoCapacity
The transmitter has no capacity to buffer more data.
kSMDCTxStatusUnderrun
At an inappropriate point the transmitter has run out of data to send.
kSMDCTxStatusFinishing
The application has used the command kSMDCTxCtlFinish but the transmitter has not yet sent all buffered data.
kSMDCTxStatusFinished
The transmitter has finished with data communications. When this status is reported, the channel's output half reverts to the idle state that it was in before smdc_channel_config() was used. Therefore it can be re-configured or used for another purpose and a subsequent call to smdc_tx_status() will report the error ERR_SM_WRONG_CHANNEL_STATE.
flow
Indicator of whether the transmitter has been stopped by flow control (non-zero) or not (zero).

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody data communications: API: smdc_tx_stop

Prototype Definition

int smdc_tx_stop(struct smdc_stop_parms *pp)

Parameters

*pp
a structure of the following type:
typedef struct smdc_stop_parms {
	tSMChannelId channel;					/* in */
} SMDC_STOP_PARMS;

Description

This stops the transmit protocol configured on a channel. Unlike the kSMDCLineCtlCmdDisconnect command of smdc_line_control(), this does not use any disconnection procedures of the protocol - it simply stops immediately. It is intended for situations where there is no need to disconnect properly, such as when call control indicates that the remote party has cleared the call.

When the output half of a channel has stopped smdc_tx_status() returns the status kSMDCTxStatusFinished.

See also the document Prosody Data Communcations Protocols and Encodings for details of behaviour specific to individual protocols and encodings.

Fields

channel
The data communication channel.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody data communications: API: smdc_tx_tone_indicator_t38

Prototype Definition

int smdc_tx_tone_indicator_t38(struct smdc_tx_tone_indicator_t38_parms *tonep)

Parameters

*tonep
a structure of the following type:
typedef struct smdc_tx_tone_indicator_t38_parms {
	tSMChannelId channel;					/* in */
	enum kSMDCT38ToneType {
		kSMDCT38ToneTypeCNG,
		kSMDCT38ToneTypeCED,
		kSMDCT38ToneTypeANSAM,
	} tone_type;						/* in */
} SMDC_TX_TONE_INDICATOR_T38_PARMS;

Description

Sends a T.38 tone indicator on the output half of a T.38 data communication channel.

T.38 tone indicators must be sent before sending any T.38 data on a given channel.

Fields

channel
The T.38 data communications channel
tone_type
The type of tone indicator to send One of these values:
kSMDCT38ToneTypeCNG
A CNG tone
kSMDCT38ToneTypeCED
A CED tone
kSMDCT38ToneTypeANSAM
An ANSAM tone

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody data communications: API: smdc_tx_v34_indicator_t38

Prototype Definition

int smdc_tx_v34_indicator_t38(struct smdc_tx_v34_indicator_t38_parms *tonep)

Parameters

*tonep
a structure of the following type:
typedef struct smdc_tx_v34_indicator_t38_parms {
	tSMChannelId channel;					/* in */
	enum kSMDCT38_V34Type v34_type;				/* int */
} SMDC_TX_V34_INDICATOR_T38_PARMS;

Description

Sends a T.38 v34 indicator on the output half of a T.38 data communication channel.

The T.38 V34_CC_1200 indicator is sent when a switch from primary channel to control channel is requested.

The T.38 V34_PRI_CHAN indicator is sent when a switch from control channel to primary channel is requested.

The T.38 V34_CC_RETRAIN indicator is sent when a new primary channel datarate is requested. This is usually followed by a T.38 data element with a field set to v34-pri-rate and the specific datarate.

Fields

channel
The T.38 data communications channel
v34_type
The type of v34 indicator to send One of these values:
kSMDCT38_V34Type_V34_CC_1200
A Control Channel
kSMDCT38_V34Type_V34_PRI_CHAN
A Primary Channel
kSMDCT38_V34Type_V34_CC_RETRAIN
A Control Channel Retrain

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody data communications: API: smdc_tx_v34_line_control_t38

Prototype Definition

int smdc_tx_v34_line_control_t38(struct smdc_tx_v34_line_control_t38_parms *configp)

Parameters

*configp
a structure of the following type:
typedef struct smdc_tx_v34_line_control_t38_parms {
	tSMChannelId channel;					/* in */
	tSM_UT32 primary_bitrate;				/* in */
} SMDC_TX_V34_LINE_CONTROL_T38_PARMS;

Description

Configures a channel's output for data communications using the T.38 protocol.

The output half of a channel is reserved for this data communications configuration. The primary_bitrate returned from smdc_line_status_v34() may be used to configure the v34 t38 line control channel to the same bitrate.

Fields

channel
The channel to configure.
primary_bitrate
The primary channel bitrate

Returns

0 if call completed successfully, otherwise a standard error such as:


These functions constitute the Prosody data communications API.