+GLOBAL void
+Conf_UnsetServer( CONN_ID Idx )
+{
+ /* Set next time for next connection attempt, if this is a server
+ * link that is (still) configured here. If the server is set as
+ * "once", delete it from our configuration.
+ * Non-Server-Connections will be silently ignored. */
+
+ int i;
+ time_t t;
+
+ /* Check all our configured servers */
+ for( i = 0; i < MAX_SERVERS; i++ ) {
+ if( Conf_Server[i].conn_id != Idx ) continue;
+
+ /* Gotcha! Mark server configuration as "unused": */
+ Conf_Server[i].conn_id = NONE;
+
+ if( Conf_Server[i].flags & CONF_SFLAG_ONCE ) {
+ /* Delete configuration here */
+ Init_Server_Struct( &Conf_Server[i] );
+ } else {
+ /* Set time for next connect attempt */
+ t = time(NULL);
+ if (Conf_Server[i].lasttry < t - Conf_ConnectRetry) {
+ /* The connection has been "long", so we don't
+ * require the next attempt to be delayed. */
+ Conf_Server[i].lasttry =
+ t - Conf_ConnectRetry + RECONNECT_DELAY;
+ } else
+ Conf_Server[i].lasttry = t;
+ }
+ }
+} /* Conf_UnsetServer */
+
+
+GLOBAL void
+Conf_SetServer( int ConfServer, CONN_ID Idx )
+{
+ /* Set connection for specified configured server */
+
+ assert( ConfServer > NONE );
+ assert( Idx > NONE );
+
+ Conf_Server[ConfServer].conn_id = Idx;
+} /* Conf_SetServer */
+
+
+GLOBAL int
+Conf_GetServer( CONN_ID Idx )
+{
+ /* Get index of server in configuration structure */
+
+ int i = 0;
+
+ assert( Idx > NONE );
+
+ for( i = 0; i < MAX_SERVERS; i++ ) {
+ if( Conf_Server[i].conn_id == Idx ) return i;
+ }
+ return NONE;
+} /* Conf_GetServer */
+
+
+GLOBAL bool
+Conf_EnableServer( char *Name, UINT16 Port )
+{
+ /* Enable specified server and adjust port */
+
+ int i;
+
+ assert( Name != NULL );
+
+ for( i = 0; i < MAX_SERVERS; i++ ) {
+ if( strcasecmp( Conf_Server[i].name, Name ) == 0 ) {
+ /* Gotcha! Set port and enable server: */
+ Conf_Server[i].port = Port;
+ Conf_Server[i].flags &= ~CONF_SFLAG_DISABLED;
+ return true;
+ }
+ }
+ return false;
+} /* Conf_EnableServer */
+
+
+GLOBAL bool
+Conf_EnablePassiveServer(const char *Name)
+{
+ /* Enable specified server */
+ int i;
+
+ assert( Name != NULL );
+ for (i = 0; i < MAX_SERVERS; i++) {
+ if ((strcasecmp( Conf_Server[i].name, Name ) == 0) && (Conf_Server[i].port > 0)) {
+ /* BINGO! Enable server */
+ Conf_Server[i].flags &= ~CONF_SFLAG_DISABLED;
+ return true;
+ }
+ }
+ return false;
+} /* Conf_EnablePassiveServer */
+
+
+GLOBAL bool
+Conf_DisableServer( char *Name )
+{
+ /* Enable specified server and adjust port */
+
+ int i;
+
+ assert( Name != NULL );
+
+ for( i = 0; i < MAX_SERVERS; i++ ) {
+ if( strcasecmp( Conf_Server[i].name, Name ) == 0 ) {
+ /* Gotcha! Disable and disconnect server: */
+ Conf_Server[i].flags |= CONF_SFLAG_DISABLED;
+ if( Conf_Server[i].conn_id > NONE ) Conn_Close( Conf_Server[i].conn_id, NULL, "Server link terminated on operator request", true);
+ return true;
+ }
+ }
+ return false;
+} /* Conf_DisableServer */
+
+
+GLOBAL bool
+Conf_AddServer( char *Name, UINT16 Port, char *Host, char *MyPwd, char *PeerPwd )