Commit 053ec4f8 authored by Juha Kallioinen's avatar Juha Kallioinen

Merge pull request #28 from kaltsi/proxy-plugin

[ssu] separate connman dependency to a plugin library
parents a90d96e3 cbf74eee
include(libssunetworkproxy_dependencies.pri)
LIBS *= -ldl
TARGET = ssunetworkproxy
include(../ssulibrary.pri)
HEADERS = ssunetworkproxy.h
SOURCES = ssunetworkproxy.cpp
CONFIG += link_pkgconfig plugin
QT += network
PKGCONFIG += connman-qt5
/**
* @file ssunetworkproxy.cpp
* @copyright 2014 Jolla Ltd.
* @author Juha Kallioinen <juha.kallioinen@jolla.com>
* @date 2014
*/
#include <connman-qt5/connmannetworkproxyfactory.h>
extern "C" void initialize()
{
QNetworkProxyFactory::setApplicationProxyFactory(new ConnmanNetworkProxyFactory);
}
/**
* @file ssunetworkproxy.h
* @copyright 2014 Jolla Ltd.
* @author Juha Kallioinen <juha.kallioinen@jolla.com>
* @date 2014
*/
#ifndef _LibSsuNetworkProxy_H
#define _LibSsuNetworkProxy_H
#include <dlfcn.h>
/**
* Set application proxy if the required library is found, otherwise
* do nothing.
*/
inline void set_application_proxy_factory()
{
void *proxylib = dlopen("libssunetworkproxy.so", RTLD_LAZY);
if (proxylib) {
typedef void (*ssuproxyinit_t)();
dlerror();
ssuproxyinit_t proxy_init = (ssuproxyinit_t) dlsym(proxylib, "initialize");
const char *dlsym_err = dlerror();
if (!dlsym_err) {
proxy_init();
}
dlclose(proxylib);
}
}
#endif
......@@ -10,7 +10,7 @@
#include <QLocale>
#include <QLibraryInfo>
#include <QTimer>
#include <connman-qt5/connmannetworkproxyfactory.h>
#include "libssunetworkproxy/ssunetworkproxy.h"
#include "rndssucli.h"
int main(int argc, char** argv){
......@@ -24,7 +24,7 @@ int main(int argc, char** argv){
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
app.installTranslator(&qtTranslator);
QNetworkProxyFactory::setApplicationProxyFactory(new ConnmanNetworkProxyFactory);
set_application_proxy_factory();
RndSsuCli mw;
QTimer::singleShot(0, &mw, SLOT(run()));
......
......@@ -4,7 +4,6 @@ include(rndssucli_dependencies.pri)
QT += network dbus
CONFIG += link_pkgconfig
PKGCONFIG += connman-qt5
HEADERS = rndssucli.h \
ssuproxy.h
......
include(../libssu/libssu.pri)
include(../libssunetworkproxy/libssunetworkproxy.pri)
......@@ -23,6 +23,7 @@ Requires(pre): shadow-utils
Requires(pre): /usr/bin/groupadd-user
Requires(postun): shadow-utils
Requires: ssu-vendor-data
Requires: ssu-network-proxy
%description
%{summary}.
......@@ -32,7 +33,7 @@ Requires: ssu-vendor-data
%{_libdir}/zypp/plugins/urlresolver/*
%{_bindir}/rndssu
%{_bindir}/ssu
%{_libdir}/*.so.*
%{_libdir}/libssu.so.*
%dir %{_sysconfdir}/zypp/credentials.d
# ssu itself does not use the package-update triggers, but provides
# them for the vendor data packages to use
......@@ -41,6 +42,18 @@ Requires: ssu-vendor-data
%{_datadir}/dbus-1/system-services/*.service
%{_sysconfdir}/dbus-1/system.d/*.conf
%package network-proxy-plugin
Summary: Network Proxy support for ssu
Group: System/Base
Provides: ssu-network-proxy
%description network-proxy-plugin
%{summary}.
%files network-proxy-plugin
%defattr(-,root,root,-)
%{_libdir}/libssunetworkproxy.so
%package vendor-data-example
Summary: Sample vendor configuration data
Group: System/Base
......
......@@ -3,7 +3,7 @@ contains(QT_VERSION, ^4\\.[0-7]\\..*) {
}
TEMPLATE = subdirs
SUBDIRS = libssu ssud
SUBDIRS = libssu libssunetworkproxy ssud
SUBDIRS += rndssucli ssuurlresolver ssuks
ssuconfhack {
......@@ -41,4 +41,4 @@ system(qdbusxml2cpp \
system(qdbusxml2cpp \
-c SsuProxy \
-p rndssucli/ssuproxy.h:rndssucli/ssuproxy.cpp \
dbus/org.nemo.ssu.xml)
\ No newline at end of file
dbus/org.nemo.ssu.xml)
......@@ -9,7 +9,7 @@
#include <QTranslator>
#include <QLocale>
#include <QLibraryInfo>
#include <connman-qt5/connmannetworkproxyfactory.h>
#include "libssunetworkproxy/ssunetworkproxy.h"
#include "ssud.h"
int main(int argc, char** argv){
......@@ -23,7 +23,7 @@ int main(int argc, char** argv){
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
app.installTranslator(&qtTranslator);
QNetworkProxyFactory::setApplicationProxyFactory(new ConnmanNetworkProxyFactory);
set_application_proxy_factory();
Ssud ssud;
......
......@@ -4,7 +4,6 @@ include(ssud_dependencies.pri)
QT += network dbus
CONFIG += link_pkgconfig
PKGCONFIG += connman-qt5
HEADERS = ssuadaptor.h \
ssud.h
......@@ -20,4 +19,4 @@ service.path = /usr/share/dbus-1/system-services/
conf.files = ../dbus/$${DBUS_SERVICE_NAME}.conf
conf.path = /etc/dbus-1/system.d/
INSTALLS += service conf
\ No newline at end of file
INSTALLS += service conf
include(../libssu/libssu.pri)
include(../libssunetworkproxy/libssunetworkproxy.pri)
......@@ -10,7 +10,7 @@
#include <QLocale>
#include <QLibraryInfo>
#include <QTimer>
#include <connman-qt5/connmannetworkproxyfactory.h>
#include "libssunetworkproxy/ssunetworkproxy.h"
#include "ssuurlresolver.h"
int main(int argc, char** argv){
......@@ -24,7 +24,7 @@ int main(int argc, char** argv){
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
app.installTranslator(&qtTranslator);
QNetworkProxyFactory::setApplicationProxyFactory(new ConnmanNetworkProxyFactory);
set_application_proxy_factory();
SsuUrlResolver mw;
QTimer::singleShot(0, &mw, SLOT(run()));
......
......@@ -8,7 +8,6 @@ target.path = /usr/lib/zypp/plugins/urlresolver
QT += network
CONFIG += link_pkgconfig
PKGCONFIG += connman-qt5
HEADERS = ssuurlresolver.h
SOURCES = main.cpp \
......
include(../libssu/libssu.pri)
include(../libssunetworkproxy/libssunetworkproxy.pri)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment