]> granicus.if.org Git - neomutt/commitdiff
doxy: comment remaining connection functions
authorRichard Russon <rich@flatcap.org>
Sat, 29 Sep 2018 21:44:21 +0000 (22:44 +0100)
committerRichard Russon <rich@flatcap.org>
Sat, 29 Sep 2018 21:44:21 +0000 (22:44 +0100)
conn/conn_raw.c
conn/connection.h
conn/sasl.c
conn/ssl.c
conn/ssl_gnutls.c
conn/tunnel.c

index 05324d77fbf10ab732ff7c979fcc51447dbac0d0..325561798bee4ac89b8b352ed59341ea3c06e832 100644 (file)
@@ -262,12 +262,12 @@ int raw_socket_open(struct Connection *conn)
 /**
  * raw_socket_read - Read data from a socket - Implements Connection::conn_read()
  */
-int raw_socket_read(struct Connection *conn, char *buf, size_t len)
+int raw_socket_read(struct Connection *conn, char *buf, size_t count)
 {
   int rc;
 
   mutt_sig_allow_interrupt(1);
-  rc = read(conn->fd, buf, len);
+  rc = read(conn->fd, buf, count);
   if (rc == -1)
   {
     mutt_error(_("Error talking to %s (%s)"), conn->account.host, strerror(errno));
index c412325277da1d224d1d79d9bbe1f0cdadeace80..e397ef5bbc1b22d8681ad34748f6f8f65c9c1119 100644 (file)
@@ -57,18 +57,18 @@ struct Connection
   int (*conn_open) (struct Connection *conn);
   /**
    * conn_read - Read from a socket Connection
-   * @param conn Connection to a server
-   * @param buf Buffer to store the data
-   * @param len Number of bytes to read
+   * @param conn  Connection to a server
+   * @param buf   Buffer to store the data
+   * @param count Number of bytes to read
    * @retval >0 Success, number of bytes read
    * @retval -1 Error, see errno
    */
-  int (*conn_read) (struct Connection *conn, char *buf, size_t len);
+  int (*conn_read) (struct Connection *conn, char *buf, size_t count);
   /**
    * conn_write - Write to a socket Connection
-   * @param conn Connection to a server
-   * @param buf  Buffer to read into
-   * @param len  Number of bytes to read
+   * @param conn  Connection to a server
+   * @param buf   Buffer to read into
+   * @param count Number of bytes to read
    * @retval >0 Success, number of bytes written
    * @retval -1 Error, see errno
    */
index 32209f1afc23e8c1bf670a59a4ab8d8bc720a2f5..e241d9bcb0b5660120a96393a19afa676bdb3599 100644 (file)
@@ -320,10 +320,7 @@ static sasl_callback_t *mutt_sasl_get_callbacks(struct ConnAccount *account)
 }
 
 /**
- * mutt_sasl_conn_open - empty wrapper for underlying open function
- * @param conn Connection to the server
- * @retval  0 Success
- * @retval -1 Error
+ * mutt_sasl_conn_open - empty wrapper for underlying open function - Implements Connection::conn_open()
  *
  * We don't know in advance that a connection will use SASL, so we replace
  * conn's methods with sasl methods when authentication is successful, using
@@ -340,10 +337,7 @@ static int mutt_sasl_conn_open(struct Connection *conn)
 }
 
 /**
- * mutt_sasl_conn_close - close SASL connection
- * @param conn Connection to a server
- * @retval  0 Success
- * @retval -1 Error
+ * mutt_sasl_conn_close - close SASL connection - Implements Connection::conn_close()
  *
  * Calls underlying close function and disposes of the sasl_conn_t object, then
  * restores connection to pre-sasl state
@@ -371,14 +365,9 @@ static int mutt_sasl_conn_close(struct Connection *conn)
 }
 
 /**
- * mutt_sasl_conn_read - Read data from an SASL connection
- * @param conn   Connection to a server
- * @param buf    Buffer to store the data
- * @param buflen Number of bytes to read
- * @retval >0 Success, number of bytes read
- * @retval -1 Error, see errno
+ * mutt_sasl_conn_read - Read data from an SASL connection - Implements Connection::conn_read()
  */
-static int mutt_sasl_conn_read(struct Connection *conn, char *buf, size_t buflen)
+static int mutt_sasl_conn_read(struct Connection *conn, char *buf, size_t count)
 {
   int rc;
   unsigned int olen;
@@ -388,8 +377,8 @@ static int mutt_sasl_conn_read(struct Connection *conn, char *buf, size_t buflen
   /* if we still have data in our read buffer, copy it into buf */
   if (sasldata->blen > sasldata->bpos)
   {
-    olen = (sasldata->blen - sasldata->bpos > buflen) ?
-               buflen :
+    olen = (sasldata->blen - sasldata->bpos > count) ?
+               count :
                sasldata->blen - sasldata->bpos;
 
     memcpy(buf, sasldata->buf + sasldata->bpos, olen);
@@ -409,7 +398,7 @@ static int mutt_sasl_conn_read(struct Connection *conn, char *buf, size_t buflen
     do
     {
       /* call the underlying read function to fill the buffer */
-      rc = (sasldata->msasl_read)(conn, buf, buflen);
+      rc = (sasldata->msasl_read)(conn, buf, count);
       if (rc <= 0)
         goto out;
 
@@ -421,8 +410,8 @@ static int mutt_sasl_conn_read(struct Connection *conn, char *buf, size_t buflen
       }
     } while (sasldata->blen == 0);
 
-    olen = (sasldata->blen - sasldata->bpos > buflen) ?
-               buflen :
+    olen = (sasldata->blen - sasldata->bpos > count) ?
+               count :
                sasldata->blen - sasldata->bpos;
 
     memcpy(buf, sasldata->buf, olen);
@@ -431,7 +420,7 @@ static int mutt_sasl_conn_read(struct Connection *conn, char *buf, size_t buflen
     rc = olen;
   }
   else
-    rc = (sasldata->msasl_read)(conn, buf, buflen);
+    rc = (sasldata->msasl_read)(conn, buf, count);
 
 out:
   conn->sockdata = sasldata;
@@ -440,14 +429,9 @@ out:
 }
 
 /**
- * mutt_sasl_conn_write - Write to an SASL connection
- * @param conn   Connection to a server
- * @param buf    Buffer to store the data
- * @param buflen Number of bytes to read
- * @retval >0 Success, number of bytes read
- * @retval -1 Error, see errno
+ * mutt_sasl_conn_write - Write to an SASL connection - Implements Connection::conn_write()
  */
-static int mutt_sasl_conn_write(struct Connection *conn, const char *buf, size_t buflen)
+static int mutt_sasl_conn_write(struct Connection *conn, const char *buf, size_t count)
 {
   int rc;
   const char *pbuf = NULL;
@@ -462,7 +446,7 @@ static int mutt_sasl_conn_write(struct Connection *conn, const char *buf, size_t
     /* handle data larger than MAXOUTBUF */
     do
     {
-      olen = (buflen > *sasldata->pbufsize) ? *sasldata->pbufsize : buflen;
+      olen = (count > *sasldata->pbufsize) ? *sasldata->pbufsize : count;
 
       rc = sasl_encode(sasldata->saslconn, buf, olen, &pbuf, &plen);
       if (rc != SASL_OK)
@@ -475,14 +459,14 @@ static int mutt_sasl_conn_write(struct Connection *conn, const char *buf, size_t
       if (rc != plen)
         goto fail;
 
-      buflen -= olen;
+      count -= olen;
       buf += olen;
-    } while (buflen > *sasldata->pbufsize);
+    } while (count > *sasldata->pbufsize);
   }
   else
   {
     /* just write using the underlying socket function */
-    rc = (sasldata->msasl_write)(conn, buf, buflen);
+    rc = (sasldata->msasl_write)(conn, buf, count);
   }
 
   conn->sockdata = sasldata;
@@ -495,12 +479,7 @@ fail:
 }
 
 /**
- * mutt_sasl_conn_poll - Check an SASL connection for data
- * @param conn Connection to a server
- * @param wait_secs How long to wait for a response
- * @retval >0 There is data to read
- * @retval  0 Read would block
- * @retval -1 Connection doesn't support polling
+ * mutt_sasl_conn_poll - Check an SASL connection for data - Implements Connection::conn_poll()
  */
 static int mutt_sasl_conn_poll(struct Connection *conn, time_t wait_secs)
 {
index 338bed8e35063c32ea5ddcd52e7bd18b3e199fc5..b33fa5a7fd3c5cc8c5a22fa309fadb2f1b034418 100644 (file)
@@ -362,8 +362,7 @@ static int ssl_passwd_cb(char *buf, int buflen, int rwflag, void *userdata)
 }
 
 /**
- * ssl_socket_open_err - Error callback for opening an SSL connection
- * @param conn Connection to a server
+ * ssl_socket_open_err - Error callback for opening an SSL connection - Implements Connection::conn_open()
  * @retval -1 Always
  */
 static int ssl_socket_open_err(struct Connection *conn)
@@ -625,10 +624,7 @@ static void ssl_get_client_cert(struct SslSockData *ssldata, struct Connection *
 }
 
 /**
- * ssl_socket_close_and_restore - Close an SSL Connection and restore Connnection callbacks
- * @param conn Connection to a server
- * @retval  0 Success
- * @retval -1 Error, see errno
+ * ssl_socket_close_and_restore - Close an SSL Connection and restore Connnection callbacks - Implements Connection::conn_close()
  */
 static int ssl_socket_close_and_restore(struct Connection *conn)
 {
@@ -1338,12 +1334,12 @@ static int ssl_socket_open(struct Connection *conn)
 /**
  * ssl_socket_read - Read data from an SSL socket - Implements Connection::conn_read()
  */
-static int ssl_socket_read(struct Connection *conn, char *buf, size_t len)
+static int ssl_socket_read(struct Connection *conn, char *buf, size_t count)
 {
   struct SslSockData *data = conn->sockdata;
   int rc;
 
-  rc = SSL_read(data->ssl, buf, len);
+  rc = SSL_read(data->ssl, buf, count);
   if (rc <= 0 || errno == EINTR)
   {
     if (errno == EINTR)
@@ -1360,12 +1356,12 @@ static int ssl_socket_read(struct Connection *conn, char *buf, size_t len)
 /**
  * ssl_socket_write - Write data to an SSL socket - Implements Connection::conn_write()
  */
-static int ssl_socket_write(struct Connection *conn, const char *buf, size_t len)
+static int ssl_socket_write(struct Connection *conn, const char *buf, size_t count)
 {
   struct SslSockData *data = conn->sockdata;
   int rc;
 
-  rc = SSL_write(data->ssl, buf, len);
+  rc = SSL_write(data->ssl, buf, count);
   if (rc <= 0 || errno == EINTR)
   {
     if (errno == EINTR)
index 42ccb811b68bfe11745a20ba360a40ccb4560315..dfbb615579e17083221902f7e7f11f329bc50066 100644 (file)
@@ -99,10 +99,7 @@ static int tls_init(void)
 }
 
 /**
- * tls_starttls_close - Close a TLS connection
- * @param conn Connection to a server
- * @retval  0 Success
- * @retval -1 Error, see errno
+ * tls_starttls_close - Close a TLS connection - Implements Connection::conn_close()
  */
 static int tls_starttls_close(struct Connection *conn)
 {
@@ -1157,7 +1154,7 @@ static int tls_socket_open(struct Connection *conn)
 /**
  * tls_socket_read - Read data from a TLS socket - Implements Connection::conn_read()
  */
-static int tls_socket_read(struct Connection *conn, char *buf, size_t len)
+static int tls_socket_read(struct Connection *conn, char *buf, size_t count)
 {
   struct TlsSockData *data = conn->sockdata;
   int rc;
@@ -1170,7 +1167,7 @@ static int tls_socket_read(struct Connection *conn, char *buf, size_t len)
 
   do
   {
-    rc = gnutls_record_recv(data->state, buf, len);
+    rc = gnutls_record_recv(data->state, buf, count);
     if ((rc < 0 && gnutls_error_is_fatal(rc) == 1) || rc == GNUTLS_E_INTERRUPTED)
     {
       mutt_error("tls_socket_read (%s)", gnutls_strerror(rc));
@@ -1184,7 +1181,7 @@ static int tls_socket_read(struct Connection *conn, char *buf, size_t len)
 /**
  * tls_socket_write - Write data to a TLS socket - Implements Connection::conn_write()
  */
-static int tls_socket_write(struct Connection *conn, const char *buf, size_t len)
+static int tls_socket_write(struct Connection *conn, const char *buf, size_t count)
 {
   struct TlsSockData *data = conn->sockdata;
   size_t sent = 0;
@@ -1197,7 +1194,7 @@ static int tls_socket_write(struct Connection *conn, const char *buf, size_t len
 
   do
   {
-    const int ret = gnutls_record_send(data->state, buf + sent, len - sent);
+    const int ret = gnutls_record_send(data->state, buf + sent, count - sent);
     if (ret < 0)
     {
       if (gnutls_error_is_fatal(ret) == 1 || ret == GNUTLS_E_INTERRUPTED)
@@ -1208,7 +1205,7 @@ static int tls_socket_write(struct Connection *conn, const char *buf, size_t len
       return ret;
     }
     sent += ret;
-  } while (sent < len);
+  } while (sent < count);
 
   return sent;
 }
index fb15e99cbfc66b71ffcea7c573283be56f5600c6..72ae5b353e584639c69224524c0931a641c5326b 100644 (file)
@@ -134,12 +134,12 @@ static int tunnel_socket_open(struct Connection *conn)
 /**
  * tunnel_socket_read - Read data from a tunnel socket - Implements Connection::conn_read()
  */
-static int tunnel_socket_read(struct Connection *conn, char *buf, size_t len)
+static int tunnel_socket_read(struct Connection *conn, char *buf, size_t count)
 {
   struct TunnelSockData *tunnel = conn->sockdata;
   int rc;
 
-  rc = read(tunnel->readfd, buf, len);
+  rc = read(tunnel->readfd, buf, count);
   if (rc == -1)
   {
     mutt_error(_("Tunnel error talking to %s: %s"), conn->account.host, strerror(errno));
@@ -151,12 +151,12 @@ static int tunnel_socket_read(struct Connection *conn, char *buf, size_t len)
 /**
  * tunnel_socket_write - Write data to a tunnel socket - Implements Connection::conn_write()
  */
-static int tunnel_socket_write(struct Connection *conn, const char *buf, size_t len)
+static int tunnel_socket_write(struct Connection *conn, const char *buf, size_t count)
 {
   struct TunnelSockData *tunnel = conn->sockdata;
   int rc;
 
-  rc = write(tunnel->writefd, buf, len);
+  rc = write(tunnel->writefd, buf, count);
   if (rc == -1)
   {
     mutt_error(_("Tunnel error talking to %s: %s"), conn->account.host, strerror(errno));