@@ -36,12 +36,6 @@ enum nsapi_error_t {
36
36
NSAPI_ERROR_AUTH_FAILURE = -3009 , /* !< connection to access point faield */
37
37
NSAPI_ERROR_DEVICE_ERROR = -3010 , /* !< failure interfacing with the network procesor */
38
38
};
39
-
40
- /* * Enum of available options
41
- * @enum nsapi_opt_t
42
- */
43
- enum nsapi_opt_t {
44
- };
45
39
46
40
/* * Enum of socket protocols
47
41
* @enum protocol_t
@@ -93,6 +87,24 @@ class NetworkInterface
93
87
*/
94
88
virtual int gethostbyname (SocketAddress *address, const char *name);
95
89
90
+ /* Set stack options
91
+ * @param level Option level
92
+ * @param optname Option identifier
93
+ * @param optval Option value
94
+ * @param optlen Length of the option value
95
+ * @return 0 on success, negative on failure
96
+ */
97
+ virtual int setstackopt (int level, int optname, const void *optval, unsigned optlen);
98
+
99
+ /* Get stack options
100
+ * @param level Option level
101
+ * @param optname Option identifier
102
+ * @param optval Buffer where to write option value
103
+ * @param optlen Length of the option value
104
+ * @return 0 on success, negative on failure
105
+ */
106
+ virtual int getstackopt (int level, int optname, void *optval, unsigned *optlen);
107
+
96
108
protected:
97
109
friend class Socket ;
98
110
friend class UDPSocket ;
@@ -114,24 +126,6 @@ class NetworkInterface
114
126
*/
115
127
virtual int socket_close (void *handle) = 0;
116
128
117
- /* * Set socket options
118
- * @param handle Socket handle
119
- * @param optname Option ID
120
- * @param optval Option value
121
- * @param optlen Length of the option value
122
- * @return 0 on success, negative on failure
123
- */
124
- virtual int socket_set_option (void *handle, int optname, const void *optval, unsigned int optlen) = 0;
125
-
126
- /* * Get socket options
127
- * @param handle Socket handle
128
- * @param optname Option ID
129
- * @param optval Buffer pointer where to write the option value
130
- * @param optlen Length of the option value
131
- * @return 0 on success, negative on failure
132
- */
133
- virtual int socket_get_option (void *handle, int optname, void *optval, unsigned int *optlen) = 0;
134
-
135
129
/* * Bind a server socket to a specific port
136
130
* @param handle Socket handle
137
131
* @param address Local address to listen for incoming connections on
@@ -220,6 +214,26 @@ class NetworkInterface
220
214
* @note Callback may be called in an interrupt context.
221
215
*/
222
216
virtual void socket_attach (void *handle, void (*callback)(void *), void *data) = 0;
217
+
218
+ /* Set socket options
219
+ * @param handle Socket handle
220
+ * @param level Option level
221
+ * @param optname Option identifier
222
+ * @param optval Option value
223
+ * @param optlen Length of the option value
224
+ * @return 0 on success, negative on failure
225
+ */
226
+ virtual int setsockopt (void *handle, int level, int optname, const void *optval, unsigned optlen);
227
+
228
+ /* Get socket options
229
+ * @param handle Socket handle
230
+ * @param level Option level
231
+ * @param optname Option identifier
232
+ * @param optval Buffer where to write option value
233
+ * @param optlen Length of the option value
234
+ * @return 0 on success, negative on failure
235
+ */
236
+ virtual int getsockopt (void *handle, int level, int optname, void *optval, unsigned *optlen);
223
237
};
224
238
225
239
#endif
0 commit comments