aboutsummaryrefslogtreecommitdiffstats
path: root/lib/megaco/doc/src/megaco_encoder.xml
blob: c7f733820474a10c88ab5735959870e80eba110a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>
  <header>
    <copyright>
      <year>2003</year><year>2013</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      The contents of this file are subject to the Erlang Public License,
      Version 1.1, (the "License"); you may not use this file except in
      compliance with the License. You should have received a copy of the
      Erlang Public License along with this software. If not, it can be
      retrieved online at http://www.erlang.org/.
    
      Software distributed under the License is distributed on an "AS IS"
      basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
      the License for the specific language governing rights and limitations
      under the License.
    
    </legalnotice>

    <title>megaco_encoder</title>
    <prepared>Micael Karlberg</prepared>
    <responsible>Micael Karlberg</responsible>
    <docno></docno>
    <approved>Micael Karlberg</approved>
    <checked></checked>
    <date>2007-06-15</date>
    <rev>%VSN%</rev>
    <file>megaco_encoder.xml</file>
  </header>
  <module>megaco_encoder</module>
  <modulesummary>Megaco encoder behaviour.</modulesummary>
  <description>
    <p>The following functions should be exported from a 
      <c><![CDATA[megaco_encoder]]></c> callback module:</p>

  </description>

  <section>
    <title>DATA TYPES</title>
    <code type="none"><![CDATA[
megaco_message() = #'MegacoMessage{}'
transaction() = {transactionRequest,     transaction_request()}      |
                {transactionPending,     transaction_reply()}        |
                {transactionReply,       transaction_pending()}      |
                {transactionResponseAck, transaction_response_ack()} |
                {segmentReply,           segment_reply()}
transaction_request() = #'TransactionRequest'{}
transaction_pending() = #'TransactionPending'{}
transaction_reply() = #'TransactionReply'{}
transaction_response_ack() = [transaction_ack()]
transaction_ack() = #'TransactionAck'{}
segment_reply() = #'SegmentReply'{}
action_request() = #'ActionRequest'{}
action_reply() = #'ActionReply'{}
    ]]></code>

    <marker id="encode_message"></marker>
  </section>

  <funcs>
    <func>
      <name>Module:encode_message(EncodingConfig, Version, Message) -> {ok, Bin} | Error</name>
      <fsummary>Encode a megaco message.</fsummary>
      <type>
        <v>EncodingConfig = list()</v>
        <v>Version = integer()</v>
        <v>Message = megaco_message()</v>
        <v>Bin = binary()</v>
        <v>Error = term()</v>
      </type>
      <desc>
        <p>Encode a megaco message.</p>

	<marker id="decode_message"></marker>
      </desc>
    </func>

    <func>
      <name>Module:decode_message(EncodingConfig, Version, Bin) -> {ok, Message} | Error</name>
      <fsummary>Decode a megaco message.</fsummary>
      <type>
        <v>EncodingConfig = list()</v>
        <v>Version = integer() | dynamic</v>
        <v>Message = megaco_message()</v>
        <v>Bin = binary()</v>
        <v>Error = term()</v>
      </type>
      <desc>
        <p>Decode a megaco message. </p>
        <p>Note that if the Version argument is <c><![CDATA[dynamic]]></c>, the
          decoder should try to figure out the actual version from the
          message itself and then use the proper decoder, e.g. version 1.
          <br></br>If on the other hand the Version argument is an integer, 
          it means that this is the expected version of the message and 
          the decoder for that version should be used.</p>

	<marker id="decode_mini_message"></marker>
      </desc>
    </func>

    <func>
      <name>Module:decode_mini_message(EncodingConfig, Version, Bin) -> {ok, Message} | Error</name>
      <fsummary>Perform a minimal decode of a megaco message.</fsummary>
      <type>
        <v>EncodingConfig = list()</v>
        <v>Version = integer() | dynamic</v>
        <v>Message = megaco_message()</v>
        <v>Bin = binary()</v>
        <v>Error = term()</v>
      </type>
      <desc>
        <p>Perform a minimal decode of a megaco message. </p>
        <p>The purpose of this function is to do a minimal decode of
          Megaco message. A successfull result is a <c><![CDATA['MegacoMessage']]></c> 
          in which only version and mid has been initiated. This function 
          is used by the megaco_messenger module when the 
          <c><![CDATA[decode_message/3]]></c> function fails to figure out the mid 
          (the actual sender) of the message.</p>
        <p>Note again that a successfull decode only returns a
          partially initiated message.</p>

	<marker id="encode_transaction"></marker>
      </desc>
    </func>

    <func>
      <name>Module:encode_transaction(EncodingConfig, Version, Transaction) -> OK | Error</name>
      <fsummary>Encode a megaco transaction.</fsummary>
      <type>
        <v>EncodingConfig = list()</v>
        <v>Version = integer()</v>
        <v>Transaction = transaction()</v>
        <v>OK = {ok, Bin}</v>
        <v>Bin = binary()</v>
        <v>Error = {error, Reason}</v>
        <v>Reason = not_implemented | OtherReason</v>
        <v>OtherReason = term()</v>
      </type>
      <desc>
        <p>Encode a megaco transaction. If this, for whatever reason, 
          is not supported, the function should return the error reason 
          <c>not_implemented</c>. </p>

        <p>This functionality is used both when the transaction sender is 
          used and for segmentation. So, for either of those to work, this 
          function <em>must</em> be fully supported! </p>

	<marker id="encode_action_requests"></marker>
      </desc>
    </func>

    <func>
      <name>Module:encode_action_requests(EncodingConfig, Version, ARs) -> OK | Error</name>
      <fsummary>Encode megaco action requests.</fsummary>
      <type>
        <v>EncodingConfig = list()</v>
        <v>Version = integer()</v>
        <v>ARs = action_requests()</v>
        <v>action_requests() = [action_request()]</v>
        <v>OK = {ok, Bin}</v>
        <v>Bin = binary()</v>
        <v>Error = {error, Reason}</v>
        <v>Reason = not_implemented | OtherReason</v>
        <v>OtherReason = term()</v>
      </type>
      <desc>
        <p>Encode megaco action requests. This function is called when 
          the user calls the function 
          <seealso marker="megaco#encode_actions">encode_actions/3</seealso>.
          If that function is never used or if the codec cannot support this
          (the encoding of individual actions), then return with error reason 
          <c>not_implemented</c>. </p>

	<marker id="encode_action_reply"></marker>
      </desc>
    </func>

    <func>
      <name>Module:encode_action_reply(EncodingConfig, Version, AR) -> OK | Error</name>
      <fsummary>Encode a megaco action reply.</fsummary>
      <type>
        <v>EncodingConfig = list()</v>
        <v>Version = integer()</v>
        <v>AR = action_reply()</v>
        <v>OK = {ok, Bin}</v>
        <v>Bin = binary()</v>
        <v>Error = {error, Reason}</v>
        <v>Reason = not_implemented | OtherReason</v>
        <v>OtherReason = term()</v>
      </type>
      <desc>
        <p>Encode a megaco action reply. If this, for whatever reason, 
          is not supported, the function should return the error reason 
          <c>not_implemented</c>. </p>

        <p>This function is used when segmentation has been configured. 
          So, for this to work, this function <em>must</em> be fully 
          supported! </p>
      </desc>
    </func>

  </funcs>

</erlref>