IOS-1480 Using typedef NS_ENUM. IOS-1480
authorDirk Zimmermann <dz@pep.security>
Mon, 04 Mar 2019 16:07:45 +0100
branchIOS-1480
changeset 862af86270f362d
parent 861 e21d2be61276
child 863 ab25ff826872
IOS-1480 Using typedef NS_ENUM.
pEpObjCAdapterFramework/PEPEngineTypes.h
     1.1 --- a/pEpObjCAdapterFramework/PEPEngineTypes.h	Mon Mar 04 16:07:45 2019 +0100
     1.2 +++ b/pEpObjCAdapterFramework/PEPEngineTypes.h	Mon Mar 04 16:07:45 2019 +0100
     1.3 @@ -11,7 +11,7 @@
     1.4  
     1.5  #import <Foundation/Foundation.h>
     1.6  
     1.7 -typedef enum _ObjC_PEP_decrypt_flags {
     1.8 +typedef NS_ENUM(NSUInteger, PEPDecryptFlags) {
     1.9      PEPDecryptFlagNone = 0x1, // This defined only in the adpater, not the engine.
    1.10      PEPDecryptFlagOwnPrivateKey = 0x1, // PEP_decrypt_flag_own_private_key = 0x1,
    1.11      PEPDecryptFlagConsume = 0x2, // PEP_decrypt_flag_consume = 0x2,
    1.12 @@ -19,18 +19,18 @@
    1.13      PEPDecryptFlagSrcModified = 0x8, // PEP_decrypt_flag_src_modified = 0x8,
    1.14      // input flags
    1.15      PEPDecryptFlagUntrustedServer = 0x100 // PEP_decrypt_flag_untrusted_server = 0x100
    1.16 -} PEPDecryptFlags; // PEP_decrypt_flags;
    1.17 +}; // PEP_decrypt_flags;
    1.18  
    1.19 -typedef enum _ObjC_PEP_enc_format {
    1.20 +typedef NS_ENUM(NSUInteger, PEPEncFormat) {
    1.21      PEPEncNone = 0, // PEP_enc_none = 0, // message is not encrypted
    1.22      PEPEncPieces, // PEP_enc_pieces, // inline PGP + PGP extensions
    1.23      PEPEncSMIME, // PEP_enc_S_MIME, // RFC5751
    1.24      PEPEncPGPMIME, // PEP_enc_PGP_MIME, // RFC3156
    1.25      PEPEncPEP, // PEP_enc_PEP, // pEp encryption format
    1.26      PEPEncPGPMIMEOutlook1 // PEP_enc_PGP_MIME_Outlook1 // Message B0rken by Outlook type 1
    1.27 -} PEPEncFormat;
    1.28 +};
    1.29  
    1.30 -typedef enum _ObjC_PEP_rating {
    1.31 +typedef NS_ENUM(NSInteger, PEPRating) {
    1.32      PEPRatingUndefined = 0,// PEP_rating_undefined = 0,
    1.33      PEPRatingCannotDecrypt, // PEP_rating_cannot_decrypt,
    1.34      PEPRatingHaveNoKey, // PEP_rating_have_no_key,
    1.35 @@ -45,9 +45,9 @@
    1.36      PEPRatingMistrust = -1, // PEP_rating_mistrust = -1,
    1.37      PEPRatingB0rken = -2, // PEP_rating_b0rken = -2,
    1.38      PEPRatingUnderAttack = -3 // PEP_rating_under_attack = -3
    1.39 -} PEPRating;
    1.40 +};
    1.41  
    1.42 -typedef enum {
    1.43 +typedef NS_ENUM(NSInteger, PEPStatus) {
    1.44      PEPStatusOK                                   = 0, // PEP_STATUS_OK
    1.45  
    1.46      PEPInitCannotLoadGPME                      = 0x0110, // PEP_INIT_CANNOT_LOAD_GPGME
    1.47 @@ -142,23 +142,23 @@
    1.48      PEPUnknownError                               = -1, // PEP_UNKNOWN_ERROR
    1.49  
    1.50      PEPVersionMismatch                            = -7, // PEP_VERSION_MISMATCH
    1.51 -} PEPStatus;
    1.52 +};
    1.53  
    1.54 -typedef enum _ObjC_identity_flags {
    1.55 +typedef NS_ENUM(NSUInteger, PEPIdentityFlags) {
    1.56      // the first octet flags are app defined settings
    1.57      PEPIdfNotForSync = 0x0001, // PEP_idf_not_for_sync = 0x0001,   // don't use this identity for sync
    1.58      PEPIdfList = 0x0002, // PEP_idf_list = 0x0002,           // identity of list of persons
    1.59      // the second octet flags are calculated
    1.60      PEPIdfDeviceGroup = 0x0100 // PEP_idf_devicegroup = 0x0100     // identity of a device group member
    1.61 -} PEPIdentityFlags;
    1.62 +};
    1.63  
    1.64 -typedef enum _ObjC_sync_handshake_result {
    1.65 +typedef NS_ENUM(NSInteger, PEPSyncHandshakeResult) {
    1.66      PEPSyncHandshakeResultCancel = -1, // SYNC_HANDSHAKE_CANCEL = -1,
    1.67      PEPSyncHandshakeResultAccepted = 0, // SYNC_HANDSHAKE_ACCEPTED = 0,
    1.68      PEPSyncHandshakeResultRejected = 1 // SYNC_HANDSHAKE_REJECTED = 1
    1.69 -} PEPSyncHandshakeResult;
    1.70 +};
    1.71  
    1.72 -typedef enum _PEPCommType {
    1.73 +typedef NS_ENUM(NSUInteger, PEPCommType) {
    1.74      PEPCtUnknown = 0, // PEP_ct_unknown = 0,
    1.75  
    1.76      // range 0x01 to 0x09: no encryption, 0x0a to 0x0e: nothing reasonable
    1.77 @@ -217,24 +217,24 @@
    1.78  
    1.79      PEPCtConfirmedEncAnon = 0xc0, // PEP_ct_confirmed_enc_anon = 0xc0,           // generic
    1.80      PEPCtPEP = 0xff // PEP_ct_pEp = 0xff
    1.81 -} PEPCommType;
    1.82 +};
    1.83  
    1.84 -typedef enum _ObjC_PEP_msg_direction {
    1.85 +typedef NS_ENUM(NSUInteger, PEPMsgDirection) {
    1.86      PEPDirIncoming = 0,
    1.87      PEPDirOutgoing
    1.88 -} PEPMsgDirection;
    1.89 +};
    1.90  
    1.91 -typedef enum _ObjC_PEP_color {
    1.92 +typedef NS_ENUM(NSInteger, PEPColor) {
    1.93      PEPColorNoColor = 0,
    1.94      PEPColorYellow,
    1.95      PEPColorGreen,
    1.96      PEPColorRed = -1,
    1.97 -} PEPColor;
    1.98 +};
    1.99  
   1.100 -typedef enum {
   1.101 +typedef NS_ENUM(NSInteger, PEPContentDisposition) {
   1.102      PEPContentDispAttachment = 0,
   1.103      PEPContentDispInline = 1,
   1.104      PEPContentDispOther = -1      // must be affirmatively set
   1.105 -} PEPContentDisposition;
   1.106 +};
   1.107  
   1.108  #endif /* PEPTypes_h */