summaryrefslogtreecommitdiff
path: root/src/WebRTCPeer.cpp
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2018-08-12 04:18:44 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2018-08-12 04:50:28 +0200
commitb238ad6dad6942fc6a53dfee5d22e12ad8b13df5 (patch)
tree4f7aa168855296b5d6c98c7b273987759d805247 /src/WebRTCPeer.cpp
parent46f45cc37388b442aa83fab76d26b81cc13bb9ca (diff)
downloadfork-godot-webrtc-native-b238ad6dad6942fc6a53dfee5d22e12ad8b13df5.tar.gz
fork-godot-webrtc-native-b238ad6dad6942fc6a53dfee5d22e12ad8b13df5.tar.bz2
fork-godot-webrtc-native-b238ad6dad6942fc6a53dfee5d22e12ad8b13df5.zip
Add initial interface
Diffstat (limited to 'src/WebRTCPeer.cpp')
-rw-r--r--src/WebRTCPeer.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/WebRTCPeer.cpp b/src/WebRTCPeer.cpp
new file mode 100644
index 0000000..bc77438
--- /dev/null
+++ b/src/WebRTCPeer.cpp
@@ -0,0 +1,36 @@
+#include "WebRTCPeer.hpp"
+
+godot_error WebRTCPeer::get_packet(const uint8_t **r_buffer, int &r_len) {
+ printf("Get packet");
+ r_len = 0;
+ return GODOT_OK;
+}
+
+godot_error WebRTCPeer::put_packet(const uint8_t *p_buffer, int p_len) {
+ printf("Put packet");
+ return GODOT_OK;
+}
+
+godot_int WebRTCPeer::get_available_packet_count() const {
+ printf("Get packet count");
+ return 2;
+}
+
+godot_int WebRTCPeer::get_max_packet_size() const {
+ printf("Get max packet size");
+ return 1024;
+}
+
+void WebRTCPeer::_register_methods() { }
+
+void WebRTCPeer::_init() {
+ printf("Binding PacketPeer interface");
+ godot_net_bind_webrtc_peer(_owner, &interface);
+}
+
+WebRTCPeer::~WebRTCPeer() {
+ if (_owner) {
+ printf("Unbinding PacketPeer interface");
+ godot_net_bind_webrtc_peer(_owner, NULL);
+ }
+}