Exemplo n.º 1
0
void cb_authServIpAddress(GateKeeper_Private& client)
{
    START_REPLY(e_GateKeeperToCli_AuthServIpAddressReply);

    // Trans ID
    client.m_buffer.write<uint32_t>(DS::CryptRecvValue<uint32_t>(client.m_sock, client.m_crypt));

    // Address
    ST::utf16_buffer address = DS::Settings::AuthServerAddress();
    client.m_buffer.write<uint16_t>(address.size());
    client.m_buffer.writeBytes(address.data(), address.size() * sizeof(char16_t));

    SEND_REPLY();
}
Exemplo n.º 2
0
void DS::Stream::writeString(const ST::string& value, DS::StringType format)
{
    if (format == e_StringUTF16) {
        ST::utf16_buffer buffer = value.to_utf16();
        writeBytes(buffer.data(), buffer.size() * sizeof(char16_t));
    } else {
        ST::char_buffer buffer = (format == e_StringUTF8) ? value.to_utf8()
                               : value.to_latin_1(ST::substitute_invalid);
        writeBytes(buffer.data(), buffer.size() * sizeof(char));
    }
}