A C++ wrapper for the basic C datatypes defined by the pEpEngine.
 
 
Go to file
roker d965b3115b allow non-const access to wrapped type. Can be dangerous! USE WITH CAUTION! 2021-09-29 09:50:01 +02:00
src allow non-const access to wrapped type. Can be dangerous! USE WITH CAUTION! 2021-09-29 09:50:01 +02:00
test oh, the missing comma confuses libetpan, letting it reject the whole Cc: line. pEpMIME parses 4 entries here. Who is rignt? 2021-09-28 17:49:36 +02:00
.gitignore add .gitignore 2021-06-03 17:16:06 +02:00
LICENSE Initial commit 2021-05-04 12:52:20 +02:00
Makefile make 'all' a PONY target. 2021-06-09 14:25:53 +02:00
Makefile.conf add Makefiles & Makefile.conf, stolen from libpEpAdapter. 2021-06-01 23:12:17 +02:00
README.md copy discussion result from pad to README.md 2021-05-07 17:31:46 +02:00
local.conf.example Build: Add local.conf.example 2021-09-09 20:59:23 +02:00

README.md

libpEpDatatypes A C++ wrapper for the basic C datatypes defined by the pEpEngine.

Resources

Requirements & Platforms

  • License: GPL3

  • C++ standard: C++11

  • supported compilers: at least gcc and clang (both have to work)

  • Build sytem: GNU Make Platforms: Linux, macOS ** Target: static library libpEpDatatypes.a

  • Windows and Android builds will be done separatly

Design goals & principles

  • implement move c'tor & operator for cheep moves
  • Qpen question: deep copy / shallow copy (with ref couning?) / only explicit copy?
  • always initialize all members. Better safe than sorry.
  • Ownership of the member pointees: rule of thumb: "const" pointees are non-owned, non-const pointees are owned by the data structure. Exceptional cases are documented explicitly.

Public API

  • defined in namespace pEp::DT
  • header files are installed in PREFIX/include/pEp/ and are used via #include <pEp/filename.hh> (Also shared with libpEpAdapter!)
  • the linked list datatypes implement the API of std::forward_list

Example usage

The following API is the target we're heading to:

#include <pEp/Types.hh>
#include <pEp/Adapter.hh>

int main()
{
    pEp::Message msg = "From: Alice Cooper <alice@mail.com>\n"
                       "To: Bob Smith <bob@mail.com>\n"
                       "Subject: Meeting\n"
                       "\n"
                       "Dear Bob,\n"
                       "\n"
                       "I will come.\n"
                       "\n"
                       "Alice.\n"_CRLF;

    try {
        auto enc = msg.encrypt();
        enc.send();
    }
    catch (pEp::err& e)
    {
    }

    return 0;
}

As an intermediate step the p≡p API in the engine must be fully supported:

#include <pEp/message_api.h> // from pEpEngine
#include <pEp/Types.hh>      // from libpEpDatatypes
#include <pEp/Adapter.hh>    // from libpEpDatatypes

int main()
{
    pEp::Message msg_plain =
            "From: Alice Cooper <alice@mail.com>\nTo: Bob "
            "Smith <bob@mail.com>\nSubject: Meeting\n\n"
            "Dear Bob,\n\nI will come.\n\nAlice."_CRLF;
     
    ::message* msg_enc = nullptr;
    PEP_STATUS status = encrypt_message(msg_plain, enc_enc, ...);
    pEp::Message msg{std::move(msg_enc)}; // ownership of the pointee goes to 'msg'
    
    return 0;
}

Implementation details

  • Code-formatting: clang-format. Please try and use .clang-format from libpEpAdapter
  • Include guards: #ifdef/#define style (not #pragma once), naming style: LIBPEPDATATYPES_FILENAME_HH