summaryrefslogtreecommitdiff
path: root/src/WebRTCPeer.hpp
blob: 72560bc08808022d448ba8eedbf5740984948186 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef WEBRTC_PEER_H
#define WEBRTC_PEER_H

#include <Godot.hpp>

#include "net/WebRTCPeerNative.hpp"

namespace godot_webrtc {

class WebRTCPeer : public WebRTCPeerNative {
	GODOT_CLASS(WebRTCPeer, WebRTCPeerNative);

public:
	static void _register_methods();

	void _init();

	void set_write_mode(godot_int mode);
	godot_int get_write_mode() const;
	bool was_string_packet() const;
	godot_int get_connection_state() const;

	godot_error create_offer();
	godot_error set_remote_description(const char *type, const char *sdp);
	godot_error set_local_description(const char *type, const char *sdp);
	godot_error add_ice_candidate(const char *sdpMidName, int sdpMlineIndexName, const char *sdpName);
	godot_error poll();

	/* WebRTCPeer */
	virtual godot_error get_packet(const uint8_t **r_buffer, int &r_len);
	virtual godot_error put_packet(const uint8_t *p_buffer, int p_len);
	virtual godot_int get_available_packet_count() const;
	virtual godot_int get_max_packet_size() const;

	WebRTCPeer();
	~WebRTCPeer();
};

}

#endif // WEBRTC_PEER_H