Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #include "NativeFeatureIncludes.h"
00009 #if _RAKNET_SUPPORT_PacketizedTCP==1
00010
00011 #ifndef __PACKETIZED_TCP
00012 #define __PACKETIZED_TCP
00013
00014 #include "TCPInterface.h"
00015 #include "DS_ByteQueue.h"
00016 #include "PluginInterface2.h"
00017 #include "DS_Map.h"
00018
00019 class RAK_DLL_EXPORT PacketizedTCP : public TCPInterface
00020 {
00021 public:
00022 PacketizedTCP();
00023 virtual ~PacketizedTCP();
00024
00027 bool Start(unsigned short port, unsigned short maxIncomingConnections, int threadPriority=-99999);
00028
00030 void Stop(void);
00031
00033 void Send( const char *data, unsigned length, SystemAddress systemAddress, bool broadcast );
00034
00035
00036 bool SendList( const char **data, const int *lengths, const int numParameters, SystemAddress systemAddress, bool broadcast );
00037
00039 Packet* Receive( void );
00040
00042 void CloseConnection( SystemAddress systemAddress );
00043
00046 SystemAddress HasCompletedConnectionAttempt(void);
00047
00050 SystemAddress HasFailedConnectionAttempt(void);
00051
00053 SystemAddress HasNewIncomingConnection(void);
00054
00056 SystemAddress HasLostConnection(void);
00057
00058
00059 void AttachPlugin( PluginInterface2 *plugin );
00060 void DetachPlugin( PluginInterface2 *plugin );
00061
00062 protected:
00063 void ClearAllConnections(void);
00064 void RemoveFromConnectionList(SystemAddress sa);
00065 void AddToConnectionList(SystemAddress sa);
00066 void PushNotificationsToQueues(void);
00067 Packet *ReturnOutgoingPacket(void);
00068
00069
00070 DataStructures::List<PluginInterface2*> messageHandlerList;
00071
00072 DataStructures::Queue<Packet*> waitingPackets;
00073 DataStructures::Map<SystemAddress, DataStructures::ByteQueue *> connections;
00074
00075
00076 DataStructures::Queue<SystemAddress> _newIncomingConnections, _lostConnections, _failedConnectionAttempts, _completedConnectionAttempts;
00077 };
00078
00079 #endif
00080
00081 #endif // _RAKNET_SUPPORT_*