1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">
<erlref>
<header>
<copyright>
<year>2000</year><year>2016</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
</legalnotice>
<title>megaco_tcp</title>
<prepared>Lars Thorsén</prepared>
<responsible>Lars Thorsén</responsible>
<docno></docno>
<approved>Lars Thorsén</approved>
<checked></checked>
<date>2007-06-15</date>
<rev>%VSN%</rev>
<file>megaco_tcp.xml</file>
</header>
<module since="">megaco_tcp</module>
<modulesummary>Interface module to TPKT transport protocol for Megaco/H.248.</modulesummary>
<description>
<p>This module contains the public interface to the TPKT (TCP/IP) version
transport protocol for Megaco/H.248.</p>
</description>
<funcs>
<func>
<name since="">start_transport() -> {ok, TransportRef}</name>
<fsummary></fsummary>
<type>
<v>TransportRef = pid()</v>
</type>
<desc>
<p>This function is used for starting the TCP/IP transport service.
Use exit(TransportRef, Reason) to stop the transport service.</p>
</desc>
</func>
<func>
<name since="">listen(TransportRef, ListenPortSpecList) -> ok</name>
<fsummary></fsummary>
<type>
<v>TransportRef = pid() | regname()</v>
<v>OptionListPerPort = [Option]</v>
<v>Option = {port, integer()} |{options, list()} |{receive_handle, term()}</v>
</type>
<desc>
<p>This function is used for starting new TPKT listening socket
for TCP/IP. The option list contains the socket
definitions.</p>
</desc>
</func>
<func>
<name since="">connect(TransportRef, OptionList) -> {ok, Handle, ControlPid} | {error, Reason}</name>
<fsummary></fsummary>
<type>
<v>TransportRef = pid() | regname()</v>
<v>OptionList = [Option]</v>
<v>Option = {host, Ipaddr} | {port, integer()} |{options, list()} |{receive_handle, term()} |{module, atom()}</v>
<v>Handle = socket_handle()</v>
<v>ControlPid = pid()</v>
<v>Reason = term()</v>
</type>
<desc>
<p>This function is used to open a TPKT connection.</p>
<p>The <c><![CDATA[module]]></c> option makes it possible for the user to provide
their own callback module. The <c><![CDATA[receive_message/4]]></c> or
<c><![CDATA[process_received_message/4]]></c> functions of this module is called
when a new message is received (which one depends on the size of the
message; small - receive_message, large - process_received_message).
Default value is <em>megaco</em>.</p>
</desc>
</func>
<func>
<name since="">close(Handle) -> ok</name>
<fsummary></fsummary>
<type>
<v>Handle = socket_handle()</v>
</type>
<desc>
<p>This function is used for closing an active TPKT connection.</p>
</desc>
</func>
<func>
<name since="">socket(Handle) -> Socket</name>
<fsummary></fsummary>
<type>
<v>Handle = socket_handle()</v>
<v>Socket = inet_socket()</v>
</type>
<desc>
<p>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.</p>
</desc>
</func>
<func>
<name since="">send_message(Handle, Message) -> ok</name>
<fsummary></fsummary>
<type>
<v>Handle = socket_handle()</v>
<v>Message = binary() | iolist()</v>
</type>
<desc>
<p>Sends a message on a connection.</p>
</desc>
</func>
<func>
<name since="">block(Handle) -> ok</name>
<fsummary></fsummary>
<type>
<v>Handle = socket_handle()</v>
</type>
<desc>
<p>Stop receiving incoming messages on the socket.</p>
</desc>
</func>
<func>
<name since="">unblock(Handle) -> ok</name>
<fsummary></fsummary>
<type>
<v>Handle = socket_handle()</v>
</type>
<desc>
<p>Starting to receive incoming messages from the socket again.</p>
<marker id="upgrade_receive_handle"></marker>
</desc>
</func>
<func>
<name since="">upgrade_receive_handle(ControlPid) -> ok</name>
<fsummary></fsummary>
<type>
<v>ControlPid = pid()</v>
</type>
<desc>
<p>Update the receive handle of the control process (e.g. after
having changed protocol version).</p>
<marker id="stats"></marker>
</desc>
</func>
<func>
<name since="">get_stats() -> {ok, TotalStats} | {error, Reason}</name>
<name since="">get_stats(SendHandle) -> {ok, SendHandleStats} | {error, Reason}</name>
<name since="">get_stats(SendHandle, Counter) -> {ok, CounterStats} | {error, Reason}</name>
<fsummary></fsummary>
<type>
<v>TotalStats = [send_handle_stats()]</v>
<v>total_stats() = {send_handle(), [stats()]}</v>
<v>SendHandle = send_handle()</v>
<v>SendHandleStats = [stats()]</v>
<v>Counter = tcp_stats_counter()</v>
<v>CounterStats = integer()</v>
<v>stats() = {tcp_stats_counter(), integer()}</v>
<v>tcp_stats_counter() = medGwyGatewayNumInMessages | medGwyGatewayNumInOctets | medGwyGatewayNumOutMessages | medGwyGatewayNumOutOctets | medGwyGatewayNumErrors</v>
<v>Reason = term()</v>
</type>
<desc>
<p>Retreive the TCP related (SNMP) statistics counters.</p>
</desc>
</func>
<func>
<name since="">reset_stats() -> void()</name>
<name since="">reset_stats(SendHandle) -> void()</name>
<fsummary></fsummary>
<type>
<v>SendHandle = send_handle()</v>
</type>
<desc>
<p>Reset all TCP related (SNMP) statistics counters.</p>
</desc>
</func>
</funcs>
</erlref>
|