0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 04:02:15 +02:00

Added clilib:

* scripts to build ovpncli shared library for C++ clients
* test client test/clilib/test.cpp
This commit is contained in:
James Yonan 2012-05-23 13:50:41 +00:00
parent ce9820fed5
commit ce1431f3c2
5 changed files with 56 additions and 4 deletions

View File

@ -385,6 +385,7 @@ namespace openvpn {
#endif
// external PKI
#if !defined(USE_APPLE_SSL)
if (state->eval.externalPki)
{
if (!state->external_pki_alias.empty())
@ -413,6 +414,7 @@ namespace openvpn {
return ret;
}
}
#endif
// build client options object
ClientOptions::Ptr client_options = new ClientOptions(state->options, cc);

View File

@ -1,5 +1,5 @@
// API for OpenVPN Client, intended to be wrapped by swig.
// Use ovpncli.i to wrap the API.
// API for OpenVPN Client, may be used standalone or wrapped by swig.
// Use ovpncli.i to wrap the API for swig.
// The crux of the API is defined in OpenVPNClient (below)
// and TunBuilderBase.
@ -135,10 +135,10 @@ namespace openvpn {
struct ExternalPKIRequestBase {
ExternalPKIRequestBase() : error(false), invalidAlias(false) {}
bool error; // true if error occurred
bool error; // true if error occurred
std::string errorText; // text describing error
bool invalidAlias; // true if the error is caused by an invalid alias
std::string alias; // the alias string, used to query cert/key
std::string alias; // the alias string, used to query cert/key
};
// used to query for External PKI certificate

18
clilib/build-linux Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -e
g++ -O3 -fPIC -pthread \
-Wall -Wno-sign-compare -Wno-unused-parameter \
-fvisibility=hidden \
-DUSE_OPENSSL \
-I$OVPN3_DIR/client \
-I$OVPN3_DIR \
-I$BOOST_DIR \
-L$BOOST_DIR/stage/lib \
$OVPN3_DIR/client/ovpncli.cpp \
-shared \
-o libovpncli.so \
-lcrypto -lssl \
-lboost_system -lboost_thread
strip libovpncli.so

22
clilib/build-mac Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
set -e
clang++ -O4 -dynamic -pthread \
-Wall -Wno-tautological-compare \
-fvisibility=hidden \
-DBOOST_ASIO_DISABLE_KQUEUE \
-DUSE_APPLE_SSL \
-I$OVPN3_DIR/client \
-I$OVPN3_DIR \
-I$BOOST_DIR \
-L$BOOST_DIR/stage/lib \
$OVPN3_DIR/client/ovpncli.cpp \
-shared \
-Wl,-current_version,1.0 \
-Wl,-compatibility_version,1.0 \
-o libovpncli.dylib \
-framework Security \
-framework CoreFoundation \
-lboost_system -lboost_thread
strip -x -S libovpncli.dylib

10
clilib/make-dist Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e
rm -rf dist
mkdir dist
mkdir -p dist/include/ovpncli
mkdir dist/lib
cp libovpncli.* dist/lib/
cp ../openvpn/tun/builder/base.hpp dist/include/ovpncli/tunbuilderbase.hpp
cp ../openvpn/pki/epkibase.hpp dist/include/ovpncli/epkibase.hpp
sed 's#<openvpn/tun/builder/base\.hpp>#"tunbuilderbase.hpp"#g' <../client/ovpncli.hpp | sed 's#<openvpn/pki/epkibase\.hpp>#"epkibase.hpp"#g' >dist/include/ovpncli/ovpncli.hpp