Line data Source code
1 : /*
2 : *
3 : * Copyright (c) 2020-2021 Project CHIP Authors
4 : * Copyright (c) 2015-2017 Nest Labs, Inc.
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 :
19 : /**
20 : * Shared state for socket implementations of TCPEndPoint and UDPEndPoint.
21 : */
22 :
23 : #pragma once
24 :
25 : #include <inet/EndPointBasis.h>
26 :
27 : #include <inet/IPAddress.h>
28 : #include <system/SocketEvents.h>
29 :
30 : namespace chip {
31 : namespace Inet {
32 :
33 : /**
34 : * Definitions shared by all sockets-based EndPoint classes.
35 : */
36 : class DLL_EXPORT EndPointStateSockets
37 : {
38 : protected:
39 104 : EndPointStateSockets() : mSocket(kInvalidSocketFd) {}
40 :
41 : static constexpr int kInvalidSocketFd = -1;
42 : int mSocket; /**< Encapsulated socket descriptor. */
43 : IPAddressType mAddrType; /**< Protocol family, i.e. IPv4 or IPv6. */
44 : System::SocketWatchToken mWatch; /**< Socket event watcher */
45 : };
46 :
47 : } // namespace Inet
48 : } // namespace chip
|