Stun Server  Compliant with the latest RFCs including 5389, 5769, and 5780
discover the local host's own external IP address
stunclienttests.h
Go to the documentation of this file.
1 /*
2  Copyright 2011 John Selbie
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 */
16 
17 
18 
19 #ifndef STUNCLIENTTESTS_H
20 #define STUNCLIENTTESTS_H
21 
22 #include "stuntypes.h"
23 #include "buffer.h"
24 #include "stunbuilder.h"
25 
27 struct StunClientResults;
28 
29 
30 
31 
33 {
34 public:
35  virtual HRESULT Init(StunClientLogicConfig* pConfig, StunClientResults* pResults) = 0;
36  virtual void PreRunCheck() = 0; // gives a test a chance to complete right away based on the results of a previous test
37  virtual bool IsReadyToRun() = 0;
38  virtual HRESULT GetMessage(CRefCountedBuffer& spMsg, CSocketAddress* pAddrDest) = 0;
39  virtual HRESULT ProcessResponse(CRefCountedBuffer& spMsg, CSocketAddress& addrRemote, CSocketAddress& addrLocal) = 0;
40  virtual void NotifyTimeout() = 0;
41  virtual bool IsCompleted() = 0;
42 };
43 
44 
46 {
47 protected:
48  bool _fInit;
53 
54 
55  HRESULT StartBindingRequest(CStunMessageBuilder& builder);
56 
57  HRESULT BasicReaderValidation(CRefCountedBuffer& spMsg, CStunMessageReader& reader);
58 
59 
60 public:
62  virtual HRESULT Init(StunClientLogicConfig* pConfig, StunClientResults* pResults);
63  virtual void PreRunCheck();
64  virtual bool IsCompleted();
65 };
66 
67 
69 {
70 public:
71 
72  bool IsReadyToRun();
74  HRESULT ProcessResponse(CRefCountedBuffer& spMsg, CSocketAddress& addrRemote, CSocketAddress& addrLocal) ;
75  void NotifyTimeout();
76 };
77 
79 {
80 protected:
81  bool _fIsTest3;
82 
83 public:
84  CBehaviorTest();
85 
86  void PreRunCheck();
87  bool IsReadyToRun();
89  HRESULT ProcessResponse(CRefCountedBuffer& spMsg, CSocketAddress& addrRemote, CSocketAddress& addrLocal) ;
90  void NotifyTimeout();
91 
92  void RunAsTest3(bool fSetAsTest3);
93 };
94 
95 
97 {
98 protected:
99  bool _fIsTest3;
100 
101 public:
102  CFilteringTest();
103 
104  void PreRunCheck();
105  bool IsReadyToRun();
106  HRESULT GetMessage(CRefCountedBuffer& spMsg, CSocketAddress* pAddrDest) ;
107  HRESULT ProcessResponse(CRefCountedBuffer& spMsg, CSocketAddress& addrRemote, CSocketAddress& addrLocal) ;
108  void NotifyTimeout();
109 
110  void RunAsTest3(bool fSetAsTest3);
111 };
112 
113 
114 
115 #endif /* STUNCLIENTTESTS_H */
116 
virtual void NotifyTimeout()=0
virtual bool IsCompleted()=0
virtual HRESULT ProcessResponse(CRefCountedBuffer &spMsg, CSocketAddress &addrRemote, CSocketAddress &addrLocal)=0
int32_t HRESULT
Definition: hresult.h:22
StunClientLogicConfig * _pConfig
virtual bool IsReadyToRun()=0
virtual HRESULT GetMessage(CRefCountedBuffer &spMsg, CSocketAddress *pAddrDest)=0
virtual HRESULT Init(StunClientLogicConfig *pConfig, StunClientResults *pResults)=0
boost::shared_ptr< CBuffer > CRefCountedBuffer
Definition: buffer.h:65
StunTransactionId _transid
StunClientResults * _pResults
virtual void PreRunCheck()=0