home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / OpenStepConversion / IntermediateFrameworks3 / Foundation.framework / Headers / NSPort.h < prev    next >
Text File  |  1996-01-22  |  2KB  |  68 lines

  1. /*      NSPort.h
  2.     An idealized many-to-one IPC interface
  3.     Copyright 1994, NeXT Computer, Inc.
  4.     All rights reserved.
  5. */
  6.  
  7. #if !defined(STRICT_OPENSTEP)
  8.  
  9. #import <Foundation/NSObject.h>
  10.  
  11. /***************    Port Class        ***************/
  12.  
  13. extern NSString *NSPortDidBecomeInvalidNotification;
  14.  
  15. @interface NSPort : NSObject <NSCopying, NSCoding> {
  16.     // Ports encode themselves for NSPortCoder, but not for generic NSCoders
  17.     // For NSPortCoder, send rights for the ports are distributed
  18. @private
  19.     unsigned    isValid:1;
  20.     unsigned    isDying:1;
  21.     unsigned    filler:6;        
  22.     unsigned    refCount:24;
  23.     int        machPort;
  24.     id        delegate;
  25.     void    *reserved;
  26. }
  27.  
  28. + (NSPort *)port;
  29.     // allocate and autorelease a new port
  30.  
  31. + (NSPort *)portWithMachPort:(int)machPort;
  32.     // Argument should be a port_t (we don't type with port_t to avoid importing Mach header files)
  33.     // autoreleased; non portable
  34.  
  35. - (id)initWithMachPort:(int)machPort;
  36.     // Argument should be a port_t
  37.     // may substitute an already allocated and initialized instance
  38.  
  39. - (void)invalidate;
  40.  
  41. - (int)machPort;
  42.     /* Access to machPort should be avoided when possible to ensure portability */
  43.     // returned value is a port_t
  44.  
  45. - (id)setDelegate:(id)anId;
  46.     /* A port delegate will be offered a couple opportunities to handle messages by means of handleMachMessage: or handlePortMessage: (see NSPortMessage API) */
  47.  
  48. - delegate;
  49.  
  50. - (BOOL)isValid;
  51.     /* returns NO if port is known to be invalid, YES if port may be valid */
  52.     /* the first time that a port discovers that it is invalid it posts
  53.        the event {name = NSPortDidBecomeInvalidNotification; sender = port} */
  54.  
  55. @end
  56.  
  57.  
  58. /* A port delegate will be offered a couple opportunities to handle messages.  Implement one only: */
  59.  
  60. @class NSPortMessage;
  61.  
  62. @interface NSObject (NSPortMessageDelegateMethods)
  63. - (void)handleMachMessage:(void *)msg;
  64. - (void)handlePortMessage:(NSPortMessage *)message;
  65. @end
  66.  
  67. #endif /* !STRICT_OPENSTEP */
  68.