Revert D4832473: [Folly] Disable EnvUtil::setAsCurrentEnvironment() on platforms...
[folly.git] / folly / IPAddressV6.h
index eeccc89da61e7056330977d22537bfe52cea3aa4..a1d0c7cbd3a9cd20d1e5cca951dccd64119fc939 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@
 #include <stdexcept>
 
 #include <folly/Hash.h>
+#include <folly/Optional.h>
 #include <folly/Range.h>
 #include <folly/detail/IPAddress.h>
 
@@ -209,6 +210,16 @@ class IPAddressV6 {
    */
   bool isLinkLocal() const;
 
+  /**
+   * Return the mac address if this is a link-local IPv6 address.
+   *
+   * @return an Optional<MacAddress> union representing the mac address.
+   *
+   * If the address is not a link-local one it will return an empty Optional.
+   * You can use Optional::value() to check whether the mac address is not null.
+   */
+  Optional<MacAddress> getMacAddressFromLinkLocal() const;
+
   /**
    * Return true if this is a multicast address.
    */