-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
globals.h
63 lines (52 loc) · 1.12 KB
/
globals.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef GLOBALS_H_
#define GLOBALS_H_
#include <stddef.h>
#include <sys/types.h>
#include <signal.h>
#include <pthread.h>
#include <libssh/server.h>
struct connection_info_t {
struct connection_info_t* prev;
struct connection_info_t* next;
ssh_session session;
ssh_event event;
pthread_t thread;
int port;
int my_port;
char ipstr[INET6_ADDRSTRLEN];
char my_ipstr[INET6_ADDRSTRLEN];
};
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpadded"
struct globals_t {
char* rsa_key;
char* dsa_key;
char* ecdsa_key;
char* ed25519_key;
char* bind_address;
char* bind_port;
#ifndef MINIMALISTIC_BUILD
char* pid_file;
char* daemon_name;
#endif
ssh_bind sshbind;
pthread_mutex_t mutex;
struct connection_info_t* head;
struct connection_info_t* tail;
volatile size_t n_threads;
volatile sig_atomic_t terminate;
#ifndef MINIMALISTIC_BUILD
int pid_fd;
int foreground;
int no_syslog;
int uid_set;
int gid_set;
uid_t uid;
gid_t gid;
#endif
};
#pragma clang diagnostic pop
extern struct globals_t globals;
void init_globals(struct globals_t* g);
void free_globals(struct globals_t* g);
#endif /* GLOBALS_H_ */