40#if !defined(_SPANDSP_HDLC_H_)
41#define _SPANDSP_HDLC_H_
46#define HDLC_MAXFRAME_LEN 400
48typedef void (*hdlc_frame_handler_t)(
void *user_data,
const uint8_t *pkt,
int len,
int ok);
49typedef 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)
void(* modem_status_func_t)(void *user_data, int status)
Definition: async.h:114
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:350
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:599
int hdlc_tx_free(hdlc_tx_state_t *s)
Free an HDLC transmitter context.
Definition: hdlc.c:665
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:357
int hdlc_tx_restart(hdlc_tx_state_t *s)
Re-initialise an HDLC transmitter context.
Definition: hdlc.c:605
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:327
int hdlc_tx_frame(hdlc_tx_state_t *s, const uint8_t *frame, size_t len)
Transmit a frame.
Definition: hdlc.c:389
int hdlc_tx_release(hdlc_tx_state_t *s)
Release an HDLC transmitter context.
Definition: hdlc.c:659
int hdlc_rx_restart(hdlc_rx_state_t *s)
Re-initialise an HDLC receiver context.
Definition: hdlc.c:313
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:300
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:424
SPAN_DECLARE_NONSTD(void) hdlc_rx_put_bit(hdlc_rx_state_t *s
Put a single bit of data to an HDLC receiver.
int hdlc_rx_release(hdlc_rx_state_t *s)
Release an HDLC receiver context.
Definition: hdlc.c:364
int hdlc_rx_get_stats(hdlc_rx_state_t *s, hdlc_rx_stats_t *t)
Get the current receive statistics.
Definition: hdlc.c:377
int hdlc_tx_abort(hdlc_tx_state_t *s)
Send an abort.
Definition: hdlc.c:440
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:450
void hdlc_rx_set_octet_counting_report_interval(hdlc_rx_state_t *s, int interval)
Set the octet counting report interval.
Definition: hdlc.c:307
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:626
int hdlc_rx_free(hdlc_rx_state_t *s)
Free an HDLC receiver context.
Definition: hdlc.c:370
Definition: private/hdlc.h:33
unsigned long int length_errors
The number of too short and too long frames received.
Definition: hdlc.h:68
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
unsigned long int good_frames
The number of good frames received.
Definition: hdlc.h:64
unsigned long int bytes
The number of bytes of good frames received (CRC not included).
Definition: hdlc.h:62
Definition: private/hdlc.h:92
size_t len
The length of the message in the buffer.
Definition: private/hdlc.h:122
int inter_frame_flags
The minimum flag octets to insert between frames.
Definition: private/hdlc.h:100
int progressive
TRUE if frame creation works in progressive mode.
Definition: private/hdlc.h:102
void * user_data
An opaque parameter passed to the callback routine.
Definition: private/hdlc.h:98