-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfig.h
41 lines (34 loc) · 906 Bytes
/
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
/**
* @license
* Copyright Bleenco GmbH. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/bleenco/bproxy
*/
#ifndef _BPROXY_CONFIG_H_
#define _BPROXY_CONFIG_H_
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "jsmn.h"
#define CONFIG_MAX_HOSTS 10
#define CONFIG_MAX_GZIP_MIME_TYPES 20
#define CONFIG_MAX_PROXIES 100
typedef struct proxy_config_t
{
char *hosts[CONFIG_MAX_HOSTS];
char *ip;
unsigned short port;
int num_hosts;
} proxy_config_t;
typedef struct config_t
{
unsigned short port;
char *gzip_mime_types[CONFIG_MAX_GZIP_MIME_TYPES];
int num_gzip_mime_types;
proxy_config_t *proxies[CONFIG_MAX_PROXIES];
int num_proxies;
} config_t;
char *read_file(char *path);
void parse_config(const char *json_string, config_t *config);
#endif // _BPROXY_CONFIG_H_