57 lines
1004 B
C
57 lines
1004 B
C
|
#ifndef _CONFIG_H_
|
||
|
#define _CONFIG_H_
|
||
|
#include <ncurses.h>
|
||
|
#include <openssl/ssl.h>
|
||
|
|
||
|
#include "response.h"
|
||
|
#include "url.h"
|
||
|
|
||
|
/**
|
||
|
* Molehole internal setting.
|
||
|
*
|
||
|
* Holds important information for the molehole runtime like terminal
|
||
|
* dimensions, and active ncurses windows.
|
||
|
*/
|
||
|
struct config_internal {
|
||
|
int height;
|
||
|
int width;
|
||
|
|
||
|
WINDOW *page_win;
|
||
|
WINDOW *status_win;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Molehole current state information.
|
||
|
*
|
||
|
* Holds information pertaining to the content displayed such as the current
|
||
|
* page url.
|
||
|
*/
|
||
|
struct config_state {
|
||
|
char *url_string;
|
||
|
struct url *url;
|
||
|
struct connection *conn;
|
||
|
struct response *res;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Molehole configuration.
|
||
|
*
|
||
|
* Holds the state of the program including user configuration.
|
||
|
*/
|
||
|
struct config {
|
||
|
struct config_internal i;
|
||
|
struct config_state s;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Initializes a config with default parameters.
|
||
|
*/
|
||
|
void init_config(struct config *conf);
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Cleans up a config state and internal.
|
||
|
*/
|
||
|
void conf_cleanup(struct config *conf);
|
||
|
#endif
|