Make peer headers build with C++ sources
authorLuke Howard <lukeh@padl.com>
Tue, 19 Oct 2010 13:06:12 +0000 (00:06 +1100)
committerLuke Howard <lukeh@padl.com>
Tue, 19 Oct 2010 13:06:12 +0000 (00:06 +1100)
21 files changed:
src/eap_common/eap_common.h
src/eap_common/eap_defs.h
src/eap_common/eap_fast_common.h
src/eap_common/eap_gpsk_common.h
src/eap_common/eap_ikev2_common.h
src/eap_common/eap_pax_common.h
src/eap_common/eap_peap_common.h
src/eap_common/eap_psk_common.h
src/eap_common/eap_pwd_common.h
src/eap_common/eap_sake_common.h
src/eap_common/eap_sim_common.h
src/eap_common/eap_tlv_common.h
src/eap_common/eap_ttls.h
src/eap_common/eap_wsc_common.h
src/eap_peer/eap.h
src/eap_peer/eap_config.h
src/eap_peer/eap_i.h
src/eap_peer/eap_methods.h
src/eap_peer/eap_tls_common.h
src/utils/wpa_debug.h
src/utils/wpabuf.h

index b95e76b..9db77ed 100644 (file)
 
 #include "wpabuf.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 const u8 * eap_hdr_validate(int vendor, EapType eap_type,
                            const struct wpabuf *msg, size_t *plen);
 struct wpabuf * eap_msg_alloc(int vendor, EapType type, size_t payload_len,
@@ -25,4 +29,8 @@ void eap_update_len(struct wpabuf *msg);
 u8 eap_get_id(const struct wpabuf *msg);
 EapType eap_get_type(const struct wpabuf *msg);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* EAP_COMMON_H */
index 3035301..482f9d2 100644 (file)
 #ifndef EAP_DEFS_H
 #define EAP_DEFS_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* RFC 3748 - Extensible Authentication Protocol (EAP) */
 
 #ifdef _MSC_VER
@@ -83,4 +87,8 @@ enum {
 #define EAP_MSK_LEN 64
 #define EAP_EMSK_LEN 64
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* EAP_DEFS_H */
index c85fd37..c4f54ca 100644 (file)
 #ifndef EAP_FAST_H
 #define EAP_FAST_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define EAP_FAST_VERSION 1
 #define EAP_FAST_KEY_LEN 64
 #define EAP_FAST_SIMCK_LEN 40
@@ -110,4 +114,8 @@ void eap_fast_derive_eap_emsk(const u8 *simck, u8 *emsk);
 int eap_fast_parse_tlv(struct eap_fast_tlv_parse *tlv,
                       int tlv_type, u8 *pos, int len);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* EAP_FAST_H */
index a30ab97..6766603 100644 (file)
 #ifndef EAP_GPSK_COMMON_H
 #define EAP_GPSK_COMMON_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define EAP_GPSK_OPCODE_GPSK_1 1
 #define EAP_GPSK_OPCODE_GPSK_2 2
 #define EAP_GPSK_OPCODE_GPSK_3 3
@@ -63,4 +67,8 @@ size_t eap_gpsk_mic_len(int vendor, int specifier);
 int eap_gpsk_compute_mic(const u8 *sk, size_t sk_len, int vendor,
                         int specifier, const u8 *data, size_t len, u8 *mic);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* EAP_GPSK_COMMON_H */
index a9fc2ca..a054b6a 100644 (file)
 #ifndef EAP_IKEV2_COMMON_H
 #define EAP_IKEV2_COMMON_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifdef CCNS_PL
 /* incorrect bit order */
 #define IKEV2_FLAGS_LENGTH_INCLUDED 0x01
@@ -39,4 +43,8 @@ int eap_ikev2_validate_icv(int integ_alg, struct ikev2_keys *keys,
                           int initiator, const struct wpabuf *msg,
                           const u8 *pos, const u8 *end);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* EAP_IKEV2_COMMON_H */
index dcc171e..ff9b903 100644 (file)
 #ifndef EAP_PAX_COMMON_H
 #define EAP_PAX_COMMON_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifdef _MSC_VER
 #pragma pack(push, 1)
 #endif /* _MSC_VER */
@@ -94,4 +98,8 @@ int eap_pax_mac(u8 mac_id, const u8 *key, size_t key_len,
 int eap_pax_initial_key_derivation(u8 mac_id, const u8 *ak, const u8 *e,
                                   u8 *mk, u8 *ck, u8 *ick);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* EAP_PAX_COMMON_H */
index f59afb0..b67de7e 100644 (file)
 #ifndef EAP_PEAP_COMMON_H
 #define EAP_PEAP_COMMON_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void peap_prfplus(int version, const u8 *key, size_t key_len,
                  const char *label, const u8 *seed, size_t seed_len,
                  u8 *buf, size_t buf_len);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* EAP_PEAP_COMMON_H */
index 8adc054..0de2c75 100644 (file)
@@ -15,6 +15,9 @@
 #ifndef EAP_PSK_COMMON_H
 #define EAP_PSK_COMMON_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 #define EAP_PSK_RAND_LEN 16
 #define EAP_PSK_MAC_LEN 16
@@ -75,4 +78,8 @@ int __must_check eap_psk_key_setup(const u8 *psk, u8 *ak, u8 *kdk);
 int __must_check eap_psk_derive_keys(const u8 *kdk, const u8 *rand_p, u8 *tek,
                                     u8 *msk, u8 *emsk);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* EAP_PSK_COMMON_H */
index 7389894..03454ac 100644 (file)
 #include <openssl/evp.h>
 #include <openssl/hmac.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*
  * definition of a finite cyclic group
  * TODO: support one based on a prime field
@@ -76,4 +80,8 @@ void H_Init(HMAC_CTX *);
 void H_Update(HMAC_CTX *, const u8 *, int);
 void H_Final(HMAC_CTX *, u8 *);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif  /* EAP_PWD_COMMON_H */
index 201e207..8a5b170 100644 (file)
 #ifndef EAP_SAKE_COMMON_H
 #define EAP_SAKE_COMMON_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define EAP_SAKE_VERSION 2
 
 #define EAP_SAKE_SUBTYPE_CHALLENGE 1
@@ -99,4 +103,8 @@ int eap_sake_compute_mic(const u8 *tek_auth,
 void eap_sake_add_attr(struct wpabuf *buf, u8 type, const u8 *data,
                       size_t len);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* EAP_SAKE_COMMON_H */
index 48c8eaa..b6359a9 100644 (file)
 #ifndef EAP_SIM_COMMON_H
 #define EAP_SIM_COMMON_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define EAP_SIM_NONCE_S_LEN 16
 #define EAP_SIM_NONCE_MT_LEN 16
 #define EAP_SIM_MAC_LEN 16
@@ -232,4 +236,8 @@ int eap_sim_msg_add_encr_end(struct eap_sim_msg *msg, u8 *k_encr,
 
 void eap_sim_report_notification(void *msg_ctx, int notification, int aka);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* EAP_SIM_COMMON_H */
index f86015d..25522ae 100644 (file)
 #ifndef EAP_TLV_COMMON_H
 #define EAP_TLV_COMMON_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* EAP-TLV TLVs (draft-josefsson-ppext-eap-tls-eap-10.txt) */
 #define EAP_TLV_RESULT_TLV 3 /* Acknowledged Result */
 #define EAP_TLV_NAK_TLV 4
@@ -115,4 +119,8 @@ struct eap_tlv_pac_type_tlv {
 #define EAP_TLV_ACTION_PROCESS_TLV 1
 #define EAP_TLV_ACTION_NEGOTIATE_EAP 2
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* EAP_TLV_COMMON_H */
index 797d084..09b6083 100644 (file)
 #ifndef EAP_TTLS_H
 #define EAP_TTLS_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct ttls_avp {
        be32 avp_code;
        be32 avp_length; /* 8-bit flags, 24-bit length;
@@ -68,4 +72,8 @@ do { \
 #define EAP_TTLS_CHAP_CHALLENGE_LEN 16
 #define EAP_TTLS_CHAP_PASSWORD_LEN 16
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* EAP_TTLS_H */
index fdf61d3..2d88b5a 100644 (file)
 #ifndef EAP_WSC_COMMON_H
 #define EAP_WSC_COMMON_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define EAP_VENDOR_TYPE_WSC 1
 
 #define WSC_FLAGS_MF 0x01
@@ -30,4 +34,8 @@
 
 struct wpabuf * eap_wsc_build_frag_ack(u8 id, u8 code);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* EAP_WSC_COMMON_H */
index 40d0b69..6a1b511 100644 (file)
 #include "eap_common/eap_defs.h"
 #include "eap_peer/eap_methods.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct eap_sm;
 struct wpa_config_blob;
 struct wpabuf;
@@ -288,4 +292,8 @@ int eap_is_wps_pin_enrollee(struct eap_peer_config *conf);
 
 #endif /* IEEE8021X_EAPOL */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* EAP_H */
index b64b68f..cb381bc 100644 (file)
 #ifndef EAP_CONFIG_H
 #define EAP_CONFIG_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * struct eap_peer_config - EAP peer configuration/credentials
  */
@@ -666,4 +670,8 @@ struct wpa_config_blob {
        struct wpa_config_blob *next;
 };
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* EAP_CONFIG_H */
index afca611..d6c391c 100644 (file)
 #include "eap_peer/eap.h"
 #include "eap_common/eap_common.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* RFC 4137 - EAP Peer state machine */
 
 typedef enum {
@@ -353,4 +357,8 @@ eap_get_config_blob(struct eap_sm *sm, const char *name);
 void eap_notify_pending(struct eap_sm *sm);
 int eap_allowed_method(struct eap_sm *sm, int vendor, u32 method);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* EAP_I_H */
index 4330b57..57302b2 100644 (file)
 
 #include "eap_common/eap_defs.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 const struct eap_method * eap_peer_get_eap_method(int vendor, EapType method);
 const struct eap_method * eap_peer_get_methods(size_t *count);
 
@@ -111,4 +115,8 @@ int eap_peer_vendor_test_register(void);
 int eap_peer_tnc_register(void);
 int eap_peer_pwd_register(void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* EAP_METHODS_H */
index e9e0998..53ed1a9 100644 (file)
 #ifndef EAP_TLS_COMMON_H
 #define EAP_TLS_COMMON_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * struct eap_ssl_data - TLS data for EAP methods
  */
@@ -123,4 +127,8 @@ int eap_peer_select_phase2_methods(struct eap_peer_config *config,
 int eap_peer_tls_phase2_nak(struct eap_method_type *types, size_t num_types,
                            struct eap_hdr *hdr, struct wpabuf **resp);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* EAP_TLS_COMMON_H */
index 9dace70..0f7bf28 100644 (file)
 
 #include "wpabuf.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Debugging function - conditional printf and hex dump. Driver wrappers can
  * use these for debugging purposes. */
 
@@ -81,7 +85,7 @@ void wpa_hexdump(int level, const char *title, const u8 *buf, size_t len);
 static inline void wpa_hexdump_buf(int level, const char *title,
                                   const struct wpabuf *buf)
 {
-       wpa_hexdump(level, title, wpabuf_head(buf), wpabuf_len(buf));
+       wpa_hexdump(level, title, (const u8 *)wpabuf_head(buf), wpabuf_len(buf));
 }
 
 /**
@@ -102,7 +106,7 @@ void wpa_hexdump_key(int level, const char *title, const u8 *buf, size_t len);
 static inline void wpa_hexdump_buf_key(int level, const char *title,
                                       const struct wpabuf *buf)
 {
-       wpa_hexdump_key(level, title, wpabuf_head(buf), wpabuf_len(buf));
+       wpa_hexdump_key(level, title, (const u8 *)wpabuf_head(buf), wpabuf_len(buf));
 }
 
 /**
@@ -255,4 +259,8 @@ static inline void wpa_debug_close_syslog(void)
 #define WPA_ASSERT(a) do { } while (0)
 #endif
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* WPA_DEBUG_H */
index cccfcc8..44c0510 100644 (file)
 #ifndef WPABUF_H
 #define WPABUF_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*
  * Internal data structure for wpabuf. Please do not touch this directly from
  * elsewhere. This is only defined in header file to allow inline functions
@@ -85,7 +89,7 @@ static inline const void * wpabuf_head(const struct wpabuf *buf)
 
 static inline const u8 * wpabuf_head_u8(const struct wpabuf *buf)
 {
-       return wpabuf_head(buf);
+       return (const u8 *)wpabuf_head(buf);
 }
 
 /**
@@ -102,42 +106,42 @@ static inline void * wpabuf_mhead(struct wpabuf *buf)
 
 static inline u8 * wpabuf_mhead_u8(struct wpabuf *buf)
 {
-       return wpabuf_mhead(buf);
+       return (u8 *)wpabuf_mhead(buf);
 }
 
 static inline void wpabuf_put_u8(struct wpabuf *buf, u8 data)
 {
-       u8 *pos = wpabuf_put(buf, 1);
+       u8 *pos = (u8 *)wpabuf_put(buf, 1);
        *pos = data;
 }
 
 static inline void wpabuf_put_le16(struct wpabuf *buf, u16 data)
 {
-       u8 *pos = wpabuf_put(buf, 2);
+       u8 *pos = (u8 *)wpabuf_put(buf, 2);
        WPA_PUT_LE16(pos, data);
 }
 
 static inline void wpabuf_put_le32(struct wpabuf *buf, u32 data)
 {
-       u8 *pos = wpabuf_put(buf, 4);
+       u8 *pos = (u8 *)wpabuf_put(buf, 4);
        WPA_PUT_LE32(pos, data);
 }
 
 static inline void wpabuf_put_be16(struct wpabuf *buf, u16 data)
 {
-       u8 *pos = wpabuf_put(buf, 2);
+       u8 *pos = (u8 *)wpabuf_put(buf, 2);
        WPA_PUT_BE16(pos, data);
 }
 
 static inline void wpabuf_put_be24(struct wpabuf *buf, u32 data)
 {
-       u8 *pos = wpabuf_put(buf, 3);
+       u8 *pos = (u8 *)wpabuf_put(buf, 3);
        WPA_PUT_BE24(pos, data);
 }
 
 static inline void wpabuf_put_be32(struct wpabuf *buf, u32 data)
 {
-       u8 *pos = wpabuf_put(buf, 4);
+       u8 *pos = (u8 *)wpabuf_put(buf, 4);
        WPA_PUT_BE32(pos, data);
 }
 
@@ -165,4 +169,8 @@ static inline void wpabuf_put_str(struct wpabuf *dst, const char *str)
        wpabuf_put_data(dst, str, os_strlen(str));
 }
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* WPABUF_H */