Base class for IP Based Networking Libraries

Dependencies:   DnsQuery

Dependents:   TempTower BSDInterfaceTests HelloBSDInterface ESP8266InterfaceTests ... more

For a complete getting started guide see the wiki...

Network Socket API

The Network Socket API provides a common interface for using sockets on network devices. The API provides a simple class-based interface that should be familiar to users experienced with other socket APIs. Additionally, the API provides a simple interface for implementing network devices, making it easy to connect hardware agnostic programs to new devices.

Network Interfaces

The NetworkInterface provides an abstract class for network devices that support sockets. Devices should provide a DeviceInterface class that inherits this interface and adds implementation specific methods for using the device. A NetworkInterface must be provided to a Socket constructor to open a socket on the interface. Currently two subclasses are defined for common devices, EthernetInterface and WiFiInterface.

Sockets

The Socket class is used for managing network sockets. Once opened, the socket provides a pipe through which data can sent and recieved to a specific endpoint. The socket class can be instantiated as either a TCPSocket or a UDPSocket which defines the protocol used for the connection.

Committer:
sam_grove
Date:
Sat Aug 29 07:30:52 2015 +0000
Revision:
18:dd05ebdd2546
Child:
21:35ed15069189
Add support for Ethernet based connections

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sam_grove 18:dd05ebdd2546 1 /* EthernetInterface Base Class
sam_grove 18:dd05ebdd2546 2 * Copyright (c) 2015 ARM Limited
sam_grove 18:dd05ebdd2546 3 *
sam_grove 18:dd05ebdd2546 4 * Licensed under the Apache License, Version 2.0 (the "License");
sam_grove 18:dd05ebdd2546 5 * you may not use this file except in compliance with the License.
sam_grove 18:dd05ebdd2546 6 * You may obtain a copy of the License at
sam_grove 18:dd05ebdd2546 7 *
sam_grove 18:dd05ebdd2546 8 * http://www.apache.org/licenses/LICENSE-2.0
sam_grove 18:dd05ebdd2546 9 *
sam_grove 18:dd05ebdd2546 10 * Unless required by applicable law or agreed to in writing, software
sam_grove 18:dd05ebdd2546 11 * distributed under the License is distributed on an "AS IS" BASIS,
sam_grove 18:dd05ebdd2546 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
sam_grove 18:dd05ebdd2546 13 * See the License for the specific language governing permissions and
sam_grove 18:dd05ebdd2546 14 * limitations under the License.
sam_grove 18:dd05ebdd2546 15 */
sam_grove 18:dd05ebdd2546 16
sam_grove 18:dd05ebdd2546 17 #ifndef ETHERNETINTERFACE_H
sam_grove 18:dd05ebdd2546 18 #define ETHERNETINTERFACE_H
sam_grove 18:dd05ebdd2546 19
sam_grove 18:dd05ebdd2546 20 #include "NetworkInterface.h"
sam_grove 18:dd05ebdd2546 21
sam_grove 18:dd05ebdd2546 22 ///* wifi_security_t enum for encryption types
sam_grove 18:dd05ebdd2546 23 // */
sam_grove 18:dd05ebdd2546 24 //typedef enum wifi_security_t {
sam_grove 18:dd05ebdd2546 25 // WI_NONE = 0, /*!< No security for connection */
sam_grove 18:dd05ebdd2546 26 // WI_WEP, /*!< WEP encryption */
sam_grove 18:dd05ebdd2546 27 // WI_WPA, /*!< WPA encryption */
sam_grove 18:dd05ebdd2546 28 // WI_WPA2, /*!< WPA2 encryption */
sam_grove 18:dd05ebdd2546 29 //} wifi_security_t;
sam_grove 18:dd05ebdd2546 30
sam_grove 18:dd05ebdd2546 31 /** EthernetInterface class.
sam_grove 18:dd05ebdd2546 32 This is a common interface to handle how ethernet connects to a router
sam_grove 18:dd05ebdd2546 33 */
sam_grove 18:dd05ebdd2546 34 class EthernetInterface : public NetworkInterface
sam_grove 18:dd05ebdd2546 35 {
sam_grove 18:dd05ebdd2546 36 public:
sam_grove 18:dd05ebdd2546 37
sam_grove 18:dd05ebdd2546 38 // make sure to import the base symbol that needs an implementation for classes that have ap and phrase in the constructor
sam_grove 18:dd05ebdd2546 39 using NetworkInterface::connect;
sam_grove 18:dd05ebdd2546 40 };
sam_grove 18:dd05ebdd2546 41
sam_grove 18:dd05ebdd2546 42 #endif