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:
geky
Date:
Fri Apr 15 16:06:01 2016 +0000
Revision:
71:9c351e105812
Added CellularInterface for Cellular devices

Who changed what in which revision?

UserRevisionLine numberNew contents of line
geky 71:9c351e105812 1 /* EthernetInterface Base Class
geky 71:9c351e105812 2 * Copyright (c) 2015 ARM Limited
geky 71:9c351e105812 3 *
geky 71:9c351e105812 4 * Licensed under the Apache License, Version 2.0 (the "License");
geky 71:9c351e105812 5 * you may not use this file except in compliance with the License.
geky 71:9c351e105812 6 * You may obtain a copy of the License at
geky 71:9c351e105812 7 *
geky 71:9c351e105812 8 * http://www.apache.org/licenses/LICENSE-2.0
geky 71:9c351e105812 9 *
geky 71:9c351e105812 10 * Unless required by applicable law or agreed to in writing, software
geky 71:9c351e105812 11 * distributed under the License is distributed on an "AS IS" BASIS,
geky 71:9c351e105812 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
geky 71:9c351e105812 13 * See the License for the specific language governing permissions and
geky 71:9c351e105812 14 * limitations under the License.
geky 71:9c351e105812 15 */
geky 71:9c351e105812 16
geky 71:9c351e105812 17 #ifndef CELLULAR_INTERFACE_H
geky 71:9c351e105812 18 #define CELLULAR_INTERFACE_H
geky 71:9c351e105812 19
geky 71:9c351e105812 20 #include "NetworkInterface.h"
geky 71:9c351e105812 21
geky 71:9c351e105812 22 /** CellularInterface class
geky 71:9c351e105812 23 * Common interface that is shared between ethernet hardware
geky 71:9c351e105812 24 */
geky 71:9c351e105812 25 class CellularInterface : public NetworkInterface
geky 71:9c351e105812 26 {
geky 71:9c351e105812 27 public:
geky 71:9c351e105812 28 /** Start the interface
geky 71:9c351e105812 29 * @param apn Optional name of the network to connect to
geky 71:9c351e105812 30 * @param username Optional username for your APN
geky 71:9c351e105812 31 * @param password Optional password for your APN
geky 71:9c351e105812 32 * @return 0 on success
geky 71:9c351e105812 33 */
geky 71:9c351e105812 34 virtual int32_t connect(const char *apn = 0, const char *username = 0, const char *password = 0) = 0;
geky 71:9c351e105812 35
geky 71:9c351e105812 36 /** Stop the interface
geky 71:9c351e105812 37 * @return 0 on success
geky 71:9c351e105812 38 */
geky 71:9c351e105812 39 virtual int32_t disconnect() = 0;
geky 71:9c351e105812 40 };
geky 71:9c351e105812 41
geky 71:9c351e105812 42 #endif