1 /* 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef COMMUNICATIONNETSTACK_EXTRA_OPTIONS_BASE_H 17 #define COMMUNICATIONNETSTACK_EXTRA_OPTIONS_BASE_H 18 19 #include <cstdint> 20 21 namespace OHOS::NetStack::Socket { 22 class ExtraOptionsBase { 23 public: 24 ExtraOptionsBase(); 25 26 ~ExtraOptionsBase() = default; 27 28 void SetReceiveBufferSize(uint32_t receiveBufferSize); 29 30 void SetSendBufferSize(uint32_t sendBufferSize); 31 32 void SetReuseAddress(bool reuseAddress); 33 34 void SetSocketTimeout(uint32_t socketTimeout); 35 36 [[nodiscard]] uint32_t GetReceiveBufferSize() const; 37 38 [[nodiscard]] uint32_t GetSendBufferSize() const; 39 40 [[nodiscard]] bool IsReuseAddress() const; 41 42 [[nodiscard]] uint32_t GetSocketTimeout() const; 43 44 private: 45 uint32_t receiveBufferSize_; 46 47 uint32_t sendBufferSize_; 48 49 bool reuseAddress_; 50 51 uint32_t socketTimeout_; 52 }; 53 } // namespace OHOS::NetStack::Socket 54 55 #endif /* COMMUNICATIONNETSTACK_EXTRA_OPTIONS_BASE_H */ 56