ndhc/ifchd.h
Nicholas J. Kain 1732bccccc Relicense as MIT.
It's a lot more common than BSD 2-clause it is both compatible
and nearly identical in effect.
2022-02-06 20:05:29 -05:00

55 lines
1.2 KiB
C

// Copyright 2018 Nicholas J. Kain <njkain at gmail dot com>
// SPDX-License-Identifier: MIT
#ifndef NJK_IFCHD_H_
#define NJK_IFCHD_H_
#include <limits.h>
#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,
STATE_WINS,
STATE_CARRIER,
};
#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];
};
extern struct ifchd_client cl;
extern int allow_hostname;
extern uid_t ifch_uid;
extern gid_t ifch_gid;
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);
void ifch_main(void);
#endif