Blame packet/probe_cygwin.h

Packit b802ec
/*
Packit b802ec
    mtr  --  a network diagnostic tool
Packit b802ec
    Copyright (C) 2016  Matt Kimball
Packit b802ec
Packit b802ec
    This program is free software; you can redistribute it and/or modify
Packit b802ec
    it under the terms of the GNU General Public License version 2 as
Packit b802ec
    published by the Free Software Foundation.
Packit b802ec
Packit b802ec
    This program is distributed in the hope that it will be useful,
Packit b802ec
    but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit b802ec
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit b802ec
    GNU General Public License for more details.
Packit b802ec
Packit b802ec
    You should have received a copy of the GNU General Public License
Packit b802ec
    along with this program; if not, write to the Free Software
Packit b802ec
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Packit b802ec
*/
Packit b802ec
Packit b802ec
#ifndef PROBE_CYGWIN_H
Packit b802ec
#define PROBE_CYGWIN_H
Packit b802ec
Packit b802ec
#include <arpa/inet.h>
Packit b802ec
#include <windows.h>
Packit b802ec
#include <iphlpapi.h>
Packit b802ec
#include <icmpapi.h>
Packit b802ec
Packit b802ec
/*
Packit b802ec
    This should be in the Windows headers, but is missing from
Packit b802ec
    Cygwin's Windows headers.
Packit b802ec
*/
Packit b802ec
typedef struct icmpv6_echo_reply_lh {
Packit b802ec
    /*
Packit b802ec
       Although Windows uses an IPV6_ADDRESS_EX here, we are using uint8_t
Packit b802ec
       fields to avoid structure padding differences between gcc and
Packit b802ec
       Visual C++.  (gcc wants to align the flow info to a 4 byte boundary,
Packit b802ec
       and Windows uses it unaligned.)
Packit b802ec
     */
Packit b802ec
    uint8_t PortBits[2];
Packit b802ec
    uint8_t FlowInfoBits[4];
Packit b802ec
    uint8_t AddressBits[16];
Packit b802ec
    uint8_t ScopeIdBits[4];
Packit b802ec
Packit b802ec
    ULONG Status;
Packit b802ec
    unsigned int RoundTripTime;
Packit b802ec
} ICMPV6_ECHO_REPLY,
Packit b802ec
*PICMPV6_ECHO_REPLY;
Packit b802ec
Packit b802ec
/*
Packit b802ec
	Windows requires an echo reply structure for each in-flight
Packit b802ec
	ICMP probe.
Packit b802ec
*/
Packit b802ec
struct probe_platform_t {
Packit b802ec
    /*
Packit b802ec
       We need a backpointer to the net_state because of the way
Packit b802ec
       IcmpSendEcho2 passes our context.
Packit b802ec
     */
Packit b802ec
    struct net_state_t *net_state;
Packit b802ec
Packit b802ec
    /*  IP version (4 or 6) used for the probe  */
Packit b802ec
    int ip_version;
Packit b802ec
Packit b802ec
    union {
Packit b802ec
        ICMP_ECHO_REPLY32 *reply4;
Packit b802ec
        ICMPV6_ECHO_REPLY *reply6;
Packit b802ec
    };
Packit b802ec
};
Packit b802ec
Packit b802ec
/*  A Windows HANDLE for the ICMP session  */
Packit b802ec
struct net_state_platform_t {
Packit b802ec
    HANDLE icmp4;
Packit b802ec
    HANDLE icmp6;
Packit b802ec
};
Packit b802ec
Packit b802ec
#endif