src/baseprotocol.h
author Volker Birk <vb@pep-project.org>
Tue, 10 May 2016 12:03:45 +0200
changeset 585 8ec129931074
child 587 ed8aa5e5b02c
permissions -rw-r--r--
prepare message
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@585
     9
// prepare_message() - prepare a sync message with payload
vb@585
    10
//
vb@585
    11
//  parameters:
vb@585
    12
//      me (in)         identity to use for the sender
vb@585
    13
//      partner (in)    identity to use for the receiver
vb@585
    14
//      payload (in)    payload to send
vb@585
    15
//      size (in)       size of payload
vb@585
    16
//      result (out)    message with payload
vb@585
    17
//
vb@585
    18
//  returns:
vb@585
    19
//      PEP_STATUS_OK on success or PEP_OUT_OF_MEMORY
vb@585
    20
//
vb@585
    21
//  caveat:
vb@585
    22
//      on success (and only then) payload goes to the ownership of the message
vb@585
    23
//      created
vb@585
    24
vb@585
    25
PEP_STATUS prepare_message(
vb@585
    26
        const pEp_identity *me,
vb@585
    27
        const pEp_identity *partner,
vb@585
    28
        char *payload,
vb@585
    29
        size_t size,
vb@585
    30
        message **result
vb@585
    31
    );
vb@585
    32
vb@585
    33
#ifdef __cplusplus
vb@585
    34
}
vb@585
    35
#endif
vb@585
    36