aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2011-12-24 11:02:57 +0100
committerMartin Willi <martin@revosec.ch>2011-12-24 12:42:25 +0100
commit6b0121642282d3a2006e07aeb26363fc491db5d3 (patch)
tree2d02f93f5947fc444329865a78d8c54e9bb5c3f3 /src
parente86b685da500f58caf1a59dceee0a2c91be275d6 (diff)
downloadstrongswan-6b0121642282d3a2006e07aeb26363fc491db5d3.tar.bz2
strongswan-6b0121642282d3a2006e07aeb26363fc491db5d3.tar.xz
Added a getter for the tls_socket file descriptor
Diffstat (limited to 'src')
-rw-r--r--src/libtls/tls_socket.c7
-rw-r--r--src/libtls/tls_socket.h7
2 files changed, 14 insertions, 0 deletions
diff --git a/src/libtls/tls_socket.c b/src/libtls/tls_socket.c
index 691a8e79f..59fa309d2 100644
--- a/src/libtls/tls_socket.c
+++ b/src/libtls/tls_socket.c
@@ -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 = {
diff --git a/src/libtls/tls_socket.h b/src/libtls/tls_socket.h
index ac714a385..413380716 100644
--- a/src/libtls/tls_socket.h
+++ b/src/libtls/tls_socket.h
@@ -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);