[Net/GDNative] Remove GDNative network bits.

This commit is contained in:
Fabio Alessandrelli 2021-09-08 01:32:28 +02:00
parent 6cb81543d4
commit ead6d10715
17 changed files with 0 additions and 981 deletions

View file

@ -16,7 +16,6 @@ env_gdnative.Prepend(CPPPATH=["#modules/gdnative/include/"])
Export("env_gdnative")
SConscript("net/SCsub")
SConscript("pluginscript/SCsub")
SConscript("videodecoder/SCsub")
SConscript("text/SCsub")

View file

@ -10,14 +10,9 @@ def get_doc_classes():
return [
"GDNative",
"GDNativeLibrary",
"MultiplayerPeerGDNative",
"NativeScript",
"PacketPeerGDNative",
"PluginScript",
"StreamPeerGDNative",
"VideoStreamGDNative",
"WebRTCPeerConnectionGDNative",
"WebRTCDataChannelGDNative",
]

View file

@ -5104,97 +5104,6 @@
}
]
},
{
"name": "net",
"type": "NET",
"version": {
"major": 4,
"minor": 0
},
"next": null,
"api": [
{
"name": "godot_net_bind_stream_peer",
"return_type": "void",
"arguments": [
[
"godot_object *",
"p_obj"
],
[
"const godot_net_stream_peer *",
"p_interface"
]
]
},
{
"name": "godot_net_bind_packet_peer",
"return_type": "void",
"arguments": [
[
"godot_object *",
"p_obj"
],
[
"const godot_net_packet_peer *",
"p_interface"
]
]
},
{
"name": "godot_net_bind_multiplayer_peer",
"return_type": "void",
"arguments": [
[
"godot_object *",
"p_obj"
],
[
"const godot_net_multiplayer_peer *",
"p_interface"
]
]
},
{
"name": "godot_net_set_webrtc_library",
"return_type": "godot_error",
"arguments": [
[
"const godot_net_webrtc_library *",
"p_library"
]
]
},
{
"name": "godot_net_bind_webrtc_peer_connection",
"return_type": "void",
"arguments": [
[
"godot_object *",
"p_obj"
],
[
"const godot_net_webrtc_peer_connection *",
"p_interface"
]
]
},
{
"name": "godot_net_bind_webrtc_data_channel",
"return_type": "void",
"arguments": [
[
"godot_object *",
"p_obj"
],
[
"const godot_net_webrtc_data_channel *",
"p_interface"
]
]
}
]
},
{
"name": "text",
"type": "TEXT",

View file

@ -20,7 +20,6 @@ def _build_gdnative_api_struct_header(api):
"#include <gdnative/gdnative.h>",
"#include <android/godot_android.h>",
"#include <nativescript/godot_nativescript.h>",
"#include <net/godot_net.h>",
"#include <pluginscript/godot_pluginscript.h>",
"#include <videodecoder/godot_videodecoder.h>",
"#include <text/godot_text.h>",

View file

@ -1,122 +0,0 @@
/*************************************************************************/
/* godot_net.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef GODOT_NATIVENET_H
#define GODOT_NATIVENET_H
#include <gdnative/gdnative.h>
#ifdef __cplusplus
extern "C" {
#endif
// For future versions of the API we should only add new functions at the end of the structure and use the
// version info to detect whether a call is available
// Use these to populate version in your plugin
#define GODOT_NET_API_MAJOR 3
#define GODOT_NET_API_MINOR 1
typedef struct {
godot_gdnative_api_version version; /* version of our API */
godot_object *data; /* User reference */
/* This is StreamPeer */
godot_error (*get_data)(void *user, uint8_t *p_buffer, int p_bytes);
godot_error (*get_partial_data)(void *user, uint8_t *p_buffer, int p_bytes, int *r_received);
godot_error (*put_data)(void *user, const uint8_t *p_data, int p_bytes);
godot_error (*put_partial_data)(void *user, const uint8_t *p_data, int p_bytes, int *r_sent);
int (*get_available_bytes)(const void *user);
void *next; /* For extension? */
} godot_net_stream_peer;
/* Binds a StreamPeerGDNative to the provided interface */
void godot_net_bind_stream_peer(godot_object *p_obj, const godot_net_stream_peer *p_interface);
typedef struct {
godot_gdnative_api_version version; /* version of our API */
godot_object *data; /* User reference */
/* This is PacketPeer */
godot_error (*get_packet)(void *, const uint8_t **, int *);
godot_error (*put_packet)(void *, const uint8_t *, int);
godot_int (*get_available_packet_count)(const void *);
godot_int (*get_max_packet_size)(const void *);
void *next; /* For extension? */
} godot_net_packet_peer;
/* Binds a PacketPeerGDNative to the provided interface */
void GDAPI godot_net_bind_packet_peer(godot_object *p_obj, const godot_net_packet_peer *);
typedef struct {
godot_gdnative_api_version version; /* version of our API */
godot_object *data; /* User reference */
/* This is PacketPeer */
godot_error (*get_packet)(void *, const uint8_t **, int *);
godot_error (*put_packet)(void *, const uint8_t *, int);
godot_int (*get_available_packet_count)(const void *);
godot_int (*get_max_packet_size)(const void *);
/* This is MultiplayerPeer */
void (*set_transfer_channel)(void *, godot_int);
godot_int (*get_transfer_channel)(void *);
void (*set_transfer_mode)(void *, godot_int);
godot_int (*get_transfer_mode)(const void *);
// 0 = broadcast, 1 = server, <0 = all but abs(value)
void (*set_target_peer)(void *, godot_int);
godot_int (*get_packet_peer)(const void *);
godot_bool (*is_server)(const void *);
void (*poll)(void *);
// Must be > 0, 1 is for server
int32_t (*get_unique_id)(const void *);
void (*set_refuse_new_connections)(void *, godot_bool);
godot_bool (*is_refusing_new_connections)(const void *);
godot_int (*get_connection_status)(const void *);
void *next; /* For extension? Or maybe not... */
} godot_net_multiplayer_peer;
/* Binds a MultiplayerPeerGDNative to the provided interface */
void GDAPI godot_net_bind_multiplayer_peer(godot_object *p_obj, const godot_net_multiplayer_peer *);
#ifdef __cplusplus
}
#endif
// WebRTC Bindings
#include "net/godot_webrtc.h"
#endif /* GODOT_NATIVENET_H */

View file

@ -1,123 +0,0 @@
/*************************************************************************/
/* godot_webrtc.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef GODOT_NATIVEWEBRTC_H
#define GODOT_NATIVEWEBRTC_H
#include <gdnative/gdnative.h>
#ifdef __cplusplus
extern "C" {
#endif
#define GODOT_NET_WEBRTC_API_MAJOR 4
#define GODOT_NET_WEBRTC_API_MINOR 0
/* Library Interface (used to set default GDNative WebRTC implementation */
typedef struct {
godot_gdnative_api_version version; /* version of our API */
/* Called when the library is unset as default interface via godot_net_set_webrtc_library */
void (*unregistered)();
/* Used by WebRTCPeerConnection create when GDNative is the default implementation. */
/* Takes a pointer to WebRTCPeerConnectionGDNative, should bind and return OK, failure if binding was unsuccessful. */
godot_error (*create_peer_connection)(godot_object *);
void *next; /* For extension */
} godot_net_webrtc_library;
/* WebRTCPeerConnection interface */
typedef struct {
godot_gdnative_api_version version; /* version of our API */
godot_object *data; /* User reference */
/* This is WebRTCPeerConnection */
godot_int (*get_connection_state)(const void *);
godot_error (*initialize)(void *, const godot_dictionary *);
godot_object *(*create_data_channel)(void *, const char *p_channel_name, const godot_dictionary *);
godot_error (*create_offer)(void *);
godot_error (*create_answer)(void *); /* unused for now, should be done automatically on set_local_description */
godot_error (*set_remote_description)(void *, const char *, const char *);
godot_error (*set_local_description)(void *, const char *, const char *);
godot_error (*add_ice_candidate)(void *, const char *, int, const char *);
godot_error (*poll)(void *);
void (*close)(void *);
void *next; /* For extension? */
} godot_net_webrtc_peer_connection;
/* WebRTCDataChannel interface */
typedef struct {
godot_gdnative_api_version version; /* version of our API */
godot_object *data; /* User reference */
/* This is PacketPeer */
godot_error (*get_packet)(void *, const uint8_t **, int *);
godot_error (*put_packet)(void *, const uint8_t *, int);
godot_int (*get_available_packet_count)(const void *);
godot_int (*get_max_packet_size)(const void *);
/* This is WebRTCDataChannel */
void (*set_write_mode)(void *, godot_int);
godot_int (*get_write_mode)(const void *);
bool (*was_string_packet)(const void *);
godot_int (*get_ready_state)(const void *);
const char *(*get_label)(const void *);
bool (*is_ordered)(const void *);
int (*get_id)(const void *);
int (*get_max_packet_life_time)(const void *);
int (*get_max_retransmits)(const void *);
const char *(*get_protocol)(const void *);
bool (*is_negotiated)(const void *);
int (*get_buffered_amount)(const void *);
godot_error (*poll)(void *);
void (*close)(void *);
void *next; /* For extension? */
} godot_net_webrtc_data_channel;
/* Set the default GDNative library */
godot_error GDAPI godot_net_set_webrtc_library(const godot_net_webrtc_library *);
/* Binds a WebRTCPeerConnectionGDNative to the provided interface */
void GDAPI godot_net_bind_webrtc_peer_connection(godot_object *p_obj, const godot_net_webrtc_peer_connection *);
/* Binds a WebRTCDataChannelGDNative to the provided interface */
void GDAPI godot_net_bind_webrtc_data_channel(godot_object *p_obj, const godot_net_webrtc_data_channel *);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,12 +0,0 @@
#!/usr/bin/env python
Import("env")
Import("env_gdnative")
env_net = env_gdnative.Clone()
has_webrtc = env_net["module_webrtc_enabled"]
if has_webrtc:
env_net.Append(CPPDEFINES=["WEBRTC_GDNATIVE_ENABLED"])
env_net.add_source_files(env.modules_sources, "*.cpp")

View file

@ -1,136 +0,0 @@
/*************************************************************************/
/* multiplayer_peer_gdnative.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "multiplayer_peer_gdnative.h"
MultiplayerPeerGDNative::MultiplayerPeerGDNative() {
interface = nullptr;
}
MultiplayerPeerGDNative::~MultiplayerPeerGDNative() {
}
void MultiplayerPeerGDNative::set_native_multiplayer_peer(const godot_net_multiplayer_peer *p_interface) {
interface = p_interface;
}
Error MultiplayerPeerGDNative::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
ERR_FAIL_COND_V(interface == nullptr, ERR_UNCONFIGURED);
return (Error)interface->get_packet(interface->data, r_buffer, &r_buffer_size);
}
Error MultiplayerPeerGDNative::put_packet(const uint8_t *p_buffer, int p_buffer_size) {
ERR_FAIL_COND_V(interface == nullptr, ERR_UNCONFIGURED);
return (Error)interface->put_packet(interface->data, p_buffer, p_buffer_size);
}
int MultiplayerPeerGDNative::get_max_packet_size() const {
ERR_FAIL_COND_V(interface == nullptr, 0);
return interface->get_max_packet_size(interface->data);
}
int MultiplayerPeerGDNative::get_available_packet_count() const {
ERR_FAIL_COND_V(interface == nullptr, 0);
return interface->get_available_packet_count(interface->data);
}
/* MultiplayerPeer */
void MultiplayerPeerGDNative::set_transfer_channel(int p_channel) {
ERR_FAIL_COND(interface == nullptr);
return interface->set_transfer_channel(interface->data, p_channel);
}
int MultiplayerPeerGDNative::get_transfer_channel() const {
ERR_FAIL_COND_V(interface == nullptr, 0);
return interface->get_transfer_channel(interface->data);
}
void MultiplayerPeerGDNative::set_transfer_mode(Multiplayer::TransferMode p_mode) {
ERR_FAIL_COND(interface == nullptr);
interface->set_transfer_mode(interface->data, (godot_int)p_mode);
}
Multiplayer::TransferMode MultiplayerPeerGDNative::get_transfer_mode() const {
ERR_FAIL_COND_V(interface == nullptr, Multiplayer::TRANSFER_MODE_UNRELIABLE);
return (Multiplayer::TransferMode)interface->get_transfer_mode(interface->data);
}
void MultiplayerPeerGDNative::set_target_peer(int p_peer_id) {
ERR_FAIL_COND(interface == nullptr);
interface->set_target_peer(interface->data, p_peer_id);
}
int MultiplayerPeerGDNative::get_packet_peer() const {
ERR_FAIL_COND_V(interface == nullptr, 0);
return interface->get_packet_peer(interface->data);
}
bool MultiplayerPeerGDNative::is_server() const {
ERR_FAIL_COND_V(interface == nullptr, false);
return interface->is_server(interface->data);
}
void MultiplayerPeerGDNative::poll() {
ERR_FAIL_COND(interface == nullptr);
interface->poll(interface->data);
}
int MultiplayerPeerGDNative::get_unique_id() const {
ERR_FAIL_COND_V(interface == nullptr, 0);
return interface->get_unique_id(interface->data);
}
void MultiplayerPeerGDNative::set_refuse_new_connections(bool p_enable) {
ERR_FAIL_COND(interface == nullptr);
interface->set_refuse_new_connections(interface->data, p_enable);
}
bool MultiplayerPeerGDNative::is_refusing_new_connections() const {
ERR_FAIL_COND_V(interface == nullptr, true);
return interface->is_refusing_new_connections(interface->data);
}
MultiplayerPeer::ConnectionStatus MultiplayerPeerGDNative::get_connection_status() const {
ERR_FAIL_COND_V(interface == nullptr, CONNECTION_DISCONNECTED);
return (ConnectionStatus)interface->get_connection_status(interface->data);
}
void MultiplayerPeerGDNative::_bind_methods() {
ADD_PROPERTY_DEFAULT("transfer_channel", 0);
ADD_PROPERTY_DEFAULT("transfer_mode", Multiplayer::TRANSFER_MODE_UNRELIABLE);
ADD_PROPERTY_DEFAULT("refuse_new_connections", true);
}
extern "C" {
void GDAPI godot_net_bind_multiplayer_peer(godot_object *p_obj, const godot_net_multiplayer_peer *p_impl) {
((MultiplayerPeerGDNative *)p_obj)->set_native_multiplayer_peer(p_impl);
}
}

View file

@ -1,79 +0,0 @@
/*************************************************************************/
/* multiplayer_peer_gdnative.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef MULTIPLAYER_PEER_GDNATIVE_H
#define MULTIPLAYER_PEER_GDNATIVE_H
#include "core/multiplayer/multiplayer_peer.h"
#include "modules/gdnative/gdnative.h"
#include "modules/gdnative/include/net/godot_net.h"
class MultiplayerPeerGDNative : public MultiplayerPeer {
GDCLASS(MultiplayerPeerGDNative, MultiplayerPeer);
protected:
static void _bind_methods();
const godot_net_multiplayer_peer *interface;
public:
MultiplayerPeerGDNative();
~MultiplayerPeerGDNative();
/* Sets the interface implementation from GDNative */
void set_native_multiplayer_peer(const godot_net_multiplayer_peer *p_impl);
/* Specific to PacketPeer */
virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size) override;
virtual Error put_packet(const uint8_t *p_buffer, int p_buffer_size) override;
virtual int get_max_packet_size() const override;
virtual int get_available_packet_count() const override;
/* Specific to MultiplayerPeer */
virtual void set_transfer_channel(int p_channel) override;
virtual int get_transfer_channel() const override;
virtual void set_transfer_mode(Multiplayer::TransferMode p_mode) override;
virtual Multiplayer::TransferMode get_transfer_mode() const override;
virtual void set_target_peer(int p_peer_id) override;
virtual int get_packet_peer() const override;
virtual bool is_server() const override;
virtual void poll() override;
virtual int get_unique_id() const override;
virtual void set_refuse_new_connections(bool p_enable) override;
virtual bool is_refusing_new_connections() const override;
virtual ConnectionStatus get_connection_status() const override;
};
#endif // MULTIPLAYER_PEER_GDNATIVE_H

View file

@ -1,72 +0,0 @@
/*************************************************************************/
/* packet_peer_gdnative.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "packet_peer_gdnative.h"
PacketPeerGDNative::PacketPeerGDNative() {
interface = nullptr;
}
PacketPeerGDNative::~PacketPeerGDNative() {
}
void PacketPeerGDNative::set_native_packet_peer(const godot_net_packet_peer *p_impl) {
interface = p_impl;
}
void PacketPeerGDNative::_bind_methods() {
}
Error PacketPeerGDNative::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
ERR_FAIL_COND_V(interface == nullptr, ERR_UNCONFIGURED);
return (Error)interface->get_packet(interface->data, r_buffer, &r_buffer_size);
}
Error PacketPeerGDNative::put_packet(const uint8_t *p_buffer, int p_buffer_size) {
ERR_FAIL_COND_V(interface == nullptr, ERR_UNCONFIGURED);
return (Error)interface->put_packet(interface->data, p_buffer, p_buffer_size);
}
int PacketPeerGDNative::get_max_packet_size() const {
ERR_FAIL_COND_V(interface == nullptr, 0);
return interface->get_max_packet_size(interface->data);
}
int PacketPeerGDNative::get_available_packet_count() const {
ERR_FAIL_COND_V(interface == nullptr, 0);
return interface->get_available_packet_count(interface->data);
}
extern "C" {
void GDAPI godot_net_bind_packet_peer(godot_object *p_obj, const godot_net_packet_peer *p_impl) {
((PacketPeerGDNative *)p_obj)->set_native_packet_peer(p_impl);
}
}

View file

@ -1,59 +0,0 @@
/*************************************************************************/
/* packet_peer_gdnative.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef PACKET_PEER_GDNATIVE_H
#define PACKET_PEER_GDNATIVE_H
#include "core/io/packet_peer.h"
#include "modules/gdnative/gdnative.h"
#include "modules/gdnative/include/net/godot_net.h"
class PacketPeerGDNative : public PacketPeer {
GDCLASS(PacketPeerGDNative, PacketPeer);
protected:
static void _bind_methods();
const godot_net_packet_peer *interface;
public:
PacketPeerGDNative();
~PacketPeerGDNative();
/* Sets the interface implementation from GDNative */
void set_native_packet_peer(const godot_net_packet_peer *p_impl);
/* Specific to PacketPeer */
virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size) override;
virtual Error put_packet(const uint8_t *p_buffer, int p_buffer_size) override;
virtual int get_max_packet_size() const override;
virtual int get_available_packet_count() const override;
};
#endif // PACKET_PEER_GDNATIVE_H

View file

@ -1,43 +0,0 @@
/*************************************************************************/
/* register_types.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "register_types.h"
#include "multiplayer_peer_gdnative.h"
#include "packet_peer_gdnative.h"
#include "stream_peer_gdnative.h"
void register_net_types() {
GDREGISTER_CLASS(MultiplayerPeerGDNative);
GDREGISTER_CLASS(PacketPeerGDNative);
GDREGISTER_CLASS(StreamPeerGDNative);
}
void unregister_net_types() {
}

View file

@ -1,37 +0,0 @@
/*************************************************************************/
/* register_types.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef NET_REGISTER_TYPES_H
#define NET_REGISTER_TYPES_H
void register_net_types();
void unregister_net_types();
#endif // NET_REGISTER_TYPES_H

View file

@ -1,77 +0,0 @@
/*************************************************************************/
/* stream_peer_gdnative.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "stream_peer_gdnative.h"
StreamPeerGDNative::StreamPeerGDNative() {
interface = nullptr;
}
StreamPeerGDNative::~StreamPeerGDNative() {
}
void StreamPeerGDNative::set_native_stream_peer(const godot_net_stream_peer *p_interface) {
interface = p_interface;
}
void StreamPeerGDNative::_bind_methods() {
}
Error StreamPeerGDNative::put_data(const uint8_t *p_data, int p_bytes) {
ERR_FAIL_COND_V(interface == nullptr, ERR_UNCONFIGURED);
return (Error)(interface->put_data(interface->data, p_data, p_bytes));
}
Error StreamPeerGDNative::put_partial_data(const uint8_t *p_data, int p_bytes, int &r_sent) {
ERR_FAIL_COND_V(interface == nullptr, ERR_UNCONFIGURED);
return (Error)(interface->put_partial_data(interface->data, p_data, p_bytes, &r_sent));
}
Error StreamPeerGDNative::get_data(uint8_t *p_buffer, int p_bytes) {
ERR_FAIL_COND_V(interface == nullptr, ERR_UNCONFIGURED);
return (Error)(interface->get_data(interface->data, p_buffer, p_bytes));
}
Error StreamPeerGDNative::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_received) {
ERR_FAIL_COND_V(interface == nullptr, ERR_UNCONFIGURED);
return (Error)(interface->get_partial_data(interface->data, p_buffer, p_bytes, &r_received));
}
int StreamPeerGDNative::get_available_bytes() const {
ERR_FAIL_COND_V(interface == nullptr, 0);
return interface->get_available_bytes(interface->data);
}
extern "C" {
void GDAPI godot_net_bind_stream_peer(godot_object *p_obj, const godot_net_stream_peer *p_interface) {
((StreamPeerGDNative *)p_obj)->set_native_stream_peer(p_interface);
}
}

View file

@ -1,60 +0,0 @@
/*************************************************************************/
/* stream_peer_gdnative.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef STREAM_PEER_GDNATIVE_H
#define STREAM_PEER_GDNATIVE_H
#include "core/io/stream_peer.h"
#include "modules/gdnative/gdnative.h"
#include "modules/gdnative/include/net/godot_net.h"
class StreamPeerGDNative : public StreamPeer {
GDCLASS(StreamPeerGDNative, StreamPeer);
protected:
static void _bind_methods();
const godot_net_stream_peer *interface;
public:
StreamPeerGDNative();
~StreamPeerGDNative();
/* Sets the interface implementation from GDNative */
void set_native_stream_peer(const godot_net_stream_peer *p_interface);
/* Specific to StreamPeer */
Error put_data(const uint8_t *p_data, int p_bytes) override;
Error put_partial_data(const uint8_t *p_data, int p_bytes, int &r_sent) override;
Error get_data(uint8_t *p_buffer, int p_bytes) override;
Error get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_received) override;
int get_available_bytes() const override;
};
#endif // STREAM_PEER_GDNATIVE_H

View file

@ -1,60 +0,0 @@
/*************************************************************************/
/* webrtc_gdnative.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "modules/gdnative/gdnative.h"
#include "modules/gdnative/include/net/godot_net.h"
#ifdef WEBRTC_GDNATIVE_ENABLED
#include "modules/webrtc/webrtc_data_channel_gdnative.h"
#include "modules/webrtc/webrtc_peer_connection_gdnative.h"
#endif
extern "C" {
void GDAPI godot_net_bind_webrtc_peer_connection(godot_object *p_obj, const godot_net_webrtc_peer_connection *p_impl) {
#ifdef WEBRTC_GDNATIVE_ENABLED
((WebRTCPeerConnectionGDNative *)p_obj)->set_native_webrtc_peer_connection(p_impl);
#endif
}
void GDAPI godot_net_bind_webrtc_data_channel(godot_object *p_obj, const godot_net_webrtc_data_channel *p_impl) {
#ifdef WEBRTC_GDNATIVE_ENABLED
((WebRTCDataChannelGDNative *)p_obj)->set_native_webrtc_data_channel(p_impl);
#endif
}
godot_error GDAPI godot_net_set_webrtc_library(const godot_net_webrtc_library *p_lib) {
#ifdef WEBRTC_GDNATIVE_ENABLED
return (godot_error)WebRTCPeerConnectionGDNative::set_default_library(p_lib);
#else
return (godot_error)ERR_UNAVAILABLE;
#endif
}
}

View file

@ -35,7 +35,6 @@
#include "gdnative.h"
#include "nativescript/register_types.h"
#include "net/register_types.h"
#include "pluginscript/register_types.h"
#include "videodecoder/register_types.h"
@ -265,7 +264,6 @@ void register_gdnative_types() {
GDNativeCallRegistry::singleton->register_native_call_type("standard_varcall", cb_standard_varcall);
register_net_types();
register_nativescript_types();
register_pluginscript_types();
register_videodecoder_types();
@ -329,7 +327,6 @@ void unregister_gdnative_types() {
unregister_videodecoder_types();
unregister_pluginscript_types();
unregister_nativescript_types();
unregister_net_types();
memdelete(GDNativeCallRegistry::singleton);