Added a getter for the tls_socket file descriptor
authorMartin Willi <martin@revosec.ch>
Sat, 24 Dec 2011 10:02:57 +0000 (11:02 +0100)
committerMartin Willi <martin@revosec.ch>
Sat, 24 Dec 2011 11:42:25 +0000 (12:42 +0100)
src/libtls/tls_socket.c
src/libtls/tls_socket.h

index 691a8e7..59fa309 100644 (file)
@@ -175,6 +175,12 @@ METHOD(tls_socket_t, write_, bool,
        return FALSE;
 }
 
+METHOD(tls_socket_t, get_fd, int,
+       private_tls_socket_t *this)
+{
+       return this->fd;
+}
+
 METHOD(tls_socket_t, destroy, void,
        private_tls_socket_t *this)
 {
@@ -195,6 +201,7 @@ tls_socket_t *tls_socket_create(bool is_server, identification_t *server,
                .public = {
                        .read = _read_,
                        .write = _write_,
+                       .get_fd = _get_fd,
                        .destroy = _destroy,
                },
                .app = {
index ac714a3..4133807 100644 (file)
@@ -55,6 +55,13 @@ struct tls_socket_t {
        bool (*write)(tls_socket_t *this, chunk_t data);
 
        /**
+        * Get the underlying file descriptor passed to the constructor.
+        *
+        * @return                      file descriptor
+        */
+       int (*get_fd)(tls_socket_t *this);
+
+       /**
         * Destroy a tls_socket_t.
         */
        void (*destroy)(tls_socket_t *this);