mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
Use config to declare signal/stun server info
This commit is contained in:
@@ -12,16 +12,26 @@ using nlohmann::json;
|
||||
|
||||
static PeerConnection *peer_connection;
|
||||
|
||||
int CreatePeerConnection(const char *uri) {
|
||||
int CreatePeerConnection(Params params) {
|
||||
PeerConnection::Params pc_params;
|
||||
pc_params.cfg_path = params.cfg_path;
|
||||
pc_params.on_receive_buffer = params.on_receive_buffer;
|
||||
pc_params.net_status_report = params.net_status_report;
|
||||
|
||||
peer_connection = new PeerConnection();
|
||||
peer_connection->Init(uri);
|
||||
peer_connection->Init(pc_params);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CreatePeerConnectionWithID(const char *uri, const char *id) {
|
||||
int CreatePeerConnectionWithID(Params params, const char *id) {
|
||||
PeerConnection::Params pc_params;
|
||||
pc_params.cfg_path = params.cfg_path;
|
||||
pc_params.on_receive_buffer = params.on_receive_buffer;
|
||||
pc_params.net_status_report = params.net_status_report;
|
||||
|
||||
peer_connection = new PeerConnection();
|
||||
peer_connection->Init(uri, id);
|
||||
peer_connection->Init(pc_params, id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -7,9 +7,20 @@ enum ws_status { WS_CONNECTING = 0, WS_OPEN, WS_FAILED, WS_CLOSED, WS_UNKNOWN };
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int CreatePeerConnection(const char* uri);
|
||||
typedef void (*OnReceiveBuffer)(unsigned char*, size_t, const char*,
|
||||
const size_t);
|
||||
|
||||
int CreatePeerConnectionWithID(const char* uri, const char* id);
|
||||
typedef void (*NetStatusReport)(const unsigned short, const unsigned short);
|
||||
|
||||
typedef struct {
|
||||
const char* cfg_path;
|
||||
OnReceiveBuffer on_receive_buffer;
|
||||
NetStatusReport net_status_report;
|
||||
} Params;
|
||||
|
||||
int CreatePeerConnection(Params params);
|
||||
|
||||
int CreatePeerConnectionWithID(Params params, const char* id);
|
||||
|
||||
int SendData(const char* data, size_t size);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user