2016-05-28 12:43:23 +00:00
|
|
|
/*
|
|
|
|
* virsecret.h: secret utility functions
|
|
|
|
*
|
|
|
|
* Copyright (C) 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/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-06-18 16:13:08 +00:00
|
|
|
#pragma once
|
2016-05-28 12:43:23 +00:00
|
|
|
|
2019-06-18 16:13:08 +00:00
|
|
|
#include "internal.h"
|
2016-05-28 12:43:23 +00:00
|
|
|
|
2019-06-18 16:13:08 +00:00
|
|
|
#include "virxml.h"
|
|
|
|
#include "virenum.h"
|
2016-06-13 20:23:42 +00:00
|
|
|
|
2019-01-20 16:04:56 +00:00
|
|
|
VIR_ENUM_DECL(virSecretUsage);
|
2017-09-15 18:55:46 +00:00
|
|
|
|
2016-05-28 12:43:23 +00:00
|
|
|
typedef enum {
|
|
|
|
VIR_SECRET_LOOKUP_TYPE_NONE,
|
|
|
|
VIR_SECRET_LOOKUP_TYPE_UUID,
|
|
|
|
VIR_SECRET_LOOKUP_TYPE_USAGE,
|
|
|
|
|
|
|
|
VIR_SECRET_LOOKUP_TYPE_LAST
|
|
|
|
} virSecretLookupType;
|
|
|
|
|
|
|
|
typedef struct _virSecretLookupTypeDef virSecretLookupTypeDef;
|
|
|
|
struct _virSecretLookupTypeDef {
|
|
|
|
int type; /* virSecretLookupType */
|
|
|
|
union {
|
|
|
|
unsigned char uuid[VIR_UUID_BUFLEN];
|
|
|
|
char *usage;
|
|
|
|
} u;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
void virSecretLookupDefClear(virSecretLookupTypeDef *def);
|
|
|
|
void virSecretLookupDefCopy(virSecretLookupTypeDef *dst,
|
2020-03-19 14:27:40 +00:00
|
|
|
const virSecretLookupTypeDef *src);
|
2016-06-13 20:23:42 +00:00
|
|
|
int virSecretLookupParseSecret(xmlNodePtr secretnode,
|
2021-03-11 07:16:13 +00:00
|
|
|
virSecretLookupTypeDef *def);
|
|
|
|
void virSecretLookupFormatSecret(virBuffer *buf,
|
2016-06-13 23:40:34 +00:00
|
|
|
const char *secrettype,
|
2021-03-11 07:16:13 +00:00
|
|
|
virSecretLookupTypeDef *def);
|
2019-10-24 16:00:55 +00:00
|
|
|
|
|
|
|
int virSecretGetSecretString(virConnectPtr conn,
|
2021-03-11 07:16:13 +00:00
|
|
|
virSecretLookupTypeDef *seclookupdef,
|
2019-10-24 16:00:55 +00:00
|
|
|
virSecretUsageType secretUsageType,
|
|
|
|
uint8_t **ret_secret,
|
|
|
|
size_t *ret_secret_size)
|
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4)
|
|
|
|
ATTRIBUTE_NONNULL(5) G_GNUC_WARN_UNUSED_RESULT;
|