NetUtils.h
Go to the documentation of this file.
1 /****
2  * Sming Framework Project - Open Source framework for high efficiency native ESP8266 development.
3  * Created 2015 by Skurydin Alexey
4  * http://github.com/SmingHub/Sming
5  * All files of the Sming Core are provided under the LGPL v3 license.
6  *
7  * NetUtils.h
8  *
9  ****/
10 
15 #pragma once
16 
17 #ifdef ARCH_ESP8266
18 #include "lwip/tcp_impl.h"
19 #else
20 #include "lwip/priv/tcp_priv.h"
21 #endif
22 
23 struct pbuf;
24 class String;
25 
26 class NetUtils
27 {
28 public:
29  // Helpers
30  static bool pbufIsStrEqual(const pbuf* buf, const char* compared, unsigned startPos);
31  static int pbufFindChar(const pbuf* buf, char wtf, unsigned startPos = 0);
32  static int pbufFindStr(const pbuf* buf, const char* wtf, unsigned startPos = 0);
33  static char* pbufAllocateStrCopy(const pbuf* buf, unsigned startPos, unsigned length);
34  static String pbufStrCopy(const pbuf* buf, unsigned startPos, unsigned length);
35 
36 #ifdef FIX_NETWORK_ROUTING
37  static bool FixNetworkRouting();
38 #else
39  static bool FixNetworkRouting()
40  {
41  return true; // Should work on standard lwip
42  }
43 #endif
44 
45  // Debug
46  static void debugPrintTcpList();
47 
48 private:
49 #ifdef FIX_NETWORK_ROUTING
50  static bool ipClientRoutingFixed;
51 #endif
52 };
53 
static int pbufFindChar(const pbuf *buf, char wtf, unsigned startPos=0)
The String class.
Definition: WString.h:136
static String pbufStrCopy(const pbuf *buf, unsigned startPos, unsigned length)
static bool FixNetworkRouting()
Definition: NetUtils.h:39
static char * pbufAllocateStrCopy(const pbuf *buf, unsigned startPos, unsigned length)
static int pbufFindStr(const pbuf *buf, const char *wtf, unsigned startPos=0)
Definition: NetUtils.h:26
static bool pbufIsStrEqual(const pbuf *buf, const char *compared, unsigned startPos)
static void debugPrintTcpList()