36 copy(data.begin(), data.end(),
data_.begin());
40 boost::system::error_code *errorp) {
43 size_t pos = str.find(
':');
44 if (pos == string::npos) {
46 *errorp = make_error_code(boost::system::errc::invalid_argument);
51 string first(str.substr(0, pos));
52 if (first !=
"originvn") {
54 *errorp = make_error_code(boost::system::errc::invalid_argument);
59 string rest(str.substr(pos+1));
62 if (pos == string::npos) {
64 *errorp = make_error_code(boost::system::errc::invalid_argument);
69 string second(rest.substr(0, pos));
71 int64_t asn = strtol(second.c_str(), &endptr, 10);
72 if (asn == 0 || asn > 0xFFFFFFFF || *endptr !=
'\0') {
74 *errorp = make_error_code(boost::system::errc::invalid_argument);
79 string third(rest.substr(pos+1));
80 uint64_t value = strtol(third.c_str(), &endptr, 10);
81 if (*endptr !=
'\0') {
83 *errorp = make_error_code(boost::system::errc::invalid_argument);
89 if ((asn >
AS2_MAX && value > 0xFFFF) || value > 0xFFFFFFFF) {
91 *errorp = make_error_code(boost::system::errc::invalid_argument);
static OriginVn null_originvn
static uint64_t get_value(const uint8_t *data, int size)
boost::array< uint8_t, kSize > bytes_type
static const int kMinGlobalId
static OriginVn FromString(const std::string &str, boost::system::error_code *error=NULL)
static void put_value(uint8_t *data, int size, uint64_t value)