home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEV / DEV.Z / NSConnection.h < prev    next >
Text File  |  1996-09-11  |  4KB  |  156 lines

  1. /*      NSConnection.h
  2.     Encapsulates the state of a DO circuit
  3.     Copyright 1994-1996, NeXT Software, Inc.  All rights reserved.
  4. */
  5.  
  6. #import <Foundation/NSObject.h>
  7. #import <Foundation/NSDate.h>
  8. #import <Foundation/NSHashTable.h>
  9. #import <Foundation/NSMapTable.h>
  10.  
  11. @class NSMutableData, NSDistantObject, NSException, NSData, NSRunLoop;
  12.  
  13. #if !defined(STRICT_OPENSTEP)
  14. @class NSPort;
  15. #endif /* !STRICT_OPENSTEP */
  16.  
  17. /*****************    NSConnection    **************************/
  18.  
  19. @interface NSConnection : NSObject {
  20.     @private
  21.     id        receivePort;
  22.     id        sendPort;
  23.     id          delegate;
  24.     unsigned    isValid:1;
  25.     unsigned    isDead:1;
  26.     unsigned    isQueueing:1;
  27.     unsigned    authGen:1;
  28.     unsigned    authCheck:1;
  29.     unsigned    encryptFlag:1;
  30.     unsigned    decryptFlag:1;
  31.     unsigned    doRequest:1;
  32.     unsigned    isMulti:1;
  33.     unsigned    filler:7;
  34.     unsigned    refCount:16;
  35.     void        *localProxies;
  36.     void        *remoteProxies;
  37.     id          runLoops;
  38.     NSTimeInterval    requestLimit;
  39.     NSTimeInterval    replyLimit;
  40.     id        requestModes;
  41.     id          rootObject;
  42.     id        registerName;
  43.     id        statistics;
  44.     NSHashTable    *classInfoExported;
  45.     NSMapTable    *classInfoImported;
  46.     NSMutableData    *releasedProxies;
  47.     void    *reserved;
  48. }
  49.  
  50. - (NSDictionary *)statistics;
  51.  
  52. + (NSArray *)allConnections;
  53.  
  54. + (NSConnection *)defaultConnection;
  55.  
  56. + (NSConnection *)connectionWithRegisteredName:(NSString *)name host:(NSString *)hostName;
  57. + (NSDistantObject *)rootProxyForConnectionWithRegisteredName:(NSString *)name host:(NSString *)hostName;
  58.  
  59. - (void)setRequestTimeout:(NSTimeInterval)ti;
  60. - (NSTimeInterval)requestTimeout;
  61. - (void)setReplyTimeout:(NSTimeInterval)ti;
  62. - (NSTimeInterval)replyTimeout;
  63.  
  64. - (void)setRootObject:(id)anObject;
  65. - (id)rootObject;
  66.  
  67. - (NSDistantObject *)rootProxy;
  68.   
  69. - (void)setDelegate:(id)anObject;
  70. - (id)delegate;
  71.  
  72. - (void)setIndependentConversationQueueing:(BOOL)yorn;
  73. - (BOOL)independentConversationQueueing;
  74.  
  75. - (BOOL)isValid;
  76.  
  77. - (void)invalidate;
  78.  
  79. - (void)addRequestMode:(NSString *)rmode;
  80. - (void)removeRequestMode:(NSString *)rmode;
  81. - (NSArray *)requestModes;
  82.  
  83. - (BOOL)registerName:(NSString *) name;
  84.  
  85. #if !defined(STRICT_OPENSTEP)
  86.  
  87. + (NSConnection *)connectionWithReceivePort:(NSPort *)receivePort sendPort:(NSPort *)sendPort;
  88.  
  89. + (id)currentConversation;
  90.  
  91. - (id)initWithReceivePort:(NSPort *)receivePort sendPort:(NSPort *)sendPort;
  92. - (NSPort *)sendPort;
  93. - (NSPort *)receivePort;
  94.  
  95. - (void)enableMultipleThreads;
  96. - (BOOL)multipleThreadsEnabled;
  97.  
  98. - (void)addRunLoop:(NSRunLoop *)runloop;
  99. - (void)removeRunLoop:(NSRunLoop *)runloop;
  100.  
  101. - (void)runInNewThread;
  102.  
  103. - (NSArray *)remoteObjects;
  104. - (NSArray *)localObjects;
  105.  
  106. #endif /* !STRICT_OPENSTEP */
  107.  
  108. @end
  109.  
  110. FOUNDATION_EXPORT NSString *NSConnectionReplyMode;
  111.  
  112. FOUNDATION_EXPORT NSString *NSConnectionDidDieNotification;
  113.  
  114.  
  115. @interface NSObject (NSConnectionDelegateMethods)
  116.  
  117. // Use the NSConnectionDidInitializeNotification notification instead
  118. // of this delegate method if possible.
  119. - (BOOL)makeNewConnection:(NSConnection *)conn sender:(NSConnection *)ancestor;
  120.  
  121. #if !defined(STRICT_OPENSTEP)
  122. // Use the NSConnectionDidInitializeNotification notification instead
  123. // of this delegate method if possible.
  124. - (BOOL)connection:(NSConnection *)ancestor shouldMakeNewConnection:(NSConnection *)conn;
  125.  
  126. - (NSData *)authenticationDataForComponents:(NSArray *)components;
  127. - (BOOL)authenticateComponents:(NSArray *)components withData:(NSData *)signature;
  128.  
  129. - (id)createConversationForConnection:(NSConnection *)conn;
  130.  
  131. FOUNDATION_EXPORT NSString *NSFailedAuthenticationException;
  132.  
  133. FOUNDATION_EXPORT NSString *NSConnectionDidInitializeNotification;
  134. #endif /* !STRICT_OPENSTEP */
  135.  
  136. @end
  137.  
  138. #if !defined(STRICT_OPENSTEP)
  139.  
  140. @interface NSDistantObjectRequest : NSObject
  141.  
  142. - (NSInvocation *)invocation;
  143. - (NSConnection *)connection;
  144. - (id)conversation;
  145. - (void)replyWithException:(NSException *)exception;
  146.  
  147. @end
  148.  
  149. @interface NSObject (NSDistantObjectRequestMethods)
  150.  
  151. - (BOOL)connection:(NSConnection *)connection handleRequest:(NSDistantObjectRequest *)doreq;
  152.  
  153. @end
  154.  
  155. #endif /* !STRICT_OPENSTEP */
  156.