1 // Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 2 // This Source Code Form is subject to the terms of the Mozilla Public 3 // License, v. 2.0. If a copy of the MPL was not distributed with this 4 // file, You can obtain one at http://mozilla.org/MPL/2.0/. 5 6 #include <vsomeip/constants.hpp> 7 #include <vsomeip/internal/logger.hpp> 8 9 #include "../include/constants.hpp" 10 #include "../include/ip_option_impl.hpp" 11 #include "../../message/include/deserializer.hpp" 12 #include "../../message/include/serializer.hpp" 13 14 15 namespace vsomeip_v3 { 16 namespace sd { 17 ip_option_impl()18ip_option_impl::ip_option_impl() 19 : protocol_(layer_four_protocol_e::UNKNOWN), port_(0) { 20 } 21 ip_option_impl(const uint16_t _port,const bool _is_reliable)22ip_option_impl::ip_option_impl(const uint16_t _port, const bool _is_reliable) 23 : protocol_(_is_reliable ? 24 layer_four_protocol_e::TCP : layer_four_protocol_e::UDP), 25 port_(_port) { 26 } 27 ~ip_option_impl()28ip_option_impl::~ip_option_impl() { 29 } 30 31 bool operator ==(const option_impl & _other) const32ip_option_impl::operator ==(const option_impl &_other) const { 33 bool is_equal(option_impl::operator ==(_other)); 34 35 if (is_equal) { 36 const ip_option_impl &its_other 37 = dynamic_cast<const ip_option_impl &>(_other); 38 is_equal = (protocol_ == its_other.protocol_ 39 && port_ == its_other.port_); 40 } 41 return is_equal; 42 } 43 get_port() const44unsigned short ip_option_impl::get_port() const { 45 return port_; 46 } 47 set_port(unsigned short _port)48void ip_option_impl::set_port(unsigned short _port) { 49 port_ = _port; 50 } 51 get_layer_four_protocol() const52layer_four_protocol_e ip_option_impl::get_layer_four_protocol() const { 53 return protocol_; 54 } 55 set_layer_four_protocol(layer_four_protocol_e _protocol)56void ip_option_impl::set_layer_four_protocol( 57 layer_four_protocol_e _protocol) { 58 protocol_ = _protocol; 59 } 60 61 } // namespace sd 62 } // namespace vsomeip_v3 63