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()
1771 oslSocket pSocket; in osl_createSocket() local
1774 pSocket= __osl_createSocketImpl(OSL_INVALID_SOCKET); in osl_createSocket()
1777 pSocket->m_Socket= socket(FAMILY_TO_NATIVE(Family), in osl_createSocket()
1782 if(pSocket->m_Socket == OSL_INVALID_SOCKET) in osl_createSocket()
1788 __osl_destroySocketImpl((pSocket)); in osl_createSocket()
1789 pSocket= 0; in osl_createSocket()
1794 if ((Flags = fcntl(pSocket->m_Socket, F_GETFD, 0)) != -1) in osl_createSocket()
1797 if (fcntl(pSocket->m_Socket, F_SETFD, Flags) == -1) in osl_createSocket()
1799 pSocket->m_nLastError=errno; in osl_createSocket()
1807 pSocket->m_nLastError=errno; in osl_createSocket()
1811 pSocket->m_CloseCallback = NULL; in osl_createSocket()
1812 pSocket->m_CallbackArg = NULL; in osl_createSocket()
1815 return pSocket; in osl_createSocket()
1818 void SAL_CALL osl_acquireSocket(oslSocket pSocket) in osl_acquireSocket() argument
1820 osl_incrementInterlockedCount( &(pSocket->m_nRefCount ) ); in osl_acquireSocket()
1823 void SAL_CALL osl_releaseSocket( oslSocket pSocket ) in osl_releaseSocket() argument
1825 if( pSocket && 0 == osl_decrementInterlockedCount( &(pSocket->m_nRefCount) ) ) in osl_releaseSocket()
1828 if ( pSocket->m_bIsAccepting == sal_True ) in osl_releaseSocket()
1834 osl_closeSocket( pSocket ); in osl_releaseSocket()
1835 __osl_destroySocketImpl( pSocket ); in osl_releaseSocket()
1844 void SAL_CALL osl_closeSocket(oslSocket pSocket) in osl_closeSocket() argument
1850 if(pSocket==0) in osl_closeSocket()
1853 pSocket->m_nLastError=0; in osl_closeSocket()
1854 nFD = pSocket->m_Socket; in osl_closeSocket()
1859 pSocket->m_Socket = OSL_INVALID_SOCKET; in osl_closeSocket()
1862 pSocket->m_bIsInShutdown = sal_True; in osl_closeSocket()
1864 if ( pSocket->m_bIsAccepting == sal_True ) in osl_closeSocket()
1905 pSocket->m_bIsAccepting = sal_False; in osl_closeSocket()
1910 if (pSocket->m_CloseCallback != NULL) in osl_closeSocket()
1912 pSocket->m_CloseCallback(pSocket->m_CallbackArg); in osl_closeSocket()
1918 pSocket->m_nLastError=errno; in osl_closeSocket()
1922 pSocket->m_Socket = OSL_INVALID_SOCKET; in osl_closeSocket()
1931 oslSocketAddr SAL_CALL osl_getLocalAddrOfSocket(oslSocket pSocket) in osl_getLocalAddrOfSocket() argument
1937 if (pSocket == NULL) /* ENOTSOCK */ in osl_getLocalAddrOfSocket()
1942 if (getsockname(pSocket->m_Socket, &Addr, &AddrLen) == OSL_SOCKET_ERROR) in osl_getLocalAddrOfSocket()
1952 oslSocketAddr SAL_CALL osl_getPeerAddrOfSocket(oslSocket pSocket) in osl_getPeerAddrOfSocket() argument
1957 OSL_ASSERT(pSocket); in osl_getPeerAddrOfSocket()
1958 if ( pSocket == 0 ) in osl_getPeerAddrOfSocket()
1963 pSocket->m_nLastError=0; in osl_getPeerAddrOfSocket()
1966 if(getpeername(pSocket->m_Socket, &Addr, &AddrLen) == OSL_SOCKET_ERROR) in osl_getPeerAddrOfSocket()
1968 pSocket->m_nLastError=errno; in osl_getPeerAddrOfSocket()
1977 sal_Bool SAL_CALL osl_bindAddrToSocket(oslSocket pSocket, in osl_bindAddrToSocket() argument
1982 OSL_ASSERT(pSocket && pAddr ); in osl_bindAddrToSocket()
1983 if ( pSocket == 0 || pAddr == 0 ) in osl_bindAddrToSocket()
1988 pSocket->m_nLastError=0; in osl_bindAddrToSocket()
1990 nRet = bind(pSocket->m_Socket, &(pAddr->m_sockaddr), sizeof(struct sockaddr)); in osl_bindAddrToSocket()
1994 pSocket->m_nLastError=errno; in osl_bindAddrToSocket()
2005 sal_Bool SAL_CALL osl_listenOnSocket(oslSocket pSocket, in osl_listenOnSocket() argument
2010 OSL_ASSERT(pSocket); in osl_listenOnSocket()
2011 if ( pSocket == 0 ) in osl_listenOnSocket()
2016 pSocket->m_nLastError=0; in osl_listenOnSocket()
2018 nRet = listen(pSocket->m_Socket, in osl_listenOnSocket()
2024 pSocket->m_nLastError=errno; in osl_listenOnSocket()
2035 oslSocketResult SAL_CALL osl_connectSocketTo(oslSocket pSocket, in osl_connectSocketTo() argument
2045 OSL_PRECOND(pSocket, "osl_connectSocketTo(): need a valid socket!\n"); in osl_connectSocketTo()
2047 if ( pSocket == 0 ) in osl_connectSocketTo()
2052 pSocket->m_nLastError=0; in osl_connectSocketTo()
2054 if (osl_isNonBlockingMode(pSocket)) in osl_connectSocketTo()
2056 if (connect(pSocket->m_Socket, in osl_connectSocketTo()
2063 pSocket->m_nLastError=EINPROGRESS; in osl_connectSocketTo()
2068 pSocket->m_nLastError=errno; in osl_connectSocketTo()
2074 OSL_VERIFY(osl_enableNonBlockingMode(pSocket, sal_True)); in osl_connectSocketTo()
2077 if(connect(pSocket->m_Socket, in osl_connectSocketTo()
2082 osl_enableNonBlockingMode(pSocket, sal_False); in osl_connectSocketTo()
2091 pSocket->m_nLastError=errno; in osl_connectSocketTo()
2096 osl_enableNonBlockingMode(pSocket, sal_False); in osl_connectSocketTo()
2105 FD_SET(pSocket->m_Socket, &WriteSet); in osl_connectSocketTo()
2106 FD_SET(pSocket->m_Socket, &ExcptSet); in osl_connectSocketTo()
2117 ReadyHandles= select(pSocket->m_Socket+1, in osl_connectSocketTo()
2125 if ( FD_ISSET(pSocket->m_Socket, &WriteSet ) ) in osl_connectSocketTo()
2132 nSockOpt = getsockopt ( pSocket->m_Socket, SOL_SOCKET, SO_ERROR, in osl_connectSocketTo()
2154 pSocket->m_nLastError=errno; in osl_connectSocketTo()
2160 pSocket->m_nLastError=errno; in osl_connectSocketTo()
2164 osl_enableNonBlockingMode(pSocket, sal_False); in osl_connectSocketTo()
2173 oslSocket SAL_CALL osl_acceptConnectionOnSocket(oslSocket pSocket, in osl_acceptConnectionOnSocket() argument
2181 OSL_ASSERT(pSocket); in osl_acceptConnectionOnSocket()
2182 if ( pSocket == 0 ) in osl_acceptConnectionOnSocket()
2187 pSocket->m_nLastError=0; in osl_acceptConnectionOnSocket()
2189 pSocket->m_bIsAccepting = sal_True; in osl_acceptConnectionOnSocket()
2201 Connection = accept(pSocket->m_Socket, &Addr, &AddrLen); in osl_acceptConnectionOnSocket()
2208 pSocket->m_nLastError=errno; in osl_acceptConnectionOnSocket()
2212 pSocket->m_bIsAccepting = sal_False; in osl_acceptConnectionOnSocket()
2221 if ( pSocket->m_bIsInShutdown == sal_True ) in osl_acceptConnectionOnSocket()
2244 pSocket->m_nLastError=errno; in osl_acceptConnectionOnSocket()
2259 pSocket->m_bIsAccepting = sal_False; in osl_acceptConnectionOnSocket()
2267 sal_Int32 SAL_CALL osl_receiveSocket(oslSocket pSocket, in osl_receiveSocket() argument
2274 OSL_ASSERT(pSocket); in osl_receiveSocket()
2275 if ( pSocket == 0 ) in osl_receiveSocket()
2281 pSocket->m_nLastError=0; in osl_receiveSocket()
2285 nRead = recv(pSocket->m_Socket, in osl_receiveSocket()
2293 pSocket->m_nLastError=errno; in osl_receiveSocket()
2308 sal_Int32 SAL_CALL osl_receiveFromSocket(oslSocket pSocket, in osl_receiveFromSocket() argument
2323 OSL_ASSERT(pSocket); in osl_receiveFromSocket()
2324 if ( pSocket == 0 ) in osl_receiveFromSocket()
2330 pSocket->m_nLastError=0; in osl_receiveFromSocket()
2332 nRead = recvfrom(pSocket->m_Socket, in osl_receiveFromSocket()
2341 pSocket->m_nLastError=errno; in osl_receiveFromSocket()
2356 sal_Int32 SAL_CALL osl_sendSocket(oslSocket pSocket, in osl_sendSocket() argument
2363 OSL_ASSERT(pSocket); in osl_sendSocket()
2364 if ( pSocket == 0 ) in osl_sendSocket()
2370 pSocket->m_nLastError=0; in osl_sendSocket()
2374 nWritten = send(pSocket->m_Socket, in osl_sendSocket()
2383 pSocket->m_nLastError=errno; in osl_sendSocket()
2397 sal_Int32 SAL_CALL osl_sendToSocket(oslSocket pSocket, in osl_sendToSocket() argument
2413 OSL_ASSERT(pSocket); in osl_sendToSocket()
2414 if ( pSocket == 0 ) in osl_sendToSocket()
2420 pSocket->m_nLastError=0; in osl_sendToSocket()
2425 nWritten = sendto(pSocket->m_Socket, in osl_sendToSocket()
2434 pSocket->m_nLastError=errno; in osl_sendToSocket()
2449 oslSocket pSocket, void *pBuffer, sal_Int32 n ) in osl_readSocket() argument
2455 OSL_ASSERT( pSocket); in osl_readSocket()
2461 RetVal= osl_receiveSocket(pSocket, in osl_readSocket()
2484 oslSocket pSocket, const void *pBuffer, sal_Int32 n ) in osl_writeSocket() argument
2491 OSL_ASSERT( pSocket ); in osl_writeSocket()
2497 RetVal= osl_sendSocket( pSocket,Ptr,BytesToSend,osl_Socket_MsgNormal); in osl_writeSocket()
2520 oslSocket pSocket, in __osl_socket_poll() argument
2528 OSL_ASSERT(0 != pSocket); in __osl_socket_poll()
2529 if (0 == pSocket) in __osl_socket_poll()
2532 pSocket->m_nLastError = 0; in __osl_socket_poll()
2534 fds.fd = pSocket->m_Socket; in __osl_socket_poll()
2549 pSocket->m_nLastError = errno; in __osl_socket_poll()
2566 oslSocket pSocket, in __osl_socket_poll() argument
2574 OSL_ASSERT(0 != pSocket); in __osl_socket_poll()
2575 if (0 == pSocket) in __osl_socket_poll()
2578 pSocket->m_nLastError = 0; in __osl_socket_poll()
2581 FD_SET(pSocket->m_Socket, &fds); in __osl_socket_poll()
2591 pSocket->m_Socket + 1, in __osl_socket_poll()
2599 pSocket->m_nLastError = errno; in __osl_socket_poll()
2610 return (FD_ISSET(pSocket->m_Socket, &fds) ? sal_True : sal_False); in __osl_socket_poll()
2619 oslSocket pSocket, const TimeValue* pTimeout) in osl_isReceiveReady() argument
2621 OSL_ASSERT(pSocket); in osl_isReceiveReady()
2622 if (pSocket == NULL) in osl_isReceiveReady()
2628 return __osl_socket_poll (pSocket, pTimeout, POLLIN); in osl_isReceiveReady()
2635 oslSocket pSocket, const TimeValue* pTimeout) in osl_isSendReady() argument
2637 OSL_ASSERT(pSocket); in osl_isSendReady()
2638 if (pSocket == NULL) in osl_isSendReady()
2644 return __osl_socket_poll (pSocket, pTimeout, POLLOUT); in osl_isSendReady()
2651 oslSocket pSocket, const TimeValue* pTimeout) in osl_isExceptionPending() argument
2653 OSL_ASSERT(pSocket); in osl_isExceptionPending()
2654 if (pSocket == NULL) in osl_isExceptionPending()
2660 return __osl_socket_poll (pSocket, pTimeout, POLLPRI); in osl_isExceptionPending()
2666 sal_Bool SAL_CALL osl_shutdownSocket(oslSocket pSocket, in osl_shutdownSocket() argument
2671 OSL_ASSERT(pSocket); in osl_shutdownSocket()
2672 if ( pSocket == 0 ) in osl_shutdownSocket()
2677 pSocket->m_nLastError=0; in osl_shutdownSocket()
2679 nRet=shutdown(pSocket->m_Socket, DIRECTION_TO_NATIVE(Direction)); in osl_shutdownSocket()
2682 pSocket->m_nLastError=errno; in osl_shutdownSocket()
2692 sal_Int32 SAL_CALL osl_getSocketOption(oslSocket pSocket, in osl_getSocketOption() argument
2700 OSL_ASSERT(pSocket); in osl_getSocketOption()
2701 if ( pSocket == 0 ) in osl_getSocketOption()
2706 pSocket->m_nLastError=0; in osl_getSocketOption()
2708 if(getsockopt(pSocket->m_Socket, in osl_getSocketOption()
2714 pSocket->m_nLastError=errno; in osl_getSocketOption()
2724 sal_Bool SAL_CALL osl_setSocketOption(oslSocket pSocket, in osl_setSocketOption() argument
2732 OSL_ASSERT(pSocket); in osl_setSocketOption()
2733 if ( pSocket == 0 ) in osl_setSocketOption()
2738 pSocket->m_nLastError=0; in osl_setSocketOption()
2740 nRet = setsockopt(pSocket->m_Socket, in osl_setSocketOption()
2748 pSocket->m_nLastError=errno; in osl_setSocketOption()
2758 sal_Bool SAL_CALL osl_enableNonBlockingMode(oslSocket pSocket, in osl_enableNonBlockingMode() argument
2764 OSL_ASSERT(pSocket); in osl_enableNonBlockingMode()
2765 if ( pSocket == 0 ) in osl_enableNonBlockingMode()
2770 pSocket->m_nLastError=0; in osl_enableNonBlockingMode()
2772 flags = fcntl(pSocket->m_Socket, F_GETFL, 0); in osl_enableNonBlockingMode()
2779 nRet = fcntl(pSocket->m_Socket, F_SETFL, flags); in osl_enableNonBlockingMode()
2783 pSocket->m_nLastError=errno; in osl_enableNonBlockingMode()
2793 sal_Bool SAL_CALL osl_isNonBlockingMode(oslSocket pSocket) in osl_isNonBlockingMode() argument
2797 OSL_ASSERT(pSocket); in osl_isNonBlockingMode()
2798 if ( pSocket == 0 ) in osl_isNonBlockingMode()
2803 pSocket->m_nLastError=0; in osl_isNonBlockingMode()
2805 flags = fcntl(pSocket->m_Socket, F_GETFL, 0); in osl_isNonBlockingMode()
2816 oslSocketType SAL_CALL osl_getSocketType(oslSocket pSocket) in osl_getSocketType() argument
2821 OSL_ASSERT(pSocket); in osl_getSocketType()
2822 if ( pSocket == 0 ) in osl_getSocketType()
2827 pSocket->m_nLastError=0; in osl_getSocketType()
2829 if(getsockopt(pSocket->m_Socket, in osl_getSocketType()
2836 pSocket->m_nLastError=errno; in osl_getSocketType()
2861 void SAL_CALL osl_psz_getLastSocketErrorDescription(oslSocket pSocket, sal_Char* pBuffer, sal_uInt3… in osl_psz_getLastSocketErrorDescription() argument
2866 if ( pSocket == 0 ) in osl_psz_getLastSocketErrorDescription()
2872 strncpy(pBuffer, strerror(pSocket->m_nLastError), BufferSize-1); in osl_psz_getLastSocketErrorDescription()
2879 oslSocketError SAL_CALL osl_getLastSocketError(oslSocket pSocket) in osl_getLastSocketError() argument
2881 if ( pSocket == 0 ) in osl_getLastSocketError()
2886 return ERROR_FROM_NATIVE(pSocket->m_nLastError); in osl_getLastSocketError()
2949 void SAL_CALL osl_addToSocketSet(oslSocketSet Set, oslSocket pSocket) in osl_addToSocketSet() argument
2954 OSL_ASSERT(pSocket); in osl_addToSocketSet()
2956 if ( Set == 0 || pSocket == 0) in osl_addToSocketSet()
2964 if(pSocket->m_Socket > pSet->m_MaxHandle) in osl_addToSocketSet()
2965 pSet->m_MaxHandle= pSocket->m_Socket; in osl_addToSocketSet()
2966 FD_SET(pSocket->m_Socket, &pSet->m_Set); in osl_addToSocketSet()
2973 void SAL_CALL osl_removeFromSocketSet(oslSocketSet Set, oslSocket pSocket) in osl_removeFromSocketSet() argument
2978 OSL_ASSERT(pSocket); in osl_removeFromSocketSet()
2980 if ( Set == 0 || pSocket == 0) in osl_removeFromSocketSet()
2988 if(pSocket->m_Socket == pSet->m_MaxHandle) in osl_removeFromSocketSet()
2999 FD_CLR(pSocket->m_Socket, &pSet->m_Set); in osl_removeFromSocketSet()
3005 sal_Bool SAL_CALL osl_isInSocketSet(oslSocketSet Set, oslSocket pSocket) in osl_isInSocketSet() argument
3010 OSL_ASSERT(pSocket); in osl_isInSocketSet()
3011 if ( Set == 0 || pSocket == 0 ) in osl_isInSocketSet()
3018 return (FD_ISSET(pSocket->m_Socket, &pSet->m_Set) != 0); in osl_isInSocketSet()