conf-parameter.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NLSR_CONF_PARAMETER_HPP
23 #define NLSR_CONF_PARAMETER_HPP
24 
25 #include "common.hpp"
26 #include "logger.hpp"
27 #include "test-access-control.hpp"
28 
29 #include <iostream>
30 #include <boost/cstdint.hpp>
31 #include <ndn-cxx/face.hpp>
32 #include <ndn-cxx/util/time.hpp>
33 
34 namespace nlsr {
35 
36 enum {
40 };
41 
42 enum {
46 };
47 
48 enum {
52 };
53 
54 enum {
58 };
59 
60 enum {
64 };
65 
66 
67 enum {
71 };
72 
73 enum {
77 };
78 
79 enum {
83 };
84 
85 enum {
89 };
90 
91 enum {
95 };
96 
97 enum {
101 };
102 
108 };
109 
110 enum {
114 };
115 
128 {
129 
130 public:
132  : m_lsaRefreshTime(LSA_REFRESH_TIME_DEFAULT)
133  , m_adjLsaBuildInterval(ADJ_LSA_BUILD_INTERVAL_DEFAULT)
134  , m_firstHelloInterval(FIRST_HELLO_INTERVAL_DEFAULT)
135  , m_routingCalcInterval(ROUTING_CALC_INTERVAL_DEFAULT)
136  , m_faceDatasetFetchInterval(ndn::time::seconds(static_cast<int>(FACE_DATASET_FETCH_INTERVAL_DEFAULT)))
137  , m_lsaInterestLifetime(ndn::time::seconds(static_cast<int>(LSA_INTEREST_LIFETIME_DEFAULT)))
138  , m_routerDeadInterval(2 * LSA_REFRESH_TIME_DEFAULT)
139  , m_logLevel("INFO")
140  , m_interestRetryNumber(HELLO_RETRIES_DEFAULT)
141  , m_interestResendTime(HELLO_TIMEOUT_DEFAULT)
142  , m_infoInterestInterval(HELLO_INTERVAL_DEFAULT)
143  , m_hyperbolicState(HYPERBOLIC_STATE_OFF)
144  , m_corR(0)
145  , m_maxFacesPerPrefix(MAX_FACES_PER_PREFIX_MIN)
146  , m_syncInterestLifetime(ndn::time::milliseconds(SYNC_INTEREST_LIFETIME_DEFAULT))
147  {
148  }
149 
150  void
151  setNetwork(const ndn::Name& networkName);
152 
153  const ndn::Name&
154  getNetwork() const
155  {
156  return m_network;
157  }
158 
159  void
160  setRouterName(const ndn::Name& routerName)
161  {
162  m_routerName = routerName;
163  }
164 
165  const ndn::Name&
167  {
168  return m_routerName;
169  }
170 
171  void
172  setSiteName(const ndn::Name& siteName)
173  {
174  m_siteName = siteName;
175  }
176 
177  const ndn::Name&
178  getSiteName() const
179  {
180  return m_siteName;
181  }
182 
183  void
185  {
186  m_routerPrefix = m_network;
187  m_routerPrefix.append(m_siteName);
188  m_routerPrefix.append(m_routerName);
189  }
190 
191  const ndn::Name&
193  {
194  return m_routerPrefix;
195  }
196 
197 
198  const ndn::Name&
200  {
201  return m_chronosyncPrefix;
202  }
203 
204  const ndn::Name&
205  getLsaPrefix() const
206  {
207  return m_lsaPrefix;
208  }
209 
210  void
211  setLsaRefreshTime(uint32_t lrt)
212  {
213  m_lsaRefreshTime = lrt;
214  }
215 
216  uint32_t
218  {
219  return m_lsaRefreshTime;
220  }
221 
222  void
223  setLsaInterestLifetime(const ndn::time::seconds& lifetime)
224  {
225  m_lsaInterestLifetime = lifetime;
226  }
227 
228  const ndn::time::seconds&
230  {
231  return m_lsaInterestLifetime;
232  }
233 
234  void
235  setAdjLsaBuildInterval(uint32_t interval)
236  {
237  m_adjLsaBuildInterval = interval;
238  }
239 
240  uint32_t
242  {
243  return m_adjLsaBuildInterval;
244  }
245 
246  void
247  setFirstHelloInterval(uint32_t interval)
248  {
249  m_firstHelloInterval = interval;
250  }
251 
252  uint32_t
254  {
255  return m_firstHelloInterval;
256  }
257 
258  void
259  setRoutingCalcInterval(uint32_t interval)
260  {
261  m_routingCalcInterval = interval;
262  }
263 
264  uint32_t
266  {
267  return m_routingCalcInterval;
268  }
269 
270  void
271  setRouterDeadInterval(uint32_t rdt)
272  {
273  m_routerDeadInterval = rdt;
274  }
275 
276  uint32_t
278  {
279  return m_routerDeadInterval;
280  }
281 
282  void
283  setFaceDatasetFetchTries(uint32_t count)
284  {
285  m_faceDatasetFetchTries = count;
286  }
287 
288  uint32_t
290  {
291  return m_faceDatasetFetchTries;
292  }
293 
294  void
295  setFaceDatasetFetchInterval(uint32_t interval)
296  {
297  m_faceDatasetFetchInterval = ndn::time::seconds(interval);
298  }
299 
300  const ndn::time::seconds
302  {
303  return m_faceDatasetFetchInterval;
304  }
305 
306  void
308  {
309  m_interestRetryNumber = irn;
310  }
311 
312  uint32_t
314  {
315  return m_interestRetryNumber;
316  }
317 
318  void
319  setInterestResendTime(uint32_t irt)
320  {
321  m_interestResendTime = irt;
322  }
323 
324  uint32_t
326  {
327  return m_interestResendTime;
328  }
329 
330  uint32_t
332  {
333  return m_infoInterestInterval;
334  }
335 
336  void
338  {
339  m_infoInterestInterval = iii;
340  }
341 
342  void
343  setHyperbolicState(int32_t ihc)
344  {
345  m_hyperbolicState = ihc;
346  }
347 
348  int32_t
350  {
351  return m_hyperbolicState;
352  }
353 
354  bool
355  setCorR(double cr)
356  {
357  if ( cr >= 0 ) {
358  m_corR = cr;
359  return true;
360  }
361  return false;
362  }
363 
364  double
365  getCorR() const
366  {
367  return m_corR;
368  }
369 
370  void
371  setCorTheta(const std::vector<double>& ct)
372  {
373  m_corTheta = ct;
374  }
375 
376  std::vector<double>
377  getCorTheta() const
378  {
379  return m_corTheta;
380  }
381 
382  void
383  setMaxFacesPerPrefix(uint32_t mfpp)
384  {
385  m_maxFacesPerPrefix = mfpp;
386  }
387 
388  uint32_t
390  {
391  return m_maxFacesPerPrefix;
392  }
393 
394  void
395  setSeqFileDir(const std::string& ssfd)
396  {
397  m_seqFileDir = ssfd;
398  }
399 
400  const std::string&
402  {
403  return m_seqFileDir;
404  }
405 
406  void
407  setSyncInterestLifetime(uint32_t syncInterestLifetime)
408  {
409  m_syncInterestLifetime = ndn::time::milliseconds(syncInterestLifetime);
410  }
411 
412  const ndn::time::milliseconds&
414  {
415  return m_syncInterestLifetime;
416  }
417 
418  void
419  writeLog();
420 
421 private:
422  ndn::Name m_routerName;
423  ndn::Name m_siteName;
424  ndn::Name m_network;
425 
426  ndn::Name m_routerPrefix;
427  ndn::Name m_lsaRouterPrefix;
428 
429  ndn::Name m_chronosyncPrefix;
430  ndn::Name m_lsaPrefix;
431 
432  uint32_t m_lsaRefreshTime;
433 
434  uint32_t m_adjLsaBuildInterval;
435  uint32_t m_firstHelloInterval;
436  uint32_t m_routingCalcInterval;
437 
438  uint32_t m_faceDatasetFetchTries;
439  ndn::time::seconds m_faceDatasetFetchInterval;
440 
441  ndn::time::seconds m_lsaInterestLifetime;
442  uint32_t m_routerDeadInterval;
443  std::string m_logLevel;
444 
445  uint32_t m_interestRetryNumber;
446  uint32_t m_interestResendTime;
447 
448  uint32_t m_infoInterestInterval;
449 
450  int32_t m_hyperbolicState;
451  double m_corR;
452  std::vector<double> m_corTheta;
453 
454  uint32_t m_maxFacesPerPrefix;
455 
456  std::string m_seqFileDir;
457  ndn::time::milliseconds m_syncInterestLifetime;
458 
460  static const uint64_t SYNC_VERSION;
461 };
462 
463 } // namespace nlsr
464 
465 #endif // NLSR_CONF_PARAMETER_HPP
uint32_t getInterestResendTime() const
A class to house all the configuration parameters for NLSR.
Copyright (c) 2014-2018, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
Definition: tlv-nlsr.hpp:27
const ndn::time::milliseconds & getSyncInterestLifetime() const
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
double getCorR() const
void setLsaInterestLifetime(const ndn::time::seconds &lifetime)
void setMaxFacesPerPrefix(uint32_t mfpp)
void setRoutingCalcInterval(uint32_t interval)
void setNetwork(const ndn::Name &networkName)
const std::string & getSeqFileDir() const
void setAdjLsaBuildInterval(uint32_t interval)
void setSiteName(const ndn::Name &siteName)
uint32_t getInfoInterestInterval() const
const ndn::Name & getRouterPrefix() const
void setInterestResendTime(uint32_t irt)
void setInfoInterestInterval(uint32_t iii)
Copyright (c) 2014-2018, The University of Memphis, Regents of the University of California.
const ndn::time::seconds & getLsaInterestLifetime() const
Copyright (c) 2014-2017, The University of Memphis, Regents of the University of California.
void setCorTheta(const std::vector< double > &ct)
uint32_t getInterestRetryNumber() const
uint32_t getMaxFacesPerPrefix() const
std::vector< double > getCorTheta() const
const ndn::Name & getLsaPrefix() const
void setSyncInterestLifetime(uint32_t syncInterestLifetime)
void setRouterName(const ndn::Name &routerName)
void setFaceDatasetFetchInterval(uint32_t interval)
uint32_t getLsaRefreshTime() const
void setInterestRetryNumber(uint32_t irn)
const ndn::Name & getChronosyncPrefix() const
bool setCorR(double cr)
Copyright (c) 2014-2018, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
uint32_t getAdjLsaBuildInterval() const
void setRouterDeadInterval(uint32_t rdt)
void setFirstHelloInterval(uint32_t interval)
void setSeqFileDir(const std::string &ssfd)
uint32_t getFirstHelloInterval() const
void setLsaRefreshTime(uint32_t lrt)
uint32_t getFaceDatasetFetchTries() const
const ndn::Name & getNetwork() const
void setHyperbolicState(int32_t ihc)
void setFaceDatasetFetchTries(uint32_t count)
const ndn::Name & getRouterName() const
int32_t getHyperbolicState() const
uint32_t getRoutingCalcInterval() const
const ndn::Name & getSiteName() const
const ndn::time::seconds getFaceDatasetFetchInterval() const
uint32_t getRouterDeadInterval() const