00001 /*############################################################################## 00002 00003 nIP - nano IP stack 00004 00005 File : autoip.h 00006 00007 Description : IPv4 Link-Local implementation (according to RFC 3927) 00008 00009 Copyright notice: 00010 00011 Copyright (C) 2005 - 00012 Andreas Dittrich, dittrich@informatik.hu-berlin.de 00013 Jon Kowal, kowal@informatik.hu-berlin.de 00014 00015 This program is free software; you can redistribute it and/or 00016 modify it under the terms of the GNU General Public License 00017 as published by the Free Software Foundation; either version 2 00018 of the License, or (at your option) any later version. 00019 00020 This program is distributed in the hope that it will be useful, 00021 but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 GNU General Public License for more details. 00024 00025 You should have received a copy of the GNU General Public License 00026 along with this program; if not, write to the Free Software 00027 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00028 00029 ##############################################################################*/ 00030 00031 #ifndef _NIP_AUTOIP_H 00032 #define _NIP_AUTOIP_H 00033 00034 #include "nip_init.h" 00035 #include "net_if.h" 00036 #include "net/arp.h" 00037 00038 #define NIP_AUTOIP_PROBE_WAIT 1 /**< max. interval to wait before sending probe packets */ 00039 #define NIP_AUTOIP_PROBE_NUM 3 /**< number of probes packets to send */ 00040 #define NIP_AUTOIP_PROBE_MIN 1 /**< min. seconds to wait in between two probe packets */ 00041 #define NIP_AUTOIP_PROBE_MAX 2 /**< max. seconds to wait in between two probe packets */ 00042 #define NIP_AUTOIP_ANNOUNCE_WAIT 2 /**< seconds to wait after last probe packet is sent*/ 00043 #define NIP_AUTOIP_ANNOUNCE_NUM 2 /**< number of announcements to send */ 00044 #define NIP_AUTOIP_ANNOUNCE_INTERVAL 2 /**< seconds to wait inbetween announcements */ 00045 #define NIP_AUTOIP_MAX_CONFLICTS 10 /**< number of conflicts after which to limit probe rate */ 00046 #define NIP_AUTOIP_RATE_LIMIT_INTERVAL 60 /**< rate at which try new addresses after MAX_CONFLICTS conflicts */ 00047 #define NIP_AUTOIP_DEFEND_INTERVAL 10 /**< minimum interval between defensive ARPs */ 00048 00049 00050 typedef enum 00051 { 00052 NIP_AUTOIP_STAT_DISABLED = 0, 00053 NIP_AUTOIP_STAT_INIT, 00054 NIP_AUTOIP_STAT_PROBE, 00055 NIP_AUTOIP_STAT_ANNOUNCE, 00056 NIP_AUTOIP_STAT_UP, 00057 NIP_AUTOIP_STAT_CONFLICT 00058 } 00059 #ifndef DOXYGEN 00060 __attribute__((packed)) 00061 #endif 00062 nip_autoip_state_t; 00063 00064 struct nip_autoip_conf 00065 { 00066 nip_autoip_state_t state; 00067 uint8_t addr[4]; /**< IPv4 address to probe for */ 00068 nip_time_t t; /**< timeout variable for current state */ 00069 uint8_t cnt;/**< number of probes/announcements that have been sent */ 00070 uint8_t conflict_cnt; 00071 } 00072 #ifndef DOXYGEN 00073 __attribute__((packed)) 00074 #endif 00075 ; 00076 00077 #if NIP_NET_IF_COUNT > 1 00078 extern struct nip_autoip_conf nip_autoip_conf[]; 00079 #else 00080 extern struct nip_autoip_conf nip_autoip_conf; 00081 #endif 00082 void nip_autoip_start( nip_net_if_id_t net_if ); 00083 void nip_autoip_disp_check( void ); 00084 void nip_autoip_arpcheck( nip_net_if_id_t if_id, struct ARP_PACKET *arp ); 00085 00086 #endif /* _NIP_AUTOIP_H */