Marshaled Interface References
The COM network protocol extends the Network Data Representation standard specified in [CAE RPC] by defining what can be thought of as a new primitive data type that can be marshaled: that of an interface reference to a COM object.6. This is the only extension to NDR made by the COM network protocol.
A marshaled interface references is described by a type known as an OBJREF, which is described in detail below. An OBJREF in actuality has several variations:
- Null.
- Standard. A standard remote reference. Known as a STDOBJREF. A STDOBJREF contains:
- An IPID, which uniquely specifies the interface and object.
- An object ID (OID), which uniquely specifies the identity of the object on which the IPID is found. OIDs are UUIDs; they are universally unique.
- An OXID, which identifies the scope where the implementation of the object is active, and can be used to reach the interface pointer.7.
- A reference count, indicating the number of references to this IPID that are conveyed by this marshaling. This count, though typically a value of one, may in fact be zero, one, or more (see the next section).
- Some flags, explained later.
- Long. A standard reference, along with a set of protocol sequences and network addresses that can be useful when marshaling a proxy to give to another computer (a.k.a. the middle-man case).
- Custom. Contains a class ID (CLSID) and class-specific information.
- The Custom format gives an object control over the representation of references to itself. For example, an immutable object might be passed by value, in which case the class-specific information would contain the object's immutable data.
- Handler. A sub-case of the custom reference in which the class-specific information is standardized.
- For example, an object wishes to be represented in client address spaces by a proxy object that caches state. In this case, the class-specific information is just a standard reference to an interface pointer that the handler (proxy object) will use to communicate with the original object.
- Long Handler: Contains the same information as the handler case as well as the object resolver address. This form is needed for the same reason the long form is needed.
Interface references are always marshaled in little-endian byte order, irrespective of the byte order prevailing in the remainder of the data being marshaled.