mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 20:13:44 +02:00
One more thing to move to CAPI.cpp.
This commit is contained in:
parent
8f746f5099
commit
8e5f8140a2
2 changed files with 21 additions and 23 deletions
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue