Rename Interface -> Stack

NetworkInterface  -> NetworkStack
EthernetInterface -> EthernetStack
WiFiInterface     -> WiFiStack
CellularInterface -> CellularStack
MeshInterface     -> MeshStack
pull/2216/head^2
Christopher Haster 2016-04-19 18:07:43 -05:00
parent d36a0b6b88
commit fc71badb69
18 changed files with 53 additions and 53 deletions

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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
*

View File

@ -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;

View File

@ -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;

View File

@ -15,7 +15,7 @@
*/
#include "SocketAddress.h"
#include "NetworkInterface.h"
#include "NetworkStack.h"
#include <string.h>
#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)) {

View File

@ -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
*

View File

@ -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);
}

View File

@ -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
*

View File

@ -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);
}

View File

@ -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
*

View File

@ -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);
}

View File

@ -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
*

View File

@ -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