Adun  0.83
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ULServerManager.h
1 /*
2  Project: Adun
3 
4  Copyright (C) 2008 Michael Johnston & Jordi VillĂ --Freixa
5 
6  Author: Michael Johnston
7 
8  This application is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public
10  License as published by the Free Software Foundation; either
11  version 2 of the License, or (at your option) any later version.
12 
13  This application is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Library General Public License for more details.
17 
18  You should have received a copy of the GNU General Public
19  License along with this library; if not, write to the Free
20  Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
21  */
22 #ifndef _ULSERVERMANAGER_
23 #define _ULSERVERMANAGER_
24 #include <Foundation/Foundation.h>
25 #include <AdunKernel/AdunKernel.h>
26 #include "ULFramework/ULFrameworkDefinitions.h"
27 
142 @interface ULServerManager: NSObject
143 {
144  NSHost* currentHost; //The local host
145  NSString* hostsFile; //Location of the file containing the persistant hosts
146  NSMutableArray* knownHosts; //An array containing the hosts known to have servers
147  NSMutableDictionary* hostInfo; //Keys: Hostnames Objects: Dictionary detailing host and local ports
148  NSMutableArray* connectedHosts; //An array of the hosts that have been connected to
149  NSMutableArray* reconnectionTimers; //An array of NSTimers for hosts that became disconnected
150  NSMutableDictionary* connections; //Keys: Hostnames Objects: NSConnection to the host
151  NSMutableDictionary* connectionErrors; //Keys: Hostnames Objects: NSError objects describing connection errors to the host
152  NSMutableDictionary* servers;
153  NSNetServiceBrowser* serviceBrowser; //Used to automatically find AdunServer on the LAN
154 }
158 + (id) appServerManager;
171 - (id) serverOnHost: (NSHost*) host;
175 - (id) serverOnLocalhost;
181 - (BOOL) checkForServerOnHost: (NSHost*) host;
186 - (void) disconnectFromServer: (id) server;
197 - (void) disconnectFromServerOnHost: (NSHost*) host;
203 - (void) applicationWillClose;
208 - (NSDictionary*) connectionErrors;
214 - (NSError*) connectionErrorForHost: (NSHost*) host;
218 - (NSArray*) connectedHosts;
224 - (NSArray*) allServers;
228 - (NSArray*) knownHosts;
232 - (BOOL) isKnownHost: (NSHost*) host;
238 - (void) addHost: (NSHost*) host;
246 - (void) addHost: (NSHost*) host hostPort: (unsigned int) port;
254 - (void) addHost: (NSHost*) host serverName: (NSString*) name;
261 - (void) addHost: (NSHost*) host persistant: (BOOL) persistant connectNow: (BOOL) connectNow;
276 - (void) addHost: (NSHost*) host
277  hostPort: (unsigned int) hostPort
278  serverName: (NSString*) name
279  persistant: (BOOL) persistant
280  connectNow: (BOOL) connectNow;
308 - (ULRemoteMessageErrorCode) handleMessageException: (NSException*) exception fromHost: (NSHost*) host error: (NSError**) error;
309 @end
310 
311 #endif
312