GainSpan Wi-Fi library see: http://mbed.org/users/gsfan/notebook/gainspan_wifi/
Dependents: GSwifi_httpd GSwifi_websocket GSwifi_tcpclient GSwifi_tcpserver ... more
Fork of GSwifi by
GainSpan Wi-Fi library
The GS1011 is an ultra low power 802.11b wireless module from GainSpan.
see: http://mbed.org/users/gsfan/notebook/gainspan_wifi/
ゲインスパン Wi-Fi モジュール ライブラリ
ゲインスパン社の低電力 Wi-Fiモジュール(無線LAN) GS1011 シリーズ用のライブラリです。
解説: http://mbed.org/users/gsfan/notebook/gainspan_wifi/
ipaddr.h@20:151b5a4fdd29, 2012-11-08 (annotated)
- Committer:
- gsfan
- Date:
- Thu Nov 08 01:28:45 2012 +0000
- Revision:
- 20:151b5a4fdd29
- Parent:
- 0:2f6062c6d018
suport httpd cgi handler
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gsfan | 0:2f6062c6d018 | 1 | |
gsfan | 0:2f6062c6d018 | 2 | /* |
gsfan | 0:2f6062c6d018 | 3 | Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com) |
gsfan | 0:2f6062c6d018 | 4 | |
gsfan | 0:2f6062c6d018 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy |
gsfan | 0:2f6062c6d018 | 6 | of this software and associated documentation files (the "Software"), to deal |
gsfan | 0:2f6062c6d018 | 7 | in the Software without restriction, including without limitation the rights |
gsfan | 0:2f6062c6d018 | 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
gsfan | 0:2f6062c6d018 | 9 | copies of the Software, and to permit persons to whom the Software is |
gsfan | 0:2f6062c6d018 | 10 | furnished to do so, subject to the following conditions: |
gsfan | 0:2f6062c6d018 | 11 | |
gsfan | 0:2f6062c6d018 | 12 | The above copyright notice and this permission notice shall be included in |
gsfan | 0:2f6062c6d018 | 13 | all copies or substantial portions of the Software. |
gsfan | 0:2f6062c6d018 | 14 | |
gsfan | 0:2f6062c6d018 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
gsfan | 0:2f6062c6d018 | 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
gsfan | 0:2f6062c6d018 | 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
gsfan | 0:2f6062c6d018 | 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
gsfan | 0:2f6062c6d018 | 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
gsfan | 0:2f6062c6d018 | 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
gsfan | 0:2f6062c6d018 | 21 | THE SOFTWARE. |
gsfan | 0:2f6062c6d018 | 22 | */ |
gsfan | 0:2f6062c6d018 | 23 | |
gsfan | 0:2f6062c6d018 | 24 | #ifndef IPADDR_H |
gsfan | 0:2f6062c6d018 | 25 | #define IPADDR_H |
gsfan | 0:2f6062c6d018 | 26 | |
gsfan | 0:2f6062c6d018 | 27 | //#include "netCfg.h" |
gsfan | 0:2f6062c6d018 | 28 | #if NET_LWIP_STACK |
gsfan | 0:2f6062c6d018 | 29 | typedef struct ip_addr ip_addr_t; |
gsfan | 0:2f6062c6d018 | 30 | #endif |
gsfan | 0:2f6062c6d018 | 31 | |
gsfan | 0:2f6062c6d018 | 32 | #include "stdint.h" |
gsfan | 0:2f6062c6d018 | 33 | |
gsfan | 0:2f6062c6d018 | 34 | ///IP Address container |
gsfan | 0:2f6062c6d018 | 35 | /** |
gsfan | 0:2f6062c6d018 | 36 | This class is a container for an IPv4 address. |
gsfan | 0:2f6062c6d018 | 37 | */ |
gsfan | 0:2f6062c6d018 | 38 | class IpAddr //Basically a C++ frontend to ip_addr_t |
gsfan | 0:2f6062c6d018 | 39 | { |
gsfan | 0:2f6062c6d018 | 40 | public: |
gsfan | 0:2f6062c6d018 | 41 | #if NET_LWIP_STACK |
gsfan | 0:2f6062c6d018 | 42 | IpAddr(ip_addr_t* pIp); |
gsfan | 0:2f6062c6d018 | 43 | #endif |
gsfan | 0:2f6062c6d018 | 44 | |
gsfan | 0:2f6062c6d018 | 45 | ///Initializes IP address with provided values |
gsfan | 0:2f6062c6d018 | 46 | IpAddr(uint8_t ip0, uint8_t ip1, uint8_t ip2, uint8_t ip3); |
gsfan | 0:2f6062c6d018 | 47 | |
gsfan | 0:2f6062c6d018 | 48 | ///Initializes IP address with null values |
gsfan | 0:2f6062c6d018 | 49 | IpAddr(); |
gsfan | 0:2f6062c6d018 | 50 | |
gsfan | 0:2f6062c6d018 | 51 | #if NET_LWIP_STACK |
gsfan | 0:2f6062c6d018 | 52 | ip_addr_t getStruct() const; |
gsfan | 0:2f6062c6d018 | 53 | #endif |
gsfan | 0:2f6062c6d018 | 54 | |
gsfan | 0:2f6062c6d018 | 55 | ///Returns IP address byte # |
gsfan | 0:2f6062c6d018 | 56 | uint8_t operator[](unsigned int i) const; |
gsfan | 0:2f6062c6d018 | 57 | |
gsfan | 0:2f6062c6d018 | 58 | ///Compares too addresses |
gsfan | 0:2f6062c6d018 | 59 | /** |
gsfan | 0:2f6062c6d018 | 60 | @return true if the two addresses are equal |
gsfan | 0:2f6062c6d018 | 61 | */ |
gsfan | 0:2f6062c6d018 | 62 | bool isEq(const IpAddr& b) const; |
gsfan | 0:2f6062c6d018 | 63 | |
gsfan | 0:2f6062c6d018 | 64 | ///Compares too addresses |
gsfan | 0:2f6062c6d018 | 65 | /** |
gsfan | 0:2f6062c6d018 | 66 | @return true if the two addresses are equal |
gsfan | 0:2f6062c6d018 | 67 | */ |
gsfan | 0:2f6062c6d018 | 68 | bool operator==(const IpAddr& b) const; |
gsfan | 0:2f6062c6d018 | 69 | |
gsfan | 0:2f6062c6d018 | 70 | ///Compares too addresses |
gsfan | 0:2f6062c6d018 | 71 | /** |
gsfan | 0:2f6062c6d018 | 72 | @return true if the two addresses are different |
gsfan | 0:2f6062c6d018 | 73 | */ |
gsfan | 0:2f6062c6d018 | 74 | bool operator!=(const IpAddr& b) const; |
gsfan | 0:2f6062c6d018 | 75 | |
gsfan | 0:2f6062c6d018 | 76 | ///Checks whether the address is null |
gsfan | 0:2f6062c6d018 | 77 | /** |
gsfan | 0:2f6062c6d018 | 78 | @return true if the address is null |
gsfan | 0:2f6062c6d018 | 79 | */ |
gsfan | 0:2f6062c6d018 | 80 | bool isNull() const; |
gsfan | 0:2f6062c6d018 | 81 | |
gsfan | 0:2f6062c6d018 | 82 | ///Checks whether the address is a broadcast address |
gsfan | 0:2f6062c6d018 | 83 | /** |
gsfan | 0:2f6062c6d018 | 84 | @return true if the address is a broadcast address |
gsfan | 0:2f6062c6d018 | 85 | */ |
gsfan | 0:2f6062c6d018 | 86 | bool isBroadcast() const; |
gsfan | 0:2f6062c6d018 | 87 | |
gsfan | 0:2f6062c6d018 | 88 | ///Checks whether the address is a multicast address |
gsfan | 0:2f6062c6d018 | 89 | /** |
gsfan | 0:2f6062c6d018 | 90 | @return true if the address is a multicast address |
gsfan | 0:2f6062c6d018 | 91 | */ |
gsfan | 0:2f6062c6d018 | 92 | bool isMulticast() const; |
gsfan | 0:2f6062c6d018 | 93 | |
gsfan | 0:2f6062c6d018 | 94 | private: |
gsfan | 0:2f6062c6d018 | 95 | uint8_t m_ip[4]; |
gsfan | 0:2f6062c6d018 | 96 | }; |
gsfan | 0:2f6062c6d018 | 97 | |
gsfan | 0:2f6062c6d018 | 98 | #endif |