Stun Server  Compliant with the latest RFCs including 5389, 5769, and 5780
discover the local host's own external IP address
testpolling.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 #ifndef TEST_POLLING_H
18 #define TEST_POLLING_H
19 
20 struct PipePair
21 {
22  int readpipe;
23  int writepipe;
25 };
26 
27 
28 class CTestPolling : public IUnitTest
29 {
30 
31 public:
33  std::vector<PipePair> _pipes;
34 
35  uint32_t _polltype;
36 
37  void TestUnInit();
38 
39  HRESULT TestInit(size_t sizePolling, size_t sizePipeArray); // creates pipes and polling mechanism;
40 
41  HRESULT CreateAndAddPipe();
42  HRESULT WritePipe(PipePair* pPipePair);
43  HRESULT SetNonBlocking(int fd);
44  HRESULT ConsumeEvent(int* pFD, int* pCount); // returns file descriptor of what was last handled
45  int FindPipePairIndex(int fd);
46  size_t GetPendingCount();
47  HRESULT RemovePipe(int pipeindex);
48 
49  HRESULT Test1();
50  HRESULT Test2();
51  HRESULT Test3();
52 
53  HRESULT Run();
54 
55  CTestPolling();
56  ~CTestPolling();
57 
58  UT_DECLARE_TEST_NAME("CTestPolling");
59 
60 };
61 
62 
63 #endif
CRefCountedPtr< IPolling > _spPolling
Definition: testpolling.h:32
int readpipe
Definition: testpolling.h:22
bool fDataPending
Definition: testpolling.h:24
std::vector< PipePair > _pipes
Definition: testpolling.h:33
int writepipe
Definition: testpolling.h:23
uint32_t _polltype
Definition: testpolling.h:35
int32_t HRESULT
Definition: hresult.h:22
#define UT_DECLARE_TEST_NAME(testname)
Definition: unittest.h:32