about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2005-04-18 21:08:31 +0000
committerFlorian Westphal <fw@strlen.de>2005-04-18 21:08:31 +0000
commitc4bc2114c91a91ba8eac2c70914dff4ec3e2d8cf (patch)
treeb9184a7e636dbc712339351a2c399da2f38ddc80 /src
parent129a22a29bb59da08a758b6a29202cc9ef389aef (diff)
downloadngircd-c4bc2114c91a91ba8eac2c70914dff4ec3e2d8cf.tar.gz
ngircd-c4bc2114c91a91ba8eac2c70914dff4ec3e2d8cf.zip
conn.h: option filed in CONNECTION struct is now UINT16.
conn-func.h: add accessor Macros

Conn_OPTION_ADD( conn, CONN_OPTION )
Conn_OPTION_DEL( conn, CONN_OPTION )
Conn_OPTION_ISSET( conn, CONN_OPTION )

To add, remove or test for a certain option field attribute (e.g. CONN_ISCLOSING)
These Macros should be used instead of accessing conn->options directly.
Diffstat (limited to 'src')
-rw-r--r--src/ngircd/conn-func.h5
-rw-r--r--src/ngircd/conn.h13
2 files changed, 11 insertions, 7 deletions
diff --git a/src/ngircd/conn-func.h b/src/ngircd/conn-func.h
index f0ed7f38..92c65bb5 100644
--- a/src/ngircd/conn-func.h
+++ b/src/ngircd/conn-func.h
@@ -8,7 +8,7 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: conn-func.h,v 1.2 2005/03/19 18:43:48 fw Exp $
+ * $Id: conn-func.h,v 1.3 2005/04/18 21:08:31 fw Exp $
  *
  * Connection management: Global functions (header)
  */
@@ -54,6 +54,9 @@ GLOBAL int Conn_Options PARAMS(( CONN_ID Idx ));
 GLOBAL void Conn_ResetWCounter PARAMS(( void ));
 GLOBAL long Conn_WCounter PARAMS(( void ));
 
+#define Conn_OPTION_ADD( x, opt )   ( (x)->options |= opt ) 
+#define Conn_OPTION_DEL( x, opt )   ( (x)->options &= ~opt )
+#define Conn_OPTION_ISSET( x, opt ) ( (x)->options & opt )
 
 #endif
 
diff --git a/src/ngircd/conn.h b/src/ngircd/conn.h
index 5bcfb4d5..bce42371 100644
--- a/src/ngircd/conn.h
+++ b/src/ngircd/conn.h
@@ -8,7 +8,7 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: conn.h,v 1.33 2005/03/19 18:43:48 fw Exp $
+ * $Id: conn.h,v 1.34 2005/04/18 21:08:31 fw Exp $
  *
  * Connection management (header)
  */
@@ -21,10 +21,11 @@
 #include <time.h>			/* for time_t, see below */
 
 
-#define CONN_ISCLOSING 1		/* Conn_Close() already called */
+#define CONN_ISCLOSING		1U	/* Conn_Close() already called */
+#define CONN_ISCONNECTING	2U	/* connect() in progress */
 
 #ifdef ZLIB
-#define CONN_ZIP 2			/* zlib compressed link */
+#define CONN_ZIP		4U	/* zlib compressed link */
 #endif
 
 
@@ -65,10 +66,10 @@ typedef struct _Connection
 	time_t lastping;		/* Last PING */
 	time_t lastprivmsg;		/* Last PRIVMSG */
 	time_t delaytime;		/* Ignore link ("penalty") */
-	long bytes_in, bytes_out; /* Received and sent bytes */
-	long msg_in, msg_out;	  /* Received and sent IRC messages */
+	long bytes_in, bytes_out;	/* Received and sent bytes */
+	long msg_in, msg_out;		/* Received and sent IRC messages */
 	int flag;			/* Flag (see "irc-write" module) */
-	int options;			/* Link options */
+	UINT16 options;			/* Link options / connection state */
 #ifdef ZLIB
 	ZIPDATA zip;			/* Compression information */
 #endif  /* ZLIB */