diff options
Diffstat (limited to 'src/fnetlock/fnetlock.h')
-rw-r--r-- | src/fnetlock/fnetlock.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/fnetlock/fnetlock.h b/src/fnetlock/fnetlock.h new file mode 100644 index 000000000..018f58223 --- /dev/null +++ b/src/fnetlock/fnetlock.h | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2014-2023 Firejail Authors | ||
3 | * | ||
4 | * This file is part of firejail project | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
19 | */ | ||
20 | #ifndef FNETLOCK_H | ||
21 | #define FNETLOCK_H | ||
22 | |||
23 | #include "../include/common.h" | ||
24 | #include <unistd.h> | ||
25 | #include <sys/stat.h> | ||
26 | #include <sys/types.h> | ||
27 | #include <sys/socket.h> | ||
28 | #include <netinet/in.h> | ||
29 | #include <time.h> | ||
30 | #include <stdarg.h> | ||
31 | #include <fcntl.h> | ||
32 | #include <sys/mman.h> | ||
33 | |||
34 | |||
35 | //#define DEBUG 1 | ||
36 | |||
37 | #define NETLOCK_INTERVAL 60 // seconds | ||
38 | |||
39 | static inline uint8_t hash(uint32_t ip) { | ||
40 | uint8_t *ptr = (uint8_t *) &ip; | ||
41 | // simple byte xor | ||
42 | return *ptr ^ *(ptr + 1) ^ *(ptr + 2) ^ *(ptr + 3); | ||
43 | } | ||
44 | |||
45 | // main.c | ||
46 | void logprintf(char* fmt, ...); | ||
47 | |||
48 | // tail.c | ||
49 | void tail(const char *logfile); | ||
50 | |||
51 | #endif | ||