modified by ohneta

Dependents:   HelloESP8266Interface_mine

Fork of NetworkSocketAPI by NetworkSocketAPI

Committer:
sam_grove
Date:
Wed Jun 17 20:56:15 2015 +0000
Revision:
7:b147c08301be
Parent:
2:ce08986b18b5
Child:
8:4b7f97a5597b
Create WiFi base with connection parameters

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sam_grove 0:d35446f60233 1 /* SocketInterface Base Class
sam_grove 0:d35446f60233 2 * Copyright (c) 2015 ARM Limited
sam_grove 0:d35446f60233 3 *
sam_grove 0:d35446f60233 4 * Licensed under the Apache License, Version 2.0 (the "License");
sam_grove 0:d35446f60233 5 * you may not use this file except in compliance with the License.
sam_grove 0:d35446f60233 6 * You may obtain a copy of the License at
sam_grove 0:d35446f60233 7 *
sam_grove 0:d35446f60233 8 * http://www.apache.org/licenses/LICENSE-2.0
sam_grove 0:d35446f60233 9 *
sam_grove 0:d35446f60233 10 * Unless required by applicable law or agreed to in writing, software
sam_grove 0:d35446f60233 11 * distributed under the License is distributed on an "AS IS" BASIS,
sam_grove 0:d35446f60233 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
sam_grove 0:d35446f60233 13 * See the License for the specific language governing permissions and
sam_grove 0:d35446f60233 14 * limitations under the License.
sam_grove 0:d35446f60233 15 */
sam_grove 0:d35446f60233 16
bridadan 1:291a9d61e58a 17 #ifndef SOCKETINTERFACE_H
bridadan 1:291a9d61e58a 18 #define SOCKETINTERFACE_H
bridadan 2:ce08986b18b5 19
bridadan 2:ce08986b18b5 20 /** SocketInterface class.
bridadan 2:ce08986b18b5 21 * This is a common interface that is shared between all sockets that connect
bridadan 2:ce08986b18b5 22 * using the NetworkInterface.
bridadan 2:ce08986b18b5 23 */
bridadan 1:291a9d61e58a 24 class SocketInterface {
bridadan 1:291a9d61e58a 25
bridadan 1:291a9d61e58a 26 public:
sam_grove 7:b147c08301be 27 // /** This enum defines the possible socket domain types.
sam_grove 7:b147c08301be 28 // */
sam_grove 7:b147c08301be 29 // typedef enum {
sam_grove 7:b147c08301be 30 // AF_INET, /*!< IPv4 */
sam_grove 7:b147c08301be 31 // AF_INET6, /*!< IPV6 */
sam_grove 7:b147c08301be 32 // AF_UNIX /*!< Local socket (using a file) */
sam_grove 7:b147c08301be 33 // } socket_domain_t;
sam_grove 7:b147c08301be 34 //
sam_grove 7:b147c08301be 35 // /** This enum defines the possible socket types.
sam_grove 7:b147c08301be 36 // */
sam_grove 7:b147c08301be 37 // typedef enum {
sam_grove 7:b147c08301be 38 // SOCK_STREAM, /*!< Reliable stream-oriented service or Stream Sockets */
sam_grove 7:b147c08301be 39 // SOCK_DGRAM, /**< Datagram service or Datagram Sockets */
sam_grove 7:b147c08301be 40 // SOCK_SEQPACKET, /*!< Reliable sequenced packet service */
sam_grove 7:b147c08301be 41 // SOCK_RAW /*!< Raw protocols atop the network layer */
sam_grove 7:b147c08301be 42 // } socket_type_t;
sam_grove 7:b147c08301be 43 //
sam_grove 7:b147c08301be 44 // /** This enum defines the ip protocols
sam_grove 7:b147c08301be 45 // */
sam_grove 7:b147c08301be 46 // typedef enum {
sam_grove 7:b147c08301be 47 // IPPROTO_TCP, /*!< Socket connection over TCP */
sam_grove 7:b147c08301be 48 // IPPROTO_UDP, /*!< Socket connection over UDP */
sam_grove 7:b147c08301be 49 // IPPROTO_SCTP /*!< Socket connection over SCTP */
sam_grove 7:b147c08301be 50 // IPPROTO_DCCP, /*!< Socket connection over DCCP */
sam_grove 7:b147c08301be 51 // } socket_type_t;
sam_grove 7:b147c08301be 52 //
sam_grove 7:b147c08301be 53 // /** Configure the socket's protocol and type.
sam_grove 7:b147c08301be 54 // @param protocol The protocol to use.
sam_grove 7:b147c08301be 55 // @param type The type of socket to use.
sam_grove 7:b147c08301be 56 // @returns 0 on success, a negative number on failure
sam_grove 7:b147c08301be 57 // */
sam_grove 7:b147c08301be 58 // virtual int32_t socket(socket_domain_t protocol, socket_type_t type, ) const = 0;
sam_grove 7:b147c08301be 59 //
sam_grove 7:b147c08301be 60 // /** Configure the socket's protocol and type.
sam_grove 7:b147c08301be 61 // @param protocol The protocol to use.
sam_grove 7:b147c08301be 62 // @param type The type of socket to use.
sam_grove 7:b147c08301be 63 // @returns 0 on success, a negative number on failure
sam_grove 7:b147c08301be 64 // */
sam_grove 7:b147c08301be 65 // virtual int bind(const struct sockaddr *my_addr, socklen_t addrlen);
sam_grove 7:b147c08301be 66 //
sam_grove 7:b147c08301be 67 // /**
sam_grove 7:b147c08301be 68 // * Set blocking or non-blocking mode of the socket and a timeout on
sam_grove 7:b147c08301be 69 // * blocking socket operations.
sam_grove 7:b147c08301be 70 // *
sam_grove 7:b147c08301be 71 // * @param blocking true for blocking mode, false for non-blocking mode.
sam_grove 7:b147c08301be 72 // * @param timeout timeout in ms [Default: (1500)ms].
sam_grove 7:b147c08301be 73 // */
sam_grove 7:b147c08301be 74 // virtual void setBlocking(bool blocking, unsigned int timeout=1500) = 0;
sam_grove 7:b147c08301be 75 //
sam_grove 7:b147c08301be 76 // /*
sam_grove 7:b147c08301be 77 // "options" functions here? Not familiar with this, need to discuss
sam_grove 7:b147c08301be 78 // */
sam_grove 7:b147c08301be 79 //
sam_grove 7:b147c08301be 80 // /**
sam_grove 7:b147c08301be 81 // * Close the socket
sam_grove 7:b147c08301be 82 // */
sam_grove 7:b147c08301be 83 // virtual void close();
bridadan 1:291a9d61e58a 84
bridadan 1:291a9d61e58a 85 };
bridadan 1:291a9d61e58a 86
bridadan 1:291a9d61e58a 87 #endif
sam_grove 0:d35446f60233 88