aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/networking/streams/stream_manager.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2013-10-11 15:32:10 +0200
committerMartin Willi <martin@revosec.ch>2014-06-04 15:53:00 +0200
commitaa5b49c0377604472ed65122bbba9299d49665a9 (patch)
tree8b31aa61337a13bfacb34ec9275eed469764f62d /src/libstrongswan/networking/streams/stream_manager.c
parent93f78d82256fd50623048dcb262b147cad85b902 (diff)
downloadstrongswan-aa5b49c0377604472ed65122bbba9299d49665a9.tar.bz2
strongswan-aa5b49c0377604472ed65122bbba9299d49665a9.tar.xz
stream: Separate TCP/Unix stream helpers from stream/service implementations
This allows us to disable Unix sockets cleanly on Windows. Replaces some read/write calls with recv/send counterparts, as Winsock does not like read/writes.
Diffstat (limited to 'src/libstrongswan/networking/streams/stream_manager.c')
-rw-r--r--src/libstrongswan/networking/streams/stream_manager.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/libstrongswan/networking/streams/stream_manager.c b/src/libstrongswan/networking/streams/stream_manager.c
index 2cbd6127e..8de243daa 100644
--- a/src/libstrongswan/networking/streams/stream_manager.c
+++ b/src/libstrongswan/networking/streams/stream_manager.c
@@ -15,6 +15,13 @@
#include "stream_manager.h"
+#include "stream_tcp.h"
+#include "stream_service_tcp.h"
+#ifndef WIN32
+# include "stream_unix.h"
+# include "stream_service_unix.h"
+#endif
+
#include <threading/rwlock.h>
typedef struct private_stream_manager_t private_stream_manager_t;
@@ -193,10 +200,12 @@ METHOD(stream_manager_t, remove_service, void,
METHOD(stream_manager_t, destroy, void,
private_stream_manager_t *this)
{
- remove_stream(this, stream_create_unix);
remove_stream(this, stream_create_tcp);
- remove_service(this, stream_service_create_unix);
remove_service(this, stream_service_create_tcp);
+#ifndef WIN32
+ remove_stream(this, stream_create_unix);
+ remove_service(this, stream_service_create_unix);
+#endif
this->streams->destroy(this->streams);
this->services->destroy(this->services);
@@ -226,10 +235,12 @@ stream_manager_t *stream_manager_create()
.lock = rwlock_create(RWLOCK_TYPE_DEFAULT),
);
- add_stream(this, "unix://", stream_create_unix);
add_stream(this, "tcp://", stream_create_tcp);
- add_service(this, "unix://", stream_service_create_unix);
add_service(this, "tcp://", stream_service_create_tcp);
+#ifndef WIN32
+ add_stream(this, "unix://", stream_create_unix);
+ add_service(this, "unix://", stream_service_create_unix);
+#endif
return &this->public;
}