libt2n: (gerd) refactored connection classes
[libt2n] / src / socket_client.hxx
diff --git a/src/socket_client.hxx b/src/socket_client.hxx
new file mode 100644 (file)
index 0000000..117aa6d
--- /dev/null
@@ -0,0 +1,46 @@
+/***************************************************************************
+ *   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_CLIENT
+#define __LIBT2N_SOCKET_CLIENT
+
+#include "client.hxx"
+#include "socket_handler.hxx"
+
+namespace libt2n
+{
+
+class socket_client_connection : public client_connection, socket_handler
+{
+    private:
+        void real_write(const std::string& data)
+            { socket_handler::write(data); }
+
+    public:
+        socket_client_connection(int port, const char* ip="0.0.0.0");
+        socket_client_connection(const char* path, mode_t filemode, const char* user="", const char* group="");
+
+        void fill_buffer(long long usec_timeout=-1)
+            { socket_handler::fill_buffer(buffer,usec_timeout); }
+
+        void close();
+};
+
+}
+
+#endif