1 /*
2  * hunt-amqp: AMQP library for D programming language, based on hunt-net.
3  *
4  * Copyright (C) 2018-2019 HuntLabs
5  *
6  * Website: https://www.huntlabs.net
7  *
8  * Licensed under the Apache-2.0 License.
9  *
10  */
11 
12 module hunt.amqp.ProtonServerOptions;
13 
14 //import java.util.Set;
15 //import java.util.concurrent.TimeUnit;
16 //
17 //import io.vertx.codegen.annotations.DataObject;
18 //import io.vertx.core.buffer.Buffer;
19 //import io.vertx.core.http.ClientAuth;
20 //import io.vertx.core.json.JsonObject;
21 //import io.vertx.core.net.JdkSSLEngineOptions;
22 //import io.vertx.core.net.JksOptions;
23 //import io.vertx.core.net.KeyCertOptions;
24 //import io.vertx.core.net.NetServerOptions;
25 //import io.vertx.core.net.OpenSSLEngineOptions;
26 //import io.vertx.core.net.PemKeyCertOptions;
27 //import io.vertx.core.net.PemTrustOptions;
28 //import io.vertx.core.net.PfxOptions;
29 //import io.vertx.core.net.SSLEngineOptions;
30 //import io.vertx.core.net.TrustOptions;
31 //
32 ///**
33 // * Options for configuring {@link hunt.amqp.ProtonServer} creation.
34 // */
35 //@DataObject(generateConverter = true, publicConverter = false)
36 //class ProtonServerOptions extends NetServerOptions {
37 //
38 //  private int heartbeat;
39 //  private int maxFrameSize;
40 //
41 //  public ProtonServerOptions() {
42 //  }
43 //
44 //  /**
45 //   * Copy constructor
46 //   *
47 //   * @param other  the options to copy
48 //   */
49 //  public ProtonServerOptions(ProtonServerOptions other) {
50 //    super(other);
51 //    this.heartbeat = other.heartbeat;
52 //    this.maxFrameSize = other.maxFrameSize;
53 //  }
54 //
55 //  /**
56 //   * Create options from JSON
57 //   *
58 //   * @param json  the JSON
59 //   */
60 //  public ProtonServerOptions(JsonObject json) {
61 //    super(json);
62 //    ProtonServerOptionsConverter.fromJson(json, this);
63 //  }
64 //
65 //  /**
66 //   * Convert to JSON
67 //   *
68 //   * @return the JSON
69 //   */
70 //  @Override
71 //  public JsonObject toJson() {
72 //    JsonObject json = super.toJson();
73 //    ProtonServerOptionsConverter.toJson(this, json);
74 //    return json;
75 //  }
76 //
77 //  @Override
78 //  public ProtonServerOptions setSendBufferSize(int sendBufferSize) {
79 //    super.setSendBufferSize(sendBufferSize);
80 //    return this;
81 //  }
82 //
83 //  @Override
84 //  public ProtonServerOptions setReceiveBufferSize(int receiveBufferSize) {
85 //    super.setReceiveBufferSize(receiveBufferSize);
86 //    return this;
87 //  }
88 //
89 //  @Override
90 //  public ProtonServerOptions setReuseAddress(boolean reuseAddress) {
91 //    super.setReuseAddress(reuseAddress);
92 //    return this;
93 //  }
94 //
95 //  @Override
96 //  public ProtonServerOptions setTrafficClass(int trafficClass) {
97 //    super.setTrafficClass(trafficClass);
98 //    return this;
99 //  }
100 //
101 //  @Override
102 //  public ProtonServerOptions setTcpNoDelay(boolean tcpNoDelay) {
103 //    super.setTcpNoDelay(tcpNoDelay);
104 //    return this;
105 //  }
106 //
107 //  @Override
108 //  public ProtonServerOptions setTcpKeepAlive(boolean tcpKeepAlive) {
109 //    super.setTcpKeepAlive(tcpKeepAlive);
110 //    return this;
111 //  }
112 //
113 //  @Override
114 //  public ProtonServerOptions setSoLinger(int soLinger) {
115 //    super.setSoLinger(soLinger);
116 //    return this;
117 //  }
118 //
119 //  @Override
120 //  public ProtonServerOptions setIdleTimeout(int idleTimeout) {
121 //    super.setIdleTimeout(idleTimeout);
122 //    return this;
123 //  }
124 //
125 //  @Override
126 //  public ProtonServerOptions setIdleTimeoutUnit(TimeUnit idleTimeoutUnit) {
127 //    super.setIdleTimeoutUnit(idleTimeoutUnit);
128 //    return this;
129 //  }
130 //
131 //  @Override
132 //  public ProtonServerOptions setSsl(boolean ssl) {
133 //    super.setSsl(ssl);
134 //    return this;
135 //  }
136 //
137 //  @Override
138 //  public ProtonServerOptions setKeyStoreOptions(JksOptions options) {
139 //    super.setKeyStoreOptions(options);
140 //    return this;
141 //  }
142 //
143 //  @Override
144 //  public ProtonServerOptions setPfxKeyCertOptions(PfxOptions options) {
145 //    super.setPfxKeyCertOptions(options);
146 //    return this;
147 //  }
148 //
149 //  @Override
150 //  public ProtonServerOptions setPemKeyCertOptions(PemKeyCertOptions options) {
151 //    super.setPemKeyCertOptions(options);
152 //    return this;
153 //  }
154 //
155 //  @Override
156 //  public ProtonServerOptions setTrustStoreOptions(JksOptions options) {
157 //    super.setTrustStoreOptions(options);
158 //    return this;
159 //  }
160 //
161 //  @Override
162 //  public ProtonServerOptions setPfxTrustOptions(PfxOptions options) {
163 //    super.setPfxTrustOptions(options);
164 //    return this;
165 //  }
166 //
167 //  @Override
168 //  public ProtonServerOptions setPemTrustOptions(PemTrustOptions options) {
169 //    super.setPemTrustOptions(options);
170 //    return this;
171 //  }
172 //
173 //  @Override
174 //  public ProtonServerOptions addEnabledCipherSuite(String suite) {
175 //    super.addEnabledCipherSuite(suite);
176 //    return this;
177 //  }
178 //
179 //  @Override
180 //  public ProtonServerOptions addCrlPath(String crlPath) throws NullPointerException {
181 //    super.addCrlPath(crlPath);
182 //    return this;
183 //  }
184 //
185 //  @Override
186 //  public ProtonServerOptions addCrlValue(Buffer crlValue) throws NullPointerException {
187 //    super.addCrlValue(crlValue);
188 //    return this;
189 //  }
190 //
191 //  @Override
192 //  public ProtonServerOptions setAcceptBacklog(int acceptBacklog) {
193 //    super.setAcceptBacklog(acceptBacklog);
194 //    return this;
195 //  }
196 //
197 //  @Override
198 //  public ProtonServerOptions setPort(int port) {
199 //    super.setPort(port);
200 //    return this;
201 //  }
202 //
203 //  @Override
204 //  public ProtonServerOptions setHost(String host) {
205 //    super.setHost(host);
206 //    return this;
207 //  }
208 //
209 //  @Override
210 //  public ProtonServerOptions setClientAuth(ClientAuth clientAuth) {
211 //    super.setClientAuth(clientAuth);
212 //    return this;
213 //  }
214 //
215 //  @Override
216 //  public int hashCode() {
217 //    final int prime = 31;
218 //
219 //    int result = super.hashCode();
220 //    result = prime * result + this.heartbeat;
221 //    result = prime * result + this.maxFrameSize;
222 //
223 //    return result;
224 //  }
225 //
226 //  @Override
227 //  public boolean equals(Object obj) {
228 //    if (this == obj) {
229 //      return true;
230 //    }
231 //
232 //    if (obj is null || getClass() != obj.getClass()){
233 //      return false;
234 //    }
235 //
236 //    if (!super.equals(obj)) {
237 //      return false;
238 //    }
239 //
240 //    ProtonServerOptions other = (ProtonServerOptions) obj;
241 //    if (this.heartbeat != other.heartbeat) {
242 //      return false;
243 //    }
244 //    if (this.maxFrameSize != other.maxFrameSize) {
245 //      return false;
246 //    }
247 //
248 //    return true;
249 //  }
250 //
251 //  @Override
252 //  public ProtonServerOptions setUseAlpn(boolean useAlpn) {
253 //    throw new UnsupportedOperationException();
254 //  }
255 //
256 //  @Override
257 //  public ProtonServerOptions addEnabledSecureTransportProtocol(String protocol) {
258 //    super.addEnabledSecureTransportProtocol(protocol);
259 //    return this;
260 //  }
261 //
262 //  @Override
263 //  public ProtonServerOptions removeEnabledSecureTransportProtocol(String protocol) {
264 //    super.removeEnabledSecureTransportProtocol(protocol);
265 //    return this;
266 //  }
267 //
268 //  @Override
269 //  public ProtonServerOptions setEnabledSecureTransportProtocols(Set<String> enabledSecureTransportProtocols) {
270 //    super.setEnabledSecureTransportProtocols(enabledSecureTransportProtocols);
271 //    return this;
272 //  }
273 //
274 //  @Override
275 //  public ProtonServerOptions setJdkSslEngineOptions(JdkSSLEngineOptions sslEngineOptions) {
276 //    super.setJdkSslEngineOptions(sslEngineOptions);
277 //    return this;
278 //  }
279 //
280 //  @Override
281 //  public ProtonServerOptions setKeyCertOptions(KeyCertOptions options) {
282 //    super.setKeyCertOptions(options);
283 //    return this;
284 //  }
285 //
286 //  @Override
287 //  public ProtonServerOptions setOpenSslEngineOptions(OpenSSLEngineOptions sslEngineOptions) {
288 //    super.setOpenSslEngineOptions(sslEngineOptions);
289 //    return this;
290 //  }
291 //
292 //  @Override
293 //  public ProtonServerOptions setSslEngineOptions(SSLEngineOptions sslEngineOptions) {
294 //    super.setSslEngineOptions(sslEngineOptions);
295 //    return this;
296 //  }
297 //
298 //  @Override
299 //  public ProtonServerOptions setSslHandshakeTimeout(long sslHandshakeTimeout) {
300 //    super.setSslHandshakeTimeout(sslHandshakeTimeout);
301 //    return this;
302 //  }
303 //
304 //  @Override
305 //  public ProtonServerOptions setSslHandshakeTimeoutUnit(TimeUnit sslHandshakeTimeoutUnit) {
306 //    super.setSslHandshakeTimeoutUnit(sslHandshakeTimeoutUnit);
307 //    return this;
308 //  }
309 //
310 //  @Override
311 //  public ProtonServerOptions setTrustOptions(TrustOptions options) {
312 //    super.setTrustOptions(options);
313 //    return this;
314 //  }
315 //
316 //  @Override
317 //  public ProtonServerOptions setLogActivity(boolean logEnabled) {
318 //    super.setLogActivity(logEnabled);
319 //    return this;
320 //  }
321 //
322 //  @Override
323 //  public ProtonServerOptions setSni(boolean sni) {
324 //    super.setSni(sni);
325 //    return this;
326 //  }
327 //
328 //  @Override
329 //  public ProtonServerOptions setReusePort(boolean reusePort) {
330 //    super.setReusePort(reusePort);
331 //    return this;
332 //  }
333 //
334 //  @Override
335 //  public ProtonServerOptions setTcpFastOpen(boolean tcpFastOpen) {
336 //    super.setTcpFastOpen(tcpFastOpen);
337 //    return this;
338 //  }
339 //
340 //  @Override
341 //  public ProtonServerOptions setTcpCork(boolean tcpCork) {
342 //    super.setTcpCork(tcpCork);
343 //    return this;
344 //  }
345 //
346 //  @Override
347 //  public ProtonServerOptions setTcpQuickAck(boolean tcpQuickAck) {
348 //    super.setTcpQuickAck(tcpQuickAck);
349 //    return this;
350 //  }
351 //
352 //  /**
353 //   * Sets the heart beat (in milliseconds) as maximum delay between sending frames for the remote peers.
354 //   * If no frames are received within 2 * heart beat, the connection is closed.
355 //   *
356 //   * @param heartbeat heart beat maximum delay
357 //   * @return current ProtonServerOptions instance
358 //   */
359 //  public ProtonServerOptions setHeartbeat(int heartbeat) {
360 //    this.heartbeat = heartbeat;
361 //    return this;
362 //  }
363 //
364 //  /**
365 //   * Gets the heart beat (in milliseconds) as maximum delay between sending frames for the remote peers.
366 //   *
367 //   * @return heart beat maximum delay
368 //   */
369 //  public int getHeartbeat() {
370 //    return this.heartbeat;
371 //  }
372 //
373 //  /**
374 //   * Sets the maximum frame size for connections.
375 //   * <p>
376 //   * If this property is not set explicitly, a reasonable default value is used.
377 //   * <p>
378 //   * Setting this property to a negative value will result in no maximum frame size being announced at all.
379 //   *
380 //   * @param maxFrameSize The frame size in bytes.
381 //   * @return This instance for setter chaining.
382 //   */
383 //  public ProtonServerOptions setMaxFrameSize(int maxFrameSize) {
384 //    if (maxFrameSize < 0) {
385 //      this.maxFrameSize = -1;
386 //    } else {
387 //      this.maxFrameSize = maxFrameSize;
388 //    }
389 //    return this;
390 //  }
391 //
392 //  /**
393 //   * Gets the maximum frame size for connections.
394 //   * <p>
395 //   * If this property is not set explicitly, a reasonable default value is used.
396 //   *
397 //   * @return The frame size in bytes or -1 if no limit is set.
398 //   */
399 //  public int getMaxFrameSize() {
400 //    return maxFrameSize;
401 //  }
402 //}