tcpipDevice.h

Go to the documentation of this file.
00001 #ifndef TCPIP_DEVICE_H
00002 #define TCPIP_DEVICE_H
00003 
00013 #include "sdlBase.h"
00014 #include "connectionDevice.h"
00015 #ifdef HAVE_CONFIG_H
00016 #include <config.h>
00017 #endif
00018 #if !HAVE_CONFIG_H || HAVE_LIBSDL_NET
00019 #include <SDL_net.h>
00020 #endif
00021 
00022 
00026 class TcpipDevice : protected SDL_Base, public ConnectionDevice {
00027   friend class TcpipServer;
00028 
00029 #if !HAVE_CONFIG_H || HAVE_LIBSDL_NET
00030   TCPsocket tcp_socket;
00031   SDLNet_SocketSet own_set;
00032   static bool initialized;
00033   static int sockets_num;
00034   static int sockets_max;
00035   static SDLNet_SocketSet socket_set;
00036 #endif
00037   static void resizeSocketSet(void);
00038   void initialize(bool eachCheckSocket);
00039 
00040   int raw_connect(const char* host, long port);
00041   void raw_disconnect(void);
00042   int raw_setBaudrate(long baudrate);
00043   int raw_send(const char* data, int len);
00044   void raw_flush(void);
00045   void raw_check(int size, long timeout);
00046 #if !HAVE_CONFIG_H || HAVE_LIBSDL_NET
00047   void addSocket(TCPsocket socket);
00048   void delSocket(TCPsocket socket);
00049   static int checkAllSockets(long timeout = 0);
00050 #endif
00051 
00052 public:
00059   TcpipDevice(int buffer_size, bool eachCheckSockets = true);
00060 
00066   TcpipDevice(bool eachCheckSockets = true);
00067 #if !HAVE_CONFIG_H || HAVE_LIBSDL_NET
00068 
00075   TcpipDevice(TCPsocket net_socket, bool eachCheckSockets = true,
00076               int buffer_size = BufferSize-1);
00077 #endif
00078   virtual ~TcpipDevice(void);
00079 
00080   const char* what(void);
00081   bool isConnected(void);
00082 
00091   int checkSocket(long timeout = 0);
00092 };
00093 
00094 #endif /* !TCPIP_DEVICE_H */
00095 

Generated on Mon Apr 13 22:52:05 2009 by  doxygen 1.5.7.1