Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit set of exported symbols #583

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
442 changes: 442 additions & 0 deletions cmake/compat/DltGenerateExportHeader.cmake

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions cmake/compat/exportheader.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

#ifndef @INCLUDE_GUARD_NAME@
#define @INCLUDE_GUARD_NAME@

#ifdef @STATIC_DEFINE@
# define @EXPORT_MACRO_NAME@
# define @NO_EXPORT_MACRO_NAME@
#else
# ifndef @EXPORT_MACRO_NAME@
# ifdef @EXPORT_IMPORT_CONDITION@
/* We are building this library */
# define @EXPORT_MACRO_NAME@ @DEFINE_EXPORT@
# else
/* We are using this library */
# define @EXPORT_MACRO_NAME@ @DEFINE_IMPORT@
# endif
# endif

# ifndef @NO_EXPORT_MACRO_NAME@
# define @NO_EXPORT_MACRO_NAME@ @DEFINE_NO_EXPORT@
# endif
#endif

#ifndef @DEPRECATED_MACRO_NAME@
# define @DEPRECATED_MACRO_NAME@ @DEFINE_DEPRECATED@
#endif

#ifndef @DEPRECATED_MACRO_NAME@_EXPORT
# define @DEPRECATED_MACRO_NAME@_EXPORT @EXPORT_MACRO_NAME@ @DEPRECATED_MACRO_NAME@
#endif

#ifndef @DEPRECATED_MACRO_NAME@_NO_EXPORT
# define @DEPRECATED_MACRO_NAME@_NO_EXPORT @NO_EXPORT_MACRO_NAME@ @DEPRECATED_MACRO_NAME@
#endif

#if @DEFINE_NO_DEPRECATED@ /* DEFINE_NO_DEPRECATED */
# ifndef @NO_DEPRECATED_MACRO_NAME@
# define @NO_DEPRECATED_MACRO_NAME@
# endif
#endif
@CUSTOM_CONTENT@
#endif /* @INCLUDE_GUARD_NAME@ */
12 changes: 11 additions & 1 deletion include/dlt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,21 @@ endif()

configure_file(dlt_user.h.in dlt_user.h)

if(CMAKE_VERSION VERSION_LESS "3.12")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/compat")
include(DltGenerateExportHeader) # compatibilty for pre-3.12 CMake
else()
include(GenerateExportHeader)
endif()

generate_export_header(dlt)

set(HEADER_LIST dlt.h dlt_user_macros.h dlt_client.h dlt_protocol.h
dlt_common.h dlt_types.h dlt_shm.h dlt_offline_trace.h
dlt_filetransfer.h dlt_common_api.h dlt_multiple_files.h
${CMAKE_CURRENT_BINARY_DIR}/dlt_version.h
${CMAKE_CURRENT_BINARY_DIR}/dlt_user.h)
${CMAKE_CURRENT_BINARY_DIR}/dlt_user.h
${CMAKE_CURRENT_BINARY_DIR}/dlt_export.h)

if(WITH_DLT_DISABLE_MACRO)
list(REMOVE_ITEM HEADER_LIST dlt_user_macros.h)
Expand Down
65 changes: 33 additions & 32 deletions include/dlt/dlt_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
\{
*/

# include "dlt_export.h"
# include "dlt_types.h"
# include "dlt_common.h"
#include <stdbool.h>
Expand Down Expand Up @@ -106,8 +107,8 @@ typedef struct
extern "C" {
# endif

void dlt_client_register_message_callback(int (*registerd_callback)(DltMessage *message, void *data));
void dlt_client_register_fetch_next_message_callback(bool (*registerd_callback)(void *data));
DLT_EXPORT void dlt_client_register_message_callback(int (*registerd_callback)(DltMessage *message, void *data));
DLT_EXPORT void dlt_client_register_fetch_next_message_callback(bool (*registerd_callback)(void *data));

/**
* Initialising dlt client structure with a specific port
Expand All @@ -116,45 +117,45 @@ void dlt_client_register_fetch_next_message_callback(bool (*registerd_callback)(
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
int dlt_client_init_port(DltClient *client, int port, int verbose);
DLT_EXPORT int dlt_client_init_port(DltClient *client, int port, int verbose);

/**
* Initialising dlt client structure
* @param client pointer to dlt client structure
* @param verbose if set to true verbose information is printed out.
* @return Value from DltReturnValue enum
*/
DltReturnValue dlt_client_init(DltClient *client, int verbose);
DLT_EXPORT DltReturnValue dlt_client_init(DltClient *client, int verbose);
/**
* Connect to dlt daemon using the information from the dlt client structure
* @param client pointer to dlt client structure
* @param verbose if set to true verbose information is printed out.
* @return Value from DltReturnValue enum
*/
DltReturnValue dlt_client_connect(DltClient *client, int verbose);
DLT_EXPORT DltReturnValue dlt_client_connect(DltClient *client, int verbose);
/**
* Cleanup dlt client structure
* @param client pointer to dlt client structure
* @param verbose if set to true verbose information is printed out.
* @return Value from DltReturnValue enum
*/
DltReturnValue dlt_client_cleanup(DltClient *client, int verbose);
DLT_EXPORT DltReturnValue dlt_client_cleanup(DltClient *client, int verbose);
/**
* Main Loop of dlt client application
* @param client pointer to dlt client structure
* @param data pointer to data to be provided to the main loop
* @param verbose if set to true verbose information is printed out.
* @return Value from DltReturnValue enum
*/
DltReturnValue dlt_client_main_loop(DltClient *client, void *data, int verbose);
DLT_EXPORT DltReturnValue dlt_client_main_loop(DltClient *client, void *data, int verbose);

/**
* Send a message to the daemon through the socket.
* @param client pointer to dlt client structure.
* @param msg The message to be send in DLT format.
* @return Value from DltReturnValue enum.
*/
DltReturnValue dlt_client_send_message_to_socket(DltClient *client, DltMessage *msg);
DLT_EXPORT DltReturnValue dlt_client_send_message_to_socket(DltClient *client, DltMessage *msg);

/**
* Send ancontrol message to the dlt daemon
Expand All @@ -165,7 +166,7 @@ DltReturnValue dlt_client_send_message_to_socket(DltClient *client, DltMessage *
* @param size Size of control message data
* @return Value from DltReturnValue enum
*/
DltReturnValue dlt_client_send_ctrl_msg(DltClient *client, char *apid, char *ctid, uint8_t *payload, uint32_t size);
DLT_EXPORT DltReturnValue dlt_client_send_ctrl_msg(DltClient *client, char *apid, char *ctid, uint8_t *payload, uint32_t size);
/**
* Send an injection message to the dlt daemon
* @param client pointer to dlt client structure
Expand All @@ -176,7 +177,7 @@ DltReturnValue dlt_client_send_ctrl_msg(DltClient *client, char *apid, char *cti
* @param size Size of injection data within buffer
* @return Value from DltReturnValue enum
*/
DltReturnValue dlt_client_send_inject_msg(DltClient *client,
DLT_EXPORT DltReturnValue dlt_client_send_inject_msg(DltClient *client,
char *apid,
char *ctid,
uint32_t serviceID,
Expand All @@ -190,35 +191,35 @@ DltReturnValue dlt_client_send_inject_msg(DltClient *client,
* @param logLevel Log Level
* @return Value from DltReturnValue enum
*/
DltReturnValue dlt_client_send_log_level(DltClient *client, char *apid, char *ctid, uint8_t logLevel);
DLT_EXPORT DltReturnValue dlt_client_send_log_level(DltClient *client, char *apid, char *ctid, uint8_t logLevel);
/**
* Send an request to get log info message to the dlt daemon
* @param client pointer to dlt client structure
* @return negative value if there was an error
*/
int dlt_client_get_log_info(DltClient *client);
DLT_EXPORT int dlt_client_get_log_info(DltClient *client);
/**
* Send an request to get default log level to the dlt daemon
* @param client pointer to dlt client structure
* @return negative value if there was an error
*/
DltReturnValue dlt_client_get_default_log_level(DltClient *client);
DLT_EXPORT DltReturnValue dlt_client_get_default_log_level(DltClient *client);
/**
* Send an request to get software version to the dlt daemon
* @param client pointer to dlt client structure
* @return negative value if there was an error
*/
int dlt_client_get_software_version(DltClient *client);
DLT_EXPORT int dlt_client_get_software_version(DltClient *client);
/**
* Initialise get log info structure
* @return void
*/
void dlt_getloginfo_init(void);
DLT_EXPORT void dlt_getloginfo_init(void);
/**
* To free the memory allocated for app description in get log info
* @return void
*/
void dlt_getloginfo_free(void);
DLT_EXPORT void dlt_getloginfo_free(void);
/**
* Send a set trace status message to the dlt daemon
* @param client pointer to dlt client structure
Expand All @@ -227,118 +228,118 @@ void dlt_getloginfo_free(void);
* @param traceStatus Default Trace Status
* @return Value from DltReturnValue enum
*/
DltReturnValue dlt_client_send_trace_status(DltClient *client, char *apid, char *ctid, uint8_t traceStatus);
DLT_EXPORT DltReturnValue dlt_client_send_trace_status(DltClient *client, char *apid, char *ctid, uint8_t traceStatus);
/**
* Send the default log level to the dlt daemon
* @param client pointer to dlt client structure
* @param defaultLogLevel Default Log Level
* @return Value from DltReturnValue enum
*/
DltReturnValue dlt_client_send_default_log_level(DltClient *client, uint8_t defaultLogLevel);
DLT_EXPORT DltReturnValue dlt_client_send_default_log_level(DltClient *client, uint8_t defaultLogLevel);
/**
* Send the log level to all contexts registered with dlt daemon
* @param client pointer to dlt client structure
* @param LogLevel Log Level to be set
* @return Value from DltReturnValue enum
*/
DltReturnValue dlt_client_send_all_log_level(DltClient *client, uint8_t LogLevel);
DLT_EXPORT DltReturnValue dlt_client_send_all_log_level(DltClient *client, uint8_t LogLevel);
/**
* Send the default trace status to the dlt daemon
* @param client pointer to dlt client structure
* @param defaultTraceStatus Default Trace Status
* @return Value from DltReturnValue enum
*/
DltReturnValue dlt_client_send_default_trace_status(DltClient *client, uint8_t defaultTraceStatus);
DLT_EXPORT DltReturnValue dlt_client_send_default_trace_status(DltClient *client, uint8_t defaultTraceStatus);
/**
* Send the trace status to all contexts registered with dlt daemon
* @param client pointer to dlt client structure
* @param traceStatus trace status to be set
* @return Value from DltReturnValue enum
*/
DltReturnValue dlt_client_send_all_trace_status(DltClient *client, uint8_t traceStatus);
DLT_EXPORT DltReturnValue dlt_client_send_all_trace_status(DltClient *client, uint8_t traceStatus);
/**
* Send the timing pakets status to the dlt daemon
* @param client pointer to dlt client structure
* @param timingPakets Timing pakets enabled
* @return Value from DltReturnValue enum
*/
DltReturnValue dlt_client_send_timing_pakets(DltClient *client, uint8_t timingPakets);
DLT_EXPORT DltReturnValue dlt_client_send_timing_pakets(DltClient *client, uint8_t timingPakets);
/**
* Send the store config command to the dlt daemon
* @param client pointer to dlt client structure
* @return Value from DltReturnValue enum
*/
DltReturnValue dlt_client_send_store_config(DltClient *client);
DLT_EXPORT DltReturnValue dlt_client_send_store_config(DltClient *client);
/**
* Send the reset to factory default command to the dlt daemon
* @param client pointer to dlt client structure
* @return Value from DltReturnValue enum
*/
DltReturnValue dlt_client_send_reset_to_factory_default(DltClient *client);
DLT_EXPORT DltReturnValue dlt_client_send_reset_to_factory_default(DltClient *client);

/**
* Set baudrate within dlt client structure
* @param client pointer to dlt client structure
* @param baudrate Baudrate
* @return Value from DltReturnValue enum
*/
DltReturnValue dlt_client_setbaudrate(DltClient *client, int baudrate);
DLT_EXPORT DltReturnValue dlt_client_setbaudrate(DltClient *client, int baudrate);

/**
* Set mode within dlt client structure
* @param client pointer to dlt client structure
* @param mode DltClientMode
* @return Value from DltReturnValue enum
*/
DltReturnValue dlt_client_set_mode(DltClient *client, DltClientMode mode);
DLT_EXPORT DltReturnValue dlt_client_set_mode(DltClient *client, DltClientMode mode);

/**
* Set server ip
* @param client pointer to dlt client structure
* @param ipaddr pointer to command line argument
* @return negative value if there was an error
*/
int dlt_client_set_server_ip(DltClient *client, char *ipaddr);
DLT_EXPORT int dlt_client_set_server_ip(DltClient *client, char *ipaddr);

/**
* Set server UDP host receiver interface address
* @param client pointer to dlt client structure
* @param hostip pointer to multicast group address
* @return negative value if there was an error
*/
int dlt_client_set_host_if_address(DltClient *client, char *hostip);
DLT_EXPORT int dlt_client_set_host_if_address(DltClient *client, char *hostip);

/**
* Set serial device
* @param client pointer to dlt client structure
* @param serial_device pointer to command line argument
* @return negative value if there was an error
*/
int dlt_client_set_serial_device(DltClient *client, char *serial_device);
DLT_EXPORT int dlt_client_set_serial_device(DltClient *client, char *serial_device);

/**
* Set socket path
* @param client pointer to dlt client structure
* @param socket_path pointer to socket path string
* @return negative value if there was an error
*/
int dlt_client_set_socket_path(DltClient *client, char *socket_path);
DLT_EXPORT int dlt_client_set_socket_path(DltClient *client, char *socket_path);

/**
* Parse GET_LOG_INFO response text
* @param resp GET_LOG_INFO response
* @param resp_text response text represented by ASCII
* @return Value from DltReturnValue enum
*/
DltReturnValue dlt_client_parse_get_log_info_resp_text(DltServiceGetLogInfoResponse *resp,
DLT_EXPORT DltReturnValue dlt_client_parse_get_log_info_resp_text(DltServiceGetLogInfoResponse *resp,
char *resp_text);

/**
* Free memory allocated for get log info message
* @param resp response
* @return 0 on success, -1 otherwise
*/
int dlt_client_cleanup_get_log_info(DltServiceGetLogInfoResponse *resp);
DLT_EXPORT int dlt_client_cleanup_get_log_info(DltServiceGetLogInfoResponse *resp);
# ifdef __cplusplus
}
# endif
Expand Down
Loading