1 #ifndef __WIFIPCAP_UTIL_H_ 2 #define __WIFIPCAP_UTIL_H_ 3 4 #include <ostream> 5 6 typedef unsigned char uint8_t; 7 typedef unsigned short uint16_t; 8 #ifdef _WIN32 9 typedef unsigned long long uint64_t; 10 #endif 11 12 #if 0 13 struct MAC { 14 uint64_t val; 15 MAC() {} 16 MAC(const uint8_t *stream); 17 MAC(uint64_t val); 18 MAC(const char *str); 19 MAC(const MAC& o); 20 21 bool operator==(const MAC& o) const { 22 return val == o.val; 23 } 24 bool operator!=(const MAC& o) const { 25 return val != o.val; 26 } 27 bool operator<(const MAC& o) const { 28 return val < o.val; 29 } 30 31 enum { PRINT_FMT_COLON, PRINT_FMT_PLAIN }; 32 33 static MAC broadcast; 34 static MAC null; 35 static int print_fmt; 36 }; 37 38 std::ostream& operator<<(std::ostream& out, const MAC& mac); 39 std::ostream& operator<<(std::ostream& out, const struct in_addr& ip); 40 #endif 41 42 char *va(const char *format, ...); 43 44 struct tok { 45 int v; /* value */ 46 const char *s; /* string */ 47 }; 48 49 extern const char * 50 tok2str(register const struct tok *lp, register const char *fmt, 51 register int v); 52 53 #endif 54