Jack Hansdampf / UIPEthernet
Committer:
hudakz
Date:
Tue Aug 27 15:01:10 2019 +0000
Revision:
9:a156d3de5647
Parent:
8:4acb22344932
Mbed OS 5 support added and API modified.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hudakz 4:d774541a34da 1 /*
hudakz 4:d774541a34da 2 Client.h - Base class that provides Client
hudakz 4:d774541a34da 3 Copyright (c) 2011 Adrian McEwen. All right reserved.
hudakz 4:d774541a34da 4
hudakz 4:d774541a34da 5 Modified (ported to mbed) by Zoltan Hudak <hudakz@inbox.com>
hudakz 4:d774541a34da 6
hudakz 4:d774541a34da 7 This library is free software; you can redistribute it and/or
hudakz 4:d774541a34da 8 modify it under the terms of the GNU Lesser General Public
hudakz 4:d774541a34da 9 License as published by the Free Software Foundation; either
hudakz 4:d774541a34da 10 version 2.1 of the License, or (at your option) any later version.
hudakz 4:d774541a34da 11
hudakz 4:d774541a34da 12 This library is distributed in the hope that it will be useful,
hudakz 4:d774541a34da 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
hudakz 4:d774541a34da 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
hudakz 4:d774541a34da 15 Lesser General Public License for more details.
hudakz 4:d774541a34da 16
hudakz 4:d774541a34da 17 You should have received a copy of the GNU Lesser General Public
hudakz 4:d774541a34da 18 License along with this library; if not, write to the Free Software
hudakz 4:d774541a34da 19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
hudakz 4:d774541a34da 20 */
hudakz 4:d774541a34da 21 #ifndef client_h
hudakz 8:4acb22344932 22 #define client_h
hudakz 9:a156d3de5647 23 #include "IpAddress.h"
hudakz 9:a156d3de5647 24 #include <stddef.h>
hudakz 4:d774541a34da 25
hudakz 4:d774541a34da 26 class Client
hudakz 4:d774541a34da 27 {
hudakz 4:d774541a34da 28 public:
hudakz 9:a156d3de5647 29 virtual int connect(IpAddress ip, uint16_t port) = 0;
hudakz 4:d774541a34da 30 virtual int connect(const char* host, uint16_t port) = 0;
hudakz 4:d774541a34da 31 virtual size_t write(uint8_t) = 0;
hudakz 4:d774541a34da 32 virtual size_t write(const uint8_t* buf, size_t size) = 0;
hudakz 4:d774541a34da 33 virtual int available(void) = 0;
hudakz 4:d774541a34da 34 virtual int read(void) = 0;
hudakz 4:d774541a34da 35 virtual int read(uint8_t* buf, size_t size) = 0;
hudakz 4:d774541a34da 36 virtual int peek(void) = 0;
hudakz 4:d774541a34da 37 virtual void flush(void) = 0;
hudakz 4:d774541a34da 38 virtual void stop(void) = 0;
hudakz 4:d774541a34da 39 virtual uint8_t connected(void) = 0;
hudakz 4:d774541a34da 40 virtual operator bool(void) = 0;
hudakz 4:d774541a34da 41 protected:
hudakz 9:a156d3de5647 42 uint8_t* rawIPAddress(IpAddress& addr) { return addr.rawAddress(); };
hudakz 4:d774541a34da 43 };
hudakz 4:d774541a34da 44 #endif