Repository: stweil/OSXvnc Branch: main Commit: 4c8eb1d11967 Files: 280 Total size: 2.2 MB Directory structure: gitextract_7q6g2gu1/ ├── .github/ │ └── workflows/ │ └── dco.yml ├── .gitignore ├── .gitmodules ├── .travis.yml ├── Base.lproj/ │ └── MainMenu.xib ├── Bundles/ │ ├── Echoware/ │ │ ├── ACConnection.cpp │ │ ├── ACConnection.h │ │ ├── AES.cpp │ │ ├── AES.h │ │ ├── APISocket/ │ │ │ ├── APISocket.h │ │ │ ├── ClientSocket.cpp │ │ │ ├── ServerSocket.cpp │ │ │ └── Socket.cpp │ │ ├── CritSection.cpp │ │ ├── CritSection.h │ │ ├── DataChannel.cpp │ │ ├── DataChannel.h │ │ ├── DataChannelSocket.cpp │ │ ├── DataChannelSocket.h │ │ ├── DataChannel_timer.cpp │ │ ├── DataChannels.cpp │ │ ├── DataChannels.h │ │ ├── DirService.cpp │ │ ├── DirService.h │ │ ├── DllProxyInfo.cpp │ │ ├── DllProxyInfo.h │ │ ├── EchoController.h │ │ ├── EchoController.m │ │ ├── EchoSrvDataChannel.cpp │ │ ├── EchoSrvDataChannel.h │ │ ├── EchoToOSX.cpp │ │ ├── EchoToOSX.h │ │ ├── Echoware.cpp │ │ ├── Echoware.dsp │ │ ├── Echoware.dsw │ │ ├── Echoware.h │ │ ├── Echoware.sln │ │ ├── Echoware.suo │ │ ├── Echoware.vcproj │ │ ├── Echoware.xcodeproj/ │ │ │ ├── admin.mode1 │ │ │ ├── admin.pbxuser │ │ │ └── project.pbxproj │ │ ├── Echoware_Prefix.pch │ │ ├── English.lproj/ │ │ │ ├── EchoServers.nib/ │ │ │ │ ├── classes.nib │ │ │ │ ├── info.nib │ │ │ │ └── keyedobjects.nib │ │ │ └── InfoPlist.strings │ │ ├── Globals.cpp │ │ ├── Globals.h │ │ ├── Info.plist │ │ ├── InterfaceDllProxyInfo.h │ │ ├── LICENSE.txt │ │ ├── LocalDataChannel.cpp │ │ ├── LocalDataChannel.h │ │ ├── LocalListener.cpp │ │ ├── LocalListener.h │ │ ├── LocalProxyConnection.cpp │ │ ├── LocalProxyConnection.h │ │ ├── Logger.cpp │ │ ├── Logger.h │ │ ├── MyDllProxyInfo.cpp │ │ ├── MyDllProxyInfo.h │ │ ├── NetPacket.h │ │ ├── OpenSSL/ │ │ │ ├── LibeaySt.dsp │ │ │ ├── LibeaySt.vcproj │ │ │ ├── aes.h │ │ │ ├── aes_core.c │ │ │ ├── aes_locl.h │ │ │ ├── e_os2.h │ │ │ └── opensslconf.h │ │ ├── ProxiesManager.cpp │ │ ├── ProxiesManager.h │ │ ├── ProxyConnect/ │ │ │ ├── ProxyConnect.cpp │ │ │ ├── ProxyConnect.dsp │ │ │ ├── ProxyConnect.h │ │ │ ├── ProxyConnect.vcproj │ │ │ ├── global.h │ │ │ ├── md4.cpp │ │ │ ├── md4.h │ │ │ ├── md5.cpp │ │ │ ├── md5.h │ │ │ ├── ntlm.h │ │ │ ├── ntlmv2.cpp │ │ │ ├── stdafx.cpp │ │ │ └── stdafx.h │ │ ├── ProxyConnection.cpp │ │ ├── ProxyConnection.h │ │ ├── README.txt │ │ ├── RFBBundleWrapper.cpp │ │ ├── RFBBundleWrapper.h │ │ ├── RSA/ │ │ │ ├── Code.cpp │ │ │ ├── Commonf.cpp │ │ │ ├── Commonf.h │ │ │ ├── Function.h │ │ │ ├── Gsimply.cpp │ │ │ ├── Gsimply.h │ │ │ ├── HNumber.h │ │ │ ├── Hnfunct.cpp │ │ │ ├── Hnfunct.h │ │ │ ├── Hnumber.cpp │ │ │ ├── Keys.cpp │ │ │ ├── Keys_main.cpp │ │ │ ├── MyNum.h │ │ │ ├── MyTypes.h │ │ │ ├── Mynum.cpp │ │ │ ├── Myprint.cpp │ │ │ ├── Myprint.h │ │ │ ├── Operator.cpp │ │ │ ├── Operator.h │ │ │ ├── PrimeGen.cpp │ │ │ ├── Profiler.h │ │ │ ├── RSA.dsp │ │ │ ├── RSA.vcproj │ │ │ ├── StdAfx.h │ │ │ ├── TMSG.H │ │ │ └── stdafx.cpp │ │ ├── RSAKeys.cpp │ │ ├── RSAKeys.h │ │ ├── ServerListSynchronize.cpp │ │ ├── ServerListSynchronize.h │ │ ├── User.cpp │ │ ├── User.h │ │ ├── blowfish.cpp │ │ ├── blowfish.h │ │ ├── blowfish.h2 │ │ ├── rfbserver.cpp │ │ ├── rfbserver.h │ │ ├── stdafx.cpp │ │ ├── stdafx.h │ │ └── version.plist │ ├── Jaguar/ │ │ ├── JaguarBundle-Info.plist │ │ ├── JaguarExtensions.h │ │ └── JaguarExtensions.m │ ├── RFBBundleProtocol.h │ ├── Tiger/ │ │ ├── TigerBundle-Info.plist │ │ ├── TigerExtensions.h │ │ └── TigerExtensions.m │ ├── VNCBundle.h │ └── VNCBundle.m ├── English.lproj/ │ └── MainMenu.nib/ │ ├── classes.nib │ ├── info.nib │ └── keyedobjects.nib ├── French.lproj/ │ ├── Credits.rtf │ └── MainMenu.nib/ │ ├── classes.nib │ ├── info.nib │ └── objects.nib ├── German.lproj/ │ ├── Credits.rtf │ └── MainMenu.nib/ │ ├── classes.nib │ ├── info.nib │ └── objects.nib ├── Italian.lproj/ │ ├── Copying.rtf │ ├── Credits.rtf │ └── MainMenu.nib/ │ ├── classes.nib │ ├── info.nib │ └── objects.nib ├── Japanese.lproj/ │ ├── Credits.rtf │ └── MainMenu.nib/ │ ├── classes.nib │ ├── info.nib │ └── objects.nib ├── LICENSE ├── NSAuthorization.h ├── NSAuthorization.m ├── OSXvnc/ │ ├── OSXvnc │ ├── OSXvnc-keepalive │ ├── Resources/ │ │ └── English.lproj/ │ │ └── Localizable.strings │ └── StartupParameters.plist ├── OSXvnc-server/ │ ├── CGS.h │ ├── COPYING │ ├── Makefile │ ├── VNCServer.h │ ├── VNCServer.m │ ├── auth.c │ ├── corre.c │ ├── cutpaste.c │ ├── d3des.c │ ├── d3des.h │ ├── dimming.c │ ├── getMACAddress.c │ ├── getMACAddress.h │ ├── hextile.c │ ├── include/ │ │ ├── X11/ │ │ │ ├── X.h │ │ │ ├── Xalloca.h │ │ │ ├── Xfuncproto.h │ │ │ ├── Xfuncs.h │ │ │ ├── Xmd.h │ │ │ ├── Xos.h │ │ │ ├── Xosdefs.h │ │ │ ├── Xproto.h │ │ │ ├── Xprotostr.h │ │ │ ├── keysym.h │ │ │ └── keysymdef.h │ │ └── Xserver/ │ │ ├── colormap.h │ │ ├── cursor.h │ │ ├── dix.h │ │ ├── gc.h │ │ ├── input.h │ │ ├── misc.h │ │ ├── miscstruct.h │ │ ├── opaque.h │ │ ├── os.h │ │ ├── pixmap.h │ │ ├── region.h │ │ ├── regionstr.h │ │ ├── screenint.h │ │ ├── scrnintstr.h │ │ ├── validate.h │ │ └── window.h │ ├── kbdptr.c │ ├── kbdptr.h │ ├── libvncauth/ │ │ └── Makefile │ ├── main.c │ ├── miregion.c │ ├── mousecursor.c │ ├── rdr/ │ │ ├── Exception.h │ │ ├── FdInStream.cxx │ │ ├── FdInStream.h │ │ ├── FdOutStream.cxx │ │ ├── FdOutStream.h │ │ ├── FixedMemOutStream.h │ │ ├── InStream.cxx │ │ ├── InStream.h │ │ ├── Makefile │ │ ├── Makefile.in │ │ ├── MemInStream.h │ │ ├── MemOutStream.h │ │ ├── NullOutStream.cxx │ │ ├── NullOutStream.h │ │ ├── OutStream.h │ │ ├── ZlibInStream.cxx │ │ ├── ZlibInStream.h │ │ ├── ZlibOutStream.cxx │ │ ├── ZlibOutStream.h │ │ └── types.h │ ├── rfb.h │ ├── rfbproto.h │ ├── rfbserver.c │ ├── rfbserver.h │ ├── rre.c │ ├── screencapture.c │ ├── screencapture.h │ ├── sockets.c │ ├── stats.c │ ├── storepasswd.c │ ├── tableinitcmtemplate.c │ ├── tableinittctemplate.c │ ├── tabletranstemplate.c │ ├── tight.c │ ├── tight.h │ ├── translate.c │ ├── vncauth.c │ ├── vncauth.h │ ├── xalloc.c │ ├── zlib.c │ ├── zlibhex.c │ ├── zrle.cc │ └── zrleEncode.h ├── OSXvnc.html ├── OSXvnc.icns ├── OSXvnc.tiff ├── OSXvnc.xcodeproj/ │ └── project.pbxproj ├── OSXvnc_small.tiff ├── README.md ├── VNCController.h ├── VNCController.m ├── Version.txt ├── VineServer-Info.plist ├── VineServer.icns ├── build-libjpeg-turbo.sh ├── de.lproj/ │ ├── Copying.rtf │ └── Localizable.strings ├── en.lproj/ │ ├── Copying.rtf │ ├── Credits.rtf │ ├── Localizable.strings │ └── Vine Server Release Notes.rtf ├── fr.lproj/ │ ├── Copying.rtf │ └── Localizable.strings ├── it.lproj/ │ └── Localizable.strings ├── ja.lproj/ │ ├── Copying.rtf │ └── Localizable.strings └── main.m ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/workflows/dco.yml ================================================ # .github/workflows/dco.yml name: DCO on: pull_request: push: branches: - main jobs: check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Set up Python 3.x uses: actions/setup-python@v4 with: python-version: '3.x' - name: Check DCO env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | pip3 install -U dco-check dco-check ================================================ FILE: .gitignore ================================================ /OSXvnc.xcodeproj/project.xcworkspace /OSXvnc.xcodeproj/xcuserdata/ # xcodebuild -configuration Deployment /build ================================================ FILE: .gitmodules ================================================ [submodule "libjpeg-turbo"] path = libjpeg-turbo url = https://github.com/libjpeg-turbo/libjpeg-turbo.git ================================================ FILE: .travis.yml ================================================ # Travis CI for OSXvnc. os: osx osx_image: xcode12.2 addons: before_deploy: before_install: branches: compiler: deploy: dist: matrix: notification: sudo: # TODO install: # libjpeg is already installed. # - brew install libjpeg # Patch project configuration to use installed libjpeg. - ruby -pi -e 'gsub("libturbojpeg", "libjpeg")' OSXvnc.xcodeproj/project.pbxproj - ruby -pi -e 'gsub("/opt/libjpeg-turbo", "/usr/local")' OSXvnc.xcodeproj/project.pbxproj script: - ./build-libjpeg-turbo.sh - xcodebuild ================================================ FILE: Base.lproj/MainMenu.xib ================================================ Display Number for VNC Server Note: This number+5900 is the port that will be used Display Number for VNC Server Note: This number+5900 is the port that will be used Display Number for VNC Server Note: This number+5900 is the port that will be used Port Number that VNC will use to communicate. Note: Same as Display Number+5900 Note: Same as Display Number+5900 Password required to connect with VNC Clients Note: Password length is not preserved Checking this box swaps the middle and right mouse buttons. By convention the buttons sent by VNC client is in the opposite order as Mac OS X buttons. DQ Host Name1 Host Name2 Host Name3 Display Number for VNC Server Note: This number+5900 is the port that will be used The System Server will start when the machine boots and display the console screen independent of users' desktop servers. Specify connection preferences for the system server above. Other preferences are shared with desktop servers. Clipboard sharing is unavailable prior to Mac OS X 10.5 Display Number for VNC Server Note: This number+5900 is the port that will be used Display Number for VNC Server Note: This number+5900 is the port that will be used Port Number that VNC will use to communicate. Note: Same as Display Number+5900 Note: Same as Display Number+5900 Password required to connect with VNC Client. Note: Size is not preserved Display Number for VNC Server Note: This number+5900 is the port that will be used Password required to connect with VNC Client. Note: Password length is not preserved ================================================ FILE: Bundles/Echoware/ACConnection.cpp ================================================ #include "StdAfx.h" #include "acconnection.h" #include "ProxyConnection.h" #include "DllProxyInfo.h" #include "NetPacket.h" #include #include #include //#include using namespace APISocket; //time for send live message #define SEND_LIVE_MESSAGE 10000 CACConnection::CACConnection(CProxyConnection* pProxyConnection) : CClientSocket() { m_pProxyConnection = pProxyConnection; m_nEncryptionLevel = 1; m_bConnected = false; m_bStopConnecting = false; m_dwConnectingStatus=0; m_pReadBuffer = new CBuffer(); m_pSendBuffer = new CBuffer(); m_dwLastIsAliveMsg = GetTickCount(); } CACConnection::~CACConnection(void) { StopSend(THREAD_STOP_TIMEOUT); Close(); delete m_pReadBuffer; delete m_pSendBuffer; } void CACConnection::StopConnect() { m_bStopConnecting = true; } //connect the socket to szIP on port nPort //first, try directly and if failed then try use proxy settings bool CACConnection::Connect(const char* szIP, unsigned int nPort) { bool res = false; if (CClientSocket::Connect(szIP, nPort) == 0) res = true; if (!res) res = g_globals.m_proxiesManager.ConnectViaProxy(this, szIP, nPort); return res; } //try connect to echoServer int CACConnection::Connect() { int nRet=CONNECTION_SUCCESSFUL; if (m_bConnected) { m_pProxyConnection->GetProxyInfo()->SetStatus(STATUS_CONNECTING, false); m_pProxyConnection->GetProxyInfo()->SetStatus(STATUS_AUTHENTICATING, false); m_pProxyConnection->GetProxyInfo()->SetStatus(STATUS_AUTHENTICATION_FAILED, false); m_pProxyConnection->GetProxyInfo()->SetStatus(STATUS_ESTABLISHING_DATA_CHANNEL, false); m_pProxyConnection->GetProxyInfo()->SetStatus(STATUS_SEARCHING_FOR_PARTNER, false); m_pProxyConnection->GetProxyInfo()->SetStatus(STATUS_DISCONNECTED_FROM_PROXY, false); m_pProxyConnection->GetProxyInfo()->SetStatus(STATUS_CONNECTED, true); return PROXY_ALREADY_CONNECTED; } //create the socket Create(); g_globals.m_logger.Write("CACConnection: Enter connect"); m_critSection.Lock(); CDllProxyInfo* pProxyInfo = m_pProxyConnection->GetProxyInfo(); if (pProxyInfo->GetConnectTimeout()!=-1) { g_globals.m_logger.WriteFormated("CACConnection: Timeout=%d", pProxyInfo->GetConnectTimeout()); //set the connection timeout CClientSocket::SetTimeouts(pProxyInfo->GetConnectTimeout()*1000); SetBlockMode(false); } pProxyInfo->SetStatus(STATUS_DISCONNECTED_FROM_PROXY, false); g_globals.m_logger.WriteFormated("\tCACConnection: Try connect %s:%s %s", pProxyInfo->GetIP(), pProxyInfo->GetPort(), pProxyInfo->GetMyID()); //connect bool a = Connect(pProxyInfo->GetIP(), atoi(pProxyInfo->GetPort())); if (a) { CClientSocket::SetTimeouts(pProxyInfo->GetConnectTimeout()*1000, pProxyInfo->GetSendTimeout()*1000, pProxyInfo->GetReceiveTimeout()*1000); unsigned int conn_timeout = (unsigned int)pProxyInfo->GetConnectTimeout() * 1000; m_pReadBuffer->Empty(); m_pSendBuffer->Empty(); m_dwConnectingStatus = STATUS_CONNECTING; m_bConnected = true; StartRoutine(); SendMessage(MSG_PROXY_CONNECTED, 0, 0); if (errored) m_bStopConnecting = true; g_globals.m_logger.Write("\t\tCACConnection: connected"); DWORD dwStartTime = GetTickCount(); while (m_dwConnectingStatus != STATUS_CONNECTED && m_dwConnectingStatus != STATUS_AUTHENTICATION_FAILED) { if (m_bStopConnecting) break; Sleep(5000); if (GetTickCount() - dwStartTime > conn_timeout) break; } g_globals.m_logger.Write("\t\tCACConnection: connected2"); switch(m_dwConnectingStatus) { case STATUS_CONNECTED: m_bConnected = true; nRet=CONNECTION_SUCCESSFUL; pProxyInfo->SetStatus(STATUS_CONNECTING, false); pProxyInfo->SetStatus(STATUS_AUTHENTICATING, false); pProxyInfo->SetStatus(STATUS_AUTHENTICATION_FAILED, false); pProxyInfo->SetStatus(STATUS_ESTABLISHING_DATA_CHANNEL, false); pProxyInfo->SetStatus(STATUS_SEARCHING_FOR_PARTNER, false); pProxyInfo->SetStatus(STATUS_DISCONNECTED_FROM_PROXY, false); pProxyInfo->SetStatus(STATUS_CONNECTED, true); pProxyInfo->SetReconnectProxy(true); break; case STATUS_AUTHENTICATION_FAILED: m_bConnected = true; nRet=AUTHENTICATION_FAILED; pProxyInfo->SetStatus(STATUS_CONNECTING, false); pProxyInfo->SetStatus(STATUS_AUTHENTICATING, false); pProxyInfo->SetStatus(STATUS_AUTHENTICATION_FAILED, true); pProxyInfo->SetStatus(STATUS_ESTABLISHING_DATA_CHANNEL, false); pProxyInfo->SetStatus(STATUS_SEARCHING_FOR_PARTNER, false); pProxyInfo->SetStatus(STATUS_DISCONNECTED_FROM_PROXY, false); pProxyInfo->SetStatus(STATUS_CONNECTED, false); pProxyInfo->SetReconnectProxy(false); break; case STATUS_AUTHENTICATING: m_bConnected = false; nRet=CONNECTION_TIMED_OUT; pProxyInfo->SetStatus(STATUS_CONNECTING, false); pProxyInfo->SetStatus(STATUS_AUTHENTICATING, false); pProxyInfo->SetStatus(STATUS_AUTHENTICATION_FAILED, false); pProxyInfo->SetStatus(STATUS_ESTABLISHING_DATA_CHANNEL, false); pProxyInfo->SetStatus(STATUS_SEARCHING_FOR_PARTNER, false); pProxyInfo->SetStatus(STATUS_DISCONNECTED_FROM_PROXY, true); pProxyInfo->SetStatus(STATUS_CONNECTED, false); break; case STATUS_CONNECTING: m_bConnected = false; nRet=CONNECTION_TIMED_OUT; pProxyInfo->SetStatus(STATUS_CONNECTING, false); pProxyInfo->SetStatus(STATUS_AUTHENTICATING, false); pProxyInfo->SetStatus(STATUS_AUTHENTICATION_FAILED, false); pProxyInfo->SetStatus(STATUS_ESTABLISHING_DATA_CHANNEL, false); pProxyInfo->SetStatus(STATUS_SEARCHING_FOR_PARTNER, false); pProxyInfo->SetStatus(STATUS_DISCONNECTED_FROM_PROXY, true); pProxyInfo->SetStatus(STATUS_CONNECTED, false); break; case STATUS_DISCONNECTED_FROM_PROXY: m_bConnected = false; nRet=ERROR_CONNECTING_TO_PROXY; pProxyInfo->SetStatus(STATUS_CONNECTING, false); pProxyInfo->SetStatus(STATUS_AUTHENTICATING, false); pProxyInfo->SetStatus(STATUS_AUTHENTICATION_FAILED, false); pProxyInfo->SetStatus(STATUS_ESTABLISHING_DATA_CHANNEL, false); pProxyInfo->SetStatus(STATUS_SEARCHING_FOR_PARTNER, false); pProxyInfo->SetStatus(STATUS_DISCONNECTED_FROM_PROXY, true); pProxyInfo->SetStatus(STATUS_CONNECTED, false); break; } } else { m_bConnected = false; pProxyInfo->SetStatus(STATUS_CONNECTED, false); nRet = NO_PROXY_SERVER_FOUND_TO_CONNECT; g_globals.m_logger.WriteFormated("\t\tCACConnection: not connected error: %d", CClientSocket::GetLastError()); } g_globals.m_logger.Write("\tCACConnection: End Try connect"); m_critSection.Unlock(); g_globals.m_logger.Write("CACConnection: Exit connect"); m_bStopConnecting = false; return nRet; } //disconnect from echoServer bool CACConnection::Disconnect() { bool bRet = true; m_bStopConnecting = true; m_critSection.Lock(); StopSend(THREAD_STOP_TIMEOUT); if (m_bConnected) { bRet = CClientSocket::Close(); m_bConnected = !m_bConnected; } m_bStopConnecting = false; m_critSection.Unlock(); return bRet; } //sets the encryption level void CACConnection::SetEncryptionLevel(int level) { m_critSection.Lock(); m_nEncryptionLevel = level; m_critSection.Unlock(); } //process messages received from echoserver //there are received some data and try to process it //it is a notify message from CClientSocket void CACConnection::OnReceive(char* buff, int len) { m_pReadBuffer->Write(buff, len); char szProxyEcho[sizeof(PROXY_ECHO)]; if (m_pReadBuffer->Peak(szProxyEcho, sizeof(PROXY_ECHO))!=sizeof(PROXY_ECHO)) { if (!strcmp(szProxyEcho, PROXY_ECHO)) { m_pReadBuffer->Read(szProxyEcho, sizeof(PROXY_ECHO)); return; } } DWORD lenMsg=0; if (m_pReadBuffer->Peak(&lenMsg, sizeof(DWORD))!=sizeof(DWORD)) return; lenMsg=OSSwapLittleToHostInt32(lenMsg); char* msg=new char[lenMsg]; if (m_pReadBuffer->Peak(msg, lenMsg)!=lenMsg) { delete []msg; return; } m_pReadBuffer->Drop(lenMsg); NetPacketHeader netPacketHeader; memcpy(&netPacketHeader, msg+sizeof(DWORD), sizeof(NetPacketHeader)); netPacketHeader.len = OSSwapLittleToHostInt32(netPacketHeader.len); CProxyMsg* pProxyMsg=(CProxyMsg*)(msg+sizeof(DWORD)+sizeof(NetPacketHeader)); pProxyMsg->messageid = OSSwapLittleToHostInt32(pProxyMsg->messageid); pProxyMsg->datalength = OSSwapLittleToHostInt32(pProxyMsg->datalength); char* pData=0; if (pProxyMsg->datalength) pData=((char*)pProxyMsg)+sizeof(CProxyMsg); if (pProxyMsg->messageid==MSG_PROXY_CONNECTED) { g_globals.m_logger.Write("CACConnection: Receive MSG_PROXY_CONNECTED"); m_pProxyConnection->GetProxyInfo()->SetStatus(STATUS_DISCONNECTED_FROM_PROXY, false); m_rsaKeys.Generate(); SendMessage(MSG_PROXY_PUBLICKEY, (char*)m_rsaKeys.m_pPublicKeyLE, m_rsaKeys.GetPublicKeyLength()); } else if (pProxyMsg->messageid==MSG_PROXY_PUBLICKEY) { g_globals.m_logger.Write("CACConnection: Receive MSG_PROXY_PUBLICKEY"); m_pProxyConnection->GetProxyInfo()->SetStatus(STATUS_AUTHENTICATING, true); m_dwConnectingStatus=STATUS_AUTHENTICATING; SendEncryptedPass(pData, pProxyMsg->datalength); } else if (pProxyMsg->messageid==MSG_PROXY_HANDSHAKEFAILED) { CClientSocket::Close(); m_bConnected=false; m_pProxyConnection->GetProxyInfo()->SetStatus(STATUS_AUTHENTICATION_FAILED, true); m_pProxyConnection->GetProxyInfo()->SetStatus(STATUS_AUTHENTICATING, false); g_globals.m_logger.Write("CACConnection: Receive MSG_PROXY_HANDSHAKEFAILED"); m_dwConnectingStatus=STATUS_AUTHENTICATION_FAILED; } else if (pProxyMsg->messageid==MSG_PROXY_HANDSHAKECONFIRM) { m_pProxyConnection->GetProxyInfo()->SetStatus(STATUS_DISCONNECTED_FROM_PROXY, false); char szServerName[ID_STRING_SIZE]; strcpy(szServerName, pData); if (strlen(szServerName)) m_pProxyConnection->GetProxyInfo()->SetName(szServerName); else m_pProxyConnection->GetProxyInfo()->SetName((char*)m_pProxyConnection->GetProxyInfo()->GetIP()); //1.926 char szPublicIP[ID_STRING_SIZE]; char szUserID[ID_STRING_SIZE]; memset(szPublicIP, 0, ID_STRING_SIZE); memset(szUserID, 0, ID_STRING_SIZE); int nReceivedData = strlen(szServerName) + 1; if (nReceivedData < pProxyMsg->datalength) { strcpy(szPublicIP, pData + nReceivedData); nReceivedData += strlen(szPublicIP) + 1; } if (nReceivedData < pProxyMsg->datalength) { memcpy(szUserID, pData + nReceivedData, 255); } if (strlen(szUserID)) { //2007.08.09 char szEmail[ID_STRING_SIZE]; g_globals.ParseFormattedID(szUserID, ID_STRING_SIZE, szEmail); g_globals.m_logger.WriteFormated("CACConnection: Receive Client %s, Form %s", szUserID, szEmail); m_pProxyConnection->GetProxyInfo()->SetMyID(szEmail); } m_pProxyConnection->GetProxyInfo()->SetStatus(STATUS_CONNECTED, true); m_pProxyConnection->GetProxyInfo()->SetStatus(STATUS_AUTHENTICATING, false); m_pProxyConnection->GetProxyInfo()->SetStatus(STATUS_CONNECTING, false); g_globals.m_logger.Write("CACConnection: Receive MSG_PROXY_HANDSHAKECONFIRM"); m_dwConnectingStatus=STATUS_CONNECTED; } else if (pProxyMsg->messageid==MSG_PROXY_DISCONNECTED) { CClientSocket::Close(); m_bConnected=false; m_pProxyConnection->GetProxyInfo()->SetStatus(STATUS_DISCONNECTED_FROM_PROXY, true); m_pProxyConnection->GetProxyInfo()->SetStatus(STATUS_CONNECTED, false); g_globals.m_logger.Write("CACConnection: Receive MSG_PROXY_DISCONNECTED"); } else if (pProxyMsg->messageid==MSG_PROXY_DUPLICATE_LOGIN) { CClientSocket::Close(); m_bConnected=false; m_pProxyConnection->GetProxyInfo()->SetStatus(STATUS_CONNECTED, false); m_dwConnectingStatus=STATUS_DISCONNECTED_FROM_PROXY; g_globals.m_logger.Write("CACConnection: Receive MSG_PROXY_DUPLICATE_LOGIN"); } else if (pProxyMsg->messageid==MSG_PROXY_PARTNERFOUND) { m_dwConnectingStatus=MSG_PROXY_PARTNERFOUND; g_globals.m_logger.Write("CACConnection: Receive MSG_PROXY_PARTNERFOUND"); } else if (pProxyMsg->messageid==MSG_PROXY_PARTNERNOTFOUND) { m_dwConnectingStatus=MSG_PROXY_PARTNERNOTFOUND; g_globals.m_logger.Write("CACConnection: Receive MSG_PROXY_PARTNERNOTFOUND"); } else if (pProxyMsg->messageid==MSG_CHANNEL_CODE) { /* initiator receives from echoserver */ m_dwConnectingStatus=MSG_CHANNEL_CODE; g_globals.m_logger.WriteFormated("CACConnection: Receive MSG_CHANNEL_CODE %s", pData); } else if (pProxyMsg->messageid==MSG_PEER_KEY) { /* initiator receives from echoserver (initiatorchannelcode/dhpart2) */ m_dwConnectingStatus=MSG_PEER_KEY; memcpy(m_szChannelCode, pData, CHANNEL_CODE_SIZE); m_szChannelCode[CHANNEL_CODE_SIZE]=0; #warning the RSA key? is that char or int data? memcpy(m_szPeerPublicKey, pData+CHANNEL_CODE_SIZE, RSA_PUBLIC_KEY*sizeof(unsigned int)); m_szPeerPublicKey[RSA_PUBLIC_KEY*sizeof(unsigned int)]=0; g_globals.m_logger.WriteFormated("CACConnection: Receive MSG_PEER_KEY, chanel code=%s", m_szChannelCode); } else if (pProxyMsg->messageid==MSG_CONNECT_TO_PEER) { /* responder receives from echoserver (respchannelcode/respID/dhPart1) */ g_globals.m_logger.Write("CACConnection: Receive MSG_CONNECT_TO_PEER 1"); m_dwConnectingStatus=MSG_CONNECT_TO_PEER; memcpy(m_szChannelCode, pData, CHANNEL_CODE_SIZE); m_szChannelCode[CHANNEL_CODE_SIZE]=0; memcpy(m_szPeerID, pData+CHANNEL_CODE_SIZE, ID_STRING_SIZE); m_szPeerID[ID_STRING_SIZE]=0; #warning the RSA key? is that char or int data? memcpy(m_szPeerPublicKey, pData+ID_STRING_SIZE+CHANNEL_CODE_SIZE, RSA_PUBLIC_KEY*sizeof(unsigned int)); m_szPeerPublicKey[RSA_PUBLIC_KEY*sizeof(unsigned int)]=0; char *pBuff = NULL; DWORD dwTotalLength = 0; DWORD dwTemp = 0; /* responder sends MSG_PEER_KEY to echoserver (initiatorId,dhpart2,respchannelcode) */ dwTotalLength += CHANNEL_CODE_SIZE;//sizeof(m_szChannelCode); dwTotalLength += ID_STRING_SIZE;//sizeof(m_szPeerID); dwTotalLength += m_rsaKeys.GetPublicKeyLength(); pBuff = new char[dwTotalLength]; memset(pBuff,0,dwTotalLength);// Total Buffer size memcpy(pBuff,m_szPeerID,sizeof(m_szPeerID)); dwTemp = ID_STRING_SIZE;//sizeof(m_szPeerID); memcpy(pBuff + dwTemp,m_szChannelCode, sizeof(m_szChannelCode)); dwTemp += CHANNEL_CODE_SIZE;//sizeof(m_szChannelCode); /* set DHpart2 to all zero if no encryption */ if (m_nEncryptionLevel==1) memcpy(pBuff+dwTemp, (char*)m_rsaKeys.m_pPublicKeyLE, m_rsaKeys.GetPublicKeyLength()); else memset(pBuff+dwTemp, 0, m_rsaKeys.GetPublicKeyLength()); g_globals.m_logger.WriteFormated("CACConnection: Receive MSG_CONNECT_TO_PEER 2, channel code=%s", m_szChannelCode); SendMessage(MSG_PEER_KEY,pBuff,dwTotalLength); g_globals.m_logger.WriteFormated("CACConnection: Receive MSG_CONNECT_TO_PEER 3, channel code=%s", m_szChannelCode); delete []pBuff; m_pProxyConnection->OnRemotePartnerConnect(m_szChannelCode, m_szPeerID, m_szPeerPublicKey); g_globals.m_logger.WriteFormated("CACConnection: Receive MSG_CONNECT_TO_PEER end, channel code=%s", m_szChannelCode); } else if (pProxyMsg->messageid==MSG_ISALIVE) { g_globals.m_logger.Write("CACConnection: Receive MSG_ISALIVE"); } delete []msg; } //send data to echoServer //if the send buffer contain data, then this data is read it for send to echoServer //if there are no data to send, then send IsAliveMessage if is time to do it //it is a notify message from CClientSocket void CACConnection::OnSend(char* buff, int& len) { if (!m_bConnected) { len=0; return; } len=m_pSendBuffer->Read(buff, len); } void CACConnection::OnTimer() { APISocket::CClientSocket::OnTimer(); if (!m_pSendBuffer->Size() && m_bConnected && GetTickCount() - m_dwLastIsAliveMsg >= SEND_LIVE_MESSAGE) { m_dwLastIsAliveMsg = GetTickCount(); SendMessage(MSG_ISALIVE, 0, 0); } } //compose message packet to send to echoServer //message : the message type //data : the message data //datalen : the message data length void CACConnection::SendMessage(DWORD message, char *data, unsigned int datalen) { char* lpBuf = NULL; DWORD nBytesSent = 0; CProxyMsg msg(message); NetPacketHeader header; header.len = msg.MakeMessage(&header, lpBuf, data, datalen);//create the message DWORD dwToSend=OSSwapHostToLittleInt32(header.len+sizeof(DWORD)); m_pSendBuffer->Write(&dwToSend, sizeof(DWORD)); m_pSendBuffer->Write(lpBuf, header.len); Send(); if (lpBuf) delete lpBuf; } //compose MSG_PROXY_PASSWORD message packet void CACConnection::SendEncryptedPass(char * pData,DWORD dwDataLength) { char pEncPass[1024]; m_rsaKeys.EncryptPassword(pData, dwDataLength, m_pProxyConnection->GetProxyInfo()->GetPassword(), pEncPass); char szEmail[ID_STRING_SIZE]; if (g_globals.GetFormattedID(szEmail, ID_STRING_SIZE, m_pProxyConnection->GetProxyInfo()->GetMyID()) == -1) return; const int nTotalPkgSize = 1024 + ID_STRING_SIZE+ sizeof(DWORD); char szTotalData[nTotalPkgSize]; memset(szTotalData, 0, nTotalPkgSize); memcpy(szTotalData, pEncPass,1024); memcpy(szTotalData + 1024, szEmail, ID_STRING_SIZE); SendMessage(MSG_PROXY_PASSWORD, szTotalData, nTotalPkgSize); } //calback function, notify that there was an error on read or send data to echoserver on this channel //it is a notify message from CClientSocket void CACConnection::OnError(int error) { CClientSocket::OnError(error); m_bStopConnecting = true; m_pProxyConnection->OnError(error); CDllProxyInfo* pProxyInfo=m_pProxyConnection->GetProxyInfo(); pProxyInfo->SetStatus(STATUS_CONNECTED, false); pProxyInfo->SetStatus(STATUS_DISCONNECTED_FROM_PROXY, true); m_bConnected = false; } //find partner on echoServer //sends MSG_PROXY_FIND_PARTNER message and wait for echoServer answer bool CACConnection::FindPartner(const char* szPartener) { g_globals.m_logger.WriteFormated("CACConnection: FindPartner %s", szPartener); if (!m_bConnected) { g_globals.m_logger.WriteFormated("CACConnection: FindPartner %s end, not connected", szPartener); return false; } m_pProxyConnection->GetProxyInfo()->SetStatus(STATUS_SEARCHING_FOR_PARTNER, true); char sz[ID_STRING_SIZE]; if (g_globals.GetFormattedID(sz, ID_STRING_SIZE, szPartener) == -1) return false; m_dwConnectingStatus=0; SendMessage(MSG_PROXY_FIND_PARTNER, (char*)sz, (unsigned int)ID_STRING_SIZE); g_globals.m_logger.WriteFormated("CACConnection: FindPartner wait %d seconds", m_pProxyConnection->GetProxyInfo()->GetConnectTimeout()); DWORD dwStartTime=GetTickCount(); while (!m_dwConnectingStatus) { Sleep(10000); if (GetTickCount()-dwStartTime>(unsigned int)m_pProxyConnection->GetProxyInfo()->GetConnectTimeout()*1000) break; } g_globals.m_logger.Write("CACConnection: FindPartner wait end"); m_pProxyConnection->GetProxyInfo()->SetStatus(STATUS_SEARCHING_FOR_PARTNER, false); g_globals.m_logger.WriteFormated("CACConnection: FindPartner status=%d", m_dwConnectingStatus); return (bool)(m_dwConnectingStatus==MSG_PROXY_PARTNERFOUND); } //try to connect to szPartner on echoServer //sends MSG_CONNECT_TO_PEER message and wait for echoServer answer bool CACConnection::ConnectToPeer(const char* szPartener, char* szChannelCode, char* szPeerPublicKey) { g_globals.m_logger.WriteFormated("CACConnection: Try connect to peer %s, channel code ", szPartener, szChannelCode); char *pBuff = NULL; DWORD dwTotalLength = 0; DWORD dwTemp = 0; dwTotalLength += ID_STRING_SIZE;//(DWORD)strlen(szPartener)+1; dwTotalLength += m_rsaKeys.GetPublicKeyLength(); pBuff = new char[dwTotalLength]; memset(pBuff, 0, dwTotalLength); g_globals.GetFormattedID(pBuff, ID_STRING_SIZE, szPartener); dwTemp = ID_STRING_SIZE;//(DWORD)strlen(szPartener)+1; /* set DHpart1 to all zero if no encryption */ if (m_nEncryptionLevel==1) memcpy(pBuff+dwTemp, m_rsaKeys.GetPublicKey(), m_rsaKeys.GetPublicKeyLength()); else memset(pBuff+dwTemp, 0, m_rsaKeys.GetPublicKeyLength()); m_dwConnectingStatus=0; m_szPeerPublicKey[0]=m_szChannelCode[0]=0; SendMessage(MSG_CONNECT_TO_PEER, pBuff, dwTotalLength); delete [] pBuff; DWORD dwStartTime=GetTickCount(); while (m_dwConnectingStatus!=MSG_PEER_KEY && m_dwConnectingStatus!=MSG_PROXY_PARTNERNOTFOUND) { Sleep(10000); if (GetTickCount()-dwStartTime>(unsigned int)m_pProxyConnection->GetProxyInfo()->GetConnectTimeout()*1000) break; } if (m_dwConnectingStatus==MSG_PEER_KEY) { strcpy(szChannelCode, m_szChannelCode); memcpy(szPeerPublicKey, m_szPeerPublicKey, RSA_PUBLIC_KEY*sizeof(unsigned int)); } if (m_dwConnectingStatus==MSG_PEER_KEY) g_globals.m_logger.WriteFormated("CACConnection: Success connect to peer %s, channel code ", szPartener, szChannelCode); else g_globals.m_logger.WriteFormated("CACConnection: Fail connect to peer %s, channel code ", szPartener, szChannelCode); return m_dwConnectingStatus==MSG_PEER_KEY; } ================================================ FILE: Bundles/Echoware/ACConnection.h ================================================ #ifndef _ACCONNECTION_H #define _ACCONNECTION_H #if _MSC_VER > 1000 #pragma once #endif #include "APISocket.h" #include "CritSection.h" #include "RSAKeys.h" class CProxyConnection; class CBuffer; /* Authentication channel class It is used for client authentication and identification on the echoServer */ class CACConnection : public APISocket::CClientSocket { public: CACConnection(CProxyConnection* pProxyConnection); virtual ~CACConnection(void); //connect to echoServer int Connect(); //disconnect from echoServer bool Disconnect(); void StopConnect(); //sets the encryption level void SetEncryptionLevel(int level); //find partner on echoServer bool FindPartner(const char* szPartener); //connect to peer on echoServer bool ConnectToPeer(const char* szPartener); bool ConnectToPeer(const char* szPartener, char* szChannelCode, char* szPeerPublicKey); //generate a session key from a public key char* GenerateSessionKey(char* szSessionKey, char* szPeerPublicKey) { m_rsaKeys.GenerateSessionKey(szPeerPublicKey, szSessionKey); return szSessionKey; } protected: //overwrited notification functions void OnReceive(char* buff, int len); void OnSend(char* buff, int& len); virtual void OnError(int error); virtual void OnTimer(); //construct message to send to echoServer void SendMessage(DWORD message, char *data, unsigned int datalen); //construct mesage MSG_PROXY_PASSWORD void SendEncryptedPass(char * pData,DWORD dwDataLength); //connect to szIP:nPort bool Connect(const char* szIP, unsigned int nPort); protected: CCritSection m_critSection; int m_nEncryptionLevel; //parent proxy connection CProxyConnection* m_pProxyConnection; bool m_bStopConnecting; bool m_bConnected; int m_dwConnectingStatus; //buffers for recv/send on socket CBuffer* m_pReadBuffer; CBuffer* m_pSendBuffer; CRSAKeys m_rsaKeys; char m_pRemotePublicKey[RSA_PUBLIC_KEY]; private: char m_szChannelCode[12]; char m_szPeerID[256]; char m_szPeerPublicKey[RSA_PUBLIC_KEY*sizeof(unsigned int)+1]; DWORD m_dwLastIsAliveMsg; }; #endif ================================================ FILE: Bundles/Echoware/AES.cpp ================================================ #include "StdAfx.h" #include "aes.h" CAES::CAES(void) { } CAES::~CAES(void) { } void CAES::Decrypt(const unsigned char *in, int length, unsigned char *out) { CryptData(in, out, length, AES_DECRYPT); } void CAES::Encrypt(const unsigned char *in, int length, unsigned char *out) { CryptData(in, out, length, AES_ENCRYPT); } int CAES::SetDecryptKey(const unsigned char *userKey, const int bits) { //return AES_set_decrypt_key(userKey, bits, &m_aesDecKey); memcpy(m_userDecKey, userKey, bits); return 0; } int CAES::SetEncryptKey(const unsigned char *userKey, const int bits) { //return AES_set_encrypt_key(userKey, bits, &m_aesEncKey); memcpy(m_userEncKey, userKey, bits); return 0; } void CAES::CryptData(const unsigned char *in, unsigned char *out, int length, const int enc) { AES_KEY aesKey; if (AES_ENCRYPT == enc) AES_set_encrypt_key(m_userEncKey, 128, &aesKey); else AES_set_decrypt_key(m_userDecKey, 128, &aesKey); unsigned long len = length; unsigned char tmp[AES_BLOCK_SIZE]; while (len >= AES_BLOCK_SIZE) { memset(tmp,0,AES_BLOCK_SIZE); memcpy(tmp,in,AES_BLOCK_SIZE); if (AES_ENCRYPT == enc) { AES_encrypt(tmp, out, &aesKey); } else { AES_decrypt(tmp, out, &aesKey); } len -= AES_BLOCK_SIZE; in += AES_BLOCK_SIZE; out += AES_BLOCK_SIZE; } if (len) { memset(tmp,0,AES_BLOCK_SIZE); memcpy(tmp,in,AES_BLOCK_SIZE); if (AES_ENCRYPT == enc) { AES_encrypt(tmp, tmp, &aesKey); } else { AES_decrypt(tmp, tmp, &aesKey); } memcpy(out, tmp, AES_BLOCK_SIZE); } } ================================================ FILE: Bundles/Echoware/AES.h ================================================ #pragma once #include "OpenSSL/aes.h" //wrapper class for AES encryption class CAES { public: CAES(void); ~CAES(void); void Decrypt(const unsigned char *in, int length, unsigned char *out); void Encrypt(const unsigned char *in, int length, unsigned char *out); int SetDecryptKey(const unsigned char *userKey, const int bits); int SetEncryptKey(const unsigned char *userKey, const int bits); protected: void CryptData(const unsigned char *in, unsigned char *out, int length, const int enc); protected: AES_KEY m_aesEncKey; AES_KEY m_aesDecKey; public: unsigned char m_userDecKey[128]; unsigned char m_userEncKey[128]; }; ================================================ FILE: Bundles/Echoware/APISocket/APISocket.h ================================================ #ifndef __APISOCKET__ #define __APISOCKET__ #if _MSC_VER > 1000 #pragma once #endif #undef FD_SETSIZE #define FD_SETSIZE 1024 #define __stdcall #define MAX_BUFFER (64*1024) #import #include "CritSection.h" namespace APISocket { //generic socket class class CSocket { public: CSocket(int sock=0); CSocket(const CSocket& other); virtual ~CSocket(); //[in]Timeouts in milliseconds void SetTimeouts(int nConnectTimeout=-1, int nSendTimeout=-1, int nRecvTimeout=-1, int nAcceptTimeOut=-1); //[in]bBlock : true for bloking socket, false for non-blocking socket void SetBlockMode(bool bBlock); int GetConnectTimeout(); int GetSendTimeout(); int GetRecvTimeout(); int GetAcceptTimeout(); bool GetBlockMode(); //[in] nPort : port to bind //return : true or false virtual bool Create(unsigned int nPort=0); //return : 0 fail, port bindit for ok unsigned int Bind(unsigned int nPort=0, bool bLocal=true); //[in] backlog //return : true or false bool Listen(int backlog=10); //return : -1 for error, 0 for success, 1 for timeout int Accept(int& sock); //[in] szServerIP //[in] nPort //connect socket to szServer (ip xxx.xxx.xxx.xxx or host name) on port nPort //return -1 for error, 0 for OK, 1 for timeout int Connect(const char* szServer, unsigned int nPort); //shutdown socket //[in] how : SD_RECEIVE, SD_SEND, SD_BOTH //return : true or false bool Shutdown(int how); //send //[in] buff : buff to send //[in] nLen : buff length //return -1 for error, 0 for OK, 1 for timeout int Send(const char* buff, int& nLen, int nFlag=0); //receive //[in] buff //[in, out] nLength : size of buff //[in] flag : 0, MSG_PEEK or MSG_OOB //return -1 for error, 0 for OK, 1 for timeout int Receive(char* buff, int& nLength, int nFlag=0); bool Close(); virtual void OnClose(); virtual void OnError(int error); virtual void OnReceive(char* buff, int len); virtual void OnSend(char* buff, int &len); //gets the TCP_NODELAY socket option //return true for success and false for error to get the TCP_NODELAY socket option bool GetSockOption(bool& bTcpNodelay); //sets the TCP_NODELAY socket option //return true for success and false for error to set the TCP_NODELAY socket option bool SetSockOption(bool bTcpNodelay); //gets the socket last error int GetLastError(); bool GetLocalPort(unsigned int& nPort); bool GetRemotePort(unsigned int& nPort); bool GetRemoteIP(char* szRemoteIP); //unsigned int GetSock(){return m_sock;}; //atach a sock to this class int Attach(int sock); //detach the sock from this class int Detach(); void OnWrite(); void OnRead(); int Send(); int ReadableByteCount(); int getSocket(); bool StartAsync(); bool StopAsync(); protected: //Set the socket to either blocking or non-blocking mode //[in] bNonBlock : true for non-blocking mode, false for blocking mode //return true or false bool NonBlock(bool bNonBlock); //[in] nTimeout in milliseconds //[in] nType 0 for read, 1 for write //return -1 for error, 0 for OK, 1 for timeout int WaitNonBlockCompletion(int nTimeout, int nType); protected: int m_sock; int m_nConnectTimeout, m_nSendTimeout, m_nRecvTimeout, m_nAcceptTimeout; bool m_bBlockMode; void* m_hAsyncThread; unsigned long m_dwAsyncThread; bool shouldAsyncQuit; bool hasAsyncQuit; bool inAsyncNotificationLoop; bool errored; CCritSection m_csAsync; static unsigned long AsyncThreadProc(void* lpParameter); void AsyncNotifications(); void AsyncNotificationLoop(); }; //a base class for client socket class CClientSocket : public CSocket { public: CClientSocket(int sock=0); virtual ~CClientSocket(void); //start send data virtual bool StartSend(); //stop send data //[in] dwTimeout : milliseconds for waitting to stop bool StopSend(unsigned long dwWaitTimeout); virtual void OnTimer(); protected: bool StartRoutine(); bool StopRoutine(unsigned long dwWaitTimeout); //routine thread handle void* m_hRoutineThread; //routine thread id unsigned long m_dwRoutineThread; //some routine thread proc static unsigned long __stdcall RoutineThreadProc(void* lpParameter); bool routineShouldQuit; bool routineHasQuit; }; //a base class for server socket class CServerSocket : public CSocket { public: CServerSocket(unsigned int nPort=0); virtual ~CServerSocket(void); //return : true or false virtual bool Create(); //[in] backlog //return : true or false bool Listen(int backlog=10); //start waitting for clients bool StartAccept(); //stop waitting for clients //[in] dwTimeout : milliseconds for waitting to stop bool StopAccept(unsigned long dwWaitTimeout); //notification : new client connected virtual void OnNewClient(int sock); virtual void OnLeaveClient(CSocket* pClient); unsigned int GetListenPort(); protected: //listen port unsigned int m_nPort; //accept thread handle void* m_hAcceptThread; //accept thread id unsigned long m_dwAcceptThread; //accept thread proc static unsigned long __stdcall AcceptThreadProc(void* lpParameter); bool shouldQuit; bool hasQuit; }; } #endif ================================================ FILE: Bundles/Echoware/APISocket/ClientSocket.cpp ================================================ #include "stdafx.h" #include "APISocket.h" #include "EchoToOSX.h" APISocket::CClientSocket::CClientSocket(int sock /*=0*/) :APISocket::CSocket(sock) { m_hRoutineThread=0; m_dwRoutineThread=0; } APISocket::CClientSocket::~CClientSocket(void) { } bool APISocket::CClientSocket::StartSend() { bool res = StartRoutine(); int ret = Send(); return res && (ret == 0); } bool APISocket::CClientSocket::StopSend(unsigned long dwWaitTimeout) { return StopRoutine(dwWaitTimeout); } bool APISocket::CClientSocket::StartRoutine() { if (m_hRoutineThread) return true; routineShouldQuit=0; routineHasQuit=0; if (!(m_hRoutineThread=CreateThread(0, 0, RoutineThreadProc, this, 0, &m_dwRoutineThread))) return false; return true; } bool APISocket::CClientSocket::StopRoutine(unsigned long dwWaitTimeout) { if (!m_hRoutineThread) return true; bool termResult = ShutdownThread(m_hRoutineThread, dwWaitTimeout, &routineShouldQuit, &routineHasQuit); m_hRoutineThread=0; m_dwRoutineThread=0; return termResult; } void APISocket::CClientSocket::OnTimer() { } unsigned long __stdcall APISocket::CClientSocket::RoutineThreadProc(void* lpParameter) { APISocket::CClientSocket* pClient = (APISocket::CClientSocket*) lpParameter; while (true) { if (pClient->routineShouldQuit) break; pClient->OnTimer(); Sleep(500000); } pClient->routineHasQuit = 1; return 0; } ================================================ FILE: Bundles/Echoware/APISocket/ServerSocket.cpp ================================================ #include "stdafx.h" #include "APISocket.h" APISocket::CServerSocket::CServerSocket(unsigned int nPort/*=0*/) :APISocket::CSocket() { m_nPort=nPort; m_hAcceptThread=0; m_dwAcceptThread=0; } APISocket::CServerSocket::~CServerSocket(void) { } bool APISocket::CServerSocket::Create() { if (!CSocket::Create(m_nPort)) return false; if (!(m_nPort=Bind(m_nPort))) return false; return true; } bool APISocket::CServerSocket::Listen(int backlog) { return CSocket::Listen(); } unsigned int APISocket::CServerSocket::GetListenPort() { return m_nPort; } bool APISocket::CServerSocket::StartAccept() { if (m_hAcceptThread) return true; shouldQuit = 0; hasQuit = 0; if (!(m_hAcceptThread=CreateThread(0, 0, AcceptThreadProc, this, 0, &m_dwAcceptThread))) return false; return true; } bool APISocket::CServerSocket::StopAccept(unsigned long dwWaitTimeout) { bool termResult = ShutdownThread(m_hAcceptThread, dwWaitTimeout, &shouldQuit, &hasQuit); m_hAcceptThread = 0; m_dwAcceptThread = 0; return termResult; } void APISocket::CServerSocket::OnNewClient(int sock) { } void APISocket::CServerSocket::OnLeaveClient(CSocket* pClient) { } unsigned long __stdcall APISocket::CServerSocket::AcceptThreadProc(void* lpParameter) { CServerSocket* pServerSock= (CServerSocket*) lpParameter; int sock; while (true) { if (pServerSock->shouldQuit) break; int rc=pServerSock->Accept(sock); if (rc==0) pServerSock->OnNewClient(sock); else if (rc==-1) { if (pServerSock->shouldQuit) break; pServerSock->OnError(pServerSock->GetLastError()); Sleep(10000); } else if (rc==1) Sleep(1000); } pServerSock->hasQuit=1; return 0; } ================================================ FILE: Bundles/Echoware/APISocket/Socket.cpp ================================================ #include "apisocket.h" #include #include "errno.h" #include #include #include "sys/fcntl.h" #include #include #include #include #include "../EchoToOSX.h" #include #include #include #include "globals.h" APISocket::CSocket::CSocket(int sock/*=0*/) { m_sock = sock; errored = false; m_nConnectTimeout = m_nSendTimeout = m_nRecvTimeout = m_nAcceptTimeout = -1; m_bBlockMode = false; m_hAsyncThread = 0; m_dwAsyncThread = 0; inAsyncNotificationLoop = false; StartAsync(); } APISocket::CSocket::CSocket(const CSocket& other) { m_sock = other.m_sock; errored = false; m_nConnectTimeout = other.m_nConnectTimeout; m_nSendTimeout = other.m_nSendTimeout; m_nRecvTimeout = other.m_nRecvTimeout; m_nAcceptTimeout = other.m_nAcceptTimeout; m_bBlockMode = other.m_bBlockMode; m_hAsyncThread = 0; m_dwAsyncThread = 0; inAsyncNotificationLoop = false; StartAsync(); } APISocket::CSocket::~CSocket() { StopAsync(); Close(); m_sock = 0; } void APISocket::CSocket::SetTimeouts(int nConnectTimeout/*=-1*/, int nSendTimeout/*=-1*/, int nRecvTimeout/*=-1*/, int nAcceptTimeout/*=-1*/) { m_nConnectTimeout = nConnectTimeout; m_nSendTimeout = nSendTimeout; m_nRecvTimeout = nRecvTimeout; m_nAcceptTimeout = nAcceptTimeout; } void APISocket::CSocket::SetBlockMode(bool bBlock) { m_bBlockMode = bBlock; NonBlock(!bBlock); } int APISocket::CSocket::GetConnectTimeout() { return m_nConnectTimeout; } int APISocket::CSocket::GetSendTimeout() { return m_nSendTimeout; } int APISocket::CSocket::GetRecvTimeout() { return m_nRecvTimeout; } int APISocket::CSocket::GetAcceptTimeout() { return m_nAcceptTimeout; } bool APISocket::CSocket::GetBlockMode() { return m_bBlockMode; } bool APISocket::CSocket::Create(unsigned int nPort /*=0*/) { int sock = socket(AF_INET, SOCK_STREAM, 0); if (!sock) sock = socket(AF_INET, SOCK_STREAM, 0); if (!(sock < 0)) { m_sock = sock; SetSockOption(true); return true; } return false; } unsigned int APISocket::CSocket::Bind(unsigned int nPort/*=0*/, bool bLocal/*=true*/) { struct sockaddr_in self; memset(&self, 0, sizeof(self)); self.sin_family = AF_INET; self.sin_port = htons(nPort); if (!bLocal) self.sin_addr.s_addr = htonl(INADDR_ANY); else self.sin_addr.s_addr = htonl(INADDR_LOOPBACK); if (bind(m_sock, (struct sockaddr *)&self, sizeof(self)) != 0) return 0; if (!nPort) GetLocalPort(nPort); return nPort; } bool APISocket::CSocket::Listen(int backlog) { return !listen(m_sock, backlog); } int APISocket::CSocket::Accept(int& sock) { struct sockaddr_in client_addr; int addrlen=sizeof(client_addr); sock = 0; if (!m_bBlockMode) { int rc = 0; if ((rc = WaitNonBlockCompletion(m_nAcceptTimeout, 0)) != 0) return rc; } sock = accept(m_sock,(struct sockaddr *)&client_addr,(socklen_t *) &addrlen); if (sock == INVALID_SOCKET) return -1; return 0; } int APISocket::CSocket::Connect(const char* szServer, unsigned int nPort) { if (!m_sock) return -1; errored = false; StartAsync(); struct sockaddr_in sockAddr; ZeroMemory(&sockAddr, sizeof(sockAddr)); sockAddr.sin_family = AF_INET; sockAddr.sin_port = htons(nPort); sockAddr.sin_addr.s_addr = inet_addr(szServer); if (sockAddr.sin_addr.s_addr == INADDR_NONE) { LPHOSTENT lphost; lphost = gethostbyname(szServer); if (lphost != NULL) sockAddr.sin_addr.s_addr = ((struct in_addr *)lphost->h_addr)->s_addr; } if (connect(m_sock, (struct sockaddr*)&sockAddr, sizeof(sockAddr)) != 0) { if (!m_bBlockMode) { while (!inAsyncNotificationLoop) Sleep(10000); return WaitNonBlockCompletion(m_nConnectTimeout, 1); } } while (!inAsyncNotificationLoop) Sleep(10000); return 0; } bool APISocket::CSocket::Close() { bool ret = false; Shutdown(SD_BOTH); if (m_sock) ret = !closesocket(m_sock); m_sock = 0; return ret; } bool APISocket::CSocket::Shutdown(int how) { if (m_sock) return !shutdown(m_sock, how); else return false; } int APISocket::CSocket::Send(const char* buff, int& nLen, int nFlag/*=0*/) { nLen=send(m_sock, buff, nLen, nFlag); if (nLen<=0) { if (nLen==SOCKET_ERROR) { nLen=0; int err; uint errlen = sizeof(err); getsockopt(m_sock, SOL_SOCKET, SO_ERROR, (char*)&err, &errlen); return (err == WSAEWOULDBLOCK)?(0):(-1); } return -1; } return 0; } int APISocket::CSocket::Receive(char* buff, int& nLength, int nFlag/*=0*/) { nLength=recv(m_sock, buff, nLength, nFlag); if (nLength<=0) { if (nLength==SOCKET_ERROR) { nLength=0; int err; uint errlen = sizeof(err); getsockopt(m_sock, SOL_SOCKET, SO_ERROR, (char*)&err, &errlen); return (err == WSAEWOULDBLOCK)?(0):(-1); } return -1; } return 0; } //gets the TCP_NODELAY socket option //return true for success and false for error to get the TCP_NODELAY socket option bool APISocket::CSocket::GetSockOption(bool& bTcpNodelay) { int on; uint len=sizeof(on); bool ret=!getsockopt(m_sock, IPPROTO_TCP, TCP_NODELAY, (char*)&on, &len); bTcpNodelay=(on!=0); return ret; } //sets the TCP_NODELAY socket option //return true for success and false for error to set the TCP_NODELAY socket option bool APISocket::CSocket::SetSockOption(bool bTcpNodelay) { int on=(int)bTcpNodelay; return !setsockopt(m_sock, IPPROTO_TCP, TCP_NODELAY, (char*)&on, sizeof(on)); } int APISocket::CSocket::GetLastError() { return WSAGetLastError(); } bool APISocket::CSocket::NonBlock(bool bNonBlock) { if (bNonBlock) return (fcntl(m_sock, F_SETFL, O_NONBLOCK) != -1); else return (fcntl(m_sock, F_SETFL, fcntl(m_sock, F_GETFL, 0) & ~O_NONBLOCK) != -1); } int APISocket::CSocket::WaitNonBlockCompletion(int nTimeout, int nType) { fd_set fd; struct timeval time; time.tv_sec = nTimeout/1000; time.tv_usec = (nTimeout-time.tv_sec*1000)*1000; FD_ZERO(&fd); FD_SET(m_sock, &fd); int rc=0; if (nType==0) rc = select(m_sock+1, &fd, NULL, NULL, &time); else if (nType==1) rc = select(m_sock+1, NULL, &fd, NULL, &time); if (rc==-1) return -1;// error else if (rc==0) return 1;//timeout if (FD_ISSET(m_sock, &fd)) return 0; else return -1; } bool APISocket::CSocket::GetLocalPort(unsigned int& nPort) { struct sockaddr_in self; memset(&self, 0, sizeof(self)); uint len=sizeof(self); if (getsockname( m_sock, (struct sockaddr*)&self, &len )) return false; nPort=ntohs(self.sin_port); return true; } bool APISocket::CSocket::GetRemotePort(unsigned int& nPort) { struct sockaddr_in self; memset(&self, 0, sizeof(self)); int len=sizeof(self); if (getpeername( m_sock, (struct sockaddr*)&self, (socklen_t *) &len )) return false; nPort=ntohs(self.sin_port); return true; } bool APISocket::CSocket::GetRemoteIP(char* szRemoteIP) { struct sockaddr_in self; memset(&self, 0, sizeof(self)); uint len=sizeof(self); if (getpeername( m_sock, (struct sockaddr*)&self, &len )) return false; sprintf(szRemoteIP, "%s", inet_ntoa(self.sin_addr)); return true; } int APISocket::CSocket::Attach(int sock) { int old=m_sock; m_sock=sock; return old; } int APISocket::CSocket::Detach() { int old=m_sock; m_sock=0; return old; } void APISocket::CSocket::OnClose() { } void APISocket::CSocket::OnError(int error) { errored = true; g_globals.m_logger.WriteFormated("CSocket::OnError sock = %d err = %d", m_sock, error); } void APISocket::CSocket::OnReceive(char* buff, int len) { } void APISocket::CSocket::OnSend(char* buff, int &len) { len = 0; } void APISocket::CSocket::OnWrite() { errored = false; int r = Send(); } void APISocket::CSocket::OnRead() { errored = false; int len_to_read = ReadableByteCount(); if (len_to_read <= 0) return; if (len_to_read > 65000) ///////////// len_to_read = 65000; //////////// char *buff = new char[len_to_read]; int len_readed = len_to_read; int r = Receive(buff, len_readed); if (len_readed <= 0) { delete [] buff; return; } OnReceive(buff, len_readed); delete[] buff; } int APISocket::CSocket::ReadableByteCount() { if (!m_sock) return 0; int bytesAvailable = 0; if (ioctl(m_sock, FIONREAD, &bytesAvailable) == -1) { if (errno == EINVAL) bytesAvailable = -1; else bytesAvailable = 0; } return bytesAvailable; } int APISocket::CSocket::Send() { if (!m_sock || errored) return 1; char *buff = new char[MAX_BUFFER]; int len = MAX_BUFFER; OnSend(buff, len); int ret = 0; if (len > 0) ret = Send(buff, len); delete [] buff; return ret; } int APISocket::CSocket::getSocket() { return m_sock; } bool APISocket::CSocket::StartAsync() { if (m_hAsyncThread) return true; inAsyncNotificationLoop = false; shouldAsyncQuit = 0; hasAsyncQuit = 0; if (!(m_hAsyncThread = CreateThread(0, 0, AsyncThreadProc, this, 0, &m_dwAsyncThread))) return false; return true; } bool APISocket::CSocket::StopAsync() { if (!m_hAsyncThread) return true; shouldAsyncQuit = true; m_csAsync.Lock(); m_csAsync.Unlock(); bool stopResult = ShutdownThread(m_hAsyncThread, THREAD_STOP_TIMEOUT, &shouldAsyncQuit, &hasAsyncQuit); m_hAsyncThread = 0; m_dwAsyncThread = 0; return stopResult; } void APISocket::CSocket::AsyncNotifications() { if (!m_sock) return; fd_set read_fds, write_fds; FD_ZERO(&read_fds); FD_ZERO(&write_fds); FD_SET(m_sock, &read_fds); FD_SET(m_sock, &write_fds); int res = select(m_sock + 1, &read_fds, &write_fds, NULL, NULL); if (res > 0) { if (FD_ISSET(m_sock, &read_fds)) { if (ReadableByteCount()) { inAsyncNotificationLoop = true; OnRead(); } else { inAsyncNotificationLoop = true; OnError(GetLastError()); shouldAsyncQuit = true; return; } } if (FD_ISSET(m_sock, &write_fds)) { inAsyncNotificationLoop = true; OnWrite(); } } inAsyncNotificationLoop = true; } void APISocket::CSocket::AsyncNotificationLoop() { while (!shouldAsyncQuit) { AsyncNotifications(); Sleep(10000); } inAsyncNotificationLoop = false; m_hAsyncThread = 0; m_dwAsyncThread = 0; hasAsyncQuit = 1; } unsigned long APISocket::CSocket::AsyncThreadProc(void* lpParameter) { APISocket::CSocket *socket = (APISocket::CSocket*)lpParameter; socket->m_csAsync.Lock(); socket->AsyncNotificationLoop(); socket->m_csAsync.Unlock(); Sleep(50000); return 0; } ================================================ FILE: Bundles/Echoware/CritSection.cpp ================================================ #include "StdAfx.h" #include "critsection.h" #include "errno.h" CCritSection::CCritSection(void) { pthread_mutex_init(&m_critSection, NULL); } CCritSection::~CCritSection(void) { if (pthread_mutex_destroy(&m_critSection) == EBUSY) { Unlock(); pthread_mutex_destroy(&m_critSection); } } void CCritSection::Lock() { pthread_testcancel(); pthread_mutex_lock(&m_critSection); } void CCritSection::Unlock() { pthread_mutex_unlock(&m_critSection); pthread_testcancel(); } ================================================ FILE: Bundles/Echoware/CritSection.h ================================================ #ifndef _CRITSECTION_H #define _CRITSECTION_H #if _MSC_VER > 1000 #pragma once #endif #include "EchoToOSX.h" //critical section class class CCritSection { public: CCritSection(void); virtual ~CCritSection(void); void Lock(); void Unlock(); protected: pthread_mutex_t m_critSection; //CRITICAL_SECTION m_critSection; }; #endif ================================================ FILE: Bundles/Echoware/DataChannel.cpp ================================================ #include "StdAfx.h" #include "DataChannel.h" #include "DataChannels.h" #include "LocalDataChannel.h" #include "EchoSrvDataChannel.h" #include "DllProxyInfo.h" #define RSA_PUBLIC_KEY 80 #pragma warning(disable : 4355) CDataChannel::CDataChannel(CDataChannels* pDataChannels, const char* szChannelCode, const char* szSessionKey, bool bEncryptDecrypt) : m_localListener(this), m_bEncryptDecrypt(bEncryptDecrypt) { m_bLocalDC=false; m_pDataChannels=pDataChannels; m_pLocalDataChannel=new CLocalDataChannel(this); m_pEchoServerDataChannel=new CEchoSrvDataChannel(this); const CDllProxyInfo* pProxyInfo=pDataChannels->GetProxyInfo(); m_pLocalDataChannel->SetTimeouts(pProxyInfo->GetConnectTimeout()*1000, pProxyInfo->GetSendTimeout()*1000, pProxyInfo->GetReceiveTimeout()*1000); m_pEchoServerDataChannel->SetTimeouts(pProxyInfo->GetConnectTimeout()*1000, pProxyInfo->GetSendTimeout()*1000, pProxyInfo->GetReceiveTimeout()*1000); m_szChannelCode=new char[12]; strcpy(m_szChannelCode, szChannelCode); m_szSessionKey=new char[1024]; strcpy(m_szSessionKey, szSessionKey); m_aes.SetEncryptKey((const unsigned char*)m_szSessionKey, 128); m_aes.SetDecryptKey((const unsigned char*)m_szSessionKey, 128); g_globals.m_logger.WriteFormated("CDataChannel: New data channel: code=%s , encrypt=%c", szChannelCode, (m_bEncryptDecrypt)?('Y'):('N')); } #pragma warning(default : 4355) CDataChannel::~CDataChannel(void) { StopListen(); if (m_pEchoServerDataChannel) { // m_pEchoServerDataChannel->Shutdown(SD_BOTH); m_pEchoServerDataChannel->Close(); m_pEchoServerDataChannel->StopSend(THREAD_STOP_TIMEOUT); } if (m_pLocalDataChannel) { // m_pLocalDataChannel->Shutdown(SD_BOTH); m_pLocalDataChannel->Close(); m_pLocalDataChannel->StopSend(THREAD_STOP_TIMEOUT); } if (m_pEchoServerDataChannel) { delete m_pEchoServerDataChannel; m_pEchoServerDataChannel=0; } if (m_pLocalDataChannel) { delete m_pLocalDataChannel; m_pLocalDataChannel=0; } delete []m_szChannelCode; delete []m_szSessionKey; } bool CDataChannel::ConnectEchoServer() { g_globals.m_logger.Write("=>ConnectEchoServer"); if (!m_pEchoServerDataChannel->Create() || m_pEchoServerDataChannel->Connect(m_pDataChannels->GetProxyInfo()->GetIP(), atoi(m_pDataChannels->GetProxyInfo()->GetPort()), m_szChannelCode, m_pDataChannels->GetProxyInfo()->GetMyID())!=0) { OnError(m_pEchoServerDataChannel, 1); g_globals.m_logger.WriteFormated("CDataChannel: Error connect data channel %p to channel code %s", this, m_szChannelCode); return false; } m_pLocalDataChannel->SetPairChannel(m_pEchoServerDataChannel); m_pEchoServerDataChannel->SetPairChannel(m_pLocalDataChannel); m_pEchoServerDataChannel->SetOffLoadingDataChannel(true); m_pEchoServerDataChannel->StartSend(); g_globals.m_logger.Write("<=ConnectEchoServer"); return true; } bool CDataChannel::ConnectLocalServer() { m_pDataChannels->LocalConnectDataChannel(this); return true; } //try to connect to the local server on the port nPort bool CDataChannel::ConnectLocalServer(unsigned int nPort) { //g_globals.m_logger.Write("=>CDataChannel::ConnectLocalServer"); m_crtLocalDCSection.Lock(); if (m_bLocalDC) { m_crtLocalDCSection.Unlock(); return true; } g_globals.m_logger.WriteFormated("=>Try connect local server port: %d", nPort); APISocket::CClientSocket client; if (!client.Create()) { m_crtLocalDCSection.Unlock(); g_globals.m_logger.Write("<=Try connect local server - error create"); return false; } client.SetBlockMode(false); const CDllProxyInfo* pProxyInfo=m_pDataChannels->GetProxyInfo(); client.SetTimeouts(pProxyInfo->GetConnectTimeout(), pProxyInfo->GetSendTimeout(), pProxyInfo->GetReceiveTimeout()); int connectRes = client.Connect("127.0.0.1", nPort); if (connectRes != 0) { m_crtLocalDCSection.Unlock(); g_globals.m_logger.WriteFormated("<=Try connect local server - error connect err code: %d", connectRes); return false; } m_bLocalDC=true; OnLocalDataChannel(client.Detach(), true); g_globals.m_logger.Write("<=Try connect local server - success"); m_crtLocalDCSection.Unlock(); return true; } //start to listen for local connections bool CDataChannel::Listen(unsigned int& nPort) { g_globals.m_logger.Write("CDataChannel: Enter Listen for local client"); if (!m_localListener.Create()) return false; if (!m_localListener.Listen()) return false; nPort=m_localListener.GetListenPort(); if (!m_localListener.StartAccept()) return false; g_globals.m_logger.Write("CDataChannel: Listen for local client started"); return true; } //stop listen for local connections void CDataChannel::StopListen() { m_localListener.Close(); m_localListener.StopAccept(5000); } //notify that there was an error on sockets operations void CDataChannel::OnError(APISocket::CSocket* pSocket, unsigned int err) { if (m_pEchoServerDataChannel == pSocket) { g_globals.m_logger.WriteFormated("CDataChannel: Start Remove data channel %p due to error on echochannel %d", this, err); if (m_pDataChannels) m_pDataChannels->RemoveDataChannel(this); g_globals.m_logger.WriteFormated("CDataChannel: End Remove data channel %p", this); } else { if (m_pEchoServerDataChannel->m_bOffLoadingDataChannel && (m_pEchoServerDataChannel->m_nRetryCounter < RECONNECTION_COUNT)) { g_globals.m_logger.WriteFormated("CDataChannel: Start trying reuse datachannel %p due to error on localchannel %d", this, err); ((APISocket::CClientSocket*)pSocket)->StopSend(THREAD_STOP_TIMEOUT); ((APISocket::CClientSocket*)pSocket)->StopAsync(); m_pEchoServerDataChannel->ResetRetryTimer(); m_pEchoServerDataChannel->m_fStartRetry = true; g_globals.m_logger.WriteFormated("CDataChannel: End trying reuse datachannel %p due to error on localchannel %d", this, err); return; } g_globals.m_logger.WriteFormated("CDataChannel: Start Remove data channel %p due to error on localchannel %d", this, err); if (m_pDataChannels) m_pDataChannels->RemoveDataChannel(this); g_globals.m_logger.WriteFormated("CDataChannel: End Remove data channel %p", this); } } //sets the encryption level void CDataChannel::SetEncriptionLevel(int nLevel) { m_pEchoServerDataChannel->SetEncriptionLevel(nLevel); } //gets the encryption level int CDataChannel::GetEncriptionLevel() { return m_pEchoServerDataChannel->GetEncriptionLevel(); } //notify that we have a local connection //there are 2 types of local connections : OffLoadingDataChannel or not //try to create the data channel to echoServer void CDataChannel::OnLocalDataChannel(unsigned int sock, bool bOffLoadingDataChannel/*=false*/) { m_pLocalDataChannel->Attach(sock); //m_pLocalDataChannel->SetOffLoadingDataChannel(bOffLoadingDataChannel); if (!bOffLoadingDataChannel) { g_globals.m_logger.WriteFormated("CDataChannel: Try connect data channel %p to channel code %s", this, m_szChannelCode); if (!m_pEchoServerDataChannel->Create() || m_pEchoServerDataChannel->Connect(m_pDataChannels->GetProxyInfo()->GetIP(), atoi(m_pDataChannels->GetProxyInfo()->GetPort()), m_szChannelCode, m_pDataChannels->GetProxyInfo()->GetMyID())!=0) { OnError(m_pEchoServerDataChannel, 1); g_globals.m_logger.WriteFormated("CDataChannel: Error connect data channel %p to channel code %s", this, m_szChannelCode); return; } g_globals.m_logger.WriteFormated("CDataChannel: Success connect data channel %p to channel code %s", this, m_szChannelCode); m_pLocalDataChannel->SetPairChannel(m_pEchoServerDataChannel); m_pEchoServerDataChannel->SetPairChannel(m_pLocalDataChannel); m_pEchoServerDataChannel->StartSend(); } m_pLocalDataChannel->StartSend(); } ================================================ FILE: Bundles/Echoware/DataChannel.h ================================================ #ifndef _DATACHANNEL_H #define _DATACHANNEL_H #if _MSC_VER > 1000 #pragma once #endif class CDataChannels; class CLocalDataChannel; class CEchoSrvDataChannel; class CLocalDCTimer; #include "LocalListener.h" #include "AES.h" //class for pair Local connection<->echoServer connection class CDataChannel { public: CDataChannel(CDataChannels* pDataChannels, const char* szChannelCode, const char* szSessionKey, bool bEncryptDecrypt); virtual ~CDataChannel(void); //connect to echoServer bool ConnectEchoServer(); //connect to local server bool ConnectLocalServer(); //connect to local server bool ConnectLocalServer(unsigned int nPort); //listen for local client bool Listen(unsigned int& nPort); void StopListen(); void OnError(APISocket::CSocket* pSocket, unsigned int err); //sets the encryption level for this data channel void SetEncriptionLevel(int nLevel); //gets the encryption level for this data channel int GetEncriptionLevel(); //a local connection void OnLocalDataChannel(unsigned int sock, bool bOffLoadingDataChannel=false); const char* GetSessionKey(){return m_szSessionKey;} CLocalDataChannel* m_pLocalDataChannel; protected: //the data channels manager CDataChannels* m_pDataChannels; CLocalListener m_localListener; CEchoSrvDataChannel* m_pEchoServerDataChannel; char* m_szChannelCode; char* m_szSessionKey; public: CAES m_aes; bool m_bEncryptDecrypt; CCritSection m_crtLocalDCSection; bool m_bLocalDC; }; #endif ================================================ FILE: Bundles/Echoware/DataChannelSocket.cpp ================================================ #include "StdAfx.h" #include "datachannelsocket.h" #include "DataChannel.h" CDataChannelSocket::CDataChannelSocket(CDataChannel* pDataChannel) { m_pDataChannel=pDataChannel; m_pRecvBuffer=new CBuffer(); m_pSendBuffer=new CBuffer(); m_nEncriptionLevel=1; m_pPairChannel=0; } CDataChannelSocket::~CDataChannelSocket(void) { StopSend(THREAD_STOP_TIMEOUT); Close(); delete m_pRecvBuffer; m_pRecvBuffer=0; delete m_pSendBuffer; m_pSendBuffer=0; } void CDataChannelSocket::OnReceive(char* buff, int len) { m_pPairChannel->WriteData(buff, len); } void CDataChannelSocket::OnSend(char* buff, int& len) { len = m_pSendBuffer->Read(buff, len); } void CDataChannelSocket::OnError(int error) { CClientSocket::OnError(error); m_pDataChannel->OnError(this, error); } //sets the pair data channel for this data channel void CDataChannelSocket::SetPairChannel(CDataChannelSocket* pPairChannel) { m_pPairChannel=pPairChannel; } //gets the pair data channel for this data channel CDataChannelSocket* CDataChannelSocket::GetPairChannel() { return m_pPairChannel; } void CDataChannelSocket::ReadData(char* buff, unsigned int& read_size) { read_size = m_pRecvBuffer->Read(buff, read_size); } void CDataChannelSocket::WriteData(char* buff, unsigned int write_size) { m_pSendBuffer->Write(buff, write_size); } //sets the encryption level for this data channel void CDataChannelSocket::SetEncriptionLevel(int nLevel) { m_nEncriptionLevel=nLevel; } //gets the encryption level for this data channel int CDataChannelSocket::GetEncriptionLevel() { return m_nEncriptionLevel; } ================================================ FILE: Bundles/Echoware/DataChannelSocket.h ================================================ #ifndef _DATACHANNELSOCKET_H #define _DATACHANNELSOCKET_H #if _MSC_VER > 1000 #pragma once #endif #include "apisocket.h" class CDataChannel; class CBuffer; //data channel socket class //a base class for CLocalDataChannel class and CEchoSrvDataChannel class class CDataChannelSocket : public APISocket::CClientSocket { public: CDataChannelSocket(CDataChannel* pDataChannel); virtual ~CDataChannelSocket(void); //notification : there are data to read //[in] len : length of data //[in] buff: data virtual void OnReceive(char* buff, int len); //notification : can send data //[in] len : length of data //[in] buff: data virtual void OnSend(char* buff, int& len); //notification : receive error //[out] error virtual void OnError(int error); //sets the pair data channel for this data channel void SetPairChannel(CDataChannelSocket* pPairChannel); //gets the pair data channel for this data channel CDataChannelSocket* GetPairChannel(); void ReadData(char* buff, unsigned int& read_size); void WriteData(char* buff, unsigned int write_size); //sets the encryption level for this data channel void SetEncriptionLevel(int nLevel); //gets the encryption level for this data channel int GetEncriptionLevel(); protected: //the parent data channel CDataChannel* m_pDataChannel; //buffers for recv/send on socket CBuffer* m_pRecvBuffer; CBuffer* m_pSendBuffer; //the pair data channel for this data channel CDataChannelSocket* m_pPairChannel; int m_nEncriptionLevel; }; #endif ================================================ FILE: Bundles/Echoware/DataChannel_timer.cpp ================================================ #include "StdAfx.h" #include "DataChannel.h" #include "DataChannels.h" #include "LocalDataChannel.h" #include "EchoSrvDataChannel.h" #include "DllProxyInfo.h" #define RSA_PUBLIC_KEY 80 #pragma warning(disable : 4355) CDataChannel::CDataChannel(CDataChannels* pDataChannels, const char* szChannelCode, const char* szSessionKey, bool bEncryptDecrypt) : m_localListener(this), m_bEncryptDecrypt(bEncryptDecrypt) { m_pLocalDCTimer=new CLocalDCTimer(this); m_bLocalDC=false; m_pDataChannels=pDataChannels; m_pLocalDataChannel=new CLocalDataChannel(this); m_pEchoServerDataChannel=new CEchoSrvDataChannel(this); const CDllProxyInfo* pProxyInfo=pDataChannels->GetProxyInfo(); m_pLocalDataChannel->SetTimeouts(pProxyInfo->GetConnectTimeout()*1000, pProxyInfo->GetSendTimeout()*1000, pProxyInfo->GetReceiveTimeout()*1000); m_pEchoServerDataChannel->SetTimeouts(pProxyInfo->GetConnectTimeout()*1000, pProxyInfo->GetSendTimeout()*1000, pProxyInfo->GetReceiveTimeout()*1000); m_szChannelCode=new char[12]; strcpy(m_szChannelCode, szChannelCode); m_szSessionKey=new char[1024]; strcpy(m_szSessionKey, szSessionKey); m_aes.SetEncryptKey((const unsigned char*)m_szSessionKey, 128); m_aes.SetDecryptKey((const unsigned char*)m_szSessionKey, 128); g_globals.m_logger.WriteFormated("CDataChannel: New data channel: code=%s , encrypt=%c", szChannelCode, (m_bEncryptDecrypt)?('Y'):('N')); } #pragma warning(default : 4355) CDataChannel::~CDataChannel(void) { if (m_pLocalDCTimer) { delete m_pLocalDCTimer; m_pLocalDCTimer=0; } StopListen(); if (m_pEchoServerDataChannel) { m_pEchoServerDataChannel->Shutdown(SD_BOTH); m_pEchoServerDataChannel->Close(); m_pEchoServerDataChannel->StopReceive(THREAD_STOP_TIMEOUT); m_pEchoServerDataChannel->StopSend(THREAD_STOP_TIMEOUT); } if (m_pLocalDataChannel) { m_pLocalDataChannel->Shutdown(SD_BOTH); m_pLocalDataChannel->Close(); m_pLocalDataChannel->StopReceive(THREAD_STOP_TIMEOUT); m_pLocalDataChannel->StopSend(THREAD_STOP_TIMEOUT); } if (m_pEchoServerDataChannel) { delete m_pEchoServerDataChannel; m_pEchoServerDataChannel=0; } if (m_pLocalDataChannel) { delete m_pLocalDataChannel; m_pLocalDataChannel=0; } delete []m_szChannelCode; delete []m_szSessionKey; } bool CDataChannel::ConnectEchoServer() { g_globals.m_logger.Write("=>ConnectEchoServer"); if (!m_pEchoServerDataChannel->Create() || m_pEchoServerDataChannel->Connect(m_pDataChannels->GetProxyInfo()->GetIP(), atoi(m_pDataChannels->GetProxyInfo()->GetPort()), m_szChannelCode, m_pDataChannels->GetProxyInfo()->GetMyID())!=0) { OnError(m_pEchoServerDataChannel, 1); g_globals.m_logger.WriteFormated("CDataChannel: Error connect data channel %p to channel code %s", this, m_szChannelCode); return false; } m_pLocalDataChannel->SetPairChannel(m_pEchoServerDataChannel); m_pEchoServerDataChannel->SetPairChannel(m_pLocalDataChannel); m_pEchoServerDataChannel->SetOffLoadingDataChannel(); m_pEchoServerDataChannel->StartReceive(); m_pEchoServerDataChannel->StartSend(); //ConnectLocalServer(); m_pLocalDCTimer->SetTimer(CONNECTION_TO_OFFLOAD_TIMER_VALUE); g_globals.m_logger.Write("<=ConnectEchoServer"); return true; } bool CDataChannel::ConnectLocalServer() { m_pDataChannels->LocalConnectDataChannel(this); return true; } //try to connect to the local server on the port nPort bool CDataChannel::ConnectLocalServer(unsigned int nPort) { g_globals.m_logger.Write("=>CDataChannel::ConnectLocalServer"); m_crtLocalDCSection.Lock(); if (m_bLocalDC) { m_crtLocalDCSection.Unlock(); return true; } if (m_pLocalDCTimer) { delete m_pLocalDCTimer; m_pLocalDCTimer=0; } g_globals.m_logger.Write("=>Try connect local server"); APISocket::CClientSocket client; if (!client.Create()) { m_crtLocalDCSection.Unlock(); g_globals.m_logger.Write("<=Try connect local server - error create"); return false; } client.SetBlockMode(false); const CDllProxyInfo* pProxyInfo=m_pDataChannels->GetProxyInfo(); client.SetTimeouts(pProxyInfo->GetConnectTimeout(), pProxyInfo->GetSendTimeout(), pProxyInfo->GetReceiveTimeout()); if (client.Connect("127.0.0.1", nPort)!=0) { m_crtLocalDCSection.Unlock(); g_globals.m_logger.Write("<=Try connect local server - error connect"); return false; } m_bLocalDC=true; OnLocalDataChannel(client.Detach(), true); g_globals.m_logger.Write("<=Try connect local server - success"); m_crtLocalDCSection.Unlock(); return true; } //start to listen for local connections bool CDataChannel::Listen(unsigned int& nPort) { g_globals.m_logger.Write("CDataChannel: Enter Listen for local client"); if (!m_localListener.Create()) return false; if (!m_localListener.Listen()) return false; nPort=m_localListener.GetListenPort(); if (!m_localListener.StartAccept()) return false; g_globals.m_logger.Write("CDataChannel: Listen for local client started"); return true; } //stop listen for local connections void CDataChannel::StopListen() { m_localListener.Close(); m_localListener.StopAccept(5000); } //notify that there was an error on sockets operations void CDataChannel::OnError(APISocket::CSocket* pSocket, unsigned int err) { g_globals.m_logger.WriteFormated("CDataChannel: Start Remove data channel %p", this); if (m_pDataChannels) m_pDataChannels->RemoveDataChannel(this); g_globals.m_logger.WriteFormated("CDataChannel: End Remove data channel %p", this); } //sets the encryption level void CDataChannel::SetEncriptionLevel(int nLevel) { m_pEchoServerDataChannel->SetEncriptionLevel(nLevel); } //gets the encryption level int CDataChannel::GetEncriptionLevel() { return m_pEchoServerDataChannel->GetEncriptionLevel(); } //notify that we have a local connection //there are 2 types of local connections : OffLoadingDataChannel or not //try to create the data channel to echoServer void CDataChannel::OnLocalDataChannel(unsigned int sock, bool bOffLoadingDataChannel/*=false*/) { m_pLocalDataChannel->Attach(sock); m_pLocalDataChannel->m_bOffLoadingDataChannel=bOffLoadingDataChannel; if (!bOffLoadingDataChannel) { g_globals.m_logger.WriteFormated("CDataChannel: Try connect data channel %p to channel code %s", this, m_szChannelCode); if (!m_pEchoServerDataChannel->Create() || m_pEchoServerDataChannel->Connect(m_pDataChannels->GetProxyInfo()->GetIP(), atoi(m_pDataChannels->GetProxyInfo()->GetPort()), m_szChannelCode, m_pDataChannels->GetProxyInfo()->GetMyID())!=0) { OnError(m_pEchoServerDataChannel, 1); g_globals.m_logger.WriteFormated("CDataChannel: Error connect data channel %p to channel code %s", this, m_szChannelCode); return; } g_globals.m_logger.WriteFormated("CDataChannel: Success connect data channel %p to channel code %s", this, m_szChannelCode); m_pLocalDataChannel->SetPairChannel(m_pEchoServerDataChannel); m_pEchoServerDataChannel->SetPairChannel(m_pLocalDataChannel); m_pEchoServerDataChannel->StartReceive(); m_pEchoServerDataChannel->StartSend(); } m_pLocalDataChannel->StartReceive(); m_pLocalDataChannel->StartSend(); } ================================================ FILE: Bundles/Echoware/DataChannels.cpp ================================================ #include "StdAfx.h" #include "DataChannels.h" #include "DataChannel.h" #include "pthread.h" #define WM_REMOVE_CHANNEL (WM_USER+1) #define WM_REMOVE_ALLCHANNEL (WM_USER+2) #define WM_LOCAL_CONNECT_DC (WM_USER+3) CDataChannels::CDataChannels(CDllProxyInfo* pProxyInfo) { pthread_mutex_init(&m_ManageThreadMutex, NULL); pthread_cond_init(&m_ManageThreadCond, NULL); m_nEncriptionLevel=1; m_pProxyInfo=pProxyInfo; removeChannel = 0; localConnectDC = 0; removeAllChannels = false; shouldQuit = 0; hasQuit = 0; m_hManageThread=CreateThread(0, 0, ManageThreadProc, this, 0, &m_dwManageThread); } CDataChannels::~CDataChannels(void) { shouldQuit=1; pthread_cond_signal(&m_ManageThreadCond); ShutdownThread(m_hManageThread, THREAD_STOP_TIMEOUT, &shouldQuit, &hasQuit); m_hManageThread=0; m_dwManageThread=0; } //adds a data channel to the list void CDataChannels::AddDataChannel(CDataChannel* pDataChannel) { g_globals.m_logger.WriteFormated("CDataChannels: Enter Add data channel %p", pDataChannel); m_critSection.Lock(); m_lstDataChannels.push_back(pDataChannel); pDataChannel->SetEncriptionLevel(m_nEncriptionLevel); m_critSection.Unlock(); g_globals.m_logger.WriteFormated("CDataChannels: Exit Add data channel %p, count=%d", pDataChannel, m_lstDataChannels.size()); } void CDataChannels::InternalRemoveDataChannel(CDataChannel* pDataChannel) { g_globals.m_logger.WriteFormated("CDataChannels: Enter Remove data channel %p", pDataChannel); m_critSection.Lock(); size_t size=m_lstDataChannels.size(); m_lstDataChannels.remove(pDataChannel); if (m_lstDataChannels.size()::iterator it=m_lstDataChannels.begin(); it!=m_lstDataChannels.end(); it++) { i++; CDataChannel* pDataChannel=(CDataChannel*)(*it); g_globals.m_logger.WriteFormated("Remove channel %d %d", i, pDataChannel); delete pDataChannel; *it=0; } m_lstDataChannels.clear(); g_globals.m_logger.Write("CDataChannels: Remove all data channel"); m_critSection.Unlock(); } //removes a data channel from the list void CDataChannels::RemoveDataChannel(CDataChannel* pDataChannel) { if (m_hManageThread) { pthread_mutex_lock(&m_ManageThreadMutex); removeChannel = pDataChannel; pthread_mutex_unlock(&m_ManageThreadMutex); pthread_cond_signal(&m_ManageThreadCond); } } //removes all the data channels from the list void CDataChannels::RemoveAllDataChannels() { if (m_hManageThread) { pthread_mutex_lock(&m_ManageThreadMutex); removeAllChannels = true; pthread_mutex_unlock(&m_ManageThreadMutex); pthread_cond_signal(&m_ManageThreadCond); } } //sets the encryption level for this proxy connection void CDataChannels::SetEncriptionLevel(int nLevel) { m_critSection.Lock(); m_nEncriptionLevel=nLevel; for(std::list::iterator it=m_lstDataChannels.begin(); it!=m_lstDataChannels.end(); it++) ((CDataChannel*)*it)->SetEncriptionLevel(nLevel); m_critSection.Unlock(); } //gets the encryption level for this proxy connection int CDataChannels::GetEncriptionLevel() { return m_nEncriptionLevel; } void CDataChannels::LocalConnectDataChannel(CDataChannel* pDataChannel) { if (m_hManageThread) { pthread_mutex_lock(&m_ManageThreadMutex); localConnectDC = pDataChannel; pthread_mutex_unlock(&m_ManageThreadMutex); pthread_cond_signal(&m_ManageThreadCond); } } void CDataChannels::InternalLocalConnectDataChannel(CDataChannel* pDataChannel) { //g_globals.m_logger.WriteFormated("CDataChannels: Enter InternalLocalConnectDataChannel data channel %p", pDataChannel); m_critSection.Lock(); for (std::list::iterator it=m_lstDataChannels.begin(); it!=m_lstDataChannels.end(); it++) { if (*it==pDataChannel) { if (!pDataChannel->ConnectLocalServer(g_globals.GetPortForOffLoadingData())) { RemoveDataChannel(pDataChannel); } break; } } m_critSection.Unlock(); //g_globals.m_logger.WriteFormated("CDataChannels: Exit InternalLocalConnectDataChannel data channel %p", pDataChannel); } #include "InterfaceDllProxyInfo.h" #include "DllProxyInfo.h" unsigned long __stdcall CDataChannels::ManageThreadProc(void* lpParameter) { CDataChannels* pDataChannels=(CDataChannels*)lpParameter; while (true) { pthread_cond_wait(&pDataChannels->m_ManageThreadCond, &pDataChannels->m_ManageThreadMutex); if (pDataChannels->shouldQuit) { pthread_mutex_unlock(&pDataChannels->m_ManageThreadMutex); break; } if (pDataChannels->removeChannel) { pDataChannels->InternalRemoveDataChannel(pDataChannels->removeChannel); pDataChannels->removeChannel=0; } if (pDataChannels->removeAllChannels) { pDataChannels->removeAllChannels=FALSE; pDataChannels->InternalRemoveAllDataChannels(); } if (pDataChannels->localConnectDC) { pDataChannels->InternalLocalConnectDataChannel(pDataChannels->localConnectDC); pDataChannels->localConnectDC=0; } pthread_mutex_unlock(&pDataChannels->m_ManageThreadMutex); } pDataChannels->hasQuit=true; pthread_cond_destroy(&pDataChannels->m_ManageThreadCond); pthread_mutex_destroy(&pDataChannels->m_ManageThreadMutex); return 0; } ================================================ FILE: Bundles/Echoware/DataChannels.h ================================================ #ifndef _DATACHANNELS_H #define _DATACHANNELS_H #if _MSC_VER > 1000 #pragma once #endif class CDataChannel; class CDllProxyInfo; #include "CritSection.h" #include #include "pthread.h" //data channels manager //manages all data channels for a proxy connection class CDataChannels { public: CDataChannels(CDllProxyInfo* pProxyInfo); virtual ~CDataChannels(void); //adds a data channel to the list void AddDataChannel(CDataChannel* pDataChannel); //removes a data channel from the list void RemoveDataChannel(CDataChannel* pDataChannel); //removes all the data channels from the list void RemoveAllDataChannels(); //make a local data channel connection void LocalConnectDataChannel(CDataChannel* pDataChannel); //sets the encryption level for this proxy connection void SetEncriptionLevel(int nLevel); //gets the encryption level for this proxy connection int GetEncriptionLevel(); const CDllProxyInfo* GetProxyInfo() const {return m_pProxyInfo;} // Thread communication flags bool shouldQuit; bool hasQuit; bool removeAllChannels; CDataChannel *removeChannel; CDataChannel *localConnectDC; pthread_cond_t m_ManageThreadCond; pthread_mutex_t m_ManageThreadMutex; protected: void InternalRemoveDataChannel(CDataChannel* pDataChannel); void InternalRemoveAllDataChannels(); void InternalLocalConnectDataChannel(CDataChannel* pDataChannel); protected: CCritSection m_critSection; std::list m_lstDataChannels; int m_nEncriptionLevel; CDllProxyInfo* m_pProxyInfo; protected: void* m_hManageThread; unsigned long m_dwManageThread; //thread proc for manage data channel notifications static unsigned long __stdcall ManageThreadProc(void* lpParameter); }; #endif ================================================ FILE: Bundles/Echoware/DirService.cpp ================================================ /* * DirService.cpp * Echoware * * Created by admin on 4/11/07. * Copyright 2007 __MyCompanyName__. All rights reserved. * */ #include "DirService.h" CDirService::CDirService() { tDirStatus dsStatus; dsRef = 0; dsSearchNodeRef = 0; dsStatus = dsOpenDirService(&dsRef); if (dsStatus != eDSNoErr) { cleanup(); return; } dsStatus = OpenSearchNode(dsRef, &dsSearchNodeRef); if (dsStatus != eDSNoErr) { cleanup(); return; } } CDirService::~CDirService() { cleanup(); } void CDirService::cleanup() { if (dsSearchNodeRef) dsCloseDirNode(dsSearchNodeRef); dsSearchNodeRef = 0; if (dsRef) dsCloseDirService(dsRef); dsRef = 0; } NSDictionary* CDirService::attributeDataForNodeOfType(const char* type, const char* value, const char* attr1, const char* attr2, const char* attr3, const char* attr4, const char* attr5, const char* attr6) { NSMutableDictionary* dict = [NSMutableDictionary dictionary]; tDirStatus dsStatus = eDSRecordNotFound; tDataListPtr pAttribsToGet = NULL; tDataListPtr pRecTypeList = NULL; tDataListPtr pRecNameList = NULL; tDataBufferPtr pSearchBuffer = NULL; unsigned long ulRecCount = 0; // do not limit the number of records we are expecting unsigned long ulBufferSize = 2048; // start with a 2k buffer for any data // we will want the actual record name and the name of the node where the user resides pAttribsToGet = dsBuildListFromStrings( dsRef, attr1, attr2, attr3, attr4, attr5, attr6 ); if( pAttribsToGet == NULL ) { dsStatus = eMemoryAllocError; goto cleanup; } // build a list to search for user record pRecNameList = dsBuildListFromStrings( dsRef, value, NULL ); if( pRecNameList == NULL ) { dsStatus = eMemoryAllocError; goto cleanup; } // build a list of record types to search, in this case users pRecTypeList = dsBuildListFromStrings( dsRef, type, NULL); if( pRecTypeList == NULL ) { dsStatus = eMemoryAllocError; goto cleanup; } // allocate a working buffer, this may be grown if we receive a eDSBufferTooSmall error pSearchBuffer = dsDataBufferAllocate( dsRef, ulBufferSize ); if( pSearchBuffer == NULL ) { dsStatus = eMemoryAllocError; goto cleanup; } // now search for the record using dsGetRecordList dsStatus = dsGetRecordList( dsSearchNodeRef, pSearchBuffer, pRecNameList, eDSExact, pRecTypeList, pAttribsToGet, 0, &ulRecCount, NULL ); // if there was not an error and we found only 1 record for this user if( dsStatus == eDSNoErr && ulRecCount == 1 ) { tAttributeListRef dsAttributeListRef = 0; tRecordEntryPtr dsRecordEntryPtr = 0; int ii; // Get the 1st record entry from the buffer since we only expect 1 result dsStatus = dsGetRecordEntry( dsSearchNodeRef, pSearchBuffer, 1, &dsAttributeListRef, &dsRecordEntryPtr ); if (dsStatus == eDSNoErr) { // loop through the attributes in the record to get the data we requested // all indexes with Open Directory APIs start with 1 not 0 for (ii = 1 ; ii <= dsRecordEntryPtr->fRecordAttributeCount; ii++) { tAttributeEntryPtr dsAttributeEntryPtr = NULL; tAttributeValueEntryPtr dsAttributeValueEntryPtr = NULL; tAttributeValueListRef dsAttributeValueListRef = 0; // get the attribute entry from the record dsStatus = dsGetAttributeEntry( dsSearchNodeRef, pSearchBuffer, dsAttributeListRef, ii, &dsAttributeValueListRef, &dsAttributeEntryPtr ); // get the value from the attribute if we were successful at getting an entry if( dsStatus == eDSNoErr ) { int valueIndex=1; NSMutableArray* values = [NSMutableArray array]; while( (dsStatus = dsGetAttributeValue( dsSearchNodeRef, pSearchBuffer, valueIndex, dsAttributeValueListRef, &dsAttributeValueEntryPtr )) == eDSNoErr ) { NSString* key = [NSString stringWithCString: dsAttributeEntryPtr->fAttributeSignature.fBufferData encoding: NSUTF8StringEncoding]; NSString* value = [NSString stringWithCString: dsAttributeValueEntryPtr->fAttributeValueData.fBufferData encoding: NSUTF8StringEncoding]; [values addObject:value]; if ([dict objectForKey:key]==nil) { [dict setObject:values forKey:key]; } valueIndex++; } } // close any value list references that may have been opened if( dsAttributeValueListRef != 0 ) { dsCloseAttributeValueList( dsAttributeValueListRef ); dsAttributeValueListRef = 0; } // free the attribute value entry if we got an entry if( dsAttributeValueEntryPtr != NULL ) { dsDeallocAttributeValueEntry( dsRef, dsAttributeValueEntryPtr ); dsAttributeValueEntryPtr = NULL; } // free the attribute entry itself as well if( dsAttributeEntryPtr != NULL ) { dsDeallocAttributeEntry( dsRef, dsAttributeEntryPtr ); dsAttributeEntryPtr = NULL; } } // close any reference to attribute list if( dsAttributeListRef != 0 ) { dsCloseAttributeList( dsAttributeListRef ); dsAttributeListRef = 0; } // deallocate the record entry if( dsRecordEntryPtr != NULL ) { dsDeallocRecordEntry( dsRef, dsRecordEntryPtr ); dsRecordEntryPtr = NULL; } } } else if( dsStatus == eDSNoErr && ulRecCount > 1 ) { // if we have more than 1 user, then we shouldn't attempt to authenticate // we chose to return eDSAuthInvalidUserName as an error since we can't distinguish // the specific user to return dsStatus = eDSAuthInvalidUserName; } cleanup: // if we allocated pAttribsToGet, we need to clean up if( pAttribsToGet != NULL ) { dsDataListDeallocate( dsRef, pAttribsToGet ); // need to free pointer as dsDataListDeallocate does not free it, just the list items free( pAttribsToGet ); pAttribsToGet = NULL; } // if we allocated pRecTypeList, we need to clean up if( pRecTypeList != NULL ) { dsDataListDeallocate( dsRef, pRecTypeList ); // need to free pointer as dsDataListDeallocate does not free it, just the list items free( pRecTypeList ); pRecTypeList = NULL; } // if we allocated pRecNameList, we need to clean up if( pRecNameList != NULL ) { dsDataListDeallocate( dsRef, pRecNameList ); // need to free pointer as dsDataListDeallocate does not free it, just the list items free( pRecNameList ); pRecNameList = NULL; } // if we allocated pSearchBuffer, we need to clean up if( pSearchBuffer != NULL ) { dsDataBufferDeAllocate( dsRef, pSearchBuffer ); pSearchBuffer = NULL; } return dict; } bool CDirService::authenticateUser(const char* username, const char* password) { NSDictionary* userInfo = attributeDataForNodeOfType(kDSStdRecordTypeUsers, username, kDSNAttrRecordName, kDSNAttrMetaNodeLocation, NULL, NULL, NULL, NULL); NSString* recordName = [[userInfo objectForKey:[NSString stringWithCString:kDSNAttrRecordName encoding:NSUTF8StringEncoding]] objectAtIndex:0]; NSString* nodeLocation = [[userInfo objectForKey:[NSString stringWithCString:kDSNAttrMetaNodeLocation encoding:NSUTF8StringEncoding]] objectAtIndex:0]; bool rc = false; if ([recordName length] > 0 && [nodeLocation length] > 0) { tDirNodeReference dsUserNodeRef = 0; tDirStatus dsStatus; tDataListPtr dsUserNodePath = dsBuildFromPath( dsRef, [nodeLocation cStringUsingEncoding:NSUTF8StringEncoding], "/" ); dsStatus = dsOpenDirNode( dsRef, dsUserNodePath, &dsUserNodeRef ); if ( dsStatus == eDSNoErr ) { // Use our Utility routine to do the authentication dsStatus = DoPasswordAuth( dsRef, dsUserNodeRef, kDSStdAuthNodeNativeClearTextOK, [recordName cStringUsingEncoding:NSUTF8StringEncoding], password ); // Determine if successful. There are cases where you may receive other errors // such as eDSAuthPasswordExpired. if ( dsStatus == eDSNoErr ) { rc = true; } } // free the data list as it is no longer needed dsDataListDeallocate( dsRef, dsUserNodePath ); free( dsUserNodePath ); dsUserNodePath = NULL; } return rc; } tDirStatus CDirService::OpenSearchNode(tDirReference inDSRef, tDirNodeReference *outNodeRef) { tDataBufferPtr pWorkingBuffer = NULL; tDataListPtr pSearchNode = NULL; tDirStatus dsStatus; tContextData dsContext = NULL; unsigned long ulReturnCount = 0; // verify none of the parameters are NULL, if so return an eDSNullParameter if( outNodeRef == NULL || inDSRef == 0 ) { return eDSNullParameter; } // allocate a buffer to hold return information, defaulting to 4k pWorkingBuffer = dsDataBufferAllocate( inDSRef, 4096 ); if( pWorkingBuffer == NULL ) { return eMemoryAllocError; } // locate the name of the search node dsStatus = dsFindDirNodes( inDSRef, pWorkingBuffer, NULL, eDSSearchNodeName, &ulReturnCount, &dsContext ); if( dsStatus == eDSNoErr ) { // pass 1 for node index since there should only be one value dsStatus = dsGetDirNodeName( inDSRef, pWorkingBuffer, 1, &pSearchNode ); } // if we ended up with a context, we should release it if( dsContext != NULL ) { dsReleaseContinueData( inDSRef, dsContext ); dsContext = NULL; } // release the current working buffer if( pWorkingBuffer != NULL ) { dsDataBufferDeAllocate( inDSRef, pWorkingBuffer ); pWorkingBuffer = NULL; } // open search node if( dsStatus == eDSNoErr && pSearchNode != NULL ) { dsStatus = dsOpenDirNode( inDSRef, pSearchNode, outNodeRef ); } // deallocate the tDataListPtr item used to locate the Search node if( pSearchNode != NULL ) { dsDataListDeallocate( inDSRef, pSearchNode ); // need to free pointer as dsDataListDeallocate does not free it, just the list items free( pSearchNode ); pSearchNode = NULL; } return dsStatus; } // OpenSearchNode tDirStatus CDirService::DoPasswordAuth(tDirReference inDSRef, tDirNodeReference inNodeRef, const char *inAuthMethod, const char *inRecordName, const char *inPassword) { tDirStatus dsStatus = eDSAuthFailed; tDataNodePtr pAuthMethod = NULL; tDataBufferPtr pAuthStepData = NULL; tDataBufferPtr pAuthRespData = NULL; tContextData pContextData = NULL; // if any of our parameters are NULL, return a NULL parameter // if a password is not set for a user, an empty string should be sent for the password if( inDSRef == 0 || inNodeRef == 0 || inRecordName == NULL || inPassword == NULL ) { return eDSNullParameter; } // since this is password based, we can only support password-based methods if( strcmp(inAuthMethod, kDSStdAuthNodeNativeNoClearText) == 0 || strcmp(inAuthMethod, kDSStdAuthNodeNativeClearTextOK) == 0 || strcmp(inAuthMethod, kDSStdAuthClearText) == 0 || strcmp(inAuthMethod, kDSStdAuthCrypt) == 0 ) { // turn the specified method into a tDataNode pAuthMethod = dsDataNodeAllocateString( inDSRef, inAuthMethod ); if( pAuthMethod == NULL ) { dsStatus = eMemoryAllocError; goto cleanup; } // allocate a buffer large enough to hold all the username and password plus length bytes pAuthStepData = dsDataBufferAllocate( inDSRef, 4 + strlen(inRecordName) + 4 + strlen(inPassword) ); if( pAuthStepData == NULL ) { dsStatus = eMemoryAllocError; goto cleanup; } // allocate a buffer for the out step data even though we don't expect anything, // it is a required parameter pAuthRespData = dsDataBufferAllocate( inDSRef, 128 ); if( pAuthRespData == NULL ) { dsStatus = eMemoryAllocError; goto cleanup; } // now place the username and password into the buffer AppendStringToBuffer( pAuthStepData, inRecordName, strlen(inRecordName) ); AppendStringToBuffer( pAuthStepData, inPassword, strlen(inPassword) ); // attempt the authentication dsStatus = dsDoDirNodeAuth( inNodeRef, pAuthMethod, 1, pAuthStepData, pAuthRespData, &pContextData ); } else { // otherwise, return a parameter error dsStatus = eDSAuthParameterError; } cleanup: // release pContextData if we had continue data if( pContextData != NULL ) { dsReleaseContinueData( inDSRef, pContextData ); pContextData = NULL; } // deallocate memory for pAuthRespData if it was allocated if( pAuthRespData != NULL ) { dsDataNodeDeAllocate( inDSRef, pAuthRespData ); pAuthRespData = NULL; } // deallocate memory for pAuthStepData if it was allocated if( pAuthStepData != NULL ) { dsDataBufferDeAllocate( inDSRef, pAuthStepData ); pAuthStepData = NULL; } // deallocate memory for pAuthMethod if it was allocated if( pAuthMethod != NULL ) { dsDataNodeDeAllocate( inDSRef, pAuthMethod ); pAuthMethod = NULL; } return dsStatus; } // DoPasswordAuth #pragma mark Support Functions tDirStatus CDirService::AppendStringToBuffer(tDataBufferPtr inBuffer, const char *inString, long inLength) { tDirStatus dsStatus = eDSBufferTooSmall; // ensure neither of our parameters are NULL if( inString == NULL || inBuffer == NULL ) { return eDSNullParameter; } // check to see if we have enough room in the buffer for the string and the 4 byte length if( inBuffer->fBufferSize >= (inBuffer->fBufferLength + 4 + inLength) ) { char *pBufferEnd = inBuffer->fBufferData + inBuffer->fBufferLength; // prepend the data with the length of the string bcopy( &inLength, pBufferEnd, sizeof(long) ); pBufferEnd += sizeof( long ); // now add the string to the buffer bcopy( inString, pBufferEnd, inLength ); // increase the buffer accordingly inBuffer->fBufferLength += 4 + inLength; // set successful error status dsStatus = eDSNoErr; } return dsStatus; } // AppendStringToBuffer ================================================ FILE: Bundles/Echoware/DirService.h ================================================ /* * DirService.h * Echoware * * Created by admin on 4/11/07. * Copyright 2007 __MyCompanyName__. All rights reserved. * */ #import #import class CDirService { private: tDirReference dsRef; tDirNodeReference dsSearchNodeRef; tDirStatus OpenSearchNode(tDirReference inDSRef, tDirNodeReference *outNodeRef); tDirStatus DoPasswordAuth(tDirReference inDSRef, tDirNodeReference inNodeRef, const char *inAuthMethod, const char *inRecordName, const char *inPassword); tDirStatus AppendStringToBuffer(tDataBufferPtr inBuffer, const char *inString, long inLength); public: CDirService(); virtual ~CDirService(); NSDictionary* attributeDataForNodeOfType(const char* type, const char* value, const char* attr1, const char* attr2, const char* attr3, const char* attr4, const char* attr5, const char* attr6); bool authenticateUser(const char* username, const char* password); void cleanup(); }; ================================================ FILE: Bundles/Echoware/DllProxyInfo.cpp ================================================ #include "stdafx.h" #include "DllProxyInfo.h" #include "globals.h" CDllProxyInfo::CDllProxyInfo() : m_strName("") ,m_strIP("") ,m_strPort("") ,m_strPass("") ,m_strMyID("") ,m_dwStatus(0) ,m_strIPPort("") ,m_bReconnectProxy(false) { m_nConnectTimeOut=m_nReceiveTimeOut=m_nSendTimeOut=30; } CDllProxyInfo::~CDllProxyInfo() { } //Sets the Proxy Name for the proxy Info object void CDllProxyInfo::SetName(char* name) { m_strName=name; } //Sets the IP Address of the proxy along with a specified Port void CDllProxyInfo::SetIPPort(char* ipport) { char* p; if ((p=strchr(ipport, ':'))) { m_strIP.assign(ipport, p-ipport); m_strPort.assign(p); } else m_strIP=ipport; m_strIPPort=ipport; } //Sets the IP Address of the proxy info Object void CDllProxyInfo::SetIP(const char* ip) { m_strIP=ip; m_strIPPort=m_strIP; if (!m_strPort.empty()) m_strIPPort+=":"+m_strPort; } //Sets the port of the proxy info object void CDllProxyInfo::SetPort(const char* port) { m_strPort=port; m_strIPPort=m_strIP+":"+m_strPort; } //Sets the authentication channel password for the Proxy void CDllProxyInfo::SetPassword(const char* pass) { m_strPass=pass; } //Sets the status of the proxy whether connected or not void CDllProxyInfo::SetStatus(int Status, bool bStatus) { if (bStatus) m_dwStatus |=Status; else m_dwStatus &=~Status; } //Set ID for authentication and/or identification with a proxy server //Each proxyInfo object may have a different MyID value. bool CDllProxyInfo::SetMyID(const char* MyID) { m_strMyID=MyID; return true; } //Set timeouts for Connect, Receive, Send bool CDllProxyInfo::SetSocketTimeout(int connectTimeout, int ReceiveTimeout, int SendTimeout) { m_nConnectTimeOut=connectTimeout; m_nReceiveTimeOut=ReceiveTimeout; m_nSendTimeOut=SendTimeout; g_globals.m_logger.WriteFormated("CDllProxyInfo: connectTimeout=%d ReceiveTimeout=%d SendTimeout=%d", m_nConnectTimeOut, m_nReceiveTimeOut, m_nSendTimeOut); return true; } //Retrieves the name of the Proxy const char* CDllProxyInfo::GetName() const { return m_strName.c_str(); } //Retrieves the IP and Port of the Proxy info together const char* CDllProxyInfo::GetIpPort() const { if (m_strPort.empty()) return m_strIP.c_str(); return m_strIPPort.c_str(); } //Retrieves the IP address for the Proxy Info const char* CDllProxyInfo::GetIP() const { return m_strIP.c_str(); } //Retrieves the Port for the Proxy const char* CDllProxyInfo::GetPort() const { return m_strPort.c_str(); } //Retrieves the authentication channel password of the Proxy const char* CDllProxyInfo::GetPassword() const { return m_strPass.c_str(); } //Retrieves the status of the Proxy, connected or not, the status of any "in-process" //connection attempts, and all active data connections with those proxies. int CDllProxyInfo::GetStatus() const { return m_dwStatus; } //Obtain the MyID value associated with a proxyInfo object const char* CDllProxyInfo::GetMyID() const { return m_strMyID.c_str(); } int CDllProxyInfo::GetConnectTimeout() const { return m_nConnectTimeOut; } int CDllProxyInfo::GetReceiveTimeout() const { return m_nReceiveTimeOut; } int CDllProxyInfo::GetSendTimeout() const { return m_nSendTimeOut; } bool CDllProxyInfo::GetReconnectProxy() const { return m_bReconnectProxy; } void CDllProxyInfo::SetReconnectProxy(bool bReconnectProxy) { m_bReconnectProxy=bReconnectProxy; } ================================================ FILE: Bundles/Echoware/DllProxyInfo.h ================================================ #ifndef _PROXYINFO_H #define _PROXYINFO_H #if _MSC_VER > 1000 #pragma once #endif #include #include "InterfaceDllProxyInfo.h" //#define ID_STRING_SIZE 255 //IDllProxyInfo implementation class CDllProxyInfo : public IDllProxyInfo { protected: std::string m_strName; std::string m_strIP; std::string m_strPort; std::string m_strPass; std::string m_strMyID; DWORD m_dwStatus; int m_nConnectTimeOut, m_nReceiveTimeOut, m_nSendTimeOut; std::string m_strIPPort; bool m_bReconnectProxy; public: CDllProxyInfo(); virtual ~CDllProxyInfo(); virtual void SetName(char* name); virtual void SetIPPort(char* ipport); virtual void SetIP(const char* ip); virtual void SetPort(const char* port); virtual void SetPassword(const char* pass); virtual void SetStatus(int Status, bool bStatus); virtual bool SetMyID(const char* MyID); virtual bool SetSocketTimeout(int connectTimeout, int ReceiveTimeout, int SendTimeout); virtual void SetReconnectProxy(bool bReconnectProxy); virtual const char* GetName() const; virtual const char* GetIpPort() const; virtual const char* GetIP() const; virtual const char* GetPort() const; virtual const char* GetPassword() const; virtual int GetStatus() const; virtual const char* GetMyID() const; virtual bool GetReconnectProxy()const; virtual int GetConnectTimeout() const; virtual int GetReceiveTimeout() const; virtual int GetSendTimeout() const; }; #endif ================================================ FILE: Bundles/Echoware/EchoController.h ================================================ /* EchoController */ #import class CServerListSynchronize; class CCritSection; class CMyDllProxyInfo; @interface EchoController : NSObject { NSTabView *mainTabView; IBOutlet NSView *echoServersView; @public IBOutlet NSTableView *echoTableView; IBOutlet NSButton *addButton; IBOutlet NSButton *editButton; IBOutlet NSButton *removeButton; IBOutlet NSWindow *addServerWindow; IBOutlet NSWindow *editServerWindow; IBOutlet NSTextFieldCell *echoServerField; IBOutlet NSTextFieldCell *usernameField; IBOutlet NSTextFieldCell *passwordField; IBOutlet NSTextFieldCell *echoServerField_edit; IBOutlet NSTextFieldCell *usernameField_edit; IBOutlet NSTextFieldCell *passwordField_edit; IBOutlet NSButton *advancedSettingsButton; IBOutlet NSWindow *advancedSettingsWindow; IBOutlet NSButton *proxyAuthenticationCheckbox; IBOutlet NSTextField *proxyAddress; IBOutlet NSTextField *proxyPort; IBOutlet NSTextField *proxyUsername; IBOutlet NSTextField *proxyUsernameLabel; IBOutlet NSTextField *proxyPassword; IBOutlet NSTextField *proxyPasswordLabel; IBOutlet NSButton *disableEchoCheckbox; IBOutlet NSButton *enableLoggingCheckbox; //IBOutlet NSButton *useAESCheckbox; YS: 21.12.2006 due to remove "128 bit encryption" button IBOutlet NSTextField *versionTextField; @public NSMutableArray *echoServers; @public NSMutableArray *echoInfoProxys; @public NSMutableArray *echoInfoProxysToRemove; int m_nEditIndex; CServerListSynchronize *m_ServerList; CCritSection *m_critSection; } - (void) loadGUI: sender; - (void) setOffloadingPort: (id)sender; - (void) loadServerList; - (void) loadProxyFields; - (void) reloadData; - (void) selectRow: (int)row; - (void) removeRow: (int)row removeProxy: (bool)rmProxy removeServer: (bool)rmServer; - (CMyDllProxyInfo*) getDllProxyInfo: (int)row; - (void) addInfo: (CMyDllProxyInfo*)info; - (void) saveData; - (NSString*) GetColumnValue: (int)row column: (NSString*)col; - (void)windowWillClose: (NSNotification*)aNotification; - (IBAction)addServer:(id)sender; - (IBAction)advancedSettings:(id)sender; - (IBAction)cancelAddServer:(id)sender; - (IBAction)cancelAdvancedSettings:(id)sender; - (IBAction)completeAddServer:(id)sender; - (IBAction)completeAdvancedSettings:(id)sender; - (IBAction)disableEcho:(id)sender; - (IBAction)enableLogging:(id)sender; - (IBAction)removeServer:(id)sender; - (IBAction)requireProxyAuthentication:(id)sender; - (IBAction)useEncryption:(id)sender; - (IBAction)editServer:(id)sender; - (IBAction)cancelEditServer:(id)sender; - (IBAction)completeEditServer:(id)sender; @end ================================================ FILE: Bundles/Echoware/EchoController.m ================================================ #import "EchoController.h" #import "Echoware.h" #import "InterfaceDLLProxyInfo.h" #import "unistd.h" #include #include #include "User.h" #include "ProxiesManager.h" #include "MyDllProxyInfo.h" #include "globals.h" #include "ServerListSynchronize.h" #include "CritSection.h" static EchoController *sharedEchoController; @interface NSString (EchoExtenstions) - (NSData *) nullTerminatedData; @end @implementation NSString (EchoExtenstions) - (NSData *) nullTerminatedData { return [NSData dataWithBytes:[self lossyCString] length:[self cStringLength]+1]; } @end @implementation EchoController (RFBBundle) + (void) loadGUI { sharedEchoController = [[self alloc] init]; } + (void) rfbUsage { } #include "rfbserver.h" #include "RFBBundleWrapper.h" + (void) rfbStartup: theServer { CRFBBundleWrapper::GetInstance()->rfb_port = ((rfbserver*)theServer)->rfbPort; CRFBBundleWrapper::GetInstance()->is_rfb = true; CRFBBundleWrapper::GetInstance()->UserDefaultsChecking(); CRFBBundleWrapper::GetInstance()->startRunLoop(); } + (void) rfbRunning { } + (void) rfbPoll { } + (void) rfbReceivedClientMessage { } + (void) rfbShutdown { CRFBBundleWrapper::FreeInstance(); } @end @implementation EchoController - init { self = [super init]; if (self) { echoInfoProxys = [[NSMutableArray alloc] init]; echoInfoProxysToRemove = [[NSMutableArray alloc] init]; m_nEditIndex = -1; m_critSection = new CCritSection(); m_ServerList = new CServerListSynchronize(); [self loadGUI: self]; NSLog(@"Starting Threads..."); m_ServerList->Init(); m_ServerList->Start(self); NSLog(@"Starting Threads done..."); } } - (void)windowWillClose: (NSNotification*)aNotification; { NSLog(@"Terminating Threads..."); if (m_ServerList) m_ServerList->Terminate(); NSLog(@"Terminating Threads done..."); NSLog(@"Disconnecting All Connections..."); bool disconnected = DisconnectAllProxies(); NSLog(@"Disconnecting All Connections done... %d", disconnected); if (m_ServerList) delete m_ServerList; m_ServerList = NULL; if (m_critSection) delete m_critSection; m_critSection = NULL; [echoInfoProxys removeAllObjects]; [echoInfoProxysToRemove removeAllObjects]; [echoInfoProxys release]; [echoInfoProxysToRemove release]; [echoServers removeAllObjects]; [echoServers release]; m_nEditIndex = -1; } - (void) loadGUI: sender { NSEnumerator *viewEnum = [[[[[NSApp delegate] window] contentView] subviews] objectEnumerator]; while (mainTabView = [viewEnum nextObject]) if ([mainTabView isKindOfClass:[NSTabView class]]) break; if (mainTabView) { if ([NSBundle loadNibNamed:@"EchoServers" owner:self]) NSLog(@"EchoServer Gui loaded"); else NSLog(@"EchoServer Gui loading Error %d", errno); NSRect rect = [[mainTabView window] frame]; rect.size.width += 80; [[mainTabView window] setFrame: rect display: YES]; } else { // Sometimes we aren't able to get the main window, let's try again [self performSelector:@selector(loadGUI:) withObject:self afterDelay:1.0]; } } - (BOOL) canWriteToFile: (NSString *) path { if ([[NSFileManager defaultManager] fileExistsAtPath:path]) return [[NSFileManager defaultManager] isWritableFileAtPath:path]; else return [[NSFileManager defaultManager] isWritableFileAtPath:[path stringByDeletingLastPathComponent]]; } - (void) setOffloadingPort: (id)sender { SetPortForOffLoadingData((int) [[NSApp delegate] runningPortNum]); } - (void) awakeFromNib { if (InitializeProxyDll()) { NSTabViewItem *newTab = [[NSTabViewItem alloc] initWithIdentifier:@"Echo"]; //SetLoggingOptions(TRUE, "/tmp/EchoServer.log"); //YS: choose log file, where we can write NSArray *logFiles = [NSArray arrayWithObjects: [[NSUserDefaults standardUserDefaults] stringForKey:@"LogFile"], @"/var/log/OSXvnc-server.log", @"~/Library/Logs/OSXvnc-server.log", [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"OSXvnc-server.log"], @"/tmp/OSXvnc-server.log", nil]; NSEnumerator *logEnumerators = [logFiles objectEnumerator]; // Find first writable location for the log file NSString *logFile = nil; while (logFile = [logEnumerators nextObject]) { logFile = [logFile stringByStandardizingPath]; if ([logFile length] && [self canWriteToFile:logFile]) { [logFile retain]; break; } } // //converto from NSString to char* int len_logFile = [logFile length]; char pLogFile[len_logFile + 1]; strncpy(pLogFile, [logFile cString], len_logFile); pLogFile[len_logFile] = '\0'; // bool enableLog = [[NSUserDefaults standardUserDefaults] boolForKey:@"EnableLogging"]; [enableLoggingCheckbox setState: enableLog]; SetLoggingOptions(enableLog, pLogFile); SetPortForOffLoadingData((int) [[NSApp delegate] runningPortNum]); [disableEchoCheckbox setState: [[NSUserDefaults standardUserDefaults] boolForKey:@"EchoDisabled"]]; [self disableEcho:self]; //YS: 21.12.2006 due to remove "128 bit encryption" button //[useAESCheckbox setState: [[NSUserDefaults standardUserDefaults] boolForKey:@"EchoAESEncryption"]]; [self loadProxyFields]; [newTab setLabel:@"echoServer"]; [mainTabView addTabViewItem:newTab]; [newTab setView:echoServersView]; NSString *first = [NSString stringWithCString: GetDllVersion()]; NSString *second = [NSString stringWithFormat: @"EchoWare version %@", first]; [versionTextField setStringValue: second]; NSLog(second); [self loadServerList]; [self saveData]; [echoTableView setTarget:self]; [echoTableView setDoubleAction:@selector(editServer:)]; } } - (void) loadProxyFields { // The EchoDLL expects us to manage memory on these strings that are passed in so we'll make some NSData objects static id proxyStringsDictionary = nil; NSString *proxyAddrString = [[NSUserDefaults standardUserDefaults] stringForKey:@"EchoProxyAddr"]; NSString *proxyPortString = [[NSUserDefaults standardUserDefaults] stringForKey:@"EchoProxyPort"]; NSString *proxyUserString = [[NSUserDefaults standardUserDefaults] stringForKey:@"EchoProxyUser"]; NSString *proxyPassString = [[NSUserDefaults standardUserDefaults] stringForKey:@"EchoProxyPass"]; /* Load To GUI */ if (proxyAddrString) [proxyAddress setStringValue: proxyAddrString]; if ([proxyPortString intValue]) [proxyPort setIntValue: [proxyPortString intValue]]; if (proxyUserString) { [proxyUsername setStringValue: proxyUserString]; if (proxyPassString) [proxyPassword setStringValue: proxyPassString]; else proxyPassString = @""; [proxyAuthenticationCheckbox setState: TRUE]; } else { proxyUserString = @""; proxyPassString = @""; } [self requireProxyAuthentication:self]; // Load to EchoWare if ([proxyAddrString length] && [proxyPortString intValue]) { [proxyStringsDictionary release]; proxyStringsDictionary = [[NSMutableDictionary alloc] init]; [proxyStringsDictionary setObject:[proxyAddrString nullTerminatedData] forKey:@"EchoProxyAddr"]; [proxyStringsDictionary setObject:[proxyPortString nullTerminatedData] forKey:@"EchoProxyPort"]; if (proxyUserString) [proxyStringsDictionary setObject:[proxyUserString nullTerminatedData] forKey:@"EchoProxyUser"]; else [proxyStringsDictionary setObject:[@"" nullTerminatedData] forKey:@"EchoProxyUser"]; if (proxyPassString) [proxyStringsDictionary setObject:[proxyPassString nullTerminatedData] forKey:@"EchoProxyPass"]; else [proxyStringsDictionary setObject:[@"" nullTerminatedData] forKey:@"EchoProxyPass"]; SetLocalProxyInfo((char *) [[proxyStringsDictionary objectForKey:@"EchoProxyAddr"] bytes], (char *) [[proxyStringsDictionary objectForKey:@"EchoProxyPort"] bytes], (char *) [[proxyStringsDictionary objectForKey:@"EchoProxyUser"] bytes], (char *) [[proxyStringsDictionary objectForKey:@"EchoProxyPass"] bytes]); } } - (void) createEchoServerFromDictionary: (NSMutableDictionary *) echoDict { IDllProxyInfo* proxyInfo = (IDllProxyInfo*)CreateProxyInfoClassObject(); [echoDict setObject:[[[echoDict objectForKey:@"IPAddress"] nullTerminatedData] retain] forKey:@"IPAddress_cStringData"]; proxyInfo->SetIP((const char *)[[echoDict objectForKey:@"IPAddress_cStringData"] bytes]); if ([echoDict objectForKey:@"Port"]) { [echoDict setObject:[[[echoDict objectForKey:@"Port"] nullTerminatedData] retain] forKey:@"Port_cStringData"]; proxyInfo->SetPort((const char *)[[echoDict objectForKey:@"Port_cStringData"] bytes]); } else proxyInfo->SetPort("1328"); if ([echoDict objectForKey:@"User"]) { [echoDict setObject:[[[echoDict objectForKey:@"User"] nullTerminatedData] retain] forKey:@"User_cStringData"]; proxyInfo->SetMyID((char *)[[echoDict objectForKey:@"User_cStringData"] bytes]); } if ([echoDict objectForKey:@"Pass"]) { [echoDict setObject:[[[echoDict objectForKey:@"Pass"] nullTerminatedData] retain] forKey:@"Pass_cStringData"]; proxyInfo->SetPassword((const char *)[[echoDict objectForKey:@"Pass_cStringData"] bytes]); } //YS: 21.12.2006 due to remove "128 bit encryption" button //old code: SetEncryptionLevel([useAESCheckbox state], proxyInfo); SetEncryptionLevel(1, proxyInfo);//nnn CMyDllProxyInfo *pMyProxyInfo = new CMyDllProxyInfo(proxyInfo); pMyProxyInfo->setStatus(CMyDllProxyInfo::Connecting); [self addInfo: pMyProxyInfo]; [echoTableView displayRect:[echoTableView rectOfRow:[echoInfoProxys count]]]; [echoTableView setNeedsDisplay:YES]; [echoTableView displayIfNeeded]; } - (void) loadServerList { NSUserDefaults *uDef = [NSUserDefaults standardUserDefaults]; NSEnumerator *echoEnum = [[uDef objectForKey:@"EchoServers"] objectEnumerator]; NSMutableDictionary *anEchoServer = nil; [echoServers release]; echoServers = [[NSMutableArray alloc] init]; while (anEchoServer = [[[echoEnum nextObject] mutableCopy] autorelease]) { [echoServers addObject: anEchoServer]; [self createEchoServerFromDictionary: anEchoServer]; } [uDef setObject:echoServers forKey: @"EchoServers"]; } #include -(NSString*) GetComputerName { CFStringRef name = NULL; NSString *computerName = NULL; name = SCDynamicStoreCopyComputerName(NULL, NULL); if (name != NULL) computerName = [NSString stringWithString:(NSString*)name]; CFRelease(name); return computerName; } - (IBAction)addServer:(id)sender { //YS: 21.12.2006 due to set by default all edits on add server screen { NSString *server_default = @"demo.echovnc.com"; NSString *password_default = @"demo2007"; NSString *username_default = [self GetComputerName]; if (username_default == NULL) username_default = @"VineServerDemo"; [echoServerField setStringValue: server_default]; [usernameField setStringValue: username_default]; [passwordField setStringValue: password_default]; } [NSApp beginSheet:addServerWindow modalForWindow:[echoServersView window] modalDelegate:self didEndSelector:NULL contextInfo:NULL]; } - (IBAction)cancelAddServer:(id)sender { [NSApp endSheet:addServerWindow returnCode:NSAlertAlternateReturn]; [addServerWindow orderOut:self]; } - (IBAction)completeAddServer:(id)sender { NSMutableDictionary *newEchoServer = [[NSMutableDictionary alloc] init]; [addServerWindow makeFirstResponder:[addServerWindow nextResponder]]; NSArray *serverAndPort = [[echoServerField stringValue] componentsSeparatedByString:@":"]; if ([[serverAndPort objectAtIndex:0] length]) { [newEchoServer setObject:[serverAndPort objectAtIndex:0] forKey:@"IPAddress"]; if ([serverAndPort count] > 1) [newEchoServer setObject:[serverAndPort objectAtIndex:1] forKey:@"Port"]; if ([[usernameField stringValue] length]) { NSString * tmp = [usernameField stringValue]; tmp = [tmp stringByAppendingString: @":vnc"]; [newEchoServer setObject:tmp forKey:@"User"]; } if ([[passwordField stringValue] length]) [newEchoServer setObject:[passwordField stringValue] forKey:@"Pass"]; [echoServers addObject:newEchoServer]; } [NSApp endSheet:addServerWindow returnCode:NSAlertDefaultReturn]; [addServerWindow orderOut:self]; [self createEchoServerFromDictionary: newEchoServer]; [self reloadData]; [self selectRow: [echoServers count] - 1]; [self saveData]; } - (IBAction)removeServer:(id)sender { int index = [echoTableView selectedRow]; if (index >= 0) { CMyDllProxyInfo *pMyProxyInfo = [self getDllProxyInfo: index]; if (pMyProxyInfo == NULL) return; if (pMyProxyInfo->getStatus() == CMyDllProxyInfo::Removing) return; [self removeRow: index removeProxy: true removeServer: true]; [self reloadData]; if (index >= [echoServers count]) index = [echoServers count] - 1; [self selectRow: index]; [self saveData]; pMyProxyInfo->setStatus(CMyDllProxyInfo::Removing); [echoInfoProxysToRemove addObject: [NSValue valueWithPointer: pMyProxyInfo]]; } } - (IBAction)advancedSettings:(id)sender { [NSApp beginSheet:advancedSettingsWindow modalForWindow:[echoServersView window] modalDelegate:self didEndSelector:NULL contextInfo:NULL]; } - (IBAction)cancelAdvancedSettings:(id)sender { [NSApp endSheet:advancedSettingsWindow returnCode:NSAlertAlternateReturn]; [advancedSettingsWindow orderOut:self]; [self loadProxyFields]; } - (IBAction)completeAdvancedSettings:(id)sender { [[NSUserDefaults standardUserDefaults] setObject:[proxyAddress stringValue] forKey:@"EchoProxyAddr"]; [[NSUserDefaults standardUserDefaults] setInteger:[proxyPort intValue] forKey:@"EchoProxyPort"]; if ([proxyAuthenticationCheckbox state]) { [[NSUserDefaults standardUserDefaults] setObject:[proxyUsername stringValue] forKey:@"EchoProxyUser"]; [[NSUserDefaults standardUserDefaults] setObject:[proxyPassword stringValue] forKey:@"EchoProxyPass"]; } else { [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"EchoProxyUser"]; [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"EchoProxyPass"]; } [[NSUserDefaults standardUserDefaults] synchronize]; [self loadProxyFields]; [NSApp endSheet:advancedSettingsWindow returnCode:NSAlertDefaultReturn]; [advancedSettingsWindow orderOut:self]; } - (IBAction)requireProxyAuthentication:(id)sender { BOOL enabled = [proxyAuthenticationCheckbox state]; [proxyUsername setEnabled:enabled]; [proxyPassword setEnabled:enabled]; [proxyUsernameLabel setTextColor:(enabled ? [NSColor blackColor] : [NSColor grayColor])]; [proxyPasswordLabel setTextColor:(enabled ? [NSColor blackColor] : [NSColor grayColor])]; } - (IBAction)disableEcho:(id)sender { BOOL disabled = [disableEchoCheckbox state]; [addButton setEnabled:!disabled]; [advancedSettingsButton setEnabled:!disabled]; [echoTableView setEnabled:!disabled]; [removeButton setEnabled:!disabled]; //YS: 21.12.2006 due to remove "128 bit encryption" button //[useAESCheckbox setEnabled:!disabled]; [[NSUserDefaults standardUserDefaults] setBool:disabled forKey:@"EchoDisabled"]; [[NSUserDefaults standardUserDefaults] synchronize]; } - (IBAction)enableLogging:(id)sender { bool enabled = [enableLoggingCheckbox state]; EnableLogging(enabled); [[NSUserDefaults standardUserDefaults] setBool: enabled forKey: @"EnableLogging"]; [[NSUserDefaults standardUserDefaults] synchronize]; } - (IBAction)useEncryption:(id)sender { id proxyEnum = [echoInfoProxys objectEnumerator]; NSValue *aProxyValue = nil; while (aProxyValue = [proxyEnum nextObject]) { //YS: 21.12.2006 due to remove "128 bit encryption" button //old code: SetEncryptionLevel([useAESCheckbox state], [aProxyValue pointerValue]); SetEncryptionLevel(1, [aProxyValue pointerValue]); } //YS: 21.12.2006 due to remove "128 bit encryption" button //[[NSUserDefaults standardUserDefaults] setBool:[useAESCheckbox state] forKey:@"EchoAESEncryption"]; //[[NSUserDefaults standardUserDefaults] synchronize]; } - (IBAction)editServer:(id)sender { m_nEditIndex = [echoTableView selectedRow]; if (m_nEditIndex >= 0) { CMyDllProxyInfo *pMyProxyInfo = [self getDllProxyInfo: m_nEditIndex]; if (pMyProxyInfo == NULL) return; IDllProxyInfo *echoProxyInfo = pMyProxyInfo->getDllProxyInfo(); if (pMyProxyInfo->getStatus() == CMyDllProxyInfo::Removing || pMyProxyInfo->getStatus() == CMyDllProxyInfo::Connecting || pMyProxyInfo->getStatus() == CMyDllProxyInfo::Reconnecting) return; int nLen = strlen(echoProxyInfo->GetMyID()); char* sTmp = new char[nLen + 1]; memset(sTmp, 0, nLen + 1); memcpy(sTmp, echoProxyInfo->GetMyID(), nLen); char* p = strstr(sTmp, ":"); if (p != NULL) *p = 0; NSString *username = [NSString stringWithCString:sTmp]; delete sTmp; NSString *password =[NSString stringWithCString: echoProxyInfo->GetPassword()]; NSString *server = [NSString stringWithCString: echoProxyInfo->GetIpPort()]; [echoServerField_edit setStringValue: server]; [usernameField_edit setStringValue: username]; [passwordField_edit setStringValue: password]; [NSApp beginSheet:editServerWindow modalForWindow:[echoServersView window] modalDelegate:self didEndSelector:NULL contextInfo:NULL]; } } - (IBAction)cancelEditServer:(id)sender { [NSApp endSheet:editServerWindow returnCode:NSAlertAlternateReturn]; [editServerWindow orderOut:self]; } - (IBAction)completeEditServer:(id)sender { [editServerWindow makeFirstResponder:[editServerWindow nextResponder]]; [NSApp endSheet:editServerWindow returnCode:NSAlertDefaultReturn]; [editServerWindow orderOut:self]; if (m_nEditIndex >= 0) { CMyDllProxyInfo *pMyProxyInfo = [self getDllProxyInfo: m_nEditIndex]; if (pMyProxyInfo == NULL) return; IDllProxyInfo *echoProxyInfo = pMyProxyInfo->getDllProxyInfo(); NSString *username = [usernameField_edit stringValue]; username = [username stringByAppendingString: @":vnc"]; NSString *password = [passwordField_edit stringValue]; int len_username = [username length]; int len_password = [password length]; char pUsername[len_username + 1]; char pPassword[len_password + 1]; strncpy(pUsername, [username cString], len_username); strncpy(pPassword, [password cString], len_password); pUsername[len_username] = 0; pPassword[len_password] = 0; echoProxyInfo->SetMyID(pUsername); echoProxyInfo->SetPassword(pPassword); NSMutableDictionary *echoDict = [[[echoServers objectAtIndex: m_nEditIndex] mutableCopy] autorelease]; [echoDict setObject: username forKey: @"User"]; [echoDict setObject: password forKey: @"Pass"]; [echoDict setObject: [[username nullTerminatedData] retain] forKey:@"User_cStringData"]; [echoDict setObject: [[password nullTerminatedData] retain] forKey:@"Pass_cStringData"]; [echoServers replaceObjectAtIndex: m_nEditIndex withObject: echoDict]; pMyProxyInfo->setStatus(CMyDllProxyInfo::Reconnecting); [self reloadData]; [self selectRow: m_nEditIndex]; [self saveData]; } } - (void) reloadData { m_critSection->Lock(); [echoTableView reloadData]; m_critSection->Unlock(); } - (void) selectRow: (int)row; { m_critSection->Lock(); [echoTableView selectRow: row byExtendingSelection: false]; m_critSection->Unlock(); } - (void) removeRow: (int)row removeProxy: (bool)rmProxy removeServer: (bool)rmServer; { m_critSection->Lock(); if (rmProxy) [echoInfoProxys removeObjectAtIndex: row]; if (rmServer) [echoServers removeObjectAtIndex: row]; m_critSection->Unlock(); } - (CMyDllProxyInfo*) getDllProxyInfo: (int)row { CMyDllProxyInfo *res = NULL; m_critSection->Lock(); if (row >= 0 && row < [echoInfoProxys count]) res = (CMyDllProxyInfo*)[[echoInfoProxys objectAtIndex: row] pointerValue]; m_critSection->Unlock(); return res; } - (void) addInfo: (CMyDllProxyInfo*)info { m_critSection->Lock(); [echoInfoProxys addObject: [NSValue valueWithPointer: info]]; m_critSection->Unlock(); } - (void) saveData { m_critSection->Lock(); NSUserDefaults *suDefaults = [NSUserDefaults standardUserDefaults]; [suDefaults setObject:echoServers forKey:@"EchoServers"]; [suDefaults synchronize]; m_critSection->Unlock(); } - (NSString*) GetColumnValue: (int)row column: (NSString*)col { NSString* res = @""; if (col && row >= 0) { NSDictionary *echoServer = [echoServers objectAtIndex: row]; CMyDllProxyInfo *pMyProxyInfo = (CMyDllProxyInfo *)[[echoInfoProxys objectAtIndex: row] pointerValue]; IDllProxyInfo *proxyInfo = pMyProxyInfo->getDllProxyInfo(); if ([col isEqualToString:@"echoServer"]) { if (proxyInfo->GetName() != nil) res = [NSString stringWithCString:proxyInfo->GetName() encoding:NSUTF8StringEncoding]; else res = @""; } else if ([col isEqualToString:@"IP"]) { if ([echoServer objectForKey:@"Port"]) res = [NSString stringWithFormat:@"%@:%@", [echoServer objectForKey:@"IPAddress"], [echoServer objectForKey:@"Port"]] ; else res = [NSString stringWithFormat:@"%@", [echoServer objectForKey:@"IPAddress"]] ; } else if ([col isEqualToString:@"Status"]) { res = [NSString stringWithCString: pMyProxyInfo->getStatusString()]; } else if ([col isEqualToString:@"User"]) { int nLen = strlen(proxyInfo->GetMyID()); char* sTmp = new char[nLen + 1]; memset(sTmp, 0, nLen + 1); memcpy(sTmp, proxyInfo->GetMyID(), nLen); char* p = strstr(sTmp, ":"); if (p != NULL) *p = 0; res = [NSString stringWithCString:sTmp encoding:NSUTF8StringEncoding]; delete sTmp; } } return res; } @end @implementation EchoController (TableDataSource) - (int)numberOfRowsInTableView:(NSTableView *)tableView { return [echoServers count]; } - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row { return [self GetColumnValue: row column: [tableColumn identifier]]; } @end ================================================ FILE: Bundles/Echoware/EchoSrvDataChannel.cpp ================================================ #include "StdAfx.h" #include "echosrvdatachannel.h" #include "localdatachannel.h" #include "NetPacket.h" #include "DataChannel.h" CEchoSrvDataChannel::CEchoSrvDataChannel(CDataChannel* pDataChannel) :CDataChannelSocket(pDataChannel) { m_bOffLoadingDataChannel = false; ResetOffLoadingTimer(); ResetRetryTimer(); m_nRetryCounter = 0; m_fStartRetry = false; } CEchoSrvDataChannel::~CEchoSrvDataChannel(void) { g_globals.m_logger.WriteFormated("CEchoSrvDataChannel: send buff=%d, rec buff=%d", m_pSendBuffer->Size(), m_pRecvBuffer->Size()); } bool CEchoSrvDataChannel::Connect(const char* szIP, unsigned int nPort) { if (CDataChannelSocket::Connect(szIP, nPort)==0) return true; return g_globals.m_proxiesManager.ConnectViaProxy(this, szIP, nPort); } //connects tis data channel to echoServer and authenticating this connection int CEchoSrvDataChannel::Connect(const char* szServer, unsigned int nPort, const char* szChannelCode, const char* szMyID) { if (!Connect(szServer, nPort)) return -1; DWORD dwTemp = ID_STRING_SIZE; DWORD dwTotalLength = ID_STRING_SIZE; dwTotalLength += CHANNEL_CODE_SIZE;//(DWORD)strlen(szChannelCode)+1; char *pBuff = new char[dwTotalLength]; g_globals.GetFormattedID(pBuff, dwTotalLength, szMyID); memcpy(pBuff+dwTemp, szChannelCode, strlen(szChannelCode)+1); SendMessage(MSG_DATA_CHANNEL_CONNECT,pBuff,dwTotalLength); delete[] pBuff; m_dwOffLoadingTime = GetTickCount(); return 0; } //message composer void CEchoSrvDataChannel::SendMessage(DWORD message, char *data, unsigned int datalen) { char* lpBuf = NULL; DWORD nBytesSent = 0; CProxyMsg msg(message ); NetPacketHeader header; header.len = msg.MakeMessage(&header, lpBuf, data, datalen); //create the message DWORD dwToSend = OSSwapHostToLittleInt32(header.len + sizeof(DWORD)); m_pSendBuffer->Write(&dwToSend, sizeof(DWORD)); m_pSendBuffer->Write(lpBuf, header.len); Send(); if (lpBuf) delete lpBuf; } void CEchoSrvDataChannel::OnReceive(char* buff, int len) { CDataChannelSocket::OnReceive(buff, len); if (m_bOffLoadingDataChannel) m_pDataChannel->ConnectLocalServer(); m_pPairChannel->Send(); } void CEchoSrvDataChannel::OnSend(char* buff, int& len) { CDataChannelSocket::OnSend(buff, len); if (len > 0) g_globals.m_logger.WriteFormated("CEchoSrvDataChannel::OnSend sock = %d len = %d", getSocket(), len); } void CEchoSrvDataChannel::OnError(int error) { CDataChannelSocket::OnError(error); } void CEchoSrvDataChannel::ResetOffLoadingTimer() { m_dwOffLoadingTime = GetTickCount(); } void CEchoSrvDataChannel::ResetRetryTimer() { m_dwRetryTime = GetTickCount(); } void CEchoSrvDataChannel::OnTimer() { APISocket::CClientSocket::OnTimer(); if (m_bOffLoadingDataChannel && GetTickCount() - m_dwOffLoadingTime >= CONNECTION_TO_OFFLOAD_TIMER_VALUE) { m_pDataChannel->ConnectLocalServer(); ResetOffLoadingTimer(); } if (m_fStartRetry && m_bOffLoadingDataChannel && GetTickCount() - m_dwRetryTime >= RECONNECTION_TO_OFFLOAD_TIMER_VALUE) { g_globals.m_logger.WriteFormated("CEchoSrvDataChannel::OnTimer Start retrying the localdatachannel"); m_pDataChannel->m_pLocalDataChannel->StartAsync(); m_pDataChannel->m_pLocalDataChannel->StartSend(); ResetRetryTimer(); m_nRetryCounter++; m_fStartRetry = false; g_globals.m_logger.WriteFormated("CEchoSrvDataChannel::OnTimer End retrying the localdatachannel"); } } ================================================ FILE: Bundles/Echoware/EchoSrvDataChannel.h ================================================ #ifndef _ECHOSRVDATACHANNELS_H #define _ECHOSRVDATACHANNELS_H #if _MSC_VER > 1000 #pragma once #endif #include "DataChannelSocket.h" class CDataChannel; //data channel to echoServer class CEchoSrvDataChannel : public CDataChannelSocket { public: CEchoSrvDataChannel(CDataChannel* pDataChannel); virtual ~CEchoSrvDataChannel(void); //connect to echoServer int Connect(const char* szServer, unsigned int nPort, const char* szChannelCode, const char* szMyID); //notification : there are data to read //[in] len : length of data //[in] buff: data virtual void OnReceive(char* buff, int len); //notification : can send data //[in] len : length of data //[in] buff: data virtual void OnSend(char* buff, int& len); virtual void OnError(int error); virtual void OnTimer(); void SetOffLoadingDataChannel(bool value) { m_bOffLoadingDataChannel = value; } void ResetOffLoadingTimer(); void ResetRetryTimer(); int m_nRetryCounter; bool m_bOffLoadingDataChannel; bool m_fStartRetry; protected: //construct message to send to echoServer void SendMessage(DWORD message, char *data, unsigned int datalen); //connect the socket bool Connect(const char* szIP, unsigned int nPort); protected: DWORD m_dwOffLoadingTime; DWORD m_dwRetryTime; }; #endif ================================================ FILE: Bundles/Echoware/EchoToOSX.cpp ================================================ /* * EchoToOSX.cpp * Echoware * * Created by Jonathan on 3/29/06. * Copyright 2006 __MyCompanyName__. All rights reserved. * */ #include #include #include #include "EchoToOSX.h" // Get Relative Time in milliseconds (not to be used for absolute time) DWORD GetTickCount() { struct timeval startTime; gettimeofday(&startTime, NULL); return (DWORD) ((startTime.tv_sec * 1000) + (startTime.tv_usec / 1000)); } void *CreateThread(int securityFlags, int stackSize, long unsigned int (*start_routine)(void *), void *arg, int creationFlags, long unsigned int *lpThreadId) { pthread_t newThread; int threadID = pthread_create(&newThread, NULL, (void *(*)(void *))start_routine, arg); *lpThreadId = threadID; pthread_detach(newThread); return newThread; } bool PostThreadMessage(unsigned long , int, void *, int) { // mach_msg, socket comm, shared state? } bool PeekMessage(void *, int,int,int, int) { } bool ShutdownThread(void *shutdownThread, unsigned long waitTimeout, bool *shouldQuit, bool *hasQuit) { if (shutdownThread) { if (!(*hasQuit)) { *shouldQuit = 1; { DWORD startTime = GetTickCount(); while (!(*hasQuit) && (GetTickCount() - startTime < waitTimeout)) { Sleep(250000); } } if (!(*hasQuit)) { if (shutdownThread) pthread_cancel((pthread_t) shutdownThread); return false; } } } return true; } ================================================ FILE: Bundles/Echoware/EchoToOSX.h ================================================ /* * EchoToVNC.h * Echoware * * Created by Jonathan on 3/3/06. * Copyright 2006 __MyCompanyName__. All rights reserved. * */ #include // Some basic redifines #undef TCP_NODELAY #define TCP_NODELAY 0x01 #define INVALID_SOCKET -1 #define SOCKET_ERROR -1 #define LPHOSTENT struct hostent * #define LPIN_ADDR struct in_addr * #define WSAEALREADY EALREADY #define WSAEINVAL EINVAL #define WSAEWOULDBLOCK EAGAIN #define WSAEISCONN EISCONN #define WSAECONNRESET ECONNRESET #define WSAECONNABORTED ECONNABORTED #define WSAESHUTDOWN ESHUTDOWN #define WSAENOTSOCK ENOTSOCK #define WSAGetLastError() errno #define closesocket close #define ZeroMemory bzero #define Sleep usleep // Nothing #define FAR #define UINT unsigned int #define CHAR unsigned char #ifndef DWORD #define DWORD long unsigned int #endif #define WORD unsigned short #define BYTE unsigned char #define INFINITE 2^16 #define BOOL bool #define min(a,b) (((a)<(b))?(a):(b)) #define TRUE 1 #define FALSE 0 #define __stdcall #define LPVOID void * #ifndef MAKEWORD #define MAKEWORD(b1, b2) ((WORD)(((BYTE)(b1)) | ((WORD)((BYTE)(b2))) << 8)) #endif #ifndef LOBYTE #define LOBYTE(w) ((BYTE)(w)) #endif #ifndef HIBYTE #define HIBYTE(w) ((BYTE)(((WORD)(w) >> 8) & 0xFF)) #endif #define SD_RECEIVE SHUT_RD #define SD_SEND SHUT_WR #define SD_BOTH SHUT_RDWR #define WM_USER 1024 // Functions which need to be implemented or the callers reworked DWORD GetTickCount(); #define WPARAM void * void *CreateThread(int, int, long unsigned int (*)(void *), void *, int, long unsigned int *); bool ShutdownThread(void *, unsigned long, bool *, bool *); bool PostThreadMessage(unsigned long , int, void *, int); bool PeekMessage(void *, int,int,int, int); //#define STILL_ACTIVE 1 //#define WAIT_TIMEOUT 18 #define HANDLE void ** #ifndef ECHOWARE_API #ifdef ECHOWARE_EXPORTS #define ECHOWARE_API __attribute__ ((dllexport)) #else //#define ECHOWARE_API __attribute__ ((dllimport)) #define ECHOWARE_API #endif #endif ================================================ FILE: Bundles/Echoware/Echoware.cpp ================================================ // Echoware.cpp : Defines the entry point for the DLL application. // #include "stdafx.h" #include "Echoware.h" #include "Globals.h" #include "DllProxyInfo.h" //BOOL APIENTRY DllMain( HANDLE hModule, BOOL DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { //#define DLL_PROCESS_ATTACH 0 //#define DLL_THREAD_ATTACH 1 //#define DLL_THREAD_DETACH 2 //#define DLL_PROCESS_DETACH 3 // switch (ul_reason_for_call) // { // case DLL_PROCESS_ATTACH: // break; // case DLL_THREAD_ATTACH: // break; // case DLL_THREAD_DETACH: // break; // case DLL_PROCESS_DETACH: // /*if (g_globals.GetDllInitialized()) // { // g_globals.m_logger.Write("ReleaseSockets"); // g_globals.ReleaseSockets(); // }*/ // break; // } return TRUE; } #define ECHOWARE_VERSION "1.926" extern "C" ECHOWARE_API char* GetDllVersion() { return ECHOWARE_VERSION; } extern "C" ECHOWARE_API bool InitializeProxyDll() { if (g_globals.GetDllInitialized()) { g_globals.m_logger.Write("InitializeProxyDll : already been intialized"); return true; } if (!g_globals.InitSockets(1, 1)) { g_globals.SetDllInitialized(false); return false; } g_globals.SetDllInitialized(true); return true; } extern "C" ECHOWARE_API void SetLoggingOptions(bool bEnablelogging, char *szLogPath) { g_globals.m_logger.SetLogger(bEnablelogging); g_globals.m_logger.SetLoggerPath(szLogPath); } extern "C" ECHOWARE_API void EnableLogging(bool bEnablelogging) { g_globals.m_logger.SetLogger(bEnablelogging); } extern "C" ECHOWARE_API bool SetPortForOffLoadingData(int DataOffLoadingPort) { g_globals.SetPortForOffLoadingData(DataOffLoadingPort); g_globals.m_logger.WriteFormated("Data offloading port : %d", DataOffLoadingPort); return true; } extern "C" ECHOWARE_API void* CreateProxyInfoClassObject() { if (!g_globals.GetDllInitialized()) { g_globals.m_logger.Write("CreateProxyInfoClassObject : not been initialized"); return 0; } CDllProxyInfo* pProxyInfo=new CDllProxyInfo; g_globals.m_proxiesManager.AddProxy(pProxyInfo); return (IDllProxyInfo*)pProxyInfo; } extern "C" ECHOWARE_API void DeleteProxyInfoClassObject (void* pProxyInfo) { if (!g_globals.GetDllInitialized()) { g_globals.m_logger.Write("DeleteProxyInfoClassObject : not been initialized"); return; } g_globals.m_proxiesManager.RemoveProxy((CDllProxyInfo*)pProxyInfo); } extern "C" ECHOWARE_API void AutoConnect() { if (!g_globals.GetDllInitialized()) { g_globals.m_logger.Write("AutoConnect : not been initialized"); return ; } g_globals.m_proxiesManager.AutoConnect(); } extern "C" ECHOWARE_API int ConnectProxy(void* pProxyInfo) { if (!g_globals.GetDllInitialized()) { g_globals.m_logger.Write("ConnectProxy : not been initialized"); return ERROR_CONNECTING_TO_PROXY; } return g_globals.m_proxiesManager.ConnectProxy((CDllProxyInfo*)pProxyInfo); } extern "C" ECHOWARE_API bool DisconnectProxy(void* pProxyInfo) { if (!g_globals.GetDllInitialized()) { g_globals.m_logger.Write("DisconnectProxy : not been initialized"); return false; } return g_globals.m_proxiesManager.DisconnectProxy((CDllProxyInfo*)pProxyInfo); } extern "C" ECHOWARE_API bool DisconnectAllProxies() { if (!g_globals.GetDllInitialized()) { g_globals.m_logger.Write("DisconnectAllProxies : not been initialized"); return false; } return g_globals.m_proxiesManager.DisconnectAllProxies(); } extern "C" ECHOWARE_API void StopConnecting(void* pProxyInfo) { if (!g_globals.GetDllInitialized()) { g_globals.m_logger.Write("StopConnecting : not been initialized"); return; } g_globals.m_proxiesManager.StopConnecting((CDllProxyInfo*)pProxyInfo); } extern "C" ECHOWARE_API int EstablishNewDataChannel(void* pProxyInfo , char* IDOfPartner) { if (!g_globals.GetDllInitialized()) { g_globals.m_logger.Write("EstablishNewDataChannel : not been initialized"); return 0; } return g_globals.m_proxiesManager.EstablishNewDataChannel((CDllProxyInfo*)pProxyInfo, IDOfPartner); } extern "C" ECHOWARE_API void SetEncryptionLevel(int level, void* pProxyInfo) { if (!g_globals.GetDllInitialized()) { g_globals.m_logger.Write("SetEncryptionLevel : not been initialized"); return; } g_globals.m_logger.WriteFormated("Set Encryption Level to %d for %s", level, ((CDllProxyInfo*)pProxyInfo)->GetIpPort()); g_globals.m_proxiesManager.SetEncryptionLevel(level, (CDllProxyInfo*)pProxyInfo); } extern "C" ECHOWARE_API void SetLocalProxyInfo(char* ip, char* port, char* username, char* password) { if (!g_globals.GetDllInitialized()) { g_globals.m_logger.Write("SetLocalProxyInfo : not been initialized"); return; } g_globals.m_proxiesManager.SetLocalProxyInfo(ip, port, username, password); } extern "C" ECHOWARE_API bool CheckServer(char* ip, unsigned short port) { if (!g_globals.GetDllInitialized()) { g_globals.m_logger.Write("SetLocalProxyInfo : not been initialized"); return false; } APISocket::CClientSocket sock; sock.Create(); if (sock.Connect(ip, port)==0) return true; return g_globals.m_proxiesManager.ConnectViaProxy(&sock, ip, port); return false; } ================================================ FILE: Bundles/Echoware/Echoware.dsp ================================================ # Microsoft Developer Studio Project File - Name="Echoware" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 CFG=Echoware - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "Echoware.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "Echoware.mak" CFG="Echoware - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "Echoware - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "Echoware - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe MTL=midl.exe RSC=rc.exe !IF "$(CFG)" == "Echoware - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Echoware___Win32_Release" # PROP BASE Intermediate_Dir "Echoware___Win32_Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release6" # PROP Intermediate_Dir "Release6" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ECHOWARE_EXPORTS" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ECHOWARE_EXPORTS" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /dll /machine:I386 /nodefaultlib:"MSVCRT.lib" /nodefaultlib:"LIBC.lib" !ELSEIF "$(CFG)" == "Echoware - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Echoware___Win32_Debug0" # PROP BASE Intermediate_Dir "Echoware___Win32_Debug0" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug6" # PROP Intermediate_Dir "Debug6" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ECHOWARE_EXPORTS" /YX /FD /GZ /c # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ECHOWARE_EXPORTS" /YX /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"MSVCRTD.lib" /nodefaultlib:"LIBCD.lib" /pdbtype:sept !ENDIF # Begin Target # Name "Echoware - Win32 Release" # Name "Echoware - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=.\ACConnection.cpp # End Source File # Begin Source File SOURCE=.\AES.cpp # End Source File # Begin Source File SOURCE=.\blowfish.cpp # End Source File # Begin Source File SOURCE=.\CritSection.cpp # End Source File # Begin Source File SOURCE=.\DataChannel.cpp # End Source File # Begin Source File SOURCE=.\DataChannels.cpp # End Source File # Begin Source File SOURCE=.\DataChannelSocket.cpp # End Source File # Begin Source File SOURCE=.\DllProxyInfo.cpp # End Source File # Begin Source File SOURCE=.\EchoSrvDataChannel.cpp # End Source File # Begin Source File SOURCE=.\Echoware.cpp # End Source File # Begin Source File SOURCE=.\Globals.cpp # End Source File # Begin Source File SOURCE=.\LocalDataChannel.cpp # End Source File # Begin Source File SOURCE=.\LocalListener.cpp # End Source File # Begin Source File SOURCE=.\Logger.cpp # End Source File # Begin Source File SOURCE=.\ProxiesManager.cpp # End Source File # Begin Source File SOURCE=.\ProxyConnection.cpp # End Source File # Begin Source File SOURCE=.\RSAKeys.cpp # End Source File # Begin Source File SOURCE=.\stdafx.cpp # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=.\ACConnection.h # End Source File # Begin Source File SOURCE=.\AES.h # End Source File # Begin Source File SOURCE=.\blowfish.h # End Source File # Begin Source File SOURCE=.\CritSection.h # End Source File # Begin Source File SOURCE=.\DataChannel.h # End Source File # Begin Source File SOURCE=.\DataChannels.h # End Source File # Begin Source File SOURCE=.\DataChannelSocket.h # End Source File # Begin Source File SOURCE=.\DllProxyInfo.h # End Source File # Begin Source File SOURCE=.\EchoSrvDataChannel.h # End Source File # Begin Source File SOURCE=.\Echoware.h # End Source File # Begin Source File SOURCE=.\Globals.h # End Source File # Begin Source File SOURCE=.\InterfaceDllProxyInfo.h # End Source File # Begin Source File SOURCE=.\LocalDataChannel.h # End Source File # Begin Source File SOURCE=.\LocalListener.h # End Source File # Begin Source File SOURCE=.\Logger.h # End Source File # Begin Source File SOURCE=.\NetPacket.h # End Source File # Begin Source File SOURCE=.\ProxiesManager.h # End Source File # Begin Source File SOURCE=.\ProxyConnection.h # End Source File # Begin Source File SOURCE=.\RSAKeys.h # End Source File # Begin Source File SOURCE=.\stdafx.h # End Source File # End Group # Begin Group "Resource Files" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # End Group # Begin Group "APISocket" # PROP Default_Filter "" # Begin Source File SOURCE=.\APISocket\APISocket.h # End Source File # Begin Source File SOURCE=.\APISocket\ClientSocket.cpp # End Source File # Begin Source File SOURCE=.\APISocket\ServerSocket.cpp # End Source File # Begin Source File SOURCE=.\APISocket\Socket.cpp # End Source File # End Group # End Target # End Project ================================================ FILE: Bundles/Echoware/Echoware.dsw ================================================ Microsoft Developer Studio Workspace File, Format Version 6.00 # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! ############################################################################### Project: "Echoware"=.\Echoware.dsp - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ Begin Project Dependency Project_Dep_Name LibeaySt End Project Dependency Begin Project Dependency Project_Dep_Name ProxyConnect End Project Dependency Begin Project Dependency Project_Dep_Name RSA End Project Dependency }}} ############################################################################### Project: "LibeaySt"=.\OpenSSL\LibeaySt.dsp - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Project: "ProxyConnect"=.\ProxyConnect\ProxyConnect.dsp - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Project: "RSA"=.\RSA\RSA.dsp - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Global: Package=<5> {{{ }}} Package=<3> {{{ }}} ############################################################################### ================================================ FILE: Bundles/Echoware/Echoware.h ================================================ #if !defined(_ECHOWARE_H) #define _ECHOWARE_H #if _MSC_VER > 1000 #pragma once #endif extern "C" char* GetDllVersion(); extern "C" bool InitializeProxyDll(); extern "C" void SetLoggingOptions(bool bEnablelogging, char *szLogPath); extern "C" void EnableLogging(bool bEnablelogging); extern "C" bool SetPortForOffLoadingData(int DataOffLoadingPort); extern "C" void* CreateProxyInfoClassObject(); extern "C" void DeleteProxyInfoClassObject (void* pProxyInfo); extern "C" void AutoConnect(); extern "C" int ConnectProxy(void* pProxyInfo); extern "C" bool DisconnectProxy(void* pProxyInfo); extern "C" bool DisconnectAllProxies(); extern "C" void StopConnecting(void* pProxyInfo); extern "C" void SetEncryptionLevel(int level, void* pProxyInfo); extern "C" void SetLocalProxyInfo(char* ip, char* port, char* username, char* password); extern "C" bool CheckServer(char* ip, unsigned short port); #ifndef ECHOWARE_API #ifdef ECHOWARE_EXPORTS #define ECHOWARE_API __declspec(dllexport) #else #define ECHOWARE_API __declspec(dllimport) #endif #endif #endif ================================================ FILE: Bundles/Echoware/Echoware.sln ================================================ Microsoft Visual Studio Solution File, Format Version 7.00 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Echoware", "Echoware.vcproj", "{1CC002F1-843A-4B82-ADD1-A045B93A2DBA}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibeaySt", "OpenSSL\LibeaySt.vcproj", "{5CDA6CEE-1D30-4C05-ACCA-327274FFC553}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RSA", "RSA\RSA.vcproj", "{3FEAADB2-4A97-473B-8839-4E97C0CD4F4B}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ProxyConnect", "ProxyConnect\ProxyConnect.vcproj", "{CCEA3A1B-1170-4302-85A8-E4B441552105}" EndProject Global GlobalSection(SolutionConfiguration) = preSolution ConfigName.0 = Debug ConfigName.1 = Release EndGlobalSection GlobalSection(ProjectDependencies) = postSolution {1CC002F1-843A-4B82-ADD1-A045B93A2DBA}.0 = {5CDA6CEE-1D30-4C05-ACCA-327274FFC553} {1CC002F1-843A-4B82-ADD1-A045B93A2DBA}.1 = {CCEA3A1B-1170-4302-85A8-E4B441552105} {1CC002F1-843A-4B82-ADD1-A045B93A2DBA}.2 = {3FEAADB2-4A97-473B-8839-4E97C0CD4F4B} EndGlobalSection GlobalSection(ProjectConfiguration) = postSolution {1CC002F1-843A-4B82-ADD1-A045B93A2DBA}.Debug.ActiveCfg = Debug|Win32 {1CC002F1-843A-4B82-ADD1-A045B93A2DBA}.Debug.Build.0 = Debug|Win32 {1CC002F1-843A-4B82-ADD1-A045B93A2DBA}.Release.ActiveCfg = Release|Win32 {1CC002F1-843A-4B82-ADD1-A045B93A2DBA}.Release.Build.0 = Release|Win32 {5CDA6CEE-1D30-4C05-ACCA-327274FFC553}.Debug.ActiveCfg = Debug|Win32 {5CDA6CEE-1D30-4C05-ACCA-327274FFC553}.Debug.Build.0 = Debug|Win32 {5CDA6CEE-1D30-4C05-ACCA-327274FFC553}.Release.ActiveCfg = Release|Win32 {5CDA6CEE-1D30-4C05-ACCA-327274FFC553}.Release.Build.0 = Release|Win32 {3FEAADB2-4A97-473B-8839-4E97C0CD4F4B}.Debug.ActiveCfg = Debug|Win32 {3FEAADB2-4A97-473B-8839-4E97C0CD4F4B}.Debug.Build.0 = Debug|Win32 {3FEAADB2-4A97-473B-8839-4E97C0CD4F4B}.Release.ActiveCfg = Release|Win32 {3FEAADB2-4A97-473B-8839-4E97C0CD4F4B}.Release.Build.0 = Release|Win32 {CCEA3A1B-1170-4302-85A8-E4B441552105}.Debug.ActiveCfg = Debug|Win32 {CCEA3A1B-1170-4302-85A8-E4B441552105}.Debug.Build.0 = Debug|Win32 {CCEA3A1B-1170-4302-85A8-E4B441552105}.Release.ActiveCfg = Release|Win32 {CCEA3A1B-1170-4302-85A8-E4B441552105}.Release.Build.0 = Release|Win32 EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution EndGlobalSection GlobalSection(ExtensibilityAddIns) = postSolution EndGlobalSection EndGlobal ================================================ FILE: Bundles/Echoware/Echoware.vcproj ================================================ ================================================ FILE: Bundles/Echoware/Echoware.xcodeproj/admin.mode1 ================================================ ActivePerspectiveName Project AllowedModules BundleLoadPath MaxInstances n Module PBXSmartGroupTreeModule Name Groups and Files Outline View BundleLoadPath MaxInstances n Module PBXNavigatorGroup Name Editor BundleLoadPath MaxInstances n Module XCTaskListModule Name Task List BundleLoadPath MaxInstances n Module XCDetailModule Name File and Smart Group Detail Viewer BundleLoadPath MaxInstances 1 Module PBXBuildResultsModule Name Detailed Build Results Viewer BundleLoadPath MaxInstances 1 Module PBXProjectFindModule Name Project Batch Find Tool BundleLoadPath MaxInstances n Module PBXRunSessionModule Name Run Log BundleLoadPath MaxInstances n Module PBXBookmarksModule Name Bookmarks Tool BundleLoadPath MaxInstances n Module PBXClassBrowserModule Name Class Browser BundleLoadPath MaxInstances n Module PBXCVSModule Name Source Code Control Tool BundleLoadPath MaxInstances n Module PBXDebugBreakpointsModule Name Debug Breakpoints Tool BundleLoadPath MaxInstances n Module XCDockableInspector Name Inspector BundleLoadPath MaxInstances n Module PBXOpenQuicklyModule Name Open Quickly Tool BundleLoadPath MaxInstances 1 Module PBXDebugSessionModule Name Debugger BundleLoadPath MaxInstances 1 Module PBXDebugCLIModule Name Debug Console Description DefaultDescriptionKey DockingSystemVisible Extension mode1 FavBarConfig PBXProjectModuleGUID 84DAA48B0B132F2800222618 XCBarModuleItemNames XCBarModuleItems FirstTimeWindowDisplayed Identifier com.apple.perspectives.project.mode1 MajorVersion 31 MinorVersion 1 Name Default Notifications OpenEditors Content PBXProjectModuleGUID 849C677DC5B0469200F11330 PBXProjectModuleLabel EchoController.m PBXSplitModuleInNavigatorKey Split0 PBXProjectModuleGUID 849C6784C5B0469200F11330 PBXProjectModuleLabel EchoController.m _historyCapacity 0 bookmark 8487D8B40C6B3851006BDD7C history 849C6785C5B0469200F11330 8487D8A90C6B37E3006BDD7C 8487D8AA0C6B37E3006BDD7C 8487D8910C6B307D006BDD7C prevStack 849C6787C5B0469200F11330 849C6788C5B0469200F11330 8487D8AB0C6B37E3006BDD7C 8487D8AC0C6B37E3006BDD7C SplitCount 1 StatusBarVisibility Geometry Frame {{0, 20}, {750, 461}} PBXModuleWindowStatusBarHidden2 RubberWindowFrame 259 175 750 502 0 0 1024 746 PerspectiveWidths -1 -1 Perspectives ChosenToolbarItems active-target-popup active-buildstyle-popup action NSToolbarFlexibleSpaceItem buildOrClean build-and-runOrDebug com.apple.ide.PBXToolbarStopButton get-info toggle-editor NSToolbarFlexibleSpaceItem com.apple.pbx.toolbar.searchfield ControllerClassBaseName IconName WindowOfProjectWithEditor Identifier perspective.project IsVertical Layout ContentConfiguration PBXBottomSmartGroupGIDs 1C37FBAC04509CD000000102 1C37FAAC04509CD000000102 1C08E77C0454961000C914BD 1C37FABC05509CD000000102 1C37FABC05539CD112110102 E2644B35053B69B200211256 1C37FABC04509CD000100104 1CC0EA4004350EF90044410B 1CC0EA4004350EF90041110B 1C77FABC04509CD000000102 PBXProjectModuleGUID 1CE0B1FE06471DED0097A5F4 PBXProjectModuleLabel Files PBXProjectStructureProvided yes PBXSmartGroupTreeModuleColumnData PBXSmartGroupTreeModuleColumnWidthsKey 217 PBXSmartGroupTreeModuleColumnsKey_v4 MainColumn PBXSmartGroupTreeModuleOutlineStateKey_v7 PBXSmartGroupTreeModuleOutlineStateExpansionKey 089C166AFE841209C02AAC07 8400B9DE0B60F36E00FB16B3 19C28FB8FE9D52D311CA2CBB 1CC0EA4004350EF90041110B PBXSmartGroupTreeModuleOutlineStateSelectionKey 27 1 0 PBXSmartGroupTreeModuleOutlineStateVisibleRectKey {{0, 190}, {217, 589}} PBXTopSmartGroupGIDs XCIncludePerspectivesSwitch XCSharingToken com.apple.Xcode.GFSharingToken GeometryConfiguration Frame {{0, 0}, {234, 607}} GroupTreeTableConfiguration MainColumn 217 RubberWindowFrame 7 98 1024 648 0 0 1024 746 Module PBXSmartGroupTreeModule Proportion 234pt Dock BecomeActive ContentConfiguration PBXProjectModuleGUID 1CE0B20306471E060097A5F4 PBXProjectModuleLabel EchoController.m PBXSplitModuleInNavigatorKey Split0 PBXProjectModuleGUID 1CE0B20406471E060097A5F4 PBXProjectModuleLabel EchoController.m _historyCapacity 0 bookmark 8487D8B30C6B3851006BDD7C history 8456E4D00B4C1D20006B7550 8456E4D20B4C1D20006B7550 8456E5290B4C22C7006B7550 8456E7040B4D0EC2006B7550 8456E7060B4D0EC2006B7550 8456E7080B4D0EC2006B7550 8456E70A0B4D0EC2006B7550 8456E70C0B4D0EC2006B7550 8456E71A0B4D0EC2006B7550 8456E71C0B4D0EC2006B7550 8456E86F0B4E88C3006B7550 8456E8700B4E88C3006B7550 8456E8710B4E88C3006B7550 8456E8720B4E88C3006B7550 8456E8730B4E88C3006B7550 8456E8740B4E88C3006B7550 8456E8750B4E88C3006B7550 8456E8770B4E88C3006B7550 8456E9090B4E956F006B7550 84D9EE770B53EC5D00C10970 84D60AB30B5BB8EF00D9EBCB 84D60AB40B5BB8EF00D9EBCB 84D4FE540B5D2A960058AE41 84DFC6550B64D26200858CAB 848C41450B84919C00BD11B3 848C416E0B84946E00BD11B3 848C424C0B84C97700BD11B3 84AFF17D0B8C87E400D93058 84AFF17F0B8C87E400D93058 84AFF1B20B8C89CC00D93058 84B1AF9F0B94350200D477E7 84BC71A90B959EDF00BFC169 84BC71AA0B959EDF00BFC169 84BC71AB0B959EDF00BFC169 84BC71AD0B959EDF00BFC169 84BC71AE0B959EDF00BFC169 84BC71B00B959EDF00BFC169 84BC721F0B95BC1100BFC169 84BC730F0B95D09000BFC169 84BC73980B95F0D000BFC169 84BC74FA0B9604DE00BFC169 84BC75800B9610B400BFC169 84B0A8140B96D8B400B60726 84B0A9360B9707B000B60726 84B0AB400B973C9E00B60726 8428A4450B984D8900F257E1 84AF08E40B98819600B348CB 84AF08E60B98819600B348CB 84BE444E0B9D67F2007EF582 84BE44970B9D6EE7007EF582 84239D390BB2A1BA00C28522 84239D3C0BB2A1BA00C28522 84DDE9750BB90B6B0074B26A 84BF70560BC3D30900AB75ED 84BF70BE0BC3DAC200AB75ED 84DE1A860BCCE1DA0033A95C 840034DB0BCD16CB00D03C1B 84BE28730BCD2B780086E6B3 84409C610BCE2D4700A7BC33 84B18DB40BCF7EEF005360E0 8420DD240BD394E900937A80 847EA4B40BDDEC2B005AC757 847EA4B60BDDEC2B005AC757 847EA4FB0BDDF714005AC757 847EA4FC0BDDF714005AC757 847EA4FD0BDDF714005AC757 8418426EC5B04BFC00DC27BC 84A37A52C5B0A121003069A5 84C86843C5B077FA0013D2B1 84C86844C5B077FA0013D2B1 844D2C290C31125500A71AF3 84464D2F0C3A520F00064760 84464D330C3A520F00064760 84464D4C0C3A523400064760 84464E470C3A8F4900064760 84DF556F0C3CC76F00AD2F4B 843C1D500C3F94EB000BB087 8491B6BD0C44CB2B00E4B477 84E20C5D0C57AF7C004FB864 849C6797C5B0469200F11330 8487D8A10C6B37E3006BDD7C 8487D8A20C6B37E3006BDD7C 8487D8A30C6B37E3006BDD7C prevStack 8456E4D70B4C1D20006B7550 8456E4D90B4C1D20006B7550 8456E52D0B4C22C7006B7550 8456E71E0B4D0EC2006B7550 8456E71F0B4D0EC2006B7550 8456E7200B4D0EC2006B7550 8456E7210B4D0EC2006B7550 8456E7230B4D0EC2006B7550 8456E7250B4D0EC2006B7550 8456E7270B4D0EC2006B7550 8456E7290B4D0EC2006B7550 8456E72B0B4D0EC2006B7550 8456E72D0B4D0EC2006B7550 8456E87B0B4E88C3006B7550 8456E87C0B4E88C3006B7550 8456E87D0B4E88C3006B7550 8456E90A0B4E956F006B7550 8456E95E0B4EA7D1006B7550 84F22A380B53D80F004CD709 84D9EE150B53E20600C10970 84E9145B0B564E2E009AD6FC 84E9145E0B564E2E009AD6FC 84E8F34C0B57B4DF001DACF7 84D60ABD0B5BB8EF00D9EBCB 84D60AC10B5BB8EF00D9EBCB 84D60AC30B5BB8EF00D9EBCB 84D60AC40B5BB8EF00D9EBCB 84D60AC90B5BB8EF00D9EBCB 84D60ACC0B5BB8EF00D9EBCB 84D60B760B5BC12200D9EBCB 84D60B770B5BC12200D9EBCB 84D60BA40B5BC49500D9EBCB 84D60BA50B5BC49500D9EBCB 84D4FA460B5CCFFB0058AE41 84D4FB3F0B5CFCE50058AE41 84D4FB5B0B5CFE640058AE41 84D4FCA60B5D15890058AE41 84D4FCA70B5D15890058AE41 84D5200B0B5E19C10050DE52 84D520E40B5E2C1A0050DE52 8400BEAE0B612C7C00FB16B3 84DFC45E0B64BF8200858CAB 84DFC6580B64D26200858CAB 84C5A4370B67B31C00A596C5 8460E80A0B8469BA009E0CB5 8460E80B0B8469BA009E0CB5 848C41470B84919C00BD11B3 848C414C0B84919C00BD11B3 848C414D0B84919C00BD11B3 848C41AE0B84A77400BD11B3 848C42570B84C97700BD11B3 848C42580B84C97700BD11B3 848C42590B84C97700BD11B3 848C425B0B84C97700BD11B3 84AFF1850B8C87E400D93058 84AFF1890B8C87E400D93058 84AFF18A0B8C87E400D93058 84AFF18D0B8C87E400D93058 84D448D60B8EE46C008F9D1F 84D44A870B8F44B4008F9D1F 84B1AFA50B94350200D477E7 84B1AFA80B94350200D477E7 84B1B0070B9465A300D477E7 84BC71BE0B959EDF00BFC169 84BC71BF0B959EDF00BFC169 84BC71C30B959EDF00BFC169 84BC71C50B959EDF00BFC169 84BC71CB0B959EDF00BFC169 84BC71CC0B959EDF00BFC169 84BC72210B95BC1100BFC169 84BC74FF0B9604DE00BFC169 84BC75900B9610B400BFC169 84B0A81D0B96D8B400B60726 84AF48B20BCCD4FB00C5BF0A 84184270C5B04BFC00DC27BC 841842B1C5B0606800DC27BC 849C6798C5B0469200F11330 8487D8A40C6B37E3006BDD7C 8487D8A50C6B37E3006BDD7C SplitCount 1 StatusBarVisibility GeometryConfiguration Frame {{0, 0}, {785, 493}} RubberWindowFrame 7 98 1024 648 0 0 1024 746 Module PBXNavigatorGroup Proportion 493pt ContentConfiguration PBXProjectModuleGUID 1CE0B20506471E060097A5F4 PBXProjectModuleLabel Detail GeometryConfiguration Frame {{0, 498}, {785, 109}} RubberWindowFrame 7 98 1024 648 0 0 1024 746 Module XCDetailModule Proportion 109pt Proportion 785pt Name Project ServiceClasses XCModuleDock PBXSmartGroupTreeModule XCModuleDock PBXNavigatorGroup XCDetailModule TableOfContents 8487D8A70C6B37E3006BDD7C 1CE0B1FE06471DED0097A5F4 8487D8A80C6B37E3006BDD7C 1CE0B20306471E060097A5F4 1CE0B20506471E060097A5F4 ToolbarConfiguration xcode.toolbar.config.default ControllerClassBaseName IconName WindowOfProject Identifier perspective.morph IsVertical 0 Layout BecomeActive 1 ContentConfiguration PBXBottomSmartGroupGIDs 1C37FBAC04509CD000000102 1C37FAAC04509CD000000102 1C08E77C0454961000C914BD 1C37FABC05509CD000000102 1C37FABC05539CD112110102 E2644B35053B69B200211256 1C37FABC04509CD000100104 1CC0EA4004350EF90044410B 1CC0EA4004350EF90041110B PBXProjectModuleGUID 11E0B1FE06471DED0097A5F4 PBXProjectModuleLabel Files PBXProjectStructureProvided yes PBXSmartGroupTreeModuleColumnData PBXSmartGroupTreeModuleColumnWidthsKey 186 PBXSmartGroupTreeModuleColumnsKey_v4 MainColumn PBXSmartGroupTreeModuleOutlineStateKey_v7 PBXSmartGroupTreeModuleOutlineStateExpansionKey 29B97314FDCFA39411CA2CEA 1C37FABC05509CD000000102 PBXSmartGroupTreeModuleOutlineStateSelectionKey 0 PBXSmartGroupTreeModuleOutlineStateVisibleRectKey {{0, 0}, {186, 337}} PBXTopSmartGroupGIDs XCIncludePerspectivesSwitch 1 XCSharingToken com.apple.Xcode.GFSharingToken GeometryConfiguration Frame {{0, 0}, {203, 355}} GroupTreeTableConfiguration MainColumn 186 RubberWindowFrame 373 269 690 397 0 0 1440 878 Module PBXSmartGroupTreeModule Proportion 100% Name Morph PreferredWidth 300 ServiceClasses XCModuleDock PBXSmartGroupTreeModule TableOfContents 11E0B1FE06471DED0097A5F4 ToolbarConfiguration xcode.toolbar.config.default.short PerspectivesBarVisible PinnedNavigatorIdentifier 849C677DC5B0469200F11330 ShelfIsVisible SourceDescription file at '/System/Library/PrivateFrameworks/DevToolsInterface.framework/Versions/A/Resources/XCPerspectivesSpecificationMode1.xcperspec' StatusbarIsVisible TimeStamp 0.0 ToolbarDisplayMode 1 ToolbarIsVisible ToolbarSizeMode 1 Type Perspectives UpdateMessage The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'? WindowJustification 5 WindowOrderList 1C0AD2B3069F1EA900FABCE6 849C677DC5B0469200F11330 /Users/admin/Projects/Echoware/Echoware.xcodeproj WindowString 7 98 1024 648 0 0 1024 746 WindowTools FirstTimeWindowDisplayed Identifier windowTool.build IsVertical Layout Dock BecomeActive ContentConfiguration PBXProjectModuleGUID 1CD0528F0623707200166675 PBXProjectModuleLabel EchoController.m StatusBarVisibility GeometryConfiguration Frame {{0, 0}, {851, 355}} RubberWindowFrame 99 121 851 615 0 0 1024 746 Module PBXNavigatorGroup Proportion 355pt ContentConfiguration PBXProjectModuleGUID XCMainBuildResultsModuleGUID PBXProjectModuleLabel Build XCBuildResultsTrigger_Collapse 1021 XCBuildResultsTrigger_Open 1011 GeometryConfiguration Frame {{0, 360}, {851, 214}} RubberWindowFrame 99 121 851 615 0 0 1024 746 Module PBXBuildResultsModule Proportion 214pt Proportion 574pt Name Build Results ServiceClasses PBXBuildResultsModule StatusbarIsVisible TableOfContents 84DAA48C0B132F2800222618 8487D89C0C6B3773006BDD7C 1CD0528F0623707200166675 XCMainBuildResultsModuleGUID ToolbarConfiguration xcode.toolbar.config.build WindowString 99 121 851 615 0 0 1024 746 WindowToolGUID 84DAA48C0B132F2800222618 WindowToolIsVisible FirstTimeWindowDisplayed Identifier windowTool.debugger IsVertical Layout Dock ContentConfiguration Debugger HorizontalSplitView _collapsingFrameDimension 0.0 _indexOfCollapsedView 0 _percentageOfCollapsedView 0.0 isCollapsed yes sizes {{0, 0}, {266, 300}} {{266, 0}, {582, 300}} VerticalSplitView _collapsingFrameDimension 0.0 _indexOfCollapsedView 0 _percentageOfCollapsedView 0.0 isCollapsed yes sizes {{0, 0}, {848, 300}} {{0, 300}, {848, 271}} LauncherConfigVersion 8 PBXProjectModuleGUID 1C162984064C10D400B95A72 PBXProjectModuleLabel Debug - GLUTExamples (Underwater) GeometryConfiguration DebugConsoleDrawerSize {100, 120} DebugConsoleVisible None DebugConsoleWindowFrame {{200, 200}, {500, 300}} DebugSTDIOWindowFrame {{200, 200}, {500, 300}} Frame {{0, 0}, {848, 571}} RubberWindowFrame 119 134 848 612 0 0 1024 746 Module PBXDebugSessionModule Proportion 571pt Proportion 571pt Name Debugger ServiceClasses PBXDebugSessionModule StatusbarIsVisible TableOfContents 1CD10A99069EF8BA00B06720 84464E510C3A8F4900064760 1C162984064C10D400B95A72 84464E520C3A8F4900064760 84464E530C3A8F4900064760 84464E540C3A8F4900064760 84464E550C3A8F4900064760 84464E560C3A8F4900064760 84464E570C3A8F4900064760 ToolbarConfiguration xcode.toolbar.config.debug WindowString 119 134 848 612 0 0 1024 746 WindowToolGUID 1CD10A99069EF8BA00B06720 WindowToolIsVisible FirstTimeWindowDisplayed Identifier windowTool.find IsVertical Layout Dock Dock BecomeActive ContentConfiguration PBXProjectModuleGUID 1CDD528C0622207200134675 PBXProjectModuleLabel ACConnection.cpp StatusBarVisibility GeometryConfiguration Frame {{0, 0}, {1024, 348}} RubberWindowFrame 36 62 1024 671 0 0 1024 746 Module PBXNavigatorGroup Proportion 1024pt Proportion 348pt ContentConfiguration PBXProjectModuleGUID 1CD0528E0623707200166675 PBXProjectModuleLabel Project Find GeometryConfiguration Frame {{0, 353}, {1024, 277}} RubberWindowFrame 36 62 1024 671 0 0 1024 746 Module PBXProjectFindModule Proportion 277pt Proportion 630pt Name Project Find ServiceClasses PBXProjectFindModule StatusbarIsVisible TableOfContents 1C530D57069F1CE1000CFCEE 84E20C5A0C57AF7B004FB864 84E20C5B0C57AF7B004FB864 1CDD528C0622207200134675 1CD0528E0623707200166675 WindowString 36 62 1024 671 0 0 1024 746 WindowToolGUID 1C530D57069F1CE1000CFCEE WindowToolIsVisible Identifier MENUSEPARATOR FirstTimeWindowDisplayed Identifier windowTool.debuggerConsole IsVertical Layout Dock ContentConfiguration PBXProjectModuleGUID 1C78EAAC065D492600B07095 PBXProjectModuleLabel Debugger Console GeometryConfiguration Frame {{0, 0}, {440, 358}} RubberWindowFrame 65 297 440 400 0 0 1024 746 Module PBXDebugCLIModule Proportion 358pt Proportion 359pt Name Debugger Console ServiceClasses PBXDebugCLIModule StatusbarIsVisible TableOfContents 84DAA5480B14CCD900222618 84C86822C5B0743E0013D2B1 1C78EAAC065D492600B07095 WindowString 65 297 440 400 0 0 1024 746 WindowToolGUID 84DAA5480B14CCD900222618 WindowToolIsVisible FirstTimeWindowDisplayed Identifier windowTool.run IsVertical Layout Dock ContentConfiguration LauncherConfigVersion 3 PBXProjectModuleGUID 1CD0528B0623707200166675 PBXProjectModuleLabel Run Runner HorizontalSplitView _collapsingFrameDimension 0.0 _indexOfCollapsedView 0 _percentageOfCollapsedView 0.0 isCollapsed yes sizes {{0, 0}, {493, 167}} {{0, 176}, {493, 267}} VerticalSplitView _collapsingFrameDimension 0.0 _indexOfCollapsedView 0 _percentageOfCollapsedView 0.0 isCollapsed yes sizes {{0, 0}, {405, 443}} {{414, 0}, {514, 443}} GeometryConfiguration Frame {{0, 0}, {657, 425}} RubberWindowFrame 254 226 657 466 0 0 1024 746 Module PBXRunSessionModule Proportion 425pt Proportion 425pt Name Run Log ServiceClasses PBXRunSessionModule StatusbarIsVisible TableOfContents 1C0AD2B3069F1EA900FABCE6 8487D89D0C6B3773006BDD7C 1CD0528B0623707200166675 8487D89E0C6B3773006BDD7C ToolbarConfiguration xcode.toolbar.config.run WindowString 254 226 657 466 0 0 1024 746 WindowToolGUID 1C0AD2B3069F1EA900FABCE6 WindowToolIsVisible Identifier windowTool.scm Layout Dock ContentConfiguration PBXProjectModuleGUID 1C78EAB2065D492600B07095 PBXProjectModuleLabel <No Editor> PBXSplitModuleInNavigatorKey Split0 PBXProjectModuleGUID 1C78EAB3065D492600B07095 SplitCount 1 StatusBarVisibility 1 GeometryConfiguration Frame {{0, 0}, {452, 0}} RubberWindowFrame 743 379 452 308 0 0 1280 1002 Module PBXNavigatorGroup Proportion 0pt BecomeActive 1 ContentConfiguration PBXProjectModuleGUID 1CD052920623707200166675 PBXProjectModuleLabel SCM GeometryConfiguration ConsoleFrame {{0, 259}, {452, 0}} Frame {{0, 7}, {452, 259}} RubberWindowFrame 743 379 452 308 0 0 1280 1002 TableConfiguration Status 30 FileName 199 Path 197.09500122070312 TableFrame {{0, 0}, {452, 250}} Module PBXCVSModule Proportion 262pt Proportion 266pt Name SCM ServiceClasses PBXCVSModule StatusbarIsVisible 1 TableOfContents 1C78EAB4065D492600B07095 1C78EAB5065D492600B07095 1C78EAB2065D492600B07095 1CD052920623707200166675 ToolbarConfiguration xcode.toolbar.config.scm WindowString 743 379 452 308 0 0 1280 1002 FirstTimeWindowDisplayed Identifier windowTool.breakpoints IsVertical Layout Dock ContentConfiguration PBXBottomSmartGroupGIDs 1C77FABC04509CD000000102 PBXProjectModuleGUID 1CE0B1FE06471DED0097A5F4 PBXProjectModuleLabel Files PBXProjectStructureProvided no PBXSmartGroupTreeModuleColumnData PBXSmartGroupTreeModuleColumnWidthsKey 168 PBXSmartGroupTreeModuleColumnsKey_v4 MainColumn PBXSmartGroupTreeModuleOutlineStateKey_v7 PBXSmartGroupTreeModuleOutlineStateExpansionKey 1C77FABC04509CD000000102 1C3E0DCA080725EA00A55177 PBXSmartGroupTreeModuleOutlineStateSelectionKey 0 PBXSmartGroupTreeModuleOutlineStateVisibleRectKey {{0, 0}, {168, 350}} PBXTopSmartGroupGIDs XCIncludePerspectivesSwitch GeometryConfiguration Frame {{0, 0}, {185, 368}} GroupTreeTableConfiguration MainColumn 168 RubberWindowFrame 283 268 744 409 0 0 1024 746 Module PBXSmartGroupTreeModule Proportion 185pt BecomeActive ContentConfiguration PBXProjectModuleGUID 1CA1AED706398EBD00589147 PBXProjectModuleLabel Detail GeometryConfiguration Frame {{190, 0}, {554, 368}} RubberWindowFrame 283 268 744 409 0 0 1024 746 Module XCDetailModule Proportion 554pt Proportion 368pt MajorVersion 2 MinorVersion 0 Name Breakpoints ServiceClasses PBXSmartGroupTreeModule XCDetailModule StatusbarIsVisible TableOfContents 84C5A4630B67B67E00A596C5 84C5A4640B67B67E00A596C5 1CE0B1FE06471DED0097A5F4 1CA1AED706398EBD00589147 ToolbarConfiguration xcode.toolbar.config.breakpoints WindowString 283 268 744 409 0 0 1024 746 WindowToolGUID 84C5A4630B67B67E00A596C5 WindowToolIsVisible Identifier windowTool.debugAnimator Layout Dock Module PBXNavigatorGroup Proportion 100% Proportion 100% Name Debug Visualizer ServiceClasses PBXNavigatorGroup StatusbarIsVisible 1 ToolbarConfiguration xcode.toolbar.config.debugAnimator WindowString 100 100 700 500 0 0 1280 1002 Identifier windowTool.bookmarks Layout Dock Module PBXBookmarksModule Proportion 100% Proportion 100% Name Bookmarks ServiceClasses PBXBookmarksModule StatusbarIsVisible 0 WindowString 538 42 401 187 0 0 1280 1002 Identifier windowTool.classBrowser Layout Dock BecomeActive 1 ContentConfiguration OptionsSetName Hierarchy, all classes PBXProjectModuleGUID 1CA6456E063B45B4001379D8 PBXProjectModuleLabel Class Browser - NSObject GeometryConfiguration ClassesFrame {{0, 0}, {374, 96}} ClassesTreeTableConfiguration PBXClassNameColumnIdentifier 208 PBXClassBookColumnIdentifier 22 Frame {{0, 0}, {630, 331}} MembersFrame {{0, 105}, {374, 395}} MembersTreeTableConfiguration PBXMemberTypeIconColumnIdentifier 22 PBXMemberNameColumnIdentifier 216 PBXMemberTypeColumnIdentifier 97 PBXMemberBookColumnIdentifier 22 PBXModuleWindowStatusBarHidden2 1 RubberWindowFrame 385 179 630 352 0 0 1440 878 Module PBXClassBrowserModule Proportion 332pt Proportion 332pt Name Class Browser ServiceClasses PBXClassBrowserModule StatusbarIsVisible 0 TableOfContents 1C0AD2AF069F1E9B00FABCE6 1C0AD2B0069F1E9B00FABCE6 1CA6456E063B45B4001379D8 ToolbarConfiguration xcode.toolbar.config.classbrowser WindowString 385 179 630 352 0 0 1440 878 WindowToolGUID 1C0AD2AF069F1E9B00FABCE6 WindowToolIsVisible 0 ================================================ FILE: Bundles/Echoware/Echoware.xcodeproj/admin.pbxuser ================================================ // !$*UTF8*$! { 089C1669FE841209C02AAC07 /* Project object */ = { activeBuildConfigurationName = Deployment; activeExecutable = 8480D0BC0B5F8D200030E8C0 /* Vine Server 2.1 */; activeTarget = 8D5B49AC048680CD000E48DA /* Echoware */; addToTargets = ( 8D5B49AC048680CD000E48DA /* Echoware */, ); breakpoints = ( ); breakpointsGroup = 84DAA51F0B14A33800222618 /* XCBreakpointsBucket */; codeSenseManager = 84DAA48F0B132F2900222618 /* Code sense */; executables = ( 8480D0BC0B5F8D200030E8C0 /* Vine Server 2.1 */, ); expressions = ( dwKey, "*(dwKey)", ); perUserDictionary = { "PBXConfiguration.PBXBreakpointsDataSource.v1:1CA1AED706398EBD00589147" = { PBXFileTableDataSourceColumnSortingDirectionKey = 1; PBXFileTableDataSourceColumnSortingKey = PBXBreakpointsDataSource_ContinueID; PBXFileTableDataSourceColumnWidthsKey = ( 20, 20, 210, 20, 110, 109, 20, ); PBXFileTableDataSourceColumnsKey = ( PBXBreakpointsDataSource_ActionID, PBXBreakpointsDataSource_TypeID, PBXBreakpointsDataSource_BreakpointID, PBXBreakpointsDataSource_UseID, PBXBreakpointsDataSource_LocationID, PBXBreakpointsDataSource_ConditionID, PBXBreakpointsDataSource_ContinueID, ); }; "PBXConfiguration.PBXBreakpointsDataSource.v1:1CE0B20506471E060097A5F4" = { PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; PBXFileTableDataSourceColumnSortingKey = PBXBreakpointsDataSource_BreakpointID; PBXFileTableDataSourceColumnWidthsKey = ( 20, 20, 287, 20, 186, 187, 20, ); PBXFileTableDataSourceColumnsKey = ( PBXBreakpointsDataSource_ActionID, PBXBreakpointsDataSource_TypeID, PBXBreakpointsDataSource_BreakpointID, PBXBreakpointsDataSource_UseID, PBXBreakpointsDataSource_LocationID, PBXBreakpointsDataSource_ConditionID, PBXBreakpointsDataSource_ContinueID, ); }; PBXConfiguration.PBXFileTableDataSource3.PBXBookmarksDataSource = { PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; PBXFileTableDataSourceColumnSortingKey = PBXBookmarksDataSource_NameID; PBXFileTableDataSourceColumnWidthsKey = ( 200, 200, 57.5835, ); PBXFileTableDataSourceColumnsKey = ( PBXBookmarksDataSource_LocationID, PBXBookmarksDataSource_NameID, PBXBookmarksDataSource_CommentsID, ); }; PBXConfiguration.PBXFileTableDataSource3.PBXErrorsWarningsDataSource = { PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; PBXFileTableDataSourceColumnSortingKey = PBXErrorsWarningsDataSource_LocationID; PBXFileTableDataSourceColumnWidthsKey = ( 20, 300, 260, ); PBXFileTableDataSourceColumnsKey = ( PBXErrorsWarningsDataSource_TypeID, PBXErrorsWarningsDataSource_MessageID, PBXErrorsWarningsDataSource_LocationID, ); }; PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = { PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID; PBXFileTableDataSourceColumnWidthsKey = ( 22, 300, 257, ); PBXFileTableDataSourceColumnsKey = ( PBXExecutablesDataSource_ActiveFlagID, PBXExecutablesDataSource_NameID, PBXExecutablesDataSource_CommentsID, ); }; PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; PBXFileTableDataSourceColumnWidthsKey = ( 20, 546, 20, 48, 43, 43, 20, ); PBXFileTableDataSourceColumnsKey = ( PBXFileDataSource_FiletypeID, PBXFileDataSource_Filename_ColumnID, PBXFileDataSource_Built_ColumnID, PBXFileDataSource_ObjectSize_ColumnID, PBXFileDataSource_Errors_ColumnID, PBXFileDataSource_Warnings_ColumnID, PBXFileDataSource_Target_ColumnID, ); }; PBXConfiguration.PBXFileTableDataSource3.PBXFindDataSource = { PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; PBXFileTableDataSourceColumnSortingKey = PBXFindDataSource_LocationID; PBXFileTableDataSourceColumnWidthsKey = ( 200, 120, ); PBXFileTableDataSourceColumnsKey = ( PBXFindDataSource_MessageID, PBXFindDataSource_LocationID, ); }; PBXConfiguration.PBXFileTableDataSource3.PBXSymbolsDataSource = { PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; PBXFileTableDataSourceColumnSortingKey = PBXSymbolsDataSource_SymbolNameID; PBXFileTableDataSourceColumnWidthsKey = ( 16, 200, 50, 183, ); PBXFileTableDataSourceColumnsKey = ( PBXSymbolsDataSource_SymbolTypeIconID, PBXSymbolsDataSource_SymbolNameID, PBXSymbolsDataSource_SymbolTypeID, PBXSymbolsDataSource_ReferenceNameID, ); }; PBXConfiguration.PBXFileTableDataSource3.XCSCMDataSource = { PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; PBXFileTableDataSourceColumnWidthsKey = ( 20, 20, 121, 20, 48, 43, 43, 20, ); PBXFileTableDataSourceColumnsKey = ( PBXFileDataSource_SCM_ColumnID, PBXFileDataSource_FiletypeID, PBXFileDataSource_Filename_ColumnID, PBXFileDataSource_Built_ColumnID, PBXFileDataSource_ObjectSize_ColumnID, PBXFileDataSource_Errors_ColumnID, PBXFileDataSource_Warnings_ColumnID, PBXFileDataSource_Target_ColumnID, ); }; PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = { PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; PBXFileTableDataSourceColumnWidthsKey = ( 20, 200, 366, 20, 48, 43, 43, ); PBXFileTableDataSourceColumnsKey = ( PBXFileDataSource_FiletypeID, PBXFileDataSource_Filename_ColumnID, PBXTargetDataSource_PrimaryAttribute, PBXFileDataSource_Built_ColumnID, PBXFileDataSource_ObjectSize_ColumnID, PBXFileDataSource_Errors_ColumnID, PBXFileDataSource_Warnings_ColumnID, ); }; PBXPerProjectTemplateStateSaveDate = 208340943; PBXWorkspaceStateSaveDate = 208340943; }; perUserProjectItems = { 840034DB0BCD16CB00D03C1B /* PBXTextBookmark */ = 840034DB0BCD16CB00D03C1B /* PBXTextBookmark */; 8400BEAE0B612C7C00FB16B3 /* PBXTextBookmark */ = 8400BEAE0B612C7C00FB16B3 /* PBXTextBookmark */; 8418426EC5B04BFC00DC27BC /* PBXTextBookmark */ = 8418426EC5B04BFC00DC27BC /* PBXTextBookmark */; 84184270C5B04BFC00DC27BC /* PBXTextBookmark */ = 84184270C5B04BFC00DC27BC /* PBXTextBookmark */; 841842B1C5B0606800DC27BC /* PBXTextBookmark */ = 841842B1C5B0606800DC27BC /* PBXTextBookmark */; 8420DD240BD394E900937A80 /* PBXTextBookmark */ = 8420DD240BD394E900937A80 /* PBXTextBookmark */; 84239D390BB2A1BA00C28522 /* PBXTextBookmark */ = 84239D390BB2A1BA00C28522 /* PBXTextBookmark */; 84239D3C0BB2A1BA00C28522 /* PBXTextBookmark */ = 84239D3C0BB2A1BA00C28522 /* PBXTextBookmark */; 8428A4450B984D8900F257E1 /* PBXTextBookmark */ = 8428A4450B984D8900F257E1 /* PBXTextBookmark */; 843C1D500C3F94EB000BB087 /* PBXTextBookmark */ = 843C1D500C3F94EB000BB087 /* PBXTextBookmark */; 84409C610BCE2D4700A7BC33 /* PBXTextBookmark */ = 84409C610BCE2D4700A7BC33 /* PBXTextBookmark */; 84464D2F0C3A520F00064760 /* PBXTextBookmark */ = 84464D2F0C3A520F00064760 /* PBXTextBookmark */; 84464D330C3A520F00064760 /* PBXTextBookmark */ = 84464D330C3A520F00064760 /* PBXTextBookmark */; 84464D4C0C3A523400064760 /* PBXTextBookmark */ = 84464D4C0C3A523400064760 /* PBXTextBookmark */; 84464E470C3A8F4900064760 /* PBXTextBookmark */ = 84464E470C3A8F4900064760 /* PBXTextBookmark */; 844D2C290C31125500A71AF3 /* PBXTextBookmark */ = 844D2C290C31125500A71AF3 /* PBXTextBookmark */; 8456E4D00B4C1D20006B7550 /* PBXTextBookmark */ = 8456E4D00B4C1D20006B7550 /* PBXTextBookmark */; 8456E4D20B4C1D20006B7550 /* PBXTextBookmark */ = 8456E4D20B4C1D20006B7550 /* PBXTextBookmark */; 8456E4D70B4C1D20006B7550 /* PBXTextBookmark */ = 8456E4D70B4C1D20006B7550 /* PBXTextBookmark */; 8456E4D90B4C1D20006B7550 /* PBXTextBookmark */ = 8456E4D90B4C1D20006B7550 /* PBXTextBookmark */; 8456E5290B4C22C7006B7550 /* PBXTextBookmark */ = 8456E5290B4C22C7006B7550 /* PBXTextBookmark */; 8456E52D0B4C22C7006B7550 /* PBXTextBookmark */ = 8456E52D0B4C22C7006B7550 /* PBXTextBookmark */; 8456E7040B4D0EC2006B7550 /* PBXTextBookmark */ = 8456E7040B4D0EC2006B7550 /* PBXTextBookmark */; 8456E7060B4D0EC2006B7550 /* PBXTextBookmark */ = 8456E7060B4D0EC2006B7550 /* PBXTextBookmark */; 8456E7080B4D0EC2006B7550 /* PBXTextBookmark */ = 8456E7080B4D0EC2006B7550 /* PBXTextBookmark */; 8456E70A0B4D0EC2006B7550 /* PBXTextBookmark */ = 8456E70A0B4D0EC2006B7550 /* PBXTextBookmark */; 8456E70C0B4D0EC2006B7550 /* PBXTextBookmark */ = 8456E70C0B4D0EC2006B7550 /* PBXTextBookmark */; 8456E71A0B4D0EC2006B7550 /* PBXTextBookmark */ = 8456E71A0B4D0EC2006B7550 /* PBXTextBookmark */; 8456E71C0B4D0EC2006B7550 /* PBXTextBookmark */ = 8456E71C0B4D0EC2006B7550 /* PBXTextBookmark */; 8456E71E0B4D0EC2006B7550 /* PBXTextBookmark */ = 8456E71E0B4D0EC2006B7550 /* PBXTextBookmark */; 8456E71F0B4D0EC2006B7550 /* PBXTextBookmark */ = 8456E71F0B4D0EC2006B7550 /* PBXTextBookmark */; 8456E7200B4D0EC2006B7550 /* PBXTextBookmark */ = 8456E7200B4D0EC2006B7550 /* PBXTextBookmark */; 8456E7210B4D0EC2006B7550 /* PBXTextBookmark */ = 8456E7210B4D0EC2006B7550 /* PBXTextBookmark */; 8456E7230B4D0EC2006B7550 /* PBXTextBookmark */ = 8456E7230B4D0EC2006B7550 /* PBXTextBookmark */; 8456E7250B4D0EC2006B7550 /* PBXTextBookmark */ = 8456E7250B4D0EC2006B7550 /* PBXTextBookmark */; 8456E7270B4D0EC2006B7550 /* PBXTextBookmark */ = 8456E7270B4D0EC2006B7550 /* PBXTextBookmark */; 8456E7290B4D0EC2006B7550 /* PBXTextBookmark */ = 8456E7290B4D0EC2006B7550 /* PBXTextBookmark */; 8456E72B0B4D0EC2006B7550 /* PBXTextBookmark */ = 8456E72B0B4D0EC2006B7550 /* PBXTextBookmark */; 8456E72D0B4D0EC2006B7550 /* PBXTextBookmark */ = 8456E72D0B4D0EC2006B7550 /* PBXTextBookmark */; 8456E86F0B4E88C3006B7550 /* PBXTextBookmark */ = 8456E86F0B4E88C3006B7550 /* PBXTextBookmark */; 8456E8700B4E88C3006B7550 /* PBXTextBookmark */ = 8456E8700B4E88C3006B7550 /* PBXTextBookmark */; 8456E8710B4E88C3006B7550 /* PBXTextBookmark */ = 8456E8710B4E88C3006B7550 /* PBXTextBookmark */; 8456E8720B4E88C3006B7550 /* PBXTextBookmark */ = 8456E8720B4E88C3006B7550 /* PBXTextBookmark */; 8456E8730B4E88C3006B7550 /* PBXTextBookmark */ = 8456E8730B4E88C3006B7550 /* PBXTextBookmark */; 8456E8740B4E88C3006B7550 /* PBXTextBookmark */ = 8456E8740B4E88C3006B7550 /* PBXTextBookmark */; 8456E8750B4E88C3006B7550 /* PBXTextBookmark */ = 8456E8750B4E88C3006B7550 /* PBXTextBookmark */; 8456E8770B4E88C3006B7550 /* PBXTextBookmark */ = 8456E8770B4E88C3006B7550 /* PBXTextBookmark */; 8456E87B0B4E88C3006B7550 /* PBXTextBookmark */ = 8456E87B0B4E88C3006B7550 /* PBXTextBookmark */; 8456E87C0B4E88C3006B7550 /* PBXTextBookmark */ = 8456E87C0B4E88C3006B7550 /* PBXTextBookmark */; 8456E87D0B4E88C3006B7550 /* PBXTextBookmark */ = 8456E87D0B4E88C3006B7550 /* PBXTextBookmark */; 8456E9090B4E956F006B7550 /* PBXTextBookmark */ = 8456E9090B4E956F006B7550 /* PBXTextBookmark */; 8456E90A0B4E956F006B7550 /* PBXTextBookmark */ = 8456E90A0B4E956F006B7550 /* PBXTextBookmark */; 8456E95E0B4EA7D1006B7550 /* PBXTextBookmark */ = 8456E95E0B4EA7D1006B7550 /* PBXTextBookmark */; 8460E80A0B8469BA009E0CB5 /* PBXTextBookmark */ = 8460E80A0B8469BA009E0CB5 /* PBXTextBookmark */; 8460E80B0B8469BA009E0CB5 /* PBXTextBookmark */ = 8460E80B0B8469BA009E0CB5 /* PBXTextBookmark */; 847EA4B40BDDEC2B005AC757 /* PBXTextBookmark */ = 847EA4B40BDDEC2B005AC757 /* PBXTextBookmark */; 847EA4B60BDDEC2B005AC757 /* PBXTextBookmark */ = 847EA4B60BDDEC2B005AC757 /* PBXTextBookmark */; 847EA4FB0BDDF714005AC757 /* PBXTextBookmark */ = 847EA4FB0BDDF714005AC757 /* PBXTextBookmark */; 847EA4FC0BDDF714005AC757 /* PBXTextBookmark */ = 847EA4FC0BDDF714005AC757 /* PBXTextBookmark */; 847EA4FD0BDDF714005AC757 /* PBXTextBookmark */ = 847EA4FD0BDDF714005AC757 /* PBXTextBookmark */; 8487D8910C6B307D006BDD7C /* PBXBookmark */ = 8487D8910C6B307D006BDD7C /* PBXBookmark */; 8487D8A10C6B37E3006BDD7C /* PBXTextBookmark */ = 8487D8A10C6B37E3006BDD7C /* PBXTextBookmark */; 8487D8A20C6B37E3006BDD7C /* PBXTextBookmark */ = 8487D8A20C6B37E3006BDD7C /* PBXTextBookmark */; 8487D8A30C6B37E3006BDD7C /* PBXTextBookmark */ = 8487D8A30C6B37E3006BDD7C /* PBXTextBookmark */; 8487D8A40C6B37E3006BDD7C /* PBXTextBookmark */ = 8487D8A40C6B37E3006BDD7C /* PBXTextBookmark */; 8487D8A50C6B37E3006BDD7C /* PBXTextBookmark */ = 8487D8A50C6B37E3006BDD7C /* PBXTextBookmark */; 8487D8A90C6B37E3006BDD7C /* PBXTextBookmark */ = 8487D8A90C6B37E3006BDD7C /* PBXTextBookmark */; 8487D8AA0C6B37E3006BDD7C /* PBXTextBookmark */ = 8487D8AA0C6B37E3006BDD7C /* PBXTextBookmark */; 8487D8AB0C6B37E3006BDD7C /* PBXTextBookmark */ = 8487D8AB0C6B37E3006BDD7C /* PBXTextBookmark */; 8487D8AC0C6B37E3006BDD7C /* PBXTextBookmark */ = 8487D8AC0C6B37E3006BDD7C /* PBXTextBookmark */; 8487D8B30C6B3851006BDD7C /* PBXTextBookmark */ = 8487D8B30C6B3851006BDD7C /* PBXTextBookmark */; 8487D8B40C6B3851006BDD7C /* PBXTextBookmark */ = 8487D8B40C6B3851006BDD7C /* PBXTextBookmark */; 848C41450B84919C00BD11B3 /* PBXTextBookmark */ = 848C41450B84919C00BD11B3 /* PBXTextBookmark */; 848C41470B84919C00BD11B3 /* PBXTextBookmark */ = 848C41470B84919C00BD11B3 /* PBXTextBookmark */; 848C414C0B84919C00BD11B3 /* PBXTextBookmark */ = 848C414C0B84919C00BD11B3 /* PBXTextBookmark */; 848C414D0B84919C00BD11B3 /* PBXTextBookmark */ = 848C414D0B84919C00BD11B3 /* PBXTextBookmark */; 848C416E0B84946E00BD11B3 /* PBXTextBookmark */ = 848C416E0B84946E00BD11B3 /* PBXTextBookmark */; 848C41AE0B84A77400BD11B3 /* PBXTextBookmark */ = 848C41AE0B84A77400BD11B3 /* PBXTextBookmark */; 848C424C0B84C97700BD11B3 /* PBXTextBookmark */ = 848C424C0B84C97700BD11B3 /* PBXTextBookmark */; 848C42570B84C97700BD11B3 /* PBXTextBookmark */ = 848C42570B84C97700BD11B3 /* PBXTextBookmark */; 848C42580B84C97700BD11B3 /* PBXTextBookmark */ = 848C42580B84C97700BD11B3 /* PBXTextBookmark */; 848C42590B84C97700BD11B3 /* PBXTextBookmark */ = 848C42590B84C97700BD11B3 /* PBXTextBookmark */; 848C425B0B84C97700BD11B3 /* PBXTextBookmark */ = 848C425B0B84C97700BD11B3 /* PBXTextBookmark */; 8491B6BD0C44CB2B00E4B477 /* PBXTextBookmark */ = 8491B6BD0C44CB2B00E4B477 /* PBXTextBookmark */; 849C6785C5B0469200F11330 /* PBXTextBookmark */ = 849C6785C5B0469200F11330 /* PBXTextBookmark */; 849C6787C5B0469200F11330 /* PBXTextBookmark */ = 849C6787C5B0469200F11330 /* PBXTextBookmark */; 849C6788C5B0469200F11330 /* PBXTextBookmark */ = 849C6788C5B0469200F11330 /* PBXTextBookmark */; 849C6797C5B0469200F11330 /* PBXTextBookmark */ = 849C6797C5B0469200F11330 /* PBXTextBookmark */; 849C6798C5B0469200F11330 /* PBXTextBookmark */ = 849C6798C5B0469200F11330 /* PBXTextBookmark */; 84A37A52C5B0A121003069A5 /* PBXTextBookmark */ = 84A37A52C5B0A121003069A5 /* PBXTextBookmark */; 84AF08E40B98819600B348CB /* PBXTextBookmark */ = 84AF08E40B98819600B348CB /* PBXTextBookmark */; 84AF08E60B98819600B348CB /* PBXTextBookmark */ = 84AF08E60B98819600B348CB /* PBXTextBookmark */; 84AF48B20BCCD4FB00C5BF0A /* PBXTextBookmark */ = 84AF48B20BCCD4FB00C5BF0A /* PBXTextBookmark */; 84AFF17D0B8C87E400D93058 /* PBXTextBookmark */ = 84AFF17D0B8C87E400D93058 /* PBXTextBookmark */; 84AFF17F0B8C87E400D93058 /* PBXTextBookmark */ = 84AFF17F0B8C87E400D93058 /* PBXTextBookmark */; 84AFF1850B8C87E400D93058 /* PBXTextBookmark */ = 84AFF1850B8C87E400D93058 /* PBXTextBookmark */; 84AFF1890B8C87E400D93058 /* PBXTextBookmark */ = 84AFF1890B8C87E400D93058 /* PBXTextBookmark */; 84AFF18A0B8C87E400D93058 /* PBXTextBookmark */ = 84AFF18A0B8C87E400D93058 /* PBXTextBookmark */; 84AFF18D0B8C87E400D93058 /* PBXTextBookmark */ = 84AFF18D0B8C87E400D93058 /* PBXTextBookmark */; 84AFF1B20B8C89CC00D93058 /* PBXTextBookmark */ = 84AFF1B20B8C89CC00D93058 /* PBXTextBookmark */; 84B0A8140B96D8B400B60726 /* PBXTextBookmark */ = 84B0A8140B96D8B400B60726 /* PBXTextBookmark */; 84B0A81D0B96D8B400B60726 /* PBXTextBookmark */ = 84B0A81D0B96D8B400B60726 /* PBXTextBookmark */; 84B0A9360B9707B000B60726 /* PBXTextBookmark */ = 84B0A9360B9707B000B60726 /* PBXTextBookmark */; 84B0AB400B973C9E00B60726 /* PBXTextBookmark */ = 84B0AB400B973C9E00B60726 /* PBXTextBookmark */; 84B18DB40BCF7EEF005360E0 /* PBXTextBookmark */ = 84B18DB40BCF7EEF005360E0 /* PBXTextBookmark */; 84B1AF9F0B94350200D477E7 /* PBXTextBookmark */ = 84B1AF9F0B94350200D477E7 /* PBXTextBookmark */; 84B1AFA50B94350200D477E7 /* PBXTextBookmark */ = 84B1AFA50B94350200D477E7 /* PBXTextBookmark */; 84B1AFA80B94350200D477E7 /* PBXTextBookmark */ = 84B1AFA80B94350200D477E7 /* PBXTextBookmark */; 84B1B0070B9465A300D477E7 /* PBXTextBookmark */ = 84B1B0070B9465A300D477E7 /* PBXTextBookmark */; 84BC71A90B959EDF00BFC169 /* PBXTextBookmark */ = 84BC71A90B959EDF00BFC169 /* PBXTextBookmark */; 84BC71AA0B959EDF00BFC169 /* PBXTextBookmark */ = 84BC71AA0B959EDF00BFC169 /* PBXTextBookmark */; 84BC71AB0B959EDF00BFC169 /* PBXTextBookmark */ = 84BC71AB0B959EDF00BFC169 /* PBXTextBookmark */; 84BC71AD0B959EDF00BFC169 /* PBXTextBookmark */ = 84BC71AD0B959EDF00BFC169 /* PBXTextBookmark */; 84BC71AE0B959EDF00BFC169 /* PBXTextBookmark */ = 84BC71AE0B959EDF00BFC169 /* PBXTextBookmark */; 84BC71B00B959EDF00BFC169 /* PBXTextBookmark */ = 84BC71B00B959EDF00BFC169 /* PBXTextBookmark */; 84BC71BE0B959EDF00BFC169 /* PBXTextBookmark */ = 84BC71BE0B959EDF00BFC169 /* PBXTextBookmark */; 84BC71BF0B959EDF00BFC169 /* PBXTextBookmark */ = 84BC71BF0B959EDF00BFC169 /* PBXTextBookmark */; 84BC71C30B959EDF00BFC169 /* PBXTextBookmark */ = 84BC71C30B959EDF00BFC169 /* PBXTextBookmark */; 84BC71C50B959EDF00BFC169 /* PBXTextBookmark */ = 84BC71C50B959EDF00BFC169 /* PBXTextBookmark */; 84BC71CB0B959EDF00BFC169 /* PBXTextBookmark */ = 84BC71CB0B959EDF00BFC169 /* PBXTextBookmark */; 84BC71CC0B959EDF00BFC169 /* PBXTextBookmark */ = 84BC71CC0B959EDF00BFC169 /* PBXTextBookmark */; 84BC721F0B95BC1100BFC169 /* PBXTextBookmark */ = 84BC721F0B95BC1100BFC169 /* PBXTextBookmark */; 84BC72210B95BC1100BFC169 /* PBXTextBookmark */ = 84BC72210B95BC1100BFC169 /* PBXTextBookmark */; 84BC730F0B95D09000BFC169 /* PBXTextBookmark */ = 84BC730F0B95D09000BFC169 /* PBXTextBookmark */; 84BC73980B95F0D000BFC169 /* PBXTextBookmark */ = 84BC73980B95F0D000BFC169 /* PBXTextBookmark */; 84BC74FA0B9604DE00BFC169 /* PBXTextBookmark */ = 84BC74FA0B9604DE00BFC169 /* PBXTextBookmark */; 84BC74FF0B9604DE00BFC169 /* PBXTextBookmark */ = 84BC74FF0B9604DE00BFC169 /* PBXTextBookmark */; 84BC75800B9610B400BFC169 /* PBXTextBookmark */ = 84BC75800B9610B400BFC169 /* PBXTextBookmark */; 84BC75900B9610B400BFC169 /* PBXTextBookmark */ = 84BC75900B9610B400BFC169 /* PBXTextBookmark */; 84BE28730BCD2B780086E6B3 /* PBXTextBookmark */ = 84BE28730BCD2B780086E6B3 /* PBXTextBookmark */; 84BE444E0B9D67F2007EF582 /* PBXTextBookmark */ = 84BE444E0B9D67F2007EF582 /* PBXTextBookmark */; 84BE44970B9D6EE7007EF582 /* PBXTextBookmark */ = 84BE44970B9D6EE7007EF582 /* PBXTextBookmark */; 84BF70560BC3D30900AB75ED /* PBXTextBookmark */ = 84BF70560BC3D30900AB75ED /* PBXTextBookmark */; 84BF70BE0BC3DAC200AB75ED /* PBXTextBookmark */ = 84BF70BE0BC3DAC200AB75ED /* PBXTextBookmark */; 84C5A4370B67B31C00A596C5 /* PBXTextBookmark */ = 84C5A4370B67B31C00A596C5 /* PBXTextBookmark */; 84C86843C5B077FA0013D2B1 /* PBXTextBookmark */ = 84C86843C5B077FA0013D2B1 /* PBXTextBookmark */; 84C86844C5B077FA0013D2B1 /* PBXTextBookmark */ = 84C86844C5B077FA0013D2B1 /* PBXTextBookmark */; 84D448D60B8EE46C008F9D1F /* PBXTextBookmark */ = 84D448D60B8EE46C008F9D1F /* PBXTextBookmark */; 84D44A870B8F44B4008F9D1F /* PBXTextBookmark */ = 84D44A870B8F44B4008F9D1F /* PBXTextBookmark */; 84D4FA460B5CCFFB0058AE41 /* PBXTextBookmark */ = 84D4FA460B5CCFFB0058AE41 /* PBXTextBookmark */; 84D4FB3F0B5CFCE50058AE41 /* PBXTextBookmark */ = 84D4FB3F0B5CFCE50058AE41 /* PBXTextBookmark */; 84D4FB5B0B5CFE640058AE41 /* PBXTextBookmark */ = 84D4FB5B0B5CFE640058AE41 /* PBXTextBookmark */; 84D4FCA60B5D15890058AE41 /* PBXTextBookmark */ = 84D4FCA60B5D15890058AE41 /* PBXTextBookmark */; 84D4FCA70B5D15890058AE41 /* PBXTextBookmark */ = 84D4FCA70B5D15890058AE41 /* PBXTextBookmark */; 84D4FE540B5D2A960058AE41 /* PBXTextBookmark */ = 84D4FE540B5D2A960058AE41 /* PBXTextBookmark */; 84D5200B0B5E19C10050DE52 /* PBXTextBookmark */ = 84D5200B0B5E19C10050DE52 /* PBXTextBookmark */; 84D520E40B5E2C1A0050DE52 /* PBXTextBookmark */ = 84D520E40B5E2C1A0050DE52 /* PBXTextBookmark */; 84D60AB30B5BB8EF00D9EBCB /* PBXTextBookmark */ = 84D60AB30B5BB8EF00D9EBCB /* PBXTextBookmark */; 84D60AB40B5BB8EF00D9EBCB /* PBXTextBookmark */ = 84D60AB40B5BB8EF00D9EBCB /* PBXTextBookmark */; 84D60ABD0B5BB8EF00D9EBCB /* PBXTextBookmark */ = 84D60ABD0B5BB8EF00D9EBCB /* PBXTextBookmark */; 84D60AC10B5BB8EF00D9EBCB /* PBXTextBookmark */ = 84D60AC10B5BB8EF00D9EBCB /* PBXTextBookmark */; 84D60AC30B5BB8EF00D9EBCB /* PBXTextBookmark */ = 84D60AC30B5BB8EF00D9EBCB /* PBXTextBookmark */; 84D60AC40B5BB8EF00D9EBCB /* PBXTextBookmark */ = 84D60AC40B5BB8EF00D9EBCB /* PBXTextBookmark */; 84D60AC90B5BB8EF00D9EBCB /* PBXTextBookmark */ = 84D60AC90B5BB8EF00D9EBCB /* PBXTextBookmark */; 84D60ACC0B5BB8EF00D9EBCB /* PBXTextBookmark */ = 84D60ACC0B5BB8EF00D9EBCB /* PBXTextBookmark */; 84D60B760B5BC12200D9EBCB /* PBXTextBookmark */ = 84D60B760B5BC12200D9EBCB /* PBXTextBookmark */; 84D60B770B5BC12200D9EBCB /* PBXTextBookmark */ = 84D60B770B5BC12200D9EBCB /* PBXTextBookmark */; 84D60BA40B5BC49500D9EBCB /* PBXTextBookmark */ = 84D60BA40B5BC49500D9EBCB /* PBXTextBookmark */; 84D60BA50B5BC49500D9EBCB /* PBXTextBookmark */ = 84D60BA50B5BC49500D9EBCB /* PBXTextBookmark */; 84D9EE150B53E20600C10970 /* PBXTextBookmark */ = 84D9EE150B53E20600C10970 /* PBXTextBookmark */; 84D9EE770B53EC5D00C10970 /* PBXTextBookmark */ = 84D9EE770B53EC5D00C10970 /* PBXTextBookmark */; 84DDE9750BB90B6B0074B26A /* PBXTextBookmark */ = 84DDE9750BB90B6B0074B26A /* PBXTextBookmark */; 84DE1A860BCCE1DA0033A95C /* PBXTextBookmark */ = 84DE1A860BCCE1DA0033A95C /* PBXTextBookmark */; 84DF556F0C3CC76F00AD2F4B /* PBXTextBookmark */ = 84DF556F0C3CC76F00AD2F4B /* PBXTextBookmark */; 84DFC45E0B64BF8200858CAB /* PBXTextBookmark */ = 84DFC45E0B64BF8200858CAB /* PBXTextBookmark */; 84DFC6550B64D26200858CAB /* PBXTextBookmark */ = 84DFC6550B64D26200858CAB /* PBXTextBookmark */; 84DFC6580B64D26200858CAB /* PBXTextBookmark */ = 84DFC6580B64D26200858CAB /* PBXTextBookmark */; 84E20C5D0C57AF7C004FB864 /* PBXTextBookmark */ = 84E20C5D0C57AF7C004FB864 /* PBXTextBookmark */; 84E8F34C0B57B4DF001DACF7 /* PBXTextBookmark */ = 84E8F34C0B57B4DF001DACF7 /* PBXTextBookmark */; 84E9145B0B564E2E009AD6FC /* PBXTextBookmark */ = 84E9145B0B564E2E009AD6FC /* PBXTextBookmark */; 84E9145E0B564E2E009AD6FC /* PBXTextBookmark */ = 84E9145E0B564E2E009AD6FC /* PBXTextBookmark */; 84F22A380B53D80F004CD709 /* PBXTextBookmark */ = 84F22A380B53D80F004CD709 /* PBXTextBookmark */; }; sourceControlManager = 84DAA48E0B132F2900222618 /* Source Control */; userBuildSettings = { OBJROOT = "/Users/admin/Projects/VS 2.1/Echoware.build"; SYMROOT = "/Users/admin/Projects/VS 2.1/Vine Server.app/Contents/Resources"; }; }; 089C167EFE841241C02AAC07 /* English */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {658, 446}}"; sepNavSelRange = "{127, 0}"; sepNavVisRect = "{{0, 0}, {658, 446}}"; sepNavWindowFrame = "{{15, 222}, {697, 519}}"; }; }; 32DBCF630370AF2F00C91783 /* Echoware_Prefix.pch */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {574, 538}}"; sepNavSelRange = "{0, 0}"; sepNavVisRect = "{{0, 0}, {574, 538}}"; sepNavWindowFrame = "{{38, 201}, {697, 519}}"; }; }; 840034180BCD0E4900D03C1B /* RFBBundleWrapper.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {744, 504}}"; sepNavSelRange = "{0, 0}"; sepNavVisRect = "{{0, 0}, {744, 461}}"; sepNavWindowFrame = "{{150, 107}, {864, 604}}"; }; }; 840034190BCD0E4900D03C1B /* RFBBundleWrapper.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {788, 8372}}"; sepNavSelRange = "{17275, 0}"; sepNavVisRect = "{{0, 5713}, {744, 461}}"; sepNavWindowFrame = "{{149, 106}, {864, 604}}"; }; }; 840034DB0BCD16CB00D03C1B /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA2F0B60F36F00FB16B3 /* CritSection.cpp */; name = "CritSection.cpp: 28"; rLen = 0; rLoc = 479; rType = 0; vrLen = 482; vrLoc = 0; }; 8400B9DF0B60F36E00FB16B3 /* ACConnection.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {896, 9212}}"; sepNavSelRange = "{17181, 0}"; sepNavVisRect = "{{0, 7112}, {744, 461}}"; sepNavWindowFrame = "{{259, 119}, {750, 558}}"; }; }; 8400B9E00B60F36E00FB16B3 /* ACConnection.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {983, 1316}}"; sepNavSelRange = "{1264, 7}"; sepNavVisRect = "{{0, 507}, {983, 316}}"; sepNavWindowFrame = "{{15, 75}, {697, 671}}"; }; }; 8400B9E10B60F36E00FB16B3 /* AES.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {744, 1134}}"; sepNavSelRange = "{92, 0}"; sepNavVisRect = "{{0, 666}, {744, 461}}"; }; }; 8400B9E40B60F36E00FB16B3 /* APISocket.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {744, 3248}}"; sepNavSelRange = "{3376, 19}"; sepNavVisRect = "{{0, 1835}, {744, 461}}"; sepNavWindowFrame = "{{167, 128}, {743, 543}}"; }; }; 8400B9E50B60F36E00FB16B3 /* ClientSocket.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {983, 966}}"; sepNavSelRange = "{336, 6}"; sepNavVisRect = "{{0, 0}, {983, 316}}"; sepNavWindowFrame = "{{167, 128}, {743, 543}}"; }; }; 8400B9E60B60F36E00FB16B3 /* ServerSocket.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {983, 1330}}"; sepNavSelRange = "{1557, 8}"; sepNavVisRect = "{{0, 1014}, {983, 316}}"; sepNavWindowFrame = "{{130, 93}, {743, 543}}"; }; }; 8400B9E70B60F36E00FB16B3 /* Socket.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {866, 7742}}"; sepNavSelRange = "{9004, 19}"; sepNavVisRect = "{{0, 6553}, {744, 461}}"; sepNavWindowFrame = "{{112, 88}, {743, 543}}"; }; }; 8400B9E80B60F36E00FB16B3 /* blowfish.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {744, 3248}}"; sepNavSelRange = "{2113, 5}"; sepNavVisRect = "{{0, 533}, {744, 461}}"; sepNavWindowFrame = "{{249, 105}, {743, 543}}"; }; }; 8400B9E90B60F36E00FB16B3 /* blowfish.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {704, 1204}}"; sepNavSelRange = "{360, 31}"; sepNavVisRect = "{{0, 0}, {704, 414}}"; sepNavWindowFrame = "{{249, 105}, {743, 543}}"; }; }; 8400BA2F0B60F36F00FB16B3 /* CritSection.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {744, 461}}"; sepNavSelRange = "{479, 0}"; sepNavVisRect = "{{0, 0}, {744, 461}}"; sepNavWindowFrame = "{{15, 70}, {743, 671}}"; }; }; 8400BA300B60F36F00FB16B3 /* CritSection.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {744, 461}}"; sepNavSelRange = "{158, 0}"; sepNavVisRect = "{{0, 0}, {744, 461}}"; sepNavWindowFrame = "{{98, 156}, {743, 543}}"; }; }; 8400BA310B60F36F00FB16B3 /* DataChannel.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {884, 3374}}"; sepNavSelRange = "{4444, 0}"; sepNavVisRect = "{{0, 2832}, {658, 542}}"; sepNavWindowFrame = "{{306, 75}, {697, 671}}"; }; }; 8400BA320B60F36F00FB16B3 /* DataChannel.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {983, 980}}"; sepNavSelRange = "{557, 18}"; sepNavVisRect = "{{0, 241}, {983, 316}}"; sepNavWindowFrame = "{{306, 75}, {697, 671}}"; }; }; 8400BA350B60F36F00FB16B3 /* DataChannels.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {824, 2954}}"; sepNavSelRange = "{4092, 24}"; sepNavVisRect = "{{0, 1}, {744, 461}}"; sepNavWindowFrame = "{{167, 128}, {743, 543}}"; }; }; 8400BA360B60F36F00FB16B3 /* DataChannels.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {983, 980}}"; sepNavSelRange = "{1113, 14}"; sepNavVisRect = "{{0, 521}, {983, 316}}"; sepNavWindowFrame = "{{343, 71}, {697, 671}}"; }; }; 8400BA370B60F36F00FB16B3 /* DataChannelSocket.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {744, 1092}}"; sepNavSelRange = "{781, 44}"; sepNavVisRect = "{{0, 393}, {744, 461}}"; sepNavWindowFrame = "{{306, 75}, {697, 671}}"; }; }; 8400BA380B60F36F00FB16B3 /* DataChannelSocket.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {744, 882}}"; sepNavSelRange = "{187, 0}"; sepNavVisRect = "{{0, 0}, {744, 461}}"; sepNavWindowFrame = "{{15, 70}, {743, 671}}"; }; }; 8400BA390B60F36F00FB16B3 /* DllProxyInfo.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {980, 2310}}"; sepNavSelRange = "{1820, 0}"; sepNavVisRect = "{{0, 627}, {746, 367}}"; sepNavWindowFrame = "{{163, 75}, {697, 519}}"; }; }; 8400BA3A0B60F36F00FB16B3 /* DllProxyInfo.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {746, 812}}"; sepNavSelRange = "{0, 0}"; sepNavVisRect = "{{0, 0}, {746, 367}}"; }; }; 8400BA3B0B60F36F00FB16B3 /* EchoController.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {825, 1232}}"; sepNavSelRange = "{185, 0}"; sepNavVisRect = "{{0, 620}, {825, 475}}"; sepNavWindowFrame = "{{276, -4}, {864, 604}}"; }; }; 8400BA3C0B60F36F00FB16B3 /* EchoController.m */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {824, 10276}}"; sepNavSelRange = "{21478, 0}"; sepNavVisRect = "{{0, 9551}, {711, 429}}"; sepNavWindowFrame = "{{84, 103}, {864, 604}}"; }; }; 8400BA3D0B60F36F00FB16B3 /* EchoSrvDataChannel.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {818, 1806}}"; sepNavSelRange = "{1057, 0}"; sepNavVisRect = "{{0, 378}, {711, 429}}"; sepNavWindowFrame = "{{259, 119}, {750, 558}}"; }; }; 8400BA3E0B60F36F00FB16B3 /* EchoSrvDataChannel.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {983, 714}}"; sepNavSelRange = "{748, 8}"; sepNavVisRect = "{{0, 325}, {983, 316}}"; sepNavWindowFrame = "{{409, 75}, {743, 671}}"; }; }; 8400BA3F0B60F36F00FB16B3 /* EchoToOSX.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {983, 1036}}"; sepNavSelRange = "{1336, 0}"; sepNavVisRect = "{{0, 737}, {983, 244}}"; sepNavWindowFrame = "{{447, 79}, {743, 543}}"; }; }; 8400BA400B60F36F00FB16B3 /* EchoToOSX.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {744, 1428}}"; sepNavSelRange = "{1514, 0}"; sepNavVisRect = "{{0, 919}, {744, 429}}"; sepNavWindowFrame = "{{15, 70}, {739, 671}}"; }; }; 8400BA410B60F36F00FB16B3 /* Echoware.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {983, 2954}}"; sepNavSelRange = "{788, 4}"; sepNavVisRect = "{{0, 311}, {983, 316}}"; sepNavWindowFrame = "{{187, 31}, {864, 604}}"; }; }; 8400BA440B60F36F00FB16B3 /* Echoware.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {810, 546}}"; sepNavSelRange = "{263, 0}"; sepNavVisRect = "{{0, 0}, {810, 323}}"; sepNavWindowFrame = "{{149, 106}, {864, 604}}"; }; }; 8400BA4C0B60F36F00FB16B3 /* Echoware_Prefix.pch */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {746, 367}}"; sepNavSelRange = "{0, 0}"; sepNavVisRect = "{{0, 0}, {746, 367}}"; }; }; 8400BA550B60F36F00FB16B3 /* Globals.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {744, 1862}}"; sepNavSelRange = "{2121, 0}"; sepNavVisRect = "{{0, 1309}, {744, 461}}"; sepNavWindowFrame = "{{84, 135}, {743, 543}}"; }; }; 8400BA560B60F36F00FB16B3 /* Globals.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {711, 2352}}"; sepNavSelRange = "{230, 0}"; sepNavVisRect = "{{0, 245}, {711, 429}}"; sepNavWindowFrame = "{{61, 156}, {743, 543}}"; }; }; 8400BA580B60F36F00FB16B3 /* InterfaceDllProxyInfo.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {744, 798}}"; sepNavSelRange = "{295, 0}"; sepNavVisRect = "{{0, 126}, {744, 429}}"; sepNavWindowFrame = "{{15, 70}, {697, 671}}"; }; }; 8400BA590B60F36F00FB16B3 /* LocalDataChannel.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {986, 2408}}"; sepNavSelRange = "{747, 0}"; sepNavVisRect = "{{0, 0}, {744, 461}}"; sepNavWindowFrame = "{{306, 75}, {697, 671}}"; }; }; 8400BA5A0B60F36F00FB16B3 /* LocalDataChannel.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {810, 560}}"; sepNavSelRange = "{724, 32}"; sepNavVisRect = "{{0, 237}, {810, 323}}"; sepNavWindowFrame = "{{15, 70}, {743, 671}}"; }; }; 8400BA5B0B60F36F00FB16B3 /* LocalListener.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {933, 546}}"; sepNavSelRange = "{423, 0}"; sepNavVisRect = "{{0, 0}, {933, 546}}"; sepNavWindowFrame = "{{38, 45}, {972, 675}}"; }; }; 8400BA5C0B60F36F00FB16B3 /* LocalListener.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {704, 542}}"; sepNavSelRange = "{328, 0}"; sepNavVisRect = "{{0, 0}, {704, 542}}"; sepNavWindowFrame = "{{15, 70}, {743, 671}}"; }; }; 8400BA5D0B60F36F00FB16B3 /* LocalProxyConnection.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {825, 475}}"; sepNavSelRange = "{177, 0}"; sepNavVisRect = "{{0, 0}, {825, 475}}"; sepNavWindowFrame = "{{15, 137}, {864, 604}}"; }; }; 8400BA5E0B60F36F00FB16B3 /* LocalProxyConnection.h */ = { uiCtxt = { sepNavWindowFrame = "{{15, 137}, {864, 604}}"; }; }; 8400BA5F0B60F36F00FB16B3 /* Logger.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {744, 1582}}"; sepNavSelRange = "{408, 0}"; sepNavVisRect = "{{0, 0}, {744, 429}}"; sepNavWindowFrame = "{{50, 188}, {750, 558}}"; }; }; 8400BA600B60F36F00FB16B3 /* Logger.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {744, 546}}"; sepNavSelRange = "{0, 0}"; sepNavVisRect = "{{0, 0}, {744, 461}}"; sepNavWindowFrame = "{{15, 137}, {864, 604}}"; }; }; 8400BA610B60F36F00FB16B3 /* MyDllProxyInfo.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {744, 1596}}"; sepNavSelRange = "{218, 0}"; sepNavVisRect = "{{0, 939}, {744, 461}}"; sepNavWindowFrame = "{{130, 93}, {743, 543}}"; }; }; 8400BA620B60F36F00FB16B3 /* MyDllProxyInfo.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {851, 588}}"; sepNavSelRange = "{272, 8}"; sepNavVisRect = "{{0, 82}, {851, 506}}"; sepNavWindowFrame = "{{15, 106}, {890, 635}}"; }; }; 8400BA630B60F36F00FB16B3 /* NetPacket.h */ = { uiCtxt = { sepNavWindowFrame = "{{15, 70}, {697, 671}}"; }; }; 8400BA650B60F36F00FB16B3 /* aes.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {704, 1820}}"; sepNavSelRange = "{2900, 0}"; sepNavVisRect = "{{0, 710}, {704, 470}}"; sepNavWindowFrame = "{{38, 177}, {743, 543}}"; }; }; 8400BA660B60F36F00FB16B3 /* aes_core.c */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {704, 17850}}"; sepNavSelRange = "{42609, 0}"; sepNavVisRect = "{{0, 12316}, {704, 470}}"; sepNavWindowFrame = "{{61, 156}, {743, 543}}"; }; }; 8400BA6C0B60F36F00FB16B3 /* ProxiesManager.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {825, 4088}}"; sepNavSelRange = "{2721, 10}"; sepNavVisRect = "{{0, 1380}, {825, 475}}"; sepNavWindowFrame = "{{150, 107}, {864, 604}}"; }; }; 8400BA6D0B60F36F00FB16B3 /* ProxiesManager.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {744, 1120}}"; sepNavSelRange = "{205, 0}"; sepNavVisRect = "{{0, 0}, {744, 461}}"; sepNavWindowFrame = "{{15, 70}, {743, 671}}"; }; }; 8400BA720B60F36F00FB16B3 /* md5.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {746, 4858}}"; sepNavSelRange = "{0, 0}"; sepNavVisRect = "{{0, 0}, {746, 367}}"; }; }; 8400BA750B60F36F00FB16B3 /* ntlmv2.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {983, 12180}}"; sepNavSelRange = "{19225, 5}"; sepNavVisRect = "{{0, 10833}, {983, 244}}"; }; }; 8400BA760B60F36F00FB16B3 /* ProxyConnect.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {983, 14266}}"; sepNavSelRange = "{5332, 5}"; sepNavVisRect = "{{0, 3517}, {983, 316}}"; sepNavWindowFrame = "{{183, 75}, {743, 671}}"; }; }; 8400BA780B60F36F00FB16B3 /* ProxyConnect.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {746, 1414}}"; sepNavSelRange = "{0, 0}"; sepNavVisRect = "{{0, 0}, {746, 367}}"; sepNavWindowFrame = "{{15, 106}, {890, 635}}"; }; }; 8400BA7B0B60F36F00FB16B3 /* stdafx.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {746, 367}}"; sepNavSelRange = "{0, 0}"; sepNavVisRect = "{{0, 0}, {746, 367}}"; }; }; 8400BA7C0B60F36F00FB16B3 /* ProxyConnection.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {983, 2240}}"; sepNavSelRange = "{3544, 24}"; sepNavVisRect = "{{0, 1924}, {983, 316}}"; sepNavWindowFrame = "{{255, 96}, {743, 543}}"; }; }; 8400BA7D0B60F36F00FB16B3 /* ProxyConnection.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {746, 714}}"; sepNavSelRange = "{185, 0}"; sepNavVisRect = "{{0, 0}, {746, 367}}"; sepNavWindowFrame = "{{15, 70}, {743, 671}}"; }; }; 8400BA870B60F36F00FB16B3 /* Hnumber.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {807, 7434}}"; sepNavSelRange = "{392, 0}"; sepNavVisRect = "{{0, 210}, {807, 239}}"; sepNavWindowFrame = "{{61, 156}, {743, 543}}"; }; }; 8400BA8A0B60F36F00FB16B3 /* Keys_main.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {744, 462}}"; sepNavSelRange = "{158, 0}"; sepNavVisRect = "{{0, 0}, {744, 461}}"; }; }; 8400BA920B60F36F00FB16B3 /* PrimeGen.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {983, 3122}}"; sepNavSelRange = "{1602, 4}"; sepNavVisRect = "{{0, 1095}, {983, 316}}"; }; }; 8400BA990B60F36F00FB16B3 /* RSAKeys.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {770, 2534}}"; sepNavSelRange = "{3200, 0}"; sepNavVisRect = "{{0, 1571}, {744, 429}}"; sepNavWindowFrame = "{{278, 149}, {743, 543}}"; }; }; 8400BA9A0B60F36F00FB16B3 /* RSAKeys.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {744, 700}}"; sepNavSelRange = "{0, 0}"; sepNavVisRect = "{{0, 0}, {744, 461}}"; }; }; 8400BA9D0B60F36F00FB16B3 /* stdafx.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {744, 429}}"; sepNavSelRange = "{295, 0}"; sepNavVisRect = "{{0, 0}, {744, 429}}"; sepNavWindowFrame = "{{15, 137}, {864, 604}}"; }; }; 8400BA9E0B60F36F00FB16B3 /* stdafx.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {744, 429}}"; sepNavSelRange = "{0, 0}"; sepNavVisRect = "{{0, 0}, {744, 429}}"; sepNavWindowFrame = "{{15, 70}, {743, 671}}"; }; }; 8400BAA00B60F36F00FB16B3 /* version.plist */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {825, 475}}"; sepNavSelRange = "{0, 0}"; sepNavVisRect = "{{0, 0}, {825, 475}}"; sepNavWindowFrame = "{{149, 106}, {864, 604}}"; }; }; 8400BEAE0B612C7C00FB16B3 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA560B60F36F00FB16B3 /* Globals.h */; name = "Globals.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 551; vrLoc = 0; }; 8418426EC5B04BFC00DC27BC /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 84AF48A40BCCD42400C5BF0A /* DirService.cpp */; name = "DirService.cpp: 5"; rLen = 0; rLoc = 55; rType = 0; vrLen = 463; vrLoc = 0; }; 84184270C5B04BFC00DC27BC /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 84AF48A40BCCD42400C5BF0A /* DirService.cpp */; name = "DirService.cpp: 5"; rLen = 0; rLoc = 55; rType = 0; vrLen = 463; vrLoc = 0; }; 841842B1C5B0606800DC27BC /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400B9E70B60F36E00FB16B3 /* Socket.cpp */; name = "Socket.cpp: 491"; rLen = 0; rLoc = 9285; rType = 0; vrLen = 668; vrLoc = 8801; }; 8420DD240BD394E900937A80 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA380B60F36F00FB16B3 /* DataChannelSocket.h */; name = "DataChannelSocket.h: 13"; rLen = 0; rLoc = 187; rType = 0; vrLen = 761; vrLoc = 0; }; 84239D390BB2A1BA00C28522 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA5F0B60F36F00FB16B3 /* Logger.cpp */; name = "Logger.cpp: 17"; rLen = 0; rLoc = 408; rType = 0; vrLen = 597; vrLoc = 0; }; 84239D3C0BB2A1BA00C28522 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA9E0B60F36F00FB16B3 /* stdafx.h */; name = "stdafx.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 173; vrLoc = 0; }; 8428A4450B984D8900F257E1 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA320B60F36F00FB16B3 /* DataChannel.h */; name = "#include \"L"; rLen = 12; rLoc = 184; rType = 0; vrLen = 606; vrLoc = 110; }; 843C1D500C3F94EB000BB087 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400B9E40B60F36E00FB16B3 /* APISocket.h */; name = "atic unsigned long"; rLen = 19; rLoc = 3426; rType = 0; vrLen = 648; vrLoc = 3105; }; 84409C610BCE2D4700A7BC33 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA6C0B60F36F00FB16B3 /* ProxiesManager.cpp */; name = "ProxiesManager.cpp: 241"; rLen = 0; rLoc = 5615; rType = 0; vrLen = 839; vrLoc = 5916; }; 84464D2F0C3A520F00064760 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA300B60F36F00FB16B3 /* CritSection.h */; name = "CritSection.h: 12"; rLen = 0; rLoc = 158; rType = 0; vrLen = 343; vrLoc = 0; }; 84464D330C3A520F00064760 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 84AFF1410B8C841D00D93058 /* ServerListSynchronize.cpp */; name = "ServerListSynchronize.cpp: 250"; rLen = 0; rLoc = 6209; rType = 0; vrLen = 973; vrLoc = 6596; }; 84464D4C0C3A523400064760 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA3D0B60F36F00FB16B3 /* EchoSrvDataChannel.cpp */; name = "EchoSrvDataChannel.cpp: 38"; rLen = 0; rLoc = 1104; rType = 0; vrLen = 962; vrLoc = 0; }; 84464E470C3A8F4900064760 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA590B60F36F00FB16B3 /* LocalDataChannel.cpp */; name = "LocalDataChannel.cpp: 32"; rLen = 0; rLoc = 747; rType = 0; vrLen = 752; vrLoc = 0; }; 844D2C290C31125500A71AF3 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA350B60F36F00FB16B3 /* DataChannels.cpp */; name = GetPortForOffLoadingData; rLen = 24; rLoc = 4092; rType = 0; vrLen = 824; vrLoc = 0; }; 8456E4D00B4C1D20006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E4D10B4C1D20006B7550 /* OSByteOrder.h */; name = "(null): 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 869; vrLoc = 2963; }; 8456E4D10B4C1D20006B7550 /* OSByteOrder.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OSByteOrder.h; path = /Developer/SDKs/MacOSX10.3.9.sdk/usr/include/libkern/ppc/OSByteOrder.h; sourceTree = ""; }; 8456E4D20B4C1D20006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E4D30B4C1D20006B7550 /* OSByteOrder.h */; name = "(null): 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 674; vrLoc = 2856; }; 8456E4D30B4C1D20006B7550 /* OSByteOrder.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OSByteOrder.h; path = /Developer/SDKs/MacOSX10.3.9.sdk/usr/include/libkern/i386/OSByteOrder.h; sourceTree = ""; }; 8456E4D70B4C1D20006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E4D80B4C1D20006B7550 /* OSByteOrder.h */; name = "(null): 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 1346; vrLoc = 0; }; 8456E4D80B4C1D20006B7550 /* OSByteOrder.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OSByteOrder.h; path = /Developer/SDKs/MacOSX10.3.9.sdk/usr/include/libkern/i386/OSByteOrder.h; sourceTree = ""; }; 8456E4D90B4C1D20006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E4DA0B4C1D20006B7550 /* OSByteOrder.h */; name = "(null): 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 869; vrLoc = 2963; }; 8456E4DA0B4C1D20006B7550 /* OSByteOrder.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OSByteOrder.h; path = /Developer/SDKs/MacOSX10.3.9.sdk/usr/include/libkern/ppc/OSByteOrder.h; sourceTree = ""; }; 8456E5290B4C22C7006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E52A0B4C22C7006B7550 /* endian.h */; name = "(null): 101"; rLen = 0; rLoc = 3927; rType = 0; vrLen = 971; vrLoc = 3502; }; 8456E52A0B4C22C7006B7550 /* endian.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = endian.h; path = /Developer/SDKs/MacOSX10.3.9.sdk/usr/include/i386/endian.h; sourceTree = ""; }; 8456E52D0B4C22C7006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E52E0B4C22C7006B7550 /* endian.h */; name = "(null): 101"; rLen = 0; rLoc = 3927; rType = 0; vrLen = 971; vrLoc = 3502; }; 8456E52E0B4C22C7006B7550 /* endian.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = endian.h; path = /Developer/SDKs/MacOSX10.3.9.sdk/usr/include/i386/endian.h; sourceTree = ""; }; 8456E5570B4CFD3B006B7550 /* MacTypes.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MacTypes.h; path = /Developer/SDKs/MacOSX10.3.9.sdk/System/Library/Frameworks/CoreServices.framework/Headers/../Frameworks/CarbonCore.framework/Headers/MacTypes.h; sourceTree = ""; }; 8456E7040B4D0EC2006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E7050B4D0EC2006B7550 /* CoreFoundation.h */; name = "(null): 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 775; vrLoc = 0; }; 8456E7050B4D0EC2006B7550 /* CoreFoundation.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CoreFoundation.h; path = /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h; sourceTree = ""; }; 8456E7060B4D0EC2006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E7070B4D0EC2006B7550 /* CFXMLNode.h */; name = "(null): 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 1825; vrLoc = 0; }; 8456E7070B4D0EC2006B7550 /* CFXMLNode.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CFXMLNode.h; path = /System/Library/Frameworks/CoreFoundation.framework/Headers/CFXMLNode.h; sourceTree = ""; }; 8456E7080B4D0EC2006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E7090B4D0EC2006B7550 /* CFTimeZone.h */; name = "(null): 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 810; vrLoc = 0; }; 8456E7090B4D0EC2006B7550 /* CFTimeZone.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CFTimeZone.h; path = /System/Library/Frameworks/CoreFoundation.framework/Headers/CFTimeZone.h; sourceTree = ""; }; 8456E70A0B4D0EC2006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E70B0B4D0EC2006B7550 /* CFBag.h */; name = "(null): 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 1167; vrLoc = 0; }; 8456E70B0B4D0EC2006B7550 /* CFBag.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CFBag.h; path = /System/Library/Frameworks/CoreFoundation.framework/Headers/CFBag.h; sourceTree = ""; }; 8456E70C0B4D0EC2006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E70D0B4D0EC2006B7550 /* CFBinaryHeap.h */; name = "(null): 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 1344; vrLoc = 0; }; 8456E70D0B4D0EC2006B7550 /* CFBinaryHeap.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CFBinaryHeap.h; path = /System/Library/Frameworks/CoreFoundation.framework/Headers/CFBinaryHeap.h; sourceTree = ""; }; 8456E70F0B4D0EC2006B7550 /* CFData.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CFData.h; path = /System/Library/Frameworks/CoreFoundation.framework/Headers/CFData.h; sourceTree = ""; }; 8456E7110B4D0EC2006B7550 /* CFStream.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CFStream.h; path = /System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h; sourceTree = ""; }; 8456E7130B4D0EC2006B7550 /* CFRunLoop.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CFRunLoop.h; path = /System/Library/Frameworks/CoreFoundation.framework/Headers/CFRunLoop.h; sourceTree = ""; }; 8456E7150B4D0EC2006B7550 /* CFPlugInCOM.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CFPlugInCOM.h; path = /System/Library/Frameworks/CoreFoundation.framework/Headers/CFPlugInCOM.h; sourceTree = ""; }; 8456E7170B4D0EC2006B7550 /* CFNumberFormatter.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CFNumberFormatter.h; path = /System/Library/Frameworks/CoreFoundation.framework/Headers/CFNumberFormatter.h; sourceTree = ""; }; 8456E7190B4D0EC2006B7550 /* CFAttributedString.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CFAttributedString.h; path = /System/Library/Frameworks/CoreFoundation.framework/Headers/CFAttributedString.h; sourceTree = ""; }; 8456E71A0B4D0EC2006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E71B0B4D0EC2006B7550 /* CFCalendar.h */; name = "(null): 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 1160; vrLoc = 0; }; 8456E71B0B4D0EC2006B7550 /* CFCalendar.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CFCalendar.h; path = /System/Library/Frameworks/CoreFoundation.framework/Headers/CFCalendar.h; sourceTree = ""; }; 8456E71C0B4D0EC2006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E71D0B4D0EC2006B7550 /* CFMachPort.h */; name = "(null): 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 1463; vrLoc = 0; }; 8456E71D0B4D0EC2006B7550 /* CFMachPort.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CFMachPort.h; path = /System/Library/Frameworks/CoreFoundation.framework/Headers/CFMachPort.h; sourceTree = ""; }; 8456E71E0B4D0EC2006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744A6F09968B340046F588 /* NetPacket.h */; name = "NetPacket.h: 66"; rLen = 0; rLoc = 1569; rType = 0; vrLen = 1003; vrLoc = 0; }; 8456E71F0B4D0EC2006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744A4E09968B340046F588 /* ACConnection.cpp */; name = "ACConnection.cpp: 10"; rLen = 0; rLoc = 208; rType = 0; vrLen = 905; vrLoc = 0; }; 8456E7200B4D0EC2006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E5570B4CFD3B006B7550 /* MacTypes.h */; name = "TimeBase base; /* reference to the time base */"; rLen = 78; rLoc = 20972; rType = 0; vrLen = 1624; vrLoc = 20028; }; 8456E7210B4D0EC2006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 32DBCF630370AF2F00C91783 /* Echoware_Prefix.pch */; name = "//"; rLen = 3; rLoc = 0; rType = 0; vrLen = 148; vrLoc = 0; }; 8456E7230B4D0EC2006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E7240B4D0EC2006B7550 /* CoreFoundation.h */; name = "(null): 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 775; vrLoc = 0; }; 8456E7240B4D0EC2006B7550 /* CoreFoundation.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CoreFoundation.h; path = /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h; sourceTree = ""; }; 8456E7250B4D0EC2006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E7260B4D0EC2006B7550 /* CFXMLNode.h */; name = "(null): 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 1825; vrLoc = 0; }; 8456E7260B4D0EC2006B7550 /* CFXMLNode.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CFXMLNode.h; path = /System/Library/Frameworks/CoreFoundation.framework/Headers/CFXMLNode.h; sourceTree = ""; }; 8456E7270B4D0EC2006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E7280B4D0EC2006B7550 /* CFTimeZone.h */; name = "(null): 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 810; vrLoc = 0; }; 8456E7280B4D0EC2006B7550 /* CFTimeZone.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CFTimeZone.h; path = /System/Library/Frameworks/CoreFoundation.framework/Headers/CFTimeZone.h; sourceTree = ""; }; 8456E7290B4D0EC2006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E72A0B4D0EC2006B7550 /* CFBag.h */; name = "(null): 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 1167; vrLoc = 0; }; 8456E72A0B4D0EC2006B7550 /* CFBag.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CFBag.h; path = /System/Library/Frameworks/CoreFoundation.framework/Headers/CFBag.h; sourceTree = ""; }; 8456E72B0B4D0EC2006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E72C0B4D0EC2006B7550 /* CFBinaryHeap.h */; name = "(null): 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 1344; vrLoc = 0; }; 8456E72C0B4D0EC2006B7550 /* CFBinaryHeap.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CFBinaryHeap.h; path = /System/Library/Frameworks/CoreFoundation.framework/Headers/CFBinaryHeap.h; sourceTree = ""; }; 8456E72D0B4D0EC2006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E72E0B4D0EC2006B7550 /* CFCalendar.h */; name = "(null): 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 1160; vrLoc = 0; }; 8456E72E0B4D0EC2006B7550 /* CFCalendar.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CFCalendar.h; path = /System/Library/Frameworks/CoreFoundation.framework/Headers/CFCalendar.h; sourceTree = ""; }; 8456E7BC0B4D1B38006B7550 /* libkern.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = libkern.h; path = /Developer/SDKs/MacOSX10.3.9.sdk/usr/include/libkern/libkern.h; sourceTree = ""; }; 8456E86F0B4E88C3006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E5570B4CFD3B006B7550 /* MacTypes.h */; name = "MacTypes.h: 504"; rLen = 0; rLoc = 21014; rType = 0; vrLen = 1768; vrLoc = 19789; }; 8456E8700B4E88C3006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E7190B4D0EC2006B7550 /* CFAttributedString.h */; name = "CFAttributedString.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 1735; vrLoc = 24; }; 8456E8710B4E88C3006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E7170B4D0EC2006B7550 /* CFNumberFormatter.h */; name = "CFNumberFormatter.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 1215; vrLoc = 0; }; 8456E8720B4E88C3006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E7150B4D0EC2006B7550 /* CFPlugInCOM.h */; name = "CFPlugInCOM.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 1361; vrLoc = 0; }; 8456E8730B4E88C3006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E7130B4D0EC2006B7550 /* CFRunLoop.h */; name = "CFRunLoop.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 1941; vrLoc = 0; }; 8456E8740B4E88C3006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E7110B4D0EC2006B7550 /* CFStream.h */; name = "CFStream.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 1164; vrLoc = 0; }; 8456E8750B4E88C3006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E70F0B4D0EC2006B7550 /* CFData.h */; name = "CFData.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 1054; vrLoc = 0; }; 8456E8770B4E88C3006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E7BC0B4D1B38006B7550 /* libkern.h */; name = "min(u_int a, u_int b)"; rLen = 22; rLoc = 3708; rType = 0; vrLen = 2243; vrLoc = 524; }; 8456E87A0B4E88C3006B7550 /* CFByteOrder.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CFByteOrder.h; path = /System/Library/Frameworks/CoreFoundation.framework/Headers/CFByteOrder.h; sourceTree = ""; }; 8456E87B0B4E88C3006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E70F0B4D0EC2006B7550 /* CFData.h */; name = "CFData.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 1054; vrLoc = 0; }; 8456E87C0B4E88C3006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744A6309968B340046F588 /* Echoware.h */; name = "Echoware.h: ConnectProxy"; rLen = 0; rLoc = 540; rType = 0; vrLen = 959; vrLoc = 0; }; 8456E87D0B4E88C3006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E7BC0B4D1B38006B7550 /* libkern.h */; name = "min(u_int a, u_int b)"; rLen = 22; rLoc = 3708; rType = 0; vrLen = 2243; vrLoc = 524; }; 8456E9090B4E956F006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E87A0B4E88C3006B7550 /* CFByteOrder.h */; name = "CFByteOrder.h: 23"; rLen = 0; rLoc = 516; rType = 0; vrLen = 1042; vrLoc = 0; }; 8456E90A0B4E956F006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8456E87A0B4E88C3006B7550 /* CFByteOrder.h */; name = "CFByteOrder.h: 23"; rLen = 0; rLoc = 516; rType = 0; vrLen = 1042; vrLoc = 0; }; 8456E95E0B4EA7D1006B7550 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744A6009968B340046F588 /* EchoSrvDataChannel.cpp */; name = "EchoSrvDataChannel.cpp: 69"; rLen = 0; rLoc = 1778; rType = 0; vrLen = 871; vrLoc = 1388; }; 8460E80A0B8469BA009E0CB5 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA600B60F36F00FB16B3 /* Logger.h */; name = "Logger.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 544; vrLoc = 0; }; 8460E80B0B8469BA009E0CB5 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA5F0B60F36F00FB16B3 /* Logger.cpp */; name = "Logger.cpp: CLogger"; rLen = 0; rLoc = 190; rType = 0; vrLen = 533; vrLoc = 0; }; 847EA4B40BDDEC2B005AC757 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA600B60F36F00FB16B3 /* Logger.h */; name = "Logger.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 724; vrLoc = 0; }; 847EA4B60BDDEC2B005AC757 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA410B60F36F00FB16B3 /* Echoware.cpp */; name = "Echoware.cpp: 14"; rLen = 0; rLoc = 380; rType = 0; vrLen = 721; vrLoc = 203; }; 847EA4FB0BDDF714005AC757 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA560B60F36F00FB16B3 /* Globals.h */; name = "Globals.h: 15"; rLen = 0; rLoc = 230; rType = 0; vrLen = 648; vrLoc = 0; }; 847EA4FC0BDDF714005AC757 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA440B60F36F00FB16B3 /* Echoware.h */; name = "Echoware.h: EnableLogging"; rLen = 0; rLoc = 263; rType = 0; vrLen = 1050; vrLoc = 0; }; 847EA4FD0BDDF714005AC757 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 84AFF1400B8C841D00D93058 /* ServerListSynchronize.h */; name = "ServerListSynchronize.h: 41"; rLen = 0; rLoc = 775; rType = 0; vrLen = 788; vrLoc = 519; }; 8480D0BC0B5F8D200030E8C0 /* Vine Server 2.1 */ = { isa = PBXExecutable; activeArgIndex = 2147483647; activeArgIndices = ( ); argumentStrings = ( ); autoAttachOnCrash = 1; configStateDict = { }; customDataFormattersEnabled = 1; debuggerPlugin = GDBDebugging; disassemblyDisplayState = 0; dylibVariantSuffix = ""; enableDebugStr = 1; environmentEntries = ( ); executableSystemSymbolLevel = 0; executableUserSymbolLevel = 0; launchableReference = 8480D0BD0B5F8D200030E8C0 /* Vine Server.app */; libgmallocEnabled = 0; name = "Vine Server 2.1"; savedGlobals = { }; sourceDirectories = ( ); variableFormatDictionary = { $cs = 1; $ds = 1; $eax = 1; $ebp = 1; $ebx = 1; $ecx = 1; $edi = 1; $edx = 1; $eflags = 1; $eip = 1; $es = 1; $esi = 1; $esp = 1; $gs = 1; $mm0 = 1; $mm1 = 1; $mm2 = 1; $mm3 = 1; $mm4 = 1; $mm5 = 1; $mm6 = 1; $mm7 = 1; $mxcsr = 1; $ss = 1; $xmm0 = 1; $xmm1 = 1; $xmm2 = 1; $xmm3 = 1; $xmm4 = 1; $xmm5 = 1; $xmm6 = 1; $xmm7 = 1; }; }; 8480D0BD0B5F8D200030E8C0 /* Vine Server.app */ = { isa = PBXFileReference; explicitFileType = wrapper.application; name = "Vine Server.app"; path = "/Users/admin/Projects/VS 2.1/Vine Server.app"; sourceTree = ""; }; 8487D8910C6B307D006BDD7C /* PBXBookmark */ = { isa = PBXBookmark; fRef = 8400BA3C0B60F36F00FB16B3 /* EchoController.m */; }; 8487D8A10C6B37E3006BDD7C /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA550B60F36F00FB16B3 /* Globals.cpp */; name = "Globals.cpp: 111"; rLen = 0; rLoc = 2121; rType = 0; vrLen = 946; vrLoc = 1684; }; 8487D8A20C6B37E3006BDD7C /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400B9DF0B60F36E00FB16B3 /* ACConnection.cpp */; name = "ACConnection.cpp: 550"; rLen = 0; rLoc = 17181; rType = 0; vrLen = 1002; vrLoc = 15841; }; 8487D8A30C6B37E3006BDD7C /* PBXTextBookmark */ = { isa = PBXTextBookmark; comments = "error: expected ',' or ';' before 'if'"; fRef = 8400BA3C0B60F36F00FB16B3 /* EchoController.m */; rLen = 1; rLoc = 710; rType = 1; }; 8487D8A40C6B37E3006BDD7C /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA550B60F36F00FB16B3 /* Globals.cpp */; name = "Globals.cpp: 111"; rLen = 0; rLoc = 2121; rType = 0; vrLen = 946; vrLoc = 1684; }; 8487D8A50C6B37E3006BDD7C /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400B9DF0B60F36E00FB16B3 /* ACConnection.cpp */; name = "ACConnection.cpp: 550"; rLen = 0; rLoc = 17181; rType = 0; vrLen = 1002; vrLoc = 15841; }; 8487D8A90C6B37E3006BDD7C /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA3D0B60F36F00FB16B3 /* EchoSrvDataChannel.cpp */; name = "EchoSrvDataChannel.cpp: 37"; rLen = 0; rLoc = 1057; rType = 0; vrLen = 853; vrLoc = 760; }; 8487D8AA0C6B37E3006BDD7C /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400B9DF0B60F36E00FB16B3 /* ACConnection.cpp */; name = "ACConnection.cpp: 345"; rLen = 0; rLoc = 10364; rType = 0; vrLen = 1173; vrLoc = 9811; }; 8487D8AB0C6B37E3006BDD7C /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA3D0B60F36F00FB16B3 /* EchoSrvDataChannel.cpp */; name = "EchoSrvDataChannel.cpp: 37"; rLen = 0; rLoc = 1057; rType = 0; vrLen = 853; vrLoc = 760; }; 8487D8AC0C6B37E3006BDD7C /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400B9DF0B60F36E00FB16B3 /* ACConnection.cpp */; name = "ACConnection.cpp: 345"; rLen = 0; rLoc = 10364; rType = 0; vrLen = 1173; vrLoc = 9811; }; 8487D8B30C6B3851006BDD7C /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA3C0B60F36F00FB16B3 /* EchoController.m */; name = "EchoController.m: 381"; rLen = 0; rLoc = 11082; rType = 0; vrLen = 1105; vrLoc = 11010; }; 8487D8B40C6B3851006BDD7C /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA3C0B60F36F00FB16B3 /* EchoController.m */; name = "EchoController.m: 714"; rLen = 0; rLoc = 21478; rType = 0; vrLen = 1148; vrLoc = 20315; }; 848C411E0B848FDC00BD11B3 /* rfbserver.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {810, 630}}"; sepNavSelRange = "{272, 0}"; sepNavVisRect = "{{0, 57}, {810, 323}}"; sepNavWindowFrame = "{{15, 70}, {739, 671}}"; }; }; 848C411F0B848FDC00BD11B3 /* rfbserver.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {746, 367}}"; sepNavSelRange = "{0, 0}"; sepNavVisRect = "{{0, 0}, {746, 367}}"; sepNavWindowFrame = "{{15, 70}, {739, 671}}"; }; }; 848C41450B84919C00BD11B3 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 848C411F0B848FDC00BD11B3 /* rfbserver.cpp */; name = "rfbserver.cpp: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 161; vrLoc = 0; }; 848C41470B84919C00BD11B3 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA310B60F36F00FB16B3 /* DataChannel.cpp */; name = "DataChannel.cpp: 129"; rLen = 0; rLoc = 3338; rType = 0; vrLen = 866; vrLoc = 3315; }; 848C414C0B84919C00BD11B3 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 848C411E0B848FDC00BD11B3 /* rfbserver.h */; name = "rfbserver.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 488; vrLoc = 0; }; 848C414D0B84919C00BD11B3 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 848C411F0B848FDC00BD11B3 /* rfbserver.cpp */; name = "rfbserver.cpp: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 161; vrLoc = 0; }; 848C416E0B84946E00BD11B3 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 848C411E0B848FDC00BD11B3 /* rfbserver.h */; name = "CGKeyCode *keyTable;"; rLen = 25; rLoc = 709; rType = 0; vrLen = 469; vrLoc = 339; }; 848C41AE0B84A77400BD11B3 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA320B60F36F00FB16B3 /* DataChannel.h */; name = "DataChannel.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 551; vrLoc = 0; }; 848C424C0B84C97700BD11B3 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744A6C09968B340046F588 /* LocalProxyConnection.h */; name = "LocalProxyConnection.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 274; vrLoc = 0; }; 848C42570B84C97700BD11B3 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744A6709968B340046F588 /* LocalDataChannel.cpp */; name = "LocalDataChannel.cpp: ~CLocalDataChannel"; rLen = 0; rLoc = 406; rType = 0; vrLen = 522; vrLoc = 3026; }; 848C42580B84C97700BD11B3 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744A6809968B340046F588 /* LocalDataChannel.h */; name = "LocalDataChannel.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 573; vrLoc = 0; }; 848C42590B84C97700BD11B3 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744A6C09968B340046F588 /* LocalProxyConnection.h */; name = "LocalProxyConnection.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 274; vrLoc = 0; }; 848C425B0B84C97700BD11B3 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400B9E50B60F36E00FB16B3 /* ClientSocket.cpp */; name = "ClientSocket.cpp: 178"; rLen = 0; rLoc = 1383; rType = 0; vrLen = 0; vrLoc = 1331; }; 8491B6BD0C44CB2B00E4B477 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400B9E70B60F36E00FB16B3 /* Socket.cpp */; name = "m_csAsync.Lock();"; rLen = 19; rLoc = 9004; rType = 0; vrLen = 726; vrLoc = 8689; }; 849C6785C5B0469200F11330 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA560B60F36F00FB16B3 /* Globals.h */; name = "Globals.h: 15"; rLen = 0; rLoc = 230; rType = 0; vrLen = 640; vrLoc = 311; }; 849C6787C5B0469200F11330 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400B9DF0B60F36E00FB16B3 /* ACConnection.cpp */; name = "ACConnection.cpp: 352"; rLen = 0; rLoc = 10666; rType = 0; vrLen = 1011; vrLoc = 9996; }; 849C6788C5B0469200F11330 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA560B60F36F00FB16B3 /* Globals.h */; name = "Globals.h: 15"; rLen = 0; rLoc = 230; rType = 0; vrLen = 640; vrLoc = 311; }; 849C6797C5B0469200F11330 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 840034190BCD0E4900D03C1B /* RFBBundleWrapper.cpp */; name = "RFBBundleWrapper.cpp: 425"; rLen = 0; rLoc = 17275; rType = 0; vrLen = 1389; vrLoc = 16529; }; 849C6798C5B0469200F11330 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 840034190BCD0E4900D03C1B /* RFBBundleWrapper.cpp */; name = "RFBBundleWrapper.cpp: 425"; rLen = 0; rLoc = 17275; rType = 0; vrLen = 1389; vrLoc = 16529; }; 84A37A52C5B0A121003069A5 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400B9E80B60F36E00FB16B3 /* blowfish.cpp */; name = PArr; rLen = 5; rLoc = 2113; rType = 0; vrLen = 934; vrLoc = 948; }; 84AF08E40B98819600B348CB /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400B9E50B60F36E00FB16B3 /* ClientSocket.cpp */; name = "ClientSocket.cpp: 48"; rLen = 0; rLoc = 979; rType = 0; vrLen = 675; vrLoc = 708; }; 84AF08E60B98819600B348CB /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400B9E00B60F36E00FB16B3 /* ACConnection.h */; name = "ACConnection.h: 19"; rLen = 0; rLoc = 310; rType = 0; vrLen = 552; vrLoc = 0; }; 84AF48A30BCCD42400C5BF0A /* DirService.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {691, 546}}"; sepNavSelRange = "{207, 18}"; sepNavVisRect = "{{0, 0}, {691, 435}}"; sepNavWindowFrame = "{{174, 42}, {864, 703}}"; }; }; 84AF48A40BCCD42400C5BF0A /* DirService.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1124, 5950}}"; sepNavSelRange = "{55, 0}"; sepNavVisRect = "{{0, 0}, {744, 461}}"; sepNavWindowFrame = "{{78, 42}, {864, 703}}"; }; }; 84AF48B20BCCD4FB00C5BF0A /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 84AF48A30BCCD42400C5BF0A /* DirService.h */; name = "DirService.h: 5"; rLen = 0; rLoc = 46; rType = 0; vrLen = 164; vrLoc = 0; }; 84AF49000BCCD76E00C5BF0A /* User.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {744, 630}}"; sepNavSelRange = "{0, 0}"; sepNavVisRect = "{{0, 0}, {744, 461}}"; sepNavWindowFrame = "{{170, 142}, {864, 604}}"; }; }; 84AF49010BCCD76E00C5BF0A /* User.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1028, 1862}}"; sepNavSelRange = "{0, 0}"; sepNavVisRect = "{{0, 0}, {744, 461}}"; sepNavWindowFrame = "{{102, 43}, {864, 703}}"; }; }; 84AFF1400B8C841D00D93058 /* ServerListSynchronize.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {744, 840}}"; sepNavSelRange = "{775, 0}"; sepNavVisRect = "{{0, 379}, {744, 461}}"; sepNavWindowFrame = "{{150, 107}, {864, 604}}"; }; }; 84AFF1410B8C841D00D93058 /* ServerListSynchronize.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {842, 5348}}"; sepNavSelRange = "{8843, 0}"; sepNavVisRect = "{{0, 4678}, {711, 429}}"; sepNavWindowFrame = "{{306, 75}, {697, 671}}"; }; }; 84AFF17D0B8C87E400D93058 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA570B60F36F00FB16B3 /* Info.plist */; name = "Info.plist: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 718; vrLoc = 0; }; 84AFF17F0B8C87E400D93058 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA3A0B60F36F00FB16B3 /* DllProxyInfo.h */; name = "DllProxyInfo.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 518; vrLoc = 0; }; 84AFF1850B8C87E400D93058 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400B9E40B60F36E00FB16B3 /* APISocket.h */; name = StopSend; rLen = 8; rLoc = 3858; rType = 0; vrLen = 551; vrLoc = 3590; }; 84AFF1890B8C87E400D93058 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA570B60F36F00FB16B3 /* Info.plist */; name = "Info.plist: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 718; vrLoc = 0; }; 84AFF18A0B8C87E400D93058 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 84AFF1400B8C841D00D93058 /* ServerListSynchronize.h */; name = "ServerListSynchronize.h: 11"; rLen = 0; rLoc = 174; rType = 0; vrLen = 583; vrLoc = 0; }; 84AFF18D0B8C87E400D93058 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 84AFF1410B8C841D00D93058 /* ServerListSynchronize.cpp */; name = "ServerListSynchronize.cpp: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 600; vrLoc = 0; }; 84AFF1B20B8C89CC00D93058 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA4C0B60F36F00FB16B3 /* Echoware_Prefix.pch */; name = "Echoware_Prefix.pch: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 148; vrLoc = 0; }; 84B0A8140B96D8B400B60726 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400B9EA0B60F36E00FB16B3 /* blowfish.h2 */; name = "blowfish.h2: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 1230; vrLoc = 0; }; 84B0A81D0B96D8B400B60726 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400B9EA0B60F36E00FB16B3 /* blowfish.h2 */; name = "blowfish.h2: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 1230; vrLoc = 0; }; 84B0A9360B9707B000B60726 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA7D0B60F36F00FB16B3 /* ProxyConnection.h */; name = "ProxyConnection.h: 14"; rLen = 0; rLoc = 185; rType = 0; vrLen = 480; vrLoc = 0; }; 84B0AB400B973C9E00B60726 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA760B60F36F00FB16B3 /* ProxyConnect.cpp */; name = "ProxyConnect.cpp: 206"; rLen = 0; rLoc = 4183; rType = 0; vrLen = 399; vrLoc = 4019; }; 84B18DB40BCF7EEF005360E0 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA7C0B60F36F00FB16B3 /* ProxyConnection.cpp */; name = "ProxyConnection.cpp: 26"; rLen = 0; rLoc = 517; rType = 0; vrLen = 920; vrLoc = 2710; }; 84B1AF9F0B94350200D477E7 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA5A0B60F36F00FB16B3 /* LocalDataChannel.h */; name = "LocalDataChannel.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 573; vrLoc = 0; }; 84B1AFA50B94350200D477E7 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA370B60F36F00FB16B3 /* DataChannelSocket.cpp */; name = "DataChannelSocket.cpp: 68"; rLen = 0; rLoc = 1322; rType = 0; vrLen = 581; vrLoc = 978; }; 84B1AFA80B94350200D477E7 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA380B60F36F00FB16B3 /* DataChannelSocket.h */; name = "DataChannelSocket.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 614; vrLoc = 0; }; 84B1B0070B9465A300D477E7 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA9E0B60F36F00FB16B3 /* stdafx.h */; name = "stdafx.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 173; vrLoc = 0; }; 84BC718E0B959CCB00BFC169 /* OpenTransportProviders.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OpenTransportProviders.h; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OpenTransportProviders.h; sourceTree = ""; }; 84BC71A90B959EDF00BFC169 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA7B0B60F36F00FB16B3 /* stdafx.h */; name = "stdafx.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 330; vrLoc = 0; }; 84BC71AA0B959EDF00BFC169 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA780B60F36F00FB16B3 /* ProxyConnect.h */; name = "ProxyConnect.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 579; vrLoc = 0; }; 84BC71AB0B959EDF00BFC169 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA770B60F36F00FB16B3 /* ProxyConnect.dsp */; name = "ProxyConnect.dsp: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 1009; vrLoc = 0; }; 84BC71AD0B959EDF00BFC169 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA720B60F36F00FB16B3 /* md5.cpp */; name = "md5.cpp: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 996; vrLoc = 0; }; 84BC71AE0B959EDF00BFC169 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 84D520B90B5E27CD0050DE52 /* NSObjCRuntime.h */; name = "@class NSString;"; rLen = 17; rLoc = 1535; rType = 0; vrLen = 1062; vrLoc = 1134; }; 84BC71B00B959EDF00BFC169 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 84BC718E0B959CCB00BFC169 /* OpenTransportProviders.h */; name = "TCP_NODELAY = 0x01,"; rLen = 40; rLoc = 2260; rType = 0; vrLen = 931; vrLoc = 2059; }; 84BC71BE0B959EDF00BFC169 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA780B60F36F00FB16B3 /* ProxyConnect.h */; name = "ProxyConnect.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 579; vrLoc = 0; }; 84BC71BF0B959EDF00BFC169 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA7B0B60F36F00FB16B3 /* stdafx.h */; name = "stdafx.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 330; vrLoc = 0; }; 84BC71C30B959EDF00BFC169 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA770B60F36F00FB16B3 /* ProxyConnect.dsp */; name = "ProxyConnect.dsp: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 1009; vrLoc = 0; }; 84BC71C50B959EDF00BFC169 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA720B60F36F00FB16B3 /* md5.cpp */; name = "md5.cpp: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 996; vrLoc = 0; }; 84BC71CB0B959EDF00BFC169 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA300B60F36F00FB16B3 /* CritSection.h */; name = "CritSection.h: 8"; rLen = 0; rLoc = 89; rType = 0; vrLen = 343; vrLoc = 0; }; 84BC71CC0B959EDF00BFC169 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 84BC718E0B959CCB00BFC169 /* OpenTransportProviders.h */; name = "TCP_NODELAY = 0x01,"; rLen = 40; rLoc = 2260; rType = 0; vrLen = 931; vrLoc = 2059; }; 84BC71E40B95A00F00BFC169 /* CFRunLoop.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CFRunLoop.h; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFRunLoop.h; sourceTree = ""; }; 84BC721F0B95BC1100BFC169 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 84BC71E40B95A00F00BFC169 /* CFRunLoop.h */; name = "CFRunLoop.h: 344"; rLen = 0; rLoc = 13964; rType = 0; vrLen = 951; vrLoc = 13650; }; 84BC72210B95BC1100BFC169 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 84BC71E40B95A00F00BFC169 /* CFRunLoop.h */; name = "CFRunLoop.h: 344"; rLen = 0; rLoc = 13964; rType = 0; vrLen = 951; vrLoc = 13650; }; 84BC730F0B95D09000BFC169 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400B9E60B60F36E00FB16B3 /* ServerSocket.cpp */; name = "ServerSocket.cpp: 25"; rLen = 0; rLoc = 403; rType = 0; vrLen = 561; vrLoc = 880; }; 84BC73980B95F0D000BFC169 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA390B60F36F00FB16B3 /* DllProxyInfo.cpp */; name = "DllProxyInfo.cpp: 92"; rLen = 0; rLoc = 1820; rType = 0; vrLen = 500; vrLoc = 801; }; 84BC744A0B95FDC800BFC169 /* limits */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = limits; path = "/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/limits"; sourceTree = ""; }; 84BC74FA0B9604DE00BFC169 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 84BC744A0B95FDC800BFC169 /* limits */; name = "static _Tp min() throw() { return static_cast<_Tp>(0); }"; rLen = 63; rLoc = 10942; rType = 0; vrLen = 1390; vrLoc = 10448; }; 84BC74FF0B9604DE00BFC169 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 84BC744A0B95FDC800BFC169 /* limits */; name = "static _Tp min() throw() { return static_cast<_Tp>(0); }"; rLen = 63; rLoc = 10942; rType = 0; vrLen = 1390; vrLoc = 10448; }; 84BC75800B9610B400BFC169 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA360B60F36F00FB16B3 /* DataChannels.h */; name = "DataChannels.h: 49"; rLen = 0; rLoc = 1214; rType = 0; vrLen = 643; vrLoc = 1007; }; 84BC75900B9610B400BFC169 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA7D0B60F36F00FB16B3 /* ProxyConnection.h */; name = "ProxyConnection.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 506; vrLoc = 0; }; 84BE28730BCD2B780086E6B3 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA6D0B60F36F00FB16B3 /* ProxiesManager.h */; name = "ProxiesManager.h: 13"; rLen = 0; rLoc = 205; rType = 0; vrLen = 775; vrLoc = 0; }; 84BE444E0B9D67F2007EF582 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA580B60F36F00FB16B3 /* InterfaceDllProxyInfo.h */; name = "InterfaceDllProxyInfo.h: STATUS_AUTHENTICATING"; rLen = 0; rLoc = 295; rType = 0; vrLen = 813; vrLoc = 135; }; 84BE44970B9D6EE7007EF582 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA990B60F36F00FB16B3 /* RSAKeys.cpp */; name = "RSAKeys.cpp: 135"; rLen = 0; rLoc = 3200; rType = 0; vrLen = 775; vrLoc = 2653; }; 84BF70560BC3D30900AB75ED /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA3E0B60F36F00FB16B3 /* EchoSrvDataChannel.h */; name = "EchoSrvDataChannel.h: 30"; rLen = 0; rLoc = 685; rType = 0; vrLen = 775; vrLoc = 104; }; 84BF70BE0BC3DAC200AB75ED /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA400B60F36F00FB16B3 /* EchoToOSX.h */; name = "EchoToOSX.h: GetTickCount"; rLen = 0; rLoc = 1512; rType = 0; vrLen = 738; vrLoc = 1238; }; 84C5A4370B67B31C00A596C5 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400B9E80B60F36E00FB16B3 /* blowfish.cpp */; name = Xr; rLen = 5; rLoc = 2113; rType = 0; vrLen = 762; vrLoc = 1076; }; 84C86843C5B077FA0013D2B1 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA310B60F36F00FB16B3 /* DataChannel.cpp */; name = "DataChannel.cpp: 164"; rLen = 0; rLoc = 4451; rType = 0; vrLen = 810; vrLoc = 4235; }; 84C86844C5B077FA0013D2B1 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA3B0B60F36F00FB16B3 /* EchoController.h */; name = loadGUI; rLen = 7; rLoc = 1579; rType = 0; vrLen = 971; vrLoc = 1121; }; 84D448D60B8EE46C008F9D1F /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400B9E60B60F36E00FB16B3 /* ServerSocket.cpp */; name = "ServerSocket.cpp: 70"; rLen = 0; rLoc = 1255; rType = 0; vrLen = 419; vrLoc = 1067; }; 84D44A870B8F44B4008F9D1F /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA760B60F36F00FB16B3 /* ProxyConnect.cpp */; name = "ProxyConnect.cpp: 206"; rLen = 0; rLoc = 4183; rType = 0; vrLen = 400; vrLoc = 4019; }; 84D4FA460B5CCFFB0058AE41 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744A7009968B340046F588 /* ProxiesManager.cpp */; name = "ProxiesManager.cpp: 309"; rLen = 0; rLoc = 6068; rType = 0; vrLen = 0; vrLoc = 6731; }; 84D4FB3F0B5CFCE50058AE41 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744A7209968B340046F588 /* ProxyConnection.cpp */; name = "ProxyConnection.cpp: 149"; rLen = 0; rLoc = 3442; rType = 0; vrLen = 859; vrLoc = 2691; }; 84D4FB5B0B5CFE640058AE41 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744A6609968B340046F588 /* InterfaceDllProxyInfo.h */; name = "ERROR_CONNECTING_TO_PROXY = -1,"; rLen = 34; rLoc = 548; rType = 0; vrLen = 902; vrLoc = 0; }; 84D4FCA60B5D15890058AE41 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744A6209968B340046F588 /* Echoware.cpp */; name = "Echoware.cpp: 121"; rLen = 0; rLoc = 2866; rType = 0; vrLen = 895; vrLoc = 2401; }; 84D4FCA70B5D15890058AE41 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744A6109968B340046F588 /* EchoSrvDataChannel.h */; name = "EchoSrvDataChannel.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 1035; vrLoc = 0; }; 84D4FE540B5D2A960058AE41 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 84D60B3C0B5BBF2400D9EBCB /* MyDllProxyInfo.h */; name = "MyDllProxyInfo.h: 14"; rLen = 0; rLoc = 227; rType = 0; vrLen = 742; vrLoc = 0; }; 84D5200B0B5E19C10050DE52 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744A5609968B340046F588 /* CritSection.cpp */; name = "CritSection.cpp: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 482; vrLoc = 0; }; 84D520B90B5E27CD0050DE52 /* NSObjCRuntime.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = NSObjCRuntime.h; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h; sourceTree = ""; }; 84D520E40B5E2C1A0050DE52 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 84D520B90B5E27CD0050DE52 /* NSObjCRuntime.h */; name = "NSObjCRuntime.h: 62"; rLen = 0; rLoc = 1575; rType = 0; vrLen = 1247; vrLoc = 1017; }; 84D60AB30B5BB8EF00D9EBCB /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744A5309968B340046F588 /* AES.h */; name = "AES.h: 9"; rLen = 0; rLoc = 104; rType = 0; vrLen = 671; vrLoc = 0; }; 84D60AB40B5BB8EF00D9EBCB /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB090FF909DB286900098B1F /* EchoToOSX.cpp */; name = Thread; rLen = 6; rLoc = 671; rType = 0; vrLen = 876; vrLoc = 0; }; 84D60ABD0B5BB8EF00D9EBCB /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744A5309968B340046F588 /* AES.h */; name = "AES.h: 9"; rLen = 0; rLoc = 104; rType = 0; vrLen = 671; vrLoc = 0; }; 84D60AC10B5BB8EF00D9EBCB /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB090FF909DB286900098B1F /* EchoToOSX.cpp */; name = Thread; rLen = 6; rLoc = 671; rType = 0; vrLen = 876; vrLoc = 0; }; 84D60AC30B5BB8EF00D9EBCB /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744A5B09968B340046F588 /* DataChannels.h */; name = "DataChannels.h: 59"; rLen = 0; rLoc = 1494; rType = 0; vrLen = 997; vrLoc = 732; }; 84D60AC40B5BB8EF00D9EBCB /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744A5F09968B340046F588 /* DllProxyInfo.h */; name = "DllProxyInfo.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 858; vrLoc = 0; }; 84D60AC90B5BB8EF00D9EBCB /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744A5A09968B340046F588 /* DataChannels.cpp */; name = "DataChannels.cpp: 18"; rLen = 0; rLoc = 521; rType = 0; vrLen = 995; vrLoc = 0; }; 84D60ACC0B5BB8EF00D9EBCB /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB090FF809DB286900098B1F /* EchoToOSX.h */; name = "EchoToOSX.h: INVALID_SOCKET"; rLen = 0; rLoc = 257; rType = 0; vrLen = 870; vrLoc = 1174; }; 84D60B3C0B5BBF2400D9EBCB /* MyDllProxyInfo.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {824, 598}}"; sepNavSelRange = "{741, 0}"; sepNavVisRect = "{{0, 0}, {824, 598}}"; sepNavWindowFrame = "{{426, 51}, {863, 671}}"; }; }; 84D60B3D0B5BBF2400D9EBCB /* MyDllProxyInfo.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {574, 1344}}"; sepNavSelRange = "{368, 22}"; sepNavVisRect = "{{0, 0}, {574, 538}}"; sepNavWindowFrame = "{{58, 203}, {743, 543}}"; }; }; 84D60B760B5BC12200D9EBCB /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744AE70996A9700046F588 /* EchoController.h */; name = "EchoController.h: echoServersView"; rLen = 0; rLoc = 202; rType = 0; vrLen = 1179; vrLoc = 0; }; 84D60B770B5BC12200D9EBCB /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744A7109968B340046F588 /* ProxiesManager.h */; name = "ProxiesManager.h: 14"; rLen = 0; rLoc = 252; rType = 0; vrLen = 989; vrLoc = 0; }; 84D60BA40B5BC49500D9EBCB /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 84D60B3C0B5BBF2400D9EBCB /* MyDllProxyInfo.h */; name = "MyDllProxyInfo.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 630; vrLoc = 0; }; 84D60BA50B5BC49500D9EBCB /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 84D60B3D0B5BBF2400D9EBCB /* MyDllProxyInfo.cpp */; name = "MyDllProxyInfo.cpp: 21"; rLen = 0; rLoc = 501; rType = 0; vrLen = 668; vrLoc = 0; }; 84D9EE150B53E20600C10970 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744A6409968B340046F588 /* Globals.cpp */; name = "Globals.cpp: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 832; vrLoc = 0; }; 84D9EE770B53EC5D00C10970 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744A6F09968B340046F588 /* NetPacket.h */; name = "NetPacket.h: 106"; rLen = 0; rLoc = 2669; rType = 0; vrLen = 1311; vrLoc = 2270; }; 84DAA48E0B132F2900222618 /* Source Control */ = { isa = PBXSourceControlManager; fallbackIsa = XCSourceControlManager; isSCMEnabled = 0; scmConfiguration = { }; scmType = ""; }; 84DAA48F0B132F2900222618 /* Code sense */ = { isa = PBXCodeSenseManager; indexTemplatePath = ""; }; 84DAA51F0B14A33800222618 /* XCBreakpointsBucket */ = { isa = XCBreakpointsBucket; name = Echoware; objects = ( ); }; 84DDE9750BB90B6B0074B26A /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA9D0B60F36F00FB16B3 /* stdafx.cpp */; name = "stdafx.cpp: 9"; rLen = 0; rLoc = 295; rType = 0; vrLen = 295; vrLoc = 0; }; 84DE1A860BCCE1DA0033A95C /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 84AF48A30BCCD42400C5BF0A /* DirService.h */; name = "class CDirService"; rLen = 18; rLoc = 207; rType = 0; vrLen = 924; vrLoc = 0; }; 84DF556F0C3CC76F00AD2F4B /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA370B60F36F00FB16B3 /* DataChannelSocket.cpp */; name = "//sets the pair data channel for this data c"; rLen = 44; rLoc = 781; rType = 0; vrLen = 742; vrLoc = 462; }; 84DFC45E0B64BF8200858CAB /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400B9E00B60F36E00FB16B3 /* ACConnection.h */; name = "ACConnection.h: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 485; vrLoc = 0; }; 84DFC6460B64CFED00858CAB /* NSUserDefaults.h */ = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = NSUserDefaults.h; path = /System/Library/Frameworks/Foundation.framework/Headers/NSUserDefaults.h; sourceTree = ""; }; 84DFC6550B64D26200858CAB /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 84DFC6460B64CFED00858CAB /* NSUserDefaults.h */; name = registerDefaults; rLen = 16; rLoc = 1413; rType = 0; vrLen = 1139; vrLoc = 813; }; 84DFC6580B64D26200858CAB /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 84DFC6460B64CFED00858CAB /* NSUserDefaults.h */; name = registerDefaults; rLen = 16; rLoc = 1413; rType = 0; vrLen = 1139; vrLoc = 813; }; 84E20C5D0C57AF7C004FB864 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8400BA610B60F36F00FB16B3 /* MyDllProxyInfo.cpp */; name = "MyDllProxyInfo.cpp: 12"; rLen = 0; rLoc = 218; rType = 0; vrLen = 577; vrLoc = 1223; }; 84E8F34C0B57B4DF001DACF7 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744A7609968B340046F588 /* stdafx.cpp */; name = "stdafx.cpp: 1"; rLen = 0; rLoc = 0; rType = 0; vrLen = 295; vrLoc = 0; }; 84E9145B0B564E2E009AD6FC /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744A7409968B340046F588 /* RSAKeys.cpp */; name = "RSAKeys.cpp: 69"; rLen = 0; rLoc = 315; rType = 0; vrLen = 1414; vrLoc = 1015; }; 84E9145E0B564E2E009AD6FC /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744A5E09968B340046F588 /* DllProxyInfo.cpp */; name = "m_nConnectTimeOut=connectTimeout;"; rLen = 35; rLoc = 1704; rType = 0; vrLen = 1012; vrLoc = 1229; }; 84F22A380B53D80F004CD709 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = AB744AE60996A9700046F588 /* EchoController.m */; name = "EchoController.m: 88"; rLen = 0; rLoc = 3779; rType = 0; vrLen = 1458; vrLoc = 1128; }; 8D5B49AC048680CD000E48DA /* Echoware */ = { activeExec = 0; }; 8D5B49B7048680CD000E48DA /* Info.plist */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {686, 446}}"; sepNavSelRange = "{163, 0}"; sepNavVisRect = "{{0, 0}, {658, 446}}"; sepNavWindowFrame = "{{38, 201}, {697, 519}}"; }; }; AB090FF809DB286900098B1F /* EchoToOSX.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {584, 1428}}"; sepNavSelRange = "{187, 25}"; sepNavVisRect = "{{0, 0}, {568, 367}}"; sepNavWindowFrame = "{{38, 201}, {697, 519}}"; }; }; AB090FF909DB286900098B1F /* EchoToOSX.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {807, 1036}}"; sepNavSelRange = "{1136, 0}"; sepNavVisRect = "{{0, 756}, {807, 239}}"; sepNavWindowFrame = "{{212, -32}, {697, 671}}"; }; }; AB7449FE09968AF50046F588 /* APISocket.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {680, 3360}}"; sepNavSelRange = "{3717, 48}"; sepNavVisRect = "{{0, 1892}, {658, 598}}"; sepNavWindowFrame = "{{245, 42}, {697, 671}}"; }; }; AB7449FF09968AF50046F588 /* ClientSocket.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {710, 2548}}"; sepNavSelRange = "{1315, 0}"; sepNavVisRect = "{{0, 496}, {658, 598}}"; sepNavWindowFrame = "{{142, -28}, {697, 671}}"; }; }; AB744A0109968AF50046F588 /* Socket.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {866, 5740}}"; sepNavSelRange = "{3793, 0}"; sepNavVisRect = "{{0, 2576}, {807, 239}}"; sepNavWindowFrame = "{{175, 165}, {697, 519}}"; }; }; AB744A1109968AF60046F588 /* ntlmv2.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {881, 12180}}"; sepNavSelRange = "{6198, 3}"; sepNavVisRect = "{{0, 2156}, {881, 323}}"; sepNavWindowFrame = "{{15, 66}, {863, 675}}"; }; }; AB744A1F09968AF60046F588 /* Hnfunct.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {807, 5096}}"; sepNavSelRange = "{3516, 0}"; sepNavVisRect = "{{0, 2030}, {807, 239}}"; sepNavWindowFrame = "{{15, 75}, {863, 671}}"; }; }; AB744A2109968AF60046F588 /* Hnumber.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {807, 7434}}"; sepNavSelRange = "{8700, 0}"; sepNavVisRect = "{{0, 6370}, {807, 239}}"; sepNavWindowFrame = "{{15, 75}, {863, 671}}"; }; }; AB744A2309968AF60046F588 /* Keys.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {752, 2506}}"; sepNavSelRange = "{3129, 77}"; sepNavVisRect = "{{0, 1963}, {752, 261}}"; sepNavWindowFrame = "{{15, 75}, {863, 671}}"; }; }; AB744A2909968AF60046F588 /* MyTypes.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {916, 224}}"; sepNavSelRange = "{166, 7}"; sepNavVisRect = "{{0, 20}, {916, 204}}"; sepNavWindowFrame = "{{15, 75}, {863, 671}}"; }; }; AB744A2C09968AF60046F588 /* PrimeGen.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {881, 3122}}"; sepNavSelRange = "{2636, 0}"; sepNavVisRect = "{{0, 1719}, {881, 301}}"; sepNavWindowFrame = "{{166, -51}, {863, 671}}"; }; }; AB744A3009968AF70046F588 /* stdafx.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {996, 244}}"; sepNavSelRange = "{0, 0}"; sepNavVisRect = "{{0, 0}, {996, 244}}"; }; }; AB744A4E09968B340046F588 /* ACConnection.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {896, 8778}}"; sepNavSelRange = "{14656, 0}"; sepNavVisRect = "{{0, 6748}, {568, 367}}"; sepNavWindowFrame = "{{192, 67}, {697, 671}}"; }; }; AB744A4F09968B340046F588 /* ACConnection.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {658, 1246}}"; sepNavSelRange = "{531, 0}"; sepNavVisRect = "{{0, 0}, {658, 598}}"; sepNavWindowFrame = "{{15, 75}, {697, 671}}"; }; }; AB744A5209968B340046F588 /* AES.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {824, 1134}}"; sepNavSelRange = "{219, 0}"; sepNavVisRect = "{{0, 0}, {824, 598}}"; sepNavWindowFrame = "{{15, 75}, {863, 671}}"; }; }; AB744A5309968B340046F588 /* AES.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {574, 538}}"; sepNavSelRange = "{104, 0}"; sepNavVisRect = "{{0, 0}, {574, 538}}"; sepNavWindowFrame = "{{15, 75}, {863, 671}}"; }; }; AB744A5409968B340046F588 /* blowfish.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {824, 3290}}"; sepNavSelRange = "{2924, 17}"; sepNavVisRect = "{{0, 1342}, {824, 598}}"; sepNavWindowFrame = "{{191, 75}, {863, 671}}"; }; }; AB744A5609968B340046F588 /* CritSection.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {658, 446}}"; sepNavSelRange = "{415, 0}"; sepNavVisRect = "{{0, 0}, {658, 446}}"; sepNavWindowFrame = "{{174, 108}, {697, 519}}"; }; }; AB744A5709968B340046F588 /* CritSection.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {658, 446}}"; sepNavSelRange = "{297, 0}"; sepNavVisRect = "{{0, 0}, {658, 446}}"; sepNavWindowFrame = "{{15, 222}, {697, 519}}"; }; }; AB744A5809968B340046F588 /* DataChannel.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {884, 3472}}"; sepNavSelRange = "{1833, 0}"; sepNavVisRect = "{{0, 0}, {658, 598}}"; sepNavWindowFrame = "{{261, 4}, {697, 671}}"; }; }; AB744A5909968B340046F588 /* DataChannel.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {658, 980}}"; sepNavSelRange = "{1144, 0}"; sepNavVisRect = "{{0, 534}, {658, 446}}"; sepNavWindowFrame = "{{61, 180}, {697, 519}}"; }; }; AB744A5A09968B340046F588 /* DataChannels.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {824, 2842}}"; sepNavSelRange = "{5238, 0}"; sepNavVisRect = "{{0, 2226}, {658, 598}}"; sepNavWindowFrame = "{{263, 75}, {697, 671}}"; }; }; AB744A5B09968B340046F588 /* DataChannels.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {658, 980}}"; sepNavSelRange = "{1511, 12}"; sepNavVisRect = "{{0, 382}, {658, 598}}"; sepNavWindowFrame = "{{343, 71}, {697, 671}}"; }; }; AB744A5C09968B340046F588 /* DataChannelSocket.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {896, 1400}}"; sepNavSelRange = "{333, 0}"; sepNavVisRect = "{{0, 140}, {807, 239}}"; sepNavWindowFrame = "{{306, 75}, {697, 671}}"; }; }; AB744A5D09968B340046F588 /* DataChannelSocket.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {658, 882}}"; sepNavSelRange = "{1340, 1}"; sepNavVisRect = "{{0, 0}, {658, 602}}"; sepNavWindowFrame = "{{166, 28}, {697, 675}}"; }; }; AB744A5E09968B340046F588 /* DllProxyInfo.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {980, 2310}}"; sepNavSelRange = "{194, 0}"; sepNavVisRect = "{{0, 29}, {658, 446}}"; sepNavWindowFrame = "{{163, 75}, {697, 519}}"; }; }; AB744A5F09968B340046F588 /* DllProxyInfo.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {574, 812}}"; sepNavSelRange = "{0, 0}"; sepNavVisRect = "{{0, 0}, {574, 538}}"; sepNavWindowFrame = "{{15, 75}, {863, 671}}"; }; }; AB744A6009968B340046F588 /* EchoSrvDataChannel.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {818, 1358}}"; sepNavSelRange = "{1814, 0}"; sepNavVisRect = "{{0, 674}, {574, 538}}"; sepNavWindowFrame = "{{166, 63}, {697, 671}}"; }; }; AB744A6109968B340046F588 /* EchoSrvDataChannel.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {668, 644}}"; sepNavSelRange = "{0, 0}"; sepNavVisRect = "{{0, 0}, {568, 538}}"; }; }; AB744A6209968B340046F588 /* Echoware.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {807, 2786}}"; sepNavSelRange = "{2523, 0}"; sepNavVisRect = "{{0, 1456}, {807, 239}}"; sepNavWindowFrame = "{{166, 60}, {697, 519}}"; }; }; AB744A6309968B340046F588 /* Echoware.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {574, 538}}"; sepNavSelRange = "{488, 0}"; sepNavVisRect = "{{0, 0}, {574, 538}}"; sepNavWindowFrame = "{{84, 159}, {697, 519}}"; }; }; AB744A6409968B340046F588 /* Globals.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {658, 1372}}"; sepNavSelRange = "{172, 0}"; sepNavVisRect = "{{0, 0}, {658, 598}}"; sepNavWindowFrame = "{{215, -120}, {697, 671}}"; }; }; AB744A6509968B340046F588 /* Globals.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {658, 2268}}"; sepNavSelRange = "{684, 0}"; sepNavVisRect = "{{0, 268}, {658, 446}}"; sepNavWindowFrame = "{{517, 89}, {697, 519}}"; }; }; AB744A6609968B340046F588 /* InterfaceDllProxyInfo.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {584, 798}}"; sepNavSelRange = "{295, 0}"; sepNavVisRect = "{{0, 126}, {568, 538}}"; sepNavWindowFrame = "{{260, 13}, {697, 519}}"; }; }; AB744A6709968B340046F588 /* LocalDataChannel.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {986, 2296}}"; sepNavSelRange = "{441, 0}"; sepNavVisRect = "{{0, 0}, {658, 390}}"; sepNavWindowFrame = "{{227, 92}, {697, 519}}"; }; }; AB744A6809968B340046F588 /* LocalDataChannel.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {746, 490}}"; sepNavSelRange = "{0, 0}"; sepNavVisRect = "{{0, 0}, {746, 367}}"; }; }; AB744A6909968B340046F588 /* LocalListener.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {704, 476}}"; sepNavSelRange = "{497, 0}"; sepNavVisRect = "{{0, 62}, {704, 414}}"; sepNavWindowFrame = "{{38, 177}, {743, 543}}"; }; }; AB744A6B09968B340046F588 /* LocalProxyConnection.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {704, 414}}"; sepNavSelRange = "{177, 0}"; sepNavVisRect = "{{0, 0}, {704, 414}}"; sepNavWindowFrame = "{{61, 156}, {743, 543}}"; }; }; AB744A6C09968B340046F588 /* LocalProxyConnection.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {746, 367}}"; sepNavSelRange = "{0, 0}"; sepNavVisRect = "{{0, 0}, {746, 367}}"; sepNavWindowFrame = "{{84, 135}, {743, 543}}"; }; }; AB744A6D09968B340046F588 /* Logger.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {807, 1568}}"; sepNavSelRange = "{1398, 54}"; sepNavVisRect = "{{0, 1062}, {807, 249}}"; }; }; AB744A6E09968B340046F588 /* Logger.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1118, 546}}"; sepNavSelRange = "{86, 19}"; sepNavVisRect = "{{0, 0}, {1118, 323}}"; }; }; AB744A6F09968B340046F588 /* NetPacket.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {807, 2100}}"; sepNavSelRange = "{2854, 0}"; sepNavVisRect = "{{0, 1861}, {807, 239}}"; sepNavWindowFrame = "{{116, 41}, {863, 671}}"; }; }; AB744A7009968B340046F588 /* ProxiesManager.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {716, 4886}}"; sepNavSelRange = "{7971, 82}"; sepNavVisRect = "{{0, 4697}, {695, 189}}"; sepNavWindowFrame = "{{242, 109}, {697, 519}}"; }; }; AB744A7109968B340046F588 /* ProxiesManager.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {568, 1120}}"; sepNavSelRange = "{245, 0}"; sepNavVisRect = "{{0, 0}, {568, 538}}"; }; }; AB744A7209968B340046F588 /* ProxyConnection.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {695, 2254}}"; sepNavSelRange = "{2831, 0}"; sepNavVisRect = "{{0, 1621}, {695, 189}}"; sepNavWindowFrame = "{{153, 150}, {697, 519}}"; }; }; AB744A7309968B340046F588 /* ProxyConnection.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1118, 728}}"; sepNavSelRange = "{132, 22}"; sepNavVisRect = "{{0, 0}, {1118, 323}}"; }; }; AB744A7409968B340046F588 /* RSAKeys.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {807, 2240}}"; sepNavSelRange = "{2886, 0}"; sepNavVisRect = "{{0, 1680}, {807, 239}}"; sepNavWindowFrame = "{{84, 135}, {743, 543}}"; }; }; AB744A7509968B340046F588 /* RSAKeys.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {824, 700}}"; sepNavSelRange = "{381, 0}"; sepNavVisRect = "{{0, 0}, {824, 598}}"; sepNavWindowFrame = "{{293, 75}, {863, 671}}"; }; }; AB744A7609968B340046F588 /* stdafx.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {574, 538}}"; sepNavSelRange = "{0, 0}"; sepNavVisRect = "{{0, 0}, {574, 538}}"; }; }; AB744AE60996A9700046F588 /* EchoController.m */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1088, 16268}}"; sepNavSelRange = "{25003, 18}"; sepNavVisRect = "{{0, 10576}, {746, 367}}"; sepNavWindowFrame = "{{278, 104}, {743, 543}}"; }; }; AB744AE70996A9700046F588 /* EchoController.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {668, 1694}}"; sepNavSelRange = "{512, 0}"; sepNavVisRect = "{{0, 277}, {568, 367}}"; sepNavWindowFrame = "{{233, 181}, {697, 519}}"; }; }; } ================================================ FILE: Bundles/Echoware/Echoware.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 42; objects = { /* Begin PBXBuildFile section */ 8400341A0BCD0E4900D03C1B /* RFBBundleWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 840034190BCD0E4900D03C1B /* RFBBundleWrapper.cpp */; }; 8456E5530B4CFCFE006B7550 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8456E5520B4CFCFE006B7550 /* CoreFoundation.framework */; }; 848C41200B848FDC00BD11B3 /* rfbserver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 848C411F0B848FDC00BD11B3 /* rfbserver.cpp */; }; 84AE56F50B42906500425DCA /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84AE56F40B42906500425DCA /* SystemConfiguration.framework */; }; 84AF48140BCCCE0B00C5BF0A /* DirectoryService.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84AF48130BCCCE0B00C5BF0A /* DirectoryService.framework */; }; 84AF48A50BCCD42400C5BF0A /* DirService.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84AF48A40BCCD42400C5BF0A /* DirService.cpp */; }; 84AF49020BCCD76E00C5BF0A /* User.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84AF49010BCCD76E00C5BF0A /* User.cpp */; }; 84AFF1420B8C841D00D93058 /* ServerListSynchronize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84AFF1410B8C841D00D93058 /* ServerListSynchronize.cpp */; }; 84D60B3E0B5BBF2400D9EBCB /* MyDllProxyInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84D60B3D0B5BBF2400D9EBCB /* MyDllProxyInfo.cpp */; }; 84FD7F370BCB729100C66DF1 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84FD7F360BCB729100C66DF1 /* Security.framework */; }; 8D5B49B0048680CD000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; }; 8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; }; AB090FFA09DB286900098B1F /* EchoToOSX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB090FF909DB286900098B1F /* EchoToOSX.cpp */; }; AB744AE50996A1320046F588 /* EchoServers.nib in Resources */ = {isa = PBXBuildFile; fileRef = AB744AE30996A1320046F588 /* EchoServers.nib */; }; AB87EAEF09B8E11900AC7E96 /* CritSection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A5609968B340046F588 /* CritSection.cpp */; }; AB87EB2E09B8E2FE00AC7E96 /* EchoController.m in Sources */ = {isa = PBXBuildFile; fileRef = AB744AE60996A9700046F588 /* EchoController.m */; }; AB87EB3B09B8E3B000AC7E96 /* ACConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A4E09968B340046F588 /* ACConnection.cpp */; }; AB87EBFE09B8E87B00AC7E96 /* AES.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A5209968B340046F588 /* AES.cpp */; }; AB87EC0009B8E88200AC7E96 /* blowfish.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A5409968B340046F588 /* blowfish.cpp */; }; AB87EC0509B8E8B100AC7E96 /* DataChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A5809968B340046F588 /* DataChannel.cpp */; }; AB87EC5609B8F13F00AC7E96 /* DataChannels.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A5A09968B340046F588 /* DataChannels.cpp */; }; AB87EC5709B8F14000AC7E96 /* DataChannelSocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A5C09968B340046F588 /* DataChannelSocket.cpp */; }; AB87EC5809B8F14200AC7E96 /* DllProxyInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A5E09968B340046F588 /* DllProxyInfo.cpp */; }; AB87EC5A09B8F15000AC7E96 /* stdafx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A7609968B340046F588 /* stdafx.cpp */; }; AB87EC5C09B8F15300AC7E96 /* EchoSrvDataChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A6009968B340046F588 /* EchoSrvDataChannel.cpp */; }; AB87EC5D09B8F15400AC7E96 /* Echoware.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A6209968B340046F588 /* Echoware.cpp */; }; AB87EC5E09B8F15500AC7E96 /* Globals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A6409968B340046F588 /* Globals.cpp */; }; AB87EC5F09B8F15600AC7E96 /* LocalDataChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A6709968B340046F588 /* LocalDataChannel.cpp */; }; AB87EC6009B8F15800AC7E96 /* LocalListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A6909968B340046F588 /* LocalListener.cpp */; }; AB87EC6109B8F15900AC7E96 /* LocalProxyConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A6B09968B340046F588 /* LocalProxyConnection.cpp */; }; AB87EC6209B8F15A00AC7E96 /* Logger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A6D09968B340046F588 /* Logger.cpp */; }; AB87EC6309B8F15B00AC7E96 /* ProxiesManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A7009968B340046F588 /* ProxiesManager.cpp */; }; AB87EC6409B8F15C00AC7E96 /* ProxyConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A7209968B340046F588 /* ProxyConnection.cpp */; }; AB87ECF309BB3B8E00AC7E96 /* Code.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A1909968AF60046F588 /* Code.cpp */; }; AB87ECF409BB3B8F00AC7E96 /* Commonf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A1A09968AF60046F588 /* Commonf.cpp */; }; AB87ECF609BB3B9100AC7E96 /* Hnfunct.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A1F09968AF60046F588 /* Hnfunct.cpp */; }; AB87ECF709BB3B9200AC7E96 /* Hnumber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A2109968AF60046F588 /* Hnumber.cpp */; }; AB87ECF809BB3B9400AC7E96 /* Keys.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A2309968AF60046F588 /* Keys.cpp */; }; AB87ECF909BB3B9500AC7E96 /* Keys_main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A2409968AF60046F588 /* Keys_main.cpp */; }; AB87ECFA09BB3B9600AC7E96 /* Mynum.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A2509968AF60046F588 /* Mynum.cpp */; }; AB87ECFB09BB3B9700AC7E96 /* Myprint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A2709968AF60046F588 /* Myprint.cpp */; }; AB87ECFC09BB3B9700AC7E96 /* Operator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A2A09968AF60046F588 /* Operator.cpp */; }; AB87ECFD09BB3B9800AC7E96 /* PrimeGen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A2C09968AF60046F588 /* PrimeGen.cpp */; }; AB87ED0009BB3B9A00AC7E96 /* stdafx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A3009968AF70046F588 /* stdafx.cpp */; }; AB87F13B09C1F95100AC7E96 /* RSAKeys.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A7409968B340046F588 /* RSAKeys.cpp */; }; AB87F1A209C1FE2700AC7E96 /* aes_core.c in Sources */ = {isa = PBXBuildFile; fileRef = AB744A0409968AF60046F588 /* aes_core.c */; }; AB87F1A409C1FE3300AC7E96 /* md4.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A0C09968AF60046F588 /* md4.cpp */; }; AB87F1A509C1FE3300AC7E96 /* md5.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A0E09968AF60046F588 /* md5.cpp */; }; AB87F1A809C1FE3B00AC7E96 /* stdafx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A1609968AF60046F588 /* stdafx.cpp */; }; AB87F1AB09C1FE5E00AC7E96 /* Gsimply.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A1D09968AF60046F588 /* Gsimply.cpp */; }; AB87F2D009C211AB00AC7E96 /* ProxyConnect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A1209968AF60046F588 /* ProxyConnect.cpp */; }; AB87F2D109C211AC00AC7E96 /* ntlmv2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A1109968AF60046F588 /* ntlmv2.cpp */; }; AB87F5A109C5FFC100AC7E96 /* ClientSocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB7449FF09968AF50046F588 /* ClientSocket.cpp */; }; AB87F5D609C602A500AC7E96 /* ServerSocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A0009968AF50046F588 /* ServerSocket.cpp */; }; AB87F5DB09C602BB00AC7E96 /* Socket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB744A0109968AF50046F588 /* Socket.cpp */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 089C1672FE841209C02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; 089C167FFE841241C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 32DBCF630370AF2F00C91783 /* Echoware_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Echoware_Prefix.pch; sourceTree = ""; }; 840034180BCD0E4900D03C1B /* RFBBundleWrapper.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = RFBBundleWrapper.h; sourceTree = ""; }; 840034190BCD0E4900D03C1B /* RFBBundleWrapper.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = RFBBundleWrapper.cpp; sourceTree = ""; }; 8400B9DF0B60F36E00FB16B3 /* ACConnection.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = ACConnection.cpp; sourceTree = ""; }; 8400B9E00B60F36E00FB16B3 /* ACConnection.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; path = ACConnection.h; sourceTree = ""; }; 8400B9E10B60F36E00FB16B3 /* AES.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = AES.cpp; sourceTree = ""; }; 8400B9E20B60F36E00FB16B3 /* AES.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; path = AES.h; sourceTree = ""; }; 8400B9E40B60F36E00FB16B3 /* APISocket.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; path = APISocket.h; sourceTree = ""; }; 8400B9E50B60F36E00FB16B3 /* ClientSocket.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = ClientSocket.cpp; sourceTree = ""; }; 8400B9E60B60F36E00FB16B3 /* ServerSocket.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = ServerSocket.cpp; sourceTree = ""; }; 8400B9E70B60F36E00FB16B3 /* Socket.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = Socket.cpp; sourceTree = ""; }; 8400B9E80B60F36E00FB16B3 /* blowfish.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = blowfish.cpp; sourceTree = ""; }; 8400B9E90B60F36E00FB16B3 /* blowfish.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; path = blowfish.h; sourceTree = ""; }; 8400B9EA0B60F36E00FB16B3 /* blowfish.h2 */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = blowfish.h2; sourceTree = ""; }; 8400BA2F0B60F36F00FB16B3 /* CritSection.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = CritSection.cpp; sourceTree = ""; }; 8400BA300B60F36F00FB16B3 /* CritSection.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; path = CritSection.h; sourceTree = ""; }; 8400BA310B60F36F00FB16B3 /* DataChannel.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = DataChannel.cpp; sourceTree = ""; }; 8400BA320B60F36F00FB16B3 /* DataChannel.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; path = DataChannel.h; sourceTree = ""; }; 8400BA350B60F36F00FB16B3 /* DataChannels.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = DataChannels.cpp; sourceTree = ""; }; 8400BA360B60F36F00FB16B3 /* DataChannels.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; path = DataChannels.h; sourceTree = ""; }; 8400BA370B60F36F00FB16B3 /* DataChannelSocket.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = DataChannelSocket.cpp; sourceTree = ""; }; 8400BA380B60F36F00FB16B3 /* DataChannelSocket.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; path = DataChannelSocket.h; sourceTree = ""; }; 8400BA390B60F36F00FB16B3 /* DllProxyInfo.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = DllProxyInfo.cpp; sourceTree = ""; }; 8400BA3A0B60F36F00FB16B3 /* DllProxyInfo.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; path = DllProxyInfo.h; sourceTree = ""; }; 8400BA3B0B60F36F00FB16B3 /* EchoController.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; path = EchoController.h; sourceTree = ""; }; 8400BA3C0B60F36F00FB16B3 /* EchoController.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = EchoController.m; sourceTree = ""; }; 8400BA3D0B60F36F00FB16B3 /* EchoSrvDataChannel.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = EchoSrvDataChannel.cpp; sourceTree = ""; }; 8400BA3E0B60F36F00FB16B3 /* EchoSrvDataChannel.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; path = EchoSrvDataChannel.h; sourceTree = ""; }; 8400BA3F0B60F36F00FB16B3 /* EchoToOSX.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = EchoToOSX.cpp; sourceTree = ""; }; 8400BA400B60F36F00FB16B3 /* EchoToOSX.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; path = EchoToOSX.h; sourceTree = ""; }; 8400BA410B60F36F00FB16B3 /* Echoware.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = Echoware.cpp; sourceTree = ""; }; 8400BA440B60F36F00FB16B3 /* Echoware.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; path = Echoware.h; sourceTree = ""; }; 8400BA480B60F36F00FB16B3 /* Echoware.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = Echoware.xcodeproj; sourceTree = ""; }; 8400BA4C0B60F36F00FB16B3 /* Echoware_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Echoware_Prefix.pch; sourceTree = ""; }; 8400BA540B60F36F00FB16B3 /* English */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; 8400BA550B60F36F00FB16B3 /* Globals.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = Globals.cpp; sourceTree = ""; }; 8400BA560B60F36F00FB16B3 /* Globals.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; path = Globals.h; sourceTree = ""; }; 8400BA570B60F36F00FB16B3 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = ""; }; 8400BA580B60F36F00FB16B3 /* InterfaceDllProxyInfo.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; path = InterfaceDllProxyInfo.h; sourceTree = ""; }; 8400BA590B60F36F00FB16B3 /* LocalDataChannel.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = LocalDataChannel.cpp; sourceTree = ""; }; 8400BA5A0B60F36F00FB16B3 /* LocalDataChannel.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; path = LocalDataChannel.h; sourceTree = ""; }; 8400BA5B0B60F36F00FB16B3 /* LocalListener.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = LocalListener.cpp; sourceTree = ""; }; 8400BA5C0B60F36F00FB16B3 /* LocalListener.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; path = LocalListener.h; sourceTree = ""; }; 8400BA5D0B60F36F00FB16B3 /* LocalProxyConnection.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = LocalProxyConnection.cpp; sourceTree = ""; }; 8400BA5E0B60F36F00FB16B3 /* LocalProxyConnection.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; path = LocalProxyConnection.h; sourceTree = ""; }; 8400BA5F0B60F36F00FB16B3 /* Logger.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = Logger.cpp; sourceTree = ""; }; 8400BA600B60F36F00FB16B3 /* Logger.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; path = Logger.h; sourceTree = ""; }; 8400BA610B60F36F00FB16B3 /* MyDllProxyInfo.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = MyDllProxyInfo.cpp; sourceTree = ""; }; 8400BA620B60F36F00FB16B3 /* MyDllProxyInfo.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; path = MyDllProxyInfo.h; sourceTree = ""; }; 8400BA630B60F36F00FB16B3 /* NetPacket.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; path = NetPacket.h; sourceTree = ""; }; 8400BA650B60F36F00FB16B3 /* aes.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = aes.h; sourceTree = ""; }; 8400BA660B60F36F00FB16B3 /* aes_core.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = aes_core.c; sourceTree = ""; }; 8400BA670B60F36F00FB16B3 /* aes_locl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = aes_locl.h; sourceTree = ""; }; 8400BA680B60F36F00FB16B3 /* e_os2.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = e_os2.h; sourceTree = ""; }; 8400BA690B60F36F00FB16B3 /* LibeaySt.dsp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = LibeaySt.dsp; sourceTree = ""; }; 8400BA6A0B60F36F00FB16B3 /* LibeaySt.vcproj */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = LibeaySt.vcproj; sourceTree = ""; }; 8400BA6B0B60F36F00FB16B3 /* opensslconf.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = opensslconf.h; sourceTree = ""; }; 8400BA6C0B60F36F00FB16B3 /* ProxiesManager.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = ProxiesManager.cpp; sourceTree = ""; }; 8400BA6D0B60F36F00FB16B3 /* ProxiesManager.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; path = ProxiesManager.h; sourceTree = ""; }; 8400BA6F0B60F36F00FB16B3 /* global.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = global.h; sourceTree = ""; }; 8400BA700B60F36F00FB16B3 /* md4.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = md4.cpp; sourceTree = ""; }; 8400BA710B60F36F00FB16B3 /* md4.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = md4.h; sourceTree = ""; }; 8400BA720B60F36F00FB16B3 /* md5.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = md5.cpp; sourceTree = ""; }; 8400BA730B60F36F00FB16B3 /* md5.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = md5.h; sourceTree = ""; }; 8400BA740B60F36F00FB16B3 /* ntlm.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ntlm.h; sourceTree = ""; }; 8400BA750B60F36F00FB16B3 /* ntlmv2.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ntlmv2.cpp; sourceTree = ""; }; 8400BA760B60F36F00FB16B3 /* ProxyConnect.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = ProxyConnect.cpp; sourceTree = ""; }; 8400BA770B60F36F00FB16B3 /* ProxyConnect.dsp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = ProxyConnect.dsp; sourceTree = ""; }; 8400BA780B60F36F00FB16B3 /* ProxyConnect.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ProxyConnect.h; sourceTree = ""; }; 8400BA790B60F36F00FB16B3 /* ProxyConnect.vcproj */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = ProxyConnect.vcproj; sourceTree = ""; }; 8400BA7A0B60F36F00FB16B3 /* stdafx.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = stdafx.cpp; sourceTree = ""; }; 8400BA7B0B60F36F00FB16B3 /* stdafx.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = stdafx.h; sourceTree = ""; }; 8400BA7C0B60F36F00FB16B3 /* ProxyConnection.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = ProxyConnection.cpp; sourceTree = ""; }; 8400BA7D0B60F36F00FB16B3 /* ProxyConnection.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; path = ProxyConnection.h; sourceTree = ""; }; 8400BA7F0B60F36F00FB16B3 /* Code.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Code.cpp; sourceTree = ""; }; 8400BA800B60F36F00FB16B3 /* Commonf.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Commonf.cpp; sourceTree = ""; }; 8400BA810B60F36F00FB16B3 /* Commonf.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Commonf.h; sourceTree = ""; }; 8400BA820B60F36F00FB16B3 /* Function.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Function.h; sourceTree = ""; }; 8400BA830B60F36F00FB16B3 /* Gsimply.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Gsimply.cpp; sourceTree = ""; }; 8400BA840B60F36F00FB16B3 /* Gsimply.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Gsimply.h; sourceTree = ""; }; 8400BA850B60F36F00FB16B3 /* Hnfunct.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Hnfunct.cpp; sourceTree = ""; }; 8400BA860B60F36F00FB16B3 /* Hnfunct.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Hnfunct.h; sourceTree = ""; }; 8400BA870B60F36F00FB16B3 /* Hnumber.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Hnumber.cpp; sourceTree = ""; }; 8400BA880B60F36F00FB16B3 /* HNumber.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HNumber.h; sourceTree = ""; }; 8400BA890B60F36F00FB16B3 /* Keys.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Keys.cpp; sourceTree = ""; }; 8400BA8A0B60F36F00FB16B3 /* Keys_main.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Keys_main.cpp; sourceTree = ""; }; 8400BA8B0B60F36F00FB16B3 /* Mynum.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Mynum.cpp; sourceTree = ""; }; 8400BA8C0B60F36F00FB16B3 /* MyNum.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MyNum.h; sourceTree = ""; }; 8400BA8D0B60F36F00FB16B3 /* Myprint.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Myprint.cpp; sourceTree = ""; }; 8400BA8E0B60F36F00FB16B3 /* Myprint.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Myprint.h; sourceTree = ""; }; 8400BA8F0B60F36F00FB16B3 /* MyTypes.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MyTypes.h; sourceTree = ""; }; 8400BA900B60F36F00FB16B3 /* Operator.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Operator.cpp; sourceTree = ""; }; 8400BA910B60F36F00FB16B3 /* Operator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Operator.h; sourceTree = ""; }; 8400BA920B60F36F00FB16B3 /* PrimeGen.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = PrimeGen.cpp; sourceTree = ""; }; 8400BA930B60F36F00FB16B3 /* Profiler.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Profiler.h; sourceTree = ""; }; 8400BA940B60F36F00FB16B3 /* RSA.dsp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = RSA.dsp; sourceTree = ""; }; 8400BA950B60F36F00FB16B3 /* RSA.vcproj */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = RSA.vcproj; sourceTree = ""; }; 8400BA960B60F36F00FB16B3 /* stdafx.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = stdafx.cpp; sourceTree = ""; }; 8400BA970B60F36F00FB16B3 /* StdAfx.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = StdAfx.h; sourceTree = ""; }; 8400BA980B60F36F00FB16B3 /* TMSG.H */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = TMSG.H; sourceTree = ""; }; 8400BA990B60F36F00FB16B3 /* RSAKeys.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = RSAKeys.cpp; sourceTree = ""; }; 8400BA9A0B60F36F00FB16B3 /* RSAKeys.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; path = RSAKeys.h; sourceTree = ""; }; 8400BA9D0B60F36F00FB16B3 /* stdafx.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = stdafx.cpp; sourceTree = ""; }; 8400BA9E0B60F36F00FB16B3 /* stdafx.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 30; path = stdafx.h; sourceTree = ""; }; 8400BAA00B60F36F00FB16B3 /* version.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = version.plist; sourceTree = ""; }; 8456E5520B4CFCFE006B7550 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = ""; }; 848C411E0B848FDC00BD11B3 /* rfbserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rfbserver.h; sourceTree = ""; }; 848C411F0B848FDC00BD11B3 /* rfbserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rfbserver.cpp; sourceTree = ""; }; 84AE56F40B42906500425DCA /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = /System/Library/Frameworks/SystemConfiguration.framework; sourceTree = ""; }; 84AF48130BCCCE0B00C5BF0A /* DirectoryService.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DirectoryService.framework; path = /System/Library/Frameworks/DirectoryService.framework; sourceTree = ""; }; 84AF48A30BCCD42400C5BF0A /* DirService.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = DirService.h; sourceTree = ""; }; 84AF48A40BCCD42400C5BF0A /* DirService.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = DirService.cpp; sourceTree = ""; }; 84AF49000BCCD76E00C5BF0A /* User.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = User.h; sourceTree = ""; }; 84AF49010BCCD76E00C5BF0A /* User.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = User.cpp; sourceTree = ""; }; 84AFF1400B8C841D00D93058 /* ServerListSynchronize.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = ServerListSynchronize.h; sourceTree = ""; }; 84AFF1410B8C841D00D93058 /* ServerListSynchronize.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = ServerListSynchronize.cpp; sourceTree = ""; }; 84D60B3C0B5BBF2400D9EBCB /* MyDllProxyInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyDllProxyInfo.h; sourceTree = ""; }; 84D60B3D0B5BBF2400D9EBCB /* MyDllProxyInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MyDllProxyInfo.cpp; sourceTree = ""; }; 84FD7F360BCB729100C66DF1 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = /System/Library/Frameworks/Security.framework; sourceTree = ""; }; 8D5B49B6048680CD000E48DA /* Echoware.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Echoware.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Info.plist; sourceTree = ""; }; AB090FF809DB286900098B1F /* EchoToOSX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EchoToOSX.h; sourceTree = ""; }; AB090FF909DB286900098B1F /* EchoToOSX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EchoToOSX.cpp; sourceTree = ""; }; AB7449FE09968AF50046F588 /* APISocket.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = APISocket.h; sourceTree = ""; }; AB7449FF09968AF50046F588 /* ClientSocket.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ClientSocket.cpp; sourceTree = ""; }; AB744A0009968AF50046F588 /* ServerSocket.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ServerSocket.cpp; sourceTree = ""; }; AB744A0109968AF50046F588 /* Socket.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Socket.cpp; sourceTree = ""; }; AB744A0309968AF50046F588 /* aes.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = aes.h; sourceTree = ""; }; AB744A0409968AF60046F588 /* aes_core.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = aes_core.c; sourceTree = ""; }; AB744A0509968AF60046F588 /* aes_locl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = aes_locl.h; sourceTree = ""; }; AB744A0609968AF60046F588 /* e_os2.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = e_os2.h; sourceTree = ""; }; AB744A0909968AF60046F588 /* opensslconf.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = opensslconf.h; sourceTree = ""; }; AB744A0B09968AF60046F588 /* global.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = global.h; sourceTree = ""; }; AB744A0C09968AF60046F588 /* md4.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = md4.cpp; sourceTree = ""; }; AB744A0D09968AF60046F588 /* md4.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = md4.h; sourceTree = ""; }; AB744A0E09968AF60046F588 /* md5.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = md5.cpp; sourceTree = ""; }; AB744A0F09968AF60046F588 /* md5.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = md5.h; sourceTree = ""; }; AB744A1009968AF60046F588 /* ntlm.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ntlm.h; sourceTree = ""; }; AB744A1109968AF60046F588 /* ntlmv2.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ntlmv2.cpp; sourceTree = ""; }; AB744A1209968AF60046F588 /* ProxyConnect.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ProxyConnect.cpp; sourceTree = ""; }; AB744A1409968AF60046F588 /* ProxyConnect.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ProxyConnect.h; sourceTree = ""; }; AB744A1609968AF60046F588 /* stdafx.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = stdafx.cpp; sourceTree = ""; }; AB744A1709968AF60046F588 /* stdafx.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = stdafx.h; sourceTree = ""; }; AB744A1909968AF60046F588 /* Code.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Code.cpp; sourceTree = ""; }; AB744A1A09968AF60046F588 /* Commonf.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Commonf.cpp; sourceTree = ""; }; AB744A1B09968AF60046F588 /* Commonf.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Commonf.h; sourceTree = ""; }; AB744A1C09968AF60046F588 /* Function.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Function.h; sourceTree = ""; }; AB744A1D09968AF60046F588 /* Gsimply.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Gsimply.cpp; sourceTree = ""; }; AB744A1E09968AF60046F588 /* Gsimply.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Gsimply.h; sourceTree = ""; }; AB744A1F09968AF60046F588 /* Hnfunct.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Hnfunct.cpp; sourceTree = ""; }; AB744A2009968AF60046F588 /* Hnfunct.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Hnfunct.h; sourceTree = ""; }; AB744A2109968AF60046F588 /* Hnumber.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Hnumber.cpp; sourceTree = ""; }; AB744A2209968AF60046F588 /* HNumber.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HNumber.h; sourceTree = ""; }; AB744A2309968AF60046F588 /* Keys.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Keys.cpp; sourceTree = ""; }; AB744A2409968AF60046F588 /* Keys_main.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Keys_main.cpp; sourceTree = ""; }; AB744A2509968AF60046F588 /* Mynum.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Mynum.cpp; sourceTree = ""; }; AB744A2609968AF60046F588 /* MyNum.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MyNum.h; sourceTree = ""; }; AB744A2709968AF60046F588 /* Myprint.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Myprint.cpp; sourceTree = ""; }; AB744A2809968AF60046F588 /* Myprint.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Myprint.h; sourceTree = ""; }; AB744A2909968AF60046F588 /* MyTypes.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MyTypes.h; sourceTree = ""; }; AB744A2A09968AF60046F588 /* Operator.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Operator.cpp; sourceTree = ""; }; AB744A2B09968AF60046F588 /* Operator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Operator.h; sourceTree = ""; }; AB744A2C09968AF60046F588 /* PrimeGen.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = PrimeGen.cpp; sourceTree = ""; }; AB744A2D09968AF70046F588 /* Profiler.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Profiler.h; sourceTree = ""; }; AB744A3009968AF70046F588 /* stdafx.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = stdafx.cpp; sourceTree = ""; }; AB744A3109968AF70046F588 /* StdAfx.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = StdAfx.h; sourceTree = ""; }; AB744A3209968AF70046F588 /* TMSG.H */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = TMSG.H; sourceTree = ""; }; AB744A4E09968B340046F588 /* ACConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ACConnection.cpp; sourceTree = ""; }; AB744A4F09968B340046F588 /* ACConnection.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ACConnection.h; sourceTree = ""; }; AB744A5209968B340046F588 /* AES.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = AES.cpp; sourceTree = ""; }; AB744A5309968B340046F588 /* AES.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AES.h; sourceTree = ""; }; AB744A5409968B340046F588 /* blowfish.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = blowfish.cpp; sourceTree = ""; }; AB744A5509968B340046F588 /* blowfish.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = blowfish.h; sourceTree = ""; }; AB744A5609968B340046F588 /* CritSection.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CritSection.cpp; sourceTree = ""; }; AB744A5709968B340046F588 /* CritSection.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CritSection.h; sourceTree = ""; }; AB744A5809968B340046F588 /* DataChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DataChannel.cpp; sourceTree = ""; }; AB744A5909968B340046F588 /* DataChannel.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DataChannel.h; sourceTree = ""; }; AB744A5A09968B340046F588 /* DataChannels.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DataChannels.cpp; sourceTree = ""; }; AB744A5B09968B340046F588 /* DataChannels.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DataChannels.h; sourceTree = ""; }; AB744A5C09968B340046F588 /* DataChannelSocket.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DataChannelSocket.cpp; sourceTree = ""; }; AB744A5D09968B340046F588 /* DataChannelSocket.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DataChannelSocket.h; sourceTree = ""; }; AB744A5E09968B340046F588 /* DllProxyInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DllProxyInfo.cpp; sourceTree = ""; }; AB744A5F09968B340046F588 /* DllProxyInfo.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DllProxyInfo.h; sourceTree = ""; }; AB744A6009968B340046F588 /* EchoSrvDataChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = EchoSrvDataChannel.cpp; sourceTree = ""; }; AB744A6109968B340046F588 /* EchoSrvDataChannel.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = EchoSrvDataChannel.h; sourceTree = ""; }; AB744A6209968B340046F588 /* Echoware.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Echoware.cpp; sourceTree = ""; }; AB744A6309968B340046F588 /* Echoware.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Echoware.h; sourceTree = ""; }; AB744A6409968B340046F588 /* Globals.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Globals.cpp; sourceTree = ""; }; AB744A6509968B340046F588 /* Globals.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Globals.h; sourceTree = ""; }; AB744A6609968B340046F588 /* InterfaceDllProxyInfo.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = InterfaceDllProxyInfo.h; sourceTree = ""; }; AB744A6709968B340046F588 /* LocalDataChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = LocalDataChannel.cpp; sourceTree = ""; }; AB744A6809968B340046F588 /* LocalDataChannel.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = LocalDataChannel.h; sourceTree = ""; }; AB744A6909968B340046F588 /* LocalListener.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = LocalListener.cpp; sourceTree = ""; }; AB744A6A09968B340046F588 /* LocalListener.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = LocalListener.h; sourceTree = ""; }; AB744A6B09968B340046F588 /* LocalProxyConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = LocalProxyConnection.cpp; sourceTree = ""; }; AB744A6C09968B340046F588 /* LocalProxyConnection.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = LocalProxyConnection.h; sourceTree = ""; }; AB744A6D09968B340046F588 /* Logger.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Logger.cpp; sourceTree = ""; }; AB744A6E09968B340046F588 /* Logger.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Logger.h; sourceTree = ""; }; AB744A6F09968B340046F588 /* NetPacket.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NetPacket.h; sourceTree = ""; }; AB744A7009968B340046F588 /* ProxiesManager.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ProxiesManager.cpp; sourceTree = ""; }; AB744A7109968B340046F588 /* ProxiesManager.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ProxiesManager.h; sourceTree = ""; }; AB744A7209968B340046F588 /* ProxyConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ProxyConnection.cpp; sourceTree = ""; }; AB744A7309968B340046F588 /* ProxyConnection.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ProxyConnection.h; sourceTree = ""; }; AB744A7409968B340046F588 /* RSAKeys.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RSAKeys.cpp; sourceTree = ""; }; AB744A7509968B340046F588 /* RSAKeys.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RSAKeys.h; sourceTree = ""; }; AB744A7609968B340046F588 /* stdafx.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = stdafx.cpp; sourceTree = ""; }; AB744A7709968B340046F588 /* stdafx.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = stdafx.h; sourceTree = ""; }; AB744AE40996A1320046F588 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/EchoServers.nib; sourceTree = ""; }; AB744AE60996A9700046F588 /* EchoController.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = EchoController.m; sourceTree = ""; }; AB744AE70996A9700046F588 /* EchoController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = EchoController.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 8D5B49B3048680CD000E48DA /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */, 84AE56F50B42906500425DCA /* SystemConfiguration.framework in Frameworks */, 8456E5530B4CFCFE006B7550 /* CoreFoundation.framework in Frameworks */, 84FD7F370BCB729100C66DF1 /* Security.framework in Frameworks */, 84AF48140BCCCE0B00C5BF0A /* DirectoryService.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 089C166AFE841209C02AAC07 /* Echoware */ = { isa = PBXGroup; children = ( 8400B9DE0B60F36E00FB16B3 /* Echoware */, 08FB77AFFE84173DC02AAC07 /* Classes */, 32C88E010371C26100C91783 /* Other Sources */, 089C167CFE841241C02AAC07 /* Resources */, 089C1671FE841209C02AAC07 /* Frameworks and Libraries */, 19C28FB8FE9D52D311CA2CBB /* Products */, AB744AE30996A1320046F588 /* EchoServers.nib */, ); name = Echoware; sourceTree = ""; }; 089C1671FE841209C02AAC07 /* Frameworks and Libraries */ = { isa = PBXGroup; children = ( 84AF48130BCCCE0B00C5BF0A /* DirectoryService.framework */, 84FD7F360BCB729100C66DF1 /* Security.framework */, 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */, 8456E5520B4CFCFE006B7550 /* CoreFoundation.framework */, 84AE56F40B42906500425DCA /* SystemConfiguration.framework */, 089C1672FE841209C02AAC07 /* Foundation.framework */, 089C167FFE841241C02AAC07 /* AppKit.framework */, 1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */, 1058C7AEFEA557BF11CA2CBB /* Other Frameworks */, ); name = "Frameworks and Libraries"; sourceTree = ""; }; 089C167CFE841241C02AAC07 /* Resources */ = { isa = PBXGroup; children = ( 8D5B49B7048680CD000E48DA /* Info.plist */, 089C167DFE841241C02AAC07 /* InfoPlist.strings */, ); name = Resources; sourceTree = ""; }; 08FB77AFFE84173DC02AAC07 /* Classes */ = { isa = PBXGroup; children = ( AB744AE60996A9700046F588 /* EchoController.m */, AB744AE70996A9700046F588 /* EchoController.h */, AB090FF909DB286900098B1F /* EchoToOSX.cpp */, AB090FF809DB286900098B1F /* EchoToOSX.h */, AB744A5309968B340046F588 /* AES.h */, AB744A6609968B340046F588 /* InterfaceDllProxyInfo.h */, AB744A6209968B340046F588 /* Echoware.cpp */, AB744A6309968B340046F588 /* Echoware.h */, AB744A4E09968B340046F588 /* ACConnection.cpp */, AB744A4F09968B340046F588 /* ACConnection.h */, AB744A5409968B340046F588 /* blowfish.cpp */, AB744A5509968B340046F588 /* blowfish.h */, AB744A5609968B340046F588 /* CritSection.cpp */, AB744A5709968B340046F588 /* CritSection.h */, AB744A5809968B340046F588 /* DataChannel.cpp */, AB744A5909968B340046F588 /* DataChannel.h */, AB744A5209968B340046F588 /* AES.cpp */, AB744A5A09968B340046F588 /* DataChannels.cpp */, AB744A5B09968B340046F588 /* DataChannels.h */, AB744A5C09968B340046F588 /* DataChannelSocket.cpp */, AB744A5D09968B340046F588 /* DataChannelSocket.h */, AB744A5E09968B340046F588 /* DllProxyInfo.cpp */, AB744A5F09968B340046F588 /* DllProxyInfo.h */, AB744A6009968B340046F588 /* EchoSrvDataChannel.cpp */, AB744A6109968B340046F588 /* EchoSrvDataChannel.h */, AB744A6409968B340046F588 /* Globals.cpp */, AB744A6509968B340046F588 /* Globals.h */, AB744A6709968B340046F588 /* LocalDataChannel.cpp */, AB744A6809968B340046F588 /* LocalDataChannel.h */, AB744A6909968B340046F588 /* LocalListener.cpp */, AB744A6A09968B340046F588 /* LocalListener.h */, AB744A6B09968B340046F588 /* LocalProxyConnection.cpp */, AB744A6C09968B340046F588 /* LocalProxyConnection.h */, AB744A6D09968B340046F588 /* Logger.cpp */, AB744A6E09968B340046F588 /* Logger.h */, AB744A6F09968B340046F588 /* NetPacket.h */, AB744A7009968B340046F588 /* ProxiesManager.cpp */, AB744A7109968B340046F588 /* ProxiesManager.h */, AB744A7209968B340046F588 /* ProxyConnection.cpp */, AB744A7309968B340046F588 /* ProxyConnection.h */, AB744A7409968B340046F588 /* RSAKeys.cpp */, AB744A7509968B340046F588 /* RSAKeys.h */, AB744A7609968B340046F588 /* stdafx.cpp */, AB744A7709968B340046F588 /* stdafx.h */, 84D60B3C0B5BBF2400D9EBCB /* MyDllProxyInfo.h */, 84D60B3D0B5BBF2400D9EBCB /* MyDllProxyInfo.cpp */, AB7449FD09968AF50046F588 /* APISocket */, AB744A0209968AF50046F588 /* OpenSSL */, AB744A0A09968AF60046F588 /* ProxyConnect */, AB744A1809968AF60046F588 /* RSA */, 848C411E0B848FDC00BD11B3 /* rfbserver.h */, 848C411F0B848FDC00BD11B3 /* rfbserver.cpp */, ); name = Classes; sourceTree = ""; }; 1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */ = { isa = PBXGroup; children = ( ); name = "Linked Frameworks"; sourceTree = ""; }; 1058C7AEFEA557BF11CA2CBB /* Other Frameworks */ = { isa = PBXGroup; children = ( ); name = "Other Frameworks"; sourceTree = ""; }; 19C28FB8FE9D52D311CA2CBB /* Products */ = { isa = PBXGroup; children = ( 8D5B49B6048680CD000E48DA /* Echoware.bundle */, ); name = Products; sourceTree = ""; }; 32C88E010371C26100C91783 /* Other Sources */ = { isa = PBXGroup; children = ( 32DBCF630370AF2F00C91783 /* Echoware_Prefix.pch */, ); name = "Other Sources"; sourceTree = ""; }; 8400B9DE0B60F36E00FB16B3 /* Echoware */ = { isa = PBXGroup; children = ( 840034180BCD0E4900D03C1B /* RFBBundleWrapper.h */, 840034190BCD0E4900D03C1B /* RFBBundleWrapper.cpp */, 84AF49000BCCD76E00C5BF0A /* User.h */, 84AF49010BCCD76E00C5BF0A /* User.cpp */, 84AF48A30BCCD42400C5BF0A /* DirService.h */, 84AF48A40BCCD42400C5BF0A /* DirService.cpp */, 8400B9DF0B60F36E00FB16B3 /* ACConnection.cpp */, 8400B9E00B60F36E00FB16B3 /* ACConnection.h */, 8400B9E10B60F36E00FB16B3 /* AES.cpp */, 8400B9E20B60F36E00FB16B3 /* AES.h */, 8400B9E30B60F36E00FB16B3 /* APISocket */, 8400B9E80B60F36E00FB16B3 /* blowfish.cpp */, 8400B9E90B60F36E00FB16B3 /* blowfish.h */, 8400B9EA0B60F36E00FB16B3 /* blowfish.h2 */, 8400BA2F0B60F36F00FB16B3 /* CritSection.cpp */, 8400BA300B60F36F00FB16B3 /* CritSection.h */, 8400BA310B60F36F00FB16B3 /* DataChannel.cpp */, 8400BA320B60F36F00FB16B3 /* DataChannel.h */, 8400BA350B60F36F00FB16B3 /* DataChannels.cpp */, 8400BA360B60F36F00FB16B3 /* DataChannels.h */, 8400BA370B60F36F00FB16B3 /* DataChannelSocket.cpp */, 8400BA380B60F36F00FB16B3 /* DataChannelSocket.h */, 8400BA390B60F36F00FB16B3 /* DllProxyInfo.cpp */, 8400BA3A0B60F36F00FB16B3 /* DllProxyInfo.h */, 8400BA3B0B60F36F00FB16B3 /* EchoController.h */, 8400BA3C0B60F36F00FB16B3 /* EchoController.m */, 8400BA3D0B60F36F00FB16B3 /* EchoSrvDataChannel.cpp */, 8400BA3E0B60F36F00FB16B3 /* EchoSrvDataChannel.h */, 8400BA3F0B60F36F00FB16B3 /* EchoToOSX.cpp */, 8400BA400B60F36F00FB16B3 /* EchoToOSX.h */, 8400BA410B60F36F00FB16B3 /* Echoware.cpp */, 8400BA440B60F36F00FB16B3 /* Echoware.h */, 8400BA480B60F36F00FB16B3 /* Echoware.xcodeproj */, 8400BA4C0B60F36F00FB16B3 /* Echoware_Prefix.pch */, 8400BA530B60F36F00FB16B3 /* InfoPlist.strings */, 8400BA550B60F36F00FB16B3 /* Globals.cpp */, 8400BA560B60F36F00FB16B3 /* Globals.h */, 8400BA570B60F36F00FB16B3 /* Info.plist */, 8400BA580B60F36F00FB16B3 /* InterfaceDllProxyInfo.h */, 8400BA590B60F36F00FB16B3 /* LocalDataChannel.cpp */, 8400BA5A0B60F36F00FB16B3 /* LocalDataChannel.h */, 8400BA5B0B60F36F00FB16B3 /* LocalListener.cpp */, 8400BA5C0B60F36F00FB16B3 /* LocalListener.h */, 8400BA5D0B60F36F00FB16B3 /* LocalProxyConnection.cpp */, 8400BA5E0B60F36F00FB16B3 /* LocalProxyConnection.h */, 8400BA5F0B60F36F00FB16B3 /* Logger.cpp */, 8400BA600B60F36F00FB16B3 /* Logger.h */, 8400BA610B60F36F00FB16B3 /* MyDllProxyInfo.cpp */, 8400BA620B60F36F00FB16B3 /* MyDllProxyInfo.h */, 8400BA630B60F36F00FB16B3 /* NetPacket.h */, 8400BA640B60F36F00FB16B3 /* OpenSSL */, 8400BA6C0B60F36F00FB16B3 /* ProxiesManager.cpp */, 8400BA6D0B60F36F00FB16B3 /* ProxiesManager.h */, 8400BA6E0B60F36F00FB16B3 /* ProxyConnect */, 8400BA7C0B60F36F00FB16B3 /* ProxyConnection.cpp */, 8400BA7D0B60F36F00FB16B3 /* ProxyConnection.h */, 8400BA7E0B60F36F00FB16B3 /* RSA */, 8400BA990B60F36F00FB16B3 /* RSAKeys.cpp */, 8400BA9A0B60F36F00FB16B3 /* RSAKeys.h */, 8400BA9D0B60F36F00FB16B3 /* stdafx.cpp */, 8400BA9E0B60F36F00FB16B3 /* stdafx.h */, 8400BAA00B60F36F00FB16B3 /* version.plist */, 84AFF1400B8C841D00D93058 /* ServerListSynchronize.h */, 84AFF1410B8C841D00D93058 /* ServerListSynchronize.cpp */, ); name = Echoware; sourceTree = ""; }; 8400B9E30B60F36E00FB16B3 /* APISocket */ = { isa = PBXGroup; children = ( 8400B9E40B60F36E00FB16B3 /* APISocket.h */, 8400B9E50B60F36E00FB16B3 /* ClientSocket.cpp */, 8400B9E60B60F36E00FB16B3 /* ServerSocket.cpp */, 8400B9E70B60F36E00FB16B3 /* Socket.cpp */, ); path = APISocket; sourceTree = ""; }; 8400BA490B60F36F00FB16B3 /* Products */ = { isa = PBXGroup; children = ( ); name = Products; sourceTree = ""; }; 8400BA640B60F36F00FB16B3 /* OpenSSL */ = { isa = PBXGroup; children = ( 8400BA650B60F36F00FB16B3 /* aes.h */, 8400BA660B60F36F00FB16B3 /* aes_core.c */, 8400BA670B60F36F00FB16B3 /* aes_locl.h */, 8400BA680B60F36F00FB16B3 /* e_os2.h */, 8400BA690B60F36F00FB16B3 /* LibeaySt.dsp */, 8400BA6A0B60F36F00FB16B3 /* LibeaySt.vcproj */, 8400BA6B0B60F36F00FB16B3 /* opensslconf.h */, ); path = OpenSSL; sourceTree = ""; }; 8400BA6E0B60F36F00FB16B3 /* ProxyConnect */ = { isa = PBXGroup; children = ( 8400BA6F0B60F36F00FB16B3 /* global.h */, 8400BA700B60F36F00FB16B3 /* md4.cpp */, 8400BA710B60F36F00FB16B3 /* md4.h */, 8400BA720B60F36F00FB16B3 /* md5.cpp */, 8400BA730B60F36F00FB16B3 /* md5.h */, 8400BA740B60F36F00FB16B3 /* ntlm.h */, 8400BA750B60F36F00FB16B3 /* ntlmv2.cpp */, 8400BA760B60F36F00FB16B3 /* ProxyConnect.cpp */, 8400BA770B60F36F00FB16B3 /* ProxyConnect.dsp */, 8400BA780B60F36F00FB16B3 /* ProxyConnect.h */, 8400BA790B60F36F00FB16B3 /* ProxyConnect.vcproj */, 8400BA7A0B60F36F00FB16B3 /* stdafx.cpp */, 8400BA7B0B60F36F00FB16B3 /* stdafx.h */, ); path = ProxyConnect; sourceTree = ""; }; 8400BA7E0B60F36F00FB16B3 /* RSA */ = { isa = PBXGroup; children = ( 8400BA7F0B60F36F00FB16B3 /* Code.cpp */, 8400BA800B60F36F00FB16B3 /* Commonf.cpp */, 8400BA810B60F36F00FB16B3 /* Commonf.h */, 8400BA820B60F36F00FB16B3 /* Function.h */, 8400BA830B60F36F00FB16B3 /* Gsimply.cpp */, 8400BA840B60F36F00FB16B3 /* Gsimply.h */, 8400BA850B60F36F00FB16B3 /* Hnfunct.cpp */, 8400BA860B60F36F00FB16B3 /* Hnfunct.h */, 8400BA870B60F36F00FB16B3 /* Hnumber.cpp */, 8400BA880B60F36F00FB16B3 /* HNumber.h */, 8400BA890B60F36F00FB16B3 /* Keys.cpp */, 8400BA8A0B60F36F00FB16B3 /* Keys_main.cpp */, 8400BA8B0B60F36F00FB16B3 /* Mynum.cpp */, 8400BA8C0B60F36F00FB16B3 /* MyNum.h */, 8400BA8D0B60F36F00FB16B3 /* Myprint.cpp */, 8400BA8E0B60F36F00FB16B3 /* Myprint.h */, 8400BA8F0B60F36F00FB16B3 /* MyTypes.h */, 8400BA900B60F36F00FB16B3 /* Operator.cpp */, 8400BA910B60F36F00FB16B3 /* Operator.h */, 8400BA920B60F36F00FB16B3 /* PrimeGen.cpp */, 8400BA930B60F36F00FB16B3 /* Profiler.h */, 8400BA940B60F36F00FB16B3 /* RSA.dsp */, 8400BA950B60F36F00FB16B3 /* RSA.vcproj */, 8400BA960B60F36F00FB16B3 /* stdafx.cpp */, 8400BA970B60F36F00FB16B3 /* StdAfx.h */, 8400BA980B60F36F00FB16B3 /* TMSG.H */, ); path = RSA; sourceTree = ""; }; AB7449FD09968AF50046F588 /* APISocket */ = { isa = PBXGroup; children = ( AB7449FE09968AF50046F588 /* APISocket.h */, AB7449FF09968AF50046F588 /* ClientSocket.cpp */, AB744A0009968AF50046F588 /* ServerSocket.cpp */, AB744A0109968AF50046F588 /* Socket.cpp */, ); path = APISocket; sourceTree = ""; }; AB744A0209968AF50046F588 /* OpenSSL */ = { isa = PBXGroup; children = ( AB744A0309968AF50046F588 /* aes.h */, AB744A0409968AF60046F588 /* aes_core.c */, AB744A0509968AF60046F588 /* aes_locl.h */, AB744A0609968AF60046F588 /* e_os2.h */, AB744A0909968AF60046F588 /* opensslconf.h */, ); path = OpenSSL; sourceTree = ""; }; AB744A0A09968AF60046F588 /* ProxyConnect */ = { isa = PBXGroup; children = ( AB744A0B09968AF60046F588 /* global.h */, AB744A0C09968AF60046F588 /* md4.cpp */, AB744A0D09968AF60046F588 /* md4.h */, AB744A0E09968AF60046F588 /* md5.cpp */, AB744A0F09968AF60046F588 /* md5.h */, AB744A1009968AF60046F588 /* ntlm.h */, AB744A1109968AF60046F588 /* ntlmv2.cpp */, AB744A1209968AF60046F588 /* ProxyConnect.cpp */, AB744A1409968AF60046F588 /* ProxyConnect.h */, AB744A1609968AF60046F588 /* stdafx.cpp */, AB744A1709968AF60046F588 /* stdafx.h */, ); path = ProxyConnect; sourceTree = ""; }; AB744A1809968AF60046F588 /* RSA */ = { isa = PBXGroup; children = ( AB744A1909968AF60046F588 /* Code.cpp */, AB744A1A09968AF60046F588 /* Commonf.cpp */, AB744A1B09968AF60046F588 /* Commonf.h */, AB744A1C09968AF60046F588 /* Function.h */, AB744A1D09968AF60046F588 /* Gsimply.cpp */, AB744A1E09968AF60046F588 /* Gsimply.h */, AB744A1F09968AF60046F588 /* Hnfunct.cpp */, AB744A2009968AF60046F588 /* Hnfunct.h */, AB744A2109968AF60046F588 /* Hnumber.cpp */, AB744A2209968AF60046F588 /* HNumber.h */, AB744A2309968AF60046F588 /* Keys.cpp */, AB744A2409968AF60046F588 /* Keys_main.cpp */, AB744A2509968AF60046F588 /* Mynum.cpp */, AB744A2609968AF60046F588 /* MyNum.h */, AB744A2709968AF60046F588 /* Myprint.cpp */, AB744A2809968AF60046F588 /* Myprint.h */, AB744A2909968AF60046F588 /* MyTypes.h */, AB744A2A09968AF60046F588 /* Operator.cpp */, AB744A2B09968AF60046F588 /* Operator.h */, AB744A2C09968AF60046F588 /* PrimeGen.cpp */, AB744A2D09968AF70046F588 /* Profiler.h */, AB744A3009968AF70046F588 /* stdafx.cpp */, AB744A3109968AF70046F588 /* StdAfx.h */, AB744A3209968AF70046F588 /* TMSG.H */, ); path = RSA; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 8D5B49AC048680CD000E48DA /* Echoware */ = { isa = PBXNativeTarget; buildConfigurationList = AB7449F309968AB50046F588 /* Build configuration list for PBXNativeTarget "Echoware" */; buildPhases = ( 8D5B49AF048680CD000E48DA /* Resources */, 8D5B49B1048680CD000E48DA /* Sources */, 8D5B49B3048680CD000E48DA /* Frameworks */, ); buildRules = ( ); dependencies = ( ); name = Echoware; productInstallPath = "$(HOME)/Library/Bundles"; productName = Echoware; productReference = 8D5B49B6048680CD000E48DA /* Echoware.bundle */; productType = "com.apple.product-type.bundle"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 089C1669FE841209C02AAC07 /* Project object */ = { isa = PBXProject; buildConfigurationList = AB7449F709968AB50046F588 /* Build configuration list for PBXProject "Echoware" */; hasScannedForEncodings = 1; mainGroup = 089C166AFE841209C02AAC07 /* Echoware */; projectDirPath = ""; projectReferences = ( { ProductGroup = 8400BA490B60F36F00FB16B3 /* Products */; ProjectRef = 8400BA480B60F36F00FB16B3 /* Echoware.xcodeproj */; }, ); targets = ( 8D5B49AC048680CD000E48DA /* Echoware */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 8D5B49AF048680CD000E48DA /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 8D5B49B0048680CD000E48DA /* InfoPlist.strings in Resources */, AB744AE50996A1320046F588 /* EchoServers.nib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 8D5B49B1048680CD000E48DA /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( AB87EAEF09B8E11900AC7E96 /* CritSection.cpp in Sources */, AB87EB2E09B8E2FE00AC7E96 /* EchoController.m in Sources */, AB87EB3B09B8E3B000AC7E96 /* ACConnection.cpp in Sources */, AB87EBFE09B8E87B00AC7E96 /* AES.cpp in Sources */, AB87EC0009B8E88200AC7E96 /* blowfish.cpp in Sources */, AB87EC0509B8E8B100AC7E96 /* DataChannel.cpp in Sources */, AB87EC5609B8F13F00AC7E96 /* DataChannels.cpp in Sources */, AB87EC5709B8F14000AC7E96 /* DataChannelSocket.cpp in Sources */, AB87EC5809B8F14200AC7E96 /* DllProxyInfo.cpp in Sources */, AB87EC5A09B8F15000AC7E96 /* stdafx.cpp in Sources */, AB87EC5C09B8F15300AC7E96 /* EchoSrvDataChannel.cpp in Sources */, AB87EC5D09B8F15400AC7E96 /* Echoware.cpp in Sources */, AB87EC5E09B8F15500AC7E96 /* Globals.cpp in Sources */, AB87EC5F09B8F15600AC7E96 /* LocalDataChannel.cpp in Sources */, AB87EC6009B8F15800AC7E96 /* LocalListener.cpp in Sources */, AB87EC6109B8F15900AC7E96 /* LocalProxyConnection.cpp in Sources */, AB87EC6209B8F15A00AC7E96 /* Logger.cpp in Sources */, AB87EC6309B8F15B00AC7E96 /* ProxiesManager.cpp in Sources */, AB87EC6409B8F15C00AC7E96 /* ProxyConnection.cpp in Sources */, AB87ECF309BB3B8E00AC7E96 /* Code.cpp in Sources */, AB87ECF409BB3B8F00AC7E96 /* Commonf.cpp in Sources */, AB87ECF609BB3B9100AC7E96 /* Hnfunct.cpp in Sources */, AB87ECF709BB3B9200AC7E96 /* Hnumber.cpp in Sources */, AB87ECF809BB3B9400AC7E96 /* Keys.cpp in Sources */, AB87ECF909BB3B9500AC7E96 /* Keys_main.cpp in Sources */, AB87ECFA09BB3B9600AC7E96 /* Mynum.cpp in Sources */, AB87ECFB09BB3B9700AC7E96 /* Myprint.cpp in Sources */, AB87ECFC09BB3B9700AC7E96 /* Operator.cpp in Sources */, AB87ECFD09BB3B9800AC7E96 /* PrimeGen.cpp in Sources */, AB87ED0009BB3B9A00AC7E96 /* stdafx.cpp in Sources */, AB87F13B09C1F95100AC7E96 /* RSAKeys.cpp in Sources */, AB87F1A209C1FE2700AC7E96 /* aes_core.c in Sources */, AB87F1A409C1FE3300AC7E96 /* md4.cpp in Sources */, AB87F1A509C1FE3300AC7E96 /* md5.cpp in Sources */, AB87F1A809C1FE3B00AC7E96 /* stdafx.cpp in Sources */, AB87F1AB09C1FE5E00AC7E96 /* Gsimply.cpp in Sources */, AB87F2D009C211AB00AC7E96 /* ProxyConnect.cpp in Sources */, AB87F2D109C211AC00AC7E96 /* ntlmv2.cpp in Sources */, AB87F5A109C5FFC100AC7E96 /* ClientSocket.cpp in Sources */, AB87F5D609C602A500AC7E96 /* ServerSocket.cpp in Sources */, AB87F5DB09C602BB00AC7E96 /* Socket.cpp in Sources */, AB090FFA09DB286900098B1F /* EchoToOSX.cpp in Sources */, 84D60B3E0B5BBF2400D9EBCB /* MyDllProxyInfo.cpp in Sources */, 848C41200B848FDC00BD11B3 /* rfbserver.cpp in Sources */, 84AFF1420B8C841D00D93058 /* ServerListSynchronize.cpp in Sources */, 84AF48A50BCCD42400C5BF0A /* DirService.cpp in Sources */, 84AF49020BCCD76E00C5BF0A /* User.cpp in Sources */, 8400341A0BCD0E4900D03C1B /* RFBBundleWrapper.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 089C167DFE841241C02AAC07 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 089C167EFE841241C02AAC07 /* English */, ); name = InfoPlist.strings; sourceTree = ""; }; 8400BA530B60F36F00FB16B3 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 8400BA540B60F36F00FB16B3 /* English */, ); name = InfoPlist.strings; sourceTree = ""; }; AB744AE30996A1320046F588 /* EchoServers.nib */ = { isa = PBXVariantGroup; children = ( AB744AE40996A1320046F588 /* English */, ); name = EchoServers.nib; sourceTree = SOURCE_ROOT; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ AB7449F409968AB50046F588 /* Development */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = ( i386, ppc, ppc7400, ); COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = Echoware_Prefix.pch; HEADER_SEARCH_PATHS = "$(SRCROOT)/"; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Library/Bundles"; PRODUCT_NAME = Echoware; WRAPPER_EXTENSION = bundle; ZERO_LINK = YES; }; name = Development; }; AB7449F509968AB50046F588 /* Deployment */ = { isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = Echoware_Prefix.pch; INFOPLIST_FILE = Info.plist; INSTALL_MODE_FLAG = rwx; INSTALL_PATH = "$(HOME)/Library/Bundles"; PRODUCT_NAME = Echoware; WRAPPER_EXTENSION = bundle; ZERO_LINK = NO; }; name = Deployment; }; AB7449F609968AB50046F588 /* Default */ = { isa = XCBuildConfiguration; buildSettings = { GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = Echoware_Prefix.pch; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Library/Bundles"; PRODUCT_NAME = Echoware; WRAPPER_EXTENSION = bundle; }; name = Default; }; AB7449F809968AB50046F588 /* Development */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = ( ppc, i386, ); BUNDLE_LOADER = ""; CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)"; GCC_MODEL_TUNING = G3; GCC_SYMBOLS_PRIVATE_EXTERN = YES; GCC_VERSION = 4.0; HEADER_SEARCH_PATHS = ( "$(HEADER_SEARCH_PATHS)", ../, ); MACOSX_DEPLOYMENT_TARGET = 10.3; OTHER_LDFLAGS = ""; SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic; SYMROOT = "/Users/admin/Projects/Vine Server.app/Contents/Resources"; }; name = Development; }; AB7449F909968AB50046F588 /* Deployment */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = ( ppc, i386, ); BUNDLE_LOADER = "$(inherited)"; CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)"; CONFIGURATION_TEMP_DIR = "$(PROJECT_TEMP_DIR)/$(CONFIGURATION)"; GCC_CHAR_IS_UNSIGNED_CHAR = NO; GCC_C_LANGUAGE_STANDARD = "compiler-default"; GCC_ENABLE_OBJC_EXCEPTIONS = NO; GCC_ENABLE_TRIGRAPHS = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_MODEL_TUNING = G3; GCC_NO_NIL_RECEIVERS = NO; GCC_PFE_FILE_C_DIALECTS = "$(inherited)"; GCC_SHORT_ENUMS = NO; GCC_SYMBOLS_PRIVATE_EXTERN = YES; GCC_VERSION = 4.0; HEADER_SEARCH_PATHS = ( "$(HEADER_SEARCH_PATHS)", ../, ); MACOSX_DEPLOYMENT_TARGET = 10.3; OBJROOT = "$(PROJECT_TEMP_DIR)"; OTHER_LDFLAGS = "-lstdc++"; REZ_SEARCH_PATHS = "$(inherited)"; SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic; SYMROOT = "/Users/admin/Projects/Vine Server.app/Contents/Resources"; }; name = Deployment; }; AB7449FA09968AB50046F588 /* Default */ = { isa = XCBuildConfiguration; buildSettings = { GCC_MODEL_TUNING = G3; GCC_SYMBOLS_PRIVATE_EXTERN = YES; GCC_VERSION = 3.3; HEADER_SEARCH_PATHS = ( "$(HEADER_SEARCH_PATHS)", ../, ); MACOSX_DEPLOYMENT_TARGET = 10.3; OTHER_LDFLAGS = "-lstdc++"; SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic; SYMROOT = "/Users/admin/Projects/Vine Server.app/Contents/Resources"; }; name = Default; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ AB7449F309968AB50046F588 /* Build configuration list for PBXNativeTarget "Echoware" */ = { isa = XCConfigurationList; buildConfigurations = ( AB7449F409968AB50046F588 /* Development */, AB7449F509968AB50046F588 /* Deployment */, AB7449F609968AB50046F588 /* Default */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Default; }; AB7449F709968AB50046F588 /* Build configuration list for PBXProject "Echoware" */ = { isa = XCConfigurationList; buildConfigurations = ( AB7449F809968AB50046F588 /* Development */, AB7449F909968AB50046F588 /* Deployment */, AB7449FA09968AB50046F588 /* Default */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Default; }; /* End XCConfigurationList section */ }; rootObject = 089C1669FE841209C02AAC07 /* Project object */; } ================================================ FILE: Bundles/Echoware/Echoware_Prefix.pch ================================================ // // Prefix header for all source files of the 'Echoware' target in the 'Echoware' project. // #ifdef __OBJC__ #import #endif ================================================ FILE: Bundles/Echoware/English.lproj/EchoServers.nib/classes.nib ================================================ { IBClasses = ( { ACTIONS = { addServer = id; advancedSettings = id; cancelAddServer = id; cancelAdvancedSettings = id; cancelEditServer = id; completeAddServer = id; completeAdvancedSettings = id; completeEditServer = id; disableEcho = id; editServer = id; enableLogging = id; loadGUI = id; removeServer = id; requireProxyAuthentication = id; setOffloadingPort = id; useEncryption = id; }; CLASS = EchoController; LANGUAGE = ObjC; OUTLETS = { addButton = NSButton; addServerWindow = NSWindow; advancedSettingsButton = NSButton; advancedSettingsWindow = NSWindow; disableEchoCheckbox = NSButton; echoServerField = NSTextFieldCell; "echoServerField_edit" = NSTextFieldCell; echoServersView = NSView; echoTableView = NSTableView; editButton = NSButton; editServerWindow = NSWindow; enableLoggingCheckbox = NSButton; passwordField = NSTextFieldCell; "passwordField_edit" = NSTextFieldCell; proxyAddress = NSTextField; proxyAuthenticationCheckbox = NSButton; proxyPassword = NSTextField; proxyPasswordLabel = NSTextField; proxyPort = NSTextField; proxyUsername = NSTextField; proxyUsernameLabel = NSTextField; removeButton = NSButton; usernameField = NSTextFieldCell; "usernameField_edit" = NSTextFieldCell; versionTextField = NSTextField; }; SUPERCLASS = NSObject; }, {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; } ); IBVersion = 1; } ================================================ FILE: Bundles/Echoware/English.lproj/EchoServers.nib/info.nib ================================================ IBDocumentLocation 37 274 648 379 0 0 1024 746 IBFramework Version 446.1 IBLockedTabItems 20 IBSystem Version 8A428 ================================================ FILE: Bundles/Echoware/Globals.cpp ================================================ #include "stdafx.h" #include "Globals.h" //#include CGlobals g_globals; CGlobals::CGlobals() { m_bIsDllInitialized=false; m_nPortForOffLoadingData=0; } CGlobals::~CGlobals() { if (g_globals.GetDllInitialized()) { g_globals.m_logger.Write("ReleaseSockets"); g_globals.ReleaseSockets(); } } bool CGlobals::InitSockets(unsigned char nHighVersion, unsigned char nLowVersion) { // No Socket System Init Needed on OSX // WORD wVersionRequested; // WSADATA wsaData; // int err; // // wVersionRequested = MAKEWORD(nLowVersion, nHighVersion); // // err = WSAStartup( wVersionRequested, &wsaData ); // if (err!=0) // return false; // // if (LOBYTE(wsaData.wVersion)!=nLowVersion || HIBYTE(wsaData.wVersion)!=nHighVersion) // { // WSACleanup(); // return false; // } return true; } bool CGlobals::ReleaseSockets() { // No Socket System Init Needed on OSX // if (WSACleanup()==0) // return true; // // if (WSAGetLastError()==WSAEINPROGRESS) // return false; return true; } void CGlobals::SetDllInitialized(bool bIsDllInitialized) { m_critSection.Lock(); m_bIsDllInitialized=bIsDllInitialized; m_critSection.Unlock(); } bool CGlobals::GetDllInitialized() { bool bRet; m_critSection.Lock(); bRet=m_bIsDllInitialized; m_critSection.Unlock(); return bRet; } void CGlobals::SetPortForOffLoadingData(int nPortForOffLoadingData) { m_critSection.Lock(); m_nPortForOffLoadingData=nPortForOffLoadingData; m_critSection.Unlock(); } int CGlobals::GetPortForOffLoadingData() { int nRet; m_critSection.Lock(); nRet=m_nPortForOffLoadingData; m_critSection.Unlock(); return nRet; } //----------------------------------------------------------------------------------------- int CGlobals::GetFormattedID(char *szBuffer, int len, const char* szPartner) { if (len < ID_STRING_SIZE) return -1; memset(szBuffer, 0, len); char *pColon; pColon = strrchr( szPartner, ':'); if (pColon == NULL) { strcpy(szBuffer + CLIENT_ID_OFFSET, szPartner); return 0; } else { strncpy(szBuffer + CLIENT_ID_OFFSET, szPartner, (int)(pColon - szPartner)); strcpy(szBuffer + APP_ID_OFFSET, szPartner + (int)(pColon - szPartner + 1)); return 1; } } //----------------------------------------------------------------------------------------- int CGlobals::ParseFormattedID(char *szBuffer, int len, char* szPartner) { memset(szPartner, 0, len); if (szBuffer + APP_ID_OFFSET != NULL) { sprintf(szPartner, "%s:%s", szBuffer, szBuffer + APP_ID_OFFSET); } else sprintf(szPartner, "%s", szBuffer); return ID_STRING_SIZE; } //----------------------------------------------------------------------------------------- ================================================ FILE: Bundles/Echoware/Globals.h ================================================ #ifndef _GLOBALS_H #define _GLOBALS_H #if _MSC_VER > 1000 #pragma once #endif #define CHANNEL_CODE_SIZE 11 #define ID_STRING_SIZE 255 #define CLIENT_ID_OFFSET 0 #define APP_ID_OFFSET 64 #define APP_INDEX_OFFSET 96 #define ECHO_VERSION_OFFSET 128 #define RESERVED_OFFSET 136 #include "Logger.h" #include "CritSection.h" #include "ProxiesManager.h" // in miliseconds #define THREAD_STOP_TIMEOUT 2000 #define CONNECTION_TO_OFFLOAD_TIMER_VALUE 3000 #define RECONNECTION_TO_OFFLOAD_TIMER_VALUE 500 #define RECONNECTION_COUNT 3 class CGlobals { public: CGlobals(); virtual ~CGlobals(); void SetDllInitialized(bool bIsDllInitialized=true); bool GetDllInitialized(); void SetPortForOffLoadingData(int nPortForOffLoadingData); int GetPortForOffLoadingData(); bool InitSockets(unsigned char nHighVersion, unsigned char nLowVersion); bool ReleaseSockets(); //format the MyID to the CONNECT_TO_PEER message format //[out szBuffer] result of formating //[in len] input length of the szBuffer //[in szPartner] Peer Id in the form "ClientID:App1,App2" //[return] 0 if there is no appid and 1 if ithere is some, -1 if error int GetFormattedID(char *szBuffer, int len, const char* szPartner); int ParseFormattedID(char *szBuffer, int len, char* szPartner); public: CLogger m_logger; //proxies list manager CProxiesManager m_proxiesManager; protected: bool m_bIsDllInitialized; int m_nPortForOffLoadingData; CCritSection m_critSection; }; extern CGlobals g_globals; //a generic buffer class class CBuffer { public: CBuffer(unsigned int size=1024) { m_buff=new char[size]; m_nSize=size; m_nWritePosition=0; } virtual ~CBuffer() { delete []m_buff; } void Write(void* buff, unsigned int write_size) { //g_globals.m_logger.WriteFormated("=>CBuffer: Write len=%d", write_size); m_critSection.Lock(); if (write_size>m_nSize-m_nWritePosition) { char* tmp=new char[m_nWritePosition+write_size]; memcpy(tmp, m_buff, m_nWritePosition); delete []m_buff; m_buff=tmp; m_nSize=m_nWritePosition+write_size; } memcpy(m_buff+m_nWritePosition, buff, write_size); m_nWritePosition+=write_size; m_critSection.Unlock(); //g_globals.m_logger.WriteFormated("<=CBuffer: Write len=%d", write_size); } unsigned int Read(void* buff, unsigned int read_size) { //g_globals.m_logger.WriteFormated("=>CBuffer: Read max=%d", read_size); m_critSection.Lock(); //g_globals.m_logger.WriteFormated("read_size=%d m_nWritePos=%d", read_size, m_nWritePosition); if (read_size>m_nWritePosition) read_size=m_nWritePosition; memcpy(buff, m_buff, read_size); memmove(m_buff, m_buff+read_size, m_nWritePosition-read_size); m_nWritePosition-=read_size; m_critSection.Unlock(); //g_globals.m_logger.WriteFormated("<=CBuffer: Read len=%d", read_size); return read_size; } unsigned int Peak(void* buff, unsigned int read_size) { m_critSection.Lock(); if (read_size>m_nWritePosition) read_size=m_nWritePosition; memcpy(buff, m_buff, read_size); m_critSection.Unlock(); return read_size; } unsigned int Size() { return m_nWritePosition; } void Drop(unsigned int drop_size) { m_critSection.Lock(); if (drop_size>=m_nWritePosition) { //drop all m_nWritePosition=0; } else { memmove(m_buff, m_buff+drop_size, m_nWritePosition-drop_size); m_nWritePosition-=drop_size; } m_critSection.Unlock(); } void Empty() { m_nWritePosition=0; } protected: char* m_buff; unsigned int m_nSize; unsigned int m_nWritePosition; CCritSection m_critSection; }; #endif ================================================ FILE: Bundles/Echoware/Info.plist ================================================ CFBundleDevelopmentRegion English CFBundleExecutable Echoware CFBundleIconFile CFBundleIdentifier com.yourcompany.yourcocoabundle CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType BNDL CFBundleSignature ???? CFBundleVersion 1.0 NSPrincipalClass ================================================ FILE: Bundles/Echoware/InterfaceDllProxyInfo.h ================================================ #ifndef _INTERFACE_DLL_PROXY_INFO_H #define _INTERFACE_DLL_PROXY_INFO_H #if _MSC_VER > 1000 #pragma once #endif //enum //{ // STATUS_MSG_BASE = WM_USER + 3000, #define STATUS_CONNECTING 0x00000001 #define STATUS_CONNECTED 0x00000002 #define STATUS_AUTHENTICATING 0x00000004 #define STATUS_AUTHENTICATION_FAILED 0x00000008 #define STATUS_ESTABLISHING_DATA_CHANNEL 0x00000010 #define STATUS_SEARCHING_FOR_PARTNER 0x00000020 #define STATUS_DISCONNECTED_FROM_PROXY 0x00000040 // STATUS_MSG_LAST //}; enum { ERROR_CONNECTING_TO_PROXY = -1, CONNECTION_SUCCESSFUL, NO_PROXY_SERVER_FOUND_TO_CONNECT, AUTHENTICATION_FAILED, PROXY_ALREADY_CONNECTED, CONNECTION_TIMED_OUT, ID_FOUND_EMPTY }; class IDllProxyInfo { public: virtual void SetName(char* name) = 0; virtual void SetIPPort(char* ipport) = 0; virtual void SetIP(const char* ip) = 0; virtual void SetPort(const char* port) = 0; virtual void SetPassword(const char* pass) = 0; virtual void SetStatus(int Status, bool bStatus) = 0; virtual bool SetMyID(const char* MyID) = 0; virtual bool SetSocketTimeout(int connectTimeout, int ReceiveTimeout, int SendTimeout) =0; virtual void SetReconnectProxy(bool bReconnectProxy) = 0; virtual const char* GetName() const= 0; virtual const char* GetIpPort() const= 0; virtual const char* GetIP() const= 0; virtual const char* GetPort() const= 0; virtual const char* GetPassword() const= 0; virtual int GetStatus() const= 0; virtual const char* GetMyID() const= 0; virtual bool GetReconnectProxy()const = 0; }; #endif ================================================ FILE: Bundles/Echoware/LICENSE.txt ================================================ EchoWare OSX Bundle 1.926 9 August 07 The openssl material used in EchoWare comes with license material that is appended to the end of this document. EchoWare License ---------------- EchoWare is Copyright (C) 2004-2007 Echogent Systems, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Redistributions in any form must be accompanied by information on how to obtain complete source code for the echoware software and any accompanying software that uses the echoware software. The source code must either be included in the distribution or be available for no more than the cost of distribution plus a nominal fee, and must be freely redistributable under reasonable conditions. For an executable file, complete source code means the source code for all modules it contains. It does not include source code for modules or files that typically accompany the major components of the operating system on which the executable file runs. THIS SOFTWARE IS PROVIDED BY ECHOGENT SYSTEMS, INC. ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL ECHOGENT SYSTEMS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. For more informationL: echoware@echogent.com OpenSSL License --------------- /* ==================================================================== * Copyright (c) 1998-2004 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ Original SSLeay License ----------------------- /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publicly available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ ================================================ FILE: Bundles/Echoware/LocalDataChannel.cpp ================================================ #include "StdAfx.h" #include "LocalDataChannel.h" #include "DataChannel.h" #include "globals.h" CLocalDataChannel::CLocalDataChannel(CDataChannel* pDataChannel) :CDataChannelSocket(pDataChannel) { m_bRFB=false; } CLocalDataChannel::~CLocalDataChannel(void) { g_globals.m_logger.WriteFormated("~CLocalDataChannel: send buff=%d, rec buff=%d", m_pSendBuffer->Size(), m_pRecvBuffer->Size()); } void crypt_data(const unsigned char *in, unsigned char *out, int length, const AES_KEY *key, const int enc) { unsigned long len = length; unsigned char tmp[AES_BLOCK_SIZE]; while (len >= AES_BLOCK_SIZE) { memset(tmp,0,AES_BLOCK_SIZE); memcpy(tmp,in,AES_BLOCK_SIZE); if (AES_ENCRYPT == enc) { AES_encrypt(tmp, out, key); } else { AES_decrypt(tmp, out, key); } len -= AES_BLOCK_SIZE; in += AES_BLOCK_SIZE; out += AES_BLOCK_SIZE; } if (len) { memset(tmp,0,AES_BLOCK_SIZE); memcpy(tmp,in,AES_BLOCK_SIZE); if (AES_ENCRYPT == enc) { AES_encrypt(tmp, tmp, key); } else { AES_decrypt(tmp, tmp, key); } memcpy(out, tmp, AES_BLOCK_SIZE); } } //send data to local server //it is a notify message from CClientSocket void CLocalDataChannel::OnSend(char* buff, int& len) { if (!m_pDataChannel->m_bEncryptDecrypt) { CDataChannelSocket::OnSend(buff, len); } else { char temp[17]; if (m_pSendBuffer->Peak(temp, 17)<17) { len=0; return; } int nLength, nMsgLength; sscanf(temp, "%d:%d", &nMsgLength, &nLength); if (nLength>len+17) { len=0; return; } unsigned int read=0; if ((read=m_pSendBuffer->Peak(buff, nLength+17))<(unsigned int)nLength+17) { len=0; return; } //nLength=read; //g_globals.m_logger.WriteFormated("CLocalDataChannel: Send on data channel %p, sock=%d ip=%s: len=%d", m_pDataChannel, m_sock, "127.0.0.1", nMsgLength); m_pSendBuffer->Drop(nLength+17); char* p=new char[nLength]; memcpy(p, buff+17, nLength); //m_pDataChannel->m_aes.Decrypt((unsigned char*)p, nLength, (unsigned char*)buff); /*CAES aes; aes.SetEncryptKey(m_pDataChannel->m_aes.m_userEncKey, 128); aes.SetDecryptKey(m_pDataChannel->m_aes.m_userDecKey, 128); aes.Decrypt((unsigned char*)p, nLength, (unsigned char*)buff); */ AES_KEY aesKey; AES_set_decrypt_key((unsigned char*)m_pDataChannel->GetSessionKey(), 128, &aesKey); crypt_data((unsigned char*)p, (unsigned char*)buff, nLength, &aesKey, AES_DECRYPT ); delete []p; len=nMsgLength; } } //there are received some data from local server and try to process it //it is a notify message from CClientSocket void CLocalDataChannel::OnReceive(char* buff, int len) { if (len > 0) g_globals.m_logger.WriteFormated("CLocalDataChannel::OnReceive sock = %d len = %d", getSocket(), len); if (!m_pDataChannel->m_bEncryptDecrypt) CDataChannelSocket::OnReceive(buff, len); else { int nLength=len+16-len%16; char temp[18]; memset(temp, 0, 18); sprintf(temp, "%d:%d", len, nLength); char *p=new char[nLength + 17]; memcpy(p, temp, 17); AES_KEY aesKey; AES_set_encrypt_key((unsigned char*)m_pDataChannel->GetSessionKey(), 128, &aesKey); crypt_data((unsigned char*)buff, (unsigned char*)(p + 17), nLength, &aesKey, AES_ENCRYPT); m_pPairChannel->WriteData(p, nLength + 17); delete []p; } m_pPairChannel->Send(); } bool CLocalDataChannel::StartSend() { int ret = Send(); return (ret == 0); } ================================================ FILE: Bundles/Echoware/LocalDataChannel.h ================================================ #ifndef _LOCALDATACHANNELS_H #define _LOCALDATACHANNELS_H #if _MSC_VER > 1000 #pragma once #endif #include "datachannelsocket.h" #define RECONNECT class CDataChannel; //local data channel class class CLocalDataChannel : public CDataChannelSocket { public: CLocalDataChannel(CDataChannel* pDataChannel); virtual ~CLocalDataChannel(void); //notification : there are data to read //[in] len : length of data //[in] buff: data virtual void OnReceive(char* buff, int len); //notification : can send data //[in] len : length of data //[in] buff: data virtual void OnSend(char* buff, int& len); bool StartSend(); protected: bool m_bRFB; }; #endif.30 ================================================ FILE: Bundles/Echoware/LocalListener.cpp ================================================ #include "StdAfx.h" #include "locallistener.h" #include "DataChannel.h" CLocalListener::CLocalListener(CDataChannel* pDataChannel) { m_pDataChannel=pDataChannel; m_bAcceptConnection=false; } CLocalListener::~CLocalListener(void) { Close(); StopAccept(5000); } //notify message //a local client is connected and can create a local data channel void CLocalListener::OnNewClient(unsigned int sock) { APISocket::CSocket sock_obj(sock); sock_obj.SetSockOption(true); m_pDataChannel->OnLocalDataChannel(sock_obj.Detach()); m_bAcceptConnection=false; } void CLocalListener::OnLeaveClient(APISocket::CSocket*) { m_bAcceptConnection=true; } ================================================ FILE: Bundles/Echoware/LocalListener.h ================================================ #ifndef _LOCALLISTENER_H #define _LOCALLISTENER_H #if _MSC_VER > 1000 #pragma once #endif #include "apisocket.h" class CDataChannel; //local listener for clients class CLocalListener : public APISocket::CServerSocket { public: CLocalListener(CDataChannel* pDataChannel); virtual ~CLocalListener(void); //notifications virtual void OnNewClient(unsigned int sock); virtual void OnLeaveClient(APISocket::CSocket* pClient); protected: protected: bool m_bAcceptConnection; CDataChannel* m_pDataChannel; }; #endif ================================================ FILE: Bundles/Echoware/LocalProxyConnection.cpp ================================================ #include "StdAfx.h" #include "LocalProxyConnection.h" CLocalProxyConnection::CLocalProxyConnection(void) { } CLocalProxyConnection::~CLocalProxyConnection(void) { } ================================================ FILE: Bundles/Echoware/LocalProxyConnection.h ================================================ #ifndef _LOCALPROXICONNECT_H #define _LOCALPROXICONNECT_H #if _MSC_VER > 1000 #pragma once #endif #include "proxyconnection.h" class CLocalProxyConnection : public CProxyConnection { public: CLocalProxyConnection(void); virtual ~CLocalProxyConnection(void); }; #endif ================================================ FILE: Bundles/Echoware/Logger.cpp ================================================ #include "StdAfx.h" #include #include "logger.h" //if defined _CONSOLE_ then the logging data are writted to a console, not to a file //#define _CONSOLE_ CLogger::CLogger(bool bLogging, const char* szFilePath) { m_strFilePath=(szFilePath)?(szFilePath):(""); m_bLogging=bLogging; #ifdef _CONSOLE_ AllocConsole(); freopen("CONIN$","rb",stdin); freopen("CONOUT$","wb",stdout); freopen("CONOUT$","wb",stderr); setbuf(stderr, 0); #endif } CLogger::~CLogger(void) { #ifdef _CONSOLE_ FreeConsole(); #endif } void CLogger::SetLogger(bool bLogging) { m_crtSection.Lock(); m_bLogging=bLogging; m_crtSection.Unlock(); } bool CLogger::GetLogger() { m_crtSection.Lock(); return m_bLogging; m_crtSection.Unlock(); } void CLogger::SetLoggerPath(const char* szFilePath) { m_crtSection.Lock(); if (szFilePath) { m_strFilePath=szFilePath; } m_crtSection.Unlock(); } const char* CLogger::GetLoggerPath() { m_crtSection.Lock(); return m_strFilePath.c_str(); m_crtSection.Unlock(); } void CLogger::Write(const char* szText) { m_crtSection.Lock(); if (m_bLogging && !m_strFilePath.empty()) { #ifndef _CONSOLE_ FILE* f=fopen(m_strFilePath.c_str(), "a"); if (f) #endif { time_t theTime; time(&theTime); char* tmp_time = ctime(&theTime); int len_time = strlen(tmp_time); if (tmp_time[len_time - 1] == '\n') tmp_time[len_time - 1] = '\0'; #ifdef _CONSOLE_ fprintf(stdout, "[%s] echoServer : %s\n", tmp_time, szText); #else fprintf(f, "[%s] echoServer : %s\n", tmp_time, szText); fclose(f); #endif } } m_crtSection.Unlock(); } void CLogger::WriteFormated(const char* szFormat, ...) { va_list valist; va_start(valist, szFormat); char szMsg[1024]; vsprintf(szMsg, szFormat, valist); va_end(valist); Write(szMsg); } ================================================ FILE: Bundles/Echoware/Logger.h ================================================ #ifndef _LOGGER_H #define _LOGGER_H #if _MSC_VER > 1000 #pragma once #endif #include #include "CritSection.h" //a generic logger class class CLogger { public: CLogger(bool bLogging=false, const char* szFilePath=0); ~CLogger(void); //set enable/disable loggings void SetLogger(bool bLogging); //get enable/disable loggings bool GetLogger(); //set the logger path void SetLoggerPath(const char* szFilePath); //get the logger path const char* GetLoggerPath(); //write the string to logger file void Write(const char* szText); //write formatted string(like printf) to logger file void WriteFormated(const char* szFormat, ...); protected: std::string m_strFilePath; bool m_bLogging; CCritSection m_crtSection; }; #endif ================================================ FILE: Bundles/Echoware/MyDllProxyInfo.cpp ================================================ /* * MyDllProxyInfo.cpp * Echoware * * Created by Vasya Pupkin on 1/15/07. * Copyright 2007 __MyCompanyName__. All rights reserved. * */ #include "MyDllProxyInfo.h" #include "unistd.h" #include "EchoToOSX.h" CMyDllProxyInfo::CMyDllProxyInfo(IDllProxyInfo *pProxyInfo) { m_pDllProxyInfo = pProxyInfo; m_eStatus = CMyDllProxyInfo::None; m_nPrevStatus = 0; if (m_pDllProxyInfo) m_nPrevStatus = m_pDllProxyInfo->GetStatus(); } CMyDllProxyInfo::~CMyDllProxyInfo() { m_pDllProxyInfo = 0; m_eStatus = CMyDllProxyInfo::None; m_nPrevStatus = 0; } IDllProxyInfo* CMyDllProxyInfo::getDllProxyInfo() { return m_pDllProxyInfo; } void CMyDllProxyInfo::setDllProxyInfo(IDllProxyInfo *pProxyInfo) { m_pDllProxyInfo = pProxyInfo; } CMyDllProxyInfo::STATUS CMyDllProxyInfo::getStatus() { return m_eStatus; } void CMyDllProxyInfo::setStatus(CMyDllProxyInfo::STATUS status) { m_eStatus = status; } void CMyDllProxyInfo::RemoveStatus() { setStatus(CMyDllProxyInfo::None); } int CMyDllProxyInfo::getPrevStatus() { return m_nPrevStatus; } void CMyDllProxyInfo::setPrevStatus(int status) { m_nPrevStatus = status; } bool CMyDllProxyInfo::isStatusChanged(int newStatus) { return (m_nPrevStatus != newStatus); } void CMyDllProxyInfo::WaitForStatus(int status, int timeout, int interval) { if (m_pDllProxyInfo) { int t = 0; while (!(m_pDllProxyInfo->GetStatus() & status)) { Sleep(interval); t += interval; if (timeout > 0 && t >= timeout) break; } } } char* CMyDllProxyInfo::getStatusString() { if (m_pDllProxyInfo) { switch(m_eStatus) { case Connecting: case Reconnecting: return "Connecting..."; case Removing: return "Removing..."; } int status = (int)m_pDllProxyInfo->GetStatus(); if (status & STATUS_SEARCHING_FOR_PARTNER) return "Partner Search Initiated"; else if (status & STATUS_ESTABLISHING_DATA_CHANNEL) return "Establishing Data Channel..."; else if (status & STATUS_AUTHENTICATION_FAILED) return "Authentication Failed"; else if (status & STATUS_AUTHENTICATING) return "Authenticating..."; else if (status & STATUS_DISCONNECTED_FROM_PROXY || !status) return "No Proxy Connection"; else if (status & STATUS_CONNECTED) return "Proxy Channel Connected"; } return ""; } ================================================ FILE: Bundles/Echoware/MyDllProxyInfo.h ================================================ /* * MyDllProxyInfo.h * Echoware * * Created by Vasya Pupkin on 1/15/07. * Copyright 2007 __MyCompanyName__. All rights reserved. * */ #import "Echoware.h" #import "InterfaceDLLProxyInfo.h"∂ class CMyDllProxyInfo { public: enum STATUS {None, Connecting, Removing, Reconnecting}; private: IDllProxyInfo *m_pDllProxyInfo; STATUS m_eStatus; int m_nPrevStatus; public: CMyDllProxyInfo(IDllProxyInfo *pProxyInfo); ~CMyDllProxyInfo(); IDllProxyInfo* getDllProxyInfo(); void setDllProxyInfo(IDllProxyInfo *pProxyInfo); STATUS getStatus(); void setStatus(STATUS status); void RemoveStatus(); int getPrevStatus(); void setPrevStatus(int status); bool isStatusChanged(int newStatus); void WaitForStatus(int status, int timeout = 0, int interval = 50000); char* getStatusString(); }; ================================================ FILE: Bundles/Echoware/NetPacket.h ================================================ #ifndef _NETPACKET_H #define _NETPACKET_H #if _MSC_VER > 1000 #pragma once #endif enum { PROXY_MSG_BASE = WM_USER + 1301, MSG_PROXY_CONNECTED = PROXY_MSG_BASE + 1, // 2326 MSG_PROXY_PUBLICKEY, // 2327 MSG_PROXY_PASSWORD, // 2328 MSG_PROXY_INIT_HANDSHAKE, // 2329 MSG_PROXY_INIT_HANDSHAKEREPLY, //2330 MSG_PROXY_HANDSHAKECONFIRM, // 2331 MSG_PROXY_HANDSHAKECOMPLETE, //2332 MSG_PROXY_HANDSHAKEFAILED, //2333 MSG_PROXY_DISCONNECTED, // 2334 MSG_PROXY_FIND_PARTNER, // 2335 MSG_PROXY_PARTNERNOTFOUND, //2336 MSG_PROXY_PARTNERFOUND, // 2337 MSG_PROXY_VPN_SUCCESSFUL, // 2339//2338 MSG_PROXY_VPN_DISCONNECTED, // 2340//2339 MSG_PROXY_DUPLICATE_LOGIN, // 2341//2340 MSG_ISALIVE, // 2342//2341 MSG_CONNECT_TO_PEER, // 2343//2342 MSG_CHANNEL_CODE, // 2344//2343 MSG_PEER_KEY, // 2345//2344 MSG_DATA_CHANNEL_CONNECT, // 2346//2345 PROXY_MSG_LAST }; #define EF_NET_PACKET_ID "EF1.0" #define PROXY_ECHO "KaboodleProxy_Protocol Version 1.0_Server Version 1.0" enum {PACKET_MESSAGE=1,PACKET_OTHER=2}; struct NetPacketHeader { char id[6];//EF packet and version identifier char type; //type of packet (usually message) long len; NetPacketHeader() { strcpy( id, EF_NET_PACKET_ID ); type = PACKET_MESSAGE; } }; class CProxyMsg { public: UINT messageid;//message or event id BYTE usertype;//user type long datalength;//length of the data following this header //bytearray data;//the actual data CProxyMsg() {} CProxyMsg(DWORD messageid,long datalength=0,BYTE usertype=0) { this->messageid=messageid; this->datalength=datalength; this->usertype=usertype; } int size() { return sizeof(CProxyMsg); } int MakeMessage(NetPacketHeader* pheader,char*& destbuffer,void* datapart=NULL,long datalength=0) { /* int s1 = sizeof(pheader->id); int s2 = sizeof(pheader->type); int s3 = sizeof(pheader->len); int s4 = sizeof(this->messageid); int s5 = sizeof(this->datalength); int s6 = sizeof(this->usertype); int len = s1 + s2 + s3 + s4 + s5 + s6; destbuffer = new char[len]; pheader->len = len; memcpy(destbuffer, pheader->id, s1); memcpy(destbuffer + s1, &pheader->type, s2); DWORD tmp = OSSwapHostToLittleInt32(pheader->len); memcpy(destbuffer + s1 + s2, &tmp, s3); this->datalength=datalength; tmp = OSSwapHostToLittleInt32(this->messageid); memcpy(destbuffer + s1 + s2 + s3, &tmp, s4); memcpy(destbuffer + s1 + s2 + s3 + s4, &this->usertype, s5); tmp = OSSwapHostToLittleInt32(this->datalength); memcpy(destbuffer + s1 + s2 + s3 + s4 + s5, &tmp, s6); if (datapart) //copy data memcpy(destbuffer + len, datapart, datalength); return len; */ int headersize=sizeof(NetPacketHeader); int mysize=sizeof(CProxyMsg); destbuffer=new char[headersize+mysize+datalength]; memset(destbuffer, 0, headersize+mysize+datalength); pheader->len=OSSwapHostToLittleInt32(headersize+mysize+datalength); memcpy(destbuffer, &pheader->id, sizeof(pheader->id)); WORD tmp1 = pheader->type; memcpy(destbuffer + sizeof(pheader->id), &tmp1, sizeof(tmp1)); DWORD tmp2 = pheader->len; memcpy(destbuffer + sizeof(pheader->id) + sizeof(tmp1), &tmp2, sizeof(tmp2)); // memcpy(destbuffer,pheader,headersize); //copy packet header pheader->len=headersize+mysize+datalength; // Swap to LE this->messageid=OSSwapHostToLittleInt32(messageid); this->datalength=OSSwapHostToLittleInt32(datalength); DWORD tmp = this->messageid; memcpy(destbuffer + headersize, &tmp, sizeof(tmp)); tmp = this->usertype; tmp = OSSwapHostToLittleInt32(tmp); memcpy(destbuffer + headersize + sizeof(tmp), &tmp, sizeof(tmp)); tmp = this->datalength; memcpy(destbuffer + headersize + sizeof(tmp) + sizeof(tmp), &tmp, sizeof(tmp)); //memcpy(destbuffer+headersize,this,mysize); //copy message descriptor // Reverse this->messageid=OSSwapLittleToHostInt32(messageid); this->datalength=datalength; if (datapart) //copy data memcpy(destbuffer+headersize+mysize,datapart,datalength); return headersize+mysize+datalength; } }; #endif ================================================ FILE: Bundles/Echoware/OpenSSL/LibeaySt.dsp ================================================ # Microsoft Developer Studio Project File - Name="LibeaySt" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Static Library" 0x0104 CFG=LibeaySt - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "LibeaySt.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "LibeaySt.mak" CFG="LibeaySt - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "LibeaySt - Win32 Release" (based on "Win32 (x86) Static Library") !MESSAGE "LibeaySt - Win32 Debug" (based on "Win32 (x86) Static Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "LibeaySt - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release6" # PROP Intermediate_Dir "Release6" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD BASE RSC /l 0x419 /d "NDEBUG" # ADD RSC /l 0x419 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo /out:"..\Release6\LibeaySt.lib" !ELSEIF "$(CFG)" == "LibeaySt - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug6" # PROP Intermediate_Dir "Debug6" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c # ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c # ADD BASE RSC /l 0x419 /d "_DEBUG" # ADD RSC /l 0x419 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo /out:"..\Debug6\LibeaySt.lib" !ENDIF # Begin Target # Name "LibeaySt - Win32 Release" # Name "LibeaySt - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=.\aes_core.c # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=.\aes.h # End Source File # Begin Source File SOURCE=.\aes_locl.h # End Source File # Begin Source File SOURCE=.\e_os2.h # End Source File # Begin Source File SOURCE=.\opensslconf.h # End Source File # End Group # End Target # End Project ================================================ FILE: Bundles/Echoware/OpenSSL/LibeaySt.vcproj ================================================ ================================================ FILE: Bundles/Echoware/OpenSSL/aes.h ================================================ /* crypto/aes/aes.h -*- mode:C; c-file-style: "eay" -*- */ /* ==================================================================== * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * */ #ifndef HEADER_AES_H #define HEADER_AES_H #include "e_os2.h" #ifdef OPENSSL_NO_AES #error AES is disabled. #endif #define AES_ENCRYPT 1 #define AES_DECRYPT 0 /* Because array size can't be a const in C, the following two are macros. Both sizes are in bytes. */ #define AES_MAXNR 14 #define AES_BLOCK_SIZE 16 #if defined(OPENSSL_FIPS) #define FIPS_AES_SIZE_T int #endif #ifdef __cplusplus extern "C" { #endif /* This should be a hidden type, but EVP requires that the size be known */ struct aes_key_st { unsigned int rd_key[4 *(AES_MAXNR + 1)]; int rounds; }; typedef struct aes_key_st AES_KEY; const char *AES_options(void); int AES_set_encrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key); int AES_set_decrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key); void AES_encrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key); void AES_decrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key); void AES_ecb_encrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key, const int enc); void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, const unsigned long length, const AES_KEY *key, unsigned char *ivec, const int enc); void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, const unsigned long length, const AES_KEY *key, unsigned char *ivec, int *num, const int enc); void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, const unsigned long length, const AES_KEY *key, unsigned char *ivec, int *num, const int enc); void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, const unsigned long length, const AES_KEY *key, unsigned char *ivec, int *num, const int enc); void AES_cfbr_encrypt_block(const unsigned char *in,unsigned char *out, const int nbits,const AES_KEY *key, unsigned char *ivec,const int enc); void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, const unsigned long length, const AES_KEY *key, unsigned char *ivec, int *num); void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out, const unsigned long length, const AES_KEY *key, unsigned char ivec[AES_BLOCK_SIZE], unsigned char ecount_buf[AES_BLOCK_SIZE], unsigned int *num); #ifdef __cplusplus } #endif #endif /* !HEADER_AES_H */ ================================================ FILE: Bundles/Echoware/OpenSSL/aes_core.c ================================================ /* crypto/aes/aes_core.c -*- mode:C; c-file-style: "eay" -*- */ /** * rijndael-alg-fst.c * * @version 3.0 (December 2000) * * Optimised ANSI C code for the Rijndael cipher (now AES) * * @author Vincent Rijmen * @author Antoon Bosselaers * @author Paulo Barreto * * This code is hereby placed in the public domain. * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* Note: rewritten a little bit to provide error control and an OpenSSL- compatible API */ #ifndef AES_DEBUG # ifndef NDEBUG # define NDEBUG # endif #endif #include #include #include "aes.h" #include "aes_locl.h" /* Te0[x] = S [x].[02, 01, 01, 03]; Te1[x] = S [x].[03, 02, 01, 01]; Te2[x] = S [x].[01, 03, 02, 01]; Te3[x] = S [x].[01, 01, 03, 02]; Te4[x] = S [x].[01, 01, 01, 01]; Td0[x] = Si[x].[0e, 09, 0d, 0b]; Td1[x] = Si[x].[0b, 0e, 09, 0d]; Td2[x] = Si[x].[0d, 0b, 0e, 09]; Td3[x] = Si[x].[09, 0d, 0b, 0e]; Td4[x] = Si[x].[01, 01, 01, 01]; */ #ifdef AES_ASM extern const u32 AES_Te[5][256]; #define Te0 AES_Te[0] #define Te1 AES_Te[1] #define Te2 AES_Te[2] #define Te3 AES_Te[3] #else static const u32 Te0[256] = { 0xc66363a5U, 0xf87c7c84U, 0xee777799U, 0xf67b7b8dU, 0xfff2f20dU, 0xd66b6bbdU, 0xde6f6fb1U, 0x91c5c554U, 0x60303050U, 0x02010103U, 0xce6767a9U, 0x562b2b7dU, 0xe7fefe19U, 0xb5d7d762U, 0x4dababe6U, 0xec76769aU, 0x8fcaca45U, 0x1f82829dU, 0x89c9c940U, 0xfa7d7d87U, 0xeffafa15U, 0xb25959ebU, 0x8e4747c9U, 0xfbf0f00bU, 0x41adadecU, 0xb3d4d467U, 0x5fa2a2fdU, 0x45afafeaU, 0x239c9cbfU, 0x53a4a4f7U, 0xe4727296U, 0x9bc0c05bU, 0x75b7b7c2U, 0xe1fdfd1cU, 0x3d9393aeU, 0x4c26266aU, 0x6c36365aU, 0x7e3f3f41U, 0xf5f7f702U, 0x83cccc4fU, 0x6834345cU, 0x51a5a5f4U, 0xd1e5e534U, 0xf9f1f108U, 0xe2717193U, 0xabd8d873U, 0x62313153U, 0x2a15153fU, 0x0804040cU, 0x95c7c752U, 0x46232365U, 0x9dc3c35eU, 0x30181828U, 0x379696a1U, 0x0a05050fU, 0x2f9a9ab5U, 0x0e070709U, 0x24121236U, 0x1b80809bU, 0xdfe2e23dU, 0xcdebeb26U, 0x4e272769U, 0x7fb2b2cdU, 0xea75759fU, 0x1209091bU, 0x1d83839eU, 0x582c2c74U, 0x341a1a2eU, 0x361b1b2dU, 0xdc6e6eb2U, 0xb45a5aeeU, 0x5ba0a0fbU, 0xa45252f6U, 0x763b3b4dU, 0xb7d6d661U, 0x7db3b3ceU, 0x5229297bU, 0xdde3e33eU, 0x5e2f2f71U, 0x13848497U, 0xa65353f5U, 0xb9d1d168U, 0x00000000U, 0xc1eded2cU, 0x40202060U, 0xe3fcfc1fU, 0x79b1b1c8U, 0xb65b5bedU, 0xd46a6abeU, 0x8dcbcb46U, 0x67bebed9U, 0x7239394bU, 0x944a4adeU, 0x984c4cd4U, 0xb05858e8U, 0x85cfcf4aU, 0xbbd0d06bU, 0xc5efef2aU, 0x4faaaae5U, 0xedfbfb16U, 0x864343c5U, 0x9a4d4dd7U, 0x66333355U, 0x11858594U, 0x8a4545cfU, 0xe9f9f910U, 0x04020206U, 0xfe7f7f81U, 0xa05050f0U, 0x783c3c44U, 0x259f9fbaU, 0x4ba8a8e3U, 0xa25151f3U, 0x5da3a3feU, 0x804040c0U, 0x058f8f8aU, 0x3f9292adU, 0x219d9dbcU, 0x70383848U, 0xf1f5f504U, 0x63bcbcdfU, 0x77b6b6c1U, 0xafdada75U, 0x42212163U, 0x20101030U, 0xe5ffff1aU, 0xfdf3f30eU, 0xbfd2d26dU, 0x81cdcd4cU, 0x180c0c14U, 0x26131335U, 0xc3ecec2fU, 0xbe5f5fe1U, 0x359797a2U, 0x884444ccU, 0x2e171739U, 0x93c4c457U, 0x55a7a7f2U, 0xfc7e7e82U, 0x7a3d3d47U, 0xc86464acU, 0xba5d5de7U, 0x3219192bU, 0xe6737395U, 0xc06060a0U, 0x19818198U, 0x9e4f4fd1U, 0xa3dcdc7fU, 0x44222266U, 0x542a2a7eU, 0x3b9090abU, 0x0b888883U, 0x8c4646caU, 0xc7eeee29U, 0x6bb8b8d3U, 0x2814143cU, 0xa7dede79U, 0xbc5e5ee2U, 0x160b0b1dU, 0xaddbdb76U, 0xdbe0e03bU, 0x64323256U, 0x743a3a4eU, 0x140a0a1eU, 0x924949dbU, 0x0c06060aU, 0x4824246cU, 0xb85c5ce4U, 0x9fc2c25dU, 0xbdd3d36eU, 0x43acacefU, 0xc46262a6U, 0x399191a8U, 0x319595a4U, 0xd3e4e437U, 0xf279798bU, 0xd5e7e732U, 0x8bc8c843U, 0x6e373759U, 0xda6d6db7U, 0x018d8d8cU, 0xb1d5d564U, 0x9c4e4ed2U, 0x49a9a9e0U, 0xd86c6cb4U, 0xac5656faU, 0xf3f4f407U, 0xcfeaea25U, 0xca6565afU, 0xf47a7a8eU, 0x47aeaee9U, 0x10080818U, 0x6fbabad5U, 0xf0787888U, 0x4a25256fU, 0x5c2e2e72U, 0x381c1c24U, 0x57a6a6f1U, 0x73b4b4c7U, 0x97c6c651U, 0xcbe8e823U, 0xa1dddd7cU, 0xe874749cU, 0x3e1f1f21U, 0x964b4bddU, 0x61bdbddcU, 0x0d8b8b86U, 0x0f8a8a85U, 0xe0707090U, 0x7c3e3e42U, 0x71b5b5c4U, 0xcc6666aaU, 0x904848d8U, 0x06030305U, 0xf7f6f601U, 0x1c0e0e12U, 0xc26161a3U, 0x6a35355fU, 0xae5757f9U, 0x69b9b9d0U, 0x17868691U, 0x99c1c158U, 0x3a1d1d27U, 0x279e9eb9U, 0xd9e1e138U, 0xebf8f813U, 0x2b9898b3U, 0x22111133U, 0xd26969bbU, 0xa9d9d970U, 0x078e8e89U, 0x339494a7U, 0x2d9b9bb6U, 0x3c1e1e22U, 0x15878792U, 0xc9e9e920U, 0x87cece49U, 0xaa5555ffU, 0x50282878U, 0xa5dfdf7aU, 0x038c8c8fU, 0x59a1a1f8U, 0x09898980U, 0x1a0d0d17U, 0x65bfbfdaU, 0xd7e6e631U, 0x844242c6U, 0xd06868b8U, 0x824141c3U, 0x299999b0U, 0x5a2d2d77U, 0x1e0f0f11U, 0x7bb0b0cbU, 0xa85454fcU, 0x6dbbbbd6U, 0x2c16163aU, }; static const u32 Te1[256] = { 0xa5c66363U, 0x84f87c7cU, 0x99ee7777U, 0x8df67b7bU, 0x0dfff2f2U, 0xbdd66b6bU, 0xb1de6f6fU, 0x5491c5c5U, 0x50603030U, 0x03020101U, 0xa9ce6767U, 0x7d562b2bU, 0x19e7fefeU, 0x62b5d7d7U, 0xe64dababU, 0x9aec7676U, 0x458fcacaU, 0x9d1f8282U, 0x4089c9c9U, 0x87fa7d7dU, 0x15effafaU, 0xebb25959U, 0xc98e4747U, 0x0bfbf0f0U, 0xec41adadU, 0x67b3d4d4U, 0xfd5fa2a2U, 0xea45afafU, 0xbf239c9cU, 0xf753a4a4U, 0x96e47272U, 0x5b9bc0c0U, 0xc275b7b7U, 0x1ce1fdfdU, 0xae3d9393U, 0x6a4c2626U, 0x5a6c3636U, 0x417e3f3fU, 0x02f5f7f7U, 0x4f83ccccU, 0x5c683434U, 0xf451a5a5U, 0x34d1e5e5U, 0x08f9f1f1U, 0x93e27171U, 0x73abd8d8U, 0x53623131U, 0x3f2a1515U, 0x0c080404U, 0x5295c7c7U, 0x65462323U, 0x5e9dc3c3U, 0x28301818U, 0xa1379696U, 0x0f0a0505U, 0xb52f9a9aU, 0x090e0707U, 0x36241212U, 0x9b1b8080U, 0x3ddfe2e2U, 0x26cdebebU, 0x694e2727U, 0xcd7fb2b2U, 0x9fea7575U, 0x1b120909U, 0x9e1d8383U, 0x74582c2cU, 0x2e341a1aU, 0x2d361b1bU, 0xb2dc6e6eU, 0xeeb45a5aU, 0xfb5ba0a0U, 0xf6a45252U, 0x4d763b3bU, 0x61b7d6d6U, 0xce7db3b3U, 0x7b522929U, 0x3edde3e3U, 0x715e2f2fU, 0x97138484U, 0xf5a65353U, 0x68b9d1d1U, 0x00000000U, 0x2cc1ededU, 0x60402020U, 0x1fe3fcfcU, 0xc879b1b1U, 0xedb65b5bU, 0xbed46a6aU, 0x468dcbcbU, 0xd967bebeU, 0x4b723939U, 0xde944a4aU, 0xd4984c4cU, 0xe8b05858U, 0x4a85cfcfU, 0x6bbbd0d0U, 0x2ac5efefU, 0xe54faaaaU, 0x16edfbfbU, 0xc5864343U, 0xd79a4d4dU, 0x55663333U, 0x94118585U, 0xcf8a4545U, 0x10e9f9f9U, 0x06040202U, 0x81fe7f7fU, 0xf0a05050U, 0x44783c3cU, 0xba259f9fU, 0xe34ba8a8U, 0xf3a25151U, 0xfe5da3a3U, 0xc0804040U, 0x8a058f8fU, 0xad3f9292U, 0xbc219d9dU, 0x48703838U, 0x04f1f5f5U, 0xdf63bcbcU, 0xc177b6b6U, 0x75afdadaU, 0x63422121U, 0x30201010U, 0x1ae5ffffU, 0x0efdf3f3U, 0x6dbfd2d2U, 0x4c81cdcdU, 0x14180c0cU, 0x35261313U, 0x2fc3ececU, 0xe1be5f5fU, 0xa2359797U, 0xcc884444U, 0x392e1717U, 0x5793c4c4U, 0xf255a7a7U, 0x82fc7e7eU, 0x477a3d3dU, 0xacc86464U, 0xe7ba5d5dU, 0x2b321919U, 0x95e67373U, 0xa0c06060U, 0x98198181U, 0xd19e4f4fU, 0x7fa3dcdcU, 0x66442222U, 0x7e542a2aU, 0xab3b9090U, 0x830b8888U, 0xca8c4646U, 0x29c7eeeeU, 0xd36bb8b8U, 0x3c281414U, 0x79a7dedeU, 0xe2bc5e5eU, 0x1d160b0bU, 0x76addbdbU, 0x3bdbe0e0U, 0x56643232U, 0x4e743a3aU, 0x1e140a0aU, 0xdb924949U, 0x0a0c0606U, 0x6c482424U, 0xe4b85c5cU, 0x5d9fc2c2U, 0x6ebdd3d3U, 0xef43acacU, 0xa6c46262U, 0xa8399191U, 0xa4319595U, 0x37d3e4e4U, 0x8bf27979U, 0x32d5e7e7U, 0x438bc8c8U, 0x596e3737U, 0xb7da6d6dU, 0x8c018d8dU, 0x64b1d5d5U, 0xd29c4e4eU, 0xe049a9a9U, 0xb4d86c6cU, 0xfaac5656U, 0x07f3f4f4U, 0x25cfeaeaU, 0xafca6565U, 0x8ef47a7aU, 0xe947aeaeU, 0x18100808U, 0xd56fbabaU, 0x88f07878U, 0x6f4a2525U, 0x725c2e2eU, 0x24381c1cU, 0xf157a6a6U, 0xc773b4b4U, 0x5197c6c6U, 0x23cbe8e8U, 0x7ca1ddddU, 0x9ce87474U, 0x213e1f1fU, 0xdd964b4bU, 0xdc61bdbdU, 0x860d8b8bU, 0x850f8a8aU, 0x90e07070U, 0x427c3e3eU, 0xc471b5b5U, 0xaacc6666U, 0xd8904848U, 0x05060303U, 0x01f7f6f6U, 0x121c0e0eU, 0xa3c26161U, 0x5f6a3535U, 0xf9ae5757U, 0xd069b9b9U, 0x91178686U, 0x5899c1c1U, 0x273a1d1dU, 0xb9279e9eU, 0x38d9e1e1U, 0x13ebf8f8U, 0xb32b9898U, 0x33221111U, 0xbbd26969U, 0x70a9d9d9U, 0x89078e8eU, 0xa7339494U, 0xb62d9b9bU, 0x223c1e1eU, 0x92158787U, 0x20c9e9e9U, 0x4987ceceU, 0xffaa5555U, 0x78502828U, 0x7aa5dfdfU, 0x8f038c8cU, 0xf859a1a1U, 0x80098989U, 0x171a0d0dU, 0xda65bfbfU, 0x31d7e6e6U, 0xc6844242U, 0xb8d06868U, 0xc3824141U, 0xb0299999U, 0x775a2d2dU, 0x111e0f0fU, 0xcb7bb0b0U, 0xfca85454U, 0xd66dbbbbU, 0x3a2c1616U, }; static const u32 Te2[256] = { 0x63a5c663U, 0x7c84f87cU, 0x7799ee77U, 0x7b8df67bU, 0xf20dfff2U, 0x6bbdd66bU, 0x6fb1de6fU, 0xc55491c5U, 0x30506030U, 0x01030201U, 0x67a9ce67U, 0x2b7d562bU, 0xfe19e7feU, 0xd762b5d7U, 0xabe64dabU, 0x769aec76U, 0xca458fcaU, 0x829d1f82U, 0xc94089c9U, 0x7d87fa7dU, 0xfa15effaU, 0x59ebb259U, 0x47c98e47U, 0xf00bfbf0U, 0xadec41adU, 0xd467b3d4U, 0xa2fd5fa2U, 0xafea45afU, 0x9cbf239cU, 0xa4f753a4U, 0x7296e472U, 0xc05b9bc0U, 0xb7c275b7U, 0xfd1ce1fdU, 0x93ae3d93U, 0x266a4c26U, 0x365a6c36U, 0x3f417e3fU, 0xf702f5f7U, 0xcc4f83ccU, 0x345c6834U, 0xa5f451a5U, 0xe534d1e5U, 0xf108f9f1U, 0x7193e271U, 0xd873abd8U, 0x31536231U, 0x153f2a15U, 0x040c0804U, 0xc75295c7U, 0x23654623U, 0xc35e9dc3U, 0x18283018U, 0x96a13796U, 0x050f0a05U, 0x9ab52f9aU, 0x07090e07U, 0x12362412U, 0x809b1b80U, 0xe23ddfe2U, 0xeb26cdebU, 0x27694e27U, 0xb2cd7fb2U, 0x759fea75U, 0x091b1209U, 0x839e1d83U, 0x2c74582cU, 0x1a2e341aU, 0x1b2d361bU, 0x6eb2dc6eU, 0x5aeeb45aU, 0xa0fb5ba0U, 0x52f6a452U, 0x3b4d763bU, 0xd661b7d6U, 0xb3ce7db3U, 0x297b5229U, 0xe33edde3U, 0x2f715e2fU, 0x84971384U, 0x53f5a653U, 0xd168b9d1U, 0x00000000U, 0xed2cc1edU, 0x20604020U, 0xfc1fe3fcU, 0xb1c879b1U, 0x5bedb65bU, 0x6abed46aU, 0xcb468dcbU, 0xbed967beU, 0x394b7239U, 0x4ade944aU, 0x4cd4984cU, 0x58e8b058U, 0xcf4a85cfU, 0xd06bbbd0U, 0xef2ac5efU, 0xaae54faaU, 0xfb16edfbU, 0x43c58643U, 0x4dd79a4dU, 0x33556633U, 0x85941185U, 0x45cf8a45U, 0xf910e9f9U, 0x02060402U, 0x7f81fe7fU, 0x50f0a050U, 0x3c44783cU, 0x9fba259fU, 0xa8e34ba8U, 0x51f3a251U, 0xa3fe5da3U, 0x40c08040U, 0x8f8a058fU, 0x92ad3f92U, 0x9dbc219dU, 0x38487038U, 0xf504f1f5U, 0xbcdf63bcU, 0xb6c177b6U, 0xda75afdaU, 0x21634221U, 0x10302010U, 0xff1ae5ffU, 0xf30efdf3U, 0xd26dbfd2U, 0xcd4c81cdU, 0x0c14180cU, 0x13352613U, 0xec2fc3ecU, 0x5fe1be5fU, 0x97a23597U, 0x44cc8844U, 0x17392e17U, 0xc45793c4U, 0xa7f255a7U, 0x7e82fc7eU, 0x3d477a3dU, 0x64acc864U, 0x5de7ba5dU, 0x192b3219U, 0x7395e673U, 0x60a0c060U, 0x81981981U, 0x4fd19e4fU, 0xdc7fa3dcU, 0x22664422U, 0x2a7e542aU, 0x90ab3b90U, 0x88830b88U, 0x46ca8c46U, 0xee29c7eeU, 0xb8d36bb8U, 0x143c2814U, 0xde79a7deU, 0x5ee2bc5eU, 0x0b1d160bU, 0xdb76addbU, 0xe03bdbe0U, 0x32566432U, 0x3a4e743aU, 0x0a1e140aU, 0x49db9249U, 0x060a0c06U, 0x246c4824U, 0x5ce4b85cU, 0xc25d9fc2U, 0xd36ebdd3U, 0xacef43acU, 0x62a6c462U, 0x91a83991U, 0x95a43195U, 0xe437d3e4U, 0x798bf279U, 0xe732d5e7U, 0xc8438bc8U, 0x37596e37U, 0x6db7da6dU, 0x8d8c018dU, 0xd564b1d5U, 0x4ed29c4eU, 0xa9e049a9U, 0x6cb4d86cU, 0x56faac56U, 0xf407f3f4U, 0xea25cfeaU, 0x65afca65U, 0x7a8ef47aU, 0xaee947aeU, 0x08181008U, 0xbad56fbaU, 0x7888f078U, 0x256f4a25U, 0x2e725c2eU, 0x1c24381cU, 0xa6f157a6U, 0xb4c773b4U, 0xc65197c6U, 0xe823cbe8U, 0xdd7ca1ddU, 0x749ce874U, 0x1f213e1fU, 0x4bdd964bU, 0xbddc61bdU, 0x8b860d8bU, 0x8a850f8aU, 0x7090e070U, 0x3e427c3eU, 0xb5c471b5U, 0x66aacc66U, 0x48d89048U, 0x03050603U, 0xf601f7f6U, 0x0e121c0eU, 0x61a3c261U, 0x355f6a35U, 0x57f9ae57U, 0xb9d069b9U, 0x86911786U, 0xc15899c1U, 0x1d273a1dU, 0x9eb9279eU, 0xe138d9e1U, 0xf813ebf8U, 0x98b32b98U, 0x11332211U, 0x69bbd269U, 0xd970a9d9U, 0x8e89078eU, 0x94a73394U, 0x9bb62d9bU, 0x1e223c1eU, 0x87921587U, 0xe920c9e9U, 0xce4987ceU, 0x55ffaa55U, 0x28785028U, 0xdf7aa5dfU, 0x8c8f038cU, 0xa1f859a1U, 0x89800989U, 0x0d171a0dU, 0xbfda65bfU, 0xe631d7e6U, 0x42c68442U, 0x68b8d068U, 0x41c38241U, 0x99b02999U, 0x2d775a2dU, 0x0f111e0fU, 0xb0cb7bb0U, 0x54fca854U, 0xbbd66dbbU, 0x163a2c16U, }; static const u32 Te3[256] = { 0x6363a5c6U, 0x7c7c84f8U, 0x777799eeU, 0x7b7b8df6U, 0xf2f20dffU, 0x6b6bbdd6U, 0x6f6fb1deU, 0xc5c55491U, 0x30305060U, 0x01010302U, 0x6767a9ceU, 0x2b2b7d56U, 0xfefe19e7U, 0xd7d762b5U, 0xababe64dU, 0x76769aecU, 0xcaca458fU, 0x82829d1fU, 0xc9c94089U, 0x7d7d87faU, 0xfafa15efU, 0x5959ebb2U, 0x4747c98eU, 0xf0f00bfbU, 0xadadec41U, 0xd4d467b3U, 0xa2a2fd5fU, 0xafafea45U, 0x9c9cbf23U, 0xa4a4f753U, 0x727296e4U, 0xc0c05b9bU, 0xb7b7c275U, 0xfdfd1ce1U, 0x9393ae3dU, 0x26266a4cU, 0x36365a6cU, 0x3f3f417eU, 0xf7f702f5U, 0xcccc4f83U, 0x34345c68U, 0xa5a5f451U, 0xe5e534d1U, 0xf1f108f9U, 0x717193e2U, 0xd8d873abU, 0x31315362U, 0x15153f2aU, 0x04040c08U, 0xc7c75295U, 0x23236546U, 0xc3c35e9dU, 0x18182830U, 0x9696a137U, 0x05050f0aU, 0x9a9ab52fU, 0x0707090eU, 0x12123624U, 0x80809b1bU, 0xe2e23ddfU, 0xebeb26cdU, 0x2727694eU, 0xb2b2cd7fU, 0x75759feaU, 0x09091b12U, 0x83839e1dU, 0x2c2c7458U, 0x1a1a2e34U, 0x1b1b2d36U, 0x6e6eb2dcU, 0x5a5aeeb4U, 0xa0a0fb5bU, 0x5252f6a4U, 0x3b3b4d76U, 0xd6d661b7U, 0xb3b3ce7dU, 0x29297b52U, 0xe3e33eddU, 0x2f2f715eU, 0x84849713U, 0x5353f5a6U, 0xd1d168b9U, 0x00000000U, 0xeded2cc1U, 0x20206040U, 0xfcfc1fe3U, 0xb1b1c879U, 0x5b5bedb6U, 0x6a6abed4U, 0xcbcb468dU, 0xbebed967U, 0x39394b72U, 0x4a4ade94U, 0x4c4cd498U, 0x5858e8b0U, 0xcfcf4a85U, 0xd0d06bbbU, 0xefef2ac5U, 0xaaaae54fU, 0xfbfb16edU, 0x4343c586U, 0x4d4dd79aU, 0x33335566U, 0x85859411U, 0x4545cf8aU, 0xf9f910e9U, 0x02020604U, 0x7f7f81feU, 0x5050f0a0U, 0x3c3c4478U, 0x9f9fba25U, 0xa8a8e34bU, 0x5151f3a2U, 0xa3a3fe5dU, 0x4040c080U, 0x8f8f8a05U, 0x9292ad3fU, 0x9d9dbc21U, 0x38384870U, 0xf5f504f1U, 0xbcbcdf63U, 0xb6b6c177U, 0xdada75afU, 0x21216342U, 0x10103020U, 0xffff1ae5U, 0xf3f30efdU, 0xd2d26dbfU, 0xcdcd4c81U, 0x0c0c1418U, 0x13133526U, 0xecec2fc3U, 0x5f5fe1beU, 0x9797a235U, 0x4444cc88U, 0x1717392eU, 0xc4c45793U, 0xa7a7f255U, 0x7e7e82fcU, 0x3d3d477aU, 0x6464acc8U, 0x5d5de7baU, 0x19192b32U, 0x737395e6U, 0x6060a0c0U, 0x81819819U, 0x4f4fd19eU, 0xdcdc7fa3U, 0x22226644U, 0x2a2a7e54U, 0x9090ab3bU, 0x8888830bU, 0x4646ca8cU, 0xeeee29c7U, 0xb8b8d36bU, 0x14143c28U, 0xdede79a7U, 0x5e5ee2bcU, 0x0b0b1d16U, 0xdbdb76adU, 0xe0e03bdbU, 0x32325664U, 0x3a3a4e74U, 0x0a0a1e14U, 0x4949db92U, 0x06060a0cU, 0x24246c48U, 0x5c5ce4b8U, 0xc2c25d9fU, 0xd3d36ebdU, 0xacacef43U, 0x6262a6c4U, 0x9191a839U, 0x9595a431U, 0xe4e437d3U, 0x79798bf2U, 0xe7e732d5U, 0xc8c8438bU, 0x3737596eU, 0x6d6db7daU, 0x8d8d8c01U, 0xd5d564b1U, 0x4e4ed29cU, 0xa9a9e049U, 0x6c6cb4d8U, 0x5656faacU, 0xf4f407f3U, 0xeaea25cfU, 0x6565afcaU, 0x7a7a8ef4U, 0xaeaee947U, 0x08081810U, 0xbabad56fU, 0x787888f0U, 0x25256f4aU, 0x2e2e725cU, 0x1c1c2438U, 0xa6a6f157U, 0xb4b4c773U, 0xc6c65197U, 0xe8e823cbU, 0xdddd7ca1U, 0x74749ce8U, 0x1f1f213eU, 0x4b4bdd96U, 0xbdbddc61U, 0x8b8b860dU, 0x8a8a850fU, 0x707090e0U, 0x3e3e427cU, 0xb5b5c471U, 0x6666aaccU, 0x4848d890U, 0x03030506U, 0xf6f601f7U, 0x0e0e121cU, 0x6161a3c2U, 0x35355f6aU, 0x5757f9aeU, 0xb9b9d069U, 0x86869117U, 0xc1c15899U, 0x1d1d273aU, 0x9e9eb927U, 0xe1e138d9U, 0xf8f813ebU, 0x9898b32bU, 0x11113322U, 0x6969bbd2U, 0xd9d970a9U, 0x8e8e8907U, 0x9494a733U, 0x9b9bb62dU, 0x1e1e223cU, 0x87879215U, 0xe9e920c9U, 0xcece4987U, 0x5555ffaaU, 0x28287850U, 0xdfdf7aa5U, 0x8c8c8f03U, 0xa1a1f859U, 0x89898009U, 0x0d0d171aU, 0xbfbfda65U, 0xe6e631d7U, 0x4242c684U, 0x6868b8d0U, 0x4141c382U, 0x9999b029U, 0x2d2d775aU, 0x0f0f111eU, 0xb0b0cb7bU, 0x5454fca8U, 0xbbbbd66dU, 0x16163a2cU, }; #endif static const u32 Te4[256] = { 0x63636363U, 0x7c7c7c7cU, 0x77777777U, 0x7b7b7b7bU, 0xf2f2f2f2U, 0x6b6b6b6bU, 0x6f6f6f6fU, 0xc5c5c5c5U, 0x30303030U, 0x01010101U, 0x67676767U, 0x2b2b2b2bU, 0xfefefefeU, 0xd7d7d7d7U, 0xababababU, 0x76767676U, 0xcacacacaU, 0x82828282U, 0xc9c9c9c9U, 0x7d7d7d7dU, 0xfafafafaU, 0x59595959U, 0x47474747U, 0xf0f0f0f0U, 0xadadadadU, 0xd4d4d4d4U, 0xa2a2a2a2U, 0xafafafafU, 0x9c9c9c9cU, 0xa4a4a4a4U, 0x72727272U, 0xc0c0c0c0U, 0xb7b7b7b7U, 0xfdfdfdfdU, 0x93939393U, 0x26262626U, 0x36363636U, 0x3f3f3f3fU, 0xf7f7f7f7U, 0xccccccccU, 0x34343434U, 0xa5a5a5a5U, 0xe5e5e5e5U, 0xf1f1f1f1U, 0x71717171U, 0xd8d8d8d8U, 0x31313131U, 0x15151515U, 0x04040404U, 0xc7c7c7c7U, 0x23232323U, 0xc3c3c3c3U, 0x18181818U, 0x96969696U, 0x05050505U, 0x9a9a9a9aU, 0x07070707U, 0x12121212U, 0x80808080U, 0xe2e2e2e2U, 0xebebebebU, 0x27272727U, 0xb2b2b2b2U, 0x75757575U, 0x09090909U, 0x83838383U, 0x2c2c2c2cU, 0x1a1a1a1aU, 0x1b1b1b1bU, 0x6e6e6e6eU, 0x5a5a5a5aU, 0xa0a0a0a0U, 0x52525252U, 0x3b3b3b3bU, 0xd6d6d6d6U, 0xb3b3b3b3U, 0x29292929U, 0xe3e3e3e3U, 0x2f2f2f2fU, 0x84848484U, 0x53535353U, 0xd1d1d1d1U, 0x00000000U, 0xededededU, 0x20202020U, 0xfcfcfcfcU, 0xb1b1b1b1U, 0x5b5b5b5bU, 0x6a6a6a6aU, 0xcbcbcbcbU, 0xbebebebeU, 0x39393939U, 0x4a4a4a4aU, 0x4c4c4c4cU, 0x58585858U, 0xcfcfcfcfU, 0xd0d0d0d0U, 0xefefefefU, 0xaaaaaaaaU, 0xfbfbfbfbU, 0x43434343U, 0x4d4d4d4dU, 0x33333333U, 0x85858585U, 0x45454545U, 0xf9f9f9f9U, 0x02020202U, 0x7f7f7f7fU, 0x50505050U, 0x3c3c3c3cU, 0x9f9f9f9fU, 0xa8a8a8a8U, 0x51515151U, 0xa3a3a3a3U, 0x40404040U, 0x8f8f8f8fU, 0x92929292U, 0x9d9d9d9dU, 0x38383838U, 0xf5f5f5f5U, 0xbcbcbcbcU, 0xb6b6b6b6U, 0xdadadadaU, 0x21212121U, 0x10101010U, 0xffffffffU, 0xf3f3f3f3U, 0xd2d2d2d2U, 0xcdcdcdcdU, 0x0c0c0c0cU, 0x13131313U, 0xececececU, 0x5f5f5f5fU, 0x97979797U, 0x44444444U, 0x17171717U, 0xc4c4c4c4U, 0xa7a7a7a7U, 0x7e7e7e7eU, 0x3d3d3d3dU, 0x64646464U, 0x5d5d5d5dU, 0x19191919U, 0x73737373U, 0x60606060U, 0x81818181U, 0x4f4f4f4fU, 0xdcdcdcdcU, 0x22222222U, 0x2a2a2a2aU, 0x90909090U, 0x88888888U, 0x46464646U, 0xeeeeeeeeU, 0xb8b8b8b8U, 0x14141414U, 0xdedededeU, 0x5e5e5e5eU, 0x0b0b0b0bU, 0xdbdbdbdbU, 0xe0e0e0e0U, 0x32323232U, 0x3a3a3a3aU, 0x0a0a0a0aU, 0x49494949U, 0x06060606U, 0x24242424U, 0x5c5c5c5cU, 0xc2c2c2c2U, 0xd3d3d3d3U, 0xacacacacU, 0x62626262U, 0x91919191U, 0x95959595U, 0xe4e4e4e4U, 0x79797979U, 0xe7e7e7e7U, 0xc8c8c8c8U, 0x37373737U, 0x6d6d6d6dU, 0x8d8d8d8dU, 0xd5d5d5d5U, 0x4e4e4e4eU, 0xa9a9a9a9U, 0x6c6c6c6cU, 0x56565656U, 0xf4f4f4f4U, 0xeaeaeaeaU, 0x65656565U, 0x7a7a7a7aU, 0xaeaeaeaeU, 0x08080808U, 0xbabababaU, 0x78787878U, 0x25252525U, 0x2e2e2e2eU, 0x1c1c1c1cU, 0xa6a6a6a6U, 0xb4b4b4b4U, 0xc6c6c6c6U, 0xe8e8e8e8U, 0xddddddddU, 0x74747474U, 0x1f1f1f1fU, 0x4b4b4b4bU, 0xbdbdbdbdU, 0x8b8b8b8bU, 0x8a8a8a8aU, 0x70707070U, 0x3e3e3e3eU, 0xb5b5b5b5U, 0x66666666U, 0x48484848U, 0x03030303U, 0xf6f6f6f6U, 0x0e0e0e0eU, 0x61616161U, 0x35353535U, 0x57575757U, 0xb9b9b9b9U, 0x86868686U, 0xc1c1c1c1U, 0x1d1d1d1dU, 0x9e9e9e9eU, 0xe1e1e1e1U, 0xf8f8f8f8U, 0x98989898U, 0x11111111U, 0x69696969U, 0xd9d9d9d9U, 0x8e8e8e8eU, 0x94949494U, 0x9b9b9b9bU, 0x1e1e1e1eU, 0x87878787U, 0xe9e9e9e9U, 0xcecececeU, 0x55555555U, 0x28282828U, 0xdfdfdfdfU, 0x8c8c8c8cU, 0xa1a1a1a1U, 0x89898989U, 0x0d0d0d0dU, 0xbfbfbfbfU, 0xe6e6e6e6U, 0x42424242U, 0x68686868U, 0x41414141U, 0x99999999U, 0x2d2d2d2dU, 0x0f0f0f0fU, 0xb0b0b0b0U, 0x54545454U, 0xbbbbbbbbU, 0x16161616U, }; #ifdef AES_ASM extern const u32 AES_Td[5][256]; #define Td0 AES_Td[0] #define Td1 AES_Td[1] #define Td2 AES_Td[2] #define Td3 AES_Td[3] #else static const u32 Td0[256] = { 0x51f4a750U, 0x7e416553U, 0x1a17a4c3U, 0x3a275e96U, 0x3bab6bcbU, 0x1f9d45f1U, 0xacfa58abU, 0x4be30393U, 0x2030fa55U, 0xad766df6U, 0x88cc7691U, 0xf5024c25U, 0x4fe5d7fcU, 0xc52acbd7U, 0x26354480U, 0xb562a38fU, 0xdeb15a49U, 0x25ba1b67U, 0x45ea0e98U, 0x5dfec0e1U, 0xc32f7502U, 0x814cf012U, 0x8d4697a3U, 0x6bd3f9c6U, 0x038f5fe7U, 0x15929c95U, 0xbf6d7aebU, 0x955259daU, 0xd4be832dU, 0x587421d3U, 0x49e06929U, 0x8ec9c844U, 0x75c2896aU, 0xf48e7978U, 0x99583e6bU, 0x27b971ddU, 0xbee14fb6U, 0xf088ad17U, 0xc920ac66U, 0x7dce3ab4U, 0x63df4a18U, 0xe51a3182U, 0x97513360U, 0x62537f45U, 0xb16477e0U, 0xbb6bae84U, 0xfe81a01cU, 0xf9082b94U, 0x70486858U, 0x8f45fd19U, 0x94de6c87U, 0x527bf8b7U, 0xab73d323U, 0x724b02e2U, 0xe31f8f57U, 0x6655ab2aU, 0xb2eb2807U, 0x2fb5c203U, 0x86c57b9aU, 0xd33708a5U, 0x302887f2U, 0x23bfa5b2U, 0x02036abaU, 0xed16825cU, 0x8acf1c2bU, 0xa779b492U, 0xf307f2f0U, 0x4e69e2a1U, 0x65daf4cdU, 0x0605bed5U, 0xd134621fU, 0xc4a6fe8aU, 0x342e539dU, 0xa2f355a0U, 0x058ae132U, 0xa4f6eb75U, 0x0b83ec39U, 0x4060efaaU, 0x5e719f06U, 0xbd6e1051U, 0x3e218af9U, 0x96dd063dU, 0xdd3e05aeU, 0x4de6bd46U, 0x91548db5U, 0x71c45d05U, 0x0406d46fU, 0x605015ffU, 0x1998fb24U, 0xd6bde997U, 0x894043ccU, 0x67d99e77U, 0xb0e842bdU, 0x07898b88U, 0xe7195b38U, 0x79c8eedbU, 0xa17c0a47U, 0x7c420fe9U, 0xf8841ec9U, 0x00000000U, 0x09808683U, 0x322bed48U, 0x1e1170acU, 0x6c5a724eU, 0xfd0efffbU, 0x0f853856U, 0x3daed51eU, 0x362d3927U, 0x0a0fd964U, 0x685ca621U, 0x9b5b54d1U, 0x24362e3aU, 0x0c0a67b1U, 0x9357e70fU, 0xb4ee96d2U, 0x1b9b919eU, 0x80c0c54fU, 0x61dc20a2U, 0x5a774b69U, 0x1c121a16U, 0xe293ba0aU, 0xc0a02ae5U, 0x3c22e043U, 0x121b171dU, 0x0e090d0bU, 0xf28bc7adU, 0x2db6a8b9U, 0x141ea9c8U, 0x57f11985U, 0xaf75074cU, 0xee99ddbbU, 0xa37f60fdU, 0xf701269fU, 0x5c72f5bcU, 0x44663bc5U, 0x5bfb7e34U, 0x8b432976U, 0xcb23c6dcU, 0xb6edfc68U, 0xb8e4f163U, 0xd731dccaU, 0x42638510U, 0x13972240U, 0x84c61120U, 0x854a247dU, 0xd2bb3df8U, 0xaef93211U, 0xc729a16dU, 0x1d9e2f4bU, 0xdcb230f3U, 0x0d8652ecU, 0x77c1e3d0U, 0x2bb3166cU, 0xa970b999U, 0x119448faU, 0x47e96422U, 0xa8fc8cc4U, 0xa0f03f1aU, 0x567d2cd8U, 0x223390efU, 0x87494ec7U, 0xd938d1c1U, 0x8ccaa2feU, 0x98d40b36U, 0xa6f581cfU, 0xa57ade28U, 0xdab78e26U, 0x3fadbfa4U, 0x2c3a9de4U, 0x5078920dU, 0x6a5fcc9bU, 0x547e4662U, 0xf68d13c2U, 0x90d8b8e8U, 0x2e39f75eU, 0x82c3aff5U, 0x9f5d80beU, 0x69d0937cU, 0x6fd52da9U, 0xcf2512b3U, 0xc8ac993bU, 0x10187da7U, 0xe89c636eU, 0xdb3bbb7bU, 0xcd267809U, 0x6e5918f4U, 0xec9ab701U, 0x834f9aa8U, 0xe6956e65U, 0xaaffe67eU, 0x21bccf08U, 0xef15e8e6U, 0xbae79bd9U, 0x4a6f36ceU, 0xea9f09d4U, 0x29b07cd6U, 0x31a4b2afU, 0x2a3f2331U, 0xc6a59430U, 0x35a266c0U, 0x744ebc37U, 0xfc82caa6U, 0xe090d0b0U, 0x33a7d815U, 0xf104984aU, 0x41ecdaf7U, 0x7fcd500eU, 0x1791f62fU, 0x764dd68dU, 0x43efb04dU, 0xccaa4d54U, 0xe49604dfU, 0x9ed1b5e3U, 0x4c6a881bU, 0xc12c1fb8U, 0x4665517fU, 0x9d5eea04U, 0x018c355dU, 0xfa877473U, 0xfb0b412eU, 0xb3671d5aU, 0x92dbd252U, 0xe9105633U, 0x6dd64713U, 0x9ad7618cU, 0x37a10c7aU, 0x59f8148eU, 0xeb133c89U, 0xcea927eeU, 0xb761c935U, 0xe11ce5edU, 0x7a47b13cU, 0x9cd2df59U, 0x55f2733fU, 0x1814ce79U, 0x73c737bfU, 0x53f7cdeaU, 0x5ffdaa5bU, 0xdf3d6f14U, 0x7844db86U, 0xcaaff381U, 0xb968c43eU, 0x3824342cU, 0xc2a3405fU, 0x161dc372U, 0xbce2250cU, 0x283c498bU, 0xff0d9541U, 0x39a80171U, 0x080cb3deU, 0xd8b4e49cU, 0x6456c190U, 0x7bcb8461U, 0xd532b670U, 0x486c5c74U, 0xd0b85742U, }; static const u32 Td1[256] = { 0x5051f4a7U, 0x537e4165U, 0xc31a17a4U, 0x963a275eU, 0xcb3bab6bU, 0xf11f9d45U, 0xabacfa58U, 0x934be303U, 0x552030faU, 0xf6ad766dU, 0x9188cc76U, 0x25f5024cU, 0xfc4fe5d7U, 0xd7c52acbU, 0x80263544U, 0x8fb562a3U, 0x49deb15aU, 0x6725ba1bU, 0x9845ea0eU, 0xe15dfec0U, 0x02c32f75U, 0x12814cf0U, 0xa38d4697U, 0xc66bd3f9U, 0xe7038f5fU, 0x9515929cU, 0xebbf6d7aU, 0xda955259U, 0x2dd4be83U, 0xd3587421U, 0x2949e069U, 0x448ec9c8U, 0x6a75c289U, 0x78f48e79U, 0x6b99583eU, 0xdd27b971U, 0xb6bee14fU, 0x17f088adU, 0x66c920acU, 0xb47dce3aU, 0x1863df4aU, 0x82e51a31U, 0x60975133U, 0x4562537fU, 0xe0b16477U, 0x84bb6baeU, 0x1cfe81a0U, 0x94f9082bU, 0x58704868U, 0x198f45fdU, 0x8794de6cU, 0xb7527bf8U, 0x23ab73d3U, 0xe2724b02U, 0x57e31f8fU, 0x2a6655abU, 0x07b2eb28U, 0x032fb5c2U, 0x9a86c57bU, 0xa5d33708U, 0xf2302887U, 0xb223bfa5U, 0xba02036aU, 0x5ced1682U, 0x2b8acf1cU, 0x92a779b4U, 0xf0f307f2U, 0xa14e69e2U, 0xcd65daf4U, 0xd50605beU, 0x1fd13462U, 0x8ac4a6feU, 0x9d342e53U, 0xa0a2f355U, 0x32058ae1U, 0x75a4f6ebU, 0x390b83ecU, 0xaa4060efU, 0x065e719fU, 0x51bd6e10U, 0xf93e218aU, 0x3d96dd06U, 0xaedd3e05U, 0x464de6bdU, 0xb591548dU, 0x0571c45dU, 0x6f0406d4U, 0xff605015U, 0x241998fbU, 0x97d6bde9U, 0xcc894043U, 0x7767d99eU, 0xbdb0e842U, 0x8807898bU, 0x38e7195bU, 0xdb79c8eeU, 0x47a17c0aU, 0xe97c420fU, 0xc9f8841eU, 0x00000000U, 0x83098086U, 0x48322bedU, 0xac1e1170U, 0x4e6c5a72U, 0xfbfd0effU, 0x560f8538U, 0x1e3daed5U, 0x27362d39U, 0x640a0fd9U, 0x21685ca6U, 0xd19b5b54U, 0x3a24362eU, 0xb10c0a67U, 0x0f9357e7U, 0xd2b4ee96U, 0x9e1b9b91U, 0x4f80c0c5U, 0xa261dc20U, 0x695a774bU, 0x161c121aU, 0x0ae293baU, 0xe5c0a02aU, 0x433c22e0U, 0x1d121b17U, 0x0b0e090dU, 0xadf28bc7U, 0xb92db6a8U, 0xc8141ea9U, 0x8557f119U, 0x4caf7507U, 0xbbee99ddU, 0xfda37f60U, 0x9ff70126U, 0xbc5c72f5U, 0xc544663bU, 0x345bfb7eU, 0x768b4329U, 0xdccb23c6U, 0x68b6edfcU, 0x63b8e4f1U, 0xcad731dcU, 0x10426385U, 0x40139722U, 0x2084c611U, 0x7d854a24U, 0xf8d2bb3dU, 0x11aef932U, 0x6dc729a1U, 0x4b1d9e2fU, 0xf3dcb230U, 0xec0d8652U, 0xd077c1e3U, 0x6c2bb316U, 0x99a970b9U, 0xfa119448U, 0x2247e964U, 0xc4a8fc8cU, 0x1aa0f03fU, 0xd8567d2cU, 0xef223390U, 0xc787494eU, 0xc1d938d1U, 0xfe8ccaa2U, 0x3698d40bU, 0xcfa6f581U, 0x28a57adeU, 0x26dab78eU, 0xa43fadbfU, 0xe42c3a9dU, 0x0d507892U, 0x9b6a5fccU, 0x62547e46U, 0xc2f68d13U, 0xe890d8b8U, 0x5e2e39f7U, 0xf582c3afU, 0xbe9f5d80U, 0x7c69d093U, 0xa96fd52dU, 0xb3cf2512U, 0x3bc8ac99U, 0xa710187dU, 0x6ee89c63U, 0x7bdb3bbbU, 0x09cd2678U, 0xf46e5918U, 0x01ec9ab7U, 0xa8834f9aU, 0x65e6956eU, 0x7eaaffe6U, 0x0821bccfU, 0xe6ef15e8U, 0xd9bae79bU, 0xce4a6f36U, 0xd4ea9f09U, 0xd629b07cU, 0xaf31a4b2U, 0x312a3f23U, 0x30c6a594U, 0xc035a266U, 0x37744ebcU, 0xa6fc82caU, 0xb0e090d0U, 0x1533a7d8U, 0x4af10498U, 0xf741ecdaU, 0x0e7fcd50U, 0x2f1791f6U, 0x8d764dd6U, 0x4d43efb0U, 0x54ccaa4dU, 0xdfe49604U, 0xe39ed1b5U, 0x1b4c6a88U, 0xb8c12c1fU, 0x7f466551U, 0x049d5eeaU, 0x5d018c35U, 0x73fa8774U, 0x2efb0b41U, 0x5ab3671dU, 0x5292dbd2U, 0x33e91056U, 0x136dd647U, 0x8c9ad761U, 0x7a37a10cU, 0x8e59f814U, 0x89eb133cU, 0xeecea927U, 0x35b761c9U, 0xede11ce5U, 0x3c7a47b1U, 0x599cd2dfU, 0x3f55f273U, 0x791814ceU, 0xbf73c737U, 0xea53f7cdU, 0x5b5ffdaaU, 0x14df3d6fU, 0x867844dbU, 0x81caaff3U, 0x3eb968c4U, 0x2c382434U, 0x5fc2a340U, 0x72161dc3U, 0x0cbce225U, 0x8b283c49U, 0x41ff0d95U, 0x7139a801U, 0xde080cb3U, 0x9cd8b4e4U, 0x906456c1U, 0x617bcb84U, 0x70d532b6U, 0x74486c5cU, 0x42d0b857U, }; static const u32 Td2[256] = { 0xa75051f4U, 0x65537e41U, 0xa4c31a17U, 0x5e963a27U, 0x6bcb3babU, 0x45f11f9dU, 0x58abacfaU, 0x03934be3U, 0xfa552030U, 0x6df6ad76U, 0x769188ccU, 0x4c25f502U, 0xd7fc4fe5U, 0xcbd7c52aU, 0x44802635U, 0xa38fb562U, 0x5a49deb1U, 0x1b6725baU, 0x0e9845eaU, 0xc0e15dfeU, 0x7502c32fU, 0xf012814cU, 0x97a38d46U, 0xf9c66bd3U, 0x5fe7038fU, 0x9c951592U, 0x7aebbf6dU, 0x59da9552U, 0x832dd4beU, 0x21d35874U, 0x692949e0U, 0xc8448ec9U, 0x896a75c2U, 0x7978f48eU, 0x3e6b9958U, 0x71dd27b9U, 0x4fb6bee1U, 0xad17f088U, 0xac66c920U, 0x3ab47dceU, 0x4a1863dfU, 0x3182e51aU, 0x33609751U, 0x7f456253U, 0x77e0b164U, 0xae84bb6bU, 0xa01cfe81U, 0x2b94f908U, 0x68587048U, 0xfd198f45U, 0x6c8794deU, 0xf8b7527bU, 0xd323ab73U, 0x02e2724bU, 0x8f57e31fU, 0xab2a6655U, 0x2807b2ebU, 0xc2032fb5U, 0x7b9a86c5U, 0x08a5d337U, 0x87f23028U, 0xa5b223bfU, 0x6aba0203U, 0x825ced16U, 0x1c2b8acfU, 0xb492a779U, 0xf2f0f307U, 0xe2a14e69U, 0xf4cd65daU, 0xbed50605U, 0x621fd134U, 0xfe8ac4a6U, 0x539d342eU, 0x55a0a2f3U, 0xe132058aU, 0xeb75a4f6U, 0xec390b83U, 0xefaa4060U, 0x9f065e71U, 0x1051bd6eU, 0x8af93e21U, 0x063d96ddU, 0x05aedd3eU, 0xbd464de6U, 0x8db59154U, 0x5d0571c4U, 0xd46f0406U, 0x15ff6050U, 0xfb241998U, 0xe997d6bdU, 0x43cc8940U, 0x9e7767d9U, 0x42bdb0e8U, 0x8b880789U, 0x5b38e719U, 0xeedb79c8U, 0x0a47a17cU, 0x0fe97c42U, 0x1ec9f884U, 0x00000000U, 0x86830980U, 0xed48322bU, 0x70ac1e11U, 0x724e6c5aU, 0xfffbfd0eU, 0x38560f85U, 0xd51e3daeU, 0x3927362dU, 0xd9640a0fU, 0xa621685cU, 0x54d19b5bU, 0x2e3a2436U, 0x67b10c0aU, 0xe70f9357U, 0x96d2b4eeU, 0x919e1b9bU, 0xc54f80c0U, 0x20a261dcU, 0x4b695a77U, 0x1a161c12U, 0xba0ae293U, 0x2ae5c0a0U, 0xe0433c22U, 0x171d121bU, 0x0d0b0e09U, 0xc7adf28bU, 0xa8b92db6U, 0xa9c8141eU, 0x198557f1U, 0x074caf75U, 0xddbbee99U, 0x60fda37fU, 0x269ff701U, 0xf5bc5c72U, 0x3bc54466U, 0x7e345bfbU, 0x29768b43U, 0xc6dccb23U, 0xfc68b6edU, 0xf163b8e4U, 0xdccad731U, 0x85104263U, 0x22401397U, 0x112084c6U, 0x247d854aU, 0x3df8d2bbU, 0x3211aef9U, 0xa16dc729U, 0x2f4b1d9eU, 0x30f3dcb2U, 0x52ec0d86U, 0xe3d077c1U, 0x166c2bb3U, 0xb999a970U, 0x48fa1194U, 0x642247e9U, 0x8cc4a8fcU, 0x3f1aa0f0U, 0x2cd8567dU, 0x90ef2233U, 0x4ec78749U, 0xd1c1d938U, 0xa2fe8ccaU, 0x0b3698d4U, 0x81cfa6f5U, 0xde28a57aU, 0x8e26dab7U, 0xbfa43fadU, 0x9de42c3aU, 0x920d5078U, 0xcc9b6a5fU, 0x4662547eU, 0x13c2f68dU, 0xb8e890d8U, 0xf75e2e39U, 0xaff582c3U, 0x80be9f5dU, 0x937c69d0U, 0x2da96fd5U, 0x12b3cf25U, 0x993bc8acU, 0x7da71018U, 0x636ee89cU, 0xbb7bdb3bU, 0x7809cd26U, 0x18f46e59U, 0xb701ec9aU, 0x9aa8834fU, 0x6e65e695U, 0xe67eaaffU, 0xcf0821bcU, 0xe8e6ef15U, 0x9bd9bae7U, 0x36ce4a6fU, 0x09d4ea9fU, 0x7cd629b0U, 0xb2af31a4U, 0x23312a3fU, 0x9430c6a5U, 0x66c035a2U, 0xbc37744eU, 0xcaa6fc82U, 0xd0b0e090U, 0xd81533a7U, 0x984af104U, 0xdaf741ecU, 0x500e7fcdU, 0xf62f1791U, 0xd68d764dU, 0xb04d43efU, 0x4d54ccaaU, 0x04dfe496U, 0xb5e39ed1U, 0x881b4c6aU, 0x1fb8c12cU, 0x517f4665U, 0xea049d5eU, 0x355d018cU, 0x7473fa87U, 0x412efb0bU, 0x1d5ab367U, 0xd25292dbU, 0x5633e910U, 0x47136dd6U, 0x618c9ad7U, 0x0c7a37a1U, 0x148e59f8U, 0x3c89eb13U, 0x27eecea9U, 0xc935b761U, 0xe5ede11cU, 0xb13c7a47U, 0xdf599cd2U, 0x733f55f2U, 0xce791814U, 0x37bf73c7U, 0xcdea53f7U, 0xaa5b5ffdU, 0x6f14df3dU, 0xdb867844U, 0xf381caafU, 0xc43eb968U, 0x342c3824U, 0x405fc2a3U, 0xc372161dU, 0x250cbce2U, 0x498b283cU, 0x9541ff0dU, 0x017139a8U, 0xb3de080cU, 0xe49cd8b4U, 0xc1906456U, 0x84617bcbU, 0xb670d532U, 0x5c74486cU, 0x5742d0b8U, }; static const u32 Td3[256] = { 0xf4a75051U, 0x4165537eU, 0x17a4c31aU, 0x275e963aU, 0xab6bcb3bU, 0x9d45f11fU, 0xfa58abacU, 0xe303934bU, 0x30fa5520U, 0x766df6adU, 0xcc769188U, 0x024c25f5U, 0xe5d7fc4fU, 0x2acbd7c5U, 0x35448026U, 0x62a38fb5U, 0xb15a49deU, 0xba1b6725U, 0xea0e9845U, 0xfec0e15dU, 0x2f7502c3U, 0x4cf01281U, 0x4697a38dU, 0xd3f9c66bU, 0x8f5fe703U, 0x929c9515U, 0x6d7aebbfU, 0x5259da95U, 0xbe832dd4U, 0x7421d358U, 0xe0692949U, 0xc9c8448eU, 0xc2896a75U, 0x8e7978f4U, 0x583e6b99U, 0xb971dd27U, 0xe14fb6beU, 0x88ad17f0U, 0x20ac66c9U, 0xce3ab47dU, 0xdf4a1863U, 0x1a3182e5U, 0x51336097U, 0x537f4562U, 0x6477e0b1U, 0x6bae84bbU, 0x81a01cfeU, 0x082b94f9U, 0x48685870U, 0x45fd198fU, 0xde6c8794U, 0x7bf8b752U, 0x73d323abU, 0x4b02e272U, 0x1f8f57e3U, 0x55ab2a66U, 0xeb2807b2U, 0xb5c2032fU, 0xc57b9a86U, 0x3708a5d3U, 0x2887f230U, 0xbfa5b223U, 0x036aba02U, 0x16825cedU, 0xcf1c2b8aU, 0x79b492a7U, 0x07f2f0f3U, 0x69e2a14eU, 0xdaf4cd65U, 0x05bed506U, 0x34621fd1U, 0xa6fe8ac4U, 0x2e539d34U, 0xf355a0a2U, 0x8ae13205U, 0xf6eb75a4U, 0x83ec390bU, 0x60efaa40U, 0x719f065eU, 0x6e1051bdU, 0x218af93eU, 0xdd063d96U, 0x3e05aeddU, 0xe6bd464dU, 0x548db591U, 0xc45d0571U, 0x06d46f04U, 0x5015ff60U, 0x98fb2419U, 0xbde997d6U, 0x4043cc89U, 0xd99e7767U, 0xe842bdb0U, 0x898b8807U, 0x195b38e7U, 0xc8eedb79U, 0x7c0a47a1U, 0x420fe97cU, 0x841ec9f8U, 0x00000000U, 0x80868309U, 0x2bed4832U, 0x1170ac1eU, 0x5a724e6cU, 0x0efffbfdU, 0x8538560fU, 0xaed51e3dU, 0x2d392736U, 0x0fd9640aU, 0x5ca62168U, 0x5b54d19bU, 0x362e3a24U, 0x0a67b10cU, 0x57e70f93U, 0xee96d2b4U, 0x9b919e1bU, 0xc0c54f80U, 0xdc20a261U, 0x774b695aU, 0x121a161cU, 0x93ba0ae2U, 0xa02ae5c0U, 0x22e0433cU, 0x1b171d12U, 0x090d0b0eU, 0x8bc7adf2U, 0xb6a8b92dU, 0x1ea9c814U, 0xf1198557U, 0x75074cafU, 0x99ddbbeeU, 0x7f60fda3U, 0x01269ff7U, 0x72f5bc5cU, 0x663bc544U, 0xfb7e345bU, 0x4329768bU, 0x23c6dccbU, 0xedfc68b6U, 0xe4f163b8U, 0x31dccad7U, 0x63851042U, 0x97224013U, 0xc6112084U, 0x4a247d85U, 0xbb3df8d2U, 0xf93211aeU, 0x29a16dc7U, 0x9e2f4b1dU, 0xb230f3dcU, 0x8652ec0dU, 0xc1e3d077U, 0xb3166c2bU, 0x70b999a9U, 0x9448fa11U, 0xe9642247U, 0xfc8cc4a8U, 0xf03f1aa0U, 0x7d2cd856U, 0x3390ef22U, 0x494ec787U, 0x38d1c1d9U, 0xcaa2fe8cU, 0xd40b3698U, 0xf581cfa6U, 0x7ade28a5U, 0xb78e26daU, 0xadbfa43fU, 0x3a9de42cU, 0x78920d50U, 0x5fcc9b6aU, 0x7e466254U, 0x8d13c2f6U, 0xd8b8e890U, 0x39f75e2eU, 0xc3aff582U, 0x5d80be9fU, 0xd0937c69U, 0xd52da96fU, 0x2512b3cfU, 0xac993bc8U, 0x187da710U, 0x9c636ee8U, 0x3bbb7bdbU, 0x267809cdU, 0x5918f46eU, 0x9ab701ecU, 0x4f9aa883U, 0x956e65e6U, 0xffe67eaaU, 0xbccf0821U, 0x15e8e6efU, 0xe79bd9baU, 0x6f36ce4aU, 0x9f09d4eaU, 0xb07cd629U, 0xa4b2af31U, 0x3f23312aU, 0xa59430c6U, 0xa266c035U, 0x4ebc3774U, 0x82caa6fcU, 0x90d0b0e0U, 0xa7d81533U, 0x04984af1U, 0xecdaf741U, 0xcd500e7fU, 0x91f62f17U, 0x4dd68d76U, 0xefb04d43U, 0xaa4d54ccU, 0x9604dfe4U, 0xd1b5e39eU, 0x6a881b4cU, 0x2c1fb8c1U, 0x65517f46U, 0x5eea049dU, 0x8c355d01U, 0x877473faU, 0x0b412efbU, 0x671d5ab3U, 0xdbd25292U, 0x105633e9U, 0xd647136dU, 0xd7618c9aU, 0xa10c7a37U, 0xf8148e59U, 0x133c89ebU, 0xa927eeceU, 0x61c935b7U, 0x1ce5ede1U, 0x47b13c7aU, 0xd2df599cU, 0xf2733f55U, 0x14ce7918U, 0xc737bf73U, 0xf7cdea53U, 0xfdaa5b5fU, 0x3d6f14dfU, 0x44db8678U, 0xaff381caU, 0x68c43eb9U, 0x24342c38U, 0xa3405fc2U, 0x1dc37216U, 0xe2250cbcU, 0x3c498b28U, 0x0d9541ffU, 0xa8017139U, 0x0cb3de08U, 0xb4e49cd8U, 0x56c19064U, 0xcb84617bU, 0x32b670d5U, 0x6c5c7448U, 0xb85742d0U, }; #endif static const u32 Td4[256] = { 0x52525252U, 0x09090909U, 0x6a6a6a6aU, 0xd5d5d5d5U, 0x30303030U, 0x36363636U, 0xa5a5a5a5U, 0x38383838U, 0xbfbfbfbfU, 0x40404040U, 0xa3a3a3a3U, 0x9e9e9e9eU, 0x81818181U, 0xf3f3f3f3U, 0xd7d7d7d7U, 0xfbfbfbfbU, 0x7c7c7c7cU, 0xe3e3e3e3U, 0x39393939U, 0x82828282U, 0x9b9b9b9bU, 0x2f2f2f2fU, 0xffffffffU, 0x87878787U, 0x34343434U, 0x8e8e8e8eU, 0x43434343U, 0x44444444U, 0xc4c4c4c4U, 0xdedededeU, 0xe9e9e9e9U, 0xcbcbcbcbU, 0x54545454U, 0x7b7b7b7bU, 0x94949494U, 0x32323232U, 0xa6a6a6a6U, 0xc2c2c2c2U, 0x23232323U, 0x3d3d3d3dU, 0xeeeeeeeeU, 0x4c4c4c4cU, 0x95959595U, 0x0b0b0b0bU, 0x42424242U, 0xfafafafaU, 0xc3c3c3c3U, 0x4e4e4e4eU, 0x08080808U, 0x2e2e2e2eU, 0xa1a1a1a1U, 0x66666666U, 0x28282828U, 0xd9d9d9d9U, 0x24242424U, 0xb2b2b2b2U, 0x76767676U, 0x5b5b5b5bU, 0xa2a2a2a2U, 0x49494949U, 0x6d6d6d6dU, 0x8b8b8b8bU, 0xd1d1d1d1U, 0x25252525U, 0x72727272U, 0xf8f8f8f8U, 0xf6f6f6f6U, 0x64646464U, 0x86868686U, 0x68686868U, 0x98989898U, 0x16161616U, 0xd4d4d4d4U, 0xa4a4a4a4U, 0x5c5c5c5cU, 0xccccccccU, 0x5d5d5d5dU, 0x65656565U, 0xb6b6b6b6U, 0x92929292U, 0x6c6c6c6cU, 0x70707070U, 0x48484848U, 0x50505050U, 0xfdfdfdfdU, 0xededededU, 0xb9b9b9b9U, 0xdadadadaU, 0x5e5e5e5eU, 0x15151515U, 0x46464646U, 0x57575757U, 0xa7a7a7a7U, 0x8d8d8d8dU, 0x9d9d9d9dU, 0x84848484U, 0x90909090U, 0xd8d8d8d8U, 0xababababU, 0x00000000U, 0x8c8c8c8cU, 0xbcbcbcbcU, 0xd3d3d3d3U, 0x0a0a0a0aU, 0xf7f7f7f7U, 0xe4e4e4e4U, 0x58585858U, 0x05050505U, 0xb8b8b8b8U, 0xb3b3b3b3U, 0x45454545U, 0x06060606U, 0xd0d0d0d0U, 0x2c2c2c2cU, 0x1e1e1e1eU, 0x8f8f8f8fU, 0xcacacacaU, 0x3f3f3f3fU, 0x0f0f0f0fU, 0x02020202U, 0xc1c1c1c1U, 0xafafafafU, 0xbdbdbdbdU, 0x03030303U, 0x01010101U, 0x13131313U, 0x8a8a8a8aU, 0x6b6b6b6bU, 0x3a3a3a3aU, 0x91919191U, 0x11111111U, 0x41414141U, 0x4f4f4f4fU, 0x67676767U, 0xdcdcdcdcU, 0xeaeaeaeaU, 0x97979797U, 0xf2f2f2f2U, 0xcfcfcfcfU, 0xcecececeU, 0xf0f0f0f0U, 0xb4b4b4b4U, 0xe6e6e6e6U, 0x73737373U, 0x96969696U, 0xacacacacU, 0x74747474U, 0x22222222U, 0xe7e7e7e7U, 0xadadadadU, 0x35353535U, 0x85858585U, 0xe2e2e2e2U, 0xf9f9f9f9U, 0x37373737U, 0xe8e8e8e8U, 0x1c1c1c1cU, 0x75757575U, 0xdfdfdfdfU, 0x6e6e6e6eU, 0x47474747U, 0xf1f1f1f1U, 0x1a1a1a1aU, 0x71717171U, 0x1d1d1d1dU, 0x29292929U, 0xc5c5c5c5U, 0x89898989U, 0x6f6f6f6fU, 0xb7b7b7b7U, 0x62626262U, 0x0e0e0e0eU, 0xaaaaaaaaU, 0x18181818U, 0xbebebebeU, 0x1b1b1b1bU, 0xfcfcfcfcU, 0x56565656U, 0x3e3e3e3eU, 0x4b4b4b4bU, 0xc6c6c6c6U, 0xd2d2d2d2U, 0x79797979U, 0x20202020U, 0x9a9a9a9aU, 0xdbdbdbdbU, 0xc0c0c0c0U, 0xfefefefeU, 0x78787878U, 0xcdcdcdcdU, 0x5a5a5a5aU, 0xf4f4f4f4U, 0x1f1f1f1fU, 0xddddddddU, 0xa8a8a8a8U, 0x33333333U, 0x88888888U, 0x07070707U, 0xc7c7c7c7U, 0x31313131U, 0xb1b1b1b1U, 0x12121212U, 0x10101010U, 0x59595959U, 0x27272727U, 0x80808080U, 0xececececU, 0x5f5f5f5fU, 0x60606060U, 0x51515151U, 0x7f7f7f7fU, 0xa9a9a9a9U, 0x19191919U, 0xb5b5b5b5U, 0x4a4a4a4aU, 0x0d0d0d0dU, 0x2d2d2d2dU, 0xe5e5e5e5U, 0x7a7a7a7aU, 0x9f9f9f9fU, 0x93939393U, 0xc9c9c9c9U, 0x9c9c9c9cU, 0xefefefefU, 0xa0a0a0a0U, 0xe0e0e0e0U, 0x3b3b3b3bU, 0x4d4d4d4dU, 0xaeaeaeaeU, 0x2a2a2a2aU, 0xf5f5f5f5U, 0xb0b0b0b0U, 0xc8c8c8c8U, 0xebebebebU, 0xbbbbbbbbU, 0x3c3c3c3cU, 0x83838383U, 0x53535353U, 0x99999999U, 0x61616161U, 0x17171717U, 0x2b2b2b2bU, 0x04040404U, 0x7e7e7e7eU, 0xbabababaU, 0x77777777U, 0xd6d6d6d6U, 0x26262626U, 0xe1e1e1e1U, 0x69696969U, 0x14141414U, 0x63636363U, 0x55555555U, 0x21212121U, 0x0c0c0c0cU, 0x7d7d7d7dU, }; static const u32 rcon[] = { 0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000, 0x20000000, 0x40000000, 0x80000000, 0x1B000000, 0x36000000, /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */ }; /** * Expand the cipher key into the encryption key schedule. */ int AES_set_encrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key) { u32 *rk; int i = 0; u32 temp; if (!userKey || !key) return -1; if (bits != 128 && bits != 192 && bits != 256) return -2; rk = key->rd_key; if (bits==128) key->rounds = 10; else if (bits==192) key->rounds = 12; else key->rounds = 14; rk[0] = GETU32(userKey ); rk[1] = GETU32(userKey + 4); rk[2] = GETU32(userKey + 8); rk[3] = GETU32(userKey + 12); if (bits == 128) { while (1) { temp = rk[3]; rk[4] = rk[0] ^ (Te4[(temp >> 16) & 0xff] & 0xff000000) ^ (Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ (Te4[(temp ) & 0xff] & 0x0000ff00) ^ (Te4[(temp >> 24) ] & 0x000000ff) ^ rcon[i]; rk[5] = rk[1] ^ rk[4]; rk[6] = rk[2] ^ rk[5]; rk[7] = rk[3] ^ rk[6]; if (++i == 10) { return 0; } rk += 4; } } rk[4] = GETU32(userKey + 16); rk[5] = GETU32(userKey + 20); if (bits == 192) { while (1) { temp = rk[ 5]; rk[ 6] = rk[ 0] ^ (Te4[(temp >> 16) & 0xff] & 0xff000000) ^ (Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ (Te4[(temp ) & 0xff] & 0x0000ff00) ^ (Te4[(temp >> 24) ] & 0x000000ff) ^ rcon[i]; rk[ 7] = rk[ 1] ^ rk[ 6]; rk[ 8] = rk[ 2] ^ rk[ 7]; rk[ 9] = rk[ 3] ^ rk[ 8]; if (++i == 8) { return 0; } rk[10] = rk[ 4] ^ rk[ 9]; rk[11] = rk[ 5] ^ rk[10]; rk += 6; } } rk[6] = GETU32(userKey + 24); rk[7] = GETU32(userKey + 28); if (bits == 256) { while (1) { temp = rk[ 7]; rk[ 8] = rk[ 0] ^ (Te4[(temp >> 16) & 0xff] & 0xff000000) ^ (Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ (Te4[(temp ) & 0xff] & 0x0000ff00) ^ (Te4[(temp >> 24) ] & 0x000000ff) ^ rcon[i]; rk[ 9] = rk[ 1] ^ rk[ 8]; rk[10] = rk[ 2] ^ rk[ 9]; rk[11] = rk[ 3] ^ rk[10]; if (++i == 7) { return 0; } temp = rk[11]; rk[12] = rk[ 4] ^ (Te4[(temp >> 24) ] & 0xff000000) ^ (Te4[(temp >> 16) & 0xff] & 0x00ff0000) ^ (Te4[(temp >> 8) & 0xff] & 0x0000ff00) ^ (Te4[(temp ) & 0xff] & 0x000000ff); rk[13] = rk[ 5] ^ rk[12]; rk[14] = rk[ 6] ^ rk[13]; rk[15] = rk[ 7] ^ rk[14]; rk += 8; } } return 0; } /** * Expand the cipher key into the decryption key schedule. */ int AES_set_decrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key) { u32 *rk; int i, j, status; u32 temp; /* first, start with an encryption schedule */ status = AES_set_encrypt_key(userKey, bits, key); if (status < 0) return status; rk = key->rd_key; /* invert the order of the round keys: */ for (i = 0, j = 4*(key->rounds); i < j; i += 4, j -= 4) { temp = rk[i ]; rk[i ] = rk[j ]; rk[j ] = temp; temp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp; temp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp; temp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp; } /* apply the inverse MixColumn transform to all round keys but the first and the last: */ for (i = 1; i < (key->rounds); i++) { rk += 4; rk[0] = Td0[Te4[(rk[0] >> 24) ] & 0xff] ^ Td1[Te4[(rk[0] >> 16) & 0xff] & 0xff] ^ Td2[Te4[(rk[0] >> 8) & 0xff] & 0xff] ^ Td3[Te4[(rk[0] ) & 0xff] & 0xff]; rk[1] = Td0[Te4[(rk[1] >> 24) ] & 0xff] ^ Td1[Te4[(rk[1] >> 16) & 0xff] & 0xff] ^ Td2[Te4[(rk[1] >> 8) & 0xff] & 0xff] ^ Td3[Te4[(rk[1] ) & 0xff] & 0xff]; rk[2] = Td0[Te4[(rk[2] >> 24) ] & 0xff] ^ Td1[Te4[(rk[2] >> 16) & 0xff] & 0xff] ^ Td2[Te4[(rk[2] >> 8) & 0xff] & 0xff] ^ Td3[Te4[(rk[2] ) & 0xff] & 0xff]; rk[3] = Td0[Te4[(rk[3] >> 24) ] & 0xff] ^ Td1[Te4[(rk[3] >> 16) & 0xff] & 0xff] ^ Td2[Te4[(rk[3] >> 8) & 0xff] & 0xff] ^ Td3[Te4[(rk[3] ) & 0xff] & 0xff]; } return 0; } #ifndef AES_ASM /* * Encrypt a single block * in and out can overlap */ void AES_encrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key) { const u32 *rk; u32 s0, s1, s2, s3, t0, t1, t2, t3; #ifndef FULL_UNROLL int r; #endif /* ?FULL_UNROLL */ assert(in && out && key); rk = key->rd_key; /* * map byte array block to cipher state * and add initial round key: */ s0 = GETU32(in ) ^ rk[0]; s1 = GETU32(in + 4) ^ rk[1]; s2 = GETU32(in + 8) ^ rk[2]; s3 = GETU32(in + 12) ^ rk[3]; #ifdef FULL_UNROLL /* round 1: */ t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[ 4]; t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[ 5]; t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[ 6]; t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[ 7]; /* round 2: */ s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[ 8]; s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[ 9]; s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[10]; s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[11]; /* round 3: */ t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[12]; t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[13]; t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[14]; t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[15]; /* round 4: */ s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[16]; s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[17]; s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[18]; s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[19]; /* round 5: */ t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[20]; t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[21]; t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[22]; t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[23]; /* round 6: */ s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[24]; s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[25]; s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[26]; s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[27]; /* round 7: */ t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[28]; t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[29]; t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[30]; t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[31]; /* round 8: */ s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[32]; s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[33]; s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[34]; s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[35]; /* round 9: */ t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[36]; t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[37]; t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[38]; t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[39]; if (key->rounds > 10) { /* round 10: */ s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[40]; s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[41]; s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[42]; s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[43]; /* round 11: */ t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[44]; t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[45]; t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[46]; t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[47]; if (key->rounds > 12) { /* round 12: */ s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[48]; s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[49]; s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[50]; s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[51]; /* round 13: */ t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[52]; t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[53]; t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[54]; t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[55]; } } rk += key->rounds << 2; #else /* !FULL_UNROLL */ /* * Nr - 1 full rounds: */ r = key->rounds >> 1; for (;;) { t0 = Te0[(s0 >> 24) ] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] ^ Te3[(s3 ) & 0xff] ^ rk[4]; t1 = Te0[(s1 >> 24) ] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] ^ Te3[(s0 ) & 0xff] ^ rk[5]; t2 = Te0[(s2 >> 24) ] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] ^ Te3[(s1 ) & 0xff] ^ rk[6]; t3 = Te0[(s3 >> 24) ] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] ^ Te3[(s2 ) & 0xff] ^ rk[7]; rk += 8; if (--r == 0) { break; } s0 = Te0[(t0 >> 24) ] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] ^ Te3[(t3 ) & 0xff] ^ rk[0]; s1 = Te0[(t1 >> 24) ] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] ^ Te3[(t0 ) & 0xff] ^ rk[1]; s2 = Te0[(t2 >> 24) ] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] ^ Te3[(t1 ) & 0xff] ^ rk[2]; s3 = Te0[(t3 >> 24) ] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] ^ Te3[(t2 ) & 0xff] ^ rk[3]; } #endif /* ?FULL_UNROLL */ /* * apply last round and * map cipher state to byte array block: */ s0 = (Te4[(t0 >> 24) ] & 0xff000000) ^ (Te4[(t1 >> 16) & 0xff] & 0x00ff0000) ^ (Te4[(t2 >> 8) & 0xff] & 0x0000ff00) ^ (Te4[(t3 ) & 0xff] & 0x000000ff) ^ rk[0]; PUTU32(out , s0); s1 = (Te4[(t1 >> 24) ] & 0xff000000) ^ (Te4[(t2 >> 16) & 0xff] & 0x00ff0000) ^ (Te4[(t3 >> 8) & 0xff] & 0x0000ff00) ^ (Te4[(t0 ) & 0xff] & 0x000000ff) ^ rk[1]; PUTU32(out + 4, s1); s2 = (Te4[(t2 >> 24) ] & 0xff000000) ^ (Te4[(t3 >> 16) & 0xff] & 0x00ff0000) ^ (Te4[(t0 >> 8) & 0xff] & 0x0000ff00) ^ (Te4[(t1 ) & 0xff] & 0x000000ff) ^ rk[2]; PUTU32(out + 8, s2); s3 = (Te4[(t3 >> 24) ] & 0xff000000) ^ (Te4[(t0 >> 16) & 0xff] & 0x00ff0000) ^ (Te4[(t1 >> 8) & 0xff] & 0x0000ff00) ^ (Te4[(t2 ) & 0xff] & 0x000000ff) ^ rk[3]; PUTU32(out + 12, s3); } /* * Decrypt a single block * in and out can overlap */ void AES_decrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key) { const u32 *rk; u32 s0, s1, s2, s3, t0, t1, t2, t3; #ifndef FULL_UNROLL int r; #endif /* ?FULL_UNROLL */ assert(in && out && key); rk = key->rd_key; /* * map byte array block to cipher state * and add initial round key: */ s0 = GETU32(in ) ^ rk[0]; s1 = GETU32(in + 4) ^ rk[1]; s2 = GETU32(in + 8) ^ rk[2]; s3 = GETU32(in + 12) ^ rk[3]; #ifdef FULL_UNROLL /* round 1: */ t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[ 4]; t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[ 5]; t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[ 6]; t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[ 7]; /* round 2: */ s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[ 8]; s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[ 9]; s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[10]; s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[11]; /* round 3: */ t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[12]; t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[13]; t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[14]; t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[15]; /* round 4: */ s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[16]; s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[17]; s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[18]; s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[19]; /* round 5: */ t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[20]; t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[21]; t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[22]; t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[23]; /* round 6: */ s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[24]; s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[25]; s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[26]; s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[27]; /* round 7: */ t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[28]; t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[29]; t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[30]; t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[31]; /* round 8: */ s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[32]; s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[33]; s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[34]; s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[35]; /* round 9: */ t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[36]; t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[37]; t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[38]; t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[39]; if (key->rounds > 10) { /* round 10: */ s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[40]; s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[41]; s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[42]; s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[43]; /* round 11: */ t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[44]; t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[45]; t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[46]; t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[47]; if (key->rounds > 12) { /* round 12: */ s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[48]; s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[49]; s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[50]; s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[51]; /* round 13: */ t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[52]; t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[53]; t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[54]; t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[55]; } } rk += key->rounds << 2; #else /* !FULL_UNROLL */ /* * Nr - 1 full rounds: */ r = key->rounds >> 1; for (;;) { t0 = Td0[(s0 >> 24) ] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] ^ Td3[(s1 ) & 0xff] ^ rk[4]; t1 = Td0[(s1 >> 24) ] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] ^ Td3[(s2 ) & 0xff] ^ rk[5]; t2 = Td0[(s2 >> 24) ] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] ^ Td3[(s3 ) & 0xff] ^ rk[6]; t3 = Td0[(s3 >> 24) ] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] ^ Td3[(s0 ) & 0xff] ^ rk[7]; rk += 8; if (--r == 0) { break; } s0 = Td0[(t0 >> 24) ] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] ^ Td3[(t1 ) & 0xff] ^ rk[0]; s1 = Td0[(t1 >> 24) ] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] ^ Td3[(t2 ) & 0xff] ^ rk[1]; s2 = Td0[(t2 >> 24) ] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] ^ Td3[(t3 ) & 0xff] ^ rk[2]; s3 = Td0[(t3 >> 24) ] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] ^ Td3[(t0 ) & 0xff] ^ rk[3]; } #endif /* ?FULL_UNROLL */ /* * apply last round and * map cipher state to byte array block: */ s0 = (Td4[(t0 >> 24) ] & 0xff000000) ^ (Td4[(t3 >> 16) & 0xff] & 0x00ff0000) ^ (Td4[(t2 >> 8) & 0xff] & 0x0000ff00) ^ (Td4[(t1 ) & 0xff] & 0x000000ff) ^ rk[0]; PUTU32(out , s0); s1 = (Td4[(t1 >> 24) ] & 0xff000000) ^ (Td4[(t0 >> 16) & 0xff] & 0x00ff0000) ^ (Td4[(t3 >> 8) & 0xff] & 0x0000ff00) ^ (Td4[(t2 ) & 0xff] & 0x000000ff) ^ rk[1]; PUTU32(out + 4, s1); s2 = (Td4[(t2 >> 24) ] & 0xff000000) ^ (Td4[(t1 >> 16) & 0xff] & 0x00ff0000) ^ (Td4[(t0 >> 8) & 0xff] & 0x0000ff00) ^ (Td4[(t3 ) & 0xff] & 0x000000ff) ^ rk[2]; PUTU32(out + 8, s2); s3 = (Td4[(t3 >> 24) ] & 0xff000000) ^ (Td4[(t2 >> 16) & 0xff] & 0x00ff0000) ^ (Td4[(t1 >> 8) & 0xff] & 0x0000ff00) ^ (Td4[(t0 ) & 0xff] & 0x000000ff) ^ rk[3]; PUTU32(out + 12, s3); } #endif /* AES_ASM */ ================================================ FILE: Bundles/Echoware/OpenSSL/aes_locl.h ================================================ /* crypto/aes/aes.h -*- mode:C; c-file-style: "eay" -*- */ /* ==================================================================== * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * */ #ifndef HEADER_AES_LOCL_H #define HEADER_AES_LOCL_H #include "e_os2.h" #ifdef OPENSSL_NO_AES #error AES is disabled. #endif #include #include #include #if defined(_MSC_VER) && !defined(_M_IA64) && !defined(OPENSSL_SYS_WINCE) # define SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00) # define GETU32(p) SWAP(*((u32 *)(p))) # define PUTU32(ct, st) { *((u32 *)(ct)) = SWAP((st)); } #else # define GETU32(pt) (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ ((u32)(pt)[2] << 8) ^ ((u32)(pt)[3])) # define PUTU32(ct, st) { (ct)[0] = (u8)((st) >> 24); (ct)[1] = (u8)((st) >> 16); (ct)[2] = (u8)((st) >> 8); (ct)[3] = (u8)(st); } #endif #ifdef AES_LONG typedef unsigned long u32; #else typedef unsigned int u32; #endif typedef unsigned short u16; typedef unsigned char u8; #define MAXKC (256/32) #define MAXKB (256/8) #define MAXNR 14 /* This controls loop-unrolling in aes_core.c */ #undef FULL_UNROLL #endif /* !HEADER_AES_LOCL_H */ ================================================ FILE: Bundles/Echoware/OpenSSL/e_os2.h ================================================ /* e_os2.h */ /* ==================================================================== * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #include "opensslconf.h" #ifndef HEADER_E_OS2_H #define HEADER_E_OS2_H #ifdef __cplusplus extern "C" { #endif /****************************************************************************** * Detect operating systems. This probably needs completing. * The result is that at least one OPENSSL_SYS_os macro should be defined. * However, if none is defined, Unix is assumed. **/ #define OPENSSL_SYS_UNIX /* ----------------------- Macintosh, before MacOS X ----------------------- */ #if defined(__MWERKS__) && defined(macintosh) || defined(OPENSSL_SYSNAME_MAC) # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_MACINTOSH_CLASSIC #endif /* ----------------------- NetWare ----------------------------------------- */ #if defined(NETWARE) || defined(OPENSSL_SYSNAME_NETWARE) # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_NETWARE #endif /* ---------------------- Microsoft operating systems ---------------------- */ /* The 16 bit environments are pretty straightforward */ #if defined(OPENSSL_SYSNAME_WIN16) || defined(OPENSSL_SYSNAME_MSDOS) # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_MSDOS #endif #if defined(OPENSSL_SYSNAME_WIN16) # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_WIN16 #endif /* For 32 bit environment, there seems to be the CygWin environment and then all the others that try to do the same thing Microsoft does... */ #if defined(OPENSSL_SYSNAME_UWIN) # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_WIN32_UWIN #else # if defined(__CYGWIN32__) || defined(OPENSSL_SYSNAME_CYGWIN32) # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_WIN32_CYGWIN # else # if defined(_WIN32) || defined(OPENSSL_SYSNAME_WIN32) # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_WIN32 # endif # if defined(OPENSSL_SYSNAME_WINNT) # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_WINNT # endif # if defined(OPENSSL_SYSNAME_WINCE) # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_WINCE # endif # endif #endif /* Anything that tries to look like Microsoft is "Windows" */ #if defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE) # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_WINDOWS # ifndef OPENSSL_SYS_MSDOS # define OPENSSL_SYS_MSDOS # endif #endif /* DLL settings. This part is a bit tough, because it's up to the application implementor how he or she will link the application, so it requires some macro to be used. */ #ifdef OPENSSL_SYS_WINDOWS # ifndef OPENSSL_OPT_WINDLL # if defined(_WINDLL) /* This is used when building OpenSSL to indicate that DLL linkage should be used */ # define OPENSSL_OPT_WINDLL # endif # endif #endif /* -------------------------------- OpenVMS -------------------------------- */ #if defined(__VMS) || defined(VMS) || defined(OPENSSL_SYSNAME_VMS) # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_VMS # if defined(__DECC) # define OPENSSL_SYS_VMS_DECC # elif defined(__DECCXX) # define OPENSSL_SYS_VMS_DECC # define OPENSSL_SYS_VMS_DECCXX # else # define OPENSSL_SYS_VMS_NODECC # endif #endif /* --------------------------------- OS/2 ---------------------------------- */ #if defined(__EMX__) || defined(__OS2__) # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_OS2 #endif /* --------------------------------- Unix ---------------------------------- */ #ifdef OPENSSL_SYS_UNIX # if defined(linux) || defined(__linux__) || defined(OPENSSL_SYSNAME_LINUX) # define OPENSSL_SYS_LINUX # endif # ifdef OPENSSL_SYSNAME_MPE # define OPENSSL_SYS_MPE # endif # ifdef OPENSSL_SYSNAME_SNI # define OPENSSL_SYS_SNI # endif # ifdef OPENSSL_SYSNAME_ULTRASPARC # define OPENSSL_SYS_ULTRASPARC # endif # ifdef OPENSSL_SYSNAME_NEWS4 # define OPENSSL_SYS_NEWS4 # endif # ifdef OPENSSL_SYSNAME_MACOSX # define OPENSSL_SYS_MACOSX # endif # ifdef OPENSSL_SYSNAME_MACOSX_RHAPSODY # define OPENSSL_SYS_MACOSX_RHAPSODY # define OPENSSL_SYS_MACOSX # endif # ifdef OPENSSL_SYSNAME_SUNOS # define OPENSSL_SYS_SUNOS #endif # if defined(_CRAY) || defined(OPENSSL_SYSNAME_CRAY) # define OPENSSL_SYS_CRAY # endif # if defined(_AIX) || defined(OPENSSL_SYSNAME_AIX) # define OPENSSL_SYS_AIX # endif #endif /* --------------------------------- VOS ----------------------------------- */ #ifdef OPENSSL_SYSNAME_VOS # define OPENSSL_SYS_VOS #endif /* ------------------------------- VxWorks --------------------------------- */ #ifdef OPENSSL_SYSNAME_VXWORKS # define OPENSSL_SYS_VXWORKS #endif /** * That's it for OS-specific stuff *****************************************************************************/ /* Specials for I/O an exit */ #ifdef OPENSSL_SYS_WIN16 # define OPENSSL_NO_FP_API #endif #ifdef OPENSSL_SYS_MSDOS # define OPENSSL_UNISTD_IO # define OPENSSL_DECLARE_EXIT extern void exit(int); #else # define OPENSSL_UNISTD_IO OPENSSL_UNISTD # define OPENSSL_DECLARE_EXIT /* declared in unistd.h */ #endif /* Definitions of OPENSSL_GLOBAL and OPENSSL_EXTERN, to define and declare certain global symbols that, with some compilers under VMS, have to be defined and declared explicitely with globaldef and globalref. Definitions of OPENSSL_EXPORT and OPENSSL_IMPORT, to define and declare DLL exports and imports for compilers under Win32. These are a little more complicated to use. Basically, for any library that exports some global variables, the following code must be present in the header file that declares them, before OPENSSL_EXTERN is used: #ifdef SOME_BUILD_FLAG_MACRO # undef OPENSSL_EXTERN # define OPENSSL_EXTERN OPENSSL_EXPORT #endif The default is to have OPENSSL_EXPORT, OPENSSL_IMPORT and OPENSSL_GLOBAL have some generally sensible values, and for OPENSSL_EXTERN to have the value OPENSSL_IMPORT. */ #if defined(OPENSSL_SYS_VMS_NODECC) # define OPENSSL_EXPORT globalref # define OPENSSL_IMPORT globalref # define OPENSSL_GLOBAL globaldef #elif defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL) # define OPENSSL_EXPORT extern __declspec(dllexport) # define OPENSSL_IMPORT extern __declspec(dllimport) # define OPENSSL_GLOBAL #else # define OPENSSL_EXPORT extern # define OPENSSL_IMPORT extern # define OPENSSL_GLOBAL #endif #define OPENSSL_EXTERN OPENSSL_IMPORT /* Macros to allow global variables to be reached through function calls when required (if a shared library version requvres it, for example. The way it's done allows definitions like this: // in foobar.c OPENSSL_IMPLEMENT_GLOBAL(int,foobar) = 0; // in foobar.h OPENSSL_DECLARE_GLOBAL(int,foobar); #define foobar OPENSSL_GLOBAL_REF(foobar) */ #ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION # define OPENSSL_IMPLEMENT_GLOBAL(type,name) \ extern type _hide_##name; \ type *_shadow_##name(void) { return &_hide_##name; } \ static type _hide_##name # define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void) # define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name())) #else # define OPENSSL_IMPLEMENT_GLOBAL(type,name) OPENSSL_GLOBAL type _shadow_##name # define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name # define OPENSSL_GLOBAL_REF(name) _shadow_##name #endif #ifdef __cplusplus } #endif #endif ================================================ FILE: Bundles/Echoware/OpenSSL/opensslconf.h ================================================ /* opensslconf.h */ /* WARNING: Generated automatically from opensslconf.h.in by Configure. */ /* OpenSSL was configured with the following options: */ #ifndef OPENSSL_DOING_MAKEDEPEND #ifndef OPENSSL_NO_GMP # define OPENSSL_NO_GMP #endif #ifndef OPENSSL_NO_KRB5 # define OPENSSL_NO_KRB5 #endif #ifndef OPENSSL_NO_MDC2 # define OPENSSL_NO_MDC2 #endif #ifndef OPENSSL_NO_RC5 # define OPENSSL_NO_RC5 #endif #endif /* OPENSSL_DOING_MAKEDEPEND */ #ifndef OPENSSL_NO_DYNAMIC_ENGINE # define OPENSSL_NO_DYNAMIC_ENGINE #endif /* The OPENSSL_NO_* macros are also defined as NO_* if the application asks for it. This is a transient feature that is provided for those who haven't had the time to do the appropriate changes in their applications. */ #ifdef OPENSSL_ALGORITHM_DEFINES # if defined(OPENSSL_NO_GMP) && !defined(NO_GMP) # define NO_GMP # endif # if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5) # define NO_KRB5 # endif # if defined(OPENSSL_NO_MDC2) && !defined(NO_MDC2) # define NO_MDC2 # endif # if defined(OPENSSL_NO_RC5) && !defined(NO_RC5) # define NO_RC5 # endif #endif /* crypto/opensslconf.h.in */ /* Generate 80386 code? */ #undef I386_ONLY #if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */ #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) #define ENGINESDIR "/usr/local/ssl/lib/engines" #define OPENSSLDIR "/usr/local/ssl" #endif #endif #undef OPENSSL_UNISTD #define OPENSSL_UNISTD #undef OPENSSL_EXPORT_VAR_AS_FUNCTION #if defined(HEADER_IDEA_H) && !defined(IDEA_INT) #define IDEA_INT unsigned int #endif #if defined(HEADER_MD2_H) && !defined(MD2_INT) #define MD2_INT unsigned int #endif #if defined(HEADER_RC2_H) && !defined(RC2_INT) /* I need to put in a mod for the alpha - eay */ #define RC2_INT unsigned int #endif #if defined(HEADER_RC4_H) #if !defined(RC4_INT) /* using int types make the structure larger but make the code faster * on most boxes I have tested - up to %20 faster. */ /* * I don't know what does "most" mean, but declaring "int" is a must on: * - Intel P6 because partial register stalls are very expensive; * - elder Alpha because it lacks byte load/store instructions; */ #define RC4_INT unsigned int #endif #if !defined(RC4_CHUNK) /* * This enables code handling data aligned at natural CPU word * boundary. See crypto/rc4/rc4_enc.c for further details. */ #undef RC4_CHUNK #endif #endif #if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a * %20 speed up (longs are 8 bytes, int's are 4). */ #ifndef DES_LONG #define DES_LONG unsigned long #endif #endif #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) #define CONFIG_HEADER_BN_H #undef BN_LLONG /* Should we define BN_DIV2W here? */ /* Only one for the following should be defined */ /* The prime number generation stuff may not work when * EIGHT_BIT but I don't care since I've only used this mode * for debuging the bignum libraries */ #undef SIXTY_FOUR_BIT_LONG #undef SIXTY_FOUR_BIT #define THIRTY_TWO_BIT #undef SIXTEEN_BIT #undef EIGHT_BIT #endif #if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) #define CONFIG_HEADER_RC4_LOCL_H /* if this is defined data[i] is used instead of *data, this is a %20 * speedup on x86 */ #undef RC4_INDEX #endif #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) #define CONFIG_HEADER_BF_LOCL_H #undef BF_PTR #endif /* HEADER_BF_LOCL_H */ #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) #define CONFIG_HEADER_DES_LOCL_H #ifndef DES_DEFAULT_OPTIONS /* the following is tweaked from a config script, that is why it is a * protected undef/define */ #ifndef DES_PTR #undef DES_PTR #endif /* This helps C compiler generate the correct code for multiple functional * units. It reduces register dependencies at the expense of 2 more * registers */ #ifndef DES_RISC1 #undef DES_RISC1 #endif #ifndef DES_RISC2 #undef DES_RISC2 #endif #if defined(DES_RISC1) && defined(DES_RISC2) YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! #endif /* Unroll the inner loop, this sometimes helps, sometimes hinders. * Very much CPU dependent */ #ifndef DES_UNROLL #undef DES_UNROLL #endif /* These default values were supplied by * Peter Gutman * They are only used if nothing else has been defined */ #if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) /* Special defines which change the way the code is built depending on the CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find even newer MIPS CPU's, but at the moment one size fits all for optimization options. Older Sparc's work better with only UNROLL, but there's no way to tell at compile time what it is you're running on */ #if defined( sun ) /* Newer Sparc's */ # define DES_PTR # define DES_RISC1 # define DES_UNROLL #elif defined( __ultrix ) /* Older MIPS */ # define DES_PTR # define DES_RISC2 # define DES_UNROLL #elif defined( __osf1__ ) /* Alpha */ # define DES_PTR # define DES_RISC2 #elif defined ( _AIX ) /* RS6000 */ /* Unknown */ #elif defined( __hpux ) /* HP-PA */ /* Unknown */ #elif defined( __aux ) /* 68K */ /* Unknown */ #elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ # define DES_UNROLL #elif defined( __sgi ) /* Newer MIPS */ # define DES_PTR # define DES_RISC2 # define DES_UNROLL #elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ # define DES_PTR # define DES_RISC1 # define DES_UNROLL #endif /* Systems-specific speed defines */ #endif #endif /* DES_DEFAULT_OPTIONS */ #endif /* HEADER_DES_LOCL_H */ ================================================ FILE: Bundles/Echoware/ProxiesManager.cpp ================================================ #include "StdAfx.h" #include "proxiesmanager.h" #include "DllProxyInfo.h" //#include CProxiesManager::CProxiesManager(void) { shouldQuit=0; // Mac OSX hasQuit=0; // Mac OSX m_bLocalProxy=false; m_pLocalProxy=0; m_hReconectProxiesThread=CreateThread(0, 0, ReconectProxiesThreadProc, this, 0, &m_dwReconectProxiesThread); } CProxiesManager::~CProxiesManager(void) { ShutdownThread(m_hReconectProxiesThread, THREAD_STOP_TIMEOUT, &shouldQuit, &hasQuit); RemoveAllProxies(); } //add a proxy to the proxies list void CProxiesManager::AddProxy(CDllProxyInfo* pProxyInfo) { m_critSection.Lock(); CProxyConnection* pProxy=new CProxyConnection(pProxyInfo); m_listProxies.push_back(pProxy); m_critSection.Unlock(); } //remove a proxy from the proxies list void CProxiesManager::RemoveProxy(CDllProxyInfo* pProxyInfo) { m_critSection.Lock(); for(std::list::iterator it=m_listProxies.begin(); it!=m_listProxies.end(); it++) if (((CProxyConnection*)*it)->GetProxyInfo()==pProxyInfo) { CProxyConnection* pProxy=(CProxyConnection*)*it; delete pProxy; pProxy=0; std::list::iterator itend=it; itend++; m_listProxies.erase(it, itend); break; } m_critSection.Unlock(); } //remove all the proxies from the proxies list void CProxiesManager::RemoveAllProxies() { m_critSection.Lock(); for(std::list::iterator it=m_listProxies.begin(); it!=m_listProxies.end(); it++) { CProxyConnection* pProxy=(CProxyConnection*)*it; delete pProxy; } m_listProxies.clear(); m_critSection.Unlock(); } //connect a proxy int CProxiesManager::ConnectProxy(CDllProxyInfo* pProxyInfo) { int nRet=1; m_critSection.Lock(); CProxyConnection* pProxyConnection=(CProxyConnection*)FindProxy(pProxyInfo); if (pProxyConnection) nRet=pProxyConnection->Connect(); m_critSection.Unlock(); return nRet; } //disconnect a proxy bool CProxiesManager::DisconnectProxy(CDllProxyInfo* pProxyInfo) { bool bRet=true; m_critSection.Lock(); CProxyConnection* pProxyConnection=(CProxyConnection*)FindProxy(pProxyInfo); if (pProxyConnection) bRet=pProxyConnection->Disconnect(); m_critSection.Unlock(); return bRet; } //stop connecting a proxy void CProxiesManager::StopConnecting(CDllProxyInfo* pProxyInfo) { CProxyConnection* pProxyConnection=(CProxyConnection*)FindProxy(pProxyInfo); if (pProxyConnection) pProxyConnection->StopConnecting(); } //disconnect all the proxies bool CProxiesManager::DisconnectAllProxies() { bool bRet=true; m_critSection.Lock(); for(std::list::iterator it=m_listProxies.begin(); it!=m_listProxies.end(); it++) { bRet= bRet && ((CProxyConnection*)*it)->Disconnect(); } m_critSection.Unlock(); return bRet; } //set a proxy encryption level void CProxiesManager::SetEncryptionLevel(int level, CDllProxyInfo* pProxyInfo) { m_critSection.Lock(); CProxyConnection* pProxyConnection=(CProxyConnection*)FindProxy(pProxyInfo); if (pProxyConnection) pProxyConnection->SetEncryptionLevel(level); m_critSection.Unlock(); } //set info for the local proxy void CProxiesManager::SetLocalProxyInfo(char* ip, char* port, char* username, char* password) { m_critSection.Lock(); m_bLocalProxy=true; if (!m_pLocalProxy) m_pLocalProxy=new CDllProxyInfo; m_pLocalProxy->SetIP(ip); m_pLocalProxy->SetPort(port); m_pLocalProxy->SetName(username); m_pLocalProxy->SetPassword(password); m_critSection.Unlock(); } //try to connect all proxies void CProxiesManager::AutoConnect() { m_critSection.Lock(); for(std::list::iterator it=m_listProxies.begin(); it!=m_listProxies.end(); it++) { ((CProxyConnection*)*it)->Connect(); } m_critSection.Unlock(); } //try to Estabilish new data channel int CProxiesManager::EstablishNewDataChannel(CDllProxyInfo* pProxyInfo , char* IDOfPartner) { int nRet=0; m_critSection.Lock(); CProxyConnection* pProxyConnection=(CProxyConnection*)FindProxy(pProxyInfo); if (pProxyConnection) nRet=pProxyConnection->EstablishNewDataChannel(IDOfPartner); m_critSection.Unlock(); return nRet; } //find a proxy in the list by CDllProxyInfo const CProxyConnection* CProxiesManager::FindProxy(CDllProxyInfo* pProxyInfo) { for(std::list::iterator it=m_listProxies.begin(); it!=m_listProxies.end(); it++) if (((CProxyConnection*)*it)->GetProxyInfo()==pProxyInfo) return (CProxyConnection*)*it; return 0; } //try to connect a socket using the proxy settings bool CProxiesManager::ConnectViaProxy(APISocket::CSocket* pSock, const char* szIp, unsigned int nPort) { if (m_bLocalProxy) return m_proxyConnect.ConnectViaProxy(*pSock, szIp, nPort, (char*)m_pLocalProxy->GetIP(), atoi(m_pLocalProxy->GetPort()), (char*)m_pLocalProxy->GetName(), (char*)m_pLocalProxy->GetPassword())>0; std::string strProxyIP; unsigned int nProxyPort; if (GetIEProxySettings(strProxyIP, nProxyPort)) return m_proxyConnect.ConnectViaProxy(*pSock, szIp, nPort, (char*)strProxyIP.c_str(), nProxyPort, "", "")>0; return false; } //read the Internet Explorer settings about proxy int CProxiesManager::GetIEProxySettings(std::string& strProxyIP, unsigned int& nProxyPort) { #warning Must Implement GetIEProxySettings return 0; } #define WM_PROXY_ERROR (WM_USER+50) void CProxiesManager::ProxyError(CDllProxyInfo* pProxyInfo) { m_critSection.Lock(); proxyError = pProxyInfo; m_critSection.Unlock(); } unsigned long __stdcall CProxiesManager::ReconectProxiesThreadProc(LPVOID lpParameter) { CProxiesManager* pThis = (CProxiesManager*)lpParameter; while (!pThis->shouldQuit) { if (pThis->proxyError) { pThis->DisconnectProxy(pThis->proxyError); pThis->proxyError = NULL; Sleep(1000000); } else { bool sleep15 = false; pThis->m_critSection.Lock(); if (!pThis->m_listProxies.empty()) { sleep15 = true; for (std::list::iterator itProxy = pThis->m_listProxies.begin(); itProxy != pThis->m_listProxies.end(); itProxy++) { CProxyConnection* pProxyConn = (CProxyConnection*)*itProxy; CDllProxyInfo* pProxyInfo = pProxyConn->GetProxyInfo(); int dwStatus = pProxyInfo->GetStatus(); bool bReconnect = pProxyInfo->GetReconnectProxy(); if ((dwStatus & STATUS_DISCONNECTED_FROM_PROXY || (dwStatus == 0)) && bReconnect) { g_globals.m_logger.Write("=>Try reconnect proxy"); pProxyConn->Connect(); g_globals.m_logger.Write("<=Reconnect proxy"); } } } pThis->m_critSection.Unlock(); if (sleep15) Sleep(15000000); else Sleep(1000000); } } pThis->hasQuit = 1; return 0; } ================================================ FILE: Bundles/Echoware/ProxiesManager.h ================================================ #ifndef _PROXIESMANAGER_H #define _PROXIESMANAGER_H #if _MSC_VER > 1000 #pragma once #endif #include "ProxyConnection.h" #include #include "CritSection.h" #include "ProxyConnect/ProxyConnect.h" //a proxies manager class class CProxiesManager { public: CProxiesManager(void); ~CProxiesManager(void); //add a proxy to the proxies list void AddProxy(CDllProxyInfo* pProxyInfo); //remove a proxy from the proxies list void RemoveProxy(CDllProxyInfo* pProxyInfo); //remove all the proxies from the proxies list void RemoveAllProxies(); //connect a proxy int ConnectProxy(CDllProxyInfo* pProxyInfo); //disconnect a proxy bool DisconnectProxy(CDllProxyInfo* pProxyInfo); //disconnect all the proxies bool DisconnectAllProxies(); //stops connecting proxy void StopConnecting(CDllProxyInfo* pProxyInfo); //set a proxy encryption level void SetEncryptionLevel(int level, CDllProxyInfo* pProxyInfo); //set info for the local proxy void SetLocalProxyInfo(char* ip, char* port, char* username, char* password); //try to connect all proxies void AutoConnect(); //try to Estabilish new data channel int EstablishNewDataChannel(CDllProxyInfo* pProxyInfo , char* IDOfPartner); //try to connect a socket using the proxy settings bool ConnectViaProxy(APISocket::CSocket* pSock, const char* szIp, unsigned int nPort); void ProxyError(CDllProxyInfo* pProxyInfo); protected: //read the Internet Explorer settings about proxy int GetIEProxySettings(std::string& strProxyIP, unsigned int& nProxyPort); protected: //find a proxy in the list by CDllProxyInfo const CProxyConnection* FindProxy(CDllProxyInfo* pProxyInfo); static unsigned long __stdcall ReconectProxiesThreadProc(LPVOID lpParameter); void* m_hReconectProxiesThread; unsigned long m_dwReconectProxiesThread; protected: std::list m_listProxies; CDllProxyInfo* m_pLocalProxy; bool m_bLocalProxy; CCritSection m_critSection; CProxyConnect m_proxyConnect; bool shouldQuit; bool hasQuit; CDllProxyInfo *proxyError; }; #endif ================================================ FILE: Bundles/Echoware/ProxyConnect/ProxyConnect.cpp ================================================ #include "stdafx.h" #include #include "proxyconnect.h" #include "ntlm.h" #include #include #include #include #include "EchoToOSX.h" int CProxyConnect::m_nConnectTimeout_secs = 5; int CProxyConnect::m_nReceiveTimeout_secs = 5; int CProxyConnect::m_nSendTimeout_secs = 5; /*int TCPConnectWithTimeout(int sock, const struct sockaddr FAR *name, int namelen, int timeout_secs); int SockReadyToRead(int socket, int timeout_secs); int SockReadyToWrite(int socket, int timeout_secs); int read_byte(int fd); */ extern void base64(unsigned char *out, const unsigned char *in, int len); int read_byte(APISocket::CSocket sock) { unsigned char c; int nLen=1; if(sock.Receive((char*)&c, nLen) == 0 && nLen==1) { return c; } return -1; } #if 0 char * base64Encode(char *str) { static char *encoding = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789+/"; char *s = NULL; char *outBuf = NULL; int len = -1; int i = 0; unsigned long bits; if (str == NULL) { return NULL; } len = strlen(str); /* ** Base64 encoding expands 6 bits to 1 char, padded with '=', if ** necessary. */ int totalLen = 4 * ((len + 2) / 3) + 1; if ((outBuf = (char*)malloc(totalLen)) == NULL) { return NULL; } memset(outBuf, 0, totalLen); s = outBuf; for (i = 0; i <= len - 3; i += 3) { bits = ((unsigned long)(str[i])) << 24; bits |= ((unsigned long)(str[i + 1])) << 16; bits |= ((unsigned long)(str[i + 2])) << 8; *s++ = encoding[bits >> 26]; bits <<= 6; *s++ = encoding[bits >> 26]; bits <<= 6; *s++ = encoding[bits >> 26]; bits <<= 6; *s++ = encoding[bits >> 26]; } switch (len % 3) { case 0: bits = ((unsigned long)(str[i])) << 24; bits |= ((unsigned long)(str[i + 1])) << 16; bits |= ((unsigned long)(str[i + 2])) << 8; *s++ = encoding[bits >> 26]; bits <<= 6; *s++ = encoding[bits >> 26]; bits <<= 6; *s++ = encoding[bits >> 26]; bits <<= 6; *s++ = encoding[bits >> 26]; break; case 2: bits = ((unsigned long)(str[len - 2])) << 24; bits |= ((unsigned long)(str[len - 1])) << 16; *s++ = encoding[bits >> 26]; bits <<= 6; *s++ = encoding[bits >> 26]; bits <<= 6; *s++ = encoding[bits >> 26]; *s++ = '='; break; case 1: bits = ((unsigned long)(str[len - 2])) << 24; *s++ = encoding[bits >> 26]; bits <<= 6; *s++ = encoding[bits >> 26]; *s++ = '='; *s++ = '='; break; } *s = '\0'; return outBuf; } #endif /* int SockReadyToRead(int socket, int timeout_secs) { struct timeval timeout; fd_set readfds; timeout.tv_sec = timeout_secs; timeout.tv_usec = 0; FD_ZERO(&readfds); FD_SET(socket, &readfds); select(1, &readfds, NULL, NULL, &timeout); return FD_ISSET(socket, &readfds); } int SockReadyToWrite(int socket, int timeout_secs) { struct timeval timeout; fd_set writefds; timeout.tv_sec = timeout_secs; timeout.tv_usec = 0; FD_ZERO(&writefds); FD_SET(socket, &writefds); select(1, NULL, &writefds, NULL, &timeout); return FD_ISSET(socket, &writefds); } int TCPConnectWithTimeout(int sock, const struct sockaddr FAR *name, int namelen, int timeout_secs) { int retval = SOCK_OK; unsigned long blockArg; blockArg = 1; if (ioctlsocket(sock, FIONBIO, &blockArg)==0) { connect(sock, name, namelen); if (!SockReadyToWrite(sock, timeout_secs)) { WSASetLastError(WSAETIMEDOUT); retval = SOCK_CONNECT_TIMEOUT; } else { blockArg = 0; ioctlsocket(sock, FIONBIO, &blockArg); retval = SOCK_OK; } } else { retval = SOCK_ERROR; } return retval; } */ int CProxyConnect::ConnectViaSocks5Proxy(APISocket::CSocket sock, const char* destIp, unsigned int destPort, char* proxyIp, unsigned int proxyPort, char* username, char* password) { int ret=sock.Connect(proxyIp, proxyPort); if (ret!=0) return LOCAL_PROXY_CONNECT_FAIL; int i; char buf[512]; unsigned char len; unsigned char atyp; buf[0] = 0x05; buf[1] = 0x01; if(username && password) buf[2] = 0x02; else buf[2] = 0x00; int nLen=3; sock.Send(buf, nLen); if(read_byte(sock) != 0x05 || read_byte(sock) != buf[2]) { sock.Close(); return LOCAL_PROXY_RESP_FAIL; } if(username && password) { unsigned char tmplen; memset(buf, 0, 512); buf[0] = 0x01; len = (unsigned char)((strlen(username) > 255) ? 255 : strlen(username)); buf[1] = len; memcpy(buf + 2, username, len); tmplen = (unsigned char)((strlen(password) > 255) ? 255 : strlen(password)); buf[2 + len] = tmplen; memcpy(buf + 3 + len, password, tmplen); int nLen=(3 + len + tmplen); sock.Send( buf, nLen); if(read_byte(sock) != 0x01 || read_byte(sock) != 0x00) { sock.Close(); return LOCAL_PROXY_AUTH_FAIL; } } buf[0] = SOCKS_V5; buf[1] = SOCKS_CONNECT; buf[2] = 0x00; buf[3] = 0x01; // ipv4 format struct sockaddr_in tempAddr; tempAddr.sin_addr.s_addr = inet_addr(destIp); char ipstr[4]; memcpy(ipstr, &tempAddr.sin_addr.s_addr, 4); memcpy(buf+4, ipstr, 4); unsigned short port = htons(destPort); memcpy(buf+8, (char*)&port, 2); nLen=10; sock.Send(buf, nLen); if(read_byte(sock) != 0x05 || read_byte(sock) != 0x00) { sock.Close(); return LOCAL_PROXY_RESP_FAIL; } read_byte(sock); atyp = read_byte(sock); if(atyp == 0x01) { for(i = 0; i < 4; i++) read_byte(sock); } else if(atyp == 0x03) { len = read_byte(sock); for(i = 0; i < len; i++) read_byte(sock); } else { sock.Close(); return LOCAL_PROXY_RESP_FAIL; } for(i = 0; i < 2; i++) read_byte(sock); return 1; } int CProxyConnect::ConnectViaSocks4Proxy(APISocket::CSocket sock, const char* destIp, unsigned int destPort, char* proxyIp, unsigned int proxyPort, char* username, char* password) { if (sock.Connect(proxyIp, proxyPort)!=0) return LOCAL_PROXY_CONNECT_FAIL; int len=9; char buf[512]; memset(buf, 0, 512); buf[0] = SOCKS_V4; buf[1] = SOCKS_CONNECT; unsigned short port = htons(destPort); memcpy(buf+2, (char*)&port, 2); struct sockaddr_in tempAddr; tempAddr.sin_addr.s_addr = inet_addr(destIp); char ipstr[4]; memcpy(ipstr, &tempAddr.sin_addr.s_addr, 4); memcpy(buf+4, ipstr, 4); if (username) { memcpy(buf+8,username,strlen(username)); len = 9 + (int)strlen(username); } else { buf[8] = 0; /* empty username */ len = 9; } int n=len; sock.Send(buf, n); unsigned char vn_byte = read_byte(sock); if (vn_byte != 0x00) { sock.Close(); return LOCAL_PROXY_RESP_FAIL; } unsigned char cd_byte = read_byte(sock); if(cd_byte != 90) { sock.Close(); return LOCAL_PROXY_AUTH_FAIL; } return 1; } #define MAXLEN 512 int CProxyConnect::ConnectViaHttpProxy(APISocket::CSocket sock, const char* destIp, unsigned int destPort, char* proxyIp, unsigned int proxyPort, char* username, char* password) { //char logstr[512]; char buf[MAX_LINE_SIZE]; char proxyAuth[MAX_LINE_SIZE]; char*bufPtr=NULL; int numRead, numWrite;//, retval; std::string ans; char authstring[MAX_LINE_SIZE]; char* pAuthstring=NULL; memset(buf, 0 , sizeof(buf)); if (sock.Connect(proxyIp, proxyPort)!=0) { return LOCAL_PROXY_CONNECT_FAIL; } if (m_temphttpProxyAuthType==HTTP_AUTH_NTLM) { unsigned char host[MAX_NAME_LEN]; unsigned char domain[MAX_NAME_LEN]; unsigned char user[MAX_NAME_LEN]; char tempusername[MAXLEN]; // // Username = "domain\user" in this case // strcpy((char*)tempusername, (char*)username); if (strstr(tempusername, "\\") !=NULL) { char * pch; pch = strtok (tempusername,"\\"); strcpy((char*)domain, pch); pch = strtok(0, "\\"); strcpy((char*)user, pch); } else { strcpy((char*)domain, ""); strcpy((char*)user, tempusername); } // char pcName[HOST_NAME_MAX+1]; // DWORD nSize = 256; // GetComputerName(pcName, &nSize); // strcpy((char*)host, pcName); gethostname((char *)host, MAX_NAME_LEN); int retnum= DoNTLMv2 ( sock.getSocket(), destIp, destPort, (unsigned char*)host, (unsigned char*)domain, (unsigned char*)user, (unsigned char*)password ); if (retnum <0) { sock.Close(); return retnum; } else { return retnum; } } if (m_temphttpProxyAuthType==HTTP_AUTH_BASIC) { // // Construct a CONNECT string // if (username && password) { sprintf(proxyAuth, "%s:%s", username, password); memset(authstring, 0, MAX_LINE_SIZE); base64((unsigned char*)authstring, (unsigned char*)proxyAuth, strlen(proxyAuth)); sprintf(buf, "CONNECT %s:%hu HTTP/1.0\r\nProxy-Authorization: Basic %s\r\nUser-Agent: echoWare\r\n\r\n", destIp, destPort, authstring); } else { sprintf(buf, "CONNECT %s:%hu HTTP/1.0\r\nUser-Agent: echoWare\r\n\r\n", destIp, destPort); } // // Send to the Proxy // int len=strlen(buf); numWrite = len; if (sock.Send(buf, numWrite)!=0) { goto CloseError; } // // Receive response from Proxy // memset(buf, 0 , sizeof(buf)); bufPtr = buf; numRead=MAX_LINE_SIZE; if (sock.Receive(bufPtr, numRead)!=0 || numRead==0) { sock.Close(); return LOCAL_PROXY_RESP_FAIL; } // // Check for an OK response // if (strncmp(buf, "HTTP/1.0 200", 12)==0 || strncmp(buf, "HTTP/1.1 200", 12)==0) { return 1; } else { sock.Close(); return LOCAL_PROXY_AUTH_FAIL; } } CloseError: sock.Close(); return -1; } // // Return -1=error, 0=non-proxy, 1=sock4, 2=sock5, 3=http/https // int CProxyConnect::TestSocks4Proxy(APISocket::CSocket sock, const char* destIp, unsigned int destPort, char* proxyIp, unsigned int proxyPort, char* username, char* password) { sock.SetTimeouts(m_nConnectTimeout_secs*1000, m_nSendTimeout_secs*1000, m_nReceiveTimeout_secs*1000, sock.GetAcceptTimeout()); if (sock.Connect(proxyIp, proxyPort)!=0) return LOCAL_PROXY_CONNECT_FAIL; char buf[512]; buf[0] = SOCKS_V4; buf[1] = SOCKS_CONNECT; unsigned short port = htons(destPort); memcpy(buf+2, (char*)&port, 2); struct sockaddr_in tempAddr; tempAddr.sin_addr.s_addr = inet_addr(destIp); char ipstr[4]; memcpy(ipstr, &tempAddr.sin_addr.s_addr, 4); memcpy(buf+4, ipstr, 4); buf[8] = 0; /* empty username */ int len=9; if (sock.Send(buf, len) !=0) { sock.Close(); return NONE_TYPE; } unsigned char vn_byte = read_byte(sock); if (vn_byte != 0x00) { sock.Close(); } else { unsigned char cd_byte = read_byte(sock); if(cd_byte == 90 || cd_byte == 91 || cd_byte == 92 || cd_byte == 93) { sock.Close(); return PROXY_TYPE_SOCKS4; } } return NONE_TYPE; } int CProxyConnect::TestSocks5Proxy(APISocket::CSocket sock, const char* destIp, unsigned int destPort, char* proxyIp, unsigned int proxyPort, char* username, char* password) { char buf[512]; sock.SetTimeouts(m_nConnectTimeout_secs*1000, m_nSendTimeout_secs*1000, m_nReceiveTimeout_secs*1000, sock.GetAcceptTimeout()); if (sock.Connect(proxyIp, proxyPort)!=0) { return LOCAL_PROXY_CONNECT_FAIL; } buf[0] = 0x05; buf[1] = 0x01; if(username && password) buf[2] = 0x02; else buf[2] = 0x00; int len=3; if (sock.Send(buf, len) !=0) { sock.Close(); return NONE_TYPE; } int ver = read_byte(sock); int method = read_byte(sock); if ((ver == 0x05 && method == buf[2]) || (ver == 0x05 && method == 0x00)) { sock.Close(); return PROXY_TYPE_SOCKS5; } else { sock.Close(); } return NONE_TYPE; } #include "../globals.h" int CProxyConnect::TestHttpProxy(APISocket::CSocket sock, const char* destIp, unsigned int destPort, char* proxyIp, unsigned int proxyPort, char* username, char* password) { char buf[512]; char authstring[MAX_LINE_SIZE]; sock.SetTimeouts(m_nConnectTimeout_secs*1000, m_nSendTimeout_secs*1000, m_nReceiveTimeout_secs*1000, sock.GetAcceptTimeout()); if (sock.Connect(proxyIp, proxyPort)!=0) { return LOCAL_PROXY_CONNECT_FAIL; } char logstr[512]; char proxyAuth[MAX_LINE_SIZE]; char*bufPtr=NULL; int numRead, numWrite; std::string ans; memset(buf, 0 , sizeof(buf)); // // Construct a CONNECT string // if (username && password) { sprintf(proxyAuth, "%s:%s", username, password); memset(authstring, 0, MAX_LINE_SIZE); base64((unsigned char*)authstring, (unsigned char*)proxyAuth, strlen(proxyAuth)); sprintf(buf, "CONNECT %s:%hu HTTP/1.0\r\nProxy-Authorization: Basic %s\r\nUser-Agent: echoWare\r\n\r\n", destIp, destPort, authstring); } else { sprintf(buf, "CONNECT %s:%hu HTTP/1.0\r\nUser-Agent: echoWare\r\n\r\n", destIp, destPort); } numWrite=strlen(buf); if (sock.Send(buf, numWrite)!=0) { sock.Close(); return NONE_TYPE; } sprintf(logstr, "Sent to the server buf=%s", buf); // // Receive response from Proxy // memset(buf, 0 , sizeof(buf)); bufPtr = buf; numRead=MAX_LINE_SIZE; if (sock.Receive(bufPtr, numRead)!=0) { sock.Close(); } else { if (strncmp(buf, "HTTP/1.0 200", 12)==0 || strncmp(buf, "HTTP/1.1 200", 12)==0) { sock.Close(); return PROXY_TYPE_HTTP; } else { sock.Close(); } } return NONE_TYPE; } int CProxyConnect::DetectProxyType(APISocket::CSocket sock, const char* destIp, unsigned int destPort, char* proxyIp, unsigned int proxyPort, char* username, char* password) { int ret, ret1, ret2, ret3; ret = NONE_TYPE; m_proxyType = NONE_TYPE; if (strcmp(proxyIp, "")==0) { goto Done; } if (strcmp(username, "")!=0) ret1 = TestSocks5Proxy(sock, destIp, destPort, proxyIp, proxyPort, username, password); else ret1 = TestSocks5Proxy(sock, destIp, destPort, proxyIp, proxyPort, NULL, NULL); if (ret1 == PROXY_TYPE_SOCKS5) { m_proxyType = PROXY_TYPE_SOCKS5; ret = ret1; goto Done; } else if (ret1 == LOCAL_PROXY_CONNECT_FAIL) { ret = LOCAL_PROXY_CONNECT_FAIL; goto Done; } if (strcmp(username, "")!=0) ret2 = TestSocks4Proxy(sock, destIp, destPort, proxyIp, proxyPort, username, password); else ret2 = TestSocks4Proxy(sock, destIp, destPort, proxyIp, proxyPort, NULL, NULL); if (ret2 == PROXY_TYPE_SOCKS4) { m_proxyType = PROXY_TYPE_SOCKS4; ret = ret2; goto Done; } else if (ret2 == LOCAL_PROXY_CONNECT_FAIL) { ret = LOCAL_PROXY_CONNECT_FAIL; goto Done; } ret3 = AnalyzeHttpProxy(sock, destIp, destPort, proxyIp, proxyPort, username, password); if (ret3 == LOCAL_PROXY_CONNECT_FAIL) { ret = LOCAL_PROXY_CONNECT_FAIL; goto Done; } else if (ret3 >0) { m_httpProxyAuthType = ret3; m_proxyType = PROXY_TYPE_HTTP; ret = PROXY_TYPE_HTTP; } else { } Done: return ret; } int CProxyConnect::ConnectViaProxy(APISocket::CSocket sock, const char* destIp, unsigned int destPort, char* proxyIp, unsigned int proxyPort, char* username, char* password) { try { if (m_bIsAutoDetectDone==false) { DetectProxyType ( sock, destIp, destPort, proxyIp, proxyPort, username, password ); if (m_proxyType != NONE_TYPE) m_bIsAutoDetectDone = true; } if (m_proxyType==PROXY_TYPE_SOCKS4) { if (strcmp(username, "")!=0) return ConnectViaSocks4Proxy ( sock, destIp, destPort, proxyIp, proxyPort, username, password ); else return ConnectViaSocks4Proxy ( sock, destIp, destPort, proxyIp, proxyPort, NULL, NULL ); } else if (m_proxyType==PROXY_TYPE_SOCKS5) { if (strcmp(username, "")!=0) return ConnectViaSocks5Proxy ( sock, destIp, destPort, proxyIp, proxyPort, username, password ); else return ConnectViaSocks5Proxy ( sock, destIp, destPort, proxyIp, proxyPort, NULL, NULL ); } else if (m_proxyType==PROXY_TYPE_HTTP) { if (m_httpProxyAuthType==HTTP_AUTH_BASIC) m_temphttpProxyAuthType = HTTP_AUTH_BASIC; else if (m_httpProxyAuthType==HTTP_AUTH_NTLM) m_temphttpProxyAuthType = HTTP_AUTH_NTLM; else if (m_httpProxyAuthType==HTTP_AUTH_BASIC_NTLM) m_temphttpProxyAuthType = HTTP_AUTH_BASIC; else if (m_httpProxyAuthType==HTTP_AUTH_NTLM_BASIC) m_temphttpProxyAuthType = HTTP_AUTH_NTLM; else m_temphttpProxyAuthType = HTTP_AUTH_BASIC; TryAgain: int retnum=-1; if (strcmp(username, "")!=0) retnum = ConnectViaHttpProxy ( sock, destIp, destPort, proxyIp, proxyPort, username, password ); else retnum = ConnectViaHttpProxy ( sock, destIp, destPort, proxyIp, proxyPort, NULL, NULL ); if (retnum <=0) { if (m_httpProxyAuthType==HTTP_AUTH_BASIC_NTLM && m_temphttpProxyAuthType==HTTP_AUTH_BASIC) { m_temphttpProxyAuthType=HTTP_AUTH_NTLM; goto TryAgain; } else if (m_httpProxyAuthType==HTTP_AUTH_NTLM_BASIC && m_temphttpProxyAuthType==HTTP_AUTH_NTLM) { m_temphttpProxyAuthType=HTTP_AUTH_BASIC; goto TryAgain; } } return retnum; } } catch(...) {} return -1; } CProxyConnect::CProxyConnect() { m_bIsAutoDetectDone = false; m_httpProxyAuthType = -1; m_temphttpProxyAuthType = -1; } CProxyConnect::~CProxyConnect() { } int CProxyConnect::AnalyzeHttpProxy(APISocket::CSocket sock, const char* destIp, unsigned int destPort, char* proxyIp, unsigned int proxyPort, char* username, char* password) { char buf[MAX_BUFFER_SIZE]; /*int fd; struct sockaddr_in destAddr; fd = socket(AF_INET, SOCK_STREAM, 0); if(fd == -1) return -1; memset(&destAddr, 0, sizeof(destAddr)); destAddr.sin_family = AF_INET; destAddr.sin_addr.s_addr = inet_addr(proxyIp); destAddr.sin_port = htons(proxyPort); if (TCPConnectWithTimeout(fd, (struct sockaddr*)&destAddr,sizeof(destAddr), connectTimeout_secs)!=SOCK_OK) { closesocket(fd); return LOCAL_PROXY_CONNECT_FAIL;; } */ sock.SetTimeouts(m_nConnectTimeout_secs*1000, m_nSendTimeout_secs*1000, m_nReceiveTimeout_secs*1000, sock.GetAcceptTimeout()); if (sock.Connect(proxyIp, proxyPort)!=0) return LOCAL_PROXY_CONNECT_FAIL; char logstr[4096]; char*bufPtr=NULL; int numRead, numWrite; memset(buf, 0 , sizeof(buf)); sprintf(buf, "CONNECT %s:%hu HTTP/1.0\r\nUser-Agent: echoWare\r\n\r\n", destIp, destPort); numWrite=strlen(buf); if (sock.Send(buf, numWrite)!=0) { sock.Close(); return -1; } sprintf(logstr, "Dll : AnalyzeHttpProxy: Sent buf(Actual:%d/Sent:%d)=%s", strlen(buf), numWrite, buf); // // Receive response from Proxy // memset(buf, 0 , sizeof(buf)); bufPtr = buf; numRead=MAX_BUFFER_SIZE; if (sock.Receive(buf, numRead)!=0) { sock.Close(); return -1; } else { if ((strncmp(buf, "HTTP/1.1 407", strlen("HTTP/1.1 407"))==0) || (strncmp(buf, "HTTP/1.0 407", strlen("HTTP/1.0 407"))==0)) { char* s1 = strstr(buf, "Proxy-Authenticate: Basic"); char* s2 = strstr(buf, "Proxy-Authenticate: NTLM"); if (s1!=NULL && s2==NULL) { // Basic Auth sock.Close(); return HTTP_AUTH_BASIC; } else if (s1==NULL && s2!=NULL) { // NTLM Auth sock.Close(); return HTTP_AUTH_NTLM; } else if (s1!=NULL && s2!=NULL) { if (s1 < s2) { // Basic Auth sock.Close(); //return HTTP_AUTH_BASIC_NTLM; return HTTP_AUTH_NTLM_BASIC; //always try NTLM first } else { // NTLM Auth sock.Close(); //return HTTP_AUTH_BASIC_NTLM; return HTTP_AUTH_NTLM_BASIC; } } else { //something different } } else if (strncmp(buf, "HTTP/1.0 200", 12)==0 || strncmp(buf, "HTTP/1.1 200", 12)==0) { sock.Close(); return HTTP_AUTH_BASIC; } } sock.Close(); return -1; } ================================================ FILE: Bundles/Echoware/ProxyConnect/ProxyConnect.dsp ================================================ # Microsoft Developer Studio Project File - Name="ProxyConnect" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Static Library" 0x0104 CFG=ProxyConnect - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "ProxyConnect.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "ProxyConnect.mak" CFG="ProxyConnect - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "ProxyConnect - Win32 Release" (based on "Win32 (x86) Static Library") !MESSAGE "ProxyConnect - Win32 Debug" (based on "Win32 (x86) Static Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "ProxyConnect - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "ProxyConnect___Win32_Release" # PROP BASE Intermediate_Dir "ProxyConnect___Win32_Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release6" # PROP Intermediate_Dir "Release6" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo /out:"..\Release6\ProxyConnect.lib" !ELSEIF "$(CFG)" == "ProxyConnect - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "ProxyConnect___Win32_Debug" # PROP BASE Intermediate_Dir "ProxyConnect___Win32_Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug6" # PROP Intermediate_Dir "Debug6" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c # ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo /out:"..\Debug6\ProxyConnect.lib" !ENDIF # Begin Target # Name "ProxyConnect - Win32 Release" # Name "ProxyConnect - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=.\md4.cpp # End Source File # Begin Source File SOURCE=.\md5.cpp # End Source File # Begin Source File SOURCE=.\ntlmv2.cpp # End Source File # Begin Source File SOURCE=.\ProxyConnect.cpp # End Source File # Begin Source File SOURCE=.\stdafx.cpp # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=.\md4.h # End Source File # Begin Source File SOURCE=.\md5.h # End Source File # Begin Source File SOURCE=.\ProxyConnect.h # End Source File # Begin Source File SOURCE=.\stdafx.h # End Source File # End Group # Begin Group "APISocket" # PROP Default_Filter "" # Begin Source File SOURCE=..\APISocket\APISocket.h # End Source File # Begin Source File SOURCE=..\APISocket\ClientSocket.cpp # End Source File # Begin Source File SOURCE=..\APISocket\ServerSocket.cpp # End Source File # Begin Source File SOURCE=..\APISocket\Socket.cpp # End Source File # End Group # End Target # End Project ================================================ FILE: Bundles/Echoware/ProxyConnect/ProxyConnect.h ================================================ #if !defined(_PROXY_CONNECT_) #define _PROXY_CONNECT_ #if _MSC_VER > 1000 #pragma once #endif #define LOCAL_PROXY_CONNECT_FAIL -10 #define LOCAL_PROXY_AUTH_FAIL -11 #define LOCAL_PROXY_RESP_FAIL -12 #define LOCAL_PROXY_RECV_FAIL -13 #define SOCK_ERROR -1 #define SOCK_OK 0 #define MAX_LINE_SIZE 1024 #define MAX_BUFFER_SIZE 65536 #define SOCK_CONNECT_TIMEOUT 100 #define SOCK_SEND_TIMEOUT 101 #define SOCK_RECEIVE_TIMEOUT 102 #define SOCKS_V5 5 #define SOCKS_V4 4 #define SOCKS_NOAUTH 0 #define SOCKS_NOMETHOD 0xff #define SOCKS_CONNECT 1 #define HTTP_AUTH_NO 1 #define HTTP_AUTH_BASIC 2 #define HTTP_AUTH_NTLM 3 #define HTTP_AUTH_NTLM_BASIC 4 #define HTTP_AUTH_BASIC_NTLM 5 #define NONE_TYPE 0 //#define SOCKS4_TYPE 1 //#define SOCKS5_TYPE 2 //#define HTTP_TYPE 3 //#define PROXY_TYPE_AUTO_DECTECT 0 #define PROXY_TYPE_SOCKS4 1 #define PROXY_TYPE_SOCKS5 2 #define PROXY_TYPE_HTTP 3 #include "../APISocket/APISocket.h" class CProxyConnect { public: CProxyConnect(); ~CProxyConnect(); int TestSocks4Proxy(APISocket::CSocket sock, const char* destIp, unsigned int destPort, char* proxyIp, unsigned int proxyPort, char* username, char* password); int TestSocks5Proxy(APISocket::CSocket sock, const char* destIp, unsigned int destPort, char* proxyIp, unsigned int proxyPort, char* username, char* password); int TestHttpProxy(APISocket::CSocket sock, const char* destIp, unsigned int destPort, char* proxyIp, unsigned int proxyPort, char* username, char* password); int DetectProxyType(APISocket::CSocket sock, const char* destIp, unsigned int destPort, char* proxyIp, unsigned int proxyPort, char* username, char* password); int ConnectViaHttpProxy(APISocket::CSocket sock, const char* destIp, unsigned int destPort, char* proxyIp, unsigned int proxyPort, char* username, char* password); int ConnectViaSocks5Proxy(APISocket::CSocket sock, const char* destIp, unsigned int destPort, char* proxyIp, unsigned int proxyPort, char* username, char* password); int ConnectViaSocks4Proxy(APISocket::CSocket sock, const char* destIp, unsigned int destPort, char* proxyIp, unsigned int proxyPort, char* username, char* password); int ConnectViaProxy(APISocket::CSocket sock, const char* destIp, unsigned int destPort, char* proxyIp, unsigned int proxyPort, char* username, char* password); int AnalyzeHttpProxy(APISocket::CSocket sock, const char* destIp, unsigned int destPort, char* proxyIp, unsigned int proxyPort, char* username, char* password); int m_httpProxyAuthType; int m_temphttpProxyAuthType; int m_proxyType; bool m_bIsAutoDetectDone; protected: static int m_nConnectTimeout_secs; static int m_nReceiveTimeout_secs; static int m_nSendTimeout_secs; }; #endif ================================================ FILE: Bundles/Echoware/ProxyConnect/ProxyConnect.vcproj ================================================ ================================================ FILE: Bundles/Echoware/ProxyConnect/global.h ================================================ /* GLOBAL.H - RSAREF types and constants */ /* PROTOTYPES should be set to one if and only if the compiler supports function argument prototyping. The following makes PROTOTYPES default to 0 if it has not already been defined with C compiler flags. */ #ifndef PROTOTYPES #define PROTOTYPES 0 #endif /* POINTER defines a generic pointer type */ typedef unsigned char *POINTER; /* UINT2 defines a two byte word */ typedef unsigned short int UINT2; /* UINT4 defines a four byte word */ typedef unsigned long int UINT4; /* PROTO_LIST is defined depending on how PROTOTYPES is defined above. If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it returns an empty list. */ #if PROTOTYPES #define PROTO_LIST(list) list #else #define PROTO_LIST(list) () #endif ================================================ FILE: Bundles/Echoware/ProxyConnect/md4.cpp ================================================ /* MD4C.C - RSA Data Security, Inc., MD4 message-digest algorithm */ /* Copyright (C) 1990-2, RSA Data Security, Inc. All rights reserved. License to copy and use this software is granted provided that it is identified as the "RSA Data Security, Inc. MD4 Message-Digest Algorithm" in all material mentioning or referencing this software or this function. License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Data Security, Inc. MD4 Message-Digest Algorithm" in all material mentioning or referencing the derived work. RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind. These notices must be retained in any copies of any part of this documentation and/or software. */ #include "stdafx.h" #include "stdio.h" #include "string.h" #include "stdlib.h" #include "global.h" #include "md4.h" #define printf /* Constants for MD4Transform routine. */ #define S11 3 #define S12 7 #define S13 11 #define S14 19 #define S21 3 #define S22 5 #define S23 9 #define S24 13 #define S31 3 #define S32 9 #define S33 11 #define S34 15 static void MD4Transform(UINT4 [4], unsigned char [64]); static void Encode(unsigned char *, UINT4 *, unsigned int); static void Decode(UINT4 *, unsigned char *, unsigned int); static void MD4_memcpy(POINTER, POINTER, unsigned int); static void MD4_memset(POINTER, int, unsigned int); static unsigned char PADDING[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* F, G and H are basic MD4 functions. */ #define F(x, y, z) (((x) & (y)) | ((~x) & (z))) #define G(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z))) #define H(x, y, z) ((x) ^ (y) ^ (z)) /* ROTATE_LEFT rotates x left n bits. */ #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) /* FF, GG and HH are transformations for rounds 1, 2 and 3 */ /* Rotation is separate from addition to prevent recomputation */ #define FF(a, b, c, d, x, s) { \ (a) += F ((b), (c), (d)) + (x); \ (a) = ROTATE_LEFT ((a), (s)); \ } #define GG(a, b, c, d, x, s) { \ (a) += G ((b), (c), (d)) + (x) + (UINT4)0x5a827999; \ (a) = ROTATE_LEFT ((a), (s)); \ } #define HH(a, b, c, d, x, s) { \ (a) += H ((b), (c), (d)) + (x) + (UINT4)0x6ed9eba1; \ (a) = ROTATE_LEFT ((a), (s)); \ } /* MD4 initialization. Begins an MD4 operation, writing a new context. */ void MD4Init(MD4_CTX* context) { context->count[0] = context->count[1] = 0; /* Load magic initialization constants. */ context->state[0] = 0x67452301; context->state[1] = 0xefcdab89; context->state[2] = 0x98badcfe; context->state[3] = 0x10325476; } /* MD4 block update operation. Continues an MD4 message-digest operation, processing another message block, and updating the context. */ void MD4Update(MD4_CTX *context, unsigned char *input, unsigned int inputLen) { unsigned int i, index, partLen; /* Compute number of bytes mod 64 */ index = (unsigned int)((context->count[0] >> 3) & 0x3F); /* Update number of bits */ if ((context->count[0] += ((UINT4)inputLen << 3)) < ((UINT4)inputLen << 3)) context->count[1]++; context->count[1] += ((UINT4)inputLen >> 29); partLen = 64 - index; /* Transform as many times as possible. */ if (inputLen >= partLen) { MD4_memcpy((POINTER)&context->buffer[index], (POINTER)input, partLen); MD4Transform (context->state, context->buffer); for (i = partLen; i + 63 < inputLen; i += 64) MD4Transform (context->state, &input[i]); index = 0; } else i = 0; /* Buffer remaining input */ MD4_memcpy ((POINTER)&context->buffer[index], (POINTER)&input[i], inputLen-i); } /* MD4 finalization. Ends an MD4 message-digest operation, writing the the message digest and zeroizing the context. */ void MD4Final(unsigned char digest[16], MD4_CTX *context) { unsigned char bits[8]; unsigned int index, padLen; /* Save number of bits */ Encode (bits, context->count, 8); /* Pad out to 56 mod 64. */ index = (unsigned int)((context->count[0] >> 3) & 0x3f); padLen = (index < 56) ? (56 - index) : (120 - index); MD4Update (context, PADDING, padLen); /* Append length (before padding) */ MD4Update (context, bits, 8); /* Store state in digest */ Encode (digest, context->state, 16); /* Zeroize sensitive information. */ MD4_memset ((POINTER)context, 0, sizeof (*context)); } /* MD4 basic transformation. Transforms state based on block. */ static void MD4Transform ( UINT4 state[4], unsigned char block[64] ) { UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; Decode (x, block, 64); /* Round 1 */ FF (a, b, c, d, x[ 0], S11); /* 1 */ FF (d, a, b, c, x[ 1], S12); /* 2 */ FF (c, d, a, b, x[ 2], S13); /* 3 */ FF (b, c, d, a, x[ 3], S14); /* 4 */ FF (a, b, c, d, x[ 4], S11); /* 5 */ FF (d, a, b, c, x[ 5], S12); /* 6 */ FF (c, d, a, b, x[ 6], S13); /* 7 */ FF (b, c, d, a, x[ 7], S14); /* 8 */ FF (a, b, c, d, x[ 8], S11); /* 9 */ FF (d, a, b, c, x[ 9], S12); /* 10 */ FF (c, d, a, b, x[10], S13); /* 11 */ FF (b, c, d, a, x[11], S14); /* 12 */ FF (a, b, c, d, x[12], S11); /* 13 */ FF (d, a, b, c, x[13], S12); /* 14 */ FF (c, d, a, b, x[14], S13); /* 15 */ FF (b, c, d, a, x[15], S14); /* 16 */ /* Round 2 */ GG (a, b, c, d, x[ 0], S21); /* 17 */ GG (d, a, b, c, x[ 4], S22); /* 18 */ GG (c, d, a, b, x[ 8], S23); /* 19 */ GG (b, c, d, a, x[12], S24); /* 20 */ GG (a, b, c, d, x[ 1], S21); /* 21 */ GG (d, a, b, c, x[ 5], S22); /* 22 */ GG (c, d, a, b, x[ 9], S23); /* 23 */ GG (b, c, d, a, x[13], S24); /* 24 */ GG (a, b, c, d, x[ 2], S21); /* 25 */ GG (d, a, b, c, x[ 6], S22); /* 26 */ GG (c, d, a, b, x[10], S23); /* 27 */ GG (b, c, d, a, x[14], S24); /* 28 */ GG (a, b, c, d, x[ 3], S21); /* 29 */ GG (d, a, b, c, x[ 7], S22); /* 30 */ GG (c, d, a, b, x[11], S23); /* 31 */ GG (b, c, d, a, x[15], S24); /* 32 */ /* Round 3 */ HH (a, b, c, d, x[ 0], S31); /* 33 */ HH (d, a, b, c, x[ 8], S32); /* 34 */ HH (c, d, a, b, x[ 4], S33); /* 35 */ HH (b, c, d, a, x[12], S34); /* 36 */ HH (a, b, c, d, x[ 2], S31); /* 37 */ HH (d, a, b, c, x[10], S32); /* 38 */ HH (c, d, a, b, x[ 6], S33); /* 39 */ HH (b, c, d, a, x[14], S34); /* 40 */ HH (a, b, c, d, x[ 1], S31); /* 41 */ HH (d, a, b, c, x[ 9], S32); /* 42 */ HH (c, d, a, b, x[ 5], S33); /* 43 */ HH (b, c, d, a, x[13], S34); /* 44 */ HH (a, b, c, d, x[ 3], S31); /* 45 */ HH (d, a, b, c, x[11], S32); /* 46 */ HH (c, d, a, b, x[ 7], S33); /* 47 */ HH (b, c, d, a, x[15], S34); /* 48 */ state[0] += a; state[1] += b; state[2] += c; state[3] += d; /* Zeroize sensitive information. */ MD4_memset ((POINTER)x, 0, sizeof (x)); } /* Encodes input (UINT4) into output (unsigned char). Assumes len is a multiple of 4. */ static void Encode ( unsigned char *output, UINT4 *input, unsigned int len ) { unsigned int i, j; for (i = 0, j = 0; j < len; i++, j += 4) { output[j] = (unsigned char)(input[i] & 0xff); output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); } } /* Decodes input (unsigned char) into output (UINT4). Assumes len is a multiple of 4. */ static void Decode ( UINT4 *output, unsigned char *input, unsigned int len ) { unsigned int i, j; for (i = 0, j = 0; j < len; i++, j += 4) output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); } /* Note: Replace "for loop" with standard memcpy if possible. */ static void MD4_memcpy ( POINTER output, POINTER input, unsigned int len ) { unsigned int i; for (i = 0; i < len; i++) output[i] = input[i]; } /* Note: Replace "for loop" with standard memset if possible. */ static void MD4_memset ( POINTER output, int value, unsigned int len ) { unsigned int i; for (i = 0; i < len; i++) ((char *)output)[i] = (char)value; } ================================================ FILE: Bundles/Echoware/ProxyConnect/md4.h ================================================ #if !defined(_MD4_) #define _MD4_ /* MD4.H - header file for MD4C.C */ /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved. License to copy and use this software is granted provided that it is identified as the "RSA Data Security, Inc. MD4 Message-Digest Algorithm" in all material mentioning or referencing this software or this function. License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Data Security, Inc. MD4 Message-Digest Algorithm" in all material mentioning or referencing the derived work. RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind. These notices must be retained in any copies of any part of this documentation and/or software. */ /* MD4 context. */ #include "stdafx.h" #include "stdio.h" #include "string.h" #include "stdlib.h" #include "global.h" typedef struct { UINT4 state[4]; /* state (ABCD) */ UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ unsigned char buffer[64]; /* input buffer */ } MD4_CTX; void MD4Init(MD4_CTX* context); void MD4Update(MD4_CTX *context, unsigned char *input, unsigned int inputLen); void MD4Final(unsigned char digest[16], MD4_CTX *context); #endif ================================================ FILE: Bundles/Echoware/ProxyConnect/md5.cpp ================================================ /* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm */ /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved. License to copy and use this software is granted provided that it is identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing this software or this function. License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing the derived work. RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind. These notices must be retained in any copies of any part of this documentation and/or software. */ #include "stdafx.h" #include "global.h" #include "md5.h" #define printf /* Constants for MD5Transform routine. */ #define S11 7 #define S12 12 #define S13 17 #define S14 22 #define S21 5 #define S22 9 #define S23 14 #define S24 20 #define S31 4 #define S32 11 #define S33 16 #define S34 23 #define S41 6 #define S42 10 #define S43 15 #define S44 21 static void MD5Transform(UINT4 [4], unsigned char [64]); static void Encode(unsigned char *, UINT4 *, unsigned int); static void Decode(UINT4 *, unsigned char *, unsigned int); static void MD5_memcpy(POINTER, POINTER, unsigned int); static void MD5_memset(POINTER, int, unsigned int); static unsigned char PADDING[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* F, G, H and I are basic MD5 functions. */ #define F(x, y, z) (((x) & (y)) | ((~x) & (z))) #define G(x, y, z) (((x) & (z)) | ((y) & (~z))) #define H(x, y, z) ((x) ^ (y) ^ (z)) #define I(x, y, z) ((y) ^ ((x) | (~z))) /* ROTATE_LEFT rotates x left n bits. */ #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) /* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. Rotation is separate from addition to prevent recomputation. */ #define FF(a, b, c, d, x, s, ac) { \ (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define GG(a, b, c, d, x, s, ac) { \ (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define HH(a, b, c, d, x, s, ac) { \ (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define II(a, b, c, d, x, s, ac) { \ (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } /* MD5 initialization. Begins an MD5 operation, writing a new context. */ void MD5Init ( MD5_CTX *context /* context */ ) { context->count[0] = context->count[1] = 0; /* Load magic initialization constants. */ context->state[0] = 0x67452301; context->state[1] = 0xefcdab89; context->state[2] = 0x98badcfe; context->state[3] = 0x10325476; } /* MD5 block update operation. Continues an MD5 message-digest operation, processing another message block, and updating the context. */ void MD5Update ( MD5_CTX *context, /* context */ unsigned char *input, /* input block */ unsigned int inputLen /* length of input block */ ) { unsigned int i, index, partLen; /* Compute number of bytes mod 64 */ index = (unsigned int)((context->count[0] >> 3) & 0x3F); /* Update number of bits */ if ((context->count[0] += ((UINT4)inputLen << 3)) < ((UINT4)inputLen << 3)) context->count[1]++; context->count[1] += ((UINT4)inputLen >> 29); partLen = 64 - index; /* Transform as many times as possible. */ if (inputLen >= partLen) { MD5_memcpy ((POINTER)&context->buffer[index], (POINTER)input, partLen); MD5Transform (context->state, context->buffer); for (i = partLen; i + 63 < inputLen; i += 64) MD5Transform (context->state, &input[i]); index = 0; } else i = 0; /* Buffer remaining input */ MD5_memcpy ((POINTER)&context->buffer[index], (POINTER)&input[i], inputLen-i); } /* MD5 finalization. Ends an MD5 message-digest operation, writing the the message digest and zeroizing the context. */ void MD5Final ( unsigned char digest[16], /* message digest */ MD5_CTX *context /* context */ ) { unsigned char bits[8]; unsigned int index, padLen; /* Save number of bits */ Encode (bits, context->count, 8); /* Pad out to 56 mod 64. */ index = (unsigned int)((context->count[0] >> 3) & 0x3f); padLen = (index < 56) ? (56 - index) : (120 - index); MD5Update (context, PADDING, padLen); /* Append length (before padding) */ MD5Update (context, bits, 8); /* Store state in digest */ Encode (digest, context->state, 16); /* Zeroize sensitive information. */ MD5_memset ((POINTER)context, 0, sizeof (*context)); } /* MD5 basic transformation. Transforms state based on block. */ static void MD5Transform ( UINT4 state[4], unsigned char block[64] ) { UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; Decode (x, block, 64); /* Round 1 */ FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ /* Round 2 */ GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */ GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ /* Round 3 */ HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ /* Round 4 */ II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ state[0] += a; state[1] += b; state[2] += c; state[3] += d; /* Zeroize sensitive information. */ MD5_memset ((POINTER)x, 0, sizeof (x)); } /* Encodes input (UINT4) into output (unsigned char). Assumes len is a multiple of 4. */ static void Encode ( unsigned char *output, UINT4 *input, unsigned int len ) { unsigned int i, j; for (i = 0, j = 0; j < len; i++, j += 4) { output[j] = (unsigned char)(input[i] & 0xff); output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); } } /* Decodes input (unsigned char) into output (UINT4). Assumes len is a multiple of 4. */ static void Decode ( UINT4 *output, unsigned char *input, unsigned int len ) { unsigned int i, j; for (i = 0, j = 0; j < len; i++, j += 4) output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); } /* Note: Replace "for loop" with standard memcpy if possible. */ static void MD5_memcpy(POINTER output, POINTER input, unsigned int len) { unsigned int i; for (i = 0; i < len; i++) output[i] = input[i]; } /* Note: Replace "for loop" with standard memset if possible. */ static void MD5_memset(POINTER output,int value,unsigned int len) { unsigned int i; for (i = 0; i < len; i++) ((char *)output)[i] = (char)value; } ================================================ FILE: Bundles/Echoware/ProxyConnect/md5.h ================================================ #if !defined(_MD5_) #define _MD5_ /* MD5.H - header file for MD5C.C */ /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved. License to copy and use this software is granted provided that it is identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing this software or this function. License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing the derived work. RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind. These notices must be retained in any copies of any part of this documentation and/or software. */ /* MD5 context. */ #include "global.h" typedef struct { UINT4 state[4]; /* state (ABCD) */ UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ unsigned char buffer[64]; /* input buffer */ } MD5_CTX; void MD5Init(MD5_CTX *); void MD5Update(MD5_CTX *, unsigned char *, unsigned int); void MD5Final(unsigned char [16], MD5_CTX *); #endif ================================================ FILE: Bundles/Echoware/ProxyConnect/ntlm.h ================================================ #if !defined(_NTLM_) #define _NTLM_ #define MAX_HOSTLEN 32 #define MAX_DOMLEN 32 #define MAX_USERLEN 32 #define RESP_LEN 24 #define NONCE_LEN 8 #define MAX_NAME_LEN 64 #define MAX_MSG_LEN 2048 #define NTLM_NEG_UNICODE 0x00000001 #define NTLM_NEG_OEM 0x00000002 #define NTLM_REQ_TARGET 0x00000004 #define NTLM_NEG_NTLM 0x00000200 #define NTLM_NEG_DOMAIN 0x00001000 #define NTLM_NEG_LOCAL 0x00004000 #define NTLM_NEG_ASIGN 0x00008000 #define NTLM_TAR_DOMAIN 0x00010000 #define NTLM_NEG_NTLM2 0x00080000 #define NTLM_MSG_TYPE_1 0x00000001 #define NTLM_MSG_TYPE_2 0x00000002 #define NTLM_MSG_TYPE_3 0x00000003 int DoNTLMv1 ( int sock, const char* destIp, unsigned int destPort, unsigned char host[MAX_NAME_LEN], unsigned char domain[MAX_NAME_LEN], unsigned char user[MAX_NAME_LEN], unsigned char password[MAX_NAME_LEN] ); int DoNTLMv2 ( int sock, const char* destIp, unsigned int destPort, unsigned char host[MAX_NAME_LEN], unsigned char domain[MAX_NAME_LEN], unsigned char user[MAX_NAME_LEN], unsigned char password[MAX_NAME_LEN] ); #endif ================================================ FILE: Bundles/Echoware/ProxyConnect/ntlmv2.cpp ================================================ //////////////////////////////////////////////////////////////////////////// // EchoWare is Copyright (C) 2004,2005 Echogent Systems, Inc. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // * Redistributions in any form must be accompanied by information on how // to obtain complete source code for the echoware software and any // accompanying software that uses the echoware software. The source code // must either be included in the distribution or be available for no more // than the cost of distribution plus a nominal fee, and must be freely // redistributable under reasonable conditions. For an executable file, // complete source code means the source code for all modules it contains. // It does not include source code for modules or files that typically // accompany the major components of the operating system on which the // executable file runs. // THIS SOFTWARE IS PROVIDED BY ECHOGENT SYSTEMS, INC. ``AS IS'' AND ANY EXPRESS //OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES //OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, //ARE DISCLAIMED. IN NO EVENT SHALL ECHOGENT SYSTEMS, INC. BE LIABLE FOR ANY //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF //THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // //For more information: echoware@echogent.com // //////////////////////////////////////////////////////////////////////////// #include "stdafx.h" //#include "afx.h" #include "iostream" //#include "windows.h" #include "stdio.h" #include "string.h" #include "stdlib.h" #include "stdafx.h" #include "proxyconnect.h" #include "Echoware.h" /*#include "VPNProxyDllManager.h"*/ #include "md5.h" #include "md4.h" #include "ntlm.h" #include "sys/socket.h" #include "EchoToOSX.h" #define printf //typedef unsigned __int8 uint8_t; //typedef unsigned __int16 uint16_t; //typedef unsigned __int32 uint32_t; //typedef unsigned __int64 uint64_t; //typedef __int8 int8_t; //typedef __int16 int16_t; //typedef __int32 int32_t; //typedef __int64 int64_t; #define bzero( x, n) memset(x, 0, n) #define bcopy( s, d, len) memcpy(d, s, len) /* ** Function: hmac_md5 */ void hmac_md5( unsigned char* text, /* pointer to data stream */ int text_len, /* length of data stream */ unsigned char* key, /* pointer to authentication key */ int key_len, /* length of authentication key */ unsigned char digest[16] /* caller digest to be filled in */ ) { MD5_CTX context; unsigned char k_ipad[65]; /* inner padding - * key XORd with ipad */ unsigned char k_opad[65]; /* outer padding - * key XORd with opad */ unsigned char tk[16]; int i; /* if key is longer than 64 bytes reset it to key=MD5(key) */ if (key_len > 64) { MD5_CTX tctx; MD5Init(&tctx); MD5Update(&tctx, key, key_len); MD5Final(tk, &tctx); key = tk; key_len = 16; } /* * the HMAC_MD5 transform looks like: * * MD5(K XOR opad, MD5(K XOR ipad, text)) * * where K is an n byte key * ipad is the byte 0x36 repeated 64 times * opad is the byte 0x5c repeated 64 times * and text is the data being protected */ /* start out by storing key in pads */ bzero( k_ipad, sizeof k_ipad); bzero( k_opad, sizeof k_opad); bcopy( key, k_ipad, key_len); bcopy( key, k_opad, key_len); /* XOR key with ipad and opad values */ for (i=0; i<64; i++) { k_ipad[i] ^= 0x36; k_opad[i] ^= 0x5c; } /* * perform inner MD5 */ MD5Init(&context); /* init context for 1st * pass */ MD5Update(&context, k_ipad, 64); /* start with inner pad */ MD5Update(&context, text, text_len); /* then text of datagram */ MD5Final(digest, &context); /* finish up 1st pass */ /* * perform outer MD5 */ MD5Init(&context); /* init context for 2nd * pass */ MD5Update(&context, k_opad, 64); /* start with outer pad */ MD5Update(&context, digest, 16); /* then results of 1st * hash */ MD5Final(digest, &context); /* finish up 2nd pass */ } static const char base64digits[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; #define BAD -1 static const char base64val[] = { BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD, 62, BAD,BAD,BAD, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,BAD,BAD, BAD,BAD,BAD,BAD, BAD, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,BAD, BAD,BAD,BAD,BAD, BAD, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,BAD, BAD,BAD,BAD,BAD }; #define DECODE64(c) (isascii(c) ? base64val[c] : BAD) #ifndef MAX #define MAX( x, y ) ( ( (x)>(y) ) ? (x) : (y) ) #endif void base64(unsigned char *out, const unsigned char *in, int len) { while (len >= 3) { *out++ = base64digits[in[0] >> 2]; *out++ = base64digits[((in[0] << 4) & 0x30) | (in[1] >> 4)]; *out++ = base64digits[((in[1] << 2) & 0x3c) | (in[2] >> 6)]; *out++ = base64digits[in[2] & 0x3f]; len -= 3; in += 3; } if (len > 0) { unsigned char fragment; *out++ = base64digits[in[0] >> 2]; fragment = (in[0] << 4) & 0x30; if (len > 1) fragment |= in[1] >> 4; *out++ = base64digits[fragment]; *out++ = (len < 2) ? '=' : base64digits[(in[1] << 2) & 0x3c]; *out++ = '='; } *out = '\0'; } int unbase64(char *out, const char *in, int maxlen) { int len = 0; register unsigned char digit1, digit2, digit3, digit4; if (in[0] == '+' && in[1] == ' ') in += 2; if (*in == '\r') return(0); do { digit1 = in[0]; if (DECODE64(digit1) == BAD) return(-1); digit2 = in[1]; if (DECODE64(digit2) == BAD) return(-1); digit3 = in[2]; if (digit3 != '=' && DECODE64(digit3) == BAD) return(-1); digit4 = in[3]; if (digit4 != '=' && DECODE64(digit4) == BAD) return(-1); in += 4; ++len; if (maxlen && len > maxlen) return(-1); *out++ = (DECODE64(digit1) << 2) | (DECODE64(digit2) >> 4); if (digit3 != '=') { ++len; if (maxlen && len > maxlen) return(-1); *out++ = ((DECODE64(digit2) << 4) & 0xf0) | (DECODE64(digit3) >> 2); if (digit4 != '=') { ++len; if (maxlen && len > maxlen) return(-1); *out++ = ((DECODE64(digit3) << 6) & 0xc0) | DECODE64(digit4); } } } while (*in && *in != '\r' && digit4 != '='); return (len); } #define MSG_BUF_SIZE 4096 #define NAME_BUF_LEN 256 #define MAXSIZE 65536 #define SIZE1 8 typedef struct { unsigned short length; unsigned short space; unsigned long offset; } securitybuffer; typedef struct { unsigned char digest[SIZE1]; //8 bytes unsigned char serverchallenge[SIZE1]; //8 bytes unsigned long signature; //4 bytes unsigned long reserved; //4 bytes unsigned long timestamp; //4 bytes unsigned char clientchallenge[SIZE1]; //8 bytes unsigned long unknown; //4 bytes //unsigned long data; //data unsigned char data[1]; //data } ntlmv2_blob; typedef struct { unsigned char signature[SIZE1]; //8 bytes unsigned long messagetype; //4 bytes unsigned long flags; //4 bytes securitybuffer domain; //8 bytes securitybuffer workstation; //8 bytes } ntlmv2_type1; typedef struct { unsigned char signature[SIZE1]; //8 bytes unsigned long messagetype; //4 bytes securitybuffer targetname; //8 bytes unsigned long flags; //4 bytes unsigned char challenge[SIZE1]; //8 bytes unsigned long context1; //4 bytes unsigned long context2; //4 bytes securitybuffer targetinfo; //8 bytes unsigned char data[1]; //data } ntlmv2_type2; typedef struct { unsigned char signature[SIZE1]; unsigned long messagetype; securitybuffer LM_response; securitybuffer NTLM_response; securitybuffer domain; securitybuffer user; securitybuffer workstation; unsigned char sessionkey[SIZE1]; unsigned long flags; unsigned char data[1]; } ntlmv2_type3; // // Global variable for NTLMv2 // char gpassword[NAME_BUF_LEN]; char gusername[NAME_BUF_LEN]; char gdomain[NAME_BUF_LEN]; char gworkstation[NAME_BUF_LEN]; char ntlmv2_type1_buffer[MSG_BUF_SIZE]; char ntlmv2_type3_buffer[MSG_BUF_SIZE]; char ntlmv2_type2_buffer[MSG_BUF_SIZE]; unsigned char challenge[8]; unsigned char unicodepassword[NAME_BUF_LEN*2]; unsigned char lmv2digest[16]; unsigned char *blob = NULL; int bloblen; char *type2_targetinfo; int type2_targetinfo_len=0; unsigned long type2_flags; unsigned long unicodeFlag = 0; // // Global functions for NTLMv2 // int ntlmv2_build_type1(); int ntlmv2_parse_type2(unsigned char *buf); int ntlmv2_build_type3(); int ntlmv2_prepare_type3(); int ntlmv2_build_type1() { ntlmv2_type1 type1; memset(&type1, 0, sizeof(type1)); type1.signature[0] = 'N'; type1.signature[1] = 'T'; type1.signature[2] = 'L'; type1.signature[3] = 'M'; type1.signature[4] = 'S'; type1.signature[5] = 'S'; type1.signature[6] = 'P'; type1.signature[7] = '\0'; type1.messagetype = NTLM_MSG_TYPE_1; type1.flags = NTLM_NEG_UNICODE|NTLM_NEG_OEM|NTLM_REQ_TARGET| NTLM_NEG_NTLM|NTLM_NEG_ASIGN|NTLM_NEG_NTLM2; base64((unsigned char*)ntlmv2_type1_buffer, (unsigned char *)&type1, sizeof(type1)); return 0; } int ntlmv2_parse_type2(unsigned char *buf) { int len; char response[4096]; ntlmv2_type2 *type2=NULL; if ((strncmp((char*)buf, "HTTP/1.1 407", strlen("HTTP/1.1 407"))==0) || (strncmp((char*)buf, "HTTP/1.0 407", strlen("HTTP/1.0 407"))==0)) { } else { return -1; } if (strstr((char*)buf, "Proxy-Authenticate: NTLM") == NULL) { return -1; } char* ptr = strstr((char*)buf, "Proxy-Authenticate: NTLM "); ptr += strlen("Proxy-Authenticate: NTLM "); // // Get 64 chars response and decode it // memset(response, 0, sizeof(response)); memcpy(response, ptr, 64); len = unbase64((char*)ntlmv2_type2_buffer, (char*)response, MSG_BUF_SIZE); if (len <= 0) { return -1; } type2 = (ntlmv2_type2*)ntlmv2_type2_buffer; if (strcmp((char*)type2->signature, "NTLMSSP") != 0) { return -1; } if (type2->messagetype != NTLM_MSG_TYPE_2) { return -1; } /* if (!(type2->flags & NTLM_NEG_NTLM && type2->flags & NTLM_NEG_NTLM2)) { if(theApp.bEnablelogging) LogVPNProxy("Dll : ntlmv2_parse_type2: not support NEG_NTLM/NEG_NTLM2, return -1"); return -1; } */ if (type2->flags & NTLM_NEG_UNICODE) unicodeFlag = 1; else unicodeFlag = 0; // // Save type2 flag to use later // type2_flags = type2->flags; // // Get the Challenge (8 bytes) // memcpy(challenge, type2->challenge, 8); // // Target Information // type2_targetinfo = &ntlmv2_type2_buffer[type2->targetinfo.offset]; type2_targetinfo_len = type2->targetinfo.length; return ntlmv2_prepare_type3(); } int ntlmv2_prepare_type3() { int i, j; int passlen = 0; int userdomainlen=0; unsigned char passdigest[16]; unsigned char userdomaindigest[16]; unsigned char respdigest[16]; unsigned char lmv2data[16]; unsigned char *userdomain; ntlmv2_blob *blob_ptr; MD4_CTX passcontext; // // The NTLM password hash is obtained. // this is the MD4 digest of the Unicode mixed-case password // memset(unicodepassword, 0, NAME_BUF_LEN*2); for (i = 0; i < strlen(gpassword); i++) { if (unicodeFlag) { unicodepassword[i*2] = gpassword[i]; passlen++; passlen++; } else { unicodepassword[i] = gpassword[i]; passlen++; } } MD4Init(&passcontext); MD4Update(&passcontext, unicodepassword, passlen); MD4Final(passdigest, &passcontext); // // The Unicode uppercase username is concatenated with the Unicode uppercase // authentication target (domain or server name). // The HMAC-MD5 message authentication code algorithm is applied to this value // using the 16-byte NTLM hash as the key. // This results in a 16-byte value - the NTLMv2 hash. // userdomainlen = (strlen(gusername) + strlen(gdomain)) *2; userdomain = (unsigned char*)malloc(userdomainlen); if (!userdomain) { return -1; } memset(userdomain, 0, userdomainlen); userdomainlen = 0; for (i = 0; i < strlen(gusername); i++) { if (unicodeFlag) { userdomain[i*2] = toupper(gusername[i]); userdomainlen++; userdomainlen++; } else { userdomain[i] = toupper(gusername[i]); userdomainlen++; } } for (j = 0; j < strlen(gdomain); j++) { if (unicodeFlag) { userdomain[i*2 + j*2] = toupper(gdomain[j]); userdomainlen++; userdomainlen++; } else { userdomain[i + j] = toupper(gdomain[j]); userdomainlen++; } } // // Apply HMAC-MD5, using NTLM hash as the key // hmac_md5(userdomain, userdomainlen, passdigest, 16, userdomaindigest); free(userdomain); // // A block of data known as the "blob" is constructed // bloblen = sizeof(ntlmv2_blob) + type2_targetinfo_len; blob = (unsigned char *)malloc(bloblen); if (!blob) { return -1; } memset(blob, 0, bloblen); blob_ptr = (ntlmv2_blob*)blob; // // The challenge from the Type 2 message is concatenated with the blob. // memcpy(blob_ptr->serverchallenge, challenge, 8); // // Client Challenge // for (i = 0; i < 8; i++) blob_ptr->clientchallenge[i] = (unsigned char)((256.0*rand())/(RAND_MAX + 1.0)) ; memcpy(&blob_ptr->data, type2_targetinfo, type2_targetinfo_len); blob_ptr->signature = 0x00000101; // // The HMAC-MD5 message authentication code algorithm is applied to // this value using the 16-byte NTLMv2 hash (userdomaindigest) as the key. // This results in a 16-byte output value. // This value is concatenated with the blob to form the NTLMv2 response. // // // Apply HMAC-MD5 // hmac_md5(blob+8, bloblen-8, userdomaindigest, 16, respdigest); memcpy(blob_ptr->digest, respdigest, 16); // // LM2 response // memcpy(lmv2data, blob_ptr->serverchallenge, 8); memcpy(lmv2data+8, blob_ptr->clientchallenge, 8); // // Apply HMAC-MD5 // hmac_md5(lmv2data, 16, userdomaindigest, 16, lmv2digest); return 0; } int ntlmv2_build_type3() { int totalLen=0; int size=1, index=0; ntlmv2_type3 *type3; unsigned char *ptr; if (unicodeFlag) size = 2; totalLen = sizeof(ntlmv2_type3) + (16 + bloblen + size*(strlen(gdomain) + strlen(gusername) + strlen(gworkstation))); type3 = (ntlmv2_type3 *)malloc(totalLen); if (!type3) { return -1; } memset(type3, 0, totalLen); ptr = (unsigned char*)type3; type3->signature[0] = 'N'; type3->signature[1] = 'T'; type3->signature[2] = 'L'; type3->signature[3] = 'M'; type3->signature[4] = 'S'; type3->signature[5] = 'S'; type3->signature[6] = 'P'; type3->signature[7] = '\0'; type3->messagetype = NTLM_MSG_TYPE_3; // // LM/LMv2 Resp // type3->LM_response.length = 16; type3->LM_response.space = 16; type3->LM_response.offset = sizeof(ntlmv2_type3); memcpy(&ptr[type3->LM_response.offset], lmv2digest, 16); // // NTLM/NTLMv2 Resp // type3->NTLM_response.length = bloblen; type3->NTLM_response.space = bloblen; type3->NTLM_response.offset = type3->LM_response.offset + type3->LM_response.space; memcpy(&ptr[type3->NTLM_response.offset], blob, bloblen); // // Domain // type3->domain.length = size*strlen(gdomain); type3->domain.space = size*strlen(gdomain); type3->domain.offset = type3->NTLM_response.offset + type3->NTLM_response.space; for (index = 0; index < strlen(gdomain); index++) ptr[type3->domain.offset + index*size] = gdomain[index]; // // User // type3->user.length = size*strlen(gusername); type3->user.space = size*strlen(gusername); type3->user.offset = type3->domain.offset + type3->domain.space; for (index = 0; index < strlen(gusername); index++) ptr[type3->user.offset + index*size] = gusername[index]; // // Workstation // type3->workstation.length = size*strlen(gworkstation); type3->workstation.space = size*strlen(gworkstation); type3->workstation.offset = type3->user.offset + type3->user.space; for (index = 0; index < strlen(gworkstation); index++) ptr[type3->workstation.offset + index*size] = gworkstation[index]; // // Flags // type3->flags = type2_flags & ~NTLM_TAR_DOMAIN; // // Encode // base64((unsigned char*)ntlmv2_type3_buffer, (unsigned char*)type3, totalLen); if (type3 != NULL) free(type3); if (blob != NULL) free(blob); return 0; } int ConnectViaHttpProxy ( const char* destIp, UINT destPort, char* proxyIp, UINT proxyPort, char* username, char* password ); #define MAX_BUFFER_SIZE 65536 #define MAX_NAME_LEN 64 #define LOCAL_PROXY_CONNECT_FAIL -10 #define LOCAL_PROXY_AUTH_FAIL -11 #define LOCAL_PROXY_RESP_FAIL -12 #define LOCAL_PROXY_RECV_FAIL -13 #define byte unsigned char int DoNTLMv2 ( int fd, const char* destIp, UINT destPort, unsigned char host[MAX_NAME_LEN], unsigned char domain[MAX_NAME_LEN], unsigned char user[MAX_NAME_LEN], unsigned char password[MAX_NAME_LEN] ) { char buf[MAX_BUFFER_SIZE]; char logstr[512]; char*bufPtr=NULL; int numRead, numWrite; memset(buf, 0 , sizeof(buf)); memset(ntlmv2_type1_buffer, 0 , sizeof(ntlmv2_type1_buffer)); memset(ntlmv2_type3_buffer, 0 , sizeof(ntlmv2_type3_buffer)); strcpy((char*)gworkstation, (char*)host); strcpy((char*)gdomain, (char*)domain); strcpy((char*)gusername, (char*)user); strcpy((char*)gpassword, (char*)password); // // Build msg1 // if (ntlmv2_build_type1()<0) { //closesocket(fd); return -1; } printf("ntlmv2_type1_buffer=%s\n", ntlmv2_type1_buffer); // // Send msg1 // sprintf(buf, "CONNECT %s:%hu HTTP/1.0\r\nProxy-Authorization: NTLM %s\r\n", destIp, destPort, ntlmv2_type1_buffer); sprintf( buf, "%sProxy-Connection: Keep-Alive\r\n\r\n", buf ); numWrite = send(fd, buf, strlen(buf), 0); if (numWrite <=0) { //closesocket(fd); return -1; } sprintf(logstr, "Dll : DoNTLMv2: Sent type1msg buf(Actual:%d/Sent:%d)=%s", strlen(buf), numWrite, buf); printf(logstr); memset(buf, 0, sizeof(buf)); if ((numRead = recv(fd, buf, MAX_BUFFER_SIZE, 0)) <= 0) { printf("Failed to receive response from this server\n"); //closesocket(fd); return -1; } else { } // // Analyze response // if (ntlmv2_parse_type2((unsigned char*)buf) !=0) { printf("Wrong Type2\n"); //closesocket(fd); return -1; } // // Build msg3 // ntlmv2_build_type3(); printf("ntlmv2_type3_buffer=%s\n", ntlmv2_type3_buffer); memset(buf, 0, sizeof(buf)); sprintf(buf, "CONNECT %s:%hu HTTP/1.0\r\nProxy-Authorization: NTLM %s\r\n", destIp, destPort, ntlmv2_type3_buffer); sprintf( buf, "%sProxy-Connection: Keep-Alive\r\n\r\n", buf ); // // Send msg3 // numWrite = send(fd, buf, strlen(buf), 0); if (numWrite <=0) { //closesocket(fd); return -1; } sprintf(logstr, "Dll : DoNTLMv2: Sent type3msg buf(Actual:%d/Sent:%d)=%s", strlen(buf), numWrite, buf); printf(logstr); memset(buf, 0, sizeof(buf)); if ((numRead = recv(fd, buf, MAX_BUFFER_SIZE, 0)) <= 0) { printf("Failed to receive response from this server\n"); //closesocket(fd); return -1; } else { if (strncmp(buf, "HTTP/1.0 200", 12)==0 || strncmp(buf, "HTTP/1.1 200", 12)==0) { printf("Dll : DoNTLMv2: Successfully connected.\n"); return fd; } else if ((strncmp((char*)buf, "HTTP/1.1 407", strlen("HTTP/1.1 407"))==0) || (strncmp((char*)buf, "HTTP/1.0 407", strlen("HTTP/1.0 407"))==0)) { //closesocket(fd); return LOCAL_PROXY_AUTH_FAIL; } else { //closesocket(fd); return LOCAL_PROXY_AUTH_FAIL; } } return -1; } ================================================ FILE: Bundles/Echoware/ProxyConnect/stdafx.cpp ================================================ // stdafx.cpp : source file that includes just the standard includes // ProxyConnect.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" // TODO: reference any additional headers you need in STDAFX.H // and not in this file ================================================ FILE: Bundles/Echoware/ProxyConnect/stdafx.h ================================================ // stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #pragma once #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers // TODO: reference additional headers your program requires here ================================================ FILE: Bundles/Echoware/ProxyConnection.cpp ================================================ #include "StdAfx.h" #include "proxyconnection.h" #include "dllproxyinfo.h" #include "ACConnection.h" #include "DataChannels.h" #include "DataChannel.h" CProxyConnection::CProxyConnection(void) { } CProxyConnection::CProxyConnection(CDllProxyInfo* pProxyInfo) { m_pProxyInfo=pProxyInfo; m_pACConnection=new CACConnection(this); m_pDataChannels=new CDataChannels(pProxyInfo); m_nEncryptionLevel=1; } CProxyConnection::~CProxyConnection(void) { if (m_pProxyInfo) delete m_pProxyInfo; delete m_pACConnection; delete m_pDataChannels; } CDllProxyInfo* CProxyConnection::GetProxyInfo() { return m_pProxyInfo; } int CProxyConnection::Connect() { int nRet; m_critSection.Lock(); nRet=m_pACConnection->Connect(); m_critSection.Unlock(); return nRet; } bool CProxyConnection::Disconnect() { bool bRet; m_critSection.Lock(); m_pDataChannels->RemoveAllDataChannels(); bRet=m_pACConnection->Disconnect(); m_critSection.Unlock(); return bRet; } void CProxyConnection::StopConnecting() { m_pACConnection->StopConnect(); } void CProxyConnection::SetEncryptionLevel(int level) { m_critSection.Lock(); m_nEncryptionLevel=level; m_pACConnection->SetEncryptionLevel(level); m_critSection.Unlock(); } int CProxyConnection::EstablishNewDataChannel(char* IDOfPartner) { g_globals.m_logger.WriteFormated("CProxyConnection: EstablishNewDataChannel to partner %s", IDOfPartner); g_globals.m_logger.Write("CProxyConnection: Find partner"); if (!m_pACConnection->FindPartner(IDOfPartner)) { g_globals.m_logger.Write("CProxyConnection: Failed find partner"); return 0; } g_globals.m_logger.Write("CProxyConnection: Success find partner"); g_globals.m_logger.WriteFormated("CProxyConnection: Connect to peer %s", IDOfPartner); char szChannelCode[12]; char szPeerPublicKey[RSA_PUBLIC_KEY*sizeof(unsigned int)+1]; if (!m_pACConnection->ConnectToPeer(IDOfPartner, szChannelCode, szPeerPublicKey)) { g_globals.m_logger.WriteFormated("CProxyConnection: Failed connect to peer %s", IDOfPartner); return 0; } g_globals.m_logger.WriteFormated("CProxyConnection: Success connect to peer %s", IDOfPartner); bool bEncDec=false; if (m_nEncryptionLevel && strcmp(szPeerPublicKey, "")!=0) bEncDec=true; //**** //bEncDec=false; //***** char szSessionKey[1024]; CDataChannel* pDataChannel=new CDataChannel(m_pDataChannels, szChannelCode, m_pACConnection->GenerateSessionKey(szSessionKey, szPeerPublicKey), bEncDec); m_pDataChannels->AddDataChannel(pDataChannel); unsigned int nPort=0; if (!pDataChannel->Listen(nPort)) return 0; return nPort; } void CProxyConnection::OnError(int error) { g_globals.m_proxiesManager.ProxyError(m_pProxyInfo); } void CProxyConnection::OnRemotePartnerConnect(char* szDataChannelCode, char* IDOfPartner, char* szPeerPublicKey) { g_globals.m_logger.Write("=>OnRemotePartnerConnect"); bool bEncDec=false; if (m_nEncryptionLevel && strcmp(szPeerPublicKey, "") != 0) bEncDec=true; //***** //bEncDec=false; //***** char szSessionKey[1024]; CDataChannel* pDataChannel=new CDataChannel(m_pDataChannels, szDataChannelCode, m_pACConnection->GenerateSessionKey(szSessionKey, szPeerPublicKey), bEncDec); m_pDataChannels->AddDataChannel(pDataChannel); if (pDataChannel->ConnectEchoServer()) { g_globals.m_logger.Write("OnRemotePartnerConnect success"); } else { g_globals.m_logger.Write("OnRemotePartnerConnect fail"); m_pDataChannels->RemoveDataChannel(pDataChannel); } //pDataChannel->ConnectLocalServer(g_globals.GetPortForOffLoadingData()); g_globals.m_logger.Write("<=OnRemotePartnerConnect"); } ================================================ FILE: Bundles/Echoware/ProxyConnection.h ================================================ #ifndef _PROXCONNECTION_H #define _PROXCONNECTION_H #if _MSC_VER > 1000 #pragma once #endif #include "CritSection.h" class CDllProxyInfo; class CACConnection; class CDataChannels; //proxy connection class class CProxyConnection { public: CProxyConnection(void); CProxyConnection(CDllProxyInfo* pProxyInfo); virtual ~CProxyConnection(void); int Connect(); bool Disconnect(); void StopConnecting(); //sets the encryption level for this proxy connection void SetEncryptionLevel(int level); CDllProxyInfo* GetProxyInfo(); //establish new data channel to partner int EstablishNewDataChannel(char* IDOfPartner); void OnError(int error); //the partner establish to me void OnRemotePartnerConnect(char* szDataChannelCode, char* IDOfPartner, char* szPeerPublicKey); protected: //the proxy info CDllProxyInfo* m_pProxyInfo; //the authenticate channel connection CACConnection* m_pACConnection; CCritSection m_critSection; int m_nEncryptionLevel; //all data channels for this proxy connection(echoServer) CDataChannels* m_pDataChannels; }; #endif ================================================ FILE: Bundles/Echoware/README.txt ================================================ EchoWare OSX Bundle Version 1.926 Released: 9 August 2007 =============================== INTRODUCTION ------------ EchoWare is an OSX bundle that enables both client-server as well as peer-to-peer applications to communicate with each other via a "relay server" (aka, an "echoServer"). All communication between echoWare and the echoserver appears to be outgoing TCP from the point of view of the OSX network. This allows the echoWare-enabled applications to communicate with each other without either side of the connection needing to set or adjust any firewall or router's port-forwarding settings. EchoWare is utilized in both the Kaboodle "Network Manager and Personal VPN application", as well as in EchoVNC, a firewall-friendly VNC Server and Viewer. For more details on these projects, please visit our website at: http://www.echogent.com/ EchoWare includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/) LICENSE ------- EchoWare is Copyright (C) 2004-2007 Echogent Systems, Inc. All rights reserved. EchoWare is available for use under the open-source "Sleepycat" license. Details can be found in the LICENSE file. In general, the Sleepycat license allows the binary to be freely included in any other open-source application. Any application wishing to remain closed-source must purchase a separate license from Echogent Systems, Inc, the owner of EchoWare. EchoWare(R) is a registered trademark of Echogent Systems, Inc. SOURCE ------ The accompanying source code has been built and compiled using XCode 2.4.1 for Mac OSX with GCC 4 as the base compiler. CHANGELIST ---------- 1.92 11-Nov-07 Initial OSX release 1.926 26-Jul-07 Added support for login character filtering ENCRYPTION ---------- EchoWare's 128-bit AES encryption is enabled by the OpenSSL source-code. It is covered by the following Copyrights: Copyright (c) 1998-2004 The OpenSSL Project Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson Please see openssl.org for information about their license and to contribute to their great efforts. TECH SUPPORT ------------ Support for our Service Provider customers is available 24/7, via phone or email. Mailing list support is available for all users; you can find those details on the EchoVNC homepage: http://echovnc.sourceforge.net/fom-serve/cache/1.html When asking a tech-support question, be sure to include as much information about your computer and network as possible. Thanks for using EchoWare! REV20070726SB ================================================ FILE: Bundles/Echoware/RFBBundleWrapper.cpp ================================================ /* * RFBBundleWrapper.cpp * Echoware * * Created by admin on 4/11/07. * Copyright 2007 __MyCompanyName__. All rights reserved. * */ #include "RFBBundleWrapper.h" #include "globals.h" //#include "ProxiesManager.h" #import "Echoware.h" #import "InterfaceDLLProxyInfo.h" #import "User.h" #include "EchoToOSX.h" @interface NSString (EchoExtenstions2) - (NSData *) nullTerminatedData; @end @implementation NSString (EchoExtenstions2) - (NSData *) nullTerminatedData { return [NSData dataWithBytes:[self lossyCString] length:[self cStringLength]+1]; } @end typedef void (*LoginNotificationCallBack) (CFStringRef UserName, uid_t UID, gid_t GID); typedef void (*LogoutNotificationCallBack) (); struct LoginLogoutExtraInfoStructure { LoginNotificationCallBack loginFunctionToCall; LogoutNotificationCallBack logoutFunctionToCall; }; static void LoginFunction(CFStringRef UserName, uid_t UID, gid_t GID) { CRFBBundleWrapper::GetInstance()->UserDefaultsChecking(); } static void LogoutFunction() { } static void LoginLogoutProxyCallBackFunction(SCDynamicStoreRef store, CFArrayRef changedKeys, void *info) { #pragma unused (changedKeys) CFStringRef consoleUserName; uid_t consoleUserUID; gid_t consoleUserGID; struct LoginLogoutExtraInfoStructure* loginLogoutCallbackInfo = (struct LoginLogoutExtraInfoStructure*) info; LoginNotificationCallBack loginFunctionToCall = loginLogoutCallbackInfo->loginFunctionToCall; LogoutNotificationCallBack logoutFunctionToCall = loginLogoutCallbackInfo->logoutFunctionToCall; consoleUserName = SCDynamicStoreCopyConsoleUser(store, &consoleUserUID, &consoleUserGID); if (consoleUserName != NULL) //Now if the username is non-null then we know that someone just logged in. //In this case call the login notification function. { if (loginFunctionToCall) loginFunctionToCall(consoleUserName, consoleUserUID, consoleUserGID); CFRelease(consoleUserName); } else //Console username is null which means logout just occurred. //Thus call the logout function instead. { if (logoutFunctionToCall) logoutFunctionToCall(); } } static int InstallLoginLogoutNotifiers( const CFStringRef StringDescribingYourApplication, const LoginNotificationCallBack YourLoginNotificationFunction, const LogoutNotificationCallBack YourLogoutNotificationFunction, CFRunLoopSourceRef* RunloopSourceReturned) { CFStringRef SCDebuggingString = NULL; SCDynamicStoreContext DynamicStoreContext = { 0, NULL, NULL, NULL, NULL }; SCDynamicStoreRef DynamicStoreCommunicationMechanism = NULL; CFStringRef KeyRepresentingConsoleUserNameChange = NULL; CFMutableArrayRef ArrayOfNotificationKeys; Boolean Result; struct LoginLogoutExtraInfoStructure* LoginLogoutCallBackFunctionInfo; // --- Setting return variables to known values --- */ *RunloopSourceReturned = NULL; // --- Checking input arguments to ensure they are valid --- // //Checking the login and logout functions passed to make sure they //are valid (i.e. not null). if ((YourLoginNotificationFunction == NULL) || (YourLogoutNotificationFunction == NULL)) { return(-1); //Invalid arguments passed. Returning error } /* The StringDescribingYourApplication is actually just a * System Configuration framework debugging string. * The string does not need to be unique or even present. However, if * NULL is passed to this function * we will insert empty string for the debugging string. */ if (StringDescribingYourApplication == NULL) { //Since passed null as the debugging string we assume an //'empty' string for the debugging string. SCDebuggingString = CFSTR(""); } else { /* Since a actual string was passed we will use it as the debugging * string. We create copy of the string passed in using * CFStringCreateCopy. * First Argument: Allocator to use. We want * default as usual so pass null. * Second Argument: The string to be duplicated. In this case we * use the string passed in. * Return Value: The new copy of the CFString in the * second argument */ SCDebuggingString = CFStringCreateCopy(NULL, StringDescribingYourApplication); } if (SCDebuggingString == NULL) { //Since error creating debugging string we assume an //'empty' string for the debugging string. SCDebuggingString = CFSTR(""); } // --- Creating Dynamic Store Context --- // /* Before we create the DynanicStoreCommunicationMechanism we will create * the context information. The context information we will store * and will be passed to the LoginLogoutCallbackFunction is the login * and logout callbacks which it should call. We put this information * in a SCDynamicStoreContext variable which will be added to the new * dynamic store. First step is to allocate the strucutre to put in the * dynamicStoreContext. * Note that we can't deallocate this since it will be pointed to from * the dynamic store itself and used in subsiquent callbacks. */ LoginLogoutCallBackFunctionInfo = (LoginLogoutExtraInfoStructure*)malloc(sizeof(struct LoginLogoutExtraInfoStructure)); if (LoginLogoutCallBackFunctionInfo == NULL) { //if were unable to allocate strucutre to hold login/logout callback //information then give up here. return(-3); } /* Now adding the callback information passed to this function to the * "LoginLogoutExtraInfoStructure". This will then be added to the * dynamic store context. */ LoginLogoutCallBackFunctionInfo->loginFunctionToCall = YourLoginNotificationFunction; LoginLogoutCallBackFunctionInfo->logoutFunctionToCall = YourLogoutNotificationFunction; /* Now adding the allocated structure to the dynamic store context. This * context will be added to the dynamic store when it is created */ DynamicStoreContext.info = (void*) LoginLogoutCallBackFunctionInfo; // --- Setting up notification with SystemConfiguration framework --- // /* The next step is to set up the notification with the * system configuration framework. The first step is to create * a dynamic store. The dynamic store is used to communicate with the * system configuration framework. Create dynamic store with a * SCDynamicStoreCreate call. * * First Argument: Allocator to use. As usual we want default * allocator so pass null. * Second Argument: Before calling this must be a CFString to use as * the debugging string in a debugging session. This will be the * same string passed into this function to describe the * application or just an empty string. * Third Argument: This is the function which will be called whenever * a key in the dynamic store changes. We have a proxy function * which will get called whenever the console username changes. * The name change will happen when a new user logs in or out. * Thus the proxy function gets called any login or logout. The * proxy function will in turn call the given Login/Logout * functions passed to this function. * Forth Argument: The dynamic store context information to be used * when creating the dynamic store. * Return Value: A mechanism used to comminicate with the dynamic * store and the system configuration framework. This will be used * in later System Configuration calls. Note this value must be * released later with CFRelease. */ DynamicStoreCommunicationMechanism = SCDynamicStoreCreate (NULL, SCDebuggingString, LoginLogoutProxyCallBackFunction, &DynamicStoreContext); //After creating the dynamic store we are done with the //debugging string. Thus, releasing now. CFRelease(SCDebuggingString); if (DynamicStoreCommunicationMechanism == NULL) { //if DynamicStoreCommunicationMechanism is null then //were unable to create communication mechanism. Fail here. return(-2); //unable to create dynamic store. } /* Now we have a dynamic store communication mechanism we will need * to get the keys with which we want to get notified upon. There is * actually only one key in this case which is the console username. * We get the console username key using the call * SCDynamicStoreKeyCreateConsoleUser. * * Return Value: A key representing we want to be notified of * console user name changes. * Note that the return value has to be released. */ KeyRepresentingConsoleUserNameChange = SCDynamicStoreKeyCreateConsoleUser(NULL); if (KeyRepresentingConsoleUserNameChange == NULL) //Note: if key is null we fail. { CFRelease(DynamicStoreCommunicationMechanism); //releasing allocated memory before giving up. return(-4); } // --- creating array of notification keys --- // /* Now that we have the console user key which is the key we will * be notifing upon we need to place the * key into an array. This is because the System Configuration * framework expects all lists of keys to be in an array. Thus we * will create an array for the occasion then place the key inside * of it. We create the array with CFArrayCreateMutable. * First Argument: Allocator to use. As usual we want default * allocator so pass null. * Second Argument: The number of items which will be in the array. * In this case we only have one key so the size will be one. * Third Argument: The type of retain/release methods to use with the * data. In this case we are using normal Core Foundation types * which means default CFArray behavior will do. Thus, as * retain/release behavior we pick kCFTypeArrayCallBacks which * represents the normal retain/release for an CFArray. * Return Value: An empty CFArray. This is the array which will * hold the notification keys. Note the CFArray must be released. */ ArrayOfNotificationKeys = CFArrayCreateMutable (NULL, (CFIndex)1, &kCFTypeArrayCallBacks); /* error creating CFArray of notification keys. */ if (ArrayOfNotificationKeys == NULL) { CFRelease(DynamicStoreCommunicationMechanism); //releasing allocated memory before giving up. CFRelease(KeyRepresentingConsoleUserNameChange); return(-5); } /* Now that we have our empty array we need to add the notification * key to it. We do this using CFArrayAppendValue * First Argument: The CFArray which will have an item appended to it. * Second Argument: Key which will be added to CFArray. The key is * represented as CFString. * No return value */ CFArrayAppendValue(ArrayOfNotificationKeys, KeyRepresentingConsoleUserNameChange); /* Now that we have an array repesenting the values to notify upon * we will add this information to the dynamic store. This way we * can create a CFRunloop source based upon the notification key * chosen. In this case the notification key was the console * user change. We add the notification keys to the * dynamic store with the call SCDynamicStoreSetNotificationKeys * First Argument: Dynamic store to add this information to. * This is the dynamic store we obtained earlier. * Second Argument: The Array of notification keys. In this case * the single key representing any change in console user. * Third Argument: Any regex keys to be monitored. In this case we * already have all our keys we need from the array. Thus this * value can be NULL since we don't need any other keys. * Return Value: A boolean representing if operation was successful * (true) or unsuccessful (false). */ Result = SCDynamicStoreSetNotificationKeys( DynamicStoreCommunicationMechanism, ArrayOfNotificationKeys, NULL); //Done with notification keys array so release CFRelease(ArrayOfNotificationKeys); //done with notification key so release. CFRelease(KeyRepresentingConsoleUserNameChange); if (Result == FALSE) //unable to add keys to dynamic store. { //releasing allocated memory before giving up. CFRelease(DynamicStoreCommunicationMechanism); return(-6); } /* Now we are creating the CFRunloopSource which we will return on * this function. This run loop source when inserted in your run loop * will cause your notification functions to get called via the * 'proxy' notification function. We create the RunLoopSource * using the call SCDynamicStoreCreateRunLoopSource. * * First Argument: Allocator to use. As usual we want default * allocator so pass null. * Second Argument: The dynamic store which to base the run loop * source upon. We have already created a dynamic store which * will notify on console user changes. This will be the dynamic * store the run loop source is based upon. * Third Argument: The 'order' of the CFRunloop source. We want * default behavior here too so pass zero. * Return value: the run loop source created. Note that the * return value must eventually be released. */ *RunloopSourceReturned = SCDynamicStoreCreateRunLoopSource (NULL, DynamicStoreCommunicationMechanism, (CFIndex) 0); return 0; } static CRFBBundleWrapper* instance = NULL; CRFBBundleWrapper::CRFBBundleWrapper() { rfb_port = 0; is_rfb = false; } CRFBBundleWrapper::~CRFBBundleWrapper() { rfb_port = 0; is_rfb = false; } bool CRFBBundleWrapper::canWriteToFile(NSString *path) { if ([[NSFileManager defaultManager] fileExistsAtPath:path]) return [[NSFileManager defaultManager] isWritableFileAtPath:path]; else return [[NSFileManager defaultManager] isWritableFileAtPath:[path stringByDeletingLastPathComponent]]; } void CRFBBundleWrapper::loadProxyFields(NSUserDefaults* suDefaults) { static id proxyStringsDictionary = nil; NSString *proxyAddrString = [suDefaults stringForKey:@"EchoProxyAddr"]; NSString *proxyPortString = [suDefaults stringForKey:@"EchoProxyPort"]; NSString *proxyUserString = [suDefaults stringForKey:@"EchoProxyUser"]; NSString *proxyPassString = [suDefaults stringForKey:@"EchoProxyPass"]; // Load to EchoWare if ([proxyAddrString length] && [proxyPortString intValue]) { [proxyStringsDictionary release]; proxyStringsDictionary = [[NSMutableDictionary alloc] init]; [proxyStringsDictionary setObject:[proxyAddrString nullTerminatedData] forKey:@"EchoProxyAddr"]; [proxyStringsDictionary setObject:[proxyPortString nullTerminatedData] forKey:@"EchoProxyPort"]; if (proxyUserString) [proxyStringsDictionary setObject:[proxyUserString nullTerminatedData] forKey:@"EchoProxyUser"]; else [proxyStringsDictionary setObject:[@"" nullTerminatedData] forKey:@"EchoProxyUser"]; if (proxyPassString) [proxyStringsDictionary setObject:[proxyPassString nullTerminatedData] forKey:@"EchoProxyPass"]; else [proxyStringsDictionary setObject:[@"" nullTerminatedData] forKey:@"EchoProxyPass"]; SetLocalProxyInfo((char *) [[proxyStringsDictionary objectForKey:@"EchoProxyAddr"] bytes], (char *) [[proxyStringsDictionary objectForKey:@"EchoProxyPort"] bytes], (char *) [[proxyStringsDictionary objectForKey:@"EchoProxyUser"] bytes], (char *) [[proxyStringsDictionary objectForKey:@"EchoProxyPass"] bytes]); } } void CRFBBundleWrapper::loadServerList(NSUserDefaults* suDefaults) { g_globals.m_proxiesManager.DisconnectAllProxies(); g_globals.m_proxiesManager.RemoveAllProxies(); NSEnumerator *echoEnum = [[suDefaults objectForKey:@"EchoServers"] objectEnumerator]; NSMutableDictionary *echoDict = nil; while (echoDict = [[[echoEnum nextObject] mutableCopy] autorelease]) { IDllProxyInfo* proxyInfo = (IDllProxyInfo*)CreateProxyInfoClassObject(); [echoDict setObject:[[[echoDict objectForKey:@"IPAddress"] nullTerminatedData] retain] forKey:@"IPAddress_cStringData"]; proxyInfo->SetIP((const char *)[[echoDict objectForKey:@"IPAddress_cStringData"] bytes]); if ([echoDict objectForKey:@"Port"]) { [echoDict setObject:[[[echoDict objectForKey:@"Port"] nullTerminatedData] retain] forKey:@"Port_cStringData"]; proxyInfo->SetPort((const char *)[[echoDict objectForKey:@"Port_cStringData"] bytes]); } else proxyInfo->SetPort("1328"); if ([echoDict objectForKey:@"User"]) { [echoDict setObject:[[[echoDict objectForKey:@"User"] nullTerminatedData] retain] forKey:@"User_cStringData"]; proxyInfo->SetMyID((char *)[[echoDict objectForKey:@"User_cStringData"] bytes]); } if ([echoDict objectForKey:@"Pass"]) { [echoDict setObject:[[[echoDict objectForKey:@"Pass"] nullTerminatedData] retain] forKey:@"Pass_cStringData"]; proxyInfo->SetPassword((const char *)[[echoDict objectForKey:@"Pass_cStringData"] bytes]); } g_globals.m_logger.Write(""); g_globals.m_logger.WriteFormated("IP: %s", proxyInfo->GetIpPort()); g_globals.m_logger.WriteFormated("User: %s", proxyInfo->GetMyID()); SetEncryptionLevel(1, proxyInfo); proxyInfo->SetReconnectProxy(false); int connectResult = ConnectProxy(proxyInfo); switch (connectResult) { case 0: g_globals.m_logger.Write("Status: Connected"); break; case 1: g_globals.m_logger.Write("Status: No Server Avail"); break; case 2: g_globals.m_logger.Write("Status: Auth Failed"); break; case 3: g_globals.m_logger.Write("Status: Already Active"); break; case 4: g_globals.m_logger.Write("Status: Timed Out"); break; default: g_globals.m_logger.Write("Status: Unknown Return Code"); break; } proxyInfo->SetReconnectProxy(true); } } void CRFBBundleWrapper::loadLoggingOptions(NSUserDefaults* suDefaults) { NSString *bundle_path = [[NSBundle mainBundle] bundlePath]; NSArray *logFiles = [NSArray arrayWithObjects: @"/var/log/OSXvnc-server.log", @"~/Library/Logs/OSXvnc-server.log", @"/tmp/OSXvnc-server.log", [bundle_path stringByAppendingPathComponent:@"OSXvnc-server.log"], [suDefaults stringForKey:@"LogFile"], nil]; NSEnumerator *logEnumerators = [logFiles objectEnumerator]; // Find first writable location for the log file NSString *logFile = nil; while (logFile = [logEnumerators nextObject]) { logFile = [logFile stringByStandardizingPath]; if ([logFile length] && canWriteToFile(logFile)) { [logFile retain]; break; } } NSLog(logFile); // //converto from NSString to char* int len_logFile = [logFile length]; char pLogFile[len_logFile + 1]; strncpy(pLogFile, [logFile cString], len_logFile); pLogFile[len_logFile] = '\0'; // bool enableLog = [suDefaults boolForKey:@"EnableLogging"]; SetLoggingOptions(enableLog, pLogFile); } bool CRFBBundleWrapper::UserDefaultsChecking() { BOOL result = FALSE; NSArray *args = [[NSProcessInfo processInfo] arguments]; int argumentIndex = [args indexOfObject:@"-donotloadproxy"]; if (argumentIndex != NSNotFound) return result; NSString *username = CUser::CurrentConsoleUsername(); if (!username) return result; CUser user(username); [username release]; uid_t old_uid = geteuid(); [NSUserDefaults resetStandardUserDefaults]; seteuid(user.uid()); NSUserDefaults *suDefaults = user.userDefaults(@"OSXvnc"); loadLoggingOptions(suDefaults); g_globals.m_logger.Write("Load echo servers."); if (InitializeProxyDll()) { SetPortForOffLoadingData(rfb_port); loadProxyFields(suDefaults); loadServerList(suDefaults); } else { g_globals.m_logger.Write("Proxy DLL can not be initialized."); } result = TRUE; [NSUserDefaults resetStandardUserDefaults]; seteuid(old_uid); return result; } int CRFBBundleWrapper::doInstall() { if (is_rfb) { CFRunLoopSourceRef testRunloopSource = NULL; int result = InstallLoginLogoutNotifiers( CFSTR("This is my crazy program"), LoginFunction, LogoutFunction, &testRunloopSource); if (result != 0) return 1; //give up since could not install notifier. CFRunLoopAddSource(CFRunLoopGetCurrent(), testRunloopSource, kCFRunLoopDefaultMode); CFRelease(testRunloopSource); CFRunLoopRun(); } return 0; } CRFBBundleWrapper* CRFBBundleWrapper::GetInstance() { if (!instance) instance = new CRFBBundleWrapper(); return instance; } void CRFBBundleWrapper::FreeInstance() { if (instance) delete instance; instance = NULL; } unsigned long CRFBBundleWrapper::RunLoopThreadProc(void* lpParameter) { CRFBBundleWrapper *rfb = (CRFBBundleWrapper*)lpParameter; if (rfb) rfb->doInstall(); return 0; } void CRFBBundleWrapper::startRunLoop() { void* m_hThread; unsigned long m_dwThread; m_hThread = CreateThread(0, 0, RunLoopThreadProc, this, 0, &m_dwThread); } ================================================ FILE: Bundles/Echoware/RFBBundleWrapper.h ================================================ /* * RFBBundleWrapper.h * Echoware * * Created by admin on 4/11/07. * Copyright 2007 __MyCompanyName__. All rights reserved. * */ #import #include #include class CRFBBundleWrapper { private: public: bool is_rfb; int rfb_port; CRFBBundleWrapper(); virtual ~CRFBBundleWrapper(); bool canWriteToFile(NSString *path); void loadProxyFields(NSUserDefaults* suDefaults); void loadServerList(NSUserDefaults* suDefaults); void loadLoggingOptions(NSUserDefaults* suDefaults); bool UserDefaultsChecking(); int doInstall(); void startRunLoop(); static CRFBBundleWrapper* GetInstance(); static void FreeInstance(); static unsigned long RunLoopThreadProc(void* lpParameter); }; ================================================ FILE: Bundles/Echoware/RSA/Code.cpp ================================================ #include "stdafx.h" //#include #include #include "HNumber.h" #include "GSimply.h" #include "Operator.h" #include "HNFunct.h" int Encode(unsigned char *msg, int msgLen, HugeNumber &FirstHalf, HugeNumber &SecondHalf) // function returns: // 1 - OK // 0 - failure { int i,n,k,j; //char buf[11]; HugeNumber x,y; unsigned long CheckSum; // Count check sum CheckSum=msgLen; for (i=0; i>4); else x.digit[k]=(x.digit[k]<<4)+(j&0xF); if (i%3==2) k++; }; if (i%3==1) x.digit[k]=x.digit[k]<<8; if (i%3==2) x.digit[k]=x.digit[k]<<4; if (i%3!=0) k++; x.digit[k++]=msgLen/base; x.digit[k++]=msgLen%base; x.digit[k++]=CheckSum%base; if (SecondHalf<=x) return 0; // Message is too long for encoding ModPower(y,x,FirstHalf,SecondHalf); y.ToStr((char*)msg,2222); return 1; }; int Decode(unsigned char *msg, int &msgLen, HugeNumber &FirstHalf, HugeNumber &SecondHalf) // function returns: // 1 - OK // 0 - failure { int i,n,k,j; //char buf[11]; HugeNumber x,y; unsigned long CheckSum; unsigned long testCheckSum; y=(char*)msg; if (SecondHalf<=y) return 0; // Message is too long for decoding ModPower(x,y,FirstHalf,SecondHalf); j=k=0; memset(msg,0,2222); n=x.Razr(); // Restore message's length in bytes msgLen=x.digit[n-3]; msgLen=msgLen*base+x.digit[n-2]; // Restore message's chech sum testCheckSum=x.digit[n-1]; n=msgLen*2; for (i=0; i>8)&0xF); else if (i%3==1) j=(j<<4)+((x.digit[k]>>4)&0xF); else { j=(j<<4)+(x.digit[k]&0xF); k++; }; if (i%2==1) { msg[i/2]=j; j=0; }; }; // Count check sum CheckSum=msgLen; for (i=0; i #include #include #include #include #include #include "MyTypes.h" extern time_t MakePrimeL_Time; extern time_t LongIsPrime_Time; void randomize() // Initialization of the random-number generator. // It is added for compatibility with Borland C ++ Builder { /* Seed the random-number generator with current time so that the numbers will be different every time we run. */ srand( (unsigned)time( NULL ) ); }; long int random(long int ULimit) // Generates a random number in the range 0..ULimit // It is added for compatibility with Borland C ++ Builderr { return (long int)(double(rand())/RAND_MAX*ULimit); }; word wmin(word a, word b) { if (ab) return a; else return b; }; int LongIsPrime(unsigned long a) { time_t t1=clock(); unsigned long b,i; if (a%2==0) { LongIsPrime_Time+=clock()-t1; return 0; } b=(unsigned long)(sqrt(a))+1; for (i=3; i8200*(lg3/lg16) for (;;) { if (LongIsPrime(a)) break; a++; }; MakePrimeL_Time+=clock()-t1; return a; }; /* void Error(char *msg) { printf("\n%s\n",msg); abort(); }; */ ================================================ FILE: Bundles/Echoware/RSA/Commonf.h ================================================ // General purpose functions #ifndef __CommonF_H #define __CommonF_H #include #include "MyTypes.h" #include "HNumber.h" extern void Error(const char *msg); extern word wmin(word a, word b); extern word wmax(word a, word b); extern void Close(); extern int LongIsPrime(unsigned long a); extern unsigned long MakePrimeL(); extern void Error(char *msg); #endif ================================================ FILE: Bundles/Echoware/RSA/Function.h ================================================ #ifndef __FUNCTION_H #define __FUNCTION_H #include "HNumber.h" extern int LL(HugeNumber &q); //extern word NOD(unsigned long uu, unsigned long vv); //extern int SimplyN(word k); //extern word SNumber(word k0); extern HugeNumber FastPower(HugeNumber &a, HugeNumber &b); extern HugeNumber Pow2m1(HugeNumber &q); //extern void Error(); #endif ================================================ FILE: Bundles/Echoware/RSA/Gsimply.cpp ================================================ /* Programs of the superbig random numbers generation. IgorSharov@rambler.ru */ #include "stdafx.h" //#include #include #include #include #include "HNumber.h" #include "HNfunct.h" #include "commonf.h" #include "operator.h" #include "GSimply.h" #include "MyPrint.h" #include "Profiler.h" // For measurement of an operating time of the program extern time_t GeneratePrimeHugeNumber_Time; extern time_t GeneratePrime_Time; extern time_t DeleteN_Time; extern time_t Razl_Time; extern time_t Construction_Time; extern time_t Test_Time; extern int Test2(HugeNumber &x); unsigned long *N=NULL; // Decomposition of number p-1 on prime multipliers int N_size=0; // Dimension of N int N_size_max=0; int N_razr=22; #define razr_default DeltaIndex #define MaxRepeat 555 // Amount of attempts of multiplier's selection int WasRandomized=0; extern int Rabin(int t, HugeNumber &S, HugeNumber &m, HugeNumber &mm1); extern void randomize(); void PutInList(unsigned long i) { // To bring number 'i' in the list of prime multipliers if (N==NULL) { N_size_max=razr_default; N=(unsigned long*)malloc(N_size_max*sizeof(unsigned long)); if (N==NULL) { printf("\nNot enough memory in PutInList"); exit(0); }; N_size=0; } else { if (N_size==N_size_max) { N_size_max+=razr_default; N =(unsigned long*)realloc(N, N_size_max*sizeof(unsigned long)); if (N==NULL) { printf("\nNot enough memory in PutInList"); exit(0); }; } else { if (N_size>N_size_max) { printf("Internal error: N_size is great then N_size_max"); exit(0); }; }; }; N[N_size++]=i; }; void Razl(unsigned long y) // Decomposition of number 'y' on prime multipliers { time_t t1=clock(); long i,n; char flag; // The 'flag' will be equal 'Y' if even one divisor is found. // Otherwise the flag will be equal 'N'. for (flag='Y'; flag=='Y'; ) { // We shall leave from this cycle when we find out that the tested // number has no any prime divider. flag='N'; n=(long)(sqrt(y))+1; // We divide tested number by 2,3, ... y^0.5+1 for (i=2; i<=n; i++) { if (y%i==0) { // i divides y without the remainder // Whether is i a prime number? if (LongIsPrime(i)) { // Put number 'i' in the list of prime multipliers of 'y' PutInList(i); y=y/i; flag='Y'; break; }; }; }; }; // The number 'y' does not have any prime divisor. // Put number y in the list of prime multipliers if (y!=1) PutInList(y); Razl_Time+=clock()-t1; }; int PrimeQ(HugeNumber &km1,HugeNumber &k) // This function returns: // 1 if the number k MAY BE simple // 0 if the number is compound { HugeNumber x; ModPower(x,three,km1,k); if (x==one) return 1; else return 0; }; void DeleteN() { time_t t1=clock(); if (N!=NULL) { free(N); N=NULL; N_size=0; }; DeleteN_Time+=clock()-t1; }; int GeneratePrime(HugeNumber &p) // Generates prime number 'p' on the basis of prime numbers N [*] // If function can not generate simple number, it returns 0. // Function returns 1 if the prime number is generated. // Knuth vol2 page 420 (?) { HugeNumber x,pm1,y,tmp,z; int i,j,intTmp; unsigned long b; time_t t1=clock(); time_t t2; Protocol("Let's try to construct huge prime from small prime's set."); t2=clock(); y=N[0]; for (i=1; i=MaxRepeat) { GeneratePrime_Time+=clock()-t1; Protocol("Attempt failure"); return 0; // Very big multiplier is not necessary for me }; ProtocolF("The number looks like prime and it's length is: ",(float)BytesInHN(p)); // 'p' looks like a prime number t2=clock(); pm1=p-one; // We search for decomposition of number pm1 on prime multipliers Razl(UnsignedLong(x)); // Check of decomposition of number pm1 on prime multipliers // This check isn't necessary, but it is a good way to check my // previous calculatings. y=N[0]; for (i=1; i2222 // I'm sure but some check won't hurt the program. if (n*2+1>2222) { fclose(f); return 0; }; fscanf(f,"%s\n",buf); x=buf; for (i=0; i2222) { fclose(f); return 0; }; fscanf(f,"%s\n",buf); y=buf; for (i=0; i #include "MyTypes.h" class HugeNumber { public: word digit[MaxRazr]; // Znachenija razriadov HugeNumber(); HugeNumber(char *); HugeNumber(unsigned long); HugeNumber(const HugeNumber&); HugeNumber(HugeNumber&); void Random(int k); // Generiryet slychiajnoe chislo iz k razriadov int Razr() const; // Opredeliaet razriadnost chisla void Resize(int k); // Yvelichivaet chislo razriadov do k char *ToStr(char*,int); // Preobrazovivaet chislo v tekstovij vid char *ToHexStr(char *,int); HugeNumber& operator = (const HugeNumber &); friend HugeNumber operator + ( HugeNumber &, HugeNumber &); friend HugeNumber operator - ( HugeNumber &u, HugeNumber &v); friend HugeNumber operator * ( HugeNumber &u, HugeNumber &v); friend HugeNumber operator / ( HugeNumber &u, HugeNumber &v); friend HugeNumber operator % ( HugeNumber &u, HugeNumber &v); HugeNumber& operator++(); HugeNumber& operator--(); }; HugeNumber operator + ( HugeNumber &, HugeNumber &); HugeNumber operator - ( HugeNumber &u, HugeNumber &v); HugeNumber operator * ( HugeNumber &u, HugeNumber &v); HugeNumber operator / ( HugeNumber &u, HugeNumber &v); HugeNumber operator % ( HugeNumber &u, HugeNumber &v); #endif ================================================ FILE: Bundles/Echoware/RSA/Hnfunct.cpp ================================================ /* Functions for work with huge numbers IgorSharov@rambler.ru */ #include "stdafx.h" //#include //Debug #include //Debug #include "Hnumber.h" #include "operator.h" #include "commonf.h" #include "string.h" #include "stdio.h" #include "MyPrint.h" #define buf_s 2222 extern time_t ModPower_Time; HugeNumber zero("0"),one("1"),two("2"),three("3"); int BaseRazr() // Vozvrashaet chislo simvolov, neobxodimsx dlia predstavlenia odnogo razriada /// Function returns number of the symbols necessary for representation of one rank { int i,n; i=1; #ifdef HexBase for(n=0; ivv) { u=uu; v=vv; } else { u=vv; v=uu; } for (;;) { // Step A1 if (v==zero) return; // Step A2 r=u % v; u=v; v=r; }; }; void LCM(HugeNumber &a, HugeNumber &b, HugeNumber &lcm) /// The least common multiple of two nonnegative huge numbers { HugeNumber tmp; GCD(a,b,lcm); tmp=a*b; lcm=tmp/lcm; }; void Mult1(HugeNumber& u, word v, HugeNumber& w) // Arifmetika smeshannoj tochnosti // u Mnogimoe c mnogokratnoj tochnostij // v Mnogitel c odnokratnoj tochnostij // w Rezultat c mnogokratnoj tochnostij /// Arithmetics of the mixed accuracy /// u - multiplicand (repeated accuracy) /// v - multiplier (unitary accuracy) /// w - result (repeated accuracy) { int j; int M; // Istinnaij razriadnist chisla /// The real word length of number dword t,k,dv; // Shag M1. Nachalnaij ustanovka. /// Step M1. Initialization M=u.Razr(); w=zero; w.Resize(M+1); dv=v; k=0; for (j=0; j=0; i--) { t=r; // Nado zamenit umnogenie na sdvig // !!! It is necessary to replace multiplication t*base with shift !!! t=(t * base) + u.digit[i]; w.digit[i]=word(t/v); r=word(t-w.digit[i]*v); }; }; void Div(HugeNumber& uu, HugeNumber& vv, HugeNumber& qq, HugeNumber& r) // Delenie uu na vv // Chastnoe - qq // Ostatok - r // Knuth vol2 page291 (?) // qq= uu / vv; r=uu mod vv /// !!! To not delete calls of debugging procedure 'Protocol' in comments !!! { word d; size_t Nrazr; // Nomer razriada, ispolzuemogo pri poluchenii // predstavlenia chisla v dopolnitelnom kode. /// Number of the rank used at reception of representation /// of number in an additional code. HugeNumber u,v,w,z,x,f; int M; // Razriadnost chastnogo /// Rank of quotient. int N; /// Razriadnost ostatka (delitelia) /// Rank of remainder (divisor) int n; /// n==N-1 int i,j; int c; /// Control value on step D4 unsigned long q; int x_razr,f_razr,z_razr; word tmp; // Obnuliaem chastnoe i ostatok qq=zero; /// quotient r=zero; /// remainder // D0. Opredeliaem resriadnost ... /// We determine the rank of ... // ...delitelia /// ...divisor N=vv.Razr(); n=N-1; if ((N==1) && (vv.digit[0]==0)) { printf("divisor ==0 !"); // getch(); } // ...delimogo /// ...dividend M=uu.Razr(); if (M==1 && uu.digit[0]==0) return ; if (M1) { Mult1(uu,d,u); Mult1(vv,d,v); //Protocol("u=",u); //Protocol("v=",v); } else { // A nugni li eti operatori? Da, nugni. /// Whether or not this operators are necessary??? Yes, they are necessary. v=vv; u=uu; }; M++; u.Resize(M); x.Resize(N+2); qq.Resize(M-N+1); z.Resize(N+1); for (j=M-1; j>=N; j--) { // D3 if (u.digit[j]==v.digit[n]) q=base-1; else { q=u.digit[j]; q=(q*base+u.digit[j-1])/v.digit[n]; } while ( v.digit[n-1]*q > (( u.digit[j]*dword(base) + u.digit[j-1] - q*v.digit[n] )*dword(base) + u.digit[j-2])) q--; // D4. Umnogit i vichest. u[j..j+N]=u[j..j+N]-v[0..N]*q /// Multiply and subtract. Mult1(v,word(q),w); // w=v*q //Protocol("w=",w); for (i=0; i<=N; i++) x.digit[N-i]=u.digit[j-i]; // x[]=u[j..j+N] x_razr=x.Razr(); for ( ; i #include #include #include #include "operator.h" #include "CommonF.h" #include "HNumber.h" #include "HNfunct.h" #include "MyTypes.h" static void Add1(HugeNumber &a, word m); static void Convert(char *b, HugeNumber &w); extern long int random(long int); HugeNumber::HugeNumber() { int i; for (i=0; i0; j--) { str[j]=str[j-1]; }; str[0]='0'; }; j=0; for (i=len-1; i>=0; i=i-n) { for (k=0; k=base) k=1; for (j=1; j=base) k=1; else k=0; }; // Ne xvataet razriada - yvelichivay razraidnost chisla Resize(MaxRazr+1); digit[j]=k; return *this; }; HugeNumber& HugeNumber::operator--() { word j,tmp; size_t m; int k; if ((digit[0])==0) { digit[0]=base-1; k=-1; } else { digit[0]=digit[0]-1; return *this; } m=Razr(); for (j=1; j0; i--) if (digit[i]!=0) break; return i+1; }; void HugeNumber::Resize(int k) // Yvelichivaet kolichestvo rezriadov v pedstavlenii chisla do k { if (k>MaxRazr) { //printf("Zaprosheno uvelichenie razriadnosti do %i",k); //printf("Request for digit capacity increasing to %i has been found.", k); // getch(); } } void HugeNumber::Random(int k) // Zapolniaet mladshie k razriadov slychajnimi znachenijami // Starshie m-k razriadov zapolniajytsia nyliami { int i; Resize(k); for (i=0; i prisvaivanie vida a=a return *this; }; HugeNumber operator + ( HugeNumber &u, HugeNumber &v) // Slogenie neotrisatelnix selix chisel { word j; dword k; // Cifra perenosa word uk; // Chislo razriadov u word vk; // Chislo razriadov v word wk; // Chislo razriadov w word kw; dword p; HugeNumber w; // Zdes bydem nakaplivat rezyltat vk=v.Razr(); uk=u.Razr(); wk=wmax(uk,vk); kw=wmin(uk,vk); w.Resize(wk+1); // Delaem nygnyiy razriadnost rezyltata k=0; // Symiryem razriadi po samomy korotkomy chisly for (j=0; j=base) { k=1; w.digit[j] = word(p & (base-1)); } else { k=0; w.digit[j]= word(p); }; }; // Tiper nado prosymirovat ostavshiesia razriadi dlinnogo chisla i // razriad perenosa. if (k!=0) { // Bil perenos pri symmirovanii po korotkomy chisly // Nado symmirivat ostavshiesia razriady if (uk>vk) { // Symmiryem, poka est cifra perenosa for (; j=base) { k=1; w.digit[j] = word(p & (base-1)); } else { k=0; w.digit[j]= word(p); break; }; } // Kopiryem ostavshiesia razriady if (k==0) for (j++; j=base) { k=1; } else { k=0; break; }; } // Kopiryem ostavshiesia razriady if (k==0) for (j++; juk) for (; jvk) for (; jRazr()*n+1) return NULL; // Byfer mal - stroka ne vlezet #ifdef HexBase sprintf(format,"%%%02iX",n); #else sprintf(format,"%%%02ii",n); #endif pointer[0]=0; for (i=this->Razr()-1; i>=0; i--) { sprintf(buf,format,this->digit[i]); strcat(pointer,buf); }; // Ybrat neznachishai nyli for (;pointer[0]=='0';) { n=strlen(pointer); if (n==1) break; for (i=0; iRazr()*razr+1) return NULL; // Malo pamiati. strcpy(buf,"%"); sprintf(format,"%s%02iX",buf,razr); pointer[0]=0; for (i=this->Razr()-1; i>=0; i--) { sprintf(buf,format,this->digit[i]); strcat(pointer,buf); }; return pointer; }; HugeNumber operator - ( HugeNumber &u, HugeNumber &v) // Bichitanie neotrisatelnix selix chisel w=u-v // Vnimanie! u >= v !!! // { int j; int k; HugeNumber w; word a,b; w.Resize(u.Razr()); // Razriadnost rezyltata == razriadnosti ymenshaemogo k=0; for (j=0; j //#include #include #include #include "MyTypes.h" #include "Function.h" #include "CommonF.h" #include "HNfunct.h" #include "Operator.h" #include "MyPrint.h" #include "MyNum.h" #include "GSimply.h" #define CLK_TCK CLOCKS_PER_SEC extern int N_razr; extern int WasRandomized; extern void MakePrime(int intS, HugeNumber &n); extern void randomize(); extern long int random(long int); time_t MakePrimeL_Time=0; time_t LongIsPrime_Time=0; time_t Misha_Time=0; time_t Construction_Time=0; time_t Razl_Time=0; time_t DeleteN_Time=0; time_t Test_Time=0; time_t GeneratePrimeHugeNumber_Time=0; time_t GeneratePrime_Time=0; void clrscr() // Dobavlena dlia sovmestimosti s Borland C++ Builder // k sogalenijy ja ne obnarygil etoj fynkcii v Visual C++ // Eta funkcija dolgna ochishat ekran i ystanavlivat kyrsor // v levij verxnij ygol ekrana. { }; void Euklid(MyNum &u, MyNum &v, MyNum &nod, MyNum &e) // Obobshionnij algorint Evklida // Knuth vol2 page367 (?) { MyNum u1,u2,u3; MyNum v1,v2,v3; MyNum t1,t2,t3; MyNum q,tmp; // X1. Nachialnaja ystanovka Assign1(u1); Assign0(u2); Assign(u3,u); Assign0(v1); Assign1(v2); Assign(v3,v); // X2. v3==0 ? while (!IsZero(v3)) { // X3. Razdelit, Vichest Div(q,u3,v3); Mult(tmp,v1,q); Subtr(t1,u1,tmp); Mult(tmp,v2,q); Subtr(t2,u2,tmp); Mult(tmp,v3,q); Subtr(t3,u3,tmp); Assign(u1,v1); Assign(u2,v2); Assign(u3,v3); Assign(v1,t1); Assign(v2,t2); Assign(v3,t3); }; Assign(nod,u3); Assign(e,u2); }; void CreateKeys(HugeNumber &D, HugeNumber &e, HugeNumber &N) // Vichslenie pari klychej (D,N) (e,N) { HugeNumber P,Q,p1q1,i,N100; HugeNumber a,b,P1,Q1; MyNum sP,sQ,sa,si,sD,se,sp1q1; // Bolshie chisla so znakom long k; if (!WasRandomized) { randomize(); WasRandomized=-1; }; for (k=0;;k++) { Protocol("Calculating P ..."); MakePrime(100, P); Protocol("Done. P=",P); Protocol("Calculating Q ..."); MakePrime(100, Q); Protocol("Done. Q=",Q); if (P!=Q) break; }; N=P*Q; Protocol("N=",N); P1=P-one; Q1=Q-one; p1q1=P1*Q1; Protocol("Calculating D and e ..."); // MakePrime(2, P); - tak delat nelzia! // Etot metod ne rabotaet dlia malix stepenej dvojki for (k=random(55555); !LongIsPrime(k);k++); D=k; ConvertHugeNumberToMyNum(sp1q1,p1q1); ConvertHugeNumberToMyNum(sD,D); for (k=1;;k++) { Euklid(sp1q1,sD,si,se); if (si.value==one && se.sign>0) break; sD.value=sD.value+one; }; Protocol("Done."); D=sD.value; e=se.value; // Vichislena para klychej (D,N) (e,N) Protocol("D=",D); Protocol("e=",e); ProtocolF("Amount iteration for calculation D and E is ",float(k)); }; void Keys(HugeNumber &d, HugeNumber &e, HugeNumber &nn) { HugeNumber a,c; HugeNumber b("12345"); unsigned long t_start; clrscr(); randomize(); Protocol("Keys generation process is started."); t_start=clock(); CreateKeys(d,e,nn); // ProtocolF("Time of calculation (sec)= ",float((clock()-t_start)/CLK_TCK)); ProtocolF("length (bytes) of d=",(float)BytesInHN(d)); ProtocolF("length (bytes) of e=",(float)BytesInHN(e)); ProtocolF("length (bytes) of n=",(float)BytesInHN(nn)); ProtocolF("Your key's length is ",(float)BytesInHN(nn)); if (nn>b) { /* As a matter in fact we don't need this step but this is a good way to test our previous calculations. */ t_start=clock(); Protocol("Begin of test encoding..."); // (d,nn) - klych dlia zashifrovivanija ModPower(a,b,d,nn); Protocol("Done. Test decoding is started..."); // (e,nn) - klych dlia rasshifrovivanija ModPower(c,a,e,nn); Protocol("Done."); if (c!=b) { Protocol("Error it test calculation.\n"); abort(); }; // ProtocolF("Time of test = ",(float)(clock()-t_start)/CLK_TCK); }; Protocol("Keys generation process is done."); }; ================================================ FILE: Bundles/Echoware/RSA/Keys_main.cpp ================================================ // Key_main.cpp : Defines the entry point for the console application. // #include "stdafx.h" //#include #include #include //#include #include "HNumber.h" #include "GSimply.h" extern void Keys(HugeNumber&,HugeNumber&,HugeNumber&); int main(int argc, char* argv[]) { HugeNumber e,d,n; // Generate keys Keys(e,d,n); SaveKeys("EncodeKey.txt",d,n); // Now "EncodeKey.txt" contains a key for encoding SaveKeys("DecodeKey.txt",e,n); // Now "DecodeKey.txt" contains a key for decoding printf("\nPress any key..."); // getch(); return 0; // File "Prot.txt" contains some debug information. // We don't need this file for work. } ================================================ FILE: Bundles/Echoware/RSA/MyNum.h ================================================ #ifndef __MyNum #define __MyNum #define SizeOfMyNum 4 #ifndef __TByte #define __TByte typedef unsigned char byte; #endif #ifndef __TWord #define __TWord typedef unsigned int word; #endif #define MyNumLen 7 #include "HNumber.h" struct MyNum { int sign; // Znak chisla HugeNumber value; // Chislo bez znaka MyNum(); }; extern void Assign1(MyNum &x); extern void Assign0(MyNum &x); extern void Assign(MyNum &x, MyNum &y); extern void ConvertHugeNumberToMyNum(MyNum &a, HugeNumber &b); extern int IsZero(MyNum &a); extern int CompareAbs(MyNum &a, MyNum &b); extern void Subtr(MyNum &c, MyNum &a, MyNum &b); extern void Div(MyNum &c, MyNum &a, MyNum &b); extern void Mult(MyNum &c, MyNum &a, MyNum &b); extern void Mod2(MyNum &c, MyNum &a); extern void Div2(MyNum &c, MyNum &a); #endif ================================================ FILE: Bundles/Echoware/RSA/MyTypes.h ================================================ #ifndef __MyTypes_H #define __MyTypes_H #define base 0x1000 // Osnovanie sistemy schislenija //#define DecBase // Ispolzyjy 10-tichnyjy zapis #define HexBase // Ispolzyjy 16-tichnyjy zapis #define DeltaIndex 16 // Shag yvelichenija razriadnosti chisla #define MaxRazr 128//512 typedef unsigned char byte; typedef unsigned int word; typedef unsigned long dword; #endif ================================================ FILE: Bundles/Echoware/RSA/Mynum.cpp ================================================ /* IgorSharov@rambler.ru Bolshie chisla so znakom v2.0 */ #include "stdafx.h" #include "MyNum.h" #include "HNFunct.h" #include "Operator.h" MyNum::MyNum() { sign=+1; value=zero; }; void Assign1(MyNum &x) { x.sign=+1; x.value=one; }; void Assign0(MyNum &x) { x.sign=+1; x.value=zero; }; void ConvertHugeNumberToMyNum(MyNum &a, HugeNumber &b) { a.sign=+1; a.value=b; }; void Assign(MyNum &x, MyNum &y) { x.sign=y.sign; x.value=y.value; }; int IsZero(MyNum &a) { if (a.value==zero) { a.sign=+1; // na vsiakij slychaj return -1; } else return 0; }; int CompareAbs(MyNum &a, MyNum &b) { if (a.value>b.value) return +1; else if (a.value0) { // Chisla odnogo znaka if (CompareAbs(a,b)>0) { // |a|>|b| c.sign=a.sign; c.value=a.value-b.value; } else { c.sign=-b.sign; c.value=b.value-a.value; }; } else // Chisla protivopolognix znakov if (a.sign>b.sign) { // a>0 && b<0 c.sign=+1; c.value=a.value+b.value; } else { // a<0 && b>0 c.sign=-1; c.value=a.value+b.value; }; }; void Div(MyNum &c, MyNum &a, MyNum &b) { c.sign=a.sign*b.sign; c.value=a.value/b.value; }; void Mult(MyNum &c, MyNum &a, MyNum &b) { c.sign=a.sign*b.sign; c.value=a.value*b.value; }; ================================================ FILE: Bundles/Echoware/RSA/Myprint.cpp ================================================ #include "stdafx.h" #include #include "HNumber.h" #include "MyNum.h" FILE *Prot=NULL; void Protocol(char *Msg) { Prot=fopen("Prot.txt","at"); printf("%s\n",Msg); fprintf(Prot,"%s\n",Msg); fclose(Prot); }; void Protocol(const char *Msg, MyNum &a) { char Buf[222]; HugeNumber hn; Prot=fopen("Prot.txt","at"); hn=a.value; hn.ToStr(Buf,222); printf("%s ",Msg); fprintf(Prot,"%s ",Msg); if (a.sign<0) { printf("-"); fprintf(Prot,"-"); }; printf("%s\n",Buf); fprintf(Prot,"%s\n",Buf); fclose(Prot); }; void ProtocolF(const char *Msg, float a) { Prot=fopen("Prot.txt","at"); printf("%s %g (dec)\n",Msg,a); fprintf(Prot,"%s %g (dec)\n",Msg,a); fclose(Prot); }; void Protocol(char *Msg, HugeNumber &a) { char Buf[222]; Prot=fopen("Prot.txt","at"); a.ToStr(Buf,222); printf("%s %s (hex)\n",Msg,Buf); fprintf(Prot,"%s %s (hex)\n",Msg,Buf); fclose(Prot); }; void PrintCode(const unsigned char *Msg, const long MsgLen) // Vivod zakodirovannogo soovshenija v 'krasivom' vide { const int MaxLen=24; int i,j; j=0; for (i=0; i=MaxLen) { j=0; printf("\n"); }; printf("%02X",Msg[i]); j++; }; printf("\n"); }; void PrintChar(unsigned char *ch, const long len) { int i; for (i=0; i #include "MyNum.h" extern FILE *Prot; extern void Protocol(char *Msg); extern void Protocol(char *Msg, MyNum &a); extern void Protocol(char *Msg, HugeNumber &a); extern void ProtocolF(const char *Msg, float a); extern void PrintCode(const unsigned char *Msg, const long MsgLen); extern void PrintChar(unsigned char *ch, const long len); #endif ================================================ FILE: Bundles/Echoware/RSA/Operator.cpp ================================================ /* IgorSharov@rambler.ru */ #include "stdafx.h" #include "HNumber.h" int operator !=( const HugeNumber &test1, const HugeNumber &test2 ) // 1 esli test1!=test2, inache 0 { word i,r1,r2; r1=test1.Razr(); r2=test2.Razr(); if (r1 != r2) return 1; for (i=0; i r2) return 0; // V chislax odinakovoe kolichestvo razriadov for (i=r1-1; i>=0; i--) { if (test1.digit[i] < test2.digit[i]) return 1; if (test1.digit[i] > test2.digit[i]) return 0; }; return 0; }; int operator > ( const HugeNumber &test1, const HugeNumber &test2 ) // 1 esli test1 r2) return 1; if (r1 < r2) return 0; // V chislax odinakovoe kolichestvo razriadov for (i=r1-1; i>=0; i--) { if (test1.digit[i] > test2.digit[i]) return 1; if (test1.digit[i] < test2.digit[i]) return 0; }; return 0; }; int operator <=( const HugeNumber &test1, const HugeNumber &test2 ) // 1 esli test1<=test2, inache 0 { size_t r1,r2; int i; r1=test1.Razr(); r2=test2.Razr(); if (r1 < r2) return 1; if (r1 > r2) return 0; // V chislax odinakovoe kolichestvo razriadov for (i=r1-1; i>=0; i--) { if (test1.digit[i] <= test2.digit[i]) return 1; if (test1.digit[i] > test2.digit[i]) return 0; }; return 0; }; ================================================ FILE: Bundles/Echoware/RSA/Operator.h ================================================ #ifndef __Operator_H #define __Operator_H #include "HNumber.h" extern int operator !=( const HugeNumber & test1, const HugeNumber & test2 ); extern int operator == ( const HugeNumber & test1, const HugeNumber & test2 ); extern int operator < ( const HugeNumber & test1, const HugeNumber & test2 ); extern int operator > ( const HugeNumber & test1, const HugeNumber & test2 ); extern int operator <=( const HugeNumber & test1, const HugeNumber & test2 ); #endif ================================================ FILE: Bundles/Echoware/RSA/PrimeGen.cpp ================================================ /* IgorSharov@rambler.ru */ #include "stdafx.h" #include #include "HNumber.h" #include "HNFunct.h" #include "Operator.h" #include "MyPrint.h" #include "CommonF.h" #include "MyTypes.h" #define MaxInt (int)(2147483647) extern time_t Misha_Time; extern long int random(long int); void NextPrime(int &intA) { for (;;) { intA+=2; if (LongIsPrime(intA)) break; }; }; int Rabin(int t, HugeNumber &S, HugeNumber &m, HugeNumber &mm1) // Test Rabina. Ispityemoe chislo imeet vid mm1=m-1=(2^t)*s // returns: // 0 if x - sostavnoe chislo // -1 esli ne ydjotsia ystanovit, chto x- sostavnoe { HugeNumber s,x,b; word wi; int i,flag; Protocol("Rabin's test is working"); // s dolgno bit nechiotnim for (s=S;;) { Div1(s,2,x,wi); if (wi!=0) break; s=x; t++; if (t==MaxInt) { Protocol("Rabin: t is too big!"); return -1; }; }; if (t==0) return -1; i=m.Razr()-1; if (i>0) b.Random(i); else b.digit[0]=2+random(UnsignedLong(m)-2); ModPower(x,b,s,m); // x==(b^s) mod m if (x!=one && x!=mm1) flag=1; else flag=0; for (i=1; i<=t; i++) { x=x*x; x=x%m; if (flag==1 && x==one) return 0; if (x!=one && x!=mm1) flag=1; else flag=0; }; if (x!=one) return 0; else return -1; }; int Test1(HugeNumber &a, HugeNumber &n, HugeNumber &nm1, HugeNumber °ree) // Function returns // -1 - n is prime // +1 - We need aditionl checks for n // 0 - n is not prime { HugeNumber b; Protocol("Main test is working."); //Protocol("n=",n); // Now: nm1=(2^s)*k, n=nm1+1, k<2^s, degree=(n-1)/2 ModPower(b,a,degree,n); if (b==nm1) return -1; if (b==one) return +1; return 0; }; int Test2(HugeNumber &x) // Returns: // 0 if x - sjstavnoe chislo // -1 if ne ydajotsia ystanovit, chto x ne prostoe chislo { HugeNumber tmp; word wi; int i; Div1(x,2,tmp,wi); if (wi==0) return 0; for (i=3; i=base) i=0; }; if (i!=1) break; }; // Esli osnovnoj test ne smog opredelit prostoty za pjat // popitok, to bery drugoe chislo if (j==5) break; wi=i; }; if (i==-1) break; }; //ProtocolF("GeneratePrime: Digits in n=",(float)BytesInHN(n)); //ProtocolF("GeneratePrime: counter=",(float)counter); Misha_Time+=clock()-t1; //ProtocolF("GeneratePrime: Misha_Time=",(float)Misha_Time/CLK_TCK); }; ================================================ FILE: Bundles/Echoware/RSA/Profiler.h ================================================ #ifndef __Profiler #define __Profiler #include #define TimeDim 11 extern time_t Time[TimeDim]; extern void ResetTime(); #endif ================================================ FILE: Bundles/Echoware/RSA/RSA.dsp ================================================ # Microsoft Developer Studio Project File - Name="RSA" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Static Library" 0x0104 CFG=RSA - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "RSA.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "RSA.mak" CFG="RSA - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "RSA - Win32 Release" (based on "Win32 (x86) Static Library") !MESSAGE "RSA - Win32 Debug" (based on "Win32 (x86) Static Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "RSA - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release6" # PROP Intermediate_Dir "Release6" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo /out:"..\Release6\RSA.lib" !ELSEIF "$(CFG)" == "RSA - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "RSA___Win32_Debug" # PROP BASE Intermediate_Dir "RSA___Win32_Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug6" # PROP Intermediate_Dir "Debug6" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c # ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo /out:"..\Debug6\RSA.lib" !ENDIF # Begin Target # Name "RSA - Win32 Release" # Name "RSA - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=.\Code.cpp # End Source File # Begin Source File SOURCE=.\Commonf.cpp # End Source File # Begin Source File SOURCE=.\Gsimply.cpp # End Source File # Begin Source File SOURCE=.\Hnfunct.cpp # End Source File # Begin Source File SOURCE=.\Hnumber.cpp # End Source File # Begin Source File SOURCE=.\Keys.cpp # End Source File # Begin Source File SOURCE=.\Keys_main.cpp # End Source File # Begin Source File SOURCE=.\Mynum.cpp # End Source File # Begin Source File SOURCE=.\Myprint.cpp # End Source File # Begin Source File SOURCE=.\Operator.cpp # End Source File # Begin Source File SOURCE=.\PrimeGen.cpp # End Source File # Begin Source File SOURCE=.\stdafx.cpp # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=.\Commonf.h # End Source File # Begin Source File SOURCE=.\Function.h # End Source File # Begin Source File SOURCE=.\Gsimply.h # End Source File # Begin Source File SOURCE=.\Hnfunct.h # End Source File # Begin Source File SOURCE=.\HNumber.h # End Source File # Begin Source File SOURCE=.\MyNum.h # End Source File # Begin Source File SOURCE=.\Myprint.h # End Source File # Begin Source File SOURCE=.\MyTypes.h # End Source File # Begin Source File SOURCE=.\Operator.h # End Source File # Begin Source File SOURCE=.\Profiler.h # End Source File # Begin Source File SOURCE=.\StdAfx.h # End Source File # Begin Source File SOURCE=.\TMSG.H # End Source File # End Group # End Target # End Project ================================================ FILE: Bundles/Echoware/RSA/RSA.vcproj ================================================ ================================================ FILE: Bundles/Echoware/RSA/StdAfx.h ================================================ // stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #pragma once #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers // TODO: reference additional headers your program requires here #include ================================================ FILE: Bundles/Echoware/RSA/TMSG.H ================================================ #ifndef __TMsg #define __TMsg // Class for encoding/decoding operations. Any message for // coding should be represented as an object of this class. class TMsg { public: unsigned int size; unsigned char *value; TMsg(); ~TMsg(); void UCharToMsg(const unsigned char *source, const unsigned int slen); void AddBytes(unsigned char *bytes, unsigned int len); void FreeMem(); void Resize(const unsigned int NewSize); }; #endif ================================================ FILE: Bundles/Echoware/RSA/stdafx.cpp ================================================ // stdafx.cpp : source file that includes just the standard includes // RSA.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" // TODO: reference any additional headers you need in STDAFX.H // and not in this file ================================================ FILE: Bundles/Echoware/RSAKeys.cpp ================================================ #include "stdafx.h" #include "RSAKeys.h" #include #include "RSA/HNumber.h" #include "RSA/Hnfunct.h" #include "blowfish.h" #include "rsa/operator.h" #define DFLT_GENERATOR "2" #define DFLT_MODULUS "7212610147295474909544523785043492409969382148186765460082500085393519556525921455588705423020751421" CRSAKeys::CRSAKeys() { } CRSAKeys::~CRSAKeys() { } const char* CRSAKeys::GetPublicKey() const { return m_pPublicKey; } const char* CRSAKeys::GetPrivateKey() const { return m_pPrivateKey; } int CRSAKeys::GetPublicKeyLength() const { return RSA_PUBLIC_KEY * size_of; } int CRSAKeys::GetPrivateKeyLength() const { return RSA_PRIVATE_KEY; } void CRSAKeys::GenerateRandomPrivateKey(char* pKey) { unsigned long temp[5] ; memset(temp, 0x00, 16); unsigned long randomNo; memset(pKey, 0x00, RSA_PRIVATE_KEY + 1); for(int index = 0; index < 5; index++) { srand( (unsigned)time( NULL ) + index); randomNo = rand() * rand(); temp[index] = randomNo; } sprintf(pKey, "%08lx%08lx%08lx%08lx%08lx", temp[0], temp[1], temp[2], temp[3], temp[4]); pKey[RSA_PRIVATE_KEY] ='\0'; } void CRSAKeys::GeneratePublicKey() { //code for Public key generation HugeNumber Y,x,n,f; x=HugeNumber(DFLT_GENERATOR); f=HugeNumber(DFLT_MODULUS); n=HugeNumber(m_pPrivateKey); //::ModPower(Y,x,n,f);//execute the modpower function Get the public key as HugeNumber ModPower(x,n,f,Y); memset(m_pPublicKey, 0, RSA_PUBLIC_KEY * size_of); memcpy(m_pPublicKey, Y.digit, RSA_PUBLIC_KEY * size_of); // copy the huge number digit buffer to char * memset(m_pPublicKeyLE, 0, RSA_PUBLIC_KEY * size_of); // Mac OS X must swap these for a big endian machine if (1) { for (int i = 0; i < RSA_PUBLIC_KEY; i++) { word value = OSSwapHostToLittleInt32(Y.digit[i]); memcpy(m_pPublicKeyLE + i * size_of, &value, size_of); } } } void CRSAKeys::GenerateSessionKey(char* szPeerPublicKey, char* szSessionKey) { HugeNumber Y,n,f,h1; word *tmp = (word*)szPeerPublicKey;//convert form liitle to host for (int i = 0; i < RSA_PUBLIC_KEY; i++) { word value = OSSwapLittleToHostInt32(tmp[i]); h1.digit[i] = value; } // memcpy(h1.digit, szPeerPublicKey, RSA_PUBLIC_KEY * size_of); memset(szSessionKey, 0, 1024); f=HugeNumber(DFLT_MODULUS); n=HugeNumber(m_pPrivateKey); //::ModPower(Y,h1,n,f); ModPower(h1,n,f,Y); szSessionKey=Y.ToHexStr(szSessionKey,1024 ); } void CRSAKeys::Generate() { GenerateRandomPrivateKey(m_pPrivateKey); // Generate public key (deffie hellman) GeneratePublicKey(); } void CRSAKeys::EncryptPassword(char* pData, DWORD dwDataLength, const char* strPass, char* output) { HugeNumber Y,n,f,h1; if (1) { word *publicKeyPointer = (word *)pData; for (int i = 0; i < dwDataLength / size_of; i++) { h1.digit[i] = OSSwapLittleToHostInt32(publicKeyPointer[i]); } } else memcpy(h1.digit, pData, dwDataLength); char* pSessionKey = new char[1024]; memset(pSessionKey, 0, 1024); f=HugeNumber(DFLT_MODULUS); //::ModPower(Y,h1,n,f); n=HugeNumber(m_pPrivateKey); ModPower(h1,n,f,Y); pSessionKey = Y.ToHexStr(pSessionKey, 1024); //const char* data = strPass; char* data = new char[dwDataLength]; memset(data, 0, dwDataLength); memcpy(data, strPass, min(strlen(strPass), dwDataLength)); //translate data to HOST endian word *dwData = (word*)data; for (int i = 0; i < dwDataLength / size_of; i++) { dwData[i] = OSSwapLittleToHostInt32(dwData[i]); } CBlowFish blowfish; blowfish.Initialize((BYTE*)pSessionKey, strlen(pSessionKey)); blowfish.Encode((BYTE*)data, (BYTE*)output, dwDataLength); //SS: added change to big endian word *publicKeyPointer = (word*)output; for (int i = 0; i < dwDataLength / size_of; i++) { publicKeyPointer[i] = OSSwapHostToLittleInt32(publicKeyPointer[i]); } delete []pSessionKey; delete []data; } //"Right to Left Binary Algorithm" from http://en.wikipedia.org/wiki/Modular_exponentiation //r=(b^e)(mod m) void CRSAKeys::ModPower(HugeNumber& b, HugeNumber& e, HugeNumber& m, HugeNumber& r) { r="1"; HugeNumber zero("0"); HugeNumber two("2"); while (e > zero) { //if (e & 1 > 0) //if ((e % two) > zero) if (e.digit[0] % 2 != 0) { r=r * b; r=r % m; } e = e / two; b = (b * b); b = (b % m); } } ================================================ FILE: Bundles/Echoware/RSAKeys.h ================================================ #ifndef _RSAKEYS_H #define _RSAKEYS_H #if _MSC_VER > 1000 #pragma once #endif #include "rsa/HNumber.h" #define RSA_PUBLIC_KEY 80 #define RSA_PRIVATE_KEY 40 #define size_of sizeof(word) class CRSAKeys { public: CRSAKeys(); virtual ~CRSAKeys(); //Generate the Deffie Hellman key pair void Generate(); const char* GetPublicKey() const; const char* GetPrivateKey() const; int GetPublicKeyLength() const; int GetPrivateKeyLength() const; void EncryptPassword(char* pData, DWORD dwDataLength, const char* strPass, char* output); void GenerateSessionKey(char* szPeerPublicKey, char* szSessionKey); char m_pPublicKeyLE[RSA_PUBLIC_KEY * size_of]; protected: //Generate the random private key void GenerateRandomPrivateKey(char* pKey); //Generate the public key for the private key void GeneratePublicKey(); //"Right to Left Binary Algorithm" from http://en.wikipedia.org/wiki/Modular_exponentiation //r=(b^e)(mod m) void ModPower(HugeNumber& b, HugeNumber& e, HugeNumber& m, HugeNumber& r); protected: char m_pPublicKey[RSA_PUBLIC_KEY * size_of]; char m_pPrivateKey[RSA_PRIVATE_KEY + 1]; }; #endif ================================================ FILE: Bundles/Echoware/ServerListSynchronize.cpp ================================================ /* * ServerListSynchronize.cpp * Echoware * * Created by admin on 2/21/07. * Copyright 2007 __MyCompanyName__. All rights reserved. * */ #include "ServerListSynchronize.h" #include "EchoToOSX.h" #include "ProxiesManager.h" #include "MyDllProxyInfo.h" #include "globals.h" CServerListSynchronize::CServerListSynchronize() { m_fInitialized = false; echo = nil; } CServerListSynchronize::~CServerListSynchronize() { if (echo) { int count = [echo->echoInfoProxys count]; while (count > 0) { count--; CMyDllProxyInfo *pMyProxyInfo = (CMyDllProxyInfo*)[[echo->echoInfoProxys objectAtIndex:count] pointerValue]; delete pMyProxyInfo; } } m_hManageThread_Connect = 0; m_dwManageThread_Connect = 0; m_hManageThread_Remove = 0; m_dwManageThread_Remove = 0; m_hManageThread_Update = 0; m_dwManageThread_Update = 0; echo = nil; } void CServerListSynchronize::Init() { if (!m_fInitialized) { m_hManageThread_Connect = 0; m_dwManageThread_Connect = 0; m_hManageThread_Remove = 0; m_dwManageThread_Remove = 0; m_hManageThread_Update = 0; m_dwManageThread_Update = 0; echo = nil; m_fTerminated_Connect = false; m_fTerminated_Remove = false; m_fTerminated_Update = false; m_fTerminated = false; m_fHasQuit_Connect = false; m_fHasQuit_Remove = false; m_fHasQuit_Update = false; m_fStatusChanged = false; m_fInitialized = true; } } void CServerListSynchronize::Start(EchoController *echo) { m_fTerminated_Connect = false; m_fTerminated_Remove = false; m_fTerminated_Update = false; m_fTerminated = false; m_fHasQuit_Connect = false; m_fHasQuit_Remove = false; m_fHasQuit_Update = false; this->echo = echo; m_hManageThread_Connect = CreateThread(0, 0, ManageThreadProc_Connect, this, 0, &m_dwManageThread_Connect); m_hManageThread_Remove = CreateThread(0, 0, ManageThreadProc_Remove, this, 0, &m_dwManageThread_Remove); m_hManageThread_Update = CreateThread(0, 0, ManageThreadProc_Update, this, 0, &m_dwManageThread_Update); } void CServerListSynchronize::Terminate() { m_fHasQuit_Update = false; m_fHasQuit_Connect = false; m_fHasQuit_Remove = false; m_fTerminated_Update = true; m_fTerminated_Connect = true; m_fTerminated_Remove = true; unsigned long timeout = 5000; ShutdownThread(m_hManageThread_Update, timeout, &m_fTerminated_Update, &m_fHasQuit_Update); ShutdownThread(m_hManageThread_Connect, timeout, &m_fTerminated_Connect, &m_fHasQuit_Connect); ShutdownThread(m_hManageThread_Remove, timeout, &m_fTerminated_Remove, &m_fHasQuit_Remove); m_fTerminated = true; } bool CServerListSynchronize::getStatusChanged() { return m_fStatusChanged; } void CServerListSynchronize::setStatusChanged(bool value) { m_fStatusChanged = value; } unsigned long CServerListSynchronize::ManageThreadProc_Connect(void* lpParameter) { CServerListSynchronize* sls = (CServerListSynchronize*)lpParameter; while (true) { sls->m_critSection.Lock(); if (sls->m_fTerminated_Connect) { sls->m_critSection.Unlock(); break; } if (sls->echo) { int count = [sls->echo->echoInfoProxys count]; int ind = 0; while (ind < count) { CMyDllProxyInfo *pMyProxyInfo = [sls->echo getDllProxyInfo: ind]; if (pMyProxyInfo == NULL) { ind++; continue; } IDllProxyInfo *echoProxyInfo = pMyProxyInfo->getDllProxyInfo(); switch(pMyProxyInfo->getStatus()) { case CMyDllProxyInfo::Connecting: { NSLog(@"Connecting..."); int ind = [sls->echo->echoTableView selectedRow]; [sls->echo reloadData]; [sls->echo selectRow: ind]; echoProxyInfo->SetReconnectProxy(false); int connectResult = ConnectProxy(echoProxyInfo); switch (connectResult) { case 0: echoProxyInfo->SetReconnectProxy(true); NSLog(@"Status: Connected"); break; case 1: NSLog(@"Status: No Server Avail"); break; case 2: NSLog(@"Status: Auth Failed"); break; case 3: echoProxyInfo->SetReconnectProxy(true); NSLog(@"Status: Already Active"); break; case 4: echoProxyInfo->SetReconnectProxy(true); NSLog(@"Status: Timed Out"); break; default: NSLog(@"Status: Unknown Return Code"); break; } if (pMyProxyInfo->getStatus() == CMyDllProxyInfo::Connecting) pMyProxyInfo->RemoveStatus(); pMyProxyInfo->setPrevStatus(echoProxyInfo->GetStatus()); ind = [sls->echo->echoTableView selectedRow]; [sls->echo reloadData]; [sls->echo selectRow: ind]; NSLog(@"Connected..."); } break; case CMyDllProxyInfo::Reconnecting: { NSLog(@"Reconnecting..."); int ind = [sls->echo->echoTableView selectedRow]; [sls->echo reloadData]; [sls->echo selectRow: ind]; echoProxyInfo->SetReconnectProxy(false); int status = echoProxyInfo->GetStatus(); if (!(status & STATUS_DISCONNECTED_FROM_PROXY) && status) { bool disconnected = DisconnectProxy(echoProxyInfo); pMyProxyInfo->WaitForStatus(STATUS_DISCONNECTED_FROM_PROXY, 500000); if (disconnected) NSLog(@"Disconnected..."); else NSLog(@"Not disconnected..."); } int connectResult = ConnectProxy(echoProxyInfo); switch (connectResult) { case 0: echoProxyInfo->SetReconnectProxy(true); NSLog(@"Status: Connected"); break; case 1: NSLog(@"Status: No Server Avail"); break; case 2: NSLog(@"Status: Auth Failed"); break; case 3: echoProxyInfo->SetReconnectProxy(true); NSLog(@"Status: Already Active"); break; case 4: echoProxyInfo->SetReconnectProxy(true); NSLog(@"Status: Timed Out"); break; default: NSLog(@"Status: Unknown Return Code"); break; } if (pMyProxyInfo->getStatus() == CMyDllProxyInfo::Reconnecting) pMyProxyInfo->RemoveStatus(); pMyProxyInfo->setPrevStatus(echoProxyInfo->GetStatus()); ind = [sls->echo->echoTableView selectedRow]; [sls->echo reloadData]; [sls->echo selectRow: ind]; NSLog(@"Reconnected..."); } break; } ind++; } } sls->m_critSection.Unlock(); Sleep(1000000); } sls->m_fHasQuit_Connect = true; return 0; } unsigned long CServerListSynchronize::ManageThreadProc_Remove(void* lpParameter) { CServerListSynchronize* sls = (CServerListSynchronize*)lpParameter; while (true) { sls->m_critSectionRemove.Lock(); if (sls->m_fTerminated_Remove) { sls->m_critSectionRemove.Unlock(); break; } if (sls->echo) { int count = [sls->echo->echoInfoProxysToRemove count]; while (count > 0) { count--; CMyDllProxyInfo *pMyProxyInfo = (CMyDllProxyInfo*)[[sls->echo->echoInfoProxysToRemove objectAtIndex:count] pointerValue]; IDllProxyInfo *echoProxyInfo = pMyProxyInfo->getDllProxyInfo(); switch(pMyProxyInfo->getStatus()) { case CMyDllProxyInfo::Removing: { NSLog(@"Removing..."); echoProxyInfo->SetReconnectProxy(false); StopConnecting(echoProxyInfo); int status = echoProxyInfo->GetStatus(); if (!(status & STATUS_DISCONNECTED_FROM_PROXY) && status) { bool disconnected = DisconnectProxy(echoProxyInfo); pMyProxyInfo->WaitForStatus(STATUS_DISCONNECTED_FROM_PROXY, 500000); if (disconnected) NSLog(@"Disconnected..."); else NSLog(@"Not disconnected..."); } [sls->echo->echoInfoProxysToRemove removeObjectAtIndex: count]; DeleteProxyInfoClassObject(echoProxyInfo); pMyProxyInfo->RemoveStatus(); delete pMyProxyInfo; NSLog(@"Removed..."); } break; } } } sls->m_critSectionRemove.Unlock(); Sleep(1000000); } sls->m_fHasQuit_Remove = true; return 0; } unsigned long CServerListSynchronize::ManageThreadProc_Update(void* lpParameter) { CServerListSynchronize* sls = (CServerListSynchronize*)lpParameter; while (true) { sls->m_critSection.Lock(); if (sls->m_fTerminated_Update) { sls->m_critSection.Unlock(); break; } bool statusChanged = false; if (sls->echo) { int count = [sls->echo->echoInfoProxys count]; while (count > 0) { count--; CMyDllProxyInfo *pMyProxyInfo = [sls->echo getDllProxyInfo: count]; if (pMyProxyInfo == NULL) continue; IDllProxyInfo *echoProxyInfo = pMyProxyInfo->getDllProxyInfo(); bool status_changed = pMyProxyInfo->isStatusChanged(echoProxyInfo->GetStatus()); if (!statusChanged && status_changed) { statusChanged = true; pMyProxyInfo->setPrevStatus(echoProxyInfo->GetStatus()); break; } } } sls->setStatusChanged(statusChanged); if (statusChanged) { NSLog(@"Status was changed"); int index = [sls->echo->echoTableView selectedRow]; [sls->echo reloadData]; [sls->echo selectRow: index]; } sls->m_critSection.Unlock(); Sleep(2000000); } sls->m_fHasQuit_Update = true; return 0; } ================================================ FILE: Bundles/Echoware/ServerListSynchronize.h ================================================ /* * ServerListSynchronize.h * Echoware * * Created by admin on 2/21/07. * Copyright 2007 __MyCompanyName__. All rights reserved. * */ #include #include "pthread.h" #include "CritSection.h" #import #include "EchoController.h" class CServerListSynchronize { public: CServerListSynchronize(); ~CServerListSynchronize(); void Init(); void Start(EchoController *echo); void Terminate(); bool getStatusChanged(); void setStatusChanged(bool value); private: bool m_fTerminated_Connect; bool m_fTerminated_Remove; bool m_fTerminated_Update; bool m_fTerminated; bool m_fHasQuit_Connect; bool m_fHasQuit_Remove; bool m_fHasQuit_Update; bool m_fInitialized; bool m_fStatusChanged; EchoController *echo; void* m_hManageThread_Connect; unsigned long m_dwManageThread_Connect; void* m_hManageThread_Remove; unsigned long m_dwManageThread_Remove; void* m_hManageThread_Update; unsigned long m_dwManageThread_Update; CCritSection m_critSection; CCritSection m_critSectionRemove; static unsigned long ManageThreadProc_Connect(void* lpParameter); static unsigned long ManageThreadProc_Remove(void* lpParameter); static unsigned long ManageThreadProc_Update(void* lpParameter); }; ================================================ FILE: Bundles/Echoware/User.cpp ================================================ /* * User.cpp * Echoware * * Created by admin on 4/11/07. * Copyright 2007 __MyCompanyName__. All rights reserved. * */ #include "User.h" #include #include #include #include CUser::CUser(NSString *username) { CDirService dirService; initWithUsername(username, &dirService); } CUser::CUser(NSString *username, NSString *password) { CDirService dirService; if (dirService.authenticateUser([username cStringUsingEncoding:NSUTF8StringEncoding], [password cStringUsingEncoding:NSUTF8StringEncoding])) { initWithUsername(username, &dirService); } } CUser::~CUser() { [m_name release]; [m_realName release]; if (m_groups != NULL) free(m_groups); m_groups = NULL; } NSUserDefaults* CUser::userDefaults(NSString *domain) { // uid_t old_uid = geteuid(); // [NSUserDefaults resetStandardUserDefaults]; // seteuid(m_uid); NSUserDefaults *suDefaults = [NSUserDefaults standardUserDefaults]; NSDictionary *persistDomain = [suDefaults persistentDomainForName: domain]; [suDefaults registerDefaults: persistDomain]; // [NSUserDefaults resetStandardUserDefaults]; // seteuid(tmp_uid); // old_uid = -1; return suDefaults; } void CUser::initWithUsername(NSString* username, CDirService* dirService) { NSDictionary* userInfo = dirService->attributeDataForNodeOfType(kDSStdRecordTypeUsers, [username cStringUsingEncoding:NSUTF8StringEncoding], kDSNAttrRecordName, kDS1AttrUniqueID, kDS1AttrPrimaryGroupID, kDS1AttrDistinguishedName, NULL, NULL); NSDictionary* adminInfo = dirService->attributeDataForNodeOfType(kDSStdRecordTypeGroups, "admin", kDSNAttrRecordName, kDSNAttrGroupMembership, NULL, NULL, NULL, NULL); m_name = [[[userInfo objectForKey:[NSString stringWithCString:kDSNAttrRecordName encoding:NSUTF8StringEncoding]] objectAtIndex:0] retain]; m_realName = [[[userInfo objectForKey:[NSString stringWithCString:kDS1AttrDistinguishedName encoding:NSUTF8StringEncoding]] objectAtIndex:0] retain]; m_uid = [[[userInfo objectForKey:[NSString stringWithCString:kDS1AttrUniqueID encoding:NSUTF8StringEncoding]] objectAtIndex:0] intValue]; m_gid = [[[userInfo objectForKey:[NSString stringWithCString:kDS1AttrPrimaryGroupID encoding:NSUTF8StringEncoding]] objectAtIndex:0] intValue]; NSArray* adminMembers = [adminInfo objectForKey:[NSString stringWithCString:kDSNAttrGroupMembership encoding:NSUTF8StringEncoding]]; m_admin = [adminMembers containsObject:m_realName] || [adminMembers containsObject:m_name]; if (m_name != nil) { m_groups = NULL; int groupsTemp[256]; int groupsize = 256; getgrouplist([m_name cStringUsingEncoding:NSUTF8StringEncoding], m_gid, groupsTemp, &groupsize); if (groupsize > 1) { m_groups = (int*)malloc( sizeof(int) * groupsize ); m_groups[groupsize - 1] = -1; int i = 0; for (i = 1; i < groupsize; i++) m_groups[i-1] = groupsTemp[i]; } } } CFStringRef CUser::CopyCurrentConsoleUsername() { CFStringRef consoleUserName; uid_t uid; gid_t gid; consoleUserName = SCDynamicStoreCopyConsoleUser(NULL, &uid, &gid); return consoleUserName; } NSString* CUser::CurrentConsoleUsername() { NSString *res = NULL; CFStringRef userName = CopyCurrentConsoleUsername(); if (userName != NULL) { res = (NSString*)userName; } return res; } bool CUser::ConsoleUserIsLoggedIn() { bool result = false; CFStringRef userName = CopyCurrentConsoleUsername(); if (userName != NULL) { CFRelease(userName); result = true; } return result; } ================================================ FILE: Bundles/Echoware/User.h ================================================ /* * User.h * Echoware * * Created by admin on 4/11/07. * Copyright 2007 __MyCompanyName__. All rights reserved. * */ #import #include #include #include "DirService.h" class CUser { private: NSString* m_name; NSString* m_realName; int m_gid; int m_uid; bool m_admin; int* m_groups; void initWithUsername(NSString* username, CDirService* dirService); public: CUser(NSString *username); CUser(NSString *username, NSString *password); virtual ~CUser(); NSString* name() { return m_name; } NSString* realName() { return m_realName; } int gid() { return m_gid; } int uid() { return m_uid; } bool admin() { return m_admin; } int* groups() { return m_groups; } NSUserDefaults *userDefaults(NSString *domain); static CFStringRef CopyCurrentConsoleUsername(); static NSString* CurrentConsoleUsername(); static bool ConsoleUserIsLoggedIn(); }; ================================================ FILE: Bundles/Echoware/blowfish.cpp ================================================ // blowfish.cpp C++ class implementation of the BLOWFISH encryption algorithm // _THE BLOWFISH ENCRYPTION ALGORITHM_ // by Bruce Schneier // Revised code--3/20/94 // Converted to C++ class 5/96, Jim Conger #include "stdafx.h" #include "blowfish.h" #include "blowfish.h2" // holds the random digit tables #define S(x,i) (SBoxes[i][x.w.byte##i]) #define bf_F(x) (((S(x,0) + S(x,1)) ^ S(x,2)) + S(x,3)) #undef ROUND #define ROUND(a,b,n) (a.dword ^= bf_F(b) ^ PArray[n]) CBlowFish::CBlowFish () { PArray = new DWORD [18] ; SBoxes = new DWORD [4][256] ; } CBlowFish::~CBlowFish () { delete [] PArray; delete [] SBoxes; } // the low level (private) encryption function void CBlowFish::Blowfish_encipher (DWORD *xl, DWORD *xr) { union aword Xl, Xr ; Xl.dword = *xl ; Xr.dword = *xr ; Xl.dword ^= PArray [0]; ROUND (Xr, Xl, 1) ; ROUND (Xl, Xr, 2) ; ROUND (Xr, Xl, 3) ; ROUND (Xl, Xr, 4) ; ROUND (Xr, Xl, 5) ; ROUND (Xl, Xr, 6) ; ROUND (Xr, Xl, 7) ; ROUND (Xl, Xr, 8) ; ROUND (Xr, Xl, 9) ; ROUND (Xl, Xr, 10) ; ROUND (Xr, Xl, 11) ; ROUND (Xl, Xr, 12) ; ROUND (Xr, Xl, 13) ; ROUND (Xl, Xr, 14) ; ROUND (Xr, Xl, 15) ; ROUND (Xl, Xr, 16) ; Xr.dword ^= PArray [17] ; *xr = Xl.dword ; *xl = Xr.dword ; } // the low level (private) decryption function void CBlowFish::Blowfish_decipher (DWORD *xl, DWORD *xr) { union aword Xl ; union aword Xr ; Xl.dword = *xl ; Xr.dword = *xr ; Xl.dword ^= PArray [17] ; ROUND (Xr, Xl, 16) ; ROUND (Xl, Xr, 15) ; ROUND (Xr, Xl, 14) ; ROUND (Xl, Xr, 13) ; ROUND (Xr, Xl, 12) ; ROUND (Xl, Xr, 11) ; ROUND (Xr, Xl, 10) ; ROUND (Xl, Xr, 9) ; ROUND (Xr, Xl, 8) ; ROUND (Xl, Xr, 7) ; ROUND (Xr, Xl, 6) ; ROUND (Xl, Xr, 5) ; ROUND (Xr, Xl, 4) ; ROUND (Xl, Xr, 3) ; ROUND (Xr, Xl, 2) ; ROUND (Xl, Xr, 1) ; Xr.dword ^= PArray[0]; *xl = Xr.dword; *xr = Xl.dword; } // constructs the enctryption sieve void CBlowFish::Initialize (BYTE key[], int keybytes) { int i, j ; DWORD data, datal, datar ; union aword temp ; // first fill arrays from data tables for (i = 0 ; i < 18 ; i++) PArray [i] = (bf_P[i]); for (i = 0 ; i < 4 ; i++) { for (j = 0 ; j < 256 ; j++) SBoxes [i][j] = (bf_S[i][j]); } j = 0 ; for (i = 0 ; i < NPASS + 2 ; ++i) { temp.dword = 0 ; temp.w.byte0 = key[j]; temp.w.byte1 = key[(j+1) % keybytes] ; temp.w.byte2 = key[(j+2) % keybytes] ; temp.w.byte3 = key[(j+3) % keybytes] ; data = temp.dword ; PArray [i] ^= data ; j = (j + 4) % keybytes ; } datal = 0 ; datar = 0 ; for (i = 0 ; i < NPASS + 2 ; i += 2) { Blowfish_encipher (&datal, &datar) ; PArray [i] = datal ; PArray [i + 1] = datar ; } for (i = 0 ; i < 4 ; ++i) { for (j = 0 ; j < 256 ; j += 2) { Blowfish_encipher (&datal, &datar) ; SBoxes [i][j] = datal ; SBoxes [i][j + 1] = datar ; } } } // get output length, which must be even MOD 8 DWORD CBlowFish::GetOutputLength (DWORD lInputLong) { DWORD lVal ; lVal = lInputLong % 8 ; // find out if uneven number of bytes at the end if (lVal != 0) return lInputLong + 8 - lVal ; else return lInputLong ; } // Encode pIntput into pOutput. Input length in lSize. Returned value // is length of output which will be even MOD 8 bytes. Input buffer and // output buffer can be the same, but be sure buffer length is even MOD 8. DWORD CBlowFish::Encode (BYTE * pInput, BYTE * pOutput, DWORD lSize) { DWORD lCount, lOutSize, lGoodBytes ; BYTE *pi, *po ; int i, j ; int SameDest = (pInput == pOutput ? 1 : 0) ; lOutSize = GetOutputLength (lSize) ; for (lCount = 0 ; lCount < lOutSize ; lCount += 8) { if (SameDest) // if encoded data is being written into input buffer { if (lCount < lSize - 7) // if not dealing with uneven bytes at end { Blowfish_encipher ((DWORD *) pInput, (DWORD *) (pInput + 4)) ; } else // pad end of data with null bytes to complete encryption { po = pOutput + lSize ; // point at byte past the end of actual data j = (int) (lOutSize - lSize) ; // number of bytes to set to null for (i = 0 ; i < j ; i++) *po++ = 0 ; Blowfish_encipher ((DWORD *) pInput, (DWORD *) (pInput + 4)) ; } pInput += 8 ; } else // output buffer not equal to input buffer, so must copy { // input to output buffer prior to encrypting if (lCount < lSize - 7) // if not dealing with uneven bytes at end { pi = pInput ; po = pOutput ; for (i = 0 ; i < 8 ; i++) // copy bytes to output *po++ = *pi++ ; Blowfish_encipher ((DWORD *) pOutput, // now encrypt them (DWORD *) (pOutput + 4)) ; } else // pad end of data with null bytes to complete encryption { lGoodBytes = lSize - lCount ; // number of remaining data bytes po = pOutput ; for (i = 0 ; i < (int) lGoodBytes ; i++) *po++ = *pInput++ ; for (j = i ; j < 8 ; j++) *po++ = 0 ; Blowfish_encipher ((DWORD *) pOutput, (DWORD *) (pOutput + 4)) ; } pInput += 8 ; pOutput += 8 ; } } return lOutSize ; } // Decode pIntput into pOutput. Input length in lSize. Input buffer and // output buffer can be the same, but be sure buffer length is even MOD 8. void CBlowFish::Decode (BYTE * pInput, BYTE * pOutput, DWORD lSize) { DWORD lCount ; BYTE *pi, *po ; int i ; int SameDest = (pInput == pOutput ? 1 : 0) ; for (lCount = 0 ; lCount < lSize ; lCount += 8) { if (SameDest) // if encoded data is being written into input buffer { Blowfish_decipher ((DWORD *) pInput, (DWORD *) (pInput + 4)) ; pInput += 8 ; } else // output buffer not equal to input buffer { // so copy input to output before decoding pi = pInput ; po = pOutput ; for (i = 0 ; i < 8 ; i++) *po++ = *pi++ ; Blowfish_decipher ((DWORD *) pOutput, (DWORD *) (pOutput + 4)) ; pInput += 8 ; pOutput += 8 ; } } } ================================================ FILE: Bundles/Echoware/blowfish.h ================================================ #ifndef _inc_blowfish_h #define _inc_blowfish_h #include // blowfish.h interface file for blowfish.cpp // _THE BLOWFISH ENCRYPTION ALGORITHM_ // by Bruce Schneier // Revised code--3/20/94 // Converted to C++ class 5/96, Jim Conger #define MAXKEYBYTES 56 // 448 bits max #define NPASS 16 // SBox passes #ifndef DWORD #define DWORD unsigned long #endif #define WORD unsigned short #define BYTE unsigned char class CBlowFish { // choose a byte order for your hardware // not needed even more to change #if defined(__LITTLE_ENDIAN__) //#define ORDER_DCBA // chosing Intel in this case //#ifdef ORDER_DCBA // DCBA - little endian - intel union aword { DWORD dword; BYTE byte [4]; struct { unsigned int byte3:8; unsigned int byte2:8; unsigned int byte1:8; unsigned int byte0:8; } w; }; //#endif #elif defined(__BIG_ENDIAN__) //#ifdef ORDER_ABCD // ABCD - big endian - motorola union aword { DWORD dword; BYTE byte [4]; struct { unsigned int byte0:8; unsigned int byte1:8; unsigned int byte2:8; unsigned int byte3:8; } w; }; #else #error Unknown endianness. #endif /* #ifdef ORDER_BADC // BADC - vax union aword { DWORD dword; BYTE byte [4]; struct { unsigned int byte1:8; unsigned int byte0:8; unsigned int byte3:8; unsigned int byte2:8; } w; }; #endif */ private: DWORD * PArray ; DWORD (* SBoxes)[256]; void Blowfish_encipher (DWORD *xl, DWORD *xr) ; void Blowfish_decipher (DWORD *xl, DWORD *xr) ; public: CBlowFish () ; ~CBlowFish () ; void Initialize (BYTE key[], int keybytes) ; DWORD GetOutputLength (DWORD lInputLong) ; DWORD Encode (BYTE * pInput, BYTE * pOutput, DWORD lSize) ; void Decode (BYTE * pInput, BYTE * pOutput, DWORD lSize) ; } ; #endif //_inc_blowfish_h ================================================ FILE: Bundles/Echoware/blowfish.h2 ================================================ // blowfish.h2 header file containing random number tables static DWORD bf_P[NPASS + 2] = { 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89, 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, 0x9216d5d9, 0x8979fb1b, }; static DWORD bf_S[4][256] = { 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99, 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16, 0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e, 0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee, 0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013, 0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef, 0x8e79dcb0, 0x603a180e, 0x6c9e0e8b, 0xb01e8a3e, 0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60, 0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440, 0x55ca396a, 0x2aab10b6, 0xb4cc5c34, 0x1141e8ce, 0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a, 0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e, 0xafd6ba33, 0x6c24cf5c, 0x7a325381, 0x28958677, 0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193, 0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032, 0xef845d5d, 0xe98575b1, 0xdc262302, 0xeb651b88, 0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239, 0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e, 0x21c66842, 0xf6e96c9a, 0x670c9c61, 0xabd388f0, 0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3, 0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98, 0xa1f1651d, 0x39af0176, 0x66ca593e, 0x82430e88, 0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe, 0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6, 0x4ed3aa62, 0x363f7706, 0x1bfedf72, 0x429b023d, 0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b, 0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7, 0xe3fe501a, 0xb6794c3b, 0x976ce0bd, 0x04c006ba, 0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463, 0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f, 0x6dfc511f, 0x9b30952c, 0xcc814544, 0xaf5ebd09, 0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3, 0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb, 0x5579c0bd, 0x1a60320a, 0xd6a100c6, 0x402c7279, 0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8, 0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab, 0x323db5fa, 0xfd238760, 0x53317b48, 0x3e00df82, 0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db, 0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573, 0x695b27b0, 0xbbca58c8, 0xe1ffa35d, 0xb8f011a0, 0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b, 0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790, 0xe1ddf2da, 0xa4cb7e33, 0x62fb1341, 0xcee4c6e8, 0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4, 0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0, 0xd08ed1d0, 0xafc725e0, 0x8e3c5b2f, 0x8e7594b7, 0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c, 0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad, 0x2f2f2218, 0xbe0e1777, 0xea752dfe, 0x8b021fa1, 0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299, 0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9, 0x165fa266, 0x80957705, 0x93cc7314, 0x211a1477, 0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf, 0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49, 0x00250e2d, 0x2071b35e, 0x226800bb, 0x57b8e0af, 0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa, 0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5, 0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41, 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915, 0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400, 0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915, 0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664, 0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a, 0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623, 0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266, 0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1, 0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e, 0x3f54989a, 0x5b429d65, 0x6b8fe4d6, 0x99f73fd6, 0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1, 0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e, 0x09686b3f, 0x3ebaefc9, 0x3c971814, 0x6b6a70a1, 0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737, 0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8, 0xb03ada37, 0xf0500c0d, 0xf01c1f04, 0x0200b3ff, 0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd, 0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701, 0x3ae5e581, 0x37c2dadc, 0xc8b57634, 0x9af3dda7, 0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41, 0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331, 0x4e548b38, 0x4f6db908, 0x6f420d03, 0xf60a04bf, 0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af, 0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e, 0x5512721f, 0x2e6b7124, 0x501adde6, 0x9f84cd87, 0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c, 0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2, 0xef1c1847, 0x3215d908, 0xdd433b37, 0x24c2ba16, 0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd, 0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b, 0x043556f1, 0xd7a3c76b, 0x3c11183b, 0x5924a509, 0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e, 0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3, 0x771fe71c, 0x4e3d06fa, 0x2965dcb9, 0x99e71d0f, 0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a, 0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4, 0xf2f74ea7, 0x361d2b3d, 0x1939260f, 0x19c27960, 0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66, 0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28, 0xc332ddef, 0xbe6c5aa5, 0x65582185, 0x68ab9802, 0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84, 0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510, 0x13cca830, 0xeb61bd96, 0x0334fe1e, 0xaa0363cf, 0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14, 0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e, 0x648b1eaf, 0x19bdf0ca, 0xa02369b9, 0x655abb50, 0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7, 0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8, 0xf837889a, 0x97e32d77, 0x11ed935f, 0x16681281, 0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99, 0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696, 0xcdb30aeb, 0x532e3054, 0x8fd948e4, 0x6dbc3128, 0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73, 0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0, 0x45eee2b6, 0xa3aaabea, 0xdb6c4f15, 0xfacb4fd0, 0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105, 0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250, 0xcf62a1f2, 0x5b8d2646, 0xfc8883a0, 0xc1c7b6a3, 0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285, 0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00, 0x58428d2a, 0x0c55f5ea, 0x1dadf43e, 0x233f7061, 0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb, 0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e, 0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735, 0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc, 0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9, 0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340, 0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20, 0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7, 0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934, 0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068, 0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af, 0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840, 0x4d95fc1d, 0x96b591af, 0x70f4ddd3, 0x66a02f45, 0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504, 0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a, 0x28507825, 0x530429f4, 0x0a2c86da, 0xe9b66dfb, 0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee, 0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6, 0xaace1e7c, 0xd3375fec, 0xce78a399, 0x406b2a42, 0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b, 0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2, 0x3a6efa74, 0xdd5b4332, 0x6841e7f7, 0xca7820fb, 0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527, 0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b, 0x55a867bc, 0xa1159a58, 0xcca92963, 0x99e1db33, 0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c, 0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3, 0x95c11548, 0xe4c66d22, 0x48c1133f, 0xc70f86dc, 0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17, 0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564, 0x257b7834, 0x602a9c60, 0xdff8e8a3, 0x1f636c1b, 0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115, 0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922, 0x85b2a20e, 0xe6ba0d99, 0xde720c8c, 0x2da2f728, 0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0, 0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e, 0x0a476341, 0x992eff74, 0x3a6f6eab, 0xf4f8fd37, 0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d, 0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804, 0xf1290dc7, 0xcc00ffa3, 0xb5390f92, 0x690fed0b, 0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3, 0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb, 0x37392eb3, 0xcc115979, 0x8026e297, 0xf42e312d, 0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c, 0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350, 0x1a6b1018, 0x11caedfa, 0x3d25bdd8, 0xe2e1c3c9, 0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a, 0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe, 0x9dbc8057, 0xf0f7c086, 0x60787bf8, 0x6003604d, 0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc, 0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f, 0x77a057be, 0xbde8ae24, 0x55464299, 0xbf582e61, 0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2, 0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9, 0x7aeb2661, 0x8b1ddf84, 0x846a0e79, 0x915f95e2, 0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c, 0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e, 0xb77f19b6, 0xe0a9dc09, 0x662d09a1, 0xc4324633, 0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10, 0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169, 0xdcb7da83, 0x573906fe, 0xa1e2ce9b, 0x4fcd7f52, 0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027, 0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5, 0xf0177a28, 0xc0f586e0, 0x006058aa, 0x30dc7d62, 0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634, 0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76, 0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24, 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc, 0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4, 0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c, 0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837, 0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0, 0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b, 0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe, 0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b, 0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4, 0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8, 0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6, 0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304, 0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22, 0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4, 0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6, 0x2826a2f9, 0xa73a3ae1, 0x4ba99586, 0xef5562e9, 0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59, 0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593, 0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, 0x022b8b51, 0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28, 0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c, 0xe029ac71, 0xe019a5e6, 0x47b0acfd, 0xed93fa9b, 0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28, 0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c, 0x15056dd4, 0x88f46dba, 0x03a16125, 0x0564f0bd, 0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a, 0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319, 0x7533d928, 0xb155fdf5, 0x03563482, 0x8aba3cbb, 0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f, 0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991, 0xea7a90c2, 0xfb3e7bce, 0x5121ce64, 0x774fbe32, 0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680, 0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166, 0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae, 0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb, 0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5, 0x72eacea8, 0xfa6484bb, 0x8d6612ae, 0xbf3c6f47, 0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370, 0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d, 0x4040cb08, 0x4eb4e2cc, 0x34d2466a, 0x0115af84, 0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048, 0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8, 0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd, 0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9, 0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7, 0x1a908749, 0xd44fbd9a, 0xd0dadecb, 0xd50ada38, 0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f, 0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c, 0xbf97222c, 0x15e6fc2a, 0x0f91fc71, 0x9b941525, 0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1, 0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442, 0xe0ec6e0e, 0x1698db3b, 0x4c98a0be, 0x3278e964, 0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e, 0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8, 0xdf359f8d, 0x9b992f2e, 0xe60b6f47, 0x0fe3f11d, 0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f, 0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299, 0xf523f357, 0xa6327623, 0x93a83531, 0x56cccd02, 0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc, 0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614, 0xe6c6c7bd, 0x327a140a, 0x45e1d006, 0xc3f27b9a, 0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6, 0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b, 0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0, 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060, 0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e, 0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9, 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f, 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6, }; ================================================ FILE: Bundles/Echoware/rfbserver.cpp ================================================ /* * rfbserver.cpp * Echoware * * Created by admin on 2/15/07. * Copyright 2007 __MyCompanyName__. All rights reserved. * */ #include "rfbserver.h" ================================================ FILE: Bundles/Echoware/rfbserver.h ================================================ /* * rfbserver.h * Echoware * * Created by admin on 2/15/07. * Copyright 2007 __MyCompanyName__. All rights reserved. * */ // This structure represents the entire state of the RFB server // We use it for passing off to the bundles //#include #include #include #include #include #include #include #include #include #include #include #include #include typedef struct rfbserver { int vncServer; char *desktopName; int rfbPort; int rfbLocalhostOnly; pthread_mutex_t listenerAccepting; pthread_cond_t listenerGotNewClient; CGKeyCode *keyTable; unsigned char *keyTableMods; int *pressModsForKeys; } rfbserver; ================================================ FILE: Bundles/Echoware/stdafx.cpp ================================================ // stdafx.cpp : source file that includes just the standard includes // Echoware.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" // TODO: reference any additional headers you need in STDAFX.H // and not in this file ================================================ FILE: Bundles/Echoware/stdafx.h ================================================ #ifndef _STDAFX_H #define _STDAFX_H #if _MSC_VER > 1000 #pragma once #endif #define WIN32_LEAN_AND_MEAN //#include #include "globals.h" #endif ================================================ FILE: Bundles/Echoware/version.plist ================================================ BuildVersion 12 CFBundleVersion 1.0 ProductBuildVersion 7K571 ProjectName DevToolsWizardTemplates SourceVersion 3870000 ================================================ FILE: Bundles/Jaguar/JaguarBundle-Info.plist ================================================ CFBundleDevelopmentRegion English CFBundleExecutable ${EXECUTABLE_NAME} CFBundleGetInfoString CFBundleIconFile CFBundleIdentifier com.redstonesoftware.JaguarBundle CFBundleInfoDictionaryVersion 6.0 CFBundleName CFBundlePackageType BNDL CFBundleShortVersionString CFBundleSignature ???? CFBundleVersion 1.0 NSPrincipalClass JaguarExtensions ================================================ FILE: Bundles/Jaguar/JaguarExtensions.h ================================================ // // JaguarExtensions.h // OSXvnc // // Created by Jonathan Gillaspie on Fri Jul 11 2003. // Copyright (c) 2003 RedstoneSoftware. All rights reserved. // #import #import #import "RFBBundleProtocol.h" #import "VNCBundle.h" @interface JaguarExtensions : VNCBundle { } + (void) registerRendezvous; @end @interface RendezvousDelegate : NSObject @end ================================================ FILE: Bundles/Jaguar/JaguarExtensions.m ================================================ // // JaguarExtensions.m // OSXvnc // // Created by Jonathan Gillaspie on Fri Jul 11 2003. // Copyright (c) 2003 RedstoneSoftware, Inc. All rights reserved. #import "JaguarExtensions.h" #import #import #import #include "keysymdef.h" #include "kbdptr.h" #include #include #include #include #include #include #include #include #include "rfb.h" #import "rfbserver.h" #import "VNCServer.h" #import "../RFBBundleProtocol.h" @implementation JaguarExtensions static NSNetService *rfbService; static NSNetService *vncService; static BOOL keyboardLoading = FALSE; static KeyboardLayoutRef loadedKeyboardRef; static BOOL useIP6 = TRUE; static BOOL listenerFinished = FALSE; rfbserver *theServer; + (void) loadGUI { // ProcessSerialNumber psn = { 0, kCurrentProcess }; // OSStatus returnCode = TransformProcessType(& psn, kProcessTransformToForegroundApplication); // returnCode = SetFrontProcess(& psn ); // if( returnCode != 0) { // NSLog(@"Could not bring the application to front. Error %d", returnCode); // } //[[NSApplication sharedApplication] activateIgnoringOtherApps: YES]; } + (void) rfbStartup: (rfbserver *) aServer { [[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys: @"NO", @"keyboardLoading", // allows OSXvnc to look at the users selected keyboard and map keystrokes using it @"YES", @"pressModsForKeys", // If OSXvnc finds the key you want it will temporarily toggle the modifier keys to produce it [NSArray arrayWithObjects:[NSNumber numberWithInt:kUCKeyActionDisplay], [NSNumber numberWithInt:kUCKeyActionAutoKey], nil], @"KeyStates", // Key States to review to find KeyCodes //[NSNumber numberWithInt:kUCKeyActionDisplay], [NSNumber numberWithInt:kUCKeyActionDown], nil], nil]]; theServer = aServer; keyboardLoading = [[NSUserDefaults standardUserDefaults] boolForKey:@"keyboardLoading"]; if (keyboardLoading) { OSErr result; NSLog(@"Keyboard Loading - Enabled"); *(theServer->pressModsForKeys) = [[NSUserDefaults standardUserDefaults] boolForKey:@"pressModsForKeys"]; if (*(theServer->pressModsForKeys)) NSLog(@"Press Modifiers For Keys - Enabled"); else NSLog(@"Press Modifiers For Keys - Disabled"); result = KLGetCurrentKeyboardLayout(&loadedKeyboardRef); if (result == noErr) [self loadKeyboard:loadedKeyboardRef forServer: theServer]; else NSLog(@"Error (%u) unabled to load current keyboard layout", result); } if ([[[NSProcessInfo processInfo] arguments] indexOfObject:@"-ipv4"] != NSNotFound) { useIP6 = FALSE; } } + (void) rfbUsage { printf( "\nJAGUAR BUNDLE OPTIONS (10.2+):\n" "-keyboardLoading flag This feature allows OSXvnc to look at the users selected keyboard and map keystrokes using it.\n" " Disabling this returns OSXvnc to standard (U.S. Keyboard) which will work better with Dead Keys.\n" " (default: no), 10.2+ ONLY\n" "-pressModsForKeys flag If OSXvnc finds the key you want it will temporarily toggle the modifier keys to produce it.\n" " This flag works well if you have different keyboards on the local and remote machines.\n" " Only works if -keyboardLoading is on\n" " (default: yes), 10.2+ ONLY\n" "-bonjour flag Allow OSXvnc to advertise VNC server using Bonjour discovery services.\n" " 'VNC' will enable the service named VNC (For Eggplant & Chicken 2.02b)\n" " 'Both' or '2' will enable the services named RFB and VNC\n" " (default: RFB:YES VNC:NO), 10.2+ ONLY\n" "-ipv4 Listen For Connections on IPv4 ONLY (Default: Off). 10.2+ ONLY\n" "-ipv6 Listen For Connections on IPv6 ONLY (Default: Off). 10.2+ ONLY\n" ); } + (void) rfbRunning { [JaguarExtensions registerRendezvous]; if (useIP6) { [NSThread detachNewThreadSelector:@selector(setupIPv6:) toTarget:self withObject:nil]; // Wait for the IP6 to bind, if it binds later it confuses the IPv4 binding into allowing others on the port while (!listenerFinished) usleep(1000); } } + (void) setupIPv6: argument { int listen_fd6=0, client_fd=0; int value=1; // Need to pass a ptr to this struct sockaddr_in6 sin6, peer6; unsigned int len6=sizeof(sin6); bzero(&sin6, sizeof(sin6)); sin6.sin6_len = sizeof(sin6); sin6.sin6_family = AF_INET6; sin6.sin6_port = htons(theServer->rfbPort); if (theServer->rfbLocalhostOnly) sin6.sin6_addr = in6addr_loopback; else sin6.sin6_addr = in6addr_any; if ((listen_fd6 = socket(PF_INET6, SOCK_STREAM, 0)) < 0) { NSLog(@"IPv6: Unable to open socket"); } /* else if (fcntl(listen_fd6, F_SETFL, O_NONBLOCK) < 0) { NSLog(@"IPv6: fcntl O_NONBLOCK failed"); } */ else if (setsockopt(listen_fd6, SOL_SOCKET, SO_REUSEADDR, &value, sizeof(value)) < 0) { NSLog(@"IPv6: setsockopt SO_REUSEADDR failed"); } else if (bind(listen_fd6, (struct sockaddr *) &sin6, len6) < 0) { NSLog(@"IPv6: Failed to bind socket: port %d may be in use by another VNC", theServer->rfbPort); } else if (listen(listen_fd6, 5) < 0) { NSLog(@"IPv6: Listen failed"); } else { NSLog(@"Started listener thread on IPv6 port %d", theServer->rfbPort); listenerFinished = TRUE; while ((client_fd = accept(listen_fd6, (struct sockaddr *) &peer6, &len6)) !=-1) { NSAutoreleasePool *pool=[[NSAutoreleasePool alloc] init]; [[NSNotificationCenter defaultCenter] postNotification: [NSNotification notificationWithName:@"NewRFBClient" object:[NSNumber numberWithInt:client_fd]]]; // We have to trigger a signal so the event loop will pickup (if no clients are connected) pthread_cond_signal(&(theServer->listenerGotNewClient)); [pool release]; } NSLog(@"IPv6: Accept failed %d", errno); } listenerFinished = TRUE; return; } + (void) registerRendezvous { BOOL loadRendezvousVNC = NO; BOOL loadRendezvousRFB = YES; int argumentIndex = [[[NSProcessInfo processInfo] arguments] indexOfObject:@"-rendezvous"]; RendezvousDelegate *rendezvousDelegate = [[RendezvousDelegate alloc] init]; if (argumentIndex == NSNotFound) { argumentIndex = [[[NSProcessInfo processInfo] arguments] indexOfObject:@"-bonjour"]; } if (argumentIndex != NSNotFound) { NSString *value = nil; if ([[[NSProcessInfo processInfo] arguments] count] > argumentIndex + 1) value = [[[NSProcessInfo processInfo] arguments] objectAtIndex:argumentIndex+1]; if ([value hasPrefix:@"n"] || [value hasPrefix:@"N"] || [value hasPrefix:@"0"]) { loadRendezvousVNC = NO; loadRendezvousRFB = NO; } else if ([value hasPrefix:@"y"] || [value hasPrefix:@"Y"] || [value hasPrefix:@"1"] || [value hasPrefix:@"rfb"]) { loadRendezvousVNC = NO; loadRendezvousRFB = YES; } else if ([value hasPrefix:@"b"] || [value hasPrefix:@"B"] || [value hasPrefix:@"2"]) { loadRendezvousVNC = YES; loadRendezvousRFB = YES; } else if ([value hasPrefix:@"vnc"]) { loadRendezvousVNC = YES; loadRendezvousRFB = NO; } } // Register For Rendezvous if (loadRendezvousRFB) { rfbService = [[NSNetService alloc] initWithDomain:@"" type:@"_rfb._tcp." name:[NSString stringWithCString:theServer->desktopName] port:(int) theServer->rfbPort]; [rfbService setDelegate:rendezvousDelegate]; [rfbService publish]; } // else // NSLog(@"Bonjour (_rfb._tcp) - Disabled"); if (loadRendezvousVNC) { vncService = [[NSNetService alloc] initWithDomain:@"" type:@"_vnc._tcp." name:[NSString stringWithCString:theServer->desktopName] port:(int) theServer->rfbPort]; [vncService setDelegate:rendezvousDelegate]; [vncService publish]; } // else // NSLog(@"Bonjour (_vnc._tcp) - Disabled"); } + (void) rfbPoll { // Check if keyboardLayoutRef has changed if (keyboardLoading) { KeyboardLayoutRef currentKeyboardLayoutRef; if (KLGetCurrentKeyboardLayout(¤tKeyboardLayoutRef) == noErr) { if (currentKeyboardLayoutRef != loadedKeyboardRef) { loadedKeyboardRef = currentKeyboardLayoutRef; [self loadKeyboard: loadedKeyboardRef forServer:theServer]; } } } } + (void) rfbReceivedClientMessage { return; } + (void) rfbShutdown { NSLog(@"Unloading Jaguar Extensions"); [rfbService stop]; [vncService stop]; } @end @implementation RendezvousDelegate // Sent when the service is about to publish - (void)netServiceWillPublish:(NSNetService *)netService { NSLog(@"Registering Bonjour Service(%@) - %@", [netService type], [netService name]); } // Sent if publication fails - (void)netService:(NSNetService *)netService didNotPublish:(NSDictionary *)errorDict { NSLog(@"An error occurred with service %@.%@.%@, error code = %@", [netService name], [netService type], [netService domain], [errorDict objectForKey:NSNetServicesErrorCode]); } // Sent when the service stops - (void)netServiceDidStop:(NSNetService *)netService { NSLog(@"Disabling Bonjour Service - %@", [netService name]); // You may want to do something here, such as updating a user interfac } @end #include @implementation NSProcessInfo (VNCExtension) - (CGDirectDisplayID) CGMainDisplayID { return CGMainDisplayID(); } @end ================================================ FILE: Bundles/RFBBundleProtocol.h ================================================ // // RFBBundleProtocol.h // OSXvnc // // Created by Jonathan Gillaspie on Fri Aug 22 2003. // Copyright (c) 2003 RedstoneSoftware. All rights reserved. // #import "rfbserver.h" // These work on the class but they aren't defined anywhere @interface NSObject (ClassPerform) + performSelector:(SEL) aSelector; + performSelector:(SEL) aSelector withObject: (id) anObject; @end @protocol RFBBundleProtocol + (void) rfbUsage; /* Print stuff to stderr if you want to add usage information */ + (void) rfbStartup: (rfbserver *) theServer; /* This method is called during startup and should display with NSLog some information about the Bundle */ /* You can use NSProcessInfo to get access to the startup arguments */ + (void) rfbRunning; /* This method is called after all of the core services are started -- immediately before listening for connects */ + (void) rfbPoll; /* This method is called during each check the VNC system does for screen updates, etc. */ + (void) rfbReceivedClientMessage; /* This method is called immediately as each event is received */ + (void) rfbShutdown; /* This method is called when we go to shutdown the server */ @end @interface NSProcessInfo (VNCExtension) - (CGDirectDisplayID) CGMainDisplayID; @end ================================================ FILE: Bundles/Tiger/TigerBundle-Info.plist ================================================ CFBundleDevelopmentRegion English CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier com.redstonesoftware.TigerBundle CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType BNDL CFBundleSignature ???? CFBundleVersion 1.0 NSPrincipalClass TigerExtensions LSMinimumSystemVersion 10.4 ================================================ FILE: Bundles/Tiger/TigerExtensions.h ================================================ // // TigerExtensions.h // OSXvnc // // Created by Jonathan Gillaspie on Fri Jul 11 2003. // Copyright (c) 2003 RedstoneSoftware. All rights reserved. // #import #import #import "RFBBundleProtocol.h" #import "rfb.h" @interface TigerExtensions : VNCBundle { } + (void) systemServerShouldQuit: (NSNotification *) aNotification; + (void) systemServerShouldContinue: (NSNotification *) aNotification; + (void) loadUnicodeKeyboard; - (void) handleKeyboard:(Bool) down forSym: (KeySym) keySym forClient: (rfbClientPtr) cl; - (void) setKeyModifiers: (CGEventFlags) modifierFlags; - (BOOL) checkModiferState; - (void) sendKeyEvent: (CGKeyCode) keyCode down: (BOOL) down modifiers: (CGEventFlags) modifiersToSend; @end ================================================ FILE: Bundles/Tiger/TigerExtensions.m ================================================ // // TigerExtensions.m // OSXvnc // // Created by Jonathan Gillaspie on Fri Jul 11 2003. // Copyright (c) 2003 RedstoneSoftware, Inc. All rights reserved. #import "JaguarExtensions.h" #import "TigerExtensions.h" #import #import #import #import #include "keysymdef.h" #include "kbdptr.h" #include "rfb.h" #include "rfbserver.h" #import "VNCServer.h" #import "../RFBBundleProtocol.h" static BOOL readyToStartup = TRUE; static BOOL dynamicKeyboard = FALSE; static CGEventSourceRef vncSourceRef=NULL; static CGEventTapLocation vncTapLocation=0; static TISInputSourceRef unicodeInputSource=NULL; static TISInputSourceRef currentInputSource=NULL; // Current Modifiers reflect the "global" state of the modifier keys (not a particular VNC connection) // This only matters for event taps. Ideally we could detect their values but // that seems to require an active event loop. static CGEventFlags currentModifiers; // These correspond to the keycodes of the keys 0-9,A-F static unsigned char unicodeNumbersToKeyCodes[16] = { 29, 18, 19, 20, 21, 23, 22, 26, 28, 25, 0, 11, 8, 2, 14, 3 }; #ifndef NSAppKitVersionNumber10_3 #define NSAppKitVersionNumber10_3 743 #endif #ifndef NSAppKitVersionNumber10_4 #define NSAppKitVersionNumber10_4 824 #endif @implementation TigerExtensions void SyncSetKeyboardLayout (TISInputSourceRef inputSource); bool isConsoleSession(); // The Keycodes to various modifiers on the current keyboard CGKeyCode keyCodeShift; CGKeyCode keyCodeOption; CGKeyCode keyCodeControl; CGKeyCode keyCodeCommand; int modifierDelay = 0; rfbserver *theServer; // This routine waits for the window server to register its per-session // services in our session. This code was necessary in various pre-release // versions of Mac OS X 10.5, but it is not necessary on the final version. static void WaitForWindowServerSession(void) { CFDictionaryRef dict; int delay = 100000, maxDelay = 5000000; dict = CGSessionCopyCurrentDictionary(); while (dict == NULL && maxDelay > 0) { usleep(delay); maxDelay -= delay; dict = CGSessionCopyCurrentDictionary(); } if (maxDelay <= 0) NSLog(@"No CG session Available, max delay reached"); if (dict != NULL) CFRelease(dict); } bool isConsoleSession() { BOOL returnValue = FALSE; CFDictionaryRef sessionInfoDict = CGSessionCopyCurrentDictionary(); if (sessionInfoDict == NULL) NSLog(@"Unable to get session dictionary."); else { CFBooleanRef userIsActive = CFDictionaryGetValue(sessionInfoDict, kCGSessionOnConsoleKey); returnValue = CFBooleanGetValue(userIsActive); CFRelease(sessionInfoDict); } // if (0) { // // This one succeeds in "off-screen acounts" also // SecuritySessionId mySession; // SessionAttributeBits sessionInfo; // OSStatus error = SessionGetInfo(callerSecuritySession, &mySession, &sessionInfo); // // returnValue = (sessionInfo & sessionHasGraphicAccess); // } // else if (0) { // // There must be a better way but for now this seems to indicate if we are a console session or not // // at least for logged in users -- it always returns NO for the login window // CGEventSourceRef testRef = CGEventSourceCreate(kCGEventSourceStatePrivate); // int pollDelay = 0; // No poll at this time, just look once // // while (!testRef && pollDelay) { // usleep(100000); // pollDelay -= 100000; // testRef = CGEventSourceCreate(kCGEventSourceStatePrivate); // } // // if (testRef != NULL) { // returnValue = TRUE; // CFRelease(testRef); // } // } return returnValue; } + (void) load { if (NSAppKitVersionNumber < NSAppKitVersionNumber10_4) { [NSException raise:@"Tiger (10.4) Required" format:@"Unable to load Tiger Bundle"]; } } + (void) rfbStartup: (rfbserver *) aServer { [[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys: @"NO", @"UnicodeKeyboard", // Load The Unicode Keyboard @"NO", @"DynamicKeyboard", // Try to set the keyboard "as we need it", doesn't work well on Tiger @"-1", @"UnicodeKeyboardIdentifier", // ID of the Unicode Keyboard resource to use (-1 is Apple's) @"2", @"EventSource", // Always private event source so we don't consolidate with existing keys (however HID for the EventTap always does anyhow) @"3", @"EventTap", // Default Event Tap (3=HID for Console User and Session For OffScreen Users) @"5000", @"ModifierDelay", // Delay when shifting modifier keys @"NO", @"SystemServer", nil]]; theServer = aServer; *(id *)(theServer->alternateKeyboardHandler) = [[self alloc] init]; // 10.5 System Server special behavior if (floor(NSAppKitVersionNumber) > floor(NSAppKitVersionNumber10_4) && [[NSUserDefaults standardUserDefaults] boolForKey:@"SystemServer"]) { // On 10.5 we need quit if the user switches out (so we can relinquish the port) if (isConsoleSession()) { [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(systemServerShouldQuit:) name: NSWorkspaceSessionDidResignActiveNotification object:nil]; } // On 10.5 we need to be able to "hold" if we aren't the console session else { [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(systemServerShouldContinue:) name: NSWorkspaceSessionDidBecomeActiveNotification object:nil]; readyToStartup = NO; // Run Loop NSLog(@"System Server for non-console session, pausing until we receive console access"); while (!readyToStartup) { OSStatus resultCode = RunCurrentEventLoop(kEventDurationSecond); //EventTimeout if (resultCode != eventLoopTimedOutErr) { NSLog(@"Received Result: %d during event loop, Shutting Down", resultCode); //rfbShutdown(); exit(0); } } } } modifierDelay = [[NSUserDefaults standardUserDefaults] integerForKey:@"ModifierDelay"]; [self loadUnicodeKeyboard]; } + (void) systemServerShouldQuit: (NSNotification *) aNotification { NSLog(@"User Switched Out, Stopping System Server - %@", [aNotification name]); //rfbShutdown(); exit(0); return; } + (void) systemServerShouldContinue: (NSNotification *) aNotification { NSLog(@"User Switched In, Starting System Server - %@", [aNotification name]); readyToStartup = YES; return; } + (void) rfbRunning { if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DynamicKeyboard"]) dynamicKeyboard = TRUE; // Event Source represents which existing event states should be combined with the incoming events switch ([[NSUserDefaults standardUserDefaults] integerForKey:@"EventSource"]) { case 2: // Doesn't combine with any other sources NSLog(@"Using Private Event Source"); vncSourceRef = CGEventSourceCreate(kCGEventSourceStatePrivate); break; case 1: // Combines with only with other User Session NSLog(@"Using Combined Event Source, WARNING: Doesn't work if we FUS off-screen (10.5.1)"); vncSourceRef = CGEventSourceCreate(kCGEventSourceStateCombinedSessionState); break; case 0: // Combines with Physical Keyboard NSLog(@"Using HID Event Source, WARNING: Doesn't allow keys if we FUS off-screen (10.5.7)"); vncSourceRef = CGEventSourceCreate(kCGEventSourceStateHIDSystemState); break; case 3: // I am pretty sure works similar to the HID default: vncSourceRef = NULL; break; } if (!vncSourceRef) NSLog(@"No Event Source -- Using 10.3 API"); // Event Taps represent at what level of the input manager the events will be interpretted switch ([[NSUserDefaults standardUserDefaults] integerForKey:@"EventTap"]) { case 3: { if (isConsoleSession()) { NSLog(@"Using Smart Event Tap -- HID for console user"); vncTapLocation = kCGHIDEventTap; } else { NSLog(@"Using Smart Event Tap -- Session for off-screen user"); vncTapLocation = kCGSessionEventTap; } [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(userSwitchedIn:) name: NSWorkspaceSessionDidBecomeActiveNotification object:nil]; [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(userSwitchedOut:) name: NSWorkspaceSessionDidResignActiveNotification object:nil]; break; } case 2: NSLog(@"Using Annotated Session Event Tap"); vncTapLocation = kCGAnnotatedSessionEventTap; break; case 1: // At this level will can passed in modifiers // it will ignore physical keyboard state // it will NOT impact physical keyboard state NSLog(@"Using Session Event Tap"); vncTapLocation = kCGSessionEventTap; break; case 0: default: // At this level will ignore passed in modifiers // it will combine with the physical keyboard state (CapsLock, etc) // it WILL impact physical keyboard state NSLog(@"Using HID Event Tap"); vncTapLocation = kCGHIDEventTap; break; } } + (void) loadUnicodeKeyboard { if ([[NSUserDefaults standardUserDefaults] boolForKey:@"UnicodeKeyboard"] && unicodeInputSource == NULL) { // Need to figure out a way to lookup the Unicode Keyboard before this will work // OSStatus result = KLGetKeyboardLayoutWithIdentifier([[NSUserDefaults standardUserDefaults] integerForKey:@"UnicodeKeyboardIdentifier"], &unicodeLayout); // Unicode Keyboard Should load keys from definition (*(theServer->pressModsForKeys) = YES); [self loadKeyboard:unicodeInputSource forServer:theServer]; } } + (void) userSwitchedIn: (NSNotification *) aNotification { NSLog(@"User Switched In, Using HID Tap - %@", [aNotification name]); vncTapLocation = kCGHIDEventTap; return; } + (void) userSwitchedOut: (NSNotification *) aNotification { NSLog(@"User Switched Out, Using Session Tap - %@", [aNotification name]); vncTapLocation = kCGSessionEventTap; return; } + (void) rfbConnect { if (unicodeInputSource != NULL && !dynamicKeyboard) { currentInputSource = TISCopyCurrentKeyboardInputSource(); // Switch to Unicode Keyboard SyncSetKeyboardLayout(unicodeInputSource); } } + (void) rfbDisconnect { if (unicodeInputSource != NULL && !dynamicKeyboard) { // Switch to Old Keyboard SyncSetKeyboardLayout(currentInputSource); } } + (void) rfbUsage { fprintf(stderr, "\nTiger BUNDLE OPTIONS (10.4+):\n" ); } + (void) rfbPoll { if (0 && vncTapLocation == kCGHIDEventTap) { CGEventFlags newModifiers = 0; if (CGEventSourceKeyState(kCGEventSourceStateHIDSystemState,keyCodeShift)) newModifiers |= kCGEventFlagMaskShift; if (CGEventSourceKeyState(kCGEventSourceStateHIDSystemState,keyCodeOption)) newModifiers |= kCGEventFlagMaskAlternate; if (CGEventSourceKeyState(kCGEventSourceStateHIDSystemState,keyCodeControl)) newModifiers |= kCGEventFlagMaskControl; if (CGEventSourceKeyState(kCGEventSourceStateHIDSystemState,keyCodeCommand)) newModifiers |= kCGEventFlagMaskControl; currentModifiers = newModifiers; } return; } + (void) rfbReceivedClientMessage { return; } + (void) rfbShutdown { NSLog(@"Unloading Tiger Extensions"); } // Keyboard handling code - (void) handleKeyboard:(Bool) down forSym: (KeySym) keySym forClient: (rfbClientPtr) cl { CGKeyCode keyCode = theServer->keyTable[(unsigned short)keySym]; CGEventFlags modifiersToSend = 0; if (1) { // Find the right keycodes base on the loaded keyboard keyCodeShift = theServer->keyTable[XK_Shift_L]; keyCodeOption = theServer->keyTable[XK_Meta_L]; keyCodeControl = theServer->keyTable[XK_Control_L]; keyCodeCommand = theServer->keyTable[XK_Alt_L]; } // If we can't locate the keycode then we will use the special OPTION+4 HEX coding that is available on the Unicode HexInput Keyboard if (keyCode == 0xFFFF) { if (down && unicodeInputSource != NULL) { CGKeyCode keyCodeMeta = 58; // KeyCode for the Option key with the Unicode Hex input keyboard unsigned short mask=0xF000; int rightShift; CGEventFlags oldModifiers = currentModifiers; // Switch to Unicode Keyboard if (dynamicKeyboard) { currentInputSource = TISCopyCurrentKeyboardInputSource(); SyncSetKeyboardLayout(unicodeInputSource); } modifiersToSend = kCGEventFlagMaskAlternate | kCGEventFlagMaskNonCoalesced; [self setKeyModifiers: modifiersToSend]; for (rightShift = 12; rightShift >= 0; rightShift-=4) { short unidigit = (keySym & mask) >> rightShift; [self sendKeyEvent:unicodeNumbersToKeyCodes[unidigit] down:1 modifiers:modifiersToSend]; [self sendKeyEvent:unicodeNumbersToKeyCodes[unidigit] down:0 modifiers:modifiersToSend]; mask >>= 4; } [self setKeyModifiers: oldModifiers]; // Switch to Old Keyboard if (dynamicKeyboard) SyncSetKeyboardLayout(currentInputSource); } } else { BOOL isModifierKey = (XK_Shift_L <= keySym && keySym <= XK_Hyper_R); if (isModifierKey) { // Mark the key state for the client, we'll release down keys later cl->modiferKeys[keyCode] = down; // Record them in our "currentModifiers" switch (keySym) { case XK_Shift_L: case XK_Shift_R: if (down) currentModifiers |= kCGEventFlagMaskShift; else currentModifiers &= ~kCGEventFlagMaskShift; break; case XK_Control_L: case XK_Control_R: if (down) currentModifiers |= kCGEventFlagMaskControl; else currentModifiers &= ~kCGEventFlagMaskControl; break; case XK_Meta_L: case XK_Meta_R: if (down) currentModifiers |= kCGEventFlagMaskAlternate; else currentModifiers &= ~kCGEventFlagMaskAlternate; break; case XK_Alt_L: case XK_Alt_R: if (down) currentModifiers |= kCGEventFlagMaskCommand; else currentModifiers &= ~kCGEventFlagMaskCommand; break; } [self sendKeyEvent:keyCode down:down modifiers:currentModifiers]; } else { if (*(theServer->pressModsForKeys)) { if (theServer->keyTableMods[keySym] != 0xFF) { // Setup the state of the appropriate keys based on the value in the KeyTableMods CGEventFlags oldModifiers = currentModifiers; CGEventFlags modifiersToSend = kCGEventFlagMaskNonCoalesced; if ((theServer->keyTableMods[keySym] << 8) & shiftKey) modifiersToSend |= kCGEventFlagMaskShift; if ((theServer->keyTableMods[keySym] << 8) & optionKey) modifiersToSend |= kCGEventFlagMaskAlternate; if ((theServer->keyTableMods[keySym] << 8) & controlKey) modifiersToSend |= kCGEventFlagMaskControl; // Treat command key separately (not as part of the generation string) modifiersToSend |= (currentModifiers & kCGEventFlagMaskCommand); [self setKeyModifiers: modifiersToSend]; [self sendKeyEvent:keyCode down:down modifiers:modifiersToSend]; // Back to current depressed state [self setKeyModifiers: oldModifiers]; } else { // Not Modified (special keys, other modifiers) [self sendKeyEvent:keyCode down:down modifiers:currentModifiers]; } } else { CGEventFlags oldModifiers = currentModifiers; CGEventFlags modifiersToSend = kCGEventFlagMaskNonCoalesced | (cl->modiferKeys[keyCodeShift] ? kCGEventFlagMaskShift : 0) | (cl->modiferKeys[keyCodeControl] ? kCGEventFlagMaskControl : 0) | (cl->modiferKeys[keyCodeOption] ? kCGEventFlagMaskAlternate : 0) | (cl->modiferKeys[keyCodeCommand] ? kCGEventFlagMaskCommand : 0); [self setKeyModifiers: modifiersToSend]; [self sendKeyEvent:keyCode down:down modifiers:modifiersToSend]; [self setKeyModifiers: oldModifiers]; } } } } - (void) setKeyModifiers: (CGEventFlags) modifierFlags { // If it's a session tap (and we have an event source) then we can specify our own modifiers as part of the event (nothing to do here) // Otherwise we will have to explicitly twiddle them at the HID level based on their current state if (vncTapLocation == kCGHIDEventTap || !vncSourceRef) { CGEventRef event = nil; // Toggle the state of the appropriate keys if ((currentModifiers & kCGEventFlagMaskCommand) != (modifierFlags & kCGEventFlagMaskCommand)) { [self sendKeyEvent:keyCodeCommand down:((modifierFlags & kCGEventFlagMaskCommand) != 0) modifiers:0]; } if ((currentModifiers & kCGEventFlagMaskShift) != (modifierFlags & kCGEventFlagMaskShift)) { [self sendKeyEvent:keyCodeShift down:((modifierFlags & kCGEventFlagMaskShift) != 0) modifiers:0]; } if ((currentModifiers & kCGEventFlagMaskAlternate) != (modifierFlags & kCGEventFlagMaskAlternate)) { [self sendKeyEvent:keyCodeOption down:((modifierFlags & kCGEventFlagMaskAlternate) != 0) modifiers:0]; } if ((currentModifiers & kCGEventFlagMaskControl) != (modifierFlags & kCGEventFlagMaskControl)) { [self sendKeyEvent:keyCodeControl down:((modifierFlags & kCGEventFlagMaskControl) != 0) modifiers:0]; } if (modifierDelay) usleep(modifierDelay); } currentModifiers = modifierFlags; } - (BOOL) checkModiferState { CGEventFlags actualFlags = CGEventSourceFlagsState(CGEventSourceGetSourceStateID(vncSourceRef)); BOOL match = YES; if ((actualFlags & kCGEventFlagMaskCommand) != (currentModifiers & kCGEventFlagMaskCommand) || (actualFlags & kCGEventFlagMaskShift) != (currentModifiers & kCGEventFlagMaskShift) || (actualFlags & kCGEventFlagMaskAlternate) != (currentModifiers & kCGEventFlagMaskAlternate) || (actualFlags & kCGEventFlagMaskControl) != (currentModifiers & kCGEventFlagMaskControl)) { match = NO; //NSLog(@"Actual(%0x) did not match Recorded (%0x)", actualFlags & 0xffffffff, currentModifiers & 0xffffffff); } return match; } - (void) sendKeyEvent: (CGKeyCode) keyCode down: (BOOL) down modifiers: (CGEventFlags) modifiersToSend { if (!vncSourceRef) { CGPostKeyboardEvent(0, keyCode, down); } else { CGEventRef event = CGEventCreateKeyboardEvent(vncSourceRef, keyCode, down); // The value of this function escapes me (since you still need to specify the keyCode for it to work // CGEventKeyboardSetUnicodeString (event, 1, (const UniChar *) &keySym); // If it's a session tap then we can specify our own modifiers as part of the event if (vncTapLocation != kCGHIDEventTap) CGEventSetFlags(event, modifiersToSend); CGEventPost(vncTapLocation, event); if (vncTapLocation == kCGHIDEventTap) { int maxWait = 250000; // 1/4 second // NEED TO WAIT UNTIL MODIFIER FLAGS REFLECT THE EXPECTED STATE while ([self checkModiferState] == NO && maxWait > 0) { maxWait -= 10000; usleep(10000); } } CFRelease(event); } } void SyncSetKeyboardLayout (TISInputSourceRef inputSource) { // http://developer.apple.com/library/mac/#documentation/TextFonts/Reference/TextInputSourcesReference/Reference/reference.html if (TISSelectInputSource(inputSource) != noErr) { NSLog(@"Error selecting input source:"); } } //- (void) sendKeyEvent: (NSDictionary *) eventData { // NSDictionary *eventDictionary = [NSDictionary dictionaryWithObjectsAndKeys: // [NSNumber numberWithInt: keyCode], @"keyCode", // [NSNumber numberWithBool:down], @"down", // [NSNumber numberWithLong: modifiersToSend], @"modifierFlags", // nil]; // [self performSelectorOnMainThread:@selector(sendKeyEvent:) withObject:eventDictionary waitUntilDone:YES]; // CGKeyCode keyCode = [[eventData objectForKey:@"keyCode"] intValue]; // BOOL down = [[eventData objectForKey:@"down"] boolValue]; // CGEventFlags localModifierFlags = [[eventData objectForKey:@"modifierFlags"] longValue]; //} @end ================================================ FILE: Bundles/VNCBundle.h ================================================ // // VNCBundle.h // OSXvnc // // Created by Jonathan Gillaspie on 3/6/08. // Copyright 2008 __MyCompanyName__. All rights reserved. // #import #import #import "rfbserver.h" @interface VNCBundle : NSObject { } + (void) loadKeyboard: (TISInputSourceRef) keyboardLayoutRef forServer: (rfbserver *) theServer; @end ================================================ FILE: Bundles/VNCBundle.m ================================================ // // VNCBundle.m // OSXvnc // // Created by Jonathan Gillaspie on 3/6/08. // Copyright 2008 __MyCompanyName__. All rights reserved. // #import "VNCBundle.h" #import "keysymdef.h" #import "kbdptr.h" @implementation VNCBundle + (void) initialize { [[NSUserDefaults standardUserDefaults] registerDefaults: [NSDictionary dictionaryWithObjectsAndKeys: [NSArray arrayWithObjects:[NSNumber numberWithInt:kUCKeyActionAutoKey],[NSNumber numberWithInt:kUCKeyActionDisplay],[NSNumber numberWithInt:kUCKeyActionDown], [NSNumber numberWithInt:kUCKeyActionUp], nil], @"KeyStates", // Key States to review to find KeyCodes nil]]; } // Here are the resources we can think about using for Int'l keyboard support // http://developer.apple.com/documentation/Carbon/Reference/KeyboardLayoutServices/ // This will let us determine the current keyboard // KLGetCurrentKeyboardLayout // This will set the current keyboard // KLSetCurrentKeyboardLayout // This will get the Properties of a keyboard (like the key code to char tables) but... // KLGetKeyboardLayoutProperty // UCKeyTranslate - This is the opposite of what we need, if you give it a table and some keyCode (key input) it will tell you what Unicode char (or string) you get // we need the opposite - we want to know what keys to hit to get a given key (or string) // This will use the KeyboardLayoutRef to produce a static table of lookups // By iterating through all possible KeyCodes + (void) loadKeyboard: (TISInputSourceRef) inputSource forServer: (rfbserver *) theServer{ int i, j; UCKeyboardLayout *uchrHandle = NULL; CFStringRef keyboardName; static UInt32 modifierKeyStates[] = {0, shiftKey, optionKey, controlKey, optionKey | shiftKey, optionKey | controlKey, controlKey | shiftKey, optionKey | shiftKey | controlKey}; UInt32 modifierKeyState = 0; NSArray *keyStates = [[NSUserDefaults standardUserDefaults] arrayForKey:@"KeyStates"]; /* modifiers */ //cmdKey = 1 << cmdKeyBit, //shiftKey = 1 << shiftKeyBit, //alphaLock = 1 << alphaLockBit, //optionKey = 1 << optionKeyBit, //controlKey = 1 << controlKeyBit, // KLGetKeyboardLayoutProperty is 10.2 only how do I access these resources in early versions? if (inputSource) { keyboardName = (CFStringRef) TISGetInputSourceProperty(inputSource, kTISPropertyLocalizedName); NSLog(@"Keyboard detected: %@ - loading keys", keyboardName); uchrHandle = (CFDataRef) TISGetInputSourceProperty(inputSource, kTISPropertyUnicodeKeyLayoutData); } // Initialize them all to 0xFFFF memset(theServer->keyTable, 0xFF, keyTableSize * sizeof(CGKeyCode)); memset(theServer->keyTableMods, 0xFF, keyTableSize * sizeof(unsigned char)); if (uchrHandle) { // Ok - we could get the LIST of Modifier Key States out of the Keyboard Layout // some of them are duplicates so we need to compare them, then we'll iterate through them in reverse order // UCKeyModifiersToTableNum = ; EventRecord // This layout gets a little harry UInt16 keyCode; UInt32 keyboardType = LMGetKbdType(); UInt32 deadKeyState = 0; UniCharCount actualStringLength; UniChar unicodeChar[255]; // Iterate Over Each Modifier Keyset for (i=0; i < (sizeof(modifierKeyStates) / sizeof(UInt32)); i++) { modifierKeyState = (modifierKeyStates[i] >> 8) & 0xFF; //NSLog(@"Loading Keys For Modifer State: %#04x", modifierKeyState); // Iterate Over Each Key Code for (keyCode = 0; keyCode < 255; keyCode++) { for (j=0; j < [keyStates count]; j++) { int keyActionState = [[keyStates objectAtIndex:j] intValue]; OSStatus resultCode = UCKeyTranslate (uchrHandle, keyCode, keyActionState, modifierKeyState, keyboardType, kUCKeyTranslateNoDeadKeysBit, &deadKeyState, 255, // Only 1 key allowed due to VNC behavior &actualStringLength, unicodeChar); if (resultCode == noErr) { if (actualStringLength > 1) { NSLog(@"Multiple Characters For %d (%#04x): %S", keyCode, modifierKeyState, unicodeChar); //unicodeChar[0] = unicodeChar[actualStringLength-1]; } else { // We'll use the FIRST keyCode that we find for that UNICODE character if (theServer->keyTable[unicodeChar[0]] == 0xFFFF) { theServer->keyTable[unicodeChar[0]] = keyCode; theServer->keyTableMods[unicodeChar[0]] = modifierKeyState; } } } else { NSLog(@"Error Translating %d (%#04x): %d", keyCode, modifierKeyState, resultCode); } } } } } else { // This is the old US only keyboard mapping // Map the above key table into a static array so we can just look them up directly NSLog(@"Unable to determine key map - reverting to US mapping"); for (i = 0; i < (sizeof(USKeyCodes) / sizeof(int)); i += 2) theServer->keyTable[(unsigned short)USKeyCodes[i]] = (CGKeyCode) USKeyCodes[i+1]; } // This is the old SpecialKeyCodes keyboard mapping // Map the above key table into a static array so we can just look them up directly NSLog(@"Loading %d XKeysym special keys", (sizeof(SpecialKeyCodes) / sizeof(int))/2); for (i = 0; i < (sizeof(SpecialKeyCodes) / sizeof(int)); i += 2) { theServer->keyTable[(unsigned short)SpecialKeyCodes[i]] = (CGKeyCode) SpecialKeyCodes[i+1]; } } @end ================================================ FILE: English.lproj/MainMenu.nib/classes.nib ================================================ IBClasses ACTIONS cancelConnectHost id changeAuthenticationType id changeDisplayName id changeDisplayNumber id changePassword id changePort id changeSharing id changeSystemServerAuthentication id changeSystemServerPort id connectHost id installAsService id loadUserDefaults id openFile id openFirewall id openGPL id openLog id openReleaseNotes id optionChanged id removeService id reverseConnection id saveUserDefaults id setInitialAuthentication id startServer id stopServer id terminateRequest id validateInitialAuthentication id CLASS VNCController LANGUAGE ObjC OUTLETS allowDimmingCheckbox NSButton allowRendezvousCheckbox NSButton allowScreenSaverCheckbox NSButton allowSleepCheckbox NSButton authenticationType NSMatrix connectHost NSTextField connectPort NSTextField disableRemoteEventsCheckbox NSButton disableRichClipboardCheckbox NSButton disableStartupButton NSButton displayNameField NSTextField displayNumText NSTextField displayNumberField NSPopUpButton dontDisconnectCheckbox NSButton eventSourcePopup NSPopUpButton hostNamesBox NSBox hostNamesField NSTextField initialAuthenticationType NSMatrix initialDoneButton NSButton initialPasswordText NSTextField initialWindow NSWindow ipAddressesBox NSBox ipAddressesView NSMatrix keyboardEvents NSPopUpButton keyboardLayout NSPopUpButton limitToLocalConnections NSButton openGLCheckbox NSButton optionsTabView NSTabView otherArguments NSTextField passwordField NSTextField portField NSTextField portNumText NSTextField preferenceWindow NSWindow preferencesMessageTestField NSTextField protocolVersion NSPopUpButton reverseConnectionMessageField NSTextField reverseConnectionWindow NSWindow serverKeepAliveCheckbox NSButton serverMenuItem NSMenuItem setStartupButton NSButton sharingMatrix NSMatrix startServerButton NSButton startServerMenuItem NSMenuItem startServerOnLaunchCheckbox NSButton startupItemStatusMessageField NSTextField statusMessageField NSTextView statusWindow NSWindow stopServerButton NSButton stopServerMenuItem NSMenuItem swapMouseButtonsCheckbox NSButton systemServerAuthenticationType NSMatrix systemServerDisplayNameField NSTextField systemServerDisplayNumberField NSPopUpButton systemServerLimitToLocalConnections NSButton systemServerMenu NSMenuItem systemServerPasswordField NSTextField systemServerPortField NSTextField systemServerWindow NSWindow terminateOnFastUserSwitch NSButton SUPERCLASS NSObject CLASS NSObject LANGUAGE ObjC ACTIONS id optionChanged id CLASS FirstResponder LANGUAGE ObjC SUPERCLASS NSObject IBVersion 1 ================================================ FILE: English.lproj/MainMenu.nib/info.nib ================================================ IBFramework Version 680 IBLastKnownRelativeProjectPath ../../OSXvnc.xcodeproj IBOldestOS 5 IBOpenObjects 627 923 IBSystem Version 11D50b targetFramework IBCocoaFramework ================================================ FILE: French.lproj/Credits.rtf ================================================ {\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf100 {\fonttbl\f0\fswiss\fcharset77 Helvetica;\f1\froman\fcharset77 Times-Roman;} {\colortbl;\red255\green255\blue255;\red26\green26\blue255;\red0\green0\blue255;} \vieww9000\viewh9000\viewkind0 \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f0\fs24 \cf0 Pour des informations et de l'aide sur OSXvnc, rendez-vous sur\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f1 \cf0 \f0 \cf2 \ul \ulc2 http://www.redstonesoftware.com/osxvnc \f1 \cf0 \ulnone \ \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f0 \cf0 Copyright \'a9 2002-2005 Redstone Software\ Jonathan Gillaspie\ Doug Simons\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f1 \cf0 \f0 \cf2 \ul osxvnc@redstonesoftware.com \f1 \cf0 \ulnone \ \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f0 \cf0 Copyright \'a9 2002 Mahmud Haque\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f1 \cf0 \f0 \cf2 \ul mahmud@bcm.tmc.edu \f1 \cf0 \ulnone \ \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f0 \cf0 Copyright \'a9 2001 Dan McGuirk\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f1 \cf0 \f0 \cf2 \ul mcguirk@incompleteness.net \f1 \cf0 \ulnone \ \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f0 \cf0 Traduction licence GNU GPL\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf2 \ul http://www.linux-france.org/article/these\cf0 \ulnone \ \ Remerciements particuliers pour la fonction "Server Side Scaling" \'88 : \ Noriaki Yamazaki\ Administrator of micro-VNC\ Hitachi System & Service, Ltd.\ \ Remerciements particuliers pour la fonction "Reverse Connections" \'88 : \ Mark Lentczner\ \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 Zlib, ZlibHex and Tight encodings:\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 Mahmud Haque\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 Autres Contributeurs:\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f1 \cf0 \f0 David Johnson \f1 \ \f0 Steven Tamm\ Mihai Parparita\ \ Traduction fran\'8daise:\ Pascal Frey\ \ Traduction Japonaise:\ Aaron Madlon-Kay \f1 \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f0 \cf0 \ Ic\'99nes par Martin Goneau \ \cf2 \ul http://www.goneau.com\cf0 \ulnone \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf2 \ul \ulc3 \ \cf0 \ulnone ----------------------------------------------------\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 \ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\ \ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\ \ You should have received a copy of the GNU General Public License along with this program; if not, write to:\ \ Free Software Foundation, Inc.\ 59 Temple Place - Suite 330\ Boston, MA 02111-1307\ USA\ } ================================================ FILE: French.lproj/MainMenu.nib/classes.nib ================================================ { IBClasses = ( { ACTIONS = {optionChanged = id; }; CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, { ACTIONS = { changeDisplayName = id; changeDisplayNumber = id; changePassword = id; changePort = id; changeSharing = id; connectHost = id; installAsService = id; loadUserDefaults = id; openFile = id; openGPL = id; openLog = id; openReleaseNotes = id; optionChanged = id; removeService = id; saveUserDefaults = id; startServer = id; stopServer = id; }; CLASS = VNCController; LANGUAGE = ObjC; OUTLETS = { allowDimmingCheckbox = NSButton; allowKeyboardLoading = NSButton; allowPressModsForKeys = NSButton; allowRendezvousCheckbox = NSButton; allowScreenSaverCheckbox = NSButton; allowSleepCheckbox = NSButton; connectHost = NSTextField; connectPort = NSTextField; disableRemoteEventsCheckbox = NSButton; disableRichClipboardCheckbox = NSButton; disableStartupButton = NSButton; displayNameField = NSTextField; displayNumberField = NSPopUpButton; dontDisconnectCheckbox = NSButton; hostNamesField = NSTextField; hostNamesLabel = NSTextField; ipAddressesField = NSTextField; ipAddressesLabel = NSTextField; limitToLocalConnections = NSButton; optionsTabView = NSTabView; otherArguments = NSTextField; passwordField = NSTextField; portField = NSTextField; protocolVersion = NSPopUpButton; serverKeepAliveCheckbox = NSButton; setStartupButton = NSButton; sharingMatrix = NSMatrix; startServerButton = NSButton; startServerMenuItem = NSMenuItem; startServerOnLaunchCheckbox = NSButton; startupItemStatusMessageField = NSTextField; statusMessageField = NSTextField; stopServerButton = NSButton; stopServerMenuItem = NSMenuItem; swapMouseButtonsCheckbox = NSButton; terminateOnFastUserSwitch = NSButton; window = NSWindow; }; SUPERCLASS = NSObject; } ); IBVersion = 1; } ================================================ FILE: French.lproj/MainMenu.nib/info.nib ================================================ IBDocumentLocation 336 328 356 240 0 0 1920 1178 IBEditorPositions 29 141 1134 319 44 0 0 1920 1178 404 800 835 192 99 0 0 1920 1178 IBFramework Version 446.1 IBOpenObjects 21 29 IBSystem Version 8L2127 ================================================ FILE: German.lproj/Credits.rtf ================================================ {\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf410 {\fonttbl\f0\fswiss\fcharset77 Helvetica;\f1\froman\fcharset77 Times-Roman;} {\colortbl;\red255\green255\blue255;\red26\green26\blue255;} \vieww12080\viewh19640\viewkind0 \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f0\fs24 \cf0 F\'9fr Informationen und Hilfe \'9fber OSXvnc:\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f1 \cf0 \f0 \cf2 \ul \ulc2 http://www.redstonesoftware.com/osxvnc \f1 \cf0 \ulnone \ \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f0 \cf0 Copyright \'a9 2002-2005 Redstone Software\ Jonathan Gillaspie\ Doug Simons\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f1 \cf0 \f0 \cf2 \ul osxvnc@redstonesoftware.com \f1 \cf0 \ulnone \ \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f0 \cf0 Copyright \'a9 2002 Mahmud Haque\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f1 \cf0 \f0 \cf2 \ul mahmud@bcm.tmc.edu \f1 \cf0 \ulnone \ \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f0 \cf0 Copyright \'a9 2001 Dan McGuirk\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f1 \cf0 \f0 \cf2 \ul mcguirk@incompleteness.net \f1 \cf0 \ulnone \ \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f0 \cf0 GNU GPL:\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf2 \ul http://www.gnu.org/copyleft/gpl.html\cf0 \ulnone \ \ Spezieller Dank f\'9fr Server basierte Skalierung geht an:\ Noriaki Yamazaki\ Administrator von micro-VNC\ Hitachi System & Service, Ltd.\ \ Spezieller Dank f\'9fr r\'9fckw\'8artige Verbindungen geht an:\ Mark Lentczner\ \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 Zlib, ZlibHex and Tight Kodierungen:\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 Mahmud Haque\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 Weitere Beteiligungen:\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f1 \cf0 \f0 David Johnson \f1 \ \f0 Steven Tamm\ Mihai Parparita\ \ Franz\'9asische Lokalisierung:\ Pascal Frey\ \ Japanische Lokalisierung:\ Aaron Madlon-Kay\ \ Deutsche Lokalisierung und internationale Tastaturlayouts:\ J\'9arg Mehring\ \ Icons von Martin Goneau \ \cf2 \ul http://www.goneau.com\cf0 \ulnone \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 \ ----------------------------------------------------\ \ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\ \ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\ \ You should have received a copy of the GNU General Public License along with this program; if not, write to:\ \ Free Software Foundation, Inc.\ 59 Temple Place - Suite 330\ Boston, MA 02111-1307\ USA\ } ================================================ FILE: German.lproj/MainMenu.nib/classes.nib ================================================ { IBClasses = ( { ACTIONS = {"" = id; optionChanged = id; }; CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, { ACTIONS = { changeDisplayName = id; changeDisplayNumber = id; changePassword = id; changePort = id; changeSharing = id; connectHost = id; installAsService = id; loadUserDefaults = id; openFile = id; openGPL = id; openLog = id; openReleaseNotes = id; optionChanged = id; removeService = id; saveUserDefaults = id; startServer = id; stopServer = id; }; CLASS = VNCController; LANGUAGE = ObjC; OUTLETS = { allowDimmingCheckbox = NSButton; allowKeyboardLoading = NSButton; allowPressModsForKeys = NSButton; allowRendezvousCheckbox = NSButton; allowScreenSaverCheckbox = NSButton; allowSleepCheckbox = NSButton; connectHost = NSTextField; connectPort = NSTextField; disableRemoteEventsCheckbox = NSButton; disableStartupButton = NSButton; displayNameField = NSTextField; displayNumberField = NSPopUpButton; dontDisconnectCheckbox = NSButton; hostNamesField = NSTextField; hostNamesLabel = NSTextField; ipAddressesField = NSTextField; ipAddressesLabel = NSTextField; limitToLocalConnections = NSButton; optionsTabView = NSTabView; otherArguments = NSTextField; passwordField = NSTextField; portField = NSTextField; protocolVersion = NSPopUpButton; serverKeepAliveCheckbox = NSButton; setStartupButton = NSButton; sharingMatrix = NSMatrix; startServerButton = NSButton; startServerMenuItem = NSMenuItem; startServerOnLaunchCheckbox = NSButton; startupItemStatusMessageField = NSTextField; statusMessageField = NSTextField; stopServerButton = NSButton; stopServerMenuItem = NSMenuItem; swapMouseButtonsCheckbox = NSButton; terminateOnFastUserSwitch = NSButton; window = NSWindow; }; SUPERCLASS = NSObject; } ); IBVersion = 1; } ================================================ FILE: German.lproj/MainMenu.nib/info.nib ================================================ IBDocumentLocation 116 836 356 240 0 0 1920 1178 IBEditorPositions 29 117 1133 279 44 0 0 1920 1178 404 792 835 114 99 0 0 1920 1178 IBFramework Version 443.0 IBOpenObjects 21 404 29 IBSystem Version 8I127 ================================================ FILE: Italian.lproj/Copying.rtf ================================================ {\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf110 {\fonttbl\f0\fswiss\fcharset77 Helvetica;\f1\fswiss\fcharset77 Arial-BoldItalicMT;\f2\fswiss\fcharset77 ArialMT; \f3\fswiss\fcharset77 Helvetica-BoldOblique;} {\colortbl;\red255\green255\blue255;} \margl1440\margr1440\vieww14540\viewh13280\viewkind0 \pard\tx1440\tx2880\tx4320\tx5760\tx7200\qc \f0\fs24 \cf0 GNU GENERAL PUBLIC LICENSE\ Version 2, June 1991\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 \ Copyright (C) 1989, 1991 \ Free Software Foundation, Inc.\ 59 Temple Place - Suite 330\ Boston, MA 02111-1307\ USA.\ \ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc \cf0 Chiunque pu\'98 copiare e distribuire copie letterali di questo documento di licenza, ma non ne \'8f permessa la modifica.\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 \ \pard\pardeftab708\sb240\sa60\qj \f1\i\b \cf0 Preambolo\ \pard\pardeftab708\sb240\qj \f2\i0\b0\fs20 \cf0 Le licenze per la maggioranza dei programmi hanno lo scopo di togliere all'utente la libert\'88 di condividerlo e di modificarlo. Al contrario, la Licenza Pubblica Generica GNU \'8f intesa a garantire la libert\'88 di condividere e modificare il free software, al fine di assicurare che i programmi siano "liberi" per tutti i loro utenti. Questa Licenza si applica alla maggioranza dei programmi della Free Software Foundation e ad ogni altro programma i cui autori hanno scelto questa Licenza. Alcuni altri programmi della Free Software Foundation sono invece coperti dalla Licenza Pubblica Generica per Librerie. Chiunque pu\'98 usare questa Licenza per i propri programmi.\ Quando si parla di "free software", ci si riferisce alla libert\'88, non al prezzo. Le nostre Licenze (la GPL e la LGPL) sono progettate per assicurarsi che ciascuno abbia la libert\'88 di distribuire copie del free software (e farsi pagare per questo, se vuole), che ciascuno riceva il codice sorgente o che lo possa ottenere se lo desidera, che ciascuno possa modificare il programma o usarne delle parti in nuovi programmi "liberi" e che ciascuno sappia di potere fare queste cose.\ Per proteggere i diritti dell'utente, abbiamo bisogno di creare delle restrizioni che vietino a chiunque di negare questi diritti o di chiedere di rinunciarvi. Queste restrizioni si traducono in certe responsabilit\'88 per chi distribuisce copie del software e per chi lo modifica.\ Per esempio, chi distribuisce copie di un Programma coperto da GPL, sia gratis sia in cambio di un compenso, deve dare ai destinatari tutti i diritti che ha ricevuto. Deve anche assicurarsi che i destinatari ricevano o possano ricevere il codice sorgente. E deve mostrar loro queste condizioni di Licenza, in modo che conoscano i loro diritti.\ Proteggiamo i diritti dell'utente in due modi: (1) proteggendo il software con un copyright, e (2) offrendo una Licenza che offre il permesso legale di copiare, distribuire e/o modificare il Programma.\ Infine, per proteggere ogni autore e noi stessi, vogliamo assicurarci che ognuno capisca che non ci sono garanzie per i programmi coperti da GPL. Se il Programma viene modificato da qualcun altro e ridistribuito, vogliamo che gli acquirenti sappiano che ci\'98 che hanno non \'8f l'originale, in modo che ogni problema introdotto da altri non si rifletta sulla reputazione degli autori originari.\ Infine, ogni programma libero \'8f costantemente minacciato dai brevetti sui programmi. Vogliamo evitare il pericolo che chi ridistribuisce un Programma libero ottenga brevetti personali, rendendo perci\'98 il Programma una cosa di sua propriet\'88. Per prevenire questo, abbiamo chiarito che ogni prodotto brevettato debba essere distribuito per il libero uso da parte di chiunque, o non distribuito affatto.\ Seguono i termini e le condizioni precisi per la copia, la distribuzione e la modifica.\ \pard\pardeftab708\sb240\sa60\qj \f1\i\b\fs24 \cf0 Licenza pubblica generica GNU. Termini e condizioni per la copia, la distribuzione e la modifica\ \pard\pardeftab708\sb240\qj \f2\i0\b0\fs20 \cf0 0. Questa Licenza si applica a ogni Programma o altra opera che contenga una nota da parte del detentore del copyright che dica che tale opera pu\'98 distribuita sotto i termini di questa Licenza Pubblica Generica. Il termine "Programma" nel seguito indica ognuno di questi programmi o lavori, e l'espressione "lavoro basato sul Programma" indica sia il Programma sia ogni opera considerata "derivata" in base alla legge sul Copyright: cio\'8f un lavoro contenente il programma o una porzione di esso, sia letteralmente sia modificato e/o tradotto in un'altra lingua; da qui in avanti, la traduzione \'8f in ogni caso considerata una "modifica". Vengono ora elencati i diritti dei detentori di licenza.\ Attivit\'88 diverse dalla copiatura, distribuzione e modifica non sono coperte da questa Licenza e sono al di fuori della sua influenza. L'atto di eseguire il programma non viene limitato, e l'output del programma \'8f coperto da questa Licenza solo se il suo contenuto costituisce un lavoro basato sul Programma (indipendentemente dal fatto che sia stato creato eseguendo il Programma). In base alla natura del Programma il suo output pu\'98 essere o meno coperto da questa Licenza.\ 1. \'e9 lecito copiare e distribuire copie letterali del codice sorgente del Programma cosi` come viene ricevuto, con qualsiasi mezzo, a condizione che venga riprodotta chiaramente su ogni copia una appropriata nota di copyright e di assenza di garanzia; che si mantengano intatti tutti i riferimenti a questa Licenza e all'assenza di ogni garanzia; che si dia a ogni altro destinatario del Programma una copia di questa Licenza insieme al Programma.\ \'e9 possibile richiedere un pagamento per il trasferimento fisico di una copia del Programma, \'8f anche possibile a propria discrezione richiedere un pagamento in cambio di una copertura assicurativa.\ 2. \'e9 lecito modificare la propria copia o copie del Programma, o parte di esso, creando perci\'98 un lavoro basato sul Programma, e copiare o distribuire queste modifiche e questi lavori sotto i termini del precedente punto 1, a patto che anche tutte queste condizioni vengano soddisfatte:\ a) Bisogna indicare chiaramente nei file che si tratta di copie modificate e la data di ogni modifica.\ b) Bisogna fare in modo che ogni lavoro distribuito o pubblicato, che in parte o nella sua totalit\'88 derivi dal Programma o da parti di esso, sia globalmente utilizzabile da terze parti secondo le condizioni di questa licenza.\ c) Se di solito il programma modificato legge comandi interattivamente quando eseguito, bisogna fare in modo che all'inizio dell'esecuzione interattiva usuale, stampi un messaggio contenente una appropriata nota di copyright e di assenza di garanzia (oppure che specifichi il tipo di garanzia che si offre). Il messaggio deve inoltre specificare agli utenti che possono ridistribuire il programma nelle condizioni qui descritte e deve indicare come reperire questa licenza. Se per\'98 il programma di partenza \'8f interattivo ma normalmente non stampa tale messaggio, non occorre che un lavoro derivato lo stampi.\ Questi requisiti si applicano al lavoro modificato nel suo complesso. Se sussistono parti identificabili del lavoro modificato che non siano derivate dal Programma e che possono essere ragionevolmente considerate lavori indipendenti, allora questa Licenza e i suoi termini non si applicano a queste parti quando vengono distribuite separatamente. Se per\'98 queste parti vengono distribuite all'interno di un prodotto che \'8f un lavoro basato sul Programma, la distribuzione di questo prodotto nel suo complesso deve avvenire nei termini di questa Licenza, le cui norme nei confronti di altri utenti si estendono a tutto il prodotto, e quindi ad ogni sua parte, chiunque ne sia l'autore.\ Sia chiaro che non \'8f nelle intenzioni di questa sezione accampare diritti su lavori scritti interamente da altri, l'intento \'8f piuttosto quello di esercitare il diritto di controllare la distribuzione di lavori derivati o dal Programma o contenenti esso.\ Inoltre, se il Programma o un lavoro derivato da esso viene aggregato ad un altro lavoro non derivato dal Programma su di un mezzo di immagazzinamento o di distribuzione, il lavoro non derivato non deve essere coperto da questa licenza.\ 3. \'e9 lecito copiare e distribuire il Programma (o un lavoro basato su di esso, come espresso al punto 2) sotto forma di codice oggetto o eseguibile sotto i termini dei precedenti punti 1 e 2, a patto che si applichi una delle seguenti condizioni:\ a) Il Programma sia corredato dal codice sorgente completo, in una forma leggibile dal calcolatore e tale sorgente deve essere fornito secondo le regole dei precedenti punti 1 e 2 su di un mezzo comunemente usato per lo scambio di programmi.\ b) Il Programma sia accompagnato da un'offerta scritta, valida per almeno tre anni, di fornire a chiunque ne faccia richiesta una copia completa del codice sorgente, in una forma leggibile dal calcolatore, in cambio di un compenso non superiore al costo del trasferimento fisico di tale copia, che deve essere fornita secondo le regole dei precedenti punti 1 e 2 su di un mezzo comunemente usato per lo scambio di programmi.\ c) Il Programma sia accompagnato dalle informazioni che sono state ricevute riguardo alla possibilit\'88 di avere il codice sorgente. Questa alternativa \'8f permessa solo in caso di distribuzioni non commerciali e solo se il programma \'8f stato ricevuto sotto forma di codice oggetto o eseguibile in accordo al precedente punto B.\ Per "codice sorgente completo" di un lavoro si intende la forma preferenziale usata per modificare un lavoro. Per un programma eseguibile, "codice sorgente completo" significa tutto il codice sorgente di tutti i moduli in esso contenuti, pi\'9d ogni file associato che definisca le interfacce esterne del programma, pi\'9d gli script usati per controllare la compilazione e l'installazione dell'eseguibile. In ogni caso non \'8f necessario che il codice sorgente fornito includa nulla che sia normalmente distribuito (in forma sorgente o in formato binario) con i principali componenti del sistema operativo sotto cui viene eseguito il Programma (compilatore, kernel, e cosi` via), a meno che tali componenti accompagnino l'eseguibile.\ Se la distribuzione dell'eseguibile o del codice oggetto \'8f effettuata indicando un luogo dal quale sia possibile copiarlo, permettere la copia del codice sorgente dallo stesso luogo \'8f considerata una valida forma di distribuzione del codice sorgente, anche se copiare il sorgente \'8f facoltativo per l'acquirente.\ 4. Non \'8f lecito copiare, modificare, sublicenziare, o distribuire il Programma in modi diversi da quelli espressamente previsti da questa Licenza. Ogni tentativo di copiare, modificare, sublicenziare o distribuire il Programma non \'8f autorizzato, e far\'88 terminare automaticamente i diritti garantiti da questa Licenza. D'altra parte ogni acquirente che abbia ricevuto copie, o diritti, coperti da questa Licenza da parte di persone che violano la Licenza come qui indicato non vedranno invalidare la loro Licenza, purch\'8e si comportino conformemente ad essa.\ 5. L'acquirente non \'8f obbligato ad accettare questa Licenza, poich\'8e non l'ha firmata. D'altra parte nessun altro documento garantisce il permesso di modificare o distribuire il Programma o i lavori derivati da esso. Queste azioni sono proibite dalla legge per chi non accetta questa Licenza; perci\'98, modificando o distribuendo il Programma o un lavoro basato sul programma, si indica nel fare ci\'98 l'accettazione di questa Licenza e quindi di tutti i suoi termini e le condizioni poste sulla copia, la distribuzione e la modifica del Programma o di lavori basati su di esso.\ 6. Ogni volta che il Programma o un lavoro basato su di esso vengono distribuiti, l'acquirente riceve automaticamente una licenza d'uso da parte del licenziatario originale. Tale licenza regola la copia, la distribuzione e la modifica del Programma secondo questi termini e queste condizioni. Non \'8f lecito imporre restrizioni ulteriori all'acquirente nel suo esercizio dei diritti qui garantiti. Chi distribuisce programmi coperti da questa Licenza non e' comunque responsabile per la conformit\'88 alla Licenza da parte di terze parti.\ 7. Se, come conseguenza del giudizio di una corte, o di una imputazione per la violazione di un brevetto o per ogni altra ragione (anche non relativa a questioni di brevetti), vengono imposte condizioni che contraddicono le condizioni di questa licenza, che queste condizioni siano dettate dalla corte, da accordi tra le parti o altro, queste condizioni non esimono nessuno dall'osservazione di questa Licenza. Se non \'8f possibile distribuire un prodotto in un modo che soddisfi simultaneamente gli obblighi dettati da questa Licenza e altri obblighi pertinenti, il prodotto non pu\'98 essere affatto distribuito. Per esempio, se un brevetto non permettesse a tutti quelli che lo ricevono di ridistribuire il Programma senza obbligare al pagamento di diritti, allora l'unico modo per soddisfare contemporaneamente il brevetto e questa Licenza e' di non distribuire affatto il Programma.\ Se parti di questo punto sono ritenute non valide o inapplicabili per qualsiasi circostanza, deve comunque essere applicata l'idea espressa da questo punto; in ogni altra circostanza invece deve essere applicato il punto 7 nel suo complesso.\ Non \'8f nello scopo di questo punto indurre gli utenti ad infrangere alcun brevetto n\'8f ogni altra rivendicazione di diritti di propriet\'88, n\'8f di contestare la validit\'88 di alcuna di queste rivendicazioni; lo scopo di questo punto \'8f solo quello di proteggere l'integrit\'88 del sistema di distribuzione dei programmi liberi, che viene realizzato tramite l'uso della licenza pubblica. Molte persone hanno contribuito generosamente alla vasta gamma di programmi distribuiti attraverso questo sistema, basandosi sull'applicazione fedele di tale sistema. L'autore/donatore pu\'98 decidere di sua volont\'88 se preferisce distribuire il software avvalendosi di altri sistemi, e l'acquirente non pu\'98 imporre la scelta del sistema di distribuzione.\ Questo punto serve a rendere il pi\'9d chiaro possibile ci\'98 che crediamo sia una conseguenza del resto di questa Licenza.\ 8. Se in alcuni paesi la distribuzione e/o l'uso del Programma sono limitati da brevetto o dall'uso di interfacce coperte da copyright, il detentore del copyright originale che pone il Programma sotto questa Licenza pu\'98 aggiungere limiti geografici espliciti alla distribuzione, per escludere questi paesi dalla distribuzione stessa, in modo che il programma possa essere distribuito solo nei paesi non esclusi da questa regola. In questo caso i limiti geografici sono inclusi in questa Licenza e ne fanno parte a tutti gli effetti.\ 9. All'occorrenza la Free Software Foundation pu\'98 pubblicare revisioni o nuove versioni di questa Licenza Pubblica Generica. Tali nuove versioni saranno simili a questa nello spirito, ma potranno differire nei dettagli al fine di coprire nuovi problemi e nuove situazioni.\ Ad ogni versione viene dato un numero identificativo. Se il Programma asserisce di essere coperto da una particolare versione di questa Licenza e "da ogni versione successiva", l'acquirente pu\'98 scegliere se seguire le condizioni della versione specificata o di una successiva. Se il Programma non specifica quale versione di questa Licenza deve applicarsi, l'acquirente pu\'98 scegliere una qualsiasi versione tra quelle pubblicate dalla Free Software Foundation.\ 10. Se si desidera incorporare parti del Programma in altri programmi liberi le cui condizioni di distribuzione differiscano da queste, \'8f possibile scrivere all'autore del Programma per chiederne l'autorizzazione. Per il software il cui copyright \'8f detenuto dalla Free Software Foundation, si scriva alla Free Software Foundation; talvolta facciamo eccezioni alle regole di questa Licenza. La nostra decisione sar\'88 guidata da due scopi: preservare la libert\'88 di tutti i prodotti derivati dal nostro free software e promuovere la condivisione e il riutilizzo del software in generale.\ NON C'\'e9 GARANZIA\ 11. POICH\'83 IL PROGRAMMA \'e9 CONCESSO IN USO GRATUITAMENTE, NON C'\'e9 GARANZIA PER IL PROGRAMMA, NEI LIMITI PERMESSI DALLE VIGENTI LEGGI. SE NON INDICATO DIVERSAMENTE PER ISCRITTO, IL DETENTORE DEL COPYRIGHT E LE ALTRE PARTI FORNISCONO IL PROGRAMMA "COSI` COM'\'e9", SENZA ALCUN TIPO DI GARANZIA, N\'e9 ESPLICITA N\'e9 IMPLICITA; CI\'f1 COMPRENDE, SENZA LIMITARSI A QUESTO, LA GARANZIA IMPLICITA DI COMMERCIABILIT\'cb E UTILIZZABILIT\'cb PER UN PARTICOLARE SCOPO. L'INTERO RISCHIO CONCERNENTE LA QUALIT\'cb E LE PRESTAZIONI DEL PROGRAMMA \'e9 DELL'ACQUIRENTE. SE IL PROGRAMMA DOVESSE RIVELARSI DIFETTOSO, L'ACQUIRENTE SI ASSUME IL COSTO DI OGNI MANUTENZIONE, RIPARAZIONE O CORREZIONE NECESSARIA.\ 12. N\'e9 IL DETENTORE DEL COPYRIGHT N\'e9 ALTRE PARTI CHE POSSONO MODIFICARE O RIDISTRIBUIRE IL PROGRAMMA COME PERMESSO IN QUESTA LICENZA SONO RESPONSABILI PER DANNI NEI CONFRONTI DELL'ACQUIRENTE, A MENO CHE QUESTO NON SIA RICHIESTO DALLE LEGGI VIGENTI O APPAIA IN UN ACCORDO SCRITTO. SONO INCLUSI DANNI GENERICI, SPECIALI O INCIDENTALI, COME PURE I DANNI CHE CONSEGUONO DALL'USO O DALL'IMPOSSIBILIT\'cb DI USARE IL PROGRAMMA; CI\'f1 COMPRENDE, SENZA LIMITARSI A QUESTO, LA PERDITA DI DATI, LA CORRUZIONE DEI DATI, LE PERDITE SOSTENUTE DALL'ACQUIRENTE O DA TERZE PARTI E L'INABILIT\'cb DEL PROGRAMMA A LAVORARE INSIEME AD ALTRI PROGRAMMI, ANCHE SE IL DETENTORE O ALTRE PARTI SONO STATE AVVISATE DELLA POSSIBILIT\'cb DI QUESTI DANNI.\ FINE DEI TERMINI E DELLE CONDIZIONI \f0\fs24 \ \pard\pardeftab708\sb240\sa60\qj \f3\i\b\fs22 \cf0 Appendice: come applicare questi termini ai nuovi programmi\ \pard\pardeftab708\sb240\qj \f0\i0\b0 \cf0 Se si sviluppa un nuovo programma e lo si vuole rendere della maggiore utilit\'88 possibile per il pubblico, la cosa migliore da fare \'8f rendere tale programma free software, cosicch\'8e ciascuno possa ridistribuirlo e modificarlo sotto questi termini.\ Per fare questo, si inserisca nel programma la seguente nota. La cosa migliore da fare \'8f mettere la nota all`inizio di ogni file sorgente, per chiarire nel modo pi\'9d efficiente possibile l'assenza di garanzia; ogni file dovrebbe contenere almeno la nota di copyright e l'indicazione di dove trovare l'intera nota.\ \pard\pardeftab708\li567\sb240\qj \cf0 Copyright (C) 19aa \ Questo programma \'8f free software; \'8f lecito redistribuirlo e/o modificarlo secondo i termini della Licenza Pubblica Generica GNU come \'8f pubblicata dalla Free Software Foundation; o la versione 2 della licenza o (a propria scelta) una versione successiva.\ Questo programma \'8f distribuito nella speranza che sia utile, ma SENZA ALCUNA GARANZIA; senza neppure la garanzia implicita di NEGOZIABILIT\'cb o di APPLICABILIT\'cb PER UN PARTICOLARE SCOPO. Si veda la Licenza Pubblica Generica GNU per avere maggiori dettagli.\ Ognuno dovrebbe avere ricevuto una copia della Licenza Pubblica Generica GNU insieme a questo programma; in caso contrario, si scriva alla Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, Stati Uniti.\ \pard\pardeftab708\sb240\qj \cf0 Si aggiungano anche informazioni su come si pu\'98 essere contattati tramite posta elettronica e cartacea.\ Se il programma \'8f interattivo, si faccia in modo che stampi una breve nota simile a questa quando viene usato interattivamente:\ \pard\pardeftab708\li567\sb240\qj \cf0 Orcaloca versione 69, Copyright (C) 19aa Orcaloca non ha ALCUNA GARANZIA; per i dettagli si digiti `show g'. Questo \'8f free software, e ognuno \'8f libero di ridistribuirlo sotto certe condizioni; si digiti `show c' per dettagli.\ \pard\pardeftab708\sb240\qj \cf0 Gli ipotetici comandi "show g" e "show c" mostreranno le parti appropriate della Licenza Pubblica Generica. Chiaramente, i comandi usati possono essere chiamati diversamente da "show g" e "show c" e possono anche essere selezionati con il mouse o attraverso un men\'9d; in qualunque modo pertinente al programma.\ Se necessario, si dovrebbe anche far firmare al proprio datore di lavoro (se si lavora come programmatore) o alla propria scuola, se si \'8f studente, una "rinuncia al copyright" per il programma. Ecco un esempio con nomi fittizi:\ \pard\pardeftab708\li567\sb240\qj \cf0 Yoyodinamica SPA rinuncia con questo documento ad ogni interesse al copyright del programma `Orcaloca' (che svolge dei passi di compilazione) scritto da Giovanni Smanettone.\ , 1 April 1999 Primo Tizio, Presidente\ \pard\pardeftab708\sb240\qj \cf0 I programmi coperti da questa Licenza Pubblica Generica non possono essere incorporati all'interno di programmi proprietari. Se il proprio programma \'8f una libreria di funzioni, pu\'98 essere pi\'9d utile permettere di collegare applicazioni proprietarie alla libreria. Se si ha questa intenzione consigliamo di usare la Licenza Generica Pubblica GNU per Librerie (LGPL) al posto di questa Licenza.} ================================================ FILE: Italian.lproj/Credits.rtf ================================================ {\rtf1\mac\ansicpg10000\cocoartf102 {\fonttbl\f0\fswiss\fcharset77 Helvetica;\f1\froman\fcharset77 Times-Roman;} {\colortbl;\red255\green255\blue255;\red26\green26\blue255;} \vieww7800\viewh9340\viewkind0 \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f0\fs24 \cf0 For information and help with OSXvnc:\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f1 \cf0 \f0 \cf2 \ul \ulc2 http://www.redstonesoftware.com/osxvnc \f1 \cf0 \ulnone \ \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f0 \cf0 Copyright \'a9 2002-2005 Redstone Software\ Jonathan Gillaspie\ Doug Simons\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f1 \cf0 \f0 \cf2 \ul osxvnc@redstonesoftware.com \f1 \cf0 \ulnone \ \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f0 \cf0 Copyright \'a9 2002 Mahmud Haque\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f1 \cf0 \f0 \cf2 \ul mahmud@bcm.tmc.edu \f1 \cf0 \ulnone \ \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f0 \cf0 Copyright \'a9 2001 Dan McGuirk\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f1 \cf0 \f0 \cf2 \ul mcguirk@incompleteness.net \f1 \cf0 \ulnone \ \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f0 \cf0 GNU GPL:\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf2 \ul http://www.gnu.org/copyleft/gpl.html\cf0 \ulnone \ \ Special Thanks For Server Side Scaling goes to:\ Noriaki Yamazaki\ Administrator of micro-VNC\ Hitachi System & Service, Ltd.\ \ Special Thanks For Reverse Connections goes to:\ Mark Lentczner\ \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 Zlib, ZlibHex and Tight encodings:\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 Mahmud Haque\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 Other Contributions:\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f1 \cf0 \f0 David Johnson \f1 \ \f0 Steven Tamm\ Mihai Parparita\ \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 French Localization:\ Pascal Frey\ \ Japanese Localization:\ Aaron Madlon-Kay\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 \ Icon Compliments of Martin Goneau \ \cf2 \ul http://www.goneau.com\cf0 \ulnone \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 \ ----------------------------------------------------\ \ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\ \ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\ \ You should have received a copy of the GNU General Public License along with this program; if not, write to:\ \ Free Software Foundation, Inc.\ 59 Temple Place - Suite 330\ Boston, MA 02111-1307\ USA\ } ================================================ FILE: Italian.lproj/MainMenu.nib/classes.nib ================================================ { IBClasses = ( { ACTIONS = {"" = id; optionChanged = id; }; CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, { ACTIONS = { changeDisplayName = id; changeDisplayNumber = id; changePassword = id; changePort = id; changeSharing = id; connectHost = id; installAsService = id; loadUserDefaults = id; openFile = id; openGPL = id; openLog = id; openReleaseNotes = id; optionChanged = id; removeService = id; saveUserDefaults = id; startServer = id; stopServer = id; }; CLASS = VNCController; LANGUAGE = ObjC; OUTLETS = { allowDimmingCheckbox = NSButton; allowKeyboardLoading = NSButton; allowPressModsForKeys = NSButton; allowRendezvousCheckbox = NSButton; allowScreenSaverCheckbox = NSButton; allowSleepCheckbox = NSButton; connectHost = NSTextField; connectPort = NSTextField; disableRemoteEventsCheckbox = NSButton; disableStartupButton = NSButton; displayNameField = NSTextField; displayNumberField = NSPopUpButton; dontDisconnectCheckbox = NSButton; hostNamesField = NSTextField; hostNamesLabel = NSTextField; ipAddressesField = NSTextField; ipAddressesLabel = NSTextField; limitToLocalConnections = NSButton; optionsTabView = NSTabView; otherArguments = NSTextField; passwordField = NSTextField; portField = NSTextField; protocolVersion = NSPopUpButton; serverKeepAliveCheckbox = NSButton; setStartupButton = NSButton; sharingMatrix = NSMatrix; startServerButton = NSButton; startServerMenuItem = NSMenuItem; startServerOnLaunchCheckbox = NSButton; startupItemStatusMessageField = NSTextField; statusMessageField = NSTextField; stopServerButton = NSButton; stopServerMenuItem = NSMenuItem; swapMouseButtonsCheckbox = NSButton; terminateOnFastUserSwitch = NSButton; window = NSWindow; }; SUPERCLASS = NSObject; } ); IBVersion = 1; } ================================================ FILE: Italian.lproj/MainMenu.nib/info.nib ================================================ IBDocumentLocation 1000 258 356 240 0 0 1440 878 IBEditorPositions 29 101 636 382 44 0 0 1024 746 404 591 584 158 99 0 0 1440 878 IBFramework Version 446.1 IBOpenObjects 404 IBSystem Version 8J2135a ================================================ FILE: Japanese.lproj/Credits.rtf ================================================ {\rtf1\mac\ansicpg10000\cocoartf102 {\fonttbl\f0\fswiss\fcharset77 Helvetica;\f1\fnil\fcharset78 HiraKakuPro-W3;\f2\froman\fcharset77 Times-Roman; } {\colortbl;\red255\green255\blue255;\red26\green26\blue255;\red0\green0\blue255;} \vieww9000\viewh9000\viewkind0 \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f0\fs24 \cf0 OSXvnc \f1 \'82\'c9\'8a\'d6\'82\'b7\'82\'e9\'8f\'ee\'95\'f1\'82\'c6\'83\'77\'83\'8b\'83\'76\'82\'c9\'82\'c2\'82\'a2\'82\'c4\'82\'cd\'82\'b1\'82\'cc\'83\'54\'83\'43\'83\'67\'82\'f0\'82\'b2\'97\'97\'89\'ba\'82\'b3\'82\'a2 \f0 \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f2 \cf0 \f0 \cf2 \ul \ulc2 http://www.redstonesoftware.com/osxvnc \f2 \cf0 \ulnone \ \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f0 \cf0 Copyright \'a9 2002-2005 Redstone Software\ Jonathan Gillaspie\ Doug Simons\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f2 \cf0 \f0 \cf2 \ul osxvnc@redstonesoftware.com \f2 \cf0 \ulnone \ \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f0 \cf0 Copyright \'a9 2002 Mahmud Haque\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f2 \cf0 \f0 \cf2 \ul mahmud@bcm.tmc.edu \f2 \cf0 \ulnone \ \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f0 \cf0 Copyright \'a9 2001 Dan McGuirk\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f2 \cf0 \f0 \cf2 \ul mcguirk@incompleteness.net \f2 \cf0 \ulnone \ \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f0 \cf0 GNU \f1 \'88\'ea\'94\'ca\'8c\'f6\'8f\'4f\'97\'98\'97\'70\'8b\'96\'91\'f8\'8c\'5f\'96\'f1\'8f\'91\'81\'46 \f0 \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf2 \ul \cf3 \ul \ulc3 http://www.gnu.org/licenses/gpl.ja.html\cf0 \ulnone \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f2 \cf0 \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f0 \cf0 Server Side Scaling \f1 \'82\'c9\'8a\'d6\'82\'b5\'82\'c4\'82\'cc\'8e\'d3\'8e\'ab\'81\'46 \f0 \ Noriaki Yamazaki\ Administrator of micro-VNC\ Hitachi System & Service, Ltd.\ \ Reverse Connections \f1 \'82\'c9\'8a\'d6\'82\'b5\'82\'c4\'82\'cc\'8e\'d3\'8e\'ab\'81\'46 \f0 \ Mark Lentczner\ \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 Zlib, ZlibHex and Tight encodings:\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 Mahmud Haque\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f1 \cf0 \'91\'bc\'82\'cc\'8b\'a6\'97\'cd\'8e\'d2\'81\'46 \f0 \ \f2 \f0 David Johnson \f2 \ \f0 Steven Tamm\ Mihai Parparita\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f1 \cf0 \'95\'a7\'96\'f3\'81\'46\ \f0 Pascal Frey \f1 \ \'98\'61\'96\'f3\'81\'46\ \f0 Aaron Madlon-Kay\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \f1 \cf0 \'83\'41\'83\'43\'83\'52\'83\'93\'81\'46 \f0 Martin Goneau\ \cf2 \ul http://www.goneau.com\ \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 \ulnone ----------------------------------------------------\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\ql\qnatural \cf0 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\ \ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\ \ You should have received a copy of the GNU General Public License along with this program; if not, write to:\ \ Free Software Foundation, Inc.\ 59 Temple Place - Suite 330\ Boston, MA 02111-1307\ USA\ } ================================================ FILE: Japanese.lproj/MainMenu.nib/classes.nib ================================================ { IBClasses = ( { ACTIONS = {optionChanged = id; }; CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, { ACTIONS = { changeDisplayName = id; changeDisplayNumber = id; changePassword = id; changePort = id; changeSharing = id; connectHost = id; installAsService = id; loadUserDefaults = id; openFile = id; openGPL = id; openLog = id; openReleaseNotes = id; optionChanged = id; removeService = id; saveUserDefaults = id; startServer = id; stopServer = id; }; CLASS = VNCController; LANGUAGE = ObjC; OUTLETS = { allowDimmingCheckbox = NSButton; allowKeyboardLoading = NSButton; allowPressModsForKeys = NSButton; allowRendezvousCheckbox = NSButton; allowScreenSaverCheckbox = NSButton; allowSleepCheckbox = NSButton; connectHost = NSTextField; connectPort = NSTextField; disableRemoteEventsCheckbox = NSButton; disableStartupButton = NSButton; displayNameField = NSTextField; displayNumberField = NSPopUpButton; dontDisconnectCheckbox = NSButton; hostNamesField = NSTextField; hostNamesLabel = NSTextField; ipAddressesField = NSTextField; ipAddressesLabel = NSTextField; limitToLocalConnections = NSButton; optionsTabView = NSTabView; otherArguments = NSTextField; passwordField = NSTextField; portField = NSTextField; protocolVersion = NSPopUpButton; serverKeepAliveCheckbox = NSButton; setStartupButton = NSButton; sharingMatrix = NSMatrix; startServerButton = NSButton; startServerMenuItem = NSMenuItem; startServerOnLaunchCheckbox = NSButton; startupItemStatusMessageField = NSTextField; statusMessageField = NSTextField; stopServerButton = NSButton; stopServerMenuItem = NSMenuItem; swapMouseButtonsCheckbox = NSButton; terminateOnFastUserSwitch = NSButton; window = NSWindow; }; SUPERCLASS = NSObject; } ); IBVersion = 1; } ================================================ FILE: Japanese.lproj/MainMenu.nib/info.nib ================================================ IBDocumentLocation 451 77 356 240 0 0 1024 746 IBEditorPositions 29 102 661 342 44 0 0 1024 746 404 400 501 108 99 0 0 1024 746 IBFramework Version 443.0 IBOpenObjects 29 21 IBSystem Version 8H14 ================================================ FILE: LICENSE ================================================ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS ================================================ FILE: NSAuthorization.h ================================================ // // NSAuthorization.h // OSXvnc // // Created by Jonathan Gillaspie on Fri Dec 12 2003. // Copyright (c) 2003 __MyCompanyName__. All rights reserved. // #import #include #include @interface NSAuthorization : NSObject { // Persistent AuthRef AuthorizationRef myAuthorizationRef; } - (instancetype) init; - (BOOL) executeCommand:(NSString *) command withArgs: (NSArray *) argumentArray; - (BOOL) executeCommand:(NSString *) command withArgs: (NSArray *) argumentArray synchronous: (BOOL) sync; @end ================================================ FILE: NSAuthorization.m ================================================ // // NSAuthorization.m // OSXvnc // // Created by Jonathan Gillaspie on Fri Dec 12 2003. // Copyright (c) 2003 __MyCompanyName__. All rights reserved. // #import "NSAuthorization.h" #include "unistd.h" @implementation NSAuthorization - (instancetype) init { AuthorizationFlags myFlags = kAuthorizationFlagDefaults | kAuthorizationFlagInteractionAllowed | kAuthorizationFlagPreAuthorize | kAuthorizationFlagExtendRights; OSStatus myStatus; AuthorizationItem myItems = {kAuthorizationRightExecute, 0, NULL, 0}; AuthorizationRights myRights = {1, &myItems}; self = [super init]; myStatus = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, myFlags, &myAuthorizationRef); // This will pre-authorize the authentication if (myStatus == errAuthorizationSuccess) myStatus = AuthorizationCopyRights(myAuthorizationRef, &myRights, NULL, myFlags, NULL); if (myStatus != errAuthorizationSuccess) { return nil; } return self; } - (BOOL) executeCommand:(NSString *) command withArgs: (NSArray *) argumentArray { return [self executeCommand:(NSString *) command withArgs: (NSArray *) argumentArray synchronous:TRUE]; } - (BOOL) executeCommand:(NSString *) command withArgs: (NSArray *) argumentArray synchronous: (BOOL) sync { FILE *communicationStream = NULL; int i; OSStatus myStatus; char outputString[1024]; time_t startTime = time(NULL); char **copyArguments = malloc(sizeof(char *) * (argumentArray.count + 1)); for (i = 0; i < argumentArray.count; i++) { copyArguments[i] = (char *)[argumentArray[i] UTF8String]; } copyArguments[i] = NULL; myStatus = AuthorizationExecuteWithPrivileges(myAuthorizationRef, command.UTF8String, kAuthorizationFlagDefaults, copyArguments, (sync ? &communicationStream : NULL)); // FILE HANDLE for I/O if (myStatus==errAuthorizationSuccess && sync) { while (!myStatus && !feof(communicationStream) && fgets(outputString, 1024, communicationStream) && time(NULL)-startTime<10) { if (strlen(outputString) > 1) NSLog(@"NSAuthorization: %s",outputString); } fclose(communicationStream); } free(copyArguments); if (myStatus != errAuthorizationSuccess) NSLog(@"Error: Executing %@ with Authorization: %d", command, (int)myStatus); return (myStatus == errAuthorizationSuccess); } - (void) dealloc { AuthorizationFree (myAuthorizationRef, kAuthorizationFlagDefaults); [super dealloc]; } @end ================================================ FILE: OSXvnc/OSXvnc ================================================ #!/bin/sh . /etc/rc.common # # OSXvnc # # The OSXvnc application will OVERWRITE this file if you ask it to Configure the Startup Item # VNCPATH="/Library/StartupItems/OSXvnc" VNCARGS="-rfbport 5900 -rfbauth $VNCPATH/.osxvncauth -swapButtons -dontdisconnect" VNCLOG="/Library/Logs/VineServer.log" # # Modification Log: # # 3.0 # Removed dash from ps -auxwww for 10.5 compatibility # Added VNCLOG path, set to /Library/Logs/VineServer.log # # 1.6 # Added missing backslashes to the Awk command when stopping OSXvnc-keepalive # # 1.5 # Switched VNCPath to /Library/StartupItems/OSXvnc by default, we now copy in the executable # Added -f option to log move so it won't hang when started up (when run as authenticated/non-root user) # Set the kill operations to use the -KILL flag, seems to help on 10.1.5 # # 1.33 # Added Resources directory with English.lproj for Localization lookup # Modified to handle 'restart' directive # Modified to make more better use of the awk command # # 1.31 # Modified Startup parameters to work better on some systems # Modified so that OSXvnc can live in directories with spaces # # 1.3 # Modified so that OSXvnc app can configure # Removed Usage # # 1.2 # Fixed problem in stop section (missing space) # Fixed stop to also kill the server and keep alive # Now Uses $VNCPATH for other arguments # # 1.11 # Added Usage Info # Added keepalive call # # 1.0/Initial # Initial Version, no # and no history # ## if [ ${1:-noset} == "stop" ] || [ ${1:-noset} == "restart" ]; then ConsoleMessage "Stopping OSXvnc KeepAlive" OSXVNCPID=`/bin/ps auxww | /usr/bin/awk '/[O]SXvnc-keepalive/ {print $2}'` if [ "${OSXVNCPID:=""}" ]; then kill -KILL $OSXVNCPID sleep 1 fi # make sure it's dead OSXVNCPID=`/bin/ps auxww | /usr/bin/awk '/[O]SXvnc-keepalive/ {print $2}'` if [ "${OSXVNCPID:=""}" != "" ]; then ConsoleMessage "OSXvnc $1: problem stopping OSXvnc-keepalive" exit -1 fi ConsoleMessage "Stopping OSXvnc Server" OSXVNCPID=`/bin/ps auxww | /usr/bin/awk '/Library\/StartupItems\/OSXvnc\/[O]SXvnc-server/ {print $2}'` if [ "${OSXVNCPID:=""}" ]; then kill -KILL $OSXVNCPID sleep 1 fi # make sure it's dead OSXVNCPID=`/bin/ps auxww | /usr/bin/awk '/Library\/StartupItems\/OSXvnc\/[O]SXvnc-server/ {print $2}'` if [ "${OSXVNCPID:=""}" != "" ]; then ConsoleMessage "OSXvnc $1: problem stopping OSXvnc-server $OSXVNCPID" exit -1 fi if [ ${1:-noset} = "stop" ]; then exit 0 fi fi if [ -x "$VNCPATH" ]; then ConsoleMessage "Starting OSXvnc Server" if [ -e "$VNCLOG" ]; then /bin/mv -f "$VNCLOG" "$VNCLOG.1" fi $0-keepalive "$VNCPATH/OSXvnc-server" $VNCARGS > $VNCLOG 2>&1 & else ConsoleMessage "Unable to find OSXvnc" exit -1 fi ================================================ FILE: OSXvnc/OSXvnc-keepalive ================================================ #!/bin/sh # # OSXvnc-keepalive # # This little script, as you might imagine, will relaunch OSXvnc-server # when a user logs out and the OS kills the process (because it's running an event loop) # # Modification Log: # # 2.2 # Ignore external kills for the purpose of restart count # # 2.0 Adopted these contributions... # # 2006-06-07 Marvin Simkin # Try to capture a little more detail when it dies # # 1.71 # For no documentable reason I can discern the server gets a 137 code when a user logs out # # 1.7 # Only restart on items where the first bit is NOT set (less than 128) # # 1.5 # Replace spurious ls -l entry with a much more appropriate pwd # # 1.4 # Uses proper -lt and checks for less than 200 rather than more than 0 since process only return unsigned shorts # # 1.33 # Modified so that keepalive only shuts down on unrecoverable errors # # 1.31 # Modified so that OSXvnc can live in directories with spaces # # 1.11 # Initial version echo "`date '+%Y-%m-%d %H:%M:%S'` $0: Starting" echo "`date '+%Y-%m-%d %H:%M:%S'` pwd: '`pwd`'" echo "`date '+%Y-%m-%d %H:%M:%S'` id: '`id`'" echo "`date '+%Y-%m-%d %H:%M:%S'` uname -a: '`uname -a`'" echo "`date '+%Y-%m-%d %H:%M:%S'` uptime: '`uptime`'" RESULT=15 # OS X will send a SIGINT or SIGTERM to shutdown OSXvnc-server # On a high SIGNAL (over 128) we'll stop properly (this is what the server returns internally when an error occurs) ## this seems to be stopping needlessly when it could recover ##while [[ "$RESULT" -lt "128" ]] STOPNOW=0 while [[ "$STOPNOW" -lt "1" ]] do echo "`date '+%Y-%m-%d %H:%M:%S'` $0: Starting Server '$1'" "$@" # Run our parameters RESULT=$? # Record Result echo "`date '+%Y-%m-%d %H:%M:%S'` Server exited with result: $RESULT" echo "`date '+%Y-%m-%d %H:%M:%S'` Server exited with result: $RESULT" >> /var/log/osxvnc_exit.log # signal code 137 = 9 + 128 corresponds to SIGKILL (kill signal from term) # this signal is sent when a user logs out # don't treat recurrence of this code as an error; let the server restart! if [ "$RESULT" -ne "137" -o "$RESULT" -ne "134" ] then # check for same problem recurring frequently COUNT=`cut -f1,7 -d' ' < /var/log/osxvnc_exit.log | uniq -c | tail -1 | sed "s/^ *//" | cut -f1 -d' '` # set the repeated failures limit here if test $COUNT -gt 4 then echo "`date '+%Y-%m-%d %H:%M:%S'` The same error '$RESULT' happened $COUNT times in a row, not restarting!" echo "`date '+%Y-%m-%d %H:%M:%S'` The same error '$RESULT' happened $COUNT times in a row, not restarting!" >> /var/log/osxvnc_exit.log STOPNOW=1 fi fi sleep 5 done echo "`date '+%Y-%m-%d %H:%M:%S'` $0: Shutdown with exit status " $RESULT ================================================ FILE: OSXvnc/Resources/English.lproj/Localizable.strings ================================================ Restarting OSXvnc server Restarting OSXvnc server Starting OSXvnc server Starting OSXvnc server Stopping OSXvnc server Stopping OSXvnc server ================================================ FILE: OSXvnc/StartupParameters.plist ================================================ { Description = "VNC Server"; Provides = ("VNC"); Requires = ("Resolver"); Uses = ("Core Graphics"); OrderPreference = "None"; Messages = { restart = "Restarting OSXvnc server"; start = "Starting OSXvnc server"; stop = "Stopping OSXvnc server"; }; } ================================================ FILE: OSXvnc-server/CGS.h ================================================ /* * CGS.h * OSXvnc * * Created by Mihai Parparita on Sat Jun 15 2002. * Copyright (c) 2002 Mihai Parparita. All rights reserved. * */ #pragma once #include typedef int CGSConnectionRef; extern CGError CGSNewConnection(void* unknown, CGSConnectionRef* newConnection); extern CGError CGSReleaseConnection(CGSConnectionRef connection); extern CGError CGSGetGlobalCursorDataSize(CGSConnectionRef connection, int* size); extern CGError CGSGetGlobalCursorData(CGSConnectionRef connection, unsigned char* cursorData, int* size, int* bytesPerRow, CGRect* cursorRect, CGPoint* hotspot, int* depth, int* components, int* bitsPerComponent); extern CGError CGSGetCurrentCursorLocation(CGSConnectionRef connection, CGPoint* point); extern int CGSCurrentCursorSeed(void); extern int CGSHardwareCursorActive(void); // flaky? doesn't seem to work after DM is initialized #ifndef SAVECOLORS #define SAVECOLORS\ RGBColor oldForeColor, oldBackColor;\ PenState oldState;\ GetForeColor(&oldForeColor);\ GetBackColor(&oldBackColor);\ GetPenState(&oldState);\ ForeColor(blackColor);\ BackColor(whiteColor); #endif #ifndef RESTORECOLORS #define RESTORECOLORS\ SetPenState(&oldState);\ RGBForeColor(&oldForeColor);\ RGBBackColor(&oldBackColor); #endif ================================================ FILE: OSXvnc-server/COPYING ================================================ GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. ================================================ FILE: OSXvnc-server/Makefile ================================================ # Makefile for OSXvnc-server CC=cc CXX=cc CFLAGS=-O3 -Wall -Wextra -g CXXFLAGS=-O3 -Wall -Wextra -g INCLUDES=-Ilibvncauth -Iinclude -Iinclude/X11 -Iinclude/Xserver -I/opt/libjpeg-turbo/include VNCAUTHLIB=-Llibvncauth -lvncauth SUPPORTLIB=-lz -lturbojpeg RDRLIB=-Lrdr -lrdr EXTRALIBS=-lstdc++ LIBS=$(VNCAUTHLIB) $(SUPPORTLIB) $(RDRLIB) $(EXTRALIBS) -framework Carbon -framework IOKit -framework Cocoa SOURCES=main.c rfbserver.c miregion.c kbdptr.c auth.c sockets.c xalloc.c \ stats.c corre.c hextile.c rre.c translate.c cutpaste.c dimming.c \ tight.c zlib.c zlibhex.c mousecursor.c zrle.cc OBJS=main.o rfbserver.o miregion.o kbdptr.o auth.o sockets.o xalloc.o \ stats.o corre.o hextile.o rre.o translate.o cutpaste.o dimming.o \ tight.o zlib.o zlibhex.o mousecursor.o zrle.o VNCServer.o all: OSXvnc-server storepasswd install: .m.o: $(CC) $(CFLAGS) $(INCLUDES) -c $< .c.o: $(CC) $(CFLAGS) $(INCLUDES) -c $< .cc.o: $(CXX) $(CXXFLAGS) $(INCLUDES) -c $< OSXvnc-server: $(OBJS) libvncauth/libvncauth.a libjpeg/libjpeg.a rdr/librdr.a $(CC) -o OSXvnc-server $(OBJS) $(LIBS) storepasswd: storepasswd.o libvncauth/libvncauth.a $(CC) -o storepasswd storepasswd.o $(VNCAUTHLIB) libvncauth/libvncauth.a: (cd libvncauth && make) libjpeg/libjpeg.a: (cd libjpeg; make libjpeg.a) rdr/librdr.a: (cd rdr; make librdr.a) clean: rm -f $(OBJS) *~ core "#"* *.bak *.orig *.o (cd libvncauth && make clean) (cd libjpeg && make clean) (cd rdr && make clean) realclean: clean rm -f OSXvnc-server storepasswd .depend depend: cc -M $(INCLUDES) $(SOURCES) > .depend .depend: cc -M $(INCLUDES) $(SOURCES) > .depend include .depend ================================================ FILE: OSXvnc-server/VNCServer.h ================================================ // // VNCServer.h // OSXvnc // // Created by Jonathan Gillaspie on Mon Nov 17 2003. // Copyright (c) 2003 __MyCompanyName__. All rights reserved. // // This object is around to receive NSNotfication events, it can then dispatch them into the regular C code #import #import #import "rfb.h" #import "rfbserver.h" #import #import "kbdptr.h" @interface VNCServer : NSObject { NSNetService *rfbService; NSNetService *vncService; BOOL keyboardLoading; TISInputSourceRef loadedKeyboardRef; BOOL useIP6; BOOL listenerFinished; rfbserver *theServer; BOOL readyToStartup; BOOL dynamicKeyboard; // This flag will try to change the modifier key state to the required set for the unicode key that came in BOOL pressModsForKeys; CGEventSourceRef vncSourceRef; CGEventTapLocation vncTapLocation; TISInputSourceRef unicodeInputSource; TISInputSourceRef currentInputSource; // Current Modifiers reflect the "global" state of the modifier keys (not a particular VNC connection) // This only matters for event taps. Ideally we could detect their values but // that seems to require an active event loop. CGEventFlags currentModifiers; CGKeyCode keyTable[keyTableSize]; unsigned char keyTableMods[keyTableSize]; // 8 Bits for Modifier Keys // The Keycodes to various modifiers on the current keyboard CGKeyCode keyCodeShift; CGKeyCode keyCodeOption; CGKeyCode keyCodeControl; CGKeyCode keyCodeCommand; NSInteger modifierDelay; } + sharedServer; - (void) loadKeyboard: (TISInputSourceRef) keyboardLayoutRef; - (void) registerRendezvous; - (void) setupIPv6: argument; - (void) rfbStartup: (rfbserver *) aServer; - (void) rfbUsage; - (void) rfbRunning; - (void) rfbConnect; - (void) rfbDisconnect; - (void) rfbPoll; - (void) rfbReceivedClientMessage; - (void) rfbShutdown; - (void) systemServerShouldQuit: (NSNotification *) aNotification; - (void) systemServerShouldContinue: (NSNotification *) aNotification; - (void) loadUnicodeKeyboard; - (void) handleMouseButtons:(int) buttonMask atPoint:(NSPoint) aPoint forClient: (rfbClientPtr) cl; - (void) handleKeyboard:(Bool) down forSym: (KeySym) keySym forClient: (rfbClientPtr) cl; - (void) releaseModifiersForClient: (rfbClientPtr) cl; - (void) setKeyModifiers: (CGEventFlags) modifierFlags; - (BOOL) checkModiferState; - (void) sendKeyEvent: (CGKeyCode) keyCode down: (BOOL) down modifiers: (CGEventFlags) modifiersToSend; - (void) userSwitched: (NSNotification *) aNotification; - (void) clientConnected: (NSNotification *) aNotification; - (void) connectHost: (NSNotification *) aNotification; @end @interface RendezvousDelegate : NSObject { } @end ================================================ FILE: OSXvnc-server/VNCServer.m ================================================ // // VNCServer.m // OSXvnc // // Created by Jonathan Gillaspie on Mon Nov 17 2003. // Copyright (c) 2003 Redstone Software, Inc. All rights reserved. // #import "VNCServer.h" #import "rfb.h" #import "keysymdef.h" #import "kbdptr.h" #import "rfbserver.h" #import #import #import //#import #include #include #include #include #include #include #include #include @implementation VNCServer static VNCServer *sharedServer = nil; // These correspond to the keycodes of the keys 0-9,A-F static int unicodeNumbersToKeyCodes[16] = { 29, 18, 19, 20, 21, 23, 22, 26, 28, 25, 0, 11, 8, 2, 14, 3 }; + sharedServer { if (!sharedServer) { sharedServer = [[self alloc] init]; } return sharedServer; } - init { self = [super init]; if (self) { keyboardLoading = FALSE; useIP6 = TRUE; listenerFinished = FALSE; readyToStartup = TRUE; dynamicKeyboard = FALSE; [self loadKeyTable]; } return self; } - (void) loadKeyTable { unsigned int i; // Initialize them all to 0xFFFF for (i = 0; i < keyTableSize; i++) { keyTable[i] = 0xFFFF; keyTableMods[i] = 0; } // This is the old US only keyboard mapping // Map the above key table into a static array so we can just look them up directly // NSLog(@"Unable To determine key map - Reverting to US mapping"); for (i = 0; i < (sizeof(USKeyCodes) / sizeof(int)); i += 2) keyTable[(unsigned short)USKeyCodes[i]] = (CGKeyCode) USKeyCodes[i+1]; // This is the old SpecialKeyCodes keyboard mapping // Map the above key table into a static array so we can just look them up directly // NSLog(@"Loading %d XKeysym special keys", (sizeof(SpecialKeyCodes) / sizeof(int))); for (i = 0; i < (sizeof(SpecialKeyCodes) / sizeof(int)); i += 2) keyTable[(unsigned short)SpecialKeyCodes[i]] = (CGKeyCode) SpecialKeyCodes[i+1]; if (1) { // Find the right keycodes base on the loaded keyboard keyCodeShift = keyTable[XK_Shift_L]; keyCodeOption = keyTable[XK_Meta_L]; keyCodeControl = keyTable[XK_Control_L]; keyCodeCommand = keyTable[XK_Alt_L]; } } // Here are the resources we can think about using for Int'l keyboard support // http://developer.apple.com/documentation/Carbon/Reference/KeyboardLayoutServices/ // This will let us determine the current keyboard // KLGetCurrentKeyboardLayout // This will set the current keyboard // KLSetCurrentKeyboardLayout // This will get the Properties of a keyboard (like the key code to char tables) but... // KLGetKeyboardLayoutProperty // UCKeyTranslate - This is the opposite of what we need, if you give it a table and some keyCode (key input) it will tell you what Unicode char (or string) you get // we need the opposite - we want to know what keys to hit to get a given key (or string) // This will use the KeyboardLayoutRef to produce a static table of lookups // By iterating through all possible KeyCodes - (void) loadKeyboard: (TISInputSourceRef) inputSource { int i, j; UCKeyboardLayout *uchrHandle = NULL; CFStringRef keyboardName; static const unsigned modifierKeyStates[] = { 0, shiftKey, optionKey, controlKey, optionKey | shiftKey, optionKey | controlKey, controlKey | shiftKey, optionKey | shiftKey | controlKey }; NSArray *keyStates = [[NSUserDefaults standardUserDefaults] arrayForKey:@"KeyStates"]; /* modifiers */ //cmdKey = 1 << cmdKeyBit, //shiftKey = 1 << shiftKeyBit, //alphaLock = 1 << alphaLockBit, //optionKey = 1 << optionKeyBit, //controlKey = 1 << controlKeyBit, // KLGetKeyboardLayoutProperty is 10.2 only how do I access these resources in early versions? if (inputSource) { keyboardName = (CFStringRef) TISGetInputSourceProperty(inputSource, kTISPropertyLocalizedName); NSLog(@"Keyboard detected: %@ - loading keys", keyboardName); uchrHandle = (UCKeyboardLayout *) CFDataGetBytePtr(TISGetInputSourceProperty(inputSource, kTISPropertyUnicodeKeyLayoutData)); } // Initialize them all to 0xFFFF memset(keyTable, 0xFF, keyTableSize * sizeof(CGKeyCode)); memset(keyTableMods, 0xFF, keyTableSize * sizeof(unsigned char)); if (uchrHandle) { // Ok - we could get the LIST of Modifier Key States out of the Keyboard Layout // some of them are duplicates so we need to compare them, then we'll iterate through them in reverse order // UCKeyModifiersToTableNum = ; EventRecord // This layout gets a little harry UInt16 keyCode; UInt32 keyboardType = LMGetKbdType(); UniCharCount actualStringLength; UniChar unicodeChar[255]; // Iterate Over Each Modifier Keyset for (i = 0; i < (sizeof(modifierKeyStates) / sizeof(*modifierKeyStates)); i++) { unsigned modifierKeyState = (modifierKeyStates[i] >> 8) & 0xFF; //NSLog(@"Loading Keys For Modifer State: %#04x", modifierKeyState); // Iterate Over Each Key Code for (keyCode = 0; keyCode < 255; keyCode++) { for (j=0; j < keyStates.count; j++) { int keyActionState = [keyStates[j] intValue]; UInt32 deadKeyState = 0; OSStatus resultCode = UCKeyTranslate (uchrHandle, keyCode, keyActionState, modifierKeyState, keyboardType, kUCKeyTranslateNoDeadKeysBit, &deadKeyState, 255, // Only 1 key allowed due to VNC behavior &actualStringLength, unicodeChar); if (resultCode == noErr) { if (actualStringLength > 1) { NSLog(@"Multiple Characters For %d (%#04x): %S", keyCode, modifierKeyState, (const unichar *)unicodeChar); //unicodeChar[0] = unicodeChar[actualStringLength-1]; } else { //~ NSLog(@"Loaded %d (%04x)", keyCode, modifierKeyState); // We'll use the FIRST keyCode that we find for that UNICODE character if (keyTable[unicodeChar[0]] == 0xFFFF) { keyTable[unicodeChar[0]] = keyCode; keyTableMods[unicodeChar[0]] = modifierKeyState; } } } else { NSLog(@"Error Translating %d (%04x): %@ - %d", keyCode, modifierKeyState, [NSError errorWithDomain:NSOSStatusErrorDomain code:resultCode userInfo:nil], (int)resultCode); } } } } } else { // This is the old US only keyboard mapping // Map the above key table into a static array so we can just look them up directly NSLog(@"Unable To determine key map - reverting to US mapping"); for (i = 0; i < (sizeof(USKeyCodes) / sizeof(int)); i += 2) keyTable[(unsigned short)USKeyCodes[i]] = (CGKeyCode) USKeyCodes[i+1]; } // This is the old SpecialKeyCodes keyboard mapping // Map the above key table into a static array so we can just look them up directly NSLog(@"Loading %ld XKeysym special keys", (sizeof(SpecialKeyCodes) / sizeof(int))/2); for (i = 0; i < (sizeof(SpecialKeyCodes) / sizeof(int)); i += 2) { keyTable[(unsigned short)SpecialKeyCodes[i]] = (CGKeyCode) SpecialKeyCodes[i+1]; } keyCodeShift = keyTable[XK_Shift_L]; keyCodeOption = keyTable[XK_Meta_L]; keyCodeControl = keyTable[XK_Control_L]; keyCodeCommand = keyTable[XK_Alt_L]; } void SyncSetKeyboardLayout (TISInputSourceRef inputSource) { // http://developer.apple.com/library/mac/#documentation/TextFonts/Reference/TextInputSourcesReference/Reference/reference.html if (TISSelectInputSource(inputSource) != noErr) { NSLog(@"Error selecting input source:"); } } static bool isConsoleSession(void) { BOOL returnValue = FALSE; CFDictionaryRef sessionInfoDict = CGSessionCopyCurrentDictionary(); if (sessionInfoDict == NULL) NSLog(@"Unable to get session dictionary."); else { CFBooleanRef userIsActive = CFDictionaryGetValue(sessionInfoDict, kCGSessionOnConsoleKey); returnValue = CFBooleanGetValue(userIsActive); CFRelease(sessionInfoDict); } // if (0) { // // This one succeeds in "off-screen acounts" also // SecuritySessionId mySession; // SessionAttributeBits sessionInfo; // OSStatus error = SessionGetInfo(callerSecuritySession, &mySession, &sessionInfo); // // returnValue = (sessionInfo & sessionHasGraphicAccess); // } // else if (0) { // // There must be a better way but for now this seems to indicate if we are a console session or not // // at least for logged in users -- it always returns NO for the login window // CGEventSourceRef testRef = CGEventSourceCreate(kCGEventSourceStatePrivate); // int pollDelay = 0; // No poll at this time, just look once // // while (!testRef && pollDelay) { // usleep(100000); // pollDelay -= 100000; // testRef = CGEventSourceCreate(kCGEventSourceStatePrivate); // } // // if (testRef != NULL) { // returnValue = TRUE; // CFRelease(testRef); // } // } return returnValue; } - (void) rfbStartup: (rfbserver *) aServer { [[NSUserDefaults standardUserDefaults] registerDefaults:@{@"UnicodeKeyboard": @"NO", // Load The Unicode Keyboard @"DynamicKeyboard": @"NO", // Try to set the keyboard "as we need it", doesn't work well on Tiger @"UnicodeKeyboardIdentifier": @"-1", // ID of the Unicode Keyboard resource to use (-1 is Apple's) @"EventSource": @"2", // Always private event source so we don't consolidate with existing keys (however HID for the EventTap always does anyhow) @"EventTap": @"3", // Default Event Tap (3=HID for Console User and Session For OffScreen Users) @"ModifierDelay": @"5000", // Delay when shifting modifier keys @"SystemServer": @"NO", @"keyboardLoading": @"NO", // allows OSXvnc to look at the users selected keyboard and map keystrokes using it @"pressModsForKeys": @"YES", // If OSXvnc finds the key you want it will temporarily toggle the modifier keys to produce it @"KeyStates": @[@(kUCKeyActionAutoKey)]}]; theServer = aServer; // System Server special behavior if ([[NSUserDefaults standardUserDefaults] boolForKey:@"SystemServer"]) { // We need quit if the user switches out (so we can relinquish the port) if (isConsoleSession()) { [[NSWorkspace sharedWorkspace].notificationCenter addObserver:self selector:@selector(systemServerShouldQuit:) name: NSWorkspaceSessionDidResignActiveNotification object:nil]; } // We need to be able to "hold" if we aren't the console session else { [[NSWorkspace sharedWorkspace].notificationCenter addObserver:self selector:@selector(systemServerShouldContinue:) name: NSWorkspaceSessionDidBecomeActiveNotification object:nil]; readyToStartup = NO; // Run Loop NSLog(@"System Server for non-console session, pausing until we receive console access"); while (!readyToStartup) { OSStatus resultCode = RunCurrentEventLoop(kEventDurationSecond); //EventTimeout if (resultCode != eventLoopTimedOutErr) { NSLog(@"Received Result: %d during event loop, Shutting Down", (int)resultCode); //rfbShutdown(); exit(0); } } } } modifierDelay = [[NSUserDefaults standardUserDefaults] integerForKey:@"ModifierDelay"]; keyboardLoading = [[NSUserDefaults standardUserDefaults] boolForKey:@"keyboardLoading"]; if (keyboardLoading) { NSLog(@"Keyboard Loading - Enabled"); pressModsForKeys = [[NSUserDefaults standardUserDefaults] boolForKey:@"pressModsForKeys"]; if (pressModsForKeys) NSLog(@"Press Modifiers For Keys - Enabled"); else NSLog(@"Press Modifiers For Keys - Disabled"); loadedKeyboardRef = TISCopyCurrentKeyboardLayoutInputSource(); if (loadedKeyboardRef) [self loadKeyboard:loadedKeyboardRef]; else NSLog(@"Error unable to load current keyboard layout"); } if ([[NSProcessInfo processInfo].arguments indexOfObject:@"-ipv4"] != NSNotFound) { useIP6 = FALSE; } [self loadUnicodeKeyboard]; } - (void) systemServerShouldQuit: (NSNotification *) aNotification { NSLog(@"User Switched Out, Stopping System Server - %@", aNotification.name); //rfbShutdown(); exit(0); return; } - (void) systemServerShouldContinue: (NSNotification *) aNotification { NSLog(@"User Switched In, Starting System Server - %@", aNotification.name); readyToStartup = YES; return; } - (void) rfbRunning { [self registerRendezvous]; if (useIP6) { [NSThread detachNewThreadSelector:@selector(setupIPv6:) toTarget:self withObject:nil]; // Wait for the IP6 to bind, if it binds later it confuses the IPv4 binding into allowing others on the port while (!listenerFinished) usleep(1000); } if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DynamicKeyboard"]) dynamicKeyboard = TRUE; // Event Source represents which existing event states should be combined with the incoming events switch ([[NSUserDefaults standardUserDefaults] integerForKey:@"EventSource"]) { case 2: // Doesn't combine with any other sources NSLog(@"Using Private Event Source"); vncSourceRef = CGEventSourceCreate(kCGEventSourceStatePrivate); break; case 1: // Combines only with other User Session Events NSLog(@"Using Combined Event Source, WARNING: Doesn't work if we FUS off-screen (10.5.1)"); vncSourceRef = CGEventSourceCreate(kCGEventSourceStateCombinedSessionState); break; case 0: // Combines with Physical Keyboard NSLog(@"Using HID Event Source, WARNING: Doesn't allow keys if we FUS off-screen (10.5.7)"); vncSourceRef = CGEventSourceCreate(kCGEventSourceStateHIDSystemState); break; case 3: // I am pretty sure works similar to the HID default: vncSourceRef = NULL; break; } if (!vncSourceRef) NSLog(@"No Event Source -- Using 10.3 API"); // Event Taps represent at what level of the input manager the events will be interpretted switch ([[NSUserDefaults standardUserDefaults] integerForKey:@"EventTap"]) { case 3: { if (isConsoleSession()) { NSLog(@"Using Smart Event Tap -- HID for console user"); vncTapLocation = kCGHIDEventTap; } else { NSLog(@"Using Smart Event Tap -- Session for off-screen user"); vncTapLocation = kCGSessionEventTap; } [[NSWorkspace sharedWorkspace].notificationCenter addObserver:self selector:@selector(userSwitchedIn:) name: NSWorkspaceSessionDidBecomeActiveNotification object:nil]; [[NSWorkspace sharedWorkspace].notificationCenter addObserver:self selector:@selector(userSwitchedOut:) name: NSWorkspaceSessionDidResignActiveNotification object:nil]; break; } case 2: NSLog(@"Using Annotated Session Event Tap"); vncTapLocation = kCGAnnotatedSessionEventTap; break; case 1: // At this level will can passed in modifiers // it will ignore physical keyboard state // it will NOT impact physical keyboard state NSLog(@"Using Session Event Tap"); vncTapLocation = kCGSessionEventTap; break; case 0: default: // At this level will ignore passed in modifiers // it will combine with the physical keyboard state (CapsLock, etc) // it WILL impact physical keyboard state NSLog(@"Using HID Event Tap"); vncTapLocation = kCGHIDEventTap; break; } } - (void) loadUnicodeKeyboard { if ([[NSUserDefaults standardUserDefaults] boolForKey:@"UnicodeKeyboard"] && unicodeInputSource == NULL) { // Need to figure out a way to lookup the Unicode Keyboard before this will work // OSStatus result = KLGetKeyboardLayoutWithIdentifier([[NSUserDefaults standardUserDefaults] integerForKey:@"UnicodeKeyboardIdentifier"], &unicodeLayout); // * Use TISCreateInputSourceList API to create a list of input // * sources that match specified properties, such as the //* kTISPropertyInputSourceID property. // Unicode Keyboard Should load keys from definition pressModsForKeys = YES; [self loadKeyboard:unicodeInputSource]; } } - (void) userSwitchedIn: (NSNotification *) aNotification { NSLog(@"User Switched In, Using HID Tap - %@", aNotification.name); vncTapLocation = kCGHIDEventTap; return; } - (void) userSwitchedOut: (NSNotification *) aNotification { NSLog(@"User Switched Out, Using Session Tap - %@", aNotification.name); vncTapLocation = kCGSessionEventTap; return; } - (void) rfbConnect { if (unicodeInputSource != NULL && !dynamicKeyboard) { currentInputSource = TISCopyCurrentKeyboardInputSource(); // Switch to Unicode Keyboard SyncSetKeyboardLayout(unicodeInputSource); } } - (void) rfbDisconnect { if (unicodeInputSource != NULL && !dynamicKeyboard) { // Switch to Old Keyboard SyncSetKeyboardLayout(currentInputSource); } } - (void) rfbUsage { printf( "-keyboardLoading flag This feature allows OSXvnc to look at the users selected keyboard\n" " and map keystrokes using it. Disabling this returns OSXvnc to\n" " standard (U.S. Keyboard) which will work better with dead keys.\n" " (default: no)\n" "-pressModsForKeys flag If OSXvnc finds the key you want it will temporarily toggle the modifier keys to produce it.\n" " This flag works well if you have different keyboards on the local and remote machines.\n" " Only works if -keyboardLoading is on.\n" " (default: yes)\n" "-bonjour flag Allow OSXvnc to advertise VNC server using Bonjour discovery services.\n" " 'VNC' will enable the service named VNC (For Eggplant & Chicken 2.02b).\n" " 'Both' or '2' will enable the services named RFB and VNC.\n" " (default: RFB:YES VNC:NO)\n" "-ipv4 Listen for connections on IPv4 only (default: off)\n" "-ipv6 Listen for connections on IPv6 only (default: off)\n" ); } - (void) rfbPoll { // Check if keyboardLayoutRef has changed if (keyboardLoading) { TISInputSourceRef currentKeyboardLayoutRef = TISCopyCurrentKeyboardLayoutInputSource(); if (currentKeyboardLayoutRef != loadedKeyboardRef) { loadedKeyboardRef = currentKeyboardLayoutRef; [self loadKeyboard: loadedKeyboardRef]; } } #if 0 if (0 && vncTapLocation == kCGHIDEventTap) { CGEventFlags newModifiers = 0; if (CGEventSourceKeyState(kCGEventSourceStateHIDSystemState,keyCodeShift)) newModifiers |= kCGEventFlagMaskShift; if (CGEventSourceKeyState(kCGEventSourceStateHIDSystemState,keyCodeOption)) newModifiers |= kCGEventFlagMaskAlternate; if (CGEventSourceKeyState(kCGEventSourceStateHIDSystemState,keyCodeControl)) newModifiers |= kCGEventFlagMaskControl; if (CGEventSourceKeyState(kCGEventSourceStateHIDSystemState,keyCodeCommand)) newModifiers |= kCGEventFlagMaskControl; currentModifiers = newModifiers; } #endif return; } - (void) rfbShutdown { [rfbService stop]; [vncService stop]; } // Mouse handling code - (void) handleMouseButtons:(int) buttonMask atPoint:(NSPoint) aPoint forClient: (rfbClientPtr) cl { rfbUndim(); if (buttonMask & rfbWheelMask) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSUserDefaults *currentUserDefs = [[NSUserDefaults alloc] initWithUser:NSUserName()]; int mouseWheelDistance; // I would rather cache this data than look it up each time but I don't know how to get notification of a change // A - User changes his setting in SysPrefs // B - Running OSXvnc as root and user swiches mouseWheelDistance = 8 * [currentUserDefs floatForKey:@"com.apple.scrollwheel.scaling"]; [currentUserDefs dealloc]; if (!mouseWheelDistance) mouseWheelDistance = 10; if (buttonMask & rfbWheelUpMask) { CGEventRef scrollEvent = CGEventCreateScrollWheelEvent(NULL, kCGScrollEventUnitPixel, 1, mouseWheelDistance); CGEventPost(vncTapLocation, scrollEvent); CFRelease(scrollEvent); } if (buttonMask & rfbWheelDownMask) { CGEventRef scrollEvent = CGEventCreateScrollWheelEvent(NULL, kCGScrollEventUnitPixel, 1, -mouseWheelDistance); CGEventPost(vncTapLocation, scrollEvent); CFRelease(scrollEvent); } [pool release]; } else { cl->clientCursorLocation.x = aPoint.x; cl->clientCursorLocation.y = aPoint.y; // Tricky here -- new events need to specify up, down and dragged, not just button state. //CGEventCreateMouseEvent(NULL, NX_OMOUSEDRAGGED, CGPointMake(x,y), kCGMouseButtonCenter) if (cl->swapMouseButtons23) CGPostMouseEvent(cl->clientCursorLocation, TRUE, 3, (buttonMask & rfbButton1Mask) ? TRUE : FALSE, (buttonMask & rfbButton3Mask) ? TRUE : FALSE, (buttonMask & rfbButton2Mask) ? TRUE : FALSE); else CGPostMouseEvent(cl->clientCursorLocation, TRUE, 3, (buttonMask & rfbButton1Mask) ? TRUE : FALSE, (buttonMask & rfbButton2Mask) ? TRUE : FALSE, (buttonMask & rfbButton3Mask) ? TRUE : FALSE); } } // Keyboard handling code - (void) handleKeyboard:(Bool) down forSym: (KeySym) keySym forClient: (rfbClientPtr) cl { CGKeyCode keyCode = keyTable[(unsigned short)keySym]; CGEventFlags modifiersToSend = 0; rfbUndim(); // If we can't locate the keycode then we will use the special OPTION+4 HEX coding that is available on the Unicode HexInput Keyboard if (keyCode == 0xFFFF) { if (down && unicodeInputSource != NULL) { unsigned short mask=0xF000; int rightShift; CGEventFlags oldModifiers = currentModifiers; // Switch to Unicode Keyboard if (dynamicKeyboard) { currentInputSource = TISCopyCurrentKeyboardInputSource(); SyncSetKeyboardLayout(unicodeInputSource); } modifiersToSend = kCGEventFlagMaskAlternate | kCGEventFlagMaskNonCoalesced; [self setKeyModifiers: modifiersToSend]; for (rightShift = 12; rightShift >= 0; rightShift-=4) { short unidigit = (keySym & mask) >> rightShift; [self sendKeyEvent:unicodeNumbersToKeyCodes[unidigit] down:1 modifiers:modifiersToSend]; [self sendKeyEvent:unicodeNumbersToKeyCodes[unidigit] down:0 modifiers:modifiersToSend]; mask >>= 4; } [self setKeyModifiers: oldModifiers]; // Switch to Old Keyboard if (dynamicKeyboard) SyncSetKeyboardLayout(currentInputSource); } } else { BOOL isModifierKey = (XK_Shift_L <= keySym && keySym <= XK_Hyper_R); if (isModifierKey) { // Mark the key state for the client, we'll release down keys later cl->modiferKeys[keyCode] = down; // Record them in our "currentModifiers" switch (keySym) { case XK_Shift_L: case XK_Shift_R: if (down) currentModifiers |= kCGEventFlagMaskShift; else currentModifiers &= ~kCGEventFlagMaskShift; break; case XK_Control_L: case XK_Control_R: if (down) currentModifiers |= kCGEventFlagMaskControl; else currentModifiers &= ~kCGEventFlagMaskControl; break; case XK_Meta_L: case XK_Meta_R: if (down) currentModifiers |= kCGEventFlagMaskAlternate; else currentModifiers &= ~kCGEventFlagMaskAlternate; break; case XK_Alt_L: case XK_Alt_R: if (down) currentModifiers |= kCGEventFlagMaskCommand; else currentModifiers &= ~kCGEventFlagMaskCommand; break; } [self sendKeyEvent:keyCode down:down modifiers:currentModifiers]; } else { if (pressModsForKeys) { if (keyTableMods[keySym] != 0xFF) { // Setup the state of the appropriate keys based on the value in the KeyTableMods CGEventFlags oldModifiers = currentModifiers; CGEventFlags modifiersToSend = kCGEventFlagMaskNonCoalesced; if ((keyTableMods[keySym] << 8) & shiftKey) modifiersToSend |= kCGEventFlagMaskShift; if ((keyTableMods[keySym] << 8) & optionKey) modifiersToSend |= kCGEventFlagMaskAlternate; if ((keyTableMods[keySym] << 8) & controlKey) modifiersToSend |= kCGEventFlagMaskControl; // Treat command key separately (not as part of the generation string) modifiersToSend |= (currentModifiers & kCGEventFlagMaskCommand); [self setKeyModifiers: modifiersToSend]; [self sendKeyEvent:keyCode down:down modifiers:modifiersToSend]; // Back to current depressed state [self setKeyModifiers: oldModifiers]; } else { // Not Modified (special keys, other modifiers) [self sendKeyEvent:keyCode down:down modifiers:currentModifiers]; } } else { CGEventFlags oldModifiers = currentModifiers; CGEventFlags modifiersToSend = kCGEventFlagMaskNonCoalesced | (cl->modiferKeys[keyCodeShift] ? kCGEventFlagMaskShift : 0) | (cl->modiferKeys[keyCodeControl] ? kCGEventFlagMaskControl : 0) | (cl->modiferKeys[keyCodeOption] ? kCGEventFlagMaskAlternate : 0) | (cl->modiferKeys[keyCodeCommand] ? kCGEventFlagMaskCommand : 0); [self setKeyModifiers: modifiersToSend]; [self sendKeyEvent:keyCode down:down modifiers:modifiersToSend]; [self setKeyModifiers: oldModifiers]; } } } } - (void) releaseModifiersForClient: (rfbClientPtr) cl { [self setKeyModifiers: 0]; } - (void) setKeyModifiers: (CGEventFlags) modifierFlags { // If it's a session tap (and we have an event source) then we can specify our own modifiers as part of the event (nothing to do here) // Otherwise we will have to explicitly twiddle them at the HID level based on their current state if (vncTapLocation == kCGHIDEventTap || !vncSourceRef) { // Toggle the state of the appropriate keys if ((currentModifiers & kCGEventFlagMaskCommand) != (modifierFlags & kCGEventFlagMaskCommand)) { [self sendKeyEvent:keyCodeCommand down:((modifierFlags & kCGEventFlagMaskCommand) != 0) modifiers:0]; } if ((currentModifiers & kCGEventFlagMaskShift) != (modifierFlags & kCGEventFlagMaskShift)) { [self sendKeyEvent:keyCodeShift down:((modifierFlags & kCGEventFlagMaskShift) != 0) modifiers:0]; } if ((currentModifiers & kCGEventFlagMaskAlternate) != (modifierFlags & kCGEventFlagMaskAlternate)) { [self sendKeyEvent:keyCodeOption down:((modifierFlags & kCGEventFlagMaskAlternate) != 0) modifiers:0]; } if ((currentModifiers & kCGEventFlagMaskControl) != (modifierFlags & kCGEventFlagMaskControl)) { [self sendKeyEvent:keyCodeControl down:((modifierFlags & kCGEventFlagMaskControl) != 0) modifiers:0]; } if (modifierDelay) usleep(modifierDelay); } currentModifiers = modifierFlags; } - (BOOL) checkModiferState { CGEventFlags actualFlags = CGEventSourceFlagsState(CGEventSourceGetSourceStateID(vncSourceRef)); BOOL match = YES; if ((actualFlags & kCGEventFlagMaskCommand) != (currentModifiers & kCGEventFlagMaskCommand) || (actualFlags & kCGEventFlagMaskShift) != (currentModifiers & kCGEventFlagMaskShift) || (actualFlags & kCGEventFlagMaskAlternate) != (currentModifiers & kCGEventFlagMaskAlternate) || (actualFlags & kCGEventFlagMaskControl) != (currentModifiers & kCGEventFlagMaskControl)) { match = NO; //NSLog(@"Actual(%0x) did not match Recorded (%0x)", actualFlags & 0xffffffff, currentModifiers & 0xffffffff); } return match; } - (void) sendKeyEvent: (CGKeyCode) keyCode down: (BOOL) down modifiers: (CGEventFlags) modifiersToSend { if (!vncSourceRef) { CGEventRef event = CGEventCreateKeyboardEvent(NULL, keyCode, down); CGEventPost(vncTapLocation, event); //CGPostKeyboardEvent(0, keyCode, down); CFRelease(event); } else { CGEventRef event = CGEventCreateKeyboardEvent(vncSourceRef, keyCode, down); // The value of this function escapes me (since you still need to specify the keyCode for it to work // CGEventKeyboardSetUnicodeString (event, 1, (const UniChar *) &keySym); // If it's a session tap then we can specify our own modifiers as part of the event if (vncTapLocation != kCGHIDEventTap) CGEventSetFlags(event, modifiersToSend); CGEventPost(vncTapLocation, event); if (vncTapLocation == kCGHIDEventTap) { int maxWait = 250000; // 1/4 second // NEED TO WAIT UNTIL MODIFIER FLAGS REFLECT THE EXPECTED STATE while ([self checkModiferState] == NO && maxWait > 0) { maxWait -= 10000; usleep(10000); } } CFRelease(event); } } - (void) setupIPv6: argument { int listen_fd6=0, client_fd=0; int value=1; // Need to pass a ptr to this struct sockaddr_in6 sin6, peer6; unsigned int len6=sizeof(sin6); bzero(&sin6, sizeof(sin6)); sin6.sin6_len = sizeof(sin6); sin6.sin6_family = AF_INET6; sin6.sin6_port = htons(theServer->rfbPort); if (theServer->rfbLocalhostOnly) sin6.sin6_addr = in6addr_loopback; else sin6.sin6_addr = in6addr_any; if ((listen_fd6 = socket(PF_INET6, SOCK_STREAM, 0)) < 0) { NSLog(@"IPv6: Unable to open socket"); } /* else if (fcntl(listen_fd6, F_SETFL, O_NONBLOCK) < 0) { NSLog(@"IPv6: fcntl O_NONBLOCK failed"); } */ else if (setsockopt(listen_fd6, IPPROTO_IPV6, IPV6_V6ONLY, &value, sizeof(value)) < 0) { NSLog(@"IPv6: setsockopt IPV6_V6ONLY failed"); } else if (setsockopt(listen_fd6, SOL_SOCKET, SO_REUSEADDR, &value, sizeof(value)) < 0) { NSLog(@"IPv6: setsockopt SO_REUSEADDR failed"); } else if (bind(listen_fd6, (struct sockaddr *) &sin6, len6) < 0) { NSLog(@"IPv6: Failed to Bind Socket: Port %d may be in use by another VNC", theServer->rfbPort); } else if (listen(listen_fd6, 5) < 0) { NSLog(@"IPv6: Listen failed"); } else { NSLog(@"Started listener thread on IPv6 port %d", theServer->rfbPort); listenerFinished = TRUE; while ((client_fd = accept(listen_fd6, (struct sockaddr *) &peer6, &len6)) !=-1) { NSAutoreleasePool *pool=[[NSAutoreleasePool alloc] init]; [[NSNotificationCenter defaultCenter] postNotification: [NSNotification notificationWithName:@"NewRFBClient" object:@(client_fd)]]; // We have to trigger a signal so the event loop will pickup (if no clients are connected) pthread_cond_signal(&(theServer->listenerGotNewClient)); [pool release]; } NSLog(@"IPv6: Accept failed %d", errno); } listenerFinished = TRUE; return; } - (void) registerRendezvous { NSAutoreleasePool *tempPool = [[NSAutoreleasePool alloc] init]; BOOL loadRendezvousVNC = NO; BOOL loadRendezvousRFB = YES; NSUInteger argumentIndex = [[NSProcessInfo processInfo].arguments indexOfObject:@"-rendezvous"]; RendezvousDelegate *rendezvousDelegate = [[RendezvousDelegate alloc] init]; if (argumentIndex == NSNotFound) { argumentIndex = [[NSProcessInfo processInfo].arguments indexOfObject:@"-bonjour"]; } if (argumentIndex != NSNotFound) { NSString *value = nil; if ([NSProcessInfo processInfo].arguments.count > argumentIndex + 1) value = [NSProcessInfo processInfo].arguments[argumentIndex+1]; if ([value hasPrefix:@"n"] || [value hasPrefix:@"N"] || [value hasPrefix:@"0"]) { loadRendezvousVNC = NO; loadRendezvousRFB = NO; } else if ([value hasPrefix:@"y"] || [value hasPrefix:@"Y"] || [value hasPrefix:@"1"] || [value hasPrefix:@"rfb"]) { loadRendezvousVNC = NO; loadRendezvousRFB = YES; } else if ([value hasPrefix:@"b"] || [value hasPrefix:@"B"] || [value hasPrefix:@"2"]) { loadRendezvousVNC = YES; loadRendezvousRFB = YES; } else if ([value hasPrefix:@"vnc"]) { loadRendezvousVNC = YES; loadRendezvousRFB = NO; } } // Register For Rendezvous if (loadRendezvousRFB) { rfbService = [[NSNetService alloc] initWithDomain:@"" type:@"_rfb._tcp." name:@(theServer->desktopName) port:(int) theServer->rfbPort]; rfbService.delegate = rendezvousDelegate; [rfbService publish]; } // else // NSLog(@"Bonjour (_rfb._tcp) - Disabled"); if (loadRendezvousVNC) { vncService = [[NSNetService alloc] initWithDomain:@"" type:@"_vnc._tcp." name:@(theServer->desktopName) port:(int) theServer->rfbPort]; vncService.delegate = rendezvousDelegate; [vncService publish]; } // else // NSLog(@"Bonjour (_vnc._tcp) - Disabled"); [tempPool release]; } - (void) rfbReceivedClientMessage { return; } - (void) userSwitched: (NSNotification *) aNotification { NSLog(@"User Switched Restarting - %@", aNotification.name); sleep(10); rfbShutdown(); exit(2); } - (void) clientConnected: (NSNotification *) aNotification { NSLog(@"New IPv6 Client Notification - %@", aNotification.name); rfbStartClientWithFD([aNotification.object intValue]); } - (void) connectHost: (NSNotification *) aNotification { NSAutoreleasePool *pool=[[NSAutoreleasePool alloc] init]; char *reverseHost = (char *)[aNotification.userInfo[@"ConnectHost"] UTF8String]; int reversePort = [aNotification.userInfo[@"ConnectPort"] intValue]; NSLog(@"Connecting VNC Client %s(%d)",reverseHost,reversePort); connectReverseClient(reverseHost,reversePort); [pool release]; } @end @implementation RendezvousDelegate // Sent when the service is about to publish - (void)netServiceWillPublish:(NSNetService *)netService { NSLog(@"Registering Bonjour Service(%@) - %@", netService.type, netService.name); } // Sent if publication fails - (void)netService:(NSNetService *)netService didNotPublish:(NSDictionary *)errorDict { NSLog(@"An error occurred with service %@.%@.%@, error code = %@", netService.name, netService.type, netService.domain, errorDict[NSNetServicesErrorCode]); } // Sent when the service stops - (void)netServiceDidStop:(NSNetService *)netService { NSLog(@"Disabling Bonjour Service - %@", netService.name); // You may want to do something here, such as updating a user interfac } @end ================================================ FILE: OSXvnc-server/auth.c ================================================ /* * auth.c - deal with authentication. * * This file implements the VNC authentication protocol when setting up an RFB * connection. */ /* * Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge. * All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #import #include #include #include "rfb.h" Bool allowNoAuth = FALSE; NSLock *authClientLock=nil; NSMutableDictionary *authClientFailures=nil; static char *storedPass; static bool suppliedPass; int rfbMaxLoginAttempts=5; char *rfbAuthPasswdFile = NULL; void rfbAuthInit(void) { authClientLock=[[NSLock alloc] init]; authClientFailures=[[NSMutableDictionary alloc] init]; } int failedAttemptsForClient(rfbClientPtr cl) { NSString *clientHost = [[NSString alloc] initWithCString:cl->host encoding:NSUTF8StringEncoding]; int failedAttempts=0; [authClientLock lock]; failedAttempts = [authClientFailures[clientHost] intValue]; [authClientLock unlock]; [clientHost release]; return failedAttempts; } int incrementFailedAttemptsForClient(rfbClientPtr cl) { NSString *clientHost = [[NSString alloc] initWithCString:cl->host encoding:NSUTF8StringEncoding]; NSNumber *failedNumber; int failedAttempts=0; [authClientLock lock]; failedAttempts = [authClientFailures[clientHost] intValue] + 1; failedNumber = [[NSNumber alloc] initWithInt:failedAttempts]; authClientFailures[clientHost] = failedNumber; [authClientLock unlock]; [failedNumber release]; [clientHost release]; return failedAttempts; } void clearFailedAttemptsForClient(rfbClientPtr cl) { NSString *clientHost = [[NSString alloc] initWithCString:cl->host encoding:NSUTF8StringEncoding]; [authClientLock lock]; [authClientFailures removeObjectForKey:clientHost]; [authClientLock unlock]; [clientHost release]; } void rfbSecurityResultMessage(rfbClientPtr cl, int result, char *errorString) { if (result==rfbVncAuthOK) { CARD32 authResult = Swap32IfLE(result); if (WriteExact(cl, (char *)&authResult, 4) < 0) { rfbLogPerror("rfbSecurityResultMessage: write"); rfbCloseClient(cl); } } else { int len=0; char buf[256]; // For Error Messages *(CARD32 *)&buf[len] = Swap32IfLE(result); len+=4; if ((cl->major == 3) && (cl->minor >= 8)) { // Return Error String size_t errorLength = strlen(errorString); *(CARD32 *)&buf[len] = Swap32IfLE(errorLength); len+=4; memcpy(&buf[len], errorString, errorLength); len+=errorLength; } rfbLog(errorString); if (WriteExact(cl, buf, len) < 0) { rfbLogPerror("rfbSecurityResultMessage: write"); rfbCloseClient(cl); } } } /* * rfbAuthNewClient is called when we reach the point of authenticating * a new client. If authentication isn't being used then we simply send * rfbNoAuth. Otherwise we send rfbVncAuth plus the challenge. */ void rfbAuthNewClient(rfbClientPtr cl) { char buf[4 + CHALLENGESIZE+256];// 256 for error messages int len = 0; if (cl->major== 3 && cl->minor >= 7) { if (rfbMaxLoginAttempts && (failedAttemptsForClient(cl) > rfbMaxLoginAttempts)) { buf[0] = 0; // Record Failure len+=1; char *errorString = "Too Many Security Failures"; size_t errorLength = strlen(errorString); *(CARD32 *)&buf[len] = Swap32IfLE(errorLength); len+=4; memcpy(&buf[len], errorString, errorLength); len+=errorLength; if (WriteExact(cl, buf, len) < 0) { rfbLogPerror("rfbAuthNewClient: write"); } rfbLog("rfbAuthNewClient: authentication failed from %s (too many failures)", cl->host); rfbCloseClient(cl); return; } // One byte for the # of Auth Types len++; /** JAMF AUTH **/ if (0) { buf[len++] = rfbJAMF; cl->state = RFB_AUTH_VERSION; } else if (0) { buf[len++] = rfbUltra; cl->state = RFB_AUTH_VERSION; } else if ((!cl->reverseConnection && rfbAuthPasswdFile) || suppliedPass) { buf[len++] = rfbVncAuth; cl->state = RFB_AUTH_VERSION; } else if (cl->reverseConnection || allowNoAuth) { buf[len++] = rfbNoAuth; cl->state = RFB_AUTH_VERSION; //RFB_INITIALISATION; } buf[0] = (len-1); // Record How Many Auth Types in the first byte if (len == 1) { // if we disable no-auth, for example char *errorString = "No Supported Security Types"; size_t errorLength = strlen(errorString); *(CARD32 *)&buf[len] = Swap32IfLE(errorLength); len+=4; memcpy(&buf[len], errorString, errorLength); len+=errorLength; } if (WriteExact(cl, buf, len) < 0) { rfbLogPerror("rfbAuthNewClient: write"); rfbCloseClient(cl); return; } } else { if (rfbMaxLoginAttempts && (failedAttemptsForClient(cl) > rfbMaxLoginAttempts)) { buf[0] = Swap32IfLE(rfbConnFailed); // Record Failure len+=4; char *errorString = "Too Many Security Failures"; size_t errorLength = strlen(errorString); *(CARD32 *)&buf[len] = Swap32IfLE(errorLength); len+=4; memcpy(&buf[len], errorString, errorLength); len+=errorLength; if (WriteExact(cl, buf, len) < 0) { rfbLogPerror("rfbAuthNewClient: write"); } rfbLog("rfbAuthNewClient: authentication failed from %s (too many failures)", cl->host); rfbCloseClient(cl); return; } // If We have a password file specified - Send Challenge Request if ((!cl->reverseConnection && rfbAuthPasswdFile) || suppliedPass) { *(CARD32 *)buf = Swap32IfLE(rfbVncAuth); vncRandomBytes(cl->authChallenge); len+=4; memcpy(&buf[len], cl->authChallenge, CHALLENGESIZE); len+=CHALLENGESIZE; cl->state = RFB_AUTHENTICATION; } // Otherwise just send NO auth else if (cl->reverseConnection || allowNoAuth) { *(CARD32 *)buf = Swap32IfLE(rfbNoAuth); len = 4; cl->state = RFB_INITIALISATION; } else { rfbLogPerror("No Authentication Types Enabled"); rfbCloseClient(cl); return; } if (WriteExact(cl, buf, len) < 0) { rfbLogPerror("rfbAuthNewClient: write"); rfbCloseClient(cl); return; } } } //init password from commandline bool enterSuppliedPassword(char *passIn){ NSString *newPass = @(passIn); if (newPass.length > 0) { storedPass = passIn; suppliedPass = true; } return suppliedPass; } void rfbProcessAuthVersion(rfbClientPtr cl) { int n; CARD8 securityType; if ((n = ReadExact(cl, (char *) &securityType, 1)) <= 0) { if (n != 0) rfbLogPerror("rfbProcessAuthVersion: read"); rfbCloseClient(cl); return; } switch (securityType) { case rfbVncAuth: { char buf[CHALLENGESIZE]; int len = 0; vncRandomBytes(cl->authChallenge); memcpy(buf, cl->authChallenge, CHALLENGESIZE); len = CHALLENGESIZE; if (WriteExact(cl, buf, len) < 0) { rfbLogPerror("rfbProcessAuthVersion: write"); rfbCloseClient(cl); return; } cl->state = RFB_AUTHENTICATION; break; } case rfbNoAuth: { if (!cl->reverseConnection && rfbAuthPasswdFile) { rfbLog("rfbProcessAuthVersion: invalid authorization type from %s", cl->host); rfbSecurityResultMessage(cl, rfbVncAuthFailed, "Invalid Security Type"); rfbCloseClient(cl); return; } else { if ((cl->major == 3) && (cl->minor >= 8)) rfbSecurityResultMessage(cl, rfbVncAuthOK, NULL); cl->state = RFB_INITIALISATION; } break; } default: rfbLog("rfbProcessAuthVersion: invalid authorization type from %s", cl->host); rfbSecurityResultMessage(cl, rfbVncAuthFailed, "Invalid Security Type"); rfbCloseClient(cl); return; } } /* * rfbAuthProcessClientMessage is called when the client sends its * authentication response. */ void rfbAuthProcessClientMessage(rfbClientPtr cl) { char *passwd; int i, n; CARD8 response[CHALLENGESIZE]; if ((n = ReadExact(cl, (char *)response, CHALLENGESIZE)) <= 0) { if (n != 0) rfbLogPerror("rfbAuthProcessClientMessage: read"); rfbCloseClient(cl); return; } if (!suppliedPass) { passwd = vncDecryptPasswdFromFile(rfbAuthPasswdFile); } else { passwd = storedPass; } if (passwd == NULL) { rfbLog("rfbAuthProcessClientMessage: could not access password from %s", rfbAuthPasswdFile); rfbSecurityResultMessage(cl, rfbVncAuthFailed, "Could not access password file"); rfbCloseClient(cl); return; } vncEncryptBytes(cl->authChallenge, passwd); /* Lose the password from memory */ for (i = 0; passwd[i] != '\0'; i++) { passwd[i] = '\0'; } if (!suppliedPass) free(passwd); if (memcmp(cl->authChallenge, response, CHALLENGESIZE) != 0) { incrementFailedAttemptsForClient(cl); rfbLog("rfbAuthProcessClientMessage: authentication failed from %s (incorrect password)", cl->host); rfbSecurityResultMessage(cl, rfbVncAuthFailed, "Incorrect Password"); rfbCloseClient(cl); return; } clearFailedAttemptsForClient(cl); rfbSecurityResultMessage(cl, rfbVncAuthOK, NULL); cl->state = RFB_INITIALISATION; } ================================================ FILE: OSXvnc-server/corre.c ================================================ /* * corre.c * * Routines to implement Compact Rise-and-Run-length Encoding (CoRRE). This * code is based on krw's original javatel rfbserver. */ /* * Copyright (C) 2002 RealVNC Ltd. * OSXvnc Copyright (C) 2001 Dan McGuirk . * Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge. * All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include #include #include "rfb.h" /* * rreBeforeBuf contains pixel data in the client's format. * rreAfterBuf contains the RRE encoded version. If the RRE encoded version is * larger than the raw data or if it exceeds rreAfterBufSize then * raw encoding is used instead. */ static int rreBeforeBufSize = 0; static char *rreBeforeBuf = NULL; static int rreAfterBufSize = 0; static char *rreAfterBuf = NULL; static int rreAfterBufLen; static int subrectEncode8(rfbClientPtr cl, uint8_t *data, int w, int h); static int subrectEncode16(rfbClientPtr cl, uint16_t *data, int w, int h); static int subrectEncode32(rfbClientPtr cl, uint32_t *data, int w, int h); static uint32_t getBgColour(const void *data, size_t size, uint8_t bpp); static Bool rfbSendSmallRectEncodingCoRRE(rfbClientPtr cl, int x, int y, int w, int h); /* * rfbSendRectEncodingCoRRE - send an arbitrary size rectangle using CoRRE * encoding. */ Bool rfbSendRectEncodingCoRRE(rfbClientPtr cl, int x, int y, int w, int h) { if (h > cl->correMaxHeight) { return (rfbSendRectEncodingCoRRE(cl, x, y, w, cl->correMaxHeight) && rfbSendRectEncodingCoRRE(cl, x, y + cl->correMaxHeight, w, h - cl->correMaxHeight)); } if (w > cl->correMaxWidth) { return (rfbSendRectEncodingCoRRE(cl, x, y, cl->correMaxWidth, h) && rfbSendRectEncodingCoRRE(cl, x + cl->correMaxWidth, y, w - cl->correMaxWidth, h)); } return rfbSendSmallRectEncodingCoRRE(cl, x, y, w, h); } /* * rfbSendSmallRectEncodingCoRRE - send a small (guaranteed < 256x256) * rectangle using CoRRE encoding. */ static Bool rfbSendSmallRectEncodingCoRRE(rfbClientPtr cl, int x, int y, int w, int h) { rfbFramebufferUpdateRectHeader rect; rfbRREHeader hdr; int nSubrects; int i; char *fbptr = (cl->scalingFrameBuffer + (cl->scalingPaddedWidthInBytes * y) + (x * (rfbScreen.bitsPerPixel / 8))); int maxRawSize = (rfbScreen.width * rfbScreen.height * (cl->format.bitsPerPixel / 8)); if (rreBeforeBufSize < maxRawSize) { rreBeforeBufSize = maxRawSize; if (rreBeforeBuf == NULL) rreBeforeBuf = (char *)xalloc(rreBeforeBufSize); else rreBeforeBuf = (char *)xrealloc(rreBeforeBuf, rreBeforeBufSize); } if (rreAfterBufSize < maxRawSize) { rreAfterBufSize = maxRawSize; if (rreAfterBuf == NULL) rreAfterBuf = (char *)xalloc(rreAfterBufSize); else rreAfterBuf = (char *)xrealloc(rreAfterBuf, rreAfterBufSize); } (*cl->translateFn)(cl->translateLookupTable, &rfbServerFormat, &cl->format, fbptr, rreBeforeBuf, cl->scalingPaddedWidthInBytes, w, h); switch (cl->format.bitsPerPixel) { case 8: nSubrects = subrectEncode8(cl, (uint8_t *)rreBeforeBuf, w, h); break; case 16: nSubrects = subrectEncode16(cl, (uint16_t *)rreBeforeBuf, w, h); break; case 32: nSubrects = subrectEncode32(cl, (uint32_t *)rreBeforeBuf, w, h); break; default: rfbLog("getBgColour: bpp %d?", cl->format.bitsPerPixel); exit(1); } if (nSubrects < 0) { /* RRE encoding was too large, use raw */ return rfbSendRectEncodingRaw(cl, x, y, w, h); } cl->rfbRectanglesSent[rfbEncodingCoRRE]++; cl->rfbBytesSent[rfbEncodingCoRRE] += (sz_rfbFramebufferUpdateRectHeader + sz_rfbRREHeader + rreAfterBufLen); if (cl->ublen + sz_rfbFramebufferUpdateRectHeader + sz_rfbRREHeader > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } rect.r.x = Swap16IfLE(x); rect.r.y = Swap16IfLE(y); rect.r.w = Swap16IfLE(w); rect.r.h = Swap16IfLE(h); rect.encoding = Swap32IfLE(rfbEncodingCoRRE); memcpy(&cl->updateBuf[cl->ublen], &rect, sz_rfbFramebufferUpdateRectHeader); cl->ublen += sz_rfbFramebufferUpdateRectHeader; hdr.nSubrects = Swap32IfLE(nSubrects); memcpy(&cl->updateBuf[cl->ublen], &hdr, sz_rfbRREHeader); cl->ublen += sz_rfbRREHeader; for (i = 0; i < rreAfterBufLen;) { int bytesToCopy = UPDATE_BUF_SIZE - cl->ublen; if (i + bytesToCopy > rreAfterBufLen) { bytesToCopy = rreAfterBufLen - i; } memcpy(&cl->updateBuf[cl->ublen], &rreAfterBuf[i], bytesToCopy); cl->ublen += bytesToCopy; i += bytesToCopy; if (cl->ublen == UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } } return TRUE; } /* * subrectEncode() encodes the given multicoloured rectangle as a background * colour overwritten by single-coloured rectangles. It returns the number * of subrectangles in the encoded buffer, or -1 if subrect encoding won't * fit in the buffer. It puts the encoded rectangles in rreAfterBuf. The * single-colour rectangle partition is not optimal, but does find the biggest * horizontal or vertical rectangle top-left anchored to each consecutive * coordinate position. * * The coding scheme is simply [...] where each * is []. */ #define DEFINE_SUBRECT_ENCODE(bpp) \ static int \ subrectEncode##bpp(rfbClientPtr _cl, uint##bpp##_t *data, int w, int h) \ { \ uint##bpp##_t cl; \ rfbCoRRERectangle subrect; \ int x,y; \ int i,j; \ int hx=0,hy,vx=0,vy; \ int hyflag; \ uint##bpp##_t *seg; \ uint##bpp##_t *line; \ int hw,hh,vw,vh; \ int thex,they,thew,theh; \ int numsubs = 0; \ int newLen; \ uint##bpp##_t bg = (uint##bpp##_t)getBgColour(data, w * h, bpp); \ \ *((uint##bpp##_t*)rreAfterBuf) = bg; \ \ rreAfterBufLen = (bpp/8); \ \ for (y=0; y 0) && (i >= hx)) {hy += 1;} else {hyflag = 0;} \ } \ vy = j-1; \ \ /* We now have two possible subrects: (x,y,hx,hy) and (x,y,vx,vy) \ * We'll choose the bigger of the two. \ */ \ hw = hx-x+1; \ hh = hy-y+1; \ vw = vx-x+1; \ vh = vy-y+1; \ \ thex = x; \ they = y; \ \ if ((hw*hh) > (vw*vh)) { \ thew = hw; \ theh = hh; \ } else { \ thew = vw; \ theh = vh; \ } \ \ subrect.x = thex; \ subrect.y = they; \ subrect.w = thew; \ subrect.h = theh; \ \ newLen = rreAfterBufLen + (bpp/8) + sz_rfbCoRRERectangle; \ if ((newLen > (w * h * (bpp/8))) || (newLen > rreAfterBufSize)) \ return -1; \ \ numsubs += 1; \ *((uint##bpp##_t*)(rreAfterBuf + rreAfterBufLen)) = cl; \ rreAfterBufLen += (bpp/8); \ memcpy(&rreAfterBuf[rreAfterBufLen],&subrect,sz_rfbCoRRERectangle); \ rreAfterBufLen += sz_rfbCoRRERectangle; \ \ /* \ * Now mark the subrect as done. \ */ \ for (j=they; j < (they+theh); j++) { \ for (i=thex; i < (thex+thew); i++) { \ data[j*w+i] = bg; \ } \ } \ } \ } \ } \ \ return numsubs; \ } DEFINE_SUBRECT_ENCODE(8) DEFINE_SUBRECT_ENCODE(16) DEFINE_SUBRECT_ENCODE(32) /* * getBgColour() gets the most prevalent colour in a byte array. */ static uint32_t getBgColour(const void *data, size_t size, uint8_t bpp) { static unsigned counts[256]; size_t j; unsigned maxcount = 0; uint8_t maxclr = 0; if (bpp != 8) { if (bpp == 16) { return ((uint16_t *)data)[0]; } else if (bpp == 32) { return ((uint32_t *)data)[0]; } else { rfbLog("getBgColour: bpp %d?",bpp); exit(1); } } memset(counts, 0, sizeof(counts)); for (j=0; j maxcount) { maxcount = counts[k]; maxclr = ((uint8_t *)data)[j]; } } return maxclr; } ================================================ FILE: OSXvnc-server/cutpaste.c ================================================ /* * cutpaste.c - routines to deal with cut & paste buffers / selection. */ /* * OSXvnc Copyright (C) 2001 Dan McGuirk . * Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge. * All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #import #include #include #include "rfb.h" #include "getMACAddress.h" // This prevents us from asking if this represents a local file #define VineRemoteProxy @"VineRemoteProxy" #define CorePasteboardFlavor_furl @"CorePasteboardFlavorType 0x6675726C" #define CorePasteboardFlavor_icns @"CorePasteboardFlavorType 0x69636E73" #define CorePasteboardFlavor_ut16 @"CorePasteboardFlavorType 0x75743136" #define CorePasteboardFlavor_ustl @"CorePasteboardFlavorType 0x7573746C" #define CorePasteboardFlavor_TEXT @"CorePasteboardFlavorType 0x54455854" #define CorePasteboardFlavor_styl @"CorePasteboardFlavorType 0x7374796C" #define CorePasteboardFlavor_fccc @"CorePasteboardFlavorType 0x66636363" #define CorePasteboardFlavor_flst @"CorePasteboardFlavorType 0xC46C7374" #ifndef NSAppKitVersionNumber10_3 #define NSAppKitVersionNumber10_3 743 #endif @interface NSFileManager (RSFileManagerAdditions) - (BOOL)ensureDirectoryAtPath:(NSString *)path attributes:(NSDictionary *)attributes; @end @implementation NSFileManager (RSFileManagerAdditions) - (BOOL)ensureDirectoryAtPath:(NSString *)path attributes:(NSDictionary *)attributes { NSString *parentDirectory; BOOL isDir = NO; path = path.stringByStandardizingPath; if ([self fileExistsAtPath:path isDirectory:&isDir]) { if (!isDir && [path isEqualToString:@"/tmp"]) return YES; // work around craziness return isDir; // if it's already there, we succeed iff it's a directory } parentDirectory = path.stringByDeletingLastPathComponent; if (parentDirectory && ![parentDirectory isEqualToString:@""]) { BOOL parentExists = [self fileExistsAtPath:parentDirectory isDirectory:&isDir]; if (parentExists || [self ensureDirectoryAtPath:parentDirectory attributes:attributes]) { return [self createDirectoryAtPath:path withIntermediateDirectories: NO attributes:attributes error:NULL]; } else { return NO; // failed to find or create parent directory } } else { return NO; // failed to create parent directory } } @end @interface NSData (RSDataAdditions) - (NSUInteger) locationOfData:(NSData *)target startingAtLocation:(NSUInteger)startLoc; - (NSMutableArray *) dataComponentsSeparatedByData:(NSData *)separator; @end @implementation NSData (RSDataAdditions) - (NSUInteger) locationOfData:(NSData *)target startingAtLocation:(NSUInteger)startLoc { char *myBytes = (char *)self.bytes; char *targetBytes = (char *)target.bytes; NSUInteger targetLen = target.length; NSUInteger loc, inner; for (loc = startLoc; loc+targetLen < self.length; loc++) { BOOL found = YES; // assume we will match at this loc until disproven for (inner = 0; found && inner < targetLen; inner++) { if (*(myBytes+loc+inner) != *(targetBytes+inner)) found = NO; // nope } if (found) return loc; } return NSNotFound; } - (NSMutableArray *) dataComponentsSeparatedByData:(NSData *)separator { NSMutableArray *array = [NSMutableArray array]; NSUInteger prevLoc = 0; NSUInteger nextLoc = [self locationOfData:separator startingAtLocation:0]; while (nextLoc != NSNotFound) { [array addObject:[self subdataWithRange:NSMakeRange(prevLoc, nextLoc - prevLoc)]]; prevLoc = nextLoc + separator.length; nextLoc = [self locationOfData:separator startingAtLocation:prevLoc]; } if (prevLoc <= self.length) // add the final section (use '<=' to get an empty data if separator was found at the end) [array addObject:[self subdataWithRange:NSMakeRange(prevLoc, self.length - prevLoc)]]; return array; } @end @interface NSClipboardProxy : NSObject { rfbClientPtr clientPointer; NSString *pasteboardName; } - initWithClientPtr: (rfbClientPtr) cl; - (void) setPasteboardName: pbName; - (void) removeClient; - (void) setupTypes: (NSArray *) availableTypes; - (void) pasteboard:(NSPasteboard *)thePasteboard provideDataForType:(NSString *)type; @end static BOOL debugPB = NO; @implementation NSClipboardProxy - initWithClientPtr: (rfbClientPtr) cl { if (self = [super init]) { clientPointer = cl; } return self; } - (void) setPasteboardName: pbName { [pasteboardName release]; pasteboardName = [pbName retain]; } - (void) setupTypes:(NSArray *) availableTypes { NSPasteboard *thePasteboard = [NSPasteboard pasteboardWithName:pasteboardName]; if (debugPB) NSLog(@"Registering Types With Pasteboard"); NSInteger newChangeCount = [thePasteboard declareTypes:[availableTypes arrayByAddingObject:VineRemoteProxy] owner:self]; // Don't send it back to the same client via rich clipboards pthread_mutex_lock(&clientPointer->updateMutex); ((NSMutableDictionary *)clientPointer->richClipboardChangeCounts)[pasteboardName] = @(newChangeCount); pthread_mutex_unlock(&clientPointer->updateMutex); } // Sent by the PB system when someone requests the data (now time to ask for it) // Happens in the main thread, should setup the data to be written, alert client send thread, wait for response and return it - (void)pasteboard:(NSPasteboard *)thePasteboard provideDataForType:(NSString *)type { time_t startTime=time(NULL); if (!clientPointer) return; pthread_mutex_lock(&clientPointer->updateMutex); // Notify sending thread of request clientPointer->richClipboardReceivedName = [thePasteboard.name retain]; clientPointer->richClipboardReceivedType = [type retain]; pthread_mutex_unlock(&clientPointer->updateMutex); pthread_cond_signal(&clientPointer->updateCond); // which will call rfbSendRichClipboardRequest // Wait for flag indicating returned data while (clientPointer && !clientPointer->richClipboardReceivedNSData && (time(NULL) - startTime < 60)) { // 60 second timeout usleep(.10 * 1000000); } if (!clientPointer) return; if (clientPointer->richClipboardReceivedChangeCount >= 0) { NSString *availableType = clientPointer->richClipboardReceivedType; NSData *pasteboardData = clientPointer->richClipboardReceivedNSData; if ([availableType hasPrefix:@"RSFileWrapper:"]) { // special file data availableType = [availableType substringFromIndex:14]; if ([availableType isEqualToString:NSFileContentsPboardType]) { [thePasteboard setData:pasteboardData forType:availableType]; //clipBoardReceivedChangeCount = lastChangeCount; } else { // not FileContents NSFileWrapper *theWrapper = [[NSFileWrapper alloc] initWithSerializedRepresentation:pasteboardData]; // create path to file(s) in /tmp NSFileManager *fileManager = [NSFileManager defaultManager]; if (!clientPointer->receivedFileTempFolder) { clientPointer->receivedFileTempFolder = [[@"/tmp/Vine-" stringByAppendingString:[NSProcessInfo processInfo].globallyUniqueString] retain]; [fileManager ensureDirectoryAtPath:clientPointer->receivedFileTempFolder attributes:nil]; } // write the files NSString *filename = theWrapper.preferredFilename; BOOL setOfFiles = [filename isEqualToString:@""]; if (setOfFiles) { filename = [@"Files-" stringByAppendingString:[NSProcessInfo processInfo].globallyUniqueString]; } filename = [(NSString *)clientPointer->receivedFileTempFolder stringByAppendingPathComponent:filename]; // get full path // set pasteboard data to point to the files if (setOfFiles) { // got a set of files -- put their local names on PB as NSFilenamesPboardType NSMutableArray *filenames = [NSMutableArray array]; if (floor(NSAppKitVersionNumber) > floor(NSAppKitVersionNumber10_3)) { // Tiger+ NSDictionary *filesDict = theWrapper.fileWrappers; NSEnumerator *fileEnum = [filesDict keyEnumerator]; NSString *aFilename; while (aFilename = [fileEnum nextObject]) { [filenames addObject:[filename stringByAppendingPathComponent:aFilename]]; } [theWrapper writeToFile:filename atomically:NO updateFilenames:NO]; filename = filenames[0]; // this is needed for setting the URL later (must be set to one of the files, not the folder) } else { // for 10.2 and 10.3, can't receive multiple files -- put them in a folder static int batchCounter = 0; filename = [filename stringByAppendingPathComponent:[NSString stringWithFormat:@"CopiedFiles_%02d",++batchCounter]]; [fileManager ensureDirectoryAtPath:filename attributes:nil]; [filenames addObject:filename]; //[theWrapper writeToFile:filename atomically:NO updateFilenames:NO]; // let's avoid saving the extra .tiff files that seem to get written for each file NSDictionary *filesDict = theWrapper.fileWrappers; NSEnumerator *fileEnum = [filesDict keyEnumerator]; NSString *aFilename; while (aFilename = [fileEnum nextObject]) { NSFileWrapper *singleItemWrapper = filesDict[aFilename]; NSString *singleItemPath = [filename stringByAppendingPathComponent:aFilename]; [singleItemWrapper writeToFile:singleItemPath atomically:NO updateFilenames:NO]; } } [thePasteboard setPropertyList:filenames forType:NSFilenamesPboardType]; //clipBoardReceivedChangeCount = lastChangeCount; } else if ([availableType isEqualToString:NSFilenamesPboardType]) { // Filenames type sent, but only got 1 file [theWrapper writeToFile:filename atomically:NO updateFilenames:YES]; [thePasteboard setPropertyList:@[filename] forType:NSFilenamesPboardType]; //clipBoardReceivedChangeCount = lastChangeCount; } else { [theWrapper writeToFile:filename atomically:NO updateFilenames:YES]; } if ([availableType isEqualToString:NSURLPboardType] || [availableType isEqualToString:CorePasteboardFlavor_furl]) { // got a URL type -- so put a URL on the PB, even if we already supplied file names NSURL *theUrl = [NSURL fileURLWithPath:filename]; //[theUrl writeToPasteboard:thePasteboard]; NSData *theData = [theUrl.absoluteString dataUsingEncoding:NSUTF8StringEncoding]; [thePasteboard setData:theData forType:availableType]; //clipBoardReceivedChangeCount = lastChangeCount; } else if (![availableType isEqualToString:NSFilenamesPboardType]) { // ERROR NSLog(@"Error: received data type: %@", availableType); } } } else if (pasteboardData) { // not RSFileWrapper [thePasteboard setData:pasteboardData forType:availableType]; //clipBoardReceivedChangeCount = lastChangeCount; } } else { // Error occurred NSString *errorString = [[NSString alloc] initWithData:clientPointer->richClipboardReceivedNSData encoding:NSUTF8StringEncoding]; NSLog(@"%@", errorString); [errorString release]; }; if (clientPointer) { pthread_mutex_lock(&clientPointer->updateMutex); [(id)clientPointer->richClipboardReceivedNSData release]; clientPointer->richClipboardReceivedNSData = nil; [(id)clientPointer->richClipboardReceivedType release]; clientPointer->richClipboardReceivedType = nil; pthread_mutex_unlock(&clientPointer->updateMutex); } } - (void) removeClient { clientPointer = NULL; // Would be nice to tell our PB that we aren't valid } - (void)pasteboardChangedOwner:(NSPasteboard *)sender { if (clientPointer) { pthread_mutex_lock(&clientPointer->updateMutex); clientPointer->clipboardProxy = nil; pthread_mutex_unlock(&clientPointer->updateMutex); } [self autorelease]; } @end // Currently there is a problem when OSXvnc is run PRIOR to the pbs (which starts when a user logs in) // the OSXvnc process is NOT connected to the pbs port - this is an OS X security measure which we aren't certain // how to work around // We might be able to register with the port later // Restart VNC on login (of course this kills sessions) // or spawn a little agent at login -- modify the /etc/ttys and add a -LoginHook process // or possibly run with -inetd...hmmm... // This is the global VNC change count NSRecursiveLock *pasteboardLock = nil; // Used to lock access to pasteboardString, clientCutText and pasteboards array NSRecursiveLock *pasteboardVariablesLock = nil; NSString *pasteboardString = nil; NSString *clientCutText = nil; NSMutableDictionary *pasteboards = nil; unsigned long long maxTransferSize = 0x10000000; // Each Pasteboard has an array with item 0 = the ChangeCount and item 1 = the AvailableTypes Array static int generalPBLastChangeCount=-1; NSStringEncoding pasteboardStringEncoding = NSWindowsCP1252StringEncoding; // RFBProto 003.008 void initPasteboard(void) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; pasteboardLock = [[NSRecursiveLock alloc] init]; pasteboardVariablesLock = [[NSRecursiveLock alloc] init]; if (![NSPasteboard generalPasteboard]) { rfbLog("Pasteboard Inaccessible - Pasteboard sharing disabled"); [pasteboardVariablesLock lock]; // Record first in case another event comes in after notifying clients generalPBLastChangeCount = 0; [pasteboardString release]; pasteboardString = [[NSString alloc] initWithString:@"\e\e"]; [pasteboardVariablesLock unlock]; rfbDisableRichClipboards = TRUE; } else { NSArray *pbNames = @[NSGeneralPboard, NSRulerPboard, NSFontPboard, NSFindPboard, NSDragPboard]; NSEnumerator *objEnum = [pbNames objectEnumerator]; NSString *aPasteboard = nil; pasteboards = [[NSMutableDictionary alloc] init]; while (aPasteboard = [objEnum nextObject]) { // Each Pasteboard has an array with item 0 = the ChangeCount and item 1 = the AvailableTypes Array pasteboards[aPasteboard] = [NSMutableArray arrayWithObjects:@0, [NSArray array], nil]; } [[NSUserDefaults standardUserDefaults] registerDefaults: @{@"MaxFileTransferSize": @0x10000000ULL}]; maxTransferSize = [[[NSUserDefaults standardUserDefaults] objectForKey:@"MaxFileTransferSize"] unsignedLongLongValue]; debugPB = [[NSUserDefaults standardUserDefaults] boolForKey:@"DebugPB"]; } if (floor(NSAppKitVersionNumber) <= floor(NSAppKitVersionNumber10_1)) rfbDisableRichClipboards = TRUE; [pool release]; } void initPasteboardForClient(rfbClientPtr cl) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; /* REDSTONE - Have new client keep his PB currently */ cl->generalPBLastChange = -1; cl->richClipboardChangeCounts = [[NSMutableDictionary alloc] init]; cl->clipboardProxy = nil; cl->richClipboardName = nil; cl->richClipboardType = nil; cl->richClipboardNSData = nil; cl->richClipboardReceivedName = nil; cl->richClipboardReceivedType = nil; cl->richClipboardReceivedNSData = nil; cl->receivedFileTempFolder = nil; [pool release]; } void freePasteboardForClient(rfbClientPtr cl) { [(NSClipboardProxy *) cl->clipboardProxy removeClient]; [(NSString *)cl->receivedFileTempFolder release]; [(NSMutableDictionary *)cl->richClipboardChangeCounts release]; } // This notifies us that the VNCclient set some new pasteboard void rfbSetCutText(rfbClientPtr cl, char *str, int len) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; if (generalPBLastChangeCount != 0) { cl->generalPBLastChange = -1; [pasteboardVariablesLock lock]; [clientCutText release]; clientCutText = [[NSString alloc] initWithData:[NSData dataWithBytes:str length:len] encoding: pasteboardStringEncoding]; [pasteboardVariablesLock unlock]; // we'll stall until it gets picked up by the main thread while (clientCutText) usleep(10000); } [pool release]; } static BOOL pasteboardRepresentsExistingFile(NSPasteboard *thePasteboard) { NSArray *pboardTypes = thePasteboard.types; if ([pboardTypes containsObject:NSFilenamesPboardType]) { NSArray *fileNames = [thePasteboard propertyListForType:NSFilenamesPboardType]; NSFileManager *fileManager = [NSFileManager defaultManager]; int index; for (index = 0; index < fileNames.count; index++) { if ([fileManager fileExistsAtPath:fileNames[index]]) { return YES; // at least one of the files exists } } } else if ([pboardTypes containsObject:CorePasteboardFlavor_flst]) { return YES; // don't try to parse it all here -- just assume it represents actual files } else if ([pboardTypes containsObject:VineRemoteProxy]) { // In this case we do NOT want to go to the next test, it can lead to a deadlock... // where the main thread tries to pull the data from client thread // while the client thread waits for the main thread to determine if we have new data return NO; } else if ([pboardTypes containsObject:NSURLPboardType]) { NSURL *theUrl = [NSURL URLFromPasteboard:thePasteboard]; if (theUrl.fileURL) { return [[NSFileManager defaultManager] fileExistsAtPath:theUrl.path]; } } return NO; } static NSArray *arrayFromFlstData(NSData *flstData) { NSArray *fileArray = [flstData dataComponentsSeparatedByData:[@"seldtype" dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES]]; int fileIndex, componentIndex; NSMutableArray *pathArray = [NSMutableArray array]; BOOL error = NO; if ([flstData locationOfData:[@"dle2" dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES] startingAtLocation:0] != 0) { if (debugPB) NSLog(@"PROBLEM: flst data doesn't start with 'dle2' !!"); error = YES; } for (fileIndex = 1; !error && fileIndex < fileArray.count; fileIndex++) { // (note: start at 1 -- ignore first chunk) NSArray *componentArray = [fileArray[fileIndex] dataComponentsSeparatedByData: [@"nameseld" dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES]]; NSString *filePath = @"/"; for (componentIndex = 1; componentIndex < componentArray.count; componentIndex++) { // (note: start at 1 -- ignore first chunk) NSData *componentData = componentArray[componentIndex]; if ([componentData locationOfData:[@"utxt" dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES] startingAtLocation:0] != 0) { if (debugPB) NSLog(@"PROBLEM: flst component doesn't start with 'utxt' !!"); error = YES; break; } unsigned char high, low; high = *(unsigned char *)(componentData.bytes+6); low = *(unsigned char *)(componentData.bytes+7); unsigned short len = 256*high + low; NSData *subdata = [componentData subdataWithRange:NSMakeRange(8,len)]; NSString *componentStr = [[NSString alloc] initWithData:subdata encoding:NSUnicodeStringEncoding]; filePath = [filePath stringByAppendingPathComponent:componentStr]; [componentStr release]; } [pathArray addObject:filePath]; } return pathArray; } static NSArray *getListOfFilenamesFromPasteboard(NSPasteboard *thePasteboard) { NSArray *pboardTypes = thePasteboard.types; if ([pboardTypes containsObject:CorePasteboardFlavor_flst]) { // 10.2 & 10.3 NSData *flstData = [thePasteboard dataForType:CorePasteboardFlavor_flst]; return arrayFromFlstData(flstData); //pathArray; } else { return nil; } } // We call this in the main thread to see if we have a new pasteboard change and should notify clients to do an update void rfbCheckForPasteboardChange(void) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSEnumerator *pasteboardsEnum = [pasteboards keyEnumerator]; NSString *pasteboardName = nil; [pasteboardVariablesLock lock]; // Protect references to clientCutText NS_DURING if (clientCutText) { if ([[NSPasteboard generalPasteboard] declareTypes:@[NSStringPboardType] owner:nil]) { [[NSPasteboard generalPasteboard] setString:clientCutText forType:NSStringPboardType]; } [clientCutText release]; clientCutText = nil; }; NS_HANDLER NSLog(@"Problem Writing Cut Text To Pasteboard: %@", localException); NS_ENDHANDLER [pasteboardVariablesLock unlock]; // First Let's see if we have new info on the pasteboard - if so we'll send an update to each client if (generalPBLastChangeCount != [NSPasteboard generalPasteboard].changeCount) { rfbClientPtr cl; rfbClientIteratorPtr iterator = rfbGetClientIterator(); // Let's grab a copy of it here in the Main/Event Thread so that the output threads don't have to deal with the PB directly if ([[NSPasteboard generalPasteboard] availableTypeFromArray:@[NSStringPboardType]]) { [pasteboardVariablesLock lock]; // Record first in case another event comes in after notifying clients generalPBLastChangeCount = (int)[NSPasteboard generalPasteboard].changeCount; [pasteboardString release]; pasteboardString = [[[NSPasteboard generalPasteboard] stringForType:NSStringPboardType] copy]; [pasteboardVariablesLock unlock]; } // Notify each client while ((cl = rfbClientIteratorNext(iterator)) != NULL) { if (!cl->richClipboardSupport) pthread_cond_signal(&cl->updateCond); } rfbReleaseClientIterator(iterator); } // Check EACH pasteboard by name to see if it has new data while (pasteboardName = [pasteboardsEnum nextObject]) { NSMutableArray *pbInfoArray = pasteboards[pasteboardName]; NSPasteboard *thePasteboard = [NSPasteboard pasteboardWithName:pasteboardName]; // Record the change count first in case another event comes in while we are pulling the Types NSInteger pasteboardsChangeCount = thePasteboard.changeCount; [pasteboardVariablesLock lock]; if ([pbInfoArray[0] intValue] != pasteboardsChangeCount) { // Check for special file types (URL for a local file, or NSFilenamesPboardType for an existing file) NSArray *pboardTypes = thePasteboard.types; pbInfoArray[0] = @(pasteboardsChangeCount); if (!pboardTypes.count) { if (debugPB) NSLog(@"Warning - Pasteboard with no types, ignored"); [pasteboardVariablesLock unlock]; continue; } pboardTypes = [pboardTypes arrayByAddingObject:[NSString stringWithFormat:@"RSPBID:%@:%@", NSUserName(), getMACAddressString()]]; if (![pboardTypes containsObject:NSFileContentsPboardType]) { // no need to check, if file contents is already there if (pasteboardRepresentsExistingFile(thePasteboard)) { pboardTypes = [pboardTypes arrayByAddingObject:NSFileContentsPboardType]; if (![pboardTypes containsObject:CorePasteboardFlavor_fccc]) { pboardTypes = [pboardTypes arrayByAddingObject:CorePasteboardFlavor_fccc]; } if (![pboardTypes containsObject:NSFilenamesPboardType]) { pboardTypes = [pboardTypes arrayByAddingObject:NSFilenamesPboardType]; } if (![pboardTypes containsObject:CorePasteboardFlavor_furl]) { pboardTypes = [pboardTypes arrayByAddingObject:CorePasteboardFlavor_furl]; } } } pbInfoArray[1] = pboardTypes; { rfbClientPtr cl; rfbClientIteratorPtr iterator = rfbGetClientIterator(); // Notify each client while ((cl = rfbClientIteratorNext(iterator)) != NULL) { if (cl->richClipboardSupport) pthread_cond_signal(&cl->updateCond); } rfbReleaseClientIterator(iterator); } } [pasteboardVariablesLock unlock]; } [pool release]; } static void rfbSendRichClipboardAck(rfbClientPtr cl) { struct { CARD8 type; /* always rfbServerCutText */ CARD8 pad1; CARD16 pad2; CARD32 pbChangeCount; CARD32 pbNameLength; } rfbServerRichPasteboardInfo; rfbServerRichPasteboardInfo.type = rfbRichClipboardAvailable; rfbServerRichPasteboardInfo.pbChangeCount = 0; rfbServerRichPasteboardInfo.pbNameLength = 0; if (WriteExact(cl, (char *)&rfbServerRichPasteboardInfo, sizeof(rfbServerRichPasteboardInfo)) < 0) { rfbLogPerror("rfbSendRichClipboardAck: write"); rfbCloseClient(cl); } } static void rfbSendRichClipboardAvailable(rfbClientPtr cl, NSString *pasteboardNameString, NSArray *pbInfoArray) { struct { CARD8 type; CARD8 pad1; CARD16 pad2; int pbChangeCount; CARD32 pbNameLength; } rfbServerRichPasteboardInfo; char *pasteboardName = (char *)pasteboardNameString.UTF8String; char *pbTypesListString = (char *)[pbInfoArray[1] componentsJoinedByString:@"\t"].UTF8String; CARD32 typesArrayLength = Swap32IfLE(strlen(pbTypesListString)); if (debugPB) NSLog(@"Sending CB Available [%s] Types: %@", pasteboardName, pbInfoArray[1]); rfbServerRichPasteboardInfo.type = rfbRichClipboardAvailable; rfbServerRichPasteboardInfo.pbChangeCount = [pbInfoArray[0] intValue]; rfbServerRichPasteboardInfo.pbNameLength = Swap32IfLE(strlen(pasteboardName)); if (WriteExact(cl, (char *)&rfbServerRichPasteboardInfo, sizeof(rfbServerRichPasteboardInfo)) < 0) { rfbLogPerror("rfbSendServerNewPasteboardInfo: write"); rfbCloseClient(cl); } /* followed by char text[pbNameLength] */ if (WriteExact(cl, pasteboardName, strlen(pasteboardName)) < 0) { rfbLogPerror("rfbSendServerNewPasteboardInfo: write"); rfbCloseClient(cl); } // Length of pbTypesListString if (WriteExact(cl, (char *)&typesArrayLength, sizeof(typesArrayLength)) < 0) { rfbLogPerror("rfbSendServerNewPasteboardInfo: write"); rfbCloseClient(cl); } /* followed by char text[typesArrayLength] */ if (WriteExact(cl, pbTypesListString, strlen(pbTypesListString)) < 0) { rfbLogPerror("rfbSendServerNewPasteboardInfo: write"); rfbCloseClient(cl); } } void rfbSendRichClipboardRequest(rfbClientPtr cl) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; struct { char messageType; char padding1; char padding2; char padding3; int changeCount; } requestRichClipboardInfo; const char *stringToSend; int stringLength; if (debugPB) NSLog(@"Sending CB Request [%@] Types: %@", cl->richClipboardReceivedName, cl->richClipboardReceivedType); requestRichClipboardInfo.messageType=rfbRichClipboardRequest; requestRichClipboardInfo.padding1=0; requestRichClipboardInfo.padding2=0; requestRichClipboardInfo.padding3=0; requestRichClipboardInfo.changeCount=htonl(-1); // -1 to indicate we don't care about a specific request WriteExact(cl, (char *)&requestRichClipboardInfo, sizeof(requestRichClipboardInfo)); stringToSend = [(id)cl->richClipboardReceivedName UTF8String]; stringLength = htonl(strlen(stringToSend)); WriteExact(cl, (char *)&stringLength, sizeof(stringLength)); WriteExact(cl, (char *)stringToSend, ntohl(stringLength)); stringToSend = [(id)cl->richClipboardReceivedType UTF8String]; stringLength = htonl(strlen(stringToSend)); WriteExact(cl, (char *)&stringLength, sizeof(stringLength)); WriteExact(cl, (char *)stringToSend, ntohl(stringLength)); [(id)cl->richClipboardReceivedName release]; cl->richClipboardReceivedName = nil; [(id)cl->richClipboardReceivedType release]; cl->richClipboardReceivedType = nil; [pool release]; } static void rfbSendRichClipboardData(rfbClientPtr cl) { struct { CARD8 type; /* always rfbServerCutText */ CARD8 pad1; CARD16 pad2; int pbChangeCount; CARD32 pbNameLength; } rfbServerRichPasteboardInfo; CARD32 sendLength; if (debugPB) NSLog(@"Sending CB Data [%s] Type: %s", cl->richClipboardName, cl->richClipboardType); rfbServerRichPasteboardInfo.type = rfbRichClipboardData; rfbServerRichPasteboardInfo.pbChangeCount = Swap32IfLE(cl->richClipboardDataChangeCount); rfbServerRichPasteboardInfo.pbNameLength = Swap32IfLE(strlen(cl->richClipboardName)); if (WriteExact(cl, (char *)&rfbServerRichPasteboardInfo, sizeof(rfbServerRichPasteboardInfo)) < 0) { rfbLogPerror("rfbSendServerNewPasteboardInfo: write"); rfbCloseClient(cl); } /* followed by char text[pbNameLength] */ if (WriteExact(cl, cl->richClipboardName, strlen(cl->richClipboardName)) < 0) { rfbLogPerror("rfbSendServerNewPasteboardInfo: write"); rfbCloseClient(cl); } // Length of cl->richClipboardName sendLength = Swap32IfLE(strlen(cl->richClipboardType)); if (WriteExact(cl, (char *)&sendLength, sizeof(sendLength)) < 0) { rfbLogPerror("rfbSendServerNewPasteboardInfo: write"); rfbCloseClient(cl); } /* followed by char text[typesArrayLength] */ if (WriteExact(cl, cl->richClipboardType, strlen(cl->richClipboardType)) < 0) { rfbLogPerror("rfbSendServerNewPasteboardInfo: write"); rfbCloseClient(cl); } // Length of pasteboard data sendLength = Swap32IfLE([(NSData *)cl->richClipboardNSData length]); if (WriteExact(cl, (char *)&sendLength, sizeof(sendLength)) < 0) { rfbLogPerror("rfbSendServerNewPasteboardInfo: write"); rfbCloseClient(cl); } /* followed by char text[dataLength] */ if (WriteExact(cl, (char *)((NSData *)cl->richClipboardNSData).bytes, ((NSData *)cl->richClipboardNSData).length) < 0) { rfbLogPerror("rfbSendServerNewPasteboardInfo: write"); rfbCloseClient(cl); } xfree(cl->richClipboardName); cl->richClipboardName = NULL; xfree(cl->richClipboardType); cl->richClipboardType = NULL; [(NSData *)cl->richClipboardNSData release]; cl->richClipboardNSData = nil; } // Each client output thread will come here to get the PB and send it, we HAVE the updateLock at this time void rfbClientUpdatePasteboard(rfbClientPtr cl) { // They must have passed initialization and be in the Normal operational mode if (cl->state == RFB_NORMAL) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; if (cl->richClipboardNSData != NULL) rfbSendRichClipboardData(cl); if (cl->richClipboardReceivedName != NULL) rfbSendRichClipboardRequest(cl); // New clients don't get the latest clipboard, they keep their own if (cl->generalPBLastChange == -1) { cl->generalPBLastChange = generalPBLastChangeCount; } // Client Identified that it supports Rich Clipboards // Send the acknowledgement but no clipboard data else if (cl->generalPBLastChange == -3) { NSEnumerator *pasteboardsEnum = [pasteboards keyEnumerator]; NSString *pasteboardName = nil; rfbSendRichClipboardAck(cl); [pasteboardVariablesLock lock]; // Protect references to pasteboards cl->generalPBLastChange = generalPBLastChangeCount; while (pasteboardName = [pasteboardsEnum nextObject]) { NSMutableArray *pbInfoArray = pasteboards[pasteboardName]; ((NSMutableDictionary *)cl->richClipboardChangeCounts)[pasteboardName] = pbInfoArray[0]; } [pasteboardVariablesLock unlock]; // Protect references to pasteboards } else { if (cl->richClipboardSupport) { NSEnumerator *pasteboardsEnum = [pasteboards keyEnumerator]; NSString *pasteboardName = nil; [pasteboardVariablesLock lock]; // Protect references to pasteboards while (pasteboardName = [pasteboardsEnum nextObject]) { NSMutableArray *pbInfoArray = pasteboards[pasteboardName]; int changeCountForPasteboard = [((NSDictionary *)cl->richClipboardChangeCounts)[pasteboardName] intValue]; if (changeCountForPasteboard < [pbInfoArray[0] intValue]) { if (changeCountForPasteboard != -1) rfbSendRichClipboardAvailable(cl, pasteboardName, pbInfoArray); ((NSMutableDictionary *)cl->richClipboardChangeCounts)[pasteboardName] = pbInfoArray[0]; } } [pasteboardVariablesLock unlock]; // Protect references to pasteboards } else { [pasteboardVariablesLock lock]; NS_DURING if (cl->generalPBLastChange != generalPBLastChangeCount && pasteboardString) { NSData *encodedString = [pasteboardString dataUsingEncoding:pasteboardStringEncoding allowLossyConversion:YES]; if (encodedString.length) rfbSendServerCutText(cl, (char *) encodedString.bytes, encodedString.length); cl->generalPBLastChange = generalPBLastChangeCount; }; NS_HANDLER NS_ENDHANDLER [pasteboardVariablesLock unlock]; } } [pool release]; } } // Receive Thread void rfbReceiveRichClipboardAvailable(rfbClientPtr cl) { NSAutoreleasePool *myPool = [[NSAutoreleasePool alloc] init]; char *readString; unsigned int stringLength; int pbChangeCount; NSString *pasteboardName = nil; NSArray *availableTypes = nil; int returnCheck; ReadExact(cl, ((char *)&pbChangeCount), 3); ReadExact(cl, ((char *)&pbChangeCount), 4); // Right now we don't really care or store this value, // We if we wanted more explicit tracking of what gets returned pbChangeCount = Swap32IfLE(pbChangeCount); // Pasteboard Name ReadExact(cl, (char *)&stringLength, 4); stringLength = Swap32IfLE(stringLength); readString = (char *) xalloc(stringLength+1); readString[stringLength] = 0; ReadExact(cl, readString, stringLength); pasteboardName = @(readString); xfree(readString); // Type String ReadExact(cl, (char *)&stringLength, 4); stringLength = Swap32IfLE(stringLength); readString = (char *) xalloc(stringLength+1); readString[stringLength] = 0; returnCheck = ReadExact(cl, readString, stringLength); availableTypes = [@(readString) componentsSeparatedByString:@"\t"]; xfree(readString); if (debugPB) NSLog(@"Received CB Available [%@] Types: %@", pasteboardName, availableTypes); if (returnCheck <= 0) { if (returnCheck != 0) rfbLogPerror("rfbReceiveRichClipboardAvailable: read"); rfbCloseClient(cl); } if (!rfbDisableRichClipboards) { if ([availableTypes indexOfObject:[NSString stringWithFormat:@"RSPBID:%@:%@", NSUserName(), getMACAddressString()]] != NSNotFound) { if (debugPB) NSLog(@"Rich clipboard info appears to be from our own account (%@:%@) -- ignored.", NSUserName(), getMACAddressString()); } else /*if (addNewDataToPB)*/ { NSClipboardProxy *newProxy = [[NSClipboardProxy alloc] initWithClientPtr:cl]; [newProxy setPasteboardName: pasteboardName]; pthread_mutex_lock(&cl->updateMutex); //We need to remove ourself as the old proxy's owner at this point, so it doesn't try to request data [(NSClipboardProxy *)cl->clipboardProxy removeClient]; // We do NOT free here, the proxy is freed when the pasteboard system is done using it. // [(NSClipboardProxy *)cl->clipboardProxy release]; cl->clipboardProxy = newProxy; pthread_mutex_unlock(&cl->updateMutex); //if (NSAppKitVersionNumber >= NSAppKitVersionNumber10_2) //We're just disabling rich clipboards below 10.2 NSUInteger flstIndex = [availableTypes indexOfObject:CorePasteboardFlavor_flst]; if (flstIndex != NSNotFound) { availableTypes = [[availableTypes mutableCopy] autorelease]; [(NSMutableArray *)availableTypes removeObjectAtIndex:flstIndex]; // don't declare flst } [newProxy performSelectorOnMainThread:@selector(setupTypes:) withObject:availableTypes waitUntilDone:NO]; } } [myPool release]; return; } void checkTotalSize(unsigned long long *totalSize, NSString *path, NSFileManager *fileManager) { BOOL isDirectory = NO; if ([fileManager fileExistsAtPath:path isDirectory:&isDirectory]) { if (isDirectory) { NSArray *contents = [fileManager contentsOfDirectoryAtPath:path error:NULL]; int index; for (index=0; index maxTransferSize) { [NSException raise:@"Maximum Size Exceeded" format:@"Total size of files being transferred exceeds the maximum allowed."]; } } } } void rfbReceiveRichClipboardRequest(rfbClientPtr cl) { NSAutoreleasePool *myPool = [[NSAutoreleasePool alloc] init]; int pbChangeCount; int readLength; int returnCheck; char *newClipboardName=NULL; char *newClipboardType=NULL; NSData *newClipboardNSData=nil; NSInteger newClipboardDataChangeCount = 0; ReadExact(cl, ((char *)&pbChangeCount), 3); ReadExact(cl, ((char *)&pbChangeCount), 4); pbChangeCount = Swap32IfLE(pbChangeCount); ReadExact(cl, ((char *)&readLength), 4); readLength = Swap32IfLE(readLength); newClipboardName = (char *) xalloc(readLength+1); newClipboardName[readLength] = 0; ReadExact(cl, newClipboardName, readLength); ReadExact(cl, ((char *)&readLength), sizeof(readLength)); readLength = Swap32IfLE(readLength); newClipboardType = (char *) xalloc(readLength+1); newClipboardType[readLength] = 0; returnCheck = ReadExact(cl, newClipboardType, readLength); if (debugPB) NSLog(@"Received CB Request [%s] For type: %s", newClipboardName, newClipboardType); if (returnCheck > 0) { NSPasteboard *thePasteboard = [NSPasteboard pasteboardWithName:[[[NSString alloc] initWithUTF8String:newClipboardName] autorelease]]; NSString *theType = [[[NSString alloc] initWithUTF8String:newClipboardType] autorelease]; // check whether we need to send file contents in place of another type if (([theType isEqualToString:NSFileContentsPboardType] && ![thePasteboard.types containsObject:NSFileContentsPboardType]) || (([theType isEqualToString:NSFilenamesPboardType] || [theType isEqualToString:NSURLPboardType] || [theType isEqualToString:CorePasteboardFlavor_furl]) && pasteboardRepresentsExistingFile(thePasteboard))) { NSFileManager *fileManager = [NSFileManager defaultManager]; NSArray *pboardTypes = thePasteboard.types; NSFileWrapper *theWrapper = nil; unsigned long long totalSize = 0; NS_DURING { if ([pboardTypes containsObject:NSFilenamesPboardType] || [pboardTypes containsObject:CorePasteboardFlavor_flst]) { // unless URL requested, try file names first NSArray *fileNames = [thePasteboard propertyListForType:NSFilenamesPboardType]; if (!fileNames) { fileNames = getListOfFilenamesFromPasteboard(thePasteboard); if (debugPB) NSLog(@"flst list to Send CB Data for filenames: %@", fileNames); } if (fileNames.count == 1) { NSString *path = fileNames[0]; checkTotalSize(&totalSize, path, fileManager); theWrapper = [[[NSFileWrapper alloc] initWithPath:path] autorelease]; } else { int index; NSMutableDictionary *wrappers = [NSMutableDictionary dictionary]; for (index = 0; index < fileNames.count; index++) { NSString *path = fileNames[index]; if ([fileManager fileExistsAtPath:path]) { NSFileWrapper *wrapper = [[[NSFileWrapper alloc] initWithPath:path] autorelease]; checkTotalSize(&totalSize, path, fileManager); if (wrapper) wrappers[path] = wrapper; else // Could possibly put a "dummy file" in place indicating the error NSLog(@"Error Unable To Read File:%@", path); } } theWrapper = [[[NSFileWrapper alloc] initDirectoryWithFileWrappers:wrappers] autorelease]; theWrapper.filename = @""; theWrapper.preferredFilename = @""; } } if (!theWrapper) { // try for a URL next NSURL *theUrl = [NSURL URLFromPasteboard:thePasteboard]; if (theUrl.fileURL) { // only do this for file: url's NSString *path = theUrl.path; if ([fileManager fileExistsAtPath:path]) { checkTotalSize(&totalSize, path, fileManager); theWrapper = [[[NSFileWrapper alloc] initWithPath:path] autorelease]; } } } if (theWrapper) { // finish setting up the wrapper theType = [@"RSFileWrapper:" stringByAppendingString:theType]; newClipboardNSData = [theWrapper.serializedRepresentation retain]; newClipboardDataChangeCount = thePasteboard.changeCount; const char *newTypeStr = theType.UTF8String; xfree(newClipboardType); newClipboardType = (char *) xalloc(strlen(newTypeStr)+1); strcpy(newClipboardType, newTypeStr); } }; NS_HANDLER { newClipboardDataChangeCount = -1; // Indicate an Error newClipboardNSData = [[[NSString stringWithFormat:@"Unable to copy files - %@", localException] dataUsingEncoding:NSUTF8StringEncoding] retain]; }; NS_ENDHANDLER } if (!newClipboardNSData) { newClipboardNSData = [[thePasteboard dataForType:theType] retain]; newClipboardDataChangeCount = thePasteboard.changeCount; if (!newClipboardNSData && [theType isEqualToString:CorePasteboardFlavor_fccc]) { // 10.3 "Copy" Code newClipboardNSData = [[@"copy" dataUsingEncoding:NSUTF8StringEncoding] retain]; } } if (!newClipboardNSData || pbChangeCount >= 0) { newClipboardDataChangeCount = -1; // Indicate an Error newClipboardNSData = [[@"Clipboard Data Unavailable" dataUsingEncoding:NSUTF8StringEncoding] retain]; } // Wait for the send thread to send pending data out (if the client goes away, so does this thread) while (cl->richClipboardNSData) { usleep(.1*1000000); } //Here we protect access to cl->rfbRichClipboard vars pthread_mutex_lock(&cl->updateMutex); if (cl->richClipboardName) xfree(cl->richClipboardName); cl->richClipboardName = newClipboardName; if (cl->richClipboardType) xfree(cl->richClipboardType); cl->richClipboardType = newClipboardType; // [(id)cl->richClipboardNSData release]; cl->richClipboardNSData = newClipboardNSData; cl->richClipboardDataChangeCount = newClipboardDataChangeCount; // Should we note if the ChangeCount is > than our recorded value here? pthread_mutex_unlock(&cl->updateMutex); pthread_cond_signal(&cl->updateCond); } else { if (returnCheck != 0) rfbLogPerror("rfbReceiveRichClipboardDataRequest: read"); rfbCloseClient(cl); } [myPool release]; return; } void rfbReceiveRichClipboardData(rfbClientPtr cl) { NSAutoreleasePool *myPool = [[NSAutoreleasePool alloc] init]; int readLength; int returnCheck; int changeCount; char *readString; ReadExact(cl, ((char *)&changeCount), 3); // Padding ReadExact(cl, ((char *)&changeCount), 4); // Change Count // Pasteboard Name ReadExact(cl, ((char *)&readLength), 4); readLength = Swap32IfLE(readLength); readString = (char *) xalloc(readLength+1); readString[readLength] = 0; ReadExact(cl, readString, readLength); xfree(readString); // Pasteboard Type ReadExact(cl, ((char *)&readLength), sizeof(readLength)); readLength = Swap32IfLE(readLength); readString = (char *) xalloc(readLength+1); readString[readLength] = 0; ReadExact(cl, readString, readLength); // Read Data ReadExact(cl, ((char *)&readLength), sizeof(readLength)); readLength = Swap32IfLE(readLength); NSMutableData *data = [[NSMutableData alloc] initWithLength:readLength]; returnCheck = ReadExact(cl, data.mutableBytes, readLength); if (returnCheck > 0) { if (debugPB) NSLog(@"Received CB Data [%@] Type: %s Length: %d bytes", cl->richClipboardReceivedName, readString, readLength); pthread_mutex_lock(&cl->updateMutex); cl->richClipboardReceivedChangeCount = Swap32IfLE(changeCount); cl->richClipboardReceivedType = [@(readString) retain]; cl->richClipboardReceivedNSData = data; pthread_mutex_unlock(&cl->updateMutex); } else { if (returnCheck != 0) rfbLogPerror("rfbReceiveRichClipboardDataRequest: read"); rfbCloseClient(cl); } xfree(readString); [myPool release]; } ================================================ FILE: OSXvnc-server/d3des.c ================================================ /* * This is D3DES (V5.09) by Richard Outerbridge with the double and * triple-length support removed for use in VNC. Also the bytebit[] array * has been reversed so that the most significant bit in each byte of the * key is ignored, not the least significant. * * These changes are: * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ /* D3DES (V5.09) - * * A portable, public domain, version of the Data Encryption Standard. * * Written with Symantec's THINK (Lightspeed) C by Richard Outerbridge. * Thanks to: Dan Hoey for his excellent Initial and Inverse permutation * code; Jim Gillogly & Phil Karn for the DES key schedule code; Dennis * Ferguson, Eric Young and Dana How for comparing notes; and Ray Lau, * for humouring me on. * * Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge. * (GEnie : OUTER; CIS : [71755,204]) Graven Imagery, 1992. */ #include "d3des.h" static void scrunch(unsigned char *, unsigned long *); static void unscrun(unsigned long *, unsigned char *); static void desfunc(unsigned long *, unsigned long *); static void cookey(unsigned long *); static unsigned long KnL[32] = { 0L }; static const unsigned short bytebit[8] = { 01, 02, 04, 010, 020, 040, 0100, 0200 }; static const unsigned long bigbyte[24] = { 0x800000L, 0x400000L, 0x200000L, 0x100000L, 0x80000L, 0x40000L, 0x20000L, 0x10000L, 0x8000L, 0x4000L, 0x2000L, 0x1000L, 0x800L, 0x400L, 0x200L, 0x100L, 0x80L, 0x40L, 0x20L, 0x10L, 0x8L, 0x4L, 0x2L, 0x1L }; /* Use the key schedule specified in the Standard (ANSI X3.92-1981). */ static const unsigned char pc1[56] = { 56, 48, 40, 32, 24, 16, 8, 0, 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 60, 52, 44, 36, 28, 20, 12, 4, 27, 19, 11, 3 }; static const unsigned char totrot[16] = { 1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28 }; static const unsigned char pc2[48] = { 13, 16, 10, 23, 0, 4, 2, 27, 14, 5, 20, 9, 22, 18, 11, 3, 25, 7, 15, 6, 26, 19, 12, 1, 40, 51, 30, 36, 46, 54, 29, 39, 50, 44, 32, 47, 43, 48, 38, 55, 33, 52, 45, 41, 49, 35, 28, 31 }; void deskey(unsigned char *key, int edf) /* Thanks to James Gillogly & Phil Karn! */ { register int i, j, l, m, n; unsigned char pc1m[56], pcr[56]; unsigned long kn[32]; for ( j = 0; j < 56; j++ ) { l = pc1[j]; m = l & 07; pc1m[j] = (key[l >> 3] & bytebit[m]) ? 1 : 0; } for( i = 0; i < 16; i++ ) { if( edf == DE1 ) m = (15 - i) << 1; else m = i << 1; n = m + 1; kn[m] = kn[n] = 0L; for( j = 0; j < 28; j++ ) { l = j + totrot[i]; if( l < 28 ) pcr[j] = pc1m[l]; else pcr[j] = pc1m[l - 28]; } for( j = 28; j < 56; j++ ) { l = j + totrot[i]; if( l < 56 ) pcr[j] = pc1m[l]; else pcr[j] = pc1m[l - 28]; } for( j = 0; j < 24; j++ ) { if( pcr[pc2[j]] ) kn[m] |= bigbyte[j]; if( pcr[pc2[j+24]] ) kn[n] |= bigbyte[j]; } } cookey(kn); return; } static void cookey(unsigned long *raw1) { register unsigned long *cook, *raw0; unsigned long dough[32]; register int i; cook = dough; for( i = 0; i < 16; i++, raw1++ ) { raw0 = raw1++; *cook = (*raw0 & 0x00fc0000L) << 6; *cook |= (*raw0 & 0x00000fc0L) << 10; *cook |= (*raw1 & 0x00fc0000L) >> 10; *cook++ |= (*raw1 & 0x00000fc0L) >> 6; *cook = (*raw0 & 0x0003f000L) << 12; *cook |= (*raw0 & 0x0000003fL) << 16; *cook |= (*raw1 & 0x0003f000L) >> 4; *cook++ |= (*raw1 & 0x0000003fL); } usekey(dough); return; } void cpkey(unsigned long *into) { unsigned long *from = KnL; unsigned long *endp = &KnL[32]; while (from < endp) { *into++ = *from++; } } void usekey(unsigned long *from) { unsigned long *to = KnL; unsigned long *endp = &KnL[32]; while (to < endp) { *to++ = *from++; } } void des(unsigned char *inblock, unsigned char *outblock) { unsigned long work[2]; scrunch(inblock, work); desfunc(work, KnL); unscrun(work, outblock); } static void scrunch(unsigned char *outof, unsigned long *into) { *into = (*outof++ & 0xffL) << 24; *into |= (*outof++ & 0xffL) << 16; *into |= (*outof++ & 0xffL) << 8; *into++ |= (*outof++ & 0xffL); *into = (*outof++ & 0xffL) << 24; *into |= (*outof++ & 0xffL) << 16; *into |= (*outof++ & 0xffL) << 8; *into |= (*outof & 0xffL); return; } static void unscrun(unsigned long *outof, unsigned char *into) { *into++ = (*outof >> 24) & 0xffL; *into++ = (*outof >> 16) & 0xffL; *into++ = (*outof >> 8) & 0xffL; *into++ = *outof++ & 0xffL; *into++ = (*outof >> 24) & 0xffL; *into++ = (*outof >> 16) & 0xffL; *into++ = (*outof >> 8) & 0xffL; *into = *outof & 0xffL; return; } static unsigned long SP1[64] = { 0x01010400L, 0x00000000L, 0x00010000L, 0x01010404L, 0x01010004L, 0x00010404L, 0x00000004L, 0x00010000L, 0x00000400L, 0x01010400L, 0x01010404L, 0x00000400L, 0x01000404L, 0x01010004L, 0x01000000L, 0x00000004L, 0x00000404L, 0x01000400L, 0x01000400L, 0x00010400L, 0x00010400L, 0x01010000L, 0x01010000L, 0x01000404L, 0x00010004L, 0x01000004L, 0x01000004L, 0x00010004L, 0x00000000L, 0x00000404L, 0x00010404L, 0x01000000L, 0x00010000L, 0x01010404L, 0x00000004L, 0x01010000L, 0x01010400L, 0x01000000L, 0x01000000L, 0x00000400L, 0x01010004L, 0x00010000L, 0x00010400L, 0x01000004L, 0x00000400L, 0x00000004L, 0x01000404L, 0x00010404L, 0x01010404L, 0x00010004L, 0x01010000L, 0x01000404L, 0x01000004L, 0x00000404L, 0x00010404L, 0x01010400L, 0x00000404L, 0x01000400L, 0x01000400L, 0x00000000L, 0x00010004L, 0x00010400L, 0x00000000L, 0x01010004L }; static unsigned long SP2[64] = { 0x80108020L, 0x80008000L, 0x00008000L, 0x00108020L, 0x00100000L, 0x00000020L, 0x80100020L, 0x80008020L, 0x80000020L, 0x80108020L, 0x80108000L, 0x80000000L, 0x80008000L, 0x00100000L, 0x00000020L, 0x80100020L, 0x00108000L, 0x00100020L, 0x80008020L, 0x00000000L, 0x80000000L, 0x00008000L, 0x00108020L, 0x80100000L, 0x00100020L, 0x80000020L, 0x00000000L, 0x00108000L, 0x00008020L, 0x80108000L, 0x80100000L, 0x00008020L, 0x00000000L, 0x00108020L, 0x80100020L, 0x00100000L, 0x80008020L, 0x80100000L, 0x80108000L, 0x00008000L, 0x80100000L, 0x80008000L, 0x00000020L, 0x80108020L, 0x00108020L, 0x00000020L, 0x00008000L, 0x80000000L, 0x00008020L, 0x80108000L, 0x00100000L, 0x80000020L, 0x00100020L, 0x80008020L, 0x80000020L, 0x00100020L, 0x00108000L, 0x00000000L, 0x80008000L, 0x00008020L, 0x80000000L, 0x80100020L, 0x80108020L, 0x00108000L }; static unsigned long SP3[64] = { 0x00000208L, 0x08020200L, 0x00000000L, 0x08020008L, 0x08000200L, 0x00000000L, 0x00020208L, 0x08000200L, 0x00020008L, 0x08000008L, 0x08000008L, 0x00020000L, 0x08020208L, 0x00020008L, 0x08020000L, 0x00000208L, 0x08000000L, 0x00000008L, 0x08020200L, 0x00000200L, 0x00020200L, 0x08020000L, 0x08020008L, 0x00020208L, 0x08000208L, 0x00020200L, 0x00020000L, 0x08000208L, 0x00000008L, 0x08020208L, 0x00000200L, 0x08000000L, 0x08020200L, 0x08000000L, 0x00020008L, 0x00000208L, 0x00020000L, 0x08020200L, 0x08000200L, 0x00000000L, 0x00000200L, 0x00020008L, 0x08020208L, 0x08000200L, 0x08000008L, 0x00000200L, 0x00000000L, 0x08020008L, 0x08000208L, 0x00020000L, 0x08000000L, 0x08020208L, 0x00000008L, 0x00020208L, 0x00020200L, 0x08000008L, 0x08020000L, 0x08000208L, 0x00000208L, 0x08020000L, 0x00020208L, 0x00000008L, 0x08020008L, 0x00020200L }; static unsigned long SP4[64] = { 0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L, 0x00802080L, 0x00800081L, 0x00800001L, 0x00002001L, 0x00000000L, 0x00802000L, 0x00802000L, 0x00802081L, 0x00000081L, 0x00000000L, 0x00800080L, 0x00800001L, 0x00000001L, 0x00002000L, 0x00800000L, 0x00802001L, 0x00000080L, 0x00800000L, 0x00002001L, 0x00002080L, 0x00800081L, 0x00000001L, 0x00002080L, 0x00800080L, 0x00002000L, 0x00802080L, 0x00802081L, 0x00000081L, 0x00800080L, 0x00800001L, 0x00802000L, 0x00802081L, 0x00000081L, 0x00000000L, 0x00000000L, 0x00802000L, 0x00002080L, 0x00800080L, 0x00800081L, 0x00000001L, 0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L, 0x00802081L, 0x00000081L, 0x00000001L, 0x00002000L, 0x00800001L, 0x00002001L, 0x00802080L, 0x00800081L, 0x00002001L, 0x00002080L, 0x00800000L, 0x00802001L, 0x00000080L, 0x00800000L, 0x00002000L, 0x00802080L }; static unsigned long SP5[64] = { 0x00000100L, 0x02080100L, 0x02080000L, 0x42000100L, 0x00080000L, 0x00000100L, 0x40000000L, 0x02080000L, 0x40080100L, 0x00080000L, 0x02000100L, 0x40080100L, 0x42000100L, 0x42080000L, 0x00080100L, 0x40000000L, 0x02000000L, 0x40080000L, 0x40080000L, 0x00000000L, 0x40000100L, 0x42080100L, 0x42080100L, 0x02000100L, 0x42080000L, 0x40000100L, 0x00000000L, 0x42000000L, 0x02080100L, 0x02000000L, 0x42000000L, 0x00080100L, 0x00080000L, 0x42000100L, 0x00000100L, 0x02000000L, 0x40000000L, 0x02080000L, 0x42000100L, 0x40080100L, 0x02000100L, 0x40000000L, 0x42080000L, 0x02080100L, 0x40080100L, 0x00000100L, 0x02000000L, 0x42080000L, 0x42080100L, 0x00080100L, 0x42000000L, 0x42080100L, 0x02080000L, 0x00000000L, 0x40080000L, 0x42000000L, 0x00080100L, 0x02000100L, 0x40000100L, 0x00080000L, 0x00000000L, 0x40080000L, 0x02080100L, 0x40000100L }; static unsigned long SP6[64] = { 0x20000010L, 0x20400000L, 0x00004000L, 0x20404010L, 0x20400000L, 0x00000010L, 0x20404010L, 0x00400000L, 0x20004000L, 0x00404010L, 0x00400000L, 0x20000010L, 0x00400010L, 0x20004000L, 0x20000000L, 0x00004010L, 0x00000000L, 0x00400010L, 0x20004010L, 0x00004000L, 0x00404000L, 0x20004010L, 0x00000010L, 0x20400010L, 0x20400010L, 0x00000000L, 0x00404010L, 0x20404000L, 0x00004010L, 0x00404000L, 0x20404000L, 0x20000000L, 0x20004000L, 0x00000010L, 0x20400010L, 0x00404000L, 0x20404010L, 0x00400000L, 0x00004010L, 0x20000010L, 0x00400000L, 0x20004000L, 0x20000000L, 0x00004010L, 0x20000010L, 0x20404010L, 0x00404000L, 0x20400000L, 0x00404010L, 0x20404000L, 0x00000000L, 0x20400010L, 0x00000010L, 0x00004000L, 0x20400000L, 0x00404010L, 0x00004000L, 0x00400010L, 0x20004010L, 0x00000000L, 0x20404000L, 0x20000000L, 0x00400010L, 0x20004010L }; static unsigned long SP7[64] = { 0x00200000L, 0x04200002L, 0x04000802L, 0x00000000L, 0x00000800L, 0x04000802L, 0x00200802L, 0x04200800L, 0x04200802L, 0x00200000L, 0x00000000L, 0x04000002L, 0x00000002L, 0x04000000L, 0x04200002L, 0x00000802L, 0x04000800L, 0x00200802L, 0x00200002L, 0x04000800L, 0x04000002L, 0x04200000L, 0x04200800L, 0x00200002L, 0x04200000L, 0x00000800L, 0x00000802L, 0x04200802L, 0x00200800L, 0x00000002L, 0x04000000L, 0x00200800L, 0x04000000L, 0x00200800L, 0x00200000L, 0x04000802L, 0x04000802L, 0x04200002L, 0x04200002L, 0x00000002L, 0x00200002L, 0x04000000L, 0x04000800L, 0x00200000L, 0x04200800L, 0x00000802L, 0x00200802L, 0x04200800L, 0x00000802L, 0x04000002L, 0x04200802L, 0x04200000L, 0x00200800L, 0x00000000L, 0x00000002L, 0x04200802L, 0x00000000L, 0x00200802L, 0x04200000L, 0x00000800L, 0x04000002L, 0x04000800L, 0x00000800L, 0x00200002L }; static unsigned long SP8[64] = { 0x10001040L, 0x00001000L, 0x00040000L, 0x10041040L, 0x10000000L, 0x10001040L, 0x00000040L, 0x10000000L, 0x00040040L, 0x10040000L, 0x10041040L, 0x00041000L, 0x10041000L, 0x00041040L, 0x00001000L, 0x00000040L, 0x10040000L, 0x10000040L, 0x10001000L, 0x00001040L, 0x00041000L, 0x00040040L, 0x10040040L, 0x10041000L, 0x00001040L, 0x00000000L, 0x00000000L, 0x10040040L, 0x10000040L, 0x10001000L, 0x00041040L, 0x00040000L, 0x00041040L, 0x00040000L, 0x10041000L, 0x00001000L, 0x00000040L, 0x10040040L, 0x00001000L, 0x00041040L, 0x10001000L, 0x00000040L, 0x10000040L, 0x10040000L, 0x10040040L, 0x10000000L, 0x00040000L, 0x10001040L, 0x00000000L, 0x10041040L, 0x00040040L, 0x10000040L, 0x10040000L, 0x10001000L, 0x10001040L, 0x00000000L, 0x10041040L, 0x00041000L, 0x00041000L, 0x00001040L, 0x00001040L, 0x00040040L, 0x10000000L, 0x10041000L }; static void desfunc(unsigned long *block, unsigned long *keys) { register unsigned long fval, work, right, leftt; register int round; leftt = block[0]; right = block[1]; work = ((leftt >> 4) ^ right) & 0x0f0f0f0fL; right ^= work; leftt ^= (work << 4); work = ((leftt >> 16) ^ right) & 0x0000ffffL; right ^= work; leftt ^= (work << 16); work = ((right >> 2) ^ leftt) & 0x33333333L; leftt ^= work; right ^= (work << 2); work = ((right >> 8) ^ leftt) & 0x00ff00ffL; leftt ^= work; right ^= (work << 8); right = ((right << 1) | ((right >> 31) & 1L)) & 0xffffffffL; work = (leftt ^ right) & 0xaaaaaaaaL; leftt ^= work; right ^= work; leftt = ((leftt << 1) | ((leftt >> 31) & 1L)) & 0xffffffffL; for( round = 0; round < 8; round++ ) { work = (right << 28) | (right >> 4); work ^= *keys++; fval = SP7[ work & 0x3fL]; fval |= SP5[(work >> 8) & 0x3fL]; fval |= SP3[(work >> 16) & 0x3fL]; fval |= SP1[(work >> 24) & 0x3fL]; work = right ^ *keys++; fval |= SP8[ work & 0x3fL]; fval |= SP6[(work >> 8) & 0x3fL]; fval |= SP4[(work >> 16) & 0x3fL]; fval |= SP2[(work >> 24) & 0x3fL]; leftt ^= fval; work = (leftt << 28) | (leftt >> 4); work ^= *keys++; fval = SP7[ work & 0x3fL]; fval |= SP5[(work >> 8) & 0x3fL]; fval |= SP3[(work >> 16) & 0x3fL]; fval |= SP1[(work >> 24) & 0x3fL]; work = leftt ^ *keys++; fval |= SP8[ work & 0x3fL]; fval |= SP6[(work >> 8) & 0x3fL]; fval |= SP4[(work >> 16) & 0x3fL]; fval |= SP2[(work >> 24) & 0x3fL]; right ^= fval; } right = (right << 31) | (right >> 1); work = (leftt ^ right) & 0xaaaaaaaaL; leftt ^= work; right ^= work; leftt = (leftt << 31) | (leftt >> 1); work = ((leftt >> 8) ^ right) & 0x00ff00ffL; right ^= work; leftt ^= (work << 8); work = ((leftt >> 2) ^ right) & 0x33333333L; right ^= work; leftt ^= (work << 2); work = ((right >> 16) ^ leftt) & 0x0000ffffL; leftt ^= work; right ^= (work << 16); work = ((right >> 4) ^ leftt) & 0x0f0f0f0fL; leftt ^= work; right ^= (work << 4); *block++ = right; *block = leftt; return; } /* Validation sets: * * Single-length key, single-length plaintext - * Key : 0123 4567 89ab cdef * Plain : 0123 4567 89ab cde7 * Cipher : c957 4425 6a5e d31d * * Double-length key, single-length plaintext - * Key : 0123 4567 89ab cdef fedc ba98 7654 3210 * Plain : 0123 4567 89ab cde7 * Cipher : 7f1d 0a77 826b 8aff * * Double-length key, double-length plaintext - * Key : 0123 4567 89ab cdef fedc ba98 7654 3210 * Plain : 0123 4567 89ab cdef 0123 4567 89ab cdff * Cipher : 27a0 8440 406a df60 278f 47cf 42d6 15d7 * * Triple-length key, single-length plaintext - * Key : 0123 4567 89ab cdef fedc ba98 7654 3210 89ab cdef 0123 4567 * Plain : 0123 4567 89ab cde7 * Cipher : de0b 7c06 ae5e 0ed5 * * Triple-length key, double-length plaintext - * Key : 0123 4567 89ab cdef fedc ba98 7654 3210 89ab cdef 0123 4567 * Plain : 0123 4567 89ab cdef 0123 4567 89ab cdff * Cipher : ad0d 1b30 ac17 cf07 0ed1 1c63 81e4 4de5 * * d3des V5.0a rwo 9208.07 18:44 Graven Imagery **********************************************************************/ ================================================ FILE: OSXvnc-server/d3des.h ================================================ /* * This is D3DES (V5.09) by Richard Outerbridge with the double and * triple-length support removed for use in VNC. * * These changes are: * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ /* d3des.h - * * Headers and defines for d3des.c * Graven Imagery, 1992. * * Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge * (GEnie : OUTER; CIS : [71755,204]) */ #define EN0 0 /* MODE == encrypt */ #define DE1 1 /* MODE == decrypt */ extern void deskey(unsigned char *, int); /* hexkey[8] MODE * Sets the internal key register according to the hexadecimal * key contained in the 8 bytes of hexkey, according to the DES, * for encryption or decryption according to MODE. */ extern void usekey(unsigned long *); /* cookedkey[32] * Loads the internal key register with the data in cookedkey. */ extern void cpkey(unsigned long *); /* cookedkey[32] * Copies the contents of the internal key register into the storage * located at &cookedkey[0]. */ extern void des(unsigned char *, unsigned char *); /* from[8] to[8] * Encrypts/Decrypts (according to the key currently loaded in the * internal key register) one block of eight bytes at address 'from' * into the block at address 'to'. They can be the same. */ /* d3des.h V5.09 rwo 9208.04 15:06 Graven Imagery ********************************************************************/ ================================================ FILE: OSXvnc-server/dimming.c ================================================ #include #include #include #include #include #include #include #include "rfb.h" Bool rfbNoDimming = FALSE; Bool rfbNoSleep = TRUE; IOPMAssertionID userActivityLastAssertionId; static pthread_mutex_t dimming_mutex; static unsigned long dim_time; static unsigned long sleep_time; static mach_port_t master_dev_port; static io_connect_t power_mgt; static Bool initialized = FALSE; static Bool dim_time_saved = FALSE; static Bool sleep_time_saved = FALSE; // OSXvnc 0.8 - Disable ScreenSaver void rfbScreensaverTimer(EventLoopTimerRef timer, void *userData) { #pragma unused (timer, userData) if (rfbNoSleep && rfbClientsConnected()) { UpdateSystemActivity(IdleActivity); // UpdateSystemActivity's seeming replacement: IOPMAssertionDeclareUserActivity(CFSTR("VNC user is logged in"), kIOPMUserActiveLocal, &userActivityLastAssertionId); } } static int saveDimSettings(void) { if (IOPMGetAggressiveness(power_mgt, kPMMinutesToDim, &dim_time) != kIOReturnSuccess) return -1; dim_time_saved = TRUE; return 0; } static int restoreDimSettings(void) { if (!dim_time_saved) return -1; if (IOPMSetAggressiveness(power_mgt, kPMMinutesToDim, dim_time) != kIOReturnSuccess) return -1; dim_time_saved = FALSE; dim_time = 0; return 0; } static int saveSleepSettings(void) { if (IOPMGetAggressiveness(power_mgt, kPMMinutesToSleep, &sleep_time) != kIOReturnSuccess) return -1; sleep_time_saved = TRUE; return 0; } static int restoreSleepSettings(void) { if (!sleep_time_saved) return -1; if (IOPMSetAggressiveness(power_mgt, kPMMinutesToSleep, sleep_time) != kIOReturnSuccess) return -1; sleep_time_saved = FALSE; sleep_time = 0; return 0; } int rfbDimmingInit(void) { pthread_mutex_init(&dimming_mutex, NULL); if (IOMasterPort(bootstrap_port, &master_dev_port) != kIOReturnSuccess) return -1; if (!(power_mgt = IOPMFindPowerManagement(master_dev_port))) return -1; if (rfbNoDimming) { if (saveDimSettings() < 0) return -1; if (IOPMSetAggressiveness(power_mgt, kPMMinutesToDim, 0) != kIOReturnSuccess) return -1; } if (rfbNoSleep) { if (saveSleepSettings() < 0) return -1; if (IOPMSetAggressiveness(power_mgt, kPMMinutesToSleep, 0) != kIOReturnSuccess) return -1; } initialized = TRUE; return 0; } int rfbUndim(void) { int result = -1; pthread_mutex_lock(&dimming_mutex); if (!initialized) goto DONE; if (!rfbNoDimming) { if (saveDimSettings() < 0) goto DONE; if (IOPMSetAggressiveness(power_mgt, kPMMinutesToDim, 0) != kIOReturnSuccess) goto DONE; if (restoreDimSettings() < 0) goto DONE; } if (!rfbNoSleep) { if (saveSleepSettings() < 0) goto DONE; if (IOPMSetAggressiveness(power_mgt, kPMMinutesToSleep, 0) != kIOReturnSuccess) goto DONE; if (restoreSleepSettings() < 0) goto DONE; } result = 0; DONE: pthread_mutex_unlock(&dimming_mutex); return result; } int rfbDimmingShutdown(void) { int result = -1; if (!initialized) goto DONE; pthread_mutex_lock(&dimming_mutex); if (dim_time_saved) if (restoreDimSettings() < 0) goto DONE; if (sleep_time_saved) if (restoreSleepSettings() < 0) goto DONE; result = 0; DONE: pthread_mutex_unlock(&dimming_mutex); return result; } ================================================ FILE: OSXvnc-server/getMACAddress.c ================================================ /* * getMACAddress.c * Eggplant * * Created by Douglas Simons on 11/15/06. * Copyright 2006 Redstone Software, Inc. All rights reserved. * */ #import "getMACAddress.h" /* File: GetPrimaryMACAddress.c Description: This sample application demonstrates how to do retrieve the Ethernet MAC address of the built-in Ethernet interface from the I/O Registry on Mac OS X. Techniques shown include finding the primary (built-in) Ethernet interface, finding the parent Ethernet controller, and retrieving properties from the controller's I/O Registry entry. Copyright: Copyright 2001-2005 Apple Computer, Inc. All rights reserved. Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software. In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under Apple's copyrights in this original Apple software (the "Apple Software"), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated. The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Change History (most recent first): <3> 09/15/05 Updated to produce a universal binary. Use kIOMasterPortDefault instead of older IOMasterPort function. Print the MAC address to stdout in response to . <2> 04/30/02 Fix bug in creating the matching dictionary that caused the kIOPrimaryInterface property to be ignored. Clean up comments and add additional comments about how IOServiceGetMatchingServices operates. <1> 06/07/01 New sample. */ #include #include #include #include #include #include static kern_return_t FindEthernetInterfaces(io_iterator_t *matchingServices); static kern_return_t GetMACAddress(io_iterator_t intfIterator, UInt8 *MACAddress, UInt8 bufferSize); // Returns an iterator containing the primary (built-in) Ethernet interface. The caller is responsible for // releasing the iterator after the caller is done with it. static kern_return_t FindEthernetInterfaces(io_iterator_t *matchingServices) { kern_return_t kernResult; CFMutableDictionaryRef matchingDict; CFMutableDictionaryRef propertyMatchDict; // Ethernet interfaces are instances of class kIOEthernetInterfaceClass. // IOServiceMatching is a convenience function to create a dictionary with the key kIOProviderClassKey and // the specified value. matchingDict = IOServiceMatching(kIOEthernetInterfaceClass); // Note that another option here would be: // matchingDict = IOBSDMatching("en0"); if (NULL == matchingDict) { printf("IOServiceMatching returned a NULL dictionary.\n"); } else { // Each IONetworkInterface object has a Boolean property with the key kIOPrimaryInterface. Only the // primary (built-in) interface has this property set to TRUE. // IOServiceGetMatchingServices uses the default matching criteria defined by IOService. This considers // only the following properties plus any family-specific matching in this order of precedence // (see IOService::passiveMatch): // // kIOProviderClassKey (IOServiceMatching) // kIONameMatchKey (IOServiceNameMatching) // kIOPropertyMatchKey // kIOPathMatchKey // kIOMatchedServiceCountKey // family-specific matching // kIOBSDNameKey (IOBSDNameMatching) // kIOLocationMatchKey // The IONetworkingFamily does not define any family-specific matching. This means that in // order to have IOServiceGetMatchingServices consider the kIOPrimaryInterface property, we must // add that property to a separate dictionary and then add that to our matching dictionary // specifying kIOPropertyMatchKey. propertyMatchDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); if (NULL == propertyMatchDict) { printf("CFDictionaryCreateMutable returned a NULL dictionary.\n"); } else { // Set the value in the dictionary of the property with the given key, or add the key // to the dictionary if it doesn't exist. This call retains the value object passed in. CFDictionarySetValue(propertyMatchDict, CFSTR(kIOPrimaryInterface), kCFBooleanTrue); // Now add the dictionary containing the matching value for kIOPrimaryInterface to our main // matching dictionary. This call will retain propertyMatchDict, so we can release our reference // on propertyMatchDict after adding it to matchingDict. CFDictionarySetValue(matchingDict, CFSTR(kIOPropertyMatchKey), propertyMatchDict); CFRelease(propertyMatchDict); } } // IOServiceGetMatchingServices retains the returned iterator, so release the iterator when we're done with it. // IOServiceGetMatchingServices also consumes a reference on the matching dictionary so we don't need to release // the dictionary explicitly. kernResult = IOServiceGetMatchingServices(kIOMasterPortDefault, matchingDict, matchingServices); if (KERN_SUCCESS != kernResult) { printf("IOServiceGetMatchingServices returned 0x%08x\n", kernResult); } return kernResult; } // Given an iterator across a set of Ethernet interfaces, return the MAC address of the last one. // If no interfaces are found the MAC address is set to an empty string. // In this sample the iterator should contain just the primary interface. static kern_return_t GetMACAddress(io_iterator_t intfIterator, UInt8 *MACAddress, UInt8 bufferSize) { io_object_t intfService; io_object_t controllerService; kern_return_t kernResult = KERN_FAILURE; // Make sure the caller provided enough buffer space. Protect against buffer overflow problems. if (bufferSize < kIOEthernetAddressSize) { return kernResult; } // Initialize the returned address bzero(MACAddress, bufferSize); // IOIteratorNext retains the returned object, so release it when we're done with it. while ((intfService = IOIteratorNext(intfIterator))) { CFTypeRef MACAddressAsCFData; // IONetworkControllers can't be found directly by the IOServiceGetMatchingServices call, // since they are hardware nubs and do not participate in driver matching. In other words, // registerService() is never called on them. So we've found the IONetworkInterface and will // get its parent controller by asking for it specifically. // IORegistryEntryGetParentEntry retains the returned object, so release it when we're done with it. kernResult = IORegistryEntryGetParentEntry(intfService, kIOServicePlane, &controllerService); if (KERN_SUCCESS != kernResult) { printf("IORegistryEntryGetParentEntry returned 0x%08x\n", kernResult); } else { // Retrieve the MAC address property from the I/O Registry in the form of a CFData MACAddressAsCFData = IORegistryEntryCreateCFProperty(controllerService, CFSTR(kIOMACAddress), kCFAllocatorDefault, 0); if (MACAddressAsCFData) { // CFShow(MACAddressAsCFData); // for display purposes only; output goes to stderr // Get the raw bytes of the MAC address from the CFData CFDataGetBytes(MACAddressAsCFData, CFRangeMake(0, kIOEthernetAddressSize), MACAddress); CFRelease(MACAddressAsCFData); } // Done with the parent Ethernet controller object so we release it. (void) IOObjectRelease(controllerService); } // Done with the Ethernet interface object so we release it. (void) IOObjectRelease(intfService); } return kernResult; } NSString *getMACAddressString(void) { static NSString *addressString = nil; if (!addressString) { kern_return_t kernResult = KERN_SUCCESS; // on PowerPC this is an int (4 bytes) /* * error number layout as follows (see mach/error.h and IOKit/IOReturn.h): * * hi lo * | system(6) | subsystem(12) | code(14) | */ io_iterator_t intfIterator; UInt8 MACAddress[kIOEthernetAddressSize]; kernResult = FindEthernetInterfaces(&intfIterator); if (KERN_SUCCESS != kernResult) { printf("FindEthernetInterfaces returned 0x%08x\n", kernResult); } else { kernResult = GetMACAddress(intfIterator, MACAddress, sizeof(MACAddress)); if (KERN_SUCCESS != kernResult) { printf("GetMACAddress returned 0x%08x\n", kernResult); } else { addressString = [[NSString alloc] initWithFormat:@"%02x:%02x:%02x:%02x:%02x:%02x", MACAddress[0], MACAddress[1], MACAddress[2], MACAddress[3], MACAddress[4], MACAddress[5] ]; } } (void) IOObjectRelease(intfIterator); // Release the iterator. } return addressString; } ================================================ FILE: OSXvnc-server/getMACAddress.h ================================================ /* * getMACAddress.h * Eggplant * * Created by Douglas Simons on 11/15/06. * Copyright 2006 Redstone Software, Inc. All rights reserved. * */ #import extern NSString *getMACAddressString(void); ================================================ FILE: OSXvnc-server/hextile.c ================================================ /* * hextile.c * * Routines to implement Hextile Encoding */ /* * OSXvnc Copyright (C) 2001 Dan McGuirk . * Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge. * All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include #include "rfb.h" static Bool sendHextiles8(rfbClientPtr cl, int x, int y, int w, int h); static Bool sendHextiles16(rfbClientPtr cl, int x, int y, int w, int h); static Bool sendHextiles32(rfbClientPtr cl, int x, int y, int w, int h); /* * rfbSendRectEncodingHextile - send a rectangle using hextile encoding. */ Bool rfbSendRectEncodingHextile(rfbClientPtr cl, int x, int y, int w, int h) { rfbFramebufferUpdateRectHeader rect; if (cl->ublen + sz_rfbFramebufferUpdateRectHeader > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } rect.r.x = Swap16IfLE(x); rect.r.y = Swap16IfLE(y); rect.r.w = Swap16IfLE(w); rect.r.h = Swap16IfLE(h); rect.encoding = Swap32IfLE(rfbEncodingHextile); memcpy(&cl->updateBuf[cl->ublen], &rect, sz_rfbFramebufferUpdateRectHeader); cl->ublen += sz_rfbFramebufferUpdateRectHeader; cl->rfbRectanglesSent[rfbEncodingHextile]++; cl->rfbBytesSent[rfbEncodingHextile] += sz_rfbFramebufferUpdateRectHeader; switch (cl->format.bitsPerPixel) { case 8: return sendHextiles8(cl, x, y, w, h); case 16: return sendHextiles16(cl, x, y, w, h); case 32: return sendHextiles32(cl, x, y, w, h); } rfbLog("rfbSendRectEncodingHextile: bpp %d?", cl->format.bitsPerPixel); return FALSE; } #define PUT_PIXEL8(pix) (cl->updateBuf[cl->ublen++] = (pix)) #define PUT_PIXEL16(pix) (cl->updateBuf[cl->ublen++] = ((char*)&(pix))[0], \ cl->updateBuf[cl->ublen++] = ((char*)&(pix))[1]) #define PUT_PIXEL32(pix) (cl->updateBuf[cl->ublen++] = ((char*)&(pix))[0], \ cl->updateBuf[cl->ublen++] = ((char*)&(pix))[1], \ cl->updateBuf[cl->ublen++] = ((char*)&(pix))[2], \ cl->updateBuf[cl->ublen++] = ((char*)&(pix))[3]) #define DEFINE_SEND_HEXTILES(bpp) \ \ \ static Bool subrectEncode##bpp(rfbClientPtr cli, CARD##bpp *data, int w, int h, \ CARD##bpp bg, CARD##bpp fg, Bool mono); \ static void testColours##bpp(CARD##bpp *data, int size, Bool *mono, \ Bool *solid, CARD##bpp *bg, CARD##bpp *fg); \ \ \ /* \ * rfbSendHextiles \ */ \ \ static Bool \ sendHextiles##bpp(rfbClientPtr cl, int rx, int ry, int rw, int rh) \ { \ int x, y, w, h; \ int startUblen; \ char *fbptr; \ CARD##bpp bg = 0, fg = 0, newBg, newFg; \ Bool mono, solid; \ Bool validBg = FALSE; \ Bool validFg = FALSE; \ CARD##bpp clientPixelData[16*16*(bpp/8)]; \ \ for (y = ry; y < ry+rh; y += 16) { \ for (x = rx; x < rx+rw; x += 16) { \ w = h = 16; \ if (rx+rw - x < 16) \ w = rx+rw - x; \ if (ry+rh - y < 16) \ h = ry+rh - y; \ \ if ((cl->ublen + 1 + (2 + 16 * 16) * (bpp/8)) > \ UPDATE_BUF_SIZE) { \ if (!rfbSendUpdateBuf(cl)) \ return FALSE; \ } \ \ fbptr = (cl->scalingFrameBuffer + (cl->scalingPaddedWidthInBytes * y) \ + (x * (rfbScreen.bitsPerPixel / 8))); \ \ (*cl->translateFn)(cl->translateLookupTable, &rfbServerFormat, \ &cl->format, fbptr, (char *)clientPixelData, \ cl->scalingPaddedWidthInBytes, w, h); \ \ startUblen = cl->ublen; \ cl->updateBuf[startUblen] = 0; \ cl->ublen++; \ \ testColours##bpp(clientPixelData, w * h, \ &mono, &solid, &newBg, &newFg); \ \ if (!validBg || (newBg != bg)) { \ validBg = TRUE; \ bg = newBg; \ cl->updateBuf[startUblen] |= rfbHextileBackgroundSpecified; \ PUT_PIXEL##bpp(bg); \ } \ \ if (solid) { \ cl->rfbBytesSent[rfbEncodingHextile] += cl->ublen - startUblen; \ continue; \ } \ \ cl->updateBuf[startUblen] |= rfbHextileAnySubrects; \ \ if (mono) { \ if (!validFg || (newFg != fg)) { \ validFg = TRUE; \ fg = newFg; \ cl->updateBuf[startUblen] |= rfbHextileForegroundSpecified; \ PUT_PIXEL##bpp(fg); \ } \ } else { \ validFg = FALSE; \ cl->updateBuf[startUblen] |= rfbHextileSubrectsColoured; \ } \ \ if (!subrectEncode##bpp(cl, clientPixelData, w, h, bg, fg, mono)) { \ /* encoding was too large, use raw */ \ validBg = FALSE; \ validFg = FALSE; \ cl->ublen = startUblen; \ cl->updateBuf[cl->ublen++] = rfbHextileRaw; \ (*cl->translateFn)(cl->translateLookupTable, \ &rfbServerFormat, &cl->format, fbptr, \ (char *)clientPixelData, \ cl->scalingPaddedWidthInBytes, w, h); \ \ memcpy(&cl->updateBuf[cl->ublen], clientPixelData, \ w * h * (bpp/8)); \ \ cl->ublen += w * h * (bpp/8); \ } \ \ cl->rfbBytesSent[rfbEncodingHextile] += cl->ublen - startUblen; \ } \ } \ \ return TRUE; \ } \ \ \ static Bool \ subrectEncode##bpp(rfbClientPtr cl, CARD##bpp *data, int w, int h, \ CARD##bpp bg, CARD##bpp fg, Bool mono) \ { \ CARD##bpp cl2; \ int x,y; \ int i,j; \ int hx=0,hy,vx=0,vy; \ int hyflag; \ CARD##bpp *seg; \ CARD##bpp *line; \ int hw,hh,vw,vh; \ int thex,they,thew,theh; \ int numsubs = 0; \ int newLen; \ int nSubrectsUblen; \ \ nSubrectsUblen = cl->ublen; \ cl->ublen++; \ \ for (y=0; y 0) && (i >= hx)) { \ hy += 1; \ } else { \ hyflag = 0; \ } \ } \ vy = j-1; \ \ /* We now have two possible subrects: (x,y,hx,hy) and \ * (x,y,vx,vy). We'll choose the bigger of the two. \ */ \ hw = hx-x+1; \ hh = hy-y+1; \ vw = vx-x+1; \ vh = vy-y+1; \ \ thex = x; \ they = y; \ \ if ((hw*hh) > (vw*vh)) { \ thew = hw; \ theh = hh; \ } else { \ thew = vw; \ theh = vh; \ } \ \ if (mono) { \ newLen = cl->ublen - nSubrectsUblen + 2; \ } else { \ newLen = cl->ublen - nSubrectsUblen + bpp/8 + 2; \ } \ \ if (newLen > (w * h * (bpp/8))) \ return FALSE; \ \ numsubs += 1; \ \ if (!mono) PUT_PIXEL##bpp(cl2); \ \ cl->updateBuf[cl->ublen++] = rfbHextilePackXY(thex,they); \ cl->updateBuf[cl->ublen++] = rfbHextilePackWH(thew,theh); \ \ /* \ * Now mark the subrect as done. \ */ \ for (j=they; j < (they+theh); j++) { \ for (i=thex; i < (thex+thew); i++) { \ data[j*w+i] = bg; \ } \ } \ } \ } \ } \ \ cl->updateBuf[nSubrectsUblen] = numsubs; \ \ return TRUE; \ } \ \ \ /* \ * testColours() tests if there are one (solid), two (mono) or more \ * colours in a tile and gets a reasonable guess at the best background \ * pixel, and the foreground pixel for mono. \ */ \ \ static void \ testColours##bpp(CARD##bpp *data, int size, Bool *mono, Bool *solid, CARD##bpp *bg, CARD##bpp *fg) \ { \ CARD##bpp colour1 = 0, colour2 = 0; \ int n1 = 0, n2 = 0; \ *mono = TRUE; \ *solid = TRUE; \ \ for (; size > 0; size--, data++) { \ \ if (n1 == 0) \ colour1 = *data; \ \ if (*data == colour1) { \ n1++; \ continue; \ } \ \ if (n2 == 0) { \ *solid = FALSE; \ colour2 = *data; \ } \ \ if (*data == colour2) { \ n2++; \ continue; \ } \ \ *mono = FALSE; \ break; \ } \ \ if (n1 > n2) { \ *bg = colour1; \ *fg = colour2; \ } else { \ *bg = colour2; \ *fg = colour1; \ } \ } DEFINE_SEND_HEXTILES(8) DEFINE_SEND_HEXTILES(16) DEFINE_SEND_HEXTILES(32) ================================================ FILE: OSXvnc-server/include/X11/X.h ================================================ /* * $XConsortium: X.h,v 1.69 94/04/17 20:10:48 dpw Exp $ */ /* Definitions for the X window system likely to be used by applications */ #ifndef X_H #define X_H /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #define X_PROTOCOL 11 /* current protocol version */ #define X_PROTOCOL_REVISION 0 /* current minor version */ /* Resources */ /* * _XSERVER64 must ONLY be defined when compiling X server sources on * systems where unsigned long is not 32 bits, must NOT be used in * client or library code. */ #ifndef _XSERVER64 typedef unsigned long XID; typedef unsigned long Mask; typedef unsigned long Atom; typedef unsigned long VisualID; typedef unsigned long Time; #else #include typedef CARD32 XID; typedef CARD32 Mask; typedef CARD32 Atom; typedef CARD32 VisualID; typedef CARD32 Time; #endif typedef XID Window; typedef XID Drawable; typedef XID Font; typedef XID Pixmap; typedef XID X11Cursor; /* conflict with CoreGraphics */ typedef XID Colormap; typedef XID GContext; typedef XID KeySym; typedef unsigned char KeyCode; /***************************************************************** * RESERVED RESOURCE AND CONSTANT DEFINITIONS *****************************************************************/ #define None 0L /* universal null resource or null atom */ #define ParentRelative 1L /* background pixmap in CreateWindow and ChangeWindowAttributes */ #define CopyFromParent 0L /* border pixmap in CreateWindow and ChangeWindowAttributes special VisualID and special window class passed to CreateWindow */ #define PointerWindow 0L /* destination window in SendEvent */ #define InputFocus 1L /* destination window in SendEvent */ #define PointerRoot 1L /* focus window in SetInputFocus */ #define AnyPropertyType 0L /* special Atom, passed to GetProperty */ #define AnyKey 0L /* special Key Code, passed to GrabKey */ #define AnyButton 0L /* special Button Code, passed to GrabButton */ #define AllTemporary 0L /* special Resource ID passed to KillClient */ #define CurrentTime 0L /* special Time */ #define NoSymbol 0L /* special KeySym */ /***************************************************************** * EVENT DEFINITIONS *****************************************************************/ /* Input Event Masks. Used as event-mask window attribute and as arguments to Grab requests. Not to be confused with event names. */ #define NoEventMask 0L #define KeyPressMask (1L<<0) #define KeyReleaseMask (1L<<1) #define ButtonPressMask (1L<<2) #define ButtonReleaseMask (1L<<3) #define EnterWindowMask (1L<<4) #define LeaveWindowMask (1L<<5) #define PointerMotionMask (1L<<6) #define PointerMotionHintMask (1L<<7) #define Button1MotionMask (1L<<8) #define Button2MotionMask (1L<<9) #define Button3MotionMask (1L<<10) #define Button4MotionMask (1L<<11) #define Button5MotionMask (1L<<12) #define ButtonMotionMask (1L<<13) #define KeymapStateMask (1L<<14) #define ExposureMask (1L<<15) #define VisibilityChangeMask (1L<<16) #define StructureNotifyMask (1L<<17) #define ResizeRedirectMask (1L<<18) #define SubstructureNotifyMask (1L<<19) #define SubstructureRedirectMask (1L<<20) #define FocusChangeMask (1L<<21) #define PropertyChangeMask (1L<<22) #define ColormapChangeMask (1L<<23) #define OwnerGrabButtonMask (1L<<24) /* Event names. Used in "type" field in XEvent structures. Not to be confused with event masks above. They start from 2 because 0 and 1 are reserved in the protocol for errors and replies. */ #define KeyPress 2 #define KeyRelease 3 #define ButtonPress 4 #define ButtonRelease 5 #define MotionNotify 6 #define EnterNotify 7 #define LeaveNotify 8 #define FocusIn 9 #define FocusOut 10 #define KeymapNotify 11 #define Expose 12 #define GraphicsExpose 13 #define NoExpose 14 #define VisibilityNotify 15 #define CreateNotify 16 #define DestroyNotify 17 #define UnmapNotify 18 #define MapNotify 19 #define MapRequest 20 #define ReparentNotify 21 #define ConfigureNotify 22 #define ConfigureRequest 23 #define GravityNotify 24 #define ResizeRequest 25 #define CirculateNotify 26 #define CirculateRequest 27 #define PropertyNotify 28 #define SelectionClear 29 #define SelectionRequest 30 #define SelectionNotify 31 #define ColormapNotify 32 #define ClientMessage 33 #define MappingNotify 34 #define LASTEvent 35 /* must be bigger than any event # */ /* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer, state in various key-, mouse-, and button-related events. */ #define ShiftMask (1<<0) #define LockMask (1<<1) #define ControlMask (1<<2) #define Mod1Mask (1<<3) #define Mod2Mask (1<<4) #define Mod3Mask (1<<5) #define Mod4Mask (1<<6) #define Mod5Mask (1<<7) /* modifier names. Used to build a SetModifierMapping request or to read a GetModifierMapping request. These correspond to the masks defined above. */ #define ShiftMapIndex 0 #define LockMapIndex 1 #define ControlMapIndex 2 #define Mod1MapIndex 3 #define Mod2MapIndex 4 #define Mod3MapIndex 5 #define Mod4MapIndex 6 #define Mod5MapIndex 7 /* button masks. Used in same manner as Key masks above. Not to be confused with button names below. */ #define Button1Mask (1<<8) #define Button2Mask (1<<9) #define Button3Mask (1<<10) #define Button4Mask (1<<11) #define Button5Mask (1<<12) #define AnyModifier (1<<15) /* used in GrabButton, GrabKey */ /* button names. Used as arguments to GrabButton and as detail in ButtonPress and ButtonRelease events. Not to be confused with button masks above. Note that 0 is already defined above as "AnyButton". */ #define Button1 1 #define Button2 2 #define Button3 3 #define Button4 4 #define Button5 5 /* Notify modes */ #define NotifyNormal 0 #define NotifyGrab 1 #define NotifyUngrab 2 #define NotifyWhileGrabbed 3 #define NotifyHint 1 /* for MotionNotify events */ /* Notify detail */ #define NotifyAncestor 0 #define NotifyVirtual 1 #define NotifyInferior 2 #define NotifyNonlinear 3 #define NotifyNonlinearVirtual 4 #define NotifyPointer 5 #define NotifyPointerRoot 6 #define NotifyDetailNone 7 /* Visibility notify */ #define VisibilityUnobscured 0 #define VisibilityPartiallyObscured 1 #define VisibilityFullyObscured 2 /* Circulation request */ #define PlaceOnTop 0 #define PlaceOnBottom 1 /* protocol families */ #define FamilyInternet 0 #define FamilyDECnet 1 #define FamilyChaos 2 /* Property notification */ #define PropertyNewValue 0 #define PropertyDelete 1 /* Color Map notification */ #define ColormapUninstalled 0 #define ColormapInstalled 1 /* GrabPointer, GrabButton, GrabKeyboard, GrabKey Modes */ #define GrabModeSync 0 #define GrabModeAsync 1 /* GrabPointer, GrabKeyboard reply status */ #define GrabSuccess 0 #define AlreadyGrabbed 1 #define GrabInvalidTime 2 #define GrabNotViewable 3 #define GrabFrozen 4 /* AllowEvents modes */ #define AsyncPointer 0 #define SyncPointer 1 #define ReplayPointer 2 #define AsyncKeyboard 3 #define SyncKeyboard 4 #define ReplayKeyboard 5 #define AsyncBoth 6 #define SyncBoth 7 /* Used in SetInputFocus, GetInputFocus */ #define RevertToNone (int)None #define RevertToPointerRoot (int)PointerRoot #define RevertToParent 2 /***************************************************************** * ERROR CODES *****************************************************************/ #define Success 0 /* everything's okay */ #define BadRequest 1 /* bad request code */ #define BadValue 2 /* int parameter out of range */ #define BadWindow 3 /* parameter not a Window */ #define BadPixmap 4 /* parameter not a Pixmap */ #define BadAtom 5 /* parameter not an Atom */ #define BadCursor 6 /* parameter not a Cursor */ #define BadFont 7 /* parameter not a Font */ #define BadMatch 8 /* parameter mismatch */ #define BadDrawable 9 /* parameter not a Pixmap or Window */ #define BadAccess 10 /* depending on context: - key/button already grabbed - attempt to free an illegal cmap entry - attempt to store into a read-only color map entry. - attempt to modify the access control list from other than the local host. */ #define BadAlloc 11 /* insufficient resources */ #define BadColor 12 /* no such colormap */ #define BadGC 13 /* parameter not a GC */ #define BadIDChoice 14 /* choice not in range or already used */ #define BadName 15 /* font or color name doesn't exist */ #define BadLength 16 /* Request length incorrect */ #define BadImplementation 17 /* server is defective */ #define FirstExtensionError 128 #define LastExtensionError 255 /***************************************************************** * WINDOW DEFINITIONS *****************************************************************/ /* Window classes used by CreateWindow */ /* Note that CopyFromParent is already defined as 0 above */ #define InputOutput 1 #define InputOnly 2 /* Window attributes for CreateWindow and ChangeWindowAttributes */ #define CWBackPixmap (1L<<0) #define CWBackPixel (1L<<1) #define CWBorderPixmap (1L<<2) #define CWBorderPixel (1L<<3) #define CWBitGravity (1L<<4) #define CWWinGravity (1L<<5) #define CWBackingStore (1L<<6) #define CWBackingPlanes (1L<<7) #define CWBackingPixel (1L<<8) #define CWOverrideRedirect (1L<<9) #define CWSaveUnder (1L<<10) #define CWEventMask (1L<<11) #define CWDontPropagate (1L<<12) #define CWColormap (1L<<13) #define CWCursor (1L<<14) /* ConfigureWindow structure */ #define CWX (1<<0) #define CWY (1<<1) #define CWWidth (1<<2) #define CWHeight (1<<3) #define CWBorderWidth (1<<4) #define CWSibling (1<<5) #define CWStackMode (1<<6) /* Bit Gravity */ #define ForgetGravity 0 #define NorthWestGravity 1 #define NorthGravity 2 #define NorthEastGravity 3 #define WestGravity 4 #define CenterGravity 5 #define EastGravity 6 #define SouthWestGravity 7 #define SouthGravity 8 #define SouthEastGravity 9 #define StaticGravity 10 /* Window gravity + bit gravity above */ #define UnmapGravity 0 /* Used in CreateWindow for backing-store hint */ #define NotUseful 0 #define WhenMapped 1 #define Always 2 /* Used in GetWindowAttributes reply */ #define IsUnmapped 0 #define IsUnviewable 1 #define IsViewable 2 /* Used in ChangeSaveSet */ #define SetModeInsert 0 #define SetModeDelete 1 /* Used in ChangeCloseDownMode */ #define DestroyAll 0 #define RetainPermanent 1 #define RetainTemporary 2 /* Window stacking method (in configureWindow) */ #define Above 0 #define Below 1 #define TopIf 2 #define BottomIf 3 #define Opposite 4 /* Circulation direction */ #define RaiseLowest 0 #define LowerHighest 1 /* Property modes */ #define PropModeReplace 0 #define PropModePrepend 1 #define PropModeAppend 2 /***************************************************************** * GRAPHICS DEFINITIONS *****************************************************************/ /* graphics functions, as in GC.alu */ #define GXclear 0x0 /* 0 */ #define GXand 0x1 /* src AND dst */ #define GXandReverse 0x2 /* src AND NOT dst */ #define GXcopy 0x3 /* src */ #define GXandInverted 0x4 /* NOT src AND dst */ #define GXnoop 0x5 /* dst */ #define GXxor 0x6 /* src XOR dst */ #define GXor 0x7 /* src OR dst */ #define GXnor 0x8 /* NOT src AND NOT dst */ #define GXequiv 0x9 /* NOT src XOR dst */ #define GXinvert 0xa /* NOT dst */ #define GXorReverse 0xb /* src OR NOT dst */ #define GXcopyInverted 0xc /* NOT src */ #define GXorInverted 0xd /* NOT src OR dst */ #define GXnand 0xe /* NOT src OR NOT dst */ #define GXset 0xf /* 1 */ /* LineStyle */ #define LineSolid 0 #define LineOnOffDash 1 #define LineDoubleDash 2 /* capStyle */ #define CapNotLast 0 #define CapButt 1 #define CapRound 2 #define CapProjecting 3 /* joinStyle */ #define JoinMiter 0 #define JoinRound 1 #define JoinBevel 2 /* fillStyle */ #define FillSolid 0 #define FillTiled 1 #define FillStippled 2 #define FillOpaqueStippled 3 /* fillRule */ #define EvenOddRule 0 #define WindingRule 1 /* subwindow mode */ #define ClipByChildren 0 #define IncludeInferiors 1 /* SetClipRectangles ordering */ #define Unsorted 0 #define YSorted 1 #define YXSorted 2 #define YXBanded 3 /* CoordinateMode for drawing routines */ #define CoordModeOrigin 0 /* relative to the origin */ #define CoordModePrevious 1 /* relative to previous point */ /* Polygon shapes */ #define Complex 0 /* paths may intersect */ #define Nonconvex 1 /* no paths intersect, but not convex */ #define Convex 2 /* wholly convex */ /* Arc modes for PolyFillArc */ #define ArcChord 0 /* join endpoints of arc */ #define ArcPieSlice 1 /* join endpoints to center of arc */ /* GC components: masks used in CreateGC, CopyGC, ChangeGC, OR'ed into GC.stateChanges */ #define GCFunction (1L<<0) #define GCPlaneMask (1L<<1) #define GCForeground (1L<<2) #define GCBackground (1L<<3) #define GCLineWidth (1L<<4) #define GCLineStyle (1L<<5) #define GCCapStyle (1L<<6) #define GCJoinStyle (1L<<7) #define GCFillStyle (1L<<8) #define GCFillRule (1L<<9) #define GCTile (1L<<10) #define GCStipple (1L<<11) #define GCTileStipXOrigin (1L<<12) #define GCTileStipYOrigin (1L<<13) #define GCFont (1L<<14) #define GCSubwindowMode (1L<<15) #define GCGraphicsExposures (1L<<16) #define GCClipXOrigin (1L<<17) #define GCClipYOrigin (1L<<18) #define GCClipMask (1L<<19) #define GCDashOffset (1L<<20) #define GCDashList (1L<<21) #define GCArcMode (1L<<22) #define GCLastBit 22 /***************************************************************** * FONTS *****************************************************************/ /* used in QueryFont -- draw direction */ #define FontLeftToRight 0 #define FontRightToLeft 1 #define FontChange 255 /***************************************************************** * IMAGING *****************************************************************/ /* ImageFormat -- PutImage, GetImage */ #define XYBitmap 0 /* depth 1, XYFormat */ #define XYPixmap 1 /* depth == drawable depth */ #define ZPixmap 2 /* depth == drawable depth */ /***************************************************************** * COLOR MAP STUFF *****************************************************************/ /* For CreateColormap */ #define AllocNone 0 /* create map with no entries */ #define AllocAll 1 /* allocate entire map writeable */ /* Flags used in StoreNamedColor, StoreColors */ #define DoRed (1<<0) #define DoGreen (1<<1) #define DoBlue (1<<2) /***************************************************************** * CURSOR STUFF *****************************************************************/ /* QueryBestSize Class */ #define CursorShape 0 /* largest size that can be displayed */ #define TileShape 1 /* size tiled fastest */ #define StippleShape 2 /* size stippled fastest */ /***************************************************************** * KEYBOARD/POINTER STUFF *****************************************************************/ #define AutoRepeatModeOff 0 #define AutoRepeatModeOn 1 #define AutoRepeatModeDefault 2 #define LedModeOff 0 #define LedModeOn 1 /* masks for ChangeKeyboardControl */ #define KBKeyClickPercent (1L<<0) #define KBBellPercent (1L<<1) #define KBBellPitch (1L<<2) #define KBBellDuration (1L<<3) #define KBLed (1L<<4) #define KBLedMode (1L<<5) #define KBKey (1L<<6) #define KBAutoRepeatMode (1L<<7) #define MappingSuccess 0 #define MappingBusy 1 #define MappingFailed 2 #define MappingModifier 0 #define MappingKeyboard 1 #define MappingPointer 2 /***************************************************************** * SCREEN SAVER STUFF *****************************************************************/ #define DontPreferBlanking 0 #define PreferBlanking 1 #define DefaultBlanking 2 #define DisableScreenSaver 0 #define DisableScreenInterval 0 #define DontAllowExposures 0 #define AllowExposures 1 #define DefaultExposures 2 /* for ForceScreenSaver */ #define ScreenSaverReset 0 #define ScreenSaverActive 1 /***************************************************************** * HOSTS AND CONNECTIONS *****************************************************************/ /* for ChangeHosts */ #define HostInsert 0 #define HostDelete 1 /* for ChangeAccessControl */ #define EnableAccess 1 #define DisableAccess 0 /* Display classes used in opening the connection * Note that the statically allocated ones are even numbered and the * dynamically changeable ones are odd numbered */ #define StaticGray 0 #define GrayScale 1 #define StaticColor 2 #define PseudoColor 3 #define TrueColor 4 #define DirectColor 5 /* Byte order used in imageByteOrder and bitmapBitOrder */ #define LSBFirst 0 #define MSBFirst 1 #endif /* X_H */ ================================================ FILE: OSXvnc-server/include/X11/Xalloca.h ================================================ /* $XConsortium: Xalloca.h /main/6 1996/09/28 16:17:22 rws $ */ /* Copyright (c) 1995 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * The purpose of this header is to define the macros ALLOCATE_LOCAL and * DEALLOCATE_LOCAL appropriately for the platform being compiled on. * These macros are used to make fast, function-local memory allocations. * Their characteristics are as follows: * * void *ALLOCATE_LOCAL(int size) * Returns a pointer to size bytes of memory, or NULL if the allocation * failed. The memory must be freed with DEALLOCATE_LOCAL before the * function that made the allocation returns. You should not ask for * large blocks of memory with this function, since on many platforms * the memory comes from the stack, which may have limited size. * * void DEALLOCATE_LOCAL(void *) * Frees the memory allocated by ALLOCATE_LOCAL. Omission of this * step may be harmless on some platforms, but will result in * memory leaks or worse on others. * * Before including this file, you should define two macros, * ALLOCATE_LOCAL_FALLBACK and DEALLOCATE_LOCAL_FALLBACK, that have the * same characteristics as ALLOCATE_LOCAL and DEALLOCATE_LOCAL. The * header uses the fallbacks if it doesn't know a "better" way to define * ALLOCATE_LOCAL and DEALLOCATE_LOCAL. Typical usage would be: * * #define ALLOCATE_LOCAL_FALLBACK(_size) malloc(_size) * #define DEALLOCATE_LOCAL_FALLBACK(_ptr) free(_ptr) * #include "Xalloca.h" */ // Lets skip this on OS X #define XALLOCA_H 1 #ifndef XALLOCA_H #define XALLOCA_H 1 #ifdef INCLUDE_ALLOCA_H # include #endif #ifndef NO_ALLOCA /* * os-dependent definition of local allocation and deallocation * If you want something other than (DE)ALLOCATE_LOCAL_FALLBACK * for ALLOCATE/DEALLOCATE_LOCAL then you add that in here. */ # if defined(__HIGHC__) # ifndef NCR extern char *alloca(); # if HCVERSION < 21003 # define ALLOCATE_LOCAL(size) alloca((int)(size)) pragma on(alloca); # else /* HCVERSION >= 21003 */ # define ALLOCATE_LOCAL(size) _Alloca((int)(size)) # endif /* HCVERSION < 21003 */ # else /* NCR */ # define ALLOCATE_LOCAL(size) alloca(size) # endif # define DEALLOCATE_LOCAL(ptr) /* as nothing */ # endif /* defined(__HIGHC__) */ # ifdef __GNUC__ # ifndef alloca # define alloca __builtin_alloca # endif /* !alloca */ # define ALLOCATE_LOCAL(size) alloca((int)(size)) # define DEALLOCATE_LOCAL(ptr) /* as nothing */ # else /* ! __GNUC__ */ /* * warning: old mips alloca (pre 2.10) is unusable, new one is built in * Test is easy, the new one is named __builtin_alloca and comes * from alloca.h which #defines alloca. */ # ifndef NCR # if defined(vax) || defined(sun) || defined(apollo) || defined(stellar) || defined(USL) || defined(alloca) /* * Some System V boxes extract alloca.o from /lib/libPW.a; if you * decide that you don't want to use alloca, you might want to fix it here. */ /* alloca might be a macro taking one arg (hi, Sun!), so give it one. */ # ifndef __sgi /* IRIX 5/6 has definition */ # define __Xnullarg /* as nothing */ # ifndef X_NOT_STDC_ENV extern void *alloca(__Xnullarg); # else extern char *alloca(__Xnullarg); # endif # endif /* __sgi */ # define ALLOCATE_LOCAL(size) alloca((int)(size)) # define DEALLOCATE_LOCAL(ptr) /* as nothing */ # endif /* who does alloca */ # endif /* NCR */ # endif /* __GNUC__ */ #endif /* NO_ALLOCA */ #if !defined(ALLOCATE_LOCAL) # if defined(ALLOCATE_LOCAL_FALLBACK) && defined(DEALLOCATE_LOCAL_FALLBACK) # define ALLOCATE_LOCAL(_size) ALLOCATE_LOCAL_FALLBACK(_size) # define DEALLOCATE_LOCAL(_ptr) DEALLOCATE_LOCAL_FALLBACK(_ptr) # else /* no fallbacks supplied; error */ # define ALLOCATE_LOCAL(_size) ALLOCATE_LOCAL_FALLBACK undefined! # define DEALLOCATE_LOCAL(_ptr) DEALLOCATE_LOCAL_FALLBACK undefined! # endif /* defined(ALLOCATE_LOCAL_FALLBACK && DEALLOCATE_LOCAL_FALLBACK) */ #endif /* !defined(ALLOCATE_LOCAL) */ #endif /* XALLOCA_H */ ================================================ FILE: OSXvnc-server/include/X11/Xfuncproto.h ================================================ /* $XConsortium: Xfuncproto.h,v 1.9 95/06/08 23:20:39 gildea Exp $ */ /* * Copyright (c) 1989, 1991 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * */ /* Definitions to make function prototypes manageable */ #ifndef _XFUNCPROTO_H_ #define _XFUNCPROTO_H_ #ifndef NeedFunctionPrototypes #if defined(FUNCPROTO) || defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus) #define NeedFunctionPrototypes 1 #else #define NeedFunctionPrototypes 0 #endif #endif /* NeedFunctionPrototypes */ #ifndef NeedVarargsPrototypes #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus) || (FUNCPROTO&2) #define NeedVarargsPrototypes 1 #else #define NeedVarargsPrototypes 0 #endif #endif /* NeedVarargsPrototypes */ #if NeedFunctionPrototypes #ifndef NeedNestedPrototypes #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus) || (FUNCPROTO&8) #define NeedNestedPrototypes 1 #else #define NeedNestedPrototypes 0 #endif #endif /* NeedNestedPrototypes */ #ifndef _Xconst #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus) || (FUNCPROTO&4) #define _Xconst const #else #define _Xconst #endif #endif /* _Xconst */ #ifndef NeedWidePrototypes #ifdef NARROWPROTO #define NeedWidePrototypes 0 #else #define NeedWidePrototypes 1 /* default to make interropt. easier */ #endif #endif /* NeedWidePrototypes */ #endif /* NeedFunctionPrototypes */ #ifndef _XFUNCPROTOBEGIN #ifdef __cplusplus /* for C++ V2.0 */ #define _XFUNCPROTOBEGIN extern "C" { /* do not leave open across includes */ #define _XFUNCPROTOEND } #else #define _XFUNCPROTOBEGIN #define _XFUNCPROTOEND #endif #endif /* _XFUNCPROTOBEGIN */ #endif /* _XFUNCPROTO_H_ */ ================================================ FILE: OSXvnc-server/include/X11/Xfuncs.h ================================================ /* * $XConsortium: Xfuncs.h,v 1.16 94/12/01 16:25:53 kaleb Exp $ * $XFree86: xc/include/Xfuncs.h,v 3.2 1995/01/28 15:42:03 dawes Exp $ * * Copyright (c) 1990 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * */ // Lets skip this file #define _XFUNCS_H_ #ifndef _XFUNCS_H_ #define _XFUNCS_H_ #include /* the old Xfuncs.h, for pre-R6 */ #ifdef X_USEBFUNCS void bcopy(); void bzero(); int bcmp(); #else #if (__STDC__ && !defined(X_NOT_STDC_ENV) && !defined(sun) && !defined(macII) && !defined(apollo)) || defined(SVR4) || defined(hpux) || defined(_IBMR2) || defined(_SEQUENT_) #include #define _XFUNCS_H_INCLUDED_STRING_H #define bcopy(b1,b2,len) memmove(b2, b1, (size_t)(len)) #define bzero(b,len) memset(b, 0, (size_t)(len)) #define bcmp(b1,b2,len) memcmp(b1, b2, (size_t)(len)) #else #ifdef sgi #include #else #ifdef SYSV #include void bcopy(); #define bzero(b,len) memset(b, 0, len) #define bcmp(b1,b2,len) memcmp(b1, b2, len) #else #ifdef __EMX__ #include #define _XFUNCS_H_INCLUDED_STRING_H /* bcopy, bcmp, bzero declared */ #else /* bsd */ void bcopy(); void bzero(); int bcmp(); #endif #endif /* SYSV */ #endif /* sgi */ #endif /* __STDC__ and relatives */ #endif /* X_USEBFUNCS */ /* the new Xfuncs.h */ #if !defined(X_NOT_STDC_ENV) && (!defined(sun) || defined(SVR4)) /* the ANSI C way */ #ifndef _XFUNCS_H_INCLUDED_STRING_H #include #endif #undef bzero #define bzero(b,len) memset(b,0,len) #else /* else X_NOT_STDC_ENV or SunOS 4 */ #if defined(SYSV) || defined(luna) || defined(sun) || defined(__sxg__) #include #define memmove(dst,src,len) bcopy((char *)(src),(char *)(dst),(int)(len)) #if defined(SYSV) && defined(_XBCOPYFUNC) #undef memmove #define memmove(dst,src,len) _XBCOPYFUNC((char *)(src),(char *)(dst),(int)(len)) #define _XNEEDBCOPYFUNC #endif #else /* else vanilla BSD */ #define memmove(dst,src,len) bcopy((char *)(src),(char *)(dst),(int)(len)) #define memcpy(dst,src,len) bcopy((char *)(src),(char *)(dst),(int)(len)) #define memcmp(b1,b2,len) bcmp((char *)(b1),(char *)(b2),(int)(len)) #endif /* SYSV else */ #endif /* ! X_NOT_STDC_ENV else */ #endif /* _XFUNCS_H_ */ ================================================ FILE: OSXvnc-server/include/X11/Xmd.h ================================================ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef XMD_H #define XMD_H 1 #if 1 #include #define B16 :16 #define B32 :32 typedef int8_t INT8; typedef int16_t INT16; typedef int32_t INT32; #if !defined(OBJC_BOOL_IS_BOOL) typedef int8_t BOOL; #endif #ifndef __EMX__ #endif typedef uint32_t BITS32; typedef uint8_t BYTE; typedef uint8_t CARD8; typedef uint16_t CARD16; typedef uint32_t CARD32; typedef uint64_t CARD64; #else /* $XConsortium: Xmd.h,v 1.49 95/06/08 23:20:39 gildea Exp $ */ /* $XFree86: xc/include/Xmd.h,v 3.4 1996/12/31 04:15:20 dawes Exp $ */ /* * Xmd.h: MACHINE DEPENDENT DECLARATIONS. */ /* * Special per-machine configuration flags. */ #ifdef CRAY #define WORD64 /* 64-bit architecture */ #endif #if defined(__alpha) || defined(__alpha__) #define LONG64 /* 32/64-bit architecture */ #endif #ifdef __sgi #if (_MIPS_SZLONG == 64) #define LONG64 #endif #endif /* * Stuff to handle large architecture machines; the constants were generated * on a 32-bit machine and must coorespond to the protocol. */ #ifdef WORD64 #define MUSTCOPY #endif /* WORD64 */ /* * Definition of macro used to set constants for size of network structures; * machines with preprocessors that can't handle all of the sz_ symbols * can define this macro to be sizeof(x) if and only if their compiler doesn't * pad out structures (esp. the xTextElt structure which contains only two * one-byte fields). Network structures should always define sz_symbols. * * The sz_ prefix is used instead of something more descriptive so that the * symbols are no more than 32 characters long (which causes problems for some * compilers and preprocessors). * * The extra indirection in the __STDC__ case is to get macro arguments to * expand correctly before the concatenation, rather than afterward. */ #if ((defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)) && !defined(UNIXCPP)) || defined(ANSICPP) #define _SIZEOF(x) sz_##x #define SIZEOF(x) _SIZEOF(x) #else #define SIZEOF(x) sz_/**/x #endif /* if ANSI C compiler else not */ /* * Bitfield suffixes for the protocol structure elements, if you * need them. Note that bitfields are not guarranteed to be signed * (or even unsigned) according to ANSI C. */ #ifdef WORD64 typedef long INT64; typedef unsigned long CARD64; #define B32 :32 #define B16 :16 #ifdef UNSIGNEDBITFIELDS typedef unsigned int INT32; typedef unsigned int INT16; #else #ifdef __STDC__ typedef signed int INT32; typedef signed int INT16; #else typedef int INT32; typedef int INT16; #endif #endif #else #define B32 #define B16 #ifdef LONG64 typedef long INT64; typedef int INT32; #else typedef long INT32; #endif typedef short INT16; #endif #if defined(__STDC__) || defined(sgi) || defined(AIXV3) typedef signed char INT8; #else typedef char INT8; #endif #ifdef LONG64 typedef unsigned long CARD64; typedef unsigned int CARD32; #else typedef unsigned long CARD32; #endif typedef unsigned short CARD16; typedef unsigned char CARD8; typedef CARD32 BITS32; typedef CARD16 BITS16; #ifndef __EMX__ typedef CARD8 BYTE; #ifndef _OBJC_OBJC_H_ typedef CARD8 BOOL; #endif #else /* * This is bad style, but the central include file declares them * as well */ #define BYTE CARD8 #ifndef _OBJC_OBJC_H_ #define BOOL CARD8 #endif #endif /* * definitions for sign-extending bitfields on 64-bit architectures */ #if defined(WORD64) && defined(UNSIGNEDBITFIELDS) #define cvtINT8toInt(val) (((val) & 0x00000080) ? ((val) | 0xffffffffffffff00) : (val)) #define cvtINT16toInt(val) (((val) & 0x00008000) ? ((val) | 0xffffffffffff0000) : (val)) #define cvtINT32toInt(val) (((val) & 0x80000000) ? ((val) | 0xffffffff00000000) : (val)) #define cvtINT8toShort(val) cvtINT8toInt(val) #define cvtINT16toShort(val) cvtINT16toInt(val) #define cvtINT32toShort(val) cvtINT32toInt(val) #define cvtINT8toLong(val) cvtINT8toInt(val) #define cvtINT16toLong(val) cvtINT16toInt(val) #define cvtINT32toLong(val) cvtINT32toInt(val) #else #define cvtINT8toInt(val) (val) #define cvtINT16toInt(val) (val) #define cvtINT32toInt(val) (val) #define cvtINT8toShort(val) (val) #define cvtINT16toShort(val) (val) #define cvtINT32toShort(val) (val) #define cvtINT8toLong(val) (val) #define cvtINT16toLong(val) (val) #define cvtINT32toLong(val) (val) #endif /* WORD64 and UNSIGNEDBITFIELDS */ #ifdef MUSTCOPY /* * This macro must not cast or else pointers will get aligned and be wrong */ #define NEXTPTR(p,t) (((char *) p) + SIZEOF(t)) #else /* else not MUSTCOPY, this is used for 32-bit machines */ /* * this version should leave result of type (t *), but that should only be * used when not in MUSTCOPY */ #define NEXTPTR(p,t) (((t *)(p)) + 1) #endif /* MUSTCOPY - used machines whose C structs don't line up with proto */ #endif /* 0 */ #endif /* XMD_H */ ================================================ FILE: OSXvnc-server/include/X11/Xos.h ================================================ /* * $XConsortium: Xos.h /main/70 1996/11/15 16:00:41 kaleb $ * $XFree86: xc/include/Xos.h,v 3.21.2.1 1998/01/23 12:35:11 dawes Exp $ * * Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * The X Window System is a Trademark of X Consortium. * */ /* This is a collection of things to try and minimize system dependencies * in a "significant" number of source files. */ #ifndef _XOS_H_ #define _XOS_H_ #include /* * Get major data types (esp. caddr_t) */ #ifdef USG #ifndef __TYPES__ #ifdef CRAY #define word word_t #endif /* CRAY */ #include /* forgot to protect it... */ #define __TYPES__ #endif /* __TYPES__ */ #else /* USG */ #if defined(_POSIX_SOURCE) && (defined(MOTOROLA) || defined(AMOEBA)) #undef _POSIX_SOURCE #include #define _POSIX_SOURCE #else #include #endif #endif /* USG */ /* * Just about everyone needs the strings routines. We provide both forms here, * index/rindex and strchr/strrchr, so any systems that don't provide them all * need to have #defines here. * * NOTE: The following ISN'T true for this XFree86 version of this file. * * These macros are defined this way, rather than, e.g.: * #defined index(s,c) strchr(s,c) * because someone might be using them as function pointers, and such * a change would break compatibility for anyone who's relying on them * being the way they currently are. So we're stuck with them this way, * which can be really inconvenient. :-( */ #ifndef X_NOT_STDC_ENV #include #ifdef __STDC__ #ifndef index #define index(s,c) (strchr((s),(c))) #endif #ifndef rindex #define rindex(s,c) (strrchr((s),(c))) #endif #else #ifndef index #define index strchr #endif #ifndef rindex #define rindex strrchr #endif #endif #else #ifdef SYSV #if defined(clipper) || defined(__clipper__) #include #endif #include #define index strchr #define rindex strrchr #else #include #define strchr index #define strrchr rindex #endif #endif /* X_NOT_STDC_ENV */ /* * strerror() */ #if (defined(X_NOT_STDC_ENV) || (defined(sun) && !defined(SVR4)) || defined(macII)) && !defined(__GLIBC__) #ifndef strerror extern char *sys_errlist[]; extern int sys_nerr; #define strerror(n) \ (((n) >= 0 && (n) < sys_nerr) ? sys_errlist[n] : "unknown error") #endif #endif /* * Get open(2) constants */ #ifdef X_NOT_POSIX #include #if defined(USL) || defined(CRAY) || defined(MOTOROLA) || (defined(i386) && (defined(SYSV) || defined(SVR4))) || defined(__sxg__) #include #endif #ifdef WIN32 #include #else #include #endif #else /* X_NOT_POSIX */ #if !defined(_POSIX_SOURCE) && defined(macII) #define _POSIX_SOURCE #include #include #undef _POSIX_SOURCE #else #include #include #endif #endif /* X_NOT_POSIX else */ #ifdef CSRG_BASED #include #include #endif /* CSRG_BASED */ /* * Get struct timeval */ #ifdef SYSV #ifndef USL #include #endif #include #ifdef CRAY #undef word #endif /* CRAY */ #if defined(USG) && !defined(CRAY) && !defined(MOTOROLA) && !defined(uniosu) && !defined(__sxg__) && !defined(clipper) && !defined(__clipper__) struct timeval { long tv_sec; long tv_usec; }; #ifndef USL_SHARELIB struct timezone { int tz_minuteswest; int tz_dsttime; }; #endif /* USL_SHARELIB */ #endif /* USG */ #ifdef _SEQUENT_ struct timezone { int tz_minuteswest; int tz_dsttime; }; #endif /* _SEQUENT_ */ #else /* not SYSV */ #if defined(_ANSI_SOURCE) && defined(__bsdi__) #undef _ANSI_SOURCE #include #define _ANSI_SOURCE #endif #if defined(_POSIX_SOURCE) && defined(SVR4) /* need to omit _POSIX_SOURCE in order to get what we want in SVR4 */ #undef _POSIX_SOURCE #include #define _POSIX_SOURCE #else /* defined(_POSIX_SOURCE) && defined(SVR4) */ #ifdef WIN32 #include #if !defined(_WINSOCKAPI_) && !defined(_WILLWINSOCK_) struct timeval { long tv_sec; /* seconds */ long tv_usec; /* and microseconds */ }; #endif #include #define gettimeofday(t) \ { \ struct _timeb _gtodtmp; \ _ftime (&_gtodtmp); \ (t)->tv_sec = _gtodtmp.time; \ (t)->tv_usec = _gtodtmp.millitm * 1000; \ } #else /* WIN32 */ #ifdef _SEQUENT_ #include #else /* _SEQUENT_ */ #ifdef AMOEBA #include #include #else /* AMOEBA */ #ifdef MINIX #include #else /* !MINIX */ #ifndef Lynx #include #else #include #endif /* Lynx */ #endif /* MINIX */ #endif /* AMOEBA */ #endif /* _SEQUENT_ */ #endif /* WIN32 else */ #endif /* defined(_POSIX_SOURCE) && defined(SVR4) */ #endif /* SYSV */ /* define X_GETTIMEOFDAY macro, a portable gettimeofday() */ #if defined(_XOPEN_XPG4) || defined(_XOPEN_UNIX) /* _XOPEN_UNIX is XPG4.2 */ #define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0) #else #if defined(SVR4) || defined(VMS) || defined(WIN32) #define X_GETTIMEOFDAY(t) gettimeofday(t) #else #define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0) #endif #endif /* XPG4 else */ #ifdef MINIX #include #include #include #include #include struct sockaddr { u16_t sa_family; char sa_data[14]; }; struct sockaddr_in { u16_t sin_family; u16_t sin_port; struct { ipaddr_t s_addr; } sin_addr; char sin_zero[8]; }; struct in_addr { ipaddr_t s_addr; }; typedef char *caddr_t; typedef unsigned char u_char; #endif /* MINIX */ #ifdef __EMX__ typedef unsigned long fd_mask; #endif /* use POSIX name for signal */ #if defined(X_NOT_POSIX) && defined(SYSV) && !defined(SIGCHLD) && !defined(ISC) #define SIGCHLD SIGCLD #endif #ifdef ISC #include #include #define NGROUPS 16 #endif #if defined(ISC) || defined(__EMX__) /* * Some OS's may not have this */ #define X_NO_SYS_UN 1 struct sockaddr_un { short sun_family; char sun_path[108]; }; #endif #endif /* _XOS_H_ */ ================================================ FILE: OSXvnc-server/include/X11/Xosdefs.h ================================================ /* * O/S-dependent (mis)feature macro definitions * * $XConsortium: Xosdefs.h /main/16 1996/09/28 16:17:29 rws $ * $XFree86: xc/include/Xosdefs.h,v 3.11 1996/12/23 05:58:09 dawes Exp $ * Copyright (c) 1991 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #ifndef _XOSDEFS_H_ #define _XOSDEFS_H_ /* * X_NOT_STDC_ENV means does not have ANSI C header files. Lack of this * symbol does NOT mean that the system has stdarg.h. * * X_NOT_POSIX means does not have POSIX header files. Lack of this * symbol does NOT mean that the POSIX environment is the default. * You may still have to define _POSIX_SOURCE to get it. */ #ifdef NOSTDHDRS #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #ifdef sony #if !defined(SYSTYPE_SYSV) && !defined(_SYSTYPE_SYSV) #define X_NOT_POSIX #endif #endif #ifdef UTEK #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #ifdef vax #ifndef ultrix /* assume vanilla BSD */ #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #endif #ifdef luna #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #ifdef Mips #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #ifdef USL #ifdef SYSV /* (release 3.2) */ #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #endif #ifdef i386 #ifdef SYSV #if !(defined(ISC) && defined(_POSIX_SOURCE)) #ifndef SCO #ifndef _SCO_DS /* SCO 5.0 has SVR4 header files */ #define X_NOT_POSIX #endif #define X_NOT_STDC_ENV #endif #endif /* !(defined(ISC) && defined(_POSIX_SOURCE)) */ #endif #endif #ifdef MOTOROLA #ifdef SYSV #define X_NOT_STDC_ENV #endif #endif #ifdef sun #ifdef SVR4 /* define this to whatever it needs to be */ #define X_POSIX_C_SOURCE 199300L #endif #endif #ifdef WIN32 #ifndef _POSIX_ #define X_NOT_POSIX #endif #endif #if defined(nec_ews_svr2) || defined(SX) || defined(PC_UX) #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #ifdef __EMX__ #define USGISH /* EMX claims to be ANSI, so X_NOT_STDC_ENV does not hold */ /* could have been provided as std flags as well */ #define X_WCHAR #define X_LOCALE #endif #endif /* _XOSDEFS_H_ */ ================================================ FILE: OSXvnc-server/include/X11/Xproto.h ================================================ /* * $XConsortium: Xproto.h /main/21 1996/03/20 15:27:51 mor $ */ /* Definitions for the X window system used by server and c bindings */ /* * This packet-construction scheme makes the following assumptions: * * 1. The compiler is able * to generate code which addresses one- and two-byte quantities. * In the worst case, this would be done with bit-fields. If bit-fields * are used it may be necessary to reorder the request fields in this file, * depending on the order in which the machine assigns bit fields to * machine words. There may also be a problem with sign extension, * as K+R specify that bitfields are always unsigned. * * 2. 2- and 4-byte fields in packet structures must be ordered by hand * such that they are naturally-aligned, so that no compiler will ever * insert padding bytes. * * 3. All packets are hand-padded to a multiple of 4 bytes, for * the same reason. */ #ifndef XPROTO_H #define XPROTO_H /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include #include /* * Define constants for the sizes of the network packets. The sz_ prefix is * used instead of something more descriptive so that the symbols are no more * than 32 characters in length (which causes problems for some compilers). */ #define sz_xSegment 8 #define sz_xPoint 4 #define sz_xRectangle 8 #define sz_xArc 12 #define sz_xConnClientPrefix 12 #define sz_xConnSetupPrefix 8 #define sz_xConnSetup 32 #define sz_xPixmapFormat 8 #define sz_xDepth 8 #define sz_xVisualType 24 #define sz_xWindowRoot 40 #define sz_xTimecoord 8 #define sz_xHostEntry 4 #define sz_xCharInfo 12 #define sz_xFontProp 8 #define sz_xTextElt 2 #define sz_xColorItem 12 #define sz_xrgb 8 #define sz_xGenericReply 32 #define sz_xGetWindowAttributesReply 44 #define sz_xGetGeometryReply 32 #define sz_xQueryTreeReply 32 #define sz_xInternAtomReply 32 #define sz_xGetAtomNameReply 32 #define sz_xGetPropertyReply 32 #define sz_xListPropertiesReply 32 #define sz_xGetSelectionOwnerReply 32 #define sz_xGrabPointerReply 32 #define sz_xQueryPointerReply 32 #define sz_xGetMotionEventsReply 32 #define sz_xTranslateCoordsReply 32 #define sz_xGetInputFocusReply 32 #define sz_xQueryKeymapReply 40 #define sz_xQueryFontReply 60 #define sz_xQueryTextExtentsReply 32 #define sz_xListFontsReply 32 #define sz_xGetFontPathReply 32 #define sz_xGetImageReply 32 #define sz_xListInstalledColormapsReply 32 #define sz_xAllocColorReply 32 #define sz_xAllocNamedColorReply 32 #define sz_xAllocColorCellsReply 32 #define sz_xAllocColorPlanesReply 32 #define sz_xQueryColorsReply 32 #define sz_xLookupColorReply 32 #define sz_xQueryBestSizeReply 32 #define sz_xQueryExtensionReply 32 #define sz_xListExtensionsReply 32 #define sz_xSetMappingReply 32 #define sz_xGetKeyboardControlReply 52 #define sz_xGetPointerControlReply 32 #define sz_xGetScreenSaverReply 32 #define sz_xListHostsReply 32 #define sz_xSetModifierMappingReply 32 #define sz_xError 32 #define sz_xEvent 32 #define sz_xKeymapEvent 32 #define sz_xReq 4 #define sz_xResourceReq 8 #define sz_xCreateWindowReq 32 #define sz_xChangeWindowAttributesReq 12 #define sz_xChangeSaveSetReq 8 #define sz_xReparentWindowReq 16 #define sz_xConfigureWindowReq 12 #define sz_xCirculateWindowReq 8 #define sz_xInternAtomReq 8 #define sz_xChangePropertyReq 24 #define sz_xDeletePropertyReq 12 #define sz_xGetPropertyReq 24 #define sz_xSetSelectionOwnerReq 16 #define sz_xConvertSelectionReq 24 #define sz_xSendEventReq 44 #define sz_xGrabPointerReq 24 #define sz_xGrabButtonReq 24 #define sz_xUngrabButtonReq 12 #define sz_xChangeActivePointerGrabReq 16 #define sz_xGrabKeyboardReq 16 #define sz_xGrabKeyReq 16 #define sz_xUngrabKeyReq 12 #define sz_xAllowEventsReq 8 #define sz_xGetMotionEventsReq 16 #define sz_xTranslateCoordsReq 16 #define sz_xWarpPointerReq 24 #define sz_xSetInputFocusReq 12 #define sz_xOpenFontReq 12 #define sz_xQueryTextExtentsReq 8 #define sz_xListFontsReq 8 #define sz_xSetFontPathReq 8 #define sz_xCreatePixmapReq 16 #define sz_xCreateGCReq 16 #define sz_xChangeGCReq 12 #define sz_xCopyGCReq 16 #define sz_xSetDashesReq 12 #define sz_xSetClipRectanglesReq 12 #define sz_xCopyAreaReq 28 #define sz_xCopyPlaneReq 32 #define sz_xPolyPointReq 12 #define sz_xPolySegmentReq 12 #define sz_xFillPolyReq 16 #define sz_xPutImageReq 24 #define sz_xGetImageReq 20 #define sz_xPolyTextReq 16 #define sz_xImageTextReq 16 #define sz_xCreateColormapReq 16 #define sz_xCopyColormapAndFreeReq 12 #define sz_xAllocColorReq 16 #define sz_xAllocNamedColorReq 12 #define sz_xAllocColorCellsReq 12 #define sz_xAllocColorPlanesReq 16 #define sz_xFreeColorsReq 12 #define sz_xStoreColorsReq 8 #define sz_xStoreNamedColorReq 16 #define sz_xQueryColorsReq 8 #define sz_xLookupColorReq 12 #define sz_xCreateCursorReq 32 #define sz_xCreateGlyphCursorReq 32 #define sz_xRecolorCursorReq 20 #define sz_xQueryBestSizeReq 12 #define sz_xQueryExtensionReq 8 #define sz_xChangeKeyboardControlReq 8 #define sz_xBellReq 4 #define sz_xChangePointerControlReq 12 #define sz_xSetScreenSaverReq 12 #define sz_xChangeHostsReq 8 #define sz_xListHostsReq 4 #define sz_xChangeModeReq 4 #define sz_xRotatePropertiesReq 12 #define sz_xReply 32 #define sz_xGrabKeyboardReply 32 #define sz_xListFontsWithInfoReply 60 #define sz_xSetPointerMappingReply 32 #define sz_xGetKeyboardMappingReply 32 #define sz_xGetPointerMappingReply 32 #define sz_xGetModifierMappingReply 32 #define sz_xListFontsWithInfoReq 8 #define sz_xPolyLineReq 12 #define sz_xPolyArcReq 12 #define sz_xPolyRectangleReq 12 #define sz_xPolyFillRectangleReq 12 #define sz_xPolyFillArcReq 12 #define sz_xPolyText8Req 16 #define sz_xPolyText16Req 16 #define sz_xImageText8Req 16 #define sz_xImageText16Req 16 #define sz_xSetPointerMappingReq 4 #define sz_xForceScreenSaverReq 4 #define sz_xSetCloseDownModeReq 4 #define sz_xClearAreaReq 16 #define sz_xSetAccessControlReq 4 #define sz_xGetKeyboardMappingReq 8 #define sz_xSetModifierMappingReq 4 #define sz_xPropIconSize 24 #define sz_xChangeKeyboardMappingReq 8 /* For the purpose of the structure definitions in this file, we must redefine the following types in terms of Xmd.h's types, which may include bit fields. All of these are #undef'd at the end of this file, restoring the definitions in X.h. */ #define Window CARD32 #define Drawable CARD32 #define Font CARD32 #define Pixmap CARD32 #define Cursor CARD32 #define Colormap CARD32 #define GContext CARD32 #define Atom CARD32 #define VisualID CARD32 #define Time CARD32 #define KeyCode CARD8 #define KeySym CARD32 #define X_TCP_PORT 6000 /* add display number */ #define xTrue 1 #define xFalse 0 typedef CARD16 KeyButMask; /***************** connection setup structure. This is followed by numRoots xWindowRoot structs. *****************/ typedef struct { CARD8 byteOrder; BYTE pad; CARD16 majorVersion B16, minorVersion B16; CARD16 nbytesAuthProto B16; /* Authorization protocol */ CARD16 nbytesAuthString B16; /* Authorization string */ CARD16 pad2 B16; } xConnClientPrefix; typedef struct { CARD8 success; BYTE lengthReason; /*num bytes in string following if failure */ CARD16 majorVersion B16, minorVersion B16; CARD16 length B16; /* 1/4 additional bytes in setup info */ } xConnSetupPrefix; typedef struct { CARD32 release B32; CARD32 ridBase B32, ridMask B32; CARD32 motionBufferSize B32; CARD16 nbytesVendor B16; /* number of bytes in vendor string */ CARD16 maxRequestSize B16; CARD8 numRoots; /* number of roots structs to follow */ CARD8 numFormats; /* number of pixmap formats */ CARD8 imageByteOrder; /* LSBFirst, MSBFirst */ CARD8 bitmapBitOrder; /* LeastSignificant, MostSign...*/ CARD8 bitmapScanlineUnit, /* 8, 16, 32 */ bitmapScanlinePad; /* 8, 16, 32 */ KeyCode minKeyCode, maxKeyCode; CARD32 pad2 B32; } xConnSetup; typedef struct { CARD8 depth; CARD8 bitsPerPixel; CARD8 scanLinePad; CARD8 pad1; CARD32 pad2 B32; } xPixmapFormat; /* window root */ typedef struct { CARD8 depth; CARD8 pad1; CARD16 nVisuals B16; /* number of xVisualType structures following */ CARD32 pad2 B32; } xDepth; typedef struct { VisualID visualID B32; #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD8 bitsPerRGB; CARD16 colormapEntries B16; CARD32 redMask B32, greenMask B32, blueMask B32; CARD32 pad B32; } xVisualType; typedef struct { Window windowId B32; Colormap defaultColormap B32; CARD32 whitePixel B32, blackPixel B32; CARD32 currentInputMask B32; CARD16 pixWidth B16, pixHeight B16; CARD16 mmWidth B16, mmHeight B16; CARD16 minInstalledMaps B16, maxInstalledMaps B16; VisualID rootVisualID B32; CARD8 backingStore; BOOL saveUnders; CARD8 rootDepth; CARD8 nDepths; /* number of xDepth structures following */ } xWindowRoot; /***************************************************************** * Structure Defns * Structures needed for replies *****************************************************************/ /* Used in GetMotionEvents */ typedef struct { CARD32 time B32; INT16 x B16, y B16; } xTimecoord; typedef struct { CARD8 family; BYTE pad; CARD16 length B16; } xHostEntry; typedef struct { INT16 leftSideBearing B16, rightSideBearing B16, characterWidth B16, ascent B16, descent B16; CARD16 attributes B16; } xCharInfo; typedef struct { Atom name B32; CARD32 value B32; } xFontProp; /* * non-aligned big-endian font ID follows this struct */ typedef struct { /* followed by string */ CARD8 len; /* number of *characters* in string, or FontChange (255) for font change, or 0 if just delta given */ INT8 delta; } xTextElt; typedef struct { CARD32 pixel B32; CARD16 red B16, green B16, blue B16; CARD8 flags; /* DoRed, DoGreen, DoBlue booleans */ CARD8 pad; } xColorItem; typedef struct { CARD16 red B16, green B16, blue B16, pad B16; } xrgb; typedef CARD8 KEYCODE; /***************** * XRep: * meant to be 32 byte quantity *****************/ /* GenericReply is the common format of all replies. The "data" items are specific to each individual reply type. */ typedef struct { BYTE type; /* X_Reply */ BYTE data1; /* depends on reply type */ CARD16 sequenceNumber B16; /* of last request received by server */ CARD32 length B32; /* 4 byte quantities beyond size of GenericReply */ CARD32 data00 B32; CARD32 data01 B32; CARD32 data02 B32; CARD32 data03 B32; CARD32 data04 B32; CARD32 data05 B32; } xGenericReply; /* Individual reply formats. */ typedef struct { BYTE type; /* X_Reply */ CARD8 backingStore; CARD16 sequenceNumber B16; CARD32 length B32; /* NOT 0; this is an extra-large reply */ VisualID visualID B32; #if defined(__cplusplus) || defined(c_plusplus) CARD16 c_class B16; #else CARD16 class B16; #endif CARD8 bitGravity; CARD8 winGravity; CARD32 backingBitPlanes B32; CARD32 backingPixel B32; BOOL saveUnder; BOOL mapInstalled; CARD8 mapState; BOOL override; Colormap colormap B32; CARD32 allEventMasks B32; CARD32 yourEventMask B32; CARD16 doNotPropagateMask B16; CARD16 pad B16; } xGetWindowAttributesReply; typedef struct { BYTE type; /* X_Reply */ CARD8 depth; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ Window root B32; INT16 x B16, y B16; CARD16 width B16, height B16; CARD16 borderWidth B16; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; } xGetGeometryReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; Window root B32, parent B32; CARD16 nChildren B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xQueryTreeReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ Atom atom B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xInternAtomReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* of additional bytes */ CARD16 nameLength B16; /* # of characters in name */ CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xGetAtomNameReply; typedef struct { BYTE type; /* X_Reply */ CARD8 format; CARD16 sequenceNumber B16; CARD32 length B32; /* of additional bytes */ Atom propertyType B32; CARD32 bytesAfter B32; CARD32 nItems B32; /* # of 8, 16, or 32-bit entities in reply */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xGetPropertyReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nProperties B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xListPropertiesReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ Window owner B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGetSelectionOwnerReply; typedef struct { BYTE type; /* X_Reply */ BYTE status; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGrabPointerReply; typedef xGrabPointerReply xGrabKeyboardReply; typedef struct { BYTE type; /* X_Reply */ BOOL sameScreen; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ Window root B32, child B32; INT16 rootX B16, rootY B16, winX B16, winY B16; CARD16 mask B16; CARD16 pad1 B16; CARD32 pad B32; } xQueryPointerReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 nEvents B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGetMotionEventsReply; typedef struct { BYTE type; /* X_Reply */ BOOL sameScreen; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ Window child B32; INT16 dstX B16, dstY B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xTranslateCoordsReply; typedef struct { BYTE type; /* X_Reply */ CARD8 revertTo; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ Window focus B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xGetInputFocusReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 2, NOT 0; this is an extra-large reply */ BYTE map[32]; } xQueryKeymapReply; /* Warning: this MUST match (up to component renaming) xListFontsWithInfoReply */ typedef struct _xQueryFontReply { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* definitely > 0, even if "nCharInfos" is 0 */ xCharInfo minBounds; #ifndef WORD64 CARD32 walign1 B32; #endif xCharInfo maxBounds; #ifndef WORD64 CARD32 walign2 B32; #endif CARD16 minCharOrByte2 B16, maxCharOrByte2 B16; CARD16 defaultChar B16; CARD16 nFontProps B16; /* followed by this many xFontProp structures */ CARD8 drawDirection; CARD8 minByte1, maxByte1; BOOL allCharsExist; INT16 fontAscent B16, fontDescent B16; CARD32 nCharInfos B32; /* followed by this many xCharInfo structures */ } xQueryFontReply; typedef struct { BYTE type; /* X_Reply */ CARD8 drawDirection; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ INT16 fontAscent B16, fontDescent B16; INT16 overallAscent B16, overallDescent B16; INT32 overallWidth B32, overallLeft B32, overallRight B32; CARD32 pad B32; } xQueryTextExtentsReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nFonts B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xListFontsReply; /* Warning: this MUST match (up to component renaming) xQueryFontReply */ typedef struct { BYTE type; /* X_Reply */ CARD8 nameLength; /* 0 indicates end-of-reply-sequence */ CARD16 sequenceNumber B16; CARD32 length B32; /* definitely > 0, even if "nameLength" is 0 */ xCharInfo minBounds; #ifndef WORD64 CARD32 walign1 B32; #endif xCharInfo maxBounds; #ifndef WORD64 CARD32 walign2 B32; #endif CARD16 minCharOrByte2 B16, maxCharOrByte2 B16; CARD16 defaultChar B16; CARD16 nFontProps B16; /* followed by this many xFontProp structures */ CARD8 drawDirection; CARD8 minByte1, maxByte1; BOOL allCharsExist; INT16 fontAscent B16, fontDescent B16; CARD32 nReplies B32; /* hint as to how many more replies might be coming */ } xListFontsWithInfoReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nPaths B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xGetFontPathReply; typedef struct { BYTE type; /* X_Reply */ CARD8 depth; CARD16 sequenceNumber B16; CARD32 length B32; VisualID visual B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xGetImageReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nColormaps B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xListInstalledColormapsReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD16 red B16, green B16, blue B16; CARD16 pad2 B16; CARD32 pixel B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xAllocColorReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD32 pixel B32; CARD16 exactRed B16, exactGreen B16, exactBlue B16; CARD16 screenRed B16, screenGreen B16, screenBlue B16; CARD32 pad2 B32; CARD32 pad3 B32; } xAllocNamedColorReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nPixels B16, nMasks B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xAllocColorCellsReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nPixels B16; CARD16 pad2 B16; CARD32 redMask B32, greenMask B32, blueMask B32; CARD32 pad3 B32; CARD32 pad4 B32; } xAllocColorPlanesReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nColors B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xQueryColorsReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD16 exactRed B16, exactGreen B16, exactBlue B16; CARD16 screenRed B16, screenGreen B16, screenBlue B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xLookupColorReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD16 width B16, height B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xQueryBestSizeReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ BOOL present; CARD8 major_opcode; CARD8 first_event; CARD8 first_error; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xQueryExtensionReply; typedef struct { BYTE type; /* X_Reply */ CARD8 nExtensions; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xListExtensionsReply; typedef struct { BYTE type; /* X_Reply */ CARD8 success; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xSetMappingReply; typedef xSetMappingReply xSetPointerMappingReply; typedef xSetMappingReply xSetModifierMappingReply; typedef struct { BYTE type; /* X_Reply */ CARD8 nElts; /* how many elements does the map have */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xGetPointerMappingReply; typedef struct { BYTE type; CARD8 keySymsPerKeyCode; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xGetKeyboardMappingReply; typedef struct { BYTE type; CARD8 numKeyPerModifier; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGetModifierMappingReply; typedef struct { BYTE type; /* X_Reply */ BOOL globalAutoRepeat; CARD16 sequenceNumber B16; CARD32 length B32; /* 5 */ CARD32 ledMask B32; CARD8 keyClickPercent, bellPercent; CARD16 bellPitch B16, bellDuration B16; CARD16 pad B16; BYTE map[32]; /* bit masks start here */ } xGetKeyboardControlReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD16 accelNumerator B16, accelDenominator B16; CARD16 threshold B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGetPointerControlReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD16 timeout B16, interval B16; BOOL preferBlanking; BOOL allowExposures; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGetScreenSaverReply; typedef struct { BYTE type; /* X_Reply */ BOOL enabled; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nHosts B16; CARD16 pad1 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xListHostsReply; /***************************************************************** * Xerror * All errors are 32 bytes *****************************************************************/ typedef struct { BYTE type; /* X_Error */ BYTE errorCode; CARD16 sequenceNumber B16; /* the nth request from this client */ CARD32 resourceID B32; CARD16 minorCode B16; CARD8 majorCode; BYTE pad1; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xError; /***************************************************************** * xEvent * All events are 32 bytes *****************************************************************/ typedef struct _xEvent { union { struct { BYTE type; BYTE detail; CARD16 sequenceNumber B16; } u; struct { CARD32 pad00 B32; Time time B32; Window root B32, event B32, child B32; INT16 rootX B16, rootY B16, eventX B16, eventY B16; KeyButMask state B16; BOOL sameScreen; BYTE pad1; } keyButtonPointer; struct { CARD32 pad00 B32; Time time B32; Window root B32, event B32, child B32; INT16 rootX B16, rootY B16, eventX B16, eventY B16; KeyButMask state B16; BYTE mode; /* really XMode */ BYTE flags; /* sameScreen and focus booleans, packed together */ #define ELFlagFocus (1<<0) #define ELFlagSameScreen (1<<1) } enterLeave; struct { CARD32 pad00 B32; Window window B32; BYTE mode; /* really XMode */ BYTE pad1, pad2, pad3; } focus; struct { CARD32 pad00 B32; Window window B32; CARD16 x B16, y B16, width B16, height B16; CARD16 count B16; CARD16 pad2 B16; } expose; struct { CARD32 pad00 B32; Drawable drawable B32; CARD16 x B16, y B16, width B16, height B16; CARD16 minorEvent B16; CARD16 count B16; BYTE majorEvent; BYTE pad1, pad2, pad3; } graphicsExposure; struct { CARD32 pad00 B32; Drawable drawable B32; CARD16 minorEvent B16; BYTE majorEvent; BYTE bpad; } noExposure; struct { CARD32 pad00 B32; Window window B32; CARD8 state; BYTE pad1, pad2, pad3; } visibility; struct { CARD32 pad00 B32; Window parent B32, window B32; INT16 x B16, y B16; CARD16 width B16, height B16, borderWidth B16; BOOL override; BYTE bpad; } createNotify; /* * The event feilds in the structures for DestroyNotify, UnmapNotify, * MapNotify, ReparentNotify, ConfigureNotify, CirclulateNotify, GravityNotify, * must be at the same offset because server internal code is depending upon * this to patch up the events before they are delivered. * Also note that MapRequest, ConfigureRequest and CirculateRequest have * the same offset for the event window. */ struct { CARD32 pad00 B32; Window event B32, window B32; } destroyNotify; struct { CARD32 pad00 B32; Window event B32, window B32; BOOL fromConfigure; BYTE pad1, pad2, pad3; } unmapNotify; struct { CARD32 pad00 B32; Window event B32, window B32; BOOL override; BYTE pad1, pad2, pad3; } mapNotify; struct { CARD32 pad00 B32; Window parent B32, window B32; } mapRequest; struct { CARD32 pad00 B32; Window event B32, window B32, parent B32; INT16 x B16, y B16; BOOL override; BYTE pad1, pad2, pad3; } reparent; struct { CARD32 pad00 B32; Window event B32, window B32, aboveSibling B32; INT16 x B16, y B16; CARD16 width B16, height B16, borderWidth B16; BOOL override; BYTE bpad; } configureNotify; struct { CARD32 pad00 B32; Window parent B32, window B32, sibling B32; INT16 x B16, y B16; CARD16 width B16, height B16, borderWidth B16; CARD16 valueMask B16; CARD32 pad1 B32; } configureRequest; struct { CARD32 pad00 B32; Window event B32, window B32; INT16 x B16, y B16; CARD32 pad1 B32, pad2 B32, pad3 B32, pad4 B32; } gravity; struct { CARD32 pad00 B32; Window window B32; CARD16 width B16, height B16; } resizeRequest; struct { /* The event field in the circulate record is really the parent when this is used as a CirculateRequest insteaad of a CircluateNotify */ CARD32 pad00 B32; Window event B32, window B32, parent B32; BYTE place; /* Top or Bottom */ BYTE pad1, pad2, pad3; } circulate; struct { CARD32 pad00 B32; Window window B32; Atom atom B32; Time time B32; BYTE state; /* NewValue or Deleted */ BYTE pad1; CARD16 pad2 B16; } property; struct { CARD32 pad00 B32; Time time B32; Window window B32; Atom atom B32; } selectionClear; struct { CARD32 pad00 B32; Time time B32; Window owner B32, requestor B32; Atom selection B32, target B32, property B32; } selectionRequest; struct { CARD32 pad00 B32; Time time B32; Window requestor B32; Atom selection B32, target B32, property B32; } selectionNotify; struct { CARD32 pad00 B32; Window window B32; Colormap colormap B32; #if defined(__cplusplus) || defined(c_plusplus) BOOL c_new; #else BOOL new; #endif BYTE state; /* Installed or UnInstalled */ BYTE pad1, pad2; } colormap; struct { CARD32 pad00 B32; CARD8 request; KeyCode firstKeyCode; CARD8 count; BYTE pad1; } mappingNotify; struct { CARD32 pad00 B32; Window window B32; union { struct { Atom type B32; INT32 longs0 B32; INT32 longs1 B32; INT32 longs2 B32; INT32 longs3 B32; INT32 longs4 B32; } l; struct { Atom type B32; INT16 shorts0 B16; INT16 shorts1 B16; INT16 shorts2 B16; INT16 shorts3 B16; INT16 shorts4 B16; INT16 shorts5 B16; INT16 shorts6 B16; INT16 shorts7 B16; INT16 shorts8 B16; INT16 shorts9 B16; } s; struct { Atom type B32; INT8 bytes[20]; } b; } u; } clientMessage; } u; } xEvent; /* KeymapNotify events are not included in the above union because they are different from all other events: they do not have a "detail" or "sequenceNumber", so there is room for a 248-bit key mask. */ typedef struct { BYTE type; BYTE map[31]; } xKeymapEvent; #define XEventSize (sizeof(xEvent)) /* XReply is the union of all the replies above whose "fixed part" fits in 32 bytes. It does NOT include GetWindowAttributesReply, QueryFontReply, QueryKeymapReply, or GetKeyboardControlReply ListFontsWithInfoReply */ typedef union { xGenericReply generic; xGetGeometryReply geom; xQueryTreeReply tree; xInternAtomReply atom; xGetAtomNameReply atomName; xGetPropertyReply property; xListPropertiesReply listProperties; xGetSelectionOwnerReply selection; xGrabPointerReply grabPointer; xGrabKeyboardReply grabKeyboard; xQueryPointerReply pointer; xGetMotionEventsReply motionEvents; xTranslateCoordsReply coords; xGetInputFocusReply inputFocus; xQueryTextExtentsReply textExtents; xListFontsReply fonts; xGetFontPathReply fontPath; xGetImageReply image; xListInstalledColormapsReply colormaps; xAllocColorReply allocColor; xAllocNamedColorReply allocNamedColor; xAllocColorCellsReply colorCells; xAllocColorPlanesReply colorPlanes; xQueryColorsReply colors; xLookupColorReply lookupColor; xQueryBestSizeReply bestSize; xQueryExtensionReply extension; xListExtensionsReply extensions; xSetModifierMappingReply setModifierMapping; xGetModifierMappingReply getModifierMapping; xSetPointerMappingReply setPointerMapping; xGetKeyboardMappingReply getKeyboardMapping; xGetPointerMappingReply getPointerMapping; xGetPointerControlReply pointerControl; xGetScreenSaverReply screenSaver; xListHostsReply hosts; xError error; xEvent event; } xReply; /***************************************************************** * REQUESTS *****************************************************************/ /* Request structure */ typedef struct _xReq { CARD8 reqType; CARD8 data; /* meaning depends on request type */ CARD16 length B16; /* length in 4 bytes quantities of whole request, including this header */ } xReq; /***************************************************************** * structures that follow request. *****************************************************************/ /* ResourceReq is used for any request which has a resource ID (or Atom or Time) as its one and only argument. */ typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; CARD32 id B32; /* a Window, Drawable, Font, GContext, Pixmap, etc. */ } xResourceReq; typedef struct { CARD8 reqType; CARD8 depth; CARD16 length B16; Window wid B32, parent B32; INT16 x B16, y B16; CARD16 width B16, height B16, borderWidth B16; #if defined(__cplusplus) || defined(c_plusplus) CARD16 c_class B16; #else CARD16 class B16; #endif VisualID visual B32; CARD32 mask B32; } xCreateWindowReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window window B32; CARD32 valueMask B32; } xChangeWindowAttributesReq; typedef struct { CARD8 reqType; BYTE mode; CARD16 length B16; Window window B32; } xChangeSaveSetReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window window B32, parent B32; INT16 x B16, y B16; } xReparentWindowReq; typedef struct { CARD8 reqType; CARD8 pad; CARD16 length B16; Window window B32; CARD16 mask B16; CARD16 pad2 B16; } xConfigureWindowReq; typedef struct { CARD8 reqType; CARD8 direction; CARD16 length B16; Window window B32; } xCirculateWindowReq; typedef struct { /* followed by padded string */ CARD8 reqType; BOOL onlyIfExists; CARD16 length B16; CARD16 nbytes B16; /* number of bytes in string */ CARD16 pad B16; } xInternAtomReq; typedef struct { CARD8 reqType; CARD8 mode; CARD16 length B16; Window window B32; Atom property B32, type B32; CARD8 format; BYTE pad[3]; CARD32 nUnits B32; /* length of stuff following, depends on format */ } xChangePropertyReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window window B32; Atom property B32; } xDeletePropertyReq; typedef struct { CARD8 reqType; #if defined(__cplusplus) || defined(c_plusplus) BOOL c_delete; #else BOOL delete; #endif CARD16 length B16; Window window B32; Atom property B32, type B32; CARD32 longOffset B32; CARD32 longLength B32; } xGetPropertyReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window window B32; Atom selection B32; Time time B32; } xSetSelectionOwnerReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window requestor B32; Atom selection B32, target B32, property B32; Time time B32; } xConvertSelectionReq; typedef struct { CARD8 reqType; BOOL propagate; CARD16 length B16; Window destination B32; CARD32 eventMask B32; #ifdef WORD64 /* the structure should have been quad-aligned */ BYTE eventdata[SIZEOF(xEvent)]; #else xEvent event; #endif /* WORD64 */ } xSendEventReq; typedef struct { CARD8 reqType; BOOL ownerEvents; CARD16 length B16; Window grabWindow B32; CARD16 eventMask B16; BYTE pointerMode, keyboardMode; Window confineTo B32; Cursor cursor B32; Time time B32; } xGrabPointerReq; typedef struct { CARD8 reqType; BOOL ownerEvents; CARD16 length B16; Window grabWindow B32; CARD16 eventMask B16; BYTE pointerMode, keyboardMode; Window confineTo B32; Cursor cursor B32; CARD8 button; BYTE pad; CARD16 modifiers B16; } xGrabButtonReq; typedef struct { CARD8 reqType; CARD8 button; CARD16 length B16; Window grabWindow B32; CARD16 modifiers B16; CARD16 pad B16; } xUngrabButtonReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Cursor cursor B32; Time time B32; CARD16 eventMask B16; CARD16 pad2 B16; } xChangeActivePointerGrabReq; typedef struct { CARD8 reqType; BOOL ownerEvents; CARD16 length B16; Window grabWindow B32; Time time B32; BYTE pointerMode, keyboardMode; CARD16 pad B16; } xGrabKeyboardReq; typedef struct { CARD8 reqType; BOOL ownerEvents; CARD16 length B16; Window grabWindow B32; CARD16 modifiers B16; CARD8 key; BYTE pointerMode, keyboardMode; BYTE pad1, pad2, pad3; } xGrabKeyReq; typedef struct { CARD8 reqType; CARD8 key; CARD16 length B16; Window grabWindow B32; CARD16 modifiers B16; CARD16 pad B16; } xUngrabKeyReq; typedef struct { CARD8 reqType; CARD8 mode; CARD16 length B16; Time time B32; } xAllowEventsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window window B32; Time start B32, stop B32; } xGetMotionEventsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window srcWid B32, dstWid B32; INT16 srcX B16, srcY B16; } xTranslateCoordsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window srcWid B32, dstWid B32; INT16 srcX B16, srcY B16; CARD16 srcWidth B16, srcHeight B16; INT16 dstX B16, dstY B16; } xWarpPointerReq; typedef struct { CARD8 reqType; CARD8 revertTo; CARD16 length B16; Window focus B32; Time time B32; } xSetInputFocusReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Font fid B32; CARD16 nbytes B16; BYTE pad1, pad2; /* string follows on word boundary */ } xOpenFontReq; typedef struct { CARD8 reqType; BOOL oddLength; CARD16 length B16; Font fid B32; } xQueryTextExtentsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; CARD16 maxNames B16; CARD16 nbytes B16; /* followed immediately by string bytes */ } xListFontsReq; typedef xListFontsReq xListFontsWithInfoReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; CARD16 nFonts B16; BYTE pad1, pad2; /* LISTofSTRING8 follows on word boundary */ } xSetFontPathReq; typedef struct { CARD8 reqType; CARD8 depth; CARD16 length B16; Pixmap pid B32; Drawable drawable B32; CARD16 width B16, height B16; } xCreatePixmapReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; GContext gc B32; Drawable drawable B32; CARD32 mask B32; } xCreateGCReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; GContext gc B32; CARD32 mask B32; } xChangeGCReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; GContext srcGC B32, dstGC B32; CARD32 mask B32; } xCopyGCReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; GContext gc B32; CARD16 dashOffset B16; CARD16 nDashes B16; /* length LISTofCARD8 of values following */ } xSetDashesReq; typedef struct { CARD8 reqType; BYTE ordering; CARD16 length B16; GContext gc B32; INT16 xOrigin B16, yOrigin B16; } xSetClipRectanglesReq; typedef struct { CARD8 reqType; BOOL exposures; CARD16 length B16; Window window B32; INT16 x B16, y B16; CARD16 width B16, height B16; } xClearAreaReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Drawable srcDrawable B32, dstDrawable B32; GContext gc B32; INT16 srcX B16, srcY B16, dstX B16, dstY B16; CARD16 width B16, height B16; } xCopyAreaReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Drawable srcDrawable B32, dstDrawable B32; GContext gc B32; INT16 srcX B16, srcY B16, dstX B16, dstY B16; CARD16 width B16, height B16; CARD32 bitPlane B32; } xCopyPlaneReq; typedef struct { CARD8 reqType; BYTE coordMode; CARD16 length B16; Drawable drawable B32; GContext gc B32; } xPolyPointReq; typedef xPolyPointReq xPolyLineReq; /* same request structure */ /* The following used for PolySegment, PolyRectangle, PolyArc, PolyFillRectangle, PolyFillArc */ typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Drawable drawable B32; GContext gc B32; } xPolySegmentReq; typedef xPolySegmentReq xPolyArcReq; typedef xPolySegmentReq xPolyRectangleReq; typedef xPolySegmentReq xPolyFillRectangleReq; typedef xPolySegmentReq xPolyFillArcReq; typedef struct _FillPolyReq { CARD8 reqType; BYTE pad; CARD16 length B16; Drawable drawable B32; GContext gc B32; BYTE shape; BYTE coordMode; CARD16 pad1 B16; } xFillPolyReq; typedef struct _PutImageReq { CARD8 reqType; CARD8 format; CARD16 length B16; Drawable drawable B32; GContext gc B32; CARD16 width B16, height B16; INT16 dstX B16, dstY B16; CARD8 leftPad; CARD8 depth; CARD16 pad B16; } xPutImageReq; typedef struct { CARD8 reqType; CARD8 format; CARD16 length B16; Drawable drawable B32; INT16 x B16, y B16; CARD16 width B16, height B16; CARD32 planeMask B32; } xGetImageReq; /* the folloiwng used by PolyText8 and PolyText16 */ typedef struct { CARD8 reqType; CARD8 pad; CARD16 length B16; Drawable drawable B32; GContext gc B32; INT16 x B16, y B16; /* items (xTextElt) start after struct */ } xPolyTextReq; typedef xPolyTextReq xPolyText8Req; typedef xPolyTextReq xPolyText16Req; typedef struct { CARD8 reqType; BYTE nChars; CARD16 length B16; Drawable drawable B32; GContext gc B32; INT16 x B16, y B16; } xImageTextReq; typedef xImageTextReq xImageText8Req; typedef xImageTextReq xImageText16Req; typedef struct { CARD8 reqType; BYTE alloc; CARD16 length B16; Colormap mid B32; Window window B32; VisualID visual B32; } xCreateColormapReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Colormap mid B32; Colormap srcCmap B32; } xCopyColormapAndFreeReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Colormap cmap B32; CARD16 red B16, green B16, blue B16; CARD16 pad2 B16; } xAllocColorReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Colormap cmap B32; CARD16 nbytes B16; /* followed by structure */ BYTE pad1, pad2; } xAllocNamedColorReq; typedef struct { CARD8 reqType; BOOL contiguous; CARD16 length B16; Colormap cmap B32; CARD16 colors B16, planes B16; } xAllocColorCellsReq; typedef struct { CARD8 reqType; BOOL contiguous; CARD16 length B16; Colormap cmap B32; CARD16 colors B16, red B16, green B16, blue B16; } xAllocColorPlanesReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Colormap cmap B32; CARD32 planeMask B32; } xFreeColorsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Colormap cmap B32; } xStoreColorsReq; typedef struct { CARD8 reqType; CARD8 flags; /* DoRed, DoGreen, DoBlue, as in xColorItem */ CARD16 length B16; Colormap cmap B32; CARD32 pixel B32; CARD16 nbytes B16; /* number of name string bytes following structure */ BYTE pad1, pad2; } xStoreNamedColorReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Colormap cmap B32; } xQueryColorsReq; typedef struct { /* followed by string of length len */ CARD8 reqType; BYTE pad; CARD16 length B16; Colormap cmap B32; CARD16 nbytes B16; /* number of string bytes following structure*/ BYTE pad1, pad2; } xLookupColorReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Cursor cid B32; Pixmap source B32, mask B32; CARD16 foreRed B16, foreGreen B16, foreBlue B16; CARD16 backRed B16, backGreen B16, backBlue B16; CARD16 x B16, y B16; } xCreateCursorReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Cursor cid B32; Font source B32, mask B32; CARD16 sourceChar B16, maskChar B16; CARD16 foreRed B16, foreGreen B16, foreBlue B16; CARD16 backRed B16, backGreen B16, backBlue B16; } xCreateGlyphCursorReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Cursor cursor B32; CARD16 foreRed B16, foreGreen B16, foreBlue B16; CARD16 backRed B16, backGreen B16, backBlue B16; } xRecolorCursorReq; typedef struct { CARD8 reqType; #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD16 length B16; Drawable drawable B32; CARD16 width B16, height B16; } xQueryBestSizeReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; CARD16 nbytes B16; /* number of string bytes following structure */ BYTE pad1, pad2; } xQueryExtensionReq; typedef struct { CARD8 reqType; CARD8 numKeyPerModifier; CARD16 length B16; } xSetModifierMappingReq; typedef struct { CARD8 reqType; CARD8 nElts; /* how many elements in the map */ CARD16 length B16; } xSetPointerMappingReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; KeyCode firstKeyCode; CARD8 count; CARD16 pad1 B16; } xGetKeyboardMappingReq; typedef struct { CARD8 reqType; CARD8 keyCodes; CARD16 length B16; KeyCode firstKeyCode; CARD8 keySymsPerKeyCode; CARD16 pad1 B16; } xChangeKeyboardMappingReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; CARD32 mask B32; } xChangeKeyboardControlReq; typedef struct { CARD8 reqType; INT8 percent; /* -100 to 100 */ CARD16 length B16; } xBellReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; INT16 accelNum B16, accelDenum B16; INT16 threshold B16; BOOL doAccel, doThresh; } xChangePointerControlReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; INT16 timeout B16, interval B16; BYTE preferBlank, allowExpose; CARD16 pad2 B16; } xSetScreenSaverReq; typedef struct { CARD8 reqType; BYTE mode; CARD16 length B16; CARD8 hostFamily; BYTE pad; CARD16 hostLength B16; } xChangeHostsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; } xListHostsReq; typedef struct { CARD8 reqType; BYTE mode; CARD16 length B16; } xChangeModeReq; typedef xChangeModeReq xSetAccessControlReq; typedef xChangeModeReq xSetCloseDownModeReq; typedef xChangeModeReq xForceScreenSaverReq; typedef struct { /* followed by LIST of ATOM */ CARD8 reqType; BYTE pad; CARD16 length B16; Window window B32; CARD16 nAtoms B16; INT16 nPositions B16; } xRotatePropertiesReq; /* Reply codes */ #define X_Reply 1 /* Normal reply */ #define X_Error 0 /* Error */ /* Request codes */ #define X_CreateWindow 1 #define X_ChangeWindowAttributes 2 #define X_GetWindowAttributes 3 #define X_DestroyWindow 4 #define X_DestroySubwindows 5 #define X_ChangeSaveSet 6 #define X_ReparentWindow 7 #define X_MapWindow 8 #define X_MapSubwindows 9 #define X_UnmapWindow 10 #define X_UnmapSubwindows 11 #define X_ConfigureWindow 12 #define X_CirculateWindow 13 #define X_GetGeometry 14 #define X_QueryTree 15 #define X_InternAtom 16 #define X_GetAtomName 17 #define X_ChangeProperty 18 #define X_DeleteProperty 19 #define X_GetProperty 20 #define X_ListProperties 21 #define X_SetSelectionOwner 22 #define X_GetSelectionOwner 23 #define X_ConvertSelection 24 #define X_SendEvent 25 #define X_GrabPointer 26 #define X_UngrabPointer 27 #define X_GrabButton 28 #define X_UngrabButton 29 #define X_ChangeActivePointerGrab 30 #define X_GrabKeyboard 31 #define X_UngrabKeyboard 32 #define X_GrabKey 33 #define X_UngrabKey 34 #define X_AllowEvents 35 #define X_GrabServer 36 #define X_UngrabServer 37 #define X_QueryPointer 38 #define X_GetMotionEvents 39 #define X_TranslateCoords 40 #define X_WarpPointer 41 #define X_SetInputFocus 42 #define X_GetInputFocus 43 #define X_QueryKeymap 44 #define X_OpenFont 45 #define X_CloseFont 46 #define X_QueryFont 47 #define X_QueryTextExtents 48 #define X_ListFonts 49 #define X_ListFontsWithInfo 50 #define X_SetFontPath 51 #define X_GetFontPath 52 #define X_CreatePixmap 53 #define X_FreePixmap 54 #define X_CreateGC 55 #define X_ChangeGC 56 #define X_CopyGC 57 #define X_SetDashes 58 #define X_SetClipRectangles 59 #define X_FreeGC 60 #define X_ClearArea 61 #define X_CopyArea 62 #define X_CopyPlane 63 #define X_PolyPoint 64 #define X_PolyLine 65 #define X_PolySegment 66 #define X_PolyRectangle 67 #define X_PolyArc 68 #define X_FillPoly 69 #define X_PolyFillRectangle 70 #define X_PolyFillArc 71 #define X_PutImage 72 #define X_GetImage 73 #define X_PolyText8 74 #define X_PolyText16 75 #define X_ImageText8 76 #define X_ImageText16 77 #define X_CreateColormap 78 #define X_FreeColormap 79 #define X_CopyColormapAndFree 80 #define X_InstallColormap 81 #define X_UninstallColormap 82 #define X_ListInstalledColormaps 83 #define X_AllocColor 84 #define X_AllocNamedColor 85 #define X_AllocColorCells 86 #define X_AllocColorPlanes 87 #define X_FreeColors 88 #define X_StoreColors 89 #define X_StoreNamedColor 90 #define X_QueryColors 91 #define X_LookupColor 92 #define X_CreateCursor 93 #define X_CreateGlyphCursor 94 #define X_FreeCursor 95 #define X_RecolorCursor 96 #define X_QueryBestSize 97 #define X_QueryExtension 98 #define X_ListExtensions 99 #define X_ChangeKeyboardMapping 100 #define X_GetKeyboardMapping 101 #define X_ChangeKeyboardControl 102 #define X_GetKeyboardControl 103 #define X_Bell 104 #define X_ChangePointerControl 105 #define X_GetPointerControl 106 #define X_SetScreenSaver 107 #define X_GetScreenSaver 108 #define X_ChangeHosts 109 #define X_ListHosts 110 #define X_SetAccessControl 111 #define X_SetCloseDownMode 112 #define X_KillClient 113 #define X_RotateProperties 114 #define X_ForceScreenSaver 115 #define X_SetPointerMapping 116 #define X_GetPointerMapping 117 #define X_SetModifierMapping 118 #define X_GetModifierMapping 119 #define X_NoOperation 127 /* restore these definitions back to the typedefs in X.h */ #undef Window #undef Drawable #undef Font #undef Pixmap #undef Cursor #undef Colormap #undef GContext #undef Atom #undef VisualID #undef Time #undef KeyCode #undef KeySym #endif /* XPROTO_H */ ================================================ FILE: OSXvnc-server/include/X11/Xprotostr.h ================================================ /* $XConsortium: Xprotostr.h,v 1.5 94/04/17 20:10:53 rws Exp $ */ #ifndef XPROTOSTRUCTS_H #define XPROTOSTRUCTS_H /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include /* Used by PolySegment */ typedef struct _xSegment { INT16 x1 B16, y1 B16, x2 B16, y2 B16; } xSegment; /* POINT */ typedef struct _xPoint { INT16 x B16, y B16; } xPoint; typedef struct _xRectangle { INT16 x B16, y B16; CARD16 width B16, height B16; } xRectangle; /* ARC */ typedef struct _xArc { INT16 x B16, y B16; CARD16 width B16, height B16; INT16 angle1 B16, angle2 B16; } xArc; #endif /* XPROTOSTRUCTS_H */ ================================================ FILE: OSXvnc-server/include/X11/keysym.h ================================================ /* $XConsortium: keysym.h,v 1.15 94/04/17 20:10:55 rws Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* default keysyms */ #define XK_MISCELLANY #define XK_XKB_KEYS #define XK_LATIN1 #define XK_LATIN2 #define XK_LATIN3 #define XK_LATIN4 #define XK_GREEK #include ================================================ FILE: OSXvnc-server/include/X11/keysymdef.h ================================================ /* $TOG: keysymdef.h /main/25 1997/06/21 10:54:51 kaleb $ */ /*********************************************************** Copyright (c) 1987, 1994 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS// // #ifdef ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #define XK_VoidSymbol 0xFFFFFF /* void symbol */ // #ifdef XK_MISCELLANY /* * TTY Functions, cleverly chosen to map to ascii, for convenience of * programming, but could have been arbitrary (at the cost of lookup * tables in client code. */ #define XK_BackSpace 0xFF08 /* back space, back char */ #define XK_Tab 0xFF09 #define XK_Linefeed 0xFF0A /* Linefeed, LF */ #define XK_Clear 0xFF0B #define XK_Return 0xFF0D /* Return, enter */ #define XK_Pause 0xFF13 /* Pause, hold */ #define XK_Scroll_Lock 0xFF14 #define XK_Sys_Req 0xFF15 #define XK_Escape 0xFF1B #define XK_Delete 0xFFFF /* Delete, rubout */ /* International & multi-key character composition */ #define XK_Multi_key 0xFF20 /* Multi-key character compose */ #define XK_SingleCandidate 0xFF3C #define XK_MultipleCandidate 0xFF3D #define XK_PreviousCandidate 0xFF3E /* Japanese keyboard support */ #define XK_Kanji 0xFF21 /* Kanji, Kanji convert */ #define XK_Muhenkan 0xFF22 /* Cancel Conversion */ #define XK_Henkan_Mode 0xFF23 /* Start/Stop Conversion */ #define XK_Henkan 0xFF23 /* Alias for Henkan_Mode */ #define XK_Romaji 0xFF24 /* to Romaji */ #define XK_Hiragana 0xFF25 /* to Hiragana */ #define XK_Katakana 0xFF26 /* to Katakana */ #define XK_Hiragana_Katakana 0xFF27 /* Hiragana/Katakana toggle */ #define XK_Zenkaku 0xFF28 /* to Zenkaku */ #define XK_Hankaku 0xFF29 /* to Hankaku */ #define XK_Zenkaku_Hankaku 0xFF2A /* Zenkaku/Hankaku toggle */ #define XK_Touroku 0xFF2B /* Add to Dictionary */ #define XK_Massyo 0xFF2C /* Delete from Dictionary */ #define XK_Kana_Lock 0xFF2D /* Kana Lock */ #define XK_Kana_Shift 0xFF2E /* Kana Shift */ #define XK_Eisu_Shift 0xFF2F /* Alphanumeric Shift */ #define XK_Eisu_toggle 0xFF30 /* Alphanumeric toggle */ #define XK_Zen_Koho 0xFF3D /* Multiple/All Candidate(s) */ #define XK_Mae_Koho 0xFF3E /* Previous Candidate */ /* 0xFF31 through 0xFF3F are under XK_KOREAN */ /* Cursor control & motion */ #define XK_Home 0xFF50 #define XK_Left 0xFF51 /* Move left, left arrow */ #define XK_Up 0xFF52 /* Move up, up arrow */ #define XK_Right 0xFF53 /* Move right, right arrow */ #define XK_Down 0xFF54 /* Move down, down arrow */ #define XK_Prior 0xFF55 /* Prior, previous */ #define XK_Page_Up 0xFF55 #define XK_Next 0xFF56 /* Next */ #define XK_Page_Down 0xFF56 #define XK_End 0xFF57 /* EOL */ #define XK_Begin 0xFF58 /* BOL */ /* Misc Functions */ #define XK_Select 0xFF60 /* Select, mark */ #define XK_Print 0xFF61 #define XK_Execute 0xFF62 /* Execute, run, do */ #define XK_Insert 0xFF63 /* Insert, insert here */ #define XK_Undo 0xFF65 /* Undo, oops */ #define XK_Redo 0xFF66 /* redo, again */ #define XK_Menu 0xFF67 #define XK_Find 0xFF68 /* Find, search */ #define XK_Cancel 0xFF69 /* Cancel, stop, abort, exit */ #define XK_Help 0xFF6A /* Help */ #define XK_Break 0xFF6B #define XK_Mode_switch 0xFF7E /* Character set switch */ #define XK_script_switch 0xFF7E /* Alias for mode_switch */ #define XK_Num_Lock 0xFF7F /* Keypad Functions, keypad numbers cleverly chosen to map to ascii */ #define XK_KP_Space 0xFF80 /* space */ #define XK_KP_Tab 0xFF89 #define XK_KP_Enter 0xFF8D /* enter */ #define XK_KP_F1 0xFF91 /* PF1, KP_A, ... */ #define XK_KP_F2 0xFF92 #define XK_KP_F3 0xFF93 #define XK_KP_F4 0xFF94 #define XK_KP_Home 0xFF95 #define XK_KP_Left 0xFF96 #define XK_KP_Up 0xFF97 #define XK_KP_Right 0xFF98 #define XK_KP_Down 0xFF99 #define XK_KP_Prior 0xFF9A #define XK_KP_Page_Up 0xFF9A #define XK_KP_Next 0xFF9B #define XK_KP_Page_Down 0xFF9B #define XK_KP_End 0xFF9C #define XK_KP_Begin 0xFF9D #define XK_KP_Insert 0xFF9E #define XK_KP_Delete 0xFF9F #define XK_KP_Equal 0xFFBD /* equals */ #define XK_KP_Multiply 0xFFAA #define XK_KP_Add 0xFFAB #define XK_KP_Separator 0xFFAC /* separator, often comma */ #define XK_KP_Subtract 0xFFAD #define XK_KP_Decimal 0xFFAE #define XK_KP_Divide 0xFFAF #define XK_KP_0 0xFFB0 #define XK_KP_1 0xFFB1 #define XK_KP_2 0xFFB2 #define XK_KP_3 0xFFB3 #define XK_KP_4 0xFFB4 #define XK_KP_5 0xFFB5 #define XK_KP_6 0xFFB6 #define XK_KP_7 0xFFB7 #define XK_KP_8 0xFFB8 #define XK_KP_9 0xFFB9 /* * Auxiliary Functions; note the duplicate definitions for left and right * function keys; Sun keyboards and a few other manufactures have such * function key groups on the left and/or right sides of the keyboard. * We've not found a keyboard with more than 35 function keys total. */ #define XK_F1 0xFFBE #define XK_F2 0xFFBF #define XK_F3 0xFFC0 #define XK_F4 0xFFC1 #define XK_F5 0xFFC2 #define XK_F6 0xFFC3 #define XK_F7 0xFFC4 #define XK_F8 0xFFC5 #define XK_F9 0xFFC6 #define XK_F10 0xFFC7 #define XK_F11 0xFFC8 #define XK_L1 0xFFC8 #define XK_F12 0xFFC9 #define XK_L2 0xFFC9 #define XK_F13 0xFFCA #define XK_L3 0xFFCA #define XK_F14 0xFFCB #define XK_L4 0xFFCB #define XK_F15 0xFFCC #define XK_L5 0xFFCC #define XK_F16 0xFFCD #define XK_L6 0xFFCD #define XK_F17 0xFFCE #define XK_L7 0xFFCE #define XK_F18 0xFFCF #define XK_L8 0xFFCF #define XK_F19 0xFFD0 #define XK_L9 0xFFD0 #define XK_F20 0xFFD1 #define XK_L10 0xFFD1 #define XK_F21 0xFFD2 #define XK_R1 0xFFD2 #define XK_F22 0xFFD3 #define XK_R2 0xFFD3 #define XK_F23 0xFFD4 #define XK_R3 0xFFD4 #define XK_F24 0xFFD5 #define XK_R4 0xFFD5 #define XK_F25 0xFFD6 #define XK_R5 0xFFD6 #define XK_F26 0xFFD7 #define XK_R6 0xFFD7 #define XK_F27 0xFFD8 #define XK_R7 0xFFD8 #define XK_F28 0xFFD9 #define XK_R8 0xFFD9 #define XK_F29 0xFFDA #define XK_R9 0xFFDA #define XK_F30 0xFFDB #define XK_R10 0xFFDB #define XK_F31 0xFFDC #define XK_R11 0xFFDC #define XK_F32 0xFFDD #define XK_R12 0xFFDD #define XK_F33 0xFFDE #define XK_R13 0xFFDE #define XK_F34 0xFFDF #define XK_R14 0xFFDF #define XK_F35 0xFFE0 #define XK_R15 0xFFE0 /* Modifiers */ #define XK_Shift_L 0xFFE1 /* Left shift */ #define XK_Shift_R 0xFFE2 /* Right shift */ #define XK_Control_L 0xFFE3 /* Left control */ #define XK_Control_R 0xFFE4 /* Right control */ #define XK_Caps_Lock 0xFFE5 /* Caps lock */ #define XK_Shift_Lock 0xFFE6 /* Shift lock */ #define XK_Meta_L 0xFFE7 /* Left meta */ #define XK_Meta_R 0xFFE8 /* Right meta */ #define XK_Alt_L 0xFFE9 /* Left alt */ #define XK_Alt_R 0xFFEA /* Right alt */ #define XK_Super_L 0xFFEB /* Left super */ #define XK_Super_R 0xFFEC /* Right super */ #define XK_Hyper_L 0xFFED /* Left hyper */ #define XK_Hyper_R 0xFFEE /* Right hyper */ // #endif /* XK_MISCELLANY */ /* * ISO 9995 Function and Modifier Keys * Byte 3 = 0xFE */ // #ifdef XK_XKB_KEYS #define XK_ISO_Lock 0xFE01 #define XK_ISO_Level2_Latch 0xFE02 #define XK_ISO_Level3_Shift 0xFE03 #define XK_ISO_Level3_Latch 0xFE04 #define XK_ISO_Level3_Lock 0xFE05 #define XK_ISO_Group_Shift 0xFF7E /* Alias for mode_switch */ #define XK_ISO_Group_Latch 0xFE06 #define XK_ISO_Group_Lock 0xFE07 #define XK_ISO_Next_Group 0xFE08 #define XK_ISO_Next_Group_Lock 0xFE09 #define XK_ISO_Prev_Group 0xFE0A #define XK_ISO_Prev_Group_Lock 0xFE0B #define XK_ISO_First_Group 0xFE0C #define XK_ISO_First_Group_Lock 0xFE0D #define XK_ISO_Last_Group 0xFE0E #define XK_ISO_Last_Group_Lock 0xFE0F #define XK_ISO_Left_Tab 0xFE20 #define XK_ISO_Move_Line_Up 0xFE21 #define XK_ISO_Move_Line_Down 0xFE22 #define XK_ISO_Partial_Line_Up 0xFE23 #define XK_ISO_Partial_Line_Down 0xFE24 #define XK_ISO_Partial_Space_Left 0xFE25 #define XK_ISO_Partial_Space_Right 0xFE26 #define XK_ISO_Set_Margin_Left 0xFE27 #define XK_ISO_Set_Margin_Right 0xFE28 #define XK_ISO_Release_Margin_Left 0xFE29 #define XK_ISO_Release_Margin_Right 0xFE2A #define XK_ISO_Release_Both_Margins 0xFE2B #define XK_ISO_Fast_Cursor_Left 0xFE2C #define XK_ISO_Fast_Cursor_Right 0xFE2D #define XK_ISO_Fast_Cursor_Up 0xFE2E #define XK_ISO_Fast_Cursor_Down 0xFE2F #define XK_ISO_Continuous_Underline 0xFE30 #define XK_ISO_Discontinuous_Underline 0xFE31 #define XK_ISO_Emphasize 0xFE32 #define XK_ISO_Center_Object 0xFE33 #define XK_ISO_Enter 0xFE34 #define XK_dead_grave 0xFE50 #define XK_dead_acute 0xFE51 #define XK_dead_circumflex 0xFE52 #define XK_dead_tilde 0xFE53 #define XK_dead_macron 0xFE54 #define XK_dead_breve 0xFE55 #define XK_dead_abovedot 0xFE56 #define XK_dead_diaeresis 0xFE57 #define XK_dead_abovering 0xFE58 #define XK_dead_doubleacute 0xFE59 #define XK_dead_caron 0xFE5A #define XK_dead_cedilla 0xFE5B #define XK_dead_ogonek 0xFE5C #define XK_dead_iota 0xFE5D #define XK_dead_voiced_sound 0xFE5E #define XK_dead_semivoiced_sound 0xFE5F #define XK_dead_belowdot 0xFE60 #define XK_First_Virtual_Screen 0xFED0 #define XK_Prev_Virtual_Screen 0xFED1 #define XK_Next_Virtual_Screen 0xFED2 #define XK_Last_Virtual_Screen 0xFED4 #define XK_Terminate_Server 0xFED5 #define XK_AccessX_Enable 0xFE70 #define XK_AccessX_Feedback_Enable 0xFE71 #define XK_RepeatKeys_Enable 0xFE72 #define XK_SlowKeys_Enable 0xFE73 #define XK_BounceKeys_Enable 0xFE74 #define XK_StickyKeys_Enable 0xFE75 #define XK_MouseKeys_Enable 0xFE76 #define XK_MouseKeys_Accel_Enable 0xFE77 #define XK_Overlay1_Enable 0xFE78 #define XK_Overlay2_Enable 0xFE79 #define XK_AudibleBell_Enable 0xFE7A #define XK_Pointer_Left 0xFEE0 #define XK_Pointer_Right 0xFEE1 #define XK_Pointer_Up 0xFEE2 #define XK_Pointer_Down 0xFEE3 #define XK_Pointer_UpLeft 0xFEE4 #define XK_Pointer_UpRight 0xFEE5 #define XK_Pointer_DownLeft 0xFEE6 #define XK_Pointer_DownRight 0xFEE7 #define XK_Pointer_Button_Dflt 0xFEE8 #define XK_Pointer_Button1 0xFEE9 #define XK_Pointer_Button2 0xFEEA #define XK_Pointer_Button3 0xFEEB #define XK_Pointer_Button4 0xFEEC #define XK_Pointer_Button5 0xFEED #define XK_Pointer_DblClick_Dflt 0xFEEE #define XK_Pointer_DblClick1 0xFEEF #define XK_Pointer_DblClick2 0xFEF0 #define XK_Pointer_DblClick3 0xFEF1 #define XK_Pointer_DblClick4 0xFEF2 #define XK_Pointer_DblClick5 0xFEF3 #define XK_Pointer_Drag_Dflt 0xFEF4 #define XK_Pointer_Drag1 0xFEF5 #define XK_Pointer_Drag2 0xFEF6 #define XK_Pointer_Drag3 0xFEF7 #define XK_Pointer_Drag4 0xFEF8 #define XK_Pointer_Drag5 0xFEFD #define XK_Pointer_EnableKeys 0xFEF9 #define XK_Pointer_Accelerate 0xFEFA #define XK_Pointer_DfltBtnNext 0xFEFB #define XK_Pointer_DfltBtnPrev 0xFEFC // #endif /* * 3270 Terminal Keys * Byte 3 = 0xFD */ // #ifdef XK_3270 #define XK_3270_Duplicate 0xFD01 #define XK_3270_FieldMark 0xFD02 #define XK_3270_Right2 0xFD03 #define XK_3270_Left2 0xFD04 #define XK_3270_BackTab 0xFD05 #define XK_3270_EraseEOF 0xFD06 #define XK_3270_EraseInput 0xFD07 #define XK_3270_Reset 0xFD08 #define XK_3270_Quit 0xFD09 #define XK_3270_PA1 0xFD0A #define XK_3270_PA2 0xFD0B #define XK_3270_PA3 0xFD0C #define XK_3270_Test 0xFD0D #define XK_3270_Attn 0xFD0E #define XK_3270_CursorBlink 0xFD0F #define XK_3270_AltCursor 0xFD10 #define XK_3270_KeyClick 0xFD11 #define XK_3270_Jump 0xFD12 #define XK_3270_Ident 0xFD13 #define XK_3270_Rule 0xFD14 #define XK_3270_Copy 0xFD15 #define XK_3270_Play 0xFD16 #define XK_3270_Setup 0xFD17 #define XK_3270_Record 0xFD18 #define XK_3270_ChangeScreen 0xFD19 #define XK_3270_DeleteWord 0xFD1A #define XK_3270_ExSelect 0xFD1B #define XK_3270_CursorSelect 0xFD1C #define XK_3270_PrintScreen 0xFD1D #define XK_3270_Enter 0xFD1E // #endif /* * Latin 1 * Byte 3 = 0 */ // #ifdef XK_LATIN1 #define XK_space 0x020 #define XK_exclam 0x021 #define XK_quotedbl 0x022 #define XK_numbersign 0x023 #define XK_dollar 0x024 #define XK_percent 0x025 #define XK_ampersand 0x026 #define XK_apostrophe 0x027 #define XK_quoteright 0x027 /* deprecated */ #define XK_parenleft 0x028 #define XK_parenright 0x029 #define XK_asterisk 0x02a #define XK_plus 0x02b #define XK_comma 0x02c #define XK_minus 0x02d #define XK_period 0x02e #define XK_slash 0x02f #define XK_0 0x030 #define XK_1 0x031 #define XK_2 0x032 #define XK_3 0x033 #define XK_4 0x034 #define XK_5 0x035 #define XK_6 0x036 #define XK_7 0x037 #define XK_8 0x038 #define XK_9 0x039 #define XK_colon 0x03a #define XK_semicolon 0x03b #define XK_less 0x03c #define XK_equal 0x03d #define XK_greater 0x03e #define XK_question 0x03f #define XK_at 0x040 #define XK_A 0x041 #define XK_B 0x042 #define XK_C 0x043 #define XK_D 0x044 #define XK_E 0x045 #define XK_F 0x046 #define XK_G 0x047 #define XK_H 0x048 #define XK_I 0x049 #define XK_J 0x04a #define XK_K 0x04b #define XK_L 0x04c #define XK_M 0x04d #define XK_N 0x04e #define XK_O 0x04f #define XK_P 0x050 #define XK_Q 0x051 #define XK_R 0x052 #define XK_S 0x053 #define XK_T 0x054 #define XK_U 0x055 #define XK_V 0x056 #define XK_W 0x057 #define XK_X 0x058 #define XK_Y 0x059 #define XK_Z 0x05a #define XK_bracketleft 0x05b #define XK_backslash 0x05c #define XK_bracketright 0x05d #define XK_asciicircum 0x05e #define XK_underscore 0x05f #define XK_grave 0x060 #define XK_quoteleft 0x060 /* deprecated */ #define XK_a 0x061 #define XK_b 0x062 #define XK_c 0x063 #define XK_d 0x064 #define XK_e 0x065 #define XK_f 0x066 #define XK_g 0x067 #define XK_h 0x068 #define XK_i 0x069 #define XK_j 0x06a #define XK_k 0x06b #define XK_l 0x06c #define XK_m 0x06d #define XK_n 0x06e #define XK_o 0x06f #define XK_p 0x070 #define XK_q 0x071 #define XK_r 0x072 #define XK_s 0x073 #define XK_t 0x074 #define XK_u 0x075 #define XK_v 0x076 #define XK_w 0x077 #define XK_x 0x078 #define XK_y 0x079 #define XK_z 0x07a #define XK_braceleft 0x07b #define XK_bar 0x07c #define XK_braceright 0x07d #define XK_asciitilde 0x07e #define XK_nobreakspace 0x0a0 #define XK_exclamdown 0x0a1 #define XK_cent 0x0a2 #define XK_sterling 0x0a3 #define XK_currency 0x0a4 #define XK_yen 0x0a5 #define XK_brokenbar 0x0a6 #define XK_section 0x0a7 #define XK_diaeresis 0x0a8 #define XK_copyright 0x0a9 #define XK_ordfeminine 0x0aa #define XK_guillemotleft 0x0ab /* left angle quotation mark */ #define XK_notsign 0x0ac #define XK_hyphen 0x0ad #define XK_registered 0x0ae #define XK_macron 0x0af #define XK_degree 0x0b0 #define XK_plusminus 0x0b1 #define XK_twosuperior 0x0b2 #define XK_threesuperior 0x0b3 #define XK_acute 0x0b4 #define XK_mu 0x0b5 #define XK_paragraph 0x0b6 #define XK_periodcentered 0x0b7 #define XK_cedilla 0x0b8 #define XK_onesuperior 0x0b9 #define XK_masculine 0x0ba #define XK_guillemotright 0x0bb /* right angle quotation mark */ #define XK_onequarter 0x0bc #define XK_onehalf 0x0bd #define XK_threequarters 0x0be #define XK_questiondown 0x0bf #define XK_Agrave 0x0c0 #define XK_Aacute 0x0c1 #define XK_Acircumflex 0x0c2 #define XK_Atilde 0x0c3 #define XK_Adiaeresis 0x0c4 #define XK_Aring 0x0c5 #define XK_AE 0x0c6 #define XK_Ccedilla 0x0c7 #define XK_Egrave 0x0c8 #define XK_Eacute 0x0c9 #define XK_Ecircumflex 0x0ca #define XK_Ediaeresis 0x0cb #define XK_Igrave 0x0cc #define XK_Iacute 0x0cd #define XK_Icircumflex 0x0ce #define XK_Idiaeresis 0x0cf #define XK_ETH 0x0d0 #define XK_Eth 0x0d0 /* deprecated */ #define XK_Ntilde 0x0d1 #define XK_Ograve 0x0d2 #define XK_Oacute 0x0d3 #define XK_Ocircumflex 0x0d4 #define XK_Otilde 0x0d5 #define XK_Odiaeresis 0x0d6 #define XK_multiply 0x0d7 #define XK_Ooblique 0x0d8 #define XK_Ugrave 0x0d9 #define XK_Uacute 0x0da #define XK_Ucircumflex 0x0db #define XK_Udiaeresis 0x0dc #define XK_Yacute 0x0dd #define XK_THORN 0x0de #define XK_Thorn 0x0de /* deprecated */ #define XK_ssharp 0x0df #define XK_agrave 0x0e0 #define XK_aacute 0x0e1 #define XK_acircumflex 0x0e2 #define XK_atilde 0x0e3 #define XK_adiaeresis 0x0e4 #define XK_aring 0x0e5 #define XK_ae 0x0e6 #define XK_ccedilla 0x0e7 #define XK_egrave 0x0e8 #define XK_eacute 0x0e9 #define XK_ecircumflex 0x0ea #define XK_ediaeresis 0x0eb #define XK_igrave 0x0ec #define XK_iacute 0x0ed #define XK_icircumflex 0x0ee #define XK_idiaeresis 0x0ef #define XK_eth 0x0f0 #define XK_ntilde 0x0f1 #define XK_ograve 0x0f2 #define XK_oacute 0x0f3 #define XK_ocircumflex 0x0f4 #define XK_otilde 0x0f5 #define XK_odiaeresis 0x0f6 #define XK_division 0x0f7 #define XK_oslash 0x0f8 #define XK_ugrave 0x0f9 #define XK_uacute 0x0fa #define XK_ucircumflex 0x0fb #define XK_udiaeresis 0x0fc #define XK_yacute 0x0fd #define XK_thorn 0x0fe #define XK_ydiaeresis 0x0ff // #endif /* XK_LATIN1 */ /* * Latin 2 * Byte 3 = 1 */ // #ifdef XK_LATIN2 #define XK_Aogonek 0x1a1 #define XK_breve 0x1a2 #define XK_Lstroke 0x1a3 #define XK_Lcaron 0x1a5 #define XK_Sacute 0x1a6 #define XK_Scaron 0x1a9 #define XK_Scedilla 0x1aa #define XK_Tcaron 0x1ab #define XK_Zacute 0x1ac #define XK_Zcaron 0x1ae #define XK_Zabovedot 0x1af #define XK_aogonek 0x1b1 #define XK_ogonek 0x1b2 #define XK_lstroke 0x1b3 #define XK_lcaron 0x1b5 #define XK_sacute 0x1b6 #define XK_caron 0x1b7 #define XK_scaron 0x1b9 #define XK_scedilla 0x1ba #define XK_tcaron 0x1bb #define XK_zacute 0x1bc #define XK_doubleacute 0x1bd #define XK_zcaron 0x1be #define XK_zabovedot 0x1bf #define XK_Racute 0x1c0 #define XK_Abreve 0x1c3 #define XK_Lacute 0x1c5 #define XK_Cacute 0x1c6 #define XK_Ccaron 0x1c8 #define XK_Eogonek 0x1ca #define XK_Ecaron 0x1cc #define XK_Dcaron 0x1cf #define XK_Dstroke 0x1d0 #define XK_Nacute 0x1d1 #define XK_Ncaron 0x1d2 #define XK_Odoubleacute 0x1d5 #define XK_Rcaron 0x1d8 #define XK_Uring 0x1d9 #define XK_Udoubleacute 0x1db #define XK_Tcedilla 0x1de #define XK_racute 0x1e0 #define XK_abreve 0x1e3 #define XK_lacute 0x1e5 #define XK_cacute 0x1e6 #define XK_ccaron 0x1e8 #define XK_eogonek 0x1ea #define XK_ecaron 0x1ec #define XK_dcaron 0x1ef #define XK_dstroke 0x1f0 #define XK_nacute 0x1f1 #define XK_ncaron 0x1f2 #define XK_odoubleacute 0x1f5 #define XK_udoubleacute 0x1fb #define XK_rcaron 0x1f8 #define XK_uring 0x1f9 #define XK_tcedilla 0x1fe #define XK_abovedot 0x1ff // #endif /* XK_LATIN2 */ /* * Latin 3 * Byte 3 = 2 */ // #ifdef XK_LATIN3 #define XK_Hstroke 0x2a1 #define XK_Hcircumflex 0x2a6 #define XK_Iabovedot 0x2a9 #define XK_Gbreve 0x2ab #define XK_Jcircumflex 0x2ac #define XK_hstroke 0x2b1 #define XK_hcircumflex 0x2b6 #define XK_idotless 0x2b9 #define XK_gbreve 0x2bb #define XK_jcircumflex 0x2bc #define XK_Cabovedot 0x2c5 #define XK_Ccircumflex 0x2c6 #define XK_Gabovedot 0x2d5 #define XK_Gcircumflex 0x2d8 #define XK_Ubreve 0x2dd #define XK_Scircumflex 0x2de #define XK_cabovedot 0x2e5 #define XK_ccircumflex 0x2e6 #define XK_gabovedot 0x2f5 #define XK_gcircumflex 0x2f8 #define XK_ubreve 0x2fd #define XK_scircumflex 0x2fe // #endif /* XK_LATIN3 */ /* * Latin 4 * Byte 3 = 3 */ // #ifdef XK_LATIN4 #define XK_kra 0x3a2 #define XK_kappa 0x3a2 /* deprecated */ #define XK_Rcedilla 0x3a3 #define XK_Itilde 0x3a5 #define XK_Lcedilla 0x3a6 #define XK_Emacron 0x3aa #define XK_Gcedilla 0x3ab #define XK_Tslash 0x3ac #define XK_rcedilla 0x3b3 #define XK_itilde 0x3b5 #define XK_lcedilla 0x3b6 #define XK_emacron 0x3ba #define XK_gcedilla 0x3bb #define XK_tslash 0x3bc #define XK_ENG 0x3bd #define XK_eng 0x3bf #define XK_Amacron 0x3c0 #define XK_Iogonek 0x3c7 #define XK_Eabovedot 0x3cc #define XK_Imacron 0x3cf #define XK_Ncedilla 0x3d1 #define XK_Omacron 0x3d2 #define XK_Kcedilla 0x3d3 #define XK_Uogonek 0x3d9 #define XK_Utilde 0x3dd #define XK_Umacron 0x3de #define XK_amacron 0x3e0 #define XK_iogonek 0x3e7 #define XK_eabovedot 0x3ec #define XK_imacron 0x3ef #define XK_ncedilla 0x3f1 #define XK_omacron 0x3f2 #define XK_kcedilla 0x3f3 #define XK_uogonek 0x3f9 #define XK_utilde 0x3fd #define XK_umacron 0x3fe // #endif /* XK_LATIN4 */ /* * Katakana * Byte 3 = 4 */ // #ifdef XK_KATAKANA #define XK_overline 0x47e #define XK_kana_fullstop 0x4a1 #define XK_kana_openingbracket 0x4a2 #define XK_kana_closingbracket 0x4a3 #define XK_kana_comma 0x4a4 #define XK_kana_conjunctive 0x4a5 #define XK_kana_middledot 0x4a5 /* deprecated */ #define XK_kana_WO 0x4a6 #define XK_kana_a 0x4a7 #define XK_kana_i 0x4a8 #define XK_kana_u 0x4a9 #define XK_kana_e 0x4aa #define XK_kana_o 0x4ab #define XK_kana_ya 0x4ac #define XK_kana_yu 0x4ad #define XK_kana_yo 0x4ae #define XK_kana_tsu 0x4af #define XK_kana_tu 0x4af /* deprecated */ #define XK_prolongedsound 0x4b0 #define XK_kana_A 0x4b1 #define XK_kana_I 0x4b2 #define XK_kana_U 0x4b3 #define XK_kana_E 0x4b4 #define XK_kana_O 0x4b5 #define XK_kana_KA 0x4b6 #define XK_kana_KI 0x4b7 #define XK_kana_KU 0x4b8 #define XK_kana_KE 0x4b9 #define XK_kana_KO 0x4ba #define XK_kana_SA 0x4bb #define XK_kana_SHI 0x4bc #define XK_kana_SU 0x4bd #define XK_kana_SE 0x4be #define XK_kana_SO 0x4bf #define XK_kana_TA 0x4c0 #define XK_kana_CHI 0x4c1 #define XK_kana_TI 0x4c1 /* deprecated */ #define XK_kana_TSU 0x4c2 #define XK_kana_TU 0x4c2 /* deprecated */ #define XK_kana_TE 0x4c3 #define XK_kana_TO 0x4c4 #define XK_kana_NA 0x4c5 #define XK_kana_NI 0x4c6 #define XK_kana_NU 0x4c7 #define XK_kana_NE 0x4c8 #define XK_kana_NO 0x4c9 #define XK_kana_HA 0x4ca #define XK_kana_HI 0x4cb #define XK_kana_FU 0x4cc #define XK_kana_HU 0x4cc /* deprecated */ #define XK_kana_HE 0x4cd #define XK_kana_HO 0x4ce #define XK_kana_MA 0x4cf #define XK_kana_MI 0x4d0 #define XK_kana_MU 0x4d1 #define XK_kana_ME 0x4d2 #define XK_kana_MO 0x4d3 #define XK_kana_YA 0x4d4 #define XK_kana_YU 0x4d5 #define XK_kana_YO 0x4d6 #define XK_kana_RA 0x4d7 #define XK_kana_RI 0x4d8 #define XK_kana_RU 0x4d9 #define XK_kana_RE 0x4da #define XK_kana_RO 0x4db #define XK_kana_WA 0x4dc #define XK_kana_N 0x4dd #define XK_voicedsound 0x4de #define XK_semivoicedsound 0x4df #define XK_kana_switch 0xFF7E /* Alias for mode_switch */ // #endif /* XK_KATAKANA */ /* * Arabic * Byte 3 = 5 */ // #ifdef XK_ARABIC #define XK_Arabic_comma 0x5ac #define XK_Arabic_semicolon 0x5bb #define XK_Arabic_question_mark 0x5bf #define XK_Arabic_hamza 0x5c1 #define XK_Arabic_maddaonalef 0x5c2 #define XK_Arabic_hamzaonalef 0x5c3 #define XK_Arabic_hamzaonwaw 0x5c4 #define XK_Arabic_hamzaunderalef 0x5c5 #define XK_Arabic_hamzaonyeh 0x5c6 #define XK_Arabic_alef 0x5c7 #define XK_Arabic_beh 0x5c8 #define XK_Arabic_tehmarbuta 0x5c9 #define XK_Arabic_teh 0x5ca #define XK_Arabic_theh 0x5cb #define XK_Arabic_jeem 0x5cc #define XK_Arabic_hah 0x5cd #define XK_Arabic_khah 0x5ce #define XK_Arabic_dal 0x5cf #define XK_Arabic_thal 0x5d0 #define XK_Arabic_ra 0x5d1 #define XK_Arabic_zain 0x5d2 #define XK_Arabic_seen 0x5d3 #define XK_Arabic_sheen 0x5d4 #define XK_Arabic_sad 0x5d5 #define XK_Arabic_dad 0x5d6 #define XK_Arabic_tah 0x5d7 #define XK_Arabic_zah 0x5d8 #define XK_Arabic_ain 0x5d9 #define XK_Arabic_ghain 0x5da #define XK_Arabic_tatweel 0x5e0 #define XK_Arabic_feh 0x5e1 #define XK_Arabic_qaf 0x5e2 #define XK_Arabic_kaf 0x5e3 #define XK_Arabic_lam 0x5e4 #define XK_Arabic_meem 0x5e5 #define XK_Arabic_noon 0x5e6 #define XK_Arabic_ha 0x5e7 #define XK_Arabic_heh 0x5e7 /* deprecated */ #define XK_Arabic_waw 0x5e8 #define XK_Arabic_alefmaksura 0x5e9 #define XK_Arabic_yeh 0x5ea #define XK_Arabic_fathatan 0x5eb #define XK_Arabic_dammatan 0x5ec #define XK_Arabic_kasratan 0x5ed #define XK_Arabic_fatha 0x5ee #define XK_Arabic_damma 0x5ef #define XK_Arabic_kasra 0x5f0 #define XK_Arabic_shadda 0x5f1 #define XK_Arabic_sukun 0x5f2 #define XK_Arabic_switch 0xFF7E /* Alias for mode_switch */ // #endif /* XK_ARABIC */ /* * Cyrillic * Byte 3 = 6 */ // #ifdef XK_CYRILLIC #define XK_Serbian_dje 0x6a1 #define XK_Macedonia_gje 0x6a2 #define XK_Cyrillic_io 0x6a3 #define XK_Ukrainian_ie 0x6a4 #define XK_Ukranian_je 0x6a4 /* deprecated */ #define XK_Macedonia_dse 0x6a5 #define XK_Ukrainian_i 0x6a6 #define XK_Ukranian_i 0x6a6 /* deprecated */ #define XK_Ukrainian_yi 0x6a7 #define XK_Ukranian_yi 0x6a7 /* deprecated */ #define XK_Cyrillic_je 0x6a8 #define XK_Serbian_je 0x6a8 /* deprecated */ #define XK_Cyrillic_lje 0x6a9 #define XK_Serbian_lje 0x6a9 /* deprecated */ #define XK_Cyrillic_nje 0x6aa #define XK_Serbian_nje 0x6aa /* deprecated */ #define XK_Serbian_tshe 0x6ab #define XK_Macedonia_kje 0x6ac #define XK_Byelorussian_shortu 0x6ae #define XK_Cyrillic_dzhe 0x6af #define XK_Serbian_dze 0x6af /* deprecated */ #define XK_numerosign 0x6b0 #define XK_Serbian_DJE 0x6b1 #define XK_Macedonia_GJE 0x6b2 #define XK_Cyrillic_IO 0x6b3 #define XK_Ukrainian_IE 0x6b4 #define XK_Ukranian_JE 0x6b4 /* deprecated */ #define XK_Macedonia_DSE 0x6b5 #define XK_Ukrainian_I 0x6b6 #define XK_Ukranian_I 0x6b6 /* deprecated */ #define XK_Ukrainian_YI 0x6b7 #define XK_Ukranian_YI 0x6b7 /* deprecated */ #define XK_Cyrillic_JE 0x6b8 #define XK_Serbian_JE 0x6b8 /* deprecated */ #define XK_Cyrillic_LJE 0x6b9 #define XK_Serbian_LJE 0x6b9 /* deprecated */ #define XK_Cyrillic_NJE 0x6ba #define XK_Serbian_NJE 0x6ba /* deprecated */ #define XK_Serbian_TSHE 0x6bb #define XK_Macedonia_KJE 0x6bc #define XK_Byelorussian_SHORTU 0x6be #define XK_Cyrillic_DZHE 0x6bf #define XK_Serbian_DZE 0x6bf /* deprecated */ #define XK_Cyrillic_yu 0x6c0 #define XK_Cyrillic_a 0x6c1 #define XK_Cyrillic_be 0x6c2 #define XK_Cyrillic_tse 0x6c3 #define XK_Cyrillic_de 0x6c4 #define XK_Cyrillic_ie 0x6c5 #define XK_Cyrillic_ef 0x6c6 #define XK_Cyrillic_ghe 0x6c7 #define XK_Cyrillic_ha 0x6c8 #define XK_Cyrillic_i 0x6c9 #define XK_Cyrillic_shorti 0x6ca #define XK_Cyrillic_ka 0x6cb #define XK_Cyrillic_el 0x6cc #define XK_Cyrillic_em 0x6cd #define XK_Cyrillic_en 0x6ce #define XK_Cyrillic_o 0x6cf #define XK_Cyrillic_pe 0x6d0 #define XK_Cyrillic_ya 0x6d1 #define XK_Cyrillic_er 0x6d2 #define XK_Cyrillic_es 0x6d3 #define XK_Cyrillic_te 0x6d4 #define XK_Cyrillic_u 0x6d5 #define XK_Cyrillic_zhe 0x6d6 #define XK_Cyrillic_ve 0x6d7 #define XK_Cyrillic_softsign 0x6d8 #define XK_Cyrillic_yeru 0x6d9 #define XK_Cyrillic_ze 0x6da #define XK_Cyrillic_sha 0x6db #define XK_Cyrillic_e 0x6dc #define XK_Cyrillic_shcha 0x6dd #define XK_Cyrillic_che 0x6de #define XK_Cyrillic_hardsign 0x6df #define XK_Cyrillic_YU 0x6e0 #define XK_Cyrillic_A 0x6e1 #define XK_Cyrillic_BE 0x6e2 #define XK_Cyrillic_TSE 0x6e3 #define XK_Cyrillic_DE 0x6e4 #define XK_Cyrillic_IE 0x6e5 #define XK_Cyrillic_EF 0x6e6 #define XK_Cyrillic_GHE 0x6e7 #define XK_Cyrillic_HA 0x6e8 #define XK_Cyrillic_I 0x6e9 #define XK_Cyrillic_SHORTI 0x6ea #define XK_Cyrillic_KA 0x6eb #define XK_Cyrillic_EL 0x6ec #define XK_Cyrillic_EM 0x6ed #define XK_Cyrillic_EN 0x6ee #define XK_Cyrillic_O 0x6ef #define XK_Cyrillic_PE 0x6f0 #define XK_Cyrillic_YA 0x6f1 #define XK_Cyrillic_ER 0x6f2 #define XK_Cyrillic_ES 0x6f3 #define XK_Cyrillic_TE 0x6f4 #define XK_Cyrillic_U 0x6f5 #define XK_Cyrillic_ZHE 0x6f6 #define XK_Cyrillic_VE 0x6f7 #define XK_Cyrillic_SOFTSIGN 0x6f8 #define XK_Cyrillic_YERU 0x6f9 #define XK_Cyrillic_ZE 0x6fa #define XK_Cyrillic_SHA 0x6fb #define XK_Cyrillic_E 0x6fc #define XK_Cyrillic_SHCHA 0x6fd #define XK_Cyrillic_CHE 0x6fe #define XK_Cyrillic_HARDSIGN 0x6ff // #endif /* XK_CYRILLIC */ /* * Greek * Byte 3 = 7 */ // #ifdef XK_GREEK #define XK_Greek_ALPHAaccent 0x7a1 #define XK_Greek_EPSILONaccent 0x7a2 #define XK_Greek_ETAaccent 0x7a3 #define XK_Greek_IOTAaccent 0x7a4 #define XK_Greek_IOTAdiaeresis 0x7a5 #define XK_Greek_OMICRONaccent 0x7a7 #define XK_Greek_UPSILONaccent 0x7a8 #define XK_Greek_UPSILONdieresis 0x7a9 #define XK_Greek_OMEGAaccent 0x7ab #define XK_Greek_accentdieresis 0x7ae #define XK_Greek_horizbar 0x7af #define XK_Greek_alphaaccent 0x7b1 #define XK_Greek_epsilonaccent 0x7b2 #define XK_Greek_etaaccent 0x7b3 #define XK_Greek_iotaaccent 0x7b4 #define XK_Greek_iotadieresis 0x7b5 #define XK_Greek_iotaaccentdieresis 0x7b6 #define XK_Greek_omicronaccent 0x7b7 #define XK_Greek_upsilonaccent 0x7b8 #define XK_Greek_upsilondieresis 0x7b9 #define XK_Greek_upsilonaccentdieresis 0x7ba #define XK_Greek_omegaaccent 0x7bb #define XK_Greek_ALPHA 0x7c1 #define XK_Greek_BETA 0x7c2 #define XK_Greek_GAMMA 0x7c3 #define XK_Greek_DELTA 0x7c4 #define XK_Greek_EPSILON 0x7c5 #define XK_Greek_ZETA 0x7c6 #define XK_Greek_ETA 0x7c7 #define XK_Greek_THETA 0x7c8 #define XK_Greek_IOTA 0x7c9 #define XK_Greek_KAPPA 0x7ca #define XK_Greek_LAMDA 0x7cb #define XK_Greek_LAMBDA 0x7cb #define XK_Greek_MU 0x7cc #define XK_Greek_NU 0x7cd #define XK_Greek_XI 0x7ce #define XK_Greek_OMICRON 0x7cf #define XK_Greek_PI 0x7d0 #define XK_Greek_RHO 0x7d1 #define XK_Greek_SIGMA 0x7d2 #define XK_Greek_TAU 0x7d4 #define XK_Greek_UPSILON 0x7d5 #define XK_Greek_PHI 0x7d6 #define XK_Greek_CHI 0x7d7 #define XK_Greek_PSI 0x7d8 #define XK_Greek_OMEGA 0x7d9 #define XK_Greek_alpha 0x7e1 #define XK_Greek_beta 0x7e2 #define XK_Greek_gamma 0x7e3 #define XK_Greek_delta 0x7e4 #define XK_Greek_epsilon 0x7e5 #define XK_Greek_zeta 0x7e6 #define XK_Greek_eta 0x7e7 #define XK_Greek_theta 0x7e8 #define XK_Greek_iota 0x7e9 #define XK_Greek_kappa 0x7ea #define XK_Greek_lamda 0x7eb #define XK_Greek_lambda 0x7eb #define XK_Greek_mu 0x7ec #define XK_Greek_nu 0x7ed #define XK_Greek_xi 0x7ee #define XK_Greek_omicron 0x7ef #define XK_Greek_pi 0x7f0 #define XK_Greek_rho 0x7f1 #define XK_Greek_sigma 0x7f2 #define XK_Greek_finalsmallsigma 0x7f3 #define XK_Greek_tau 0x7f4 #define XK_Greek_upsilon 0x7f5 #define XK_Greek_phi 0x7f6 #define XK_Greek_chi 0x7f7 #define XK_Greek_psi 0x7f8 #define XK_Greek_omega 0x7f9 #define XK_Greek_switch 0xFF7E /* Alias for mode_switch */ // #endif /* XK_GREEK */ /* * Technical * Byte 3 = 8 */ // #ifdef XK_TECHNICAL #define XK_leftradical 0x8a1 #define XK_topleftradical 0x8a2 #define XK_horizconnector 0x8a3 #define XK_topintegral 0x8a4 #define XK_botintegral 0x8a5 #define XK_vertconnector 0x8a6 #define XK_topleftsqbracket 0x8a7 #define XK_botleftsqbracket 0x8a8 #define XK_toprightsqbracket 0x8a9 #define XK_botrightsqbracket 0x8aa #define XK_topleftparens 0x8ab #define XK_botleftparens 0x8ac #define XK_toprightparens 0x8ad #define XK_botrightparens 0x8ae #define XK_leftmiddlecurlybrace 0x8af #define XK_rightmiddlecurlybrace 0x8b0 #define XK_topleftsummation 0x8b1 #define XK_botleftsummation 0x8b2 #define XK_topvertsummationconnector 0x8b3 #define XK_botvertsummationconnector 0x8b4 #define XK_toprightsummation 0x8b5 #define XK_botrightsummation 0x8b6 #define XK_rightmiddlesummation 0x8b7 #define XK_lessthanequal 0x8bc #define XK_notequal 0x8bd #define XK_greaterthanequal 0x8be #define XK_integral 0x8bf #define XK_therefore 0x8c0 #define XK_variation 0x8c1 #define XK_infinity 0x8c2 #define XK_nabla 0x8c5 #define XK_approximate 0x8c8 #define XK_similarequal 0x8c9 #define XK_ifonlyif 0x8cd #define XK_implies 0x8ce #define XK_identical 0x8cf #define XK_radical 0x8d6 #define XK_includedin 0x8da #define XK_includes 0x8db #define XK_intersection 0x8dc #define XK_union 0x8dd #define XK_logicaland 0x8de #define XK_logicalor 0x8df #define XK_partialderivative 0x8ef #define XK_function 0x8f6 #define XK_leftarrow 0x8fb #define XK_uparrow 0x8fc #define XK_rightarrow 0x8fd #define XK_downarrow 0x8fe // #endif /* XK_TECHNICAL */ /* * Special * Byte 3 = 9 */ // #ifdef XK_SPECIAL #define XK_blank 0x9df #define XK_soliddiamond 0x9e0 #define XK_checkerboard 0x9e1 #define XK_ht 0x9e2 #define XK_ff 0x9e3 #define XK_cr 0x9e4 #define XK_lf 0x9e5 #define XK_nl 0x9e8 #define XK_vt 0x9e9 #define XK_lowrightcorner 0x9ea #define XK_uprightcorner 0x9eb #define XK_upleftcorner 0x9ec #define XK_lowleftcorner 0x9ed #define XK_crossinglines 0x9ee #define XK_horizlinescan1 0x9ef #define XK_horizlinescan3 0x9f0 #define XK_horizlinescan5 0x9f1 #define XK_horizlinescan7 0x9f2 #define XK_horizlinescan9 0x9f3 #define XK_leftt 0x9f4 #define XK_rightt 0x9f5 #define XK_bott 0x9f6 #define XK_topt 0x9f7 #define XK_vertbar 0x9f8 // #endif /* XK_SPECIAL */ /* * Publishing * Byte 3 = a */ // #ifdef XK_PUBLISHING #define XK_emspace 0xaa1 #define XK_enspace 0xaa2 #define XK_em3space 0xaa3 #define XK_em4space 0xaa4 #define XK_digitspace 0xaa5 #define XK_punctspace 0xaa6 #define XK_thinspace 0xaa7 #define XK_hairspace 0xaa8 #define XK_emdash 0xaa9 #define XK_endash 0xaaa #define XK_signifblank 0xaac #define XK_ellipsis 0xaae #define XK_doubbaselinedot 0xaaf #define XK_onethird 0xab0 #define XK_twothirds 0xab1 #define XK_onefifth 0xab2 #define XK_twofifths 0xab3 #define XK_threefifths 0xab4 #define XK_fourfifths 0xab5 #define XK_onesixth 0xab6 #define XK_fivesixths 0xab7 #define XK_careof 0xab8 #define XK_figdash 0xabb #define XK_leftanglebracket 0xabc #define XK_decimalpoint 0xabd #define XK_rightanglebracket 0xabe #define XK_marker 0xabf #define XK_oneeighth 0xac3 #define XK_threeeighths 0xac4 #define XK_fiveeighths 0xac5 #define XK_seveneighths 0xac6 #define XK_trademark 0xac9 #define XK_signaturemark 0xaca #define XK_trademarkincircle 0xacb #define XK_leftopentriangle 0xacc #define XK_rightopentriangle 0xacd #define XK_emopencircle 0xace #define XK_emopenrectangle 0xacf #define XK_leftsinglequotemark 0xad0 #define XK_rightsinglequotemark 0xad1 #define XK_leftdoublequotemark 0xad2 #define XK_rightdoublequotemark 0xad3 #define XK_prescription 0xad4 #define XK_minutes 0xad6 #define XK_seconds 0xad7 #define XK_latincross 0xad9 #define XK_hexagram 0xada #define XK_filledrectbullet 0xadb #define XK_filledlefttribullet 0xadc #define XK_filledrighttribullet 0xadd #define XK_emfilledcircle 0xade #define XK_emfilledrect 0xadf #define XK_enopencircbullet 0xae0 #define XK_enopensquarebullet 0xae1 #define XK_openrectbullet 0xae2 #define XK_opentribulletup 0xae3 #define XK_opentribulletdown 0xae4 #define XK_openstar 0xae5 #define XK_enfilledcircbullet 0xae6 #define XK_enfilledsqbullet 0xae7 #define XK_filledtribulletup 0xae8 #define XK_filledtribulletdown 0xae9 #define XK_leftpointer 0xaea #define XK_rightpointer 0xaeb #define XK_club 0xaec #define XK_diamond 0xaed #define XK_heart 0xaee #define XK_maltesecross 0xaf0 #define XK_dagger 0xaf1 #define XK_doubledagger 0xaf2 #define XK_checkmark 0xaf3 #define XK_ballotcross 0xaf4 #define XK_musicalsharp 0xaf5 #define XK_musicalflat 0xaf6 #define XK_malesymbol 0xaf7 #define XK_femalesymbol 0xaf8 #define XK_telephone 0xaf9 #define XK_telephonerecorder 0xafa #define XK_phonographcopyright 0xafb #define XK_caret 0xafc #define XK_singlelowquotemark 0xafd #define XK_doublelowquotemark 0xafe #define XK_cursor 0xaff // #endif /* XK_PUBLISHING */ /* * APL * Byte 3 = b */ // #ifdef XK_APL #define XK_leftcaret 0xba3 #define XK_rightcaret 0xba6 #define XK_downcaret 0xba8 #define XK_upcaret 0xba9 #define XK_overbar 0xbc0 #define XK_downtack 0xbc2 #define XK_upshoe 0xbc3 #define XK_downstile 0xbc4 #define XK_underbar 0xbc6 #define XK_jot 0xbca #define XK_quad 0xbcc #define XK_uptack 0xbce #define XK_circle 0xbcf #define XK_upstile 0xbd3 #define XK_downshoe 0xbd6 #define XK_rightshoe 0xbd8 #define XK_leftshoe 0xbda #define XK_lefttack 0xbdc #define XK_righttack 0xbfc // #endif /* XK_APL */ /* * Hebrew * Byte 3 = c */ // #ifdef XK_HEBREW #define XK_hebrew_doublelowline 0xcdf #define XK_hebrew_aleph 0xce0 #define XK_hebrew_bet 0xce1 #define XK_hebrew_beth 0xce1 /* deprecated */ #define XK_hebrew_gimel 0xce2 #define XK_hebrew_gimmel 0xce2 /* deprecated */ #define XK_hebrew_dalet 0xce3 #define XK_hebrew_daleth 0xce3 /* deprecated */ #define XK_hebrew_he 0xce4 #define XK_hebrew_waw 0xce5 #define XK_hebrew_zain 0xce6 #define XK_hebrew_zayin 0xce6 /* deprecated */ #define XK_hebrew_chet 0xce7 #define XK_hebrew_het 0xce7 /* deprecated */ #define XK_hebrew_tet 0xce8 #define XK_hebrew_teth 0xce8 /* deprecated */ #define XK_hebrew_yod 0xce9 #define XK_hebrew_finalkaph 0xcea #define XK_hebrew_kaph 0xceb #define XK_hebrew_lamed 0xcec #define XK_hebrew_finalmem 0xced #define XK_hebrew_mem 0xcee #define XK_hebrew_finalnun 0xcef #define XK_hebrew_nun 0xcf0 #define XK_hebrew_samech 0xcf1 #define XK_hebrew_samekh 0xcf1 /* deprecated */ #define XK_hebrew_ayin 0xcf2 #define XK_hebrew_finalpe 0xcf3 #define XK_hebrew_pe 0xcf4 #define XK_hebrew_finalzade 0xcf5 #define XK_hebrew_finalzadi 0xcf5 /* deprecated */ #define XK_hebrew_zade 0xcf6 #define XK_hebrew_zadi 0xcf6 /* deprecated */ #define XK_hebrew_qoph 0xcf7 #define XK_hebrew_kuf 0xcf7 /* deprecated */ #define XK_hebrew_resh 0xcf8 #define XK_hebrew_shin 0xcf9 #define XK_hebrew_taw 0xcfa #define XK_hebrew_taf 0xcfa /* deprecated */ #define XK_Hebrew_switch 0xFF7E /* Alias for mode_switch */ // #endif /* XK_HEBREW */ /* * Thai * Byte 3 = d */ // #ifdef XK_THAI #define XK_Thai_kokai 0xda1 #define XK_Thai_khokhai 0xda2 #define XK_Thai_khokhuat 0xda3 #define XK_Thai_khokhwai 0xda4 #define XK_Thai_khokhon 0xda5 #define XK_Thai_khorakhang 0xda6 #define XK_Thai_ngongu 0xda7 #define XK_Thai_chochan 0xda8 #define XK_Thai_choching 0xda9 #define XK_Thai_chochang 0xdaa #define XK_Thai_soso 0xdab #define XK_Thai_chochoe 0xdac #define XK_Thai_yoying 0xdad #define XK_Thai_dochada 0xdae #define XK_Thai_topatak 0xdaf #define XK_Thai_thothan 0xdb0 #define XK_Thai_thonangmontho 0xdb1 #define XK_Thai_thophuthao 0xdb2 #define XK_Thai_nonen 0xdb3 #define XK_Thai_dodek 0xdb4 #define XK_Thai_totao 0xdb5 #define XK_Thai_thothung 0xdb6 #define XK_Thai_thothahan 0xdb7 #define XK_Thai_thothong 0xdb8 #define XK_Thai_nonu 0xdb9 #define XK_Thai_bobaimai 0xdba #define XK_Thai_popla 0xdbb #define XK_Thai_phophung 0xdbc #define XK_Thai_fofa 0xdbd #define XK_Thai_phophan 0xdbe #define XK_Thai_fofan 0xdbf #define XK_Thai_phosamphao 0xdc0 #define XK_Thai_moma 0xdc1 #define XK_Thai_yoyak 0xdc2 #define XK_Thai_rorua 0xdc3 #define XK_Thai_ru 0xdc4 #define XK_Thai_loling 0xdc5 #define XK_Thai_lu 0xdc6 #define XK_Thai_wowaen 0xdc7 #define XK_Thai_sosala 0xdc8 #define XK_Thai_sorusi 0xdc9 #define XK_Thai_sosua 0xdca #define XK_Thai_hohip 0xdcb #define XK_Thai_lochula 0xdcc #define XK_Thai_oang 0xdcd #define XK_Thai_honokhuk 0xdce #define XK_Thai_paiyannoi 0xdcf #define XK_Thai_saraa 0xdd0 #define XK_Thai_maihanakat 0xdd1 #define XK_Thai_saraaa 0xdd2 #define XK_Thai_saraam 0xdd3 #define XK_Thai_sarai 0xdd4 #define XK_Thai_saraii 0xdd5 #define XK_Thai_saraue 0xdd6 #define XK_Thai_sarauee 0xdd7 #define XK_Thai_sarau 0xdd8 #define XK_Thai_sarauu 0xdd9 #define XK_Thai_phinthu 0xdda #define XK_Thai_maihanakat_maitho 0xdde #define XK_Thai_baht 0xddf #define XK_Thai_sarae 0xde0 #define XK_Thai_saraae 0xde1 #define XK_Thai_sarao 0xde2 #define XK_Thai_saraaimaimuan 0xde3 #define XK_Thai_saraaimaimalai 0xde4 #define XK_Thai_lakkhangyao 0xde5 #define XK_Thai_maiyamok 0xde6 #define XK_Thai_maitaikhu 0xde7 #define XK_Thai_maiek 0xde8 #define XK_Thai_maitho 0xde9 #define XK_Thai_maitri 0xdea #define XK_Thai_maichattawa 0xdeb #define XK_Thai_thanthakhat 0xdec #define XK_Thai_nikhahit 0xded #define XK_Thai_leksun 0xdf0 #define XK_Thai_leknung 0xdf1 #define XK_Thai_leksong 0xdf2 #define XK_Thai_leksam 0xdf3 #define XK_Thai_leksi 0xdf4 #define XK_Thai_lekha 0xdf5 #define XK_Thai_lekhok 0xdf6 #define XK_Thai_lekchet 0xdf7 #define XK_Thai_lekpaet 0xdf8 #define XK_Thai_lekkao 0xdf9 // #endif /* XK_THAI */ /* * Korean * Byte 3 = e */ // #ifdef XK_KOREAN #define XK_Hangul 0xff31 /* Hangul start/stop(toggle) */ #define XK_Hangul_Start 0xff32 /* Hangul start */ #define XK_Hangul_End 0xff33 /* Hangul end, English start */ #define XK_Hangul_Hanja 0xff34 /* Start Hangul->Hanja Conversion */ #define XK_Hangul_Jamo 0xff35 /* Hangul Jamo mode */ #define XK_Hangul_Romaja 0xff36 /* Hangul Romaja mode */ #define XK_Hangul_Codeinput 0xff37 /* Hangul code input mode */ #define XK_Hangul_Jeonja 0xff38 /* Jeonja mode */ #define XK_Hangul_Banja 0xff39 /* Banja mode */ #define XK_Hangul_PreHanja 0xff3a /* Pre Hanja conversion */ #define XK_Hangul_PostHanja 0xff3b /* Post Hanja conversion */ #define XK_Hangul_SingleCandidate 0xff3c /* Single candidate */ #define XK_Hangul_MultipleCandidate 0xff3d /* Multiple candidate */ #define XK_Hangul_PreviousCandidate 0xff3e /* Previous candidate */ #define XK_Hangul_Special 0xff3f /* Special symbols */ #define XK_Hangul_switch 0xFF7E /* Alias for mode_switch */ /* Hangul Consonant Characters */ #define XK_Hangul_Kiyeog 0xea1 #define XK_Hangul_SsangKiyeog 0xea2 #define XK_Hangul_KiyeogSios 0xea3 #define XK_Hangul_Nieun 0xea4 #define XK_Hangul_NieunJieuj 0xea5 #define XK_Hangul_NieunHieuh 0xea6 #define XK_Hangul_Dikeud 0xea7 #define XK_Hangul_SsangDikeud 0xea8 #define XK_Hangul_Rieul 0xea9 #define XK_Hangul_RieulKiyeog 0xeaa #define XK_Hangul_RieulMieum 0xeab #define XK_Hangul_RieulPieub 0xeac #define XK_Hangul_RieulSios 0xead #define XK_Hangul_RieulTieut 0xeae #define XK_Hangul_RieulPhieuf 0xeaf #define XK_Hangul_RieulHieuh 0xeb0 #define XK_Hangul_Mieum 0xeb1 #define XK_Hangul_Pieub 0xeb2 #define XK_Hangul_SsangPieub 0xeb3 #define XK_Hangul_PieubSios 0xeb4 #define XK_Hangul_Sios 0xeb5 #define XK_Hangul_SsangSios 0xeb6 #define XK_Hangul_Ieung 0xeb7 #define XK_Hangul_Jieuj 0xeb8 #define XK_Hangul_SsangJieuj 0xeb9 #define XK_Hangul_Cieuc 0xeba #define XK_Hangul_Khieuq 0xebb #define XK_Hangul_Tieut 0xebc #define XK_Hangul_Phieuf 0xebd #define XK_Hangul_Hieuh 0xebe /* Hangul Vowel Characters */ #define XK_Hangul_A 0xebf #define XK_Hangul_AE 0xec0 #define XK_Hangul_YA 0xec1 #define XK_Hangul_YAE 0xec2 #define XK_Hangul_EO 0xec3 #define XK_Hangul_E 0xec4 #define XK_Hangul_YEO 0xec5 #define XK_Hangul_YE 0xec6 #define XK_Hangul_O 0xec7 #define XK_Hangul_WA 0xec8 #define XK_Hangul_WAE 0xec9 #define XK_Hangul_OE 0xeca #define XK_Hangul_YO 0xecb #define XK_Hangul_U 0xecc #define XK_Hangul_WEO 0xecd #define XK_Hangul_WE 0xece #define XK_Hangul_WI 0xecf #define XK_Hangul_YU 0xed0 #define XK_Hangul_EU 0xed1 #define XK_Hangul_YI 0xed2 #define XK_Hangul_I 0xed3 /* Hangul syllable-final (JongSeong) Characters */ #define XK_Hangul_J_Kiyeog 0xed4 #define XK_Hangul_J_SsangKiyeog 0xed5 #define XK_Hangul_J_KiyeogSios 0xed6 #define XK_Hangul_J_Nieun 0xed7 #define XK_Hangul_J_NieunJieuj 0xed8 #define XK_Hangul_J_NieunHieuh 0xed9 #define XK_Hangul_J_Dikeud 0xeda #define XK_Hangul_J_Rieul 0xedb #define XK_Hangul_J_RieulKiyeog 0xedc #define XK_Hangul_J_RieulMieum 0xedd #define XK_Hangul_J_RieulPieub 0xede #define XK_Hangul_J_RieulSios 0xedf #define XK_Hangul_J_RieulTieut 0xee0 #define XK_Hangul_J_RieulPhieuf 0xee1 #define XK_Hangul_J_RieulHieuh 0xee2 #define XK_Hangul_J_Mieum 0xee3 #define XK_Hangul_J_Pieub 0xee4 #define XK_Hangul_J_PieubSios 0xee5 #define XK_Hangul_J_Sios 0xee6 #define XK_Hangul_J_SsangSios 0xee7 #define XK_Hangul_J_Ieung 0xee8 #define XK_Hangul_J_Jieuj 0xee9 #define XK_Hangul_J_Cieuc 0xeea #define XK_Hangul_J_Khieuq 0xeeb #define XK_Hangul_J_Tieut 0xeec #define XK_Hangul_J_Phieuf 0xeed #define XK_Hangul_J_Hieuh 0xeee /* Ancient Hangul Consonant Characters */ #define XK_Hangul_RieulYeorinHieuh 0xeef #define XK_Hangul_SunkyeongeumMieum 0xef0 #define XK_Hangul_SunkyeongeumPieub 0xef1 #define XK_Hangul_PanSios 0xef2 #define XK_Hangul_KkogjiDalrinIeung 0xef3 #define XK_Hangul_SunkyeongeumPhieuf 0xef4 #define XK_Hangul_YeorinHieuh 0xef5 /* Ancient Hangul Vowel Characters */ #define XK_Hangul_AraeA 0xef6 #define XK_Hangul_AraeAE 0xef7 /* Ancient Hangul syllable-final (JongSeong) Characters */ #define XK_Hangul_J_PanSios 0xef8 #define XK_Hangul_J_KkogjiDalrinIeung 0xef9 #define XK_Hangul_J_YeorinHieuh 0xefa /* Korean currency symbol */ #define XK_Korean_Won 0xeff // #endif /* XK_KOREAN */ ================================================ FILE: OSXvnc-server/include/Xserver/colormap.h ================================================ /* Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* $XConsortium: colormap.h,v 1.28 94/04/17 20:25:32 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/include/colormap.h,v 1.2 1997/01/14 22:22:38 dawes Exp $ */ #ifndef CMAP_H #define CMAP_H 1 #include "X11/Xproto.h" #include "screenint.h" #include "window.h" /* these follow X.h's AllocNone and AllocAll */ #define CM_PSCREEN 2 #define CM_PWIN 3 /* Passed internally in colormap.c */ #define REDMAP 0 #define GREENMAP 1 #define BLUEMAP 2 #define PSEUDOMAP 3 #define AllocPrivate (-1) #define AllocTemporary (-2) #define DynamicClass 1 /* Values for the flags field of a colormap. These should have 1 bit set * and not overlap */ #define IsDefault 1 #define AllAllocated 2 #define BeingCreated 4 typedef CARD32 Pixel; typedef struct _CMEntry *EntryPtr; /* moved to screenint.h: typedef struct _ColormapRec *ColormapPtr */ typedef struct _colorResource *colorResourcePtr; extern int CreateColormap( Colormap /*mid*/, ScreenPtr /*pScreen*/, VisualPtr /*pVisual*/, ColormapPtr* /*ppcmap*/, int /*alloc*/, int /*client*/ ); extern int FreeColormap( pointer /*pmap*/, XID /*mid*/ ); extern int TellLostMap( X11WindowPtr /*pwin*/, pointer /* Colormap *pmid */ ); extern int TellGainedMap( X11WindowPtr /*pwin*/, pointer /* Colormap *pmid */ ); extern int CopyColormapAndFree( Colormap /*mid*/, ColormapPtr /*pSrc*/, int /*client*/ ); extern int AllocColor( ColormapPtr /*pmap*/, unsigned short* /*pred*/, unsigned short* /*pgreen*/, unsigned short* /*pblue*/, Pixel* /*pPix*/, int /*client*/ ); extern void FakeAllocColor( ColormapPtr /*pmap*/, xColorItem * /*item*/ ); extern void FakeFreeColor( ColormapPtr /*pmap*/, Pixel /*pixel*/ ); typedef int (*ColorCompareProcPtr)( EntryPtr /*pent*/, xrgb * /*prgb*/ ); extern int FindColor( ColormapPtr /*pmap*/, EntryPtr /*pentFirst*/, int /*size*/, xrgb* /*prgb*/, Pixel* /*pPixel*/, int /*channel*/, int /*client*/, ColorCompareProcPtr /*comp*/ ); extern int QueryColors( ColormapPtr /*pmap*/, int /*count*/, Pixel* /*ppixIn*/, xrgb* /*prgbList*/ ); extern int FreeClientPixels( pointer /*pcr*/, XID /*fakeid*/ ); extern int AllocColorCells( int /*client*/, ColormapPtr /*pmap*/, int /*colors*/, int /*planes*/, Bool /*contig*/, Pixel* /*ppix*/, Pixel* /*masks*/ ); extern int AllocColorPlanes( int /*client*/, ColormapPtr /*pmap*/, int /*colors*/, int /*r*/, int /*g*/, int /*b*/, Bool /*contig*/, Pixel* /*pixels*/, Pixel* /*prmask*/, Pixel* /*pgmask*/, Pixel* /*pbmask*/ ); extern int FreeColors( ColormapPtr /*pmap*/, int /*client*/, int /*count*/, Pixel* /*pixels*/, Pixel /*mask*/ ); extern int StoreColors( ColormapPtr /*pmap*/, int /*count*/, xColorItem* /*defs*/ ); extern int IsMapInstalled( Colormap /*map*/, X11WindowPtr /*pWin*/ ); #endif /* CMAP_H */ ================================================ FILE: OSXvnc-server/include/Xserver/cursor.h ================================================ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: cursor.h,v 1.22 94/04/17 20:25:34 dpw Exp $ */ #ifndef CURSOR_H #define CURSOR_H #include "misc.h" #include "screenint.h" #include "window.h" #define NullCursor ((CursorPtr)NULL) typedef struct _Cursor *CursorPtr; typedef struct _CursorMetric *CursorMetricPtr; extern CursorPtr rootCursor; extern int FreeCursor( pointer /*pCurs*/, XID /*cid*/ ); extern CursorPtr X11AllocCursor( unsigned char* /*psrcbits*/, unsigned char* /*pmaskbits*/, CursorMetricPtr /*cm*/, unsigned /*foreRed*/, unsigned /*foreGreen*/, unsigned /*foreBlue*/, unsigned /*backRed*/, unsigned /*backGreen*/, unsigned /*backBlue*/ ); extern int AllocGlyphCursor( Font /*source*/, unsigned int /*sourceChar*/, Font /*mask*/, unsigned int /*maskChar*/, unsigned /*foreRed*/, unsigned /*foreGreen*/, unsigned /*foreBlue*/, unsigned /*backRed*/, unsigned /*backGreen*/, unsigned /*backBlue*/, CursorPtr* /*ppCurs*/, ClientPtr /*client*/ ); extern CursorPtr CreateRootCursor( char* /*pfilename*/, unsigned int /*glyph*/ ); extern int ServerBitsFromGlyph( FontPtr /*pfont*/, unsigned int /*ch*/, register CursorMetricPtr /*cm*/, unsigned char ** /*ppbits*/ ); extern Bool CursorMetricsFromGlyph( FontPtr /*pfont*/, unsigned /*ch*/, CursorMetricPtr /*cm*/ ); extern void CheckCursorConfinement( X11WindowPtr /*pWin*/ ); extern void NewCurrentScreen( ScreenPtr /*newScreen*/, int /*x*/, int /*y*/ ); extern Bool PointerConfinedToScreen( void ); extern void GetSpritePosition( int * /*px*/, int * /*py*/ ); #endif /* CURSOR_H */ ================================================ FILE: OSXvnc-server/include/Xserver/dix.h ================================================ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: dix.h /main/44 1996/12/15 21:24:57 rws $ */ /* $XFree86: xc/programs/Xserver/include/dix.h,v 3.7 1996/12/31 04:17:46 dawes Exp $ */ #ifndef DIX_H #define DIX_H #include "gc.h" #include "window.h" #include "input.h" #define EARLIER -1 #define SAMETIME 0 #define LATER 1 #define NullClient ((ClientPtr) 0) #define REQUEST(type) \ register type *stuff = (type *)client->requestBuffer #define REQUEST_SIZE_MATCH(req)\ if ((sizeof(req) >> 2) != client->req_len)\ return(BadLength) #define REQUEST_AT_LEAST_SIZE(req) \ if ((sizeof(req) >> 2) > client->req_len )\ return(BadLength) #define REQUEST_FIXED_SIZE(req, n)\ if (((sizeof(req) >> 2) > client->req_len) || \ (((sizeof(req) + (n) + 3) >> 2) != client->req_len)) \ return(BadLength) #define LEGAL_NEW_RESOURCE(id,client)\ if (!LegalNewID(id,client)) \ {\ client->errorValue = id;\ return(BadIDChoice);\ } /* XXX if you are using this macro, you are probably not generating Match * errors where appropriate */ #define LOOKUP_DRAWABLE(did, client)\ ((client->lastDrawableID == did) ? \ client->lastDrawable : (DrawablePtr)LookupDrawable(did, client)) #ifdef XCSECURITY #define SECURITY_VERIFY_DRAWABLE(pDraw, did, client, mode)\ if (client->lastDrawableID == did && !client->trustLevel)\ pDraw = client->lastDrawable;\ else \ {\ pDraw = (DrawablePtr) SecurityLookupIDByClass(client, did, \ RC_DRAWABLE, mode);\ if (!pDraw) \ {\ client->errorValue = did; \ return BadDrawable;\ }\ if (pDraw->type == UNDRAWABLE_WINDOW)\ return BadMatch;\ } #define SECURITY_VERIFY_GEOMETRABLE(pDraw, did, client, mode)\ if (client->lastDrawableID == did && !client->trustLevel)\ pDraw = client->lastDrawable;\ else \ {\ pDraw = (DrawablePtr) SecurityLookupIDByClass(client, did, \ RC_DRAWABLE, mode);\ if (!pDraw) \ {\ client->errorValue = did; \ return BadDrawable;\ }\ } #define SECURITY_VERIFY_GC(pGC, rid, client, mode)\ if (client->lastGCID == rid && !client->trustLevel)\ pGC = client->lastGC;\ else\ pGC = (GC *) SecurityLookupIDByType(client, rid, RT_GC, mode);\ if (!pGC)\ {\ client->errorValue = rid;\ return (BadGC);\ } #define VERIFY_DRAWABLE(pDraw, did, client)\ SECURITY_VERIFY_DRAWABLE(pDraw, did, client, SecurityUnknownAccess) #define VERIFY_GEOMETRABLE(pDraw, did, client)\ SECURITY_VERIFY_GEOMETRABLE(pDraw, did, client, SecurityUnknownAccess) #define VERIFY_GC(pGC, rid, client)\ SECURITY_VERIFY_GC(pGC, rid, client, SecurityUnknownAccess) #else /* not XCSECURITY */ #define VERIFY_DRAWABLE(pDraw, did, client)\ if (client->lastDrawableID == did)\ pDraw = client->lastDrawable;\ else \ {\ pDraw = (DrawablePtr) LookupIDByClass(did, RC_DRAWABLE);\ if (!pDraw) \ {\ client->errorValue = did; \ return BadDrawable;\ }\ if (pDraw->type == UNDRAWABLE_WINDOW)\ return BadMatch;\ } #define VERIFY_GEOMETRABLE(pDraw, did, client)\ if (client->lastDrawableID == did)\ pDraw = client->lastDrawable;\ else \ {\ pDraw = (DrawablePtr) LookupIDByClass(did, RC_DRAWABLE);\ if (!pDraw) \ {\ client->errorValue = did; \ return BadDrawable;\ }\ } #define VERIFY_GC(pGC, rid, client)\ if (client->lastGCID == rid)\ pGC = client->lastGC;\ else\ pGC = (GC *)LookupIDByType(rid, RT_GC);\ if (!pGC)\ {\ client->errorValue = rid;\ return (BadGC);\ } #define SECURITY_VERIFY_DRAWABLE(pDraw, did, client, mode)\ VERIFY_DRAWABLE(pDraw, did, client) #define SECURITY_VERIFY_GEOMETRABLE(pDraw, did, client, mode)\ VERIFY_GEOMETRABLE(pDraw, did, client) #define SECURITY_VERIFY_GC(pGC, rid, client, mode)\ VERIFY_GC(pGC, rid, client) #endif /* XCSECURITY */ /* * We think that most hardware implementations of DBE will want * LookupID*(dbe_back_buffer_id) to return the window structure that the * id is a back buffer for. Since both front and back buffers will * return the same structure, you need to be able to distinguish * somewhere what kind of buffer (front/back) was being asked for, so * that ddx can render to the right place. That's the problem that the * following code solves. Note: we couldn't embed this in the LookupID* * functions because the VALIDATE_DRAWABLE_AND_GC macro often circumvents * those functions by checking a one-element cache. That's why we're * mucking with VALIDATE_DRAWABLE_AND_GC. * * If you put -DNEED_DBE_BUF_BITS into PervasiveDBEDefines, the window * structure will have two additional bits defined, srcBuffer and * dstBuffer, and their values will be maintained via the macros * SET_DBE_DSTBUF and SET_DBE_SRCBUF (below). If you also * put -DNEED_DBE_BUF_VALIDATE into PervasiveDBEDefines, the function * DbeValidateBuffer will be called any time the bits change to give you * a chance to do some setup. See the DBE code for more details on this * function. We put in these levels of conditionality so that you can do * just what you need to do, and no more. If neither of these defines * are used, the bits won't be there, and VALIDATE_DRAWABLE_AND_GC will * be unchanged. dpw */ #if defined(NEED_DBE_BUF_BITS) #define SET_DBE_DSTBUF(_pDraw, _drawID) \ SET_DBE_BUF(_pDraw, _drawID, dstBuffer, TRUE) #define SET_DBE_SRCBUF(_pDraw, _drawID) \ SET_DBE_BUF(_pDraw, _drawID, srcBuffer, FALSE) #if defined (NEED_DBE_BUF_VALIDATE) #define SET_DBE_BUF(_pDraw, _drawID, _whichBuffer, _dstbuf) \ if (_pDraw->type == DRAWABLE_WINDOW)\ {\ int thisbuf = (_pDraw->id == _drawID);\ if (thisbuf != ((X11WindowPtr)_pDraw)->_whichBuffer)\ {\ ((X11WindowPtr)_pDraw)->_whichBuffer = thisbuf;\ DbeValidateBuffer((X11WindowPtr)_pDraw, _drawID, _dstbuf);\ }\ } #else /* want buffer bits, but don't need to call DbeValidateBuffer */ #define SET_DBE_BUF(_pDraw, _drawID, _whichBuffer, _dstbuf) \ if (_pDraw->type == DRAWABLE_WINDOW)\ {\ ((X11WindowPtr)_pDraw)->_whichBuffer = (_pDraw->id == _drawID);\ } #endif /* NEED_DBE_BUF_VALIDATE */ #else /* don't want buffer bits in window */ #define SET_DBE_DSTBUF(_pDraw, _drawID) /**/ #define SET_DBE_SRCBUF(_pDraw, _drawID) /**/ #endif /* NEED_DBE_BUF_BITS */ #define VALIDATE_DRAWABLE_AND_GC(drawID, pDraw, pGC, client)\ if ((stuff->gc == INVALID) || (client->lastGCID != stuff->gc) ||\ (client->lastDrawableID != drawID))\ {\ SECURITY_VERIFY_GEOMETRABLE(pDraw, drawID, client, SecurityWriteAccess);\ SECURITY_VERIFY_GC(pGC, stuff->gc, client, SecurityReadAccess);\ if ((pGC->depth != pDraw->depth) ||\ (pGC->pScreen != pDraw->pScreen))\ return (BadMatch);\ client->lastDrawable = pDraw;\ client->lastDrawableID = drawID;\ client->lastGC = pGC;\ client->lastGCID = stuff->gc;\ }\ else\ {\ pGC = client->lastGC;\ pDraw = client->lastDrawable;\ }\ SET_DBE_DSTBUF(pDraw, drawID);\ if (pGC->serialNumber != pDraw->serialNumber)\ ValidateGC(pDraw, pGC); #define WriteReplyToClient(pClient, size, pReply) \ if ((pClient)->swapped) \ (*ReplySwapVector[((xReq *)(pClient)->requestBuffer)->reqType]) \ (pClient, (int)(size), pReply); \ else (void) WriteToClient(pClient, (int)(size), (char *)(pReply)); #define WriteSwappedDataToClient(pClient, size, pbuf) \ if ((pClient)->swapped) \ (*(pClient)->pSwapReplyFunc)(pClient, (int)(size), pbuf); \ else (void) WriteToClient (pClient, (int)(size), (char *)(pbuf)); typedef struct _TimeStamp *TimeStampPtr; #ifndef _XTYPEDEF_CLIENTPTR typedef struct _Client *ClientPtr; /* also in misc.h */ #define _XTYPEDEF_CLIENTPTR #endif typedef struct _WorkQueue *WorkQueuePtr; extern ClientPtr requestingClient; extern ClientPtr *clients; extern ClientPtr serverClient; extern int currentMaxClients; #if !(defined(__alpha) || defined(__alpha__)) typedef long HWEventQueueType; #else typedef int HWEventQueueType; #endif typedef HWEventQueueType* HWEventQueuePtr; extern HWEventQueuePtr checkForInput[2]; typedef struct _TimeStamp { CARD32 months; /* really ~49.7 days */ CARD32 milliseconds; } TimeStamp; /* dispatch.c */ extern void SetInputCheck( #if NeedFunctionPrototypes HWEventQueuePtr /*c0*/, HWEventQueuePtr /*c1*/ #endif ); extern void CloseDownClient( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); extern void UpdateCurrentTime( #if NeedFunctionPrototypes void #endif ); extern void UpdateCurrentTimeIf( #if NeedFunctionPrototypes void #endif ); extern void InitSelections( #if NeedFunctionPrototypes void #endif ); extern void FlushClientCaches( #if NeedFunctionPrototypes XID /*id*/ #endif ); extern int dixDestroyPixmap( #if NeedFunctionPrototypes pointer /*value*/, XID /*pid*/ #endif ); extern void CloseDownRetainedResources( #if NeedFunctionPrototypes void #endif ); extern void InitClient( #if NeedFunctionPrototypes ClientPtr /*client*/, int /*i*/, pointer /*ospriv*/ #endif ); extern ClientPtr NextAvailableClient( #if NeedFunctionPrototypes pointer /*ospriv*/ #endif ); extern void SendErrorToClient( #if NeedFunctionPrototypes ClientPtr /*client*/, unsigned int /*majorCode*/, unsigned int /*minorCode*/, XID /*resId*/, int /*errorCode*/ #endif ); extern void DeleteWindowFromAnySelections( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/ #endif ); extern void MarkClientException( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); extern int GetGeometry( #if NeedFunctionPrototypes ClientPtr /*client*/, xGetGeometryReply* /* wa */ #endif ); /* dixutils.c */ extern void CopyISOLatin1Lowered( #if NeedFunctionPrototypes unsigned char * /*dest*/, unsigned char * /*source*/, int /*length*/ #endif ); #ifdef XCSECURITY extern X11WindowPtr SecurityLookupWindow( #if NeedFunctionPrototypes XID /*rid*/, ClientPtr /*client*/, Mask /*access_mode*/ #endif ); extern pointer SecurityLookupDrawable( #if NeedFunctionPrototypes XID /*rid*/, ClientPtr /*client*/, Mask /*access_mode*/ #endif ); extern X11WindowPtr LookupWindow( #if NeedFunctionPrototypes XID /*rid*/, ClientPtr /*client*/ #endif ); extern pointer LookupDrawable( #if NeedFunctionPrototypes XID /*rid*/, ClientPtr /*client*/ #endif ); #else extern X11WindowPtr LookupWindow( #if NeedFunctionPrototypes XID /*rid*/, ClientPtr /*client*/ #endif ); extern pointer LookupDrawable( #if NeedFunctionPrototypes XID /*rid*/, ClientPtr /*client*/ #endif ); #define SecurityLookupWindow(rid, client, access_mode) \ LookupWindow(rid, client) #define SecurityLookupDrawable(rid, client, access_mode) \ LookupDrawable(rid, client) #endif /* XCSECURITY */ extern ClientPtr LookupClient( #if NeedFunctionPrototypes XID /*rid*/, ClientPtr /*client*/ #endif ); extern void NoopDDA( #if NeedVarargsPrototypes void *, ... #endif ); extern int AlterSaveSetForClient( #if NeedFunctionPrototypes ClientPtr /*client*/, X11WindowPtr /*pWin*/, unsigned /*mode*/ #endif ); extern void DeleteWindowFromAnySaveSet( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/ #endif ); extern void BlockHandler( #if NeedFunctionPrototypes pointer /*pTimeout*/, pointer /*pReadmask*/ #endif ); extern void WakeupHandler( #if NeedFunctionPrototypes int /*result*/, pointer /*pReadmask*/ #endif ); typedef struct timeval ** OSTimePtr; typedef void (* BlockHandlerProcPtr)( #if NeedNestedPrototypes pointer /* blockData */, OSTimePtr /* pTimeout */, pointer /* pReadmask */ #endif ); typedef void (* WakeupHandlerProcPtr)( #if NeedNestedPrototypes pointer /* blockData */, int /* result */, pointer /* pReadmask */ #endif ); extern Bool RegisterBlockAndWakeupHandlers( #if NeedFunctionPrototypes BlockHandlerProcPtr /*blockHandler*/, WakeupHandlerProcPtr /*wakeupHandler*/, pointer /*blockData*/ #endif ); extern void RemoveBlockAndWakeupHandlers( #if NeedFunctionPrototypes BlockHandlerProcPtr /*blockHandler*/, WakeupHandlerProcPtr /*wakeupHandler*/, pointer /*blockData*/ #endif ); extern void InitBlockAndWakeupHandlers( #if NeedFunctionPrototypes void #endif ); extern void ProcessWorkQueue( #if NeedFunctionPrototypes void #endif ); extern Bool QueueWorkProc( #if NeedFunctionPrototypes Bool (* /*function*/)( #if NeedNestedPrototypes ClientPtr /*clientUnused*/, pointer /*closure*/ #endif ), ClientPtr /*client*/, pointer /*closure*/ #endif ); typedef Bool (* ClientSleepProcPtr)( #if NeedFunctionPrototypes ClientPtr /*client*/, pointer /*closure*/ #endif ); extern Bool ClientSleep( ClientPtr /*client*/, ClientSleepProcPtr /* function */, pointer /*closure*/ ); extern Bool ClientSignal( ClientPtr /*client*/ ); extern void ClientWakeup( ClientPtr /*client*/ ); extern Bool ClientIsAsleep( ClientPtr /*client*/ ); /* atom.c */ extern Atom MakeAtom( char * /*string*/, unsigned /*len*/, Bool /*makeit*/ ); extern Bool ValidAtom( Atom /*atom*/ ); extern char *NameForAtom( Atom /*atom*/ ); extern void AtomError( void ); extern void FreeAllAtoms( void ); extern void InitAtoms( void ); /* events.c */ extern void SetMaskForEvent( Mask /* mask */, int /* event */ ); extern Bool PointerConfinedToScreen( void ); extern Bool IsParent( X11WindowPtr /* maybeparent */, X11WindowPtr /* child */ ); extern X11WindowPtr GetCurrentRootWindow( void ); extern X11WindowPtr GetSpriteWindow( void ); extern void GetSpritePosition( int * /* px */, int * /* py */ ); extern void NoticeEventTime( xEventPtr /* xE */ ); extern void EnqueueEvent( xEventPtr /* xE */, DeviceIntPtr /* device */, int /* count */ ); extern void ComputeFreezes( void ); extern void CheckGrabForSyncs( DeviceIntPtr /* dev */, Bool /* thisMode */, Bool /* otherMode */ ); extern void ActivatePointerGrab( DeviceIntPtr /* mouse */, GrabPtr /* grab */, TimeStamp /* time */, Bool /* autoGrab */ ); extern void DeactivatePointerGrab( DeviceIntPtr /* mouse */ ); extern void ActivateKeyboardGrab( DeviceIntPtr /* keybd */, GrabPtr /* grab */, TimeStamp /* time */, Bool /* passive */ ); extern void DeactivateKeyboardGrab( DeviceIntPtr /* keybd */ ); extern void AllowSome( ClientPtr /* client */, TimeStamp /* time */, DeviceIntPtr /* thisDev */, int /* newState */ ); extern void ReleaseActiveGrabs( ClientPtr client ); extern int DeliverEventsToWindow( X11WindowPtr /* pWin */, xEventPtr /* pEvents */, int /* count */, Mask /* filter */, GrabPtr /* grab */, int /* mskidx */ ); extern int DeliverDeviceEvents( X11WindowPtr /* pWin */, xEventPtr /* xE */, GrabPtr /* grab */, X11WindowPtr /* stopAt */, DeviceIntPtr /* dev */, int /* count */ ); extern void DefineInitialRootWindow( X11WindowPtr /* win */ ); extern void WindowHasNewCursor( X11WindowPtr /* pWin */ ); extern Bool CheckDeviceGrabs( DeviceIntPtr /* device */, xEventPtr /* xE */, int /* checkFirst */, int /* count */ ); extern void DeliverFocusedEvent( DeviceIntPtr /* keybd */, xEventPtr /* xE */, X11WindowPtr /* window */, int /* count */ ); extern void DeliverGrabbedEvent( xEventPtr /* xE */, DeviceIntPtr /* thisDev */, Bool /* deactivateGrab */, int /* count */ ); extern void RecalculateDeliverableEvents( X11WindowPtr /* pWin */ ); extern int OtherClientGone( pointer /* value */, XID /* id */ ); extern void DoFocusEvents( DeviceIntPtr /* dev */, X11WindowPtr /* fromWin */, X11WindowPtr /* toWin */, int /* mode */ ); extern int SetInputFocus( ClientPtr /* client */, DeviceIntPtr /* dev */, Window /* focusID */, CARD8 /* revertTo */, Time /* ctime */, Bool /* followOK */ ); extern int GrabDevice( ClientPtr /* client */, DeviceIntPtr /* dev */, unsigned /* this_mode */, unsigned /* other_mode */, Window /* grabWindow */, unsigned /* ownerEvents */, Time /* ctime */, Mask /* mask */, CARD8 * /* status */ ); extern void InitEvents( void ); extern void DeleteWindowFromAnyEvents( X11WindowPtr /* pWin */, Bool /* freeResources */ ); extern void CheckCursorConfinement( X11WindowPtr /* pWin */ ); extern Mask EventMaskForClient( X11WindowPtr /* pWin */, ClientPtr /* client */ ); extern int DeliverEvents( X11WindowPtr /*pWin*/, xEventPtr /*xE*/, int /*count*/, X11WindowPtr /*otherParent*/ ); extern void WriteEventsToClient( ClientPtr /*pClient*/, int /*count*/, xEventPtr /*events*/ ); extern int TryClientEvents( ClientPtr /*client*/, xEventPtr /*pEvents*/, int /*count*/, Mask /*mask*/, Mask /*filter*/, GrabPtr /*grab*/ ); extern int EventSelectForWindow( X11WindowPtr /*pWin*/, ClientPtr /*client*/, Mask /*mask*/ ); extern int EventSuppressForWindow( X11WindowPtr /*pWin*/, ClientPtr /*client*/, Mask /*mask*/, Bool * /*checkOptional*/ ); extern int MaybeDeliverEventsToClient( X11WindowPtr /*pWin*/, xEventPtr /*pEvents*/, int /*count*/, Mask /*filter*/, ClientPtr /*dontClient*/ ); extern void WindowsRestructured( void ); extern void ResetClientPrivates( void ); extern int AllocateClientPrivateIndex( void ); extern Bool AllocateClientPrivate( int /*index*/, unsigned /*amount*/ ); /* * callback manager stuff */ #ifndef _XTYPEDEF_CALLBACKLISTPTR typedef struct _CallbackList *CallbackListPtr; /* also in misc.h */ #define _XTYPEDEF_CALLBACKLISTPTR #endif typedef void (*CallbackProcPtr) ( CallbackListPtr *, pointer, pointer ); typedef Bool (*AddCallbackProcPtr) ( CallbackListPtr *, CallbackProcPtr, pointer ); typedef Bool (*DeleteCallbackProcPtr) ( CallbackListPtr *, CallbackProcPtr, pointer ); typedef void (*CallCallbacksProcPtr) ( CallbackListPtr *, pointer ); typedef void (*DeleteCallbackListProcPtr) ( CallbackListPtr * ); typedef struct _CallbackProcs { AddCallbackProcPtr AddCallback; DeleteCallbackProcPtr DeleteCallback; CallCallbacksProcPtr CallCallbacks; DeleteCallbackListProcPtr DeleteCallbackList; } CallbackFuncsRec, *CallbackFuncsPtr; extern Bool CreateCallbackList( CallbackListPtr * /*pcbl*/, CallbackFuncsPtr /*cbfuncs*/ ); extern Bool AddCallback( CallbackListPtr * /*pcbl*/, CallbackProcPtr /*callback*/, pointer /*data*/ ); extern Bool DeleteCallback( CallbackListPtr * /*pcbl*/, CallbackProcPtr /*callback*/, pointer /*data*/ ); extern void CallCallbacks( CallbackListPtr * /*pcbl*/, pointer /*call_data*/ ); extern void DeleteCallbackList( CallbackListPtr * /*pcbl*/ ); extern void InitCallbackManager( void ); /* * ServerGrabCallback stuff */ extern CallbackListPtr ServerGrabCallback; typedef enum {SERVER_GRABBED, SERVER_UNGRABBED, CLIENT_PERVIOUS, CLIENT_IMPERVIOUS } ServerGrabState; typedef struct { ClientPtr client; ServerGrabState grabstate; } ServerGrabInfoRec; /* * EventCallback stuff */ extern CallbackListPtr EventCallback; typedef struct { ClientPtr client; xEventPtr events; int count; } EventInfoRec; /* * DeviceEventCallback stuff */ extern CallbackListPtr DeviceEventCallback; typedef struct { xEventPtr events; int count; } DeviceEventInfoRec; #endif /* DIX_H */ ================================================ FILE: OSXvnc-server/include/Xserver/gc.h ================================================ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: gc.h /main/16 1996/08/01 19:18:17 dpw $ */ #ifndef GC_H #define GC_H #include "misc.h" /* for Bool */ #include "X11/X.h" /* for GContext, Mask */ #include "X11/Xproto.h" #include "screenint.h" /* for ScreenPtr */ #include "pixmap.h" /* for DrawablePtr */ /* clientClipType field in GC */ #define CT_NONE 0 #define CT_PIXMAP 1 #define CT_REGION 2 #define CT_UNSORTED 6 #define CT_YSORTED 10 #define CT_YXSORTED 14 #define CT_YXBANDED 18 #define GCQREASON_VALIDATE 1 #define GCQREASON_CHANGE 2 #define GCQREASON_COPY_SRC 3 #define GCQREASON_COPY_DST 4 #define GCQREASON_DESTROY 5 #define GC_CHANGE_SERIAL_BIT (((unsigned long)1)<<31) #define GC_CALL_VALIDATE_BIT (1L<<30) #define GCExtensionInterest (1L<<29) #define DRAWABLE_SERIAL_BITS (~(GC_CHANGE_SERIAL_BIT)) #define MAX_SERIAL_NUM (1L<<28) #define NEXT_SERIAL_NUMBER ((++globalSerialNumber) > MAX_SERIAL_NUM ? \ (globalSerialNumber = 1): globalSerialNumber) typedef struct _GCInterest *GCInterestPtr; typedef struct _GC *GCPtr; typedef struct _GCOps *GCOpsPtr; extern void ValidateGC( DrawablePtr /*pDraw*/, GCPtr /*pGC*/ ); extern int ChangeGC( GCPtr/*pGC*/, BITS32 /*mask*/, XID* /*pval*/ ); extern int DoChangeGC( GCPtr/*pGC*/, BITS32 /*mask*/, XID* /*pval*/, int /*fPointer*/ ); typedef union { CARD32 val; pointer ptr; } ChangeGCVal, *ChangeGCValPtr; extern int dixChangeGC( ClientPtr /*client*/, GCPtr /*pGC*/, BITS32 /*mask*/, CARD32 * /*pval*/, ChangeGCValPtr /*pCGCV*/ ); extern GCPtr CreateGC( DrawablePtr /*pDrawable*/, BITS32 /*mask*/, XID* /*pval*/, int* /*pStatus*/ ); extern int CopyGC( GCPtr/*pgcSrc*/, GCPtr/*pgcDst*/, BITS32 /*mask*/ ); extern int FreeGC( pointer /*pGC*/, XID /*gid*/ ); extern void SetGCMask( GCPtr /*pGC*/, Mask /*selectMask*/, Mask /*newDataMask*/ ); extern GCPtr CreateScratchGC( ScreenPtr /*pScreen*/, unsigned /*depth*/ ); extern void FreeGCperDepth( int /*screenNum*/ ); extern Bool CreateGCperDepth( int /*screenNum*/ ); extern Bool CreateDefaultStipple( int /*screenNum*/ ); extern void FreeDefaultStipple( int /*screenNum*/ ); extern int SetDashes( GCPtr /*pGC*/, unsigned /*offset*/, unsigned /*ndash*/, unsigned char* /*pdash*/ ); extern int VerifyRectOrder( int /*nrects*/, xRectangle* /*prects*/, int /*ordering*/ ); extern int SetClipRects( GCPtr /*pGC*/, int /*xOrigin*/, int /*yOrigin*/, int /*nrects*/, xRectangle* /*prects*/, int /*ordering*/ ); extern GCPtr GetScratchGC( unsigned /*depth*/, ScreenPtr /*pScreen*/ ); extern void FreeScratchGC( GCPtr /*pGC*/ ); #endif /* GC_H */ ================================================ FILE: OSXvnc-server/include/Xserver/input.h ================================================ /* $XConsortium: input.h /main/22 1996/09/25 00:50:39 dpw $ */ /* $XFree86: xc/programs/Xserver/include/input.h,v 3.4 1996/12/23 07:09:28 dawes Exp $ */ /************************************************************ Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef INPUT_H #define INPUT_H #include "misc.h" #include "screenint.h" #include "X11/Xmd.h" #include "X11/Xproto.h" #include "window.h" /* for WindowPtr */ #define DEVICE_INIT 0 #define DEVICE_ON 1 #define DEVICE_OFF 2 #define DEVICE_CLOSE 3 #define MAP_LENGTH 256 #define DOWN_LENGTH 32 /* 256/8 => number of bytes to hold 256 bits */ #define NullGrab ((GrabPtr)NULL) #define PointerRootWin ((WindowPtr)PointerRoot) #define NoneWin ((WindowPtr)None) #define NullDevice ((DevicePtr)NULL) #ifndef FollowKeyboard #define FollowKeyboard 3 #endif #ifndef FollowKeyboardWin #define FollowKeyboardWin ((WindowPtr) FollowKeyboard) #endif #ifndef RevertToFollowKeyboard #define RevertToFollowKeyboard 3 #endif typedef unsigned long Leds; typedef struct _OtherClients *OtherClientsPtr; typedef struct _InputClients *InputClientsPtr; typedef struct _DeviceIntRec *DeviceIntPtr; typedef int (*DeviceProc)( #if NeedNestedPrototypes DeviceIntPtr /*device*/, int /*what*/ #endif ); typedef void (*ProcessInputProc)( #if NeedNestedPrototypes xEventPtr /*events*/, DeviceIntPtr /*device*/, int /*count*/ #endif ); typedef struct _DeviceRec { pointer devicePrivate; ProcessInputProc processInputProc; /* current */ ProcessInputProc realInputProc; /* deliver */ ProcessInputProc enqueueInputProc; /* enqueue */ Bool on; /* used by DDX to keep state */ } DeviceRec, *DevicePtr; typedef struct { int click, bell, bell_pitch, bell_duration; Bool autoRepeat; unsigned char autoRepeats[32]; Leds leds; unsigned char id; } KeybdCtrl; typedef struct { KeySym *map; KeyCode minKeyCode, maxKeyCode; int mapWidth; } KeySymsRec, *KeySymsPtr; typedef struct { int num, den, threshold; unsigned char id; } PtrCtrl; typedef struct { int resolution, min_value, max_value; int integer_displayed; unsigned char id; } IntegerCtrl; typedef struct { int max_symbols, num_symbols_supported; int num_symbols_displayed; KeySym *symbols_supported; KeySym *symbols_displayed; unsigned char id; } StringCtrl; typedef struct { int percent, pitch, duration; unsigned char id; } BellCtrl; typedef struct { Leds led_values; Mask led_mask; unsigned char id; } LedCtrl; extern KeybdCtrl defaultKeyboardControl; extern PtrCtrl defaultPointerControl; #undef AddInputDevice extern DevicePtr AddInputDevice( #if NeedFunctionPrototypes DeviceProc /*deviceProc*/, Bool /*autoStart*/ #endif ); #define AddInputDevice(deviceProc, autoStart) \ _AddInputDevice(deviceProc, autoStart) extern DeviceIntPtr _AddInputDevice( #if NeedFunctionPrototypes DeviceProc /*deviceProc*/, Bool /*autoStart*/ #endif ); extern Bool EnableDevice( #if NeedFunctionPrototypes DeviceIntPtr /*device*/ #endif ); extern Bool DisableDevice( #if NeedFunctionPrototypes DeviceIntPtr /*device*/ #endif ); extern int InitAndStartDevices( #if NeedFunctionPrototypes void #endif ); extern void CloseDownDevices( #if NeedFunctionPrototypes void #endif ); extern void RemoveDevice( #if NeedFunctionPrototypes DeviceIntPtr /*dev*/ #endif ); extern int NumMotionEvents( #if NeedFunctionPrototypes void #endif ); #undef RegisterPointerDevice extern void RegisterPointerDevice( #if NeedFunctionPrototypes DevicePtr /*device*/ #endif ); #define RegisterPointerDevice(device) \ _RegisterPointerDevice(device) extern void _RegisterPointerDevice( #if NeedFunctionPrototypes DeviceIntPtr /*device*/ #endif ); #undef RegisterKeyboardDevice extern void RegisterKeyboardDevice( #if NeedFunctionPrototypes DevicePtr /*device*/ #endif ); #define RegisterKeyboardDevice(device) \ _RegisterKeyboardDevice(device) extern void _RegisterKeyboardDevice( #if NeedFunctionPrototypes DeviceIntPtr /*device*/ #endif ); extern DevicePtr LookupKeyboardDevice( #if NeedFunctionPrototypes void #endif ); extern DevicePtr LookupPointerDevice( #if NeedFunctionPrototypes void #endif ); extern DevicePtr LookupDevice( #if NeedFunctionPrototypes int /* id */ #endif ); extern void QueryMinMaxKeyCodes( #if NeedFunctionPrototypes KeyCode* /*minCode*/, KeyCode* /*maxCode*/ #endif ); extern Bool SetKeySymsMap( #if NeedFunctionPrototypes KeySymsPtr /*dst*/, KeySymsPtr /*src*/ #endif ); extern Bool InitKeyClassDeviceStruct( #if NeedFunctionPrototypes DeviceIntPtr /*device*/, KeySymsPtr /*pKeySyms*/, CARD8 /*pModifiers*/[] #endif ); extern Bool InitButtonClassDeviceStruct( #if NeedFunctionPrototypes DeviceIntPtr /*device*/, int /*numButtons*/, CARD8* /*map*/ #endif ); typedef int (*ValuatorMotionProcPtr)( #if NeedNestedPrototypes DeviceIntPtr /*pdevice*/, xTimecoord * /*coords*/, unsigned long /*start*/, unsigned long /*stop*/, ScreenPtr /*pScreen*/ #endif ); extern Bool InitValuatorClassDeviceStruct( #if NeedFunctionPrototypes DeviceIntPtr /*device*/, int /*numAxes*/, ValuatorMotionProcPtr /* motionProc */, int /*numMotionEvents*/, int /*mode*/ #endif ); extern Bool InitFocusClassDeviceStruct( #if NeedFunctionPrototypes DeviceIntPtr /*device*/ #endif ); typedef void (*BellProcPtr)( #if NeedNestedPrototypes int /*percent*/, DeviceIntPtr /*device*/, pointer /*ctrl*/, int #endif ); typedef void (*KbdCtrlProcPtr)( #if NeedNestedPrototypes DeviceIntPtr /*device*/, KeybdCtrl * /*ctrl*/ #endif ); extern Bool InitKbdFeedbackClassDeviceStruct( #if NeedFunctionPrototypes DeviceIntPtr /*device*/, BellProcPtr /*bellProc*/, KbdCtrlProcPtr /*controlProc*/ #endif ); typedef void (*PtrCtrlProcPtr)( #if NeedNestedPrototypes DeviceIntPtr /*device*/, PtrCtrl * /*ctrl*/ #endif ); extern Bool InitPtrFeedbackClassDeviceStruct( #if NeedFunctionPrototypes DeviceIntPtr /*device*/, PtrCtrlProcPtr /*controlProc*/ #endif ); typedef void (*StringCtrlProcPtr)( #if NeedNestedPrototypes DeviceIntPtr /*device*/, StringCtrl * /*ctrl*/ #endif ); extern Bool InitStringFeedbackClassDeviceStruct( #if NeedFunctionPrototypes DeviceIntPtr /*device*/, StringCtrlProcPtr /*controlProc*/, int /*max_symbols*/, int /*num_symbols_supported*/, KeySym* /*symbols*/ #endif ); typedef void (*BellCtrlProcPtr)( #if NeedNestedPrototypes DeviceIntPtr /*device*/, BellCtrl * /*ctrl*/ #endif ); extern Bool InitBellFeedbackClassDeviceStruct( #if NeedFunctionPrototypes DeviceIntPtr /*device*/, BellProcPtr /*bellProc*/, BellCtrlProcPtr /*controlProc*/ #endif ); typedef void (*LedCtrlProcPtr)( #if NeedNestedPrototypes DeviceIntPtr /*device*/, LedCtrl * /*ctrl*/ #endif ); extern Bool InitLedFeedbackClassDeviceStruct( #if NeedFunctionPrototypes DeviceIntPtr /*device*/, LedCtrlProcPtr /*controlProc*/ #endif ); typedef void (*IntegerCtrlProcPtr)( #if NeedNestedPrototypes DeviceIntPtr /*device*/, IntegerCtrl * /*ctrl*/ #endif ); extern Bool InitIntegerFeedbackClassDeviceStruct( #if NeedFunctionPrototypes DeviceIntPtr /*device*/, IntegerCtrlProcPtr /*controlProc*/ #endif ); extern Bool InitPointerDeviceStruct( #if NeedFunctionPrototypes DevicePtr /*device*/, CARD8* /*map*/, int /*numButtons*/, ValuatorMotionProcPtr /*motionProc*/, PtrCtrlProcPtr /*controlProc*/, int /*numMotionEvents*/ #endif ); extern Bool InitKeyboardDeviceStruct( #if NeedFunctionPrototypes DevicePtr /*device*/, KeySymsPtr /*pKeySyms*/, CARD8 /*pModifiers*/[], BellProcPtr /*bellProc*/, KbdCtrlProcPtr /*controlProc*/ #endif ); extern void SendMappingNotify( #if NeedFunctionPrototypes unsigned int /*request*/, unsigned int /*firstKeyCode*/, unsigned int /*count*/, ClientPtr /* client */ #endif ); extern Bool BadDeviceMap( #if NeedFunctionPrototypes BYTE* /*buff*/, int /*length*/, unsigned /*low*/, unsigned /*high*/, XID* /*errval*/ #endif ); extern Bool AllModifierKeysAreUp( #if NeedFunctionPrototypes DeviceIntPtr /*device*/, CARD8* /*map1*/, int /*per1*/, CARD8* /*map2*/, int /*per2*/ #endif ); extern void NoteLedState( #if NeedFunctionPrototypes DeviceIntPtr /*keybd*/, int /*led*/, Bool /*on*/ #endif ); extern void MaybeStopHint( #if NeedFunctionPrototypes DeviceIntPtr /*device*/, ClientPtr /*client*/ #endif ); extern void ProcessPointerEvent( #if NeedFunctionPrototypes xEventPtr /*xE*/, DeviceIntPtr /*mouse*/, int /*count*/ #endif ); extern void ProcessKeyboardEvent( #if NeedFunctionPrototypes xEventPtr /*xE*/, DeviceIntPtr /*keybd*/, int /*count*/ #endif ); #ifdef XKB extern void CoreProcessPointerEvent( #if NeedFunctionPrototypes xEventPtr /*xE*/, DeviceIntPtr /*mouse*/, int /*count*/ #endif ); extern void CoreProcessKeyboardEvent( #if NeedFunctionPrototypes xEventPtr /*xE*/, DeviceIntPtr /*keybd*/, int /*count*/ #endif ); #endif extern Bool LegalModifier( #if NeedFunctionPrototypes unsigned int /*key*/, DevicePtr /*pDev*/ #endif ); extern void ProcessInputEvents( #if NeedFunctionPrototypes void #endif ); extern void InitInput( #if NeedFunctionPrototypes int /*argc*/, char ** /*argv*/ #endif ); #endif /* INPUT_H */ ================================================ FILE: OSXvnc-server/include/Xserver/misc.h ================================================ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Copyright 1992, 1993 Data General Corporation; Copyright 1992, 1993 OMRON Corporation Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that neither the name OMRON or DATA GENERAL be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission of the party whose name is to be used. Neither OMRON or DATA GENERAL make any representation about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. OMRON AND DATA GENERAL EACH DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL OMRON OR DATA GENERAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: misc.h /main/28 1996/12/02 10:22:01 lehors $ */ /* $XFree86: xc/programs/Xserver/include/misc.h,v 3.5 1996/12/23 07:09:29 dawes Exp $ */ #ifndef MISC_H #define MISC_H 1 /* * X internal definitions * */ extern unsigned long globalSerialNumber; extern unsigned long serverGeneration; #include #include #include #include #ifndef MAXSCREENS #define MAXSCREENS 3 #endif #define MAXCLIENTS 128 #define MAXDITS 1 #define MAXEXTENSIONS 128 #define MAXFORMATS 8 #define MAXVISUALS_PER_SCREEN 50 typedef void *pointer; typedef int Bool; typedef unsigned long PIXEL; typedef unsigned long ATOM; #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif #ifndef _XTYPEDEF_FONTPTR typedef struct _Font *FontPtr; /* also in fonts/include/font.h */ #define _XTYPEDEF_FONTPTR #endif #ifndef _XTYPEDEF_CLIENTPTR typedef struct _Client *ClientPtr; /* also in dix.h */ #define _XTYPEDEF_CLIENTPTR #endif #ifndef _XTYPEDEF_CALLBACKLISTPTR typedef struct _CallbackList *CallbackListPtr; /* also in dix.h */ #define _XTYPEDEF_CALLBACKLISTPTR #endif typedef struct _xReq *xReqPtr; #include "os.h" /* for ALLOCATE_LOCAL and DEALLOCATE_LOCAL */ #include /* for bcopy, bzero, and bcmp */ #define NullBox ((BoxPtr)0) #define MILLI_PER_MIN (1000 * 60) #define MILLI_PER_SECOND (1000) /* this next is used with None and ParentRelative to tell PaintWin() what to use to paint the background. Also used in the macro IS_VALID_PIXMAP */ #define USE_BACKGROUND_PIXEL 3 #define USE_BORDER_PIXEL 3 /* byte swap a 32-bit literal */ #define lswapl(x) ((((x) & 0xff) << 24) |\ (((x) & 0xff00) << 8) |\ (((x) & 0xff0000) >> 8) |\ (((x) >> 24) & 0xff)) /* byte swap a short literal */ #define lswaps(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff)) #define min(a, b) (((a) < (b)) ? (a) : (b)) #define max(a, b) (((a) > (b)) ? (a) : (b)) /* abs() is a function, not a macro; include the file declaring * it in case we haven't done that yet. */ #include #define sign(x) ((x) < 0 ? -1 : ((x) > 0 ? 1 : 0)) /* this assumes b > 0 */ #define modulus(a, b, d) if (((d) = (a) % (b)) < 0) (d) += (b) /* * return the least significant bit in x which is set * * This works on 1's complement and 2's complement machines. * If you care about the extra instruction on 2's complement * machines, change to ((x) & (-(x))) */ #define lowbit(x) ((x) & (~(x) + 1)) #ifndef MAXSHORT #define MAXSHORT 32767 #endif #ifndef MINSHORT #define MINSHORT -MAXSHORT #endif /* some macros to help swap requests, replies, and events */ #define LengthRestB(stuff) \ ((client->req_len << 2) - sizeof(*stuff)) #define LengthRestS(stuff) \ ((client->req_len << 1) - (sizeof(*stuff) >> 1)) #define LengthRestL(stuff) \ (client->req_len - (sizeof(*stuff) >> 2)) #define SwapRestS(stuff) \ SwapShorts((short *)(stuff + 1), LengthRestS(stuff)) #define SwapRestL(stuff) \ SwapLongs((CARD32 *)(stuff + 1), LengthRestL(stuff)) /* byte swap a 32-bit value */ #define swapl(x, n) { \ n = ((char *) (x))[0];\ ((char *) (x))[0] = ((char *) (x))[3];\ ((char *) (x))[3] = n;\ n = ((char *) (x))[1];\ ((char *) (x))[1] = ((char *) (x))[2];\ ((char *) (x))[2] = n; } /* byte swap a short */ #define swaps(x, n) { \ n = ((char *) (x))[0];\ ((char *) (x))[0] = ((char *) (x))[1];\ ((char *) (x))[1] = n; } /* copy 32-bit value from src to dst byteswapping on the way */ #define cpswapl(src, dst) { \ ((char *)&(dst))[0] = ((char *) &(src))[3];\ ((char *)&(dst))[1] = ((char *) &(src))[2];\ ((char *)&(dst))[2] = ((char *) &(src))[1];\ ((char *)&(dst))[3] = ((char *) &(src))[0]; } /* copy short from src to dst byteswapping on the way */ #define cpswaps(src, dst) { \ ((char *) &(dst))[0] = ((char *) &(src))[1];\ ((char *) &(dst))[1] = ((char *) &(src))[0]; } extern void SwapLongs( CARD32 *list, unsigned long count ); extern void SwapShorts( short *list, unsigned long count ); extern void MakePredeclaredAtoms( void ); extern int Ones( unsigned long /*mask*/ ); typedef struct _xPoint *DDXPointPtr; typedef struct _Box *BoxPtr; typedef struct _xEvent *xEventPtr; typedef struct _xRectangle *xRectanglePtr; typedef struct _GrabRec *GrabPtr; /* typedefs from other places - duplicated here to minimize the amount * of unnecessary junk that one would normally have to include to get * these symbols defined */ #ifndef _XTYPEDEF_CHARINFOPTR typedef struct _CharInfo *CharInfoPtr; /* also in fonts/include/font.h */ #define _XTYPEDEF_CHARINFOPTR #endif #endif /* MISC_H */ ================================================ FILE: OSXvnc-server/include/Xserver/miscstruct.h ================================================ /* $XConsortium: miscstruct.h,v 5.5 94/04/17 20:25:50 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/include/miscstruct.h,v 3.0 1996/02/18 03:45:10 dawes Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef MISCSTRUCT_H #define MISCSTRUCT_H 1 #include "misc.h" #include "X11/Xprotostr.h" typedef xPoint DDXPointRec; typedef struct _Box { short x1, y1, x2, y2; } BoxRec; typedef union _DevUnion { pointer ptr; long val; unsigned long uval; pointer (*fptr)( void ); } DevUnion; #endif /* MISCSTRUCT_H */ ================================================ FILE: OSXvnc-server/include/Xserver/opaque.h ================================================ /* $XConsortium: opaque.h,v 1.19 94/04/17 20:25:51 dpw Exp $ */ /* Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* $XFree86: xc/programs/Xserver/include/opaque.h,v 1.2.2.1 1997/06/01 12:33:43 dawes Exp $ */ #ifndef OPAQUE_H #define OPAQUE_H #include extern char *defaultFontPath; extern char *defaultTextFont; extern char *defaultCursorFont; extern char *rgbPath; extern int MaxClients; extern char isItTimeToYield; extern char dispatchException; /* bit values for dispatchException */ #define DE_RESET 1 #define DE_TERMINATE 2 #define DE_PRIORITYCHANGE 4 /* set when a client's priority changes */ extern CARD32 TimeOutValue; extern CARD32 ScreenSaverTime; extern CARD32 ScreenSaverInterval; extern int ScreenSaverBlanking; extern int ScreenSaverAllowExposures; extern int argcGlobal; extern char **argvGlobal; #if DPMSExtension extern CARD32 defaultDPMSStandbyTime; extern CARD32 defaultDPMSSuspendTime; extern CARD32 defaultDPMSOffTime; extern CARD32 DPMSStandbyTime; extern CARD32 DPMSSuspendTime; extern CARD32 DPMSOffTime; extern CARD16 DPMSPowerLevel; extern Bool defaultDPMSEnabled; extern Bool DPMSEnabled; extern Bool DPMSEnabledSwitch; extern Bool DPMSDisabledSwitch; extern Bool DPMSCapableFlag; #endif #endif /* OPAQUE_H */ ================================================ FILE: OSXvnc-server/include/Xserver/os.h ================================================ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: os.h /main/60 1996/12/15 21:25:13 rws $ */ /* $XFree86: xc/programs/Xserver/include/os.h,v 3.16.2.1 1998/01/22 10:47:13 dawes Exp $ */ #ifndef OS_H #define OS_H #include "misc.h" #define ALLOCATE_LOCAL_FALLBACK(_size) Xalloc((unsigned long)(_size)) #define DEALLOCATE_LOCAL_FALLBACK(_ptr) Xfree((pointer)(_ptr)) #include "Xalloca.h" #define NullFID ((FID) 0) #define SCREEN_SAVER_ON 0 #define SCREEN_SAVER_OFF 1 #define SCREEN_SAVER_FORCER 2 #define SCREEN_SAVER_CYCLE 3 #ifndef MAX_REQUEST_SIZE #define MAX_REQUEST_SIZE 65535 #endif #ifndef MAX_BIG_REQUEST_SIZE #define MAX_BIG_REQUEST_SIZE 1048575 #endif typedef pointer FID; typedef struct _FontPathRec *FontPathPtr; typedef struct _NewClientRec *NewClientPtr; #define xnfalloc(size) XNFalloc((unsigned long)(size)) #define xnfrealloc(ptr, size) XNFrealloc((pointer)(ptr), (unsigned long)(size)) #define xalloc(size) Xalloc((unsigned long)(size)) #define xnfalloc(size) XNFalloc((unsigned long)(size)) #define xcalloc(_num, _size) Xcalloc((unsigned long)(_num)*(unsigned long)(_size)) #define xrealloc(ptr, size) Xrealloc((pointer)(ptr), (unsigned long)(size)) #define xnfrealloc(ptr, size) XNFrealloc((pointer)(ptr), (unsigned long)(size)) #define xfree(ptr) Xfree((pointer)(ptr)) #ifdef SCO #include #endif #ifndef X_NOT_STDC_ENV #include #else #ifdef SYSV #include #else #include #endif #endif /* have to put $(SIGNAL_DEFINES) in DEFINES in Imakefile to get this right */ #ifdef SIGNALRETURNSINT #define SIGVAL int #else #define SIGVAL void #endif extern Bool OsDelayInitColors; extern int WaitForSomething( int* /*pClientsReady*/ ); #ifdef LBX #define ReadRequestFromClient(client) ((client)->readRequest(client)) extern int StandardReadRequestFromClient( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); #else extern int ReadRequestFromClient( ClientPtr /*client*/ ); #endif /* LBX */ extern Bool InsertFakeRequest( ClientPtr /*client*/, char* /*data*/, int /*count*/ ); extern int ResetCurrentRequest( ClientPtr /*client*/ ); extern void FlushAllOutput( void ); extern void FlushIfCriticalOutputPending( void ); extern void SetCriticalOutputPending( void ); extern int WriteToClient( ClientPtr /*who*/, int /*count*/, char* /*buf*/ ); extern void ResetOsBuffers( void ); extern void CreateWellKnownSockets( void ); extern void ResetWellKnownSockets( void ); extern XID AuthorizationIDOfClient( ClientPtr /*client*/ ); extern char *ClientAuthorized( ClientPtr /*client*/, unsigned int /*proto_n*/, char* /*auth_proto*/, unsigned int /*string_n*/, char* /*auth_string*/ ); extern Bool EstablishNewConnections( ClientPtr /*clientUnused*/, pointer /*closure*/ ); extern void CheckConnections( void ); extern void CloseDownConnection( ClientPtr /*client*/ ); extern int AddEnabledDevice( int /*fd*/ ); extern int RemoveEnabledDevice( int /*fd*/ ); extern int OnlyListenToOneClient( ClientPtr /*client*/ ); extern int ListenToAllClients( void ); extern int IgnoreClient( ClientPtr /*client*/ ); extern int AttendClient( ClientPtr /*client*/ ); extern int MakeClientGrabImpervious( ClientPtr /*client*/ ); extern int MakeClientGrabPervious( ClientPtr /*client*/ ); extern void Error( char* /*str*/ ); extern CARD32 GetTimeInMillis( void ); extern int AdjustWaitForDelay( pointer /*waitTime*/, unsigned long /*newdelay*/ ); typedef struct _OsTimerRec *OsTimerPtr; typedef CARD32 (*OsTimerCallback)( OsTimerPtr /* timer */, CARD32 /* time */, pointer /* arg */ ); extern void TimerInit( void ); extern Bool TimerForce( OsTimerPtr /* timer */ ); #define TimerAbsolute (1<<0) #define TimerForceOld (1<<1) extern OsTimerPtr TimerSet( OsTimerPtr /* timer */, int /* flags */, CARD32 /* millis */, OsTimerCallback /* func */, pointer /* arg */ ); extern void TimerCheck( void ); extern void TimerCancel( OsTimerPtr /* pTimer */ ); extern void TimerFree( OsTimerPtr /* pTimer */ ); extern SIGVAL AutoResetServer( int /*sig*/ ); extern SIGVAL GiveUp( int /*sig*/ ); extern void UseMsg( void ); extern void ProcessCommandLine( int /*argc*/, char* /*argv*/[] ); extern unsigned long *Xalloc( unsigned long /*amount*/ ); extern unsigned long *XNFalloc( unsigned long /*amount*/ ); extern unsigned long *Xcalloc( unsigned long /*amount*/ ); extern unsigned long *Xrealloc( pointer /*ptr*/, unsigned long /*amount*/ ); extern unsigned long *XNFrealloc( pointer /*ptr*/, unsigned long /*amount*/ ); extern void Xfree( pointer /*ptr*/ ); extern void OsInitAllocator( void ); typedef SIGVAL (*OsSigHandlerPtr)( int /* sig */ ); extern OsSigHandlerPtr OsSignal( int /* sig */, OsSigHandlerPtr /* handler */ ); extern int auditTrailLevel; extern void AuditF( char* /*f*/, ... ); extern void FatalError( #if NeedVarargsPrototypes char* /*f*/, ... #endif ) #if __GNUC__ == 2 && __GNUC_MINOR__ > 4 __attribute((noreturn)) #endif ; extern void ErrorF( #if NeedVarargsPrototypes char* /*f*/, ... #endif ); #ifdef SERVER_LOCK extern void LockServer( #if NeedFunctionPrototypes void #endif ); extern void UnlockServer( #if NeedFunctionPrototypes void #endif ); #endif extern int OsLookupColor( #if NeedFunctionPrototypes int /*screen*/, char * /*name*/, unsigned /*len*/, unsigned short * /*pred*/, unsigned short * /*pgreen*/, unsigned short * /*pblue*/ #endif ); extern void OsInit( #if NeedFunctionPrototypes void #endif ); extern void OsCleanup( #if NeedFunctionPrototypes void #endif ); extern void OsVendorFatalError( #if NeedFunctionPrototypes void #endif ); extern void OsVendorInit( #if NeedFunctionPrototypes void #endif ); extern int OsInitColors( #if NeedFunctionPrototypes void #endif ); #if !defined(WIN32) && !defined(__EMX__) extern int System( #if NeedFunctionPrototypes char * #endif ); extern pointer Popen( #if NeedFunctionPrototypes char *, char * #endif ); extern int Pclose( #if NeedFunctionPrototypes pointer #endif ); #else #define System(a) system(a) #define Popen(a,b) popen(a,b) #define Pclose(a) pclose(a) #endif extern int AddHost( #if NeedFunctionPrototypes ClientPtr /*client*/, int /*family*/, unsigned /*length*/, pointer /*pAddr*/ #endif ); extern Bool ForEachHostInFamily ( #if NeedFunctionPrototypes int /*family*/, Bool (* /*func*/ )( #if NeedNestedPrototypes unsigned char * /* addr */, short /* len */, pointer /* closure */ #endif ), pointer /*closure*/ #endif ); extern int RemoveHost( #if NeedFunctionPrototypes ClientPtr /*client*/, int /*family*/, unsigned /*length*/, pointer /*pAddr*/ #endif ); extern int GetHosts( #if NeedFunctionPrototypes pointer * /*data*/, int * /*pnHosts*/, int * /*pLen*/, BOOL * /*pEnabled*/ #endif ); typedef struct sockaddr * sockaddrPtr; extern int InvalidHost( #if NeedFunctionPrototypes sockaddrPtr /*saddr*/, int /*len*/ #endif ); extern int LocalClient( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); extern int ChangeAccessControl( #if NeedFunctionPrototypes ClientPtr /*client*/, int /*fEnabled*/ #endif ); extern int GetAccessControl( #if NeedFunctionPrototypes void #endif ); extern void AddLocalHosts( #if NeedFunctionPrototypes void #endif ); extern void ResetHosts( #if NeedFunctionPrototypes char *display #endif ); extern void EnableLocalHost( #if NeedFunctionPrototypes void #endif ); extern void DisableLocalHost( #if NeedFunctionPrototypes void #endif ); extern void AccessUsingXdmcp( #if NeedFunctionPrototypes void #endif ); extern void DefineSelf( #if NeedFunctionPrototypes int /*fd*/ #endif ); extern void AugmentSelf( #if NeedFunctionPrototypes pointer /*from*/, int /*len*/ #endif ); extern void InitAuthorization( #if NeedFunctionPrototypes char * /*filename*/ #endif ); extern int LoadAuthorization( #if NeedFunctionPrototypes void #endif ); extern void RegisterAuthorizations( #if NeedFunctionPrototypes void #endif ); extern XID CheckAuthorization( #if NeedFunctionPrototypes unsigned int /*namelength*/, char * /*name*/, unsigned int /*datalength*/, char * /*data*/, ClientPtr /*client*/, char ** /*reason*/ #endif ); extern void ResetAuthorization( #if NeedFunctionPrototypes void #endif ); extern int AddAuthorization( #if NeedFunctionPrototypes unsigned int /*name_length*/, char * /*name*/, unsigned int /*data_length*/, char * /*data*/ #endif ); extern XID GenerateAuthorization( #if NeedFunctionPrototypes unsigned int /* name_length */, char * /* name */, unsigned int /* data_length */, char * /* data */, unsigned int * /* data_length_return */, char ** /* data_return */ #endif ); extern void ExpandCommandLine( #if NeedFunctionPrototypes int * /*pargc*/, char *** /*pargv*/ #endif ); extern int ddxProcessArgument( #if NeedFunctionPrototypes int /*argc*/, char * /*argv*/ [], int /*i*/ #endif ); /* * idiom processing stuff */ xReqPtr PeekNextRequest( #if NeedFunctionPrototypes xReqPtr req, ClientPtr client, Bool readmore #endif ); void SkipRequests( #if NeedFunctionPrototypes xReqPtr req, ClientPtr client, int numskipped #endif ); /* int ReqLen(xReq *req, ClientPtr client) * Given a pointer to a *complete* request, return its length in bytes. * Note that if the request is a big request (as defined in the Big * Requests extension), the macro lies by returning 4 less than the * length that it actually occupies in the request buffer. This is so you * can blindly compare the length with the various sz_ constants * in Xproto.h without having to know/care about big requests. */ #define ReqLen(_pxReq, _client) \ ((_pxReq->length ? \ (_client->swapped ? lswaps(_pxReq->length) : _pxReq->length) \ : ((_client->swapped ? \ lswapl(((CARD32*)_pxReq)[1]) : ((CARD32*)_pxReq)[1])-1) \ ) << 2) /* otherReqTypePtr CastxReq(xReq *req, otherReqTypePtr) * Cast the given request to one of type otherReqTypePtr to access * fields beyond the length field. */ #define CastxReq(_pxReq, otherReqTypePtr) \ (_pxReq->length ? (otherReqTypePtr)_pxReq \ : (otherReqTypePtr)(((CARD32*)_pxReq)+1)) /* stuff for SkippedRequestsCallback */ extern CallbackListPtr SkippedRequestsCallback; typedef struct { xReqPtr req; ClientPtr client; int numskipped; } SkippedRequestInfoRec; /* stuff for ReplyCallback */ extern CallbackListPtr ReplyCallback; typedef struct { ClientPtr client; pointer replyData; unsigned long dataLenBytes; unsigned long bytesRemaining; Bool startOfReply; } ReplyInfoRec; /* stuff for FlushCallback */ extern CallbackListPtr FlushCallback; #endif /* OS_H */ ================================================ FILE: OSXvnc-server/include/Xserver/pixmap.h ================================================ /* $XConsortium: pixmap.h,v 5.6 94/04/17 20:25:53 dpw Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef PIXMAP_H #define PIXMAP_H #include "misc.h" #include "screenint.h" /* types for Drawable */ #define DRAWABLE_WINDOW 0 #define DRAWABLE_PIXMAP 1 #define UNDRAWABLE_WINDOW 2 #define DRAWABLE_BUFFER 3 /* flags to PaintWindow() */ #define PW_BACKGROUND 0 #define PW_BORDER 1 #define NullPixmap ((PixmapPtr)0) typedef struct _Drawable *DrawablePtr; typedef struct _Pixmap *PixmapPtr; typedef union _PixUnion { PixmapPtr pixmap; unsigned long pixel; } PixUnion; #define SamePixUnion(a,b,isPixel)\ ((isPixel) ? (a).pixel == (b).pixel : (a).pixmap == (b).pixmap) #define EqualPixUnion(as, a, bs, b) \ ((as) == (bs) && (SamePixUnion (a, b, as))) #define OnScreenDrawable(type) \ ((type == DRAWABLE_WINDOW) || (type == DRAWABLE_BUFFER)) #define WindowDrawable(type) \ ((type == DRAWABLE_WINDOW) || (type == UNDRAWABLE_WINDOW)) extern PixmapPtr GetScratchPixmapHeader( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, int /*width*/, int /*height*/, int /*depth*/, int /*bitsPerPixel*/, int /*devKind*/, pointer /*pPixData*/ #endif ); extern void FreeScratchPixmapHeader( #if NeedFunctionPrototypes PixmapPtr /*pPixmap*/ #endif ); extern Bool CreateScratchPixmapsForScreen( #if NeedFunctionPrototypes int /*scrnum*/ #endif ); extern void FreeScratchPixmapsForScreen( #if NeedFunctionPrototypes int /*scrnum*/ #endif ); extern PixmapPtr AllocatePixmap( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, int /*pixDataSize*/ #endif ); #endif /* PIXMAP_H */ ================================================ FILE: OSXvnc-server/include/Xserver/region.h ================================================ /* $XConsortium: region.h,v 1.5 94/04/17 20:25:59 dpw Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef REGION_H #define REGION_H #include "regionstr.h" #endif /* REGION_H */ ================================================ FILE: OSXvnc-server/include/Xserver/regionstr.h ================================================ /* $XConsortium: regionstr.h,v 1.8 94/04/17 20:26:01 dpw Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef REGIONSTRUCT_H #define REGIONSTRUCT_H #include "miscstruct.h" /* Return values from RectIn() */ #define rgnOUT 0 #define rgnIN 1 #define rgnPART 2 #define NullRegion ((RegionPtr)0) /* * clip region */ typedef struct _RegData { long size; long numRects; /* BoxRec rects[size]; in memory but not explicitly declared */ } RegDataRec, *RegDataPtr; typedef struct _Region { BoxRec extents; RegDataPtr data; } RegionRec, *RegionPtr; extern BoxRec miEmptyBox; extern RegDataRec miEmptyData; #define REGION_NIL(reg) ((reg)->data && !(reg)->data->numRects) #define REGION_NUM_RECTS(reg) ((reg)->data ? (reg)->data->numRects : 1) #define REGION_SIZE(reg) ((reg)->data ? (reg)->data->size : 0) #define REGION_RECTS(reg) ((reg)->data ? (BoxPtr)((reg)->data + 1) \ : &(reg)->extents) #define REGION_BOXPTR(reg) ((BoxPtr)((reg)->data + 1)) #define REGION_BOX(reg,i) (®ION_BOXPTR(reg)[i]) #define REGION_TOP(reg) REGION_BOX(reg, (reg)->data->numRects) #define REGION_END(reg) REGION_BOX(reg, (reg)->data->numRects - 1) #define REGION_SZOF(n) (sizeof(RegDataRec) + ((n) * sizeof(BoxRec))) #ifdef NEED_SCREEN_REGIONS #define REGION_CREATE(_pScreen, _rect, _size) \ (*(_pScreen)->RegionCreate)(_rect, _size) #define REGION_INIT(_pScreen, _pReg, _rect, _size) \ (*(_pScreen)->RegionInit)(_pReg, _rect, _size) #define REGION_COPY(_pScreen, dst, src) \ (*(_pScreen)->RegionCopy)(dst, src) #define REGION_DESTROY(_pScreen, _pReg) \ (*(_pScreen)->RegionDestroy)(_pReg) #define REGION_UNINIT(_pScreen, _pReg) \ (*(_pScreen)->RegionUninit)(_pReg) #define REGION_INTERSECT(_pScreen, newReg, reg1, reg2) \ (*(_pScreen)->Intersect)(newReg, reg1, reg2) #define REGION_UNION(_pScreen, newReg, reg1, reg2) \ (*(_pScreen)->Union)(newReg, reg1, reg2) #define REGION_SUBTRACT(_pScreen, newReg, reg1, reg2) \ (*(_pScreen)->Subtract)(newReg, reg1, reg2) #define REGION_INVERSE(_pScreen, newReg, reg1, invRect) \ (*(_pScreen)->Inverse)(newReg, reg1, invRect) #define REGION_RESET(_pScreen, _pReg, _pBox) \ (*(_pScreen)->RegionReset)(_pReg, _pBox) #define REGION_TRANSLATE(_pScreen, _pReg, _x, _y) \ (*(_pScreen)->TranslateRegion)(_pReg, _x, _y) #define RECT_IN_REGION(_pScreen, _pReg, prect) \ (*(_pScreen)->RectIn)(_pReg, prect) #define POINT_IN_REGION(_pScreen, _pReg, _x, _y, prect) \ (*(_pScreen)->PointInRegion)(_pReg, _x, _y, prect) #define REGION_NOTEMPTY(_pScreen, _pReg) \ (*(_pScreen)->RegionNotEmpty)(_pReg) #define REGION_EMPTY(_pScreen, _pReg) \ (*(_pScreen)->RegionEmpty)(_pReg) #define REGION_EXTENTS(_pScreen, _pReg) \ (*(_pScreen)->RegionExtents)(_pReg) #define REGION_APPEND(_pScreen, dstrgn, rgn) \ (*(_pScreen)->RegionAppend)(dstrgn, rgn) #define REGION_VALIDATE(_pScreen, badreg, pOverlap) \ (*(_pScreen)->RegionValidate)(badreg, pOverlap) #define BITMAP_TO_REGION(_pScreen, pPix) \ (*(_pScreen)->BitmapToRegion)(pPix) #define RECTS_TO_REGION(_pScreen, nrects, prect, ctype) \ (*(_pScreen)->RectsToRegion)(nrects, prect, ctype) #else /* !NEED_SCREEN_REGIONS */ #define REGION_CREATE(_pScreen, _rect, _size) \ miRegionCreate(_rect, _size) #define REGION_COPY(_pScreen, dst, src) \ miRegionCopy(dst, src) #define REGION_DESTROY(_pScreen, _pReg) \ miRegionDestroy(_pReg) #define REGION_INTERSECT(_pScreen, newReg, reg1, reg2) \ miIntersect(newReg, reg1, reg2) #define REGION_UNION(_pScreen, newReg, reg1, reg2) \ miUnion(newReg, reg1, reg2) #define REGION_SUBTRACT(_pScreen, newReg, reg1, reg2) \ miSubtract(newReg, reg1, reg2) #define REGION_INVERSE(_pScreen, newReg, reg1, invRect) \ miInverse(newReg, reg1, invRect) #define REGION_TRANSLATE(_pScreen, _pReg, _x, _y) \ miTranslateRegion(_pReg, _x, _y) #define RECT_IN_REGION(_pScreen, _pReg, prect) \ miRectIn(_pReg, prect) #define POINT_IN_REGION(_pScreen, _pReg, _x, _y, prect) \ miPointInRegion(_pReg, _x, _y, prect) #define REGION_APPEND(_pScreen, dstrgn, rgn) \ miRegionAppend(dstrgn, rgn) #define REGION_VALIDATE(_pScreen, badreg, pOverlap) \ miRegionValidate(badreg, pOverlap) #define BITMAP_TO_REGION(_pScreen, pPix) \ (*(_pScreen)->BitmapToRegion)(pPix) /* no mi version?! */ #define RECTS_TO_REGION(_pScreen, nrects, prect, ctype) \ miRectsToRegion(nrects, prect, ctype) #ifdef DONT_INLINE_REGION_OPS #define REGION_INIT(_pScreen, _pReg, _rect, _size) \ miRegionInit(_pReg, _rect, _size) #define REGION_UNINIT(_pScreen, _pReg) \ miRegionUninit(_pReg) #define REGION_RESET(_pScreen, _pReg, _pBox) \ miRegionReset(_pReg, _pBox) #define REGION_NOTEMPTY(_pScreen, _pReg) \ miRegionNotEmpty(_pReg) #define REGION_EMPTY(_pScreen, _pReg) \ miRegionEmpty(_pReg) #define REGION_EXTENTS(_pScreen, _pReg) \ miRegionExtents(_pReg) #else /* inline certain simple region ops for performance */ #define REGION_INIT(_pScreen, _pReg, _rect, _size) \ { \ if (_rect) \ { \ (_pReg)->extents = *(_rect); \ (_pReg)->data = (RegDataPtr)NULL; \ } \ else \ { \ (_pReg)->extents = miEmptyBox; \ if (((_size) > 1) && ((_pReg)->data = \ (RegDataPtr)xalloc(REGION_SZOF(_size)))) \ { \ (_pReg)->data->size = (_size); \ (_pReg)->data->numRects = 0; \ } \ else \ (_pReg)->data = &miEmptyData; \ } \ } #define REGION_UNINIT(_pScreen, _pReg) \ { \ if ((_pReg)->data && (_pReg)->data->size) xfree((_pReg)->data); \ } #define REGION_RESET(_pScreen, _pReg, _pBox) \ { \ (_pReg)->extents = *(_pBox); \ REGION_UNINIT(_pScreen, _pReg); \ (_pReg)->data = (RegDataPtr)NULL; \ } #define REGION_NOTEMPTY(_pScreen, _pReg) \ !REGION_NIL(_pReg) #define REGION_EMPTY(_pScreen, _pReg) \ { \ REGION_UNINIT(_pScreen, _pReg); \ (_pReg)->extents.x2 = (_pReg)->extents.x1; \ (_pReg)->extents.y2 = (_pReg)->extents.y1; \ (_pReg)->data = &miEmptyData; \ } #define REGION_EXTENTS(_pScreen, _pReg) \ &(_pReg)->extents #endif /* DONT_INLINE_REGION_OPS */ #endif /* NEED_SCREEN_REGIONS */ /* moved from mi.h */ extern RegionPtr miRegionCreate( #if NeedFunctionPrototypes BoxPtr /*rect*/, int /*size*/ #endif ); extern void miRegionInit( #if NeedFunctionPrototypes RegionPtr /*pReg*/, BoxPtr /*rect*/, int /*size*/ #endif ); extern void miRegionDestroy( #if NeedFunctionPrototypes RegionPtr /*pReg*/ #endif ); extern void miRegionUninit( #if NeedFunctionPrototypes RegionPtr /*pReg*/ #endif ); extern Bool miRegionCopy( #if NeedFunctionPrototypes RegionPtr /*dst*/, RegionPtr /*src*/ #endif ); extern Bool miIntersect( #if NeedFunctionPrototypes RegionPtr /*newReg*/, RegionPtr /*reg1*/, RegionPtr /*reg2*/ #endif ); extern Bool miUnion( #if NeedFunctionPrototypes RegionPtr /*newReg*/, RegionPtr /*reg1*/, RegionPtr /*reg2*/ #endif ); extern Bool miRegionAppend( #if NeedFunctionPrototypes RegionPtr /*dstrgn*/, RegionPtr /*rgn*/ #endif ); extern Bool miRegionValidate( #if NeedFunctionPrototypes RegionPtr /*badreg*/, Bool * /*pOverlap*/ #endif ); extern RegionPtr miRectsToRegion( #if NeedFunctionPrototypes int /*nrects*/, xRectanglePtr /*prect*/, int /*ctype*/ #endif ); extern Bool miSubtract( #if NeedFunctionPrototypes RegionPtr /*regD*/, RegionPtr /*regM*/, RegionPtr /*regS*/ #endif ); extern Bool miInverse( #if NeedFunctionPrototypes RegionPtr /*newReg*/, RegionPtr /*reg1*/, BoxPtr /*invRect*/ #endif ); extern int miRectIn( #if NeedFunctionPrototypes RegionPtr /*region*/, BoxPtr /*prect*/ #endif ); extern void miTranslateRegion( #if NeedFunctionPrototypes RegionPtr /*pReg*/, int /*x*/, int /*y*/ #endif ); extern void miRegionReset( #if NeedFunctionPrototypes RegionPtr /*pReg*/, BoxPtr /*pBox*/ #endif ); extern Bool miPointInRegion( #if NeedFunctionPrototypes RegionPtr /*pReg*/, int /*x*/, int /*y*/, BoxPtr /*box*/ #endif ); extern Bool miRegionNotEmpty( #if NeedFunctionPrototypes RegionPtr /*pReg*/ #endif ); extern void miRegionEmpty( #if NeedFunctionPrototypes RegionPtr /*pReg*/ #endif ); extern BoxPtr miRegionExtents( #if NeedFunctionPrototypes RegionPtr /*pReg*/ #endif ); #endif /* REGIONSTRUCT_H */ ================================================ FILE: OSXvnc-server/include/Xserver/screenint.h ================================================ /* $XConsortium: screenint.h /main/6 1996/06/17 10:55:15 mor $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XFree86: xc/programs/Xserver/include/screenint.h,v 1.2 1997/01/14 22:22:40 dawes Exp $ */ #ifndef SCREENINT_H #define SCREENINT_H #include "misc.h" typedef struct _PixmapFormat *PixmapFormatPtr; typedef struct _Visual *VisualPtr; typedef struct _Depth *DepthPtr; typedef struct _Screen *ScreenPtr; extern void ResetScreenPrivates( #if NeedFunctionPrototypes void #endif ); extern int AllocateScreenPrivateIndex( #if NeedFunctionPrototypes void #endif ); extern void ResetWindowPrivates( #if NeedFunctionPrototypes void #endif ); extern int AllocateWindowPrivateIndex( #if NeedFunctionPrototypes void #endif ); extern Bool AllocateWindowPrivate( #if NeedFunctionPrototypes ScreenPtr /* pScreen */, int /* index */, unsigned /* amount */ #endif ); extern void ResetGCPrivates( #if NeedFunctionPrototypes void #endif ); extern int AllocateGCPrivateIndex( #if NeedFunctionPrototypes void #endif ); extern Bool AllocateGCPrivate( #if NeedFunctionPrototypes ScreenPtr /* pScreen */, int /* index */, unsigned /* amount */ #endif ); extern int AddScreen( #if NeedFunctionPrototypes Bool (* /*pfnInit*/)( #if NeedNestedPrototypes int /*index*/, ScreenPtr /*pScreen*/, int /*argc*/, char ** /*argv*/ #endif ), int /*argc*/, char** /*argv*/ #endif ); #ifdef PIXPRIV extern void ResetPixmapPrivates( #if NeedFunctionPrototypes void #endif ); extern int AllocatePixmapPrivateIndex( #if NeedFunctionPrototypes void #endif ); extern Bool AllocatePixmapPrivate( #if NeedFunctionPrototypes ScreenPtr /* pScreen */, int /* index */, unsigned /* amount */ #endif ); #endif /* PIXPRIV */ extern void ResetColormapPrivates( #if NeedFunctionPrototypes void #endif ); typedef struct _ColormapRec *ColormapPtr; typedef int (*InitCmapPrivFunc)( #if NeedNestedPrototypes ColormapPtr #endif ); extern int AllocateColormapPrivateIndex( #if NeedFunctionPrototypes InitCmapPrivFunc /* initPrivFunc */ #endif ); #endif /* SCREENINT_H */ ================================================ FILE: OSXvnc-server/include/Xserver/scrnintstr.h ================================================ /* $XConsortium: scrnintstr.h /main/32 1996/09/28 17:14:32 rws $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef SCREENINTSTRUCT_H #define SCREENINTSTRUCT_H #include "screenint.h" #include "miscstruct.h" #include "region.h" #include "pixmap.h" #include "gc.h" #include "colormap.h" #include "cursor.h" #include "validate.h" #include "window.h" #include "X11/Xproto.h" #include "dix.h" typedef struct _PixmapFormat { unsigned char depth; unsigned char bitsPerPixel; unsigned char scanlinePad; } PixmapFormatRec; typedef struct _Visual { VisualID vid; short clazz; short bitsPerRGBValue; short ColormapEntries; short nplanes;/* = log2 (ColormapEntries). This does not * imply that the screen has this many planes. * it may have more or fewer */ unsigned long redMask, greenMask, blueMask; int offsetRed, offsetGreen, offsetBlue; } VisualRec; typedef struct _Depth { unsigned char depth; short numVids; VisualID *vids; /* block of visual ids for this depth */ } DepthRec; /* * There is a typedef for each screen function pointer so that code that * needs to declare a screen function pointer (e.g. in a screen private * or as a local variable) can easily do so and retain full type checking. */ typedef Bool (* CloseScreenProcPtr)( #if NeedNestedPrototypes int /*index*/, ScreenPtr /*pScreen*/ #endif ); typedef void (* QueryBestSizeProcPtr)( #if NeedNestedPrototypes int /*class*/, unsigned short * /*pwidth*/, unsigned short * /*pheight*/, ScreenPtr /*pScreen*/ #endif ); typedef Bool (* SaveScreenProcPtr)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, int /*on*/ #endif ); typedef void (* GetImageProcPtr)( #if NeedNestedPrototypes DrawablePtr /*pDrawable*/, int /*sx*/, int /*sy*/, int /*w*/, int /*h*/, unsigned int /*format*/, unsigned long /*planeMask*/, char * /*pdstLine*/ #endif ); typedef void (* GetSpansProcPtr)( #if NeedNestedPrototypes DrawablePtr /*pDrawable*/, int /*wMax*/, DDXPointPtr /*ppt*/, int* /*pwidth*/, int /*nspans*/, char * /*pdstStart*/ #endif ); typedef void (* PointerNonInterestBoxProcPtr)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, BoxPtr /*pBox*/ #endif ); typedef void (* SourceValidateProcPtr)( #if NeedNestedPrototypes DrawablePtr /*pDrawable*/, int /*x*/, int /*y*/, int /*width*/, int /*height*/ #endif ); typedef Bool (* CreateWindowProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pWindow*/ #endif ); typedef Bool (* DestroyWindowProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pWindow*/ #endif ); typedef Bool (* PositionWindowProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pWindow*/, int /*x*/, int /*y*/ #endif ); typedef Bool (* ChangeWindowAttributesProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pWindow*/, unsigned long /*mask*/ #endif ); typedef Bool (* RealizeWindowProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pWindow*/ #endif ); typedef Bool (* UnrealizeWindowProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pWindow*/ #endif ); typedef int (* ValidateTreeProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pParent*/, X11WindowPtr /*pChild*/, VTKind /*kind*/ #endif ); typedef void (* PostValidateTreeProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pParent*/, X11WindowPtr /*pChild*/, VTKind /*kind*/ #endif ); typedef void (* WindowExposuresProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pWindow*/, RegionPtr /*prgn*/, RegionPtr /*other_exposed*/ #endif ); typedef void (* PaintWindowBackgroundProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pWindow*/, RegionPtr /*pRegion*/, int /*what*/ #endif ); typedef void (* PaintWindowBorderProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pWindow*/, RegionPtr /*pRegion*/, int /*what*/ #endif ); typedef void (* CopyWindowProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pWindow*/, DDXPointRec /*ptOldOrg*/, RegionPtr /*prgnSrc*/ #endif ); typedef void (* ClearToBackgroundProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pWindow*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/, Bool /*generateExposures*/ #endif ); typedef void (* ClipNotifyProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pWindow*/, int /*dx*/, int /*dy*/ #endif ); typedef PixmapPtr (* CreatePixmapProcPtr)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, int /*width*/, int /*height*/, int /*depth*/ #endif ); typedef Bool (* DestroyPixmapProcPtr)( #if NeedNestedPrototypes PixmapPtr /*pPixmap*/ #endif ); typedef void (* SaveDoomedAreasProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pWindow*/, RegionPtr /*prgnSave*/, int /*xorg*/, int /*yorg*/ #endif ); typedef RegionPtr (* RestoreAreasProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pWindow*/, RegionPtr /*prgnRestore*/ #endif ); typedef void (* ExposeCopyProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pSrc*/, DrawablePtr /*pDst*/, GCPtr /*pGC*/, RegionPtr /*prgnExposed*/, int /*srcx*/, int /*srcy*/, int /*dstx*/, int /*dsty*/, unsigned long /*plane*/ #endif ); typedef RegionPtr (* TranslateBackingStoreProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pWindow*/, int /*windx*/, int /*windy*/, RegionPtr /*oldClip*/, int /*oldx*/, int /*oldy*/ #endif ); typedef RegionPtr (* ClearBackingStoreProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pWindow*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/, Bool /*generateExposures*/ #endif ); typedef void (* DrawGuaranteeProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pWindow*/, GCPtr /*pGC*/, int /*guarantee*/ #endif ); typedef Bool (* RealizeFontProcPtr)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, FontPtr /*pFont*/ #endif ); typedef Bool (* UnrealizeFontProcPtr)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, FontPtr /*pFont*/ #endif ); typedef void (* ConstrainCursorProcPtr)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, BoxPtr /*pBox*/ #endif ); typedef void (* CursorLimitsProcPtr)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/, BoxPtr /*pHotBox*/, BoxPtr /*pTopLeftBox*/ #endif ); typedef Bool (* DisplayCursorProcPtr)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/ #endif ); typedef Bool (* RealizeCursorProcPtr)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/ #endif ); typedef Bool (* UnrealizeCursorProcPtr)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/ #endif ); typedef void (* RecolorCursorProcPtr)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/, Bool /*displayed*/ #endif ); typedef Bool (* SetCursorPositionProcPtr)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, int /*x*/, int /*y*/, Bool /*generateEvent*/ #endif ); typedef Bool (* CreateGCProcPtr)( #if NeedNestedPrototypes GCPtr /*pGC*/ #endif ); typedef Bool (* CreateColormapProcPtr)( #if NeedNestedPrototypes ColormapPtr /*pColormap*/ #endif ); typedef void (* DestroyColormapProcPtr)( #if NeedNestedPrototypes ColormapPtr /*pColormap*/ #endif ); typedef void (* InstallColormapProcPtr)( #if NeedNestedPrototypes ColormapPtr /*pColormap*/ #endif ); typedef void (* UninstallColormapProcPtr)( #if NeedNestedPrototypes ColormapPtr /*pColormap*/ #endif ); typedef int (* ListInstalledColormapsProcPtr) ( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, XID* /*pmaps */ #endif ); typedef void (* StoreColorsProcPtr)( #if NeedNestedPrototypes ColormapPtr /*pColormap*/, int /*ndef*/, xColorItem * /*pdef*/ #endif ); typedef void (* ResolveColorProcPtr)( #if NeedNestedPrototypes unsigned short* /*pred*/, unsigned short* /*pgreen*/, unsigned short* /*pblue*/, VisualPtr /*pVisual*/ #endif ); typedef RegionPtr (* RegionCreateProcPtr)( #if NeedNestedPrototypes BoxPtr /*rect*/, int /*size*/ #endif ); typedef void (* RegionInitProcPtr)( #if NeedNestedPrototypes RegionPtr /*pReg*/, BoxPtr /*rect*/, int /*size*/ #endif ); typedef Bool (* RegionCopyProcPtr)( #if NeedNestedPrototypes RegionPtr /*dst*/, RegionPtr /*src*/ #endif ); typedef void (* RegionDestroyProcPtr)( #if NeedNestedPrototypes RegionPtr /*pReg*/ #endif ); typedef void (* RegionUninitProcPtr)( #if NeedNestedPrototypes RegionPtr /*pReg*/ #endif ); typedef Bool (* IntersectProcPtr)( #if NeedNestedPrototypes RegionPtr /*newReg*/, RegionPtr /*reg1*/, RegionPtr /*reg2*/ #endif ); typedef Bool (* UnionProcPtr)( #if NeedNestedPrototypes RegionPtr /*newReg*/, RegionPtr /*reg1*/, RegionPtr /*reg2*/ #endif ); typedef Bool (* SubtractProcPtr)( #if NeedNestedPrototypes RegionPtr /*regD*/, RegionPtr /*regM*/, RegionPtr /*regS*/ #endif ); typedef Bool (* InverseProcPtr)( #if NeedNestedPrototypes RegionPtr /*newReg*/, RegionPtr /*reg1*/, BoxPtr /*invRect*/ #endif ); typedef void (* RegionResetProcPtr)( #if NeedNestedPrototypes RegionPtr /*pReg*/, BoxPtr /*pBox*/ #endif ); typedef void (* TranslateRegionProcPtr)( #if NeedNestedPrototypes RegionPtr /*pReg*/, int /*x*/, int /*y*/ #endif ); typedef int (* RectInProcPtr)( #if NeedNestedPrototypes RegionPtr /*region*/, BoxPtr /*prect*/ #endif ); typedef Bool (* PointInRegionProcPtr)( #if NeedNestedPrototypes RegionPtr /*pReg*/, int /*x*/, int /*y*/, BoxPtr /*box*/ #endif ); typedef Bool (* RegionNotEmptyProcPtr)( #if NeedNestedPrototypes RegionPtr /*pReg*/ #endif ); typedef void (* RegionEmptyProcPtr)( #if NeedNestedPrototypes RegionPtr /*pReg*/ #endif ); typedef BoxPtr (* RegionExtentsProcPtr)( #if NeedNestedPrototypes RegionPtr /*pReg*/ #endif ); typedef Bool (* RegionAppendProcPtr)( #if NeedNestedPrototypes RegionPtr /*dstrgn*/, RegionPtr /*rgn*/ #endif ); typedef Bool (* RegionValidateProcPtr)( #if NeedNestedPrototypes RegionPtr /*badreg*/, Bool* /*pOverlap*/ #endif ); typedef RegionPtr (* BitmapToRegionProcPtr)( #if NeedNestedPrototypes PixmapPtr /*pPix*/ #endif ); typedef RegionPtr (* RectsToRegionProcPtr)( #if NeedNestedPrototypes int /*nrects*/, xRectangle* /*prect*/, int /*ctype*/ #endif ); typedef void (* SendGraphicsExposeProcPtr)( #if NeedNestedPrototypes ClientPtr /*client*/, RegionPtr /*pRgn*/, XID /*drawable*/, int /*major*/, int /*minor*/ #endif ); typedef void (* ScreenBlockHandlerProcPtr)( #if NeedNestedPrototypes int /*screenNum*/, pointer /*blockData*/, struct timeval ** /*pTimeout*/, pointer /*pReadmask*/ #endif ); typedef void (* ScreenWakeupHandlerProcPtr)( #if NeedNestedPrototypes int /*screenNum*/, pointer /*wakeupData*/, unsigned long /*result*/, pointer /*pReadMask*/ #endif ); typedef Bool (* CreateScreenResourcesProcPtr)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/ #endif ); typedef Bool (* ModifyPixmapHeaderProcPtr)( #if NeedNestedPrototypes PixmapPtr /*pPixmap*/, int /*width*/, int /*height*/, int /*depth*/, int /*bitsPerPixel*/, int /*devKind*/, pointer /*pPixData*/ #endif ); typedef void (* MarkWindowProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pWin*/ #endif ); typedef Bool (* MarkOverlappedWindowsProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*parent*/, X11WindowPtr /*firstChild*/, X11WindowPtr * /*pLayerWin*/ #endif ); typedef Bool (* ChangeSaveUnderProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pLayerWin*/, X11WindowPtr /*firstChild*/ #endif ); typedef void (* PostChangeSaveUnderProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pLayerWin*/, X11WindowPtr /*firstChild*/ #endif ); typedef void (* MoveWindowProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pWin*/, int /*x*/, int /*y*/, X11WindowPtr /*pSib*/, VTKind /*kind*/ #endif ); typedef void (* ResizeWindowProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pWin*/, int /*x*/, int /*y*/, unsigned int /*w*/, unsigned int /*h*/, X11WindowPtr /*pSib*/ #endif ); typedef X11WindowPtr (* GetLayerWindowProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pWin*/ #endif ); typedef void (* HandleExposuresProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pWin*/ #endif ); typedef void (* ReparentWindowProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pWin*/, X11WindowPtr /*pPriorParent*/ #endif ); #ifdef SHAPE typedef void (* SetShapeProcPtr)( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/ #endif ); #endif /* SHAPE */ typedef void (* ChangeBorderWidthProcPtr)( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/, unsigned int /*width*/ #endif ); typedef void (* MarkUnrealizedWindowProcPtr)( #if NeedFunctionPrototypes X11WindowPtr /*pChild*/, X11WindowPtr /*pWin*/, Bool /*fromConfigure*/ #endif ); typedef struct _Screen { int myNum; /* index of this instance in Screens[] */ ATOM id; short width, height; short mmWidth, mmHeight; short numDepths; unsigned char rootDepth; DepthPtr allowedDepths; unsigned long rootVisual; unsigned long defColormap; short minInstalledCmaps, maxInstalledCmaps; char backingStoreSupport, saveUnderSupport; unsigned long whitePixel, blackPixel; unsigned long rgf; /* array of flags; she's -- HUNGARIAN */ GCPtr GCperDepth[MAXFORMATS+1]; /* next field is a stipple to use as default in a GC. we don't build default tiles of all depths because they are likely to be of a color different from the default fg pixel, so we don't win anything by building a standard one. */ PixmapPtr PixmapPerDepth[1]; pointer devPrivate; short numVisuals; VisualPtr visuals; int WindowPrivateLen; unsigned *WindowPrivateSizes; unsigned totalWindowSize; int GCPrivateLen; unsigned *GCPrivateSizes; unsigned totalGCSize; /* Random screen procedures */ CloseScreenProcPtr CloseScreen; QueryBestSizeProcPtr QueryBestSize; SaveScreenProcPtr SaveScreen; GetImageProcPtr GetImage; GetSpansProcPtr GetSpans; PointerNonInterestBoxProcPtr PointerNonInterestBox; SourceValidateProcPtr SourceValidate; /* Window Procedures */ CreateWindowProcPtr CreateWindow; DestroyWindowProcPtr DestroyWindow; PositionWindowProcPtr PositionWindow; ChangeWindowAttributesProcPtr ChangeWindowAttributes; RealizeWindowProcPtr RealizeWindow; UnrealizeWindowProcPtr UnrealizeWindow; ValidateTreeProcPtr ValidateTree; PostValidateTreeProcPtr PostValidateTree; WindowExposuresProcPtr WindowExposures; PaintWindowBackgroundProcPtr PaintWindowBackground; PaintWindowBorderProcPtr PaintWindowBorder; CopyWindowProcPtr CopyWindow; ClearToBackgroundProcPtr ClearToBackground; ClipNotifyProcPtr ClipNotify; /* Pixmap procedures */ CreatePixmapProcPtr CreatePixmap; DestroyPixmapProcPtr DestroyPixmap; /* Backing store procedures */ SaveDoomedAreasProcPtr SaveDoomedAreas; RestoreAreasProcPtr RestoreAreas; ExposeCopyProcPtr ExposeCopy; TranslateBackingStoreProcPtr TranslateBackingStore; ClearBackingStoreProcPtr ClearBackingStore; DrawGuaranteeProcPtr DrawGuarantee; /* Font procedures */ RealizeFontProcPtr RealizeFont; UnrealizeFontProcPtr UnrealizeFont; /* Cursor Procedures */ ConstrainCursorProcPtr ConstrainCursor; CursorLimitsProcPtr CursorLimits; DisplayCursorProcPtr DisplayCursor; RealizeCursorProcPtr RealizeCursor; UnrealizeCursorProcPtr UnrealizeCursor; RecolorCursorProcPtr RecolorCursor; SetCursorPositionProcPtr SetCursorPosition; /* GC procedures */ CreateGCProcPtr CreateGC; /* Colormap procedures */ CreateColormapProcPtr CreateColormap; DestroyColormapProcPtr DestroyColormap; InstallColormapProcPtr InstallColormap; UninstallColormapProcPtr UninstallColormap; ListInstalledColormapsProcPtr ListInstalledColormaps; StoreColorsProcPtr StoreColors; ResolveColorProcPtr ResolveColor; /* Region procedures */ RegionCreateProcPtr RegionCreate; RegionInitProcPtr RegionInit; RegionCopyProcPtr RegionCopy; RegionDestroyProcPtr RegionDestroy; RegionUninitProcPtr RegionUninit; IntersectProcPtr Intersect; UnionProcPtr Union; SubtractProcPtr Subtract; InverseProcPtr Inverse; RegionResetProcPtr RegionReset; TranslateRegionProcPtr TranslateRegion; RectInProcPtr RectIn; PointInRegionProcPtr PointInRegion; RegionNotEmptyProcPtr RegionNotEmpty; RegionEmptyProcPtr RegionEmpty; RegionExtentsProcPtr RegionExtents; RegionAppendProcPtr RegionAppend; RegionValidateProcPtr RegionValidate; BitmapToRegionProcPtr BitmapToRegion; RectsToRegionProcPtr RectsToRegion; SendGraphicsExposeProcPtr SendGraphicsExpose; /* os layer procedures */ ScreenBlockHandlerProcPtr BlockHandler; ScreenWakeupHandlerProcPtr WakeupHandler; pointer blockData; pointer wakeupData; /* anybody can get a piece of this array */ DevUnion *devPrivates; CreateScreenResourcesProcPtr CreateScreenResources; ModifyPixmapHeaderProcPtr ModifyPixmapHeader; PixmapPtr pScratchPixmap; /* scratch pixmap "pool" */ #ifdef PIXPRIV int PixmapPrivateLen; unsigned *PixmapPrivateSizes; unsigned totalPixmapSize; #endif MarkWindowProcPtr MarkWindow; MarkOverlappedWindowsProcPtr MarkOverlappedWindows; ChangeSaveUnderProcPtr ChangeSaveUnder; PostChangeSaveUnderProcPtr PostChangeSaveUnder; MoveWindowProcPtr MoveWindow; ResizeWindowProcPtr ResizeWindow; GetLayerWindowProcPtr GetLayerWindow; HandleExposuresProcPtr HandleExposures; ReparentWindowProcPtr ReparentWindow; #ifdef SHAPE SetShapeProcPtr SetShape; #endif /* SHAPE */ ChangeBorderWidthProcPtr ChangeBorderWidth; MarkUnrealizedWindowProcPtr MarkUnrealizedWindow; } ScreenRec; typedef struct _ScreenInfo { int imageByteOrder; int bitmapScanlineUnit; int bitmapScanlinePad; int bitmapBitOrder; int numPixmapFormats; PixmapFormatRec formats[MAXFORMATS]; int arraySize; int numScreens; ScreenPtr screens[MAXSCREENS]; int numVideoScreens; } ScreenInfo; extern ScreenInfo screenInfo; extern void InitOutput( #if NeedFunctionPrototypes ScreenInfo * /*pScreenInfo*/, int /*argc*/, char ** /*argv*/ #endif ); #endif /* SCREENINTSTRUCT_H */ ================================================ FILE: OSXvnc-server/include/Xserver/validate.h ================================================ /* $XConsortium: validate.h,v 5.4 94/04/17 20:26:11 dpw Exp $ */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #ifndef VALIDATE_H #define VALIDATE_H #include "miscstruct.h" #include "regionstr.h" typedef enum { VTOther, VTStack, VTMove, VTUnmap, VTMap } VTKind; /* union _Validate is now device dependent; see mivalidate.h for an example */ typedef union _Validate *ValidatePtr; #define UnmapValData ((ValidatePtr)1) #endif /* VALIDATE_H */ ================================================ FILE: OSXvnc-server/include/Xserver/window.h ================================================ /* $XConsortium: window.h /main/8 1996/03/21 13:35:33 mor $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef WINDOW_H #define WINDOW_H #include "misc.h" #include "region.h" #include "screenint.h" #include "X11/Xproto.h" #define TOTALLY_OBSCURED 0 #define UNOBSCURED 1 #define OBSCURED 2 #define VisibilityNotViewable 3 /* return values for tree-walking callback procedures */ #define WT_STOPWALKING 0 #define WT_WALKCHILDREN 1 #define WT_DONTWALKCHILDREN 2 #define WT_NOMATCH 3 #define NullWindow ((X11WindowPtr) 0) typedef struct _BackingStore *BackingStorePtr; typedef struct _Window *X11WindowPtr; /* conflict with CoreGraphics */ typedef int (*VisitWindowProcPtr)( #if NeedNestedPrototypes X11WindowPtr /*pWin*/, pointer /*data*/ #endif ); extern int TraverseTree( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/, VisitWindowProcPtr /*func*/, pointer /*data*/ #endif ); extern int WalkTree( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, VisitWindowProcPtr /*func*/, pointer /*data*/ #endif ); extern X11WindowPtr AllocateWindow( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/ #endif ); extern Bool CreateRootWindow( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/ #endif ); extern void InitRootWindow( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/ #endif ); extern void ClippedRegionFromBox( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/, RegionPtr /*Rgn*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/ #endif ); extern X11WindowPtr RealChildHead( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/ #endif ); extern X11WindowPtr CreateWindow( #if NeedFunctionPrototypes Window /*wid*/, X11WindowPtr /*pParent*/, int /*x*/, int /*y*/, unsigned int /*w*/, unsigned int /*h*/, unsigned int /*bw*/, unsigned int /*class*/, Mask /*vmask*/, XID* /*vlist*/, int /*depth*/, ClientPtr /*client*/, VisualID /*visual*/, int* /*error*/ #endif ); extern int DeleteWindow( #if NeedFunctionPrototypes pointer /*pWin*/, XID /*wid*/ #endif ); extern void DestroySubwindows( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/, ClientPtr /*client*/ #endif ); extern int X11ChangeWindowAttributes( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/, Mask /*vmask*/, XID* /*vlist*/, ClientPtr /*client*/ #endif ); extern void X11GetWindowAttributes( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/, ClientPtr /*client*/, xGetWindowAttributesReply* /* wa */ #endif ); extern RegionPtr CreateUnclippedWinSize( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/ #endif ); extern void GravityTranslate( #if NeedFunctionPrototypes int /*x*/, int /*y*/, int /*oldx*/, int /*oldy*/, int /*dw*/, int /*dh*/, unsigned /*gravity*/, int* /*destx*/, int* /*desty*/ #endif ); extern int ConfigureWindow( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/, Mask /*mask*/, XID* /*vlist*/, ClientPtr /*client*/ #endif ); extern int CirculateWindow( #if NeedFunctionPrototypes X11WindowPtr /*pParent*/, int /*direction*/, ClientPtr /*client*/ #endif ); extern int ReparentWindow( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/, X11WindowPtr /*pParent*/, int /*x*/, int /*y*/, ClientPtr /*client*/ #endif ); extern int MapWindow( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/, ClientPtr /*client*/ #endif ); extern void MapSubwindows( #if NeedFunctionPrototypes X11WindowPtr /*pParent*/, ClientPtr /*client*/ #endif ); extern int UnmapWindow( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/, Bool /*fromConfigure*/ #endif ); extern void UnmapSubwindows( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/ #endif ); extern void HandleSaveSet( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); extern Bool VisibleBoundingBoxFromPoint( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/, int /*x*/, int /*y*/, BoxPtr /*box*/ #endif ); extern Bool PointInWindowIsVisible( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/, int /*x*/, int /*y*/ #endif ); extern RegionPtr NotClippedByChildren( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/ #endif ); extern void SendVisibilityNotify( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/ #endif ); extern void SaveScreens( #if NeedFunctionPrototypes int /*on*/, int /*mode*/ #endif ); extern X11WindowPtr FindWindowWithOptional( #if NeedFunctionPrototypes X11WindowPtr /*w*/ #endif ); extern void CheckWindowOptionalNeed( #if NeedFunctionPrototypes X11WindowPtr /*w*/ #endif ); extern Bool MakeWindowOptional( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/ #endif ); extern void DisposeWindowOptional( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/ #endif ); extern X11WindowPtr MoveWindowInStack( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/, X11WindowPtr /*pNextSib*/ #endif ); void SetWinSize( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/ #endif ); void SetBorderSize( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/ #endif ); void ResizeChildrenWinSize( #if NeedFunctionPrototypes X11WindowPtr /*pWin*/, int /*dx*/, int /*dy*/, int /*dw*/, int /*dh*/ #endif ); #endif /* WINDOW_H */ ================================================ FILE: OSXvnc-server/kbdptr.c ================================================ /* * kbdptr.c - deal with keyboard and pointer device over TCP & UDP. * * */ /* * OSXvnc Copyright (C) 2001 Dan McGuirk * Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge. * All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #import #import #import #import #import "VNCServer.h" #import #import "rfb.h" #import "kbdptr.h" void KbdAddEvent(Bool down, KeySym keySym, rfbClientPtr cl) { [[VNCServer sharedServer] handleKeyboard:(Bool) down forSym: (KeySym) keySym forClient: (rfbClientPtr) cl]; } void keyboardReleaseKeysForClient(rfbClientPtr cl) { [[VNCServer sharedServer] releaseModifiersForClient: (rfbClientPtr) cl]; } void PtrAddEvent(int buttonMask, int x, int y, rfbClientPtr cl) { [[VNCServer sharedServer] handleMouseButtons:buttonMask atPoint:NSMakePoint(x, y) forClient: (rfbClientPtr) cl]; } ================================================ FILE: OSXvnc-server/kbdptr.h ================================================ // This list has an entry for the X keySym followed by the corresponding // Mac US Keyboard's KeyCode // Would prefer to Get this from the official file/state // but it isn't quite that simple. #define keyTableSize 0xFFFF static int USKeyCodes[] = { /* The alphabet */ XK_A, 0, /* A */ XK_B, 11, /* B */ XK_C, 8, /* C */ XK_D, 2, /* D */ XK_E, 14, /* E */ XK_F, 3, /* F */ XK_G, 5, /* G */ XK_H, 4, /* H */ XK_I, 34, /* I */ XK_J, 38, /* J */ XK_K, 40, /* K */ XK_L, 37, /* L */ XK_M, 46, /* M */ XK_N, 45, /* N */ XK_O, 31, /* O */ XK_P, 35, /* P */ XK_Q, 12, /* Q */ XK_R, 15, /* R */ XK_S, 1, /* S */ XK_T, 17, /* T */ XK_U, 32, /* U */ XK_V, 9, /* V */ XK_W, 13, /* W */ XK_X, 7, /* X */ XK_Y, 16, /* Y */ XK_Z, 6, /* Z */ XK_a, 0, /* a */ XK_b, 11, /* b */ XK_c, 8, /* c */ XK_d, 2, /* d */ XK_e, 14, /* e */ XK_f, 3, /* f */ XK_g, 5, /* g */ XK_h, 4, /* h */ XK_i, 34, /* i */ XK_j, 38, /* j */ XK_k, 40, /* k */ XK_l, 37, /* l */ XK_m, 46, /* m */ XK_n, 45, /* n */ XK_o, 31, /* o */ XK_p, 35, /* p */ XK_q, 12, /* q */ XK_r, 15, /* r */ XK_s, 1, /* s */ XK_t, 17, /* t */ XK_u, 32, /* u */ XK_v, 9, /* v */ XK_w, 13, /* w */ XK_x, 7, /* x */ XK_y, 16, /* y */ XK_z, 6, /* z */ /* Numbers */ XK_0, 29, /* 0 */ XK_1, 18, /* 1 */ XK_2, 19, /* 2 */ XK_3, 20, /* 3 */ XK_4, 21, /* 4 */ XK_5, 23, /* 5 */ XK_6, 22, /* 6 */ XK_7, 26, /* 7 */ XK_8, 28, /* 8 */ XK_9, 25, /* 9 */ /* Symbols */ XK_exclam, 18, /* ! */ XK_at, 19, /* @ */ XK_numbersign, 20, /* # */ XK_dollar, 21, /* $ */ XK_percent, 23, /* % */ XK_asciicircum, 22, /* ^ */ XK_ampersand, 26, /* & */ XK_asterisk, 28, /* * */ XK_parenleft, 25, /* ( */ XK_parenright, 29, /* ) */ XK_minus, 27, /* - */ XK_underscore, 27, /* _ */ XK_equal, 24, /* = */ XK_plus, 24, /* + */ XK_grave, 50, /* ` */ /* XXX ? */ XK_asciitilde, 50, /* ~ */ XK_bracketleft, 33, /* [ */ XK_braceleft, 33, /* { */ XK_bracketright, 30, /* ] */ XK_braceright, 30, /* } */ XK_semicolon, 41, /* ; */ XK_colon, 41, /* : */ XK_apostrophe, 39, /* ' */ XK_quotedbl, 39, /* " */ XK_comma, 43, /* , */ XK_less, 43, /* < */ XK_period, 47, /* . */ XK_greater, 47, /* > */ XK_slash, 44, /* / */ XK_question, 44, /* ? */ XK_backslash, 42, /* \ */ XK_bar, 42, /* | */ // OS X Sends this (END OF MEDIUM) for Shift-Tab (with US Keyboard) 0x0019, 48, /* Tab */ XK_space, 49, /* Space */ }; static int SpecialKeyCodes[] = { /* "Special" keys */ XK_Return, 36, /* Return */ XK_Delete, 117, /* Delete */ XK_Tab, 48, /* Tab */ XK_Escape, 53, /* Esc */ XK_Caps_Lock, 57, /* Caps Lock */ XK_Num_Lock, 71, /* Num Lock */ XK_Scroll_Lock, 107, /* Scroll Lock */ XK_Pause, 113, /* Pause */ XK_BackSpace, 51, /* Backspace */ XK_Insert, 114, /* Insert */ /* Cursor movement */ XK_Up, 126, /* Cursor Up */ XK_Down, 125, /* Cursor Down */ XK_Left, 123, /* Cursor Left */ XK_Right, 124, /* Cursor Right */ XK_Page_Up, 116, /* Page Up */ XK_Page_Down, 121, /* Page Down */ XK_Home, 115, /* Home */ XK_End, 119, /* End */ /* Numeric keypad */ XK_KP_0, 82, /* KP 0 */ XK_KP_1, 83, /* KP 1 */ XK_KP_2, 84, /* KP 2 */ XK_KP_3, 85, /* KP 3 */ XK_KP_4, 86, /* KP 4 */ XK_KP_5, 87, /* KP 5 */ XK_KP_6, 88, /* KP 6 */ XK_KP_7, 89, /* KP 7 */ XK_KP_8, 91, /* KP 8 */ XK_KP_9, 92, /* KP 9 */ XK_KP_Enter, 76, /* KP Enter */ XK_KP_Decimal, 65, /* KP . */ XK_KP_Add, 69, /* KP + */ XK_KP_Subtract, 78, /* KP - */ XK_KP_Multiply, 67, /* KP * */ XK_KP_Divide, 75, /* KP / */ XK_KP_Equal, 81, /* KP = */ /* Function keys */ XK_F1, 122, /* F1 */ XK_F2, 120, /* F2 */ XK_F3, 99, /* F3 */ XK_F4, 118, /* F4 */ XK_F5, 96, /* F5 */ XK_F6, 97, /* F6 */ XK_F7, 98, /* F7 */ XK_F8, 100, /* F8 */ XK_F9, 101, /* F9 */ XK_F10, 109, /* F10 */ XK_F11, 103, /* F11 */ XK_F12, 111, /* F12 */ XK_F13, 105, /* F12 */ XK_F14, 107, /* F12 */ XK_F15, 113, /* F12 */ XK_F16, 106, /* F12 */ XK_F17, 64, /* F12 */ XK_F18, 79, /* F12 */ XK_F19, 80, /* F12 */ XK_F20, 90, /* F12 */ /* Modifier keys */ XK_Alt_L, 55, /* Alt Left (-> Command) */ XK_Alt_R, 55, /* Alt Right (-> Command) */ XK_Shift_L, 56, /* Shift Left */ XK_Shift_R, 56, /* Shift Right */ XK_Meta_L, 58, /* Option Left (-> Option) */ XK_Meta_R, 58, /* Option Right (-> Option) */ XK_Super_L, 58, /* Option Left (-> Option) */ XK_Super_R, 58, /* Option Right (-> Option) */ XK_Control_L, 59, /* Ctrl Left */ XK_Control_R, 59, /* Ctrl Right */ }; ================================================ FILE: OSXvnc-server/libvncauth/Makefile ================================================ # Dummy Makefile for OSXvnc-server .PHONY: all clean all: @echo Nothing to be done clean: @echo Nothing to be done ================================================ FILE: OSXvnc-server/main.c ================================================ /* * OSXvnc Copyright (C) 2002-2004 Redstone Software osxvnc@redstonesoftware.com * Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge. * All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "rfb.h" #include "rfbserver.h" #import "VNCServer.h" static ScreenRec hackScreen; rfbScreenInfo rfbScreen; unsigned rfbProtocolMajorVersion = 3; unsigned rfbProtocolMinorVersion = 8; char desktopName[256]; BOOL keepRunning = TRUE; BOOL littleEndian = FALSE; unsigned rfbPort = 0; //5900; int rfbMaxBitDepth = 0; Bool rfbAlwaysShared = FALSE; Bool rfbNeverShared = FALSE; Bool rfbDontDisconnect = FALSE; Bool rfbLocalhostOnly = FALSE; Bool rfbInhibitEvents = FALSE; Bool rfbReverseMods = FALSE; Bool rfbSwapButtons = TRUE; Bool rfbDisableRemote = FALSE; Bool rfbDisableRichClipboards = FALSE; Bool rfbRemapShortcuts = FALSE; BOOL rfbShouldSendUpdates = TRUE; BOOL registered = FALSE; BOOL restartOnUserSwitch = FALSE; BOOL useIP4 = TRUE; BOOL unregisterWhenNoConnections = FALSE; BOOL nonBlocking = FALSE; BOOL logEnable = TRUE; static BOOL didSupplyPass; static CGFloat displayScale; // OSXvnc 0.8 This flag will use a local buffer which will allow us to display the mouse cursor // Bool rfbLocalBuffer = FALSE; static pthread_mutex_t logMutex; pthread_mutex_t listenerAccepting; pthread_cond_t listenerGotNewClient; pthread_t listener_thread; /* OSXvnc 0.8 for screensaver .... */ // setup screen saver disabling timer // Not sure we want or need this... static EventLoopTimerUPP screensaverTimerUPP; static EventLoopTimerRef screensaverTimer; Bool rfbDisableScreenSaver = FALSE; // Display ID of main display static CGDirectDisplayID displayID; // Deprecated in 10.6 but required since the new api doesn't work for off-screen sessions size_t CGDisplayBytesPerRow ( CGDirectDisplayID display ); void * CGDisplayBaseAddress ( CGDirectDisplayID display ); extern void rfbScreensaverTimer(EventLoopTimerRef timer, void *userData); int rfbDeferUpdateTime = 40; /* in ms */ static char reverseHost[256] = ""; static int reversePort = 5500; CGDisplayErr displayErr; // Server Data rfbserver thisServer; VNCServer *vncServerObject = nil; static bool rfbScreenInit(void); /* * rfbLog prints a time-stamped message to the log file (stderr). */ void rfbLog(char *format, ...) { if (logEnable && format != NULL) { va_list args; NSString *nsFormat = [[NSString alloc] initWithUTF8String:format]; pthread_mutex_lock(&logMutex); NS_DURING { va_start(args, format); NSLogv(nsFormat, args); va_end(args); }; NS_HANDLER NS_ENDHANDLER pthread_mutex_unlock(&logMutex); [nsFormat release]; } } void rfbDebugLog(char *format, ...) { #ifdef __DEBUGGING__ va_list args; NSString *nsFormat = [[NSString alloc] initWithUTF8String:format]; pthread_mutex_lock(&logMutex); va_start(args, format); NSLogv(nsFormat, args); va_end(args); [nsFormat release]; pthread_mutex_unlock(&logMutex); #endif } void rfbLogPerror(char *str) { rfbLog("%s: %s", str, strerror(errno)); } // Some calls fail under older OS X'es so we will do some detected loading void loadDynamicBundles(BOOL startup) { NSAutoreleasePool *startPool = [[NSAutoreleasePool alloc] init]; // Setup thisServer structure thisServer.vncServer = vncServerObject; thisServer.desktopName = desktopName; thisServer.rfbPort = rfbPort; thisServer.rfbLocalhostOnly = rfbLocalhostOnly; thisServer.listenerAccepting = listenerAccepting; thisServer.listenerGotNewClient = listenerGotNewClient; [[VNCServer sharedServer] rfbStartup: &thisServer]; [startPool release]; } void refreshCallback(CGRectCount count, const CGRect *rectArray, void *ignore) { BoxRec box; RegionRec region; rfbClientIteratorPtr iterator; rfbClientPtr cl; int i; for (i = 0; i < count; i++) { box.x1 = rectArray[i].origin.x; box.y1 = rectArray[i].origin.y; box.x2 = box.x1 + rectArray[i].size.width; box.y2 = box.y1 + rectArray[i].size.height; SAFE_REGION_INIT(&hackScreen, ®ion, &box, 0); iterator = rfbGetClientIterator(); while ((cl = rfbClientIteratorNext(iterator)) != NULL) { pthread_mutex_lock(&cl->updateMutex); REGION_UNION(&hackScreen,&cl->modifiedRegion,&cl->modifiedRegion,®ion); pthread_mutex_unlock(&cl->updateMutex); pthread_cond_signal(&cl->updateCond); } rfbReleaseClientIterator(iterator); REGION_UNINIT(&hackScreen, ®ion); } } //CGError screenUpdateMoveCallback(CGScreenUpdateMoveDelta delta, CGRectCount count, const CGRect * rectArray, void * userParameter) { // //NSLog(@"Moved Callback"); // return 0; //} static int bitsPerPixelForDisplay(CGDirectDisplayID dispID) { int bitsPerPixel = 0; CGDisplayModeRef mode = CGDisplayCopyDisplayMode(dispID); CFStringRef pixelEncoding = CGDisplayModeCopyPixelEncoding(mode); if (!pixelEncoding) { // When off-screen the BPP is not accessible -- 32 is default and works. bitsPerPixel = 32; } else if (CFStringCompare(pixelEncoding, CFSTR(IO32BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) { bitsPerPixel = 32; } else if (CFStringCompare(pixelEncoding, CFSTR(IO16BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) { bitsPerPixel = 16; } else if (CFStringCompare(pixelEncoding, CFSTR(IO8BitIndexedPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) { bitsPerPixel = 8; } [(id)pixelEncoding release]; CGDisplayModeRelease(mode); return bitsPerPixel; } static CGFloat scalingFactor(void) { CGFloat scale = 1.0; NSScreen *myScreen = [NSScreen mainScreen]; if ([myScreen respondsToSelector:@selector(backingScaleFactor)]) { scale = myScreen.backingScaleFactor; } return scale; } static void rfbCheckForScreenResolutionChange(void) { BOOL sizeChange = (rfbScreen.width != CGDisplayPixelsWide(displayID) || rfbScreen.height != CGDisplayPixelsHigh(displayID)); BOOL colorChange = (bitsPerPixelForDisplay(displayID) > 0 && rfbScreen.bitsPerPixel != bitsPerPixelForDisplay(displayID)); // See if screen changed if (sizeChange || colorChange) { rfbClientIteratorPtr iterator; rfbClientPtr cl = NULL; BOOL screenOK = TRUE; int maxTries = 12; // Block listener from accepting new connections while we restart pthread_mutex_lock(&listenerAccepting); iterator = rfbGetClientIterator(); // Disconnect Existing Clients while ((cl = rfbClientIteratorNext(iterator))) { pthread_mutex_lock(&cl->updateMutex); // Keep locked until after screen change } rfbReleaseClientIterator(iterator); do { screenOK = rfbScreenInit(); } while (!screenOK && maxTries-- && usleep(2000000)==0); if (!screenOK) exit(1); rfbLog("Screen geometry changed - (%d,%d) depth: %d", CGDisplayPixelsWide(displayID), CGDisplayPixelsHigh(displayID), bitsPerPixelForDisplay(displayID)); iterator = rfbGetClientIterator(); while ((cl = rfbClientIteratorNext(iterator))) { // Only need to notify them on a SIZE change - other changes just make us re-init if (sizeChange) { if (cl->desktopSizeUpdate) { BoxRec box; rfbFramebufferUpdateMsg *fu = (rfbFramebufferUpdateMsg *)cl->updateBuf; fu->type = rfbFramebufferUpdate; fu->nRects = Swap16IfLE(1); cl->ublen = sz_rfbFramebufferUpdateMsg; rfbSendScreenUpdateEncoding(cl); cl->screenBuffer = rfbGetFramebuffer(); if (cl->scalingFactor == 1) { cl->scalingFrameBuffer = cl->screenBuffer; cl->scalingPaddedWidthInBytes = rfbScreen.paddedWidthInBytes; } else { const unsigned long csh = (rfbScreen.height+cl->scalingFactor-1)/ cl->scalingFactor; const unsigned long csw = (rfbScreen.width +cl->scalingFactor-1)/ cl->scalingFactor; // Reset Frame Buffer free(cl->scalingFrameBuffer); cl->scalingFrameBuffer = malloc( csw*csh*rfbScreen.bitsPerPixel/8 ); cl->scalingPaddedWidthInBytes = csw * rfbScreen.bitsPerPixel/8; } box.x1 = box.y1 = 0; box.x2 = rfbScreen.width; box.y2 = rfbScreen.height; REGION_INIT(pScreen,&cl->modifiedRegion,&box,0); //cl->needNewScreenSize = TRUE; } else rfbCloseClient(cl); } else { // In theory we shouldn't need to disconnect them but some state in the cl record seems to cause a problem rfbCloseClient(cl); rfbSetTranslateFunction(cl); } sleep(2); // We may detect the new depth before OS X has quite finished getting everything ready for it. pthread_mutex_unlock(&cl->updateMutex); pthread_cond_signal(&cl->updateCond); } rfbReleaseClientIterator(iterator); // Accept new connections again pthread_mutex_unlock(&listenerAccepting); } } static void *clientOutput(void *data) { rfbClientPtr cl = (rfbClientPtr)data; RegionRec updateRegion; Bool haveUpdate = false; while (1) { haveUpdate = false; pthread_mutex_lock(&cl->updateMutex); while (!haveUpdate) { if (cl->sock == -1) { /* Client has disconnected. */ pthread_mutex_unlock(&cl->updateMutex); return NULL; } // Check for (and send immediately) pending PB changes rfbClientUpdatePasteboard(cl); // Only do checks if we HAVE an outstanding request if (REGION_NOTEMPTY(&hackScreen, &cl->requestedRegion)) { /* REDSTONE */ if (rfbDeferUpdateTime > 0 && !cl->immediateUpdate) { // Compare Request with Update Area REGION_INIT(&hackScreen, &updateRegion, NullBox, 0); REGION_INTERSECT(&hackScreen, &updateRegion, &cl->modifiedRegion, &cl->requestedRegion); haveUpdate = REGION_NOTEMPTY(&hackScreen, &updateRegion); REGION_UNINIT(&hackScreen, &updateRegion); } else { /* If we've turned off deferred updating We are going to send an update as soon as we have a requested, regardless of if we have a "change" intersection */ haveUpdate = TRUE; } if (rfbShouldSendNewCursor(cl)) haveUpdate = TRUE; else if (rfbShouldSendNewPosition(cl)) // Could Compare with the request area but for now just always send it haveUpdate = TRUE; else if (cl->needNewScreenSize) haveUpdate = TRUE; } if (!haveUpdate) pthread_cond_wait(&cl->updateCond, &cl->updateMutex); } // OK, now, to save bandwidth, wait a little while for more updates to come along. /* REDSTONE - Lets send it right away if no rfbDeferUpdateTime */ if (rfbDeferUpdateTime > 0 && !cl->immediateUpdate && !cl->needNewScreenSize) { pthread_mutex_unlock(&cl->updateMutex); usleep(rfbDeferUpdateTime * 1000); pthread_mutex_lock(&cl->updateMutex); } /* Now, get the region we're going to update, and remove it from cl->modifiedRegion _before_ we send the update. That way, if anything that overlaps the region we're sending is updated, we'll be sure to do another update later. */ REGION_INIT(&hackScreen, &updateRegion, NullBox, 0); REGION_INTERSECT(&hackScreen, &updateRegion, &cl->modifiedRegion, &cl->requestedRegion); REGION_SUBTRACT(&hackScreen, &cl->modifiedRegion, &cl->modifiedRegion, &updateRegion); /* REDSTONE - We also want to clear out the requested region, so we don't process graphic updates in previously requested regions */ REGION_UNINIT(&hackScreen, &cl->requestedRegion); REGION_INIT(&hackScreen, &cl->requestedRegion,NullBox,0); /* This does happen but it's asynchronous (and slow to occur) what we really want to happen is to just temporarily hide the cursor (while sending to the remote screen) -- It's not even usually there (as it's handled by the display driver - but under certain occasions it does appear displayErr = CGDisplayHideCursor(displayID); if (displayErr != 0) rfbLog("Error Hiding Cursor %d", displayErr); CGDisplayMoveCursorToPoint(displayID, CGPointZero); */ /* Now actually send the update. */ rfbSendFramebufferUpdate(cl, updateRegion); /* If we were hiding it before make it reappear now displayErr = CGDisplayShowCursor(displayID); if (displayErr != 0) rfbLog("Error Showing Cursor %d", displayErr); */ REGION_UNINIT(&hackScreen, &updateRegion); pthread_mutex_unlock(&cl->updateMutex); } return NULL; } void *clientInput(void *data) { rfbClientPtr cl = (rfbClientPtr)data; pthread_t output_thread; pthread_create(&output_thread, NULL, clientOutput, cl); while (1) { [[VNCServer sharedServer] rfbReceivedClientMessage]; rfbProcessClientMessage(cl); // Some people will connect but not request screen updates - just send events, this will delay registering the CG callback until then if (rfbShouldSendUpdates && REGION_NOTEMPTY(&hackScreen, &cl->requestedRegion)) { @synchronized([VNCServer sharedServer]) { // Registering twice sometimes prevents getting notice on 10.6 if (!registered) { CGError result = CGRegisterScreenRefreshCallback(refreshCallback, NULL); if (result == kCGErrorSuccess) { rfbLog("Client connected - registering screen update notification"); [[VNCServer sharedServer] rfbConnect]; //CGScreenRegisterMoveCallback(screenUpdateMoveCallback, NULL); registered = TRUE; } else { NSLog(@"Error (%d) registering for Screen Update Notification", result); } } } } if (cl->sock == -1) { /* Client has disconnected. */ break; } } /* Get rid of the output thread. */ //pthread_mutex_lock(&cl->updateMutex); pthread_cond_signal(&cl->updateCond); //pthread_mutex_unlock(&cl->updateMutex); pthread_join(output_thread, NULL); rfbClientConnectionGone(cl); return NULL; } void rfbStartClientWithFD(int client_fd) { rfbClientPtr cl; pthread_t client_thread; int one=1; if (!rfbClientsConnected()) rfbCheckForScreenResolutionChange(); pthread_mutex_lock(&listenerAccepting); if (setsockopt(client_fd, IPPROTO_TCP, TCP_NODELAY, (void *)&one, sizeof(one)) < 0) rfbLogPerror("setsockopt TCP_NODELAY failed"); rfbUndim(); cl = rfbNewClient(client_fd); pthread_create(&client_thread, NULL, clientInput, (void *)cl); pthread_mutex_unlock(&listenerAccepting); pthread_cond_signal(&listenerGotNewClient); } static void *listenerRun(void *ignore) { int listen_fd4=0, client_fd=0; int value=1; // Need to pass a ptr to this struct sockaddr_in sin4, peer4; unsigned int len4=sizeof(sin4); // Must register IPv6 first otherwise it seems to clear our unique binding for IPv4 portNum [[VNCServer sharedServer] rfbRunning]; // Ok, we are leaving IPv4 binding on even with IPv6 on so that OSXvnc will bind up the port regardless // When both are enabled you can't have another VNC server "steal" the IPv4 port if (useIP4) { bzero(&sin4, sizeof(sin4)); sin4.sin_len = sizeof(sin4); sin4.sin_family = AF_INET; sin4.sin_port = htons(rfbPort); if (rfbLocalhostOnly) sin4.sin_addr.s_addr = htonl(INADDR_LOOPBACK); else sin4.sin_addr.s_addr = htonl(INADDR_ANY); if ((listen_fd4 = socket(PF_INET, SOCK_STREAM, 0)) < 0) { rfbLogPerror("Unable to open socket"); } else if (nonBlocking && (fcntl(listen_fd4, F_SETFL, O_NONBLOCK) < 0)) { rfbLogPerror("fcntl O_NONBLOCK failed"); } else if (setsockopt(listen_fd4, SOL_SOCKET, SO_REUSEADDR, &value, sizeof(value)) < 0) { rfbLogPerror("setsockopt SO_REUSEADDR failed"); } else if (bind(listen_fd4, (struct sockaddr *) &sin4, len4) < 0) { rfbLog("Failed to bind socket: port %d maybe in use by another VNC", rfbPort); } else if (listen(listen_fd4, 5) < 0) { rfbLogPerror("Listen failed"); } else { rfbLog("Started listener thread on IPv4 port %d", rfbPort); // Thread stays here forever unless something goes wrong while (keepRunning) { client_fd = accept(listen_fd4, (struct sockaddr *) &peer4, &len4); if (client_fd != -1) rfbStartClientWithFD(client_fd); else { if (errno == EWOULDBLOCK) { usleep(100000); } else { rfbLog("Accept failed %d", errno); exit(1); } } } rfbLog("Listener thread exiting"); return NULL; } if (reverseHost[0] != '\0') { rfbLog("Listener disabled"); } else { exit(250); } } return NULL; } void connectReverseClient(char *hostName, int portNum) { pthread_t client_thread; rfbClientPtr cl; pthread_mutex_lock(&listenerAccepting); rfbUndim(); cl = rfbReverseConnection(hostName, portNum); if (cl) { pthread_create(&client_thread, NULL, clientInput, (void *)cl); pthread_mutex_unlock(&listenerAccepting); pthread_cond_signal(&listenerGotNewClient); } else { pthread_mutex_unlock(&listenerAccepting); } } static NSMutableData *frameBufferData; static size_t frameBufferBytesPerRow; static size_t frameBufferBitsPerPixel; char *rfbGetFramebuffer(void) { if (floor(NSAppKitVersionNumber) > floor(NSAppKitVersionNumber10_6)) { if (!frameBufferData) { CGImageRef imageRef; if (displayScale > 1.0) { // Retina display. size_t width = rfbScreen.width; size_t height = rfbScreen.height; CGImageRef image = CGDisplayCreateImage(displayID); CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); CGContextRef context = CGBitmapContextCreate(NULL, width, height, CGImageGetBitsPerComponent(image), CGImageGetBytesPerRow(image), colorspace, kCGImageAlphaNoneSkipLast); CGColorSpaceRelease(colorspace); if (context == NULL) { CGImageRelease(image); rfbLog("There was an error getting screen shot"); return nil; } CGContextDrawImage(context, CGRectMake(0, 0, width, height), image); imageRef = CGBitmapContextCreateImage(context); CGContextRelease(context); CGImageRelease(image); } else { imageRef = CGDisplayCreateImage(displayID); } CGDataProviderRef dataProvider = CGImageGetDataProvider (imageRef); CFDataRef dataRef = CGDataProviderCopyData(dataProvider); frameBufferBytesPerRow = CGImageGetBytesPerRow(imageRef); frameBufferBitsPerPixel = CGImageGetBitsPerPixel(imageRef); frameBufferData = [(NSData *)dataRef mutableCopy]; CFRelease(dataRef); if (imageRef != NULL) CGImageRelease(imageRef); } return frameBufferData.mutableBytes; } else { // Old API is required for off screen user sessions int maxWait = 5000000; int retryWait = 500000; char *returnValue = (char *)CGDisplayBaseAddress(displayID); while (!returnValue && maxWait > 0) { NSLog(@"Unable to obtain base address"); usleep(retryWait); // Buffer goes away while screen is "switching", it'll be back maxWait -= retryWait; returnValue = (char *)CGDisplayBaseAddress(displayID); } if (!returnValue) { NSLog(@"Unable to obtain base address -- Giving up"); exit(1); } return returnValue; } } // Called to get record updates of the requested region into our framebuffer void rfbGetFramebufferUpdateInRect(int x, int y, int w, int h) { if (frameBufferData) { CGRect rect = CGRectMake (x,y,w,h); CGImageRef imageRef; if (displayScale > 1.0) { // Retina display. CGImageRef image = CGDisplayCreateImageForRect(displayID, rect); CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB(); CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst; CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, w * 4,colorspace, bitmapInfo); CGColorSpaceRelease(colorspace); if (context == NULL) { CGImageRelease(image); rfbLog("There was an error getting scaled images"); return; } CGContextDrawImage(context, CGRectMake(0, 0, w, h), image); CGImageRelease(image); imageRef = CGBitmapContextCreateImage(context); CGContextRelease(context); } else { imageRef = CGDisplayCreateImageForRect(displayID, rect); } CGDataProviderRef dataProvider = CGImageGetDataProvider (imageRef); CFDataRef dataRef = CGDataProviderCopyData(dataProvider); size_t imgBytesPerRow = CGImageGetBytesPerRow(imageRef); size_t imgBitsPerPixel = CGImageGetBitsPerPixel(imageRef); if (imgBitsPerPixel != frameBufferBitsPerPixel) NSLog(@"BitsPerPixel MISMATCH: frameBuffer %zu, rect image %zu", frameBufferBitsPerPixel, imgBitsPerPixel); char *dest = (char *)frameBufferData.mutableBytes + frameBufferBytesPerRow * y + x * (frameBufferBitsPerPixel/8); const char *source = ((NSData *)dataRef).bytes; while (h--) { memcpy(dest, source, w*(imgBitsPerPixel/8)); dest += frameBufferBytesPerRow; source += imgBytesPerRow; } if (imageRef != NULL) CGImageRelease(imageRef); [(id)dataRef release]; } } static bool rfbScreenInit(void) { /* Note: As of 10.7 there doesn't appear to be an easy way to get the bitsPerSample or samplesPerPixel of the screen buffer. It looks like that information may be in the bitsPerComponent and componentCount elements of the IOPixelInformation structure. But we'd have to get into poorly-documented IOKit functions to get it. It seems very unlikely that it will be anything other than 8 bits and 3 samples, and in any case we're not really prepared to handle anything else, so the best we could do is die gracefully. Now we are likely to die ungracefully (or maybe just produce garbage) if the screen buffer is in a different format. */ int bitsPerSample = 8; // Let's presume 8 bits x 3 samples and hope for the best..... int samplesPerPixel = 3; [frameBufferData release]; // release previous screen buffer, if any frameBufferData = nil; if (displayID == 0) { // The display was not selected up to now, so choose the main display. displayID = CGMainDisplayID(); } if (samplesPerPixel != 3) { rfbLog("screen format not supported"); return FALSE; } displayScale = scalingFactor(); if (displayScale > 1.0) { // Retina display. rfbLog("Detected HiDPI Display with scaling factor of %f", displayScale); } rfbScreen.width = CGDisplayPixelsWide(displayID); rfbScreen.height = CGDisplayPixelsHigh(displayID); rfbScreen.bitsPerPixel = bitsPerPixelForDisplay(displayID); rfbScreen.depth = samplesPerPixel * bitsPerSample; //Fix for Yosemite and above if (floor(NSAppKitVersionNumber) > floor(NSAppKitVersionNumber10_6)) { CGImageRef imageRef; // Check to see if retina display. if (displayScale > 1.0) { size_t width = rfbScreen.width; size_t height = rfbScreen.height; CGImageRef image = CGDisplayCreateImage(displayID); CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); CGContextRef context = CGBitmapContextCreate(NULL, width, height, CGImageGetBitsPerComponent(image), CGImageGetBytesPerRow(image), colorspace, kCGImageAlphaNoneSkipLast); CGColorSpaceRelease(colorspace); if (context == NULL) { CGImageRelease(image); rfbLog("There was an error getting screen shot"); return nil; } CGContextDrawImage(context, CGRectMake(0, 0, width, height), image); CGImageRelease(image); imageRef = CGBitmapContextCreateImage(context); CGContextRelease(context); } else { imageRef = CGDisplayCreateImage(displayID); } rfbScreen.paddedWidthInBytes = CGImageGetBytesPerRow(imageRef); if (imageRef != NULL) CGImageRelease(imageRef); } else { rfbScreen.paddedWidthInBytes = CGDisplayBytesPerRow(displayID); } rfbServerFormat.bitsPerPixel = rfbScreen.bitsPerPixel; rfbServerFormat.depth = rfbScreen.depth; rfbServerFormat.trueColour = TRUE; rfbServerFormat.redMax = (1 << bitsPerSample) - 1; rfbServerFormat.greenMax = (1 << bitsPerSample) - 1; rfbServerFormat.blueMax = (1 << bitsPerSample) - 1; if (littleEndian) rfbLog("Running in Little Endian"); else rfbLog("Running in Big Endian"); rfbServerFormat.bigEndian = !littleEndian; rfbServerFormat.redShift = bitsPerSample * 2; rfbServerFormat.greenShift = bitsPerSample * 1; rfbServerFormat.blueShift = bitsPerSample * 0; /* We want to use the X11 REGION_* macros without having an actual X11 ScreenPtr, so we do this. Pretty ugly, but at least it lets us avoid hacking up regionstr.h, or changing every call to REGION_* */ hackScreen.RegionCreate = miRegionCreate; hackScreen.RegionInit = miRegionInit; hackScreen.RegionCopy = miRegionCopy; hackScreen.RegionDestroy = miRegionDestroy; hackScreen.RegionUninit = miRegionUninit; hackScreen.Intersect = miIntersect; hackScreen.Union = miUnion; hackScreen.Subtract = miSubtract; hackScreen.Inverse = miInverse; hackScreen.RegionReset = miRegionReset; hackScreen.TranslateRegion = miTranslateRegion; hackScreen.RectIn = miRectIn; hackScreen.PointInRegion = miPointInRegion; hackScreen.RegionNotEmpty = miRegionNotEmpty; hackScreen.RegionEmpty = miRegionEmpty; hackScreen.RegionExtents = miRegionExtents; hackScreen.RegionAppend = miRegionAppend; hackScreen.RegionValidate = miRegionValidate; return TRUE; } static void usage(void) { printf( "\nAvailable options:\n\n" "-rfbport port TCP port for RFB protocol (0=autodetect first open port 5900-5909)\n" "-rfbwait time Maximum time in ms to wait for RFB client\n" "-rfbnoauth Run the server without password protection\n" "-rfbauth passwordFile Use this password file for VNC authentication\n" " (use 'storepasswd' to create a password file)\n" "-rfbpass Supply a password directly to the server\n" "-maxauthattempts num Maximum number of auth tries before disabling access from a host\n" " (default: 5), zero disables\n" "-deferupdate time Time in ms to defer updates (default %d)\n" "-desktop name VNC desktop name (default: host name)\n" "-alwaysshared Always treat new clients as shared\n" "-nevershared Never treat new clients as shared\n" "-dontdisconnect Don't disconnect existing clients when a new non-shared\n" " connection comes in (refuse new connection instead)\n" "-nodimming Never allow the display to dim\n" " (default: display can dim, input undims)\n" "-maxdepth bits Maximum allowed bit depth for connecting clients (32, 16, 8).\n" " (default: bit depth of display)\n" #if 0 "-reversemods reverse the interpretation of control\n" " and command (for windows clients)\n" #endif "-allowsleep Allow machine to sleep\n" " (default: sleep is disabled)\n" "-disableScreenSaver Disable screen saver while users are connected\n" " (default: no, allow screen saver to engage)\n" "-swapButtons Swap mouse buttons 2 & 3\n" " (default: yes)\n" "-dontswapButtons Disable swap mouse buttons 2 & 3\n" " (default: no)\n" "-disableRemoteEvents Ignore remote keyboard, pointer, and clipboard event\n" " (default: no, process them)\n" "-disableRichClipboards Don't share rich clipboard events\n" " (default: no, process them)\n" "-connectHost host Host name or IP of listening client to establish a reverse connect\n" "-connectPort port TCP port of listening client to establish a reverse connect\n" " (default: 5500)\n" "-noupdates Prevent registering for screen updates, for use with x2vnc or win2vnc\n" "-protocol protocol Force a particular RFB protocol version (eg 3.3)\n" " (default: %u.%u)\n" "-bigEndian Force big-endian mode (PPC)\n" " (default: detect)\n" "-littleEndian Force little-endian mode (INTEL)\n" " (default: detect)\n" "-display DisplayID displayID to indicate which display to serve\n", rfbDeferUpdateTime, rfbProtocolMajorVersion, rfbProtocolMinorVersion ); { CGDisplayCount displayCount; CGDirectDisplayID activeDisplays[100]; int index; CGGetActiveDisplayList(100, activeDisplays, &displayCount); for (index = 0; index < displayCount; index++) { printf(" %d = (%zu, %zu)\n", index, CGDisplayPixelsWide(activeDisplays[index]), CGDisplayPixelsHigh(activeDisplays[index])); } } printf( "-localhost Only allow connections from the same machine,\n" " literally localhost (127.0.0.1)\n" " If you use SSH and want to stop non-SSH connections from any other hosts\n" " (default: no, allow remote connections)\n" "-restartonuserswitch flag\n" " For use on Panther 10.3 systems, this will cause the\n" " server to restart when a fast user switch occurs\n" " (default: no)\n" "-disableLog Don't log anything in console\n" ); [[VNCServer sharedServer] rfbUsage]; printf("\n"); exit(255); } static void checkForUsage(int argc, char *argv[]) { int i; for (i = 1; i < argc; i++) { if (strncmp(argv[i], "-h", 2) == 0 || strncmp(argv[i], "-H", 2) == 0 || strncmp(argv[i], "--h", 3) == 0 || strncmp(argv[i], "--H", 3) == 0 || strncmp(argv[i], "-usage", 6) == 0 || strncmp(argv[i], "--usage", 7) == 0 || strcmp(argv[i], "-?") == 0) { loadDynamicBundles(FALSE); usage(); } } } static void processArguments(int argc, char *argv[]) { char argString[1024] = "Arguments:"; int i, j; for (i = 1; i < argc; i++) { strcat(argString, " "); strcat(argString, argv[i]); } rfbLog(argString); for (i = 1; i < argc; i++) { // Lowercase it for (j=0;j= argc) usage(); rfbPort = atoi(argv[++i]); } else if (strcmp(argv[i], "-protocol") == 0) { // -rfbport port double protocol; if (i + 1 >= argc) usage(); protocol = atof(argv[++i]); rfbProtocolMajorVersion = MIN(rfbProtocolMajorVersion, floor(protocol)); protocol = protocol-floor(protocol); // Now just the fractional part // Ok some folks think of it as 3.3 others as 003.003, so let's repeat... while (protocol > 0 && protocol < 1) protocol *= 10; rfbProtocolMinorVersion = MIN(rfbProtocolMinorVersion, rint(protocol)); rfbLog("Forcing: %u.%u", rfbProtocolMajorVersion, rfbProtocolMinorVersion); } else if (strcmp(argv[i], "-rfbwait") == 0) { // -rfbwait ms if (i + 1 >= argc) usage(); rfbMaxClientWait = atoi(argv[++i]); } else if (strcmp(argv[i], "-rfbnoauth") == 0) { allowNoAuth = TRUE; rfbLog("Warning: No Auth specified, running with no password protection"); } else if (strcmp(argv[i], "-rfbauth") == 0) { // -rfbauth passwd-file if (i + 1 >= argc) usage(); rfbAuthPasswdFile = argv[++i]; } else if (strcmp(argv[i], "-rfbpass") == 0) { // -rfbauth passwd-file if (i + 1 >= argc) usage(); if (!enterSuppliedPassword(argv[++i])) { rfbLog("ERROR: The supplied password failed to initialize. Now exiting!!"); exit (255); }else{ didSupplyPass=TRUE; } } else if (strcmp(argv[i], "-maxauthattempts") == 0) { if (i + 1 >= argc) usage(); rfbMaxLoginAttempts = atoi(argv[++i]); } else if (strcmp(argv[i], "-connecthost") == 0) { // -connect host if (i + 1 >= argc) usage(); strncpy(reverseHost, argv[++i], 255); if (reverseHost[0] == '\0') usage(); } else if (strcmp(argv[i], "-connectport") == 0) { // -connect host if (i + 1 >= argc) usage(); reversePort = atoi(argv[++i]); } else if (strcmp(argv[i], "-deferupdate") == 0) { // -deferupdate ms if (i + 1 >= argc) usage(); rfbDeferUpdateTime = atoi(argv[++i]); } else if (strcmp(argv[i], "-maxdepth") == 0) { // -maxdepth if (i + 1 >= argc) usage(); rfbMaxBitDepth = atoi(argv[++i]); switch (rfbMaxBitDepth) { case 24: rfbMaxBitDepth = 32; break; case 32: case 16: case 8: break; default: rfbLog("Invalid maxDepth"); exit(-1); break; } } else if (strcmp(argv[i], "-desktop") == 0) { // -desktop desktop-name if (i + 1 >= argc) usage(); strncpy(desktopName, argv[++i], 255); } else if (strcmp(argv[i], "-display") == 0) { // -display DisplayID CGDisplayCount displayCount; CGDirectDisplayID activeDisplays[100]; CGGetActiveDisplayList(100, activeDisplays, &displayCount); if (i + 1 >= argc || atoi(argv[i+1]) >= displayCount) usage(); displayID = activeDisplays[atoi(argv[++i])]; } else if (strcmp(argv[i], "-alwaysshared") == 0) { rfbAlwaysShared = TRUE; } else if (strcmp(argv[i], "-nevershared") == 0) { rfbNeverShared = TRUE; } else if (strcmp(argv[i], "-dontdisconnect") == 0) { rfbDontDisconnect = TRUE; } else if (strcmp(argv[i], "-nodimming") == 0) { rfbNoDimming = TRUE; } else if (strcmp(argv[i], "-allowsleep") == 0) { rfbNoSleep = FALSE; } else if (strcmp(argv[i], "-reversemods") == 0) { rfbReverseMods = TRUE; } else if (strcmp(argv[i], "-disablescreensaver") == 0) { rfbDisableScreenSaver = TRUE; } else if (strcmp(argv[i], "-swapbuttons") == 0) { rfbSwapButtons = TRUE; } else if (strcmp(argv[i], "-dontswapbuttons") == 0) { rfbSwapButtons = FALSE; } else if (strcmp(argv[i], "-disableremoteevents") == 0) { rfbDisableRemote = TRUE; } else if (strcmp(argv[i], "-disablerichclipboards") == 0) { rfbDisableRichClipboards = TRUE; } else if (strcmp(argv[i], "-localhost") == 0) { rfbLocalhostOnly = TRUE; } else if (strcmp(argv[i], "-inhibitevents") == 0) { rfbInhibitEvents = TRUE; } else if (strcmp(argv[i], "-noupdates") == 0) { rfbShouldSendUpdates = FALSE; } else if (strcmp(argv[i], "-littleendian") == 0) { littleEndian = TRUE; } else if (strcmp(argv[i], "-bigendian") == 0) { littleEndian = FALSE; } else if (strcmp(argv[i], "-ipv6") == 0) { // Ok so the code to enable is in the Bundle, but this disables 4 useIP4 = FALSE; } else if (strcmp(argv[i], "-keepregistration") == 0) { unregisterWhenNoConnections = FALSE; } else if (strcmp(argv[i], "-dontkeepregistration") == 0) { unregisterWhenNoConnections = TRUE; } else if (strcmp(argv[i], "-restartonuserswitch") == 0) { if (i + 1 >= argc) usage(); else { char *argument = argv[++i]; restartOnUserSwitch = (argument[0] == 'y' || argument[0] == 'Y' || argument[0] == 't' || argument[0] == 'T' || atoi(argument)); } } else if (strcmp(argv[i], "-disablelog") == 0) { logEnable = FALSE; } else if (strcmp(argv[i], "-useopengl") == 0) { rfbLog("OpenGL no longer supported"); } } if (!rfbAuthPasswdFile && !allowNoAuth && reverseHost[0] == '\0' && !didSupplyPass) { rfbLog("ERROR: No authentication specified, use -rfbauth passwordfile OR -rfbnoauth"); exit (255); } } void rfbShutdown(void) { [[VNCServer sharedServer] rfbShutdown]; CGUnregisterScreenRefreshCallback(refreshCallback, NULL); //CGDisplayShowCursor(displayID); rfbDimmingShutdown(); rfbDebugLog("Removing Observers"); [[NSWorkspace sharedWorkspace].notificationCenter removeObserver: vncServerObject]; [[NSNotificationCenter defaultCenter] removeObserver:vncServerObject]; [[NSDistributedNotificationCenter defaultCenter] removeObserver:vncServerObject]; if (rfbDisableScreenSaver) { /* remove the screensaver timer */ RemoveEventLoopTimer(screensaverTimer); DisposeEventLoopTimerUPP(screensaverTimerUPP); } if (nonBlocking) { keepRunning = NO; pthread_join(listener_thread,NULL); } rfbDebugLog("RFB shutdown complete"); } static void executeEventLoop (int signal) { pthread_cond_signal(&listenerGotNewClient); } static void rfbShutdownOnSignal(int signal) { rfbLog("OSXvnc-server received signal: %d", signal); rfbShutdown(); if (signal == SIGTERM) exit (0); else exit (signal); } void daemonize( void ) { int i; // Fork New Process if ( fork() != 0 ) exit( 0 ); // Become session leader setsid(); // Ignore signals here signal(SIGHUP, SIG_IGN); signal(SIGPIPE, SIG_IGN); // Shutdown on these signal(SIGTERM, rfbShutdownOnSignal); signal(SIGINT, rfbShutdownOnSignal); signal(SIGQUIT, rfbShutdownOnSignal); // Fork a second new process if ( fork( ) != 0 ) exit( 0 ); // chdir ( "/" ); umask( 0 ); // Close open FDs for ( i = getdtablesize( ) - 1; i > STDERR_FILENO; i-- ) close( i ); /* from this point on we should only send output to server log or syslog */ } static int scanForOpenPort(void) { int tryPort = 5900; int listen_fd4=0; int value=1; struct sockaddr_in sin4; bzero(&sin4, sizeof(sin4)); sin4.sin_len = sizeof(sin4); sin4.sin_family = AF_INET; // if ([[NSUserDefaults standardUserDefaults] boolForKey:@"localhostOnly"]) // sin4.sin_addr.s_addr = htonl(INADDR_LOOPBACK); // else sin4.sin_addr.s_addr = htonl(INADDR_ANY); while (tryPort < 5910) { sin4.sin_port = htons(tryPort); if ((listen_fd4 = socket(PF_INET, SOCK_STREAM, 0)) < 0) { //NSLog(@"Socket init failed %d", tryPort); } else if (fcntl(listen_fd4, F_SETFL, O_NONBLOCK) < 0) { //rfbLogPerror("fcntl O_NONBLOCK failed"); } else if (setsockopt(listen_fd4, SOL_SOCKET, SO_REUSEADDR, &value, sizeof(value)) < 0) { //NSLog(@"setsockopt SO_REUSEADDR failed %d", tryPort); } else if (bind(listen_fd4, (struct sockaddr *) &sin4, sizeof(sin4)) < 0) { //NSLog(@"Failed to bind socket: port %d may be in use by another VNC", tryPort); } else if (listen(listen_fd4, 5) < 0) { //NSLog(@"Listen failed %d", tryPort); } else { close(listen_fd4); return tryPort; } close(listen_fd4); tryPort++; } rfbLog("Unable to find open port 5900-5909"); return 0; } BOOL runningLittleEndian ( void ) { return (CFByteOrderGetCurrent() == CFByteOrderLittleEndian); /* // rosetta is so complete that it obsucres even CFByteOrderGetCurrent int hasMMX = 0; size_t length = sizeof(hasMMX); // No Error and it does have MMX return (!sysctlbyname("hw.optional.mmx", &hasMMX, &length, NULL, 0) && hasMMX); */ } int main(int argc, char *argv[]) { NSAutoreleasePool *tempPool = [[NSAutoreleasePool alloc] init]; vncServerObject = [[VNCServer alloc] init]; littleEndian = runningLittleEndian(); checkForUsage(argc,argv); // The bug with unregistering from user updates may have been fixed in 10.4 Tiger if (floor(NSAppKitVersionNumber) > floor(NSAppKitVersionNumber10_3)) unregisterWhenNoConnections = TRUE; // This guarantees separating us from any terminal - // Right now this causes problems with the keep-alive script and the GUI app (since it causes the process to return right away) // it allows you to survive when launched in SSH, etc but doesn't solves the problem of being killed on GUI logout. // It also doesn't help with any of the pasteboard security issues, those requires secure sessionID's, see: // http://developer.apple.com/documentation/MacOSX/Conceptual/BPMultipleUsers/index.html // // daemonize(); // Let's not shutdown on a SIGHUP at some point perhaps we can use that to reload configuration signal(SIGHUP, SIG_IGN); signal(SIGPIPE, SIG_IGN); signal(SIGCONT, executeEventLoop); signal(SIGTERM, rfbShutdownOnSignal); signal(SIGINT, rfbShutdownOnSignal); signal(SIGQUIT, rfbShutdownOnSignal); pthread_mutex_init(&logMutex, NULL); pthread_mutex_init(&listenerAccepting, NULL); pthread_cond_init(&listenerGotNewClient, NULL); [[NSUserDefaults standardUserDefaults] addSuiteNamed:@"com.redstonesoftware.VineServer"]; processArguments(argc, argv); if (rfbPort == 0) rfbPort = scanForOpenPort(); loadDynamicBundles(TRUE); // If no desktop name is provided try to get it. if (desktopName[0] == '\0') { gethostname(desktopName, 256); } if (!rfbScreenInit()) exit(1); rfbClientListInit(); rfbDimmingInit(); rfbAuthInit(); initPasteboard(); // Register for User Switch Notification // This works on pre-Panther systems since the notification just won't get called. if (restartOnUserSwitch) { [[NSWorkspace sharedWorkspace].notificationCenter addObserver:vncServerObject selector:@selector(userSwitched:) name: NSWorkspaceSessionDidBecomeActiveNotification object:nil]; [[NSWorkspace sharedWorkspace].notificationCenter addObserver:vncServerObject selector:@selector(userSwitched:) name: NSWorkspaceSessionDidResignActiveNotification object:nil]; } { // Setup Notifications so other Bundles can post user connect [[NSNotificationCenter defaultCenter] addObserver:vncServerObject selector:@selector(clientConnected:) name:@"NewRFBClient" object:nil]; // Setup Notifications so we can add listening hosts [[NSDistributedNotificationCenter defaultCenter] addObserver:vncServerObject selector:@selector(connectHost:) name:@"VNCConnectHost" object:[NSString stringWithFormat:@"OSXvnc%d", rfbPort]]; } // Does this need to be in 10.1 and greater (does any of this stuff work in 10.0?) if (!rfbInhibitEvents) { //NSLog(@"Core Graphics - Event Suppression Turned Off"); // This seems to actually sometimes inhibit REMOTE events as well, but all the same let's let everything pass through for now // CGSetLocalEventsFilterDuringSupressionState(kCGEventFilterMaskPermitAllEvents, kCGEventSupressionStateSupressionInterval); // CGSetLocalEventsFilterDuringSupressionState(kCGEventFilterMaskPermitAllEvents, kCGEventSupressionStateRemoteMouseDrag); } // Better to handle this at the event level, see kbdptr.c //CGEnableEventStateCombining(FALSE); if (rfbDisableScreenSaver) { /* setup screen saver disabling timer */ screensaverTimerUPP = NewEventLoopTimerUPP(rfbScreensaverTimer); InstallEventLoopTimer(GetMainEventLoop(), kEventDurationSecond * 30, kEventDurationSecond * 30, screensaverTimerUPP, NULL, &screensaverTimer); } nonBlocking = [[NSUserDefaults standardUserDefaults] boolForKey:@"NonBlocking"]; pthread_create(&listener_thread, NULL, listenerRun, NULL); if (reverseHost[0] != '\0') connectReverseClient(reverseHost, reversePort); // This segment is what is responsible for causing the server to shutdown when a user logs out // The problem being that OS X sends it first a SIGTERM and then a SIGKILL (un-trappable) // Presumable because it's running a Carbon Event loop if (1) { OSStatus resultCode = 0; while (keepRunning) { // No Clients - go into hibernation if (!rfbClientsConnected()) { pthread_mutex_lock(&listenerAccepting); // You would think that there is no point in getting screen updates with no clients connected // But it seems that unregistering but keeping the process (or event loop) around can cause a stuttering behavior in OS X. if (registered && unregisterWhenNoConnections) { rfbLog("UnRegistering screen update notification - waiting for clients"); CGUnregisterScreenRefreshCallback(refreshCallback, NULL); [[VNCServer sharedServer] rfbDisconnect]; registered = NO; } else rfbLog("Waiting for clients"); pthread_cond_wait(&listenerGotNewClient, &listenerAccepting); pthread_mutex_unlock(&listenerAccepting); } [[VNCServer sharedServer] rfbPoll]; rfbCheckForPasteboardChange(); rfbCheckForCursorChange(); rfbCheckForScreenResolutionChange(); // Run The Event loop a moment to see if we have a screen update or NSNotification // No better luck with RunApplicationEventLoop() avoiding the shutdown on logout problem resultCode = RunCurrentEventLoop(kEventDurationSecond/30); //EventTimeout if (resultCode != eventLoopTimedOutErr) { rfbLog("Received Result: %d during event loop, Shutting Down", resultCode); keepRunning = NO; } } } #if 0 else while (1) { // So this looks like it should fix it but I get no response on the CGWaitForScreenRefreshRect.... // It doesn't seem to get called at all when not running an event loop CGRectCount rectCount; CGRect *rectArray; CGEventErr result; result = CGWaitForScreenRefreshRects( &rectArray, &rectCount ); refreshCallback(rectCount, rectArray, NULL); CGReleaseScreenRefreshRects( rectArray ); } #endif [tempPool release]; rfbShutdown(); return 0; } ================================================ FILE: OSXvnc-server/miregion.c ================================================ /*********************************************************** Copyright (c) 1987, 1988, 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987, 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: miregion.c,v 1.60 94/04/17 20:27:49 dpw Exp $ */ #include #include #include "miscstruct.h" #include "regionstr.h" #include "Xprotostr.h" #include "gc.h" #if defined (__GNUC__) && !defined (NO_INLINES) #define INLINE __inline #else #define INLINE #endif /* * hack until callers of these functions can deal with out-of-memory */ extern Bool Must_have_memory; #ifdef DEBUG #define assert(expr) {if (!(expr)) \ FatalError("Assertion failed file %s, line %d: expr\n", \ __FILE__, __LINE__); } #else #define assert(expr) #endif #define good(reg) assert(miValidRegion(reg)) /* * The functions in this file implement the Region abstraction used extensively * throughout the X11 sample server. A Region is simply a set of disjoint * (non-overlapping) rectangles, plus an "extent" rectangle which is the * smallest single rectangle that contains all the non-overlapping rectangles. * * A Region is implemented as a "y-x-banded" array of rectangles. This array * imposes two degrees of order. First, all rectangles are sorted by top side * y coordinate first (y1), and then by left side x coordinate (x1). * * Furthermore, the rectangles are grouped into "bands". Each rectangle in a * band has the same top y coordinate (y1), and each has the same bottom y * coordinate (y2). Thus all rectangles in a band differ only in their left * and right side (x1 and x2). Bands are implicit in the array of rectangles: * there is no separate list of band start pointers. * * The y-x band representation does not minimize rectangles. In particular, * if a rectangle vertically crosses a band (the rectangle has scanlines in * the y1 to y2 area spanned by the band), then the rectangle may be broken * down into two or more smaller rectangles stacked one atop the other. * * ----------- ----------- * | | | | band 0 * | | -------- ----------- -------- * | | | | in y-x banded | | | | band 1 * | | | | form is | | | | * ----------- | | ----------- -------- * | | | | band 2 * -------- -------- * * An added constraint on the rectangles is that they must cover as much * horizontal area as possible: no two rectangles within a band are allowed * to touch. * * Whenever possible, bands will be merged together to cover a greater vertical * distance (and thus reduce the number of rectangles). Two bands can be merged * only if the bottom of one touches the top of the other and they have * rectangles in the same places (of the same width, of course). * * Adam de Boor wrote most of the original region code. Joel McCormack * substantially modified or rewrote most of the core arithmetic routines, * and added miRegionValidate in order to support several speed improvements * to miValidateTree. Bob Scheifler changed the representation to be more * compact when empty or a single rectangle, and did a bunch of gratuitous * reformatting. */ /* true iff two Boxes overlap */ #define EXTENTCHECK(r1,r2) \ (!( ((r1)->x2 <= (r2)->x1) || \ ((r1)->x1 >= (r2)->x2) || \ ((r1)->y2 <= (r2)->y1) || \ ((r1)->y1 >= (r2)->y2) ) ) /* true iff (x,y) is in Box */ #define INBOX(r,x,y) \ ( ((r)->x2 > x) && \ ((r)->x1 <= x) && \ ((r)->y2 > y) && \ ((r)->y1 <= y) ) /* true iff Box r1 contains Box r2 */ #define SUBSUMES(r1,r2) \ ( ((r1)->x1 <= (r2)->x1) && \ ((r1)->x2 >= (r2)->x2) && \ ((r1)->y1 <= (r2)->y1) && \ ((r1)->y2 >= (r2)->y2) ) #define xallocData(n) (RegDataPtr)xalloc(REGION_SZOF(n)) #define xfreeData(reg) if ((reg)->data && (reg)->data->size) xfree((reg)->data) #define RECTALLOC(pReg,n) \ if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \ miRectAlloc(pReg, n) #define ADDRECT(pNextRect,nx1,ny1,nx2,ny2) \ { \ pNextRect->x1 = nx1; \ pNextRect->y1 = ny1; \ pNextRect->x2 = nx2; \ pNextRect->y2 = ny2; \ pNextRect++; \ } #define NEWRECT(pReg,pNextRect,nx1,ny1,nx2,ny2) \ { \ if (!(pReg)->data || ((pReg)->data->numRects == (pReg)->data->size))\ { \ miRectAlloc(pReg, 1); \ pNextRect = REGION_TOP(pReg); \ } \ ADDRECT(pNextRect,nx1,ny1,nx2,ny2); \ pReg->data->numRects++; \ assert(pReg->data->numRects<=pReg->data->size); \ } #define DOWNSIZE(reg,numRects) \ if (((numRects) < ((reg)->data->size >> 1)) && ((reg)->data->size > 50)) \ { \ RegDataPtr NewData; \ NewData = (RegDataPtr)xrealloc((reg)->data, REGION_SZOF(numRects)); \ if (NewData) \ { \ NewData->size = (numRects); \ (reg)->data = NewData; \ } \ } BoxRec miEmptyBox = {0, 0, 0, 0}; RegDataRec miEmptyData = {0, 0}; #ifdef DEBUG int miPrintRegion(rgn) RegionPtr rgn; { int num, size; register int i; BoxPtr rects; num = REGION_NUM_RECTS(rgn); size = REGION_SIZE(rgn); rects = REGION_RECTS(rgn); ErrorF("num: %d size: %d\n", num, size); ErrorF("extents: %d %d %d %d\n", rgn->extents.x1, rgn->extents.y1, rgn->extents.x2, rgn->extents.y2); for (i = 0; i < num; i++) ErrorF("%d %d %d %d\n", rects[i].x1, rects[i].y1, rects[i].x2, rects[i].y2); ErrorF("\n"); return(num); } Bool miRegionsEqual(reg1, reg2) RegionPtr reg1; RegionPtr reg2; { int i; BoxPtr rects1, rects2; if (reg1->extents.x1 != reg2->extents.x1) return FALSE; if (reg1->extents.x2 != reg2->extents.x2) return FALSE; if (reg1->extents.y1 != reg2->extents.y1) return FALSE; if (reg1->extents.y2 != reg2->extents.y2) return FALSE; if (REGION_NUM_RECTS(reg1) != REGION_NUM_RECTS(reg2)) return FALSE; rects1 = REGION_RECTS(reg1); rects2 = REGION_RECTS(reg2); for (i = 0; i != REGION_NUM_RECTS(reg1); i++) { if (rects1[i].x1 != rects2[i].x1) return FALSE; if (rects1[i].x2 != rects2[i].x2) return FALSE; if (rects1[i].y1 != rects2[i].y1) return FALSE; if (rects1[i].y2 != rects2[i].y2) return FALSE; } return TRUE; } Bool miValidRegion(reg) RegionPtr reg; { register int i, numRects; if ((reg->extents.x1 > reg->extents.x2) || (reg->extents.y1 > reg->extents.y2)) return FALSE; numRects = REGION_NUM_RECTS(reg); if (!numRects) return ((reg->extents.x1 == reg->extents.x2) && (reg->extents.y1 == reg->extents.y2) && (reg->data->size || (reg->data == &miEmptyData))); else if (numRects == 1) return (!reg->data); else { register BoxPtr pboxP, pboxN; BoxRec box; pboxP = REGION_RECTS(reg); box = *pboxP; box.y2 = pboxP[numRects-1].y2; pboxN = pboxP + 1; for (i = numRects; --i > 0; pboxP++, pboxN++) { if ((pboxN->x1 >= pboxN->x2) || (pboxN->y1 >= pboxN->y2)) return FALSE; if (pboxN->x1 < box.x1) box.x1 = pboxN->x1; if (pboxN->x2 > box.x2) box.x2 = pboxN->x2; if ((pboxN->y1 < pboxP->y1) || ((pboxN->y1 == pboxP->y1) && ((pboxN->x1 < pboxP->x2) || (pboxN->y2 != pboxP->y2)))) return FALSE; } return ((box.x1 == reg->extents.x1) && (box.x2 == reg->extents.x2) && (box.y1 == reg->extents.y1) && (box.y2 == reg->extents.y2)); } } #endif /* DEBUG */ /***************************************************************** * RegionCreate(rect, size) * This routine does a simple malloc to make a structure of * REGION of "size" number of rectangles. *****************************************************************/ RegionPtr miRegionCreate(BoxPtr rect, int size) { register RegionPtr pReg; Must_have_memory = TRUE; /* XXX */ pReg = (RegionPtr)xalloc(sizeof(RegionRec)); Must_have_memory = FALSE; /* XXX */ if (rect) { pReg->extents = *rect; pReg->data = (RegDataPtr)NULL; } else { pReg->extents = miEmptyBox; if ((size > 1) && (pReg->data = xallocData(size))) { pReg->data->size = size; pReg->data->numRects = 0; } else pReg->data = &miEmptyData; } return(pReg); } /***************************************************************** * RegionInit(pReg, rect, size) * Outer region rect is statically allocated. *****************************************************************/ void miRegionInit(RegionPtr pReg, BoxPtr rect, int size) { if (rect) { pReg->extents = *rect; pReg->data = (RegDataPtr)NULL; } else { pReg->extents = miEmptyBox; if ((size > 1) && (pReg->data = xallocData(size))) { pReg->data->size = size; pReg->data->numRects = 0; } else pReg->data = &miEmptyData; } } void miRegionDestroy(RegionPtr pReg) { good(pReg); xfreeData(pReg); xfree(pReg); } void miRegionUninit(RegionPtr pReg) { good(pReg); xfreeData(pReg); } Bool miRectAlloc(RegionPtr pRgn, int n) { Must_have_memory = TRUE; /* XXX */ if (!pRgn->data) { n++; pRgn->data = xallocData(n); pRgn->data->numRects = 1; *REGION_BOXPTR(pRgn) = pRgn->extents; } else if (!pRgn->data->size) { pRgn->data = xallocData(n); pRgn->data->numRects = 0; } else { if (n == 1) { n = pRgn->data->numRects; if (n > 500) /* XXX pick numbers out of a hat */ n = 250; } n += pRgn->data->numRects; pRgn->data = (RegDataPtr)xrealloc(pRgn->data, REGION_SZOF(n)); } Must_have_memory = FALSE; /* XXX */ pRgn->data->size = n; return TRUE; } Bool miRegionCopy(RegionPtr dst, RegionPtr src) { good(dst); good(src); if (dst == src) return TRUE; dst->extents = src->extents; if (!src->data || !src->data->size) { xfreeData(dst); dst->data = src->data; return TRUE; } if (!dst->data || (dst->data->size < src->data->numRects)) { xfreeData(dst); Must_have_memory = TRUE; /* XXX */ dst->data = xallocData(src->data->numRects); Must_have_memory = FALSE; /* XXX */ dst->data->size = src->data->numRects; } dst->data->numRects = src->data->numRects; memmove((char *)REGION_BOXPTR(dst),(char *)REGION_BOXPTR(src), dst->data->numRects * sizeof(BoxRec)); return TRUE; } /*====================================================================== * Generic Region Operator *====================================================================*/ /*- *----------------------------------------------------------------------- * miCoalesce -- * Attempt to merge the boxes in the current band with those in the * previous one. We are guaranteed that the current band extends to * the end of the rects array. Used only by miRegionOp. * * Results: * The new index for the previous band. * * Side Effects: * If coalescing takes place: * - rectangles in the previous band will have their y2 fields * altered. * - pReg->data->numRects will be decreased. * *----------------------------------------------------------------------- */ INLINE static int miCoalesce ( RegionPtr pReg, /* Region to coalesce */ int prevStart, /* Index of start of previous band */ int curStart /* Index of start of current band */ ) { register BoxPtr pPrevBox; /* Current box in previous band */ register BoxPtr pCurBox; /* Current box in current band */ register int numRects; /* Number rectangles in both bands */ register int y2; /* Bottom of current band */ /* * Figure out how many rectangles are in the band. */ numRects = curStart - prevStart; assert(numRects == pReg->data->numRects - curStart); if (!numRects) return curStart; /* * The bands may only be coalesced if the bottom of the previous * matches the top scanline of the current. */ pPrevBox = REGION_BOX(pReg, prevStart); pCurBox = REGION_BOX(pReg, curStart); if (pPrevBox->y2 != pCurBox->y1) return curStart; /* * Make sure the bands have boxes in the same places. This * assumes that boxes have been added in such a way that they * cover the most area possible. I.e. two boxes in a band must * have some horizontal space between them. */ y2 = pCurBox->y2; do { if ((pPrevBox->x1 != pCurBox->x1) || (pPrevBox->x2 != pCurBox->x2)) { return (curStart); } pPrevBox++; pCurBox++; numRects--; } while (numRects); /* * The bands may be merged, so set the bottom y of each box * in the previous band to the bottom y of the current band. */ numRects = curStart - prevStart; pReg->data->numRects -= numRects; do { pPrevBox--; pPrevBox->y2 = y2; numRects--; } while (numRects); return prevStart; } /* Quicky macro to avoid trivial reject procedure calls to miCoalesce */ #define Coalesce(newReg, prevBand, curBand) \ if (curBand - prevBand == newReg->data->numRects - curBand) { \ prevBand = miCoalesce(newReg, prevBand, curBand); \ } else { \ prevBand = curBand; \ } /*- *----------------------------------------------------------------------- * miAppendNonO -- * Handle a non-overlapping band for the union and subtract operations. * Just adds the (top/bottom-clipped) rectangles into the region. * Doesn't have to check for subsumption or anything. * * Results: * None. * * Side Effects: * pReg->data->numRects is incremented and the rectangles overwritten * with the rectangles we're passed. * *----------------------------------------------------------------------- */ INLINE static Bool miAppendNonO (RegionPtr pReg, BoxPtr r, BoxPtr rEnd, int y1, int y2) { register BoxPtr pNextRect; ssize_t newRects = rEnd - r; assert(y1 < y2); assert(newRects != 0); /* Make sure we have enough space for all rectangles to be added */ RECTALLOC(pReg, newRects); pNextRect = REGION_TOP(pReg); pReg->data->numRects += newRects; do { assert(r->x1 < r->x2); ADDRECT(pNextRect, r->x1, y1, r->x2, y2); r++; } while (r != rEnd); return TRUE; } #define FindBand(r, rBandEnd, rEnd, ry1) \ { \ ry1 = r->y1; \ rBandEnd = r+1; \ while ((rBandEnd != rEnd) && (rBandEnd->y1 == ry1)) { \ rBandEnd++; \ } \ } #define AppendRegions(newReg, r, rEnd) \ { \ int newRects; \ if ((newRects = rEnd - r)) { \ RECTALLOC(newReg, newRects); \ memmove((char *)REGION_TOP(newReg),(char *)r, \ newRects * sizeof(BoxRec)); \ newReg->data->numRects += newRects; \ } \ } /*- *----------------------------------------------------------------------- * miRegionOp -- * Apply an operation to two regions. Called by miUnion, miInverse, * miSubtract, miIntersect.... Both regions MUST have at least one * rectangle, and cannot be the same object. * * Results: * TRUE if successful. * * Side Effects: * The new region is overwritten. * pOverlap set to TRUE if overlapFunc ever returns TRUE. * * Notes: * The idea behind this function is to view the two regions as sets. * Together they cover a rectangle of area that this function divides * into horizontal bands where points are covered only by one region * or by both. For the first case, the nonOverlapFunc is called with * each the band and the band's upper and lower extents. For the * second, the overlapFunc is called to process the entire band. It * is responsible for clipping the rectangles in the band, though * this function provides the boundaries. * At the end of each band, the new region is coalesced, if possible, * to reduce the number of rectangles in the region. * *----------------------------------------------------------------------- */ static Bool miRegionOp(RegionPtr newReg, /* Place to store result */ RegionPtr reg1, /* First region in operation */ RegionPtr reg2, /* 2d region in operation */ Bool (*overlapFunc)(RegionPtr pReg, BoxPtr r1, BoxPtr r1End, BoxPtr r2, BoxPtr r2End, short y1, short y2, Bool *pOverlap), /* Function to call for over- * lapping bands */ Bool appendNon1, /* Append non-overlapping bands */ /* in region 1 ? */ Bool appendNon2, /* Append non-overlapping bands */ /* in region 2 ? */ Bool *pOverlap) { register BoxPtr r1; /* Pointer into first region */ register BoxPtr r2; /* Pointer into 2d region */ BoxPtr r1End; /* End of 1st region */ BoxPtr r2End; /* End of 2d region */ short ybot; /* Bottom of intersection */ short ytop; /* Top of intersection */ RegDataPtr oldData; /* Old data for newReg */ int prevBand; /* Index of start of * previous band in newReg */ int curBand; /* Index of start of current * band in newReg */ register BoxPtr r1BandEnd; /* End of current band in r1 */ register BoxPtr r2BandEnd; /* End of current band in r2 */ short top; /* Top of non-overlapping band */ short bot; /* Bottom of non-overlapping band*/ register int r1y1; /* Temps for r1->y1 and r2->y1 */ register int r2y1; /* * Initialization: * set r1, r2, r1End and r2End appropriately, save the rectangles * of the destination region until the end in case it's one of * the two source regions, then mark the "new" region empty, allocating * another array of rectangles for it to use. */ r1 = REGION_RECTS(reg1); int newSize = REGION_NUM_RECTS(reg1); r1End = r1 + newSize; int numRects = REGION_NUM_RECTS(reg2); r2 = REGION_RECTS(reg2); r2End = r2 + numRects; assert(r1 != r1End); assert(r2 != r2End); oldData = (RegDataPtr)NULL; if (((newReg == reg1) && (newSize > 1)) || ((newReg == reg2) && (numRects > 1))) { oldData = newReg->data; newReg->data = &miEmptyData; } /* guess at new size */ if (numRects > newSize) newSize = numRects; newSize <<= 1; if (!newReg->data) newReg->data = &miEmptyData; else if (newReg->data->size) newReg->data->numRects = 0; if (newSize > newReg->data->size) miRectAlloc(newReg, newSize); /* * Initialize ybot. * In the upcoming loop, ybot and ytop serve different functions depending * on whether the band being handled is an overlapping or non-overlapping * band. * In the case of a non-overlapping band (only one of the regions * has points in the band), ybot is the bottom of the most recent * intersection and thus clips the top of the rectangles in that band. * ytop is the top of the next intersection between the two regions and * serves to clip the bottom of the rectangles in the current band. * For an overlapping band (where the two regions intersect), ytop clips * the top of the rectangles of both regions and ybot clips the bottoms. */ ybot = min(r1->y1, r2->y1); /* * prevBand serves to mark the start of the previous band so rectangles * can be coalesced into larger rectangles. qv. miCoalesce, above. * In the beginning, there is no previous band, so prevBand == curBand * (curBand is set later on, of course, but the first band will always * start at index 0). prevBand and curBand must be indices because of * the possible expansion, and resultant moving, of the new region's * array of rectangles. */ prevBand = 0; do { /* * This algorithm proceeds one source-band (as opposed to a * destination band, which is determined by where the two regions * intersect) at a time. r1BandEnd and r2BandEnd serve to mark the * rectangle after the last one in the current band for their * respective regions. */ assert(r1 != r1End); assert(r2 != r2End); FindBand(r1, r1BandEnd, r1End, r1y1); FindBand(r2, r2BandEnd, r2End, r2y1); /* * First handle the band that doesn't intersect, if any. * * Note that attention is restricted to one band in the * non-intersecting region at once, so if a region has n * bands between the current position and the next place it overlaps * the other, this entire loop will be passed through n times. */ if (r1y1 < r2y1) { if (appendNon1) { top = max(r1y1, ybot); bot = min(r1->y2, r2y1); if (top != bot) { curBand = newReg->data->numRects; miAppendNonO(newReg, r1, r1BandEnd, top, bot); Coalesce(newReg, prevBand, curBand); } } ytop = r2y1; } else if (r2y1 < r1y1) { if (appendNon2) { top = max(r2y1, ybot); bot = min(r2->y2, r1y1); if (top != bot) { curBand = newReg->data->numRects; miAppendNonO(newReg, r2, r2BandEnd, top, bot); Coalesce(newReg, prevBand, curBand); } } ytop = r1y1; } else { ytop = r1y1; } /* * Now see if we've hit an intersecting band. The two bands only * intersect if ybot > ytop */ ybot = min(r1->y2, r2->y2); if (ybot > ytop) { curBand = newReg->data->numRects; (* overlapFunc)(newReg, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot, pOverlap); Coalesce(newReg, prevBand, curBand); } /* * If we've finished with a band (y2 == ybot) we skip forward * in the region to the next band. */ if (r1->y2 == ybot) r1 = r1BandEnd; if (r2->y2 == ybot) r2 = r2BandEnd; } while (r1 != r1End && r2 != r2End); /* * Deal with whichever region (if any) still has rectangles left. * * We only need to worry about banding and coalescing for the very first * band left. After that, we can just group all remaining boxes, * regardless of how many bands, into one final append to the list. */ if ((r1 != r1End) && appendNon1) { /* Do first nonOverlap1Func call, which may be able to coalesce */ FindBand(r1, r1BandEnd, r1End, r1y1); curBand = newReg->data->numRects; miAppendNonO(newReg, r1, r1BandEnd, max(r1y1, ybot), r1->y2); Coalesce(newReg, prevBand, curBand); /* Just append the rest of the boxes */ AppendRegions(newReg, r1BandEnd, r1End); } else if ((r2 != r2End) && appendNon2) { /* Do first nonOverlap2Func call, which may be able to coalesce */ FindBand(r2, r2BandEnd, r2End, r2y1); curBand = newReg->data->numRects; miAppendNonO(newReg, r2, r2BandEnd, max(r2y1, ybot), r2->y2); Coalesce(newReg, prevBand, curBand); /* Append rest of boxes */ AppendRegions(newReg, r2BandEnd, r2End); } if (oldData) xfree(oldData); if (!(numRects = newReg->data->numRects)) { xfreeData(newReg); newReg->data = &miEmptyData; } else if (numRects == 1) { newReg->extents = *REGION_BOXPTR(newReg); xfreeData(newReg); newReg->data = (RegDataPtr)NULL; } else { DOWNSIZE(newReg, numRects); } return TRUE; } /*- *----------------------------------------------------------------------- * miSetExtents -- * Reset the extents of a region to what they should be. Called by * miSubtract and miIntersect as they can't figure it out along the * way or do so easily, as miUnion can. * * Results: * None. * * Side Effects: * The region's 'extents' structure is overwritten. * *----------------------------------------------------------------------- */ void miSetExtents(RegionPtr pReg) { register BoxPtr pBox, pBoxEnd; if (!pReg->data) return; if (!pReg->data->size) { pReg->extents.x2 = pReg->extents.x1; pReg->extents.y2 = pReg->extents.y1; return; } pBox = REGION_BOXPTR(pReg); pBoxEnd = REGION_END(pReg); /* * Since pBox is the first rectangle in the region, it must have the * smallest y1 and since pBoxEnd is the last rectangle in the region, * it must have the largest y2, because of banding. Initialize x1 and * x2 from pBox and pBoxEnd, resp., as good things to initialize them * to... */ pReg->extents.x1 = pBox->x1; pReg->extents.y1 = pBox->y1; pReg->extents.x2 = pBoxEnd->x2; pReg->extents.y2 = pBoxEnd->y2; assert(pReg->extents.y1 < pReg->extents.y2); while (pBox <= pBoxEnd) { if (pBox->x1 < pReg->extents.x1) pReg->extents.x1 = pBox->x1; if (pBox->x2 > pReg->extents.x2) pReg->extents.x2 = pBox->x2; pBox++; }; assert(pReg->extents.x1 < pReg->extents.x2); } /*====================================================================== * Region Intersection *====================================================================*/ /*- *----------------------------------------------------------------------- * miIntersectO -- * Handle an overlapping band for miIntersect. * * Results: * TRUE if successful. * * Side Effects: * Rectangles may be added to the region. * *----------------------------------------------------------------------- */ /*ARGSUSED*/ static Bool miIntersectO(RegionPtr pReg, BoxPtr r1, BoxPtr r1End, BoxPtr r2, BoxPtr r2End, short y1, short y2, Bool *pOverlap) { register int x1; register int x2; register BoxPtr pNextRect; pNextRect = REGION_TOP(pReg); assert(y1 < y2); assert(r1 != r1End && r2 != r2End); do { x1 = max(r1->x1, r2->x1); x2 = min(r1->x2, r2->x2); /* * If there's any overlap between the two rectangles, add that * overlap to the new region. */ if (x1 < x2) NEWRECT(pReg, pNextRect, x1, y1, x2, y2); /* * Advance the pointer(s) with the leftmost right side, since the next * rectangle on that list may still overlap the other region's * current rectangle. */ if (r1->x2 == x2) { r1++; } if (r2->x2 == x2) { r2++; } } while ((r1 != r1End) && (r2 != r2End)); return TRUE; } Bool miIntersect( RegionPtr newReg, /* destination Region */ RegionPtr reg1, RegionPtr reg2 /* source regions */ ) { good(reg1); good(reg2); good(newReg); /* check for trivial reject */ if (REGION_NIL(reg1) || REGION_NIL(reg2) || !EXTENTCHECK(®1->extents, ®2->extents)) { /* Covers about 20% of all cases */ xfreeData(newReg); newReg->extents.x2 = newReg->extents.x1; newReg->extents.y2 = newReg->extents.y1; newReg->data = &miEmptyData; } else if (!reg1->data && !reg2->data) { /* Covers about 80% of cases that aren't trivially rejected */ newReg->extents.x1 = max(reg1->extents.x1, reg2->extents.x1); newReg->extents.y1 = max(reg1->extents.y1, reg2->extents.y1); newReg->extents.x2 = min(reg1->extents.x2, reg2->extents.x2); newReg->extents.y2 = min(reg1->extents.y2, reg2->extents.y2); xfreeData(newReg); newReg->data = (RegDataPtr)NULL; } else if (!reg2->data && SUBSUMES(®2->extents, ®1->extents)) { return miRegionCopy(newReg, reg1); } else if (!reg1->data && SUBSUMES(®1->extents, ®2->extents)) { return miRegionCopy(newReg, reg2); } else if (reg1 == reg2) { return miRegionCopy(newReg, reg1); } else { /* General purpose intersection */ Bool overlap; /* result ignored */ if (!miRegionOp(newReg, reg1, reg2, miIntersectO, FALSE, FALSE, &overlap)) return FALSE; miSetExtents(newReg); } good(newReg); return(TRUE); } #define MERGERECT(r) \ { \ if (r->x1 <= x2) { \ /* Merge with current rectangle */ \ if (r->x1 < x2) *pOverlap = TRUE; \ if (x2 < r->x2) x2 = r->x2; \ } else { \ /* Add current rectangle, start new one */ \ NEWRECT(pReg, pNextRect, x1, y1, x2, y2); \ x1 = r->x1; \ x2 = r->x2; \ } \ r++; \ } /*====================================================================== * Region Union *====================================================================*/ /*- *----------------------------------------------------------------------- * miUnionO -- * Handle an overlapping band for the union operation. Picks the * left-most rectangle each time and merges it into the region. * * Results: * TRUE if successful. * * Side Effects: * pReg is overwritten. * pOverlap is set to TRUE if any boxes overlap. * *----------------------------------------------------------------------- */ static Bool miUnionO(RegionPtr pReg, BoxPtr r1, BoxPtr r1End, BoxPtr r2, BoxPtr r2End, short y1, short y2, Bool *pOverlap) { register BoxPtr pNextRect; register int x1; /* left and right side of current union */ register int x2; assert (y1 < y2); assert(r1 != r1End && r2 != r2End); pNextRect = REGION_TOP(pReg); /* Start off current rectangle */ if (r1->x1 < r2->x1) { x1 = r1->x1; x2 = r1->x2; r1++; } else { x1 = r2->x1; x2 = r2->x2; r2++; } while (r1 != r1End && r2 != r2End) { if (r1->x1 < r2->x1) MERGERECT(r1) else MERGERECT(r2); } /* Finish off whoever (if any) is left */ if (r1 != r1End) { do { MERGERECT(r1); } while (r1 != r1End); } else if (r2 != r2End) { do { MERGERECT(r2); } while (r2 != r2End); } /* Add current rectangle */ NEWRECT(pReg, pNextRect, x1, y1, x2, y2); return TRUE; } Bool miUnion( RegionPtr newReg, /* destination Region */ RegionPtr reg1, RegionPtr reg2 /* source regions */ ) { Bool overlap; /* result ignored */ /* Return TRUE if some overlap between reg1, reg2 */ good(reg1); good(reg2); good(newReg); /* checks all the simple cases */ /* * Region 1 and 2 are the same */ if (reg1 == reg2) { return miRegionCopy(newReg, reg1); } /* * Region 1 is empty */ if (REGION_NIL(reg1)) { if (newReg != reg2) return miRegionCopy(newReg, reg2); return TRUE; } /* * Region 2 is empty */ if (REGION_NIL(reg2)) { if (newReg != reg1) return miRegionCopy(newReg, reg1); return TRUE; } /* * Region 1 completely subsumes region 2 */ if (!reg1->data && SUBSUMES(®1->extents, ®2->extents)) { if (newReg != reg1) return miRegionCopy(newReg, reg1); return TRUE; } /* * Region 2 completely subsumes region 1 */ if (!reg2->data && SUBSUMES(®2->extents, ®1->extents)) { if (newReg != reg2) return miRegionCopy(newReg, reg2); return TRUE; } if (!miRegionOp(newReg, reg1, reg2, miUnionO, TRUE, TRUE, &overlap)) return FALSE; newReg->extents.x1 = min(reg1->extents.x1, reg2->extents.x1); newReg->extents.y1 = min(reg1->extents.y1, reg2->extents.y1); newReg->extents.x2 = max(reg1->extents.x2, reg2->extents.x2); newReg->extents.y2 = max(reg1->extents.y2, reg2->extents.y2); good(newReg); return TRUE; } /*====================================================================== * Batch Rectangle Union *====================================================================*/ /*- *----------------------------------------------------------------------- * miRegionAppend -- * * "Append" the rgn rectangles onto the end of dstrgn, maintaining * knowledge of YX-banding when it's easy. Otherwise, dstrgn just * becomes a non-y-x-banded random collection of rectangles, and not * yet a true region. After a sequence of appends, the caller must * call miRegionValidate to ensure that a valid region is constructed. * * Results: * TRUE if successful. * * Side Effects: * dstrgn is modified if rgn has rectangles. * */ Bool miRegionAppend(RegionPtr dstrgn, RegionPtr rgn) { int numRects, dnumRects, size; BoxPtr new, old; Bool prepend; if (!rgn->data && (dstrgn->data == &miEmptyData)) { dstrgn->extents = rgn->extents; dstrgn->data = (RegDataPtr)NULL; return TRUE; } numRects = REGION_NUM_RECTS(rgn); if (!numRects) return TRUE; prepend = FALSE; size = numRects; dnumRects = REGION_NUM_RECTS(dstrgn); if (!dnumRects && (size < 200)) size = 200; /* XXX pick numbers out of a hat */ RECTALLOC(dstrgn, size); old = REGION_RECTS(rgn); if (!dnumRects) dstrgn->extents = rgn->extents; else if (dstrgn->extents.x2 > dstrgn->extents.x1) { register BoxPtr first, last; first = old; last = REGION_BOXPTR(dstrgn) + (dnumRects - 1); if ((first->y1 > last->y2) || ((first->y1 == last->y1) && (first->y2 == last->y2) && (first->x1 > last->x2))) { if (rgn->extents.x1 < dstrgn->extents.x1) dstrgn->extents.x1 = rgn->extents.x1; if (rgn->extents.x2 > dstrgn->extents.x2) dstrgn->extents.x2 = rgn->extents.x2; dstrgn->extents.y2 = rgn->extents.y2; } else { first = REGION_BOXPTR(dstrgn); last = old + (numRects - 1); if ((first->y1 > last->y2) || ((first->y1 == last->y1) && (first->y2 == last->y2) && (first->x1 > last->x2))) { prepend = TRUE; if (rgn->extents.x1 < dstrgn->extents.x1) dstrgn->extents.x1 = rgn->extents.x1; if (rgn->extents.x2 > dstrgn->extents.x2) dstrgn->extents.x2 = rgn->extents.x2; dstrgn->extents.y1 = rgn->extents.y1; } else dstrgn->extents.x2 = dstrgn->extents.x1; } } if (prepend) { new = REGION_BOX(dstrgn, numRects); if (dnumRects == 1) *new = *REGION_BOXPTR(dstrgn); else memmove((char *)new,(char *)REGION_BOXPTR(dstrgn), dnumRects * sizeof(BoxRec)); new = REGION_BOXPTR(dstrgn); } else new = REGION_BOXPTR(dstrgn) + dnumRects; if (numRects == 1) *new = *old; else memmove((char *)new, (char *)old, numRects * sizeof(BoxRec)); dstrgn->data->numRects += numRects; return TRUE; } #define ExchangeRects(a, b) \ { \ BoxRec t; \ t = rects[a]; \ rects[a] = rects[b]; \ rects[b] = t; \ } static void QuickSortRects(BoxRec rects[], int numRects) { register int y1; register int x1; register int i, j; register BoxPtr r; /* Always called with numRects > 1 */ do { if (numRects == 2) { if (rects[0].y1 > rects[1].y1 || (rects[0].y1 == rects[1].y1 && rects[0].x1 > rects[1].x1)) ExchangeRects(0, 1); return; } /* Choose partition element, stick in location 0 */ ExchangeRects(0, numRects >> 1); y1 = rects[0].y1; x1 = rects[0].x1; /* Partition array */ i = 0; j = numRects; do { r = &(rects[i]); do { r++; i++; } while (i != numRects && (r->y1 < y1 || (r->y1 == y1 && r->x1 < x1))); r = &(rects[j]); do { r--; j--; } while (y1 < r->y1 || (y1 == r->y1 && x1 < r->x1)); if (i < j) ExchangeRects(i, j); } while (i < j); /* Move partition element back to middle */ ExchangeRects(0, j); /* Recurse */ if (numRects-j-1 > 1) QuickSortRects(&rects[j+1], numRects-j-1); numRects = j; } while (numRects > 1); } /*- *----------------------------------------------------------------------- * miRegionValidate -- * * Take a ``region'' which is a non-y-x-banded random collection of * rectangles, and compute a nice region which is the union of all the * rectangles. * * Results: * TRUE if successful. * * Side Effects: * The passed-in ``region'' may be modified. * pOverlap set to TRUE if any retangles overlapped, else FALSE; * * Strategy: * Step 1. Sort the rectangles into ascending order with primary key y1 * and secondary key x1. * * Step 2. Split the rectangles into the minimum number of proper y-x * banded regions. This may require horizontally merging * rectangles, and vertically coalescing bands. With any luck, * this step in an identity tranformation (ala the Box widget), * or a coalescing into 1 box (ala Menus). * * Step 3. Merge the separate regions down to a single region by calling * miUnion. Maximize the work each miUnion call does by using * a binary merge. * *----------------------------------------------------------------------- */ Bool miRegionValidate(RegionPtr badreg, Bool *pOverlap) { /* Descriptor for regions under construction in Step 2. */ typedef struct { RegionRec reg; int prevBand; int curBand; } RegionInfo; int numRects; /* Original numRects for badreg */ RegionInfo *ri; /* Array of current regions */ int numRI; /* Number of entries used in ri */ int sizeRI; /* Number of entries available in ri */ int i; /* Index into rects */ register int j; /* Index into ri */ register RegionInfo *rit; /* &ri[j] */ register RegionPtr reg; /* ri[j].reg */ register BoxPtr box; /* Current box in rects */ register BoxPtr riBox; /* Last box in ri[j].reg */ register RegionPtr hreg; /* ri[j_half].reg */ *pOverlap = FALSE; if (!badreg->data) { good(badreg); return TRUE; } numRects = badreg->data->numRects; if (!numRects) { good(badreg); return TRUE; } if (badreg->extents.x1 < badreg->extents.x2) { if ((numRects) == 1) { xfreeData(badreg); badreg->data = (RegDataPtr) NULL; } else { DOWNSIZE(badreg, numRects); } good(badreg); return TRUE; } /* Step 1: Sort the rects array into ascending (y1, x1) order */ QuickSortRects(REGION_BOXPTR(badreg), numRects); /* Step 2: Scatter the sorted array into the minimum number of regions */ /* Set up the first region to be the first rectangle in badreg */ /* Note that step 2 code will never overflow the ri[0].reg rects array */ Must_have_memory = TRUE; /* XXX */ ri = (RegionInfo *) xalloc(4 * sizeof(RegionInfo)); Must_have_memory = FALSE; /* XXX */ sizeRI = 4; numRI = 1; ri[0].prevBand = 0; ri[0].curBand = 0; ri[0].reg = *badreg; box = REGION_BOXPTR(&ri[0].reg); ri[0].reg.extents = *box; ri[0].reg.data->numRects = 1; /* Now scatter rectangles into the minimum set of valid regions. If the next rectangle to be added to a region would force an existing rectangle in the region to be split up in order to maintain y-x banding, just forget it. Try the next region. If it doesn't fit cleanly into any region, make a new one. */ for (i = numRects; --i > 0;) { box++; /* Look for a region to append box to */ for (j = numRI, rit = ri; --j >= 0; rit++) { reg = &rit->reg; riBox = REGION_END(reg); if (box->y1 == riBox->y1 && box->y2 == riBox->y2) { /* box is in same band as riBox. Merge or append it */ if (box->x1 <= riBox->x2) { /* Merge it with riBox */ if (box->x1 < riBox->x2) *pOverlap = TRUE; if (box->x2 > riBox->x2) riBox->x2 = box->x2; } else { RECTALLOC(reg, 1); *REGION_TOP(reg) = *box; reg->data->numRects++; } goto NextRect; /* So sue me */ } else if (box->y1 >= riBox->y2) { /* Put box into new band */ if (reg->extents.x2 < riBox->x2) reg->extents.x2 = riBox->x2; if (reg->extents.x1 > box->x1) reg->extents.x1 = box->x1; Coalesce(reg, rit->prevBand, rit->curBand); rit->curBand = reg->data->numRects; RECTALLOC(reg, 1); *REGION_TOP(reg) = *box; reg->data->numRects++; goto NextRect; } /* Well, this region was inappropriate. Try the next one. */ } /* for j */ /* Uh-oh. No regions were appropriate. Create a new one. */ if (sizeRI == numRI) { /* Oops, allocate space for new region information */ sizeRI <<= 1; Must_have_memory = TRUE; /* XXX */ ri = (RegionInfo *) xrealloc(ri, sizeRI * sizeof(RegionInfo)); Must_have_memory = FALSE; /* XXX */ rit = &ri[numRI]; } numRI++; rit->prevBand = 0; rit->curBand = 0; rit->reg.extents = *box; rit->reg.data = (RegDataPtr)NULL; miRectAlloc(&rit->reg, (i+numRI) / numRI); /* MUST force allocation */ NextRect: ; } /* for i */ /* Make a final pass over each region in order to Coalesce and set extents.x2 and extents.y2 */ for (j = numRI, rit = ri; --j >= 0; rit++) { reg = &rit->reg; riBox = REGION_END(reg); reg->extents.y2 = riBox->y2; if (reg->extents.x2 < riBox->x2) reg->extents.x2 = riBox->x2; Coalesce(reg, rit->prevBand, rit->curBand); if (reg->data->numRects == 1) /* keep unions happy below */ { xfreeData(reg); reg->data = (RegDataPtr)NULL; } } /* Step 3: Union all regions into a single region */ while (numRI > 1) { int half = numRI/2; for (j = numRI & 1; j < (half + (numRI & 1)); j++) { reg = &ri[j].reg; hreg = &ri[j+half].reg; miRegionOp(reg, reg, hreg, miUnionO, TRUE, TRUE, pOverlap); if (hreg->extents.x1 < reg->extents.x1) reg->extents.x1 = hreg->extents.x1; if (hreg->extents.y1 < reg->extents.y1) reg->extents.y1 = hreg->extents.y1; if (hreg->extents.x2 > reg->extents.x2) reg->extents.x2 = hreg->extents.x2; if (hreg->extents.y2 > reg->extents.y2) reg->extents.y2 = hreg->extents.y2; xfreeData(hreg); } numRI -= half; } *badreg = ri[0].reg; xfree(ri); good(badreg); return TRUE; } RegionPtr miRectsToRegion(int nrects, xRectangle *prect, int ctype) { register RegionPtr pRgn; register RegDataPtr pData; register BoxPtr pBox; register int i; int x1, y1, x2, y2; pRgn = miRegionCreate(NullBox, 0); if (!nrects) return pRgn; if (nrects == 1) { x1 = prect->x; y1 = prect->y; if ((x2 = x1 + (int) prect->width) > MAXSHORT) x2 = MAXSHORT; if ((y2 = y1 + (int) prect->height) > MAXSHORT) y2 = MAXSHORT; if (x1 != x2 && y1 != y2) { pRgn->extents.x1 = x1; pRgn->extents.y1 = y1; pRgn->extents.x2 = x2; pRgn->extents.y2 = y2; pRgn->data = (RegDataPtr)NULL; } return pRgn; } Must_have_memory = TRUE; /* XXX */ pData = xallocData(nrects); pBox = (BoxPtr) (pData + 1); Must_have_memory = FALSE; /* XXX */ for (i = nrects; --i >= 0; prect++) { x1 = prect->x; y1 = prect->y; if ((x2 = x1 + (int) prect->width) > MAXSHORT) x2 = MAXSHORT; if ((y2 = y1 + (int) prect->height) > MAXSHORT) y2 = MAXSHORT; if (x1 != x2 && y1 != y2) { pBox->x1 = x1; pBox->y1 = y1; pBox->x2 = x2; pBox->y2 = y2; pBox++; } } if (pBox != (BoxPtr) (pData + 1)) { pData->size = nrects; pData->numRects = pBox - (BoxPtr) (pData + 1); pRgn->data = pData; if (ctype != CT_YXBANDED) { Bool overlap; /* result ignored */ pRgn->extents.x1 = pRgn->extents.x2 = 0; miRegionValidate(pRgn, &overlap); } else miSetExtents(pRgn); good(pRgn); } else { xfree (pData); } return pRgn; } /*====================================================================== * Region Subtraction *====================================================================*/ /*- *----------------------------------------------------------------------- * miSubtractO -- * Overlapping band subtraction. x1 is the left-most point not yet * checked. * * Results: * TRUE if successful. * * Side Effects: * pReg may have rectangles added to it. * *----------------------------------------------------------------------- */ /*ARGSUSED*/ static Bool miSubtractO (RegionPtr pReg, BoxPtr r1, BoxPtr r1End, BoxPtr r2, BoxPtr r2End, short y1, short y2, Bool *pOverlap) { register BoxPtr pNextRect; register int x1; x1 = r1->x1; assert(y1x2 <= x1) { /* * Subtrahend entirely to left of minuend: go to next subtrahend. */ r2++; } else if (r2->x1 <= x1) { /* * Subtrahend precedes minuend: nuke left edge of minuend. */ x1 = r2->x2; if (x1 >= r1->x2) { /* * Minuend completely covered: advance to next minuend and * reset left fence to edge of new minuend. */ r1++; if (r1 != r1End) x1 = r1->x1; } else { /* * Subtrahend now used up since it doesn't extend beyond * minuend */ r2++; } } else if (r2->x1 < r1->x2) { /* * Left part of subtrahend covers part of minuend: add uncovered * part of minuend to region and skip to next subtrahend. */ assert(x1x1); NEWRECT(pReg, pNextRect, x1, y1, r2->x1, y2); x1 = r2->x2; if (x1 >= r1->x2) { /* * Minuend used up: advance to new... */ r1++; if (r1 != r1End) x1 = r1->x1; } else { /* * Subtrahend used up */ r2++; } } else { /* * Minuend used up: add any remaining piece before advancing. */ if (r1->x2 > x1) NEWRECT(pReg, pNextRect, x1, y1, r1->x2, y2); r1++; if (r1 != r1End) x1 = r1->x1; } } while ((r1 != r1End) && (r2 != r2End)); /* * Add remaining minuend rectangles to region. */ while (r1 != r1End) { assert(x1x2); NEWRECT(pReg, pNextRect, x1, y1, r1->x2, y2); r1++; if (r1 != r1End) x1 = r1->x1; } return TRUE; } /*- *----------------------------------------------------------------------- * miSubtract -- * Subtract regS from regM and leave the result in regD. * S stands for subtrahend, M for minuend and D for difference. * * Results: * TRUE if successful. * * Side Effects: * regD is overwritten. * *----------------------------------------------------------------------- */ Bool miSubtract(RegionPtr regD, RegionPtr regM, RegionPtr regS) { Bool overlap; /* result ignored */ good(regM); good(regS); good(regD); /* check for trivial rejects */ if (REGION_NIL(regM) || REGION_NIL(regS) || !EXTENTCHECK(®M->extents, ®S->extents)) { return miRegionCopy(regD, regM); } else if (regM == regS) { xfreeData(regD); regD->extents.x2 = regD->extents.x1; regD->extents.y2 = regD->extents.y1; regD->data = &miEmptyData; return TRUE; } /* Add those rectangles in region 1 that aren't in region 2, do yucky subtraction for overlaps, and just throw away rectangles in region 2 that aren't in region 1 */ if (!miRegionOp(regD, regM, regS, miSubtractO, TRUE, FALSE, &overlap)) return FALSE; /* * Can't alter RegD's extents before we call miRegionOp because * it might be one of the source regions and miRegionOp depends * on the extents of those regions being unaltered. Besides, this * way there's no checking against rectangles that will be nuked * due to coalescing, so we have to examine fewer rectangles. */ miSetExtents(regD); good(regD); return TRUE; } /*====================================================================== * Region Inversion *====================================================================*/ /*- *----------------------------------------------------------------------- * miInverse -- * Take a region and a box and return a region that is everything * in the box but not in the region. The careful reader will note * that this is the same as subtracting the region from the box... * * Results: * TRUE. * * Side Effects: * newReg is overwritten. * *----------------------------------------------------------------------- */ Bool miInverse( RegionPtr newReg, /* Destination region */ RegionPtr reg1, /* Region to invert */ BoxPtr invRect /* Bounding box for inversion */ ) { RegionRec invReg; /* Quick and dirty region made from the * bounding box */ Bool overlap; /* result ignored */ good(reg1); good(newReg); /* check for trivial rejects */ if (REGION_NIL(reg1) || !EXTENTCHECK(invRect, ®1->extents)) { newReg->extents = *invRect; xfreeData(newReg); newReg->data = (RegDataPtr)NULL; return TRUE; } /* Add those rectangles in region 1 that aren't in region 2, do yucky subtraction for overlaps, and just throw away rectangles in region 2 that aren't in region 1 */ invReg.extents = *invRect; invReg.data = (RegDataPtr)NULL; if (!miRegionOp(newReg, &invReg, reg1, miSubtractO, TRUE, FALSE, &overlap)) return FALSE; /* * Can't alter newReg's extents before we call miRegionOp because * it might be one of the source regions and miRegionOp depends * on the extents of those regions being unaltered. Besides, this * way there's no checking against rectangles that will be nuked * due to coalescing, so we have to examine fewer rectangles. */ miSetExtents(newReg); good(newReg); return TRUE; } /* * RectIn(region, rect) * This routine takes a pointer to a region and a pointer to a box * and determines if the box is outside/inside/partly inside the region. * * The idea is to travel through the list of rectangles trying to cover the * passed box with them. Anytime a piece of the rectangle isn't covered * by a band of rectangles, partOut is set TRUE. Any time a rectangle in * the region covers part of the box, partIn is set TRUE. The process ends * when either the box has been completely covered (we reached a band that * doesn't overlap the box, partIn is TRUE and partOut is false), the * box has been partially covered (partIn == partOut == TRUE -- because of * the banding, the first time this is true we know the box is only * partially in the region) or is outside the region (we reached a band * that doesn't overlap the box at all and partIn is false) */ int miRectIn(RegionPtr region, BoxPtr prect) { register int x; register int y; register BoxPtr pbox; register BoxPtr pboxEnd; int partIn, partOut; int numRects; good(region); numRects = REGION_NUM_RECTS(region); /* useful optimization */ if (!numRects || !EXTENTCHECK(®ion->extents, prect)) return(rgnOUT); if (numRects == 1) { /* We know that it must be rgnIN or rgnPART */ if (SUBSUMES(®ion->extents, prect)) return(rgnIN); else return(rgnPART); } partOut = FALSE; partIn = FALSE; /* (x,y) starts at upper left of rect, moving to the right and down */ x = prect->x1; y = prect->y1; /* can stop when both partOut and partIn are TRUE, or we reach prect->y2 */ for (pbox = REGION_BOXPTR(region), pboxEnd = pbox + numRects; pbox != pboxEnd; pbox++) { if (pbox->y2 <= y) continue; /* getting up to speed or skipping remainder of band */ if (pbox->y1 > y) { if (partIn || (pbox->y1 >= prect->y2)) break; partOut = TRUE; /* missed part of rectangle above */ y = pbox->y1; /* x guaranteed to be == prect->x1 */ } if (pbox->x2 <= x) continue; /* not far enough over yet */ if (pbox->x1 > x) { if (partIn) break; partOut = TRUE; /* missed part of rectangle to left */ } if (pbox->x1 < prect->x2) { partIn = TRUE; /* definitely overlap */ if (partOut) break; } if (pbox->x2 >= prect->x2) { y = pbox->y2; /* finished with this band */ if (y >= prect->y2) break; x = prect->x1; /* reset x out to left again */ } else { /* * Because boxes in a band are maximal width, if the first box * to overlap the rectangle doesn't completely cover it in that * band, the rectangle must be partially out, since some of it * will be uncovered in that band. partIn will have been set true * by now... */ break; } } return(partIn ? ((y < prect->y2) ? rgnPART : rgnIN) : rgnOUT); } /* TranslateRegion(pReg, x, y) translates in place */ void miTranslateRegion(RegionPtr pReg, int x, int y) { int x1, x2, y1, y2; register int nbox; register BoxPtr pbox; good(pReg); pReg->extents.x1 = x1 = pReg->extents.x1 + x; pReg->extents.y1 = y1 = pReg->extents.y1 + y; pReg->extents.x2 = x2 = pReg->extents.x2 + x; pReg->extents.y2 = y2 = pReg->extents.y2 + y; if (((x1 - MINSHORT)|(y1 - MINSHORT)|(MAXSHORT - x2)|(MAXSHORT - y2)) >= 0) { if (pReg->data && (nbox = pReg->data->numRects)) { for (pbox = REGION_BOXPTR(pReg); nbox--; pbox++) { pbox->x1 += x; pbox->y1 += y; pbox->x2 += x; pbox->y2 += y; } } return; } if (((x2 - MINSHORT)|(y2 - MINSHORT)|(MAXSHORT - x1)|(MAXSHORT - y1)) <= 0) { pReg->extents.x2 = pReg->extents.x1; pReg->extents.y2 = pReg->extents.y1; xfreeData(pReg); pReg->data = &miEmptyData; return; } if (x1 < MINSHORT) pReg->extents.x1 = MINSHORT; else if (x2 > MAXSHORT) pReg->extents.x2 = MAXSHORT; if (y1 < MINSHORT) pReg->extents.y1 = MINSHORT; else if (y2 > MAXSHORT) pReg->extents.y2 = MAXSHORT; if (pReg->data && (nbox = pReg->data->numRects)) { register BoxPtr pboxout; for (pboxout = pbox = REGION_BOXPTR(pReg); nbox--; pbox++) { pboxout->x1 = x1 = pbox->x1 + x; pboxout->y1 = y1 = pbox->y1 + y; pboxout->x2 = x2 = pbox->x2 + x; pboxout->y2 = y2 = pbox->y2 + y; if (((x2 - MINSHORT)|(y2 - MINSHORT)| (MAXSHORT - x1)|(MAXSHORT - y1)) <= 0) { pReg->data->numRects--; continue; } if (x1 < MINSHORT) pboxout->x1 = MINSHORT; else if (x2 > MAXSHORT) pboxout->x2 = MAXSHORT; if (y1 < MINSHORT) pboxout->y1 = MINSHORT; else if (y2 > MAXSHORT) pboxout->y2 = MAXSHORT; pboxout++; } if (pboxout != pbox) { if (pReg->data->numRects == 1) { pReg->extents = *REGION_BOXPTR(pReg); xfreeData(pReg); pReg->data = (RegDataPtr)NULL; } else miSetExtents(pReg); } } } void miRegionReset(RegionPtr pReg, BoxPtr pBox) { good(pReg); assert(pBox->x1<=pBox->x2); assert(pBox->y1<=pBox->y2); pReg->extents = *pBox; xfreeData(pReg); pReg->data = (RegDataPtr)NULL; } Bool miPointInRegion(RegionPtr pReg, int x, int y, BoxPtr box) /* box "return" value */ { register BoxPtr pbox, pboxEnd; long numRects; good(pReg); numRects = REGION_NUM_RECTS(pReg); if (!numRects || !INBOX(&pReg->extents, x, y)) return(FALSE); if (numRects == 1) { *box = pReg->extents; return(TRUE); } for (pbox = REGION_BOXPTR(pReg), pboxEnd = pbox + numRects; pbox != pboxEnd; pbox++) { if (y >= pbox->y2) continue; /* not there yet */ if ((y < pbox->y1) || (x < pbox->x1)) break; /* missed it */ if (x >= pbox->x2) continue; /* not there yet */ *box = *pbox; return(TRUE); } return(FALSE); } Bool miRegionNotEmpty(RegionPtr pReg) { good(pReg); return(!REGION_NIL(pReg)); } void miRegionEmpty(RegionPtr pReg) { good(pReg); xfreeData(pReg); pReg->extents.x2 = pReg->extents.x1; pReg->extents.y2 = pReg->extents.y1; pReg->data = &miEmptyData; } BoxPtr miRegionExtents(RegionPtr pReg) { good(pReg); return(&pReg->extents); } #define ExchangeSpans(a, b) \ { \ DDXPointRec tpt; \ register int tw; \ \ tpt = spans[a]; spans[a] = spans[b]; spans[b] = tpt; \ tw = widths[a]; widths[a] = widths[b]; widths[b] = tw; \ } /* ||| I should apply the merge sort code to rectangle sorting above, and see if mapping time can be improved. But right now I've been at work 12 hours, so forget it. */ static void QuickSortSpans(DDXPointRec spans[], int widths[], int numSpans) { register int y; register int i, j, m; register DDXPointPtr r; /* Always called with numSpans > 1 */ /* Sorts only by y, doesn't bother to sort by x */ do { if (numSpans < 9) { /* Do insertion sort */ register int yprev; yprev = spans[0].y; i = 1; do { /* while i != numSpans */ y = spans[i].y; if (yprev > y) { /* spans[i] is out of order. Move into proper location. */ DDXPointRec tpt; int tw, k; for (j = 0; y >= spans[j].y; j++) {} tpt = spans[i]; tw = widths[i]; for (k = i; k != j; k--) { spans[k] = spans[k-1]; widths[k] = widths[k-1]; } spans[j] = tpt; widths[j] = tw; y = spans[i].y; } /* if out of order */ yprev = y; i++; } while (i != numSpans); return; } /* Choose partition element, stick in location 0 */ m = numSpans / 2; if (spans[m].y > spans[0].y) ExchangeSpans(m, 0); if (spans[m].y > spans[numSpans-1].y) ExchangeSpans(m, numSpans-1); if (spans[m].y > spans[0].y) ExchangeSpans(m, 0); y = spans[0].y; /* Partition array */ i = 0; j = numSpans; do { r = &(spans[i]); do { r++; i++; } while (i != numSpans && r->y < y); r = &(spans[j]); do { r--; j--; } while (y < r->y); if (i < j) ExchangeSpans(i, j); } while (i < j); /* Move partition element back to middle */ ExchangeSpans(0, j); /* Recurse */ if (numSpans-j-1 > 1) QuickSortSpans(&spans[j+1], &widths[j+1], numSpans-j-1); numSpans = j; } while (numSpans > 1); } #define NextBand() \ { \ clipy1 = pboxBandStart->y1; \ clipy2 = pboxBandStart->y2; \ pboxBandEnd = pboxBandStart + 1; \ while (pboxBandEnd != pboxLast && pboxBandEnd->y1 == clipy1) { \ pboxBandEnd++; \ } \ for (; ppt != pptLast && ppt->y < clipy1; ppt++, pwidth++) {} \ } /* Clip a list of scanlines to a region. The caller has allocated the space. FSorted is non-zero if the scanline origins are in ascending order. returns the number of new, clipped scanlines. */ int miClipSpans(RegionPtr prgnDst, DDXPointPtr ppt, int *pwidth, int nspans, DDXPointPtr pptNew, int *pwidthNew, int fSorted) { register DDXPointPtr pptLast; int *pwidthNewStart; /* the vengeance of Xerox! */ register int y, x1, x2; register int numRects; good(prgnDst); pptLast = ppt + nspans; pwidthNewStart = pwidthNew; if (!prgnDst->data) { /* Do special fast code with clip boundaries in registers(?) */ /* It doesn't pay much to make use of fSorted in this case, so we lump everything together. */ register int clipx1, clipx2, clipy1, clipy2; clipx1 = prgnDst->extents.x1; clipy1 = prgnDst->extents.y1; clipx2 = prgnDst->extents.x2; clipy2 = prgnDst->extents.y2; for (; ppt != pptLast; ppt++, pwidth++) { y = ppt->y; x1 = ppt->x; if (clipy1 <= y && y < clipy2) { x2 = x1 + *pwidth; if (x1 < clipx1) x1 = clipx1; if (x2 > clipx2) x2 = clipx2; if (x1 < x2) { /* part of span in clip rectangle */ pptNew->x = x1; pptNew->y = y; *pwidthNew = x2 - x1; pptNew++; pwidthNew++; } } } /* end for */ } else if ((numRects = prgnDst->data->numRects)) { /* Have to clip against many boxes */ BoxPtr pboxBandStart, pboxBandEnd; register BoxPtr pbox; register BoxPtr pboxLast; register int clipy1, clipy2; /* In this case, taking advantage of sorted spans gains more than the sorting costs. */ if ((! fSorted) && (nspans > 1)) QuickSortSpans(ppt, pwidth, nspans); pboxBandStart = REGION_BOXPTR(prgnDst); pboxLast = pboxBandStart + numRects; NextBand(); for (; ppt != pptLast; ) { y = ppt->y; if (y < clipy2) { /* span is in the current band */ pbox = pboxBandStart; x1 = ppt->x; x2 = x1 + *pwidth; do { /* For each box in band */ register int newx1, newx2; newx1 = x1; newx2 = x2; if (newx1 < pbox->x1) newx1 = pbox->x1; if (newx2 > pbox->x2) newx2 = pbox->x2; if (newx1 < newx2) { /* Part of span in clip rectangle */ pptNew->x = newx1; pptNew->y = y; *pwidthNew = newx2 - newx1; pptNew++; pwidthNew++; } pbox++; } while (pbox != pboxBandEnd); ppt++; pwidth++; } else { /* Move to next band, adjust ppt as needed */ pboxBandStart = pboxBandEnd; if (pboxBandStart == pboxLast) break; /* We're completely done */ NextBand(); } } } return (pwidthNew - pwidthNewStart); } /* find the band in a region with the most rectangles */ int miFindMaxBand(RegionPtr prgn) { register int nbox; register BoxPtr pbox; register int nThisBand; register int nMaxBand = 0; short yThisBand; good(prgn); nbox = REGION_NUM_RECTS(prgn); pbox = REGION_RECTS(prgn); while(nbox > 0) { yThisBand = pbox->y1; nThisBand = 0; while((nbox > 0) && (pbox->y1 == yThisBand)) { nbox--; pbox++; nThisBand++; } if (nThisBand > nMaxBand) nMaxBand = nThisBand; } return (nMaxBand); } ================================================ FILE: OSXvnc-server/mousecursor.c ================================================ /* * mousecursor.c * OSXvnc * * Created by Jonathan Gillaspie on Wed Nov 20 2002. * Copyright (c) 2002 Redstone Software. All rights reserved. * */ #include #include #include #include #include "rfb.h" //#import "rfbproto.h" #include "pthread.h" #include "CGS.h" static int lastCursorSeed = 0; static int maxFailsRemaining = 8; static CGPoint lastCursorPosition; // Cursor Info static unsigned char *cursorData=NULL; static unsigned char *cursorMaskData=NULL; static int cursorRowBytes; static int cursorDataSize; // Size to be sent to client static int cursorMaskSize; // Mask Size to be sent to client static int cursorDepth; static int cursorBitsPerComponent; static CGPoint hotspot; static CGRect cursorRect; static int components; // Cursor Components static rfbPixelFormat cursorFormat; static pthread_mutex_t cursorMutex; // We are only going to access cursor data from the main thread now static CGSConnectionRef sharedConnection = 0; inline CGSConnectionRef getConnection(void) { if (!sharedConnection && maxFailsRemaining > 0) { CGError result = CGSNewConnection(NULL, &sharedConnection); if (result != kCGErrorSuccess) rfbLog("Error obtaining CGSConnection (%u)%s", result, (--maxFailsRemaining ? "" : " -- giving up")); else { maxFailsRemaining = 8; pthread_mutex_init(&cursorMutex, NULL); } } return sharedConnection; } static CGPoint currentCursorLoc(void) { CGPoint cursorLoc={0.0, 0.0}; CGSConnectionRef connection = getConnection(); if (connection) { if (CGSGetCurrentCursorLocation(connection, &cursorLoc) != kCGErrorSuccess) rfbLog("Error obtaining cursor location"); } return cursorLoc; } static void loadCurrentCursorData(void) { CGError err; CGSConnectionRef connection = getConnection(); if (!connection) { if (!maxFailsRemaining) return; } if (CGSGetGlobalCursorDataSize(connection, &cursorDataSize) != kCGErrorSuccess) { rfbLog("Error obtaining cursor data - cursor not sent"); return; } if (cursorData) free(cursorData); cursorData = (unsigned char*)malloc(sizeof(unsigned char) * cursorDataSize); err = CGSGetGlobalCursorData(connection, cursorData, &cursorDataSize, &cursorRowBytes, &cursorRect, &hotspot, &cursorDepth, &components, &cursorBitsPerComponent); //CGSReleaseConnection(connection); if (err != kCGErrorSuccess) { free(cursorData); cursorData = NULL; rfbLog("Error obtaining cursor data - cursor not sent"); return; } cursorFormat.depth = (cursorDepth == 32 ? 24 : cursorDepth); cursorFormat.bitsPerPixel = cursorDepth; cursorFormat.bigEndian = TRUE; cursorFormat.trueColour = TRUE; cursorFormat.redMax = cursorFormat.greenMax = cursorFormat.blueMax = (unsigned short) ((1<> alphaShift; unsigned char alphaThreshold = (0x60) >> alphaShift; // Only include the pixel if it's coverage is greater than this int dataX, dataY, componentIndex; for (dataY = 0; dataY < cursorRect.size.height; dataY++) { unsigned char *cursorColumnData = cursorRowData; for (dataX = 0; dataX < cursorRect.size.width; dataX++) { if (littleEndian) mask = (unsigned char)(*(cursorColumnData+(cursorBytesPerPixel-1))) >> alphaShift; else mask = (unsigned char)(*cursorColumnData) >> alphaShift; if (mask > alphaThreshold) { // Write the Bit For The Mask to be ON (opaque) maskPointer[(dataX/8)] |= (0x0080 >> (dataX % 8)); // Composite Alpha into the cursors other channels - only for 32 bit if (cursorDepth == 32 && mask != fullOn) { for (componentIndex = 0; componentIndex < components; componentIndex++) { *cursorColumnData = (unsigned char) (fullOn - mask + ((*cursorColumnData * mask)/fullOn)) & 0xFF; cursorColumnData++; } } else cursorColumnData += cursorBytesPerPixel; } else cursorColumnData += cursorBytesPerPixel; } maskPointer += (int) floor(((int)cursorRect.size.width+7)/8); cursorRowData += cursorRowBytes; } } } // Just for logging #if 0 // unused void GetCursorInfo(void) { CGSConnectionRef connection = getConnection(); CGError err = noErr; int cursorDataSize, depth, components, bitsPerComponent, cursorRowSize; unsigned char* cursorData; CGPoint location, hotspot; CGRect cursorRect; int i, j; err = CGSGetCurrentCursorLocation(connection, &location); printf("location (err %d) = %d, %d\n", err, (int)location.x, (int)location.y); err = CGSGetGlobalCursorDataSize(connection, &cursorDataSize); printf("data size (err %d) = %d\n", err, cursorDataSize); cursorData = (unsigned char*)calloc(cursorDataSize, sizeof(unsigned char)); err = CGSGetGlobalCursorData(connection, cursorData, &cursorDataSize, &cursorRowSize, &cursorRect, &hotspot, &depth, &components, &bitsPerComponent); printf("rect origin (%g, %g), dimensions (%g, %g)\n", cursorRect.origin.x, cursorRect.origin.y, cursorRect.size.width, cursorRect.size.height); printf("hotspot (%g, %g)\n", hotspot.x, hotspot.y); printf("depth: %d\n", depth); printf("components: %d\n", components); printf("bits per component: %d\n", bitsPerComponent); printf("Bytes Per Row: %d\n", cursorRowSize); printf("Components (err %d):\n", err); // Print Colors for (j=0; j < components; j++) { printf("\n"); for (i=0; i < cursorDataSize; i++) { if (i % cursorRowSize == 0) printf("\n"); if (i % components == j) printf("%02x", (int)cursorData[i]); } } printf("released connection (err %d)\n", CGSReleaseConnection(connection)); } #endif // We call this to see if we have a new cursor and should notify clients to do an update // Or if cursor has moved void rfbCheckForCursorChange(void) { Bool sendNotice = FALSE; CGPoint cursorLoc = currentCursorLoc(); int currentSeed = CGSCurrentCursorSeed(); pthread_mutex_lock(&cursorMutex); if (!CGPointEqualToPoint(lastCursorPosition, cursorLoc)) { lastCursorPosition = cursorLoc; sendNotice = TRUE; } if (lastCursorSeed != currentSeed) { // Record first in case another change occurs after notifying clients lastCursorSeed = currentSeed; loadCurrentCursorData(); sendNotice = TRUE; } pthread_mutex_unlock(&cursorMutex); //rfbLog("Check For Cursor Change"); if (sendNotice) { rfbClientIteratorPtr iterator = rfbGetClientIterator(); rfbClientPtr cl; // Notify each client while ((cl = rfbClientIteratorNext(iterator)) != NULL) { if (rfbShouldSendNewCursor(cl) || (rfbShouldSendNewPosition(cl))) pthread_cond_signal(&cl->updateCond); } rfbReleaseClientIterator(iterator); } } #pragma mark - #pragma mark VNCClientOutput Bool rfbShouldSendNewCursor(rfbClientPtr cl) { if (!cl->useRichCursorEncoding) return FALSE; else return (cl->currentCursorSeed != lastCursorSeed); } Bool rfbShouldSendNewPosition(rfbClientPtr cl) { if (!cl->enableCursorPosUpdates) return FALSE; else { return (!CGPointEqualToPoint(cl->clientCursorLocation,lastCursorPosition)); } } Bool rfbSendCursorPos(rfbClientPtr cl) { rfbFramebufferUpdateRectHeader rect; if (cl->ublen + sz_rfbFramebufferUpdateRectHeader > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } cl->clientCursorLocation = lastCursorPosition; rect.encoding = Swap32IfLE(rfbEncodingPointerPos); rect.r.x = Swap16IfLE((CARD16)cl->clientCursorLocation.x); rect.r.y = Swap16IfLE((CARD16)cl->clientCursorLocation.y); rect.r.w = 0; rect.r.h = 0; memcpy(&cl->updateBuf[cl->ublen], &rect, sz_rfbFramebufferUpdateRectHeader); cl->ublen += sz_rfbFramebufferUpdateRectHeader; cl->rfbRectanglesSent[rfbStatsCursorPosition]++; cl->rfbBytesSent[rfbStatsCursorPosition] += sz_rfbFramebufferUpdateRectHeader; if (!rfbSendUpdateBuf(cl)) return FALSE; return TRUE; } /* Still To Do Problems with occasional artifacts - turning off the cursor didn't seem to help Perhaps if we resend the area where the cursor just was.. // QDGetCursorData */ Bool rfbSendRichCursorUpdate(rfbClientPtr cl) { BOOL cursorIsDifferentFormat = TRUE; BOOL returnValue = TRUE; int cursorSize = 0; pthread_mutex_lock(&cursorMutex); cursorIsDifferentFormat = !(PF_EQ(cursorFormat,rfbServerFormat)); cursorSize = (cursorRect.size.width * cursorRect.size.height * (cl->format.bitsPerPixel / 8)); if (!cursorData || cursorRect.size.height > 128 || cursorRect.size.width > 128) { // Wow That's one big cursor! We don't handle cursors this big // (they are probably cursors with lots of states and that doesn't work so good for VNC. // For now just ignore them cl->currentCursorSeed = lastCursorSeed; returnValue = FALSE; } // Make Sure we have space on the buffer (otherwise push the data out now) if (returnValue && cl->ublen + sz_rfbFramebufferUpdateRectHeader + cursorSize + cursorMaskSize > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) returnValue = FALSE; } if (returnValue) { rfbFramebufferUpdateRectHeader rect; // Send The Header rect.r.x = Swap16IfLE((short) hotspot.x); rect.r.y = Swap16IfLE((short) hotspot.y); rect.r.w = Swap16IfLE((short) cursorRect.size.width); rect.r.h = Swap16IfLE((short) cursorRect.size.height); rect.encoding = Swap32IfLE(rfbEncodingRichCursor); memcpy(&cl->updateBuf[cl->ublen], &rect, sz_rfbFramebufferUpdateRectHeader); cl->ublen += sz_rfbFramebufferUpdateRectHeader; // Temporarily set it to the cursor format if (cursorIsDifferentFormat) rfbSetTranslateFunctionUsingFormat(cl, cursorFormat); // Now Send The Cursor (*cl->translateFn)(cl->translateLookupTable, // The Lookup Table &cursorFormat, // Our Cursor format &cl->format, // Client Format (char *)cursorData, // Data we're sending &cl->updateBuf[cl->ublen], // where to write it cursorRowBytes, // bytesBetweenInputLines cursorRect.size.width, cursorRect.size.height); cl->ublen += cursorSize; if (cursorIsDifferentFormat) rfbSetTranslateFunctionUsingFormat(cl, rfbServerFormat); // Now Send The Cursor Bitmap (1 for on, 0 for clear) memcpy(&cl->updateBuf[cl->ublen], cursorMaskData, cursorMaskSize); cl->ublen += cursorMaskSize; // Update Stats cl->rfbRectanglesSent[rfbStatsRichCursor]++; cl->rfbBytesSent[rfbStatsRichCursor] += sz_rfbFramebufferUpdateRectHeader + cursorSize + cursorMaskSize; cl->currentCursorSeed = lastCursorSeed; } pthread_mutex_unlock(&cursorMutex); return returnValue; } ================================================ FILE: OSXvnc-server/rdr/Exception.h ================================================ // // Copyright (C) 2002 RealVNC Ltd. All Rights Reserved. // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this software; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #ifndef __RDR_EXCEPTION_H__ #define __RDR_EXCEPTION_H__ #include #include namespace rdr { struct Exception { enum { len = 256 }; char str_[len]; Exception(const char* s=0, const char* e="rdr::Exception") { str_[0] = 0; strncat(str_, e, len-1); if (s) { strncat(str_, ": ", len-1-strlen(str_)); strncat(str_, s, len-1-strlen(str_)); } } virtual const char* str() const { return str_; } }; struct SystemException : public Exception { int err; SystemException(const char* s, int err_) : err(err_) { str_[0] = 0; strncat(str_, "rdr::SystemException: ", len-1); strncat(str_, s, len-1-strlen(str_)); strncat(str_, ": ", len-1-strlen(str_)); strncat(str_, strerror(err), len-1-strlen(str_)); strncat(str_, " (", len-1-strlen(str_)); char buf[20]; snprintf(buf, sizeof(buf), "%d", err); strncat(str_, buf, len-1-strlen(str_)); strncat(str_, ")", len-1-strlen(str_)); } }; struct TimedOut : public Exception { TimedOut(const char* s=0) : Exception(s,"rdr::TimedOut") {} }; struct EndOfStream : public Exception { EndOfStream(const char* s=0) : Exception(s,"rdr::EndOfStream") {} }; struct FrameException : public Exception { FrameException(const char* s=0) : Exception(s,"rdr::FrameException") {} }; } #endif ================================================ FILE: OSXvnc-server/rdr/FdInStream.cxx ================================================ // // Copyright (C) 2002 RealVNC Ltd. All Rights Reserved. // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this software; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #include #include #include #include #ifdef _WIN32 #include #include #define read(s,b,l) recv(s,(char*)b,l,0) #undef errno #define errno WSAGetLastError() #else #include #include #endif // XXX should use autoconf HAVE_SYS_SELECT_H #ifdef _AIX #include #endif #include #include using namespace rdr; enum { DEFAULT_BUF_SIZE = 8192, MIN_BULK_SIZE = 1024 }; FdInStream::FdInStream(int fd_, int timeout_, int bufSize_) : fd(fd_), timeout(timeout_), blockCallback(0), blockCallbackArg(0), timing(false), timeWaitedIn100us(5), timedKbits(0), bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0) { ptr = end = start = new U8[bufSize]; } FdInStream::FdInStream(int fd_, void (*blockCallback_)(void*), void* blockCallbackArg_, int bufSize_) : fd(fd_), timeout(0), blockCallback(blockCallback_), blockCallbackArg(blockCallbackArg_), timing(false), timeWaitedIn100us(5), timedKbits(0), bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0) { ptr = end = start = new U8[bufSize]; } FdInStream::~FdInStream() { delete [] start; } size_t FdInStream::pos() { return offset + ptr - start; } void FdInStream::readBytes(void* data, int length) { if (length < MIN_BULK_SIZE) { InStream::readBytes(data, length); return; } U8* dataPtr = (U8*)data; size_t n = end - ptr; if (n > length) n = length; memcpy(dataPtr, ptr, n); dataPtr += n; length -= n; ptr += n; while (length > 0) { n = readWithTimeoutOrCallback(dataPtr, length); dataPtr += n; length -= n; offset += n; } } size_t FdInStream::overrun(size_t itemSize, size_t nItems) { if (itemSize > bufSize) throw Exception("FdInStream overrun: max itemSize exceeded"); if (end - ptr != 0) memmove(start, ptr, end - ptr); offset += ptr - start; end -= ptr - start; ptr = start; while (end < start + itemSize) { ssize_t n = readWithTimeoutOrCallback((U8*)end, start + bufSize - end); end += n; } if (itemSize * nItems > end - ptr) nItems = (end - ptr) / itemSize; return nItems; } int FdInStream::checkReadable(int fd, int timeout) { while (true) { fd_set rfds; struct timeval tv; tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout % 1000) * 1000; FD_ZERO(&rfds); FD_SET(fd, &rfds); int n = select(fd+1, &rfds, 0, 0, &tv); if (n != -1 || errno != EINTR) return n; fprintf(stderr,"select returned EINTR\n"); } } #ifdef _WIN32 static void gettimeofday(struct timeval* tv, void*) { LARGE_INTEGER counts, countsPerSec; static double usecPerCount = 0.0; if (QueryPerformanceCounter(&counts)) { if (usecPerCount == 0.0) { QueryPerformanceFrequency(&countsPerSec); usecPerCount = 1000000.0 / countsPerSec.QuadPart; } LONGLONG usecs = (LONGLONG)(counts.QuadPart * usecPerCount); tv->tv_usec = (long)(usecs % 1000000); tv->tv_sec = (long)(usecs / 1000000); } else { struct timeb tb; ftime(&tb); tv->tv_sec = tb.time; tv->tv_usec = tb.millitm * 1000; } } #endif ssize_t FdInStream::readWithTimeoutOrCallback(void* buf, size_t len) { struct timeval before = {0, 0}; if (timing) gettimeofday(&before, 0); ssize_t n = checkReadable(fd, timeout); if (n < 0) throw SystemException("select",errno); if (n == 0) { if (timeout) throw TimedOut(); if (blockCallback) (*blockCallback)(blockCallbackArg); } while (true) { n = ::read(fd, buf, len); if (n != -1 || errno != EINTR) break; fprintf(stderr,"read returned EINTR\n"); } if (n < 0) throw SystemException("read",errno); if (n == 0) throw EndOfStream(); if (before.tv_sec != 0) { struct timeval after; gettimeofday(&after, 0); // fprintf(stderr,"%d.%06d\n",(after.tv_sec - before.tv_sec), // (after.tv_usec - before.tv_usec)); time_t newTimeWaited = ((after.tv_sec - before.tv_sec) * 10000 + (after.tv_usec - before.tv_usec) / 100); size_t newKbits = n * 8 / 1000; // if (newTimeWaited == 0) { // fprintf(stderr,"new kbps infinite t %d k %d\n", // newTimeWaited, newKbits); // } else { // fprintf(stderr,"new kbps %d t %d k %d\n", // newKbits * 10000 / newTimeWaited, newTimeWaited, newKbits); // } // limit rate to between 10kbit/s and 40Mbit/s if (newTimeWaited > newKbits*1000) newTimeWaited = newKbits*1000; if (newTimeWaited < newKbits/4) newTimeWaited = newKbits/4; timeWaitedIn100us += newTimeWaited; timedKbits += newKbits; } return n; } void FdInStream::startTiming() { timing = true; // Carry over up to 1s worth of previous rate for smoothing. if (timeWaitedIn100us > 10000) { timedKbits = timedKbits * 10000 / timeWaitedIn100us; timeWaitedIn100us = 10000; } } void FdInStream::stopTiming() { timing = false; if (timeWaitedIn100us < timedKbits/2) timeWaitedIn100us = timedKbits/2; // upper limit 20Mbit/s } unsigned int FdInStream::kbitsPerSecond() { // The following calculation will overflow 32-bit arithmetic if we have // received more than about 50Mbytes (400Mbits) since we started timing, so // it should be OK for a single RFB update. return timedKbits * 10000 / timeWaitedIn100us; } ================================================ FILE: OSXvnc-server/rdr/FdInStream.h ================================================ // // Copyright (C) 2002 RealVNC Ltd. All Rights Reserved. // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this software; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. // // FdInStream streams from a file descriptor. // #ifndef __RDR_FDINSTREAM_H__ #define __RDR_FDINSTREAM_H__ #include namespace rdr { class FdInStream : public InStream { public: FdInStream(int fd, int timeout=0, int bufSize=0); FdInStream(int fd, void (*blockCallback)(void*), void* blockCallbackArg=0, int bufSize=0); virtual ~FdInStream(); int getFd() { return fd; } size_t pos(); void readBytes(void* data, int length); size_t bytesInBuf() { return end - ptr; } void startTiming(); void stopTiming(); unsigned int kbitsPerSecond(); unsigned int timeWaited() { return timeWaitedIn100us; } protected: size_t overrun(size_t itemSize, size_t nItems); private: int checkReadable(int fd, int timeout); ssize_t readWithTimeoutOrCallback(void* buf, size_t len); int fd; int timeout; void (*blockCallback)(void*); void* blockCallbackArg; bool timing; unsigned int timeWaitedIn100us; unsigned int timedKbits; int bufSize; int offset; U8* start; }; } // end of namespace rdr #endif ================================================ FILE: OSXvnc-server/rdr/FdOutStream.cxx ================================================ // // Copyright (C) 2002 RealVNC Ltd. All Rights Reserved. // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this software; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #include #include #include #include #ifdef _WIN32 #include #define write(s,b,l) send(s,(const char*)b,l,0) #undef errno #define errno WSAGetLastError() #else #include #include #endif #include #include using namespace rdr; enum { DEFAULT_BUF_SIZE = 16384, MIN_BULK_SIZE = 1024 }; FdOutStream::FdOutStream(int fd_, int bufSize_) : fd(fd_), bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0) { ptr = start = new U8[bufSize]; end = start + bufSize; } FdOutStream::~FdOutStream() { try { flush(); } catch (Exception&) { } delete [] start; } void FdOutStream::writeBytes(const void* data, size_t length) { if (length < MIN_BULK_SIZE) { OutStream::writeBytes(data, length); return; } const U8* dataPtr = (const U8*)data; flush(); while (length > 0) { ssize_t n = write(fd, dataPtr, length); if (n < 0) throw SystemException("write",errno); length -= n; dataPtr += n; offset += n; } } size_t FdOutStream::length() { return offset + ptr - start; } void FdOutStream::flush() { U8* sentUpTo = start; while (sentUpTo < ptr) { ssize_t n = write(fd, (const void*) sentUpTo, ptr - sentUpTo); if (n < 0) throw SystemException("write",errno); sentUpTo += n; offset += n; } ptr = start; } size_t FdOutStream::overrun(size_t itemSize, size_t nItems) { if (itemSize > bufSize) throw Exception("FdOutStream overrun: max itemSize exceeded"); flush(); if (itemSize * nItems > end - ptr) nItems = (end - ptr) / itemSize; return nItems; } ================================================ FILE: OSXvnc-server/rdr/FdOutStream.h ================================================ // // Copyright (C) 2002 RealVNC Ltd. All Rights Reserved. // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this software; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. // // FdOutStream streams to a file descriptor. // #ifndef __RDR_FDOUTSTREAM_H__ #define __RDR_FDOUTSTREAM_H__ #include namespace rdr { class FdOutStream : public OutStream { public: FdOutStream(int fd, int bufSize=0); virtual ~FdOutStream(); int getFd() { return fd; } void flush(); size_t length(); void writeBytes(const void* data, size_t length); private: size_t overrun(size_t itemSize, size_t nItems); int fd; int bufSize; int offset; U8* start; }; } #endif ================================================ FILE: OSXvnc-server/rdr/FixedMemOutStream.h ================================================ // // Copyright (C) 2002 RealVNC Ltd. All Rights Reserved. // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this software; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. // // A FixedMemOutStream writes to a buffer of a fixed length. // #ifndef __RDR_FIXEDMEMOUTSTREAM_H__ #define __RDR_FIXEDMEMOUTSTREAM_H__ #include #include namespace rdr { class FixedMemOutStream : public OutStream { public: FixedMemOutStream(void* buf, int len) { ptr = start = (U8*)buf; end = start + len; } int length() { return ptr - start; } void reposition(int pos) { ptr = start + pos; } const void* data() { return (const void*)start; } private: size_t overrun(size_t itemSize, size_t nItems) { throw EndOfStream(); } U8* start; }; } #endif ================================================ FILE: OSXvnc-server/rdr/InStream.cxx ================================================ // // Copyright (C) 2002 RealVNC Ltd. All Rights Reserved. // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this software; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #include #include using namespace rdr; U32 InStream::maxStringLength = 65535; char* InStream::readString() { U32 len = readU32(); if (len > maxStringLength) throw Exception("InStream max string length exceeded"); char* str = new char[len+1]; readBytes(str, len); str[len] = 0; return str; } ================================================ FILE: OSXvnc-server/rdr/InStream.h ================================================ // // Copyright (C) 2002 RealVNC Ltd. All Rights Reserved. // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this software; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. // // rdr::InStream marshalls data from a buffer stored in RDR (RFB Data // Representation). // #ifndef __RDR_INSTREAM_H__ #define __RDR_INSTREAM_H__ #include #include // for memcpy namespace rdr { class InStream { public: virtual ~InStream() {} // check() ensures there is buffer data for at least one item of size // itemSize bytes. Returns the number of items in the buffer (up to a // maximum of nItems). inline size_t check(size_t itemSize, size_t nItems = 1) { if (ptr + itemSize * nItems > end) { if (ptr + itemSize > end) return overrun(itemSize, nItems); nItems = (end - ptr) / itemSize; } return nItems; } // readU/SN() methods read unsigned and signed N-bit integers. inline U8 readU8() { check(1); return *ptr++; } inline U16 readU16() { check(2); int b0 = *ptr++; int b1 = *ptr++; return b0 << 8 | b1; } inline U32 readU32() { check(4); int b0 = *ptr++; int b1 = *ptr++; int b2 = *ptr++; int b3 = *ptr++; return b0 << 24 | b1 << 16 | b2 << 8 | b3; } inline S8 readS8() { return (S8) readU8(); } inline S16 readS16() { return (S16)readU16(); } inline S32 readS32() { return (S32)readU32(); } // readString() reads a string - a U32 length followed by the data. // Returns a null-terminated string - the caller should delete[] it // afterwards. char* readString(); // maxStringLength protects against allocating a huge buffer. Set it // higher if you need longer strings. static U32 maxStringLength; inline void skip(size_t bytes) { while (bytes > 0) { size_t n = check(1, bytes); ptr += n; bytes -= n; } } // readBytes() reads an exact number of bytes. virtual void readBytes(void* data, int length) { U8* dataPtr = (U8*)data; U8* dataEnd = dataPtr + length; while (dataPtr < dataEnd) { size_t n = check(1, dataEnd - dataPtr); memcpy(dataPtr, ptr, n); ptr += n; dataPtr += n; } } // readOpaqueN() reads a quantity without byte-swapping. inline U8 readOpaque8() { return readU8(); } inline U16 readOpaque16() { check(2); U16 r; ((U8*)&r)[0] = *ptr++; ((U8*)&r)[1] = *ptr++; return r; } inline U32 readOpaque32() { check(4); U32 r; ((U8*)&r)[0] = *ptr++; ((U8*)&r)[1] = *ptr++; ((U8*)&r)[2] = *ptr++; ((U8*)&r)[3] = *ptr++; return r; } inline U32 readOpaque24A() { check(3); U32 r=0; ((U8*)&r)[0] = *ptr++; ((U8*)&r)[1] = *ptr++; ((U8*)&r)[2] = *ptr++; return r; } inline U32 readOpaque24B() { check(3); U32 r=0; ((U8*)&r)[1] = *ptr++; ((U8*)&r)[2] = *ptr++; ((U8*)&r)[3] = *ptr++; return r; } // pos() returns the position in the stream. virtual size_t pos() = 0; // getptr(), getend() and setptr() are "dirty" methods which allow you to // manipulate the buffer directly. This is useful for a stream which is a // wrapper around an underlying stream. inline const U8* getptr() const { return ptr; } inline const U8* getend() const { return end; } inline void setptr(const U8* p) { ptr = p; } private: // overrun() is implemented by a derived class to cope with buffer overrun. // It ensures there are at least itemSize bytes of buffer data. Returns // the number of items in the buffer (up to a maximum of nItems). itemSize // is supposed to be "small" (a few bytes). virtual size_t overrun(size_t itemSize, size_t nItems) = 0; protected: InStream() {} const U8* ptr; const U8* end; }; } #endif ================================================ FILE: OSXvnc-server/rdr/Makefile ================================================ SRCS = FdInStream.cxx FdOutStream.cxx InStream.cxx NullOutStream.cxx \ ZlibInStream.cxx ZlibOutStream.cxx OBJS = $(SRCS:.cxx=.o) DIR_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/zlib library = librdr.a all:: $(library) $(library): $(OBJS) rm -f $(library) $(AR) $(library) $(OBJS) $(RANLIB) $(library) # followed by boilerplate.mk all:: @subdirs="$(SUBDIRS)"; for d in $$subdirs; do (cd $$d; $(MAKE) $@) || exit 1; done clean:: @subdirs="$(SUBDIRS)"; for d in $$subdirs; do (cd $$d; $(MAKE) $@) || exit 1; done clean:: rm -f $(program) $(library) *.o SHELL = /bin/sh top_srcdir = .. CC = gcc CFLAGS = -O2 -Wall -no-cpp-precomp $(DIR_CFLAGS) CCLD = $(CC) CXX = g++ CXXFLAGS = -O2 -Wall CXXLD = $(CXX) CPPFLAGS = DEFS = ALL_CPPFLAGS = $(CPPFLAGS) $(DEFS) $(DIR_CPPFLAGS) LIBS = LDFLAGS = RANLIB = ranlib AR = ar cq .SUFFIXES: .SUFFIXES: .cxx .c .o .c.o: $(CC) $(ALL_CPPFLAGS) $(CFLAGS) -c $< .cxx.o: $(CXX) $(ALL_CPPFLAGS) $(CXXFLAGS) -c $< ================================================ FILE: OSXvnc-server/rdr/Makefile.in ================================================ SRCS = FdInStream.cxx FdOutStream.cxx InStream.cxx NullOutStream.cxx \ ZlibInStream.cxx ZlibOutStream.cxx OBJS = $(SRCS:.cxx=.o) DIR_CPPFLAGS = -I$(top_srcdir) @ZLIB_INCLUDE@ library = librdr.a all:: $(library) $(library): $(OBJS) rm -f $(library) $(AR) $(library) $(OBJS) $(RANLIB) $(library) # followed by boilerplate.mk ================================================ FILE: OSXvnc-server/rdr/MemInStream.h ================================================ // // Copyright (C) 2002 RealVNC Ltd. All Rights Reserved. // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this software; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #ifndef __RDR_MEMINSTREAM_H__ #define __RDR_MEMINSTREAM_H__ #include #include namespace rdr { class MemInStream : public InStream { public: MemInStream(const void* data, int len) { ptr = start = (const U8*)data; end = start + len; } size_t pos() { return ptr - start; } void reposition(int pos) { ptr = start + pos; } private: size_t overrun(size_t itemSize, size_t nItems) { throw EndOfStream(); } const U8* start; }; } #endif ================================================ FILE: OSXvnc-server/rdr/MemOutStream.h ================================================ // // Copyright (C) 2002 RealVNC Ltd. All Rights Reserved. // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this software; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. // // A MemOutStream grows as needed when data is written to it. // #ifndef __RDR_MEMOUTSTREAM_H__ #define __RDR_MEMOUTSTREAM_H__ #include namespace rdr { class MemOutStream : public OutStream { public: MemOutStream(int len=1024) { start = ptr = new U8[len]; end = start + len; } virtual ~MemOutStream() { delete [] start; } void writeBytes(const void* data, size_t length) { check(length); memcpy(ptr, data, length); ptr += length; } size_t length() { return ptr - start; } void clear() { ptr = start; }; void reposition(int pos) { ptr = start + pos; } // data() returns a pointer to the buffer. const void* data() { return (const void*)start; } private: // overrun() either doubles the buffer or adds enough space for nItems of // size itemSize bytes. size_t overrun(size_t itemSize, size_t nItems) { ssize_t len = ptr - start + itemSize * nItems; if (len < (end - start) * 2) len = (end - start) * 2; U8* newStart = new U8[len]; memcpy(newStart, start, ptr - start); ptr = newStart + (ptr - start); delete [] start; start = newStart; end = newStart + len; return nItems; } U8* start; }; } #endif ================================================ FILE: OSXvnc-server/rdr/NullOutStream.cxx ================================================ // // Copyright (C) 2002 RealVNC Ltd. All Rights Reserved. // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this software; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #include #include using namespace rdr; static const int bufferSize = 1024; NullOutStream::NullOutStream() : offset(0) { start = ptr = new U8[bufferSize]; end = start + bufferSize; } NullOutStream::~NullOutStream() { delete [] start; } size_t NullOutStream::length() { return offset + ptr - start; } void NullOutStream::writeBytes(const void* data, size_t length) { offset += length; } size_t NullOutStream::overrun(size_t itemSize, size_t nItems) { if (itemSize > bufferSize) throw Exception("NullOutStream overrun: max itemSize exceeded"); offset += ptr - start; ptr = start; if (itemSize * nItems > end - ptr) nItems = (end - ptr) / itemSize; return nItems; } ================================================ FILE: OSXvnc-server/rdr/NullOutStream.h ================================================ // // Copyright (C) 2002 RealVNC Ltd. All Rights Reserved. // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this software; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #ifndef __RDR_NULLOUTSTREAM_H__ #define __RDR_NULLOUTSTREAM_H__ #include namespace rdr { class NullOutStream : public OutStream { public: NullOutStream(); virtual ~NullOutStream(); size_t length(); void writeBytes(const void* data, size_t length); private: size_t overrun(size_t itemSize, size_t nItems); int offset; U8* start; }; } #endif ================================================ FILE: OSXvnc-server/rdr/OutStream.h ================================================ // // Copyright (C) 2002 RealVNC Ltd. All Rights Reserved. // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this software; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. // // rdr::OutStream marshalls data into a buffer stored in RDR (RFB Data // Representation). // #ifndef __RDR_OUTSTREAM_H__ #define __RDR_OUTSTREAM_H__ #include #include // for memcpy namespace rdr { class OutStream { protected: OutStream() {} public: virtual ~OutStream() {} // check() ensures there is buffer space for at least one item of size // itemSize bytes. Returns the number of items which fit (up to a maximum // of nItems). inline size_t check(size_t itemSize, size_t nItems = 1) { if (ptr + itemSize * nItems > end) { if (ptr + itemSize > end) return overrun(itemSize, nItems); nItems = (end - ptr) / itemSize; } return nItems; } // writeU/SN() methods write unsigned and signed N-bit integers. inline void writeU8( U8 u) { check(1); *ptr++ = u; } inline void writeU16(U16 u) { check(2); *ptr++ = u >> 8; *ptr++ = (U8)u; } inline void writeU32(U32 u) { check(4); *ptr++ = u >> 24; *ptr++ = u >> 16; *ptr++ = u >> 8; *ptr++ = u; } inline void writeS8( S8 s) { writeU8((U8)s); } inline void writeS16(S16 s) { writeU16((U16)s); } inline void writeS32(S32 s) { writeU32((U32)s); } // writeString() writes a string - a U32 length followed by the data. The // given string should be null-terminated (but the terminating null is not // written to the stream). inline void writeString(const char* str) { size_t len = strlen(str); writeU32((U32)len); writeBytes(str, len); } inline void pad(int bytes) { while (bytes-- > 0) writeU8(0); } inline void skip(int bytes) { while (bytes > 0) { size_t n = check(1, bytes); ptr += n; bytes -= n; } } // writeBytes() writes an exact number of bytes. virtual void writeBytes(const void* data, size_t length) { const U8* dataPtr = (const U8*)data; const U8* dataEnd = dataPtr + length; while (dataPtr < dataEnd) { size_t n = check(1, dataEnd - dataPtr); memcpy(ptr, dataPtr, n); ptr += n; dataPtr += n; } } // writeOpaqueN() writes a quantity without byte-swapping. inline void writeOpaque8( U8 u) { writeU8(u); } inline void writeOpaque16(U16 u) { check(2); *ptr++ = ((U8*)&u)[0]; *ptr++ = ((U8*)&u)[1]; } inline void writeOpaque32(U32 u) { check(4); *ptr++ = ((U8*)&u)[0]; *ptr++ = ((U8*)&u)[1]; *ptr++ = ((U8*)&u)[2]; *ptr++ = ((U8*)&u)[3]; } inline void writeOpaque24A(U32 u) { check(3); *ptr++ = ((U8*)&u)[0]; *ptr++ = ((U8*)&u)[1]; *ptr++ = ((U8*)&u)[2]; } inline void writeOpaque24B(U32 u) { check(3); *ptr++ = ((U8*)&u)[1]; *ptr++ = ((U8*)&u)[2]; *ptr++ = ((U8*)&u)[3]; } // length() returns the length of the stream. virtual size_t length() = 0; // flush() requests that the stream be flushed. virtual void flush() {} // getptr(), getend() and setptr() are "dirty" methods which allow you to // manipulate the buffer directly. This is useful for a stream which is a // wrapper around an underlying stream. inline U8* getptr() { return ptr; } inline U8* getend() { return end; } inline void setptr(U8* p) { ptr = p; } private: // overrun() is implemented by a derived class to cope with buffer overrun. // It ensures there are at least itemSize bytes of buffer space. Returns // the number of items which fit (up to a maximum of nItems). itemSize is // supposed to be "small" (a few bytes). virtual size_t overrun(size_t itemSize, size_t nItems) = 0; protected: U8* ptr; U8* end; }; } #endif ================================================ FILE: OSXvnc-server/rdr/ZlibInStream.cxx ================================================ // // Copyright (C) 2002 RealVNC Ltd. All Rights Reserved. // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this software; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #include #include #include using namespace rdr; enum { DEFAULT_BUF_SIZE = 16384 }; ZlibInStream::ZlibInStream(int bufSize_) : underlying(0), bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0), bytesIn(0) { zs = new z_stream; zs->zalloc = Z_NULL; zs->zfree = Z_NULL; zs->opaque = Z_NULL; zs->next_in = Z_NULL; zs->avail_in = 0; if (inflateInit(zs) != Z_OK) { delete zs; throw Exception("ZlibInStream: inflateInit failed"); } ptr = end = start = new U8[bufSize]; } ZlibInStream::~ZlibInStream() { delete [] start; inflateEnd(zs); delete zs; } void ZlibInStream::setUnderlying(InStream* is, int bytesIn_) { underlying = is; bytesIn = bytesIn_; ptr = end = start; } size_t ZlibInStream::pos() { return offset + ptr - start; } void ZlibInStream::reset() { ptr = end = start; if (!underlying) return; while (bytesIn > 0) { decompress(); end = start; // throw away any data } underlying = 0; } size_t ZlibInStream::overrun(size_t itemSize, size_t nItems) { if (itemSize > bufSize) throw Exception("ZlibInStream overrun: max itemSize exceeded"); if (!underlying) throw Exception("ZlibInStream overrun: no underlying stream"); if (end - ptr != 0) memmove(start, ptr, end - ptr); offset += ptr - start; end -= ptr - start; ptr = start; while (end - ptr < itemSize) { decompress(); } if (itemSize * nItems > end - ptr) nItems = (end - ptr) / itemSize; return nItems; } // decompress() calls the decompressor once. Note that this won't necessarily // generate any output data - it may just consume some input data. void ZlibInStream::decompress() { zs->next_out = (U8*)end; zs->avail_out = unsigned(start + bufSize - end); underlying->check(1); zs->next_in = (U8*)underlying->getptr(); zs->avail_in = unsigned(underlying->getend() - underlying->getptr()); if ((int)zs->avail_in > bytesIn) zs->avail_in = bytesIn; int rc = inflate(zs, Z_SYNC_FLUSH); if (rc != Z_OK) { throw Exception("ZlibInStream: inflate failed"); } bytesIn -= zs->next_in - underlying->getptr(); end = zs->next_out; underlying->setptr(zs->next_in); } ================================================ FILE: OSXvnc-server/rdr/ZlibInStream.h ================================================ // // Copyright (C) 2002 RealVNC Ltd. All Rights Reserved. // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this software; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. // // ZlibInStream streams from a compressed data stream ("underlying"), // decompressing with zlib on the fly. // #ifndef __RDR_ZLIBINSTREAM_H__ #define __RDR_ZLIBINSTREAM_H__ #include struct z_stream_s; namespace rdr { class ZlibInStream : public InStream { public: ZlibInStream(int bufSize=0); virtual ~ZlibInStream(); void setUnderlying(InStream* is, int bytesIn); void reset(); size_t pos(); private: size_t overrun(size_t itemSize, size_t nItems); void decompress(); InStream* underlying; int bufSize; int offset; z_stream_s* zs; int bytesIn; U8* start; }; } // end of namespace rdr #endif ================================================ FILE: OSXvnc-server/rdr/ZlibOutStream.cxx ================================================ // // Copyright (C) 2002 RealVNC Ltd. All Rights Reserved. // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this software; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #include #include #include using namespace rdr; enum { DEFAULT_BUF_SIZE = 16384 }; ZlibOutStream::ZlibOutStream(OutStream* os, int bufSize_) : underlying(os), bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0) { zs = new z_stream; zs->zalloc = Z_NULL; zs->zfree = Z_NULL; zs->opaque = Z_NULL; if (deflateInit(zs, Z_DEFAULT_COMPRESSION) != Z_OK) { delete zs; throw Exception("ZlibOutStream: deflateInit failed"); } ptr = start = new U8[bufSize]; end = start + bufSize; } ZlibOutStream::~ZlibOutStream() { try { flush(); } catch (Exception&) { } delete [] start; deflateEnd(zs); delete zs; } void ZlibOutStream::setUnderlying(OutStream* os) { underlying = os; } size_t ZlibOutStream::length() { return offset + ptr - start; } void ZlibOutStream::flush() { zs->next_in = start; zs->avail_in = unsigned(ptr - start); // fprintf(stderr,"zos flush: avail_in %d\n",zs->avail_in); while (zs->avail_in != 0) { do { underlying->check(1); zs->next_out = underlying->getptr(); zs->avail_out = unsigned(underlying->getend() - underlying->getptr()); // fprintf(stderr,"zos flush: calling deflate, avail_in %d, avail_out %d\n", // zs->avail_in,zs->avail_out); int rc = deflate(zs, Z_SYNC_FLUSH); if (rc != Z_OK) throw Exception("ZlibOutStream: deflate failed"); // fprintf(stderr,"zos flush: after deflate: %d bytes\n", // zs->next_out-underlying->getptr()); underlying->setptr(zs->next_out); } while (zs->avail_out == 0); } offset += ptr - start; ptr = start; } size_t ZlibOutStream::overrun(size_t itemSize, size_t nItems) { // fprintf(stderr,"ZlibOutStream overrun\n"); if (itemSize > bufSize) throw Exception("ZlibOutStream overrun: max itemSize exceeded"); while (end - ptr < itemSize) { zs->next_in = start; zs->avail_in = unsigned(ptr - start); do { underlying->check(1); zs->next_out = underlying->getptr(); zs->avail_out = unsigned(underlying->getend() - underlying->getptr()); // fprintf(stderr,"zos overrun: calling deflate, avail_in %d, avail_out %d\n", // zs->avail_in,zs->avail_out); int rc = deflate(zs, 0); if (rc != Z_OK) throw Exception("ZlibOutStream: deflate failed"); // fprintf(stderr,"zos overrun: after deflate: %d bytes\n", // zs->next_out-underlying->getptr()); underlying->setptr(zs->next_out); } while (zs->avail_out == 0); // output buffer not full if (zs->avail_in == 0) { offset += ptr - start; ptr = start; } else { // but didn't consume all the data? try shifting what's left to the // start of the buffer. fprintf(stderr,"z out buf not full, but in data not consumed\n"); memmove(start, zs->next_in, ptr - zs->next_in); offset += zs->next_in - start; ptr -= zs->next_in - start; } } if (itemSize * nItems > end - ptr) nItems = (end - ptr) / itemSize; return nItems; } ================================================ FILE: OSXvnc-server/rdr/ZlibOutStream.h ================================================ // // Copyright (C) 2002 RealVNC Ltd. All Rights Reserved. // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this software; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. // // ZlibOutStream streams to a compressed data stream (underlying), compressing // with zlib on the fly. // #ifndef __RDR_ZLIBOUTSTREAM_H__ #define __RDR_ZLIBOUTSTREAM_H__ #include struct z_stream_s; namespace rdr { class ZlibOutStream : public OutStream { public: ZlibOutStream(OutStream* os=0, int bufSize=0); virtual ~ZlibOutStream(); void setUnderlying(OutStream* os); void flush(); size_t length(); private: size_t overrun(size_t itemSize, size_t nItems); OutStream* underlying; int bufSize; int offset; z_stream_s* zs; U8* start; }; } // end of namespace rdr #endif ================================================ FILE: OSXvnc-server/rdr/types.h ================================================ // // Copyright (C) 2002 RealVNC Ltd. All Rights Reserved. // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this software; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. #ifndef __RDR_TYPES_H__ #define __RDR_TYPES_H__ namespace rdr { typedef unsigned char U8; typedef unsigned short U16; typedef unsigned int U32; typedef signed char S8; typedef signed short S16; typedef signed int S32; }; // end of namespace rdr #endif ================================================ FILE: OSXvnc-server/rfb.h ================================================ /* * rfb.h - header file for RFB DDX implementation. */ /* * OSXvnc Copyright (C) 2001 * OSXvnc Copyright (C) 2002-2004 Redstone Software osxvnc@redstonesoftware.comGuirk . * Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge. * All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include "scrnintstr.h" /* trying to replace the above with some more minimal set of includes */ #include "misc.h" #include "Xmd.h" #include "regionstr.h" #include #include #include #include #include #include "tight.h" #import "screencapture.h" //#include "Keyboards.h" //#import //#include #include "CoreGraphics/CGGeometry.h" #include #define MAX_ENCODINGS 17 /* * Per-screen (framebuffer) structure. There is only one of these, since we * don't allow the X server to have multiple screens. */ typedef struct { int width; int paddedWidthInBytes; int height; int depth; int bitsPerPixel; int sizeInBytes; } rfbScreenInfo, *rfbScreenInfoPtr; /* * rfbTranslateFnType is the type of translation functions. */ struct rfbClientRec; typedef void (*rfbTranslateFnType)(char *table, rfbPixelFormat *in, rfbPixelFormat *out, char *iptr, char *optr, int bytesBetweenInputLines, int width, int height); /* * Per-client structure. */ enum client_state { RFB_PROTOCOL_VERSION, /* establishing protocol version */ RFB_AUTH_VERSION, /* establishing authentication version (3.7) */ RFB_AUTHENTICATION, /* authenticating */ RFB_INITIALISATION, /* sending initialisation messages */ RFB_NORMAL /* normal protocol messages */ } ; typedef struct rfbClientRec { int sock; char *host; // Version int major, minor; pthread_mutex_t outputMutex; /* Possible client states: */ enum client_state state; int correMaxWidth, correMaxHeight; void* zrleData; void* mosData; /* The following member is only used during VNC authentication */ CARD8 authChallenge[CHALLENGESIZE]; /* The following members represent the update needed to get the client's framebuffer from its present state to the current state of our framebuffer. The update is simply represented as the region of the screen which has been modified (modifiedRegion). CopyRect is not supported, because there's no way I can get the OS to tell me something has been copied. updateMutex should be held, and updateCond signalled, whenever either modifiedRegion or requestedRegion is changed (as either of these may trigger sending an update out to the client). */ pthread_mutex_t updateMutex; pthread_cond_t updateCond; RegionRec modifiedRegion; /* As part of the FramebufferUpdateRequest, a client can express interest in a subrectangle of the whole framebuffer. This is stored in the requestedRegion member. In the normal case this is the whole framebuffer if the client is ready, empty if it's not. */ RegionRec requestedRegion; /* translateFn points to the translation function which is used to copy and translate a rectangle from the framebuffer to an output buffer. */ rfbTranslateFnType translateFn; char *translateLookupTable; rfbPixelFormat format; /* SERVER SCALING EXTENSIONS */ int scalingFactor; char* screenBuffer; char* scalingFrameBuffer; int scalingPaddedWidthInBytes; /* statistics */ int rfbBytesSent[MAX_ENCODINGS]; int rfbRectanglesSent[MAX_ENCODINGS]; int rfbLastRectMarkersSent; int rfbLastRectBytesSent; int rfbFramebufferUpdateMessagesSent; int rfbRawBytesEquivalent; int rfbKeyEventsRcvd; int rfbPointerEventsRcvd; /* zlib encoding -- necessary compression state info per client */ struct z_stream_s compStream; Bool compStreamInited; CARD32 zlibCompressLevel; struct z_stream_s compStreamRaw; struct z_stream_s compStreamHex; /* * zlibBeforeBuf contains pixel data in the client's format. * zlibAfterBuf contains the zlib (deflated) encoding version. * If the zlib compressed/encoded version is * larger than the raw data or if it exceeds zlibAfterBufSize then * raw encoding is used instead. */ int client_zlibBeforeBufSize; char *client_zlibBeforeBuf; int client_zlibAfterBufSize; char *client_zlibAfterBuf; int client_zlibAfterBufLen; // These defines will "hopefully" allow us to keep the rest of the code looking roughly the same // but reference them out of the client record pointer, where they need to be, instead of as globals #define zlibBeforeBufSize cl->client_zlibBeforeBufSize #define zlibBeforeBuf cl->client_zlibBeforeBuf #define zlibAfterBufSize cl->client_zlibAfterBufSize #define zlibAfterBuf cl->client_zlibAfterBuf #define zlibAfterBufLen cl->client_zlibAfterBufLen /* tight encoding -- preserve zlib streams' state for each client */ z_stream zsStruct[4]; Bool zsActive[4]; int zsLevel[4]; int tightCompressLevel; int tightQualityLevel; Bool enableLastRectEncoding; /* client supports LastRect encoding */ Bool enableXCursorShapeUpdates; /* client supports XCursor shape updates - Tight */ Bool useRichCursorEncoding; /* rfbEncodingRichCursor is preferred : Tight and RFB - 3.7 */ Bool enableCursorPosUpdates; /* client supports PointerPos updates - Tight */ Bool desktopSizeUpdate; /* client supports dynamic desktop updates - Tight and RFB 3.7 */ Bool reverseConnection; Bool readyForSetColourMapEntries; Bool useCopyRect; int preferredEncoding; /* tight encoding -- This variable is set on every rfbSendRectEncodingTight() call. */ Bool usePixelFormat24; /* tight encoding -- Compression level stuff. */ int compressLevel; int qualityLevel; /* tight encoding -- Stuff dealing with palettes. */ int paletteNumColors, paletteMaxColors; CARD32 monoBackground, monoForeground; PALETTE palette; /* tight encoding -- Pointers to dynamically-allocated buffers. */ int tightBeforeBufSize; char *tightBeforeBuf; int tightAfterBufSize; char *tightAfterBuf; int *prevRowBuf; /* tight encoding -- JPEG compression stuff. */ struct jpeg_destination_mgr jpegDstManager; Bool jpegError; int jpegDstDataLen; j_compress_ptr cinfo; /* tight encoding -- GetClient() uses this to map cinfos to client records */ // These defines will "hopefully" allow us to keep the rest of the code looking roughly the same // but reference them out of the client record pointer, where they need to be, instead of as globals #define usePixelFormat24 cl->usePixelFormat24 #define compressLevel cl->compressLevel #define qualityLevel cl->qualityLevel #define paletteNumColors cl->paletteNumColors #define paletteMaxColors cl->paletteMaxColors #define monoBackground cl->monoBackground #define monoForeground cl->monoForeground #define tightBeforeBufSize cl->tightBeforeBufSize #define tightBeforeBuf cl->tightBeforeBuf #define tightAfterBufSize cl->tightAfterBufSize #define tightAfterBuf cl->tightAfterBuf #define prevRowBuf cl->prevRowBuf #define jpegDstManager cl->jpegDstManager #define jpegError cl->jpegError #define jpegDstDataLen cl->jpegDstDataLen /* ZRLE -- Zlib Run Length Encoding Variable Space */ char client_zrleBeforeBuf[rfbZRLETileWidth * rfbZRLETileHeight * 4 + 4]; /* REDSTONE - Adding some features */ Bool disableRemoteEvents; // Ignore PB, Keyboard and Mouse events Bool swapMouseButtons23; // How to interpret mouse buttons 2 & 3 Bool immediateUpdate; // To request that we get immediate updates (even 0 rects) Bool richClipboardSupport; // Client has indicated they support rich clipboards void *richClipboardChangeCounts; // Dictionary of local ChangeCount NSNumbers stored by PB Name /* These store temporary values during a rich clipboard transfer (one at a time per client) */ void *clipboardProxy; char *richClipboardName; char *richClipboardType; void *richClipboardNSData; int richClipboardDataChangeCount; void *richClipboardReceivedName; void *richClipboardReceivedType; void *richClipboardReceivedNSData; void *receivedFileTempFolder; int richClipboardReceivedChangeCount; int generalPBLastChange; // Used to see if we need to send the latest general PB // Cursor Info int currentCursorSeed; // Used to see if we need to send a new cursor CGPoint clientCursorLocation; // The last location the client left the mouse at BOOL needNewScreenSize; // Flag to indicate we must send a new screen resolution BOOL modiferKeys[256]; // BOOL Array to record which keys THIS user has down, if they disconnect we will release those keys /* REDSTONE - These (updateBuf, ublen) need to be in the CL, not global, for multiple clients */ screen_data_t * p_data; /* * UPDATE_BUF_SIZE must be big enough to send at least one whole line of the * framebuffer. So for a max screen width of say 2K with 32-bit pixels this * means 8K minimum. */ #define UPDATE_BUF_SIZE 30000 char updateBuf[UPDATE_BUF_SIZE]; uint32_t ublen; struct rfbClientRec *prev; struct rfbClientRec *next; } rfbClientRec, *rfbClientPtr; /* * This macro creates an empty region (ie. a region with no areas) if it is * given a rectangle with a width or height of zero. It appears that * REGION_INTERSECT does not quite do the right thing with zero-width * rectangles, but it should with completely empty regions. */ #define SAFE_REGION_INIT(pscreen, preg, rect, size) \ { \ if ( ( (rect) ) && \ ( ( (rect)->x2 == (rect)->x1 ) || \ ( (rect)->y2 == (rect)->y1 ) ) ) { \ REGION_INIT( (pscreen), (preg), NullBox, 0 ); \ } else { \ REGION_INIT( (pscreen), (preg), (rect), (size) ); \ } \ } /* * Macros for endian swapping. */ #define Swap16(s) ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) #define Swap32(l) (((l) >> 24) | \ (((l) & 0x00ff0000) >> 8) | \ (((l) & 0x0000ff00) << 8) | \ ((l) << 24)) // NSByteOrder.h // kCGBitmapByteOrder32Host __i386__ __ppc__ // kCGBitmapByteOrder16Big AC_C_BIGENDIAN // #define rfbEndianTest (0) #include #define Swap16IfLE(s) htons(s) #define Swap32IfLE(l) htonl(l) /* main.c */ extern unsigned rfbProtocolMajorVersion; extern unsigned rfbProtocolMinorVersion; extern unsigned rfbPort; extern char *rfbGetFramebuffer(void); extern void rfbGetFramebufferUpdateInRect(int x, int y, int w, int h); extern void rfbStartClientWithFD(int client_fd); extern void connectReverseClient(char *hostName, int portNum); extern rfbScreenInfo rfbScreen; extern char desktopName[256]; extern BOOL littleEndian; extern int rfbMaxBitDepth; extern Bool rfbAlwaysShared; extern Bool rfbNeverShared; extern Bool rfbDontDisconnect; extern Bool rfbReverseMods; extern Bool rfbSwapButtons; extern Bool rfbDisableRemote; extern Bool rfbDisableRichClipboards; extern Bool rfbLocalBuffer; extern void rfbLog(char *format, ...); extern void rfbDebugLog(char *format, ...); extern void rfbLogPerror(char *str); extern void rfbShutdown(void); /* sockets.c */ extern int rfbMaxClientWait; extern void rfbCloseClient(rfbClientPtr cl); extern int ReadExact(rfbClientPtr cl, void *buf, size_t len); extern int WriteExact(rfbClientPtr cl, const void *buf, size_t len); /* cutpaste.c */ extern void initPasteboard(void); extern void initPasteboardForClient(rfbClientPtr cl); extern void freePasteboardForClient(rfbClientPtr cl); extern void rfbSetCutText(rfbClientPtr cl, char *str, int len); extern void rfbCheckForPasteboardChange(void); extern void rfbClientUpdatePasteboard(rfbClientPtr cl); extern void rfbReceiveRichClipboardAvailable(rfbClientPtr cl); extern void rfbReceiveRichClipboardRequest(rfbClientPtr cl); extern void rfbReceiveRichClipboardData(rfbClientPtr cl); /* kbdptr.c */ extern void PtrAddEvent(int buttonMask, int x, int y, rfbClientPtr cl); extern void KbdAddEvent(Bool down, KeySym keySym, rfbClientPtr cl); extern void keyboardReleaseKeysForClient(rfbClientPtr cl); /* rfbserver.c */ //extern char updateBuf[UPDATE_BUF_SIZE]; //extern int ublen; extern rfbClientPtr pointerClient; extern rfbClientPtr rfbClientHead; /* tight encoding -- GetClient() in tight.c accesses this list, so make it global */ extern void rfbProcessClientProtocolVersion(rfbClientPtr cl); extern void rfbProcessClientNormalMessage(rfbClientPtr cl); extern void rfbProcessClientInitMessage(rfbClientPtr cl); extern Bool rfbSendScreenUpdateEncoding(rfbClientPtr cl); extern Bool rfbSendLastRectMarker(rfbClientPtr cl); /* Routines to iterate over the client list in a thread-safe way. Only a single iterator can be in use at a time process-wide. */ typedef struct rfbClientIterator *rfbClientIteratorPtr; extern void rfbClientListInit(void); extern rfbClientIteratorPtr rfbGetClientIterator(void); extern rfbClientPtr rfbClientIteratorNext(rfbClientIteratorPtr iterator); extern void rfbReleaseClientIterator(rfbClientIteratorPtr iterator); extern Bool rfbClientsConnected(void); extern void rfbNewClientConnection(int sock); extern rfbClientPtr rfbNewClient(int sock); extern rfbClientPtr rfbReverseConnection(char *host, int port); extern void rfbClientConnectionGone(rfbClientPtr cl); extern void rfbProcessClientMessage(rfbClientPtr cl); extern void rfbClientConnFailed(rfbClientPtr cl, char *reason); extern void rfbNewUDPConnection(int sock); extern void rfbProcessUDPInput(int sock); extern Bool rfbSendFramebufferUpdate(rfbClientPtr cl, RegionRec updateRegion); extern Bool rfbSendRectEncodingRaw(rfbClientPtr cl, int x,int y,int w,int h); extern Bool rfbSendUpdateBuf(rfbClientPtr cl); extern void rfbSendServerCutText(rfbClientPtr cl, char *str, size_t len); extern void setScaling (rfbClientPtr cl); /* translate.c */ /* * Macro to compare pixel formats. */ #define PF_EQ(x,y) \ ((x.bitsPerPixel == y.bitsPerPixel) && \ (x.depth == y.depth) && \ ((x.bigEndian == y.bigEndian) || (x.bitsPerPixel == 8)) && \ (x.trueColour == y.trueColour) && \ (!x.trueColour || ((x.redMax == y.redMax) && \ (x.greenMax == y.greenMax) && \ (x.blueMax == y.blueMax) && \ (x.redShift == y.redShift) && \ (x.greenShift == y.greenShift) && \ (x.blueShift == y.blueShift)))) extern Bool rfbEconomicTranslate; extern rfbPixelFormat rfbServerFormat; extern void rfbTranslateNone(char *table, rfbPixelFormat *in, rfbPixelFormat *out, char *iptr, char *optr, int bytesBetweenInputLines, int width, int height); extern Bool rfbSetTranslateFunction(rfbClientPtr cl); extern Bool rfbSetTranslateFunctionUsingFormat(rfbClientPtr cl, rfbPixelFormat inFormat); extern void PrintPixelFormat(rfbPixelFormat *pf); /* httpd.c */ extern int httpPort; extern char *httpDir; extern void httpInitSockets(void); extern void httpCheckFds(void); /* auth.c */ extern Bool allowNoAuth; extern char *rfbAuthPasswdFile; extern Bool rfbAuthenticating; extern int rfbMaxLoginAttempts; extern void rfbAuthInit(void); extern void rfbAuthNewClient(rfbClientPtr cl); extern void rfbProcessAuthVersion(rfbClientPtr cl); extern void rfbAuthProcessClientMessage(rfbClientPtr cl); extern bool enterSuppliedPassword(char *passIn); /* rre.c */ extern Bool rfbSendRectEncodingRRE(rfbClientPtr cl, int x,int y,int w,int h); /* corre.c */ extern Bool rfbSendRectEncodingCoRRE(rfbClientPtr cl, int x,int y,int w,int h); /* hextile.c */ extern Bool rfbSendRectEncodingHextile(rfbClientPtr cl, int x, int y, int w, int h); /* zlib.c */ /* Minimum zlib rectangle size in bytes. Anything smaller will * not compress well due to overhead. */ #define VNC_ENCODE_ZLIB_MIN_COMP_SIZE (17) /* Set maximum zlib rectangle size in pixels. Always allow at least * two scan lines. */ #define ZLIB_MAX_RECT_SIZE (128*256) #define ZLIB_MAX_SIZE(min) ((( min * 2 ) > ZLIB_MAX_RECT_SIZE ) ? \ ( min * 2 ) : ZLIB_MAX_RECT_SIZE ) extern Bool rfbSendRectEncodingZlib(rfbClientPtr cl, int x, int y, int w, int h); /* tight.c */ #define TIGHT_DEFAULT_COMPRESSION 6 extern Bool rfbTightDisableGradient; extern int rfbNumCodedRectsTight(rfbClientPtr cl, int x,int y,int w,int h); extern Bool rfbSendRectEncodingTight(rfbClientPtr cl, int x,int y,int w,int h); /* zlibhex.c */ /* Minimum zlibhex tile size in bytes. Anything smaller will * not compress well due to overhead. */ #define VNC_ENCODE_ZLIBHEX_MIN_COMP_SIZE (17) /* Compressor state uninitialized value. Changed after one time * initialization. */ #define ZLIBHEX_COMP_UNINITED (-1) extern Bool rfbSendRectEncodingZlibHex(rfbClientPtr cl, int x, int y, int w, int h); /* zrle.c */ extern Bool rfbSendRectEncodingZRLE(rfbClientPtr cl, int x, int y, int w, int h); extern void FreeZrleData(rfbClientPtr cl); /* stats.c */ extern char* encNames[]; extern void rfbResetStats(rfbClientPtr cl); extern void rfbPrintStats(rfbClientPtr cl); /* dimming.c */ extern Bool rfbNoDimming; extern Bool rfbNoSleep; extern IOPMAssertionID userActivityLastAssertionId; extern int rfbDimmingInit(void); extern int rfbUndim(void); extern int rfbDimmingShutdown(void); /* mousecursor.c */ extern void GetCursorInfo(void); extern void rfbCheckForCursorChange(void); extern Bool rfbShouldSendNewCursor(rfbClientPtr cl); extern Bool rfbShouldSendNewPosition(rfbClientPtr cl); extern Bool rfbSendRichCursorUpdate(rfbClientPtr cl); extern Bool rfbSendCursorPos(rfbClientPtr cl); /* screencapture.c */ screen_data_t *screen_InitCapture(void); extern char *screen_Capture (screen_data_t *p_data); extern void screen_CloseCapture (screen_data_t *p_data); ================================================ FILE: OSXvnc-server/rfbproto.h ================================================ /* * Copyright (C) 2002 RealVNC Ltd. All Rights Reserved. * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ /* * rfbproto.h - header file for the RFB protocol version 3.3 * * Uses types CARD for an n-bit unsigned integer, INT for an n-bit signed * integer (for n = 8, 16 and 32). * * All multiple byte integers are in big endian (network) order (most * significant byte first). Unless noted otherwise there is no special * alignment of protocol structures. * * * Once the initial handshaking is done, all messages start with a type byte, * (usually) followed by message-specific data. The order of definitions in * this file is as follows: * * (1) Structures used in several types of message. * (2) Structures used in the initial handshaking. * (3) Message types. * (4) Encoding types. * (5) For each message type, the form of the data following the type byte. * Sometimes this is defined by a single structure but the more complex * messages have to be explained by comments. */ /***************************************************************************** * * Structures used in several messages * *****************************************************************************/ /*----------------------------------------------------------------------------- * Structure used to specify a rectangle. This structure is a multiple of 4 * bytes so that it can be interspersed with 32-bit pixel data without * affecting alignment. */ typedef struct { CARD16 x; CARD16 y; CARD16 w; CARD16 h; } rfbRectangle; #define sz_rfbRectangle 8 /*----------------------------------------------------------------------------- * Structure used to specify pixel format. */ typedef struct { CARD8 bitsPerPixel; /* 8,16,32 only */ CARD8 depth; /* 8 to 32 */ CARD8 bigEndian; /* True if multi-byte pixels are interpreted as big endian, or if single-bit-per-pixel has most significant bit of the byte corresponding to first (leftmost) pixel. Of course this is meaningless for 8 bits/pix */ CARD8 trueColour; /* If false then we need a "colour map" to convert pixels to RGB. If true, xxxMax and xxxShift specify bits used for red, green and blue */ /* the following fields are only meaningful if trueColour is true */ CARD16 redMax; /* maximum red value (= 2^n - 1 where n is the number of bits used for red). Note this value is always in big endian order. */ CARD16 greenMax; /* similar for green */ CARD16 blueMax; /* and blue */ CARD8 redShift; /* number of shifts needed to get the red value in a pixel to the least significant bit. To find the red value from a given pixel, do the following: 1) Swap pixel value according to bigEndian (e.g. if bigEndian is false and host byte order is big endian, then swap). 2) Shift right by redShift. 3) AND with redMax (in host byte order). 4) You now have the red value between 0 and redMax. */ CARD8 greenShift; /* similar for green */ CARD8 blueShift; /* and blue */ CARD8 pad1; CARD16 pad2; } rfbPixelFormat; #define sz_rfbPixelFormat 16 /***************************************************************************** * * Initial handshaking messages * *****************************************************************************/ /*----------------------------------------------------------------------------- * Protocol Version * * The server always sends 12 bytes to start which identifies the latest RFB * protocol version number which it supports. These bytes are interpreted * as a string of 12 ASCII characters in the format "RFB xxx.yyy\n" where * xxx and yyy are the major and minor version numbers (for version 3.3 * this is "RFB 003.003\n"). * * The client then replies with a similar 12-byte message giving the version * number of the protocol which should actually be used (which may be different * to that quoted by the server). * * It is intended that both clients and servers may provide some level of * backwards compatibility by this mechanism. Servers in particular should * attempt to provide backwards compatibility, and even forwards compatibility * to some extent. For example if a client demands version 3.1 of the * protocol, a 3.0 server can probably assume that by ignoring requests for * encoding types it doesn't understand, everything will still work OK. This * will probably not be the case for changes in the major version number. * * The format string below can be used in sprintf or sscanf to generate or * decode the version string respectively. */ #define rfbProtocolVersionFormat "RFB %03d.%03d\n" typedef char rfbProtocolVersionMsg[13]; /* allow extra byte for null */ #define sz_rfbProtocolVersionMsg 12 /*----------------------------------------------------------------------------- * Authentication * * Once the protocol version has been decided, the server then sends a 32-bit * word indicating whether any authentication is needed on the connection. * The value of this word determines the authentication scheme in use. For * version 3.0 of the protocol this may have one of the following values: */ #define rfbConnFailed 0 #define rfbNoAuth 1 #define rfbVncAuth 2 // Defined (but unsupported Authentication Protocols) #define rfbRA2 5 #define rfbRA2ne 6 #define rfbTight 16 #define rfbUltra 17 #define rfbTLS 18 #define rfbJAMF 32 /* * rfbConnFailed: For some reason the connection failed (e.g. the server * cannot support the desired protocol version). This is * followed by a string describing the reason (where a * string is specified as a 32-bit length followed by that * many ASCII characters). * * rfbNoAuth: No authentication is needed. * * rfbVncAuth: The VNC authentication scheme is to be used. A 16-byte * challenge follows, which the client encrypts as * appropriate using the password and sends the resulting * 16-byte response. If the response is correct, the * server sends the 32-bit word rfbVncAuthOK. If a simple * failure happens, the server sends rfbVncAuthFailed and * closes the connection. If the server decides that too * many failures have occurred, it sends rfbVncAuthTooMany * and closes the connection. In the latter case, the * server should not allow an immediate reconnection by * the client. */ #define rfbVncAuthOK 0 #define rfbVncAuthFailed 1 #define rfbVncAuthTooMany 2 /*----------------------------------------------------------------------------- * Client Initialisation Message * * Once the client and server are sure that they're happy to talk to one * another, the client sends an initialisation message. At present this * message only consists of a boolean indicating whether the server should try * to share the desktop by leaving other clients connected, or give exclusive * access to this client by disconnecting all other clients. */ typedef struct { CARD8 shared; } rfbClientInitMsg; #define sz_rfbClientInitMsg 1 /*----------------------------------------------------------------------------- * Server Initialisation Message * * After the client initialisation message, the server sends one of its own. * This tells the client the width and height of the server's framebuffer, * its pixel format and the name associated with the desktop. */ typedef struct { CARD16 framebufferWidth; CARD16 framebufferHeight; rfbPixelFormat format; /* the server's preferred pixel format */ CARD32 nameLength; /* followed by char name[nameLength] */ } rfbServerInitMsg; #define sz_rfbServerInitMsg (8 + sz_rfbPixelFormat) /* * Following the server initialisation message it's up to the client to send * whichever protocol messages it wants. Typically it will send a * SetPixelFormat message and a SetEncodings message, followed by a * FramebufferUpdateRequest. From then on the server will send * FramebufferUpdate messages in response to the client's * FramebufferUpdateRequest messages. The client should send * FramebufferUpdateRequest messages with incremental set to true when it has * finished processing one FramebufferUpdate and is ready to process another. * With a fast client, the rate at which FramebufferUpdateRequests are sent * should be regulated to avoid hogging the network. */ /***************************************************************************** * * Message types * *****************************************************************************/ /* server -> client */ #define rfbFramebufferUpdate 0 #define rfbSetColourMapEntries 1 #define rfbBell 2 #define rfbServerCutText 3 #define rfbReSizeFrameBuffer 0xF /* client -> server */ #define rfbSetPixelFormat 0 #define rfbFixColourMapEntries 1 /* not currently supported */ #define rfbSetEncodings 2 #define rfbFramebufferUpdateRequest 3 #define rfbKeyEvent 4 #define rfbPointerEvent 5 #define rfbClientCutText 6 #define rfbSetScaleFactorULTRA 8 #define rfbSetScaleFactor 0xF #define rfbRichClipboardAvailable 0x83 #define rfbRichClipboardRequest 0x84 #define rfbRichClipboardData 0x85 /***************************************************************************** * * Encoding types * *****************************************************************************/ #define rfbEncodingRaw 0 #define rfbEncodingCopyRect 1 #define rfbEncodingRRE 2 #define rfbEncodingCoRRE 4 #define rfbEncodingHextile 5 #define rfbEncodingZlib 6 #define rfbEncodingTight 7 #define rfbEncodingZlibHex 8 #define rfbEncodingUltra 9 #define rfbStatsRichCursor 10 #define rfbStatsCursorPosition 11 #define rfbStatsDesktopResize 12 #define rfbEncodingZRLE 16 /* Redstone Software Special Encodings rfbImmediateUpdate Sending this encoding asks the server to respond immediately upon seeing a FBU request and not wait to consolidate events and not to wait for an update to occur rfbPasteboardError Asks that OSXvnc should send an error message (in the form of a cut message) if the pasteboard is not accessible. */ #define rfbImmediateUpdate 0x80000000 #define rfbPasteboardRequest 0x80010000 #define rfbRichPasteboard 0x80010001 /* TightVNC * * Special encoding numbers: * 0xFFFFFF00 .. 0xFFFFFF0F -- encoding-specific compression levels; * 0xFFFFFF10 .. 0xFFFFFF1F -- mouse cursor shape data; * 0xFFFFFF20 .. 0xFFFFFF2F -- various protocol extensions; * 0xFFFFFF30 .. 0xFFFFFFDF -- not allocated yet; * 0xFFFFFFE0 .. 0xFFFFFFEF -- quality level for JPEG compressor; * 0xFFFFFFF0 .. 0xFFFFFFFF -- cross-encoding compression levels. */ #define rfbEncodingCompressLevel0 0xFFFFFF00 #define rfbEncodingCompressLevel1 0xFFFFFF01 #define rfbEncodingCompressLevel2 0xFFFFFF02 #define rfbEncodingCompressLevel3 0xFFFFFF03 #define rfbEncodingCompressLevel4 0xFFFFFF04 #define rfbEncodingCompressLevel5 0xFFFFFF05 #define rfbEncodingCompressLevel6 0xFFFFFF06 #define rfbEncodingCompressLevel7 0xFFFFFF07 #define rfbEncodingCompressLevel8 0xFFFFFF08 #define rfbEncodingCompressLevel9 0xFFFFFF09 #define rfbEncodingXCursor 0xFFFFFF10 #define rfbEncodingRichCursor 0xFFFFFF11 #define rfbEncodingPointerPos 0xFFFFFF18 #define rfbEncodingLastRect 0xFFFFFF20 #define rfbEncodingDesktopResize 0xFFFFFF21 #define rfbEncodingQualityLevel0 0xFFFFFFE0 #define rfbEncodingQualityLevel1 0xFFFFFFE1 #define rfbEncodingQualityLevel2 0xFFFFFFE2 #define rfbEncodingQualityLevel3 0xFFFFFFE3 #define rfbEncodingQualityLevel4 0xFFFFFFE4 #define rfbEncodingQualityLevel5 0xFFFFFFE5 #define rfbEncodingQualityLevel6 0xFFFFFFE6 #define rfbEncodingQualityLevel7 0xFFFFFFE7 #define rfbEncodingQualityLevel8 0xFFFFFFE8 #define rfbEncodingQualityLevel9 0xFFFFFFE9 /***************************************************************************** * * Server -> client message definitions * *****************************************************************************/ /*----------------------------------------------------------------------------- * FramebufferUpdate - a block of rectangles to be copied to the framebuffer. * * This message consists of a header giving the number of rectangles of pixel * data followed by the rectangles themselves. The header is padded so that * together with the type byte it is an exact multiple of 4 bytes (to help * with alignment of 32-bit pixels): */ typedef struct { CARD8 type; /* always rfbFramebufferUpdate */ CARD8 pad; CARD16 nRects; /* followed by nRects rectangles */ } rfbFramebufferUpdateMsg; #define sz_rfbFramebufferUpdateMsg 4 /* * Each rectangle of pixel data consists of a header describing the position * and size of the rectangle and a type word describing the encoding of the * pixel data, followed finally by the pixel data. Note that if the client has * not sent a SetEncodings message then it will only receive raw pixel data. * Also note again that this structure is a multiple of 4 bytes. */ typedef struct { rfbRectangle r; CARD32 encoding; /* one of the encoding types rfbEncoding... */ } rfbFramebufferUpdateRectHeader; #define sz_rfbFramebufferUpdateRectHeader (sz_rfbRectangle + 4) /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * Raw Encoding. Pixels are sent in top-to-bottom scanline order, * left-to-right within a scanline with no padding in between. */ /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * CopyRect Encoding. The pixels are specified simply by the x and y position * of the source rectangle. */ typedef struct { CARD16 srcX; CARD16 srcY; } rfbCopyRect; #define sz_rfbCopyRect 4 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * RRE - Rise-and-Run-length Encoding. We have an rfbRREHeader structure * giving the number of subrectangles following. Finally the data follows in * the form [...] where each is * []. */ typedef struct { CARD32 nSubrects; } rfbRREHeader; #define sz_rfbRREHeader 4 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * CoRRE - Compact RRE Encoding. We have an rfbRREHeader structure giving * the number of subrectangles following. Finally the data follows in the form * [...] where each is * []. This means that * the whole rectangle must be at most 255x255 pixels. */ typedef struct { CARD8 x; CARD8 y; CARD8 w; CARD8 h; } rfbCoRRERectangle; #define sz_rfbCoRRERectangle 4 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * Hextile Encoding. The rectangle is divided up into "tiles" of 16x16 pixels, * starting at the top left going in left-to-right, top-to-bottom order. If * the width of the rectangle is not an exact multiple of 16 then the width of * the last tile in each row will be correspondingly smaller. Similarly if the * height is not an exact multiple of 16 then the height of each tile in the * final row will also be smaller. Each tile begins with a "subencoding" type * byte, which is a mask made up of a number of bits. If the Raw bit is set * then the other bits are irrelevant; w*h pixel values follow (where w and h * are the width and height of the tile). Otherwise the tile is encoded in a * similar way to RRE, except that the position and size of each subrectangle * can be specified in just two bytes. The other bits in the mask are as * follows: * * BackgroundSpecified - if set, a pixel value follows which specifies * the background colour for this tile. The first non-raw tile in a * rectangle must have this bit set. If this bit isn't set then the * background is the same as the last tile. * * ForegroundSpecified - if set, a pixel value follows which specifies * the foreground colour to be used for all subrectangles in this tile. * If this bit is set then the SubrectsColoured bit must be zero. * * AnySubrects - if set, a single byte follows giving the number of * subrectangles following. If not set, there are no subrectangles (i.e. * the whole tile is just solid background colour). * * SubrectsColoured - if set then each subrectangle is preceded by a pixel * value giving the colour of that subrectangle. If not set, all * subrectangles are the same colour, the foreground colour; if the * ForegroundSpecified bit wasn't set then the foreground is the same as * the last tile. * * The position and size of each subrectangle is specified in two bytes. The * Pack macros below can be used to generate the two bytes from x, y, w, h, * and the Extract macros can be used to extract the x, y, w, h values from * the two bytes. */ #define rfbHextileRaw (1 << 0) #define rfbHextileBackgroundSpecified (1 << 1) #define rfbHextileForegroundSpecified (1 << 2) #define rfbHextileAnySubrects (1 << 3) #define rfbHextileSubrectsColoured (1 << 4) #define rfbHextileZlibRaw (1 << 5) #define rfbHextileZlibHex (1 << 6) #define rfbHextilePackXY(x,y) (((x) << 4) | (y)) #define rfbHextilePackWH(w,h) ((((w)-1) << 4) | ((h)-1)) #define rfbHextileExtractX(byte) ((byte) >> 4) #define rfbHextileExtractY(byte) ((byte) & 0xf) #define rfbHextileExtractW(byte) (((byte) >> 4) + 1) #define rfbHextileExtractH(byte) (((byte) & 0xf) + 1) /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * zlib - zlib compressed Encoding. We have an rfbZlibHeader structure * giving the number of bytes following. Finally the data follows is * zlib compressed version of the raw pixel data as negotiated. */ typedef struct { CARD32 nBytes; } rfbZlibHeader; #define sz_rfbZlibHeader 4 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * ZRLE - encoding combining Zlib compression, tiling, palettisation and * run-length encoding. */ typedef struct { CARD32 length; } rfbZRLEHeader; #define sz_rfbZRLEHeader 4 #define rfbZRLETileWidth 64 #define rfbZRLETileHeight 64 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * Tight Encoding. FIXME: Add more documentation. */ #define rfbTightExplicitFilter 0x04 #define rfbTightFill 0x08 #define rfbTightJpeg 0x09 #define rfbTightMaxSubencoding 0x09 /* Filters to improve compression efficiency */ #define rfbTightFilterCopy 0x00 #define rfbTightFilterPalette 0x01 #define rfbTightFilterGradient 0x02 /*----------------------------------------------------------------------------- * SetColourMapEntries - these messages are only sent if the pixel * format uses a "colour map" (i.e. trueColour false) and the client has not * fixed the entire colour map using FixColourMapEntries. In addition they * will only start being sent after the client has sent its first * FramebufferUpdateRequest. So if the client always tells the server to use * trueColour then it never needs to process this type of message. */ typedef struct { CARD8 type; /* always rfbSetColourMapEntries */ CARD8 pad; CARD16 firstColour; CARD16 nColours; /* Followed by nColours * 3 * CARD16 r1, g1, b1, r2, g2, b2, r3, g3, b3, ..., rn, bn, gn */ } rfbSetColourMapEntriesMsg; #define sz_rfbSetColourMapEntriesMsg 6 /*----------------------------------------------------------------------------- * Bell - ring a bell on the client if it has one. */ typedef struct { CARD8 type; /* always rfbBell */ } rfbBellMsg; #define sz_rfbBellMsg 1 /*----------------------------------------------------------------------------- * ServerCutText - the server has new text in its cut buffer. */ typedef struct { CARD8 type; /* always rfbServerCutText */ CARD8 pad1; CARD16 pad2; CARD32 length; /* followed by char text[length] */ } rfbServerCutTextMsg; #define sz_rfbServerCutTextMsg 8 /*----------------------------------------------------------------------------- * ReSizeFrameBuffer - tell the RFB client to alter its framebuffer, either * due to a resize of the server desktop or a client-requested scaling factor. * The pixel format remains unchanged. */ typedef struct { CARD8 type; /* always rfbReSizeFrameBuffer */ CARD8 pad1; CARD16 desktop_w; /* Desktop width */ CARD16 desktop_h; /* Desktop height */ CARD16 buffer_w; /* FrameBuffer width */ CARD16 buffer_h; /* Framebuffer height */ CARD16 pad2; } rfbReSizeFrameBufferMsg; #define sz_rfbReSizeFrameBufferMsg (12) /*----------------------------------------------------------------------------- * Union of all server->client messages. */ typedef union { CARD8 type; rfbFramebufferUpdateMsg fu; rfbSetColourMapEntriesMsg scme; rfbBellMsg b; rfbServerCutTextMsg sct; rfbReSizeFrameBufferMsg rsfb; } rfbServerToClientMsg; /***************************************************************************** * * Message definitions (client -> server) * *****************************************************************************/ /*----------------------------------------------------------------------------- * SetPixelFormat - tell the RFB server the format in which the client wants * pixels sent. */ typedef struct { CARD8 type; /* always rfbSetPixelFormat */ CARD8 pad1; CARD16 pad2; rfbPixelFormat format; } rfbSetPixelFormatMsg; #define sz_rfbSetPixelFormatMsg (sz_rfbPixelFormat + 4) /*----------------------------------------------------------------------------- * FixColourMapEntries - when the pixel format uses a "colour map", fix * read-only colour map entries. * * ***************** NOT CURRENTLY SUPPORTED ***************** */ typedef struct { CARD8 type; /* always rfbFixColourMapEntries */ CARD8 pad; CARD16 firstColour; CARD16 nColours; /* Followed by nColours * 3 * CARD16 r1, g1, b1, r2, g2, b2, r3, g3, b3, ..., rn, bn, gn */ } rfbFixColourMapEntriesMsg; #define sz_rfbFixColourMapEntriesMsg 6 /*----------------------------------------------------------------------------- * SetEncodings - tell the RFB server which encoding types we accept. Put them * in order of preference, if we have any. We may always receive raw * encoding, even if we don't specify it here. */ typedef struct { CARD8 type; /* always rfbSetEncodings */ CARD8 pad; CARD16 nEncodings; /* followed by nEncodings * CARD32 encoding types */ } rfbSetEncodingsMsg; #define sz_rfbSetEncodingsMsg 4 /*----------------------------------------------------------------------------- * SetScaleFactor - tell the RFB server to alter the scale factor for the * client buffer. */ typedef struct { CARD8 type; /* always rfbSetScaleFactor */ CARD8 scale; /* Scale factor (positive non-zero integer) */ CARD16 pad2; } rfbSetScaleFactorMsg; #define sz_rfbSetScaleFactorMsg (4) /*----------------------------------------------------------------------------- * FramebufferUpdateRequest - request for a framebuffer update. If incremental * is true then the client just wants the changes since the last update. If * false then it wants the whole of the specified rectangle. */ typedef struct { CARD8 type; /* always rfbFramebufferUpdateRequest */ CARD8 incremental; CARD16 x; CARD16 y; CARD16 w; CARD16 h; } rfbFramebufferUpdateRequestMsg; #define sz_rfbFramebufferUpdateRequestMsg 10 /*----------------------------------------------------------------------------- * KeyEvent - key press or release * * Keys are specified using the "keysym" values defined by the X Window System. * For most ordinary keys, the keysym is the same as the corresponding ASCII * value. Other common keys are: * * BackSpace 0xff08 * Tab 0xff09 * Return or Enter 0xff0d * Escape 0xff1b * Insert 0xff63 * Delete 0xffff * Home 0xff50 * End 0xff57 * Page Up 0xff55 * Page Down 0xff56 * Left 0xff51 * Up 0xff52 * Right 0xff53 * Down 0xff54 * F1 0xffbe * F2 0xffbf * ... ... * F12 0xffc9 * Shift 0xffe1 * Control 0xffe3 * Meta 0xffe7 * Alt 0xffe9 */ typedef struct { CARD8 type; /* always rfbKeyEvent */ CARD8 down; /* true if down (press), false if up */ CARD16 pad; CARD32 key; /* key is specified as an X keysym */ } rfbKeyEventMsg; #define sz_rfbKeyEventMsg 8 /*----------------------------------------------------------------------------- * PointerEvent - mouse/pen move and/or button press. */ typedef struct { CARD8 type; /* always rfbPointerEvent */ CARD8 buttonMask; /* bits 0-7 are buttons 1-8, 0=up, 1=down */ CARD16 x; CARD16 y; } rfbPointerEventMsg; #define rfbButton1Mask 1 #define rfbButton2Mask 2 #define rfbButton3Mask 4 #define rfbButton4Mask 8 #define rfbButton5Mask 16 #define rfbWheelUpMask rfbButton4Mask #define rfbWheelDownMask rfbButton5Mask #define rfbWheelMask (rfbWheelUpMask | rfbWheelDownMask) #define sz_rfbPointerEventMsg 6 /*----------------------------------------------------------------------------- * ClientCutText - the client has new text in its cut buffer. */ typedef struct { CARD8 type; /* always rfbClientCutText */ CARD8 pad1; CARD16 pad2; CARD32 length; /* followed by char text[length] */ } rfbClientCutTextMsg; #define sz_rfbClientCutTextMsg 8 /*----------------------------------------------------------------------------- * Union of all client->server messages. */ typedef union { CARD8 type; rfbSetPixelFormatMsg spf; rfbSetScaleFactorMsg ssf; rfbFixColourMapEntriesMsg fcme; rfbSetEncodingsMsg se; rfbFramebufferUpdateRequestMsg fur; rfbKeyEventMsg ke; rfbPointerEventMsg pe; rfbClientCutTextMsg cct; } rfbClientToServerMsg; ================================================ FILE: OSXvnc-server/rfbserver.c ================================================ /* * rfbserver.c - deal with server-side of the RFB protocol. */ /* * OSXvnc Copyright (C) 2001 Dan McGuirk . * Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge. * All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "rfb.h" //char updateBuf[UPDATE_BUF_SIZE]; //int ublen; rfbClientPtr pointerClient = NULL; /* Mutex for pointer events with buttons down*/ rfbClientPtr rfbClientHead; /* tight encoding -- GetClient() in tight.c accesses this list, so make it global */ struct rfbClientIterator { rfbClientPtr next; }; static pthread_mutex_t rfbClientListMutex; static struct rfbClientIterator rfbClientIteratorInstance; static void CopyScalingRect(rfbClientPtr cl, uint32_t* x, uint32_t* y, uint32_t* w, uint32_t* h, bool bDoScaling); void rfbClientListInit(void) { rfbClientHead = NULL; pthread_mutex_init(&rfbClientListMutex, NULL); } rfbClientIteratorPtr rfbGetClientIterator(void) { pthread_mutex_lock(&rfbClientListMutex); rfbClientIteratorInstance.next = rfbClientHead; return &rfbClientIteratorInstance; } rfbClientPtr rfbClientIteratorNext(rfbClientIteratorPtr iterator) { rfbClientPtr result = iterator->next; if (result) iterator->next = result->next; return result; } void rfbReleaseClientIterator(rfbClientIteratorPtr iterator) { pthread_mutex_unlock(&rfbClientListMutex); } Bool rfbClientsConnected(void) { return (rfbClientHead != NULL); } static void rfbSendClientList(void) { pthread_mutex_lock(&rfbClientListMutex); NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSMutableArray *clientList = [[NSMutableArray alloc] init]; rfbClientPtr myClient = rfbClientHead; while (myClient != NULL) { [clientList addObject:@{@"clientIP": @(myClient->host)}]; myClient = myClient->next; } [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"VNCConnections" object:[NSString stringWithFormat:@"OSXvnc%d",rfbPort] userInfo:@{@"clientList": clientList}]; [pool release]; pthread_mutex_unlock(&rfbClientListMutex); } /* * rfbNewClientConnection is called from sockets.c when a new connection * comes in. */ void rfbNewClientConnection(int sock) { rfbNewClient(sock); } /* * rfbReverseConnection is called to make an outward * connection to a "listening" RFB client. */ rfbClientPtr rfbReverseConnection(char *host, int port) { int sock= -1; struct addrinfo *res, *res0, hint; int errCode; rfbClientPtr cl; { // Old IPV4 stuff struct sockaddr_in sin; bzero(&sin, sizeof(sin)); sin.sin_len = sizeof(sin); sin.sin_family = AF_INET; sin.sin_addr.s_addr = inet_addr(host); sin.sin_port = htons(port); if ((int)sin.sin_addr.s_addr == -1) { struct hostent *hostinfo = gethostbyname(host); if (hostinfo && hostinfo->h_addr) { sin.sin_addr.s_addr = ((struct in_addr *)hostinfo->h_addr)->s_addr; } else { rfbLog("Error resolving reverse host %s", host); return NULL; } } if ((sock = socket(PF_INET, SOCK_STREAM, 0)) < 0) { rfbLog("Error creating reverse socket"); } if (connect(sock, (struct sockaddr *)&sin, sizeof(sin)) != 0) { rfbLog("Error connecting to reverse host %s:%d", host, port); sock = -1; } } if (sock == -1) { hint.ai_family = PF_UNSPEC; hint.ai_socktype = SOCK_STREAM; if ((errCode = getaddrinfo(host, NULL, &hint, &res0)) != 0) { rfbLog("Error resolving reverse host %s: %s", host, gai_strerror(errCode)); } // Iterate over all the resources looking for one we can connect with with. for(res=res0; res && (sock < 0); res = res->ai_next) { if (res->ai_family == PF_INET6) ((struct sockaddr_in6 *)(res->ai_addr))->sin6_port = port; else if (res->ai_family == PF_INET) ((struct sockaddr_in *)(res->ai_addr))->sin_port = port; else { rfbLog("Error creating reverse socket: unrecognized protocol family %d", res->ai_family); continue; } if ((sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol)) < 0) { rfbLog("Error creating reverse socket: %s", strerror(errno)); } else if (connect(sock, res->ai_addr, res->ai_addrlen) != 0) { rfbLog("Error connecting to reverse host %s:%d: %s", host, port, strerror(errno)); sock = -1; } } freeaddrinfo(res0); } if (sock < 0) return NULL; cl = rfbNewClient(sock); if (cl) { cl->reverseConnection = TRUE; } return cl; } /* * rfbNewClient is called when a new connection has been made by whatever * means. */ rfbClientPtr rfbNewClient(int sock) { rfbProtocolVersionMsg pv; rfbClientPtr cl; BoxRec box; int i; unsigned int addrlen; int bitsPerSample; /* { rfbClientIteratorPtr iterator; rfbLog("syncing other clients:"); iterator = rfbGetClientIterator(); while ((cl = rfbClientIteratorNext(iterator)) != NULL) { rfbLog(" %s",cl->host); } rfbReleaseClientIterator(iterator); } */ cl = (rfbClientPtr)xalloc(sizeof(rfbClientRec)); memset(cl, 0, sizeof(rfbClientRec)); cl->sock = sock; if (floor(NSAppKitVersionNumber) > floor(NSAppKitVersionNumber10_1)) { struct sockaddr_in6 addr; char host[NI_MAXHOST]; addrlen = sizeof(struct sockaddr_in6); host[0] = 0; getnameinfo((struct sockaddr *)&addr, addrlen, host, sizeof(host), NULL, 0, NI_NUMERICHOST); // Not available on 10.1 cl->host = strdup(host); } if (!strlen(cl->host)) { struct sockaddr_in addr; addrlen = sizeof(struct sockaddr_in); getpeername(sock, (struct sockaddr *)&addr, &addrlen); cl->host = strdup(inet_ntoa(addr.sin_addr)); } pthread_mutex_init(&cl->outputMutex, NULL); cl->state = RFB_PROTOCOL_VERSION; /* REDSTONE - Adding some features In theory these need not be global, but could be set per client */ cl->disableRemoteEvents = rfbDisableRemote; // Ignore PB, Keyboard and Mouse events cl->swapMouseButtons23 = rfbSwapButtons; // How to interpret mouse buttons 2 & 3 cl->needNewScreenSize = NO; initPasteboardForClient(cl); cl->reverseConnection = FALSE; cl->preferredEncoding = rfbEncodingRaw; cl->correMaxWidth = 48; cl->correMaxHeight = 48; cl->zrleData = 0; cl->mosData = 0; for (i = 0; i < 256; i++) cl->modiferKeys[i] = 0; box.x1 = box.y1 = 0; box.x2 = rfbScreen.width; box.y2 = rfbScreen.height; REGION_INIT(pScreen,&cl->modifiedRegion,&box,0); pthread_mutex_init(&cl->updateMutex, NULL); pthread_cond_init(&cl->updateCond, NULL); REGION_INIT(pScreen,&cl->requestedRegion,NullBox,0); switch (rfbMaxBitDepth) { case 32: case 16: case 8: cl->format.bitsPerPixel = max(rfbMaxBitDepth, rfbScreen.bitsPerPixel); bitsPerSample = cl->format.bitsPerPixel << 2; cl->format.depth = bitsPerSample*3; cl->format.bigEndian = !littleEndian; cl->format.trueColour = TRUE; cl->format.redMax = (1 << bitsPerSample) - 1; cl->format.greenMax = (1 << bitsPerSample) - 1; cl->format.blueMax = (1 << bitsPerSample) - 1; cl->format.redShift = bitsPerSample * 2; cl->format.greenShift = bitsPerSample * 1; cl->format.blueShift = bitsPerSample * 0; break; case 0: default: cl->format = rfbServerFormat; break; } // This will rfbSetTranslateFunctionUsingFormat(cl, rfbServerFormat); /* SERVER SCALING EXTENSIONS -- Server Scaling is off by default */ cl->scalingFactor = 1; cl->screenBuffer = rfbGetFramebuffer(); cl->scalingFrameBuffer = cl->screenBuffer; cl->scalingPaddedWidthInBytes = rfbScreen.paddedWidthInBytes; cl->tightCompressLevel = TIGHT_DEFAULT_COMPRESSION; cl->tightQualityLevel = -1; for (i = 0; i < 4; i++) cl->zsActive[i] = FALSE; cl->enableLastRectEncoding = FALSE; cl->enableXCursorShapeUpdates = FALSE; cl->useRichCursorEncoding = FALSE; cl->enableCursorPosUpdates = FALSE; cl->desktopSizeUpdate = FALSE; cl->immediateUpdate = FALSE; pthread_mutex_lock(&rfbClientListMutex); cl->next = rfbClientHead; cl->prev = NULL; if (rfbClientHead) rfbClientHead->prev = cl; rfbClientHead = cl; pthread_mutex_unlock(&rfbClientListMutex); rfbResetStats(cl); cl->compStreamInited = FALSE; cl->compStream.total_in = 0; cl->compStream.total_out = 0; cl->compStream.zalloc = Z_NULL; cl->compStream.zfree = Z_NULL; cl->compStream.opaque = Z_NULL; cl->zlibCompressLevel = 5; cl->compStreamRaw.total_in = ZLIBHEX_COMP_UNINITED; cl->compStreamHex.total_in = ZLIBHEX_COMP_UNINITED; cl->client_zlibBeforeBufSize = 0; cl->client_zlibBeforeBuf = NULL; cl->client_zlibAfterBufSize = 0; cl->client_zlibAfterBuf = NULL; cl->client_zlibAfterBufLen = 0; snprintf(pv, sizeof(pv), rfbProtocolVersionFormat, rfbProtocolMajorVersion, rfbProtocolMinorVersion); if (WriteExact(cl, pv, sz_rfbProtocolVersionMsg) < 0) { rfbLogPerror("rfbNewClient: write"); rfbCloseClient(cl); return NULL; } // wake up screen in case monitor off (avoid blank VNC screen): IOPMAssertionDeclareUserActivity(CFSTR("VNC user is logged in"), kIOPMUserActiveLocal, &userActivityLastAssertionId); return cl; } /* * rfbClientConnectionGone is called from sockets.c just after a connection * has gone away. */ void rfbClientConnectionGone(rfbClientPtr cl) { int i; // RedstoneOSX - Track and release depressed modifier keys whenever the client disconnects keyboardReleaseKeysForClient(cl); freePasteboardForClient(cl); pthread_mutex_lock(&rfbClientListMutex); /* Release the compression state structures if any. */ if ( cl->compStreamInited == TRUE ) { deflateEnd( &(cl->compStream) ); } for (i = 0; i < 4; i++) { if (cl->zsActive[i]) deflateEnd(&cl->zsStruct[i]); } if (pointerClient == cl) pointerClient = NULL; if (cl->prev) cl->prev->next = cl->next; else rfbClientHead = cl->next; if (cl->next) cl->next->prev = cl->prev; pthread_mutex_unlock(&rfbClientListMutex); REGION_UNINIT(pScreen,&cl->modifiedRegion); if (cl->major && cl->minor) { // If it didn't get so far as to send a protocol then let's just ignore // For Clients with no activity just return with no log rfbLog("Client %s disconnected", cl->host); rfbSendClientList(); rfbPrintStats(cl); } FreeZrleData(cl); free(cl->host); if (cl->translateLookupTable) free(cl->translateLookupTable); /* SERVER SCALING EXTENSIONS */ if( cl->scalingFactor != 1 ){ free(cl->scalingFrameBuffer); } pthread_cond_destroy(&cl->updateCond); pthread_mutex_destroy(&cl->updateMutex); pthread_mutex_destroy(&cl->outputMutex); xfree(cl); // Not sure why but this log message seems to prevent a crash // rfbLog("Client gone"); } /* * rfbProcessClientMessage is called when there is data to read from a client. */ void rfbProcessClientMessage(rfbClientPtr cl) { switch (cl->state) { case RFB_PROTOCOL_VERSION: rfbProcessClientProtocolVersion(cl); return; case RFB_AUTH_VERSION: rfbProcessAuthVersion(cl); return; case RFB_AUTHENTICATION: rfbAuthProcessClientMessage(cl); return; case RFB_INITIALISATION: rfbProcessClientInitMessage(cl); return; default: rfbProcessClientNormalMessage(cl); return; } } /* * rfbProcessClientProtocolVersion is called when the client sends its * protocol version. */ void rfbProcessClientProtocolVersion(rfbClientPtr cl) { rfbProtocolVersionMsg pv; int n; char failureReason[256]; if ((n = ReadExact(cl, pv, sz_rfbProtocolVersionMsg)) <= 0) { if (n == 0) rfbLog("rfbProcessClientProtocolVersion: client gone"); else rfbLogPerror("rfbProcessClientProtocolVersion: read"); rfbCloseClient(cl); return; } pv[sz_rfbProtocolVersionMsg] = 0; if (sscanf(pv, rfbProtocolVersionFormat, &cl->major, &cl->minor) != 2) { if (strncmp(pv,"GET",3)) // Don't log if it was a browser rfbLog("rfbProcessClientProtocolVersion: not a valid RFB client"); rfbCloseClient(cl); return; } rfbLog("Protocol version %d.%d", cl->major, cl->minor); if (cl->major != rfbProtocolMajorVersion) { /* Major version mismatch - send a ConnFailed message */ rfbLog("Major version mismatch"); snprintf(failureReason, sizeof(failureReason), "RFB protocol version mismatch - server %d.%d, client %d.%d", rfbProtocolMajorVersion,rfbProtocolMinorVersion,cl->major,cl->minor); rfbClientConnFailed(cl, failureReason); return; } if (cl->minor != rfbProtocolMinorVersion) { /* Minor version mismatch - warn but try to continue */ rfbLog("Ignoring minor version mismatch"); } rfbSendClientList(); rfbAuthNewClient(cl); } /* * rfbClientConnFailed is called when a client connection has failed either * because it talks the wrong protocol or it has failed authentication. */ void rfbClientConnFailed(rfbClientPtr cl, char *reason) { char *buf; size_t len = strlen(reason); buf = (char *)xalloc(8 + len); ((CARD32 *)buf)[0] = Swap32IfLE(rfbConnFailed); ((CARD32 *)buf)[1] = Swap32IfLE(len); memcpy(buf + 8, reason, len); if (WriteExact(cl, buf, 8 + len) < 0) rfbLogPerror("rfbClientConnFailed: write"); xfree(buf); rfbCloseClient(cl); } /* * rfbProcessClientInitMessage is called when the client sends its * initialisation message. */ void rfbProcessClientInitMessage(rfbClientPtr cl) { rfbClientInitMsg ci; char buf[256]; rfbServerInitMsg *si = (rfbServerInitMsg *)buf; int n; size_t len; rfbClientIteratorPtr iterator; rfbClientPtr otherCl; if ((n = ReadExact(cl, (char *)&ci,sz_rfbClientInitMsg)) <= 0) { if (n == 0) rfbLog("rfbProcessClientInitMessage: client gone"); else rfbLogPerror("rfbProcessClientInitMessage: read"); rfbCloseClient(cl); return; } si->framebufferWidth = Swap16IfLE(rfbScreen.width); si->framebufferHeight = Swap16IfLE(rfbScreen.height); si->format = rfbServerFormat; si->format.redMax = Swap16IfLE(si->format.redMax); si->format.greenMax = Swap16IfLE(si->format.greenMax); si->format.blueMax = Swap16IfLE(si->format.blueMax); if (strlen(desktopName) > 128) /* sanity check on desktop name len */ desktopName[128] = 0; strcpy(buf + sz_rfbServerInitMsg, desktopName); len = strlen(buf + sz_rfbServerInitMsg); si->nameLength = Swap32IfLE(len); if (WriteExact(cl, buf, sz_rfbServerInitMsg + len) < 0) { rfbLogPerror("rfbProcessClientInitMessage: write"); rfbCloseClient(cl); return; } cl->state = RFB_NORMAL; if (!cl->reverseConnection && (rfbNeverShared || (!rfbAlwaysShared && !ci.shared))) { if (rfbDontDisconnect) { iterator = rfbGetClientIterator(); while ((otherCl = rfbClientIteratorNext(iterator)) != NULL) { if ((otherCl != cl) && (otherCl->state == RFB_NORMAL)) { rfbLog("-dontdisconnect: Not shared & existing client"); rfbLog(" refusing new client %s", cl->host); rfbCloseClient(cl); rfbReleaseClientIterator(iterator); return; } } rfbReleaseClientIterator(iterator); } else { iterator = rfbGetClientIterator(); while ((otherCl = rfbClientIteratorNext(iterator)) != NULL) { if ((otherCl != cl) && (otherCl->state == RFB_NORMAL)) { rfbLog("Not shared - closing connection to client %s", otherCl->host); rfbCloseClient(otherCl); } } rfbReleaseClientIterator(iterator); } } } /* * rfbProcessClientNormalMessage is called when the client has sent a normal * protocol message. */ void rfbProcessClientNormalMessage(rfbClientPtr cl) { int n; rfbClientToServerMsg msg; char *str; if ((n = ReadExact(cl, (char *)&msg, 1)) <= 0) { if (n != 0) rfbLogPerror("rfbProcessClientNormalMessage: read"); rfbCloseClient(cl); return; } switch (msg.type) { case rfbSetPixelFormat: { if ((n = ReadExact(cl, ((char *)&msg) + 1, sz_rfbSetPixelFormatMsg - 1)) <= 0) { if (n != 0) rfbLogPerror("rfbProcessClientNormalMessage: read"); rfbCloseClient(cl); return; } if (!rfbMaxBitDepth || msg.spf.format.bitsPerPixel <= rfbMaxBitDepth) { cl->format.bitsPerPixel = msg.spf.format.bitsPerPixel; cl->format.depth = msg.spf.format.depth; cl->format.bigEndian = (msg.spf.format.bigEndian ? 1 : 0); cl->format.trueColour = (msg.spf.format.trueColour ? 1 : 0); cl->format.redMax = Swap16IfLE(msg.spf.format.redMax); cl->format.greenMax = Swap16IfLE(msg.spf.format.greenMax); cl->format.blueMax = Swap16IfLE(msg.spf.format.blueMax); cl->format.redShift = msg.spf.format.redShift; cl->format.greenShift = msg.spf.format.greenShift; cl->format.blueShift = msg.spf.format.blueShift; rfbSetTranslateFunction(cl); } else rfbLog("rfbProcessClientNormalMessage: Unable to set requested bit depth %d to greater than MaxBitDepth (%d)", msg.spf.format.bitsPerPixel, rfbMaxBitDepth); return; } case rfbFixColourMapEntries: { if ((n = ReadExact(cl, ((char *)&msg) + 1, sz_rfbFixColourMapEntriesMsg - 1)) <= 0) { if (n != 0) rfbLogPerror("rfbProcessClientNormalMessage: read"); rfbCloseClient(cl); return; } rfbLog("rfbProcessClientNormalMessage: %s", "FixColourMapEntries unsupported\n"); rfbCloseClient(cl); return; } case rfbSetEncodings: { int i; CARD32 enc; if ((n = ReadExact(cl, ((char *)&msg) + 1, sz_rfbSetEncodingsMsg - 1)) <= 0) { if (n != 0) rfbLogPerror("rfbProcessClientNormalMessage: read"); rfbCloseClient(cl); return; } msg.se.nEncodings = Swap16IfLE(msg.se.nEncodings); pthread_mutex_lock(&cl->updateMutex); // Since there is not protocol to "clear" these extensions we always clear them and expect them to be re-sent if // the client continues to support those options cl->preferredEncoding = -1; cl->enableLastRectEncoding = FALSE; cl->enableXCursorShapeUpdates = FALSE; cl->useRichCursorEncoding = FALSE; cl->enableCursorPosUpdates = FALSE; cl->desktopSizeUpdate = FALSE; cl->immediateUpdate = FALSE; for (i = 0; i < msg.se.nEncodings; i++) { if ((n = ReadExact(cl, (char *)&enc, 4)) <= 0) { if (n != 0) rfbLogPerror("rfbProcessClientNormalMessage: read"); rfbCloseClient(cl); return; } enc = Swap32IfLE(enc); switch (enc) { case rfbEncodingCopyRect: break; case rfbEncodingRaw: case rfbEncodingRRE: case rfbEncodingCoRRE: case rfbEncodingHextile: case rfbEncodingZlib: case rfbEncodingTight: case rfbEncodingZlibHex: case rfbEncodingZRLE: if (cl->preferredEncoding == -1) { cl->preferredEncoding = enc; rfbLog("ENCODING: %s for client %s", encNames[cl->preferredEncoding], cl->host); } break; case rfbEncodingUltra: rfbLog("\tULTRA Encoding not supported(ignored): %u (%X)", (int)enc, (int)enc); break; /* PSEUDO_ENCODINGS */ case rfbEncodingLastRect: rfbLog("\tEnabling LastRect protocol extension for client %s", cl->host); cl->enableLastRectEncoding = TRUE; break; case rfbEncodingXCursor: //rfbLog("Enabling XCursor protocol extension for client %s", cl->host); cl->enableXCursorShapeUpdates = TRUE; break; case rfbEncodingRichCursor: rfbLog("\tEnabling Cursor Shape protocol extension for client %s", cl->host); cl->useRichCursorEncoding = TRUE; cl->currentCursorSeed = 0; break; case rfbEncodingPointerPos: rfbLog("\tEnabling Cursor Position protocol extension for client %s", cl->host); cl->enableCursorPosUpdates = TRUE; cl->clientCursorLocation = CGPointMake(-1.0, -1.0); break; case rfbEncodingDesktopResize: rfbLog("\tEnabling Dynamic Desktop Sizing for client %s", cl->host); cl->desktopSizeUpdate = TRUE; break; case rfbImmediateUpdate: rfbLog("\tEnabling Immediate updates for client " "%s", cl->host); cl->immediateUpdate = TRUE; break; case rfbPasteboardRequest: rfbLog("\tEnabling pasteboard request " "%s", cl->host); cl->generalPBLastChange = -2; // This will cause it to send a single update that shows the current PB break; case rfbRichPasteboard: if (!rfbDisableRichClipboards) { rfbLog("\tEnabling rich pasteboard " "%s", cl->host); cl->richClipboardSupport = TRUE; // The -2 will already trigger force sending the PB, so we don't need to send the ack. if (cl->generalPBLastChange != -2) cl->generalPBLastChange = -3; } break; // Tight encoding options default: if ( enc >= (CARD32)rfbEncodingCompressLevel0 && enc <= (CARD32)rfbEncodingCompressLevel9 ) { cl->zlibCompressLevel = enc & 0x0F; cl->tightCompressLevel = enc & 0x0F; rfbLog("\tUsing compression level %d for client %s", cl->tightCompressLevel, cl->host); } else if ( enc >= (CARD32)rfbEncodingQualityLevel0 && enc <= (CARD32)rfbEncodingQualityLevel9 ) { cl->tightQualityLevel = enc & 0x0F; rfbLog("\tUsing jpeg image quality level %d for client %s", cl->tightQualityLevel, cl->host); } else { rfbLog("\tUnknown Encoding Type(ignored): %u (%X)", (int)enc, (int)enc); } } } if (cl->preferredEncoding == -1) { cl->preferredEncoding = rfbEncodingRaw; } pthread_mutex_unlock(&cl->updateMutex); // Force a new update to the client if (rfbShouldSendNewCursor(cl) || (rfbShouldSendNewPosition(cl))) pthread_cond_signal(&cl->updateCond); return; } case rfbFramebufferUpdateRequest: { RegionRec tmpRegion; BoxRec box; if ((n = ReadExact(cl, ((char *)&msg) + 1, sz_rfbFramebufferUpdateRequestMsg-1)) <= 0) { if (n != 0) rfbLogPerror("rfbProcessClientNormalMessage: read"); rfbCloseClient(cl); return; } //rfbLog("FUR: %d (%d,%d x %d,%d)", msg.fur.incremental, msg.fur.x, msg.fur.y, msg.fur.w, msg.fur.h); box.x1 = Swap16IfLE(msg.fur.x)*cl->scalingFactor; box.y1 = Swap16IfLE(msg.fur.y)*cl->scalingFactor; box.x2 = (box.x1 + Swap16IfLE(msg.fur.w))*cl->scalingFactor; box.y2 = (box.y1 + Swap16IfLE(msg.fur.h))*cl->scalingFactor; SAFE_REGION_INIT(pScreen,&tmpRegion,&box,0); pthread_mutex_lock(&cl->updateMutex); REGION_UNION(pScreen, &cl->requestedRegion, &cl->requestedRegion, &tmpRegion); if (!msg.fur.incremental) { REGION_UNION(pScreen,&cl->modifiedRegion,&cl->modifiedRegion, &tmpRegion); } pthread_mutex_unlock(&cl->updateMutex); pthread_cond_signal(&cl->updateCond); REGION_UNINIT(pScreen,&tmpRegion); return; } case rfbKeyEvent: { if (!cl->disableRemoteEvents) cl->rfbKeyEventsRcvd++; if ((n = ReadExact(cl, ((char *)&msg) + 1, sz_rfbKeyEventMsg - 1)) <= 0) { if (n != 0) rfbLogPerror("rfbProcessClientNormalMessage: read"); rfbCloseClient(cl); return; } if (!cl->disableRemoteEvents) KbdAddEvent(msg.ke.down, (KeySym)Swap32IfLE(msg.ke.key), cl); return; } case rfbPointerEvent: { if (!cl->disableRemoteEvents) cl->rfbPointerEventsRcvd++; if ((n = ReadExact(cl, ((char *)&msg) + 1, sz_rfbPointerEventMsg - 1)) <= 0) { if (n != 0) rfbLogPerror("rfbProcessClientNormalMessage: read"); rfbCloseClient(cl); return; } if (cl->disableRemoteEvents || (pointerClient && (pointerClient != cl))) return; if (msg.pe.buttonMask == 0) pointerClient = NULL; else pointerClient = cl; PtrAddEvent(msg.pe.buttonMask, (Swap16IfLE(msg.pe.x)+cl->scalingFactor-1)*cl->scalingFactor, (Swap16IfLE(msg.pe.y)+cl->scalingFactor-1)*cl->scalingFactor, cl); return; } case rfbClientCutText: { if ((n = ReadExact(cl, ((char *)&msg) + 1, sz_rfbClientCutTextMsg - 1)) <= 0) { if (n != 0) rfbLogPerror("rfbProcessClientNormalMessage: read"); rfbCloseClient(cl); return; } msg.cct.length = Swap32IfLE(msg.cct.length); str = (char *)xalloc(msg.cct.length); if ((n = ReadExact(cl, str, msg.cct.length)) <= 0) { if (n != 0) rfbLogPerror("rfbProcessClientNormalMessage: read"); xfree(str); rfbCloseClient(cl); return; } if (!cl->disableRemoteEvents) { rfbSetCutText(cl, str, msg.cct.length); } xfree(str); return; } /* SERVER SCALING EXTENSIONS */ case rfbSetScaleFactorULTRA: case rfbSetScaleFactor: { rfbReSizeFrameBufferMsg rsfb; if ((n = ReadExact(cl, ((char *)&msg) + 1, sz_rfbSetScaleFactorMsg-1)) <= 0) { if (n != 0) rfbLogPerror("rfbProcessClientNormalMessage: read"); rfbCloseClient(cl); return; } if( cl->scalingFactor != msg.ssf.scale ){ const unsigned long csh = (rfbScreen.height+msg.ssf.scale-1) / msg.ssf.scale; const unsigned long csw = (rfbScreen.width +msg.ssf.scale-1) / msg.ssf.scale; if (cl->scalingFactor != 1) free(cl->scalingFrameBuffer); cl->scalingFactor = msg.ssf.scale; rfbLog("Server Side Scaling: %d for client %s", msg.ssf.scale, cl->host); if (cl->scalingFactor == 1) { cl->scalingFrameBuffer = cl->screenBuffer; cl->scalingPaddedWidthInBytes = rfbScreen.paddedWidthInBytes; } else { cl->scalingFrameBuffer = malloc( csw*csh*rfbScreen.bitsPerPixel/8 ); cl->scalingPaddedWidthInBytes = csw * rfbScreen.bitsPerPixel/8; } /* Now notify the client of the new desktop area */ if (msg.type == rfbSetScaleFactor) { rsfb.type = rfbReSizeFrameBuffer; rsfb.desktop_w = Swap16IfLE(rfbScreen.width); rsfb.desktop_h = Swap16IfLE(rfbScreen.height); rsfb.buffer_w = Swap16IfLE(csw); rsfb.buffer_h = Swap16IfLE(csh); if (WriteExact(cl, (char *)&rsfb, sizeof(rsfb)) < 0) { rfbLogPerror("rfbProcessClientNormalMessage: write"); rfbCloseClient(cl); return; } } else { // What does UltraVNC expect here probably just a resize event rfbFramebufferUpdateMsg *fu = (rfbFramebufferUpdateMsg *)cl->updateBuf; fu->type = rfbFramebufferUpdate; fu->nRects = Swap16IfLE(1); cl->ublen = sz_rfbFramebufferUpdateMsg; rfbSendScreenUpdateEncoding(cl); } } return; } case rfbRichClipboardAvailable: rfbReceiveRichClipboardAvailable(cl); return; case rfbRichClipboardRequest: rfbReceiveRichClipboardRequest(cl); return; case rfbRichClipboardData: rfbReceiveRichClipboardData(cl); return; default: { rfbLog("ERROR: Client Sent Message: unknown message type %d", msg.type); rfbLog("...... Closing connection to client %s", cl->host); rfbCloseClient(cl); return; } } } /* * rfbSendFramebufferUpdate - send the currently pending framebuffer update to * the RFB client. */ Bool rfbSendFramebufferUpdate(rfbClientPtr cl, RegionRec updateRegion) { int i; uint32_t nUpdateRegionRects = 0; Bool sendRichCursorEncoding = FALSE; Bool sendCursorPositionEncoding = FALSE; rfbFramebufferUpdateMsg *fu = (rfbFramebufferUpdateMsg *)cl->updateBuf; /* Now send the update */ cl->rfbFramebufferUpdateMessagesSent++; if (cl->preferredEncoding == rfbEncodingCoRRE) { for (i = 0; i < REGION_NUM_RECTS(&updateRegion); i++) { int x = REGION_RECTS(&updateRegion)[i].x1; int y = REGION_RECTS(&updateRegion)[i].y1; int w = REGION_RECTS(&updateRegion)[i].x2 - x; int h = REGION_RECTS(&updateRegion)[i].y2 - y; nUpdateRegionRects += (((w-1) / cl->correMaxWidth + 1) * ((h-1) / cl->correMaxHeight + 1)); } } else if (cl->preferredEncoding == rfbEncodingZlib) { for (i = 0; i < REGION_NUM_RECTS(&updateRegion); i++) { int x = REGION_RECTS(&updateRegion)[i].x1; int y = REGION_RECTS(&updateRegion)[i].y1; int w = REGION_RECTS(&updateRegion)[i].x2 - x; int h = REGION_RECTS(&updateRegion)[i].y2 - y; nUpdateRegionRects += (((h-1) / (ZLIB_MAX_SIZE( w ) / w)) + 1); } } else if (cl->preferredEncoding == rfbEncodingTight) { for (i = 0; i < REGION_NUM_RECTS(&updateRegion); i++) { int x = REGION_RECTS(&updateRegion)[i].x1; int y = REGION_RECTS(&updateRegion)[i].y1; int w = REGION_RECTS(&updateRegion)[i].x2 - x; int h = REGION_RECTS(&updateRegion)[i].y2 - y; int n = rfbNumCodedRectsTight(cl, x, y, w, h); if (n == 0) { nUpdateRegionRects = 0xFFFF; break; } nUpdateRegionRects += n; } } else { nUpdateRegionRects = REGION_NUM_RECTS(&updateRegion); } // Sometimes send the mouse cursor update also if (nUpdateRegionRects != 0xFFFF) { if (rfbShouldSendNewCursor(cl)) { sendRichCursorEncoding = TRUE; nUpdateRegionRects++; } if (rfbShouldSendNewPosition(cl)) { sendCursorPositionEncoding = TRUE; nUpdateRegionRects++; } if (cl->needNewScreenSize) { nUpdateRegionRects++; } } fu->type = rfbFramebufferUpdate; fu->nRects = Swap16IfLE(nUpdateRegionRects); cl->ublen = sz_rfbFramebufferUpdateMsg; // Sometimes send the mouse cursor update (this can fail with big cursors so we'll try it first if (sendRichCursorEncoding) { if (!rfbSendRichCursorUpdate(cl)) { // rfbLog("Error Sending Cursor"); // We'll log at the lower level if it fails and only fail a few times // return FALSE; Since this is the first update we can "skip the cursor update" instead of failing the whole thing --nUpdateRegionRects; fu->nRects = Swap16IfLE(nUpdateRegionRects); } } if (sendCursorPositionEncoding) { if (!rfbSendCursorPos(cl)) { rfbLog("Error Sending Cursor Position"); return FALSE; } } if (cl->needNewScreenSize) { if (rfbSendScreenUpdateEncoding(cl)) { cl->needNewScreenSize = FALSE; } else { rfbLog("Error Sending New Screen Size"); return FALSE; } } cl->screenBuffer = rfbGetFramebuffer(); for (i = 0; i < REGION_NUM_RECTS(&updateRegion); i++) { uint32_t x = REGION_RECTS(&updateRegion)[i].x1; uint32_t y = REGION_RECTS(&updateRegion)[i].y1; uint32_t w = REGION_RECTS(&updateRegion)[i].x2 - x; uint32_t h = REGION_RECTS(&updateRegion)[i].y2 - y; rfbGetFramebufferUpdateInRect(x,y,w,h); // Refresh with latest pointer (should be "read-locked" throughout here with CG but I don't see that option) if (cl->scalingFactor != 1) CopyScalingRect( cl, &x, &y, &w, &h, TRUE); else cl->scalingFrameBuffer = cl->screenBuffer; cl->rfbRawBytesEquivalent += (sz_rfbFramebufferUpdateRectHeader + w * (cl->format.bitsPerPixel / 8) * h); switch (cl->preferredEncoding) { case rfbEncodingRaw: if (!rfbSendRectEncodingRaw(cl, x, y, w, h)) { return FALSE; } break; case rfbEncodingRRE: if (!rfbSendRectEncodingRRE(cl, x, y, w, h)) { return FALSE; } break; case rfbEncodingCoRRE: if (!rfbSendRectEncodingCoRRE(cl, x, y, w, h)) { return FALSE; } break; case rfbEncodingHextile: if (!rfbSendRectEncodingHextile(cl, x, y, w, h)) { return FALSE; } break; case rfbEncodingZlib: if (!rfbSendRectEncodingZlib(cl, x, y, w, h)) { return FALSE; } break; case rfbEncodingTight: if (!rfbSendRectEncodingTight(cl, x, y, w, h)) { return FALSE; } break; case rfbEncodingZlibHex: if (!rfbSendRectEncodingZlibHex(cl, x, y, w, h)) { return FALSE; } break; case rfbEncodingZRLE: if (!rfbSendRectEncodingZRLE(cl, x, y, w, h)) { return FALSE; } break; } } if (nUpdateRegionRects == 0xFFFF && !rfbSendLastRectMarker(cl)) return FALSE; if (!rfbSendUpdateBuf(cl)) return FALSE; return TRUE; } Bool rfbSendScreenUpdateEncoding(rfbClientPtr cl) { rfbFramebufferUpdateRectHeader rect; if (cl->ublen + sz_rfbFramebufferUpdateRectHeader > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } rect.r.x = 0; rect.r.y = 0; rect.r.w = Swap16IfLE((rfbScreen.width +cl->scalingFactor-1) / cl->scalingFactor); rect.r.h = Swap16IfLE((rfbScreen.height+cl->scalingFactor-1) / cl->scalingFactor); rect.encoding = Swap32IfLE(rfbEncodingDesktopResize); memcpy(&cl->updateBuf[cl->ublen], &rect, sz_rfbFramebufferUpdateRectHeader); cl->ublen += sz_rfbFramebufferUpdateRectHeader; cl->rfbRectanglesSent[rfbStatsDesktopResize]++; cl->rfbBytesSent[rfbStatsDesktopResize] += sz_rfbFramebufferUpdateRectHeader; // Let's push this out right away return rfbSendUpdateBuf(cl); } /* * Send a given rectangle in raw encoding (rfbEncodingRaw). */ Bool rfbSendRectEncodingRaw(rfbClientPtr cl, int x, int y, int w, int h) { rfbFramebufferUpdateRectHeader rect; int nlines; int bytesPerLine = w * (cl->format.bitsPerPixel / 8); char *fbptr = (cl->scalingFrameBuffer + (cl->scalingPaddedWidthInBytes * y) + (x * (rfbScreen.bitsPerPixel / 8))); if (cl->ublen + sz_rfbFramebufferUpdateRectHeader > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } rect.r.x = Swap16IfLE(x); rect.r.y = Swap16IfLE(y); rect.r.w = Swap16IfLE(w); rect.r.h = Swap16IfLE(h); rect.encoding = Swap32IfLE(rfbEncodingRaw); memcpy(&cl->updateBuf[cl->ublen], &rect, sz_rfbFramebufferUpdateRectHeader); cl->ublen += sz_rfbFramebufferUpdateRectHeader; cl->rfbRectanglesSent[rfbEncodingRaw]++; cl->rfbBytesSent[rfbEncodingRaw] += sz_rfbFramebufferUpdateRectHeader + bytesPerLine * h; nlines = (UPDATE_BUF_SIZE - cl->ublen) / bytesPerLine; while (TRUE) { if (nlines > h) nlines = h; (*cl->translateFn)(cl->translateLookupTable, &rfbServerFormat, &cl->format, fbptr, &cl->updateBuf[cl->ublen], cl->scalingPaddedWidthInBytes, w, nlines); cl->ublen += nlines * bytesPerLine; h -= nlines; if (h == 0) /* rect fitted in buffer, do next one */ return TRUE; /* buffer full - flush partial rect and do another nlines */ if (!rfbSendUpdateBuf(cl)) return FALSE; fbptr += (cl->scalingPaddedWidthInBytes * nlines); nlines = (UPDATE_BUF_SIZE - cl->ublen) / bytesPerLine; if (nlines == 0) { rfbLog("rfbSendRectEncodingRaw: send buffer too small for %d " "bytes per line\n", bytesPerLine); rfbCloseClient(cl); return FALSE; } } } /* * Send an empty rectangle with encoding field set to value of * rfbEncodingLastRect to notify client that this is the last * rectangle in framebuffer update ("LastRect" extension of RFB * protocol). */ Bool rfbSendLastRectMarker(rfbClientPtr cl) { rfbFramebufferUpdateRectHeader rect; if (cl->ublen + sz_rfbFramebufferUpdateRectHeader > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } rect.encoding = Swap32IfLE(rfbEncodingLastRect); rect.r.x = 0; rect.r.y = 0; rect.r.w = 0; rect.r.h = 0; memcpy(&cl->updateBuf[cl->ublen], &rect, sz_rfbFramebufferUpdateRectHeader); cl->ublen += sz_rfbFramebufferUpdateRectHeader; cl->rfbLastRectMarkersSent++; cl->rfbLastRectBytesSent += sz_rfbFramebufferUpdateRectHeader; return TRUE; } /* * Send the contents of updateBuf. Returns 1 if successful, -1 if * not (errno should be set). */ Bool rfbSendUpdateBuf(rfbClientPtr cl) { /* int i; for (i = 0; i < cl->ublen; i++) { fprintf(stderr,"%02x ",((unsigned char *)cl->updateBuf)[i]); } fprintf(stderr,"\n"); */ if (WriteExact(cl, cl->updateBuf, cl->ublen) < 0) { rfbLogPerror("rfbSendUpdateBuf: write"); rfbCloseClient(cl); return FALSE; } cl->ublen = 0; return TRUE; } /* * rfbSendServerCutText sends a ServerCutText message to all the clients. */ void rfbSendServerCutText(rfbClientPtr cl, char *str, size_t len) { rfbServerCutTextMsg sct; sct.type = rfbServerCutText; sct.length = Swap32IfLE(len); if (WriteExact(cl, (char *)&sct, sz_rfbServerCutTextMsg) < 0) { rfbLogPerror("rfbSendServerCutText: write"); rfbCloseClient(cl); } if (WriteExact(cl, str, len) < 0) { rfbLogPerror("rfbSendServerCutText: write"); rfbCloseClient(cl); } } /* void rfbSendServerCutText(char *str, int len) { rfbClientPtr cl; rfbServerCutTextMsg sct; rfbClientIteratorPtr iterator; // XXX bad-- writing with client list lock held iterator = rfbGetClientIterator(); while ((cl = rfbClientIteratorNext(iterator)) != NULL) { sct.type = rfbServerCutText; sct.length = Swap32IfLE(len); if (WriteExact(cl, (char *)&sct, sz_rfbServerCutTextMsg) < 0) { rfbLogPerror("rfbSendServerCutText: write"); rfbCloseClient(cl); continue; } if (WriteExact(cl, str, len) < 0) { rfbLogPerror("rfbSendServerCutText: write"); rfbCloseClient(cl); } } rfbReleaseClientIterator(iterator); } */ /* SERVER SCALING EXTENSIONS */ static void CopyScalingRect(rfbClientPtr cl, uint32_t* x, uint32_t* y, uint32_t* w, uint32_t* h, bool bDoScaling) { uint32_t cx, cy, cw, ch; unsigned char* srcptr; unsigned char* dstptr; unsigned char* tmpptr; unsigned long pixel_value=0, red, green, blue; unsigned long xx, yy, u, v; const unsigned long bytesPerPixel = rfbScreen.bitsPerPixel/8; const uint32_t csh = (rfbScreen.height+cl->scalingFactor-1)/ cl->scalingFactor; const uint32_t csw = (rfbScreen.width +cl->scalingFactor-1)/ cl->scalingFactor; cy = (*y) / cl->scalingFactor; ch = (*h+cl->scalingFactor-1) / cl->scalingFactor+1; cx = (*x) / cl->scalingFactor; cw = (*w+cl->scalingFactor-1) / cl->scalingFactor+1; if( cy > csh ){ cy = csh; } if( cy + ch > csh ){ ch = csh - cy; } if( cx > csw ){ cx = csw; } if( cx + cw > csw ){ cw = csw - cx; } if( bDoScaling ){ uint32_t rx = cx * cl->scalingFactor; uint32_t ry = cy * cl->scalingFactor; #if 0 uint32_t rh = ch * cl->scalingFactor; uint32_t rw = cw * cl->scalingFactor; #endif /* Copy and scale data from screen buffer to scaling buffer */ srcptr = (unsigned char*)cl->screenBuffer + (ry * rfbScreen.paddedWidthInBytes ) + (rx * bytesPerPixel); dstptr = (unsigned char*)cl->scalingFrameBuffer+ (cy * cl->scalingPaddedWidthInBytes) + (cx * bytesPerPixel); if( cl->format.trueColour ) { /* Blend neighbouring pixels together */ for( yy=0; yy < ch; yy++ ){ for( xx=0; xx < cw; xx++ ){ red = green = blue = 0; for( v = 0; v < (unsigned long)cl->scalingFactor; v++ ){ tmpptr = srcptr; for( u = 0; u < (unsigned long)cl->scalingFactor; u++ ){ switch( bytesPerPixel ){ case 1: pixel_value = (unsigned long)*(unsigned char* )tmpptr; break; case 2: pixel_value = (unsigned long)*(unsigned short*)tmpptr; break; case 3: /* 24bpp may cause bus error? */ case 4: pixel_value = (unsigned long)*(unsigned long* )tmpptr; break; } red += (pixel_value >> rfbServerFormat.redShift )& rfbServerFormat.redMax; green += (pixel_value >> rfbServerFormat.greenShift)& rfbServerFormat.greenMax; blue += (pixel_value >> rfbServerFormat.blueShift )& rfbServerFormat.blueMax; tmpptr += rfbScreen.paddedWidthInBytes; } srcptr += bytesPerPixel; } red /= cl->scalingFactor * cl->scalingFactor; green /= cl->scalingFactor * cl->scalingFactor; blue /= cl->scalingFactor * cl->scalingFactor; pixel_value = (red << rfbServerFormat.redShift) + (green << rfbServerFormat.greenShift) + (blue << rfbServerFormat.blueShift); switch( bytesPerPixel ){ case 1: *(unsigned char* )dstptr = (unsigned char )pixel_value; break; case 2: *(unsigned short*)dstptr = (unsigned short)pixel_value; break; case 3: /* 24bpp may cause bus error? */ case 4: *(unsigned long* )dstptr = (unsigned long )pixel_value; break; } dstptr += bytesPerPixel; } srcptr += (rfbScreen.paddedWidthInBytes - cw * bytesPerPixel)* cl->scalingFactor; dstptr += cl->scalingPaddedWidthInBytes - cw * bytesPerPixel; } }else{ /* Not truecolour, so we can't blend. Just use the top-left pixel instead */ for( yy=0; yy < ch; yy++ ){ for( xx=0; xx < cw; xx++ ){ memcpy( dstptr, srcptr, bytesPerPixel); srcptr += bytesPerPixel * cl->scalingFactor; dstptr += bytesPerPixel; } srcptr += (rfbScreen.paddedWidthInBytes - cw * bytesPerPixel)* cl->scalingFactor; dstptr += cl->scalingPaddedWidthInBytes - cw * bytesPerPixel; } } } *y = cy; *h = ch; *x = cx; *w = cw; } ================================================ FILE: OSXvnc-server/rfbserver.h ================================================ // This structure represents the entire state of the RFB server // We use it for passing off to the bundles typedef struct rfbserver { id vncServer; char *desktopName; int rfbPort; BOOL rfbLocalhostOnly; pthread_mutex_t listenerAccepting; pthread_cond_t listenerGotNewClient; } rfbserver; ================================================ FILE: OSXvnc-server/rre.c ================================================ /* * rre.c * * Routines to implement Rise-and-Run-length Encoding (RRE). This * code is based on krw's original javatel rfbserver. */ /* * OSXvnc Copyright (C) 2001 Dan McGuirk . * Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge. * All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include #include #include "rfb.h" /* * rreBeforeBuf contains pixel data in the client's format. * rreAfterBuf contains the RRE encoded version. If the RRE encoded version is * larger than the raw data or if it exceeds rreAfterBufSize then * raw encoding is used instead. */ static int rreBeforeBufSize = 0; static char *rreBeforeBuf = NULL; static int rreAfterBufSize = 0; static char *rreAfterBuf = NULL; static int rreAfterBufLen; static int subrectEncode8(CARD8 *data, int w, int h); static int subrectEncode16(CARD16 *data, int w, int h); static int subrectEncode32(CARD32 *data, int w, int h); static CARD32 getBgColour(char *data, int size, int bpp); /* * rfbSendRectEncodingRRE - send a given rectangle using RRE encoding. */ Bool rfbSendRectEncodingRRE(rfbClientPtr cl, int x, int y, int w, int h) { rfbFramebufferUpdateRectHeader rect; rfbRREHeader hdr; int nSubrects; int i; char *fbptr = (cl->scalingFrameBuffer + (cl->scalingPaddedWidthInBytes * y) + (x * (rfbScreen.bitsPerPixel / 8))); int maxRawSize = (rfbScreen.width * rfbScreen.height * (cl->format.bitsPerPixel / 8)); if (rreBeforeBufSize < maxRawSize) { rreBeforeBufSize = maxRawSize; if (rreBeforeBuf == NULL) rreBeforeBuf = (char *)xalloc(rreBeforeBufSize); else rreBeforeBuf = (char *)xrealloc(rreBeforeBuf, rreBeforeBufSize); } if (rreAfterBufSize < maxRawSize) { rreAfterBufSize = maxRawSize; if (rreAfterBuf == NULL) rreAfterBuf = (char *)xalloc(rreAfterBufSize); else rreAfterBuf = (char *)xrealloc(rreAfterBuf, rreAfterBufSize); } (*cl->translateFn)(cl->translateLookupTable, &rfbServerFormat, &cl->format, fbptr, rreBeforeBuf, cl->scalingPaddedWidthInBytes, w, h); switch (cl->format.bitsPerPixel) { case 8: nSubrects = subrectEncode8((CARD8 *)rreBeforeBuf, w, h); break; case 16: nSubrects = subrectEncode16((CARD16 *)rreBeforeBuf, w, h); break; case 32: nSubrects = subrectEncode32((CARD32 *)rreBeforeBuf, w, h); break; default: rfbLog("getBgColour: bpp %d?",cl->format.bitsPerPixel); exit(1); } if (nSubrects < 0) { /* RRE encoding was too large, use raw */ return rfbSendRectEncodingRaw(cl, x, y, w, h); } cl->rfbRectanglesSent[rfbEncodingRRE]++; cl->rfbBytesSent[rfbEncodingRRE] += (sz_rfbFramebufferUpdateRectHeader + sz_rfbRREHeader + rreAfterBufLen); if (cl->ublen + sz_rfbFramebufferUpdateRectHeader + sz_rfbRREHeader > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } rect.r.x = Swap16IfLE(x); rect.r.y = Swap16IfLE(y); rect.r.w = Swap16IfLE(w); rect.r.h = Swap16IfLE(h); rect.encoding = Swap32IfLE(rfbEncodingRRE); memcpy(&cl->updateBuf[cl->ublen], &rect, sz_rfbFramebufferUpdateRectHeader); cl->ublen += sz_rfbFramebufferUpdateRectHeader; hdr.nSubrects = Swap32IfLE(nSubrects); memcpy(&cl->updateBuf[cl->ublen], &hdr, sz_rfbRREHeader); cl->ublen += sz_rfbRREHeader; for (i = 0; i < rreAfterBufLen;) { int bytesToCopy = UPDATE_BUF_SIZE - cl->ublen; if (i + bytesToCopy > rreAfterBufLen) { bytesToCopy = rreAfterBufLen - i; } memcpy(&cl->updateBuf[cl->ublen], &rreAfterBuf[i], bytesToCopy); cl->ublen += bytesToCopy; i += bytesToCopy; if (cl->ublen == UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } } return TRUE; } /* * subrectEncode() encodes the given multicoloured rectangle as a background * colour overwritten by single-coloured rectangles. It returns the number * of subrectangles in the encoded buffer, or -1 if subrect encoding won't * fit in the buffer. It puts the encoded rectangles in rreAfterBuf. The * single-colour rectangle partition is not optimal, but does find the biggest * horizontal or vertical rectangle top-left anchored to each consecutive * coordinate position. * * The coding scheme is simply [...] where each * is []. */ #define DEFINE_SUBRECT_ENCODE(bpp) \ static int \ subrectEncode##bpp(CARD##bpp *data, int w,int h) \ { \ CARD##bpp cl; \ rfbRectangle subrect; \ int x,y; \ int i,j; \ int hx=0,hy,vx=0,vy; \ int hyflag; \ CARD##bpp *seg; \ CARD##bpp *line; \ int hw,hh,vw,vh; \ int thex,they,thew,theh; \ int numsubs = 0; \ int newLen; \ CARD##bpp bg = (CARD##bpp)getBgColour((char*)data,w*h,bpp); \ \ *((CARD##bpp*)rreAfterBuf) = bg; \ \ rreAfterBufLen = (bpp/8); \ \ for (y=0; y 0) && (i >= hx)) {hy += 1;} else {hyflag = 0;} \ } \ vy = j-1; \ \ /* We now have two possible subrects: (x,y,hx,hy) and (x,y,vx,vy) \ * We'll choose the bigger of the two. \ */ \ hw = hx-x+1; \ hh = hy-y+1; \ vw = vx-x+1; \ vh = vy-y+1; \ \ thex = x; \ they = y; \ \ if ((hw*hh) > (vw*vh)) { \ thew = hw; \ theh = hh; \ } else { \ thew = vw; \ theh = vh; \ } \ \ subrect.x = Swap16IfLE(thex); \ subrect.y = Swap16IfLE(they); \ subrect.w = Swap16IfLE(thew); \ subrect.h = Swap16IfLE(theh); \ \ newLen = rreAfterBufLen + (bpp/8) + sz_rfbRectangle; \ if ((newLen > (w * h * (bpp/8))) || (newLen > rreAfterBufSize)) \ return -1; \ \ numsubs += 1; \ *((CARD##bpp*)(rreAfterBuf + rreAfterBufLen)) = cl; \ rreAfterBufLen += (bpp/8); \ memcpy(&rreAfterBuf[rreAfterBufLen], &subrect, sz_rfbRectangle); \ rreAfterBufLen += sz_rfbRectangle; \ \ /* \ * Now mark the subrect as done. \ */ \ for (j=they; j < (they+theh); j++) { \ for (i=thex; i < (thex+thew); i++) { \ data[j*w+i] = bg; \ } \ } \ } \ } \ } \ \ return numsubs; \ } DEFINE_SUBRECT_ENCODE(8) DEFINE_SUBRECT_ENCODE(16) DEFINE_SUBRECT_ENCODE(32) /* * getBgColour() gets the most prevalent colour in a byte array. */ static CARD32 getBgColour(char *data, int size, int bpp) { #define NUMCLRS 256 static int counts[NUMCLRS]; int i,j,k; int maxcount = 0; CARD8 maxclr = 0; if (bpp != 8) { if (bpp == 16) { return ((CARD16 *)data)[0]; } else if (bpp == 32) { return ((CARD32 *)data)[0]; } else { rfbLog("getBgColour: bpp %d?",bpp); exit(1); } } for (i=0; i= NUMCLRS) { rfbLog("getBgColour: unusual colour = %d", k); exit(1); } counts[k] += 1; if (counts[k] > maxcount) { maxcount = counts[k]; maxclr = ((CARD8 *)data)[j]; } } return maxclr; } ================================================ FILE: OSXvnc-server/screencapture.c ================================================ /***************************************************************************** * mac.c: Screen capture module for the Mac. ***************************************************************************** * Copyright (C) 2004, 2008 the VideoLAN team * $Id: screencapture.c,v 1.1 2009/09/10 14:37:18 jonathanosx Exp $ * * Authors: Derk-Jan Hartman * arai * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ /***************************************************************************** * Preamble *****************************************************************************/ #import #import "screencapture.h" // This function has to be called before doing any screen capture screen_data_t *screen_InitCapture() { CGLPixelFormatAttribute attribs[4]; CGLPixelFormatObj pix, pix2; GLint npix; GLint viewport[4]; screen_data_t * p_data = ( screen_data_t * ) malloc( sizeof( screen_data_t ) ); attribs[0] = kCGLPFAFullScreen; attribs[1] = kCGLPFADisplayMask; attribs[2] = CGDisplayIDToOpenGLDisplayMask( CGMainDisplayID() ); attribs[3] = 0; // Create a fullscreen context CGLChoosePixelFormat( attribs, &pix, &npix ); CGLCreateContext( pix, NULL, &( p_data->screen ) ); CGLDestroyPixelFormat( pix ); CGLSetCurrentContext( p_data->screen ); CGLSetFullScreen( p_data->screen ); // Get the screen size glGetIntegerv( GL_VIEWPORT, viewport ); p_data->screen_width = viewport[2]; p_data->screen_height = viewport[3]; p_data->offscreen_width = 2; p_data->offscreen_height = 2; while (p_data->offscreen_width < p_data->screen_width) p_data->offscreen_width *= 2; while (p_data->offscreen_height < p_data->screen_height) p_data->offscreen_height *= 2; // Save screen size attribs [0] = kCGLPFAOffScreen; attribs [1] = kCGLPFAColorSize; attribs [2] = 32; attribs [3] = 0; // Create an offscreen context CGLChoosePixelFormat( attribs, &pix2, &npix ); CGLCreateContext( pix2, NULL, &( p_data->scaled ) ); CGLDestroyPixelFormat( pix2 ); CGLSetCurrentContext( p_data->scaled ); p_data->scaled_image = ( char * )malloc( p_data->screen_width * p_data->screen_height * 4 ); CGLSetOffScreen( p_data->scaled, p_data->screen_width, p_data->screen_height, p_data->screen_width * 4, p_data->scaled_image ); glGenTextures( 1, &( p_data->texture ) ); glBindTexture( GL_TEXTURE_2D, p_data->texture ); p_data->texture_image = ( char * )malloc( p_data->offscreen_width * p_data->offscreen_height * 4 ); // Parameters for textures glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP ); // Allocate memory for the screen capture (only one time) p_data->data_return = (unsigned char *) malloc( p_data->screen_width * p_data->screen_height * 4 ); return p_data; } // This function takes a screen capture using opengl char * screen_Capture(screen_data_t * p_data) { // Check if we called screen_InitCapure() (the p_data should be allocated) if (p_data == NULL) return NULL; // TODO: Search for the right pixel format //if (bitPerPixel == 16) pixelFormat = GL_UNSIGNED_SHORT_1_5_5_5_REV; int pixelFormat = GL_UNSIGNED_INT_8_8_8_8_REV; // Change the current context to the desktop context CGLSetCurrentContext( p_data->screen ); glPixelStorei(GL_PACK_ROW_LENGTH, p_data->offscreen_width); // Take a screenshot of the screen glReadPixels(0, 0, p_data->screen_width, p_data->screen_height, GL_BGRA, pixelFormat, p_data->texture_image ); //return p_data->texture_image; glPixelStorei(GL_PACK_ROW_LENGTH, 0); // Change to our own context CGLSetCurrentContext( p_data->scaled ); // Enable textures glEnable( GL_TEXTURE_2D ); glBindTexture( GL_TEXTURE_2D, p_data->texture ); // Change the texture with the screen capture made before glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, p_data->offscreen_width, p_data->offscreen_height, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, p_data->texture_image ); // Clear our context glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); glClear( GL_COLOR_BUFFER_BIT ); float max_width = p_data->screen_width/(double)p_data->offscreen_width; float max_height = p_data->screen_height/(double)p_data->offscreen_height; // Draw the screen capture (and we also flip it horizontally) glColor3f( 1.0f, 1.0f, 1.0f ); glEnable( GL_TEXTURE_2D ); glBindTexture( GL_TEXTURE_2D, p_data->texture ); glBegin( GL_POLYGON ); glTexCoord2f( 0.0 , max_height ); glVertex2f( -1.0, -1.0 ); glTexCoord2f( max_width, max_height ); glVertex2f( 1.0, -1.0 ); glTexCoord2f( max_width, 0.0 ); glVertex2f( 1.0, 1.0 ); glTexCoord2f( 0.0 , 0.0 ); glVertex2f( -1.0, 1.0 ); glEnd(); glDisable( GL_TEXTURE_2D ); // Get the pixels after transformation glReadPixels( 0, 0, p_data->screen_width, p_data->screen_height, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, p_data->data_return ); return (char *) p_data->data_return; } void screen_CloseCapture(screen_data_t * p_data) { // Free data if (p_data != NULL) { CGLSetCurrentContext( NULL ); CGLClearDrawable( p_data->screen ); CGLDestroyContext( p_data->screen ); if (p_data->data_return != NULL) { free(p_data->data_return); } free(p_data); } } ================================================ FILE: OSXvnc-server/screencapture.h ================================================ /* * screencapture.h * OSXvnc * * Created by Jonathan Gillaspie on 6/1/09. * Copyright 2009 __MyCompanyName__. All rights reserved. * */ #import #import typedef struct screen_data_t { CGLContextObj screen; CGLContextObj scaled; char *scaled_image; GLuint texture; char *texture_image; // Data capture from screen unsigned char * data_return; int screen_width; int screen_height; int offscreen_width; int offscreen_height; } screen_data_t; ================================================ FILE: OSXvnc-server/sockets.c ================================================ /* * sockets.c - deal with TCP & UDP sockets. * * This code should be independent of any changes in the RFB protocol. It just * deals with the X server scheduling stuff, calling rfbNewClientConnection and * rfbProcessClientMessage to actually deal with the protocol. If a socket * needs to be closed for any reason then rfbCloseClient should be called, and * this in turn will call rfbClientConnectionGone. To make an active * connection out, call rfbConnect - note that this does _not_ call * rfbNewClientConnection. * * This file is divided into two types of function. Those beginning with * "rfb" are specific to sockets using the RFB protocol. Those without the * "rfb" prefix are more general socket routines (which are used by the http * code). * * Thanks to Karl Hakimian for pointing out that some platforms return EAGAIN * not EWOULDBLOCK. */ /* * OSXvnc Copyright (C) 2001 Dan McGuirk . * Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge. * All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include #include #include #include #include #include //#include -- This conflicts with Carbon #include #include #include #include #include #include "rfb.h" int rfbMaxClientWait = 20000; /* time (ms) after which we decide client has gone away - needed to stop us hanging */ void rfbCloseClient(rfbClientPtr cl) { close(cl->sock); cl->sock = -1; } /* * ReadExact reads an exact number of bytes from a client. Returns 1 if * those bytes have been read, 0 if the other end has closed, or -1 if an error * occurred (errno is set to ETIMEDOUT if it timed out). */ int ReadExact(rfbClientPtr cl, void *data, size_t len) { char *buf = data; int sock = cl->sock; fd_set fds; struct timeval tv; while (len > 0) { ssize_t n = read(sock, buf, len); if (n > 0) { buf += n; len -= n; } else if (n == 0) { return 0; } else { if (errno != EWOULDBLOCK && errno != EAGAIN) { return -1; } FD_ZERO(&fds); FD_SET(sock, &fds); tv.tv_sec = rfbMaxClientWait / 1000; tv.tv_usec = (rfbMaxClientWait % 1000) * 1000; n = select(sock+1, &fds, NULL, NULL, &tv); if (n < 0) { rfbLogPerror("ReadExact: select"); return -1; } if (n == 0) { errno = ETIMEDOUT; return -1; } } } return 1; } /* * WriteExact writes an exact number of bytes to a client. Returns 1 if * those bytes have been written, or -1 if an error occurred (errno is set to * ETIMEDOUT if it timed out). */ int WriteExact(rfbClientPtr cl, const void *data, size_t len) { const char *buf = data; int sock = cl->sock; fd_set fds; struct timeval tv; int totalTimeWaited = 0; // pthread_mutex_lock(&cl->outputMutex); while (len > 0) { ssize_t n = write(sock, buf, len); if (n > 0) { buf += n; len -= n; } else if (n == 0) { rfbLog("WriteExact: write returned 0?"); exit(1); } else { if (errno != EWOULDBLOCK && errno != EAGAIN) { //pthread_mutex_unlock(&cl->outputMutex); return -1; } /* Retry every 5 seconds until we exceed rfbMaxClientWait. We need to do this because select doesn't necessarily return immediately when the other end has gone away */ FD_ZERO(&fds); FD_SET(sock, &fds); tv.tv_sec = 5; tv.tv_usec = 0; n = select(sock+1, NULL, &fds, NULL, &tv); if (n < 0) { rfbLogPerror("WriteExact: select"); //pthread_mutex_unlock(&cl->outputMutex); return -1; } if (n == 0) { totalTimeWaited += 5000; if (totalTimeWaited >= rfbMaxClientWait) { errno = ETIMEDOUT; //pthread_mutex_unlock(&cl->outputMutex); return -1; } } else { totalTimeWaited = 0; } } } //pthread_mutex_unlock(&cl->outputMutex); return 1; } ================================================ FILE: OSXvnc-server/stats.c ================================================ /* * stats.c */ /* * OSXvnc Copyright (C) 2001 Dan McGuirk . * Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge. * All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include #include #include "rfb.h" char* encNames[] = { "Raw", "CopyRect", "RRE", "[encoding 3]", "CoRRE", "Hextile", "Zlib", "Tight", "ZlibHextile", "[encoding 9]", "Cursor Shape Updates", "Cursor Position Updates", "Screen Resize", NULL, NULL, NULL, "ZRLE" }; void rfbResetStats(rfbClientPtr cl) { int i; for (i = 0; i < MAX_ENCODINGS; i++) { cl->rfbBytesSent[i] = 0; cl->rfbRectanglesSent[i] = 0; } cl->rfbLastRectMarkersSent = 0; cl->rfbLastRectBytesSent = 0; cl->rfbFramebufferUpdateMessagesSent = 0; cl->rfbRawBytesEquivalent = 0; cl->rfbKeyEventsRcvd = 0; cl->rfbPointerEventsRcvd = 0; } void rfbPrintStats(rfbClientPtr cl) { int i; int totalRectanglesSent = 0; int totalBytesSent = 0; rfbLog("Statistics:"); if ((cl->rfbKeyEventsRcvd != 0) || (cl->rfbPointerEventsRcvd != 0)) rfbLog(" key events received %d, pointer events %d", cl->rfbKeyEventsRcvd, cl->rfbPointerEventsRcvd); for (i = 0; i < MAX_ENCODINGS; i++) { totalRectanglesSent += cl->rfbRectanglesSent[i]; totalBytesSent += cl->rfbBytesSent[i]; } totalRectanglesSent += cl->rfbLastRectMarkersSent; totalBytesSent += cl->rfbLastRectBytesSent; rfbLog(" framebuffer updates %d, rectangles %d, bytes %d", cl->rfbFramebufferUpdateMessagesSent, totalRectanglesSent, totalBytesSent); if (cl->rfbLastRectMarkersSent != 0) rfbLog(" LastRect markers %d, bytes %d", cl->rfbLastRectMarkersSent, cl->rfbLastRectBytesSent); for (i = 0; i < MAX_ENCODINGS; i++) { if (cl->rfbRectanglesSent[i] != 0) rfbLog(" %s rectangles %d, bytes %d", encNames[i], cl->rfbRectanglesSent[i], cl->rfbBytesSent[i]); } if ((totalBytesSent - cl->rfbBytesSent[rfbEncodingCopyRect]) != 0) { rfbLog(" raw bytes equivalent %d, compression ratio %f", cl->rfbRawBytesEquivalent, (double)cl->rfbRawBytesEquivalent / (double)(totalBytesSent - cl->rfbBytesSent[rfbEncodingCopyRect] - cl->rfbLastRectBytesSent)); } } ================================================ FILE: OSXvnc-server/storepasswd.c ================================================ /* * OSXvnc Copyright (C) 2001 Dan McGuirk . * Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge. * All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include #include #include "vncauth.h" void usage(void) { printf("\nusage: storepasswd \n\n"); printf("Stores a password in encrypted format.\n"); printf("The resulting file can be used with the -rfbauth argument to OSXvnc.\n\n"); exit(1); } int main(int argc, char *argv[]) { if (argc != 3) usage(); if (vncEncryptAndStorePasswd(argv[1], argv[2]) != 0) { printf("storing password failed.\n"); return 1; } else { printf("storing password succeeded.\n"); return 0; } } ================================================ FILE: OSXvnc-server/tableinitcmtemplate.c ================================================ /* * tableinitcmtemplate.c - template for initialising lookup tables for * translation from a colour map to true colour. * * This file shouldn't be compiled. It is included multiple times by * translate.c, each time with a different definition of the macro OUT. * For each value of OUT, this file defines a function which allocates an * appropriately sized lookup table and initialises it. * * I know this code isn't nice to read because of all the macros, but * efficiency is important here. */ /* * OSXvnc Copyright (C) 2001 Dan McGuirk . * Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge. * All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #if !defined(OUT) #error "This file shouldn't be compiled." #error "It is included as part of translate.c" #endif #define OUT_T CONCAT2E(CARD,OUT) #define SwapOUT(x) CONCAT2E(Swap,OUT(x)) #define rfbInitColourMapSingleTableOUT \ CONCAT2E(rfbInitColourMapSingleTable,OUT) static void rfbInitColourMapSingleTableOUT (char **table, rfbPixelFormat *in, rfbPixelFormat *out) { int i, r, g, b; OUT_T *t; EntryPtr pent; int nEntries = 1 << in->bitsPerPixel; if (*table) free(*table); *table = (char *)malloc(nEntries * sizeof(OUT_T)); t = (OUT_T *)*table; pent = (EntryPtr)&rfbInstalledColormap->red[0]; for (i = 0; i < nEntries; i++) { if (pent->fShared) { r = pent->co.shco.red->color; g = pent->co.shco.green->color; b = pent->co.shco.blue->color; } else { r = pent->co.local.red; g = pent->co.local.green; b = pent->co.local.blue; } t[i] = ((((r * out->redMax + 32767) / 65535) << out->redShift) | (((g * out->greenMax + 32767) / 65535) << out->greenShift) | (((b * out->blueMax + 32767) / 65535) << out->blueShift)); #if (OUT != 8) if (out->bigEndian != in->bigEndian) { t[i] = SwapOUT(t[i]); } #endif pent++; } } #undef OUT_T #undef SwapOUT #undef rfbInitColourMapSingleTableOUT ================================================ FILE: OSXvnc-server/tableinittctemplate.c ================================================ /* * tableinittctemplate.c - template for initialising lookup tables for * truecolour to truecolour translation. * * This file shouldn't be compiled. It is included multiple times by * translate.c, each time with a different definition of the macro OUT. * For each value of OUT, this file defines two functions for initialising * lookup tables. One is for truecolour translation using a single lookup * table, the other is for truecolour translation using three separate * lookup tables for the red, green and blue values. * * I know this code isn't nice to read because of all the macros, but * efficiency is important here. */ /* * OSXvnc Copyright (C) 2001 Dan McGuirk . * Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge. * All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #if !defined(OUT) #error "This file shouldn't be compiled." #error "It is included as part of translate.c" #endif #define OUT_T CONCAT2E(CARD,OUT) #define SwapOUT(x) CONCAT2E(Swap,OUT(x)) #define rfbInitTrueColourSingleTableOUT \ CONCAT2E(rfbInitTrueColourSingleTable,OUT) #define rfbInitTrueColourRGBTablesOUT CONCAT2E(rfbInitTrueColourRGBTables,OUT) #define rfbInitOneRGBTableOUT CONCAT2E(rfbInitOneRGBTable,OUT) static void rfbInitOneRGBTableOUT (OUT_T *table, int inMax, int outMax, int outShift, int swap); /* * rfbInitTrueColourSingleTable sets up a single lookup table for truecolour * translation. */ static void rfbInitTrueColourSingleTableOUT (char **table, rfbPixelFormat *in, rfbPixelFormat *out) { int i; int inRed, inGreen, inBlue, outRed, outGreen, outBlue; OUT_T *t; int nEntries = 1 << in->bitsPerPixel; if (*table) free(*table); *table = (char *)xalloc(nEntries * sizeof(OUT_T)); t = (OUT_T *)*table; for (i = 0; i < nEntries; i++) { inRed = (i >> in->redShift) & in->redMax; inGreen = (i >> in->greenShift) & in->greenMax; inBlue = (i >> in->blueShift) & in->blueMax; outRed = (inRed * out->redMax + in->redMax / 2) / in->redMax; outGreen = (inGreen * out->greenMax + in->greenMax / 2) / in->greenMax; outBlue = (inBlue * out->blueMax + in->blueMax / 2) / in->blueMax; t[i] = ((outRed << out->redShift) | (outGreen << out->greenShift) | (outBlue << out->blueShift)); #if (OUT != 8) if (out->bigEndian != in->bigEndian) { t[i] = SwapOUT(t[i]); } #endif } } /* * rfbInitTrueColourRGBTables sets up three separate lookup tables for the * red, green and blue values. */ static void rfbInitTrueColourRGBTablesOUT (char **table, rfbPixelFormat *in, rfbPixelFormat *out) { OUT_T *redTable; OUT_T *greenTable; OUT_T *blueTable; if (*table) free(*table); *table = (char *)xalloc((in->redMax + in->greenMax + in->blueMax + 3) * sizeof(OUT_T)); redTable = (OUT_T *)*table; greenTable = redTable + in->redMax + 1; blueTable = greenTable + in->greenMax + 1; rfbInitOneRGBTableOUT (redTable, in->redMax, out->redMax, out->redShift, (out->bigEndian != in->bigEndian)); rfbInitOneRGBTableOUT (greenTable, in->greenMax, out->greenMax, out->greenShift, (out->bigEndian != in->bigEndian)); rfbInitOneRGBTableOUT (blueTable, in->blueMax, out->blueMax, out->blueShift, (out->bigEndian != in->bigEndian)); } static void rfbInitOneRGBTableOUT (OUT_T *table, int inMax, int outMax, int outShift, int swap) { int i; int nEntries = inMax + 1; for (i = 0; i < nEntries; i++) { table[i] = ((i * outMax + inMax / 2) / inMax) << outShift; #if (OUT != 8) if (swap) { table[i] = SwapOUT(table[i]); } #endif } } #undef OUT_T #undef SwapOUT #undef rfbInitTrueColourSingleTableOUT #undef rfbInitTrueColourRGBTablesOUT #undef rfbInitOneRGBTableOUT ================================================ FILE: OSXvnc-server/tabletranstemplate.c ================================================ /* * tabletranstemplate.c - template for translation using lookup tables. * * This file shouldn't be compiled. It is included multiple times by * translate.c, each time with different definitions of the macros IN and OUT. * * For each pair of values IN and OUT, this file defines two functions for * translating a given rectangle of pixel data. One uses a single lookup * table, and the other uses three separate lookup tables for the red, green * and blue values. * * I know this code isn't nice to read because of all the macros, but * efficiency is important here. */ /* * OSXvnc Copyright (C) 2001 Dan McGuirk . * Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge. * All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #if !defined(IN) || !defined(OUT) #error "This file shouldn't be compiled." #error "It is included as part of translate.c" #endif #define IN_T CONCAT2E(CARD,IN) #define OUT_T CONCAT2E(CARD,OUT) #define rfbTranslateWithSingleTableINtoOUT \ CONCAT4E(rfbTranslateWithSingleTable,IN,to,OUT) #define rfbTranslateWithRGBTablesINtoOUT \ CONCAT4E(rfbTranslateWithRGBTables,IN,to,OUT) /* * rfbTranslateWithSingleTableINtoOUT translates a rectangle of pixel data * using a single lookup table. */ static void rfbTranslateWithSingleTableINtoOUT (char *table, rfbPixelFormat *in, rfbPixelFormat *out, char *iptr, char *optr, int bytesBetweenInputLines, int width, int height) { IN_T *ip = (IN_T *)iptr; OUT_T *op = (OUT_T *)optr; int ipextra = bytesBetweenInputLines / sizeof(IN_T) - width; OUT_T *opLineEnd; OUT_T *t = (OUT_T *)table; while (height > 0) { opLineEnd = op + width; while (op < opLineEnd) { *(op++) = t[*(ip++)]; } ip += ipextra; height--; } } /* * rfbTranslateWithRGBTablesINtoOUT translates a rectangle of pixel data * using three separate lookup tables for the red, green and blue values. */ static void rfbTranslateWithRGBTablesINtoOUT (char *table, rfbPixelFormat *in, rfbPixelFormat *out, char *iptr, char *optr, int bytesBetweenInputLines, int width, int height) { IN_T *ip = (IN_T *)iptr; OUT_T *op = (OUT_T *)optr; int ipextra = bytesBetweenInputLines / sizeof(IN_T) - width; OUT_T *opLineEnd; OUT_T *redTable = (OUT_T *)table; OUT_T *greenTable = redTable + in->redMax + 1; OUT_T *blueTable = greenTable + in->greenMax + 1; while (height > 0) { opLineEnd = op + width; while (op < opLineEnd) { *(op++) = (redTable[(*ip >> in->redShift) & in->redMax] | greenTable[(*ip >> in->greenShift) & in->greenMax] | blueTable[(*ip >> in->blueShift) & in->blueMax]); ip++; } ip += ipextra; height--; } } #undef IN_T #undef OUT_T #undef rfbTranslateWithSingleTableINtoOUT #undef rfbTranslateWithRGBTablesINtoOUT ================================================ FILE: OSXvnc-server/tight.c ================================================ /* * tight.c * * Routines to implement Tight Encoding */ /* * Copyright (C) 2000, 2001 Const Kaplinsky. All Rights Reserved. * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include #include #include "rfb.h" #include "tight.h" /* Note: The following constant should not be changed. */ #define TIGHT_MIN_TO_COMPRESS 12 /* The parameters below may be adjusted. */ #define MIN_SPLIT_RECT_SIZE 4096 #define MIN_SOLID_SUBRECT_SIZE 2048 #define MAX_SPLIT_TILE_SIZE 16 /* May be set to TRUE with "-lazytight" Xvnc option. */ Bool rfbTightDisableGradient = FALSE; /* Compression level stuff. The following array contains various encoder parameters for each of 10 compression levels (0..9). Last three parameters correspond to JPEG quality levels (0..9). */ typedef struct TIGHT_CONF_s { int maxRectSize, maxRectWidth; int monoMinRectSize, gradientMinRectSize; int idxZlibLevel, monoZlibLevel, rawZlibLevel, gradientZlibLevel; int gradientThreshold, gradientThreshold24; int idxMaxColorsDivisor; int jpegQuality, jpegThreshold, jpegThreshold24; } TIGHT_CONF; static TIGHT_CONF tightConf[10] = { { 512, 32, 6, 65536, 0, 0, 0, 0, 0, 0, 4, 20, 10000, 23000 }, { 2048, 128, 6, 65536, 1, 1, 1, 0, 0, 0, 8, 30, 8000, 18000 }, { 6144, 256, 8, 65536, 3, 3, 2, 0, 0, 0, 24, 40, 6500, 15000 }, { 10240, 1024, 12, 65536, 5, 5, 3, 0, 0, 0, 32, 50, 5000, 12000 }, { 16384, 2048, 12, 65536, 6, 6, 4, 0, 0, 0, 32, 55, 4000, 10000 }, { 32768, 2048, 12, 4096, 7, 7, 5, 4, 150, 380, 32, 60, 3000, 8000 }, { 65536, 2048, 16, 4096, 7, 7, 6, 4, 170, 420, 48, 65, 2000, 5000 }, { 65536, 2048, 16, 4096, 8, 8, 7, 5, 180, 450, 64, 70, 1000, 2500 }, { 65536, 2048, 32, 8192, 9, 9, 8, 6, 190, 475, 64, 75, 500, 1200 }, { 65536, 2048, 32, 8192, 9, 9, 9, 6, 200, 500, 96, 80, 200, 500 } }; /* Prototypes for static functions. */ static void FindBestSolidArea (rfbClientPtr cl, int x, int y, int w, int h, CARD32 colorValue, int *w_ptr, int *h_ptr); static void ExtendSolidArea (rfbClientPtr cl, int x, int y, int w, int h, CARD32 colorValue, int *x_ptr, int *y_ptr, int *w_ptr, int *h_ptr); static Bool CheckSolidTile (rfbClientPtr cl, int x, int y, int w, int h, CARD32 *colorPtr, Bool needSameColor); static Bool CheckSolidTile8 (rfbClientPtr cl, int x, int y, int w, int h, CARD32 *colorPtr, Bool needSameColor); static Bool CheckSolidTile16 (rfbClientPtr cl, int x, int y, int w, int h, CARD32 *colorPtr, Bool needSameColor); static Bool CheckSolidTile32 (rfbClientPtr cl, int x, int y, int w, int h, CARD32 *colorPtr, Bool needSameColor); static Bool SendRectSimple (rfbClientPtr cl, int x, int y, int w, int h); static Bool SendSubrect (rfbClientPtr cl, int x, int y, int w, int h); static Bool SendTightHeader (rfbClientPtr cl, int x, int y, int w, int h); static Bool SendSolidRect (rfbClientPtr cl); static Bool SendMonoRect (rfbClientPtr cl, int w, int h); static Bool SendIndexedRect (rfbClientPtr cl, int w, int h); static Bool SendFullColorRect (rfbClientPtr cl, int w, int h); static Bool SendGradientRect (rfbClientPtr cl, int w, int h); static Bool CompressData(rfbClientPtr cl, int streamId, int dataLen, int zlibLevel, int zlibStrategy); static Bool SendCompressedData(rfbClientPtr cl, int compressedLen); static void FillPalette8(rfbClientPtr cl, int count); static void FillPalette16(rfbClientPtr cl, int count); static void FillPalette32(rfbClientPtr cl, int count); static void PaletteReset(rfbClientPtr cl); static int PaletteInsert(rfbClientPtr cl, CARD32 rgb, int numPixels, int bpp); static void Pack24(char *buf, rfbPixelFormat *fmt, int count); static void EncodeIndexedRect16(rfbClientPtr cl, CARD8 *buf, int count); static void EncodeIndexedRect32(rfbClientPtr cl, CARD8 *buf, int count); static void EncodeMonoRect8(rfbClientPtr cl, CARD8 *buf, int w, int h); static void EncodeMonoRect16(rfbClientPtr cl, CARD8 *buf, int w, int h); static void EncodeMonoRect32(rfbClientPtr cl, CARD8 *buf, int w, int h); static void FilterGradient24(rfbClientPtr cl, char *buf, rfbPixelFormat *fmt, int w, int h); static void FilterGradient16(rfbClientPtr cl, CARD16 *buf, rfbPixelFormat *fmt, int w, int h); static void FilterGradient32(rfbClientPtr cl, CARD32 *buf, rfbPixelFormat *fmt, int w, int h); static int DetectSmoothImage(rfbClientPtr cl, rfbPixelFormat *fmt, int w, int h); static unsigned long DetectSmoothImage24(rfbClientPtr cl, rfbPixelFormat *fmt, int w, int h); static unsigned long DetectSmoothImage16(rfbClientPtr cl, rfbPixelFormat *fmt, int w, int h); static unsigned long DetectSmoothImage32(rfbClientPtr cl, rfbPixelFormat *fmt, int w, int h); static Bool SendJpegRect(rfbClientPtr cl, int x, int y, int w, int h, int quality); static void PrepareRowForJpeg(rfbClientPtr cl, CARD8 *dst, int x, int y, int count); static void PrepareRowForJpeg16(rfbClientPtr cl, CARD8 *dst, int x, int y, int count); static void PrepareRowForJpeg24(rfbClientPtr cl, CARD8 *dst, int x, int y, int count); static void PrepareRowForJpeg32(rfbClientPtr cl, CARD8 *dst, int x, int y, int count); static void JpegInitDestination(j_compress_ptr cinfo); static boolean JpegEmptyOutputBuffer(j_compress_ptr cinfo); static void JpegTermDestination(j_compress_ptr cinfo); static void JpegSetDstManager(rfbClientPtr cl, j_compress_ptr cinfo); // These defines will "hopefully" allow us to keep the rest of the code looking roughly the same // but call them with the client record pointer, instead of without it #define FillPalette8(x) FillPalette8(cl, x) #define FillPalette16(x) FillPalette16(cl, x) #define FillPalette32(x) FillPalette32(cl, x) #define PaletteReset() PaletteReset(cl) #define PaletteInsert(x, y, z) PaletteInsert(cl, x, y, z) #define EncodeIndexedRect16(x, y) EncodeIndexedRect16(cl, x, y) #define EncodeIndexedRect32(x, y) EncodeIndexedRect32(cl, x, y) #define EncodeMonoRect8(x, y, z) EncodeMonoRect8(cl, x, y, z) #define EncodeMonoRect16(x, y, z) EncodeMonoRect16(cl, x, y, z) #define EncodeMonoRect32(x, y, z) EncodeMonoRect32(cl, x, y, z) #define FilterGradient24(w, x, y, z) FilterGradient24(cl, w, x, y, z) #define FilterGradient16(w, x, y, z) FilterGradient16(cl, w, x, y, z) #define FilterGradient32(w, x, y, z) FilterGradient32(cl, w, x, y, z) #define DetectSmoothImage(x, y, z) DetectSmoothImage(cl, x, y, z) #define DetectSmoothImage24(x, y, z) DetectSmoothImage24(cl, x, y, z) #define DetectSmoothImage16(x, y, z) DetectSmoothImage16(cl, x, y, z) #define DetectSmoothImage32(x, y, z) DetectSmoothImage32(cl, x, y, z) #define JpegSetDstManager(x) JpegSetDstManager(cl, x) #define palette cl->palette /* * Tight encoding implementation. */ int rfbNumCodedRectsTight(rfbClientPtr cl, int x, int y, int w, int h) { int maxRectSize, maxRectWidth; int subrectMaxWidth, subrectMaxHeight; /* No matter how many rectangles we will send if LastRect markers are used to terminate rectangle stream. */ if (cl->enableLastRectEncoding && w * h >= MIN_SPLIT_RECT_SIZE) return 0; maxRectSize = tightConf[cl->tightCompressLevel].maxRectSize; maxRectWidth = tightConf[cl->tightCompressLevel].maxRectWidth; if (w > maxRectWidth || w * h > maxRectSize) { subrectMaxWidth = (w > maxRectWidth) ? maxRectWidth : w; subrectMaxHeight = maxRectSize / subrectMaxWidth; return (((w - 1) / maxRectWidth + 1) * ((h - 1) / subrectMaxHeight + 1)); } else { return 1; } } Bool rfbSendRectEncodingTight(rfbClientPtr cl, int x, int y, int w, int h) { int nMaxRows; CARD32 colorValue; int dx, dy, dw, dh; int x_best, y_best, w_best, h_best; char *fbptr; compressLevel = cl->tightCompressLevel; qualityLevel = cl->tightQualityLevel; if ( cl->format.depth == 24 && cl->format.redMax == 0xFF && cl->format.greenMax == 0xFF && cl->format.blueMax == 0xFF ) { usePixelFormat24 = TRUE; } else { usePixelFormat24 = FALSE; } if (!cl->enableLastRectEncoding || w * h < MIN_SPLIT_RECT_SIZE) return SendRectSimple(cl, x, y, w, h); /* Make sure we can write at least one pixel into tightBeforeBuf. */ if (tightBeforeBufSize < 4) { tightBeforeBufSize = 4; if (tightBeforeBuf == NULL) tightBeforeBuf = (char *)xalloc(tightBeforeBufSize); else tightBeforeBuf = (char *)xrealloc(tightBeforeBuf, tightBeforeBufSize); } /* Calculate maximum number of rows in one non-solid rectangle. */ { int maxRectSize, maxRectWidth, nMaxWidth; maxRectSize = tightConf[compressLevel].maxRectSize; maxRectWidth = tightConf[compressLevel].maxRectWidth; nMaxWidth = (w > maxRectWidth) ? maxRectWidth : w; nMaxRows = maxRectSize / nMaxWidth; } /* Try to find large solid-color areas and send them separately. */ for (dy = y; dy < y + h; dy += MAX_SPLIT_TILE_SIZE) { /* If a rectangle becomes too large, send its upper part now. */ if (dy - y >= nMaxRows) { if (!SendRectSimple(cl, x, y, w, nMaxRows)) return 0; y += nMaxRows; h -= nMaxRows; } dh = (dy + MAX_SPLIT_TILE_SIZE <= y + h) ? MAX_SPLIT_TILE_SIZE : (y + h - dy); for (dx = x; dx < x + w; dx += MAX_SPLIT_TILE_SIZE) { dw = (dx + MAX_SPLIT_TILE_SIZE <= x + w) ? MAX_SPLIT_TILE_SIZE : (x + w - dx); if (CheckSolidTile(cl, dx, dy, dw, dh, &colorValue, FALSE)) { /* Get dimensions of solid-color area. */ FindBestSolidArea(cl, dx, dy, w - (dx - x), h - (dy - y), colorValue, &w_best, &h_best); /* Make sure a solid rectangle is large enough (or the whole rectangle is of the same color). */ if ( w_best * h_best != w * h && w_best * h_best < MIN_SOLID_SUBRECT_SIZE ) continue; /* Try to extend solid rectangle to maximum size. */ x_best = dx; y_best = dy; ExtendSolidArea(cl, x, y, w, h, colorValue, &x_best, &y_best, &w_best, &h_best); /* Send rectangles at top and left to solid-color area. */ if ( y_best != y && !SendRectSimple(cl, x, y, w, y_best-y) ) return FALSE; if ( x_best != x && !rfbSendRectEncodingTight(cl, x, y_best, x_best-x, h_best) ) return FALSE; /* Send solid-color rectangle. */ if (!SendTightHeader(cl, x_best, y_best, w_best, h_best)) return FALSE; fbptr = (cl->scalingFrameBuffer + (cl->scalingPaddedWidthInBytes * y_best) + (x_best * (rfbScreen.bitsPerPixel / 8))); (*cl->translateFn)(cl->translateLookupTable, &rfbServerFormat, &cl->format, fbptr, tightBeforeBuf, cl->scalingPaddedWidthInBytes, 1, 1); if (!SendSolidRect(cl)) return FALSE; /* Send remaining rectangles (at right and bottom). */ if ( x_best + w_best != x + w && !rfbSendRectEncodingTight(cl, x_best+w_best, y_best, w-(x_best-x)-w_best, h_best) ) return FALSE; if ( y_best + h_best != y + h && !rfbSendRectEncodingTight(cl, x, y_best+h_best, w, h-(y_best-y)-h_best) ) return FALSE; /* Return after all recursive calls are done. */ return TRUE; } } } /* No suitable solid-color rectangles found. */ return SendRectSimple(cl, x, y, w, h); } static void FindBestSolidArea(rfbClientPtr cl, int x, int y, int w, int h, CARD32 colorValue, int *w_ptr, int *h_ptr) { int dx, dy, dw, dh; int w_prev; int w_best = 0, h_best = 0; w_prev = w; for (dy = y; dy < y + h; dy += MAX_SPLIT_TILE_SIZE) { dh = (dy + MAX_SPLIT_TILE_SIZE <= y + h) ? MAX_SPLIT_TILE_SIZE : (y + h - dy); dw = (w_prev > MAX_SPLIT_TILE_SIZE) ? MAX_SPLIT_TILE_SIZE : w_prev; if (!CheckSolidTile(cl, x, dy, dw, dh, &colorValue, TRUE)) break; for (dx = x + dw; dx < x + w_prev;) { dw = (dx + MAX_SPLIT_TILE_SIZE <= x + w_prev) ? MAX_SPLIT_TILE_SIZE : (x + w_prev - dx); if (!CheckSolidTile(cl, dx, dy, dw, dh, &colorValue, TRUE)) break; dx += dw; } w_prev = dx - x; if (w_prev * (dy + dh - y) > w_best * h_best) { w_best = w_prev; h_best = dy + dh - y; } } *w_ptr = w_best; *h_ptr = h_best; } static void ExtendSolidArea(rfbClientPtr cl, int x, int y, int w, int h, CARD32 colorValue, int *x_ptr, int *y_ptr, int *w_ptr, int *h_ptr) { int cx, cy; /* Try to extend the area upwards. */ for ( cy = *y_ptr - 1; cy >= y && CheckSolidTile(cl, *x_ptr, cy, *w_ptr, 1, &colorValue, TRUE); cy-- ); *h_ptr += *y_ptr - (cy + 1); *y_ptr = cy + 1; /* ... downwards. */ for ( cy = *y_ptr + *h_ptr; cy < y + h && CheckSolidTile(cl, *x_ptr, cy, *w_ptr, 1, &colorValue, TRUE); cy++ ); *h_ptr += cy - (*y_ptr + *h_ptr); /* ... to the left. */ for ( cx = *x_ptr - 1; cx >= x && CheckSolidTile(cl, cx, *y_ptr, 1, *h_ptr, &colorValue, TRUE); cx-- ); *w_ptr += *x_ptr - (cx + 1); *x_ptr = cx + 1; /* ... to the right. */ for ( cx = *x_ptr + *w_ptr; cx < x + w && CheckSolidTile(cl, cx, *y_ptr, 1, *h_ptr, &colorValue, TRUE); cx++ ); *w_ptr += cx - (*x_ptr + *w_ptr); } static Bool CheckSolidTile(rfbClientPtr cl, int x, int y, int w, int h, CARD32 *colorPtr, Bool needSameColor) { switch(rfbServerFormat.bitsPerPixel) { case 32: return CheckSolidTile32(cl, x, y, w, h, colorPtr, needSameColor); case 16: return CheckSolidTile16(cl, x, y, w, h, colorPtr, needSameColor); default: return CheckSolidTile8(cl, x, y, w, h, colorPtr, needSameColor); } } #define DEFINE_CHECK_SOLID_FUNCTION(bpp) \ \ static Bool \ CheckSolidTile##bpp(rfbClientPtr cl, int x, int y, int w, int h, CARD32 *colorPtr, Bool needSameColor) \ { \ CARD##bpp *fbptr; \ CARD##bpp colorValue; \ int dx, dy; \ \ fbptr = (CARD##bpp *) \ &cl->scalingFrameBuffer[y * cl->scalingPaddedWidthInBytes + x * (bpp/8)]; \ \ colorValue = *fbptr; \ if (needSameColor && (CARD32)colorValue != *colorPtr) \ return FALSE; \ \ for (dy = 0; dy < h; dy++) { \ for (dx = 0; dx < w; dx++) { \ if (colorValue != fbptr[dx]) \ return FALSE; \ } \ fbptr = (CARD##bpp *)((CARD8 *)fbptr + cl->scalingPaddedWidthInBytes); \ } \ \ *colorPtr = (CARD32)colorValue; \ return TRUE; \ } DEFINE_CHECK_SOLID_FUNCTION(8) DEFINE_CHECK_SOLID_FUNCTION(16) DEFINE_CHECK_SOLID_FUNCTION(32) static Bool SendRectSimple(rfbClientPtr cl, int x, int y, int w, int h) { int maxBeforeSize, maxAfterSize; int maxRectSize, maxRectWidth; int subrectMaxWidth, subrectMaxHeight; int dx, dy; int rw, rh; maxRectSize = tightConf[compressLevel].maxRectSize; maxRectWidth = tightConf[compressLevel].maxRectWidth; maxBeforeSize = maxRectSize * (cl->format.bitsPerPixel / 8); maxAfterSize = maxBeforeSize + (maxBeforeSize + 99) / 100 + 12; if (tightBeforeBufSize < maxBeforeSize) { tightBeforeBufSize = maxBeforeSize; if (tightBeforeBuf == NULL) tightBeforeBuf = (char *)xalloc(tightBeforeBufSize); else tightBeforeBuf = (char *)xrealloc(tightBeforeBuf, tightBeforeBufSize); } if (tightAfterBufSize < maxAfterSize) { tightAfterBufSize = maxAfterSize; if (tightAfterBuf == NULL) tightAfterBuf = (char *)xalloc(tightAfterBufSize); else tightAfterBuf = (char *)xrealloc(tightAfterBuf, tightAfterBufSize); } if (w > maxRectWidth || w * h > maxRectSize) { subrectMaxWidth = (w > maxRectWidth) ? maxRectWidth : w; subrectMaxHeight = maxRectSize / subrectMaxWidth; for (dy = 0; dy < h; dy += subrectMaxHeight) { for (dx = 0; dx < w; dx += maxRectWidth) { rw = (dx + maxRectWidth < w) ? maxRectWidth : w - dx; rh = (dy + subrectMaxHeight < h) ? subrectMaxHeight : h - dy; if (!SendSubrect(cl, x+dx, y+dy, rw, rh)) return FALSE; } } } else { if (!SendSubrect(cl, x, y, w, h)) return FALSE; } return TRUE; } static Bool SendSubrect(rfbClientPtr cl, int x, int y, int w, int h) { char *fbptr; Bool success = FALSE; /* Send pending data if there is more than 128 bytes. */ if (cl->ublen > 128) { if (!rfbSendUpdateBuf(cl)) return FALSE; } if (!SendTightHeader(cl, x, y, w, h)) return FALSE; fbptr = (cl->scalingFrameBuffer + (cl->scalingPaddedWidthInBytes * y) + (x * (rfbScreen.bitsPerPixel / 8))); (*cl->translateFn)(cl->translateLookupTable, &rfbServerFormat, &cl->format, fbptr, tightBeforeBuf, cl->scalingPaddedWidthInBytes, w, h); paletteMaxColors = w * h / tightConf[compressLevel].idxMaxColorsDivisor; if ( paletteMaxColors < 2 && w * h >= tightConf[compressLevel].monoMinRectSize ) { paletteMaxColors = 2; } switch (cl->format.bitsPerPixel) { case 8: FillPalette8(w * h); break; case 16: FillPalette16(w * h); break; default: FillPalette32(w * h); } switch (paletteNumColors) { case 0: /* Truecolor image */ if (DetectSmoothImage(&cl->format, w, h)) { if (qualityLevel != -1) { success = SendJpegRect(cl, x, y, w, h, tightConf[qualityLevel].jpegQuality); } else { success = SendGradientRect(cl, w, h); } } else { success = SendFullColorRect(cl, w, h); } break; case 1: /* Solid rectangle */ success = SendSolidRect(cl); break; case 2: /* Two-color rectangle */ success = SendMonoRect(cl, w, h); break; default: /* Up to 256 different colors */ if ( paletteNumColors > 96 && qualityLevel != -1 && qualityLevel <= 3 && DetectSmoothImage(&cl->format, w, h) ) { success = SendJpegRect(cl, x, y, w, h, tightConf[qualityLevel].jpegQuality); } else { success = SendIndexedRect(cl, w, h); } } return success; } static Bool SendTightHeader(rfbClientPtr cl, int x, int y, int w, int h) { rfbFramebufferUpdateRectHeader rect; if (cl->ublen + sz_rfbFramebufferUpdateRectHeader > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } rect.r.x = Swap16IfLE(x); rect.r.y = Swap16IfLE(y); rect.r.w = Swap16IfLE(w); rect.r.h = Swap16IfLE(h); rect.encoding = Swap32IfLE(rfbEncodingTight); memcpy(&cl->updateBuf[cl->ublen], &rect, sz_rfbFramebufferUpdateRectHeader); cl->ublen += sz_rfbFramebufferUpdateRectHeader; cl->rfbRectanglesSent[rfbEncodingTight]++; cl->rfbBytesSent[rfbEncodingTight] += sz_rfbFramebufferUpdateRectHeader; return TRUE; } /* * Subencoding implementations. */ static Bool SendSolidRect(rfbClientPtr cl) { int len; if (usePixelFormat24) { Pack24(tightBeforeBuf, &cl->format, 1); len = 3; } else len = cl->format.bitsPerPixel / 8; if (cl->ublen + 1 + len > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } cl->updateBuf[cl->ublen++] = (char)(rfbTightFill << 4); memcpy (&cl->updateBuf[cl->ublen], tightBeforeBuf, len); cl->ublen += len; cl->rfbBytesSent[rfbEncodingTight] += len + 1; return TRUE; } static Bool SendMonoRect(rfbClientPtr cl, int w, int h) { int streamId = 1; int paletteLen, dataLen; if ( (cl->ublen + TIGHT_MIN_TO_COMPRESS + 6 + 2 * cl->format.bitsPerPixel / 8) > UPDATE_BUF_SIZE ) { if (!rfbSendUpdateBuf(cl)) return FALSE; } /* Prepare tight encoding header. */ dataLen = (w + 7) / 8; dataLen *= h; cl->updateBuf[cl->ublen++] = (streamId | rfbTightExplicitFilter) << 4; cl->updateBuf[cl->ublen++] = rfbTightFilterPalette; cl->updateBuf[cl->ublen++] = 1; /* Prepare palette, convert image. */ switch (cl->format.bitsPerPixel) { case 32: EncodeMonoRect32((CARD8 *)tightBeforeBuf, w, h); ((CARD32 *)tightAfterBuf)[0] = monoBackground; ((CARD32 *)tightAfterBuf)[1] = monoForeground; if (usePixelFormat24) { Pack24(tightAfterBuf, &cl->format, 2); paletteLen = 6; } else paletteLen = 8; memcpy(&cl->updateBuf[cl->ublen], tightAfterBuf, paletteLen); cl->ublen += paletteLen; cl->rfbBytesSent[rfbEncodingTight] += 3 + paletteLen; break; case 16: EncodeMonoRect16((CARD8 *)tightBeforeBuf, w, h); ((CARD16 *)tightAfterBuf)[0] = (CARD16)monoBackground; ((CARD16 *)tightAfterBuf)[1] = (CARD16)monoForeground; memcpy(&cl->updateBuf[cl->ublen], tightAfterBuf, 4); cl->ublen += 4; cl->rfbBytesSent[rfbEncodingTight] += 7; break; default: EncodeMonoRect8((CARD8 *)tightBeforeBuf, w, h); cl->updateBuf[cl->ublen++] = (char)monoBackground; cl->updateBuf[cl->ublen++] = (char)monoForeground; cl->rfbBytesSent[rfbEncodingTight] += 5; } return CompressData(cl, streamId, dataLen, tightConf[compressLevel].monoZlibLevel, Z_DEFAULT_STRATEGY); } static Bool SendIndexedRect(rfbClientPtr cl, int w, int h) { int streamId = 2; int i, entryLen; if ( (cl->ublen + TIGHT_MIN_TO_COMPRESS + 6 + paletteNumColors * cl->format.bitsPerPixel / 8) > UPDATE_BUF_SIZE ) { if (!rfbSendUpdateBuf(cl)) return FALSE; } /* Prepare tight encoding header. */ cl->updateBuf[cl->ublen++] = (streamId | rfbTightExplicitFilter) << 4; cl->updateBuf[cl->ublen++] = rfbTightFilterPalette; cl->updateBuf[cl->ublen++] = (char)(paletteNumColors - 1); /* Prepare palette, convert image. */ switch (cl->format.bitsPerPixel) { case 32: EncodeIndexedRect32((CARD8 *)tightBeforeBuf, w * h); for (i = 0; i < paletteNumColors; i++) { ((CARD32 *)tightAfterBuf)[i] = palette.entry[i].listNode->rgb; } if (usePixelFormat24) { Pack24(tightAfterBuf, &cl->format, paletteNumColors); entryLen = 3; } else entryLen = 4; memcpy(&cl->updateBuf[cl->ublen], tightAfterBuf, paletteNumColors * entryLen); cl->ublen += paletteNumColors * entryLen; cl->rfbBytesSent[rfbEncodingTight] += 3 + paletteNumColors * entryLen; break; case 16: EncodeIndexedRect16((CARD8 *)tightBeforeBuf, w * h); for (i = 0; i < paletteNumColors; i++) { ((CARD16 *)tightAfterBuf)[i] = (CARD16)palette.entry[i].listNode->rgb; } memcpy(&cl->updateBuf[cl->ublen], tightAfterBuf, paletteNumColors * 2); cl->ublen += paletteNumColors * 2; cl->rfbBytesSent[rfbEncodingTight] += 3 + paletteNumColors * 2; break; default: return FALSE; /* Should never happen. */ } return CompressData(cl, streamId, w * h, tightConf[compressLevel].idxZlibLevel, Z_DEFAULT_STRATEGY); } static Bool SendFullColorRect(rfbClientPtr cl, int w, int h) { int streamId = 0; int len; if (cl->ublen + TIGHT_MIN_TO_COMPRESS + 1 > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } cl->updateBuf[cl->ublen++] = 0x00; /* stream id = 0, no flushing, no filter */ cl->rfbBytesSent[rfbEncodingTight]++; if (usePixelFormat24) { Pack24(tightBeforeBuf, &cl->format, w * h); len = 3; } else len = cl->format.bitsPerPixel / 8; return CompressData(cl, streamId, w * h * len, tightConf[compressLevel].rawZlibLevel, Z_DEFAULT_STRATEGY); } static Bool SendGradientRect(rfbClientPtr cl, int w, int h) { int streamId = 3; int len; if (cl->format.bitsPerPixel == 8) return SendFullColorRect(cl, w, h); if (cl->ublen + TIGHT_MIN_TO_COMPRESS + 2 > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } if (prevRowBuf == NULL) prevRowBuf = (int *)xalloc(2048 * 3 * sizeof(int)); cl->updateBuf[cl->ublen++] = (streamId | rfbTightExplicitFilter) << 4; cl->updateBuf[cl->ublen++] = rfbTightFilterGradient; cl->rfbBytesSent[rfbEncodingTight] += 2; if (usePixelFormat24) { FilterGradient24(tightBeforeBuf, &cl->format, w, h); len = 3; } else if (cl->format.bitsPerPixel == 32) { FilterGradient32((CARD32 *)tightBeforeBuf, &cl->format, w, h); len = 4; } else { FilterGradient16((CARD16 *)tightBeforeBuf, &cl->format, w, h); len = 2; } return CompressData(cl, streamId, w * h * len, tightConf[compressLevel].gradientZlibLevel, Z_FILTERED); } static Bool CompressData(rfbClientPtr cl, int streamId, int dataLen, int zlibLevel, int zlibStrategy) { z_streamp pz; int err; if (dataLen < TIGHT_MIN_TO_COMPRESS) { memcpy(&cl->updateBuf[cl->ublen], tightBeforeBuf, dataLen); cl->ublen += dataLen; cl->rfbBytesSent[rfbEncodingTight] += dataLen; return TRUE; } pz = &cl->zsStruct[streamId]; /* Initialize compression stream if needed. */ if (!cl->zsActive[streamId]) { pz->zalloc = Z_NULL; pz->zfree = Z_NULL; pz->opaque = Z_NULL; err = deflateInit2 (pz, zlibLevel, Z_DEFLATED, MAX_WBITS, MAX_MEM_LEVEL, zlibStrategy); if (err != Z_OK) return FALSE; cl->zsActive[streamId] = TRUE; cl->zsLevel[streamId] = zlibLevel; } /* Prepare buffer pointers. */ pz->next_in = (Bytef *)tightBeforeBuf; pz->avail_in = dataLen; pz->next_out = (Bytef *)tightAfterBuf; pz->avail_out = tightAfterBufSize; /* Change compression parameters if needed. */ if (zlibLevel != cl->zsLevel[streamId]) { if (deflateParams (pz, zlibLevel, zlibStrategy) != Z_OK) { return FALSE; } cl->zsLevel[streamId] = zlibLevel; } /* Actual compression. */ if ( deflate (pz, Z_SYNC_FLUSH) != Z_OK || pz->avail_in != 0 || pz->avail_out == 0 ) { return FALSE; } return SendCompressedData(cl, tightAfterBufSize - pz->avail_out); } static Bool SendCompressedData(rfbClientPtr cl, int compressedLen) { int i, portionLen; cl->updateBuf[cl->ublen++] = compressedLen & 0x7F; cl->rfbBytesSent[rfbEncodingTight]++; if (compressedLen > 0x7F) { cl->updateBuf[cl->ublen-1] |= 0x80; cl->updateBuf[cl->ublen++] = compressedLen >> 7 & 0x7F; cl->rfbBytesSent[rfbEncodingTight]++; if (compressedLen > 0x3FFF) { cl->updateBuf[cl->ublen-1] |= 0x80; cl->updateBuf[cl->ublen++] = compressedLen >> 14 & 0xFF; cl->rfbBytesSent[rfbEncodingTight]++; } } portionLen = UPDATE_BUF_SIZE; for (i = 0; i < compressedLen; i += portionLen) { if (i + portionLen > compressedLen) { portionLen = compressedLen - i; } if (cl->ublen + portionLen > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } memcpy(&cl->updateBuf[cl->ublen], &tightAfterBuf[i], portionLen); cl->ublen += portionLen; } cl->rfbBytesSent[rfbEncodingTight] += compressedLen; return TRUE; } /* * Code to determine how many different colors used in rectangle. */ #undef FillPalette8 static void FillPalette8(rfbClientPtr cl, int count) { CARD8 *data = (CARD8 *)tightBeforeBuf; CARD8 c0, c1; int i, n0, n1; paletteNumColors = 0; c0 = data[0]; for (i = 1; i < count && data[i] == c0; i++); if (i == count) { paletteNumColors = 1; return; /* Solid rectangle */ } if (paletteMaxColors < 2) return; n0 = i; c1 = data[i]; n1 = 0; for (i++; i < count; i++) { if (data[i] == c0) { n0++; } else if (data[i] == c1) { n1++; } else break; } if (i == count) { if (n0 > n1) { monoBackground = (CARD32)c0; monoForeground = (CARD32)c1; } else { monoBackground = (CARD32)c1; monoForeground = (CARD32)c0; } paletteNumColors = 2; /* Two colors */ } } #define FillPalette8(x) FillPalette8(cl, x) #undef FillPalette16 #undef FillPalette32 #define DEFINE_FILL_PALETTE_FUNCTION(bpp) \ \ static void \ FillPalette##bpp(rfbClientPtr cl, int count) \ { \ CARD##bpp *data = (CARD##bpp *)tightBeforeBuf; \ CARD##bpp c0, c1, ci = 0; \ int i, n0, n1, ni; \ \ c0 = data[0]; \ for (i = 1; i < count && data[i] == c0; i++); \ if (i >= count) { \ paletteNumColors = 1; /* Solid rectangle */ \ return; \ } \ \ if (paletteMaxColors < 2) { \ paletteNumColors = 0; /* Full-color encoding preferred */ \ return; \ } \ \ n0 = i; \ c1 = data[i]; \ n1 = 0; \ for (i++; i < count; i++) { \ ci = data[i]; \ if (ci == c0) { \ n0++; \ } else if (ci == c1) { \ n1++; \ } else \ break; \ } \ if (i >= count) { \ if (n0 > n1) { \ monoBackground = (CARD32)c0; \ monoForeground = (CARD32)c1; \ } else { \ monoBackground = (CARD32)c1; \ monoForeground = (CARD32)c0; \ } \ paletteNumColors = 2; /* Two colors */ \ return; \ } \ \ PaletteReset(); \ PaletteInsert (c0, (CARD32)n0, bpp); \ PaletteInsert (c1, (CARD32)n1, bpp); \ \ ni = 1; \ for (i++; i < count; i++) { \ if (data[i] == ci) { \ ni++; \ } else { \ if (!PaletteInsert (ci, (CARD32)ni, bpp)) \ return; \ ci = data[i]; \ ni = 1; \ } \ } \ PaletteInsert (ci, (CARD32)ni, bpp); \ } DEFINE_FILL_PALETTE_FUNCTION(16) DEFINE_FILL_PALETTE_FUNCTION(32) #define FillPalette16(x) FillPalette16(cl, x) #define FillPalette32(x) FillPalette32(cl, x) /* * Functions to operate with palette structures. */ #define HASH_FUNC16(rgb) ((int)((((rgb) >> 8) + (rgb)) & 0xFF)) #define HASH_FUNC32(rgb) ((int)((((rgb) >> 16) + ((rgb) >> 8)) & 0xFF)) #undef PaletteReset static void PaletteReset(rfbClientPtr cl) { paletteNumColors = 0; memset(palette.hash, 0, 256 * sizeof(COLOR_LIST *)); } #define PaletteReset() PaletteReset(cl) #undef PaletteInsert static int PaletteInsert(rfbClientPtr cl, CARD32 rgb, int numPixels, int bpp) { COLOR_LIST *pnode; COLOR_LIST *prev_pnode = NULL; int hash_key, idx, new_idx, count; hash_key = (bpp == 16) ? HASH_FUNC16(rgb) : HASH_FUNC32(rgb); pnode = palette.hash[hash_key]; while (pnode != NULL) { if (pnode->rgb == rgb) { /* Such palette entry already exists. */ new_idx = idx = pnode->idx; count = palette.entry[idx].numPixels + numPixels; if (new_idx && palette.entry[new_idx-1].numPixels < count) { do { palette.entry[new_idx] = palette.entry[new_idx-1]; palette.entry[new_idx].listNode->idx = new_idx; new_idx--; } while (new_idx && palette.entry[new_idx-1].numPixels < count); palette.entry[new_idx].listNode = pnode; pnode->idx = new_idx; } palette.entry[new_idx].numPixels = count; return paletteNumColors; } prev_pnode = pnode; pnode = pnode->next; } /* Check if palette is full. */ if (paletteNumColors == 256 || paletteNumColors == paletteMaxColors) { paletteNumColors = 0; return 0; } /* Move palette entries with lesser pixel counts. */ for ( idx = paletteNumColors; idx > 0 && palette.entry[idx-1].numPixels < numPixels; idx-- ) { palette.entry[idx] = palette.entry[idx-1]; palette.entry[idx].listNode->idx = idx; } /* Add new palette entry into the freed slot. */ pnode = &palette.list[paletteNumColors]; if (prev_pnode != NULL) { prev_pnode->next = pnode; } else { palette.hash[hash_key] = pnode; } pnode->next = NULL; pnode->idx = idx; pnode->rgb = rgb; palette.entry[idx].listNode = pnode; palette.entry[idx].numPixels = numPixels; return (++paletteNumColors); } #define PaletteInsert(x, y, z) PaletteInsert(cl, x, y, z) /* * Converting 32-bit color samples into 24-bit colors. * Should be called only when redMax, greenMax and blueMax are 255. * Color components assumed to be byte-aligned. */ static void Pack24(char *buf, rfbPixelFormat *fmt, int count) { CARD32 *buf32; CARD32 pix; int r_shift, g_shift, b_shift; buf32 = (CARD32 *)buf; if (!rfbServerFormat.bigEndian == !fmt->bigEndian) { r_shift = fmt->redShift; g_shift = fmt->greenShift; b_shift = fmt->blueShift; } else { r_shift = 24 - fmt->redShift; g_shift = 24 - fmt->greenShift; b_shift = 24 - fmt->blueShift; } while (count--) { pix = *buf32++; *buf++ = (char)(pix >> r_shift); *buf++ = (char)(pix >> g_shift); *buf++ = (char)(pix >> b_shift); } } /* * Converting truecolor samples into palette indices. */ #undef EncodeIndexedRect16 #undef EncodeIndexedRect32 #define DEFINE_IDX_ENCODE_FUNCTION(bpp) \ \ static void \ EncodeIndexedRect##bpp(rfbClientPtr cl, CARD8 *buf, int count) \ { \ COLOR_LIST *pnode; \ CARD##bpp *src; \ CARD##bpp rgb; \ int rep = 0; \ \ src = (CARD##bpp *) buf; \ \ while (count--) { \ rgb = *src++; \ while (count && *src == rgb) { \ rep++, src++, count--; \ } \ pnode = palette.hash[HASH_FUNC##bpp(rgb)]; \ while (pnode != NULL) { \ if ((CARD##bpp)pnode->rgb == rgb) { \ *buf++ = (CARD8)pnode->idx; \ while (rep) { \ *buf++ = (CARD8)pnode->idx; \ rep--; \ } \ break; \ } \ pnode = pnode->next; \ } \ } \ } DEFINE_IDX_ENCODE_FUNCTION(16) DEFINE_IDX_ENCODE_FUNCTION(32) #define EncodeIndexedRect16(x, y) EncodeIndexedRect16(cl, x, y) #define EncodeIndexedRect32(x, y) EncodeIndexedRect32(cl, x, y) #undef EncodeMonoRect8 #undef EncodeMonoRect16 #undef EncodeMonoRect32 #define DEFINE_MONO_ENCODE_FUNCTION(bpp) \ \ static void \ EncodeMonoRect##bpp(rfbClientPtr cl, CARD8 *buf, int w, int h) \ { \ CARD##bpp *ptr; \ CARD##bpp bg; \ unsigned int value, mask; \ int aligned_width; \ int x, y, bg_bits; \ \ ptr = (CARD##bpp *) buf; \ bg = (CARD##bpp) monoBackground; \ aligned_width = w - w % 8; \ \ for (y = 0; y < h; y++) { \ for (x = 0; x < aligned_width; x += 8) { \ for (bg_bits = 0; bg_bits < 8; bg_bits++) { \ if (*ptr++ != bg) \ break; \ } \ if (bg_bits == 8) { \ *buf++ = 0; \ continue; \ } \ mask = 0x80 >> bg_bits; \ value = mask; \ for (bg_bits++; bg_bits < 8; bg_bits++) { \ mask >>= 1; \ if (*ptr++ != bg) { \ value |= mask; \ } \ } \ *buf++ = (CARD8)value; \ } \ \ mask = 0x80; \ value = 0; \ if (x >= w) \ continue; \ \ for (; x < w; x++) { \ if (*ptr++ != bg) { \ value |= mask; \ } \ mask >>= 1; \ } \ *buf++ = (CARD8)value; \ } \ } DEFINE_MONO_ENCODE_FUNCTION(8) DEFINE_MONO_ENCODE_FUNCTION(16) DEFINE_MONO_ENCODE_FUNCTION(32) #define EncodeMonoRect8(x, y, z) EncodeMonoRect8(cl, x, y, z) #define EncodeMonoRect16(x, y, z) EncodeMonoRect16(cl, x, y, z) #define EncodeMonoRect32(x, y, z) EncodeMonoRect32(cl, x, y, z) /* * ``Gradient'' filter for 24-bit color samples. * Should be called only when redMax, greenMax and blueMax are 255. * Color components assumed to be byte-aligned. */ #undef FilterGradient24 static void FilterGradient24(rfbClientPtr cl, char *buf, rfbPixelFormat *fmt, int w, int h) { CARD32 *buf32; CARD32 pix32; int *prevRowPtr; int shiftBits[3]; int pixHere[3], pixUpper[3], pixLeft[3], pixUpperLeft[3]; int prediction; int x, y, c; buf32 = (CARD32 *)buf; memset (prevRowBuf, 0, w * 3 * sizeof(int)); if (!rfbServerFormat.bigEndian == !fmt->bigEndian) { shiftBits[0] = fmt->redShift; shiftBits[1] = fmt->greenShift; shiftBits[2] = fmt->blueShift; } else { shiftBits[0] = 24 - fmt->redShift; shiftBits[1] = 24 - fmt->greenShift; shiftBits[2] = 24 - fmt->blueShift; } for (y = 0; y < h; y++) { for (c = 0; c < 3; c++) { pixUpper[c] = 0; pixHere[c] = 0; } prevRowPtr = prevRowBuf; for (x = 0; x < w; x++) { pix32 = *buf32++; for (c = 0; c < 3; c++) { pixUpperLeft[c] = pixUpper[c]; pixLeft[c] = pixHere[c]; pixUpper[c] = *prevRowPtr; pixHere[c] = (int)(pix32 >> shiftBits[c] & 0xFF); *prevRowPtr++ = pixHere[c]; prediction = pixLeft[c] + pixUpper[c] - pixUpperLeft[c]; if (prediction < 0) { prediction = 0; } else if (prediction > 0xFF) { prediction = 0xFF; } *buf++ = (char)(pixHere[c] - prediction); } } } } #define FilterGradient24(w, x, y, z) FilterGradient24(cl, w, x, y, z) /* * ``Gradient'' filter for other color depths. */ #undef FilterGradient16 #undef FilterGradient32 #define DEFINE_GRADIENT_FILTER_FUNCTION(bpp) \ \ static void \ FilterGradient##bpp(rfbClientPtr cl, CARD##bpp *buf, rfbPixelFormat *fmt, int w, int h) \ { \ CARD##bpp pix, diff; \ Bool endianMismatch; \ int *prevRowPtr; \ int maxColor[3], shiftBits[3]; \ int pixHere[3], pixUpper[3], pixLeft[3], pixUpperLeft[3]; \ int prediction; \ int x, y, c; \ \ memset (prevRowBuf, 0, w * 3 * sizeof(int)); \ \ endianMismatch = (!rfbServerFormat.bigEndian != !fmt->bigEndian); \ \ maxColor[0] = fmt->redMax; \ maxColor[1] = fmt->greenMax; \ maxColor[2] = fmt->blueMax; \ shiftBits[0] = fmt->redShift; \ shiftBits[1] = fmt->greenShift; \ shiftBits[2] = fmt->blueShift; \ \ for (y = 0; y < h; y++) { \ for (c = 0; c < 3; c++) { \ pixUpper[c] = 0; \ pixHere[c] = 0; \ } \ prevRowPtr = prevRowBuf; \ for (x = 0; x < w; x++) { \ pix = *buf; \ if (endianMismatch) { \ pix = Swap##bpp(pix); \ } \ diff = 0; \ for (c = 0; c < 3; c++) { \ pixUpperLeft[c] = pixUpper[c]; \ pixLeft[c] = pixHere[c]; \ pixUpper[c] = *prevRowPtr; \ pixHere[c] = (int)(pix >> shiftBits[c] & maxColor[c]); \ *prevRowPtr++ = pixHere[c]; \ \ prediction = pixLeft[c] + pixUpper[c] - pixUpperLeft[c]; \ if (prediction < 0) { \ prediction = 0; \ } else if (prediction > maxColor[c]) { \ prediction = maxColor[c]; \ } \ diff |= ((pixHere[c] - prediction) & maxColor[c]) \ << shiftBits[c]; \ } \ if (endianMismatch) { \ diff = Swap##bpp(diff); \ } \ *buf++ = diff; \ } \ } \ } DEFINE_GRADIENT_FILTER_FUNCTION(16) DEFINE_GRADIENT_FILTER_FUNCTION(32) #define FilterGradient16(w, x, y, z) FilterGradient16(cl, w, x, y, z) #define FilterGradient32(w, x, y, z) FilterGradient32(cl, w, x, y, z) /* * Code to guess if given rectangle is suitable for smooth image * compression (by applying "gradient" filter or JPEG coder). */ #define JPEG_MIN_RECT_SIZE 4096 #define DETECT_SUBROW_WIDTH 7 #define DETECT_MIN_WIDTH 8 #define DETECT_MIN_HEIGHT 8 #undef DetectSmoothImage static int DetectSmoothImage (rfbClientPtr cl, rfbPixelFormat *fmt, int w, int h) { unsigned long avgError; if ( rfbServerFormat.bitsPerPixel == 8 || fmt->bitsPerPixel == 8 || w < DETECT_MIN_WIDTH || h < DETECT_MIN_HEIGHT ) { return 0; } if (qualityLevel != -1) { if (w * h < JPEG_MIN_RECT_SIZE) { return 0; } } else { if ( rfbTightDisableGradient || w * h < tightConf[compressLevel].gradientMinRectSize ) { return 0; } } if (fmt->bitsPerPixel == 32) { if (usePixelFormat24) { avgError = DetectSmoothImage24(fmt, w, h); if (qualityLevel != -1) { return (avgError < tightConf[qualityLevel].jpegThreshold24); } return (avgError < tightConf[compressLevel].gradientThreshold24); } else { avgError = DetectSmoothImage32(fmt, w, h); } } else { avgError = DetectSmoothImage16(fmt, w, h); } if (qualityLevel != -1) { return (avgError < tightConf[qualityLevel].jpegThreshold); } return (avgError < tightConf[compressLevel].gradientThreshold); } #define DetectSmoothImage(x, y, z) DetectSmoothImage(cl, x, y, z) #undef DetectSmoothImage24 static unsigned long DetectSmoothImage24 (rfbClientPtr cl, rfbPixelFormat *fmt, int w, int h) { int off; int d, dx, c; int diffStat[256]; int pixelCount = 0; int pix, left[3]; unsigned long avgError; /* If client is big-endian, color samples begin from the second byte (offset 1) of a 32-bit pixel value. */ off = (fmt->bigEndian != 0); memset(diffStat, 0, 256*sizeof(int)); int x = 0; int y = 0; while (y < h && x < w) { for (d = 0; d < h - y && d < w - x - DETECT_SUBROW_WIDTH; d++) { for (c = 0; c < 3; c++) { left[c] = (int)tightBeforeBuf[((y+d)*w+x+d)*4+off+c] & 0xFF; } for (dx = 1; dx <= DETECT_SUBROW_WIDTH; dx++) { for (c = 0; c < 3; c++) { pix = (int)tightBeforeBuf[((y+d)*w+x+d+dx)*4+off+c] & 0xFF; diffStat[abs(pix - left[c])]++; left[c] = pix; } pixelCount++; } } if (w > h) { x += h; y = 0; } else { x = 0; y += w; } } if (pixelCount == 0 || diffStat[0] * 33 / pixelCount >= 95) return 0; avgError = 0; for (c = 1; c < 8; c++) { avgError += (unsigned long)diffStat[c] * (unsigned long)(c * c); if (diffStat[c] == 0 || diffStat[c] > diffStat[c-1] * 2) return 0; } for (; c < 256; c++) { avgError += (unsigned long)diffStat[c] * (unsigned long)(c * c); } avgError /= (pixelCount * 3 - diffStat[0]); return avgError; } #define DetectSmoothImage24(x, y, z) DetectSmoothImage24(cl, x, y, z) #undef DetectSmoothImage16 #undef DetectSmoothImage32 #define DEFINE_DETECT_FUNCTION(bpp) \ \ static unsigned long \ DetectSmoothImage##bpp (rfbClientPtr cl, rfbPixelFormat *fmt, int w, int h) \ { \ Bool endianMismatch; \ CARD##bpp pix; \ int maxColor[3], shiftBits[3]; \ int x, y, d, dx, c; \ int diffStat[256]; \ int pixelCount = 0; \ int sample, sum, left[3]; \ unsigned long avgError; \ \ endianMismatch = (!rfbServerFormat.bigEndian != !fmt->bigEndian); \ \ maxColor[0] = fmt->redMax; \ maxColor[1] = fmt->greenMax; \ maxColor[2] = fmt->blueMax; \ shiftBits[0] = fmt->redShift; \ shiftBits[1] = fmt->greenShift; \ shiftBits[2] = fmt->blueShift; \ \ memset(diffStat, 0, 256*sizeof(int)); \ \ y = 0, x = 0; \ while (y < h && x < w) { \ for (d = 0; d < h - y && d < w - x - DETECT_SUBROW_WIDTH; d++) { \ pix = ((CARD##bpp *)tightBeforeBuf)[(y+d)*w+x+d]; \ if (endianMismatch) { \ pix = Swap##bpp(pix); \ } \ for (c = 0; c < 3; c++) { \ left[c] = (int)(pix >> shiftBits[c] & maxColor[c]); \ } \ for (dx = 1; dx <= DETECT_SUBROW_WIDTH; dx++) { \ pix = ((CARD##bpp *)tightBeforeBuf)[(y+d)*w+x+d+dx]; \ if (endianMismatch) { \ pix = Swap##bpp(pix); \ } \ sum = 0; \ for (c = 0; c < 3; c++) { \ sample = (int)(pix >> shiftBits[c] & maxColor[c]); \ sum += abs(sample - left[c]); \ left[c] = sample; \ } \ if (sum > 255) \ sum = 255; \ diffStat[sum]++; \ pixelCount++; \ } \ } \ if (w > h) { \ x += h; \ y = 0; \ } else { \ x = 0; \ y += w; \ } \ } \ \ if (pixelCount == 0) \ return 0; \ \ if ((diffStat[0] + diffStat[1]) * 100 / pixelCount >= 90) \ return 0; \ \ avgError = 0; \ for (c = 1; c < 8; c++) { \ avgError += (unsigned long)diffStat[c] * (unsigned long)(c * c); \ if (diffStat[c] == 0 || diffStat[c] > diffStat[c-1] * 2) \ return 0; \ } \ for (; c < 256; c++) { \ avgError += (unsigned long)diffStat[c] * (unsigned long)(c * c); \ } \ avgError /= (pixelCount - diffStat[0]); \ \ return avgError; \ } DEFINE_DETECT_FUNCTION(16) DEFINE_DETECT_FUNCTION(32) #define DetectSmoothImage16(x, y, z) DetectSmoothImage16(cl, x, y, z) #define DetectSmoothImage32(x, y, z) DetectSmoothImage32(cl, x, y, z) /* * JPEG compression stuff. */ static Bool SendJpegRect(rfbClientPtr cl, int x, int y, int w, int h, int quality) { struct jpeg_compress_struct cinfo; struct jpeg_error_mgr jerr; CARD8 *srcBuf; JSAMPROW rowPointer[1]; int dy; cl->cinfo = &cinfo; /* tight encoding -- GetClient() uses this to map cinfos to client records */ if (rfbServerFormat.bitsPerPixel == 8) return SendFullColorRect(cl, w, h); srcBuf = (CARD8 *)xalloc(w * 3); if (srcBuf == NULL) { return SendFullColorRect(cl, w, h); } rowPointer[0] = srcBuf; cinfo.err = jpeg_std_error(&jerr); jpeg_create_compress(&cinfo); cinfo.image_width = w; cinfo.image_height = h; cinfo.input_components = 3; cinfo.in_color_space = JCS_RGB; jpeg_set_defaults(&cinfo); jpeg_set_quality(&cinfo, quality, TRUE); JpegSetDstManager (&cinfo); jpeg_start_compress(&cinfo, TRUE); for (dy = 0; dy < h; dy++) { PrepareRowForJpeg(cl, srcBuf, x, y + dy, w); jpeg_write_scanlines(&cinfo, rowPointer, 1); if (jpegError) break; } if (!jpegError) jpeg_finish_compress(&cinfo); jpeg_destroy_compress(&cinfo); xfree((char *)srcBuf); if (jpegError) return SendFullColorRect(cl, w, h); if (cl->ublen + TIGHT_MIN_TO_COMPRESS + 1 > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } cl->updateBuf[cl->ublen++] = (char)(rfbTightJpeg << 4); cl->rfbBytesSent[rfbEncodingTight]++; return SendCompressedData(cl, jpegDstDataLen); } static void PrepareRowForJpeg(rfbClientPtr cl, CARD8 *dst, int x, int y, int count) { if (rfbServerFormat.bitsPerPixel == 32) { if ( rfbServerFormat.redMax == 0xFF && rfbServerFormat.greenMax == 0xFF && rfbServerFormat.blueMax == 0xFF ) { PrepareRowForJpeg24(cl, dst, x, y, count); } else { PrepareRowForJpeg32(cl, dst, x, y, count); } } else { /* 16 bpp assumed. */ PrepareRowForJpeg16(cl, dst, x, y, count); } } static void PrepareRowForJpeg24(rfbClientPtr cl, CARD8 *dst, int x, int y, int count) { CARD32 *fbptr; CARD32 pix; fbptr = (CARD32 *) &cl->scalingFrameBuffer[y * cl->scalingPaddedWidthInBytes + x * 4]; while (count--) { pix = *fbptr++; *dst++ = (CARD8)(pix >> rfbServerFormat.redShift); *dst++ = (CARD8)(pix >> rfbServerFormat.greenShift); *dst++ = (CARD8)(pix >> rfbServerFormat.blueShift); } } #define DEFINE_JPEG_GET_ROW_FUNCTION(bpp) \ \ static void \ PrepareRowForJpeg##bpp(rfbClientPtr cl, CARD8 *dst, int x, int y, int count) \ { \ CARD##bpp *fbptr; \ CARD##bpp pix; \ int inRed, inGreen, inBlue; \ \ fbptr = (CARD##bpp *) \ &cl->scalingFrameBuffer[y * cl->scalingPaddedWidthInBytes + \ x * (bpp / 8)]; \ \ while (count--) { \ pix = *fbptr++; \ \ inRed = (int) \ (pix >> rfbServerFormat.redShift & rfbServerFormat.redMax); \ inGreen = (int) \ (pix >> rfbServerFormat.greenShift & rfbServerFormat.greenMax); \ inBlue = (int) \ (pix >> rfbServerFormat.blueShift & rfbServerFormat.blueMax); \ \ *dst++ = (CARD8)((inRed * 255 + rfbServerFormat.redMax / 2) / \ rfbServerFormat.redMax); \ *dst++ = (CARD8)((inGreen * 255 + rfbServerFormat.greenMax / 2) / \ rfbServerFormat.greenMax); \ *dst++ = (CARD8)((inBlue * 255 + rfbServerFormat.blueMax / 2) / \ rfbServerFormat.blueMax); \ } \ } DEFINE_JPEG_GET_ROW_FUNCTION(16) DEFINE_JPEG_GET_ROW_FUNCTION(32) /* * Destination manager implementation for JPEG library. */ /* tight encoding -- Map cinfo to client record */ #define GetClient(cl, cinfo) \ for ( cl = rfbClientHead;; cl = cl->next ) { \ if (cl == NULL) \ pthread_exit(NULL); \ \ if (cl->cinfo == cinfo) \ break; \ } static void JpegInitDestination(j_compress_ptr cinfo) { rfbClientPtr cl; GetClient(cl, cinfo); jpegError = FALSE; jpegDstManager.next_output_byte = (JOCTET *)tightAfterBuf; jpegDstManager.free_in_buffer = (size_t)tightAfterBufSize; } static boolean JpegEmptyOutputBuffer(j_compress_ptr cinfo) { rfbClientPtr cl; GetClient(cl, cinfo); jpegError = TRUE; jpegDstManager.next_output_byte = (JOCTET *)tightAfterBuf; jpegDstManager.free_in_buffer = (size_t)tightAfterBufSize; return TRUE; } static void JpegTermDestination(j_compress_ptr cinfo) { rfbClientPtr cl; GetClient(cl, cinfo); jpegDstDataLen = tightAfterBufSize - jpegDstManager.free_in_buffer; } #undef JpegSetDstManager static void JpegSetDstManager(rfbClientPtr cl, j_compress_ptr cinfo) { jpegDstManager.init_destination = JpegInitDestination; jpegDstManager.empty_output_buffer = JpegEmptyOutputBuffer; jpegDstManager.term_destination = JpegTermDestination; cinfo->dest = &jpegDstManager; } ================================================ FILE: OSXvnc-server/tight.h ================================================ /* * tight.h - header file for Tight Encoding */ /* * Copyright (C) 2000, 2001 Const Kaplinsky. All Rights Reserved. * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #ifndef __TIGHT_H__ #define __TIGHT_H__ #include /* Stuff dealing with palettes. */ typedef struct COLOR_LIST_s { struct COLOR_LIST_s *next; int idx; CARD32 rgb; } COLOR_LIST; typedef struct PALETTE_ENTRY_s { COLOR_LIST *listNode; int numPixels; } PALETTE_ENTRY; typedef struct PALETTE_s { PALETTE_ENTRY entry[256]; COLOR_LIST *hash[256]; COLOR_LIST list[256]; } PALETTE; #endif ================================================ FILE: OSXvnc-server/translate.c ================================================ /* * translate.c - translate between different pixel formats */ /* * OSXvnc Copyright (C) 2001 Dan McGuirk . * Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge. * All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include #include #include "rfb.h" static Bool rfbSetClientColourMapBGR233(rfbClientPtr cl); Bool rfbEconomicTranslate = FALSE; /* * Structure representing pixel format for RFB server (i.e. us). */ rfbPixelFormat rfbServerFormat; /* * Some standard pixel formats. */ static const rfbPixelFormat BGR233Format = { 8, 8, 0, 1, 7, 7, 3, 0, 3, 6 }; #define CONCAT2(a,b) a##b #define CONCAT2E(a,b) CONCAT2(a,b) #define CONCAT4(a,b,c,d) a##b##c##d #define CONCAT4E(a,b,c,d) CONCAT4(a,b,c,d) #define OUT 8 #include "tableinittctemplate.c" #define IN 8 #include "tabletranstemplate.c" #undef IN #define IN 16 #include "tabletranstemplate.c" #undef IN #define IN 32 #include "tabletranstemplate.c" #undef IN #undef OUT #define OUT 16 #include "tableinittctemplate.c" #define IN 8 #include "tabletranstemplate.c" #undef IN #define IN 16 #include "tabletranstemplate.c" #undef IN #define IN 32 #include "tabletranstemplate.c" #undef IN #undef OUT #define OUT 32 #include "tableinittctemplate.c" #define IN 8 #include "tabletranstemplate.c" #undef IN #define IN 16 #include "tabletranstemplate.c" #undef IN #define IN 32 #include "tabletranstemplate.c" #undef IN #undef OUT typedef void (*rfbInitTableFnType)(char **table, rfbPixelFormat *in, rfbPixelFormat *out); rfbInitTableFnType rfbInitTrueColourSingleTableFns[3] = { rfbInitTrueColourSingleTable8, rfbInitTrueColourSingleTable16, rfbInitTrueColourSingleTable32 }; rfbInitTableFnType rfbInitTrueColourRGBTablesFns[3] = { rfbInitTrueColourRGBTables8, rfbInitTrueColourRGBTables16, rfbInitTrueColourRGBTables32 }; rfbTranslateFnType rfbTranslateWithSingleTableFns[3][3] = { { rfbTranslateWithSingleTable8to8, rfbTranslateWithSingleTable8to16, rfbTranslateWithSingleTable8to32 }, { rfbTranslateWithSingleTable16to8, rfbTranslateWithSingleTable16to16, rfbTranslateWithSingleTable16to32 }, { rfbTranslateWithSingleTable32to8, rfbTranslateWithSingleTable32to16, rfbTranslateWithSingleTable32to32 } }; rfbTranslateFnType rfbTranslateWithRGBTablesFns[3][3] = { { rfbTranslateWithRGBTables8to8, rfbTranslateWithRGBTables8to16, rfbTranslateWithRGBTables8to32 }, { rfbTranslateWithRGBTables16to8, rfbTranslateWithRGBTables16to16, rfbTranslateWithRGBTables16to32 }, { rfbTranslateWithRGBTables32to8, rfbTranslateWithRGBTables32to16, rfbTranslateWithRGBTables32to32 } }; /* * rfbTranslateNone is used when no translation is required. */ void rfbTranslateNone(char *table, rfbPixelFormat *in, rfbPixelFormat *out, char *iptr, char *optr, int bytesBetweenInputLines, int width, int height) { int bytesPerOutputLine = width * (out->bitsPerPixel / 8); while (height > 0) { memcpy(optr, iptr, bytesPerOutputLine); iptr += bytesBetweenInputLines; optr += bytesPerOutputLine; height--; } } /* * rfbSetTranslateFunction sets the translation function. */ Bool rfbSetTranslateFunction(rfbClientPtr cl) { rfbLog("Pixel format for client %s:",cl->host); PrintPixelFormat(&cl->format); //cl->format = rfbServerFormat; cl->translateFn = rfbTranslateNone; cl->translateLookupTable = NULL; return rfbSetTranslateFunctionUsingFormat(cl, rfbServerFormat); } Bool rfbSetTranslateFunctionUsingFormat(rfbClientPtr cl, rfbPixelFormat inFormat) { /* * Check that bits per pixel values are valid */ if ((inFormat.bitsPerPixel != 8) && (inFormat.bitsPerPixel != 16) && (inFormat.bitsPerPixel != 32)) { rfbLog("%s: server bits per pixel not 8, 16 or 32", "rfbSetTranslateFunction"); rfbCloseClient(cl); return FALSE; } if ((cl->format.bitsPerPixel != 8) && (cl->format.bitsPerPixel != 16) && (cl->format.bitsPerPixel != 32)) { rfbLog("%s: client bits per pixel not 8, 16 or 32", "rfbSetTranslateFunction"); rfbCloseClient(cl); return FALSE; } if (!cl->format.trueColour && (cl->format.bitsPerPixel != 8)) { rfbLog("rfbSetTranslateFunction: client has colour map " "but %d-bit - can only cope with 8-bit colour maps\n", cl->format.bitsPerPixel); rfbCloseClient(cl); return FALSE; } /* * bpp is valid, now work out how to translate */ if (!cl->format.trueColour) { /* * truecolour -> colour map * * Set client's colour map to BGR233, then effectively it's * truecolour as well */ rfbLog("setting the client's color map to BGR233"); if (!rfbSetClientColourMapBGR233(cl)) return FALSE; cl->format = BGR233Format; } /* truecolour -> truecolour */ if (PF_EQ(cl->format,inFormat)) { /* client & server the same */ //rfbLog("no translation needed"); cl->translateFn = rfbTranslateNone; cl->translateLookupTable = NULL; return TRUE; } if ((inFormat.bitsPerPixel < 16) || (!rfbEconomicTranslate && (inFormat.bitsPerPixel == 16))) { /* we can use a single lookup table for <= 16 bpp */ //rfbLog("single lookup table translation, function [%d][%d]", inFormat.bitsPerPixel / 16, cl->format.bitsPerPixel / 16); cl->translateFn = rfbTranslateWithSingleTableFns [inFormat.bitsPerPixel / 16] [cl->format.bitsPerPixel / 16]; (*rfbInitTrueColourSingleTableFns [cl->format.bitsPerPixel / 16]) (&cl->translateLookupTable, &inFormat, &cl->format); } else { //rfbLog("three tables for R, G, B"); /* otherwise we use three separate tables for red, green and blue */ cl->translateFn = rfbTranslateWithRGBTablesFns [inFormat.bitsPerPixel / 16] [cl->format.bitsPerPixel / 16]; (*rfbInitTrueColourRGBTablesFns [cl->format.bitsPerPixel / 16]) (&cl->translateLookupTable, &inFormat, &cl->format); } return TRUE; } /* * rfbSetClientColourMapBGR233 sets the client's colour map so that it's * just like an 8-bit BGR233 true colour client. */ static Bool rfbSetClientColourMapBGR233(rfbClientPtr cl) { char buf[sz_rfbSetColourMapEntriesMsg + 256 * 3 * 2]; rfbSetColourMapEntriesMsg *scme = (rfbSetColourMapEntriesMsg *)buf; CARD16 *rgb = (CARD16 *)(&buf[sz_rfbSetColourMapEntriesMsg]); int i, len; int r, g, b; if (cl->format.bitsPerPixel != 8) { rfbLog("%s: client not 8 bits per pixel", "rfbSetClientColourMapBGR233"); rfbCloseClient(cl); return FALSE; } scme->type = rfbSetColourMapEntries; scme->firstColour = Swap16IfLE(0); scme->nColours = Swap16IfLE(256); len = sz_rfbSetColourMapEntriesMsg; i = 0; for (b = 0; b < 4; b++) { for (g = 0; g < 8; g++) { for (r = 0; r < 8; r++) { rgb[i++] = Swap16IfLE(r * 65535 / 7); rgb[i++] = Swap16IfLE(g * 65535 / 7); rgb[i++] = Swap16IfLE(b * 65535 / 3); } } } len += 256 * 3 * 2; if (WriteExact(cl, buf, len) < 0) { rfbLogPerror("rfbSetClientColourMapBGR233: write"); rfbCloseClient(cl); return FALSE; } return TRUE; } void PrintPixelFormat(rfbPixelFormat *pf) { if (pf->bitsPerPixel == 1) { rfbLog(" 1 bpp, %s sig bit in each byte is leftmost on the screen.", (pf->bigEndian ? "most" : "least")); } else { rfbLog(" %d bpp, depth %d%s", pf->bitsPerPixel, pf->depth, ((pf->bitsPerPixel == 8) ? "" : (pf->bigEndian ? ", big endian" : ", little endian"))); if (pf->trueColour) { rfbLog(" true colour: max r %d g %d b %d, shift r %d g %d b %d", pf->redMax, pf->greenMax, pf->blueMax, pf->redShift, pf->greenShift, pf->blueShift); } else { rfbLog(" uses a colour map (not true colour)."); } } } ================================================ FILE: OSXvnc-server/vncauth.c ================================================ /* * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ /* * vncauth.c - Functions for VNC password management and authentication. */ #include #include #include #include #include #include #include "vncauth.h" #include "d3des.h" /* * We use a fixed key to store passwords, since we assume that our local * file system is secure but nonetheless don't want to store passwords * as plaintext. */ unsigned char fixedkey[8] = {23,82,107,6,35,78,88,7}; char *vncEncryptPasswd(const char *passwd) { unsigned char encryptedPasswd[8]; char *returnPass; // Handles copying 0's into extra space strncpy((char *)encryptedPasswd, passwd, 8); /* Do encryption in-place - this way we overwrite our copy of the plaintext password */ deskey(fixedkey, EN0); des(encryptedPasswd, encryptedPasswd); returnPass = malloc(8); strncpy(returnPass, (const char *) encryptedPasswd, 8); return (char *)returnPass; } /* * Encrypt a password and store it in a file. Returns 0 if successful, * 1 if the file could not be written. */ int vncEncryptAndStorePasswd(char *passwd, char *fname) { FILE *fp; int i; unsigned char encryptedPasswd[8]; if ((fp = fopen(fname,"w")) == NULL) return 1; chmod(fname, S_IRUSR|S_IWUSR); /* pad password with nulls */ for (i = 0; i < 8; i++) { if (i < strlen(passwd)) { encryptedPasswd[i] = passwd[i]; } else { encryptedPasswd[i] = 0; } } /* Do encryption in-place - this way we overwrite our copy of the plaintext password */ deskey(fixedkey, EN0); des(encryptedPasswd, encryptedPasswd); for (i = 0; i < 8; i++) { putc(encryptedPasswd[i], fp); } fclose(fp); return 0; } /* * Decrypt a password from a file. Returns a pointer to a newly allocated * string containing the password or a null pointer if the password could * not be retrieved for some reason. */ char * vncDecryptPasswdFromFile(char *fname) { FILE *fp; int i, ch; unsigned char *passwd; if ((fp = fopen(fname,"r")) == NULL) return NULL; passwd = (unsigned char *)malloc(9); if (passwd != NULL) { for (i = 0; i < 8; i++) { ch = getc(fp); if (ch == EOF) { free(passwd); fclose(fp); return NULL; } passwd[i] = ch; } deskey(fixedkey, DE1); des(passwd, passwd); passwd[8] = 0; } fclose(fp); return (char *)passwd; } /* * Generate CHALLENGESIZE random bytes for use in challenge-response * authentication. */ void vncRandomBytes(unsigned char *bytes) { int i; unsigned int seed = (unsigned int) time(0); srandom(seed); for (i = 0; i < CHALLENGESIZE; i++) { bytes[i] = (unsigned char)(random() & 255); } } /* * Encrypt CHALLENGESIZE bytes in memory using a password. */ void vncEncryptBytes(unsigned char *bytes, char *passwd) { unsigned char key[8]; int i; /* key is simply password padded with nulls */ for (i = 0; i < 8; i++) { if (i < strlen(passwd)) { key[i] = passwd[i]; } else { key[i] = 0; } } deskey(key, EN0); for (i = 0; i < CHALLENGESIZE; i += 8) { des(bytes+i, bytes+i); } } ================================================ FILE: OSXvnc-server/vncauth.h ================================================ /* * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ /* * vncauth.h - describes the functions provided by the vncauth library. */ #define MAXPWLEN 8 #define CHALLENGESIZE 16 extern char *vncEncryptPasswd(const char *passwd); extern int vncEncryptAndStorePasswd(char *passwd, char *fname); extern char *vncDecryptPasswdFromFile(char *fname); extern void vncRandomBytes(unsigned char *bytes); extern void vncEncryptBytes(unsigned char *bytes, char *passwd); ================================================ FILE: OSXvnc-server/xalloc.c ================================================ /* XALLOC -- X's internal memory allocator. Why does it return unsigned * long * instead of the more common char *? Well, if you read K&R you'll * see they say that alloc must return a pointer "suitable for conversion" * to whatever type you really want. In a full-blown generic allocator * there's no way to solve the alignment problems without potentially * wasting lots of space. But we have a more limited problem. We know * we're only ever returning pointers to structures which will have to * be long word aligned. So we are making a stronger guarantee. It might * have made sense to make Xalloc return char * to conform with people's * expectations of malloc, but this makes lint happier. */ #ifdef WIN32 #include #endif #include "Xos.h" #include #include #include "misc.h" #include "X.h" #include "input.h" #include "opaque.h" #ifdef X_POSIX_C_SOURCE #define _POSIX_C_SOURCE X_POSIX_C_SOURCE #include #undef _POSIX_C_SOURCE #else #if defined(X_NOT_POSIX) || defined(_POSIX_SOURCE) #include #else #define _POSIX_SOURCE #include #undef _POSIX_SOURCE #endif #endif #if !defined(SYSV) && !defined(AMOEBA) && !defined(_MINIX) && !defined(WIN32) && !defined(Lynx) #include #endif #include #include #include /* for isspace */ #if NeedVarargsPrototypes #include #endif #ifndef INTERNAL_MALLOC Bool Must_have_memory = FALSE; unsigned long * Xalloc (unsigned long amount) { #if !defined(__STDC__) && !defined(AMOEBA) char *malloc(); #endif register pointer ptr; if ((long)amount <= 0) { return (unsigned long *)NULL; } /* aligned extra on long word boundary */ amount = (amount + (sizeof(long) - 1)) & ~(sizeof(long) - 1); #ifdef MEMBUG if (!Must_have_memory && Memory_fail && ((random() % MEM_FAIL_SCALE) < Memory_fail)) return (unsigned long *)NULL; #endif if ((ptr = (pointer)malloc(amount))) { return (unsigned long *)ptr; } if (Must_have_memory) FatalError("Out of memory"); return (unsigned long *)NULL; } /***************** * XNFalloc * "no failure" realloc, alternate interface to Xalloc w/o Must_have_memory *****************/ unsigned long * XNFalloc (unsigned long amount) { #if !defined(__STDC__) && !defined(AMOEBA) char *malloc(); #endif register pointer ptr; if ((long)amount <= 0) { return (unsigned long *)NULL; } /* aligned extra on long word boundary */ amount = (amount + (sizeof(long) - 1)) & ~(sizeof(long) - 1); ptr = (pointer)malloc(amount); if (!ptr) { FatalError("Out of memory"); } return ((unsigned long *)ptr); } /***************** * Xcalloc *****************/ unsigned long * Xcalloc (unsigned long amount) { unsigned long *ret; ret = Xalloc (amount); if (ret) bzero ((char *) ret, (int) amount); return ret; } /***************** * Xrealloc *****************/ unsigned long * Xrealloc (pointer ptr, unsigned long amount) { #if !defined(__STDC__) && !defined(AMOEBA) char *malloc(); char *realloc(); #endif #ifdef MEMBUG if (!Must_have_memory && Memory_fail && ((random() % MEM_FAIL_SCALE) < Memory_fail)) return (unsigned long *)NULL; #endif if ((long)amount <= 0) { if (ptr && !amount) free(ptr); return (unsigned long *)NULL; } amount = (amount + (sizeof(long) - 1)) & ~(sizeof(long) - 1); if (ptr) ptr = (pointer)realloc((char *)ptr, amount); else ptr = (pointer)malloc(amount); if (ptr) return (unsigned long *)ptr; if (Must_have_memory) FatalError("Out of memory"); return (unsigned long *)NULL; } /***************** * XNFrealloc * "no failure" realloc, alternate interface to Xrealloc w/o Must_have_memory *****************/ unsigned long * XNFrealloc (pointer ptr, unsigned long amount) { if (( ptr = (pointer)Xrealloc( ptr, amount ) ) == NULL) { FatalError( "Out of memory" ); } return ((unsigned long *)ptr); } /***************** * Xfree * calls free *****************/ void Xfree(pointer ptr) { if (ptr) free((char *)ptr); } void FatalError(char *f, ...) { va_list args; fprintf(stderr, "\nFatal server error:\n"); va_start(args, f); vfprintf(stderr, f, args); va_end(args); fprintf(stderr, "\n"); exit(1); } #endif ================================================ FILE: OSXvnc-server/zlib.c ================================================ /* * zlib.c * * Routines to implement zlib based encoding (deflate). */ /* * Copyright (C) 2000 Tridia Corporation. All Rights Reserved. * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * * For the latest source code, please check: * * http://www.developVNC.org/ * * or send email to feedback@developvnc.org. */ #include #include "rfb.h" /* * rfbSendOneRectEncodingZlib - send a given rectangle using one Zlib * rectangle encoding. */ Bool rfbSendOneRectEncodingZlib(rfbClientPtr cl, int x, int y, int w, int h) { rfbFramebufferUpdateRectHeader rect; rfbZlibHeader hdr; int deflateResult; int i; char *fbptr = (cl->scalingFrameBuffer + (cl->scalingPaddedWidthInBytes * y) + (x * (rfbScreen.bitsPerPixel / 8))); int maxRawSize; int maxCompSize; maxRawSize = (rfbScreen.width * rfbScreen.height * (cl->format.bitsPerPixel / 8)); if (zlibBeforeBufSize < maxRawSize) { zlibBeforeBufSize = maxRawSize; if (zlibBeforeBuf == NULL) zlibBeforeBuf = (char *)xalloc(zlibBeforeBufSize); else zlibBeforeBuf = (char *)xrealloc(zlibBeforeBuf, zlibBeforeBufSize); } /* zlib compression is not useful for very small data sets. * So, we just send these raw without any compression. */ if (( w * h * (rfbScreen.bitsPerPixel / 8)) < VNC_ENCODE_ZLIB_MIN_COMP_SIZE ) { int result; /* The translation function (used also by the in raw encoding) * requires 4/2/1 byte alignment in the output buffer (which is * cl->updateBuf for the raw encoding) based on the bitsPerPixel of * the viewer/client. This prevents SIGBUS errors on some * architectures like SPARC, PARISC... */ if (( cl->format.bitsPerPixel > 8 ) && ( cl->ublen % ( cl->format.bitsPerPixel / 8 )) != 0 ) { if (!rfbSendUpdateBuf(cl)) return FALSE; } result = rfbSendRectEncodingRaw(cl, x, y, w, h); return result; } /* * zlib requires output buffer to be slightly larger than the input * buffer, in the worst case. */ maxCompSize = maxRawSize + (( maxRawSize + 99 ) / 100 ) + 12; if (zlibAfterBufSize < maxCompSize) { zlibAfterBufSize = maxCompSize; if (zlibAfterBuf == NULL) zlibAfterBuf = (char *)xalloc(zlibAfterBufSize); else zlibAfterBuf = (char *)xrealloc(zlibAfterBuf, zlibAfterBufSize); } /* * Convert pixel data to client format. */ (*cl->translateFn)(cl->translateLookupTable, &rfbServerFormat, &cl->format, fbptr, zlibBeforeBuf, cl->scalingPaddedWidthInBytes, w, h); cl->compStream.next_in = ( Bytef * )zlibBeforeBuf; cl->compStream.avail_in = w * h * (cl->format.bitsPerPixel / 8); cl->compStream.next_out = ( Bytef * )zlibAfterBuf; cl->compStream.avail_out = maxCompSize; cl->compStream.data_type = Z_BINARY; /* Initialize the deflation state. */ if ( cl->compStreamInited == FALSE ) { cl->compStream.total_in = 0; cl->compStream.total_out = 0; cl->compStream.zalloc = Z_NULL; cl->compStream.zfree = Z_NULL; cl->compStream.opaque = Z_NULL; deflateInit2( &(cl->compStream), cl->zlibCompressLevel, Z_DEFLATED, MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY ); /* deflateInit( &(cl->compStream), Z_BEST_COMPRESSION ); */ /* deflateInit( &(cl->compStream), Z_BEST_SPEED ); */ cl->compStreamInited = TRUE; } size_t previousOut = cl->compStream.total_out; /* Perform the compression here. */ deflateResult = deflate( &(cl->compStream), Z_SYNC_FLUSH ); /* Find the total size of the resulting compressed data. */ zlibAfterBufLen = cl->compStream.total_out - previousOut; if ( deflateResult != Z_OK ) { rfbLog("zlib deflation error: %s", cl->compStream.msg); return FALSE; } /* Note that it is not possible to switch zlib parameters based on * the results of the compression pass. The reason is * that we rely on the compressor and decompressor states being * in sync. Compressing and then discarding the results would * cause lose of synchronization. */ /* Update statics */ cl->rfbRectanglesSent[rfbEncodingZlib]++; cl->rfbBytesSent[rfbEncodingZlib] += (sz_rfbFramebufferUpdateRectHeader + sz_rfbZlibHeader + zlibAfterBufLen); if (cl->ublen + sz_rfbFramebufferUpdateRectHeader + sz_rfbZlibHeader > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } rect.r.x = Swap16IfLE(x); rect.r.y = Swap16IfLE(y); rect.r.w = Swap16IfLE(w); rect.r.h = Swap16IfLE(h); rect.encoding = Swap32IfLE(rfbEncodingZlib); memcpy(&cl->updateBuf[cl->ublen], &rect, sz_rfbFramebufferUpdateRectHeader); cl->ublen += sz_rfbFramebufferUpdateRectHeader; hdr.nBytes = Swap32IfLE(zlibAfterBufLen); memcpy(&cl->updateBuf[cl->ublen], &hdr, sz_rfbZlibHeader); cl->ublen += sz_rfbZlibHeader; for (i = 0; i < zlibAfterBufLen;) { int bytesToCopy = UPDATE_BUF_SIZE - cl->ublen; if (i + bytesToCopy > zlibAfterBufLen) { bytesToCopy = zlibAfterBufLen - i; } memcpy(&cl->updateBuf[cl->ublen], &zlibAfterBuf[i], bytesToCopy); cl->ublen += bytesToCopy; i += bytesToCopy; if (cl->ublen == UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } } return TRUE; } /* * rfbSendRectEncodingZlib - send a given rectangle using one or more * Zlib encoding rectangles. */ Bool rfbSendRectEncodingZlib(rfbClientPtr cl, int x, int y, int w, int h) { int maxLines; int linesRemaining; rfbRectangle partialRect; partialRect.x = x; partialRect.y = y; partialRect.w = w; partialRect.h = h; /* Determine maximum pixel/scan lines allowed per rectangle. */ maxLines = ( ZLIB_MAX_SIZE(w) / w ); /* Initialize number of scan lines left to do. */ linesRemaining = h; /* Loop until all work is done. */ while ( linesRemaining > 0 ) { int linesToComp; if ( maxLines < linesRemaining ) linesToComp = maxLines; else linesToComp = linesRemaining; partialRect.h = linesToComp; /* Encode (compress) and send the next rectangle. */ if ( ! rfbSendOneRectEncodingZlib( cl, partialRect.x, partialRect.y, partialRect.w, partialRect.h )) { return FALSE; } /* Technically, flushing the buffer here is not extremely * efficient. However, this improves the overall throughput * of the system over very slow networks. By flushing * the buffer with every maximum size zlib rectangle, we * improve the pipelining usage of the server CPU, network, * and viewer CPU components. Insuring that these components * are working in parallel actually improves the performance * seen by the user. * Since, zlib is most useful for slow networks, this flush * is appropriate for the desired behavior of the zlib encoding. */ if (( cl->ublen > 0 ) && ( linesToComp == maxLines )) { if (!rfbSendUpdateBuf(cl)) { return FALSE; } } /* Update remaining and incremental rectangle location. */ linesRemaining -= linesToComp; partialRect.y += linesToComp; } return TRUE; } ================================================ FILE: OSXvnc-server/zlibhex.c ================================================ /* * zlibhex.c * * Routines to implement ZlibHex Encoding */ /* * Copyright (C) 2000 Tridia Corporation. All Rights Reserved. * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * * For the latest source code, please check: * * http://www.developVNC.org/ * * or send email to feedback@developvnc.org. */ #include #include "rfb.h" static Bool sendZlibHex8(rfbClientPtr cl, int x, int y, int w, int h); static Bool sendZlibHex16(rfbClientPtr cl, int x, int y, int w, int h); static Bool sendZlibHex32(rfbClientPtr cl, int x, int y, int w, int h); /* * rfbSendRectEncodingZlibHex - send a rectangle using zlibhex encoding. */ Bool rfbSendRectEncodingZlibHex(rfbClientPtr cl, int x, int y, int w, int h) { rfbFramebufferUpdateRectHeader rect; if (cl->ublen + sz_rfbFramebufferUpdateRectHeader > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } rect.r.x = Swap16IfLE(x); rect.r.y = Swap16IfLE(y); rect.r.w = Swap16IfLE(w); rect.r.h = Swap16IfLE(h); rect.encoding = Swap32IfLE(rfbEncodingZlibHex); memcpy(&cl->updateBuf[cl->ublen], &rect, sz_rfbFramebufferUpdateRectHeader); cl->ublen += sz_rfbFramebufferUpdateRectHeader; cl->rfbRectanglesSent[rfbEncodingZlibHex]++; cl->rfbBytesSent[rfbEncodingZlibHex] += sz_rfbFramebufferUpdateRectHeader; switch (cl->format.bitsPerPixel) { case 8: return sendZlibHex8(cl, x, y, w, h); case 16: return sendZlibHex16(cl, x, y, w, h); case 32: return sendZlibHex32(cl, x, y, w, h); } rfbLog("rfbSendRectEncodingZlibHex: bpp %d?", cl->format.bitsPerPixel); return FALSE; } int zlibCompress( BYTE *from_buf, BYTE *to_buf, unsigned int length, unsigned int size, rfbClientPtr cl, struct z_stream_s *compressor ) { int deflateResult; /* Initialize input/output buffer assignment for compressor state. */ compressor->avail_in = length; compressor->next_in = from_buf; compressor->avail_out = size; compressor->next_out = to_buf; compressor->data_type = Z_BINARY; /* If necessary, the first time, initialize the compressor state. */ if ( compressor->total_in == ZLIBHEX_COMP_UNINITED ) { compressor->total_in = 0; compressor->total_out = 0; compressor->zalloc = Z_NULL; compressor->zfree = Z_NULL; compressor->opaque = Z_NULL; deflateResult = deflateInit2( compressor, cl->zlibCompressLevel, Z_DEFLATED, MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY ); if ( deflateResult != Z_OK ) { rfbLog( "deflateInit2 returned error:%d:%s", deflateResult, compressor->msg ); return -1; } } /* Record previous total output size. */ size_t previousTotalOut = compressor->total_out; /* Compress the raw data into the result buffer. */ deflateResult = deflate( compressor, Z_SYNC_FLUSH ); if ( deflateResult != Z_OK ) { rfbLog( "deflate returned error:%d:%s", deflateResult, compressor->msg); return -1; } return compressor->total_out - previousTotalOut; } #define PUT_PIXEL8(pix) (cl->updateBuf[cl->ublen++] = (pix)) #define PUT_PIXEL16(pix) (cl->updateBuf[cl->ublen++] = ((char*)&(pix))[0], \ cl->updateBuf[cl->ublen++] = ((char*)&(pix))[1]) #define PUT_PIXEL32(pix) (cl->updateBuf[cl->ublen++] = ((char*)&(pix))[0], \ cl->updateBuf[cl->ublen++] = ((char*)&(pix))[1], \ cl->updateBuf[cl->ublen++] = ((char*)&(pix))[2], \ cl->updateBuf[cl->ublen++] = ((char*)&(pix))[3]) #define DEFINE_SEND_ZLIBHEX(bpp) \ \ \ static Bool subrectEncode##bpp(CARD##bpp *data, int w, int h, CARD##bpp bg, \ CARD##bpp fg, Bool mono, rfbClientPtr cl); \ static void testColours##bpp(CARD##bpp *data, int size, Bool *mono, \ Bool *solid, CARD##bpp *bg, CARD##bpp *fg, \ rfbClientPtr cl); \ \ \ /* \ * rfbSendZlibHex \ */ \ \ static Bool \ sendZlibHex##bpp(rfbClientPtr cl, int rx, int ry, int rw, int rh) \ { \ int x, y, w, h; \ int startUblen; \ char *fbptr; \ CARD##bpp bg = 0, fg = 0, newBg = 0, newFg = 0; \ Bool mono, solid; \ Bool validBg = FALSE; \ Bool validFg = FALSE; \ CARD##bpp clientPixelData[(16*16+2)*(bpp/8)]; \ int encodedBytes; \ int compressedSize; \ CARD16 *card16ptr; \ \ for (y = ry; y < ry+rh; y += 16) { \ for (x = rx; x < rx+rw; x += 16) { \ w = h = 16; \ if (rx+rw - x < 16) \ w = rx+rw - x; \ if (ry+rh - y < 16) \ h = ry+rh - y; \ \ if ((cl->ublen + 1 + (2 + 16*16)*(bpp/8) + 22) > UPDATE_BUF_SIZE) { \ if (!rfbSendUpdateBuf(cl)) \ return FALSE; \ } \ \ fbptr = (cl->scalingFrameBuffer + (cl->scalingPaddedWidthInBytes * y) \ + (x * (rfbScreen.bitsPerPixel / 8))); \ \ (*cl->translateFn)(cl->translateLookupTable, &rfbServerFormat, \ &cl->format, fbptr, (char *)clientPixelData, \ cl->scalingPaddedWidthInBytes, w, h); \ \ startUblen = cl->ublen; \ cl->updateBuf[startUblen] = 0; \ cl->ublen++; \ \ testColours##bpp(clientPixelData, w * h, \ &mono, &solid, &newBg, &newFg, cl); \ \ if (!validBg || (newBg != bg)) { \ validBg = TRUE; \ bg = newBg; \ cl->updateBuf[startUblen] |= rfbHextileBackgroundSpecified; \ PUT_PIXEL##bpp(bg); \ } \ \ if (solid) { \ cl->rfbBytesSent[rfbEncodingZlibHex] += cl->ublen - startUblen; \ continue; \ } \ \ cl->updateBuf[startUblen] |= rfbHextileAnySubrects; \ \ if (mono) { \ if (!validFg || (newFg != fg)) { \ validFg = TRUE; \ fg = newFg; \ cl->updateBuf[startUblen] |= rfbHextileForegroundSpecified; \ PUT_PIXEL##bpp(fg); \ } \ } else { \ validFg = FALSE; \ cl->updateBuf[startUblen] |= rfbHextileSubrectsColoured; \ } \ \ if (!subrectEncode##bpp(clientPixelData, w, h, bg, fg, mono, cl)) { \ encodedBytes = -1; \ } \ else { \ encodedBytes = cl->ublen - startUblen - 1; \ } \ \ \ if ( encodedBytes == -1 ) { \ /* straight hextile failed, deal with raw data */ \ if ( w * h * (bpp/8) > VNC_ENCODE_ZLIBHEX_MIN_COMP_SIZE ) { \ /* rectangle large enough, zlib raw data */ \ validBg = FALSE; \ validFg = FALSE; \ cl->ublen = startUblen; \ cl->updateBuf[cl->ublen++] = rfbHextileZlibRaw; \ (*cl->translateFn)(cl->translateLookupTable, \ &rfbServerFormat, &cl->format, fbptr, \ (char *)clientPixelData, \ cl->scalingPaddedWidthInBytes, w, h); \ \ compressedSize = zlibCompress( (BYTE*) clientPixelData, \ (BYTE*) &cl->updateBuf[cl->ublen+2], \ w * h * (bpp/8), \ (16*16+2)*(bpp/8)+20, \ cl, \ &(cl->compStreamRaw)); \ \ card16ptr = (CARD16*) (&cl->updateBuf[cl->ublen]); \ *card16ptr = Swap16IfLE(compressedSize); \ cl->ublen += compressedSize + 2; \ } \ else { \ /* rectangle was too small, use raw */ \ validBg = FALSE; \ validFg = FALSE; \ cl->ublen = startUblen; \ cl->updateBuf[cl->ublen++] = rfbHextileRaw; \ (*cl->translateFn)(cl->translateLookupTable, \ &rfbServerFormat, &cl->format, fbptr, \ (char *)clientPixelData, \ cl->scalingPaddedWidthInBytes, w, h); \ \ /* Extra copy protects against bus errors on RISC. */ \ memcpy(&cl->updateBuf[cl->ublen], clientPixelData, \ w * h * (bpp/8)); \ \ cl->ublen += w * h * (bpp/8); \ } \ } \ else { \ /* straight hextile worked, deal with hextiled data */ \ if ( encodedBytes > (VNC_ENCODE_ZLIBHEX_MIN_COMP_SIZE * 2)) { \ /* hex data large enough, zlib hex data */ \ cl->ublen = startUblen; \ cl->updateBuf[cl->ublen++] |= rfbHextileZlibHex; \ memcpy( clientPixelData, &cl->updateBuf[cl->ublen], encodedBytes); \ \ compressedSize = zlibCompress( (BYTE*) clientPixelData, \ (BYTE*) &cl->updateBuf[cl->ublen+2], \ encodedBytes, \ (16*16+2)*(bpp/8)+20, \ cl, \ &(cl->compStreamHex)); \ \ card16ptr = (CARD16*) (&cl->updateBuf[cl->ublen]); \ *card16ptr = Swap16IfLE(compressedSize); \ cl->ublen += compressedSize + 2; \ } \ /* hex data too small, use as is */ \ } \ \ cl->rfbBytesSent[rfbEncodingZlibHex] += cl->ublen - startUblen; \ } \ } \ \ return TRUE; \ } #define DEFINE_SUBRECT_ENCODE(bpp) \ \ static Bool \ subrectEncode##bpp(CARD##bpp *data, int w, int h, CARD##bpp bg, \ CARD##bpp fg, Bool mono, rfbClientPtr cl) \ { \ CARD##bpp singleCL; \ int x,y; \ int i,j; \ int hx=0,hy,vx=0,vy; \ int hyflag; \ CARD##bpp *seg; \ CARD##bpp *line; \ int hw,hh,vw,vh; \ int thex,they,thew,theh; \ int numsubs = 0; \ int newLen; \ int nSubrectsUblen; \ \ nSubrectsUblen = cl->ublen; \ cl->ublen++; \ \ for (y=0; y 0) && (i >= hx)) { \ hy += 1; \ } else { \ hyflag = 0; \ } \ } \ vy = j-1; \ \ /* We now have two possible subrects: (x,y,hx,hy) and \ * (x,y,vx,vy). We'll choose the bigger of the two. \ */ \ hw = hx-x+1; \ hh = hy-y+1; \ vw = vx-x+1; \ vh = vy-y+1; \ \ thex = x; \ they = y; \ \ if ((hw*hh) > (vw*vh)) { \ thew = hw; \ theh = hh; \ } else { \ thew = vw; \ theh = vh; \ } \ \ if (mono) { \ newLen = cl->ublen - nSubrectsUblen + 2; \ } else { \ newLen = cl->ublen - nSubrectsUblen + bpp/8 + 2; \ } \ \ if (newLen > (w * h * (bpp/8))) \ return FALSE; \ \ numsubs += 1; \ \ if (!mono) PUT_PIXEL##bpp(singleCL); \ \ cl->updateBuf[cl->ublen++] = rfbHextilePackXY(thex,they); \ cl->updateBuf[cl->ublen++] = rfbHextilePackWH(thew,theh); \ \ /* \ * Now mark the subrect as done. \ */ \ for (j=they; j < (they+theh); j++) { \ for (i=thex; i < (thex+thew); i++) { \ data[j*w+i] = bg; \ } \ } \ } \ } \ } \ \ cl->updateBuf[nSubrectsUblen] = numsubs; \ \ return TRUE; \ } #define DEFINE_TEST_COLOURS(bpp) \ \ /* \ * testColours() tests if there are one (solid), two (mono) or more \ * colours in a tile and gets a reasonable guess at the best background \ * pixel, and the foreground pixel for mono. \ */ \ \ static void \ testColours##bpp(CARD##bpp *data, int size, Bool *mono, Bool *solid, CARD##bpp *bg, CARD##bpp *fg, rfbClientPtr cl) \ { \ CARD##bpp colour1 = 0, colour2 = 0; \ int n1 = 0, n2 = 0; \ *mono = TRUE; \ *solid = TRUE; \ \ for (; size > 0; size--, data++) { \ \ if (n1 == 0) \ colour1 = *data; \ \ if (*data == colour1) { \ n1++; \ continue; \ } \ \ if (n2 == 0) { \ *solid = FALSE; \ colour2 = *data; \ } \ \ if (*data == colour2) { \ n2++; \ continue; \ } \ \ *mono = FALSE; \ break; \ } \ \ if (n1 > n2) { \ *bg = colour1; \ *fg = colour2; \ } else { \ *bg = colour2; \ *fg = colour1; \ } \ } DEFINE_SEND_ZLIBHEX(8) DEFINE_SUBRECT_ENCODE(8) DEFINE_TEST_COLOURS(8) DEFINE_SEND_ZLIBHEX(16) DEFINE_SUBRECT_ENCODE(16) DEFINE_TEST_COLOURS(16) DEFINE_SEND_ZLIBHEX(32) DEFINE_SUBRECT_ENCODE(32) DEFINE_TEST_COLOURS(32) ================================================ FILE: OSXvnc-server/zrle.cc ================================================ // // Copyright (C) 2002 RealVNC Ltd. All Rights Reserved. // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this software; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. // // // zrle.cc // // Routines to implement Zlib Run-length Encoding (ZRLE). // #include #include extern "C" { #include "rfb.h" } #include #include #define GET_IMAGE_INTO_BUF(tx,ty,tw,th,buf) \ char *fbptr = (cl->scalingFrameBuffer + (cl->scalingPaddedWidthInBytes * ty) \ + (tx * (rfbScreen.bitsPerPixel / 8))); \ \ (*cl->translateFn)(cl->translateLookupTable, &rfbServerFormat, \ &cl->format, fbptr, (char*)buf, \ cl->scalingPaddedWidthInBytes, tw, th); #define EXTRA_ARGS , rfbClientPtr cl #define BPP 8 #include #undef BPP #define BPP 16 #include #undef BPP #define BPP 32 #include #define CPIXEL 24A #include #undef CPIXEL #define CPIXEL 24B #include #undef CPIXEL #undef BPP /* * rfbSendRectEncodingZRLE - send a given rectangle using ZRLE encoding. */ /* * zrleBeforeBuf contains pixel data in the client's format. It must be at * least one pixel bigger than the largest tile of pixel data, since the * ZRLE encoding algorithm writes to the position one past the end of the pixel * data. */ /* These things must be inside the client record to be thread safe in OSXvnc We #define them to minimize differences from the original source */ #define zrleBeforeBuf cl->client_zrleBeforeBuf #define ublen cl->ublen #define updateBuf cl->updateBuf Bool rfbSendRectEncodingZRLE(rfbClientPtr cl, int x, int y, int w, int h) { if (!cl->zrleData) { cl->zrleData = new rdr::ZlibOutStream; cl->mosData = new rdr::MemOutStream(2048); } rdr::ZlibOutStream* zos = (rdr::ZlibOutStream*)cl->zrleData; rdr::MemOutStream* mos = (rdr::MemOutStream*)cl->mosData; mos->clear(); switch (cl->format.bitsPerPixel) { case 8: zrleEncode8( x, y, w, h, mos, zos, zrleBeforeBuf, cl); break; case 16: zrleEncode16(x, y, w, h, mos, zos, zrleBeforeBuf, cl); break; case 32: bool fitsInLS3Bytes = ((cl->format.redMax << cl->format.redShift) < (1<<24) && (cl->format.greenMax << cl->format.greenShift) < (1<<24) && (cl->format.blueMax << cl->format.blueShift) < (1<<24)); bool fitsInMS3Bytes = (cl->format.redShift > 7 && cl->format.greenShift > 7 && cl->format.blueShift > 7); if ((fitsInLS3Bytes && !cl->format.bigEndian) || (fitsInMS3Bytes && cl->format.bigEndian)) { zrleEncode24A(x, y, w, h, mos, zos, zrleBeforeBuf, cl); } else if ((fitsInLS3Bytes && cl->format.bigEndian) || (fitsInMS3Bytes && !cl->format.bigEndian)) { zrleEncode24B(x, y, w, h, mos, zos, zrleBeforeBuf, cl); } else { zrleEncode32(x, y, w, h, mos, zos, zrleBeforeBuf, cl); } break; } cl->rfbRectanglesSent[rfbEncodingZRLE]++; cl->rfbBytesSent[rfbEncodingZRLE] += (sz_rfbFramebufferUpdateRectHeader + sz_rfbZRLEHeader + mos->length()); if (ublen + sz_rfbFramebufferUpdateRectHeader + sz_rfbZRLEHeader > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } rfbFramebufferUpdateRectHeader rect; rect.r.x = Swap16IfLE(x); rect.r.y = Swap16IfLE(y); rect.r.w = Swap16IfLE(w); rect.r.h = Swap16IfLE(h); rect.encoding = Swap32IfLE(rfbEncodingZRLE); memcpy(&updateBuf[ublen], &rect, sz_rfbFramebufferUpdateRectHeader); ublen += sz_rfbFramebufferUpdateRectHeader; rfbZRLEHeader hdr; hdr.length = Swap32IfLE(mos->length()); memcpy(&updateBuf[ublen], &hdr, sz_rfbZRLEHeader); ublen += sz_rfbZRLEHeader; // copy into updateBuf and send from there. Maybe should send directly? for (int i = 0; i < mos->length();) { size_t bytesToCopy = UPDATE_BUF_SIZE - ublen; if (i + bytesToCopy > mos->length()) { bytesToCopy = mos->length() - i; } memcpy(&updateBuf[ublen], (CARD8*)mos->data() + i, bytesToCopy); ublen += bytesToCopy; i += bytesToCopy; if (ublen == UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } } return TRUE; } void FreeZrleData(rfbClientPtr cl) { if (cl->zrleData) { delete (rdr::ZlibOutStream*)cl->zrleData; cl->zrleData = NULL; } if (cl->mosData) { delete (rdr::MemOutStream*)cl->mosData; cl->mosData = NULL; } } ================================================ FILE: OSXvnc-server/zrleEncode.h ================================================ // // Copyright (C) 2002 RealVNC Ltd. All Rights Reserved. // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this software; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. // // zrleEncode.h - zrle encoding function. // // Before including this file, you must define a number of CPP macros. // // BPP should be 8, 16 or 32 depending on the bits per pixel. // GET_IMAGE_INTO_BUF should be some code which gets a rectangle of pixel data // into the given buffer. EXTRA_ARGS can be defined to pass any other // arguments needed by GET_IMAGE_INTO_BUF. // // Note that the buf argument to ZRLE_ENCODE needs to be at least one pixel // bigger than the largest tile of pixel data, since the ZRLE encoding // algorithm writes to the position one past the end of the pixel data. // #include #include using namespace rdr; /* __RFB_CONCAT2 concatenates its two arguments. __RFB_CONCAT2E does the same but also expands its arguments if they are macros */ #ifndef __RFB_CONCAT2E #define __RFB_CONCAT2(a,b) a##b #define __RFB_CONCAT2E(a,b) __RFB_CONCAT2(a,b) #endif #ifdef CPIXEL #define PIXEL_T __RFB_CONCAT2E(rdr::U,BPP) #define WRITE_PIXEL __RFB_CONCAT2E(writeOpaque,CPIXEL) #define ZRLE_ENCODE __RFB_CONCAT2E(zrleEncode,CPIXEL) #define ZRLE_ENCODE_TILE __RFB_CONCAT2E(zrleEncodeTile,CPIXEL) #define BPPOUT 24 #else #define PIXEL_T __RFB_CONCAT2E(rdr::U,BPP) #define WRITE_PIXEL __RFB_CONCAT2E(writeOpaque,BPP) #define ZRLE_ENCODE __RFB_CONCAT2E(zrleEncode,BPP) #define ZRLE_ENCODE_TILE __RFB_CONCAT2E(zrleEncodeTile,BPP) #define BPPOUT BPP #endif #ifndef ZRLE_ONCE #define ZRLE_ONCE static const int bitsPerPackedPixel[] = { 0, 1, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }; // The PaletteHelper class helps us build up the palette from pixel data by // storing a reverse index using a simple hash-table class PaletteHelper { public: enum { MAX_SIZE = 127 }; PaletteHelper() { memset(index, 255, sizeof(index)); size = 0; } inline int hash(rdr::U32 pix) { return (pix ^ (pix >> 17)) & 4095; } inline void insert(rdr::U32 pix) { if (size < MAX_SIZE) { int i = hash(pix); while (index[i] != 255 && key[i] != pix) i++; if (index[i] != 255) return; index[i] = size; key[i] = pix; palette[size] = pix; } size++; } inline int lookup(rdr::U32 pix) { assert(size <= MAX_SIZE); int i = hash(pix); while (index[i] != 255 && key[i] != pix) i++; if (index[i] != 255) return index[i]; return -1; } rdr::U32 palette[MAX_SIZE]; rdr::U8 index[4096+MAX_SIZE]; rdr::U32 key[4096+MAX_SIZE]; int size; }; #endif void ZRLE_ENCODE_TILE (PIXEL_T* data, int w, int h, rdr::OutStream* os); void ZRLE_ENCODE (int x, int y, int w, int h, rdr::OutStream* os, rdr::ZlibOutStream* zos, void* buf EXTRA_ARGS ) { zos->setUnderlying(os); for (int ty = y; ty < y+h; ty += rfbZRLETileHeight) { int th = rfbZRLETileHeight; if (th > y+h-ty) th = y+h-ty; for (int tx = x; tx < x+w; tx += rfbZRLETileWidth) { int tw = rfbZRLETileWidth; if (tw > x+w-tx) tw = x+w-tx; GET_IMAGE_INTO_BUF(tx,ty,tw,th,buf); ZRLE_ENCODE_TILE((PIXEL_T*)buf, tw, th, zos); } } zos->flush(); } void ZRLE_ENCODE_TILE (PIXEL_T* data, int w, int h, rdr::OutStream* os) { // First find the palette and the number of runs PaletteHelper ph; int runs = 0; int singlePixels = 0; PIXEL_T* ptr = data; PIXEL_T* end = ptr + h * w; *end = ~*(end-1); // one past the end is different so the while loop ends while (ptr < end) { PIXEL_T pix = *ptr; if (*++ptr != pix) { singlePixels++; } else { while (*++ptr == pix) ; runs++; } ph.insert(pix); } //fprintf(stderr,"runs %d, single pixels %d, paletteSize %d\n", // runs, singlePixels, ph.size); // Solid tile is a special case if (ph.size == 1) { os->writeU8(1); os->WRITE_PIXEL(ph.palette[0]); return; } // Try to work out whether to use RLE and/or a palette. We do this by // estimating the number of bytes which will be generated and picking the // method which results in the fewest bytes. Of course this may not result // in the fewest bytes after compression... bool useRle = false; bool usePalette = false; int estimatedBytes = w * h * (BPPOUT/8); // start assuming raw int plainRleBytes = ((BPPOUT/8)+1) * (runs + singlePixels); if (plainRleBytes < estimatedBytes) { useRle = true; estimatedBytes = plainRleBytes; } if (ph.size < 128) { int paletteRleBytes = (BPPOUT/8) * ph.size + 2 * runs + singlePixels; if (paletteRleBytes < estimatedBytes) { useRle = true; usePalette = true; estimatedBytes = paletteRleBytes; } if (ph.size < 17) { int packedBytes = ((BPPOUT/8) * ph.size + w * h * bitsPerPackedPixel[ph.size-1] / 8); if (packedBytes < estimatedBytes) { useRle = false; usePalette = true; estimatedBytes = packedBytes; } } } if (!usePalette) ph.size = 0; os->writeU8((useRle ? 128 : 0) | ph.size); for (int i = 0; i < ph.size; i++) { os->WRITE_PIXEL(ph.palette[i]); } if (useRle) { PIXEL_T* ptr = data; PIXEL_T* end = ptr + w * h; PIXEL_T* runStart; PIXEL_T pix; while (ptr < end) { runStart = ptr; pix = *ptr++; while (*ptr == pix && ptr < end) ptr++; ssize_t len = ptr - runStart; if (len <= 2 && usePalette) { int index = ph.lookup(pix); if (len == 2) os->writeU8(index); os->writeU8(index); continue; } if (usePalette) { int index = ph.lookup(pix); os->writeU8(index | 128); } else { os->WRITE_PIXEL(pix); } len -= 1; while (len >= 255) { os->writeU8(255); len -= 255; } os->writeU8(len); } } else { // no RLE if (usePalette) { // packed pixels assert (ph.size < 17); int bppp = bitsPerPackedPixel[ph.size-1]; PIXEL_T* ptr = data; for (int i = 0; i < h; i++) { U8 nbits = 0; U8 byte = 0; PIXEL_T* eol = ptr + w; while (ptr < eol) { PIXEL_T pix = *ptr++; U8 index = ph.lookup(pix); byte = (byte << bppp) | index; nbits += bppp; if (nbits >= 8) { os->writeU8(byte); nbits = 0; } } if (nbits > 0) { byte <<= 8 - nbits; os->writeU8(byte); } } } else { // raw #ifdef CPIXEL for (PIXEL_T* ptr = data; ptr < data+w*h; ptr++) { os->WRITE_PIXEL(*ptr); } #else os->writeBytes(data, w*h*(BPP/8)); #endif } } } #undef PIXEL_T #undef WRITE_PIXEL #undef ZRLE_ENCODE #undef ZRLE_ENCODE_TILE #undef BPPOUT ================================================ FILE: OSXvnc.html ================================================ OSXvnc FAQ

 

OSXvnc icon

OSXvnc 1.71

Frequently Asked Questions

(Last Modified: 26 January 2006)

OSXvnc is provided by Redstone Software for use with Eggplant: The solution for cross-platform automation and testing
For the latest information on OSXvnc, including the latest FAQ, please visit:
http://www.redstonesoftware.com/osxvnc

For additional information not covered in this FAQ please visit: http://faq.gotomyvnc.com

Q: What is VNC?

A: VNC stands for Virtual Network Computing. It is remote control software which allows you to view and interact with one computer (the "server") using a simple program (the "viewer") on another computer anywhere on the Internet. The two computers don't even have to be the same type, so for example you can use VNC to view and control a MacOS X machine at home on your Windows machine at the office. VNC is freely and publicly available and is in widespread active use by millions.

Q: What is Eggplant? Why does Redstone Software provide OSXvnc?

A: If you've ever thought that it would be convenient to generate scripts that could interact with a remote VNC machine through the interface exactly the way a user can - then that's what Eggplant is! It's a powerful tool for cross-platform automation and testing. If you are interested in learning more about it, please visit Redstone Software.

Q: OSXvnc only contains a server, where's the client to connect to my machine?

A: That's right - OSXvnc is only a server. There are a number of VNC Clients available for OS X, we recommend these:
Chicken Of The VNC
VNCDimension
VNCThing (also supports MacOS 8/9)

Q: OSXvnc is running but I can't connect to it/How do I configure my Firewall to allow OSXvnc?

A: If you don't see anything in the OSXvnc log then your network isn't allowing the connection. The most likely cause of this is that your MaxOS X machine is running the built-in firewall. You can configure the firewall to allow port 5900 (or whichever port VNC is running on). Using the System Preferences application go to Sharing and then Firewall. On that panel, "Add.." another service for port 5900 and call it VNC

Q: How can I connect to my home machine from outside my home/across the internet?

A: First, if your machine is behind a device that does NAT like a Firewall, Router or Cable/DSL modem then please read the following FAQ. If not, then you need to get the IP address of your computer. It will be shown in the System Preferences application under Network and will consist of four numbers with dots between them. In your VNC client just use this number to connect to your computer from an external network. You can also go to this handy link from the machine running OSXvnc to verify the IP address: http://www.gotomyvnc.com

Q: How can I connect to a machine that is behind a Cable/DSL Modem or NAT Firewall?

A: When working through a network address translation (NAT) device like a Cable/DSL Modem, Router, or Firewall you will need to setup "Port Forwarding" on the device to forward the VNC port (5900 by default) from that device to the internal IP address of the machine running OSXvnc (the internal IP will look like 192.168.X.X, 10.X.X.X, or 127.0.0.X). For further details on setting up port forwarding please read your device's documentation or refer to the following helpful website: http://www.portforward.com.

Not all devices offer port forwarding, for those that do not, you can set your Mac to be the designated DMZ host for the NAT but this has the effect of forwarding ALL ports from the internet to your Macintosh. If you need to go this route we highly recommend you enable the Firewall on your MacOS X machine and ONLY allow port 5900 to pass through.

Once the port for VNC has been directed toward your Macintosh you should be able to connect via an external VNC client to your Network's External (or WAN) IP address. This number will be substantially different from the internal IP of your computer and can usually be found by looking at the modem configuration information or else by visiting this handy page from the machine running OSXvnc to get your IP and check your VNC access: http://www.gotomyvnc.com

Q: Can I setup OSXvnc to allow a remote user to work in his own desktop without disrupting the user at the machine(like X-Windows)?

A: Yes, if you are using MacOS 10.4 (TIGER). Please read this separate guide on Multiple Desktop Sessions on MacOS 10.4 - TIGER.

Q: Why am I getting an "Incompatible Version" error message when I attempt to connect to OSXvnc?

A: The problem is that you aren't connecting to OSXvnc but instead are connecting to the Apple Remote Desktop agent, which also runs on port 5900.

We recommend that you disable ARD by unchecking it in the System Preferences -> Sharing -> Services panel. Alternatively, you can connect to OSXvnc on a different port. It is probably running on port 5901 if it found a conflict on port 5900.

Q: The OSXvnc application launches fine the first time but after that it just bounces in the Dock and never launches?

A: This is most likely because you are running APE from unsanity.org. In some situations APE can corrupt the OSXvnc bundle to the point where it can no longer function. Try adding the OSXvnc application to the "exclude" list in the Ape Manager preference pane and re-installing OSXvnc. If that does not solve your problem please contact support at urgent@unsanity.org.

Q: When I start OSXvnc it stops immediately with the error: "Unable to Bind Socket"?

A: This means that OSXvnc can't listen on the specified port, this is almost always because another VNC is already listening, often because OSXvnc has already been set as a startup item. You can check to see with the following Terminal command:
ps -auxwww | grep -i '[v]nc'
If this reports anything then vnc is probably already running, if it's another instance of OSXvnc read the FAQ "I've setup OSXvnc as a Startup item, how can I turn it off" for instructions on how to stop it.
Keep in mind that if you are running Apple Remote Desktop 2.0 that it WILL use port 5900 and prevent OSXvnc from using that port, please choose a different port for OSXvnc.

Q: I am using an International keyboard (or keyboard layout) and the characters don't come up appropriately.

A: Currently OSXvnc doesn't handle this as well as we would like. Part of the problem is that if both the remote and local users are using an international keyboard layout the keystrokes actually get double-corrected, thus producing the standard US keys. Try setting one of the keyboards back to US; this works a bit better.

Q: How do I uninstall OSXvnc?

A: Normally you can just move the entire OSXvnc application into your trash.
However, if you've configured OSXvnc as a Startup Item (so that it launches at boot time) we recommend that you use the "Disable Startup Item" button on the Startup Tab for OSXvnc first. Alternatively, you can remove the /Library/StartupItems/OSXvnc folder in addition to the OSXvnc application and then reboot.

Q: I'm connecting to a system using VNC and it's not very fast, how can I improve the refresh rate/performance of OSXvnc?

A: One thing you can do is look at your selected encoding, you don't always want to choose the strongest one, it takes more CPU time on the VNC server and VNC client machine. We've found that for a LAN you are actually better off with Hextile, Zlib (Raw) or Zlib (Hextile) than the stronger compressions ZRLE and Tight (which are better over low bandwidth). This can very based on your machines as well, if they are G5's go ahead with the stronger encodings. G3's are very slow machines at this point for both clients and servers and so VNC is pretty slow on these no matter what you do, in a LAN environment you might even consider going with RAW (no encoding) for these machines.

Also, keep in mind that MacOS X uses a LOT of colors, more than some operating systems, there is shading and coloring going on in places you wouldn't even notice, but it's there. As just an example, if you have font smoothing set for a flat panel monitor your "Black" letters actually have red on one side and blue on the other(illustrated here), this is much harder on VNC than just two pixel colors. You can improve this by launching System Preferences, going to the "Appearance" tab and setting your font smoothing to Standard.

Another factor which many people ignore is the desktop background, Apple ships with a number of lovely backgrounds but they have millions of colors, so each time your desktop is exposed VNC has to resend that part of the intensive image. Instead set your background to the monotone white, grey or black, which is fast for VNC to send.

Q: I've configured OSXvnc as a Startup using the latest 10.4 TIGER and it isn't starting up?

A: It's a permissions problem that is addressed in version 1.5 of OSXvnc. We rcommend updating to the latest OSXvnc.

Q: How can I start up OSXvnc from a command line?

A: To startup OSXvnc from command line, go inside the Application directory(OSXvnc.app) and launch the OSXvnc-server process.  To change parameters you will need to give it arguments (-rfbport to set port, -vncauth to specify a password file, etc).  For usage run the command with -help. For example:
/Applications/OSXvnc.app/osxvnc-server -rfbport 5901

Q: I'm using 10.3 (Panther) and when I do a Fast User Switch I'm no longer able to control the remote machine.

A: This is a known bug in Apple's control API. It was probably designed with security in mind and attempts to work past it by allowing authentication, etc have not been successful. We hope to discuss this problem with Apple and have a good solution in the future. In the meantime, you must switch back to the original user or else launch a new server, perhaps via command line, to connect to.

Q: What encodings does OSXvnc support?

A: As far as we are aware OSXvnc supports all known encodings for VNC except ULTRA. This includes Raw, RRE, CoRRE, Hextile, Zlib (Full), Zlib (Hextile), ZRLE, and Tight (with optional JPEG). If you have a problem with any of these encodings or know of other encodings that we should support please send us an email.

Q: OSXvnc is only for MacOS X, what about MacOS 9?

A: For a MacOS 9 VNC client please use, VNCThing.
For a MacOS 9 VNC server Redstone Software also offers OS9vnc, it can be downloaded here:
http://www.redstonesoftware.com/Download/OS9vnc.sit
NOTE: At this time closing the OS9vnc log window will shutdown the server - please leave the log window running.

Q: When trying to launch OSXvnc command line it fails with the error "kCGErrorIllegalArgument : initCGDisplayState: cannot map display interlocks" (MacOS 10.1 and 10.2) or it fails with the error "kCGErrorRangeCheck : Window Server communications from outside of session allowed for root and console user only" (MacOS 10.3 and MacOS 10.4).

A: This happens if you try to launch as an unprivileged user. A privileged user is either the user who is currently logged into the GUI or the ROOT user. Try launching the server using the sudo command (or configuring the application to autostart using the system startup item).

Q: How can I connect to OSXvnc using a web browser?
Q: Is there a Web Server with OSXvnc or a Java applet integrated into OSXvnc?

A: The way this works is that you connect to a webserver which then serves the Java Applet to your browser, allowing you to connect without a stand-alone client. This isn't available directly within OSXvnc. Instead you can perform the following steps:

  1. Downloading a VNC Client Java applet. We didn't port the Java applet, but a copy of it can be downloaded here.
  2. Put that directory it in your user's "Sites" directory.
  3. Note: You may need to modify the vncjava/index.html file to match the port number and other configurable settings.
  4. Enable web serving on your machine (System Preferences->Sharing, check "Personal Web Sharing").
  5. Access the Java applet using a URL like http://MACHINE'S_IP/~USERNAME/vncjava/

Q: I'm using x2vnc or win2vnc and it seems slow. Is there a way to run OSXvnc without the slowdown from having the screen updates sent?

A: Version 1.61 and above should be better with *2vnc type clients. We also highly recommend using Broadband Optimizer to optimize your network traffic.
Additionally, we have had good luck running OSXvnc with osx2x running against OSXvnc 1.5 on a 10.3 machine.

Q: How can I have my connection to OSXvnc tunnel through SSH?

A: Since MacOS X ships with SSH support built in this is pretty easy.  First you will want to make sure your VNC machine has SSH running. You can turn this on in the System Preferences -> Sharing Panel by checking the box for "Remote Login".  Then you need an SSH client on the machine you want to connect from (again, it's there by default on MacOS X). For the rest of the instructions read the VNC page http://www.cl.cam.ac.uk/Research/DTG/attarchive/vnc/sshvnc.html.
If you use the "-localhost" option in OSXvnc you will need to literally specify "127.0.0.1" when you make your ssh port forwarding call, like this example:
ssh -L 5905:127.0.0.1:5900 mydomain.com
NOTE: In MacOS 10.3 (Panther) and above localhost is defined as it's IPv6 version - this doesn't work for VNC so specify 127.0.0.1

Q: Does OSXvnc support multiple displays?

A: Officially OSXvnc does not support multiple monitors at this time, it is on our list of future enhancements.
We do have a BETA feature for view only on displays besides the primary display. This feature is available only from command line. If you launch OSXvnc with the arguments
"-disableRemoteEvents -display" #displayNumber#
then that VNC server will serve the display associated with that number, starting at 0 for the primary display. Unfortunately you must disable events because the event translation logic has not yet been added.

Q: I'm running a headless MacOS X machine and OSXvnc doesn't work.

A: When MacOS X starts up on older systems it will disable certain video functions when no monitor is plugged in. We are looking at ways to solve this in OSXvnc, but for the time being you can purchase a dongle that makes the MacOS X machine think that a monitor is plugged in.  
Dr Bott has one called gHEAD available here.

Q: How can I setup OSXvnc as a boot-time Startup Itme without needing a user logged in?

A: OSXvnc 1.3 and above can setup this mode for you. Please go to the "Startup" panel and press the "Setup Startup Item" button. You will need to authenticate as a user with privilege to administer the machine. Once you have, OSXvnc will set itself to start up the next time your machine boots. In this mode you don't need to launch the GUI application, the server will be running all the time.
If you want to do it by hand you will need to copy the OSXvnc.app/Contents/Resources/OSXvnc folder into /Library/StartupItems and then modify the OSXvnc file by hand.
NOTE: Due to Apple security restrictions VNC clients will NOT have access to the pasteboard (Cut&Paste) of the MacOS X machine.

Q: I've setup OSXvnc as a Startup item, how can I turn it off?

A: Starting with 1.32 the GUI can do this for you on the Startup tab. If you want to turn it off temporarily but have it continue to startup then you want to issue the following command:
sudo /Library/StartupItems/OSXvnc/OSXvnc stop
If you want to stop OSXvnc from starting up automatically any longer you can also remove the startup directory. This command will do that:
sudo rm -rf /Library/StartupItems/OSXvnc

Q: Where are the storepasswd and OSXvnc-server executables?

A: The OSXvnc-server and storepasswd executables are now stored in the /Contents/MacOS directory. This prevents the GUI from launching a second dock icon when they are executed.

Q: I've set up OSXvnc as a boot-time Startup Item but when a user logs out it breaks the server.

A: This should be fixed with the 1.11 version of the startup script so that at least the server restarts.  This is a workaround for a behavior in MacOS X that kills all user processes when a user logs out.

Q: OSXvnc is open source, so....where's the source?

A: Our source code is available at Sourceforge via CVS. Please try it at: http://sourceforge.net/projects/osxvnc.

Q: What are you looking at adding for future versions?

A: Outside of bugs fixes, on our list at the moment (in some rough approximation of order) are...

  • Adding an indicator when users are connected
  • Improving International Keyboard support
  • Adding support for Multiple Monitor Support
  • Improving Startup Item (System Prefs Pane, fixing Pasteboards, and the shutdown on logout thing)

Q: I'm a developer and would like to help with OSXvnc.

A: Great! Please send email to osxvnc@redstonesoftware.com.

================================================ FILE: OSXvnc.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 47; objects = { /* Begin PBXAggregateTarget section */ ABA30D3D15BEE7310001BAE5 /* Vine Server Package */ = { isa = PBXAggregateTarget; buildConfigurationList = ABA30D4215BEE7670001BAE5 /* Build configuration list for PBXAggregateTarget "Vine Server Package" */; buildPhases = ( ABA30D3C15BEE7310001BAE5 /* Build DMG */, ); dependencies = ( ABA30D4115BEE7490001BAE5 /* PBXTargetDependency */, ); name = "Vine Server Package"; productName = "Vine Server Package"; }; /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ 9199995B0B1135FF0099EA7A /* getMACAddress.c in Sources */ = {isa = PBXBuildFile; fileRef = 919999430B11348E0099EA7A /* getMACAddress.c */; }; AB25D81F08686B520065843D /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = F57BB467027E036F014B5D3F /* Credits.rtf */; }; AB25D82008686B520065843D /* Vine Server Release Notes.rtf in Resources */ = {isa = PBXBuildFile; fileRef = AB541C2907A0264F00B63668 /* Vine Server Release Notes.rtf */; }; AB25D82108686B520065843D /* Copying.rtf in Resources */ = {isa = PBXBuildFile; fileRef = AB541C3B07A0273500B63668 /* Copying.rtf */; }; AB25D82208686B520065843D /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = ABD7FE7E07AFF8B4004D0B81 /* Localizable.strings */; }; AB25D82608686B520065843D /* OSXvnc in Resources */ = {isa = PBXBuildFile; fileRef = ABCCC8B203D9C60A00A80117 /* OSXvnc */; }; AB25D82A08686B520065843D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; AB25D82B08686B520065843D /* VNCController.m in Sources */ = {isa = PBXBuildFile; fileRef = F5456A2802FAD08901A80117 /* VNCController.m */; }; AB25D82E08686B520065843D /* NSAuthorization.m in Sources */ = {isa = PBXBuildFile; fileRef = ABD8EC08058A0BD600C84739 /* NSAuthorization.m */; }; AB25D83008686B520065843D /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; AB25D83108686B520065843D /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ABEE28F804C8745B00A80117 /* Security.framework */; }; AB25D895086870420065843D /* auth.c in Sources */ = {isa = PBXBuildFile; fileRef = F538E01002F9812901A80186 /* auth.c */; }; AB25D896086870430065843D /* corre.c in Sources */ = {isa = PBXBuildFile; fileRef = F538E01302F9812901A80186 /* corre.c */; }; AB25D897086870430065843D /* cutpaste.c in Sources */ = {isa = PBXBuildFile; fileRef = F538E01402F9812901A80186 /* cutpaste.c */; }; AB25D898086870440065843D /* dimming.c in Sources */ = {isa = PBXBuildFile; fileRef = F538E01502F9812901A80186 /* dimming.c */; }; AB25D899086870460065843D /* VNCServer.m in Sources */ = {isa = PBXBuildFile; fileRef = F58DDDE8056A861001A8015E /* VNCServer.m */; }; AB25D89A086870490065843D /* mousecursor.c in Sources */ = {isa = PBXBuildFile; fileRef = F5C9A8F1038C6F5D01A80117 /* mousecursor.c */; }; AB25D89B0868704A0065843D /* hextile.c in Sources */ = {isa = PBXBuildFile; fileRef = F538E01602F9812901A80186 /* hextile.c */; }; AB25D89C0868704B0065843D /* kbdptr.c in Sources */ = {isa = PBXBuildFile; fileRef = F538E03502F9812901A80186 /* kbdptr.c */; }; AB25D89E0868704C0065843D /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = F538E10E02F9812C01A80186 /* main.c */; }; AB25D89F0868704C0065843D /* miregion.c in Sources */ = {isa = PBXBuildFile; fileRef = F538E11002F9812C01A80186 /* miregion.c */; }; AB25D8A00868704D0065843D /* rfbserver.c in Sources */ = {isa = PBXBuildFile; fileRef = F538E11502F9812C01A80186 /* rfbserver.c */; }; AB25D8A10868704E0065843D /* rre.c in Sources */ = {isa = PBXBuildFile; fileRef = F538E11602F9812C01A80186 /* rre.c */; }; AB25D8A20868704E0065843D /* sockets.c in Sources */ = {isa = PBXBuildFile; fileRef = F538E11702F9812C01A80186 /* sockets.c */; }; AB25D8A30868704F0065843D /* stats.c in Sources */ = {isa = PBXBuildFile; fileRef = F538E11802F9812C01A80186 /* stats.c */; }; AB25D8A5086870530065843D /* tight.c in Sources */ = {isa = PBXBuildFile; fileRef = F538E11D02F9812C01A80186 /* tight.c */; }; AB25D8A6086870540065843D /* translate.c in Sources */ = {isa = PBXBuildFile; fileRef = F538E11F02F9812C01A80186 /* translate.c */; }; AB25D8A7086870540065843D /* xalloc.c in Sources */ = {isa = PBXBuildFile; fileRef = F538E12002F9812C01A80186 /* xalloc.c */; }; AB25D8A8086870550065843D /* zlib.c in Sources */ = {isa = PBXBuildFile; fileRef = F538E12102F9812C01A80186 /* zlib.c */; }; AB25D8A9086870550065843D /* zlibhex.c in Sources */ = {isa = PBXBuildFile; fileRef = F538E12202F9812C01A80186 /* zlibhex.c */; }; AB25D8AA086870560065843D /* zrle.cc in Sources */ = {isa = PBXBuildFile; fileRef = F5C9B02C038DA64501A80117 /* zrle.cc */; }; AB25D8AC0868707C0065843D /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ABF191B704E447A400A80117 /* Carbon.framework */; }; AB25D9400868707E0065843D /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; AB25D992086877000065843D /* storepasswd.c in Sources */ = {isa = PBXBuildFile; fileRef = F538E11902F9812C01A80186 /* storepasswd.c */; }; AB25DA3B0868842E0065843D /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB25DA3A0868842E0065843D /* IOKit.framework */; }; AB25DA3D086884420065843D /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = AB25DA3C086884420065843D /* libz.dylib */; }; AB3E27F80AF947FB004AF567 /* Vine Server.pdf in Resources */ = {isa = PBXBuildFile; fileRef = AB3E27F70AF947FB004AF567 /* Vine Server.pdf */; }; AB82605A08689AC00010AB63 /* storepasswd in CopyFiles */ = {isa = PBXBuildFile; fileRef = AB82605708689AC00010AB63 /* storepasswd */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; AB82605E08689AC00010AB63 /* OSXvnc-server in CopyFiles */ = {isa = PBXBuildFile; fileRef = AB82605B08689AC00010AB63 /* OSXvnc-server */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; AB95E3EE0FD4AA3800D063EC /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB95E3ED0FD4AA3700D063EC /* OpenGL.framework */; }; ABA7B3D60948CB5D00CD7499 /* d3des.c in Sources */ = {isa = PBXBuildFile; fileRef = ABA7B3D10948CB5D00CD7499 /* d3des.c */; }; ABA7B3D70948CB5D00CD7499 /* vncauth.c in Sources */ = {isa = PBXBuildFile; fileRef = ABA7B3D30948CB5D00CD7499 /* vncauth.c */; }; ABA7B5150949EB7E00CD7499 /* d3des.c in Sources */ = {isa = PBXBuildFile; fileRef = ABA7B3D10948CB5D00CD7499 /* d3des.c */; }; ABA7B51F0949EBBC00CD7499 /* vncauth.c in Sources */ = {isa = PBXBuildFile; fileRef = ABA7B3D30948CB5D00CD7499 /* vncauth.c */; }; ABA7B53F094A05BE00CD7499 /* FdInStream.cxx in Sources */ = {isa = PBXBuildFile; fileRef = F5C9B030038DA99401A80117 /* FdInStream.cxx */; }; ABA7B540094A05BF00CD7499 /* FdOutStream.cxx in Sources */ = {isa = PBXBuildFile; fileRef = F5C9B032038DA99401A80117 /* FdOutStream.cxx */; }; ABA7B543094A05C700CD7499 /* InStream.cxx in Sources */ = {isa = PBXBuildFile; fileRef = F5C9B035038DA99401A80117 /* InStream.cxx */; }; ABA7B544094A05C900CD7499 /* NullOutStream.cxx in Sources */ = {isa = PBXBuildFile; fileRef = F5C9B03A038DA99401A80117 /* NullOutStream.cxx */; }; ABA7B547094A05DE00CD7499 /* ZlibInStream.cxx in Sources */ = {isa = PBXBuildFile; fileRef = F5C9B03F038DA99401A80117 /* ZlibInStream.cxx */; }; ABA7B548094A05DF00CD7499 /* ZlibOutStream.cxx in Sources */ = {isa = PBXBuildFile; fileRef = F5C9B041038DA99401A80117 /* ZlibOutStream.cxx */; }; ABA7B560094A080200CD7499 /* librdr.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ABA7B52D094A053000CD7499 /* librdr.a */; }; ABA7B6D0094A170E00CD7499 /* vncauth.c in Sources */ = {isa = PBXBuildFile; fileRef = ABA7B3D30948CB5D00CD7499 /* vncauth.c */; }; ABA7B6D6094A171A00CD7499 /* d3des.c in Sources */ = {isa = PBXBuildFile; fileRef = ABA7B3D10948CB5D00CD7499 /* d3des.c */; }; ABDBE34715BA2A9D00558229 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = ABDBE34515BA2A9D00558229 /* MainMenu.xib */; }; ABFC222C0AF08CBA00BCE727 /* VineServer.icns in Resources */ = {isa = PBXBuildFile; fileRef = ABFC222B0AF08CBA00BCE727 /* VineServer.icns */; }; CA00814E121CA18D008B29B7 /* FdInStream.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C9B031038DA99401A80117 /* FdInStream.h */; }; CA008151121CA1C5008B29B7 /* Exception.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C9B02F038DA99401A80117 /* Exception.h */; }; CA008152121CA1D8008B29B7 /* FdOutStream.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C9B033038DA99401A80117 /* FdOutStream.h */; }; CA008153121CA1E1008B29B7 /* FixedMemOutStream.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C9B034038DA99401A80117 /* FixedMemOutStream.h */; }; CA008154121CA1E8008B29B7 /* InStream.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C9B036038DA99401A80117 /* InStream.h */; }; CA008155121CA1F3008B29B7 /* MemInStream.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C9B038038DA99401A80117 /* MemInStream.h */; }; CA008156121CA1F7008B29B7 /* MemOutStream.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C9B039038DA99401A80117 /* MemOutStream.h */; }; CA008157121CA1FC008B29B7 /* NullOutStream.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C9B03B038DA99401A80117 /* NullOutStream.h */; }; CA008158121CA200008B29B7 /* OutStream.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C9B03C038DA99401A80117 /* OutStream.h */; }; CA008159121CA204008B29B7 /* types.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C9B03E038DA99401A80117 /* types.h */; }; CA00815A121CA207008B29B7 /* ZlibInStream.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C9B040038DA99401A80117 /* ZlibInStream.h */; }; CA00815B121CA20A008B29B7 /* ZlibOutStream.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C9B042038DA99401A80117 /* ZlibOutStream.h */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ AB25DA5C08688EE80065843D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */; proxyType = 1; remoteGlobalIDString = AB25D98F086876B80065843D; remoteInfo = storepasswd; }; AB52324608689C02003F66AC /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */; proxyType = 1; remoteGlobalIDString = AB25D88E08686FC40065843D; remoteInfo = "OSXvnc-server"; }; ABA30D4015BEE7490001BAE5 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */; proxyType = 1; remoteGlobalIDString = AB25D81508686B520065843D; remoteInfo = "Vine Server"; }; ABA7B55A094A07AE00CD7499 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */; proxyType = 1; remoteGlobalIDString = ABA7B52C094A053000CD7499; remoteInfo = rdr; }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ AB25D83208686B520065843D /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 12; dstPath = ""; dstSubfolderSpec = 6; files = ( AB82605A08689AC00010AB63 /* storepasswd in CopyFiles */, AB82605E08689AC00010AB63 /* OSXvnc-server in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ 096B69DC0097995A7F000001 /* OSXvnc.html */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.html; path = OSXvnc.html; sourceTree = ""; }; 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 919999420B11348C0099EA7A /* getMACAddress.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = getMACAddress.h; sourceTree = ""; }; 919999430B11348E0099EA7A /* getMACAddress.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 30; path = getMACAddress.c; sourceTree = ""; }; AB25D83708686B520065843D /* VineServer-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "VineServer-Info.plist"; sourceTree = ""; }; AB25D83808686B520065843D /* Vine Server.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Vine Server.app"; sourceTree = BUILT_PRODUCTS_DIR; }; AB25DA3A0868842E0065843D /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = ""; }; AB25DA3C086884420065843D /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = /usr/lib/libz.dylib; sourceTree = ""; }; AB3E27F70AF947FB004AF567 /* Vine Server.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "Vine Server.pdf"; sourceTree = ""; }; AB41881F04C5986E00A80117 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = ""; }; AB82605708689AC00010AB63 /* storepasswd */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = storepasswd; sourceTree = BUILT_PRODUCTS_DIR; }; AB82605B08689AC00010AB63 /* OSXvnc-server */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "OSXvnc-server"; sourceTree = BUILT_PRODUCTS_DIR; }; AB82E81904FA629800A80117 /* kbdptr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kbdptr.h; sourceTree = ""; }; AB82E81D04FA6D0A00A80117 /* rfbserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rfbserver.h; sourceTree = ""; }; AB83C53A12724F8B0096F6A7 /* Version.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Version.txt; sourceTree = ""; }; AB95E3650FD497F600D063EC /* screencapture.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = screencapture.c; sourceTree = ""; }; AB95E3B20FD4A68800D063EC /* screencapture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = screencapture.h; sourceTree = ""; }; AB95E3ED0FD4AA3700D063EC /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; ABA7B3D10948CB5D00CD7499 /* d3des.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = d3des.c; sourceTree = ""; }; ABA7B3D20948CB5D00CD7499 /* d3des.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = d3des.h; sourceTree = ""; }; ABA7B3D30948CB5D00CD7499 /* vncauth.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = vncauth.c; sourceTree = ""; }; ABA7B3D40948CB5D00CD7499 /* vncauth.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = vncauth.h; sourceTree = ""; }; ABA7B3D50948CB5D00CD7499 /* zrleEncode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = zrleEncode.h; sourceTree = ""; }; ABA7B52D094A053000CD7499 /* librdr.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = librdr.a; sourceTree = BUILT_PRODUCTS_DIR; }; ABCCC8B203D9C60A00A80117 /* OSXvnc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = folder; path = OSXvnc; sourceTree = ""; }; ABD8EC07058A0BD600C84739 /* NSAuthorization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSAuthorization.h; sourceTree = ""; }; ABD8EC08058A0BD600C84739 /* NSAuthorization.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSAuthorization.m; sourceTree = ""; }; ABEE28F804C8745B00A80117 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = /System/Library/Frameworks/Security.framework; sourceTree = ""; }; ABF191B704E447A400A80117 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; ABFC222B0AF08CBA00BCE727 /* VineServer.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = VineServer.icns; sourceTree = ""; }; F538E01002F9812901A80186 /* auth.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 30; path = auth.c; sourceTree = ""; }; F538E01302F9812901A80186 /* corre.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = corre.c; sourceTree = ""; }; F538E01402F9812901A80186 /* cutpaste.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 30; path = cutpaste.c; sourceTree = ""; }; F538E01502F9812901A80186 /* dimming.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = dimming.c; sourceTree = ""; }; F538E01602F9812901A80186 /* hextile.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.c; fileEncoding = 30; path = hextile.c; sourceTree = ""; }; F538E01902F9812901A80186 /* keysym.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = keysym.h; sourceTree = ""; }; F538E01A02F9812901A80186 /* keysymdef.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = keysymdef.h; sourceTree = ""; }; F538E01B02F9812901A80186 /* X.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = X.h; sourceTree = ""; }; F538E01C02F9812901A80186 /* Xalloca.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Xalloca.h; sourceTree = ""; }; F538E01D02F9812901A80186 /* Xfuncproto.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Xfuncproto.h; sourceTree = ""; }; F538E01E02F9812901A80186 /* Xfuncs.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Xfuncs.h; sourceTree = ""; }; F538E01F02F9812901A80186 /* Xmd.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Xmd.h; sourceTree = ""; }; F538E02002F9812901A80186 /* Xos.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Xos.h; sourceTree = ""; }; F538E02102F9812901A80186 /* Xosdefs.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Xosdefs.h; sourceTree = ""; }; F538E02202F9812901A80186 /* Xproto.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Xproto.h; sourceTree = ""; }; F538E02302F9812901A80186 /* Xprotostr.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Xprotostr.h; sourceTree = ""; }; F538E02502F9812901A80186 /* colormap.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = colormap.h; sourceTree = ""; }; F538E02602F9812901A80186 /* cursor.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cursor.h; sourceTree = ""; }; F538E02702F9812901A80186 /* dix.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = dix.h; sourceTree = ""; }; F538E02802F9812901A80186 /* gc.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = gc.h; sourceTree = ""; }; F538E02902F9812901A80186 /* input.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = input.h; sourceTree = ""; }; F538E02A02F9812901A80186 /* misc.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = misc.h; sourceTree = ""; }; F538E02B02F9812901A80186 /* miscstruct.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = miscstruct.h; sourceTree = ""; }; F538E02C02F9812901A80186 /* opaque.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = opaque.h; sourceTree = ""; }; F538E02D02F9812901A80186 /* os.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = os.h; sourceTree = ""; }; F538E02E02F9812901A80186 /* pixmap.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = pixmap.h; sourceTree = ""; }; F538E02F02F9812901A80186 /* region.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = region.h; sourceTree = ""; }; F538E03002F9812901A80186 /* regionstr.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = regionstr.h; sourceTree = ""; }; F538E03102F9812901A80186 /* screenint.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = screenint.h; sourceTree = ""; }; F538E03202F9812901A80186 /* scrnintstr.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = scrnintstr.h; sourceTree = ""; }; F538E03302F9812901A80186 /* validate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = validate.h; sourceTree = ""; }; F538E03402F9812901A80186 /* window.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = window.h; sourceTree = ""; }; F538E03502F9812901A80186 /* kbdptr.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 30; path = kbdptr.c; sourceTree = ""; }; F538E10E02F9812C01A80186 /* main.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 30; path = main.c; sourceTree = ""; }; F538E10F02F9812C01A80186 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; F538E11002F9812C01A80186 /* miregion.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = miregion.c; sourceTree = ""; }; F538E11302F9812C01A80186 /* rfb.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = rfb.h; sourceTree = ""; }; F538E11402F9812C01A80186 /* rfbproto.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = rfbproto.h; sourceTree = ""; }; F538E11502F9812C01A80186 /* rfbserver.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 30; lineEnding = 0; path = rfbserver.c; sourceTree = ""; }; F538E11602F9812C01A80186 /* rre.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = rre.c; sourceTree = ""; }; F538E11702F9812C01A80186 /* sockets.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = sockets.c; sourceTree = ""; }; F538E11802F9812C01A80186 /* stats.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = stats.c; sourceTree = ""; }; F538E11902F9812C01A80186 /* storepasswd.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = storepasswd.c; sourceTree = ""; }; F538E11A02F9812C01A80186 /* tableinitcmtemplate.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = tableinitcmtemplate.c; sourceTree = ""; }; F538E11B02F9812C01A80186 /* tableinittctemplate.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = tableinittctemplate.c; sourceTree = ""; }; F538E11C02F9812C01A80186 /* tabletranstemplate.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = tabletranstemplate.c; sourceTree = ""; }; F538E11D02F9812C01A80186 /* tight.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = tight.c; sourceTree = ""; }; F538E11F02F9812C01A80186 /* translate.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = translate.c; sourceTree = ""; }; F538E12002F9812C01A80186 /* xalloc.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = xalloc.c; sourceTree = ""; }; F538E12102F9812C01A80186 /* zlib.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = zlib.c; sourceTree = ""; }; F538E12202F9812C01A80186 /* zlibhex.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = zlibhex.c; sourceTree = ""; }; F5456A2802FAD08901A80117 /* VNCController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = VNCController.m; sourceTree = ""; }; F5456A2902FAD08901A80117 /* VNCController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = VNCController.h; sourceTree = ""; }; F54B48D8038C32FA01A80117 /* OSXvnc.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = OSXvnc.tiff; sourceTree = ""; }; F570ED1002F9DA7601A80186 /* OSXvnc.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = OSXvnc.icns; sourceTree = SOURCE_ROOT; }; F58DDDE7056A861001A8015E /* VNCServer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VNCServer.h; sourceTree = ""; }; F58DDDE8056A861001A8015E /* VNCServer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VNCServer.m; sourceTree = ""; }; F5C9A8F1038C6F5D01A80117 /* mousecursor.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = mousecursor.c; sourceTree = ""; }; F5C9A8F6038C74D301A80117 /* CGS.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CGS.h; sourceTree = ""; }; F5C9B02C038DA64501A80117 /* zrle.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = zrle.cc; sourceTree = ""; }; F5C9B02F038DA99401A80117 /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Exception.h; sourceTree = ""; }; F5C9B030038DA99401A80117 /* FdInStream.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FdInStream.cxx; sourceTree = ""; }; F5C9B031038DA99401A80117 /* FdInStream.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FdInStream.h; sourceTree = ""; }; F5C9B032038DA99401A80117 /* FdOutStream.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FdOutStream.cxx; sourceTree = ""; }; F5C9B033038DA99401A80117 /* FdOutStream.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FdOutStream.h; sourceTree = ""; }; F5C9B034038DA99401A80117 /* FixedMemOutStream.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FixedMemOutStream.h; sourceTree = ""; }; F5C9B035038DA99401A80117 /* InStream.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = InStream.cxx; sourceTree = ""; }; F5C9B036038DA99401A80117 /* InStream.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = InStream.h; sourceTree = ""; }; F5C9B038038DA99401A80117 /* MemInStream.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MemInStream.h; sourceTree = ""; }; F5C9B039038DA99401A80117 /* MemOutStream.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MemOutStream.h; sourceTree = ""; }; F5C9B03A038DA99401A80117 /* NullOutStream.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = NullOutStream.cxx; sourceTree = ""; }; F5C9B03B038DA99401A80117 /* NullOutStream.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NullOutStream.h; sourceTree = ""; }; F5C9B03C038DA99401A80117 /* OutStream.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = OutStream.h; sourceTree = ""; }; F5C9B03E038DA99401A80117 /* types.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = types.h; sourceTree = ""; }; F5C9B03F038DA99401A80117 /* ZlibInStream.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ZlibInStream.cxx; sourceTree = ""; }; F5C9B040038DA99401A80117 /* ZlibInStream.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ZlibInStream.h; sourceTree = ""; }; F5C9B041038DA99401A80117 /* ZlibOutStream.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ZlibOutStream.cxx; sourceTree = ""; }; F5C9B042038DA99401A80117 /* ZlibOutStream.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ZlibOutStream.h; sourceTree = ""; }; F5F3A78903B395AA01A80117 /* OSXvnc.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = OSXvnc.jpg; sourceTree = ""; }; F89837A525B78CE3003BFE25 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = fr; path = fr.lproj/Copying.rtf; sourceTree = ""; }; F89837A625B78CE3003BFE25 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = ""; }; F89837A825B78CFB003BFE25 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Copying.rtf; sourceTree = ""; }; F89837A925B78CFB003BFE25 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = ""; }; F89837AA25B78CFB003BFE25 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; F89837AB25B78CFB003BFE25 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = "en.lproj/Vine Server Release Notes.rtf"; sourceTree = ""; }; F89837AC25B78D00003BFE25 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = de; path = de.lproj/Copying.rtf; sourceTree = ""; }; F89837AD25B78D00003BFE25 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = ""; }; F89837AE25B78D05003BFE25 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = ja; path = ja.lproj/Copying.rtf; sourceTree = ""; }; F89837AF25B78D05003BFE25 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Localizable.strings; sourceTree = ""; }; F89837B025B78D09003BFE25 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Localizable.strings; sourceTree = ""; }; F89837B125B78D15003BFE25 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ AB25D82F08686B520065843D /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( AB25D83008686B520065843D /* Cocoa.framework in Frameworks */, AB25D83108686B520065843D /* Security.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; AB25D88D08686FC40065843D /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( AB25D8AC0868707C0065843D /* Carbon.framework in Frameworks */, AB25D9400868707E0065843D /* Cocoa.framework in Frameworks */, AB25DA3B0868842E0065843D /* IOKit.framework in Frameworks */, AB95E3EE0FD4AA3800D063EC /* OpenGL.framework in Frameworks */, ABA7B560094A080200CD7499 /* librdr.a in Frameworks */, AB25DA3D086884420065843D /* libz.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 19C28FACFE9D520D11CA2CBB /* Products */ = { isa = PBXGroup; children = ( AB25D83808686B520065843D /* Vine Server.app */, AB82605708689AC00010AB63 /* storepasswd */, AB82605B08689AC00010AB63 /* OSXvnc-server */, ABA7B52D094A053000CD7499 /* librdr.a */, ); name = Products; sourceTree = ""; }; 29B97314FDCFA39411CA2CEA /* OSXvnc */ = { isa = PBXGroup; children = ( BCFF37981DEB1F6300D4F43D /* VineServer */, F538E00B02F9812901A80186 /* OSXvnc-server */, 29B97323FDCFA39411CA2CEA /* Frameworks */, 19C28FACFE9D520D11CA2CBB /* Products */, ); name = OSXvnc; sourceTree = ""; }; 29B97315FDCFA39411CA2CEA /* Other Sources */ = { isa = PBXGroup; children = ( 29B97316FDCFA39411CA2CEA /* main.m */, ); name = "Other Sources"; sourceTree = ""; }; 29B97317FDCFA39411CA2CEA /* Resources */ = { isa = PBXGroup; children = ( AB3E27F70AF947FB004AF567 /* Vine Server.pdf */, AB541C2907A0264F00B63668 /* Vine Server Release Notes.rtf */, 096B69DC0097995A7F000001 /* OSXvnc.html */, ABCCC8B203D9C60A00A80117 /* OSXvnc */, ABD7FE7E07AFF8B4004D0B81 /* Localizable.strings */, AB541C3B07A0273500B63668 /* Copying.rtf */, F57BB467027E036F014B5D3F /* Credits.rtf */, ABFC222B0AF08CBA00BCE727 /* VineServer.icns */, F5F3A78903B395AA01A80117 /* OSXvnc.jpg */, F570ED1002F9DA7601A80186 /* OSXvnc.icns */, F54B48D8038C32FA01A80117 /* OSXvnc.tiff */, AB83C53A12724F8B0096F6A7 /* Version.txt */, ); name = Resources; sourceTree = ""; }; 29B97323FDCFA39411CA2CEA /* Frameworks */ = { isa = PBXGroup; children = ( AB25DA3C086884420065843D /* libz.dylib */, AB25DA3A0868842E0065843D /* IOKit.framework */, ABF191B704E447A400A80117 /* Carbon.framework */, AB95E3ED0FD4AA3700D063EC /* OpenGL.framework */, 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, ABEE28F804C8745B00A80117 /* Security.framework */, AB41881F04C5986E00A80117 /* ApplicationServices.framework */, ); name = Frameworks; sourceTree = ""; }; BCFF37981DEB1F6300D4F43D /* VineServer */ = { isa = PBXGroup; children = ( 29B97315FDCFA39411CA2CEA /* Other Sources */, 29B97317FDCFA39411CA2CEA /* Resources */, ABDBE34515BA2A9D00558229 /* MainMenu.xib */, ABD8EC07058A0BD600C84739 /* NSAuthorization.h */, ABD8EC08058A0BD600C84739 /* NSAuthorization.m */, F5456A2902FAD08901A80117 /* VNCController.h */, F5456A2802FAD08901A80117 /* VNCController.m */, AB25D83708686B520065843D /* VineServer-Info.plist */, ); name = VineServer; sourceTree = ""; }; F538E00B02F9812901A80186 /* OSXvnc-server */ = { isa = PBXGroup; children = ( F538E10F02F9812C01A80186 /* Makefile */, F58DDDE7056A861001A8015E /* VNCServer.h */, F58DDDE8056A861001A8015E /* VNCServer.m */, ABA7B3D10948CB5D00CD7499 /* d3des.c */, ABA7B3D20948CB5D00CD7499 /* d3des.h */, ABA7B3D30948CB5D00CD7499 /* vncauth.c */, ABA7B3D40948CB5D00CD7499 /* vncauth.h */, F5C9A8F6038C74D301A80117 /* CGS.h */, F538E11302F9812C01A80186 /* rfb.h */, F538E11402F9812C01A80186 /* rfbproto.h */, F538E01002F9812901A80186 /* auth.c */, F538E01302F9812901A80186 /* corre.c */, 919999420B11348C0099EA7A /* getMACAddress.h */, 919999430B11348E0099EA7A /* getMACAddress.c */, F538E01402F9812901A80186 /* cutpaste.c */, F538E01502F9812901A80186 /* dimming.c */, F5C9A8F1038C6F5D01A80117 /* mousecursor.c */, F538E01602F9812901A80186 /* hextile.c */, AB82E81904FA629800A80117 /* kbdptr.h */, F538E03502F9812901A80186 /* kbdptr.c */, F538E10E02F9812C01A80186 /* main.c */, F538E11002F9812C01A80186 /* miregion.c */, AB82E81D04FA6D0A00A80117 /* rfbserver.h */, F538E11502F9812C01A80186 /* rfbserver.c */, F538E11602F9812C01A80186 /* rre.c */, AB95E3650FD497F600D063EC /* screencapture.c */, AB95E3B20FD4A68800D063EC /* screencapture.h */, F538E11702F9812C01A80186 /* sockets.c */, F538E11802F9812C01A80186 /* stats.c */, F538E11902F9812C01A80186 /* storepasswd.c */, F538E11A02F9812C01A80186 /* tableinitcmtemplate.c */, F538E11B02F9812C01A80186 /* tableinittctemplate.c */, F538E11C02F9812C01A80186 /* tabletranstemplate.c */, F538E11D02F9812C01A80186 /* tight.c */, F538E11F02F9812C01A80186 /* translate.c */, F538E12002F9812C01A80186 /* xalloc.c */, F538E12102F9812C01A80186 /* zlib.c */, F538E12202F9812C01A80186 /* zlibhex.c */, F5C9B02C038DA64501A80117 /* zrle.cc */, ABA7B3D50948CB5D00CD7499 /* zrleEncode.h */, F5C9B02E038DA99401A80117 /* rdr */, F538E01702F9812901A80186 /* include */, ); path = "OSXvnc-server"; sourceTree = ""; }; F538E01702F9812901A80186 /* include */ = { isa = PBXGroup; children = ( F538E01802F9812901A80186 /* X11 */, F538E02402F9812901A80186 /* Xserver */, ); path = include; sourceTree = ""; }; F538E01802F9812901A80186 /* X11 */ = { isa = PBXGroup; children = ( F538E01902F9812901A80186 /* keysym.h */, F538E01A02F9812901A80186 /* keysymdef.h */, F538E01B02F9812901A80186 /* X.h */, F538E01C02F9812901A80186 /* Xalloca.h */, F538E01D02F9812901A80186 /* Xfuncproto.h */, F538E01E02F9812901A80186 /* Xfuncs.h */, F538E01F02F9812901A80186 /* Xmd.h */, F538E02002F9812901A80186 /* Xos.h */, F538E02102F9812901A80186 /* Xosdefs.h */, F538E02202F9812901A80186 /* Xproto.h */, F538E02302F9812901A80186 /* Xprotostr.h */, ); path = X11; sourceTree = ""; }; F538E02402F9812901A80186 /* Xserver */ = { isa = PBXGroup; children = ( F538E02502F9812901A80186 /* colormap.h */, F538E02602F9812901A80186 /* cursor.h */, F538E02702F9812901A80186 /* dix.h */, F538E02802F9812901A80186 /* gc.h */, F538E02902F9812901A80186 /* input.h */, F538E02A02F9812901A80186 /* misc.h */, F538E02B02F9812901A80186 /* miscstruct.h */, F538E02C02F9812901A80186 /* opaque.h */, F538E02D02F9812901A80186 /* os.h */, F538E02E02F9812901A80186 /* pixmap.h */, F538E02F02F9812901A80186 /* region.h */, F538E03002F9812901A80186 /* regionstr.h */, F538E03102F9812901A80186 /* screenint.h */, F538E03202F9812901A80186 /* scrnintstr.h */, F538E03302F9812901A80186 /* validate.h */, F538E03402F9812901A80186 /* window.h */, ); path = Xserver; sourceTree = ""; }; F5C9B02E038DA99401A80117 /* rdr */ = { isa = PBXGroup; children = ( F5C9B02F038DA99401A80117 /* Exception.h */, F5C9B030038DA99401A80117 /* FdInStream.cxx */, F5C9B031038DA99401A80117 /* FdInStream.h */, F5C9B032038DA99401A80117 /* FdOutStream.cxx */, F5C9B033038DA99401A80117 /* FdOutStream.h */, F5C9B034038DA99401A80117 /* FixedMemOutStream.h */, F5C9B035038DA99401A80117 /* InStream.cxx */, F5C9B036038DA99401A80117 /* InStream.h */, F5C9B038038DA99401A80117 /* MemInStream.h */, F5C9B039038DA99401A80117 /* MemOutStream.h */, F5C9B03A038DA99401A80117 /* NullOutStream.cxx */, F5C9B03B038DA99401A80117 /* NullOutStream.h */, F5C9B03C038DA99401A80117 /* OutStream.h */, F5C9B03E038DA99401A80117 /* types.h */, F5C9B03F038DA99401A80117 /* ZlibInStream.cxx */, F5C9B040038DA99401A80117 /* ZlibInStream.h */, F5C9B041038DA99401A80117 /* ZlibOutStream.cxx */, F5C9B042038DA99401A80117 /* ZlibOutStream.h */, ); path = rdr; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ ABA7B529094A053000CD7499 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( CA008152121CA1D8008B29B7 /* FdOutStream.h in Headers */, CA008154121CA1E8008B29B7 /* InStream.h in Headers */, CA008158121CA200008B29B7 /* OutStream.h in Headers */, CA008159121CA204008B29B7 /* types.h in Headers */, CA008156121CA1F7008B29B7 /* MemOutStream.h in Headers */, CA00815A121CA207008B29B7 /* ZlibInStream.h in Headers */, CA00815B121CA20A008B29B7 /* ZlibOutStream.h in Headers */, CA008157121CA1FC008B29B7 /* NullOutStream.h in Headers */, CA008153121CA1E1008B29B7 /* FixedMemOutStream.h in Headers */, CA008155121CA1F3008B29B7 /* MemInStream.h in Headers */, CA008151121CA1C5008B29B7 /* Exception.h in Headers */, CA00814E121CA18D008B29B7 /* FdInStream.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ AB25D81508686B520065843D /* Vine Server */ = { isa = PBXNativeTarget; buildConfigurationList = ABECD3EA08E46414009C84A0 /* Build configuration list for PBXNativeTarget "Vine Server" */; buildPhases = ( AB25D81D08686B520065843D /* Resources */, AB25D82908686B520065843D /* Sources */, AB25D82F08686B520065843D /* Frameworks */, AB25D83208686B520065843D /* CopyFiles */, AB139E5C0CEA05C200EE873A /* Record our Version */, ); buildRules = ( ); dependencies = ( AB52324708689C02003F66AC /* PBXTargetDependency */, AB25DA5D08688EE80065843D /* PBXTargetDependency */, ); name = "Vine Server"; productInstallPath = /OSXvnc/; productName = OSXvnc; productReference = AB25D83808686B520065843D /* Vine Server.app */; productType = "com.apple.product-type.application"; }; AB25D88E08686FC40065843D /* OSXvnc-server */ = { isa = PBXNativeTarget; buildConfigurationList = ABECD3DE08E46414009C84A0 /* Build configuration list for PBXNativeTarget "OSXvnc-server" */; buildPhases = ( AB25D88C08686FC40065843D /* Sources */, AB25D88D08686FC40065843D /* Frameworks */, ); buildRules = ( ); dependencies = ( ABA7B55B094A07AE00CD7499 /* PBXTargetDependency */, ); name = "OSXvnc-server"; productName = "OSXvnc-server"; productReference = AB82605B08689AC00010AB63 /* OSXvnc-server */; productType = "com.apple.product-type.tool"; }; AB25D98F086876B80065843D /* storepasswd */ = { isa = PBXNativeTarget; buildConfigurationList = ABECD3E208E46414009C84A0 /* Build configuration list for PBXNativeTarget "storepasswd" */; buildPhases = ( AB25D98D086876B80065843D /* Sources */, ); buildRules = ( ); dependencies = ( ); name = storepasswd; productName = storepasswd; productReference = AB82605708689AC00010AB63 /* storepasswd */; productType = "com.apple.product-type.tool"; }; ABA7B52C094A053000CD7499 /* rdr */ = { isa = PBXNativeTarget; buildConfigurationList = ABA7B537094A054A00CD7499 /* Build configuration list for PBXNativeTarget "rdr" */; buildPhases = ( ABA7B529094A053000CD7499 /* Headers */, ABA7B52A094A053000CD7499 /* Sources */, ); buildRules = ( ); dependencies = ( ); name = rdr; productName = rdr; productReference = ABA7B52D094A053000CD7499 /* librdr.a */; productType = "com.apple.product-type.library.static"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 1230; }; buildConfigurationList = ABECD3EE08E46414009C84A0 /* Build configuration list for PBXProject "OSXvnc" */; compatibilityVersion = "Xcode 6.3"; developmentRegion = en; hasScannedForEncodings = 1; knownRegions = ( fr, en, de, ja, it, Base, ); mainGroup = 29B97314FDCFA39411CA2CEA /* OSXvnc */; projectDirPath = ""; projectRoot = ""; targets = ( ABA30D3D15BEE7310001BAE5 /* Vine Server Package */, AB25D81508686B520065843D /* Vine Server */, AB25D88E08686FC40065843D /* OSXvnc-server */, AB25D98F086876B80065843D /* storepasswd */, ABA7B52C094A053000CD7499 /* rdr */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ AB25D81D08686B520065843D /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( AB25D82108686B520065843D /* Copying.rtf in Resources */, AB25D81F08686B520065843D /* Credits.rtf in Resources */, AB25D82208686B520065843D /* Localizable.strings in Resources */, AB25D82008686B520065843D /* Vine Server Release Notes.rtf in Resources */, AB25D82608686B520065843D /* OSXvnc in Resources */, ABFC222C0AF08CBA00BCE727 /* VineServer.icns in Resources */, AB3E27F80AF947FB004AF567 /* Vine Server.pdf in Resources */, ABDBE34715BA2A9D00558229 /* MainMenu.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ AB139E5C0CEA05C200EE873A /* Record our Version */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); name = "Record our Version"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "#Write our current AGV version number into the Info.plist\ntypeset CURRENT_PRODUCT_VERSION=`cat Version.txt`\ntypeset CURRENT_BUILD_VERSION=`date +%y%m%d%H%M`\ntypeset CURRENT_YEAR=`date +%Y`\necho Version: $CURRENT_PRODUCT_VERSION Build Number: $CURRENT_BUILD_VERSION\npushd \"$TARGET_BUILD_DIR/$PRODUCT_NAME.$WRAPPER_EXTENSION/Contents\"\nsed -i \"\" s/__PRODUCT_VERSION__/$CURRENT_PRODUCT_VERSION/ ./Info.plist\nsed -i \"\" s/__BUILD_VERSION__/$CURRENT_BUILD_VERSION/ ./Info.plist\nsed -i \"\" s/__YEAR__/$CURRENT_YEAR/ ./Info.plist\npopd\n"; }; ABA30D3C15BEE7310001BAE5 /* Build DMG */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); name = "Build DMG"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "# Create a UDIF DMG\nset -e\nset -x\nPACKAGE_FOLDER=\"/tmp/VineServer\"\nrm -rf \"$PACKAGE_FOLDER\"\nmkdir -p \"$PACKAGE_FOLDER\"\ncp -r \"$BUILT_PRODUCTS_DIR/Vine Server.app\" \"$PACKAGE_FOLDER\"\nhdiutil create -fs HFS+ -ov -format UDZO -imagekey zlib-level=9 -srcfolder \"$PACKAGE_FOLDER\" \"/tmp/VineServer.dmg\""; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ AB25D82908686B520065843D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( AB25D82A08686B520065843D /* main.m in Sources */, AB25D82B08686B520065843D /* VNCController.m in Sources */, AB25D82E08686B520065843D /* NSAuthorization.m in Sources */, ABA7B6D0094A170E00CD7499 /* vncauth.c in Sources */, ABA7B6D6094A171A00CD7499 /* d3des.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; AB25D88C08686FC40065843D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( AB25D895086870420065843D /* auth.c in Sources */, AB25D896086870430065843D /* corre.c in Sources */, AB25D897086870430065843D /* cutpaste.c in Sources */, AB25D898086870440065843D /* dimming.c in Sources */, AB25D899086870460065843D /* VNCServer.m in Sources */, AB25D89A086870490065843D /* mousecursor.c in Sources */, AB25D89B0868704A0065843D /* hextile.c in Sources */, AB25D89C0868704B0065843D /* kbdptr.c in Sources */, AB25D89E0868704C0065843D /* main.c in Sources */, AB25D89F0868704C0065843D /* miregion.c in Sources */, AB25D8A00868704D0065843D /* rfbserver.c in Sources */, AB25D8A10868704E0065843D /* rre.c in Sources */, AB25D8A20868704E0065843D /* sockets.c in Sources */, AB25D8A30868704F0065843D /* stats.c in Sources */, AB25D8A5086870530065843D /* tight.c in Sources */, AB25D8A6086870540065843D /* translate.c in Sources */, AB25D8A7086870540065843D /* xalloc.c in Sources */, AB25D8A8086870550065843D /* zlib.c in Sources */, AB25D8A9086870550065843D /* zlibhex.c in Sources */, AB25D8AA086870560065843D /* zrle.cc in Sources */, ABA7B3D60948CB5D00CD7499 /* d3des.c in Sources */, ABA7B3D70948CB5D00CD7499 /* vncauth.c in Sources */, 9199995B0B1135FF0099EA7A /* getMACAddress.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; AB25D98D086876B80065843D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( AB25D992086877000065843D /* storepasswd.c in Sources */, ABA7B5150949EB7E00CD7499 /* d3des.c in Sources */, ABA7B51F0949EBBC00CD7499 /* vncauth.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; ABA7B52A094A053000CD7499 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( ABA7B53F094A05BE00CD7499 /* FdInStream.cxx in Sources */, ABA7B540094A05BF00CD7499 /* FdOutStream.cxx in Sources */, ABA7B543094A05C700CD7499 /* InStream.cxx in Sources */, ABA7B544094A05C900CD7499 /* NullOutStream.cxx in Sources */, ABA7B547094A05DE00CD7499 /* ZlibInStream.cxx in Sources */, ABA7B548094A05DF00CD7499 /* ZlibOutStream.cxx in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ AB25DA5D08688EE80065843D /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = AB25D98F086876B80065843D /* storepasswd */; targetProxy = AB25DA5C08688EE80065843D /* PBXContainerItemProxy */; }; AB52324708689C02003F66AC /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = AB25D88E08686FC40065843D /* OSXvnc-server */; targetProxy = AB52324608689C02003F66AC /* PBXContainerItemProxy */; }; ABA30D4115BEE7490001BAE5 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = AB25D81508686B520065843D /* Vine Server */; targetProxy = ABA30D4015BEE7490001BAE5 /* PBXContainerItemProxy */; }; ABA7B55B094A07AE00CD7499 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = ABA7B52C094A053000CD7499 /* rdr */; targetProxy = ABA7B55A094A07AE00CD7499 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ AB541C2907A0264F00B63668 /* Vine Server Release Notes.rtf */ = { isa = PBXVariantGroup; children = ( F89837AB25B78CFB003BFE25 /* en */, ); name = "Vine Server Release Notes.rtf"; sourceTree = ""; }; AB541C3B07A0273500B63668 /* Copying.rtf */ = { isa = PBXVariantGroup; children = ( F89837A525B78CE3003BFE25 /* fr */, F89837A825B78CFB003BFE25 /* en */, F89837AC25B78D00003BFE25 /* de */, F89837AE25B78D05003BFE25 /* ja */, ); name = Copying.rtf; sourceTree = ""; }; ABD7FE7E07AFF8B4004D0B81 /* Localizable.strings */ = { isa = PBXVariantGroup; children = ( F89837A625B78CE3003BFE25 /* fr */, F89837AA25B78CFB003BFE25 /* en */, F89837AD25B78D00003BFE25 /* de */, F89837AF25B78D05003BFE25 /* ja */, F89837B025B78D09003BFE25 /* it */, ); name = Localizable.strings; sourceTree = ""; }; ABDBE34515BA2A9D00558229 /* MainMenu.xib */ = { isa = PBXVariantGroup; children = ( F89837B125B78D15003BFE25 /* Base */, ); name = MainMenu.xib; sourceTree = ""; }; F57BB467027E036F014B5D3F /* Credits.rtf */ = { isa = PBXVariantGroup; children = ( F89837A925B78CFB003BFE25 /* en */, ); name = Credits.rtf; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ ABA30D3E15BEE7310001BAE5 /* Development */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_WEAK = YES; CODE_SIGN_IDENTITY = ""; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; PRODUCT_NAME = "Vine Server Package"; SDKROOT = macosx; }; name = Development; }; ABA30D3F15BEE7310001BAE5 /* Deployment */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_WEAK = YES; CODE_SIGN_IDENTITY = ""; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; PRODUCT_NAME = "Vine Server Package"; SDKROOT = macosx; }; name = Deployment; }; ABA7B538094A054A00CD7499 /* Development */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_WEAK = YES; COMBINE_HIDPI_IMAGES = YES; GCC_DYNAMIC_NO_PIC = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_INLINES_ARE_PRIVATE_EXTERN = YES; HEADER_SEARCH_PATHS = "osxvnc-server"; INSTALL_PATH = /usr/local/lib; PRODUCT_NAME = rdr; }; name = Development; }; ABA7B539094A054A00CD7499 /* Deployment */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_WEAK = YES; COMBINE_HIDPI_IMAGES = YES; CXX = "g++-3.3 "; DEPLOYMENT_POSTPROCESSING = NO; GCC_INPUT_FILETYPE = sourcecode.cpp.cpp; HEADER_SEARCH_PATHS = "osxvnc-server"; PRODUCT_NAME = rdr; SEPARATE_STRIP = NO; STRIP_INSTALLED_PRODUCT = NO; }; name = Deployment; }; ABECD3DF08E46414009C84A0 /* Development */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_WEAK = YES; CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; HEADER_SEARCH_PATHS = ( "OSXvnc-server", "OSXvnc-server/include", "libjpeg-turbo", ); LIBRARY_SEARCH_PATHS = ""; "OTHER_LDFLAGS[arch=arm64]" = ( "-sectcreate", __CGPreLoginApp, __cgpreloginapp, /dev/null, "libjpeg-turbo/macosarmv8/libturbojpeg.a", ); "OTHER_LDFLAGS[arch=x86_64]" = ( "-sectcreate", __CGPreLoginApp, __cgpreloginapp, /dev/null, "libjpeg-turbo/macosx8664/libturbojpeg.a", ); PRODUCT_NAME = "OSXvnc-server"; PROVISIONING_PROFILE = ""; }; name = Development; }; ABECD3E008E46414009C84A0 /* Deployment */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_WEAK = YES; CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; DEPLOYMENT_POSTPROCESSING = NO; GCC_OPTIMIZATION_LEVEL = 3; HEADER_SEARCH_PATHS = ( "OSXvnc-server", "OSXvnc-server/include", "libjpeg-turbo", ); LIBRARY_SEARCH_PATHS = ""; MACH_O_TYPE = mh_execute; "OTHER_LDFLAGS[arch=arm64]" = ( "-sectcreate", __CGPreLoginApp, __cgpreloginapp, /dev/null, "libjpeg-turbo/macosarmv8/libturbojpeg.a", ); "OTHER_LDFLAGS[arch=x86_64]" = ( "-sectcreate", __CGPreLoginApp, __cgpreloginapp, /dev/null, "libjpeg-turbo/macosx8664/libturbojpeg.a", ); PRODUCT_NAME = "OSXvnc-server"; PROVISIONING_PROFILE = ""; STRIP_INSTALLED_PRODUCT = NO; }; name = Deployment; }; ABECD3E308E46414009C84A0 /* Development */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_WEAK = YES; CODE_SIGN_IDENTITY = "-"; PRODUCT_NAME = storepasswd; PROVISIONING_PROFILE = ""; }; name = Development; }; ABECD3E408E46414009C84A0 /* Deployment */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_WEAK = YES; CODE_SIGN_IDENTITY = "-"; PRODUCT_NAME = storepasswd; PROVISIONING_PROFILE = ""; }; name = Deployment; }; ABECD3EB08E46414009C84A0 /* Development */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_WEAK = YES; CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; DSTROOT = ""; INFOPLIST_FILE = "VineServer-Info.plist"; INSTALL_PATH = ""; PRODUCT_BUNDLE_IDENTIFIER = "de.uni-mannheim.VineServer"; PRODUCT_NAME = "Vine Server"; PROVISIONING_PROFILE = ""; WRAPPER_EXTENSION = app; }; name = Development; }; ABECD3EC08E46414009C84A0 /* Deployment */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_WEAK = YES; CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; DEPLOYMENT_LOCATION = YES; DEPLOYMENT_POSTPROCESSING = YES; DSTROOT = ""; INFOPLIST_FILE = "VineServer-Info.plist"; INSTALL_PATH = ""; PRODUCT_BUNDLE_IDENTIFIER = "de.uni-mannheim.VineServer"; PRODUCT_NAME = "Vine Server"; PROVISIONING_PROFILE = ""; WRAPPER_EXTENSION = app; }; name = Deployment; }; ABECD3EF08E46414009C84A0 /* Development */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = ""; DSTROOT = ""; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; INSTALL_PATH = ""; MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)"; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; STRIP_INSTALLED_PRODUCT = NO; "USER_HEADER_SEARCH_PATHS[arch=*]" = ""; }; name = Development; }; ABECD3F008E46414009C84A0 /* Deployment */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = ""; DEPLOYMENT_POSTPROCESSING = YES; DSTROOT = ""; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; INSTALL_PATH = ""; MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)"; SDKROOT = macosx; STRIP_INSTALLED_PRODUCT = NO; "USER_HEADER_SEARCH_PATHS[arch=*]" = ""; }; name = Deployment; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ ABA30D4215BEE7670001BAE5 /* Build configuration list for PBXAggregateTarget "Vine Server Package" */ = { isa = XCConfigurationList; buildConfigurations = ( ABA30D3E15BEE7310001BAE5 /* Development */, ABA30D3F15BEE7310001BAE5 /* Deployment */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Deployment; }; ABA7B537094A054A00CD7499 /* Build configuration list for PBXNativeTarget "rdr" */ = { isa = XCConfigurationList; buildConfigurations = ( ABA7B538094A054A00CD7499 /* Development */, ABA7B539094A054A00CD7499 /* Deployment */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Deployment; }; ABECD3DE08E46414009C84A0 /* Build configuration list for PBXNativeTarget "OSXvnc-server" */ = { isa = XCConfigurationList; buildConfigurations = ( ABECD3DF08E46414009C84A0 /* Development */, ABECD3E008E46414009C84A0 /* Deployment */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Deployment; }; ABECD3E208E46414009C84A0 /* Build configuration list for PBXNativeTarget "storepasswd" */ = { isa = XCConfigurationList; buildConfigurations = ( ABECD3E308E46414009C84A0 /* Development */, ABECD3E408E46414009C84A0 /* Deployment */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Deployment; }; ABECD3EA08E46414009C84A0 /* Build configuration list for PBXNativeTarget "Vine Server" */ = { isa = XCConfigurationList; buildConfigurations = ( ABECD3EB08E46414009C84A0 /* Development */, ABECD3EC08E46414009C84A0 /* Deployment */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Deployment; }; ABECD3EE08E46414009C84A0 /* Build configuration list for PBXProject "OSXvnc" */ = { isa = XCConfigurationList; buildConfigurations = ( ABECD3EF08E46414009C84A0 /* Development */, ABECD3F008E46414009C84A0 /* Deployment */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Deployment; }; /* End XCConfigurationList section */ }; rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; } ================================================ FILE: README.md ================================================ [![Build Status](https://travis-ci.org/stweil/OSXvnc.svg?branch=master)](https://travis-ci.org/stweil/OSXvnc) Vine VNC Server (OSXvnc) ======================== The code in this Git repository is based on the CVS repository at http://osxvnc.cvs.sourceforge.net/viewvc/osxvnc/. It was created using this command: git cvsimport -d :pserver:anonymous@osxvnc.cvs.sourceforge.net:/cvsroot/osxvnc OSXvnc Vine was developed at Redstone Software which was acquired by TestPlant. This is a modified private copy of the original software. News ---- ### 2021-01-29 libjpeg-turbo is now included as a git submodule and built using local build rules. The build rules build now a universal app which supports both Intel and Arm64 Macs. ### 2017-12-15 libjpeg-turbo now is only needed for building. It is no longer required for running the server. The software license was updated from GPL 2 to GPL 3. ### 2016-11-20 Builds now require https://sourceforge.net/projects/libjpeg-turbo/ or a compatible libjpeg. ### 2015-10-10 Vine VNC server now also works with high resolution (retina) displays (thanks to Tom Sealy who wrote the new code). Building -------- Vine VNC server requires Xcode to build a distributable packet from sources. In addition, it uses the JPEG library [libjpeg-turbo](https://libjpeg-turbo.org/). The source code for that library is included as a Git submodule. ### Building from Xcode Build the libjpeg-turbo library first by running `./build-libjpeg-turbo.sh`. Then open `OSXvnc.xcodeproj` in Xcode and build the "Vine Server Package". You will find the distributable at /tmp/VineServer.dmg ### Building from the command line Run these commands from the command line: ./build-libjpeg-turbo.sh xcodebuild -configuration Deployment Again you will find the distributable at /tmp/VineServer.dmg License ------- This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see or the file LICENSE in the distribution. Links ----- CVS repository at Sourceforge: * http://osxvnc.cvs.sourceforge.net/viewvc/osxvnc/ Other Git clones of the CVS code: * https://github.com/aaronbrethorst/OSXVnc * https://github.com/browserstack/OSXVNC * https://github.com/eventials/OSXVnc * https://github.com/wingify/vnc Documentation at TestPlant.com: * http://docs.testplant.com/?q=content/installing-vnc-server RFB Standard: * https://tools.ietf.org/html/rfc6143 ================================================ FILE: VNCController.h ================================================ // // VNCController.h // OSXvnc // // Created by Jonathan Gillaspie on Fri Aug 02 2002. // Copyright (c) 2002 Redstone Software, Inc. All rights reserved. // #import #import "NSAuthorization.h" @interface VNCController : NSObject { IBOutlet NSMenuItem *startServerMenuItem; IBOutlet NSMenuItem *stopServerMenuItem; IBOutlet NSMenuItem *serverMenuItem; IBOutlet NSWindow *statusWindow; IBOutlet NSWindow *preferenceWindow; IBOutlet NSWindow *reverseConnectionWindow; // System Server UI IBOutlet NSMenuItem *systemServerMenu; IBOutlet NSWindow *systemServerWindow; IBOutlet NSTextField *systemServerDisplayNameField; IBOutlet NSPopUpButton *systemServerDisplayNumberField; IBOutlet NSTextField *systemServerPortField; IBOutlet NSMatrix *systemServerAuthenticationType; IBOutlet NSTextField *systemServerPasswordField; IBOutlet NSButton *systemServerLimitToLocalConnections; IBOutlet NSButton *disableStartupButton; IBOutlet NSButton *setStartupButton; IBOutlet NSTextField *startupItemStatusMessageField; // Control Panel IBOutlet NSBox *hostNamesBox; IBOutlet NSTextField *hostNamesField; IBOutlet NSBox *ipAddressesBox; IBOutlet NSMatrix *ipAddressesView; IBOutlet NSTextField *displayNumText; IBOutlet NSTextField *portNumText; IBOutlet NSTextView *statusMessageField; IBOutlet NSButton *startServerButton; IBOutlet NSButton *stopServerButton; // Preferences Interface IBOutlet NSTabView *optionsTabView; IBOutlet NSTextField *preferencesMessageTestField; // Connection IBOutlet NSTextField *displayNameField; IBOutlet NSPopUpButton *displayNumberField; IBOutlet NSTextField *portField; IBOutlet NSMatrix *authenticationType; IBOutlet NSTextField *passwordField; IBOutlet NSButton *limitToLocalConnections; // Device IBOutlet NSButton *allowSleepCheckbox; IBOutlet NSButton *allowDimmingCheckbox; IBOutlet NSButton *allowScreenSaverCheckbox; IBOutlet NSPopUpButton *keyboardLayout; IBOutlet NSButton *swapMouseButtonsCheckbox; // Advanced IBOutlet NSPopUpButton *protocolVersion; IBOutlet NSTextField *otherArguments; IBOutlet NSButton *openGLCheckbox; IBOutlet NSPopUpButton *keyboardEvents; IBOutlet NSPopUpButton *eventSourcePopup; // Sharing IBOutlet NSMatrix *sharingMatrix; IBOutlet NSButton *dontDisconnectCheckbox; IBOutlet NSButton *disableRemoteEventsCheckbox; IBOutlet NSButton *disableRichClipboardCheckbox; IBOutlet NSButton *allowRendezvousCheckbox; // Startup IBOutlet NSButton *startServerOnLaunchCheckbox; IBOutlet NSButton *terminateOnFastUserSwitch; IBOutlet NSButton *serverKeepAliveCheckbox; // Reverse Connections UI IBOutlet NSTextField *connectHost; IBOutlet NSTextField *connectPort; IBOutlet NSTextField *reverseConnectionMessageField; // Initial Settings UI IBOutlet NSWindow *initialWindow; IBOutlet NSTextField *initialPasswordText; IBOutlet NSMatrix *initialAuthenticationType; IBOutlet NSButton *initialDoneButton; //int port; BOOL systemServerIsConfigured; BOOL alwaysShared; BOOL neverShared; BOOL userStopped; BOOL relaunchServer; BOOL doNotLoadProxy; BOOL waitingForHostInfo; NSTask *controller; NSFileHandle *serverOutput; NSString *passwordFile; NSString *logFile; NSAuthorization *myAuthorization; NSDate *lastLaunchTime; NSMutableArray *bundleArray; NSArray *clientList; NSString *hostName; NSString *automaticReverseHost; NSString *automaticReversePort; } - (instancetype) init; @property (NS_NONATOMIC_IOSONLY, readonly, strong) NSWindow *window; @property (NS_NONATOMIC_IOSONLY, readonly) int runningPortNum; - (void) awakeFromNib; - (void) loadUIForSystemServer; - (void) loadUIForPort: (NSInteger) port; - (void) loadUserDefaults: sender; - (void) saveUserDefaults: sender; - (IBAction) validateInitialAuthentication: sender; - (IBAction) setInitialAuthentication: sender; - (NSMutableArray *) formCommandLineForSystemServer: (BOOL) isSystemServer; - (IBAction) startServer: sender; - (IBAction) stopServer: sender; - (void) serverStopped: (NSNotification *) aNotification; - (IBAction) changeDisplayNumber: sender; - (IBAction) changePort: sender; - (IBAction) changeSharing: sender; - (IBAction) changeAuthenticationType: sender; - (IBAction) changePassword: sender; - (IBAction) changeDisplayName: sender; - (IBAction) optionChanged: sender; - (IBAction) changeSystemServerPort: sender; - (IBAction) changeSystemServerAuthentication: sender; - (IBAction) reverseConnection: sender; - (IBAction) cancelConnectHost: sender; - (IBAction) connectHost: sender; - (void) checkForRestart; - (void) applicationWillTerminate: (NSNotification *) notification; - (BOOL) validateMenuItem: (NSMenuItem *) menuItem ; // Menu Items - (IBAction) openFirewall:(id) sender; - (IBAction) openLog:(id) sender; - (IBAction) openGPL:(id) sender; - (IBAction) openReleaseNotes:(id) sender; - (IBAction) openFile:(id) sender; - (IBAction) installAsService: sender; - (IBAction) removeService: sender; - (IBAction) terminateRequest: sender; @end ================================================ FILE: VNCController.m ================================================ /* * VNCController.m * OSXvnc * * Created by Jonathan Gillaspie on Fri Aug 02 2002. osxvnc@redstonesoftware.com * Copyright (c) 2002-2005 Redstone Software Inc. All rights reserved. * * All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #import "VNCController.h" #import "OSXvnc-server/vncauth.h" #import #import #import #import #import #import #import #import #define PasswordProxy @"********" #define LocalizedString(X) [[NSBundle mainBundle] localizedStringForKey:(X) value:nil table:nil] @interface NSString (VNCExtensions) @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString *string; @end @implementation NSString (VNCExtensions) - (NSString *) string { return self; } @end @interface NSTextView (VNCExtensions) - (void) setStringValue: (NSString *) newString; @end @implementation NSTextView (VNCExtensions) - (void) setStringValue: (NSString *) newString { self.string = newString; } @end @interface NSFileManager (VNCExtensions) - (BOOL) directoryExistsAtPath: (NSString *) path; - (BOOL) createFullDirectoryAtPath:(NSString *)path attributes:(NSDictionary *)attributes; - (BOOL) canWriteToFile: (NSString *) path; @end @implementation NSFileManager (VNCExtensions) - (BOOL) directoryExistsAtPath: (NSString *) path { BOOL isDirectory = NO; return ([self fileExistsAtPath:path isDirectory: &isDirectory] && isDirectory); } - (BOOL) createFullDirectoryAtPath:(NSString *)path attributes:(NSDictionary *)attributes { return [self createDirectoryAtPath:path withIntermediateDirectories:YES attributes:attributes error:NULL]; } - (BOOL) canWriteToFile: (NSString *) path { if ([[NSFileManager defaultManager] fileExistsAtPath:path]) return [[NSFileManager defaultManager] isWritableFileAtPath:path]; else { [[NSFileManager defaultManager] createFullDirectoryAtPath:path.stringByDeletingLastPathComponent attributes:nil]; return [[NSFileManager defaultManager] isWritableFileAtPath:path.stringByDeletingLastPathComponent]; } } @end @implementation VNCController static int shutdownSignal = 0; static NSColor *successColor; static NSColor *failureColor; static void terminateOnSignal(int signal) { shutdownSignal = signal; NSLog(@"Trapped Signal %d -- Terminating", shutdownSignal); [NSApp terminate:NSApp]; } static NSMutableString *hostNameString(void) { char hostName[256]; gethostname(hostName, 256); NSMutableString *hostNameString = [NSMutableString stringWithUTF8String:hostName]; if ([hostNameString hasSuffix:@".local"]) [hostNameString deleteCharactersInRange:NSMakeRange(hostNameString.length - 6, 6)]; return hostNameString; } static NSMutableArray *localIPAddresses(void) { NSMutableArray *returnArray = [NSMutableArray array]; struct ifaddrs *ifa = NULL, *ifp = NULL; if (getifaddrs (&ifp) < 0) { return nil; } for (ifa = ifp; ifa; ifa = ifa->ifa_next) { char ipString[256]; socklen_t salen; if (ifa->ifa_addr->sa_family == AF_INET) salen = sizeof (struct sockaddr_in); else if (ifa->ifa_addr->sa_family == AF_INET6) salen = sizeof (struct sockaddr_in6); else continue; if (getnameinfo (ifa->ifa_addr, salen, ipString, sizeof (ipString), NULL, 0, NI_NUMERICHOST) == 0) { [returnArray addObject:@(ipString)]; } } freeifaddrs (ifp); return returnArray; } - (instancetype) init { self = [super init]; // Transform the GUI into a "ForegroundApp" with Dock Icon and Menu // This is so the server can run without a UI // 10.3+ only // ProcessSerialNumber psn = { 0, kCurrentProcess }; // OSStatus returnCode = TransformProcessType(& psn, kProcessTransformToForegroundApplication); // if (returnCode != 0) { // NSLog(@"Could not transform process type. Error %d", returnCode); // } // // if (![[NSUserDefaults standardUserDefaults] boolForKey:@"autolaunch"]) // SetFrontProcess(& psn ); hostName = [hostNameString() retain]; successColor = [[NSColor colorWithDeviceRed:0.0 green:0.4 blue:0.0 alpha:1.0] retain]; failureColor = [[NSColor colorWithDeviceRed:0.6 green:0.0 blue:0.0 alpha:1.0] retain]; [[NSUserDefaults standardUserDefaults] registerDefaults: @{ @"PasswordFile": @"", @"LogFile": @"", @"desktopName": [NSString stringWithFormat:@"%@ (%@)", hostName, NSUserName()], @"portNumberSystemServer": @"5900", @"desktopNameSystemServer": hostName, @"allowSleep": @"NO", @"allowDimming": @"YES", @"allowScreenSaver": @"YES", @"swapButtons": @"YES", @"keyboardLayout": @0, @"keyboardEvents": @3, @"eventSource": @2, @"disableRemoteEvents": @"NO", @"disableRichClipboard": @"NO", @"allowRendezvous": @"YES", @"dontDisconnectClients": @"NO", @"startServerOnLaunch": @"NO", @"terminateOnFastUserSwitch": @"NO", @"serverKeepAlive": @"YES", @"protocolVersion": @"Default", @"otherArguments": @"", @"localhostOnly": @"NO", @"localhostOnlySystemServer": @"NO", #if defined(WITH_EXTERNAL_IP) @"externalIPURL": @"http://automation.whatismyip.com/n09230945.asp", #endif @"startupItemLocation": @"/Library/StartupItems/OSXvnc", @"launchdItemLocation": @"/Library/LaunchAgents/com.redstonesoftware.VineServer.plist" }]; alwaysShared = FALSE; neverShared = FALSE; userStopped = FALSE; automaticReverseHost = [[NSBundle mainBundle].infoDictionary[@"ReverseHost"] copy]; automaticReversePort = [[NSBundle mainBundle].infoDictionary[@"ReversePort"] copy]; signal(SIGHUP, SIG_IGN); signal(SIGABRT, terminateOnSignal); signal(SIGINT, terminateOnSignal); signal(SIGQUIT, terminateOnSignal); signal(SIGBUS, terminateOnSignal); signal(SIGSEGV, terminateOnSignal); signal(SIGTERM, terminateOnSignal); signal(SIGTSTP, terminateOnSignal); return self; } - (IBAction) terminateRequest: sender { if (clientList.count && !shutdownSignal) NSBeginAlertSheet(LocalizedString(@"Quit Vine Server"), LocalizedString(@"Cancel"), LocalizedString(@"Quit"), nil, statusWindow, self, @selector(terminateSheetDidEnd:returnCode:contextInfo:), NULL, NULL, LocalizedString(@"Disconnect %lu clients and quit Vine Server?"), (unsigned long)clientList.count); else [NSApp terminate: self]; } - (void) terminateSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { if (returnCode == NSAlertAlternateReturn) { [sheet orderOut:self]; [NSApp terminate: self]; } } - (BOOL) authenticationIsValid { return (automaticReverseHost.length || [[NSUserDefaults standardUserDefaults] dataForKey:@"vncauth"].length || [[NSUserDefaults standardUserDefaults] integerForKey:@"AuthenticationType"] > 1); } - (void) updateHostInfo { // These commands can sometimes take a little while, so we have a dedicated thread for them if (!waitingForHostInfo) { waitingForHostInfo = TRUE; [NSThread detachNewThreadSelector:@selector(dedicatedUpdateHostInfoThread) toTarget:self withObject:nil]; } } // Since this can block for a long time in certain DNS situations we will put this in a separate thread - (void) dedicatedUpdateHostInfoThread { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NS_DURING { // flushHostCache is no longer needed since OS X 10.6. #if 0 [NSHost flushHostCache]; #endif NSHost *currentHost = [NSHost currentHost]; NSMutableArray *commonHostNames = [currentHost.names mutableCopy]; NSMutableArray *commonIPAddresses = [currentHost.addresses mutableCopy]; NSMutableArray *displayIPAddresses = [NSMutableArray array]; #if defined(WITH_EXTERNAL_IP) NSURL *externalIP = [NSURL URLWithString:[[NSUserDefaults standardUserDefaults] stringForKey:@"externalIPURL"]]; NSData *externalIPData = [NSData dataWithContentsOfURL:externalIP]; NSString *externalIPString = (externalIPData.length ? [NSString stringWithUTF8String: externalIPData.bytes] : @"" ); #endif NSEnumerator *ipEnum = nil; NSString *anIP = nil; BOOL anyConnections = TRUE; // Sadly it looks like the local IP's bypass the firewall anyhow #if defined(WITH_EXTERNAL_IP) if (externalIPString.length && [commonIPAddresses indexOfObject:externalIPString] == NSNotFound) [commonIPAddresses insertObject:externalIPString atIndex:0]; #endif ipEnum = [commonIPAddresses objectEnumerator]; while (anIP = [ipEnum nextObject]) { #if defined(WITH_EXTERNAL_IP) BOOL isExternal = [externalIPString isEqualToString:anIP]; #else bool isExternal = false; #endif NSMutableAttributedString *ipString = [[[NSMutableAttributedString alloc] initWithString: anIP] autorelease]; if ([anIP hasPrefix:@"127.0.0.1"] || // localhost entries [anIP rangeOfString:@"::"].location != NSNotFound) { continue; } if (isExternal) { [ipString replaceCharactersInRange:NSMakeRange(ipString.length,0) withString:@"\tExternal"]; } else { [ipString replaceCharactersInRange:NSMakeRange(ipString.length,0) withString:@"\tInternal"]; } if (controller && !limitToLocalConnections.state) { // Colorize and add tooltip NSURL *testURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://%@:%d", anIP, self.runningPortNum]]; NSData *testData = [NSData dataWithContentsOfURL:testURL]; NSString *testString = (testData.length ? [NSString stringWithUTF8String: testData.bytes] : @""); if ([testString hasPrefix:@"RFB"]) { [ipString replaceCharactersInRange:NSMakeRange(ipString.length,0) withString:@"\tNetwork is configured to allow connections to this IP"]; [ipString addAttribute:NSForegroundColorAttributeName value:successColor range:NSMakeRange(0,ipString.length)]; anyConnections = TRUE; } else { [ipString replaceCharactersInRange:NSMakeRange(ipString.length,0) withString:@"\tNetwork is NOT configured to allow connections to this IP"]; [ipString addAttribute:NSForegroundColorAttributeName value:failureColor range:NSMakeRange(0,ipString.length)]; } } else // We don't want to warn about the firewall if we don't actually do the detection anyConnections = TRUE; [displayIPAddresses addObject: ipString]; } if (!anyConnections) [self performSelectorOnMainThread:@selector(addStatusMessage:) withObject: @"\n(It appears that your firewall is not permitting VNC connections)" waitUntilDone:NO]; [self performSelectorOnMainThread:@selector(updateHostNames:) withObject: commonHostNames waitUntilDone:NO]; [self performSelectorOnMainThread:@selector(updateIPAddresses:) withObject: displayIPAddresses waitUntilDone:NO]; waitingForHostInfo = FALSE; } NS_HANDLER NSLog(@"Exception in updateHostInfo: %@", localException); NS_ENDHANDLER [pool release]; } // Display Host Names - (void) updateHostNames: (NSArray *) newHostNames { NSMutableArray *commonHostNames = [[newHostNames mutableCopy] autorelease]; [commonHostNames removeObject:@"localhost"]; if (commonHostNames.count > 1) { [hostNamesBox setTitle:LocalizedString(@"Host Names")]; hostNamesField.stringValue = [commonHostNames componentsJoinedByString:@"\n"]; } else if (commonHostNames.count == 1) { [hostNamesBox setTitle:LocalizedString(@"Host Name")]; hostNamesField.stringValue = [commonHostNames componentsJoinedByString:@"\n"]; } else { [hostNamesBox setTitle:LocalizedString(@"Host Name")]; hostNamesField.stringValue = @""; } } // Display IP Info - (void) updateIPAddresses: (NSArray *) commonIPAddresses { [ipAddressesView renewRows:0 columns:2]; id ipAddressEnum = [commonIPAddresses objectEnumerator]; id ipAddress = nil; int i = 0; while (ipAddress = [ipAddressEnum nextObject]) { NSString *anIP = [ipAddress string]; if ([anIP hasPrefix:@"127.0.0.1"] || // localhost entries [anIP rangeOfString:@"::"].location != NSNotFound) { ;//[commonIPAddresses removeObject:anIP]; } else { NSRange endOfIP = [anIP rangeOfString:@"\t"]; NSAttributedString *ipString = ipAddress; NSAttributedString *noteString = nil; NSString *tooltipString = @""; if (endOfIP.location != NSNotFound && [ipAddress isKindOfClass:[NSAttributedString class]]) { ipString = [ipAddress attributedSubstringFromRange: NSMakeRange(0,endOfIP.location)]; noteString = [ipAddress attributedSubstringFromRange: NSMakeRange(endOfIP.location+1,[ipAddress length]-(endOfIP.location+1))]; endOfIP = [noteString.string rangeOfString:@"\t"]; if (endOfIP.location != NSNotFound) { tooltipString = [noteString.string substringFromIndex:endOfIP.location+1]; noteString = [noteString attributedSubstringFromRange: NSMakeRange(0,endOfIP.location)]; } } [ipAddressesView addRow]; [ipAddressesView cellAtRow:i column:0].attributedStringValue = ipString; [ipAddressesView setToolTip:tooltipString forCell:[ipAddressesView cellAtRow:i column:0]]; [ipAddressesView cellAtRow:i column:1].attributedStringValue = noteString; [ipAddressesView setToolTip:tooltipString forCell:[ipAddressesView cellAtRow:i column:1]]; i++; } } [ipAddressesView sizeToCells]; if (commonIPAddresses.count > 1) { [ipAddressesBox setTitle:LocalizedString(@"IP Addresses")]; //[ipAddressesField setStringValue:[commonIPAddresses componentsJoinedByString:@"\n"]]; } else { [ipAddressesBox setTitle:LocalizedString(@"IP Address")]; //[ipAddressesField setStringValue:@""]; } } - (void) addStatusMessage: message { if ([message isKindOfClass:[NSAttributedString class]]) [statusMessageField.textStorage appendAttributedString:message]; else if ([message isKindOfClass:[NSString class]]) [statusMessageField.textStorage appendAttributedString:[[[NSAttributedString alloc] initWithString:message] autorelease]]; } - (NSWindow *) window { return preferenceWindow; } - (void) determinePasswordLocation { NSArray *passwordFiles = @[[[NSUserDefaults standardUserDefaults] stringForKey:@"PasswordFile"], @"~/.vinevncauth", [[NSBundle mainBundle].bundlePath stringByAppendingPathComponent:@".vinevncauth"], @"/tmp/.vinevncauth"]; NSEnumerator *passwordEnumerators = [passwordFiles objectEnumerator]; [passwordFile release]; passwordFile = nil; // Find first writable location for the password file while (passwordFile = [passwordEnumerators nextObject]) { passwordFile = passwordFile.stringByStandardizingPath; if (passwordFile.length && [[NSFileManager defaultManager] canWriteToFile:passwordFile]) { [passwordFile retain]; break; } } } - (void) determineLogLocation { NSArray *logFiles = @[[[NSUserDefaults standardUserDefaults] stringForKey:@"LogFile"], @"~/Library/Logs/VineServer.log", @"/var/log/VineServer.log", @"/tmp/VineServer.log", [[NSBundle mainBundle].bundlePath stringByAppendingPathComponent:@"VineServer.log"]]; NSEnumerator *logEnumerators = [logFiles objectEnumerator]; [logFile release]; logFile = nil; // Find first writable location for the log file while (logFile = [logEnumerators nextObject]) { logFile = logFile.stringByStandardizingPath; if (logFile.length && [[NSFileManager defaultManager] canWriteToFile:logFile]) { [logFile retain]; break; } } } - (void) awakeFromNib { id infoDictionary = [NSBundle mainBundle].infoDictionary; [self determinePasswordLocation]; [self determineLogLocation]; connectPort.stringValue = @""; [connectPort.cell performSelector:@selector(setPlaceholderString:) withObject:@"5500"]; // Copy over old preferences found in OSXvnc NSDictionary *oldPrefs = [[NSUserDefaults standardUserDefaults] persistentDomainForName:@"OSXvnc"]; if (!oldPrefs[@"Converted"]) { [[NSUserDefaults standardUserDefaults] registerDefaults:oldPrefs]; [self loadUserDefaults: self]; [self saveUserDefaults: self]; oldPrefs = [oldPrefs mutableCopy]; ((NSMutableDictionary *)oldPrefs)[@"Converted"] = [NSNumber numberWithBool:TRUE]; // Record that we've converted [[NSUserDefaults standardUserDefaults] setPersistentDomain:oldPrefs forName:@"OSXvnc"]; // write it back } else [self loadUserDefaults: self]; statusWindow.title = [NSString stringWithFormat:@"%@: %@", infoDictionary[@"CFBundleName"], displayNameField.stringValue]; [optionsTabView selectTabViewItemAtIndex:0]; systemServerIsConfigured = ([[NSFileManager defaultManager] fileExistsAtPath:[[NSUserDefaults standardUserDefaults] stringForKey:@"startupItemLocation"]] || [[NSFileManager defaultManager] fileExistsAtPath:[[NSUserDefaults standardUserDefaults] stringForKey:@"launchdItemLocation"]]); [self loadUIForSystemServer]; stopServerButton.keyEquivalent = @""; startServerButton.keyEquivalent = @"\r"; preferencesMessageTestField.stringValue = @""; // First we'll update with the quick-lookup information that doesn't hang [self updateHostNames:@[hostName]]; [self updateIPAddresses: localIPAddresses()]; [self updateHostInfo]; } - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { if (startServerOnLaunchCheckbox.state)// && [self authenticationIsValid]) [self startServer: self]; if (!NSApp.hidden) [statusWindow makeMainWindow]; } - (void)applicationDidBecomeActive:(NSNotification *)aNotification { if (!statusWindow.visible) [statusWindow makeKeyAndOrderFront:self]; [self updateHostInfo]; } // This is sent when the server's screen params change, // the server can't handle this right now so we'll restart. - (void)applicationDidChangeScreenParameters:(NSNotification *)aNotification { [self addStatusMessage:@"\n"]; [self addStatusMessage:LocalizedString(@"Screen Resolution changed - Server Reinitialized")]; } - (void) updateUIForConnectionList: (NSArray *) connectionList { NSMutableString *statusMessage = [NSMutableString string]; [clientList autorelease]; clientList = [connectionList copy]; NSUInteger activeConnectionsCount = clientList.count; if (!passwordField.stringValue.length) [statusMessage appendFormat:@"%@(%@)", LocalizedString(@"Server Running"), LocalizedString(@"No Authentication")]; else [statusMessage appendString: LocalizedString(@"Server Running")]; [statusMessage appendString:@"\n"]; if (activeConnectionsCount == 0) [statusMessage appendString: LocalizedString(@"No Clients Connected")]; else if (activeConnectionsCount == 1) { [statusMessage appendFormat: @"%d ", 1]; [statusMessage appendString: LocalizedString(@"Client Connected: ")]; [statusMessage appendString: [clientList[0] valueForKey:@"clientIP"]]; } else if (activeConnectionsCount > 1) { [statusMessage appendFormat: @"%lu ", (unsigned long)activeConnectionsCount]; [statusMessage appendString: LocalizedString(@"Clients Connected: ")]; [statusMessage appendString: [[clientList valueForKey:@"clientIP"] componentsJoinedByString:@", "]]; } [statusMessageField setStringValue: statusMessage]; if (activeConnectionsCount == 0) { [[NSApp performSelector:@selector(dockTile)] performSelector:@selector(setBadgeLabel:) withObject:@""]; } else { [[NSApp performSelector:@selector(dockTile)] performSelector:@selector(setBadgeLabel:) withObject:[NSString stringWithFormat:@"%lu", (unsigned long)activeConnectionsCount]]; } } - (void)activeConnections: (NSNotification *) aNotification { [self updateUIForConnectionList: aNotification.userInfo[@"clientList"]]; } - (int) scanForOpenPort: (int) tryPort { int listen_fd4=0; int value=1; struct sockaddr_in sin4; bzero(&sin4, sizeof(sin4)); sin4.sin_len = sizeof(sin4); sin4.sin_family = AF_INET; sin4.sin_addr.s_addr = htonl(INADDR_ANY); // I'm going to only scan on IPv4 since our OSXvnc is going to register in both spaces // struct sockaddr_in6 sin6; // int listen_fd6=0; // bzero(&sin6, sizeof(sin6)); // sin6.sin6_len = sizeof(sin6); // sin6.sin6_family = AF_INET6; // sin6.sin6_addr = in6addr_any; while (tryPort < 5910) { sin4.sin_port = htons(tryPort); //sin6.sin6_port = htons(tryPort); if ((listen_fd4 = socket(PF_INET, SOCK_STREAM, 0)) < 0) { //NSLog(@"Socket init failed %d", tryPort); } else if (fcntl(listen_fd4, F_SETFL, O_NONBLOCK) < 0) { //rfbLogPerror("fcntl O_NONBLOCK failed"); } else if (setsockopt(listen_fd4, SOL_SOCKET, SO_REUSEADDR, &value, sizeof(value)) < 0) { //NSLog(@"setsockopt SO_REUSEADDR failed %d", tryPort); } else if (bind(listen_fd4, (struct sockaddr *) &sin4, sizeof(sin4)) < 0) { //NSLog(@"Failed to bind socket: port %d may be in use by another VNC", tryPort); } else if (listen(listen_fd4, 5) < 0) { //NSLog(@"Listen failed %d", tryPort); } /* else if ((listen_fd6 = socket(PF_INET6, SOCK_STREAM, 0)) < 0) { // NSLog(@"Socket init 6 failed %d", tryPort); } else if (fcntl(listen_fd6, F_SETFL, O_NONBLOCK) < 0) { // rfbLogPerror("IPv6: fcntl O_NONBLOCK failed"); } else if (setsockopt(listen_fd6, SOL_SOCKET, SO_REUSEADDR, &value, sizeof(value)) < 0) { //NSLog(@"setsockopt 6 SO_REUSEADDR failed %d", tryPort); } else if (bind(listen_fd6, (struct sockaddr *) &sin6, sizeof(sin6)) < 0) { //NSLog(@"Failed to bind socket: port %d may be in use by another VNC", tryPort); } else if (listen(listen_fd6, 5) < 0) { //NSLog(@"Listen failed %d", tryPort); } */ else { close(listen_fd4); //close(listen_fd6); return tryPort; } close(listen_fd4); //close(listen_fd6); tryPort++; } [statusMessageField setStringValue:LocalizedString(@"Unable to find open port 5900-5909")]; return 0; } - (int) runningPortNum { return portNumText.intValue; } - (void) loadUIForSystemServer { if (systemServerIsConfigured) { startupItemStatusMessageField.textColor = successColor; [startupItemStatusMessageField setStringValue:LocalizedString(@"Startup Item Configured (Started)")]; } else { startupItemStatusMessageField.textColor = failureColor; [startupItemStatusMessageField setStringValue:LocalizedString(@"Startup Item Disabled (Stopped)")]; } disableStartupButton.enabled = systemServerIsConfigured; systemServerMenu.state = (systemServerIsConfigured ? NSOnState : NSOffState); setStartupButton.title = (systemServerIsConfigured ? LocalizedString(@"Restart System Server") : LocalizedString(@"Start System Server")); } - (void) loadAuthenticationUI { NSUInteger authType = [[NSUserDefaults standardUserDefaults] integerForKey:@"AuthenticationType"]; if ([[NSUserDefaults standardUserDefaults] dataForKey:@"vncauth"].length) { [passwordField setStringValue:PasswordProxy]; [authenticationType selectCellWithTag:1]; } else if (authType == 2) { [authenticationType selectCellWithTag: 2]; } limitToLocalConnections.state = [[NSUserDefaults standardUserDefaults] boolForKey:@"localhostOnly"]; } - (void) loadSystemServerAuthenticationUI { if ([[NSUserDefaults standardUserDefaults] dataForKey:@"vncauthSystemServer"].length) { [systemServerPasswordField setStringValue:PasswordProxy]; [systemServerAuthenticationType selectCellWithTag:1]; } else { // if (authType == 2) { [systemServerAuthenticationType selectCellWithTag: 2]; } systemServerLimitToLocalConnections.state = [[NSUserDefaults standardUserDefaults] boolForKey:@"localhostOnlySystemServer"]; } - (void) loadUIForPort: (NSInteger) port { if (port) { if (port < 5900 || port > 5909) [displayNumberField selectItemWithTitle:@"--"]; else [displayNumberField selectItemWithTitle:[NSString stringWithFormat:@"%d", (int)(port - 5900)]]; portField.stringValue = [NSString stringWithFormat:@"%u", (unsigned)port]; displayNumText.stringValue = displayNumberField.title; portNumText.stringValue = [NSString stringWithFormat:@"%u", (unsigned)port]; } else { [displayNumberField selectItemWithTitle:@"Auto"]; port = [self scanForOpenPort:5900]; if (port) { portField.stringValue = @""; [portField.cell performSelector:@selector(setPlaceholderString:) withObject:[NSString stringWithFormat:@"%u", (unsigned)port]]; displayNumText.intValue = (int)(port - 5900); portNumText.stringValue = [NSString stringWithFormat:@"%u", (unsigned)port]; } } } - (void) loadUIForSystemServerPort: (NSInteger) port { if (port) { if (port < 5900 || port > 5909) [systemServerDisplayNumberField selectItemWithTitle:@"--"]; else [systemServerDisplayNumberField selectItemWithTitle:[NSString stringWithFormat:@"%d", (int)(port - 5900)]]; systemServerPortField.stringValue = [NSString stringWithFormat:@"%u", (unsigned)port]; } else { [systemServerDisplayNumberField selectItemWithTitle:@"Auto"]; port = [self scanForOpenPort:5900]; if (port) { systemServerPortField.stringValue = @""; [systemServerPortField.cell performSelector:@selector(setPlaceholderString:) withObject:[NSString stringWithFormat:@"%u", (unsigned)port]]; } } } - (void) loadUserDefaults: sender { [self loadAuthenticationUI]; [self loadSystemServerAuthenticationUI]; [self loadUIForPort: [[NSUserDefaults standardUserDefaults] integerForKey:@"portNumber"]]; [self loadUIForSystemServerPort: [[NSUserDefaults standardUserDefaults] integerForKey:@"portNumberSystemServer"]]; displayNameField.stringValue = [[NSUserDefaults standardUserDefaults] stringForKey:@"desktopName"]; systemServerDisplayNameField.stringValue = [[NSUserDefaults standardUserDefaults] stringForKey:@"desktopNameSystemServer"]; allowSleepCheckbox.state = [[NSUserDefaults standardUserDefaults] boolForKey:@"allowSleep"]; allowDimmingCheckbox.state = [[NSUserDefaults standardUserDefaults] boolForKey:@"allowDimming"]; allowScreenSaverCheckbox.state = [[NSUserDefaults standardUserDefaults] boolForKey:@"allowScreenSaver"]; swapMouseButtonsCheckbox.state = [[NSUserDefaults standardUserDefaults] boolForKey:@"swapButtons"]; [keyboardLayout selectItemAtIndex:[keyboardLayout indexOfItemWithTag:[[NSUserDefaults standardUserDefaults] integerForKey:@"keyboardLayout"]]]; [keyboardEvents selectItemAtIndex:[keyboardEvents indexOfItemWithTag:[[NSUserDefaults standardUserDefaults] integerForKey:@"keyboardEvents"]]]; [eventSourcePopup selectItemAtIndex:[eventSourcePopup indexOfItemWithTag:[[NSUserDefaults standardUserDefaults] integerForKey:@"eventSource"]]]; disableRemoteEventsCheckbox.state = [[NSUserDefaults standardUserDefaults] boolForKey:@"disableRemoteEvents"]; disableRichClipboardCheckbox.state = [[NSUserDefaults standardUserDefaults] boolForKey:@"disableRichClipboard"]; allowRendezvousCheckbox.state = [[NSUserDefaults standardUserDefaults] boolForKey:@"allowRendezvous"]; [sharingMatrix selectCellWithTag: [[NSUserDefaults standardUserDefaults] integerForKey:@"sharingMode"]]; dontDisconnectCheckbox.state = [[NSUserDefaults standardUserDefaults] boolForKey:@"dontDisconnectClients"]; [self changeSharing:self]; if ([[NSUserDefaults standardUserDefaults] floatForKey:@"protocolVersion"] > 0.0) [protocolVersion selectItemWithTitle:[[NSUserDefaults standardUserDefaults] stringForKey:@"protocolVersion"]]; otherArguments.stringValue = [[NSUserDefaults standardUserDefaults] stringForKey:@"otherArguments"]; startServerOnLaunchCheckbox.state = [[NSUserDefaults standardUserDefaults] boolForKey:@"startServerOnLaunch"]; terminateOnFastUserSwitch.state = [[NSUserDefaults standardUserDefaults] boolForKey:@"terminateOnFastUserSwitch"]; serverKeepAliveCheckbox.state = [[NSUserDefaults standardUserDefaults] boolForKey:@"serverKeepAlive"]; } - (void) saveUserDefaults: sender { if (displayNameField.stringValue.length) [[NSUserDefaults standardUserDefaults] setObject:displayNameField.stringValue forKey:@"desktopName"]; if (displayNumberField.selectedItem.tag == 0) [[NSUserDefaults standardUserDefaults] setInteger:0 forKey:@"portNumber"]; else [[NSUserDefaults standardUserDefaults] setInteger:portField.intValue forKey:@"portNumber"]; [[NSUserDefaults standardUserDefaults] setInteger:(authenticationType.selectedCell).tag forKey:@"AuthenticationType"]; // System Server { if (systemServerDisplayNameField.stringValue.length) [[NSUserDefaults standardUserDefaults] setObject:systemServerDisplayNameField.stringValue forKey:@"desktopNameSystemServer"]; if (systemServerDisplayNumberField.selectedItem.tag == 0) [[NSUserDefaults standardUserDefaults] setInteger:0 forKey:@"portNumberSystemServer"]; else [[NSUserDefaults standardUserDefaults] setInteger:systemServerPortField.intValue forKey:@"portNumberSystemServer"]; [[NSUserDefaults standardUserDefaults] setInteger:(systemServerAuthenticationType.selectedCell).tag forKey:@"AuthenticationTypeSystemServer"]; [[NSUserDefaults standardUserDefaults] setBool:systemServerLimitToLocalConnections.state forKey:@"localhostOnlySystemServer"]; } [[NSUserDefaults standardUserDefaults] setBool:swapMouseButtonsCheckbox.state forKey:@"swapButtons"]; [[NSUserDefaults standardUserDefaults] setInteger:(sharingMatrix.selectedCell).tag forKey:@"sharingMode"]; [[NSUserDefaults standardUserDefaults] setBool:dontDisconnectCheckbox.state forKey:@"dontDisconnectClients"]; [[NSUserDefaults standardUserDefaults] setBool:disableRemoteEventsCheckbox.state forKey:@"disableRemoteEvents"]; [[NSUserDefaults standardUserDefaults] setBool:disableRichClipboardCheckbox.state forKey:@"disableRichClipboard"]; [[NSUserDefaults standardUserDefaults] setBool:limitToLocalConnections.state forKey:@"localhostOnly"]; [[NSUserDefaults standardUserDefaults] setBool:allowRendezvousCheckbox.state forKey:@"allowRendezvous"]; [[NSUserDefaults standardUserDefaults] setBool:startServerOnLaunchCheckbox.state forKey:@"startServerOnLaunch"]; [[NSUserDefaults standardUserDefaults] setBool:terminateOnFastUserSwitch.state forKey:@"terminateOnFastUserSwitch"]; [[NSUserDefaults standardUserDefaults] setBool:serverKeepAliveCheckbox.state forKey:@"serverKeepAlive"]; [[NSUserDefaults standardUserDefaults] setBool:allowSleepCheckbox.state forKey:@"allowSleep"]; [[NSUserDefaults standardUserDefaults] setBool:allowDimmingCheckbox.state forKey:@"allowDimming"]; [[NSUserDefaults standardUserDefaults] setBool:allowScreenSaverCheckbox.state forKey:@"allowScreenSaver"]; [[NSUserDefaults standardUserDefaults] setInteger:keyboardLayout.selectedItem.tag forKey:@"keyboardLayout"]; [[NSUserDefaults standardUserDefaults] setInteger:keyboardEvents.selectedItem.tag forKey:@"keyboardEvents"]; [[NSUserDefaults standardUserDefaults] setInteger:eventSourcePopup.selectedItem.tag forKey:@"eventSource"]; if (protocolVersion.titleOfSelectedItem.floatValue > 0.0) [[NSUserDefaults standardUserDefaults] setFloat:protocolVersion.titleOfSelectedItem.floatValue forKey:@"protocolVersion"]; else [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"protocolVersion"]; [[NSUserDefaults standardUserDefaults] setObject:otherArguments.stringValue forKey:@"otherArguments"]; [[NSUserDefaults standardUserDefaults] synchronize]; } - (void) startServer: sender { NSArray *argv; if (controller) { // Set to relaunch and then try to shut-down relaunchServer = TRUE; [self stopServer: self]; return; } if (![preferenceWindow makeFirstResponder:preferenceWindow]) { [preferenceWindow endEditingFor:nil]; } if (![statusWindow makeFirstResponder:statusWindow]) { [statusWindow endEditingFor:nil]; } if (displayNumberField.selectedItem.tag == 0) { [self loadUIForPort:0]; // To update the UI on the likely port that we will get } if (![self authenticationIsValid]) { [NSApp beginSheet: initialWindow modalForWindow:statusWindow modalDelegate:nil didEndSelector: NULL contextInfo: NULL]; return; } if ([[NSUserDefaults standardUserDefaults] dataForKey:@"vncauth"] && ![[[NSUserDefaults standardUserDefaults] dataForKey:@"vncauth"] writeToFile: passwordFile atomically:NO]) { [self addStatusMessage:@"Unable to start - problem writing vnc password file"]; return; } if ((argv = [self formCommandLineForSystemServer: NO])) { NSDictionary *infoDictionary = [NSBundle mainBundle].infoDictionary; NSString *executionPath = [[NSBundle mainBundle].bundlePath stringByAppendingPathComponent: @"Contents/MacOS/OSXvnc-server"]; NSString *noteStartup = [NSString stringWithFormat:@"%@\tStarting %@ %@(%@)\n", [NSDate date], [NSProcessInfo processInfo].processName, [infoDictionary valueForKey:@"CFBundleShortVersion"], [infoDictionary valueForKey:@"CFBundleVersion"]]; [self determineLogLocation]; if (![[NSFileManager defaultManager] fileExistsAtPath:logFile]) { [[NSFileManager defaultManager] createFileAtPath:logFile contents:nil attributes:nil]; } else { // Clear it serverOutput = [NSFileHandle fileHandleForUpdatingAtPath:logFile]; [serverOutput truncateFileAtOffset:0]; [serverOutput closeFile]; } serverOutput = [[NSFileHandle fileHandleForUpdatingAtPath:logFile] retain]; [serverOutput writeData:[noteStartup dataUsingEncoding: NSUTF8StringEncoding]]; [serverOutput writeData:[[argv componentsJoinedByString:@" "] dataUsingEncoding: NSUTF8StringEncoding]]; [serverOutput writeData:[@"\n\n" dataUsingEncoding: NSUTF8StringEncoding]]; controller = [[NSTask alloc] init]; controller.launchPath = executionPath; controller.arguments = argv; controller.standardOutput = serverOutput; controller.standardError = serverOutput; [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(activeConnections:) name:@"VNCConnections" object:[NSString stringWithFormat:@"OSXvnc%d", self.runningPortNum] suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately]; [controller launch]; [lastLaunchTime release]; lastLaunchTime = [[NSDate date] retain]; [[NSNotificationCenter defaultCenter] addObserver: self selector: NSSelectorFromString(@"serverStopped:") name: NSTaskDidTerminateNotification object: controller]; if (!passwordField.stringValue.length) [statusMessageField setStringValue:[NSString stringWithFormat:@"%@ - %@", LocalizedString(@"Server Running"), LocalizedString(@"No Authentication")]]; else [statusMessageField setStringValue:LocalizedString(@"Server Running")]; //[startServerButton setEnabled:FALSE]; [startServerButton setTitle:LocalizedString(@"Restart Server")]; [startServerMenuItem setTitle:LocalizedString(@"Restart Server")]; [stopServerButton setEnabled:TRUE]; serverMenuItem.state = NSOnState; // We really don't want people to accidentally stop the server //[startServerButton setKeyEquivalent:@""]; //[stopServerButton setKeyEquivalent:@"\r"]; userStopped = FALSE; /* Only auto-connect the very first time ??; */ if (automaticReverseHost.length) { [self addStatusMessage:[NSString stringWithFormat:@"\n%@: %@", LocalizedString(@"Initiating Reverse Connection To Host"), automaticReverseHost]]; // [automaticReverseHost release]; // automaticReverseHost = nil; // [automaticReversePort release]; // automaticReversePort = nil; } // Give the server a second to launch [self performSelector:@selector(updateHostInfo) withObject:nil afterDelay:1.0]; } } - (void) stopServer: sender { [self updateHostInfo]; if (controller != nil) { userStopped = TRUE; [controller terminate]; } else { [statusMessageField setStringValue:LocalizedString(@"The server is stopped.")]; } } - (void) serverStopped: (NSNotification *) aNotification { // If we don't get the notification soon enough, we may have already restarted if (controller.running) { return; } [[NSDistributedNotificationCenter defaultCenter] removeObserver:self name:@"VNCConnections" object:[NSString stringWithFormat:@"OSXvnc%d", self.runningPortNum]]; [[NSNotificationCenter defaultCenter] removeObserver: self name: NSTaskDidTerminateNotification object: controller]; [self updateUIForConnectionList:[NSArray array]]; preferencesMessageTestField.stringValue = @""; [startServerButton setTitle:LocalizedString(@"Start Server")]; [startServerMenuItem setTitle:LocalizedString(@"Start Server")]; //[startServerButton setEnabled:TRUE]; [stopServerButton setEnabled:FALSE]; serverMenuItem.state = NSOffState; //[stopServerButton setKeyEquivalent:@""]; //[startServerButton setKeyEquivalent:@"\r"]; if (userStopped) [statusMessageField setStringValue:LocalizedString(@"The server is stopped.")]; else if (controller.terminationStatus==250) { NSMutableString *messageString = [NSMutableString stringWithFormat: LocalizedString(@"Vine Server can't listen on the specified port (%d)."), self.runningPortNum]; [messageString appendString:@"\n"]; if (systemServerIsConfigured) [messageString appendString:LocalizedString(@"Probably because the VNC server is already running as a Startup Item.")]; else [messageString appendString:LocalizedString(@"Probably because another VNC is already using this port.")]; [statusMessageField setStringValue:messageString]; } else if (controller.terminationStatus) { [statusMessageField setStringValue:[NSString stringWithFormat:LocalizedString(@"The server has stopped running. See Log (%d)\n"), controller.terminationStatus]]; } else [statusMessageField setStringValue:LocalizedString(@"The server has stopped running")]; if (!userStopped && serverKeepAliveCheckbox.state && controller.terminationStatus >= 0 && controller.terminationStatus <= 64 && -lastLaunchTime.timeIntervalSinceNow > 1.0) relaunchServer = YES; [controller release]; controller = nil; [serverOutput closeFile]; [serverOutput release]; serverOutput = nil; // If it crashes in less than a second it probably can't launch if (relaunchServer) { relaunchServer = NO; [self startServer:self]; } } - (NSMutableArray *) formCommandLineForSystemServer: (BOOL) isSystemServer { NSMutableArray *argv = [NSMutableArray array]; if (isSystemServer) { [argv addObject:@"-rfbport"]; if (systemServerDisplayNumberField.selectedItem.tag == 0) [argv addObject:@"0"]; else [argv addObject:[NSString stringWithFormat:@"%d", systemServerPortField.intValue]]; if (systemServerDisplayNameField.stringValue.length) { [argv addObject:@"-desktop"]; [argv addObject:systemServerDisplayNameField.stringValue]; } switch ((systemServerAuthenticationType.selectedCell).tag) { case 2: [argv addObject:@"-rfbnoauth"]; break; case 1: default: if (passwordFile && [[NSFileManager defaultManager] fileExistsAtPath:passwordFile]) { [argv addObject:@"-rfbauth"]; [argv addObject:passwordFile]; } else { [startupItemStatusMessageField setStringValue:LocalizedString(@"Error: Valid VNC password required to start server")]; return nil; } break; } if (systemServerLimitToLocalConnections.state) [argv addObject:@"-localhost"]; [argv addObject:@"-SystemServer"]; [argv addObject:@"1"]; } else { [argv addObject:@"-rfbport"]; if (displayNumberField.selectedItem.tag == 0) [argv addObject:@"0"]; else [argv addObject:[NSString stringWithFormat:@"%d", portField.intValue]]; if (displayNameField.stringValue.length) { [argv addObject:@"-desktop"]; [argv addObject:displayNameField.stringValue]; } [argv addObject:@"-donotloadproxy"]; switch ((authenticationType.selectedCell).tag) { case 2: [argv addObject:@"-rfbnoauth"]; break; case 1: default: if (passwordFile && [[NSFileManager defaultManager] fileExistsAtPath:passwordFile]) { [argv addObject:@"-rfbauth"]; [argv addObject:passwordFile]; } else { [self addStatusMessage:[NSString stringWithFormat:@"\n%@", LocalizedString(@"Valid VNC password required to start server")]]; return nil; } break; } if (automaticReverseHost.length) { [argv addObject:@"-connectHost"]; [argv addObject:automaticReverseHost]; if (automaticReversePort.intValue) { [argv addObject:@"-connectPort"]; [argv addObject: automaticReversePort]; } } if (limitToLocalConnections.state) [argv addObject:@"-localhost"]; } if (alwaysShared) [argv addObject:@"-alwaysshared"]; if (neverShared) [argv addObject:@"-nevershared"]; if (dontDisconnectCheckbox.state && !alwaysShared) [argv addObject:@"-dontdisconnect"]; if (allowSleepCheckbox.state) [argv addObject:@"-allowsleep"]; if (!allowDimmingCheckbox.state) [argv addObject:@"-nodimming"]; if (!allowScreenSaverCheckbox.state) [argv addObject:@"-disableScreenSaver"]; if (protocolVersion.titleOfSelectedItem.floatValue > 0.0) { [argv addObject:@"-protocol"]; [argv addObject:protocolVersion.titleOfSelectedItem]; } [argv addObject:@"-restartonuserswitch"]; [argv addObject:(terminateOnFastUserSwitch.state ? @"Y" : @"N")]; switch (keyboardLayout.selectedItem.tag) { case 2: [argv addObject:@"-UnicodeKeyboard"]; [argv addObject:@"1"]; [argv addObject:@"-keyboardLoading"]; [argv addObject:@"N"]; [argv addObject:@"-pressModsForKeys"]; [argv addObject:@"Y"]; break; case 1: [argv addObject:@"-UnicodeKeyboard"]; [argv addObject:@"0"]; [argv addObject:@"-keyboardLoading"]; [argv addObject:@"Y"]; [argv addObject:@"-pressModsForKeys"]; [argv addObject:@"Y"]; break; case 0: default: [argv addObject:@"-UnicodeKeyboard"]; [argv addObject:@"0"]; [argv addObject:@"-keyboardLoading"]; [argv addObject:@"N"]; [argv addObject:@"-pressModsForKeys"]; [argv addObject:@"N"]; break; } [argv addObject:@"-EventTap"]; [argv addObject:[NSString stringWithFormat:@"%ld", keyboardEvents.selectedItem.tag]]; [argv addObject:@"-EventSource"]; [argv addObject:[NSString stringWithFormat:@"%ld", eventSourcePopup.selectedItem.tag]]; if (swapMouseButtonsCheckbox.state) [argv addObject:@"-swapButtons"]; if (disableRemoteEventsCheckbox.state) [argv addObject:@"-disableRemoteEvents"]; if (disableRichClipboardCheckbox.state) [argv addObject:@"-disableRichClipboards"]; [argv addObject:@"-rendezvous"]; [argv addObject:(allowRendezvousCheckbox.state ? @"Y" : @"N")]; if ([[NSUserDefaults standardUserDefaults] objectForKey:@"rfbDeferUpdateTime"]) { [argv addObject:@"-deferupdate"]; [argv addObject:[[NSUserDefaults standardUserDefaults] stringForKey:@"rfbDeferUpdateTime"]]; } if (otherArguments.stringValue.length) [argv addObjectsFromArray:[otherArguments.stringValue componentsSeparatedByString:@" "]]; return argv; } - (void)controlTextDidChange:(NSNotification *)aNotification { if ([aNotification.object isKindOfClass:[NSControl class]]) { if ([aNotification.object target] && ([aNotification.object action] != NULL)) { [[aNotification.object target] performSelector: [aNotification.object action] withObject: aNotification.object]; } } } - (IBAction) validateInitialAuthentication: sender { NSString *passwordString = initialPasswordText.stringValue; if (sender == initialPasswordText && passwordString.length) { [initialAuthenticationType selectCellWithTag:1]; [initialDoneButton setEnabled: TRUE]; } else if (sender == initialAuthenticationType) { long newAuth = (initialAuthenticationType.selectedCell).tag; if (newAuth == 1) { initialPasswordText.stringValue = @""; [initialDoneButton setEnabled: FALSE]; [initialPasswordText.window makeFirstResponder: initialPasswordText]; } // No Auth else { //if (newAuth == 2) { initialPasswordText.stringValue = @""; [initialPasswordText.window makeFirstResponder: nil]; [initialDoneButton setEnabled: TRUE]; } } else { [initialDoneButton setEnabled: FALSE]; } } - (IBAction) setInitialAuthentication: sender { NSString *passwordString = initialPasswordText.stringValue; long newAuth = (initialAuthenticationType.selectedCell).tag; // VNC Password if (newAuth == 1) { [[NSUserDefaults standardUserDefaults] setObject:[NSData dataWithBytes:(const void *)vncEncryptPasswd(passwordString.UTF8String) length:8] forKey:@"vncauth"]; } // No Auth else if (newAuth == 2) { [[NSFileManager defaultManager] removeItemAtPath:passwordFile error:NULL]; [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"vncauth"]; passwordField.stringValue = @""; } [[NSUserDefaults standardUserDefaults] setInteger:(initialAuthenticationType.selectedCell).tag forKey:@"AuthenticationType"]; [self loadAuthenticationUI]; [initialWindow orderOut:self]; [NSApp endSheet: initialWindow]; if (startServerOnLaunchCheckbox.state) [self startServer: self]; } - (void) changeDisplayNumber: sender { [self loadUIForPort: displayNumberField.selectedItem.tag]; if (sender != self) { [self saveUserDefaults: self]; [self checkForRestart]; } } - (void) changePort: sender { [self loadUIForPort: portField.intValue]; if (sender != self) { [self saveUserDefaults: self]; [self checkForRestart]; } } - (void) changeSharing: sender { long selected = (sharingMatrix.selectedCell).tag; if (selected == 1) { // Always shared. alwaysShared = TRUE; neverShared = FALSE; [dontDisconnectCheckbox setEnabled:NO]; } else if (selected == 2) { // Never shared. alwaysShared = FALSE; neverShared = TRUE; [dontDisconnectCheckbox setEnabled:YES]; } else { // Not always or never shared. alwaysShared = FALSE; neverShared = FALSE; [dontDisconnectCheckbox setEnabled:YES]; } if (sender != self) { [self saveUserDefaults: self]; [self checkForRestart]; } } - (IBAction) changeAuthenticationType: sender { long newAuth = (authenticationType.selectedCell).tag; if (newAuth != [[NSUserDefaults standardUserDefaults] integerForKey:@"AuthenticationType"]) { // VNC Password if (newAuth == 1) { passwordField.stringValue = @""; [preferenceWindow makeFirstResponder: passwordField]; } // No Auth else if (newAuth == 2) { [[NSFileManager defaultManager] removeItemAtPath:passwordFile error:NULL]; [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"vncauth"]; passwordField.stringValue = @""; [preferenceWindow makeFirstResponder: nil]; } if (sender != self) { [self saveUserDefaults: self]; [self checkForRestart]; } } } - (void) changePassword: sender { NSString *passwordString = [sender stringValue]; if (passwordString.length && ![passwordString isEqualToString:PasswordProxy]) { [authenticationType selectCellWithTag:1]; [[NSUserDefaults standardUserDefaults] setObject:[NSData dataWithBytes:(const void *)vncEncryptPasswd(passwordString.UTF8String) length:8] forKey:@"vncauth"]; if (sender != self) { [self saveUserDefaults: self]; [self checkForRestart]; } } } - (IBAction) changeDisplayName: sender { if (![displayNameField.stringValue isEqualToString:[[NSUserDefaults standardUserDefaults] objectForKey:@"desktopName"]] && sender != self) { [self saveUserDefaults: self]; statusWindow.title = [NSString stringWithFormat:@"%@: %@", [NSBundle mainBundle].infoDictionary[@"CFBundleName"], displayNameField.stringValue]; [self checkForRestart]; } } - (IBAction) optionChanged: sender { if (sender != self) { [self saveUserDefaults: sender]; [self checkForRestart]; } } - (void) changeSystemServerPort: sender { if (sender == systemServerPortField) [self loadUIForSystemServerPort: systemServerPortField.intValue]; else [self loadUIForSystemServerPort: systemServerDisplayNumberField.selectedItem.tag]; [self saveUserDefaults: self]; } - (IBAction) changeSystemServerAuthentication: sender { NSString *passwordString = systemServerPasswordField.stringValue; long sysServerAuthType = (systemServerAuthenticationType.selectedCell).tag; if (sender == systemServerPasswordField && passwordString.length && ![passwordString isEqualToString:PasswordProxy]) { char *encPassword = vncEncryptPasswd(passwordString.UTF8String); [systemServerAuthenticationType selectCellWithTag:1]; [[NSUserDefaults standardUserDefaults] setObject:[NSData dataWithBytes:(const void *)encPassword length:8] forKey:@"vncauthSystemServer"]; } if (sender == systemServerAuthenticationType && sysServerAuthType != [[NSUserDefaults standardUserDefaults] integerForKey:@"AuthenticationTypeSystemServer"]) { // VNC Password [[NSUserDefaults standardUserDefaults] setInteger:sysServerAuthType forKey:@"AuthenticationTypeSystemServer"]; if (sysServerAuthType == 1) { systemServerPasswordField.stringValue = @""; [systemServerWindow makeFirstResponder: systemServerPasswordField]; } // No Auth else if (sysServerAuthType == 2) { [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"vncauthSystemServer"]; systemServerPasswordField.stringValue = @""; [systemServerWindow makeFirstResponder: nil]; } } } // Bring up the Reverse Connection Window In A Sheet... - (IBAction) reverseConnection: sender { reverseConnectionMessageField.stringValue = @""; [NSApp beginSheet:reverseConnectionWindow modalForWindow:statusWindow modalDelegate:self didEndSelector:NULL contextInfo:NULL]; } - (IBAction) cancelConnectHost: sender { [NSApp endSheet: reverseConnectionWindow]; [reverseConnectionWindow orderOut:self]; } // This will issue a Distributed Notification to add a VNC client - (IBAction) connectHost: sender { NSMutableDictionary *argumentsDict = [NSMutableDictionary dictionaryWithObjectsAndKeys:connectHost.stringValue,@"ConnectHost",connectPort.stringValue,@"ConnectPort",nil]; if (!connectHost.stringValue.length) { [reverseConnectionMessageField setStringValue:LocalizedString(@"Please specify a Connect Host to establish a connection")]; return; } if (!connectPort.intValue) { argumentsDict[@"ConnectPort"] = @"5500"; } if (!controller) { [self startServer: self]; usleep(500000); // Give that server time to start } [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"VNCConnectHost" object:[NSString stringWithFormat:@"OSXvnc%d", self.runningPortNum] userInfo:argumentsDict deliverImmediately:YES]; usleep(500000); // Give notification time to post if (kill(controller.processIdentifier, SIGCONT) == 0) { [self addStatusMessage: @"\n"]; [self addStatusMessage: LocalizedString(@"Connection invitation sent to Connect Host")]; } else { [self addStatusMessage: @"\n"]; [self addStatusMessage:[NSString stringWithFormat:LocalizedString(@"Error sending invitation: %s"), strerror(errno)]]; } if (statusWindow.attachedSheet == reverseConnectionWindow) { [NSApp endSheet: reverseConnectionWindow]; [reverseConnectionWindow orderOut:self]; } } - (void) checkForRestart { if (controller) { if (![statusMessageField.textStorage.string hasSuffix: LocalizedString(@"Option Change Requires a Restart")]) { [self addStatusMessage: @"\n"]; [self addStatusMessage: LocalizedString(@"Option Change Requires a Restart")]; } [preferencesMessageTestField setStringValue:LocalizedString(@"Option Change Requires a Restart")]; } } - (void) applicationWillTerminate: (NSNotification *) notification { [self stopServer: self]; [preferenceWindow endEditingFor: nil]; [statusWindow endEditingFor: nil]; [self saveUserDefaults:self]; } - (BOOL) validateMenuItem: (NSMenuItem *) menuItem { // Disable the 'start server' menu item when the server is already started. // Disable the 'stop server' menu item when the server is not running. // if ((menuItem == startServerMenuItem) && controller) { // return FALSE; // } if ((menuItem == stopServerMenuItem) && (!controller)) { return FALSE; } return TRUE; } - (IBAction) openFirewall:(id) sender { [[NSWorkspace sharedWorkspace] openFile: @"/System/Library/PreferencePanes/Security.prefPane"]; } - (IBAction) openLog:(id) sender { [[NSWorkspace sharedWorkspace] openFile:logFile]; } - (IBAction) openGPL:(id) sender { NSString *openPath = [[NSBundle mainBundle] pathForResource:@"Copying" ofType:@"rtf"]; [[NSWorkspace sharedWorkspace] openFile:openPath]; } - (IBAction) openReleaseNotes:(id) sender { NSString *openPath = [[NSBundle mainBundle] pathForResource:@"Vine Server Release Notes" ofType:@"rtf"]; [[NSWorkspace sharedWorkspace] openFile:openPath]; } - (IBAction) openFile:(id) sender { NSString *openPath = [[NSBundle mainBundle] pathForResource:[sender title] ofType:@"rtf"]; if (!openPath) { openPath = [[NSBundle mainBundle] pathForResource:[sender title] ofType:@"pdf"]; } if (!openPath) { openPath = [[NSBundle mainBundle] pathForResource:[sender title] ofType:@"txt"]; } if (!openPath) { openPath = [[NSBundle mainBundle] pathForResource:[sender title] ofType:nil]; } [[NSWorkspace sharedWorkspace] openFile:openPath]; } - (BOOL) installLaunchd { BOOL success = TRUE; NSMutableDictionary *launchdDictionary = [NSMutableDictionary dictionary]; NSString *launchdPath = [[NSUserDefaults standardUserDefaults] stringForKey:@"launchdItemLocation"]; NSString *logLocation = @"/Library/Logs/VineServer.log"; NSString *oldPasswordFile = passwordFile; NSData *vncauth = [[NSUserDefaults standardUserDefaults] dataForKey:@"vncauthSystemServer"]; NSString *launchdResources = @"/Library/Application Support/VineServer"; // If VineServer resources directory doesn't exist then create it if (![[NSFileManager defaultManager] fileExistsAtPath:launchdResources]) { success &= [myAuthorization executeCommand:@"/bin/mkdir" withArgs:@[@"-p", launchdResources]]; success &= [myAuthorization executeCommand:@"/usr/sbin/chown" withArgs:@[@"-R", @"root:wheel", launchdResources]]; if (!success) { [startupItemStatusMessageField setStringValue:LocalizedString(@"Error: Unable to setup VineServer folder")]; success = FALSE; } } if (vncauth.length) { passwordFile = [launchdResources stringByAppendingPathComponent: @".vinevncauth"]; [vncauth writeToFile:@"/tmp/.vinevncauth" atomically:YES]; if (![myAuthorization executeCommand:@"/bin/mv" withArgs:@[@"-f", @"/tmp/.vinevncauth", passwordFile]]) { [startupItemStatusMessageField setStringValue:LocalizedString(@"Error: Unable To Setup Password File")]; success = FALSE; } } NSMutableArray *argv = [self formCommandLineForSystemServer: YES]; passwordFile = oldPasswordFile; if (success && argv) { NSMutableArray *copyArgsArray = [NSMutableArray array]; NSString *executionPath = [[NSBundle mainBundle].bundlePath stringByAppendingPathComponent: @"Contents/MacOS/OSXvnc-server"]; // Copy Server Executable [copyArgsArray removeAllObjects]; [copyArgsArray addObject:@"-R"]; // Recursive [copyArgsArray addObject:@"-f"]; // Force Copy (overwrite existing) [copyArgsArray addObject:executionPath]; [copyArgsArray addObject:launchdResources]; if (![myAuthorization executeCommand:@"/bin/cp" withArgs:copyArgsArray]) { [startupItemStatusMessageField setStringValue:LocalizedString(@"Error: Unable to copy OSXvnc-server executable")]; return FALSE; } // Copy All Bundles NSEnumerator *bundleEnum = [[NSBundle pathsForResourcesOfType:@"bundle" inDirectory:[NSBundle mainBundle].resourcePath] objectEnumerator]; NSString *bundlePath = nil; while (bundlePath = [bundleEnum nextObject]) { [copyArgsArray removeAllObjects]; [copyArgsArray addObject:@"-R"]; // Recursive [copyArgsArray addObject:@"-f"]; // Force Copy (overwrite existing) [copyArgsArray addObject:bundlePath]; [copyArgsArray addObject:[launchdResources stringByAppendingPathComponent:@"Resources"]]; if (![myAuthorization executeCommand:@"/bin/cp" withArgs:copyArgsArray]) { startupItemStatusMessageField.stringValue = [NSString stringWithFormat:@"Error: Unable to copy bundle:%@", bundlePath.lastPathComponent]; return FALSE; } } success &= [myAuthorization executeCommand:@"/bin/chmod" withArgs:@[@"-R", @"755", launchdResources]]; // Configure PLIST launchdDictionary[@"Label"] = @"VineServer"; [argv insertObject:[launchdResources stringByAppendingPathComponent:@"OSXvnc-server"] atIndex:0]; launchdDictionary[@"ProgramArguments"] = argv; launchdDictionary[@"KeepAlive"] = [NSNumber numberWithBool:TRUE]; launchdDictionary[@"RunAtLoad"] = [NSNumber numberWithBool:TRUE]; //[launchdDictionary setObject:[NSNumber numberWithInt:1] forKey:@"ExitTimeOut"]; // Send a KILL signal after 1 second launchdDictionary[@"StandardOutPath"] = logLocation; launchdDictionary[@"StandardErrorPath"] = logLocation; launchdDictionary[@"LimitLoadToSessionType"] = @[@"Aqua",@"LoginWindow"]; // Write to file NSString *tempPath = [@"/tmp" stringByAppendingPathComponent:launchdPath.lastPathComponent]; [launchdDictionary writeToFile:tempPath atomically:NO]; success &= [myAuthorization executeCommand:@"/usr/sbin/chown" withArgs:@[@"-R", @"root:wheel", tempPath]]; success &= [myAuthorization executeCommand:@"/bin/chmod" withArgs:@[@"-R", @"744", tempPath]]; // Install to launchdPath success &= [myAuthorization executeCommand:@"/bin/mv" withArgs:@[@"-f", tempPath, launchdPath]]; //Setup Log File (for multiple user access) success &= [myAuthorization executeCommand:@"/usr/bin/touch" withArgs:@[logLocation]]; success &= [myAuthorization executeCommand:@"/usr/sbin/chown" withArgs:@[@"-R", @"root:wheel", logLocation]]; success &= [myAuthorization executeCommand:@"/bin/chmod" withArgs:@[@"-R", @"666", logLocation]]; // Launch Using launchctl success &= [myAuthorization executeCommand:@"/bin/launchctl" withArgs:@[@"load", @"-S", @"Aqua", launchdPath]]; if (!success) { [startupItemStatusMessageField setStringValue:LocalizedString(@"Error: Unable To Setup Vine Server using launchd")]; } } return success; } - (void) installAsService { if (!myAuthorization) myAuthorization = [[NSAuthorization alloc] init]; if (!myAuthorization) { [startupItemStatusMessageField setStringValue:LocalizedString(@"Error: No Authorization")]; return; } // Remove Old SystemServer [self removeService: self]; systemServerIsConfigured = [self installLaunchd]; [self loadUIForSystemServer]; [myAuthorization release]; myAuthorization = nil; } - (IBAction) installAsService: sender { // No password, so double check if (!passwordField.stringValue.length) { NSBeginAlertSheet(LocalizedString(@"System Server"), LocalizedString(@"Cancel"), LocalizedString(@"Start Server"), nil, systemServerWindow, self, @selector(serviceSheetDidEnd:returnCode:contextInfo:), NULL, NULL, @"%@", LocalizedString(@"No password has been specified for the System Server. The System Server will automatic launch every time your machine is restarted. Are you sure that you want to install a System Server with no password")); } else { [self installAsService]; } } - (void) serviceSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { if (returnCode==NSAlertDefaultReturn) return; else [self installAsService]; } - (IBAction) removeService: sender { BOOL success = TRUE; NSString *startupPath = [[NSUserDefaults standardUserDefaults] stringForKey:@"startupItemLocation"]; NSString *launchdPath = [[NSUserDefaults standardUserDefaults] stringForKey:@"launchdItemLocation"]; if (!myAuthorization) myAuthorization = [[NSAuthorization alloc] init]; if (!myAuthorization) { [startupItemStatusMessageField setStringValue:LocalizedString(@"Error: No Authorization")]; return; } if ([[NSFileManager defaultManager] fileExistsAtPath: startupPath]) { // Kill any running system servers, necessary since old OSXvnc scripts don't work on Leopard success &= [myAuthorization executeCommand:[NSString stringWithFormat:@"%@/OSXvnc/OSXvnc", [NSBundle mainBundle].resourcePath] withArgs:@[@"stop"]]; success &= [myAuthorization executeCommand:@"/bin/rm" withArgs:@[@"-r", @"-f", startupPath]]; } if ([[NSFileManager defaultManager] fileExistsAtPath:launchdPath]) { success &= [myAuthorization executeCommand:@"/bin/launchctl" withArgs:@[@"unload", @"-S", @"Aqua", launchdPath]]; success &= [myAuthorization executeCommand:@"/bin/rm" withArgs:@[@"-r", @"-f", launchdPath]]; } if (success) { systemServerIsConfigured = FALSE; [self loadUIForSystemServer]; } else { [startupItemStatusMessageField setStringValue:LocalizedString(@"Error: Unabled to remove startup item")]; } if (sender != self) { [myAuthorization release]; myAuthorization = nil; } } - (void) dealloc { [passwordFile release]; [logFile release]; [myAuthorization release]; myAuthorization = nil; [bundleArray release]; bundleArray = nil; [super dealloc]; } @end ================================================ FILE: Version.txt ================================================ 5.3.1 ================================================ FILE: VineServer-Info.plist ================================================ CFBundleDevelopmentRegion English CFBundleExecutable ${EXECUTABLE_NAME} CFBundleGetInfoString __PRODUCT_VERSION__ - (C) 2013 TestPlant, Inc., (C) __YEAR__ Stefan Weil CFBundleIconFile VineServer.icns CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName Vine Server CFBundlePackageType APPL CFBundleShortVersion __PRODUCT_VERSION__ CFBundleShortVersionString __PRODUCT_VERSION__ CFBundleSignature vncS CFBundleVersion __BUILD_VERSION__ LSApplicationCategoryType public.app-category.utilities NSHelpFile Vine Server.pdf NSHighResolutionCapable NSHumanReadableCopyright © __YEAR__ Stefan Weil NSMainNibFile MainMenu NSPrincipalClass NSApplication ReverseHost ReversePort ================================================ FILE: build-libjpeg-turbo.sh ================================================ #!/bin/sh set -e export CFLAGS="-mmacosx-version-min=10.11 -Wall" CMAKE_BUILD_TYPE=Release NUMCPUS=$(sysctl -n hw.ncpu) MACOSX_DEPLOYMENT_TARGET=10.11 export MACOSX_DEPLOYMENT_TARGET # Get submodule libjepg-turbo. git submodule update --init libjpeg-turbo cd libjpeg-turbo mkdir -p macosarmv8 pushd macosarmv8 cmake .. -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_OSX_ARCHITECTURES=arm64 make -j $NUMCPUS popd mkdir -p macosx8664 pushd macosx8664 cmake .. -DARMV8_BUILD=../macosarmv8 -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_OSX_ARCHITECTURES=x86_64 make -j $NUMCPUS popd ln -sf macosarmv8/jconfig.h . ================================================ FILE: de.lproj/Copying.rtf ================================================ {\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf410 {\fonttbl\f0\fswiss\fcharset77 Helvetica;\f1\froman\fcharset77 Times-Roman;\f2\fmodern\fcharset77 Courier; \f3\fnil\fcharset77 LucidaGrande;} {\colortbl;\red255\green255\blue255;} \paperw11900\paperh16840\margl1440\margr1440\vieww16260\viewh17880\viewkind0 \pard\tx1440\tx2880\tx4320\tx5760\tx7200\qc \f0\fs24 \cf0 GNU GENERAL PUBLIC LICENSE\ (Deutsche \'86bersetzung)\ \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200 \f1 \cf0 Urspr\'9fnglich erstellt im Auftrag der S.u.S.E.\'caGmbH \'d0 \f2 http://www.suse.de \f3 \f1 von Katja Lachmann \'86bersetzungen, \f3 \uc0\u8232 \f1 \'9fberarbeitet von {\field{\*\fldinst{HYPERLINK "http://www.peter.gerwinski.de/"}}{\fldrslt Peter Gerwinski}}, G-N-U GmbH \'d0 \f2 http://www.g-n-u.de \f3 \f1 (31.\'caOktober 1996, 4.\'caJuni 2000)\ \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural \f2 \cf0 \ \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural \f1 \cf0 Diese \'86bersetzung wird mit der Absicht angeboten, das Verst\'8andnis der GNU General Public License (GNU GPL) zu erleichtern. Es handelt sich jedoch nicht um eine offizielle oder im rechtlichen Sinne anerkannte \'86bersetzung.\ Die Free Software Foundation (FSF) ist nicht der Herausgeber dieser \'86bersetzung, und sie hat diese \'86bersetzung auch nicht als rechtskr\'8aftigen Ersatz f\'9fr die Original-GNU-GPL anerkannt. Da die \'86bersetzung nicht sorgf\'8altig von Anw\'8alten \'9fberpr\'9fft wurde, k\'9annen die \'86bersetzer nicht garantieren, da\'a7 die \'86bersetzung die rechtlichen Aussagen der GNU GPL exakt wiedergibt. Wenn Sie sichergehen wollen, da\'a7 von Ihnen geplante Aktivit\'8aten im Sinne der GNU GPL gestattet sind, halten Sie sich bitte an die {\field{\*\fldinst{HYPERLINK "http://www.gnu.org/licenses/gpl.html"}}{\fldrslt englischsprachige Originalversion}}.\ Die \'86bersetzer und die Free Software Foundation m\'9achten Sie darum bitten, diese \'86bersetzung nicht als offizielle Lizenzbedingungen f\'9fr von Ihnen geschriebene Programme zu verwenden. Bitte benutzen Sie hierf\'9fr stattdessen die von der Free Software Foundation herausgegebene {\field{\*\fldinst{HYPERLINK "http://www.gnu.org/licenses/gpl.html"}}{\fldrslt englischsprachige Originalversion}}.\ \f2 \ \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\qc \f0 \cf0 GNU GENERAL PUBLIC LICENSE\ \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\qc\pardirnatural \f1 \cf0 Deutsche \'86bersetzung der Version 2, Juni 1991\ \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural \cf0 \ Copyright \'a9 1989, 1991\ Free Software Foundation, Inc. \f3 \uc0\u8232 \f1 51 Franklin St, Fifth Floor, Boston, MA 02110, USA\ \ Es ist jedermann gestattet, diese Lizenzurkunde zu vervielf\'8altigen und unver\'8anderte Kopien zu verbreiten; \'80nderungen sind jedoch nicht erlaubt.\ Diese \'86bersetzung ist kein rechtskr\'8aftiger Ersatz f\'9fr die {\field{\*\fldinst{HYPERLINK "http://www.gnu.org/licenses/gpl.html"}}{\fldrslt englischsprachige Originalversion}}!\ \ \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\qc\pardirnatural \cf0 Vorwort\ \ \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural \cf0 Die meisten Softwarelizenzen sind daraufhin entworfen worden, Ihnen die Freiheit zu nehmen, die Software weiterzugeben und zu ver\'8andern. Im Gegensatz dazu soll Ihnen die GNU General Public License, die Allgemeine \'85ffentliche GNU-Lizenz, ebendiese Freiheit garantieren. Sie soll sicherstellen, da\'a7 die Software f\'9fr alle Benutzer frei ist. Diese Lizenz gilt f\'9fr den Gro\'a7teil der von der Free Software Foundation herausgegebenen Software und f\'9fr alle anderen Programme, deren Autoren ihr Datenwerk dieser Lizenz unterstellt haben. Auch Sie k\'9annen diese M\'9aglichkeit der Lizenzierung f\'9fr Ihre Programme anwenden. (Ein anderer Teil der Software der Free Software Foundation unterliegt stattdessen der GNU Library General Public License, der Allgemeinen \'85ffentlichen GNU-Lizenz f\'9fr Bibliotheken.) [Mittlerweile wurde die GNU Library Public License von der GNU Lesser Public License abgel\'9ast \'d0 Anmerkung des \'86bersetzers.]\ \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural \cf0 Die Bezeichnung \'e3freie\'d2 Software bezieht sich auf Freiheit, nicht auf den Preis. Unsere Lizenzen sollen Ihnen die Freiheit garantieren, Kopien freier Software zu verbreiten (und etwas f\'9fr diesen Service zu berechnen, wenn Sie m\'9achten), die M\'9aglichkeit, die Software im Quelltext zu erhalten oder den Quelltext auf Wunsch zu bekommen. Die Lizenzen sollen garantieren, da\'a7 Sie die Software \'8andern oder Teile davon in neuen freien Programmen verwenden d\'9frfen \'d0 und da\'a7 Sie wissen, da\'a7 Sie dies alles tun d\'9frfen.\ Um Ihre Rechte zu sch\'9ftzen, m\'9fssen wir Einschr\'8ankungen machen, die es jedem verbieten, Ihnen diese Rechte zu verweigern oder Sie aufzufordern, auf diese Rechte zu verzichten. Aus diesen Einschr\'8ankungen folgen bestimmte Verantwortlichkeiten f\'9fr Sie, wenn Sie Kopien der Software verbreiten oder sie ver\'8andern.\ Beispielsweise m\'9fssen Sie den Empf\'8angern alle Rechte gew\'8ahren, die Sie selbst haben, wenn Sie \'d0 kostenlos oder gegen Bezahlung \'d0 Kopien eines solchen Programms verbreiten. Sie m\'9fssen sicherstellen, da\'a7 auch die Empf\'8anger den Quelltext erhalten bzw.\'caerhalten k\'9annen. Und Sie m\'9fssen ihnen diese Bedingungen zeigen, damit sie ihre Rechte kennen.\ Wir sch\'9ftzen Ihre Rechte in zwei Schritten: (1) Wir stellen die Software unter ein Urheberrecht (Copyright), und (2) wir bieten Ihnen diese Lizenz an, die Ihnen das Recht gibt, die Software zu vervielf\'8altigen, zu verbreiten und/oder zu ver\'8andern.\ Um die Autoren und uns zu sch\'9ftzen, wollen wir dar\'9fberhinaus sicherstellen, da\'a7 jeder erf\'8ahrt, da\'a7 f\'9fr diese freie Software keinerlei Garantie besteht. Wenn die Software von jemand anderem modifiziert und weitergegeben wird, m\'9achten wir, da\'a7 die Empf\'8anger wissen, da\'a7 sie nicht das Original erhalten haben, damit irgendwelche von anderen verursachte Probleme nicht den Ruf des urspr\'9fnglichen Autors sch\'8adigen.\ Schlie\'a7lich und endlich ist jedes freie Programm permanent durch Software-Patente bedroht. Wir m\'9achten die Gefahr ausschlie\'a7en, da\'a7 Distributoren eines freien Programms individuell Patente lizensieren \'d0 mit dem Ergebnis, da\'a7 das Programm propriet\'8ar w\'9frde. Um dies zu verhindern, haben wir klargestellt, da\'a7 jedes Patent entweder f\'9fr freie Benutzung durch jedermann lizenziert werden mu\'a7 oder \'9fberhaupt nicht lizenziert werden darf.\ Es folgen die genauen Bedingungen f\'9fr die Vervielf\'8altigung, Verbreitung und Bearbeitung:\ \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\qc\pardirnatural \cf0 \ Allgemeine \'85ffentliche GNU-Lizenz \f3 \uc0\u8232 \f1 Bedingungen f\'9fr die Vervielf\'8altigung, \f3 \uc0\u8232 \f1 Verbreitung und Bearbeitung\ \ \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural \cf0 \'a40. Diese Lizenz gilt f\'9fr jedes Programm und jedes andere Datenwerk, in dem ein entsprechender Vermerk des Copyright-Inhabers darauf hinweist, da\'a7 das Datenwerk unter den Bestimmungen dieser General Public License verbreitet werden darf. Im folgenden wird jedes derartige Programm oder Datenwerk als \'e3das Programm\'d2 bezeichnet; die Formulierung \'e3auf dem Programm basierendes Datenwerk\'d2 bezeichnet das Programm sowie jegliche Bearbeitung des Programms im urheberrechtlichen Sinne, also ein Datenwerk, welches das Programm, auch auszugsweise, sei es unver\'8andert oder ver\'8andert und/oder in eine andere Sprache \'9fbersetzt, enth\'8alt. (Im folgenden wird die \'86bersetzung ohne Einschr\'8ankung als \'e3Bearbeitung\'d2 eingestuft.) Jeder Lizenznehmer wird im folgenden als \'e3Sie\'d2 angesprochen.\ Andere Handlungen als Vervielf\'8altigung, Verbreitung und Bearbeitung werden von dieser Lizenz nicht ber\'9fhrt; sie fallen nicht in ihren Anwendungsbereich. Der Vorgang der Ausf\'9fhrung des Programms wird nicht eingeschr\'8ankt, und die Ausgaben des Programms unterliegen dieser Lizenz nur, wenn der Inhalt ein auf dem Programm basierendes Datenwerk darstellt (unabh\'8angig davon, da\'a7 die Ausgabe durch die Ausf\'9fhrung des Programmes erfolgte). Ob dies zutrifft, h\'8angt von den Funktionen des Programms ab.\ \'a41. Sie d\'9frfen auf beliebigen Medien unver\'8anderte Kopien des Quelltextes des Programms, wie sie ihn erhalten haben, anfertigen und verbreiten. Voraussetzung hierf\'9fr ist, da\'a7 Sie mit jeder Kopie einen entsprechenden Copyright-Vermerk sowie einen Haftungsausschlu\'a7 ver\'9affentlichen, alle Vermerke, die sich auf diese Lizenz und das Fehlen einer Garantie beziehen, unver\'8andert lassen und desweiteren allen anderen Empf\'8angern des Programms zusammen mit dem Programm eine Kopie dieser Lizenz zukommen lassen.\ Sie d\'9frfen f\'9fr den eigentlichen Kopiervorgang eine Geb\'9fhr verlangen. Wenn Sie es w\'9fnschen, d\'9frfen Sie auch gegen Entgelt eine Garantie f\'9fr das Programm anbieten.\ \'a42. Sie d\'9frfen Ihre Kopie(n) des Programms oder eines Teils davon ver\'8andern, wodurch ein auf dem Programm basierendes Datenwerk entsteht; Sie d\'9frfen derartige Bearbeitungen unter den Bestimmungen von Paragraph 1 vervielf\'8altigen und verbreiten, vorausgesetzt, da\'a7 zus\'8atzlich alle im folgenden genannten Bedingungen erf\'9fllt werden:\ 1. Sie m\'9fssen die ver\'8anderten Dateien mit einem auff\'8alligen Vermerk versehen, der auf die von Ihnen vorgenommene Modifizierung und das Datum jeder \'80nderung hinweist.\ 2. Sie m\'9fssen daf\'9fr sorgen, da\'a7 jede von Ihnen verbreitete oder ver\'9affentlichte Arbeit, die ganz oder teilweise von dem Programm oder Teilen davon abgeleitet ist, Dritten gegen\'9fber als Ganzes unter den Bedingungen dieser Lizenz ohne Lizenzgeb\'9fhren zur Verf\'9fgung gestellt wird.\ 3. Wenn das ver\'8anderte Programm normalerweise bei der Ausf\'9fhrung interaktiv Kommandos einliest, m\'9fssen Sie daf\'9fr sorgen, da\'a7 es, wenn es auf dem \'9fblichsten Wege f\'9fr solche interaktive Nutzung gestartet wird, eine Meldung ausgibt oder ausdruckt, die einen geeigneten Copyright-Vermerk enth\'8alt sowie einen Hinweis, da\'a7 es keine Gew\'8ahrleistung gibt (oder anderenfalls, da\'a7 Sie Garantie leisten), und da\'a7 die Benutzer das Programm unter diesen Bedingungen weiter verbreiten d\'9frfen. Auch mu\'a7 der Benutzer darauf hingewiesen werden, wie er eine Kopie dieser Lizenz ansehen kann. (Ausnahme: Wenn das Programm selbst interaktiv arbeitet, aber normalerweise keine derartige Meldung ausgibt, mu\'a7 Ihr auf dem Programm basierendes Datenwerk auch keine solche Meldung ausgeben).\ Diese Anforderungen gelten f\'9fr das bearbeitete Datenwerk als Ganzes. Wenn identifizierbare Teile des Datenwerkes nicht von dem Programm abgeleitet sind und vern\'9fnftigerweise als unabh\'8angige und eigenst\'8andige Datenwerke f\'9fr sich selbst zu betrachten sind, dann gelten diese Lizenz und ihre Bedingungen nicht f\'9fr die betroffenen Teile, wenn Sie diese als eigenst\'8andige Datenwerke weitergeben. Wenn Sie jedoch dieselben Abschnitte als Teil eines Ganzen weitergeben, das ein auf dem Programm basierendes Datenwerk darstellt, dann mu\'a7 die Weitergabe des Ganzen nach den Bedingungen dieser Lizenz erfolgen, deren Bedingungen f\'9fr weitere Lizenznehmer somit auf das gesamte Ganze ausgedehnt werden \'d0 und somit auf jeden einzelnen Teil, unabh\'8angig vom jeweiligen Autor.\ Somit ist es nicht die Absicht dieses Abschnittes, Rechte f\'9fr Datenwerke in Anspruch zu nehmen oder Ihnen die Rechte f\'9fr Datenwerke streitig zu machen, die komplett von Ihnen geschrieben wurden; vielmehr ist es die Absicht, die Rechte zur Kontrolle der Verbreitung von Datenwerken, die auf dem Programm basieren oder unter seiner auszugsweisen Verwendung zusammengestellt worden sind, auszu\'9fben.\ Ferner bringt auch das einfache Zusammenlegen eines anderen Datenwerkes, das nicht auf dem Programm basiert, mit dem Programm oder einem auf dem Programm basierenden Datenwerk auf ein- und demselben Speicher- oder Vertriebsmedium dieses andere Datenwerk nicht in den Anwendungsbereich dieser Lizenz.\ \'a43. Sie d\'9frfen das Programm (oder ein darauf basierendes Datenwerk gem\'8a\'a7 Paragraph 2) als Objectcode oder in ausf\'9fhrbarer Form unter den Bedingungen der Paragraphen 1 und 2 kopieren und weitergeben \'d0 vorausgesetzt, da\'a7 Sie au\'a7erdem eine der folgenden Leistungen erbringen:\ 1. Liefern Sie das Programm zusammen mit dem vollst\'8andigen zugeh\'9arigen maschinenlesbaren Quelltext auf einem f\'9fr den Datenaustausch \'9fblichen Medium aus, wobei die Verteilung unter den Bedingungen der Paragraphen 1 und 2 erfolgen mu\'a7. Oder:\ 2. Liefern Sie das Programm zusammen mit einem mindestens drei Jahre lang g\'9fltigen schriftlichen Angebot aus, jedem Dritten eine vollst\'8andige maschinenlesbare Kopie des Quelltextes zur Verf\'9fgung zu stellen \'d0 zu nicht h\'9aheren Kosten als denen, die durch den physikalischen Kopiervorgang anfallen \'d0, wobei der Quelltext unter den Bedingungen der Paragraphen 1 und 2 auf einem f\'9fr den Datenaustausch \'9fblichen Medium weitergegeben wird. Oder:\ 3. Liefern Sie das Programm zusammen mit dem schriftlichen Angebot der Zurverf\'9fgungstellung des Quelltextes aus, das Sie selbst erhalten haben. (Diese Alternative ist nur f\'9fr nicht-kommerzielle Verbreitung zul\'8assig und nur, wenn Sie das Programm als Objectcode oder in ausf\'9fhrbarer Form mit einem entsprechenden Angebot gem\'8a\'a7 Absatz b erhalten haben.)\ Unter dem Quelltext eines Datenwerkes wird diejenige Form des Datenwerkes verstanden, die f\'9fr Bearbeitungen vorzugsweise verwendet wird. F\'9fr ein ausf\'9fhrbares Programm bedeutet \'e3der komplette Quelltext\'d2: Der Quelltext aller im Programm enthaltenen Module einschlie\'a7lich aller zugeh\'9arigen Modulschnittstellen-Definitionsdateien sowie der zur Compilation und Installation verwendeten Skripte. Als besondere Ausnahme jedoch braucht der verteilte Quelltext nichts von dem zu enthalten, was \'9fblicherweise (entweder als Quelltext oder in bin\'8arer Form) zusammen mit den Hauptkomponenten des Betriebssystems (Kernel, Compiler usw.) geliefert wird, unter dem das Programm l\'8auft \'d0 es sei denn, diese Komponente selbst geh\'9art zum ausf\'9fhrbaren Programm.\ Wenn die Verbreitung eines ausf\'9fhrbaren Programms oder von Objectcode dadurch erfolgt, da\'a7 der Kopierzugriff auf eine daf\'9fr vorgesehene Stelle gew\'8ahrt wird, so gilt die Gew\'8ahrung eines gleichwertigen Zugriffs auf den Quelltext als Verbreitung des Quelltextes, auch wenn Dritte nicht dazu gezwungen sind, den Quelltext zusammen mit dem Objectcode zu kopieren.\ \'a44. Sie d\'9frfen das Programm nicht vervielf\'8altigen, ver\'8andern, weiter lizenzieren oder verbreiten, sofern es nicht durch diese Lizenz ausdr\'9fcklich gestattet ist. Jeder anderweitige Versuch der Vervielf\'8altigung, Modifizierung, Weiterlizenzierung und Verbreitung ist nichtig und beendet automatisch Ihre Rechte unter dieser Lizenz. Jedoch werden die Lizenzen Dritter, die von Ihnen Kopien oder Rechte unter dieser Lizenz erhalten haben, nicht beendet, solange diese die Lizenz voll anerkennen und befolgen.\ \'a45. Sie sind nicht verpflichtet, diese Lizenz anzunehmen, da Sie sie nicht unterzeichnet haben. Jedoch gibt Ihnen nichts anderes die Erlaubnis, das Programm oder von ihm abgeleitete Datenwerke zu ver\'8andern oder zu verbreiten. Diese Handlungen sind gesetzlich verboten, wenn Sie diese Lizenz nicht anerkennen. Indem Sie das Programm (oder ein darauf basierendes Datenwerk) ver\'8andern oder verbreiten, erkl\'8aren Sie Ihr Einverst\'8andnis mit dieser Lizenz und mit allen ihren Bedingungen bez\'9fglich der Vervielf\'8altigung, Verbreitung und Ver\'8anderung des Programms oder eines darauf basierenden Datenwerks.\ \'a46. Jedesmal, wenn Sie das Programm (oder ein auf dem Programm basierendes Datenwerk) weitergeben, erh\'8alt der Empf\'8anger automatisch vom urspr\'9fnglichen Lizenzgeber die Lizenz, das Programm entsprechend den hier festgelegten Bestimmungen zu vervielf\'8altigen, zu verbreiten und zu ver\'8andern. Sie d\'9frfen keine weiteren Einschr\'8ankungen der Durchsetzung der hierin zugestandenen Rechte des Empf\'8angers vornehmen. Sie sind nicht daf\'9fr verantwortlich, die Einhaltung dieser Lizenz durch Dritte durchzusetzen.\ \'a47. Sollten Ihnen infolge eines Gerichtsurteils, des Vorwurfs einer Patentverletzung oder aus einem anderen Grunde (nicht auf Patentfragen begrenzt) Bedingungen (durch Gerichtsbeschlu\'a7, Vergleich oder anderweitig) auferlegt werden, die den Bedingungen dieser Lizenz widersprechen, so befreien Sie diese Umst\'8ande nicht von den Bestimmungen dieser Lizenz. Wenn es Ihnen nicht m\'9aglich ist, das Programm unter gleichzeitiger Beachtung der Bedingungen in dieser Lizenz und Ihrer anderweitigen Verpflichtungen zu verbreiten, dann d\'9frfen Sie als Folge das Programm \'9fberhaupt nicht verbreiten. Wenn zum Beispiel ein Patent nicht die geb\'9fhrenfreie Weiterverbreitung des Programms durch diejenigen erlaubt, die das Programm direkt oder indirekt von Ihnen erhalten haben, dann besteht der einzige Weg, sowohl das Patentrecht als auch diese Lizenz zu befolgen, darin, ganz auf die Verbreitung des Programms zu verzichten.\ Sollte sich ein Teil dieses Paragraphen als ung\'9fltig oder unter bestimmten Umst\'8anden nicht durchsetzbar erweisen, so soll dieser Paragraph seinem Sinne nach angewandt werden; im \'9fbrigen soll dieser Paragraph als Ganzes gelten.\ Zweck dieses Paragraphen ist nicht, Sie dazu zu bringen, irgendwelche Patente oder andere Eigentumsanspr\'9fche zu verletzen oder die G\'9fltigkeit solcher Anspr\'9fche zu bestreiten; dieser Paragraph hat einzig den Zweck, die Integrit\'8at des Verbreitungssystems der freien Software zu sch\'9ftzen, das durch die Praxis \'9affentlicher Lizenzen verwirklicht wird. Viele Leute haben gro\'a7z\'9fgige Beitr\'8age zu dem gro\'a7en Angebot der mit diesem System verbreiteten Software im Vertrauen auf die konsistente Anwendung dieses Systems geleistet; es liegt am Autor/Geber, zu entscheiden, ob er die Software mittels irgendeines anderen Systems verbreiten will; ein Lizenznehmer hat auf diese Entscheidung keinen Einflu\'a7.\ Dieser Paragraph ist dazu gedacht, deutlich klarzustellen, was als Konsequenz aus dem Rest dieser Lizenz betrachtet wird.\ \'a48. Wenn die Verbreitung und/oder die Benutzung des Programms in bestimmten Staaten entweder durch Patente oder durch urheberrechtlich gesch\'9ftzte Schnittstellen eingeschr\'8ankt ist, kann der Urheberrechtsinhaber, der das Programm unter diese Lizenz gestellt hat, eine explizite geographische Begrenzung der Verbreitung angeben, in der diese Staaten ausgeschlossen werden, so da\'a7 die Verbreitung nur innerhalb und zwischen den Staaten erlaubt ist, die nicht ausgeschlossen sind. In einem solchen Fall beinhaltet diese Lizenz die Beschr\'8ankung, als w\'8are sie in diesem Text niedergeschrieben.\ \'a49. Die Free Software Foundation kann von Zeit zu Zeit \'9fberarbeitete und/oder neue Versionen der General Public License ver\'9affentlichen. Solche neuen Versionen werden vom Grundprinzip her der gegenw\'8artigen entsprechen, k\'9annen aber im Detail abweichen, um neuen Problemen und Anforderungen gerecht zu werden.\ Jede Version dieser Lizenz hat eine eindeutige Versionsnummer. Wenn in einem Programm angegeben wird, da\'a7 es dieser Lizenz in einer bestimmten Versionsnummer oder \'e3jeder sp\'8ateren Version\'d2 (\'d2any later version\'d3) unterliegt, so haben Sie die Wahl, entweder den Bestimmungen der genannten Version zu folgen oder denen jeder beliebigen sp\'8ateren Version, die von der Free Software Foundation ver\'9affentlicht wurde. Wenn das Programm keine Versionsnummer angibt, k\'9annen Sie eine beliebige Version w\'8ahlen, die je von der Free Software Foundation ver\'9affentlicht wurde.\ \'a410. Wenn Sie den Wunsch haben, Teile des Programms in anderen freien Programmen zu verwenden, deren Bedingungen f\'9fr die Verbreitung anders sind, schreiben Sie an den Autor, um ihn um die Erlaubnis zu bitten. F\'9fr Software, die unter dem Copyright der Free Software Foundation steht, schreiben Sie an die Free Software Foundation; wir machen zu diesem Zweck gelegentlich Ausnahmen. Unsere Entscheidung wird von den beiden Zielen geleitet werden, zum einen den freien Status aller von unserer freien Software abgeleiteten Datenwerke zu erhalten und zum anderen das gemeinschaftliche Nutzen und Wiederverwenden von Software im allgemeinen zu f\'9ardern.\ Keine Gew\'8ahrleistung\ \'a411. Da das Programm ohne jegliche Kosten lizenziert wird, besteht keinerlei Gew\'8ahrleistung f\'9fr das Programm, soweit dies gesetzlich zul\'8assig ist. Sofern nicht anderweitig schriftlich best\'8atigt, stellen die Copyright-Inhaber und/oder Dritte das Programm so zur Verf\'9fgung, \'e3wie es ist\'d2, ohne irgendeine Gew\'8ahrleistung, weder ausdr\'9fcklich noch implizit, einschlie\'a7lich \'d0 aber nicht begrenzt auf \'d0 Marktreife oder Verwendbarkeit f\'9fr einen bestimmten Zweck. Das volle Risiko bez\'9fglich Qualit\'8at und Leistungsf\'8ahigkeit des Programms liegt bei Ihnen. Sollte sich das Programm als fehlerhaft herausstellen, liegen die Kosten f\'9fr notwendigen Service, Reparatur oder Korrektur bei Ihnen.\ \'a412. In keinem Fall, au\'a7er wenn durch geltendes Recht gefordert oder schriftlich zugesichert, ist irgendein Copyright-Inhaber oder irgendein Dritter, der das Programm wie oben erlaubt modifiziert oder verbreitet hat, Ihnen gegen\'9fber f\'9fr irgendwelche Sch\'8aden haftbar, einschlie\'a7lich jeglicher allgemeiner oder spezieller Sch\'8aden, Sch\'8aden durch Seiteneffekte (Nebenwirkungen) oder Folgesch\'8aden, die aus der Benutzung des Programms oder der Unbenutzbarkeit des Programms folgen (einschlie\'a7lich \'d0 aber nicht beschr\'8ankt auf \'d0 Datenverluste, fehlerhafte Verarbeitung von Daten, Verluste, die von Ihnen oder anderen getragen werden m\'9fssen, oder dem Unverm\'9agen des Programms, mit irgendeinem anderen Programm zusammenzuarbeiten), selbst wenn ein Copyright-Inhaber oder Dritter \'9fber die M\'9aglichkeit solcher Sch\'8aden unterrichtet worden war.\ Ende der Bedingungen\ Anhang: Wie Sie diese Bedingungen auf Ihre eigenen, \f3 \f1 neuen Programme anwenden k\'9annen\ Wenn Sie ein neues Programm entwickeln und wollen, da\'a7 es vom gr\'9a\'a7tm\'9aglichen Nutzen f\'9fr die Allgemeinheit ist, dann erreichen Sie das am besten, indem Sie es zu freier Software machen, die jeder unter diesen Bestimmungen weiterverbreiten und ver\'8andern kann.\ Um dies zu erreichen, f\'9fgen Sie die folgenden Vermerke zu Ihrem Programm hinzu. Am sichersten ist es, sie an den Anfang einer jeden Quelldatei zu stellen, um den Gew\'8ahrleistungsausschlu\'a7 m\'9aglichst deutlich darzustellen; zumindest aber sollte jede Datei eine Copyright-Zeile besitzen sowie einen kurzen Hinweis darauf, wo die vollst\'8andigen Vermerke zu finden sind.\ \f2 [eine Zeile mit dem Programmnamen und einer kurzen Beschreibung] \f3 \uc0\u8232 \f2 Copyright (C) [Jahr]\'ca\'ca[Name des Autors] \f1 \ \f2 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. \f1 \ \f2 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. \f1 \ \f2 You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA \f1 \ Auf Deutsch:\ \f2 [eine Zeile mit dem Programmnamen und einer kurzen Beschreibung] \f3 \uc0\u8232 \f2 Copyright (C) [Jahr]\'ca\'ca[Name des Autors] \f1 \ \f2 Dieses Programm ist freie Software. Sie k\'9annen es unter den Bedingungen der GNU General Public License, wie von der Free Software Foundation ver\'9affentlicht, weitergeben und/oder modifizieren, entweder gem\'8a\'a7 Version 2 der Lizenz oder (nach Ihrer Option) jeder sp\'8ateren Version. \f1 \ \f2 Die Ver\'9affentlichung dieses Programms erfolgt in der Hoffnung, da\'a7 es Ihnen von Nutzen sein wird, aber OHNE IRGENDEINE GARANTIE, sogar ohne die implizite Garantie der MARKTREIFE oder der VERWENDBARKEIT F\'86R EINEN BESTIMMTEN ZWECK. Details finden Sie in der GNU General Public License. \f1 \ \f2 Sie sollten ein Exemplar der GNU General Public License zusammen mit diesem Programm erhalten haben. Falls nicht, schreiben Sie an die Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA. \f1 \ F\'9fgen Sie auch einen kurzen Hinweis hinzu, wie Sie elektronisch und per Brief erreichbar sind.\ Wenn Ihr Programm interaktiv ist, sorgen Sie daf\'9fr, da\'a7 es nach dem Start einen kurzen Vermerk ausgibt:\ \f2 version 69, Copyright (C) [Jahr]\'ca\'ca[Name des Autors] \f3 \uc0\u8232 \f2 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. \f1 \ Auf Deutsch:\ \f2 Version 69, Copyright (C) [Jahr]\'ca\'ca[Name des Autors] F\'9fr Gnomovision besteht KEINERLEI GARANTIE; geben Sie `show w' f\'9fr Details ein. Gnonovision ist freie Software, die Sie unter bestimmten Bedingungen weitergeben d\'9frfen; geben Sie `show c' f\'9fr Details ein. \f1 \ Die hypothetischen Kommandos \f2 `show w' \f1 und \f2 `show c' \f1 sollten die entsprechenden Teile der GNU-GPL anzeigen. Nat\'9frlich k\'9annen die von Ihnen verwendeten Kommandos anders hei\'a7en als \f2 `show w' \f1 und \f2 `show c' \f1 ; es k\'9annten auch Mausklicks oder Men\'9fpunkte sein \'d0 was immer am besten in Ihr Programm pa\'a7t.\ Soweit vorhanden, sollten Sie auch Ihren Arbeitgeber (wenn Sie als Programmierer arbeiten) oder Ihre Schule einen Copyright-Verzicht f\'9fr das Programm unterschreiben lassen. Hier ein Beispiel. Die Namen m\'9fssen Sie nat\'9frlich \'8andern.\ \f2 Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. \f1 \ \f2 [Unterschrift von Ty Coon], 1 April 1989 \f3 \uc0\u8232 \f2 Ty Coon, President of Vice \f1 \ Auf Deutsch:\ \f2 Die Yoyodyne GmbH erhebt keinen urheberrechtlichen Anspruch auf das von James Hacker geschriebene Programm ,Gnomovision` (einem Schrittmacher f\'9fr Compiler). \f1 \ \f2 [Unterschrift von Ty Coon], 1. April 1989 \f3 \uc0\u8232 \f2 Ty Coon, Vizepr\'8asident \f1 \ Diese General Public License gestattet nicht die Einbindung des Programms in propriet\'8are Programme. Ist Ihr Programm eine Funktionsbibliothek, so kann es sinnvoller sein, das Binden propriet\'8arer Programme mit dieser Bibliothek zu gestatten. Wenn Sie dies tun wollen, sollten Sie die GNU Library General Public License anstelle dieser Lizenz verwenden.} ================================================ FILE: de.lproj/Localizable.strings ================================================ { "Host Name" = "Host-Name"; "Host Names" = "Host-Namen"; "IP Address" = "IP-Adresse"; "IP Addresses" = "IP-Adressen"; "Screen Resolution changed - Server Reinitialized" = "Bildschirmauflösung geändert - Server-Reinitialisierung"; "Server Running" = "Der Server wurde aktiviert"; "The server is not running." = "Der Server läuft nicht."; "Start Server" = "Server starten"; "Restart Server" = "Server-Neustart"; "The server is stopped." = "Der Server wurde angehalten."; "Probably because the OSXvnc server is already running as a Startup Item." = "Eventuell läuft der OSXvnc-Server bereits als Startobjekt."; "Probably because another VNC is already using this port." = "Eventuell benutzt ein anderer VNC-Server bereits diesen Port."; "The server has stopped running. See Log (%d)\n" = "Der Server wurde beendet. Siehe Protokoll (%d)\n"; "The server has stopped running." = "Der Server wurde beendet."; "Need a valid Port or Display Number" = "Benötigt eine gültige Port- oder Displaynummer"; "Problem - Unable to store password to %@" = "Problem - Das Passwort kann nicht in %@ gespeichert werden"; "Option Change Requires a Restart" = "Einstellungsänderung erfordert einen Neustart"; "Error: No Authorization" = "Fehler: Fehlende Authorisierung"; "Error: Unable To Setup Password File" = "Fehler: Kann die Passwortdatei nicht ändern"; "Error: Unable To Write out Temporary Script File" = "Fehler: Kann die temporäre Skriptdatei nicht schreiben"; "Startup Item Configured (Started)" = "Startup-Item konfiguriert (gestartet)"; "Startup Item Disabled (Stopped)" = "Startup-Item deaktiviert (gestoppt)"; "Error: Unabled to remove startup item" = "Fehler: Kann das Startup-Item nicht entfernen"; "Please specify a Connect Host to establish a connection" = "Bitte einen Zielhost angeben, um eine Verbindung aufbauen zu können"; "Connection invitation sent to Connect Host" = "Verbindungsanforderung an den Zielhost gesendet"; } ================================================ FILE: en.lproj/Copying.rtf ================================================ {\rtf1\ansi\deff0{\fonttbl{\f0 \fswiss Helvetica;}{\f1 Courier;}} {\colortbl;\red255\green0\blue0;\red0\green0\blue255;} \widowctrl\hyphauto {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs28 GNU GENERAL PUBLIC LICENSE\par} {\pard \ql \f0 \sa180 \li0 \fi0 Version 3, 29 June 2007\par} {\pard \ql \f0 \sa180 \li0 \fi0 Copyright \u169? 2007 Free Software Foundation, Inc. <{\field{\*\fldinst{HYPERLINK "http://fsf.org/"}}{\fldrslt{\ul http://fsf.org/ }}} >\par} {\pard \ql \f0 \sa180 \li0 \fi0 Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs28 Preamble\par} {\pard \ql \f0 \sa180 \li0 \fi0 The GNU General Public License is a free, copyleft license for software and other kinds of works.\par} {\pard \ql \f0 \sa180 \li0 \fi0 The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.\par} {\pard \ql \f0 \sa180 \li0 \fi0 When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.\par} {\pard \ql \f0 \sa180 \li0 \fi0 To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.\par} {\pard \ql \f0 \sa180 \li0 \fi0 For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.\par} {\pard \ql \f0 \sa180 \li0 \fi0 Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.\par} {\pard \ql \f0 \sa180 \li0 \fi0 For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.\par} {\pard \ql \f0 \sa180 \li0 \fi0 Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.\par} {\pard \ql \f0 \sa180 \li0 \fi0 Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.\par} {\pard \ql \f0 \sa180 \li0 \fi0 The precise terms and conditions for copying, distribution and modification follow.\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs28 TERMS AND CONDITIONS\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs24 0. Definitions.\par} {\pard \ql \f0 \sa180 \li0 \fi0 \u8220"This License\u8221" refers to version 3 of the GNU General Public License.\par} {\pard \ql \f0 \sa180 \li0 \fi0 \u8220"Copyright\u8221" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.\par} {\pard \ql \f0 \sa180 \li0 \fi0 \u8220"The Program\u8221" refers to any copyrightable work licensed under this License. Each licensee is addressed as \u8220"you\u8221". \u8220"Licensees\u8221" and \u8220"recipients\u8221" may be individuals or organizations.\par} {\pard \ql \f0 \sa180 \li0 \fi0 To \u8220"modify\u8221" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a \u8220"modified version\u8221" of the earlier work or a work \u8220"based on\u8221" the earlier work.\par} {\pard \ql \f0 \sa180 \li0 \fi0 A \u8220"covered work\u8221" means either the unmodified Program or a work based on the Program.\par} {\pard \ql \f0 \sa180 \li0 \fi0 To \u8220"propagate\u8221" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.\par} {\pard \ql \f0 \sa180 \li0 \fi0 To \u8220"convey\u8221" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.\par} {\pard \ql \f0 \sa180 \li0 \fi0 An interactive user interface displays \u8220"Appropriate Legal Notices\u8221" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs24 1. Source Code.\par} {\pard \ql \f0 \sa180 \li0 \fi0 The \u8220"source code\u8221" for a work means the preferred form of the work for making modifications to it. \u8220"Object code\u8221" means any non-source form of a work.\par} {\pard \ql \f0 \sa180 \li0 \fi0 A \u8220"Standard Interface\u8221" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.\par} {\pard \ql \f0 \sa180 \li0 \fi0 The \u8220"System Libraries\u8221" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A \u8220"Major Component\u8221", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.\par} {\pard \ql \f0 \sa180 \li0 \fi0 The \u8220"Corresponding Source\u8221" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.\par} {\pard \ql \f0 \sa180 \li0 \fi0 The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.\par} {\pard \ql \f0 \sa180 \li0 \fi0 The Corresponding Source for a work in source code form is that same work.\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs24 2. Basic Permissions.\par} {\pard \ql \f0 \sa180 \li0 \fi0 All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.\par} {\pard \ql \f0 \sa180 \li0 \fi0 You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.\par} {\pard \ql \f0 \sa180 \li0 \fi0 Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs24 3. Protecting Users' Legal Rights From Anti-Circumvention Law.\par} {\pard \ql \f0 \sa180 \li0 \fi0 No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.\par} {\pard \ql \f0 \sa180 \li0 \fi0 When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs24 4. Conveying Verbatim Copies.\par} {\pard \ql \f0 \sa180 \li0 \fi0 You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.\par} {\pard \ql \f0 \sa180 \li0 \fi0 You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs24 5. Conveying Modified Source Versions.\par} {\pard \ql \f0 \sa180 \li0 \fi0 You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:\par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab a) The work must carry prominent notices stating that you modified it, and giving a relevant date.\par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to \u8220"keep intact all notices\u8221".\par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.\par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.\sa180\par} {\pard \ql \f0 \sa180 \li0 \fi0 A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an \u8220"aggregate\u8221" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs24 6. Conveying Non-Source Forms.\par} {\pard \ql \f0 \sa180 \li0 \fi0 You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:\par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.\par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.\par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.\par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.\par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.\sa180\par} {\pard \ql \f0 \sa180 \li0 \fi0 A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.\par} {\pard \ql \f0 \sa180 \li0 \fi0 A \u8220"User Product\u8221" is either (1) a \u8220"consumer product\u8221", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, \u8220"normally used\u8221" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.\par} {\pard \ql \f0 \sa180 \li0 \fi0 \u8220"Installation Information\u8221" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.\par} {\pard \ql \f0 \sa180 \li0 \fi0 If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).\par} {\pard \ql \f0 \sa180 \li0 \fi0 The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.\par} {\pard \ql \f0 \sa180 \li0 \fi0 Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs24 7. Additional Terms.\par} {\pard \ql \f0 \sa180 \li0 \fi0 \u8220"Additional permissions\u8221" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.\par} {\pard \ql \f0 \sa180 \li0 \fi0 When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.\par} {\pard \ql \f0 \sa180 \li0 \fi0 Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:\par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or\par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or\par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or\par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab d) Limiting the use for publicity purposes of names of licensors or authors of the material; or\par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or\par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.\sa180\par} {\pard \ql \f0 \sa180 \li0 \fi0 All other non-permissive additional terms are considered \u8220"further restrictions\u8221" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.\par} {\pard \ql \f0 \sa180 \li0 \fi0 If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.\par} {\pard \ql \f0 \sa180 \li0 \fi0 Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs24 8. Termination.\par} {\pard \ql \f0 \sa180 \li0 \fi0 You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).\par} {\pard \ql \f0 \sa180 \li0 \fi0 However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.\par} {\pard \ql \f0 \sa180 \li0 \fi0 Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.\par} {\pard \ql \f0 \sa180 \li0 \fi0 Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs24 9. Acceptance Not Required for Having Copies.\par} {\pard \ql \f0 \sa180 \li0 \fi0 You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs24 10. Automatic Licensing of Downstream Recipients.\par} {\pard \ql \f0 \sa180 \li0 \fi0 Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.\par} {\pard \ql \f0 \sa180 \li0 \fi0 An \u8220"entity transaction\u8221" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.\par} {\pard \ql \f0 \sa180 \li0 \fi0 You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs24 11. Patents.\par} {\pard \ql \f0 \sa180 \li0 \fi0 A \u8220"contributor\u8221" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's \u8220"contributor version\u8221".\par} {\pard \ql \f0 \sa180 \li0 \fi0 A contributor's \u8220"essential patent claims\u8221" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, \u8220"control\u8221" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.\par} {\pard \ql \f0 \sa180 \li0 \fi0 Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.\par} {\pard \ql \f0 \sa180 \li0 \fi0 In the following three paragraphs, a \u8220"patent license\u8221" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To \u8220"grant\u8221" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.\par} {\pard \ql \f0 \sa180 \li0 \fi0 If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. \u8220"Knowingly relying\u8221" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.\par} {\pard \ql \f0 \sa180 \li0 \fi0 If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.\par} {\pard \ql \f0 \sa180 \li0 \fi0 A patent license is \u8220"discriminatory\u8221" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.\par} {\pard \ql \f0 \sa180 \li0 \fi0 Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs24 12. No Surrender of Others' Freedom.\par} {\pard \ql \f0 \sa180 \li0 \fi0 If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs24 13. Use with the GNU Affero General Public License.\par} {\pard \ql \f0 \sa180 \li0 \fi0 Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs24 14. Revised Versions of this License.\par} {\pard \ql \f0 \sa180 \li0 \fi0 The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.\par} {\pard \ql \f0 \sa180 \li0 \fi0 Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License \u8220"or any later version\u8221" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.\par} {\pard \ql \f0 \sa180 \li0 \fi0 If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.\par} {\pard \ql \f0 \sa180 \li0 \fi0 Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs24 15. Disclaimer of Warranty.\par} {\pard \ql \f0 \sa180 \li0 \fi0 THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \u8220"AS IS\u8221" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs24 16. Limitation of Liability.\par} {\pard \ql \f0 \sa180 \li0 \fi0 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs24 17. Interpretation of Sections 15 and 16.\par} {\pard \ql \f0 \sa180 \li0 \fi0 If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.\par} {\pard \ql \f0 \sa180 \li0 \fi0 END OF TERMS AND CONDITIONS\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs28 How to Apply These Terms to Your New Programs\par} {\pard \ql \f0 \sa180 \li0 \fi0 If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.\par} {\pard \ql \f0 \sa180 \li0 \fi0 To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the \u8220"copyright\u8221" line and a pointer to where the full notice is found.\par} {\pard \ql \f0 \sa180 \li0 \fi0 \f1 \line Copyright (C) \line \line This program is free software: you can redistribute it and/or modify\line it under the terms of the GNU General Public License as published by\line the Free Software Foundation, either version 3 of the License, or\line (at your option) any later version.\line \line This program is distributed in the hope that it will be useful,\line but WITHOUT ANY WARRANTY; without even the implied warranty of\line MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\line GNU General Public License for more details.\line \line You should have received a copy of the GNU General Public License\line along with this program. If not, see .\par} {\pard \ql \f0 \sa180 \li0 \fi0 Also add information on how to contact you by electronic and paper mail.\par} {\pard \ql \f0 \sa180 \li0 \fi0 If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:\par} {\pard \ql \f0 \sa180 \li0 \fi0 \f1 Copyright (C) \line This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\line This is free software, and you are welcome to redistribute it\line under certain conditions; type `show c' for details.\par} {\pard \ql \f0 \sa180 \li0 \fi0 The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an \u8220"about box\u8221".\par} {\pard \ql \f0 \sa180 \li0 \fi0 You should also get your employer (if you work as a programmer) or school, if any, to sign a \u8220"copyright disclaimer\u8221" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <{\field{\*\fldinst{HYPERLINK "http://www.gnu.org/licenses/"}}{\fldrslt{\ul http://www.gnu.org/licenses/ }}} >.\par} {\pard \ql \f0 \sa180 \li0 \fi0 The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <{\field{\*\fldinst{HYPERLINK "http://www.gnu.org/philosophy/why-not-lgpl.html"}}{\fldrslt{\ul http://www.gnu.org/philosophy/why-not-lgpl.html }}} >.\par} } ================================================ FILE: en.lproj/Credits.rtf ================================================ {\rtf1\ansi\ansicpg1252\cocoartf1504\cocoasubrtf600 {\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\froman\fcharset0 Times-Roman;} {\colortbl;\red255\green255\blue255;\red26\green26\blue255;} {\*\expandedcolortbl;\csgray\c100000;\csgenericrgb\c10196\c10196\c100000;} \paperw12240\paperh15840\vieww9000\viewh8400\viewkind0 \pard\tx360\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \f0\fs24 \cf0 This is an improved version of Vine VNC:\ {\field{\*\fldinst{HYPERLINK "https://github.com/stweil/OSXvnc.git"}}{\fldrslt https://github.com/stweil/OSXvnc.git}}\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \f1 \cf0 \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \f0 \cf0 Copyright \'a9 2015\'962017 Stefan Weil\ \ Copyright \'a9 2002\'962012 TestPlant Software\ Jonathan Gillaspie\ Doug Simons\ \ GNU GPL:\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \cf2 \ul \ulc2 http://www.gnu.org/copyleft/gpl.html\cf0 \ulnone \ \ Thanks for Vine Server manual:\ Pamela Moncavage\ \ Thanks For 10.8 Fixes:\ John Turnipseed\ \ Thanks For Server Side Scaling:\ Noriaki Yamazaki\ Administrator of micro-VNC\ Hitachi System & Service, Ltd.\ \ Thanks For Reverse Connections:\ Mark Lentczner\ \ Thanks for corrections for multiple Tight clients:\ Solletica\ \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \cf0 Zlib, ZlibHex and Tight encodings:\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \cf0 Mahmud Haque\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \cf0 \ \pard\tx360\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \cf0 Other Contributions:\ \pard\tx360\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \f1 \cf0 \f0 David Johnson \f1 \ \f0 Steven Tamm\ Mihai Parparita\ Marvin Simkin\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \cf0 \ ----------------------------------------------------\ \ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.\ \ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\ \ You should have received a copy of the GNU General Public License along with this program; if not, write to:\ \ Free Software Foundation, Inc.\ 59 Temple Place - Suite 330\ Boston, MA 02111-1307\ USA\ } ================================================ FILE: en.lproj/Localizable.strings ================================================ { "The server is stopped."="The server is not running."; "No Authentication"="no password protection"; "Startup Item Configured (Started)"="The System Server is running"; "Startup Item Disabled (Stopped)"="The System Server is not running"; "Vine Server can't listen on the specified port (%d)."="The port you chose (%d) is not available."; "Probably because the OSXvnc server is already running as a Startup Item." = "(You may already be running a System Server on this port)"; "Probably because another VNC is already using this port." = "(There is already a VNC server running on this port)"; "Option Change Requires a Restart" = "Restart Server to Affect Changes"; "No password has been specified for the System Server. The System Server will automatically launch every time your machine is restarted. Are you sure that you want to install a System Server with no password"="This server is not password-protected, and will start automatically whenever your computer is turned on. Do you want to proceed with no password protection?"; } ================================================ FILE: en.lproj/Vine Server Release Notes.rtf ================================================ {\rtf1\ansi\ansicpg1252\cocoartf1504\cocoasubrtf600 {\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\froman\fcharset0 Times-Roman;\f2\fnil\fcharset0 Monaco; \f3\fnil\fcharset0 Geneva;} {\colortbl;\red255\green255\blue255;\red137\green19\blue21;\red25\green35\blue255;} {\*\expandedcolortbl;\csgray\c100000;\csgenericrgb\c53725\c7451\c8235;\csgenericrgb\c9804\c13725\c100000;} \paperw12240\paperh15840\vieww15020\viewh14560\viewkind0 \pard\tx1440\tx2880\tx4320\tx5760\tx7200\qc\partightenfactor0 \f0\b\fs36 \cf0 Vine Server 5.0\ Release Notes\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b0\fs24 \cf0 \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b \cf0 Version 5.1 Released 20-November-2016:\ \pard\tx480\tx960\tx1440\tx1920\tx2400\tx2880\tx3360\tx3840\tx4320\tx4800\tx5280\tx5760\tx6240\tx6720\tx7200\tx7680\tx8160\tx8640\tx9120\tx9600\tx10080\tx10560\tx11040\tx11520\tx12000\tx12480\tx12960\tx13440\tx13920\tx14400\tx14880\tx15360\tx15840\tx16320\tx16800\tx17280\tx17760\tx18240\tx18720\tx19200\tx19680\tx20160\tx20640\tx21120\tx21600\tx22080\tx22560\tx23040\tx23520\tx24000\tx24480\tx24960\tx25440\tx25920\tx26400\tx26880\tx27360\tx27840\tx28320\tx28800\tx29280\tx29760\tx30240\tx30720\tx31200\tx31680\tx32160\tx32640\tx33120\tx33600\tx34080\tx34560\tx35040\tx35520\tx36000\tx36480\tx36960\tx37440\tx37920\tx38400\tx38880\tx39360\tx39840\tx40320\tx40800\tx41280\tx41760\tx42240\tx42720\tx43200\tx43680\tx44160\tx44640\tx45120\tx45600\tx46080\tx46560\tx47040\tx47520\tx48000\pardirnatural\partightenfactor0 \cf0 Modified by Stefan Weil \b0 \ \b Note: This release supports 10.7 and above, Intel-Only \b0 \ \ Replaced libvnc by libjpeg-turbo. This might result in improved performance.\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b \cf0 \ \ Version 5.0 Released 10-November-2016:\ \pard\tx480\tx960\tx1440\tx1920\tx2400\tx2880\tx3360\tx3840\tx4320\tx4800\tx5280\tx5760\tx6240\tx6720\tx7200\tx7680\tx8160\tx8640\tx9120\tx9600\tx10080\tx10560\tx11040\tx11520\tx12000\tx12480\tx12960\tx13440\tx13920\tx14400\tx14880\tx15360\tx15840\tx16320\tx16800\tx17280\tx17760\tx18240\tx18720\tx19200\tx19680\tx20160\tx20640\tx21120\tx21600\tx22080\tx22560\tx23040\tx23520\tx24000\tx24480\tx24960\tx25440\tx25920\tx26400\tx26880\tx27360\tx27840\tx28320\tx28800\tx29280\tx29760\tx30240\tx30720\tx31200\tx31680\tx32160\tx32640\tx33120\tx33600\tx34080\tx34560\tx35040\tx35520\tx36000\tx36480\tx36960\tx37440\tx37920\tx38400\tx38880\tx39360\tx39840\tx40320\tx40800\tx41280\tx41760\tx42240\tx42720\tx43200\tx43680\tx44160\tx44640\tx45120\tx45600\tx46080\tx46560\tx47040\tx47520\tx48000\pardirnatural\partightenfactor0 \cf0 Modified by Stefan Weil \b0 \ \b Note: This release supports 10.6 and above, Intel-Only \b0 \ \ Includes lots of bug fixes and updates.\ Supports Retina displays.\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b \cf0 \ \ Version 4.01 Released 28-September-2012:\ \pard\tx480\tx960\tx1440\tx1920\tx2400\tx2880\tx3360\tx3840\tx4320\tx4800\tx5280\tx5760\tx6240\tx6720\tx7200\tx7680\tx8160\tx8640\tx9120\tx9600\tx10080\tx10560\tx11040\tx11520\tx12000\tx12480\tx12960\tx13440\tx13920\tx14400\tx14880\tx15360\tx15840\tx16320\tx16800\tx17280\tx17760\tx18240\tx18720\tx19200\tx19680\tx20160\tx20640\tx21120\tx21600\tx22080\tx22560\tx23040\tx23520\tx24000\tx24480\tx24960\tx25440\tx25920\tx26400\tx26880\tx27360\tx27840\tx28320\tx28800\tx29280\tx29760\tx30240\tx30720\tx31200\tx31680\tx32160\tx32640\tx33120\tx33600\tx34080\tx34560\tx35040\tx35520\tx36000\tx36480\tx36960\tx37440\tx37920\tx38400\tx38880\tx39360\tx39840\tx40320\tx40800\tx41280\tx41760\tx42240\tx42720\tx43200\tx43680\tx44160\tx44640\tx45120\tx45600\tx46080\tx46560\tx47040\tx47520\tx48000\pardirnatural\partightenfactor0 \cf0 Modified by Jonathan Gillaspie with TestPlant, Inc. \b0 \ \b Note: This release supports 10.6 and above, Intel-Only \b0 \ \ Fixed a bug where new connections could have invalid starting states and produce clipboard errors. \ Fixes a problem loading keyboard data for non US keyboards.\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b \cf0 \ \ Version 4.0 Released 20-July-2012:\ \pard\tx480\tx960\tx1440\tx1920\tx2400\tx2880\tx3360\tx3840\tx4320\tx4800\tx5280\tx5760\tx6240\tx6720\tx7200\tx7680\tx8160\tx8640\tx9120\tx9600\tx10080\tx10560\tx11040\tx11520\tx12000\tx12480\tx12960\tx13440\tx13920\tx14400\tx14880\tx15360\tx15840\tx16320\tx16800\tx17280\tx17760\tx18240\tx18720\tx19200\tx19680\tx20160\tx20640\tx21120\tx21600\tx22080\tx22560\tx23040\tx23520\tx24000\tx24480\tx24960\tx25440\tx25920\tx26400\tx26880\tx27360\tx27840\tx28320\tx28800\tx29280\tx29760\tx30240\tx30720\tx31200\tx31680\tx32160\tx32640\tx33120\tx33600\tx34080\tx34560\tx35040\tx35520\tx36000\tx36480\tx36960\tx37440\tx37920\tx38400\tx38880\tx39360\tx39840\tx40320\tx40800\tx41280\tx41760\tx42240\tx42720\tx43200\tx43680\tx44160\tx44640\tx45120\tx45600\tx46080\tx46560\tx47040\tx47520\tx48000\pardirnatural\partightenfactor0 \cf0 Modified by Jonathan Gillaspie with TestPlant, Inc. \b0 \ \b Note: This release supports 10.6 and above, Intel-Only \b0 \ \ Uses newer API for improved performance and reliability.\ \b \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \cf0 \ Version 3.12 Released 22-October-2010:\ \pard\tx480\tx960\tx1440\tx1920\tx2400\tx2880\tx3360\tx3840\tx4320\tx4800\tx5280\tx5760\tx6240\tx6720\tx7200\tx7680\tx8160\tx8640\tx9120\tx9600\tx10080\tx10560\tx11040\tx11520\tx12000\tx12480\tx12960\tx13440\tx13920\tx14400\tx14880\tx15360\tx15840\tx16320\tx16800\tx17280\tx17760\tx18240\tx18720\tx19200\tx19680\tx20160\tx20640\tx21120\tx21600\tx22080\tx22560\tx23040\tx23520\tx24000\tx24480\tx24960\tx25440\tx25920\tx26400\tx26880\tx27360\tx27840\tx28320\tx28800\tx29280\tx29760\tx30240\tx30720\tx31200\tx31680\tx32160\tx32640\tx33120\tx33600\tx34080\tx34560\tx35040\tx35520\tx36000\tx36480\tx36960\tx37440\tx37920\tx38400\tx38880\tx39360\tx39840\tx40320\tx40800\tx41280\tx41760\tx42240\tx42720\tx43200\tx43680\tx44160\tx44640\tx45120\tx45600\tx46080\tx46560\tx47040\tx47520\tx48000\pardirnatural\partightenfactor0 \cf0 Modified by Jonathan Gillaspie with TestPlant, Inc. \b0 \ \b Note: This release supports 10.4 and above, PPC and Intel \b0 \ \ Fixed a bug on startup that could crash on some systems \ Fixes to prevent a Rich Clipboard deadlock problem.\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b \cf0 \ \pard\tx480\tx960\tx1440\tx1920\tx2400\tx2880\tx3360\tx3840\tx4320\tx4800\tx5280\tx5760\tx6240\tx6720\tx7200\tx7680\tx8160\tx8640\tx9120\tx9600\tx10080\tx10560\tx11040\tx11520\tx12000\tx12480\tx12960\tx13440\tx13920\tx14400\tx14880\tx15360\tx15840\tx16320\tx16800\tx17280\tx17760\tx18240\tx18720\tx19200\tx19680\tx20160\tx20640\tx21120\tx21600\tx22080\tx22560\tx23040\tx23520\tx24000\tx24480\tx24960\tx25440\tx25920\tx26400\tx26880\tx27360\tx27840\tx28320\tx28800\tx29280\tx29760\tx30240\tx30720\tx31200\tx31680\tx32160\tx32640\tx33120\tx33600\tx34080\tx34560\tx35040\tx35520\tx36000\tx36480\tx36960\tx37440\tx37920\tx38400\tx38880\tx39360\tx39840\tx40320\tx40800\tx41280\tx41760\tx42240\tx42720\tx43200\tx43680\tx44160\tx44640\tx45120\tx45600\tx46080\tx46560\tx47040\tx47520\tx48000\pardirnatural\partightenfactor0 \b0 \cf0 Fixes to project for XCode 3.2 and Mac OS X 10.6.\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b \cf0 \ \ Version 3.11 Released 12-October-2009:\ \pard\tx480\tx960\tx1440\tx1920\tx2400\tx2880\tx3360\tx3840\tx4320\tx4800\tx5280\tx5760\tx6240\tx6720\tx7200\tx7680\tx8160\tx8640\tx9120\tx9600\tx10080\tx10560\tx11040\tx11520\tx12000\tx12480\tx12960\tx13440\tx13920\tx14400\tx14880\tx15360\tx15840\tx16320\tx16800\tx17280\tx17760\tx18240\tx18720\tx19200\tx19680\tx20160\tx20640\tx21120\tx21600\tx22080\tx22560\tx23040\tx23520\tx24000\tx24480\tx24960\tx25440\tx25920\tx26400\tx26880\tx27360\tx27840\tx28320\tx28800\tx29280\tx29760\tx30240\tx30720\tx31200\tx31680\tx32160\tx32640\tx33120\tx33600\tx34080\tx34560\tx35040\tx35520\tx36000\tx36480\tx36960\tx37440\tx37920\tx38400\tx38880\tx39360\tx39840\tx40320\tx40800\tx41280\tx41760\tx42240\tx42720\tx43200\tx43680\tx44160\tx44640\tx45120\tx45600\tx46080\tx46560\tx47040\tx47520\tx48000\pardirnatural\partightenfactor0 \cf0 Modified by Jonathan Gillaspie with TestPlant, Inc. \b0 \ \b Note: This release supports 10.3.9 and above, PPC and Intel \b0 \ \ Fixed a number of international keyboards that had a small number of keys not mapped (like i and ; in French.)\ \ Fixed a compile level problem that caused a crash when using ZRLE encoding\ \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b \cf0 \ Version 3.1 Released 01-June-2009:\ \pard\tx480\tx960\tx1440\tx1920\tx2400\tx2880\tx3360\tx3840\tx4320\tx4800\tx5280\tx5760\tx6240\tx6720\tx7200\tx7680\tx8160\tx8640\tx9120\tx9600\tx10080\tx10560\tx11040\tx11520\tx12000\tx12480\tx12960\tx13440\tx13920\tx14400\tx14880\tx15360\tx15840\tx16320\tx16800\tx17280\tx17760\tx18240\tx18720\tx19200\tx19680\tx20160\tx20640\tx21120\tx21600\tx22080\tx22560\tx23040\tx23520\tx24000\tx24480\tx24960\tx25440\tx25920\tx26400\tx26880\tx27360\tx27840\tx28320\tx28800\tx29280\tx29760\tx30240\tx30720\tx31200\tx31680\tx32160\tx32640\tx33120\tx33600\tx34080\tx34560\tx35040\tx35520\tx36000\tx36480\tx36960\tx37440\tx37920\tx38400\tx38880\tx39360\tx39840\tx40320\tx40800\tx41280\tx41760\tx42240\tx42720\tx43200\tx43680\tx44160\tx44640\tx45120\tx45600\tx46080\tx46560\tx47040\tx47520\tx48000\pardirnatural\partightenfactor0 \cf0 Modified by Jonathan Gillaspie with TestPlant, Inc. \b0 \ \b Note: This release supports 10.3.9 and above, PPC and Intel \b0 \ \ Added an advanced preference to specify which event source Vine Server should register with (10.4+)\ Added an advanced preference to use OpenGL to capture the display, best on newer Intel hardware (10.4+)\ Moved Keyboard Events selector to Advanced Settings.\ \ Fixed a problem running on 10.3.9\ Fixed a problem auto launching the server from GUI when Vine Server was set to Auto-Hide\ Fixed a problem not honoring the selection to disable Bonjour.\ Fixed a problem with Require SSH not being stored correctly for System Server.\ Fixed a problem with server shutting down after a logout.\ \ Fixed a number of international keyboards that had a small number of keys not mapped (like i in Belgian, o in Swiss, etc.)\ Fixed an occasional problem sending rich cursors to the remote system.\ \ Fixed an occasional problem not sending the right information on a copy/cut.\ \ Fixed a problem with Echoware bundle loaded twice.\ \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b \cf0 \ Version 3.0, Released 17-Dec-2007:\ \pard\tx480\tx960\tx1440\tx1920\tx2400\tx2880\tx3360\tx3840\tx4320\tx4800\tx5280\tx5760\tx6240\tx6720\tx7200\tx7680\tx8160\tx8640\tx9120\tx9600\tx10080\tx10560\tx11040\tx11520\tx12000\tx12480\tx12960\tx13440\tx13920\tx14400\tx14880\tx15360\tx15840\tx16320\tx16800\tx17280\tx17760\tx18240\tx18720\tx19200\tx19680\tx20160\tx20640\tx21120\tx21600\tx22080\tx22560\tx23040\tx23520\tx24000\tx24480\tx24960\tx25440\tx25920\tx26400\tx26880\tx27360\tx27840\tx28320\tx28800\tx29280\tx29760\tx30240\tx30720\tx31200\tx31680\tx32160\tx32640\tx33120\tx33600\tx34080\tx34560\tx35040\tx35520\tx36000\tx36480\tx36960\tx37440\tx37920\tx38400\tx38880\tx39360\tx39840\tx40320\tx40800\tx41280\tx41760\tx42240\tx42720\tx43200\tx43680\tx44160\tx44640\tx45120\tx45600\tx46080\tx46560\tx47040\tx47520\tx48000\pardirnatural\partightenfactor0 \cf0 Modified by Jonathan Gillaspie with Redstone Software, Inc. \b0 \ \b Note: This release supports 10.3.9 and above, PPC and Intel \b0 \ \ International Interfaces haven't been converted to the new interface, as they become available we will post them.\ \ \b Added support for Leopard System Servers\ \b0 \ \b Interface:\ \b0 Cleaned up interface by introducing a basic control panel and moving settings to dedicate Preference Pane.\ Moved "View Log" and "Reverse Connection" to menus\ Added Reporting for Client Connection List (and icon badging in Leopard)\ Added external IP lookup and ability to verify access to your VNC server from detected IPs\ Always allow a server restart from the UI\ Panel to prevent accidentally quitting Vine Server when users are connected\ \ \b Startup:\ \b0 Better IP and DNS resolution so that initial startup is not delayed (as can happen on Leopard)\ Added LaunchD support for the System Server on 10.5\ Fixed a Leopard issue with displaying an extra icon\ Added better versioning (AVS)\ \ \b VNC Server:\ \b0 Added support for Unicode keyboard (10.4+)\ Added support to detect keyboard type (10.4+)\ Added support to control where events enter the system (Event Taps) (10.4+) \b \ \b0 \ Fixed a bug auto-detecting the proper port when SSH-only was checked.\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \cf0 Fixed a lockup problem in the OSXvnc-server process that could occur with Rich Clipboard Support enabled.\ Fixed a problem repeatedly trying to send an empty clipboard buffer.\ Fixed a bug with restoring otherArguments from defaults\ \ \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b \cf0 Version 2.2, Released 1-August-2007:\ \pard\tx480\tx960\tx1440\tx1920\tx2400\tx2880\tx3360\tx3840\tx4320\tx4800\tx5280\tx5760\tx6240\tx6720\tx7200\tx7680\tx8160\tx8640\tx9120\tx9600\tx10080\tx10560\tx11040\tx11520\tx12000\tx12480\tx12960\tx13440\tx13920\tx14400\tx14880\tx15360\tx15840\tx16320\tx16800\tx17280\tx17760\tx18240\tx18720\tx19200\tx19680\tx20160\tx20640\tx21120\tx21600\tx22080\tx22560\tx23040\tx23520\tx24000\tx24480\tx24960\tx25440\tx25920\tx26400\tx26880\tx27360\tx27840\tx28320\tx28800\tx29280\tx29760\tx30240\tx30720\tx31200\tx31680\tx32160\tx32640\tx33120\tx33600\tx34080\tx34560\tx35040\tx35520\tx36000\tx36480\tx36960\tx37440\tx37920\tx38400\tx38880\tx39360\tx39840\tx40320\tx40800\tx41280\tx41760\tx42240\tx42720\tx43200\tx43680\tx44160\tx44640\tx45120\tx45600\tx46080\tx46560\tx47040\tx47520\tx48000\pardirnatural\partightenfactor0 \cf0 Modified by Jonathan Gillaspie with Redstone Software, Inc. \b0 \ \ Added warnings when launching or setting a system server with no password set.\ Added a new -maxdepth argument to limit incoming connections..\ Added a new -maxauths to limit brute force VNC server attacks.\ \ Fixed a problem with keyboard events being impacted by local modifer keys (like CapsLock and Command).\ Fixed a problem detecting "self connection loops" where we are providing our own Pasteboard Data.\ Fixed a problem with multiple users launching the same copy of Vine Server.\ Fixed a problem with launching Vine Server when our own Host Name can't be determined.\ \ Host name is retrieved in a separate thread to prevent hanging the app when DNS isn't setup.\ Improvements to performance when accessing clipboard data.\ Removed spurious log messages when accessing clipboard dat.\ Changed install permissions to 755 for increased security.\ Defaults to storing the .osxvncauth files to the users home directory. \b \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \cf0 \ \ Version 2.1, Released 5 December 2006:\ \pard\tx480\tx960\tx1440\tx1920\tx2400\tx2880\tx3360\tx3840\tx4320\tx4800\tx5280\tx5760\tx6240\tx6720\tx7200\tx7680\tx8160\tx8640\tx9120\tx9600\tx10080\tx10560\tx11040\tx11520\tx12000\tx12480\tx12960\tx13440\tx13920\tx14400\tx14880\tx15360\tx15840\tx16320\tx16800\tx17280\tx17760\tx18240\tx18720\tx19200\tx19680\tx20160\tx20640\tx21120\tx21600\tx22080\tx22560\tx23040\tx23520\tx24000\tx24480\tx24960\tx25440\tx25920\tx26400\tx26880\tx27360\tx27840\tx28320\tx28800\tx29280\tx29760\tx30240\tx30720\tx31200\tx31680\tx32160\tx32640\tx33120\tx33600\tx34080\tx34560\tx35040\tx35520\tx36000\tx36480\tx36960\tx37440\tx37920\tx38400\tx38880\tx39360\tx39840\tx40320\tx40800\tx41280\tx41760\tx42240\tx42720\tx43200\tx43680\tx44160\tx44640\tx45120\tx45600\tx46080\tx46560\tx47040\tx47520\tx48000\pardirnatural\partightenfactor0 \cf0 Modified by Jonathan Gillaspie & Doug Simons with Redstone Software, Inc. \b0 \ \ Fixed a problem with Host Name Lookups when doing Reverse Connections\ Fixes to move all clipboard interaction through main thread (required for 10.2 support and better all around behavior).\ Fix to improper behavior when changing the display number to Auto.\ Improved support for 10.1 and below by adding a dynamically loadable call to the CGMainDisplay() function..\ \ Much improved Rich Pasteboard support for 10.2, 10.3 and for interactions with those versions and 10.4.\ Fixed a crash when multiple threads accessed the pasteboard variables\ Fixed a crash accessing client pasteboard data after it's been cleared.\ Fix to not retaining the "COPY" string when it's put to the pasteboard.\ Fix for one of many pasteboard files when we can't read the file.\ Improvements to detecting "self connection loops" where we are providing our own Pasteboard Data.\ \b \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \cf0 \ Version 2.0, Released 1 November 2006:\ \pard\tx480\tx960\tx1440\tx1920\tx2400\tx2880\tx3360\tx3840\tx4320\tx4800\tx5280\tx5760\tx6240\tx6720\tx7200\tx7680\tx8160\tx8640\tx9120\tx9600\tx10080\tx10560\tx11040\tx11520\tx12000\tx12480\tx12960\tx13440\tx13920\tx14400\tx14880\tx15360\tx15840\tx16320\tx16800\tx17280\tx17760\tx18240\tx18720\tx19200\tx19680\tx20160\tx20640\tx21120\tx21600\tx22080\tx22560\tx23040\tx23520\tx24000\tx24480\tx24960\tx25440\tx25920\tx26400\tx26880\tx27360\tx27840\tx28320\tx28800\tx29280\tx29760\tx30240\tx30720\tx31200\tx31680\tx32160\tx32640\tx33120\tx33600\tx34080\tx34560\tx35040\tx35520\tx36000\tx36480\tx36960\tx37440\tx37920\tx38400\tx38880\tx39360\tx39840\tx40320\tx40800\tx41280\tx41760\tx42240\tx42720\tx43200\tx43680\tx44160\tx44640\tx45120\tx45600\tx46080\tx46560\tx47040\tx47520\tx48000\pardirnatural\partightenfactor0 \cf0 Modified by Jonathan Gillaspie with Redstone Software, Inc. \ \ \b0 Renamed the server wrapper to correspond to its companion - Vine Viewer!\ http://www.redstonesoftware.com/products/vine for more information\ \b \ \b0 Added Rich Clipboard Support for Mac OS X\ \ Vine Server now includes a User Manual\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \cf0 Thanks to Pamela Gillaspie\ \ Incorporated a much better keep-alive script for the System Server\ Thanks to Marvin Simkin \b \ \pard\tx480\tx960\tx1440\tx1920\tx2400\tx2880\tx3360\tx3840\tx4320\tx4800\tx5280\tx5760\tx6240\tx6720\tx7200\tx7680\tx8160\tx8640\tx9120\tx9600\tx10080\tx10560\tx11040\tx11520\tx12000\tx12480\tx12960\tx13440\tx13920\tx14400\tx14880\tx15360\tx15840\tx16320\tx16800\tx17280\tx17760\tx18240\tx18720\tx19200\tx19680\tx20160\tx20640\tx21120\tx21600\tx22080\tx22560\tx23040\tx23520\tx24000\tx24480\tx24960\tx25440\tx25920\tx26400\tx26880\tx27360\tx27840\tx28320\tx28800\tx29280\tx29760\tx30240\tx30720\tx31200\tx31680\tx32160\tx32640\tx33120\tx33600\tx34080\tx34560\tx35040\tx35520\tx36000\tx36480\tx36960\tx37440\tx37920\tx38400\tx38880\tx39360\tx39840\tx40320\tx40800\tx41280\tx41760\tx42240\tx42720\tx43200\tx43680\tx44160\tx44640\tx45120\tx45600\tx46080\tx46560\tx47040\tx47520\tx48000\pardirnatural\partightenfactor0 \cf0 \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b0 \cf0 Improved Performance on 10.4+ systems by un-registering for notifications when server has no clients connected \b \ \ \b0 Fixed a compatibility problem running on 10.1.5 \b \ \b0 Fixed InfoPlist encoding\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b \cf0 \ \b0 Removed Host Name/IP Address Display when none are found \b \ \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b0 \cf0 Added German Localization\ Thanks To J\'f6rg Mehring\ Added Italian Localization\ Thanks to Claudio and Creative Shield ( http://shieldnet.tk/ )\ Improved Some Japanese Localized Strings\ Thanks to Hiroshi Saito\ \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b \cf0 Version 1.71, Released 01/26/2006:\ \pard\tx480\tx960\tx1440\tx1920\tx2400\tx2880\tx3360\tx3840\tx4320\tx4800\tx5280\tx5760\tx6240\tx6720\tx7200\tx7680\tx8160\tx8640\tx9120\tx9600\tx10080\tx10560\tx11040\tx11520\tx12000\tx12480\tx12960\tx13440\tx13920\tx14400\tx14880\tx15360\tx15840\tx16320\tx16800\tx17280\tx17760\tx18240\tx18720\tx19200\tx19680\tx20160\tx20640\tx21120\tx21600\tx22080\tx22560\tx23040\tx23520\tx24000\tx24480\tx24960\tx25440\tx25920\tx26400\tx26880\tx27360\tx27840\tx28320\tx28800\tx29280\tx29760\tx30240\tx30720\tx31200\tx31680\tx32160\tx32640\tx33120\tx33600\tx34080\tx34560\tx35040\tx35520\tx36000\tx36480\tx36960\tx37440\tx37920\tx38400\tx38880\tx39360\tx39840\tx40320\tx40800\tx41280\tx41760\tx42240\tx42720\tx43200\tx43680\tx44160\tx44640\tx45120\tx45600\tx46080\tx46560\tx47040\tx47520\tx48000\pardirnatural\partightenfactor0 \cf0 Modified by Jonathan Gillaspie with Redstone Software, Inc.\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \cf0 osxvnc@redstonesoftware.com \b0 \ \ Added support for ISO Latin Clipboards as per RFB Spec 3.8 (Compatible with TightVNC)\ \ Fixed a problem with the Startup Item Shutting down after a user-logout\ Fixed a problem for Startup Item with spaces in the Display Name\ Fixed a problem reporting default DeferUpdate timer value\ \ Fixed problems compiling for Intel Macs on PPC Macs\ \ \ \b Version 1.7, Released 01/06/2006:\ Modified by Jonathan Gillaspie with Redstone Software, Inc.\ osxvnc@redstonesoftware.com \b0 \ \ \pard\pardeftab720\partightenfactor0 \cf0 Added GUI Support to Establish Reverse Connections to listening VNC Viewers:\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \cf0 You can now add as many listening hosts as you want directly from the GUI.\ \ Converted OSXvnc to a full Universal Binary For Improved Intel performance.\ \ Added a mode to force backward compatibility to older protocol versions (3.3).\ Added a flag to disable the screen saver while clients are connected.\ \ Fixed a problem with screen updates on INTEL Prerelease 10.4.2 and above.\ Fixed a problem with Jaguar Extensions(Bonjour) when first "Configuring the Startup Item", worked on subsequent boots.\ \ Fixed a problem with the "ConnectHost" option when specifying IPv4 addresses or host names which resolved to IPv4.\ Fixed a problem where the application could user CPU cycles even when no user was connected.\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\pardeftab720\partightenfactor0 \cf0 Fixed a problem with IPv6 host names not showing up\ Fixed a problem with repeated crashes not exiting the keep-alive script\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \cf0 \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b \cf0 Version 1.61, Released 8/3/2005:\ Modified by Jonathan Gillaspie with Redstone Software, Inc.\ osxvnc@redstonesoftware.com \b0 \ \ New With Tiger! Multiple Mac OS X Desktops: \f1 \ \pard\tx1440\tx2160\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\partightenfactor0 \f0 \cf0 Please read this separate guide to {\field{\*\fldinst{HYPERLINK "http://www.redstonesoftware.com/multidesktop.html"}}{\fldrslt Multiple Desktop Sessions on Mac OS 10.4 - TIGER}}.\ Improved default preferences to work best for Multiple Mac OS X Desktops. \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \cf0 \ Fixed color mapping problems for Intel Macs.\ Fixed a problem with the startup script being unable to kill running Startup Items.\ Fixed a problem with the startup item not supporting Rendezvous.\ Fixed a problem where changing only the bit depth on the local machine resulted in bad data being sent to client.\ Fixed a crashing/disconnect bug with certain animated cursors.\ \ Added "Auto" to display number/port selection (0 from command line), this will find the first open port 5900-5909.\ Added support to update the IP and Host Name sections when network changes (10.4+ Only)\ Added RFB support for protocol version 003.008\ Added IPv6 Support (10.2+ Only)\ Special Thanks To Jens-Uwe Mager for the patch.\ \ Added \f2\fs20 \CocoaLigature0 TCP_NODELAY \f0\fs24 \CocoaLigature1 on socket to improve performance, particularly with \f3 * \f0 2vnc type applications.\ \ Added a backwards compatibility flag (-rendezvous VNC) for old rendezvous service name. \b \ \ \b0 Added Japanese Localization\ \pard\tx1440\tx2160\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\partightenfactor0 \cf0 Special Thanks to Aaron Madlon-Kay\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b \cf0 \ \ Version 1.5, Released 2/1/2005:\ Modified by Jonathan Gillaspie with Redstone Software, Inc.\ osxvnc@redstonesoftware.com\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b0 \cf0 \ Added support for Server Side Scaling (Both PalmVNC and UltraVNC style)\ \pard\tx1440\tx2160\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\partightenfactor0 \cf0 Special Thanks To Noriaki Yamazaki\ Administrator of micro-VNC\ Hitachi System & Service, Ltd.\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \cf0 \ Added command-line support for Reverse connections.\ \pard\tx1440\tx2160\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\partightenfactor0 \cf0 Special Thanks to Mark Lentczner\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \cf0 \ Added French Localization\ \pard\tx1440\tx2160\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\partightenfactor0 \cf0 Special Thanks to Pascal Frey\ \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \cf0 Switch Rendezvous (zero-conf) support to use _rfb._tcp for compatibility with other servers.\ Turned KeyboardLoading OFF by default since it is currently detrimental for international keyboard users.\ Fixed a problem doing startup on OSX 10.1.5.\ Fixed a problem doing startup on OSX 10.4 (TIGER).\ Fixed a crashing bug with pasteboard access when multiple clients are connected.\ Added special pseudo-encoding so OSXvnc can report when its clipboard is inaccessible.\ \ \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b \cf0 \ Version 1.4, Released 8/17/2004:\ Modified by Jonathan Gillaspie with Redstone Software, Inc.\ osxvnc@redstonesoftware.com\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b0 \cf0 \ Added Rendezvous (zero-conf) support using _vnc._tcp.\ VNC Discovery will work with \b Chicken of The VNC \b0 and \b Eggplant \b0 \ Fixed a problem where the "Never Share Connection" option was being ignored from the GUI\ Fixed a problem where a spurious 0 file was created when running the startup script\ Fixed a problem where the keep-alive script wouldn't shutdown properly on unrecoverable errors\ \ \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b \cf0 Version 1.33, Released 3/18/2004:\ Modified by Jonathan Gillaspie with Redstone Software, Inc.\ osxvnc@redstonesoftware.com\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b0 \cf0 \ Added support for pressing Keypad keys.\ Fixed a small problem with depth being reported as 32 for 24 bit screens.\ Added a -noupdates flag for users of x2vnc or win2vnc.\ Fixed a password problem with startup item which sometimes used /tmp/.osxvncauth, now this file is written with the startup item.\ Fixed a problem with with the auto restart script on 10.2.8\ Server now returns a negative number for unrecoverable errors (to tell the restart script to not try to restart it).\ Improved timing of Startup Item creation so that all authorized calls finish before we proceed.\ Improved scripts to use AWK more efficiently.\ Fixed permissions on Startup Item.\ Added a \b restart \b0 directive to the startup item.\ Added the \b PasswordFile \f2\b0\fs20 \cf2 \CocoaLigature0 \f0\fs24 \cf0 \CocoaLigature1 default to override where password file is stored (for GUI).\ Added the \b LogFile \f2\b0\fs20 \cf2 \CocoaLigature0 \f0\fs24 \cf0 \CocoaLigature1 default to override where password file is stored (for GUI).\ \ \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b \cf0 Version 1.32, Released 12/12/2003:\ Modified by Jonathan Gillaspie with Redstone Software, Inc.\ osxvnc@redstonesoftware.com\ \ \b0 Fixed problem with Idle clients being disconnected\ Added Host Names and IP Addresses to the General Tab\ Added a remove Startup Item button\ Added GUI support to terminate connections after a Fast User Switch (still working on better reconnect behavior)\ Authentications now persist in OSXvnc GUI\ Moved to XCode and fixed some compile problems and backwards compatibility issues\ Fixed a problem with -restartonuserswitch Flag not recognizing yes/Yes\ Added defaults to override log and password file locations of GUI (LogFile and PasswordFile, respectively)\ \b \ \ Version 1.31, Released 12/02/2003:\ Modified by Jonathan Gillaspie with Redstone Software, Inc.\ osxvnc@redstonesoftware.com\ \ \b0 Fixed problem with Startup Scripts not able to handle spaces in path \b \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b0 \cf0 Fixed problem with StartupItem not starting up on some systems due to incorrect StartupItem.plist\ Fixed problem with connecting to some clients when running on 10.1.5 (Unknown Auth Type)\ Fixed crashing bug when a non-ZRLE client disconnected\ Fixed problem with GUI autorestart flag not always restarting\ Clarify Screen Resolution changed message.\ Added a -restartonuserswitch command line flag to quit the server (and allow it to be restarted) on a user switch\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b \cf0 \b0 Improved performance with respect to registering for local screen updates (Win2VNC and X2VNC)\ Change to help with Mac OS stuttering when no clients are connected\ \b \ \ Version 1.3, Released 9/17/2003:\ Modified by Jonathan Gillaspie with Redstone Software, Inc.\ osxvnc@redstonesoftware.com\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b0 \cf0 \ OSXvnc GUI has been broken out to allow for more options and to match Preference Panes more closely.\ Added GUI controls to set for System Startup Up (Including Authentication)\ WARNING: OSXvnc run at StartUp Does NOT have pasteboard synchronization\ Added Mac OS X Cursor Support\ Added RichCursorSupport (RFB 3.7 + Tight) \ Added CursorPositionUpdate Support (Tight)\ Supports Dynamic Screen Sizing (Clients need no longer reconnect after a screen size change - RFB 3.7)\ \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b \cf0 \b0 Fixed crashing bug where certain unknown keys would crash OSXvnc \b \ \b0 Fixed problem with Shift-Tab (sent from OS X) being ignored as an End Of Medium character, when it didn't crash the whole server \b \ \b0 Fixed problem with OSXvnc causing machine interruptions when no clients connected by disabling poll for ScreenUpdates (Bug-770661)\ Now Attempting to pass the CGCharCode, reports that this improves stability (no crashing during key events like Return).\ Added Bundle Loading to hopefully allow OSXvnc to run on 10.0 and use 10.2 and 10.3 specific enhancements\ Fixed an occasional problem sending a rectangle without having accounted for it\ Fixed a rare bug where it was occasionally possible for clients to miss a copy event which occurred on the server. \b \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b0 \cf0 Fixed so that scroll wheel events don't leak by adding NSAutoreleasePool (Bug-760383)\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b \cf0 \b0 Fixed some pasteboard problems with non text put to pasteboard\ \b \b0 Minor Performance improvements for delay between thread notifications\ \ \ \b Version 1.2, Released 5/7/2003:\ Modified by Jonathan Gillaspie with Redstone Software, Inc.\ osxvnc@redstonesoftware.com\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b0 \cf0 Improvements to StartupItems script for Startup on System Boot\ Fixed so that client keys which are being held down by a client will be released when the client disconnects\ Fixed pasteboard bug where Server Cut Text event was being sent only in response to screen updates and sometimes within an RFB\ Fixed problem where server sometimes says it needs to restart when nothing changed\ Fixed an occasional Crash on Disconnect in 10.1\ Fixed a problem with lossy conversion to CStrings for clipboard contents with non-roman characters.\ Setup run-loop to only poll screen when clients are connected, for improved performance.\ Change to place temporary files in /tmp if the application package is not writable. (10.2 only)\ \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b \cf0 \ Version 1.11, Released 1/18/2003:\ Modified by Jonathan Gillaspie with Redstone Software, Inc.\ osxvnc@redstonesoftware.com\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b0 \cf0 * Contributions from (OSXvncPlus) by Steven Tamm\ * Contributions from (OSXvnc 0.8) by Mihai Parparita\ * Cool Icon Contributed by Martin Goneau ( http://www.goneau.com )\ Included StarupItems folder for Startup on System Boot\ Version 1.11 of StarupItems Script will relaunch after a user logout\ GUI will now offer Server Restart when appropriate\ OSXvnc now supports Scroll Wheel Mice (compliant with RealVNC 3.3.5+)\ OSXvnc now supports zRLE encoding (compliant with RealVNC 3.3.4+)\ 8-Bit color now works\ Can optionally set to allow only local connections (useful with SSH)\ Updated FAQ with lots of useful information\ Enhanced Keyboard Mapping Performance\ Now compatible with all versions of Chicken of the VNC\ Fixed which caused pointer events to be locked out and occasionally not recognized\ Fixed to a problem when multiple clients were using encodings that use Zlib compression\ Fixed to a problem where changing screen resolution didn't work if launched command line\ Fixed to the Zero Size Rect\ Fixed to the default keymapping for ~ and ` keys\ \ \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b \cf0 Version 1.0, Released 9/26/2002;\ Modified by Jonathan Gillaspie & Doug Simons with Redstone Software, Inc. \b0 \b osxvnc@redstonesoftware.com\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b0 \cf0 VNC Server will restart if the screen resolution Changes\ Now sends updates on request as per protocol\ Now Handles Pasteboard events\ Now correctly handles multiple connections\ Now stores setting in preferences\ Now pulls host name for default display\ Now defaults to display numer 0 = Port 5900 \ Doesn't launch second icon to dock\ Now able to swap mouse #2/#3 for Right Clicks\ Allows Disabling Remote Keyboard and Mouse\ Allows Autostart server on launch\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \i\b \cf3 \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \i0\b0 \cf0 \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b \cf0 Version 0.7, Released 4/23/2002:\ Modified by Mahmud Haque mahmud@bcm.tmc.edu\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b0 \cf0 Add support for zlib and tight encoding ( codes from Tightvnc source).\ Add support for zlibhex encoding ( codes from Tridia source).\ \ \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b \cf0 Version 0.6, Released 5/14/2001: \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b0 \cf0 Add support for controlling display dimming and sleep based on\ patch submitted by Jed Davis . A dimmed\ display now wakes up when there is VNC input.\ Various minor UI fixes: remove console debugging output; add\ 0 to the list of display numbers; change default display name\ to "Mac OS X"; don't leave the UI disabled when the server dies\ unexpectedly.\ \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b \cf0 Version 0.5, released 4/25/2001:\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b0 \cf0 Initial release.\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b \cf0 \ \ \ Things To Do:\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b0 \cf0 \ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b \cf0 Still to do:\ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\partightenfactor0 \b0 \cf0 \ Bundles performance optimization\ \ Move Disable Logic To Puma Bundle - Necessary for 10.0?\ \ Mouse Cursor:\ Occasional cursor artifacts (disabling cursor display didn't seem to help)\ Problem with partial transparency on cursors - displayed using threshold\ \ Fix so that server doesn't die when user logs out \ Tried using demonize, didn't seem to fix it, I think it needs to be the run loop which shuts down\ \ Option to set background to Black on Connect\ ( \f2\fs20 /System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background -module "" &)\ \f0\fs24 \ Disable the screen-blanking/screen-saver while people are connected\ It does some of this, must verify\ \ Fix bug when running with local screen in 256 Color Mode\ \ Fix bug in CoRRE\ \ Support For Multiple Physical Displays\ Have some basics in but haven't resolved dealing with the multiple screens as part of a larger screen area (need to translate events, etc.)\ \ Replace -localhost \f2\fs20 \cf2 \CocoaLigature0 \f0\fs24 \cf0 \CocoaLigature1 with full -vncauth file\ \ Add inetd/xinetd support\ So OSXvnc will startup when a request comes in\ Look in RealVNC 4.0 for example\ \ Add "Send Full Screen" Mode - Useful for things like Keynote which bypasses CGRemoteOperations API\ Possibly Detect when machine enters such a mode - ie starts running Keynote\ \ Paint in Local Mouse Cursor Option\ Try using the rfbLocalBuffer logic - BUT instead of running the whole screen through that \ Just send an update for cursor position when cursor moves. Or when other updates go out.\ } ================================================ FILE: fr.lproj/Copying.rtf ================================================ {\rtf1\mac\ansicpg10000\cocoartf102 \readonlydoc1{\fonttbl\f0\fswiss\fcharset77 Helvetica-Bold;\f1\fswiss\fcharset77 Helvetica;\f2\fswiss\fcharset77 Helvetica-Oblique; } {\colortbl;\red255\green255\blue255;\red255\green0\blue0;} \paperw11900\paperh16840\margl1440\margr1440\vieww11720\viewh14400\viewkind0 \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc \f0\b\fs36 \cf0 Licence Publique G\'8en\'8erale GNU Version 2, Juin 1991\ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc \f1\b0\fs24 \cf0 \ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural \cf0 Free Software Foundation\ 199106\ \ \f2\i \cf2 This is an unofficial translation of the GNU General Public License into French. It was not published by the Free Software Foundation, and does not legally state the distribution terms for software that uses the GNU GPL--only the original English text of the GNU GPL does that. However, we hope that this translation will help French speakers understand the GNU GPL better. \ \ Voici (http://www.linux-france.org/article/these/gpl.html) une adaptation non officielle de la Licence Publique G\'8en\'8erale du projet GNU. Elle n'a pas \'8et\'8e publi\'8ee par la Free Software Foundation et son contenu n'a aucune port\'8ee l\'8egale car seule la version anglaise de ce document d\'8etaille le mode de distribution des logiciels sous GNU GPL. Nous esp\'8erons cependant qu'elle permettra aux francophones de mieux comprendre la GPL. \f1\i0 \cf0 \ \ \ \f0\b\fs30 \ul 1. Copyright \f1\b0\fs24 \ulnone \ \ Copyright \'a9 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 \'83tats-Unis, 1989, 1991.\ \ La copie et la distribution de copies exactes de ce document sont autoris\'8ees, mais aucune modification n'est permise.\ \ \ \f0\b\fs32 \ul 2. Pr\'8eambule \f1\b0\fs24 \ulnone \ \ Les licences d'utilisation de la plupart des programmes sont d\'8efinies pour limiter ou supprimer toute libert\'8e \'88 l'utilisateur. \'cb l'inverse, la Licence Publique G\'8en\'8erale (General Public License) est destin\'8ee \'88 vous garantir la libert\'8e de partager et de modifier les logiciels libres, et de s'assurer que ces logiciels sont effectivement accessibles \'88 tout utilisateur.\ \ Cette Licence Publique G\'8en\'8erale s'applique \'88 la plupart des programmes de la Free Software Foundation, comme \'88 tout autre programme dont l'auteur l'aura d\'8ecid\'8e (d'autres logiciels de la FSF sont couverts pour leur part par la Licence Publique G\'8en\'8erale pour Biblioth\'8fques GNU (LGPL)). Vous pouvez aussi appliquer les termes de cette Licence \'88 vos propres programmes, si vous le d\'8esirez.\ \ Libert\'8e des logiciels ne signifie pas n\'8ecessairement gratuit\'8e. Notre Licence est con\'8due pour vous assurer la libert\'8e de distribuer des copies des programmes, gratuitement ou non, de recevoir le code source ou de pouvoir l'obtenir, de modifier les programmes ou d'en utiliser des \'8el\'8ements dans de nouveaux programmes libres, en sachant que vous y \'90tes autoris\'8e.\ \ Afin de garantir ces droits, nous avons d\'9e introduire des restrictions interdisant \'88 quiconque de vous les refuser ou de vous demander d'y renoncer. Ces restrictions vous imposent en retour certaines obligations si vous distribuez ou modifiez des copies de programmes prot\'8eg\'8es par la Licence. En d'autre termes, il vous incombera en ce cas de:\ \ * transmettre aux destinataires tous les droits que vous poss\'8edez,\ * exp\'8edier aux destinataires le code source ou bien tenir celui-ci \'88 leur disposition,\ * leur remettre cette Licence afin qu'ils prennent connaissance de leurs droits.\ \ Nous prot\'8egeons vos droits de deux fa\'8dons: d'abord par le copyright du logiciel, ensuite par la remise de cette Licence qui vous autorise l\'8egalement \'88 copier, distribuer et/ou modifier le logiciel.\ \ En outre, pour prot\'8eger chaque auteur ainsi que la FSF, nous affirmons solennellement que le programme concern\'8e ne fait l'objet d'aucune garantie. Si un tiers le modifie puis le redistribue, tous ceux qui en recevront une copie doivent savoir qu'il ne s'agit pas de l'original afin qu'une copie d\'8efectueuse n'entache pas la r\'8eputation de l'auteur du logiciel.\ \ Enfin, tout programme libre est sans cesse menac\'8e par des d\'8ep\'99ts de brevets. Nous souhaitons \'88 tout prix \'8eviter que des distributeurs puissent d\'8eposer des brevets sur les Logiciels Libres pour leur propre compte. Pour \'8eviter cela, nous stipulons bien que tout d\'8ep\'99t \'8eventuel de brevet doit accorder express\'8ement \'88 tout un chacun le libre usage du produit.\ \ Les dispositions pr\'8ecises et les conditions de copie, de distribution et de modification de nos logiciels sont les suivantes:\ \ \ \f0\b\fs32 \ul 3. Stipulations et conditions relatives \'88 la copie, la distribution et la modification \f1\b0\fs24 \ulnone \ \ \f0\b * Article 0. \f1\b0 La pr\'8esente Licence s'applique \'88 tout Programme (ou autre travail) o\'9d figure une note, plac\'8ee par le d\'8etenteur des droits, stipulant que ledit Programme ou travail peut \'90tre distribu\'8e selon les termes de la pr\'8esente Licence. Le terme Programme d\'8esigne aussi bien le Programme lui-m\'90me que tout travail qui en est d\'8eriv\'8e selon la loi, c'est-\'88-dire tout ouvrage reproduisant le Programme ou une partie de celui-ci, \'88 l'identique ou bien modifi\'8e, et/ou traduit dans une autre langue (la traduction est consid\'8er\'8ee comme une modification). Chaque personne concern\'8ee par la Licence Publique G\'8en\'8erale sera d\'8esign\'8ee par le terme Vous. Les activit\'8es autres que copie, distribution et modification ne sont pas couvertes par la pr\'8esente Licence et sortent de son cadre. Rien ne restreint l'utilisation du Programme et les donn\'8ees issues de celui-ci ne sont couvertes que si leur contenu constitue un travail bas\'8e sur le logiciel (ind\'8ependemment du fait d'avoir \'8et\'8e r\'8ealis\'8e en lan\'8dant le Programme). Tout d\'8epend de ce que le Programme est cens\'8e produire.\ \ \f0\b * Article 1. \f1\b0 Vous pouvez copier et distribuer des copies conformes du code source du Programme, tel que Vous l'avez re\'8du, sur n'importe quel support, \'88 condition de placer sur chaque copie un copyright appropri\'8e et une restriction de garantie, de ne pas modifier ou omettre toutes les stipulations se r\'8ef\'8erant \'88 la pr\'8esente Licence et \'88 la limitation de garantie, et de fournir avec toute copie du Programme un exemplaire de la Licence. Vous pouvez demander une r\'8etribution financi\'8fre pour la r\'8ealisation de la copie et demeurez libre de proposer une garantie assur\'8ee par vos soins, moyennant finances.\ \ \f0\b * Article 2. \f1\b0 Vous pouvez modifier votre copie ou vos copies du Programme ou partie de celui-ci, ou d'un travail bas\'8e sur ce Programme, et copier et distribuer ces modifications selon les termes de l'article 1, \'88 condition de Vous conformer \'8egalement aux conditions suivantes:\ o a) Ajouter aux fichiers modifi\'8es l'indication tr\'8fs claire des modifications effectu\'8ees, ainsi que la date de chaque changement.\ o b) Distribuer sous les termes de la Licence Publique G\'8en\'8erale l'ensemble de toute r\'8ealisation contenant tout ou partie du Programme, avec ou sans modifications.\ o c) Si le Programme modifi\'8e lit des commandes de mani\'8fre interactive lors de son ex\'8ecution, faire en sorte qu'il affiche, lors d'une invocation ordinaire, le copyright appropri\'8e en indiquant clairement la limitation de garantie (ou la garantie que Vous Vous engagez \'88 fournir Vous-m\'90me), qu'il stipule que tout utilisateur peut librement redistribuer le Programme selon les conditions de la Licence Publique G\'8en\'8erale GNU, et qu'il montre \'88 tout utilisateur comment lire une copie de celle-ci (exception: si le Programme original est interactif mais n'affiche pas un tel message en temps normal, tout travail d\'8eriv\'8e de ce Programme ne sera pas non plus contraint de l'afficher).\ Toutes ces conditions s'appliquent \'88 l'ensemble des modifications. Si des \'8el\'8ements identifiables de ce travail ne sont pas d\'8eriv\'8es du Programme et peuvent \'90tre raisonnablement consid\'8er\'8es comme ind\'8ependants, la pr\'8esente Licence ne s'applique pas \'88 ces \'8el\'8ements lorsque Vous les distribuez seuls. Mais, si Vous distribuez ces m\'90mes \'8el\'8ements comme partie d'un ensemble coh\'8erent dont le reste est bas\'8e sur un Programme soumis \'88 la Licence, ils lui sont \'8egalement soumis, et la Licence s'\'8etend ainsi \'88 l'ensemble du produit, quel qu'en soit l'auteur. Cet article n'a pas pour but de s'approprier ou de contester vos droits sur un travail enti\'8frement r\'8ealis\'8e par Vous, mais plut\'99t d'ouvrir droit \'88 un contr\'99le de la libre distribution de tout travail d\'8eriv\'8e ou collectif bas\'8e sur le Programme. En outre, toute fusion d'un autre travail, non bas\'8e sur le Programme, avec le Programme (ou avec un travail d\'8eriv\'8e de ce dernier), effectu\'8ee sur un support de stockage ou de distribution, ne fait pas tomber cet autre travail sous le contr\'99le de la Licence.\ \ \f0\b * Article 3. \f1\b0 Vous pouvez copier et distribuer le Programme (ou tout travail d\'8eriv\'8e selon les conditions \'8enonc\'8ees dans l'article 1) sous forme de code objet ou ex\'8ecutable, selon les termes des articles 0 et 1, \'88 condition de respecter une des clauses suivantes:\ o a) Fournir le code source complet du Programme, sous une forme lisible par un ordinateur et selon les termes des articles 0 et 1, sur un support habituellement utilis\'8e pour l'\'8echange de donn\'8ees; ou,\ o b) Faire une offre \'8ecrite, valable pendant au moins trois ans, pr\'8evoyant de donner \'88 tout tiers qui en fera la demande une copie, sous forme lisible par un ordinateur, du code source correspondant, pour un tarif n'exc\'8edant pas le co\'9et de la copie, selon les termes des articles 0 et 1, sur un support couramment utilis\'8e pour l'\'8echange de donn\'8ees informatiques; ou,\ o c) Informer le destinataire de l'endroit o\'9d le code source peut \'90tre obtenu (cette solution n'est recevable que dans le cas d'une distribution non commerciale, et uniquement si Vous avez re\'8du le Programme sous forme de code objet ou ex\'8ecutable avec l'offre pr\'8evue \'88 l'alin\'8ea b ci-dessus).\ Le code source d'un travail d\'8esigne la forme de cet ouvrage sous laquelle les modifications sont les plus ais\'8ees. Sont ainsi d\'8esign\'8es la totalit\'8e du code source de tous les modules composant un Programme ex\'8ecutable, de m\'90me que tout fichier de d\'8efinition associ\'8e, ainsi que les scripts utilis\'8es pour effectuer la compilation et l'installation du Programme ex\'8ecutable. Toutefois, l'environnement standard de d\'8eveloppement du syst\'8fme d'exploitation mis en oeuvre (source ou binaire) -- compilateurs, biblioth\'8fques, noyau, etc. -- constitue une exception, sauf si ces \'8el\'8ements sont diffus\'8es en m\'90me temps que le Programme ex\'8ecutable. Si la distribution de l'ex\'8ecutable ou du code objet consiste \'88 offrir un acc\'8fs permettant de copier le Programme depuis un endroit particulier, l'offre d'un acc\'8fs \'8equivalent pour se procurer le code source au m\'90me endroit est consid\'8er\'8e comme une distribution de ce code source, m\'90me si l'utilisateur choisit de ne pas profiter de cette offre.\ \ \f0\b * Article 4. \f1\b0 Vous ne pouvez pas copier, modifier, c\'8eder, d\'8eposer ou distribuer le Programme d'une autre mani\'8fre que l'autorise la Licence Publique G\'8en\'8erale. Toute tentative de ce type annule imm\'8ediatement vos droits d'utilisation du Programme sous cette Licence. Toutefois, les tiers ayant re\'8du de Vous des copies du Programme ou le droit d'utiliser ces copies continueront \'88 b\'8en\'8eficier de leur droit d'utilisation tant qu'ils respecteront pleinement les conditions de la Licence.\ \ \f0\b * Article 5. \f1\b0 Ne l'ayant pas sign\'8ee, Vous n'\'90tes pas oblig\'8e d'accepter cette Licence. Cependant, rien d'autre ne Vous autorise \'88 modifier ou distribuer le Programme ou quelque travaux d\'8eriv\'8es: la loi l'interdit tant que Vous n'acceptez pas les termes de cette Licence. En cons\'8equence, en modifiant ou en distribuant le Programme (ou tout travail bas\'8e sur lui), Vous acceptez implicitement tous les termes et conditions de cette Licence.\ \ \f0\b * Article 6. \f1\b0 La diffusion d'un Programme (ou de tout travail d\'8eriv\'8e) suppose l'envoi simultan\'8e d'une licence autorisant la copie, la distribution ou la modification du Programme, aux termes et conditions de la Licence. Vous n'avez pas le droit d'imposer de restrictions suppl\'8ementaires aux droits transmis au destinataire. Vous n'\'90tes pas responsable du respect de la Licence par un tiers.\ \ \f0\b * Article 7. \f1\b0 Si, \'88 la suite d'une d\'8ecision de Justice, d'une plainte en contrefa\'8don ou pour toute autre raison (li\'8ee ou non \'88 la contrefa\'8don), des conditions Vous sont impos\'8ees (que ce soit par ordonnance, accord amiable ou autre) qui se r\'8ev\'8flent incompatibles avec les termes de la pr\'8esente Licence, Vous n'\'90tes pas pour autant d\'8egag\'8e des obligations li\'8ees \'88 celle-ci: si Vous ne pouvez concilier vos obligations l\'8egales ou autres avec les conditions de cette Licence, Vous ne devez pas distribuer le Programme. Si une partie quelconque de cet article est invalid\'8ee ou inapplicable pour quelque raison que ce soit, le reste de l'article continue de s'appliquer et l'int\'8egralit\'8e de l'article s'appliquera en toute autre circonstance. Le pr\'8esent article n'a pas pour but de Vous pousser \'88 enfreindre des droits ou des dispositions l\'8egales ni en contester la validit\'8e; son seul objectif est de prot\'8eger l'int\'8egrit\'8e du syst\'8fme de distribution du Logiciel Libre. De nombreuses personnes ont g\'8en\'8ereusement contribu\'8e \'88 la large gamme de Programmes distribu\'8ee de cette fa\'8don en toute confiance; il appartient \'88 chaque auteur/donateur de d\'8ecider de diffuser ses Programmes selon les crit\'8fres de son choix.\ \ \f0\b * Article 8. \f1\b0 Si la distribution et/ou l'utilisation du Programme est limit\'8ee dans certains pays par des brevets ou des droits sur des interfaces, le d\'8etenteur original des droits qui place le Programme sous la Licence Publique G\'8en\'8erale peut ajouter explicitement une clause de limitation g\'8eographique excluant ces pays. Dans ce cas, cette clause devient une partie int\'8egrante de la Licence.\ \ \f0\b * Article 9. \f1\b0 La Free Software Foundation se r\'8eserve le droit de publier p\'8eriodiquement des mises \'88 jour ou de nouvelles versions de la Licence. R\'8edig\'8ees dans le m\'90me esprit que la pr\'8esente version, elles seront cependant susceptibles d'en modifier certains d\'8etails \'88 mesure que de nouveaux probl\'8fmes se font jour. Chaque version poss\'8fde un num\'8ero distinct. Si le Programme pr\'8ecise un num\'8ero de version de cette Licence et \'c7toute version ult\'8erieure\'c8, Vous avez le choix de suivre les termes et conditions de cette version ou de toute autre version plus r\'8ecente publi\'8ee par la Free Software Foundation. Si le Programme ne sp\'8ecifie aucun num\'8ero de version, Vous pouvez alors choisir l'une quelconque des versions publi\'8ees par la Free Software Foundation.\ \ \f0\b * Article 10. \f1\b0 Si Vous d\'8esirez incorporer des \'8el\'8ements du Programme dans d'autres Programmes libres dont les conditions de distribution diff\'8frent, Vous devez \'8ecrire \'88 l'auteur pour lui en demander la permission. Pour ce qui est des Programmes directement d\'8epos\'8es par la Free Software Foundation, \'8ecrivez-nous: une exception est toujours envisageable. Notre d\'8ecision sera bas\'8ee sur notre volont\'8e de pr\'8eserver la libert\'8e de notre Programme ou de ses d\'8eriv\'8es et celle de promouvoir le partage et la r\'8eutilisation du logiciel en g\'8en\'8eral. \ \ \f0\b LIMITATION DE GARANTIE \f1\b0 \ \f0\b * Article 11. \f1\b0 Parce que l'utilisation de ce Programme est libre et gratuite, aucune garantie n'est fournie, comme le permet la loi. Sauf mention \'8ecrite, les d\'8etenteurs du copyright et/ou les tiers fournissent le Programme en l'\'8etat, sans aucune sorte de garantie explicite ou implicite, y compris les garanties de commercialisation ou d'adaptation dans un but particulier. Vous assumez tous les risques quant \'88 la qualit\'8e et aux effets du Programme. Si le Programme est d\'8efectueux, Vous assumez le co\'9et de tous les services, corrections ou r\'8eparations n\'8ecessaires.\ \f0\b * Article 12. \f1\b0 Sauf lorsqu'explicitement pr\'8evu par la Loi ou accept\'8e par \'8ecrit, ni le d\'8etenteur des droits, ni quiconque autoris\'8e \'88 modifier et/ou redistribuer le Programme comme il est permis ci-dessus ne pourra \'90tre tenu pour responsable de tout dommage direct, indirect, secondaire ou accessoire (pertes financi\'8fres dues au manque \'88 gagner, \'88 l'interruption d'activit\'8es ou \'88 la perte de donn\'8ees, etc., d\'8ecoulant de l'utilisation du Programme ou de l'impossibilit\'8e d'utiliser celui-ci).\ \ \f0\b\fs28 FIN DES TERMES ET CONDITIONS\ \ \f1\b0\fs24 \ \f0\b\fs32 \ul 4. Comment appliquer ces directives \'88 vos nouveaux programmes \f1\b0\fs24 \ulnone \ \ Si vous d\'8eveloppez un nouveau programme et d\'8esirez en faire b\'8en\'8eficier tout un chacun, la meilleure m\'8ethode est d'en faire un Logiciel Libre que tout le monde pourra redistribuer et modifier selon les termes de la Licence Publique G\'8en\'8erale.\ \ Pour cela, ins\'8erez les indications suivantes dans votre programme (il est pr\'8ef\'8erable et plus s\'9er de les faire figurer au d\'8ebut de chaque fichier source; dans tous les cas, chaque module source devra comporter au minimum la ligne de \'c7copyright\'c8 et indiquer o\'9d r\'8esident toutes les autres indications):\ \ ((une ligne pour donner le nom du programme et donner une id\'8ee de sa finalit\'8e))\ \ Copyright (C) 19xx ((nom de l'auteur))\ \ Ce programme est libre, vous pouvez le redistribuer et/ou le modifier selon les termes de la Licence Publique G\'8en\'8erale GNU publi\'8ee par la Free Software Foundation (version 2 ou bien toute autre version ult\'8erieure choisie par vous).\ \ Ce programme est distribu\'8e car potentiellement utile, mais SANS AUCUNE GARANTIE, ni explicite ni implicite, y compris les garanties de commercialisation ou d'adaptation dans un but sp\'8ecifique. Reportez-vous \'88 la Licence Publique G\'8en\'8erale GNU pour plus de d\'8etails.\ \ Vous devez avoir re\'8du une copie de la Licence Publique G\'8en\'8erale GNU en m\'90me temps que ce programme; si ce n'est pas le cas, \'8ecrivez \'88 la Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, \'83tats-Unis.\ \ Ajoutez \'8egalement votre adresse \'8electronique, le cas \'8ech\'8eant, ainsi que votre adresse postale.\ \ Si le programme est interactif, faites-lui afficher un court avertissement du type de celui-ci \'88 chaque invocation:\ \ ...(nom du programme) version 69, Copyright (C) 19aa nom de l'auteur\ \ ...(nom du programme) est fourni sans AUCUNE GARANTIE. Pour plus de d\'8etails, tapez `g'.\ \ Ce programme est libre et vous \'90tes encourag\'8e \'88 le redistribuer sous certaines conditions; tapez `c' pour plus de d\'8etails.\ \ Les commandes hypoth\'8etiques `g' et `c' doivent afficher les sections appropri\'8ees de la Licence Publique G\'8en\'8erale GNU. Bien entendu, vous pouvez implanter ces commandes comme bon vous semble: options dans un menu, ou bien accessibles d'un clic de souris, etc., tout d\'8epend de votre programme.\ \ Si vous officiez en tant que programmeur, n'omettez pas de demander \'88 votre employeur, votre \'8etablissement scolaire ou autres de signer une d\'8echarge stipulant leur renoncement aux droits qu'ils pourraient avoir sur le programme:\ \ ...((employeur, \'8ecole...)) d\'8eclare par la pr\'8esente ne pas revendiquer de droits sur le programme \'c7(nom du programme)\'c8 r\'8ealis\'8e par ...((nom de l'auteur)).\ \ ((signature du responsable)), ...((date)), ...((nom et qualit\'8e du responsable)).\ \ La Licence Publique G\'8en\'8erale ne permet pas d'inclure votre programme dans des logiciels sous licence commerciale sp\'8ecifique. Si votre programme est une fonction de biblioth\'8fque, vous jugerez probablement plus judicieux de le faire relever de la Licence G\'8en\'8erale de Biblioth\'8fque GNU (LGPL) plut\'99t que de la pr\'8esente.\ } ================================================ FILE: fr.lproj/Localizable.strings ================================================ { "Host Name" = "Nom du poste"; "Host Names" = "Noms du poste"; "IP Address" = "Address IP"; "IP Addresses" = "Addresses IP"; "Screen Resolution changed - Server Reinitialized" = "Résolution d'affichage modifiée - Serveur réinitialisé"; "Server Running" = "Le serveur est activé"; "The server is not running." = "Le serveur est arrêté."; "Start Server" = "Démarrer"; "Restart Server" = "Redémarrer"; "The server is stopped." = "Le serveur est arrêté."; "Probably because the OSXvnc server is already running as a Startup Item." = "Probablement car Vine serveur est déjà lançé comme service de démarrage"; "Probably because another VNC is already using this port." = "Probablement car une autre instance de VNC utilise déjà ce port."; "The server has stopped running. See Log (%d)\n" = "Le serveur s'est arrêté. Consultez le fichier Log (%d)\n"; "The server has stopped running." = "Le serveur est arrêté."; "Need a valid Port or Display Number" = "Numéro de port / d'affichage non valide"; "Problem - Unable to store password to %@" = "Problème - Impossible d'enregistrer le mot de passe dans %@"; "Option Change Requires a Restart" = "Redémarrer le serveur pour enregistrer les changements"; "Error: No Authorization" = "Erreur: Pas d'autorisation"; "Error: Unable To Setup Password File" = "Erreur: Impossible d'initialiser le fichier de mot de passe"; "Error: Unable To Write out Temporary Script File" = "Erreur: Impossible d'écrire le fichier script temporaire"; "Startup Item Configured (Started)" = "Service de démarrage configuré (Démarrer)"; "Startup Item Disabled (Stopped)" = "Service de démarrage désactivé (Arrêté)"; "Error: Unabled to remove startup item" = "Erreur: Impossible de supprimer le service de démarrage"; "Please specify a Connect Host to establish a connection" = "Veuillez spécifier un hôte cible vers lequel établir une connexion"; "Connection invitation sent to Connect Host" = "Invitation de connexion envoyée à l'hôte cible"; } ================================================ FILE: it.lproj/Localizable.strings ================================================ { "Host Name" = "Nome dell'Host"; "Host Names" = "Nomi degli Host"; "IP Address" = "Indirizzo IP"; "IP Addresses" = "Indirizzi IP"; "Screen Resolution changed - Server Reinitialized" = "Risoluzione schermo cambiata - Server Reinizializzato"; "Server Running" = "Il server è in esecuzione"; "The server is not running." = "Il server non è in esecuzione."; "Start Server" = "Avvia Server"; "Restart Server" = "Riavvia il Server"; "The server is stopped." = "Il server è fermo."; "Probably because the OSXvnc server is already running as a Startup Item." = "Probabilmente perché il server Vine è già avviato all'avvio del Mac"; "Probably because another VNC is already using this port." = "Probabilmente perché un altro VNC sta usando questa porta."; "The server has stopped running. See Log (%d)\n" = "Il server si è fermato. Consulta il resoconto (%d)\n"; "The server has stopped running." = "Il server si è fermato."; "Need a valid Port or Display Number" = "Numero di porta / Numero Visore non corretto"; "Problem - Unable to store password to %@" = "Problema - Impossibile registrare la parola chiave in %@"; "Option Change Requires a Restart" = "Riavvia il server per rendere effettivi i cambiamenti"; "Error: No Authorization" = "Errore: Nessuna Autorizzazione"; "Error: Unable To Setup Password File" = "Errore: Impossibile impostare la parola chiave"; "Error: Unable To Write out Temporary Script File" = "Errore: Impossibile scrivere lo script temporaneo"; "Startup Item Configured (Started)" = "Elemento di avvio configurato (Avviato)"; "Startup Item Disabled (Stopped)" = "Elemento di avvio disattivato (Fermato)"; "Error: Unabled to remove startup item" = "Errore: Impossibile rimuovere l'elemento di avvio"; "Please specify a Connect Host to establish a connection" = "Per favore specifica un'host di connessione per stabilire un collegamento"; "Connection invitation sent to Connect Host" = "Invito alla connessione inviato all'host"; } ================================================ FILE: ja.lproj/Copying.rtf ================================================ {\rtf1\mac\ansicpg10000\cocoartf102 \readonlydoc1{\fonttbl\f0\fswiss\fcharset77 Helvetica;\f1\fnil\fcharset78 HiraKakuPro-W3;} {\colortbl;\red255\green255\blue255;} \paperw11900\paperh16840\margl1440\margr1440\vieww9000\viewh9000\viewkind0 \pard\tx565\tx1133\tx1700\tx2266\tx2833\tx3401\tx3967\tx4535\tx5102\tx5669\tx6235\tx6802\ql\qnatural \f0\fs24 \cf0 GNU \f1 \'88\'ea\'94\'ca\'8c\'f6\'8f\'4f\'97\'98\'97\'70\'8b\'96\'91\'f8\'8c\'5f\'96\'f1\'8f\'91\ \f0 \f1 \'83\'6f\'81\'5b\'83\'57\'83\'87\'83\'93 \f0 2 \f1 \'81\'41 \f0 1991 \f1 \'94\'4e \f0 6 \f1 \'8c\'8e\ \f0 \f1 \'93\'fa\'96\'7b\'8c\'ea\'96\'f3\'81\'41 \f0 2002 \f1 \'94\'4e \f0 5 \f1 \'8c\'8e \f0 20 \f1 \'93\'fa\ \ \f0 Copyright (C) 1989, 1991 Free Software Foundation, Inc.\ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\ \f1 \'82\'b1\'82\'cc\'97\'98\'97\'70\'8b\'96\'91\'f8\'8c\'5f\'96\'f1\'8f\'91\'82\'f0\'81\'41\'88\'ea\'8e\'9a\'88\'ea\'8b\'e5\'82\'bb\'82\'cc\'82\'dc\'82\'dc\'82\'c9\'95\'a1\'90\'bb\'82\'b5\'94\'d0\'95\'7a\'82\'b7\'82\'e9\'82\'b1\'82\'c6\'82\'cd\'8b\'96\'89\'c2\'82\'b7\'82\'e9\'81\'42\ \f0 \f1 \'82\'b5\'82\'a9\'82\'b5\'95\'cf\'8d\'58\'82\'cd\'94\'46\'82\'df\'82\'c8\'82\'a2\'81\'42\ \ \f0 This is an unofficial translation of the GNU General Public License\ into Japanese. It was not published by the Free Software Foundation,\ and does not legally state the distribution terms for software that\ uses the GNU GPL--only the original English text of the GNU GPL does\ that. However, we hope that this translation will help Japanese\ speakers understand the GNU GPL better.\ \ ( \f1 \'96\'f3 \f0 : \f1 \'88\'c8\'89\'ba\'82\'cd \f0 GNU General Public License \f1 \'82\'cc\'94\'f1\'8c\'f6\'8e\'ae\'82\'c8\'93\'fa\'96\'7b\'8c\'ea\'96\'f3\'82\'c5\'82\'b7\'81\'42\'82\'b1\'82\'ea\'82\'cd\'83\'74\ \f0 \f1 \'83\'8a\'81\'5b\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'8d\'e0\'92\'63 \f0 (the Free Software Foundataion) \f1 \'82\'c9\'82\'e6\'82\'c1\'82\'c4\'94\'ad\'95\'5c\'82\'b3\'82\'ea\'82\'bd\ \f0 \f1 \'82\'e0\'82\'cc\'82\'c5\'82\'cd\'82\'c8\'82\'ad\'81\'41 \f0 GNU GPL \f1 \'82\'f0\'93\'4b\'97\'70\'82\'b5\'82\'bd\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'82\'cc\'94\'d0\'95\'7a\'8f\'f0\'8c\'8f\'82\'f0\'96\'40\'93\'49\'82\'c9\'97\'4c\'8c\'f8\'82\'c8\'8c\'60\ \f0 \f1 \'82\'c5\'8f\'71\'82\'d7\'82\'bd\'82\'e0\'82\'cc\'82\'c5\'82\'cd\'82\'a0\'82\'e8\'82\'dc\'82\'b9\'82\'f1\'81\'42\'94\'d0\'95\'7a\'8f\'f0\'8c\'8f\'82\'c6\'82\'b5\'82\'c4\'82\'cd \f0 GNU GPL \f1 \'82\'cc\'89\'70\'8c\'ea\'94\'c5\'83\'65\'83\'4c\'83\'58\'83\'67\'82\'c5\ \f0 \f1 \'8e\'77\'92\'e8\'82\'b3\'82\'ea\'82\'c4\'82\'a2\'82\'e9\'82\'e0\'82\'cc\'82\'cc\'82\'dd\'82\'aa\'97\'4c\'8c\'f8\'82\'c5\'82\'b7\'81\'42\'82\'b5\'82\'a9\'82\'b5\'82\'c8\'82\'aa\'82\'e7\'81\'41\'8e\'84\'82\'bd\'82\'bf\'82\'cd\'82\'b1\'82\'cc\'96\'7c\'96\'f3\'82\'aa\'81\'41\ \f0 \f1 \'93\'fa\'96\'7b\'8c\'ea\'82\'f0\'8e\'67\'97\'70\'82\'b7\'82\'e9\'90\'6c\'81\'58\'82\'c9\'82\'c6\'82\'c1\'82\'c4 \f0 GNU GPL \f1 \'82\'f0\'82\'e6\'82\'e8\'97\'c7\'82\'ad\'97\'9d\'89\'f0\'82\'b7\'82\'e9\'8f\'95\'82\'af\'82\'c6\'82\'c8\'82\'e9\'82\'b1\'82\'c6\'82\'f0\ \f0 \f1 \'96\'5d\'82\'f1\'82\'c5\'82\'a2\'82\'dc\'82\'b7\'81\'42 \f0 )\ \ \f1 \'96\'7c\'96\'f3\'82\'cd \f0 \f1 \'94\'aa\'93\'63\'90\'5e\'8d\'73 \f0 \f1 \'82\'aa\'8d\'73\'82\'c1\'82\'bd\'81\'42\'8c\'b4\'95\'b6\'82\'cd\ \f0 http://www.gnu.org/licenses/gpl.txt \f1 \'82\'c5\'82\'a0\'82\'e9\'81\'42\'8c\'eb\'96\'f3\'82\'cc\'8e\'77\'93\'45\'82\'e2\'89\'fc\'91\'50\'88\'c4\'82\'f0\'8a\'bd\'8c\'7d\'82\'b7\ \f0 \f1 \'82\'e9\'81\'42\ \f0 \f1 \'82\'cd\'82\'b6\'82\'df\'82\'c9\ \ \'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'8c\'fc\'82\'af\'83\'89\'83\'43\'83\'5a\'83\'93\'83\'58\'82\'cc\'91\'e5\'94\'bc\'82\'cd\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'aa\'82\'bb\'82\'cc\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'82\'f0\'8b\'a4\'97\'4c\'82\'b5\'82\'bd\ \'82\'e8\'95\'cf\'8d\'58\'82\'b5\'82\'bd\'82\'e8\'82\'b7\'82\'e9\'8e\'a9\'97\'52\'82\'f0\'92\'44\'82\'a4\'82\'e6\'82\'a4\'82\'c9\'90\'dd\'8c\'76\'82\'b3\'82\'ea\'82\'c4\'82\'a2\'82\'dc\'82\'b7\'81\'42\'91\'ce\'8f\'c6\'93\'49\'82\'c9\'81\'41 \f0 GNU \f1 \'88\'ea\'94\'ca\'8c\'f6\ \'8f\'4f\'97\'98\'97\'70\'8b\'96\'91\'f8\'8c\'5f\'96\'f1\'8f\'91\'82\'cd\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'aa\'83\'74\'83\'8a\'81\'5b\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'82\'f0\'8b\'a4\'97\'4c\'82\'b5\'82\'bd\'82\'e8\'95\'cf\'8d\'58\'82\'b5\'82\'bd\'82\'e8\'82\'b7\ \'82\'e9\'8e\'a9\'97\'52\'82\'f0\'95\'db\'8f\'d8\'82\'b7\'82\'e9 \f0 -- \f1 \'82\'b7\'82\'c8\'82\'ed\'82\'bf\'81\'41\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'82\'aa\'82\'bb\'82\'cc\'83\'86\'81\'5b\'83\'55\'82\'b7\'82\'d7\'82\'c4\'82\'c9\'82\'c6\'82\'c1\'82\'c4\'83\'74\'83\'8a\'81\'5b\ \'82\'c5\'82\'a0\'82\'e9\'82\'b1\'82\'c6\'82\'f0\'95\'db\'8f\'d8\'82\'b7\'82\'e9\'82\'b1\'82\'c6\'82\'f0\'96\'da\'93\'49\'82\'c6\'82\'b5\'82\'c4\'82\'a2\'82\'dc\'82\'b7\'81\'42\'82\'b1\'82\'cc\'88\'ea\'94\'ca\'8c\'f6\'8f\'4f\'97\'98\'97\'70\'8b\'96\'91\'f8\'8c\'5f\'96\'f1\'8f\'91\ \'82\'cd\'83\'74\'83\'8a\'81\'5b\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'8d\'e0\'92\'63\'82\'cc\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'82\'cc\'82\'d9\'82\'c6\'82\'f1\'82\'c7\'82\'c9\'93\'4b\'97\'70\'82\'b3\'82\'ea\'82\'c4\'82\'a8\'82\'e8\'81\'41\'82\'dc\'82\'bd\ \f0 GNU GPL \f1 \'82\'f0\'93\'4b\'97\'70\'82\'b7\'82\'e9\'82\'c6\'8c\'88\'82\'df\'82\'bd\'83\'74\'83\'8a\'81\'5b\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'8d\'e0\'92\'63\'88\'c8\'8a\'4f\'82\'cc\'8d\'ec\'8e\'d2\'82\'c9\'82\'e6\'82\'e9\'83\'76\'83\'8d\'83\'4f\ \'83\'89\'83\'80\'82\'c9\'82\'e0\'93\'4b\'97\'70\'82\'b3\'82\'ea\'82\'c4\'82\'a2\'82\'dc\'82\'b7 \f0 ( \f1 \'82\'a2\'82\'ad\'82\'c2\'82\'a9\'82\'cc\'83\'74\'83\'8a\'81\'5b\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'8d\'e0\'92\'63\'82\'cc\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\ \'83\'41\'82\'c9\'82\'cd\'81\'41 \f0 GNU GPL \f1 \'82\'c5\'82\'cd\'82\'c8\'82\'ad \f0 GNU \f1 \'83\'89\'83\'43\'83\'75\'83\'89\'83\'8a\'88\'ea\'94\'ca\'8c\'f6\'8f\'4f\'97\'98\'97\'70\'8b\'96\'91\'f8\'8c\'5f\'96\'f1\'8f\'91\'82\'aa\'93\'4b\'97\'70\'82\'b3\'82\'ea\ \'82\'c4\'82\'a2\'82\'e9\'82\'b1\'82\'c6\'82\'e0\'82\'a0\'82\'e8\'82\'dc\'82\'b7 \f0 ) \f1 \'81\'42\'82\'a0\'82\'c8\'82\'bd\'82\'e0\'82\'dc\'82\'bd\'81\'41\'82\'b2\'8e\'a9\'95\'aa\'82\'cc\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'82\'c9 \f0 GNU GPL \f1 \'82\'f0\'93\'4b\'97\'70\ \'82\'b7\'82\'e9\'82\'b1\'82\'c6\'82\'aa\'89\'c2\'94\'5c\'82\'c5\'82\'b7\'81\'42\ \ \'8e\'84\'82\'bd\'82\'bf\'82\'aa\'83\'74\'83\'8a\'81\'5b\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'82\'c6\'8c\'be\'82\'a4\'82\'c6\'82\'ab\'81\'41\'82\'bb\'82\'ea\'82\'cd\'97\'98\'97\'70\'82\'cc\'8e\'a9\'97\'52\'82\'c9\'82\'c2\'82\'a2\'82\'c4\'8c\'be\'8b\'79\'82\'b5\'82\'c4\ \'82\'a2\'82\'e9\'82\'cc\'82\'c5\'82\'a0\'82\'c1\'82\'c4\'81\'41\'89\'bf\'8a\'69\'82\'cd\'96\'e2\'91\'e8\'82\'c9\'82\'b5\'82\'c4\'82\'a2\'82\'dc\'82\'b9\'82\'f1\'81\'42\'8e\'84\'82\'bd\'82\'bf\'82\'cc\'88\'ea\'94\'ca\'8c\'f6\'8f\'4f\'97\'98\'97\'70\'8b\'96\'91\'f8\'8c\'5f\'96\'f1\ \'8f\'91\'82\'cd\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'aa\'83\'74\'83\'8a\'81\'5b\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'82\'cc\'95\'a1\'90\'bb\'95\'a8\'82\'f0\'94\'d0\'95\'7a\'82\'b7\'82\'e9\'8e\'a9\'97\'52\'82\'f0\'95\'db\'8f\'d8\'82\'b7\'82\'e9\'82\'e6\'82\'a4\'90\'dd\ \'8c\'76\'82\'b3\'82\'ea\'82\'c4\'82\'a2\'82\'dc\'82\'b7 \f0 ( \f1 \'8a\'f3\'96\'5d\'82\'c9\'89\'9e\'82\'b6\'82\'c4\'82\'bb\'82\'cc\'8e\'ed\'82\'cc\'83\'54\'81\'5b\'83\'72\'83\'58\'82\'c9\'8e\'e8\'90\'94\'97\'bf\'82\'f0\'89\'db\'82\'b7\'8e\'a9\'97\'52\'82\'e0\'95\'db\'8f\'d8\'82\'b3\ \'82\'ea\'82\'dc\'82\'b7 \f0 ) \f1 \'81\'42\'82\'dc\'82\'bd\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'aa\'83\'5c\'81\'5b\'83\'58\'83\'52\'81\'5b\'83\'68\'82\'f0\'8e\'f3\'82\'af\'8e\'e6\'82\'e9\'82\'a9\'81\'41\'82\'a0\'82\'e9\'82\'a2\'82\'cd\'96\'5d\'82\'df\'82\'ce\'82\'bb\'82\'ea\'82\'f0\ \'93\'fc\'8e\'e8\'82\'b7\'82\'e9\'82\'b1\'82\'c6\'82\'aa\'89\'c2\'94\'5c\'82\'c5\'82\'a0\'82\'e9\'82\'c6\'82\'a2\'82\'a4\'82\'b1\'82\'c6\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'aa\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'82\'f0\'95\'cf\'8d\'58\'82\'b5\'81\'41\'82\'bb\'82\'cc\ \'88\'ea\'95\'94\'82\'f0\'90\'56\'82\'bd\'82\'c8\'83\'74\'83\'8a\'81\'5b\'82\'cc\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'82\'c5\'97\'98\'97\'70\'82\'c5\'82\'ab\'82\'e9\'82\'c6\'82\'a2\'82\'a4\'82\'b1\'82\'c6\'81\'41\'82\'bb\'82\'b5\'82\'c4\'81\'41\'88\'c8\'8f\'e3\'82\'c5\'8f\'71\ \'82\'d7\'82\'bd\'82\'e6\'82\'a4\'82\'c8\'82\'b1\'82\'c6\'82\'aa\'82\'c5\'82\'ab\'82\'e9\'82\'c6\'82\'a2\'82\'a4\'82\'b1\'82\'c6\'82\'aa\'82\'a0\'82\'c8\'82\'bd\'82\'c9\'92\'6d\'82\'e7\'82\'b3\'82\'ea\'82\'e9\'82\'c6\'82\'a2\'82\'a4\'82\'b1\'82\'c6\'82\'e0\'95\'db\'8f\'d8\'82\'b3\ \'82\'ea\'82\'dc\'82\'b7\'81\'42\ \ \'82\'a0\'82\'c8\'82\'bd\'82\'cc\'8c\'a0\'97\'98\'82\'f0\'8e\'e7\'82\'e9\'82\'bd\'82\'df\'81\'41\'8e\'84\'82\'bd\'82\'bf\'82\'cd\'92\'4e\'82\'a9\'82\'aa\'82\'a0\'82\'c8\'82\'bd\'82\'cc\'97\'4c\'82\'b7\'82\'e9\'82\'b1\'82\'ea\'82\'e7\'82\'cc\'8c\'a0\'97\'98\'82\'f0\'94\'db\'92\'e8\ \'82\'b7\'82\'e9\'82\'b1\'82\'c6\'82\'e2\'81\'41\'82\'b1\'82\'ea\'82\'e7\'82\'cc\'8c\'a0\'97\'98\'82\'f0\'95\'fa\'8a\'fc\'82\'b7\'82\'e9\'82\'e6\'82\'a4\'97\'76\'8b\'81\'82\'b7\'82\'e9\'82\'b1\'82\'c6\'82\'f0\'8b\'d6\'8e\'7e\'82\'b7\'82\'e9\'82\'c6\'82\'a2\'82\'a4\'90\'a7\'8c\'c0\ \'82\'f0\'89\'c1\'82\'a6\'82\'e9\'95\'4b\'97\'76\'82\'aa\'82\'a0\'82\'e8\'82\'dc\'82\'b7\'81\'42\'82\'e6\'82\'c1\'82\'c4\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'aa\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'82\'cc\'95\'a1\'90\'bb\'95\'a8\'82\'f0\'94\'d0\'95\'7a\'82\'b5\'82\'bd\ \'82\'e8\'82\'bb\'82\'ea\'82\'f0\'95\'cf\'8d\'58\'82\'b5\'82\'bd\'82\'e8\'82\'b7\'82\'e9\'8f\'ea\'8d\'87\'82\'c9\'82\'cd\'81\'41\'82\'b1\'82\'ea\'82\'e7\'82\'cc\'90\'a7\'8c\'c0\'82\'cc\'82\'bd\'82\'df\'82\'c9\'82\'a0\'82\'c8\'82\'bd\'82\'c9\'82\'a0\'82\'e9\'8e\'ed\'82\'cc\'90\'d3\ \'94\'43\'82\'aa\'94\'ad\'90\'b6\'82\'b7\'82\'e9\'82\'b1\'82\'c6\'82\'c9\'82\'c8\'82\'e8\'82\'dc\'82\'b7\'81\'42\ \ \'97\'e1\'82\'a6\'82\'ce\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'aa\'83\'74\'83\'8a\'81\'5b\'82\'c8\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'82\'cc\'95\'a1\'90\'bb\'95\'a8\'82\'f0\'94\'d0\'95\'7a\'82\'b7\'82\'e9\'8f\'ea\'8d\'87\'81\'41\'97\'4c\'97\'bf\'82\'a9\'96\'b3\'97\'bf\'82\'c9\ \'8a\'d6\'82\'ed\'82\'e7\'82\'b8\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'cd\'8e\'a9\'95\'aa\'82\'aa\'97\'4c\'82\'b7\'82\'e9\'8c\'a0\'97\'98\'82\'f0\'91\'53\'82\'c4\'8e\'f3\'97\'cc\'8e\'d2\'82\'c9\'97\'5e\'82\'a6\'82\'c8\'82\'af\'82\'ea\'82\'ce\'82\'c8\'82\'e8\'82\'dc\'82\'b9\'82\'f1\'81\'42\ \'82\'dc\'82\'bd\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'cd\'94\'de\'82\'e7\'82\'e0\'83\'5c\'81\'5b\'83\'58\'83\'52\'81\'5b\'83\'68\'82\'f0\'8e\'f3\'82\'af\'8e\'e6\'82\'e9\'82\'a9\'8e\'e8\'82\'c9\'93\'fc\'82\'ea\'82\'e9\'82\'b1\'82\'c6\'82\'aa\'82\'c5\'82\'ab\'82\'e9\'82\'e6\'82\'a4\ \'95\'db\'8f\'d8\'82\'b5\'82\'c8\'82\'af\'82\'ea\'82\'ce\'82\'c8\'82\'e8\'82\'dc\'82\'b9\'82\'f1\'81\'42\'82\'bb\'82\'b5\'82\'c4\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'cd\'94\'de\'82\'e7\'82\'c9\'91\'ce\'82\'b5\'82\'c4\'88\'c8\'89\'ba\'82\'c5\'8f\'71\'82\'d7\'82\'e9\'8f\'f0\'8c\'8f\ \'82\'f0\'8e\'a6\'82\'b5\'81\'41\'94\'de\'82\'e7\'82\'c9\'8e\'a9\'82\'e7\'82\'cc\'8e\'9d\'82\'c2\'8c\'a0\'97\'98\'82\'c9\'82\'c2\'82\'a2\'82\'c4\'92\'6d\'82\'e7\'82\'b5\'82\'df\'82\'e9\'82\'e6\'82\'a4\'82\'c9\'82\'b5\'82\'c8\'82\'af\'82\'ea\'82\'ce\'82\'c8\'82\'e8\'82\'dc\'82\'b9\ \'82\'f1\'81\'42\ \ \'8e\'84\'82\'bd\'82\'bf\'82\'cd\'82\'a0\'82\'c8\'82\'bd\'82\'cc\'8c\'a0\'97\'98\'82\'f0\'93\'f1\'92\'69\'8a\'4b\'82\'cc\'8e\'e8\'8f\'87\'82\'f0\'93\'a5\'82\'f1\'82\'c5\'95\'db\'8c\'ec\'82\'b5\'82\'dc\'82\'b7\'81\'42 \f0 (1) \f1 \'82\'dc\'82\'b8\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\ \'83\'41\'82\'c9\'91\'ce\'82\'b5\'82\'c4\'92\'98\'8d\'ec\'8c\'a0\'82\'f0\'8e\'e5\'92\'a3\'82\'b5\'81\'41\'82\'bb\'82\'b5\'82\'c4 \f0 (2) \f1 \'82\'a0\'82\'c8\'82\'bd\'82\'c9\'91\'ce\'82\'b5\'82\'c4\'81\'41\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'82\'cc\'95\'a1\ \'90\'bb\'82\'e2\'94\'d0\'95\'7a\'82\'dc\'82\'bd\'82\'cd\'89\'fc\'95\'cf\'82\'c9\'82\'c2\'82\'a2\'82\'c4\'82\'cc\'96\'40\'93\'49\'82\'c8\'8b\'96\'89\'c2\'82\'f0\'97\'5e\'82\'a6\'82\'e9\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'f0\'92\'f1\'8e\'a6\'82\'b5\'82\'dc\'82\'b7\'81\'42\ \ \'82\'dc\'82\'bd\'81\'41\'8a\'65\'8d\'ec\'8e\'d2\'82\'e2\'8e\'84\'82\'bd\'82\'bf\'82\'f0\'95\'db\'8c\'ec\'82\'b7\'82\'e9\'82\'bd\'82\'df\'81\'41\'8e\'84\'82\'bd\'82\'bf\'82\'cd\'82\'b1\'82\'cc\'83\'74\'83\'8a\'81\'5b\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'82\'c9\'82\'cd\ \'89\'bd\'82\'cc\'95\'db\'8f\'d8\'82\'e0\'96\'b3\'82\'a2\'82\'c6\'82\'a2\'82\'a4\'82\'b1\'82\'c6\'82\'f0\'92\'4e\'82\'e0\'82\'aa\'8a\'6d\'8e\'c0\'82\'c9\'97\'9d\'89\'f0\'82\'b7\'82\'e9\'82\'e6\'82\'a4\'82\'c9\'82\'b5\'81\'41\'82\'dc\'82\'bd\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\ \'83\'41\'82\'aa\'92\'4e\'82\'a9\'91\'bc\'90\'6c\'82\'c9\'82\'e6\'82\'c1\'82\'c4\'89\'fc\'95\'cf\'82\'b3\'82\'ea\'81\'41\'82\'bb\'82\'ea\'82\'aa\'8e\'9f\'81\'58\'82\'c6\'94\'d0\'95\'7a\'82\'b3\'82\'ea\'82\'c4\'82\'a2\'82\'c1\'82\'bd\'82\'c6\'82\'b5\'82\'c4\'82\'e0\'81\'41\'82\'bb\ \'82\'cc\'8e\'f3\'97\'cc\'8e\'d2\'82\'cd\'94\'de\'82\'e7\'82\'aa\'8e\'e8\'82\'c9\'93\'fc\'82\'ea\'82\'bd\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'82\'aa\'83\'49\'83\'8a\'83\'57\'83\'69\'83\'8b\'82\'cc\'83\'6f\'81\'5b\'83\'57\'83\'87\'83\'93\'82\'c5\'82\'cd\'96\'b3\'82\'a2\ \'82\'b1\'82\'c6\'81\'41\'82\'bb\'82\'b5\'82\'c4\'8c\'b4\'8d\'ec\'8e\'d2\'82\'cc\'96\'bc\'90\'ba\'82\'cd\'91\'bc\'90\'6c\'82\'c9\'82\'e6\'82\'c1\'82\'c4\'8e\'9d\'82\'bf\'8d\'9e\'82\'dc\'82\'ea\'82\'bd\'89\'c2\'94\'5c\'90\'ab\'82\'cc\'82\'a0\'82\'e9\'96\'e2\'91\'e8\'82\'c9\'82\'e6\'82\'c1\ \'82\'c4\'89\'65\'8b\'bf\'82\'b3\'82\'ea\'82\'e9\'82\'b1\'82\'c6\'82\'aa\'82\'c8\'82\'a2\'82\'c6\'82\'a2\'82\'a4\'82\'b1\'82\'c6\'82\'f0\'8e\'fc\'92\'6d\'82\'b3\'82\'b9\'82\'bd\'82\'a2\'82\'c6\'8e\'76\'82\'a2\'82\'dc\'82\'b7\'81\'42\ \ \'8d\'c5\'8c\'e3\'82\'c9\'81\'41\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'93\'c1\'8b\'96\'82\'aa\'82\'a2\'82\'a9\'82\'c8\'82\'e9\'83\'74\'83\'8a\'81\'5b\'82\'cc\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'82\'cc\'91\'b6\'8d\'dd\'82\'c9\'82\'e0\'95\'73\'92\'66\'82\'cc\'8b\'ba\ \'88\'d0\'82\'f0\'93\'8a\'82\'b0\'82\'a9\'82\'af\'82\'c4\'82\'a2\'82\'dc\'82\'b7\'82\'aa\'81\'41\'8e\'84\'82\'bd\'82\'bf\'82\'cd\'81\'41\'83\'74\'83\'8a\'81\'5b\'82\'c8\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'82\'cc\'8d\'c4\'94\'d0\'95\'7a\'8e\'d2\'82\'aa\'8c\'c2\'81\'58\'82\'c9\ \'93\'c1\'8b\'96\'83\'89\'83\'43\'83\'5a\'83\'93\'83\'58\'82\'f0\'8e\'e6\'93\'be\'82\'b7\'82\'e9\'82\'b1\'82\'c6\'82\'c9\'82\'e6\'82\'c1\'82\'c4\'81\'41\'8e\'96\'8e\'c0\'8f\'e3\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'82\'f0\'93\'c6\'90\'e8\'93\'49\'82\'c9\'82\'b5\'82\'c4\'82\'b5\ \'82\'dc\'82\'a4\'82\'c6\'82\'a2\'82\'a4\'8a\'eb\'8c\'af\'82\'f0\'94\'f0\'82\'af\'82\'bd\'82\'a2\'82\'c6\'8e\'76\'82\'a2\'82\'dc\'82\'b7\'81\'42\'82\'b1\'82\'a4\'82\'a2\'82\'c1\'82\'bd\'8e\'96\'91\'d4\'82\'f0\'97\'5c\'96\'68\'82\'b7\'82\'e9\'82\'bd\'82\'df\'81\'41\'8e\'84\'82\'bd\ \'82\'bf\'82\'cd\'82\'a2\'82\'a9\'82\'c8\'82\'e9\'93\'c1\'8b\'96\'82\'e0\'92\'4e\'82\'e0\'82\'aa\'8e\'a9\'97\'52\'82\'c9\'97\'98\'97\'70\'82\'c5\'82\'ab\'82\'e9\'82\'e6\'82\'a4\'83\'89\'83\'43\'83\'5a\'83\'93\'83\'58\'82\'b3\'82\'ea\'82\'e9\'82\'a9\'81\'41\'91\'53\'82\'ad\'83\'89\ \'83\'43\'83\'5a\'83\'93\'83\'58\'82\'b3\'82\'ea\'82\'c8\'82\'a2\'82\'a9\'82\'cc\'82\'c7\'82\'bf\'82\'e7\'82\'a9\'82\'c5\'82\'c8\'82\'af\'82\'ea\'82\'ce\'82\'c8\'82\'e7\'82\'c8\'82\'a2\'82\'b1\'82\'c6\'82\'f0\'96\'be\'8a\'6d\'82\'c9\'82\'b5\'82\'dc\'82\'b5\'82\'bd\'81\'42\ \ \f0 ( \f1 \'96\'f3\'92\'8d \f0 : \f1 \'96\'7b\'8c\'5f\'96\'f1\'8f\'91\'82\'c5\'81\'75\'93\'c6\'90\'e8\'93\'49 \f0 (proprietary) \f1 \'81\'76\'82\'c6\'82\'cd\'81\'41\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'82\'cc\'97\'98\'97\'70\'82\'e2\'8d\'c4\'94\'d0\ \'95\'7a\'81\'41\'89\'fc\'95\'cf\'82\'aa\'8b\'d6\'8e\'7e\'82\'b3\'82\'ea\'82\'c4\'82\'a2\'82\'e9\'82\'a9\'81\'41\'8b\'96\'89\'c2\'82\'f0\'93\'be\'82\'e9\'82\'b1\'82\'c6\'82\'aa\'95\'4b\'97\'76\'82\'c6\'82\'b3\'82\'ea\'82\'c4\'82\'a2\'82\'e9\'82\'a9\'81\'41\'82\'a0\'82\'e9\'82\'a2\ \'82\'cd\'8c\'b5\'82\'b5\'82\'a2\'90\'a7\'8c\'c0\'82\'aa\'89\'db\'82\'b9\'82\'e7\'82\'ea\'82\'c4\'82\'a2\'82\'c4\'8e\'a9\'97\'52\'82\'c9\'82\'bb\'82\'a4\'82\'b7\'82\'e9\'82\'b1\'82\'c6\'82\'aa\'8e\'96\'8e\'c0\'8f\'e3\'82\'c5\'82\'ab\'82\'c8\'82\'ad\'82\'c8\'82\'c1\'82\'c4\'82\'a2\ \'82\'e9\'8f\'f3\'91\'d4\'82\'cc\'82\'b1\'82\'c6\'82\'f0\'8e\'77\'82\'b7\'81\'42\'8f\'da\'82\'b5\'82\'ad\'82\'cd\ \f0 http://www.gnu.org/philosophy/categories.ja.html#ProprietarySoftware \f1 \'82\'f0\ \'8e\'51\'8f\'c6\'82\'b9\'82\'e6\'81\'42 \f0 )\ \ \f1 \'95\'a1\'90\'bb\'82\'e2\'94\'d0\'95\'7a\'81\'41\'89\'fc\'95\'cf\'82\'c9\'82\'c2\'82\'a2\'82\'c4\'82\'cc\'90\'b3\'8a\'6d\'82\'c8\'8f\'f0\'8c\'8f\'82\'c6\'90\'a7\'96\'f1\'82\'f0\'88\'c8\'89\'ba\'82\'c5\'8f\'71\'82\'d7\'82\'c4\'82\'a2\'82\'ab\'82\'dc\'82\'b7\'81\'42\ \ \ \page \ \f0 GNU \f1 \'88\'ea\'94\'ca\'8c\'f6\'8f\'4f\'97\'98\'97\'70\'8b\'96\'91\'f8\'8c\'5f\'96\'f1\'8f\'91\ \f0 \f1 \'95\'a1\'90\'bb\'81\'41\'94\'d0\'95\'7a\'81\'41\'89\'fc\'95\'cf\'82\'c9\'8a\'d6\'82\'b7\'82\'e9\'8f\'f0\'8c\'8f\'82\'c6\'90\'a7\'96\'f1\ \ \f0 0. \f1 \'82\'b1\'82\'cc\'97\'98\'97\'70\'8b\'96\'91\'f8\'8c\'5f\'96\'f1\'8f\'91\'82\'cd\'81\'41\'82\'bb\'82\'cc\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80 \f0 ( \f1 \'82\'dc\'82\'bd\'82\'cd\'82\'bb\'82\'cc\'91\'bc\'82\'cc\'92\'98\'8d\'ec\'95\'a8 \f0 ) \f1 \'82\'f0\'82\'b1\'82\'cc\'88\'ea\ \'94\'ca\'8c\'f6\'8f\'4f\'97\'98\'97\'70\'8b\'96\'91\'f8\'8c\'5f\'96\'f1\'8f\'91\'82\'cc\'92\'e8\'82\'df\'82\'e9\'8f\'f0\'8c\'8f\'82\'cc\'89\'ba\'82\'c5\'94\'d0\'95\'7a\'82\'c5\'82\'ab\'82\'e9\'82\'c6\'82\'a2\'82\'a4\'8d\'90\'92\'6d\'82\'aa\'92\'98\'8d\'ec\'8c\'a0\'8e\'d2\'82\'c9\ \'82\'e6\'82\'c1\'82\'c4\'8b\'4c\'8d\'da\'82\'b3\'82\'ea\'82\'bd\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'82\'dc\'82\'bd\'82\'cd\'82\'bb\'82\'cc\'91\'bc\'82\'cc\'92\'98\'8d\'ec\'95\'a8\'91\'53\'94\'ca\'82\'c9\'93\'4b\'97\'70\'82\'b3\'82\'ea\'82\'e9\'81\'42\'88\'c8\'89\'ba\'82\'c5\ \'82\'cd\'81\'41\'81\'75\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'81\'76\'82\'c6\'82\'cd\'82\'bb\'82\'cc\'82\'e6\'82\'a4\'82\'c9\'82\'b5\'82\'c4\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'aa\'93\'4b\'97\'70\'82\'b3\'82\'ea\'82\'bd\'83\'76\'83\'8d\'83\'4f\'83\'89\ \'83\'80\'82\'e2\'92\'98\'8d\'ec\'95\'a8\'91\'53\'94\'ca\'82\'f0\'88\'d3\'96\'a1\'82\'b5\'81\'41\'82\'dc\'82\'bd\'81\'75\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'f0\'8a\'ee\'82\'c9\'82\'b5\'82\'bd\'92\'98\'8d\'ec\'95\'a8\'81\'76\'82\'c6\'82\'cd\'81\'77\'83\'76\ \'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'e2\'82\'bb\'82\'cc\'91\'bc\'92\'98\'8d\'ec\'8c\'a0\'96\'40\'82\'cc\'89\'ba\'82\'c5\'94\'68\'90\'b6\'95\'a8\'82\'c6\'8c\'a9\'82\'c8\'82\'b3\'82\'ea\'82\'e9\'82\'e0\'82\'cc\'91\'53\'94\'ca\'82\'f0\'8e\'77\'82\'b7\'81\'42\'82\'b7\'82\'c8\ \'82\'ed\'82\'bf\'81\'41\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'a9\'82\'bb\'82\'cc\'88\'ea\'95\'94\'82\'f0\'81\'41\'91\'53\'82\'ad\'93\'af\'88\'ea\'82\'cc\'82\'dc\'82\'dc\'82\'a9\'81\'41\'89\'fc\'95\'cf\'82\'f0\'89\'c1\'82\'a6\'82\'bd\'82\'a9\'81\'41\'82\'a0\ \'82\'e9\'82\'a2\'82\'cd\'91\'bc\'82\'cc\'8c\'be\'8c\'ea\'82\'c9\'96\'7c\'96\'f3\'82\'b3\'82\'ea\'82\'bd\'8c\'60\'82\'c5\'8a\'dc\'82\'de\'92\'98\'8d\'ec\'95\'a8\'82\'cc\'82\'b1\'82\'c6\'82\'c5\'82\'a0\'82\'e9 \f0 ( \f1 \'81\'75\'89\'fc\'95\'cf\'81\'76\'82\'c6\'82\'a2\'82\'a4\'8c\'ea\ \'82\'cc\'96\'7b\'97\'88\'82\'cc\'88\'d3\'96\'a1\'82\'a9\'82\'e7\'82\'cd\'82\'b8\'82\'ea\'82\'e9\'82\'aa\'81\'41\'88\'c8\'89\'ba\'82\'c5\'82\'cd\'96\'7c\'96\'f3\'82\'e0\'89\'fc\'95\'cf\'82\'cc\'88\'ea\'8e\'ed\'82\'c6\'8c\'a9\'82\'c8\'82\'b7 \f0 ) \f1 \'81\'42\'82\'bb\'82\'ea\'82\'bc\ \'82\'ea\'82\'cc\'8c\'5f\'96\'f1\'8e\'d2\'82\'cd\'81\'75\'82\'a0\'82\'c8\'82\'bd\'81\'76\'82\'c6\'95\'5c\'8c\'bb\'82\'b3\'82\'ea\'82\'e9\'81\'42\ \ \'95\'a1\'90\'bb\'82\'e2\'94\'d0\'95\'7a\'81\'41\'89\'fc\'95\'cf\'88\'c8\'8a\'4f\'82\'cc\'8a\'88\'93\'ae\'82\'cd\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'c5\'82\'cd\'83\'4a\'83\'6f\'81\'5b\'82\'b3\'82\'ea\'82\'c8\'82\'a2\'81\'42\'82\'bb\'82\'ea\'82\'e7\'82\'cd\'82\'b1\'82\'cc\ \'8c\'5f\'96\'f1\'8f\'91\'82\'cc\'91\'ce\'8f\'db\'8a\'4f\'82\'c5\'82\'a0\'82\'e9\'81\'42\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'f0\'8e\'c0\'8d\'73\'82\'b7\'82\'e9\'8d\'73\'88\'d7\'8e\'a9\'91\'cc\'82\'c9\'90\'a7\'8c\'c0\'82\'cd\'82\'c8\'82\'a2\'81\'42\'82\'dc\ \'82\'bd\'81\'41\'82\'bb\'82\'cc\'82\'e6\'82\'a4\'82\'c8\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'cc\'8f\'6f\'97\'cd\'8c\'8b\'89\'ca\'82\'cd\'81\'41\'82\'bb\'82\'cc\'93\'e0\'97\'65\'82\'aa\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'f0\'8a\'ee\ \'82\'c9\'82\'b5\'82\'bd\'92\'98\'8d\'ec\'95\'a8\'82\'f0\'8d\'5c\'90\'ac\'82\'b7\'82\'e9\'8f\'ea\'8d\'87\'82\'cc\'82\'dd\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'c9\'82\'e6\'82\'c1\'82\'c4\'95\'db\'8c\'ec\'82\'b3\'82\'ea\'82\'e9 \f0 ( \f1 \'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\ \'83\'80\'81\'78\'82\'f0\'8e\'c0\'8d\'73\'82\'b5\'82\'bd\'82\'b1\'82\'c6\'82\'c9\'82\'e6\'82\'c1\'82\'c4\'8d\'ec\'90\'ac\'82\'b3\'82\'ea\'82\'bd\'82\'c6\'82\'a2\'82\'a4\'82\'b1\'82\'c6\'82\'c6\'82\'cd\'96\'b3\'8a\'d6\'8c\'57\'82\'c5\'82\'a0\'82\'e9 \f0 ) \f1 \'81\'42\'82\'b1\'82\'cc\ \'82\'e6\'82\'a4\'82\'c8\'90\'fc\'88\'f8\'82\'ab\'82\'cc\'91\'c3\'93\'96\'90\'ab\'82\'cd\'81\'41\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'aa\'89\'bd\'82\'f0\'82\'b7\'82\'e9\'82\'cc\'82\'a9\'82\'c9\'88\'cb\'91\'b6\'82\'b7\'82\'e9\'81\'42\ \ \f0 1. \f1 \'82\'bb\'82\'ea\'82\'bc\'82\'ea\'82\'cc\'95\'a1\'90\'bb\'95\'a8\'82\'c9\'82\'a8\'82\'a2\'82\'c4\'93\'4b\'90\'d8\'82\'c8\'92\'98\'8d\'ec\'8c\'a0\'95\'5c\'8e\'a6\'82\'c6\'95\'db\'8f\'d8\'82\'cc\'94\'db\'94\'46\'90\'ba\'96\'be \f0 (disclaimer\ of warranty) \f1 \'82\'f0\'96\'da\'97\'a7\'82\'c2\'82\'e6\'82\'a4\'93\'4b\'90\'d8\'82\'c9\'8c\'66\'8d\'da\'82\'b5\'81\'41\'82\'dc\'82\'bd\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'a8\'82\'e6\'82\'d1\'88\'ea\'90\'d8\'82\'cc\'95\'db\'8f\'d8\'82\'cc\ \'95\'73\'8d\'dd\'82\'c9\'90\'47\'82\'ea\'82\'bd\'8d\'90\'92\'6d\'82\'b7\'82\'d7\'82\'c4\'82\'f0\'82\'bb\'82\'cc\'82\'dc\'82\'dc\'8e\'63\'82\'b5\'81\'41\'82\'bb\'82\'b5\'82\'c4\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'cc\'95\'a1\'90\'bb\'95\'a8\'82\'f0\'81\'77\'83\'76\'83\'8d\ \'83\'4f\'83\'89\'83\'80\'81\'78\'82\'cc\'82\'a2\'82\'a9\'82\'c8\'82\'e9\'8e\'f3\'97\'cc\'8e\'d2\'82\'c9\'82\'e0\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'c6\'8b\'a4\'82\'c9\'94\'d0\'95\'7a\'82\'b7\'82\'e9\'8c\'c0\'82\'e8\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'cd\ \'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'cc\'83\'5c\'81\'5b\'83\'58\'83\'52\'81\'5b\'83\'68\'82\'cc\'95\'a1\'90\'bb\'95\'a8\'82\'f0\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'aa\'8e\'f3\'82\'af\'8e\'e6\'82\'c1\'82\'bd\'92\'ca\'82\'e8\'82\'cc\'8c\'60\'82\'c5\'95\'a1\ \'90\'bb\'82\'dc\'82\'bd\'82\'cd\'94\'d0\'95\'7a\'82\'b7\'82\'e9\'82\'b1\'82\'c6\'82\'aa\'82\'c5\'82\'ab\'82\'e9\'81\'42\'94\'7d\'91\'cc\'82\'cd\'96\'e2\'82\'ed\'82\'c8\'82\'a2\'81\'42\ \ \'82\'a0\'82\'c8\'82\'bd\'82\'cd\'81\'41\'95\'a8\'97\'9d\'93\'49\'82\'c9\'95\'a1\'90\'bb\'95\'a8\'82\'f0\'8f\'f7\'93\'6e\'82\'b7\'82\'e9\'82\'c6\'82\'a2\'82\'a4\'8d\'73\'88\'d7\'82\'c9\'8a\'d6\'82\'b5\'82\'c4\'8e\'e8\'90\'94\'97\'bf\'82\'f0\'89\'db\'82\'b5\'82\'c4\'82\'e0\'97\'c7\ \'82\'a2\'82\'b5\'81\'41\'8a\'f3\'96\'5d\'82\'c9\'82\'e6\'82\'c1\'82\'c4\'82\'cd\'8e\'e8\'90\'94\'97\'bf\'82\'f0\'8e\'e6\'82\'c1\'82\'c4\'8c\'f0\'8a\'b7\'82\'c9\'82\'a8\'82\'af\'82\'e9\'95\'db\'8c\'ec\'82\'cc\'95\'db\'8f\'d8\'82\'f0\'92\'f1\'8b\'9f\'82\'b5\'82\'c4\'82\'e0\'97\'c7\ \'82\'a2\'81\'42\ \ \f0 2. \f1 \'82\'a0\'82\'c8\'82\'bd\'82\'cd\'8e\'a9\'95\'aa\'82\'cc\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'cc\'95\'a1\'90\'bb\'95\'a8\'82\'a9\'82\'bb\'82\'cc\'88\'ea\'95\'94\'82\'f0\'89\'fc\'95\'cf\'82\'b5\'82\'c4\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\ \'83\'80\'81\'78\'82\'f0\'8a\'ee\'82\'c9\'82\'b5\'82\'bd\'92\'98\'8d\'ec\'95\'a8\'82\'f0\'8c\'60\'90\'ac\'82\'b5\'81\'41\'82\'bb\'82\'cc\'82\'e6\'82\'a4\'82\'c8\'89\'fc\'95\'cf\'93\'5f\'82\'e2\'92\'98\'8d\'ec\'95\'a8\'82\'f0\'8f\'e3\'8b\'4c\'91\'e6 \f0 1 \f1 \'90\'df\'82\'cc\'92\'e8\ \'82\'df\'82\'e9\'8f\'f0\'8c\'8f\'82\'cc\'89\'ba\'82\'c5\'95\'a1\'90\'bb\'82\'dc\'82\'bd\'82\'cd\'94\'d0\'95\'7a\'82\'b7\'82\'e9\'82\'b1\'82\'c6\'82\'aa\'82\'c5\'82\'ab\'82\'e9\'81\'42\'82\'bd\'82\'be\'82\'b5\'81\'41\'82\'bb\'82\'cc\'82\'bd\'82\'df\'82\'c9\'82\'cd\'88\'c8\'89\'ba\ \'82\'cc\'8f\'f0\'8c\'8f\'82\'b7\'82\'d7\'82\'c4\'82\'f0\'96\'9e\'82\'bd\'82\'b5\'82\'c4\'82\'a2\'82\'c8\'82\'af\'82\'ea\'82\'ce\'82\'c8\'82\'e7\'82\'c8\'82\'a2 \f0 :\ \ a) \f1 \'82\'a0\'82\'c8\'82\'bd\'82\'aa\'82\'bb\'82\'ea\'82\'e7\'82\'cc\'83\'74\'83\'40\'83\'43\'83\'8b\'82\'f0\'95\'cf\'8d\'58\'82\'b5\'82\'bd\'82\'c6\'82\'a2\'82\'a4\'82\'b1\'82\'c6\'82\'c6\'95\'cf\'8d\'58\'82\'b5\'82\'bd\'93\'fa\'8e\'9e\'82\'aa\'97\'c7\ \f0 \f1 \'82\'ad\'95\'aa\'82\'a9\'82\'e9\'82\'e6\'82\'a4\'81\'41\'89\'fc\'95\'cf\'82\'b3\'82\'ea\'82\'bd\'83\'74\'83\'40\'83\'43\'83\'8b\'82\'c9\'8d\'90\'8e\'a6\'82\'b5\'82\'c8\'82\'af\'82\'ea\'82\'ce\'82\'c8\'82\'e7\'82\'c8\'82\'a2\'81\'42\ \ \f0 b) \f1 \'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'dc\'82\'bd\'82\'cd\'82\'bb\'82\'cc\'88\'ea\'95\'94\'82\'f0\'8a\'dc\'82\'de\'92\'98\'8d\'ec\'95\'a8\'81\'41\'82\'a0\'82\'e9\'82\'a2\'82\'cd\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\ \f0 \f1 \'82\'a9\'82\'bb\'82\'cc\'88\'ea\'95\'94\'82\'a9\'82\'e7\'94\'68\'90\'b6\'82\'b5\'82\'bd\'92\'98\'8d\'ec\'95\'a8\'82\'f0\'94\'d0\'95\'7a\'82\'a0\'82\'e9\'82\'a2\'82\'cd\'94\'ad\'95\'5c\'82\'b7\'82\'e9\'8f\'ea\'8d\'87\'82\'c9\'82\'cd\'81\'41\'82\'bb\'82\'cc\'91\'53\ \f0 \f1 \'91\'cc\'82\'f0\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'cc\'8f\'f0\'8c\'8f\'82\'c9\'8f\'5d\'82\'c1\'82\'c4\'91\'e6\'8e\'4f\'8e\'d2\'82\'d6\'96\'b3\'8f\'9e\'82\'c5\'97\'98\'97\'70\'8b\'96\'91\'f8\'82\'b5\'82\'c8\'82\'af\'82\'ea\'82\'ce\'82\'c8\'82\'e7\'82\'c8\ \f0 \f1 \'82\'a2\'81\'42\ \ \f0 c) \f1 \'89\'fc\'95\'cf\'82\'b3\'82\'ea\'82\'bd\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'82\'aa\'81\'41\'92\'ca\'8f\'ed\'8e\'c0\'8d\'73\'82\'b7\'82\'e9\'8d\'db\'82\'c9\'91\'ce\'98\'62\'93\'49\'82\'c9\'83\'52\'83\'7d\'83\'93\'83\'68\'82\'f0\'93\'c7\'82\'de\ \f0 \f1 \'82\'e6\'82\'a4\'82\'c9\'82\'c8\'82\'c1\'82\'c4\'82\'a2\'82\'e9\'82\'c8\'82\'e7\'82\'ce\'81\'41\'82\'bb\'82\'cc\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'82\'f0\'8d\'c5\'82\'e0\'88\'ea\'94\'ca\'93\'49\'82\'c8\'95\'fb\'96\'40\'82\'c5\'91\'ce\'98\'62\'93\'49\'82\'c9\ \f0 \f1 \'8e\'c0\'8d\'73\'82\'b7\'82\'e9\'8d\'db\'81\'41\'93\'4b\'90\'d8\'82\'c8\'92\'98\'8d\'ec\'8c\'a0\'95\'5c\'8e\'a6\'81\'41\'96\'b3\'95\'db\'8f\'d8\'82\'c5\'82\'a0\'82\'e9\'82\'b1\'82\'c6 \f0 ( \f1 \'82\'a0\'82\'e9\'82\'a2\'82\'cd\'82\'a0\'82\'c8\'82\'bd\'82\'aa\'95\'db\ \f0 \f1 \'8f\'d8\'82\'f0\'92\'f1\'8b\'9f\'82\'b7\'82\'e9\'82\'c6\'82\'a2\'82\'a4\'82\'b1\'82\'c6 \f0 ) \f1 \'81\'41\'83\'86\'81\'5b\'83\'55\'82\'aa\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'82\'f0\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'c5\'8f\'71\'82\'d7\'82\'bd\'8f\'f0\ \f0 \f1 \'8c\'8f\'82\'cc\'89\'ba\'82\'c5\'94\'d0\'95\'7a\'82\'b7\'82\'e9\'82\'b1\'82\'c6\'82\'aa\'82\'c5\'82\'ab\'82\'e9\'82\'c6\'82\'a2\'82\'a4\'82\'b1\'82\'c6\'81\'41\'82\'bb\'82\'b5\'82\'c4\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'cc\'95\'a1\'90\'bb\'95\'a8\'82\'f0\ \f0 \f1 \'89\'7b\'97\'97\'82\'b7\'82\'e9\'82\'c9\'82\'cd\'82\'c7\'82\'a4\'82\'b5\'82\'bd\'82\'e7\'82\'e6\'82\'a2\'82\'a9\'82\'c6\'82\'a2\'82\'a4\'83\'86\'81\'5b\'83\'55\'82\'d6\'82\'cc\'90\'e0\'96\'be\'82\'f0\'8a\'dc\'82\'de\'8d\'90\'92\'6d\'82\'aa\'88\'f3\'8d\'fc\'82\'b3\ \f0 \f1 \'82\'ea\'82\'e9\'82\'a9\'81\'41\'82\'a0\'82\'e9\'82\'a2\'82\'cd\'89\'e6\'96\'ca\'82\'c9\'95\'5c\'8e\'a6\'82\'b3\'82\'ea\'82\'e9\'82\'e6\'82\'a4\'82\'c9\'82\'b5\'82\'c8\'82\'af\'82\'ea\'82\'ce\'82\'c8\'82\'e7\'82\'c8\'82\'a2 \f0 ( \f1 \'97\'e1\'8a\'4f\'82\'c6\'82\'b5\ \f0 \f1 \'82\'c4\'81\'41\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'bb\'82\'cc\'82\'e0\'82\'cc\'82\'cd\'91\'ce\'98\'62\'93\'49\'82\'c5\'82\'a0\'82\'c1\'82\'c4\'82\'e0\'92\'ca\'8f\'ed\'82\'bb\'82\'cc\'82\'e6\'82\'a4\'82\'c8\'8d\'90\'92\'6d\'82\'f0\'88\'f3\ \f0 \f1 \'8d\'fc\'82\'b5\'82\'c8\'82\'a2\'8f\'ea\'8d\'87\'82\'c9\'82\'cd\'81\'41\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'f0\'8a\'ee\'82\'c9\'82\'b5\'82\'bd\'82\'a0\'82\'c8\'82\'bd\'82\'cc\'92\'98\'8d\'ec\'95\'a8\'82\'c9\'82\'bb\'82\'cc\'82\'e6\'82\'a4\ \f0 \f1 \'82\'c8\'8d\'90\'92\'6d\'82\'f0\'88\'f3\'8d\'fc\'82\'b3\'82\'b9\'82\'e9\'95\'4b\'97\'76\'82\'cd\'82\'c8\'82\'a2 \f0 ) \f1 \'81\'42\ \ \ \page \ \'88\'c8\'8f\'e3\'82\'cc\'95\'4b\'97\'76\'8f\'f0\'8c\'8f\'82\'cd\'91\'53\'91\'cc\'82\'c6\'82\'b5\'82\'c4\'82\'cc\'89\'fc\'95\'cf\'82\'b3\'82\'ea\'82\'bd\'92\'98\'8d\'ec\'95\'a8\'82\'c9\'93\'4b\'97\'70\'82\'b3\'82\'ea\'82\'e9\'81\'42\'92\'98\'8d\'ec\'95\'a8\'82\'cc\'88\'ea\'95\'94\ \'82\'aa\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'a9\'82\'e7\'94\'68\'90\'b6\'82\'b5\'82\'bd\'82\'e0\'82\'cc\'82\'c5\'82\'cd\'82\'c8\'82\'a2\'82\'c6\'8a\'6d\'94\'46\'82\'c5\'82\'ab\'81\'41\'82\'bb\'82\'ea\'82\'e7\'8e\'a9\'90\'67\'95\'ca\'82\'cc\'93\'c6\'97\'a7\ \'82\'b5\'82\'bd\'92\'98\'8d\'ec\'95\'a8\'82\'c5\'82\'a0\'82\'e9\'82\'c6\'8d\'87\'97\'9d\'93\'49\'82\'c9\'8d\'6c\'82\'a6\'82\'e7\'82\'ea\'82\'e9\'82\'c8\'82\'e7\'82\'ce\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'aa\'82\'bb\'82\'ea\'82\'e7\'82\'f0\'95\'ca\'82\'cc\'92\'98\'8d\'ec\'95\'a8\ \'82\'c6\'82\'b5\'82\'c4\'95\'aa\'82\'af\'82\'c4\'94\'d0\'95\'7a\'82\'b7\'82\'e9\'8f\'ea\'8d\'87\'81\'41\'82\'bb\'82\'a4\'82\'a2\'82\'c1\'82\'bd\'95\'94\'95\'aa\'82\'c9\'82\'cd\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'c6\'82\'bb\'82\'cc\'8f\'f0\'8c\'8f\'82\'cd\ \'93\'4b\'97\'70\'82\'b3\'82\'ea\'82\'c8\'82\'a2\'81\'42\'82\'b5\'82\'a9\'82\'b5\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'aa\'93\'af\'82\'b6\'95\'94\'95\'aa\'82\'f0\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'f0\'8a\'ee\'82\'c9\'82\'b5\'82\'bd\'92\'98\'8d\'ec\'95\'a8\ \'91\'53\'91\'cc\'82\'cc\'88\'ea\'95\'94\'82\'c6\'82\'b5\'82\'c4\'94\'d0\'95\'7a\'82\'b7\'82\'e9\'82\'c8\'82\'e7\'82\'ce\'81\'41\'91\'53\'91\'cc\'82\'c6\'82\'b5\'82\'c4\'82\'cc\'94\'d0\'95\'7a\'95\'a8\'82\'cd\'81\'41\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'aa\ \'89\'db\'82\'b7\'8f\'f0\'8c\'8f\'82\'c9\'8f\'5d\'82\'ed\'82\'c8\'82\'af\'82\'ea\'82\'ce\'82\'c8\'82\'e7\'82\'c8\'82\'a2\'81\'42\'82\'c6\'82\'a2\'82\'a4\'82\'cc\'82\'cd\'81\'41\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'aa\'91\'bc\'82\'cc\'8c\'5f\'96\'f1\'8e\'d2\ \'82\'c9\'97\'5e\'82\'a6\'82\'e9\'8b\'96\'89\'c2\'82\'cd\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'8a\'db\'82\'b2\'82\'c6\'91\'53\'91\'cc\'82\'c9\'8b\'79\'82\'d1\'81\'41\'92\'4e\'82\'aa\'8f\'91\'82\'a2\'82\'bd\'82\'a9\'82\'cd\'8a\'d6\'8c\'57\'82\'c8\'82\'ad\'8a\'65\ \'95\'94\'95\'aa\'82\'cc\'82\'b7\'82\'d7\'82\'c4\'82\'f0\'95\'db\'8c\'ec\'82\'b7\'82\'e9\'82\'a9\'82\'e7\'82\'c5\'82\'a0\'82\'e9\'81\'42\ \ \'82\'e6\'82\'c1\'82\'c4\'81\'41\'82\'b7\'82\'d7\'82\'c4\'82\'a0\'82\'c8\'82\'bd\'82\'c9\'82\'e6\'82\'c1\'82\'c4\'8f\'91\'82\'a9\'82\'ea\'82\'bd\'92\'98\'8d\'ec\'95\'a8\'82\'c9\'91\'ce\'82\'b5\'81\'41\'8c\'a0\'97\'98\'82\'f0\'8e\'e5\'92\'a3\'82\'b5\'82\'bd\'82\'e8\'82\'a0\'82\'c8\ \'82\'bd\'82\'cc\'8c\'a0\'97\'98\'82\'c9\'88\'d9\'8b\'63\'82\'f0\'90\'5c\'82\'b5\'97\'a7\'82\'c4\'82\'e9\'82\'b1\'82\'c6\'82\'cd\'82\'b1\'82\'cc\'90\'df\'82\'cc\'88\'d3\'90\'7d\'82\'b7\'82\'e9\'82\'c6\'82\'b1\'82\'eb\'82\'c5\'82\'cd\'82\'c8\'82\'a2\'81\'42\'82\'de\'82\'b5\'82\'eb\'81\'41\ \'82\'bb\'82\'cc\'8e\'ef\'8e\'7c\'82\'cd\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'f0\'8a\'ee\'82\'c9\'82\'b5\'82\'bd\'94\'68\'90\'b6\'95\'a8\'82\'c8\'82\'a2\'82\'b5\'8f\'57\'8d\'87\'92\'98\'8d\'ec\'95\'a8\'82\'cc\'94\'d0\'95\'7a\'82\'f0\'8a\'c7\'97\'9d\'82\'b7\ \'82\'e9\'8c\'a0\'97\'98\'82\'f0\'8d\'73\'8e\'67\'82\'b7\'82\'e9\'82\'c6\'82\'a2\'82\'a4\'82\'b1\'82\'c6\'82\'c9\'82\'a0\'82\'e9\'81\'42\ \ \'82\'dc\'82\'bd\'81\'41\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'f0\'8a\'ee\'82\'c9\'82\'b5\'82\'c4\'82\'a2\'82\'c8\'82\'a2\'82\'bb\'82\'cc\'91\'bc\'82\'cc\'92\'98\'8d\'ec\'95\'a8\'82\'f0\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78 \f0 ( \f1 \'82\'a0\ \'82\'e9\'82\'a2\'82\'cd\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'f0\'8a\'ee\'82\'c9\'82\'b5\'82\'bd\'92\'98\'8d\'ec\'95\'a8 \f0 ) \f1 \'82\'c6\'88\'ea\'8f\'8f\'82\'c9\'8f\'57\'82\'df\'82\'bd\'82\'be\'82\'af\'82\'cc\'82\'e0\'82\'cc\'82\'f0\'88\'ea\'8a\'aa\'82\'cc\ \'95\'db\'8a\'c7\'91\'95\'92\'75\'82\'c8\'82\'a2\'82\'b5\'94\'d0\'95\'7a\'94\'7d\'91\'cc\'82\'c9\'8e\'fb\'82\'df\'82\'c4\'82\'e0\'81\'41\'82\'bb\'82\'cc\'91\'bc\'82\'cc\'92\'98\'8d\'ec\'95\'a8\'82\'dc\'82\'c5\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'aa\'95\'db\ \'8c\'ec\'82\'b7\'82\'e9\'91\'ce\'8f\'db\'82\'c9\'82\'c8\'82\'e9\'82\'c6\'82\'a2\'82\'a4\'82\'b1\'82\'c6\'82\'c9\'82\'cd\'82\'c8\'82\'e7\'82\'c8\'82\'a2\'81\'42\ \ \f0 3. \f1 \'82\'a0\'82\'c8\'82\'bd\'82\'cd\'8f\'e3\'8b\'4c\'91\'e6 \f0 1 \f1 \'90\'df\'82\'a8\'82\'e6\'82\'d1 \f0 2 \f1 \'90\'df\'82\'cc\'8f\'f0\'8c\'8f\'82\'c9\'8f\'5d\'82\'a2\'81\'41\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78 \f0 ( \f1 \'82\'a0\'82\'e9\'82\'a2\'82\'cd\'91\'e6 \f0 2\ \f1 \'90\'df\'82\'c9\'82\'a8\'82\'af\'82\'e9\'94\'68\'90\'b6\'95\'a8 \f0 ) \f1 \'82\'f0\'83\'49\'83\'75\'83\'57\'83\'46\'83\'4e\'83\'67\'83\'52\'81\'5b\'83\'68\'82\'c8\'82\'a2\'82\'b5\'8e\'c0\'8d\'73\'8c\'60\'8e\'ae\'82\'c5\'95\'a1\'90\'bb\'82\'dc\'82\'bd\'82\'cd\'94\'d0\'95\'7a\'82\'b7\ \'82\'e9\'82\'b1\'82\'c6\'82\'aa\'82\'c5\'82\'ab\'82\'e9\'81\'42\'82\'bd\'82\'be\'82\'b5\'81\'41\'82\'bb\'82\'cc\'8f\'ea\'8d\'87\'82\'a0\'82\'c8\'82\'bd\'82\'cd\'88\'c8\'89\'ba\'82\'cc\'82\'a4\'82\'bf\'82\'c7\'82\'ea\'82\'a9\'88\'ea\'82\'c2\'82\'f0\'8e\'c0\'8e\'7b\'82\'b5\'82\'c8\ \'82\'af\'82\'ea\'82\'ce\'82\'c8\'82\'e7\'82\'c8\'82\'a2 \f0 :\ \ a) \f1 \'92\'98\'8d\'ec\'95\'a8\'82\'c9\'81\'41\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'c9\'91\'ce\'89\'9e\'82\'b5\'82\'bd\'8a\'ae\'91\'53\'82\'a9\'82\'c2\'8b\'40\'8a\'42\'82\'c5\'93\'c7\'82\'dd\'8e\'e6\'82\'e8\'89\'c2\'94\'5c\'82\'c8\ \f0 \f1 \'83\'5c\'81\'5b\'83\'58\'83\'52\'81\'5b\'83\'68\'82\'f0\'93\'59\'95\'74\'82\'b7\'82\'e9\'81\'42\'82\'bd\'82\'be\'82\'b5\'81\'41\'83\'5c\'81\'5b\'83\'58\'83\'52\'81\'5b\'83\'68\'82\'cd\'8f\'e3\'8b\'4c\'91\'e6 \f0 1 \f1 \'90\'df\'82\'a8\'82\'e6\'82\'d1 \f0 2 \f1 \'90\'df\'82\'cc\ \f0 \f1 \'8f\'f0\'8c\'8f\'82\'c9\'8f\'5d\'82\'a2\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'82\'cc\'8c\'f0\'8a\'b7\'82\'c5\'8f\'4b\'8a\'b5\'93\'49\'82\'c9\'8e\'67\'82\'ed\'82\'ea\'82\'e9\'94\'7d\'91\'cc\'82\'c5\'94\'d0\'95\'7a\'82\'b5\'82\'c8\'82\'af\'82\'ea\'82\'ce\ \f0 \f1 \'82\'c8\'82\'e7\'82\'c8\'82\'a2\'81\'42\'82\'a0\'82\'e9\'82\'a2\'82\'cd\'81\'41\ \ \f0 b) \f1 \'92\'98\'8d\'ec\'95\'a8\'82\'c9\'81\'41\'82\'a2\'82\'a9\'82\'c8\'82\'e9\'91\'e6\'8e\'4f\'8e\'d2\'82\'c9\'91\'ce\'82\'b5\'82\'c4\'82\'e0\'81\'41\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'c9\'91\'ce\'89\'9e\'82\'b5\'82\'bd\'8a\'ae\ \f0 \f1 \'91\'53\'82\'a9\'82\'c2\'8b\'40\'8a\'42\'82\'c5\'93\'c7\'82\'dd\'8e\'e6\'82\'e8\'89\'c2\'94\'5c\'82\'c8\'83\'5c\'81\'5b\'83\'58\'83\'52\'81\'5b\'83\'68\'82\'f0\'81\'41\'94\'d0\'95\'7a\'82\'c9\'97\'76\'82\'b7\'82\'e9\'95\'a8\'97\'9d\'93\'49\'83\'52\'83\'58\'83\'67\ \f0 \f1 \'82\'f0\'8f\'e3\'89\'f1\'82\'e7\'82\'c8\'82\'a2\'92\'f6\'93\'78\'82\'cc\'8e\'e8\'90\'94\'97\'bf\'82\'c6\'88\'f8\'82\'ab\'8a\'b7\'82\'a6\'82\'c9\'92\'f1\'8b\'9f\'82\'b7\'82\'e9\'8e\'7c\'8f\'71\'82\'d7\'82\'bd\'8f\'ad\'82\'c8\'82\'ad\'82\'c6\'82\'e0 \f0 3 \f1 \'94\'4e\ \f0 \f1 \'8a\'d4\'82\'cd\'97\'4c\'8c\'f8\'82\'c8\'8f\'91\'96\'ca\'82\'c9\'82\'c8\'82\'c1\'82\'bd\'90\'5c\'82\'b5\'8f\'6f\'82\'f0\'93\'59\'82\'a6\'82\'e9\'81\'42\'82\'bd\'82\'be\'82\'b5\'81\'41\'83\'5c\'81\'5b\'83\'58\'83\'52\'81\'5b\'83\'68\'82\'cd\'8f\'e3\'8b\'4c\'91\'e6\ \f0 1 \f1 \'90\'df\'82\'a8\'82\'e6\'82\'d1 \f0 2 \f1 \'90\'df\'82\'cc\'8f\'f0\'8c\'8f\'82\'c9\'8f\'5d\'82\'a2\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'82\'cc\'8c\'f0\'8a\'b7\'82\'c5\'8f\'4b\'8a\'b5\'93\'49\'82\'c9\'8e\'67\'82\'ed\'82\'ea\'82\'e9\'94\'7d\'91\'cc\'82\'c5\ \f0 \f1 \'94\'d0\'95\'7a\'82\'b5\'82\'c8\'82\'af\'82\'ea\'82\'ce\'82\'c8\'82\'e7\'82\'c8\'82\'a2\'81\'42\'82\'a0\'82\'e9\'82\'a2\'82\'cd\'81\'41\ \ \f0 c) \f1 \'91\'ce\'89\'9e\'82\'b7\'82\'e9\'83\'5c\'81\'5b\'83\'58\'83\'52\'81\'5b\'83\'68\'94\'d0\'95\'7a\'82\'cc\'90\'5c\'82\'b5\'8f\'6f\'82\'c9\'8d\'db\'82\'b5\'82\'c4\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'aa\'93\'be\'82\'bd\'8f\'ee\'95\'f1\'82\'f0\'88\'ea\ \f0 \f1 \'8f\'8f\'82\'c9\'88\'f8\'82\'ab\'93\'6e\'82\'b7 \f0 ( \f1 \'82\'b1\'82\'cc\'91\'49\'91\'f0\'8e\'88\'82\'cd\'81\'41\'89\'63\'97\'98\'82\'f0\'96\'da\'93\'49\'82\'c6\'82\'b5\'82\'c8\'82\'a2\'94\'d0\'95\'7a\'82\'c5\'82\'a0\'82\'c1\'82\'c4\'81\'41\'82\'a9\'82\'c2\'82\'a0\ \f0 \f1 \'82\'c8\'82\'bd\'82\'aa\'8f\'e3\'8b\'4c\'8f\'ac\'90\'df \f0 b \f1 \'82\'c5\'8e\'77\'92\'e8\'82\'b3\'82\'ea\'82\'c4\'82\'a2\'82\'e9\'82\'e6\'82\'a4\'82\'c8\'90\'5c\'82\'b5\'8f\'6f\'82\'c6\'8b\'a4\'82\'c9\'83\'49\'83\'75\'83\'57\'83\'46\'83\'4e\'83\'67\'83\'52\'81\'5b\ \f0 \f1 \'83\'68\'82\'a0\'82\'e9\'82\'a2\'82\'cd\'8e\'c0\'8d\'73\'8c\'60\'8e\'ae\'82\'cc\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'82\'b5\'82\'a9\'93\'fc\'8e\'e8\'82\'b5\'82\'c4\'82\'a2\'82\'c8\'82\'a2\'8f\'ea\'8d\'87\'82\'c9\'8c\'c0\'82\'e8\'8b\'96\'89\'c2\'82\'b3\'82\'ea\ \f0 \f1 \'82\'e9 \f0 ) \f1 \'81\'42\ \ \'92\'98\'8d\'ec\'95\'a8\'82\'cc\'83\'5c\'81\'5b\'83\'58\'83\'52\'81\'5b\'83\'68\'82\'c6\'82\'cd\'81\'41\'82\'bb\'82\'ea\'82\'c9\'91\'ce\'82\'b5\'82\'c4\'89\'fc\'95\'cf\'82\'f0\'89\'c1\'82\'a6\'82\'e9\'8f\'e3\'82\'c5\'8d\'44\'82\'dc\'82\'b5\'82\'a2\'82\'c6\'82\'b3\'82\'ea\'82\'e9\ \'92\'98\'8d\'ec\'95\'a8\'82\'cc\'8c\'60\'8e\'ae\'82\'f0\'88\'d3\'96\'a1\'82\'b7\'82\'e9\'81\'42\'82\'a0\'82\'e9\'8e\'c0\'8d\'73\'8c\'60\'8e\'ae\'82\'cc\'92\'98\'8d\'ec\'95\'a8\'82\'c9\'82\'c6\'82\'c1\'82\'c4\'8a\'ae\'91\'53\'82\'c8\'83\'5c\'81\'5b\'83\'58\'83\'52\'81\'5b\'83\'68\ \'82\'c6\'82\'cd\'81\'41\'82\'bb\'82\'ea\'82\'aa\'8a\'dc\'82\'de\'83\'82\'83\'57\'83\'85\'81\'5b\'83\'8b\'82\'b7\'82\'d7\'82\'c4\'82\'cc\'83\'5c\'81\'5b\'83\'58\'83\'52\'81\'5b\'83\'68\'91\'53\'95\'94\'82\'c9\'89\'c1\'82\'a6\'81\'41\'8a\'d6\'98\'41\'82\'b7\'82\'e9\'83\'43\'83\'93\ \'83\'5e\'81\'5b\'83\'74\'83\'46\'81\'5b\'83\'58\'92\'e8\'8b\'60\'83\'74\'83\'40\'83\'43\'83\'8b\'82\'cc\'82\'b7\'82\'d7\'82\'c4\'82\'c6\'83\'89\'83\'43\'83\'75\'83\'89\'83\'8a\'82\'cc\'83\'52\'83\'93\'83\'70\'83\'43\'83\'8b\'82\'e2\'83\'43\'83\'93\'83\'58\'83\'67\'81\'5b\'83\'8b\ \'82\'f0\'90\'a7\'8c\'e4\'82\'b7\'82\'e9\'82\'bd\'82\'df\'82\'c9\'8e\'67\'82\'ed\'82\'ea\'82\'e9\'83\'58\'83\'4e\'83\'8a\'83\'76\'83\'67\'82\'f0\'82\'e0\'89\'c1\'82\'a6\'82\'bd\'82\'e0\'82\'cc\'82\'f0\'88\'d3\'96\'a1\'82\'b7\'82\'e9\'81\'42\'82\'b5\'82\'a9\'82\'b5\'93\'c1\'95\'ca\ \'82\'c8\'97\'e1\'8a\'4f\'82\'c6\'82\'b5\'82\'c4\'81\'41\'82\'bb\'82\'cc\'83\'52\'83\'93\'83\'7c\'81\'5b\'83\'6c\'83\'93\'83\'67\'8e\'a9\'91\'cc\'82\'aa\'8e\'c0\'8d\'73\'8c\'60\'8e\'ae\'82\'c9\'95\'74\'90\'8f\'82\'b7\'82\'e9\'82\'cc\'82\'c5\'82\'cd\'96\'b3\'82\'a2\'8c\'c0\'82\'e8\'81\'41\ \'94\'d0\'95\'7a\'82\'b3\'82\'ea\'82\'e9\'82\'e0\'82\'cc\'82\'cc\'92\'86\'82\'c9\'81\'41\'8e\'c0\'8d\'73\'8c\'60\'8e\'ae\'82\'aa\'8e\'c0\'8d\'73\'82\'b3\'82\'ea\'82\'e9\'83\'49\'83\'79\'83\'8c\'81\'5b\'83\'65\'83\'42\'83\'93\'83\'4f\'83\'56\'83\'58\'83\'65\'83\'80\'82\'cc\'8e\'e5\ \'97\'76\'82\'c8\'83\'52\'83\'93\'83\'7c\'81\'5b\'83\'6c\'83\'93\'83\'67 \f0 ( \f1 \'83\'52\'83\'93\'83\'70\'83\'43\'83\'89\'82\'e2\'83\'4a\'81\'5b\'83\'6c\'83\'8b\'93\'99 \f0 ) \f1 \'82\'c6\'92\'ca\'8f\'ed\'88\'ea\'8f\'8f\'82\'c9 \f0 ( \f1 \'83\'5c\'81\'5b\'83\'58\'82\'a9\'83\'6f\'83\'43\'83\'69\ \'83\'8a\'8c\'60\'8e\'ae\'82\'cc\'82\'c7\'82\'bf\'82\'e7\'82\'a9\'82\'c5 \f0 ) \f1 \'94\'d0\'95\'7a\'82\'b3\'82\'ea\'82\'e9\'82\'e0\'82\'cc\'82\'f0\'8a\'dc\'82\'f1\'82\'c5\'82\'a2\'82\'e9\'95\'4b\'97\'76\'82\'cd\'82\'c8\'82\'a2\'82\'c6\'82\'b7\'82\'e9\'81\'42\ \ \'8e\'c0\'8d\'73\'8c\'60\'8e\'ae\'82\'dc\'82\'bd\'82\'cd\'83\'49\'83\'75\'83\'57\'83\'46\'83\'4e\'83\'67\'83\'52\'81\'5b\'83\'68\'82\'cc\'94\'d0\'95\'7a\'82\'aa\'81\'41\'8e\'77\'92\'e8\'82\'b3\'82\'ea\'82\'bd\'8f\'ea\'8f\'8a\'82\'a9\'82\'e7\'83\'52\'83\'73\'81\'5b\'82\'b7\'82\'e9\ \'82\'bd\'82\'df\'82\'cc\'83\'41\'83\'4e\'83\'5a\'83\'58\'8e\'e8\'92\'69\'82\'f0\'92\'f1\'8b\'9f\'82\'b7\'82\'e9\'82\'b1\'82\'c6\'82\'c5\'88\'d7\'82\'b3\'82\'ea\'82\'e9\'82\'c6\'82\'b5\'82\'c4\'81\'41\'82\'bb\'82\'cc\'8f\'e3\'82\'c5\'83\'5c\'81\'5b\'83\'58\'83\'52\'81\'5b\'83\'68\ \'82\'e0\'93\'af\'93\'99\'82\'cc\'83\'41\'83\'4e\'83\'5a\'83\'58\'8e\'e8\'92\'69\'82\'c9\'82\'e6\'82\'c1\'82\'c4\'93\'af\'82\'b6\'8f\'ea\'8f\'8a\'82\'a9\'82\'e7\'83\'52\'83\'73\'81\'5b\'82\'c5\'82\'ab\'82\'e9\'82\'e6\'82\'a4\'82\'c9\'82\'c8\'82\'c1\'82\'c4\'82\'a2\'82\'e9\'82\'c8\ \'82\'e7\'82\'ce\'81\'41\'91\'e6\'8e\'4f\'8e\'d2\'82\'aa\'83\'49\'83\'75\'83\'57\'83\'46\'83\'4e\'83\'67\'83\'52\'81\'5b\'83\'68\'82\'c6\'88\'ea\'8f\'8f\'82\'c9\'83\'5c\'81\'5b\'83\'58\'82\'e0\'8b\'ad\'90\'a7\'93\'49\'82\'c9\'83\'52\'83\'73\'81\'5b\'82\'b3\'82\'b9\'82\'e7\'82\'ea\ \'82\'e9\'82\'e6\'82\'a4\'82\'c9\'82\'c8\'82\'c1\'82\'c4\'82\'a2\'82\'c8\'82\'ad\'82\'c4\'82\'e0\'83\'5c\'81\'5b\'83\'58\'83\'52\'81\'5b\'83\'68\'94\'d0\'95\'7a\'82\'cc\'8f\'f0\'8c\'8f\'82\'f0\'96\'9e\'82\'bd\'82\'b5\'82\'c4\'82\'a2\'82\'e9\'82\'e0\'82\'cc\'82\'c6\'82\'b7\'82\'e9\'81\'42\ \ \ \page \ \f0 4. \f1 \'82\'a0\'82\'c8\'82\'bd\'82\'cd\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'f0\'81\'41\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'c9\'82\'a8\'82\'a2\'82\'c4\'96\'be\'8a\'6d\'82\'c9\'92\'f1\'8e\'a6\'82\'b3\'82\'ea\'82\'bd\'8d\'73\ \'88\'d7\'82\'f0\'8f\'9c\'82\'ab\'95\'a1\'90\'bb\'82\'e2\'89\'fc\'95\'cf\'81\'41\'83\'54\'83\'75\'83\'89\'83\'43\'83\'5a\'83\'93\'83\'58\'81\'41\'82\'a0\'82\'e9\'82\'a2\'82\'cd\'94\'d0\'95\'7a\'82\'b5\'82\'c4\'82\'cd\'82\'c8\'82\'e7\'82\'c8\'82\'a2\'81\'42\'91\'bc\'82\'c9\ \'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'f0\'95\'a1\'90\'bb\'82\'e2\'89\'fc\'95\'cf\'81\'41\'83\'54\'83\'75\'83\'89\'83\'43\'83\'5a\'83\'93\'83\'58\'81\'41\'82\'a0\'82\'e9\'82\'a2\'82\'cd\'94\'d0\'95\'7a\'82\'b7\'82\'e9\'8a\'e9\'82\'c4\'82\'cd\'82\'b7\'82\'d7\ \'82\'c4\'96\'b3\'8c\'f8\'82\'c5\'82\'a0\'82\'e8\'81\'41\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'cc\'89\'ba\'82\'c5\'82\'cc\'82\'a0\'82\'c8\'82\'bd\'82\'cc\'8c\'a0\'97\'98\'82\'f0\'8e\'a9\'93\'ae\'93\'49\'82\'c9\'8f\'49\'8c\'8b\'82\'b3\'82\'b9\'82\'e9\'82\'b1\ \'82\'c6\'82\'c9\'82\'c8\'82\'eb\'82\'a4\'81\'42\'82\'b5\'82\'a9\'82\'b5\'81\'41\'95\'a1\'90\'bb\'95\'a8\'82\'e2\'8c\'a0\'97\'98\'82\'f0\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'c9\'8f\'5d\'82\'c1\'82\'c4\'82\'a0\'82\'c8\'82\'bd\'82\'a9\'82\'e7\'93\'be\'82\'bd\ \'90\'6c\'81\'58\'82\'c9\'8a\'d6\'82\'b5\'82\'c4\'82\'cd\'81\'41\'82\'bb\'82\'cc\'82\'e6\'82\'a4\'82\'c8\'90\'6c\'81\'58\'82\'aa\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'c9\'8a\'ae\'91\'53\'82\'c9\'8f\'5d\'82\'c1\'82\'c4\'82\'a2\'82\'e9\'8c\'c0\'82\'e8\'94\'de\ \'82\'e7\'82\'cc\'83\'89\'83\'43\'83\'5a\'83\'93\'83\'58\'82\'dc\'82\'c5\'8f\'49\'8c\'8b\'82\'b7\'82\'e9\'82\'b1\'82\'c6\'82\'cd\'82\'c8\'82\'a2\'81\'42\ \ \f0 5. \f1 \'82\'a0\'82\'c8\'82\'bd\'82\'cd\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'f0\'8e\'f3\'91\'f8\'82\'b7\'82\'e9\'95\'4b\'97\'76\'82\'cd\'96\'b3\'82\'a2\'81\'42\'82\'c6\'82\'a2\'82\'a4\'82\'cc\'82\'cd\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'cd\'82\'b1\ \'82\'ea\'82\'c9\'8f\'90\'96\'bc\'82\'b5\'82\'c4\'82\'a2\'82\'c8\'82\'a2\'82\'a9\'82\'e7\'82\'c5\'82\'a0\'82\'e9\'81\'42\'82\'b5\'82\'a9\'82\'b5\'81\'41\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'88\'c8\'8a\'4f\'82\'c9\'82\'a0\'82\'c8\'82\'bd\'82\'c9\'91\'ce\'82\'b5\ \'82\'c4\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'e2\'82\'bb\'82\'cc\'94\'68\'90\'b6\'95\'a8\'82\'f0\'95\'cf\'8d\'58\'81\'41\'94\'d0\'95\'7a\'82\'b7\'82\'e9\'8b\'96\'89\'c2\'82\'f0\'97\'5e\'82\'a6\'82\'e9\'82\'e0\'82\'cc\'82\'cd\'91\'b6\'8d\'dd\'82\'b5\'82\'c8\ \'82\'a2\'81\'42\'82\'b1\'82\'ea\'82\'e7\'82\'cc\'8d\'73\'88\'d7\'82\'cd\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'aa\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'f0\'8e\'f3\'82\'af\'93\'fc\'82\'ea\'82\'c8\'82\'a2\'8c\'c0\'82\'e8\'96\'40\'82\'c9\'82\'e6\'82\'c1\'82\'c4\ \'8b\'d6\'82\'b6\'82\'e7\'82\'ea\'82\'c4\'82\'a2\'82\'e9\'81\'42\'82\'bb\'82\'b1\'82\'c5\'81\'41\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78 \f0 ( \f1 \'82\'a0\'82\'e9\'82\'a2\'82\'cd\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'f0\'8a\'ee\'82\'c9\'82\'b5\ \'82\'bd\'92\'98\'8d\'ec\'95\'a8\'82\'cc\'82\'b7\'82\'d7\'82\'c4 \f0 ) \f1 \'82\'f0\'89\'fc\'95\'cf\'82\'c8\'82\'a2\'82\'b5\'94\'d0\'95\'7a\'82\'b7\'82\'e9\'82\'b1\'82\'c6\'82\'c9\'82\'e6\'82\'e8\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'cd\'8e\'a9\'95\'aa\'82\'aa\'82\'bb\'82\'cc\'82\'e6\ \'82\'a4\'82\'c8\'8d\'73\'88\'d7\'82\'f0\'8d\'73\'82\'a4\'82\'bd\'82\'df\'82\'c9\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'f0\'8e\'f3\'91\'f8\'82\'b5\'82\'bd\'82\'c6\'82\'a2\'82\'a4\'82\'b1\'82\'c6\'81\'41\'82\'bb\'82\'b5\'82\'c4\'81\'77\'83\'76\'83\'8d\'83\'4f\ \'83\'89\'83\'80\'81\'78\'82\'c6\'82\'bb\'82\'ea\'82\'c9\'8a\'ee\'82\'c3\'82\'ad\'92\'98\'8d\'ec\'95\'a8\'82\'cc\'95\'a1\'90\'bb\'82\'e2\'94\'d0\'95\'7a\'81\'41\'89\'fc\'95\'cf\'82\'c9\'82\'c2\'82\'a2\'82\'c4\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'aa\'89\'db\ \'82\'b7\'90\'a7\'96\'f1\'82\'c6\'8f\'f0\'8c\'8f\'82\'f0\'82\'b7\'82\'d7\'82\'c4\'8e\'f3\'82\'af\'93\'fc\'82\'ea\'82\'bd\'82\'c6\'82\'a2\'82\'a4\'82\'b1\'82\'c6\'82\'f0\'8e\'a6\'82\'b5\'82\'bd\'82\'e0\'82\'cc\'82\'c6\'8c\'a9\'82\'c8\'82\'b7\'81\'42\ \ \f0 6. \f1 \'82\'a0\'82\'c8\'82\'bd\'82\'aa\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78 \f0 ( \f1 \'82\'dc\'82\'bd\'82\'cd\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'f0\'8a\'ee\'82\'c9\'82\'b5\'82\'bd\'92\'98\'8d\'ec\'95\'a8\'91\'53\'94\'ca \f0 ) \f1 \'82\'f0\ \'8d\'c4\'94\'d0\'95\'7a\'82\'b7\'82\'e9\'82\'bd\'82\'d1\'82\'c9\'81\'41\'82\'bb\'82\'cc\'8e\'f3\'97\'cc\'8e\'d2\'82\'cd\'8c\'b3\'81\'58\'82\'cc\'83\'89\'83\'43\'83\'5a\'83\'93\'83\'58\'8b\'96\'89\'c2\'8e\'d2\'82\'a9\'82\'e7\'81\'41\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'c5\ \'8e\'77\'92\'e8\'82\'b3\'82\'ea\'82\'bd\'8f\'f0\'8c\'8f\'82\'c6\'90\'a7\'96\'f1\'82\'cc\'89\'ba\'82\'c5\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'f0\'95\'a1\'90\'bb\'82\'e2\'94\'d0\'95\'7a\'81\'41\'82\'a0\'82\'e9\'82\'a2\'82\'cd\'89\'fc\'95\'cf\'82\'b7\'82\'e9\ \'8b\'96\'89\'c2\'82\'f0\'8e\'a9\'93\'ae\'93\'49\'82\'c9\'93\'be\'82\'e9\'82\'e0\'82\'cc\'82\'c6\'82\'b7\'82\'e9\'81\'42\'82\'a0\'82\'c8\'82\'bd\'82\'cd\'81\'41\'8e\'f3\'97\'cc\'8e\'d2\'82\'aa\'82\'b1\'82\'b1\'82\'c5\'94\'46\'82\'df\'82\'e7\'82\'ea\'82\'bd\'8c\'a0\'97\'98\'82\'f0\ \'8d\'73\'8e\'67\'82\'b7\'82\'e9\'82\'b1\'82\'c6\'82\'c9\'8a\'d6\'82\'b5\'82\'c4\'82\'b1\'82\'ea\'88\'c8\'8f\'e3\'91\'bc\'82\'cc\'82\'a2\'82\'a9\'82\'c8\'82\'e9\'90\'a7\'8c\'c0\'82\'e0\'89\'db\'82\'b7\'82\'b1\'82\'c6\'82\'aa\'82\'c5\'82\'ab\'82\'c8\'82\'a2\'81\'42\'82\'a0\'82\'c8\ \'82\'bd\'82\'c9\'82\'cd\'81\'41\'91\'e6\'8e\'4f\'8e\'d2\'82\'aa\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'c9\'8f\'5d\'82\'a4\'82\'b1\'82\'c6\'82\'f0\'8b\'ad\'90\'a7\'82\'b7\'82\'e9\'90\'d3\'94\'43\'82\'cd\'82\'c8\'82\'a2\'81\'42\ \ \f0 7. \f1 \'93\'c1\'8b\'96\'90\'4e\'8a\'51\'82\'a0\'82\'e9\'82\'a2\'82\'cd\'82\'bb\'82\'cc\'91\'bc\'82\'cc\'97\'9d\'97\'52 \f0 ( \f1 \'93\'c1\'8b\'96\'8a\'d6\'8c\'57\'82\'c9\'8c\'c0\'82\'e7\'82\'c8\'82\'a2 \f0 ) \f1 \'82\'a9\'82\'e7\'81\'41\'8d\'d9\'94\'bb\'8f\'8a\'82\'cc\'94\'bb\'8c\'88\ \'82\'a0\'82\'e9\'82\'a2\'82\'cd\'90\'5c\'82\'b5\'97\'a7\'82\'c4\'82\'cc\'8c\'8b\'89\'ca\'82\'c6\'82\'b5\'82\'c4\'82\'a0\'82\'c8\'82\'bd\'82\'c9 \f0 ( \f1 \'8d\'d9\'94\'bb\'8f\'8a\'96\'bd\'97\'df\'82\'e2\'8c\'5f\'96\'f1\'82\'c8\'82\'c7\'82\'c9\'82\'e6\'82\'e8 \f0 ) \f1 \'82\'b1\'82\'cc\'8c\'5f\ \'96\'f1\'8f\'91\'82\'cc\'8f\'f0\'8c\'8f\'82\'c6\'96\'b5\'8f\'82\'82\'b7\'82\'e9\'90\'a7\'96\'f1\'82\'aa\'89\'db\'82\'b3\'82\'ea\'82\'bd\'8f\'ea\'8d\'87\'82\'c5\'82\'e0\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'aa\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'cc\'8f\'f0\'8c\'8f\'82\'f0\ \'96\'c6\'8f\'9c\'82\'b3\'82\'ea\'82\'e9\'82\'ed\'82\'af\'82\'c5\'82\'cd\'82\'c8\'82\'a2\'81\'42\'82\'e0\'82\'b5\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'cc\'89\'ba\'82\'c5\'82\'a0\'82\'c8\'82\'bd\'82\'c9\'89\'db\'82\'b9\'82\'e7\'82\'ea\'82\'bd\'90\'d3\'94\'43\'82\'c6\'91\'bc\ \'82\'cc\'8a\'d6\'98\'41\'82\'b7\'82\'e9\'90\'d3\'94\'43\'82\'f0\'93\'af\'8e\'9e\'82\'c9\'96\'9e\'82\'bd\'82\'b7\'82\'e6\'82\'a4\'82\'c8\'8c\'60\'82\'c5\'94\'d0\'95\'7a\'82\'c5\'82\'ab\'82\'c8\'82\'a2\'82\'c8\'82\'e7\'82\'ce\'81\'41\'8c\'8b\'89\'ca\'82\'c6\'82\'b5\'82\'c4\'82\'a0\ \'82\'c8\'82\'bd\'82\'cd\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'f0\'94\'d0\'95\'7a\'82\'b7\'82\'e9\'82\'b1\'82\'c6\'82\'aa\'91\'53\'82\'ad\'82\'c5\'82\'ab\'82\'c8\'82\'a2\'82\'c6\'82\'a2\'82\'a4\'82\'b1\'82\'c6\'82\'c5\'82\'a0\'82\'e9\'81\'42\'97\'e1\'82\'a6\ \'82\'ce\'93\'c1\'8b\'96\'83\'89\'83\'43\'83\'5a\'83\'93\'83\'58\'82\'aa\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'a9\'82\'e7\'92\'bc\'90\'da\'8a\'d4\'90\'da\'82\'f0\'96\'e2\'82\'ed\'82\'b8\'83\'52\'83\'73\'81\'5b\'82\'f0\'8e\'f3\'82\'af\'8e\'e6\'82\'c1\'82\'bd\'90\'6c\'82\'aa\'92\'4e\ \'82\'c5\'82\'e0\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'f0\'8e\'67\'97\'70\'97\'bf\'96\'b3\'97\'bf\'82\'c5\'8d\'c4\'94\'d0\'95\'7a\'82\'b7\'82\'e9\'82\'b1\'82\'c6\'82\'f0\'94\'46\'82\'df\'82\'c4\'82\'a2\'82\'c8\'82\'a2\'8f\'ea\'8d\'87\'81\'41\'82\'a0\'82\'c8\ \'82\'bd\'82\'aa\'82\'bb\'82\'cc\'90\'a7\'96\'f1\'82\'c6\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'f0\'97\'bc\'95\'fb\'82\'c6\'82\'e0\'96\'9e\'82\'bd\'82\'b7\'82\'c9\'82\'cd\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'cc\'94\'d0\'95\'7a\'82\'f0\'8a\'ae\'91\'53\ \'82\'c9\'92\'86\'8e\'7e\'82\'b7\'82\'e9\'82\'b5\'82\'a9\'82\'c8\'82\'a2\'82\'be\'82\'eb\'82\'a4\'81\'42\ \ \'82\'b1\'82\'cc\'90\'df\'82\'cc\'88\'ea\'95\'94\'95\'aa\'82\'aa\'93\'c1\'92\'e8\'82\'cc\'8f\'f3\'8b\'b5\'82\'cc\'89\'ba\'82\'c5\'96\'b3\'8c\'f8\'82\'c8\'82\'a2\'82\'b5\'8e\'c0\'8e\'7b\'95\'73\'89\'c2\'94\'5c\'82\'c8\'8f\'ea\'8d\'87\'82\'c5\'82\'e0\'81\'41\'90\'df\'82\'cc\'8e\'63\ \'82\'e8\'82\'cc\'95\'94\'95\'aa\'82\'cd\'93\'4b\'97\'70\'82\'b3\'82\'ea\'82\'e9\'82\'e6\'82\'a4\'88\'d3\'90\'7d\'82\'b3\'82\'ea\'82\'c4\'82\'a2\'82\'e9\'81\'42\'82\'bb\'82\'cc\'91\'bc\'82\'cc\'8f\'f3\'8b\'b5\'82\'c5\'82\'cd\'90\'df\'82\'aa\'91\'53\'91\'cc\'82\'c6\'82\'b5\'82\'c4\ \'93\'4b\'97\'70\'82\'b3\'82\'ea\'82\'e9\'82\'e6\'82\'a4\'88\'d3\'90\'7d\'82\'b3\'82\'ea\'82\'c4\'82\'a2\'82\'e9\'81\'42\ \ \'93\'c1\'8b\'96\'82\'e2\'82\'bb\'82\'cc\'91\'bc\'82\'cc\'8d\'e0\'8e\'59\'8c\'a0\'82\'f0\'90\'4e\'8a\'51\'82\'b5\'82\'bd\'82\'e8\'81\'41\'82\'bb\'82\'cc\'82\'e6\'82\'a4\'82\'c8\'8c\'a0\'97\'98\'82\'cc\'8e\'e5\'92\'a3\'82\'cc\'8c\'f8\'97\'cd\'82\'c9\'88\'d9\'8b\'63\'82\'f0\'8f\'a5\ \'82\'a6\'82\'bd\'82\'e8\'82\'b7\'82\'e9\'82\'e6\'82\'a4\'82\'a0\'82\'c8\'82\'bd\'82\'f0\'97\'55\'98\'66\'82\'b7\'82\'e9\'82\'b1\'82\'c6\'82\'aa\'82\'b1\'82\'cc\'90\'df\'82\'cc\'96\'da\'93\'49\'82\'c5\'82\'cd\'82\'c8\'82\'a2\'81\'42\'82\'b1\'82\'cc\'90\'df\'82\'c9\'82\'cd\'81\'41\ \'90\'6c\'81\'58\'82\'c9\'82\'e6\'82\'c1\'82\'c4\'83\'89\'83\'43\'83\'5a\'83\'93\'83\'58\'8a\'b5\'8d\'73\'82\'c6\'82\'b5\'82\'c4\'8e\'c0\'8c\'bb\'82\'b3\'82\'ea\'82\'c4\'82\'ab\'82\'bd\'81\'41\'83\'74\'83\'8a\'81\'5b\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'94\'d0\'95\'7a\ \'82\'cc\'83\'56\'83\'58\'83\'65\'83\'80\'82\'cc\'8a\'ae\'91\'53\'90\'ab\'82\'f0\'8c\'ec\'82\'e9\'82\'c6\'82\'a2\'82\'a4\'96\'da\'93\'49\'82\'b5\'82\'a9\'82\'c8\'82\'a2\'81\'42\'91\'bd\'82\'ad\'82\'cc\'90\'6c\'81\'58\'82\'aa\'81\'41\'83\'74\'83\'8a\'81\'5b\'83\'5c\'83\'74\'83\'67\ \'83\'45\'83\'46\'83\'41\'82\'cc\'94\'d0\'95\'7a\'83\'56\'83\'58\'83\'65\'83\'80\'82\'aa\'8e\'f1\'94\'f6\'88\'ea\'8a\'d1\'82\'b5\'82\'c4\'93\'4b\'97\'70\'82\'b3\'82\'ea\'82\'c4\'82\'a2\'82\'e9\'82\'c6\'82\'a2\'82\'a4\'90\'4d\'97\'8a\'82\'c9\'8a\'ee\'82\'c3\'82\'ab\'81\'41\'82\'b1\ \'82\'cc\'83\'56\'83\'58\'83\'65\'83\'80\'82\'f0\'92\'ca\'82\'b6\'82\'c4\'94\'d0\'95\'7a\'82\'b3\'82\'ea\'82\'e9\'91\'bd\'97\'6c\'82\'c8\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'82\'c9\'8a\'b0\'91\'e5\'82\'c8\'8d\'76\'8c\'a3\'82\'f0\'82\'b5\'82\'c4\'82\'ab\'82\'bd\'82\'cc\ \'82\'cd\'8e\'96\'8e\'c0\'82\'c5\'82\'a0\'82\'e9\'82\'aa\'81\'41\'90\'6c\'82\'aa\'82\'c7\'82\'cc\'82\'e6\'82\'a4\'82\'c8\'83\'56\'83\'58\'83\'65\'83\'80\'82\'f0\'92\'ca\'82\'b6\'82\'c4\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'82\'f0\'94\'d0\'95\'7a\'82\'b5\'82\'bd\'82\'a2\ \'82\'c6\'8e\'76\'82\'a4\'82\'a9\'82\'cd\'82\'a0\'82\'ad\'82\'dc\'82\'c5\'82\'e0\'8d\'ec\'8e\'d2 \f0 / \f1 \'8a\'f1\'97\'5e\'8e\'d2\'8e\'9f\'91\'e6\'82\'c5\'82\'a0\'82\'e8\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'aa\'91\'49\'91\'f0\'82\'f0\'89\'9f\'82\'b5\'82\'c2\'82\'af\'82\'e9\'82\'b1\ \'82\'c6\'82\'cd\'82\'c5\'82\'ab\'82\'c8\'82\'a2\'81\'42\ \ \'82\'b1\'82\'cc\'90\'df\'82\'cd\'81\'41\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'cc\'82\'b1\'82\'cc\'90\'df\'88\'c8\'8a\'4f\'82\'cc\'95\'94\'95\'aa\'82\'cc\'88\'ea\'8b\'41\'8c\'8b\'82\'c9\'82\'c8\'82\'e9\'82\'c6\'8d\'6c\'82\'a6\'82\'e7\'82\'ea\'82\'e9\'83\'50\'81\'5b\ \'83\'58\'82\'f0\'93\'4f\'92\'ea\'93\'49\'82\'c9\'96\'be\'82\'e7\'82\'a9\'82\'c9\'82\'b7\'82\'e9\'82\'b1\'82\'c6\'82\'f0\'96\'da\'93\'49\'82\'c6\'82\'b5\'82\'c4\'82\'a2\'82\'e9\'81\'42\ \ \ \page \ \f0 8. \f1 \'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'cc\'94\'d0\'95\'7a\'82\'e2\'97\'98\'97\'70\'82\'aa\'81\'41\'82\'a0\'82\'e9\'8d\'91\'82\'c9\'82\'a8\'82\'a2\'82\'c4\'82\'cd\'93\'c1\'8b\'96\'82\'dc\'82\'bd\'82\'cd\'92\'98\'8d\'ec\'8c\'a0\'82\'aa\'8e\'e5\ \'92\'a3\'82\'b3\'82\'ea\'82\'bd\'83\'43\'83\'93\'83\'5e\'81\'5b\'83\'74\'83\'46\'81\'5b\'83\'58\'82\'cc\'82\'a2\'82\'b8\'82\'ea\'82\'a9\'82\'c9\'82\'e6\'82\'c1\'82\'c4\'90\'a7\'8c\'c0\'82\'b3\'82\'ea\'82\'c4\'82\'a2\'82\'e9\'8f\'ea\'8d\'87\'81\'41\'81\'77\'83\'76\'83\'8d\'83\'4f\ \'83\'89\'83\'80\'81\'78\'82\'c9\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'f0\'93\'4b\'97\'70\'82\'b5\'82\'bd\'8c\'b3\'82\'cc\'92\'98\'8d\'ec\'8c\'a0\'8e\'d2\'82\'cd\'81\'41\'82\'bb\'82\'a4\'82\'a2\'82\'c1\'82\'bd\'8d\'91\'81\'58\'82\'f0\'94\'72\'8f\'9c\'82\'b5\ \'82\'bd\'96\'be\'8a\'6d\'82\'c8\'92\'6e\'97\'9d\'93\'49\'94\'d0\'95\'7a\'90\'a7\'8c\'c0\'82\'f0\'89\'c1\'82\'a6\'81\'41\'82\'bb\'82\'b1\'82\'c5\'94\'72\'8f\'9c\'82\'b3\'82\'ea\'82\'c4\'82\'a2\'82\'c8\'82\'a2\'8d\'91\'82\'cc\'92\'86\'82\'e2\'82\'bb\'82\'ea\'82\'e7\'82\'cc\'8d\'91\'81\'58\ \'82\'cc\'8a\'d4\'82\'c5\'82\'cc\'82\'dd\'94\'d0\'95\'7a\'82\'aa\'8b\'96\'89\'c2\'82\'b3\'82\'ea\'82\'e9\'82\'e6\'82\'a4\'82\'c9\'82\'b5\'82\'c4\'82\'e0\'8d\'5c\'82\'ed\'82\'c8\'82\'a2\'81\'42\'82\'bb\'82\'cc\'8f\'ea\'8d\'87\'81\'41\'82\'bb\'82\'cc\'82\'e6\'82\'a4\'82\'c8\'90\'a7\ \'8c\'c0\'82\'cd\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'96\'7b\'95\'b6\'82\'c5\'8f\'91\'82\'a9\'82\'ea\'82\'c4\'82\'a2\'82\'e9\'82\'cc\'82\'c6\'93\'af\'97\'6c\'82\'c9\'8c\'a9\'82\'c8\'82\'b3\'82\'ea\'82\'e9\'81\'42\ \ \f0 9. \f1 \'83\'74\'83\'8a\'81\'5b\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'8d\'e0\'92\'63\'82\'cd\'81\'41\'8e\'9e\'82\'c9\'82\'e6\'82\'c1\'82\'c4\'89\'fc\'92\'f9\'82\'dc\'82\'bd\'82\'cd\'90\'56\'94\'c5\'82\'cc\'88\'ea\'94\'ca\'8c\'f6\'8f\'4f\'97\'98\'97\'70\'8b\'96\ \'91\'f8\'8f\'91\'82\'f0\'94\'ad\'95\'5c\'82\'b7\'82\'e9\'82\'b1\'82\'c6\'82\'aa\'82\'c5\'82\'ab\'82\'e9\'81\'42\'82\'bb\'82\'cc\'82\'e6\'82\'a4\'82\'c8\'90\'56\'94\'c5\'82\'cd\'8c\'bb\'8d\'dd\'82\'cc\'83\'6f\'81\'5b\'83\'57\'83\'87\'83\'93\'82\'c6\'82\'bb\'82\'cc\'90\'b8\'90\'5f\ \'82\'c9\'82\'a8\'82\'a2\'82\'c4\'82\'cd\'8e\'97\'82\'bd\'82\'e0\'82\'cc\'82\'c9\'82\'c8\'82\'e9\'82\'be\'82\'eb\'82\'a4\'82\'aa\'81\'41\'90\'56\'82\'bd\'82\'c8\'96\'e2\'91\'e8\'82\'e2\'8c\'9c\'94\'4f\'82\'f0\'89\'f0\'8c\'88\'82\'b7\'82\'e9\'82\'bd\'82\'df\'8d\'d7\'95\'94\'82\'c5\ \'82\'cd\'88\'d9\'82\'c8\'82\'e9\'89\'c2\'94\'5c\'90\'ab\'82\'aa\'82\'a0\'82\'e9\'81\'42\ \ \'82\'bb\'82\'ea\'82\'bc\'82\'ea\'82\'cc\'83\'6f\'81\'5b\'83\'57\'83\'87\'83\'93\'82\'c9\'82\'cd\'81\'41\'8c\'a9\'95\'aa\'82\'af\'82\'aa\'95\'74\'82\'ad\'82\'e6\'82\'a4\'82\'c9\'83\'6f\'81\'5b\'83\'57\'83\'87\'83\'93\'94\'d4\'8d\'86\'82\'aa\'90\'55\'82\'e7\'82\'ea\'82\'c4\'82\'a2\ \'82\'e9\'81\'42\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'c9\'82\'a8\'82\'a2\'82\'c4\'82\'bb\'82\'ea\'82\'c9\'93\'4b\'97\'70\'82\'b3\'82\'ea\'82\'e9\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'cc\'83\'6f\'81\'5b\'83\'57\'83\'87\'83\'93\'94\'d4\'8d\'86\'82\'aa\ \'8e\'77\'92\'e8\'82\'b3\'82\'ea\'82\'c4\'82\'a2\'82\'c4\'81\'41\'8d\'58\'82\'c9\'81\'75\'82\'bb\'82\'ea\'88\'c8\'8d\'7e\'82\'cc\'82\'a2\'82\'a9\'82\'c8\'82\'e9\'83\'6f\'81\'5b\'83\'57\'83\'87\'83\'93\'81\'76\'82\'e0\'93\'4b\'97\'70\'82\'b5\'82\'c4\'97\'c7\'82\'a2\'82\'c6\'82\'c8\'82\'c1\ \'82\'c4\'82\'a2\'82\'bd\'8f\'ea\'8d\'87\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'cd\'8f\'5d\'82\'a4\'8f\'f0\'8c\'8f\'82\'c6\'90\'a7\'96\'f1\'82\'c6\'82\'b5\'82\'c4\'81\'41\'8e\'77\'92\'e8\'82\'cc\'83\'6f\'81\'5b\'83\'57\'83\'87\'83\'93\'82\'a9\'81\'41\'83\'74\'83\'8a\'81\'5b\'83\'5c\ \'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'8d\'e0\'92\'63\'82\'c9\'82\'e6\'82\'c1\'82\'c4\'94\'ad\'8d\'73\'82\'b3\'82\'ea\'82\'bd\'8e\'77\'92\'e8\'82\'cc\'83\'6f\'81\'5b\'83\'57\'83\'87\'83\'93\'88\'c8\'8d\'7e\'82\'cc\'94\'c5\'82\'cc\'82\'c7\'82\'ea\'82\'a9\'88\'ea\'82\'c2\'82\'cc\ \'82\'c7\'82\'bf\'82\'e7\'82\'a9\'82\'f0\'91\'49\'82\'d4\'82\'b1\'82\'c6\'82\'aa\'8f\'6f\'97\'88\'82\'e9\'81\'42\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'c5\'83\'89\'83\'43\'83\'5a\'83\'93\'83\'58\'82\'cc\'83\'6f\'81\'5b\'83\'57\'83\'87\'83\'93\'94\'d4\'8d\'86\ \'82\'aa\'8e\'77\'92\'e8\'82\'b3\'82\'ea\'82\'c4\'82\'a2\'82\'c8\'82\'a2\'82\'c8\'82\'e7\'82\'ce\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'cd\'8d\'a1\'82\'dc\'82\'c5\'82\'c9\'83\'74\'83\'8a\'81\'5b\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'8d\'e0\'92\'63\'82\'a9\'82\'e7\'94\'ad\ \'8d\'73\'82\'b3\'82\'ea\'82\'bd\'83\'6f\'81\'5b\'83\'57\'83\'87\'83\'93\'82\'cc\'92\'86\'82\'a9\'82\'e7\'8d\'44\'82\'ab\'82\'c9\'91\'49\'82\'f1\'82\'c5\'8d\'5c\'82\'ed\'82\'c8\'82\'a2\'81\'42\ \ \f0 10. \f1 \'82\'e0\'82\'b5\'82\'a0\'82\'c8\'82\'bd\'82\'aa\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'cc\'88\'ea\'95\'94\'82\'f0\'81\'41\'82\'bb\'82\'cc\'94\'d0\'95\'7a\'8f\'f0\'8c\'8f\'82\'aa\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'c6\ \'88\'d9\'82\'c8\'82\'e9\'91\'bc\'82\'cc\'83\'74\'83\'8a\'81\'5b\'82\'c8\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'82\'c6\'93\'9d\'8d\'87\'82\'b5\'82\'bd\'82\'a2\'82\'c8\'82\'e7\'82\'ce\'81\'41\'8d\'ec\'8e\'d2\'82\'c9\'98\'41\'97\'8d\'82\'b5\'82\'c4\'8b\'96\'89\'c2\'82\'f0\'8b\'81\ \'82\'df\'82\'e6\'81\'42\'83\'74\'83\'8a\'81\'5b\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'8d\'e0\'92\'63\'82\'aa\'92\'98\'8d\'ec\'8c\'a0\'82\'f0\'95\'db\'97\'4c\'82\'b7\'82\'e9\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'82\'c9\'82\'c2\'82\'a2\'82\'c4\'82\'cd\'81\'41\ \'83\'74\'83\'8a\'81\'5b\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'8d\'e0\'92\'63\'82\'c9\'98\'41\'97\'8d\'82\'b9\'82\'e6\'81\'42\'8e\'84\'82\'bd\'82\'bf\'82\'cd\'81\'41\'82\'b1\'82\'cc\'82\'e6\'82\'a4\'82\'c8\'8f\'ea\'8d\'87\'82\'cc\'82\'bd\'82\'df\'82\'c9\'93\'c1\'95\'ca\ \'82\'c8\'97\'e1\'8a\'4f\'82\'f0\'90\'dd\'82\'af\'82\'e9\'82\'b1\'82\'c6\'82\'e0\'82\'a0\'82\'e9\'81\'42\'8e\'84\'82\'bd\'82\'bf\'82\'aa\'8c\'88\'92\'e8\'82\'f0\'89\'ba\'82\'b7\'82\'c9\'82\'a0\'82\'bd\'82\'c1\'82\'c4\'82\'cd\'81\'41\'8e\'84\'82\'bd\'82\'bf\'82\'cc\'83\'74\'83\'8a\'81\'5b\ \'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'82\'cc\'94\'68\'90\'b6\'95\'a8\'82\'b7\'82\'d7\'82\'c4\'82\'aa\'83\'74\'83\'8a\'81\'5b\'82\'c8\'8f\'f3\'91\'d4\'82\'c9\'95\'db\'82\'bd\'82\'ea\'82\'e9\'82\'c6\'82\'a2\'82\'a4\'82\'b1\'82\'c6\'82\'c6\'81\'41\'88\'ea\'94\'ca\'93\'49\ \'82\'c9\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'82\'cc\'8b\'a4\'97\'4c\'82\'c6\'8d\'c4\'97\'98\'97\'70\'82\'f0\'91\'a3\'90\'69\'82\'b7\'82\'e9\'82\'c6\'82\'a2\'82\'a4\'93\'f1\'82\'c2\'82\'cc\'96\'da\'95\'57\'82\'f0\'8b\'4b\'8f\'80\'82\'c9\'8c\'9f\'93\'a2\'82\'b3\'82\'ea\ \'82\'e9\'82\'c5\'82\'a0\'82\'eb\'82\'a4\'81\'42\ \f0 \f1 \'96\'b3\'95\'db\'8f\'d8\'82\'c9\'82\'c2\'82\'a2\'82\'c4\ \ \f0 11. \f1 \'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'cd\'91\'e3\'89\'bf\'96\'b3\'82\'b5\'82\'c9\'97\'98\'97\'70\'82\'aa\'8b\'96\'89\'c2\'82\'b3\'82\'ea\'82\'e9\'82\'cc\'82\'c5\'81\'41\'93\'4b\'90\'d8\'82\'c8\'96\'40\'82\'aa\'94\'46\'82\'df\'82\'e9\'8c\'c0\ \'82\'e8\'82\'c9\'82\'a8\'82\'a2\'82\'c4\'81\'41\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'c9\'8a\'d6\'82\'b7\'82\'e9\'82\'a2\'82\'a9\'82\'c8\'82\'e9\'95\'db\'8f\'d8\'82\'e0\'91\'b6\'8d\'dd\'82\'b5\'82\'c8\'82\'a2\'81\'42\'8f\'91\'96\'ca\'82\'c5\'95\'ca\'82\'c9\ \'8f\'71\'82\'d7\'82\'e9\'8f\'ea\'8d\'87\'82\'f0\'8f\'9c\'82\'a2\'82\'c4\'81\'41\'92\'98\'8d\'ec\'8c\'a0\'8e\'d2\'81\'41\'82\'dc\'82\'bd\'82\'cd\'82\'bb\'82\'cc\'91\'bc\'82\'cc\'92\'63\'91\'cc\'82\'cd\'81\'41\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'f0\'81\'41\ \'95\'5c\'96\'be\'82\'b3\'82\'ea\'82\'bd\'82\'a9\'8c\'be\'8a\'4f\'82\'c9\'82\'a9\'82\'cd\'96\'e2\'82\'ed\'82\'b8\'81\'41\'8f\'a4\'8b\'c6\'93\'49\'93\'4b\'90\'ab\'82\'f0\'95\'db\'8f\'d8\'82\'b7\'82\'e9\'82\'d9\'82\'cc\'82\'df\'82\'a9\'82\'b5\'82\'e2\'82\'a0\'82\'e9\'93\'c1\'92\'e8\ \'82\'cc\'96\'da\'93\'49\'82\'d6\'82\'cc\'93\'4b\'8d\'87\'90\'ab \f0 ( \f1 \'82\'c9\'8c\'c0\'82\'e7\'82\'ea\'82\'c8\'82\'a2 \f0 ) \f1 \'82\'f0\'8a\'dc\'82\'de\'88\'ea\'90\'d8\'82\'cc\'95\'db\'8f\'d8\'96\'b3\'82\'b5\'82\'c9\'81\'75\'82\'a0\'82\'e9\'82\'aa\'82\'dc\'82\'dc\'81\'76\'82\'c5\'92\'f1\ \'8b\'9f\'82\'b7\'82\'e9\'81\'42\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'cc\'8e\'bf\'82\'c6\'90\'ab\'94\'5c\'82\'c9\'8a\'d6\'82\'b7\'82\'e9\'83\'8a\'83\'58\'83\'4e\'82\'cc\'82\'b7\'82\'d7\'82\'c4\'82\'cd\'82\'a0\'82\'c8\'82\'bd\'82\'c9\'8b\'41\'91\'ae\'82\'b7\ \'82\'e9\'81\'42\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'c9\'8c\'87\'8a\'d7\'82\'aa\'82\'a0\'82\'e9\'82\'c6\'94\'bb\'96\'be\'82\'b5\'82\'bd\'8f\'ea\'8d\'87\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'cd\'95\'4b\'97\'76\'82\'c8\'95\'db\'8e\'e7\'93\'5f\'8c\'9f\'82\'e2\ \'95\'e2\'8f\'43\'81\'41\'8f\'43\'90\'b3\'82\'c9\'97\'76\'82\'b7\'82\'e9\'83\'52\'83\'58\'83\'67\'82\'cc\'82\'b7\'82\'d7\'82\'c4\'82\'f0\'88\'f8\'82\'ab\'8e\'f3\'82\'af\'82\'e9\'82\'b1\'82\'c6\'82\'c9\'82\'c8\'82\'e9\'81\'42\ \ \f0 12. \f1 \'93\'4b\'90\'d8\'82\'c8\'96\'40\'82\'a9\'8f\'91\'96\'ca\'82\'c5\'82\'cc\'93\'af\'88\'d3\'82\'c9\'82\'e6\'82\'c1\'82\'c4\'96\'bd\'82\'ba\'82\'e7\'82\'ea\'82\'c8\'82\'a2\'8c\'c0\'82\'e8\'81\'41\'92\'98\'8d\'ec\'8c\'a0\'8e\'d2\'81\'41\'82\'dc\'82\'bd\'82\'cd\'8f\'e3\ \'8b\'4c\'82\'c5\'8b\'96\'89\'c2\'82\'b3\'82\'ea\'82\'c4\'82\'a2\'82\'e9\'92\'ca\'82\'e8\'82\'c9\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'f0\'89\'fc\'95\'cf\'82\'dc\'82\'bd\'82\'cd\'8d\'c4\'94\'d0\'95\'7a\'82\'b5\'82\'bd\'82\'bb\'82\'cc\'91\'bc\'82\'cc\'92\'63\ \'91\'cc\'82\'cd\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'c9\'91\'ce\'82\'b5\'82\'c4\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'cc\'97\'98\'97\'70\'82\'c8\'82\'a2\'82\'b5\'97\'98\'97\'70\'95\'73\'94\'5c\'82\'c5\'90\'b6\'82\'b6\'82\'bd\'88\'ea\'94\'ca\'93\'49\'81\'41\ \'93\'c1\'95\'ca\'93\'49\'81\'41\'8b\'f4\'91\'52\'93\'49\'81\'41\'95\'4b\'91\'52\'93\'49\'82\'c8\'91\'b9\'8a\'51 \f0 ( \f1 \'83\'66\'81\'5b\'83\'5e\'82\'cc\'8f\'c1\'8e\'b8\'82\'e2\'95\'73\'90\'b3\'8a\'6d\'82\'c8\'8f\'88\'97\'9d\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'a9\'91\'e6\'8e\'4f\ \'8e\'d2\'82\'aa\'94\'ed\'82\'c1\'82\'bd\'91\'b9\'8e\'b8\'81\'41\'82\'a0\'82\'e9\'82\'a2\'82\'cd\'81\'77\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'81\'78\'82\'aa\'91\'bc\'82\'cc\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'82\'c6\'88\'ea\'8f\'8f\'82\'c9\'93\'ae\'8d\'ec\'82\'b5\ \'82\'c8\'82\'a2\'82\'c6\'82\'a2\'82\'a4\'95\'73\'8b\'ef\'8d\'87\'82\'c8\'82\'c7\'82\'f0\'8a\'dc\'82\'de\'82\'aa\'82\'bb\'82\'ea\'82\'e7\'82\'c9\'8c\'c0\'82\'e7\'82\'c8\'82\'a2 \f0 ) \f1 \'82\'c9\'88\'ea\'90\'d8\'82\'cc\'90\'d3\'94\'43\'82\'f0\'95\'89\'82\'ed\'82\'c8\'82\'a2\'81\'42\ \'82\'bb\'82\'cc\'82\'e6\'82\'a4\'82\'c8\'91\'b9\'8a\'51\'82\'aa\'90\'b6\'82\'b8\'82\'e9\'89\'c2\'94\'5c\'90\'ab\'82\'c9\'82\'c2\'82\'a2\'82\'c4\'94\'de\'82\'e7\'82\'aa\'92\'89\'8d\'90\'82\'b3\'82\'ea\'82\'c4\'82\'a2\'82\'bd\'82\'c6\'82\'b5\'82\'c4\'82\'e0\'93\'af\'97\'6c\'82\'c5\ \'82\'a0\'82\'e9\'81\'42\ \ \f0 \f1 \'8f\'f0\'8c\'8f\'82\'c6\'90\'a7\'96\'f1\'8f\'49\'82\'ed\'82\'e8\ \ \ \page \ \f0 \f1 \'88\'c8\'8f\'e3\'82\'cc\'8f\'f0\'8d\'80\'82\'f0\'82\'a0\'82\'c8\'82\'bd\'82\'cc\'90\'56\'82\'b5\'82\'a2\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'82\'c9\'93\'4b\'97\'70\'82\'b7\'82\'e9\'95\'fb\'96\'40\ \ \'82\'a0\'82\'c8\'82\'bd\'82\'aa\'90\'56\'82\'b5\'82\'a2\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'82\'f0\'8a\'4a\'94\'ad\'82\'b5\'82\'bd\'82\'c6\'82\'b5\'82\'c4\'81\'41\'8c\'f6\'8f\'4f\'82\'c9\'82\'e6\'82\'c1\'82\'c4\'82\'bb\'82\'ea\'82\'aa\'97\'98\'97\'70\'82\'b3\'82\'ea\'82\'e9\ \'89\'c2\'94\'5c\'90\'ab\'82\'f0\'8d\'c5\'91\'e5\'82\'c9\'82\'b5\'82\'bd\'82\'a2\'82\'c8\'82\'e7\'81\'41\'82\'bb\'82\'cc\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'82\'f0\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'cc\'8f\'f0\'8d\'80\'82\'c9\'8f\'5d\'82\'c1\'82\'c4\ \'92\'4e\'82\'c5\'82\'e0\'8d\'c4\'94\'d0\'95\'7a\'82\'a0\'82\'e9\'82\'a2\'82\'cd\'95\'cf\'8d\'58\'82\'c5\'82\'ab\'82\'e9\'82\'e6\'82\'a4\'83\'74\'83\'8a\'81\'5b\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'82\'c9\'82\'b7\'82\'e9\'82\'cc\'82\'aa\'8d\'c5\'91\'50\'82\'c5\'82\'b7\'81\'42\ \ \'82\'bb\'82\'cc\'82\'bd\'82\'df\'82\'c9\'82\'cd\'81\'41\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'82\'c9\'88\'c8\'89\'ba\'82\'cc\'82\'e6\'82\'a4\'82\'c8\'95\'5c\'8e\'a6\'82\'f0\'93\'59\'95\'74\'82\'b5\'82\'c4\'82\'ad\'82\'be\'82\'b3\'82\'a2\'81\'42\'82\'bb\'82\'cc\'8f\'ea\'8d\'87\'81\'41\ \'95\'db\'8f\'d8\'82\'aa\'94\'72\'8f\'9c\'82\'b3\'82\'ea\'82\'c4\'82\'a2\'82\'e9\'82\'c6\'82\'a2\'82\'a4\'82\'b1\'82\'c6\'82\'f0\'8d\'c5\'82\'e0\'8c\'f8\'89\'ca\'93\'49\'82\'c9\'93\'60\'82\'a6\'82\'e9\'82\'bd\'82\'df\'82\'c9\'81\'41\'82\'bb\'82\'ea\'82\'bc\'82\'ea\'82\'cc\'83\'5c\'81\'5b\ \'83\'58\'83\'74\'83\'40\'83\'43\'83\'8b\'82\'cc\'96\'60\'93\'aa\'82\'c9\'95\'5c\'8e\'a6\'82\'f0\'93\'59\'95\'74\'82\'b7\'82\'ea\'82\'ce\'8d\'c5\'82\'e0\'88\'c0\'91\'53\'82\'c5\'82\'b7\'81\'42\'8f\'ad\'82\'c8\'82\'ad\'82\'c6\'82\'e0\'81\'41\'81\'75\'92\'98\'8d\'ec\'8c\'a0\'95\'5c\ \'8e\'a6\'81\'76\'82\'c6\'82\'a2\'82\'a4\'8d\'73\'82\'c6\'91\'53\'95\'b6\'82\'aa\'82\'a0\'82\'e9\'8f\'ea\'8f\'8a\'82\'d6\'82\'cc\'83\'7c\'83\'43\'83\'93\'83\'5e\'82\'be\'82\'af\'82\'cd\'8a\'65\'83\'74\'83\'40\'83\'43\'83\'8b\'82\'c9\'8a\'dc\'82\'df\'82\'c4\'92\'75\'82\'a2\'82\'c4\ \'82\'ad\'82\'be\'82\'b3\'82\'a2\'81\'42\ \ \f0 \ Copyright (C) \ \ This program is free software; you can redistribute it and/or modify\ it under the terms of the GNU General Public License as published by\ the Free Software Foundation; either version 2 of the License, or\ (at your option) any later version.\ \ This program is distributed in the hope that it will be useful,\ but WITHOUT ANY WARRANTY; without even the implied warranty of\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\ GNU General Public License for more details.\ \ You should have received a copy of the GNU General Public License\ along with this program; if not, write to the Free Software\ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\ \ ( \f1 \'96\'f3 \f0 :\ \ < \f1 \'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'82\'cc\'96\'bc\'91\'4f\'82\'c6\'81\'41\'82\'bb\'82\'ea\'82\'aa\'89\'bd\'82\'f0\'82\'b7\'82\'e9\'82\'a9\'82\'c9\'82\'c2\'82\'a2\'82\'c4\'82\'cc\'8a\'c8\'92\'50\'82\'c8\'90\'e0\'96\'be\'81\'42 \f0 >\ Copyright (C) < \f1 \'90\'bc\'97\'ef\'94\'4e \f0 > < \f1 \'8d\'ec\'8e\'d2\'82\'cc\'96\'bc\'91\'4f \f0 >\ \ \f1 \'82\'b1\'82\'cc\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'82\'cd\'83\'74\'83\'8a\'81\'5b\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'82\'c5\'82\'b7\'81\'42\'82\'a0\'82\'c8\'82\'bd\'82\'cd\'82\'b1\'82\'ea\'82\'f0\'81\'41\'83\'74\'83\'8a\'81\'5b\'83\'5c\'83\'74\ \f0 \f1 \'83\'67\'83\'45\'83\'46\'83\'41\'8d\'e0\'92\'63\'82\'c9\'82\'e6\'82\'c1\'82\'c4\'94\'ad\'8d\'73\'82\'b3\'82\'ea\'82\'bd \f0 GNU \f1 \'88\'ea\'94\'ca\'8c\'f6\'8f\'4f\'97\'98\'97\'70\'8b\'96\'91\'f8\'8c\'5f\'96\'f1\'8f\'91 \f0 ( \f1 \'83\'6f\'81\'5b\'83\'57\'83\'87\ \f0 \f1 \'83\'93 \f0 2 \f1 \'82\'a9\'81\'41\'8a\'f3\'96\'5d\'82\'c9\'82\'e6\'82\'c1\'82\'c4\'82\'cd\'82\'bb\'82\'ea\'88\'c8\'8d\'7e\'82\'cc\'83\'6f\'81\'5b\'83\'57\'83\'87\'83\'93\'82\'cc\'82\'a4\'82\'bf\'82\'c7\'82\'ea\'82\'a9 \f0 ) \f1 \'82\'cc\'92\'e8\'82\'df\'82\'e9\'8f\'f0\'8c\'8f\ \f0 \f1 \'82\'cc\'89\'ba\'82\'c5\'8d\'c4\'94\'d0\'95\'7a\'82\'dc\'82\'bd\'82\'cd\'89\'fc\'95\'cf\'82\'b7\'82\'e9\'82\'b1\'82\'c6\'82\'aa\'82\'c5\'82\'ab\'82\'dc\'82\'b7\'81\'42\ \ \f0 \f1 \'82\'b1\'82\'cc\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'82\'cd\'97\'4c\'97\'70\'82\'c5\'82\'a0\'82\'e9\'82\'b1\'82\'c6\'82\'f0\'8a\'e8\'82\'c1\'82\'c4\'94\'d0\'95\'7a\'82\'b3\'82\'ea\'82\'dc\'82\'b7\'82\'aa\'81\'41 \f0 * \f1 \'91\'53\'82\'ad\'82\'cc\'96\'b3\'95\'db\ \f0 \f1 \'8f\'d8 \f0 * \f1 \'82\'c5\'82\'b7\'81\'42\'8f\'a4\'8b\'c6\'89\'c2\'94\'5c\'90\'ab\'82\'cc\'95\'db\'8f\'d8\'82\'e2\'93\'c1\'92\'e8\'82\'cc\'96\'da\'93\'49\'82\'d6\'82\'cc\'93\'4b\'8d\'87\'90\'ab\'82\'cd\'81\'41\'8c\'be\'8a\'4f\'82\'c9\'8e\'a6\'82\'b3\'82\'ea\'82\'bd\ \f0 \f1 \'82\'e0\'82\'cc\'82\'e0\'8a\'dc\'82\'df\'91\'53\'82\'ad\'91\'b6\'8d\'dd\'82\'b5\'82\'dc\'82\'b9\'82\'f1\'81\'42\'8f\'da\'82\'b5\'82\'ad\'82\'cd \f0 GNU \f1 \'88\'ea\'94\'ca\'8c\'f6\'8f\'4f\'97\'98\'97\'70\'8b\'96\'91\'f8\'8c\'5f\'96\'f1\'8f\'91\'82\'f0\'82\'b2\ \f0 \f1 \'97\'97\'82\'ad\'82\'be\'82\'b3\'82\'a2\'81\'42\ \ \f0 \f1 \'82\'a0\'82\'c8\'82\'bd\'82\'cd\'82\'b1\'82\'cc\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'82\'c6\'8b\'a4\'82\'c9\'81\'41 \f0 GNU \f1 \'88\'ea\'94\'ca\'8c\'f6\'8f\'4f\'97\'98\'97\'70\'8b\'96\'91\'f8\'8c\'5f\'96\'f1\'8f\'91\'82\'cc\'95\'a1\'90\'bb\'95\'a8\'82\'f0\ \f0 \f1 \'88\'ea\'95\'94\'8e\'f3\'82\'af\'8e\'e6\'82\'c1\'82\'bd\'82\'cd\'82\'b8\'82\'c5\'82\'b7\'81\'42\'82\'e0\'82\'b5\'8e\'f3\'82\'af\'8e\'e6\'82\'c1\'82\'c4\'82\'a2\'82\'c8\'82\'af\'82\'ea\'82\'ce\'81\'41\'83\'74\'83\'8a\'81\'5b\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\ \f0 \f1 \'83\'41\'8d\'e0\'92\'63\'82\'dc\'82\'c5\'90\'bf\'8b\'81\'82\'b5\'82\'c4\'82\'ad\'82\'be\'82\'b3\'82\'a2 \f0 ( \f1 \'88\'b6\'90\'e6\'82\'cd \f0 the Free Software Foundation,\ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA) \f1 \'81\'42\ \ \f0 )\ \ \f1 \'93\'64\'8e\'71\'82\'c8\'82\'a2\'82\'b5\'8e\'86\'82\'cc\'83\'81\'81\'5b\'83\'8b\'82\'c5\'82\'a0\'82\'c8\'82\'bd\'82\'c9\'96\'e2\'82\'a2\'8d\'87\'82\'ed\'82\'b9\'82\'e9\'95\'fb\'96\'40\'82\'c9\'82\'c2\'82\'a2\'82\'c4\'82\'cc\'8f\'ee\'95\'f1\'82\'e0\'8f\'91\'82\'ab\'89\'c1\'82\'a6\ \'82\'dc\'82\'b5\'82\'e5\'82\'a4\'81\'42\ \ \'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'82\'aa\'91\'ce\'98\'62\'93\'49\'82\'c8\'82\'e0\'82\'cc\'82\'c8\'82\'e7\'82\'ce\'81\'41\'91\'ce\'98\'62\'83\'82\'81\'5b\'83\'68\'82\'c5\'8b\'4e\'93\'ae\'82\'b5\'82\'bd\'8d\'db\'82\'c9\'8f\'6f\'97\'cd\'82\'c6\'82\'b5\'82\'c4\'88\'c8\'89\'ba\ \'82\'cc\'82\'e6\'82\'a4\'82\'c8\'92\'5a\'82\'a2\'8d\'90\'92\'6d\'82\'aa\'95\'5c\'8e\'a6\'82\'b3\'82\'ea\'82\'e9\'82\'e6\'82\'a4\'82\'c9\'82\'b5\'82\'c4\'82\'ad\'82\'be\'82\'b3\'82\'a2 \f0 :\ \ Gnomovision version 69, Copyright (C) year name of author\ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\ This is free software, and you are welcome to redistribute it\ under certain conditions; type `show c' for details.\ \ ( \f1 \'96\'f3 \f0 :\ \ Gnomovision \f1 \'83\'6f\'81\'5b\'83\'57\'83\'87\'83\'93 \f0 69, Copyright (C) \f1 \'94\'4e \f0 \f1 \'8d\'ec\'8e\'d2\'82\'cc\'96\'bc\'91\'4f\ \f0 Gnomovision \f1 \'82\'cd \f0 * \f1 \'91\'53\'82\'ad\'82\'cc\'96\'b3\'95\'db\'8f\'d8 \f0 * \f1 \'82\'c5\'92\'f1\'8b\'9f\'82\'b3\'82\'ea\'82\'dc\'82\'b7\'81\'42\'8f\'da\'82\'b5\'82\'ad\'82\'cd\'81\'75 \f0 show w \f1 \'81\'76\ \f0 \f1 \'82\'c6\'83\'5e\'83\'43\'83\'76\'82\'b5\'82\'c4\'89\'ba\'82\'b3\'82\'a2\'81\'42\'82\'b1\'82\'ea\'82\'cd\'83\'74\'83\'8a\'81\'5b\'83\'5c\'83\'74\'83\'67\'83\'45\'83\'46\'83\'41\'82\'c5\'82\'a0\'82\'e8\'81\'41\'82\'a0\'82\'e9\'8f\'f0\'8c\'8f\'82\'cc\'89\'ba\'82\'c5\ \f0 \f1 \'8d\'c4\'94\'d0\'95\'7a\'82\'b7\'82\'e9\'82\'b1\'82\'c6\'82\'aa\'8f\'a7\'97\'e3\'82\'b3\'82\'ea\'82\'c4\'82\'a2\'82\'dc\'82\'b7\'81\'42\'8f\'da\'82\'b5\'82\'ad\'82\'cd\'81\'75 \f0 show c \f1 \'81\'76\'82\'c6\'83\'5e\'83\'43\'83\'76\'82\'b5\'82\'c4\'89\'ba\ \f0 \f1 \'82\'b3\'82\'a2\'81\'42\ \ \f0 )\ \ \f1 \'82\'b1\'82\'b1\'82\'c5\'81\'41\'89\'bc\'91\'7a\'93\'49\'82\'c8\'83\'52\'83\'7d\'83\'93\'83\'68\'81\'75 \f0 show w \f1 \'81\'76\'82\'c6\'81\'75 \f0 show c \f1 \'81\'76\'82\'cd\'88\'ea\'94\'ca\'8c\'f6\'8f\'4f\'97\'98\'97\'70\'8b\'96\'91\'f8\'8c\'5f\'96\'f1\'8f\'91\ \'82\'cc\'93\'4b\'90\'d8\'82\'c8\'95\'94\'95\'aa\'82\'f0\'95\'5c\'8e\'a6\'82\'b7\'82\'e9\'82\'e6\'82\'a4\'82\'c9\'82\'c8\'82\'c1\'82\'c4\'82\'a2\'82\'c8\'82\'af\'82\'ea\'82\'ce\'82\'c8\'82\'e8\'82\'dc\'82\'b9\'82\'f1\'81\'42\'82\'e0\'82\'bf\'82\'eb\'82\'f1\'81\'41\'82\'a0\'82\'c8\ \'82\'bd\'82\'aa\'8e\'67\'82\'a4\'83\'52\'83\'7d\'83\'93\'83\'68\'82\'f0\'81\'75 \f0 show w \f1 \'81\'76\'82\'e2\'81\'75 \f0 show c \f1 \'81\'76\'82\'c6\'8c\'c4\'82\'d4\'95\'4b\'91\'52\'90\'ab\'82\'cd\'82\'a0\'82\'e8\'82\'dc\'82\'b9\'82\'f1\'82\'cc\'82\'c5\'81\'41\ \'82\'a0\'82\'c8\'82\'bd\'82\'cc\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'82\'c9\'8d\'87\'82\'ed\'82\'b9\'82\'c4\'83\'7d\'83\'45\'83\'58\'82\'cc\'83\'4e\'83\'8a\'83\'62\'83\'4e\'82\'e2\'83\'81\'83\'6a\'83\'85\'81\'5b\'82\'cc\'83\'41\'83\'43\'83\'65\'83\'80\'82\'c9\'82\'b5\'82\'c4\ \'82\'e0\'8c\'8b\'8d\'5c\'82\'c5\'82\'b7\'81\'42\ \ \'82\'dc\'82\'bd\'82\'a0\'82\'c8\'82\'bd\'82\'cd\'81\'41\'95\'4b\'97\'76\'82\'c8\'82\'e7\'82\'ce \f0 ( \f1 \'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'7d\'81\'5b\'82\'c6\'82\'b5\'82\'c4\'93\'ad\'82\'a2\'82\'c4\'82\'a2\'82\'bd\'82\'e7 \f0 ) \f1 \'82\'a0\'82\'c8\'82\'bd\'82\'cc\'8c\'d9\'97\'70\'8e\'e5\'81\'41\ \'82\'a0\'82\'e9\'82\'a2\'82\'cd\'8f\'ea\'8d\'87\'82\'c9\'82\'e6\'82\'c1\'82\'c4\'82\'cd\'8a\'77\'8d\'5a\'82\'a9\'82\'e7\'81\'41\'82\'bb\'82\'cc\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'82\'c9\'8a\'d6\'82\'b7\'82\'e9\'81\'75\'92\'98\'8d\'ec\'8c\'a0\'95\'fa\'8a\'fc\'90\'ba\'96\'be\ \f0 (copyright disclaimer) \f1 \'81\'76\'82\'c9\'8f\'90\'96\'bc\'82\'b5\'82\'c4\'82\'e0\'82\'e7\'82\'a4\'82\'d7\'82\'ab\'82\'c5\'82\'b7\'81\'42\'88\'c8\'89\'ba\'82\'cd\'97\'e1\'82\'c5\'82\'b7\'82\'cc\'82\'c5\'81\'41\'96\'bc\ \'91\'4f\'82\'f0\'95\'cf\'82\'a6\'82\'c4\'82\'ad\'82\'be\'82\'b3\'82\'a2 \f0 :\ \ Yoyodyne, Inc., hereby disclaims all copyright interest in the program\ `Gnomovision' (which makes passes at compilers) written by James Hacker.\ \ , 1 April 1989\ Ty Coon, President of Vice\ \ ( \f1 \'96\'f3 \f0 :\ \ Yoyodyne \f1 \'8e\'d0\'82\'cd\'82\'b1\'82\'b1\'82\'c9\'81\'41 \f0 James Hacker \f1 \'82\'c9\'82\'e6\'82\'c1\'82\'c4\'8f\'91\'82\'a9\'82\'ea\'82\'bd\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\ \f0 \f1 \'81\'75 \f0 Gnomovision \f1 \'81\'76 \f0 ( \f1 \'83\'52\'83\'93\'83\'70\'83\'43\'83\'89\'82\'d6\'92\'ca\'82\'b7\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80 \f0 ) \f1 \'82\'c9\'8a\'d6\'82\'b7\'82\'e9\'88\'ea\'90\'d8\'82\'cc\'92\'98\'8d\'ec\'8c\'a0\'82\'cc\'97\'98\ \f0 \f1 \'89\'76\'82\'f0\'95\'fa\'8a\'fc\'82\'b5\'82\'dc\'82\'b7\'81\'42\ \ \f0 \f1 \'81\'41 \f0 1989 \f1 \'94\'4e \f0 4 \f1 \'8c\'8e \f0 1 \f1 \'93\'fa\ \f0 Ty Coon \f1 \'81\'41\'95\'9b\'8e\'d0\'92\'b7\ \ \f0 )\ \ \f1 \'82\'b1\'82\'cc\'88\'ea\'94\'ca\'8c\'f6\'8f\'4f\'97\'98\'97\'70\'8b\'96\'91\'f8\'8c\'5f\'96\'f1\'8f\'91\'82\'c5\'82\'cd\'81\'41\'82\'a0\'82\'c8\'82\'bd\'82\'cc\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'82\'f0\'93\'c6\'90\'e8\'93\'49\'82\'c8\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\ \'82\'c9\'93\'9d\'8d\'87\'82\'b7\'82\'e9\'82\'b1\'82\'c6\'82\'f0\'94\'46\'82\'df\'82\'c4\'82\'a2\'82\'dc\'82\'b9\'82\'f1\'81\'42\'82\'a0\'82\'c8\'82\'bd\'82\'cc\'83\'76\'83\'8d\'83\'4f\'83\'89\'83\'80\'82\'aa\'83\'54\'83\'75\'83\'8b\'81\'5b\'83\'60\'83\'93\'83\'89\'83\'43\'83\'75\ \'83\'89\'83\'8a\'82\'c8\'82\'e7\'82\'ce\'81\'41\'93\'c6\'90\'e8\'93\'49\'82\'c8\'83\'41\'83\'76\'83\'8a\'83\'50\'81\'5b\'83\'56\'83\'87\'83\'93\'82\'c6\'82\'a0\'82\'c8\'82\'bd\'82\'cc\'83\'89\'83\'43\'83\'75\'83\'89\'83\'8a\'82\'f0\'83\'8a\'83\'93\'83\'4e\'82\'b7\'82\'e9\'82\'b1\ \'82\'c6\'82\'f0\'8b\'96\'89\'c2\'82\'b5\'82\'bd\'82\'d9\'82\'a4\'82\'aa\'82\'e6\'82\'e8\'95\'d6\'97\'98\'82\'c5\'82\'a0\'82\'e9\'82\'c6\'8d\'6c\'82\'a6\'82\'e9\'82\'a9\'82\'e0\'82\'b5\'82\'ea\'82\'dc\'82\'b9\'82\'f1\'81\'42\'82\'e0\'82\'b5\'82\'b1\'82\'ea\'82\'aa\'82\'a0\'82\'c8\ \'82\'bd\'82\'cc\'96\'5d\'82\'de\'82\'b1\'82\'c6\'82\'c8\'82\'e7\'82\'ce\'81\'41\'82\'b1\'82\'cc\'8c\'5f\'96\'f1\'8f\'91\'82\'cc\'91\'e3\'82\'ed\'82\'e8\'82\'c9 \f0 GNU \f1 \'83\'89\'83\'43\'83\'75\'83\'89\'83\'8a\'88\'ea\'94\'ca\'8c\'f6\'8f\'4f\'97\'98\'97\'70\'8b\'96\'91\'f8\ \'8c\'5f\'96\'f1\'8f\'91\'82\'f0\'93\'4b\'97\'70\'82\'b5\'82\'c4\'82\'ad\'82\'be\'82\'b3\'82\'a2\'81\'42\ } ================================================ FILE: ja.lproj/Localizable.strings ================================================ { "Host Name" = "ホスト名"; "Host Names" = "ホスト名"; "IP Address" = "IP アドレス"; "IP Addresses" = "IP アドレス"; "Screen Resolution changed - Server Reinitialized" = "画面の解像度が変更 - サーバを再初期化しました。"; "Server Running" = "サーバは動作中。"; "The server is not running." = "サーバは動作していません。"; "Start Server" = "サーバを起動"; "Restart Server" = "サーバを再起動"; "The server is stopped." = "サーバは停止しています。"; "Probably because the OSXvnc server is already running as a Startup Item." = "Vine サーバが既に起動項目として起動している可能性があります。"; "Probably because another VNC is already using this port." = "このポートは既にほかの VNC によって使用されている可能性があります。"; "The server has stopped running. See Log (%d)\n" = "サーバが停止しました。詳細はログ (%d) を参照してください。\n"; "The server has stopped running." = "サーバが停止しました。"; "Need a valid Port or Display Number" = "有効なポートまたはディスプレイ名が必要です。"; "Problem - Unable to store password to %@" = "パスワードを '%@' へ保存できません。"; "Option Change Requires a Restart" = "設定変更には再起動が必要です。"; //"Error: No Authorization" = "エラー:認証が必要です。"; //"Error: Unable To Setup Password File" = "エラー:パスワードファイルを設定できません。"; //"Error: Unable To Write out Temporary Script File" = "エラー:一時スクリプトファイルを書き込めません。"; "Startup Item Configured (Started)" = "起動項目として設定されました。(開始)"; "Startup Item Disabled (Stopped)" = "起動項目を無効にしました。(停止)"; //"Error: Unabled to remove startup item" = "エラー:起動項目を削除できない"; "Please specify a Connect Host to establish a connection" = "「接続ホスト」を指定して下さい。"; "Connection invitation sent to Connect Host" = "接続依頼を「接続ホスト」へ送信しました。"; } ================================================ FILE: main.m ================================================ #import int main(int argc, const char *argv[]) { return NSApplicationMain(argc, argv); }