Skip to content

Commit

Permalink
Add Configuration structure
Browse files Browse the repository at this point in the history
  • Loading branch information
usbuild committed Aug 9, 2012
1 parent 193a34e commit 5b4344d
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.o
uws
3 changes: 3 additions & 0 deletions uws.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#define OPT_LEN 20
#define VLU_LEN 50
#define PATH_LEN 512
#define bool int
#define true 1
#define false 0


void exit_err(const char* str);
Expand Down
42 changes: 42 additions & 0 deletions uws_config.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,48 @@
#ifndef __UWS_CONFIG_H__
#define __UWS_CONFIG_H__
#define CONFIG_FILE "uws.conf"

//config struct defined here
typedef struct{
char* root;
char** index;
char* server_name;
} server_cfg_t;

struct events_cfg{
int worker_connections;
};

struct http_cfg{
bool sendfile;
bool tcp_nopush;
bool tcp_nodelay;
int keepalive_timeout;
int types_hash_max_size;
bool server_tokens;
int server_names_hash_bucket_size;
char* access_log;
char* error_log;
bool gzip;
char* gzip_disable;
bool gzip_vary;
char* gzip_proxied;
int gzip_comp_level;
char* gzip_http_version;
char** gzip_types;
};

typedef struct{
char* user;
int worker_processes;
char* pid;
struct events_cfg events;
struct http_cfg http;
server_cfg_t* servers;
} uws_config_t;

//config end here

char* get_opt(const char* option) ;

void init_config();
Expand Down

0 comments on commit 5b4344d

Please sign in to comment.