summaryrefslogtreecommitdiff
path: root/src/net/WebRTCDataChannelNative.hpp
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2021-09-22 23:06:19 +0200
committerGitHub <noreply@github.com>2021-09-22 23:06:19 +0200
commit8c18112f5dcf96bf24fab14ab4470c00ab7f7f70 (patch)
tree32593cc621a8908e021d6fe044a59d8238b46524 /src/net/WebRTCDataChannelNative.hpp
parentc37cc530e739d58b272d78f2749d21a5c58debce (diff)
parent3bdf6cdc1320dfd7ac0f1704976a633ef3c911d8 (diff)
downloadfork-godot-webrtc-native-8c18112f5dcf96bf24fab14ab4470c00ab7f7f70.tar.gz
fork-godot-webrtc-native-8c18112f5dcf96bf24fab14ab4470c00ab7f7f70.tar.bz2
fork-godot-webrtc-native-8c18112f5dcf96bf24fab14ab4470c00ab7f7f70.zip
Merge pull request #43 from dsnopek/buffered-amount
Add get_buffered_amount() to WebRTCDataChannel (GDNative)
Diffstat (limited to 'src/net/WebRTCDataChannelNative.hpp')
-rw-r--r--src/net/WebRTCDataChannelNative.hpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/net/WebRTCDataChannelNative.hpp b/src/net/WebRTCDataChannelNative.hpp
index 37b8616..20ef38e 100644
--- a/src/net/WebRTCDataChannelNative.hpp
+++ b/src/net/WebRTCDataChannelNative.hpp
@@ -54,13 +54,30 @@ int get_max_packet_life_time_wdc(const void *);
int get_max_retransmits_wdc(const void *);
const char *get_protocol_wdc(const void *);
bool is_negotiated_wdc(const void *);
+int get_buffered_amount_wdc(const void *);
godot_error poll_wdc(void *);
void close_wdc(void *);
+#if GODOT_NET_WEBRTC_API_MAJOR == 3 && GODOT_NET_WEBRTC_API_MINOR < 4
+extern "C" {
+/* Extensions to WebRTCDataChannel */
+typedef struct {
+ int (*get_buffered_amount)(const void *);
+
+ void *next; /* For extension? */
+} godot_net_webrtc_data_channel_ext;
+}
+#endif
+
class WebRTCDataChannelNative : public godot::WebRTCDataChannelGDNative {
GODOT_CLASS(WebRTCDataChannelNative, godot::WebRTCDataChannelGDNative);
protected:
+ godot_net_webrtc_data_channel_ext interface_ext = {
+ &get_buffered_amount_wdc,
+ NULL,
+ };
+
godot_net_webrtc_data_channel interface = {
{ 3, 1 },
this,
@@ -84,7 +101,7 @@ protected:
&poll_wdc,
&close_wdc,
- NULL,
+ &interface_ext,
};
public:
@@ -105,6 +122,7 @@ public:
virtual int get_max_retransmits() const = 0;
virtual const char *get_protocol() const = 0;
virtual bool is_negotiated() const = 0;
+ virtual int get_buffered_amount() const = 0;
virtual godot_error poll() = 0;
virtual void close() = 0;