-
-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Small updates to Http response/request and Udp (#2117)
* Made toString method for HttpRequest and HttpResponse to be available also in release mode. Useful for building Http request/response strings. * Added UDP multicast methods (when the used LWIP version supports it). * Added join/leave to/from multicast groups in IpConnection class. Co-authored-by: mikee47 <[email protected]>
- Loading branch information
Showing
9 changed files
with
197 additions
and
19 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/**** | ||
* Sming Framework Project - Open Source framework for high efficiency native ESP8266 development. | ||
* Created 2015 by Skurydin Alexey | ||
* http://github.com/SmingHub/Sming | ||
* All files of the Sming Core are provided under the LGPL v3 license. | ||
* | ||
* IpConnection.cpp | ||
* | ||
****/ | ||
|
||
#include "IpConnection.h" | ||
#include <lwip/igmp.h> | ||
|
||
bool IpConnection::joinMulticastGroup(IpAddress localIp, IpAddress multicastIp) | ||
{ | ||
return (igmp_joingroup(localIp, multicastIp) == ERR_OK); | ||
} | ||
|
||
bool IpConnection::leaveMulticastGroup(IpAddress localIp, IpAddress multicastIp) | ||
{ | ||
return (igmp_leavegroup(localIp, multicastIp) == ERR_OK); | ||
} |
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,65 @@ | ||
/**** | ||
* Sming Framework Project - Open Source framework for high efficiency native ESP8266 development. | ||
* Created 2015 by Skurydin Alexey | ||
* http://github.com/SmingHub/Sming | ||
* All files of the Sming Core are provided under the LGPL v3 license. | ||
* | ||
* IpConnection.h | ||
* | ||
****/ | ||
|
||
#pragma once | ||
|
||
#include <IpAddress.h> | ||
|
||
/** @defgroup ip IP | ||
* @brief Provides common IP functions | ||
* @ingroup networking | ||
* @{ | ||
*/ | ||
|
||
class IpConnection | ||
{ | ||
public: | ||
/** | ||
* @brief Uses IGMP to add a local network interface to multicast group | ||
* @param localIp Address identifying network interface | ||
* @param multicastIp The multicast group address | ||
* | ||
* @retval true on success | ||
*/ | ||
bool joinMulticastGroup(IpAddress localIp, IpAddress multicastIp); | ||
|
||
/** | ||
* @brief Uses IGMP to add all local network interfaces to multicast group | ||
* @param multicastIp The multicast group address | ||
* | ||
* @retval true on success | ||
*/ | ||
bool joinMulticastGroup(IpAddress multicastIp) | ||
{ | ||
return joinMulticastGroup(INADDR_NONE, multicastIp); | ||
} | ||
|
||
/** | ||
* @brief Uses IGMP to remove a local network interface from multicast group | ||
* @param localIp Address identifying network interface | ||
* @param multicastIp The multicast group address | ||
* | ||
* @retval true on success | ||
*/ | ||
bool leaveMulticastGroup(IpAddress localIp, IpAddress multicastIp); | ||
|
||
/** | ||
* @brief Uses IGMP to remove all local network interfaces from multicast group | ||
* @param multicastIp The multicast group address | ||
* | ||
* @retval true on success | ||
*/ | ||
bool leaveMulticastGroup(IpAddress multicastIp) | ||
{ | ||
return leaveMulticastGroup(INADDR_NONE, multicastIp); | ||
} | ||
}; | ||
|
||
/** @} */ |
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