* @return false on failure.
*/
static int
-add_open(char* ip, int nr, struct listen_port** list, int noproto_is_err)
+add_open(const char* ip, int nr, struct listen_port** list, int noproto_is_err)
{
struct addrinfo hints;
struct addrinfo* res;
/** print stats from statinfo */
static int
-print_stats(SSL* ssl, char* nm, struct stats_info* s)
+print_stats(SSL* ssl, const char* nm, struct stats_info* s)
{
struct timeval avg;
if(!ssl_printf(ssl, "%s.num.queries"SQ"%u\n", nm,
/** daemonize, drop user priviliges and chroot if needed */
static void
perform_setup(struct daemon* daemon, struct config_file* cfg, int debug_mode,
- char** cfgfile)
+ const char** cfgfile)
{
#ifdef HAVE_GETPWNAM
uid_t uid;
* @param debug_mode: if set, do not daemonize.
*/
static void
-run_daemon(char* cfgfile, int cmdline_verbose, int debug_mode)
+run_daemon(const char* cfgfile, int cmdline_verbose, int debug_mode)
{
struct config_file* cfg = NULL;
struct daemon* daemon = NULL;
main(int argc, char* argv[])
{
int c;
- char* cfgfile = CONFIGFILE;
+ const char* cfgfile = CONFIGFILE;
int cmdline_verbose = 0;
int debug_mode = 0;
+4 November 2008: Wouter
+ - fixed -Wwrite-strings warnings that result in better code.
+
3 November 2008: Wouter
- fixup build process for Mac OSX linker, use ldns b32 compat funcs.
- generated configure with autoconf-2.61.
/** enter AS112 default zone */
static int
add_as112_default(struct local_zones* zones, struct config_file* cfg,
- ldns_buffer* buf, char* name)
+ ldns_buffer* buf, const char* name)
{
struct local_zone* z;
char str[1024]; /* known long enough */
/** check configuration for errors */
static void
-morechecks(struct config_file* cfg, char* fname)
+morechecks(struct config_file* cfg, const char* fname)
{
warn_hosts("stub-host", cfg->stubs);
warn_hosts("forward-host", cfg->forwards);
/** check config file */
static void
-checkconf(char* cfgfile)
+checkconf(const char* cfgfile)
{
struct config_file* cfg = config_create();
if(!cfg)
int main(int argc, char* argv[])
{
int c;
- char* f;
+ const char* f;
log_ident_set("unbound-checkconf");
log_init(NULL, 0, NULL);
checklock_start();
/** contact the server with TCP connect */
static int
-contact_server(char* svr, struct config_file* cfg)
+contact_server(const char* svr, struct config_file* cfg)
{
struct sockaddr_storage addr;
socklen_t addrlen;
static int
go_cmd(SSL* ssl, int argc, char* argv[])
{
- char* pre="UBCT";
- char* space=" ";
- char* newline="\n";
+ const char* pre="UBCT";
+ const char* space=" ";
+ const char* newline="\n";
int was_error = 0, first_line = 1;
int r, i;
char buf[1024];
/** go ahead and read config, contact server and perform command and display */
static int
-go(char* cfgfile, char* svr, int argc, char* argv[])
+go(const char* cfgfile, char* svr, int argc, char* argv[])
{
struct config_file* cfg;
int fd, ret;
int main(int argc, char* argv[])
{
int c, ret;
- char* cfgfile = CONFIGFILE;
+ const char* cfgfile = CONFIGFILE;
char* svr = NULL;
#ifdef USE_WINSOCK
int r;
{
struct in6_addr addr;
/* [nibble.]{32}.ip6.arpa. is less than 128 */
- char* hex = "0123456789abcdef";
+ const char* hex = "0123456789abcdef";
char buf[128];
char *p;
int i;
/** delayer main service routine */
static void
-service(char* bind_str, int bindport, char* serv_str, size_t memsize,
- int delay_msec)
+service(const char* bind_str, int bindport, const char* serv_str,
+ size_t memsize, int delay_msec)
{
struct sockaddr_storage bind_addr, srv_addr;
socklen_t bind_len, srv_len;
int main(int argc, char** argv)
{
int c; /* defaults */
- char* server = "127.0.0.1@53";
- char* bindto = "0.0.0.0";
+ const char* server = "127.0.0.1@53";
+ const char* bindto = "0.0.0.0";
int bindport = 0;
size_t memsize = 10*1024*1024;
int delay = 100;
static int hverb = 0;
/** exit with error */
-static void error_exit(char* str)
+static void error_exit(const char* str)
{
printf("error: %s\n", str);
exit(1);
/** create label entry */
static struct labdata*
-lab_create(char* name)
+lab_create(const char* name)
{
struct labdata* lab = (struct labdata*)calloc(1, sizeof(*lab));
if(!lab) error_exit("out of memory");
* @return: true if found, false if not.
*/
static int
-parse_keyword(char** line, char* keyword)
+parse_keyword(char** line, const char* keyword)
{
size_t len = (size_t)strlen(keyword);
if(strncmp(*line, keyword, len) == 0) {
/** open TCP socket to svr */
static int
-open_svr(char* svr, int udp)
+open_svr(const char* svr, int udp)
{
struct sockaddr_storage addr;
socklen_t addrlen;
/** write a query over the TCP fd */
static void
write_q(int fd, int udp, ldns_buffer* buf, int id,
- char* strname, char* strtype, char* strclass)
+ const char* strname, const char* strtype, const char* strclass)
{
struct query_info qinfo;
ldns_rdf* rdf;
/** send the TCP queries and print answers */
static void
-send_em(char* svr, int udp, int noanswer, int num, char** qs)
+send_em(const char* svr, int udp, int noanswer, int num, char** qs)
{
ldns_buffer* buf = ldns_buffer_new(65553);
int fd = open_svr(svr, udp);
int main(int argc, char** argv)
{
int c;
- char* svr = "127.0.0.1";
+ const char* svr = "127.0.0.1";
int udp = 0;
int noanswer = 0;
* @param pass_argv: the argv to pass to unbound. Modified.
*/
static void
-add_opts(char* optarg, int* pass_argc, char* pass_argv[])
+add_opts(const char* optarg, int* pass_argc, char* pass_argv[])
{
- char *p = optarg, *np;
+ const char *p = optarg, *np;
size_t len;
while(p && isspace((int)*p))
p++;
static void
net_test()
{
- char* t4[] = {"\000\000\000\000",
+ const char* t4[] = {"\000\000\000\000",
"\200\000\000\000",
"\300\000\000\000",
"\340\000\000\000",
}
int
-config_read(struct config_file* cfg, char* filename)
+config_read(struct config_file* cfg, const char* filename)
{
FILE *in;
if(!filename)
log_err("Could not open %s: %s", filename, strerror(errno));
return 0;
}
- create_cfg_parser(cfg, filename);
+ create_cfg_parser(cfg, (char*)filename);
ub_c_in = in;
ub_c_parse();
fclose(in);
if(addr_is_ip6(&addr, addrlen)) {
struct in6_addr* ad = &((struct sockaddr_in6*)&addr)->sin6_addr;
- char* hex = "0123456789abcdef";
+ const char* hex = "0123456789abcdef";
char *p = buf;
int i;
for(i=15; i>=0; i--) {
* @return: false on error. In that case errno is set, ENOENT means
* file not found.
*/
-int config_read(struct config_file* config, char* filename);
+int config_read(struct config_file* config, const char* filename);
/**
* Destroy the config file structure.
*/
struct module_func_block {
/** text string name of module */
- char* name;
+ const char* name;
/**
* init the module. Called once for the global state.