From 85c28ff17e37de4ac9489d79f2c87e63de156d87 Mon Sep 17 00:00:00 2001 From: liuwentan Date: Thu, 11 Aug 2022 10:50:41 +0800 Subject: [PATCH] [CIFIX]add extern 'C' in C++ code --- sdk/include/event.h | 9 +++++++++ sdk/include/http.h | 11 ++++++++++- sdk/include/logger.h | 11 ++++++++++- sdk/include/util_errors.h | 13 ++++++++++++- src/common/global_var.h | 16 ++++++++++++++-- src/common/pio_packet_queue.h | 16 ++++++++++++++-- src/common/time_helper.h | 16 ++++++++++++++-- src/packet_io/marsio_mode/pio_marsio.h | 17 ++++++++++++++--- src/packet_io/packet_io.h | 16 ++++++++++++++-- src/packet_io/pcap_file_mode/pio_pcap_file.h | 16 ++++++++++++++-- src/packet_io/pcap_live_mode/pio_pcap_live.h | 16 ++++++++++++++-- version.txt | 12 ++++++------ 12 files changed, 145 insertions(+), 24 deletions(-) diff --git a/sdk/include/event.h b/sdk/include/event.h index 0653f69..774c7d5 100644 --- a/sdk/include/event.h +++ b/sdk/include/event.h @@ -1,3 +1,9 @@ +#pragma once + +#ifdef __cpluscplus +extern "C" +{ +#endif struct stellar_session_event_data; @@ -10,3 +16,6 @@ struct stellar_event }; }; +#ifdef __cpluscplus +} +#endif \ No newline at end of file diff --git a/sdk/include/http.h b/sdk/include/http.h index 6250055..a88d072 100644 --- a/sdk/include/http.h +++ b/sdk/include/http.h @@ -1,5 +1,14 @@ #pragma once +#ifdef __cpluscplus +extern "C" +{ +#endif + #include "session.h" -void http_decoder(const struct stellar_session *s, enum session_event_type event, struct stellar_packet *p, const char *payload, uint16_t len, void **pme); \ No newline at end of file +void http_decoder(const struct stellar_session *s, enum session_event_type event, struct stellar_packet *p, const char *payload, uint16_t len, void **pme); + +#ifdef __cpluscplus +} +#endif \ No newline at end of file diff --git a/sdk/include/logger.h b/sdk/include/logger.h index 2ec18fb..947b52c 100644 --- a/sdk/include/logger.h +++ b/sdk/include/logger.h @@ -10,10 +10,19 @@ #pragma once +#ifdef __cpluscplus +extern "C" +{ +#endif + #define log_debug(x, ...) #define log_info(x, ...) #define log_notice(x, ...) -#define log_error(x, ...) +#define log_error(x, ...) + +#ifdef __cpluscplus +} +#endif \ No newline at end of file diff --git a/sdk/include/util_errors.h b/sdk/include/util_errors.h index 53e6b06..1426a06 100644 --- a/sdk/include/util_errors.h +++ b/sdk/include/util_errors.h @@ -8,6 +8,13 @@ *********************************************************************************************** */ +#pragma once + +#ifdef __cpluscplus +extern "C" +{ +#endif + #define CASE_CODE(E) case E: return #E /* ST is short for stellar */ @@ -35,4 +42,8 @@ typedef enum { ST_ERR_FOPEN, ST_ERR_BPF, ST_ERR_MAX -} error_code_t; \ No newline at end of file +} error_code_t; + +#ifdef __cpluscplus +} +#endif \ No newline at end of file diff --git a/src/common/global_var.h b/src/common/global_var.h index c27980e..e7bd5e6 100644 --- a/src/common/global_var.h +++ b/src/common/global_var.h @@ -8,7 +8,13 @@ *********************************************************************************************** */ -#pragma once +#ifndef _GLOBAL_VAR_H_ +#define _GLOBAL_VAR_H_ + +#ifdef __cpluscplus +extern "C" +{ +#endif #include #include @@ -86,4 +92,10 @@ extern struct stellar_engine g_engine_instance; * * @retval -1(failed), 0(success) */ -int strncpy_safe(char *dst, const char *src, size_t dst_size); \ No newline at end of file +int strncpy_safe(char *dst, const char *src, size_t dst_size); + +#ifdef __cpluscplus +} +#endif + +#endif /* _GLOBAL_VAR_H_ */ \ No newline at end of file diff --git a/src/common/pio_packet_queue.h b/src/common/pio_packet_queue.h index d4f3583..e823d0b 100644 --- a/src/common/pio_packet_queue.h +++ b/src/common/pio_packet_queue.h @@ -8,7 +8,13 @@ *********************************************************************************************** */ -#pragma once +#ifndef _PIO_PACKET_QUEUE_H_ +#define _PIO_PACKET_QUEUE_H_ + +#ifdef __cpluscplus +extern "C" +{ +#endif #include @@ -61,4 +67,10 @@ int packet_copy_data(uint8_t *ptr, const uint8_t *pkt_data, uint32_t pkt_len); void pio_packet_enqueue(struct pio_packet_queue *, struct pio_packet *); struct pio_packet *pio_packet_dequeue(struct pio_packet_queue *); -void release_pio_packet_queue(struct pio_packet_queue *); \ No newline at end of file +void release_pio_packet_queue(struct pio_packet_queue *); + +#ifdef __cpluscplus +} +#endif + +#endif /* _PIO_PACKET_QUEUE_H_ */ \ No newline at end of file diff --git a/src/common/time_helper.h b/src/common/time_helper.h index c20b00d..55e7e60 100644 --- a/src/common/time_helper.h +++ b/src/common/time_helper.h @@ -8,7 +8,13 @@ *********************************************************************************************** */ -#pragma once +#ifndef _TIME_HELPER_H_ +#define _TIME_HELPER_H_ + +#ifdef __cpluscplus +extern "C" +{ +#endif #include #include @@ -19,4 +25,10 @@ int compare_timespec(struct timespec *left, struct timespec *right); void copy_timespec(struct timespec *from, struct timespec *to); -uint64_t timespec_to_millisecond(const struct timespec* ts); \ No newline at end of file +uint64_t timespec_to_millisecond(const struct timespec* ts); + +#ifdef __cpluscplus +} +#endif + +#endif /* _TIME_HELPER_H_ */ \ No newline at end of file diff --git a/src/packet_io/marsio_mode/pio_marsio.h b/src/packet_io/marsio_mode/pio_marsio.h index 1b40bc4..0a81ff7 100644 --- a/src/packet_io/marsio_mode/pio_marsio.h +++ b/src/packet_io/marsio_mode/pio_marsio.h @@ -8,10 +8,15 @@ *********************************************************************************************** */ -#pragma once +#ifndef _PIO_MARSIO_H_ +#define _PIO_MARSIO_H_ + +#ifdef __cpluscplus +extern "C" +{ +#endif #include - #include /** @@ -166,4 +171,10 @@ char *pio_marsio_device_buff_mtod(struct stellar_packet *p); uint32_t pio_marsio_device_buff_buflen(struct stellar_packet *p); -uint32_t pio_marsio_device_buff_datalen(struct stellar_packet *p); \ No newline at end of file +uint32_t pio_marsio_device_buff_datalen(struct stellar_packet *p); + +#ifdef __cpluscplus +} +#endif + +#endif /* _PIO_MARSIO_H_ */ \ No newline at end of file diff --git a/src/packet_io/packet_io.h b/src/packet_io/packet_io.h index 0cd0936..1e70df8 100644 --- a/src/packet_io/packet_io.h +++ b/src/packet_io/packet_io.h @@ -8,7 +8,13 @@ *********************************************************************************************** */ -#pragma once +#ifndef _PACKET_IO_H_ +#define _PACKET_IO_H_ + +#ifdef __cpluscplus +extern "C" +{ +#endif #include #include @@ -169,4 +175,10 @@ uint32_t packet_io_buff_buflen(struct packet_io_device *pdev, struct stellar_pac /** * @brief get packet_io packet's data length */ -uint32_t packet_io_buff_datalen(struct packet_io_device *pdev, struct stellar_packet *p); \ No newline at end of file +uint32_t packet_io_buff_datalen(struct packet_io_device *pdev, struct stellar_packet *p); + +#ifdef __cpluscplus +} +#endif + +#endif /* _PIO_PCAP_LIVE_H_ */ \ No newline at end of file diff --git a/src/packet_io/pcap_file_mode/pio_pcap_file.h b/src/packet_io/pcap_file_mode/pio_pcap_file.h index 69e20c3..1d5e327 100644 --- a/src/packet_io/pcap_file_mode/pio_pcap_file.h +++ b/src/packet_io/pcap_file_mode/pio_pcap_file.h @@ -8,7 +8,13 @@ *********************************************************************************************** */ -#pragma once +#ifndef _PIO_PCAP_FILE_H_ +#define _PIO_PCAP_FILE_H_ + +#ifdef __cpluscplus +extern "C" +{ +#endif #include #include @@ -137,4 +143,10 @@ char *pio_pcap_file_device_buff_mtod(struct stellar_packet *p); uint32_t pio_pcap_file_device_buff_buflen(struct stellar_packet *p); -uint32_t pio_pcap_file_device_buff_datalen(struct stellar_packet *p); \ No newline at end of file +uint32_t pio_pcap_file_device_buff_datalen(struct stellar_packet *p); + +#ifdef __cpluscplus +} +#endif + +#endif /* _PIO_PCAP_FILE_H_ */ \ No newline at end of file diff --git a/src/packet_io/pcap_live_mode/pio_pcap_live.h b/src/packet_io/pcap_live_mode/pio_pcap_live.h index c60d5a2..85b6554 100644 --- a/src/packet_io/pcap_live_mode/pio_pcap_live.h +++ b/src/packet_io/pcap_live_mode/pio_pcap_live.h @@ -8,7 +8,13 @@ *********************************************************************************************** */ -#pragma once +#ifndef _PIO_PCAP_LIVE_H_ +#define _PIO_PCAP_LIVE_H_ + +#ifdef __cpluscplus +extern "C" +{ +#endif #include #include @@ -99,4 +105,10 @@ char *pio_pcap_live_device_buff_mtod(struct stellar_packet *p); uint32_t pio_pcap_live_device_buff_buflen(struct stellar_packet *p); -uint32_t pio_pcap_live_device_buff_datalen(struct stellar_packet *p); \ No newline at end of file +uint32_t pio_pcap_live_device_buff_datalen(struct stellar_packet *p); + +#ifdef __cpluscplus +} +#endif + +#endif /* _PIO_PCAP_LIVE_H_ */ \ No newline at end of file diff --git a/version.txt b/version.txt index d4f6ce9..ec3fd2b 100644 --- a/version.txt +++ b/version.txt @@ -3,16 +3,16 @@ VCS_TYPE="git" VCS_BASENAME="stellar" VCS_UUID="4ca8c002ee6c7ebcbb5bc7360b82a391a12d4a63" -VCS_NUM="35" -VCS_DATE="2022-08-11T01:38:38Z" +VCS_NUM="36" +VCS_DATE="2022-08-11T02:00:02Z" VCS_BRANCH="dev-liuwentan" VCS_TAG="" -VCS_TICK="35" +VCS_TICK="36" VCS_EXTRA="" -VCS_ACTION_STAMP="2022-08-11T01:38:38Z!liuwentan@geedgenetworks.com" -VCS_FULL_HASH="1d7b9d8c945ed79ca46a355fe97e90f64a91236f" -VCS_SHORT_HASH="1d7b9d8" +VCS_ACTION_STAMP="2022-08-11T02:00:02Z!liuwentan@geedgenetworks.com" +VCS_FULL_HASH="14703ec4b44f708001f19bbe326e03a29346df0c" +VCS_SHORT_HASH="14703ec" VCS_WC_MODIFIED="1"