Stun Server  Compliant with the latest RFCs including 5389, 5769, and 5780
discover the local host's own external IP address
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 
9 {
13 };
14 
15 
17 {
18  time_t _timeStart;
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 
32 {
33 private:
34 
36 
37  HRESULT Grow();
38 
39 
40 public:
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 
StunConnectionState
Definition: stunconnection.h:8
StunConnection * pNext
CStunMessageReader _reader
StunConnection * _freelist
SocketRole
Definition: socketrole.h:22
CRefCountedBuffer _spReaderBuffer
int32_t HRESULT
Definition: hresult.h:22
CRefCountedBuffer _spOutputBuffer
boost::shared_ptr< CBuffer > CRefCountedBuffer
Definition: buffer.h:65
CStunSocket _stunsocket
StunConnectionState _state