20032013 Ericsson AB. All Rights Reserved. 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. megaco_encoder Micael Karlberg Micael Karlberg Micael Karlberg 2007-06-15 %VSN% megaco_encoder.xml
megaco_encoder Megaco encoder behaviour.

The following functions should be exported from a callback module:

DATA TYPES
Module:encode_message(EncodingConfig, Version, Message) -> {ok, Bin} | Error Encode a megaco message. EncodingConfig = list() Version = integer() Message = megaco_message() Bin = binary() Error = term()

Encode a megaco message.

Module:decode_message(EncodingConfig, Version, Bin) -> {ok, Message} | Error Decode a megaco message. EncodingConfig = list() Version = integer() | dynamic Message = megaco_message() Bin = binary() Error = term()

Decode a megaco message.

Note that if the Version argument is , the decoder should try to figure out the actual version from the message itself and then use the proper decoder, e.g. version 1.

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.

Module:decode_mini_message(EncodingConfig, Version, Bin) -> {ok, Message} | Error Perform a minimal decode of a megaco message. EncodingConfig = list() Version = integer() | dynamic Message = megaco_message() Bin = binary() Error = term()

Perform a minimal decode of a megaco message.

The purpose of this function is to do a minimal decode of Megaco message. A successfull result is a in which only version and mid has been initiated. This function is used by the megaco_messenger module when the function fails to figure out the mid (the actual sender) of the message.

Note again that a successfull decode only returns a partially initiated message.

Module:encode_transaction(EncodingConfig, Version, Transaction) -> OK | Error Encode a megaco transaction. EncodingConfig = list() Version = integer() Transaction = transaction() OK = {ok, Bin} Bin = binary() Error = {error, Reason} Reason = not_implemented | OtherReason OtherReason = term()

Encode a megaco transaction. If this, for whatever reason, is not supported, the function should return the error reason not_implemented.

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

Module:encode_action_requests(EncodingConfig, Version, ARs) -> OK | Error Encode megaco action requests. EncodingConfig = list() Version = integer() ARs = action_requests() action_requests() = [action_request()] OK = {ok, Bin} Bin = binary() Error = {error, Reason} Reason = not_implemented | OtherReason OtherReason = term()

Encode megaco action requests. This function is called when the user calls the function encode_actions/3. If that function is never used or if the codec cannot support this (the encoding of individual actions), then return with error reason not_implemented.

Module:encode_action_reply(EncodingConfig, Version, AR) -> OK | Error Encode a megaco action reply. EncodingConfig = list() Version = integer() AR = action_reply() OK = {ok, Bin} Bin = binary() Error = {error, Reason} Reason = not_implemented | OtherReason OtherReason = term()

Encode a megaco action reply. If this, for whatever reason, is not supported, the function should return the error reason not_implemented.

This function is used when segmentation has been configured. So, for this to work, this function must be fully supported!