Annotation of embedaddon/mtr/packet/probe_cygwin.h, revision 1.1

1.1     ! misho       1: /*
        !             2:     mtr  --  a network diagnostic tool
        !             3:     Copyright (C) 2016  Matt Kimball
        !             4: 
        !             5:     This program is free software; you can redistribute it and/or modify
        !             6:     it under the terms of the GNU General Public License version 2 as
        !             7:     published by the Free Software Foundation.
        !             8: 
        !             9:     This program is distributed in the hope that it will be useful,
        !            10:     but WITHOUT ANY WARRANTY; without even the implied warranty of
        !            11:     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        !            12:     GNU General Public License for more details.
        !            13: 
        !            14:     You should have received a copy of the GNU General Public License
        !            15:     along with this program; if not, write to the Free Software
        !            16:     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
        !            17: */
        !            18: 
        !            19: #ifndef PROBE_CYGWIN_H
        !            20: #define PROBE_CYGWIN_H
        !            21: 
        !            22: #include <arpa/inet.h>
        !            23: #include <windows.h>
        !            24: #include <iphlpapi.h>
        !            25: #include <icmpapi.h>
        !            26: 
        !            27: /*
        !            28:     This should be in the Windows headers, but is missing from
        !            29:     Cygwin's Windows headers.
        !            30: */
        !            31: typedef struct icmpv6_echo_reply_lh {
        !            32:     /*
        !            33:        Although Windows uses an IPV6_ADDRESS_EX here, we are using uint8_t
        !            34:        fields to avoid structure padding differences between gcc and
        !            35:        Visual C++.  (gcc wants to align the flow info to a 4 byte boundary,
        !            36:        and Windows uses it unaligned.)
        !            37:      */
        !            38:     uint8_t PortBits[2];
        !            39:     uint8_t FlowInfoBits[4];
        !            40:     uint8_t AddressBits[16];
        !            41:     uint8_t ScopeIdBits[4];
        !            42: 
        !            43:     ULONG Status;
        !            44:     unsigned int RoundTripTime;
        !            45: } ICMPV6_ECHO_REPLY,
        !            46: *PICMPV6_ECHO_REPLY;
        !            47: 
        !            48: /*
        !            49:        Windows requires an echo reply structure for each in-flight
        !            50:        ICMP probe.
        !            51: */
        !            52: struct probe_platform_t {
        !            53:     /*
        !            54:        We need a backpointer to the net_state because of the way
        !            55:        IcmpSendEcho2 passes our context.
        !            56:      */
        !            57:     struct net_state_t *net_state;
        !            58: 
        !            59:     /*  IP version (4 or 6) used for the probe  */
        !            60:     int ip_version;
        !            61: 
        !            62:     union {
        !            63:         ICMP_ECHO_REPLY32 *reply4;
        !            64:         ICMPV6_ECHO_REPLY *reply6;
        !            65:     };
        !            66: };
        !            67: 
        !            68: /*  A Windows HANDLE for the ICMP session  */
        !            69: struct net_state_platform_t {
        !            70:     HANDLE icmp4;
        !            71:     HANDLE icmp6;
        !            72: };
        !            73: 
        !            74: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>