mirror of
https://github.com/esp8266/Arduino.git
synced 2025-09-02 09:41:44 +03:00
IPv6 on esp8266-nonos-sdk and arduino (#5136)
This commit is contained in:
@@ -75,7 +75,7 @@ uint8_t listen(SOCKET s)
|
||||
*
|
||||
* @return 1 for success else 0.
|
||||
*/
|
||||
uint8_t connect(SOCKET s, uint8_t * addr, uint16_t port)
|
||||
uint8_t connect(SOCKET s, const uint8_t * addr, uint16_t port)
|
||||
{
|
||||
if
|
||||
(
|
||||
@@ -420,7 +420,7 @@ uint16_t bufferData(SOCKET s, uint16_t offset, const uint8_t* buf, uint16_t len)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int startUDP(SOCKET s, uint8_t* addr, uint16_t port)
|
||||
int startUDP(SOCKET s, const uint8_t* addr, uint16_t port)
|
||||
{
|
||||
if
|
||||
(
|
||||
|
@@ -6,7 +6,7 @@
|
||||
extern uint8_t socket(SOCKET s, uint8_t protocol, uint16_t port, uint8_t flag); // Opens a socket(TCP or UDP or IP_RAW mode)
|
||||
extern uint8_t socketStatus(SOCKET s);
|
||||
extern void close(SOCKET s); // Close socket
|
||||
extern uint8_t connect(SOCKET s, uint8_t * addr, uint16_t port); // Establish TCP connection (Active connection)
|
||||
extern uint8_t connect(SOCKET s, const uint8_t * addr, uint16_t port); // Establish TCP connection (Active connection)
|
||||
extern void disconnect(SOCKET s); // disconnect the connection
|
||||
extern uint8_t listen(SOCKET s); // Establish TCP connection (Passive connection)
|
||||
extern uint16_t send(SOCKET s, const uint8_t * buf, uint16_t len); // Send data (TCP)
|
||||
@@ -26,7 +26,7 @@ extern uint16_t igmpsend(SOCKET s, const uint8_t * buf, uint16_t len);
|
||||
or more calls to bufferData and then finally sent with sendUDP.
|
||||
@return 1 if the datagram was successfully set up, or 0 if there was an error
|
||||
*/
|
||||
extern int startUDP(SOCKET s, uint8_t* addr, uint16_t port);
|
||||
extern int startUDP(SOCKET s, const uint8_t* addr, uint16_t port);
|
||||
/*
|
||||
@brief This function copies up to len bytes of data from buf into a UDP datagram to be
|
||||
sent later by sendUDP. Allows datagrams to be built up from a series of bufferData calls.
|
||||
|
@@ -1,14 +1,24 @@
|
||||
#ifndef UTIL_H
|
||||
#define UTIL_H
|
||||
|
||||
#ifndef htons
|
||||
#define htons(x) ( ((x)<< 8 & 0xFF00) | \
|
||||
((x)>> 8 & 0x00FF) )
|
||||
#define ntohs(x) htons(x)
|
||||
#endif
|
||||
|
||||
#ifndef ntohs
|
||||
#define ntohs(x) htons(x)
|
||||
#endif
|
||||
|
||||
#ifndef htonl
|
||||
#define htonl(x) ( ((x)<<24 & 0xFF000000UL) | \
|
||||
((x)<< 8 & 0x00FF0000UL) | \
|
||||
((x)>> 8 & 0x0000FF00UL) | \
|
||||
((x)>>24 & 0x000000FFUL) )
|
||||
#endif
|
||||
|
||||
#ifndef ntohl
|
||||
#define ntohl(x) htonl(x)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -260,7 +260,7 @@ private:
|
||||
static inline uint8_t readSn(SOCKET _s, uint16_t _addr);
|
||||
static inline uint8_t writeSn(SOCKET _s, uint16_t _addr, uint8_t _data);
|
||||
static inline uint16_t readSn(SOCKET _s, uint16_t _addr, uint8_t *_buf, uint16_t len);
|
||||
static inline uint16_t writeSn(SOCKET _s, uint16_t _addr, uint8_t *_buf, uint16_t len);
|
||||
static inline uint16_t writeSn(SOCKET _s, uint16_t _addr, const uint8_t *_buf, uint16_t len);
|
||||
|
||||
static const uint16_t CH_BASE = 0x0400;
|
||||
static const uint16_t CH_SIZE = 0x0100;
|
||||
@@ -286,7 +286,7 @@ private:
|
||||
return res; \
|
||||
}
|
||||
#define __SOCKET_REGISTER_N(name, address, size) \
|
||||
static uint16_t write##name(SOCKET _s, uint8_t *_buff) { \
|
||||
static uint16_t write##name(SOCKET _s, const uint8_t *_buff) { \
|
||||
return writeSn(_s, address, _buff, size); \
|
||||
} \
|
||||
static uint16_t read##name(SOCKET _s, uint8_t *_buff) { \
|
||||
@@ -371,7 +371,7 @@ uint16_t W5100Class::readSn(SOCKET _s, uint16_t _addr, uint8_t *_buf, uint16_t _
|
||||
return read(CH_BASE + _s * CH_SIZE + _addr, _buf, _len);
|
||||
}
|
||||
|
||||
uint16_t W5100Class::writeSn(SOCKET _s, uint16_t _addr, uint8_t *_buf, uint16_t _len) {
|
||||
uint16_t W5100Class::writeSn(SOCKET _s, uint16_t _addr, const uint8_t *_buf, uint16_t _len) {
|
||||
return write(CH_BASE + _s * CH_SIZE + _addr, _buf, _len);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user