@@ -326,7 +326,7 @@ const char *mbed_lwip_get_mac_address(void)
326326 return lwip_mac_address [0 ] ? lwip_mac_address : 0 ;
327327}
328328
329- char * mbed_lwip_get_ip_address (char * buf , int buflen )
329+ char * mbed_lwip_get_ip_address (char * buf , nsapi_size_t buflen )
330330{
331331 const ip_addr_t * addr = mbed_lwip_get_ip_addr (true, & lwip_netif );
332332 if (!addr ) {
@@ -345,7 +345,7 @@ char *mbed_lwip_get_ip_address(char *buf, int buflen)
345345 return NULL ;
346346}
347347
348- const char * mbed_lwip_get_netmask (char * buf , int buflen )
348+ const char * mbed_lwip_get_netmask (char * buf , nsapi_size_t buflen )
349349{
350350#if LWIP_IPV4
351351 const ip4_addr_t * addr = netif_ip4_netmask (& lwip_netif );
@@ -359,7 +359,7 @@ const char *mbed_lwip_get_netmask(char *buf, int buflen)
359359#endif
360360}
361361
362- char * mbed_lwip_get_gateway (char * buf , int buflen )
362+ char * mbed_lwip_get_gateway (char * buf , nsapi_size_t buflen )
363363{
364364#if LWIP_IPV4
365365 const ip4_addr_t * addr = netif_ip4_gw (& lwip_netif );
@@ -373,7 +373,7 @@ char *mbed_lwip_get_gateway(char *buf, int buflen)
373373#endif
374374}
375375
376- int mbed_lwip_init (emac_interface_t * emac )
376+ nsapi_error_t mbed_lwip_init (emac_interface_t * emac )
377377{
378378 // Check if we've already brought up lwip
379379 if (!mbed_lwip_get_mac_address ()) {
@@ -409,7 +409,7 @@ int mbed_lwip_init(emac_interface_t *emac)
409409 return NSAPI_ERROR_OK ;
410410}
411411
412- int mbed_lwip_bringup (bool dhcp , const char * ip , const char * netmask , const char * gw )
412+ nsapi_error_t mbed_lwip_bringup (bool dhcp , const char * ip , const char * netmask , const char * gw )
413413{
414414 // Check if we've already connected
415415 if (lwip_connected ) {
@@ -509,7 +509,7 @@ int mbed_lwip_bringup(bool dhcp, const char *ip, const char *netmask, const char
509509 return 0 ;
510510}
511511
512- int mbed_lwip_bringdown (void )
512+ nsapi_error_t mbed_lwip_bringdown (void )
513513{
514514 // Check if we've connected
515515 if (!lwip_connected ) {
@@ -533,7 +533,7 @@ int mbed_lwip_bringdown(void)
533533}
534534
535535/* LWIP error remapping */
536- static int mbed_lwip_err_remap (err_t err ) {
536+ static nsapi_error_t mbed_lwip_err_remap (err_t err ) {
537537 switch (err ) {
538538 case ERR_OK :
539539 case ERR_CLSD :
@@ -559,7 +559,7 @@ static int mbed_lwip_err_remap(err_t err) {
559559}
560560
561561/* LWIP network stack implementation */
562- static int mbed_lwip_gethostbyname (nsapi_stack_t * stack , const char * host , nsapi_addr_t * addr , nsapi_version_t version )
562+ static nsapi_error_t mbed_lwip_gethostbyname (nsapi_stack_t * stack , const char * host , nsapi_addr_t * addr , nsapi_version_t version )
563563{
564564 ip_addr_t lwip_addr ;
565565
@@ -600,7 +600,7 @@ static int mbed_lwip_gethostbyname(nsapi_stack_t *stack, const char *host, nsapi
600600 return 0 ;
601601}
602602
603- static int mbed_lwip_socket_open (nsapi_stack_t * stack , nsapi_socket_t * handle , nsapi_protocol_t proto )
603+ static nsapi_error_t mbed_lwip_socket_open (nsapi_stack_t * stack , nsapi_socket_t * handle , nsapi_protocol_t proto )
604604{
605605 // check if network is connected
606606 if (!lwip_connected ) {
@@ -643,7 +643,7 @@ static int mbed_lwip_socket_open(nsapi_stack_t *stack, nsapi_socket_t *handle, n
643643 return 0 ;
644644}
645645
646- static int mbed_lwip_socket_close (nsapi_stack_t * stack , nsapi_socket_t handle )
646+ static nsapi_error_t mbed_lwip_socket_close (nsapi_stack_t * stack , nsapi_socket_t handle )
647647{
648648 struct lwip_socket * s = (struct lwip_socket * )handle ;
649649
@@ -652,7 +652,7 @@ static int mbed_lwip_socket_close(nsapi_stack_t *stack, nsapi_socket_t handle)
652652 return mbed_lwip_err_remap (err );
653653}
654654
655- static int mbed_lwip_socket_bind (nsapi_stack_t * stack , nsapi_socket_t handle , nsapi_addr_t addr , uint16_t port )
655+ static nsapi_error_t mbed_lwip_socket_bind (nsapi_stack_t * stack , nsapi_socket_t handle , nsapi_addr_t addr , uint16_t port )
656656{
657657 struct lwip_socket * s = (struct lwip_socket * )handle ;
658658 ip_addr_t ip_addr ;
@@ -670,15 +670,15 @@ static int mbed_lwip_socket_bind(nsapi_stack_t *stack, nsapi_socket_t handle, ns
670670 return mbed_lwip_err_remap (err );
671671}
672672
673- static int mbed_lwip_socket_listen (nsapi_stack_t * stack , nsapi_socket_t handle , int backlog )
673+ static nsapi_error_t mbed_lwip_socket_listen (nsapi_stack_t * stack , nsapi_socket_t handle , int backlog )
674674{
675675 struct lwip_socket * s = (struct lwip_socket * )handle ;
676676
677677 err_t err = netconn_listen_with_backlog (s -> conn , backlog );
678678 return mbed_lwip_err_remap (err );
679679}
680680
681- static int mbed_lwip_socket_connect (nsapi_stack_t * stack , nsapi_socket_t handle , nsapi_addr_t addr , uint16_t port )
681+ static nsapi_error_t mbed_lwip_socket_connect (nsapi_stack_t * stack , nsapi_socket_t handle , nsapi_addr_t addr , uint16_t port )
682682{
683683 struct lwip_socket * s = (struct lwip_socket * )handle ;
684684 ip_addr_t ip_addr ;
@@ -694,7 +694,7 @@ static int mbed_lwip_socket_connect(nsapi_stack_t *stack, nsapi_socket_t handle,
694694 return mbed_lwip_err_remap (err );
695695}
696696
697- static int mbed_lwip_socket_accept (nsapi_stack_t * stack , nsapi_socket_t server , nsapi_socket_t * handle , nsapi_addr_t * addr , uint16_t * port )
697+ static nsapi_error_t mbed_lwip_socket_accept (nsapi_stack_t * stack , nsapi_socket_t server , nsapi_socket_t * handle , nsapi_addr_t * addr , uint16_t * port )
698698{
699699 struct lwip_socket * s = (struct lwip_socket * )server ;
700700 struct lwip_socket * ns = mbed_lwip_arena_alloc ();
@@ -718,7 +718,7 @@ static int mbed_lwip_socket_accept(nsapi_stack_t *stack, nsapi_socket_t server,
718718 return 0 ;
719719}
720720
721- static int mbed_lwip_socket_send (nsapi_stack_t * stack , nsapi_socket_t handle , const void * data , unsigned size )
721+ static nsapi_size_or_error_t mbed_lwip_socket_send (nsapi_stack_t * stack , nsapi_socket_t handle , const void * data , nsapi_size_t size )
722722{
723723 struct lwip_socket * s = (struct lwip_socket * )handle ;
724724 size_t bytes_written = 0 ;
@@ -728,10 +728,10 @@ static int mbed_lwip_socket_send(nsapi_stack_t *stack, nsapi_socket_t handle, co
728728 return mbed_lwip_err_remap (err );
729729 }
730730
731- return (int )bytes_written ;
731+ return (nsapi_size_or_error_t )bytes_written ;
732732}
733733
734- static int mbed_lwip_socket_recv (nsapi_stack_t * stack , nsapi_socket_t handle , void * data , unsigned size )
734+ static nsapi_size_or_error_t mbed_lwip_socket_recv (nsapi_stack_t * stack , nsapi_socket_t handle , void * data , nsapi_size_t size )
735735{
736736 struct lwip_socket * s = (struct lwip_socket * )handle ;
737737
@@ -755,7 +755,7 @@ static int mbed_lwip_socket_recv(nsapi_stack_t *stack, nsapi_socket_t handle, vo
755755 return recv ;
756756}
757757
758- static int mbed_lwip_socket_sendto (nsapi_stack_t * stack , nsapi_socket_t handle , nsapi_addr_t addr , uint16_t port , const void * data , unsigned size )
758+ static nsapi_size_or_error_t mbed_lwip_socket_sendto (nsapi_stack_t * stack , nsapi_socket_t handle , nsapi_addr_t addr , uint16_t port , const void * data , nsapi_size_t size )
759759{
760760 struct lwip_socket * s = (struct lwip_socket * )handle ;
761761 ip_addr_t ip_addr ;
@@ -780,7 +780,7 @@ static int mbed_lwip_socket_sendto(nsapi_stack_t *stack, nsapi_socket_t handle,
780780 return size ;
781781}
782782
783- static int mbed_lwip_socket_recvfrom (nsapi_stack_t * stack , nsapi_socket_t handle , nsapi_addr_t * addr , uint16_t * port , void * data , unsigned size )
783+ static nsapi_size_or_error_t mbed_lwip_socket_recvfrom (nsapi_stack_t * stack , nsapi_socket_t handle , nsapi_addr_t * addr , uint16_t * port , void * data , nsapi_size_t size )
784784{
785785 struct lwip_socket * s = (struct lwip_socket * )handle ;
786786 struct netbuf * buf ;
@@ -799,7 +799,7 @@ static int mbed_lwip_socket_recvfrom(nsapi_stack_t *stack, nsapi_socket_t handle
799799 return recv ;
800800}
801801
802- static int mbed_lwip_setsockopt (nsapi_stack_t * stack , nsapi_socket_t handle , int level , int optname , const void * optval , unsigned optlen )
802+ static nsapi_error_t mbed_lwip_setsockopt (nsapi_stack_t * stack , nsapi_socket_t handle , int level , int optname , const void * optval , unsigned optlen )
803803{
804804 struct lwip_socket * s = (struct lwip_socket * )handle ;
805805
0 commit comments