int getsockopt(int s, int level, int name, void *val, int *valsize) { struct SocketSettings *lss; StdFileDes *fp = _lx_fhfromfd(s); int rc; switch (lss=_lx_get_socket_settings(),lss->lx_network_type) { case LX_AS225: rc = SOCK_getsockopt(fp->lx_sock,level,name,val, valsize); break; case LX_AMITCP: rc = TCP_GetSockOpt(fp->lx_sock,level,name,val, valsize); break; default: rc = 0; break; } return rc; }
HRESULT Library_spot_net_native_Microsoft_SPOT_Net_SocketNative::SockOptHelper( CLR_RT_StackFrame& stack, bool fGet ) { NATIVE_PROFILE_CLR_NETWORK(); TINYCLR_HEADER(); CLR_RT_HeapBlock* socket = stack.Arg0().Dereference(); CLR_INT32 handle; CLR_INT32 level = stack.Arg1().NumericByRef().s4; CLR_INT32 optname = stack.Arg2().NumericByRef().s4; CLR_RT_HeapBlock_Array* arrOpt = stack.Arg3().DereferenceArray(); char* optval; CLR_INT32 optlen; CLR_INT32 ret; FAULT_ON_NULL(socket); handle = socket[ FIELD__m_Handle ].NumericByRef().s4; FAULT_ON_NULL(arrOpt); optval = (char*)arrOpt->GetFirstElement(); optlen = arrOpt->m_numOfElements; if(fGet) { ret = SOCK_getsockopt( handle, level, optname, optval, &optlen ); _ASSERTE( optlen <= (CLR_INT32)arrOpt->m_numOfElements ); } else { ret = SOCK_setsockopt( handle, level, optname, optval, optlen ); } TINYCLR_CHECK_HRESULT(ThrowOnError( stack, ret )); TINYCLR_NOCLEANUP(); }