1
<?xml version="1.0" encoding="latin1" ?>
2
<!DOCTYPE erlref SYSTEM "erlref.dtd">
7
<year>2000</year><year>2009</year>
8
<holder>Ericsson AB. All Rights Reserved.</holder>
11
The contents of this file are subject to the Erlang Public License,
12
Version 1.1, (the "License"); you may not use this file except in
13
compliance with the License. You should have received a copy of the
14
Erlang Public License along with this software. If not, it can be
15
retrieved online at http://www.erlang.org/.
17
Software distributed under the License is distributed on an "AS IS"
18
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
19
the License for the specific language governing rights and limitations
24
<title>megaco_tcp</title>
25
<prepared>Lars Thorsén</prepared>
26
<responsible>Lars Thorsén</responsible>
28
<approved>Lars Thorsén</approved>
30
<date>2007-06-15</date>
32
<file>megaco_tcp.xml</file>
34
<module>megaco_tcp</module>
35
<modulesummary>Interface module to TPKT transport protocol for Megaco/H.248.</modulesummary>
37
<p>This module contains the public interface to the TPKT (TCP/IP) version
38
transport protocol for Megaco/H.248.</p>
42
<name>start_transport() -> {ok, TransportRef}</name>
45
<v>TransportRef = pid()</v>
48
<p>This function is used for starting the TCP/IP transport service.
49
Use exit(TransportRef, Reason) to stop the transport service.</p>
53
<name>listen(TransportRef, ListenPortSpecList) -> ok</name>
56
<v>TransportRef = pid() | regname()</v>
57
<v>OptionListPerPort = [Option]</v>
58
<v>Option = {port, integer()} |{options, list()} |{receive_handle, term()}</v>
61
<p>This function is used for starting new TPKT listening socket
62
for TCP/IP. The option list contains the socket
67
<name>connect(TransportRef, OptionList) -> {ok, Handle, ControlPid} | {error, Reason}</name>
70
<v>TransportRef = pid() | regname()</v>
71
<v>OptionList = [Option]</v>
72
<v>Option = {host, Ipaddr} | {port, integer()} |{options, list()} |{receive_handle, term()} |{module, atom()}</v>
73
<v>Handle = socket_handle()</v>
74
<v>ControlPid = pid()</v>
75
<v>Reason = term()</v>
78
<p>This function is used to open a TPKT connection.</p>
79
<p>The <c><![CDATA[module]]></c> option makes it possible for the user to provide
80
their own callback module. The <c><![CDATA[receive_message/4]]></c> or
81
<c><![CDATA[process_received_message/4]]></c> functions of this module is called
82
when a new message is received (which one depends on the size of the
83
message; small - receive_message, large - process_received_message).
84
Default value is <em>megaco</em>.</p>
88
<name>close(Handle) -> ok</name>
91
<v>Handle = socket_handle()</v>
94
<p>This function is used for closing an active TPKT connection.</p>
98
<name>socket(Handle) -> Socket</name>
101
<v>Handle = socket_handle()</v>
102
<v>Socket = inet_socket()</v>
105
<p>This function is used to convert a socket_handle() to
106
a inet_socket(). inet_socket() is a plain socket,
107
see the inet module for more info.</p>
111
<name>send_message(Handle, Message) -> ok</name>
112
<fsummary></fsummary>
114
<v>Handle = socket_handle()</v>
115
<v>Message = binary() | iolist()</v>
118
<p>Sends a message on a connection.</p>
122
<name>block(Handle) -> ok</name>
123
<fsummary></fsummary>
125
<v>Handle = socket_handle()</v>
128
<p>Stop receiving incomming messages on the socket.</p>
132
<name>unblock(Handle) -> ok</name>
133
<fsummary></fsummary>
135
<v>Handle = socket_handle()</v>
138
<p>Starting to receive incomming messages from the socket again.</p>
139
<marker id="upgrade_receive_handle"></marker>
143
<name>upgrade_receive_handle(ControlPid) -> ok</name>
144
<fsummary></fsummary>
146
<v>ControlPid = pid()</v>
149
<p>Update the receive handle of the control process (e.g. after
150
having changed protocol version).</p>
151
<marker id="stats"></marker>
155
<name>get_stats() -> {ok, TotalStats} | {error, Reason}</name>
156
<name>get_stats(SendHandle) -> {ok, SendHandleStats} | {error, Reason}</name>
157
<name>get_stats(SendHandle, Counter) -> {ok, CounterStats} | {error, Reason}</name>
158
<fsummary></fsummary>
160
<v>TotalStats = [send_handle_stats()]</v>
161
<v>total_stats() = {send_handle(), [stats()]}</v>
162
<v>SendHandle = send_handle()</v>
163
<v>SendHandleStats = [stats()]</v>
164
<v>Counter = tcp_stats_counter()</v>
165
<v>CounterStats = integer()</v>
166
<v>stats() = {tcp_stats_counter(), integer()}</v>
167
<v>tcp_stats_counter() = medGwyGatewayNumInMessages | medGwyGatewayNumInOctets | medGwyGatewayNumOutMessages | medGwyGatewayNumOutOctets | medGwyGatewayNumErrors</v>
168
<v>Reason = term()</v>
171
<p>Retreive the TCP related (SNMP) statistics counters.</p>
175
<name>reset_stats() -> void()</name>
176
<name>reset_stats(SendHandle) -> void()</name>
177
<fsummary></fsummary>
179
<v>SendHandle = send_handle()</v>
182
<p>Reset all TCP related (SNMP) statistics counters.</p>