+GLOBAL time_t
+Conn_LastPing( CONN_ID Idx )
+{
+ /* Zeitpunkt des letzten PING liefern */
+
+ assert( Idx > NONE );
+ return My_Connections[Idx].lastping;
+} /* Conn_LastPing */
+
+
+GLOBAL VOID
+Conn_SetPenalty( CONN_ID Idx, time_t Seconds )
+{
+ /* Penalty-Delay fuer eine Verbindung (in Sekunden) setzen;
+ * waehrend dieser Zeit wird der entsprechende Socket vom Server
+ * bei Lese-Operationen komplett ignoriert. Der Delay kann mit
+ * dieser Funktion nur erhoeht, nicht aber verringert werden. */
+
+ time_t t;
+
+ assert( Idx > NONE );
+ assert( Seconds >= 0 );
+
+ t = time( NULL ) + Seconds;
+ if( t > My_Connections[Idx].delaytime ) My_Connections[Idx].delaytime = t;
+} /* Conn_SetPenalty */
+
+
+GLOBAL VOID
+Conn_ResetPenalty( CONN_ID Idx )
+{
+ assert( Idx > NONE );
+ My_Connections[Idx].delaytime = 0;
+} /* Conn_ResetPenalty */
+
+
+GLOBAL VOID
+Conn_ClearFlags( VOID )
+{
+ /* Alle Connection auf "nicht-markiert" setzen */
+
+ LONG i;
+
+ for( i = 0; i < Pool_Size; i++ ) My_Connections[i].flag = 0;
+} /* Conn_ClearFlags */
+
+
+GLOBAL INT
+Conn_Flag( CONN_ID Idx )
+{
+ /* Ist eine Connection markiert (TRUE) oder nicht? */
+
+ assert( Idx > NONE );
+ return My_Connections[Idx].flag;
+} /* Conn_Flag */
+
+
+GLOBAL VOID
+Conn_SetFlag( CONN_ID Idx, INT Flag )
+{
+ /* Connection markieren */
+
+ assert( Idx > NONE );
+ My_Connections[Idx].flag = Flag;
+} /* Conn_SetFlag */
+
+
+GLOBAL CONN_ID
+Conn_First( VOID )
+{
+ /* Connection-Struktur der ersten Verbindung liefern;
+ * Ist keine Verbindung vorhanden, wird NONE geliefert. */
+
+ LONG i;
+
+ for( i = 0; i < Pool_Size; i++ )
+ {
+ if( My_Connections[i].sock != NONE ) return i;
+ }
+ return NONE;
+} /* Conn_First */
+
+
+GLOBAL CONN_ID
+Conn_Next( CONN_ID Idx )
+{
+ /* Naechste Verbindungs-Struktur liefern; existiert keine
+ * weitere, so wird NONE geliefert. */
+
+ LONG i = NONE;
+
+ assert( Idx > NONE );
+
+ for( i = Idx + 1; i < Pool_Size; i++ )
+ {
+ if( My_Connections[i].sock != NONE ) return i;
+ }
+ return NONE;
+} /* Conn_Next */
+
+
+GLOBAL VOID
+Conn_SetServer( CONN_ID Idx, INT ConfServer )
+{
+ /* Connection als Server markieren: Index des konfigurierten
+ * Servers speichern. Verbindung muss bereits bestehen! */
+
+ assert( Idx > NONE );
+ assert( My_Connections[Idx].sock > NONE );
+
+ My_Connections[Idx].our_server = ConfServer;
+} /* Conn_SetServer */
+
+
+GLOBAL VOID
+Conn_SetOption( CONN_ID Idx, INT Option )
+{
+ /* Option fuer Verbindung setzen.
+ * Initial sind alle Optionen _nicht_ gesetzt. */
+
+ assert( Idx > NONE );
+ assert( Option != 0 );
+
+ My_Connections[Idx].options |= Option;
+} /* Conn_SetOption */
+
+
+GLOBAL VOID
+Conn_UnsetOption( CONN_ID Idx, INT Option )
+{
+ /* Option fuer Verbindung loeschen */
+
+ assert( Idx > NONE );
+ assert( Option != 0 );
+
+ My_Connections[Idx].options &= ~Option;
+} /* Conn_UnsetOption */
+
+
+GLOBAL INT
+Conn_Options( CONN_ID Idx )
+{
+ assert( Idx > NONE );
+ return My_Connections[Idx].options;
+} /* Conn_Options */
+
+
+#ifdef USE_ZLIB
+
+GLOBAL BOOLEAN
+Conn_InitZip( CONN_ID Idx )
+{
+ /* Kompression fuer Link initialisieren */
+
+ assert( Idx > NONE );
+
+ My_Connections[Idx].zip.in.avail_in = 0;
+ My_Connections[Idx].zip.in.total_in = 0;
+ My_Connections[Idx].zip.in.total_out = 0;
+ My_Connections[Idx].zip.in.zalloc = NULL;
+ My_Connections[Idx].zip.in.zfree = NULL;
+ My_Connections[Idx].zip.in.data_type = Z_ASCII;
+
+ if( inflateInit( &My_Connections[Idx].zip.in ) != Z_OK )
+ {
+ /* Fehler! */
+ Log( LOG_ALERT, "Can't initialize compression on connection %d (zlib inflate)!", Idx );
+ return FALSE;
+ }
+
+ My_Connections[Idx].zip.out.total_in = 0;
+ My_Connections[Idx].zip.out.total_in = 0;
+ My_Connections[Idx].zip.out.zalloc = NULL;
+ My_Connections[Idx].zip.out.zfree = NULL;
+ My_Connections[Idx].zip.out.data_type = Z_ASCII;
+
+ if( deflateInit( &My_Connections[Idx].zip.out, Z_DEFAULT_COMPRESSION ) != Z_OK )
+ {
+ /* Fehler! */
+ Log( LOG_ALERT, "Can't initialize compression on connection %d (zlib deflate)!", Idx );
+ return FALSE;
+ }
+
+ My_Connections[Idx].zip.bytes_in = My_Connections[Idx].bytes_in;
+ My_Connections[Idx].zip.bytes_out = My_Connections[Idx].bytes_out;
+
+ Log( LOG_INFO, "Enabled link compression (zlib) on connection %d.", Idx );
+ Conn_SetOption( Idx, CONN_ZIP );
+
+ return TRUE;
+} /* Conn_InitZip */
+
+
+GLOBAL LONG
+Conn_SendBytesZip( CONN_ID Idx )
+{
+ /* Anzahl gesendeter Bytes (komprimiert!) liefern */
+
+ assert( Idx > NONE );
+ return My_Connections[Idx].zip.bytes_out;
+} /* Conn_SendBytesZip */
+
+
+GLOBAL LONG
+Conn_RecvBytesZip( CONN_ID Idx )
+{
+ /* Anzahl gesendeter Bytes (komprimiert!) liefern */
+
+ assert( Idx > NONE );
+ return My_Connections[Idx].zip.bytes_in;
+} /* Conn_RecvBytesZip */
+
+#endif
+
+
+GLOBAL time_t
+Conn_StartTime( CONN_ID Idx )
+{
+ /* Zeitpunkt des Link-Starts liefern (in Sekunden) */
+
+ assert( Idx > NONE );
+ return My_Connections[Idx].starttime;
+} /* Conn_Uptime */
+
+
+GLOBAL INT
+Conn_SendQ( CONN_ID Idx )
+{
+ /* Laenge der Daten im Schreibbuffer liefern */
+
+ assert( Idx > NONE );
+#ifdef USE_ZLIB
+ return My_Connections[Idx].zip.wdatalen;
+#else
+ return My_Connections[Idx].wdatalen;
+#endif
+} /* Conn_SendQ */
+
+
+GLOBAL LONG
+Conn_SendMsg( CONN_ID Idx )