Remove building with NOCRYPTO option
[minix3.git] / external / bsd / dhcpcd / dist / ipv4ll.h
blobc038222e7d77f53508f829211c8c832d34bbb7f6
1 /* $NetBSD: ipv4ll.h,v 1.10 2015/08/21 10:39:00 roy Exp $ */
3 /*
4 * dhcpcd - DHCP client daemon
5 * Copyright (c) 2006-2015 Roy Marples <roy@marples.name>
6 * All rights reserved
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
30 #ifndef IPV4LL_H
31 #define IPV4LL_H
33 #include "arp.h"
35 extern const struct in_addr inaddr_llmask;
36 extern const struct in_addr inaddr_llbcast;
38 #define LINKLOCAL_ADDR 0xa9fe0000
39 #define LINKLOCAL_MASK IN_CLASSB_NET
40 #define LINKLOCAL_BRDC (LINKLOCAL_ADDR | ~LINKLOCAL_MASK)
42 #ifndef IN_LINKLOCAL
43 # define IN_LINKLOCAL(addr) ((addr & IN_CLASSB_NET) == LINKLOCAL_ADDR)
44 #endif
46 struct ipv4ll_state {
47 struct in_addr addr;
48 struct arp_state *arp;
49 unsigned int conflicts;
50 struct timespec defend;
51 char randomstate[128];
52 uint8_t down;
55 #define IPV4LL_STATE(ifp) \
56 ((struct ipv4ll_state *)(ifp)->if_data[IF_DATA_IPV4LL])
57 #define IPV4LL_CSTATE(ifp) \
58 ((const struct ipv4ll_state *)(ifp)->if_data[IF_DATA_IPV4LL])
59 #define IPV4LL_STATE_RUNNING(ifp) \
60 (IPV4LL_CSTATE((ifp)) && !IPV4LL_CSTATE((ifp))->down && \
61 IN_LINKLOCAL(ntohl(IPV4LL_CSTATE((ifp))->addr.s_addr)))
63 struct rt* ipv4ll_subnet_route(const struct interface *);
64 struct rt* ipv4ll_default_route(const struct interface *);
65 ssize_t ipv4ll_env(char **, const char *, const struct interface *);
66 void ipv4ll_start(void *);
67 void ipv4ll_claimed(void *);
68 void ipv4ll_handle_failure(void *);
70 #define ipv4ll_free(ifp) ipv4ll_freedrop((ifp), 0);
71 #define ipv4ll_drop(ifp) ipv4ll_freedrop((ifp), 1);
72 void ipv4ll_freedrop(struct interface *, int);
74 #endif