2
* Copyright (C) 2008, 2010 Red Hat, Inc.
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2.1 of the License, or (at your option) any later version.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with this library. If not, see
16
* <http://www.gnu.org/licenses/>.
19
* James Morris <jmorris@namei.org>
22
#ifndef __VIR_SECURITY_H__
23
# define __VIR_SECURITY_H__
25
# include "internal.h"
26
# include "domain_conf.h"
28
# include "security_manager.h"
31
* Return values for security driver probing: the driver will determine
32
* whether it should be enabled or disabled.
35
SECURITY_DRIVER_ENABLE = 0,
36
SECURITY_DRIVER_ERROR = -1,
37
SECURITY_DRIVER_DISABLE = -2,
38
} virSecurityDriverStatus;
40
typedef struct _virSecurityDriver virSecurityDriver;
41
typedef virSecurityDriver *virSecurityDriverPtr;
43
typedef virSecurityDriverStatus (*virSecurityDriverProbe) (const char *virtDriver);
44
typedef int (*virSecurityDriverOpen) (virSecurityManagerPtr mgr);
45
typedef int (*virSecurityDriverClose) (virSecurityManagerPtr mgr);
47
typedef const char *(*virSecurityDriverGetModel) (virSecurityManagerPtr mgr);
48
typedef const char *(*virSecurityDriverGetDOI) (virSecurityManagerPtr mgr);
50
typedef int (*virSecurityDomainRestoreImageLabel) (virSecurityManagerPtr mgr,
52
virDomainDiskDefPtr disk);
53
typedef int (*virSecurityDomainSetDaemonSocketLabel)(virSecurityManagerPtr mgr,
55
typedef int (*virSecurityDomainSetSocketLabel) (virSecurityManagerPtr mgr,
57
typedef int (*virSecurityDomainClearSocketLabel)(virSecurityManagerPtr mgr,
59
typedef int (*virSecurityDomainSetImageLabel) (virSecurityManagerPtr mgr,
61
virDomainDiskDefPtr disk);
62
typedef int (*virSecurityDomainRestoreHostdevLabel) (virSecurityManagerPtr mgr,
64
virDomainHostdevDefPtr dev);
65
typedef int (*virSecurityDomainSetHostdevLabel) (virSecurityManagerPtr mgr,
67
virDomainHostdevDefPtr dev);
68
typedef int (*virSecurityDomainSetSavedStateLabel) (virSecurityManagerPtr mgr,
70
const char *savefile);
71
typedef int (*virSecurityDomainRestoreSavedStateLabel) (virSecurityManagerPtr mgr,
73
const char *savefile);
74
typedef int (*virSecurityDomainGenLabel) (virSecurityManagerPtr mgr,
76
typedef int (*virSecurityDomainReserveLabel) (virSecurityManagerPtr mgr,
79
typedef int (*virSecurityDomainReleaseLabel) (virSecurityManagerPtr mgr,
81
typedef int (*virSecurityDomainSetAllLabel) (virSecurityManagerPtr mgr,
83
const char *stdin_path);
84
typedef int (*virSecurityDomainRestoreAllLabel) (virSecurityManagerPtr mgr,
87
typedef int (*virSecurityDomainGetProcessLabel) (virSecurityManagerPtr mgr,
90
virSecurityLabelPtr sec);
91
typedef int (*virSecurityDomainSetProcessLabel) (virSecurityManagerPtr mgr,
93
typedef int (*virSecurityDomainSecurityVerify) (virSecurityManagerPtr mgr,
95
typedef int (*virSecurityDomainSetImageFDLabel) (virSecurityManagerPtr mgr,
98
typedef int (*virSecurityDomainSetTapFDLabel) (virSecurityManagerPtr mgr,
101
typedef char *(*virSecurityDomainGetMountOptions) (virSecurityManagerPtr mgr,
102
virDomainDefPtr def);
104
struct _virSecurityDriver {
105
size_t privateDataLen;
107
virSecurityDriverProbe probe;
108
virSecurityDriverOpen open;
109
virSecurityDriverClose close;
111
virSecurityDriverGetModel getModel;
112
virSecurityDriverGetDOI getDOI;
114
virSecurityDomainSecurityVerify domainSecurityVerify;
116
virSecurityDomainSetImageLabel domainSetSecurityImageLabel;
117
virSecurityDomainRestoreImageLabel domainRestoreSecurityImageLabel;
119
virSecurityDomainSetDaemonSocketLabel domainSetSecurityDaemonSocketLabel;
120
virSecurityDomainSetSocketLabel domainSetSecuritySocketLabel;
121
virSecurityDomainClearSocketLabel domainClearSecuritySocketLabel;
123
virSecurityDomainGenLabel domainGenSecurityLabel;
124
virSecurityDomainReserveLabel domainReserveSecurityLabel;
125
virSecurityDomainReleaseLabel domainReleaseSecurityLabel;
127
virSecurityDomainGetProcessLabel domainGetSecurityProcessLabel;
128
virSecurityDomainSetProcessLabel domainSetSecurityProcessLabel;
130
virSecurityDomainSetAllLabel domainSetSecurityAllLabel;
131
virSecurityDomainRestoreAllLabel domainRestoreSecurityAllLabel;
133
virSecurityDomainSetHostdevLabel domainSetSecurityHostdevLabel;
134
virSecurityDomainRestoreHostdevLabel domainRestoreSecurityHostdevLabel;
136
virSecurityDomainSetSavedStateLabel domainSetSavedStateLabel;
137
virSecurityDomainRestoreSavedStateLabel domainRestoreSavedStateLabel;
139
virSecurityDomainSetImageFDLabel domainSetSecurityImageFDLabel;
140
virSecurityDomainSetTapFDLabel domainSetSecurityTapFDLabel;
142
virSecurityDomainGetMountOptions domainGetSecurityMountOptions;
145
virSecurityDriverPtr virSecurityDriverLookup(const char *name,
146
const char *virtDriver);
148
#endif /* __VIR_SECURITY_H__ */