@@ -110,7 +110,7 @@ class NanostackSocket {
110110
111111static NanostackSocket * socket_tbl[NS_INTERFACE_SOCKETS_MAX];
112112
113- static int map_mesh_error (mesh_error_t err)
113+ static nsapi_error_t map_mesh_error (mesh_error_t err)
114114{
115115 switch (err) {
116116 case MESH_ERROR_NONE: return 0 ;
@@ -167,7 +167,7 @@ NanostackSocket::~NanostackSocket()
167167 close ();
168168 }
169169 if (socket_id >= 0 ) {
170- int ret = socket_free (socket_id);
170+ nsapi_error_t ret = socket_free (socket_id);
171171 MBED_ASSERT (0 == ret);
172172 MBED_ASSERT (socket_tbl[socket_id] == this );
173173 socket_tbl[socket_id] = NULL ;
@@ -209,7 +209,7 @@ void NanostackSocket::close()
209209 MBED_ASSERT (mode != SOCKET_MODE_CLOSED);
210210
211211 if (socket_id >= 0 ) {
212- int ret = socket_close (socket_id, (addr_valid ? &ns_address : NULL ));
212+ nsapi_error_t ret = socket_close (socket_id, (addr_valid ? &ns_address : NULL ));
213213 MBED_ASSERT (0 == ret);
214214 } else {
215215 MBED_ASSERT (SOCKET_MODE_UNOPENED == mode);
@@ -466,7 +466,7 @@ MeshInterfaceNanostack::MeshInterfaceNanostack(NanostackRfPhy *phy)
466466 // Nothing to do
467467}
468468
469- int MeshInterfaceNanostack::initialize (NanostackRfPhy *phy)
469+ nsapi_error_t MeshInterfaceNanostack::initialize (NanostackRfPhy *phy)
470470{
471471 if (this ->phy != NULL ) {
472472 error (" Phy already set" );
@@ -486,7 +486,7 @@ void MeshInterfaceNanostack::mesh_network_handler(mesh_connection_status_t statu
486486 nanostack_unlock ();
487487}
488488
489- int MeshInterfaceNanostack::register_rf ()
489+ nsapi_error_t MeshInterfaceNanostack::register_rf ()
490490{
491491 nanostack_lock ();
492492
@@ -504,7 +504,7 @@ int MeshInterfaceNanostack::register_rf()
504504 return 0 ;
505505}
506506
507- int MeshInterfaceNanostack::actual_connect ()
507+ nsapi_error_t MeshInterfaceNanostack::actual_connect ()
508508{
509509 nanostack_assert_locked ();
510510
@@ -532,7 +532,7 @@ NetworkStack * MeshInterfaceNanostack::get_stack()
532532 return NanostackInterface::get_stack ();
533533}
534534
535- int MeshInterfaceNanostack::disconnect ()
535+ nsapi_error_t MeshInterfaceNanostack::disconnect ()
536536{
537537 nanostack_lock ();
538538
@@ -562,7 +562,7 @@ const char *MeshInterfaceNanostack::get_mac_address()
562562 return mac_addr_str;
563563}
564564
565- int ThreadInterface::connect ()
565+ nsapi_error_t ThreadInterface::connect ()
566566{
567567 // initialize mesh networking resources, memory, timers, etc...
568568 mesh_system_init ();
@@ -586,14 +586,14 @@ int ThreadInterface::connect()
586586 nanostack_unlock ();
587587 return map_mesh_error (status);
588588 }
589- int ret = this ->actual_connect ();
589+ nsapi_error_t ret = this ->actual_connect ();
590590
591591 nanostack_unlock ();
592592
593593 return ret;
594594}
595595
596- int LoWPANNDInterface::connect ()
596+ nsapi_error_t LoWPANNDInterface::connect ()
597597{
598598 // initialize mesh networking resources, memory, timers, etc...
599599 mesh_system_init ();
@@ -617,7 +617,7 @@ int LoWPANNDInterface::connect()
617617 nanostack_unlock ();
618618 return map_mesh_error (status);
619619 }
620- int ret = this ->actual_connect ();
620+ nsapi_error_t ret = this ->actual_connect ();
621621
622622 nanostack_unlock ();
623623
@@ -646,7 +646,7 @@ const char * NanostackInterface::get_ip_address()
646646 return NULL ;
647647}
648648
649- int NanostackInterface::socket_open (void **handle, nsapi_protocol_t protocol)
649+ nsapi_error_t NanostackInterface::socket_open (void **handle, nsapi_protocol_t protocol)
650650{
651651 // Validate parameters
652652 if (NULL == handle) {
@@ -687,7 +687,7 @@ int NanostackInterface::socket_open(void **handle, nsapi_protocol_t protocol)
687687 return 0 ;
688688}
689689
690- int NanostackInterface::socket_close (void *handle)
690+ nsapi_error_t NanostackInterface::socket_close (void *handle)
691691{
692692 // Validate parameters
693693 NanostackSocket * socket = static_cast <NanostackSocket *>(handle);
@@ -707,7 +707,7 @@ int NanostackInterface::socket_close(void *handle)
707707
708708}
709709
710- int NanostackInterface::socket_sendto (void *handle, const SocketAddress &address, const void *data, unsigned int size)
710+ nsapi_size_or_error_t NanostackInterface::socket_sendto (void *handle, const SocketAddress &address, const void *data, nsapi_size_t size)
711711{
712712 // Validate parameters
713713 NanostackSocket * socket = static_cast <NanostackSocket *>(handle);
@@ -718,7 +718,7 @@ int NanostackInterface::socket_sendto(void *handle, const SocketAddress &address
718718
719719 nanostack_lock ();
720720
721- int ret;
721+ nsapi_size_or_error_t ret;
722722 if (socket->closed ()) {
723723 ret = NSAPI_ERROR_NO_CONNECTION;
724724 } else if (NANOSTACK_SOCKET_TCP == socket->proto ) {
@@ -758,7 +758,7 @@ int NanostackInterface::socket_sendto(void *handle, const SocketAddress &address
758758 return ret;
759759}
760760
761- int NanostackInterface::socket_recvfrom (void *handle, SocketAddress *address, void *buffer, unsigned size)
761+ nsapi_size_or_error_t NanostackInterface::socket_recvfrom (void *handle, SocketAddress *address, void *buffer, nsapi_size_t size)
762762{
763763 // Validate parameters
764764 NanostackSocket * socket = static_cast <NanostackSocket *>(handle);
@@ -777,7 +777,7 @@ int NanostackInterface::socket_recvfrom(void *handle, SocketAddress *address, vo
777777
778778 nanostack_lock ();
779779
780- int ret;
780+ nsapi_size_or_error_t ret;
781781 if (socket->closed ()) {
782782 ret = NSAPI_ERROR_NO_CONNECTION;
783783 } else if (NANOSTACK_SOCKET_TCP == socket->proto ) {
@@ -796,7 +796,7 @@ int NanostackInterface::socket_recvfrom(void *handle, SocketAddress *address, vo
796796 return ret;
797797}
798798
799- int NanostackInterface::socket_bind (void *handle, const SocketAddress &address)
799+ nsapi_error_t NanostackInterface::socket_bind (void *handle, const SocketAddress &address)
800800{
801801 // Validate parameters
802802 NanostackSocket * socket = static_cast <NanostackSocket *>(handle);
@@ -812,7 +812,7 @@ int NanostackInterface::socket_bind(void *handle, const SocketAddress &address)
812812 ns_address.type = ADDRESS_IPV6;
813813 memset (ns_address.address , 0 , sizeof ns_address.address );
814814 ns_address.identifier = address.get_port ();
815- int ret = NSAPI_ERROR_DEVICE_ERROR;
815+ nsapi_error_t ret = NSAPI_ERROR_DEVICE_ERROR;
816816 if (0 == ::socket_bind (socket->socket_id , &ns_address)) {
817817 socket->set_bound ();
818818 ret = 0 ;
@@ -825,22 +825,22 @@ int NanostackInterface::socket_bind(void *handle, const SocketAddress &address)
825825 return ret;
826826}
827827
828- int NanostackInterface::setsockopt (void *handle, int level, int optname, const void *optval, unsigned optlen)
828+ nsapi_error_t NanostackInterface::setsockopt (void *handle, int level, int optname, const void *optval, unsigned optlen)
829829{
830830 return NSAPI_ERROR_UNSUPPORTED;
831831}
832832
833- int NanostackInterface::getsockopt (void *handle, int level, int optname, void *optval, unsigned *optlen)
833+ nsapi_error_t NanostackInterface::getsockopt (void *handle, int level, int optname, void *optval, unsigned *optlen)
834834{
835835 return NSAPI_ERROR_UNSUPPORTED;
836836}
837837
838- int NanostackInterface::socket_listen (void *handle, int backlog)
838+ nsapi_error_t NanostackInterface::socket_listen (void *handle, int backlog)
839839{
840840 return NSAPI_ERROR_UNSUPPORTED;
841841}
842842
843- int NanostackInterface::socket_connect (void *handle, const SocketAddress &addr)
843+ nsapi_error_t NanostackInterface::socket_connect (void *handle, const SocketAddress &addr)
844844{
845845 // Validate parameters
846846 NanostackSocket * socket = static_cast <NanostackSocket *>(handle);
@@ -851,7 +851,7 @@ int NanostackInterface::socket_connect(void *handle, const SocketAddress &addr)
851851
852852 nanostack_lock ();
853853
854- int ret;
854+ nsapi_error_t ret;
855855 ns_address_t ns_addr;
856856 int random_port = socket->is_bound () ? 0 : 1 ;
857857 convert_mbed_addr_to_ns (&ns_addr, &addr);
@@ -869,12 +869,12 @@ int NanostackInterface::socket_connect(void *handle, const SocketAddress &addr)
869869 return ret;
870870}
871871
872- int NanostackInterface::socket_accept (void *server, void **handle, SocketAddress *address)
872+ nsapi_error_t NanostackInterface::socket_accept (void *server, void **handle, SocketAddress *address)
873873{
874874 return NSAPI_ERROR_UNSUPPORTED;
875875}
876876
877- int NanostackInterface::socket_send (void *handle, const void *p, unsigned size)
877+ nsapi_size_or_error_t NanostackInterface::socket_send (void *handle, const void *p, nsapi_size_t size)
878878{
879879 // Validate parameters
880880 NanostackSocket * socket = static_cast <NanostackSocket *>(handle);
@@ -885,7 +885,7 @@ int NanostackInterface::socket_send(void *handle, const void *p, unsigned size)
885885
886886 nanostack_lock ();
887887
888- int ret;
888+ nsapi_size_or_error_t ret;
889889 if (socket->closed ()) {
890890 ret = NSAPI_ERROR_NO_CONNECTION;
891891 } else if (socket->is_connecting ()) {
@@ -918,7 +918,7 @@ int NanostackInterface::socket_send(void *handle, const void *p, unsigned size)
918918 return ret;
919919}
920920
921- int NanostackInterface::socket_recv (void *handle, void *data, unsigned size)
921+ nsapi_size_or_error_t NanostackInterface::socket_recv (void *handle, void *data, nsapi_size_t size)
922922{
923923 // Validate parameters
924924 NanostackSocket * socket = static_cast <NanostackSocket *>(handle);
@@ -929,7 +929,7 @@ int NanostackInterface::socket_recv(void *handle, void *data, unsigned size)
929929
930930 nanostack_lock ();
931931
932- int ret;
932+ nsapi_size_or_error_t ret;
933933 if (socket->closed ()) {
934934 ret = NSAPI_ERROR_NO_CONNECTION;
935935 } else if (socket->data_available ()) {
0 commit comments