@@ -142,6 +142,14 @@ int socket_request(int type);
142
142
*/
143
143
int socket_setopt (int id , struct sockopt_t * opts );
144
144
145
+ /**
146
+ * Clear socket options/configuration
147
+ * @note socket must be closed before clearing else -EINVAL will be returned
148
+ * @param id [in] Socket ID
149
+ * @return 0 on success, negative value on error
150
+ */
151
+ int socket_clearopt (int id );
152
+
145
153
/**
146
154
* Open a socket. socket options must be configured before calling this function.
147
155
* This is a non blocking function, connection status will be returned via status callback
@@ -177,6 +185,7 @@ int socket_getstatus(int id);
177
185
178
186
/**
179
187
* Set user data associated with socket
188
+ * @ref sockopt_t::arg
180
189
* @param id [in] Socket ID
181
190
* @param arg [in] User data pointer
182
191
* @return 0 on success, negative value on error
@@ -190,6 +199,38 @@ int socket_setuserdata(int id, void *arg);
190
199
*/
191
200
void * socket_getuserdata (int id );
192
201
202
+ /**
203
+ * Set server IP
204
+ * @param id [in] Socket ID
205
+ * @param ip [in] Server IP or domain name
206
+ * @return 0 on success, negative value on error
207
+ */
208
+ int socket_setserverip (int id , const char * ip );
209
+
210
+ /**
211
+ * Set server port
212
+ * @param id [in] Socket ID
213
+ * @param port [in] server port
214
+ * @return 0 on success, negative value on error
215
+ */
216
+ int socket_setserverport (int id , uint16_t port );
217
+
218
+ /**
219
+ * Enable or disable auto connect
220
+ * @param id [in] Socket ID
221
+ * @param enable [in] 1 - Enable, 0 - Disable
222
+ * @return 0 on success, negative value on error
223
+ */
224
+ int socket_setautoconnect (int id , int enable );
225
+
226
+ /**
227
+ * Set socket callbacks
228
+ * @param id [in] Socket ID
229
+ * @param cb [in] Callbacks, Can be null to disable callbacks
230
+ * @return 0 on success, negative value on error
231
+ */
232
+ int socket_setcallback (int id , struct socket_callback_t * cb );
233
+
193
234
/**
194
235
* Release socket. If socket is not closed it will be closed first.
195
236
* @param id [in] Socket ID
@@ -214,6 +255,14 @@ int ssl_socket_request(int ssl_version, struct ssl_certs_t *certs);
214
255
*/
215
256
int ssl_socket_setopt (int id , struct ssl_sockopt_t * opts );
216
257
258
+ /**
259
+ * Clear SSL socket configuration
260
+ * @note socket must be closed before calling this function
261
+ * @param id [in] Socket ID
262
+ * @return 0 on success, negative value on error
263
+ */
264
+ int ssl_socket_clearopt (int id );
265
+
217
266
/**
218
267
* Open SSL socket connection
219
268
* @param id [in] Socket ID
0 commit comments