View Javadoc
1   /*
2    * Copyright 2014 The Netty Project
3    *
4    * The Netty Project licenses this file to you under the Apache License,
5    * version 2.0 (the "License"); you may not use this file except in compliance
6    * with the License. You may obtain a copy of the License at:
7    *
8    *   https://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations
14   * under the License.
15   */
16  package io.netty.channel.epoll;
17  
18  /**
19   * <p>
20   * struct tcp_info
21   * {
22   *      __u8    tcpi_state;
23   *      __u8    tcpi_ca_state;
24   *      __u8    tcpi_retransmits;
25   *      __u8    tcpi_probes;
26   *      __u8    tcpi_backoff;
27   *      __u8    tcpi_options;
28   *      __u8    tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4;
29   *
30   *      __u32   tcpi_rto;
31   *      __u32   tcpi_ato;
32   *      __u32   tcpi_snd_mss;
33   *      __u32   tcpi_rcv_mss;
34   *
35   *      __u32   tcpi_unacked;
36   *      __u32   tcpi_sacked;
37   *      __u32   tcpi_lost;
38   *      __u32   tcpi_retrans;
39   *      __u32   tcpi_fackets;
40   *
41   *      __u32   tcpi_last_data_sent;
42   *      __u32   tcpi_last_ack_sent;
43   *      __u32   tcpi_last_data_recv;
44   *      __u32   tcpi_last_ack_recv;
45   *
46   *      __u32   tcpi_pmtu;
47   *      __u32   tcpi_rcv_ssthresh;
48   *      __u32   tcpi_rtt;
49   *      __u32   tcpi_rttvar;
50   *      __u32   tcpi_snd_ssthresh;
51   *      __u32   tcpi_snd_cwnd;
52   *      __u32   tcpi_advmss;
53   *      __u32   tcpi_reordering;
54   *
55   *      __u32   tcpi_rcv_rtt;
56   *      __u32   tcpi_rcv_space;
57   *
58   *      __u32   tcpi_total_retrans;
59   * };
60   * </p>
61   */
62  public final class EpollTcpInfo {
63  
64      final long[] info = new long[32];
65  
66      public int state() {
67          return (int) info[0];
68      }
69  
70      public int caState() {
71          return (int) info[1];
72      }
73  
74      public int retransmits() {
75          return (int) info[2];
76      }
77  
78      public int probes() {
79          return (int) info[3];
80      }
81  
82      public int backoff() {
83          return (int) info[4];
84      }
85  
86      public int options() {
87          return (int) info[5];
88      }
89  
90      public int sndWscale() {
91          return (int) info[6];
92      }
93  
94      public int rcvWscale() {
95          return (int) info[7];
96      }
97  
98      public long rto() {
99          return info[8];
100     }
101 
102     public long ato() {
103         return info[9];
104     }
105 
106     public long sndMss() {
107         return info[10];
108     }
109 
110     public long rcvMss() {
111         return info[11];
112     }
113 
114     public long unacked() {
115         return info[12];
116     }
117 
118     public long sacked() {
119         return info[13];
120     }
121 
122     public long lost() {
123         return info[14];
124     }
125 
126     public long retrans() {
127         return info[15];
128     }
129 
130     public long fackets() {
131         return info[16];
132     }
133 
134     public long lastDataSent() {
135         return info[17];
136     }
137 
138     public long lastAckSent() {
139         return info[18];
140     }
141 
142     public long lastDataRecv() {
143         return info[19];
144     }
145 
146     public long lastAckRecv() {
147         return info[20];
148     }
149 
150     public long pmtu() {
151         return info[21];
152     }
153 
154     public long rcvSsthresh() {
155         return info[22];
156     }
157 
158     public long rtt() {
159         return info[23];
160     }
161 
162     public long rttvar() {
163         return info[24];
164     }
165 
166     public long sndSsthresh() {
167         return info[25];
168     }
169 
170     public long sndCwnd() {
171         return info[26];
172     }
173 
174     public long advmss() {
175         return info[27];
176     }
177 
178     public long reordering() {
179         return info[28];
180     }
181 
182     public long rcvRtt() {
183         return info[29];
184     }
185 
186     public long rcvSpace() {
187         return info[30];
188     }
189 
190     public long totalRetrans() {
191         return info[31];
192     }
193 }