[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] add a tor_tls_is_server method to remember if conn->tls



Update of /home2/or/cvsroot/tor/src/common
In directory moria.mit.edu:/home2/arma/work/onion/cvs/tor/src/common

Modified Files:
	tortls.c tortls.h 
Log Message:
add a tor_tls_is_server method to remember if conn->tls
was an initiator or a receiver


Index: tortls.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/common/tortls.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- tortls.c	28 Feb 2005 02:52:51 -0000	1.88
+++ tortls.c	31 Mar 2005 07:46:38 -0000	1.89
@@ -430,6 +430,15 @@
   return result;
 }
 
+/** Return whether this tls initiated the connect (client) or
+ * received it (server). */
+int
+tor_tls_is_server(tor_tls *tls)
+{
+  tor_assert(tls);
+  return tls->isServer;
+}
+
 /** Release resources associated with a TLS object.  Does not close the
  * underlying file descriptor.
  */

Index: tortls.h
===================================================================
RCS file: /home2/or/cvsroot/tor/src/common/tortls.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- tortls.h	11 Feb 2005 01:41:19 -0000	1.24
+++ tortls.h	31 Mar 2005 07:46:38 -0000	1.25
@@ -28,6 +28,7 @@
 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);