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 #include "extra_options_base.h" 17 18 namespace OHOS::NetStack { ExtraOptionsBase()19ExtraOptionsBase::ExtraOptionsBase() 20 : receiveBufferSize_(0), sendBufferSize_(0), reuseAddress_(false), socketTimeout_(0) 21 { 22 } 23 SetReceiveBufferSize(uint32_t receiveBufferSize)24void ExtraOptionsBase::SetReceiveBufferSize(uint32_t receiveBufferSize) 25 { 26 receiveBufferSize_ = receiveBufferSize; 27 } 28 SetSendBufferSize(uint32_t sendBufferSize)29void ExtraOptionsBase::SetSendBufferSize(uint32_t sendBufferSize) 30 { 31 sendBufferSize_ = sendBufferSize; 32 } 33 SetReuseAddress(bool reuseAddress)34void ExtraOptionsBase::SetReuseAddress(bool reuseAddress) 35 { 36 reuseAddress_ = reuseAddress; 37 } 38 SetSocketTimeout(uint32_t socketTimeout)39void ExtraOptionsBase::SetSocketTimeout(uint32_t socketTimeout) 40 { 41 socketTimeout_ = socketTimeout; 42 } 43 GetReceiveBufferSize() const44uint32_t ExtraOptionsBase::GetReceiveBufferSize() const 45 { 46 return receiveBufferSize_; 47 } 48 GetSendBufferSize() const49uint32_t ExtraOptionsBase::GetSendBufferSize() const 50 { 51 return sendBufferSize_; 52 } 53 IsReuseAddress() const54bool ExtraOptionsBase::IsReuseAddress() const 55 { 56 return reuseAddress_; 57 } 58 GetSocketTimeout() const59uint32_t ExtraOptionsBase::GetSocketTimeout() const 60 { 61 return socketTimeout_; 62 } 63 } // namespace OHOS::NetStack 64