Annotation of embedaddon/mtr/packet/probe_unix.h, revision 1.1.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_UNIX_H
20: #define PROBE_UNIX_H
21:
22: /* The range of local port numbers to use for probes */
23: #define MIN_PORT 33000
24: #define MAX_PORT 65535
25:
26: /* We need to track the transmission and timeouts on Unix systems */
27: struct probe_platform_t {
28: /* The socket for the outgoing connection (used by TCP probes) */
29: int socket;
30:
31: /* The time at which the probe is considered lost */
32: struct timeval timeout_time;
33:
34: /* The time at which the probe was sent */
35: struct timeval departure_time;
36: };
37:
38: /* We'll use rack sockets to send and recieve probes on Unix systems */
39: struct net_state_platform_t {
40: /* true if we were successful at opening IPv4 sockets */
41: bool ip4_present;
42:
43: /* true if we were successful at opening IPv6 sockets */
44: bool ip6_present;
45:
46: /* Socket used to send raw IPv4 packets */
47: int ip4_send_socket;
48:
49: /* Socket used to receive IPv4 ICMP replies */
50: int ip4_recv_socket;
51:
52: /* Send socket for ICMPv6 packets */
53: int icmp6_send_socket;
54:
55: /* Send socket for UDPv6 packets */
56: int udp6_send_socket;
57:
58: /* Receive socket for IPv6 packets */
59: int ip6_recv_socket;
60:
61: /*
62: true if we should encode the IP header length in host order.
63: (as opposed to network order)
64: */
65: bool ip_length_host_order;
66:
67: /* true if the operating system supports SCTP sockets */
68: bool sctp_support;
69:
70: /* The next port number to use when creating a new probe */
71: int next_sequence;
72: };
73:
74: struct net_state_t;
75: struct probe_t;
76: struct mpls_label_t;
77:
78: void set_socket_nonblocking(
79: int socket);
80:
81: void receive_probe(
82: struct net_state_t *net_state,
83: struct probe_t *probe,
84: int icmp_type,
85: const struct sockaddr_storage *remote_addr,
86: struct timeval *timestamp,
87: int mpls_count,
88: struct mpls_label_t *mpls);
89:
90: int gather_probe_sockets(
91: const struct net_state_t *net_state,
92: fd_set * write_set);
93:
94: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>