Bindings and Interfaces



next up previous
Next: User Code Interface Up: MSRPC2 User Manual Previous: Action of the

Bindings and Interfaces

Interfaces

In MSRPC2 terms, an interface represents an instantiation of an interface type. The operations supported by an interface and the types of parameters they take are given in the MIDDL specification for the interface type. Once created, an interface can support many active clients, each one having made a binding to the interface.

In implementation terms, MSRPC2 provides mechanisms for creating an interface for a particular type, managing it, and eventually destroying it. An interface called Aubergine would be represented at the stub level by the following C structure:

typedef struct Aubergine_Interface {
    struct {
          ...
    } ops;
    bool_t (*bind) (  Aubergine_Interface  *self,
                      Aubergine_Binding   **b,
                      caddr_t               sess );
    svcInterface         *svcIntf;
    Aubergine_Constructor userBind;
    Aubergine_Destructor  userDestroy;
    caddr_t               userState;
}

The ops structure contains pointers to the C functions which implement the operations of the interface. It has a reference to a corresponding structure inside the runtime system, and two methods which are called to create a new binding to the interface and destroy an existing one.

The implementer of the interface is provided with a pointer to interface-specific state, which he or she can use in an arbitrary way, and two methods to create and destroy binding (client) specific state when bindings are created and destroyed.

Bindings

In MSRPC2 terms, a binding represents a logical connection between a client and a server. To the client, the binding represents an object which performs the server's operations.

In MSRPC2 bindings are inherently single threaded. If a client wishes to make multiple concurrent requests to a server, then should first obtain multiple bindings.

A binding structure contains information on all operations and and exceptions used by it. Some of this state is client specific, and some server specific, but most is shared. In the same domain case, the binding structure is shared between the client and sever which optimises RPC calls and exception returns to a single indirect procedure call.

An binding called Aubergine would be represented at the stub level by the following C structure:

struct Aubergine_Binding {
        void   (*destroy) _(( Aubergine_Binding *self ));
        bool_t (*control) _(( Aubergine_Binding *self,
                              u_int32 op, caddr_t param ));
        void (*release) _((Aubergine_Binding *self ));
        Aubergine_Interface *intf;
        msdr_mm mm;
        caddr_t session;
        caddr_t userState;
        struct {
                Aubergine_enames_t *elist;
                char **name;
                int retries;
                union {
                        struct {
                                MSRPC2Cardinal  status;
                                MSRPC2Integer   err_no;
                        } InternalError;
                       ...
                } u;
                Triv_InternalError      InternalError;
                ...
        } excs;
        struct {
          ...
        } ops;
};

control, destroy and release are server specific functions and are described in the next section. ops contains pointers to the procedures implementing the operations of the binding. The excs structure contains pointers to functions implementing each of the exception dispatchers (for the server) and a union of structures of exceptions arguments (for the client). It also contains three fields used by the TRY block.



next up previous
Next: User Code Interface Up: MSRPC2 User Manual Previous: Action of the



Simon Crosby and Richard Hayton