megaco_tcp (megaco v4.8.3)

Copy Markdown View Source

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

This module contains the public interface to the TPKT (TCP/IP) version transport protocol for Megaco/H.248.

Summary

Types

Defines the different counters handled by this transport.

An opaque data type representing a TPKT connection.

Functions

Stop receiving incoming messages on the socket.

This function is used for closing an active TPKT connection.

This function is used to open a TPKT connection.

Get all counter values for all known connections.

Get all counter values for a given (connection) handle.

Get the value of a specific counter.

This function is used for starting new TPKT listening socket for TCP/IP. The option list contains the socket definitions.

Reset all counters for all connections.

Reset all counters for the given connection.

Sends a message on a TPKT connection.

This function is used to convert a socket handle() to a inet socket().

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

Starting to receive incoming messages from the socket again.

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

Types

counter()

-type counter() ::
          medGwyGatewayNumInMessages | medGwyGatewayNumInOctets | medGwyGatewayNumOutMessages |
          medGwyGatewayNumOutOctets | medGwyGatewayNumErrors.

Defines the different counters handled by this transport.

handle()

-opaque handle()

An opaque data type representing a TPKT connection.

Functions

block(Handle :: handle()) -> ok

Stop receiving incoming messages on the socket.

close(Handle :: handle()) -> ok

This function is used for closing an active TPKT connection.

connect(TransportRef, Opts) -> Result

Types

TransportRef = pid() | RegName
Opts = [Option]
Result = {ok, Handle, ControlPid} | {error, Reason}
Host = inet:socket_address() | inet:hostname()
Reason = term()
ControlPid = pid()
Option = {inet_backend, default | inet | socket} |
          {host, Host} |
          {port, PortNum} |
          {options, list()} |
          {receive_handle, term()} |
          {module, atom()}
Handle = handle()
RegName = atom()
PortNum = inet:port_number()

This function is used to open a TPKT connection.

  • module - This option makes it possible for the user to provide their own callback module. The receive_message/4 or process_received_message/4 functions of this module is called when a new message is received. Which one is called depends on the size of the message;

    • small - receive_message

    • large - 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).

get_stats() -> Result

Types

Result = {ok, TotalStats} | {error, Reason}
Reason = term()
TotalStats = [{Handle, [{Counter, integer()}]}]
Counter = counter()
Handle = handle()

Get all counter values for all known connections.

get_stats(Handle :: handle()) -> Result

Types

Result = {ok, Stats} | {error, Reason}
Reason = term()
Stats = [{Counter, integer()}]
Counter = counter()

Get all counter values for a given (connection) handle.

get_stats(Handle, Counter) -> Result

Types

Handle = handle()
Counter = counter()
Result = {ok, integer()} | {error, Reason}
Reason = term()

Get the value of a specific counter.

listen(TransportRef :: pid() | RegName, Options :: [Option]) -> ok

Types

Option = {inet_backend, default | inet | socket} |
          {port, inet:port_number()} |
          {options, list()} |
          {receive_handle, term()}
RegName = atom()

This function is used for starting new TPKT listening socket for TCP/IP. The option list contains the socket definitions.

  • 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 connections.

reset_stats(Handle :: handle()) -> megaco:void()

Reset all counters for the given connection.

send_message(Handle :: handle(), Msg :: binary() | iolist()) -> ok

Sends a message on a TPKT connection.

socket(Handle :: handle()) -> Socket

Types

Socket = inet:socket()

This function is used to convert a socket handle() to a inet socket().

start_transport() -> {ok, TransportRef}

Types

TransportRef = pid()

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

unblock(Handle :: handle()) -> ok

Starting to receive incoming messages from the socket again.

upgrade_receive_handle(ControlPid :: pid(), NewRecvHandle :: term()) -> ok

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