---
name: "megaco_udp"
section: "3erl"
platform: "linux"
package: "erlang-manpages"
version: "1:25.2.3+dfsg-1+deb12u4"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/megaco_udp"
---

# megaco\_udp(3erl)

Interface module to UDP transport protocol for Megaco/H.248.

## NAME

megaco\_udp - Interface module to UDP transport protocol for Megaco/H.248.

## DESCRIPTION

This module contains the public interface to the UDP/IP version transport protocol for Megaco/H.248.

## EXPORTS

**start\_transport() -\> {ok, TransportRef}**\

Types:

TransportRef = pid()\

This function is used for starting the UDP/IP transport service. Use exit(TransportRef, Reason) to stop the transport service.

**open(TransportRef, OptionList) -\> {ok, Handle, ControlPid} \| {error, Reason}**\

Types:

TransportRef = pid() \| regname()\
 OptionList = \[option()\]\
 option() = {port, integer()} \| {options, list()} \| {receive\_handle, receive\_handle()} \| {module, atom()} \| {inet\_backend, default \| inet \| socket}\
 Handle = socket\_handle()\
 receive\_handle() = term()\
 ControlPid = pid()\
 Reason = term()\

This function is used to open an UDP/IP socket.

- ***module*:**

  The option makes it possible for the user to provide their own callback module. The functions *receive\_message/4* or *process\_received\_message/4* of this module is called when a new message is received. Which one depends on the size of the message:

  - ***small*:**

    receive\_message

  - ***large*:**

    process\_received\_message

  Default value is *megaco*.

**close(Handle, Msg) -\> ok**\

Types:

Handle = socket\_handle()\
 Msg\

This function is used for closing an active UDP socket.

**socket(Handle) -\> Socket**\

Types:

Handle = socket\_handle()\
 Socket = inet\_socket()\

This function is used to convert a socket\_handle() to a inet\_socket(). inet\_socket() is a plain socket, see the inet module for more info.

**create\_send\_handle(Handle, Host, Port) -\> send\_handle()**\

Types:

Handle = socket\_handle()\
 Host = {A,B,C,D} \| string()\
 Port = integer()\

Creates a send handle from a transport handle. The send handle is intended to be used by megaco\_udp:send\_message/2.

**send\_message(SendHandle, Msg) -\> ok**\

Types:

SendHandle = send\_handle()\
 Message = binary() \| iolist()\

Sends a message on a socket. The send handle is obtained by megaco\_udp:create\_send\_handle/3. Increments the NumOutMessages and NumOutOctets counters if message successfully sent. In case of a failure to send, the NumErrors counter is *not* incremented. This is done elsewhere in the megaco app.

**block(Handle) -\> ok**\

Types:

Handle = socket\_handle()\

Stop receiving incoming messages on the socket.

**unblock(Handle) -\> ok**\

Types:

Handle = socket\_handle()\

Starting to receive incoming messages from the socket again.

**upgrade\_receive\_handle(ControlPid, NewHandle) -\> ok**\

Types:

ControlPid = pid()\
 NewHandle = receive\_handle()\
 receive\_handle() = term()\

Update the receive handle of the control process (e.g. after having changed protocol version).

**get\_stats() -\> {ok, TotalStats} \| {error, Reason}**\
 **get\_stats(SendHandle) -\> {ok, SendHandleStats} \| {error, Reason}**\
 **get\_stats(SendHandle, Counter) -\> {ok, CounterStats} \| {error, Reason}**\

Types:

TotalStats = \[total\_stats()\]\
 total\_stats() = {send\_handle(), \[stats()\]}\
 SendHandle = send\_handle()\
 SendHandleStats = \[stats()\]\
 Counter = udp\_stats\_counter()\
 CounterStats = integer()\
 stats() = {udp\_stats\_counter(), integer()}\
 tcp\_stats\_counter() = medGwyGatewayNumInMessages \| medGwyGatewayNumInOctets \| medGwyGatewayNumOutMessages \| medGwyGatewayNumOutOctets \| medGwyGatewayNumErrors\
 Reason = term()\

Retreive the UDP related (SNMP) statistics counters.

**reset\_stats() -\> void()**\
 **reset\_stats(SendHandle) -\> void()**\

Types:

SendHandle = send\_handle()\

Reset all TCP related (SNMP) statistics counters.
