|
1 /* |
|
2 * Copyright 2007 Intel Corporation |
|
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 #ifdef HAVE_CONFIG_H |
|
18 #include <dtn-config.h> |
|
19 #endif |
|
20 |
|
21 #include "DTLSRConfig.h" |
|
22 |
|
23 namespace dtn { |
|
24 |
|
25 //---------------------------------------------------------------------- |
|
26 template <> |
|
27 DTLSRConfig* oasys::Singleton<DTLSRConfig>::instance_ = NULL; |
|
28 |
|
29 //---------------------------------------------------------------------- |
|
30 DTLSRConfig::DTLSRConfig() |
|
31 : area_(""), |
|
32 weight_fn_(ESTIMATED_DELAY), |
|
33 weight_shift_(0), |
|
34 uptime_factor_(10.0), |
|
35 keep_down_links_(true), |
|
36 recompute_delay_(1), |
|
37 aging_interval_(5), |
|
38 lsa_interval_(3600), |
|
39 min_lsa_interval_(5), |
|
40 lsa_lifetime_(24 * 3600) |
|
41 { |
|
42 } |
|
43 |
|
44 //---------------------------------------------------------------------- |
|
45 const char* |
|
46 DTLSRConfig::weight_fn_to_str(weight_fn_t fn) |
|
47 { |
|
48 switch(fn) { |
|
49 case COST: return "COST"; |
|
50 case DELAY: return "DELAY"; |
|
51 case ESTIMATED_DELAY: return "ESTIMATED_DELAY"; |
|
52 } |
|
53 return "INVALID_WEIGHT_FN"; |
|
54 } |
|
55 |
|
56 //---------------------------------------------------------------------- |
|
57 oasys::EnumOpt::Case |
|
58 DTLSRConfig::weight_opts_[] = |
|
59 { |
|
60 {"cost", COST}, |
|
61 {"delay", DELAY}, |
|
62 {"estimated_delay", ESTIMATED_DELAY}, |
|
63 {"estdelay", ESTIMATED_DELAY}, |
|
64 {NULL, 0}, |
|
65 }; |
|
66 |
|
67 } // namespace dtn |