apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dr...@apache.org
Subject svn commit: r415705 - in /apr/apr-util/trunk: include/apr_ssl.h include/private/apr_ssl_openssl_private.h include/private/apr_ssl_private.h ssl/apr_ssl.c ssl/apr_ssl_openssl.c ssl/apr_ssl_socket.c test/testssl.c
Date Tue, 20 Jun 2006 15:18:00 GMT
Author: dreid
Date: Tue Jun 20 08:17:59 2006
New Revision: 415705

URL: http://svn.apache.org/viewvc?rev=415705&view=rev
Log:
- remove symbols with '_' as first character
- remove c++ style comments
- protect testssl if not building with ssl
- add a tiny bit more documentation - more to follow

Hopefully these start to address Joe's concerns???

Modified:
    apr/apr-util/trunk/include/apr_ssl.h
    apr/apr-util/trunk/include/private/apr_ssl_openssl_private.h
    apr/apr-util/trunk/include/private/apr_ssl_private.h
    apr/apr-util/trunk/ssl/apr_ssl.c
    apr/apr-util/trunk/ssl/apr_ssl_openssl.c
    apr/apr-util/trunk/ssl/apr_ssl_socket.c
    apr/apr-util/trunk/test/testssl.c

Modified: apr/apr-util/trunk/include/apr_ssl.h
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/include/apr_ssl.h?rev=415705&r1=415704&r2=415705&view=diff
==============================================================================
--- apr/apr-util/trunk/include/apr_ssl.h (original)
+++ apr/apr-util/trunk/include/apr_ssl.h Tue Jun 20 08:17:59 2006
@@ -36,10 +36,16 @@
  * @ingroup APR_Util
  * @{
  */
+
 /**
  * Structure for referencing an ssl "factory"
  */
 typedef struct apr_ssl_factory   apr_ssl_factory_t;
+
+/**
+ * Structure for referencing an ssl socket. These are created
+ * by referncing an apr_ssl_factory.
+ */
 typedef struct apr_ssl_socket    apr_ssl_socket_t;
 
 APU_DECLARE(apr_status_t) apr_ssl_factory_create(apr_ssl_factory_t **,
@@ -75,4 +81,4 @@
 }
 #endif
 
-#endif	/* !APR_DBM_H */
+#endif	/* !APR_SSL_H */

Modified: apr/apr-util/trunk/include/private/apr_ssl_openssl_private.h
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/include/private/apr_ssl_openssl_private.h?rev=415705&r1=415704&r2=415705&view=diff
==============================================================================
--- apr/apr-util/trunk/include/private/apr_ssl_openssl_private.h (original)
+++ apr/apr-util/trunk/include/private/apr_ssl_openssl_private.h Tue Jun 20 08:17:59 2006
@@ -21,12 +21,12 @@
 
 #include <openssl/ssl.h>
 
-struct _apu_ssl_data {
+struct apu_ssl_data {
     SSL_CTX *ctx;
     const EVP_MD *md;
 };
 
-struct _apu_ssl_socket_data {
+struct apu_ssl_socket_data {
     SSL     *ssl;
 };
 

Modified: apr/apr-util/trunk/include/private/apr_ssl_private.h
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/include/private/apr_ssl_private.h?rev=415705&r1=415704&r2=415705&view=diff
==============================================================================
--- apr/apr-util/trunk/include/private/apr_ssl_private.h (original)
+++ apr/apr-util/trunk/include/private/apr_ssl_private.h Tue Jun 20 08:17:59 2006
@@ -31,15 +31,15 @@
 
 /** @internal */
 
-typedef struct _apu_ssl_data        _apu_ssl_data_t;
-typedef struct _apu_ssl_socket_data _apu_ssl_socket_data_t;
+typedef struct apu_ssl_data        apu_ssl_data_t;
+typedef struct apu_ssl_socket_data apu_ssl_socket_data_t;
 
 /**
  * SSL factory structure
  */
 struct apr_ssl_factory {
     apr_pool_t *pool;
-    _apu_ssl_data_t *sslData;
+    apu_ssl_data_t *sslData;
 };
 
 struct apr_ssl_socket {
@@ -47,22 +47,23 @@
     apr_socket_t *plain;
     apr_ssl_factory_t *factory;
     int connected;
-    _apu_ssl_socket_data_t *sslData;
+    apu_ssl_socket_data_t *sslData;
 };
 
 /**
  * The following functions are provided by the implementations of
- * SSL libraries.
+ * SSL libraries. They are internal ONLY and should not be referenced
+ * outside of the apr_ssl code.
  */
 
-apr_status_t _ssl_init(void);
-apr_status_t _ssl_factory_create(apr_ssl_factory_t *, const char *, const char *, const char
*);
-apr_status_t _ssl_socket_create(apr_ssl_socket_t *sslSock, apr_ssl_factory_t *asf);
-apr_status_t _ssl_socket_close(apr_ssl_socket_t *);
-apr_status_t _ssl_connect(apr_ssl_socket_t *);
-apr_status_t _ssl_send(apr_ssl_socket_t *, const char *, apr_size_t *);
-apr_status_t _ssl_socket_recv(apr_ssl_socket_t *, char *, apr_size_t *);
-apr_status_t _ssl_accept(apr_ssl_socket_t *, apr_ssl_socket_t *, apr_pool_t *);
+apr_status_t apu_ssl_init(void);
+apr_status_t apu_ssl_factory_create(apr_ssl_factory_t *, const char *, const char *, const
char *);
+apr_status_t apu_ssl_socket_create(apr_ssl_socket_t *sslSock, apr_ssl_factory_t *asf);
+apr_status_t apu_ssl_socket_close(apr_ssl_socket_t *);
+apr_status_t apu_ssl_connect(apr_ssl_socket_t *);
+apr_status_t apu_ssl_send(apr_ssl_socket_t *, const char *, apr_size_t *);
+apr_status_t apu_ssl_socket_recv(apr_ssl_socket_t *, char *, apr_size_t *);
+apr_status_t apu_ssl_accept(apr_ssl_socket_t *, apr_ssl_socket_t *, apr_pool_t *);
 
 #ifdef __cplusplus
 }

Modified: apr/apr-util/trunk/ssl/apr_ssl.c
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/ssl/apr_ssl.c?rev=415705&r1=415704&r2=415705&view=diff
==============================================================================
--- apr/apr-util/trunk/ssl/apr_ssl.c (original)
+++ apr/apr-util/trunk/ssl/apr_ssl.c Tue Jun 20 08:17:59 2006
@@ -52,17 +52,17 @@
         return ENOMEM;
 
     if (! sslInit) {
-        if (_ssl_init() != APR_SUCCESS)
+        if (apu_ssl_init() != APR_SUCCESS)
             return APR_EGENERAL; /* ?? error code ?? */
         sslInit = 1;
     }
 
     *fact = NULL;
     asf->pool = p;
-    if (_ssl_factory_create(asf, privateKeyFn, certFn, digestType) != APR_SUCCESS)
+    if (apu_ssl_factory_create(asf, privateKeyFn, certFn, digestType) != APR_SUCCESS)
         return -1;
 
-    // should register a cleanup here
+    /* should we register a cleanup here? */
     *fact = asf;
     return APR_SUCCESS;
 }

Modified: apr/apr-util/trunk/ssl/apr_ssl_openssl.c
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/ssl/apr_ssl_openssl.c?rev=415705&r1=415704&r2=415705&view=diff
==============================================================================
--- apr/apr-util/trunk/ssl/apr_ssl_openssl.c (original)
+++ apr/apr-util/trunk/ssl/apr_ssl_openssl.c Tue Jun 20 08:17:59 2006
@@ -35,7 +35,7 @@
 #include "apr_ssl_private.h"
 #include "apr_ssl_openssl_private.h"
 
-apr_status_t _ssl_init(void)
+apr_status_t apu_ssl_init(void)
 {
     CRYPTO_malloc_init();
     SSL_load_error_strings();
@@ -44,12 +44,12 @@
     return APR_SUCCESS;
 }
 
-apr_status_t _ssl_factory_create(apr_ssl_factory_t *asf,
+apr_status_t apu_ssl_factory_create(apr_ssl_factory_t *asf,
                                  const char *privateKeyFn,
                                  const char *certFn,
                                  const char *digestType)
 {
-    _apu_ssl_data_t *sslData = apr_pcalloc(asf->pool, sizeof(*sslData));
+    apu_ssl_data_t *sslData = apr_pcalloc(asf->pool, sizeof(*sslData));
     if (!sslData) {
         return -1;
     }
@@ -61,7 +61,7 @@
                 !SSL_CTX_use_certificate_file(sslData->ctx, certFn, SSL_FILETYPE_PEM)
||
                 !SSL_CTX_check_private_key(sslData->ctx)) {
                 SSL_CTX_free(sslData->ctx);
-                return -1; // code?
+                return -1; /* what code shoudl we return? */
             }
         }
     } else {
@@ -70,20 +70,20 @@
 
     if (digestType) {
         sslData->md = EVP_get_digestbyname(digestType);
-        // we don't care if this fails...
+        /* we don't care if this fails... */
     }
 
     if (!sslData->ctx)
-        return APR_EGENERAL; // what code?
+        return APR_EGENERAL; /* what error code? */
 
     asf->sslData = sslData;
 
     return APR_SUCCESS;
 }
 
-apr_status_t _ssl_socket_create(apr_ssl_socket_t *sslSock, apr_ssl_factory_t *asf)
+apr_status_t apu_ssl_socket_create(apr_ssl_socket_t *sslSock, apr_ssl_factory_t *asf)
 {
-    _apu_ssl_socket_data_t *sslData = apr_pcalloc(sslSock->pool, sizeof(*sslData));
+    apu_ssl_socket_data_t *sslData = apr_pcalloc(sslSock->pool, sizeof(*sslData));
     apr_os_sock_t fd;
 
     if (!sslData || !asf->sslData)
@@ -100,7 +100,7 @@
     return APR_SUCCESS;
 }
 
-apr_status_t _ssl_socket_close(apr_ssl_socket_t *sock)
+apr_status_t apu_ssl_socket_close(apr_ssl_socket_t *sock)
 {
     int sslRv;
     apr_status_t rv;
@@ -118,7 +118,7 @@
     return APR_SUCCESS;
 }
 
-apr_status_t _ssl_connect(apr_ssl_socket_t *sock)
+apr_status_t apu_ssl_connect(apr_ssl_socket_t *sock)
 {
     if (!sock->sslData->ssl)
         return APR_EINVAL;
@@ -130,7 +130,7 @@
     return -1;
 }
 
-apr_status_t _ssl_send(apr_ssl_socket_t *sock, const char *buf, apr_size_t *len)
+apr_status_t apu_ssl_send(apr_ssl_socket_t *sock, const char *buf, apr_size_t *len)
 {
     apr_status_t rv;
     int sslOp;
@@ -143,7 +143,7 @@
     return -1;
 }
 
-apr_status_t _ssl_recv(apr_ssl_socket_t * sock,
+apr_status_t apu_ssl_recv(apr_ssl_socket_t * sock,
                               char *buf, apr_size_t *len)
 {
     int sslOp;
@@ -156,9 +156,9 @@
     return -1;
 }
 
-apr_status_t _ssl_accept(apr_ssl_socket_t *newSock, apr_ssl_socket_t *oldSock, apr_pool_t
*pool)
+apr_status_t apu_ssl_accept(apr_ssl_socket_t *newSock, apr_ssl_socket_t *oldSock, apr_pool_t
*pool)
 {
-    _apu_ssl_socket_data_t *sslData = apr_pcalloc(pool, sizeof(*sslData));
+    apu_ssl_socket_data_t *sslData = apr_pcalloc(pool, sizeof(*sslData));
     apr_os_sock_t fd;
 
     if (!sslData || !oldSock->factory)

Modified: apr/apr-util/trunk/ssl/apr_ssl_socket.c
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/ssl/apr_ssl_socket.c?rev=415705&r1=415704&r2=415705&view=diff
==============================================================================
--- apr/apr-util/trunk/ssl/apr_ssl_socket.c (original)
+++ apr/apr-util/trunk/ssl/apr_ssl_socket.c Tue Jun 20 08:17:59 2006
@@ -62,7 +62,7 @@
     }
     sslSock->pool = thepool;
     sslSock->factory = asf;
-    if (_ssl_socket_create(sslSock, asf) != APR_SUCCESS) {
+    if (apu_ssl_socket_create(sslSock, asf) != APR_SUCCESS) {
         apr_socket_close(plainSock);
         return -1;
     }
@@ -77,7 +77,7 @@
     if (!sock || !sock->sslData)
         return APR_EINVAL;
 
-    if ((rv = _ssl_socket_close(sock)) != APR_SUCCESS)
+    if ((rv = apu_ssl_socket_close(sock)) != APR_SUCCESS)
         return rv;
     return apr_socket_close(sock->plain);
 }
@@ -93,20 +93,20 @@
 
     if ((rv = apr_socket_connect(sock->plain, sa)) != APR_SUCCESS)
         return rv;
-    return _ssl_connect(sock);
+    return apu_ssl_connect(sock);
 }
 
 APU_DECLARE(apr_status_t) apr_ssl_socket_send(apr_ssl_socket_t *sock,
                                               const char *buf,
                                               apr_size_t *len)
 {
-    return _ssl_send(sock, buf, len);
+    return apu_ssl_send(sock, buf, len);
 }
 
 APU_DECLARE(apr_status_t) apr_ssl_socket_recv(apr_ssl_socket_t * sock,
                                               char *buf, apr_size_t *len)
 {
-    return _ssl_recv(sock, buf, len);
+    return apu_ssl_recv(sock, buf, len);
 }
 
 APU_DECLARE(apr_status_t) apr_ssl_socket_bind(apr_ssl_socket_t *sock,
@@ -147,7 +147,7 @@
         return ENOMEM;
     }
     newSSLSock->plain = newSock;
-    if (_ssl_accept(newSSLSock, sock, thepool) != APR_SUCCESS) {
+    if (apu_ssl_accept(newSSLSock, sock, thepool) != APR_SUCCESS) {
         apr_socket_close(newSock);
         return APR_EGENERAL;
     }

Modified: apr/apr-util/trunk/test/testssl.c
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/test/testssl.c?rev=415705&r1=415704&r2=415705&view=diff
==============================================================================
--- apr/apr-util/trunk/test/testssl.c (original)
+++ apr/apr-util/trunk/test/testssl.c Tue Jun 20 08:17:59 2006
@@ -35,6 +35,8 @@
 #include "apr_ssl.h"
 #include "apr_network_io.h"
 
+#include "apu_config.h"
+
 #if APR_HAVE_STDIO_H
 #include <stdio.h>
 #endif
@@ -51,6 +53,8 @@
     apr_sockaddr_t *remoteSA;
     apr_status_t rv;
 
+#ifdef APU_HAVE_SSL
+
     (void) apr_initialize();
     apr_pool_create(&pool, NULL);
     atexit(apr_terminate);
@@ -93,6 +97,8 @@
     }
 
     apr_pool_destroy(pool);
+
+#endif /* APU_HAVE_SSL */
 
     return 0;
 }



Mime
View raw message