| 83 | } |
| 84 | |
| 85 | bool eventgroupentry_impl::matches(const eventgroupentry_impl& _other, const message_impl::options_t& _options) const { |
| 86 | if (service_ == _other.service_ && instance_ == _other.instance_ && eventgroup_ == _other.eventgroup_ |
| 87 | && major_version_ == _other.major_version_ && counter_ == _other.counter_) { |
| 88 | |
| 89 | // Check, whether options are identical |
| 90 | if (index1_ == _other.index1_ && index2_ == _other.index2_ && num_options_[0] == _other.num_options_[0] |
| 91 | && num_options_[1] == _other.num_options_[1]) { |
| 92 | return true; |
| 93 | } |
| 94 | |
| 95 | // check if entries reference options at different indexes but the |
| 96 | // options itself are identical |
| 97 | // check if number of options referenced is the same |
| 98 | if (num_options_[0] + num_options_[1] != _other.num_options_[0] + _other.num_options_[1] |
| 99 | || num_options_[0] + num_options_[1] == 0) { |
| 100 | return false; |
| 101 | } |
| 102 | |
| 103 | // read out ip options of current and _other |
| 104 | std::vector<std::shared_ptr<ip_option_impl>> its_options_current; |
| 105 | std::vector<std::shared_ptr<ip_option_impl>> its_options_other; |
| 106 | const std::size_t its_options_size = _options.size(); |
| 107 | for (const auto option_run : {0, 1}) { |
| 108 | for (const auto option_index : options_[option_run]) { |
| 109 | if (its_options_size > option_index) { |
| 110 | switch (_options[option_index]->get_type()) { |
| 111 | case option_type_e::IP4_ENDPOINT: |
| 112 | its_options_current.push_back(std::static_pointer_cast<ipv4_option_impl>(_options[option_index])); |
| 113 | break; |
| 114 | case option_type_e::IP6_ENDPOINT: |
| 115 | its_options_current.push_back(std::static_pointer_cast<ipv6_option_impl>(_options[option_index])); |
| 116 | break; |
| 117 | default: |
| 118 | break; |
| 119 | } |
| 120 | } |
| 121 | } |
| 122 | for (const auto option_index : _other.options_[option_run]) { |
| 123 | if (its_options_size > option_index) { |
| 124 | switch (_options[option_index]->get_type()) { |
| 125 | case option_type_e::IP4_ENDPOINT: |
| 126 | its_options_other.push_back(std::static_pointer_cast<ipv4_option_impl>(_options[option_index])); |
| 127 | break; |
| 128 | case option_type_e::IP6_ENDPOINT: |
| 129 | its_options_other.push_back(std::static_pointer_cast<ipv6_option_impl>(_options[option_index])); |
| 130 | break; |
| 131 | default: |
| 132 | break; |
| 133 | } |
| 134 | } |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | if (!its_options_current.size() || !its_options_other.size()) { |
| 139 | return false; |
| 140 | } |
| 141 | |
| 142 | // search every option of current in other |
no test coverage detected