chromium/dbus/message.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "dbus/message.h"

#include <string>

#include "base/format_macros.h"
#include "base/logging.h"
#include "base/notreached.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "dbus/object_path.h"
#include "third_party/protobuf/src/google/protobuf/message_lite.h"

namespace {

// Appends the header name and the value to |output|, if the value is
// not empty.
void AppendStringHeader(const std::string& header_name,
                        const std::string& header_value,
                        std::string* output) {}

// Appends the header name and the value to |output|, if the value is
// nonzero.
void AppendUint32Header(const std::string& header_name,
                        uint32_t header_value,
                        std::string* output) {}

}  // namespace

namespace dbus {

bool IsDBusTypeUnixFdSupported() {}

Message::Message() :{}

Message::~Message() {}

void Message::Init(DBusMessage* raw_message) {}

Message::MessageType Message::GetMessageType() {}

std::string Message::GetMessageTypeAsString() {}

std::string Message::ToStringInternal(const std::string& indent,
                                      MessageReader* reader) {}

// The returned string consists of message headers such as
// destination if any, followed by a blank line, and the message
// payload. For example, a MethodCall's ToString() will look like:
//
// destination: com.example.Service
// path: /com/example/Object
// interface: com.example.Interface
// member: SomeMethod
//
// string \"payload\"
// ...
std::string Message::ToString() {}

bool Message::SetDestination(const std::string& destination) {}

bool Message::SetPath(const ObjectPath& path) {}

bool Message::SetInterface(const std::string& interface) {}

bool Message::SetMember(const std::string& member) {}

bool Message::SetErrorName(const std::string& error_name) {}

bool Message::SetSender(const std::string& sender) {}

void Message::SetSerial(uint32_t serial) {}

void Message::SetReplySerial(uint32_t reply_serial) {}

std::string Message::GetDestination() {}

ObjectPath Message::GetPath() {}

std::string Message::GetInterface() {}

std::string Message::GetMember() {}

std::string Message::GetErrorName() {}

std::string Message::GetSender() {}

std::string Message::GetSignature() {}

uint32_t Message::GetSerial() {}

uint32_t Message::GetReplySerial() {}

//
// MethodCall implementation.
//

MethodCall::MethodCall(const std::string& interface_name,
                       const std::string& method_name) {}

MethodCall::MethodCall() = default;

std::unique_ptr<MethodCall> MethodCall::FromRawMessage(
    DBusMessage* raw_message) {}

//
// Signal implementation.
//
Signal::Signal(const std::string& interface_name,
               const std::string& method_name) {}

Signal::Signal() = default;

std::unique_ptr<Signal> Signal::FromRawMessage(DBusMessage* raw_message) {}

//
// Response implementation.
//

Response::Response() = default;

std::unique_ptr<Response> Response::FromRawMessage(DBusMessage* raw_message) {}

std::unique_ptr<Response> Response::FromMethodCall(MethodCall* method_call) {}

std::unique_ptr<Response> Response::CreateEmpty() {}

//
// ErrorResponse implementation.
//

ErrorResponse::ErrorResponse() = default;

std::unique_ptr<ErrorResponse> ErrorResponse::FromRawMessage(
    DBusMessage* raw_message) {}

std::unique_ptr<ErrorResponse> ErrorResponse::FromMethodCall(
    MethodCall* method_call,
    const std::string& error_name,
    const std::string& error_message) {}

//
// MessageWriter implementation.
//

MessageWriter::MessageWriter(Message* message)
    :{}

MessageWriter::~MessageWriter() = default;

void MessageWriter::AppendByte(uint8_t value) {}

void MessageWriter::AppendBool(bool value) {}

void MessageWriter::AppendInt16(int16_t value) {}

void MessageWriter::AppendUint16(uint16_t value) {}

void MessageWriter::AppendInt32(int32_t value) {}

void MessageWriter::AppendUint32(uint32_t value) {}

void MessageWriter::AppendInt64(int64_t value) {}

void MessageWriter::AppendUint64(uint64_t value) {}

void MessageWriter::AppendDouble(double value) {}

void MessageWriter::AppendString(const std::string& value) {}

void MessageWriter::AppendObjectPath(const ObjectPath& value) {}

// Ideally, client shouldn't need to supply the signature string, but
// the underlying D-Bus library requires us to supply this before
// appending contents to array and variant. It's technically possible
// for us to design API that doesn't require the signature but it will
// complicate the implementation so we decided to have the signature
// parameter. Hopefully, variants are less used in request messages from
// client side than response message from server side, so this should
// not be a big issue.
void MessageWriter::OpenArray(const std::string& signature,
                              MessageWriter* writer) {}

void MessageWriter::OpenVariant(const std::string& signature,
                                MessageWriter* writer) {}

void MessageWriter::OpenStruct(MessageWriter* writer) {}

void MessageWriter::OpenDictEntry(MessageWriter* writer) {}

void MessageWriter::CloseContainer(MessageWriter* writer) {}

void MessageWriter::AppendArrayOfBytes(base::span<const uint8_t> values) {}

void MessageWriter::AppendArrayOfInt32s(base::span<const int32_t> values) {}

void MessageWriter::AppendArrayOfUint32s(base::span<const uint32_t> values) {}

void MessageWriter::AppendArrayOfDoubles(base::span<const double> values) {}

void MessageWriter::AppendArrayOfStrings(
    const std::vector<std::string>& strings) {}

void MessageWriter::AppendArrayOfObjectPaths(
    const std::vector<ObjectPath>& object_paths) {}

bool MessageWriter::AppendProtoAsArrayOfBytes(
    const google::protobuf::MessageLite& protobuf) {}

void MessageWriter::AppendVariantOfByte(uint8_t value) {}

void MessageWriter::AppendVariantOfBool(bool value) {}

void MessageWriter::AppendVariantOfInt16(int16_t value) {}

void MessageWriter::AppendVariantOfUint16(uint16_t value) {}

void MessageWriter::AppendVariantOfInt32(int32_t value) {}

void MessageWriter::AppendVariantOfUint32(uint32_t value) {}

void MessageWriter::AppendVariantOfInt64(int64_t value) {}

void MessageWriter::AppendVariantOfUint64(uint64_t value) {}

void MessageWriter::AppendVariantOfDouble(double value) {}

void MessageWriter::AppendVariantOfString(const std::string& value) {}

void MessageWriter::AppendVariantOfObjectPath(const ObjectPath& value) {}

void MessageWriter::AppendBasic(int dbus_type, const void* value) {}

void MessageWriter::AppendVariantOfBasic(int dbus_type, const void* value) {}

void MessageWriter::AppendFileDescriptor(int value) {}

//
// MessageReader implementation.
//

MessageReader::MessageReader(Message* message) :{}

MessageReader::~MessageReader() = default;

bool MessageReader::HasMoreData() {}

bool MessageReader::PopByte(uint8_t* value) {}

bool MessageReader::PopBool(bool* value) {}

bool MessageReader::PopInt16(int16_t* value) {}

bool MessageReader::PopUint16(uint16_t* value) {}

bool MessageReader::PopInt32(int32_t* value) {}

bool MessageReader::PopUint32(uint32_t* value) {}

bool MessageReader::PopInt64(int64_t* value) {}

bool MessageReader::PopUint64(uint64_t* value) {}

bool MessageReader::PopDouble(double* value) {}

bool MessageReader::PopString(std::string* value) {}

bool MessageReader::PopObjectPath(ObjectPath* value) {}

bool MessageReader::PopArray(MessageReader* sub_reader) {}

bool MessageReader::PopStruct(MessageReader* sub_reader) {}

bool MessageReader::PopDictEntry(MessageReader* sub_reader) {}

bool MessageReader::PopVariant(MessageReader* sub_reader) {}

bool MessageReader::PopArrayOfBytes(const uint8_t** bytes, size_t* length) {}

bool MessageReader::PopArrayOfInt32s(const int32_t** signed_ints,
                                     size_t* length) {}

bool MessageReader::PopArrayOfUint32s(const uint32_t** unsigned_ints,
                                      size_t* length) {}

bool MessageReader::PopArrayOfDoubles(const double** doubles, size_t* length) {}

bool MessageReader::PopArrayOfStrings(std::vector<std::string>* strings) {}

bool MessageReader::PopArrayOfObjectPaths(
    std::vector<ObjectPath>* object_paths) {}

bool MessageReader::PopArrayOfBytesAsProto(
    google::protobuf::MessageLite* protobuf) {}

bool MessageReader::PopVariantOfByte(uint8_t* value) {}

bool MessageReader::PopVariantOfBool(bool* value) {}

bool MessageReader::PopVariantOfInt16(int16_t* value) {}

bool MessageReader::PopVariantOfUint16(uint16_t* value) {}

bool MessageReader::PopVariantOfInt32(int32_t* value) {}

bool MessageReader::PopVariantOfUint32(uint32_t* value) {}

bool MessageReader::PopVariantOfInt64(int64_t* value) {}

bool MessageReader::PopVariantOfUint64(uint64_t* value) {}

bool MessageReader::PopVariantOfDouble(double* value) {}

bool MessageReader::PopVariantOfString(std::string* value) {}

bool MessageReader::PopVariantOfObjectPath(ObjectPath* value) {}

Message::DataType MessageReader::GetDataType() {}

std::string MessageReader::GetDataSignature() {}

bool MessageReader::CheckDataType(int dbus_type) {}

bool MessageReader::PopBasic(int dbus_type, void* value) {}

bool MessageReader::PopContainer(int dbus_type, MessageReader* sub_reader) {}

bool MessageReader::PopVariantOfBasic(int dbus_type, void* value) {}

bool MessageReader::PopFileDescriptor(base::ScopedFD* value) {}

}  // namespace dbus