src/identity_list.h
author Volker Birk <vb@pep-project.org>
Thu, 30 Apr 2015 19:01:58 +0200
changeset 230 5b36a2663539
parent 105 bdd627440076
child 730 de7942336904
permissions -rw-r--r--
adding _length() functions
vb@98
     1
#pragma once
vb@98
     2
vb@105
     3
#include "pEpEngine.h"
vb@98
     4
vb@98
     5
#ifdef __cplusplus
vb@98
     6
extern "C" {
vb@98
     7
#endif
vb@98
     8
vb@98
     9
vb@98
    10
typedef struct _identity_list {
vb@98
    11
    pEp_identity *ident;
vb@98
    12
    struct _identity_list *next;
vb@98
    13
} identity_list;
vb@98
    14
vb@98
    15
vb@98
    16
// new_identity_list() - allocate a new identity list
vb@98
    17
//
vb@98
    18
//  parameters:
vb@98
    19
//      ident (in)          identity to move for first element
vb@98
    20
//
vb@98
    21
//  return value:
vb@98
    22
//      new identity_list or NULL if out of memory
vb@98
    23
//
vb@98
    24
//  caveat:
vb@98
    25
//      ident is being moved if the function succeeds, the caller loses
vb@98
    26
//      ownership
vb@98
    27
vb@98
    28
DYNAMIC_API identity_list *new_identity_list(pEp_identity *ident);
vb@98
    29
vb@98
    30
vb@98
    31
// identity_list_dup() - duplicate identity_list (deep copy)
vb@98
    32
//
vb@98
    33
//  parameters:
vb@98
    34
//      id_list (in)        identity_list to copy
vb@98
    35
//
vb@98
    36
//  return value:
vb@98
    37
//      new identity_list or NULL if out of memory
vb@98
    38
vb@98
    39
DYNAMIC_API identity_list *identity_list_dup(const identity_list *src);
vb@98
    40
vb@98
    41
vb@98
    42
// free_identity_list() - free memory allocated by identity_list
vb@98
    43
//
vb@98
    44
//  parameters:
vb@98
    45
//      id_list (in)        identity_list to free
vb@98
    46
//
vb@98
    47
//  caveat:
vb@98
    48
//      this function frees all identities in the list additional to the
vb@98
    49
//      identity_list itself
vb@98
    50
vb@98
    51
DYNAMIC_API void free_identity_list(identity_list *id_list);
vb@98
    52
vb@98
    53
vb@98
    54
// identity_list_add - add identity to an identity_list
vb@98
    55
//
vb@98
    56
//  parameters:
vb@98
    57
//      id_list (in)        identity_list to add to
vb@98
    58
//      ident (in)          identity being added
vb@98
    59
//
vb@98
    60
//  return value:
vb@98
    61
//      pointer to the last element in identity_list or NULL if out of memory
vb@98
    62
//
vb@98
    63
//  caveat:
vb@98
    64
//      ident is being moved, the caller loses ownership if the function is
vb@98
    65
//      successful
vb@98
    66
vb@98
    67
DYNAMIC_API identity_list *identity_list_add(identity_list *id_list, pEp_identity *ident);
vb@98
    68
vb@98
    69
vb@230
    70
// identity_list_length() - get length of identity_list
vb@230
    71
//
vb@230
    72
//  parameters:
vb@230
    73
//      id_list (in)        identity_list struct to determine length of
vb@230
    74
//
vb@230
    75
//  return value:
vb@230
    76
//      length of identity_list in number of elements
vb@230
    77
vb@230
    78
DYNAMIC_API int identity_list_length(const identity_list *id_list);
vb@230
    79
vb@230
    80
vb@98
    81
#ifdef __cplusplus
vb@98
    82
}
vb@98
    83
#endif
vb@98
    84