2022-02-07 06:35:29 +05:30
|
|
|
// Copyright 2018 Nicholas J. Kain <njkain at gmail dot com>
|
|
|
|
// SPDX-License-Identifier: MIT
|
2014-03-10 10:22:56 +05:30
|
|
|
#ifndef NJK_IFCHD_H_
|
|
|
|
#define NJK_IFCHD_H_
|
|
|
|
|
2014-03-31 02:32:48 +05:30
|
|
|
#include <limits.h>
|
2014-03-10 10:22:56 +05:30
|
|
|
#include "ndhc-defines.h"
|
|
|
|
|
|
|
|
enum ifchd_states {
|
|
|
|
STATE_NOTHING,
|
|
|
|
STATE_IP4SET,
|
|
|
|
STATE_TIMEZONE,
|
|
|
|
STATE_ROUTER,
|
|
|
|
STATE_DNS,
|
|
|
|
STATE_LPRSVR,
|
|
|
|
STATE_HOSTNAME,
|
|
|
|
STATE_DOMAIN,
|
|
|
|
STATE_IPTTL,
|
|
|
|
STATE_MTU,
|
|
|
|
STATE_NTPSVR,
|
2015-02-15 13:20:29 +05:30
|
|
|
STATE_WINS,
|
|
|
|
STATE_CARRIER,
|
2014-03-10 10:22:56 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
#include <net/if.h>
|
|
|
|
struct ifchd_client {
|
|
|
|
/* Socket fd, current state, and idle time for connection. */
|
|
|
|
int state;
|
|
|
|
/* Per-connection buffer. */
|
|
|
|
char ibuf[MAX_BUF];
|
|
|
|
/* ' '-delimited buffers of nameservers and domains */
|
|
|
|
char namesvrs[MAX_BUF];
|
|
|
|
char domains[MAX_BUF];
|
|
|
|
};
|
|
|
|
|
2014-03-13 01:54:02 +05:30
|
|
|
extern struct ifchd_client cl;
|
|
|
|
|
2014-03-13 01:43:47 +05:30
|
|
|
extern int allow_hostname;
|
|
|
|
extern uid_t ifch_uid;
|
|
|
|
extern gid_t ifch_gid;
|
|
|
|
|
2022-01-12 09:05:19 +05:30
|
|
|
int perform_timezone(const char *str, size_t len);
|
|
|
|
int perform_dns(const char *str, size_t len);
|
|
|
|
int perform_lprsvr(const char *str, size_t len);
|
|
|
|
int perform_hostname(const char *str, size_t len);
|
|
|
|
int perform_domain(const char *str, size_t len);
|
|
|
|
int perform_ipttl(const char *str, size_t len);
|
|
|
|
int perform_ntpsrv(const char *str, size_t len);
|
|
|
|
int perform_wins(const char *str, size_t len);
|
2014-03-18 07:40:58 +05:30
|
|
|
|
|
|
|
void ifch_main(void);
|
2014-03-11 05:10:38 +05:30
|
|
|
|
2022-02-07 06:35:29 +05:30
|
|
|
#endif
|
2014-03-10 10:22:56 +05:30
|
|
|
|