View Source megaco_tcp (megaco v4.6)

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.

socket(Handle) -> 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

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

Defines the different counters handled by this transport.

-opaque handle()

An opaque data type representing a TPKT connection.

Functions

-spec block(Handle) -> ok when Handle :: handle().

Stop receiving incoming messages on the socket.

-spec close(Handle) -> ok when Handle :: handle().

This function is used for closing an active TPKT connection.

Link to this function

connect(TransportRef, Opts)

View Source
-spec connect(TransportRef, Opts) -> {ok, Handle, ControlPid} | {error, Reason}
                 when
                     TransportRef :: pid() | RegName,
                     RegName :: atom(),
                     Opts :: [Option],
                     Option ::
                         {inet_backend, default | inet | socket} |
                         {host, Host} |
                         {port, PortNum} |
                         {options, list()} |
                         {receive_handle, term()} |
                         {module, atom()},
                     Host :: inet:socket_address() | inet:hostname(),
                     PortNum :: inet:port_number(),
                     Handle :: handle(),
                     ControlPid :: pid(),
                     Reason :: term().

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

-spec get_stats() -> {ok, TotalStats} | {error, Reason}
                   when
                       TotalStats :: [{Handle, [{Counter, integer()}]}],
                       Handle :: handle(),
                       Counter :: counter(),
                       Reason :: term().

Get all counter values for all known connections.

-spec get_stats(Handle) -> {ok, Stats} | {error, Reason}
                   when
                       Handle :: handle(),
                       Stats :: [{Counter, integer()}],
                       Counter :: counter(),
                       Reason :: term().

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

Link to this function

get_stats(Handle, Counter)

View Source
-spec get_stats(Handle, Counter) -> {ok, integer()} | {error, Reason}
                   when Handle :: handle(), Counter :: counter(), Reason :: term().

Get the value of a specific counter.

Link to this function

listen(TransportRef, Options)

View Source
-spec listen(TransportRef, Options) -> ok
                when
                    TransportRef :: pid() | RegName,
                    RegName :: atom(),
                    Options :: [Option],
                    Option ::
                        {inet_backend, default | inet | socket} |
                        {port, inet:port_number()} |
                        {options, list()} |
                        {receive_handle, term()}.

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

-spec reset_stats() -> megaco:void().

Reset all counters for all connections.

-spec reset_stats(Handle) -> megaco:void() when Handle :: handle().

Reset all counters for the given connection.

Link to this function

send_message(Handle, Msg)

View Source
-spec send_message(Handle, Msg) -> ok when Handle :: handle(), Msg :: binary() | iolist().

Sends a message on a TPKT connection.

-spec socket(Handle) -> Socket when Handle :: handle(), Socket :: inet:socket().

socket(Handle) -> Socket

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

-spec start_transport() -> {ok, TransportRef} when TransportRef :: pid().

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

-spec unblock(Handle) -> ok when Handle :: handle().

Starting to receive incoming messages from the socket again.

Link to this function

upgrade_receive_handle(ControlPid, NewRecvHandle)

View Source
-spec upgrade_receive_handle(ControlPid, NewRecvHandle) -> ok
                                when ControlPid :: pid(), NewRecvHandle :: term().

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