2010-11-13 05:14:49 +05:30
|
|
|
#ifndef IFCHD_DEFINES_H_
|
|
|
|
#define IFCHD_DEFINES_H_
|
|
|
|
|
|
|
|
#include "defines.h"
|
|
|
|
|
2010-11-12 14:32:18 +05:30
|
|
|
#define PID_FILE_DEFAULT "/var/run/ifchd.pid"
|
2012-07-21 00:26:17 +05:30
|
|
|
#define IFCHD_VERSION "0.9"
|
2012-07-21 04:18:26 +05:30
|
|
|
#define MAX_BUF 384
|
2010-11-12 14:32:18 +05:30
|
|
|
#define SOCK_QUEUE 2
|
|
|
|
#define CONN_TIMEOUT 60
|
2012-07-21 00:47:44 +05:30
|
|
|
#define MAX_IFACES 10
|
2010-11-13 05:14:49 +05:30
|
|
|
|
2013-05-08 15:57:22 +05:30
|
|
|
enum ifchd_states {
|
|
|
|
STATE_NOTHING,
|
|
|
|
STATE_INTERFACE,
|
|
|
|
STATE_IP,
|
|
|
|
STATE_SUBNET,
|
|
|
|
STATE_TIMEZONE,
|
|
|
|
STATE_ROUTER,
|
|
|
|
STATE_DNS,
|
|
|
|
STATE_LPRSVR,
|
|
|
|
STATE_HOSTNAME,
|
|
|
|
STATE_DOMAIN,
|
|
|
|
STATE_IPTTL,
|
|
|
|
STATE_MTU,
|
|
|
|
STATE_BROADCAST,
|
|
|
|
STATE_NTPSVR,
|
|
|
|
STATE_WINS
|
|
|
|
};
|
|
|
|
|
2012-07-21 00:26:17 +05:30
|
|
|
#include <net/if.h>
|
|
|
|
struct ifchd_client {
|
|
|
|
/* Socket fd, current state, and idle time for connection. */
|
|
|
|
int fd;
|
|
|
|
int state;
|
|
|
|
int idle_time;
|
|
|
|
|
|
|
|
/* Symbolic name of the interface associated with a connection. */
|
|
|
|
char ifnam[IFNAMSIZ];
|
|
|
|
/* Per-connection buffer. */
|
|
|
|
char ibuf[MAX_BUF];
|
2012-07-21 03:01:15 +05:30
|
|
|
/* ' '-delimited buffers of nameservers and domains */
|
|
|
|
char namesvrs[MAX_BUF];
|
|
|
|
char domains[MAX_BUF];
|
2012-07-21 00:26:17 +05:30
|
|
|
};
|
|
|
|
|
2013-05-08 15:57:22 +05:30
|
|
|
extern void perform_timezone(struct ifchd_client *cl, const char *str, size_t len);
|
|
|
|
extern void perform_dns(struct ifchd_client *cl, const char *str, size_t len);
|
|
|
|
extern void perform_lprsvr(struct ifchd_client *cl, const char *str, size_t len);
|
|
|
|
extern void perform_hostname(struct ifchd_client *cl, const char *str, size_t len);
|
|
|
|
extern void perform_domain(struct ifchd_client *cl, const char *str, size_t len);
|
|
|
|
extern void perform_ipttl(struct ifchd_client *cl, const char *str, size_t len);
|
|
|
|
extern void perform_ntpsrv(struct ifchd_client *cl, const char *str, size_t len);
|
|
|
|
extern void perform_wins(struct ifchd_client *cl, const char *str, size_t len);
|
|
|
|
|
2010-11-13 05:14:49 +05:30
|
|
|
#endif /* IFCHD_DEFINES_H_ */
|
2010-11-12 14:32:18 +05:30
|
|
|
|