[Pkg-telepathy-commits] [libnice] 56/265: pseudotcp: Add methods to query the state of the send and recv buffers
Simon McVittie
smcv at debian.org
Wed May 14 12:04:52 UTC 2014
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian
in repository libnice.
commit eb231e64cc3e72d47ff5d0b5761389725778fab3
Author: Olivier Crête <olivier.crete at collabora.com>
Date: Tue Jan 7 20:28:50 2014 -0500
pseudotcp: Add methods to query the state of the send and recv buffers
---
agent/pseudotcp.c | 23 +++++++++++++++++++++++
agent/pseudotcp.h | 28 ++++++++++++++++++++++++++++
docs/reference/libnice/libnice-sections.txt | 2 ++
3 files changed, 53 insertions(+)
diff --git a/agent/pseudotcp.c b/agent/pseudotcp.c
index 2e8ecc4..39e45ac 100644
--- a/agent/pseudotcp.c
+++ b/agent/pseudotcp.c
@@ -1796,3 +1796,26 @@ resize_receive_buffer (PseudoTcpSocket *self, guint32 new_size)
priv->rcv_wnd = available_space;
}
+gint
+pseudo_tcp_socket_get_available_bytes (PseudoTcpSocket *self)
+{
+ PseudoTcpSocketPrivate *priv = self->priv;
+
+ if (priv->state != TCP_ESTABLISHED) {
+ return -1;
+ }
+
+ return pseudo_tcp_fifo_get_buffered (&priv->rbuf);
+}
+
+gboolean
+pseudo_tcp_socket_can_send (PseudoTcpSocket *self)
+{
+ PseudoTcpSocketPrivate *priv = self->priv;
+
+ if (priv->state != TCP_ESTABLISHED) {
+ return FALSE;
+ }
+
+ return (pseudo_tcp_fifo_get_write_remaining (&priv->sbuf) != 0);
+}
diff --git a/agent/pseudotcp.h b/agent/pseudotcp.h
index f8fa198..f5cd1a9 100644
--- a/agent/pseudotcp.h
+++ b/agent/pseudotcp.h
@@ -412,6 +412,34 @@ gboolean pseudo_tcp_socket_notify_packet(PseudoTcpSocket *self,
*/
void pseudo_tcp_set_debug_level (PseudoTcpDebugLevel level);
+
+/**
+ * pseudo_tcp_socket_get_available_bytes:
+ * @self: The #PseudoTcpSocket object.
+ *
+ * Gets the number of bytes of data in the buffer that can be read without
+ * receiving more packets from the network.
+ *
+ * Returns: The number of bytes or -1 if the connection is not established
+ *
+ * Since: 0.1.5
+ */
+
+gint pseudo_tcp_socket_get_available_bytes (PseudoTcpSocket *self);
+
+/**
+ * pseudo_tcp_socket_can_send:
+ * @self: The #PseudoTcpSocket object.
+ *
+ * Returns if there is space in the send buffer to send any data.
+ *
+ * Returns: %TRUE if data can be sent, %FALSE otherwise
+ *
+ * Since: 0.1.5
+ */
+
+gboolean pseudo_tcp_socket_can_send (PseudoTcpSocket *self);
+
G_END_DECLS
#endif /* _PSEUDOTCP_H */
diff --git a/docs/reference/libnice/libnice-sections.txt b/docs/reference/libnice/libnice-sections.txt
index b13a5ca..bc276ab 100644
--- a/docs/reference/libnice/libnice-sections.txt
+++ b/docs/reference/libnice/libnice-sections.txt
@@ -255,4 +255,6 @@ pseudo_tcp_socket_notify_clock
pseudo_tcp_socket_notify_mtu
pseudo_tcp_socket_notify_packet
pseudo_tcp_set_debug_level
+pseudo_tcp_socket_get_available_bytes
+pseudo_tcp_socket_can_send
</SECTION>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/libnice.git
More information about the Pkg-telepathy-commits
mailing list