Murata Type YD Wi-Fi driver
Dependents: easy-connect-type-yd
SNICInterface/Socket/Endpoint.h@0:35a2186cf186, 2017-07-12 (annotated)
- Committer:
- MACRUM
- Date:
- Wed Jul 12 10:49:10 2017 +0000
- Revision:
- 0:35a2186cf186
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MACRUM | 0:35a2186cf186 | 1 | /* Copyright (C) 2012 mbed.org, MIT License |
MACRUM | 0:35a2186cf186 | 2 | * |
MACRUM | 0:35a2186cf186 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
MACRUM | 0:35a2186cf186 | 4 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
MACRUM | 0:35a2186cf186 | 5 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
MACRUM | 0:35a2186cf186 | 6 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
MACRUM | 0:35a2186cf186 | 7 | * furnished to do so, subject to the following conditions: |
MACRUM | 0:35a2186cf186 | 8 | * |
MACRUM | 0:35a2186cf186 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
MACRUM | 0:35a2186cf186 | 10 | * substantial portions of the Software. |
MACRUM | 0:35a2186cf186 | 11 | * |
MACRUM | 0:35a2186cf186 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
MACRUM | 0:35a2186cf186 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
MACRUM | 0:35a2186cf186 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
MACRUM | 0:35a2186cf186 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
MACRUM | 0:35a2186cf186 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
MACRUM | 0:35a2186cf186 | 17 | */ |
MACRUM | 0:35a2186cf186 | 18 | /* Copyright (C) 2014 Murata Manufacturing Co.,Ltd., MIT License |
MACRUM | 0:35a2186cf186 | 19 | * port to the muRata, SWITCH SCIENCE Wi-FI module TypeYD SNIC-UART. |
MACRUM | 0:35a2186cf186 | 20 | */ |
MACRUM | 0:35a2186cf186 | 21 | #ifndef SNIC_ENDPOINT_H |
MACRUM | 0:35a2186cf186 | 22 | #define SNIC_ENDPOINT_H |
MACRUM | 0:35a2186cf186 | 23 | |
MACRUM | 0:35a2186cf186 | 24 | class UDPSocket; |
MACRUM | 0:35a2186cf186 | 25 | |
MACRUM | 0:35a2186cf186 | 26 | /** |
MACRUM | 0:35a2186cf186 | 27 | IP Endpoint (address, port) |
MACRUM | 0:35a2186cf186 | 28 | */ |
MACRUM | 0:35a2186cf186 | 29 | class Endpoint { |
MACRUM | 0:35a2186cf186 | 30 | friend class SnicUDPSocket; |
MACRUM | 0:35a2186cf186 | 31 | |
MACRUM | 0:35a2186cf186 | 32 | public: |
MACRUM | 0:35a2186cf186 | 33 | /** IP Endpoint (address, port) |
MACRUM | 0:35a2186cf186 | 34 | */ |
MACRUM | 0:35a2186cf186 | 35 | Endpoint(void); |
MACRUM | 0:35a2186cf186 | 36 | |
MACRUM | 0:35a2186cf186 | 37 | ~Endpoint(void); |
MACRUM | 0:35a2186cf186 | 38 | |
MACRUM | 0:35a2186cf186 | 39 | /** Reset the address of this endpoint |
MACRUM | 0:35a2186cf186 | 40 | */ |
MACRUM | 0:35a2186cf186 | 41 | void reset_address(void); |
MACRUM | 0:35a2186cf186 | 42 | |
MACRUM | 0:35a2186cf186 | 43 | /** Set the address of this endpoint |
MACRUM | 0:35a2186cf186 | 44 | \param host_p The endpoint address (it can either be an IP Address or a hostname that will be resolved with DNS). |
MACRUM | 0:35a2186cf186 | 45 | \param port The endpoint port |
MACRUM | 0:35a2186cf186 | 46 | \return 0 on success, -1 on failure (when an hostname cannot be resolved by DNS). |
MACRUM | 0:35a2186cf186 | 47 | */ |
MACRUM | 0:35a2186cf186 | 48 | int set_address(const char* host_p, const int port); |
MACRUM | 0:35a2186cf186 | 49 | |
MACRUM | 0:35a2186cf186 | 50 | /** Get the IP address of this endpoint |
MACRUM | 0:35a2186cf186 | 51 | \return The IP address of this endpoint. |
MACRUM | 0:35a2186cf186 | 52 | */ |
MACRUM | 0:35a2186cf186 | 53 | char* get_address(void); |
MACRUM | 0:35a2186cf186 | 54 | |
MACRUM | 0:35a2186cf186 | 55 | /** Get the port of this endpoint |
MACRUM | 0:35a2186cf186 | 56 | \return The port of this endpoint |
MACRUM | 0:35a2186cf186 | 57 | */ |
MACRUM | 0:35a2186cf186 | 58 | int get_port(void); |
MACRUM | 0:35a2186cf186 | 59 | |
MACRUM | 0:35a2186cf186 | 60 | protected: |
MACRUM | 0:35a2186cf186 | 61 | char mIpAddress[17]; |
MACRUM | 0:35a2186cf186 | 62 | int mPort; |
MACRUM | 0:35a2186cf186 | 63 | // struct sockaddr_in _remoteHost; |
MACRUM | 0:35a2186cf186 | 64 | |
MACRUM | 0:35a2186cf186 | 65 | }; |
MACRUM | 0:35a2186cf186 | 66 | #endif |
MACRUM | 0:35a2186cf186 | 67 |