Lines Matching refs:pSocket

483 	oslSocket pSocket;  in __osl_createSocketImpl()  local
485 pSocket = (oslSocket)calloc(1, sizeof(struct oslSocketImpl)); in __osl_createSocketImpl()
487 pSocket->m_Socket = Socket; in __osl_createSocketImpl()
488 pSocket->m_nLastError = 0; in __osl_createSocketImpl()
489 pSocket->m_CloseCallback = 0; in __osl_createSocketImpl()
490 pSocket->m_CallbackArg = 0; in __osl_createSocketImpl()
491 pSocket->m_nRefCount = 1; in __osl_createSocketImpl()
494 pSocket->m_bIsAccepting = sal_False; in __osl_createSocketImpl()
500 return pSocket; in __osl_createSocketImpl()
1792 oslSocket pSocket; in osl_createSocket() local
1795 pSocket= __osl_createSocketImpl(OSL_INVALID_SOCKET); in osl_createSocket()
1798 pSocket->m_Socket= socket(FAMILY_TO_NATIVE(Family), in osl_createSocket()
1803 if(pSocket->m_Socket == OSL_INVALID_SOCKET) in osl_createSocket()
1809 __osl_destroySocketImpl((pSocket)); in osl_createSocket()
1810 pSocket= 0; in osl_createSocket()
1815 if ((Flags = fcntl(pSocket->m_Socket, F_GETFD, 0)) != -1) in osl_createSocket()
1818 if (fcntl(pSocket->m_Socket, F_SETFD, Flags) == -1) in osl_createSocket()
1820 pSocket->m_nLastError=errno; in osl_createSocket()
1828 pSocket->m_nLastError=errno; in osl_createSocket()
1832 pSocket->m_CloseCallback = NULL; in osl_createSocket()
1833 pSocket->m_CallbackArg = NULL; in osl_createSocket()
1836 return pSocket; in osl_createSocket()
1839 void SAL_CALL osl_acquireSocket(oslSocket pSocket) in osl_acquireSocket() argument
1841 osl_incrementInterlockedCount( &(pSocket->m_nRefCount ) ); in osl_acquireSocket()
1844 void SAL_CALL osl_releaseSocket( oslSocket pSocket ) in osl_releaseSocket() argument
1846 if( pSocket && 0 == osl_decrementInterlockedCount( &(pSocket->m_nRefCount) ) ) in osl_releaseSocket()
1849 if ( pSocket->m_bIsAccepting == sal_True ) in osl_releaseSocket()
1855 osl_closeSocket( pSocket ); in osl_releaseSocket()
1856 __osl_destroySocketImpl( pSocket ); in osl_releaseSocket()
1865 void SAL_CALL osl_closeSocket(oslSocket pSocket) in osl_closeSocket() argument
1871 if(pSocket==0) in osl_closeSocket()
1874 pSocket->m_nLastError=0; in osl_closeSocket()
1875 nFD = pSocket->m_Socket; in osl_closeSocket()
1877 pSocket->m_Socket = OSL_INVALID_SOCKET; in osl_closeSocket()
1880 pSocket->m_bIsInShutdown = sal_True; in osl_closeSocket()
1882 if ( pSocket->m_bIsAccepting == sal_True ) in osl_closeSocket()
1926 if (pSocket->m_CloseCallback != NULL) in osl_closeSocket()
1928 pSocket->m_CloseCallback(pSocket->m_CallbackArg); in osl_closeSocket()
1934 pSocket->m_nLastError=errno; in osl_closeSocket()
1938 pSocket->m_Socket = OSL_INVALID_SOCKET; in osl_closeSocket()
1947 oslSocketAddr SAL_CALL osl_getLocalAddrOfSocket(oslSocket pSocket) in osl_getLocalAddrOfSocket() argument
1960 if (pSocket == NULL) /* ENOTSOCK */ in osl_getLocalAddrOfSocket()
1965 if (getsockname(pSocket->m_Socket, &Addr, PTR_SIZE_T(AddrLen)) == OSL_SOCKET_ERROR) in osl_getLocalAddrOfSocket()
1975 oslSocketAddr SAL_CALL osl_getPeerAddrOfSocket(oslSocket pSocket) in osl_getPeerAddrOfSocket() argument
1980 OSL_ASSERT(pSocket); in osl_getPeerAddrOfSocket()
1981 if ( pSocket == 0 ) in osl_getPeerAddrOfSocket()
1986 pSocket->m_nLastError=0; in osl_getPeerAddrOfSocket()
1989 if(getpeername(pSocket->m_Socket, &Addr, (int*)PTR_SIZE_T(AddrLen)) == OSL_SOCKET_ERROR) in osl_getPeerAddrOfSocket()
1991 pSocket->m_nLastError=errno; in osl_getPeerAddrOfSocket()
2000 sal_Bool SAL_CALL osl_bindAddrToSocket(oslSocket pSocket, in osl_bindAddrToSocket() argument
2005 OSL_ASSERT(pSocket && pAddr ); in osl_bindAddrToSocket()
2006 if ( pSocket == 0 || pAddr == 0 ) in osl_bindAddrToSocket()
2011 pSocket->m_nLastError=0; in osl_bindAddrToSocket()
2013 nRet = bind(pSocket->m_Socket, &(pAddr->m_sockaddr), sizeof(struct sockaddr)); in osl_bindAddrToSocket()
2017 pSocket->m_nLastError=errno; in osl_bindAddrToSocket()
2028 sal_Bool SAL_CALL osl_listenOnSocket(oslSocket pSocket, in osl_listenOnSocket() argument
2033 OSL_ASSERT(pSocket); in osl_listenOnSocket()
2034 if ( pSocket == 0 ) in osl_listenOnSocket()
2039 pSocket->m_nLastError=0; in osl_listenOnSocket()
2041 nRet = listen(pSocket->m_Socket, in osl_listenOnSocket()
2047 pSocket->m_nLastError=errno; in osl_listenOnSocket()
2058 oslSocketResult SAL_CALL osl_connectSocketTo(oslSocket pSocket, in osl_connectSocketTo() argument
2068 OSL_PRECOND(pSocket, "osl_connectSocketTo(): need a valid socket!\n"); in osl_connectSocketTo()
2070 if ( pSocket == 0 ) in osl_connectSocketTo()
2075 pSocket->m_nLastError=0; in osl_connectSocketTo()
2077 if (osl_isNonBlockingMode(pSocket)) in osl_connectSocketTo()
2079 if (connect(pSocket->m_Socket, in osl_connectSocketTo()
2086 pSocket->m_nLastError=EINPROGRESS; in osl_connectSocketTo()
2091 pSocket->m_nLastError=errno; in osl_connectSocketTo()
2097 OSL_VERIFY(osl_enableNonBlockingMode(pSocket, sal_True)); in osl_connectSocketTo()
2100 if(connect(pSocket->m_Socket, in osl_connectSocketTo()
2105 osl_enableNonBlockingMode(pSocket, sal_False); in osl_connectSocketTo()
2114 pSocket->m_nLastError=errno; in osl_connectSocketTo()
2119 osl_enableNonBlockingMode(pSocket, sal_False); in osl_connectSocketTo()
2128 FD_SET(pSocket->m_Socket, &WriteSet); in osl_connectSocketTo()
2129 FD_SET(pSocket->m_Socket, &ExcptSet); in osl_connectSocketTo()
2140 ReadyHandles= select(pSocket->m_Socket+1, in osl_connectSocketTo()
2148 if ( FD_ISSET(pSocket->m_Socket, &WriteSet ) ) in osl_connectSocketTo()
2163 nSockOpt = getsockopt ( pSocket->m_Socket, SOL_SOCKET, SO_ERROR, in osl_connectSocketTo()
2192 pSocket->m_nLastError=errno; in osl_connectSocketTo()
2198 pSocket->m_nLastError=errno; in osl_connectSocketTo()
2202 osl_enableNonBlockingMode(pSocket, sal_False); in osl_connectSocketTo()
2211 oslSocket SAL_CALL osl_acceptConnectionOnSocket(oslSocket pSocket, in osl_acceptConnectionOnSocket() argument
2219 OSL_ASSERT(pSocket); in osl_acceptConnectionOnSocket()
2220 if ( pSocket == 0 ) in osl_acceptConnectionOnSocket()
2225 pSocket->m_nLastError=0; in osl_acceptConnectionOnSocket()
2227 pSocket->m_bIsAccepting = sal_True; in osl_acceptConnectionOnSocket()
2239 Connection = accept(pSocket->m_Socket, &Addr, (int*)PTR_SIZE_T(AddrLen)); in osl_acceptConnectionOnSocket()
2246 pSocket->m_nLastError=errno; in osl_acceptConnectionOnSocket()
2250 pSocket->m_bIsAccepting = sal_False; in osl_acceptConnectionOnSocket()
2259 if ( pSocket->m_bIsInShutdown == sal_True ) in osl_acceptConnectionOnSocket()
2282 pSocket->m_nLastError=errno; in osl_acceptConnectionOnSocket()
2297 pSocket->m_bIsAccepting = sal_False; in osl_acceptConnectionOnSocket()
2305 sal_Int32 SAL_CALL osl_receiveSocket(oslSocket pSocket, in osl_receiveSocket() argument
2312 OSL_ASSERT(pSocket); in osl_receiveSocket()
2313 if ( pSocket == 0 ) in osl_receiveSocket()
2319 pSocket->m_nLastError=0; in osl_receiveSocket()
2323 nRead = recv(pSocket->m_Socket, in osl_receiveSocket()
2331 pSocket->m_nLastError=errno; in osl_receiveSocket()
2346 sal_Int32 SAL_CALL osl_receiveFromSocket(oslSocket pSocket, in osl_receiveFromSocket() argument
2361 OSL_ASSERT(pSocket); in osl_receiveFromSocket()
2362 if ( pSocket == 0 ) in osl_receiveFromSocket()
2368 pSocket->m_nLastError=0; in osl_receiveFromSocket()
2370 nRead = recvfrom(pSocket->m_Socket, in osl_receiveFromSocket()
2379 pSocket->m_nLastError=errno; in osl_receiveFromSocket()
2394 sal_Int32 SAL_CALL osl_sendSocket(oslSocket pSocket, in osl_sendSocket() argument
2401 OSL_ASSERT(pSocket); in osl_sendSocket()
2402 if ( pSocket == 0 ) in osl_sendSocket()
2408 pSocket->m_nLastError=0; in osl_sendSocket()
2412 nWritten = send(pSocket->m_Socket, in osl_sendSocket()
2421 pSocket->m_nLastError=errno; in osl_sendSocket()
2435 sal_Int32 SAL_CALL osl_sendToSocket(oslSocket pSocket, in osl_sendToSocket() argument
2451 OSL_ASSERT(pSocket); in osl_sendToSocket()
2452 if ( pSocket == 0 ) in osl_sendToSocket()
2458 pSocket->m_nLastError=0; in osl_sendToSocket()
2463 nWritten = sendto(pSocket->m_Socket, in osl_sendToSocket()
2472 pSocket->m_nLastError=errno; in osl_sendToSocket()
2487 oslSocket pSocket, void *pBuffer, sal_Int32 n ) in osl_readSocket() argument
2493 OSL_ASSERT( pSocket); in osl_readSocket()
2499 RetVal= osl_receiveSocket(pSocket, in osl_readSocket()
2522 oslSocket pSocket, const void *pBuffer, sal_Int32 n ) in osl_writeSocket() argument
2529 OSL_ASSERT( pSocket ); in osl_writeSocket()
2535 RetVal= osl_sendSocket( pSocket,Ptr,BytesToSend,osl_Socket_MsgNormal); in osl_writeSocket()
2558 oslSocket pSocket, in __osl_socket_poll() argument
2566 OSL_ASSERT(pSocket); in __osl_socket_poll()
2567 pSocket->m_nLastError = 0; in __osl_socket_poll()
2569 fds.fd = pSocket->m_Socket; in __osl_socket_poll()
2584 pSocket->m_nLastError = errno; in __osl_socket_poll()
2601 oslSocket pSocket, in __osl_socket_poll() argument
2609 OSL_ASSERT(pSocket); in __osl_socket_poll()
2610 pSocket->m_nLastError = 0; in __osl_socket_poll()
2613 FD_SET(pSocket->m_Socket, &fds); in __osl_socket_poll()
2623 pSocket->m_Socket + 1, in __osl_socket_poll()
2631 pSocket->m_nLastError = errno; in __osl_socket_poll()
2642 return (FD_ISSET(pSocket->m_Socket, &fds) ? sal_True : sal_False); in __osl_socket_poll()
2651 oslSocket pSocket, const TimeValue* pTimeout) in osl_isReceiveReady() argument
2653 OSL_ASSERT(pSocket); in osl_isReceiveReady()
2654 if (pSocket == NULL) in osl_isReceiveReady()
2660 return __osl_socket_poll (pSocket, pTimeout, POLLIN); in osl_isReceiveReady()
2667 oslSocket pSocket, const TimeValue* pTimeout) in osl_isSendReady() argument
2669 OSL_ASSERT(pSocket); in osl_isSendReady()
2670 if (pSocket == NULL) in osl_isSendReady()
2676 return __osl_socket_poll (pSocket, pTimeout, POLLOUT); in osl_isSendReady()
2683 oslSocket pSocket, const TimeValue* pTimeout) in osl_isExceptionPending() argument
2685 OSL_ASSERT(pSocket); in osl_isExceptionPending()
2686 if (pSocket == NULL) in osl_isExceptionPending()
2692 return __osl_socket_poll (pSocket, pTimeout, POLLPRI); in osl_isExceptionPending()
2698 sal_Bool SAL_CALL osl_shutdownSocket(oslSocket pSocket, in osl_shutdownSocket() argument
2703 OSL_ASSERT(pSocket); in osl_shutdownSocket()
2704 if ( pSocket == 0 ) in osl_shutdownSocket()
2709 pSocket->m_nLastError=0; in osl_shutdownSocket()
2711 nRet=shutdown(pSocket->m_Socket, DIRECTION_TO_NATIVE(Direction)); in osl_shutdownSocket()
2714 pSocket->m_nLastError=errno; in osl_shutdownSocket()
2724 sal_Int32 SAL_CALL osl_getSocketOption(oslSocket pSocket, in osl_getSocketOption() argument
2730 OSL_ASSERT(pSocket); in osl_getSocketOption()
2731 if ( pSocket == 0 ) in osl_getSocketOption()
2736 pSocket->m_nLastError=0; in osl_getSocketOption()
2738 if(getsockopt(pSocket->m_Socket, in osl_getSocketOption()
2744 pSocket->m_nLastError=errno; in osl_getSocketOption()
2754 sal_Bool SAL_CALL osl_setSocketOption(oslSocket pSocket, in osl_setSocketOption() argument
2762 OSL_ASSERT(pSocket); in osl_setSocketOption()
2763 if ( pSocket == 0 ) in osl_setSocketOption()
2768 pSocket->m_nLastError=0; in osl_setSocketOption()
2770 nRet = setsockopt(pSocket->m_Socket, in osl_setSocketOption()
2778 pSocket->m_nLastError=errno; in osl_setSocketOption()
2788 sal_Bool SAL_CALL osl_enableNonBlockingMode(oslSocket pSocket, in osl_enableNonBlockingMode() argument
2794 OSL_ASSERT(pSocket); in osl_enableNonBlockingMode()
2795 if ( pSocket == 0 ) in osl_enableNonBlockingMode()
2800 pSocket->m_nLastError=0; in osl_enableNonBlockingMode()
2802 flags = fcntl(pSocket->m_Socket, F_GETFL, 0); in osl_enableNonBlockingMode()
2809 nRet = fcntl(pSocket->m_Socket, F_SETFL, flags); in osl_enableNonBlockingMode()
2813 pSocket->m_nLastError=errno; in osl_enableNonBlockingMode()
2823 sal_Bool SAL_CALL osl_isNonBlockingMode(oslSocket pSocket) in osl_isNonBlockingMode() argument
2827 OSL_ASSERT(pSocket); in osl_isNonBlockingMode()
2828 if ( pSocket == 0 ) in osl_isNonBlockingMode()
2833 pSocket->m_nLastError=0; in osl_isNonBlockingMode()
2835 flags = fcntl(pSocket->m_Socket, F_GETFL, 0); in osl_isNonBlockingMode()
2846 oslSocketType SAL_CALL osl_getSocketType(oslSocket pSocket) in osl_getSocketType() argument
2851 OSL_ASSERT(pSocket); in osl_getSocketType()
2852 if ( pSocket == 0 ) in osl_getSocketType()
2857 pSocket->m_nLastError=0; in osl_getSocketType()
2859 if(getsockopt(pSocket->m_Socket, in osl_getSocketType()
2866 pSocket->m_nLastError=errno; in osl_getSocketType()
2891 void SAL_CALL osl_psz_getLastSocketErrorDescription(oslSocket pSocket, sal_Char* pBuffer, sal_uInt3… in osl_psz_getLastSocketErrorDescription() argument
2896 if ( pSocket == 0 ) in osl_psz_getLastSocketErrorDescription()
2902 strncpy(pBuffer, strerror(pSocket->m_nLastError), BufferSize-1); in osl_psz_getLastSocketErrorDescription()
2909 oslSocketError SAL_CALL osl_getLastSocketError(oslSocket pSocket) in osl_getLastSocketError() argument
2911 if ( pSocket == 0 ) in osl_getLastSocketError()
2916 return ERROR_FROM_NATIVE(pSocket->m_nLastError); in osl_getLastSocketError()
2979 void SAL_CALL osl_addToSocketSet(oslSocketSet Set, oslSocket pSocket) in osl_addToSocketSet() argument
2984 OSL_ASSERT(pSocket); in osl_addToSocketSet()
2986 if ( Set == 0 || pSocket == 0) in osl_addToSocketSet()
2994 if(pSocket->m_Socket > pSet->m_MaxHandle) in osl_addToSocketSet()
2995 pSet->m_MaxHandle= pSocket->m_Socket; in osl_addToSocketSet()
2996 FD_SET(pSocket->m_Socket, &pSet->m_Set); in osl_addToSocketSet()
3003 void SAL_CALL osl_removeFromSocketSet(oslSocketSet Set, oslSocket pSocket) in osl_removeFromSocketSet() argument
3008 OSL_ASSERT(pSocket); in osl_removeFromSocketSet()
3010 if ( Set == 0 || pSocket == 0) in osl_removeFromSocketSet()
3018 if(pSocket->m_Socket == pSet->m_MaxHandle) in osl_removeFromSocketSet()
3029 FD_CLR(pSocket->m_Socket, &pSet->m_Set); in osl_removeFromSocketSet()
3035 sal_Bool SAL_CALL osl_isInSocketSet(oslSocketSet Set, oslSocket pSocket) in osl_isInSocketSet() argument
3040 OSL_ASSERT(pSocket); in osl_isInSocketSet()
3041 if ( Set == 0 || pSocket == 0 ) in osl_isInSocketSet()
3048 return (FD_ISSET(pSocket->m_Socket, &pSet->m_Set) != 0); in osl_isInSocketSet()