NetBurner 3.5.0
PDF Version
 
autoip.h
1/*NB_REVISION*/
2
3/*NB_COPYRIGHT*/
4
5/*
6 * Doxygen note: AutoIP is an option set in the configuration system for each interface, so no
7 * functions are used by the application and they do not need to be documented. The previous
8 * documentation is copied below for historical reference.
9 */
10
11#ifndef _AUTOIP_H_INC
12#define _AUTOIP_H_INC
13
14#include <buffers.h>
15#include <nettimer.h>
16
17#define PROBE_WAIT 1
18#define PROBE_NUM 3
19#define PROBE_MIN 1
20#define PROBE_MAX 2
21#define ANNOUNCE_WAIT 2
22#define ANNOUNCE_NUM 2
23#define ANNOUNCE_INTERVAL 2
24#define MAX_CONFLICTS 10
25#define RATE_LIMIT_INTERVAL 60
26#define DEFEND_INTERVAL 10
27
28#define BASE_AUTO_IP 0xA9FE0100
29
30#define AUTO_IP_INIT 1
31#define AUTO_IP_NEGOTIATING 2
32#define AUTO_IP_CONFIGURED 3
33#define AUTO_IP_STOPPED 4
34#define AUTO_IP_STARTARP 5
35#define AUTO_IP_ARPCHECKING 6
36#define AUTO_IP_ANNOUNCING 7
37#define AUTO_IP_CONFLICT 8
38#define AUTO_IP_DISABLED 9
39
40#define NOSCHEDULE_TICK 0
41
42class InterfaceBlock;
43
44class AutoIPClient : public TimeOutElement
45{
46 private:
47 InterfaceBlock *pIfb;
48 int AutoIPState;
49 IPADDR4 last_try;
50
51 unsigned long nextTick;
52 int probeCount;
53 int announceCount;
54 int conflicts;
55 bool collision;
56
57 AutoIPClient *nextIPC;
58
59 void addressCollision();
60 IPADDR4 generateNewIPAddr();
61 void negotiate();
62 void startArp();
63 void arpCheck();
64 void announce();
65 void tickDelay(uint16_t delay);
66
67 virtual void TimeElementEvent();
68
69 public:
70 AutoIPClient(InterfaceBlock *ib);
71 ~AutoIPClient();
72 void start();
73 void stop();
74 void disable();
75 void enable();
76 void restart();
77 int getState();
78 friend void processArp(PoolPtr p, PEFRAME pF);
79 IPADDR4 cur_val();
80 void LinkNotify(bool bLink);
81};
82
83AutoIPClient *AddAutoIPInterface(int InterfaceNumber = 0);
84
85#endif /* ----- #ifndef _AUTOIP_H_INC ----- */
NetBurner Buffers API.
Used to store and manipulate IPv4 addresses in dual stack mode.
Definition nettypes.h:208
Network interface configuration block class for interface control and configuration.
Definition netinterface.h:245