diameter_make(3erl)
π NAME π
Okay bestie, this is diameter_make(3erl) β literally the page from the 3erl manual, and it's giving Diameter dictionary compilation main character energy. She's an Erlang Module Definition girlie and she's here to help, no cap. Slay, periodt.
β¨ DESCRIPTION β¨
So 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. Iconic behavior, honestly. π
The utility diameterc(1) provides an alternate compilation interface. Options, bestie, we love a backup route. π«Ά Obsessed.
π EXPORTS π
codec/2
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 β and the occurrence of newline (ascii NL) or carriage return (ascii CR) is what identifies the latter. Opt determines the format of the results and whether they are written to file or returned, and can have the following types.
parse|forms|erl|hrlβ specifies an output format. Whether the output is returned or written to file depends on whether or not optionreturnis specified. When written to file, the resulting file(s) will have extensions.D,.F,.erl, and.hrlrespectively, basenames defaulting todictionaryif the input dictionary is literal and does not specify@name. When returned, results are in the order of the corresponding format options. Format options default toerlandhrl(in this order) if unspecified. Theparseformat is an internal representation that can be passed toflatten/1andformat/1, while theformsformat can be passed tocompile:forms/2. Theerlandhrlformats are returned as iolists.{include, string()}β prepend the specified directory to the code path. Use this to point at beam files compiled from inherited dictionaries;@inheritsin a dictionary file creating a beam dependency, not an erl/hrl dependency. Multipleincludeoptions can be specified.{outdir, string()}β write generated source to the specified directory. Defaults to the current working directory. Has no effect if optionreturnis specified.returnβ return results in a{ok, [Out]}tuple instead of writing to file and returningok.{name|prefix, string()}β transform the input dictionary before compilation, setting@nameor@prefixto the specified string.{inherits, string()}β transform the input dictionary before compilation, appending@inheritsof the specified string.
Two forms have special meaning:
{inherits, "-"}
{inherits, "Prev/Mod"}
{inherits, "-"}has the effect of clearing any previous inherits.{inherits, "Prev/Mod"}has the effect of replacing a previous inherits ofPrevto one ofMod.
This allows the semantics of the input dictionary to be changed without modifying the file itself. Multiple inherits options can be specified.
Lowkey important note: a dictionary's@name, together with theoutdiroption, determine the output paths when thereturnoption is not specified. The@nameof a literal input dictionary defaults todictionary.
A returned error reason can be converted into a readable string using format_error/1.
format/1
format(Parsed) -> iolist()
Turns a parsed dictionary, as returned by codec/2, back into the dictionary format. Round-trip queen behavior. β¨
flatten/1
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 defined in the dictionary itself. The return value is also a parsed dictionary. Yes, all the AVPs are living in the dictionary itself β no inherited crutches, just vibes. π
format_error/1
format_error(Reason) -> string()
Turn an error reason returned by codec/2 into a readable string. So when things go sideways, you get actual words instead of cryptic little gremlin energy, ngl. π
π BUGS π
Unrecognized options are silently ignored. Not a drill, bestie β she's literally not gonna tell you, she's just gonna ignore them and move on. π Fr fr.
π SEE ALSO π
diameterc(1), diameter_dict(5) β go read those too. You know you want to, iykyk. π
Cute sign-off: source/version is Ericsson AB with version diameter 2.2.7, and the footer date slot is staying mysterious in this version β mwah π
π¦ where this page comes from
- debian bookworm: erlang-manpages 1:25.2.3+dfsg-1+deb12u1 Β· Apache-2.0
- debian bookworm: erlang-manpages 1:25.2.3+dfsg-1+deb12u4 Β· Apache-2.0
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4 Β· Apache-2.0
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4.8 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms