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