forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnetAddress.h
More file actions
63 lines (50 loc) · 1.65 KB
/
netAddress.h
File metadata and controls
63 lines (50 loc) · 1.65 KB
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
54
55
56
57
58
59
60
61
62
// Filename: netAddress.h
// Created by: drose (08Feb00)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#ifndef NETADDRESS_H
#define NETADDRESS_H
#include "pandabase.h"
#include "numeric_types.h"
#include "socket_address.h"
////////////////////////////////////////////////////////////////////
// Class : NetAddress
// Description : Represents a network address to which UDP packets may
// be sent or to which a TCP socket may be bound.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA_NET NetAddress {
PUBLISHED:
NetAddress();
NetAddress(const Socket_Address &addr);
bool set_any(int port);
bool set_localhost(int port);
bool set_broadcast(int port);
bool set_host(const string &hostname, int port);
void clear();
int get_port() const;
void set_port(int port);
string get_ip_string() const;
PN_uint32 get_ip() const;
PN_uint8 get_ip_component(int n) const;
const Socket_Address &get_addr() const;
void output(ostream &out) const;
size_t get_hash() const;
bool operator == (const NetAddress &other) const;
bool operator != (const NetAddress &other) const;
private:
Socket_Address _addr;
};
INLINE ostream &operator << (ostream &out, const NetAddress &addr) {
addr.output(out);
return out;
}
#endif