src/identity_list.h
changeset 98 9e3d28932e7b
child 105 bdd627440076
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/identity_list.h	Wed Mar 11 11:52:14 2015 +0100
     1.3 @@ -0,0 +1,73 @@
     1.4 +#pragma once
     1.5 +
     1.6 +#include "dynamic_api.h"
     1.7 +
     1.8 +#ifdef __cplusplus
     1.9 +extern "C" {
    1.10 +#endif
    1.11 +
    1.12 +
    1.13 +typedef struct _identity_list {
    1.14 +    pEp_identity *ident;
    1.15 +    struct _identity_list *next;
    1.16 +} identity_list;
    1.17 +
    1.18 +
    1.19 +// new_identity_list() - allocate a new identity list
    1.20 +//
    1.21 +//  parameters:
    1.22 +//      ident (in)          identity to move for first element
    1.23 +//
    1.24 +//  return value:
    1.25 +//      new identity_list or NULL if out of memory
    1.26 +//
    1.27 +//  caveat:
    1.28 +//      ident is being moved if the function succeeds, the caller loses
    1.29 +//      ownership
    1.30 +
    1.31 +DYNAMIC_API identity_list *new_identity_list(pEp_identity *ident);
    1.32 +
    1.33 +
    1.34 +// identity_list_dup() - duplicate identity_list (deep copy)
    1.35 +//
    1.36 +//  parameters:
    1.37 +//      id_list (in)        identity_list to copy
    1.38 +//
    1.39 +//  return value:
    1.40 +//      new identity_list or NULL if out of memory
    1.41 +
    1.42 +DYNAMIC_API identity_list *identity_list_dup(const identity_list *src);
    1.43 +
    1.44 +
    1.45 +// free_identity_list() - free memory allocated by identity_list
    1.46 +//
    1.47 +//  parameters:
    1.48 +//      id_list (in)        identity_list to free
    1.49 +//
    1.50 +//  caveat:
    1.51 +//      this function frees all identities in the list additional to the
    1.52 +//      identity_list itself
    1.53 +
    1.54 +DYNAMIC_API void free_identity_list(identity_list *id_list);
    1.55 +
    1.56 +
    1.57 +// identity_list_add - add identity to an identity_list
    1.58 +//
    1.59 +//  parameters:
    1.60 +//      id_list (in)        identity_list to add to
    1.61 +//      ident (in)          identity being added
    1.62 +//
    1.63 +//  return value:
    1.64 +//      pointer to the last element in identity_list or NULL if out of memory
    1.65 +//
    1.66 +//  caveat:
    1.67 +//      ident is being moved, the caller loses ownership if the function is
    1.68 +//      successful
    1.69 +
    1.70 +DYNAMIC_API identity_list *identity_list_add(identity_list *id_list, pEp_identity *ident);
    1.71 +
    1.72 +
    1.73 +#ifdef __cplusplus
    1.74 +}
    1.75 +#endif
    1.76 +