src/message_api.h
author Volker Birk <vb@pep-project.org>
Fri, 01 May 2015 00:23:03 +0200
changeset 232 3d44d9bb18e5
parent 220 9234c753e2cf
child 235 8b7468ca8034
permissions -rw-r--r--
slighly renaming
     1 #pragma once
     2 
     3 #include "pEpEngine.h"
     4 #include "keymanagement.h"
     5 #include "message.h"
     6 
     7 #ifdef __cplusplus
     8 extern "C" {
     9 #endif
    10 
    11 
    12 // encrypt_message() - encrypt message in memory
    13 //
    14 //  parameters:
    15 //      session (in)        session handle
    16 //      src (in)            message to encrypt
    17 //      extra (in)          extra keys for encryption
    18 //      dst (out)           pointer to new encrypted message or NULL on failure
    19 //      enc_format (in)     encrypted format
    20 //
    21 //  return value:
    22 //      PEP_STATUS_OK                   on success
    23 //		PEP_KEY_NOT_FOUND	            at least one of the receipient keys
    24 //		                                could not be found
    25 //		PEP_KEY_HAS_AMBIG_NAME          at least one of the receipient keys has
    26 //		                                an ambiguous name
    27 //		PEP_GET_KEY_FAILED		        cannot retrieve key
    28 //
    29 //	caveat:
    30 //	    the ownership of the new message goes to the caller
    31 //	    if src is unencrypted this function returns PEP_UNENCRYPTED and sets
    32 //	    dst to NULL
    33 
    34 DYNAMIC_API PEP_STATUS encrypt_message(
    35         PEP_SESSION session,
    36         message *src,
    37         stringlist_t *extra,
    38         message **dst,
    39         PEP_enc_format enc_format
    40     );
    41 
    42 
    43 // decrypt_message() - decrypt message in memory
    44 //
    45 //  parameters:
    46 //      session (in)        session handle
    47 //      src (in)            message to decrypt
    48 //      mime (in)           MIME encoding wanted
    49 //      dst (out)           pointer to new decrypted message or NULL on failure
    50 //
    51 //  return value:
    52 //      error status or PEP_STATUS_OK on success
    53 //
    54 //	caveat:
    55 //	    the ownership of the new message goes to the caller
    56 
    57 DYNAMIC_API PEP_STATUS decrypt_message(
    58         PEP_SESSION session,
    59         message *src,
    60         PEP_MIME_format mime,
    61         message **dst
    62     );
    63 
    64 
    65 typedef enum _PEP_color {
    66     PEP_undefined = 0,
    67     PEP_unencrypted,
    68     PEP_unreliable,
    69     PEP_reliable,
    70     PEP_yellow = PEP_reliable,
    71     PEP_trusted,
    72     PEP_green = PEP_trusted,
    73     PEP_trusted_and_anonymized,
    74     PEP_fully_anonymous,   
    75 
    76     PEP_under_attack = -1,
    77     PEP_red = PEP_under_attack,
    78     PEP_b0rken = -2
    79 } PEP_color;
    80 
    81 // get_message_color() - get color for a message
    82 //
    83 //  parameters:
    84 //      session (in)        session handle
    85 //      msg (in)            message to get the color for
    86 //      color (out)         color for the message
    87 //
    88 //  return value:
    89 //      error status or PEP_STATUS_OK on success
    90 //
    91 //  caveat:
    92 //      msg->from must point to a valid pEp_identity
    93 
    94 DYNAMIC_API PEP_STATUS get_message_color(
    95         PEP_SESSION session,
    96         message *msg,
    97         PEP_color *color
    98     );
    99 
   100 #ifdef __cplusplus
   101 }
   102 #endif
   103