Interface module to UDP transport protocol for Megaco/H.248.
This module contains the public interface to the UDP/IP version transport protocol for Megaco/H.248.
Summary
Types
Defines the different counters handled by this transport.
An opaque data type representing an UDP socket.
An opaque data type representing an UDP socket, used when sending.
Functions
Stop receiving incoming messages on the socket.
This function is used for closing an active UDP socket.
Creates a send handle from a transport handle. The send handle is intended to be used by megaco_udp:send_message/2.
Get all counter values for all known connections.
Get all counter values for a given handle.
Get the value of a specific counter.
This function is used to open an UDP/IP socket.
Reset all counters for all UDP handles.
Reset all counters for the given UDP handle.
Sends a message on a socket. The send handle is obtained by megacoudp: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.
This function is used to convert a socket handle() to a inet socket().
This function is used for starting the UDP/IP transport service. Use exit(TransportRef, Reason) to stop the transport service.
Starting to receive incoming messages from the socket again.
Update the receive handle of the control process (e.g. after having changed protocol version).
Types
-type counter() ::
medGwyGatewayNumInMessages | medGwyGatewayNumInOctets | medGwyGatewayNumOutMessages |
medGwyGatewayNumOutOctets | medGwyGatewayNumErrors.
Defines the different counters handled by this transport.
-opaque handle()
An opaque data type representing an UDP socket.
-opaque send_handle()
An opaque data type representing an UDP socket, used when sending.
Functions
block(Handle :: handle() | send_handle()) -> ok
Stop receiving incoming messages on the socket.
close(Handle :: handle() | send_handle()) -> ok
This function is used for closing an active UDP socket.
create_send_handle(Handle, Host, Port) -> send_handle()
Creates a send handle from a transport handle. The send handle is intended to be used by megaco_udp:send_message/2.
Types
Result = {ok, TotalStats} | {error, Reason}
Reason = term()
TotalStats = [{SH, [{Counter, integer()}]}]
Counter = counter()
SH = send_handle()
Get all counter values for all known connections.
get_stats(SH :: send_handle()) -> Result
Types
Result = {ok, Stats} | {error, Reason}
Reason = term()
Stats = [{Counter, integer()}]
Counter = counter()
Get all counter values for a given handle.
Types
SH = send_handle()
Counter = counter()
Result = {ok, integer()} | {error, Reason}
Reason = term()
Get the value of a specific counter.
Types
TransportRef = ControlPid = pid()
Opts = {inet_backend, default | inet | socket} |
{port, PortNum} |
{options, list()} |
{receive_handle, term()} |
{module, atom()}
Result = {ok, Handle, ControlPid} | {error, Reason}
Reason = term()
Handle = handle()
PortNum = inet:port_number()
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 functionsreceive_message/4orprocess_received_message/4of this module is called when a new message is received. Which one depends on the size of the message:small- receive_messagelarge- process_received_message
Default value is megaco.
inet_backend- Choose the inet-backend.This option make it possible to use a different inet-backend ('default', 'inet' or 'socket').
Default is
default(system default).
reset_stats() -> megaco:void()
Reset all counters for all UDP handles.
reset_stats(SH :: send_handle()) -> megaco:void()
Reset all counters for the given UDP handle.
send_message(SH :: send_handle(), Msg :: binary() | iolist()) -> ok
Sends a message on a socket. The send handle is obtained by megacoudp: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.
socket(Handle :: handle() | send_handle()) -> Socket
Types
Socket = inet:socket()
This function is used to convert a socket handle() to a inet socket().
Types
TransportRef = pid()
This function is used for starting the UDP/IP transport service. Use exit(TransportRef, Reason) to stop the transport service.
unblock(Handle :: handle() | send_handle()) -> ok
Starting to receive incoming messages from the socket again.
Update the receive handle of the control process (e.g. after having changed protocol version).