1 // Copyright (C) 2015-2019 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 #include "../npdu_tests/npdu_test_client.hpp"
6 
7 #include <vsomeip/internal/logger.hpp>
8 #include "../../implementation/configuration/include/configuration.hpp"
9 #include "../../implementation/configuration/include/configuration_impl.hpp"
10 #include "../../implementation/configuration/include/configuration_plugin.hpp"
11 #include "../../implementation/plugin/include/plugin_manager_impl.hpp"
12 
13 enum class payloadsize
14     : std::uint8_t
15     {
16         UDS, TCP, UDP
17 };
18 
19 // this variables are changed via cmdline parameters
20 static bool use_tcp = false;
21 static bool call_service_sync = true;
22 static bool wait_for_replies = true;
23 static std::uint32_t sliding_window_size = vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND;
24 static payloadsize max_payload_size = payloadsize::UDS;
25 static bool shutdown_service_at_end = true;
26 
npdu_test_client(bool _use_tcp,bool _call_service_sync,std::uint32_t _sliding_window_size,bool _wait_for_replies,std::array<std::array<std::chrono::milliseconds,4>,4> _applicative_debounce)27 npdu_test_client::npdu_test_client(
28         bool _use_tcp,
29         bool _call_service_sync,
30         std::uint32_t _sliding_window_size,
31         bool _wait_for_replies,
32         std::array<std::array<std::chrono::milliseconds, 4>, 4> _applicative_debounce) :
33                 app_(vsomeip::runtime::get()->create_application()),
34                 request_(vsomeip::runtime::get()->create_request(_use_tcp)),
35                 call_service_sync_(_call_service_sync),
36                 wait_for_replies_(_wait_for_replies),
37                 sliding_window_size_(_sliding_window_size),
38                 blocked_({false}),
39                 is_available_({false}), // will set first element to false, rest to 0
40                 number_of_messages_to_send_(vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND),
41                 number_of_sent_messages_{0,0,0,0},
42                 number_of_acknowledged_messages_{{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
43                 current_payload_size_({0}),
44                 all_msg_acknowledged_({false, false, false, false}),
45                 acknowledgements_{0,0,0,0},
46                 applicative_debounce_(_applicative_debounce),
47                 finished_waiter_(&npdu_test_client::wait_for_all_senders, this)
48 {
49     senders_[0] = std::thread(&npdu_test_client::run<0>, this);
50     senders_[1] = std::thread(&npdu_test_client::run<1>, this);
51     senders_[2] = std::thread(&npdu_test_client::run<2>, this);
52     senders_[3] = std::thread(&npdu_test_client::run<3>, this);
53 }
54 
~npdu_test_client()55 npdu_test_client::~npdu_test_client() {
56     finished_waiter_.join();
57 }
58 
init()59 void npdu_test_client::init()
60 {
61     app_->init();
62 
63     app_->register_state_handler(
64             std::bind(&npdu_test_client::on_state, this,
65                     std::placeholders::_1));
66 
67     register_availability_handler<0>();
68     register_availability_handler<1>();
69     register_availability_handler<2>();
70     register_availability_handler<3>();
71 
72     register_message_handler_for_all_service_methods<0>();
73     register_message_handler_for_all_service_methods<1>();
74     register_message_handler_for_all_service_methods<2>();
75     register_message_handler_for_all_service_methods<3>();
76 
77     request_->set_service(vsomeip_test::TEST_SERVICE_SERVICE_ID);
78     request_->set_instance(vsomeip_test::TEST_SERVICE_INSTANCE_ID);
79     if(!wait_for_replies_)
80         request_->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
81 }
82 
83 template<int service_idx>
register_availability_handler()84 void npdu_test_client::register_availability_handler() {
85     app_->register_availability_handler(npdu_test::service_ids[service_idx],
86             npdu_test::instance_ids[service_idx],
87             std::bind(
88                     &npdu_test_client::on_availability<service_idx>,
89                     this, std::placeholders::_1, std::placeholders::_2,
90                     std::placeholders::_3));
91 }
92 
93 template<int service_idx>
register_message_handler_for_all_service_methods()94 void npdu_test_client::register_message_handler_for_all_service_methods() {
95     register_message_handler<service_idx, 0>();
96     register_message_handler<service_idx, 1>();
97     register_message_handler<service_idx, 2>();
98     register_message_handler<service_idx, 3>();
99 }
100 
101 template<int service_idx, int method_idx>
register_message_handler()102 void npdu_test_client::register_message_handler() {
103     app_->register_message_handler(npdu_test::service_ids[service_idx],
104             npdu_test::instance_ids[service_idx],
105             npdu_test::method_ids[service_idx][method_idx],
106             std::bind(
107                     &npdu_test_client::on_message<service_idx, method_idx>,
108                     this, std::placeholders::_1));
109 }
110 
start()111 void npdu_test_client::start()
112 {
113     VSOMEIP_INFO << "Starting...";
114     app_->start();
115 }
116 
stop()117 void npdu_test_client::stop()
118 {
119     VSOMEIP_INFO << "Stopping...";
120 
121     app_->unregister_state_handler();
122 
123     for (unsigned int i = 0; i< npdu_test::service_ids.size(); i++) {
124         app_->unregister_availability_handler(npdu_test::service_ids[i],
125                                               npdu_test::instance_ids[i]);
126 
127         for(unsigned int j = 0; j < npdu_test::method_ids[i].size(); j++) {
128             app_->unregister_message_handler(npdu_test::service_ids[i],
129                                              npdu_test::instance_ids[i],
130                                              npdu_test::method_ids[i][j]);
131         }
132     }
133 
134     if(shutdown_service_at_end) {
135         // notify the routing manager daemon that were finished
136         request_->set_service(npdu_test::RMD_SERVICE_ID_CLIENT_SIDE);
137         request_->set_instance(npdu_test::RMD_INSTANCE_ID);
138         request_->set_method(npdu_test::RMD_SHUTDOWN_METHOD_ID);
139         request_->set_payload(vsomeip::runtime::get()->create_payload());
140         request_->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
141         app_->send(request_);
142         // sleep otherwise the app will shutdown before the message reaches the rmd
143         std::this_thread::sleep_for(std::chrono::seconds(5));
144     }
145     app_->stop();
146 }
147 
join_sender_thread()148 void npdu_test_client::join_sender_thread() {
149     for (auto& t : senders_) {
150         t.join();
151     }
152 }
153 
on_state(vsomeip::state_type_e _state)154 void npdu_test_client::on_state(vsomeip::state_type_e _state)
155 {
156     if(_state == vsomeip::state_type_e::ST_REGISTERED)
157     {
158         for (unsigned int i = 0; i< npdu_test::service_ids.size(); i++) {
159             app_->request_service(npdu_test::service_ids[i],
160                                   npdu_test::instance_ids[i]);
161         }
162     }
163 }
164 
165 template<int service_idx>
on_availability(vsomeip::service_t _service,vsomeip::instance_t _instance,bool _is_available)166 void npdu_test_client::on_availability(vsomeip::service_t _service,
167         vsomeip::instance_t _instance, bool _is_available)
168 {
169     VSOMEIP_INFO<< "Service [" << std::setw(4) << std::setfill('0') << std::hex
170             << _service << "." << std::setw(4) << std::setfill('0') << _instance << "] is "
171             << (_is_available ? "available." : "NOT available.");
172     if(npdu_test::service_ids[service_idx] == _service
173        && npdu_test::instance_ids[service_idx] == _instance) {
174         if(is_available_[service_idx] && !_is_available)
175         {
176             is_available_[service_idx] = false;
177         }
178         else if(_is_available && !is_available_[service_idx])
179         {
180             is_available_[service_idx] = true;
181             send<service_idx>();
182         }
183     }
184 }
185 
186 template<int service_idx, int method_idx>
on_message(const std::shared_ptr<vsomeip::message> & _response)187 void npdu_test_client::on_message(const std::shared_ptr<vsomeip::message>& _response) {
188     (void)_response;
189     //TODO make sure the replies were sent within demanded debounce times
190     VSOMEIP_DEBUG << "Received reply from:" << std::setw(4) << std::setfill('0')
191             << std::hex << npdu_test::service_ids[service_idx] << ":"
192             << std::setw(4) << std::setfill('0') << std::hex
193             << npdu_test::instance_ids[service_idx] << ":" << std::setw(4)
194             << std::setfill('0') << std::hex
195             << npdu_test::method_ids[service_idx][method_idx];
196 
197     if(call_service_sync_)
198     {
199         // We notify the sender thread every time a message was acknowledged
200         std::lock_guard<std::mutex> lk(all_msg_acknowledged_mutexes_[service_idx][method_idx]);
201         all_msg_acknowledged_[service_idx][method_idx] = true;
202         all_msg_acknowledged_cvs_[service_idx][method_idx].notify_one();
203     }
204     else
205     {
206 
207         std::lock_guard<std::mutex> its_lock(number_of_acknowledged_messages_mutexes_[service_idx][method_idx]);
208         number_of_acknowledged_messages_[service_idx][method_idx]++;
209 
210         // We notify the sender thread only if all sent messages have been acknowledged
211         if(number_of_acknowledged_messages_[service_idx][method_idx] == number_of_messages_to_send_)
212         {
213             std::lock_guard<std::mutex> lk(all_msg_acknowledged_mutexes_[service_idx][method_idx]);
214             // reset
215             number_of_acknowledged_messages_[service_idx][method_idx] = 0;
216             all_msg_acknowledged_[service_idx][method_idx] = true;
217             all_msg_acknowledged_cvs_[service_idx][method_idx].notify_one();
218         } else if(number_of_acknowledged_messages_[service_idx][method_idx] % sliding_window_size == 0)
219         {
220             std::lock_guard<std::mutex> lk(all_msg_acknowledged_mutexes_[service_idx][method_idx]);
221             all_msg_acknowledged_[service_idx][method_idx] = true;
222             all_msg_acknowledged_cvs_[service_idx][method_idx].notify_one();
223         }
224     }
225 }
226 
227 template<int service_idx>
send()228 void npdu_test_client::send()
229 {
230     std::lock_guard<std::mutex> its_lock(mutexes_[service_idx]);
231     blocked_[service_idx] = true;
232     conditions_[service_idx].notify_one();
233 }
234 
235 template<int service_idx>
run()236 void npdu_test_client::run()
237 {
238     std::unique_lock<std::mutex> its_lock(mutexes_[service_idx]);
239     while (!blocked_[service_idx])
240     {
241         conditions_[service_idx].wait(its_lock);
242     }
243     current_payload_size_[service_idx] = 1;
244 
245     std::uint32_t max_allowed_payload = get_max_allowed_payload();
246 
247     for (int var = 0; var < 4; ++var) {
248         payloads_[service_idx][var] = vsomeip::runtime::get()->create_payload();
249         payload_data_[service_idx][var] = std::vector<vsomeip::byte_t>();
250     }
251 
252     bool lastrun = false;
253     while (current_payload_size_[service_idx] <= max_allowed_payload)
254     {
255         // prepare the payloads w/ current payloadsize
256         for (int var = 0; var < 4; ++var) {
257             // assign 0x11 to first, 0x22 to second...
258             payload_data_[service_idx][var].assign(
259                     current_payload_size_[service_idx], static_cast<vsomeip::byte_t>(0x11 * (var + 1)));
260             payloads_[service_idx][var]->set_data(payload_data_[service_idx][var]);
261         }
262 
263         // send the payloads to the service's methods
264         if(wait_for_replies_) {
265             call_service_sync_ ? send_messages_sync<service_idx>() : send_messages_async<service_idx>();
266         } else {
267             send_messages_and_dont_wait_for_reply<service_idx>();
268         }
269 
270         // Increase array size for next iteration
271         current_payload_size_[service_idx] *= 2;
272 
273         //special case to test the biggest payload possible as last test
274         // 16 Bytes are reserved for the SOME/IP header
275         if(current_payload_size_[service_idx] > max_allowed_payload - 16 && !lastrun)
276         {
277             current_payload_size_[service_idx] = max_allowed_payload - 16;
278             lastrun = true;
279         }
280         std::this_thread::sleep_for(std::chrono::milliseconds(100));
281     }
282     blocked_[service_idx] = false;
283 
284     {
285         std::lock_guard<std::mutex> its_lock(finished_mutex_);
286         finished_[service_idx] = true;
287     }
288 }
289 
290 
get_max_allowed_payload()291 std::uint32_t npdu_test_client::get_max_allowed_payload()
292 {
293     std::uint32_t payload;
294     switch (max_payload_size)
295     {
296         case payloadsize::UDS:
297             payload = VSOMEIP_MAX_LOCAL_MESSAGE_SIZE;
298             break;
299         case payloadsize::TCP:
300             payload = 4095;
301             break;
302         case payloadsize::UDP:
303             payload = VSOMEIP_MAX_UDP_MESSAGE_SIZE;
304             break;
305         default:
306             payload = VSOMEIP_MAX_LOCAL_MESSAGE_SIZE;
307             break;
308     }
309     return payload;
310 }
311 
312 template<int service_idx>
send_messages_sync()313 void npdu_test_client::send_messages_sync()
314 {
315     std::thread t0 = start_send_thread_sync<service_idx, 0>();
316     std::thread t1 = start_send_thread_sync<service_idx, 1>();
317     std::thread t2 = start_send_thread_sync<service_idx, 2>();
318     std::thread t3 = start_send_thread_sync<service_idx, 3>();
319     t0.join();
320     t1.join();
321     t2.join();
322     t3.join();
323 }
324 
325 template<int service_idx, int method_idx>
start_send_thread_sync()326 std::thread npdu_test_client::start_send_thread_sync() {
327     return std::thread([&]() {
328         all_msg_acknowledged_unique_locks_[service_idx][method_idx] =
329                 std::unique_lock<std::mutex>
330                     (all_msg_acknowledged_mutexes_[service_idx][method_idx]);
331 
332         std::shared_ptr<vsomeip::message> request = vsomeip::runtime::get()->create_request(use_tcp);
333         request->set_service(npdu_test::service_ids[service_idx]);
334         request->set_instance(npdu_test::instance_ids[service_idx]);
335         request->set_method(npdu_test::method_ids[service_idx][method_idx]);
336         request->set_payload(payloads_[service_idx][method_idx]);
337         for (std::uint32_t i = 0; i < number_of_messages_to_send_; i++)
338         {
339             all_msg_acknowledged_[service_idx][method_idx] = false;
340             app_->send(request);
341 
342             std::chrono::high_resolution_clock::time_point sent =
343                     std::chrono::high_resolution_clock::now();
344 
345             while(!all_msg_acknowledged_[service_idx][method_idx]) {
346                 all_msg_acknowledged_cvs_[service_idx][method_idx].wait(
347                         all_msg_acknowledged_unique_locks_[service_idx][method_idx]);
348             }
349 
350             std::chrono::nanoseconds waited_for_response =
351                     std::chrono::high_resolution_clock::now() - sent;
352             if(waited_for_response < applicative_debounce_[service_idx][method_idx]) {
353                 // make sure we don't send faster than debounce time + max retention time
354                 std::this_thread::sleep_for(
355                                         applicative_debounce_[service_idx][method_idx]
356                                                            - waited_for_response);
357             }
358         }
359         all_msg_acknowledged_unique_locks_[service_idx][method_idx].unlock();
360     });
361 }
362 
363 template<int service_idx>
send_messages_async()364 void npdu_test_client::send_messages_async()
365 {
366     std::thread t0 = start_send_thread_async<service_idx, 0>();
367     std::thread t1 = start_send_thread_async<service_idx, 1>();
368     std::thread t2 = start_send_thread_async<service_idx, 2>();
369     std::thread t3 = start_send_thread_async<service_idx, 3>();
370     t0.join();
371     t1.join();
372     t2.join();
373     t3.join();
374 }
375 
376 template<int service_idx, int method_idx>
start_send_thread_async()377 std::thread npdu_test_client::start_send_thread_async() {
378     return std::thread([&]() {
379         all_msg_acknowledged_unique_locks_[service_idx][method_idx] =
380                 std::unique_lock<std::mutex>
381                     (all_msg_acknowledged_mutexes_[service_idx][method_idx]);
382         std::shared_ptr<vsomeip::message> request = vsomeip::runtime::get()->create_request(use_tcp);
383         request->set_service(npdu_test::service_ids[service_idx]);
384         request->set_instance(npdu_test::instance_ids[service_idx]);
385         request->set_method(npdu_test::method_ids[service_idx][method_idx]);
386         request->set_payload(payloads_[service_idx][method_idx]);
387         for (std::uint32_t i = 0; i < number_of_messages_to_send_; i++)
388         {
389             app_->send(request);
390 
391             if((i+1) == number_of_messages_to_send_ || (i+1) % sliding_window_size == 0) {
392                 // wait until all send messages have been acknowledged
393                 // as long we wait lk is released; after wait returns lk is reacquired
394                 while(!all_msg_acknowledged_[service_idx][method_idx]) {
395                     all_msg_acknowledged_cvs_[service_idx][method_idx].wait(
396                             all_msg_acknowledged_unique_locks_[service_idx][method_idx]);
397                 }
398                 // Reset condition variable
399                 all_msg_acknowledged_[service_idx][method_idx] = false;
400             }
401             // make sure we don't send faster than debounce time + max retention time
402             std::this_thread::sleep_for(applicative_debounce_[service_idx][method_idx]);
403         }
404         all_msg_acknowledged_unique_locks_[service_idx][method_idx].unlock();
405     });
406 }
407 
408 template<int service_idx>
send_messages_and_dont_wait_for_reply()409 void npdu_test_client::send_messages_and_dont_wait_for_reply()
410 {
411     std::thread t0 = start_send_thread<service_idx, 0>();
412     std::thread t1 = start_send_thread<service_idx, 1>();
413     std::thread t2 = start_send_thread<service_idx, 2>();
414     std::thread t3 = start_send_thread<service_idx, 3>();
415     t0.join();
416     t1.join();
417     t2.join();
418     t3.join();
419 }
420 
421 template<int service_idx, int method_idx>
start_send_thread()422 std::thread npdu_test_client::start_send_thread() {
423     return std::thread([&]() {
424         std::shared_ptr<vsomeip::message> request = vsomeip::runtime::get()->create_request(use_tcp);
425         request->set_service(npdu_test::service_ids[service_idx]);
426         request->set_instance(npdu_test::instance_ids[service_idx]);
427         request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
428         request->set_method(npdu_test::method_ids[service_idx][method_idx]);
429         request->set_payload(payloads_[service_idx][method_idx]);
430         for (std::uint32_t i = 0; i < number_of_messages_to_send_; i++)
431         {
432             app_->send(request);
433             // make sure we don't send faster than debounce time + max retention time
434             std::this_thread::sleep_for(applicative_debounce_[service_idx][method_idx]);
435         }
436     });
437 }
438 
wait_for_all_senders()439 void npdu_test_client::wait_for_all_senders() {
440     bool all_finished(false);
441     while (!all_finished) {
442         {
443             std::lock_guard<std::mutex> its_lock(finished_mutex_);
444             if (std::all_of(finished_.begin(), finished_.end(), [](bool i) { return i; })) {
445                 all_finished = true;
446             }
447         }
448         std::this_thread::sleep_for(std::chrono::milliseconds(100));
449     }
450     join_sender_thread();
451 
452     if (!wait_for_replies_ || !call_service_sync_) {
453         // sleep longer here as sending is asynchronously and it's necessary
454         // to wait until all messages have left the application
455         VSOMEIP_INFO << "Sleeping for 180sec since the client is running "
456                 "in --dont-wait-for-replies or --async mode. "
457                 "Otherwise it might be possible that not all messages leave the "
458                 "application.";
459         for(int i = 0; i < 180; i++) {
460             std::this_thread::sleep_for(std::chrono::seconds(1));
461             std::cout << ".";
462             std::cout.flush();
463         }
464     } else {
465         std::this_thread::sleep_for(std::chrono::seconds(5));
466     }
467     stop();
468 }
469 
TEST(someip_npdu_test,send_different_payloads)470 TEST(someip_npdu_test, send_different_payloads)
471 {
472     // get the configuration
473     std::shared_ptr<vsomeip::configuration> its_configuration;
474     auto its_plugin = vsomeip::plugin_manager::get()->get_plugin(
475             vsomeip::plugin_type_e::CONFIGURATION_PLUGIN, VSOMEIP_CFG_LIBRARY);
476     if (its_plugin) {
477         auto its_config_plugin = std::dynamic_pointer_cast<vsomeip::configuration_plugin>(its_plugin);
478         if (its_config_plugin) {
479             its_configuration = its_config_plugin->get_configuration("");
480         }
481     }
482     if (!its_configuration) {
483         ADD_FAILURE() << "No configuration object. "
484                 "Either memory overflow or loading error detected!";
485         return;
486     }
487 
488     // used to store the debounce times
489     std::array<std::array<std::chrono::milliseconds, 4>, 4> applicative_debounce;
490 
491     // query the debouncetimes from the configuration. We want to know the
492     // debounce times which the _clients_ of this service have to comply with
493     // when they send requests to this service.
494     // This is necessary as we must ensure a applicative debouncing greater than
495     // debounce time + maximum retention time. Therefore the send threads sleep
496     // for this amount of time after sending a message.
497     for(int service_id = 0; service_id < 4; service_id++) {
498         for(int method_id = 0; method_id < 4; method_id++) {
499             std::chrono::nanoseconds debounce(0), retention(0);
500             its_configuration->get_configured_timing_requests(
501                     npdu_test::service_ids[service_id],
502                     its_configuration->get_unicast_address(npdu_test::service_ids[service_id],
503                                                            npdu_test::instance_ids[service_id]),
504                     its_configuration->get_unreliable_port(
505                             npdu_test::service_ids[service_id],
506                             npdu_test::instance_ids[service_id]),
507                     npdu_test::method_ids[service_id][method_id],
508                     &debounce, &retention);
509             if (debounce == std::chrono::nanoseconds(VSOMEIP_DEFAULT_NPDU_DEBOUNCING_NANO) &&
510                 retention == std::chrono::nanoseconds(VSOMEIP_DEFAULT_NPDU_MAXIMUM_RETENTION_NANO)) {
511                 // no timings specified don't don't sleep after sending...
512                 applicative_debounce[service_id][method_id] =
513                         std::chrono::milliseconds(0);
514             } else {
515                 // we add 1 milliseconds to sleep a little bit longer
516                 applicative_debounce[service_id][method_id] = std::chrono::duration_cast<
517                         std::chrono::milliseconds>(debounce + retention)
518                         + std::chrono::milliseconds(1);
519 
520             }
521 
522         }
523     }
524 
525     npdu_test_client test_client_(use_tcp, call_service_sync,
526             sliding_window_size, wait_for_replies,
527             applicative_debounce);
528     test_client_.init();
529     test_client_.start();
530 }
531 
532 
533 #ifndef _WIN32
main(int argc,char ** argv)534 int main(int argc, char** argv)
535 {
536     std::string tcp_enable("--TCP");
537     std::string udp_enable("--UDP");
538     std::string sync_enable("--sync");
539     std::string async_enable("--async");
540     std::string no_reply_enable("--dont-wait-for-replies");
541     std::string sliding_window_size_param("--sliding-window-size");
542     std::string max_payload_size_param("--max-payload-size");
543     std::string shutdown_service_disable_param("--dont-shutdown-service");
544     std::string help("--help");
545 
546     int i = 1;
547     while (i < argc)
548     {
549         if (tcp_enable == argv[i]) {
550             use_tcp = true;
551         } else if (udp_enable == argv[i]) {
552             use_tcp = false;
553         } else if (sync_enable == argv[i]) {
554             call_service_sync = true;
555         } else if (async_enable == argv[i]) {
556             call_service_sync = false;
557         } else if (no_reply_enable == argv[i]) {
558             wait_for_replies = false;
559         } else if (sliding_window_size_param == argv[i] && i + 1 < argc) {
560             i++;
561             std::stringstream converter(argv[i]);
562             converter >> sliding_window_size;
563         } else if (max_payload_size_param == argv[i] && i + 1 < argc) {
564             i++;
565             if (std::string("UDS") == argv[i]) {
566                 max_payload_size = payloadsize::UDS;
567             } else if (std::string("TCP") == argv[i]) {
568                 max_payload_size = payloadsize::TCP;
569             } else if (std::string("UDP") == argv[i]) {
570                 max_payload_size = payloadsize::UDP;
571             }
572         } else if (shutdown_service_disable_param == argv[i]) {
573             shutdown_service_at_end = false;
574         } else if (help == argv[i]) {
575             VSOMEIP_INFO << "Parameters:\n"
576             << "--TCP: Send messages via TCP\n"
577             << "--UDP: Send messages via UDP (default)\n"
578             << "--sync: Wait for acknowledge before sending next message (default)\n"
579             << "--async: Send multiple messages w/o waiting for"
580                 " acknowledge of service\n"
581             << "--dont-wait-for-replies: Just send out the messages w/o waiting for "
582                 "a reply by the service (use REQUEST_NO_RETURN message type)\n"
583             << "--sliding-window-size: Number of messages to send before waiting "
584                 "for acknowledge of service. Default: " << sliding_window_size << "\n"
585             << "--max-payload-size: limit the maximum payloadsize of send requests. One of {"
586                 "UDS (=" << VSOMEIP_MAX_LOCAL_MESSAGE_SIZE << "byte), "
587                 "UDP (=" << VSOMEIP_MAX_UDP_MESSAGE_SIZE << "byte), "
588                 "TCP (=" << VSOMEIP_MAX_TCP_MESSAGE_SIZE << "byte)}, default: UDS\n"
589             << "--dont-shutdown-service: Don't shutdown the service upon "
590                 "finishing of the payload test\n"
591             << "--help: print this help";
592         }
593         i++;
594     }
595 
596     ::testing::InitGoogleTest(&argc, argv);
597     return RUN_ALL_TESTS();
598 }
599 #endif
600