src/baseprotocol.h
author Roker <roker@pep-project.org>
Tue, 20 Sep 2016 15:54:57 +0200
branchroker-linux
changeset 1168 4d4e3ecbaf8b
parent 587 ed8aa5e5b02c
child 1513 e7f7e42385b5
permissions -rw-r--r--
merge "default" into my branch
vb@585
     1
#pragma once
vb@585
     2
vb@585
     3
#include "message.h"
vb@585
     4
vb@585
     5
#ifdef __cplusplus
vb@585
     6
extern "C" {
vb@585
     7
#endif
vb@585
     8
vb@587
     9
vb@587
    10
// decorate_message() - decorate a message with payload
vb@587
    11
//
vb@587
    12
//  parameters:
vb@587
    13
//      msg (inout)     message to decorate
vb@587
    14
//      payload (in)    payload to send
vb@587
    15
//      size (in)       size of payload
vb@587
    16
//
vb@587
    17
//  returns:
vb@587
    18
//      PEP_STATUS_OK and result on success or an error on failure
vb@587
    19
//
vb@587
    20
//  caveat:
vb@587
    21
//      on success (and only then) payload goes to the ownership of the msg
vb@587
    22
//      the ownership of the msg remains with the caller
vb@587
    23
vb@587
    24
PEP_STATUS decorate_message(
vb@587
    25
        message *msg,
vb@587
    26
        char *payload,
vb@587
    27
        size_t size
vb@587
    28
    );
vb@587
    29
vb@587
    30
vb@585
    31
// prepare_message() - prepare a sync message with payload
vb@585
    32
//
vb@585
    33
//  parameters:
vb@585
    34
//      me (in)         identity to use for the sender
vb@585
    35
//      partner (in)    identity to use for the receiver
vb@585
    36
//      payload (in)    payload to send
vb@585
    37
//      size (in)       size of payload
vb@585
    38
//      result (out)    message with payload
vb@585
    39
//
vb@585
    40
//  returns:
vb@587
    41
//      PEP_STATUS_OK and result on success or an error on failure
vb@585
    42
//
vb@585
    43
//  caveat:
vb@587
    44
//      on success (and only then) payload goes to the ownership of the result
vb@587
    45
//      the ownership of the result goes to the caller
vb@585
    46
vb@585
    47
PEP_STATUS prepare_message(
vb@585
    48
        const pEp_identity *me,
vb@585
    49
        const pEp_identity *partner,
vb@585
    50
        char *payload,
vb@585
    51
        size_t size,
vb@585
    52
        message **result
vb@585
    53
    );
vb@585
    54
vb@587
    55
vb@585
    56
#ifdef __cplusplus
vb@585
    57
}
vb@585
    58
#endif
vb@585
    59