diff --git a/CellularInterface.h b/CellularStack.h similarity index 90% rename from CellularInterface.h rename to CellularStack.h index a65ac62012..da96cafedb 100644 --- a/CellularInterface.h +++ b/CellularStack.h @@ -1,4 +1,4 @@ -/* CellularInterface +/* CellularStack * Copyright (c) 2015 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,13 +17,13 @@ #ifndef CELLULAR_INTERFACE_H #define CELLULAR_INTERFACE_H -#include "NetworkInterface.h" +#include "NetworkStack.h" -/** CellularInterface class +/** CellularStack class * * Common interface that is shared between ethernet hardware */ -class CellularInterface : public NetworkInterface +class CellularStack : public NetworkStack { public: /** Start the interface diff --git a/DnsQuery/DnsQuery.cpp b/DnsQuery/DnsQuery.cpp index e940e34694..2c209f529e 100644 --- a/DnsQuery/DnsQuery.cpp +++ b/DnsQuery/DnsQuery.cpp @@ -185,7 +185,7 @@ static int32_t query(UDPSocket *socket, const SocketAddress &addr, const char *h return NSAPI_ERROR_DNS_FAILURE; } -int32_t dnsQuery(NetworkInterface *iface, const char *host, char *ip) +int32_t dnsQuery(NetworkStack *iface, const char *host, char *ip) { if (isIP(host)) { strcpy(ip, host); diff --git a/DnsQuery/DnsQuery.h b/DnsQuery/DnsQuery.h index 6e1e6265b7..3c5dfa7d70 100644 --- a/DnsQuery/DnsQuery.h +++ b/DnsQuery/DnsQuery.h @@ -18,7 +18,7 @@ #ifndef __DNSQUERY_H__ #define __DNSQUERY_H__ -#include "NetworkInterface.h" +#include "NetworkStack.h" #include "UDPSocket.h" @@ -34,7 +34,7 @@ * @returns 0 on succes, NS_DNS_FAILURE if host is not found, * or a negative value for other errors. */ -int32_t dnsQuery(NetworkInterface *iface, const char *host, char *ip); +int32_t dnsQuery(NetworkStack *iface, const char *host, char *ip); int32_t dnsQuery(UDPSocket *sock, const char *host, char *ip); diff --git a/EthernetInterface.h b/EthernetStack.h similarity index 88% rename from EthernetInterface.h rename to EthernetStack.h index 8fce3082d0..061648af14 100644 --- a/EthernetInterface.h +++ b/EthernetStack.h @@ -1,4 +1,4 @@ -/* EthernetInterface +/* EthernetStack * Copyright (c) 2015 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,13 +17,13 @@ #ifndef ETHERNET_INTERFACE_H #define ETHERNET_INTERFACE_H -#include "NetworkInterface.h" +#include "NetworkStack.h" -/** EthernetInterface class +/** EthernetStack class * * Common interface that is shared between ethernet hardware. */ -class EthernetInterface : public NetworkInterface +class EthernetStack : public NetworkStack { public: /** Start the interface diff --git a/MeshInterface.h b/MeshStack.h similarity index 89% rename from MeshInterface.h rename to MeshStack.h index 0b1f598a00..cdb4360700 100644 --- a/MeshInterface.h +++ b/MeshStack.h @@ -1,4 +1,4 @@ -/* MeshInterface +/* MeshStack * Copyright (c) 2015 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,13 +17,13 @@ #ifndef MESH_INTERFACE_H #define MESH_INTERFACE_H -#include "NetworkInterface.h" +#include "NetworkStack.h" -/** MeshInterface class +/** MeshStack class * * Common interface that is shared between mesh hardware */ -class MeshInterface : public NetworkInterface +class MeshStack : public NetworkStack { public: /** Start the interface diff --git a/NetworkInterface.cpp b/NetworkStack.cpp similarity index 67% rename from NetworkInterface.cpp rename to NetworkStack.cpp index a39fdc7c43..1b70dd6551 100644 --- a/NetworkInterface.cpp +++ b/NetworkStack.cpp @@ -17,7 +17,7 @@ #include "DnsQuery.h" #include "mbed.h" -int NetworkInterface::gethostbyname(SocketAddress *address, const char *name) +int NetworkStack::gethostbyname(SocketAddress *address, const char *name) { char buffer[NSAPI_IP_SIZE]; int err = dnsQuery(this, name, buffer); @@ -29,22 +29,22 @@ int NetworkInterface::gethostbyname(SocketAddress *address, const char *name) return 0; } -int NetworkInterface::setstackopt(int level, int optname, const void *optval, unsigned optlen) +int NetworkStack::setstackopt(int level, int optname, const void *optval, unsigned optlen) { return NSAPI_ERROR_UNSUPPORTED; } -int NetworkInterface::getstackopt(int level, int optname, void *optval, unsigned *optlen) +int NetworkStack::getstackopt(int level, int optname, void *optval, unsigned *optlen) { return NSAPI_ERROR_UNSUPPORTED; } -int NetworkInterface::setsockopt(void *handle, int level, int optname, const void *optval, unsigned optlen) +int NetworkStack::setsockopt(void *handle, int level, int optname, const void *optval, unsigned optlen) { return NSAPI_ERROR_UNSUPPORTED; } -int NetworkInterface::getsockopt(void *handle, int level, int optname, void *optval, unsigned *optlen) +int NetworkStack::getsockopt(void *handle, int level, int optname, void *optval, unsigned *optlen) { return NSAPI_ERROR_UNSUPPORTED; } diff --git a/NetworkInterface.h b/NetworkStack.h similarity index 98% rename from NetworkInterface.h rename to NetworkStack.h index 1f35571d6e..37306e6c19 100644 --- a/NetworkInterface.h +++ b/NetworkStack.h @@ -1,4 +1,4 @@ -/* NetworkInterface +/* NetworkStack * Copyright (c) 2015 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -62,17 +62,17 @@ enum nsapi_protocol_t { #define NSAPI_MAC_BYTES 6 -/** NetworkInterface class +/** NetworkStack class * * Common interface that is shared between hardware that * can connect to a network over IP. By implementing the - * NetworkInterface, a network stack can be used as a target + * NetworkStack, a network stack can be used as a target * for instantiating network sockets. */ -class NetworkInterface +class NetworkStack { public: - virtual ~NetworkInterface() {}; + virtual ~NetworkStack() {}; /** Get the local IP address * diff --git a/Socket.cpp b/Socket.cpp index e291f7e1a5..aa8a47023c 100644 --- a/Socket.cpp +++ b/Socket.cpp @@ -31,7 +31,7 @@ Socket::~Socket() } } -int Socket::open(NetworkInterface *iface, nsapi_protocol_t proto) +int Socket::open(NetworkStack *iface, nsapi_protocol_t proto) { _iface = iface; diff --git a/Socket.h b/Socket.h index 612360e927..ab093e39d3 100644 --- a/Socket.h +++ b/Socket.h @@ -18,7 +18,7 @@ #define SOCKET_H #include "SocketAddress.h" -#include "NetworkInterface.h" +#include "NetworkStack.h" /** Abstract socket class */ @@ -38,7 +38,7 @@ public: * @param iface Network stack as target for socket * @return 0 on success, negative error code on failure */ - virtual int open(NetworkInterface *iface) = 0; + virtual int open(NetworkStack *iface) = 0; /** Close the socket * @@ -160,11 +160,11 @@ public: protected: Socket(); - int open(NetworkInterface *iface, nsapi_protocol_t proto); + int open(NetworkStack *iface, nsapi_protocol_t proto); static void thunk(void *); - NetworkInterface *_iface; + NetworkStack *_iface; void *_socket; bool _blocking; unsigned _timeout; diff --git a/SocketAddress.cpp b/SocketAddress.cpp index f8446ea349..f238c883d8 100644 --- a/SocketAddress.cpp +++ b/SocketAddress.cpp @@ -15,7 +15,7 @@ */ #include "SocketAddress.h" -#include "NetworkInterface.h" +#include "NetworkStack.h" #include #include "mbed.h" @@ -126,7 +126,7 @@ static void ipv6_to_address(char *addr, const uint8_t *bytes) } -SocketAddress::SocketAddress(NetworkInterface *iface, const char *host, uint16_t port) +SocketAddress::SocketAddress(NetworkStack *iface, const char *host, uint16_t port) { // Check for valid IP addresses if (host && ipv4_is_valid(host)) { diff --git a/SocketAddress.h b/SocketAddress.h index 4e68053265..5d71e2678e 100644 --- a/SocketAddress.h +++ b/SocketAddress.h @@ -56,7 +56,7 @@ enum nsapi_version_t { #define NSAPI_IPv6_BYTES 16 // Predeclared classes -class NetworkInterface; +class NetworkStack; /** SocketAddress class @@ -76,7 +76,7 @@ public: * @param host Hostname to resolve * @param port Optional 16-bit port */ - SocketAddress(NetworkInterface *iface, const char *host, uint16_t port = 0); + SocketAddress(NetworkStack *iface, const char *host, uint16_t port = 0); /** Create a SocketAddress from an IP address and port * diff --git a/TCPServer.cpp b/TCPServer.cpp index 6c513f4be0..83a85d66b4 100644 --- a/TCPServer.cpp +++ b/TCPServer.cpp @@ -21,12 +21,12 @@ TCPServer::TCPServer() { } -TCPServer::TCPServer(NetworkInterface *iface) +TCPServer::TCPServer(NetworkStack *iface) { open(iface); } -int TCPServer::open(NetworkInterface *iface) +int TCPServer::open(NetworkStack *iface) { return Socket::open(iface, NSAPI_TCP); } diff --git a/TCPServer.h b/TCPServer.h index 619056369c..0bb7d15a01 100644 --- a/TCPServer.h +++ b/TCPServer.h @@ -19,7 +19,7 @@ #include "Socket.h" #include "TCPSocket.h" -#include "NetworkInterface.h" +#include "NetworkStack.h" /** TCP socket server */ @@ -37,7 +37,7 @@ public: * * @param iface Network stack as target for socket */ - TCPServer(NetworkInterface *iface); + TCPServer(NetworkStack *iface); /** Opens a socket * @@ -47,7 +47,7 @@ public: * @param iface Network stack as target for socket * @return 0 on success, negative error code on failure */ - virtual int open(NetworkInterface *iface); + virtual int open(NetworkStack *iface); /** Listen for connections on a TCP socket * diff --git a/TCPSocket.cpp b/TCPSocket.cpp index a837f29fe2..b59715594c 100644 --- a/TCPSocket.cpp +++ b/TCPSocket.cpp @@ -21,12 +21,12 @@ TCPSocket::TCPSocket() { } -TCPSocket::TCPSocket(NetworkInterface *iface) +TCPSocket::TCPSocket(NetworkStack *iface) { open(iface); } -int TCPSocket::open(NetworkInterface *iface) +int TCPSocket::open(NetworkStack *iface) { return Socket::open(iface, NSAPI_TCP); } diff --git a/TCPSocket.h b/TCPSocket.h index 834b064015..2a37f776fb 100644 --- a/TCPSocket.h +++ b/TCPSocket.h @@ -18,7 +18,7 @@ #define TCPSOCKET_H #include "Socket.h" -#include "NetworkInterface.h" +#include "NetworkStack.h" /** TCP socket connection */ @@ -36,7 +36,7 @@ public: * * @param iface Network stack as target for socket */ - TCPSocket(NetworkInterface *iface); + TCPSocket(NetworkStack *iface); /** Opens a socket * @@ -46,7 +46,7 @@ public: * @param iface Network stack as target for socket * @return 0 on success, negative error code on failure */ - virtual int open(NetworkInterface *iface); + virtual int open(NetworkStack *iface); /** Connects TCP socket to a remote host * diff --git a/UDPSocket.cpp b/UDPSocket.cpp index 9177de60c8..85569c7a58 100644 --- a/UDPSocket.cpp +++ b/UDPSocket.cpp @@ -21,12 +21,12 @@ UDPSocket::UDPSocket() { } -UDPSocket::UDPSocket(NetworkInterface *iface) +UDPSocket::UDPSocket(NetworkStack *iface) { open(iface); } -int UDPSocket::open(NetworkInterface *iface) +int UDPSocket::open(NetworkStack *iface) { return Socket::open(iface, NSAPI_UDP); } diff --git a/UDPSocket.h b/UDPSocket.h index 74f8c4a340..b2a8454d9f 100644 --- a/UDPSocket.h +++ b/UDPSocket.h @@ -18,7 +18,7 @@ #define UDPSOCKET_H #include "Socket.h" -#include "NetworkInterface.h" +#include "NetworkStack.h" /** UDP socket */ @@ -36,7 +36,7 @@ public: * * @param iface Network stack as target for socket */ - UDPSocket(NetworkInterface *iface); + UDPSocket(NetworkStack *iface); /** Opens a socket * @@ -46,7 +46,7 @@ public: * @param iface Network stack as target for socket * @return 0 on success, negative error code on failure */ - virtual int open(NetworkInterface *iface); + virtual int open(NetworkStack *iface); /** Send a packet over a UDP socket * diff --git a/WiFiInterface.h b/WiFiStack.h similarity index 94% rename from WiFiInterface.h rename to WiFiStack.h index 1a9e267e0b..f5a2ef632b 100644 --- a/WiFiInterface.h +++ b/WiFiStack.h @@ -1,4 +1,4 @@ -/* WiFiInterface +/* WiFiStack * Copyright (c) 2015 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,7 +17,7 @@ #ifndef WIFI_INTERFACE_H #define WIFI_INTERFACE_H -#include "NetworkInterface.h" +#include "NetworkStack.h" /** Enum of WiFi encryption types * @@ -33,11 +33,11 @@ enum nsapi_security_t { NSAPI_SECURITY_WPA2, /*!< phrase conforms to WPA2 */ }; -/** WiFiInterface class +/** WiFiStack class * * Common interface that is shared between WiFi devices */ -class WiFiInterface : public NetworkInterface +class WiFiStack : public NetworkStack { public: /** Start the interface