#ifndef DHCPCD_H
#define DHCPCD_H
#include <sys/socket.h>
#include <net/if.h>
#include <limits.h>
#include "dhcp.h"
#include "if-options.h"
#define HWADDR_LEN 20
#define IF_SSIDSIZE 33
#define PROFILE_LEN 64
enum DHS {
DHS_INIT,
DHS_DISCOVER,
DHS_REQUEST,
DHS_BOUND,
DHS_RENEW,
DHS_REBIND,
DHS_REBOOT,
DHS_INFORM,
DHS_RENEW_REQUESTED,
DHS_INIT_IPV4LL,
DHS_PROBE
};
#define LINK_UP 1
#define LINK_UNKNOWN 0
#define LINK_DOWN -1
struct if_state {
enum DHS state;
char profile[PROFILE_LEN];
struct if_options *options;
struct dhcp_message *sent;
struct dhcp_message *offer;
struct dhcp_message *new;
struct dhcp_message *old;
struct dhcp_lease lease;
const char *reason;
time_t interval;
time_t nakoff;
uint32_t xid;
int socket;
int probes;
int claims;
int conflicts;
time_t defend;
struct in_addr fail;
size_t arping_index;
};
struct interface {
char name[IF_NAMESIZE];
struct if_state *state;
int flags;
sa_family_t family;
unsigned char hwaddr[HWADDR_LEN];
size_t hwlen;
int metric;
int carrier;
int wireless;
char ssid[IF_SSIDSIZE];
int raw_fd;
int udp_fd;
int arp_fd;
size_t buffer_size, buffer_len, buffer_pos;
unsigned char *buffer;
struct in_addr addr;
struct in_addr net;
struct in_addr dst;
char leasefile[PATH_MAX];
time_t start_uptime;
unsigned char *clientid;
struct interface *next;
};
extern int pidfd;
extern int options;
extern int ifac;
extern char **ifav;
extern int ifdc;
extern char **ifdv;
extern struct interface *ifaces;
#endif