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 * Defines certain methods that all junixsocket socket implementations share and extend beyond the
22 * standard socket API.
23 *
24 * The set of features include methods to support working with ancillary messages (such as file
25 * descriptors) as well as socket credentials.
26 *
27 * Keep in mind that the platform this code runs on may not support these features, and exceptions
28 * may be thrown when not checking for the corresponding {@link AFSocketCapability} first.
29 *
30 * @author Christian Kohlschütter
31 */
32 public interface AFSocketExtensions {
33 /**
34 * Returns the size of the receive buffer for ancillary messages (in bytes).
35 *
36 * @return The size.
37 */
38 int getAncillaryReceiveBufferSize();
39
40 /**
41 * Sets the size of the receive buffer for ancillary messages (in bytes).
42 *
43 * To disable handling ancillary messages, set it to 0 (default).
44 *
45 * @param size The size.
46 */
47 void setAncillaryReceiveBufferSize(int size);
48
49 /**
50 * Ensures a minimum ancillary receive buffer size.
51 *
52 * @param minSize The minimum size (in bytes).
53 */
54 void ensureAncillaryReceiveBufferSize(int minSize);
55 }