pseudotcp.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  1. /*
  2. * This file is part of the Nice GLib ICE library.
  3. *
  4. * (C) 2010, 2014 Collabora Ltd.
  5. * Contact: Philip Withnall
  6. *
  7. * The contents of this file are subject to the Mozilla Public License Version
  8. * 1.1 (the "License"); you may not use this file except in compliance with
  9. * the License. You may obtain a copy of the License at
  10. * http://www.mozilla.org/MPL/
  11. *
  12. * Software distributed under the License is distributed on an "AS IS" basis,
  13. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  14. * for the specific language governing rights and limitations under the
  15. * License.
  16. *
  17. * The Original Code is the Nice GLib ICE library.
  18. *
  19. * The Initial Developers of the Original Code are Collabora Ltd and Nokia
  20. * Corporation. All Rights Reserved.
  21. *
  22. * Contributors:
  23. * Youness Alaoui, Collabora Ltd.
  24. * Philip Withnall, Collabora Ltd.
  25. *
  26. * Alternatively, the contents of this file may be used under the terms of the
  27. * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
  28. * case the provisions of LGPL are applicable instead of those above. If you
  29. * wish to allow use of your version of this file only under the terms of the
  30. * LGPL and not to allow others to use your version of this file under the
  31. * MPL, indicate your decision by deleting the provisions above and replace
  32. * them with the notice and other provisions required by the LGPL. If you do
  33. * not delete the provisions above, a recipient may use your version of this
  34. * file under either the MPL or the LGPL.
  35. */
  36. #ifndef __LIBNICE_PSEUDOTCP_H__
  37. #define __LIBNICE_PSEUDOTCP_H__
  38. /**
  39. * SECTION:pseudotcp
  40. * @short_description: Pseudo TCP implementation
  41. * @include: pseudotcp.h
  42. * @stability: Stable
  43. *
  44. * The #PseudoTcpSocket is an object implementing a Pseudo Tcp Socket for use
  45. * over UDP.
  46. * The socket will implement a subset of the TCP stack to allow for a reliable
  47. * transport over non-reliable sockets (such as UDP).
  48. *
  49. * See the file tests/test-pseudotcp.c in the source package for an example
  50. * of how to use the object.
  51. *
  52. * Since: 0.0.11
  53. */
  54. #include <glib-object.h>
  55. #ifndef __GTK_DOC_IGNORE__
  56. #ifdef G_OS_WIN32
  57. # include <winsock2.h>
  58. #ifndef ECONNABORTED
  59. # define ECONNABORTED WSAECONNABORTED
  60. #endif
  61. #ifndef ENOTCONN
  62. # define ENOTCONN WSAENOTCONN
  63. #endif
  64. #ifndef EWOULDBLOCK
  65. # define EWOULDBLOCK WSAEWOULDBLOCK
  66. #endif
  67. #ifndef ECONNRESET
  68. # define ECONNRESET WSAECONNRESET
  69. #endif
  70. #ifndef EMSGSIZE
  71. # define EMSGSIZE WSAEMSGSIZE
  72. #endif
  73. #ifndef ETIMEDOUT
  74. # define ETIMEDOUT WSAETIMEDOUT
  75. #endif
  76. #endif
  77. #endif
  78. #include "agent.h"
  79. G_BEGIN_DECLS
  80. /**
  81. * PseudoTcpSocket:
  82. *
  83. * The #PseudoTcpSocket is the GObject implementing the Pseudo TCP Socket
  84. *
  85. * Since: 0.0.11
  86. */
  87. typedef struct _PseudoTcpSocket PseudoTcpSocket;
  88. typedef struct _PseudoTcpSocketClass PseudoTcpSocketClass;
  89. GType pseudo_tcp_socket_get_type (void);
  90. /* TYPE MACROS */
  91. #define PSEUDO_TCP_SOCKET_TYPE \
  92. (pseudo_tcp_socket_get_type ())
  93. #define PSEUDO_TCP_SOCKET(obj) \
  94. (G_TYPE_CHECK_INSTANCE_CAST((obj), PSEUDO_TCP_SOCKET_TYPE, \
  95. PseudoTcpSocket))
  96. #define PSEUDO_TCP_SOCKET_CLASS(klass) \
  97. (G_TYPE_CHECK_CLASS_CAST((klass), PSEUDO_TCP_SOCKET_TYPE, \
  98. PseudoTcpSocketClass))
  99. #define IS_PSEUDO_TCP_SOCKET(obj) \
  100. (G_TYPE_CHECK_INSTANCE_TYPE((obj), PSEUDO_TCP_SOCKET_TYPE))
  101. #define IS_PSEUDO_TCP_SOCKET_CLASS(klass) \
  102. (G_TYPE_CHECK_CLASS_TYPE((klass), PSEUDO_TCP_SOCKET_TYPE))
  103. #define PSEUDOTCP_SOCKET_GET_CLASS(obj) \
  104. (G_TYPE_INSTANCE_GET_CLASS ((obj), PSEUDO_TCP_SOCKET_TYPE, \
  105. PseudoTcpSocketClass))
  106. /**
  107. * PseudoTcpDebugLevel:
  108. * @PSEUDO_TCP_DEBUG_NONE: Disable debug messages
  109. * @PSEUDO_TCP_DEBUG_NORMAL: Enable basic debug messages
  110. * @PSEUDO_TCP_DEBUG_VERBOSE: Enable verbose debug messages
  111. *
  112. * Valid values of debug levels to be set.
  113. *
  114. * Since: 0.0.11
  115. */
  116. typedef enum {
  117. PSEUDO_TCP_DEBUG_NONE = 0,
  118. PSEUDO_TCP_DEBUG_NORMAL,
  119. PSEUDO_TCP_DEBUG_VERBOSE,
  120. } PseudoTcpDebugLevel;
  121. /**
  122. * PseudoTcpState:
  123. * @PSEUDO_TCP_LISTEN: The socket's initial state. The socket isn't connected and is
  124. * listening for an incoming connection
  125. * @PSEUDO_TCP_SYN_SENT: The socket has sent a connection request (SYN) packet and is
  126. * waiting for an answer
  127. * @PSEUDO_TCP_SYN_RECEIVED: The socket has received a connection request (SYN) packet.
  128. * @PSEUDO_TCP_ESTABLISHED: The socket is connected
  129. * @PSEUDO_TCP_CLOSED: The socket has been closed
  130. * @PSEUDO_TCP_FIN_WAIT_1: The socket has been closed locally but not remotely
  131. * (Since: 0.1.8)
  132. * @PSEUDO_TCP_FIN_WAIT_2: The socket has been closed locally but not remotely
  133. * (Since: 0.1.8)
  134. * @PSEUDO_TCP_CLOSING: The socket has been closed locally and remotely
  135. * (Since: 0.1.8)
  136. * @PSEUDO_TCP_TIME_WAIT: The socket has been closed locally and remotely
  137. * (Since: 0.1.8)
  138. * @PSEUDO_TCP_CLOSE_WAIT: The socket has been closed remotely but not locally
  139. * (Since: 0.1.8)
  140. * @PSEUDO_TCP_LAST_ACK: The socket has been closed locally and remotely
  141. * (Since: 0.1.8)
  142. *
  143. * An enum representing the state of the #PseudoTcpSocket. These states
  144. * correspond to the TCP states in RFC 793.
  145. * <para> See also: #PseudoTcpSocket:state </para>
  146. *
  147. * Since: 0.0.11
  148. */
  149. typedef enum {
  150. PSEUDO_TCP_LISTEN,
  151. PSEUDO_TCP_SYN_SENT,
  152. PSEUDO_TCP_SYN_RECEIVED,
  153. PSEUDO_TCP_ESTABLISHED,
  154. PSEUDO_TCP_CLOSED,
  155. PSEUDO_TCP_FIN_WAIT_1,
  156. PSEUDO_TCP_FIN_WAIT_2,
  157. PSEUDO_TCP_CLOSING,
  158. PSEUDO_TCP_TIME_WAIT,
  159. PSEUDO_TCP_CLOSE_WAIT,
  160. PSEUDO_TCP_LAST_ACK,
  161. } PseudoTcpState;
  162. /**
  163. * PseudoTcpWriteResult:
  164. * @WR_SUCCESS: The write operation was successful
  165. * @WR_TOO_LARGE: The socket type requires that message be sent atomically
  166. * and the size of the message to be sent made this impossible.
  167. * @WR_FAIL: There was an error sending the message
  168. *
  169. * An enum representing the result value of the write operation requested by
  170. * the #PseudoTcpSocket.
  171. * <para> See also: %PseudoTcpCallbacks:WritePacket </para>
  172. *
  173. * Since: 0.0.11
  174. */
  175. typedef enum {
  176. WR_SUCCESS,
  177. WR_TOO_LARGE,
  178. WR_FAIL
  179. } PseudoTcpWriteResult;
  180. /**
  181. * PseudoTcpShutdown:
  182. * @PSEUDO_TCP_SHUTDOWN_RD: Shut down the local reader only
  183. * @PSEUDO_TCP_SHUTDOWN_WR: Shut down the local writer only
  184. * @PSEUDO_TCP_SHUTDOWN_RDWR: Shut down both reading and writing
  185. *
  186. * Options for which parts of a connection to shut down when calling
  187. * pseudo_tcp_socket_shutdown(). These correspond to the values passed to POSIX
  188. * shutdown().
  189. *
  190. * Since: 0.1.8
  191. */
  192. typedef enum {
  193. PSEUDO_TCP_SHUTDOWN_RD,
  194. PSEUDO_TCP_SHUTDOWN_WR,
  195. PSEUDO_TCP_SHUTDOWN_RDWR,
  196. } PseudoTcpShutdown;
  197. /**
  198. * PseudoTcpCallbacks:
  199. * @user_data: A user defined pointer to be passed to the callbacks
  200. * @PseudoTcpOpened: The #PseudoTcpSocket is now connected
  201. * @PseudoTcpReadable: The socket is readable
  202. * @PseudoTcpWritable: The socket is writable
  203. * @PseudoTcpClosed: The socket was closed (both sides)
  204. * @WritePacket: This callback is called when the socket needs to send data.
  205. *
  206. * A structure containing callbacks functions that will be called by the
  207. * #PseudoTcpSocket when some events happen.
  208. * <para> See also: #PseudoTcpWriteResult </para>
  209. *
  210. * Since: 0.0.11
  211. */
  212. typedef struct {
  213. gpointer user_data;
  214. void (*PseudoTcpOpened) (PseudoTcpSocket *tcp, gpointer data);
  215. void (*PseudoTcpReadable) (PseudoTcpSocket *tcp, gpointer data);
  216. void (*PseudoTcpWritable) (PseudoTcpSocket *tcp, gpointer data);
  217. void (*PseudoTcpClosed) (PseudoTcpSocket *tcp, guint32 error, gpointer data);
  218. PseudoTcpWriteResult (*WritePacket) (PseudoTcpSocket *tcp,
  219. const gchar * buffer, guint32 len, gpointer data);
  220. } PseudoTcpCallbacks;
  221. /**
  222. * pseudo_tcp_socket_new:
  223. * @conversation: The conversation id for the socket.
  224. * @callbacks: A pointer to the #PseudoTcpCallbacks structure for getting
  225. * notified of the #PseudoTcpSocket events.
  226. *
  227. * Creates a new #PseudoTcpSocket for the specified conversation
  228. *
  229. <note>
  230. <para>
  231. The @callbacks must be non-NULL, in order to get notified of packets the
  232. socket needs to send.
  233. </para>
  234. <para>
  235. If the @callbacks structure was dynamicly allocated, it can be freed
  236. after the call @pseudo_tcp_socket_new
  237. </para>
  238. </note>
  239. *
  240. * Returns: The new #PseudoTcpSocket object, %NULL on error
  241. *
  242. * Since: 0.0.11
  243. */
  244. PseudoTcpSocket *pseudo_tcp_socket_new (guint32 conversation,
  245. PseudoTcpCallbacks *callbacks);
  246. /**
  247. * pseudo_tcp_socket_connect:
  248. * @self: The #PseudoTcpSocket object.
  249. *
  250. * Connects the #PseudoTcpSocket to the peer with the same conversation id.
  251. * The connection will only be successful after the
  252. * %PseudoTcpCallbacks:PseudoTcpOpened callback is called
  253. *
  254. * Returns: %TRUE on success, %FALSE on failure (not in %TCP_LISTEN state)
  255. * <para> See also: pseudo_tcp_socket_get_error() </para>
  256. *
  257. * Since: 0.0.11
  258. */
  259. gboolean pseudo_tcp_socket_connect(PseudoTcpSocket *self);
  260. /**
  261. * pseudo_tcp_socket_recv:
  262. * @self: The #PseudoTcpSocket object.
  263. * @buffer: The buffer to fill with received data
  264. * @len: The length of @buffer
  265. *
  266. * Receive data from the socket.
  267. *
  268. <note>
  269. <para>
  270. Only call this on the %PseudoTcpCallbacks:PseudoTcpReadable callback.
  271. </para>
  272. <para>
  273. This function should be called in a loop. If this function does not
  274. return -1 with EWOULDBLOCK as the error, the
  275. %PseudoTcpCallbacks:PseudoTcpReadable callback will not be called again.
  276. </para>
  277. </note>
  278. *
  279. * Returns: The number of bytes received or -1 in case of error
  280. * <para> See also: pseudo_tcp_socket_get_error() </para>
  281. *
  282. * Since: 0.0.11
  283. */
  284. gint pseudo_tcp_socket_recv(PseudoTcpSocket *self, char * buffer, size_t len);
  285. /**
  286. * pseudo_tcp_socket_send:
  287. * @self: The #PseudoTcpSocket object.
  288. * @buffer: The buffer with data to send
  289. * @len: The length of @buffer
  290. *
  291. * Send data on the socket.
  292. *
  293. <note>
  294. <para>
  295. If this function return -1 with EWOULDBLOCK as the error, or if the return
  296. value is lower than @len, then the %PseudoTcpCallbacks:PseudoTcpWritable
  297. callback will be called when the socket will become writable.
  298. </para>
  299. </note>
  300. *
  301. * Returns: The number of bytes sent or -1 in case of error
  302. * <para> See also: pseudo_tcp_socket_get_error() </para>
  303. *
  304. * Since: 0.0.11
  305. */
  306. gint pseudo_tcp_socket_send(PseudoTcpSocket *self, const char * buffer,
  307. guint32 len);
  308. /**
  309. * pseudo_tcp_socket_close:
  310. * @self: The #PseudoTcpSocket object.
  311. * @force: %TRUE to close the socket forcefully, %FALSE to close it gracefully
  312. *
  313. * Close the socket for sending. If @force is set to %FALSE, the socket will
  314. * finish sending pending data before closing. If it is set to %TRUE, the socket
  315. * will discard pending data and close the connection immediately (sending a TCP
  316. * RST segment).
  317. *
  318. * The socket will be closed in both directions – sending and receiving – and
  319. * any pending received data must be read before calling this function, by
  320. * calling pseudo_tcp_socket_recv() until it blocks. If any pending data is in
  321. * the receive buffer when pseudo_tcp_socket_close() is called, a TCP RST
  322. * segment will be sent to the peer to notify it of the data loss.
  323. *
  324. <note>
  325. <para>
  326. The %PseudoTcpCallbacks:PseudoTcpClosed callback will not be called once
  327. the socket gets closed. It is only used for aborted connection.
  328. Instead, the socket gets closed when the pseudo_tcp_socket_get_next_clock()
  329. function returns FALSE.
  330. </para>
  331. </note>
  332. *
  333. * <para> See also: pseudo_tcp_socket_get_next_clock() </para>
  334. *
  335. * Since: 0.0.11
  336. */
  337. void pseudo_tcp_socket_close(PseudoTcpSocket *self, gboolean force);
  338. /**
  339. * pseudo_tcp_socket_shutdown:
  340. * @self: The #PseudoTcpSocket object.
  341. * @how: The directions of the connection to shut down.
  342. *
  343. * Shut down sending, receiving, or both on the socket, depending on the value
  344. * of @how. The behaviour of pseudo_tcp_socket_send() and
  345. * pseudo_tcp_socket_recv() will immediately change after this function returns
  346. * (depending on the value of @how), though the socket may continue to process
  347. * network traffic in the background even if sending or receiving data is
  348. * forbidden.
  349. *
  350. * This is equivalent to the POSIX shutdown() function. Setting @how to
  351. * %PSEUDO_TCP_SHUTDOWN_RDWR is equivalent to calling pseudo_tcp_socket_close().
  352. *
  353. * Since: 0.1.8
  354. */
  355. void pseudo_tcp_socket_shutdown (PseudoTcpSocket *self, PseudoTcpShutdown how);
  356. /**
  357. * pseudo_tcp_socket_get_error:
  358. * @self: The #PseudoTcpSocket object.
  359. *
  360. * Return the last encountered error.
  361. *
  362. <note>
  363. <para>
  364. The return value can be :
  365. <para>
  366. EINVAL (for pseudo_tcp_socket_connect()).
  367. </para>
  368. <para>
  369. EWOULDBLOCK or ENOTCONN (for pseudo_tcp_socket_recv() and
  370. pseudo_tcp_socket_send()).
  371. </para>
  372. </para>
  373. </note>
  374. *
  375. * Returns: The error code
  376. * <para> See also: pseudo_tcp_socket_connect() </para>
  377. * <para> See also: pseudo_tcp_socket_recv() </para>
  378. * <para> See also: pseudo_tcp_socket_send() </para>
  379. *
  380. * Since: 0.0.11
  381. */
  382. int pseudo_tcp_socket_get_error(PseudoTcpSocket *self);
  383. /**
  384. * pseudo_tcp_socket_get_next_clock:
  385. * @self: The #PseudoTcpSocket object.
  386. * @timeout: A pointer to be filled with the new timeout.
  387. *
  388. * Call this to determine the timeout needed before the next time call
  389. * to pseudo_tcp_socket_notify_clock() should be made.
  390. *
  391. * Returns: %TRUE if @timeout was filled, %FALSE if the socket is closed and
  392. * ready to be destroyed.
  393. *
  394. * <para> See also: pseudo_tcp_socket_notify_clock() </para>
  395. *
  396. * Since: 0.0.11
  397. */
  398. gboolean pseudo_tcp_socket_get_next_clock(PseudoTcpSocket *self,
  399. guint64 *timeout);
  400. /**
  401. * pseudo_tcp_socket_notify_clock:
  402. * @self: The #PseudoTcpSocket object.
  403. *
  404. * Start the processing of receiving data, pending data or syn/acks.
  405. * Call this based on timeout value returned by
  406. * pseudo_tcp_socket_get_next_clock().
  407. * It's ok to call this too frequently.
  408. *
  409. * <para> See also: pseudo_tcp_socket_get_next_clock() </para>
  410. *
  411. * Since: 0.0.11
  412. */
  413. void pseudo_tcp_socket_notify_clock(PseudoTcpSocket *self);
  414. /**
  415. * pseudo_tcp_socket_notify_mtu:
  416. * @self: The #PseudoTcpSocket object.
  417. * @mtu: The new MTU of the socket
  418. *
  419. * Set the MTU of the socket
  420. *
  421. * Since: 0.0.11
  422. */
  423. void pseudo_tcp_socket_notify_mtu(PseudoTcpSocket *self, guint16 mtu);
  424. /**
  425. * pseudo_tcp_socket_notify_packet:
  426. * @self: The #PseudoTcpSocket object.
  427. * @buffer: The buffer containing the received data
  428. * @len: The length of @buffer
  429. *
  430. * Notify the #PseudoTcpSocket when a new packet arrives
  431. *
  432. * Returns: %TRUE if the packet was processed successfully, %FALSE otherwise
  433. *
  434. * Since: 0.0.11
  435. */
  436. gboolean pseudo_tcp_socket_notify_packet(PseudoTcpSocket *self,
  437. const gchar * buffer, guint32 len);
  438. /**
  439. * pseudo_tcp_socket_notify_message:
  440. * @self: The #PseudoTcpSocket object.
  441. * @message: A #NiceInputMessage containing the received data.
  442. *
  443. * Notify the #PseudoTcpSocket that a new message has arrived, and enqueue the
  444. * data in its buffers to the #PseudoTcpSocket’s receive buffer.
  445. *
  446. * Returns: %TRUE if the packet was processed successfully, %FALSE otherwise
  447. *
  448. * Since: 0.1.5
  449. */
  450. gboolean pseudo_tcp_socket_notify_message (PseudoTcpSocket *self,
  451. NiceInputMessage *message);
  452. /**
  453. * pseudo_tcp_set_debug_level:
  454. * @level: The level of debug to set
  455. *
  456. * Sets the debug level to enable/disable normal/verbose debug messages.
  457. *
  458. * Since: 0.0.11
  459. */
  460. void pseudo_tcp_set_debug_level (PseudoTcpDebugLevel level);
  461. /**
  462. * pseudo_tcp_socket_get_available_bytes:
  463. * @self: The #PseudoTcpSocket object.
  464. *
  465. * Gets the number of bytes of data in the buffer that can be read without
  466. * receiving more packets from the network.
  467. *
  468. * Returns: The number of bytes or -1 if the connection is not established
  469. *
  470. * Since: 0.1.5
  471. */
  472. gint pseudo_tcp_socket_get_available_bytes (PseudoTcpSocket *self);
  473. /**
  474. * pseudo_tcp_socket_can_send:
  475. * @self: The #PseudoTcpSocket object.
  476. *
  477. * Returns if there is space in the send buffer to send any data.
  478. *
  479. * Returns: %TRUE if data can be sent, %FALSE otherwise
  480. *
  481. * Since: 0.1.5
  482. */
  483. gboolean pseudo_tcp_socket_can_send (PseudoTcpSocket *self);
  484. /**
  485. * pseudo_tcp_socket_get_available_send_space:
  486. * @self: The #PseudoTcpSocket object.
  487. *
  488. * Gets the number of bytes of space available in the transmission buffer.
  489. *
  490. * Returns: The number of bytes, or 0 if the connection is not established.
  491. *
  492. * Since: 0.1.5
  493. */
  494. gsize pseudo_tcp_socket_get_available_send_space (PseudoTcpSocket *self);
  495. /**
  496. * pseudo_tcp_socket_set_time:
  497. * @self: The #PseudoTcpSocket object.
  498. * @current_time: Current monotonic time, in milliseconds; or zero to use the
  499. * system monotonic clock.
  500. *
  501. * Sets the current monotonic time to be used by the TCP socket when calculating
  502. * timeouts and expiry times. If this function is not called, or is called with
  503. * @current_time as zero, g_get_monotonic_time() will be used. Otherwise, the
  504. * specified @current_time will be used until it is updated by calling this
  505. * function again.
  506. *
  507. * This function is intended for testing only, and should not be used in
  508. * production code.
  509. *
  510. * Since: 0.1.8
  511. */
  512. void pseudo_tcp_socket_set_time (PseudoTcpSocket *self, guint32 current_time);
  513. /**
  514. * pseudo_tcp_socket_is_closed:
  515. * @self: The #PseudoTcpSocket object.
  516. *
  517. * Gets whether the socket is closed, with the shutdown handshake completed,
  518. * and both peers no longer able to read or write data to the connection.
  519. *
  520. * Returns: %TRUE if the socket is closed in both directions, %FALSE otherwise
  521. * Since: 0.1.8
  522. */
  523. gboolean pseudo_tcp_socket_is_closed (PseudoTcpSocket *self);
  524. /**
  525. * pseudo_tcp_socket_is_closed_remotely:
  526. * @self: The #PseudoTcpSocket object.
  527. *
  528. * Gets whether the socket has been closed on the remote peer’s side of the
  529. * connection (i.e. whether pseudo_tcp_socket_close() has been called there).
  530. * This is guaranteed to return %TRUE if pseudo_tcp_socket_is_closed() returns
  531. * %TRUE. It will not return %TRUE after pseudo_tcp_socket_close() is called
  532. * until a FIN segment is received from the remote peer.
  533. *
  534. * Returns: %TRUE if the remote peer has closed its side of the connection,
  535. * %FALSE otherwise
  536. * Since: 0.1.8
  537. */
  538. gboolean pseudo_tcp_socket_is_closed_remotely (PseudoTcpSocket *self);
  539. G_END_DECLS
  540. #endif /* __LIBNICE_PSEUDOTCP_H__ */