286 |
case NETCONN_UDPLITE: |
case NETCONN_UDPLITE: |
287 |
case NETCONN_UDPNOCHKSUM: |
case NETCONN_UDPNOCHKSUM: |
288 |
case NETCONN_UDP: |
case NETCONN_UDP: |
289 |
|
if ((conn->pcb.udp->flags & UDP_FLAGS_CONNECTED) == 0) |
290 |
|
return -1; |
291 |
*addr = &(conn->pcb.udp->remote_ip); |
*addr = &(conn->pcb.udp->remote_ip); |
292 |
*port = conn->pcb.udp->remote_port; |
*port = conn->pcb.udp->remote_port; |
293 |
break; |
break; |
347 |
memp_freep(MEMP_API_MSG, msg); |
memp_freep(MEMP_API_MSG, msg); |
348 |
return conn->err; |
return conn->err; |
349 |
} |
} |
350 |
|
|
351 |
/*-----------------------------------------------------------------------------------*/ |
/*-----------------------------------------------------------------------------------*/ |
352 |
err_t |
err_t |
353 |
netconn_connect(struct netconn *conn, struct ip_addr *addr, |
netconn_connect(struct netconn *conn, struct ip_addr *addr, |
378 |
memp_freep(MEMP_API_MSG, msg); |
memp_freep(MEMP_API_MSG, msg); |
379 |
return conn->err; |
return conn->err; |
380 |
} |
} |
381 |
|
|
382 |
|
err_t |
383 |
|
netconn_disconnect(struct netconn *conn) |
384 |
|
{ |
385 |
|
struct api_msg *msg; |
386 |
|
|
387 |
|
if(conn == NULL) { |
388 |
|
return ERR_VAL; |
389 |
|
} |
390 |
|
|
391 |
|
if((msg = memp_mallocp(MEMP_API_MSG)) == NULL) { |
392 |
|
return ERR_MEM; |
393 |
|
} |
394 |
|
msg->type = API_MSG_DISCONNECT; |
395 |
|
msg->msg.conn = conn; |
396 |
|
api_msg_post(msg); |
397 |
|
memp_freep(MEMP_API_MSG, msg); |
398 |
|
return conn->err; |
399 |
|
|
400 |
|
} |
401 |
/*-----------------------------------------------------------------------------------*/ |
/*-----------------------------------------------------------------------------------*/ |
402 |
err_t |
err_t |
403 |
netconn_listen(struct netconn *conn) |
netconn_listen(struct netconn *conn) |