home *** CD-ROM | disk | FTP | other *** search
- /*
- Listener.h
- Application Kit, Release 2.0
- Copyright (c) 1988, NeXT, Inc. All rights reserved.
- */
-
- #import <objc/Object.h>
- #import <mach/port.h>
- #import <mach/message.h>
- #import "Pasteboard.h"
-
- /*
- * Functions to enable/disable Services Menu items. These should usually
- * only be called by service PROVIDERS (since they are the only ones who
- * know the name of the services, requestors don't). The itemName in the
- * two functions below is the language-independent "Menu Item:" entry in
- * the __services section (which all provided services must have). The
- * set function returns whether it was successful.
- * NXUpdateDynamicServices() causes the services information for the
- * system to be updated. This will only be necessary if your program
- * adds dynamic services to the system (i.e. services not found in macho
- * segments oUE#ecutables).
- */
-
- extern BOOL NXIsServicesMenuItemEnabled(const char *itemName);
- extern int NXSetServicesMenuItemEnabled(const char *itemName, BOOL enabled);
- extern void NXUpdateDynamicServices(void);
- extern BOOL NXPerformService(const char *itemName, Pasteboard *pboard);
-
- /*
- * Names of workspace ports for requests and for acknowledging machlaunch
- * from the Workspace Manager.
- */
-
- extern const char *NXWorkspaceName;
- extern const char *const NXWorkspaceReplyName;
- #define NX_WORKSPACEREQUEST NXWorkspaceName
- #define NX_WORKSPACEREPLY NXWorkspaceReplyName
-
- /* reserved message numbers */
-
- #define NX_SELECTORPMSG 35555
- #define NX_SELECTORFMSG 35556
- #define NX_RESPONSEMSG 35557
- #define NX_ACKNOWLEDGE 35558
-
- /* rpc return result error returns */
-
- #define NX_INCORRECTMESSAGE -20000
-
- /* maximum number of remote method parameters allowed */
-
- #define NX_MAXMSGPARAMS 20
-
- /* default timeouts in milliseconds */
-
- #define NX_SENDTIMEOUT 10000
- #define NX_RCVTIMEOUT 10000
-
- #define NX_MAXMESSAGE (2048-sizeof(msg_header_t)-\
- sizeof(msg_type_t)-sizeof(int)-\
- sizeof(msg_type_t)-8)
-
- typedef struct _NXMessage { /* a message via mach */
- msg_header_t header; /* every message has one of these */
- msg_type_t sequenceType; /* sequence number type */
- int sequence; /* sequence number */
- msg_type_t actionType; /* selector string */
- char action[NX_MAXMESSAGE];
- } NXMessage;
-
- typedef struct _NXResponse { /* a message via mach */
- msg_header_t header; /* every message has one of these */
- msg_type_t sequenceType; /* sequence number type */
- int sequence; /* sequence number */
- } NXResponse;
-
- typedef struct _NXAcknowledge { /* a message via mach */
- msg_header_t header; /* every message has one of these */
- msg_type_t sequenceType; /* sequence number type */
- int sequence; /* sequence number */
- msg_type_t errorType; /* error number type */
- int error; /* error number, 0 is ok */
- } NXAcknowledge;
-
- typedef struct _NXRemoteMethod {/* defines method understood by Listener */
- SEL key; /* obj-c selector */
- char *types; /* defines types of parameters */
- } NXRemoteMethod;
-
- typedef union { /* used to pass parameters to method */
- int ival;
- double dval;
- port_t pval;
- struct _bval {
- char *p;
- int len;
- } bval;
- } NXParamValue;
-
- extern char *NXCopyInpuUE$a(int parameter);
- extern char *NXCopyOutputData(int parameter);
- extern port_t NXPortFromName(const char *portName, const char *hostName);
- extern port_t NXPortNameLookup(const char *portName, const char *hostName);
- extern NXRemoteMethod *NXRemoteMethodFromSel(SEL s, NXRemoteMethod *pt);
- extern id NXResponsibleDelegate(id self, SEL selector);
-
- /*
- * permissible values of posType for setPosition:posType:andSelect:
- * and postion:posType:
- */
-
- #define NX_TEXTPOSTYPE 0
- #define NX_REGEXPRPOSTYPE 1
- #define NX_LINENUMPOSTYPE 2
- #define NX_CHARNUMPOSTYPE 3
- #define NX_APPPOSTYPE 4
-
- @interface Listener : Object
- {
- char *portName;
- port_t listenPort;
- port_t signaturePort;
- id delegate;
- int timeout;
- int priority;
- id _delegate2;
- id _requestDelegate;
- int _reservedListener2;
- }
-
- + initialize;
- + run;
-
- - init;
- - free;
- - (int)timeout;
- - setTimeout:(int)ms;
- - (int)priority;
- - setPriority:(int)level;
- - (port_t)listenPort;
- - (port_t)signaturePort;
- - delegate;
- - setDelegate:anObject;
- - setServicesDelegate:anObject;
- - servicesDelegate;
- - (const char *)portName;
- - (int)checkInAs:(const char *)name;
- - (int)usePrivatePort;
- - (int)checkOut;
- - addPort;
- - removePort;
- - (NXRemoteMethod *)remoteMethodFor:(SEL)aSelector;
- - messageReceived:(NXMessage *)msg;
- - write:(NXTypedStream *)stream;
- - read:(NXTypedStream *)stream;
-
- - (int)msgQuit:(int *)flag;
- - (int)msgCalc:(int *)flag;
- - (int)msgDirectory:(char * const *)fullPath ok:(int *)flag;
- - (int)msgVersion:(char * const *)aString ok:(int *)flag;
- - (int)msgFile:(char * const *)fullPath ok:(int *)flag;
- - (int)msgPrint:(const char *)fullPath ok:(int *)flag;
- - (int)msgSelection:(char * const *)bytes length:(int *)len asType:(const char *)aType ok:(int *)flag;
- - (int)msgSetPosition:(const char *)aString posType:(int)anInt andSelect:(int)sflag ok:(int *)flag;
- - (int)msgPosition:(char * const *)aString posType:(int *)anInt ok:(int *)flag;
- - (int)msgCopyAsType:(const char *)aType ok:(int *)flag;
- - (int)msgCutAsType:(const char *)aType ok:(int *)flag;
- - (int)msgPaste:(int *)flag;
- - (int)performRemoteMethod:(NXRemoteMethod *)method paramList:(NXParamValue *)params;
-
- /*
- * The following new... methods are now obsolete. They remain iUE%is
- * interface file for backward compatibility only. Use Object's alloc method
- * and the init... methods defined in this class instead.
- */
- + new;
-
- @end
-