diff options
Diffstat (limited to 'src/daemon')
-rwxr-xr-x | src/daemon/dlt-daemon.c | 117 | ||||
-rwxr-xr-x | src/daemon/dlt-daemon.h | 3 | ||||
-rwxr-xr-x | src/daemon/dlt_daemon_common.c | 18 | ||||
-rwxr-xr-x | src/daemon/dlt_daemon_common.h | 1 |
4 files changed, 5 insertions, 134 deletions
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c index f419442..19115b2 100755 --- a/src/daemon/dlt-daemon.c +++ b/src/daemon/dlt-daemon.c @@ -333,11 +333,6 @@ int option_file_parser(DltDaemonLocal *daemon_local) strncpy(daemon_local->flags.ovalue,value,sizeof(daemon_local->flags.ovalue)); printf("Option: %s=%s\n",token,value); } - else if(strcmp(token,"RingbufferSize")==0) - { - strncpy(daemon_local->flags.uvalue,value,sizeof(daemon_local->flags.uvalue)); - printf("Option: %s=%s\n",token,value); - } else if(strcmp(token,"PersistanceStoragePath")==0) { strncpy(daemon_local->flags.ivalue,value,sizeof(daemon_local->flags.ivalue)); @@ -579,18 +574,6 @@ int dlt_daemon_local_init_p2(DltDaemon *daemon, DltDaemonLocal *daemon_local, in /* Set flag for optional sending of serial header */ daemon->sendserialheader = daemon_local->flags.lflag; - /* prepare ringbuffer size */ - if (daemon_local->flags.uvalue[0]) - { - daemon_local->ringbufferSize = atoi(daemon_local->flags.uvalue); - } - else - { - daemon_local->ringbufferSize = DLT_DAEMON_RCVBUFSIZE; - } - sprintf(str,"Ringbuffer size: %d bytes\n",daemon_local->ringbufferSize); - dlt_log(LOG_NOTICE, str); - /* init shared memory */ if (dlt_shm_init_server(&(daemon_local->dlt_shm),DLT_SHM_KEY,daemon_local->flags.sharedMemorySize)==-1) { @@ -605,7 +588,7 @@ int dlt_daemon_local_init_p2(DltDaemon *daemon, DltDaemonLocal *daemon_local, in return -1; } - if (dlt_receiver_init(&(daemon_local->receiver),daemon_local->fp,daemon_local->ringbufferSize)==-1) + if (dlt_receiver_init(&(daemon_local->receiver),daemon_local->fp,DLT_DAEMON_RCVBUFSIZE)==-1) { dlt_log(LOG_ERR,"Could not initialize receiver\n"); return -1; @@ -615,7 +598,6 @@ int dlt_daemon_local_init_p2(DltDaemon *daemon, DltDaemonLocal *daemon_local, in dlt_log(LOG_ERR,"Could not initialize receiver for socket\n"); return -1; } - if (daemon_local->flags.yvalue[0]) { if (dlt_receiver_init(&(daemon_local->receiverSerial),daemon_local->fdserial,DLT_DAEMON_RCVBUFSIZESERIAL)==-1) @@ -991,15 +973,8 @@ int dlt_daemon_process_client_connect(DltDaemon *daemon, DltDaemonLocal *daemon_ if (daemon_local->client_connections==1) { - if (daemon_local->flags.vflag) - { - dlt_log(LOG_INFO, "Send ring-buffer to client\n"); - } - if (dlt_daemon_send_ringbuffer_to_client(daemon, daemon_local, verbose)==-1) - { - dlt_log(LOG_ERR,"Can't send contents of ringbuffer to clients\n"); - return -1; - } + /* send ringbuffer done in old implementation */ + /* nothing to do with shared memory */ } return 0; @@ -1828,14 +1803,6 @@ int dlt_daemon_process_user_message_log(DltDaemon *daemon, DltDaemonLocal *daemo /* dlt message was not sent, keep in buffer */ break; - /*if (dlt_ringbuffer_put3(&(daemon->client_ringbuffer), - daemon_local->msg.headerbuffer+sizeof(DltStorageHeader),daemon_local->msg.headersize-sizeof(DltStorageHeader), - daemon_local->msg.databuffer,daemon_local->msg.datasize, - 0, 0 - )<0) - { - dlt_log(LOG_ERR,"Storage of message in history buffer failed! Message discarded.\n"); - }*/ } else { @@ -1843,18 +1810,6 @@ int dlt_daemon_process_user_message_log(DltDaemon *daemon, DltDaemonLocal *daemo dlt_shm_remove(&(daemon_local->dlt_shm)); } - /* keep not read data in buffer */ - /*bytes_to_be_removed = daemon_local->msg.headersize+daemon_local->msg.datasize-sizeof(DltStorageHeader)+sizeof(DltUserHeader); - if (daemon_local->msg.found_serialheader) - { - bytes_to_be_removed += sizeof(dltSerialHeader); - } - - if (dlt_receiver_remove(&(daemon_local->receiver),bytes_to_be_removed)==-1) - { - dlt_log(LOG_ERR,"Can't remove bytes from receiver\n"); - return -1; - }*/ } else { @@ -1943,72 +1898,6 @@ int dlt_daemon_process_user_message_set_app_ll_ts(DltDaemon *daemon, DltDaemonLo return 0; } -int dlt_daemon_send_ringbuffer_to_client(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose) -{ - static uint8_t data[DLT_DAEMON_RINGBUFFER_SIZE]; - size_t length=0; - int j, third_value; - ssize_t ret; - - PRINT_FUNCTION_VERBOSE(verbose); - - if ((daemon==0) || (daemon_local==0)) - { - dlt_log(LOG_ERR, "Invalid function parameters used for function dlt_daemon_send_ringbuffer_to_client()\n"); - return -1; - } - - /* Attention: If the message can't be send at this time, it will be silently discarded. */ - while ((dlt_ringbuffer_get(&(daemon->client_ringbuffer), data, &length ))!=-1) - { - /* look if TCP connection to client is available */ - for (j = 0; j <= daemon_local->fdmax; j++) - { - /* send to everyone! */ - if (FD_ISSET(j, &(daemon_local->master))) - { - /* except the listener and ourselves */ - if (daemon_local->flags.yvalue[0]) - { - third_value = daemon_local->fdserial; - } - else - { - third_value = daemon_local->sock; - } - - if ((j != daemon_local->fp) && (j != daemon_local->sock) && (j != third_value)) - { - DLT_DAEMON_SEM_LOCK(); - - if (daemon_local->flags.lflag) - { - send(j,dltSerialHeader,sizeof(dltSerialHeader),0); - } - send(j,data,length,0); - - DLT_DAEMON_SEM_FREE(); - - } /* if */ - else if ((j == daemon_local->fdserial) && (daemon_local->flags.yvalue[0])) - { - DLT_DAEMON_SEM_LOCK(); - - if (daemon_local->flags.lflag) - { - ret=write(j,dltSerialHeader,sizeof(dltSerialHeader)); - } - ret=write(j,data,length); - - DLT_DAEMON_SEM_LOCK(); - } - } /* if */ - } /* for */ - } - - return 0; -} - void dlt_daemon_timingpacket_thread(void *ptr) { DltDaemonPeriodicData info; diff --git a/src/daemon/dlt-daemon.h b/src/daemon/dlt-daemon.h index 9a04235..7ddccdd 100755 --- a/src/daemon/dlt-daemon.h +++ b/src/daemon/dlt-daemon.h @@ -102,7 +102,6 @@ typedef struct char evalue[256]; /**< (String: ECU ID) Set ECU ID (Default: ECU1) */
char bvalue[256]; /**< (String: Baudrate) Serial device baudrate (Default: 115200) */
char yvalue[256]; /**< (String: Devicename) Additional support for serial device */
- char uvalue[256]; /**< (String: Ringbuffer) Size of the ringbuffer in bytes (Default: 10024) */
char ivalue[256]; /**< (String: Directory) Directory where to store the persistant configuration (Default: /tmp) */
char cvalue[256]; /**< (String: Directory) Filename of DLT configuration file (Default: /etc/dlt.conf) */
int sharedMemorySize; /**< (String: Directory) FSize of shared memory (Default: 100000 */
@@ -128,7 +127,6 @@ typedef struct DltReceiver receiverSerial; /**< receiver for serial connection */
int client_connections; /**< counter for nr. of client connections */
size_t baudrate; /**< Baudrate of serial connection */
- size_t ringbufferSize; /**< Size of the ringbuffer */
DltShm dlt_shm;
} DltDaemonLocal;
@@ -165,7 +163,6 @@ int dlt_daemon_process_user_message_register_context(DltDaemon *daemon, DltDaemo int dlt_daemon_process_user_message_unregister_context(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
int dlt_daemon_process_user_message_log(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
int dlt_daemon_process_user_message_set_app_ll_ts(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
-int dlt_daemon_send_ringbuffer_to_client(DltDaemon *daemon, DltDaemonLocal *daemon_local, int verbose);
void dlt_daemon_timingpacket_thread(void *ptr);
int dlt_daemon_make_periodic (unsigned int period, DltDaemonPeriodicData *info, int verbose);
diff --git a/src/daemon/dlt_daemon_common.c b/src/daemon/dlt_daemon_common.c index ed6103c..003dc33 100755 --- a/src/daemon/dlt_daemon_common.c +++ b/src/daemon/dlt_daemon_common.c @@ -177,12 +177,6 @@ int dlt_daemon_init(DltDaemon *daemon,const char *runtime_directory, int verbose dlt_set_id(daemon->ecuid,""); - /* initialize ring buffer for client connection */ - if (dlt_ringbuffer_init(&(daemon->client_ringbuffer), DLT_DAEMON_RINGBUFFER_SIZE)==-1) - { - return -1; - } - return 0; } @@ -2002,16 +1996,8 @@ void dlt_daemon_control_send_control_message( int sock, DltDaemon *daemon, DltMe } else { - /* Store message in history buffer */ - if (dlt_ringbuffer_put3(&(daemon->client_ringbuffer), - msg->headerbuffer+sizeof(DltStorageHeader),msg->headersize-sizeof(DltStorageHeader), - msg->databuffer,msg->datasize, - 0, 0 - )<0) - { - dlt_log(LOG_ERR,"Storage of message in history buffer failed! Message discarded.\n"); - return; - } + /* message can not be sent */ + /* in old implementation control message was stored in buffer */ } } diff --git a/src/daemon/dlt_daemon_common.h b/src/daemon/dlt_daemon_common.h index 1d16a85..bdacfd7 100755 --- a/src/daemon/dlt_daemon_common.h +++ b/src/daemon/dlt_daemon_common.h @@ -148,7 +148,6 @@ typedef struct char ecuid[DLT_ID_SIZE]; /**< ECU ID of daemon */
int sendserialheader; /**< 1: send serial header; 0 don't send serial header */
int timingpackets; /**< 1: send continous timing packets; 0 don't send continous timing packets */
- DltRingBuffer client_ringbuffer; /**< Ring-buffer for storing received logs while no client connection is available */
char runtime_application_cfg[256]; /**< Path and filename of persistent application configuration */
char runtime_context_cfg[256]; /**< Path and filename of persistent context configuration */
} DltDaemon;
|