查看本类的 API文档回源码主页即时通讯网 - 即时通讯开发者社区!
1   /*
2    * Copyright 2012 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.udt;
17  
18  import com.barchart.udt.OptionUDT;
19  import com.barchart.udt.TypeUDT;
20  import io.netty.buffer.ByteBufAllocator;
21  import io.netty.channel.ChannelConfig;
22  import io.netty.channel.ChannelException;
23  import io.netty.channel.ChannelOption;
24  import io.netty.channel.MessageSizeEstimator;
25  import io.netty.channel.RecvByteBufAllocator;
26  import io.netty.channel.WriteBufferWaterMark;
27  
28  /**
29   * A {@link ChannelConfig} for a {@link UdtChannel}.
30   * <p>
31   * <h3>Available options</h3>
32   * In addition to the options provided by {@link ChannelConfig},
33   * {@link UdtChannelConfig} allows the following options in the option map:
34   * <p>
35   * <table border="1" cellspacing="0" cellpadding="6">
36   * <tr>
37   * <th>Name</th>
38   * <th>Associated setter method</th>
39   * </tr><tr>
40   * <td>{@link ChannelOption#SO_REUSEADDR}</td><td>{@link #setReuseAddress(boolean)}</td>
41   * </tr><tr>
42   * <td>{@link ChannelOption#SO_RCVBUF}</td><td>{@link #setReceiveBufferSize(int)}</td>
43   * </tr><tr>
44   * <td>{@link ChannelOption#SO_SNDBUF}</td><td>{@link #setSendBufferSize(int)}</td>
45   * </tr><tr>
46   * <td>{@link ChannelOption#SO_REUSEADDR}</td><td>{@link #setReuseAddress(boolean)}</td>
47   * </tr><tr>
48   * <td>{@link ChannelOption#SO_LINGER}</td><td>{@link #setSoLinger(int)}</td>
49   * </tr><tr>
50   * <td>{@link ChannelOption#SO_RCVBUF}</td><td>{@link #setReceiveBufferSize(int)}</td>
51   * </tr><tr>
52   * <td>{@link ChannelOption#SO_SNDBUF}</td><td>{@link #setSendBufferSize(int)}</td>
53   * </tr><tr>
54   * <td>{@link UdtChannelOption#PROTOCOL_RECEIVE_BUFFER_SIZE}</td>
55   * <td>{@link #setProtocolReceiveBufferSize(int)}</td>
56   * </tr><tr>
57   * <td>{@link UdtChannelOption#PROTOCOL_SEND_BUFFER_SIZE}</td>
58   * <td>{@link #setProtocolSendBufferSize(int)}</td>
59   * </tr><tr>
60   * <td>{@link UdtChannelOption#SYSTEM_RECEIVE_BUFFER_SIZE}</td>
61   * <td>{@link #setSystemReceiveBufferSize(int)}</td>
62   * </tr><tr>
63   * <td>{@link UdtChannelOption#SYSTEM_SEND_BUFFER_SIZE}</td>
64   * <td>{@link #setSystemSendBufferSize(int)}</td>
65  
66   * </tr>
67   * </table>
68   * <p>
69   * Note that {@link TypeUDT#DATAGRAM} message oriented channels treat
70   * {@code "receiveBufferSize"} and {@code "sendBufferSize"} as maximum message
71   * size. If received or sent message does not fit specified sizes,
72   * {@link ChannelException} will be thrown.
73   *
74   * @deprecated The UDT transport is no longer maintained and will be removed.
75   */
76  @Deprecated
77  public interface UdtChannelConfig extends ChannelConfig {
78  
79      /**
80       * Gets {@link OptionUDT#Protocol_Receive_Buffer_Size}
81       */
82      int getProtocolReceiveBufferSize();
83  
84      /**
85       * Gets {@link OptionUDT#Protocol_Send_Buffer_Size}
86       */
87      int getProtocolSendBufferSize();
88  
89      /**
90       * Gets the {@link ChannelOption#SO_RCVBUF} option.
91       */
92      int getReceiveBufferSize();
93  
94      /**
95       * Gets the {@link ChannelOption#SO_SNDBUF} option.
96       */
97      int getSendBufferSize();
98  
99      /**
100      * Gets the {@link ChannelOption#SO_LINGER} option.
101      */
102     int getSoLinger();
103 
104     /**
105      * Gets {@link OptionUDT#System_Receive_Buffer_Size}
106      */
107     int getSystemReceiveBufferSize();
108 
109     /**
110      * Gets {@link OptionUDT#System_Send_Buffer_Size}
111      */
112     int getSystemSendBufferSize();
113 
114     /**
115      * Gets the {@link ChannelOption#SO_REUSEADDR} option.
116      */
117     boolean isReuseAddress();
118 
119     @Override
120     UdtChannelConfig setConnectTimeoutMillis(int connectTimeoutMillis);
121 
122     @Override
123     @Deprecated
124     UdtChannelConfig setMaxMessagesPerRead(int maxMessagesPerRead);
125 
126     @Override
127     UdtChannelConfig setWriteSpinCount(int writeSpinCount);
128 
129     @Override
130     UdtChannelConfig setAllocator(ByteBufAllocator allocator);
131 
132     @Override
133     UdtChannelConfig setRecvByteBufAllocator(RecvByteBufAllocator allocator);
134 
135     @Override
136     UdtChannelConfig setAutoRead(boolean autoRead);
137 
138     @Override
139     UdtChannelConfig setAutoClose(boolean autoClose);
140 
141     @Override
142     UdtChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark);
143 
144     @Override
145     UdtChannelConfig setWriteBufferLowWaterMark(int writeBufferLowWaterMark);
146 
147     @Override
148     UdtChannelConfig setWriteBufferWaterMark(WriteBufferWaterMark writeBufferWaterMark);
149 
150     @Override
151     UdtChannelConfig setMessageSizeEstimator(MessageSizeEstimator estimator);
152 
153     /**
154      * Sets {@link OptionUDT#Protocol_Receive_Buffer_Size}
155      */
156     UdtChannelConfig setProtocolReceiveBufferSize(int size);
157 
158     /**
159      * Sets {@link OptionUDT#Protocol_Send_Buffer_Size}
160      */
161     UdtChannelConfig setProtocolSendBufferSize(int size);
162 
163     /**
164      * Sets the {@link ChannelOption#SO_RCVBUF} option.
165      */
166     UdtChannelConfig setReceiveBufferSize(int receiveBufferSize);
167 
168     /**
169      * Sets the {@link ChannelOption#SO_REUSEADDR} option.
170      */
171     UdtChannelConfig setReuseAddress(boolean reuseAddress);
172 
173     /**
174      * Sets the {@link ChannelOption#SO_SNDBUF} option.
175      */
176     UdtChannelConfig setSendBufferSize(int sendBufferSize);
177 
178     /**
179      * Sets the {@link ChannelOption#SO_LINGER} option.
180      */
181     UdtChannelConfig setSoLinger(int soLinger);
182 
183     /**
184      * Sets {@link OptionUDT#System_Receive_Buffer_Size}
185      */
186     UdtChannelConfig setSystemReceiveBufferSize(int size);
187 
188     /**
189      * Sets {@link OptionUDT#System_Send_Buffer_Size}
190      */
191     UdtChannelConfig setSystemSendBufferSize(int size);
192 }