From 84fc489e0cc5ae1b663dcd30867f4dab2eeaa053 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Thu, 10 May 2007 10:59:20 +0000 Subject: [PATCH] Included patch #5448: include '#ifdef __cplusplus \ extern "C" {' in all header files. Now you can write your application using the lwIP stack in C++ and simply #include the core files. Note I have left out the netif/ppp/*h header files for now, since I don't know which files are included by applications and which are for internal use only. --- CHANGELOG | 9 ++++++++- src/include/ipv4/lwip/icmp.h | 8 ++++++++ src/include/ipv4/lwip/igmp.h | 8 ++++++++ src/include/ipv4/lwip/inet.h | 14 +++++++++++--- src/include/ipv4/lwip/ip.h | 8 ++++++++ src/include/ipv4/lwip/ip_addr.h | 8 ++++++++ src/include/ipv4/lwip/ip_frag.h | 8 ++++++++ src/include/ipv6/lwip/icmp.h | 8 ++++++++ src/include/ipv6/lwip/inet.h | 8 ++++++++ src/include/ipv6/lwip/ip.h | 8 ++++++++ src/include/ipv6/lwip/ip_addr.h | 8 ++++++++ src/include/lwip/api.h | 10 ++++++++-- src/include/lwip/api_msg.h | 9 ++++++++- src/include/lwip/arch.h | 8 ++++++++ src/include/lwip/dhcp.h | 8 ++++++++ src/include/lwip/err.h | 9 +++++++++ src/include/lwip/mem.h | 9 ++++++++- src/include/lwip/memp.h | 9 ++++++++- src/include/lwip/netif.h | 8 ++++++++ src/include/lwip/netifapi.h | 8 ++++++++ src/include/lwip/pbuf.h | 8 ++++++++ src/include/lwip/raw.h | 7 +++++++ src/include/lwip/sio.h | 8 ++++++++ src/include/lwip/snmp.h | 8 ++++++++ src/include/lwip/snmp_asn1.h | 8 ++++++++ src/include/lwip/snmp_msg.h | 8 ++++++++ src/include/lwip/snmp_structs.h | 8 ++++++++ src/include/lwip/sockets.h | 10 +++++++++- src/include/lwip/stats.h | 8 ++++++++ src/include/lwip/sys.h | 7 +++++++ src/include/lwip/tcp.h | 12 +++++++++--- src/include/lwip/tcpip.h | 7 +++++++ src/include/lwip/udp.h | 11 +++++++++-- src/include/netif/etharp.h | 8 ++++++++ src/include/netif/loopif.h | 8 ++++++++ src/include/netif/slipif.h | 8 ++++++++ 36 files changed, 292 insertions(+), 15 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 433bc73b..e9f180f5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -22,7 +22,14 @@ HISTORY * [Enter new changes just after this line - do not remove this line] ++ New features: - 2007-05-08 Simon Goldschmidt + 2007-05-10 Simon Goldschmidt + * *.h (except netif/ppp/*.h): Included patch #5448: include '#ifdef __cplusplus + \ extern "C" {' in all header files. Now you can write your application using + the lwIP stack in C++ and simply #include the core files. Note I have left + out the netif/ppp/*h header files for now, since I don't know which files are + included by applications and which are for internal use only. + + 2007-05-09 Simon Goldschmidt * opt.h, *.c/*.h: Included patch #5920: Create define to override C-library memcpy. 2 Defines are created: MEMCPY() for normal memcpy, SMEMCPY() for situations where some compilers might inline the copy and save a function diff --git a/src/include/ipv4/lwip/icmp.h b/src/include/ipv4/lwip/icmp.h index 634405b7..d3cc153d 100644 --- a/src/include/ipv4/lwip/icmp.h +++ b/src/include/ipv4/lwip/icmp.h @@ -40,6 +40,10 @@ #include "lwip/ip_addr.h" #include "lwip/netif.h" +#ifdef __cplusplus +extern "C" { +#endif + #define ICMP_ER 0 /* echo reply */ #define ICMP_DUR 3 /* destination unreachable */ #define ICMP_SQ 4 /* source quench */ @@ -108,5 +112,9 @@ PACK_STRUCT_END #define ICMPH_TYPE_SET(hdr, type) ((hdr)->_type_code = htons(ICMPH_CODE(hdr) | ((type) << 8))) #define ICMPH_CODE_SET(hdr, code) ((hdr)->_type_code = htons((code) | (ICMPH_TYPE(hdr) << 8))) +#ifdef __cplusplus +} +#endif + #endif /* __LWIP_ICMP_H__ */ diff --git a/src/include/ipv4/lwip/igmp.h b/src/include/ipv4/lwip/igmp.h index efb5107b..d6090105 100644 --- a/src/include/ipv4/lwip/igmp.h +++ b/src/include/ipv4/lwip/igmp.h @@ -38,6 +38,10 @@ /* IGMP support available? */ #if defined(LWIP_IGMP) && (LWIP_IGMP > 0) +#ifdef __cplusplus +extern "C" { +#endif + /* Some routers are not happy with ROUTER ALERT make it defineable, 1 to enable */ #define USE_ROUTER_ALERT 0 @@ -143,6 +147,10 @@ err_t igmp_ip_output_if( struct pbuf *p, struct ip_addr *src, struct ip_addr *d void igmp_send( struct igmp_group *group, u8_t type); +#ifdef __cplusplus +} +#endif + #endif /* LWIP_IGMP */ #endif /* IGMPH */ diff --git a/src/include/ipv4/lwip/inet.h b/src/include/ipv4/lwip/inet.h index 57a55a37..2725150c 100644 --- a/src/include/ipv4/lwip/inet.h +++ b/src/include/ipv4/lwip/inet.h @@ -38,6 +38,10 @@ #include "lwip/pbuf.h" #include "lwip/ip_addr.h" +#ifdef __cplusplus +extern "C" { +#endif + u16_t inet_chksum(void *dataptr, u16_t len); #if 0 /* optimized routine */ u16_t inet_chksum4(u8_t *dataptr, u16_t len); @@ -80,19 +84,23 @@ char *inet_ntoa(struct in_addr addr); /* returns ptr to static buffer; not reent #define ntohs lwip_ntohs #define htonl lwip_htonl #define ntohl lwip_ntohl -#endif +#endif /* LWIP_PREFIX_BYTEORDER_FUNCS */ #if LWIP_PLATFORM_BYTESWAP #define htons(x) LWIP_PLATFORM_HTONS(x) #define ntohs(x) LWIP_PLATFORM_HTONS(x) #define htonl(x) LWIP_PLATFORM_HTONL(x) #define ntohl(x) LWIP_PLATFORM_HTONL(x) -#else +#else /* LWIP_PLATFORM_BYTESWAP */ u16_t htons(u16_t x); u16_t ntohs(u16_t x); u32_t htonl(u32_t x); u32_t ntohl(u32_t x); -#endif +#endif /* LWIP_PLATFORM_BYTESWAP */ +#endif /* BYTE_ORDER == BIG_ENDIAN */ + +#ifdef __cplusplus +} #endif #endif /* __LWIP_INET_H__ */ diff --git a/src/include/ipv4/lwip/ip.h b/src/include/ipv4/lwip/ip.h index 9f745f5d..f5886740 100644 --- a/src/include/ipv4/lwip/ip.h +++ b/src/include/ipv4/lwip/ip.h @@ -41,6 +41,10 @@ #include "lwip/err.h" +#ifdef __cplusplus +extern "C" { +#endif + void ip_init(void); struct netif *ip_route(struct ip_addr *dest); err_t ip_input(struct pbuf *p, struct netif *inp); @@ -149,6 +153,10 @@ void ip_debug_print(struct pbuf *p); #define ip_debug_print(p) #endif /* IP_DEBUG */ +#ifdef __cplusplus +} +#endif + #endif /* __LWIP_IP_H__ */ diff --git a/src/include/ipv4/lwip/ip_addr.h b/src/include/ipv4/lwip/ip_addr.h index ce700407..84ec6e5d 100644 --- a/src/include/ipv4/lwip/ip_addr.h +++ b/src/include/ipv4/lwip/ip_addr.h @@ -34,6 +34,10 @@ #include "lwip/arch.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifdef PACK_STRUCT_USE_INCLUDES # include "arch/bpstruct.h" #endif @@ -157,4 +161,8 @@ u8_t ip_addr_isbroadcast(struct ip_addr *, struct netif *); #define ip4_addr3(ipaddr) ((u16_t)(ntohl((ipaddr)->addr) >> 8) & 0xff) #define ip4_addr4(ipaddr) ((u16_t)(ntohl((ipaddr)->addr)) & 0xff) +#ifdef __cplusplus +} +#endif + #endif /* __LWIP_IP_ADDR_H__ */ diff --git a/src/include/ipv4/lwip/ip_frag.h b/src/include/ipv4/lwip/ip_frag.h index 31b40b1c..081555d6 100644 --- a/src/include/ipv4/lwip/ip_frag.h +++ b/src/include/ipv4/lwip/ip_frag.h @@ -41,6 +41,10 @@ #if (IP_FRAG || IP_REASSEMBLY) +#ifdef __cplusplus +extern "C" { +#endif + /* The IP timer interval in milliseconds. */ #define IP_TMR_INTERVAL 1000 @@ -49,6 +53,10 @@ void ip_reass_tmr(void); struct pbuf * ip_reass(struct pbuf *p); err_t ip_frag(struct pbuf *p, struct netif *netif, struct ip_addr *dest); +#ifdef __cplusplus +} +#endif + #endif /* IP_FRAG || IP_REASSEMBLY */ #endif /* __LWIP_IP_FRAG_H__ */ diff --git a/src/include/ipv6/lwip/icmp.h b/src/include/ipv6/lwip/icmp.h index 2b6adb12..0df99344 100644 --- a/src/include/ipv6/lwip/icmp.h +++ b/src/include/ipv6/lwip/icmp.h @@ -39,6 +39,10 @@ #include "lwip/netif.h" +#ifdef __cplusplus +extern "C" { +#endif + #define ICMP6_DUR 1 #define ICMP6_TE 3 #define ICMP6_ECHO 128 /* echo */ @@ -86,5 +90,9 @@ struct icmp_te_hdr { u32_t unused; }; +#ifdef __cplusplus +} +#endif + #endif /* __LWIP_ICMP_H__ */ diff --git a/src/include/ipv6/lwip/inet.h b/src/include/ipv6/lwip/inet.h index ae783436..8228c205 100644 --- a/src/include/ipv6/lwip/inet.h +++ b/src/include/ipv6/lwip/inet.h @@ -38,6 +38,10 @@ #include "lwip/pbuf.h" #include "lwip/ip_addr.h" +#ifdef __cplusplus +extern "C" { +#endif + u16_t inet_chksum(void *data, u16_t len); u16_t inet_chksum_pbuf(struct pbuf *p); u16_t inet_chksum_pseudo(struct pbuf *p, @@ -58,5 +62,9 @@ u32_t ntohl(u32_t n); #endif /* _NETINET_IN_H */ #endif /* _MACHINE_ENDIAN_H_ */ +#ifdef __cplusplus +} +#endif + #endif /* __LWIP_INET_H__ */ diff --git a/src/include/ipv6/lwip/ip.h b/src/include/ipv6/lwip/ip.h index 3393c0f4..8b4301b6 100644 --- a/src/include/ipv6/lwip/ip.h +++ b/src/include/ipv6/lwip/ip.h @@ -39,6 +39,10 @@ #include "lwip/err.h" +#ifdef __cplusplus +extern "C" { +#endif + #define IP_HLEN 40 #define IP_PROTO_ICMP 58 @@ -104,6 +108,10 @@ err_t ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, void ip_debug_print(struct pbuf *p); #endif /* IP_DEBUG */ +#ifdef __cplusplus +} +#endif + #endif /* __LWIP_IP_H__ */ diff --git a/src/include/ipv6/lwip/ip_addr.h b/src/include/ipv6/lwip/ip_addr.h index 8f926166..02e6cee4 100644 --- a/src/include/ipv6/lwip/ip_addr.h +++ b/src/include/ipv6/lwip/ip_addr.h @@ -34,6 +34,10 @@ #include "lwip/arch.h" +#ifdef __cplusplus +extern "C" { +#endif + #define IP_ADDR_ANY 0 #ifdef PACK_STRUCT_USE_INCLUDES @@ -86,4 +90,8 @@ u8_t ip_addr_isany(struct ip_addr *addr); (ntohl(ipaddr->addr[3]) >> 16) & 0xffff, \ ntohl(ipaddr->addr[3]) & 0xffff)); +#ifdef __cplusplus +} +#endif + #endif /* __LWIP_IP_ADDR_H__ */ diff --git a/src/include/lwip/api.h b/src/include/lwip/api.h index a7a25e1b..e2d926aa 100644 --- a/src/include/lwip/api.h +++ b/src/include/lwip/api.h @@ -44,6 +44,10 @@ #include "lwip/err.h" +#ifdef __cplusplus +extern "C" { +#endif + #define NETCONN_NOCOPY 0x00 #define NETCONN_COPY 0x01 @@ -173,6 +177,8 @@ err_t netconn_join_leave_group (struct netconn *conn, err_t netconn_err (struct netconn *conn); +#ifdef __cplusplus +} +#endif + #endif /* __LWIP_API_H__ */ - - diff --git a/src/include/lwip/api_msg.h b/src/include/lwip/api_msg.h index 3bf8aa49..70bb47d6 100644 --- a/src/include/lwip/api_msg.h +++ b/src/include/lwip/api_msg.h @@ -43,6 +43,10 @@ #include "lwip/api.h" +#ifdef __cplusplus +extern "C" { +#endif + enum api_msg_type { API_MSG_NEWCONN, API_MSG_DELCONN, @@ -94,5 +98,8 @@ struct api_msg { void api_msg_input(struct api_msg *msg); err_t api_msg_post(struct api_msg *msg); -#endif /* __LWIP_API_MSG_H__ */ +#ifdef __cplusplus +} +#endif +#endif /* __LWIP_API_MSG_H__ */ diff --git a/src/include/lwip/arch.h b/src/include/lwip/arch.h index 9f9803d8..7d1400be 100644 --- a/src/include/lwip/arch.h +++ b/src/include/lwip/arch.h @@ -42,6 +42,10 @@ #include "arch/cc.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifndef PACK_STRUCT_BEGIN #define PACK_STRUCT_BEGIN #endif /* PACK_STRUCT_BEGIN */ @@ -217,4 +221,8 @@ extern int errno; #endif /* LWIP_PROVIDE_ERRNO */ +#ifdef __cplusplus +} +#endif + #endif /* __LWIP_ARCH_H__ */ diff --git a/src/include/lwip/dhcp.h b/src/include/lwip/dhcp.h index 2cd1167a..6b6d8d30 100644 --- a/src/include/lwip/dhcp.h +++ b/src/include/lwip/dhcp.h @@ -8,6 +8,10 @@ #include "lwip/netif.h" #include "lwip/udp.h" +#ifdef __cplusplus +extern "C" { +#endif + /** period (in seconds) of the application calling dhcp_coarse_tmr() */ #define DHCP_COARSE_TIMER_SECS 60 /** period (in milliseconds) of the application calling dhcp_fine_tmr() */ @@ -221,4 +225,8 @@ void dhcp_fine_tmr(void); #define DHCP_OVERLOAD_SNAME 2 #define DHCP_OVERLOAD_SNAME_FILE 3 +#ifdef __cplusplus +} +#endif + #endif /*__LWIP_DHCP_H__*/ diff --git a/src/include/lwip/err.h b/src/include/lwip/err.h index b4c2a7eb..b9cd6fb5 100644 --- a/src/include/lwip/err.h +++ b/src/include/lwip/err.h @@ -36,6 +36,10 @@ #include "arch/cc.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef s8_t err_t; /* Definitions for error constants. */ @@ -69,4 +73,9 @@ extern const char *lwip_strerr(err_t err); #else #define lwip_strerr(x) "" #endif /* LWIP_DEBUG */ + +#ifdef __cplusplus +} +#endif + #endif /* __LWIP_ERR_H__ */ diff --git a/src/include/lwip/mem.h b/src/include/lwip/mem.h index 751d3d5a..fbafa709 100644 --- a/src/include/lwip/mem.h +++ b/src/include/lwip/mem.h @@ -35,6 +35,10 @@ #include "lwip/opt.h" #include "lwip/arch.h" +#ifdef __cplusplus +extern "C" { +#endif + #if MEM_SIZE > 64000l typedef u32_t mem_size_t; #define MEM_SIZE_F U32_F @@ -74,5 +78,8 @@ void *mem_realloc(void *mem, mem_size_t size); #define MEM_ALIGN(addr) ((void *)(((mem_ptr_t)(addr) + MEM_ALIGNMENT - 1) & ~(mem_ptr_t)(MEM_ALIGNMENT-1))) #endif -#endif /* __LWIP_MEM_H__ */ +#ifdef __cplusplus +} +#endif +#endif /* __LWIP_MEM_H__ */ diff --git a/src/include/lwip/memp.h b/src/include/lwip/memp.h index 71fd49fb..54fc3cc5 100644 --- a/src/include/lwip/memp.h +++ b/src/include/lwip/memp.h @@ -35,6 +35,10 @@ #include "lwip/opt.h" +#ifdef __cplusplus +extern "C" { +#endif + /* If you change this enum, think to update memp_names in stats_display (stats.c) */ typedef enum { MEMP_PBUF, @@ -60,5 +64,8 @@ void memp_init(void); void *memp_malloc(memp_t type); void memp_free(memp_t type, void *mem); +#ifdef __cplusplus +} +#endif + #endif /* __LWIP_MEMP_H__ */ - diff --git a/src/include/lwip/netif.h b/src/include/lwip/netif.h index 1d013906..252c8581 100644 --- a/src/include/lwip/netif.h +++ b/src/include/lwip/netif.h @@ -44,6 +44,10 @@ # include "lwip/dhcp.h" #endif +#ifdef __cplusplus +extern "C" { +#endif + /** must be the maximum of all used hardware address lengths across all types of interfaces in use */ #define NETIF_MAX_HWADDR_LEN 6U @@ -183,4 +187,8 @@ u8_t netif_is_up(struct netif *netif); void netif_set_status_callback( struct netif *netif, void (* status_callback)(struct netif *netif )); #endif /* LWIP_NETIF_CALLBACK */ +#ifdef __cplusplus +} +#endif + #endif /* __LWIP_NETIF_H__ */ diff --git a/src/include/lwip/netifapi.h b/src/include/lwip/netifapi.h index dfe7b0ef..8eb575a1 100644 --- a/src/include/lwip/netifapi.h +++ b/src/include/lwip/netifapi.h @@ -35,6 +35,10 @@ #if LWIP_NETIF_API +#ifdef __cplusplus +extern "C" { +#endif + enum netifapi_msg_type { NETIFAPI_MSG_NETIF_ADD, NETIFAPI_MSG_NETIF_REMOVE, @@ -82,6 +86,10 @@ err_t netifapi_dhcp_stop ( struct netif *netif); void netifapi_msg_input(struct netifapi_msg *msg); err_t netifapi_msg_post (struct netifapi_msg *msg); +#ifdef __cplusplus +} +#endif + #endif /* LWIP_NETIF_API */ #endif /* __LWIP_NETIFAPI_H__ */ diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h index 06173b5a..171ebb11 100644 --- a/src/include/lwip/pbuf.h +++ b/src/include/lwip/pbuf.h @@ -36,6 +36,10 @@ #include "arch/cc.h" #include "lwip/err.h" +#ifdef __cplusplus +extern "C" { +#endif + #define PBUF_TRANSPORT_HLEN 20 #define PBUF_IP_HLEN 20 @@ -110,4 +114,8 @@ struct pbuf *pbuf_dechain(struct pbuf *p); err_t pbuf_copy(struct pbuf *p_to, struct pbuf *p_from); #endif +#ifdef __cplusplus +} +#endif + #endif /* __LWIP_PBUF_H__ */ diff --git a/src/include/lwip/raw.h b/src/include/lwip/raw.h index 6f7a9871..e4451650 100644 --- a/src/include/lwip/raw.h +++ b/src/include/lwip/raw.h @@ -38,6 +38,10 @@ #include "lwip/inet.h" #include "lwip/ip.h" +#ifdef __cplusplus +extern "C" { +#endif + struct raw_pcb { /* Common members of all PCB types */ IP_PCB; @@ -70,5 +74,8 @@ err_t raw_send (struct raw_pcb *pcb, struct pbuf *p); u8_t raw_input (struct pbuf *p, struct netif *inp); void raw_init (void); +#ifdef __cplusplus +} +#endif #endif /* __LWIP_RAW_H__ */ diff --git a/src/include/lwip/sio.h b/src/include/lwip/sio.h index 8a37aa35..1453127a 100644 --- a/src/include/lwip/sio.h +++ b/src/include/lwip/sio.h @@ -34,6 +34,10 @@ #include "arch/cc.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __sio_fd_t_defined typedef void * sio_fd_t; #endif @@ -61,3 +65,7 @@ u32_t sio_write(sio_fd_t, u8_t *, u32_t); #ifndef sio_read_abort void sio_read_abort(sio_fd_t); #endif + +#ifdef __cplusplus +} +#endif diff --git a/src/include/lwip/snmp.h b/src/include/lwip/snmp.h index dfcb9f23..b75e8e2c 100644 --- a/src/include/lwip/snmp.h +++ b/src/include/lwip/snmp.h @@ -37,6 +37,10 @@ #include "lwip/netif.h" #include "lwip/udp.h" +#ifdef __cplusplus +extern "C" { +#endif + /* SNMP support available? */ #if defined(LWIP_SNMP) && (LWIP_SNMP > 0) @@ -310,4 +314,8 @@ void snmp_get_snmpenableauthentraps(u8_t *value); #endif +#ifdef __cplusplus +} +#endif + #endif /* __LWIP_SNMP_H__ */ diff --git a/src/include/lwip/snmp_asn1.h b/src/include/lwip/snmp_asn1.h index c1df94a9..d753675e 100644 --- a/src/include/lwip/snmp_asn1.h +++ b/src/include/lwip/snmp_asn1.h @@ -41,6 +41,10 @@ #include "lwip/pbuf.h" #include "lwip/snmp.h" +#ifdef __cplusplus +extern "C" { +#endif + #define SNMP_ASN1_UNIV (!0x80 | !0x40) #define SNMP_ASN1_APPLIC (!0x80 | 0x40) #define SNMP_ASN1_CONTXT ( 0x80 | !0x40) @@ -87,4 +91,8 @@ err_t snmp_asn1_enc_s32t(struct pbuf *p, u16_t ofs, u8_t octets_needed, s32_t va err_t snmp_asn1_enc_oid(struct pbuf *p, u16_t ofs, u8_t ident_len, s32_t *ident); err_t snmp_asn1_enc_raw(struct pbuf *p, u16_t ofs, u8_t raw_len, u8_t *raw); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/include/lwip/snmp_msg.h b/src/include/lwip/snmp_msg.h index 2e126ebe..d419b26e 100644 --- a/src/include/lwip/snmp_msg.h +++ b/src/include/lwip/snmp_msg.h @@ -44,6 +44,10 @@ #include "private_mib.h" #endif +#ifdef __cplusplus +extern "C" { +#endif + /* The listen port of the SNMP agent. Clients have to make their requests to this port. Most standard clients won't work if you change this! */ #ifndef SNMP_IN_PORT @@ -297,4 +301,8 @@ err_t snmp_send_trap(s8_t generic_trap, struct snmp_obj_id *eoid, s32_t specific void snmp_coldstart_trap(void); void snmp_authfail_trap(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/include/lwip/snmp_structs.h b/src/include/lwip/snmp_structs.h index f4854664..c9eba807 100644 --- a/src/include/lwip/snmp_structs.h +++ b/src/include/lwip/snmp_structs.h @@ -47,6 +47,10 @@ #include "private_mib.h" #endif +#ifdef __cplusplus +extern "C" { +#endif + /* MIB object instance */ #define MIB_OBJECT_NONE 0 #define MIB_OBJECT_SCALAR 1 @@ -249,5 +253,9 @@ struct mib_node* snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t * u8_t snmp_iso_prefix_tst(u8_t ident_len, s32_t *ident); u8_t snmp_iso_prefix_expand(u8_t ident_len, s32_t *ident, struct snmp_obj_id *oidret); +#ifdef __cplusplus +} +#endif + #endif /* LWIP_SNMP */ #endif diff --git a/src/include/lwip/sockets.h b/src/include/lwip/sockets.h index 782a405a..a49a5cad 100644 --- a/src/include/lwip/sockets.h +++ b/src/include/lwip/sockets.h @@ -33,10 +33,15 @@ #ifndef __LWIP_SOCKETS_H__ #define __LWIP_SOCKETS_H__ + #include "lwip/ip_addr.h" #include "opt.h" #include "tcp.h" +#ifdef __cplusplus +extern "C" { +#endif + struct sockaddr_in { u8_t sin_len; u8_t sin_family; @@ -293,5 +298,8 @@ int lwip_ioctl(int s, long cmd, void *argp); #endif /* LWIP_COMPAT_SOCKETS */ -#endif /* __LWIP_SOCKETS_H__ */ +#ifdef __cplusplus +} +#endif +#endif /* __LWIP_SOCKETS_H__ */ diff --git a/src/include/lwip/stats.h b/src/include/lwip/stats.h index d4a419ee..1a955706 100644 --- a/src/include/lwip/stats.h +++ b/src/include/lwip/stats.h @@ -38,6 +38,10 @@ #include "lwip/mem.h" #include "lwip/memp.h" +#ifdef __cplusplus +extern "C" { +#endif + #if LWIP_STATS #ifndef LWIP_STATS_LARGE @@ -179,4 +183,8 @@ void stats_display(void); #define stats_display() #endif /* LWIP_STATS_DISPLAY */ +#ifdef __cplusplus +} +#endif + #endif /* __LWIP_STATS_H__ */ diff --git a/src/include/lwip/sys.h b/src/include/lwip/sys.h index 50613c62..fc666ca8 100644 --- a/src/include/lwip/sys.h +++ b/src/include/lwip/sys.h @@ -36,6 +36,9 @@ #include "lwip/opt.h" +#ifdef __cplusplus +extern "C" { +#endif #if NO_SYS @@ -195,4 +198,8 @@ void sys_arch_unprotect(sys_prot_t pval); #endif /* SYS_ARCH_PROTECT */ +#ifdef __cplusplus +} +#endif + #endif /* __LWIP_SYS_H__ */ diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h index dbf4ef47..76bbe254 100644 --- a/src/include/lwip/tcp.h +++ b/src/include/lwip/tcp.h @@ -42,6 +42,10 @@ #include "lwip/err.h" +#ifdef __cplusplus +extern "C" { +#endif + struct tcp_pcb; /* Functions for interfacing with TCP: */ @@ -538,7 +542,9 @@ extern struct tcp_pcb *tcp_tmp_pcb; /* Only used for temporary storage. */ npcb->next = NULL; \ } while(0) #endif /* LWIP_DEBUG */ + +#ifdef __cplusplus +} +#endif + #endif /* __LWIP_TCP_H__ */ - - - diff --git a/src/include/lwip/tcpip.h b/src/include/lwip/tcpip.h index ed7fbea0..5f8e9d56 100644 --- a/src/include/lwip/tcpip.h +++ b/src/include/lwip/tcpip.h @@ -36,6 +36,10 @@ #include "lwip/netifapi.h" #include "lwip/pbuf.h" +#ifdef __cplusplus +extern "C" { +#endif + void tcpip_init(void (* tcpip_init_done)(void *), void *arg); err_t tcpip_apimsg(struct api_msg *apimsg); #if ETHARP_TCPIP_INPUT @@ -82,5 +86,8 @@ struct tcpip_msg { } msg; }; +#ifdef __cplusplus +} +#endif #endif /* __LWIP_TCPIP_H__ */ diff --git a/src/include/lwip/udp.h b/src/include/lwip/udp.h index 346898e8..089066e3 100644 --- a/src/include/lwip/udp.h +++ b/src/include/lwip/udp.h @@ -38,6 +38,10 @@ #include "lwip/inet.h" #include "lwip/ip.h" +#ifdef __cplusplus +extern "C" { +#endif + #define UDP_HLEN 8 struct udp_hdr { @@ -101,6 +105,9 @@ void udp_debug_print(struct udp_hdr *udphdr); #else #define udp_debug_print(udphdr) #endif + +#ifdef __cplusplus +} +#endif + #endif /* __LWIP_UDP_H__ */ - - diff --git a/src/include/netif/etharp.h b/src/include/netif/etharp.h index ebb49178..84d8199a 100644 --- a/src/include/netif/etharp.h +++ b/src/include/netif/etharp.h @@ -41,6 +41,10 @@ #include "lwip/netif.h" #include "lwip/ip.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifndef ETH_PAD_SIZE #define ETH_PAD_SIZE 0 #endif @@ -136,4 +140,8 @@ err_t etharp_output(struct netif *netif, struct ip_addr *ipaddr, err_t etharp_query(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q); err_t etharp_request(struct netif *netif, struct ip_addr *ipaddr); +#ifdef __cplusplus +} +#endif + #endif /* __NETIF_ARP_H__ */ diff --git a/src/include/netif/loopif.h b/src/include/netif/loopif.h index 3fa8ecb5..68fc7b39 100644 --- a/src/include/netif/loopif.h +++ b/src/include/netif/loopif.h @@ -35,10 +35,18 @@ #include "lwip/netif.h" #include "lwip/err.h" +#ifdef __cplusplus +extern "C" { +#endif + #if !LWIP_LOOPIF_MULTITHREADING void loopif_poll(struct netif *netif); #endif err_t loopif_init(struct netif *netif); +#ifdef __cplusplus +} +#endif + #endif /* __NETIF_LOOPIF_H__ */ diff --git a/src/include/netif/slipif.h b/src/include/netif/slipif.h index bf70046a..aa08ada4 100644 --- a/src/include/netif/slipif.h +++ b/src/include/netif/slipif.h @@ -36,7 +36,15 @@ #include "lwip/netif.h" +#ifdef __cplusplus +extern "C" { +#endif + err_t slipif_init(struct netif * netif); + +#ifdef __cplusplus +} +#endif #endif