The Pedigree Project  0.1
prot/autoip.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
25 /*
26  *
27  * Copyright (c) 2007 Dominik Spies <kontakt@dspies.de>
28  * All rights reserved.
29  *
30  * Redistribution and use in source and binary forms, with or without modification,
31  * are permitted provided that the following conditions are met:
32  *
33  * 1. Redistributions of source code must retain the above copyright notice,
34  * this list of conditions and the following disclaimer.
35  * 2. Redistributions in binary form must reproduce the above copyright notice,
36  * this list of conditions and the following disclaimer in the documentation
37  * and/or other materials provided with the distribution.
38  * 3. The name of the author may not be used to endorse or promote products
39  * derived from this software without specific prior written permission.
40  *
41  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
42  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
43  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
44  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
45  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
46  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
47  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
48  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
49  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
50  * OF SUCH DAMAGE.
51  *
52  * Author: Dominik Spies <kontakt@dspies.de>
53  *
54  * This is a AutoIP implementation for the lwIP TCP/IP stack. It aims to conform
55  * with RFC 3927.
56  *
57  */
58 
59 #ifndef LWIP_HDR_PROT_AUTOIP_H
60 #define LWIP_HDR_PROT_AUTOIP_H
61 
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65 
66 /* 169.254.0.0 */
67 #define AUTOIP_NET 0xA9FE0000
68 /* 169.254.1.0 */
69 #define AUTOIP_RANGE_START (AUTOIP_NET | 0x0100)
70 /* 169.254.254.255 */
71 #define AUTOIP_RANGE_END (AUTOIP_NET | 0xFEFF)
72 
73 /* RFC 3927 Constants */
74 #define PROBE_WAIT 1 /* second (initial random delay) */
75 #define PROBE_MIN 1 /* second (minimum delay till repeated probe) */
76 #define PROBE_MAX 2 /* seconds (maximum delay till repeated probe) */
77 #define PROBE_NUM 3 /* (number of probe packets) */
78 #define ANNOUNCE_NUM 2 /* (number of announcement packets) */
79 #define ANNOUNCE_INTERVAL 2 /* seconds (time between announcement packets) */
80 #define ANNOUNCE_WAIT 2 /* seconds (delay before announcing) */
81 #define MAX_CONFLICTS 10 /* (max conflicts before rate limiting) */
82 #define RATE_LIMIT_INTERVAL 60 /* seconds (delay between successive attempts) */
83 #define DEFEND_INTERVAL 10 /* seconds (min. wait between defensive ARPs) */
84 
85 /* AutoIP client states */
86 typedef enum {
87  AUTOIP_STATE_OFF = 0,
88  AUTOIP_STATE_PROBING = 1,
89  AUTOIP_STATE_ANNOUNCING = 2,
90  AUTOIP_STATE_BOUND = 3
91 } autoip_state_enum_t;
92 
93 #ifdef __cplusplus
94 }
95 #endif
96 
97 #endif /* LWIP_HDR_PROT_AUTOIP_H */