MCPcopy Create free account
hub / github.com/COVESA/vsomeip / check_error

Method check_error

implementation/routing/src/routing_manager_impl.cpp:2233–2271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2231}
2232
2233return_code_e routing_manager_impl::check_error(const byte_t* _data, length_t /*_size*/, instance_t _instance) const {
2234
2235 // caller guarantees _size >= VSOMEIP_FULL_HEADER_SIZE
2236
2237 if (utility::is_request(_data[VSOMEIP_MESSAGE_TYPE_POS]) || utility::is_request_no_return(_data[VSOMEIP_MESSAGE_TYPE_POS])) {
2238 service_t its_service = bithelper::read_uint16_be(&_data[VSOMEIP_SERVICE_POS_MIN]);
2239 major_version_t its_version = _data[VSOMEIP_INTERFACE_VERSION_POS];
2240
2241 uint8_t its_protocol_version = _data[VSOMEIP_PROTOCOL_VERSION_POS];
2242 if (its_protocol_version != VSOMEIP_PROTOCOL_VERSION) {
2243 VSOMEIP_WARNING_P << "Received a message with unsupported protocol version 0x" << hex2(its_protocol_version)
2244 << " for service 0x" << hex4(its_service);
2245 return return_code_e::E_WRONG_PROTOCOL_VERSION;
2246 }
2247 if (_instance == 0xFFFF) {
2248 VSOMEIP_WARNING_P << "Receiving endpoint is not configured for service 0x" << hex4(its_service);
2249 return return_code_e::E_UNKNOWN_SERVICE;
2250 }
2251
2252 // Check interface version of service/instance
2253 auto its_info = find_service(its_service, _instance);
2254 if (its_info) {
2255 if (its_version != its_info->get_major()) {
2256 VSOMEIP_WARNING_P << "Received a message with unsupported interface version 0x" << hex2(its_version) << " for service 0x"
2257 << hex4(its_service);
2258 return return_code_e::E_WRONG_INTERFACE_VERSION;
2259 }
2260 }
2261 uint8_t its_return_code = _data[VSOMEIP_RETURN_CODE_POS];
2262 if (its_return_code != static_cast<byte_t>(return_code_e::E_OK)) {
2263 // Request calls must to have return code E_OK set!
2264 VSOMEIP_WARNING_P << "Received a message with unsupported return code 0x" << hex2(its_return_code) << " set for service 0x"
2265 << hex4(its_service);
2266 return return_code_e::E_NOT_OK;
2267 }
2268 }
2269
2270 return return_code_e::E_OK;
2271}
2272
2273void routing_manager_impl::send_error(return_code_e _return_code, const byte_t* _data, length_t _size, instance_t _instance, bool _reliable,
2274 boardnet_endpoint* const _receiver, const boost::asio::ip::address& _remote_address,

Callers

nothing calls this directly

Calls 3

hex2Function · 0.85
hex4Function · 0.85
get_majorMethod · 0.45

Tested by

no test coverage detected