megaco_tcp(3erl)

πŸ’… megaco_tcp(3erl) β€” TPKT transport, bestie edition πŸ’…

okay so this is the page for megaco_tcp(3erl), and it’s giving public interface to the TPKT transport protocol for Megaco/H.248. no cap. πŸ’–


🌸 NAME 🌸

megaco_tcp β€” interface module to TPKT transport protocol for Megaco/H.248. literally the public-facing bestie of this transport. 🫢

πŸ¦‹ DESCRIPTION πŸ¦‹

This module contains the public interface to the TPKT (TCP/IP) version transport protocol for Megaco/H.248. that’s the whole assignment. ✨

πŸ‘‘ EXPORTS πŸ‘‘

πŸ’– start_transport() -> {ok, TransportRef} πŸ’–

Types:

TransportRef = pid()

This function is used for starting the TCP/IP transport service. to stop the transport service, use exit(TransportRef, Reason). periodt. πŸ’…

πŸŽ€ listen(TransportRef, ListenPortSpecList) -> ok πŸŽ€

Types:

TransportRef = pid() | regname()
OptionListPerPort = [Option]

The Option type is exactly one of these shapes, no cap:

  • {port, integer()}
  • {options, list()}
  • {receive_handle, term()}
  • {inet_backend, default | inet | socket}

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

πŸ¦‹ connect(TransportRef, OptionList) -> {ok, Handle, ControlPid} | {error, Reason} πŸ¦‹

Types:

TransportRef = pid() | regname()
OptionList = [Option]
Handle = socket_handle()
ControlPid = pid()
Reason = term()

The Option type is exactly one of these shapes:

  • {host, IpAddr}
  • {port, integer()}
  • {options, list()}
  • {receive_handle, term()}
  • {module, atom()}
  • {inet_backend, default | inet | socket}

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 function of this module is called when a new message is received. Which one gets called depends on the size of the message;

  • small: receive_message
  • large: process_received_message

Default value is megaco. πŸ’œ

πŸ“ close(Handle) -> ok πŸ“

Types:

Handle = socket_handle()

This function is used for closing an active TPKT connection. bye bestie πŸ‘‹

🌸 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. iconic. ✨

πŸ’Œ send_message(Handle, Message) -> ok πŸ’Œ

Types:

Handle = socket_handle()
Message = binary() | iolist()

Sends a message on a connection. πŸ’…

πŸ›‘ block(Handle) -> ok πŸ›‘

Types:

Handle = socket_handle()

Stop receiving incoming messages on the socket. not me hitting pause 😭

▢️ unblock(Handle) -> ok ▢️

Types:

Handle = socket_handle()

Starting to receive incoming messages from the socket again. we’re so back πŸ¦‹

🧚 upgrade_receive_handle(ControlPid) -> ok 🧚

Types:

ControlPid = pid()

Update the receive handle of the control process (e.g. after having changed protocol version). glow-up moment πŸ’«

πŸ“Š get_stats() / get_stats(SendHandle) / get_stats(SendHandle, Counter) πŸ“Š

get_stats() -> {ok, TotalStats} | {error, Reason}
get_stats(SendHandle) -> {ok, SendHandleStats} | {error, Reason}
get_stats(SendHandle, Counter) -> {ok, CounterStats} | {error, Reason}

Types:

TotalStats = [send_handle_stats()]
total_stats() = {send_handle(), [stats()]}
SendHandle = send_handle()
SendHandleStats = [stats()]
Counter = tcp_stats_counter()
CounterStats = integer()
stats() = {tcp_stats_counter(), integer()}
tcp_stats_counter() = medGwyGatewayNumInMessages |
         medGwyGatewayNumInOctets | medGwyGatewayNumOutMessages |
         medGwyGatewayNumOutOctets | medGwyGatewayNumErrors
Reason = term()

Retreive the TCP related (SNMP) statistics counters. numbers bestie πŸ”₯

🧹 reset_stats() -> void() / reset_stats(SendHandle) -> void() 🧹

reset_stats() -> void()
reset_stats(SendHandle) -> void()

Types:

SendHandle = send_handle()

Reset all TCP related (SNMP) statistics counters. clean slate energy πŸ’–


Signed off by Ericsson AB πŸ’œ β€” version megaco 4.4.3 β€” manual bestie megaco_tcp(3erl). mwah πŸ’‹

πŸ“¦ where this page comes from