18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Implementation of the security services.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Author : Stephen Smalley, <sds@tycho.nsa.gov>
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci#ifndef _SS_SERVICES_H_
88c2ecf20Sopenharmony_ci#define _SS_SERVICES_H_
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include "policydb.h"
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/* Mapping for a single class */
138c2ecf20Sopenharmony_cistruct selinux_mapping {
148c2ecf20Sopenharmony_ci	u16 value; /* policy value for class */
158c2ecf20Sopenharmony_ci	unsigned int num_perms; /* number of permissions in class */
168c2ecf20Sopenharmony_ci	u32 perms[sizeof(u32) * 8]; /* policy values for permissions */
178c2ecf20Sopenharmony_ci};
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci/* Map for all of the classes, with array size */
208c2ecf20Sopenharmony_cistruct selinux_map {
218c2ecf20Sopenharmony_ci	struct selinux_mapping *mapping; /* indexed by class */
228c2ecf20Sopenharmony_ci	u16 size; /* array size of mapping */
238c2ecf20Sopenharmony_ci};
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_cistruct selinux_policy {
268c2ecf20Sopenharmony_ci	struct sidtab *sidtab;
278c2ecf20Sopenharmony_ci	struct policydb policydb;
288c2ecf20Sopenharmony_ci	struct selinux_map map;
298c2ecf20Sopenharmony_ci	u32 latest_granting;
308c2ecf20Sopenharmony_ci} __randomize_layout;
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_civoid services_compute_xperms_drivers(struct extended_perms *xperms,
338c2ecf20Sopenharmony_ci				struct avtab_node *node);
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_civoid services_compute_xperms_decision(struct extended_perms_decision *xpermd,
368c2ecf20Sopenharmony_ci					struct avtab_node *node);
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#endif	/* _SS_SERVICES_H_ */
39