OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
security_group.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef SRC_BGP_SECURITY_GROUP_SECURITY_GROUP_H_
6 #define SRC_BGP_SECURITY_GROUP_SECURITY_GROUP_H_
7 
8 #include <boost/array.hpp>
9 #include <boost/system/error_code.hpp>
10 
11 #include <string>
12 
13 #include "base/parse_object.h"
14 #include "bgp/bgp_common.h"
15 
17 public:
18  static const int kSize = 8;
19  static const uint32_t kMinGlobalId = 1;
20  static const uint32_t kMaxGlobalId = 7999999;
21  typedef boost::array<uint8_t, kSize> bytes_type;
22 
23  SecurityGroup(as2_t asn, uint32_t id);
24  explicit SecurityGroup(const bytes_type &data);
25 
26  as2_t as_number() const;
27  uint32_t security_group_id() const;
28  bool IsGlobal() const;
29 
30  const bytes_type &GetExtCommunity() const {
31  return data_;
32  }
33 
34  const uint64_t GetExtCommunityValue() const {
35  return get_value(data_.begin(), 8);
36  }
37  std::string ToString();
38 
39 private:
41 };
42 
44 public:
45  static const int kSize = 8;
46  static const uint32_t kMinGlobalId = 1;
47  static const uint32_t kMaxGlobalId = 7999999;
48  typedef boost::array<uint8_t, kSize> bytes_type;
49 
50  SecurityGroup4ByteAs(as_t asn, uint32_t id);
51  explicit SecurityGroup4ByteAs(const bytes_type &data);
52 
53  as_t as_number() const;
54  uint32_t security_group_id() const;
55  bool IsGlobal() const;
56 
57  const bytes_type &GetExtCommunity() const {
58  return data_;
59  }
60 
61  const uint64_t GetExtCommunityValue() const {
62  return get_value(data_.begin(), 8);
63  }
64  std::string ToString();
65 
66 private:
68 };
69 
70 #endif // SRC_BGP_SECURITY_GROUP_SECURITY_GROUP_H_
bool IsGlobal() const
static const uint32_t kMinGlobalId
static const uint32_t kMaxGlobalId
std::string ToString()
const uint64_t GetExtCommunityValue() const
static const int kSize
uint32_t as_t
Definition: bgp_common.h:21
static uint64_t get_value(const uint8_t *data, int size)
Definition: parse_object.h:39
uint32_t security_group_id() const
std::string ToString()
boost::array< uint8_t, kSize > bytes_type
uint16_t as2_t
Definition: bgp_common.h:22
uint32_t security_group_id() const
static const uint32_t kMaxGlobalId
const bytes_type & GetExtCommunity() const
boost::array< uint8_t, kSize > bytes_type
bytes_type data_
const uint64_t GetExtCommunityValue() const
as2_t as_number() const
bool IsGlobal() const
SecurityGroup(as2_t asn, uint32_t id)
as_t as_number() const
static const uint32_t kMinGlobalId
const bytes_type & GetExtCommunity() const
SecurityGroup4ByteAs(as_t asn, uint32_t id)
static const int kSize