-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathconfig.h
99 lines (83 loc) · 2.5 KB
/
config.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
* mptsd configuration header file
* Copyright (C) 2010-2011 Unix Solutions Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*/
#ifndef CONFIG_H
#define CONFIG_H
#include <pthread.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include "libfuncs/libfuncs.h"
typedef enum { udp_sock, tcp_sock } channel_source;
typedef struct {
channel_source sproto;
char *proto;
char *host;
char *path;
unsigned int port;
} CHANSRC;
#define MAX_CHANNEL_SOURCES 8
typedef struct {
char *name;
char *source; /* Full source url */
char *sources[MAX_CHANNEL_SOURCES];
uint8_t num_src;
uint8_t curr_src;
char *dest_host;
int dest_port;
} CHANNEL;
typedef struct {
char *name;
CHANNEL *channel;
int sock; /* Server socket */
struct sockaddr_in src_sockname;
int clientsock; /* The udp socket */
struct sockaddr_in dst_sockname;
int reconnect:1, /* Set to 1 to force proxy reconnect */
connected:1, /* It's set to 1 when proxy is connected and serving clients */
dienow:1, /* Stop serving clients and exit now */
hibernate:1, /* Sleep channel (while nobody uses him) */
freechannel:1; /* Free channel data on object free (this is used in chanconf) */
int cookie; /* Used in chanconf to determine if the restreamer is alrady checked */
pthread_t thread;
pthread_rwlock_t lock;
time_t conn_ts;
uint64_t read_bytes;
int64_t last_decrypted_input_ts;
char status[64];
} RESTREAMER;
struct config {
char *ident;
char *pidfile;
int syslog_active;
char *logident;
char *loghost;
int logport;
struct sockaddr_in server;
char *server_addr;
int server_port;
int server_socket;
pthread_t server_thread;
int detect_encrypted_input;
char *channels_file;
LIST *chanconf;
LIST *restreamer;
pthread_mutex_t channels_lock;
};
extern void do_reconnect(int sig);
extern void do_reconf(int sig);
extern struct config *get_config(void);
#endif