21 copy(data.begin(), data.end(),
data_.begin());
67 snprintf(temp,
sizeof(temp),
"subcluster:%u:%u", asn,
id);
74 snprintf(temp,
sizeof(temp),
"subcluster:%u:%u", asn,
id);
81 boost::system::error_code *errorp) {
86 size_t pos = str.find(
':');
87 if (pos == string::npos) {
89 *errorp = make_error_code(boost::system::errc::invalid_argument);
94 string first(str.substr(0, pos));
95 if (first !=
"subcluster") {
97 *errorp = make_error_code(boost::system::errc::invalid_argument);
102 string rest(str.substr(pos+1));
104 pos = rest.find(
':');
105 if (pos == string::npos) {
106 if (errorp != NULL) {
107 *errorp = make_error_code(boost::system::errc::invalid_argument);
112 boost::system::error_code ec;
113 string second(rest.substr(0, pos));
117 uint64_t asn = strtoll(second.c_str(), &endptr, 10);
118 if (asn == 0 || asn > 0xFFFFFFFF || *endptr !=
'\0') {
119 if (errorp != NULL) {
120 *errorp = make_error_code(boost::system::errc::invalid_argument);
125 string third(rest.substr(pos+1));
126 uint64_t
id = strtoll(third.c_str(), &endptr, 10);
127 if (*endptr !=
'\0') {
128 if (errorp != NULL) {
129 *errorp = make_error_code(boost::system::errc::invalid_argument);
135 if ((asn >
AS2_MAX &&
id > 0xFFFF) ||
id == 0 ||
id > 0xFFFFFFFF) {
136 if (errorp != NULL) {
137 *errorp = make_error_code(boost::system::errc::invalid_argument);
static SubCluster null_sub_cluster
static uint64_t get_value(const uint8_t *data, int size)
boost::array< uint8_t, kSize > bytes_type
static SubCluster FromString(const std::string &str, boost::system::error_code *error=NULL)
std::string ToString() const
static void put_value(uint8_t *data, int size, uint64_t value)