Browse Source

Not using variants but basic data types

master
David Lanzendörfer 7 months ago
parent
commit
8c79c84bcf
16 changed files with 19 additions and 288 deletions
  1. +3
    -9
      CMakeLists.txt
  2. +6
    -23
      pep-introspect.xml
  3. +5
    -16
      pep-server.cpp
  4. +1
    -3
      pep-server.h
  5. +4
    -9
      tests.cpp
  6. +0
    -25
      types/CMakeLists.txt
  7. +0
    -8
      types/pEpDBusEncryptionFlags.cpp
  8. +0
    -14
      types/pEpDBusEncryptionFlags.h
  9. +0
    -67
      types/pEpDBusMessage.cpp
  10. +0
    -33
      types/pEpDBusMessage.h
  11. +0
    -10
      types/pEpDBusRating.cpp
  12. +0
    -14
      types/pEpDBusRating.h
  13. +0
    -15
      types/pEpDBusStatus.cpp
  14. +0
    -19
      types/pEpDBusStatus.h
  15. +0
    -9
      types/pEpDBusStringList.cpp
  16. +0
    -14
      types/pEpDBusStringList.h

+ 3
- 9
CMakeLists.txt View File

@ -2,8 +2,6 @@ project(pEpDBusAdapter)
include_directories(${PROJECT_SOURCE_DIR}/types)
add_subdirectory(types)
############################ Server glue ###########################
add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/pep-server-glue.h
@ -27,18 +25,14 @@ set_source_files_properties(${PROJECT_BINARY_DIR}/pep-client-glue.h PROPERTIES G
#######################
add_library(pEpDBusAdapterClient SHARED pep-client.cpp ${PROJECT_BINARY_DIR}/pep-client-glue.h)
target_link_libraries(pEpDBusAdapterClient
pEpDBusAdapterTypes
)
target_link_libraries(pEpDBusAdapterClient pEpEngine dbus-c++-1)
set_target_properties(pEpDBusAdapterClient PROPERTIES
CXX_VISIBILITY_PRESET default
VISIBILITY_INLINES_HIDDEN 0
)
add_library(pEpDBusAdapterServer SHARED pep-server.cpp ${PROJECT_BINARY_DIR}/pep-server-glue.h)
target_link_libraries(pEpDBusAdapterServer
pEpDBusAdapterTypes
)
target_link_libraries(pEpDBusAdapterServer pEpEngine pEpMIME dbus-c++-1)
set_target_properties(pEpDBusAdapterServer PROPERTIES
CXX_VISIBILITY_PRESET default
VISIBILITY_INLINES_HIDDEN 0
@ -54,5 +48,5 @@ configure_file(security.pep.service.in ${CMAKE_CURRENT_BINARY_DIR}/security.pep.
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/security.pep.service
DESTINATION ${KDE_INSTALL_DBUSSERVICEDIR})
install(TARGETS pep-dbus-server pEpDBusAdapterServer pEpDBusAdapterClient pEpDBusAdapterTypes)
install(TARGETS pep-dbus-server pEpDBusAdapterServer)

+ 6
- 23
pep-introspect.xml View File

@ -1,30 +1,13 @@
<?xml version="1.0" ?>
<node name="/security/pep/">
<interface name="security.pep">
<method name="send_test">
<arg direction="in" name="src" type="v">
<annotation name="org.freedesktop.DBus.Object" value="pEpDBusMessage" />
</arg>
</method>
<method name="decrypt_message">
<arg direction="out" name="status" type="v">
<annotation name="org.freedesktop.DBus.Object" value="pEpDBusStatus" />
</arg>
<arg direction="out" name="dst" type="v">
<annotation name="org.freedesktop.DBus.Object" value="pEpDBusMessage" />
</arg>
<arg direction="in" name="src" type="v">
<annotation name="org.freedesktop.DBus.Object" value="pEpDBusMessage" />
</arg>
<arg direction="in" name="keylist" type="v">
<annotation name="org.freedesktop.DBus.Object" value="pEpDBusStringList" />
</arg>
<arg direction="in" name="rating" type="v">
<annotation name="org.freedesktop.DBus.Object" value="pEpDBusRating" />
</arg>
<arg direction="in" name="flags" type="v">
<annotation name="org.freedesktop.DBus.Object" value="pEpDBusEncryptionFlags" />
</arg>
<arg direction="out" name="status" type="i" />
<arg direction="out" name="dst" type="s" />
<arg direction="in" name="src" type="s" />
<arg direction="in" name="keylist" type="as" />
<arg direction="in" name="rating" type="i" />
<arg direction="in" name="flags" type="i"/>
</method>
</interface>
</node>

+ 5
- 16
pep-server.cpp View File

@ -20,23 +20,12 @@ pEp::Server::~Server()
{
}
void pEp::Server::send_test(const pEpDBusMessage& src)
{
message m;
m << src;
std::cout << "Got something" << std::endl;
return;
}
void pEp::Server::decrypt_message(const pEpDBusMessage& src, const pEpDBusStringList& keylist, const pEpDBusRating& rating,
const pEpDBusEncryptionFlags& flags, pEpDBusStatus& status, pEpDBusMessage& dst)
void pEp::Server::decrypt_message(const std::string& src, const std::vector< std::string >& keylist, const int32_t& rating, const int32_t& flags, int32_t& status, std::string& dst)
{
bool has_possible_pEp_msg;
std::cout << "Trying to decrypt the data" << std::endl;
//status PEP_STATUS_OK;
status = PEP_STATUS_OK;
// message m = src;
// src = m;
//status = ::decrypt_message( mSession, src, dst, keylist, rating, flags ));
message **srcm;
mime_decode_message(src.c_str(), src.size(), srcm, &has_possible_pEp_msg );
//status = ::decrypt_message( mSession, srcm, dstm, keylist, rating, flags );
}

+ 1
- 3
pep-server.h View File

@ -18,9 +18,7 @@ public:
~Server();
// Message API
void send_test(const pEpDBusMessage& src);
void decrypt_message(const pEpDBusMessage& src, const pEpDBusStringList& keylist, const pEpDBusRating& rating,
const pEpDBusEncryptionFlags& flags, pEpDBusStatus& status, pEpDBusMessage& dst);
void decrypt_message(const std::string& src, const std::vector< std::string >& keylist, const int32_t& rating, const int32_t& flags, int32_t& status, std::string& dst);
private:


+ 4
- 9
tests.cpp View File

@ -8,10 +8,12 @@ int main()
DBus::Connection conn = DBus::Connection::SessionBus();
pEp::Client client(conn, "/security/pep", "security.pep");
message m;
/*message m;
m.dir=PEP_dir_outgoing;
m.id="test";
pEp_identity from;
from.address="leviathan@libresilicon.com";
m.from=&from;
m.from=&from;*/
/*pEpDBusMessage src, dst;
pEpDBusStringList keylist;
@ -20,14 +22,7 @@ int main()
pEpDBusStatus status;
src.clear();*/
//client.decrypt_message(src,keylist,rating,flags,status,dst);
//dst >> m;
::DBus::MessageIter wi;
::DBus::Variant _src;
pEpDBusMessage src;
src << m;
client.send_test(src);
return 0;
}

+ 0
- 25
types/CMakeLists.txt View File

@ -1,25 +0,0 @@
set(pEpDBusAdapterTypes_SRC
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
)

+ 0
- 8
types/pEpDBusEncryptionFlags.cpp View File

@ -1,8 +0,0 @@
#include "pEpDBusEncryptionFlags.h"
pEpDBusEncryptionFlags::pEpDBusEncryptionFlags() {}
DBus::Variant& operator<<(DBus::Variant&, const pEpDBusEncryptionFlags&) {
DBus::Variant ret;
return ret;
}

+ 0
- 14
types/pEpDBusEncryptionFlags.h View File

@ -1,14 +0,0 @@
#ifndef PEP_DBUS_ENCRYPTION_FLAG_H
#define PEP_DBUS_ENCRYPTION_FLAG_H
#include <dbus-c++/types.h>
class pEpDBusEncryptionFlags : public DBus::Variant
{
public:
pEpDBusEncryptionFlags();
const DBus::Signature signature() const { return "s"; }
friend DBus::Variant& operator<<(DBus::Variant&, const pEpDBusEncryptionFlags&);
};
#endif

+ 0
- 67
types/pEpDBusMessage.cpp View File

@ -1,67 +0,0 @@
#include "pEpDBusMessage.h"
#include <iostream>
pEpDBusMessage::pEpDBusMessage() : DBus::Variant::Variant()
{
writer().new_variant("s");
}
pEpDBusMessage::pEpDBusMessage(message m) : DBus::Variant::Variant()
{
writer().new_variant("s");
}
DBus::Variant& operator>>(DBus::Variant &v, const pEpDBusMessage &m)
{
DBus::MessageIter to = m.writer();
v.reader().copy_data(to);
return v;
}
DBus::Variant& operator<<(DBus::Variant &v, const pEpDBusMessage &m)
{
DBus::MessageIter to = v.writer();
m.reader().copy_data(to);
return v;
}
message& pEpDBusMessage::operator >> (message &m)
{
m.from->address = writer().get_string();
return m;
}
DBus::Variant& pEpDBusMessage::operator << (DBus::Variant &v)
{
DBus::MessageIter to = writer();
v.reader().copy_data(to);
return v;
}
message& pEpDBusMessage::operator << (message &m)
{
writer().append_string(m.from->address);
return m;
}
message& operator << (message &m, const pEpDBusMessage&)
{
return m;
}
message& operator >> (message &m, const pEpDBusMessage&)
{
return m;
}
void pEpDBusMessage::omnom_pEp_message(message m)
{
writer().append_string(m.from->address);
}
message pEpDBusMessage::spit_out_pEp_message()
{
message m;
return m;
}

+ 0
- 33
types/pEpDBusMessage.h View File

@ -1,33 +0,0 @@
#ifndef PEP_DBUS_MESSAGE_H
#define PEP_DBUS_MESSAGE_H
#include <dbus-c++/types.h>
#include <pEp/message.h>
class pEpDBusMessage : public DBus::Variant
{
public:
explicit pEpDBusMessage();
explicit pEpDBusMessage(message);
message& operator >> (message &m);
message& operator << (message &m);
DBus::Variant& operator << (DBus::Variant &v);
//const DBus::Signature signature() const;
friend DBus::Variant& operator << (DBus::Variant&, const pEpDBusMessage&);
friend DBus::Variant& operator >> (DBus::Variant&, const pEpDBusMessage&);
friend message& operator << (message &m, const pEpDBusMessage&);
friend message& operator >> (message &m, const pEpDBusMessage&);
//friend std::string operator << (DBus::Variant&, const pEpDBusMessage&);
private:
void omnom_pEp_message(message m);
message spit_out_pEp_message();
};
#endif

+ 0
- 10
types/pEpDBusRating.cpp View File

@ -1,10 +0,0 @@
#include "pEpDBusRating.h"
pEpDBusRating::pEpDBusRating() {}
DBus::Variant& operator<<(DBus::Variant&, const pEpDBusRating&)
{
DBus::Variant ret;
return ret;
}

+ 0
- 14
types/pEpDBusRating.h View File

@ -1,14 +0,0 @@
#ifndef PEP_DBUS_RATING_H
#define PEP_DBUS_RATING_H
#include <dbus-c++/types.h>
class pEpDBusRating : public DBus::Variant
{
public:
pEpDBusRating();
const DBus::Signature signature() const { return "s"; }
friend DBus::Variant& operator<<(DBus::Variant&, const pEpDBusRating&);
};
#endif

+ 0
- 15
types/pEpDBusStatus.cpp View File

@ -1,15 +0,0 @@
#include "pEpDBusStatus.h"
pEpDBusStatus::pEpDBusStatus()
{
}
pEpDBusStatus::pEpDBusStatus(PEP_STATUS)
{
}
DBus::Variant& operator<<(DBus::Variant&, const pEpDBusStatus&)
{
DBus::Variant ret;
return ret;
}

+ 0
- 19
types/pEpDBusStatus.h View File

@ -1,19 +0,0 @@
#ifndef PEP_DBUS_STATUS_H
#define PEP_DBUS_STATUS_H
#include <dbus-c++/types.h>
#include <pEp/pEpEngine.h>
class pEpDBusStatus : public DBus::Variant
{
public:
pEpDBusStatus();
pEpDBusStatus(PEP_STATUS);
const DBus::Signature signature() const { return "s"; }
friend DBus::Variant& operator<<(DBus::Variant&, const pEpDBusStatus&);
};
#endif

+ 0
- 9
types/pEpDBusStringList.cpp View File

@ -1,9 +0,0 @@
#include "pEpDBusStringList.h"
pEpDBusStringList::pEpDBusStringList() {}
DBus::Variant& operator<<(DBus::Variant&, const pEpDBusStringList&)
{
DBus::Variant ret;
return ret;
}

+ 0
- 14
types/pEpDBusStringList.h View File

@ -1,14 +0,0 @@
#ifndef PEP_DBUS_STRING_LIST_H
#define PEP_DBUS_STRING_LIST_H
#include <dbus-c++/types.h>
class pEpDBusStringList : public DBus::Variant
{
public:
pEpDBusStringList();
const DBus::Signature signature() const { return "s"; }
friend DBus::Variant& operator<<(DBus::Variant&, const pEpDBusStringList&);
};
#endif

Loading…
Cancel
Save