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