automotive-dlt
|
#include "dlt_common.h"
Go to the source code of this file.
Data Structures | |
struct | DltShm |
struct | DltShmBlockHead |
Macros | |
#define | DLT_SHM_KEY 11771 |
#define | DLT_SHM_SIZE 100000 |
#define | DLT_SHM_SEM 22771 |
#define | DLT_SHM_HEAD "SHM" |
#define | DLT_SHM_SEM_GET(id) dlt_shm_pv(id,-1) |
#define | DLT_SHM_SEM_FREE(id) dlt_shm_pv(id,1) |
Functions | |
DltReturnValue | dlt_shm_init_client (DltShm *buf, int key) |
DltReturnValue | dlt_shm_init_server (DltShm *buf, int key, int size) |
int | dlt_shm_push (DltShm *buf, const unsigned char *data1, unsigned int size1, const unsigned char *data2, unsigned int size2, const unsigned char *data3, unsigned int size3) |
int | dlt_shm_pull (DltShm *buf, unsigned char *data, int size) |
int | dlt_shm_copy (DltShm *buf, unsigned char *data, int size) |
int | dlt_shm_remove (DltShm *buf) |
void | dlt_shm_info (DltShm *buf) |
void | dlt_shm_status (DltShm *buf) |
DltReturnValue | dlt_shm_free_client (DltShm *buf) |
int | dlt_shm_get_total_size (DltShm *buf) |
int | dlt_shm_get_used_size (DltShm *buf) |
int | dlt_shm_get_message_count (DltShm *buf) |
int | dlt_shm_reset (DltShm *buf) |
int | dlt_shm_recover (DltShm *buf) |
int | dlt_shm_free_server (DltShm *buf) |
Definition in file dlt_shm.h.
#define DLT_SHM_KEY 11771 |
Definition at line 64 of file dlt_shm.h.
Referenced by dlt_daemon_local_init_p2(), dlt_init(), and dlt_user_log_reattach_to_daemon().
#define DLT_SHM_SEM 22771 |
Definition at line 74 of file dlt_shm.h.
Referenced by dlt_shm_init_client(), and dlt_shm_init_server().
#define DLT_SHM_SEM_FREE | ( | id | ) | dlt_shm_pv(id,1) |
Definition at line 93 of file dlt_shm.h.
Referenced by dlt_shm_copy(), dlt_shm_get_used_size(), dlt_shm_pull(), dlt_shm_push(), and dlt_shm_remove().
#define DLT_SHM_SEM_GET | ( | id | ) | dlt_shm_pv(id,-1) |
Definition at line 92 of file dlt_shm.h.
Referenced by dlt_shm_copy(), dlt_shm_get_used_size(), dlt_shm_pull(), dlt_shm_push(), and dlt_shm_remove().
#define DLT_SHM_SIZE 100000 |
Definition at line 69 of file dlt_shm.h.
Referenced by option_file_parser().
int dlt_shm_copy | ( | DltShm * | buf, |
unsigned char * | data, | ||
int | size | ||
) |
Copy message from shm. This function should be called from server. Data is not deleted from shm after this call.
buf | pointer to shm structure |
data | pointer to buffer where data is to be written |
size | maximum size to be written into buffer |
Definition at line 248 of file dlt_shm.c.
References DltShm::buffer, dlt_buffer_copy(), DLT_SHM_SEM_FREE, DLT_SHM_SEM_GET, DltBuffer::mem, and DltShm::semid.
Referenced by dlt_daemon_process_user_message_log().
DltReturnValue dlt_shm_free_client | ( | DltShm * | buf | ) |
Deinitialise the shared memory on the client side.
buf | pointer to shm structure |
Definition at line 303 of file dlt_shm.c.
References DltShm::buffer, dlt_buffer_free_static(), dlt_log(), DLT_RETURN_ERROR, DltShm::semid, DltBuffer::shm, and DltShm::shmid.
Referenced by dlt_free(), and dlt_user_log_send_log().
int dlt_shm_free_server | ( | DltShm * | buf | ) |
Deinitialise the shared memory on the server side.
buf | pointer to shm structure |
Definition at line 278 of file dlt_shm.c.
References DltShm::buffer, dlt_buffer_free_static(), dlt_log(), DLT_RETURN_ERROR, NULL, DltShm::semid, DltBuffer::shm, and DltShm::shmid.
Referenced by dlt_daemon_local_cleanup().
int dlt_shm_get_message_count | ( | DltShm * | buf | ) |
Returns the number of messages in the shm.
buf | pointer to shm structure |
Definition at line 213 of file dlt_shm.c.
References DltShm::buffer, and dlt_buffer_get_message_count().
int dlt_shm_get_total_size | ( | DltShm * | buf | ) |
Returns the total size of the shm.
buf | pointer to shm structure |
Definition at line 193 of file dlt_shm.c.
References DltShm::buffer, and dlt_buffer_get_total_size().
Referenced by dlt_user_check_buffer().
int dlt_shm_get_used_size | ( | DltShm * | buf | ) |
Returns the used size in the shm.
buf | pointer to shm structure |
Definition at line 198 of file dlt_shm.c.
References DltShm::buffer, dlt_buffer_get_used_size(), DLT_SHM_SEM_FREE, DLT_SHM_SEM_GET, DltBuffer::mem, and DltShm::semid.
Referenced by dlt_user_check_buffer().
void dlt_shm_info | ( | DltShm * | buf | ) |
Print information about shm.
buf | pointer to shm structure |
Definition at line 183 of file dlt_shm.c.
References DltShm::buffer, and dlt_buffer_info().
DltReturnValue dlt_shm_init_client | ( | DltShm * | buf, |
int | key | ||
) |
Initialise the shared memory on the client side. This function must be called before using further shm functions.
buf | pointer to shm structure |
key | the identifier of the shm, must be the same for server and client |
Definition at line 144 of file dlt_shm.c.
References DltShm::buffer, dlt_buffer_init_static_client(), dlt_log(), DLT_RETURN_ERROR, DLT_RETURN_OK, DLT_SHM_SEM, NULL, DltShm::semid, and DltShm::shmid.
Referenced by dlt_init(), and dlt_user_log_reattach_to_daemon().
DltReturnValue dlt_shm_init_server | ( | DltShm * | buf, |
int | key, | ||
int | size | ||
) |
Initialise the shared memory on the server side. This function must be called before using further shm functions.
buf | pointer to shm structure |
key | the identifier of the shm, must be the same for server and client |
size | the requested size of the shm |
Definition at line 99 of file dlt_shm.c.
References DltShm::buffer, dlt_buffer_init_static_server(), dlt_log(), DLT_RETURN_ERROR, DLT_RETURN_OK, DLT_SHM_SEM, NULL, DltShm::semid, and DltShm::shmid.
Referenced by dlt_daemon_local_init_p2().
int dlt_shm_pull | ( | DltShm * | buf, |
unsigned char * | data, | ||
int | size | ||
) |
Pull data from shm. This function should be called from client. Data is deleted from shm after this call.
buf | pointer to shm structure |
data | pointer to buffer where data is to be written |
size | maximum size to be written into buffer |
Definition at line 233 of file dlt_shm.c.
References DltShm::buffer, dlt_buffer_pull(), DLT_SHM_SEM_FREE, DLT_SHM_SEM_GET, DltBuffer::mem, and DltShm::semid.
int dlt_shm_push | ( | DltShm * | buf, |
const unsigned char * | data1, | ||
unsigned int | size1, | ||
const unsigned char * | data2, | ||
unsigned int | size2, | ||
const unsigned char * | data3, | ||
unsigned int | size3 | ||
) |
Push data from client onto the shm.
buf | pointer to shm structure |
data1 | pointer to first data block to be written, null if not used |
size1 | size in bytes of first data block to be written, 0 if not used |
data2 | pointer to second data block to be written, null if not used |
size2 | size in bytes of second data block to be written, 0 if not used |
data3 | pointer to third data block to be written, null if not used |
size3 | size in bytes of third data block to be written, 0 if not used |
Definition at line 218 of file dlt_shm.c.
References DltShm::buffer, dlt_buffer_push3(), DLT_SHM_SEM_FREE, DLT_SHM_SEM_GET, DltBuffer::mem, and DltShm::semid.
Referenced by dlt_user_log_resend_buffer(), and dlt_user_log_send_log().
int dlt_shm_recover | ( | DltShm * | buf | ) |
Recover to find next valid message.
buf | pointer to shm structure |
int dlt_shm_remove | ( | DltShm * | buf | ) |
Delete message from shm. This function should be called from server. This function should be called after each succesful copy.
buf | pointer to shm structure |
Definition at line 263 of file dlt_shm.c.
References DltShm::buffer, dlt_buffer_remove(), DLT_SHM_SEM_FREE, DLT_SHM_SEM_GET, DltBuffer::mem, and DltShm::semid.
Referenced by dlt_daemon_process_user_message_log().
int dlt_shm_reset | ( | DltShm * | buf | ) |
Reset pointers and counters when shm corrupted.
buf | pointer to shm structure |
void dlt_shm_status | ( | DltShm * | buf | ) |
Print status about shm.
buf | pointer to shm structure |
Definition at line 188 of file dlt_shm.c.
References DltShm::buffer, and dlt_buffer_status().