Debian Codegraph @

modules/upnp/upnp.cpp

raw symbols SCIP
1 /**************************************************************************/
2 /* upnp.cpp */
3 /**************************************************************************/
4 /* This file is part of: */
5 /* GODOT ENGINE */
6 /* https://godotengine.org */
7 /**************************************************************************/
8 /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9 /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10 /* */
11 /* Permission is hereby granted, free of charge, to any person obtaining */
12 /* a copy of this software and associated documentation files (the */
13 /* "Software"), to deal in the Software without restriction, including */
14 /* without limitation the rights to use, copy, modify, merge, publish, */
15 /* distribute, sublicense, and/or sell copies of the Software, and to */
16 /* permit persons to whom the Software is furnished to do so, subject to */
17 /* the following conditions: */
18 /* */
19 /* The above copyright notice and this permission notice shall be */
20 /* included in all copies or substantial portions of the Software. */
21 /* */
22 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29 /**************************************************************************/
30
31 #include "upnp.h"
32
33 UPNP *(*UPNP::_create)(bool p_notify_postinitialize) = nullptr;
34
35 void UPNP::_bind_methods() {
36 ClassDB::bind_method(D_METHOD("get_device_count"), &UPNP::get_device_count);
37 ClassDB::bind_method(D_METHOD("get_device", "index"), &UPNP::get_device);
38 ClassDB::bind_method(D_METHOD("add_device", "device"), &UPNP::add_device);
39 ClassDB::bind_method(D_METHOD("set_device", "index", "device"), &UPNP::set_device);
40 ClassDB::bind_method(D_METHOD("remove_device", "index"), &UPNP::remove_device);
41 ClassDB::bind_method(D_METHOD("clear_devices"), &UPNP::clear_devices);
42
43 ClassDB::bind_method(D_METHOD("get_gateway"), &UPNP::get_gateway);
44
45 ClassDB::bind_method(D_METHOD("discover", "timeout", "ttl", "device_filter"), &UPNP::discover, DEFVAL(2000), DEFVAL(2), DEFVAL("InternetGatewayDevice"));
46
47 ClassDB::bind_method(D_METHOD("query_external_address"), &UPNP::query_external_address);
48
49 ClassDB::bind_method(D_METHOD("add_port_mapping", "port", "port_internal", "desc", "proto", "duration"), &UPNP::add_port_mapping, DEFVAL(0), DEFVAL(""), DEFVAL("UDP"), DEFVAL(0));
50 ClassDB::bind_method(D_METHOD("delete_port_mapping", "port", "proto"), &UPNP::delete_port_mapping, DEFVAL("UDP"));
51
52 ClassDB::bind_method(D_METHOD("set_discover_multicast_if", "m_if"), &UPNP::set_discover_multicast_if);
53 ClassDB::bind_method(D_METHOD("get_discover_multicast_if"), &UPNP::get_discover_multicast_if);
54 ADD_PROPERTY(PropertyInfo(Variant::STRING, "discover_multicast_if"), "set_discover_multicast_if", "get_discover_multicast_if");
55
56 ClassDB::bind_method(D_METHOD("set_discover_local_port", "port"), &UPNP::set_discover_local_port);
57 ClassDB::bind_method(D_METHOD("get_discover_local_port"), &UPNP::get_discover_local_port);
58 ADD_PROPERTY(PropertyInfo(Variant::INT, "discover_local_port", PROPERTY_HINT_RANGE, "0,65535"), "set_discover_local_port", "get_discover_local_port");
59
60 ClassDB::bind_method(D_METHOD("set_discover_ipv6", "ipv6"), &UPNP::set_discover_ipv6);
61 ClassDB::bind_method(D_METHOD("is_discover_ipv6"), &UPNP::is_discover_ipv6);
62 ADD_PROPERTY(PropertyInfo(Variant::BOOL, "discover_ipv6"), "set_discover_ipv6", "is_discover_ipv6");
63
64 BIND_ENUM_CONSTANT(UPNP_RESULT_SUCCESS);
65 BIND_ENUM_CONSTANT(UPNP_RESULT_NOT_AUTHORIZED);
66 BIND_ENUM_CONSTANT(UPNP_RESULT_PORT_MAPPING_NOT_FOUND);
67 BIND_ENUM_CONSTANT(UPNP_RESULT_INCONSISTENT_PARAMETERS);
68 BIND_ENUM_CONSTANT(UPNP_RESULT_NO_SUCH_ENTRY_IN_ARRAY);
69 BIND_ENUM_CONSTANT(UPNP_RESULT_ACTION_FAILED);
70 BIND_ENUM_CONSTANT(UPNP_RESULT_SRC_IP_WILDCARD_NOT_PERMITTED);
71 BIND_ENUM_CONSTANT(UPNP_RESULT_EXT_PORT_WILDCARD_NOT_PERMITTED);
72 BIND_ENUM_CONSTANT(UPNP_RESULT_INT_PORT_WILDCARD_NOT_PERMITTED);
73 BIND_ENUM_CONSTANT(UPNP_RESULT_REMOTE_HOST_MUST_BE_WILDCARD);
74 BIND_ENUM_CONSTANT(UPNP_RESULT_EXT_PORT_MUST_BE_WILDCARD);
75 BIND_ENUM_CONSTANT(UPNP_RESULT_NO_PORT_MAPS_AVAILABLE);
76 BIND_ENUM_CONSTANT(UPNP_RESULT_CONFLICT_WITH_OTHER_MECHANISM);
77 BIND_ENUM_CONSTANT(UPNP_RESULT_CONFLICT_WITH_OTHER_MAPPING);
78 BIND_ENUM_CONSTANT(UPNP_RESULT_SAME_PORT_VALUES_REQUIRED);
79 BIND_ENUM_CONSTANT(UPNP_RESULT_ONLY_PERMANENT_LEASE_SUPPORTED);
80 BIND_ENUM_CONSTANT(UPNP_RESULT_INVALID_GATEWAY);
81 BIND_ENUM_CONSTANT(UPNP_RESULT_INVALID_PORT);
82 BIND_ENUM_CONSTANT(UPNP_RESULT_INVALID_PROTOCOL);
83 BIND_ENUM_CONSTANT(UPNP_RESULT_INVALID_DURATION);
84 BIND_ENUM_CONSTANT(UPNP_RESULT_INVALID_ARGS);
85 BIND_ENUM_CONSTANT(UPNP_RESULT_INVALID_RESPONSE);
86 BIND_ENUM_CONSTANT(UPNP_RESULT_INVALID_PARAM);
87 BIND_ENUM_CONSTANT(UPNP_RESULT_HTTP_ERROR);
88 BIND_ENUM_CONSTANT(UPNP_RESULT_SOCKET_ERROR);
89 BIND_ENUM_CONSTANT(UPNP_RESULT_MEM_ALLOC_ERROR);
90 BIND_ENUM_CONSTANT(UPNP_RESULT_NO_GATEWAY);
91 BIND_ENUM_CONSTANT(UPNP_RESULT_NO_DEVICES);
92 BIND_ENUM_CONSTANT(UPNP_RESULT_UNKNOWN_ERROR);
93 }