1megaco_encoder(3) Erlang Module Definition megaco_encoder(3)
2
3
4
6 megaco_encoder - Megaco encoder behaviour.
7
9 The following functions should be exported from a megaco_encoder call‐
10 back module:
11
13 Note:
14 Note that the actual definition of (some of) these records depend on
15 the megaco protocol version used. For instance, the 'TransactionReply'
16 record has two more fields in version 3, so a simple erlang type defi‐
17 nition cannot be made here.
18
19
20 protocol_version() = integer()
21 segment_no() = integer()
22 megaco_message() = #'MegacoMessage{}'
23 transaction() = {transactionRequest, transaction_request()} |
24 {transactionPending, transaction_reply()} |
25 {transactionReply, transaction_pending()} |
26 {transactionResponseAck, transaction_response_ack()} |
27 {segmentReply, segment_reply()}
28 transaction_request() = #'TransactionRequest'{}
29 transaction_pending() = #'TransactionPending'{}
30 transaction_reply() = #'TransactionReply'{}
31 transaction_response_ack() = [transaction_ack()]
32 transaction_ack() = #'TransactionAck'{}
33 segment_reply() = #'SegmentReply'{}
34 action_request() = #'ActionRequest'{}
35 action_reply() = #'ActionReply'{}
36 command_request() = #'CommandRequest'{}
37 error_desc() = #'ErrorDescriptor'{}
38
39
41 Module:encode_message(EncodingConfig, Version, Message) -> {ok, Bin} |
42 Error
43
44 Types:
45
46 EncodingConfig = list()
47 Version = integer()
48 Message = megaco_message()
49 Bin = binary()
50 Error = term()
51
52 Encode a megaco message.
53
54 Module:decode_message(EncodingConfig, Version, Bin) -> {ok, Message} |
55 Error
56
57 Types:
58
59 EncodingConfig = list()
60 Version = integer() | dynamic
61 Message = megaco_message()
62 Bin = binary()
63 Error = term()
64
65 Decode a megaco message.
66
67 Note that if the Version argument is dynamic, the decoder should
68 try to figure out the actual version from the message itself and
69 then use the proper decoder, e.g. version 1.
70 If on the other hand the Version argument is an integer, it
71 means that this is the expected version of the message and the
72 decoder for that version should be used.
73
74 Module:decode_mini_message(EncodingConfig, Version, Bin) -> {ok, Mes‐
75 sage} | Error
76
77 Types:
78
79 EncodingConfig = list()
80 Version = integer() | dynamic
81 Message = megaco_message()
82 Bin = binary()
83 Error = term()
84
85 Perform a minimal decode of a megaco message.
86
87 The purpose of this function is to do a minimal decode of Megaco
88 message. A successfull result is a 'MegacoMessage' in which only
89 version and mid has been initiated. This function is used by the
90 megaco_messenger module when the decode_message/3 function fails
91 to figure out the mid (the actual sender) of the message.
92
93 Note again that a successfull decode only returns a partially
94 initiated message.
95
96 Module:encode_transaction(EncodingConfig, Version, Transaction) -> OK |
97 Error
98
99 Types:
100
101 EncodingConfig = list()
102 Version = integer()
103 Transaction = transaction()
104 OK = {ok, Bin}
105 Bin = binary()
106 Error = {error, Reason}
107 Reason = not_implemented | OtherReason
108 OtherReason = term()
109
110 Encode a megaco transaction. If this, for whatever reason, is
111 not supported, the function should return the error reason
112 not_implemented.
113
114 This functionality is used both when the transaction sender is
115 used and for segmentation. So, for either of those to work, this
116 function must be fully supported!
117
118 Module:encode_action_requests(EncodingConfig, Version, ARs) -> OK | Er‐
119 ror
120
121 Types:
122
123 EncodingConfig = list()
124 Version = integer()
125 ARs = action_requests()
126 action_requests() = [action_request()]
127 OK = {ok, Bin}
128 Bin = binary()
129 Error = {error, Reason}
130 Reason = not_implemented | OtherReason
131 OtherReason = term()
132
133 Encode megaco action requests. This function is called when the
134 user calls the function encode_actions/3. If that function is
135 never used or if the codec cannot support this (the encoding of
136 individual actions), then return with error reason not_imple‐
137 mented.
138
139 Module:encode_action_reply(EncodingConfig, Version, AR) -> OK | Error
140
141 Types:
142
143 EncodingConfig = list()
144 Version = integer()
145 AR = action_reply()
146 OK = {ok, Bin}
147 Bin = binary()
148 Error = {error, Reason}
149 Reason = not_implemented | OtherReason
150 OtherReason = term()
151
152 Encode a megaco action reply. If this, for whatever reason, is
153 not supported, the function should return the error reason
154 not_implemented.
155
156 This function is used when segmentation has been configured. So,
157 for this to work, this function must be fully supported!
158
159
160
161Ericsson AB megaco 4.1 megaco_encoder(3)