Folly parseJson doesn't handle minInt properly
[folly.git] / folly / IPAddressV6.h
index ed64a75d05e3e31dff1e3ad55a28f12fa03b8210..703f9da71e5ffeca96047bf5a8ab80bcc1fab66f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2015 Facebook, Inc.
+ * Copyright 2016 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -82,6 +82,13 @@ class IPAddressV6 : boost::totally_ordered<IPAddressV6> {
   // Binary prefix for 6to4 networks
   static const uint32_t PREFIX_6TO4;
 
+  // Size of std::string returned by toFullyQualified.
+  static constexpr size_t kToFullyQualifiedSize =
+    8 /*words*/ * 4 /*hex chars per word*/ + 7 /*separators*/;
+
+  // returns true iff the input string can be parsed as an ipv6-address
+  static bool validate(StringPiece ip);
+
   /**
    * Create a new IPAddress instance from the provided binary data.
    * @throws IPAddressFormatException if the input length is not 16 bytes.
@@ -92,6 +99,13 @@ class IPAddressV6 : boost::totally_ordered<IPAddressV6> {
     return addr;
   }
 
+  /**
+   * Returns the address as a Range.
+   */
+  ByteRange toBinary() const {
+    return ByteRange((const unsigned char *) &addr_.in6Addr_.s6_addr, 16);
+  }
+
   /**
    * Default constructor for IPAddressV6.
    *