[CIFIX]add extern 'C' in C++ code

This commit is contained in:
liuwentan
2022-08-11 10:50:41 +08:00
parent 14703ec4b4
commit 85c28ff17e
12 changed files with 145 additions and 24 deletions

View File

@@ -1,3 +1,9 @@
#pragma once
#ifdef __cpluscplus
extern "C"
{
#endif
struct stellar_session_event_data; struct stellar_session_event_data;
@@ -10,3 +16,6 @@ struct stellar_event
}; };
}; };
#ifdef __cpluscplus
}
#endif

View File

@@ -1,5 +1,14 @@
#pragma once #pragma once
#ifdef __cpluscplus
extern "C"
{
#endif
#include "session.h" #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); 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

View File

@@ -10,10 +10,19 @@
#pragma once #pragma once
#ifdef __cpluscplus
extern "C"
{
#endif
#define log_debug(x, ...) #define log_debug(x, ...)
#define log_info(x, ...) #define log_info(x, ...)
#define log_notice(x, ...) #define log_notice(x, ...)
#define log_error(x, ...) #define log_error(x, ...)
#ifdef __cpluscplus
}
#endif

View File

@@ -8,6 +8,13 @@
*********************************************************************************************** ***********************************************************************************************
*/ */
#pragma once
#ifdef __cpluscplus
extern "C"
{
#endif
#define CASE_CODE(E) case E: return #E #define CASE_CODE(E) case E: return #E
/* ST is short for stellar */ /* ST is short for stellar */
@@ -35,4 +42,8 @@ typedef enum {
ST_ERR_FOPEN, ST_ERR_FOPEN,
ST_ERR_BPF, ST_ERR_BPF,
ST_ERR_MAX ST_ERR_MAX
} error_code_t; } error_code_t;
#ifdef __cpluscplus
}
#endif

View File

@@ -8,7 +8,13 @@
*********************************************************************************************** ***********************************************************************************************
*/ */
#pragma once #ifndef _GLOBAL_VAR_H_
#define _GLOBAL_VAR_H_
#ifdef __cpluscplus
extern "C"
{
#endif
#include <limits.h> #include <limits.h>
#include <stdint.h> #include <stdint.h>
@@ -86,4 +92,10 @@ extern struct stellar_engine g_engine_instance;
* *
* @retval -1(failed), 0(success) * @retval -1(failed), 0(success)
*/ */
int strncpy_safe(char *dst, const char *src, size_t dst_size); int strncpy_safe(char *dst, const char *src, size_t dst_size);
#ifdef __cpluscplus
}
#endif
#endif /* _GLOBAL_VAR_H_ */

View File

@@ -8,7 +8,13 @@
*********************************************************************************************** ***********************************************************************************************
*/ */
#pragma once #ifndef _PIO_PACKET_QUEUE_H_
#define _PIO_PACKET_QUEUE_H_
#ifdef __cpluscplus
extern "C"
{
#endif
#include <stdint.h> #include <stdint.h>
@@ -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 *); void pio_packet_enqueue(struct pio_packet_queue *, struct pio_packet *);
struct pio_packet *pio_packet_dequeue(struct pio_packet_queue *); struct pio_packet *pio_packet_dequeue(struct pio_packet_queue *);
void release_pio_packet_queue(struct pio_packet_queue *); void release_pio_packet_queue(struct pio_packet_queue *);
#ifdef __cpluscplus
}
#endif
#endif /* _PIO_PACKET_QUEUE_H_ */

View File

@@ -8,7 +8,13 @@
*********************************************************************************************** ***********************************************************************************************
*/ */
#pragma once #ifndef _TIME_HELPER_H_
#define _TIME_HELPER_H_
#ifdef __cpluscplus
extern "C"
{
#endif
#include <time.h> #include <time.h>
#include <stdint.h> #include <stdint.h>
@@ -19,4 +25,10 @@ int compare_timespec(struct timespec *left, struct timespec *right);
void copy_timespec(struct timespec *from, struct timespec *to); void copy_timespec(struct timespec *from, struct timespec *to);
uint64_t timespec_to_millisecond(const struct timespec* ts); uint64_t timespec_to_millisecond(const struct timespec* ts);
#ifdef __cpluscplus
}
#endif
#endif /* _TIME_HELPER_H_ */

View File

@@ -8,10 +8,15 @@
*********************************************************************************************** ***********************************************************************************************
*/ */
#pragma once #ifndef _PIO_MARSIO_H_
#define _PIO_MARSIO_H_
#ifdef __cpluscplus
extern "C"
{
#endif
#include <stdint.h> #include <stdint.h>
#include <marsio.h> #include <marsio.h>
/** /**
@@ -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_buflen(struct stellar_packet *p);
uint32_t pio_marsio_device_buff_datalen(struct stellar_packet *p); uint32_t pio_marsio_device_buff_datalen(struct stellar_packet *p);
#ifdef __cpluscplus
}
#endif
#endif /* _PIO_MARSIO_H_ */

View File

@@ -8,7 +8,13 @@
*********************************************************************************************** ***********************************************************************************************
*/ */
#pragma once #ifndef _PACKET_IO_H_
#define _PACKET_IO_H_
#ifdef __cpluscplus
extern "C"
{
#endif
#include <stdint.h> #include <stdint.h>
#include <limits.h> #include <limits.h>
@@ -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 * @brief get packet_io packet's data length
*/ */
uint32_t packet_io_buff_datalen(struct packet_io_device *pdev, struct stellar_packet *p); uint32_t packet_io_buff_datalen(struct packet_io_device *pdev, struct stellar_packet *p);
#ifdef __cpluscplus
}
#endif
#endif /* _PIO_PCAP_LIVE_H_ */

View File

@@ -8,7 +8,13 @@
*********************************************************************************************** ***********************************************************************************************
*/ */
#pragma once #ifndef _PIO_PCAP_FILE_H_
#define _PIO_PCAP_FILE_H_
#ifdef __cpluscplus
extern "C"
{
#endif
#include <stdint.h> #include <stdint.h>
#include <dirent.h> #include <dirent.h>
@@ -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_buflen(struct stellar_packet *p);
uint32_t pio_pcap_file_device_buff_datalen(struct stellar_packet *p); uint32_t pio_pcap_file_device_buff_datalen(struct stellar_packet *p);
#ifdef __cpluscplus
}
#endif
#endif /* _PIO_PCAP_FILE_H_ */

View File

@@ -8,7 +8,13 @@
*********************************************************************************************** ***********************************************************************************************
*/ */
#pragma once #ifndef _PIO_PCAP_LIVE_H_
#define _PIO_PCAP_LIVE_H_
#ifdef __cpluscplus
extern "C"
{
#endif
#include <stdint.h> #include <stdint.h>
#include <pcap/pcap.h> #include <pcap/pcap.h>
@@ -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_buflen(struct stellar_packet *p);
uint32_t pio_pcap_live_device_buff_datalen(struct stellar_packet *p); uint32_t pio_pcap_live_device_buff_datalen(struct stellar_packet *p);
#ifdef __cpluscplus
}
#endif
#endif /* _PIO_PCAP_LIVE_H_ */

View File

@@ -3,16 +3,16 @@
VCS_TYPE="git" VCS_TYPE="git"
VCS_BASENAME="stellar" VCS_BASENAME="stellar"
VCS_UUID="4ca8c002ee6c7ebcbb5bc7360b82a391a12d4a63" VCS_UUID="4ca8c002ee6c7ebcbb5bc7360b82a391a12d4a63"
VCS_NUM="35" VCS_NUM="36"
VCS_DATE="2022-08-11T01:38:38Z" VCS_DATE="2022-08-11T02:00:02Z"
VCS_BRANCH="dev-liuwentan" VCS_BRANCH="dev-liuwentan"
VCS_TAG="" VCS_TAG=""
VCS_TICK="35" VCS_TICK="36"
VCS_EXTRA="" VCS_EXTRA=""
VCS_ACTION_STAMP="2022-08-11T01:38:38Z!liuwentan@geedgenetworks.com" VCS_ACTION_STAMP="2022-08-11T02:00:02Z!liuwentan@geedgenetworks.com"
VCS_FULL_HASH="1d7b9d8c945ed79ca46a355fe97e90f64a91236f" VCS_FULL_HASH="14703ec4b44f708001f19bbe326e03a29346df0c"
VCS_SHORT_HASH="1d7b9d8" VCS_SHORT_HASH="14703ec"
VCS_WC_MODIFIED="1" VCS_WC_MODIFIED="1"