Print this page
11547 Want connstat(1M) command to display per-connection TCP statistics
Portions contributed by: Cody Peter Mello <cody.mello@joyent.com>
Portions contributed by: Ahmed G <ahmedg@delphix.com>
Reviewed by: Jason King <jason.king@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Dan McDonald <danmcd@joyent.com>


   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  *
  21  * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
  22  */
  23 /* Copyright (c) 1990 Mentat Inc. */



  24 
  25 #ifndef _INET_MIB2_H
  26 #define _INET_MIB2_H
  27 
  28 #include <netinet/in.h>   /* For in6_addr_t */
  29 #include <sys/tsol/label.h> /* For brange_t */
  30 #include <sys/tsol/label_macro.h> /* For brange_t */
  31 
  32 #ifdef  __cplusplus
  33 extern "C" {
  34 #endif
  35 
  36 /*
  37  * The IPv6 parts of this are derived from:
  38  *      RFC 2465
  39  *      RFC 2466
  40  *      RFC 2452
  41  *      RFC 2454
  42  */
  43 


1337 #define MIB2_TCP_closing        10
1338 #define MIB2_TCP_timeWait       11
1339 #define MIB2_TCP_deleteTCB      12              /* only writeable value */
1340 
1341 /* Pack data to make struct size the same for 32- and 64-bits */
1342 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
1343 #pragma pack(4)
1344 #endif
1345 typedef struct mib2_tcpConnEntry {
1346                 /* state of tcp connection              { tcpConnEntry 1} RW */
1347         int             tcpConnState;
1348                 /* local ip addr for this connection    { tcpConnEntry 2 } */
1349         IpAddress       tcpConnLocalAddress;
1350                 /* local port for this connection       { tcpConnEntry 3 } */
1351         int             tcpConnLocalPort;       /* In host byte order */
1352                 /* remote ip addr for this connection   { tcpConnEntry 4 } */
1353         IpAddress       tcpConnRemAddress;
1354                 /* remote port for this connection      { tcpConnEntry 5 } */
1355         int             tcpConnRemPort;         /* In host byte order */
1356         struct tcpConnEntryInfo_s {













1357                         /* seq # of next segment to send */
1358                 Gauge           ce_snxt;
1359                                 /* seq # of of last segment unacknowledged */
1360                 Gauge           ce_suna;
1361                                 /* currect send window size */
1362                 Gauge           ce_swnd;


1363                                 /* seq # of next expected segment */
1364                 Gauge           ce_rnxt;
1365                                 /* seq # of last ack'd segment */
1366                 Gauge           ce_rack;
1367                                 /* currenct receive window size */


1368                 Gauge           ce_rwnd;


1369                                         /* current rto (retransmit timeout) */
1370                 Gauge           ce_rto;


1371                                         /* current max segment size */
1372                 Gauge           ce_mss;
1373                                 /* actual internal state */
1374                 int             ce_state;
1375         }               tcpConnEntryInfo;
1376 
1377         /* pid of the processes that created this connection */
1378         uint32_t        tcpConnCreationProcess;
1379         /* system uptime when the connection was created */
1380         uint64_t        tcpConnCreationTime;
1381 } mib2_tcpConnEntry_t;
1382 #define MIB_FIRST_NEW_ELM_mib2_tcpConnEntry_t   tcpConnCreationProcess
1383 
1384 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
1385 #pragma pack()
1386 #endif
1387 
1388 
1389 /*
1390  * The TCP/IPv6 connection table {tcp 14} contains information about this
1391  * entity's existing TCP connections over IPv6.
1392  */
1393 
1394 /* Pack data to make struct size the same for 32- and 64-bits */
1395 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
1396 #pragma pack(4)
1397 #endif
1398 typedef struct mib2_tcp6ConnEntry {
1399         /* local ip addr for this connection    { ipv6TcpConnEntry 1 } */
1400         Ip6Address      tcp6ConnLocalAddress;
1401         /* local port for this connection       { ipv6TcpConnEntry 2 } */
1402         int             tcp6ConnLocalPort;
1403         /* remote ip addr for this connection   { ipv6TcpConnEntry 3 } */
1404         Ip6Address      tcp6ConnRemAddress;
1405         /* remote port for this connection      { ipv6TcpConnEntry 4 } */
1406         int             tcp6ConnRemPort;
1407         /* interface index or zero              { ipv6TcpConnEntry 5 } */
1408         DeviceIndex     tcp6ConnIfIndex;
1409         /* state of tcp6 connection             { ipv6TcpConnEntry 6 } RW */
1410         int             tcp6ConnState;
1411         struct tcp6ConnEntryInfo_s {
1412                         /* seq # of next segment to send */
1413                 Gauge           ce_snxt;
1414                                 /* seq # of of last segment unacknowledged */
1415                 Gauge           ce_suna;
1416                                 /* currect send window size */
1417                 Gauge           ce_swnd;
1418                                 /* seq # of next expected segment */
1419                 Gauge           ce_rnxt;
1420                                 /* seq # of last ack'd segment */
1421                 Gauge           ce_rack;
1422                                 /* currenct receive window size */
1423                 Gauge           ce_rwnd;
1424                                         /* current rto (retransmit timeout) */
1425                 Gauge           ce_rto;
1426                                         /* current max segment size */
1427                 Gauge           ce_mss;
1428                                 /* actual internal state */
1429                 int             ce_state;
1430         }               tcp6ConnEntryInfo;
1431 
1432         /* pid of the processes that created this connection */
1433         uint32_t        tcp6ConnCreationProcess;
1434         /* system uptime when the connection was created */
1435         uint64_t        tcp6ConnCreationTime;
1436 } mib2_tcp6ConnEntry_t;
1437 #define MIB_FIRST_NEW_ELM_mib2_tcp6ConnEntry_t  tcp6ConnCreationProcess
1438 
1439 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
1440 #pragma pack()
1441 #endif
1442 
1443 /*
1444  * the UDP group
1445  */
1446 #define MIB2_UDP_ENTRY  5       /* udpEntry */
1447 #define MIB2_UDP6_ENTRY 6       /* udp6Entry */
1448 
1449 /* Old name retained for compatibility */
1450 #define MIB2_UDP_5      MIB2_UDP_ENTRY




   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  *
  21  * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
  22  */
  23 /*
  24  * Copyright (c) 1990 Mentat Inc.
  25  * Copyright (c) 2015, 2016 by Delphix. All rights reserved.
  26  */
  27 
  28 #ifndef _INET_MIB2_H
  29 #define _INET_MIB2_H
  30 
  31 #include <netinet/in.h>   /* For in6_addr_t */
  32 #include <sys/tsol/label.h> /* For brange_t */
  33 #include <sys/tsol/label_macro.h> /* For brange_t */
  34 
  35 #ifdef  __cplusplus
  36 extern "C" {
  37 #endif
  38 
  39 /*
  40  * The IPv6 parts of this are derived from:
  41  *      RFC 2465
  42  *      RFC 2466
  43  *      RFC 2452
  44  *      RFC 2454
  45  */
  46 


1340 #define MIB2_TCP_closing        10
1341 #define MIB2_TCP_timeWait       11
1342 #define MIB2_TCP_deleteTCB      12              /* only writeable value */
1343 
1344 /* Pack data to make struct size the same for 32- and 64-bits */
1345 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
1346 #pragma pack(4)
1347 #endif
1348 typedef struct mib2_tcpConnEntry {
1349                 /* state of tcp connection              { tcpConnEntry 1} RW */
1350         int             tcpConnState;
1351                 /* local ip addr for this connection    { tcpConnEntry 2 } */
1352         IpAddress       tcpConnLocalAddress;
1353                 /* local port for this connection       { tcpConnEntry 3 } */
1354         int             tcpConnLocalPort;       /* In host byte order */
1355                 /* remote ip addr for this connection   { tcpConnEntry 4 } */
1356         IpAddress       tcpConnRemAddress;
1357                 /* remote port for this connection      { tcpConnEntry 5 } */
1358         int             tcpConnRemPort;         /* In host byte order */
1359         struct tcpConnEntryInfo_s {
1360                 Counter64       ce_in_data_inorder_bytes;
1361                 Counter64       ce_in_data_inorder_segs;
1362                 Counter64       ce_in_data_unorder_bytes;
1363                 Counter64       ce_in_data_unorder_segs;
1364                 Counter64       ce_in_zwnd_probes;
1365 
1366                 Counter64       ce_out_data_bytes;
1367                 Counter64       ce_out_data_segs;
1368                 Counter64       ce_out_retrans_bytes;
1369                 Counter64       ce_out_retrans_segs;
1370                 Counter64       ce_out_zwnd_probes;
1371                 Counter64       ce_rtt_sum;
1372 
1373                                 /* seq # of next segment to send */
1374                 Gauge           ce_snxt;
1375                                 /* seq # of of last segment unacknowledged */
1376                 Gauge           ce_suna;
1377                                 /* current send window size */
1378                 Gauge           ce_swnd;
1379                                 /* current congestion window size */
1380                 Gauge           ce_cwnd;
1381                                 /* seq # of next expected segment */
1382                 Gauge           ce_rnxt;
1383                                 /* seq # of last ack'd segment */
1384                 Gauge           ce_rack;
1385                                 /* # of unsent bytes in the xmit queue */
1386                 Gauge           ce_unsent;
1387                                 /* current receive window size */
1388                 Gauge           ce_rwnd;
1389                                 /* round-trip time smoothed average (us) */
1390                 Gauge           ce_rtt_sa;
1391                                 /* current rto (retransmit timeout) */
1392                 Gauge           ce_rto;
1393                                 /* round-trip time count */
1394                 Gauge           ce_rtt_cnt;
1395                                 /* current max segment size */
1396                 Gauge           ce_mss;
1397                                 /* actual internal state */
1398                 int             ce_state;
1399         }               tcpConnEntryInfo;
1400 
1401         /* pid of the processes that created this connection */
1402         uint32_t        tcpConnCreationProcess;
1403         /* system uptime when the connection was created */
1404         uint64_t        tcpConnCreationTime;
1405 } mib2_tcpConnEntry_t;
1406 #define MIB_FIRST_NEW_ELM_mib2_tcpConnEntry_t   tcpConnCreationProcess
1407 
1408 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
1409 #pragma pack()
1410 #endif
1411 
1412 
1413 /*
1414  * The TCP/IPv6 connection table {tcp 14} contains information about this
1415  * entity's existing TCP connections over IPv6.
1416  */
1417 
1418 /* Pack data to make struct size the same for 32- and 64-bits */
1419 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
1420 #pragma pack(4)
1421 #endif
1422 typedef struct mib2_tcp6ConnEntry {
1423         /* local ip addr for this connection    { ipv6TcpConnEntry 1 } */
1424         Ip6Address      tcp6ConnLocalAddress;
1425         /* local port for this connection       { ipv6TcpConnEntry 2 } */
1426         int             tcp6ConnLocalPort;
1427         /* remote ip addr for this connection   { ipv6TcpConnEntry 3 } */
1428         Ip6Address      tcp6ConnRemAddress;
1429         /* remote port for this connection      { ipv6TcpConnEntry 4 } */
1430         int             tcp6ConnRemPort;
1431         /* interface index or zero              { ipv6TcpConnEntry 5 } */
1432         DeviceIndex     tcp6ConnIfIndex;
1433         /* state of tcp6 connection             { ipv6TcpConnEntry 6 } RW */
1434         int             tcp6ConnState;
1435         struct tcpConnEntryInfo_s tcp6ConnEntryInfo;



















1436 
1437         /* pid of the processes that created this connection */
1438         uint32_t        tcp6ConnCreationProcess;
1439         /* system uptime when the connection was created */
1440         uint64_t        tcp6ConnCreationTime;
1441 } mib2_tcp6ConnEntry_t;
1442 #define MIB_FIRST_NEW_ELM_mib2_tcp6ConnEntry_t  tcp6ConnCreationProcess
1443 
1444 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
1445 #pragma pack()
1446 #endif
1447 
1448 /*
1449  * the UDP group
1450  */
1451 #define MIB2_UDP_ENTRY  5       /* udpEntry */
1452 #define MIB2_UDP6_ENTRY 6       /* udp6Entry */
1453 
1454 /* Old name retained for compatibility */
1455 #define MIB2_UDP_5      MIB2_UDP_ENTRY