replace mode with flags (only a PROXY flag so far)
diff --git a/README b/README
index 69a35ec..bcf98fe 100644
--- a/README
+++ b/README
@@ -58,7 +58,7 @@
    API calls.
 
  void libtelnet_init(libtelnet_t *telnet, libtelnet_event_handler_t handler,
-     libtelnet_mode_t mode, void *user_data);
+     unsigned char flags, void *user_data);
    The libtelnet_init() function is responsible for initializing
    the data in a libtelnet_t structure.  It must be called
    immediately after establishing a connection and before any other
@@ -73,13 +73,10 @@
    information about the connection, including a socket descriptor
    for implementing LIBTELNET_EV_SEND event handling.
 
-   The mode parameter must be one of LIBTELNET_MODE_SERVER,
-   LIBTELNET_MODE_CLIENT, or LIBTELNET_MODE_PROXY.  These slightly
-   alter the behavior of libtelnet in certain instances.  If you are
-   implementing a TELNET server, use the SERVER mode.  If you are
-   implementing a client, use the CLIENT mode.  The PROXY mode
-   enables special behavior for telnet-proxy (or similar
-   applications).
+   The flags parameter can be any of the following flag constants
+   bit-or'd together, or 0 to leave all options disabled.
+
+    LIBTELNET_FLAG_PROXY   - operate in proxy mode
  
  boid libtelnet_free(libtelnet_t *telnet);
    Releases any internal memory allocated by libtelnet.  This must
diff --git a/libtelnet.c b/libtelnet.c
index eb04e0a..1f9e606 100644
--- a/libtelnet.c
+++ b/libtelnet.c
@@ -103,11 +103,11 @@
 
 /* initialize a telnet state tracker */
 void libtelnet_init(libtelnet_t *telnet, libtelnet_event_handler_t eh,
-		libtelnet_mode_t mode, void *user_data) {
+		unsigned char flags, void *user_data) {
 	memset(telnet, 0, sizeof(libtelnet_t));
 	telnet->ud = user_data;
 	telnet->eh = eh;
-	telnet->mode = mode;
+	telnet->flags = flags;
 }
 
 /* free up any memory allocated by a state tracker */
@@ -288,8 +288,7 @@
 				 */
 				if (telnet->sb_telopt == LIBTELNET_TELOPT_COMPRESS2 &&
 						telnet->z_inflate == 0 &&
-						(telnet->mode == LIBTELNET_MODE_CLIENT ||
-						 telnet->mode == LIBTELNET_MODE_PROXY)) {
+						telnet->flags & LIBTELNET_FLAG_PROXY) {
 
 					if ((telnet->z_inflate = _init_zlib(telnet, 0, 1)) == 0)
 						break;
@@ -476,7 +475,7 @@
 	/* if we're a proxy and we just sent the COMPRESS2 marker, we must
 	 * make sure all further data is compressed if not already.
 	 */
-	if (telnet->mode == LIBTELNET_MODE_PROXY &&
+	if (telnet->flags & LIBTELNET_FLAG_PROXY &&
 			telnet->z_deflate == 0 &&
 			opt == LIBTELNET_TELOPT_COMPRESS2) {
 
@@ -499,13 +498,6 @@
 				"compression already enabled");
 		return;
 	}
-	
-	/* only supported by servers */
-	if (telnet->mode != LIBTELNET_MODE_SERVER) {
-		_error(telnet, __LINE__, __func__, LIBTELNET_EBADVAL, 0,
-				"only supported in SERVER mode");
-		return;
-	}
 
 	/* attempt to create output stream first, bail if we can't */
 	if ((zlib = _init_zlib(telnet, 1, 0)) == 0)
diff --git a/libtelnet.h b/libtelnet.h
index f9950ee..6a698c6 100644
--- a/libtelnet.h
+++ b/libtelnet.h
@@ -89,12 +89,8 @@
 #define LIBTELNET_TELOPT_ZMP 93
 #define LIBTELNET_TELOPT_EXOPL 255
 
-/* libtelnet modes */
-enum libtelnet_mode_t {
-	LIBTELNET_MODE_SERVER = 0,
-	LIBTELNET_MODE_CLIENT,
-	LIBTELNET_MODE_PROXY
-};
+/* libtelnet feature flags */
+#define LIBTELNET_FLAG_PROXY (1<<0)
 
 /* telnet states */
 enum libtelnet_state_t {
@@ -167,15 +163,15 @@
 	unsigned int length;
 	/* current state */
 	enum libtelnet_state_t state;
-	/* processing mode */
-	enum libtelnet_mode_t mode;
+	/* option flags */
+	unsigned char flags;
 	/* current subnegotiation telopt */
 	unsigned char sb_telopt;
 };
 
 /* initialize a telnet state tracker */
 extern void libtelnet_init(libtelnet_t *telnet, libtelnet_event_handler_t eh,
-		libtelnet_mode_t mode, void *user_data);
+		unsigned char flags, void *user_data);
 
 /* free up any memory allocated by a state tracker */
 extern void libtelnet_free(libtelnet_t *telnet);
diff --git a/telnet-client.c b/telnet-client.c
index 2a82338..c79977b 100644
--- a/telnet-client.c
+++ b/telnet-client.c
@@ -225,7 +225,7 @@
 	do_echo = 1;
 
 	/* initialize telnet box */
-	libtelnet_init(&telnet, _event_handler, LIBTELNET_MODE_CLIENT, &sock);
+	libtelnet_init(&telnet, _event_handler, 0, &sock);
 
 	/* initialize poll descriptors */
 	memset(pfd, 0, sizeof(pfd));
diff --git a/telnet-proxy.c b/telnet-proxy.c
index 7f7d9dd..078806d 100644
--- a/telnet-proxy.c
+++ b/telnet-proxy.c
@@ -336,9 +336,9 @@
 		client.remote = &server;
 
 		/* initialize telnet boxes */
-		libtelnet_init(&server.telnet, _event_handler, LIBTELNET_MODE_PROXY,
+		libtelnet_init(&server.telnet, _event_handler, LIBTELNET_FLAG_PROXY,
 				&server);
-		libtelnet_init(&client.telnet, _event_handler, LIBTELNET_MODE_PROXY,
+		libtelnet_init(&client.telnet, _event_handler, LIBTELNET_FLAG_PROXY,
 				&client);
 
 		/* initialize poll descriptors */