this repo has no description
1/*
2 * Darling - libquarantine
3 * Copyright (c) 2016 Lubos Dolezel, All rights reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 3.0 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library.
17 */
18
19#ifndef _QUARANTINE_H_
20#define _QUARANTINE_H_
21
22#include <stdint.h>
23#include <stddef.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29#define QTN_NOT_QUARANTINED (-1)
30
31#define QTN_FLAG_SANDBOX 1
32#define QTN_FLAG_HARD 2
33
34#define QTN_FLAG_USER_APPROVED 0x01 << 0
35#define QTN_FLAG_TRANSLOCATE 0x01 << 1
36#define QTN_FLAG_DO_NOT_TRANSLOCATE 0x01 << 2
37
38typedef struct _qtn_file_s *qtn_file_t;
39
40extern qtn_file_t _qtn_file_alloc();
41extern void _qtn_file_free(qtn_file_t file);
42
43extern qtn_file_t _qtn_file_clone(qtn_file_t file);
44
45extern int _qtn_file_init_with_fd(qtn_file_t file, int fd);
46extern int _qtn_file_apply_to_fd(qtn_file_t file, int fd);
47extern int _qtn_file_apply_to_path(qtn_file_t file, const char* path);
48
49extern int _qtn_file_init_with_path(qtn_file_t file, const char *path);
50
51extern int _qtn_file_init_with_data(qtn_file_t file, const void *, size_t);
52extern int _qtn_file_to_data(qtn_file_t file, void *, size_t*);
53extern int _qtn_file_set_flags(qtn_file_t file, uint32_t flags);
54extern uint32_t _qtn_file_get_flags(qtn_file_t file);
55
56extern const char *_qtn_error(int err);
57
58extern const char *_qtn_xattr_name;
59
60extern int __esp_enabled();
61extern int __esp_check_ns(const char *a, void *b);
62extern int __esp_notify_ns(const char *a, void *b);
63
64typedef struct _qtn_proc_t* qtn_proc_t;
65qtn_proc_t qtn_proc_alloc(void);
66void qtn_proc_set_identifier(qtn_proc_t proc, const char* ident);
67void qtn_proc_set_flags(qtn_proc_t proc, unsigned int flags);
68int qtn_proc_apply_to_self(qtn_proc_t proc);
69void qtn_proc_free(qtn_proc_t proc);
70
71extern int qtn_file_init_with_mount_point(qtn_file_t a, char b[1024]);
72
73extern int qtn_file_apply_to_mount_point(qtn_file_t a, const char *b);
74
75int qtn_proc_init_with_data(qtn_proc_t proc, void* data, size_t data_len);
76
77#define QTN_SERIALIZED_DATA_MAX 4096
78
79#define qtn_file_alloc _qtn_file_alloc
80#define qtn_file_free _qtn_file_free
81
82#define qtn_file_clone _qtn_file_clone
83#define qtn_file_set_flags _qtn_file_set_flags
84#define qtn_file_get_flags _qtn_file_get_flags
85
86#define qtn_file_init_with_fd _qtn_file_init_with_fd
87#define qtn_file_apply_to_fd _qtn_file_apply_to_fd
88#define qtn_file_apply_to_path _qtn_file_apply_to_path
89
90#define qtn_file_init_with_path _qtn_file_init_with_path
91
92#define qtn_file_init_with_data _qtn_file_init_with_data
93#define qtn_file_to_data _qtn_file_to_data
94
95#define qtn_error _qtn_error
96
97#define qtn_xattr_name _qtn_xattr_name
98
99#ifdef __cplusplus
100}
101#endif
102
103#endif
104