Class

NSProtocolChecker

An object that restricts the messages that can be sent to another object (referred to as the checker’s delegate).

Declaration

@interface NSProtocolChecker : NSProxy

Overview

A NSProtocolChecker object can be particularly useful when an object with many methods, only a few of which ought to be remotely accessible, is made available using the distributed objects system.

A protocol checker acts as a kind of proxy; when it receives a message that is in its designated protocol, it forwards the message to its target and consequently appears to be the target object itself. However, when it receives a message not in its protocol, it raises an NSInvalidArgumentException to indicate that the message isn’t allowed, whether or not the target object implements the method.

Typically, an object that is to be distributed (yet must restrict messages) creates an NSProtocolChecker for itself and returns the checker rather than returning itself in response to any messages. The object might also register the checker as the root object of an NSConnection.

The object should be careful about vending references to self—the protocol checker will convert a return value of self to indicate the checker rather than the object for any messages forwarded by the checker, but direct references to the object (bypassing the checker) could be passed around by other objects.

Topics

Creating a checker

+ protocolCheckerWithTarget:protocol:

Allocates and initializes an NSProtocolChecker instance that will forward any messages in aProtocol to anObject, the protocol checker’s target.

- initWithTarget:protocol:

Initializes a newly allocated NSProtocolChecker instance that will forward any messages in aProtocol to anObject, the protocol checker’s target.

Getting information

protocol

Returns the protocol object the receiver uses.

target

Returns the target of the receiver.

Relationships

Inherits From

See Also

Legacy

NSMachPortDelegate

An interface for handling incoming Mach messages.

NSConnectionDelegate

An interface for interacting with low-level, interprocess connections.

Deprecated
NSConnection

An object that manages the communication between objects in different threads or between a thread and a process running on a local or remote system.

Deprecated
NSDistantObject

A proxy for objects in other applications or threads.

Deprecated
NSDistantObjectRequest

An object used by the distributed objects system to help handle invocations between different processes.

Deprecated
NSMachBootstrapServer

A port name server that takes and returns Mach port objects.

Deprecated
NSMachPort

A port that can be used as an endpoint for distributed object connections (or raw messaging).

NSMessagePort

A port that can be used as an endpoint for distributed object connections (or raw messaging).

NSMessagePortNameServer

A server takes and returns message ports.

Deprecated
NSPortCoder

A coder used to transmit object proxies (and sometimes objects themselves) between connections.

Deprecated
NSPortDelegate

An interface for handling incoming messages.

NSPortMessage

A low-level, operating system-independent type for inter-application (and inter-thread) messages.

NSPortNameServer

An object-oriented interface to the port registration service used by the distributed objects system.

Deprecated
NSSocketPortNameServer

A port name server that takes and returns socket ports.

Deprecated