One more thing to move to CAPI.cpp.

This commit is contained in:
Adam Ierymenko 2020-10-14 19:02:32 -04:00
parent 8f746f5099
commit 8e5f8140a2
No known key found for this signature in database
GPG key ID: C8877CF2D7A5D7F3
2 changed files with 21 additions and 23 deletions

View file

@ -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"

View file

@ -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