40 #if !defined(_SPANDSP_HDLC_H_)
41 #define _SPANDSP_HDLC_H_
46 #define HDLC_MAXFRAME_LEN 400
48 typedef void (*hdlc_frame_handler_t)(
void *user_data,
const uint8_t *pkt,
int len,
int ok);
49 typedef void (*hdlc_underflow_handler_t)(
void *user_data);
79 #if defined(__cplusplus)
98 int report_bad_frames,
99 int framing_ok_threshold,
100 hdlc_frame_handler_t handler,
192 hdlc_underflow_handler_t handler,
269 #if defined(__cplusplus)
int hdlc_rx_free(hdlc_rx_state_t *s)
Free an HDLC receiver context.
Definition: hdlc.c:418
void hdlc_rx_set_octet_counting_report_interval(hdlc_rx_state_t *s, int interval)
Set the octet counting report interval.
Definition: hdlc.c:353
void hdlc_rx_set_frame_handler(hdlc_rx_state_t *s, hdlc_frame_handler_t handler, void *user_data)
Change the put_bit function associated with an HDLC receiver context.
Definition: hdlc.c:398
int inter_frame_flags
The minimum flag octets to insert between frames.
Definition: private/hdlc.h:100
int hdlc_tx_corrupt_frame(hdlc_tx_state_t *s)
Corrupt the frame currently being transmitted, by giving it the wrong CRC.
Definition: hdlc.c:507
void(* modem_status_func_t)(void *user_data, int status)
Definition: async.h:116
int hdlc_tx_flags(hdlc_tx_state_t *s, int len)
Transmit a specified quantity of flag octets, typically as a preamble.
Definition: hdlc.c:479
int hdlc_tx_release(hdlc_tx_state_t *s)
Release an HDLC transmitter context.
Definition: hdlc.c:740
void * user_data
An opaque parameter passed to the callback routine.
Definition: private/hdlc.h:98
void hdlc_rx_set_status_handler(hdlc_rx_state_t *s, modem_status_func_t handler, void *user_data)
Change the status report function associated with an HDLC receiver context.
Definition: hdlc.c:405
Definition: private/hdlc.h:91
int hdlc_tx_free(hdlc_tx_state_t *s)
Free an HDLC transmitter context.
Definition: hdlc.c:746
int progressive
True if frame creation works in progressive mode.
Definition: private/hdlc.h:102
int hdlc_rx_get_stats(hdlc_rx_state_t *s, hdlc_rx_stats_t *t)
Get the current receive statistics.
Definition: hdlc.c:425
SPAN_DECLARE_NONSTD(void) async_rx_put_bit(void *user_data
Accept a bit from a received serial bit stream.
unsigned long int aborts
The number of HDLC aborts received.
Definition: hdlc.h:70
unsigned long int crc_errors
The number of frames with CRC errors received.
Definition: hdlc.h:66
void hdlc_rx_set_max_frame_len(hdlc_rx_state_t *s, size_t max_len)
Set the maximum frame length for an HDLC receiver context.
Definition: hdlc.c:346
int hdlc_rx_release(hdlc_rx_state_t *s)
Release an HDLC receiver context.
Definition: hdlc.c:412
size_t len
The length of the message in the buffer.
Definition: private/hdlc.h:122
int hdlc_tx_frame(hdlc_tx_state_t *s, const uint8_t *frame, size_t len)
Transmit a frame.
Definition: hdlc.c:437
void hdlc_tx_set_max_frame_len(hdlc_tx_state_t *s, size_t max_len)
Set the maximum frame length for an HDLC transmitter context.
Definition: hdlc.c:676
int hdlc_tx_restart(hdlc_tx_state_t *s)
Re-initialise an HDLC transmitter context.
Definition: hdlc.c:682
hdlc_tx_state_t * hdlc_tx_init(hdlc_tx_state_t *s, int crc32, int inter_frame_flags, int progressive, hdlc_underflow_handler_t handler, void *user_data)
Initialise an HDLC transmitter context.
Definition: hdlc.c:704
int hdlc_tx_abort(hdlc_tx_state_t *s)
Send an abort.
Definition: hdlc.c:497
hdlc_rx_state_t * hdlc_rx_init(hdlc_rx_state_t *s, int crc32, int report_bad_frames, int framing_ok_threshold, hdlc_frame_handler_t handler, void *user_data)
Initialise an HDLC receiver context.
Definition: hdlc.c:373
int hdlc_rx_restart(hdlc_rx_state_t *s)
Re-initialise an HDLC receiver context.
Definition: hdlc.c:359
Definition: private/hdlc.h:32
unsigned long int length_errors
The number of too short and too long frames received.
Definition: hdlc.h:68
unsigned long int bytes
The number of bytes of good frames received (CRC not included).
Definition: hdlc.h:62
unsigned long int good_frames
The number of good frames received.
Definition: hdlc.h:64