Skip to content

Commit

Permalink
+ Linux compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
ru committed Jun 18, 2014
1 parent 00bb767 commit d638cbd
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 8 deletions.
39 changes: 39 additions & 0 deletions lib/oexlib/src/os/posix/ip_address.cpp
Expand Up @@ -470,3 +470,42 @@ oexBOOL CIpAddress::LookupHost( oexCSTR x_pServer, oexINT32 x_uPort, oexINT32 x_

}

CPropertyBag CIpAddress::Lookup( oexCSTR x_pServer )
{_STT();

CStr sServer( x_pServer );
if ( !sServer.Length() )
sServer = GetHostName();

// Ensure we have a name
if ( !sServer.Length() )
return CPropertyBag();

// First try to interpret as dot address
struct hostent *pHe = gethostbyname( oexStrToStr8Ptr( x_pServer ) );

if ( !pHe )
return CPropertyBag();

CPropertyBag pb;
for ( int i = 0; pHe->h_addr_list[ i ]; i++ )
{
in_addr *pia = (in_addr*)pHe->h_addr_list[ i ];
if ( oexVERIFY_PTR( pia ) )
pb[ oexMks( i ) ] = oexStr8ToStr( inet_ntoa( *pia ) );

} // end for

return pb;
}


oexUINT CIpAddress::Arp( oexCSTR x_pDst, oexCSTR x_pSrc, oexBYTE *x_pAddr )
{
return 0;
}

CPropertyBag CIpAddress::GetArpTable()
{
return CPropertyBag();
}
21 changes: 18 additions & 3 deletions lib/oexlib/src/os/posix/sys.cpp
Expand Up @@ -199,7 +199,7 @@ oexINT CSys::ShowMessageBox( oexCSTR x_pTitle, oexCSTR x_pStr )

oexCPVOID CSys::GetInstanceHandle()
{
return (oexCPVOID)getpid();
return (oexCPVOID)(oexLONG)getpid();
}

oexBOOL CSys::SetThreadPriority( oexINT x_nPriority )
Expand Down Expand Up @@ -572,7 +572,7 @@ int CSys::Print( oexCSTRW x_pFmt, ... )
{
CStrW s;
oexVaList ap; oexVaStart( ap, x_pFmt );
s.vFmt( x_pFmt, (va_list)ap );
s.vFmt( x_pFmt, ap );
oexVaEnd( ap );
Echo( s.Ptr() );
return s.Length();
Expand Down Expand Up @@ -1061,7 +1061,7 @@ int CSys::Print( oexCSTR8 x_pFmt, ... )
{
CStr8 s;
oexVaList ap; oexVaStart( ap, x_pFmt );
s.vFmt( x_pFmt, (va_list)ap );
s.vFmt( x_pFmt, ap );
oexVaEnd( ap );
Echo( s.Ptr() );
return s.Length();
Expand Down Expand Up @@ -1211,6 +1211,21 @@ oexBOOL CSys::Shell( oexCSTR x_pFile, oexCSTR x_pParams, oexCSTR x_pDirectory )
return system( oexStrToMb( sCmd ).Ptr() ) ? oexTRUE : oexFALSE;
}

oexUINT CSys::GetCurrentProcessId()
{
return 0;
}

oexUINT CSys::GetProcessVersion( oexUINT uPid )
{
return 0;
}

oexINT CSys::KillProcess( oexINT nPid, oexUINT uTimeout, oexUINT uExit )
{
return 0;
}

oexUINT CSys::StartProcess( oexCSTR x_pFile, oexCSTR x_pParams, oexCSTR x_pDirectory )
{
if ( !oexCHECK_PTR( x_pFile ) )
Expand Down
10 changes: 10 additions & 0 deletions lib/oexlib/src/os/posix/sys_util.cpp
Expand Up @@ -502,3 +502,13 @@ oexINT CSysUtil::i_cpuid( int *reg, oexINT i )
return 1;
#endif
}

oexINT CSysUtil::GetProcessList( CPropertyBag *pb, bool bProcessInfo )
{
return -1;
}

oexINT CSysUtil::GetProcessInfo( oexLONG lPid, CPropertyBag *pb )
{
return -1;
}
2 changes: 2 additions & 0 deletions sq/sntpsync/Makefile
Expand Up @@ -24,11 +24,13 @@ include $(PRJ_LIBROOT)/config.mk
#-------------------------------------------------------------------
# Add resources
#-------------------------------------------------------------------
ifeq ($(OS),windows)
export LOC_TAG := rc
LOC_CXX_rc := rc
LOC_BLD_rc := rc
LOC_SRC_rc := res
include $(PRJ_LIBROOT)/build.mk
endif

#-------------------------------------------------------------------
# Execute the build
Expand Down
2 changes: 1 addition & 1 deletion sqmod/sqmod_portaudio/Makefile
Expand Up @@ -12,7 +12,7 @@ PRJ_DEPS := portaudio
PRJ_TYPE := dll
PRJ_INCS := winglib/lib/oexlib winglib/lib/sqbind SqPlus/include SqPlus/sqplus \
portaudio/include
PRJ_LIBS := sqbind oexlib sqplus sqstdlib squirrel CxImage jpeg png zlib tiff \
PRJ_LIBS := sqbind oexlib sqplus sqstdlib squirrel cximage jpeg png zlib tiff \
portaudio
PRJ_DEFS :=

Expand Down
14 changes: 11 additions & 3 deletions sqmod/sqmod_rtmpd/rtmpd_session.cpp
@@ -1,8 +1,12 @@

#include "stdafx.h"

#include <winsock2.h>
#include <windows.h>
#if defined( OEX_WINODWS )
# include <winsock2.h>
# include <windows.h>
#else
# include <sys/socket.h>
#endif

#if defined( _DEBUG )
extern "C"
Expand Down Expand Up @@ -141,7 +145,7 @@ int CRtmpdSession::setTimeout( int nMs )
return 0;


#if defined( _WIN32 )
#if defined( OEX_WINDOWS )

// Set the recv and send timeouts
return ( setsockopt( m_session.m_sb.sb_socket, SOL_SOCKET, SO_RCVTIMEO, (const char *)&nMs, sizeof( nMs ) )
Expand Down Expand Up @@ -198,10 +202,14 @@ int CRtmpdSession::Init( sqbind::CSqSocket *pSocket )
// Give the rtmpd object control of the socket handle
m_session.m_sb.sb_socket = oexPtrToInt( pSocket->Ptr()->Detach() );

#if defined( OEX_WINDOWS )

// Disable Nagle's algorithm
int on = 1;
setsockopt( m_session.m_sb.sb_socket, IPPROTO_TCP, TCP_NODELAY, (char*)&on, sizeof( on ) );

#endif

// Attempt handshake
if ( !RTMP_Serve( &m_session ) )
{ setLastErrorStr( oexT( "RTMP handshake failed" ) );
Expand Down
2 changes: 1 addition & 1 deletion sqmod/sqmod_tinyxml/Makefile
Expand Up @@ -10,7 +10,7 @@ default_target: all
PRJ_NAME := sqmod_tinyxml
PRJ_TYPE := dll
PRJ_INCS := winglib/lib/oexlib winglib/lib/sqbind SqPlus/include SqPlus/sqplus tinyxml
PRJ_LIBS := sqbind oexlib sqplus sqstdlib squirrel tinyxml CxImage jpeg png zlib
PRJ_LIBS := sqbind oexlib sqplus sqstdlib squirrel tinyxml cximage jpeg png zlib
PRJ_DEFS := TIXML_USE_STL

PRJ_EXPORTS := SRV_GetModuleInfo SRV_Start SRV_Stop SQBIND_Export_Symbols
Expand Down

0 comments on commit d638cbd

Please sign in to comment.