# megaco_codec_transform

### MODULE

megaco_codec_transform

### MODULE SUMMARY

Megaco message transformation utility.

### DESCRIPTION

This module implements a simple megaco message transformation utility.

Note that this module is not included in the runtime part of the application.

### EXPORTS

`tt() -> void()`

Transform messages using pretty text as base. Transform messages from pretty text encoding to compact, ber, per and erlang encoding.

This call is equivalent to the call: `t(pretty, [compact, ber, per, erlang])`

`tb() -> void()`

Transform messages using ber binary as base. Transform messages from ber binary encoding to pretty, compact, ber, per and erlang encoding.

This call is equivalent to the call: `t(ber, [pretty, compact, per, erlang])`

`t([FromCodec, ToCodecs]) -> ok | {error, Reason}`

Types:

`FromCodec = codec_string()`
`ToCodecs = [codec_string()]`
`codec_string() = "pretty" | "compact" | "ber" | "per" | "erlang"`

Called from the command line (shell) to transform all messages in a given codec dir to a given list of codec dirs. The dirs will not be created.

Example: Converts from codec ber to codecs pretty, compact and per

              erl -noshell -sname megaco ../ebin \
                  -run megaco_codec_transform t ber "pretty compact per" \
                  -s erlang halt

`t(FromCodec, ToCodecs) -> ok | {error, Reason}`

Types:

`FromCodec = codec()`
`ToCodecs = [codec()]`
`codec() = pretty | compact | ber | per | erlang`

Transforms all messages in a given codec dir to a given list of codec dirs. The dirs will not be created.

`tmf(FromFile, FromCodec, ToCodec) -> ok | {error, Reason}`

Types:

`FromFile = string()`
`FromCodec = codec()`
`ToCodec = codec()`

Transform a message in a file encoded with the given codec to another codec. The resulting message is written to file, in the `ToCodec` dir.

`tm(FromMsg, FromCodec, ToCodec) -> binary()`

Types:

`FromMsg = binary()`
`FromCodec = codec()`
`ToCodec = codec()`

Tranforms a message binary encoded with the given codec to another codec. The resulting message is returned (as a binary).

### AUTHORS

Micael Karlberg - support@erlang.ericsson.se

megaco 3.5.1
Copyright © 1991-2007 Ericsson AB