dhcpcd.h revision e95877ecfa1170d77b1ec1f66752725cdda01b64
1/*
2 * dhcpcd - DHCP client daemon
3 * Copyright 2006-2008 Roy Marples <roy@marples.name>
4 * All rights reserved
5
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 *    notice, this list of conditions and the following disclaimer in the
13 *    documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#ifndef DHCPCD_H
29#define DHCPCD_H
30
31#include <sys/param.h>
32#include <sys/socket.h>
33
34#include <net/if.h>
35#include <netinet/in.h>
36
37#include <limits.h>
38
39#include "common.h"
40
41#define DEFAULT_TIMEOUT		30
42#define DEFAULT_LEASETIME	3600	/* 1 hour */
43
44#define CLASSID_MAX_LEN		48
45#define CLIENTID_MAX_LEN	48
46#define USERCLASS_MAX_LEN	255
47#define VENDOR_MAX_LEN		255
48
49#ifdef THERE_IS_NO_FORK
50extern char dhcpcd[PATH_MAX];
51extern char **dhcpcd_argv;
52extern int dhcpcd_argc;
53extern char *dhcpcd_skiproutes;
54#endif
55
56#define DHCPCD_ARP		(1 << 0)
57#define DHCPCD_DOMAIN		(1 << 2)
58#define DHCPCD_GATEWAY		(1 << 3)
59#define DHCPCD_LASTLEASE	(1 << 7)
60#define DHCPCD_INFORM		(1 << 8)
61#define DHCPCD_REQUEST		(1 << 9)
62#define DHCPCD_IPV4LL		(1 << 10)
63#define DHCPCD_DUID		(1 << 11)
64#define DHCPCD_PERSISTENT	(1 << 12)
65#define DHCPCD_DAEMONISE	(1 << 14)
66#define DHCPCD_DAEMONISED	(1 << 15)
67#define DHCPCD_TEST		(1 << 16)
68#define DHCPCD_FORKED		(1 << 17)
69#define DHCPCD_HOSTNAME		(1 << 18)
70#define DHCPCD_CLIENTID		(1 << 19)
71
72struct options {
73	char interface[IF_NAMESIZE];
74	int metric;
75	uint8_t reqmask[256 / 8];
76	uint8_t nomask[256 / 8];
77	uint32_t leasetime;
78	time_t timeout;
79	int options;
80
81	struct in_addr request_address;
82	struct in_addr request_netmask;
83
84	char **environ;
85	char script[PATH_MAX];
86	char pidfile[PATH_MAX];
87
88#ifndef MINIMAL
89	char hostname[MAXHOSTNAMELEN];
90	int fqdn;
91	uint8_t classid[CLASSID_MAX_LEN + 1];
92	char clientid[CLIENTID_MAX_LEN + 1];
93	uint8_t userclass[USERCLASS_MAX_LEN + 1];
94	uint8_t vendor[VENDOR_MAX_LEN + 1];
95#endif
96};
97
98#endif
99