diff --git a/core/CAPI.cpp b/core/CAPI.cpp index 7649b63b2..f126faa09 100644 --- a/core/CAPI.cpp +++ b/core/CAPI.cpp @@ -701,4 +701,25 @@ void ZT_Certificate_delete(const ZT_Certificate *cert) /********************************************************************************************************************/ +char *ZT_Endpoint_toString( + const ZT_Endpoint *ep, + char *buf, + int capacity) +{ + if ((!ep) || (!buf) || (capacity < ZT_ENDPOINT_STRING_SIZE_MAX)) + return nullptr; + return reinterpret_cast(ep)->toString(buf); +} + +int ZT_Endpoint_fromString( + ZT_Endpoint *ep, + const char *str) +{ + if ((!ep) || (!str)) + return ZT_RESULT_ERROR_BAD_PARAMETER; + return reinterpret_cast(ep)->fromString(str) ? ZT_RESULT_OK : ZT_RESULT_ERROR_BAD_PARAMETER; +} + +/********************************************************************************************************************/ + } // extern "C" diff --git a/core/Endpoint.cpp b/core/Endpoint.cpp index 7b4c5c5f5..6cd58ca23 100644 --- a/core/Endpoint.cpp +++ b/core/Endpoint.cpp @@ -278,26 +278,3 @@ bool Endpoint::operator<(const Endpoint &ep) const noexcept } } // namespace ZeroTier - -extern "C" { - -char *ZT_Endpoint_toString( - const ZT_Endpoint *ep, - char *buf, - int capacity) -{ - if ((!ep) || (!buf) || (capacity < ZT_ENDPOINT_STRING_SIZE_MAX)) - return nullptr; - return reinterpret_cast(ep)->toString(buf); -} - -int ZT_Endpoint_fromString( - ZT_Endpoint *ep, - const char *str) -{ - if ((!ep) || (!str)) - return ZT_RESULT_ERROR_BAD_PARAMETER; - return reinterpret_cast(ep)->fromString(str) ? ZT_RESULT_OK : ZT_RESULT_ERROR_BAD_PARAMETER; -} - -} // C API