Stun Server
Compliant with the latest RFCs including 5389, 5769, and 5780
discover the local host's own external IP address
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
stunconnection.h
Go to the documentation of this file.
1
#ifndef STUN_CONNECTION_H
2
#define STUN_CONNECTION_H
3
4
#include "
stuncore.h
"
5
#include "
stunsocket.h
"
6
7
8
enum
StunConnectionState
9
{
10
ConnectionState_Idle
,
11
ConnectionState_Receiving
,
12
ConnectionState_Transmitting
13
};
14
15
16
struct
StunConnection
17
{
18
time_t
_timeStart
;
19
StunConnectionState
_state
;
20
CStunSocket
_stunsocket
;
21
CStunMessageReader
_reader
;
22
CRefCountedBuffer
_spReaderBuffer
;
23
CRefCountedBuffer
_spOutputBuffer
;
// contains the response
24
size_t
_txCount
;
// number of bytes of response transmitted thus far
25
int
_idHashTable
;
// hints at which hash table the connection got inserted into
26
StunConnection
*
pNext
;
// next item in pool - meaningless outside of the pool
27
};
28
29
30
31
class
CConnectionPool
32
{
33
private
:
34
35
StunConnection
*
_freelist
;
36
37
HRESULT
Grow();
38
39
40
public
:
41
CConnectionPool
();
42
~
CConnectionPool
();
43
44
StunConnection
* GetConnection(
int
sock,
SocketRole
role);
45
void
ReleaseConnection(
StunConnection
* pConn);
46
47
// ResetConnection resets streams to handle a subsequent incoming packet
48
// It's a lighter version of calling ReleaseConnection followed by GetConnection
49
void
ResetConnection(
StunConnection
* pConn);
50
51
void
Reset();
52
53
};
54
55
56
57
58
59
60
#endif
61
stunsocket.h
StunConnectionState
StunConnectionState
Definition:
stunconnection.h:8
StunConnection::_timeStart
time_t _timeStart
Definition:
stunconnection.h:18
StunConnection::pNext
StunConnection * pNext
Definition:
stunconnection.h:26
StunConnection::_txCount
size_t _txCount
Definition:
stunconnection.h:24
StunConnection::_reader
CStunMessageReader _reader
Definition:
stunconnection.h:21
CConnectionPool::_freelist
StunConnection * _freelist
Definition:
stunconnection.h:35
ConnectionState_Idle
Definition:
stunconnection.h:10
StunConnection::_idHashTable
int _idHashTable
Definition:
stunconnection.h:25
stuncore.h
SocketRole
SocketRole
Definition:
socketrole.h:22
StunConnection::_spReaderBuffer
CRefCountedBuffer _spReaderBuffer
Definition:
stunconnection.h:22
HRESULT
int32_t HRESULT
Definition:
hresult.h:22
ConnectionState_Transmitting
Definition:
stunconnection.h:12
StunConnection::_spOutputBuffer
CRefCountedBuffer _spOutputBuffer
Definition:
stunconnection.h:23
ConnectionState_Receiving
Definition:
stunconnection.h:11
StunConnection
Definition:
stunconnection.h:16
CStunSocket
Definition:
stunsocket.h:22
CRefCountedBuffer
boost::shared_ptr< CBuffer > CRefCountedBuffer
Definition:
buffer.h:65
CConnectionPool
Definition:
stunconnection.h:31
StunConnection::_stunsocket
CStunSocket _stunsocket
Definition:
stunconnection.h:20
CStunMessageReader
Definition:
stunreader.h:30
StunConnection::_state
StunConnectionState _state
Definition:
stunconnection.h:19
server
stunconnection.h
Generated by
1.8.11