2020-11-16 14:50:54 +01:00

74 lines
3.6 KiB
C++

#include <cstdint>
#include <cstdlib>
#ifdef __cplusplus
extern "C" {
#endif
/* Attention: Do not call any librtc functions within being in the callback, only librtc_destroy_client is allowed */
struct NativeCallbacks {
uint32_t version;
void(*log)(uint8_t /* level */, const void* /* callback data */, const char* /* message */, uint32_t /* length */);
void(*free_client_data)(const void*);
uint32_t(*rtc_configure)(const void* /* callback data */, void* /* configure callback data */);
void(*client_stream_assignment)(const void* /* callback data */, uint32_t /* stream id */, const void* /* source callback data */);
void(*client_offer_generated)(const void* /* callback data */, const char* /* offer */, size_t /* offer length */);
void(*client_stream_start)(const void* /* callback data */, uint32_t /* stream id */, const void* /* source callback data */);
void(*client_stream_stop)(const void* /* callback data */, uint32_t /* stream id */, const void* /* source callback data */);
void(*client_audio_sender_data)(const void* /* callback data */, const void* /* source callback data */, uint8_t /* mode */, uint16_t /* seq. no. */, uint8_t /* codec */, const void* /* data */, uint32_t /* length */);
};
struct RtpClientConfigureOptions {
uint16_t min_port;
uint16_t max_port;
bool ice_tcp;
bool ice_udp;
bool ice_upnp;
const char* stun_host;
uint16_t stun_port;
};
extern const char* librtc_version();
extern void librtc_free_str(const char* /* ptr */);
extern const char* librtc_init(const NativeCallbacks* /* */, size_t /* size of the callback struct */);
extern void* librtc_create_server();
extern void librtc_destroy_server(void* /* server */);
extern uint32_t librtc_create_rtp_client(void* /* server */, void* /* callback data */, const char** /* error ptr */);
extern uint32_t librtc_create_native_client(void* /* server */, void* /* callback data */);
extern void librtc_destroy_client(void* /* server */, uint32_t /* client id */);
extern const char* librtc_rtc_configure(void* /* callback data */, const RtpClientConfigureOptions* /* config */, size_t /* config size */);
extern const char* librtc_reset_rtp_session(void* /* server */, uint32_t /* client id */);
extern const char* librtc_apply_remote_description(void* /* server */, uint32_t /* client id */, uint32_t /* mode */, const char* /* description */);
extern const char* librtc_generate_local_description(void* /* server */, uint32_t /* client id */, char** /* description */);
extern const char* librtc_add_ice_candidate(void* /* server */, uint32_t /* client id */, uint32_t /* media line */, const char* /* candidate */);
extern void* librtc_create_audio_source_supplier(void* /* server */, uint32_t /* client id */);
extern void librtc_audio_source_supply(void* /* sender */,
uint16_t /* seq no */,
bool /* marked */,
uint32_t /* timestamp */,
uint8_t /* codec */,
const void* /* data */,
uint32_t /* length */);
extern void librtc_destroy_audio_source_supplier(void* /* sender */);
extern uint32_t librtc_create_channel(void* /* server */);
extern uint32_t librtc_assign_channel(void* /* server */, uint32_t /* client id */, uint32_t /* channel id */);
extern uint32_t librtc_client_broadcast(void* /* server */, uint32_t /* client id */, uint8_t /* broadcast type */, uint32_t /* stream id */);
extern void librtc_destroy_channel(void* /* server */, uint32_t /* channel */);
#ifdef __cplusplus
};
#endif