# megaco_encoder

### MODULE

megaco_encoder

### MODULE SUMMARY

Megaco encoder behaviour.

### DESCRIPTION

The following functions should be exported from a `megaco_encoder` callback module:

### EXPORTS

`Module:encode_message(EncodingConfig, Version, Message) -> {ok, Bin} | Error`

Types:

`EncodingConfig = list()`
`Version = integer()`
`Message = megaco_message()`
`Bin = binary()`
`Error = term()`

Encode a megaco message.

`Module:decode_message(EncodingConfig, Version, Bin) -> {ok, Message} | Error`

Types:

`EncodingConfig = list()`
`Version = integer() | dynamic`
`Message = megaco_message()`
`Bin = binary()`
`Error = term()`

Decode a megaco message.

Note that if the Version argument is `dynamic`, 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`

Types:

`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 `'MegacoMessage'` in which only version and mid has been initiated. This function is used by the megaco_messeger module when the `decode_message/3` function failes to figure out the mid (the actual sender) of the message.

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

### AUTHORS

Micael Karlberg - support@erlang.ericsson.se

megaco 3.6.0.1
Copyright © 1991-2007 Ericsson AB