Sfoglia il codice sorgente

One more thing to move to CAPI.cpp.

Adam Ierymenko 4 anni fa
parent
commit
8e5f8140a2
2 ha cambiato i file con 21 aggiunte e 23 eliminazioni
  1. 21 0
      core/CAPI.cpp
  2. 0 23
      core/Endpoint.cpp

+ 21 - 0
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<const ZeroTier::Endpoint *>(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<ZeroTier::Endpoint *>(ep)->fromString(str) ? ZT_RESULT_OK : ZT_RESULT_ERROR_BAD_PARAMETER;
+}
+
+/********************************************************************************************************************/
+
 } // extern "C"

+ 0 - 23
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<const ZeroTier::Endpoint *>(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<ZeroTier::Endpoint *>(ep)->fromString(str) ? ZT_RESULT_OK : ZT_RESULT_ERROR_BAD_PARAMETER;
-}
-
-} // C API