cc3100_Socket_Wifi_Server with Ethernet Interface not working
Dependencies: EthernetInterface mbed-rtos mbed
Fork of cc3100_Test_Demo by
simplelink/cc3100_socket.h@0:e89ba455dbcf, 2015-02-10 (annotated)
- Committer:
- dflet
- Date:
- Tue Feb 10 12:09:29 2015 +0000
- Revision:
- 0:e89ba455dbcf
For test only! Not much has been tested, but the 2 demo apps run ok. Alot more work needs to be done!
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dflet | 0:e89ba455dbcf | 1 | /* |
dflet | 0:e89ba455dbcf | 2 | * socket.h - CC31xx/CC32xx Host Driver Implementation |
dflet | 0:e89ba455dbcf | 3 | * |
dflet | 0:e89ba455dbcf | 4 | * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ |
dflet | 0:e89ba455dbcf | 5 | * |
dflet | 0:e89ba455dbcf | 6 | * |
dflet | 0:e89ba455dbcf | 7 | * Redistribution and use in source and binary forms, with or without |
dflet | 0:e89ba455dbcf | 8 | * modification, are permitted provided that the following conditions |
dflet | 0:e89ba455dbcf | 9 | * are met: |
dflet | 0:e89ba455dbcf | 10 | * |
dflet | 0:e89ba455dbcf | 11 | * Redistributions of source code must retain the above copyright |
dflet | 0:e89ba455dbcf | 12 | * notice, this list of conditions and the following disclaimer. |
dflet | 0:e89ba455dbcf | 13 | * |
dflet | 0:e89ba455dbcf | 14 | * Redistributions in binary form must reproduce the above copyright |
dflet | 0:e89ba455dbcf | 15 | * notice, this list of conditions and the following disclaimer in the |
dflet | 0:e89ba455dbcf | 16 | * documentation and/or other materials provided with the |
dflet | 0:e89ba455dbcf | 17 | * distribution. |
dflet | 0:e89ba455dbcf | 18 | * |
dflet | 0:e89ba455dbcf | 19 | * Neither the name of Texas Instruments Incorporated nor the names of |
dflet | 0:e89ba455dbcf | 20 | * its contributors may be used to endorse or promote products derived |
dflet | 0:e89ba455dbcf | 21 | * from this software without specific prior written permission. |
dflet | 0:e89ba455dbcf | 22 | * |
dflet | 0:e89ba455dbcf | 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
dflet | 0:e89ba455dbcf | 24 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
dflet | 0:e89ba455dbcf | 25 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
dflet | 0:e89ba455dbcf | 26 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
dflet | 0:e89ba455dbcf | 27 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
dflet | 0:e89ba455dbcf | 28 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
dflet | 0:e89ba455dbcf | 29 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
dflet | 0:e89ba455dbcf | 30 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
dflet | 0:e89ba455dbcf | 31 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
dflet | 0:e89ba455dbcf | 32 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
dflet | 0:e89ba455dbcf | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
dflet | 0:e89ba455dbcf | 34 | * |
dflet | 0:e89ba455dbcf | 35 | */ |
dflet | 0:e89ba455dbcf | 36 | |
dflet | 0:e89ba455dbcf | 37 | #ifndef SL_SOCKET_H_ |
dflet | 0:e89ba455dbcf | 38 | #define SL_SOCKET_H_ |
dflet | 0:e89ba455dbcf | 39 | |
dflet | 0:e89ba455dbcf | 40 | /*****************************************************************************/ |
dflet | 0:e89ba455dbcf | 41 | /* Include files */ |
dflet | 0:e89ba455dbcf | 42 | /*****************************************************************************/ |
dflet | 0:e89ba455dbcf | 43 | #include "cc3100_simplelink.h" |
dflet | 0:e89ba455dbcf | 44 | #include "cc3100_protocol.h" |
dflet | 0:e89ba455dbcf | 45 | |
dflet | 0:e89ba455dbcf | 46 | namespace mbed_cc3100 { |
dflet | 0:e89ba455dbcf | 47 | |
dflet | 0:e89ba455dbcf | 48 | //#include "cc3100_driver.h" |
dflet | 0:e89ba455dbcf | 49 | |
dflet | 0:e89ba455dbcf | 50 | /*! |
dflet | 0:e89ba455dbcf | 51 | |
dflet | 0:e89ba455dbcf | 52 | \addtogroup socket |
dflet | 0:e89ba455dbcf | 53 | @{ |
dflet | 0:e89ba455dbcf | 54 | |
dflet | 0:e89ba455dbcf | 55 | */ |
dflet | 0:e89ba455dbcf | 56 | |
dflet | 0:e89ba455dbcf | 57 | /*****************************************************************************/ |
dflet | 0:e89ba455dbcf | 58 | /* Macro declarations */ |
dflet | 0:e89ba455dbcf | 59 | /*****************************************************************************/ |
dflet | 0:e89ba455dbcf | 60 | |
dflet | 0:e89ba455dbcf | 61 | const uint8_t SL_FD_SETSIZE = SL_MAX_SOCKETS; /* Number of sockets to select on - same is max sockets! */ |
dflet | 0:e89ba455dbcf | 62 | const uint8_t BSD_SOCKET_ID_MASK = (0x0F); /* Index using the LBS 4 bits for socket id 0-7 */ |
dflet | 0:e89ba455dbcf | 63 | /* Define some BSD protocol constants. */ |
dflet | 0:e89ba455dbcf | 64 | const uint8_t SL_SOCK_STREAM = (1); /* TCP Socket */ |
dflet | 0:e89ba455dbcf | 65 | const uint8_t SL_SOCK_DGRAM = (2); /* UDP Socket */ |
dflet | 0:e89ba455dbcf | 66 | const uint8_t SL_SOCK_RAW = (3); /* Raw socket */ |
dflet | 0:e89ba455dbcf | 67 | const uint8_t SL_IPPROTO_TCP = (6); /* TCP Raw Socket */ |
dflet | 0:e89ba455dbcf | 68 | const uint8_t SL_IPPROTO_UDP = (17); /* UDP Raw Socket */ |
dflet | 0:e89ba455dbcf | 69 | const uint8_t SL_IPPROTO_RAW = (255); /* Raw Socket */ |
dflet | 0:e89ba455dbcf | 70 | const uint8_t SL_SEC_SOCKET = (100); /* Secured Socket Layer (SSL,TLS) */ |
dflet | 0:e89ba455dbcf | 71 | |
dflet | 0:e89ba455dbcf | 72 | /* Address families. */ |
dflet | 0:e89ba455dbcf | 73 | const uint8_t SL_AF_INET = (2); /* IPv4 socket (UDP, TCP, etc) */ |
dflet | 0:e89ba455dbcf | 74 | const uint8_t SL_AF_INET6 = (3); /* IPv6 socket (UDP, TCP, etc) */ |
dflet | 0:e89ba455dbcf | 75 | const uint8_t SL_AF_INET6_EUI_48 = (9); |
dflet | 0:e89ba455dbcf | 76 | const uint8_t AF_INET = SL_AF_INET; |
dflet | 0:e89ba455dbcf | 77 | const uint8_t AF_INET6 = SL_AF_INET6; |
dflet | 0:e89ba455dbcf | 78 | const uint8_t SL_AF_RF = (6); /* data include RF parameter, All layer by user (Wifi could be disconnected) */ |
dflet | 0:e89ba455dbcf | 79 | const uint8_t SL_AF_PACKET = (17); |
dflet | 0:e89ba455dbcf | 80 | /* Protocol families, same as address families. */ |
dflet | 0:e89ba455dbcf | 81 | const uint8_t SL_PF_INET = AF_INET; |
dflet | 0:e89ba455dbcf | 82 | const uint8_t SL_PF_INET6 = AF_INET6; |
dflet | 0:e89ba455dbcf | 83 | const uint8_t SL_INADDR_ANY = (0); /* bind any address */ |
dflet | 0:e89ba455dbcf | 84 | |
dflet | 0:e89ba455dbcf | 85 | /* error codes */ |
dflet | 0:e89ba455dbcf | 86 | const int8_t SL_SOC_ERROR = (-1); /* Failure. */ |
dflet | 0:e89ba455dbcf | 87 | const int8_t SL_SOC_OK = ( 0); /* Success. */ |
dflet | 0:e89ba455dbcf | 88 | const int8_t SL_INEXE = (-8); /* socket command in execution */ |
dflet | 0:e89ba455dbcf | 89 | const int8_t SL_EBADF = (-9); /* Bad file number */ |
dflet | 0:e89ba455dbcf | 90 | const int8_t SL_ENSOCK = (-10); /* The system limit on the total number of open socket, has been reached */ |
dflet | 0:e89ba455dbcf | 91 | const int8_t SL_EAGAIN = (-11); /* Try again */ |
dflet | 0:e89ba455dbcf | 92 | const int8_t SL_EWOULDBLOCK = SL_EAGAIN; |
dflet | 0:e89ba455dbcf | 93 | const int8_t SL_ENOMEM = (-12); /* Out of memory */ |
dflet | 0:e89ba455dbcf | 94 | const int8_t SL_EACCES = (-13); /* Permission denied */ |
dflet | 0:e89ba455dbcf | 95 | const int8_t SL_EFAULT = (-14); /* Bad address */ |
dflet | 0:e89ba455dbcf | 96 | const int8_t SL_ECLOSE = (-15); /* close socket operation failed to transmit all queued packets */ |
dflet | 0:e89ba455dbcf | 97 | const int8_t SL_EALREADY_ENABLED = (-21); /* Transceiver - Transceiver already ON. there could be only one */ |
dflet | 0:e89ba455dbcf | 98 | const int8_t SL_EINVAL = (-22); /* Invalid argument */ |
dflet | 0:e89ba455dbcf | 99 | const int8_t SL_EAUTO_CONNECT_OR_CONNECTING = (-69); /* Transceiver - During connection, connected or auto mode started */ |
dflet | 0:e89ba455dbcf | 100 | const int8_t SL_CONNECTION_PENDING = (-72); /* Transceiver - Device is connected, disconnect first to open transceiver */ |
dflet | 0:e89ba455dbcf | 101 | const int8_t SL_EUNSUPPORTED_ROLE = (-86); /* Transceiver - Trying to start when WLAN role is AP or P2P GO */ |
dflet | 0:e89ba455dbcf | 102 | const int8_t SL_EDESTADDRREQ = (-89); /* Destination address required */ |
dflet | 0:e89ba455dbcf | 103 | const int8_t SL_EPROTOTYPE = (-91); /* Protocol wrong type for socket */ |
dflet | 0:e89ba455dbcf | 104 | const int8_t SL_ENOPROTOOPT = (-92); /* Protocol not available */ |
dflet | 0:e89ba455dbcf | 105 | const int8_t SL_EPROTONOSUPPORT = (-93); /* Protocol not supported */ |
dflet | 0:e89ba455dbcf | 106 | const int8_t SL_ESOCKTNOSUPPORT = (-94); /* Socket type not supported */ |
dflet | 0:e89ba455dbcf | 107 | const int8_t SL_EOPNOTSUPP = (-95); /* Operation not supported on transport endpoint */ |
dflet | 0:e89ba455dbcf | 108 | const int8_t SL_EAFNOSUPPORT = (-97); /* Address family not supported by protocol */ |
dflet | 0:e89ba455dbcf | 109 | const int8_t SL_EADDRINUSE = (-98); /* Address already in use */ |
dflet | 0:e89ba455dbcf | 110 | const int8_t SL_EADDRNOTAVAIL = (-99); /* Cannot assign requested address */ |
dflet | 0:e89ba455dbcf | 111 | const int8_t SL_ENETUNREACH = (-101); /* Network is unreachable */ |
dflet | 0:e89ba455dbcf | 112 | const int8_t SL_ENOBUFS = (-105); /* No buffer space available */ |
dflet | 0:e89ba455dbcf | 113 | const int8_t SL_EOBUFF = SL_ENOBUFS; |
dflet | 0:e89ba455dbcf | 114 | const int8_t SL_EISCONN = (-106); /* Transport endpoint is already connected */ |
dflet | 0:e89ba455dbcf | 115 | const int8_t SL_ENOTCONN = (-107); /* Transport endpoint is not connected */ |
dflet | 0:e89ba455dbcf | 116 | const int8_t SL_ETIMEDOUT = (-110); /* Connection timed out */ |
dflet | 0:e89ba455dbcf | 117 | const int8_t SL_ECONNREFUSED = (-111); /* Connection refused */ |
dflet | 0:e89ba455dbcf | 118 | const int8_t SL_EALREADY = (-114); /* Non blocking connect in progress, try again */ |
dflet | 0:e89ba455dbcf | 119 | |
dflet | 0:e89ba455dbcf | 120 | const int16_t SL_ESEC_RSA_WRONG_TYPE_E = (-130); /* RSA wrong block type for RSA function */ |
dflet | 0:e89ba455dbcf | 121 | const int16_t SL_ESEC_RSA_BUFFER_E = (-131); /* RSA buffer error, output too small or */ |
dflet | 0:e89ba455dbcf | 122 | const int16_t SL_ESEC_BUFFER_E = (-132); /* output buffer too small or input too large */ |
dflet | 0:e89ba455dbcf | 123 | const int16_t SL_ESEC_ALGO_ID_E = (-133); /* setting algo id error */ |
dflet | 0:e89ba455dbcf | 124 | const int16_t SL_ESEC_PUBLIC_KEY_E = (-134); /* setting public key error */ |
dflet | 0:e89ba455dbcf | 125 | const int16_t SL_ESEC_DATE_E = (-135); /* setting date validity error */ |
dflet | 0:e89ba455dbcf | 126 | const int16_t SL_ESEC_SUBJECT_E = (-136); /* setting subject name error */ |
dflet | 0:e89ba455dbcf | 127 | const int16_t SL_ESEC_ISSUER_E = (-137); /* setting issuer name error */ |
dflet | 0:e89ba455dbcf | 128 | const int16_t SL_ESEC_CA_TRUE_E = (-138); /* setting CA basic constraint true error */ |
dflet | 0:e89ba455dbcf | 129 | const int16_t SL_ESEC_EXTENSIONS_E = (-139); /* setting extensions error */ |
dflet | 0:e89ba455dbcf | 130 | const int16_t SL_ESEC_ASN_PARSE_E = (-140); /* ASN parsing error, invalid input */ |
dflet | 0:e89ba455dbcf | 131 | const int16_t SL_ESEC_ASN_VERSION_E = (-141); /* ASN version error, invalid number */ |
dflet | 0:e89ba455dbcf | 132 | const int16_t SL_ESEC_ASN_GETINT_E = (-142); /* ASN get big int16_t error, invalid data */ |
dflet | 0:e89ba455dbcf | 133 | const int16_t SL_ESEC_ASN_RSA_KEY_E = (-143); /* ASN key init error, invalid input */ |
dflet | 0:e89ba455dbcf | 134 | const int16_t SL_ESEC_ASN_OBJECT_ID_E = (-144); /* ASN object id error, invalid id */ |
dflet | 0:e89ba455dbcf | 135 | const int16_t SL_ESEC_ASN_TAG_NULL_E = (-145); /* ASN tag error, not null */ |
dflet | 0:e89ba455dbcf | 136 | const int16_t SL_ESEC_ASN_EXPECT_0_E = (-146); /* ASN expect error, not zero */ |
dflet | 0:e89ba455dbcf | 137 | const int16_t SL_ESEC_ASN_BITSTR_E = (-147); /* ASN bit string error, wrong id */ |
dflet | 0:e89ba455dbcf | 138 | const int16_t SL_ESEC_ASN_UNKNOWN_OID_E = (-148); /* ASN oid error, unknown sum id */ |
dflet | 0:e89ba455dbcf | 139 | const int16_t SL_ESEC_ASN_DATE_SZ_E = (-149); /* ASN date error, bad size */ |
dflet | 0:e89ba455dbcf | 140 | const int16_t SL_ESEC_ASN_BEFORE_DATE_E = (-150); /* ASN date error, current date before */ |
dflet | 0:e89ba455dbcf | 141 | const int16_t SL_ESEC_ASN_AFTER_DATE_E = (-151); /* ASN date error, current date after */ |
dflet | 0:e89ba455dbcf | 142 | const int16_t SL_ESEC_ASN_SIG_OID_E = (-152); /* ASN signature error, mismatched oid */ |
dflet | 0:e89ba455dbcf | 143 | const int16_t SL_ESEC_ASN_TIME_E = (-153); /* ASN time error, unknown time type */ |
dflet | 0:e89ba455dbcf | 144 | const int16_t SL_ESEC_ASN_INPUT_E = (-154); /* ASN input error, not enough data */ |
dflet | 0:e89ba455dbcf | 145 | const int16_t SL_ESEC_ASN_SIG_CONFIRM_E = (-155); /* ASN sig error, confirm failure */ |
dflet | 0:e89ba455dbcf | 146 | const int16_t SL_ESEC_ASN_SIG_HASH_E = (-156); /* ASN sig error, unsupported hash type */ |
dflet | 0:e89ba455dbcf | 147 | const int16_t SL_ESEC_ASN_SIG_KEY_E = (-157); /* ASN sig error, unsupported key type */ |
dflet | 0:e89ba455dbcf | 148 | const int16_t SL_ESEC_ASN_DH_KEY_E = (-158); /* ASN key init error, invalid input */ |
dflet | 0:e89ba455dbcf | 149 | const int16_t SL_ESEC_ASN_NTRU_KEY_E = (-159); /* ASN ntru key decode error, invalid input */ |
dflet | 0:e89ba455dbcf | 150 | const int16_t SL_ESEC_ECC_BAD_ARG_E = (-170); /* ECC input argument of wrong type */ |
dflet | 0:e89ba455dbcf | 151 | const int16_t SL_ESEC_ASN_ECC_KEY_E = (-171); /* ASN ECC bad input */ |
dflet | 0:e89ba455dbcf | 152 | const int16_t SL_ESEC_ECC_CURVE_OID_E = (-172); /* Unsupported ECC OID curve type */ |
dflet | 0:e89ba455dbcf | 153 | const int16_t SL_ESEC_BAD_FUNC_ARG = (-173); /* Bad function argument provided */ |
dflet | 0:e89ba455dbcf | 154 | const int16_t SL_ESEC_NOT_COMPILED_IN = (-174); /* Feature not compiled in */ |
dflet | 0:e89ba455dbcf | 155 | const int16_t SL_ESEC_UNICODE_SIZE_E = (-175); /* Unicode password too big */ |
dflet | 0:e89ba455dbcf | 156 | const int16_t SL_ESEC_NO_PASSWORD = (-176); /* no password provided by user */ |
dflet | 0:e89ba455dbcf | 157 | const int16_t SL_ESEC_ALT_NAME_E = (-177); /* alt name size problem, too big */ |
dflet | 0:e89ba455dbcf | 158 | const int16_t SL_ESEC_AES_GCM_AUTH_E = (-180); /* AES-GCM Authentication check failure */ |
dflet | 0:e89ba455dbcf | 159 | const int16_t SL_ESEC_AES_CCM_AUTH_E = (-181); /* AES-CCM Authentication check failure */ |
dflet | 0:e89ba455dbcf | 160 | /* ssl tls security start with -300 offset */ |
dflet | 0:e89ba455dbcf | 161 | const int16_t SL_ESEC_CLOSE_NOTIFY = (-300); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 162 | const int16_t SL_ESEC_UNEXPECTED_MESSAGE = (-310); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 163 | const int16_t SL_ESEC_BAD_RECORD_MAC = (-320); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 164 | const int16_t SL_ESEC_DECRYPTION_FAILED = (-321); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 165 | const int16_t SL_ESEC_RECORD_OVERFLOW = (-322); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 166 | const int16_t SL_ESEC_DECOMPRESSION_FAILURE = (-330); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 167 | const int16_t SL_ESEC_HANDSHAKE_FAILURE = (-340); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 168 | const int16_t SL_ESEC_NO_CERTIFICATE = (-341); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 169 | const int16_t SL_ESEC_BAD_CERTIFICATE = (-342); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 170 | const int16_t SL_ESEC_UNSUPPORTED_CERTIFICATE = (-343); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 171 | const int16_t SL_ESEC_CERTIFICATE_REVOKED = (-344); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 172 | const int16_t SL_ESEC_CERTIFICATE_EXPIRED = (-345); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 173 | const int16_t SL_ESEC_CERTIFICATE_UNKNOWN = (-346); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 174 | const int16_t SL_ESEC_ILLEGAL_PARAMETER = (-347); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 175 | const int16_t SL_ESEC_UNKNOWN_CA = (-348); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 176 | const int16_t SL_ESEC_ACCESS_DENIED = (-349); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 177 | const int16_t SL_ESEC_DECODE_ERROR = (-350); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 178 | const int16_t SL_ESEC_DECRYPT_ERROR = (-351); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 179 | const int16_t SL_ESEC_EXPORT_RESTRICTION = (-360); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 180 | const int16_t SL_ESEC_PROTOCOL_VERSION = (-370); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 181 | const int16_t SL_ESEC_INSUFFICIENT_SECURITY = (-371); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 182 | const int16_t SL_ESEC_INTERNAL_ERROR = (-380); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 183 | const int16_t SL_ESEC_USER_CANCELLED = (-390); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 184 | const int16_t SL_ESEC_NO_RENEGOTIATION = (-400); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 185 | const int16_t SL_ESEC_UNSUPPORTED_EXTENSION = (-410); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 186 | const int16_t SL_ESEC_CERTIFICATE_UNOBTAINABLE = (-411); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 187 | const int16_t SL_ESEC_UNRECOGNIZED_NAME = (-412); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 188 | const int16_t SL_ESEC_BAD_CERTIFICATE_STATUS_RESPONSE = (-413); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 189 | const int16_t SL_ESEC_BAD_CERTIFICATE_HASH_VALUE = (-414); /* ssl/tls alerts */ |
dflet | 0:e89ba455dbcf | 190 | /* propierty secure */ |
dflet | 0:e89ba455dbcf | 191 | const int16_t SL_ESECGENERAL = (-450); /* error secure level general error */ |
dflet | 0:e89ba455dbcf | 192 | const int16_t SL_ESECDECRYPT = (-451); /* error secure level, decrypt recv packet fail */ |
dflet | 0:e89ba455dbcf | 193 | const int16_t SL_ESECCLOSED = (-452); /* secure layrer is closed by other size , tcp is still connected */ |
dflet | 0:e89ba455dbcf | 194 | const int16_t SL_ESECSNOVERIFY = (-453); /* Connected without server verification */ |
dflet | 0:e89ba455dbcf | 195 | const int16_t SL_ESECNOCAFILE = (-454); /* error secure level CA file not found*/ |
dflet | 0:e89ba455dbcf | 196 | const int16_t SL_ESECMEMORY = (-455); /* error secure level No memory space available */ |
dflet | 0:e89ba455dbcf | 197 | const int16_t SL_ESECBADCAFILE = (-456); /* error secure level bad CA file */ |
dflet | 0:e89ba455dbcf | 198 | const int16_t SL_ESECBADCERTFILE = (-457); /* error secure level bad Certificate file */ |
dflet | 0:e89ba455dbcf | 199 | const int16_t SL_ESECBADPRIVATEFILE = (-458); /* error secure level bad private file */ |
dflet | 0:e89ba455dbcf | 200 | const int16_t SL_ESECBADDHFILE = (-459); /* error secure level bad DH file */ |
dflet | 0:e89ba455dbcf | 201 | const int16_t SL_ESECT00MANYSSLOPENED = (-460); /* MAX SSL Sockets are opened */ |
dflet | 0:e89ba455dbcf | 202 | const int16_t SL_ESECDATEERROR = (-461); /* connected with certificate date verification error */ |
dflet | 0:e89ba455dbcf | 203 | const int16_t SL_ESECHANDSHAKETIMEDOUT = (-462); /* connection timed out due to handshake time */ |
dflet | 0:e89ba455dbcf | 204 | |
dflet | 0:e89ba455dbcf | 205 | /* end error codes */ |
dflet | 0:e89ba455dbcf | 206 | |
dflet | 0:e89ba455dbcf | 207 | /* Max payload size by protocol */ |
dflet | 0:e89ba455dbcf | 208 | const uint8_t SL_SOCKET_PAYLOAD_TYPE_MASK = (0xF0); /*4 bits type, 4 bits sockets id */ |
dflet | 0:e89ba455dbcf | 209 | const uint8_t SL_SOCKET_PAYLOAD_TYPE_UDP_IPV4 = (0x00); /* 1472 bytes */ |
dflet | 0:e89ba455dbcf | 210 | const uint8_t SL_SOCKET_PAYLOAD_TYPE_TCP_IPV4 = (0x10); /* 1460 bytes */ |
dflet | 0:e89ba455dbcf | 211 | const uint8_t SL_SOCKET_PAYLOAD_TYPE_UDP_IPV6 = (0x20); /* 1452 bytes */ |
dflet | 0:e89ba455dbcf | 212 | const uint8_t SL_SOCKET_PAYLOAD_TYPE_TCP_IPV6 = (0x30); /* 1440 bytes */ |
dflet | 0:e89ba455dbcf | 213 | const uint8_t SL_SOCKET_PAYLOAD_TYPE_UDP_IPV4_SECURE =(0x40); /* */ |
dflet | 0:e89ba455dbcf | 214 | const uint8_t SL_SOCKET_PAYLOAD_TYPE_TCP_IPV4_SECURE =(0x50); /* */ |
dflet | 0:e89ba455dbcf | 215 | const uint8_t SL_SOCKET_PAYLOAD_TYPE_UDP_IPV6_SECURE =(0x60); /* */ |
dflet | 0:e89ba455dbcf | 216 | const uint8_t SL_SOCKET_PAYLOAD_TYPE_TCP_IPV6_SECURE =(0x70); /* */ |
dflet | 0:e89ba455dbcf | 217 | const uint8_t SL_SOCKET_PAYLOAD_TYPE_RAW_TRANCEIVER =(0x80); /* 1536 bytes */ |
dflet | 0:e89ba455dbcf | 218 | const uint8_t SL_SOCKET_PAYLOAD_TYPE_RAW_PACKET = (0x90); /* 1536 bytes */ |
dflet | 0:e89ba455dbcf | 219 | const uint8_t SL_SOCKET_PAYLOAD_TYPE_RAW_IP4 = (0xa0); |
dflet | 0:e89ba455dbcf | 220 | const uint8_t SL_SOCKET_PAYLOAD_TYPE_RAW_IP6 = (SL_SOCKET_PAYLOAD_TYPE_RAW_IP4 ); |
dflet | 0:e89ba455dbcf | 221 | |
dflet | 0:e89ba455dbcf | 222 | |
dflet | 0:e89ba455dbcf | 223 | |
dflet | 0:e89ba455dbcf | 224 | const uint8_t SL_SOL_SOCKET = (1); /* Define the socket option category. */ |
dflet | 0:e89ba455dbcf | 225 | const uint8_t SL_IPPROTO_IP = (2); /* Define the IP option category. */ |
dflet | 0:e89ba455dbcf | 226 | const uint8_t SL_SOL_PHY_OPT = (3); /* Define the PHY option category. */ |
dflet | 0:e89ba455dbcf | 227 | |
dflet | 0:e89ba455dbcf | 228 | const uint8_t SL_SO_RCVBUF = (8); /* Setting TCP receive buffer size */ |
dflet | 0:e89ba455dbcf | 229 | const uint8_t SL_SO_KEEPALIVE = (9); /* Connections are kept alive with periodic messages */ |
dflet | 0:e89ba455dbcf | 230 | const uint8_t SL_SO_RCVTIMEO = (20); /* Enable receive timeout */ |
dflet | 0:e89ba455dbcf | 231 | const uint8_t SL_SO_NONBLOCKING = (24); /* Enable . disable nonblocking mode */ |
dflet | 0:e89ba455dbcf | 232 | const uint8_t SL_SO_SECMETHOD = (25); /* security metohd */ |
dflet | 0:e89ba455dbcf | 233 | const uint8_t SL_SO_SECURE_MASK = (26); /* security mask */ |
dflet | 0:e89ba455dbcf | 234 | const uint8_t SL_SO_SECURE_FILES = (27); /* security files */ |
dflet | 0:e89ba455dbcf | 235 | const uint8_t SL_SO_CHANGE_CHANNEL = (28); /* This option is available only when transceiver started */ |
dflet | 0:e89ba455dbcf | 236 | const uint8_t SL_SO_SECURE_FILES_PRIVATE_KEY_FILE_NAME =(30); /* This option used to configue secure file */ |
dflet | 0:e89ba455dbcf | 237 | const uint8_t SL_SO_SECURE_FILES_CERTIFICATE_FILE_NAME =(31); /* This option used to configue secure file */ |
dflet | 0:e89ba455dbcf | 238 | const uint8_t SL_SO_SECURE_FILES_CA_FILE_NAME = (32); /* This option used to configue secure file */ |
dflet | 0:e89ba455dbcf | 239 | const uint8_t SL_SO_SECURE_FILES_DH_KEY_FILE_NAME = (33); /* This option used to configue secure file */ |
dflet | 0:e89ba455dbcf | 240 | |
dflet | 0:e89ba455dbcf | 241 | const uint8_t SL_IP_MULTICAST_IF = (60); /* Specify outgoing multicast interface */ |
dflet | 0:e89ba455dbcf | 242 | const uint8_t SL_IP_MULTICAST_TTL = (61); /* Specify the TTL value to use for outgoing multicast packet. */ |
dflet | 0:e89ba455dbcf | 243 | const uint8_t SL_IP_ADD_MEMBERSHIP = (65); /* Join IPv4 multicast membership */ |
dflet | 0:e89ba455dbcf | 244 | const uint8_t SL_IP_DROP_MEMBERSHIP= (66); /* Leave IPv4 multicast membership */ |
dflet | 0:e89ba455dbcf | 245 | const uint8_t SL_IP_HDRINCL = (67); /* Raw socket IPv4 header included. */ |
dflet | 0:e89ba455dbcf | 246 | const uint8_t SL_IP_RAW_RX_NO_HEADER =(68); /* Proprietary socket option that does not includeIPv4/IPv6 header (and extension headers) on received raw sockets*/ |
dflet | 0:e89ba455dbcf | 247 | const uint8_t SL_IP_RAW_IPV6_HDRINCL =(69); /* Transmitted buffer over IPv6 socket contains IPv6 header. */ |
dflet | 0:e89ba455dbcf | 248 | |
dflet | 0:e89ba455dbcf | 249 | const uint8_t SL_SO_PHY_RATE = (100); /* WLAN Transmit rate */ |
dflet | 0:e89ba455dbcf | 250 | const uint8_t SL_SO_PHY_TX_POWER = (101); /* TX Power level */ |
dflet | 0:e89ba455dbcf | 251 | const uint8_t SL_SO_PHY_NUM_FRAMES_TO_TX = (102); /* Number of frames to transmit */ |
dflet | 0:e89ba455dbcf | 252 | const uint8_t SL_SO_PHY_PREAMBLE = (103); /* Preamble for transmission */ |
dflet | 0:e89ba455dbcf | 253 | |
dflet | 0:e89ba455dbcf | 254 | const uint8_t SL_SO_SEC_METHOD_SSLV3 = (0); /* security metohd SSL v3*/ |
dflet | 0:e89ba455dbcf | 255 | const uint8_t SL_SO_SEC_METHOD_TLSV1 = (1); /* security metohd TLS v1*/ |
dflet | 0:e89ba455dbcf | 256 | const uint8_t SL_SO_SEC_METHOD_TLSV1_1 = (2); /* security metohd TLS v1_1*/ |
dflet | 0:e89ba455dbcf | 257 | const uint8_t SL_SO_SEC_METHOD_TLSV1_2 = (3); /* security metohd TLS v1_2*/ |
dflet | 0:e89ba455dbcf | 258 | const uint8_t SL_SO_SEC_METHOD_SSLv3_TLSV1_2 = (4); /* use highest possible version from SSLv3 - TLS 1.2*/ |
dflet | 0:e89ba455dbcf | 259 | const uint8_t SL_SO_SEC_METHOD_DLSV1 = (5); /* security metohd DTL v1 */ |
dflet | 0:e89ba455dbcf | 260 | |
dflet | 0:e89ba455dbcf | 261 | #define SL_SEC_MASK_SSL_RSA_WITH_RC4_128_SHA (1 << 0) |
dflet | 0:e89ba455dbcf | 262 | #define SL_SEC_MASK_SSL_RSA_WITH_RC4_128_MD5 (1 << 1) |
dflet | 0:e89ba455dbcf | 263 | #define SL_SEC_MASK_TLS_RSA_WITH_AES_256_CBC_SHA (1 << 2) |
dflet | 0:e89ba455dbcf | 264 | #define SL_SEC_MASK_TLS_DHE_RSA_WITH_AES_256_CBC_SHA (1 << 3) |
dflet | 0:e89ba455dbcf | 265 | #define SL_SEC_MASK_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (1 << 4) |
dflet | 0:e89ba455dbcf | 266 | #define SL_SEC_MASK_TLS_ECDHE_RSA_WITH_RC4_128_SHA (1 << 5) |
dflet | 0:e89ba455dbcf | 267 | #define SL_SEC_MASK_SECURE_DEFAULT ((SL_SEC_MASK_TLS_ECDHE_RSA_WITH_RC4_128_SHA << 1) - 1) /*Is this var name correct? was SEC_MASK_TLS_ECDHE_RSA_WITH_RC4_128_SHA*/ |
dflet | 0:e89ba455dbcf | 268 | |
dflet | 0:e89ba455dbcf | 269 | const uint32_t SL_MSG_DONTWAIT = (0x00000008); /* Nonblocking IO */ |
dflet | 0:e89ba455dbcf | 270 | |
dflet | 0:e89ba455dbcf | 271 | /* AP DHCP Server - IP Release reason code */ |
dflet | 0:e89ba455dbcf | 272 | const uint8_t SL_IP_LEASE_PEER_RELEASE = (0); |
dflet | 0:e89ba455dbcf | 273 | const uint8_t SL_IP_LEASE_PEER_DECLINE = (1); |
dflet | 0:e89ba455dbcf | 274 | const uint8_t SL_IP_LEASE_EXPIRED = (2); |
dflet | 0:e89ba455dbcf | 275 | |
dflet | 0:e89ba455dbcf | 276 | /* possible types when receiving SL_SOCKET_ASYNC_EVENT*/ |
dflet | 0:e89ba455dbcf | 277 | const uint8_t SSL_ACCEPT = (1); /* accept failed due to ssl issue ( tcp pass) */ |
dflet | 0:e89ba455dbcf | 278 | const uint8_t RX_FRAGMENTATION_TOO_BIG = (2); /* connection less mode, rx packet fragmentation > 16K, packet is being released */ |
dflet | 0:e89ba455dbcf | 279 | const uint8_t OTHER_SIDE_CLOSE_SSL_DATA_NOT_ENCRYPTED = (3); /* remote side down from secure to unsecure */ |
dflet | 0:e89ba455dbcf | 280 | |
dflet | 0:e89ba455dbcf | 281 | |
dflet | 0:e89ba455dbcf | 282 | |
dflet | 0:e89ba455dbcf | 283 | #ifdef SL_INC_STD_BSD_API_NAMING |
dflet | 0:e89ba455dbcf | 284 | |
dflet | 0:e89ba455dbcf | 285 | #define FD_SETSIZE SL_FD_SETSIZE |
dflet | 0:e89ba455dbcf | 286 | |
dflet | 0:e89ba455dbcf | 287 | #define SOCK_STREAM SL_SOCK_STREAM |
dflet | 0:e89ba455dbcf | 288 | #define SOCK_DGRAM SL_SOCK_DGRAM |
dflet | 0:e89ba455dbcf | 289 | #define SOCK_RAW SL_SOCK_RAW |
dflet | 0:e89ba455dbcf | 290 | #define IPPROTO_TCP SL_IPPROTO_TCP |
dflet | 0:e89ba455dbcf | 291 | #define IPPROTO_UDP SL_IPPROTO_UDP |
dflet | 0:e89ba455dbcf | 292 | #define IPPROTO_RAW SL_IPPROTO_RAW |
dflet | 0:e89ba455dbcf | 293 | |
dflet | 0:e89ba455dbcf | 294 | #define AF_INET6_EUI_48 SL_AF_INET6_EUI_48 |
dflet | 0:e89ba455dbcf | 295 | #define AF_RF SL_AF_RF |
dflet | 0:e89ba455dbcf | 296 | #define AF_PACKET SL_AF_PACKET |
dflet | 0:e89ba455dbcf | 297 | |
dflet | 0:e89ba455dbcf | 298 | #define PF_INET SL_PF_INET |
dflet | 0:e89ba455dbcf | 299 | #define PF_INET6 SL_PF_INET6 |
dflet | 0:e89ba455dbcf | 300 | |
dflet | 0:e89ba455dbcf | 301 | #define INADDR_ANY SL_INADDR_ANY |
dflet | 0:e89ba455dbcf | 302 | #define ERROR SL_SOC_ERROR |
dflet | 0:e89ba455dbcf | 303 | #define INEXE SL_INEXE |
dflet | 0:e89ba455dbcf | 304 | #define EBADF SL_EBADF |
dflet | 0:e89ba455dbcf | 305 | #define ENSOCK SL_ENSOCK |
dflet | 0:e89ba455dbcf | 306 | #define EAGAIN SL_EAGAIN |
dflet | 0:e89ba455dbcf | 307 | #define EWOULDBLOCK SL_EWOULDBLOCK |
dflet | 0:e89ba455dbcf | 308 | #define ENOMEM SL_ENOMEM |
dflet | 0:e89ba455dbcf | 309 | #define EACCES SL_EACCES |
dflet | 0:e89ba455dbcf | 310 | #define EFAULT SL_EFAULT |
dflet | 0:e89ba455dbcf | 311 | #define EINVAL SL_EINVAL |
dflet | 0:e89ba455dbcf | 312 | #define EDESTADDRREQ SL_EDESTADDRREQ |
dflet | 0:e89ba455dbcf | 313 | #define EPROTOTYPE SL_EPROTOTYPE |
dflet | 0:e89ba455dbcf | 314 | #define ENOPROTOOPT SL_ENOPROTOOPT |
dflet | 0:e89ba455dbcf | 315 | #define EPROTONOSUPPORT SL_EPROTONOSUPPORT |
dflet | 0:e89ba455dbcf | 316 | #define ESOCKTNOSUPPORT SL_ESOCKTNOSUPPORT |
dflet | 0:e89ba455dbcf | 317 | #define EOPNOTSUPP SL_EOPNOTSUPP |
dflet | 0:e89ba455dbcf | 318 | #define EAFNOSUPPORT SL_EAFNOSUPPORT |
dflet | 0:e89ba455dbcf | 319 | #define EADDRINUSE SL_EADDRINUSE |
dflet | 0:e89ba455dbcf | 320 | #define EADDRNOTAVAIL SL_EADDRNOTAVAIL |
dflet | 0:e89ba455dbcf | 321 | #define ENETUNREACH SL_ENETUNREACH |
dflet | 0:e89ba455dbcf | 322 | #define ENOBUFS SL_ENOBUFS |
dflet | 0:e89ba455dbcf | 323 | #define EOBUFF SL_EOBUFF |
dflet | 0:e89ba455dbcf | 324 | #define EISCONN SL_EISCONN |
dflet | 0:e89ba455dbcf | 325 | #define ENOTCONN SL_ENOTCONN |
dflet | 0:e89ba455dbcf | 326 | #define ETIMEDOUT SL_ETIMEDOUT |
dflet | 0:e89ba455dbcf | 327 | #define ECONNREFUSED SL_ECONNREFUSED |
dflet | 0:e89ba455dbcf | 328 | |
dflet | 0:e89ba455dbcf | 329 | #define SOL_SOCKET SL_SOL_SOCKET |
dflet | 0:e89ba455dbcf | 330 | #define IPPROTO_IP SL_IPPROTO_IP |
dflet | 0:e89ba455dbcf | 331 | #define SO_KEEPALIVE SL_SO_KEEPALIVE |
dflet | 0:e89ba455dbcf | 332 | |
dflet | 0:e89ba455dbcf | 333 | #define SO_RCVTIMEO SL_SO_RCVTIMEO |
dflet | 0:e89ba455dbcf | 334 | #define SO_NONBLOCKING SL_SO_NONBLOCKING |
dflet | 0:e89ba455dbcf | 335 | |
dflet | 0:e89ba455dbcf | 336 | #define IP_MULTICAST_IF SL_IP_MULTICAST_IF |
dflet | 0:e89ba455dbcf | 337 | #define IP_MULTICAST_TTL SL_IP_MULTICAST_TTL |
dflet | 0:e89ba455dbcf | 338 | #define IP_ADD_MEMBERSHIP SL_IP_ADD_MEMBERSHIP |
dflet | 0:e89ba455dbcf | 339 | #define IP_DROP_MEMBERSHIP SL_IP_DROP_MEMBERSHIP |
dflet | 0:e89ba455dbcf | 340 | |
dflet | 0:e89ba455dbcf | 341 | #define socklen_t SlSocklen_t |
dflet | 0:e89ba455dbcf | 342 | #define timeval SlTimeval_t |
dflet | 0:e89ba455dbcf | 343 | #define sockaddr SlSockAddr_t |
dflet | 0:e89ba455dbcf | 344 | #define in6_addr SlIn6Addr_t |
dflet | 0:e89ba455dbcf | 345 | #define sockaddr_in6 SlSockAddrIn6_t |
dflet | 0:e89ba455dbcf | 346 | #define in_addr SlInAddr_t |
dflet | 0:e89ba455dbcf | 347 | #define sockaddr_in SlSockAddrIn_t |
dflet | 0:e89ba455dbcf | 348 | |
dflet | 0:e89ba455dbcf | 349 | #define MSG_DONTWAIT SL_MSG_DONTWAIT |
dflet | 0:e89ba455dbcf | 350 | |
dflet | 0:e89ba455dbcf | 351 | #define FD_SET SL_FD_SET |
dflet | 0:e89ba455dbcf | 352 | #define FD_CLR SL_FD_CLR |
dflet | 0:e89ba455dbcf | 353 | #define FD_ISSET SL_FD_ISSET |
dflet | 0:e89ba455dbcf | 354 | #define FD_ZERO SL_FD_ZERO |
dflet | 0:e89ba455dbcf | 355 | #define fd_set SlFdSet_t |
dflet | 0:e89ba455dbcf | 356 | |
dflet | 0:e89ba455dbcf | 357 | #define socket sl_Socket |
dflet | 0:e89ba455dbcf | 358 | #define close sl_Close |
dflet | 0:e89ba455dbcf | 359 | #define accept sl_Accept |
dflet | 0:e89ba455dbcf | 360 | #define bind sl_Bind |
dflet | 0:e89ba455dbcf | 361 | #define listen sl_Listen |
dflet | 0:e89ba455dbcf | 362 | #define connect sl_Connect |
dflet | 0:e89ba455dbcf | 363 | #define select sl_Select |
dflet | 0:e89ba455dbcf | 364 | #define setsockopt sl_SetSockOpt |
dflet | 0:e89ba455dbcf | 365 | #define getsockopt sl_GetSockOpt |
dflet | 0:e89ba455dbcf | 366 | #define recv sl_Recv |
dflet | 0:e89ba455dbcf | 367 | #define recvfrom sl_RecvFrom |
dflet | 0:e89ba455dbcf | 368 | #define write_ sl_Write |
dflet | 0:e89ba455dbcf | 369 | #define send sl_Send |
dflet | 0:e89ba455dbcf | 370 | #define sendto sl_SendTo |
dflet | 0:e89ba455dbcf | 371 | #define gethostbyname sl_NetAppDnsGetHostByName |
dflet | 0:e89ba455dbcf | 372 | #define htonl sl_Htonl |
dflet | 0:e89ba455dbcf | 373 | #define ntohl sl_Ntohl |
dflet | 0:e89ba455dbcf | 374 | #define htons sl_Htons |
dflet | 0:e89ba455dbcf | 375 | #define ntohs sl_Ntohs |
dflet | 0:e89ba455dbcf | 376 | #endif |
dflet | 0:e89ba455dbcf | 377 | |
dflet | 0:e89ba455dbcf | 378 | |
dflet | 0:e89ba455dbcf | 379 | /*****************************************************************************/ |
dflet | 0:e89ba455dbcf | 380 | /* Structure/Enum declarations */ |
dflet | 0:e89ba455dbcf | 381 | /*****************************************************************************/ |
dflet | 0:e89ba455dbcf | 382 | |
dflet | 0:e89ba455dbcf | 383 | /* Internet address */ |
dflet | 0:e89ba455dbcf | 384 | typedef struct SlInAddr_t { |
dflet | 0:e89ba455dbcf | 385 | #ifndef s_addr |
dflet | 0:e89ba455dbcf | 386 | uint32_t s_addr; /* Internet address 32 bits */ |
dflet | 0:e89ba455dbcf | 387 | #else |
dflet | 0:e89ba455dbcf | 388 | union S_un { |
dflet | 0:e89ba455dbcf | 389 | struct { |
dflet | 0:e89ba455dbcf | 390 | uint8_t s_b1,s_b2,s_b3,s_b4; |
dflet | 0:e89ba455dbcf | 391 | } S_un_b; |
dflet | 0:e89ba455dbcf | 392 | struct { |
dflet | 0:e89ba455dbcf | 393 | uint8_t s_w1,s_w2; |
dflet | 0:e89ba455dbcf | 394 | } S_un_w; |
dflet | 0:e89ba455dbcf | 395 | uint32_t S_addr; |
dflet | 0:e89ba455dbcf | 396 | } S_un; |
dflet | 0:e89ba455dbcf | 397 | #endif |
dflet | 0:e89ba455dbcf | 398 | } SlInAddr_t; |
dflet | 0:e89ba455dbcf | 399 | |
dflet | 0:e89ba455dbcf | 400 | |
dflet | 0:e89ba455dbcf | 401 | /* sockopt */ |
dflet | 0:e89ba455dbcf | 402 | typedef struct { |
dflet | 0:e89ba455dbcf | 403 | uint32_t KeepaliveEnabled; /* 0 = disabled;1 = enabled; default = 1*/ |
dflet | 0:e89ba455dbcf | 404 | } SlSockKeepalive_t; |
dflet | 0:e89ba455dbcf | 405 | |
dflet | 0:e89ba455dbcf | 406 | typedef struct { |
dflet | 0:e89ba455dbcf | 407 | uint32_t ReuseaddrEnabled; /* 0 = disabled; 1 = enabled; default = 1*/ |
dflet | 0:e89ba455dbcf | 408 | } SlSockReuseaddr_t; |
dflet | 0:e89ba455dbcf | 409 | |
dflet | 0:e89ba455dbcf | 410 | typedef struct { |
dflet | 0:e89ba455dbcf | 411 | uint32_t Winsize; /* receive window size for tcp sockets */ |
dflet | 0:e89ba455dbcf | 412 | } SlSockWinsize_t; |
dflet | 0:e89ba455dbcf | 413 | |
dflet | 0:e89ba455dbcf | 414 | typedef struct { |
dflet | 0:e89ba455dbcf | 415 | uint32_t NonblockingEnabled;/* 0 = disabled;1 = enabled;default = 1*/ |
dflet | 0:e89ba455dbcf | 416 | } SlSockNonblocking_t; |
dflet | 0:e89ba455dbcf | 417 | |
dflet | 0:e89ba455dbcf | 418 | typedef struct { |
dflet | 0:e89ba455dbcf | 419 | uint8_t sd; |
dflet | 0:e89ba455dbcf | 420 | uint8_t type; |
dflet | 0:e89ba455dbcf | 421 | uint16_t val; |
dflet | 0:e89ba455dbcf | 422 | } SlSocketAsyncEvent_t; |
dflet | 0:e89ba455dbcf | 423 | |
dflet | 0:e89ba455dbcf | 424 | typedef struct { |
dflet | 0:e89ba455dbcf | 425 | int16_t status; |
dflet | 0:e89ba455dbcf | 426 | uint16_t sd; |
dflet | 0:e89ba455dbcf | 427 | SlSocketAsyncEvent_t socketAsyncEvent; |
dflet | 0:e89ba455dbcf | 428 | } SlSockEventData_t; |
dflet | 0:e89ba455dbcf | 429 | |
dflet | 0:e89ba455dbcf | 430 | |
dflet | 0:e89ba455dbcf | 431 | typedef struct { |
dflet | 0:e89ba455dbcf | 432 | uint32_t Event; |
dflet | 0:e89ba455dbcf | 433 | SlSockEventData_t EventData; |
dflet | 0:e89ba455dbcf | 434 | } SlSockEvent_t; |
dflet | 0:e89ba455dbcf | 435 | |
dflet | 0:e89ba455dbcf | 436 | |
dflet | 0:e89ba455dbcf | 437 | typedef struct { |
dflet | 0:e89ba455dbcf | 438 | uint32_t secureMask; |
dflet | 0:e89ba455dbcf | 439 | } SlSockSecureMask; |
dflet | 0:e89ba455dbcf | 440 | |
dflet | 0:e89ba455dbcf | 441 | typedef struct { |
dflet | 0:e89ba455dbcf | 442 | uint8_t secureMethod; |
dflet | 0:e89ba455dbcf | 443 | } SlSockSecureMethod; |
dflet | 0:e89ba455dbcf | 444 | |
dflet | 0:e89ba455dbcf | 445 | typedef enum { |
dflet | 0:e89ba455dbcf | 446 | SL_BSD_SECURED_PRIVATE_KEY_IDX = 0, |
dflet | 0:e89ba455dbcf | 447 | SL_BSD_SECURED_CERTIFICATE_IDX, |
dflet | 0:e89ba455dbcf | 448 | SL_BSD_SECURED_CA_IDX, |
dflet | 0:e89ba455dbcf | 449 | SL_BSD_SECURED_DH_IDX |
dflet | 0:e89ba455dbcf | 450 | } slBsd_secureSocketFilesIndex_e; |
dflet | 0:e89ba455dbcf | 451 | |
dflet | 0:e89ba455dbcf | 452 | typedef struct { |
dflet | 0:e89ba455dbcf | 453 | SlInAddr_t imr_multiaddr; /* The IPv4 multicast address to join */ |
dflet | 0:e89ba455dbcf | 454 | SlInAddr_t imr_interface; /* The interface to use for this group */ |
dflet | 0:e89ba455dbcf | 455 | } SlSockIpMreq; |
dflet | 0:e89ba455dbcf | 456 | |
dflet | 0:e89ba455dbcf | 457 | |
dflet | 0:e89ba455dbcf | 458 | /* sockopt */ |
dflet | 0:e89ba455dbcf | 459 | typedef uint32_t SlTime_t; |
dflet | 0:e89ba455dbcf | 460 | typedef uint32_t SlSuseconds_t; |
dflet | 0:e89ba455dbcf | 461 | |
dflet | 0:e89ba455dbcf | 462 | typedef struct { |
dflet | 0:e89ba455dbcf | 463 | SlTime_t tv_sec; /* Seconds */ |
dflet | 0:e89ba455dbcf | 464 | SlSuseconds_t tv_usec; /* Microseconds */ |
dflet | 0:e89ba455dbcf | 465 | } SlTimeval_t; |
dflet | 0:e89ba455dbcf | 466 | |
dflet | 0:e89ba455dbcf | 467 | typedef uint16_t SlSocklen_t; |
dflet | 0:e89ba455dbcf | 468 | |
dflet | 0:e89ba455dbcf | 469 | /* IpV4 socket address */ |
dflet | 0:e89ba455dbcf | 470 | typedef struct { |
dflet | 0:e89ba455dbcf | 471 | uint16_t sa_family; /* Address family (e.g. , AF_INET) */ |
dflet | 0:e89ba455dbcf | 472 | uint8_t sa_data[14]; /* Protocol- specific address information*/ |
dflet | 0:e89ba455dbcf | 473 | } SlSockAddr_t; |
dflet | 0:e89ba455dbcf | 474 | |
dflet | 0:e89ba455dbcf | 475 | |
dflet | 0:e89ba455dbcf | 476 | /* IpV6 or Ipv6 EUI64 */ |
dflet | 0:e89ba455dbcf | 477 | typedef struct { |
dflet | 0:e89ba455dbcf | 478 | union { |
dflet | 0:e89ba455dbcf | 479 | uint8_t _S6_u8[16]; |
dflet | 0:e89ba455dbcf | 480 | uint32_t _S6_u32[4]; |
dflet | 0:e89ba455dbcf | 481 | } _S6_un; |
dflet | 0:e89ba455dbcf | 482 | } SlIn6Addr_t; |
dflet | 0:e89ba455dbcf | 483 | |
dflet | 0:e89ba455dbcf | 484 | typedef struct { |
dflet | 0:e89ba455dbcf | 485 | uint16_t sin6_family; /* AF_INET6 || AF_INET6_EUI_48*/ |
dflet | 0:e89ba455dbcf | 486 | uint16_t sin6_port; /* Transport layer port. */ |
dflet | 0:e89ba455dbcf | 487 | uint32_t sin6_flowinfo; /* IPv6 flow information. */ |
dflet | 0:e89ba455dbcf | 488 | SlIn6Addr_t sin6_addr; /* IPv6 address. */ |
dflet | 0:e89ba455dbcf | 489 | uint32_t sin6_scope_id; /* set of interfaces for a scope. */ |
dflet | 0:e89ba455dbcf | 490 | } SlSockAddrIn6_t; |
dflet | 0:e89ba455dbcf | 491 | |
dflet | 0:e89ba455dbcf | 492 | /* Socket address, Internet style. */ |
dflet | 0:e89ba455dbcf | 493 | |
dflet | 0:e89ba455dbcf | 494 | typedef struct { |
dflet | 0:e89ba455dbcf | 495 | uint16_t sin_family; /* Internet Protocol (AF_INET). */ |
dflet | 0:e89ba455dbcf | 496 | uint16_t sin_port; /* Address port (16 bits). */ |
dflet | 0:e89ba455dbcf | 497 | SlInAddr_t sin_addr; /* Internet address (32 bits). */ |
dflet | 0:e89ba455dbcf | 498 | int8_t sin_zero[8]; /* Not used. */ |
dflet | 0:e89ba455dbcf | 499 | } SlSockAddrIn_t; |
dflet | 0:e89ba455dbcf | 500 | |
dflet | 0:e89ba455dbcf | 501 | typedef struct { |
dflet | 0:e89ba455dbcf | 502 | uint32_t ip; |
dflet | 0:e89ba455dbcf | 503 | uint32_t gateway; |
dflet | 0:e89ba455dbcf | 504 | uint32_t dns; |
dflet | 0:e89ba455dbcf | 505 | } SlIpV4AcquiredAsync_t; |
dflet | 0:e89ba455dbcf | 506 | |
dflet | 0:e89ba455dbcf | 507 | typedef struct { |
dflet | 0:e89ba455dbcf | 508 | uint32_t type; |
dflet | 0:e89ba455dbcf | 509 | uint32_t ip[4]; |
dflet | 0:e89ba455dbcf | 510 | uint32_t gateway[4]; |
dflet | 0:e89ba455dbcf | 511 | uint32_t dns[4]; |
dflet | 0:e89ba455dbcf | 512 | } SlIpV6AcquiredAsync_t; |
dflet | 0:e89ba455dbcf | 513 | |
dflet | 0:e89ba455dbcf | 514 | typedef struct { |
dflet | 0:e89ba455dbcf | 515 | uint32_t ip_address; |
dflet | 0:e89ba455dbcf | 516 | uint32_t lease_time; |
dflet | 0:e89ba455dbcf | 517 | uint8_t mac[6]; |
dflet | 0:e89ba455dbcf | 518 | uint16_t padding; |
dflet | 0:e89ba455dbcf | 519 | } SlIpLeasedAsync_t; |
dflet | 0:e89ba455dbcf | 520 | |
dflet | 0:e89ba455dbcf | 521 | typedef struct { |
dflet | 0:e89ba455dbcf | 522 | uint32_t ip_address; |
dflet | 0:e89ba455dbcf | 523 | uint8_t mac[6]; |
dflet | 0:e89ba455dbcf | 524 | uint16_t reason; |
dflet | 0:e89ba455dbcf | 525 | } SlIpReleasedAsync_t; |
dflet | 0:e89ba455dbcf | 526 | |
dflet | 0:e89ba455dbcf | 527 | |
dflet | 0:e89ba455dbcf | 528 | typedef union { |
dflet | 0:e89ba455dbcf | 529 | SlIpV4AcquiredAsync_t ipAcquiredV4; /*SL_NETAPP_IPV4_IPACQUIRED_EVENT*/ |
dflet | 0:e89ba455dbcf | 530 | SlIpV6AcquiredAsync_t ipAcquiredV6; /*SL_NETAPP_IPV6_IPACQUIRED_EVENT*/ |
dflet | 0:e89ba455dbcf | 531 | uint32_t sd; /*SL_SOCKET_TX_FAILED_EVENT*/ |
dflet | 0:e89ba455dbcf | 532 | SlIpLeasedAsync_t ipLeased; /* SL_NETAPP_IP_LEASED_EVENT */ |
dflet | 0:e89ba455dbcf | 533 | SlIpReleasedAsync_t ipReleased; /* SL_NETAPP_IP_RELEASED_EVENT */ |
dflet | 0:e89ba455dbcf | 534 | } SlNetAppEventData_u; |
dflet | 0:e89ba455dbcf | 535 | |
dflet | 0:e89ba455dbcf | 536 | typedef struct { |
dflet | 0:e89ba455dbcf | 537 | uint32_t Event; |
dflet | 0:e89ba455dbcf | 538 | SlNetAppEventData_u EventData; |
dflet | 0:e89ba455dbcf | 539 | } SlNetAppEvent_t; |
dflet | 0:e89ba455dbcf | 540 | |
dflet | 0:e89ba455dbcf | 541 | |
dflet | 0:e89ba455dbcf | 542 | typedef struct sock_secureFiles { |
dflet | 0:e89ba455dbcf | 543 | uint8_t secureFiles[4]; |
dflet | 0:e89ba455dbcf | 544 | } SlSockSecureFiles_t; |
dflet | 0:e89ba455dbcf | 545 | |
dflet | 0:e89ba455dbcf | 546 | |
dflet | 0:e89ba455dbcf | 547 | typedef struct SlFdSet_t { /* The select socket array manager */ |
dflet | 0:e89ba455dbcf | 548 | uint32_t fd_array[(SL_FD_SETSIZE + 31)/32]; /* Bit map of SOCKET Descriptors */ |
dflet | 0:e89ba455dbcf | 549 | } SlFdSet_t; |
dflet | 0:e89ba455dbcf | 550 | |
dflet | 0:e89ba455dbcf | 551 | typedef struct { |
dflet | 0:e89ba455dbcf | 552 | uint8_t rate; /* Recevied Rate */ |
dflet | 0:e89ba455dbcf | 553 | uint8_t channel; /* The received channel*/ |
dflet | 0:e89ba455dbcf | 554 | int8_t rssi; /* The computed RSSI value in db of current frame */ |
dflet | 0:e89ba455dbcf | 555 | uint8_t padding; /* pad to align to 32 bits */ |
dflet | 0:e89ba455dbcf | 556 | uint32_t timestamp; /* Timestamp in microseconds, */ |
dflet | 0:e89ba455dbcf | 557 | } SlTransceiverRxOverHead_t; |
dflet | 0:e89ba455dbcf | 558 | |
dflet | 0:e89ba455dbcf | 559 | class cc3100_nonos; |
dflet | 0:e89ba455dbcf | 560 | |
dflet | 0:e89ba455dbcf | 561 | class cc3100_socket |
dflet | 0:e89ba455dbcf | 562 | { |
dflet | 0:e89ba455dbcf | 563 | |
dflet | 0:e89ba455dbcf | 564 | public: |
dflet | 0:e89ba455dbcf | 565 | |
dflet | 0:e89ba455dbcf | 566 | cc3100_socket(cc3100_driver &driver, cc3100_nonos &nonos); |
dflet | 0:e89ba455dbcf | 567 | |
dflet | 0:e89ba455dbcf | 568 | ~cc3100_socket(); |
dflet | 0:e89ba455dbcf | 569 | |
dflet | 0:e89ba455dbcf | 570 | /*******************************************************************************/ |
dflet | 0:e89ba455dbcf | 571 | /* Functions prototypes */ |
dflet | 0:e89ba455dbcf | 572 | /*******************************************************************************/ |
dflet | 0:e89ba455dbcf | 573 | void _sl_BuildAddress(const SlSockAddr_t *addr, int16_t addrlen, _SocketAddrCommand_u *pCmd); |
dflet | 0:e89ba455dbcf | 574 | void _sl_ParseAddress(_SocketAddrResponse_u *pRsp, SlSockAddr_t *addr, SlSocklen_t *addrlen); |
dflet | 0:e89ba455dbcf | 575 | uint16_t _sl_TruncatePayloadByProtocol(const int16_t pSd,const uint16_t length); |
dflet | 0:e89ba455dbcf | 576 | |
dflet | 0:e89ba455dbcf | 577 | /*****************************************************************************/ |
dflet | 0:e89ba455dbcf | 578 | /* Function prototypes */ |
dflet | 0:e89ba455dbcf | 579 | /*****************************************************************************/ |
dflet | 0:e89ba455dbcf | 580 | |
dflet | 0:e89ba455dbcf | 581 | /*! |
dflet | 0:e89ba455dbcf | 582 | |
dflet | 0:e89ba455dbcf | 583 | \brief create an endpoint for communication |
dflet | 0:e89ba455dbcf | 584 | |
dflet | 0:e89ba455dbcf | 585 | The socket function creates a new socket of a certain socket type, identified |
dflet | 0:e89ba455dbcf | 586 | by an integer number, and allocates system resources to it. |
dflet | 0:e89ba455dbcf | 587 | This function is called by the application layer to obtain a socket handle. |
dflet | 0:e89ba455dbcf | 588 | |
dflet | 0:e89ba455dbcf | 589 | \param[in] domain specifies the protocol family of the created socket. |
dflet | 0:e89ba455dbcf | 590 | For example: |
dflet | 0:e89ba455dbcf | 591 | AF_INET for network protocol IPv4 |
dflet | 0:e89ba455dbcf | 592 | AF_RF for starting transceiver mode. Notes: |
dflet | 0:e89ba455dbcf | 593 | - sending and receiving any packet overriding 802.11 header |
dflet | 0:e89ba455dbcf | 594 | - for optimized power consumption the socket will be started in TX |
dflet | 0:e89ba455dbcf | 595 | only mode until receive command is activated |
dflet | 0:e89ba455dbcf | 596 | AF_INET6 for IPv6 |
dflet | 0:e89ba455dbcf | 597 | |
dflet | 0:e89ba455dbcf | 598 | |
dflet | 0:e89ba455dbcf | 599 | \param[in] type specifies the communication semantic, one of: |
dflet | 0:e89ba455dbcf | 600 | SOCK_STREAM (reliable stream-oriented service or Stream Sockets) |
dflet | 0:e89ba455dbcf | 601 | SOCK_DGRAM (datagram service or Datagram Sockets) |
dflet | 0:e89ba455dbcf | 602 | SOCK_RAW (raw protocols atop the network layer) |
dflet | 0:e89ba455dbcf | 603 | when used with AF_RF: |
dflet | 0:e89ba455dbcf | 604 | SOCK_DGRAM - L2 socket |
dflet | 0:e89ba455dbcf | 605 | SOCK_RAW - L1 socket - bypass WLAN CCA (Clear Channel Assessment) |
dflet | 0:e89ba455dbcf | 606 | |
dflet | 0:e89ba455dbcf | 607 | \param[in] protocol specifies a particular transport to be used with |
dflet | 0:e89ba455dbcf | 608 | the socket. |
dflet | 0:e89ba455dbcf | 609 | The most common are IPPROTO_TCP, IPPROTO_SCTP, IPPROTO_UDP, |
dflet | 0:e89ba455dbcf | 610 | IPPROTO_DCCP. |
dflet | 0:e89ba455dbcf | 611 | The value 0 may be used to select a default |
dflet | 0:e89ba455dbcf | 612 | protocol from the selected domain and type |
dflet | 0:e89ba455dbcf | 613 | |
dflet | 0:e89ba455dbcf | 614 | |
dflet | 0:e89ba455dbcf | 615 | \return On success, socket handle that is used for consequent socket operations. |
dflet | 0:e89ba455dbcf | 616 | A successful return code should be a positive number (int16) |
dflet | 0:e89ba455dbcf | 617 | On error, a negative (int16) value will be returned specifying the error code. |
dflet | 0:e89ba455dbcf | 618 | SL_EAFNOSUPPORT - illegal domain parameter |
dflet | 0:e89ba455dbcf | 619 | SL_EPROTOTYPE - illegal type parameter |
dflet | 0:e89ba455dbcf | 620 | SL_EACCES - permission denied |
dflet | 0:e89ba455dbcf | 621 | SL_ENSOCK - exceeded maximal number of socket |
dflet | 0:e89ba455dbcf | 622 | SL_ENOMEM - memory allocation error |
dflet | 0:e89ba455dbcf | 623 | SL_EINVAL - error in socket configuration |
dflet | 0:e89ba455dbcf | 624 | SL_EPROTONOSUPPORT - illegal protocol parameter |
dflet | 0:e89ba455dbcf | 625 | SL_EOPNOTSUPP - illegal combination of protocol and type parameters |
dflet | 0:e89ba455dbcf | 626 | |
dflet | 0:e89ba455dbcf | 627 | |
dflet | 0:e89ba455dbcf | 628 | \sa sl_Close |
dflet | 0:e89ba455dbcf | 629 | \note belongs to \ref basic_api |
dflet | 0:e89ba455dbcf | 630 | \warning |
dflet | 0:e89ba455dbcf | 631 | */ |
dflet | 0:e89ba455dbcf | 632 | #if _SL_INCLUDE_FUNC(sl_Socket) |
dflet | 0:e89ba455dbcf | 633 | int16_t sl_Socket(int16_t Domain, int16_t Type, int16_t Protocol); |
dflet | 0:e89ba455dbcf | 634 | #endif |
dflet | 0:e89ba455dbcf | 635 | |
dflet | 0:e89ba455dbcf | 636 | /*! |
dflet | 0:e89ba455dbcf | 637 | \brief gracefully close socket |
dflet | 0:e89ba455dbcf | 638 | |
dflet | 0:e89ba455dbcf | 639 | This function causes the system to release resources allocated to a socket. \n |
dflet | 0:e89ba455dbcf | 640 | In case of TCP, the connection is terminated. |
dflet | 0:e89ba455dbcf | 641 | |
dflet | 0:e89ba455dbcf | 642 | \param[in] sd socket handle (received in sl_Socket) |
dflet | 0:e89ba455dbcf | 643 | |
dflet | 0:e89ba455dbcf | 644 | \return On success, zero is returned. |
dflet | 0:e89ba455dbcf | 645 | On error, a negative number is returned. |
dflet | 0:e89ba455dbcf | 646 | |
dflet | 0:e89ba455dbcf | 647 | \sa sl_Socket |
dflet | 0:e89ba455dbcf | 648 | \note belongs to \ref ext_api |
dflet | 0:e89ba455dbcf | 649 | \warning |
dflet | 0:e89ba455dbcf | 650 | */ |
dflet | 0:e89ba455dbcf | 651 | #if _SL_INCLUDE_FUNC(sl_Close) |
dflet | 0:e89ba455dbcf | 652 | int16_t sl_Close(int16_t sd); |
dflet | 0:e89ba455dbcf | 653 | #endif |
dflet | 0:e89ba455dbcf | 654 | |
dflet | 0:e89ba455dbcf | 655 | /*! |
dflet | 0:e89ba455dbcf | 656 | \brief Accept a connection on a socket |
dflet | 0:e89ba455dbcf | 657 | |
dflet | 0:e89ba455dbcf | 658 | This function is used with connection-based socket types (SOCK_STREAM). |
dflet | 0:e89ba455dbcf | 659 | It extracts the first connection request on the queue of pending |
dflet | 0:e89ba455dbcf | 660 | connections, creates a new connected socket, and returns a new file |
dflet | 0:e89ba455dbcf | 661 | descriptor referring to that socket. |
dflet | 0:e89ba455dbcf | 662 | The newly created socket is not in the listening state. The |
dflet | 0:e89ba455dbcf | 663 | original socket sd is unaffected by this call. |
dflet | 0:e89ba455dbcf | 664 | The argument sd is a socket that has been created with |
dflet | 0:e89ba455dbcf | 665 | sl_Socket(), bound to a local address with sl_Bind(), and is |
dflet | 0:e89ba455dbcf | 666 | listening for connections after a sl_Listen(). The argument \b |
dflet | 0:e89ba455dbcf | 667 | \e addr is a pointer to a sockaddr structure. This structure |
dflet | 0:e89ba455dbcf | 668 | is filled in with the address of the peer socket, as known to |
dflet | 0:e89ba455dbcf | 669 | the communications layer. The exact format of the address |
dflet | 0:e89ba455dbcf | 670 | returned addr is determined by the socket's address family. |
dflet | 0:e89ba455dbcf | 671 | The \b \e addrlen argument is a value-result argument: it |
dflet | 0:e89ba455dbcf | 672 | should initially contain the size of the structure pointed to |
dflet | 0:e89ba455dbcf | 673 | by addr, on return it will contain the actual length (in |
dflet | 0:e89ba455dbcf | 674 | bytes) of the address returned. |
dflet | 0:e89ba455dbcf | 675 | |
dflet | 0:e89ba455dbcf | 676 | \param[in] sd socket descriptor (handle) |
dflet | 0:e89ba455dbcf | 677 | \param[out] addr the argument addr is a pointer |
dflet | 0:e89ba455dbcf | 678 | to a sockaddr structure. This |
dflet | 0:e89ba455dbcf | 679 | structure is filled in with the |
dflet | 0:e89ba455dbcf | 680 | address of the peer socket, as |
dflet | 0:e89ba455dbcf | 681 | known to the communications |
dflet | 0:e89ba455dbcf | 682 | layer. The exact format of the |
dflet | 0:e89ba455dbcf | 683 | address returned addr is |
dflet | 0:e89ba455dbcf | 684 | determined by the socket's |
dflet | 0:e89ba455dbcf | 685 | address\n |
dflet | 0:e89ba455dbcf | 686 | sockaddr:\n - code for the |
dflet | 0:e89ba455dbcf | 687 | address format. On this version |
dflet | 0:e89ba455dbcf | 688 | only AF_INET is supported.\n - |
dflet | 0:e89ba455dbcf | 689 | socket address, the length |
dflet | 0:e89ba455dbcf | 690 | depends on the code format |
dflet | 0:e89ba455dbcf | 691 | \param[out] addrlen the addrlen argument is a value-result |
dflet | 0:e89ba455dbcf | 692 | argument: it should initially contain the |
dflet | 0:e89ba455dbcf | 693 | size of the structure pointed to by addr |
dflet | 0:e89ba455dbcf | 694 | |
dflet | 0:e89ba455dbcf | 695 | \return On success, a socket handle. |
dflet | 0:e89ba455dbcf | 696 | On a non-blocking accept a possible negative value is SL_EAGAIN. |
dflet | 0:e89ba455dbcf | 697 | On failure, negative value. |
dflet | 0:e89ba455dbcf | 698 | SL_POOL_IS_EMPTY may be return in case there are no resources in the system |
dflet | 0:e89ba455dbcf | 699 | In this case try again later or increase MAX_CONCURRENT_ACTIONS |
dflet | 0:e89ba455dbcf | 700 | |
dflet | 0:e89ba455dbcf | 701 | \sa sl_Socket sl_Bind sl_Listen |
dflet | 0:e89ba455dbcf | 702 | \note belongs to \ref server_side |
dflet | 0:e89ba455dbcf | 703 | \warning |
dflet | 0:e89ba455dbcf | 704 | */ |
dflet | 0:e89ba455dbcf | 705 | #if _SL_INCLUDE_FUNC(sl_Accept) |
dflet | 0:e89ba455dbcf | 706 | int16_t sl_Accept(int16_t sd, SlSockAddr_t *addr, SlSocklen_t *addrlen); |
dflet | 0:e89ba455dbcf | 707 | #endif |
dflet | 0:e89ba455dbcf | 708 | |
dflet | 0:e89ba455dbcf | 709 | /*! |
dflet | 0:e89ba455dbcf | 710 | \brief assign a name to a socket |
dflet | 0:e89ba455dbcf | 711 | |
dflet | 0:e89ba455dbcf | 712 | This function gives the socket the local address addr. |
dflet | 0:e89ba455dbcf | 713 | addr is addrlen bytes long. Traditionally, this is called |
dflet | 0:e89ba455dbcf | 714 | When a socket is created with socket, it exists in a name |
dflet | 0:e89ba455dbcf | 715 | space (address family) but has no name assigned. |
dflet | 0:e89ba455dbcf | 716 | It is necessary to assign a local address before a SOCK_STREAM |
dflet | 0:e89ba455dbcf | 717 | socket may receive connections. |
dflet | 0:e89ba455dbcf | 718 | |
dflet | 0:e89ba455dbcf | 719 | \param[in] sd socket descriptor (handle) |
dflet | 0:e89ba455dbcf | 720 | \param[in] addr specifies the destination |
dflet | 0:e89ba455dbcf | 721 | addrs\n sockaddr:\n - code for |
dflet | 0:e89ba455dbcf | 722 | the address format. On this |
dflet | 0:e89ba455dbcf | 723 | version only AF_INET is |
dflet | 0:e89ba455dbcf | 724 | supported.\n - socket address, |
dflet | 0:e89ba455dbcf | 725 | the length depends on the code |
dflet | 0:e89ba455dbcf | 726 | format |
dflet | 0:e89ba455dbcf | 727 | \param[in] addrlen contains the size of the structure pointed to by addr |
dflet | 0:e89ba455dbcf | 728 | |
dflet | 0:e89ba455dbcf | 729 | \return On success, zero is returned. On error, a negative error code is returned. |
dflet | 0:e89ba455dbcf | 730 | |
dflet | 0:e89ba455dbcf | 731 | \sa sl_Socket sl_Accept sl_Listen |
dflet | 0:e89ba455dbcf | 732 | \note belongs to \ref basic_api |
dflet | 0:e89ba455dbcf | 733 | \warning |
dflet | 0:e89ba455dbcf | 734 | */ |
dflet | 0:e89ba455dbcf | 735 | #if _SL_INCLUDE_FUNC(sl_Bind) |
dflet | 0:e89ba455dbcf | 736 | int16_t sl_Bind(int16_t sd, const SlSockAddr_t *addr, int16_t addrlen); |
dflet | 0:e89ba455dbcf | 737 | #endif |
dflet | 0:e89ba455dbcf | 738 | |
dflet | 0:e89ba455dbcf | 739 | /*! |
dflet | 0:e89ba455dbcf | 740 | \brief listen for connections on a socket |
dflet | 0:e89ba455dbcf | 741 | |
dflet | 0:e89ba455dbcf | 742 | The willingness to accept incoming connections and a queue |
dflet | 0:e89ba455dbcf | 743 | limit for incoming connections are specified with listen(), |
dflet | 0:e89ba455dbcf | 744 | and then the connections are accepted with accept. |
dflet | 0:e89ba455dbcf | 745 | The listen() call applies only to sockets of type SOCK_STREAM |
dflet | 0:e89ba455dbcf | 746 | The backlog parameter defines the maximum length the queue of |
dflet | 0:e89ba455dbcf | 747 | pending connections may grow to. |
dflet | 0:e89ba455dbcf | 748 | |
dflet | 0:e89ba455dbcf | 749 | \param[in] sd socket descriptor (handle) |
dflet | 0:e89ba455dbcf | 750 | \param[in] backlog specifies the listen queue depth. |
dflet | 0:e89ba455dbcf | 751 | |
dflet | 0:e89ba455dbcf | 752 | |
dflet | 0:e89ba455dbcf | 753 | \return On success, zero is returned. On error, a negative error code is returned. |
dflet | 0:e89ba455dbcf | 754 | |
dflet | 0:e89ba455dbcf | 755 | \sa sl_Socket sl_Accept sl_Bind |
dflet | 0:e89ba455dbcf | 756 | \note belongs to \ref server_side |
dflet | 0:e89ba455dbcf | 757 | \warning |
dflet | 0:e89ba455dbcf | 758 | */ |
dflet | 0:e89ba455dbcf | 759 | #if _SL_INCLUDE_FUNC(sl_Listen) |
dflet | 0:e89ba455dbcf | 760 | int16_t sl_Listen(int16_t sd, int16_t backlog); |
dflet | 0:e89ba455dbcf | 761 | #endif |
dflet | 0:e89ba455dbcf | 762 | |
dflet | 0:e89ba455dbcf | 763 | /*! |
dflet | 0:e89ba455dbcf | 764 | \brief Initiate a connection on a socket |
dflet | 0:e89ba455dbcf | 765 | |
dflet | 0:e89ba455dbcf | 766 | Function connects the socket referred to by the socket |
dflet | 0:e89ba455dbcf | 767 | descriptor sd, to the address specified by addr. The addrlen |
dflet | 0:e89ba455dbcf | 768 | argument specifies the size of addr. The format of the |
dflet | 0:e89ba455dbcf | 769 | address in addr is determined by the address space of the |
dflet | 0:e89ba455dbcf | 770 | socket. If it is of type SOCK_DGRAM, this call specifies the |
dflet | 0:e89ba455dbcf | 771 | peer with which the socket is to be associated; this address |
dflet | 0:e89ba455dbcf | 772 | is that to which datagrams are to be sent, and the only |
dflet | 0:e89ba455dbcf | 773 | address from which datagrams are to be received. If the |
dflet | 0:e89ba455dbcf | 774 | socket is of type SOCK_STREAM, this call attempts to make a |
dflet | 0:e89ba455dbcf | 775 | connection to another socket. The other socket is specified |
dflet | 0:e89ba455dbcf | 776 | by address, which is an address in the communications space |
dflet | 0:e89ba455dbcf | 777 | of the socket. |
dflet | 0:e89ba455dbcf | 778 | |
dflet | 0:e89ba455dbcf | 779 | |
dflet | 0:e89ba455dbcf | 780 | \param[in] sd socket descriptor (handle) |
dflet | 0:e89ba455dbcf | 781 | \param[in] addr specifies the destination addr\n |
dflet | 0:e89ba455dbcf | 782 | sockaddr:\n - code for the |
dflet | 0:e89ba455dbcf | 783 | address format. On this version |
dflet | 0:e89ba455dbcf | 784 | only AF_INET is supported.\n - |
dflet | 0:e89ba455dbcf | 785 | socket address, the length |
dflet | 0:e89ba455dbcf | 786 | depends on the code format |
dflet | 0:e89ba455dbcf | 787 | |
dflet | 0:e89ba455dbcf | 788 | \param[in] addrlen contains the size of the structure pointed |
dflet | 0:e89ba455dbcf | 789 | to by addr |
dflet | 0:e89ba455dbcf | 790 | |
dflet | 0:e89ba455dbcf | 791 | \return On success, a socket handle. |
dflet | 0:e89ba455dbcf | 792 | On a non-blocking connect a possible negative value is SL_EALREADY. |
dflet | 0:e89ba455dbcf | 793 | On failure, negative value. |
dflet | 0:e89ba455dbcf | 794 | SL_POOL_IS_EMPTY may be return in case there are no resources in the system |
dflet | 0:e89ba455dbcf | 795 | In this case try again later or increase MAX_CONCURRENT_ACTIONS |
dflet | 0:e89ba455dbcf | 796 | |
dflet | 0:e89ba455dbcf | 797 | \sa sl_Socket |
dflet | 0:e89ba455dbcf | 798 | \note belongs to \ref client_side |
dflet | 0:e89ba455dbcf | 799 | \warning |
dflet | 0:e89ba455dbcf | 800 | */ |
dflet | 0:e89ba455dbcf | 801 | #if _SL_INCLUDE_FUNC(sl_Connect) |
dflet | 0:e89ba455dbcf | 802 | int16_t sl_Connect(int16_t sd, const SlSockAddr_t *addr, int16_t addrlen); |
dflet | 0:e89ba455dbcf | 803 | #endif |
dflet | 0:e89ba455dbcf | 804 | |
dflet | 0:e89ba455dbcf | 805 | /*! |
dflet | 0:e89ba455dbcf | 806 | \brief Monitor socket activity |
dflet | 0:e89ba455dbcf | 807 | |
dflet | 0:e89ba455dbcf | 808 | Select allow a program to monitor multiple file descriptors, |
dflet | 0:e89ba455dbcf | 809 | waiting until one or more of the file descriptors become |
dflet | 0:e89ba455dbcf | 810 | "ready" for some class of I/O operation |
dflet | 0:e89ba455dbcf | 811 | |
dflet | 0:e89ba455dbcf | 812 | |
dflet | 0:e89ba455dbcf | 813 | \param[in] nfds the highest-numbered file descriptor in any of the |
dflet | 0:e89ba455dbcf | 814 | three sets, plus 1. |
dflet | 0:e89ba455dbcf | 815 | \param[out] readsds socket descriptors list for read monitoring and accept monitoring |
dflet | 0:e89ba455dbcf | 816 | \param[out] writesds socket descriptors list for connect monitoring only, write monitoring is not supported |
dflet | 0:e89ba455dbcf | 817 | \param[out] exceptsds socket descriptors list for exception monitoring, not supported. |
dflet | 0:e89ba455dbcf | 818 | \param[in] timeout is an upper bound on the amount of time elapsed |
dflet | 0:e89ba455dbcf | 819 | before select() returns. Null or above 0xffff seconds means |
dflet | 0:e89ba455dbcf | 820 | infinity timeout. The minimum timeout is 10 milliseconds, |
dflet | 0:e89ba455dbcf | 821 | less than 10 milliseconds will be set automatically to 10 milliseconds. |
dflet | 0:e89ba455dbcf | 822 | Max microseconds supported is 0xfffc00. |
dflet | 0:e89ba455dbcf | 823 | |
dflet | 0:e89ba455dbcf | 824 | \return On success, select() returns the number of |
dflet | 0:e89ba455dbcf | 825 | file descriptors contained in the three returned |
dflet | 0:e89ba455dbcf | 826 | descriptor sets (that is, the total number of bits that |
dflet | 0:e89ba455dbcf | 827 | are set in readfds, writefds, exceptfds) which may be |
dflet | 0:e89ba455dbcf | 828 | zero if the timeout expires before anything interesting |
dflet | 0:e89ba455dbcf | 829 | happens. On error, a negative value is returned. |
dflet | 0:e89ba455dbcf | 830 | readsds - return the sockets on which Read request will |
dflet | 0:e89ba455dbcf | 831 | return without delay with valid data. |
dflet | 0:e89ba455dbcf | 832 | writesds - return the sockets on which Write request |
dflet | 0:e89ba455dbcf | 833 | will return without delay. |
dflet | 0:e89ba455dbcf | 834 | exceptsds - return the sockets closed recently. |
dflet | 0:e89ba455dbcf | 835 | SL_POOL_IS_EMPTY may be return in case there are no resources in the system |
dflet | 0:e89ba455dbcf | 836 | In this case try again later or increase MAX_CONCURRENT_ACTIONS |
dflet | 0:e89ba455dbcf | 837 | |
dflet | 0:e89ba455dbcf | 838 | \sa sl_Socket |
dflet | 0:e89ba455dbcf | 839 | \note If the timeout value set to less than 5ms it will automatically set |
dflet | 0:e89ba455dbcf | 840 | to 5ms to prevent overload of the system |
dflet | 0:e89ba455dbcf | 841 | belongs to \ref basic_api |
dflet | 0:e89ba455dbcf | 842 | |
dflet | 0:e89ba455dbcf | 843 | Only one sl_Select can be handled at a time. |
dflet | 0:e89ba455dbcf | 844 | Calling this API while the same command is called from another thread, may result |
dflet | 0:e89ba455dbcf | 845 | in one of the two scenarios: |
dflet | 0:e89ba455dbcf | 846 | 1. The command will wait (internal) until the previous command finish, and then be executed. |
dflet | 0:e89ba455dbcf | 847 | 2. There are not enough resources and SL_POOL_IS_EMPTY error will return. |
dflet | 0:e89ba455dbcf | 848 | In this case, MAX_CONCURRENT_ACTIONS can be increased (result in memory increase) or try |
dflet | 0:e89ba455dbcf | 849 | again later to issue the command. |
dflet | 0:e89ba455dbcf | 850 | |
dflet | 0:e89ba455dbcf | 851 | \warning |
dflet | 0:e89ba455dbcf | 852 | */ |
dflet | 0:e89ba455dbcf | 853 | #if _SL_INCLUDE_FUNC(sl_Select) |
dflet | 0:e89ba455dbcf | 854 | int16_t sl_Select(int16_t nfds, SlFdSet_t *readsds, SlFdSet_t *writesds, SlFdSet_t *exceptsds, SlTimeval_t *timeout); |
dflet | 0:e89ba455dbcf | 855 | |
dflet | 0:e89ba455dbcf | 856 | |
dflet | 0:e89ba455dbcf | 857 | /*! |
dflet | 0:e89ba455dbcf | 858 | \brief Select's SlFdSet_t SET function |
dflet | 0:e89ba455dbcf | 859 | |
dflet | 0:e89ba455dbcf | 860 | Sets current socket descriptor on SlFdSet_t container |
dflet | 0:e89ba455dbcf | 861 | */ |
dflet | 0:e89ba455dbcf | 862 | void SL_FD_SET(int16_t fd, SlFdSet_t *fdset); |
dflet | 0:e89ba455dbcf | 863 | |
dflet | 0:e89ba455dbcf | 864 | /*! |
dflet | 0:e89ba455dbcf | 865 | \brief Select's SlFdSet_t CLR function |
dflet | 0:e89ba455dbcf | 866 | |
dflet | 0:e89ba455dbcf | 867 | Clears current socket descriptor on SlFdSet_t container |
dflet | 0:e89ba455dbcf | 868 | */ |
dflet | 0:e89ba455dbcf | 869 | void SL_FD_CLR(int16_t fd, SlFdSet_t *fdset); |
dflet | 0:e89ba455dbcf | 870 | |
dflet | 0:e89ba455dbcf | 871 | |
dflet | 0:e89ba455dbcf | 872 | /*! |
dflet | 0:e89ba455dbcf | 873 | \brief Select's SlFdSet_t ISSET function |
dflet | 0:e89ba455dbcf | 874 | |
dflet | 0:e89ba455dbcf | 875 | Checks if current socket descriptor is set (TRUE/FALSE) |
dflet | 0:e89ba455dbcf | 876 | |
dflet | 0:e89ba455dbcf | 877 | \return Returns TRUE if set, FALSE if unset |
dflet | 0:e89ba455dbcf | 878 | |
dflet | 0:e89ba455dbcf | 879 | */ |
dflet | 0:e89ba455dbcf | 880 | int16_t SL_FD_ISSET(int16_t fd, SlFdSet_t *fdset); |
dflet | 0:e89ba455dbcf | 881 | |
dflet | 0:e89ba455dbcf | 882 | /*! |
dflet | 0:e89ba455dbcf | 883 | \brief Select's SlFdSet_t ZERO function |
dflet | 0:e89ba455dbcf | 884 | |
dflet | 0:e89ba455dbcf | 885 | Clears all socket descriptors from SlFdSet_t |
dflet | 0:e89ba455dbcf | 886 | */ |
dflet | 0:e89ba455dbcf | 887 | void SL_FD_ZERO(SlFdSet_t *fdset); |
dflet | 0:e89ba455dbcf | 888 | |
dflet | 0:e89ba455dbcf | 889 | |
dflet | 0:e89ba455dbcf | 890 | |
dflet | 0:e89ba455dbcf | 891 | #endif |
dflet | 0:e89ba455dbcf | 892 | |
dflet | 0:e89ba455dbcf | 893 | /*! |
dflet | 0:e89ba455dbcf | 894 | \brief set socket options |
dflet | 0:e89ba455dbcf | 895 | |
dflet | 0:e89ba455dbcf | 896 | This function manipulate the options associated with a socket. |
dflet | 0:e89ba455dbcf | 897 | Options may exist at multiple protocol levels; they are always |
dflet | 0:e89ba455dbcf | 898 | present at the uppermost socket level. |
dflet | 0:e89ba455dbcf | 899 | |
dflet | 0:e89ba455dbcf | 900 | When manipulating socket options the level at which the option resides |
dflet | 0:e89ba455dbcf | 901 | and the name of the option must be specified. To manipulate options at |
dflet | 0:e89ba455dbcf | 902 | the socket level, level is specified as SOL_SOCKET. To manipulate |
dflet | 0:e89ba455dbcf | 903 | options at any other level the protocol number of the appropriate proto- |
dflet | 0:e89ba455dbcf | 904 | col controlling the option is supplied. For example, to indicate that an |
dflet | 0:e89ba455dbcf | 905 | option is to be interpreted by the TCP protocol, level should be set to |
dflet | 0:e89ba455dbcf | 906 | the protocol number of TCP; |
dflet | 0:e89ba455dbcf | 907 | |
dflet | 0:e89ba455dbcf | 908 | The parameters optval and optlen are used to access optval - |
dflet | 0:e89ba455dbcf | 909 | ues for setsockopt(). For getsockopt() they identify a |
dflet | 0:e89ba455dbcf | 910 | buffer in which the value for the requested option(s) are to |
dflet | 0:e89ba455dbcf | 911 | be returned. For getsockopt(), optlen is a value-result |
dflet | 0:e89ba455dbcf | 912 | parameter, initially containing the size of the buffer |
dflet | 0:e89ba455dbcf | 913 | pointed to by option_value, and modified on return to |
dflet | 0:e89ba455dbcf | 914 | indicate the actual size of the value returned. If no option |
dflet | 0:e89ba455dbcf | 915 | value is to be supplied or returned, option_value may be |
dflet | 0:e89ba455dbcf | 916 | NULL. |
dflet | 0:e89ba455dbcf | 917 | |
dflet | 0:e89ba455dbcf | 918 | \param[in] sd socket handle |
dflet | 0:e89ba455dbcf | 919 | \param[in] level defines the protocol level for this option |
dflet | 0:e89ba455dbcf | 920 | - <b>SL_SOL_SOCKET</b> Socket level configurations (L4, transport layer) |
dflet | 0:e89ba455dbcf | 921 | - <b>SL_IPPROTO_IP</b> IP level configurations (L3, network layer) |
dflet | 0:e89ba455dbcf | 922 | - <b>SL_SOL_PHY_OPT</b> Link level configurations (L2, link layer) |
dflet | 0:e89ba455dbcf | 923 | \param[in] optname defines the option name to interrogate |
dflet | 0:e89ba455dbcf | 924 | - <b>SL_SOL_SOCKET</b> |
dflet | 0:e89ba455dbcf | 925 | - <b>SL_SO_KEEPALIVE</b> \n |
dflet | 0:e89ba455dbcf | 926 | Enable/Disable periodic keep alive. |
dflet | 0:e89ba455dbcf | 927 | Keeps TCP connections active by enabling the periodic transmission of messages \n |
dflet | 0:e89ba455dbcf | 928 | Timeout is 5 minutes.\n |
dflet | 0:e89ba455dbcf | 929 | Default: Enabled \n |
dflet | 0:e89ba455dbcf | 930 | This options takes SlSockKeepalive_t struct as parameter |
dflet | 0:e89ba455dbcf | 931 | - <b>SL_SO_RCVTIMEO</b> \n |
dflet | 0:e89ba455dbcf | 932 | Sets the timeout value that specifies the maximum amount of time an input function waits until it completes. \n |
dflet | 0:e89ba455dbcf | 933 | Default: No timeout \n |
dflet | 0:e89ba455dbcf | 934 | This options takes SlTimeval_t struct as parameter |
dflet | 0:e89ba455dbcf | 935 | - <b>SL_SO_RCVBUF</b> \n |
dflet | 0:e89ba455dbcf | 936 | Sets tcp max recv window size. \n |
dflet | 0:e89ba455dbcf | 937 | This options takes SlSockWinsize_t struct as parameter |
dflet | 0:e89ba455dbcf | 938 | - <b>SL_SO_NONBLOCKING</b> \n |
dflet | 0:e89ba455dbcf | 939 | Sets socket to non-blocking operation Impacts: connect, accept, send, sendto, recv and recvfrom. \n |
dflet | 0:e89ba455dbcf | 940 | Default: Blocking. |
dflet | 0:e89ba455dbcf | 941 | This options takes SlSockNonblocking_t struct as parameter |
dflet | 0:e89ba455dbcf | 942 | - <b>SL_SO_SECMETHOD</b> \n |
dflet | 0:e89ba455dbcf | 943 | Sets method to tcp secured socket (SL_SEC_SOCKET) \n |
dflet | 0:e89ba455dbcf | 944 | Default: SL_SO_SEC_METHOD_SSLv3_TLSV1_2 \n |
dflet | 0:e89ba455dbcf | 945 | This options takes SlSockSecureMethod struct as parameter |
dflet | 0:e89ba455dbcf | 946 | - <b>SL_SO_SEC_MASK</b> \n |
dflet | 0:e89ba455dbcf | 947 | Sets specific cipher to tcp secured socket (SL_SEC_SOCKET) \n |
dflet | 0:e89ba455dbcf | 948 | Default: "Best" cipher suitable to method \n |
dflet | 0:e89ba455dbcf | 949 | This options takes SlSockSecureMask struct as parameter |
dflet | 0:e89ba455dbcf | 950 | - <b>SL_SO_SECURE_FILES_CA_FILE_NAME</b> \n |
dflet | 0:e89ba455dbcf | 951 | Map secured socket to CA file by name \n |
dflet | 0:e89ba455dbcf | 952 | This options takes <b>uint8_t</b> buffer as parameter |
dflet | 0:e89ba455dbcf | 953 | - <b>SL_SO_SECURE_FILES_PRIVATE_KEY_FILE_NAME</b> \n |
dflet | 0:e89ba455dbcf | 954 | Map secured socket to private key by name \n |
dflet | 0:e89ba455dbcf | 955 | This options takes <b>uint8_t</b> buffer as parameter |
dflet | 0:e89ba455dbcf | 956 | - <b>SL_SO_SECURE_FILES_CERTIFICATE_FILE_NAME</b> \n |
dflet | 0:e89ba455dbcf | 957 | Map secured socket to certificate file by name \n |
dflet | 0:e89ba455dbcf | 958 | This options takes <b>uint8_t</b> buffer as parameter |
dflet | 0:e89ba455dbcf | 959 | - <b>SL_SO_SECURE_FILES_DH_KEY_FILE_NAME</b> \n |
dflet | 0:e89ba455dbcf | 960 | Map secured socket to Diffie Hellman file by name \n |
dflet | 0:e89ba455dbcf | 961 | This options takes <b>uint8_t</b> buffer as parameter |
dflet | 0:e89ba455dbcf | 962 | - <b>SL_SO_CHANGE_CHANNEL</b> \n |
dflet | 0:e89ba455dbcf | 963 | Sets channel in transceiver mode. |
dflet | 0:e89ba455dbcf | 964 | This options takes <b>uint32_t</b> as channel number parameter |
dflet | 0:e89ba455dbcf | 965 | - <b>SL_IPPROTO_IP</b> |
dflet | 0:e89ba455dbcf | 966 | - <b>SL_IP_MULTICAST_TTL</b> \n |
dflet | 0:e89ba455dbcf | 967 | Set the time-to-live value of outgoing multicast packets for this socket. \n |
dflet | 0:e89ba455dbcf | 968 | This options takes <b>uint8_t</b> as parameter |
dflet | 0:e89ba455dbcf | 969 | - <b>SL_IP_ADD_MEMBERSHIP</b> \n |
dflet | 0:e89ba455dbcf | 970 | UDP socket, Join a multicast group. \n |
dflet | 0:e89ba455dbcf | 971 | This options takes SlSockIpMreq struct as parameter |
dflet | 0:e89ba455dbcf | 972 | - <b>SL_IP_DROP_MEMBERSHIP</b> \n |
dflet | 0:e89ba455dbcf | 973 | UDP socket, Leave a multicast group \n |
dflet | 0:e89ba455dbcf | 974 | This options takes SlSockIpMreq struct as parameter |
dflet | 0:e89ba455dbcf | 975 | - <b>SL_IP_RAW_RX_NO_HEADER</b> \n |
dflet | 0:e89ba455dbcf | 976 | Raw socket remove IP header from received data. \n |
dflet | 0:e89ba455dbcf | 977 | Default: data includes ip header \n |
dflet | 0:e89ba455dbcf | 978 | This options takes <b>uint32_t</b> as parameter |
dflet | 0:e89ba455dbcf | 979 | - <b>SL_IP_HDRINCL</b> \n |
dflet | 0:e89ba455dbcf | 980 | RAW socket only, the IPv4 layer generates an IP header when sending a packet unless \n |
dflet | 0:e89ba455dbcf | 981 | the IP_HDRINCL socket option is enabled on the socket. \n |
dflet | 0:e89ba455dbcf | 982 | When it is enabled, the packet must contain an IP header. \n |
dflet | 0:e89ba455dbcf | 983 | Default: disabled, IPv4 header generated by Network Stack \n |
dflet | 0:e89ba455dbcf | 984 | This options takes <b>uint32_t</b> as parameter |
dflet | 0:e89ba455dbcf | 985 | - <b>SL_IP_RAW_IPV6_HDRINCL</b> (inactive) \n |
dflet | 0:e89ba455dbcf | 986 | RAW socket only, the IPv6 layer generates an IP header when sending a packet unless \n |
dflet | 0:e89ba455dbcf | 987 | the IP_HDRINCL socket option is enabled on the socket. When it is enabled, the packet must contain an IP header \n |
dflet | 0:e89ba455dbcf | 988 | Default: disabled, IPv4 header generated by Network Stack \n |
dflet | 0:e89ba455dbcf | 989 | This options takes <b>uint32_t</b> as parameter |
dflet | 0:e89ba455dbcf | 990 | - <b>SL_SOL_PHY_OPT</b> |
dflet | 0:e89ba455dbcf | 991 | - <b>SL_SO_PHY_RATE</b> \n |
dflet | 0:e89ba455dbcf | 992 | RAW socket, set WLAN PHY transmit rate \n |
dflet | 0:e89ba455dbcf | 993 | The values are based on RateIndex_e \n |
dflet | 0:e89ba455dbcf | 994 | This options takes <b>uint32_t</b> as parameter |
dflet | 0:e89ba455dbcf | 995 | - <b>SL_SO_PHY_TX_POWER</b> \n |
dflet | 0:e89ba455dbcf | 996 | RAW socket, set WLAN PHY TX power \n |
dflet | 0:e89ba455dbcf | 997 | Valid rage is 1-15 \n |
dflet | 0:e89ba455dbcf | 998 | This options takes <b>uint32_t</b> as parameter |
dflet | 0:e89ba455dbcf | 999 | - <b>SL_SO_PHY_NUM_FRAMES_TO_TX</b> \n |
dflet | 0:e89ba455dbcf | 1000 | RAW socket, set number of frames to transmit in transceiver mode. |
dflet | 0:e89ba455dbcf | 1001 | Default: 1 packet |
dflet | 0:e89ba455dbcf | 1002 | This options takes <b>uint32_t</b> as parameter |
dflet | 0:e89ba455dbcf | 1003 | - <b>SL_SO_PHY_PREAMBLE</b> \n |
dflet | 0:e89ba455dbcf | 1004 | RAW socket, set WLAN PHY preamble for Long/Short\n |
dflet | 0:e89ba455dbcf | 1005 | This options takes <b>uint32_t</b> as parameter |
dflet | 0:e89ba455dbcf | 1006 | |
dflet | 0:e89ba455dbcf | 1007 | \param[in] optval specifies a value for the option |
dflet | 0:e89ba455dbcf | 1008 | \param[in] optlen specifies the length of the |
dflet | 0:e89ba455dbcf | 1009 | option value |
dflet | 0:e89ba455dbcf | 1010 | |
dflet | 0:e89ba455dbcf | 1011 | \return On success, zero is returned. |
dflet | 0:e89ba455dbcf | 1012 | On error, a negative value is returned. |
dflet | 0:e89ba455dbcf | 1013 | \sa sl_getsockopt |
dflet | 0:e89ba455dbcf | 1014 | \note belongs to \ref basic_api |
dflet | 0:e89ba455dbcf | 1015 | \warning |
dflet | 0:e89ba455dbcf | 1016 | \par Examples: |
dflet | 0:e89ba455dbcf | 1017 | \par |
dflet | 0:e89ba455dbcf | 1018 | <b> SL_SO_KEEPALIVE: </b>(disable Keepalive) |
dflet | 0:e89ba455dbcf | 1019 | \code |
dflet | 0:e89ba455dbcf | 1020 | SlSockKeepalive_t enableOption; |
dflet | 0:e89ba455dbcf | 1021 | enableOption.KeepaliveEnabled = 0; |
dflet | 0:e89ba455dbcf | 1022 | sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_KEEPALIVE, (uint8_t *)&enableOption,sizeof(enableOption)); |
dflet | 0:e89ba455dbcf | 1023 | \endcode |
dflet | 0:e89ba455dbcf | 1024 | \par |
dflet | 0:e89ba455dbcf | 1025 | <b> SL_SO_RCVTIMEO: </b> |
dflet | 0:e89ba455dbcf | 1026 | \code |
dflet | 0:e89ba455dbcf | 1027 | struct SlTimeval_t timeVal; |
dflet | 0:e89ba455dbcf | 1028 | timeVal.tv_sec = 1; // Seconds |
dflet | 0:e89ba455dbcf | 1029 | timeVal.tv_usec = 0; // Microseconds. 10000 microseconds resolution |
dflet | 0:e89ba455dbcf | 1030 | sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_RCVTIMEO, (uint8_t *)&timeVal, sizeof(timeVal)); // Enable receive timeout |
dflet | 0:e89ba455dbcf | 1031 | \endcode |
dflet | 0:e89ba455dbcf | 1032 | \par |
dflet | 0:e89ba455dbcf | 1033 | <b> SL_SO_RCVBUF: </b> |
dflet | 0:e89ba455dbcf | 1034 | \code |
dflet | 0:e89ba455dbcf | 1035 | SlSockWinsize_t size; |
dflet | 0:e89ba455dbcf | 1036 | size.Winsize = 3000; // bytes |
dflet | 0:e89ba455dbcf | 1037 | sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_RCVBUF, (uint8_t *)&size, sizeof(size)); |
dflet | 0:e89ba455dbcf | 1038 | \endcode |
dflet | 0:e89ba455dbcf | 1039 | \par |
dflet | 0:e89ba455dbcf | 1040 | <b> SL_SO_NONBLOCKING: </b> |
dflet | 0:e89ba455dbcf | 1041 | \code |
dflet | 0:e89ba455dbcf | 1042 | SlSockNonblocking_t enableOption; |
dflet | 0:e89ba455dbcf | 1043 | enableOption.NonblockingEnabled = 1; |
dflet | 0:e89ba455dbcf | 1044 | sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_NONBLOCKING, (uint8_t *)&enableOption,sizeof(enableOption)); // Enable/disable nonblocking mode |
dflet | 0:e89ba455dbcf | 1045 | \endcode |
dflet | 0:e89ba455dbcf | 1046 | \par |
dflet | 0:e89ba455dbcf | 1047 | <b> SL_SO_SECMETHOD:</b> |
dflet | 0:e89ba455dbcf | 1048 | \code |
dflet | 0:e89ba455dbcf | 1049 | SlSockSecureMethod method; |
dflet | 0:e89ba455dbcf | 1050 | method.secureMethod = SL_SO_SEC_METHOD_SSLV3; // security method we want to use |
dflet | 0:e89ba455dbcf | 1051 | SockID = sl_Socket(SL_AF_INET,SL_SOCK_STREAM, SL_SEC_SOCKET); |
dflet | 0:e89ba455dbcf | 1052 | sl_SetSockOpt(SockID, SL_SOL_SOCKET, SL_SO_SECMETHOD, (uint8_t *)&method, sizeof(method)); |
dflet | 0:e89ba455dbcf | 1053 | \endcode |
dflet | 0:e89ba455dbcf | 1054 | \par |
dflet | 0:e89ba455dbcf | 1055 | <b> SL_SO_SECURE_MASK:</b> |
dflet | 0:e89ba455dbcf | 1056 | \code |
dflet | 0:e89ba455dbcf | 1057 | SlSockSecureMask cipher; |
dflet | 0:e89ba455dbcf | 1058 | cipher.secureMask = SL_SEC_MASK_SSL_RSA_WITH_RC4_128_SHA; // cipher type |
dflet | 0:e89ba455dbcf | 1059 | SockID = sl_Socket(SL_AF_INET,SL_SOCK_STREAM, SL_SEC_SOCKET); |
dflet | 0:e89ba455dbcf | 1060 | sl_SetSockOpt(SockID, SL_SOL_SOCKET, SL_SO_SEC_MASK,(uint8_t *)&cipher, sizeof(cipher)); |
dflet | 0:e89ba455dbcf | 1061 | \endcode |
dflet | 0:e89ba455dbcf | 1062 | \par |
dflet | 0:e89ba455dbcf | 1063 | <b> SL_SO_SECURE_FILES_CA_FILE_NAME:</b> |
dflet | 0:e89ba455dbcf | 1064 | \code |
dflet | 0:e89ba455dbcf | 1065 | sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_SECURE_FILES_CA_FILE_NAME,"exuifaxCaCert.der",strlen("exuifaxCaCert.der")); |
dflet | 0:e89ba455dbcf | 1066 | \endcode |
dflet | 0:e89ba455dbcf | 1067 | |
dflet | 0:e89ba455dbcf | 1068 | \par |
dflet | 0:e89ba455dbcf | 1069 | <b> SL_SO_SECURE_FILES_PRIVATE_KEY_FILE_NAME:</b> |
dflet | 0:e89ba455dbcf | 1070 | \code |
dflet | 0:e89ba455dbcf | 1071 | sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_SECURE_FILES_PRIVATE_KEY_FILE_NAME,"myPrivateKey.der",strlen("myPrivateKey.der")); |
dflet | 0:e89ba455dbcf | 1072 | \endcode |
dflet | 0:e89ba455dbcf | 1073 | |
dflet | 0:e89ba455dbcf | 1074 | \par |
dflet | 0:e89ba455dbcf | 1075 | <b> SL_SO_SECURE_FILES_CERTIFICATE_FILE_NAME:</b> |
dflet | 0:e89ba455dbcf | 1076 | \code |
dflet | 0:e89ba455dbcf | 1077 | sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_SECURE_FILES_CERTIFICATE_FILE_NAME,"myCertificate.der",strlen("myCertificate.der")); |
dflet | 0:e89ba455dbcf | 1078 | \endcode |
dflet | 0:e89ba455dbcf | 1079 | |
dflet | 0:e89ba455dbcf | 1080 | \par |
dflet | 0:e89ba455dbcf | 1081 | <b> SL_SO_SECURE_FILES_DH_KEY_FILE_NAME:</b> |
dflet | 0:e89ba455dbcf | 1082 | \code |
dflet | 0:e89ba455dbcf | 1083 | sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_SECURE_FILES_DH_KEY_FILE_NAME,"myDHinServerMode.der",strlen("myDHinServerMode.der")); |
dflet | 0:e89ba455dbcf | 1084 | \endcode |
dflet | 0:e89ba455dbcf | 1085 | |
dflet | 0:e89ba455dbcf | 1086 | \par |
dflet | 0:e89ba455dbcf | 1087 | <b> SL_IP_MULTICAST_TTL:</b> |
dflet | 0:e89ba455dbcf | 1088 | \code |
dflet | 0:e89ba455dbcf | 1089 | uint8_t ttl = 20; |
dflet | 0:e89ba455dbcf | 1090 | sl_SetSockOpt(SockID, SL_IPPROTO_IP, SL_IP_MULTICAST_TTL, &ttl, sizeof(ttl)); |
dflet | 0:e89ba455dbcf | 1091 | \endcode |
dflet | 0:e89ba455dbcf | 1092 | |
dflet | 0:e89ba455dbcf | 1093 | \par |
dflet | 0:e89ba455dbcf | 1094 | <b> SL_IP_ADD_MEMBERSHIP:</b> |
dflet | 0:e89ba455dbcf | 1095 | \code |
dflet | 0:e89ba455dbcf | 1096 | SlSockIpMreq mreq; |
dflet | 0:e89ba455dbcf | 1097 | sl_SetSockOpt(SockID, SL_IPPROTO_IP, SL_IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq)); |
dflet | 0:e89ba455dbcf | 1098 | \endcode |
dflet | 0:e89ba455dbcf | 1099 | |
dflet | 0:e89ba455dbcf | 1100 | \par |
dflet | 0:e89ba455dbcf | 1101 | <b> SL_IP_DROP_MEMBERSHIP:</b> |
dflet | 0:e89ba455dbcf | 1102 | \code |
dflet | 0:e89ba455dbcf | 1103 | SlSockIpMreq mreq; |
dflet | 0:e89ba455dbcf | 1104 | sl_SetSockOpt(SockID, SL_IPPROTO_IP, SL_IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq)); |
dflet | 0:e89ba455dbcf | 1105 | \endcode |
dflet | 0:e89ba455dbcf | 1106 | |
dflet | 0:e89ba455dbcf | 1107 | \par |
dflet | 0:e89ba455dbcf | 1108 | <b> SL_SO_CHANGE_CHANNEL:</b> |
dflet | 0:e89ba455dbcf | 1109 | \code |
dflet | 0:e89ba455dbcf | 1110 | uint32_t newChannel = 6; // range is 1-13 |
dflet | 0:e89ba455dbcf | 1111 | sl_SetSockOpt(SockID, SL_SOL_SOCKET, SL_SO_CHANGE_CHANNEL, &newChannel, sizeof(newChannel)); |
dflet | 0:e89ba455dbcf | 1112 | \endcode |
dflet | 0:e89ba455dbcf | 1113 | |
dflet | 0:e89ba455dbcf | 1114 | \par |
dflet | 0:e89ba455dbcf | 1115 | <b> SL_IP_RAW_RX_NO_HEADER:</b> |
dflet | 0:e89ba455dbcf | 1116 | \code |
dflet | 0:e89ba455dbcf | 1117 | uint32_t header = 1; // remove ip header |
dflet | 0:e89ba455dbcf | 1118 | sl_SetSockOpt(SockID, SL_IPPROTO_IP, SL_IP_RAW_RX_NO_HEADER, &header, sizeof(header)); |
dflet | 0:e89ba455dbcf | 1119 | \endcode |
dflet | 0:e89ba455dbcf | 1120 | |
dflet | 0:e89ba455dbcf | 1121 | \par |
dflet | 0:e89ba455dbcf | 1122 | <b> SL_IP_HDRINCL:</b> |
dflet | 0:e89ba455dbcf | 1123 | \code |
dflet | 0:e89ba455dbcf | 1124 | uint32_t header = 1; |
dflet | 0:e89ba455dbcf | 1125 | sl_SetSockOpt(SockID, SL_IPPROTO_IP, SL_IP_HDRINCL, &header, sizeof(header)); |
dflet | 0:e89ba455dbcf | 1126 | \endcode |
dflet | 0:e89ba455dbcf | 1127 | \par |
dflet | 0:e89ba455dbcf | 1128 | <b> SL_IP_RAW_IPV6_HDRINCL:</b> |
dflet | 0:e89ba455dbcf | 1129 | \code |
dflet | 0:e89ba455dbcf | 1130 | uint32_t header = 1; |
dflet | 0:e89ba455dbcf | 1131 | sl_SetSockOpt(SockID, SL_IPPROTO_IP, SL_IP_RAW_IPV6_HDRINCL, &header, sizeof(header)); |
dflet | 0:e89ba455dbcf | 1132 | \endcode |
dflet | 0:e89ba455dbcf | 1133 | |
dflet | 0:e89ba455dbcf | 1134 | \par |
dflet | 0:e89ba455dbcf | 1135 | <b> SL_SO_PHY_RATE:</b> |
dflet | 0:e89ba455dbcf | 1136 | \code |
dflet | 0:e89ba455dbcf | 1137 | uint32_t rate = 6; // see wlan.h RateIndex_e for values |
dflet | 0:e89ba455dbcf | 1138 | sl_SetSockOpt(SockID, SL_SOL_PHY_OPT, SL_SO_PHY_RATE, &rate, sizeof(rate)); |
dflet | 0:e89ba455dbcf | 1139 | \endcode |
dflet | 0:e89ba455dbcf | 1140 | |
dflet | 0:e89ba455dbcf | 1141 | \par |
dflet | 0:e89ba455dbcf | 1142 | <b> SL_SO_PHY_TX_POWER:</b> |
dflet | 0:e89ba455dbcf | 1143 | \code |
dflet | 0:e89ba455dbcf | 1144 | uint32_t txpower = 1; // valid range is 1-15 |
dflet | 0:e89ba455dbcf | 1145 | sl_SetSockOpt(SockID, SL_SOL_PHY_OPT, SL_SO_PHY_TX_POWER, &txpower, sizeof(txpower)); |
dflet | 0:e89ba455dbcf | 1146 | \endcode |
dflet | 0:e89ba455dbcf | 1147 | |
dflet | 0:e89ba455dbcf | 1148 | \par |
dflet | 0:e89ba455dbcf | 1149 | <b> SL_SO_PHY_NUM_FRAMES_TO_TX:</b> |
dflet | 0:e89ba455dbcf | 1150 | \code |
dflet | 0:e89ba455dbcf | 1151 | uint32_t numframes = 1; |
dflet | 0:e89ba455dbcf | 1152 | sl_SetSockOpt(SockID, SL_SOL_PHY_OPT, SL_SO_PHY_NUM_FRAMES_TO_TX, &numframes, sizeof(numframes)); |
dflet | 0:e89ba455dbcf | 1153 | \endcode |
dflet | 0:e89ba455dbcf | 1154 | |
dflet | 0:e89ba455dbcf | 1155 | \par |
dflet | 0:e89ba455dbcf | 1156 | <b> SL_SO_PHY_PREAMBLE:</b> |
dflet | 0:e89ba455dbcf | 1157 | \code |
dflet | 0:e89ba455dbcf | 1158 | uint32_t preamble = 1; |
dflet | 0:e89ba455dbcf | 1159 | sl_SetSockOpt(SockID, SL_SOL_PHY_OPT, SL_SO_PHY_PREAMBLE, &preamble, sizeof(preamble)); |
dflet | 0:e89ba455dbcf | 1160 | \endcode |
dflet | 0:e89ba455dbcf | 1161 | |
dflet | 0:e89ba455dbcf | 1162 | */ |
dflet | 0:e89ba455dbcf | 1163 | #if _SL_INCLUDE_FUNC(sl_SetSockOpt) |
dflet | 0:e89ba455dbcf | 1164 | int16_t sl_SetSockOpt(int16_t sd, int16_t level, int16_t optname, const void *optval, SlSocklen_t optlen); |
dflet | 0:e89ba455dbcf | 1165 | #endif |
dflet | 0:e89ba455dbcf | 1166 | |
dflet | 0:e89ba455dbcf | 1167 | /*! |
dflet | 0:e89ba455dbcf | 1168 | \brief Get socket options |
dflet | 0:e89ba455dbcf | 1169 | |
dflet | 0:e89ba455dbcf | 1170 | This function manipulate the options associated with a socket. |
dflet | 0:e89ba455dbcf | 1171 | Options may exist at multiple protocol levels; they are always |
dflet | 0:e89ba455dbcf | 1172 | present at the uppermost socket level. |
dflet | 0:e89ba455dbcf | 1173 | |
dflet | 0:e89ba455dbcf | 1174 | When manipulating socket options the level at which the option resides |
dflet | 0:e89ba455dbcf | 1175 | and the name of the option must be specified. To manipulate options at |
dflet | 0:e89ba455dbcf | 1176 | the socket level, level is specified as SOL_SOCKET. To manipulate |
dflet | 0:e89ba455dbcf | 1177 | options at any other level the protocol number of the appropriate proto- |
dflet | 0:e89ba455dbcf | 1178 | col controlling the option is supplied. For example, to indicate that an |
dflet | 0:e89ba455dbcf | 1179 | option is to be interpreted by the TCP protocol, level should be set to |
dflet | 0:e89ba455dbcf | 1180 | the protocol number of TCP; |
dflet | 0:e89ba455dbcf | 1181 | |
dflet | 0:e89ba455dbcf | 1182 | The parameters optval and optlen are used to access optval - |
dflet | 0:e89ba455dbcf | 1183 | ues for setsockopt(). For getsockopt() they identify a |
dflet | 0:e89ba455dbcf | 1184 | buffer in which the value for the requested option(s) are to |
dflet | 0:e89ba455dbcf | 1185 | be returned. For getsockopt(), optlen is a value-result |
dflet | 0:e89ba455dbcf | 1186 | parameter, initially containing the size of the buffer |
dflet | 0:e89ba455dbcf | 1187 | pointed to by option_value, and modified on return to |
dflet | 0:e89ba455dbcf | 1188 | indicate the actual size of the value returned. If no option |
dflet | 0:e89ba455dbcf | 1189 | value is to be supplied or returned, option_value may be |
dflet | 0:e89ba455dbcf | 1190 | NULL. |
dflet | 0:e89ba455dbcf | 1191 | |
dflet | 0:e89ba455dbcf | 1192 | |
dflet | 0:e89ba455dbcf | 1193 | \param[in] sd socket handle |
dflet | 0:e89ba455dbcf | 1194 | \param[in] level defines the protocol level for this option |
dflet | 0:e89ba455dbcf | 1195 | \param[in] optname defines the option name to interrogate |
dflet | 0:e89ba455dbcf | 1196 | \param[out] optval specifies a value for the option |
dflet | 0:e89ba455dbcf | 1197 | \param[out] optlen specifies the length of the |
dflet | 0:e89ba455dbcf | 1198 | option value |
dflet | 0:e89ba455dbcf | 1199 | |
dflet | 0:e89ba455dbcf | 1200 | \return On success, zero is returned. |
dflet | 0:e89ba455dbcf | 1201 | On error, a negative value is returned. |
dflet | 0:e89ba455dbcf | 1202 | \sa sl_SetSockOpt |
dflet | 0:e89ba455dbcf | 1203 | \note See sl_SetSockOpt |
dflet | 0:e89ba455dbcf | 1204 | belongs to \ref ext_api |
dflet | 0:e89ba455dbcf | 1205 | \warning |
dflet | 0:e89ba455dbcf | 1206 | */ |
dflet | 0:e89ba455dbcf | 1207 | #if _SL_INCLUDE_FUNC(sl_GetSockOpt) |
dflet | 0:e89ba455dbcf | 1208 | int16_t sl_GetSockOpt(int16_t sd, int16_t level, int16_t optname, void *optval, SlSocklen_t *optlen); |
dflet | 0:e89ba455dbcf | 1209 | #endif |
dflet | 0:e89ba455dbcf | 1210 | |
dflet | 0:e89ba455dbcf | 1211 | /*! |
dflet | 0:e89ba455dbcf | 1212 | \brief read data from TCP socket |
dflet | 0:e89ba455dbcf | 1213 | |
dflet | 0:e89ba455dbcf | 1214 | function receives a message from a connection-mode socket |
dflet | 0:e89ba455dbcf | 1215 | |
dflet | 0:e89ba455dbcf | 1216 | \param[in] sd socket handle |
dflet | 0:e89ba455dbcf | 1217 | \param[out] buf Points to the buffer where the |
dflet | 0:e89ba455dbcf | 1218 | message should be stored. |
dflet | 0:e89ba455dbcf | 1219 | \param[in] Len Specifies the length in bytes of |
dflet | 0:e89ba455dbcf | 1220 | the buffer pointed to by the buffer argument. |
dflet | 0:e89ba455dbcf | 1221 | Range: 1-16000 bytes |
dflet | 0:e89ba455dbcf | 1222 | \param[in] flags Specifies the type of message |
dflet | 0:e89ba455dbcf | 1223 | reception. On this version, this parameter is not |
dflet | 0:e89ba455dbcf | 1224 | supported. |
dflet | 0:e89ba455dbcf | 1225 | |
dflet | 0:e89ba455dbcf | 1226 | \return return the number of bytes received, |
dflet | 0:e89ba455dbcf | 1227 | or a negative value if an error occurred. |
dflet | 0:e89ba455dbcf | 1228 | using a non-blocking recv a possible negative value is SL_EAGAIN. |
dflet | 0:e89ba455dbcf | 1229 | SL_POOL_IS_EMPTY may be return in case there are no resources in the system |
dflet | 0:e89ba455dbcf | 1230 | In this case try again later or increase MAX_CONCURRENT_ACTIONS |
dflet | 0:e89ba455dbcf | 1231 | |
dflet | 0:e89ba455dbcf | 1232 | \sa sl_RecvFrom |
dflet | 0:e89ba455dbcf | 1233 | \note belongs to \ref recv_api |
dflet | 0:e89ba455dbcf | 1234 | \warning |
dflet | 0:e89ba455dbcf | 1235 | \par Examples: |
dflet | 0:e89ba455dbcf | 1236 | \code An example of receiving data using TCP socket: |
dflet | 0:e89ba455dbcf | 1237 | |
dflet | 0:e89ba455dbcf | 1238 | SlSockAddrIn_t Addr; |
dflet | 0:e89ba455dbcf | 1239 | SlSockAddrIn_t LocalAddr; |
dflet | 0:e89ba455dbcf | 1240 | int16_t AddrSize = sizeof(SlSockAddrIn_t); |
dflet | 0:e89ba455dbcf | 1241 | int16_t SockID, newSockID; |
dflet | 0:e89ba455dbcf | 1242 | int16_t Status; |
dflet | 0:e89ba455dbcf | 1243 | int8_t Buf[RECV_BUF_LEN]; |
dflet | 0:e89ba455dbcf | 1244 | |
dflet | 0:e89ba455dbcf | 1245 | LocalAddr.sin_family = SL_AF_INET; |
dflet | 0:e89ba455dbcf | 1246 | LocalAddr.sin_port = sl_Htons(5001); |
dflet | 0:e89ba455dbcf | 1247 | LocalAddr.sin_addr.s_addr = 0; |
dflet | 0:e89ba455dbcf | 1248 | |
dflet | 0:e89ba455dbcf | 1249 | Addr.sin_family = SL_AF_INET; |
dflet | 0:e89ba455dbcf | 1250 | Addr.sin_port = sl_Htons(5001); |
dflet | 0:e89ba455dbcf | 1251 | Addr.sin_addr.s_addr = sl_Htonl(SL_IPV4_VAL(10,1,1,200)); |
dflet | 0:e89ba455dbcf | 1252 | |
dflet | 0:e89ba455dbcf | 1253 | SockID = sl_Socket(SL_AF_INET,SL_SOCK_STREAM, 0); |
dflet | 0:e89ba455dbcf | 1254 | Status = sl_Bind(SockID, (SlSockAddr_t *)&LocalAddr, AddrSize); |
dflet | 0:e89ba455dbcf | 1255 | Status = sl_Listen(SockID, 0); |
dflet | 0:e89ba455dbcf | 1256 | newSockID = sl_Accept(SockID, (SlSockAddr_t*)&Addr, (SlSocklen_t*) &AddrSize); |
dflet | 0:e89ba455dbcf | 1257 | Status = sl_Recv(newSockID, Buf, 1460, 0); |
dflet | 0:e89ba455dbcf | 1258 | \endcode |
dflet | 0:e89ba455dbcf | 1259 | \code Example code for Rx transceiver mode using a raw socket |
dflet | 0:e89ba455dbcf | 1260 | int8_t buffer[1536]; |
dflet | 0:e89ba455dbcf | 1261 | int16_t sd; |
dflet | 0:e89ba455dbcf | 1262 | uint16_t size; |
dflet | 0:e89ba455dbcf | 1263 | SlTransceiverRxOverHead_t *transHeader; |
dflet | 0:e89ba455dbcf | 1264 | sd = sl_Socket(SL_AF_RF,SL_SOCK_RAW,11); // channel 11 |
dflet | 0:e89ba455dbcf | 1265 | while(1) |
dflet | 0:e89ba455dbcf | 1266 | { |
dflet | 0:e89ba455dbcf | 1267 | size = sl_Recv(sd,buffer,1536,0); |
dflet | 0:e89ba455dbcf | 1268 | transHeader = (SlTransceiverRxOverHead_t *)buffer; |
dflet | 0:e89ba455dbcf | 1269 | printf("RSSI is %d frame type is 0x%x size %d\n",transHeader->rssi,buffer[sizeof(SlTransceiverRxOverHead_t)],size); |
dflet | 0:e89ba455dbcf | 1270 | } |
dflet | 0:e89ba455dbcf | 1271 | \endcode |
dflet | 0:e89ba455dbcf | 1272 | */ |
dflet | 0:e89ba455dbcf | 1273 | #if _SL_INCLUDE_FUNC(sl_Recv) |
dflet | 0:e89ba455dbcf | 1274 | int16_t sl_Recv(int16_t sd, void *buf, int16_t Len, int16_t flags); |
dflet | 0:e89ba455dbcf | 1275 | #endif |
dflet | 0:e89ba455dbcf | 1276 | |
dflet | 0:e89ba455dbcf | 1277 | /*! |
dflet | 0:e89ba455dbcf | 1278 | \brief read data from socket |
dflet | 0:e89ba455dbcf | 1279 | |
dflet | 0:e89ba455dbcf | 1280 | function receives a message from a connection-mode or |
dflet | 0:e89ba455dbcf | 1281 | connectionless-mode socket |
dflet | 0:e89ba455dbcf | 1282 | |
dflet | 0:e89ba455dbcf | 1283 | \param[in] sd socket handle |
dflet | 0:e89ba455dbcf | 1284 | \param[out] buf Points to the buffer where the message should be stored. |
dflet | 0:e89ba455dbcf | 1285 | \param[in] Len Specifies the length in bytes of the buffer pointed to by the buffer argument. |
dflet | 0:e89ba455dbcf | 1286 | Range: 1-16000 bytes |
dflet | 0:e89ba455dbcf | 1287 | \param[in] flags Specifies the type of message |
dflet | 0:e89ba455dbcf | 1288 | reception. On this version, this parameter is not |
dflet | 0:e89ba455dbcf | 1289 | supported. |
dflet | 0:e89ba455dbcf | 1290 | \param[in] from pointer to an address structure |
dflet | 0:e89ba455dbcf | 1291 | indicating the source |
dflet | 0:e89ba455dbcf | 1292 | address.\n sockaddr:\n - code |
dflet | 0:e89ba455dbcf | 1293 | for the address format. On this |
dflet | 0:e89ba455dbcf | 1294 | version only AF_INET is |
dflet | 0:e89ba455dbcf | 1295 | supported.\n - socket address, |
dflet | 0:e89ba455dbcf | 1296 | the length depends on the code |
dflet | 0:e89ba455dbcf | 1297 | format |
dflet | 0:e89ba455dbcf | 1298 | \param[in] fromlen source address structure |
dflet | 0:e89ba455dbcf | 1299 | size. This parameter MUST be set to the size of the structure pointed to by addr. |
dflet | 0:e89ba455dbcf | 1300 | |
dflet | 0:e89ba455dbcf | 1301 | |
dflet | 0:e89ba455dbcf | 1302 | \return return the number of bytes received, |
dflet | 0:e89ba455dbcf | 1303 | or a negative value if an error occurred. |
dflet | 0:e89ba455dbcf | 1304 | using a non-blocking recv a possible negative value is SL_EAGAIN. |
dflet | 0:e89ba455dbcf | 1305 | SL_RET_CODE_INVALID_INPUT (-2) will be returned if fromlen has incorrect length. |
dflet | 0:e89ba455dbcf | 1306 | SL_POOL_IS_EMPTY may be return in case there are no resources in the system |
dflet | 0:e89ba455dbcf | 1307 | In this case try again later or increase MAX_CONCURRENT_ACTIONS |
dflet | 0:e89ba455dbcf | 1308 | |
dflet | 0:e89ba455dbcf | 1309 | \sa sl_Recv |
dflet | 0:e89ba455dbcf | 1310 | \note belongs to \ref recv_api |
dflet | 0:e89ba455dbcf | 1311 | \warning |
dflet | 0:e89ba455dbcf | 1312 | \par Example: |
dflet | 0:e89ba455dbcf | 1313 | \code An example of receiving data: |
dflet | 0:e89ba455dbcf | 1314 | |
dflet | 0:e89ba455dbcf | 1315 | SlSockAddrIn_t Addr; |
dflet | 0:e89ba455dbcf | 1316 | SlSockAddrIn_t LocalAddr; |
dflet | 0:e89ba455dbcf | 1317 | int16_t AddrSize = sizeof(SlSockAddrIn_t); |
dflet | 0:e89ba455dbcf | 1318 | int16_t SockID; |
dflet | 0:e89ba455dbcf | 1319 | int16_t Status; |
dflet | 0:e89ba455dbcf | 1320 | int8_t Buf[RECV_BUF_LEN]; |
dflet | 0:e89ba455dbcf | 1321 | |
dflet | 0:e89ba455dbcf | 1322 | LocalAddr.sin_family = SL_AF_INET; |
dflet | 0:e89ba455dbcf | 1323 | LocalAddr.sin_port = sl_Htons(5001); |
dflet | 0:e89ba455dbcf | 1324 | LocalAddr.sin_addr.s_addr = 0; |
dflet | 0:e89ba455dbcf | 1325 | |
dflet | 0:e89ba455dbcf | 1326 | SockID = sl_Socket(SL_AF_INET,SL_SOCK_DGRAM, 0); |
dflet | 0:e89ba455dbcf | 1327 | Status = sl_Bind(SockID, (SlSockAddr_t *)&LocalAddr, AddrSize); |
dflet | 0:e89ba455dbcf | 1328 | Status = sl_RecvFrom(SockID, Buf, 1472, 0, (SlSockAddr_t *)&Addr, (SlSocklen_t*)&AddrSize); |
dflet | 0:e89ba455dbcf | 1329 | |
dflet | 0:e89ba455dbcf | 1330 | \endcode |
dflet | 0:e89ba455dbcf | 1331 | */ |
dflet | 0:e89ba455dbcf | 1332 | #if _SL_INCLUDE_FUNC(sl_RecvFrom) |
dflet | 0:e89ba455dbcf | 1333 | int16_t sl_RecvFrom(int16_t sd, void *buf, int16_t Len, int16_t flags, SlSockAddr_t *from, SlSocklen_t *fromlen); |
dflet | 0:e89ba455dbcf | 1334 | #endif |
dflet | 0:e89ba455dbcf | 1335 | |
dflet | 0:e89ba455dbcf | 1336 | /*! |
dflet | 0:e89ba455dbcf | 1337 | \brief write data to TCP socket |
dflet | 0:e89ba455dbcf | 1338 | |
dflet | 0:e89ba455dbcf | 1339 | This function is used to transmit a message to another socket. |
dflet | 0:e89ba455dbcf | 1340 | Returns immediately after sending data to device. |
dflet | 0:e89ba455dbcf | 1341 | In case of TCP failure an async event SL_SOCKET_TX_FAILED_EVENT is going to |
dflet | 0:e89ba455dbcf | 1342 | be received. |
dflet | 0:e89ba455dbcf | 1343 | In case of a RAW socket (transceiver mode), extra 4 bytes should be reserved at the end of the |
dflet | 0:e89ba455dbcf | 1344 | frame data buffer for WLAN FCS |
dflet | 0:e89ba455dbcf | 1345 | |
dflet | 0:e89ba455dbcf | 1346 | \param[in] sd socket handle |
dflet | 0:e89ba455dbcf | 1347 | \param[in] buf Points to a buffer containing |
dflet | 0:e89ba455dbcf | 1348 | the message to be sent |
dflet | 0:e89ba455dbcf | 1349 | \param[in] Len message size in bytes. Range: 1-1460 bytes |
dflet | 0:e89ba455dbcf | 1350 | \param[in] flags Specifies the type of message |
dflet | 0:e89ba455dbcf | 1351 | transmission. On this version, this parameter is not |
dflet | 0:e89ba455dbcf | 1352 | supported for TCP. |
dflet | 0:e89ba455dbcf | 1353 | For transceiver mode, the SL_RAW_RF_TX_PARAMS macro can be used to determine |
dflet | 0:e89ba455dbcf | 1354 | transmission parameters (channel,rate,tx_power,preamble) |
dflet | 0:e89ba455dbcf | 1355 | |
dflet | 0:e89ba455dbcf | 1356 | |
dflet | 0:e89ba455dbcf | 1357 | \return Return the number of bytes transmitted, |
dflet | 0:e89ba455dbcf | 1358 | or -1 if an error occurred |
dflet | 0:e89ba455dbcf | 1359 | |
dflet | 0:e89ba455dbcf | 1360 | \sa sl_SendTo |
dflet | 0:e89ba455dbcf | 1361 | \note belongs to \ref send_api |
dflet | 0:e89ba455dbcf | 1362 | \warning |
dflet | 0:e89ba455dbcf | 1363 | \par Example: |
dflet | 0:e89ba455dbcf | 1364 | \code An example of sending data: |
dflet | 0:e89ba455dbcf | 1365 | |
dflet | 0:e89ba455dbcf | 1366 | SlSockAddrIn_t Addr; |
dflet | 0:e89ba455dbcf | 1367 | int16_t AddrSize = sizeof(SlSockAddrIn_t); |
dflet | 0:e89ba455dbcf | 1368 | int16_t SockID; |
dflet | 0:e89ba455dbcf | 1369 | int16_t Status; |
dflet | 0:e89ba455dbcf | 1370 | int8_t Buf[SEND_BUF_LEN]; |
dflet | 0:e89ba455dbcf | 1371 | |
dflet | 0:e89ba455dbcf | 1372 | Addr.sin_family = SL_AF_INET; |
dflet | 0:e89ba455dbcf | 1373 | Addr.sin_port = sl_Htons(5001); |
dflet | 0:e89ba455dbcf | 1374 | Addr.sin_addr.s_addr = sl_Htonl(SL_IPV4_VAL(10,1,1,200)); |
dflet | 0:e89ba455dbcf | 1375 | |
dflet | 0:e89ba455dbcf | 1376 | SockID = sl_Socket(SL_AF_INET,SL_SOCK_STREAM, 0); |
dflet | 0:e89ba455dbcf | 1377 | Status = sl_Connect(SockID, (SlSockAddr_t *)&Addr, AddrSize); |
dflet | 0:e89ba455dbcf | 1378 | Status = sl_Send(SockID, Buf, 1460, 0 ); |
dflet | 0:e89ba455dbcf | 1379 | |
dflet | 0:e89ba455dbcf | 1380 | \endcode |
dflet | 0:e89ba455dbcf | 1381 | */ |
dflet | 0:e89ba455dbcf | 1382 | #if _SL_INCLUDE_FUNC(sl_Send ) |
dflet | 0:e89ba455dbcf | 1383 | int16_t sl_Send(int16_t sd, const void *buf, int16_t Len, int16_t flags); |
dflet | 0:e89ba455dbcf | 1384 | #endif |
dflet | 0:e89ba455dbcf | 1385 | |
dflet | 0:e89ba455dbcf | 1386 | /*! |
dflet | 0:e89ba455dbcf | 1387 | \brief write data to socket |
dflet | 0:e89ba455dbcf | 1388 | |
dflet | 0:e89ba455dbcf | 1389 | This function is used to transmit a message to another socket |
dflet | 0:e89ba455dbcf | 1390 | (connection less socket SOCK_DGRAM, SOCK_RAW). |
dflet | 0:e89ba455dbcf | 1391 | Returns immediately after sending data to device. |
dflet | 0:e89ba455dbcf | 1392 | In case of transmission failure an async event SL_SOCKET_TX_FAILED_EVENT is going to |
dflet | 0:e89ba455dbcf | 1393 | be received. |
dflet | 0:e89ba455dbcf | 1394 | |
dflet | 0:e89ba455dbcf | 1395 | \param[in] sd socket handle |
dflet | 0:e89ba455dbcf | 1396 | \param[in] buf Points to a buffer containing |
dflet | 0:e89ba455dbcf | 1397 | the message to be sent |
dflet | 0:e89ba455dbcf | 1398 | \param[in] Len message size in bytes. Range: 1-1460 bytes |
dflet | 0:e89ba455dbcf | 1399 | \param[in] flags Specifies the type of message |
dflet | 0:e89ba455dbcf | 1400 | transmission. On this version, this parameter is not |
dflet | 0:e89ba455dbcf | 1401 | supported |
dflet | 0:e89ba455dbcf | 1402 | \param[in] to pointer to an address structure |
dflet | 0:e89ba455dbcf | 1403 | indicating the destination |
dflet | 0:e89ba455dbcf | 1404 | address.\n sockaddr:\n - code |
dflet | 0:e89ba455dbcf | 1405 | for the address format. On this |
dflet | 0:e89ba455dbcf | 1406 | version only AF_INET is |
dflet | 0:e89ba455dbcf | 1407 | supported.\n - socket address, |
dflet | 0:e89ba455dbcf | 1408 | the length depends on the code |
dflet | 0:e89ba455dbcf | 1409 | format |
dflet | 0:e89ba455dbcf | 1410 | \param[in] tolen destination address structure size |
dflet | 0:e89ba455dbcf | 1411 | |
dflet | 0:e89ba455dbcf | 1412 | \return Return the number of transmitted bytes, |
dflet | 0:e89ba455dbcf | 1413 | or -1 if an error occurred |
dflet | 0:e89ba455dbcf | 1414 | |
dflet | 0:e89ba455dbcf | 1415 | \sa sl_Send |
dflet | 0:e89ba455dbcf | 1416 | \note belongs to \ref send_api |
dflet | 0:e89ba455dbcf | 1417 | \warning |
dflet | 0:e89ba455dbcf | 1418 | \par Example: |
dflet | 0:e89ba455dbcf | 1419 | \code An example of sending data: |
dflet | 0:e89ba455dbcf | 1420 | |
dflet | 0:e89ba455dbcf | 1421 | SlSockAddrIn_t Addr; |
dflet | 0:e89ba455dbcf | 1422 | int16_t AddrSize = sizeof(SlSockAddrIn_t); |
dflet | 0:e89ba455dbcf | 1423 | int16_t SockID; |
dflet | 0:e89ba455dbcf | 1424 | int16_t Status; |
dflet | 0:e89ba455dbcf | 1425 | int8_t Buf[SEND_BUF_LEN]; |
dflet | 0:e89ba455dbcf | 1426 | |
dflet | 0:e89ba455dbcf | 1427 | Addr.sin_family = SL_AF_INET; |
dflet | 0:e89ba455dbcf | 1428 | Addr.sin_port = sl_Htons(5001); |
dflet | 0:e89ba455dbcf | 1429 | Addr.sin_addr.s_addr = sl_Htonl(SL_IPV4_VAL(10,1,1,200)); |
dflet | 0:e89ba455dbcf | 1430 | |
dflet | 0:e89ba455dbcf | 1431 | SockID = sl_Socket(SL_AF_INET,SL_SOCK_DGRAM, 0); |
dflet | 0:e89ba455dbcf | 1432 | Status = sl_SendTo(SockID, Buf, 1472, 0, (SlSockAddr_t *)&Addr, AddrSize); |
dflet | 0:e89ba455dbcf | 1433 | |
dflet | 0:e89ba455dbcf | 1434 | \endcode |
dflet | 0:e89ba455dbcf | 1435 | */ |
dflet | 0:e89ba455dbcf | 1436 | #if _SL_INCLUDE_FUNC(sl_SendTo) |
dflet | 0:e89ba455dbcf | 1437 | int16_t sl_SendTo(int16_t sd, const void *buf, int16_t Len, int16_t flags, const SlSockAddr_t *to, SlSocklen_t tolen); |
dflet | 0:e89ba455dbcf | 1438 | #endif |
dflet | 0:e89ba455dbcf | 1439 | |
dflet | 0:e89ba455dbcf | 1440 | /*! |
dflet | 0:e89ba455dbcf | 1441 | \brief Reorder the bytes of a 32-bit unsigned value |
dflet | 0:e89ba455dbcf | 1442 | |
dflet | 0:e89ba455dbcf | 1443 | This function is used to Reorder the bytes of a 32-bit unsigned value from processor order to network order. |
dflet | 0:e89ba455dbcf | 1444 | |
dflet | 0:e89ba455dbcf | 1445 | \param[in] var variable to reorder |
dflet | 0:e89ba455dbcf | 1446 | |
dflet | 0:e89ba455dbcf | 1447 | \return Return the reorder variable, |
dflet | 0:e89ba455dbcf | 1448 | |
dflet | 0:e89ba455dbcf | 1449 | \sa sl_SendTo sl_Bind sl_Connect sl_RecvFrom sl_Accept |
dflet | 0:e89ba455dbcf | 1450 | \note belongs to \ref send_api |
dflet | 0:e89ba455dbcf | 1451 | \warning |
dflet | 0:e89ba455dbcf | 1452 | */ |
dflet | 0:e89ba455dbcf | 1453 | #if _SL_INCLUDE_FUNC(sl_Htonl ) |
dflet | 0:e89ba455dbcf | 1454 | uint32_t sl_Htonl( uint32_t val ); |
dflet | 0:e89ba455dbcf | 1455 | |
dflet | 0:e89ba455dbcf | 1456 | #define sl_Ntohl sl_Htonl /* Reorder the bytes of a 16-bit unsigned value from network order to processor orde. */ |
dflet | 0:e89ba455dbcf | 1457 | #endif |
dflet | 0:e89ba455dbcf | 1458 | |
dflet | 0:e89ba455dbcf | 1459 | /*! |
dflet | 0:e89ba455dbcf | 1460 | \brief Reorder the bytes of a 16-bit unsigned value |
dflet | 0:e89ba455dbcf | 1461 | |
dflet | 0:e89ba455dbcf | 1462 | This function is used to Reorder the bytes of a 16-bit unsigned value from processor order to network order. |
dflet | 0:e89ba455dbcf | 1463 | |
dflet | 0:e89ba455dbcf | 1464 | \param[in] var variable to reorder |
dflet | 0:e89ba455dbcf | 1465 | |
dflet | 0:e89ba455dbcf | 1466 | \return Return the reorder variable, |
dflet | 0:e89ba455dbcf | 1467 | |
dflet | 0:e89ba455dbcf | 1468 | \sa sl_SendTo sl_Bind sl_Connect sl_RecvFrom sl_Accept |
dflet | 0:e89ba455dbcf | 1469 | \note belongs to \ref send_api |
dflet | 0:e89ba455dbcf | 1470 | \warning |
dflet | 0:e89ba455dbcf | 1471 | */ |
dflet | 0:e89ba455dbcf | 1472 | #if _SL_INCLUDE_FUNC(sl_Htons ) |
dflet | 0:e89ba455dbcf | 1473 | uint16_t sl_Htons( uint16_t val ); |
dflet | 0:e89ba455dbcf | 1474 | |
dflet | 0:e89ba455dbcf | 1475 | #define sl_Ntohs sl_Htons /* Reorder the bytes of a 16-bit unsigned value from network order to processor orde. */ |
dflet | 0:e89ba455dbcf | 1476 | #endif |
dflet | 0:e89ba455dbcf | 1477 | |
dflet | 0:e89ba455dbcf | 1478 | private: |
dflet | 0:e89ba455dbcf | 1479 | |
dflet | 0:e89ba455dbcf | 1480 | cc3100_driver &_driver; |
dflet | 0:e89ba455dbcf | 1481 | cc3100_nonos &_nonos; |
dflet | 0:e89ba455dbcf | 1482 | |
dflet | 0:e89ba455dbcf | 1483 | };//class |
dflet | 0:e89ba455dbcf | 1484 | |
dflet | 0:e89ba455dbcf | 1485 | |
dflet | 0:e89ba455dbcf | 1486 | }//namespace mbed_cc3100 |
dflet | 0:e89ba455dbcf | 1487 | |
dflet | 0:e89ba455dbcf | 1488 | /*! |
dflet | 0:e89ba455dbcf | 1489 | |
dflet | 0:e89ba455dbcf | 1490 | Close the Doxygen group. |
dflet | 0:e89ba455dbcf | 1491 | @} |
dflet | 0:e89ba455dbcf | 1492 | |
dflet | 0:e89ba455dbcf | 1493 | */ |
dflet | 0:e89ba455dbcf | 1494 | |
dflet | 0:e89ba455dbcf | 1495 | #endif /* __SOCKET_H__ */ |
dflet | 0:e89ba455dbcf | 1496 | |
dflet | 0:e89ba455dbcf | 1497 | |
dflet | 0:e89ba455dbcf | 1498 |