Browse Source

Adding autostart and install

master
David Lanzendörfer 9 months ago
parent
commit
c43fe02ef2
11 changed files with 115 additions and 203 deletions
  1. +41
    -4
      CMakeLists.txt
  2. +6
    -0
      pep-client.cpp
  3. +11
    -73
      pep-client.h
  4. +0
    -116
      pep-server-glue.h
  5. +3
    -0
      security.pep.service.in
  6. +13
    -0
      tests.cpp
  7. +17
    -7
      types/CMakeLists.txt
  8. +8
    -1
      types/pEpDBusMessage.cpp
  9. +5
    -1
      types/pEpDBusMessage.h
  10. +7
    -1
      types/pEpDBusStatus.cpp
  11. +4
    -0
      types/pEpDBusStatus.h

+ 41
- 4
CMakeLists.txt View File

@ -1,15 +1,52 @@
project(pEpDBusAdapter)
include_directories(${PROJECT_SOURCE_DIR}/types)
add_subdirectory(types)
add_custom_command(
OUTPUT pep-server-glue.h
COMMAND /usr/bin/dbusxx-xml2cpp ${CMAKE_CURRENT_SOURCE_DIR}/pep-introspect.xml --adaptor=pep-server-glue.h
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/pep-introspect.xml
PRE_BUILD
VERBATIM
)
add_custom_command(
OUTPUT pep-client-glue.h
COMMAND /usr/bin/dbusxx-xml2cpp ${CMAKE_CURRENT_SOURCE_DIR}/pep-introspect.xml --proxy=pep-client-glue.h
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/pep-introspect.xml
PRE_BUILD
VERBATIM
)
add_library(pEpDBusAdapterClient SHARED pep-client.cpp)
target_link_libraries(pEpDBusAdapterClient
pEpDBusAdapterTypes
)
set_target_properties(pEpDBusAdapterClient PROPERTIES
CXX_VISIBILITY_PRESET default
VISIBILITY_INLINES_HIDDEN 0
)
add_library(pEpDBusAdapterServer SHARED pep-server.cpp)
target_link_libraries(pEpDBusAdapterServer
pEpDBusAdapterTypes
)
set_target_properties(pEpDBusAdapterServer PROPERTIES
CXX_VISIBILITY_PRESET default
VISIBILITY_INLINES_HIDDEN 0)
CXX_VISIBILITY_PRESET default
VISIBILITY_INLINES_HIDDEN 0
)
add_executable(pep-dbus-server server.cpp)
target_link_libraries(pep-dbus-server pEpDBusAdapterServer dbus-c++-1)
add_executable(tests tests.cpp)
target_link_libraries(tests pEpDBusAdapterClient dbus-c++-1)
configure_file(security.pep.service.in ${CMAKE_CURRENT_BINARY_DIR}/security.pep.service)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/security.pep.service
DESTINATION ${KDE_INSTALL_DBUSSERVICEDIR})
add_executable(server server.cpp)
target_link_libraries(server pEpDBusAdapterServer dbus-c++-1)
install(TARGETS pep-dbus-server pEpDBusAdapterServer pEpDBusAdapterClient pEpDBusAdapterTypes)

+ 6
- 0
pep-client.cpp View File

@ -0,0 +1,6 @@
#include <pep-client.h>
pEpClient::pEpClient(DBus::Connection &connection, const char *path, const char *name) : DBus::ObjectProxy(connection, path, name)
{
}

+ 11
- 73
pep-client.h View File

@ -1,80 +1,18 @@
#ifndef PEP_DBUS_CLIENT_H
#define PEP_DBUS_CLIENT_H
/*
* This file was automatically generated by dbusxx-xml2cpp; DO NOT EDIT!
*/
#include <pep-client-glue.h>
#ifndef __dbusxx__pep_client_h__PROXY_MARSHAL_H
#define __dbusxx__pep_client_h__PROXY_MARSHAL_H
#include <dbus-c++/dbus.h>
#include <cassert>
#include "pEpDBusMessage.h"
#include "pEpDBusStringList.h"
#include "pEpDBusRating.h"
#include "pEpDBusEncryptionFlags.h"
#include "pEpDBusStatus.h"
#include "pEpDBusMessage.h"
namespace security {
class pep_proxy
: public ::DBus::InterfaceProxy
class pEpClient :
public security::pep_proxy,
public DBus::IntrospectableProxy,
public DBus::ObjectProxy
{
public:
pEpClient(DBus::Connection &connection, const char *path, const char *name);
void decryptMessage(const pEpDBusMessage& src, const pEpDBusStringList& keylist, const pEpDBusRating& rating,
const pEpDBusEncryptionFlags& flags, pEpDBusStatus& status, pEpDBusMessage& dst);
pep_proxy()
: ::DBus::InterfaceProxy("security.pep")
{
}
public:
/* properties exported by this interface */
public:
/* methods exported by this interface,
* this functions will invoke the corresponding methods on the remote objects
*/
void decryptMessage(const pEpDBusMessage& src, const pEpDBusStringList& keylist, const pEpDBusRating& rating, const pEpDBusEncryptionFlags& flags, pEpDBusStatus& status, pEpDBusMessage& dst)
{
::DBus::CallMessage call;
::DBus::MessageIter wi = call.writer();
::DBus::Variant _src;
_src << src;
wi << _src;
::DBus::Variant _keylist;
_keylist << keylist;
wi << _keylist;
::DBus::Variant _rating;
_rating << rating;
wi << _rating;
::DBus::Variant _flags;
_flags << flags;
wi << _flags;
call.member("decryptMessage");
::DBus::Message ret = invoke_method (call);
::DBus::MessageIter ri = ret.reader();
::DBus::Variant _status;
ri >> _status;
status << _status;
::DBus::Variant _dst;
ri >> _dst;
dst << _dst;
}
public:
/* signal handlers for this interface
*/
private:
/* unmarshalers (to unpack the DBus message before calling the actual signal handler)
*/
};
}
#endif //__dbusxx__pep_client_h__PROXY_MARSHAL_H
#endif

+ 0
- 116
pep-server-glue.h View File

@ -1,116 +0,0 @@
/*
* This file was automatically generated by dbusxx-xml2cpp; DO NOT EDIT!
*/
#ifndef __dbusxx__pep_server_glue_h__ADAPTOR_MARSHAL_H
#define __dbusxx__pep_server_glue_h__ADAPTOR_MARSHAL_H
#include <dbus-c++/dbus.h>
#include <cassert>
#include "pEpDBusMessage.h"
#include "pEpDBusStringList.h"
#include "pEpDBusRating.h"
#include "pEpDBusEncryptionFlags.h"
#include "pEpDBusStatus.h"
#include "pEpDBusMessage.h"
namespace security {
class pep_adaptor
: public ::DBus::InterfaceAdaptor
{
public:
pep_adaptor()
: ::DBus::InterfaceAdaptor("security.pep")
{
register_method(pep_adaptor, decryptMessage, _decryptMessage_stub);
}
::DBus::IntrospectedInterface *introspect() const
{
static ::DBus::IntrospectedArgument decryptMessage_args[] =
{
{ "status", "v", false },
{ "dst", "v", false },
{ "src", "v", true },
{ "keylist", "v", true },
{ "rating", "v", true },
{ "flags", "v", true },
{ 0, 0, 0 }
};
static ::DBus::IntrospectedMethod pep_adaptor_methods[] =
{
{ "decryptMessage", decryptMessage_args },
{ 0, 0 }
};
static ::DBus::IntrospectedMethod pep_adaptor_signals[] =
{
{ 0, 0 }
};
static ::DBus::IntrospectedProperty pep_adaptor_properties[] =
{
{ 0, 0, 0, 0 }
};
static ::DBus::IntrospectedInterface pep_adaptor_interface =
{
"security.pep",
pep_adaptor_methods,
pep_adaptor_signals,
pep_adaptor_properties
};
return &pep_adaptor_interface;
}
public:
/* properties exposed by this interface, use
* property() and property(value) to get and set a particular property
*/
public:
/* methods exported by this interface,
* you will have to implement them in your ObjectAdaptor
*/
virtual void decryptMessage(const pEpDBusMessage& src, const pEpDBusStringList& keylist, const pEpDBusRating& rating, const pEpDBusEncryptionFlags& flags, pEpDBusStatus& status, pEpDBusMessage& dst) = 0;
public:
/* signal emitters for this interface
*/
private:
/* unmarshalers (to unpack the DBus message before calling the actual interface method)
*/
::DBus::Message _decryptMessage_stub(const ::DBus::CallMessage &call)
{
::DBus::MessageIter ri = call.reader();
::DBus::Variant argin1; ri >> argin1;
::DBus::Variant argin2; ri >> argin2;
::DBus::Variant argin3; ri >> argin3;
::DBus::Variant argin4; ri >> argin4;
pEpDBusMessage _argin1; _argin1 << argin1;
pEpDBusStringList _argin2; _argin2 << argin2;
pEpDBusRating _argin3; _argin3 << argin3;
pEpDBusEncryptionFlags _argin4; _argin4 << argin4;
::DBus::Variant argout1;
::DBus::Variant argout2;
pEpDBusStatus _argout1;
pEpDBusMessage _argout2;
decryptMessage(_argin1, _argin2, _argin3, _argin4, _argout1, _argout2);
::DBus::ReturnMessage reply(call);
::DBus::MessageIter wi = reply.writer();
argout1 << _argout1;
argout2 << _argout2;
wi << argout1;
wi << argout2;
return reply;
}
};
}
#endif //__dbusxx__pep_server_glue_h__ADAPTOR_MARSHAL_H

+ 3
- 0
security.pep.service.in View File

@ -0,0 +1,3 @@
[D-BUS Service]
Name=pep.security
Exec=/usr/bin/pep-dbus-server

+ 13
- 0
tests.cpp View File

@ -0,0 +1,13 @@
#include <pep-client.h>
DBus::BusDispatcher dispatcher;
int main()
{
DBus::default_dispatcher = &dispatcher;
DBus::Connection conn = DBus::Connection::SessionBus();
pEpClient server(conn, "/pep/security", "pep.security");
message m;
pEpDBusMessage dm1(m);
}

+ 17
- 7
types/CMakeLists.txt View File

@ -1,15 +1,25 @@
set(pEpDBusAdapterTypes_SRC
pEpDBusEncryptionFlags.cpp
pEpDBusMessage.cpp
pEpDBusRating.cpp
pEpDBusStatus.cpp
pEpDBusStringList.cpp
)
add_library(pEpDBusAdapterTypes SHARED
pEpDBusEncryptionFlags.cpp
pEpDBusMessage.cpp
pEpDBusRating.cpp
pEpDBusStatus.cpp
pEpDBusStringList.cpp
set(pEpDBusAdapterTypes_H
pEpDBusEncryptionFlags.h
pEpDBusMessage.h
pEpDBusRating.h
pEpDBusStatus.h
pEpDBusStringList.h
)
add_library(pEpDBusAdapterTypes SHARED ${pEpDBusAdapterTypes_SRC} ${pEpDBusAdapterTypes_H})
target_link_libraries(pEpDBusAdapterTypes dbus-c++-1)
set_target_properties(pEpDBusAdapterTypes PROPERTIES
CXX_VISIBILITY_PRESET default
VISIBILITY_INLINES_HIDDEN 0)
VISIBILITY_INLINES_HIDDEN 0
)

+ 8
- 1
types/pEpDBusMessage.cpp View File

@ -1,6 +1,13 @@
#include "pEpDBusMessage.h"
#include <iostream>
pEpDBusMessage::pEpDBusMessage() {}
pEpDBusMessage::pEpDBusMessage()
{
}
pEpDBusMessage::pEpDBusMessage(message &m)
{
}
DBus::Variant& operator<<(DBus::Variant&, const pEpDBusMessage&)
{


+ 5
- 1
types/pEpDBusMessage.h View File

@ -3,10 +3,14 @@
#include <dbus-c++/types.h>
#include <pEp/message.h>
class pEpDBusMessage : public DBus::Variant
{
public:
pEpDBusMessage();
explicit pEpDBusMessage();
explicit pEpDBusMessage(message&);
friend DBus::Variant& operator<<(DBus::Variant&, const pEpDBusMessage&);
};


+ 7
- 1
types/pEpDBusStatus.cpp View File

@ -1,6 +1,12 @@
#include "pEpDBusStatus.h"
pEpDBusStatus::pEpDBusStatus() {}
pEpDBusStatus::pEpDBusStatus()
{
}
pEpDBusStatus::pEpDBusStatus(PEP_STATUS&)
{
}
DBus::Variant& operator<<(DBus::Variant&, const pEpDBusStatus&)
{


+ 4
- 0
types/pEpDBusStatus.h View File

@ -3,10 +3,14 @@
#include <dbus-c++/types.h>
#include <pEp/pEpEngine.h>
class pEpDBusStatus : public DBus::Variant
{
public:
pEpDBusStatus();
pEpDBusStatus(PEP_STATUS&);
friend DBus::Variant& operator<<(DBus::Variant&, const pEpDBusStatus&);
};


Loading…
Cancel
Save