transmit_as
typedef
[transmit_as(xmit-type) [ , type-attribute-list ] ]
type-specifier declarator-list;
void __RPC_USER type-id_to_xmit (
type-id __RPC_FAR *,
xmit-type __RPC_FAR *
__RPC_FAR *);
void __RPC_USER type-id_from_xmit (
xmit-type __RPC_FAR *,
type-id __RPC_FAR *);
void __RPC_USER type-id_free_inst (
type-id __RPC_FAR *);
void __RPC_USER type-id_free_xmit (
xmit-type__RPC_FAR *);
xmit-type
Specifies the
data type that is transmitted between client and server.
type-attribute-list
Specifies one
or more attributes that apply to the type. Valid type attributes include handle,
switch_type; the pointer attribute ref, unique, or ptr;
and the usage attributes string and ignore. Separate multiple
attributes with commas.
type-specifier
Specifies a base_type,
struct, union, enum type, or type identifier. An optional
storage specification can precede type-specifier.
declarator-list
Specifies
standard C declarators, such as identifiers, pointer declarators, and array
declarators. For more information, see pointers
type-id
Specifies the
name of the data type that is presented to the client and server applications.
Examples
typedef struct _TREE_NODE_TYPE {
unsigned
short data;
struct
_TREE_NODE_TYPE * left;
struct
_TREE_NODE_TYPE * right;
} TREE_NODE_TYPE;
typedef [transmit_as(TREE_XMIT_TYPE)] TREE_NODE_TYPE
* TREE_TYPE;
void __RPC_USER TREE_TYPE_to_xmit(
TREE_TYPE
__RPC_FAR * ,
TREE_XMIT_TYPE __RPC_FAR * __RPC_FAR *);
void __RPC_USER TREE_TYPE_from_xmit (
TREE_XMIT_TYPE __RPC_FAR *,
TREE_TYPE
__RPC_FAR *);
void __RPC_USER TREE_TYPE_free_inst(
TREE_TYPE
__RPC_FAR *);
void __RPC_USER TREE_TYPE_free_xmit(
TREE_XMIT_TYPE __RPC_FAR *);
Remarks
The transmit_as
attribute instructs the compiler to associate type-id, a presented type
that client and server applications manipulate, with a transmitted type xmit-type.
The user must supply routines that convert data between the presented and the
transmitted types; these routines must also free memory used to hold the
converted data. The transmit_as attribute instructs the stubs to call
the user-supplied conversion routines.
The transmitted
type xmit-type must resolve to a MIDL base type, predefined type, or a
type identifier. For more information, see base_types
The user must
supply the following routines:
Routine
name |
Description |
type-id_to_xmit |
Converts
data from the presented type to the transmitted type |
type-id_from_xmit |
Converts
data from the transmitted type to the presented type |
type-id_free_inst |
Frees
storage used by the callee for the presented type |
type-id_free_xmit |
Frees
storage used by the caller for the transmitted type |
The client
stub calls type-id_to_xmit to allocate space for the transmitted
type and to translate the data into objects of type xmit-type. The
server stub allocates space for the original data type and calls type-id_from_xmit
to translate the data from its transmitted type to the presented type.
Upon return
from the application code, the server stub calls type-id_free_inst
to deallocate the storage for type-id on the server side. The client
stub calls type-id_free_xmit to deallocate the xmit-type storage
on the client side.
The following
types cannot have a transmit_as attribute:
Context handles (types with the
context_handle type attribute and types that are used as parameters with
the context_handle attribute)
Parameters that are conformant,
varying, or open arrays
Structures that contain
conformant arrays
The predefined type handle_t,
void
When a
pointer attribute appears as one of the type attributes with the transmit_as
attribute, the pointer attribute is applied to the xmit_type parameter
of the type-id-to_xmit and type-id-from_xmit
routines.
See Also