[or-cvs] Make doxygen marginally happier

Nick Mathewson nickm at seul.org
Thu Oct 6 04:33:42 UTC 2005


Update of /home/or/cvsroot/tor/src/common
In directory moria:/tmp/cvs-serv30951/src/common

Modified Files:
	compat.c compat.h container.c crypto.c crypto.h tortls.c 
	tortls.h util.h 
Log Message:
Make doxygen marginally happier

Index: compat.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/compat.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -d -r1.71 -r1.72
--- compat.c	5 Oct 2005 22:04:45 -0000	1.71
+++ compat.c	6 Oct 2005 04:33:40 -0000	1.72
@@ -776,6 +776,9 @@
  */
 
 #if defined(USE_PTHREADS)
+/** Wraps a an int (*)(void*) function and its argument so we can
+ * invoke them in a way pthreads would expect.
+ */
 typedef struct tor_pthread_data_t {
   int (*func)(void *);
   void *data;
@@ -961,6 +964,7 @@
 #endif
 
 #ifdef USE_WIN32_THREADS
+/** A generic lock structure for multithreaded builds. */
 struct tor_mutex_t {
   HANDLE handle;
 };
@@ -1010,6 +1014,7 @@
   return (unsigned long)GetCurrentThreadId();
 }
 #elif defined(USE_PTHREADS)
+/** A generic lock structure for multithreaded builds. */
 struct tor_mutex_t {
   pthread_mutex_t mutex;
 };
@@ -1050,6 +1055,7 @@
   return r.id;
 }
 #else
+/** A generic lock structure for multithreaded builds. */
 struct tor_mutex_t {
   int _unused;
 };

Index: compat.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/compat.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- compat.h	14 Sep 2005 23:27:52 -0000	1.36
+++ compat.h	6 Oct 2005 04:33:40 -0000	1.37
@@ -236,6 +236,7 @@
 
 /* Because we use threads instead of processes on Windows, we need locking on
  * Windows.  On Unixy platforms, these functions are no-ops. */
+
 typedef struct tor_mutex_t tor_mutex_t;
 #ifdef TOR_IS_MULTITHREADED
 tor_mutex_t *tor_mutex_new(void);

Index: container.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/container.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- container.c	30 Sep 2005 20:47:58 -0000	1.43
+++ container.c	6 Oct 2005 04:33:40 -0000	1.44
@@ -29,8 +29,9 @@
 #define SMARTLIST_DEFAULT_CAPACITY 32
 
 #ifndef FAST_SMARTLIST
+/** A resizeable list of pointers, with associated helpful functionality. */
 struct smartlist_t {
-  /** <b>list</b> has enough capacity to store exactly <b>capacity</b> elements
+  /* <b>list</b> has enough capacity to store exactly <b>capacity</b> elements
    * before it needs to be resized.  Only the first <b>num_used</b> (\<=
    * capacity) elements point to valid data.
    */
@@ -484,14 +485,14 @@
   smartlist_sort(sl, _compare_string_ptrs);
 }
 
-/** Splay-tree implementation of string-to-void* map
- */
+/** A node in a strmap_t string-to-void* map. */
 typedef struct strmap_entry_t {
   SPLAY_ENTRY(strmap_entry_t) node;
   char *key;
   void *val;
 } strmap_entry_t;
 
+/** Splay-tree implementation of string-to-void* map */
 struct strmap_t {
   SPLAY_HEAD(strmap_tree, strmap_entry_t) head;
 };

Index: crypto.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/crypto.c,v
retrieving revision 1.161
retrieving revision 1.162
diff -u -d -r1.161 -r1.162
--- crypto.c	3 Oct 2005 21:10:35 -0000	1.161
+++ crypto.c	6 Oct 2005 04:33:40 -0000	1.162
@@ -91,18 +91,22 @@
 static int _n_openssl_mutexes = -1;
 #endif
 
+/** A public key, or a public/private keypair. */
 struct crypto_pk_env_t
 {
   int refs; /* reference counting so we don't have to copy keys */
   RSA *key;
 };
 
+/** Key and stream information for a stream cipher. */
 struct crypto_cipher_env_t
 {
   char key[CIPHER_KEY_LEN];
   aes_cnt_cipher_t *cipher;
 };
 
+/** A structure to hold the first half (x, g^x) of a Diffie-Hellman handshake
+ * while we're waiting for the second.*/
 struct crypto_dh_env_t {
   DH *dh;
 };
@@ -1220,6 +1224,7 @@
   return (SHA1((const unsigned char*)m,len,(unsigned char*)digest) == NULL);
 }
 
+/** Intermediate information about the digest of a stream of data. */
 struct crypto_digest_env_t {
   SHA_CTX d;
 };

Index: crypto.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/crypto.h,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- crypto.h	18 Sep 2005 02:18:59 -0000	1.66
+++ crypto.h	6 Oct 2005 04:33:40 -0000	1.67
@@ -24,7 +24,8 @@
 /** Length of our DH keys. */
 #define DH_BYTES (1024/8)
 
-/* DOCDOC */
+/** Length of a message digest when encoded in base64 with trailing = signs
+ * removed. */
 #define BASE64_DIGEST_LEN 27
 
 /** Constants used to indicate no padding for public-key encryption */

Index: tortls.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/tortls.c,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -d -r1.104 -r1.105
--- tortls.c	30 Sep 2005 20:47:58 -0000	1.104
+++ tortls.c	6 Oct 2005 04:33:40 -0000	1.105
@@ -35,15 +35,16 @@
 /** How long do identity certificates live? (sec) */
 #define IDENTITY_CERT_LIFETIME  (365*24*60*60)
 
-typedef struct tor_tls_context_st {
+/* DOCDOC */
+typedef struct tor_tls_context_t {
   SSL_CTX *ctx;
   SSL_CTX *client_only_ctx;
-} tor_tls_context;
+} tor_tls_context_t;
 
 /** Holds a SSL object and its associated data.  Members are only
  * accessed from within tortls.c.
  */
-struct tor_tls_st {
+struct tor_tls_t {
   SSL *ssl; /**< An OpenSSL SSL object. */
   int socket; /**< The underlying file descriptor for this TLS connection. */
   enum {
@@ -63,7 +64,7 @@
 
 /** Global tls context. We keep it here because nobody else needs to
  * touch it. */
-static tor_tls_context *global_tls_context = NULL;
+static tor_tls_context_t *global_tls_context = NULL;
 /** True iff tor_tls_init() has been called. */
 static int tls_library_is_initialized = 0;
 
@@ -111,7 +112,7 @@
  * current action as <b>doing</b>.
  */
 static int
-tor_tls_get_error(tor_tls *tls, int r, int extra,
+tor_tls_get_error(tor_tls_t *tls, int r, int extra,
                   const char *doing, int severity)
 {
   int err = SSL_get_error(tls->ssl, r);
@@ -308,7 +309,7 @@
   crypto_pk_env_t *rsa = NULL;
   crypto_dh_env_t *dh = NULL;
   EVP_PKEY *pkey = NULL;
-  tor_tls_context *result = NULL;
+  tor_tls_context_t *result = NULL;
   X509 *cert = NULL, *idcert = NULL;
   char nn2[128];
   int client_only;
@@ -337,7 +338,7 @@
     }
   }
 
-  result = tor_malloc(sizeof(tor_tls_context));
+  result = tor_malloc(sizeof(tor_tls_context_t));
   result->ctx = result->client_only_ctx = NULL;
   for (client_only=0; client_only <= 1; ++client_only) {
     ctx = client_only ? &result->client_only_ctx : &result->ctx;
@@ -419,10 +420,10 @@
 /** Create a new TLS object from a file descriptor, and a flag to
  * determine whether it is functioning as a server.
  */
-tor_tls *
+tor_tls_t *
 tor_tls_new(int sock, int isServer, int use_no_cert)
 {
-  tor_tls *result = tor_malloc(sizeof(tor_tls));
+  tor_tls_t *result = tor_malloc(sizeof(tor_tls_t));
   SSL_CTX *ctx;
   tor_assert(global_tls_context); /* make sure somebody made it first */
   ctx = use_no_cert ? global_tls_context->client_only_ctx
@@ -445,7 +446,7 @@
 /** Return whether this tls initiated the connect (client) or
  * received it (server). */
 int
-tor_tls_is_server(tor_tls *tls)
+tor_tls_is_server(tor_tls_t *tls)
 {
   tor_assert(tls);
   return tls->isServer;
@@ -455,7 +456,7 @@
  * underlying file descriptor.
  */
 void
-tor_tls_free(tor_tls *tls)
+tor_tls_free(tor_tls_t *tls)
 {
   tor_assert(tls && tls->ssl);
   SSL_free(tls->ssl);
@@ -469,7 +470,7 @@
  * TOR_TLS_CLOSE, TOR_TLS_WANTREAD, or TOR_TLS_WANTWRITE.
  */
 int
-tor_tls_read(tor_tls *tls, char *cp, size_t len)
+tor_tls_read(tor_tls_t *tls, char *cp, size_t len)
 {
   int r, err;
   tor_assert(tls);
@@ -496,7 +497,7 @@
  * TOR_TLS_WANTREAD, or TOR_TLS_WANTWRITE.
  */
 int
-tor_tls_write(tor_tls *tls, char *cp, size_t n)
+tor_tls_write(tor_tls_t *tls, char *cp, size_t n)
 {
   int r, err;
   tor_assert(tls);
@@ -528,7 +529,7 @@
  * or TOR_TLS_WANTWRITE.
  */
 int
-tor_tls_handshake(tor_tls *tls)
+tor_tls_handshake(tor_tls_t *tls)
 {
   int r;
   tor_assert(tls);
@@ -556,7 +557,7 @@
  * or TOR_TLS_WANTWRITE.
  */
 int
-tor_tls_shutdown(tor_tls *tls)
+tor_tls_shutdown(tor_tls_t *tls)
 {
   int r, err;
   char buf[128];
@@ -616,7 +617,7 @@
 /** Return true iff this TLS connection is authenticated.
  */
 int
-tor_tls_peer_has_cert(tor_tls *tls)
+tor_tls_peer_has_cert(tor_tls_t *tls)
 {
   X509 *cert;
   cert = SSL_get_peer_certificate(tls->ssl);
@@ -633,7 +634,7 @@
  * NUL-terminate.  Return 0 on success, -1 on failure.
  */
 int
-tor_tls_get_peer_cert_nickname(tor_tls *tls, char *buf, size_t buflen)
+tor_tls_get_peer_cert_nickname(tor_tls_t *tls, char *buf, size_t buflen)
 {
   X509 *cert = NULL;
   X509_NAME *name = NULL;
@@ -726,7 +727,7 @@
  * 0.  Else, return -1.
  */
 int
-tor_tls_verify(tor_tls *tls, crypto_pk_env_t **identity_key)
+tor_tls_verify(tor_tls_t *tls, crypto_pk_env_t **identity_key)
 {
   X509 *cert = NULL, *id_cert = NULL;
   STACK_OF(X509) *chain = NULL;
@@ -795,7 +796,7 @@
  * NOTE: you should call tor_tls_verify before tor_tls_check_lifetime.
  */
 int
-tor_tls_check_lifetime(tor_tls *tls, int tolerance)
+tor_tls_check_lifetime(tor_tls_t *tls, int tolerance)
 {
   time_t now, t;
   X509 *cert;
@@ -830,7 +831,7 @@
 /** Return the number of bytes available for reading from <b>tls</b>.
  */
 int
-tor_tls_get_pending_bytes(tor_tls *tls)
+tor_tls_get_pending_bytes(tor_tls_t *tls)
 {
   tor_assert(tls);
 #if OPENSSL_VERSION_NUMBER < 0x0090700fl
@@ -845,14 +846,14 @@
 
 /** Return the number of bytes read across the underlying socket. */
 unsigned long
-tor_tls_get_n_bytes_read(tor_tls *tls)
+tor_tls_get_n_bytes_read(tor_tls_t *tls)
 {
   tor_assert(tls);
   return BIO_number_read(SSL_get_rbio(tls->ssl));
 }
 /** Return the number of bytes written across the underlying socket. */
 unsigned long
-tor_tls_get_n_bytes_written(tor_tls *tls)
+tor_tls_get_n_bytes_written(tor_tls_t *tls)
 {
   tor_assert(tls);
   return BIO_number_written(SSL_get_wbio(tls->ssl));

Index: tortls.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/tortls.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- tortls.h	9 Jun 2005 19:03:31 -0000	1.29
+++ tortls.h	6 Oct 2005 04:33:40 -0000	1.30
@@ -16,7 +16,7 @@
 #include "../common/compat.h"
 
 /* Opaque structure to hold a TLS connection. */
-typedef struct tor_tls_st tor_tls;
+typedef struct tor_tls_t tor_tls_t;
 
 /* Possible return values for most tor_tls_* functions. */
 #define TOR_TLS_ERROR       -4
@@ -28,21 +28,21 @@
 void tor_tls_free_all(void);
 int tor_tls_context_new(crypto_pk_env_t *rsa, int isServer,
                         const char *nickname, unsigned int key_lifetime);
-tor_tls *tor_tls_new(int sock, int is_server, int use_no_cert);
-int tor_tls_is_server(tor_tls *tls);
-void tor_tls_free(tor_tls *tls);
-int tor_tls_peer_has_cert(tor_tls *tls);
-int tor_tls_get_peer_cert_nickname(tor_tls *tls, char *buf, size_t buflen);
-int tor_tls_verify(tor_tls *tls, crypto_pk_env_t **identity);
-int tor_tls_check_lifetime(tor_tls *tls, int tolerance);
-int tor_tls_read(tor_tls *tls, char *cp, size_t len);
-int tor_tls_write(tor_tls *tls, char *cp, size_t n);
-int tor_tls_handshake(tor_tls *tls);
-int tor_tls_shutdown(tor_tls *tls);
-int tor_tls_get_pending_bytes(tor_tls *tls);
+tor_tls_t *tor_tls_new(int sock, int is_server, int use_no_cert);
+int tor_tls_is_server(tor_tls_t *tls);
+void tor_tls_free(tor_tls_t *tls);
+int tor_tls_peer_has_cert(tor_tls_t *tls);
+int tor_tls_get_peer_cert_nickname(tor_tls_t *tls, char *buf, size_t buflen);
+int tor_tls_verify(tor_tls_t *tls, crypto_pk_env_t **identity);
+int tor_tls_check_lifetime(tor_tls_t *tls, int tolerance);
+int tor_tls_read(tor_tls_t *tls, char *cp, size_t len);
+int tor_tls_write(tor_tls_t *tls, char *cp, size_t n);
+int tor_tls_handshake(tor_tls_t *tls);
+int tor_tls_shutdown(tor_tls_t *tls);
+int tor_tls_get_pending_bytes(tor_tls_t *tls);
 
-unsigned long tor_tls_get_n_bytes_read(tor_tls *tls);
-unsigned long tor_tls_get_n_bytes_written(tor_tls *tls);
+unsigned long tor_tls_get_n_bytes_read(tor_tls_t *tls);
+unsigned long tor_tls_get_n_bytes_written(tor_tls_t *tls);
 
 /* Log and abort if there are unhandled TLS errors in OpenSSL's error stack.
  */

Index: util.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/util.h,v
retrieving revision 1.142
retrieving revision 1.143
diff -u -d -r1.142 -r1.143
--- util.h	3 Oct 2005 20:20:38 -0000	1.142
+++ util.h	6 Oct 2005 04:33:40 -0000	1.143
@@ -140,6 +140,8 @@
 int write_str_to_file(const char *fname, const char *str, int bin);
 int write_bytes_to_file(const char *fname, const char *str, size_t len,
                         int bin);
+/** An ad-hoc type to hold a string of characters and a count; used by
+ * write_chunks_to_file. */
 typedef struct sized_chunk_t {
   const char *bytes;
   size_t len;



More information about the tor-commits mailing list