diameter_make(3erl) | Erlang Module Definition | diameter_make(3erl) |
diameter_make - Diameter dictionary compilation.
The function codec/2 is used to compile a diameter dictionary file into Erlang source. The resulting source implements the interface diameter requires to encode and decode the dictionary's messages and AVPs.
The utility diameterc(1) provides an alternate compilation interface.
codec(File :: iolist() | binary(), [Opt]) -> ok | {ok,
[Out]} | {error, Reason}
Compile a single dictionary file. The input File can be either a path or a literal dictionary, the occurrence of newline (ascii NL) or carriage return (ascii CR) identifying the latter. Opt determines the format of the results and whether they are written to file or returned, and can have the following types.
The parse format is an internal representation that can be passed to flatten/1 and format/1, while the forms format can be passed to compile:forms/2. The erl and hrl formats are returned as iolists.
Multiple include options can be specified.
Two forms have special meaning:
{inherits, "-"} {inherits, "Prev/Mod"}
The first has the effect of clearing any previous inherits, the second of replacing a previous inherits of Prev to one of Mod. This allows the semantics of the input dictionary to be changed without modifying the file itself.
Multiple inherits options can be specified.
Note that a dictionary's @name, together with the outdir option, determine the output paths when the return option is not specified. The @name of a literal input dictionary defaults to dictionary.
A returned error reason can be converted into a readable string using format_error/1.
format(Parsed) -> iolist()
Turns a parsed dictionary, as returned by codec/2, back into the dictionary format.
flatten(Parsed) -> term()
Reconstitute a parsed dictionary, as returned by codec/2, without using @inherits. That is, construct an equivalent dictionary in which all AVP's are definined in the dictionary itself. The return value is also a parsed dictionary.
format_error(Reason) -> string()
Turn an error reason returned by codec/2 into a readable string.
Unrecognized options are silently ignored.
diameter 2.2.3 | Ericsson AB |