You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

129 lines
3.0 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
1 year ago
7 years ago
  1. /**
  2. * @file identity_list.h
  3. * @brief identity list functions and data structures (@see pEpIdentity)
  4. * @license GNU General Public License 3.0 - see LICENSE.txt
  5. */
  6. #ifndef IDENTITY_LIST_H
  7. #define IDENTITY_LIST_H
  8. #include "pEpEngine.h"
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. /**
  13. * <!-- new_identity_list() -->
  14. *
  15. * @brief Allocate a new identity list
  16. *
  17. * @param[in] ident identity to move for first element
  18. *
  19. * @retval new identity_list or NULL if out of memory
  20. *
  21. * @warning ident is being moved if the function succeeds, the caller loses
  22. * ownership
  23. *
  24. */
  25. DYNAMIC_API identity_list *new_identity_list(pEp_identity *ident);
  26. /**
  27. * <!-- identity_list_dup() -->
  28. *
  29. * @brief Duplicate identity_list (deep copy)
  30. *
  31. * @param[in] id_list identity_list to copy
  32. *
  33. * @retval new identity_list or NULL if out of memory
  34. *
  35. *
  36. */
  37. DYNAMIC_API identity_list *identity_list_dup(const identity_list *src);
  38. /**
  39. * <!-- free_identity_list() -->
  40. *
  41. * @brief Free memory allocated by identity_list
  42. *
  43. * @param[in] id_list identity_list to free
  44. *
  45. * @warning this function frees all identities in the list additional to the
  46. * identity_list itself
  47. *
  48. */
  49. DYNAMIC_API void free_identity_list(identity_list *id_list);
  50. /**
  51. * <!-- identity_list_add() -->
  52. *
  53. * @brief Add identity to an identity_list
  54. *
  55. * @param[in] id_list identity_list to add to
  56. * @param[in] ident identity being added
  57. *
  58. * @retval pointer to the last element in identity_list or NULL if out of memory
  59. *
  60. * @warning ident is being moved, the caller loses ownership if the function is
  61. * successful
  62. *
  63. */
  64. DYNAMIC_API identity_list *identity_list_add(identity_list *id_list, pEp_identity *ident);
  65. /**
  66. * <!-- identity_list_add() -->
  67. *
  68. * @brief Join second identity_list to the first.
  69. *
  70. * @param[in] first_list identity_list to add to
  71. * @param[in] second_list identity list to add
  72. *
  73. * @retval pointer to the HEAD of the new list, or NULL if both lists are empty.
  74. *
  75. *
  76. */
  77. DYNAMIC_API identity_list *identity_list_join(identity_list *first_list, identity_list* second_list);
  78. /**
  79. * <!-- identity_list_length() -->
  80. *
  81. * @brief Get length of identity_list
  82. *
  83. * @param[in] id_list identity_list struct to determine length of
  84. *
  85. * @retval length of identity_list in number of elements
  86. *
  87. *
  88. */
  89. DYNAMIC_API int identity_list_length(const identity_list *id_list);
  90. // Internal
  91. /**
  92. * <!-- set_all_userids_in_list() -->
  93. *
  94. * @brief TODO
  95. *
  96. * @param[in] id_list identity_list*
  97. * @param[in] user_id const char*
  98. *
  99. * @retval PEP_STATUS_OK
  100. * @retval PEP_ILLEGAL_VALUE illegal parameter values
  101. * @retval PEP_OUT_OF_MEMORY out of memory
  102. *
  103. */
  104. PEP_STATUS set_all_userids_in_list(identity_list* id_list, const char* user_id);
  105. #ifdef __cplusplus
  106. }
  107. #endif
  108. #endif