-
Notifications
You must be signed in to change notification settings - Fork 34
/
gdnet_peer.h
53 lines (33 loc) · 974 Bytes
/
gdnet_peer.h
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
42
43
44
45
46
47
48
49
50
51
52
53
/* gdnet_peer.h */
#ifndef GDNET_PEER_H
#define GDNET_PEER_H
#include "error_macros.h"
#include "reference.h"
#include "variant.h"
#include "enet/enet.h"
#include "gdnet_address.h"
#include "gdnet_host.h"
#include "gdnet_message.h"
class GDNetHost;
class GDNetPeer : public Reference {
OBJ_TYPE(GDNetPeer,Reference);
GDNetHost* _host;
ENetPeer* _peer;
protected:
static void _bind_methods();
public:
GDNetPeer(GDNetHost* host, ENetPeer* peer);
~GDNetPeer();
int get_peer_id();
Ref<GDNetAddress> get_address();
int get_avg_rtt();
void ping();
void reset();
void disconnect(int data = 0);
void disconnect_later(int data = 0);
void disconnect_now(int data = 0);
void send_packet(const ByteArray& packet, int channel_id = 0, int type = GDNetMessage::UNSEQUENCED);
void send_var(const Variant& var, int channel_id = 0, int type = GDNetMessage::UNSEQUENCED);
void set_timeout(int limit, int min_timeout, int max_timeout);
};
#endif