void cb_broadcast(AuthServer_Private& client) { DS::FifoMessage bcast = client.m_broadcast.getMessage(); DS::BufferStream* msg = reinterpret_cast<DS::BufferStream*>(bcast.m_payload); START_REPLY(bcast.m_messageType); client.m_buffer.writeBytes(msg->buffer(), msg->size()); msg->unref(); SEND_REPLY(); }
DS::Blob gen_default_sdl(const DS::String& filename) { SDL::StateDescriptor* desc = SDL::DescriptorDb::FindDescriptor(filename, -1); if (!desc) { fprintf(stderr, "[Vault] Warning: Could not find SDL descriptor for %s\n", filename.c_str()); return DS::Blob(); } SDL::State state(desc); DS::BufferStream stream; state.write(&stream); return DS::Blob(stream.buffer(), stream.size()); }
DS::Blob SDL::State::toBlob() const { if (!m_data) return DS::Blob(); DS::BufferStream buffer; // Stream header (see ::Create) uint16_t hflags = 0x8000; if (!m_data->m_object.isNull()) hflags |= e_HFlagVolatile; buffer.write<uint16_t>(hflags); buffer.writeSafeString(m_data->m_desc->m_name); buffer.write<int16_t>(m_data->m_desc->m_version); if (!m_data->m_object.isNull()) m_data->m_object.write(&buffer); write(&buffer); return DS::Blob(buffer.buffer(), buffer.size()); }