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)
97 int report_bad_frames,
98 int framing_ok_threshold,
99 hdlc_frame_handler_t handler,
183 hdlc_underflow_handler_t handler,
245 #if defined(__cplusplus)
int hdlc_rx_free(hdlc_rx_state_t *s)
Free an HDLC receiver context.
Definition: hdlc.c:348
void hdlc_rx_set_octet_counting_report_interval(hdlc_rx_state_t *s, int interval)
Set the octet counting report interval.
Definition: hdlc.c:299
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:328
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:428
SPAN_DECLARE_NONSTD(int) async_tx_get_bit(void *user_data)
Get the next bit of a transmitted serial bit stream.
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:402
void * user_data
An opaque parameter passed to the callback routine.
Definition: private/hdlc.h:98
Definition: private/hdlc.h:91
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:355
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:292
int hdlc_rx_release(hdlc_rx_state_t *s)
Release an HDLC receiver context.
Definition: hdlc.c:342
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:367
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:577
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:583
int hdlc_tx_abort(hdlc_tx_state_t *s)
Send an abort.
Definition: hdlc.c:418
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:305
void(* modem_rx_status_func_t)(void *user_data, int status)
Definition: async.h:108
Definition: private/hdlc.h:32
void hdlc_rx_set_status_handler(hdlc_rx_state_t *s, modem_rx_status_func_t handler, void *user_data)
Change the status report function associated with an HDLC receiver context.
Definition: hdlc.c:335
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