00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00023 #ifndef _UCOMMON_BUFFER_H_
00024 #define _UCOMMON_BUFFER_H_
00025
00026 #ifndef _UCOMMON_CONFIG_H_
00027 #include <ucommon/platform.h>
00028 #endif
00029
00030 #ifndef _UCOMMON_PROTOCOLS_H_
00031 #include <ucommon/protocols.h>
00032 #endif
00033
00034 #ifndef _UCOMMON_SOCKET_H_
00035 #include <ucommon/socket.h>
00036 #endif
00037
00038 #ifndef _UCOMMON_STRING_H_
00039 #include <ucommon/string.h>
00040 #endif
00041
00042 #ifndef _UCOMMON_FSYS_H_
00043 #include <ucommon/fsys.h>
00044 #endif
00045
00046 #ifndef _UCOMMON_SHELL_H_
00047 #include <ucommon/shell.h>
00048 #endif
00049
00050 NAMESPACE_UCOMMON
00051
00058 class __EXPORT TCPBuffer : public BufferProtocol, protected Socket
00059 {
00060 protected:
00061 void _buffer(size_t size);
00062
00063 virtual size_t _push(const char *address, size_t size);
00064 virtual size_t _pull(char *address, size_t size);
00065 int _err(void) const;
00066 void _clear(void);
00067 bool _blocking(void);
00068
00073 inline socket_t getsocket(void) const
00074 {return so;};
00075
00076 public:
00080 TCPBuffer();
00081
00087 TCPBuffer(const TCPServer *server, size_t size = 536);
00088
00095 TCPBuffer(const char *host, const char *service, size_t size = 536);
00096
00100 virtual ~TCPBuffer();
00101
00108 void open(const TCPServer *server, size_t size = 536);
00109
00117 void open(const char *host, const char *service, size_t size = 536);
00118
00122 void close(void);
00123
00124 protected:
00129 virtual bool _pending(void);
00130 };
00131
00135 typedef TCPBuffer tcp_t;
00136
00137 END_NAMESPACE
00138
00139 #endif