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