-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move UDPEndPointManager out of Globals.cpp
Currently there is no way for platforms to provide storage for UDPEndPointManager or to provide an alternate instance, as there is a prescribed static instance in Globals.cpp. Move this instance to ConnectivityManager, which platforms provide the implementation for. Note to porters: You can inherit from GenericConnectivityManagerImpl_UDP<ConnectivityManagerImpl> if previous behavior was working for you.
- Loading branch information
Showing
26 changed files
with
312 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/include/platform/internal/GenericConnectivityManagerImpl_TCP.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* | ||
* Copyright (c) 2022 Project CHIP Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* @file | ||
* Provides a generic implementation of ConnectivityManager features | ||
* for use on platforms that use TCP. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <inet/TCPEndPointImpl.h> | ||
|
||
namespace chip { | ||
namespace DeviceLayer { | ||
namespace Internal { | ||
|
||
template <class ImplClass> | ||
class GenericConnectivityManagerImpl_TCP | ||
{ | ||
public: | ||
// ConnectivityManager: | ||
chip::Inet::EndPointManager<Inet::TCPEndPoint> & _TCPEndPointManager(); | ||
|
||
private: | ||
static chip::Inet::TCPEndPointManagerImpl sTCPEndPointManagerImpl; | ||
}; | ||
|
||
template <class ImplClass> | ||
chip::Inet::TCPEndPointManagerImpl GenericConnectivityManagerImpl_TCP<ImplClass>::sTCPEndPointManagerImpl; | ||
|
||
template <class ImplClass> | ||
inline chip::Inet::EndPointManager<Inet::TCPEndPoint> & GenericConnectivityManagerImpl_TCP<ImplClass>::_TCPEndPointManager() | ||
{ | ||
return sTCPEndPointManagerImpl; | ||
} | ||
|
||
} // namespace Internal | ||
} // namespace DeviceLayer | ||
} // namespace chip |
54 changes: 54 additions & 0 deletions
54
src/include/platform/internal/GenericConnectivityManagerImpl_UDP.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* | ||
* Copyright (c) 2022 Project CHIP Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* @file | ||
* Provides a generic implementation of ConnectivityManager features | ||
* for use on platforms that use UDP. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <inet/UDPEndPointImpl.h> | ||
|
||
namespace chip { | ||
namespace DeviceLayer { | ||
namespace Internal { | ||
|
||
template <class ImplClass> | ||
class GenericConnectivityManagerImpl_UDP | ||
{ | ||
public: | ||
// ConnectivityManager: | ||
chip::Inet::EndPointManager<Inet::UDPEndPoint> & _UDPEndPointManager(); | ||
|
||
private: | ||
static chip::Inet::UDPEndPointManagerImpl sUDPEndPointManagerImpl; | ||
}; | ||
|
||
template <class ImplClass> | ||
chip::Inet::UDPEndPointManagerImpl GenericConnectivityManagerImpl_UDP<ImplClass>::sUDPEndPointManagerImpl; | ||
|
||
template <class ImplClass> | ||
inline chip::Inet::EndPointManager<Inet::UDPEndPoint> & GenericConnectivityManagerImpl_UDP<ImplClass>::_UDPEndPointManager() | ||
{ | ||
return sUDPEndPointManagerImpl; | ||
} | ||
|
||
} // namespace Internal | ||
} // namespace DeviceLayer | ||
} // namespace chip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.