mirror of
https://github.com/moparisthebest/spdylay
synced 2024-11-11 20:15:04 -05:00
1dd61d5973
By default, configuration file is /etc/shrpx/shrpx.conf. It can be overridden using --conf option. See shrpx.conf.sample to know how to write shrpx.conf. The configurations given in shrpx.conf will be overridden by the options specified in cmmand-line.
121 lines
3.8 KiB
C++
121 lines
3.8 KiB
C++
/*
|
|
* Spdylay - SPDY Library
|
|
*
|
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining
|
|
* a copy of this software and associated documentation files (the
|
|
* "Software"), to deal in the Software without restriction, including
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
* the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be
|
|
* included in all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
*/
|
|
#ifndef SHRPX_CONFIG_H
|
|
#define SHRPX_CONFIG_H
|
|
|
|
#include "shrpx.h"
|
|
|
|
#include <stdint.h>
|
|
#include <sys/types.h>
|
|
#include <sys/socket.h>
|
|
#include <netinet/in.h>
|
|
#include <arpa/inet.h>
|
|
|
|
namespace shrpx {
|
|
|
|
extern const char SHRPX_OPT_PRIVATE_KEY_FILE[];
|
|
extern const char SHRPX_OPT_CERTIFICATE_FILE[];
|
|
|
|
extern const char SHRPX_OPT_BACKEND[];
|
|
extern const char SHRPX_OPT_FRONTEND[];
|
|
extern const char SHRPX_OPT_WORKERS[];
|
|
extern const char SHRPX_OPT_SPDY_MAX_CONCURRENT_STREAMS[];
|
|
extern const char SHRPX_OPT_LOG_LEVEL[];
|
|
extern const char SHRPX_OPT_DAEMON[];
|
|
extern const char SHRPX_OPT_SPDY_PROXY[];
|
|
extern const char SHRPX_OPT_ADD_X_FORWARDED_FOR[];
|
|
extern const char SHRPX_OPT_FRONTEND_SPDY_READ_TIMEOUT[];
|
|
extern const char SHRPX_OPT_FRONTEND_READ_TIMEOUT[];
|
|
extern const char SHRPX_OPT_FRONTEND_WRITE_TIMEOUT[];
|
|
extern const char SHRPX_OPT_BACKEND_READ_TIMEOUT[];
|
|
extern const char SHRPX_OPT_BACKEND_WRITE_TIMEOUT[];
|
|
extern const char SHRPX_OPT_ACCESSLOG[];
|
|
extern const char SHRPX_OPT_BACKEND_KEEP_ALIVE_TIMEOUT[];
|
|
extern const char SHRPX_OPT_FRONTEND_SPDY_WINDOW_BITS[];
|
|
extern const char SHRPX_OPT_PID_FILE[];
|
|
extern const char SHRPX_OPT_USER[];
|
|
|
|
union sockaddr_union {
|
|
sockaddr sa;
|
|
sockaddr_storage storage;
|
|
sockaddr_in6 in6;
|
|
sockaddr_in in;
|
|
};
|
|
|
|
struct Config {
|
|
bool verbose;
|
|
bool daemon;
|
|
char *host;
|
|
uint16_t port;
|
|
char *private_key_file;
|
|
char *cert_file;
|
|
bool verify_client;
|
|
const char *server_name;
|
|
char *downstream_host;
|
|
uint16_t downstream_port;
|
|
char *downstream_hostport;
|
|
sockaddr_union downstream_addr;
|
|
size_t downstream_addrlen;
|
|
timeval spdy_upstream_read_timeout;
|
|
timeval upstream_read_timeout;
|
|
timeval upstream_write_timeout;
|
|
timeval downstream_read_timeout;
|
|
timeval downstream_write_timeout;
|
|
timeval downstream_idle_read_timeout;
|
|
size_t num_worker;
|
|
size_t spdy_max_concurrent_streams;
|
|
bool spdy_proxy;
|
|
bool add_x_forwarded_for;
|
|
bool accesslog;
|
|
size_t spdy_upstream_window_bits;
|
|
char *pid_file;
|
|
uid_t uid;
|
|
gid_t gid;
|
|
char *conf_path;
|
|
Config();
|
|
};
|
|
|
|
const Config* get_config();
|
|
Config* mod_config();
|
|
void create_config();
|
|
|
|
// Parses option name |opt| and value |optarg|. The results are
|
|
// stored into statically allocated Config object. This function
|
|
// returns 0 if it succeeds, or -1.
|
|
int parse_config(const char *opt, const char *optarg);
|
|
|
|
// Loads configurations from |filename| and stores them in statically
|
|
// allocated Config object. This function returns 0 if it succeeds, or
|
|
// -1.
|
|
int load_config(const char *filename);
|
|
|
|
// Copies NULL-terminated string |val| to |*destp|. If |*destp| is not
|
|
// NULL, it is freed before copying.
|
|
void set_config_str(char **destp, const char *val);
|
|
|
|
} // namespace shrpx
|
|
|
|
#endif // SHRPX_CONFIG_H
|