277 throw new IOException("Unable to map index to interface");
278 return (T) ni;
279 }
280 }
281
282 if (name == StandardSocketOptions.SO_REUSEADDR &&
283 reuseAddressEmulated)
284 {
285 return (T)Boolean.valueOf(isReuseAddress);
286 }
287
288 // no special handling
289 return (T) Net.getSocketOption(fd, Net.UNSPEC, name);
290 }
291 }
292
293 private static class DefaultOptionsHolder {
294 static final Set<SocketOption<?>> defaultOptions = defaultOptions();
295
296 private static Set<SocketOption<?>> defaultOptions() {
297 HashSet<SocketOption<?>> set = new HashSet<SocketOption<?>>(8);
298 set.add(StandardSocketOptions.SO_SNDBUF);
299 set.add(StandardSocketOptions.SO_RCVBUF);
300 set.add(StandardSocketOptions.SO_REUSEADDR);
301 set.add(StandardSocketOptions.SO_BROADCAST);
302 set.add(StandardSocketOptions.IP_TOS);
303 set.add(StandardSocketOptions.IP_MULTICAST_IF);
304 set.add(StandardSocketOptions.IP_MULTICAST_TTL);
305 set.add(StandardSocketOptions.IP_MULTICAST_LOOP);
306 if (ExtendedOptionsImpl.flowSupported()) {
307 set.add(jdk.net.ExtendedSocketOptions.SO_FLOW_SLA);
308 }
309 return Collections.unmodifiableSet(set);
310 }
311 }
312
313 @Override
314 public final Set<SocketOption<?>> supportedOptions() {
315 return DefaultOptionsHolder.defaultOptions;
316 }
317
|
277 throw new IOException("Unable to map index to interface");
278 return (T) ni;
279 }
280 }
281
282 if (name == StandardSocketOptions.SO_REUSEADDR &&
283 reuseAddressEmulated)
284 {
285 return (T)Boolean.valueOf(isReuseAddress);
286 }
287
288 // no special handling
289 return (T) Net.getSocketOption(fd, Net.UNSPEC, name);
290 }
291 }
292
293 private static class DefaultOptionsHolder {
294 static final Set<SocketOption<?>> defaultOptions = defaultOptions();
295
296 private static Set<SocketOption<?>> defaultOptions() {
297 HashSet<SocketOption<?>> set = new HashSet<>(8);
298 set.add(StandardSocketOptions.SO_SNDBUF);
299 set.add(StandardSocketOptions.SO_RCVBUF);
300 set.add(StandardSocketOptions.SO_REUSEADDR);
301 set.add(StandardSocketOptions.SO_BROADCAST);
302 set.add(StandardSocketOptions.IP_TOS);
303 set.add(StandardSocketOptions.IP_MULTICAST_IF);
304 set.add(StandardSocketOptions.IP_MULTICAST_TTL);
305 set.add(StandardSocketOptions.IP_MULTICAST_LOOP);
306 if (ExtendedOptionsImpl.flowSupported()) {
307 set.add(jdk.net.ExtendedSocketOptions.SO_FLOW_SLA);
308 }
309 return Collections.unmodifiableSet(set);
310 }
311 }
312
313 @Override
314 public final Set<SocketOption<?>> supportedOptions() {
315 return DefaultOptionsHolder.defaultOptions;
316 }
317
|