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 HOSTNAME_MAX_LEN 250 /* 255 - 3 (FQDN) - 2 (DNS enc) */ 45#define VENDORCLASSID_MAX_LEN 48 46#define CLIENTID_MAX_LEN 48 47#define USERCLASS_MAX_LEN 255 48#define VENDOR_MAX_LEN 255 49 50#define DHCPCD_ARP (1 << 0) 51#define DHCPCD_DOMAIN (1 << 2) 52#define DHCPCD_GATEWAY (1 << 3) 53#define DHCPCD_LASTLEASE (1 << 7) 54#define DHCPCD_INFORM (1 << 8) 55#define DHCPCD_REQUEST (1 << 9) 56#define DHCPCD_IPV4LL (1 << 10) 57#define DHCPCD_DUID (1 << 11) 58#define DHCPCD_PERSISTENT (1 << 12) 59#define DHCPCD_DAEMONISE (1 << 14) 60#define DHCPCD_DAEMONISED (1 << 15) 61#define DHCPCD_TEST (1 << 16) 62#define DHCPCD_FORKED (1 << 17) 63#define DHCPCD_HOSTNAME (1 << 18) 64#define DHCPCD_CLIENTID (1 << 19) 65#define DHCPCD_LINK (1 << 20) 66#define DHCPCD_BACKGROUND (1 << 21) 67 68struct options { 69 char interface[IF_NAMESIZE]; 70 int metric; 71 uint8_t requestmask[256 / 8]; 72 uint8_t requiremask[256 / 8]; 73 uint8_t nomask[256 / 8]; 74 uint32_t leasetime; 75 time_t timeout; 76 int options; 77 78 struct in_addr request_address; 79 struct in_addr request_netmask; 80 81 char **environ; 82 char script[PATH_MAX]; 83 char pidfile[PATH_MAX]; 84 85 char hostname[HOSTNAME_MAX_LEN + 1]; /* We don't store the lenth */ 86 int fqdn; 87 uint8_t vendorclassid[VENDORCLASSID_MAX_LEN + 2]; 88 char clientid[CLIENTID_MAX_LEN + 2]; 89 uint8_t userclass[USERCLASS_MAX_LEN + 2]; 90 uint8_t vendor[VENDOR_MAX_LEN + 2]; 91 92 size_t blacklist_len; 93 in_addr_t *blacklist; 94}; 95#endif 96