20 #ifndef __PROTOCOL_H__ 21 #define __PROTOCOL_H__ 90 typedef size_t (*brp_cb_fmt_spec_t)
104 brp_cb_fmt_spec_t fmt_spec_callback,
116 brp_frame instance_id
146 struct brp_protocol_t
152 brp_cb_generic_t cb_open;
153 brp_cb_generic_t cb_close;
154 brp_cb_generic_t cb_send_frame;
155 brp_cb_recv_any_frame_t cb_recv_any_frame;
156 brp_cb_recv_frame_t cb_recv_frame;
157 brp_cb_generic_t cb_flush;
158 brp_cb_generic_t cb_destroy;
159 brp_cb_get_id_t cb_get_id;
170 struct brp_frame_t send_frame;
176 struct brp_frame_t recv_frame;
233 brp_cb_fmt_spec_t fmt_spec_callback,
258 #define BRP_FMTSPEC_EXPECT_MORE(frame_rdr, requested_byte_cnt) do { \ 259 if (brp_frame_read_err(frame_rdr)) \ 261 else if (brp_frame_rest(frame_rdr) < (requested_byte_cnt)) \ 262 return (requested_byte_cnt) - brp_frame_rest(frame_rdr); \ 271 #define BRP_FMTSPEC_EXPECT_END(frame_rdr) do { \ 272 if (! brp_frame_read_eof(frame_rdr)) \ 347 brp_frame instance_id
BRP_LIB brp_errcode brp_flush(brp_protocol)
Deletes all data that is waiting in input buffers for being read via brp_recv_frame() (or brp_recv_fi...
int brp_layer_id
identifies the layer of a composite protocol stack (see brp_create() or brp_create_composite().
Contains all possible error codes that could be returned by BRP library.
unsigned int brp_errcode
This type is used library-wide for passing error codes in the return value of functions.
Every protocol has to be identified unique by a protocol ID.
struct brp_protocol_t * brp_protocol
This is a generic handle of a protocol.
unsigned long brp_time
absolute/relative timeout/delay in ms.
BRP_LIB brp_errcode brp_close(brp_protocol protocol)
Closes protocol.
struct brp_mempool_object_t * brp_mempool
mempool handle.
BRP_LIB brp_errcode brp_open(brp_protocol protocol)
Set up a connection via this protocol.
BRP_LIB brp_errcode brp_destroy(brp_protocol)
Closes a protocol if opened and frees all allocated resources thereafter.
Defines frame objects that allow dynamic sized buffers to be handled easily.
BRP_LIB brp_errcode brp_get_io_id(brp_protocol protocol, char **intf_name, brp_frame instance_id)
Retrieves the instance name of the I/O-protocol of this protocol stack.
Contains the basic defines that are required throughout the BRP library.
Defines a mempool that allows centralized memory allocation.