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

Method send

implementation/routing/src/routing_manager_impl.cpp:656–842  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

654}
655
656bool routing_manager_impl::send(client_t _client, const byte_t* _data, length_t _size, instance_t _instance, bool _reliable,
657 [[maybe_unused]] client_t _bound_client, [[maybe_unused]] const vsomeip_sec_client_t* _sec_client,
658 uint8_t _status_check, [[maybe_unused]] bool _sent_from_remote, [[maybe_unused]] bool _force) {
659
660 bool is_sent(false);
661 if (_size <= VSOMEIP_MESSAGE_TYPE_POS) {
662 return is_sent;
663 }
664 bool is_request = utility::is_request(_data[VSOMEIP_MESSAGE_TYPE_POS]);
665 bool is_notification = utility::is_notification(_data[VSOMEIP_MESSAGE_TYPE_POS]);
666 client_t its_client = bithelper::read_uint16_be(&_data[VSOMEIP_CLIENT_POS_MIN]);
667 service_t its_service = bithelper::read_uint16_be(&_data[VSOMEIP_SERVICE_POS_MIN]);
668 method_t its_method = bithelper::read_uint16_be(&_data[VSOMEIP_METHOD_POS_MIN]);
669 client_t its_target_client = VSOMEIP_ROUTING_CLIENT;
670
671 bool is_service_discovery = (its_service == sd::service && its_method == sd::method);
672
673 std::shared_ptr<local_endpoint> its_local_target;
674 if (is_request) {
675 its_target_client = find_local_client(its_service, _instance);
676 its_local_target = find_routing_endpoint(its_target_client);
677 } else if (!is_notification) {
678 its_local_target = find_routing_endpoint(its_client);
679 its_target_client = its_client;
680 } else if (is_notification && _client && !is_service_discovery) { // Selective notifications!
681 its_local_target = find_routing_endpoint(_client);
682 its_target_client = _client;
683 }
684
685 if (its_local_target) {
686 is_sent = send_local(its_local_target, its_target_client, _data, _size, _instance, _reliable, protocol::id_e::SEND_ID,
687 _status_check, VSOMEIP_ROUTING_CLIENT);
688 if (is_sent && (is_notification && find_local_client(its_service, _instance) == VSOMEIP_ROUTING_CLIENT)) {
689 trace::header its_header;
690 if (its_header.prepare(its_local_target, true, _instance))
691 tc_->trace(its_header.data_, VSOMEIP_TRACE_HEADER_SIZE, _data, _size);
692 }
693 return is_sent;
694 }
695
696 std::shared_ptr<boardnet_endpoint> its_target;
697 {
698 e2e_buffer its_buffer;
699
700 if (e2e_provider_) {
701 if (!is_service_discovery) {
702 service_t its_service_inner = bithelper::read_uint16_be(&_data[VSOMEIP_SERVICE_POS_MIN]);
703 method_t its_method_inner = bithelper::read_uint16_be(&_data[VSOMEIP_METHOD_POS_MIN]);
704#ifndef ANDROID
705 if (e2e_provider_->is_protected({its_service_inner, its_method_inner})) {
706 // Find out where the protected area starts
707 size_t its_base = e2e_provider_->get_protection_base({its_service_inner, its_method_inner});
708
709 // Build a corresponding buffer
710 its_buffer.assign(_data + its_base, _data + _size);
711
712 e2e_provider_->protect({its_service_inner, its_method_inner}, its_buffer, _instance);
713

Callers 7

send_localMethod · 0.45
send_subscribeMethod · 0.45
send_unsubscribeMethod · 0.45
on_pingMethod · 0.45
send_pingMethod · 0.45
send_localMethod · 0.45

Calls 15

hex4Function · 0.85
is_protectedMethod · 0.80
get_protection_baseMethod · 0.80
insertMethod · 0.80
beginMethod · 0.80
get_unicast_targetsMethod · 0.80
is_sending_multicastMethod · 0.80
prepareMethod · 0.45
traceMethod · 0.45
assignMethod · 0.45
protectMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected