Browse Subversion Repository
Contents of /connection/TcpipCtrl.h
Parent Directory
| Revision Log
Revision 191 -
( show annotations)
( download)
( as text)
Fri Jan 4 02:49:36 2008 UTC
(16 years, 3 months ago)
by satofumi
File MIME type: text/x-chdr
File size: 1362 byte(s)
using namespace beego
| 1 |
#ifndef TCPIP_CTRL_H |
| 2 |
#define TCPIP_CTRL_H |
| 3 |
|
| 4 |
/*! |
| 5 |
\file |
| 6 |
\brief TCP/IP Úą |
| 7 |
|
| 8 |
\author Satofumi KAMIMURA |
| 9 |
|
| 10 |
$Id$ |
| 11 |
*/ |
| 12 |
|
| 13 |
#include "ConnectionInterface.h" |
| 14 |
#ifdef HAVE_CONFIG_H |
| 15 |
#include "config.h" |
| 16 |
#endif |
| 17 |
#if !HAVE_CONFIG_H || HAVE_LIBSDL_NET |
| 18 |
#include <SDL_net.h> |
| 19 |
#else |
| 20 |
namespace beego { |
| 21 |
class TCPsocket { |
| 22 |
public: |
| 23 |
TCPsocket(void *dummy) { |
| 24 |
} |
| 25 |
}; |
| 26 |
|
| 27 |
class SDLNet_SocketSet { |
| 28 |
public: |
| 29 |
SDLNet_SocketSet(void *dummy) { |
| 30 |
} |
| 31 |
}; |
| 32 |
|
| 33 |
class IPaddress { |
| 34 |
}; |
| 35 |
}; |
| 36 |
#endif |
| 37 |
#include <memory> |
| 38 |
|
| 39 |
namespace beego { |
| 40 |
|
| 41 |
class SocketSet; |
| 42 |
|
| 43 |
|
| 44 |
/*! |
| 45 |
\brief TCP/IP Úąnh |
| 46 |
*/ |
| 47 |
class TcpipCtrl : public ConnectionInterface { |
| 48 |
TcpipCtrl(const TcpipCtrl& rhs); |
| 49 |
TcpipCtrl& operator = (const TcpipCtrl& rhs); |
| 50 |
|
| 51 |
struct pImpl; |
| 52 |
const std::auto_ptr<pImpl> pimpl; |
| 53 |
|
| 54 |
public: |
| 55 |
enum { NoTimeout = -1 }; |
| 56 |
TcpipCtrl(void); |
| 57 |
explicit TcpipCtrl(SocketSet* socketSet, TCPsocket socket = NULL); |
| 58 |
~TcpipCtrl(void); |
| 59 |
|
| 60 |
const char* what(void); |
| 61 |
bool connect(const char* host, long port); |
| 62 |
void disconnect(void); |
| 63 |
bool isConnected(void); |
| 64 |
bool changeBaudrate(long baudrate); |
| 65 |
int send(const char* data, int size); |
| 66 |
int recv(char* data, int size, int timeout); |
| 67 |
int size(int timeout = 0); |
| 68 |
void clear(void); |
| 69 |
void skip(int total_timeout); |
| 70 |
void flush(void); |
| 71 |
|
| 72 |
TCPsocket getNetSocket(void); |
| 73 |
}; |
| 74 |
}; |
| 75 |
|
| 76 |
#endif /* !TCPIP_CTRL_H */ |
|