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