18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * NetLabel NETLINK Interface
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * This file defines the NETLINK interface for the NetLabel system.  The
68c2ecf20Sopenharmony_ci * NetLabel system manages static and dynamic label mappings for network
78c2ecf20Sopenharmony_ci * protocols such as CIPSO and RIPSO.
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * Author: Paul Moore <paul@paul-moore.com>
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/*
138c2ecf20Sopenharmony_ci * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
148c2ecf20Sopenharmony_ci */
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#ifndef _NETLABEL_USER_H
178c2ecf20Sopenharmony_ci#define _NETLABEL_USER_H
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#include <linux/types.h>
208c2ecf20Sopenharmony_ci#include <linux/skbuff.h>
218c2ecf20Sopenharmony_ci#include <linux/capability.h>
228c2ecf20Sopenharmony_ci#include <linux/audit.h>
238c2ecf20Sopenharmony_ci#include <net/netlink.h>
248c2ecf20Sopenharmony_ci#include <net/genetlink.h>
258c2ecf20Sopenharmony_ci#include <net/netlabel.h>
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci/* NetLabel NETLINK helper functions */
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci/**
308c2ecf20Sopenharmony_ci * netlbl_netlink_auditinfo - Fetch the audit information from a NETLINK msg
318c2ecf20Sopenharmony_ci * @audit_info: NetLabel audit information
328c2ecf20Sopenharmony_ci */
338c2ecf20Sopenharmony_cistatic inline void netlbl_netlink_auditinfo(struct netlbl_audit *audit_info)
348c2ecf20Sopenharmony_ci{
358c2ecf20Sopenharmony_ci	security_task_getsecid(current, &audit_info->secid);
368c2ecf20Sopenharmony_ci	audit_info->loginuid = audit_get_loginuid(current);
378c2ecf20Sopenharmony_ci	audit_info->sessionid = audit_get_sessionid(current);
388c2ecf20Sopenharmony_ci}
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci/* NetLabel NETLINK I/O functions */
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ciint netlbl_netlink_init(void);
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/* NetLabel Audit Functions */
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_cistruct audit_buffer *netlbl_audit_start_common(int type,
478c2ecf20Sopenharmony_ci					      struct netlbl_audit *audit_info);
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci#endif
50