Action of the stub compiler
Next: Bindings and Interfaces
Up: MSRPC2 User Manual
Previous: MIDDL to C
The MSRPC2 stub compiler is constructed around the middlc1 front
end for MIDDL, and a set of Python modules to implement the back end.
It takes as input a MIDDL file, and outputs a grand total of 8 files.
An input file called Aubergine.idl would result in the following
being generated, described below:
- Aubergine.sif, the MIDDL signature file.
- t_Aubergine.h, the MSRPC2 type definitions.
- m_Aubergine.h, the MSDR marshalling code header file
- m_Aubergine.c, the MSDR marshalling code.
- s_Aubergine.h, the MSRPC2 server function prototypes.
- s_Aubergine.c, the MSRPC2 server stub code.
- c_Aubergine.h, the MSRPC2 client function prototypes.
- c_Aubergine.c, the MSRPC2 client stub code.
All C header files generated by the stub compiler are protected from
multiple inclusion by C preprocessor macros.
The .sif file is generated by the front end of the MIDDL
compiler, and is used for keeping track of interface subtyping and
type imports. It does not form part of any MSRPC2 code.
The type definition file contains the following:
- Include directives for the type header files for all interface types
that this one is compatible with or NEEDS.
- A definition of the type of references to instances of this
interface type. All interface references are currently defined as MSRPCInterfaceRefs. Given the state of C's type system, this probably
doesn't matter.
- Definitions of C types for all the constructed types defined in
the interface type. Note that imported types are catered for by the include
directives.
- Definitions of C types for all the operations and exceptions
exported by the interface type. These are defined as pointers to
prototyped functions.
- The definition of the binding structure for the interface type.
- The definition of the interface structure for this interface type.
- Definitions of the user state constructor and destructor
functions for interfaces of this type.
The marshalling code header file contains the following:
- An include directive for the corresponding type definition file.
- Include directives for the marshalling header files for all
interface types that this one is compatible with or NEEDS.
- For each MIDDL constructed type (including the type-specific
interface reference), either a set of macros or a set of function
prototypes to:
- Marshal an instance of the data type
- Unmarshal an instance of the data type
- Free any memory allocated during the unmarshalling of an
instance of the data type.
For details of when macros are used instead of real function, see the
chapter on MSDR in this manual. Basically they are used wherever the
obvious optimisation can be made.
The marshalling code source file contains the following:
- An include directive for the MSRPC2 system header file.
- An include directive for the MSDR code header file corresponding
to this source file.
- For each MIDDL constructed type (including the type-specific
interface reference) which is not marshalling by means of a set of
macros in the header file, C source for the MSDR functions to:
- Marshal an instance of the data type
- Unmarshal an instance of the data type
- Free any memory allocated during the unmarshalling of an
instance of the data type.
The server header file contains the following:
- The declaration of the function to create an interface of this type.
- The declaration of the function to destroy an interface of this type.
The server stub file contains the following:
- An include directive for the MSRPC2 system header file.
- An include directive for the MSDR code header file corresponding
to this interface. Note that this includes the type definitions.
- An include directive for the corresponding server header file.
- The function to create an interface of this type.
- The function to destroy an interface of this type.
- The internal binding control method function.
- The internal routine to create a binding to an interface of this
type.
- The internal binding destroy method function.
- Server stub functions for all exceptions raised by interfaces of
this type.
- Server stub functions for all interrogations and/or
announcements exported by interfaces of this type.
- The internal server dispatcher function
The server header file contains the following:
- The declaration of the function to bind to an interface of this type.
The client stub file contains the following:
- An include directive for the MSRPC2 system header file.
- An include directive for the MSDR code header file corresponding
to this interface. Note that this includes the type definitions.
- An include directive for the corresponding client header file.
- Client stub functions for all exceptions raised by interfaces of
this type, for each exception there are two functions, a single domain
version and a generic version.
- The internal client exception dispatcher function
- An array of exception names. This is to aid the ansi-c version of
the TRY-ENDTRY block. There is a gcc specific optimisation which does
not require this.
- The function to bind to an interface of this type.
- The function to destroy a binding to an interface of this type.
- The internal binding control method function.
- The internal routine to create a binding to an interface of this
type.
- The internal binding destroy method function.
- Server stub functions for all interrogations and/or
announcements exported by interfaces of this type.
Next: Bindings and Interfaces
Up: MSRPC2 User Manual
Previous: MIDDL to C
Simon Crosby and Richard Hayton