diff options
author | Martin Willi <martin@revosec.ch> | 2013-04-12 12:42:14 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2013-05-06 16:10:11 +0200 |
commit | 60babe02364de90737f91c56e16a54692e5cca9c (patch) | |
tree | 8ca6a366afbcd2f81337da1e8b7f2864ff15dbcb /src | |
parent | d947d0d61a595d394b5b35adf3d2a83da11860bb (diff) | |
download | strongswan-60babe02364de90737f91c56e16a54692e5cca9c.tar.bz2 strongswan-60babe02364de90737f91c56e16a54692e5cca9c.tar.xz |
tun_device: add a getter for the underlying file descriptor
Diffstat (limited to 'src')
-rw-r--r-- | src/libstrongswan/networking/tun_device.c | 7 | ||||
-rw-r--r-- | src/libstrongswan/networking/tun_device.h | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/libstrongswan/networking/tun_device.c b/src/libstrongswan/networking/tun_device.c index 691d96c8e..b0be8688e 100644 --- a/src/libstrongswan/networking/tun_device.c +++ b/src/libstrongswan/networking/tun_device.c @@ -192,6 +192,12 @@ METHOD(tun_device_t, get_name, char*, return this->if_name; } +METHOD(tun_device_t, get_fd, int, + private_tun_device_t *this) +{ + return this->tunfd; +} + METHOD(tun_device_t, write_packet, bool, private_tun_device_t *this, chunk_t packet) { @@ -398,6 +404,7 @@ tun_device_t *tun_device_create(const char *name_tmpl) .get_mtu = _get_mtu, .set_mtu = _set_mtu, .get_name = _get_name, + .get_fd = _get_fd, .set_address = _set_address, .up = _up, .destroy = _destroy, diff --git a/src/libstrongswan/networking/tun_device.h b/src/libstrongswan/networking/tun_device.h index b22a5d170..3bdb02a5d 100644 --- a/src/libstrongswan/networking/tun_device.h +++ b/src/libstrongswan/networking/tun_device.h @@ -95,6 +95,13 @@ struct tun_device_t { char *(*get_name)(tun_device_t *this); /** + * Get the underlying tun file descriptor. + * + * @return file descriptor of this tun device + */ + int (*get_fd)(tun_device_t *this); + + /** * Destroy a tun_device_t */ void (*destroy)(tun_device_t *this); |