2000-07-04 11:05:46 +00:00
|
|
|
|
#if GS_NEW_DO
|
|
|
|
|
/* Interface for GNU Objective-C version of NSConnection
|
|
|
|
|
Copyright (C) 1997,2000 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
|
|
Original by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
|
|
|
|
Version for OPENSTEP by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
|
|
|
|
Created: August 1997, updated June 2000
|
|
|
|
|
|
|
|
|
|
This file is part of the GNUstep Base Library.
|
|
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
|
|
|
License along with this library; if not, write to the Free
|
|
|
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef __NSConnection_h_GNUSTEP_BASE_INCLUDE
|
|
|
|
|
#define __NSConnection_h_GNUSTEP_BASE_INCLUDE
|
|
|
|
|
|
|
|
|
|
#include <Foundation/NSObject.h>
|
|
|
|
|
#include <Foundation/NSDictionary.h>
|
|
|
|
|
#include <Foundation/NSString.h>
|
|
|
|
|
#include <Foundation/NSTimer.h>
|
|
|
|
|
#include <Foundation/NSRunLoop.h>
|
|
|
|
|
#include <Foundation/NSMapTable.h>
|
|
|
|
|
|
|
|
|
|
@class NSDistantObject;
|
|
|
|
|
@class NSPort;
|
|
|
|
|
@class NSPortNameServer;
|
|
|
|
|
@class NSData;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Keys for the NSDictionary returned by [NSConnection -statistics]
|
|
|
|
|
*/
|
|
|
|
|
/* These in OPENSTEP 4.2 */
|
|
|
|
|
GS_EXPORT NSString *NSConnectionRepliesReceived;
|
|
|
|
|
GS_EXPORT NSString *NSConnectionRepliesSent;
|
|
|
|
|
GS_EXPORT NSString *NSConnectionRequestsReceived;
|
|
|
|
|
GS_EXPORT NSString *NSConnectionRequestsSent;
|
|
|
|
|
/* These Are GNUstep extras */
|
|
|
|
|
GS_EXPORT NSString *NSConnectionLocalCount; /* Objects sent out */
|
|
|
|
|
GS_EXPORT NSString *NSConnectionProxyCount; /* Objects received */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* NSConnection class interface.
|
|
|
|
|
*
|
|
|
|
|
* A few methods are in the specification but not yet implemented.
|
|
|
|
|
*/
|
|
|
|
|
@interface NSConnection : NSObject
|
|
|
|
|
{
|
|
|
|
|
@private
|
|
|
|
|
BOOL _isValid;
|
|
|
|
|
BOOL _independentQueueing;
|
|
|
|
|
BOOL _authenticateIn;
|
|
|
|
|
BOOL _authenticateOut;
|
|
|
|
|
BOOL _multipleThreads;
|
|
|
|
|
NSPort *_receivePort;
|
|
|
|
|
NSPort *_sendPort;
|
|
|
|
|
unsigned _requestDepth;
|
|
|
|
|
unsigned _messageCount;
|
|
|
|
|
unsigned _reqOutCount;
|
|
|
|
|
unsigned _reqInCount;
|
|
|
|
|
unsigned _repOutCount;
|
|
|
|
|
unsigned _repInCount;
|
|
|
|
|
NSMapTable *_localObjects;
|
|
|
|
|
NSMapTable *_localTargets;
|
|
|
|
|
NSMapTable *_remoteProxies;
|
|
|
|
|
NSMapTable *_replyMap;
|
|
|
|
|
NSTimeInterval _replyTimeout;
|
|
|
|
|
NSTimeInterval _requestTimeout;
|
|
|
|
|
NSMutableArray *_requestModes;
|
|
|
|
|
NSMutableArray *_runLoops;
|
|
|
|
|
NSMutableArray *_requestQueue;
|
|
|
|
|
id _delegate;
|
|
|
|
|
NSRecursiveLock *_refGate;
|
|
|
|
|
NSMutableArray *_cachedDecoders;
|
|
|
|
|
NSMutableArray *_cachedEncoders;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ (NSArray*) allConnections;
|
|
|
|
|
+ (NSConnection*) connectionWithReceivePort: (NSPort*)r
|
|
|
|
|
sendPort: (NSPort*)s;
|
|
|
|
|
+ (NSConnection*) connectionWithRegisteredName: (NSString*)n
|
|
|
|
|
host: (NSString*)h;
|
|
|
|
|
+ (NSConnection*) connectionWithRegisteredName: (NSString*)n
|
|
|
|
|
host: (NSString*)h
|
|
|
|
|
usingNameServer: (NSPortNameServer*)s;
|
|
|
|
|
+ (id) currentConversation;
|
|
|
|
|
+ (NSConnection*) defaultConnection;
|
|
|
|
|
+ (NSDistantObject*) rootProxyForConnectionWithRegisteredName: (NSString*)name
|
|
|
|
|
host: (NSString*)host;
|
|
|
|
|
+ (NSDistantObject*) rootProxyForConnectionWithRegisteredName: (NSString*)name
|
|
|
|
|
host: (NSString*)host usingNameServer: (NSPortNameServer*)s;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void) addRequestMode: (NSString*)mode;
|
|
|
|
|
- (void) addRunLoop: (NSRunLoop*)runloop;
|
|
|
|
|
- (id) delegate;
|
|
|
|
|
- (void) enableMultipleThreads;
|
|
|
|
|
- (BOOL) independentConversationQueueing;
|
|
|
|
|
- (id) initWithReceivePort: (NSPort*)r
|
|
|
|
|
sendPort: (NSPort*)s;
|
|
|
|
|
- (void) invalidate;
|
|
|
|
|
- (BOOL) isValid;
|
|
|
|
|
- (NSArray*)localObjects;
|
|
|
|
|
- (BOOL) multipleThreadsEnabled;
|
|
|
|
|
- (NSPort*) receivePort;
|
|
|
|
|
- (BOOL) registerName: (NSString*)name;
|
|
|
|
|
- (BOOL) registerName: (NSString*)name withNameServer: (NSPortNameServer*)svr;
|
|
|
|
|
- (NSArray*) remoteObjects;
|
|
|
|
|
- (void) removeRequestMode: (NSString*)mode;
|
|
|
|
|
- (void) removeRunLoop: (NSRunLoop *)runloop;
|
|
|
|
|
- (NSTimeInterval) replyTimeout;
|
|
|
|
|
- (NSArray*) requestModes;
|
|
|
|
|
- (NSTimeInterval) requestTimeout;
|
|
|
|
|
- (id) rootObject;
|
|
|
|
|
- (NSDistantObject*) rootProxy;
|
|
|
|
|
- (void) runInNewThread;
|
|
|
|
|
- (NSPort*) sendPort;
|
|
|
|
|
- (void) setDelegate: anObj;
|
|
|
|
|
- (void) setIndependentConversationQueueing: (BOOL)flag;
|
|
|
|
|
- (void) setReplyTimeout: (NSTimeInterval)seconds;
|
|
|
|
|
- (void) setRequestMode: (NSString*)mode;
|
|
|
|
|
- (void) setRequestTimeout: (NSTimeInterval)seconds;
|
|
|
|
|
- (void) setRootObject: anObj;
|
|
|
|
|
- (NSDictionary*) statistics;
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This catagory contains legacy methods from the original GNU 'Connection'
|
|
|
|
|
* class, and useful extensions to NSConnection.
|
|
|
|
|
*/
|
|
|
|
|
@interface NSConnection (GNUstepExtensions) <GCFinalization>
|
|
|
|
|
|
|
|
|
|
+ (NSConnection*) newRegisteringAtName: (NSString*)n
|
|
|
|
|
withRootObject: (id)anObject;
|
|
|
|
|
|
|
|
|
|
- (void) gcFinalize;
|
|
|
|
|
|
|
|
|
|
- (retval_t) forwardForProxy: (NSDistantObject*)object
|
|
|
|
|
selector: (SEL)sel
|
|
|
|
|
argFrame: (arglist_t)frame;
|
|
|
|
|
- (const char *) typeForSelector: (SEL)sel remoteTarget: (unsigned)target;
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
GS_EXPORT NSString *ConnectionBecameInvalidNotification;
|
|
|
|
|
|
|
|
|
|
@interface Object (NSConnectionDelegate)
|
|
|
|
|
/*
|
|
|
|
|
* This method may be used to ask a delegates permission to create
|
|
|
|
|
* a new connection from the old one.
|
|
|
|
|
* This method should be implemented in preference to the
|
|
|
|
|
* [makeNewConnection:sender:] which is obsolete.
|
|
|
|
|
*/
|
|
|
|
|
- (BOOL) connection: (NSConnection*)parent
|
|
|
|
|
shouldMakeNewConnection: (NSConnection*)newConnection;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This is the old way of doing the same thing as
|
|
|
|
|
* [connection:shouldMakeNewConnection:]
|
|
|
|
|
* It is obsolete - don't use it.
|
|
|
|
|
*/
|
|
|
|
|
- (BOOL) makeNewConnection: (NSConnection*)newConnection
|
|
|
|
|
sender: (NSConnection*)parent;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* If the delegate responds to this method, it will be used to ask the
|
|
|
|
|
* delegate's permission to establish a new connection from the old one.
|
|
|
|
|
* Often this is used so that the delegate can register for invalidation
|
|
|
|
|
* notification on new child connections.
|
|
|
|
|
* This is a GNUstep extension
|
|
|
|
|
* Normally return newConn.
|
|
|
|
|
*/
|
|
|
|
|
- (NSConnection*) connection: (NSConnection*)ancestorConn
|
|
|
|
|
didConnect: (NSConnection*)newConn;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (BOOL) authenticateComponents: (NSArray*)components
|
|
|
|
|
withData: (NSData*)authenticationData;
|
|
|
|
|
- (NSData*) authenticationDataForComponents: (NSArray*)components;
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
@interface Object (NSPortCoder)
|
|
|
|
|
- (Class) classForPortCoder;
|
|
|
|
|
/*
|
|
|
|
|
* Must return the class that will be created on the remote side
|
|
|
|
|
* of the connection. If the class to be created is not the same
|
|
|
|
|
* as that of the object returned by replacementObjectForPortCoder:
|
|
|
|
|
* then the class must be capable of recognising the object it
|
|
|
|
|
* actually gets in its initWithCoder: method.
|
|
|
|
|
* The default operation is to return NSDistantObject unless the
|
|
|
|
|
* object is being sent bycopy, in which case the objects actual
|
|
|
|
|
* class is returned. To force bycopy operation the object should
|
|
|
|
|
* return its own class.
|
|
|
|
|
*/
|
|
|
|
|
- (id) replacementObjectForPortCoder: (NSPortCoder*)aCoder;
|
|
|
|
|
/*
|
|
|
|
|
* This message is sent to an object about to be encoded for sending
|
|
|
|
|
* over the wire. The default action is to return an NSDistantObject
|
|
|
|
|
* which is a local proxy for the object unless the object is being
|
|
|
|
|
* sent bycopy, in which case the actual object is returned.
|
|
|
|
|
* To force bycopy, an object should return itsself.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
#define CONNECTION_DEFAULT_TIMEOUT 15.0 /* in seconds */
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* NSRunLoop mode, NSNotification name and NSException strings.
|
|
|
|
|
*/
|
|
|
|
|
GS_EXPORT NSString *NSConnectionReplyMode;
|
|
|
|
|
GS_EXPORT NSString *NSConnectionDidDieNotification;
|
|
|
|
|
GS_EXPORT NSString *NSConnectionDidInitializeNotification; /* OPENSTEP */
|
|
|
|
|
GS_EXPORT NSString *NSFailedAuthenticationException; /* MacOS-X */
|
|
|
|
|
|
|
|
|
|
#endif /* __NSConnection_h_GNUSTEP_BASE_INCLUDE */
|
|
|
|
|
#else
|
1997-09-01 21:59:51 +00:00
|
|
|
|
/* Interface for GNU Objective-C version of NSConnection
|
1997-05-03 16:31:11 +00:00
|
|
|
|
Copyright (C) 1997 Free Software Foundation, Inc.
|
|
|
|
|
|
1997-09-01 21:59:51 +00:00
|
|
|
|
Original by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
|
|
|
|
Version for OPENSTEP by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
|
|
|
|
Created: August 1997
|
1997-05-03 16:31:11 +00:00
|
|
|
|
|
|
|
|
|
This file is part of the GNUstep Base Library.
|
1997-09-01 21:59:51 +00:00
|
|
|
|
|
1997-05-03 16:31:11 +00:00
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
|
|
|
License along with this library; if not, write to the Free
|
1999-09-09 02:56:20 +00:00
|
|
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
1997-09-01 21:59:51 +00:00
|
|
|
|
*/
|
1994-11-08 16:44:01 +00:00
|
|
|
|
|
1997-05-03 20:44:08 +00:00
|
|
|
|
#ifndef __NSConnection_h_GNUSTEP_BASE_INCLUDE
|
|
|
|
|
#define __NSConnection_h_GNUSTEP_BASE_INCLUDE
|
|
|
|
|
|
1999-02-11 08:10:24 +00:00
|
|
|
|
#include <Foundation/NSObject.h>
|
|
|
|
|
#include <Foundation/NSDictionary.h>
|
1997-09-23 21:00:33 +00:00
|
|
|
|
#include <Foundation/NSString.h>
|
1997-05-03 20:44:08 +00:00
|
|
|
|
#include <Foundation/NSTimer.h>
|
1997-09-01 21:59:51 +00:00
|
|
|
|
#include <Foundation/NSRunLoop.h>
|
|
|
|
|
#include <Foundation/NSMapTable.h>
|
|
|
|
|
|
|
|
|
|
@class NSDistantObject;
|
|
|
|
|
@class NSPort;
|
1998-11-16 19:36:51 +00:00
|
|
|
|
@class NSData;
|
1997-05-03 20:44:08 +00:00
|
|
|
|
|
1997-09-01 21:59:51 +00:00
|
|
|
|
/*
|
|
|
|
|
* Keys for the NSDictionary returned by [NSConnection -statistics]
|
|
|
|
|
*/
|
|
|
|
|
/* These in OPENSTEP 4.2 */
|
2000-06-14 04:03:56 +00:00
|
|
|
|
GS_EXPORT NSString *NSConnectionRepliesReceived;
|
|
|
|
|
GS_EXPORT NSString *NSConnectionRepliesSent;
|
|
|
|
|
GS_EXPORT NSString *NSConnectionRequestsReceived;
|
|
|
|
|
GS_EXPORT NSString *NSConnectionRequestsSent;
|
1997-09-01 21:59:51 +00:00
|
|
|
|
/* These Are GNUstep extras */
|
2000-06-14 04:03:56 +00:00
|
|
|
|
GS_EXPORT NSString *NSConnectionLocalCount; /* Objects sent out */
|
|
|
|
|
GS_EXPORT NSString *NSConnectionProxyCount; /* Objects received */
|
1997-09-01 21:59:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* NSConnection class interface.
|
|
|
|
|
*
|
|
|
|
|
* A few methods are in the specification but not yet implemented.
|
|
|
|
|
*/
|
1994-11-08 16:44:01 +00:00
|
|
|
|
@interface NSConnection : NSObject
|
|
|
|
|
{
|
1997-09-01 21:59:51 +00:00
|
|
|
|
@private
|
|
|
|
|
BOOL is_valid;
|
1999-06-28 10:36:32 +00:00
|
|
|
|
BOOL independent_queueing;
|
2000-06-02 11:10:44 +00:00
|
|
|
|
unsigned request_depth;
|
1997-09-01 21:59:51 +00:00
|
|
|
|
NSPort *receive_port;
|
|
|
|
|
NSPort *send_port;
|
|
|
|
|
unsigned message_count;
|
|
|
|
|
unsigned req_out_count;
|
|
|
|
|
unsigned req_in_count;
|
|
|
|
|
unsigned rep_out_count;
|
|
|
|
|
unsigned rep_in_count;
|
1999-01-24 09:29:13 +00:00
|
|
|
|
NSMapTable *local_objects;
|
1997-09-01 21:59:51 +00:00
|
|
|
|
NSMapTable *local_targets;
|
|
|
|
|
NSMapTable *remote_proxies;
|
|
|
|
|
NSTimeInterval reply_timeout;
|
|
|
|
|
NSTimeInterval request_timeout;
|
|
|
|
|
Class receive_port_class;
|
|
|
|
|
Class send_port_class;
|
|
|
|
|
Class encoding_class;
|
|
|
|
|
id delegate;
|
|
|
|
|
NSMutableArray *request_modes;
|
1994-11-08 16:44:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-09-01 21:59:51 +00:00
|
|
|
|
+ (NSArray*) allConnections;
|
|
|
|
|
+ (NSConnection*) connectionWithRegisteredName: (NSString*)n
|
|
|
|
|
host: (NSString*)h;
|
1998-11-16 19:36:51 +00:00
|
|
|
|
+ (id)currentConversation;
|
1994-11-08 16:44:01 +00:00
|
|
|
|
+ (NSConnection*) defaultConnection;
|
1997-05-03 16:31:11 +00:00
|
|
|
|
+ (NSDistantObject*) rootProxyForConnectionWithRegisteredName: (NSString*)name
|
1997-09-01 21:59:51 +00:00
|
|
|
|
host: (NSString*)host;
|
1994-11-08 16:44:01 +00:00
|
|
|
|
|
1997-09-01 21:59:51 +00:00
|
|
|
|
- (void) addRequestMode: (NSString*)mode;
|
1998-11-16 19:36:51 +00:00
|
|
|
|
- (void) addRunLoop: (NSRunLoop *)runloop;
|
1994-11-08 16:44:01 +00:00
|
|
|
|
- (id) delegate;
|
1998-11-16 19:36:51 +00:00
|
|
|
|
- (void) enableMultipleThreads;
|
|
|
|
|
- (BOOL) multipleThreadsEnabled;
|
1999-06-28 10:36:32 +00:00
|
|
|
|
- (BOOL) independentConversationQueueing;
|
1997-09-01 21:59:51 +00:00
|
|
|
|
- (void) invalidate;
|
|
|
|
|
- (BOOL) isValid;
|
2000-02-04 18:14:13 +00:00
|
|
|
|
- (BOOL) registerName: (NSString*)name;
|
1998-11-16 19:36:51 +00:00
|
|
|
|
- (NSArray *) remoteObjects;
|
1997-09-01 21:59:51 +00:00
|
|
|
|
- (void) removeRequestMode: (NSString*)mode;
|
1998-11-16 19:36:51 +00:00
|
|
|
|
- (void) removeRunLoop: (NSRunLoop *)runloop;
|
1997-09-01 21:59:51 +00:00
|
|
|
|
- (NSTimeInterval) replyTimeout;
|
|
|
|
|
- (NSArray*) requestModes;
|
|
|
|
|
- (NSTimeInterval) requestTimeout;
|
1994-11-08 16:44:01 +00:00
|
|
|
|
- (id) rootObject;
|
|
|
|
|
- (NSDistantObject*) rootProxy;
|
1997-09-01 21:59:51 +00:00
|
|
|
|
- (void) setDelegate: anObj;
|
1999-06-28 10:36:32 +00:00
|
|
|
|
- (void) setIndependentConversationQueueing: (BOOL)flag;
|
1997-09-01 21:59:51 +00:00
|
|
|
|
- (void) setReplyTimeout: (NSTimeInterval)seconds;
|
1994-11-08 16:44:01 +00:00
|
|
|
|
- (void) setRequestMode: (NSString*)mode;
|
1997-09-01 21:59:51 +00:00
|
|
|
|
- (void) setRequestTimeout: (NSTimeInterval)seconds;
|
|
|
|
|
- (void) setRootObject: anObj;
|
|
|
|
|
- (NSDictionary*) statistics;
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This catagory contains methods which were not in the original
|
|
|
|
|
* OpenStep specification, but which are in OPENSTEP.
|
|
|
|
|
* Some methods are not yet implemented.
|
|
|
|
|
*/
|
|
|
|
|
@interface NSConnection (OPENSTEP)
|
|
|
|
|
+ (NSConnection*) connectionWithReceivePort: (NSPort*)r
|
|
|
|
|
sendPort: (NSPort*)s;
|
|
|
|
|
- initWithReceivePort: (NSPort*)r
|
|
|
|
|
sendPort: (NSPort*)s;
|
|
|
|
|
- (NSPort*) receivePort;
|
|
|
|
|
- (void) runInNewThread;
|
|
|
|
|
- (NSPort*) sendPort;
|
|
|
|
|
@end
|
1994-11-08 16:44:01 +00:00
|
|
|
|
|
1997-09-01 21:59:51 +00:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This catagory contains legacy methods from the original GNU 'Connection'
|
|
|
|
|
* class, and useful extensions to NSConnection.
|
|
|
|
|
*/
|
1999-02-11 08:10:24 +00:00
|
|
|
|
@interface NSConnection (GNUstepExtensions) <GCFinalization>
|
|
|
|
|
|
|
|
|
|
- (void) gcFinalize;
|
1994-11-08 16:44:01 +00:00
|
|
|
|
|
1997-09-01 21:59:51 +00:00
|
|
|
|
/* Setting and getting class configuration */
|
|
|
|
|
+ (Class) defaultReceivePortClass;
|
|
|
|
|
+ (void) setDefaultReceivePortClass: (Class) aPortClass;
|
|
|
|
|
+ (Class) defaultSendPortClass;
|
|
|
|
|
+ (void) setDefaultSendPortClass: (Class) aPortClass;
|
|
|
|
|
+ (Class) defaultProxyClass;
|
|
|
|
|
+ (void) setDefaultProxyClass: (Class) aClass;
|
|
|
|
|
+ (int) defaultOutTimeout;
|
|
|
|
|
+ (void) setDefaultOutTimeout: (int)to;
|
|
|
|
|
+ (int) defaultInTimeout;
|
|
|
|
|
+ (void) setDefaultInTimeout: (int)to;
|
|
|
|
|
|
|
|
|
|
/* Querying the state of all the connections */
|
|
|
|
|
+ (int) messagesReceived;
|
|
|
|
|
+ (unsigned) connectionsCount;
|
|
|
|
|
+ (unsigned) connectionsCountWithInPort: (NSPort*)aPort;
|
|
|
|
|
|
|
|
|
|
/* Registering your server object on the network.
|
|
|
|
|
These methods create a new connection object that must be "run" in order
|
|
|
|
|
to start handling requests from clients.
|
|
|
|
|
These method names may change when we get the capability to register
|
|
|
|
|
ports with names after the ports have been created. */
|
|
|
|
|
/* I want the second method name to clearly indicate that we're not
|
|
|
|
|
connecting to a pre-existing registration name, we're registering a
|
|
|
|
|
new name, and this method will fail if that name has already been
|
|
|
|
|
registered. This is why I don't like "newWithRegisteredName:" ---
|
|
|
|
|
it's unclear if we're connecting to another NSConnection that already
|
|
|
|
|
registered with that name. */
|
|
|
|
|
+ (NSConnection*) newWithRootObject: anObj;
|
1998-12-16 20:32:59 +00:00
|
|
|
|
+ (NSConnection*) newRegisteringAtName: (NSString*)n
|
|
|
|
|
withRootObject: anObj;
|
|
|
|
|
+ (NSConnection*) newRegisteringAtName: (NSString*)n
|
|
|
|
|
atPort: (int)portn
|
|
|
|
|
withRootObject: anObj;
|
1997-09-01 21:59:51 +00:00
|
|
|
|
|
2000-06-28 10:25:19 +00:00
|
|
|
|
+ (NSConnection*) connectionByOutPort: (NSPort*)aPort;
|
1997-09-01 21:59:51 +00:00
|
|
|
|
/* Get a proxy to a remote server object.
|
|
|
|
|
A new connection is created if necessary. */
|
|
|
|
|
+ (NSDistantObject*) rootProxyAtName: (NSString*)name onHost: (NSString*)host;
|
|
|
|
|
+ (NSDistantObject*) rootProxyAtName: (NSString*)name;
|
|
|
|
|
+ (NSDistantObject*) rootProxyAtPort: (NSPort*)anOutPort;
|
|
|
|
|
+ (NSDistantObject*) rootProxyAtPort: (NSPort*)anOutPort withInPort: (NSPort*)anInPort;
|
|
|
|
|
|
|
|
|
|
/* This is the designated initializer for the NSConnection class.
|
|
|
|
|
You don't need to call it yourself. */
|
|
|
|
|
+ (NSConnection*) newForInPort: (NSPort*)anInPort outPort: (NSPort*)anOutPort
|
|
|
|
|
ancestorConnection: (NSConnection*)ancestor;
|
|
|
|
|
|
|
|
|
|
/* Make a connection object start listening for incoming requests. After
|
|
|
|
|
after DATE. */
|
|
|
|
|
- (void) runConnectionUntilDate: date;
|
|
|
|
|
|
|
|
|
|
/* Same as above, but never time out. */
|
|
|
|
|
- (void) runConnection;
|
|
|
|
|
|
|
|
|
|
/* When you get an invalidation notification from a connection, use
|
|
|
|
|
this method in order to find out if any of the proxy objects you're
|
|
|
|
|
using are going away. */
|
2000-06-16 11:06:06 +00:00
|
|
|
|
- (id) proxies;
|
1994-11-08 16:44:01 +00:00
|
|
|
|
|
1997-09-01 21:59:51 +00:00
|
|
|
|
|
|
|
|
|
/* For getting the root object of a connection or port */
|
|
|
|
|
+ rootObjectForInPort: (NSPort*)aPort;
|
|
|
|
|
|
|
|
|
|
/* Used for setting the root object of a connection that we
|
|
|
|
|
created without one, or changing the root object of a connection
|
|
|
|
|
that already has one. */
|
|
|
|
|
+ (void) setRootObject: anObj forInPort: (NSPort*)aPort;
|
|
|
|
|
|
|
|
|
|
/* Querying and setting some instance variables */
|
|
|
|
|
- (Class) receivePortClass;
|
|
|
|
|
- (Class) sendPortClass;
|
|
|
|
|
- (void) setReceivePortClass: (Class)aPortClass;
|
|
|
|
|
- (void) setSendPortClass: (Class)aPortClass;
|
|
|
|
|
- (Class) proxyClass;
|
|
|
|
|
- (Class) encodingClass;
|
|
|
|
|
- (Class) decodingClass;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Only subclassers and power-users need worry about these */
|
|
|
|
|
- (void) addProxy: (NSDistantObject*)aProxy;
|
1999-01-24 09:29:13 +00:00
|
|
|
|
- (id) includesProxyForTarget: (gsu32)target;
|
1997-09-01 21:59:51 +00:00
|
|
|
|
- (void) removeProxy: (NSDistantObject*)aProxy;
|
1998-11-16 19:36:51 +00:00
|
|
|
|
|
|
|
|
|
// It seems to be a non pure-OPENSTEP definition...
|
|
|
|
|
//
|
|
|
|
|
// new def :
|
2000-06-16 11:06:06 +00:00
|
|
|
|
- (NSArray*)localObjects;
|
1997-09-01 21:59:51 +00:00
|
|
|
|
- (void) addLocalObject: anObj;
|
1998-06-26 20:39:50 +00:00
|
|
|
|
- (id) includesLocalObject: anObj;
|
1997-09-01 21:59:51 +00:00
|
|
|
|
- (void) removeLocalObject: anObj;
|
|
|
|
|
- (retval_t) forwardForProxy: (NSDistantObject*)object
|
|
|
|
|
selector: (SEL)sel
|
|
|
|
|
argFrame: (arglist_t)frame;
|
|
|
|
|
- (const char *) typeForSelector: (SEL)sel remoteTarget: (unsigned)target;
|
1994-11-08 16:44:01 +00:00
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
2000-06-14 04:03:56 +00:00
|
|
|
|
GS_EXPORT NSString *ConnectionBecameInvalidNotification;
|
1997-09-01 21:59:51 +00:00
|
|
|
|
|
|
|
|
|
@interface Object (NSConnectionDelegate)
|
|
|
|
|
- (BOOL) connection: (NSConnection*)parent
|
|
|
|
|
shouldMakeNewConnection: (NSConnection*)newConnection;
|
|
|
|
|
/*
|
|
|
|
|
* This method may be used to ask a delegates permission to create
|
|
|
|
|
* a new connection from the old one.
|
|
|
|
|
* This method should be implemented in preference to the
|
|
|
|
|
* [makeNewConnection:sender:] which is obsolete.
|
|
|
|
|
*/
|
|
|
|
|
- (BOOL) makeNewConnection: (NSConnection*)newConnection
|
|
|
|
|
sender: (NSConnection*)parent;
|
|
|
|
|
/*
|
|
|
|
|
* This is the old way of doing the same thing as
|
|
|
|
|
* [connection:shouldMakeNewConnection:]
|
|
|
|
|
* It is obsolete - don't use it.
|
|
|
|
|
*/
|
|
|
|
|
- (NSConnection*) connection: ancestorConn didConnect: newConn;
|
|
|
|
|
/*
|
|
|
|
|
* If the delegate responds to this method, it will be used to ask the
|
|
|
|
|
* delegate's permission to establish a new connection from the old one.
|
|
|
|
|
* Often this is used so that the delegate can register for invalidation
|
|
|
|
|
* notification on new child connections.
|
|
|
|
|
* This is a GNUstep extension
|
|
|
|
|
* Normally return newConn.
|
|
|
|
|
*/
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
@interface Object (NSPortCoder)
|
1997-09-29 14:39:53 +00:00
|
|
|
|
- (Class) classForPortCoder;
|
1997-09-01 21:59:51 +00:00
|
|
|
|
/*
|
|
|
|
|
* Must return the class that will be created on the remote side
|
|
|
|
|
* of the connection. If the class to be created is not the same
|
|
|
|
|
* as that of the object returned by replacementObjectForPortCoder:
|
|
|
|
|
* then the class must be capable of recognising the object it
|
|
|
|
|
* actually gets in its initWithCoder: method.
|
|
|
|
|
* The default operation is to return NSDistantObject unless the
|
|
|
|
|
* object is being sent bycopy, in which case the objects actual
|
|
|
|
|
* class is returned. To force bycopy operation the object should
|
|
|
|
|
* return its own class.
|
|
|
|
|
*/
|
|
|
|
|
- (id) replacementObjectForPortCoder: (NSPortCoder*)aCoder;
|
|
|
|
|
/*
|
|
|
|
|
* This message is sent to an object about to be encoded for sending
|
|
|
|
|
* over the wire. The default action is to return an NSDistantObject
|
|
|
|
|
* which is a local proxy for the object unless the object is being
|
|
|
|
|
* sent bycopy, in which case the actual object is returned.
|
|
|
|
|
* To force bycopy, an object should return itsself.
|
|
|
|
|
*/
|
1998-11-16 19:36:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (BOOL)authenticateComponents: (NSArray *)components
|
|
|
|
|
withData: (NSData *)authenticationData;
|
|
|
|
|
- (NSData *)authenticationDataForComponents: (NSArray *)components;
|
|
|
|
|
|
1994-11-08 16:44:01 +00:00
|
|
|
|
@end
|
|
|
|
|
|
1997-09-01 21:59:51 +00:00
|
|
|
|
#define CONNECTION_DEFAULT_TIMEOUT 15.0 /* in seconds */
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* NSRunLoop mode, NSNotification name and NSException strings.
|
|
|
|
|
*/
|
2000-06-14 04:03:56 +00:00
|
|
|
|
GS_EXPORT NSString *NSConnectionReplyMode;
|
|
|
|
|
GS_EXPORT NSString *NSConnectionDidDieNotification;
|
|
|
|
|
GS_EXPORT NSString *NSConnectionDidInitializeNotification; /* OPENSTEP */
|
1997-09-01 21:59:51 +00:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* For compatibility with old GNU DO code -
|
|
|
|
|
*/
|
|
|
|
|
#define RunLoopConnectionReplyMode NSConnectionReplyMode
|
|
|
|
|
#define ConnectionBecameInvalidNotification NSConnectionDidDieNotification
|
|
|
|
|
#define ConnectionWasCreatedNotification NSConnectionDidInitializeNotification
|
1997-05-03 20:44:08 +00:00
|
|
|
|
|
|
|
|
|
#endif /* __NSConnection_h_GNUSTEP_BASE_INCLUDE */
|
2000-07-04 11:05:46 +00:00
|
|
|
|
#endif
|