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