Rtos API example

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers autoip.h Source File

autoip.h

Go to the documentation of this file.
00001 /**
00002  * @file
00003  * AutoIP protocol definitions
00004  */
00005 
00006 /*
00007  *
00008  * Copyright (c) 2007 Dominik Spies <kontakt@dspies.de>
00009  * All rights reserved.
00010  *
00011  * Redistribution and use in source and binary forms, with or without modification,
00012  * are permitted provided that the following conditions are met:
00013  *
00014  * 1. Redistributions of source code must retain the above copyright notice,
00015  *    this list of conditions and the following disclaimer.
00016  * 2. Redistributions in binary form must reproduce the above copyright notice,
00017  *    this list of conditions and the following disclaimer in the documentation
00018  *    and/or other materials provided with the distribution.
00019  * 3. The name of the author may not be used to endorse or promote products
00020  *    derived from this software without specific prior written permission.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
00023  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00024  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
00025  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00026  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00027  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00028  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00029  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
00030  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
00031  * OF SUCH DAMAGE.
00032  *
00033  * Author: Dominik Spies <kontakt@dspies.de>
00034  *
00035  * This is a AutoIP implementation for the lwIP TCP/IP stack. It aims to conform
00036  * with RFC 3927.
00037  *
00038  */
00039 
00040 #ifndef LWIP_HDR_PROT_AUTOIP_H
00041 #define LWIP_HDR_PROT_AUTOIP_H
00042 
00043 #ifdef __cplusplus
00044 extern "C" {
00045 #endif
00046 
00047 /* 169.254.0.0 */
00048 #define AUTOIP_NET              0xA9FE0000
00049 /* 169.254.1.0 */
00050 #define AUTOIP_RANGE_START      (AUTOIP_NET | 0x0100)
00051 /* 169.254.254.255 */
00052 #define AUTOIP_RANGE_END        (AUTOIP_NET | 0xFEFF)
00053 
00054 /* RFC 3927 Constants */
00055 #define PROBE_WAIT              1   /* second   (initial random delay)                 */
00056 #define PROBE_MIN               1   /* second   (minimum delay till repeated probe)    */
00057 #define PROBE_MAX               2   /* seconds  (maximum delay till repeated probe)    */
00058 #define PROBE_NUM               3   /*          (number of probe packets)              */
00059 #define ANNOUNCE_NUM            2   /*          (number of announcement packets)       */
00060 #define ANNOUNCE_INTERVAL       2   /* seconds  (time between announcement packets)    */
00061 #define ANNOUNCE_WAIT           2   /* seconds  (delay before announcing)              */
00062 #define MAX_CONFLICTS           10  /*          (max conflicts before rate limiting)   */
00063 #define RATE_LIMIT_INTERVAL     60  /* seconds  (delay between successive attempts)    */
00064 #define DEFEND_INTERVAL         10  /* seconds  (min. wait between defensive ARPs)     */
00065 
00066 /* AutoIP client states */
00067 typedef enum {
00068   AUTOIP_STATE_OFF        = 0,
00069   AUTOIP_STATE_PROBING    = 1,
00070   AUTOIP_STATE_ANNOUNCING = 2,
00071   AUTOIP_STATE_BOUND      = 3
00072 } autoip_state_enum_t;
00073 
00074 #ifdef __cplusplus
00075 }
00076 #endif
00077 
00078 #endif /* LWIP_HDR_PROT_AUTOIP_H */