1 // This file is under GNU General Public License 3.0
6 #include "dynamic_api.h"
13 typedef struct _keyreset_command {
18 // new_keyreset_command() - allocate new keyreset_command
21 // ident (in) identity to reset, including fpr of existing key
22 // new_key (in) fpr of new key
25 // pointer to keyreset_command or NULL on failure
28 // ident, new_key are copied and remain in the ownership of the caller
30 DYNAMIC_API keyreset_command * new_keyreset_command(const pEp_identity * ident, const char * new_key);
33 // free_keyreset_command() - free memory allocated by keyreset_command
36 // command (in) pointer to keyreset_command to free
38 DYNAMIC_API void free_keyreset_command(keyreset_command * command);
41 // keyreset_command_dup() - duplicate keyreset_command (deep copy)
44 // src (in) pointer to keyreset_command to duplicate
47 // pointer to copy of src or NULL on failure
49 DYNAMIC_API keyreset_command * keyreset_command_dup(const keyreset_command * src);
52 typedef struct _keyreset_command_list {
53 keyreset_command * command;
54 struct _keyreset_command_list * next;
55 } keyreset_command_list;
58 // new_keyreset_command_list() - allocate a new keyreset_command_list
61 // command (in) initial command
64 // pointer to keyreset_command_list object or NULL if out of memory
67 // the ownership of the command goes to the keyreset_command_list
68 // next pointer is NULL
70 DYNAMIC_API keyreset_command_list * new_keyreset_command_list(keyreset_command * command);
73 // keyreset_command_list_dup() - duplicate a keyreset_command_list (deep copy)
76 // src (in) keyreset_command_list to copy
79 // pointer to keyreset_command_list object or NULL if out of memory
80 // keyreset_command command copies created by this function belong to the returned list
82 DYNAMIC_API keyreset_command_list * keyreset_command_list_dup(
83 const keyreset_command_list * src
87 // keyreset_command_list_add() - add key to keyreset_command_list
90 // command_list (in) keyreset_command_list struct or NULL to create a new one
91 // command (in) keyreset_command to add
94 // pointer to last element in keyreset_command_list or NULL if out of memory
97 // the ownership of the command goes to the keyreset_command_list if add is successful
99 DYNAMIC_API keyreset_command_list * keyreset_command_list_add(
100 keyreset_command_list * command_list,
101 keyreset_command * command
105 // keyreset_command_list_append() - append keyreset_command_list to keyreset_command_list
108 // command_list (in) keyreset_command_list struct to append to
109 // second (in) keyreset_command_list struct to append
112 // pointer to last element in command_list or NULL if out of memory
113 // or command_list is NULL
116 // all commands are being copied before being added to the list
117 // the original commands are still being owned by the caller
119 DYNAMIC_API keyreset_command_list * keyreset_command_list_append(
120 keyreset_command_list * command_list,
121 keyreset_command_list * second
125 // keyreset_command_list_length() - get length of keyreset_command_list
128 // command_list (in) keyreset_command_list struct to determine length of
131 // length of command_list in number of elements
133 DYNAMIC_API int keyreset_command_list_length(
134 const keyreset_command_list * command_list
138 // free_keyreset_command_list() - free memory occupied by command_list
141 // command_list (in) keyreset_command_list to free
143 DYNAMIC_API void free_keyreset_command_list(keyreset_command_list * command_list);