Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
vsnet_socket.h
Go to the documentation of this file.
1
/*
2
* This program is free software; you can redistribute it and/or
3
* modify it under the terms of the GNU General Public License
4
* as published by the Free Software Foundation; either version 2
5
* of the License, or (at your option) any later version.
6
*
7
* This program is distributed in the hope that it will be useful,
8
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
* GNU General Public License for more details.
11
*
12
* You should have received a copy of the GNU General Public License
13
* along with this program; if not, write to the Free Software
14
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15
*/
16
17
#ifndef VSNET_SOCKET_H
18
#define VSNET_SOCKET_H
19
20
#include <config.h>
21
22
#include <boost/shared_ptr.hpp>
23
24
#include <iostream>
25
26
#include "
vsnet_address.h
"
27
#include "
vsnet_socketset.h
"
28
#include "
packetmem.h
"
29
30
class
Packet
;
31
class
VsnetSocket
;
32
class
SocketSet
;
33
34
class
SOCKETALT
35
{
36
typedef
boost::shared_ptr< VsnetSocket >ptr;
37
38
ptr _sock;
39
40
public
:
41
LOCALCONST_DECL
(
bool
, TCP, 1 )
42
LOCALCONST_DECL
(
bool
, UDP, 0 )
43
44
public
:
SOCKETALT
();
45
SOCKETALT
(
const
SOCKETALT
&orig );
46
SOCKETALT
(
VsnetSocket
*sock );
47
SOCKETALT
(
int
sock,
bool
mode,
const
AddressIP
&remote_ip,
SocketSet
&set );
48
//not actually a socketalt SOCKETALT( std::string url, SocketSet& sets );
49
SOCKETALT
&
operator=
(
const
SOCKETALT
&orig );
50
51
int
get_fd
()
const
;
52
bool
valid
()
const
;
53
bool
isTcp
()
const
;
54
int
queueLen
(
int
pri );
55
int
optPayloadSize
()
const
;
56
bool
isActive
();
57
//int sendbuf( PacketMem& packet, const AddressIP* to, int pcktflags );
58
int
sendbuf
(
Packet
*packet,
const
AddressIP
*to,
int
pcktflags );
59
bool
set_nonblock
();
60
bool
set_block
();
61
62
int
recvbuf
(
Packet
*p,
AddressIP
*ipadr );
63
void
disconnect
(
const
char
*s );
64
65
bool
sameAddress
(
const
SOCKETALT
&l )
const
;
66
bool
lowerAddress
(
const
SOCKETALT
&l )
const
;
67
68
friend
std::ostream&
operator<<
( std::ostream &ostr,
const
SOCKETALT
&s );
69
friend
bool
operator==
(
const
SOCKETALT
&l,
const
SOCKETALT
&r );
70
71
void
addToSet
(
SocketSet
&set );
72
void
setSet
(
SocketSet
*set );
73
74
const
AddressIP
&
getRemoteAddress
()
const
;
75
//returns false if impossible (TCP)
76
bool
setRemoteAddress
(
const
AddressIP
& );
77
78
const
AddressIP
&
getLocalAddress
()
const
;
79
bool
setLocalAddress
(
const
AddressIP
& );
80
83
friend
class
CompareLt
;
84
class
CompareLt
85
{
86
public
:
87
bool
operator()
(
const
SOCKETALT
&l,
const
SOCKETALT
&r )
const
;
88
};
89
};
90
91
std::ostream&
operator<<
( std::ostream &ostr,
const
SOCKETALT
&s );
92
bool
operator==
(
const
SOCKETALT
&l,
const
SOCKETALT
&r );
93
94
#endif
/* VSNET_SOCKET_H */
95
src
networking
lowlevel
vsnet_socket.h
Generated on Fri May 29 2015 23:07:35 for Vegastrike 0.5.1 rc1 by
1.8.4