src/identity_list.h
author Krista 'DarthMama' Bennett <krista@pep.foundation>
Fri, 17 Jan 2020 11:20:09 +0100
branchsync
changeset 4351 864d368faa8b
parent 4186 9fbd6672b600
child 4792 7056435ab9e7
permissions -rw-r--r--
merge
vb@1513
     1
// This file is under GNU General Public License 3.0
vb@1513
     2
// see LICENSE.txt
vb@1513
     3
vb@98
     4
#pragma once
vb@98
     5
vb@105
     6
#include "pEpEngine.h"
vb@98
     7
vb@98
     8
#ifdef __cplusplus
vb@98
     9
extern "C" {
vb@98
    10
#endif
vb@98
    11
vb@98
    12
vb@98
    13
// new_identity_list() - allocate a new identity list
vb@98
    14
//
vb@98
    15
//  parameters:
vb@98
    16
//      ident (in)          identity to move for first element
vb@98
    17
//
vb@98
    18
//  return value:
vb@98
    19
//      new identity_list or NULL if out of memory
vb@98
    20
//
vb@98
    21
//  caveat:
vb@98
    22
//      ident is being moved if the function succeeds, the caller loses
vb@98
    23
//      ownership
vb@98
    24
vb@98
    25
DYNAMIC_API identity_list *new_identity_list(pEp_identity *ident);
vb@98
    26
vb@98
    27
vb@98
    28
// identity_list_dup() - duplicate identity_list (deep copy)
vb@98
    29
//
vb@98
    30
//  parameters:
vb@98
    31
//      id_list (in)        identity_list to copy
vb@98
    32
//
vb@98
    33
//  return value:
vb@98
    34
//      new identity_list or NULL if out of memory
vb@98
    35
vb@98
    36
DYNAMIC_API identity_list *identity_list_dup(const identity_list *src);
vb@98
    37
vb@98
    38
vb@98
    39
// free_identity_list() - free memory allocated by identity_list
vb@98
    40
//
vb@98
    41
//  parameters:
vb@98
    42
//      id_list (in)        identity_list to free
vb@98
    43
//
vb@98
    44
//  caveat:
vb@98
    45
//      this function frees all identities in the list additional to the
vb@98
    46
//      identity_list itself
vb@98
    47
vb@98
    48
DYNAMIC_API void free_identity_list(identity_list *id_list);
vb@98
    49
vb@98
    50
vb@98
    51
// identity_list_add - add identity to an identity_list
vb@98
    52
//
vb@98
    53
//  parameters:
vb@98
    54
//      id_list (in)        identity_list to add to
vb@98
    55
//      ident (in)          identity being added
vb@98
    56
//
vb@98
    57
//  return value:
vb@98
    58
//      pointer to the last element in identity_list or NULL if out of memory
vb@98
    59
//
vb@98
    60
//  caveat:
vb@98
    61
//      ident is being moved, the caller loses ownership if the function is
vb@98
    62
//      successful
vb@98
    63
vb@98
    64
DYNAMIC_API identity_list *identity_list_add(identity_list *id_list, pEp_identity *ident);
vb@98
    65
krista@3889
    66
// identity_list_add - join second identity_list to the first.
krista@3889
    67
//
krista@3889
    68
//  parameters:
krista@3889
    69
//      first_list (in)             identity_list to add to
krista@3889
    70
//      second_list (in)            identity list to add
krista@3889
    71
//
krista@3889
    72
//  return value:
krista@3889
    73
//      pointer to the HEAD of the new list, or NULL if both lists are empty.
krista@3889
    74
//
krista@3889
    75
DYNAMIC_API identity_list *identity_list_join(identity_list *first_list, identity_list* second_list);
vb@98
    76
vb@230
    77
// identity_list_length() - get length of identity_list
vb@230
    78
//
vb@230
    79
//  parameters:
vb@230
    80
//      id_list (in)        identity_list struct to determine length of
vb@230
    81
//
vb@230
    82
//  return value:
vb@230
    83
//      length of identity_list in number of elements
vb@230
    84
vb@230
    85
DYNAMIC_API int identity_list_length(const identity_list *id_list);
krista@4186
    86
krista@4186
    87
// Internal
krista@4186
    88
PEP_STATUS set_all_userids_in_list(identity_list* id_list, const char* user_id);
krista@4186
    89
vb@98
    90
#ifdef __cplusplus
vb@98
    91
}
vb@98
    92
#endif