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_SOCKET_REMOTE_INFO_H
17 #define COMMUNICATIONNETSTACK_SOCKET_REMOTE_INFO_H
18 
19 #include <cstdint>
20 #include <iosfwd>
21 #include <string>
22 
23 #include "net_address.h"
24 
25 namespace OHOS::NetStack::Socket {
26 class SocketRemoteInfo final {
27 public:
28     SocketRemoteInfo();
29 
30     ~SocketRemoteInfo() = default;
31 
32     void SetAddress(const std::string &address);
33 
34     void SetFamily(sa_family_t family);
35 
36     void SetPort(uint16_t port);
37 
38     void SetSize(uint32_t size);
39 
40     void SetFamilyByStr(const std::string family);
41     [[nodiscard]] const std::string &GetAddress() const;
42 
43     [[nodiscard]] const std::string &GetFamily() const;
44 
45     [[nodiscard]] uint16_t GetPort() const;
46 
47     [[nodiscard]] uint32_t GetSize() const;
48 
49 private:
50     std::string address_;
51 
52     std::string family_;
53 
54     uint16_t port_;
55 
56     uint32_t size_;
57 };
58 } // namespace OHOS::NetStack::Socket
59 
60 #endif /* COMMUNICATIONNETSTACK_SOCKET_REMOTE_INFO_H */
61