• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

PacketizedTCP.h

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         // Sends a concatenated list of byte streams
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         // Only currently tested with FileListTransfer!
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         // Plugins
00070         DataStructures::List<PluginInterface2*> messageHandlerList;
00071         // A single TCP recieve may generate multiple split packets. They are stored in the waitingPackets list until Receive is called
00072         DataStructures::Queue<Packet*> waitingPackets;
00073         DataStructures::Map<SystemAddress, DataStructures::ByteQueue *> connections;
00074 
00075         // Mirrors single producer / consumer, but processes them in Receive() before returning to user
00076         DataStructures::Queue<SystemAddress> _newIncomingConnections, _lostConnections, _failedConnectionAttempts, _completedConnectionAttempts;
00077 };
00078 
00079 #endif
00080 
00081 #endif // _RAKNET_SUPPORT_*

Generated on Thu Sep 30 2010 01:27:25 for RakNet by  doxygen 1.7.1