def marshall
if @path == "/org/freedesktop/DBus/Local"
raise InvalidDestinationName
end
params = PacketMarshaller.new
@params.each do |param|
params.append(param[0], param[1])
end
@body_length = params.packet.bytesize
marshaller = PacketMarshaller.new
marshaller.append(Type::BYTE, HOST_END)
marshaller.append(Type::BYTE, @message_type)
marshaller.append(Type::BYTE, @flags)
marshaller.append(Type::BYTE, @protocol)
marshaller.append(Type::UINT32, @body_length)
marshaller.append(Type::UINT32, @serial)
marshaller.array(Type::Parser.new("y").parse[0]) do
if @path
marshaller.struct do
marshaller.append(Type::BYTE, PATH)
marshaller.append(Type::BYTE, 1)
marshaller.append_simple_string("o")
marshaller.append(Type::OBJECT_PATH, @path)
end
end
if @interface
marshaller.struct do
marshaller.append(Type::BYTE, INTERFACE)
marshaller.append(Type::BYTE, 1)
marshaller.append_simple_string("s")
marshaller.append(Type::STRING, @interface)
end
end
if @member
marshaller.struct do
marshaller.append(Type::BYTE, MEMBER)
marshaller.append(Type::BYTE, 1)
marshaller.append_simple_string("s")
marshaller.append(Type::STRING, @member)
end
end
if @error_name
marshaller.struct do
marshaller.append(Type::BYTE, ERROR_NAME)
marshaller.append(Type::BYTE, 1)
marshaller.append_simple_string("s")
marshaller.append(Type::STRING, @error_name)
end
end
if @reply_serial
marshaller.struct do
marshaller.append(Type::BYTE, REPLY_SERIAL)
marshaller.append(Type::BYTE, 1)
marshaller.append_simple_string("u")
marshaller.append(Type::UINT32, @reply_serial)
end
end
if @destination
marshaller.struct do
marshaller.append(Type::BYTE, DESTINATION)
marshaller.append(Type::BYTE, 1)
marshaller.append_simple_string("s")
marshaller.append(Type::STRING, @destination)
end
end
if @signature != ""
marshaller.struct do
marshaller.append(Type::BYTE, SIGNATURE)
marshaller.append(Type::BYTE, 1)
marshaller.append_simple_string("g")
marshaller.append(Type::SIGNATURE, @signature)
end
end
end
marshaller.align(8)
@params.each do |param|
marshaller.append(param[0], param[1])
end
marshaller.packet
end