Module msrpce_parse_transform

A parse transform which provides attributes for compiling record and type definitions into encode/decode functions for the MS RPC DCE format.

Description

A parse transform which provides attributes for compiling record and type definitions into encode/decode functions for the MS RPC DCE format.

This parse transform defines serveral new attributes:

-rpce(msrpce_compiler:options()) Sets compiler options. See msrpce_compiler:options(). These affect all other attributes following it until the next -rpce() attribute.
-rpce_struct(Name :: record_name()). Generates:
  • encode_Name/1
  • decode_Name/1
These encode the given record and all deferred pointer values, with no stream headers attached.
-rpce_stream(Name :: atom(), [record_name()]). Generates:
  • encode_Name_v1/1
  • encode_Name_v2/1
  • decode_Name/1
These encode the given list of records as a MS-RPCE Type Serialization stream, with one Common Type Header, and one Private Header per argument.

The records named in these attributes must be fully type-annotated, with types taken from the msrpce module (e.g. msrpce:uint32() or msrpce:pointer(msrpce:string())).

The header file include/types.hrl also adds local type definitions and shortcuts which make this more readable.

Example


-include_lib("msrpce/include/types.hrl").
 
-record(foobar, {
    field_a :: ulong(),
    field_b :: pointer(str())
    }).
 
-rpce_struct(foobar).
 
do_something() ->
    Bin = encode_foobar(#foobar{field_a = 123, field_b = "hello"}),
    ...

Function Index

parse_transform/2
parse_transform_info/0

Function Details

parse_transform/2

parse_transform(Forms::[erl_parse:abstract_form()], Options::[compile:option()]) -> [erl_parse:abstract_form()]

parse_transform_info/0

parse_transform_info() -> #{error_location => column | line}


Generated by EDoc