Panda3D
 All Classes Functions Variables Enumerations
baseincomingset.h
1 #ifndef __BASEINCOMINGSET_H__
2 #define __BASEINCOMINGSET_H__
3 
4 #include <list>
5 #include "socket_base.h"
6 
7 enum CloseState
8 {
9  ConnectionDoNotClose,
10  ConnectionDoClose
11 };
12 // RHH
13 ////////////////////////////////////////////////////////////////////
14 // Template :BaseIncomingSet
15 //
16 // Description : A base structre for a listening socket and a
17 // set of connection that have been received with there read functions..
18 //
19 // Think of this like a web server with 1 listening socket and 0-n open reacting conections..
20 //
21 // The general operation if get connection..
22 // do you have a message
23 // process message
24 // go back to do you have a message or close connection
25 //
26 //
27 ////////////////////////////////////////////////////////////////////
28 template < class _INCLASS1,class _IN_LISTEN, class MESSAGE_READER_BUF, class MESSAGE_READER_UPPASS> class BaseIncomingSet : public std::list<_INCLASS1 *>
29 {
30  typedef std::list<_INCLASS1 *> BaseClass;
31  typedef TYPENAME BaseClass::iterator iterator;
32  _IN_LISTEN _Listener;
33 
34  inline void AddFromListener(void);
35  inline int PumpReader(Time_Clock &currentTime);
36  inline void AddAConection(_INCLASS1 * newt);
37 
38 public:
39 
40 // typedef typename BaseIncomingSet<_INCLASS1, _IN_LISTEN, MESSAGE_READER_BUF, MESSAGE_READER_UPPASS>::LinkNode LinkNode;
41 
42 // typedef SentDblLinkListNode_Gm SentDblLinkListNode_Gm;
43  inline BaseIncomingSet(void);
44  inline BaseIncomingSet(BaseIncomingSet &in);
45  virtual ~BaseIncomingSet();
46 
47  inline _IN_LISTEN & GetListener(void);
48  inline bool init(Socket_Address &WhereFrom);
49  inline void PumpAll(Time_Clock &currentTime);
50  virtual CloseState ProcessNewConnection(SOCKET socket);
51  inline void AddToFDSet(Socket_fdset &set);
52 
53 // inline LinkNode * GetRoot(void) { return &this->sentenal; };
54  BaseIncomingSet &operator=( BaseIncomingSet &inval);
55  void Reset();
56 };
57 
58 #include "baseincomingset.i"
59 
60 #endif //__BASEINCOMINGSET_H__
61 
62 
63 
A simple place to store and munipulate tcp and port address for communication layer.
A base structre for a listening socket and a set of connection that have been received with there rea...