mfontanini / libtins

High-level, multiplatform C++ network packet sniffing and crafting library.
http://libtins.github.io/
BSD 2-Clause "Simplified" License
1.89k stars 374 forks source link

clang-tidy fixes #478

Open neheb opened 2 years ago

neheb commented 2 years ago

why is there still C++98 support?

edit: just tested. It doesn't compile with C++98 because of std::function.

edit2: fix for that:

--- a/include/tins/crypto.h
+++ b/include/tins/crypto.h
@@ -35,9 +35,6 @@
 #include <map>
 #include <string>
 #include <vector>
-#ifdef TINS_HAVE_WPA2_CALLBACKS
-    #include <functional>
-#endif // TINS_HAVE_WPA2_CALLBACKS
 #include <tins/macros.h>
 #include <tins/handshake_capturer.h>

@@ -268,8 +265,8 @@ public:
      * The first argument to the function will be the access point's SSID and
      * the second one its BSSID.
      */
-    typedef std::function<void(const std::string&,
-                               const address_type&)> ap_found_callback_type;
+    typedef void(*ap_found_callback_type)(const std::string&,
+                               const address_type&);

     /**
      * The type used to store the callback type used when a new handshake
@@ -279,9 +276,9 @@ public:
      * the second one its BSSID. The third argument will be the client's hardware
      * address.
      */
-    typedef std::function<void(const std::string&,
+    typedef void(*handshake_captured_callback_type) (const std::string&,
                                const address_type&,
-                               const address_type&)> handshake_captured_callback_type;
+                               const address_type&);

     #endif // TINS_HAVE_WPA2_CALLBACKS