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