You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lokinet/llarp/config.hpp

54 lines
1.1 KiB
C++

7 years ago
#ifndef LIBLLARP_CONFIG_HPP
#define LIBLLARP_CONFIG_HPP
6 years ago
#include <list>
7 years ago
#include <string>
7 years ago
#include <llarp/config.h>
7 years ago
namespace llarp
{
struct Config
{
typedef std::list< std::pair< std::string, std::string > > section_t;
7 years ago
section_t router;
section_t network;
section_t netdb;
6 years ago
section_t dns;
section_t iwp_links;
section_t connect;
6 years ago
section_t services;
6 years ago
section_t system;
7 years ago
bool
Load(const char *fname);
};
6 years ago
6 years ago
} // namespace llarp
7 years ago
struct llarp_config
{
6 years ago
llarp::Config impl;
};
7 years ago
6 years ago
/// ensure configuration exists
/// populate with defaults
/// return if this succeeded
/// if overwrite is true then overwrite old config file
/// if basedir is not nullptr then use basedir as an absolute
/// base path for all files in config
bool
llarp_ensure_config(const char *fname, const char *basedir = nullptr,
bool overwrite = false, bool asRouter = true);
void
llarp_generic_ensure_config(std::ofstream &f, std::string basepath);
void
llarp_ensure_router_config(std::ofstream &f, std::string basepath);
6 years ago
bool
llarp_ensure_client_config(std::ofstream &f, std::string basepath);
7 years ago
#endif