Skip to content

Commit fc73538

Browse files
committed
[net][sal/at] Add components C++ support
1 parent 192b177 commit fc73538

File tree

10 files changed

+61
-5
lines changed

10 files changed

+61
-5
lines changed

components/net/at/at_socket/at_socket.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
#include <netdb.h>
3333
#include <sys/socket.h>
3434

35+
#ifdef __cplusplus
36+
extern "C" {
37+
#endif
38+
3539
#ifndef AT_SOCKET_RECV_BFSZ
3640
#define AT_SOCKET_RECV_BFSZ 512
3741
#endif
@@ -160,4 +164,8 @@ void at_scoket_device_register(const struct at_device_ops *ops);
160164

161165
#endif /* RT_USING_SAL */
162166

167+
#ifdef __cplusplus
168+
}
169+
#endif
170+
163171
#endif /* AT_SOCKET_H__ */

components/net/at/include/at.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727

2828
#include <rtthread.h>
2929

30+
#ifdef __cplusplus
31+
extern "C" {
32+
#endif
3033
#define AT_SW_VERSION "0.3.0"
3134

3235
#define DBG_ENABLE
@@ -251,4 +254,8 @@ void at_port_reset(void);
251254
void at_port_factory_reset(void);
252255
#endif
253256

257+
#ifdef __cplusplus
258+
}
259+
#endif
260+
254261
#endif /* __AT_H__ */

components/net/sal_socket/impl/af_inet.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727

2828
#include <rtthread.h>
2929

30+
#ifdef __cplusplus
31+
extern "C" {
32+
#endif
33+
3034
#ifdef SAL_USING_LWIP
3135
/* lwIP protocol family register */
3236
int lwip_inet_init(void);
@@ -37,4 +41,8 @@ int lwip_inet_init(void);
3741
int at_inet_init(void);
3842
#endif
3943

44+
#ifdef __cplusplus
45+
}
46+
#endif
47+
4048
#endif /* __AF_INET_H__ */

components/net/sal_socket/include/dfs_net/dfs_net.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
#ifndef DFS_NET_H__
2727
#define DFS_NET_H__
2828

29+
#include <dfs_file.h>
30+
2931
#ifdef __cplusplus
3032
extern "C" {
3133
#endif
3234

33-
#include <dfs_file.h>
34-
3535
const struct dfs_file_ops* dfs_net_get_fops(void);
3636
int dfs_net_getsocket(int fd);
3737

components/net/sal_socket/include/sal.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
#include <dfs_file.h>
2929
#include <rtdevice.h>
3030

31+
#ifdef __cplusplus
32+
extern "C" {
33+
#endif
34+
3135
#if !defined(socklen_t) && !defined(SOCKLEN_T_DEFINED)
3236
typedef uint32_t socklen_t;
3337
#endif
@@ -103,4 +107,8 @@ int sal_proto_family_register(const struct proto_family *pf);
103107
int sal_proto_family_unregister(const struct proto_family *pf);
104108
struct proto_family *sal_proto_family_find(const char *name);
105109

110+
#ifdef __cplusplus
111+
}
112+
#endif
113+
106114
#endif /* SAL_H__ */

components/net/sal_socket/include/sal_ipaddr.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626

2727
#include "sal_type.h"
2828

29+
#ifdef __cplusplus
30+
extern "C" {
31+
#endif
32+
2933
/** IPv4 only: set the IP address given as an u32_t */
3034
#define ip4_addr_set_u32(dest_ipaddr, src_u32) ((dest_ipaddr)->addr = (src_u32))
3135
/** IPv4 only: get the IP address as an u32_t */

components/net/sal_socket/include/sal_netdb.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626

2727
#include <sal_socket.h>
2828

29+
#ifdef __cplusplus
30+
extern "C" {
31+
#endif
32+
2933
#define EAI_NONAME 200
3034
#define EAI_SERVICE 201
3135
#define EAI_FAIL 202
@@ -88,4 +92,8 @@ int sal_getaddrinfo(const char *nodename,
8892
const struct addrinfo *hints,
8993
struct addrinfo **res);
9094

95+
#ifdef __cplusplus
96+
}
97+
#endif
98+
9199
#endif /* SAL_NETDB_H__ */

components/net/sal_socket/include/sal_socket.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727

2828
#include "sal_ipaddr.h"
2929

30+
#ifdef __cplusplus
31+
extern "C" {
32+
#endif
33+
3034
#if !defined(socklen_t) && !defined(SOCKLEN_T_DEFINED)
3135
typedef uint32_t socklen_t;
3236
#endif
@@ -175,4 +179,8 @@ int sal_socket(int domain, int type, int protocol);
175179
int sal_closesocket(int socket);
176180
int sal_ioctlsocket(int socket, long cmd, void *arg);
177181

182+
#ifdef __cplusplus
183+
}
184+
#endif
185+
178186
#endif /* SAL_SOCKET_H__ */

components/net/sal_socket/include/sal_type.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
#include <stdlib.h>
2929
#include <stdint.h>
3030

31+
#ifdef __cplusplus
32+
extern "C" {
33+
#endif
34+
3135
typedef int8_t err_t;
3236
typedef uint8_t u8_t;
3337
typedef int8_t s8_t;
@@ -37,4 +41,8 @@ typedef uint32_t u32_t;
3741
typedef int32_t s32_t;
3842
typedef uintptr_t mem_ptr_t;
3943

44+
#ifdef __cplusplus
45+
}
46+
#endif
47+
4048
#endif /* SAL_TYPE_H__ */

components/net/sal_socket/src/sal_socket.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,6 @@ struct hostent *sal_gethostbyname(const char *name)
738738
{
739739
return hst;
740740
}
741-
continue;
742741
}
743742
}
744743

@@ -759,7 +758,6 @@ int sal_gethostbyname_r(const char *name, struct hostent *ret, char *buf,
759758
{
760759
return res;
761760
}
762-
continue;
763761
}
764762
}
765763

@@ -796,7 +794,6 @@ int sal_getaddrinfo(const char *nodename,
796794
{
797795
return ret;
798796
}
799-
continue;
800797
}
801798
}
802799

0 commit comments

Comments
 (0)