src/map_asn1.h
author Edouard Tisserant <edouard@pep-project.org>
Wed, 05 Oct 2016 18:18:41 +0200
changeset 1248 c332c47fe26e
parent 969 bf2aac3565a3
child 1257 0c12d65fe859
permissions -rw-r--r--
KEYSYNC: Added arbitrary hard coded sync message expiry (10m), and made special case when receiving groupKeys message so that they are not consumed giving a chance to other devices in the group to receive it as well.
     1 #pragma once
     2 
     3 #include "pEpEngine.h"
     4 #include "identity_list.h"
     5 #include "../asn.1/Identity.h"
     6 #include "../asn.1/IdentityList.h"
     7 #include "../asn.1/GeneralizedTime.h"
     8 
     9 #ifdef __cplusplus
    10 extern "C" {
    11 #endif
    12 
    13 
    14 // Identity_from_Struct() - convert pEp_identity into ASN.1 Identity_t
    15 //
    16 //  params:
    17 //      ident (in)          pEp_identity to convert
    18 //      result (inout)      Identity_t to update or NULL to alloc a new one
    19 //
    20 //  return value:
    21 //      pointer to updated or allocated result
    22 //
    23 //  caveat:
    24 //      if a new struct is allocated, the ownership goes to the caller
    25 
    26 Identity_t *Identity_from_Struct(
    27         const pEp_identity *ident,
    28         Identity_t *result
    29     );
    30 
    31 
    32 // Identity_to_Struct() - convert ASN.1 Identity_t into pEp_identity
    33 //
    34 //  params:
    35 //      ident (in)          Identity_t to convert
    36 //      result (inout)      pEp_identity to update or NULL to alloc a new one
    37 //
    38 //  return value:
    39 //      pointer to updated or allocated result
    40 //
    41 //  caveat:
    42 //      if a new struct is allocated, the ownership goes to the caller
    43 
    44 pEp_identity *Identity_to_Struct(Identity_t *ident, pEp_identity *result);
    45 
    46 
    47 // IdentityList_from_identity_list() - convert identity_list_t into ASN.1 IdentityList_t
    48 //
    49 //  params:
    50 //      list (in)           identity_list to convert
    51 //      result (inout)      IdentityList_t to update or NULL to alloc a new one
    52 //
    53 //  return value:
    54 //      pointer to updated or allocated result
    55 //
    56 //  caveat:
    57 //      if a new struct is allocated, the ownership goes to the caller
    58 
    59 IdentityList_t *IdentityList_from_identity_list(
    60         const identity_list *list,
    61         IdentityList_t *result
    62     );
    63 
    64 // IdentityList_to_identity_list() - convert ASN.1 IdentityList_t to identity_list_t
    65 //
    66 //  params:
    67 //      list (in)           ASN.1 IdentityList_t to convert
    68 //      result (inout)      identity_list_t to update or NULL to alloc a new one
    69 //
    70 //  return value:
    71 //      pointer to updated or allocated result
    72 //
    73 //  caveat:
    74 //      if a new struct is allocated, the ownership goes to the caller
    75 
    76 identity_list *IdentityList_to_identity_list(IdentityList_t *list, identity_list *result);
    77 
    78 // GeneralizedTime_to_timestamp() - convert ASN.1 GeneralizedTime to timestamp
    79 //
    80 //  params:
    81 //      asntime (in)        ASN.1 GeneralizedTime to convert
    82 //      result (inout)      timestamp to update or NULL to alloc a new one
    83 //
    84 //  return value:
    85 //      pointer to allocated timestamp
    86 //
    87 //  caveat:
    88 //      if a new timestamp is allocated, the ownership goes to the caller
    89 
    90 timestamp *GeneralizedTime_to_timestamp(GeneralizedTime_t * asntime, timestamp *result);
    91 
    92 // GeneralizedTime_to_time_t() - convert ASN.1 GeneralizedTime to time_t
    93 //
    94 //  params:
    95 //      asntime (in)        ASN.1 GeneralizedTime to convert
    96 //
    97 //  return value:
    98 //      resulting time_t
    99 //
   100 
   101 time_t GeneralizedTime_to_time_t(GeneralizedTime_t * asntime);
   102 
   103 // timestamp_GeneralizedTime_to() - convert ASN.1 timestamp to GeneralizedTime
   104 //
   105 //  params:
   106 //      ts (in)             timestam to convert
   107 //      result (inout)      GeneralizedTime_t to update or NULL to alloc a new one
   108 //
   109 //  return value:
   110 //      pointer to allocated ASN.1 GeneralizedTime
   111 //
   112 //  caveat:
   113 //      if a new GeneralizedTime is allocated, the ownership goes to the caller
   114 
   115 GeneralizedTime_t *timestamp_to_GeneralizedTime(timestamp * ts, GeneralizedTime_t *result);
   116 
   117 #ifdef __cplusplus
   118 }
   119 #endif
   120