|
1 /* |
|
2 * Copyright 2007 Baylor University |
|
3 * |
|
4 * Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 * you may not use this file except in compliance with the License. |
|
6 * You may obtain a copy of the License at |
|
7 * |
|
8 * http://www.apache.org/licenses/LICENSE-2.0 |
|
9 * |
|
10 * Unless required by applicable law or agreed to in writing, software |
|
11 * distributed under the License is distributed on an "AS IS" BASIS, |
|
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 * See the License for the specific language governing permissions and |
|
14 * limitations under the License. |
|
15 */ |
|
16 |
|
17 #ifndef _PROPHET_PARAMS_H_ |
|
18 #define _PROPHET_PARAMS_H_ |
|
19 |
|
20 #include <sys/types.h> |
|
21 #include "Node.h" |
|
22 #include "FwdStrategy.h" |
|
23 #include "QueuePolicy.h" |
|
24 |
|
25 namespace prophet |
|
26 { |
|
27 |
|
28 /** |
|
29 * Tunable parameter struct for setting global default values |
|
30 * for various Prophet algorithms |
|
31 */ |
|
32 class ProphetParams : public NodeParams |
|
33 { |
|
34 public: |
|
35 /** |
|
36 * Time between HELLO beacons (in 100ms units) |
|
37 */ |
|
38 static const u_int8_t HELLO_INTERVAL = 20; ///< 2 sec (arbitrary) |
|
39 |
|
40 /** |
|
41 * Max units of HELLO_INTERVAL before peer is considered unreachable |
|
42 */ |
|
43 static const u_int HELLO_DEAD = 20; ///< 40 sec (arbitrary) |
|
44 |
|
45 /** |
|
46 * Max times to forward a bundle for GTMX |
|
47 */ |
|
48 static const u_int DEFAULT_NUM_F_MAX = 5; ///< arbitrary |
|
49 |
|
50 /** |
|
51 * Min times to forward a bundle for LEPR |
|
52 */ |
|
53 static const u_int DEFAULT_NUM_F_MIN = 3; ///< arbitrary |
|
54 |
|
55 /** |
|
56 * Seconds between aging of nodes and Prophet ACKs |
|
57 */ |
|
58 static const u_int AGE_PERIOD = 180; ///< 3 min (arbitrary) |
|
59 |
|
60 /** |
|
61 * Current version of the protocol |
|
62 */ |
|
63 static const u_int8_t PROPHET_VERSION = 0x01; |
|
64 |
|
65 /** |
|
66 * Maximum number of routes to retain (not specified by I-D) |
|
67 */ |
|
68 static const u_int MAX_TABLE_SIZE = 1024; |
|
69 |
|
70 /** |
|
71 * Constructor. Default values are defined in Prophet.h |
|
72 */ |
|
73 ProphetParams() |
|
74 : NodeParams(), |
|
75 fs_(FwdStrategy::GRTR), |
|
76 qp_(QueuePolicy::FIFO), |
|
77 hello_interval_(HELLO_INTERVAL), |
|
78 hello_dead_(HELLO_DEAD), |
|
79 max_forward_(DEFAULT_NUM_F_MAX), |
|
80 min_forward_(DEFAULT_NUM_F_MIN), |
|
81 age_period_(AGE_PERIOD), |
|
82 max_table_size_(MAX_TABLE_SIZE), |
|
83 epsilon_(0.0039), // min value using 1/255 |
|
84 relay_node_(true), |
|
85 internet_gw_(false) // not implemented |
|
86 {} |
|
87 |
|
88 ///@{ Accessors |
|
89 FwdStrategy::fwd_strategy_t fs() const { return fs_; } |
|
90 QueuePolicy::q_policy_t qp() const { return qp_; } |
|
91 u_int8_t hello_interval() const { return hello_interval_; } |
|
92 u_int hello_dead() const { return hello_dead_; } |
|
93 u_int max_forward() const { return max_forward_; } |
|
94 u_int min_forward() const { return min_forward_; } |
|
95 u_int age_period() const { return age_period_; } |
|
96 double epsilon() const { return epsilon_; } |
|
97 bool relay_node() const { return relay_node_; } |
|
98 bool internet_gw() const { return internet_gw_; } |
|
99 ///@} |
|
100 |
|
101 FwdStrategy::fwd_strategy_t fs_; ///< bundle forwarding strategy |
|
102 QueuePolicy::q_policy_t qp_; ///< bundle queuing policy |
|
103 |
|
104 u_int8_t hello_interval_; ///< delay between HELLO beacons (100ms units) |
|
105 u_int hello_dead_; ///< hello_interval's before giving up on peer |
|
106 |
|
107 u_int max_forward_; ///< max times to forward bundle using GTMX |
|
108 u_int min_forward_; ///< min times to forward bundle before LEPR drops |
|
109 |
|
110 u_int age_period_; ///< seconds between applying age algorithm |
|
111 |
|
112 u_int max_table_size_; ///< max number of routes to retain |
|
113 |
|
114 double epsilon_; ///< minimum predictability before dropping route |
|
115 |
|
116 bool relay_node_; ///< whether this node accepts bundles to relay to peers |
|
117 bool internet_gw_; ///< not implemented; whether node bridges to Internet |
|
118 }; |
|
119 |
|
120 }; // namespace prophet |
|
121 |
|
122 #endif // _PROPHET_PARAMS_H_ |