src/baseprotocol.h
author Krista Bennett <krista@pep-project.org>
Tue, 14 Aug 2018 13:45:34 +0200
branchENGINE-451
changeset 2826 07c080d73a63
parent 1513 e7f7e42385b5
child 2846 7444832c5c6e
permissions -rw-r--r--
ENGINE-451: abandoning branch - config files to be dealt with using gpgme (and hotfix will be external to engine
vb@1513
     1
// This file is under GNU General Public License 3.0
vb@1513
     2
// see LICENSE.txt
vb@1513
     3
vb@585
     4
#pragma once
vb@585
     5
vb@585
     6
#include "message.h"
vb@585
     7
vb@585
     8
#ifdef __cplusplus
vb@585
     9
extern "C" {
vb@585
    10
#endif
vb@585
    11
vb@587
    12
vb@587
    13
// decorate_message() - decorate a message with payload
vb@587
    14
//
vb@587
    15
//  parameters:
vb@587
    16
//      msg (inout)     message to decorate
vb@587
    17
//      payload (in)    payload to send
vb@587
    18
//      size (in)       size of payload
vb@587
    19
//
vb@587
    20
//  returns:
vb@587
    21
//      PEP_STATUS_OK and result on success or an error on failure
vb@587
    22
//
vb@587
    23
//  caveat:
vb@587
    24
//      on success (and only then) payload goes to the ownership of the msg
vb@587
    25
//      the ownership of the msg remains with the caller
vb@587
    26
vb@587
    27
PEP_STATUS decorate_message(
vb@587
    28
        message *msg,
vb@587
    29
        char *payload,
vb@587
    30
        size_t size
vb@587
    31
    );
vb@587
    32
vb@587
    33
vb@585
    34
// prepare_message() - prepare a sync message with payload
vb@585
    35
//
vb@585
    36
//  parameters:
vb@585
    37
//      me (in)         identity to use for the sender
vb@585
    38
//      partner (in)    identity to use for the receiver
vb@585
    39
//      payload (in)    payload to send
vb@585
    40
//      size (in)       size of payload
vb@585
    41
//      result (out)    message with payload
vb@585
    42
//
vb@585
    43
//  returns:
vb@587
    44
//      PEP_STATUS_OK and result on success or an error on failure
vb@585
    45
//
vb@585
    46
//  caveat:
vb@587
    47
//      on success (and only then) payload goes to the ownership of the result
vb@587
    48
//      the ownership of the result goes to the caller
vb@585
    49
vb@585
    50
PEP_STATUS prepare_message(
vb@585
    51
        const pEp_identity *me,
vb@585
    52
        const pEp_identity *partner,
vb@585
    53
        char *payload,
vb@585
    54
        size_t size,
vb@585
    55
        message **result
vb@585
    56
    );
vb@585
    57
vb@587
    58
vb@585
    59
#ifdef __cplusplus
vb@585
    60
}
vb@585
    61
#endif
vb@585
    62