summaryrefslogtreecommitdiffhomepage
path: root/windows
diff options
context:
space:
mode:
Diffstat (limited to 'windows')
-rw-r--r--windows/winroute/src/winroute/winroute.cpp10
-rw-r--r--windows/winroute/src/winroute/winroute.h9
2 files changed, 14 insertions, 5 deletions
diff --git a/windows/winroute/src/winroute/winroute.cpp b/windows/winroute/src/winroute/winroute.cpp
index 3c0b8ce2dd..fe5d82d3c3 100644
--- a/windows/winroute/src/winroute/winroute.cpp
+++ b/windows/winroute/src/winroute/winroute.cpp
@@ -4,9 +4,10 @@
#include <cstdint>
#include <stdexcept>
+
extern "C"
WINROUTE_LINKAGE
-int32_t
+WINROUTE_STATUS
WINROUTE_API
WinRoute_EnsureTopMetric(
const wchar_t *deviceAlias,
@@ -17,7 +18,7 @@ WinRoute_EnsureTopMetric(
{
NetworkInterfaces interfaces;
bool metrics_set = interfaces.SetTopMetricForInterfaceByAlias(deviceAlias);
- return metrics_set ? 1 : 0;
+ return metrics_set ? WINROUTE_STATUS::METRIC_SET : WINROUTE_STATUS::METRIC_NO_CHANGE;
}
catch (std::exception &err)
{
@@ -25,11 +26,12 @@ WinRoute_EnsureTopMetric(
{
errorSink(err.what(), errorSinkContext);
}
- return -1;
+ return WINROUTE_STATUS::FAILURE;
+
}
catch (...)
{
- return -1;
+ return WINROUTE_STATUS::FAILURE;
}
};
diff --git a/windows/winroute/src/winroute/winroute.h b/windows/winroute/src/winroute/winroute.h
index 316a024d79..593108936e 100644
--- a/windows/winroute/src/winroute/winroute.h
+++ b/windows/winroute/src/winroute/winroute.h
@@ -11,10 +11,17 @@
typedef void (WINROUTE_API *WinRouteErrorSink)(const char *errorMessage, void *context);
+enum class WINROUTE_STATUS : uint32_t
+{
+ METRIC_NO_CHANGE = 0,
+ METRIC_SET = 1,
+ FAILURE = 2,
+};
+
extern "C"
WINROUTE_LINKAGE
-int32_t
+WINROUTE_STATUS
WINROUTE_API
WinRoute_EnsureTopMetric(
const wchar_t *deviceAlias,