--- a/inc/ucommon/stream.h
+++ b/inc/ucommon/stream.h
@@ -25,6 +25,14 @@
 #ifndef	_UCOMMON_STREAM_H_
 #define	_UCOMMON_STREAM_H_
 
+#ifndef _UCOMMON_CONFIG_H
+#include <ucommon/platform.h>
+#endif
+
+#ifndef _UCOMMON_PROTOCOLS_H_
+#include <ucommon/protocols.h>
+#endif
+
 #ifndef	_UCOMMON_THREAD_H_
 #include <ucommon/thread.h>
 #endif
@@ -40,6 +48,48 @@
 #include <iostream>
 
 NAMESPACE_UCOMMON
+
+/**
+ * Common stream protocol for std C++ i/o classes.  This both binds the
+ * character protocol to iostream and offers a common base class for all
+ * other c++ stdlib based streaming classes.
+ * @author David Sugar <dyfet@gnutelephony.org>
+ */
+class __EXPORT StreamProtocol : protected std::streambuf, public std::iostream, public CharacterProtocol
+{
+protected:
+	size_t bufsize;
+	char *gbuf, *pbuf;
+
+	StreamProtocol();
+
+    int underflow();
+
+	int overflow(int code);
+
+	/**
+     * This streambuf method is used for doing unbuffered reads
+     * through the establish tcp socket connection when in interactive mode.
+     * Also this method will handle proper use of buffers if not in
+     * interactive mode.
+     *
+     * @return char from tcp socket connection, EOF if not connected.
+     */
+    int uflow();
+
+	void release(void);
+
+	void allocate(size_t size);
+
+public:
+	/**
+	 * Flush the stream input and output buffers, writes pending output.
+	 * @return 0 on success, or error code.
+	 */
+	int sync(void);
+};
+
+
 
 /**
  * Streamable tcp connection between client and server.  The tcp stream
@@ -49,7 +99,7 @@
  *
  * @author David Sugar <dyfet@gnutelephony.org>
  */
-class __EXPORT tcpstream : protected std::streambuf, public std::iostream, public CharacterProtocol
+class __EXPORT tcpstream : public StreamProtocol
 {
 private:
 	__LOCAL void allocate(unsigned size);
@@ -58,12 +108,6 @@
 protected:
 	socket_t so;
 	timeout_t timeout;
-	size_t bufsize;
-	char *gbuf, *pbuf;
-
-	virtual int _putch(int code);
-
-	virtual int _getch(void);
 
 	virtual ssize_t _read(char *buffer, size_t size);
 
@@ -82,26 +126,15 @@
      *
      * @return char from get buffer, EOF if not connected.
      */
-    int underflow();
-
-    /**
-     * This streambuf method is used for doing unbuffered reads
-     * through the establish tcp socket connection when in interactive mode.
-     * Also this method will handle proper use of buffers if not in
-     * interactive mode.
-     *
-     * @return char from tcp socket connection, EOF if not connected.
-     */
-    int uflow();
+    int _getch(void);
 
     /**
      * This streambuf method is used to write the output
      * buffer through the established tcp connection.
-     *
      * @param ch char to push through.
      * @return char pushed through.
      */
-    int overflow(int ch);
+    int _putch(int ch);
 
 public:
 	/**
@@ -174,12 +207,6 @@
 	 * socket but is a disconnect.
 	 */
 	void close(void);
-
-	/**
-	 * Flush the stream input and output buffers, writes pending output.
-	 * @return 0 on success, or error code.
-	 */
-	int sync(void);	
 };
 
 /**
@@ -190,7 +217,7 @@
  *
  * @author David Sugar <dyfet@gnutelephony.org>
  */
-class __EXPORT pipestream : protected std::streambuf, public std::iostream, public CharacterProtocol
+class __EXPORT pipestream : public StreamProtocol
 {
 public:
 	typedef enum {
@@ -205,12 +232,6 @@
 protected:
 	fsys_t rd, wr;
 	pid_t pid;
-	size_t bufsize;
-	char *gbuf, *pbuf;
-
-	virtual int _getch(void);
-
-	virtual int _putch(int code);
 
 	/**
 	 * Release the stream, detach/do not wait for the process.
@@ -223,17 +244,7 @@
      *
      * @return char from get buffer, EOF if not connected.
      */
-    int underflow();
-
-    /**
-     * This streambuf method is used for doing unbuffered reads
-     * through the establish tcp socket connection when in interactive mode.
-     * Also this method will handle proper use of buffers if not in
-     * interative mode.
-     *
-     * @return char from pipe connection, EOF if not connected.
-     */
-    int uflow();
+    int _getch(void);
 
     /**
      * This streambuf method is used to write the output
@@ -242,7 +253,7 @@
      * @param ch char to push through.
      * @return char pushed through.
      */
-    int overflow(int ch);
+    int _putch(int ch);
 
 public:
 	/**
@@ -297,12 +308,6 @@
 	 * Force terminate child and close.
 	 */
 	void terminate(void);
-
-	/**
-	 * Flush the stream input and output buffers, writes pending output.
-	 * @return 0 on success, or error code.
-	 */
-	int sync(void);	
 };
 
 /**
@@ -313,7 +318,7 @@
  *
  * @author David Sugar <dyfet@gnutelephony.org>
  */
-class __EXPORT filestream : protected std::streambuf, public std::iostream, public CharacterProtocol
+class __EXPORT filestream : public StreamProtocol
 {
 public:
 	typedef enum {
@@ -328,12 +333,6 @@
 protected:
 	fsys_t fd;
 	fsys::access_t ac;
-	size_t bufsize;
-	char *gbuf, *pbuf;
-
-	virtual int _getch(void);
-
-	virtual int _putch(int code);
 
     /**
      * This streambuf method is used to load the input buffer
@@ -341,17 +340,7 @@
      *
      * @return char from get buffer, EOF if not connected.
      */
-    int underflow();
-
-    /**
-     * This streambuf method is used for doing unbuffered reads
-     * through the establish tcp socket connection when in interactive mode.
-     * Also this method will handle proper use of buffers if not in
-     * interative mode.
-     *
-     * @return char from pipe connection, EOF if not connected.
-     */
-    int uflow();
+    int _getch(void);
 
     /**
      * This streambuf method is used to write the output
@@ -360,7 +349,7 @@
      * @param ch char to push through.
      * @return char pushed through.
      */
-    int overflow(int ch);
+    int _putch(int ch);
 
 public:
 	/**
@@ -421,12 +410,6 @@
 	 * Seek position.
 	 */
 	void seek(fsys::offset_t offset);
-
-	/**
-	 * Flush the stream input and output buffers, writes pending output.
-	 * @return 0 on success, or error code.
-	 */
-	int sync(void);	
 
 	/**
 	 * Get error flag from last i/o operation.