3 * Copyright (C) 2012-2014 BMW AG
5 * This file is part of GENIVI Project Dlt - Diagnostic Log and Trace console apps.
7 * Contributions are licensed to the GENIVI Alliance under one or more
8 * Contribution License Agreements.
11 * This Source Code Form is subject to the terms of the
12 * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
13 * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
16 * Alexander Wenzel <alexander.aw.wenzel@bmw.de>
17 * Markus Klein <Markus.Klein@esk.fraunhofer.de>
18 * Mikko Rapeli <mikko.rapeli@bmw.de>
20 * \file dlt_daemon_client.c
21 * For further information see http://www.genivi.org/.
27 #include <stdio.h> /* for printf() and fprintf() */
28 #include <sys/socket.h> /* for socket(), connect(), (), and recv() */
29 #include <arpa/inet.h> /* for sockaddr_in and inet_addr() */
30 #include <stdlib.h> /* for atoi() and exit() */
31 #include <string.h> /* for memset() */
32 #include <unistd.h> /* for close() */
40 #include <sys/timerfd.h>
45 #include <linux/stat.h>
48 #include "dlt_types.h"
49 #include "dlt-daemon.h"
50 #include "dlt-daemon_cfg.h"
51 #include "dlt_daemon_common_cfg.h"
53 #include "dlt_daemon_socket.h"
54 #include "dlt_daemon_serial.h"
56 #include "dlt_daemon_client.h"
58 /** Global text output buffer, mainly used for creation of error/warning strings */
59 static char str[DLT_DAEMON_TEXTBUFSIZE];
61 int dlt_daemon_client_send(int sock,DltDaemon *daemon,DltDaemonLocal *daemon_local,void* data1,int size1,void* data2,int size2,int verbose)
66 if (sock!=DLT_DAEMON_SEND_TO_ALL && sock!=DLT_DAEMON_SEND_FORCE)
68 /* Send message to specific socket */
71 DLT_DAEMON_SEM_LOCK();
73 if((ret=dlt_daemon_serial_send(sock,data1,size1,data2,size2,daemon->sendserialheader)))
75 DLT_DAEMON_SEM_FREE();
76 dlt_log(LOG_WARNING,"dlt_daemon_client_send: serial send dlt message failed\n");
80 DLT_DAEMON_SEM_FREE();
84 DLT_DAEMON_SEM_LOCK();
86 if((ret=dlt_daemon_socket_send(sock,data1,size1,data2,size2,daemon->sendserialheader)))
88 DLT_DAEMON_SEM_FREE();
89 dlt_log(LOG_WARNING,"dlt_daemon_client_send: socket send dlt message failed\n");
93 DLT_DAEMON_SEM_FREE();
95 return DLT_DAEMON_ERROR_OK;
98 /* write message to offline trace */
99 if ((sock!=DLT_DAEMON_SEND_FORCE) && (daemon->state == DLT_DAEMON_STATE_SEND_DIRECT))
101 if(((daemon->mode == DLT_USER_MODE_INTERNAL) || (daemon->mode == DLT_USER_MODE_BOTH))
102 && daemon_local->flags.offlineTraceDirectory[0])
104 if(dlt_offline_trace_write(&(daemon_local->offlineTrace),daemon_local->msg.headerbuffer,daemon_local->msg.headersize,
105 daemon_local->msg.databuffer,daemon_local->msg.datasize,0,0))
107 static int error_dlt_offline_trace_write_failed = 0;
108 if(!error_dlt_offline_trace_write_failed)
110 dlt_log(LOG_ERR,"dlt_daemon_client_send: dlt_offline_trace_write failed!\n");
111 error_dlt_offline_trace_write_failed = 1;
113 //return DLT_DAEMON_ERROR_WRITE_FAILED;
118 /* send messages to daemon socket */
119 if((daemon->mode == DLT_USER_MODE_EXTERNAL) || (daemon->mode == DLT_USER_MODE_BOTH))
121 if ((sock==DLT_DAEMON_SEND_FORCE) || (daemon->state == DLT_DAEMON_STATE_SEND_DIRECT))
124 /* look if TCP connection to client is available */
125 for (j = 0; j <= daemon_local->fdmax; j++)
127 /* send to everyone! */
128 if (FD_ISSET(j, &(daemon_local->master)))
130 if ((j != daemon_local->fp) && (j != daemon_local->sock) && (j != daemon_local->sock)
131 #ifdef DLT_SYSTEMD_WATCHDOG_ENABLE
132 && (j!=daemon_local->timer_wd)
134 && (j!=daemon_local->timer_one_s) && (j!=daemon_local->timer_sixty_s))
139 DLT_DAEMON_SEM_LOCK();
141 if((ret=dlt_daemon_serial_send(j,data1,size1,data2,size2,daemon->sendserialheader)))
143 DLT_DAEMON_SEM_FREE();
144 dlt_log(LOG_WARNING,"dlt_daemon_client_send: serial send dlt message failed\n");
148 DLT_DAEMON_SEM_FREE();
152 DLT_DAEMON_SEM_LOCK();
154 if((ret=dlt_daemon_socket_send(j,data1,size1,data2,size2,daemon->sendserialheader)))
156 DLT_DAEMON_SEM_FREE();
157 dlt_log(LOG_WARNING,"dlt_daemon_client_send: socket send dlt message failed\n");
158 dlt_daemon_close_socket(j, daemon, daemon_local, verbose);
162 DLT_DAEMON_SEM_FREE();
169 if((sock==DLT_DAEMON_SEND_FORCE) && !sent)
171 return DLT_DAEMON_ERROR_SEND_FAILED;
176 /* Message was not sent to client, so store it in client ringbuffer */
177 if ((sock!=DLT_DAEMON_SEND_FORCE) && (daemon->state == DLT_DAEMON_STATE_BUFFER || daemon->state == DLT_DAEMON_STATE_SEND_BUFFER || daemon->state == DLT_DAEMON_STATE_BUFFER_FULL))
179 if(daemon->state == DLT_DAEMON_STATE_BUFFER_FULL)
180 return DLT_DAEMON_ERROR_BUFFER_FULL;
182 DLT_DAEMON_SEM_LOCK();
183 /* Store message in history buffer */
184 if (dlt_buffer_push3(&(daemon->client_ringbuffer),data1,size1,data2,size2,0, 0)<0)
186 DLT_DAEMON_SEM_FREE();
187 dlt_log(LOG_DEBUG,"dlt_daemon_client_send: Buffer is full! Message discarded.\n");
188 dlt_daemon_change_state(daemon,DLT_DAEMON_STATE_BUFFER_FULL);
189 return DLT_DAEMON_ERROR_BUFFER_FULL;
191 DLT_DAEMON_SEM_FREE();
194 return DLT_DAEMON_ERROR_OK;
198 int dlt_daemon_client_send_control_message( int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, DltMessage *msg, char* appid, char* ctid, int verbose)
203 PRINT_FUNCTION_VERBOSE(verbose);
205 if ((daemon==0) || (msg==0) || (appid==0) || (ctid==0))
207 return DLT_DAEMON_ERROR_UNKNOWN;
210 /* prepare storage header */
211 msg->storageheader = (DltStorageHeader*)msg->headerbuffer;
213 if (dlt_set_storageheader(msg->storageheader,daemon->ecuid)==-1)
215 return DLT_DAEMON_ERROR_UNKNOWN;
218 /* prepare standard header */
219 msg->standardheader = (DltStandardHeader*)(msg->headerbuffer + sizeof(DltStorageHeader));
220 msg->standardheader->htyp = DLT_HTYP_WEID | DLT_HTYP_WTMS | DLT_HTYP_UEH | DLT_HTYP_PROTOCOL_VERSION1 ;
222 #if (BYTE_ORDER==BIG_ENDIAN)
223 msg->standardheader->htyp = ( msg->standardheader->htyp | DLT_HTYP_MSBF);
226 msg->standardheader->mcnt = 0;
228 /* Set header extra parameters */
229 dlt_set_id(msg->headerextra.ecu,daemon->ecuid);
231 //msg->headerextra.seid = 0;
233 msg->headerextra.tmsp = dlt_uptime();
235 dlt_message_set_extraparameters(msg, verbose);
237 /* prepare extended header */
238 msg->extendedheader = (DltExtendedHeader*)(msg->headerbuffer + sizeof(DltStorageHeader) + sizeof(DltStandardHeader) + DLT_STANDARD_HEADER_EXTRA_SIZE(msg->standardheader->htyp));
239 msg->extendedheader->msin = DLT_MSIN_CONTROL_RESPONSE;
241 msg->extendedheader->noar = 1; /* number of arguments */
242 if (strcmp(appid,"")==0)
244 dlt_set_id(msg->extendedheader->apid,DLT_DAEMON_CTRL_APID); /* application id */
248 dlt_set_id(msg->extendedheader->apid, appid);
250 if (strcmp(ctid,"")==0)
252 dlt_set_id(msg->extendedheader->ctid,DLT_DAEMON_CTRL_CTID); /* context id */
256 dlt_set_id(msg->extendedheader->ctid, ctid);
259 /* prepare length information */
260 msg->headersize = sizeof(DltStorageHeader) + sizeof(DltStandardHeader) + sizeof(DltExtendedHeader) + DLT_STANDARD_HEADER_EXTRA_SIZE(msg->standardheader->htyp);
262 len=msg->headersize - sizeof(DltStorageHeader) + msg->datasize;
265 dlt_log(LOG_CRIT,"Huge control message discarded!\n");
266 return DLT_DAEMON_ERROR_UNKNOWN;
269 msg->standardheader->len = DLT_HTOBE_16(((uint16_t)len));
271 if((ret=dlt_daemon_client_send(sock,daemon,daemon_local,msg->headerbuffer+sizeof(DltStorageHeader),msg->headersize-sizeof(DltStorageHeader),
272 msg->databuffer,msg->datasize,verbose)))
274 dlt_log(LOG_DEBUG,"dlt_daemon_control_send_control_message: DLT message send to all failed!.\n");
278 return DLT_DAEMON_ERROR_OK;
281 int dlt_daemon_client_process_control(int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, DltMessage *msg, int verbose)
283 uint32_t id,id_tmp=0;
285 PRINT_FUNCTION_VERBOSE(verbose);
287 if ((daemon==0) || (msg==0))
292 if (msg->datasize < (int32_t)sizeof(uint32_t))
297 id_tmp = *((uint32_t*)(msg->databuffer));
298 id=DLT_ENDIAN_GET_32(msg->standardheader->htyp ,id_tmp);
300 if ((id > 0) && (id <= DLT_SERVICE_ID_MESSAGE_BUFFER_OVERFLOW))
302 /* Control message handling */
305 case DLT_SERVICE_ID_SET_LOG_LEVEL:
307 dlt_daemon_control_set_log_level(sock, daemon, daemon_local, msg, verbose);
310 case DLT_SERVICE_ID_SET_TRACE_STATUS:
312 dlt_daemon_control_set_trace_status(sock, daemon, daemon_local, msg, verbose);
315 case DLT_SERVICE_ID_GET_LOG_INFO:
317 dlt_daemon_control_get_log_info(sock, daemon, daemon_local, msg, verbose);
320 case DLT_SERVICE_ID_GET_DEFAULT_LOG_LEVEL:
322 dlt_daemon_control_get_default_log_level(sock, daemon, daemon_local, verbose);
325 case DLT_SERVICE_ID_STORE_CONFIG:
327 if (dlt_daemon_applications_save(daemon, daemon->runtime_application_cfg, verbose)==0)
329 if (dlt_daemon_contexts_save(daemon, daemon->runtime_context_cfg, verbose)==0)
331 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_OK, verbose);
335 /* Delete saved files */
336 dlt_daemon_control_reset_to_factory_default(daemon, daemon->runtime_application_cfg, daemon->runtime_context_cfg, verbose);
337 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_ERROR, verbose);
342 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_ERROR, verbose);
346 case DLT_SERVICE_ID_RESET_TO_FACTORY_DEFAULT:
348 dlt_daemon_control_reset_to_factory_default(daemon, daemon->runtime_application_cfg, daemon->runtime_context_cfg, verbose);
349 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_OK, verbose);
352 case DLT_SERVICE_ID_SET_COM_INTERFACE_STATUS:
354 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_NOT_SUPPORTED, verbose);
357 case DLT_SERVICE_ID_SET_COM_INTERFACE_MAX_BANDWIDTH:
359 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_NOT_SUPPORTED, verbose);
362 case DLT_SERVICE_ID_SET_VERBOSE_MODE:
364 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_NOT_SUPPORTED, verbose);
367 case DLT_SERVICE_ID_SET_MESSAGE_FILTERING:
369 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_NOT_SUPPORTED, verbose);
372 case DLT_SERVICE_ID_SET_TIMING_PACKETS:
374 dlt_daemon_control_set_timing_packets(sock, daemon, daemon_local, msg, verbose);
377 case DLT_SERVICE_ID_GET_LOCAL_TIME:
379 /* Send response with valid timestamp (TMSP) field */
380 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_OK, verbose);
383 case DLT_SERVICE_ID_USE_ECU_ID:
385 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_NOT_SUPPORTED, verbose);
388 case DLT_SERVICE_ID_USE_SESSION_ID:
390 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_NOT_SUPPORTED, verbose);
393 case DLT_SERVICE_ID_USE_TIMESTAMP:
395 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_NOT_SUPPORTED, verbose);
398 case DLT_SERVICE_ID_USE_EXTENDED_HEADER:
400 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_NOT_SUPPORTED, verbose);
403 case DLT_SERVICE_ID_SET_DEFAULT_LOG_LEVEL:
405 dlt_daemon_control_set_default_log_level(sock, daemon, daemon_local, msg, verbose);
408 case DLT_SERVICE_ID_SET_DEFAULT_TRACE_STATUS:
410 dlt_daemon_control_set_default_trace_status(sock, daemon, daemon_local, msg, verbose);
413 case DLT_SERVICE_ID_GET_SOFTWARE_VERSION:
415 dlt_daemon_control_get_software_version(sock, daemon, daemon_local, verbose);
418 case DLT_SERVICE_ID_MESSAGE_BUFFER_OVERFLOW:
420 dlt_daemon_control_message_buffer_overflow(sock, daemon, daemon_local, daemon->overflow_counter,"",verbose);
425 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_NOT_SUPPORTED, verbose);
432 /* Injection handling */
433 dlt_daemon_control_callsw_cinjection(sock, daemon, daemon_local, msg, verbose);
439 void dlt_daemon_control_get_software_version(int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose)
443 DltServiceGetSoftwareVersionResponse *resp;
445 PRINT_FUNCTION_VERBOSE(verbose);
452 /* initialise new message */
453 if (dlt_message_init(&msg,0)==-1)
455 dlt_daemon_control_service_response(sock, daemon,daemon_local, DLT_SERVICE_ID_GET_SOFTWARE_VERSION, DLT_SERVICE_RESPONSE_ERROR, verbose);
459 /* prepare payload of data */
460 len = strlen(daemon->ECUVersionString);
462 msg.datasize = sizeof(DltServiceGetSoftwareVersionResponse) + len;
463 if (msg.databuffer && (msg.databuffersize < msg.datasize))
465 free(msg.databuffer);
468 if (msg.databuffer == 0){
469 msg.databuffer = (uint8_t *) malloc(msg.datasize);
470 msg.databuffersize = msg.datasize;
472 if (msg.databuffer==0)
474 dlt_daemon_control_service_response(sock, daemon,daemon_local, DLT_SERVICE_ID_GET_SOFTWARE_VERSION, DLT_SERVICE_RESPONSE_ERROR, verbose);
478 resp = (DltServiceGetSoftwareVersionResponse*) msg.databuffer;
479 resp->service_id = DLT_SERVICE_ID_GET_SOFTWARE_VERSION;
480 resp->status = DLT_SERVICE_RESPONSE_OK;
482 memcpy(msg.databuffer+sizeof(DltServiceGetSoftwareVersionResponse),daemon->ECUVersionString,len);
485 dlt_daemon_client_send_control_message(sock, daemon,daemon_local, &msg,"","", verbose);
488 dlt_message_free(&msg,0);
491 void dlt_daemon_control_get_default_log_level(int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose)
494 DltServiceGetDefaultLogLevelResponse *resp;
496 PRINT_FUNCTION_VERBOSE(verbose);
503 /* initialise new message */
504 if (dlt_message_init(&msg,0)==-1)
506 dlt_daemon_control_service_response(sock, daemon,daemon_local, DLT_SERVICE_ID_GET_DEFAULT_LOG_LEVEL, DLT_SERVICE_RESPONSE_ERROR, verbose);
510 msg.datasize = sizeof(DltServiceGetDefaultLogLevelResponse);
511 if (msg.databuffer && (msg.databuffersize<msg.datasize))
513 free(msg.databuffer);
516 if (msg.databuffer == 0){
517 msg.databuffer = (uint8_t *) malloc(msg.datasize);
518 msg.databuffersize = msg.datasize;
520 if (msg.databuffer==0)
522 dlt_daemon_control_service_response(sock, daemon,daemon_local, DLT_SERVICE_ID_GET_DEFAULT_LOG_LEVEL, DLT_SERVICE_RESPONSE_ERROR, verbose);
526 resp = (DltServiceGetDefaultLogLevelResponse*) msg.databuffer;
527 resp->service_id = DLT_SERVICE_ID_GET_DEFAULT_LOG_LEVEL;
528 resp->status = DLT_SERVICE_RESPONSE_OK;
529 resp->log_level = daemon->default_log_level;
532 dlt_daemon_client_send_control_message(sock,daemon,daemon_local,&msg,"","", verbose);
535 dlt_message_free(&msg,0);
538 void dlt_daemon_control_get_log_info(int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, DltMessage *msg, int verbose)
540 DltServiceGetLogInfoRequest *req;
542 DltDaemonContext *context=0;
543 DltDaemonApplication *application=0;
545 int num_applications=0, num_contexts=0;
546 uint16_t count_app_ids=0, count_con_ids=0;
548 #if (DLT_DEBUG_GETLOGINFO==1)
552 int32_t i,j,offset=0;
562 PRINT_FUNCTION_VERBOSE(verbose);
564 if ((daemon==0) || (msg==0))
569 /* prepare pointer to message request */
570 req = (DltServiceGetLogInfoRequest*) (msg->databuffer);
572 /* initialise new message */
573 if (dlt_message_init(&resp,0)==-1)
575 dlt_daemon_control_service_response(sock, daemon,daemon_local, DLT_SERVICE_ID_GET_LOG_INFO, DLT_SERVICE_RESPONSE_ERROR, verbose);
580 if ((req->options < 3 ) || (req->options>7))
582 dlt_daemon_control_service_response(sock, daemon,daemon_local, DLT_SERVICE_ID_GET_LOG_INFO, DLT_SERVICE_RESPONSE_ERROR, verbose);
586 if (req->apid[0]!='\0')
588 application = dlt_daemon_application_find(daemon, req->apid, verbose);
591 num_applications = 1;
592 if (req->ctid[0]!='\0')
594 context = dlt_daemon_context_find(daemon, req->apid, req->ctid, verbose);
596 num_contexts = ((context)?1:0);
600 num_contexts = application->num_contexts;
605 num_applications = 0;
611 /* Request all applications and contexts */
612 num_applications = daemon->num_applications;
613 num_contexts = daemon->num_contexts;
616 /* prepare payload of data */
618 /* Calculate maximum size for a response */
619 resp.datasize = sizeof(uint32_t) /* SID */ + sizeof(int8_t) /* status*/ + sizeof(ID4) /* DLT_DAEMON_REMO_STRING */;
621 sizecont = sizeof(uint32_t) /* context_id */;
623 /* Add additional size for response of Mode 4, 6, 7 */
624 if ((req->options==4) || (req->options==6) || (req->options==7))
626 sizecont += sizeof(int8_t); /* log level */
629 /* Add additional size for response of Mode 5, 6, 7 */
630 if ((req->options==5) || (req->options==6) || (req->options==7))
632 sizecont+= sizeof(int8_t); /* trace status */
635 resp.datasize+= (num_applications * (sizeof(uint32_t) /* app_id */ + sizeof(uint16_t) /* count_con_ids */)) +
636 (num_contexts * sizecont);
638 resp.datasize+= sizeof(uint16_t) /* count_app_ids */;
640 /* Add additional size for response of Mode 7 */
643 if (req->apid[0]!='\0')
645 if (req->ctid[0]!='\0')
647 /* One application, one context */
648 // context = dlt_daemon_context_find(daemon, req->apid, req->ctid, verbose);
651 resp.datasize+=sizeof(uint16_t) /* len_context_description */;
652 if (context->context_description!=0)
654 resp.datasize+=strlen(context->context_description); /* context_description */
660 /* One application, all contexts */
661 if ((daemon->applications) && (application))
663 /* Calculate start offset within contexts[] */
665 for (i=0; i<(application-(daemon->applications)); i++)
667 offset_base+=daemon->applications[i].num_contexts;
670 /* Iterate over all contexts belonging to this application */
671 for (j=0;j<application->num_contexts;j++)
674 context = &(daemon->contexts[offset_base+j]);
677 resp.datasize+=sizeof(uint16_t) /* len_context_description */;
678 if (context->context_description!=0)
680 resp.datasize+=strlen(context->context_description); /* context_description */
687 /* Space for application description */
690 resp.datasize+=sizeof(uint16_t) /* len_app_description */;
691 if (application->application_description!=0)
693 resp.datasize+=strlen(application->application_description); /* app_description */
699 /* All applications, all contexts */
700 for (i=0;i<daemon->num_contexts;i++)
702 resp.datasize+=sizeof(uint16_t) /* len_context_description */;
703 if (daemon->contexts[i].context_description!=0)
705 resp.datasize+=strlen(daemon->contexts[i].context_description); /* context_description */
709 for (i=0;i<daemon->num_applications;i++)
711 resp.datasize+=sizeof(uint16_t) /* len_app_description */;
712 if (daemon->applications[i].application_description!=0)
714 resp.datasize+=strlen(daemon->applications[i].application_description); /* app_description */
722 sprintf(str,"Allocate %d bytes for response msg databuffer\n", resp.datasize);
723 dlt_log(LOG_INFO, str);
726 /* Allocate buffer for response message */
727 resp.databuffer = (uint8_t *) malloc(resp.datasize);
728 resp.databuffersize = resp.datasize;
730 if (resp.databuffer==0)
732 dlt_daemon_control_service_response(sock, daemon,daemon_local, DLT_SERVICE_ID_GET_LOG_INFO, DLT_SERVICE_RESPONSE_ERROR, verbose);
735 memset(resp.databuffer,0,resp.datasize);
736 /* Preparation finished */
738 /* Prepare response */
739 sid = DLT_SERVICE_ID_GET_LOG_INFO;
740 memcpy(resp.databuffer,&sid,sizeof(uint32_t));
741 offset+=sizeof(uint32_t);
743 value = (((num_applications!=0)&&(num_contexts!=0))?req->options:8); /* 8 = no matching context found */
745 memcpy(resp.databuffer+offset,&value,sizeof(int8_t));
746 offset+=sizeof(int8_t);
748 count_app_ids = num_applications;
750 if (count_app_ids!=0)
752 memcpy(resp.databuffer+offset,&count_app_ids,sizeof(uint16_t));
753 offset+=sizeof(uint16_t);
755 #if (DLT_DEBUG_GETLOGINFO==1)
756 sprintf(str,"#apid: %d \n", count_app_ids);
757 dlt_log(LOG_DEBUG, str);
760 for (i=0;i<count_app_ids;i++)
762 if (req->apid[0]!='\0')
768 if (daemon->applications)
770 apid = daemon->applications[i].apid;
774 /* This should never occur! */
779 application = dlt_daemon_application_find(daemon, apid, verbose);
783 /* Calculate start offset within contexts[] */
785 for (j=0; j<(application-(daemon->applications)); j++)
787 offset_base+=daemon->applications[j].num_contexts;
790 dlt_set_id((char*)(resp.databuffer+offset),apid);
793 #if (DLT_DEBUG_GETLOGINFO==1)
794 dlt_print_id(buf, apid);
795 sprintf(str,"apid: %s\n",buf);
796 dlt_log(LOG_DEBUG, str);
799 if (req->apid[0]!='\0')
801 count_con_ids = num_contexts;
805 count_con_ids = application->num_contexts;
808 memcpy(resp.databuffer+offset,&count_con_ids,sizeof(uint16_t));
809 offset+=sizeof(uint16_t);
811 #if (DLT_DEBUG_GETLOGINFO==1)
812 sprintf(str,"#ctid: %d \n", count_con_ids);
813 dlt_log(LOG_DEBUG, str);
816 for (j=0;j<count_con_ids;j++)
818 #if (DLT_DEBUG_GETLOGINFO==1)
819 sprintf(str,"j: %d \n",j);
820 dlt_log(LOG_DEBUG, str);
822 if (!((count_con_ids==1) && (req->apid[0]!='\0') && (req->ctid[0]!='\0')))
824 context = &(daemon->contexts[offset_base+j]);
826 /* else: context was already searched and found
827 (one application (found) with one context (found))*/
830 ((req->ctid[0]=='\0') ||
831 ((req->ctid[0]!='\0') && (memcmp(context->ctid,req->ctid,DLT_ID_SIZE)==0)))
834 dlt_set_id((char*)(resp.databuffer+offset),context->ctid);
837 #if (DLT_DEBUG_GETLOGINFO==1)
838 dlt_print_id(buf, context->ctid);
839 sprintf(str,"ctid: %s \n",buf);
840 dlt_log(LOG_DEBUG, str);
844 if ((req->options==4) || (req->options==6) || (req->options==7))
846 ll=context->log_level;
847 memcpy(resp.databuffer+offset,&ll,sizeof(int8_t));
848 offset+=sizeof(int8_t);
852 if ((req->options==5) || (req->options==6) || (req->options==7))
854 ts=context->trace_status;
855 memcpy(resp.databuffer+offset,&ts,sizeof(int8_t));
856 offset+=sizeof(int8_t);
862 if (context->context_description)
864 len = strlen(context->context_description);
865 memcpy(resp.databuffer+offset,&len,sizeof(uint16_t));
866 offset+=sizeof(uint16_t);
867 memcpy(resp.databuffer+offset,context->context_description,strlen(context->context_description));
868 offset+=strlen(context->context_description);
873 memcpy(resp.databuffer+offset,&len,sizeof(uint16_t));
874 offset+=sizeof(uint16_t);
878 #if (DLT_DEBUG_GETLOGINFO==1)
879 sprintf(str,"ll=%d ts=%d \n",(int32_t)ll,(int32_t)ts);
880 dlt_log(LOG_DEBUG, str);
884 #if (DLT_DEBUG_GETLOGINFO==1)
885 dlt_log(LOG_DEBUG,"\n");
892 if (application->application_description)
894 len = strlen(application->application_description);
895 memcpy(resp.databuffer+offset,&len,sizeof(uint16_t));
896 offset+=sizeof(uint16_t);
897 memcpy(resp.databuffer+offset,application->application_description,strlen(application->application_description));
898 offset+=strlen(application->application_description);
903 memcpy(resp.databuffer+offset,&len,sizeof(uint16_t));
904 offset+=sizeof(uint16_t);
907 } /* if (application) */
908 } /* for (i=0;i<count_app_ids;i++) */
909 } /* if (count_app_ids!=0) */
911 dlt_set_id((char*)(resp.databuffer+offset),DLT_DAEMON_REMO_STRING);
914 dlt_daemon_client_send_control_message(sock,daemon,daemon_local,&resp,"","", verbose);
917 dlt_message_free(&resp,0);
920 int dlt_daemon_control_message_buffer_overflow(int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, unsigned int overflow_counter,char* apid, int verbose)
924 DltServiceMessageBufferOverflowResponse *resp;
926 PRINT_FUNCTION_VERBOSE(verbose);
930 return DLT_DAEMON_ERROR_UNKNOWN;
933 /* initialise new message */
934 if (dlt_message_init(&msg,0)==-1)
936 dlt_daemon_control_service_response(sock, daemon,daemon_local, DLT_SERVICE_ID_MESSAGE_BUFFER_OVERFLOW, DLT_SERVICE_RESPONSE_ERROR, verbose);
937 return DLT_DAEMON_ERROR_UNKNOWN;
940 /* prepare payload of data */
941 msg.datasize = sizeof(DltServiceMessageBufferOverflowResponse);
942 if (msg.databuffer && (msg.databuffersize < msg.datasize))
944 free(msg.databuffer);
947 if (msg.databuffer == 0){
948 msg.databuffer = (uint8_t *) malloc(msg.datasize);
949 msg.databuffersize = msg.datasize;
951 if (msg.databuffer==0)
953 return DLT_DAEMON_ERROR_UNKNOWN;
956 resp = (DltServiceMessageBufferOverflowResponse*) msg.databuffer;
957 resp->service_id = DLT_SERVICE_ID_MESSAGE_BUFFER_OVERFLOW;
958 resp->status = DLT_SERVICE_RESPONSE_OK;
959 resp->overflow = DLT_MESSAGE_BUFFER_OVERFLOW;
960 resp->overflow_counter = overflow_counter;
963 if((ret=dlt_daemon_client_send_control_message(sock,daemon,daemon_local,&msg,apid,"", verbose)))
965 dlt_message_free(&msg,0);
970 dlt_message_free(&msg,0);
972 return DLT_DAEMON_ERROR_OK;
975 void dlt_daemon_control_service_response( int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, uint32_t service_id, int8_t status , int verbose)
978 DltServiceResponse *resp;
980 PRINT_FUNCTION_VERBOSE(verbose);
987 /* initialise new message */
988 if (dlt_message_init(&msg,0)==-1)
993 /* prepare payload of data */
994 msg.datasize = sizeof(DltServiceResponse);
995 if (msg.databuffer && (msg.databuffersize < msg.datasize))
997 free(msg.databuffer);
1000 if (msg.databuffer == 0){
1001 msg.databuffer = (uint8_t *) malloc(msg.datasize);
1002 msg.databuffersize = msg.datasize;
1004 if (msg.databuffer==0)
1009 resp = (DltServiceResponse*) msg.databuffer;
1010 resp->service_id = service_id;
1011 resp->status = status;
1014 dlt_daemon_client_send_control_message(sock,daemon,daemon_local,&msg,"","", verbose);
1017 dlt_message_free(&msg,0);
1020 int dlt_daemon_control_message_unregister_context(int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, char* apid, char* ctid, char* comid, int verbose)
1023 DltServiceUnregisterContext *resp;
1025 PRINT_FUNCTION_VERBOSE(verbose);
1032 /* initialise new message */
1033 if (dlt_message_init(&msg,0)==-1)
1038 /* prepare payload of data */
1039 msg.datasize = sizeof(DltServiceUnregisterContext);
1040 if (msg.databuffer && (msg.databuffersize < msg.datasize))
1042 free(msg.databuffer);
1045 if (msg.databuffer == 0){
1046 msg.databuffer = (uint8_t *) malloc(msg.datasize);
1047 msg.databuffersize = msg.datasize;
1049 if (msg.databuffer==0)
1054 resp = (DltServiceUnregisterContext*) msg.databuffer;
1055 resp->service_id = DLT_SERVICE_ID_UNREGISTER_CONTEXT;
1056 resp->status = DLT_SERVICE_RESPONSE_OK;
1057 dlt_set_id(resp->apid, apid);
1058 dlt_set_id(resp->ctid, ctid);
1059 dlt_set_id(resp->comid, comid);
1062 if(dlt_daemon_client_send_control_message(sock,daemon,daemon_local,&msg,"","", verbose))
1064 dlt_message_free(&msg,0);
1069 dlt_message_free(&msg,0);
1074 int dlt_daemon_control_message_connection_info(int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, uint8_t state, char* comid, int verbose)
1077 DltServiceConnectionInfo *resp;
1079 PRINT_FUNCTION_VERBOSE(verbose);
1086 /* initialise new message */
1087 if (dlt_message_init(&msg,0)==-1)
1092 /* prepare payload of data */
1093 msg.datasize = sizeof(DltServiceConnectionInfo);
1094 if (msg.databuffer && (msg.databuffersize < msg.datasize))
1096 free(msg.databuffer);
1099 if (msg.databuffer == 0){
1100 msg.databuffer = (uint8_t *) malloc(msg.datasize);
1101 msg.databuffersize = msg.datasize;
1103 if (msg.databuffer==0)
1108 resp = (DltServiceConnectionInfo*) msg.databuffer;
1109 resp->service_id = DLT_SERVICE_ID_CONNECTION_INFO;
1110 resp->status = DLT_SERVICE_RESPONSE_OK;
1111 resp->state = state;
1112 dlt_set_id(resp->comid, comid);
1115 if(dlt_daemon_client_send_control_message(sock,daemon,daemon_local,&msg,"","", verbose))
1117 dlt_message_free(&msg,0);
1122 dlt_message_free(&msg,0);
1127 int dlt_daemon_control_message_timezone(int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose)
1130 DltServiceTimezone *resp;
1132 PRINT_FUNCTION_VERBOSE(verbose);
1139 /* initialise new message */
1140 if (dlt_message_init(&msg,0)==-1)
1145 /* prepare payload of data */
1146 msg.datasize = sizeof(DltServiceTimezone);
1147 if (msg.databuffer && (msg.databuffersize < msg.datasize))
1149 free(msg.databuffer);
1152 if (msg.databuffer == 0){
1153 msg.databuffer = (uint8_t *) malloc(msg.datasize);
1154 msg.databuffersize = msg.datasize;
1156 if (msg.databuffer==0)
1161 resp = (DltServiceTimezone*) msg.databuffer;
1162 resp->service_id = DLT_SERVICE_ID_TIMEZONE;
1163 resp->status = DLT_SERVICE_RESPONSE_OK;
1165 time_t t = time(NULL);
1167 localtime_r(&t, <);
1168 #if !defined(__CYGWIN__)
1169 resp->timezone = (int32_t) lt.tm_gmtoff;
1171 resp->isdst = (uint8_t) lt.tm_isdst;
1174 if(dlt_daemon_client_send_control_message(sock,daemon,daemon_local,&msg,"","", verbose))
1176 dlt_message_free(&msg,0);
1181 dlt_message_free(&msg,0);
1186 void dlt_daemon_control_callsw_cinjection(int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, DltMessage *msg, int verbose)
1188 char apid[DLT_ID_SIZE],ctid[DLT_ID_SIZE];
1189 uint32_t id=0,id_tmp=0;
1191 DltDaemonContext *context;
1192 int32_t data_length_inject=0;
1193 uint32_t data_length_inject_tmp=0;
1197 DltUserHeader userheader;
1198 DltUserControlMsgInjection usercontext;
1199 uint8_t *userbuffer;
1201 PRINT_FUNCTION_VERBOSE(verbose);
1203 if ((daemon==0) || (msg==0))
1208 datalength = msg->datasize;
1209 ptr = msg->databuffer;
1216 DLT_MSG_READ_VALUE(id_tmp,ptr,datalength,uint32_t); /* Get service id */
1217 id=DLT_ENDIAN_GET_32(msg->standardheader->htyp, id_tmp);
1219 if ((id>=DLT_DAEMON_INJECTION_MIN) && (id<=DLT_DAEMON_INJECTION_MAX))
1221 /* This a a real SW-C injection call */
1222 data_length_inject=0;
1223 data_length_inject_tmp=0;
1225 DLT_MSG_READ_VALUE(data_length_inject_tmp,ptr,datalength,uint32_t); /* Get data length */
1226 data_length_inject=DLT_ENDIAN_GET_32(msg->standardheader->htyp, data_length_inject_tmp);
1228 /* Get context handle for apid, ctid (and seid) */
1229 /* Warning: seid is ignored in this implementation! */
1230 if (DLT_IS_HTYP_UEH(msg->standardheader->htyp))
1232 dlt_set_id(apid, msg->extendedheader->apid);
1233 dlt_set_id(ctid, msg->extendedheader->ctid);
1237 /* No extended header, and therefore no apid and ctid available */
1238 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_ERROR, verbose);
1242 /* At this point, apid and ctid is available */
1243 context=dlt_daemon_context_find(daemon, apid, ctid, verbose);
1247 // dlt_log(LOG_INFO,"No context found!\n");
1248 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_ERROR, verbose);
1252 /* Send user message to handle, specified in context */
1253 if (dlt_user_set_userheader(&userheader, DLT_USER_MESSAGE_INJECTION)==-1)
1255 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_ERROR, verbose);
1259 usercontext.log_level_pos = context->log_level_pos;
1261 if(data_length_inject > msg->databuffersize)
1263 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_ERROR, verbose);
1267 userbuffer = malloc(data_length_inject);
1271 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_ERROR, verbose);
1275 usercontext.data_length_inject = data_length_inject;
1276 usercontext.service_id = id;
1278 memcpy(userbuffer,ptr,data_length_inject); /* Copy received injection to send buffer */
1281 DltReturnValue ret =
1282 dlt_user_log_out3(context->user_handle, &(userheader), sizeof(DltUserHeader),
1283 &(usercontext), sizeof(DltUserControlMsgInjection),
1284 userbuffer, data_length_inject);
1285 if (ret != DLT_RETURN_OK)
1287 if (ret == DLT_RETURN_PIPE_ERROR)
1289 /* Close connection */
1290 close(context->user_handle);
1291 context->user_handle=DLT_FD_INIT;
1293 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_ERROR, verbose);
1297 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_OK, verbose);
1307 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_NOT_SUPPORTED, verbose);
1311 void dlt_daemon_control_set_log_level(int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, DltMessage *msg, int verbose)
1313 PRINT_FUNCTION_VERBOSE(verbose);
1315 char apid[DLT_ID_SIZE],ctid[DLT_ID_SIZE];
1316 DltServiceSetLogLevel *req;
1317 DltDaemonContext *context;
1318 int32_t id=DLT_SERVICE_ID_SET_LOG_LEVEL;
1320 int8_t old_log_level;
1322 if ((daemon==0) || (msg==0))
1327 req = (DltServiceSetLogLevel*) (msg->databuffer);
1329 dlt_set_id(apid, req->apid);
1330 dlt_set_id(ctid, req->ctid);
1332 context=dlt_daemon_context_find(daemon, apid, ctid, verbose);
1337 old_log_level = context->log_level;
1338 context->log_level = req->log_level; /* No endianess conversion necessary*/
1340 if ((context->user_handle >= DLT_FD_MINIMUM) &&
1341 (dlt_daemon_user_send_log_level(daemon, context, verbose)==0))
1343 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_OK, verbose);
1347 //dlt_log(LOG_ERR, "Log level could not be sent!\n");
1348 context->log_level = old_log_level;
1349 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_ERROR, verbose);
1354 //dlt_log(LOG_ERR, "Context not found!\n");
1355 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_ERROR, verbose);
1359 void dlt_daemon_control_set_trace_status(int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, DltMessage *msg, int verbose)
1361 PRINT_FUNCTION_VERBOSE(verbose);
1363 char apid[DLT_ID_SIZE],ctid[DLT_ID_SIZE];
1364 DltServiceSetLogLevel *req; /* request uses same struct as set log level */
1365 DltDaemonContext *context;
1366 int32_t id=DLT_SERVICE_ID_SET_TRACE_STATUS;
1368 int8_t old_trace_status;
1370 if ((daemon==0) || (msg==0))
1375 req = (DltServiceSetLogLevel*) (msg->databuffer);
1377 dlt_set_id(apid, req->apid);
1378 dlt_set_id(ctid, req->ctid);
1380 context=dlt_daemon_context_find(daemon, apid, ctid, verbose);
1385 old_trace_status = context->trace_status;
1386 context->trace_status = req->log_level; /* No endianess conversion necessary */
1388 if ((context->user_handle >= DLT_FD_MINIMUM ) &&
1389 (dlt_daemon_user_send_log_level(daemon, context, verbose)==0))
1391 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_OK, verbose);
1395 //dlt_log(LOG_ERR, "Trace Status could not be sent!\n");
1396 context->trace_status = old_trace_status;
1397 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_ERROR, verbose);
1402 //dlt_log(LOG_ERR, "Context not found!\n");
1403 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_ERROR, verbose);
1407 void dlt_daemon_control_set_default_log_level(int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, DltMessage *msg, int verbose)
1409 PRINT_FUNCTION_VERBOSE(verbose);
1411 DltServiceSetDefaultLogLevel *req;
1412 int32_t id=DLT_SERVICE_ID_SET_DEFAULT_LOG_LEVEL;
1414 if ((daemon==0) || (msg==0))
1419 req = (DltServiceSetDefaultLogLevel*) (msg->databuffer);
1421 /* No endianess conversion necessary */
1422 if (/*(req->log_level>=0) &&*/
1423 (req->log_level<=DLT_LOG_VERBOSE))
1425 daemon->default_log_level = req->log_level; /* No endianess conversion necessary */
1427 /* Send Update to all contexts using the default log level */
1428 dlt_daemon_user_send_default_update(daemon, verbose);
1430 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_OK, verbose);
1434 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_ERROR, verbose);
1438 void dlt_daemon_control_set_default_trace_status(int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, DltMessage *msg, int verbose)
1440 PRINT_FUNCTION_VERBOSE(verbose);
1442 /* Payload of request message */
1443 DltServiceSetDefaultLogLevel *req;
1444 int32_t id=DLT_SERVICE_ID_SET_DEFAULT_TRACE_STATUS;
1446 if ((daemon==0) || (msg==0))
1451 req = (DltServiceSetDefaultLogLevel*) (msg->databuffer);
1453 /* No endianess conversion necessary */
1454 if ((req->log_level==DLT_TRACE_STATUS_OFF) ||
1455 (req->log_level==DLT_TRACE_STATUS_ON))
1457 daemon->default_trace_status = req->log_level; /* No endianess conversion necessary*/
1459 /* Send Update to all contexts using the default trace status */
1460 dlt_daemon_user_send_default_update(daemon, verbose);
1462 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_OK, verbose);
1466 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_ERROR, verbose);
1470 void dlt_daemon_control_set_timing_packets(int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, DltMessage *msg, int verbose)
1472 PRINT_FUNCTION_VERBOSE(verbose);
1474 DltServiceSetVerboseMode *req; /* request uses same struct as set verbose mode */
1475 int32_t id=DLT_SERVICE_ID_SET_TIMING_PACKETS;
1477 if ((daemon==0) || (msg==0))
1482 req = (DltServiceSetVerboseMode*) (msg->databuffer);
1483 if ((req->new_status==0) || (req->new_status==1))
1485 daemon->timingpackets = req->new_status;
1487 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_OK, verbose);
1491 dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_ERROR, verbose);
1495 void dlt_daemon_control_message_time(int sock, DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose)
1501 PRINT_FUNCTION_VERBOSE(verbose);
1508 /* initialise new message */
1509 if (dlt_message_init(&msg,0)==-1)
1516 /* prepare storage header */
1517 msg.storageheader = (DltStorageHeader*)msg.headerbuffer;
1518 dlt_set_storageheader(msg.storageheader,daemon->ecuid);
1520 /* prepare standard header */
1521 msg.standardheader = (DltStandardHeader*)(msg.headerbuffer + sizeof(DltStorageHeader));
1522 msg.standardheader->htyp = DLT_HTYP_WEID | DLT_HTYP_WTMS | DLT_HTYP_UEH | DLT_HTYP_PROTOCOL_VERSION1 ;
1524 #if (BYTE_ORDER==BIG_ENDIAN)
1525 msg.standardheader->htyp = ( msg.standardheader->htyp | DLT_HTYP_MSBF);
1528 msg.standardheader->mcnt = 0;
1530 /* Set header extra parameters */
1531 dlt_set_id(msg.headerextra.ecu,daemon->ecuid);
1532 msg.headerextra.tmsp = dlt_uptime();
1534 dlt_message_set_extraparameters(&msg, verbose);
1536 /* prepare extended header */
1537 msg.extendedheader = (DltExtendedHeader*)(msg.headerbuffer + sizeof(DltStorageHeader) + sizeof(DltStandardHeader) + DLT_STANDARD_HEADER_EXTRA_SIZE(msg.standardheader->htyp));
1538 msg.extendedheader->msin = DLT_MSIN_CONTROL_TIME;
1540 msg.extendedheader->noar = 0; /* number of arguments */
1541 dlt_set_id(msg.extendedheader->apid,""); /* application id */
1542 dlt_set_id(msg.extendedheader->ctid,""); /* context id */
1544 /* prepare length information */
1545 msg.headersize = sizeof(DltStorageHeader) + sizeof(DltStandardHeader) + sizeof(DltExtendedHeader) + DLT_STANDARD_HEADER_EXTRA_SIZE(msg.standardheader->htyp);
1547 len=msg.headersize - sizeof(DltStorageHeader) + msg.datasize;
1550 dlt_log(LOG_CRIT,"Huge control message discarded!\n");
1553 dlt_message_free(&msg,0);
1558 msg.standardheader->len = DLT_HTOBE_16(((uint16_t)len));
1561 if((ret = dlt_daemon_client_send(sock,daemon,daemon_local,msg.headerbuffer+sizeof(DltStorageHeader),msg.headersize-sizeof(DltStorageHeader),
1562 msg.databuffer,msg.datasize,verbose)))
1568 dlt_message_free(&msg,0);