id
int64 0
755k
| file_name
stringlengths 3
109
| file_path
stringlengths 13
185
| content
stringlengths 31
9.38M
| size
int64 31
9.38M
| language
stringclasses 1
value | extension
stringclasses 11
values | total_lines
int64 1
340k
| avg_line_length
float64 2.18
149k
| max_line_length
int64 7
2.22M
| alphanum_fraction
float64 0
1
| repo_name
stringlengths 6
65
| repo_stars
int64 100
47.3k
| repo_forks
int64 0
12k
| repo_open_issues
int64 0
3.4k
| repo_license
stringclasses 9
values | repo_extraction_date
stringclasses 92
values | exact_duplicates_redpajama
bool 2
classes | near_duplicates_redpajama
bool 2
classes | exact_duplicates_githubcode
bool 2
classes | exact_duplicates_stackv2
bool 1
class | exact_duplicates_stackv1
bool 2
classes | near_duplicates_githubcode
bool 2
classes | near_duplicates_stackv1
bool 2
classes | near_duplicates_stackv2
bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
21,082
|
dbus_wrappers.h
|
canonical_multipass/src/platform/backends/shared/linux/dbus_wrappers.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_DBUS_WRAPPERS_H
#define MULTIPASS_DBUS_WRAPPERS_H
#include "multipass/singleton.h"
#include <multipass/disabled_copy_move.h>
#include <QString>
#include <QVariant>
#include <QtDBus/QtDBus>
#include <cassert>
#include <memory>
#include <optional>
namespace multipass::backend::dbus
{
class DBusInterface : private DisabledCopyMove
{
public:
virtual ~DBusInterface() = default;
virtual bool is_valid() const
{
assert(iface);
return iface->isValid();
}
virtual QDBusError last_error() const
{
assert(iface);
return iface->lastError();
}
virtual QString interface() const
{
assert(iface);
return iface->interface();
}
virtual QString path() const
{
assert(iface);
return iface->path();
}
virtual QString service() const
{
assert(iface);
return iface->service();
}
QDBusMessage call(QDBus::CallMode mode, const QString& method, const QVariant& arg1 = {}, const QVariant& arg2 = {},
const QVariant& arg3 = {}) // three args should be enough for the DBus methods we need
{
return call_impl(mode, method, arg1, arg2, arg3); // indirection avoids default args in virtual method
}
protected:
DBusInterface() = default; // for mocks
virtual QDBusMessage call_impl(QDBus::CallMode mode, const QString& method, const QVariant& arg1,
const QVariant& arg2, const QVariant& arg3)
{
assert(iface);
if (!arg1.isValid())
return iface->call(mode, method);
if (!arg2.isValid())
return iface->call(mode, method, arg1);
if (!arg3.isValid())
return iface->call(mode, method, arg1, arg2);
return iface->call(mode, method, arg1, arg2, arg3);
}
private:
friend class DBusConnection;
explicit DBusInterface(
std::unique_ptr<QDBusInterface>&& iface) noexcept // client creates QDBusInterface, so we can noexcept
: iface{std::move(iface)}
{
}
std::unique_ptr<QDBusInterface> iface;
};
class DBusConnection : private DisabledCopyMove
{
public:
virtual ~DBusConnection() = default;
virtual bool is_connected() const
{
return connection.value().isConnected();
}
virtual QDBusError last_error() const
{
return connection.value().lastError();
}
virtual std::unique_ptr<DBusInterface> get_interface(const QString& service, const QString& path,
const QString& interface) const
{
auto con = connection.value();
assert(con.isConnected());
auto qiface = std::make_unique<QDBusInterface>(service, path, interface, con);
return std::unique_ptr<DBusInterface>(new DBusInterface(std::move(qiface))); /* std::make_unique can't call
private ctors, so we call it ourselves; but the ctor is noexcept, so no leaks */
}
protected:
friend class DBusProvider;
explicit DBusConnection(bool create_bus) // allow mocks to skip bus fetching
: connection{create_bus ? std::optional{QDBusConnection::systemBus()} : std::nullopt}
{
}
private:
std::optional<QDBusConnection> connection;
};
class DBusProvider : public Singleton<DBusProvider>
{
public:
explicit DBusProvider(const Singleton::PrivatePass& pass) : Singleton{pass}, system_bus{/* create_bus = */ true}
{
}
virtual const DBusConnection& get_system_bus() const // return ref for polymorphism (and no chopping in mocks)
{
return system_bus;
}
private:
DBusConnection system_bus;
};
} // namespace multipass::backend::dbus
#endif // MULTIPASS_DBUS_WRAPPERS_H
| 4,429
|
C++
|
.h
| 130
| 28.146154
| 120
| 0.666511
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,083
|
backend_utils.h
|
canonical_multipass/src/platform/backends/shared/linux/backend_utils.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_BACKEND_UTILS_H
#define MULTIPASS_BACKEND_UTILS_H
#include <multipass/path.h>
#include <multipass/singleton.h>
#include <chrono>
#include <stdexcept>
#include <string>
#define MP_BACKEND multipass::Backend::instance()
#define MP_LINUX_SYSCALLS multipass::LinuxSysCalls::instance()
class QDBusError;
namespace multipass
{
class MemorySize;
class ProcessFactory;
namespace backend
{
std::string generate_random_subnet();
class CreateBridgeException : public std::runtime_error
{
public:
CreateBridgeException(const std::string& detail, const QDBusError& dbus_error, bool rollback = false);
};
} // namespace backend
class Backend : public Singleton<Backend>
{
public:
using Singleton<Backend>::Singleton;
virtual std::string create_bridge_with(const std::string& interface);
virtual std::string get_subnet(const Path& network_dir, const QString& bridge_name) const;
// For detecting KVM
virtual void check_for_kvm_support();
virtual void check_if_kvm_is_in_use();
};
class LinuxSysCalls : public Singleton<LinuxSysCalls>
{
public:
using Singleton<LinuxSysCalls>::Singleton;
virtual int close(int fd) const;
virtual int ioctl(int fd, unsigned long request, unsigned long parameter) const;
virtual int open(const char* path, mode_t mode) const;
};
} // namespace multipass
#endif // MULTIPASS_BACKEND_UTILS_H
| 2,008
|
C++
|
.h
| 59
| 31.813559
| 106
| 0.770145
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,084
|
qemu_img_utils.h
|
canonical_multipass/src/platform/backends/shared/qemu_img_utils/qemu_img_utils.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_QEMU_IMG_UTILS_H
#define MULTIPASS_QEMU_IMG_UTILS_H
#include <multipass/path.h>
#include <multipass/platform.h>
#include <optional>
namespace multipass
{
class MemorySize;
class QemuImgProcessSpec;
namespace backend
{
class QemuImgException : public std::runtime_error
{
public:
using std::runtime_error::runtime_error;
};
Process::UPtr checked_exec_qemu_img(std::unique_ptr<QemuImgProcessSpec> spec,
const std::string& custom_error_prefix = "Internal error",
std::optional<int> timeout = std::nullopt);
void resize_instance_image(const MemorySize& disk_space, const multipass::Path& image_path);
Path convert_to_qcow_if_necessary(const Path& image_path);
void amend_to_qcow2_v3(const Path& image_path);
bool instance_image_has_snapshot(const Path& image_path, QString snapshot_tag);
QByteArray snapshot_list_output(const Path& image_path);
void delete_snapshot_from_image(const Path& image_path, const QString& snapshot_tag);
} // namespace backend
} // namespace multipass
#endif // MULTIPASS_QEMU_IMG_UTILS_H
| 1,740
|
C++
|
.h
| 44
| 36.340909
| 94
| 0.747337
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,085
|
qemu_snapshot.h
|
canonical_multipass/src/platform/backends/qemu/qemu_snapshot.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_QEMU_SNAPSHOT_H
#define MULTIPASS_QEMU_SNAPSHOT_H
#include "qemu_virtual_machine.h"
#include <shared/base_snapshot.h>
#include <multipass/path.h>
namespace multipass
{
class QemuVirtualMachine;
class VirtualMachineDescription;
class QemuSnapshot : public BaseSnapshot
{
public:
QemuSnapshot(const std::string& name,
const std::string& comment,
const std::string& cloud_init_instance_id,
std::shared_ptr<Snapshot> parent,
const VMSpecs& specs,
QemuVirtualMachine& vm,
VirtualMachineDescription& desc);
QemuSnapshot(const QString& filename, QemuVirtualMachine& vm, VirtualMachineDescription& desc);
protected:
void capture_impl() override;
void erase_impl() override;
void apply_impl() override;
private:
VirtualMachineDescription& desc;
const Path& image_path;
};
} // namespace multipass
#endif // MULTIPASS_QEMU_SNAPSHOT_H
| 1,610
|
C++
|
.h
| 46
| 30.630435
| 99
| 0.728443
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,086
|
qemu_virtual_machine.h
|
canonical_multipass/src/platform/backends/qemu/qemu_virtual_machine.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_QEMU_VIRTUAL_MACHINE_H
#define MULTIPASS_QEMU_VIRTUAL_MACHINE_H
#include "qemu_platform.h"
#include <shared/base_virtual_machine.h>
#include <multipass/network_interface.h>
#include <multipass/process/process.h>
#include <multipass/virtual_machine_description.h>
#include <QObject>
#include <QStringList>
#include <unordered_map>
namespace multipass
{
class QemuPlatform;
class VMStatusMonitor;
class QemuVirtualMachine : public QObject, public BaseVirtualMachine
{
Q_OBJECT
public:
using MountArgs = std::unordered_map<std::string, std::pair<std::string, QStringList>>;
QemuVirtualMachine(const VirtualMachineDescription& desc,
QemuPlatform* qemu_platform,
VMStatusMonitor& monitor,
const SSHKeyProvider& key_provider,
const Path& instance_dir);
~QemuVirtualMachine();
void start() override;
void shutdown(ShutdownPolicy shutdown_policy = ShutdownPolicy::Powerdown) override;
void suspend() override;
State current_state() override;
int ssh_port() override;
std::string ssh_hostname(std::chrono::milliseconds timeout) override;
std::string ssh_username() override;
std::string management_ipv4() override;
std::string ipv6() override;
void ensure_vm_is_running() override;
void wait_until_ssh_up(std::chrono::milliseconds timeout) override;
void update_state() override;
void update_cpus(int num_cores) override;
void resize_memory(const MemorySize& new_size) override;
void resize_disk(const MemorySize& new_size) override;
virtual void add_network_interface(int index,
const std::string& default_mac_addr,
const NetworkInterface& extra_interface) override;
virtual MountArgs& modifiable_mount_args();
std::unique_ptr<MountHandler> make_native_mount_handler(const std::string& target, const VMMount& mount) override;
void remove_snapshots_from_image() const override;
signals:
void on_delete_memory_snapshot();
void on_reset_network();
void on_synchronize_clock();
protected:
// TODO remove this, the onus of composing a VM of stubs should be on the stub VMs
QemuVirtualMachine(const std::string& name, const SSHKeyProvider& key_provider, const Path& instance_dir)
: BaseVirtualMachine{name, key_provider, instance_dir}
{
}
void require_snapshots_support() const override;
std::shared_ptr<Snapshot> make_specific_snapshot(const QString& filename) override;
std::shared_ptr<Snapshot> make_specific_snapshot(const std::string& snapshot_name,
const std::string& comment,
const std::string& instance_id,
const VMSpecs& specs,
std::shared_ptr<Snapshot> parent) override;
private:
void on_started();
void on_error();
void on_shutdown();
void on_suspend();
void on_restart();
void initialize_vm_process();
void connect_vm_signals();
void disconnect_vm_signals();
VirtualMachineDescription desc;
std::unique_ptr<Process> vm_process{nullptr};
QemuPlatform* qemu_platform;
VMStatusMonitor* monitor;
MountArgs mount_args;
std::string saved_error_msg;
bool update_shutdown_status{true};
bool is_starting_from_suspend{false};
bool force_shutdown{false};
std::mutex vm_signal_mutex;
bool vm_signals_connected{false};
std::chrono::steady_clock::time_point network_deadline;
};
} // namespace multipass
inline void multipass::QemuVirtualMachine::require_snapshots_support() const
{
}
#endif // MULTIPASS_QEMU_VIRTUAL_MACHINE_H
| 4,477
|
C++
|
.h
| 106
| 35.254717
| 118
| 0.690629
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,087
|
qemu_base_process_spec.h
|
canonical_multipass/src/platform/backends/qemu/qemu_base_process_spec.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_QEMU_BASE_PROCESS_SPEC_H
#define MULTIPASS_QEMU_BASE_PROCESS_SPEC_H
#include <multipass/process/process_spec.h>
namespace multipass
{
class QemuBaseProcessSpec : public ProcessSpec
{
public:
QemuBaseProcessSpec() = default;
QString program() const override;
QString working_directory() const override;
QString apparmor_profile() const override;
};
} // namespace multipass
#endif // MULTIPASS_QEMU_BASE_PROCESS_SPEC_H
| 1,087
|
C++
|
.h
| 31
| 32.83871
| 72
| 0.769304
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,088
|
qemu_vm_process_spec.h
|
canonical_multipass/src/platform/backends/qemu/qemu_vm_process_spec.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_QEMU_PROCESS_H
#define MULTIPASS_QEMU_PROCESS_H
#include "qemu_base_process_spec.h"
#include "qemu_virtual_machine.h"
#include <multipass/virtual_machine_description.h>
#include <optional>
#include <unordered_map>
namespace multipass
{
class QemuVMProcessSpec : public QemuBaseProcessSpec
{
public:
struct ResumeData
{
QString suspend_tag;
QString machine_type;
bool use_cdrom_flag; // to be removed, should be replaced by "arguments"
QStringList arguments;
};
static QString default_machine_type();
explicit QemuVMProcessSpec(const VirtualMachineDescription& desc, const QStringList& platform_args,
const QemuVirtualMachine::MountArgs& mount_args,
const std::optional<ResumeData>& resume_data);
QStringList arguments() const override;
QString apparmor_profile() const override;
QString identifier() const override;
private:
const VirtualMachineDescription desc;
const QStringList platform_args;
const QemuVirtualMachine::MountArgs mount_args;
const std::optional<ResumeData> resume_data;
};
} // namespace multipass
#endif // MULTIPASS_QEMU_PROCESS_H
| 1,853
|
C++
|
.h
| 50
| 32.66
| 103
| 0.739106
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,089
|
qemu_virtual_machine_factory.h
|
canonical_multipass/src/platform/backends/qemu/qemu_virtual_machine_factory.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_QEMU_VIRTUAL_MACHINE_FACTORY_H
#define MULTIPASS_QEMU_VIRTUAL_MACHINE_FACTORY_H
#include "qemu_platform.h"
#include <multipass/path.h>
#include <shared/base_virtual_machine_factory.h>
#include <QString>
#include <string>
namespace multipass
{
class QemuVirtualMachineFactory final : public BaseVirtualMachineFactory
{
public:
explicit QemuVirtualMachineFactory(const Path& data_dir);
VirtualMachine::UPtr create_virtual_machine(const VirtualMachineDescription& desc,
const SSHKeyProvider& key_provider,
VMStatusMonitor& monitor) override;
VirtualMachine::UPtr create_vm_and_clone_instance_dir_data(const VMSpecs& src_vm_spec,
const VMSpecs& dest_vm_spec,
const std::string& source_name,
const std::string& destination_name,
const VMImage& dest_vm_image,
const SSHKeyProvider& key_provider,
VMStatusMonitor& monitor) override;
VMImage prepare_source_image(const VMImage& source_image) override;
void prepare_instance_image(const VMImage& instance_image, const VirtualMachineDescription& desc) override;
void hypervisor_health_check() override;
QString get_backend_version_string() const override;
QString get_backend_directory_name() const override;
std::vector<NetworkInterfaceInfo> networks() const override;
void require_snapshots_support() const override;
void prepare_networking(std::vector<NetworkInterface>& extra_interfaces) override;
void require_clone_support() const override
{
}
protected:
void remove_resources_for_impl(const std::string& name) override;
std::string create_bridge_with(const NetworkInterfaceInfo& interface) override;
private:
QemuVirtualMachineFactory(QemuPlatform::UPtr qemu_platform, const Path& data_dir);
QemuPlatform::UPtr qemu_platform;
};
} // namespace multipass
inline void multipass::QemuVirtualMachineFactory::require_snapshots_support() const
{
}
#endif // MULTIPASS_QEMU_VIRTUAL_MACHINE_FACTORY_H
| 3,044
|
C++
|
.h
| 62
| 38.854839
| 111
| 0.663973
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,090
|
qemu_platform.h
|
canonical_multipass/src/platform/backends/qemu/qemu_platform.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_QEMU_PLATFORM_H
#define MULTIPASS_QEMU_PLATFORM_H
#include <multipass/disabled_copy_move.h>
#include <multipass/exceptions/not_implemented_on_this_backend_exception.h>
#include <multipass/ip_address.h>
#include <multipass/network_interface_info.h>
#include <multipass/path.h>
#include <multipass/singleton.h>
#include <multipass/virtual_machine_description.h>
#include <QString>
#include <QStringList>
#include <memory>
#include <optional>
#include <string>
namespace multipass
{
class QemuPlatform : private DisabledCopyMove
{
public:
using UPtr = std::unique_ptr<QemuPlatform>;
virtual ~QemuPlatform() = default;
virtual std::optional<IPAddress> get_ip_for(const std::string& hw_addr) = 0;
virtual void remove_resources_for(const std::string&) = 0;
virtual void platform_health_check() = 0;
virtual QStringList vmstate_platform_args()
{
return {};
};
virtual QStringList vm_platform_args(const VirtualMachineDescription& vm_desc) = 0;
virtual QString get_directory_name() const
{
return {};
};
virtual bool is_network_supported(const std::string& network_type) const = 0;
virtual bool needs_network_prep() const = 0;
virtual std::string create_bridge_with(const NetworkInterfaceInfo& interface) const = 0;
virtual void set_authorization(std::vector<NetworkInterfaceInfo>& networks) = 0;
protected:
explicit QemuPlatform() = default;
};
#define MP_QEMU_PLATFORM_FACTORY multipass::QemuPlatformFactory::instance()
class QemuPlatformFactory : public Singleton<QemuPlatformFactory>
{
public:
QemuPlatformFactory(const Singleton<QemuPlatformFactory>::PrivatePass& pass) noexcept
: Singleton<QemuPlatformFactory>::Singleton{pass} {};
virtual QemuPlatform::UPtr make_qemu_platform(const Path& data_dir) const;
};
} // namespace multipass
#endif // MULTIPASS_QEMU_PLATFORM_H
| 2,526
|
C++
|
.h
| 66
| 35.363636
| 92
| 0.759085
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,091
|
qemu_mount_handler.h
|
canonical_multipass/src/platform/backends/qemu/qemu_mount_handler.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_QEMU_MOUNT_HANDLER_H
#define MULTIPASS_QEMU_MOUNT_HANDLER_H
#include "qemu_virtual_machine.h"
#include <multipass/mount_handler.h>
namespace multipass
{
class QemuMountHandler : public MountHandler
{
public:
QemuMountHandler(QemuVirtualMachine* vm,
const SSHKeyProvider* ssh_key_provider,
const std::string& target,
VMMount mount_spec);
~QemuMountHandler() override;
void activate_impl(ServerVariant server, std::chrono::milliseconds timeout) override;
void deactivate_impl(bool force) override;
bool is_active() override;
private:
QemuVirtualMachine::MountArgs& vm_mount_args;
std::string tag;
};
} // namespace multipass
#endif // MULTIPASS_QEMU_MOUNT_HANDLER_H
| 1,408
|
C++
|
.h
| 39
| 32.205128
| 89
| 0.737151
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,092
|
qemu_vmstate_process_spec.h
|
canonical_multipass/src/platform/backends/qemu/qemu_vmstate_process_spec.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_QEMU_VMSTATE_PROCESS_SPEC_H
#define MULTIPASS_QEMU_VMSTATE_PROCESS_SPEC_H
#include "qemu_base_process_spec.h"
namespace multipass
{
class QemuVmStateProcessSpec : public QemuBaseProcessSpec
{
public:
explicit QemuVmStateProcessSpec(const QString& file_name, const QStringList& platform_args = QStringList());
QStringList arguments() const override;
private:
QString file_name;
QStringList platform_args;
};
} // namespace multipass
#endif // MULTIPASS_QEMU_VMSTATE_PROCESS_SPEC_H
| 1,150
|
C++
|
.h
| 32
| 33.71875
| 112
| 0.776577
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,093
|
qemu_platform_detail.h
|
canonical_multipass/src/platform/backends/qemu/linux/qemu_platform_detail.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_QEMU_PLATFORM_DETAIL_H
#define MULTIPASS_QEMU_PLATFORM_DETAIL_H
#include "dnsmasq_server.h"
#include "firewall_config.h"
#include <qemu_platform.h>
#include <multipass/path.h>
#include <unordered_map>
#include <utility>
namespace multipass
{
// This class is the platform detail for QEMU on Linux
class QemuPlatformDetail : public QemuPlatform
{
public:
explicit QemuPlatformDetail(const Path& data_dir);
virtual ~QemuPlatformDetail();
std::optional<IPAddress> get_ip_for(const std::string& hw_addr) override;
void remove_resources_for(const std::string& name) override;
void platform_health_check() override;
QStringList vm_platform_args(const VirtualMachineDescription& vm_desc) override;
bool is_network_supported(const std::string& network_type) const override;
bool needs_network_prep() const override;
std::string create_bridge_with(const NetworkInterfaceInfo& interface) const override;
void set_authorization(std::vector<NetworkInterfaceInfo>& networks) override;
private:
const QString bridge_name;
const Path network_dir;
const std::string subnet;
DNSMasqServer::UPtr dnsmasq_server;
FirewallConfig::UPtr firewall_config;
std::unordered_map<std::string, std::pair<QString, std::string>> name_to_net_device_map;
};
} // namespace multipass
#endif // MULTIPASS_QEMU_PLATFORM_DETAIL_H
| 2,010
|
C++
|
.h
| 50
| 37.46
| 92
| 0.768443
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,094
|
dnsmasq_process_spec.h
|
canonical_multipass/src/platform/backends/qemu/linux/dnsmasq_process_spec.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_DNSMASQ_PROCESS_SPEC_H
#define MULTIPASS_DNSMASQ_PROCESS_SPEC_H
#include <multipass/ip_address.h>
#include <multipass/path.h>
#include <multipass/process/process_spec.h>
#include <string>
namespace multipass
{
class DNSMasqProcessSpec : public ProcessSpec
{
public:
explicit DNSMasqProcessSpec(const Path& data_dir, const QString& bridge_name, const std::string& subnet,
const QString& conf_file_path);
QString program() const override;
QStringList arguments() const override;
logging::Level error_log_level() const override;
QString apparmor_profile() const override;
private:
const Path data_dir;
const QString bridge_name;
const std::string subnet;
const QString conf_file_path;
};
} // namespace multipass
#endif // MULTIPASS_DNSMASQ_PROCESS_SPEC_H
| 1,477
|
C++
|
.h
| 41
| 32.756098
| 108
| 0.749649
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,095
|
firewall_config.h
|
canonical_multipass/src/platform/backends/qemu/linux/firewall_config.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_FIREWALL_CONFIG_H
#define MULTIPASS_FIREWALL_CONFIG_H
#include <multipass/singleton.h>
#include <string>
#include <QString>
namespace multipass
{
class FirewallConfig
{
public:
using UPtr = std::unique_ptr<FirewallConfig>;
FirewallConfig(const QString& bridge_name, const std::string& subnet);
virtual ~FirewallConfig();
virtual void verify_firewall_rules();
protected:
FirewallConfig() = default; // for testing
private:
void clear_all_firewall_rules();
const QString firewall;
const QString bridge_name;
const QString cidr;
const QString comment;
bool firewall_error{false};
std::string error_string;
};
#define MP_FIREWALL_CONFIG_FACTORY multipass::FirewallConfigFactory::instance()
class FirewallConfigFactory : public Singleton<FirewallConfigFactory>
{
public:
FirewallConfigFactory(const Singleton<FirewallConfigFactory>::PrivatePass& pass) noexcept
: Singleton<FirewallConfigFactory>::Singleton{pass} {};
virtual FirewallConfig::UPtr make_firewall_config(const QString& bridge_name, const std::string& subnet) const;
};
} // namespace multipass
#endif // MULTIPASS_FIREWALL_CONFIG_H
| 1,814
|
C++
|
.h
| 51
| 32.745098
| 115
| 0.768439
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,096
|
dnsmasq_server.h
|
canonical_multipass/src/platform/backends/qemu/linux/dnsmasq_server.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_DNSMASQ_SERVER_H
#define MULTIPASS_DNSMASQ_SERVER_H
#include <multipass/disabled_copy_move.h>
#include <multipass/ip_address.h>
#include <multipass/path.h>
#include <multipass/singleton.h>
#include <QTemporaryFile>
#include <memory>
#include <optional>
#include <string>
namespace multipass
{
class Process;
class DNSMasqServer : private DisabledCopyMove
{
public:
using UPtr = std::unique_ptr<DNSMasqServer>;
DNSMasqServer(const Path& data_dir, const QString& bridge_name, const std::string& subnet);
virtual ~DNSMasqServer(); // inherited by mock for testing
virtual std::optional<IPAddress> get_ip_for(const std::string& hw_addr);
virtual void release_mac(const std::string& hw_addr);
virtual void check_dnsmasq_running();
protected:
DNSMasqServer() = default; // For testing
private:
void start_dnsmasq();
const QString data_dir;
const QString bridge_name;
const std::string subnet;
std::unique_ptr<Process> dnsmasq_cmd;
QMetaObject::Connection finish_connection;
QTemporaryFile conf_file;
};
#define MP_DNSMASQ_SERVER_FACTORY multipass::DNSMasqServerFactory::instance()
class DNSMasqServerFactory : public Singleton<DNSMasqServerFactory>
{
public:
DNSMasqServerFactory(const Singleton<DNSMasqServerFactory>::PrivatePass& pass) noexcept
: Singleton<DNSMasqServerFactory>::Singleton{pass} {};
virtual DNSMasqServer::UPtr make_dnsmasq_server(const Path& network_dir, const QString& bridge_name,
const std::string& subnet) const;
};
} // namespace multipass
#endif // MULTIPASS_DNSMASQ_SERVER_H
| 2,280
|
C++
|
.h
| 60
| 34.45
| 104
| 0.749773
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,097
|
lxd_virtual_machine_factory.h
|
canonical_multipass/src/platform/backends/lxd/lxd_virtual_machine_factory.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_LXD_VIRTUAL_MACHINE_FACTORY_H
#define MULTIPASS_LXD_VIRTUAL_MACHINE_FACTORY_H
#include "lxd_request.h"
#include <multipass/network_access_manager.h>
#include <shared/base_virtual_machine_factory.h>
#include <QUrl>
namespace multipass
{
class LXDVirtualMachineFactory : public BaseVirtualMachineFactory
{
public:
explicit LXDVirtualMachineFactory(const Path& data_dir, const QUrl& base_url = lxd_socket_url);
explicit LXDVirtualMachineFactory(NetworkAccessManager::UPtr manager, const Path& data_dir,
const QUrl& base_url = lxd_socket_url);
VirtualMachine::UPtr create_virtual_machine(const VirtualMachineDescription& desc,
const SSHKeyProvider& key_provider,
VMStatusMonitor& monitor) override;
VMImage prepare_source_image(const VMImage& source_image) override;
void prepare_instance_image(const VMImage& instance_image, const VirtualMachineDescription& desc) override;
void hypervisor_health_check() override;
QString get_backend_directory_name() const override
{
return "lxd";
};
QString get_backend_version_string() const override;
VMImageVault::UPtr create_image_vault(std::vector<VMImageHost*> image_hosts, URLDownloader* downloader,
const Path& cache_dir_path, const Path& data_dir_path,
const days& days_to_expire) override;
void configure(VirtualMachineDescription& vm_desc) override;
std::vector<NetworkInterfaceInfo> networks() const override;
void require_suspend_support() const override;
protected:
void remove_resources_for_impl(const std::string& name) override;
std::string create_bridge_with(const NetworkInterfaceInfo& interface) override;
private:
NetworkAccessManager::UPtr manager;
const QUrl base_url;
QString storage_pool;
};
} // namespace multipass
inline void multipass::LXDVirtualMachineFactory::require_suspend_support() const
{
throw NotImplementedOnThisBackendException{"suspend"};
}
#endif // MULTIPASS_LXD_VIRTUAL_MACHINE_FACTORY_H
| 2,827
|
C++
|
.h
| 61
| 39.918033
| 111
| 0.721698
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,098
|
lxd_virtual_machine.h
|
canonical_multipass/src/platform/backends/lxd/lxd_virtual_machine.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_LXD_VIRTUAL_MACHINE_H
#define MULTIPASS_LXD_VIRTUAL_MACHINE_H
#include <QString>
#include <QUrl>
#include <shared/base_virtual_machine.h>
namespace multipass
{
class NetworkAccessManager;
class VirtualMachineDescription;
class VMStatusMonitor;
class LXDVirtualMachine : public BaseVirtualMachine
{
public:
LXDVirtualMachine(const VirtualMachineDescription& desc,
VMStatusMonitor& monitor,
NetworkAccessManager* manager,
const QUrl& base_url,
const QString& bridge_name,
const QString& storage_pool,
const SSHKeyProvider& key_provider,
const Path& instance_dir);
~LXDVirtualMachine() override;
void start() override;
void shutdown(ShutdownPolicy shutdown_policy = ShutdownPolicy::Powerdown) override;
void suspend() override;
State current_state() override;
int ssh_port() override;
std::string ssh_hostname(std::chrono::milliseconds timeout) override;
std::string ssh_username() override;
std::string management_ipv4() override;
std::string ipv6() override;
void ensure_vm_is_running() override;
void ensure_vm_is_running(const std::chrono::milliseconds& timeout);
void update_state() override;
void update_cpus(int num_cores) override;
void resize_memory(const MemorySize& new_size) override;
void resize_disk(const MemorySize& new_size) override;
void add_network_interface(int index,
const std::string& default_mac_addr,
const NetworkInterface& extra_interface) override;
std::unique_ptr<MountHandler> make_native_mount_handler(const std::string& target, const VMMount& mount) override;
private:
void add_extra_interface_to_instance_cloud_init(const std::string& default_mac_addr,
const NetworkInterface& extra_interface) const override;
void apply_extra_interfaces_and_instance_id_to_cloud_init(const std::string& default_mac_addr,
const std::vector<NetworkInterface>& extra_interfaces,
const std::string& new_instance_id) const override
{
throw NotImplementedOnThisBackendException("apply_extra_interfaces_and_instance_id_to_cloud_init");
}
const QString name;
const std::string username;
std::optional<int> port;
VMStatusMonitor* monitor;
bool update_shutdown_status{true};
NetworkAccessManager* manager;
const QUrl base_url;
const QString bridge_name;
const QString mac_addr;
const QString storage_pool;
const QUrl url() const;
const QUrl state_url();
const QUrl network_leases_url();
void request_state(const QString& new_state, const QJsonObject& args = {});
};
} // namespace multipass
#endif // MULTIPASS_LXD_VIRTUAL_MACHINE_H
| 3,641
|
C++
|
.h
| 83
| 35.975904
| 118
| 0.681882
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,099
|
lxd_request.h
|
canonical_multipass/src/platform/backends/lxd/lxd_request.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_LXD_REQUEST_H
#define MULTIPASS_LXD_REQUEST_H
#include <QHttpMultiPart>
#include <QJsonObject>
#include <QUrl>
#include <optional>
#include <string>
namespace multipass
{
const QUrl lxd_socket_url{"unix:///var/snap/lxd/common/lxd/unix.socket@1.0"};
const QString lxd_project_name{"multipass"};
class NetworkAccessManager;
class LXDNotFoundException : public std::runtime_error
{
public:
LXDNotFoundException() : runtime_error{"LXD object not found"}
{
}
};
class LXDRuntimeError : public std::runtime_error
{
public:
LXDRuntimeError(const std::string& message) : runtime_error{message}
{
}
};
class LXDNetworkError : public LXDRuntimeError
{
public:
LXDNetworkError(const std::string& message) : LXDRuntimeError{message}
{
}
};
class LXDJsonParseError : public std::runtime_error
{
public:
LXDJsonParseError(const std::string& message) : runtime_error{message}
{
}
};
const QJsonObject lxd_request(NetworkAccessManager* manager, const std::string& method, QUrl url,
const std::optional<QJsonObject>& json_data = std::nullopt,
int timeout = 30000 /* in milliseconds */);
const QJsonObject lxd_request(NetworkAccessManager* manager, const std::string& method, QUrl url,
QHttpMultiPart& multi_part, int timeout = 30000 /* in milliseconds */);
const QJsonObject lxd_wait(NetworkAccessManager* manager, const QUrl& base_url, const QJsonObject& task_data,
int timeout /* in milliseconds */);
} // namespace multipass
#endif // MULTIPASS_LXD_REQUEST_H
| 2,269
|
C++
|
.h
| 65
| 30.938462
| 109
| 0.722045
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,100
|
lxd_vm_image_vault.h
|
canonical_multipass/src/platform/backends/lxd/lxd_vm_image_vault.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_LXD_VM_IMAGE_VAULT_H
#define MULTIPASS_LXD_VM_IMAGE_VAULT_H
#include <multipass/days.h>
#include <multipass/exceptions/not_implemented_on_this_backend_exception.h>
#include <multipass/query.h>
#include <shared/base_vm_image_vault.h>
#include <QJsonArray>
#include <QJsonObject>
#include <QUrl>
namespace multipass
{
class NetworkAccessManager;
class URLDownloader;
class LXDVMImageVault final : public BaseVMImageVault
{
public:
using TaskCompleteAction = std::function<void(const QJsonObject&)>;
LXDVMImageVault(std::vector<VMImageHost*> image_host, URLDownloader* downloader, NetworkAccessManager* manager,
const QUrl& base_url, const QString& cache_dir_path, const multipass::days& days_to_expire);
VMImage fetch_image(const FetchType& fetch_type,
const Query& query,
const PrepareAction& prepare,
const ProgressMonitor& monitor,
const bool unlock,
const std::optional<std::string>& checksum,
const Path& /* save_dir */) override;
void remove(const std::string& name) override;
bool has_record_for(const std::string& name) override;
void prune_expired_images() override;
void update_images(const FetchType& fetch_type, const PrepareAction& prepare,
const ProgressMonitor& monitor) override;
MemorySize minimum_image_size_for(const std::string& id) override;
void clone(const std::string& source_instance_name, const std::string& destination_instance_name) override
{
throw NotImplementedOnThisBackendException("clone");
}
private:
void lxd_download_image(const VMImageInfo& info, const Query& query, const ProgressMonitor& monitor,
const QString& last_used = QString());
void url_download_image(const VMImageInfo& info, const QString& image_path, const ProgressMonitor& monitor);
void poll_download_operation(const QJsonObject& json_reply, const ProgressMonitor& monitor);
std::string lxd_import_metadata_and_image(const QString& metadata_path, const QString& image_path);
std::string get_lxd_image_hash_for(const QString& id);
QJsonArray retrieve_image_list();
URLDownloader* const url_downloader;
NetworkAccessManager* manager;
const QUrl base_url;
const QString template_path;
const days days_to_expire;
};
} // namespace multipass
#endif // MULTIPASS_LXD_VM_IMAGE_VAULT_H
| 3,145
|
C++
|
.h
| 68
| 40.323529
| 115
| 0.718057
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,101
|
lxd_mount_handler.h
|
canonical_multipass/src/platform/backends/lxd/lxd_mount_handler.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_LXD_MOUNT_HANDLER_H
#define MULTIPASS_LXD_MOUNT_HANDLER_H
#include "lxd_virtual_machine.h"
#include "multipass/mount_handler.h"
namespace multipass
{
class LXDMountHandler : public MountHandler
{
public:
LXDMountHandler(NetworkAccessManager* network_manager,
LXDVirtualMachine* lxd_virtual_machine,
const SSHKeyProvider* ssh_key_provider,
const std::string& target_path,
VMMount mount_spec);
~LXDMountHandler() override;
void activate_impl(ServerVariant server, std::chrono::milliseconds timeout) override;
void deactivate_impl(bool force) override;
bool is_mount_managed_by_backend() override
{
return true;
}
private:
void lxd_device_add();
void lxd_device_remove();
// data member
NetworkAccessManager* network_manager{nullptr};
const QUrl lxd_instance_endpoint{};
const std::string device_name{};
};
} // namespace multipass
#endif // MULTIPASS_LXD_MOUNT_HANDLER_H
| 1,663
|
C++
|
.h
| 47
| 30.914894
| 89
| 0.722637
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,102
|
journald_logger.h
|
canonical_multipass/src/platform/logger/journald_logger.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_JOURNALD_LOGGER_H
#define MULTIPASS_JOURNALD_LOGGER_H
#include "linux_logger.h"
namespace multipass
{
namespace logging
{
class JournaldLogger : public LinuxLogger
{
public:
explicit JournaldLogger(Level level);
void log(Level level, CString category, CString message) const override;
};
} // namespace logging
} // namespace multipass
#endif // MULTIPASS_JOURNALD_LOGGER_H
| 1,031
|
C++
|
.h
| 32
| 30.40625
| 76
| 0.773092
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,103
|
linux_logger.h
|
canonical_multipass/src/platform/logger/linux_logger.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_LINUX_LOGGER_H
#define MULTIPASS_LINUX_LOGGER_H
#include <multipass/logging/logger.h>
#include <syslog.h>
namespace multipass
{
namespace logging
{
class LinuxLogger : public Logger
{
public:
explicit LinuxLogger(Level level);
protected:
static constexpr auto to_syslog_priority(const Level& level) noexcept
{
switch (level)
{
case Level::trace:
case Level::debug:
return LOG_DEBUG;
case Level::error:
return LOG_ERR;
case Level::info:
return LOG_INFO;
case Level::warning:
return LOG_WARNING;
}
return 42;
}
};
} // namespace logging
} // namespace multipass
#endif // MULTIPASS_LINUX_LOGGER_H
| 1,381
|
C++
|
.h
| 49
| 24.020408
| 73
| 0.698795
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,104
|
syslog_logger.h
|
canonical_multipass/src/platform/logger/syslog_logger.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_SYSLOG_LOGGER_H
#define MULTIPASS_SYSLOG_LOGGER_H
#include "linux_logger.h"
namespace multipass
{
namespace logging
{
class SyslogLogger : public LinuxLogger
{
public:
explicit SyslogLogger(Level level);
void log(Level level, CString category, CString message) const override;
};
} // namespace logging
} // namespace multipass
#endif // MULTIPASS_SYSLOG_LOGGER_H
| 1,021
|
C++
|
.h
| 32
| 30.09375
| 76
| 0.770791
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,105
|
default_update_prompt.h
|
canonical_multipass/src/platform/update/default_update_prompt.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_DEFAULT_UPDATE_PROMPT_H
#define MULTIPASS_DEFAULT_UPDATE_PROMPT_H
#include <multipass/update_prompt.h>
#include <chrono>
#include <memory>
namespace multipass
{
class NewReleaseMonitor;
/*
* Update Prompt that checks Default
*/
class DefaultUpdatePrompt : public UpdatePrompt
{
public:
DefaultUpdatePrompt();
~DefaultUpdatePrompt();
bool is_time_to_show() override;
void populate(UpdateInfo *update_info) override;
void populate_if_time_to_show(UpdateInfo *update_info) override;
private:
std::unique_ptr<NewReleaseMonitor> monitor;
std::chrono::system_clock::time_point last_shown;
};
} // namespace multipass
#endif // MULTIPASS_DEFAULT_UPDATE_PROMPT_H
| 1,338
|
C++
|
.h
| 41
| 30.365854
| 72
| 0.767442
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,106
|
new_release_monitor.h
|
canonical_multipass/src/platform/update/new_release_monitor.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_NEW_RELEASE_MONITOR_H
#define MULTIPASS_NEW_RELEASE_MONITOR_H
#include <multipass/new_release_info.h>
#include <multipass/qt_delete_later_unique_ptr.h>
#include <QObject>
#include <QString>
#include <QTimer>
#include <optional>
namespace multipass
{
class LatestReleaseChecker;
/*
* NewReleaseMonitor - monitors for new Multipass releases
*
* Checks for new releases occur on an internal thread to avoid blocking
* callers. Rechecks happen at a specified intervals.
*
* TODO: the internal thread can be removed when refactoring to move all
* blocking calls off the main-loop.
*/
class NewReleaseMonitor : public QObject
{
Q_OBJECT
public:
static constexpr auto default_update_url = "https://multipass.run/static/latest-release.json";
NewReleaseMonitor(const QString& current_version, std::chrono::steady_clock::duration refresh_rate,
const QString& update_url = default_update_url);
~NewReleaseMonitor();
std::optional<NewReleaseInfo> get_new_release() const;
private slots:
void check_for_new_release();
void latest_release_found(const NewReleaseInfo& latest_release);
private:
const QString current_version, update_url;
std::optional<NewReleaseInfo> new_release;
QTimer refresh_timer;
qt_delete_later_unique_ptr<LatestReleaseChecker> worker_thread;
};
} // namespace multipass
#endif // MULTIPASS_NEW_RELEASE_MONITOR_H
| 2,054
|
C++
|
.h
| 56
| 33.857143
| 103
| 0.764232
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,107
|
disabled_update_prompt.h
|
canonical_multipass/src/platform/update/disabled_update_prompt.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_DISABLED_UPDATE_PROMPT_H
#define MULTIPASS_DISABLED_UPDATE_PROMPT_H
#include <multipass/update_prompt.h>
namespace multipass
{
class DisabledUpdatePrompt : public UpdatePrompt
{
public:
bool is_time_to_show() override { return false; }
void populate(UpdateInfo *) override {}
void populate_if_time_to_show(UpdateInfo *) override {}
};
} // namespace multipass
#endif // MULTIPASS_DISABLED_UPDATE_PROMPT_H
| 1,068
|
C++
|
.h
| 30
| 33.533333
| 72
| 0.763795
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,108
|
local_socket_reply.h
|
canonical_multipass/src/network/local_socket_reply.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_LOCAL_SOCKET_REPLY_H
#define MULTIPASS_LOCAL_SOCKET_REPLY_H
#include <QByteArray>
#include <QLocalSocket>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QString>
#include <memory>
namespace multipass
{
using LocalSocketUPtr = std::unique_ptr<QLocalSocket>;
class LocalSocketReply : public QNetworkReply
{
Q_OBJECT
public:
LocalSocketReply(LocalSocketUPtr local_socket, const QNetworkRequest& request, QIODevice* outgoingData);
LocalSocketReply();
virtual ~LocalSocketReply();
public Q_SLOTS:
void abort() override;
protected:
qint64 readData(char* data, qint64 maxSize) override;
QByteArray content_data;
private slots:
void read_reply();
void read_finish();
private:
void send_request(const QNetworkRequest& request, QIODevice* outgoingData);
void parse_reply();
void parse_status(const QByteArray& status);
bool local_socket_write(const QByteArray& data);
LocalSocketUPtr local_socket;
QByteArray reply_data;
qint64 reply_offset{0};
qint64 offset{0};
bool chunked_transfer_encoding{false};
};
} // namespace multipass
#endif // MULTIPASS_LOCAL_SOCKET_REPLY_H
| 1,805
|
C++
|
.h
| 55
| 30.036364
| 108
| 0.765382
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,109
|
petname.h
|
canonical_multipass/src/petname/petname.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
* Authored by: Alberto Aguirre <alberto.aguirre@canonical.com>
*
*/
#ifndef MULTIPASS_PETNAME_H
#define MULTIPASS_PETNAME_H
#include <multipass/name_generator.h>
#include <random>
#include <string>
#include <vector>
namespace multipass
{
class Petname final : public NameGenerator
{
public:
enum class NumWords
{
ONE,
TWO,
THREE
};
/// Constructs an instance that will generate names using
/// the requested separator and the requested number of words
Petname(NumWords num_words, std::string separator);
/// Constructs an instance that will generate names using
/// a default separator of "-" and the requested number of words
explicit Petname(NumWords num_words);
/// Constructs an instance that will generate names using
/// the requested separator and two words
explicit Petname(std::string separator);
std::string make_name() override;
private:
std::string separator;
NumWords num_words;
std::mt19937 engine;
std::uniform_int_distribution<std::size_t> name_dist;
std::uniform_int_distribution<std::size_t> adjective_dist;
std::uniform_int_distribution<std::size_t> adverb_dist;
};
}
#endif // MULTIPASS_PETNAME_H
| 1,851
|
C++
|
.h
| 55
| 30.4
| 72
| 0.737283
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,110
|
daemon.h
|
canonical_multipass/src/daemon/daemon.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_DAEMON_H
#define MULTIPASS_DAEMON_H
#include "daemon_config.h"
#include "daemon_rpc.h"
#include <multipass/async_periodic_download_task.h>
#include <multipass/delayed_shutdown_timer.h>
#include <multipass/format.h>
#include <multipass/mount_handler.h>
#include <multipass/virtual_machine.h>
#include <multipass/vm_specs.h>
#include <multipass/vm_status_monitor.h>
#include <chrono>
#include <future>
#include <memory>
#include <mutex>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <QFutureWatcher>
namespace multipass
{
struct DaemonConfig;
class SettingsHandler;
class Daemon : public QObject, public multipass::VMStatusMonitor
{
Q_OBJECT
public:
explicit Daemon(std::unique_ptr<const DaemonConfig> config);
~Daemon();
void persist_instances();
protected:
using InstanceTable = std::unordered_map<std::string, VirtualMachine::ShPtr>;
void on_resume() override;
void on_shutdown() override;
void on_suspend() override;
void on_restart(const std::string& name) override;
void persist_state_for(const std::string& name, const VirtualMachine::State& state) override;
void update_metadata_for(const std::string& name, const QJsonObject& metadata) override;
QJsonObject retrieve_metadata_for(const std::string& name) override;
public slots:
virtual void shutdown_grpc_server();
virtual void create(const CreateRequest* request,
grpc::ServerReaderWriterInterface<CreateReply, CreateRequest>* server,
std::promise<grpc::Status>* status_promise);
virtual void launch(const LaunchRequest* request,
grpc::ServerReaderWriterInterface<LaunchReply, LaunchRequest>* server,
std::promise<grpc::Status>* status_promise);
virtual void purge(const PurgeRequest* request, grpc::ServerReaderWriterInterface<PurgeReply, PurgeRequest>* server,
std::promise<grpc::Status>* status_promise);
virtual void find(const FindRequest* request, grpc::ServerReaderWriterInterface<FindReply, FindRequest>* server,
std::promise<grpc::Status>* status_promise);
virtual void info(const InfoRequest* request, grpc::ServerReaderWriterInterface<InfoReply, InfoRequest>* server,
std::promise<grpc::Status>* status_promise);
virtual void list(const ListRequest* request, grpc::ServerReaderWriterInterface<ListReply, ListRequest>* server,
std::promise<grpc::Status>* status_promise);
virtual void networks(const NetworksRequest* request,
grpc::ServerReaderWriterInterface<NetworksReply, NetworksRequest>* server,
std::promise<grpc::Status>* status_promise);
virtual void mount(const MountRequest* request, grpc::ServerReaderWriterInterface<MountReply, MountRequest>* server,
std::promise<grpc::Status>* status_promise);
virtual void recover(const RecoverRequest* request,
grpc::ServerReaderWriterInterface<RecoverReply, RecoverRequest>* server,
std::promise<grpc::Status>* status_promise);
virtual void ssh_info(const SSHInfoRequest* request,
grpc::ServerReaderWriterInterface<SSHInfoReply, SSHInfoRequest>* server,
std::promise<grpc::Status>* status_promise);
virtual void start(const StartRequest* request, grpc::ServerReaderWriterInterface<StartReply, StartRequest>* server,
std::promise<grpc::Status>* status_promise);
virtual void stop(const StopRequest* request, grpc::ServerReaderWriterInterface<StopReply, StopRequest>* server,
std::promise<grpc::Status>* status_promise);
virtual void suspend(const SuspendRequest* request,
grpc::ServerReaderWriterInterface<SuspendReply, SuspendRequest>* server,
std::promise<grpc::Status>* status_promise);
virtual void restart(const RestartRequest* request,
grpc::ServerReaderWriterInterface<RestartReply, RestartRequest>* server,
std::promise<grpc::Status>* status_promise);
virtual void delet(const DeleteRequest* request,
grpc::ServerReaderWriterInterface<DeleteReply, DeleteRequest>* server,
std::promise<grpc::Status>* status_promise);
virtual void umount(const UmountRequest* request,
grpc::ServerReaderWriterInterface<UmountReply, UmountRequest>* server,
std::promise<grpc::Status>* status_promise);
virtual void version(const VersionRequest* request,
grpc::ServerReaderWriterInterface<VersionReply, VersionRequest>* server,
std::promise<grpc::Status>* status_promise);
virtual void get(const GetRequest* request, grpc::ServerReaderWriterInterface<GetReply, GetRequest>* server,
std::promise<grpc::Status>* status_promise);
virtual void set(const SetRequest* request, grpc::ServerReaderWriterInterface<SetReply, SetRequest>* server,
std::promise<grpc::Status>* status_promise);
virtual void keys(const KeysRequest* request, grpc::ServerReaderWriterInterface<KeysReply, KeysRequest>* server,
std::promise<grpc::Status>* status_promise);
virtual void authenticate(const AuthenticateRequest* request,
grpc::ServerReaderWriterInterface<AuthenticateReply, AuthenticateRequest>* server,
std::promise<grpc::Status>* status_promise);
virtual void clone(const CloneRequest* request,
grpc::ServerReaderWriterInterface<CloneReply, CloneRequest>* server,
std::promise<grpc::Status>* status_promise);
virtual void snapshot(const SnapshotRequest* request,
grpc::ServerReaderWriterInterface<SnapshotReply, SnapshotRequest>* server,
std::promise<grpc::Status>* status_promise);
virtual void restore(const RestoreRequest* request,
grpc::ServerReaderWriterInterface<RestoreReply, RestoreRequest>* server,
std::promise<grpc::Status>* status_promise);
virtual void daemon_info(const DaemonInfoRequest* request,
grpc::ServerReaderWriterInterface<DaemonInfoReply, DaemonInfoRequest>* server,
std::promise<grpc::Status>* status_promise);
private:
void release_resources(const std::string& instance);
void create_vm(const CreateRequest* request, grpc::ServerReaderWriterInterface<CreateReply, CreateRequest>* server,
std::promise<grpc::Status>* status_promise, bool start);
bool delete_vm(InstanceTable::iterator vm_it, bool purge, DeleteReply& response);
grpc::Status reboot_vm(VirtualMachine& vm);
grpc::Status shutdown_vm(VirtualMachine& vm, const std::chrono::milliseconds delay);
grpc::Status switch_off_vm(VirtualMachine& vm);
grpc::Status cancel_vm_shutdown(const VirtualMachine& vm);
grpc::Status get_ssh_info_for_vm(VirtualMachine& vm, SSHInfoReply& response);
void init_mounts(const std::string& name);
void stop_mounts(const std::string& name);
// This returns whether any specs were updated (and need persisting)
bool update_mounts(VMSpecs& vm_specs,
std::unordered_map<std::string, MountHandler::UPtr>& vm_mounts,
VirtualMachine* vm);
// This returns whether all required mount handlers were successfully created
bool create_missing_mounts(std::unordered_map<std::string, VMMount>& mount_specs,
std::unordered_map<std::string, MountHandler::UPtr>& vm_mounts,
VirtualMachine* vm);
MountHandler::UPtr make_mount(VirtualMachine* vm, const std::string& target, const VMMount& mount);
struct AsyncOperationStatus
{
grpc::Status status;
std::promise<grpc::Status>* status_promise;
};
// These async_* methods need to operate on instance names and look up the VMs again, lest they be gone or moved.
template <typename Reply, typename Request>
std::string async_wait_for_ssh_and_start_mounts_for(const std::string& name, const std::chrono::seconds& timeout,
grpc::ServerReaderWriterInterface<Reply, Request>* server);
template <typename Reply, typename Request>
AsyncOperationStatus async_wait_for_ready_all(grpc::ServerReaderWriterInterface<Reply, Request>* server,
const std::vector<std::string>& vms,
const std::chrono::seconds& timeout,
std::promise<grpc::Status>* status_promise,
const std::string& errors,
const std::string& start_warnings);
void finish_async_operation(const std::string& async_future_key);
QFutureWatcher<AsyncOperationStatus>* create_future_watcher(std::function<void()> const& finished_op = []() {});
void update_manifests_all(const bool is_force_update_from_network = false);
// it is applied in Daemon::find wherever the image info fetching is involved, aka non-only-blueprints case
void wait_update_manifests_all_and_optionally_applied_force(const bool force_manifest_network_download);
template <typename Reply, typename Request>
void reply_msg(grpc::ServerReaderWriterInterface<Reply, Request>* server, std::string&& msg, bool sticky = false);
void
populate_instance_info(VirtualMachine& vm, InfoReply& response, bool runtime_info, bool deleted, bool& have_mounts);
bool is_instance_name_already_used(const std::string& instance_name);
std::string generate_destination_instance_name_for_clone(const CloneRequest& request);
VMSpecs clone_spec(const VMSpecs& src_vm_spec, const std::string& src_name, const std::string& dest_name);
std::unique_ptr<const DaemonConfig> config;
protected:
std::unordered_map<std::string, VMSpecs> vm_instance_specs;
InstanceTable operative_instances;
bool is_bridged(const std::string& instance_name) const;
void add_bridged_interface(const std::string& instance_name);
private:
InstanceTable deleted_instances;
std::unordered_map<std::string, std::unique_ptr<DelayedShutdownTimer>> delayed_shutdown_instances;
std::unordered_set<std::string> allocated_mac_addrs;
DaemonRpc daemon_rpc;
QTimer source_images_maintenance_task;
multipass::utils::AsyncPeriodicDownloadTask<void> update_manifests_all_task{"fetch manifest periodically",
std::chrono::minutes(15),
std::chrono::seconds(5),
&Daemon::update_manifests_all,
this,
false};
std::unordered_map<std::string, std::unique_ptr<QFutureWatcher<AsyncOperationStatus>>> async_future_watchers;
std::unordered_map<std::string, QFuture<std::string>> async_running_futures;
std::mutex start_mutex;
std::unordered_set<std::string> preparing_instances;
QFuture<void> image_update_future;
SettingsHandler* instance_mod_handler;
SettingsHandler* snapshot_mod_handler;
std::unordered_map<std::string, std::unordered_map<std::string, MountHandler::UPtr>> mounts;
std::unordered_set<std::string> user_authorized_bridges;
};
} // namespace multipass
#endif // MULTIPASS_DAEMON_H
| 12,690
|
C++
|
.h
| 201
| 50.860697
| 120
| 0.667203
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,111
|
custom_image_host.h
|
canonical_multipass/src/daemon/custom_image_host.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_CUSTOM_IMAGE_HOST
#define MULTIPASS_CUSTOM_IMAGE_HOST
#include "common_image_host.h"
#include <QString>
#include <memory>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
namespace multipass
{
class URLDownloader;
struct CustomManifest
{
const std::vector<VMImageInfo> products;
const std::unordered_map<std::string, const VMImageInfo*> image_records;
CustomManifest(std::vector<VMImageInfo>&& images);
};
class CustomVMImageHost final : public CommonVMImageHost
{
public:
CustomVMImageHost(const QString& arch, URLDownloader* downloader);
std::optional<VMImageInfo> info_for(const Query& query) override;
std::vector<std::pair<std::string, VMImageInfo>> all_info_for(const Query& query) override;
std::vector<VMImageInfo> all_images_for(const std::string& remote_name, const bool allow_unsupported) override;
std::vector<std::string> supported_remotes() override;
private:
void for_each_entry_do_impl(const Action& action) override;
VMImageInfo info_for_full_hash_impl(const std::string& full_hash) override;
void fetch_manifests(const bool is_force_update_from_network) override;
void clear() override;
CustomManifest* manifest_from(const std::string& remote_name);
const QString arch;
URLDownloader* const url_downloader;
std::unordered_map<std::string, std::unique_ptr<CustomManifest>> custom_image_info;
std::vector<std::string> remotes;
};
} // namespace multipass
#endif // MULTIPASS_CUSTOM_IMAGE_HOST
| 2,165
|
C++
|
.h
| 55
| 36.654545
| 115
| 0.764173
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,112
|
runtime_instance_info_helper.h
|
canonical_multipass/src/daemon/runtime_instance_info_helper.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_RUNTIME_INSTANCE_INFO_HELPER_H
#define MULTIPASS_RUNTIME_INSTANCE_INFO_HELPER_H
#include <string>
namespace multipass
{
class VirtualMachine;
class DetailedInfoItem;
class InstanceDetails;
// Note: we could extract other code to info/list populating code here, but that is left as a future improvement
struct RuntimeInstanceInfoHelper
{
static void populate_runtime_info(VirtualMachine& vm,
DetailedInfoItem* info,
InstanceDetails* instance_info,
const std::string& original_release,
bool parallelize);
};
} // namespace multipass
#endif // MULTIPASS_RUNTIME_INSTANCE_INFO_HELPER_H
| 1,390
|
C++
|
.h
| 35
| 33.657143
| 112
| 0.702001
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,113
|
default_vm_image_vault.h
|
canonical_multipass/src/daemon/default_vm_image_vault.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_DEFAULT_VM_IMAGE_VAULT_H
#define MULTIPASS_DEFAULT_VM_IMAGE_VAULT_H
#include <multipass/days.h>
#include <multipass/query.h>
#include <multipass/vm_image.h>
#include <multipass/vm_image_host.h>
#include <shared/base_vm_image_vault.h>
#include <QDir>
#include <QFuture>
#include <mutex>
#include <optional>
#include <unordered_map>
namespace multipass
{
class URLDownloader;
class VMImageHost;
class VaultRecord
{
public:
multipass::VMImage image;
multipass::Query query;
std::chrono::system_clock::time_point last_accessed;
};
class DefaultVMImageVault final : public BaseVMImageVault
{
public:
DefaultVMImageVault(std::vector<VMImageHost*> image_host,
URLDownloader* downloader,
const multipass::Path& cache_dir_path,
const multipass::Path& data_dir_path,
const multipass::days& days_to_expire);
~DefaultVMImageVault();
VMImage fetch_image(const FetchType& fetch_type,
const Query& query,
const PrepareAction& prepare,
const ProgressMonitor& monitor,
const bool unlock,
const std::optional<std::string>& checksum,
const Path& save_dir) override;
void remove(const std::string& name) override;
bool has_record_for(const std::string& name) override;
void prune_expired_images() override;
void update_images(const FetchType& fetch_type, const PrepareAction& prepare,
const ProgressMonitor& monitor) override;
MemorySize minimum_image_size_for(const std::string& id) override;
void clone(const std::string& source_instance_name, const std::string& destination_instance_name) override;
private:
VMImage image_instance_from(const VMImage& prepared_image, const Path& dest_dir);
VMImage download_and_prepare_source_image(const VMImageInfo& info, std::optional<VMImage>& existing_source_image,
const QDir& image_dir, const FetchType& fetch_type,
const PrepareAction& prepare, const ProgressMonitor& monitor);
QString extract_image_from(const VMImage& source_image, const ProgressMonitor& monitor, const Path& dest_dir);
std::optional<QFuture<VMImage>> get_image_future(const std::string& id);
VMImage finalize_image_records(const Query& query,
const VMImage& prepared_image,
const std::string& id,
const Path& dest_dir);
void persist_image_records();
void persist_instance_records();
URLDownloader* const url_downloader;
const QDir cache_dir;
const QDir data_dir;
const QDir images_dir;
const days days_to_expire;
std::mutex fetch_mutex;
std::unordered_map<std::string, VaultRecord> prepared_image_records;
std::unordered_map<std::string, VaultRecord> instance_image_records;
std::unordered_map<std::string, QFuture<VMImage>> in_progress_image_fetches;
};
} // namespace multipass
#endif // MULTIPASS_DEFAULT_VM_IMAGE_VAULT_H
| 3,846
|
C++
|
.h
| 87
| 36.356322
| 117
| 0.676
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,114
|
daemon_config.h
|
canonical_multipass/src/daemon/daemon_config.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_DAEMON_CONFIG_H
#define MULTIPASS_DAEMON_CONFIG_H
#include <multipass/cert_provider.h>
#include <multipass/cert_store.h>
#include <multipass/days.h>
#include <multipass/logging/logger.h>
#include <multipass/logging/multiplexing_logger.h>
#include <multipass/name_generator.h>
#include <multipass/path.h>
#include <multipass/rpc/multipass.grpc.pb.h>
#include <multipass/ssh/ssh_key_provider.h>
#include <multipass/update_prompt.h>
#include <multipass/url_downloader.h>
#include <multipass/virtual_machine_factory.h>
#include <multipass/vm_blueprint_provider.h>
#include <multipass/vm_image_host.h>
#include <multipass/vm_image_vault.h>
#include <QNetworkProxy>
#include <memory>
#include <vector>
namespace multipass
{
struct DaemonConfig
{
~DaemonConfig();
const std::unique_ptr<URLDownloader> url_downloader;
const std::unique_ptr<VirtualMachineFactory> factory;
const std::vector<std::unique_ptr<VMImageHost>> image_hosts;
const std::unique_ptr<VMImageVault> vault;
const std::unique_ptr<NameGenerator> name_generator;
const std::unique_ptr<SSHKeyProvider> ssh_key_provider;
const std::unique_ptr<CertProvider> cert_provider;
const std::unique_ptr<CertStore> client_cert_store;
const std::unique_ptr<UpdatePrompt> update_prompt;
const std::shared_ptr<logging::MultiplexingLogger> logger;
const std::unique_ptr<QNetworkProxy> network_proxy;
const std::unique_ptr<VMBlueprintProvider> blueprint_provider;
const multipass::Path cache_directory;
const multipass::Path data_directory;
const std::string server_address;
const std::string ssh_username;
const std::chrono::hours image_refresh_timer;
};
struct DaemonConfigBuilder
{
std::unique_ptr<URLDownloader> url_downloader;
std::unique_ptr<VirtualMachineFactory> factory;
std::vector<std::unique_ptr<VMImageHost>> image_hosts;
std::unique_ptr<VMImageVault> vault;
std::unique_ptr<NameGenerator> name_generator;
std::unique_ptr<SSHKeyProvider> ssh_key_provider;
std::unique_ptr<CertProvider> cert_provider;
std::unique_ptr<CertStore> client_cert_store;
std::unique_ptr<UpdatePrompt> update_prompt;
std::unique_ptr<logging::Logger> logger;
std::unique_ptr<QNetworkProxy> network_proxy;
std::unique_ptr<VMBlueprintProvider> blueprint_provider;
multipass::Path cache_directory;
multipass::Path data_directory;
std::string server_address;
std::string ssh_username;
multipass::days days_to_expire{14};
std::chrono::hours image_refresh_timer{6};
multipass::logging::Level verbosity_level{multipass::logging::Level::info};
std::unique_ptr<const DaemonConfig> build();
};
} // namespace multipass
#endif // MULTIPASS_DAEMON_CONFIG_H
| 3,379
|
C++
|
.h
| 84
| 37.142857
| 79
| 0.764223
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,115
|
snapshot_settings_handler.h
|
canonical_multipass/src/daemon/snapshot_settings_handler.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_SNAPSHOT_SETTINGS_HANDLER_H
#define MULTIPASS_SNAPSHOT_SETTINGS_HANDLER_H
#include <multipass/exceptions/settings_exceptions.h>
#include <multipass/settings/settings_handler.h>
#include <multipass/snapshot.h>
#include <multipass/virtual_machine.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
namespace multipass
{
class SnapshotSettingsHandler : public SettingsHandler
{
public:
SnapshotSettingsHandler(std::unordered_map<std::string, VirtualMachine::ShPtr>& operative_instances,
const std::unordered_map<std::string, VirtualMachine::ShPtr>& deleted_instances,
const std::unordered_set<std::string>& preparing_instances) noexcept;
std::set<QString> keys() const override;
QString get(const QString& key) const override;
void set(const QString& key, const QString& val) override;
private:
std::shared_ptr<const Snapshot> find_snapshot(const std::string& instance_name,
const std::string& snapshot_name,
bool deleted_ok = true) const;
std::shared_ptr<const VirtualMachine> find_instance(const std::string& instance_name, bool deleted_ok = true) const;
std::shared_ptr<Snapshot> modify_snapshot(const std::string& instance_name, const std::string& snapshot_name);
std::shared_ptr<VirtualMachine> modify_instance(const std::string& instance_name);
private:
// references, careful
std::unordered_map<std::string, VirtualMachine::ShPtr>& operative_instances;
const std::unordered_map<std::string, VirtualMachine::ShPtr>& deleted_instances;
const std::unordered_set<std::string>& preparing_instances;
};
class SnapshotSettingsException : public SettingsException
{
public:
SnapshotSettingsException(const std::string& missing_instance, const std::string& detail);
explicit SnapshotSettingsException(const std::string& detail);
};
} // namespace multipass
#endif // MULTIPASS_SNAPSHOT_SETTINGS_HANDLER_H
| 2,690
|
C++
|
.h
| 57
| 42
| 120
| 0.732163
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,116
|
daemon_rpc.h
|
canonical_multipass/src/daemon/daemon_rpc.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_DAEMON_RPC_H
#define MULTIPASS_DAEMON_RPC_H
#include "daemon_config.h"
#include <multipass/cert_provider.h>
#include <multipass/disabled_copy_move.h>
#include <multipass/rpc/multipass.grpc.pb.h>
#include <grpcpp/grpcpp.h>
#include <QObject>
#include <future>
#include <memory>
namespace multipass
{
using CreateRequest = LaunchRequest;
using CreateReply = LaunchReply;
using CreateError = LaunchError;
using CreateProgress = LaunchProgress;
// Skip running moc on this enum class since it fails parsing it
#ifndef Q_MOC_RUN
enum class ServerSocketType
{
tcp,
unix
};
#endif
struct DaemonConfig;
class DaemonRpc : public QObject, public multipass::Rpc::Service, private DisabledCopyMove
{
Q_OBJECT
public:
DaemonRpc(const std::string& server_address, const CertProvider& cert_provider, CertStore* client_cert_store);
void shutdown_and_wait();
signals:
void on_create(const CreateRequest* request, grpc::ServerReaderWriter<CreateReply, CreateRequest>* server,
std::promise<grpc::Status>* status_promise);
void on_launch(const LaunchRequest* request, grpc::ServerReaderWriter<LaunchReply, LaunchRequest>* server,
std::promise<grpc::Status>* status_promise);
void on_purge(const PurgeRequest* request, grpc::ServerReaderWriter<PurgeReply, PurgeRequest>* server,
std::promise<grpc::Status>* status_promise);
void on_find(const FindRequest* request, grpc::ServerReaderWriter<FindReply, FindRequest>* server,
std::promise<grpc::Status>* status_promise);
void on_info(const InfoRequest* request, grpc::ServerReaderWriter<InfoReply, InfoRequest>* server,
std::promise<grpc::Status>* status_promise);
void on_list(const ListRequest* request, grpc::ServerReaderWriter<ListReply, ListRequest>* server,
std::promise<grpc::Status>* status_promise);
void on_clone(const CloneRequest* request,
grpc::ServerReaderWriter<CloneReply, CloneRequest>* server,
std::promise<grpc::Status>* status_promise);
void on_networks(const NetworksRequest* request, grpc::ServerReaderWriter<NetworksReply, NetworksRequest>* server,
std::promise<grpc::Status>* status_promise);
void on_mount(const MountRequest* request, grpc::ServerReaderWriter<MountReply, MountRequest>* server,
std::promise<grpc::Status>* status_promise);
void on_recover(const RecoverRequest* request, grpc::ServerReaderWriter<RecoverReply, RecoverRequest>* server,
std::promise<grpc::Status>* status_promise);
void on_ssh_info(const SSHInfoRequest* request, grpc::ServerReaderWriter<SSHInfoReply, SSHInfoRequest>* server,
std::promise<grpc::Status>* status_promise);
void on_start(const StartRequest* request, grpc::ServerReaderWriter<StartReply, StartRequest>* server,
std::promise<grpc::Status>* status_promise);
void on_stop(const StopRequest* request, grpc::ServerReaderWriter<StopReply, StopRequest>* server,
std::promise<grpc::Status>* status_promise);
void on_suspend(const SuspendRequest* request, grpc::ServerReaderWriter<SuspendReply, SuspendRequest>* server,
std::promise<grpc::Status>* status_promise);
void on_restart(const RestartRequest* request, grpc::ServerReaderWriter<RestartReply, RestartRequest>* server,
std::promise<grpc::Status>* status_promise);
void on_delete(const DeleteRequest* request, grpc::ServerReaderWriter<DeleteReply, DeleteRequest>* server,
std::promise<grpc::Status>* status_promise);
void on_umount(const UmountRequest* request, grpc::ServerReaderWriter<UmountReply, UmountRequest>* server,
std::promise<grpc::Status>* status_promise);
void on_version(const VersionRequest* request, grpc::ServerReaderWriter<VersionReply, VersionRequest>* server,
std::promise<grpc::Status>* status_promise);
void on_get(const GetRequest* request, grpc::ServerReaderWriter<GetReply, GetRequest>* server,
std::promise<grpc::Status>* status_promise);
void on_set(const SetRequest* request, grpc::ServerReaderWriter<SetReply, SetRequest>* server,
std::promise<grpc::Status>* status_promise);
void on_keys(const KeysRequest* request, grpc::ServerReaderWriter<KeysReply, KeysRequest>* server,
std::promise<grpc::Status>* status_promise);
void on_authenticate(const AuthenticateRequest* request,
grpc::ServerReaderWriter<AuthenticateReply, AuthenticateRequest>* server,
std::promise<grpc::Status>* status_promise);
void on_snapshot(const SnapshotRequest* request,
grpc::ServerReaderWriter<SnapshotReply, SnapshotRequest>* server,
std::promise<grpc::Status>* status_promise);
void on_restore(const RestoreRequest* request,
grpc::ServerReaderWriter<RestoreReply, RestoreRequest>* server,
std::promise<grpc::Status>* status_promise);
void on_daemon_info(const DaemonInfoRequest* request,
grpc::ServerReaderWriter<DaemonInfoReply, DaemonInfoRequest>* server,
std::promise<grpc::Status>* status_promise);
private:
template <typename OperationSignal>
grpc::Status verify_client_and_dispatch_operation(OperationSignal signal, const std::string& client_cert);
const std::string server_address;
const std::unique_ptr<grpc::Server> server;
const ServerSocketType server_socket_type;
CertStore* client_cert_store;
protected:
grpc::Status create(grpc::ServerContext* context,
grpc::ServerReaderWriter<CreateReply, CreateRequest>* server) override;
grpc::Status launch(grpc::ServerContext* context,
grpc::ServerReaderWriter<LaunchReply, LaunchRequest>* server) override;
grpc::Status purge(grpc::ServerContext* context,
grpc::ServerReaderWriter<PurgeReply, PurgeRequest>* server) override;
grpc::Status find(grpc::ServerContext* context, grpc::ServerReaderWriter<FindReply, FindRequest>* server) override;
grpc::Status info(grpc::ServerContext* context, grpc::ServerReaderWriter<InfoReply, InfoRequest>* server) override;
grpc::Status list(grpc::ServerContext* context, grpc::ServerReaderWriter<ListReply, ListRequest>* server) override;
grpc::Status clone(grpc::ServerContext* context,
grpc::ServerReaderWriter<CloneReply, CloneRequest>* server) override;
grpc::Status networks(grpc::ServerContext* context,
grpc::ServerReaderWriter<NetworksReply, NetworksRequest>* server) override;
grpc::Status mount(grpc::ServerContext* context,
grpc::ServerReaderWriter<MountReply, MountRequest>* server) override;
grpc::Status recover(grpc::ServerContext* context,
grpc::ServerReaderWriter<RecoverReply, RecoverRequest>* server) override;
grpc::Status ssh_info(grpc::ServerContext* context,
grpc::ServerReaderWriter<SSHInfoReply, SSHInfoRequest>* server) override;
grpc::Status start(grpc::ServerContext* context,
grpc::ServerReaderWriter<StartReply, StartRequest>* server) override;
grpc::Status stop(grpc::ServerContext* context, grpc::ServerReaderWriter<StopReply, StopRequest>* server) override;
grpc::Status suspend(grpc::ServerContext* context,
grpc::ServerReaderWriter<SuspendReply, SuspendRequest>* server) override;
grpc::Status restart(grpc::ServerContext* context,
grpc::ServerReaderWriter<RestartReply, RestartRequest>* server) override;
grpc::Status delet(grpc::ServerContext* context,
grpc::ServerReaderWriter<DeleteReply, DeleteRequest>* server) override;
grpc::Status umount(grpc::ServerContext* context,
grpc::ServerReaderWriter<UmountReply, UmountRequest>* server) override;
grpc::Status version(grpc::ServerContext* context,
grpc::ServerReaderWriter<VersionReply, VersionRequest>* server) override;
grpc::Status ping(grpc::ServerContext* context, const PingRequest* request, PingReply* reply) override;
grpc::Status get(grpc::ServerContext* context, grpc::ServerReaderWriter<GetReply, GetRequest>* server) override;
grpc::Status set(grpc::ServerContext* context, grpc::ServerReaderWriter<SetReply, SetRequest>* server) override;
grpc::Status keys(grpc::ServerContext* context, grpc::ServerReaderWriter<KeysReply, KeysRequest>* server) override;
grpc::Status authenticate(grpc::ServerContext* context,
grpc::ServerReaderWriter<AuthenticateReply, AuthenticateRequest>* server) override;
grpc::Status snapshot(grpc::ServerContext* context,
grpc::ServerReaderWriter<SnapshotReply, SnapshotRequest>* server) override;
grpc::Status restore(grpc::ServerContext* context,
grpc::ServerReaderWriter<RestoreReply, RestoreRequest>* server) override;
grpc::Status daemon_info(grpc::ServerContext* context,
grpc::ServerReaderWriter<DaemonInfoReply, DaemonInfoRequest>* server) override;
};
} // namespace multipass
#endif // MULTIPASS_DAEMON_RPC_H
| 10,125
|
C++
|
.h
| 158
| 54.78481
| 119
| 0.71074
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,117
|
common_image_host.h
|
canonical_multipass/src/daemon/common_image_host.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_COMMON_IMAGE_HOST_H_
#define MULTIPASS_COMMON_IMAGE_HOST_H_
#include "multipass/vm_image_host.h"
#include <QStringList>
#include <QTimer>
#include <chrono>
namespace multipass
{
class CommonVMImageHost : public VMImageHost
{
public:
void for_each_entry_do(const Action& action) final;
VMImageInfo info_for_full_hash(const std::string& full_hash) final;
void update_manifests(const bool is_force_update_from_network);
protected:
void on_manifest_update_failure(const std::string& details);
void on_manifest_empty(const std::string& details);
void check_remote_is_supported(const std::string& remote_name) const;
void check_alias_is_supported(const std::string& alias, const std::string& remote_name) const;
bool alias_verifies_image_is_supported(const QStringList& aliases, const std::string& remote_name) const;
virtual void for_each_entry_do_impl(const Action& action) = 0;
virtual VMImageInfo info_for_full_hash_impl(const std::string& full_hash) = 0;
virtual void clear() = 0;
virtual void fetch_manifests(const bool is_force_update_from_network) = 0;
};
} // namespace multipass
#endif /* MULTIPASS_COMMON_IMAGE_HOST_H_ */
| 1,831
|
C++
|
.h
| 43
| 39.883721
| 109
| 0.755906
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,118
|
instance_settings_handler.h
|
canonical_multipass/src/daemon/instance_settings_handler.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_INSTANCE_SETTINGS_HANDLER_H
#define MULTIPASS_INSTANCE_SETTINGS_HANDLER_H
#include <multipass/exceptions/settings_exceptions.h>
#include <multipass/network_interface_info.h>
#include <multipass/settings/settings_handler.h>
#include <multipass/virtual_machine.h>
#include <multipass/vm_specs.h>
#include <QString>
#include <functional>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
namespace multipass
{
class InstanceSettingsHandler : public SettingsHandler
{
public:
InstanceSettingsHandler(std::unordered_map<std::string, VMSpecs>& vm_instance_specs,
std::unordered_map<std::string, VirtualMachine::ShPtr>& operative_instances,
const std::unordered_map<std::string, VirtualMachine::ShPtr>& deleted_instances,
const std::unordered_set<std::string>& preparing_instances,
std::function<void()> instance_persister,
std::function<bool(const std::string&)> is_bridged,
std::function<void(const std::string&)> add_interface);
std::set<QString> keys() const override;
QString get(const QString& key) const override;
void set(const QString& key, const QString& val) override;
private:
VirtualMachine& modify_instance(const std::string& instance_name);
VMSpecs& modify_spec(const std::string& instance_name);
const VMSpecs& find_spec(const std::string& instance_name) const;
private:
// references, careful
std::unordered_map<std::string, VMSpecs>& vm_instance_specs;
std::unordered_map<std::string, VirtualMachine::ShPtr>& operative_instances;
const std::unordered_map<std::string, VirtualMachine::ShPtr>& deleted_instances;
const std::unordered_set<std::string>& preparing_instances;
std::function<void()> instance_persister;
std::function<bool(const std::string&)> is_bridged;
std::function<void(const std::string&)> add_interface;
};
class InstanceSettingsException : public SettingsException
{
public:
InstanceSettingsException(const std::string& reason, const std::string& instance, const std::string& detail);
};
class NonAuthorizedBridgeSettingsException : public InstanceSettingsException
{
public:
NonAuthorizedBridgeSettingsException(const std::string& reason, const std::string& instance, const std::string& net)
: InstanceSettingsException{reason, instance, fmt::format("Need user authorization to bridge {}", net)}
{
}
};
class BridgeFailureException : public InstanceSettingsException
{
public:
BridgeFailureException(const std::string& reason, const std::string& instance, const std::string& net)
: InstanceSettingsException{reason, instance, fmt::format("Failure to bridge {}", net)}
{
}
};
} // namespace multipass
#endif // MULTIPASS_INSTANCE_SETTINGS_HANDLER_H
| 3,546
|
C++
|
.h
| 81
| 39.061728
| 120
| 0.731382
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,119
|
base_cloud_init_config.h
|
canonical_multipass/src/daemon/base_cloud_init_config.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_BASE_CLOUD_INIT_CONFIG_H
#define MULTIPASS_BASE_CLOUD_INIT_CONFIG_H
namespace multipass
{
constexpr auto base_cloud_init_config = "growpart:\n"
" mode: auto\n"
" devices: [\"/\"]\n"
" ignore_growroot_disabled: false\n"
"users:\n"
" - default\n"
"manage_etc_hosts: true\n";
}
#endif // MULTIPASS_BASE_CLOUD_INIT_CONFIG_H
| 1,220
|
C++
|
.h
| 29
| 32.206897
| 79
| 0.590412
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,120
|
cli.h
|
canonical_multipass/src/daemon/cli.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_CLI_H
#define MULTIPASS_CLI_H
#include "daemon_config.h"
#include <QCoreApplication>
namespace multipass
{
namespace cli
{
DaemonConfigBuilder parse(const QCoreApplication& app);
}
} // namespace multipass
#endif // MULTIPASS_CLI_H
| 883
|
C++
|
.h
| 28
| 29.821429
| 72
| 0.771765
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,121
|
ubuntu_image_host.h
|
canonical_multipass/src/daemon/ubuntu_image_host.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_UBUNTU_IMAGE_HOST_H
#define MULTIPASS_UBUNTU_IMAGE_HOST_H
#include "common_image_host.h"
#include <multipass/constants.h>
#include <multipass/simple_streams_manifest.h>
#include <QString>
#include <string>
#include <utility>
#include <vector>
namespace multipass
{
constexpr auto release_remote = "release";
constexpr auto daily_remote = "daily";
constexpr auto appliance_remote = "appliance";
class URLDownloader;
class UbuntuVMImageRemote;
class UbuntuVMImageHost final : public CommonVMImageHost
{
public:
UbuntuVMImageHost(std::vector<std::pair<std::string, UbuntuVMImageRemote>> remotes, URLDownloader* downloader);
std::optional<VMImageInfo> info_for(const Query& query) override;
std::vector<std::pair<std::string, VMImageInfo>> all_info_for(const Query& query) override;
std::vector<VMImageInfo> all_images_for(const std::string& remote_name, const bool allow_unsupported) override;
std::vector<std::string> supported_remotes() override;
private:
void for_each_entry_do_impl(const Action& action) override;
VMImageInfo info_for_full_hash_impl(const std::string& full_hash) override;
void fetch_manifests(const bool is_force_update_from_network) override;
void clear() override;
SimpleStreamsManifest* manifest_from(const std::string& remote);
const VMImageInfo* match_alias(const QString& key, const SimpleStreamsManifest& manifest) const;
std::vector<std::pair<std::string, std::unique_ptr<SimpleStreamsManifest>>> manifests;
URLDownloader* const url_downloader;
std::vector<std::pair<std::string, UbuntuVMImageRemote>> remotes;
std::string remote_url_from(const std::string& remote_name);
QString index_path;
};
class UbuntuVMImageRemote
{
public:
UbuntuVMImageRemote(std::string official_host, std::string uri, std::optional<QString> mirror_key = std::nullopt);
const QString get_url() const;
const QString get_official_url() const;
const std::optional<QString> get_mirror_url() const;
private:
const std::string official_host;
const std::string uri;
const std::optional<QString> mirror_key;
};
} // namespace multipass
#endif // MULTIPASS_UBUNTU_IMAGE_HOST_H
| 2,820
|
C++
|
.h
| 67
| 39.328358
| 118
| 0.7655
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,122
|
daemon_init_settings.h
|
canonical_multipass/src/daemon/daemon_init_settings.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_DAEMON_INIT_SETTINGS_H
#define MULTIPASS_DAEMON_INIT_SETTINGS_H
namespace multipass::daemon
{
void monitor_and_quit_on_settings_change(); // TODO replace with async restart in relevant settings handlers (see #2514)
void register_global_settings_handlers();
} // namespace multipass::daemon
#endif // MULTIPASS_DAEMON_INIT_SETTINGS_H
| 982
|
C++
|
.h
| 24
| 39.166667
| 120
| 0.772775
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,123
|
client.h
|
canonical_multipass/src/client/cli/client.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_CLIENT_H
#define MULTIPASS_CLIENT_H
#include <multipass/cert_provider.h>
#include <multipass/cli/alias_dict.h>
#include <multipass/cli/command.h>
#include <multipass/rpc/multipass.grpc.pb.h>
#include <multipass/terminal.h>
#include <map>
#include <memory>
#include <unordered_map>
namespace multipass
{
struct ClientConfig
{
const std::string server_address;
std::unique_ptr<CertProvider> cert_provider;
Terminal *term;
};
class Client
{
public:
explicit Client(ClientConfig& context);
virtual ~Client() = default;
int run(const QStringList& arguments);
protected:
template <typename T, typename... Ts>
void add_command(Ts&&... params);
void sort_commands();
private:
std::unique_ptr<multipass::Rpc::Stub> stub;
std::vector<cmd::Command::UPtr> commands;
Terminal* term;
AliasDict aliases;
};
} // namespace multipass
template <typename T, typename... Ts>
void multipass::Client::add_command(Ts&&... params)
{
auto cmd = std::make_unique<T>(*stub, term, std::forward<Ts>(params)...);
commands.push_back(std::move(cmd));
}
#endif // MULTIPASS_CLIENT_H
| 1,767
|
C++
|
.h
| 58
| 27.982759
| 77
| 0.737338
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,124
|
common_cli.h
|
canonical_multipass/src/client/cli/cmd/common_cli.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_COMMON_CLI_H
#define MULTIPASS_COMMON_CLI_H
#include <multipass/cli/client_common.h>
#include <multipass/cli/return_codes.h>
#include <multipass/rpc/multipass.grpc.pb.h>
#include <multipass/terminal.h>
#include <multipass/timer.h>
#include <QString>
using RpcMethod = multipass::Rpc::StubInterface;
namespace multipass
{
class AnimatedSpinner;
class ArgParser;
class Formatter;
class SettingsException;
namespace cmd
{
const QString all_option_name{"all"};
const QString format_option_name{"format"};
ParseCode check_for_name_and_all_option_conflict(const ArgParser* parser, std::ostream& cerr, bool allow_empty = false);
InstanceNames add_instance_names(const ArgParser* parser);
InstanceNames add_instance_names(const ArgParser* parser, const std::string& default_name);
std::vector<InstanceSnapshotPair> add_instance_and_snapshot_names(const ArgParser* parser);
ParseCode handle_format_option(const ArgParser* parser, Formatter** chosen_formatter, std::ostream& cerr);
std::string instance_action_message_for(const InstanceNames& instance_names, const std::string& action_name);
ReturnCode run_cmd(const QStringList& args, const ArgParser* parser, std::ostream& cout, std::ostream& cerr);
ReturnCode run_cmd_and_retry(const QStringList& args, const ArgParser* parser, std::ostream& cout, std::ostream& cerr);
ReturnCode return_code_from(const SettingsException& e);
QString describe_common_settings_keys();
// parser helpers
void add_timeout(multipass::ArgParser*);
int parse_timeout(const multipass::ArgParser* parser);
std::unique_ptr<multipass::utils::Timer> make_timer(int timeout, AnimatedSpinner* spinner, std::ostream& cerr,
const std::string& msg);
} // namespace cmd
} // namespace multipass
#endif // MULTIPASS_COMMON_CLI_H
| 2,445
|
C++
|
.h
| 53
| 43.679245
| 120
| 0.77204
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,125
|
version.h
|
canonical_multipass/src/client/cli/cmd/version.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
* Authored by: Alberto Aguirre <alberto.aguirre@canonical.com>
*
*/
#ifndef MULTIPASS_VERSION_H
#define MULTIPASS_VERSION_H
#include <multipass/cli/command.h>
namespace multipass
{
class Formatter;
namespace cmd
{
class Version final : public Command
{
public:
using Command::Command;
ReturnCode run(ArgParser *parser) override;
std::string name() const override;
QString short_help() const override;
QString description() const override;
private:
ParseCode parse_args(ArgParser* parser);
Formatter* chosen_formatter;
};
}
}
#endif // MULTIPASS_VERSION_H
| 1,217
|
C++
|
.h
| 41
| 27.414634
| 72
| 0.76219
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,126
|
list.h
|
canonical_multipass/src/client/cli/cmd/list.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_LIST_H
#define MULTIPASS_LIST_H
#include <multipass/cli/command.h>
namespace multipass
{
class Formatter;
namespace cmd
{
class List final : public Command
{
public:
using Command::Command;
ReturnCode run(ArgParser *parser) override;
std::string name() const override;
std::vector<std::string> aliases() const override;
QString short_help() const override;
QString description() const override;
private:
ParseCode parse_args(ArgParser* parser);
ListRequest request;
Formatter* chosen_formatter;
};
}
}
#endif // MULTIPASS_LIST_H
| 1,218
|
C++
|
.h
| 41
| 27.292683
| 72
| 0.75641
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,127
|
clone.h
|
canonical_multipass/src/client/cli/cmd/clone.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_CLONE_H
#define MULTIPASS_CLONE_H
#include <multipass/cli/command.h>
namespace multipass
{
namespace cmd
{
class Clone final : public Command
{
public:
using Command::Command;
ReturnCode run(ArgParser* parser) override;
std::string name() const override;
QString short_help() const override;
QString description() const override;
private:
ParseCode parse_args(ArgParser* parser);
CloneRequest rpc_request;
};
} // namespace cmd
} // namespace multipass
#endif // MULTIPASS_CLONE_H
| 1,161
|
C++
|
.h
| 38
| 28.263158
| 72
| 0.758281
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,128
|
prefer.h
|
canonical_multipass/src/client/cli/cmd/prefer.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_PREFER_H
#define MULTIPASS_PREFER_H
#include <multipass/cli/command.h>
#include <QString>
namespace multipass
{
class AliasDict;
namespace cmd
{
class Prefer final : public Command
{
public:
using Command::Command;
Prefer(Rpc::StubInterface& stub, Terminal* term, AliasDict& dict) : Command(stub, term), aliases(dict)
{
}
ReturnCode run(ArgParser* parser) override;
std::string name() const override;
QString short_help() const override;
QString description() const override;
private:
ParseCode parse_args(ArgParser* parser);
AliasDict aliases;
};
} // namespace cmd
} // namespace multipass
#endif // MULTIPASS_PREFER_H
| 1,316
|
C++
|
.h
| 43
| 28.116279
| 106
| 0.751582
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,129
|
stop.h
|
canonical_multipass/src/client/cli/cmd/stop.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
* Authored by: Alberto Aguirre <alberto.aguirre@canonical.com>
*
*/
#ifndef MULTIPASS_STOP_H
#define MULTIPASS_STOP_H
#include <multipass/cli/command.h>
namespace multipass
{
namespace cmd
{
class Stop final : public Command
{
public:
using Command::Command;
ReturnCode run(ArgParser *parser) override;
std::string name() const override;
QString short_help() const override;
QString description() const override;
private:
StopRequest request;
ParseCode parse_args(ArgParser* parser);
};
}
}
#endif // MULTIPASS_STOP_H
| 1,179
|
C++
|
.h
| 40
| 27.2
| 72
| 0.758164
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,130
|
unalias.h
|
canonical_multipass/src/client/cli/cmd/unalias.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_UNALIAS_H
#define MULTIPASS_UNALIAS_H
#include <multipass/cli/alias_dict.h>
#include <multipass/cli/command.h>
#include <unordered_set>
#include <QString>
namespace multipass
{
namespace cmd
{
class Unalias final : public Command
{
public:
using Command::Command;
Unalias(Rpc::StubInterface& stub, Terminal* term, AliasDict& dict) : Command(stub, term), aliases(dict)
{
}
ReturnCode run(ArgParser* parser) override;
std::string name() const override;
QString short_help() const override;
QString description() const override;
private:
ParseCode parse_args(ArgParser* parser);
AliasDict aliases;
struct str_pair_hash
{
inline std::size_t operator()(const std::pair<std::string, std::string> p) const
{
return std::hash<std::string>()(p.first) + std::hash<std::string>()(p.second);
}
};
std::vector<std::pair<std::string, std::string>> aliases_to_remove;
};
} // namespace cmd
} // namespace multipass
#endif // MULTIPASS_UNALIAS_H
| 1,679
|
C++
|
.h
| 52
| 29.019231
| 107
| 0.720297
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,131
|
aliases.h
|
canonical_multipass/src/client/cli/cmd/aliases.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_ALIASES_H
#define MULTIPASS_ALIASES_H
#include <multipass/cli/command.h>
#include <QString>
namespace multipass
{
class AliasDict;
class Formatter;
namespace cmd
{
class Aliases final : public Command
{
public:
using Command::Command;
Aliases(Rpc::StubInterface& stub, Terminal* term, AliasDict& dict) : Command(stub, term), aliases(dict)
{
}
ReturnCode run(ArgParser* parser) override;
std::string name() const override;
QString short_help() const override;
QString description() const override;
private:
ParseCode set_formatter(ArgParser* parser);
ParseCode parse_args(ArgParser* parser);
AliasDict aliases;
Formatter* chosen_formatter;
};
} // namespace cmd
} // namespace multipass
#endif // MULTIPASS_ALIASES_H
| 1,419
|
C++
|
.h
| 46
| 28.282609
| 107
| 0.754399
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,132
|
info.h
|
canonical_multipass/src/client/cli/cmd/info.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
* Authored by: Chris Townsend <christopher.townsend@canonical.com>
*
*/
#ifndef MULTIPASS_INFO_H
#define MULTIPASS_INFO_H
#include <multipass/cli/command.h>
namespace multipass
{
class Formatter;
namespace cmd
{
class Info final : public Command
{
public:
using Command::Command;
ReturnCode run(ArgParser *parser) override;
std::string name() const override;
QString short_help() const override;
QString description() const override;
private:
InfoRequest request;
Formatter* chosen_formatter;
ParseCode parse_args(ArgParser* parser);
};
}
}
#endif // MULTIPASS_INFO_H
| 1,234
|
C++
|
.h
| 42
| 27.047619
| 72
| 0.760338
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,133
|
suspend.h
|
canonical_multipass/src/client/cli/cmd/suspend.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_SUSPEND_H
#define MULTIPASS_SUSPEND_H
#include <multipass/cli/command.h>
namespace multipass
{
namespace cmd
{
class Suspend final : public Command
{
public:
using Command::Command;
ReturnCode run(ArgParser* parser) override;
std::string name() const override;
QString short_help() const override;
QString description() const override;
private:
SuspendRequest request;
ParseCode parse_args(ArgParser* parser);
};
} // namespace cmd
} // namespace multipass
#endif // MULTIPASS_SUSPEND_H
| 1,167
|
C++
|
.h
| 38
| 28.421053
| 72
| 0.760463
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,134
|
purge.h
|
canonical_multipass/src/client/cli/cmd/purge.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_PURGE_H
#define MULTIPASS_PURGE_H
#include <multipass/cli/alias_dict.h>
#include <multipass/cli/command.h>
namespace multipass
{
namespace cmd
{
class Purge final : public Command
{
public:
using Command::Command;
Purge(Rpc::StubInterface& stub, Terminal* term, AliasDict& dict) : Command(stub, term), aliases(dict)
{
}
ReturnCode run(ArgParser* parser) override;
std::string name() const override;
QString short_help() const override;
QString description() const override;
private:
AliasDict aliases;
ParseCode parse_args(ArgParser* parser);
};
} // namespace cmd
} // namespace multipass
#endif // MULTIPASS_PURGE_H
| 1,311
|
C++
|
.h
| 42
| 28.738095
| 105
| 0.749604
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,135
|
mount.h
|
canonical_multipass/src/client/cli/cmd/mount.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_MOUNT_H
#define MULTIPASS_MOUNT_H
#include <multipass/cli/command.h>
namespace multipass
{
namespace cmd
{
class Mount final : public Command
{
public:
using Command::Command;
ReturnCode run(ArgParser *parser) override;
std::string name() const override;
QString short_help() const override;
QString description() const override;
private:
MountRequest request;
ParseCode parse_args(ArgParser* parser);
};
}
}
#endif // MULTIPASS_MOUNT_H
| 1,117
|
C++
|
.h
| 38
| 27.105263
| 72
| 0.758621
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,136
|
networks.h
|
canonical_multipass/src/client/cli/cmd/networks.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_NETWORKS_H
#define MULTIPASS_NETWORKS_H
#include <multipass/cli/command.h>
namespace multipass
{
class Formatter;
namespace cmd
{
class Networks final : public Command
{
public:
using Command::Command;
ReturnCode run(ArgParser* parser) override;
std::string name() const override;
std::vector<std::string> aliases() const override;
QString short_help() const override;
QString description() const override;
private:
ParseCode parse_args(ArgParser* parser);
Formatter* chosen_formatter;
};
} // namespace cmd
} // namespace multipass
#endif // MULTIPASS_NETWORKS_H
| 1,250
|
C++
|
.h
| 40
| 28.875
| 72
| 0.759567
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,137
|
snapshot.h
|
canonical_multipass/src/client/cli/cmd/snapshot.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_SNAPSHOT_H
#define MULTIPASS_SNAPSHOT_H
#include <multipass/cli/command.h>
namespace multipass::cmd
{
class Snapshot : public Command
{
public:
using Command::Command;
ReturnCode run(ArgParser* parser) override;
std::string name() const override;
QString short_help() const override;
QString description() const override;
private:
ParseCode parse_args(ArgParser* parser);
SnapshotRequest request;
};
} // namespace multipass::cmd
#endif // MULTIPASS_SNAPSHOT_H
| 1,141
|
C++
|
.h
| 35
| 30.2
| 72
| 0.76
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,138
|
help.h
|
canonical_multipass/src/client/cli/cmd/help.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_HELP_H
#define MULTIPASS_HELP_H
#include <multipass/cli/command.h>
namespace multipass
{
namespace cmd
{
class Help final : public Command
{
public:
using Command::Command;
ReturnCode run(ArgParser *parser) override;
std::string name() const override;
QString short_help() const override;
QString description() const override;
private:
QString command;
ParseCode parse_args(ArgParser* parser);
};
}
}
#endif // MULTIPASS_HELP_H
| 1,108
|
C++
|
.h
| 38
| 26.868421
| 72
| 0.756579
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,139
|
exec.h
|
canonical_multipass/src/client/cli/cmd/exec.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
* Authored by: Chris Townsend <christopher.townsend@canonical.com>
*
*/
#ifndef MULTIPASS_EXEC_H
#define MULTIPASS_EXEC_H
#include <multipass/cli/alias_dict.h>
#include <multipass/cli/command.h>
namespace multipass
{
namespace cmd
{
class Exec final : public Command
{
public:
using Command::Command;
Exec(Rpc::StubInterface& stub, Terminal* term, AliasDict& dict) : Command(stub, term), aliases(dict)
{
}
ReturnCode run(ArgParser* parser) override;
std::string name() const override;
QString short_help() const override;
QString description() const override;
static ReturnCode exec_success(const SSHInfoReply& reply, const std::optional<std::string>& dir,
const std::vector<std::string>& args, Terminal* term);
private:
SSHInfoRequest ssh_info_request;
InfoRequest info_request;
AliasDict aliases;
ParseCode parse_args(ArgParser* parser);
};
} // namespace cmd
} // namespace multipass
#endif // MULTIPASS_EXEC_H
| 1,636
|
C++
|
.h
| 48
| 30.75
| 104
| 0.73481
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,140
|
alias.h
|
canonical_multipass/src/client/cli/cmd/alias.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_ALIAS_H
#define MULTIPASS_ALIAS_H
#include <multipass/cli/alias_dict.h>
#include <multipass/cli/command.h>
#include <QString>
namespace multipass
{
namespace cmd
{
class Alias final : public Command
{
public:
using Command::Command;
Alias(Rpc::StubInterface& stub, Terminal* term, AliasDict& dict) : Command(stub, term), aliases(dict)
{
}
ReturnCode run(ArgParser* parser) override;
std::string name() const override;
QString short_help() const override;
QString description() const override;
private:
InfoRequest info_request;
ParseCode parse_args(ArgParser* parser);
AliasDict aliases;
std::string alias_name;
AliasDefinition alias_definition;
};
} // namespace cmd
} // namespace multipass
#endif // MULTIPASS_ALIAS_H
| 1,427
|
C++
|
.h
| 46
| 28.391304
| 105
| 0.750182
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,141
|
delete.h
|
canonical_multipass/src/client/cli/cmd/delete.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_DELETE_H
#define MULTIPASS_DELETE_H
#include <multipass/cli/alias_dict.h>
#include <multipass/cli/command.h>
namespace multipass
{
namespace cmd
{
class Delete final : public Command
{
public:
using Command::Command;
Delete(Rpc::StubInterface& stub, Terminal* term, AliasDict& dict) : Command(stub, term), aliases(dict)
{
}
ReturnCode run(ArgParser* parser) override;
std::string name() const override;
QString short_help() const override;
QString description() const override;
private:
AliasDict aliases;
DeleteRequest request;
std::string instance_args;
std::string snapshot_args;
ParseCode parse_args(ArgParser* parser);
ParseCode parse_instances_snapshots(ArgParser* parser);
std::string generate_snapshot_purge_msg() const;
bool confirm_snapshot_purge() const;
};
} // namespace cmd
} // namespace multipass
#endif // MULTIPASS_DELETE_H
| 1,560
|
C++
|
.h
| 48
| 29.6875
| 106
| 0.749335
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,142
|
shell.h
|
canonical_multipass/src/client/cli/cmd/shell.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_CONNECT_H
#define MULTIPASS_CONNECT_H
#include <multipass/cli/command.h>
#include <QString>
namespace multipass
{
namespace cmd
{
class Shell final : public Command
{
public:
using Command::Command;
ReturnCode run(ArgParser *parser) override;
std::string name() const override;
std::vector<std::string> aliases() const override;
QString short_help() const override;
QString description() const override;
private:
SSHInfoRequest request;
QString petenv_name;
ParseCode parse_args(ArgParser* parser);
};
}
}
#endif // MULTIPASS_CONNECT_H
| 1,225
|
C++
|
.h
| 41
| 27.463415
| 72
| 0.757009
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,143
|
common_callbacks.h
|
canonical_multipass/src/client/cli/cmd/common_callbacks.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef MULTIPASS_COMMON_CALLBACKS_H
#define MULTIPASS_COMMON_CALLBACKS_H
#include "animated_spinner.h"
#include <multipass/cli/client_common.h>
#include <multipass/cli/prompters.h>
#include <multipass/constants.h>
#include <multipass/terminal.h>
#include <grpc++/grpc++.h>
namespace multipass
{
template <typename Request, typename Reply>
auto make_logging_spinner_callback(AnimatedSpinner& spinner, std::ostream& stream)
{
return [&spinner, &stream](const Reply& reply, grpc::ClientReaderWriterInterface<Request, Reply>*) {
if (!reply.log_line().empty())
spinner.print(stream, reply.log_line());
};
}
template <typename Request, typename Reply>
auto make_reply_spinner_callback(AnimatedSpinner& spinner, std::ostream& stream)
{
return [&spinner, &stream](const Reply& reply, grpc::ClientReaderWriterInterface<Request, Reply>*) {
if (!reply.log_line().empty())
spinner.print(stream, reply.log_line());
if (const auto& msg = reply.reply_message(); !msg.empty())
{
spinner.stop();
spinner.start(msg);
}
};
}
template <typename Request, typename Reply>
auto make_iterative_spinner_callback(AnimatedSpinner& spinner, Terminal& term)
{
return [&spinner, &term](const Reply& reply, grpc::ClientReaderWriterInterface<Request, Reply>* client) {
if (!reply.log_line().empty())
spinner.print(term.cerr(), reply.log_line());
if (reply.password_requested())
{
spinner.stop();
return cmd::handle_password(client, &term);
}
if (const auto& msg = reply.reply_message(); !msg.empty())
{
spinner.stop();
spinner.start(msg);
}
};
}
template <typename Request, typename Reply>
auto make_confirmation_callback(Terminal& term, const QString& key)
{
return [&key, &term](Reply& reply, grpc::ClientReaderWriterInterface<Request, Reply>* client) {
if (key.startsWith(daemon_settings_root) && key.endsWith(bridged_network_name) && reply.needs_authorization())
{
auto bridged_network = reply.reply_message();
std::vector<std::string> nets(1, bridged_network);
BridgePrompter prompter(&term);
auto request = Request{};
auto answer = prompter.bridge_prompt(nets);
request.set_authorized(answer);
client->Write(request);
}
};
}
} // namespace multipass
#endif // MULTIPASS_COMMON_CALLBACKS_H
| 3,150
|
C++
|
.h
| 82
| 32.841463
| 118
| 0.679122
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,144
|
get.h
|
canonical_multipass/src/client/cli/cmd/get.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_GET_H
#define MULTIPASS_GET_H
#include <multipass/cli/command.h>
#include <QString>
namespace multipass
{
namespace cmd
{
class Get final : public Command
{
public:
using Command::Command;
ReturnCode run(ArgParser* parser) override;
std::string name() const override;
QString short_help() const override;
QString description() const override;
private:
ParseCode parse_args(ArgParser* parser);
void print_settings() const;
void print_keys() const;
QString arg;
bool raw_opt = false;
bool keys_opt = false;
};
} // namespace cmd
} // namespace multipass
#endif // MULTIPASS_GET_H
| 1,276
|
C++
|
.h
| 43
| 27.116279
| 72
| 0.74449
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,145
|
find.h
|
canonical_multipass/src/client/cli/cmd/find.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_FIND_H
#define MULTIPASS_FIND_H
#include <multipass/cli/command.h>
namespace multipass
{
class Formatter;
namespace cmd
{
class Find final : public Command
{
public:
using Command::Command;
ReturnCode run(ArgParser* parser) override;
std::string name() const override;
QString short_help() const override;
QString description() const override;
private:
FindRequest request;
ParseCode parse_args(ArgParser* parser);
Formatter* chosen_formatter;
};
}
}
#endif // MULTIPASS_FIND_H
| 1,164
|
C++
|
.h
| 40
| 26.725
| 72
| 0.758961
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,146
|
animated_spinner.h
|
canonical_multipass/src/client/cli/cmd/animated_spinner.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef MULTIPASS_ANIMATED_SPINNER_H
#define MULTIPASS_ANIMATED_SPINNER_H
#include <future>
#include <string>
#include <vector>
namespace multipass
{
class AnimatedSpinner
{
public:
explicit AnimatedSpinner(std::ostream& cout);
~AnimatedSpinner();
void start(const std::string& message);
void start();
void stop();
void print(std::ostream& stream, const std::string& message);
private:
void draw();
const std::vector<char> spinner;
std::ostream& cout;
bool running;
std::string current_message;
std::mutex mutex;
std::condition_variable cv;
std::thread t;
};
}
#endif // MULTIPASS_ANIMATED_SPINNER_H
| 1,287
|
C++
|
.h
| 43
| 27.162791
| 72
| 0.738288
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,147
|
umount.h
|
canonical_multipass/src/client/cli/cmd/umount.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_UMOUNT_H
#define MULTIPASS_UMOUNT_H
#include <multipass/cli/command.h>
namespace multipass
{
namespace cmd
{
class Umount final : public Command
{
public:
using Command::Command;
ReturnCode run(ArgParser *parser) override;
std::string name() const override;
std::vector<std::string> aliases() const override;
QString short_help() const override;
QString description() const override;
private:
UmountRequest request;
ParseCode parse_args(ArgParser* parser);
};
}
}
#endif // MULTIPASS_UMOUNT_H
| 1,177
|
C++
|
.h
| 39
| 27.820513
| 72
| 0.757067
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,148
|
remote_settings_handler.h
|
canonical_multipass/src/client/cli/cmd/remote_settings_handler.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "common_cli.h"
#include <multipass/settings/settings_handler.h>
#include <stdexcept>
namespace multipass
{
class RemoteSettingsHandler : public SettingsHandler
{
public:
// need to ensure refs outlive this
RemoteSettingsHandler(QString key_prefix, Rpc::StubInterface& stub, Terminal* term, int verbosity);
QString get(const QString& key) const override;
void set(const QString& key, const QString& val) override;
std::set<QString> keys() const override;
public: // accessors for tests
const QString& get_key_prefix() const;
int get_verbosity() const;
private:
QString key_prefix;
Rpc::StubInterface& stub;
Terminal* term;
int verbosity;
};
class RemoteHandlerException : public std::runtime_error
{
public:
explicit RemoteHandlerException(grpc::Status status);
grpc::Status get_status() const;
private:
grpc::Status status;
};
} // namespace multipass
inline const QString& multipass::RemoteSettingsHandler::get_key_prefix() const
{
return key_prefix;
}
inline int multipass::RemoteSettingsHandler::get_verbosity() const
{
return verbosity;
}
#ifndef MULTIPASS_REMOTE_SETTINGS_HANDLER_H
#define MULTIPASS_REMOTE_SETTINGS_HANDLER_H
#endif // MULTIPASS_REMOTE_SETTINGS_HANDLER_H
| 1,891
|
C++
|
.h
| 58
| 30.017241
| 103
| 0.764286
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,149
|
recover.h
|
canonical_multipass/src/client/cli/cmd/recover.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
* Authored by: Alberto Aguirre <alberto.aguirre@canonical.com>
*
*/
#ifndef MULTIPASS_RECOVER_H
#define MULTIPASS_RECOVER_H
#include <multipass/cli/command.h>
namespace multipass
{
namespace cmd
{
class Recover final : public Command
{
public:
using Command::Command;
ReturnCode run(ArgParser *parser) override;
std::string name() const override;
QString short_help() const override;
QString description() const override;
private:
RecoverRequest request;
ParseCode parse_args(ArgParser* parser);
};
}
}
#endif // MULTIPASS_RECOVER_H
| 1,194
|
C++
|
.h
| 40
| 27.575
| 72
| 0.761324
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,150
|
set.h
|
canonical_multipass/src/client/cli/cmd/set.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_SET_H
#define MULTIPASS_SET_H
#include <multipass/cli/command.h>
#include <QString>
namespace multipass
{
namespace cmd
{
class Set final : public Command
{
public:
using Command::Command;
ReturnCode run(ArgParser* parser) override;
std::string name() const override;
QString short_help() const override;
QString description() const override;
private:
ParseCode parse_args(ArgParser* parser);
ParseCode checked_prompt(const QString& key);
QString key;
QString val;
};
} // namespace cmd
} // namespace multipass
#endif // MULTIPASS_SET_H
| 1,228
|
C++
|
.h
| 41
| 27.512195
| 72
| 0.753181
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,151
|
restore.h
|
canonical_multipass/src/client/cli/cmd/restore.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_RESTORE_H
#define MULTIPASS_RESTORE_H
#include <multipass/cli/command.h>
namespace multipass::cmd
{
class Restore : public Command
{
public:
using Command::Command;
ReturnCode run(ArgParser* parser) override;
std::string name() const override;
QString short_help() const override;
QString description() const override;
private:
ParseCode parse_args(ArgParser* parser);
bool confirm_destruction(const std::string& instance_name);
RestoreRequest request;
};
} // namespace multipass::cmd
#endif // MULTIPASS_RESTORE_H
| 1,200
|
C++
|
.h
| 36
| 30.861111
| 72
| 0.759067
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,152
|
authenticate.h
|
canonical_multipass/src/client/cli/cmd/authenticate.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_AUTHENTICATE_H
#define MULTIPASS_AUTHENTICATE_H
#include <multipass/cli/command.h>
namespace multipass
{
namespace cmd
{
class Authenticate final : public Command
{
public:
using Command::Command;
ReturnCode run(ArgParser* parser) override;
std::string name() const override;
std::vector<std::string> aliases() const override;
QString short_help() const override;
QString description() const override;
private:
ParseCode parse_args(ArgParser* parser);
AuthenticateRequest request;
};
} // namespace cmd
} // namespace multipass
#endif // MULTIPASS_AUTHENTICATE_H
| 1,248
|
C++
|
.h
| 39
| 29.615385
| 72
| 0.762895
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,153
|
launch.h
|
canonical_multipass/src/client/cli/cmd/launch.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_LAUNCH_H
#define MULTIPASS_LAUNCH_H
#include "animated_spinner.h"
#include <multipass/cli/alias_dict.h>
#include <multipass/cli/command.h>
#include <multipass/timer.h>
#include <QString>
#include <memory>
#include <string>
#include <utility>
namespace multipass
{
namespace cmd
{
class Launch final : public Command
{
public:
using Command::Command;
Launch(Rpc::StubInterface& stub, Terminal* term, AliasDict& dict) : Command(stub, term), aliases(dict)
{
}
ReturnCode run(ArgParser* parser) override;
std::string name() const override;
QString short_help() const override;
QString description() const override;
private:
ParseCode parse_args(ArgParser* parser);
ReturnCode request_launch(const ArgParser* parser);
ReturnCode mount(const ArgParser* parser, const QString& mount_source, const QString& mount_target);
bool ask_bridge_permission(multipass::LaunchReply& reply);
LaunchRequest request;
QString petenv_name;
std::unique_ptr<multipass::AnimatedSpinner> spinner;
std::unique_ptr<multipass::utils::Timer> timer;
std::vector<std::pair<QString, QString>> mount_routes;
QString instance_name;
AliasDict aliases;
};
} // namespace cmd
} // namespace multipass
#endif // MULTIPASS_LAUNCH_H
| 1,925
|
C++
|
.h
| 57
| 30.964912
| 106
| 0.753233
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,154
|
restart.h
|
canonical_multipass/src/client/cli/cmd/restart.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_RESTART_H
#define MULTIPASS_RESTART_H
#include <multipass/cli/command.h>
namespace multipass
{
namespace cmd
{
class Restart final : public Command
{
public:
using Command::Command;
ReturnCode run(ArgParser* parser) override;
std::string name() const override;
QString short_help() const override;
QString description() const override;
private:
RestartRequest request;
ParseCode parse_args(ArgParser* parser);
};
} // namespace cmd
} // namespace multipass
#endif // MULTIPASS_RESTART_H
| 1,167
|
C++
|
.h
| 38
| 28.421053
| 72
| 0.760463
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,155
|
start.h
|
canonical_multipass/src/client/cli/cmd/start.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_START_H
#define MULTIPASS_START_H
#include <multipass/cli/command.h>
#include <QString>
namespace multipass
{
namespace cmd
{
class Start final : public Command
{
public:
using Command::Command;
ReturnCode run(ArgParser *parser) override;
std::string name() const override;
QString short_help() const override;
QString description() const override;
private:
StartRequest request;
QString petenv_name;
ParseCode parse_args(ArgParser* parser);
};
}
}
#endif // MULTIPASS_START_H
| 1,162
|
C++
|
.h
| 40
| 26.7
| 72
| 0.757848
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,156
|
transfer.h
|
canonical_multipass/src/client/cli/cmd/transfer.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_TRANSFER_H
#define MULTIPASS_TRANSFER_H
#include <multipass/cli/command.h>
#include <multipass/ssh/sftp_client.h>
#include "multipass/cli/return_codes.h"
#include <filesystem>
#include <string>
#include <variant>
#include <vector>
namespace multipass::cmd
{
struct InstanceSourcesLocalTarget
{
std::unordered_multimap<std::string, fs::path> sources;
fs::path target_path;
};
struct LocalSourcesInstanceTarget
{
std::vector<fs::path> source_paths;
fs::path target;
};
struct FromCin
{
fs::path target;
};
struct ToCout
{
fs::path source;
};
class Transfer final : public Command
{
public:
using Command::Command;
ReturnCode run(ArgParser* parser) override;
std::string name() const override;
std::vector<std::string> aliases() const override;
QString short_help() const override;
QString description() const override;
private:
SSHInfoRequest request;
std::variant<InstanceSourcesLocalTarget, LocalSourcesInstanceTarget, FromCin, ToCout> arguments;
SFTPClient::Flags flags;
ParseCode parse_args(ArgParser* parser);
std::vector<std::pair<std::string, fs::path>> args_to_instance_and_path(const QStringList& args);
std::optional<ParseCode> parse_streaming(const QStringList& full_sources, const QString& full_target,
std::vector<std::pair<std::string, fs::path>> split_sources,
std::pair<std::string, fs::path> split_target);
ParseCode parse_non_streaming(std::vector<std::pair<std::string, fs::path>>& split_sources,
std::pair<std::string, fs::path>& split_target);
};
} // namespace multipass::cmd
#endif // MULTIPASS_TRANSFER_H
| 2,385
|
C++
|
.h
| 68
| 30.735294
| 105
| 0.712364
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,157
|
create_alias.h
|
canonical_multipass/src/client/cli/cmd/create_alias.h
|
/*
* Copyright (C) Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MULTIPASS_CREATE_ALIAS_H
#define MULTIPASS_CREATE_ALIAS_H
#include <multipass/cli/alias_dict.h>
#include <multipass/cli/return_codes.h>
#include <optional>
namespace multipass
{
namespace cmd
{
ReturnCode create_alias(AliasDict& aliases, const std::string& alias_name, const AliasDefinition& alias_definition,
std::ostream& cout, std::ostream& cerr,
const std::optional<std::string>& context = std::nullopt);
} // namespace cmd
} // namespace multipass
#endif // MULTIPASS_CREATE_ALIAS_H
| 1,177
|
C++
|
.h
| 31
| 34.774194
| 115
| 0.737073
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,158
|
my_application.h
|
canonical_multipass/src/client/gui/linux/my_application.h
|
#ifndef FLUTTER_MY_APPLICATION_H_
#define FLUTTER_MY_APPLICATION_H_
#include <gtk/gtk.h>
G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
GtkApplication)
/**
* my_application_new:
*
* Creates a new Flutter-based application.
*
* Returns: a new #MyApplication.
*/
MyApplication* my_application_new();
#endif // FLUTTER_MY_APPLICATION_H_
| 388
|
C++
|
.h
| 14
| 24.5
| 68
| 0.721622
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| true
| true
| false
| false
| false
| false
| false
| false
|
21,159
|
generated_plugin_registrant.h
|
canonical_multipass/src/client/gui/linux/flutter/generated_plugin_registrant.h
|
//
// Generated file. Do not edit.
//
// clang-format off
#ifndef GENERATED_PLUGIN_REGISTRANT_
#define GENERATED_PLUGIN_REGISTRANT_
#include <flutter_linux/flutter_linux.h>
// Registers Flutter plugins.
void fl_register_plugins(FlPluginRegistry* registry);
#endif // GENERATED_PLUGIN_REGISTRANT_
| 303
|
C++
|
.h
| 10
| 28.8
| 53
| 0.791667
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,164
|
generated_plugin_registrant.h
|
canonical_multipass/src/client/gui/windows/flutter/generated_plugin_registrant.h
|
//
// Generated file. Do not edit.
//
// clang-format off
#ifndef GENERATED_PLUGIN_REGISTRANT_
#define GENERATED_PLUGIN_REGISTRANT_
#include <flutter/plugin_registry.h>
// Registers Flutter plugins.
void RegisterPlugins(flutter::PluginRegistry* registry);
#endif // GENERATED_PLUGIN_REGISTRANT_
| 302
|
C++
|
.h
| 10
| 28.7
| 56
| 0.794425
|
canonical/multipass
| 7,732
| 642
| 476
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,165
|
winptyprocess.cpp
|
visualfc_liteide/liteidex/src/3rdparty/ptyqt/core/winptyprocess.cpp
|
#include "winptyprocess.h"
#include <QFile>
#include <QFileInfo>
#include <sstream>
#include <QCoreApplication>
#include <windows.h>
#include <QDir>
#define DEBUG_VAR_LEGACY "WINPTYDBG"
#define DEBUG_VAR_ACTUAL "WINPTY_DEBUG"
#define SHOW_CONSOLE_VAR "WINPTY_SHOW_CONSOLE"
#define WINPTY_AGENT_NAME "winpty-agent.exe"
#ifdef Q_OS_WIN64
#define WINPTY_DLL_NAME "winpty64.dll"
#else
#define WINPTY_DLL_NAME "winpty32.dll"
#endif
//#define WINPTY_DLL "winpty.dll"
static HMODULE hWinPtyDLL = NULL;
/* Gets the error code from the error object. */
WINPTY_API winpty_result_t (*winpty_error_code)(winpty_error_ptr_t err);
/* Returns a textual representation of the error. The string is freed when
* the error is freed. */
WINPTY_API LPCWSTR (*winpty_error_msg)(winpty_error_ptr_t err);
/* Free the error object. Every error returned from the winpty API must be
* freed. */
WINPTY_API void (*winpty_error_free)(winpty_error_ptr_t err);
WINPTY_API winpty_config_t *
(*winpty_config_new)(UINT64 agentFlags, winpty_error_ptr_t *err /*OPTIONAL*/);
/* Free the cfg object after passing it to winpty_open. */
WINPTY_API void (*winpty_config_free)(winpty_config_t *cfg);
WINPTY_API void
(*winpty_config_set_initial_size)(winpty_config_t *cfg, int cols, int rows);
/* Set the mouse mode to one of the WINPTY_MOUSE_MODE_xxx constants. */
WINPTY_API void
(*winpty_config_set_mouse_mode)(winpty_config_t *cfg, int mouseMode);
/* Amount of time to wait for the agent to startup and to wait for any given
* agent RPC request. Must be greater than 0. Can be INFINITE. */
WINPTY_API void
(*winpty_config_set_agent_timeout)(winpty_config_t *cfg, DWORD timeoutMs);
WINPTY_API winpty_t *
(*winpty_open)(const winpty_config_t *cfg,
winpty_error_ptr_t *err /*OPTIONAL*/);
WINPTY_API HANDLE (*winpty_agent_process)(winpty_t *wp);
WINPTY_API LPCWSTR (*winpty_conin_name)(winpty_t *wp);
WINPTY_API LPCWSTR (*winpty_conout_name)(winpty_t *wp);
WINPTY_API LPCWSTR (*winpty_conerr_name)(winpty_t *wp);
WINPTY_API winpty_spawn_config_t *
(*winpty_spawn_config_new)(UINT64 spawnFlags,
LPCWSTR appname /*OPTIONAL*/,
LPCWSTR cmdline /*OPTIONAL*/,
LPCWSTR cwd /*OPTIONAL*/,
LPCWSTR env /*OPTIONAL*/,
winpty_error_ptr_t *err /*OPTIONAL*/);
WINPTY_API void (*winpty_spawn_config_free)(winpty_spawn_config_t *cfg);
WINPTY_API BOOL
(*winpty_spawn)(winpty_t *wp,
const winpty_spawn_config_t *cfg,
HANDLE *process_handle /*OPTIONAL*/,
HANDLE *thread_handle /*OPTIONAL*/,
DWORD *create_process_error /*OPTIONAL*/,
winpty_error_ptr_t *err /*OPTIONAL*/);
WINPTY_API BOOL
(*winpty_set_size)(winpty_t *wp, int cols, int rows,
winpty_error_ptr_t *err /*OPTIONAL*/);
WINPTY_API int
(*winpty_get_console_process_list)(winpty_t *wp, int *processList, const int processCount,
winpty_error_ptr_t *err /*OPTIONAL*/);
WINPTY_API void (*winpty_free)(winpty_t *wp);
static bool winpty_init()
{
int i;
static struct
{
char *name;
FARPROC *ptr;
} winpty_entry[] =
{
{"winpty_conerr_name", (FARPROC*)&winpty_conerr_name},
{"winpty_config_free", (FARPROC*)&winpty_config_free},
{"winpty_config_new", (FARPROC*)&winpty_config_new},
{"winpty_config_set_mouse_mode",
(FARPROC*)&winpty_config_set_mouse_mode},
{"winpty_config_set_initial_size",
(FARPROC*)&winpty_config_set_initial_size},
{"winpty_conin_name", (FARPROC*)&winpty_conin_name},
{"winpty_conout_name", (FARPROC*)&winpty_conout_name},
{"winpty_error_free", (FARPROC*)&winpty_error_free},
{"winpty_free", (FARPROC*)&winpty_free},
{"winpty_open", (FARPROC*)&winpty_open},
{"winpty_spawn", (FARPROC*)&winpty_spawn},
{"winpty_spawn_config_free", (FARPROC*)&winpty_spawn_config_free},
{"winpty_spawn_config_new", (FARPROC*)&winpty_spawn_config_new},
{"winpty_error_msg", (FARPROC*)&winpty_error_msg},
{"winpty_set_size", (FARPROC*)&winpty_set_size},
{"winpty_agent_process", (FARPROC*)&winpty_agent_process},
{"winpty_get_console_process_list", (FARPROC*)&winpty_get_console_process_list},
{NULL, NULL}
};
// No need to initialize twice.
if (hWinPtyDLL)
return true;
// Load winpty.dll, prefer using the 'winptydll' option, fall back to just
// winpty.dll.
if (!hWinPtyDLL)
hWinPtyDLL = LoadLibraryA(WINPTY_DLL_NAME);
if (!hWinPtyDLL)
{
return false;
}
for (i = 0; winpty_entry[i].name != NULL
&& winpty_entry[i].ptr != NULL; ++i)
{
if ((*winpty_entry[i].ptr = (FARPROC)GetProcAddress(hWinPtyDLL,
winpty_entry[i].name)) == NULL)
{
qDebug() << "GetProcAddress false" << winpty_entry[i].name;
// hWinPtyDLL = NULL;
// return false;
}
}
return true;
}
QString castErrorToString(winpty_error_ptr_t error_ptr)
{
return QString::fromStdWString(winpty_error_msg(error_ptr));
}
WinPtyProcess::WinPtyProcess()
: IPtyProcess()
, m_ptyHandler(0)
, m_innerHandle(0)
, m_inSocket(0)
, m_outSocket(0)
{
m_initPty = winpty_init();
}
WinPtyProcess::~WinPtyProcess()
{
kill();
}
bool WinPtyProcess::startProcess(const QString &shellPath, const QStringList &arguments, const QString &workingDirectory, QStringList environment, qint16 cols, qint16 rows)
{
// if (!isAvailable())
// {
// m_lastError = QString("WinPty Error: winpty-agent.exe or winpty.dll not found!");
// return false;
// }
//already running
if (m_ptyHandler)
return false;
QFileInfo fi(shellPath);
if (fi.isRelative() || !QFile::exists(shellPath))
{
//todo add auto-find executable in PATH env var
m_lastError = QString("WinPty Error: shell file path must be absolute");
return false;
}
m_shellPath = QDir::toNativeSeparators(shellPath);
m_size = QPair<qint16, qint16>(cols, rows);
#ifdef PTYQT_DEBUG
if (m_trace)
{
environment.append(QString("%1=1").arg(DEBUG_VAR_LEGACY));
environment.append(QString("%1=trace").arg(DEBUG_VAR_ACTUAL));
environment.append(QString("%1=1").arg(SHOW_CONSOLE_VAR));
SetEnvironmentVariable(DEBUG_VAR_LEGACY, "1");
SetEnvironmentVariable(DEBUG_VAR_ACTUAL, "trace");
SetEnvironmentVariable(SHOW_CONSOLE_VAR, "1");
}
#endif
//env
std::wstringstream envBlock;
foreach (QString line, environment)
{
envBlock << line.toStdWString() << L'\0';
}
std::wstring env = envBlock.str();
//create start config
winpty_error_ptr_t errorPtr = 0;
winpty_config_t* startConfig = winpty_config_new(0, &errorPtr);
if (startConfig == 0)
{
m_lastError = QString("WinPty Error: create start config -> %1").arg(castErrorToString(errorPtr));
return false;
}
winpty_error_free(errorPtr);
//set params
winpty_config_set_initial_size(startConfig, cols, rows);
winpty_config_set_mouse_mode(startConfig, WINPTY_MOUSE_MODE_AUTO);
//winpty_config_set_agent_timeout();
//start agent
m_ptyHandler = winpty_open(startConfig, &errorPtr);
winpty_config_free(startConfig); //start config is local var, free it after use
if (m_ptyHandler == 0)
{
m_lastError = QString("WinPty Error: start agent -> %1").arg(castErrorToString(errorPtr));
return false;
}
winpty_error_free(errorPtr);
//create spawn config
winpty_spawn_config_t* spawnConfig = winpty_spawn_config_new(WINPTY_SPAWN_FLAG_AUTO_SHUTDOWN, m_shellPath.toStdWString().c_str(),
//commandLine.toStdWString().c_str(), cwd.toStdWString().c_str(),
NULL, workingDirectory.toStdWString().c_str(),
env.c_str(),
&errorPtr);
if (spawnConfig == 0)
{
m_lastError = QString("WinPty Error: create spawn config -> %1").arg(castErrorToString(errorPtr));
return false;
}
winpty_error_free(errorPtr);
//spawn the new process
BOOL spawnSuccess = winpty_spawn(m_ptyHandler, spawnConfig, &m_innerHandle, 0, 0, &errorPtr);
winpty_spawn_config_free(spawnConfig); //spawn config is local var, free it after use
if (!spawnSuccess)
{
m_lastError = QString("WinPty Error: start terminal process -> %1").arg(castErrorToString(errorPtr));
return false;
}
winpty_error_free(errorPtr);
m_pid = (int)GetProcessId(m_innerHandle);
//get pipe names
LPCWSTR conInPipeName = winpty_conin_name(m_ptyHandler);
m_conInName = QString::fromStdWString(std::wstring(conInPipeName));
m_inSocket = new QLocalSocket();
m_inSocket->connectToServer(m_conInName, QIODevice::WriteOnly);
m_inSocket->waitForConnected();
LPCWSTR conOutPipeName = winpty_conout_name(m_ptyHandler);
m_conOutName = QString::fromStdWString(std::wstring(conOutPipeName));
m_outSocket = new QLocalSocket();
m_outSocket->connectToServer(m_conOutName, QIODevice::ReadOnly);
m_outSocket->waitForConnected();
if (m_inSocket->state() != QLocalSocket::ConnectedState && m_outSocket->state() != QLocalSocket::ConnectedState)
{
m_lastError = QString("WinPty Error: Unable to connect local sockets -> %1 / %2").arg(m_inSocket->errorString()).arg(m_outSocket->errorString());
m_inSocket->deleteLater();
m_outSocket->deleteLater();
m_inSocket = 0;
m_outSocket = 0;
return false;
}
connect(m_outSocket,SIGNAL(disconnected()),this,SLOT(disconnected()));
return true;
}
bool WinPtyProcess::resize(qint16 cols, qint16 rows)
{
if (m_ptyHandler == 0)
{
return false;
}
bool res = winpty_set_size(m_ptyHandler, cols, rows, 0);
if (res)
{
m_size = QPair<qint16, qint16>(cols, rows);
}
return res;
}
bool WinPtyProcess::kill()
{
bool exitCode = false;
if (m_innerHandle != 0 && m_ptyHandler != 0)
{
//disconnect all signals (readyRead, ...)
m_inSocket->disconnect();
m_outSocket->disconnect();
//disconnect for server
m_inSocket->disconnectFromServer();
m_outSocket->disconnectFromServer();
m_inSocket->deleteLater();
m_outSocket->deleteLater();
m_inSocket = 0;
m_outSocket = 0;
winpty_free(m_ptyHandler);
exitCode = CloseHandle(m_innerHandle);
m_ptyHandler = 0;
m_innerHandle = 0;
m_conInName = QString();
m_conOutName = QString();
m_pid = 0;
}
return exitCode;
}
IPtyProcess::PtyType WinPtyProcess::type()
{
return IPtyProcess::WinPty;
}
QString WinPtyProcess::dumpDebugInfo()
{
#ifdef PTYQT_DEBUG
return QString("PID: %1, ConIn: %2, ConOut: %3, Type: %4, Cols: %5, Rows: %6, IsRunning: %7, Shell: %8")
.arg(m_pid).arg(m_conInName).arg(m_conOutName).arg(type())
.arg(m_size.first).arg(m_size.second).arg(m_ptyHandler != nullptr)
.arg(m_shellPath);
#else
return QString("Nothing...");
#endif
}
QIODevice *WinPtyProcess::notifier()
{
return m_outSocket;
}
QByteArray WinPtyProcess::readAll()
{
return m_outSocket->readAll();
}
qint64 WinPtyProcess::write(const QByteArray &byteArray)
{
return m_inSocket->write(byteArray);
}
bool WinPtyProcess::isAvailable()
{
return m_initPty;
}
void WinPtyProcess::moveToThread(QThread *targetThread)
{
m_inSocket->moveToThread(targetThread);
m_outSocket->moveToThread(targetThread);
}
int WinPtyProcess::processList() const
{
if (winpty_get_console_process_list) {
int list[64];
int n = winpty_get_console_process_list(m_ptyHandler,list,64,0);
return n;
}
return 0;
}
void WinPtyProcess::disconnected()
{
emit exited();
}
| 12,211
|
C++
|
.cpp
| 330
| 30.793939
| 172
| 0.646297
|
visualfc/liteide
| 7,563
| 970
| 395
|
LGPL-2.1
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| true
| false
| false
|
21,166
|
unixptyprocess.cpp
|
visualfc_liteide/liteidex/src/3rdparty/ptyqt/core/unixptyprocess.cpp
|
#include "unixptyprocess.h"
//#include <QStandardPaths>
#include <termios.h>
#include <errno.h>
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_BSD4)
#include <utmpx.h>
#endif
#include <fcntl.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <stdlib.h>
#include <QFileInfo>
#include <QCoreApplication>
#include <signal.h>
/* for pty_getproc */
#if defined(__linux__)
#include <stdio.h>
#include <stdint.h>
// support for build with MUSL on Alpine Linux
#ifndef _PATH_UTMPX
#include <sys/time.h>
# define _PATH_UTMPX "/var/log/utmp"
#endif
#elif defined(__APPLE__)
#include <sys/sysctl.h>
#include <libproc.h>
#endif
static char *pty_getproc(int fd, char *tty);
UnixPtyProcess::UnixPtyProcess()
: IPtyProcess()
, m_readMasterNotify(0)
{
// m_shellProcess.setWorkingDirectory(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
connect(&m_shellProcess,SIGNAL(finished(int, QProcess::ExitStatus)),this,SLOT(finished(int, QProcess::ExitStatus)));
connect(&m_shellProcess,SIGNAL(stateChanged(QProcess::ProcessState)),this,SLOT(stateChanged(QProcess::ProcessState)));
}
UnixPtyProcess::~UnixPtyProcess()
{
kill();
}
bool UnixPtyProcess::startProcess(const QString &shellPath, const QStringList &arguments, const QString &workingDirectory, QStringList environment, qint16 cols, qint16 rows)
{
// if (!isAvailable())
// {
// m_lastError = QString("UnixPty Error: unavailable");
// return false;
// }
if (m_shellProcess.state() == QProcess::Running)
return false;
QFileInfo fi(shellPath);
if (fi.isRelative() || !QFile::exists(shellPath))
{
//todo add auto-find executable in PATH env var
m_lastError = QString("UnixPty Error: shell file path must be absolute");
return false;
}
#ifdef Q_OS_MAC
m_shellName = fi.fileName();
#else
m_shellName = shellPath;
#endif
m_shellPath = shellPath;
m_size = QPair<qint16, qint16>(cols, rows);
int rc = 0;
m_shellProcess.m_handleMaster = ::posix_openpt(O_RDWR | O_NOCTTY);
if (m_shellProcess.m_handleMaster <= 0)
{
m_lastError = QString("UnixPty Error: unable to open master -> %1").arg(strerror(errno));
kill();
return false;
}
m_shellProcess.m_handleSlaveName = ptsname(m_shellProcess.m_handleMaster);
if ( m_shellProcess.m_handleSlaveName.isEmpty())
{
m_lastError = QString("UnixPty Error: unable to get slave name -> %1").arg(strerror(errno));
kill();
return false;
}
signal(SIGINT, SIG_DFL);
rc = grantpt(m_shellProcess.m_handleMaster);
if (rc != 0)
{
m_lastError = QString("UnixPty Error: unable to change perms for slave -> %1").arg(strerror(errno));
kill();
return false;
}
rc = unlockpt(m_shellProcess.m_handleMaster);
if (rc != 0)
{
m_lastError = QString("UnixPty Error: unable to unlock slave -> %1").arg(strerror(errno));
kill();
return false;
}
m_shellProcess.m_handleSlave = ::open(m_shellProcess.m_handleSlaveName.toLatin1().data(), O_RDWR | O_NOCTTY);
if (m_shellProcess.m_handleSlave < 0)
{
m_lastError = QString("UnixPty Error: unable to open slave -> %1").arg(strerror(errno));
kill();
return false;
}
rc = fcntl(m_shellProcess.m_handleMaster, F_SETFD, FD_CLOEXEC);
if (rc == -1)
{
m_lastError = QString("UnixPty Error: unable to set flags for master -> %1").arg(strerror(errno));
kill();
return false;
}
rc = fcntl(m_shellProcess.m_handleSlave, F_SETFD, FD_CLOEXEC);
if (rc == -1)
{
m_lastError = QString("UnixPty Error: unable to set flags for slave -> %1").arg(strerror(errno));
kill();
return false;
}
#ifdef Q_OS_MAC
fcntl(m_shellProcess.m_handleMaster, F_SETFL, fcntl(m_shellProcess.m_handleMaster, F_GETFL) | O_NONBLOCK);
fcntl(m_shellProcess.m_handleSlave, F_SETFL, fcntl(m_shellProcess.m_handleSlave, F_GETFL) | O_NONBLOCK);
#endif
struct ::termios ttmode;
rc = tcgetattr(m_shellProcess.m_handleMaster, &ttmode);
if (rc != 0)
{
m_lastError = QString("UnixPty Error: termios fail -> %1").arg(strerror(errno));
kill();
return false;
}
ttmode.c_iflag = ICRNL | IXON | IXANY | IMAXBEL | BRKINT;
#if defined(IUTF8)
ttmode.c_iflag |= IUTF8;
#endif
ttmode.c_oflag = OPOST | ONLCR;
ttmode.c_cflag = CREAD | CS8 | HUPCL;
ttmode.c_lflag = ICANON | ISIG | IEXTEN | ECHO | ECHOE | ECHOK | ECHOKE | ECHOCTL;
ttmode.c_cc[VEOF] = 4;
ttmode.c_cc[VEOL] = -1;
ttmode.c_cc[VEOL2] = -1;
ttmode.c_cc[VERASE] = 0x7f;
ttmode.c_cc[VWERASE] = 23;
ttmode.c_cc[VKILL] = 21;
ttmode.c_cc[VREPRINT] = 18;
ttmode.c_cc[VINTR] = 3;
ttmode.c_cc[VQUIT] = 0x1c;
ttmode.c_cc[VSUSP] = 26;
ttmode.c_cc[VSTART] = 17;
ttmode.c_cc[VSTOP] = 19;
ttmode.c_cc[VLNEXT] = 22;
ttmode.c_cc[VDISCARD] = 15;
ttmode.c_cc[VMIN] = 1;
ttmode.c_cc[VTIME] = 0;
#if (__APPLE__)
ttmode.c_cc[VDSUSP] = 25;
ttmode.c_cc[VSTATUS] = 20;
#endif
cfsetispeed(&ttmode, B38400);
cfsetospeed(&ttmode, B38400);
rc = tcsetattr(m_shellProcess.m_handleMaster, TCSANOW, &ttmode);
if (rc != 0)
{
m_lastError = QString("UnixPty Error: unabble to set associated params -> %1").arg(strerror(errno));
kill();
return false;
}
m_readMasterNotify = new QSocketNotifier(m_shellProcess.m_handleMaster, QSocketNotifier::Read, &m_shellProcess);
m_readMasterNotify->setEnabled(true);
m_readMasterNotify->moveToThread(m_shellProcess.thread());
connect(m_readMasterNotify,SIGNAL(activated(int)),this,SLOT(readActivated(int)));
// QObject::connect(m_readMasterNotify, &QSocketNotifier::activated, [this](int socket)
// {
// Q_UNUSED(socket)
// QByteArray buffer;
// int size = 1025;
// int readSize = 1024;
// QByteArray data;
// do
// {
// char nativeBuffer[size];
// int len = ::read(m_shellProcess.m_handleMaster, nativeBuffer, readSize);
// data = QByteArray(nativeBuffer, len);
// buffer.append(data);
// } while (data.size() == readSize); //last data block always < readSize
// m_shellReadBuffer.append(buffer);
// m_shellProcess.emitReadyRead();
// });
QStringList defaultVars;
defaultVars.append("TERM=xterm-256color");
defaultVars.append("ITERM_PROFILE=Default");
defaultVars.append("XPC_FLAGS=0x0");
defaultVars.append("XPC_SERVICE_NAME=0");
defaultVars.append("LANG=en_US.UTF-8");
defaultVars.append("LC_ALL=en_US.UTF-8");
defaultVars.append("LC_CTYPE=UTF-8");
defaultVars.append("INIT_CWD=" + QCoreApplication::applicationDirPath());
defaultVars.append("COMMAND_MODE=unix2003");
defaultVars.append("COLORTERM=truecolor");
QStringList varNames;
foreach (QString line, environment)
{
varNames.append(line.split("=").first());
}
//append default env vars only if they don't exists in current env
foreach (QString defVar, defaultVars)
{
if (!varNames.contains(defVar.split("=").first()))
environment.append(defVar);
}
QProcessEnvironment envFormat;
foreach (QString line, environment)
{
envFormat.insert(line.split("=").first(), line.split("=").last());
}
m_shellProcess.setWorkingDirectory(workingDirectory);
m_shellProcess.setProcessEnvironment(envFormat);
m_shellProcess.setReadChannel(QProcess::StandardOutput);
m_shellProcess.start(m_shellPath, arguments);
m_shellProcess.waitForStarted();
m_pid = m_shellProcess.pid();
resize(cols, rows);
return true;
}
bool UnixPtyProcess::resize(qint16 cols, qint16 rows)
{
struct winsize winp;
winp.ws_col = cols;
winp.ws_row = rows;
winp.ws_xpixel = 0;
winp.ws_ypixel = 0;
bool res = ((ioctl(m_shellProcess.m_handleMaster, TIOCSWINSZ, &winp) != -1) && (ioctl(m_shellProcess.m_handleSlave, TIOCSWINSZ, &winp) != -1) );
if (res)
{
m_size = QPair<qint16, qint16>(cols, rows);
}
return res;
}
//bool tty_kill(int fd, int signal)
//{
//#if defined(TIOCSIG)
// if (ioctl(fd, TIOCSIG, signal) == -1)
// return false;
//#elif defined(TIOCSIGNAL)
// if (ioctl(fd, TIOCSIGNAL, signal) == -1)
// return false;
//#endif
// return true;
//}
bool UnixPtyProcess::kill()
{
m_shellProcess.m_handleSlaveName = QString();
if (m_shellProcess.m_handleSlave >= 0)
{
::close(m_shellProcess.m_handleSlave);
m_shellProcess.m_handleSlave = -1;
}
if (m_shellProcess.m_handleMaster >= 0)
{
::close(m_shellProcess.m_handleMaster);
m_shellProcess.m_handleMaster = -1;
}
if (!m_readMasterNotify) {
return false;
}
if (m_shellProcess.state() == QProcess::Running)
{
m_readMasterNotify->disconnect();
m_readMasterNotify->deleteLater();
m_shellProcess.terminate();
m_shellProcess.waitForFinished(1000);
if (m_shellProcess.state() == QProcess::Running)
{
QProcess::startDetached( QString("kill -9 %1").arg( pid() ) );
m_shellProcess.kill();
m_shellProcess.waitForFinished(1000);
}
return (m_shellProcess.state() == QProcess::NotRunning);
}
return false;
}
IPtyProcess::PtyType UnixPtyProcess::type()
{
return IPtyProcess::UnixPty;
}
QString UnixPtyProcess::dumpDebugInfo()
{
#ifdef PTYQT_DEBUG
return QString("PID: %1, In: %2, Out: %3, Type: %4, Cols: %5, Rows: %6, IsRunning: %7, Shell: %8, SlaveName: %9")
.arg(m_pid).arg(m_shellProcess.m_handleMaster).arg(m_shellProcess.m_handleSlave).arg(type())
.arg(m_size.first).arg(m_size.second).arg(m_shellProcess.state() == QProcess::Running)
.arg(m_shellPath).arg(m_shellProcess.m_handleSlaveName);
#else
return QString("Nothing...");
#endif
}
QIODevice *UnixPtyProcess::notifier()
{
return &m_shellProcess;
}
QByteArray UnixPtyProcess::readAll()
{
QByteArray tmpBuffer = m_shellReadBuffer;
m_shellReadBuffer.clear();
return tmpBuffer;
}
qint64 UnixPtyProcess::write(const QByteArray &byteArray)
{
int result = ::write(m_shellProcess.m_handleMaster, byteArray.constData(), byteArray.size());
Q_UNUSED(result)
return byteArray.size();
}
bool UnixPtyProcess::isAvailable()
{
//todo check something more if required
return true;
}
int UnixPtyProcess::processList() const
{
QString proc = getUnixProc();
if (proc.isEmpty()) {
return 0;
}
if (proc == m_shellName) {
return 1;
}
return 2;
}
QString UnixPtyProcess::getUnixProc() const
{
QString tmp;
char *buf = pty_getproc(m_shellProcess.m_handleMaster,m_shellProcess.m_handleSlaveName.toUtf8().data());
if (buf) {
tmp = QString::fromUtf8(buf);
free(buf);
}
return tmp;
}
void UnixPtyProcess::stateChanged(QProcess::ProcessState newState)
{
if (newState == QProcess::Starting) {
emit started();
}
}
void UnixPtyProcess::finished(int /*exitCode*/, QProcess::ExitStatus /*exitStatus*/)
{
emit exited();
}
void UnixPtyProcess::readActivated(int socket)
{
Q_UNUSED(socket)
QByteArray buffer;
int readSize = 4096;
QByteArray data;
do
{
char nativeBuffer[4096];
int len = ::read(m_shellProcess.m_handleMaster, nativeBuffer, readSize);
data = QByteArray(nativeBuffer, len);
buffer.append(data);
} while (data.size() == readSize); //last data block always < readSize
m_shellReadBuffer.append(buffer);
m_shellProcess.emitReadyRead();
}
void UnixPtyProcess::moveToThread(QThread *targetThread)
{
m_shellProcess.moveToThread(targetThread);
}
void ShellProcess::setupChildProcess()
{
dup2(m_handleSlave, STDIN_FILENO);
dup2(m_handleSlave, STDOUT_FILENO);
dup2(m_handleSlave, STDERR_FILENO);
pid_t sid = setsid();
ioctl(m_handleSlave, TIOCSCTTY, 0);
tcsetpgrp(m_handleSlave, sid);
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_BSD4)
// on Android imposible to put record to the 'utmp' file
struct utmpx utmpxInfo;
memset(&utmpxInfo, 0, sizeof(utmpxInfo));
strncpy(utmpxInfo.ut_user, qgetenv("USER"), sizeof(utmpxInfo.ut_user));
QString device(m_handleSlaveName);
if (device.startsWith("/dev/"))
device = device.mid(5);
const char *d = device.toLatin1().constData();
strncpy(utmpxInfo.ut_line, d, sizeof(utmpxInfo.ut_line));
strncpy(utmpxInfo.ut_id, d + strlen(d) - sizeof(utmpxInfo.ut_id), sizeof(utmpxInfo.ut_id));
struct timeval tv;
gettimeofday(&tv, 0);
utmpxInfo.ut_tv.tv_sec = tv.tv_sec;
utmpxInfo.ut_tv.tv_usec = tv.tv_usec;
utmpxInfo.ut_type = USER_PROCESS;
utmpxInfo.ut_pid = getpid();
utmpxname(_PATH_UTMPX);
setutxent();
pututxline(&utmpxInfo);
endutxent();
#if !defined(Q_OS_UNIX)
updwtmpx(_PATH_UTMPX, &loginInfo);
#endif
#endif
}
/**
* pty_getproc
* Taken from tmux.
*/
// Taken from: tmux (http://tmux.sourceforge.net/)
// Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
// Copyright (c) 2009 Joshua Elsasser <josh@elsasser.org>
// Copyright (c) 2009 Todd Carson <toc@daybefore.net>
//
// Permission to use, copy, modify, and distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
// IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
// OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#if defined(__linux__)
static char *
pty_getproc(int fd, char *tty) {
FILE *f;
char *path, *buf;
size_t len;
int ch;
pid_t pgrp;
int r;
if ((pgrp = tcgetpgrp(fd)) == -1) {
return NULL;
}
r = asprintf(&path, "/proc/%lld/cmdline", (long long)pgrp);
if (r == -1 || path == NULL) return NULL;
if ((f = fopen(path, "r")) == NULL) {
free(path);
return NULL;
}
free(path);
len = 0;
buf = NULL;
while ((ch = fgetc(f)) != EOF) {
if (ch == '\0') break;
buf = (char *)realloc(buf, len + 2);
if (buf == NULL) return NULL;
buf[len++] = ch;
}
if (buf != NULL) {
buf[len] = '\0';
}
fclose(f);
return buf;
}
#elif defined(__APPLE__)
static char *
pty_getproc(int fd, char *tty) {
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, 0 };
size_t size;
struct kinfo_proc kp;
if ((mib[3] = tcgetpgrp(fd)) == -1) {
return NULL;
}
size = sizeof kp;
if (sysctl(mib, 4, &kp, &size, NULL, 0) == -1) {
return NULL;
}
if (*kp.kp_proc.p_comm == '\0') {
return NULL;
}
return strdup(kp.kp_proc.p_comm);
}
#else
static char *
pty_getproc(int fd, char *tty) {
return NULL;
}
#endif
| 15,305
|
C++
|
.cpp
| 474
| 28.00211
| 173
| 0.661033
|
visualfc/liteide
| 7,563
| 970
| 395
|
LGPL-2.1
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| true
| false
| false
|
21,168
|
ptyqt.cpp
|
visualfc_liteide/liteidex/src/3rdparty/ptyqt/core/ptyqt.cpp
|
#include "ptyqt.h"
#include <utility>
#ifdef Q_OS_WIN
#ifdef _MSC_VER
#include "conptyprocess.h"
#else
#include "winptyprocess.h"
#endif
#endif
#ifdef Q_OS_UNIX
#include "unixptyprocess.h"
#endif
IPtyProcess *PtyQt::createPtyProcess(IPtyProcess::PtyType ptyType)
{
switch (ptyType)
{
#ifdef Q_OS_WIN
#ifdef _MSC_VER
case IPtyProcess::ConPty:
return new ConPtyProcess();
break;
#else
case IPtyProcess::WinPty:
return new WinPtyProcess();
break;
#endif
#endif
#ifdef Q_OS_UNIX
case IPtyProcess::UnixPty:
return new UnixPtyProcess();
break;
#endif
case IPtyProcess::AutoPty:
default:
break;
}
#ifdef Q_OS_WIN
#ifdef _MSC_VER
return new ConPtyProcess();
#else
return new WinPtyProcess();
#endif
#endif
#ifdef Q_OS_UNIX
return new UnixPtyProcess();
#endif
}
| 871
|
C++
|
.cpp
| 47
| 15.021277
| 66
| 0.69656
|
visualfc/liteide
| 7,563
| 970
| 395
|
LGPL-2.1
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
21,172
|
LangGermanModel.cpp
|
visualfc_liteide/liteidex/src/3rdparty/libucd/src/LangGermanModel.cpp
|
/**
* @file LangGermanModel.cpp
* @brief LangGermanModel
* @license GPL 2.0/LGPL 2.1
*/
#include "nsSBCharSetProber.h"
static const unsigned char german_WINDOWS_1252CharToOrderMap[] =
{
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255, 30, 34, 50, 25, 27, 36, 31, 28, 35, 49, 41, 39, 32, 42, 48,
45, 58, 44, 21, 37, 40, 43, 29, 62, 61, 47,255,255,255,255,255,
255, 8, 16, 12, 9, 1, 18, 13, 7, 3, 46, 20, 11, 14, 2, 15,
33, 53, 4, 5, 6, 10, 23, 17, 55, 51, 19,255,255,255,255,255,
180,179,178,177,176,175,174,173,172,171,170, 64,169,168,167,166,
165,164, 54,163,162,161, 66,160,159,158,157, 63,156,155,154,153,
65,152,151,150,149,148,147,146,145,144,143, 57,142,141,140,139,
138,137,136,135,134,133,132,131,130,129,128, 56,127,126,125,124,
123,122,121,120, 59,119,118, 71,117,116,115,114,113,112,111,110,
109,108,107,106,105,104, 60,103,102,101,100, 99, 52, 98, 97, 26,
70, 96, 69, 95, 24, 94, 68, 93, 92, 67, 91, 90, 89, 88, 87, 86,
85, 84, 83, 82, 81, 80, 38, 79, 78, 77, 76, 75, 22, 74, 73, 72,
};
static const PRUint8 germanLangModel[] =
{
3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,0,2,2,2,0,3,0,0,0,0,0,0,
3,0,0,0,0,2,0,0,0,0,0,0,0,2,0,0,0,0,3,0,2,2,2,0,2,0,0,0,0,0,0,0,
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,0,0,0,0,0,0,0,0,
2,0,0,0,0,2,0,0,0,0,0,0,0,2,0,0,0,0,2,0,2,2,0,0,2,0,0,0,0,0,0,0,
3,3,2,3,3,3,3,2,3,2,3,3,3,3,3,3,2,3,3,3,0,0,2,2,0,3,0,0,0,0,0,0,
3,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,0,0,0,0,0,0,0,0,
2,0,0,0,0,3,0,0,0,0,0,0,0,2,0,0,0,0,2,0,2,2,0,0,2,0,0,0,0,0,0,0,
3,2,3,3,3,3,3,3,2,3,3,3,3,2,3,2,3,2,3,2,0,2,2,3,0,0,0,0,0,0,0,0,
3,0,0,0,0,2,0,0,0,0,0,0,0,2,0,0,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,
3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,2,0,3,2,3,0,0,0,0,0,0,0,0,
2,0,0,0,0,3,0,0,0,0,0,0,0,0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,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,
0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
const SequenceModel WINDOWS_1252germanModel =
{
german_WINDOWS_1252CharToOrderMap,
germanLangModel,
(float)0.985431,
PR_TRUE,
"WINDOWS-1252",
"german"
};
| 9,777
|
C++
|
.cpp
| 165
| 58.084848
| 65
| 0.5255
|
visualfc/liteide
| 7,563
| 970
| 395
|
LGPL-2.1
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| true
| false
| true
| true
| true
| false
|
21,173
|
LangFinnishModel.cpp
|
visualfc_liteide/liteidex/src/3rdparty/libucd/src/LangFinnishModel.cpp
|
/**
* @file LangFinnishModel.cpp
* @brief LangFinnishModel
* @license GPL 2.0/LGPL 2.1
*/
#include "nsSBCharSetProber.h"
static const unsigned char finnish_WINDOWS_1252CharToOrderMap[] =
{
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255, 30, 48, 45, 50, 22, 46, 40, 29, 27, 32, 24, 33, 21, 26, 31,
36, 60, 34, 23, 28, 39, 35, 59, 49, 41, 54,255,255,255,255,255,
255, 1, 43, 47, 19, 5, 44, 37, 13, 2, 18, 9, 8, 12, 3, 11,
17, 57, 15, 6, 4, 10, 14, 51, 58, 16, 56,255,255,255,255,255,
175,255,174,173,172,171,170,169,168,167,166,165,164,255,163,255,
255,162,161,160,159,158,157,156,155,154,153,152,151,255,150,149,
148,147,146,145,144,143, 63,142,141,140,139,138,137,136,135,134,
133,132,131,130,129,128,127,126,125,124,123, 25,122,121,120,119,
118,117,116,115, 38,114,113,112,111,110,109,108,107,106,105,104,
103,102,101,100, 99, 98, 42, 97, 96, 95, 94, 93, 92, 91, 90, 89,
88, 87, 62, 86, 7, 55, 85, 52, 84, 53, 83, 82, 81, 80, 79, 78,
77, 76, 75, 74, 73, 72, 20, 71, 70, 69, 68, 67, 61, 66, 65, 64,
};
static const PRUint8 finnishLangModel[] =
{
3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,2,3,3,3,0,0,0,0,0,3,0,0,0,0,0,0,0,
0,0,0,0,2,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,0,0,0,0,3,0,0,0,0,0,0,0,
0,0,0,0,2,0,0,0,0,0,2,3,0,0,2,0,0,0,0,0,2,0,0,0,2,2,0,0,0,0,0,0,
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,0,0,0,0,3,0,0,0,0,0,0,0,
0,0,0,0,3,0,0,0,0,0,3,3,0,0,2,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,
3,3,2,3,3,3,3,2,3,3,3,3,3,3,3,3,2,2,0,3,0,0,0,0,2,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,0,0,0,0,2,0,0,0,0,0,0,0,
0,0,0,0,2,0,0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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,2,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
const SequenceModel WINDOWS_1252finnishModel =
{
finnish_WINDOWS_1252CharToOrderMap,
finnishLangModel,
(float)0.995928,
PR_TRUE,
"WINDOWS-1252",
"finnish"
};
| 9,785
|
C++
|
.cpp
| 165
| 58.139394
| 66
| 0.525894
|
visualfc/liteide
| 7,563
| 970
| 395
|
LGPL-2.1
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| true
| false
| true
| true
| true
| false
|
21,176
|
LangSwedishModel.cpp
|
visualfc_liteide/liteidex/src/3rdparty/libucd/src/LangSwedishModel.cpp
|
/**
* @file LangSwedishModel.cpp
* @brief LangSwedishModel
* @license GPL 2.0/LGPL 2.1
*/
#include "nsSBCharSetProber.h"
static const unsigned char swedish_WINDOWS_1252CharToOrderMap[] =
{
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255, 31, 44, 47, 26, 33, 36, 38, 27, 40, 30, 42, 43, 29, 34, 35,
45, 70, 46, 28, 37, 48, 32, 53, 61, 60, 57,255,255,255,255,255,
255, 1, 23, 21, 7, 2, 18, 11, 14, 9, 24, 13, 8, 12, 3, 10,
22, 52, 5, 6, 4, 19, 16, 55, 41, 25, 54,255,255,255,255,255,
180,179,178,177, 66,176, 71,175,174,173,172,171,170,169,168,167,
166,165, 56, 59,164,163,162,161,160,159,158,157,156,155,154,153,
152,151,150, 69,149,148,147,146,145,144,143,142,141,140,139,138,
72, 85, 77, 62,137,136,135,134,133,132,131, 39, 73, 68, 76,130,
129,128,127,126, 49, 50, 84,125,124, 81,123,122,121,120,119,118,
117,116,115,114,113,112, 58,111,110,109,108,107, 83,106,105,104,
64,103, 80,102, 15, 17, 65, 74, 67, 51, 79, 78,101,100, 99, 98,
97, 96, 95, 94, 82, 93, 20, 92, 91, 90, 89, 75, 63, 88, 87, 86,
};
static const PRUint8 swedishLangModel[] =
{
2,2,3,3,3,3,3,3,2,2,3,3,3,2,1,3,2,3,3,0,3,3,3,2,2,0,0,0,0,0,0,0,
0,0,0,0,0,0,2,0,3,0,0,0,0,0,0,0,0,0,0,0,0,2,1,2,0,0,2,0,0,0,0,0,
3,3,3,3,3,3,3,3,2,2,3,3,3,3,2,3,2,3,3,1,3,3,3,3,2,0,0,0,0,0,0,0,
0,0,0,0,0,0,2,0,3,0,0,0,0,0,0,0,0,0,0,2,0,2,2,2,0,0,1,0,0,0,0,0,
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,0,0,0,0,0,0,0,
0,0,0,0,0,0,2,0,1,0,0,0,0,0,0,0,0,0,2,1,0,2,0,2,0,0,2,0,0,0,0,0,
3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,3,3,3,0,0,0,0,0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0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,2,2,2,0,0,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,
0,0,0,0,0,0,0,2,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
const SequenceModel WINDOWS_1252swedishModel =
{
swedish_WINDOWS_1252CharToOrderMap,
swedishLangModel,
(float)0.989923,
PR_TRUE,
"WINDOWS-1252",
"swedish"
};
| 9,785
|
C++
|
.cpp
| 165
| 58.133333
| 66
| 0.525894
|
visualfc/liteide
| 7,563
| 970
| 395
|
LGPL-2.1
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| true
| false
| true
| true
| true
| false
|
21,177
|
LangGreekModel.cpp
|
visualfc_liteide/liteidex/src/3rdparty/libucd/src/LangGreekModel.cpp
|
/**
* @file LangGreekModel.cpp
* @brief LangGreekModel
* @license GPL 2.0/LGPL 2.1
*/
#include "nsSBCharSetProber.h"
/****************************************************************
255: Control characters that usually does not exist in any text
254: Carriage/Return
253: symbol (punctuation) that does not belong to word
252: 0 - 9
*****************************************************************/
//Character Mapping Table:
static const unsigned char greek_ISO_8859_7CharToOrderMap[] =
{
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255, 67, 59, 45, 74, 51, 61, 69,105, 88, 99, 80, 93, 77, 95, 97,
73,121, 92, 71, 64,110,103, 87,114,112,116,255,255,255,255,255,
255, 32, 72, 60, 43, 29, 78, 44, 58, 28, 70, 49, 41, 55, 40, 31,
42,115, 37, 39, 38, 53, 90, 65, 98, 66,108,255,255,255,255,255,
145,140,150,180,138,144,179,155,178,154,177,176,135,175,149,174,
173,137,143,172,171,136,148,170,169,153,152,151,168,167,166,165,
164,134,107,132,127,163,162,128,147,131,161, 84,146,160,159,142,
133,126,130,129,120,141,102, 94, 89,109,118, 83, 85,139,122,125,
91, 36, 62, 75, 57, 46,111, 82,101, 56, 54, 81, 50, 68,113, 63,
47, 96,158, 25, 48,106, 79, 86,119,104,124,157, 17, 21, 18, 15,
123, 1, 34, 19, 23, 5, 33, 9, 27, 6, 12, 16, 13, 4, 52, 2,
14, 7, 11, 8, 3, 10, 22, 26, 76, 24,100,117, 20, 30, 35,156,
};
static const unsigned char greek_WINDOWS_1253CharToOrderMap[] =
{
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255, 67, 59, 45, 74, 51, 61, 69,105, 88, 99, 80, 93, 77, 95, 97,
73,121, 92, 71, 64,110,103, 87,114,112,116,255,255,255,255,255,
255, 32, 72, 60, 43, 29, 78, 44, 58, 28, 70, 49, 41, 55, 40, 31,
42,115, 37, 39, 38, 53, 90, 65, 98, 66,108,255,255,255,255,255,
127,180,179,178,177,176,175,174,173,172,171,170,169,168,167,166,
165,134,107,164,163,162,161,160,159,158,157,156,155,154,153,152,
151,137,102,132,150,149,148,128,139,131,147, 84,138,146,145,136,
133,126,130,129,120,144,143, 94, 89,109,118, 83, 85,135,122,125,
91, 36, 62, 75, 57, 46,111, 82,101, 56, 54, 81, 50, 68,113, 63,
47, 96,142, 25, 48,106, 79, 86,119,104,124,141, 17, 21, 18, 15,
123, 1, 34, 19, 23, 5, 33, 9, 27, 6, 12, 16, 13, 4, 52, 2,
14, 7, 11, 8, 3, 10, 22, 26, 76, 24,100,117, 20, 30, 35,140,
};
//Model Table:
//total sequences: 100%
//first 512 sequences: 98.2851%
//first 1024 sequences:1.7001%
//rest sequences: 0.0359%
//negative sequences: 0.0148%
static const PRUint8 greekLangModel[] =
{
1,2,3,3,2,3,3,3,1,3,3,3,3,3,3,3,1,2,3,2,2,3,3,1,0,3,3,0,0,3,0,0,
3,3,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,3,0,1,0,0,0,0,0,0,0,0,0,0,
2,2,3,3,3,3,3,3,2,3,3,3,3,3,3,3,1,3,3,1,2,3,3,1,1,3,3,0,0,3,0,0,
2,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,1,0,1,0,0,0,0,0,0,0,0,
3,3,2,1,3,3,3,3,3,3,1,1,2,1,3,3,3,3,1,3,3,1,0,3,0,1,1,0,0,3,1,0,
2,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
3,3,3,3,3,3,1,2,3,2,1,1,1,0,3,1,3,3,2,3,3,1,3,3,0,1,3,1,1,2,1,0,
1,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0,3,2,
0,0,0,0,2,2,2,1,2,1,1,1,1,0,0,0,2,0,0,0,2,0,1,0,0,2,1,2,1,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0,3,2,
0,0,0,0,2,1,1,0,2,0,0,0,1,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,2,0,0,1,
2,3,0,0,2,3,2,0,1,1,0,0,0,0,2,2,2,1,1,2,1,0,0,0,0,0,0,0,0,1,0,0,
0,0,1,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,
0,0,1,1,0,2,2,1,0,2,0,3,2,1,1,2,0,0,0,0,0,1,2,0,2,1,1,0,0,2,0,0,
0,1,0,1,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,1,0,1,0,1,1,0,0,0,0,1,1,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0,3,2,
0,0,0,0,2,1,1,0,0,0,1,0,1,0,1,0,1,1,1,0,1,1,1,0,0,2,0,0,1,0,0,1,
};
const SequenceModel ISO_8859_7greekModel =
{
greek_ISO_8859_7CharToOrderMap,
greekLangModel,
(float)0.944928,
true,
"ISO-8859-7",
"greek"
};
const SequenceModel WINDOWS_1253greekModel =
{
greek_WINDOWS_1253CharToOrderMap,
greekLangModel,
(float)0.944928,
true,
"WINDOWS-1253",
"greek"
};
| 11,509
|
C++
|
.cpp
| 206
| 54.61165
| 66
| 0.540593
|
visualfc/liteide
| 7,563
| 970
| 395
|
LGPL-2.1
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| true
| false
| false
| true
| true
| false
|
21,181
|
LangPolishModel.cpp
|
visualfc_liteide/liteidex/src/3rdparty/libucd/src/LangPolishModel.cpp
|
/**
* @file LangGreekModel.cpp
* @brief LangGreekModel
* @license GPL 2.0/LGPL 2.1
*/
#include "nsSBCharSetProber.h"
static const unsigned char polish_iso_8859_2CharToOrderMap[] =
{
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255, 34, 39, 37, 46, 54, 59, 51, 43, 35, 42, 45, 49, 41, 32, 47,
31,180, 50, 33, 38, 53, 60, 30, 61, 58, 40,255,255,255,255,255,
255, 1, 21, 11, 13, 3, 44, 23, 26, 2, 18, 15, 20, 14, 6, 4,
16, 63, 7, 8, 12, 19, 52, 9, 64, 10, 5,255,255,255,255,255,
179,178,177,176,175,174,173,172,171,170,169,168,167,166,165,164,
163,162,161,160,159,158,157,156,155,154,153,152,151,150,149,148,
147, 70,146, 57,145,144, 55, 78,143,142,141,140, 74,139,138, 56,
137, 24,136, 17,135, 82, 27,134,133,132,131, 65, 48,130,129, 25,
128,127,126,125,124,123, 77,122,121,120, 66,119,118,117,116,115,
114, 68,113, 62,112,111,110,109,108,107,106,105, 81,104,103,102,
101, 76, 69,100, 80, 99, 29, 71, 98, 67, 22, 97, 96, 95, 79, 73,
94, 36, 93, 28, 92, 91, 75, 90, 89, 88, 87, 86, 72, 85, 84, 83,
};
static const PRUint8 polishLangModel[] =
{
2,2,2,2,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,0,3,0,3,2,3,0,3,0,0,0,
0,0,0,3,0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
3,2,3,3,3,3,3,3,3,0,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,0,3,3,3,0,0,0,
0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,
2,2,2,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,2,3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, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| true
| false
| true
| true
| true
| false
|
21,195
|
LangSpanishModel.cpp
|
visualfc_liteide/liteidex/src/3rdparty/libucd/src/LangSpanishModel.cpp
|
/**
* @file LangSpanishModel.cpp
* @brief LangSpanishModel
* @license GPL 2.0/LGPL 2.1
*/
#include "nsSBCharSetProber.h"
static const unsigned char spanish_windows_1252CharToOrderMap[] =
{
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255, 32, 44, 29, 38, 26, 48, 49, 53, 37, 55, 63, 31, 35, 40, 46,
30, 58, 36, 33, 41, 47, 54, 52, 64, 51, 67,255,255,255,255,255,
255, 2, 15, 11, 9, 1, 19, 16, 21, 6, 27, 43, 8, 13, 4, 3,
14, 22, 7, 5, 10, 12, 17, 42, 39, 18, 24,255,255,255,255,255,
180,179,178,177,176, 71,175,174,173,172,171,170,169,168,167,166,
165, 76, 70, 61, 62,164, 57,163,162,161,160,159,158,157,156,155,
154, 56,153,152,151,150,149,148,147, 79, 73, 59,146,145,144,143,
83, 82,142,141,140,139,138,137,136,135, 78, 60,134,133,132, 50,
131, 72,130,129,128,127,126,125,124, 66,123,122,121, 68,120,119,
118, 74,117, 69,116,115,114,113,112,111, 81,110,109,108,107,106,
105, 25,104,103,102,101,100, 77, 75, 28, 99, 98, 97, 23, 96, 95,
94, 34, 80, 20, 93, 92, 91, 90, 89, 88, 45, 87, 65, 86, 85, 84,
};
static const PRUint8 spanishLangModel[] =
{
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,3,3,3,2,0,3,0,0,2,2,0,
2,3,0,0,0,0,3,0,2,3,2,3,2,0,0,0,0,0,0,2,0,0,0,0,2,0,0,2,0,2,0,2,
3,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3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OrderMap,
spanishLangModel,
(float)0.983906,
PR_TRUE,
"windows-1252",
"spanish"
};
| 9,785
|
C++
|
.cpp
| 165
| 58.139394
| 66
| 0.525894
|
visualfc/liteide
| 7,563
| 970
| 395
|
LGPL-2.1
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| true
| false
| true
| true
| true
| false
|
21,196
|
LangHungarianModel.cpp
|
visualfc_liteide/liteidex/src/3rdparty/libucd/src/LangHungarianModel.cpp
|
/**
* @file LangHungarianModel.cpp
* @brief LangHungarianModel
* @license GPL 2.0/LGPL 2.1
*/
#include "nsSBCharSetProber.h"
/****************************************************************
255: Control characters that usually does not exist in any text
254: Carriage/Return
253: symbol (punctuation) that does not belong to word
252: 0 - 9
*****************************************************************/
//Character Mapping Table:
static const unsigned char Latin2_HungarianCharToOrderMap[] =
{
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255, 30, 47, 46, 43, 34, 50, 52, 38, 41, 49, 36, 44, 33, 35, 53,
51,180, 45, 37, 42, 56, 39, 62, 64, 59, 54,255,255,255,255,255,
255, 2, 18, 27, 17, 1, 24, 12, 20, 9, 23, 7, 5, 13, 4, 8,
26, 65, 10, 6, 3, 21, 19, 67, 63, 16, 11,255,255,255,255,255,
179,178,177,176,175,174,173,172,171,170,169,168,167,166,165,164,
163,162,161,160,159,158,157,156,155,154,153,152,151,150,149,148,
147,146,145,144,143,142,141,140,139,138,137,136,135,134,133,132,
131,130,129,128,127,126,125,124,123,122,121,120,119,118,117,116,
115, 55,114,113,112,111,110,109,108, 48,107,106,105, 66,104,103,
102,101,100, 60, 99, 61, 57, 98, 97, 96, 58, 68, 69, 95, 94, 93,
92, 14, 91, 90, 89, 88, 87, 86, 85, 15, 84, 70, 83, 31, 82, 81,
80, 79, 78, 25, 77, 28, 22, 76, 75, 74, 32, 40, 29, 73, 72, 71,
};
static const unsigned char win1250HungarianCharToOrderMap[] =
{
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255, 30, 47, 46, 43, 34, 50, 52, 38, 41, 49, 36, 44, 33, 35, 53,
51,180, 45, 37, 42, 56, 39, 63, 65, 60, 54,255,255,255,255,255,
255, 2, 18, 27, 17, 1, 24, 12, 20, 9, 23, 7, 5, 13, 4, 8,
26, 67, 10, 6, 3, 21, 19, 70, 64, 16, 11,255,255,255,255,255,
179,178,177,176, 59,175,174,173,172,171,170,169,168,167,166,165,
164,163,162,161,160,159,158,157,156,155,154,153,152,151,150,149,
148,147,146,145,144,143,142,141,140,139,138, 69,137,136,135,134,
133,132,131,130,129,128,127,126,125,124,123, 66,122,121,120,119,
118, 55,117,116,115,114,113,112,111, 48,110,109,108, 68,107,106,
105,104,103, 61,102, 62, 57,101,100, 99, 58, 71, 72, 98, 97, 96,
95, 14, 94, 93, 92, 91, 90, 89, 88, 15, 87, 73, 86, 31, 85, 84,
83, 82, 81, 25, 80, 28, 22, 79, 78, 77, 32, 40, 29, 76, 75, 74,
};
//Model Table:
//total sequences: 100%
//first 512 sequences: 94.7368%
//first 1024 sequences:5.2623%
//rest sequences: 0.8894%
//negative sequences: 0.0009%
static const PRUint8 HungarianLangModel[] =
{
2,2,3,3,3,3,3,2,3,3,3,3,3,3,2,2,3,3,3,3,2,0,3,3,0,3,3,0,2,0,2,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
3,2,3,3,3,3,3,0,3,3,3,3,3,2,2,3,3,3,3,3,3,0,3,3,2,3,3,0,2,0,0,2,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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ianCharToOrderMap,
HungarianLangModel,
(float)0.965178,
true,
"windows-1250",
"hungarian"
};
| 11,529
|
C++
|
.cpp
| 206
| 54.73301
| 66
| 0.542595
|
visualfc/liteide
| 7,563
| 970
| 395
|
LGPL-2.1
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| true
| false
| false
| true
| true
| false
|
21,197
|
LangCzechModel.cpp
|
visualfc_liteide/liteidex/src/3rdparty/libucd/src/LangCzechModel.cpp
|
/**
* @file LangCzechModel.cpp
* @brief LangCzechModel
* @license GPL 2.0/LGPL 2.1
*/
#include "nsSBCharSetProber.h"
static const unsigned char czech_iso_8859_2CharToOrderMap[] =
{
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255, 32, 42, 49, 41, 63, 52, 36, 38, 53, 35, 37, 59, 44, 34, 47,
33,180, 48, 45, 40, 56, 39, 76, 70, 75, 51,255,255,255,255,255,
255, 3, 24, 19, 11, 1, 50, 57, 17, 8, 16, 12, 5, 10, 4, 2,
14, 58, 15, 6, 7, 13, 9, 80, 62, 21, 23,255,255,255,255,255,
179,178,177,176,175,174,173,172,171,170,169,168,167,166,165,164,
163,162,161,160,159,158,157,156,155,154,153,152,151,150,149,148,
147,146,145,144,143,142,141,140,139, 64,138, 79,137,136, 61,135,
134,133,132,131,130,129,128,127,126, 28,125, 43,124,123, 25,122,
121, 71,120,119,118,117,116,115, 60, 72,114,113, 73, 69,112, 78,
111,110,109, 68,108,107,106,105, 65, 77, 67,104,103, 74,102,101,
100, 20, 99, 98, 97, 96, 95, 94, 27, 29, 93, 92, 22, 18, 91, 55,
90, 89, 54, 66, 88, 87, 86, 85, 26, 31, 46, 84, 83, 30, 82, 81,
};
static const PRUint8 czechLangModel[] =
{
1,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
const SequenceModel iso_8859_2czechModel =
{
czech_iso_8859_2CharToOrderMap,
czechLangModel,
(float)0.968107,
PR_TRUE,
"iso-8859-2",
"czech"
};
| 9,761
|
C++
|
.cpp
| 165
| 58
| 64
| 0.524291
|
visualfc/liteide
| 7,563
| 970
| 395
|
LGPL-2.1
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| true
| false
| true
| true
| true
| false
|
21,199
|
LangTurkishModel.cpp
|
visualfc_liteide/liteidex/src/3rdparty/libucd/src/LangTurkishModel.cpp
|
/**
* @file LangTurkishModel.cpp
* @brief LangTurkishModel
* @license GPL 2.0/LGPL 2.1
*/
#include "nsSBCharSetProber.h"
static const unsigned char turkish_ISO_8859_9CharToOrderMap[] =
{
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255, 23, 37, 47, 39, 29, 52, 36, 45, 53, 60, 16, 49, 20, 46, 42,
48, 69, 44, 35, 31, 51, 38, 62, 65, 43, 56,255,255,255,255,255,
255, 1, 21, 28, 12, 2, 18, 27, 25, 3, 24, 10, 5, 13, 4, 15,
26, 64, 7, 8, 9, 14, 32, 57, 58, 11, 22,255,255,255,255,255,
180,179,178,177,176,175,174,173,172,171,170,169,168,167,166,165,
164,163,162,161,160,159,101,158,157,156,155,154,153,152,151,106,
150,149,148,147,146,145,144,100,143,142,141,140,139,138,137,136,
94, 80, 93,135,105,134,133, 63,132,131,130,129,128,127,126,125,
124,104, 73, 99, 79, 85,123, 54,122, 98, 92,121,120, 91,103,119,
68,118,117, 97,116,115, 50, 90,114,113,112,111, 55, 41, 40, 86,
89, 70, 59, 78, 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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,1,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
const SequenceModel ISO_8859_9turkishModel =
{
turkish_ISO_8859_9CharToOrderMap,
turkishLangModel,
(float)0.970290,
PR_TRUE,
"ISO-8859-9",
"turkish"
};
| 9,777
|
C++
|
.cpp
| 165
| 58.078788
| 64
| 0.525083
|
visualfc/liteide
| 7,563
| 970
| 395
|
LGPL-2.1
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| true
| false
| true
| true
| true
| false
|
21,202
|
LangFrenchModel.cpp
|
visualfc_liteide/liteidex/src/3rdparty/libucd/src/LangFrenchModel.cpp
|
/**
* @file LangFrenchModel.cpp
* @brief LangFrenchModel
* @license GPL 2.0/LGPL 2.1
*/
#include "nsSBCharSetProber.h"
static const unsigned char french_WINDOWS_1252CharToOrderMap[] =
{
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255, 30, 40, 31, 37, 27, 44, 48, 52, 32, 45, 61, 25, 29, 41, 43,
34, 53, 38, 35, 39, 46, 42, 68, 63, 65, 71,255,255,255,255,255,
255, 2, 20, 12, 11, 1, 17, 18, 21, 4, 24, 57, 9, 13, 5, 10,
14, 19, 7, 3, 6, 8, 16, 54, 23, 28, 36,255,255,255,255,255,
64,180,179,178,177, 75,176,175,174,173,172,171, 91,170,169,168,
167,166, 62,111,110, 67, 78, 88,165, 97,164, 90, 82,163,162,161,
160,159,158,157,156,155,154, 86, 84, 69,101, 50,109,153, 96,152,
81,151,108,150,100,149,148, 80,147,107,146, 51,145,144,143,142,
70,141, 79, 72,140,139,138, 73, 77, 60, 76,137,136,135, 99,134,
106,133,132,131, 83,130, 98, 92,129, 95,128, 94,127,126,125,124,
22, 93, 49,123,105,104, 89, 47, 26, 15, 33, 74,122,121, 56, 66,
120,103,119,118, 55,102, 87,117,116, 59,115, 58, 85,114,113,112,
};
static const PRUint8 frenchLangModel[] =
{
2,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,2,3,2,0,3,2,0,0,0,3,2,0,0,0,
0,0,0,3,0,0,1,1,0,0,0,1,0,0,2,0,2,0,2,0,0,3,1,0,2,3,0,0,0,0,1,0,
2,2,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,0,2,3,0,0,0,3,0,0,0,0,
0,0,1,3,0,0,0,0,0,0,0,0,0,0,3,0,0,0,1,0,0,1,1,3,3,0,0,0,0,0,0,0,
3,3,3,3,2,3,2,3,3,3,1,3,3,3,3,1,2,2,3,2,2,0,0,1,1,3,0,3,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,1,0,1,2,2,0,0,0,2,0,0,
3,3,3,2,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,1,0,3,2,1,3,0,1,0,0,0,0,
1,2,0,3,0,0,0,2,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,2,0,0,0,0,0,0,0,
3,3,3,3,3,3,3,3,2,3,3,3,2,2,3,3,3,3,3,2,3,0,2,2,0,2,0,2,0,1,0,0,
3,0,0,3,0,0,0,0,1,0,0,1,0,0,3,0,2,0,1,0,0,0,1,0,2,1,0,0,0,2,0,0,
3,3,3,3,1,3,3,3,2,3,1,2,2,3,3,0,1,0,0,1,3,0,0,0,0,3,0,2,0,0,0,0,
3,0,0,2,0,0,0,0,0,0,0,0,0,0,0,1,2,0,1,0,0,1,3,1,0,0,0,0,0,0,0,0,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,2,0,0,0,0,2,0,0,0,0,0,2,1,0,0,0,0,2,1,0,2,0,2,
1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,
1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,3,
0,0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
const SequenceModel WINDOWS_1252frenchModel =
{
french_WINDOWS_1252CharToOrderMap,
frenchLangModel,
(float)0.985451,
PR_TRUE,
"WINDOWS-1252",
"french"
};
| 9,777
|
C++
|
.cpp
| 165
| 58.078788
| 65
| 0.5255
|
visualfc/liteide
| 7,563
| 970
| 395
|
LGPL-2.1
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| true
| false
| true
| true
| true
| false
|
21,207
|
filterlineedit.cpp
|
visualfc_liteide/liteidex/src/3rdparty/qtc_editutil/filterlineedit.cpp
|
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#include "filterlineedit.h"
#include <QTimer>
namespace Utils {
FilterLineEdit::FilterLineEdit(int dly, QWidget *parent) :
FancyLineEdit(parent),
m_lastFilterText(text()),
m_dlytimer(dly)
{
// KDE has custom icons for this. Notice that icon namings are counter intuitive
// If these icons are not avaiable we use the freedesktop standard name before
// falling back to a bundled resource
QIcon icon = QIcon::fromTheme(layoutDirection() == Qt::LeftToRight ?
QLatin1String("edit-clear-locationbar-rtl") :
QLatin1String("edit-clear-locationbar-ltr"),
QIcon::fromTheme(QLatin1String("edit-clear"), QIcon(QLatin1String("icon:images/editclear.png"))));
setButtonPixmap(Right, icon.pixmap(16));
setButtonVisible(Right, true);
setPlaceholderText(tr("Filter"));
setButtonToolTip(Right, tr("Clear text"));
setAutoHideButton(Right, true);
m_timer = new QTimer(this);
m_timer->setSingleShot(true);
connect(m_timer,SIGNAL(timeout()),this,SLOT(dlyTextChanged()));
connect(this, SIGNAL(rightButtonClicked()), this, SLOT(clear()));
connect(this, SIGNAL(textChanged(QString)), this, SLOT(slotTextChanged()));
}
void FilterLineEdit::slotTextChanged()
{
const QString newlyTypedText = text();
if (newlyTypedText != m_lastFilterText) {
m_lastFilterText = newlyTypedText;
if (m_dlytimer == 0) {
emit filterChanged(m_lastFilterText);
} else {
m_timer->start(m_dlytimer);
}
}
}
void FilterLineEdit::dlyTextChanged()
{
emit filterChanged(m_lastFilterText);
}
} // namespace Utils
| 2,890
|
C++
|
.cpp
| 71
| 36.760563
| 119
| 0.681964
|
visualfc/liteide
| 7,563
| 970
| 395
|
LGPL-2.1
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| true
| false
| false
| true
| false
| false
|
21,209
|
gdbmi.cpp
|
visualfc_liteide/liteidex/src/3rdparty/qtc_gdbmi/gdbmi.cpp
|
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "gdbmi.h"
#include <QTextStream>
#include <QDebug>
//lite_memory_check_begin
#if defined(WIN32) && defined(_MSC_VER) && defined(_DEBUG)
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#define DEBUG_NEW new( _NORMAL_BLOCK, __FILE__, __LINE__ )
#define new DEBUG_NEW
#endif
//lite_memory_check_end
void skipCommas(const char *&from, const char *to)
{
while (*from == ',' && from != to)
++from;
}
QTextStream &operator<<(QTextStream &os, const GdbMiValue &mi)
{
return os << mi.toString();
}
void GdbMiValue::parseResultOrValue(const char *&from, const char *to)
{
while (from != to && isspace(*from))
++from;
//qDebug() << "parseResultOrValue: " << QByteArray(from, to - from);
parseValue(from, to);
if (isValid()) {
//qDebug() << "no valid result in " << QByteArray(from, to - from);
return;
}
if (from == to || *from == '(')
return;
const char *ptr = from;
while (ptr < to && *ptr != '=') {
//qDebug() << "adding" << QChar(*ptr) << "to name";
++ptr;
}
m_name = QByteArray(from, ptr - from);
from = ptr;
if (from < to && *from == '=') {
++from;
parseValue(from, to);
}
}
QByteArray GdbMiValue::parseCString(const char *&from, const char *to)
{
QByteArray result;
//qDebug() << "parseCString: " << QByteArray(from, to - from);
if (*from != '"') {
qDebug() << "MI Parse Error, double quote expected";
++from; // So we don't hang
return QByteArray();
}
const char *ptr = from;
++ptr;
while (ptr < to) {
if (*ptr == '"') {
++ptr;
result = QByteArray(from + 1, ptr - from - 2);
break;
}
if (*ptr == '\\') {
++ptr;
if (ptr == to) {
qDebug() << "MI Parse Error, unterminated backslash escape";
from = ptr; // So we don't hang
return QByteArray();
}
}
++ptr;
}
from = ptr;
int idx = result.indexOf('\\');
if (idx >= 0) {
char *dst = result.data() + idx;
const char *src = dst + 1, *end = result.data() + result.length();
do {
char c = *src++;
switch (c) {
case 'a': *dst++ = '\a'; break;
case 'b': *dst++ = '\b'; break;
case 'f': *dst++ = '\f'; break;
case 'n': *dst++ = '\n'; break;
case 'r': *dst++ = '\r'; break;
case 't': *dst++ = '\t'; break;
case 'v': *dst++ = '\v'; break;
case '"': *dst++ = '"'; break;
case '\\': *dst++ = '\\'; break;
default:
{
int chars = 0;
uchar prod = 0;
forever {
if (c < '0' || c > '7') {
--src;
break;
}
prod = prod * 8 + c - '0';
if (++chars == 3 || src == end)
break;
c = *src++;
}
if (!chars) {
qDebug() << "MI Parse Error, unrecognized backslash escape";
return QByteArray();
}
*dst++ = prod;
}
}
while (src != end) {
char c = *src++;
if (c == '\\')
break;
*dst++ = c;
}
} while (src != end);
*dst = 0;
result.truncate(dst - result.data());
}
return result;
}
void GdbMiValue::parseValue(const char *&from, const char *to)
{
//qDebug() << "parseValue: " << QByteArray(from, to - from);
switch (*from) {
case '{':
parseTuple(from, to);
break;
case '[':
parseList(from, to);
break;
case '"':
m_type = Const;
m_data = parseCString(from, to);
break;
default:
break;
}
}
void GdbMiValue::parseTuple(const char *&from, const char *to)
{
//qDebug() << "parseTuple: " << QByteArray(from, to - from);
if (*from != '{') {
return;
}
++from;
parseTuple_helper(from, to);
}
void GdbMiValue::parseTuple_helper(const char *&from, const char *to)
{
skipCommas(from, to);
//qDebug() << "parseTuple_helper: " << QByteArray(from, to - from);
m_type = Tuple;
while (from < to) {
if (*from == '}') {
++from;
break;
}
GdbMiValue child;
child.parseResultOrValue(from, to);
//qDebug() << "\n=======\n" << qPrintable(child.toString()) << "\n========\n";
if (!child.isValid())
return;
m_children += child;
skipCommas(from, to);
}
}
void GdbMiValue::parseList(const char *&from, const char *to)
{
//qDebug() << "parseList: " << QByteArray(from, to - from);
if (*from != '[') {
return;
}
++from;
m_type = List;
skipCommas(from, to);
while (from < to) {
if (*from == ']') {
++from;
break;
}
GdbMiValue child;
child.parseResultOrValue(from, to);
if (child.isValid())
m_children += child;
skipCommas(from, to);
}
}
static QByteArray ind(int indent)
{
return QByteArray(2 * indent, ' ');
}
void GdbMiValue::dumpChildren(QByteArray * str, bool multiline, int indent) const
{
for (int i = 0; i < m_children.size(); ++i) {
if (i != 0) {
*str += ',';
if (multiline)
*str += '\n';
}
if (multiline)
*str += ind(indent);
*str += m_children.at(i).toString(multiline, indent);
}
}
class MyString : public QString {
public:
ushort at(int i) const { return constData()[i].unicode(); }
};
template<class ST, typename CT>
inline ST escapeCStringTpl(const ST &ba)
{
ST ret;
ret.reserve(ba.length() * 2);
for (int i = 0; i < ba.length(); ++i) {
CT c = ba.at(i);
switch (c) {
case '\\': ret += "\\\\"; break;
case '\a': ret += "\\a"; break;
case '\b': ret += "\\b"; break;
case '\f': ret += "\\f"; break;
case '\n': ret += "\\n"; break;
case '\r': ret += "\\r"; break;
case '\t': ret += "\\t"; break;
case '\v': ret += "\\v"; break;
case '"': ret += "\\\""; break;
default:
if (c < 32 || c == 127) {
ret += '\\';
ret += '0' + (c >> 6);
ret += '0' + ((c >> 3) & 7);
ret += '0' + (c & 7);
} else {
ret += c;
}
}
}
return ret;
}
QString GdbMiValue::escapeCString(const QString &ba)
{
return escapeCStringTpl<MyString, ushort>(static_cast<const MyString &>(ba));
}
QByteArray GdbMiValue::escapeCString(const QByteArray &ba)
{
return escapeCStringTpl<QByteArray, uchar>(ba);
}
QByteArray GdbMiValue::toString(bool multiline, int indent) const
{
QByteArray result;
switch (m_type) {
case Invalid:
if (multiline)
result += ind(indent) + "Invalid\n";
else
result += "Invalid";
break;
case Const:
if (!m_name.isEmpty())
result += m_name + '=';
result += '"' + escapeCString(m_data) + '"';
break;
case Tuple:
if (!m_name.isEmpty())
result += m_name + '=';
if (multiline) {
result += "{\n";
dumpChildren(&result, multiline, indent + 1);
result += '\n' + ind(indent) + '}';
} else {
result += '{';
dumpChildren(&result, multiline, indent + 1);
result += '}';
}
break;
case List:
if (!m_name.isEmpty())
result += m_name + '=';
if (multiline) {
result += "[\n";
dumpChildren(&result, multiline, indent + 1);
result += '\n' + ind(indent) + ']';
} else {
result += '[';
dumpChildren(&result, multiline, indent + 1);
result += ']';
}
break;
}
return result;
}
void GdbMiValue::fromString(const QByteArray &ba)
{
const char *from = ba.constBegin();
const char *to = ba.constEnd();
parseResultOrValue(from, to);
}
void GdbMiValue::fromStringMultiple(const QByteArray &ba)
{
const char *from = ba.constBegin();
const char *to = ba.constEnd();
parseTuple_helper(from, to);
}
GdbMiValue GdbMiValue::findChild(const char *name) const
{
for (int i = 0; i < m_children.size(); ++i)
if (m_children.at(i).m_name == name)
return m_children.at(i);
return GdbMiValue();
}
qulonglong GdbMiValue::toAddress() const
{
QByteArray ba = m_data;
if (ba.endsWith('L'))
ba.chop(1);
if (ba.startsWith('*') || ba.startsWith('@'))
ba = ba.mid(1);
return ba.toULongLong(0, 0);
}
QByteArray GdbResponse::stringFromResultClass(GdbResultClass resultClass)
{
switch (resultClass) {
case GdbResultDone: return "done";
case GdbResultRunning: return "running";
case GdbResultConnected: return "connected";
case GdbResultError: return "error";
case GdbResultExit: return "exit";
default: return "unknown";
}
}
QByteArray GdbResponse::toString() const
{
QByteArray result;
if (token != -1)
result = QByteArray::number(token);
result += '^';
result += stringFromResultClass(resultClass);
if (data.isValid())
result += ',' + data.toString();
result += '\n';
return result;
}
| 11,497
|
C++
|
.cpp
| 374
| 22.294118
| 88
| 0.489049
|
visualfc/liteide
| 7,563
| 970
| 395
|
LGPL-2.1
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| true
| false
| false
| true
| false
| false
|
21,211
|
interface.cpp
|
visualfc_liteide/liteidex/src/3rdparty/qjsonrpc/tests/manual/console/interface.cpp
|
/*
* Copyright (C) 2012-2013 Matt Broadstone
* Contact: http://bitbucket.org/devonit/qjsonrpc
*
* This file is part of the QJsonRpc Library.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*/
#include <QLocalSocket>
#include <QEventLoop>
#include <QTimer>
#include <QScriptContext>
#include "qjsonrpcsocket.h"
#include "qjsonrpcservice.h"
#include "qjsonrpcservicereply.h"
#include "interface.h"
QJsonRpcServiceSocketPrototype::QJsonRpcServiceSocketPrototype(QObject *parent)
: QObject(parent),
m_socket(0)
{
}
QJsonRpcServiceSocketPrototype::~QJsonRpcServiceSocketPrototype()
{
}
void QJsonRpcServiceSocketPrototype::connectToLocalService(const QString &service)
{
if (m_socket) {
context()->throwError("already connected to local service");
return;
}
QLocalSocket *localSocket = new QLocalSocket(this);
localSocket->connectToServer(service);
if (!localSocket->waitForConnected()) {
context()->throwError("could not connect to local sevice: " + service);
localSocket->deleteLater();
return;
}
m_socket = new QJsonRpcSocket(localSocket, this);
}
QVariant QJsonRpcServiceSocketPrototype::invokeRemoteMethod(const QString &method,
const QVariant ¶m1, const QVariant ¶m2, const QVariant ¶m3,
const QVariant ¶m4, const QVariant ¶m5, const QVariant ¶m6,
const QVariant ¶m7, const QVariant ¶m8, const QVariant ¶m9,
const QVariant ¶m10)
{
QVariantList params;
if (param1.isValid()) params.append(param1);
if (param2.isValid()) params.append(param2);
if (param3.isValid()) params.append(param3);
if (param4.isValid()) params.append(param4);
if (param5.isValid()) params.append(param5);
if (param6.isValid()) params.append(param6);
if (param7.isValid()) params.append(param7);
if (param8.isValid()) params.append(param8);
if (param9.isValid()) params.append(param9);
if (param10.isValid()) params.append(param10);
QJsonRpcMessage request =
QJsonRpcMessage::createRequest(method, QJsonArray::fromVariantList(params));
QJsonRpcServiceReply *reply = m_socket->sendMessage(request);
QEventLoop loop;
connect(m_socket, SIGNAL(messageReceived(QJsonRpcMessage)), &loop, SLOT(quit()));
connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
loop.exec();
if (reply->response().type() == QJsonRpcMessage::Invalid) {
context()->throwError("request timed out");
return QVariant();
}
return reply->response().result().toVariant();
}
| 3,253
|
C++
|
.cpp
| 77
| 35.558442
| 128
| 0.68456
|
visualfc/liteide
| 7,563
| 970
| 395
|
LGPL-2.1
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| true
| false
| false
| true
| false
| false
|
21,212
|
qjsonrpc.cpp
|
visualfc_liteide/liteidex/src/3rdparty/qjsonrpc/tests/manual/qjsonrpc/qjsonrpc.cpp
|
/*
* Copyright (C) 2012-2013 Matt Broadstone
* Contact: http://bitbucket.org/devonit/qjsonrpc
*
* This file is part of the QJsonRpc Library.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*/
#include <QCoreApplication>
#include <QStringList>
#include <QLocalSocket>
#include <QTcpSocket>
#include <QScopedPointer>
#include <QUrl>
#include <QHostAddress>
#include "qjsonrpcsocket.h"
#include "qjsonrpcservice.h"
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
QStringList args = app.arguments();
QString appName = args.takeFirst();
bool notification = args.contains("-n");
if (notification)
args.removeAll("-n");
if (args.size() < 2) {
qDebug("usage: %s [-n] <service> <method> <arguments>", appName.toLocal8Bit().data());
return -1;
}
// try to process socket
QIODevice *device = 0;
QScopedPointer<QIODevice> devicePtr(device);
QString service = args.takeFirst();
QUrl serviceUrl = QUrl::fromUserInput(service);
QHostAddress serviceAddress(serviceUrl.host());
if (serviceAddress.isNull()) {
QLocalSocket *localSocket = new QLocalSocket;
device = localSocket;
localSocket->connectToServer(service);
if (!localSocket->waitForConnected(5000)) {
qDebug("could not connect to service: %s", service.toLocal8Bit().data());
return -1;
}
} else {
QTcpSocket *tcpSocket = new QTcpSocket;
device = tcpSocket;
int servicePort = serviceUrl.port() ? serviceUrl.port() : 5555;
tcpSocket->connectToHost(serviceAddress, servicePort);
if (!tcpSocket->waitForConnected(5000)) {
qDebug("could not connect to host at %s:%d", serviceUrl.host().toLocal8Bit().data(),
servicePort);
return -1;
}
}
QJsonRpcSocket socket(device);
QString method = args.takeFirst();
QVariantList arguments;
foreach (QString arg, args)
arguments.append(arg);
QJsonRpcMessage request = notification ?
QJsonRpcMessage::createNotification(method, QJsonArray::fromVariantList(arguments)) :
QJsonRpcMessage::createRequest(method, QJsonArray::fromVariantList(arguments));
qDebug() << request.toJson();
QJsonRpcMessage response = socket.sendMessageBlocking(request, 5000);
if (response.type() == QJsonRpcMessage::Error) {
qDebug("error(%d): %s", response.errorCode(), response.errorMessage().toLocal8Bit().data());
return -1;
}
qDebug() << response.result();
}
| 3,039
|
C++
|
.cpp
| 78
| 33.512821
| 100
| 0.688347
|
visualfc/liteide
| 7,563
| 970
| 395
|
LGPL-2.1
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| true
| false
| false
| true
| false
| false
|
21,213
|
main.cpp
|
visualfc_liteide/liteidex/src/3rdparty/qjsonrpc/tests/manual/httpclient/main.cpp
|
/*
* Copyright (C) 2012-2013 Matt Broadstone
* Contact: http://bitbucket.org/devonit/qjsonrpc
*
* This file is part of the QJsonRpc Library.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*/
#include <QCoreApplication>
#include <QAuthenticator>
#include <QStringList>
#include <QDebug>
#include "qjsonrpchttpclient.h"
class HttpClient : public QJsonRpcHttpClient
{
Q_OBJECT
public:
HttpClient(const QString &endpoint, QObject *parent = 0)
: QJsonRpcHttpClient(endpoint, parent)
{
// defaults added for my local test server
m_username = "bitcoinrpc";
m_password = "232fb3276bbb7437d265298ea48bdc46";
}
void setUsername(const QString &username) {
m_username = username;
}
void setPassword(const QString &password) {
m_password = password;
}
private Q_SLOTS:
virtual void handleAuthenticationRequired(QNetworkReply *reply, QAuthenticator * authenticator)
{
Q_UNUSED(reply)
authenticator->setUser(m_username);
authenticator->setPassword(m_password);
}
private:
QString m_username;
QString m_password;
};
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
if (app.arguments().size() < 2) {
qDebug() << "usage: " << argv[0] << "[-u username] [-p password] <command> <arguments>";
return -1;
}
HttpClient client("http://127.0.0.1:8332");
if (app.arguments().contains("-u")) {
int idx = app.arguments().indexOf("-u");
app.arguments().removeAt(idx);
client.setUsername(app.arguments().takeAt(idx));
}
if (app.arguments().contains("-p")) {
int idx = app.arguments().indexOf("-p");
app.arguments().removeAt(idx);
client.setPassword(app.arguments().takeAt(idx));
}
QJsonRpcMessage message = QJsonRpcMessage::createRequest(app.arguments().at(1));
QJsonRpcMessage response = client.sendMessageBlocking(message);
if (response.type() == QJsonRpcMessage::Error) {
qDebug() << response.errorData();
return -1;
}
qDebug() << response.toJson();
}
#include "main.moc"
| 2,611
|
C++
|
.cpp
| 76
| 29.618421
| 99
| 0.685567
|
visualfc/liteide
| 7,563
| 970
| 395
|
LGPL-2.1
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| true
| false
| false
| true
| false
| false
|
21,214
|
testservice.cpp
|
visualfc_liteide/liteidex/src/3rdparty/qjsonrpc/tests/manual/httpserver/testservice.cpp
|
/*
* Copyright (C) 2012-2013 Matt Broadstone
* Contact: http://bitbucket.org/devonit/qjsonrpc
*
* This file is part of the QJsonRpc Library.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*/
#include <QDebug>
#include <QTimer>
#include <QEventLoop>
#include <QThreadPool>
#include <QRunnable>
#include "testservice.h"
TestService::TestService(QObject *parent)
: QJsonRpcService(parent)
{
QThreadPool::globalInstance()->setMaxThreadCount(10);
}
void TestService::testMethod()
{
qDebug() << Q_FUNC_INFO << "called" << endl;
}
void TestService::testMethodWithParams(const QString &first, bool second, double third)
{
qDebug() << Q_FUNC_INFO << "called with parameters: " << endl
<< " first: " << first << endl
<< "second: " << second << endl
<< " third: " << third << endl;
}
void TestService::testMethodWithVariantParams(const QString &first, bool second, double third, const QVariant &fourth)
{
qDebug() << Q_FUNC_INFO << "called with variant parameters: " << endl
<< " first: " << first << endl
<< "second: " << second << endl
<< " third: " << third << endl
<< "fourth: " << fourth << endl;
}
QString TestService::testMethodWithParamsAndReturnValue(const QString &name)
{
return QString("Hello %1").arg(name);
}
void TestService::testMethodWithDefaultParameter(const QString &first, const QString &second)
{
qDebug() << Q_FUNC_INFO << endl
<< "first: " << first << endl
<< (second.isEmpty() ? "not defined, default parameter" : second) << endl;
}
QString TestService::immediateResponse()
{
return "immediate";
}
QString TestService::longTaskWithImmediateResponse()
{
QEventLoop loop;
QTimer::singleShot(1000, &loop, SLOT(quit()));
loop.exec();
return "long immediate";
}
class DelayedResponseJob : public QRunnable
{
public:
DelayedResponseJob(const QJsonRpcServiceRequest &request)
: m_request(request)
{
}
protected:
virtual void run() {
// do some work
QEventLoop loop;
QTimer::singleShot(1000, &loop, SLOT(quit()));
loop.exec();
// respond
QJsonRpcMessage response = m_request.request().createResponse(QLatin1String("long delayed"));
m_request.respond(response);
}
private:
QJsonRpcServiceRequest m_request;
};
QString TestService::longTaskWithDelayedResponse()
{
beginDelayedResponse();
QThreadPool::globalInstance()->start(new DelayedResponseJob(currentRequest()));
return QString();
}
| 3,050
|
C++
|
.cpp
| 93
| 28.623656
| 118
| 0.685588
|
visualfc/liteide
| 7,563
| 970
| 395
|
LGPL-2.1
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| true
| false
| false
| true
| false
| false
|
21,215
|
httpserver.cpp
|
visualfc_liteide/liteidex/src/3rdparty/qjsonrpc/tests/manual/httpserver/httpserver.cpp
|
/*
* Copyright (C) 2012-2013 Matt Broadstone
* Contact: http://bitbucket.org/devonit/qjsonrpc
*
* This file is part of the QJsonRpc Library.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*/
#include <QCoreApplication>
#include "qjsonrpchttpserver.h"
#include "testservice.h"
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
QJsonRpcHttpServer rpcServer;
rpcServer.addService(new TestService);
if (!rpcServer.listen(QHostAddress::LocalHost, 5555)) {
qDebug() << "can't start tcp server: " << rpcServer.errorString();
return -1;
}
return app.exec();
}
| 1,091
|
C++
|
.cpp
| 30
| 33.433333
| 74
| 0.740076
|
visualfc/liteide
| 7,563
| 970
| 395
|
LGPL-2.1
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| true
| false
| false
| true
| false
| false
|
21,217
|
localclient.cpp
|
visualfc_liteide/liteidex/src/3rdparty/qjsonrpc/tests/manual/localclient/localclient.cpp
|
/*
* Copyright (C) 2012-2013 Matt Broadstone
* Contact: http://bitbucket.org/devonit/qjsonrpc
*
* This file is part of the QJsonRpc Library.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*/
#include <QLocalSocket>
#include <QDir>
#include "qjsonrpcsocket.h"
#include "qjsonrpcservice.h"
#include "qjsonrpcservicereply.h"
#include "localclient.h"
LocalClient::LocalClient(QObject *parent)
: QObject(parent),
m_client(0)
{
}
void LocalClient::run()
{
QLocalSocket *socket = new QLocalSocket(this);
QString serviceName = QDir::temp().absoluteFilePath("testservice");
socket->connectToServer(serviceName);
if (!socket->waitForConnected()) {
qDebug() << "could not connect to server: " << socket->errorString();
return;
}
m_client = new QJsonRpcSocket(socket, this);
QJsonRpcServiceReply *reply = m_client->invokeRemoteMethod("agent.testMethod");
connect(reply, SIGNAL(finished()), this, SLOT(processResponse()));
reply = m_client->invokeRemoteMethod("agent.testMethodWithParams", "one", false, 10);
connect(reply, SIGNAL(finished()), this, SLOT(processResponse()));
reply = m_client->invokeRemoteMethod("agent.testMethodWithVariantParams", "one", false, 10, QVariant(2.5));
connect(reply, SIGNAL(finished()), this, SLOT(processResponse()));
reply = m_client->invokeRemoteMethod("agent.testMethodWithParamsAndReturnValue", "matt");
connect(reply, SIGNAL(finished()), this, SLOT(processResponse()));
}
void LocalClient::processResponse()
{
QJsonRpcServiceReply *reply = static_cast<QJsonRpcServiceReply *>(sender());
if (!reply) {
qDebug() << "invalid response received";
return;
}
qDebug() << "response received: " << reply->response();
}
| 2,236
|
C++
|
.cpp
| 55
| 37.145455
| 111
| 0.726059
|
visualfc/liteide
| 7,563
| 970
| 395
|
LGPL-2.1
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| true
| false
| false
| true
| false
| false
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.