29 #if !defined(_SPANDSP_SPRT_H_) 30 #define _SPANDSP_SPRT_H_ 32 #define SPRT_MIN_TC0_PAYLOAD_BYTES 140 33 #define SPRT_MAX_TC0_PAYLOAD_BYTES 256 34 #define SPRT_DEFAULT_TC0_PAYLOAD_BYTES 140 36 #define SPRT_MIN_TC1_PAYLOAD_BYTES 132 37 #define SPRT_MAX_TC1_PAYLOAD_BYTES 256 38 #define SPRT_DEFAULT_TC1_PAYLOAD_BYTES 132 40 #define SPRT_MIN_TC1_WINDOWS_SIZE 32 41 #define SPRT_MAX_TC1_WINDOWS_SIZE 96 42 #define SPRT_DEFAULT_TC1_WINDOWS_SIZE 32 44 #define SPRT_MIN_TC2_PAYLOAD_BYTES 132 45 #define SPRT_MAX_TC2_PAYLOAD_BYTES 256 46 #define SPRT_DEFAULT_TC2_PAYLOAD_BYTES 132 48 #define SPRT_MIN_TC2_WINDOWS_SIZE 8 49 #define SPRT_MAX_TC2_WINDOWS_SIZE 32 50 #define SPRT_DEFAULT_TC2_WINDOWS_SIZE 8 52 #define SPRT_MIN_TC3_PAYLOAD_BYTES 140 53 #define SPRT_MAX_TC3_PAYLOAD_BYTES 256 54 #define SPRT_DEFAULT_TC3_PAYLOAD_BYTES 140 57 #define SPRT_MAX_WINDOWS_SIZE 96 61 #define SPRT_DEFAULT_TIMER_TC1_TA01 90000 62 #define SPRT_DEFAULT_TIMER_TC1_TA02 130000 63 #define SPRT_DEFAULT_TIMER_TC1_TR03 500000 65 #define SPRT_DEFAULT_TIMER_TC2_TA01 90000 66 #define SPRT_DEFAULT_TIMER_TC2_TA02 500000 67 #define SPRT_DEFAULT_TIMER_TC2_TR03 500000 69 #define SPRT_MIN_MAX_TRIES 1 70 #define SPRT_MAX_MAX_TRIES 20 71 #define SPRT_DEFAULT_MAX_TRIES 10 76 SPRT_STATUS_EXCESS_RETRIES = 1,
77 SPRT_STATUS_SUBSESSION_CHANGED = 2,
78 SPRT_STATUS_OUT_OF_SEQUENCE = 3
83 enum sprt_tcid_range_view_e
86 SPRT_TCID_MIN_RELIABLE = 1,
87 SPRT_TCID_MAX_RELIABLE = 2,
92 #define SPRT_CHANNELS 4 97 SPRT_TCID_UNRELIABLE_UNSEQUENCED = 0,
98 SPRT_TCID_RELIABLE_SEQUENCED = 1,
99 SPRT_TCID_EXPEDITED_RELIABLE_SEQUENCED = 2,
100 SPRT_TCID_UNRELIABLE_SEQUENCED = 3
110 enum sprt_timer_action_e
113 SPRT_TIMER_CLEAR = 1,
114 SPRT_TIMER_ADJUST = 2
119 uint16_t payload_bytes;
120 uint16_t window_size;
126 typedef int (*sprt_tx_packet_handler_t) (
void *user_data,
const uint8_t pkt[],
int len);
127 typedef int (*sprt_rx_delivery_handler_t) (
void *user_data,
int channel,
int seq_no,
const uint8_t msg[],
int len);
128 typedef span_timestamp_t (*sprt_timer_handler_t) (
void *user_data, span_timestamp_t timeout);
132 #if defined(__cplusplus) 141 SPAN_DECLARE(
int) sprt_timer_expired(
sprt_state_t *s, span_timestamp_t now);
163 SPAN_DECLARE(
int) sprt_set_local_tc_windows_size(
sprt_state_t *s,
int channel,
int size);
165 SPAN_DECLARE(
int) sprt_get_local_tc_windows_size(
sprt_state_t *s,
int channel);
167 SPAN_DECLARE(
int) sprt_set_local_tc_payload_bytes(
sprt_state_t *s,
int channel,
int max_len);
169 SPAN_DECLARE(
int) sprt_get_local_tc_payload_bytes(
sprt_state_t *s,
int channel);
171 SPAN_DECLARE(
int) sprt_set_local_tc_max_tries(
sprt_state_t *s,
int channel,
int max_tries);
173 SPAN_DECLARE(
int) sprt_get_local_tc_max_tries(
sprt_state_t *s,
int channel);
175 SPAN_DECLARE(
int) sprt_set_far_tc_payload_bytes(
sprt_state_t *s,
int channel,
int max_len);
177 SPAN_DECLARE(
int) sprt_get_far_tc_payload_bytes(
sprt_state_t *s,
int channel);
179 SPAN_DECLARE(
int) sprt_set_far_tc_windows_size(
sprt_state_t *s,
int channel,
int size);
181 SPAN_DECLARE(
int) sprt_get_far_tc_windows_size(
sprt_state_t *s,
int channel);
183 SPAN_DECLARE(
int) sprt_set_tc_timeout(
sprt_state_t *s,
int channel,
int timer,
int timeout);
185 SPAN_DECLARE(
int) sprt_get_tc_timeout(
sprt_state_t *s,
int channel,
int timer);
224 uint8_t subsession_id,
225 uint8_t rx_payload_type,
226 uint8_t tx_payload_type,
228 sprt_tx_packet_handler_t tx_packet_handler,
230 sprt_rx_delivery_handler_t rx_delivery_handler,
232 sprt_timer_handler_t timer_handler,
233 void *timer_user_data,
235 void *status_user_data);
247 #if defined(__cplusplus) int sprt_release(sprt_state_t *s)
Release an SPRT context.
Definition: sprt.c:1330
bool sprt_get_far_busy_status(sprt_state_t *s, int channel)
Test if far end of SPRT context is busy.
Definition: sprt.c:1193
sprt_state_t * sprt_init(sprt_state_t *s, uint8_t subsession_id, uint8_t rx_payload_type, uint8_t tx_payload_type, channel_parms_t parms[4], sprt_tx_packet_handler_t tx_packet_handler, void *tx_user_data, sprt_rx_delivery_handler_t rx_delivery_handler, void *rx_user_data, sprt_timer_handler_t timer_handler, void *timer_user_data, span_modem_status_func_t status_handler, void *status_user_data)
Initialise an SPRT context.
Definition: sprt.c:1205
const char * sprt_transmission_channel_to_str(int channel)
Find the name of an SPRT channel.
Definition: sprt.c:136
Definition: private/sprt.h:95
int sprt_set_local_busy(sprt_state_t *s, int channel, bool busy)
Test if local end of SPRT context is busy.
Definition: sprt.c:1170
void(* span_modem_status_func_t)(void *user_data, int status)
Definition: async.h:131
logging_state_t * sprt_get_logging_state(sprt_state_t *s)
Get the logging context associated with an SPRT context.
Definition: sprt.c:1199
int sprt_free(sprt_state_t *s)
Free an SPRT context.
Definition: sprt.c:1336
int sprt_rx_packet(sprt_state_t *s, const uint8_t pkt[], int len)
Process a packet arriving from the far end. If the packet validates as an SPRT packet 0 is returned...
Definition: sprt.c:655
int sprt_tx(sprt_state_t *s, int channel, const uint8_t buf[], int len)
Send a message to a SPRT channel.
Definition: sprt.c:903
Definition: private/logging.h:33