virsecretobj.h 3.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
/*
 * virsecretobj.h: internal <secret> objects handling
 *
 * Copyright (C) 2009-2010, 2013-2014, 2016 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.  If not, see
 * <http://www.gnu.org/licenses/>.
 */

#ifndef __VIRSECRETOBJ_H__
# define __VIRSECRETOBJ_H__

# include "internal.h"

# include "secret_conf.h"
27
# include "virobject.h"
28 29 30 31

typedef struct _virSecretObj virSecretObj;
typedef virSecretObj *virSecretObjPtr;

32
void
33
virSecretObjEndAPI(virSecretObjPtr *obj);
34 35 36 37

typedef struct _virSecretObjList virSecretObjList;
typedef virSecretObjList *virSecretObjListPtr;

38 39 40 41 42 43 44 45 46 47 48 49 50 51
virSecretObjListPtr
virSecretObjListNew(void);

virSecretObjPtr
virSecretObjListFindByUUID(virSecretObjListPtr secrets,
                           const unsigned char *uuid);

virSecretObjPtr
virSecretObjListFindByUsage(virSecretObjListPtr secrets,
                            int usageType,
                            const char *usageID);

void
virSecretObjListRemove(virSecretObjListPtr secrets,
52
                       virSecretObjPtr obj);
53 54 55

virSecretObjPtr
virSecretObjListAdd(virSecretObjListPtr secrets,
56
                    virSecretDefPtr newdef,
57 58 59 60 61 62 63 64 65 66 67
                    const char *configDir,
                    virSecretDefPtr *oldDef);

typedef bool
(*virSecretObjListACLFilter)(virConnectPtr conn,
                             virSecretDefPtr def);

int
virSecretObjListNumOfSecrets(virSecretObjListPtr secrets,
                             virSecretObjListACLFilter filter,
                             virConnectPtr conn);
68

69 70 71 72 73 74
int
virSecretObjListExport(virConnectPtr conn,
                       virSecretObjListPtr secretobjs,
                       virSecretPtr **secrets,
                       virSecretObjListACLFilter filter,
                       unsigned int flags);
75

76 77 78
int
virSecretObjListGetUUIDs(virSecretObjListPtr secrets,
                         char **uuids,
79
                         int maxuuids,
80 81
                         virSecretObjListACLFilter filter,
                         virConnectPtr conn);
82

83
int
84
virSecretObjDeleteConfig(virSecretObjPtr obj);
85

86
void
87
virSecretObjDeleteData(virSecretObjPtr obj);
88

89
int
90
virSecretObjSaveConfig(virSecretObjPtr obj);
91

92
int
93
virSecretObjSaveData(virSecretObjPtr obj);
94

95
virSecretDefPtr
96
virSecretObjGetDef(virSecretObjPtr obj);
97

98
void
99
virSecretObjSetDef(virSecretObjPtr obj,
100
                   virSecretDefPtr def);
101

102
unsigned char *
103
virSecretObjGetValue(virSecretObjPtr obj);
104

105
int
106
virSecretObjSetValue(virSecretObjPtr obj,
107 108
                     const unsigned char *value,
                     size_t value_size);
109

110
size_t
111
virSecretObjGetValueSize(virSecretObjPtr obj);
112

113
void
114
virSecretObjSetValueSize(virSecretObjPtr obj,
115
                         size_t value_size);
116

117 118 119
int
virSecretLoadAllConfigs(virSecretObjListPtr secrets,
                        const char *configDir);
120

121
#endif /* __VIRSECRETOBJ_H__ */