Skip to content

Commit 855f3e1

Browse files
committed
TCP core: Add docs for tcp_close_conn() and MI tcp:close
(cherry picked from commit a66a151)
1 parent 985272f commit 855f3e1

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

net/proto_tcp/doc/proto_tcp_admin.xml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,53 @@ socket=tcp:127.0.0.1:5080 # change with the listening IP and port
2727
</para>
2828
</para>
2929

30+
<section id="related_core_tcp_apis" xreflabel="Related Core TCP APIs">
31+
<title>Related Core TCP APIs</title>
32+
33+
<section id="func_tcp_close_conn" xreflabel="tcp_close_conn()">
34+
<title><function moreinfo="none">tcp_close_conn(ipport)</function></title>
35+
<para>
36+
Force-close an existing TCP-based connection. The
37+
<emphasis>ipport</emphasis> argument may be either a TCP connection ID,
38+
as reported by the <emphasis>tcp:list</emphasis> MI command, or a remote
39+
endpoint in the form <emphasis>ip:port</emphasis> or
40+
<emphasis>proto:ip:port</emphasis>. If the protocol is omitted,
41+
OpenSIPS will search all TCP-based transports.
42+
</para>
43+
<para>
44+
The function returns true if a matching connection was scheduled for
45+
closing, false if no connection matched and an error on invalid input
46+
or internal failure.
47+
</para>
48+
<example>
49+
<title>Force-close a TCP connection from script</title>
50+
<programlisting format="linespecific">
51+
...
52+
if (!tcp_close_conn("tcp:10.0.0.10:5060")) {
53+
xlog("No matching TCP connection was found\n");
54+
}
55+
...
56+
</programlisting>
57+
</example>
58+
</section>
59+
60+
<section id="mi_close" xreflabel="tcp:close">
61+
<title><function moreinfo="none">tcp:close</function></title>
62+
<para>
63+
Core MI command equivalent of <xref linkend="func_tcp_close_conn"/>. It
64+
accepts a single <emphasis>ipport</emphasis> parameter using the same
65+
formats described above.
66+
</para>
67+
<example>
68+
<title>Force-close a TCP connection via MI</title>
69+
<programlisting format="linespecific">
70+
$ opensips-cli -x mi tcp:close ipport=tcp:10.0.0.10:5060
71+
OK
72+
</programlisting>
73+
</example>
74+
</section>
75+
</section>
76+
3077
<section>
3178
<title>Dependencies</title>
3279
<section>

0 commit comments

Comments
 (0)