本文整理汇总了C++中string_ref::get_buffer方法的典型用法代码示例。如果您正苦于以下问题:C++ string_ref::get_buffer方法的具体用法?C++ string_ref::get_buffer怎么用?C++ string_ref::get_buffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类string_ref
的用法示例。
在下文中一共展示了string_ref::get_buffer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
string
consensus::download_from_random_authority(
const string_ref path
)
{
net::ip_address ip;
uint16_t port;
auto authority = default_authority_list[
3
// mini::crypto::random_device->get_random(default_authority_list.get_size())
];
ip = authority.ip;
port = authority.dir_port;
mini_debug(
"consensus::download_from_random_authority() [path: http://%s:%u%s]",
ip.to_string().get_buffer(),
port,
path.get_buffer());
return net::http::client::get(ip.to_string(), port, path);
}
示例2:
SECURITY_STATUS
ssl_socket::client_handshake(
PCredHandle phCreds,
const string_ref server_name,
CtxtHandle* phContext,
SecBuffer* pExtraData
)
{
SecBufferDesc OutBuffer;
SecBuffer OutBuffers[1];
DWORD dwSSPIFlags;
DWORD dwSSPIOutFlags;
TimeStamp tsExpiry;
SECURITY_STATUS scRet;
DWORD cbData;
dwSSPIFlags = ISC_REQ_SEQUENCE_DETECT |
ISC_REQ_REPLAY_DETECT |
ISC_REQ_CONFIDENTIALITY |
ISC_RET_EXTENDED_ERROR |
ISC_REQ_ALLOCATE_MEMORY |
ISC_REQ_STREAM;
OutBuffers[0].pvBuffer = NULL;
OutBuffers[0].BufferType = SECBUFFER_TOKEN;
OutBuffers[0].cbBuffer = 0;
OutBuffer.cBuffers = 1;
OutBuffer.pBuffers = OutBuffers;
OutBuffer.ulVersion = SECBUFFER_VERSION;
scRet = g_sspi->InitializeSecurityContext(
phCreds,
NULL,
(TCHAR*)server_name.get_buffer(),
dwSSPIFlags,
0,
SECURITY_NATIVE_DREP,
NULL,
0,
phContext,
&OutBuffer,
&dwSSPIOutFlags,
&tsExpiry);
if (scRet != SEC_I_CONTINUE_NEEDED)
{
return scRet;
}
if (OutBuffers[0].cbBuffer != 0 && OutBuffers[0].pvBuffer != NULL)
{
m_bAllowPlainText = TRUE;
cbData = static_cast<DWORD>(write_impl(OutBuffers[0].pvBuffer, static_cast<size_t>(OutBuffers[0].cbBuffer)));
m_bAllowPlainText = FALSE;
if (cbData == SOCKET_ERROR || cbData == 0)
{
g_sspi->FreeContextBuffer(OutBuffers[0].pvBuffer);
g_sspi->DeleteSecurityContext(phContext);
return SEC_E_INTERNAL_ERROR;
}
g_sspi->FreeContextBuffer(OutBuffers[0].pvBuffer);
OutBuffers[0].pvBuffer = NULL;
}
SECURITY_STATUS rc = client_handshake_loop(phCreds, phContext, TRUE, pExtraData);
if (pExtraData->pvBuffer)
{
delete[] pExtraData->pvBuffer;
}
return rc;
}