--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2006 by Gerd v. Egidy *
+ * gve@intra2net.com *
+ * *
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef __LIBT2N_SOCKET_HANDLER
+#define __LIBT2N_SOCKET_HANDLER
+
+#include "types.hxx"
+
+namespace libt2n
+{
+
+class socket_handler
+{
+ private:
+ static const unsigned int recv_buffer_size=2048;
+ static const unsigned int write_block_size=4096;
+
+ socket_type_value socket_type;
+
+ bool data_waiting(long long usec_timeout=-1);
+
+ protected:
+ int sock;
+
+ socket_handler(int _sock, socket_type_value _socket_type)
+ { sock=_sock; socket_type=_socket_type; }
+
+ void set_socket_options(int sock);
+
+ void log(log_level_values level, const std::string& message)
+ { log(level,message.c_str()); }
+ virtual void log(log_level_values level, const char* message)
+ { return; }
+
+ public:
+ socket_type_value get_type()
+ { return socket_type; }
+
+ bool fill_buffer(std::string& buffer, long long usec_timeout);
+ bool fill_buffer(std::string& buffer);
+
+ void close();
+
+ void write(const std::string& data);
+};
+
+}
+
+#endif