1 /*
2 * junixsocket
3 *
4 * Copyright 2009-2024 Christian Kohlschütter
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18 package org.newsclub.net.unix;
19
20 /**
21 * Describes junixsocket capabilities the current environment (system platform, native library,
22 * etc.) may or may not support.
23 *
24 * You can check whether your environment supports a given capability by calling
25 * {@link AFUNIXSocket#supports(AFUNIXSocketCapability)}.
26 *
27 * This enum is deprecated. Use {@link AFSocketCapability} instead.
28 *
29 * @see AFSocketCapability
30 */
31 @Deprecated
32 public enum AFUNIXSocketCapability {
33 // see org_newsclub_net_unix_NativeUnixSocket.c in junixsocket-native
34
35 /** Socket supports retrieving peer credentials. */
36 CAPABILITY_PEER_CREDENTIALS(0),
37
38 /** Socket supports sending and receiving ancillary messages. */
39 CAPABILITY_ANCILLARY_MESSAGES(1),
40
41 /** Socket supports passing file descriptors via ancillary messages. */
42 CAPABILITY_FILE_DESCRIPTORS(2),
43
44 /** Socket addressing supports the abstract namespace (Linux). */
45 CAPABILITY_ABSTRACT_NAMESPACE(3),
46
47 /** Support for AF_UNIX datagrams (not on Windows yet). */
48 CAPABILITY_DATAGRAMS(4),
49
50 /**
51 * A pair of interconnected sockets can be created natively.
52 *
53 * This currently not possible on Windows, but instead emulated via anonymous AF_INET ports when
54 * you use {@link AFUNIXSocketPair}.
55 */
56 CAPABILITY_NATIVE_SOCKETPAIR(5),
57
58 ; // end of list
59
60 private final int bitmask;
61
62 AFUNIXSocketCapability(int bit) {
63 this.bitmask = 1 << bit;
64 }
65
66 int getBitmask() {
67 return bitmask;
68 }
69 }