diff options
Diffstat (limited to 'implementation/protocol/include')
42 files changed, 1622 insertions, 0 deletions
diff --git a/implementation/protocol/include/assign_client_ack_command.hpp b/implementation/protocol/include/assign_client_ack_command.hpp new file mode 100644 index 0000000..ec11268 --- /dev/null +++ b/implementation/protocol/include/assign_client_ack_command.hpp @@ -0,0 +1,33 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_ASSIGN_CLIENT_ACK_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_ASSIGN_CLIENT_ACK_COMMAND_HPP_ + +#include "command.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class assign_client_ack_command + : public command { +public: + assign_client_ack_command(); + + void serialize(std::vector<byte_t> &_buffer, error_e &_error) const; + void deserialize(const std::vector<byte_t> &_buffer, error_e &_error); + + // specific + client_t get_assigned() const; + void set_assigned(client_t _assigned); + +private: + client_t assigned_; +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_ASSIGN_CLIENT_ACK_COMMAND_HPP_ diff --git a/implementation/protocol/include/assign_client_command.hpp b/implementation/protocol/include/assign_client_command.hpp new file mode 100644 index 0000000..b1932da --- /dev/null +++ b/implementation/protocol/include/assign_client_command.hpp @@ -0,0 +1,38 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_ASSIGN_CLIENT_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_ASSIGN_CLIENT_COMMAND_HPP_ + +#include <string> + +#include "command.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class assign_client_command + : public command { +public: + assign_client_command(); + + // command + id_e get_id() const; + + void serialize(std::vector<byte_t> &_buffer, error_e &_error) const; + void deserialize(const std::vector<byte_t> &_buffer, error_e &_error); + + // specific + std::string get_name() const; + void set_name(const std::string &_name); + +private: + std::string name_; +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_ASSIGN_CLIENT_COMMAND_HPP_ diff --git a/implementation/protocol/include/command.hpp b/implementation/protocol/include/command.hpp new file mode 100644 index 0000000..a39990a --- /dev/null +++ b/implementation/protocol/include/command.hpp @@ -0,0 +1,46 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_COMMAND_HPP_ + +#include <cstring> // memcpy +#include <vector> + +#include <vsomeip/primitive_types.hpp> + +#include "protocol.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +using commandize_t = std::uint32_t; + +class command { +public: + inline id_e get_id() const { return id_; } + inline version_t get_version() const { return version_; } + inline client_t get_client() const { return client_; } + inline void set_client(client_t _client) { client_ = _client; } + inline command_size_t get_size() const { return size_; } + + virtual void serialize(std::vector<byte_t> &_buffer, + error_e &_error) const; + virtual void deserialize(const std::vector<byte_t> &_buffer, + error_e &_error); + +protected: + id_e id_; + version_t version_; + client_t client_; + mutable command_size_t size_; + + command(id_e _id); +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_COMMAND_HPP_ diff --git a/implementation/protocol/include/deregister_application_command.hpp b/implementation/protocol/include/deregister_application_command.hpp new file mode 100644 index 0000000..9b1bcb8 --- /dev/null +++ b/implementation/protocol/include/deregister_application_command.hpp @@ -0,0 +1,24 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_DEREGISTER_APPLICATION_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_DEREGISTER_APPLICATION_COMMAND_HPP_ + +#include "simple_command.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class deregister_application_command + : public simple_command { + +public: + deregister_application_command(); +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_DEREGISTER_APPLICATION_COMMAND_HPP_ diff --git a/implementation/protocol/include/distribute_security_policies_command.hpp b/implementation/protocol/include/distribute_security_policies_command.hpp new file mode 100644 index 0000000..2b2c673 --- /dev/null +++ b/implementation/protocol/include/distribute_security_policies_command.hpp @@ -0,0 +1,44 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_DISTRIBUTE_SECURITY_POLICIES_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_DISTRIBUTE_SECURITY_POLICIES_COMMAND_HPP_ + +#include <map> +#include <memory> +#include <set> +#include <vector> + +#include "command.hpp" + +namespace vsomeip_v3 { + +class payload; +struct policy; + +namespace protocol { + +class distribute_security_policies_command + : public command { +public: + distribute_security_policies_command(); + + void serialize(std::vector<byte_t> &_buffer, error_e &_error) const; + void deserialize(const std::vector<byte_t> &_buffer, error_e &_error); + + // specific + std::set<std::shared_ptr<policy> > get_policies() const; + + void set_payloads(const std::map<uint32_t, std::shared_ptr<payload> > &_payloads); + +private: + std::set<std::shared_ptr<policy> > policies_; + std::vector<byte_t> payload_; +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_DISTRIBUTE_SECURITY_POLICIES_COMMAND_HPP_ diff --git a/implementation/protocol/include/dummy_command.hpp b/implementation/protocol/include/dummy_command.hpp new file mode 100644 index 0000000..70f4f6c --- /dev/null +++ b/implementation/protocol/include/dummy_command.hpp @@ -0,0 +1,28 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_DUMMY_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_DUMMY_COMMAND_HPP_ + +#include "command.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class dummy_command + : public command { +public: + dummy_command(); + + void serialize(std::vector<byte_t> &_buffer, + error_e &_error) const; + void deserialize(const std::vector<byte_t> &_buffer, + error_e &_error); +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_DUMMY_COMMAND_HPP_ diff --git a/implementation/protocol/include/expire_command.hpp b/implementation/protocol/include/expire_command.hpp new file mode 100644 index 0000000..4c47aa9 --- /dev/null +++ b/implementation/protocol/include/expire_command.hpp @@ -0,0 +1,33 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_EXPIRE_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_EXPIRE_COMMAND_HPP_ + +#include <memory> + +#include <vsomeip/structured_types.hpp> + +#include "subscribe_command_base.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class expire_command + : public subscribe_command_base { + +public: + expire_command(); + + void serialize(std::vector<byte_t> &_buffer, + error_e &_error) const; + void deserialize(const std::vector<byte_t> &_buffer, + error_e &_error); +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_EXPIRE_COMMAND_HPP_ diff --git a/implementation/protocol/include/multiple_services_command_base.hpp b/implementation/protocol/include/multiple_services_command_base.hpp new file mode 100644 index 0000000..d679b16 --- /dev/null +++ b/implementation/protocol/include/multiple_services_command_base.hpp @@ -0,0 +1,37 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_MULTIPLE_SERVICES_COMMAND_BASE_HPP_ +#define VSOMEIP_V3_PROTOCOL_MULTIPLE_SERVICES_COMMAND_BASE_HPP_ + +#include <set> + +#include "command.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class multiple_services_command_base + : public command { +public: + multiple_services_command_base(id_e _id); + + // command + void serialize(std::vector<byte_t> &_buffer, error_e &_error) const; + void deserialize(const std::vector<byte_t> &_buffer, error_e &_error); + + // specific + std::set<service> get_services() const; + void set_services(const std::set<service> &_services); + void add_service(const service &_service); + +private: + std::set<service> services_; +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_MULTIPLE_SERVICES_COMMAND_BASE_HPP_ diff --git a/implementation/protocol/include/offer_service_command.hpp b/implementation/protocol/include/offer_service_command.hpp new file mode 100644 index 0000000..22e5f36 --- /dev/null +++ b/implementation/protocol/include/offer_service_command.hpp @@ -0,0 +1,24 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_OFFER_SERVICE_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_OFFER_SERVICE_COMMAND_HPP_ + +#include "service_command_base.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class offer_service_command + : public service_command_base { + +public: + offer_service_command(); +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_OFFER_SERVICE_COMMAND_HPP_ diff --git a/implementation/protocol/include/offered_services_request_command.hpp b/implementation/protocol/include/offered_services_request_command.hpp new file mode 100644 index 0000000..3ced949 --- /dev/null +++ b/implementation/protocol/include/offered_services_request_command.hpp @@ -0,0 +1,33 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_OFFERED_SERVICES_REQUEST_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_OFFERED_SERVICES_REQUEST_COMMAND_HPP_ + +#include "command.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class offered_services_request_command + : public command { + +public: + offered_services_request_command(); + + void serialize(std::vector<byte_t> &_buffer, error_e &_error) const; + void deserialize(const std::vector<byte_t> &_buffer, error_e &_error); + + offer_type_e get_offer_type() const; + void set_offer_type(offer_type_e _offer_type); + +private: + offer_type_e offer_type_; +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_OFFERED_SERVICES_REQUEST_COMMAND_HPP_ diff --git a/implementation/protocol/include/offered_services_response_command.hpp b/implementation/protocol/include/offered_services_response_command.hpp new file mode 100644 index 0000000..79a8f2c --- /dev/null +++ b/implementation/protocol/include/offered_services_response_command.hpp @@ -0,0 +1,23 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_OFFERED_SERVICES_RESPONSE_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_OFFERED_SERVICES_RESPONSE_COMMAND_HPP_ + +#include "multiple_services_command_base.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class offered_services_response_command + : public multiple_services_command_base { +public: + offered_services_response_command(); +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_OFFERED_SERVICES_RESPONSE_COMMAND_HPP_ diff --git a/implementation/protocol/include/ping_command.hpp b/implementation/protocol/include/ping_command.hpp new file mode 100644 index 0000000..369e255 --- /dev/null +++ b/implementation/protocol/include/ping_command.hpp @@ -0,0 +1,24 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_PING_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_PING_COMMAND_HPP_ + +#include "simple_command.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class ping_command + : public simple_command { + +public: + ping_command(); +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_PING_COMMAND_HPP_ diff --git a/implementation/protocol/include/pong_command.hpp b/implementation/protocol/include/pong_command.hpp new file mode 100644 index 0000000..1876f0d --- /dev/null +++ b/implementation/protocol/include/pong_command.hpp @@ -0,0 +1,24 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_PONG_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_PONG_COMMAND_HPP_ + +#include "simple_command.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class pong_command + : public simple_command { + +public: + pong_command(); +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_PONG_COMMAND_HPP_ diff --git a/implementation/protocol/include/protocol.hpp b/implementation/protocol/include/protocol.hpp new file mode 100644 index 0000000..08a770b --- /dev/null +++ b/implementation/protocol/include/protocol.hpp @@ -0,0 +1,142 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_PROTOCOL_HPP_ +#define VSOMEIP_V3_PROTOCOL_PROTOCOL_HPP_ + +#include <vsomeip/constants.hpp> +#include <vsomeip/primitive_types.hpp> + +namespace vsomeip_v3 { +namespace protocol { + +using version_t = std::uint16_t; +using command_size_t = std::uint32_t; + +enum class id_e : uint8_t { + ASSIGN_CLIENT_ID = 0x00, + ASSIGN_CLIENT_ACK_ID = 0x01, + REGISTER_APPLICATION_ID = 0x02, + DEREGISTER_APPLICATION_ID = 0x03, + // APPLICATION_LOST_ID = 0x04, + ROUTING_INFO_ID = 0x05, + REGISTERED_ACK_ID = 0x06, + PING_ID = 0x07, + PONG_ID = 0x08, + OFFER_SERVICE_ID = 0x10, + STOP_OFFER_SERVICE_ID = 0x11, + SUBSCRIBE_ID = 0x12, + UNSUBSCRIBE_ID = 0x13, + REQUEST_SERVICE_ID = 0x14, + RELEASE_SERVICE_ID = 0x15, + SUBSCRIBE_NACK_ID = 0x16, + SUBSCRIBE_ACK_ID = 0x17, + SEND_ID = 0x18, + NOTIFY_ID = 0x19, + NOTIFY_ONE_ID = 0x1A, + REGISTER_EVENT_ID = 0x1B, + UNREGISTER_EVENT_ID = 0x1C, + ID_RESPONSE_ID = 0x1D, + ID_REQUEST_ID = 0x1E, + OFFERED_SERVICES_REQUEST_ID = 0x1F, + OFFERED_SERVICES_RESPONSE_ID = 0x20, + UNSUBSCRIBE_ACK_ID = 0x21, + RESEND_PROVIDED_EVENTS_ID = 0x22, + UPDATE_SECURITY_POLICY_ID = 0x23, + UPDATE_SECURITY_POLICY_RESPONSE_ID = 0x24, + REMOVE_SECURITY_POLICY_ID = 0x25, + REMOVE_SECURITY_POLICY_RESPONSE_ID = 0x26, + UPDATE_SECURITY_CREDENTIALS_ID = 0x27, + DISTRIBUTE_SECURITY_POLICIES_ID = 0x28, + UPDATE_SECURITY_POLICY_INT_ID = 0x29, + EXPIRE_ID = 0x2A, + SUSPEND_ID = 0x30, + UNKNOWN_ID = 0xFF +}; + +enum class error_e : uint8_t { + ERROR_OK = 0x00, + ERROR_NOT_ENOUGH_BYTES = 0x01, + ERROR_MAX_COMMAND_SIZE_EXCEEDED = 0x02, + ERROR_MISMATCH = 0x04, + ERROR_MALFORMED = 0x08, + ERROR_NOT_ALLOWED = 0x10, + ERROR_UNKNOWN = 0xff +}; + +enum class routing_info_entry_type_e : std::uint8_t { + RIE_ADD_CLIENT = 0x00, + RIE_DELETE_CLIENT = 0x01, + RIE_ADD_SERVICE_INSTANCE = 0x02, + RIE_DELETE_SERVICE_INSTANCE = 0x04, + RIE_UNKNOWN = 0xff +}; + +using pending_id_t = std::uint16_t; + +struct service { + service_t service_; + instance_t instance_; + major_version_t major_; + minor_version_t minor_; + + service() + : service_(ANY_SERVICE), + instance_(ANY_INSTANCE), + major_(ANY_MAJOR), + minor_(ANY_MINOR) { + } + + service(service_t _service, instance_t _instance, + major_version_t _major, minor_version_t _minor) + : service_(_service), + instance_(_instance), + major_(_major), + minor_(_minor) { + } + + bool operator<(const service &_other) const { + + return (service_ < _other.service_ + || (service_ == _other.service_ + && instance_ < _other.instance_)); + } +}; + +static const version_t MAX_SUPPORTED_VERSION = 0; + +static const size_t TAG_SIZE = 4; +static const size_t COMMAND_HEADER_SIZE = 9; +static const size_t SEND_COMMAND_HEADER_SIZE = 15; +static const size_t ROUTING_INFO_ENTRY_HEADER_SIZE = 7; + +static const size_t COMMAND_POSITION_ID = 0; +static const size_t COMMAND_POSITION_VERSION = 1; +static const size_t COMMAND_POSITION_CLIENT = 3; +static const size_t COMMAND_POSITION_SIZE = 5; +static const size_t COMMAND_POSITION_PAYLOAD = 9; + +static inline id_e get_command(byte_t _byte) { + + id_e its_id(id_e::UNKNOWN_ID); + if (_byte <= static_cast<byte_t>(id_e::SUSPEND_ID)) + its_id = static_cast<id_e>(_byte); + return (its_id); +} + +static inline bool operator==(const byte_t &_lhs, const id_e &_rhs) { + + return (_lhs == static_cast<byte_t>(_rhs)); +} + +static inline bool operator==(const id_e &_lhs, const byte_t &_rhs) { + + return (_rhs == _lhs); +} + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_PROTOCOL_HPP_ diff --git a/implementation/protocol/include/register_application_command.hpp b/implementation/protocol/include/register_application_command.hpp new file mode 100644 index 0000000..ffb15ad --- /dev/null +++ b/implementation/protocol/include/register_application_command.hpp @@ -0,0 +1,33 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_REGISTER_APPLICATION_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_REGISTER_APPLICATION_COMMAND_HPP_ + +#include "command.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class register_application_command + : public command { + +public: + register_application_command(); + + void serialize(std::vector<byte_t> &_buffer, error_e &_error) const; + void deserialize(const std::vector<byte_t> &_buffer, error_e &_error); + + port_t get_port() const; + void set_port(port_t _port); + +private: + port_t port_; +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_REGISTER_APPLICATION_COMMAND_HPP_ diff --git a/implementation/protocol/include/register_event.hpp b/implementation/protocol/include/register_event.hpp new file mode 100644 index 0000000..f468c02 --- /dev/null +++ b/implementation/protocol/include/register_event.hpp @@ -0,0 +1,67 @@ +#ifndef VSOMEIP_V3_PROTOCOL_REGISTER_EVENT_HPP_ +#define VSOMEIP_V3_PROTOCOL_REGISTER_EVENT_HPP_ + +#include <set> +#include <vector> +#include <vsomeip/constants.hpp> +#include <cstring> + +#include "protocol.hpp" +#include <vsomeip/enumeration_types.hpp> +#include <vsomeip/primitive_types.hpp> + +namespace vsomeip_v3 { +namespace protocol { + +class register_event { +public: + register_event(service_t service = ANY_SERVICE, instance_t instance = ANY_INSTANCE, + event_t event = ANY_EVENT, event_type_e event_type = event_type_e::ET_UNKNOWN, + bool is_provided = false, reliability_type_e reliability = reliability_type_e::RT_UNKNOWN, + bool is_cyclic = false, uint16_t num_eventg = 0, + const std::set<eventgroup_t> &eventgroups = std::set<eventgroup_t>()); + void serialize(std::vector<byte_t> &_buffer, size_t &_offset) const; + void deserialize(const std::vector<byte_t> &_buffer, size_t &_offset); + + service_t get_service() const { return service_; } + void set_service(service_t _service) { service_ = _service; } + + instance_t get_instance() const { return instance_; } + void set_instance(instance_t _instance) { instance_ = _instance; } + + event_t get_event() const { return event_; } + void set_event(event_t _event) { event_ = _event; } + + event_type_e get_event_type() const { return event_type_; } + void set_event_type(event_type_e _event_type) { event_type_ = _event_type; } + + bool is_provided() const { return is_provided_; } + void set_provided(bool _is_provided) { is_provided_ = _is_provided; } + + reliability_type_e get_reliability() const { return reliability_; } + void set_reliability(reliability_type_e _reliability) { reliability_ = _reliability; } + + bool is_cyclic() const { return is_cyclic_; } + void set_cyclic(bool _cyclic) { is_cyclic_ = _cyclic; } + + uint16_t get_num_eventgroups() const { return num_eventg_; } + + std::set<eventgroup_t> get_eventgroups() const { return eventgroups_; } + void set_eventgroups(const std::set<eventgroup_t> &_eventgroups); + +private: + service_t service_; + instance_t instance_; + event_t event_; + event_type_e event_type_; + bool is_provided_; + reliability_type_e reliability_; + bool is_cyclic_; + uint16_t num_eventg_; + std::set<eventgroup_t> eventgroups_; +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_REGISTER_EVENT_HPP_ diff --git a/implementation/protocol/include/register_events_command.hpp b/implementation/protocol/include/register_events_command.hpp new file mode 100644 index 0000000..23dd7fa --- /dev/null +++ b/implementation/protocol/include/register_events_command.hpp @@ -0,0 +1,40 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_REGISTER_EVENTS_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_REGISTER_EVENTS_COMMAND_HPP_ + +#include <set> + +#include <vsomeip/enumeration_types.hpp> + +#include "command.hpp" +#include "register_event.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class register_events_command + : public command { +public: + + register_events_command(); + + void serialize(std::vector<byte_t> &_buffer, error_e &_error) const; + void deserialize(const std::vector<byte_t> &_buffer, error_e &_error); + + std::size_t get_num_registrations() const; + + bool add_registration(const register_event &_register_event); + bool get_registration_at(std::size_t _position, register_event & _reg) const; + +private: + std::vector<register_event> registrations_; +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_REGISTER_EVENTS_COMMAND_HPP_ diff --git a/implementation/protocol/include/registered_ack_command.hpp b/implementation/protocol/include/registered_ack_command.hpp new file mode 100644 index 0000000..0ae85ba --- /dev/null +++ b/implementation/protocol/include/registered_ack_command.hpp @@ -0,0 +1,24 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_REGISTERED_ACK_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_REGISTERED_ACK_COMMAND_HPP_ + +#include "simple_command.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class registered_ack_command + : public simple_command { + +public: + registered_ack_command(); +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_REGISTERED_ACK_COMMAND_HPP_ diff --git a/implementation/protocol/include/release_service_command.hpp b/implementation/protocol/include/release_service_command.hpp new file mode 100644 index 0000000..537fd14 --- /dev/null +++ b/implementation/protocol/include/release_service_command.hpp @@ -0,0 +1,39 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_RELEASE_SERVICE_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_RELEASE_SERVICE_COMMAND_HPP_ + +#include <set> + +#include "command.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class release_service_command + : public command { +public: + release_service_command(); + + // command + void serialize(std::vector<byte_t> &_buffer, error_e &_error) const; + void deserialize(const std::vector<byte_t> &_buffer, error_e &_error); + + // specific + service_t get_service() const; + void set_service(service_t _service); + + instance_t get_instance() const; + void set_instance(instance_t _instance); + +private: + service service_; +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_RELEASE_SERVICE_COMMAND_HPP_ diff --git a/implementation/protocol/include/remove_security_policy_command.hpp b/implementation/protocol/include/remove_security_policy_command.hpp new file mode 100644 index 0000000..83480e4 --- /dev/null +++ b/implementation/protocol/include/remove_security_policy_command.hpp @@ -0,0 +1,41 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_REMOVE_SECURITY_POLICY_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_REMOVE_SECURITY_POLICY_COMMAND_HPP_ + +#include "command.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class remove_security_policy_command + : public command { +public: + remove_security_policy_command(); + + void serialize(std::vector<byte_t> &_buffer, error_e &_error) const; + void deserialize(const std::vector<byte_t> &_buffer, error_e &_error); + + // specific + uint32_t get_update_id() const; + void set_update_id(uint32_t _update_id); + + uid_t get_uid() const; + void set_uid(uid_t _uid); + + gid_t get_gid() const; + void set_gid(gid_t _gid); + +private: + uint32_t update_id_; + uid_t uid_; + gid_t gid_; +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_REMOVE_SECURITY_POLICY_COMMAND_HPP_ diff --git a/implementation/protocol/include/remove_security_policy_response_command.hpp b/implementation/protocol/include/remove_security_policy_response_command.hpp new file mode 100644 index 0000000..7deda2c --- /dev/null +++ b/implementation/protocol/include/remove_security_policy_response_command.hpp @@ -0,0 +1,24 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_REMOVE_SECURITY_POLICY_RESPONSE_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_REMOVE_SECURITY_POLICY_RESPONSE_COMMAND_HPP_ + +#include "security_policy_response_command_base.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class remove_security_policy_response_command + : public security_policy_response_command_base { + +public: + remove_security_policy_response_command(); +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_REMOVE_SECURITY_POLICY_RESPONSE_COMMAND_HPP_ diff --git a/implementation/protocol/include/request_service_command.hpp b/implementation/protocol/include/request_service_command.hpp new file mode 100644 index 0000000..945247e --- /dev/null +++ b/implementation/protocol/include/request_service_command.hpp @@ -0,0 +1,23 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_REQUEST_SERVICE_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_REQUEST_SERVICE_COMMAND_HPP_ + +#include "multiple_services_command_base.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class request_service_command + : public multiple_services_command_base { +public: + request_service_command(); +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_REQUEST_SERVICE_COMMAND_HPP_ diff --git a/implementation/protocol/include/resend_provided_events_command.hpp b/implementation/protocol/include/resend_provided_events_command.hpp new file mode 100644 index 0000000..1fc493c --- /dev/null +++ b/implementation/protocol/include/resend_provided_events_command.hpp @@ -0,0 +1,33 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_RESEND_PROVIDED_EVENTS_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_RESEND_PROVIDED_EVENTS_COMMAND_HPP_ + +#include "command.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class resend_provided_events_command + : public command { +public: + resend_provided_events_command(); + + void serialize(std::vector<byte_t> &_buffer, error_e &_error) const; + void deserialize(const std::vector<byte_t> &_buffer, error_e &_error); + + // specific + pending_remote_offer_id_t get_remote_offer_id() const; + void set_remote_offer_id(pending_remote_offer_id_t _remote_offer_id); + +private: + pending_remote_offer_id_t remote_offer_id_; +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_RESEND_PROVIDED_EVENTS_COMMAND_HPP_ diff --git a/implementation/protocol/include/routing_info_command.hpp b/implementation/protocol/include/routing_info_command.hpp new file mode 100644 index 0000000..2cb0ab7 --- /dev/null +++ b/implementation/protocol/include/routing_info_command.hpp @@ -0,0 +1,36 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_ROUTING_INFO_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_ROUTING_INFO_COMMAND_HPP_ + +#include "command.hpp" +#include "routing_info_entry.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class routing_info_command + : public command { +public: + routing_info_command(); + + // command + void serialize(std::vector<byte_t> &_buffer, error_e &_error) const; + void deserialize(const std::vector<byte_t> &_buffer, error_e &_error); + + // specific + const std::vector<routing_info_entry> &get_entries() const; + void set_entries(std::vector<routing_info_entry> &&_entries); + void add_entry(const routing_info_entry &_entry); + +private: + std::vector<routing_info_entry> entries_; +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_ROUTING_INFO_COMMAND_HPP_ diff --git a/implementation/protocol/include/routing_info_entry.hpp b/implementation/protocol/include/routing_info_entry.hpp new file mode 100644 index 0000000..b27190b --- /dev/null +++ b/implementation/protocol/include/routing_info_entry.hpp @@ -0,0 +1,59 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_ROUTING_INFO_ENTRY_HPP_ +#define VSOMEIP_V3_PROTOCOL_ROUTING_INFO_ENTRY_HPP_ + +#include <vector> + +#include <boost/asio/ip/address.hpp> + +#include "protocol.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class routing_info_entry { +public: + routing_info_entry(); + routing_info_entry(const routing_info_entry &_source); + + void serialize(std::vector<byte_t> &_buffer, size_t &_index, + error_e &_error) const; + void deserialize(const std::vector<byte_t> &_buffer, size_t &_index, + error_e &_error); + + routing_info_entry_type_e get_type() const; + void set_type(routing_info_entry_type_e _type); + + size_t get_size() const; + + client_t get_client() const; + void set_client(client_t _client); + + boost::asio::ip::address get_address() const; + void set_address(const boost::asio::ip::address &_address); + + port_t get_port() const; + void set_port(port_t _port); + + const std::vector<service> &get_services() const; + void add_service(const service &_service); + +private: + routing_info_entry_type_e type_; + + client_t client_; + + boost::asio::ip::address address_; + port_t port_; + + std::vector<service> services_; +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_ROUTING_INFO_ENTRY_HPP_ diff --git a/implementation/protocol/include/security_policy_response_command_base.hpp b/implementation/protocol/include/security_policy_response_command_base.hpp new file mode 100644 index 0000000..799f703 --- /dev/null +++ b/implementation/protocol/include/security_policy_response_command_base.hpp @@ -0,0 +1,38 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_SECURITY_POLICY_RESPONSE_COMMAND_BASE_HPP_ +#define VSOMEIP_V3_PROTOCOL_SECURITY_POLICY_RESPONSE_COMMAND_BASE_HPP_ + +#include <memory> + +#include "command.hpp" + +namespace vsomeip_v3 { + +struct policy; + +namespace protocol { + +class security_policy_response_command_base + : public command { +public: + security_policy_response_command_base(id_e _id); + + void serialize(std::vector<byte_t> &_buffer, error_e &_error) const; + void deserialize(const std::vector<byte_t> &_buffer, error_e &_error); + + // specific + uint32_t get_update_id() const; + void set_update_id(uint32_t _update_id); + +private: + uint32_t update_id_; +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_SECURITY_POLICY_RESPONSE_COMMAND_BASE_HPP_ diff --git a/implementation/protocol/include/send_command.hpp b/implementation/protocol/include/send_command.hpp new file mode 100644 index 0000000..cb10b45 --- /dev/null +++ b/implementation/protocol/include/send_command.hpp @@ -0,0 +1,52 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_SEND_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_SEND_COMMAND_HPP_ + +#include "command.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class send_command + : public command { +public: + send_command(id_e _id); + + void serialize(std::vector<byte_t> &_buffer, + error_e &_error) const; + void deserialize(const std::vector<byte_t> &_buffer, + error_e &_error); + + instance_t get_instance() const; + void set_instance(instance_t _instance); + + bool is_reliable() const; + void set_reliable(bool _is_reliable); + + uint8_t get_status() const; + void set_status(uint8_t _status); + + client_t get_target() const; + void set_target(client_t _target); + + // TODO: Optimize this as the vector might be huge! + std::vector<byte_t> get_message() const; + void set_message(const std::vector<byte_t> &_message); + +private: + + instance_t instance_; + bool is_reliable_; + uint8_t status_; // TODO: DO WE REALLY NEED THIS? + client_t target_; + std::vector<byte_t> message_; +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_BASIC_COMMAND_HPP_ diff --git a/implementation/protocol/include/service_command_base.hpp b/implementation/protocol/include/service_command_base.hpp new file mode 100644 index 0000000..05b488d --- /dev/null +++ b/implementation/protocol/include/service_command_base.hpp @@ -0,0 +1,45 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_SERVICE_COMMAND_BASE_HPP_ +#define VSOMEIP_V3_PROTOCOL_SERVICE_COMMAND_BASE_HPP_ + +#include "command.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class service_command_base + : public command { + +public: + service_t get_service() const; + void set_service(service_t _service); + + instance_t get_instance() const; + void set_instance(instance_t _instance); + + major_version_t get_major() const; + void set_major(major_version_t _major); + + minor_version_t get_minor() const; + void set_minor(minor_version_t _minor); + + void serialize(std::vector<byte_t> &_buffer, + error_e &_error) const; + void deserialize(const std::vector<byte_t> &_buffer, + error_e &_error); + +protected: + service_command_base(id_e _id); + +private: + service service_; +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_SERVICE_COMMAND_BASE_HPP_ diff --git a/implementation/protocol/include/simple_command.hpp b/implementation/protocol/include/simple_command.hpp new file mode 100644 index 0000000..09ae8fd --- /dev/null +++ b/implementation/protocol/include/simple_command.hpp @@ -0,0 +1,30 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_SIMPLE_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_SIMPLE_COMMAND_HPP_ + +#include "command.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class simple_command + : public command { +public: + + void serialize(std::vector<byte_t> &_buffer, + error_e &_error) const; + void deserialize(const std::vector<byte_t> &_buffer, + error_e &_error); + +protected: + simple_command(id_e _id); +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_SIMPLE_COMMAND_HPP_ diff --git a/implementation/protocol/include/stop_offer_service_command.hpp b/implementation/protocol/include/stop_offer_service_command.hpp new file mode 100644 index 0000000..a9a51d2 --- /dev/null +++ b/implementation/protocol/include/stop_offer_service_command.hpp @@ -0,0 +1,24 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_STOP_OFFER_SERVICE_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_STOP_OFFER_SERVICE_COMMAND_HPP_ + +#include "service_command_base.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class stop_offer_service_command + : public service_command_base { + +public: + stop_offer_service_command(); +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_STOP_OFFER_SERVICE_COMMAND_HPP_ diff --git a/implementation/protocol/include/subscribe_ack_command.hpp b/implementation/protocol/include/subscribe_ack_command.hpp new file mode 100644 index 0000000..b3f4c76 --- /dev/null +++ b/implementation/protocol/include/subscribe_ack_command.hpp @@ -0,0 +1,24 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_SUBSCRIBE_ACK_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_SUBSCRIBE_ACK_COMMAND_HPP_ + +#include "subscribe_ack_command_base.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class subscribe_ack_command + : public subscribe_ack_command_base { + +public: + subscribe_ack_command(); +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_SUBSCRIBE_ACK_COMMAND_HPP_ diff --git a/implementation/protocol/include/subscribe_ack_command_base.hpp b/implementation/protocol/include/subscribe_ack_command_base.hpp new file mode 100644 index 0000000..3a738b9 --- /dev/null +++ b/implementation/protocol/include/subscribe_ack_command_base.hpp @@ -0,0 +1,57 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_SUBSCRIBE_ACK_COMMAND_BASE_HPP_ +#define VSOMEIP_V3_PROTOCOL_SUBSCRIBE_ACK_COMMAND_BASE_HPP_ + +#include <memory> + +#include "command.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class subscribe_ack_command_base + : public command { + +public: + service_t get_service() const; + void set_service(service_t _service); + + instance_t get_instance() const; + void set_instance(instance_t _instance); + + eventgroup_t get_eventgroup() const; + void set_eventgroup(eventgroup_t _eventgroup); + + client_t get_subscriber() const; + void set_subscriber(client_t _subscriber); + + event_t get_event() const; + void set_event(event_t _event); + + pending_id_t get_pending_id() const; + void set_pending_id(pending_id_t _pending_id); + + void serialize(std::vector<byte_t> &_buffer, + error_e &_error) const; + void deserialize(const std::vector<byte_t> &_buffer, + error_e &_error); + +protected: + subscribe_ack_command_base(id_e _id); + + service_t service_; + instance_t instance_; + eventgroup_t eventgroup_; + client_t subscriber_; + event_t event_; + pending_id_t pending_id_; +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_SUBSCRIBE_ACK_COMMAND_BASE_HPP_ diff --git a/implementation/protocol/include/subscribe_command.hpp b/implementation/protocol/include/subscribe_command.hpp new file mode 100644 index 0000000..d552562 --- /dev/null +++ b/implementation/protocol/include/subscribe_command.hpp @@ -0,0 +1,39 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_SUBSCRIBE_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_SUBSCRIBE_COMMAND_HPP_ + +#include <memory> + +#include <vsomeip/structured_types.hpp> + +#include "subscribe_command_base.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class subscribe_command + : public subscribe_command_base { + +public: + subscribe_command(); + + std::shared_ptr<debounce_filter_t> get_filter() const; + void set_filter(const std::shared_ptr<debounce_filter_t> &_filter); + + void serialize(std::vector<byte_t> &_buffer, + error_e &_error) const; + void deserialize(const std::vector<byte_t> &_buffer, + error_e &_error); + +private: + std::shared_ptr<debounce_filter_t> filter_; +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_SUBSCRIBE_COMMAND_HPP_ diff --git a/implementation/protocol/include/subscribe_command_base.hpp b/implementation/protocol/include/subscribe_command_base.hpp new file mode 100644 index 0000000..a16c2fe --- /dev/null +++ b/implementation/protocol/include/subscribe_command_base.hpp @@ -0,0 +1,59 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_SUBSCRIBE_COMMAND_BASE_HPP_ +#define VSOMEIP_V3_PROTOCOL_SUBSCRIBE_COMMAND_BASE_HPP_ + +#include <memory> + +#include <vsomeip/structured_types.hpp> + +#include "command.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class subscribe_command_base + : public command { + +public: + service_t get_service() const; + void set_service(service_t _service); + + instance_t get_instance() const; + void set_instance(instance_t _instance); + + eventgroup_t get_eventgroup() const; + void set_eventgroup(eventgroup_t _eventgroup); + + major_version_t get_major() const; + void set_major(major_version_t _major); + + event_t get_event() const; + void set_event(event_t _event); + + pending_id_t get_pending_id() const; + void set_pending_id(pending_id_t _pending_id); + + void serialize(std::vector<byte_t> &_buffer, + error_e &_error) const; + void deserialize(const std::vector<byte_t> &_buffer, + error_e &_error); + +protected: + subscribe_command_base(id_e _id); + + service_t service_; + instance_t instance_; + eventgroup_t eventgroup_; + major_version_t major_; + event_t event_; + pending_id_t pending_id_; +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_SUBSCRIBE_COMMAND_BASE_HPP_ diff --git a/implementation/protocol/include/subscribe_nack_command.hpp b/implementation/protocol/include/subscribe_nack_command.hpp new file mode 100644 index 0000000..5b79ce5 --- /dev/null +++ b/implementation/protocol/include/subscribe_nack_command.hpp @@ -0,0 +1,24 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_SUBSCRIBE_NACK_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_SUBSCRIBE_NACK_COMMAND_HPP_ + +#include "subscribe_ack_command_base.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class subscribe_nack_command + : public subscribe_ack_command_base { + +public: + subscribe_nack_command(); +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_SUBSCRIBE_NACK_COMMAND_HPP_ diff --git a/implementation/protocol/include/suspend_command.hpp b/implementation/protocol/include/suspend_command.hpp new file mode 100644 index 0000000..414b36f --- /dev/null +++ b/implementation/protocol/include/suspend_command.hpp @@ -0,0 +1,24 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_SUSPEND_HPP_ +#define VSOMEIP_V3_PROTOCOL_SUSPEND_HPP_ + +#include "simple_command.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class suspend_command + : public simple_command { + +public: + suspend_command(); +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_SUSPEND_COMMAND_HPP_ diff --git a/implementation/protocol/include/unregister_event_command.hpp b/implementation/protocol/include/unregister_event_command.hpp new file mode 100644 index 0000000..9779946 --- /dev/null +++ b/implementation/protocol/include/unregister_event_command.hpp @@ -0,0 +1,49 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_UNREGISTER_EVENT_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_UNREGISTER_EVENT_COMMAND_HPP_ + +#include <set> + +#include <vsomeip/enumeration_types.hpp> + +#include "command.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class unregister_event_command + : public command { +public: + unregister_event_command(); + + void serialize(std::vector<byte_t> &_buffer, error_e &_error) const; + void deserialize(const std::vector<byte_t> &_buffer, error_e &_error); + + // specific + service_t get_service() const; + void set_service(service_t _service); + + instance_t get_instance() const; + void set_instance(instance_t _instance); + + event_t get_event() const; + void set_event(event_t _event); + + bool is_provided() const; + void set_provided(bool _is_provided); + +private: + service_t service_; + instance_t instance_; + event_t event_; + bool is_provided_; +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_REGISTER_EVENT_COMMAND_HPP_ diff --git a/implementation/protocol/include/unsubscribe_ack_command.hpp b/implementation/protocol/include/unsubscribe_ack_command.hpp new file mode 100644 index 0000000..7afaa1d --- /dev/null +++ b/implementation/protocol/include/unsubscribe_ack_command.hpp @@ -0,0 +1,47 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_UNSUBSCRIBE_ACK_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_UNSUBSCRIBE_ACK_COMMAND_HPP_ + +#include "command.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class unsubscribe_ack_command + : public command { + +public: + unsubscribe_ack_command(); + + service_t get_service() const; + void set_service(service_t _service); + + instance_t get_instance() const; + void set_instance(instance_t _instance); + + eventgroup_t get_eventgroup() const; + void set_eventgroup(eventgroup_t _eventgroup); + + pending_id_t get_pending_id() const; + void set_pending_id(pending_id_t _pending_id); + + void serialize(std::vector<byte_t> &_buffer, + error_e &_error) const; + void deserialize(const std::vector<byte_t> &_buffer, + error_e &_error); + +private: + service_t service_; + instance_t instance_; + eventgroup_t eventgroup_; + pending_id_t pending_id_; +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_UNSUBSCRIBE_ACK_COMMAND_HPP_ diff --git a/implementation/protocol/include/unsubscribe_command.hpp b/implementation/protocol/include/unsubscribe_command.hpp new file mode 100644 index 0000000..e0a05ce --- /dev/null +++ b/implementation/protocol/include/unsubscribe_command.hpp @@ -0,0 +1,33 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_UNSUBSCRIBE_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_UNSUBSCRIBE_COMMAND_HPP_ + +#include <memory> + +#include <vsomeip/structured_types.hpp> + +#include "subscribe_command_base.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class unsubscribe_command + : public subscribe_command_base { + +public: + unsubscribe_command(); + + void serialize(std::vector<byte_t> &_buffer, + error_e &_error) const; + void deserialize(const std::vector<byte_t> &_buffer, + error_e &_error); +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_UNSUBSCRIBE_COMMAND_HPP_ diff --git a/implementation/protocol/include/update_security_credentials_command.hpp b/implementation/protocol/include/update_security_credentials_command.hpp new file mode 100644 index 0000000..37d9c34 --- /dev/null +++ b/implementation/protocol/include/update_security_credentials_command.hpp @@ -0,0 +1,39 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_UPDATE_SECURITY_CREDENTIALS_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_UPDATE_SECURITY_CREDENTIALS_COMMAND_HPP_ + +#include <set> + +#include "command.hpp" + +namespace vsomeip_v3 { + +struct policy; + +namespace protocol { + +class update_security_credentials_command + : public command { +public: + update_security_credentials_command(); + + void serialize(std::vector<byte_t> &_buffer, error_e &_error) const; + void deserialize(const std::vector<byte_t> &_buffer, error_e &_error); + + // specific + std::set<std::pair<uid_t, gid_t> > get_credentials() const; + void set_credentials( + const std::set<std::pair<uid_t, gid_t> > &_credentials); + +private: + std::set<std::pair<uid_t, gid_t> > credentials_; +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_UPDATE_SECURITY_CREDENTIALS_COMMAND_HPP_ diff --git a/implementation/protocol/include/update_security_policy_command.hpp b/implementation/protocol/include/update_security_policy_command.hpp new file mode 100644 index 0000000..9a42d64 --- /dev/null +++ b/implementation/protocol/include/update_security_policy_command.hpp @@ -0,0 +1,42 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_UPDATE_SECURITY_POLICY_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_UPDATE_SECURITY_POLICY_COMMAND_HPP_ + +#include <memory> + +#include "command.hpp" + +namespace vsomeip_v3 { + +struct policy; + +namespace protocol { + +class update_security_policy_command + : public command { +public: + update_security_policy_command(bool _is_internal = false); + + void serialize(std::vector<byte_t> &_buffer, error_e &_error) const; + void deserialize(const std::vector<byte_t> &_buffer, error_e &_error); + + // specific + uint32_t get_update_id() const; + void set_update_id(uint32_t _update_id); + + std::shared_ptr<policy> get_policy() const; + void set_policy(const std::shared_ptr<policy> &_policy); + +private: + uint32_t update_id_; + std::shared_ptr<policy> policy_; +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_UPDATE_SECURITY_POLICY_COMMAND_HPP_ diff --git a/implementation/protocol/include/update_security_policy_response_command.hpp b/implementation/protocol/include/update_security_policy_response_command.hpp new file mode 100644 index 0000000..002b001 --- /dev/null +++ b/implementation/protocol/include/update_security_policy_response_command.hpp @@ -0,0 +1,24 @@ +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef VSOMEIP_V3_PROTOCOL_UPDATE_SECURITY_POLICY_RESPONSE_COMMAND_HPP_ +#define VSOMEIP_V3_PROTOCOL_UPDATE_SECURITY_POLICY_RESPONSE_COMMAND_HPP_ + +#include "security_policy_response_command_base.hpp" + +namespace vsomeip_v3 { +namespace protocol { + +class update_security_policy_response_command + : public security_policy_response_command_base { + +public: + update_security_policy_response_command(); +}; + +} // namespace protocol +} // namespace vsomeip_v3 + +#endif // VSOMEIP_V3_PROTOCOL_UPDATE_SECURITY_POLICY_RESPONSE_COMMAND_HPP_ |