1diameter_make(3) Erlang Module Definition diameter_make(3)
2
3
4
6 diameter_make - Diameter dictionary compilation.
7
9 The function codec/2 is used to compile a diameter dictionary file into
10 Erlang source. The resulting source implements the interface diameter
11 requires to encode and decode the dictionary's messages and AVPs.
12
13 The utility diameterc(1) provides an alternate compilation interface.
14
16 codec(File :: iolist() | binary(), [Opt]) -> ok | {ok, [Out]} | {error,
17 Reason}
18
19 Compile a single dictionary file. The input File can be either a
20 path or a literal dictionary, the occurrence of newline (ascii
21 NL) or carriage return (ascii CR) identifying the latter. Opt
22 determines the format of the results and whether they are writ‐
23 ten to file or returned, and can have the following types.
24
25 parse | forms | erl | hrl:
26 Specifies an output format. Whether the output is returned
27 or written to file depends on whether or not option return
28 is specified. When written to file, the resulting file(s)
29 will have extensions .D, .F, .erl, and .hrl respectively,
30 basenames defaulting to dictionary if the input dictionary
31 is literal and does not specify @name. When returned, re‐
32 sults are in the order of the corresponding format options.
33 Format options default to erl and hrl (in this order) if un‐
34 specified.
35
36 The parse format is an internal representation that can be
37 passed to flatten/1 and format/1, while the forms format can
38 be passed to compile:forms/2. The erl and hrl formats are
39 returned as iolists.
40
41 {include, string()}:
42 Prepend the specified directory to the code path. Use to
43 point at beam files compiled from inherited dictionaries,
44 @inherits in a dictionary file creating a beam dependency,
45 not an erl/hrl dependency.
46
47 Multiple include options can be specified.
48
49 {outdir, string()}:
50 Write generated source to the specified directory. Defaults
51 to the current working directory. Has no effect if option
52 return is specified.
53
54 return:
55 Return results in a {ok, [Out]} tuple instead of writing to
56 file and returning ok.
57
58 {name|prefix, string()}:
59 Transform the input dictionary before compilation, setting
60 @name or @prefix to the specified string.
61
62 {inherits, string()}:
63 Transform the input dictionary before compilation, appending
64 @inherits of the specified string.
65
66 Two forms have special meaning:
67
68 {inherits, "-"}
69 {inherits, "Prev/Mod"}
70
71
72 The first has the effect of clearing any previous inherits,
73 the second of replacing a previous inherits of Prev to one
74 of Mod. This allows the semantics of the input dictionary to
75 be changed without modifying the file itself.
76
77 Multiple inherits options can be specified.
78
79 Note that a dictionary's @name, together with the outdir option,
80 determine the output paths when the return option is not speci‐
81 fied. The @name of a literal input dictionary defaults to dic‐
82 tionary.
83
84 A returned error reason can be converted into a readable string
85 using format_error/1.
86
87 format(Parsed) -> iolist()
88
89 Turns a parsed dictionary, as returned by codec/2, back into the
90 dictionary format.
91
92 flatten(Parsed) -> term()
93
94 Reconstitute a parsed dictionary, as returned by codec/2, with‐
95 out using @inherits. That is, construct an equivalent dictionary
96 in which all AVP's are definined in the dictionary itself. The
97 return value is also a parsed dictionary.
98
99 format_error(Reason) -> string()
100
101 Turn an error reason returned by codec/2 into a readable string.
102
104 Unrecognized options are silently ignored.
105
107 diameterc(1), diameter_dict(4)
108
109
110
111Ericsson AB diameter 2.3 diameter_make(3)