2012-04-26 15:48:42 +02:00
|
|
|
/*
|
2013-06-21 15:48:28 +02:00
|
|
|
* Copyright (c) [2012-2013] Novell, Inc.
|
2023-11-28 08:32:40 +01:00
|
|
|
* Copyright (c) [2016-2023] SUSE LLC
|
2012-04-26 15:48:42 +02:00
|
|
|
*
|
|
|
|
|
* All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
|
* under the terms of version 2 of the GNU General Public License as published
|
|
|
|
|
* by the Free Software Foundation.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
|
* more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, contact Novell, Inc.
|
|
|
|
|
*
|
|
|
|
|
* To contact Novell about this file by physical or electronic mail, you may
|
|
|
|
|
* find current contact information at www.novell.com.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "Types.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace DBus
|
|
|
|
|
{
|
2012-07-05 12:43:48 +02:00
|
|
|
const char* TypeInfo<ConfigInfo>::signature = "(ssa{ss})";
|
2013-01-24 14:42:04 +01:00
|
|
|
const char* TypeInfo<Snapshot>::signature = "(uquxussa{ss})";
|
2012-08-16 21:11:12 +02:00
|
|
|
const char* TypeInfo<File>::signature = "(su)";
|
2016-03-30 16:13:23 +02:00
|
|
|
const char* TypeInfo<QuotaData>::signature = "(tt)";
|
2018-10-29 10:12:22 +01:00
|
|
|
const char* TypeInfo<FreeSpaceData>::signature = "(tt)";
|
2023-11-28 08:32:40 +01:00
|
|
|
const char* TypeInfo<Plugins::Report::Entry>::signature = "(sasi)";
|
2012-04-26 15:48:42 +02:00
|
|
|
|
|
|
|
|
|
2022-05-30 20:27:26 +02:00
|
|
|
Marshaller&
|
|
|
|
|
operator<<(Marshaller& marshaller, const ConfigInfo& data)
|
2012-04-26 15:48:42 +02:00
|
|
|
{
|
2022-05-30 20:27:26 +02:00
|
|
|
marshaller.open_struct();
|
|
|
|
|
marshaller << data.get_config_name() << data.get_subvolume() << data.get_all_values();
|
|
|
|
|
marshaller.close_struct();
|
|
|
|
|
return marshaller;
|
2012-04-26 15:48:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2022-05-30 20:27:26 +02:00
|
|
|
Unmarshaller&
|
|
|
|
|
operator>>(Unmarshaller& unmarshaller, SnapshotType& data)
|
2012-04-26 15:48:42 +02:00
|
|
|
{
|
|
|
|
|
dbus_uint16_t tmp;
|
2022-05-30 20:27:26 +02:00
|
|
|
unmarshaller >> tmp;
|
2012-04-26 15:48:42 +02:00
|
|
|
data = static_cast<SnapshotType>(tmp);
|
2022-05-30 20:27:26 +02:00
|
|
|
return unmarshaller;
|
2012-04-26 15:48:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2022-05-30 20:27:26 +02:00
|
|
|
Marshaller&
|
|
|
|
|
operator<<(Marshaller& marshaller, SnapshotType data)
|
2012-04-26 15:48:42 +02:00
|
|
|
{
|
2022-05-30 20:27:26 +02:00
|
|
|
marshaller << static_cast<dbus_uint16_t>(data);
|
|
|
|
|
return marshaller;
|
2012-04-26 15:48:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2022-05-30 20:27:26 +02:00
|
|
|
Marshaller&
|
|
|
|
|
operator<<(Marshaller& marshaller, const Snapshot& data)
|
2012-04-26 15:48:42 +02:00
|
|
|
{
|
2022-05-30 20:27:26 +02:00
|
|
|
marshaller.open_struct();
|
|
|
|
|
marshaller << data.getNum() << data.getType() << data.getPreNum() << data.getDate()
|
2012-09-05 18:32:23 +02:00
|
|
|
<< data.getUid() << data.getDescription() << data.getCleanup()
|
|
|
|
|
<< data.getUserdata();
|
2022-05-30 20:27:26 +02:00
|
|
|
marshaller.close_struct();
|
|
|
|
|
return marshaller;
|
2012-04-26 15:48:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2022-05-30 20:27:26 +02:00
|
|
|
Marshaller&
|
|
|
|
|
operator<<(Marshaller& marshaller, const Snapshots& data)
|
2012-04-26 15:48:42 +02:00
|
|
|
{
|
2022-05-30 20:27:26 +02:00
|
|
|
marshaller.open_array(TypeInfo<Snapshot>::signature);
|
2025-08-04 18:21:03 +02:00
|
|
|
for (const Snapshot& snapshot : data)
|
|
|
|
|
marshaller << snapshot;
|
2022-05-30 20:27:26 +02:00
|
|
|
marshaller.close_array();
|
|
|
|
|
return marshaller;
|
2012-04-26 15:48:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2022-05-30 20:27:26 +02:00
|
|
|
Marshaller&
|
|
|
|
|
operator<<(Marshaller& marshaller, const File& data)
|
2012-04-26 15:48:42 +02:00
|
|
|
{
|
2022-05-30 20:27:26 +02:00
|
|
|
marshaller.open_struct();
|
|
|
|
|
marshaller << data.getName() << data.getPreToPostStatus();
|
|
|
|
|
marshaller.close_struct();
|
|
|
|
|
return marshaller;
|
2012-04-26 15:48:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2022-05-30 20:27:26 +02:00
|
|
|
Marshaller&
|
|
|
|
|
operator<<(Marshaller& marshaller, const QuotaData& data)
|
2016-03-30 16:13:23 +02:00
|
|
|
{
|
2022-05-30 20:27:26 +02:00
|
|
|
marshaller.open_struct();
|
|
|
|
|
marshaller << data.size << data.used;
|
|
|
|
|
marshaller.close_struct();
|
|
|
|
|
return marshaller;
|
2016-03-30 16:13:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2022-05-30 20:27:26 +02:00
|
|
|
Marshaller&
|
|
|
|
|
operator<<(Marshaller& marshaller, const FreeSpaceData& data)
|
2018-10-29 10:12:22 +01:00
|
|
|
{
|
2022-05-30 20:27:26 +02:00
|
|
|
marshaller.open_struct();
|
|
|
|
|
marshaller << data.size << data.free;
|
|
|
|
|
marshaller.close_struct();
|
|
|
|
|
return marshaller;
|
2018-10-29 10:12:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2022-05-30 20:27:26 +02:00
|
|
|
Marshaller&
|
|
|
|
|
operator<<(Marshaller& marshaller, const Files& data)
|
2012-04-26 15:48:42 +02:00
|
|
|
{
|
2022-05-30 20:27:26 +02:00
|
|
|
marshaller.open_array(TypeInfo<File>::signature);
|
2025-08-04 18:21:03 +02:00
|
|
|
for (const File& file : data)
|
|
|
|
|
marshaller << file;
|
2022-05-30 20:27:26 +02:00
|
|
|
marshaller.close_array();
|
|
|
|
|
return marshaller;
|
2012-04-26 15:48:42 +02:00
|
|
|
}
|
|
|
|
|
|
2023-11-28 08:32:40 +01:00
|
|
|
|
|
|
|
|
Marshaller&
|
|
|
|
|
operator<<(Marshaller& marshaller, const Plugins::Report::Entry& data)
|
|
|
|
|
{
|
|
|
|
|
marshaller.open_struct();
|
|
|
|
|
marshaller << data.name << data.args << data.exit_status;
|
|
|
|
|
marshaller.close_struct();
|
|
|
|
|
return marshaller;
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-26 15:48:42 +02:00
|
|
|
}
|