BALTECH SDK wrapper functions reference

§ brp_create_custom()

BRP_LIB brp_protocol brp_create_custom ( int  custom_index)

Creates a bare custom protocol whose callbacks are meant to be filled in by the caller (e.g.

a language binding implementing an I/O protocol or a transformation layer in its own runtime).

The returned protocol is allocated and owned by this library: its cb_destroy is preset to free the protocol via brp_protocol_free(), so it is released like any other protocol via brp_destroy(). The caller assigns the desired cb_* callbacks (and may wrap cb_destroy, as long as it still frees the protocol via brp_protocol_free()).

Parameters
custom_indexdistinguishes custom protocol types; must be in [0, 0x80) so the protocol_id stays in the custom range BRP_PROTID_CUSTOM(custom_index) (= 0x80 + index).
Returns
NULL on error (incl. custom_index out of range), otherwise the protocol