View Javadoc
1   /*
2    * Copyright 2024 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.handler.codec.quic;
17  
18  import io.netty.util.internal.StringUtil;
19  
20  import java.net.InetSocketAddress;
21  
22  final class QuicheQuicConnectionPathStats implements QuicConnectionPathStats {
23  
24      private final Object[] values;
25  
26      QuicheQuicConnectionPathStats(Object[] values) {
27          this.values = values;
28      }
29  
30      @Override
31      public InetSocketAddress localAddress() {
32          return (InetSocketAddress) values[0];
33      }
34  
35      @Override
36      public InetSocketAddress peerAddress() {
37          return (InetSocketAddress) values[1];
38      }
39  
40      public long validationState() {
41          return (long) values[2];
42      }
43  
44      @Override
45      public boolean active() {
46          return (boolean) values[3];
47      }
48  
49      @Override
50      public long recv() {
51          return (long) values[4];
52      }
53  
54      @Override
55      public long sent() {
56          return (long) values[5];
57      }
58  
59      @Override
60      public long lost() {
61          return (long) values[6];
62      }
63  
64      @Override
65      public long retrans() {
66          return (long) values[7];
67      }
68  
69      @Override
70      public long rtt() {
71          return (long) values[8];
72      }
73  
74      @Override
75      public long cwnd() {
76          return (long) values[9];
77      }
78  
79      @Override
80      public long sentBytes() {
81          return (long) values[10];
82      }
83  
84      @Override
85      public long recvBytes() {
86          return (long) values[11];
87      }
88  
89      @Override
90      public long lostBytes() {
91          return (long) values[12];
92      }
93  
94      @Override
95      public long streamRetransBytes() {
96          return (long) values[13];
97      }
98  
99      @Override
100     public long pmtu() {
101         return (long) values[14];
102     }
103 
104     @Override
105     public long deliveryRate() {
106         return (long) values[15];
107     }
108 
109     /**
110      * Returns the {@link String} representation of stats.
111      */
112     @Override
113     public String toString() {
114         return StringUtil.simpleClassName(this) + "[" +
115                 "local=" + localAddress() +
116                 ", peer=" + peerAddress() +
117                 ", validationState=" + validationState() +
118                 ", active=" + active() +
119                 ", recv=" + recv() +
120                 ", sent=" + sent() +
121                 ", lost=" + lost() +
122                 ", retrans=" + retrans() +
123                 ", rtt=" + rtt() +
124                 ", cwnd=" + cwnd() +
125                 ", sentBytes=" + sentBytes() +
126                 ", recvBytes=" + recvBytes() +
127                 ", lostBytes=" + lostBytes() +
128                 ", streamRetransBytes=" + streamRetransBytes() +
129                 ", pmtu=" + pmtu() +
130                 ", deliveryRate=" + deliveryRate() +
131                 ']';
132     }
133 
134 }