My fork

Dependencies:   WncControllerK64F

Fork of WNCInterface by Jan Korycan

Committer:
korycanjan
Date:
Thu Apr 05 03:17:03 2018 +0000
Revision:
33:f41d199375f0
Parent:
28:dceb8da78e6d
Better stability

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JMF 1:e511ea8d39d5 1 /* =====================================================================
JMF 1:e511ea8d39d5 2 Copyright © 2016, Avnet (R)
JMF 1:e511ea8d39d5 3
JMF 1:e511ea8d39d5 4 Contributors:
JMF 1:e511ea8d39d5 5 * James M Flynn, www.em.avnet.com
JMF 1:e511ea8d39d5 6
JMF 1:e511ea8d39d5 7 Licensed under the Apache License, Version 2.0 (the "License");
JMF 1:e511ea8d39d5 8 you may not use this file except in compliance with the License.
JMF 1:e511ea8d39d5 9 You may obtain a copy of the License at
JMF 1:e511ea8d39d5 10
JMF 1:e511ea8d39d5 11 http://www.apache.org/licenses/LICENSE-2.0
JMF 1:e511ea8d39d5 12
JMF 1:e511ea8d39d5 13 Unless required by applicable law or agreed to in writing,
JMF 1:e511ea8d39d5 14 software distributed under the License is distributed on an
JMF 1:e511ea8d39d5 15 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
JMF 1:e511ea8d39d5 16 either express or implied. See the License for the specific
JMF 1:e511ea8d39d5 17 language governing permissions and limitations under the License.
JMF 1:e511ea8d39d5 18
JMF 1:e511ea8d39d5 19 @file WNCInterface.cpp
JMF 1:e511ea8d39d5 20 @version 1.0
JMF 1:e511ea8d39d5 21 @date Sept 2016
JMF 1:e511ea8d39d5 22
JMF 1:e511ea8d39d5 23 ======================================================================== */
JMF 1:e511ea8d39d5 24
JMF 1:e511ea8d39d5 25
JMF 1:e511ea8d39d5 26 #ifndef ENDPOINT_H
JMF 1:e511ea8d39d5 27 #define ENDPOINT_H
JMF 1:e511ea8d39d5 28
JMF 26:81e520908460 29 #include "WncSocket.h"
JMF 26:81e520908460 30
JMF 1:e511ea8d39d5 31 struct EndPointAddr {
JMF 1:e511ea8d39d5 32 char IP[16];
JMF 1:e511ea8d39d5 33 unsigned int port;
JMF 1:e511ea8d39d5 34 };
JMF 1:e511ea8d39d5 35
JMF 28:dceb8da78e6d 36 class WncUDPSocket;
JMF 1:e511ea8d39d5 37
JMF 27:2dc9461c04dc 38 class WncEndpoint {
JMF 28:dceb8da78e6d 39 friend class WncUDPSocket;
JMF 1:e511ea8d39d5 40
JMF 1:e511ea8d39d5 41 public:
JMF 27:2dc9461c04dc 42 WncEndpoint(void);
JMF 27:2dc9461c04dc 43 ~WncEndpoint(void);
JMF 1:e511ea8d39d5 44
JMF 1:e511ea8d39d5 45 /** Reset the address of the endpoint by clearning the internal endpoint IP address
JMF 1:e511ea8d39d5 46 \param none
JMF 1:e511ea8d39d5 47 \return none.
JMF 1:e511ea8d39d5 48 */
JMF 1:e511ea8d39d5 49 void reset_address(void);
JMF 1:e511ea8d39d5 50
JMF 1:e511ea8d39d5 51 /** Set the address of the endpoint
JMF 1:e511ea8d39d5 52 \param host The endpoint address (it can either be an IP Address or a hostname that will be resolved with DNS).
JMF 1:e511ea8d39d5 53 \param port The endpoint port
JMF 1:e511ea8d39d5 54 \return 0 on success, -1 on failure (when an hostname cannot be resolved by DNS).
JMF 1:e511ea8d39d5 55 */
JMF 1:e511ea8d39d5 56 int set_address(const char* host, const int port);
JMF 1:e511ea8d39d5 57
JMF 1:e511ea8d39d5 58 /** Get the IP address of the endpoint
JMF 1:e511ea8d39d5 59 \return The IP address of the endpoint.
JMF 1:e511ea8d39d5 60 */
JMF 1:e511ea8d39d5 61 char* get_address(void);
JMF 1:e511ea8d39d5 62
JMF 1:e511ea8d39d5 63 /** Get the port of the endpoint
JMF 1:e511ea8d39d5 64 \return The port of the endpoint
JMF 1:e511ea8d39d5 65 */
JMF 1:e511ea8d39d5 66 int get_port(void);
JMF 1:e511ea8d39d5 67
JMF 1:e511ea8d39d5 68 private:
JMF 1:e511ea8d39d5 69 EndPointAddr _epAddr;
JMF 1:e511ea8d39d5 70 };
JMF 1:e511ea8d39d5 71
JMF 1:e511ea8d39d5 72 #endif