1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00

Replace WIN32 macro with _WIN32.

This commit is contained in:
Matias Fontanini
2015-05-02 16:25:59 -07:00
parent a7a63483df
commit a607ab380c
28 changed files with 108 additions and 110 deletions

View File

@@ -382,12 +382,12 @@ public:
*/
uint32_t header_size() const;
#ifndef WIN32
#ifndef _WIN32
/**
* \sa PDU::send()
*/
void send(PacketSender &sender, const NetworkInterface &iface);
#endif // WIN32
#endif // _WIN32
/**
* \brief Adds a new option to this Dot11 PDU.

View File

@@ -138,12 +138,12 @@ namespace Tins {
*/
uint32_t header_size() const;
#if !defined(WIN32) || defined(HAVE_PACKET_SENDER_PCAP_SENDPACKET)
#if !defined(_WIN32) || defined(HAVE_PACKET_SENDER_PCAP_SENDPACKET)
/**
* \sa PDU::send()
*/
void send(PacketSender &sender, const NetworkInterface &iface);
#endif // !WIN32 || HAVE_PACKET_SENDER_PCAP_SENDPACKET
#endif // !_WIN32 || HAVE_PACKET_SENDER_PCAP_SENDPACKET
/**
* \brief Check wether ptr points to a valid response for this PDU.
@@ -154,12 +154,12 @@ namespace Tins {
*/
bool matches_response(const uint8_t *ptr, uint32_t total_sz) const;
#ifndef WIN32
#ifndef _WIN32
/**
* \sa PDU::recv_response
*/
PDU *recv_response(PacketSender &sender, const NetworkInterface &iface);
#endif // WIN32
#endif // _WIN32
/**
* \brief Getter for the PDU's type.

View File

@@ -41,7 +41,7 @@
#include <sys/endian.h>
#define TINS_IS_LITTLE_ENDIAN (_BYTE_ORDER == _LITTLE_ENDIAN)
#define TINS_IS_BIG_ENDIAN (_BYTE_ORDER == _BIG_ENDIAN)
#elif defined(WIN32)
#elif defined(_WIN32)
// Assume windows == little endian. fixme later
#define TINS_IS_LITTLE_ENDIAN 1
#define TINS_IS_BIG_ENDIAN 0

View File

@@ -160,14 +160,14 @@ namespace Tins {
*/
bool matches_response(const uint8_t *ptr, uint32_t total_sz) const;
#ifndef WIN32
#ifndef _WIN32
/**
* \brief Receives a matching response for this packet.
*
* \sa PDU::recv_response
*/
PDU *recv_response(PacketSender &sender, const NetworkInterface &iface);
#endif // WIN32
#endif // _WIN32
/**
* \brief Getter for the PDU's type.

View File

@@ -32,7 +32,7 @@
// Windows likes to define macros with not-so-common-names, which break
// this code
#ifdef WIN32
#ifdef _WIN32
#ifdef TIMESTAMP_REQUEST
#undef TIMESTAMP_REQUEST
#endif // TIMESTAMP_REQUEST
@@ -40,7 +40,7 @@
#ifdef TIMESTAMP_REPLY
#undef TIMESTAMP_REPLY
#endif // TIMESTAMP_REPLY
#endif // WIN32
#endif // _WIN32
#include "macros.h"
#include "pdu.h"

View File

@@ -159,7 +159,7 @@ namespace Tins {
PacketSender& operator=(PacketSender &&rhs) TINS_NOEXCEPT {
_sockets = std::move(rhs._sockets);
rhs._sockets = std::vector<int>(SOCKETS_END, INVALID_RAW_SOCKET);
#ifndef WIN32
#ifndef _WIN32
#if defined(BSD) || defined(__FreeBSD_kernel__)
_ether_socket = std::move(rhs._ether_socket);
#else
@@ -182,14 +182,14 @@ namespace Tins {
*/
~PacketSender();
#if !defined(WIN32) || defined(HAVE_PACKET_SENDER_PCAP_SENDPACKET)
#if !defined(_WIN32) || defined(HAVE_PACKET_SENDER_PCAP_SENDPACKET)
/**
* \brief Opens a layer 2 socket.
*
* If this operation fails, then a socket_open_error will be thrown.
*/
void open_l2_socket(const NetworkInterface& iface = NetworkInterface());
#endif // !WIN32 || defined(HAVE_PACKET_SENDER_PCAP_SENDPACKET)
#endif // !_WIN32 || defined(HAVE_PACKET_SENDER_PCAP_SENDPACKET)
/**
* \brief Opens a layer 3 socket, using the corresponding protocol
@@ -302,7 +302,7 @@ namespace Tins {
*/
PDU *send_recv(PDU &pdu, const NetworkInterface &iface);
#ifndef WIN32
#ifndef _WIN32
/**
* \brief Receives a layer 2 PDU response to a previously sent PDU.
*
@@ -320,9 +320,9 @@ namespace Tins {
PDU *recv_l2(PDU &pdu, struct sockaddr *link_addr, uint32_t len_addr,
const NetworkInterface &iface = NetworkInterface());
#endif // WIN32
#endif // _WIN32
#if !defined(WIN32) || defined(HAVE_PACKET_SENDER_PCAP_SENDPACKET)
#if !defined(_WIN32) || defined(HAVE_PACKET_SENDER_PCAP_SENDPACKET)
/**
* \brief Sends a level 2 PDU.
*
@@ -340,7 +340,7 @@ namespace Tins {
*/
void send_l2(PDU &pdu, struct sockaddr* link_addr, uint32_t len_addr,
const NetworkInterface &iface = NetworkInterface());
#endif // !WIN32 || HAVE_PACKET_SENDER_PCAP_SENDPACKET
#endif // !_WIN32 || HAVE_PACKET_SENDER_PCAP_SENDPACKET
/**
* \brief Receives a layer 3 PDU response to a previously sent PDU.
@@ -383,7 +383,7 @@ namespace Tins {
PacketSender& operator=(const PacketSender&);
int find_type(SocketType type);
int timeval_subtract (struct timeval *result, struct timeval *x, struct timeval *y);
#ifndef WIN32
#ifndef _WIN32
bool ether_socket_initialized(const NetworkInterface& iface = NetworkInterface()) const;
int get_ether_socket(const NetworkInterface& iface = NetworkInterface());
#endif
@@ -399,7 +399,7 @@ namespace Tins {
uint32_t addrlen);
std::vector<int> _sockets;
#ifndef WIN32
#ifndef _WIN32
#if defined(BSD) || defined(__FreeBSD_kernel__)
typedef std::map<uint32_t, int> BSDEtherSockets;
BSDEtherSockets _ether_socket;

View File

@@ -141,7 +141,7 @@ namespace Tins {
/* Setters */
#ifndef WIN32
#ifndef _WIN32
/**
* \sa PDU::send()
*/

View File

@@ -30,7 +30,7 @@
#ifndef TINS_TIMESTAMP_H
#define TINS_TIMESTAMP_H
#ifdef WIN32
#ifdef _WIN32
#include <winsock2.h>
#else
#include <sys/time.h>
@@ -46,7 +46,7 @@ namespace Tins {
*/
class Timestamp {
public:
#ifdef WIN32
#ifdef _WIN32
typedef long seconds_type;
typedef long microseconds_type;
#else
@@ -58,7 +58,7 @@ public:
* \brief Constructs a Timestamp which will hold the current time.
*/
static Timestamp current_time() {
#ifdef WIN32
#ifdef _WIN32
//fixme
return Timestamp();
#else

View File

@@ -30,7 +30,7 @@
#ifndef TINS_UTILS_H
#define TINS_UTILS_H
#ifndef WIN32
#ifndef _WIN32
#include <ifaddrs.h>
#else
#include <winsock2.h>
@@ -248,7 +248,7 @@ namespace Tins {
* the object to collect data from them.
* \param functor An instance of an class which implements operator(struct ifaddrs*).
*/
#ifndef WIN32
#ifndef _WIN32
template<class Functor>
void generic_iface_loop(Functor &functor) {
struct ifaddrs *ifaddrs = 0;
@@ -261,7 +261,7 @@ namespace Tins {
if(ifaddrs)
freeifaddrs(ifaddrs);
}
#else // WIN32
#else // _WIN32
template<class Functor>
void generic_iface_loop(Functor &functor) {
ULONG size;
@@ -276,7 +276,7 @@ namespace Tins {
}
}
}
#endif // WIN32
#endif // _WIN32
template <typename T>
struct is_pdu {
@@ -376,7 +376,7 @@ void Tins::Utils::route_entries(ForwardIterator output) {
next += rtm->rtm_msglen;
}
}
#elif defined(WIN32)
#elif defined(_WIN32)
template<class ForwardIterator>
void Tins::Utils::route_entries(ForwardIterator output) {
MIB_IPFORWARDTABLE *table;