V.06 11/3

Dependencies:   FT6206 SDFileSystem SPI_TFT_ILI9341 TFT_fonts

Fork of ATT_AWS_IoT_demo by attiot

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers WNCEndpoint.h Source File

WNCEndpoint.h

00001 /* =====================================================================
00002    Copyright © 2016, Avnet (R)
00003 
00004    Contributors:
00005      * James M Flynn, www.em.avnet.com 
00006  
00007    Licensed under the Apache License, Version 2.0 (the "License"); 
00008    you may not use this file except in compliance with the License.
00009    You may obtain a copy of the License at
00010 
00011     http://www.apache.org/licenses/LICENSE-2.0
00012 
00013    Unless required by applicable law or agreed to in writing, 
00014    software distributed under the License is distributed on an 
00015    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
00016    either express or implied. See the License for the specific 
00017    language governing permissions and limitations under the License.
00018 
00019     @file          WNCInterface.cpp
00020     @version       1.0
00021     @date          Sept 2016
00022 
00023 ======================================================================== */
00024 
00025 #include "WNCSocket.h"
00026 
00027 #ifndef WNCENDPOINT_H
00028 #define WNCENDPOINT_H
00029 
00030 struct EndPointAddr {
00031   char IP[16];
00032   unsigned int port;
00033   };
00034 
00035 class WNCUDPSocket;
00036 
00037 class WNCEndpoint {
00038     friend class WNCUDPSocket;
00039 
00040 public:
00041     WNCEndpoint(void);
00042     ~WNCEndpoint(void);
00043     
00044     /** Reset the address of the endpoint by clearning the internal endpoint IP address
00045     \param none
00046     \return none.
00047      */
00048     void reset_address(void);
00049 
00050     /** Set the address of the endpoint
00051     \param host The endpoint address (it can either be an IP Address or a hostname that will be resolved with DNS).
00052     \param port The endpoint port
00053     \return 0 on success, -1 on failure (when an hostname cannot be resolved by DNS).
00054      */
00055     int  set_address(const char* host, const int port);
00056 
00057     /** Get the IP address of the endpoint
00058     \return The IP address of the endpoint.
00059      */
00060     char* get_address(void); 
00061 
00062     /** Get the port of the endpoint
00063     \return The port of the endpoint
00064      */
00065     int get_port(void);
00066 
00067 private:
00068     EndPointAddr _epAddr;
00069 };
00070   
00071 #endif
00072