├── .appveyor.yml ├── .github └── workflows │ └── codacy-analysis.yml ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── SphereSvr.vcxproj ├── SphereSvr.vcxproj.filters ├── changelog.txt ├── makefile └── src ├── common ├── CArray.cpp ├── CArray.h ├── CAssoc.cpp ├── CAssoc.h ├── CCSVFile.cpp ├── CCSVFile.h ├── CCacheableScriptFile.cpp ├── CCacheableScriptFile.h ├── CDataBase.cpp ├── CDataBase.h ├── CEncrypt.cpp ├── CEncrypt.h ├── CException.cpp ├── CException.h ├── CExpression.cpp ├── CExpression.h ├── CFile.cpp ├── CFile.h ├── CFileList.cpp ├── CFileList.h ├── CGrayData.cpp ├── CGrayInst.cpp ├── CGrayInst.h ├── CGrayMap.cpp ├── CGrayMap.h ├── CListDefMap.cpp ├── CListDefMap.h ├── CMD5.cpp ├── CMD5.h ├── CMemBlock.h ├── CQueue.cpp ├── CQueue.h ├── CRect.cpp ├── CRect.h ├── CRegion.cpp ├── CRegion.h ├── CResourceBase.cpp ├── CResourceBase.h ├── CScript.cpp ├── CScript.h ├── CScriptObj.cpp ├── CScriptObj.h ├── CSectorTemplate.cpp ├── CSectorTemplate.h ├── CSocket.cpp ├── CSocket.h ├── CString.cpp ├── CString.h ├── CTime.cpp ├── CTime.h ├── CVarDefMap.cpp ├── CVarDefMap.h ├── CVarFloat.cpp ├── CVarFloat.h ├── CWindow.cpp ├── CWindow.h ├── graycom.cpp ├── graycom.h ├── graymul.h ├── grayproto.h ├── grayver.h ├── libev │ ├── Changes │ ├── README │ ├── ev++.h │ ├── ev.c │ ├── ev.h │ ├── ev_config.h │ ├── ev_epoll.c │ ├── ev_iouring.c │ ├── ev_kqueue.c │ ├── ev_linuxaio.c │ ├── ev_poll.c │ ├── ev_port.c │ ├── ev_select.c │ ├── ev_vars.h │ ├── ev_win32.c │ ├── ev_wrap.h │ ├── event.c │ ├── event.h │ ├── wrapper_ev.c │ └── wrapper_ev.h ├── mysql │ ├── COPYING │ ├── README │ ├── include │ │ ├── big_endian.h │ │ ├── binary_log_types.h │ │ ├── byte_order_generic.h │ │ ├── byte_order_generic_x86.h │ │ ├── decimal.h │ │ ├── errmsg.h │ │ ├── keycache.h │ │ ├── little_endian.h │ │ ├── m_ctype.h │ │ ├── m_string.h │ │ ├── my_alloc.h │ │ ├── my_byteorder.h │ │ ├── my_command.h │ │ ├── my_compiler.h │ │ ├── my_config.h │ │ ├── my_dbug.h │ │ ├── my_dir.h │ │ ├── my_getopt.h │ │ ├── my_global.h │ │ ├── my_list.h │ │ ├── my_sys.h │ │ ├── my_thread.h │ │ ├── my_thread_local.h │ │ ├── my_xml.h │ │ ├── mysql.h │ │ ├── mysql │ │ │ ├── client_authentication.h │ │ │ ├── client_plugin.h │ │ │ ├── client_plugin.h.pp │ │ │ ├── get_password.h │ │ │ ├── mysql_lex_string.h │ │ │ ├── plugin_auth_common.h │ │ │ ├── plugin_trace.h │ │ │ ├── psi │ │ │ │ ├── mysql_file.h │ │ │ │ ├── mysql_idle.h │ │ │ │ ├── mysql_mdl.h │ │ │ │ ├── mysql_memory.h │ │ │ │ ├── mysql_ps.h │ │ │ │ ├── mysql_socket.h │ │ │ │ ├── mysql_sp.h │ │ │ │ ├── mysql_stage.h │ │ │ │ ├── mysql_statement.h │ │ │ │ ├── mysql_table.h │ │ │ │ ├── mysql_thread.h │ │ │ │ ├── mysql_transaction.h │ │ │ │ ├── psi.h │ │ │ │ ├── psi_base.h │ │ │ │ └── psi_memory.h │ │ │ ├── service_my_snprintf.h │ │ │ └── service_mysql_alloc.h │ │ ├── mysql_com.h │ │ ├── mysql_com_server.h │ │ ├── mysql_embed.h │ │ ├── mysql_time.h │ │ ├── mysql_version.h │ │ ├── mysqld_ername.h │ │ ├── mysqld_error.h │ │ ├── sql_common.h │ │ ├── sql_state.h │ │ ├── sslopt-case.h │ │ ├── sslopt-longopts.h │ │ ├── sslopt-vars.h │ │ ├── thr_cond.h │ │ ├── thr_mutex.h │ │ ├── thr_rwlock.h │ │ └── typelib.h │ └── lib │ │ ├── x64 │ │ ├── libmysql.dll │ │ └── libmysql.lib │ │ └── x86 │ │ ├── libmysql.dll │ │ └── libmysql.lib ├── os_common.h ├── os_unix.h ├── os_windows.h ├── sqlite │ ├── SQLite.cpp │ ├── SQLite.h │ ├── sqlite3.c │ └── sqlite3.h ├── twofish │ ├── aes.h │ ├── debug.h │ ├── platform.h │ ├── table.h │ └── twofish2.cpp ├── version │ ├── GitRevision.h │ └── GitRevision.h.in └── zlib │ ├── ChangeLog │ ├── FAQ │ ├── INDEX │ ├── README │ ├── adler32.c │ ├── compress.c │ ├── crc32.c │ ├── crc32.h │ ├── deflate.c │ ├── deflate.h │ ├── gzclose.c │ ├── gzguts.h │ ├── gzlib.c │ ├── gzread.c │ ├── gzwrite.c │ ├── infback.c │ ├── inffast.c │ ├── inffast.h │ ├── inffixed.h │ ├── inflate.c │ ├── inflate.h │ ├── inftrees.c │ ├── inftrees.h │ ├── trees.c │ ├── trees.h │ ├── uncompr.c │ ├── zconf.h │ ├── zlib.h │ ├── zutil.c │ └── zutil.h ├── graysvr ├── CAccount.cpp ├── CAccount.h ├── CBase.cpp ├── CBase.h ├── CChar.cpp ├── CChar.h ├── CCharAct.cpp ├── CCharBase.cpp ├── CCharBase.h ├── CCharFight.cpp ├── CCharNPC.cpp ├── CCharNPCAct.cpp ├── CCharNPCPet.cpp ├── CCharNPCStatus.cpp ├── CCharSkill.cpp ├── CCharSpell.cpp ├── CCharStatus.cpp ├── CCharUse.cpp ├── CChat.cpp ├── CChat.h ├── CClient.cpp ├── CClient.h ├── CClientDialog.cpp ├── CClientEvent.cpp ├── CClientLog.cpp ├── CClientMsg.cpp ├── CClientTarg.cpp ├── CClientUse.cpp ├── CContain.cpp ├── CGMPage.cpp ├── CGMPage.h ├── CItem.cpp ├── CItem.h ├── CItemBase.cpp ├── CItemBase.h ├── CItemMulti.cpp ├── CItemMulti.h ├── CItemMultiCustom.cpp ├── CItemMultiCustom.h ├── CItemShip.cpp ├── CItemShip.h ├── CItemSpawn.cpp ├── CItemStone.cpp ├── CItemStone.h ├── CItemVend.cpp ├── CLog.cpp ├── CLog.h ├── CNTWindow.cpp ├── CNTWindow.h ├── CObjBase.cpp ├── CObjBase.h ├── CParty.cpp ├── CParty.h ├── CPathFinder.cpp ├── CPathFinder.h ├── CPingServer.cpp ├── CPingServer.h ├── CResource.cpp ├── CResource.h ├── CResourceCalc.cpp ├── CResourceDef.cpp ├── CSector.cpp ├── CSector.h ├── CServRef.cpp ├── CServRef.h ├── CServer.cpp ├── CServer.h ├── CUnixTerminal.cpp ├── CUnixTerminal.h ├── CWebPage.cpp ├── CWebPage.h ├── CWorld.cpp ├── CWorld.h ├── CWorldImport.cpp ├── CWorldMap.cpp ├── SphereSvr.rc ├── graysvr.cpp ├── graysvr.h ├── resource.h ├── spheresvr.ico └── spheresvrold.ico ├── network ├── network.cpp ├── network.h ├── packet.cpp ├── packet.h ├── receive.cpp ├── receive.h ├── send.cpp └── send.h ├── sphere.ini ├── sphere ├── ProfileData.cpp ├── ProfileData.h ├── asyncdb.cpp ├── asyncdb.h ├── containers.h ├── linuxev.cpp ├── linuxev.h ├── mutex.cpp ├── mutex.h ├── strings.cpp ├── strings.h ├── threads.cpp └── threads.h ├── sphereCrypt.ini └── tables ├── CBaseBaseDef_props.tbl ├── CCharBase_props.tbl ├── CCharNpc_props.tbl ├── CCharPlayer_functions.tbl ├── CCharPlayer_props.tbl ├── CChar_functions.tbl ├── CChar_props.tbl ├── CClient_functions.tbl ├── CClient_props.tbl ├── CFileObjContainer_functions.tbl ├── CFileObjContainer_props.tbl ├── CFile_functions.tbl ├── CFile_props.tbl ├── CItemBase_props.tbl ├── CItemStone_functions.tbl ├── CItemStone_props.tbl ├── CItem_functions.tbl ├── CItem_props.tbl ├── CObjBase_functions.tbl ├── CObjBase_props.tbl ├── CParty_functions.tbl ├── CParty_props.tbl ├── CScriptObj_functions.tbl ├── CSector_functions.tbl ├── CStoneMember_functions.tbl ├── CStoneMember_props.tbl ├── classnames.tbl ├── defmessages.tbl └── triggers.tbl /.appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 0.56.4.{build} 2 | configuration: Nightly 3 | pull_requests: 4 | do_not_increment_build_number: true 5 | before_build: 6 | - ps: if (-not (Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER)) {Update-AppveyorBuild -Version ("0.56.4.{0}" -f ((git rev-list --count HEAD) - 2406))} 7 | image: 8 | - Visual Studio 2015 9 | - Ubuntu 10 | platform: 11 | - x86 12 | - x64 13 | 14 | for: 15 | - 16 | matrix: 17 | only: 18 | - image: Visual Studio 2015 19 | platform: x86 20 | build: 21 | project: SphereSvr.vcxproj 22 | verbosity: minimal 23 | after_build: 24 | - cmd: mkdir accounts logs save scripts 25 | - cmd: 7z a SphereSvr-Win32.zip accounts\ logs\ save\ scripts\ %APPVEYOR_BUILD_FOLDER%\%CONFIGURATION%\SphereSvr.exe %APPVEYOR_BUILD_FOLDER%\src\sphere.ini %APPVEYOR_BUILD_FOLDER%\src\sphereCrypt.ini %APPVEYOR_BUILD_FOLDER%\src\common\mysql\lib\%PLATFORM%\libmysql.dll 26 | artifacts: 27 | - path: SphereSvr-Win32.zip 28 | name: SphereSvr 29 | - 30 | matrix: 31 | only: 32 | - image: Visual Studio 2015 33 | platform: x64 34 | build: 35 | project: SphereSvr.vcxproj 36 | verbosity: minimal 37 | after_build: 38 | - cmd: mkdir accounts logs save scripts 39 | - cmd: 7z a SphereSvr-Win64.zip accounts\ logs\ save\ scripts\ %APPVEYOR_BUILD_FOLDER%\%PLATFORM%\%CONFIGURATION%\SphereSvr.exe %APPVEYOR_BUILD_FOLDER%\src\sphere.ini %APPVEYOR_BUILD_FOLDER%\src\sphereCrypt.ini %APPVEYOR_BUILD_FOLDER%\src\common\mysql\lib\%PLATFORM%\libmysql.dll 40 | artifacts: 41 | - path: SphereSvr-Win64.zip 42 | name: SphereSvr 43 | - 44 | matrix: 45 | only: 46 | - image: Ubuntu 47 | platform: x86 48 | install: 49 | - sh: sudo apt-get -qq update 50 | - sh: sudo apt-get -qq remove gcc g++ > /dev/null 51 | - sh: sudo apt-get -qq install gcc-multilib g++-multilib libmysqlclient-dev:i386 > /dev/null 52 | before_build: 53 | - sh: lsb_release -d 54 | - sh: gcc --version 55 | build_script: 56 | - sh: make NIGHTLY=1 x86=1 57 | after_build: 58 | - sh: mkdir accounts logs save scripts 59 | - sh: tar -czvf SphereSvr-Linux32.tar.gz accounts/ logs/ save/ scripts/ spheresvr -C src/ sphere.ini sphereCrypt.ini 60 | artifacts: 61 | - path: SphereSvr-Linux32.tar.gz 62 | name: SphereSvr 63 | before_deploy: 64 | - sh: echo "set ssl:verify-certificate no" >> ~/.lftprc 65 | - 66 | matrix: 67 | only: 68 | - image: Ubuntu 69 | platform: x64 70 | install: 71 | - sh: sudo apt-get -qq update 72 | - sh: sudo apt-get -qq remove gcc g++ > /dev/null 73 | - sh: sudo apt-get -qq install gcc g++ libmysqlclient-dev > /dev/null 74 | before_build: 75 | - sh: lsb_release -d 76 | - sh: gcc --version 77 | build_script: 78 | - sh: make NIGHTLY=1 79 | after_build: 80 | - sh: mkdir accounts logs save scripts 81 | - sh: tar -czvf SphereSvr-Linux64.tar.gz accounts/ logs/ save/ scripts/ spheresvr -C src/ sphere.ini sphereCrypt.ini 82 | artifacts: 83 | - path: SphereSvr-Linux64.tar.gz 84 | name: SphereSvr 85 | before_deploy: 86 | - sh: echo "set ssl:verify-certificate no" >> ~/.lftprc 87 | 88 | deploy: 89 | provider: FTP 90 | protocol: ftp 91 | host: 92 | secure: LjYrCGlwCyEGfBJ2fVvCF9pAlSlsob0eZaUnKrFWJTs= 93 | username: 94 | secure: UAZaqnbj2s8C/ObEXIg6xA== 95 | password: 96 | secure: 0tC8NEgCp8IBChlZ0ssFdzgwkD+iX3FykjKaRQe+03k= -------------------------------------------------------------------------------- /.github/workflows/codacy-analysis.yml: -------------------------------------------------------------------------------- 1 | # This workflow uses actions that are not certified by GitHub. 2 | # They are provided by a third-party and are governed by 3 | # separate terms of service, privacy policy, and support 4 | # documentation. 5 | 6 | # This workflow checks out code, performs a Codacy security scan 7 | # and integrates the results with the 8 | # GitHub Advanced Security code scanning feature. For more information on 9 | # the Codacy security scan action usage and parameters, see 10 | # https://github.com/codacy/codacy-analysis-cli-action. 11 | # For more information on Codacy Analysis CLI in general, see 12 | # https://github.com/codacy/codacy-analysis-cli. 13 | 14 | name: Codacy Security Scan 15 | 16 | on: 17 | push: 18 | branches: [ "master" ] 19 | pull_request: 20 | # The branches below must be a subset of the branches above 21 | branches: [ "master" ] 22 | 23 | permissions: 24 | contents: read 25 | 26 | jobs: 27 | codacy-security-scan: 28 | permissions: 29 | contents: read # for actions/checkout to fetch code 30 | security-events: write # for github/codeql-action/upload-sarif to upload SARIF results 31 | actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status 32 | name: Codacy Security Scan 33 | runs-on: ubuntu-latest 34 | steps: 35 | # Checkout the repository to the GitHub Actions runner 36 | - name: Checkout code 37 | uses: actions/checkout@v3 38 | 39 | # Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis 40 | - name: Run Codacy Analysis CLI 41 | uses: codacy/codacy-analysis-cli-action@master 42 | with: 43 | # Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository 44 | # You can also omit the token and run the tools that support default configurations 45 | project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} 46 | verbose: true 47 | output: results.sarif 48 | format: sarif 49 | # Adjust severity of non-security issues 50 | gh-code-scanning-compat: true 51 | # Force 0 exit code to allow SARIF file generation 52 | # This will handover control about PR rejection to the GitHub side 53 | max-allowed-issues: 2147483647 54 | 55 | # Upload the SARIF file generated in the previous step 56 | - name: Upload SARIF results file 57 | uses: github/codeql-action/upload-sarif@v2 58 | with: 59 | sarif_file: results.sarif 60 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore all files, except those already included on git repository 2 | * 3 | 4 | # Ignore git versioning file 5 | /src/common/version/GitRevision.h -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp 2 | compiler: gcc 3 | env: 4 | - BUILD_CMD="make NIGHTLY=1" 5 | git: 6 | depth: false 7 | notifications: 8 | email: false 9 | addons: 10 | coverity_scan: 11 | project: 12 | name: "Sphereserver/Source" 13 | description: "Game server for Ultima Online" 14 | notification_email: null@null 15 | build_command: $BUILD_CMD 16 | branch_pattern: master 17 | script: 18 | - if [ $COVERITY_SCAN_BRANCH != 1 ]; then $BUILD_CMD; fi -------------------------------------------------------------------------------- /src/common/CArray.cpp: -------------------------------------------------------------------------------- 1 | #include "graycom.h" 2 | #include "CArray.h" 3 | 4 | /////////////////////////////////////////////////////////// 5 | // CGObListRec 6 | 7 | CGObListRec::CGObListRec() 8 | { 9 | m_pParent = NULL; 10 | m_pNext = NULL; 11 | m_pPrev = NULL; 12 | } 13 | 14 | CGObListRec::~CGObListRec() 15 | { 16 | RemoveSelf(); 17 | } 18 | 19 | /////////////////////////////////////////////////////////// 20 | // CGObList 21 | 22 | CGObList::CGObList() 23 | { 24 | m_pHead = NULL; 25 | m_pTail = NULL; 26 | m_iCount = 0; 27 | } 28 | 29 | CGObList::~CGObList() 30 | { 31 | DeleteAll(); 32 | } 33 | 34 | CGObListRec *CGObList::GetAt(size_t i) const 35 | { 36 | ADDTOCALLSTACK("CGObList::GetAt"); 37 | CGObListRec *pRec = GetHead(); 38 | while ( (i-- > 0) && pRec ) 39 | { 40 | pRec = pRec->GetNext(); 41 | } 42 | return pRec; 43 | } 44 | 45 | CGObListRec *CGObList::GetHead() const 46 | { 47 | return m_pHead; 48 | } 49 | 50 | CGObListRec *CGObList::GetTail() const 51 | { 52 | return m_pTail; 53 | } 54 | 55 | size_t CGObList::GetCount() const 56 | { 57 | return m_iCount; 58 | } 59 | 60 | bool CGObList::IsEmpty() const 61 | { 62 | return !GetCount(); 63 | } 64 | 65 | void CGObList::InsertAfter(CGObListRec *pNewRec, CGObListRec *pPrev) 66 | { 67 | ADDTOCALLSTACK("CGObList::InsertAfter"); 68 | // Insert after pPrev 69 | ASSERT(pNewRec); 70 | pNewRec->RemoveSelf(); // get out of previous list first 71 | ASSERT(pPrev != pNewRec); 72 | ASSERT(!pNewRec->GetParent()); 73 | 74 | pNewRec->m_pParent = this; 75 | 76 | CGObListRec *pNext; 77 | if ( pPrev ) 78 | { 79 | ASSERT(pPrev->GetParent() == this); 80 | pNext = pPrev->GetNext(); 81 | pPrev->m_pNext = pNewRec; 82 | } 83 | else 84 | { 85 | pNext = GetHead(); 86 | m_pHead = pNewRec; 87 | } 88 | 89 | pNewRec->m_pPrev = pPrev; 90 | 91 | if ( pNext ) 92 | { 93 | ASSERT(pNext->GetParent() == this); 94 | pNext->m_pPrev = pNewRec; 95 | } 96 | else 97 | m_pTail = pNewRec; 98 | 99 | pNewRec->m_pNext = pNext; 100 | ++m_iCount; 101 | } 102 | 103 | void CGObList::InsertHead(CGObListRec *pNewRec) 104 | { 105 | ADDTOCALLSTACK("CGObList::InsertHead"); 106 | InsertAfter(pNewRec, NULL); 107 | } 108 | 109 | void CGObList::InsertTail(CGObListRec *pNewRec) 110 | { 111 | ADDTOCALLSTACK("CGObList::InsertTail"); 112 | InsertAfter(pNewRec, GetTail()); 113 | } 114 | 115 | void CGObList::DeleteAll() 116 | { 117 | ADDTOCALLSTACK("CGObList::DeleteAll"); 118 | // Delete all entries 119 | for (;;) 120 | { 121 | CGObListRec *pRec = GetHead(); 122 | if ( !pRec ) 123 | break; 124 | 125 | ASSERT(pRec->GetParent() == this); 126 | delete pRec; 127 | } 128 | m_pHead = NULL; 129 | m_pTail = NULL; 130 | m_iCount = 0; 131 | } 132 | 133 | void CGObList::RemoveAtSpecial(CGObListRec *pObRec) 134 | { 135 | ADDTOCALLSTACK("CGObList::RemoveAtSpecial"); 136 | // Only called by CGObListRec::RemoveSelf() 137 | OnRemoveOb(pObRec); // call any appropriate virtuals 138 | } 139 | 140 | void CGObList::OnRemoveOb(CGObListRec *pObRec) 141 | { 142 | ADDTOCALLSTACK("CGObList::OnRemoveOb"); 143 | // Just remove from list (don't delete) 144 | if ( !pObRec ) 145 | return; 146 | 147 | ASSERT(pObRec->GetParent() == this); 148 | CGObListRec *pNext = pObRec->GetNext(); 149 | CGObListRec *pPrev = pObRec->GetPrev(); 150 | 151 | if ( pNext ) 152 | pNext->m_pPrev = pPrev; 153 | else 154 | m_pTail = pPrev; 155 | 156 | if ( pPrev ) 157 | pPrev->m_pNext = pNext; 158 | else 159 | m_pHead = pNext; 160 | 161 | pObRec->m_pParent = NULL; 162 | pObRec->m_pNext = NULL; 163 | pObRec->m_pPrev = NULL; 164 | --m_iCount; 165 | } 166 | -------------------------------------------------------------------------------- /src/common/CAssoc.cpp: -------------------------------------------------------------------------------- 1 | #include "graycom.h" 2 | #include "CAssoc.h" 3 | 4 | //*************************************************************************** 5 | // -CValStr 6 | 7 | LPCTSTR CValStr::FindName( int iVal ) const 8 | { 9 | ADDTOCALLSTACK("CValStr::FindName"); 10 | size_t i = 0; 11 | ASSERT(this[i].m_pszName != NULL); 12 | for ( ; this[i].m_pszName; ++i ) 13 | { 14 | if ( iVal < this[i + 1].m_iVal ) 15 | return this[i].m_pszName; 16 | } 17 | return this[i - 1].m_pszName; 18 | } 19 | 20 | //*************************************************************************** 21 | // -CElementDef 22 | // Describe the elements of a structure/class 23 | 24 | const int CElementDef::sm_Lengths[ELEM_QTY] = 25 | { 26 | 0, // ELEM_VOID 27 | -1, // ELEM_CSTRING 28 | -1, // ELEM_STRING (assume max size of REG_SIZE) 29 | sizeof(bool), // ELEM_BOOL 30 | sizeof(BYTE), // ELEM_BYTE (1 byte) 31 | sizeof(BYTE), // ELEM_MASK_BYTE (bits in a BYTE) 32 | sizeof(WORD), // ELEM_WORD (2 bytes) 33 | sizeof(WORD), // ELEM_MASK_WORD (bits in a WORD) 34 | sizeof(int), // ELEM_INT (whatever the int size is, 4 i assume) 35 | sizeof(int), // ELEM_MASK_INT (bits in a int) 36 | sizeof(DWORD), // ELEM_DWORD (4 bytes) 37 | sizeof(DWORD) // ELEM_MASK_DWORD (bits in a DWORD) 38 | }; 39 | 40 | bool CElementDef::SetValStr( void * pBase, LPCTSTR pszVal ) const 41 | { 42 | ADDTOCALLSTACK("CElementDef::SetValStr"); 43 | // Set the element value as a string. 44 | ASSERT(m_offset >= 0); 45 | 46 | void *pValPtr = GetValPtr(pBase); 47 | switch ( m_type ) 48 | { 49 | case ELEM_VOID: 50 | return false; 51 | case ELEM_STRING: 52 | { 53 | int iLen = GetValLength() - 1; 54 | strncpy(static_cast(pValPtr), pszVal, iLen); 55 | static_cast(pValPtr)[iLen - 1] = '\0'; 56 | return true; 57 | } 58 | case ELEM_CSTRING: 59 | { 60 | *static_cast(pValPtr) = pszVal; 61 | return true; 62 | } 63 | case ELEM_BOOL: 64 | case ELEM_BYTE: 65 | case ELEM_WORD: 66 | case ELEM_INT: // signed ? 67 | case ELEM_DWORD: 68 | { 69 | DWORD dwVal = Exp_GetVal(pszVal); 70 | memcpy(pValPtr, &dwVal, GetValLength()); 71 | return true; 72 | } 73 | case ELEM_MASK_BYTE: // bits in a BYTE 74 | case ELEM_MASK_WORD: // bits in a WORD 75 | case ELEM_MASK_INT: 76 | case ELEM_MASK_DWORD: // bits in a DWORD 77 | return false; 78 | default: 79 | return false; 80 | } 81 | } 82 | 83 | bool CElementDef::GetValStr( const void * pBase, CGString & sVal ) const 84 | { 85 | ADDTOCALLSTACK("CElementDef::GetValStr"); 86 | // Get the element value as a string. 87 | ASSERT(m_offset >= 0); 88 | 89 | void *pValPtr = GetValPtr(pBase); 90 | switch ( m_type ) 91 | { 92 | case ELEM_VOID: 93 | return false; 94 | case ELEM_STRING: 95 | { 96 | sVal = static_cast(pValPtr); 97 | return true; 98 | } 99 | case ELEM_CSTRING: 100 | { 101 | sVal = *static_cast(pValPtr); 102 | return true; 103 | } 104 | case ELEM_BOOL: 105 | case ELEM_BYTE: 106 | case ELEM_WORD: 107 | case ELEM_INT: // signed ? 108 | case ELEM_DWORD: 109 | { 110 | DWORD dwVal = 0; 111 | memcpy(&dwVal, pValPtr, GetValLength()); 112 | sVal.Format("%" FMTDWORD, dwVal); 113 | return true; 114 | } 115 | case ELEM_MASK_BYTE: // bits in a BYTE 116 | case ELEM_MASK_WORD: // bits in a WORD 117 | case ELEM_MASK_INT: 118 | case ELEM_MASK_DWORD: // bits in a DWORD 119 | return false; 120 | default: 121 | return false; 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /src/common/CCSVFile.cpp: -------------------------------------------------------------------------------- 1 | #include "../graysvr/graysvr.h" 2 | 3 | CCSVFile::CCSVFile() 4 | { 5 | m_iColumnCount = 0; 6 | m_iCurrentRow = 0; 7 | m_pszColumnTypes[0] = NULL; 8 | m_pszColumnNames[0] = NULL; 9 | } 10 | 11 | CCSVFile::~CCSVFile() 12 | { 13 | for ( size_t i = 0; m_pszColumnTypes[i] != NULL; ++i ) 14 | delete[] m_pszColumnTypes[i]; 15 | 16 | for ( size_t i = 0; m_pszColumnNames[i] != NULL; ++i ) 17 | delete[] m_pszColumnNames[i]; 18 | } 19 | 20 | bool CCSVFile::OpenBase(void *pExtra) 21 | { 22 | ADDTOCALLSTACK("CCSVFile::OpenBase"); 23 | if ( !CCacheableScriptFile::OpenBase(pExtra) ) 24 | return false; 25 | 26 | m_iCurrentRow = 0; 27 | 28 | // Remove all empty lines so that we just have data rows stored 29 | for ( std::vector::iterator i = m_fileContent->begin(); i != m_fileContent->end(); ) 30 | { 31 | LPCTSTR pszLine = i->c_str(); 32 | GETNONWHITESPACE(pszLine); 33 | if ( *pszLine == '\0' ) 34 | i = m_fileContent->erase(i); 35 | else 36 | ++i; 37 | } 38 | 39 | // Find type and name of the columns 40 | TCHAR *ppColumnTypes[FILE_MAX_COLUMNS]; 41 | TCHAR *ppColumnNames[FILE_MAX_COLUMNS]; 42 | 43 | // First row tells us how many columns there are 44 | m_iColumnCount = ReadRowContent(ppColumnTypes, 0); 45 | if ( m_iColumnCount <= 0 ) 46 | { 47 | m_iColumnCount = 0; 48 | Close(); 49 | return false; 50 | } 51 | 52 | // Second row lets us validate the column count 53 | if ( ReadRowContent(ppColumnNames, 1) != m_iColumnCount ) 54 | { 55 | m_iColumnCount = 0; 56 | Close(); 57 | return false; 58 | } 59 | 60 | // Copy the names 61 | for ( size_t i = 0; i < m_iColumnCount; ++i ) 62 | { 63 | m_pszColumnTypes[i] = new TCHAR[128]; 64 | strncpy(m_pszColumnTypes[i], ppColumnTypes[i], COUNTOF(m_pszColumnTypes)); 65 | m_pszColumnTypes[i][COUNTOF(m_pszColumnTypes) - 1] = '\0'; 66 | 67 | m_pszColumnNames[i] = new TCHAR[128]; 68 | strncpy(m_pszColumnNames[i], ppColumnNames[i], COUNTOF(m_pszColumnNames)); 69 | m_pszColumnNames[i][COUNTOF(m_pszColumnNames) - 1] = '\0'; 70 | } 71 | 72 | m_pszColumnTypes[m_iColumnCount] = NULL; 73 | m_pszColumnNames[m_iColumnCount] = NULL; 74 | return true; 75 | } 76 | 77 | size_t CCSVFile::ReadRowContent(TCHAR **ppOutput, size_t rowIndex, size_t columns) 78 | { 79 | ADDTOCALLSTACK("CCSVFile::ReadRowContent"); 80 | ASSERT((columns > 0) && (columns <= FILE_MAX_COLUMNS)); 81 | if ( GetPosition() != rowIndex ) 82 | Seek(static_cast(rowIndex), SEEK_SET); 83 | 84 | TCHAR *pszLine = Str_GetTemp(); 85 | if ( ReadString(pszLine, THREAD_STRING_LENGTH) == NULL ) 86 | return 0; 87 | 88 | return Str_ParseCmds(pszLine, ppOutput, columns, "\t"); 89 | } 90 | 91 | bool CCSVFile::ReadRowContent(size_t rowIndex, CSVRowData &target) 92 | { 93 | ADDTOCALLSTACK("CCSVFile::ReadRowContent"); 94 | // Get row data 95 | TCHAR *ppRowContent[FILE_MAX_COLUMNS]; 96 | size_t columns = ReadRowContent(ppRowContent, rowIndex); 97 | if ( columns != m_iColumnCount ) 98 | return false; 99 | 100 | // Copy to target 101 | target.clear(); 102 | for ( size_t i = 0; i < columns; ++i ) 103 | target[m_pszColumnNames[i]] = ppRowContent[i]; 104 | 105 | return !target.empty(); 106 | } 107 | 108 | size_t CCSVFile::ReadNextRowContent(TCHAR **ppOutput) 109 | { 110 | ADDTOCALLSTACK("CCSVFile::ReadNextRowContent"); 111 | ++m_iCurrentRow; 112 | return ReadRowContent(ppOutput, m_iCurrentRow); 113 | } 114 | 115 | bool CCSVFile::ReadNextRowContent(CSVRowData &target) 116 | { 117 | ADDTOCALLSTACK("CCSVFile::ReadNextRowContent"); 118 | ++m_iCurrentRow; 119 | return ReadRowContent(m_iCurrentRow, target); 120 | } 121 | -------------------------------------------------------------------------------- /src/common/CCSVFile.h: -------------------------------------------------------------------------------- 1 | #ifndef _INC_CCSVFILE_H 2 | #define _INC_CCSVFILE_H 3 | #pragma once 4 | 5 | #define FILE_MAX_COLUMNS 64 // maximum number of columns in a file 6 | 7 | typedef std::map CSVRowData; 8 | 9 | class CCSVFile : public CCacheableScriptFile 10 | { 11 | public: 12 | CCSVFile(); 13 | ~CCSVFile(); 14 | 15 | private: 16 | CCSVFile(const CCSVFile ©); 17 | CCSVFile &operator=(const CCSVFile &other); 18 | 19 | private: 20 | TCHAR *m_pszColumnTypes[FILE_MAX_COLUMNS]; 21 | TCHAR *m_pszColumnNames[FILE_MAX_COLUMNS]; 22 | size_t m_iColumnCount; 23 | size_t m_iCurrentRow; 24 | 25 | virtual bool OpenBase(void *pExtra); 26 | 27 | public: 28 | size_t GetColumnCount() const { return m_iColumnCount; } 29 | size_t GetCurrentRow() const { return m_iCurrentRow; } 30 | 31 | size_t ReadRowContent(TCHAR **ppOutput, size_t rowIndex, size_t columns = FILE_MAX_COLUMNS); 32 | bool ReadRowContent(size_t rowIndex, CSVRowData &target); 33 | 34 | size_t ReadNextRowContent(TCHAR **ppOutput); 35 | bool ReadNextRowContent(CSVRowData &target); 36 | }; 37 | 38 | #endif // _INC_CCSVFILE_H 39 | -------------------------------------------------------------------------------- /src/common/CCacheableScriptFile.h: -------------------------------------------------------------------------------- 1 | #ifndef _INC_CCACHEABLESCRIPTFILE_H 2 | #define _INC_CCACHEABLESCRIPTFILE_H 3 | #pragma once 4 | 5 | #include 6 | #include "CFile.h" 7 | 8 | class CCacheableScriptFile : public CFileText 9 | { 10 | public: 11 | CCacheableScriptFile(); 12 | ~CCacheableScriptFile(); 13 | 14 | private: 15 | bool m_closed; 16 | bool m_realFile; 17 | size_t m_currentLine; 18 | 19 | protected: 20 | std::vector *m_fileContent; 21 | 22 | protected: 23 | virtual bool OpenBase(void *pExtra); 24 | virtual void CloseBase(); 25 | void DupeFrom(CCacheableScriptFile *other); 26 | 27 | public: 28 | virtual bool IsFileOpen() const; 29 | virtual bool IsEOF() const; 30 | virtual TCHAR *ReadString(TCHAR *pBuffer, size_t iSizeMax); 31 | virtual DWORD Seek(long lOffset = 0, UINT uOrigin = SEEK_SET); 32 | virtual DWORD GetPosition() const; 33 | 34 | private: 35 | bool UseDefaultFile() const; 36 | 37 | private: 38 | CCacheableScriptFile(const CCacheableScriptFile ©); 39 | CCacheableScriptFile &operator=(const CCacheableScriptFile &other); 40 | }; 41 | 42 | #endif // _INC_CCACHEABLESCRIPTFILE_H 43 | -------------------------------------------------------------------------------- /src/common/CDataBase.h: -------------------------------------------------------------------------------- 1 | #ifndef _INC_CDATABASE_H 2 | #define _INC_CDATABASE_H 3 | #pragma once 4 | 5 | #include "graycom.h" 6 | #include "mysql/include/mysql.h" 7 | #include "mysql/include/errmsg.h" 8 | 9 | class CDataBase : public CScriptObj 10 | { 11 | public: 12 | static const char *m_sClassName; 13 | static const LPCTSTR sm_szLoadKeys[]; 14 | static const LPCTSTR sm_szVerbKeys[]; 15 | 16 | CDataBase(); 17 | ~CDataBase(); 18 | 19 | private: 20 | typedef std::pair FunctionArgsPair_t; 21 | typedef std::queue QueueFunction_t; 22 | 23 | protected: 24 | WORD m_wTickCount; 25 | MYSQL *m_socket; 26 | QueueFunction_t m_QueryArgs; 27 | 28 | public: 29 | CVarDefMap m_QueryResult; 30 | 31 | private: 32 | SimpleMutex m_connectionMutex; 33 | SimpleMutex m_resultMutex; 34 | 35 | public: 36 | void Connect(); 37 | void Close(); 38 | 39 | bool Query(LPCTSTR pszQuery, CVarDefMap &mapQueryResult); // SQL commands that need query result (SELECT) 40 | bool __cdecl Queryf(CVarDefMap &mapQueryResult, char *pFormat, ...) __printfargs(3, 4); 41 | 42 | bool Exec(LPCTSTR pszQuery); // SQL commands that doesn't need query result (SET, INSERT, DELETE, ...) 43 | bool __cdecl Execf(char *pFormat, ...) __printfargs(2, 3); 44 | 45 | bool AsyncQueue(bool fQuery, LPCTSTR pszFunction, LPCTSTR pszQuery); 46 | void AsyncQueueCallback(CGString &sFunction, CScriptTriggerArgs *pArgs); 47 | 48 | void OnTick(); 49 | 50 | virtual bool r_GetRef(LPCTSTR &pszKey, CScriptObj *&pRef); 51 | virtual bool r_LoadVal(CScript &s); 52 | virtual bool r_WriteVal(LPCTSTR pszKey, CGString &sVal, CTextConsole *pSrc); 53 | virtual bool r_Verb(CScript &s, CTextConsole *pSrc); 54 | 55 | LPCTSTR GetName() const 56 | { 57 | return "SQL_OBJ"; 58 | } 59 | 60 | private: 61 | CDataBase(const CDataBase ©); 62 | CDataBase &operator=(const CDataBase &other); 63 | }; 64 | 65 | #endif // _INC_CDATABASE_H 66 | -------------------------------------------------------------------------------- /src/common/CFileList.cpp: -------------------------------------------------------------------------------- 1 | #include "graycom.h" 2 | #include "CFileList.h" 3 | #ifndef _WIN32 4 | #include 5 | #endif 6 | 7 | bool CFileList::ReadFileInfo(LPCTSTR pszPath, time_t &timeDateChange, DWORD &dwSize) // static 8 | { 9 | ADDTOCALLSTACK("CFileList::ReadFileInfo"); 10 | 11 | #ifdef _WIN32 12 | struct _finddata_t fileinfo; 13 | fileinfo.attrib = _A_NORMAL; 14 | 15 | intptr_t hFile = _findfirst(pszPath, &fileinfo); 16 | if ( hFile != -1 ) 17 | { 18 | timeDateChange = fileinfo.time_write; 19 | dwSize = fileinfo.size; 20 | _findclose(hFile); 21 | return true; 22 | } 23 | #else 24 | struct stat fileStat; 25 | if ( stat(pszPath, &fileStat) != -1 ) 26 | { 27 | timeDateChange = fileStat.st_mtime; 28 | dwSize = fileStat.st_size; 29 | return true; 30 | } 31 | #endif 32 | 33 | return false; 34 | } 35 | 36 | int CFileList::ReadDir(LPCTSTR pszPath) 37 | { 38 | ADDTOCALLSTACK("CFileList::ReadDir"); 39 | // NOTE: It seems NOT to like the trailing \ alone 40 | 41 | TCHAR szPath[_MAX_PATH]; 42 | size_t len = strcpylen(szPath, pszPath, sizeof(szPath)); 43 | 44 | #ifdef _WIN32 45 | if ( len > 0 ) 46 | { 47 | --len; 48 | if ( (szPath[len] == '\\') || (szPath[len] == '/') ) 49 | strncat(szPath, "*.*", sizeof(szPath) - strlen(szPath) - 1); 50 | } 51 | 52 | struct _finddata_t fileinfo; 53 | intptr_t hFile = _findfirst(szPath, &fileinfo); 54 | if ( hFile != -1 ) 55 | { 56 | do 57 | { 58 | if ( fileinfo.name[0] == '.' ) 59 | continue; 60 | AddTail(fileinfo.name); 61 | } 62 | while ( !_findnext(hFile, &fileinfo) ); 63 | 64 | _findclose(hFile); 65 | return static_cast(GetCount()); 66 | } 67 | #else 68 | // Strip out the *.scp part 69 | for ( size_t i = len; i > 0; --i ) 70 | { 71 | if ( szPath[i] == '/' ) 72 | { 73 | szPath[i++] = '\0'; 74 | break; 75 | } 76 | } 77 | 78 | DIR *dirp = opendir(szPath); 79 | if ( dirp ) 80 | { 81 | struct dirent *fileinfo = NULL; 82 | char szFileName[_MAX_PATH]; 83 | 84 | do 85 | { 86 | fileinfo = readdir(dirp); 87 | if ( !fileinfo ) 88 | break; 89 | if ( fileinfo->d_name[0] == '.' ) 90 | continue; 91 | 92 | len = snprintf(szFileName, sizeof(szFileName), "%s%s", szPath, fileinfo->d_name); 93 | if ( (len > 4) && !strcmpi(&szFileName[len - 4], SPHERE_FILE_EXT_SCP) ) 94 | AddTail(fileinfo->d_name); 95 | } 96 | while ( fileinfo != NULL ); 97 | 98 | closedir(dirp); 99 | return static_cast(GetCount()); 100 | } 101 | #endif 102 | 103 | return -1; 104 | } 105 | -------------------------------------------------------------------------------- /src/common/CFileList.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _INC_CFILELIST_H 3 | #define _INC_CFILELIST_H 4 | 5 | #include "CAssoc.h" 6 | 7 | /** 8 | * @brief List of CGStrings with methods to read 9 | */ 10 | class CFileList : public CGStringList 11 | { 12 | public: 13 | CFileList() { }; 14 | 15 | public: 16 | static const char *m_sClassName; 17 | 18 | /** 19 | * @brief Get update time and size of a file. 20 | * @param pszPath file to read. 21 | * @param timeDateChange update time stored here. 22 | * @param dwSize size stored here. 23 | * @return false if can not read info from the file, true if info is setted. 24 | */ 25 | static bool ReadFileInfo(LPCTSTR pszPath, time_t &timeDateChange, DWORD &dwSize); 26 | 27 | /** 28 | * @brief Read a dir content and store inside the instance (content with name starting with '.' is not listed). 29 | * @param pszPath dir to read. 30 | * @return -1 on error, otherwise the number of elements listed. 31 | */ 32 | int ReadDir(LPCTSTR pszPath); 33 | 34 | private: 35 | CFileList(const CFileList ©); 36 | CFileList &operator=(const CFileList &other); 37 | }; 38 | 39 | #endif // _INC_CFILELIST_H 40 | -------------------------------------------------------------------------------- /src/common/CMD5.h: -------------------------------------------------------------------------------- 1 | /* 2 | This code has been built from scratch using rfc1321 and Colin Plumb's 3 | public domain code. 4 | */ 5 | 6 | #ifndef _INC_CMD5_H 7 | #define _INC_CMD5_H 8 | #pragma once 9 | 10 | #include 11 | #define MD5_DIGEST_LENGTH 32 12 | 13 | class CMD5 14 | { 15 | private: 16 | unsigned int m_buffer[4]; 17 | unsigned int m_bits[2]; 18 | unsigned char m_input[64]; 19 | bool m_finalized; 20 | 21 | void update(); 22 | 23 | public: 24 | CMD5(); 25 | ~CMD5(); 26 | private: 27 | CMD5(const CMD5& copy); 28 | CMD5& operator=(const CMD5& other); 29 | 30 | public: 31 | void reset(); 32 | void update( const unsigned char * data, unsigned int length ); 33 | void finalize(); 34 | 35 | // Digest has to be 33 bytes long 36 | void digest( char * digest ); 37 | // Get digest in a "numeric" form to be usable 38 | void numericDigest( unsigned char * digest ); 39 | 40 | inline static void fastDigest( char * digest, const char * message ) 41 | { 42 | CMD5 ctx; 43 | ctx.update( reinterpret_cast(message), static_cast(strlen( message ) )); 44 | ctx.finalize(); 45 | ctx.digest( digest ); 46 | } 47 | }; 48 | 49 | #endif // _INC_CMD5_H 50 | -------------------------------------------------------------------------------- /src/common/CMemBlock.h: -------------------------------------------------------------------------------- 1 | #ifndef _INC_CMEMBLOCK_H 2 | #define _INC_CMEMBLOCK_H 3 | #pragma once 4 | 5 | struct CMemBlock 6 | { 7 | public: 8 | CMemBlock() 9 | { 10 | m_pbData = NULL; 11 | } 12 | virtual ~CMemBlock() 13 | { 14 | Free(); 15 | } 16 | 17 | private: 18 | BYTE *m_pbData; // the actual data bytes of the bitmap 19 | 20 | protected: 21 | /** 22 | * @brief Sets the internal data pointer. Fails when internal data pointer is not NULL. 23 | */ 24 | void MemLink(BYTE *pbData) 25 | { 26 | ASSERT(!m_pbData); 27 | m_pbData = pbData; 28 | } 29 | 30 | /** 31 | * @brief Alloc mem (new BYTE[*] wrapper). Fails if can not alloc or if size is invalid. 32 | * @param uSize size to alloc. 33 | * @return pointer to the allocated data. 34 | */ 35 | BYTE *AllocBase(size_t uSize) 36 | { 37 | ASSERT(uSize > 0); 38 | BYTE *pbData = new BYTE[uSize]; 39 | ASSERT(pbData); 40 | return pbData; 41 | } 42 | 43 | public: 44 | /** 45 | * @brief Clear internal data pointer and, if size is valid, alloc mem, updating internal data pointer. 46 | * @param uSize size to alloc. 47 | */ 48 | void Alloc(size_t uSize) 49 | { 50 | Free(); 51 | if ( uSize > 0 ) 52 | m_pbData = AllocBase(uSize); 53 | } 54 | 55 | /** 56 | * @brief Clear internal data pointer if it is not NULL. 57 | */ 58 | void Free() 59 | { 60 | if ( m_pbData ) 61 | { 62 | delete[] m_pbData; 63 | m_pbData = NULL; 64 | } 65 | } 66 | 67 | /** 68 | * @brief Gets the internal data pointer. 69 | * @return The internal data pointer (can be NULL). 70 | */ 71 | BYTE *GetData() const 72 | { 73 | return m_pbData; 74 | } 75 | 76 | private: 77 | CMemBlock(const CMemBlock ©); 78 | CMemBlock &operator=(const CMemBlock &other); 79 | }; 80 | 81 | struct CMemLenBlock : public CMemBlock 82 | { 83 | public: 84 | CMemLenBlock() 85 | { 86 | m_uLength = 0; 87 | } 88 | 89 | private: 90 | size_t m_uLength; // buffer length 91 | 92 | public: 93 | /** 94 | * @brief Set the size of the buffer and alloc mem. 95 | * @param uSize new size of the buffer. 96 | */ 97 | void Alloc(size_t uSize) 98 | { 99 | m_uLength = uSize; 100 | CMemBlock::Alloc(uSize); 101 | } 102 | 103 | /** 104 | * @brief Clears the buffer. 105 | */ 106 | void Free() 107 | { 108 | m_uLength = 0; 109 | CMemBlock::Free(); 110 | } 111 | 112 | /** 113 | * @brief Get the buffer length. 114 | * @return Length of the buffer. 115 | */ 116 | size_t GetDataLength() const 117 | { 118 | return m_uLength; 119 | } 120 | 121 | /** 122 | * @brief Resizes the buffer, maintaining the current data. 123 | * @param uSizeNew new size of the buffer. 124 | */ 125 | void Resize(size_t uSizeNew) 126 | { 127 | ASSERT(uSizeNew != m_uLength); 128 | BYTE *pbDataNew = AllocBase(uSizeNew); 129 | ASSERT(pbDataNew); 130 | if ( GetData() ) 131 | { 132 | // Move any existing data 133 | ASSERT(m_uLength); 134 | memcpy(pbDataNew, GetData(), minimum(uSizeNew, m_uLength)); 135 | CMemBlock::Free(); 136 | } 137 | else 138 | ASSERT(!m_uLength); 139 | 140 | m_uLength = uSizeNew; 141 | MemLink(pbDataNew); 142 | } 143 | 144 | private: 145 | CMemLenBlock(const CMemLenBlock ©); 146 | CMemLenBlock &operator=(const CMemLenBlock &other); 147 | }; 148 | 149 | #endif // _INC_CMEMBLOCK_H 150 | -------------------------------------------------------------------------------- /src/common/CQueue.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file CQueue.cpp 3 | */ 4 | 5 | #include "../graysvr/graysvr.h" 6 | 7 | CQueueBytes::CQueueBytes() 8 | { 9 | m_iDataQty = 0; 10 | } 11 | 12 | CQueueBytes::~CQueueBytes() 13 | { 14 | } 15 | 16 | void CQueueBytes::Empty() 17 | { 18 | m_iDataQty = 0; 19 | } 20 | 21 | const BYTE * CQueueBytes::RemoveDataLock() const 22 | { 23 | return m_Mem.GetData(); 24 | } 25 | 26 | void CQueueBytes::RemoveDataAmount( size_t iSize ) 27 | { 28 | ADDTOCALLSTACK("CQueueBytes::RemoveDataAmount"); 29 | // use up this read data. (from the start) 30 | if ( iSize > m_iDataQty ) 31 | iSize = m_iDataQty; 32 | m_iDataQty -= iSize; 33 | memmove( m_Mem.GetData(), m_Mem.GetData()+iSize, m_iDataQty ); 34 | } 35 | 36 | BYTE * CQueueBytes::AddNewDataLock( size_t iLen ) 37 | { 38 | ADDTOCALLSTACK("CQueueBytes::AddNewDataLock"); 39 | // lock the queue to place this data in it. 40 | 41 | size_t iLenNew = m_iDataQty + iLen; 42 | if ( iLenNew > m_Mem.GetDataLength() ) 43 | { 44 | // re-alloc a bigger buffer. as needed. 45 | 46 | ASSERT(m_iDataQty<=m_Mem.GetDataLength()); 47 | m_Mem.Resize( ( iLenNew + 0x1000 ) &~ 0xFFF ); 48 | } 49 | 50 | return( m_Mem.GetData() + m_iDataQty ); 51 | } 52 | 53 | void CQueueBytes::AddNewDataFinish( size_t iLen ) 54 | { 55 | // The data is now ready. 56 | m_iDataQty += iLen; 57 | } 58 | 59 | void CQueueBytes::AddNewData( const BYTE * pData, size_t iLen ) 60 | { 61 | ADDTOCALLSTACK("CQueueBytes::AddNewData"); 62 | // Add new data to the end of the queue. 63 | memcpy( AddNewDataLock(iLen), pData, iLen ); 64 | AddNewDataFinish( iLen ); 65 | } 66 | -------------------------------------------------------------------------------- /src/common/CQueue.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file CQueue.h 3 | */ 4 | 5 | #ifndef _INC_CQUEUE_H 6 | #define _INC_CQUEUE_H 7 | 8 | #include "CMemBlock.h" 9 | 10 | /** 11 | * @brief FIFO data buffer 12 | */ 13 | class CQueueBytes 14 | { 15 | // Create an arbitrary queue of data. 16 | // NOTE: I know this is not a real queue yet, but i'm working on it. 17 | private: 18 | CMemLenBlock m_Mem; ///< Data buffer. 19 | size_t m_iDataQty; ///< Item count of the data queue. 20 | public: 21 | static const char *m_sClassName; 22 | CQueueBytes(); 23 | ~CQueueBytes(); 24 | 25 | private: 26 | /** 27 | * @brief No copy on construction allowed. 28 | */ 29 | CQueueBytes(const CQueueBytes& copy); 30 | /** 31 | * @brief No copy allowed. 32 | */ 33 | CQueueBytes& operator=(const CQueueBytes& other); 34 | 35 | public: 36 | /** 37 | * @brief Clear the queue. 38 | */ 39 | void Empty(); 40 | /** 41 | * @brief Get the element count from the queue. 42 | * @return Element count. 43 | */ 44 | size_t GetDataQty() const { return m_iDataQty; } 45 | /** 46 | * @brief Get the internal data pointer. 47 | * @return Pointer to internal data. 48 | */ 49 | const BYTE * RemoveDataLock() const; 50 | /** 51 | * @brief Remove an amount of data from the queue. 52 | * 53 | * If amount is greater than current element count, all will be removed. 54 | * @param iSize amount of data to remove. 55 | */ 56 | void RemoveDataAmount( size_t iSize ); 57 | 58 | /** 59 | * @brief Add an amount of data, resizing the buffer if needed. 60 | * @param pData pointer to the data to add. 61 | * @param iLen amount of data to add. 62 | */ 63 | void AddNewData( const BYTE * pData, size_t iLen ); 64 | /** 65 | * @brief Get the position to add an amount of data, resizing the buffer if needed. 66 | * @param iLen length needed. 67 | * @return pointer to the position where the data can be added. 68 | */ 69 | BYTE * AddNewDataLock( size_t iLen ); 70 | /** 71 | * @brief Increment the data counter. 72 | * @param iLen increment to add. 73 | */ 74 | void AddNewDataFinish( size_t iLen ); 75 | }; 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /src/common/CTime.h: -------------------------------------------------------------------------------- 1 | #ifndef _INC_CTIME_H 2 | #define _INC_CTIME_H 3 | 4 | #ifndef _WIN32 5 | ULONGLONG GetTickCount64(); 6 | #endif 7 | #undef GetCurrentTime 8 | 9 | class CGTime 10 | { 11 | // Get time stamp in the real world (based on struct tm) 12 | // Similar to MFC CTime and CTimeSpan or COleDateTime 13 | public: 14 | static const char *m_sClassName; 15 | 16 | CGTime() 17 | { 18 | m_time = 0; 19 | } 20 | CGTime(time_t time) 21 | { 22 | m_time = time; 23 | } 24 | CGTime(int iYear, int iMonth, int iDay, int iHour, int iMin, int iSec, int iDST = -1); 25 | 26 | private: 27 | time_t m_time; 28 | 29 | public: 30 | static CGTime GetCurrentTime(); 31 | struct tm *GetLocalTm() const; 32 | LPCTSTR Format(LPCTSTR pszFormat) const; 33 | LPCTSTR FormatGmt(LPCTSTR pszFormat) const; 34 | bool Read(TCHAR *pszVal); 35 | 36 | void Init() 37 | { 38 | m_time = -1; 39 | } 40 | 41 | time_t GetTime() const 42 | { 43 | return m_time; 44 | } 45 | bool IsTimeValid() const 46 | { 47 | return (m_time && (m_time != -1)); 48 | } 49 | 50 | int GetYear() const 51 | { 52 | return GetLocalTm()->tm_year + 1900; 53 | } 54 | int GetMonth() const 55 | { 56 | return GetLocalTm()->tm_mon + 1; 57 | } 58 | int GetDay() const 59 | { 60 | return GetLocalTm()->tm_mday; 61 | } 62 | int GetHour() const 63 | { 64 | return GetLocalTm()->tm_hour; 65 | } 66 | int GetMinute() const 67 | { 68 | return GetLocalTm()->tm_min; 69 | } 70 | int GetDaysTotal() const 71 | { 72 | // Needs to be more consistent than accurate, just for compare 73 | return (GetYear() * 365) + (GetMonth() * 30) + GetDay(); 74 | } 75 | 76 | public: 77 | const CGTime &operator=(const CGTime &timeSrc) 78 | { 79 | m_time = timeSrc.m_time; 80 | return *this; 81 | } 82 | const CGTime &operator=(time_t time) 83 | { 84 | m_time = time; 85 | return *this; 86 | } 87 | 88 | bool operator<=(time_t time) const 89 | { 90 | return (m_time <= time); 91 | } 92 | bool operator==(time_t time) const 93 | { 94 | return (m_time == time); 95 | } 96 | bool operator!=(time_t time) const 97 | { 98 | return (m_time != time); 99 | } 100 | }; 101 | 102 | #endif // _INC_CTIME_H 103 | -------------------------------------------------------------------------------- /src/common/CVarFloat.h: -------------------------------------------------------------------------------- 1 | #ifndef _INC_CVARFLOAT_H 2 | #define _INC_CVARFLOAT_H 3 | #pragma once 4 | 5 | #include 6 | 7 | struct LexNoCaseLess 8 | { 9 | bool operator()(const CGString &sVal, LPCTSTR pszBeg2) const 10 | { 11 | LPCTSTR pszBeg1 = sVal.GetPtr(); 12 | if ( !pszBeg1 || !pszBeg2 ) 13 | return false; 14 | 15 | LPCTSTR pszEnd1 = pszBeg1; 16 | LPCTSTR pszEnd2 = pszBeg2; 17 | while ( *pszEnd1 ) 18 | ++pszEnd1; 19 | while ( *pszEnd2 ) 20 | ++pszEnd2; 21 | ++pszEnd1; 22 | ++pszEnd2; 23 | 24 | for ( ; (pszBeg1 != pszEnd1) && (pszBeg2 != pszEnd2); ++pszBeg1, ++pszBeg2 ) 25 | { 26 | if ( tolower(*pszBeg1) < tolower(*pszBeg2) ) 27 | return true; 28 | if ( tolower(*pszBeg2) < tolower(*pszBeg1) ) 29 | return false; 30 | } 31 | return ((pszBeg1 == pszEnd1) && (pszBeg2 != pszEnd2)); 32 | } 33 | }; 34 | 35 | class CVarFloat 36 | { 37 | public: 38 | CVarFloat(); 39 | ~CVarFloat(); 40 | 41 | public: 42 | typedef double RealType; 43 | typedef std::map MapType; 44 | 45 | private: 46 | MapType m_VarMap; 47 | 48 | public: 49 | bool Insert(LPCTSTR pszName, LPCTSTR pszValue, bool fForceSet = false); 50 | CGString Get(LPCTSTR pszName); 51 | 52 | static RealType MakeFloatMath(LPCTSTR &pszExpr); 53 | 54 | private: 55 | RealType GetVal(LPCTSTR pszName); 56 | static RealType GetValMath(RealType dVal, LPCTSTR &pszExpr); 57 | static RealType GetSingle(LPCTSTR & pszArgs); 58 | static RealType GetRandVal(RealType dMin, RealType dMax); 59 | 60 | private: 61 | CVarFloat(const CVarFloat ©); 62 | CVarFloat &operator=(const CVarFloat &other); 63 | }; 64 | 65 | class CObjBase; 66 | 67 | class CLocalObjMap 68 | { 69 | public: 70 | CLocalObjMap(); 71 | ~CLocalObjMap(); 72 | 73 | public: 74 | typedef std::map ObjMap; 75 | 76 | private: 77 | ObjMap m_ObjMap; 78 | 79 | public: 80 | CObjBase *Get(WORD wNumber); 81 | bool Insert(WORD wNumber, CObjBase *pObj, bool fForceSet = false); 82 | 83 | private: 84 | CLocalObjMap(const CLocalObjMap ©); 85 | CLocalObjMap &operator=(const CLocalObjMap &other); 86 | }; 87 | 88 | #endif // _INC_CVARFLOAT_H 89 | -------------------------------------------------------------------------------- /src/common/CWindow.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // CWindow.cpp 3 | // 4 | 5 | #include "CWindow.h" 6 | 7 | #ifdef _WIN32 8 | 9 | /////////////////////// 10 | // -CDialogBase 11 | 12 | INT_PTR CALLBACK CDialogBase::DialogProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) // static 13 | { 14 | CDialogBase * pDlg; 15 | if ( message == WM_INITDIALOG ) 16 | { 17 | pDlg = reinterpret_cast(lParam); 18 | ASSERT( pDlg ); 19 | pDlg->m_hWnd = hWnd; // OnCreate() 20 | pDlg->SetWindowLongPtr( GWLP_USERDATA, reinterpret_cast(pDlg) ); 21 | } 22 | else 23 | { 24 | pDlg = static_cast((LPVOID)::GetWindowLongPtr(hWnd, GWLP_USERDATA)); 25 | } 26 | if ( pDlg ) 27 | { 28 | return pDlg->DefDialogProc( message, wParam, lParam ); 29 | } 30 | else 31 | { 32 | return FALSE; 33 | } 34 | } 35 | 36 | /////////////////////// 37 | // -CWindowBase 38 | 39 | ATOM CWindowBase::RegisterClass( WNDCLASS & wc ) // static 40 | { 41 | wc.lpfnWndProc = WndProc; 42 | return ::RegisterClass( &wc ); 43 | } 44 | 45 | LRESULT WINAPI CWindowBase::WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) // static 46 | { 47 | // NOTE: It is important to call OnDestroy() for asserts to work. 48 | CWindowBase * pWnd; 49 | if ( message == WM_NCCREATE || message == WM_CREATE ) 50 | { 51 | LPCREATESTRUCT lpCreateStruct = (LPCREATESTRUCT)lParam; 52 | ASSERT(lpCreateStruct); 53 | pWnd = static_cast(lpCreateStruct->lpCreateParams); 54 | ASSERT( pWnd ); 55 | pWnd->m_hWnd = hWnd; // OnCreate() 56 | pWnd->SetWindowLongPtr(GWLP_USERDATA, reinterpret_cast(pWnd)); 57 | } 58 | pWnd = static_cast((LPVOID)::GetWindowLongPtr(hWnd, GWLP_USERDATA)); 59 | return ( pWnd ? pWnd->DefWindowProc(message, wParam, lParam) : ::DefWindowProc(hWnd, message, wParam, lParam) ); 60 | } 61 | 62 | #endif // _WIN32 63 | -------------------------------------------------------------------------------- /src/common/grayver.h: -------------------------------------------------------------------------------- 1 | #ifndef _INC_GRAYVER_H 2 | #define _INC_GRAYVER_H 3 | #pragma once 4 | 5 | #include "version/GitRevision.h" 6 | #if defined(__GITREVISION__) 7 | #define SPHERE_VER_BUILD __GITREVISION__ 8 | #else 9 | #define SPHERE_VER_BUILD 0 10 | #endif 11 | 12 | #define SPHERE_VER_FILEVERSION 0,56,4,SPHERE_VER_BUILD // version to be set on generated .exe file 13 | #define SPHERE_VER_STR "0.56d" // share version with all files 14 | 15 | #if defined(_DEBUG) 16 | #define SPHERE_VER_STR_FULL SPHERE_VER_STR "-Debug" 17 | #define SPHERE_VER_FILEFLAGS VS_FF_DEBUG 18 | #elif defined(_NIGHTLYBUILD) 19 | #define SPHERE_VER_STR_FULL SPHERE_VER_STR "-Nightly" 20 | #define SPHERE_VER_FILEFLAGS VS_FF_PRERELEASE 21 | #elif defined(_PRIVATEBUILD) 22 | #define SPHERE_VER_STR_FULL SPHERE_VER_STR "-Private" 23 | #define SPHERE_VER_FILEFLAGS VS_FF_PRIVATEBUILD 24 | #else 25 | #define SPHERE_VER_STR_FULL SPHERE_VER_STR "-Release" 26 | #define SPHERE_VER_FILEFLAGS 0x0L 27 | #endif 28 | 29 | #define SPHERE_TITLE "Sphere" 30 | #define SPHERE_TITLE_VER "Sphere V" SPHERE_VER_STR_FULL 31 | #define SPHERE_WEBSITE "www.spherecommunity.net" 32 | 33 | #if defined(_WIN32) 34 | #define SPHERE_VER_FILEOS VOS_NT_WINDOWS32 35 | #else 36 | #define SPHERE_VER_FILEOS VOS_UNKNOWN 37 | #endif 38 | 39 | #if defined(_WIN64) || defined(x64) 40 | #define SPHERE_VER_ARCH "64bit" 41 | #else 42 | #define SPHERE_VER_ARCH "32bit" 43 | #endif 44 | 45 | #endif // _INC_GRAYVER_H 46 | -------------------------------------------------------------------------------- /src/common/libev/README: -------------------------------------------------------------------------------- 1 | libev is a high-performance event loop/event model with lots of features. 2 | (see benchmark at http://libev.schmorp.de/bench.html) 3 | 4 | 5 | ABOUT 6 | 7 | Homepage: http://software.schmorp.de/pkg/libev 8 | Mailinglist: libev@lists.schmorp.de 9 | http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev 10 | Library Documentation: http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod 11 | 12 | Libev is modelled (very losely) after libevent and the Event perl 13 | module, but is faster, scales better and is more correct, and also more 14 | featureful. And also smaller. Yay. 15 | 16 | Some of the specialties of libev not commonly found elsewhere are: 17 | 18 | - extensive and detailed, readable documentation (not doxygen garbage). 19 | - fully supports fork, can detect fork in various ways and automatically 20 | re-arms kernel mechanisms that do not support fork. 21 | - highly optimised select, poll, linux epoll, linux aio, bsd kqueue 22 | and solaris event ports backends. 23 | - filesystem object (path) watching (with optional linux inotify support). 24 | - wallclock-based times (using absolute time, cron-like). 25 | - relative timers/timeouts (handle time jumps). 26 | - fast intra-thread communication between multiple 27 | event loops (with optional fast linux eventfd backend). 28 | - extremely easy to embed (fully documented, no dependencies, 29 | autoconf supported but optional). 30 | - very small codebase, no bloated library, simple code. 31 | - fully extensible by being able to plug into the event loop, 32 | integrate other event loops, integrate other event loop users. 33 | - very little memory use (small watchers, small event loop data). 34 | - optional C++ interface allowing method and function callbacks 35 | at no extra memory or runtime overhead. 36 | - optional Perl interface with similar characteristics (capable 37 | of running Glib/Gtk2 on libev). 38 | - support for other languages (multiple C++ interfaces, D, Ruby, 39 | Python) available from third-parties. 40 | 41 | Examples of programs that embed libev: the EV perl module, node.js, 42 | auditd, rxvt-unicode, gvpe (GNU Virtual Private Ethernet), the 43 | Deliantra MMORPG server (http://www.deliantra.net/), Rubinius (a 44 | next-generation Ruby VM), the Ebb web server, the Rev event toolkit. 45 | 46 | 47 | CONTRIBUTORS 48 | 49 | libev was written and designed by Marc Lehmann and Emanuele Giaquinta. 50 | 51 | The following people sent in patches or made other noteworthy 52 | contributions to the design (for minor patches, see the Changes 53 | file. If I forgot to include you, please shout at me, it was an 54 | accident): 55 | 56 | W.C.A. Wijngaards 57 | Christopher Layne 58 | Chris Brody 59 | 60 | -------------------------------------------------------------------------------- /src/common/libev/ev_config.h: -------------------------------------------------------------------------------- 1 | /* config.h. Generated from config.h.in by configure. */ 2 | /* config.h.in. Generated from configure.ac by autoheader. */ 3 | 4 | /* Define to 1 if you have the `clock_gettime' function. */ 5 | #define HAVE_CLOCK_GETTIME 1 6 | 7 | /* Define to 1 if you have the header file. */ 8 | #define HAVE_DLFCN_H 1 9 | 10 | /* Define to 1 if you have the `epoll_ctl' function. */ 11 | #define HAVE_EPOLL_CTL 1 12 | 13 | /* Define to 1 if you have the `inotify_init' function. */ 14 | /* #undef HAVE_INOTIFY_INIT */ 15 | 16 | /* Define to 1 if you have the header file. */ 17 | #define HAVE_INTTYPES_H 1 18 | 19 | /* Define to 1 if you have the `kqueue' function. */ 20 | #ifdef _BSD 21 | #define HAVE_KQUEUE 1 22 | #endif 23 | 24 | /* Define to 1 if you have the `m' library (-lm). */ 25 | #define HAVE_LIBM 1 26 | 27 | /* Define to 1 if you have the `rt' library (-lrt). */ 28 | #define HAVE_LIBRT 1 29 | 30 | /* Define to 1 if you have the header file. */ 31 | #define HAVE_MEMORY_H 1 32 | 33 | /* Define to 1 if you have the `nanosleep' function. */ 34 | /* #undef HAVE_NANOSLEEP */ 35 | 36 | /* Define to 1 if you have the `poll' function. */ 37 | #define HAVE_POLL 1 38 | 39 | /* Define to 1 if you have the header file. */ 40 | #define HAVE_POLL_H 1 41 | 42 | /* Define to 1 if you have the `port_create' function. */ 43 | /* #undef HAVE_PORT_CREATE */ 44 | 45 | /* Define to 1 if you have the header file. */ 46 | /* #undef HAVE_PORT_H */ 47 | 48 | /* Define to 1 if you have the `select' function. */ 49 | #define HAVE_SELECT 1 50 | 51 | /* Define to 1 if you have the header file. */ 52 | #define HAVE_STDINT_H 1 53 | 54 | /* Define to 1 if you have the header file. */ 55 | #define HAVE_STDLIB_H 1 56 | 57 | /* Define to 1 if you have the header file. */ 58 | #define HAVE_STRINGS_H 1 59 | 60 | /* Define to 1 if you have the header file. */ 61 | #define HAVE_STRING_H 1 62 | 63 | /* Define to 1 if you have the header file. */ 64 | #define HAVE_SYS_EPOLL_H 1 65 | 66 | /* Define to 1 if you have the header file. */ 67 | /* #undef HAVE_SYS_EVENT_H */ 68 | 69 | /* Define to 1 if you have the header file. */ 70 | /* #undef HAVE_SYS_INOTIFY_H */ 71 | 72 | /* Define to 1 if you have the header file. */ 73 | #define HAVE_SYS_QUEUE_H 1 74 | 75 | /* Define to 1 if you have the header file. */ 76 | #define HAVE_SYS_SELECT_H 1 77 | 78 | /* Define to 1 if you have the header file. */ 79 | #define HAVE_SYS_STAT_H 1 80 | 81 | /* Define to 1 if you have the header file. */ 82 | #define HAVE_SYS_TYPES_H 1 83 | 84 | /* Define to 1 if you have the header file. */ 85 | #define HAVE_UNISTD_H 1 86 | 87 | /* Name of package */ 88 | #define PACKAGE "libev" 89 | 90 | /* Define to the address where bug reports for this package should be sent. */ 91 | #define PACKAGE_BUGREPORT "" 92 | 93 | /* Define to the full name of this package. */ 94 | #define PACKAGE_NAME "" 95 | 96 | /* Define to the full name and version of this package. */ 97 | #define PACKAGE_STRING "" 98 | 99 | /* Define to the one symbol short name of this package. */ 100 | #define PACKAGE_TARNAME "" 101 | 102 | /* Define to the version of this package. */ 103 | #define PACKAGE_VERSION "" 104 | 105 | /* Define to 1 if you have the ANSI C header files. */ 106 | #define STDC_HEADERS 1 107 | 108 | /* Version number of package */ 109 | #define VERSION "4.1" 110 | -------------------------------------------------------------------------------- /src/common/libev/wrapper_ev.c: -------------------------------------------------------------------------------- 1 | #include "wrapper_ev.h" 2 | 3 | // libev produces many warnings which isn't really appropriate for us to 4 | // address since it is 3rd party code that could be overwritten at any time 5 | // with a new version 6 | #pragma GCC diagnostic ignored "-Wcomment" 7 | #pragma GCC diagnostic ignored "-Wparentheses" 8 | #pragma GCC diagnostic ignored "-Wreturn-type" 9 | #pragma GCC diagnostic ignored "-Wunused-but-set-variable" 10 | #pragma GCC diagnostic ignored "-Wunused-value" 11 | 12 | #ifdef __MINGW32__ 13 | #include 14 | struct timespec 15 | { 16 | time_t tv_sec; 17 | long int tv_nsec; 18 | }; 19 | #endif // __MINGW32__ 20 | #include "ev.c" 21 | -------------------------------------------------------------------------------- /src/common/libev/wrapper_ev.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __WRAPPER_EV__H 3 | #define __WRAPPER_EV__H 4 | 5 | #ifdef _WIN32 6 | #undef FD_SETSIZE 7 | #define FD_SETSIZE 1024 8 | #define EV_SELECT_IS_WINSOCKET 1 9 | 10 | #ifndef EV_FD_TO_WIN32_HANDLE 11 | # define EV_FD_TO_WIN32_HANDLE(fd) _get_osfhandle (fd) 12 | #endif 13 | #ifndef EV_WIN32_HANDLE_TO_FD 14 | # define EV_WIN32_HANDLE_TO_FD(handle) _open_osfhandle (handle, 0) 15 | #endif 16 | #ifndef EV_WIN32_CLOSE_FD 17 | # define EV_WIN32_CLOSE_FD(fd) close (fd) 18 | #endif 19 | #else 20 | #define EV_CONFIG "ev_config.h" 21 | #endif 22 | #define EV_STANDALONE 1 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /src/common/mysql/include/binary_log_types.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, 2015 Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | 16 | /** 17 | @file binary_log_types.h 18 | 19 | @brief This file contains the field type. 20 | 21 | 22 | @note This file can be imported both from C and C++ code, so the 23 | definitions have to be constructed to support this. 24 | */ 25 | 26 | #ifndef BINARY_LOG_TYPES_INCLUDED 27 | #define BINARY_LOG_TYPES_INCLUDED 28 | 29 | #ifdef __cplusplus 30 | extern "C" 31 | { 32 | #endif 33 | 34 | /* 35 | * Constants exported from this package. 36 | */ 37 | 38 | typedef enum enum_field_types { 39 | MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY, 40 | MYSQL_TYPE_SHORT, MYSQL_TYPE_LONG, 41 | MYSQL_TYPE_FLOAT, MYSQL_TYPE_DOUBLE, 42 | MYSQL_TYPE_NULL, MYSQL_TYPE_TIMESTAMP, 43 | MYSQL_TYPE_LONGLONG,MYSQL_TYPE_INT24, 44 | MYSQL_TYPE_DATE, MYSQL_TYPE_TIME, 45 | MYSQL_TYPE_DATETIME, MYSQL_TYPE_YEAR, 46 | MYSQL_TYPE_NEWDATE, MYSQL_TYPE_VARCHAR, 47 | MYSQL_TYPE_BIT, 48 | MYSQL_TYPE_TIMESTAMP2, 49 | MYSQL_TYPE_DATETIME2, 50 | MYSQL_TYPE_TIME2, 51 | MYSQL_TYPE_JSON=245, 52 | MYSQL_TYPE_NEWDECIMAL=246, 53 | MYSQL_TYPE_ENUM=247, 54 | MYSQL_TYPE_SET=248, 55 | MYSQL_TYPE_TINY_BLOB=249, 56 | MYSQL_TYPE_MEDIUM_BLOB=250, 57 | MYSQL_TYPE_LONG_BLOB=251, 58 | MYSQL_TYPE_BLOB=252, 59 | MYSQL_TYPE_VAR_STRING=253, 60 | MYSQL_TYPE_STRING=254, 61 | MYSQL_TYPE_GEOMETRY=255 62 | } enum_field_types; 63 | 64 | #define DATETIME_MAX_DECIMALS 6 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif // __cplusplus 69 | 70 | #endif /* BINARY_LOG_TYPES_INCLUDED */ 71 | -------------------------------------------------------------------------------- /src/common/mysql/include/byte_order_generic.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | 16 | /* 17 | Endianness-independent definitions for architectures other 18 | than the x86 architecture. 19 | */ 20 | static inline int16 sint2korr(const uchar *A) 21 | { 22 | return 23 | (int16) (((int16) (A[0])) + 24 | ((int16) (A[1]) << 8)) 25 | ; 26 | } 27 | 28 | static inline int32 sint4korr(const uchar *A) 29 | { 30 | return 31 | (int32) (((int32) (A[0])) + 32 | (((int32) (A[1]) << 8)) + 33 | (((int32) (A[2]) << 16)) + 34 | (((int32) (A[3]) << 24))) 35 | ; 36 | } 37 | 38 | static inline uint16 uint2korr(const uchar *A) 39 | { 40 | return 41 | (uint16) (((uint16) (A[0])) + 42 | ((uint16) (A[1]) << 8)) 43 | ; 44 | } 45 | 46 | static inline uint32 uint4korr(const uchar *A) 47 | { 48 | return 49 | (uint32) (((uint32) (A[0])) + 50 | (((uint32) (A[1])) << 8) + 51 | (((uint32) (A[2])) << 16) + 52 | (((uint32) (A[3])) << 24)) 53 | ; 54 | } 55 | 56 | static inline ulonglong uint8korr(const uchar *A) 57 | { 58 | return 59 | ((ulonglong)(((uint32) (A[0])) + 60 | (((uint32) (A[1])) << 8) + 61 | (((uint32) (A[2])) << 16) + 62 | (((uint32) (A[3])) << 24)) + 63 | (((ulonglong) (((uint32) (A[4])) + 64 | (((uint32) (A[5])) << 8) + 65 | (((uint32) (A[6])) << 16) + 66 | (((uint32) (A[7])) << 24))) << 67 | 32)) 68 | ; 69 | } 70 | 71 | static inline longlong sint8korr(const uchar *A) 72 | { 73 | return (longlong) uint8korr(A); 74 | } 75 | 76 | static inline void int2store(uchar *T, uint16 A) 77 | { 78 | uint def_temp= A ; 79 | *(T)= (uchar)(def_temp); 80 | *(T+1)= (uchar)(def_temp >> 8); 81 | } 82 | 83 | static inline void int4store(uchar *T, uint32 A) 84 | { 85 | *(T)= (uchar) (A); 86 | *(T+1)=(uchar) (A >> 8); 87 | *(T+2)=(uchar) (A >> 16); 88 | *(T+3)=(uchar) (A >> 24); 89 | } 90 | 91 | static inline void int8store(uchar *T, ulonglong A) 92 | { 93 | uint def_temp= (uint) A, 94 | def_temp2= (uint) (A >> 32); 95 | int4store(T, def_temp); 96 | int4store(T+4,def_temp2); 97 | } 98 | -------------------------------------------------------------------------------- /src/common/mysql/include/byte_order_generic_x86.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | 16 | /* 17 | Optimized functions for the x86 architecture (_WIN32 included). 18 | 19 | x86 handles misaligned reads and writes just fine, so suppress 20 | UBSAN warnings for these functions. 21 | */ 22 | static inline int16 sint2korr(const uchar *A) SUPPRESS_UBSAN; 23 | static inline int16 sint2korr(const uchar *A) { return *((int16*) A); } 24 | 25 | static inline int32 sint4korr(const uchar *A) SUPPRESS_UBSAN; 26 | static inline int32 sint4korr(const uchar *A) { return *((int32*) A); } 27 | 28 | static inline uint16 uint2korr(const uchar *A) SUPPRESS_UBSAN; 29 | static inline uint16 uint2korr(const uchar *A) { return *((uint16*) A); } 30 | 31 | static inline uint32 uint4korr(const uchar *A) SUPPRESS_UBSAN; 32 | static inline uint32 uint4korr(const uchar *A) { return *((uint32*) A); } 33 | 34 | static inline ulonglong uint8korr(const uchar *A) SUPPRESS_UBSAN; 35 | static inline ulonglong uint8korr(const uchar *A) { return *((ulonglong*) A);} 36 | 37 | static inline longlong sint8korr(const uchar *A) SUPPRESS_UBSAN; 38 | static inline longlong sint8korr(const uchar *A) { return *((longlong*) A); } 39 | 40 | static inline void int2store(uchar *T, uint16 A) SUPPRESS_UBSAN; 41 | static inline void int2store(uchar *T, uint16 A) 42 | { 43 | *((uint16*) T)= A; 44 | } 45 | 46 | static inline void int4store(uchar *T, uint32 A) SUPPRESS_UBSAN; 47 | static inline void int4store(uchar *T, uint32 A) 48 | { 49 | *((uint32*) T)= A; 50 | } 51 | 52 | static inline void int8store(uchar *T, ulonglong A) SUPPRESS_UBSAN; 53 | static inline void int8store(uchar *T, ulonglong A) 54 | { 55 | *((ulonglong*) T)= A; 56 | } 57 | -------------------------------------------------------------------------------- /src/common/mysql/include/little_endian.h: -------------------------------------------------------------------------------- 1 | #ifndef LITTLE_ENDIAN_INCLUDED 2 | #define LITTLE_ENDIAN_INCLUDED 3 | /* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 17 | 18 | /* 19 | Data in little-endian format. 20 | */ 21 | 22 | #include 23 | 24 | static inline void float4get (float *V, const uchar *M) 25 | { 26 | memcpy(V, (M), sizeof(float)); 27 | } 28 | 29 | static inline void float4store(uchar *V, float M) 30 | { 31 | memcpy(V, (&M), sizeof(float)); 32 | } 33 | 34 | static inline void float8get (double *V, const uchar *M) 35 | { 36 | memcpy(V, M, sizeof(double)); 37 | } 38 | 39 | static inline void float8store(uchar *V, double M) 40 | { 41 | memcpy(V, &M, sizeof(double)); 42 | } 43 | 44 | static inline void floatget (float *V, const uchar *M) { float4get(V, M); } 45 | static inline void floatstore (uchar *V, float M) { float4store(V, M); } 46 | 47 | /* Bi-endian hardware.... */ 48 | #if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN) 49 | static inline void doublestore(uchar *T, double V) 50 | { *(((char*)T)+0)=(char) ((uchar *) &V)[4]; 51 | *(((char*)T)+1)=(char) ((uchar *) &V)[5]; 52 | *(((char*)T)+2)=(char) ((uchar *) &V)[6]; 53 | *(((char*)T)+3)=(char) ((uchar *) &V)[7]; 54 | *(((char*)T)+4)=(char) ((uchar *) &V)[0]; 55 | *(((char*)T)+5)=(char) ((uchar *) &V)[1]; 56 | *(((char*)T)+6)=(char) ((uchar *) &V)[2]; 57 | *(((char*)T)+7)=(char) ((uchar *) &V)[3]; } 58 | static inline void doubleget(double *V, const uchar *M) 59 | { double def_temp; 60 | ((uchar*) &def_temp)[0]=(M)[4]; 61 | ((uchar*) &def_temp)[1]=(M)[5]; 62 | ((uchar*) &def_temp)[2]=(M)[6]; 63 | ((uchar*) &def_temp)[3]=(M)[7]; 64 | ((uchar*) &def_temp)[4]=(M)[0]; 65 | ((uchar*) &def_temp)[5]=(M)[1]; 66 | ((uchar*) &def_temp)[6]=(M)[2]; 67 | ((uchar*) &def_temp)[7]=(M)[3]; 68 | (*V) = def_temp; } 69 | 70 | #else /* Bi-endian hardware.... */ 71 | 72 | static inline void doublestore(uchar *T, double V) { memcpy(T, &V, sizeof(double)); } 73 | static inline void doubleget (double *V, const uchar *M) { memcpy(V, M, sizeof(double)); } 74 | 75 | #endif /* Bi-endian hardware.... */ 76 | 77 | static inline void ushortget(uint16 *V, const uchar *pM) { *V= uint2korr(pM); } 78 | static inline void shortget (int16 *V, const uchar *pM) { *V= sint2korr(pM); } 79 | static inline void longget (int32 *V, const uchar *pM) { *V= sint4korr(pM); } 80 | static inline void ulongget (uint32 *V, const uchar *pM) { *V= uint4korr(pM); } 81 | static inline void shortstore(uchar *T, int16 V) { int2store(T, V); } 82 | static inline void longstore (uchar *T, int32 V) { int4store(T, V); } 83 | 84 | static inline void longlongget(longlong *V, const uchar *M) 85 | { 86 | memcpy(V, (M), sizeof(ulonglong)); 87 | } 88 | static inline void longlongstore(uchar *T, longlong V) 89 | { 90 | memcpy((T), &V, sizeof(ulonglong)); 91 | } 92 | 93 | #endif /* LITTLE_ENDIAN_INCLUDED */ 94 | -------------------------------------------------------------------------------- /src/common/mysql/include/my_alloc.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | 16 | /* 17 | Data structures for mysys/my_alloc.c (root memory allocator) 18 | */ 19 | 20 | #ifndef _my_alloc_h 21 | #define _my_alloc_h 22 | 23 | #define ALLOC_MAX_BLOCK_TO_DROP 4096 24 | #define ALLOC_MAX_BLOCK_USAGE_BEFORE_DROP 10 25 | 26 | /* PSI_memory_key */ 27 | #include "mysql/psi/psi_memory.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | typedef struct st_used_mem 34 | { /* struct for once_alloc (block) */ 35 | struct st_used_mem *next; /* Next block in use */ 36 | unsigned int left; /* memory left in block */ 37 | unsigned int size; /* size of block */ 38 | } USED_MEM; 39 | 40 | 41 | typedef struct st_mem_root 42 | { 43 | USED_MEM *free; /* blocks with free memory in it */ 44 | USED_MEM *used; /* blocks almost without free memory */ 45 | USED_MEM *pre_alloc; /* preallocated block */ 46 | /* if block have less memory it will be put in 'used' list */ 47 | size_t min_malloc; 48 | size_t block_size; /* initial block size */ 49 | unsigned int block_num; /* allocated blocks counter */ 50 | /* 51 | first free block in queue test counter (if it exceed 52 | MAX_BLOCK_USAGE_BEFORE_DROP block will be dropped in 'used' list) 53 | */ 54 | unsigned int first_block_usage; 55 | 56 | void (*error_handler)(void); 57 | 58 | PSI_memory_key m_psi_key; 59 | } MEM_ROOT; 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /src/common/mysql/include/my_command.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | 16 | #ifndef _mysql_command_h 17 | #define _mysql_command_h 18 | 19 | /** 20 | @enum enum_server_command 21 | @brief You should add new commands to the end of this list, otherwise old 22 | servers won't be able to handle them as 'unsupported'. 23 | */ 24 | enum enum_server_command 25 | { 26 | COM_SLEEP, 27 | COM_QUIT, 28 | COM_INIT_DB, 29 | COM_QUERY, 30 | COM_FIELD_LIST, 31 | COM_CREATE_DB, 32 | COM_DROP_DB, 33 | COM_REFRESH, 34 | COM_SHUTDOWN, 35 | COM_STATISTICS, 36 | COM_PROCESS_INFO, 37 | COM_CONNECT, 38 | COM_PROCESS_KILL, 39 | COM_DEBUG, 40 | COM_PING, 41 | COM_TIME, 42 | COM_DELAYED_INSERT, 43 | COM_CHANGE_USER, 44 | COM_BINLOG_DUMP, 45 | COM_TABLE_DUMP, 46 | COM_CONNECT_OUT, 47 | COM_REGISTER_SLAVE, 48 | COM_STMT_PREPARE, 49 | COM_STMT_EXECUTE, 50 | COM_STMT_SEND_LONG_DATA, 51 | COM_STMT_CLOSE, 52 | COM_STMT_RESET, 53 | COM_SET_OPTION, 54 | COM_STMT_FETCH, 55 | COM_DAEMON, 56 | COM_BINLOG_DUMP_GTID, 57 | COM_RESET_CONNECTION, 58 | /* don't forget to update const char *command_name[] in sql_parse.cc */ 59 | 60 | /* Must be last */ 61 | COM_END 62 | }; 63 | 64 | #endif /* _mysql_command_h */ 65 | -------------------------------------------------------------------------------- /src/common/mysql/include/my_dir.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | 16 | #ifndef MY_DIR_H 17 | #define MY_DIR_H 18 | 19 | #include "my_global.h" 20 | 21 | #include 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /* Defines for my_dir and my_stat */ 28 | 29 | #ifdef _WIN32 30 | #define S_IROTH _S_IREAD 31 | #define S_IFIFO _S_IFIFO 32 | #endif 33 | 34 | #define MY_S_IFMT S_IFMT /* type of file */ 35 | #define MY_S_IFDIR S_IFDIR /* directory */ 36 | #define MY_S_IFCHR S_IFCHR /* character special */ 37 | #define MY_S_IFBLK S_IFBLK /* block special */ 38 | #define MY_S_IFREG S_IFREG /* regular */ 39 | #define MY_S_IFIFO S_IFIFO /* fifo */ 40 | #define MY_S_ISUID S_ISUID /* set user id on execution */ 41 | #define MY_S_ISGID S_ISGID /* set group id on execution */ 42 | #define MY_S_ISVTX S_ISVTX /* save swapped text even after use */ 43 | #define MY_S_IREAD S_IREAD /* read permission, owner */ 44 | #define MY_S_IWRITE S_IWRITE /* write permission, owner */ 45 | #define MY_S_IEXEC S_IEXEC /* execute/search permission, owner */ 46 | 47 | #define MY_S_ISDIR(m) (((m) & MY_S_IFMT) == MY_S_IFDIR) 48 | #define MY_S_ISCHR(m) (((m) & MY_S_IFMT) == MY_S_IFCHR) 49 | #define MY_S_ISBLK(m) (((m) & MY_S_IFMT) == MY_S_IFBLK) 50 | #define MY_S_ISREG(m) (((m) & MY_S_IFMT) == MY_S_IFREG) 51 | #define MY_S_ISFIFO(m) (((m) & MY_S_IFMT) == MY_S_IFIFO) 52 | 53 | #define MY_DONT_SORT 512 /* my_lib; Don't sort files */ 54 | #define MY_WANT_STAT 1024 /* my_lib; stat files */ 55 | 56 | /* typedefs for my_dir & my_stat */ 57 | 58 | #if(_MSC_VER) 59 | #define MY_STAT struct _stati64 /* 64 bit file size */ 60 | #else 61 | #define MY_STAT struct stat /* Orginal struct have what we need */ 62 | #endif 63 | 64 | /* Struct describing one file returned from my_dir */ 65 | typedef struct fileinfo 66 | { 67 | char *name; 68 | MY_STAT *mystat; 69 | } FILEINFO; 70 | 71 | typedef struct st_my_dir /* Struct returned from my_dir */ 72 | { 73 | /* 74 | These members are just copies of parts of DYNAMIC_ARRAY structure, 75 | which is allocated right after the end of MY_DIR structure (MEM_ROOT 76 | for storing names is also resides there). We've left them here because 77 | we don't want to change code that uses my_dir. 78 | */ 79 | struct fileinfo *dir_entry; 80 | uint number_off_files; 81 | } MY_DIR; 82 | 83 | extern MY_DIR *my_dir(const char *path,myf MyFlags); 84 | extern void my_dirend(MY_DIR *buffer); 85 | extern MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags); 86 | extern int my_fstat(int filenr, MY_STAT *stat_area, myf MyFlags); 87 | 88 | #ifdef __cplusplus 89 | } 90 | #endif 91 | 92 | #endif /* MY_DIR_H */ 93 | 94 | -------------------------------------------------------------------------------- /src/common/mysql/include/my_list.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | 16 | #ifndef _list_h_ 17 | #define _list_h_ 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | typedef struct st_list { 24 | struct st_list *prev,*next; 25 | void *data; 26 | } LIST; 27 | 28 | typedef int (*list_walk_action)(void *,void *); 29 | 30 | extern LIST *list_add(LIST *root,LIST *element); 31 | extern LIST *list_delete(LIST *root,LIST *element); 32 | extern LIST *list_cons(void *data,LIST *root); 33 | extern LIST *list_reverse(LIST *root); 34 | extern void list_free(LIST *root,unsigned int free_data); 35 | extern unsigned int list_length(LIST *); 36 | extern int list_walk(LIST *,list_walk_action action,unsigned char * argument); 37 | 38 | #define list_rest(a) ((a)->next) 39 | #define list_push(a,b) (a)=list_cons((b),(a)) 40 | #define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old); my_free(old); } 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | #endif 46 | -------------------------------------------------------------------------------- /src/common/mysql/include/my_thread_local.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ 15 | 16 | #ifndef MY_THREAD_LOCAL_INCLUDED 17 | #define MY_THREAD_LOCAL_INCLUDED 18 | 19 | #ifndef _WIN32 20 | #include 21 | #endif 22 | 23 | struct _db_code_state_; 24 | typedef uint32 my_thread_id; 25 | 26 | C_MODE_START 27 | 28 | #ifdef _WIN32 29 | typedef DWORD thread_local_key_t; 30 | #else 31 | typedef pthread_key_t thread_local_key_t; 32 | #endif 33 | 34 | static inline int my_create_thread_local_key(thread_local_key_t *key, 35 | void (*destructor)(void *)) 36 | { 37 | #ifdef _WIN32 38 | *key= TlsAlloc(); 39 | return (*key == TLS_OUT_OF_INDEXES); 40 | #else 41 | return pthread_key_create(key, destructor); 42 | #endif 43 | } 44 | 45 | static inline int my_delete_thread_local_key(thread_local_key_t key) 46 | { 47 | #ifdef _WIN32 48 | return !TlsFree(key); 49 | #else 50 | return pthread_key_delete(key); 51 | #endif 52 | } 53 | 54 | static inline void* my_get_thread_local(thread_local_key_t key) 55 | { 56 | #ifdef _WIN32 57 | return TlsGetValue(key); 58 | #else 59 | return pthread_getspecific(key); 60 | #endif 61 | } 62 | 63 | static inline int my_set_thread_local(thread_local_key_t key, 64 | void *value) 65 | { 66 | #ifdef _WIN32 67 | return !TlsSetValue(key, value); 68 | #else 69 | return pthread_setspecific(key, value); 70 | #endif 71 | } 72 | 73 | /** 74 | Retrieve the MySQL thread-local storage variant of errno. 75 | */ 76 | int my_errno(); 77 | 78 | /** 79 | Set the MySQL thread-local storage variant of errno. 80 | */ 81 | void set_my_errno(int my_errno); 82 | 83 | #ifdef _WIN32 84 | /* 85 | thr_winerr is used for returning the original OS error-code in Windows, 86 | my_osmaperr() returns EINVAL for all unknown Windows errors, hence we 87 | preserve the original Windows Error code in thr_winerr. 88 | */ 89 | int thr_winerr(); 90 | 91 | void set_thr_winerr(int winerr); 92 | 93 | #endif 94 | 95 | #ifndef DBUG_OFF 96 | /* Return pointer to DBUG for holding current state */ 97 | struct _db_code_state_ **my_thread_var_dbug(); 98 | 99 | my_thread_id my_thread_var_id(); 100 | 101 | void set_my_thread_var_id(my_thread_id id); 102 | 103 | #endif 104 | 105 | C_MODE_END 106 | 107 | #endif // MY_THREAD_LOCAL_INCLUDED 108 | -------------------------------------------------------------------------------- /src/common/mysql/include/my_xml.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ 15 | 16 | 17 | #ifndef _my_xml_h 18 | #define _my_xml_h 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | 25 | #define MY_XML_OK 0 26 | #define MY_XML_ERROR 1 27 | 28 | /* 29 | A flag whether to use absolute tag names in call-back functions, 30 | like "a", "a.b" and "a.b.c" (used in character set file parser), 31 | or relative names like "a", "b" and "c". 32 | */ 33 | #define MY_XML_FLAG_RELATIVE_NAMES 1 34 | 35 | /* 36 | A flag whether to skip normilization of text values before calling 37 | call-back functions: i.e. skip leading/trailing spaces, 38 | \r, \n, \t characters. 39 | */ 40 | #define MY_XML_FLAG_SKIP_TEXT_NORMALIZATION 2 41 | 42 | enum my_xml_node_type 43 | { 44 | MY_XML_NODE_TAG, /* can have TAG, ATTR and TEXT children */ 45 | MY_XML_NODE_ATTR, /* can have TEXT children */ 46 | MY_XML_NODE_TEXT /* cannot have children */ 47 | }; 48 | 49 | typedef struct xml_stack_st 50 | { 51 | int flags; 52 | enum my_xml_node_type current_node_type; 53 | char errstr[128]; 54 | 55 | struct { 56 | char static_buffer[128]; 57 | char *buffer; 58 | size_t buffer_size; 59 | char *start; 60 | char *end; 61 | } attr; 62 | 63 | const char *beg; 64 | const char *cur; 65 | const char *end; 66 | void *user_data; 67 | int (*enter)(struct xml_stack_st *st,const char *val, size_t len); 68 | int (*value)(struct xml_stack_st *st,const char *val, size_t len); 69 | int (*leave_xml)(struct xml_stack_st *st,const char *val, size_t len); 70 | } MY_XML_PARSER; 71 | 72 | void my_xml_parser_create(MY_XML_PARSER *st); 73 | void my_xml_parser_free(MY_XML_PARSER *st); 74 | int my_xml_parse(MY_XML_PARSER *st,const char *str, size_t len); 75 | 76 | void my_xml_set_value_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *, 77 | const char *, 78 | size_t len)); 79 | void my_xml_set_enter_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *, 80 | const char *, 81 | size_t len)); 82 | void my_xml_set_leave_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *, 83 | const char *, 84 | size_t len)); 85 | void my_xml_set_user_data(MY_XML_PARSER *st, void *); 86 | 87 | size_t my_xml_error_pos(MY_XML_PARSER *st); 88 | uint my_xml_error_lineno(MY_XML_PARSER *st); 89 | 90 | const char *my_xml_error_string(MY_XML_PARSER *st); 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | #endif /* _my_xml_h */ 97 | -------------------------------------------------------------------------------- /src/common/mysql/include/mysql/client_authentication.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | #ifndef CLIENT_AUTHENTICATION_H 16 | #define CLIENT_AUTHENTICATION_H 17 | #include 18 | #include "mysql.h" 19 | #include "mysql/client_plugin.h" 20 | 21 | C_MODE_START 22 | int sha256_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql); 23 | int sha256_password_init(char *, size_t, int, va_list); 24 | int sha256_password_deinit(void); 25 | C_MODE_END 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /src/common/mysql/include/mysql/client_plugin.h.pp: -------------------------------------------------------------------------------- 1 | struct st_mysql_client_plugin 2 | { 3 | int type; unsigned int interface_version; const char *name; const char *author; const char *desc; unsigned int version[3]; const char *license; void *mysql_api; int (*init)(char *, size_t, int, va_list); int (*deinit)(void); int (*options)(const char *option, const void *); 4 | }; 5 | struct st_mysql; 6 | #include "plugin_auth_common.h" 7 | typedef struct st_plugin_vio_info 8 | { 9 | enum { MYSQL_VIO_INVALID, MYSQL_VIO_TCP, MYSQL_VIO_SOCKET, 10 | MYSQL_VIO_PIPE, MYSQL_VIO_MEMORY } protocol; 11 | int socket; 12 | } MYSQL_PLUGIN_VIO_INFO; 13 | typedef struct st_plugin_vio 14 | { 15 | int (*read_packet)(struct st_plugin_vio *vio, 16 | unsigned char **buf); 17 | int (*write_packet)(struct st_plugin_vio *vio, 18 | const unsigned char *packet, 19 | int packet_len); 20 | void (*info)(struct st_plugin_vio *vio, struct st_plugin_vio_info *info); 21 | } MYSQL_PLUGIN_VIO; 22 | struct st_mysql_client_plugin_AUTHENTICATION 23 | { 24 | int type; unsigned int interface_version; const char *name; const char *author; const char *desc; unsigned int version[3]; const char *license; void *mysql_api; int (*init)(char *, size_t, int, va_list); int (*deinit)(void); int (*options)(const char *option, const void *); 25 | int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, struct st_mysql *mysql); 26 | }; 27 | struct st_mysql_client_plugin * 28 | mysql_load_plugin(struct st_mysql *mysql, const char *name, int type, 29 | int argc, ...); 30 | struct st_mysql_client_plugin * 31 | mysql_load_plugin_v(struct st_mysql *mysql, const char *name, int type, 32 | int argc, va_list args); 33 | struct st_mysql_client_plugin * 34 | mysql_client_find_plugin(struct st_mysql *mysql, const char *name, int type); 35 | struct st_mysql_client_plugin * 36 | mysql_client_register_plugin(struct st_mysql *mysql, 37 | struct st_mysql_client_plugin *plugin); 38 | int mysql_plugin_options(struct st_mysql_client_plugin *plugin, 39 | const char *option, const void *value); 40 | -------------------------------------------------------------------------------- /src/common/mysql/include/mysql/get_password.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | 16 | /* 17 | ** Ask for a password from tty 18 | ** This is an own file to avoid conflicts with curses 19 | */ 20 | 21 | #ifndef MYSQL_GET_PASSWORD_H_INCLUDED 22 | #define MYSQL_GET_PASSWORD_H_INCLUDED 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | typedef char *(* strdup_handler_t)(const char *, int); 29 | char *get_tty_password_ext(const char *opt_message, 30 | strdup_handler_t strdup_function); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif /* ! MYSQL_GET_PASSWORD_H_INCLUDED */ 37 | -------------------------------------------------------------------------------- /src/common/mysql/include/mysql/mysql_lex_string.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | 16 | #ifndef MYSQL_LEX_STRING_INCLUDED 17 | #define MYSQL_LEX_STRING_INCLUDED 18 | 19 | struct st_mysql_lex_string 20 | { 21 | char *str; 22 | size_t length; 23 | }; 24 | typedef struct st_mysql_lex_string MYSQL_LEX_STRING; 25 | 26 | struct st_mysql_const_lex_string 27 | { 28 | const char *str; 29 | size_t length; 30 | }; 31 | typedef struct st_mysql_const_lex_string MYSQL_LEX_CSTRING; 32 | 33 | #endif // MYSQL_LEX_STRING_INCLUDED 34 | -------------------------------------------------------------------------------- /src/common/mysql/include/mysql/psi/mysql_idle.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software Foundation, 14 | 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ 15 | 16 | #ifndef MYSQL_IDLE_H 17 | #define MYSQL_IDLE_H 18 | 19 | /** 20 | @file mysql/psi/mysql_idle.h 21 | Instrumentation helpers for idle waits. 22 | */ 23 | 24 | #include "mysql/psi/psi.h" 25 | 26 | #ifndef PSI_IDLE_CALL 27 | #define PSI_IDLE_CALL(M) PSI_DYNAMIC_CALL(M) 28 | #endif 29 | 30 | /** 31 | @defgroup Idle_instrumentation Idle Instrumentation 32 | @ingroup Instrumentation_interface 33 | @{ 34 | */ 35 | 36 | /** 37 | @def MYSQL_START_IDLE_WAIT 38 | Instrumentation helper for table io_waits. 39 | This instrumentation marks the start of a wait event. 40 | @param LOCKER the locker 41 | @param STATE the locker state 42 | @sa MYSQL_END_IDLE_WAIT. 43 | */ 44 | #ifdef HAVE_PSI_IDLE_INTERFACE 45 | #define MYSQL_START_IDLE_WAIT(LOCKER, STATE) \ 46 | LOCKER= inline_mysql_start_idle_wait(STATE, __FILE__, __LINE__) 47 | #else 48 | #define MYSQL_START_IDLE_WAIT(LOCKER, STATE) \ 49 | do {} while (0) 50 | #endif 51 | 52 | /** 53 | @def MYSQL_END_IDLE_WAIT 54 | Instrumentation helper for idle waits. 55 | This instrumentation marks the end of a wait event. 56 | @param LOCKER the locker 57 | @sa MYSQL_START_IDLE_WAIT. 58 | */ 59 | #ifdef HAVE_PSI_IDLE_INTERFACE 60 | #define MYSQL_END_IDLE_WAIT(LOCKER) \ 61 | inline_mysql_end_idle_wait(LOCKER) 62 | #else 63 | #define MYSQL_END_IDLE_WAIT(LOCKER) \ 64 | do {} while (0) 65 | #endif 66 | 67 | #ifdef HAVE_PSI_IDLE_INTERFACE 68 | /** 69 | Instrumentation calls for MYSQL_START_IDLE_WAIT. 70 | @sa MYSQL_END_IDLE_WAIT. 71 | */ 72 | static inline struct PSI_idle_locker * 73 | inline_mysql_start_idle_wait(PSI_idle_locker_state *state, 74 | const char *src_file, int src_line) 75 | { 76 | struct PSI_idle_locker *locker; 77 | locker= PSI_IDLE_CALL(start_idle_wait)(state, src_file, src_line); 78 | return locker; 79 | } 80 | 81 | /** 82 | Instrumentation calls for MYSQL_END_IDLE_WAIT. 83 | @sa MYSQL_START_IDLE_WAIT. 84 | */ 85 | static inline void 86 | inline_mysql_end_idle_wait(struct PSI_idle_locker *locker) 87 | { 88 | if (likely(locker != NULL)) 89 | PSI_IDLE_CALL(end_idle_wait)(locker); 90 | } 91 | #endif 92 | 93 | /** @} (end of group Idle_instrumentation) */ 94 | 95 | #endif 96 | 97 | -------------------------------------------------------------------------------- /src/common/mysql/include/mysql/psi/mysql_memory.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software Foundation, 14 | 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ 15 | 16 | #ifndef MYSQL_MEMORY_H 17 | #define MYSQL_MEMORY_H 18 | 19 | /** 20 | @file mysql/psi/mysql_memory.h 21 | Instrumentation helpers for memory allocation. 22 | */ 23 | 24 | #include "mysql/psi/psi.h" 25 | 26 | #ifndef PSI_MEMORY_CALL 27 | #define PSI_MEMORY_CALL(M) PSI_DYNAMIC_CALL(M) 28 | #endif 29 | 30 | /** 31 | @defgroup Memory_instrumentation Memory Instrumentation 32 | @ingroup Instrumentation_interface 33 | @{ 34 | */ 35 | 36 | /** 37 | @def mysql_memory_register(P1, P2, P3) 38 | Memory registration. 39 | */ 40 | #define mysql_memory_register(P1, P2, P3) \ 41 | inline_mysql_memory_register(P1, P2, P3) 42 | 43 | static inline void inline_mysql_memory_register( 44 | #ifdef HAVE_PSI_MEMORY_INTERFACE 45 | const char *category, 46 | PSI_memory_info *info, 47 | int count) 48 | #else 49 | const char *category MY_ATTRIBUTE((unused)), 50 | void *info MY_ATTRIBUTE((unused)), 51 | int count MY_ATTRIBUTE((unused))) 52 | #endif 53 | { 54 | #ifdef HAVE_PSI_MEMORY_INTERFACE 55 | PSI_MEMORY_CALL(register_memory)(category, info, count); 56 | #endif 57 | } 58 | 59 | /** @} (end of group Memory_instrumentation) */ 60 | 61 | #endif 62 | 63 | -------------------------------------------------------------------------------- /src/common/mysql/include/mysql/psi/mysql_ps.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | 16 | #ifndef MYSQL_PS_H 17 | #define MYSQL_PS_H 18 | 19 | /** 20 | @file mysql/psi/mysql_ps.h 21 | Instrumentation helpers for prepared statements. 22 | */ 23 | 24 | #include "mysql/psi/psi.h" 25 | 26 | #ifndef PSI_PS_CALL 27 | #define PSI_PS_CALL(M) PSI_DYNAMIC_CALL(M) 28 | #endif 29 | 30 | #ifdef HAVE_PSI_PS_INTERFACE 31 | #define MYSQL_CREATE_PS(IDENTITY, ID, LOCKER, NAME, NAME_LENGTH, SQLTEXT, SQLTEXT_LENGTH) \ 32 | inline_mysql_create_prepared_stmt(IDENTITY, ID, LOCKER, NAME, NAME_LENGTH, SQLTEXT, SQLTEXT_LENGTH) 33 | #define MYSQL_EXECUTE_PS(LOCKER, PREPARED_STMT) \ 34 | inline_mysql_execute_prepared_stmt(LOCKER, PREPARED_STMT) 35 | #define MYSQL_DESTROY_PS(PREPARED_STMT) \ 36 | inline_mysql_destroy_prepared_stmt(PREPARED_STMT) 37 | #define MYSQL_REPREPARE_PS(PREPARED_STMT) \ 38 | inline_mysql_reprepare_prepared_stmt(PREPARED_STMT) 39 | #else 40 | #define MYSQL_CREATE_PS(IDENTITY, ID, LOCKER, NAME, NAME_LENGTH, SQLTEXT, SQLTEXT_LENGTH) \ 41 | NULL 42 | #define MYSQL_EXECUTE_PS(LOCKER, PREPARED_STMT) \ 43 | do {} while (0) 44 | #define MYSQL_DESTROY_PS(PREPARED_STMT) \ 45 | do {} while (0) 46 | #define MYSQL_REPREPARE_PS(PREPARED_STMT) \ 47 | do {} while (0) 48 | #endif 49 | 50 | #ifdef HAVE_PSI_PS_INTERFACE 51 | static inline struct PSI_prepared_stmt* 52 | inline_mysql_create_prepared_stmt(void *identity, uint stmt_id, 53 | PSI_statement_locker *locker, 54 | const char *stmt_name, size_t stmt_name_length, 55 | const char *sqltext, size_t sqltext_length) 56 | { 57 | if (locker == NULL) 58 | return NULL; 59 | return PSI_PS_CALL(create_prepared_stmt)(identity, stmt_id, 60 | locker, 61 | stmt_name, stmt_name_length, 62 | sqltext, sqltext_length); 63 | } 64 | 65 | static inline void 66 | inline_mysql_execute_prepared_stmt(PSI_statement_locker *locker, 67 | PSI_prepared_stmt* prepared_stmt) 68 | { 69 | if (prepared_stmt != NULL && locker != NULL) 70 | PSI_PS_CALL(execute_prepared_stmt)(locker, prepared_stmt); 71 | } 72 | 73 | static inline void 74 | inline_mysql_destroy_prepared_stmt(PSI_prepared_stmt *prepared_stmt) 75 | { 76 | if (prepared_stmt != NULL) 77 | PSI_PS_CALL(destroy_prepared_stmt)(prepared_stmt); 78 | } 79 | 80 | static inline void 81 | inline_mysql_reprepare_prepared_stmt(PSI_prepared_stmt *prepared_stmt) 82 | { 83 | if (prepared_stmt != NULL) 84 | PSI_PS_CALL(reprepare_prepared_stmt)(prepared_stmt); 85 | } 86 | #endif 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /src/common/mysql/include/mysql/psi/mysql_sp.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | 16 | #ifndef MYSQL_SP_H 17 | #define MYSQL_SP_H 18 | 19 | /** 20 | @file mysql/psi/mysql_sp.h 21 | Instrumentation helpers for stored programs. 22 | */ 23 | 24 | #include "mysql/psi/psi.h" 25 | 26 | #ifndef PSI_SP_CALL 27 | #define PSI_SP_CALL(M) PSI_DYNAMIC_CALL(M) 28 | #endif 29 | 30 | #ifdef HAVE_PSI_SP_INTERFACE 31 | #define MYSQL_START_SP(STATE, SP_SHARE) \ 32 | inline_mysql_start_sp(STATE, SP_SHARE) 33 | #else 34 | #define MYSQL_START_SP(STATE, SP_SHARE) \ 35 | NULL 36 | #endif 37 | 38 | 39 | #ifdef HAVE_PSI_SP_INTERFACE 40 | #define MYSQL_END_SP(LOCKER) \ 41 | inline_mysql_end_sp(LOCKER) 42 | #else 43 | #define MYSQL_END_SP(LOCKER) \ 44 | do {} while (0) 45 | #endif 46 | 47 | #ifdef HAVE_PSI_SP_INTERFACE 48 | #define MYSQL_DROP_SP(OT, SN, SNL, ON, ONL) \ 49 | inline_mysql_drop_sp(OT, SN, SNL, ON, ONL) 50 | #else 51 | #define MYSQL_DROP_SP(OT, SN, SNL, ON, ONL) \ 52 | do {} while (0) 53 | #endif 54 | 55 | #ifdef HAVE_PSI_SP_INTERFACE 56 | #define MYSQL_GET_SP_SHARE(OT, SN, SNL, ON, ONL) \ 57 | inline_mysql_get_sp_share(OT, SN, SNL, ON, ONL) 58 | #else 59 | #define MYSQL_GET_SP_SHARE(OT, SN, SNL, ON, ONL) \ 60 | NULL 61 | #endif 62 | 63 | #ifdef HAVE_PSI_SP_INTERFACE 64 | static inline struct PSI_sp_locker* 65 | inline_mysql_start_sp(PSI_sp_locker_state *state, PSI_sp_share *sp_share) 66 | { 67 | return PSI_SP_CALL(start_sp)(state, sp_share); 68 | } 69 | 70 | static inline void inline_mysql_end_sp(PSI_sp_locker *locker) 71 | { 72 | if (likely(locker != NULL)) 73 | PSI_SP_CALL(end_sp)(locker); 74 | } 75 | 76 | static inline void 77 | inline_mysql_drop_sp(uint sp_type, 78 | const char* schema_name, uint shcema_name_length, 79 | const char* object_name, uint object_name_length) 80 | { 81 | PSI_SP_CALL(drop_sp)(sp_type, 82 | schema_name, shcema_name_length, 83 | object_name, object_name_length); 84 | } 85 | 86 | static inline PSI_sp_share* 87 | inline_mysql_get_sp_share(uint sp_type, 88 | const char* schema_name, uint shcema_name_length, 89 | const char* object_name, uint object_name_length) 90 | { 91 | return PSI_SP_CALL(get_sp_share)(sp_type, 92 | schema_name, shcema_name_length, 93 | object_name, object_name_length); 94 | } 95 | #endif 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /src/common/mysql/include/mysql/service_mysql_alloc.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | 16 | #ifndef MYSQL_SERVICE_MYSQL_ALLOC_INCLUDED 17 | #define MYSQL_SERVICE_MYSQL_ALLOC_INCLUDED 18 | 19 | #ifndef MYSQL_ABI_CHECK 20 | #include 21 | #endif 22 | 23 | /* PSI_memory_key */ 24 | #include "mysql/psi/psi_memory.h" 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* myf */ 31 | typedef int myf_t; 32 | 33 | typedef void * (*mysql_malloc_t)(PSI_memory_key key, size_t size, myf_t flags); 34 | typedef void * (*mysql_realloc_t)(PSI_memory_key key, void *ptr, size_t size, myf_t flags); 35 | typedef void (*mysql_claim_t)(void *ptr); 36 | typedef void (*mysql_free_t)(void *ptr); 37 | typedef void * (*my_memdup_t)(PSI_memory_key key, const void *from, size_t length, myf_t flags); 38 | typedef char * (*my_strdup_t)(PSI_memory_key key, const char *from, myf_t flags); 39 | typedef char * (*my_strndup_t)(PSI_memory_key key, const char *from, size_t length, myf_t flags); 40 | 41 | struct mysql_malloc_service_st 42 | { 43 | mysql_malloc_t mysql_malloc; 44 | mysql_realloc_t mysql_realloc; 45 | mysql_claim_t mysql_claim; 46 | mysql_free_t mysql_free; 47 | my_memdup_t my_memdup; 48 | my_strdup_t my_strdup; 49 | my_strndup_t my_strndup; 50 | }; 51 | 52 | extern struct mysql_malloc_service_st *mysql_malloc_service; 53 | 54 | #ifdef MYSQL_DYNAMIC_PLUGIN 55 | 56 | #define my_malloc mysql_malloc_service->mysql_malloc 57 | #define my_realloc mysql_malloc_service->mysql_realloc 58 | #define my_claim mysql_malloc_service->mysql_claim 59 | #define my_free mysql_malloc_service->mysql_free 60 | #define my_memdup mysql_malloc_service->my_memdup 61 | #define my_strdup mysql_malloc_service->my_strdup 62 | #define my_strndup mysql_malloc_service->my_strndup 63 | 64 | #else 65 | 66 | extern void * my_malloc(PSI_memory_key key, size_t size, myf_t flags); 67 | extern void * my_realloc(PSI_memory_key key, void *ptr, size_t size, myf_t flags); 68 | extern void my_claim(void *ptr); 69 | extern void my_free(void *ptr); 70 | extern void * my_memdup(PSI_memory_key key, const void *from, size_t length, myf_t flags); 71 | extern char * my_strdup(PSI_memory_key key, const char *from, myf_t flags); 72 | extern char * my_strndup(PSI_memory_key key, const char *from, size_t length, myf_t flags); 73 | 74 | #endif 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | 80 | #endif 81 | 82 | -------------------------------------------------------------------------------- /src/common/mysql/include/mysql_com_server.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | 16 | /* 17 | Definitions private to the server, 18 | used in the networking layer to notify specific events. 19 | */ 20 | 21 | #ifndef _mysql_com_server_h 22 | #define _mysql_com_server_h 23 | 24 | struct st_net_server; 25 | 26 | typedef void (*before_header_callback_fn) 27 | (struct st_net *net, void *user_data, size_t count); 28 | 29 | typedef void (*after_header_callback_fn) 30 | (struct st_net *net, void *user_data, size_t count, my_bool rc); 31 | 32 | struct st_net_server 33 | { 34 | before_header_callback_fn m_before_header; 35 | after_header_callback_fn m_after_header; 36 | void *m_user_data; 37 | }; 38 | 39 | typedef struct st_net_server NET_SERVER; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/common/mysql/include/mysql_embed.h: -------------------------------------------------------------------------------- 1 | #ifndef MYSQL_EMBED_INCLUDED 2 | #define MYSQL_EMBED_INCLUDED 3 | 4 | /* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; version 2 of the License. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 18 | 19 | /* Defines that are unique to the embedded version of MySQL */ 20 | 21 | #ifdef EMBEDDED_LIBRARY 22 | 23 | /* Things we don't need in the embedded version of MySQL */ 24 | /* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */ 25 | 26 | #undef HAVE_DLOPEN /* No udf functions */ 27 | 28 | #endif /* EMBEDDED_LIBRARY */ 29 | #endif /* MYSQL_EMBED_INCLUDED */ 30 | -------------------------------------------------------------------------------- /src/common/mysql/include/mysql_time.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ 15 | 16 | #ifndef _mysql_time_h_ 17 | #define _mysql_time_h_ 18 | 19 | /* 20 | Time declarations shared between the server and client API: 21 | you should not add anything to this header unless it's used 22 | (and hence should be visible) in mysql.h. 23 | If you're looking for a place to add new time-related declaration, 24 | it's most likely my_time.h. See also "C API Handling of Date 25 | and Time Values" chapter in documentation. 26 | */ 27 | 28 | enum enum_mysql_timestamp_type 29 | { 30 | MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1, 31 | MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2 32 | }; 33 | 34 | 35 | /* 36 | Structure which is used to represent datetime values inside MySQL. 37 | 38 | We assume that values in this structure are normalized, i.e. year <= 9999, 39 | month <= 12, day <= 31, hour <= 23, hour <= 59, hour <= 59. Many functions 40 | in server such as my_system_gmt_sec() or make_time() family of functions 41 | rely on this (actually now usage of make_*() family relies on a bit weaker 42 | restriction). Also functions that produce MYSQL_TIME as result ensure this. 43 | There is one exception to this rule though if this structure holds time 44 | value (time_type == MYSQL_TIMESTAMP_TIME) days and hour member can hold 45 | bigger values. 46 | */ 47 | typedef struct st_mysql_time 48 | { 49 | unsigned int year, month, day, hour, minute, second; 50 | unsigned long second_part; /**< microseconds */ 51 | my_bool neg; 52 | enum enum_mysql_timestamp_type time_type; 53 | } MYSQL_TIME; 54 | 55 | #endif /* _mysql_time_h_ */ 56 | -------------------------------------------------------------------------------- /src/common/mysql/include/mysql_version.h: -------------------------------------------------------------------------------- 1 | /* Copyright Abandoned 1996,1999 TCX DataKonsult AB & Monty Program KB 2 | & Detron HB, 1996, 1999-2004, 2007 MySQL AB. 3 | This file is public domain and comes with NO WARRANTY of any kind 4 | */ 5 | 6 | /* Version numbers for protocol & mysqld */ 7 | 8 | #ifndef _mysql_version_h 9 | #define _mysql_version_h 10 | #ifdef _CUSTOMCONFIG_ 11 | #include 12 | #else 13 | #define PROTOCOL_VERSION 10 14 | #define MYSQL_SERVER_VERSION "5.7.16" 15 | #define MYSQL_VERSION_ID 50716 16 | #define MYSQL_PORT 3306 17 | #define MYSQL_PORT_DEFAULT 0 18 | #define MYSQL_UNIX_ADDR "/tmp/mysql.sock" 19 | #define MYSQL_CONFIG_NAME "my" 20 | #define MYSQL_COMPILATION_COMMENT "MySQL Connector/C (GPL)" 21 | #define LIBMYSQL_VERSION "6.1.11" 22 | #define LIBMYSQL_VERSION_ID 60111 23 | 24 | /* mysqld compile time options */ 25 | #endif /* _CUSTOMCONFIG_ */ 26 | 27 | #ifndef LICENSE 28 | #define LICENSE GPL 29 | #endif /* LICENSE */ 30 | 31 | #endif /* _mysql_version_h */ 32 | -------------------------------------------------------------------------------- /src/common/mysql/include/sslopt-case.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | 16 | #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) 17 | 18 | #ifndef MYSQL_CLIENT 19 | #error This header is supposed to be used only in the client 20 | #endif 21 | 22 | case OPT_SSL_MODE: 23 | opt_ssl_mode= find_type_or_exit(argument, &ssl_mode_typelib, 24 | opt->name); 25 | ssl_mode_set_explicitly= TRUE; 26 | break; 27 | case OPT_SSL_SSL: 28 | CLIENT_WARN_DEPRECATED("--ssl", "--ssl-mode"); 29 | if (!opt_use_ssl_arg) 30 | opt_ssl_mode= SSL_MODE_DISABLED; 31 | else if (opt_ssl_mode < SSL_MODE_REQUIRED) 32 | opt_ssl_mode= SSL_MODE_REQUIRED; 33 | break; 34 | case OPT_SSL_VERIFY_SERVER_CERT: 35 | CLIENT_WARN_DEPRECATED("--ssl-verify-server-cert", 36 | "--ssl-mode=VERIFY_IDENTITY"); 37 | if (!opt_ssl_verify_server_cert_arg) 38 | { 39 | if (opt_ssl_mode >= SSL_MODE_VERIFY_IDENTITY) 40 | opt_ssl_mode= SSL_MODE_VERIFY_CA; 41 | } 42 | else 43 | opt_ssl_mode= SSL_MODE_VERIFY_IDENTITY; 44 | break; 45 | case OPT_SSL_CA: 46 | case OPT_SSL_CAPATH: 47 | /* Don't change ssl-mode if set explicitly. */ 48 | if (!ssl_mode_set_explicitly) 49 | opt_ssl_mode= SSL_MODE_VERIFY_CA; 50 | break; 51 | case OPT_SSL_KEY: 52 | case OPT_SSL_CERT: 53 | case OPT_SSL_CIPHER: 54 | case OPT_SSL_CRL: 55 | case OPT_SSL_CRLPATH: 56 | case OPT_TLS_VERSION: 57 | #ifdef HAVE_YASSL 58 | /* crl has no effect in yaSSL. */ 59 | opt_ssl_crl= NULL; 60 | opt_ssl_crlpath= NULL; 61 | #endif /* HAVE_YASSL */ 62 | break; 63 | #endif /* HAVE_OPENSSL */ 64 | -------------------------------------------------------------------------------- /src/common/mysql/include/sslopt-longopts.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | 16 | #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) 17 | #ifdef MYSQL_CLIENT 18 | {"ssl-mode", OPT_SSL_MODE, 19 | "SSL connection mode.", 20 | 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 21 | {"ssl", OPT_SSL_SSL, 22 | "Deprecated. Use --ssl-mode instead.", 23 | &opt_use_ssl_arg, &opt_use_ssl_arg, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, 24 | {"ssl-verify-server-cert", OPT_SSL_VERIFY_SERVER_CERT, 25 | "Deprecated. Use --ssl-mode=VERIFY_IDENTITY instead.", 26 | &opt_ssl_verify_server_cert_arg, &opt_ssl_verify_server_cert_arg, 27 | 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, 28 | #else 29 | {"ssl", OPT_SSL_SSL, 30 | "If set to ON, this option enforces that SSL is established before client " 31 | "attempts to authenticate to the server. To disable client SSL capabilities " 32 | "use --ssl=OFF.", 33 | &opt_use_ssl, &opt_use_ssl, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, 34 | #endif 35 | {"ssl-ca", OPT_SSL_CA, 36 | "CA file in PEM format.", 37 | &opt_ssl_ca, &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG, 38 | 0, 0, 0, 0, 0, 0}, 39 | {"ssl-capath", OPT_SSL_CAPATH, 40 | "CA directory.", 41 | &opt_ssl_capath, &opt_ssl_capath, 0, GET_STR, REQUIRED_ARG, 42 | 0, 0, 0, 0, 0, 0}, 43 | {"ssl-cert", OPT_SSL_CERT, "X509 cert in PEM format.", 44 | &opt_ssl_cert, &opt_ssl_cert, 0, GET_STR, REQUIRED_ARG, 45 | 0, 0, 0, 0, 0, 0}, 46 | {"ssl-cipher", OPT_SSL_CIPHER, "SSL cipher to use.", 47 | &opt_ssl_cipher, &opt_ssl_cipher, 0, GET_STR, REQUIRED_ARG, 48 | 0, 0, 0, 0, 0, 0}, 49 | {"ssl-key", OPT_SSL_KEY, "X509 key in PEM format.", 50 | &opt_ssl_key, &opt_ssl_key, 0, GET_STR, REQUIRED_ARG, 51 | 0, 0, 0, 0, 0, 0}, 52 | {"ssl-crl", OPT_SSL_CRL, "Certificate revocation list.", 53 | &opt_ssl_crl, &opt_ssl_crl, 0, GET_STR, REQUIRED_ARG, 54 | 0, 0, 0, 0, 0, 0}, 55 | {"ssl-crlpath", OPT_SSL_CRLPATH, 56 | "Certificate revocation list path.", 57 | &opt_ssl_crlpath, &opt_ssl_crlpath, 0, GET_STR, REQUIRED_ARG, 58 | 0, 0, 0, 0, 0, 0}, 59 | {"tls-version", OPT_TLS_VERSION, "TLS version to use, " 60 | #ifndef HAVE_YASSL 61 | "permitted values are: TLSv1, TLSv1.1, TLSv1.2", 62 | #else 63 | "permitted values are: TLSv1, TLSv1.1", 64 | #endif 65 | &opt_tls_version, &opt_tls_version, 0, GET_STR, REQUIRED_ARG, 66 | 0, 0, 0, 0, 0, 0}, 67 | #endif /* HAVE_OPENSSL */ 68 | -------------------------------------------------------------------------------- /src/common/mysql/include/sslopt-vars.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 15 | 16 | #ifndef SSLOPT_VARS_INCLUDED 17 | #define SSLOPT_VARS_INCLUDED 18 | 19 | #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) 20 | 21 | #ifndef MYSQL_CLIENT 22 | #error This header is supposed to be used only in the client 23 | #endif 24 | 25 | const char *ssl_mode_names_lib[] = 26 | {"DISABLED", "PREFERRED", "REQUIRED", "VERIFY_CA", "VERIFY_IDENTITY", 27 | NullS }; 28 | TYPELIB ssl_mode_typelib = {array_elements(ssl_mode_names_lib) - 1, "", 29 | ssl_mode_names_lib, NULL}; 30 | 31 | static uint opt_ssl_mode = SSL_MODE_PREFERRED; 32 | static char *opt_ssl_ca = 0; 33 | static char *opt_ssl_capath = 0; 34 | static char *opt_ssl_cert = 0; 35 | static char *opt_ssl_cipher = 0; 36 | static char *opt_ssl_key = 0; 37 | static char *opt_ssl_crl = 0; 38 | static char *opt_ssl_crlpath = 0; 39 | static char *opt_tls_version = 0; 40 | static my_bool ssl_mode_set_explicitly= FALSE; 41 | static my_bool opt_use_ssl_arg= TRUE; 42 | static my_bool opt_ssl_verify_server_cert_arg= FALSE; 43 | 44 | static void set_client_ssl_options(MYSQL *mysql) 45 | { 46 | /* 47 | Print a warning if explicitly defined combination of --ssl-mode other than 48 | VERIFY_CA or VERIFY_IDENTITY with explicit --ssl-ca or --ssl-capath values. 49 | */ 50 | if (ssl_mode_set_explicitly && 51 | opt_ssl_mode < SSL_MODE_VERIFY_CA && 52 | (opt_ssl_ca || opt_ssl_capath)) 53 | { 54 | printf("WARNING: no verification of server certificate will be done. " 55 | "Use --ssl-mode=VERIFY_CA or VERIFY_IDENTITY.\n"); 56 | } 57 | 58 | /* Set SSL parameters: key, cert, ca, capath, cipher, clr, clrpath. */ 59 | if (opt_ssl_mode >= SSL_MODE_VERIFY_CA) 60 | mysql_ssl_set(mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, 61 | opt_ssl_capath, opt_ssl_cipher); 62 | else 63 | mysql_ssl_set(mysql, opt_ssl_key, opt_ssl_cert, NULL, 64 | NULL, opt_ssl_cipher); 65 | mysql_options(mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl); 66 | mysql_options(mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); 67 | mysql_options(mysql, MYSQL_OPT_TLS_VERSION, opt_tls_version); 68 | mysql_options(mysql, MYSQL_OPT_SSL_MODE, &opt_ssl_mode); 69 | } 70 | 71 | #define SSL_SET_OPTIONS(mysql) set_client_ssl_options(mysql); 72 | #else 73 | #define SSL_SET_OPTIONS(mysql) do { } while(0) 74 | #endif 75 | #endif /* SSLOPT_VARS_INCLUDED */ 76 | -------------------------------------------------------------------------------- /src/common/mysql/include/typelib.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ 15 | 16 | 17 | #ifndef _typelib_h 18 | #define _typelib_h 19 | 20 | #include "my_alloc.h" 21 | 22 | typedef struct st_typelib { /* Different types saved here */ 23 | unsigned int count; /* How many types */ 24 | const char *name; /* Name of typelib */ 25 | const char **type_names; 26 | unsigned int *type_lengths; 27 | } TYPELIB; 28 | 29 | extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int *error_position); 30 | extern int find_type_or_exit(const char *x, TYPELIB *typelib, 31 | const char *option); 32 | #define FIND_TYPE_BASIC 0 33 | /** makes @c find_type() require the whole name, no prefix */ 34 | #define FIND_TYPE_NO_PREFIX (1 << 0) 35 | /** always implicitely on, so unused, but old code may pass it */ 36 | #define FIND_TYPE_NO_OVERWRITE (1 << 1) 37 | /** makes @c find_type() accept a number */ 38 | #define FIND_TYPE_ALLOW_NUMBER (1 << 2) 39 | /** makes @c find_type() treat ',' as terminator */ 40 | #define FIND_TYPE_COMMA_TERM (1 << 3) 41 | 42 | extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags); 43 | extern void make_type(char *to,unsigned int nr,TYPELIB *typelib); 44 | extern const char *get_type(TYPELIB *typelib,unsigned int nr); 45 | extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from); 46 | 47 | extern TYPELIB sql_protocol_typelib; 48 | 49 | my_ulonglong find_set_from_flags(const TYPELIB *lib, unsigned int default_name, 50 | my_ulonglong cur_set, my_ulonglong default_set, 51 | const char *str, unsigned int length, 52 | char **err_pos, unsigned int *err_len); 53 | 54 | #endif /* _typelib_h */ 55 | -------------------------------------------------------------------------------- /src/common/mysql/lib/x64/libmysql.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sphereserver/Source/e1e47c154be28b0910d378ffbfa184c578aa778e/src/common/mysql/lib/x64/libmysql.dll -------------------------------------------------------------------------------- /src/common/mysql/lib/x64/libmysql.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sphereserver/Source/e1e47c154be28b0910d378ffbfa184c578aa778e/src/common/mysql/lib/x64/libmysql.lib -------------------------------------------------------------------------------- /src/common/mysql/lib/x86/libmysql.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sphereserver/Source/e1e47c154be28b0910d378ffbfa184c578aa778e/src/common/mysql/lib/x86/libmysql.dll -------------------------------------------------------------------------------- /src/common/mysql/lib/x86/libmysql.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sphereserver/Source/e1e47c154be28b0910d378ffbfa184c578aa778e/src/common/mysql/lib/x86/libmysql.lib -------------------------------------------------------------------------------- /src/common/os_unix.h: -------------------------------------------------------------------------------- 1 | #ifndef _INC_OS_UNIX_H 2 | #define _INC_OS_UNIX_H 3 | #pragma once 4 | 5 | #ifndef _WIN32 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | // Port some Windows stuff to Linux 17 | typedef unsigned char BYTE; // 8 bits 18 | #define BYTE_MAX UCHAR_MAX 19 | 20 | typedef unsigned short WORD; // 16 bits 21 | #define WORD_MAX USHRT_MAX 22 | 23 | typedef unsigned int DWORD; // 32 bits 24 | typedef uintptr_t DWORD_PTR, ULONG_PTR; 25 | #define DWORD_MAX UINT_MAX 26 | #define DWORD_PTR_MAX UINTPTR_MAX 27 | 28 | typedef int INT32; // 32 bits 29 | typedef unsigned int UINT32, UINT; // 32 bits 30 | typedef long LONG; // 32 bits 31 | typedef long long LONGLONG, INT64; // 64 bits 32 | typedef unsigned long long ULONGLONG, UINT64; // 64 bits 33 | 34 | typedef unsigned short WCHAR; 35 | typedef char TCHAR; 36 | typedef char *LPSTR, *LPTSTR; 37 | typedef const char *LPCSTR, *LPCTSTR; 38 | 39 | typedef int BOOL; 40 | 41 | #define MAKEWORD(l, h) ((WORD)(((BYTE)(l))|(((WORD)((BYTE)(h))) << 8))) 42 | #define MAKELONG(l, h) ((LONG)(((WORD)(l))|(((DWORD)((WORD)(h))) << 16))) 43 | #define LOWORD(l) ((WORD)((DWORD)(l) & 0xFFFF)) 44 | #define HIWORD(l) ((WORD)((DWORD)(l) >> 16)) 45 | #define LOBYTE(w) ((BYTE)((DWORD)(w) & 0xFF)) 46 | #define HIBYTE(w) ((BYTE)((DWORD)(w) >> 8)) 47 | 48 | #define FAR 49 | 50 | #define _cdecl 51 | #define __cdecl 52 | #define _vsnprintf vsnprintf 53 | #define Sleep(mSec) usleep(mSec * 1000) // arg is microseconds = 1/1000000 54 | #define SleepEx(mSec, unused) usleep(mSec * 1000) // arg is microseconds = 1/1000000 55 | 56 | #ifndef _MAX_PATH 57 | #define _MAX_PATH 260 58 | #endif 59 | 60 | #ifndef ERROR_SUCCESS 61 | #define ERROR_SUCCESS 0 62 | #endif 63 | 64 | #define E_FAIL 0x80004005 65 | 66 | #ifndef HKEY_LOCAL_MACHINE 67 | #define HKEY_LOCAL_MACHINE ((HKEY)0x80000002) 68 | #endif 69 | 70 | #ifndef UNREFERENCED_PARAMETER 71 | #define UNREFERENCED_PARAMETER(P) (void)(P) 72 | #endif 73 | 74 | inline void _strupr(TCHAR *pszStr) 75 | { 76 | for ( ; *pszStr != '\0'; ++pszStr ) 77 | *pszStr = toupper(*pszStr); 78 | } 79 | 80 | inline void _strlwr(TCHAR *pszStr) 81 | { 82 | for ( ; *pszStr != '\0'; ++pszStr ) 83 | *pszStr = tolower(*pszStr); 84 | } 85 | 86 | #endif // _WIN32 87 | #endif // _INC_OS_UNIX_H 88 | -------------------------------------------------------------------------------- /src/common/os_windows.h: -------------------------------------------------------------------------------- 1 | #ifndef _INC_OS_WINDOWS_H 2 | #define _INC_OS_WINDOWS_H 3 | #pragma once 4 | 5 | #ifdef _WIN32 6 | #undef FD_SETSIZE 7 | #define FD_SETSIZE 1024 // for max of n users ! default = 64 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | extern bool NTWindow_Init(HINSTANCE hInstance, int nCmdShow); 17 | extern void NTWindow_Exit(); 18 | extern void NTWindow_DeleteIcon(); 19 | extern bool NTWindow_OnTick(int iWaitmSec); 20 | extern bool NTWindow_PostMsg(LPCTSTR pszMsg); 21 | extern bool NTWindow_PostMsgColor(COLORREF color); 22 | extern void NTWindow_SetWindowTitle(LPCTSTR pszText = NULL); 23 | 24 | #if defined(_MSC_VER) && _MSC_VER < 1900 25 | #define snprintf sprintf_s 26 | #endif 27 | 28 | #ifdef __MINGW32__ 29 | // On MinGW the 'operator=' is private on many classes and UNREFERENCED_PARAMETER macro on MinGW is (P)=(P), so we have a compilation error here 30 | #ifdef UNREFERENCED_PARAMETER 31 | #undef UNREFERENCED_PARAMETER 32 | #endif 33 | #define UNREFERENCED_PARAMETER(P) (void)(P) 34 | 35 | // Not defined on MinGW 36 | typedef int LSTATUS; 37 | typedef void(__cdecl *_invalid_parameter_handler)(const wchar_t *, const wchar_t *, const wchar_t *, unsigned int, uintptr_t); 38 | 39 | // Stuctured exception handling Windows API not implemented on MinGW 40 | #define __except(P) catch(int) 41 | #endif 42 | 43 | #endif // _WIN32 44 | #endif // _INC_OS_WINDOWS_H 45 | -------------------------------------------------------------------------------- /src/common/sqlite/SQLite.h: -------------------------------------------------------------------------------- 1 | #ifndef _INC_SQLITE_H 2 | #define _INC_SQLITE_H 3 | #pragma once 4 | 5 | #include "../graycom.h" 6 | #include "sqlite3.h" 7 | 8 | typedef std::vector stdvstring; 9 | typedef std::vector vstrlist; 10 | typedef vstrlist row; 11 | 12 | class TablePtr; 13 | 14 | class CSQLite : public CScriptObj 15 | { 16 | public: 17 | static const char *m_sClassName; 18 | static const LPCTSTR sm_szLoadKeys[]; 19 | static const LPCTSTR sm_szVerbKeys[]; 20 | 21 | CSQLite(); 22 | ~CSQLite(); 23 | 24 | private: 25 | sqlite3 *m_socket; 26 | int m_resultCode; 27 | 28 | public: 29 | CVarDefMap m_QueryResult; 30 | 31 | public: 32 | void Connect(LPCTSTR pszFileName); 33 | void Close(); 34 | 35 | TablePtr QueryPtr(LPCTSTR pszQuery); 36 | void Query(LPCTSTR pszQuery, CVarDefMap &mapQueryResult); 37 | void Exec(LPCTSTR pszQuery); 38 | 39 | virtual bool r_GetRef(LPCTSTR &pszKey, CScriptObj *&pRef); 40 | virtual bool r_LoadVal(CScript &s); 41 | virtual bool r_WriteVal(LPCTSTR pszKey, CGString &sVal, CTextConsole *pSrc); 42 | virtual bool r_Verb(CScript &s, CTextConsole *pSrc); 43 | 44 | LPCTSTR GetName() const 45 | { 46 | return "SQLite_OBJ"; 47 | } 48 | 49 | private: 50 | void ConvertUTF8ToString(LPTSTR pszIn, stdvstring &pszOut); 51 | }; 52 | 53 | class Table 54 | { 55 | friend class CSQLite; 56 | 57 | public: 58 | Table(void) 59 | { 60 | m_iRows = m_iCols = 0; 61 | m_iPos = -1; 62 | }; 63 | virtual ~Table() { }; 64 | 65 | private: 66 | int m_iRows; 67 | int m_iCols; 68 | int m_iPos; 69 | 70 | row m_strlstCols; 71 | std::vector m_lstRows; 72 | 73 | public: 74 | bool GoRow(int iRow); 75 | LPCTSTR GetColName(int iCol); 76 | LPCTSTR GetColValue(int iCol); 77 | }; 78 | 79 | // Class to contain a pointer to a Table class, which will spare the user from freeing a pointer 80 | class TablePtr 81 | { 82 | public: 83 | TablePtr(); 84 | TablePtr(Table *pTable); 85 | virtual ~TablePtr(); 86 | 87 | public: 88 | Table *m_pTable; 89 | }; 90 | 91 | // Class for converting TCHAR to multi-byte UTF-8 and vice versa 92 | class UTF8MBSTR 93 | { 94 | public: 95 | UTF8MBSTR(LPCTSTR pszArgs); 96 | UTF8MBSTR(UTF8MBSTR &pszArgs); 97 | virtual ~UTF8MBSTR(); 98 | 99 | private: 100 | size_t m_iLen; 101 | char *m_pszUTF8_MultiByte; 102 | 103 | private: 104 | size_t ConvertStringToUTF8(LPCTSTR pszIn, char *&pszOut); 105 | 106 | public: 107 | operator char *(); 108 | }; 109 | 110 | #endif // _INC_SQLITE_H 111 | -------------------------------------------------------------------------------- /src/common/twofish/debug.h: -------------------------------------------------------------------------------- 1 | CONST int debugCompile = 0; 2 | #define DebugDump(x,s,R,XOR,doRot,showT,needBswap) 3 | #define DebugDumpKey(key) 4 | -------------------------------------------------------------------------------- /src/common/twofish/platform.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | PLATFORM.H -- Platform-specific defines for TWOFISH code 3 | 4 | Submitters: 5 | Bruce Schneier, Counterpane Systems 6 | Doug Whiting, Hi/fn 7 | John Kelsey, Counterpane Systems 8 | Chris Hall, Counterpane Systems 9 | David Wagner, UC Berkeley 10 | 11 | Code Author: Doug Whiting, Hi/fn 12 | 13 | Version 1.00 April 1998 14 | 15 | Copyright 1998, Hi/fn and Counterpane Systems. All rights reserved. 16 | 17 | Notes: 18 | * Tab size is set to 4 characters in this file 19 | 20 | ***************************************************************************/ 21 | 22 | /* use intrinsic rotate if possible */ 23 | #define ROL( x, y ) ( ( (x) << (y) ) | ( (x) >> ( 32 - (y) ) ) ) 24 | #define ROR( x, y ) ( ( (x) >> (y) ) | ( (x) << ( 32 - (y) ) ) ) 25 | 26 | #if defined(_MSC_VER) 27 | #include /* get prototypes for rotation functions */ 28 | #undef ROL 29 | #undef ROR 30 | #pragma intrinsic(_lrotl,_lrotr) /* use intrinsic compiler rotations */ 31 | #define ROL(x,n) _lrotl(x,n) 32 | #define ROR(x,n) _lrotr(x,n) 33 | #endif 34 | 35 | // Change this to compile on a BigEndian machine 36 | #if !defined(Q_OS_MAC) 37 | #define LittleEndianCrypt 1 38 | #endif 39 | #define ALIGN32 1 40 | 41 | #if LittleEndianCrypt 42 | #define Bswap(x) (x) /* NOP for little-endian machines */ 43 | #define ADDR_XOR 0 /* NOP for little-endian machines */ 44 | #else 45 | #define Bswap(x) ((ROR(x,8) & 0xFF00FF00) | (ROL(x,8) & 0x00FF00FF)) 46 | #define ADDR_XOR 3 /* convert byte address in dword */ 47 | #endif 48 | 49 | /* Macros for extracting bytes from dwords (correct for endianness) */ 50 | #define _b(x,N) (((BYTE *)&x)[((N) & 3) ^ ADDR_XOR]) /* pick bytes out of a dword */ 51 | 52 | #define b0(x) _b(x,0) /* extract LSB of DWORD */ 53 | #define b1(x) _b(x,1) 54 | #define b2(x) _b(x,2) 55 | #define b3(x) _b(x,3) /* extract MSB of DWORD */ 56 | 57 | -------------------------------------------------------------------------------- /src/common/version/GitRevision.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sphereserver/Source/e1e47c154be28b0910d378ffbfa184c578aa778e/src/common/version/GitRevision.h -------------------------------------------------------------------------------- /src/common/version/GitRevision.h.in: -------------------------------------------------------------------------------- 1 | #define __GITHASH__ "@GITHASHCMD@" 2 | #define __GITREVISION__ @GITREVCMD@ 3 | -------------------------------------------------------------------------------- /src/common/zlib/INDEX: -------------------------------------------------------------------------------- 1 | CMakeLists.txt cmake build file 2 | ChangeLog history of changes 3 | FAQ Frequently Asked Questions about zlib 4 | INDEX this file 5 | Makefile dummy Makefile that tells you to ./configure 6 | Makefile.in template for Unix Makefile 7 | README guess what 8 | configure configure script for Unix 9 | make_vms.com makefile for VMS 10 | test/example.c zlib usages examples for build testing 11 | test/minigzip.c minimal gzip-like functionality for build testing 12 | test/infcover.c inf*.c code coverage for build coverage testing 13 | treebuild.xml XML description of source file dependencies 14 | zconf.h.cmakein zconf.h template for cmake 15 | zconf.h.in zconf.h template for configure 16 | zlib.3 Man page for zlib 17 | zlib.3.pdf Man page in PDF format 18 | zlib.map Linux symbol information 19 | zlib.pc.in Template for pkg-config descriptor 20 | zlib.pc.cmakein zlib.pc template for cmake 21 | zlib2ansi perl script to convert source files for C++ compilation 22 | 23 | amiga/ makefiles for Amiga SAS C 24 | as400/ makefiles for AS/400 25 | doc/ documentation for formats and algorithms 26 | msdos/ makefiles for MSDOS 27 | nintendods/ makefile for Nintendo DS 28 | old/ makefiles for various architectures and zlib documentation 29 | files that have not yet been updated for zlib 1.2.x 30 | qnx/ makefiles for QNX 31 | watcom/ makefiles for OpenWatcom 32 | win32/ makefiles for Windows 33 | 34 | zlib public header files (required for library use): 35 | zconf.h 36 | zlib.h 37 | 38 | private source files used to build the zlib library: 39 | adler32.c 40 | compress.c 41 | crc32.c 42 | crc32.h 43 | deflate.c 44 | deflate.h 45 | gzclose.c 46 | gzguts.h 47 | gzlib.c 48 | gzread.c 49 | gzwrite.c 50 | infback.c 51 | inffast.c 52 | inffast.h 53 | inffixed.h 54 | inflate.c 55 | inflate.h 56 | inftrees.c 57 | inftrees.h 58 | trees.c 59 | trees.h 60 | uncompr.c 61 | zutil.c 62 | zutil.h 63 | 64 | source files for sample programs 65 | See examples/README.examples 66 | 67 | unsupported contributions by third parties 68 | See contrib/README.contrib 69 | -------------------------------------------------------------------------------- /src/common/zlib/compress.c: -------------------------------------------------------------------------------- 1 | /* compress.c -- compress a memory buffer 2 | * Copyright (C) 1995-2005, 2014, 2016 Jean-loup Gailly, Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #define ZLIB_INTERNAL 9 | #include "zlib.h" 10 | 11 | /* =========================================================================== 12 | Compresses the source buffer into the destination buffer. The level 13 | parameter has the same meaning as in deflateInit. sourceLen is the byte 14 | length of the source buffer. Upon entry, destLen is the total size of the 15 | destination buffer, which must be at least 0.1% larger than sourceLen plus 16 | 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. 17 | 18 | compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough 19 | memory, Z_BUF_ERROR if there was not enough room in the output buffer, 20 | Z_STREAM_ERROR if the level parameter is invalid. 21 | */ 22 | int ZEXPORT compress2(dest, destLen, source, sourceLen, level) 23 | Bytef *dest; 24 | uLongf *destLen; 25 | const Bytef *source; 26 | uLong sourceLen; 27 | int level; 28 | { 29 | z_stream stream; 30 | int err; 31 | const uInt max = (uInt)-1; 32 | uLong left; 33 | 34 | left = *destLen; 35 | *destLen = 0; 36 | 37 | stream.zalloc = (alloc_func)0; 38 | stream.zfree = (free_func)0; 39 | stream.opaque = (voidpf)0; 40 | 41 | err = deflateInit(&stream, level); 42 | if (err != Z_OK) return err; 43 | 44 | stream.next_out = dest; 45 | stream.avail_out = 0; 46 | stream.next_in = (z_const Bytef *)source; 47 | stream.avail_in = 0; 48 | 49 | do { 50 | if (stream.avail_out == 0) { 51 | stream.avail_out = left > (uLong)max ? max : (uInt)left; 52 | left -= stream.avail_out; 53 | } 54 | if (stream.avail_in == 0) { 55 | stream.avail_in = sourceLen > (uLong)max ? max : (uInt)sourceLen; 56 | sourceLen -= stream.avail_in; 57 | } 58 | err = deflate(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH); 59 | } while (err == Z_OK); 60 | 61 | *destLen = stream.total_out; 62 | deflateEnd(&stream); 63 | return err == Z_STREAM_END ? Z_OK : err; 64 | } 65 | 66 | /* =========================================================================== 67 | */ 68 | int ZEXPORT compress(dest, destLen, source, sourceLen) 69 | Bytef *dest; 70 | uLongf *destLen; 71 | const Bytef *source; 72 | uLong sourceLen; 73 | { 74 | return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); 75 | } 76 | 77 | /* =========================================================================== 78 | If the default memLevel or windowBits for deflateInit() is changed, then 79 | this function needs to be updated. 80 | */ 81 | uLong ZEXPORT compressBound(sourceLen) 82 | uLong sourceLen; 83 | { 84 | return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 85 | (sourceLen >> 25) + 13; 86 | } 87 | -------------------------------------------------------------------------------- /src/common/zlib/gzclose.c: -------------------------------------------------------------------------------- 1 | /* gzclose.c -- zlib gzclose() function 2 | * Copyright (C) 2004, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | #include "gzguts.h" 7 | 8 | /* gzclose() is in a separate file so that it is linked in only if it is used. 9 | That way the other gzclose functions can be used instead to avoid linking in 10 | unneeded compression or decompression routines. */ 11 | int ZEXPORT gzclose(file) 12 | gzFile file; 13 | { 14 | #ifndef NO_GZCOMPRESS 15 | gz_statep state; 16 | 17 | if (file == NULL) 18 | return Z_STREAM_ERROR; 19 | state = (gz_statep)file; 20 | 21 | return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); 22 | #else 23 | return gzclose_r(file); 24 | #endif 25 | } 26 | -------------------------------------------------------------------------------- /src/common/zlib/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); 12 | -------------------------------------------------------------------------------- /src/common/zlib/inftrees.h: -------------------------------------------------------------------------------- 1 | /* inftrees.h -- header to use inftrees.c 2 | * Copyright (C) 1995-2005, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | /* Structure for decoding tables. Each entry provides either the 12 | information needed to do the operation requested by the code that 13 | indexed that table entry, or it provides a pointer to another 14 | table that indexes more bits of the code. op indicates whether 15 | the entry is a pointer to another table, a literal, a length or 16 | distance, an end-of-block, or an invalid code. For a table 17 | pointer, the low four bits of op is the number of index bits of 18 | that table. For a length or distance, the low four bits of op 19 | is the number of extra bits to get after the code. bits is 20 | the number of bits in this code or part of the code to drop off 21 | of the bit buffer. val is the actual byte to output in the case 22 | of a literal, the base length or distance, or the offset from 23 | the current table to the next table. Each entry is four bytes. */ 24 | typedef struct { 25 | unsigned char op; /* operation, extra bits, table bits */ 26 | unsigned char bits; /* bits in this part of the code */ 27 | unsigned short val; /* offset in table or code value */ 28 | } code; 29 | 30 | /* op values as set by inflate_table(): 31 | 00000000 - literal 32 | 0000tttt - table link, tttt != 0 is the number of table index bits 33 | 0001eeee - length or distance, eeee is the number of extra bits 34 | 01100000 - end of block 35 | 01000000 - invalid code 36 | */ 37 | 38 | /* Maximum size of the dynamic table. The maximum number of code structures is 39 | 1444, which is the sum of 852 for literal/length codes and 592 for distance 40 | codes. These values were found by exhaustive searches using the program 41 | examples/enough.c found in the zlib distribution. The arguments to that 42 | program are the number of symbols, the initial root table size, and the 43 | maximum bit length of a code. "enough 286 9 15" for literal/length codes 44 | returns returns 852, and "enough 30 6 15" for distance codes returns 592. 45 | The initial root table size (9 or 6) is found in the fifth argument of the 46 | inflate_table() calls in inflate.c and infback.c. If the root table size is 47 | changed, then these maximum sizes would be need to be recalculated and 48 | updated. */ 49 | #define ENOUGH_LENS 852 50 | #define ENOUGH_DISTS 592 51 | #define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS) 52 | 53 | /* Type of code to build for inflate_table() */ 54 | typedef enum { 55 | CODES, 56 | LENS, 57 | DISTS 58 | } codetype; 59 | 60 | int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens, 61 | unsigned codes, code FAR * FAR *table, 62 | unsigned FAR *bits, unsigned short FAR *work)); 63 | -------------------------------------------------------------------------------- /src/common/zlib/uncompr.c: -------------------------------------------------------------------------------- 1 | /* uncompr.c -- decompress a memory buffer 2 | * Copyright (C) 1995-2003, 2010, 2014, 2016 Jean-loup Gailly, Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #define ZLIB_INTERNAL 9 | #include "zlib.h" 10 | 11 | /* =========================================================================== 12 | Decompresses the source buffer into the destination buffer. *sourceLen is 13 | the byte length of the source buffer. Upon entry, *destLen is the total size 14 | of the destination buffer, which must be large enough to hold the entire 15 | uncompressed data. (The size of the uncompressed data must have been saved 16 | previously by the compressor and transmitted to the decompressor by some 17 | mechanism outside the scope of this compression library.) Upon exit, 18 | *destLen is the size of the decompressed data and *sourceLen is the number 19 | of source bytes consumed. Upon return, source + *sourceLen points to the 20 | first unused input byte. 21 | 22 | uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough 23 | memory, Z_BUF_ERROR if there was not enough room in the output buffer, or 24 | Z_DATA_ERROR if the input data was corrupted, including if the input data is 25 | an incomplete zlib stream. 26 | */ 27 | int ZEXPORT uncompress2(dest, destLen, source, sourceLen) 28 | Bytef *dest; 29 | uLongf *destLen; 30 | const Bytef *source; 31 | uLong *sourceLen; 32 | { 33 | z_stream stream; 34 | int err; 35 | const uInt max = (uInt)-1; 36 | uLong len, left; 37 | Byte buf[1]; /* for detection of incomplete stream when *destLen == 0 */ 38 | 39 | len = *sourceLen; 40 | if (*destLen) { 41 | left = *destLen; 42 | *destLen = 0; 43 | } 44 | else { 45 | left = 1; 46 | dest = buf; 47 | } 48 | 49 | stream.next_in = (z_const Bytef *)source; 50 | stream.avail_in = 0; 51 | stream.zalloc = (alloc_func)0; 52 | stream.zfree = (free_func)0; 53 | stream.opaque = (voidpf)0; 54 | 55 | err = inflateInit(&stream); 56 | if (err != Z_OK) return err; 57 | 58 | stream.next_out = dest; 59 | stream.avail_out = 0; 60 | 61 | do { 62 | if (stream.avail_out == 0) { 63 | stream.avail_out = left > (uLong)max ? max : (uInt)left; 64 | left -= stream.avail_out; 65 | } 66 | if (stream.avail_in == 0) { 67 | stream.avail_in = len > (uLong)max ? max : (uInt)len; 68 | len -= stream.avail_in; 69 | } 70 | err = inflate(&stream, Z_NO_FLUSH); 71 | } while (err == Z_OK); 72 | 73 | *sourceLen -= len + stream.avail_in; 74 | if (dest != buf) 75 | *destLen = stream.total_out; 76 | else if (stream.total_out && err == Z_BUF_ERROR) 77 | left = 1; 78 | 79 | inflateEnd(&stream); 80 | return err == Z_STREAM_END ? Z_OK : 81 | err == Z_NEED_DICT ? Z_DATA_ERROR : 82 | err == Z_BUF_ERROR && left + stream.avail_out ? Z_DATA_ERROR : 83 | err; 84 | } 85 | 86 | int ZEXPORT uncompress(dest, destLen, source, sourceLen) 87 | Bytef *dest; 88 | uLongf *destLen; 89 | const Bytef *source; 90 | uLong sourceLen; 91 | { 92 | return uncompress2(dest, destLen, source, &sourceLen); 93 | } 94 | -------------------------------------------------------------------------------- /src/graysvr/CGMPage.h: -------------------------------------------------------------------------------- 1 | #ifndef _INC_CGMPAGE_H 2 | #define _INC_CGMPAGE_H 3 | #pragma once 4 | 5 | class CGMPage : public CGObListRec, public CScriptObj 6 | { 7 | // RES_GMPAGE 8 | public: 9 | static const char *m_sClassName; 10 | static const LPCTSTR sm_szLoadKeys[]; 11 | 12 | CGMPage(LPCTSTR pszAccount); 13 | ~CGMPage(); 14 | 15 | public: 16 | CClient *m_pClientHandling; 17 | CGString m_sAccount; 18 | CGrayUID m_uidChar; 19 | CPointMap m_pt; 20 | CGString m_sReason; 21 | CServTime m_time; 22 | 23 | public: 24 | void SetHandler(CClient *pClient); 25 | void ClearHandler(); 26 | 27 | LPCTSTR GetName() const 28 | { 29 | return m_sAccount; 30 | } 31 | 32 | CGMPage *GetNext() const 33 | { 34 | return static_cast(CGObListRec::GetNext()); 35 | } 36 | 37 | void r_Write(CScript &s) const; 38 | bool r_WriteVal(LPCTSTR pszKey, CGString &sVal, CTextConsole *pSrc); 39 | bool r_LoadVal(CScript &s); 40 | 41 | private: 42 | CGMPage(const CGMPage ©); 43 | CGMPage &operator=(const CGMPage &other); 44 | }; 45 | 46 | #endif // _INC_CGMPAGE_H 47 | -------------------------------------------------------------------------------- /src/graysvr/CItemMulti.h: -------------------------------------------------------------------------------- 1 | #ifndef _INC_CITEMMULTI_H 2 | #define _INC_CITEMMULTI_H 3 | #pragma once 4 | 5 | class CItemMulti : public CItem 6 | { 7 | // IT_MULTI 8 | // IT_MULTI_CUSTOM 9 | // IT_SHIP 10 | public: 11 | static const char *m_sClassName; 12 | 13 | CItemMulti(ITEMID_TYPE id, CItemBase *pItemDef); 14 | virtual ~CItemMulti(); 15 | 16 | private: 17 | static const LPCTSTR sm_szLoadKeys[]; 18 | static const LPCTSTR sm_szVerbKeys[]; 19 | 20 | public: 21 | CRegionWorld *m_pRegion; 22 | 23 | struct ShipSpeed 24 | { 25 | BYTE period; // time between movement 26 | BYTE tiles; // distance to move 27 | }; 28 | ShipSpeed m_shipSpeed; 29 | BYTE m_SpeedMode; 30 | 31 | public: 32 | static const CItemBaseMulti *Multi_GetDef(ITEMID_TYPE id); 33 | int Multi_GetMaxDist() const; 34 | void MultiRealizeRegion(); 35 | void MultiUnRealizeRegion(); 36 | void Multi_Create(CChar *pChar); 37 | 38 | CItem *Multi_GetSign(); 39 | void OnHearRegion(LPCTSTR pszCmd, CChar *pSrc); 40 | 41 | virtual bool OnTick(); 42 | virtual void OnMoveFrom(); 43 | virtual bool MoveTo(CPointMap pt, bool fForceFix = false); 44 | 45 | virtual bool r_GetRef(LPCTSTR &pszKey, CScriptObj *&pRef); 46 | virtual bool r_Verb(CScript &s, CTextConsole *pSrc); // execute command from script 47 | virtual void r_Write(CScript &s); 48 | virtual bool r_WriteVal(LPCTSTR pszKey, CGString &sVal, CTextConsole *pSrc); 49 | virtual bool r_LoadVal(CScript &s); 50 | virtual void DupeCopy(const CItem *pItem); 51 | 52 | protected: 53 | bool Multi_CreateComponent(ITEMID_TYPE id, signed short x, signed short y, signed char z, DWORD dwKeyCode); 54 | bool Multi_IsPartOf(const CItem *pItem) const; 55 | 56 | CItem *Multi_FindItemType(IT_TYPE type) const; 57 | 58 | const CItemBaseMulti *Multi_GetDef() const 59 | { 60 | return dynamic_cast(Base_GetDef()); 61 | } 62 | 63 | virtual void OnComponentCreate(const CItem *pComponent) 64 | { 65 | UNREFERENCED_PARAMETER(pComponent); 66 | } 67 | 68 | private: 69 | CItemMulti(const CItemMulti ©); 70 | CItemMulti &operator=(const CItemMulti &other); 71 | }; 72 | 73 | #endif // _INC_CITEMMULTI_H 74 | -------------------------------------------------------------------------------- /src/graysvr/CItemMultiCustom.h: -------------------------------------------------------------------------------- 1 | #ifndef _INC_CITEMMULTICUSTOM_H 2 | #define _INC_CITEMMULTICUSTOM_H 3 | #pragma once 4 | 5 | class PacketHouseDesign; 6 | 7 | class CItemMultiCustom : public CItemMulti 8 | { 9 | // IT_MULTI_CUSTOM 10 | public: 11 | static const char *m_sClassName; 12 | 13 | CItemMultiCustom(ITEMID_TYPE id, CItemBase *pItemDef); 14 | virtual ~CItemMultiCustom(); 15 | 16 | private: 17 | static const LPCTSTR sm_szLoadKeys[]; 18 | static const LPCTSTR sm_szVerbKeys[]; 19 | 20 | public: 21 | struct Component 22 | { 23 | CUOMultiItemRecHS m_item; 24 | int m_iStairID; 25 | bool m_fFloor; 26 | }; 27 | 28 | private: 29 | typedef std::vector ComponentsContainer; 30 | struct DesignDetails 31 | { 32 | DWORD m_dwRevision; 33 | ComponentsContainer m_vectorComponents; 34 | PacketHouseDesign *m_pPacket; 35 | DWORD m_dwPacketRevision; 36 | }; 37 | 38 | class CGrayMultiCustom : public CGrayMulti 39 | { 40 | public: 41 | CGrayMultiCustom() { }; 42 | void LoadFrom(DesignDetails *pDesign); 43 | 44 | private: 45 | CGrayMultiCustom(const CGrayMultiCustom ©); 46 | CGrayMultiCustom &operator=(const CGrayMultiCustom &other); 47 | }; 48 | 49 | private: 50 | DesignDetails m_designMain; 51 | DesignDetails m_designWorking; 52 | DesignDetails m_designBackup; 53 | 54 | CClient *m_pArchitect; 55 | CGrayMultiCustom *m_pGrayMulti; 56 | CRectMap m_rectDesignArea; 57 | 58 | typedef std::map ValidItemsContainer; // ItemID, FeatureMask 59 | static ValidItemsContainer sm_mapValidItems; 60 | 61 | public: 62 | void BeginCustomize(CClient *pClient); 63 | void EndCustomize(bool fForce = false); 64 | 65 | void AddItem(CClient *pClient, ITEMID_TYPE id, signed short x, signed short y, signed char z = SCHAR_MIN, int iStairID = 0); 66 | void RemoveItem(CClient *pClient, ITEMID_TYPE id, signed short x, signed short y, signed char z); 67 | 68 | void AddStairs(CClient *pClient, ITEMID_TYPE id, signed short x, signed short y, signed char z = SCHAR_MIN); 69 | 70 | void AddRoof(CClient *pClient, ITEMID_TYPE id, signed short x, signed short y, signed char z); 71 | void RemoveRoof(CClient *pClient, ITEMID_TYPE id, signed short x, signed short y, signed char z); 72 | 73 | void SwitchToLevel(CClient *pClient, BYTE bLevel); 74 | void BackupStructure(); 75 | void RestoreStructure(CClient *pClient = NULL); 76 | void RevertChanges(CClient *pClient = NULL); 77 | void ResetStructure(CClient *pClient = NULL); 78 | void CommitChanges(CClient *pClient = NULL); 79 | 80 | void SendVersionTo(CClient *pClient); 81 | void SendStructureTo(CClient *pClient); 82 | 83 | DWORD GetRevision(const CClient *pClient = NULL) const; 84 | size_t GetFixtureCount(DesignDetails *pDesign); 85 | size_t GetComponentsAt(signed short x, signed short y, signed char z, Component **ppComponentList, DesignDetails *pDesign); 86 | 87 | const CGrayMultiCustom *GetMultiItemDefs(); 88 | const CGRect GetDesignArea(); 89 | static BYTE GetLevel(signed short z); 90 | static signed char GetLevelZ(BYTE bLevel); 91 | 92 | private: 93 | const CPointMap GetComponentPoint(Component *pComponent) const; 94 | void CopyDesign(DesignDetails *pDesignFrom, DesignDetails *pDesignTo); 95 | 96 | static bool IsValidItem(ITEMID_TYPE id, CClient *pClient, bool fMulti); 97 | static bool LoadValidItems(); 98 | 99 | virtual bool r_GetRef(LPCTSTR &pszKey, CScriptObj *&pRef); 100 | virtual bool r_Verb(CScript &s, CTextConsole *pSrc); // execute command from script 101 | virtual void r_Write(CScript &s); 102 | virtual bool r_WriteVal(LPCTSTR pszKey, CGString &sVal, CTextConsole *pSrc); 103 | virtual bool r_LoadVal(CScript &s); 104 | 105 | private: 106 | CItemMultiCustom(const CItemMultiCustom ©); 107 | CItemMultiCustom &operator=(const CItemMultiCustom &other); 108 | }; 109 | 110 | #endif // _INC_CITEMMULTICUSTOM_H 111 | -------------------------------------------------------------------------------- /src/graysvr/CItemShip.h: -------------------------------------------------------------------------------- 1 | #ifndef _INC_CITEMSHIP_H 2 | #define _INC_CITEMSHIP_H 3 | #pragma once 4 | 5 | class CItemShip : public CItemMulti 6 | { 7 | // IT_SHIP 8 | public: 9 | static const char *m_sClassName; 10 | 11 | CItemShip(ITEMID_TYPE id, CItemBase *pItemDef); 12 | virtual ~CItemShip(); 13 | 14 | private: 15 | static const LPCTSTR sm_szLoadKeys[]; 16 | static const LPCTSTR sm_szVerbKeys[]; 17 | 18 | CGrayUID m_uidHold; 19 | std::vector m_uidPlanks; 20 | CServTime m_NextMove; 21 | 22 | public: 23 | void Ship_Stop(); 24 | void Ship_SetPilot(CChar *pChar); 25 | bool Ship_SetMoveDir(DIR_TYPE dir, BYTE bSpeed = 2, bool fWheelMove = false); 26 | bool Ship_Face(DIR_TYPE dir); 27 | bool Ship_Move(DIR_TYPE dir, int iDist); 28 | 29 | CItemContainer *GetShipHold(); 30 | size_t GetShipPlankCount(); 31 | CItem *GetShipPlank(size_t index); 32 | 33 | virtual bool OnTick(); 34 | 35 | private: 36 | size_t Ship_ListObjs(CObjBase **ppObjList); 37 | bool Ship_MoveDelta(CPointBase ptDelta, bool fMapBoundary = false); 38 | bool Ship_CanMoveTo(const CPointMap &pt) const; 39 | bool Ship_OnMoveTick(); 40 | 41 | int Ship_GetFaceOffset() const 42 | { 43 | return (GetID() & 3); 44 | } 45 | 46 | virtual bool r_GetRef(LPCTSTR &pszKey, CScriptObj *&pRef); 47 | virtual bool r_Verb(CScript &s, CTextConsole *pSrc); // execute command from script 48 | virtual void r_Write(CScript &s); 49 | virtual bool r_WriteVal(LPCTSTR pszKey, CGString &sVal, CTextConsole *pSrc); 50 | virtual bool r_LoadVal(CScript &s); 51 | 52 | virtual int FixWeirdness(); 53 | virtual void OnComponentCreate(const CItem *pComponent); 54 | 55 | private: 56 | CItemShip(const CItemShip ©); 57 | CItemShip &operator=(const CItemShip &other); 58 | }; 59 | 60 | #endif // _INC_CITEMSHIP_H 61 | -------------------------------------------------------------------------------- /src/graysvr/CNTWindow.h: -------------------------------------------------------------------------------- 1 | #ifdef _WIN32 2 | #ifndef _INC_CNTWINDOW_H 3 | #define _INC_CNTWINDOW_H 4 | 5 | #include "../common/CWindow.h" 6 | 7 | class CNTWindow : public CWindow 8 | { 9 | public: 10 | CNTWindow(); 11 | virtual ~CNTWindow(); 12 | 13 | static const char *m_sClassName; 14 | 15 | public: 16 | int m_iLogTextLen; 17 | bool m_fLogScrollLock; // lock with the rolling text? 18 | COLORREF m_dwColorNew; // setthe color for the next block written 19 | COLORREF m_dwColorPrv; 20 | int m_iHeightInput; 21 | HFONT m_hLogFont; 22 | CRichEditCtrl m_wndLog; 23 | CEdit m_wndInput; // the text input portion at the bottom 24 | char m_szCmdHistory[10][256]; 25 | 26 | public: 27 | void List_Clear(); 28 | void List_Add(COLORREF color, LPCTSTR pszText); 29 | bool OnCommand(WORD wNotifyCode, INT_PTR wID, HWND hwndCtl); 30 | 31 | static bool RegisterClass(char *className); 32 | static LRESULT WINAPI WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); 33 | 34 | private: 35 | int OnCreate(HWND hWnd, LPCREATESTRUCT lParam); 36 | void OnDestroy(); 37 | void OnSetFocus(HWND hWndLoss); 38 | LRESULT OnUserTrayNotify(WPARAM wID, LPARAM lEvent); 39 | void OnUserPostMessage(COLORREF color, CGString *psMsg); 40 | void OnSize(WPARAM nType, int cx, int cy); 41 | bool OnClose(); 42 | bool OnSysCommand(WPARAM uCmdType, int xPos, int yPos); 43 | void SetLogFont(const char *pszFont); 44 | LRESULT OnNotify(int idCtrl, NMHDR *pnmh); 45 | 46 | public: 47 | class CAboutDlg : public CDialogBase 48 | { 49 | private: 50 | bool OnInitDialog(); 51 | bool OnCommand(WORD wNotifyCode, INT_PTR wID, HWND hwndCtl); 52 | 53 | public: 54 | virtual BOOL DefDialogProc(UINT message, WPARAM wParam, LPARAM lParam); 55 | }; 56 | 57 | class CStatusDlg : public CDialogBase 58 | { 59 | public: 60 | CListbox m_wndListClients; 61 | CListbox m_wndListStats; 62 | 63 | private: 64 | bool OnInitDialog(); 65 | bool OnCommand(WORD wNotifyCode, INT_PTR wID, HWND hwndCtl); 66 | 67 | public: 68 | void FillClients(); 69 | void FillStats(); 70 | 71 | virtual BOOL DefDialogProc(UINT message, WPARAM wParam, LPARAM lParam); 72 | }; 73 | 74 | class CListTextConsole : public CTextConsole 75 | { 76 | public: 77 | CListTextConsole(HWND hWndList) 78 | { 79 | m_wndList.m_hWnd = hWndList; 80 | } 81 | ~CListTextConsole() 82 | { 83 | m_wndList.OnDestroy(); 84 | } 85 | 86 | public: 87 | CListbox m_wndList; 88 | 89 | public: 90 | virtual LPCTSTR GetName() const 91 | { 92 | return "Stats"; 93 | } 94 | virtual PLEVEL_TYPE GetPrivLevel() const 95 | { 96 | return PLEVEL_QTY; 97 | } 98 | virtual void SysMessage(LPCTSTR pszMessage) const 99 | { 100 | if ( !pszMessage || ISINTRESOURCE(pszMessage) ) 101 | return; 102 | 103 | TCHAR *ppMessages[255]; 104 | size_t iQty = Str_ParseCmds(const_cast(pszMessage), ppMessages, COUNTOF(ppMessages), "\n"); 105 | for ( size_t i = 0; i < iQty; ++i ) 106 | { 107 | if ( *ppMessages[i] ) 108 | m_wndList.AddString(ppMessages[i]); 109 | } 110 | } 111 | }; 112 | }; 113 | 114 | class CNTApp : public CWinApp 115 | { 116 | public: 117 | static const char *m_sClassName; 118 | 119 | public: 120 | CNTWindow m_wndMain; 121 | CNTWindow::CAboutDlg m_wndAbout; 122 | CNTWindow::CStatusDlg m_wndStatus; 123 | }; 124 | 125 | #endif // _INC_CNTWINDOW_H 126 | #endif // _WIN32 127 | -------------------------------------------------------------------------------- /src/graysvr/CParty.h: -------------------------------------------------------------------------------- 1 | #ifndef _INC_CPARTY_H 2 | #define _INC_CPARTY_H 3 | #pragma once 4 | 5 | class CPartyDef : public CGObListRec, public CScriptObj 6 | { 7 | // List of characters in party 8 | public: 9 | static const char *m_sClassName; 10 | static const LPCTSTR sm_szVerbKeys[]; 11 | static const LPCTSTR sm_szLoadKeys[]; 12 | 13 | CPartyDef(CChar *pCharInviter, CChar *pCharAccept); 14 | 15 | private: 16 | CCharRefArray m_Chars; 17 | CGString m_sName; 18 | CGString m_pSpeechFunction; 19 | CVarDefMap m_TagDefs; 20 | 21 | private: 22 | bool SendMemberMsg(CChar *pCharDest, PacketSend *pPacket); 23 | void SendAll(PacketSend *pPacket); 24 | 25 | bool SetMaster(CChar *pChar); 26 | CChar *GetMaster() const 27 | { 28 | return m_Chars.GetChar(0).CharFind(); 29 | } 30 | 31 | // List manipulation 32 | size_t AttachChar(CChar *pChar); 33 | size_t DetachChar(CChar *pChar); 34 | 35 | public: 36 | static bool AcceptEvent(CChar *pCharAccept, CChar *pCharInviter, bool fForced = false); 37 | static bool DeclineEvent(CChar *pCharDecline, CChar *pCharInviter); 38 | 39 | // Functions sent to all party members 40 | void StatsUpdateAll(CChar *pCharSrc, PacketSend *pPacket); 41 | void SysMessageAll(LPCTSTR pszMsg); 42 | void UpdateWaypointAll(CChar *pCharSrc, MAPWAYPOINT_TYPE type); 43 | 44 | // List sending wrappers 45 | bool SendRemoveList(CChar *pCharRemove); 46 | bool SendAddList(CChar *pCharDest); 47 | 48 | // Party message sending wrappers 49 | bool MessageEvent(CChar *pCharDest, CChar *pCharSrc, const NCHAR *pszMsg); 50 | 51 | // Commands 52 | bool Disband(); 53 | bool RemoveMember(CChar *pChar, CChar *pCharSrc = NULL); 54 | void AcceptMember(CChar *pChar); 55 | void SetLootFlag(CChar *pChar, bool fSet); 56 | bool GetLootFlag(const CChar *pChar); 57 | 58 | bool IsPartyFull() const 59 | { 60 | return (m_Chars.GetCharCount() >= 10); 61 | } 62 | bool IsInParty(const CChar *pChar) const 63 | { 64 | return m_Chars.IsCharIn(pChar); 65 | } 66 | bool IsPartyMaster(const CChar *pChar) const 67 | { 68 | return (m_Chars.FindChar(pChar) == 0); 69 | } 70 | 71 | LPCTSTR GetName() const 72 | { 73 | return static_cast(m_sName); 74 | } 75 | 76 | bool r_GetRef(LPCTSTR &pszKey, CScriptObj *&pRef); 77 | bool r_WriteVal(LPCTSTR pszKey, CGString &sVal, CTextConsole *pSrc); 78 | bool r_Verb(CScript &s, CTextConsole *pSrc); // execute command from script 79 | bool r_LoadVal(CScript &s); 80 | bool r_Load(CScript &s); 81 | 82 | private: 83 | CPartyDef(const CPartyDef ©); 84 | CPartyDef &operator=(const CPartyDef &other); 85 | }; 86 | 87 | #endif // _INC_CPARTY_H 88 | -------------------------------------------------------------------------------- /src/graysvr/CPathFinder.h: -------------------------------------------------------------------------------- 1 | #ifndef _INC_CPATHFINDER_H 2 | #define _INC_CPATHFINDER_H 3 | #pragma once 4 | 5 | #include "../graysvr/graysvr.h" 6 | #ifndef _WIN32 7 | #include 8 | #include 9 | #include 10 | #endif 11 | 12 | using std::deque; 13 | using std::list; 14 | 15 | class CPathFinderPointRef; 16 | 17 | class CPathFinderPoint : public CPointMap 18 | { 19 | public: 20 | CPathFinderPoint(); 21 | explicit CPathFinderPoint(const CPointMap pt); 22 | 23 | public: 24 | CPathFinderPoint *m_pParent; 25 | bool m_fWalkable; 26 | int iValF; 27 | int iValG; 28 | int iValH; 29 | 30 | private: 31 | CPathFinderPoint(const CPathFinderPoint ©); 32 | CPathFinderPoint &operator=(const CPathFinderPoint &other); 33 | }; 34 | 35 | class CPathFinderPointRef 36 | { 37 | public: 38 | CPathFinderPointRef() 39 | { 40 | m_pPoint = 0; 41 | } 42 | explicit CPathFinderPointRef(CPathFinderPoint &pt) 43 | { 44 | m_pPoint = &pt; 45 | } 46 | 47 | public: 48 | CPathFinderPoint *m_pPoint; 49 | 50 | public: 51 | CPathFinderPointRef &operator=(const CPathFinderPointRef &pt) 52 | { 53 | m_pPoint = pt.m_pPoint; 54 | return *this; 55 | } 56 | bool operator < (const CPathFinderPointRef &pt) const 57 | { 58 | return (m_pPoint->iValF < pt.m_pPoint->iValF); 59 | } 60 | bool operator == (const CPathFinderPointRef &pt) const 61 | { 62 | return (m_pPoint == pt.m_pPoint); 63 | } 64 | }; 65 | 66 | class CPathFinder 67 | { 68 | public: 69 | static const char *m_sClassName; 70 | 71 | CPathFinder(CChar *pChar, CPointMap ptTarget); 72 | 73 | protected: 74 | CPathFinderPoint m_Points[MAX_NPC_PATH_STORAGE_SIZE][MAX_NPC_PATH_STORAGE_SIZE]; 75 | std::deque m_Opened; 76 | std::deque m_Closed; 77 | std::deque m_LastPath; 78 | 79 | signed short m_RealX; 80 | signed short m_RealY; 81 | 82 | CChar *m_pChar; 83 | CPointMap m_ptTarget; 84 | 85 | public: 86 | bool FindPath(); 87 | 88 | CPointMap ReadStep(signed short i) const 89 | { 90 | return m_LastPath[i]; 91 | } 92 | 93 | signed short LastPathSize() const 94 | { 95 | return static_cast(m_LastPath.size()); 96 | } 97 | 98 | void ClearLastPath() 99 | { 100 | m_LastPath.clear(); 101 | } 102 | 103 | protected: 104 | void GetChildren(CPathFinderPointRef pt, std::list ptChildList); 105 | void Clear(); 106 | void FillMap(); 107 | 108 | int Heuristic(CPathFinderPointRef ptStart, CPathFinderPointRef ptEnd) const 109 | { 110 | return 10 * (abs(ptStart.m_pPoint->m_x - ptEnd.m_pPoint->m_x) + abs(ptStart.m_pPoint->m_y - ptEnd.m_pPoint->m_y)); 111 | } 112 | 113 | private: 114 | CPathFinder(const CPathFinder ©); 115 | CPathFinder &operator=(const CPathFinder &other); 116 | }; 117 | 118 | #endif // _INC_CPATHFINDER_H 119 | -------------------------------------------------------------------------------- /src/graysvr/CPingServer.cpp: -------------------------------------------------------------------------------- 1 | #include "CPingServer.h" 2 | 3 | CPingServer g_PingServer; 4 | 5 | CPingServer::CPingServer() : AbstractSphereThread("PingServer", IThread::RealTime) 6 | { 7 | m_profile.EnableProfile(PROFILE_NETWORK_RX); 8 | m_profile.EnableProfile(PROFILE_NETWORK_TX); 9 | m_profile.EnableProfile(PROFILE_DATA_TX); 10 | m_profile.EnableProfile(PROFILE_DATA_RX); 11 | m_socket.Close(); 12 | } 13 | 14 | void CPingServer::onStart() 15 | { 16 | AbstractSphereThread::onStart(); 17 | if ( m_socket.IsOpen() ) 18 | m_socket.Close(); 19 | 20 | if ( !m_socket.Create(PF_INET, SOCK_DGRAM, CGSocket::GetProtocolIdByName("udp")) ) 21 | { 22 | m_socket.Close(); 23 | return; 24 | } 25 | 26 | CSocketAddress SockAddr; 27 | SockAddr.SetAddrIP(INADDR_LOOPBACK_REVERSE); 28 | SockAddr.SetPortNum(PINGSERVER_PORT); 29 | 30 | if ( m_socket.Bind(SockAddr) == SOCKET_ERROR ) 31 | { 32 | m_socket.Close(); 33 | return; 34 | } 35 | } 36 | 37 | void CPingServer::tick() 38 | { 39 | // Prepare to receive data from somewhere 40 | char buffer[PINGSERVER_BUFFER]; 41 | sockaddr_in addr; 42 | socklen_t addr_len = sizeof(addr); 43 | 44 | // Receive data 45 | ProfileTask receiveTask(PROFILE_NETWORK_RX); 46 | int received = recvfrom(m_socket.GetSocket(), buffer, sizeof(buffer), 0, reinterpret_cast(&addr), &addr_len); 47 | if ( received <= 0 ) 48 | return; 49 | CurrentProfileData.Count(PROFILE_DATA_RX, received); 50 | 51 | // Reply data 52 | ProfileTask sendTask(PROFILE_NETWORK_TX); 53 | int sent = sendto(m_socket.GetSocket(), buffer, received, 0, reinterpret_cast(&addr), addr_len); 54 | if ( sent <= 0 ) 55 | return; 56 | CurrentProfileData.Count(PROFILE_DATA_TX, sent); 57 | } 58 | 59 | bool CPingServer::shouldExit() 60 | { 61 | if ( !m_socket.IsOpen() ) 62 | return true; 63 | return AbstractSphereThread::shouldExit(); 64 | } 65 | 66 | void CPingServer::waitForClose() 67 | { 68 | m_socket.Close(); 69 | AbstractSphereThread::waitForClose(); 70 | } 71 | -------------------------------------------------------------------------------- /src/graysvr/CPingServer.h: -------------------------------------------------------------------------------- 1 | #ifndef _INC_CPINGSERVER_H 2 | #define _INC_CPINGSERVER_H 3 | #pragma once 4 | 5 | #include "../sphere/threads.h" 6 | 7 | #define PINGSERVER_PORT 12000 // listen on this port for client pings (clients normally uses 12000) 8 | #define PINGSERVER_BUFFER 64 // number of bytes to receive from clients (client normally sends 40) 9 | 10 | class CPingServer : public AbstractSphereThread 11 | { 12 | public: 13 | CPingServer(); 14 | virtual ~CPingServer() { }; 15 | 16 | private: 17 | CGSocket m_socket; 18 | 19 | public: 20 | virtual void onStart(); 21 | virtual void tick(); 22 | virtual bool shouldExit(); 23 | virtual void waitForClose(); 24 | }; 25 | 26 | #endif // _INC_CPINGSERVER_H 27 | -------------------------------------------------------------------------------- /src/graysvr/CServRef.h: -------------------------------------------------------------------------------- 1 | #ifndef _INC_CSERVREF_H 2 | #define _INC_CSERVREF_H 3 | #pragma once 4 | 5 | enum SERV_STAT_TYPE 6 | { 7 | SERV_STAT_CLIENTS, // How many clients connected (use as % full) 8 | SERV_STAT_CHARS, 9 | SERV_STAT_ITEMS, 10 | SERV_STAT_ACCOUNTS, 11 | SERV_STAT_MEM, // Virtual 12 | SERV_STAT_QTY 13 | }; 14 | 15 | class CServerDef : public CScriptObj 16 | { 17 | public: 18 | static const char *m_sClassName; 19 | static const LPCTSTR sm_szLoadKeys[]; 20 | 21 | CServerDef(LPCTSTR pszName, CSocketAddressIP dwIP); 22 | 23 | private: 24 | DWORD m_dwStat[SERV_STAT_QTY]; // Statistic counters 25 | CGString m_sName; // Server name 26 | CServTime m_timeCreate; // Server creation time 27 | 28 | public: 29 | CSocketAddress m_ip; // Server IP/port 30 | CCrypt m_ClientVersion; // Server client version 31 | signed char m_TimeZone; // Server timezone (GMT based) 32 | CGString m_sEMail; // Server admin email address 33 | CGString m_sURL; // Server URL 34 | CGString m_sLang; // Server language 35 | CGString m_sRestAPIPublicIP; // REST API URL used to set server public IP on ServIP automatically at server startup 36 | 37 | public: 38 | DWORD StatGet(SERV_STAT_TYPE i) const; 39 | void StatInc(SERV_STAT_TYPE i) 40 | { 41 | ASSERT((i >= SERV_STAT_CLIENTS) && (i < SERV_STAT_QTY)); 42 | ++m_dwStat[i]; 43 | } 44 | void StatDec(SERV_STAT_TYPE i) 45 | { 46 | ASSERT((i >= SERV_STAT_CLIENTS) && (i < SERV_STAT_QTY)); 47 | --m_dwStat[i]; 48 | } 49 | 50 | void SetName(LPCTSTR pszName); 51 | LPCTSTR GetName() const 52 | { 53 | return m_sName; 54 | } 55 | 56 | virtual INT64 GetAge() const; 57 | 58 | bool IsSame(const CServerDef *pServ) const 59 | { 60 | UNREFERENCED_PARAMETER(pServ); 61 | return true; 62 | } 63 | 64 | virtual bool r_LoadVal(CScript &s); 65 | virtual bool r_WriteVal(LPCTSTR pKey, CGString &sVal, CTextConsole *pSrc = NULL); 66 | 67 | private: 68 | CServerDef(const CServerDef ©); 69 | CServerDef &operator=(const CServerDef &other); 70 | }; 71 | 72 | #endif // _INC_CSERVREF_H 73 | -------------------------------------------------------------------------------- /src/graysvr/CServer.h: -------------------------------------------------------------------------------- 1 | #ifndef _INC_CSERVER_H 2 | #define _INC_CSERVER_H 3 | #pragma once 4 | 5 | enum SERVMODE_TYPE 6 | { 7 | SERVMODE_RestockAll, // Major event 8 | SERVMODE_Saving, // Forced save freezes the system 9 | SERVMODE_Run, // Game is up and running 10 | SERVMODE_ResyncPause, // Paused during resync 11 | SERVMODE_Loading, // Initial load 12 | SERVMODE_ResyncLoad, // Loading after resync 13 | SERVMODE_Exiting // Closing down 14 | }; 15 | 16 | class CItemShip; 17 | 18 | extern class CServer : public CServerDef, public CTextConsole 19 | { 20 | public: 21 | static const char *m_sClassName; 22 | static const LPCTSTR sm_szVerbKeys[]; 23 | 24 | CServer(); 25 | 26 | public: 27 | SERVMODE_TYPE m_iModeCode; // Just some error code to return to system 28 | int m_iExitFlag; // Identify what caused the exit (< 0 = error) 29 | 30 | bool m_fReloadMultis; // Server resync changed an AREADEF/ROOMDEF resource that overrided multi regions, so multi regions must be reloaded 31 | bool m_fResyncPause; // Server is temporarily halted so files can be updated 32 | CTextConsole *m_fResyncRequested; // A resync pause has been requested by this source 33 | 34 | int m_iTelnetClients; // Admin clients connected on Telnet console 35 | CGString m_sConsoleText; 36 | bool m_fConsoleTextReadyFlag; // Interlocking flag for moving between tasks 37 | 38 | CServTime m_timeShutdown; // When to perform the shutdowm (g_World.clock) 39 | CChat m_Chats; // Keep all the active chats 40 | 41 | CGSocket m_SocketMain; // Incoming monitor socket (might be multiple ports?) 42 | char m_PacketFilter[PACKET_QTY][EXPRESSION_MAX_KEY_LEN]; // List of inbound packet filtering functions 43 | char m_OutPacketFilter[PACKET_QTY][EXPRESSION_MAX_KEY_LEN]; // List of outbound packet filtering functions 44 | 45 | CFileObj fhFile; // File script object 46 | CDataBase m_hdb; // MySQL database 47 | CSQLite m_hldb; // SQLite database 48 | 49 | public: 50 | void SetServerMode(SERVMODE_TYPE mode); 51 | bool IsValidBusy() const; 52 | bool IsLoading() const 53 | { 54 | return ((m_iModeCode > SERVMODE_Run) || m_fResyncPause); 55 | } 56 | 57 | void SetExitFlag(int iFlag); 58 | void Shutdown(INT64 iMinutes); 59 | 60 | bool SocketsInit(); 61 | void SocketsClose(); 62 | bool GetPublicIP(); 63 | 64 | void OnTick(); 65 | bool Load(); 66 | 67 | void SysMessage(LPCTSTR pszMsg) const; 68 | void PrintTelnet(LPCTSTR pszMsg) const; 69 | void PrintStr(LPCTSTR pszMsg) const; 70 | int PrintPercent(long iCount, long iTotal); 71 | 72 | bool OnConsoleCmd(CGString &sText, CTextConsole *pSrc); 73 | void ListClients(CTextConsole *pConsole) const; 74 | 75 | LPCTSTR GetStatusString(BYTE bIndex) const; 76 | 77 | virtual bool r_GetRef(LPCTSTR &pszKey, CScriptObj *&pRef); 78 | virtual bool r_WriteVal(LPCTSTR pszKey, CGString &sVal, CTextConsole *pSrc = NULL); 79 | virtual bool r_LoadVal(CScript &s); 80 | virtual bool r_Verb(CScript &s, CTextConsole *pSrc); 81 | 82 | LPCTSTR GetName() const 83 | { 84 | return CServerDef::GetName(); 85 | } 86 | PLEVEL_TYPE GetPrivLevel() const 87 | { 88 | return PLEVEL_QTY; 89 | } 90 | 91 | private: 92 | void SetResyncPause(bool fPause, CTextConsole *pSrc, bool fMessage = false); 93 | void ProfileDump(CTextConsole *pSrc, bool fDump = false); 94 | 95 | public: 96 | std::vector m_ShipTimers; 97 | void ShipTimers_Tick(); 98 | void ShipTimers_Add(CItemShip *pShip); 99 | void ShipTimers_Delete(CItemShip *pShip); 100 | 101 | private: 102 | CServer(const CServer ©); 103 | CServer &operator=(const CServer &other); 104 | } g_Serv; 105 | 106 | #endif // _INC_CSERVER_H 107 | -------------------------------------------------------------------------------- /src/graysvr/CUnixTerminal.h: -------------------------------------------------------------------------------- 1 | #ifndef _INC_CUNIXTERMINAL_H 2 | #define _INC_CUNIXTERMINAL_H 3 | #pragma once 4 | 5 | #ifndef _WIN32 6 | #ifdef _USECURSES 7 | #include 8 | #pragma comment(lib, "ncurses") 9 | #else 10 | #include 11 | #endif 12 | 13 | class CUnixTerminal 14 | { 15 | public: 16 | static const char *m_sClassName; 17 | 18 | private: 19 | #ifdef _USECURSES 20 | WINDOW *m_pWindow; 21 | #else 22 | termios m_terminal; 23 | #endif 24 | TCHAR m_szNextChar; 25 | bool m_fColorEnabled; 26 | bool m_fPrepared; 27 | 28 | public: 29 | enum COLOR_TYPE 30 | { 31 | COL_DEFAULT, 32 | COL_RED, 33 | COL_GREEN, 34 | COL_YELLOW, 35 | COL_BLUE, 36 | COL_MAGENTA, 37 | COL_CYAN, 38 | COL_WHITE, 39 | COL_QTY 40 | }; 41 | 42 | public: 43 | CUnixTerminal(); 44 | ~CUnixTerminal(); 45 | 46 | public: 47 | bool isReady(); 48 | TCHAR read(); 49 | void setColor(COLOR_TYPE color); 50 | void print(LPCTSTR pszText); 51 | void prepare(); 52 | 53 | bool isColorEnabled() const 54 | { 55 | return m_fColorEnabled; 56 | } 57 | 58 | private: 59 | void restore(); 60 | 61 | protected: 62 | CUnixTerminal(const CUnixTerminal ©); 63 | CUnixTerminal &operator=(const CUnixTerminal &other); 64 | }; 65 | 66 | extern CUnixTerminal g_UnixTerminal; 67 | 68 | #endif // _WIN32 69 | #endif // _INC_CUNIXTERMINAL_H 70 | -------------------------------------------------------------------------------- /src/graysvr/CWebPage.h: -------------------------------------------------------------------------------- 1 | #ifndef _INC_CWEBPAGE_H 2 | #define _INC_CWEBPAGE_H 3 | #pragma once 4 | 5 | enum WEBPAGE_TYPE 6 | { 7 | WEBPAGE_TEMPLATE, 8 | WEBPAGE_TEXT, 9 | WEBPAGE_BMP, 10 | WEBPAGE_GIF, 11 | WEBPAGE_JPG, 12 | WEBPAGE_PNG, 13 | WEBPAGE_QTY 14 | }; 15 | 16 | enum WTRIG_TYPE 17 | { 18 | // XTRIG_UNKNOWN = some named trigger not on this list 19 | WTRIG_Load = 1, 20 | WTRIG_QTY 21 | }; 22 | 23 | class CWebPageDef : public CResourceLink 24 | { 25 | // RES_WEBPAGE 26 | // This is a single web page we are generating or serving 27 | public: 28 | static const char *m_sClassName; 29 | static const LPCTSTR sm_szLoadKeys[]; 30 | static const LPCTSTR sm_szVerbKeys[]; 31 | static const LPCTSTR sm_szPageType[]; 32 | static const LPCTSTR sm_szPageExt[]; 33 | static const LPCTSTR sm_szTrigName[WTRIG_QTY + 1]; 34 | 35 | explicit CWebPageDef(RESOURCE_ID rid); 36 | virtual ~CWebPageDef() { }; 37 | 38 | public: 39 | static int sm_iListIndex; 40 | 41 | private: 42 | WEBPAGE_TYPE m_type; // File type (text, image, etc) 43 | PLEVEL_TYPE m_privlevel; // Required plevel to view this page 44 | CServTime m_timeNextUpdate; 45 | int m_iUpdatePeriod; // How often in seconds the page is updated (0 = never) 46 | int m_iUpdateLog; // Create a daily copy of the page 47 | CGString m_sSrcFilePath; // Determines what page is used as source 48 | CGString m_sDstFilePath; // Determines where the final page is saved 49 | 50 | public: 51 | bool WebPageUpdate(bool fNow, LPCTSTR pszDstName, CTextConsole *pSrc); 52 | void WebPageLog(); 53 | 54 | bool SetSourceFile(LPCTSTR pszName, CClient *pClient); 55 | bool IsMatch(LPCTSTR pszMatch) const; 56 | 57 | bool ServPagePost(CClient *pClient, TCHAR *pszContent, int iContentLength); 58 | static bool ServPage(CClient *pClient, TCHAR *pszPageName, CGTime *pTimeLastModified); 59 | 60 | LPCTSTR GetName() const 61 | { 62 | return m_sSrcFilePath; 63 | } 64 | LPCTSTR GetDstName() const 65 | { 66 | return m_sDstFilePath; 67 | } 68 | 69 | virtual bool r_WriteVal(LPCTSTR pszKey, CGString &sVal, CTextConsole *pSrc = NULL); 70 | virtual bool r_LoadVal(CScript &s); 71 | virtual bool r_Verb(CScript &s, CTextConsole *pSrc); // some command on this object as a target 72 | 73 | private: 74 | int ServPageRequest(CClient *pClient, LPCTSTR pszURLArgs, CGTime *pTimeLastModified); 75 | 76 | private: 77 | CWebPageDef(const CWebPageDef ©); 78 | CWebPageDef &operator=(const CWebPageDef &other); 79 | }; 80 | 81 | class CFileConsole : public CTextConsole 82 | { 83 | public: 84 | static const char *m_sClassName; 85 | CFileText m_FileOut; 86 | 87 | CFileConsole() { }; 88 | 89 | public: 90 | virtual LPCTSTR GetName() const 91 | { 92 | return "WebFile"; 93 | } 94 | virtual PLEVEL_TYPE GetPrivLevel() const 95 | { 96 | return PLEVEL_Admin; 97 | } 98 | virtual void SysMessage(LPCTSTR pszMessage) const 99 | { 100 | if ( !pszMessage || ISINTRESOURCE(pszMessage) ) 101 | return; 102 | const_cast(this)->m_FileOut.WriteString(pszMessage); 103 | } 104 | 105 | private: 106 | CFileConsole(const CFileConsole ©); 107 | CFileConsole &operator=(const CFileConsole &other); 108 | }; 109 | 110 | #endif // _INC_CWEBPAGE_H 111 | -------------------------------------------------------------------------------- /src/graysvr/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Developer Studio generated include file. 3 | // Used by SphereSvr.rc 4 | // 5 | #define IDC_STATIC 0 6 | #define IDR_MAINFRAME 100 7 | #define IDR_ABOUT_BOX 101 8 | #define IDM_POP_TRAY 102 9 | #define IDM_POP_LOG 103 10 | #define IDC_STAT_STATS 201 11 | #define IDC_STAT_CLIENTS 202 12 | #define IDM_STATUS 528 13 | #define IDM_RESTORE 544 14 | #define IDM_MINIMIZE 560 15 | #define IDM_EDIT_COPY 580 16 | #define IDM_EXIT 582 17 | #define IDC_ABOUT_VERSION 1117 18 | #define IDC_ABOUT_COMPILER 1118 19 | #define IDC_ABOUT_WEBSITE 1119 20 | #define IDM_RESYNC_PAUSE 32784 21 | 22 | // Next default values for new objects 23 | // 24 | #ifdef APSTUDIO_INVOKED 25 | #ifndef APSTUDIO_READONLY_SYMBOLS 26 | #define _APS_3D_CONTROLS 1 27 | #define _APS_NEXT_RESOURCE_VALUE 160 28 | #define _APS_NEXT_COMMAND_VALUE 32785 29 | #define _APS_NEXT_CONTROL_VALUE 4026 30 | #define _APS_NEXT_SYMED_VALUE 210 31 | #endif 32 | #endif 33 | -------------------------------------------------------------------------------- /src/graysvr/spheresvr.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sphereserver/Source/e1e47c154be28b0910d378ffbfa184c578aa778e/src/graysvr/spheresvr.ico -------------------------------------------------------------------------------- /src/graysvr/spheresvrold.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sphereserver/Source/e1e47c154be28b0910d378ffbfa184c578aa778e/src/graysvr/spheresvrold.ico -------------------------------------------------------------------------------- /src/sphere/ProfileData.h: -------------------------------------------------------------------------------- 1 | #ifndef PROFILEDATA_H 2 | #define PROFILEDATA_H 3 | #pragma once 4 | 5 | enum PROFILE_TYPE 6 | { 7 | PROFILE_IDLE, // Wait for stuff. 8 | PROFILE_OVERHEAD, // In between stuff. 9 | PROFILE_NETWORK_RX, // Just get client info and monitor new client requests. No processing. 10 | PROFILE_CLIENTS, // Client processing. 11 | PROFILE_NETWORK_TX, // sending network data 12 | PROFILE_CHARS, // ticking characters 13 | PROFILE_ITEMS, // ticking items 14 | PROFILE_MAP, // reading map data 15 | PROFILE_NPC_AI, // processing npc ai 16 | PROFILE_SCRIPTS, // running scripts 17 | PROFILE_TIME_QTY, 18 | 19 | // Qty of bytes. Not Time. 20 | PROFILE_DATA_TX = PROFILE_TIME_QTY, // network bytes sent 21 | PROFILE_DATA_RX, // network bytes received 22 | PROFILE_DATA_QTY, 23 | 24 | PROFILE_STAT_FAULTS = PROFILE_DATA_QTY, // exceptions raised 25 | 26 | PROFILE_QTY 27 | }; 28 | 29 | class ProfileData 30 | { 31 | protected: 32 | struct ProfileDataRec 33 | { 34 | ULONGLONG m_Time; // accumulated time in msec. 35 | int m_iCount; // how many passes made into this. 36 | }; 37 | 38 | ProfileDataRec m_AverageTimes[PROFILE_QTY]; 39 | ProfileDataRec m_PreviousTimes[PROFILE_QTY]; 40 | ProfileDataRec m_CurrentTimes[PROFILE_QTY]; 41 | bool m_EnabledProfiles[PROFILE_QTY]; 42 | 43 | int m_iActiveWindowSeconds; // The sample window size in seconds. 0=off 44 | int m_iAverageCount; 45 | 46 | ULONGLONG m_TimeTotal; // Average this over a total time period. 47 | 48 | // Store the last time start time. 49 | PROFILE_TYPE m_CurrentTask; // What task are we currently processing ? 50 | ULONGLONG m_CurrentTime; // QueryPerformanceCount() 51 | 52 | public: 53 | ProfileData(); 54 | 55 | private: 56 | ProfileData(const ProfileData& copy); 57 | ProfileData& operator=(const ProfileData& other); 58 | 59 | public: 60 | bool IsActive() const { return( m_iActiveWindowSeconds > 0 ? true : false ); } 61 | int GetActiveWindow() const { return m_iActiveWindowSeconds; } 62 | 63 | void SetActive(int iSampleSec); 64 | void Start(PROFILE_TYPE id); 65 | void Count(PROFILE_TYPE id, DWORD dwVal); 66 | void EnableProfile(PROFILE_TYPE id); 67 | 68 | PROFILE_TYPE GetCurrentTask() const; 69 | LPCTSTR GetName(PROFILE_TYPE id) const; 70 | LPCTSTR GetDescription(PROFILE_TYPE id) const; 71 | bool IsEnabled(PROFILE_TYPE id = PROFILE_QTY) const; 72 | }; 73 | 74 | #define CurrentProfileData static_cast(ThreadHolder::current())->m_profile 75 | 76 | class AbstractSphereThread; 77 | 78 | class ProfileTask 79 | { 80 | private: 81 | AbstractSphereThread* m_context; 82 | PROFILE_TYPE m_previousTask; 83 | 84 | public: 85 | explicit ProfileTask(PROFILE_TYPE id); 86 | ~ProfileTask(void); 87 | 88 | private: 89 | ProfileTask(const ProfileTask& copy); 90 | ProfileTask& operator=(const ProfileTask& other); 91 | }; 92 | 93 | #endif // PROFILEDATA_H 94 | -------------------------------------------------------------------------------- /src/sphere/asyncdb.cpp: -------------------------------------------------------------------------------- 1 | #include "asyncdb.h" 2 | 3 | CDataBaseAsyncHelper g_asyncHdb; 4 | 5 | CDataBaseAsyncHelper::CDataBaseAsyncHelper(void) : AbstractSphereThread("AsyncDatabaseHelper", IThread::Low) 6 | { 7 | } 8 | 9 | CDataBaseAsyncHelper::~CDataBaseAsyncHelper(void) 10 | { 11 | } 12 | 13 | void CDataBaseAsyncHelper::onStart() 14 | { 15 | AbstractSphereThread::onStart(); 16 | } 17 | 18 | void CDataBaseAsyncHelper::tick() 19 | { 20 | if ( !m_queriesTodo.empty() ) 21 | { 22 | SimpleThreadLock lock(m_queryMutex); 23 | QueryBlob_t currentPair = m_queriesTodo.front(); 24 | m_queriesTodo.pop_front(); 25 | FunctionQueryPair_t currentFunctionPair = currentPair.second; 26 | 27 | CScriptTriggerArgs *args = new CScriptTriggerArgs(); 28 | args->m_iN1 = currentPair.first; 29 | args->m_s1 = currentFunctionPair.second; 30 | 31 | if ( currentPair.first ) 32 | args->m_iN2 = g_Serv.m_hdb.Query(currentFunctionPair.second, args->m_VarsLocal); 33 | else 34 | args->m_iN2 = g_Serv.m_hdb.Exec(currentFunctionPair.second); 35 | 36 | g_Serv.m_hdb.AsyncQueueCallback(currentFunctionPair.first, args); 37 | } 38 | } 39 | 40 | void CDataBaseAsyncHelper::waitForClose() 41 | { 42 | SimpleThreadLock lock(m_queryMutex); 43 | m_queriesTodo.clear(); 44 | AbstractSphereThread::waitForClose(); 45 | } 46 | 47 | void CDataBaseAsyncHelper::addQuery(bool isQuery, LPCTSTR function, LPCTSTR query) 48 | { 49 | SimpleThreadLock lock(m_queryMutex); 50 | m_queriesTodo.push_back(QueryBlob_t(isQuery, FunctionQueryPair_t(CGString(function), CGString(query)))); 51 | } 52 | -------------------------------------------------------------------------------- /src/sphere/asyncdb.h: -------------------------------------------------------------------------------- 1 | #ifndef _INC_ASYNCDB_H 2 | #define _INC_ASYNCDB_H 3 | 4 | #include "../graysvr/graysvr.h" 5 | 6 | class CDataBaseAsyncHelper : public AbstractSphereThread 7 | { 8 | public: 9 | CDataBaseAsyncHelper(void); 10 | ~CDataBaseAsyncHelper(void); 11 | 12 | private: 13 | CDataBaseAsyncHelper(const CDataBaseAsyncHelper ©); 14 | CDataBaseAsyncHelper &operator=(const CDataBaseAsyncHelper &other); 15 | 16 | public: 17 | virtual void onStart(); 18 | virtual void tick(); 19 | virtual void waitForClose(); 20 | void addQuery(bool isQuery, LPCTSTR function, LPCTSTR query); 21 | 22 | private: 23 | typedef std::pair FunctionQueryPair_t; 24 | typedef std::pair QueryBlob_t; 25 | typedef std::deque QueueQuery_t; 26 | 27 | SimpleMutex m_queryMutex; 28 | QueueQuery_t m_queriesTodo; 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/sphere/containers.h: -------------------------------------------------------------------------------- 1 | #ifndef __CONTAINERS_H__ 2 | #define __CONTAINERS_H__ 3 | #pragma once 4 | 5 | // a thread-safe implementation of a queue container that doesn't use any locks 6 | // this only works as long as there is only a single reader thread and writer thread 7 | template 8 | class ThreadSafeQueue 9 | { 10 | public: 11 | typedef std::list list; 12 | typedef typename std::list::iterator iterator; 13 | typedef typename std::list::const_iterator const_iterator; 14 | 15 | private: 16 | list m_list; 17 | iterator m_head; 18 | iterator m_tail; 19 | 20 | public: 21 | ThreadSafeQueue() 22 | { 23 | m_list.push_back(T()); // at least one element must be in the queue 24 | m_head = m_list.begin(); 25 | m_tail = m_list.end(); 26 | } 27 | 28 | private: 29 | ThreadSafeQueue(const ThreadSafeQueue& copy); 30 | ThreadSafeQueue& operator=(const ThreadSafeQueue& other); 31 | 32 | public: 33 | // Append an element to the end of the queue (writer) 34 | void push(const T& value) 35 | { 36 | m_list.push_back(value); 37 | m_tail = m_list.end(); 38 | clean(); 39 | } 40 | 41 | // Erase elements from before reader head (writer) 42 | void clean(void) 43 | { 44 | m_head = m_list.erase(m_list.begin(), m_head); 45 | } 46 | 47 | // Retrieve the number of elements in the queue (reader/writer) 48 | size_t size(void) const 49 | { 50 | if (empty()) 51 | return 0; 52 | 53 | size_t toSkip = 1; 54 | for (const_iterator it = m_list.begin(); it != m_head && it != m_list.end(); ++it) 55 | { 56 | if (it == m_list.end()) 57 | break; 58 | 59 | ++toSkip; 60 | } 61 | 62 | return m_list.size() - toSkip; 63 | } 64 | 65 | // Determine if the queue is empty (reader/writer) 66 | bool empty(void) const 67 | { 68 | iterator next = m_head; 69 | ++next; 70 | 71 | return (next == m_tail); 72 | } 73 | 74 | // Remove the first element from the queue (reader) 75 | void pop(void) 76 | { 77 | if (empty()) 78 | throw CGrayError(LOGL_ERROR, 0, "No elements to read from queue."); 79 | 80 | iterator next = m_head; 81 | ++next; 82 | 83 | if (next != m_tail) 84 | m_head = next; 85 | } 86 | 87 | // Retrieve the first element in the queue (reader) 88 | T front(void) const 89 | { 90 | if (empty() == false) 91 | { 92 | iterator next = m_head; 93 | ++next; 94 | 95 | if (next != m_tail) 96 | return *next; 97 | } 98 | 99 | // this should never happen 100 | throw CGrayError(LOGL_ERROR, 0, "No elements to read from queue."); 101 | } 102 | }; 103 | 104 | #endif 105 | -------------------------------------------------------------------------------- /src/sphere/linuxev.h: -------------------------------------------------------------------------------- 1 | #ifndef _INC_LINUXEV_H 2 | #define _INC_LINUXEV_H 3 | #if !defined(_WIN32) || defined(_LIBEV) 4 | 5 | #include "../common/libev/wrapper_ev.h" 6 | #include "../common/libev/ev.h" 7 | #include "threads.h" 8 | #include "mutex.h" 9 | 10 | #ifdef __FreeBSD__ 11 | #define EV_BACKEND_LIST (EVBACKEND_SELECT | EVBACKEND_POLL | EVBACKEND_KQUEUE) 12 | #else 13 | #define EV_BACKEND_LIST (EVBACKEND_SELECT | EVBACKEND_POLL | EVBACKEND_EPOLL) 14 | #endif 15 | 16 | class CGSocket; 17 | class CClient; 18 | class NetState; 19 | 20 | class LinuxEv : public AbstractSphereThread 21 | { 22 | public: 23 | enum EventsID 24 | { 25 | Undefinied = -1, 26 | None = 0, 27 | Read = 1, 28 | Write = 2, 29 | 30 | Error = 0x80000000 31 | }; 32 | 33 | private: 34 | struct ev_loop * m_eventLoop; 35 | struct ev_io m_watchMainsock; 36 | 37 | public: 38 | LinuxEv(void); 39 | virtual ~LinuxEv(void); 40 | 41 | private: 42 | LinuxEv(const LinuxEv& copy); 43 | LinuxEv& operator=(const LinuxEv& other); 44 | 45 | public: 46 | virtual void onStart(); 47 | virtual void tick(); 48 | virtual void waitForClose(); 49 | 50 | private: 51 | void forceClientevent(NetState *, EventsID); 52 | 53 | public: 54 | void forceClientread(NetState *); 55 | void forceClientwrite(NetState *); 56 | // -------------------------------------- 57 | void registerClient(NetState *, EventsID); 58 | void unregisterClient(NetState *); 59 | // -------------------------------------- 60 | void registerMainsocket(); 61 | void unregisterMainsocket(); 62 | }; 63 | 64 | #endif 65 | #endif 66 | -------------------------------------------------------------------------------- /src/sphere/mutex.h: -------------------------------------------------------------------------------- 1 | #ifndef _INC_MUTEX_H 2 | #define _INC_MUTEX_H 3 | #pragma once 4 | 5 | #include "../common/os_common.h" 6 | 7 | class SimpleMutex 8 | { 9 | public: 10 | SimpleMutex(); 11 | ~SimpleMutex(); 12 | 13 | public: 14 | void lock(); 15 | bool tryLock(); 16 | void unlock(); 17 | 18 | private: 19 | #ifdef _WIN32 20 | CRITICAL_SECTION m_criticalSection; 21 | #else 22 | pthread_mutex_t m_criticalSection; 23 | pthread_mutexattr_t m_criticalSectionAttr; 24 | #endif 25 | 26 | private: 27 | SimpleMutex(const SimpleMutex ©); 28 | SimpleMutex &operator=(const SimpleMutex &other); 29 | }; 30 | 31 | class SimpleThreadLock 32 | { 33 | public: 34 | explicit SimpleThreadLock(SimpleMutex &mutex); 35 | ~SimpleThreadLock(); 36 | 37 | private: 38 | SimpleMutex &m_mutex; 39 | bool m_locked; 40 | 41 | public: 42 | operator bool() const 43 | { 44 | // Report the state of locking when used as a boolean 45 | return m_locked; 46 | } 47 | 48 | private: 49 | SimpleThreadLock(const SimpleThreadLock ©); 50 | SimpleThreadLock &operator=(const SimpleThreadLock &other); 51 | }; 52 | 53 | class ManualThreadLock 54 | { 55 | public: 56 | ManualThreadLock(); 57 | explicit ManualThreadLock(SimpleMutex *mutex); 58 | ~ManualThreadLock(); 59 | 60 | private: 61 | SimpleMutex *m_mutex; 62 | bool m_locked; 63 | 64 | public: 65 | void setMutex(SimpleMutex *mutex); 66 | void doLock(); 67 | bool doTryLock(); 68 | void doUnlock(); 69 | 70 | operator bool() const 71 | { 72 | // Report the state of locking when used as a boolean 73 | return m_locked; 74 | } 75 | 76 | private: 77 | ManualThreadLock(const ManualThreadLock ©); 78 | ManualThreadLock &operator=(const ManualThreadLock &other); 79 | }; 80 | 81 | class AutoResetEvent 82 | { 83 | public: 84 | AutoResetEvent(); 85 | ~AutoResetEvent(); 86 | 87 | private: 88 | #ifdef _WIN32 89 | HANDLE m_handle; 90 | #else 91 | pthread_mutex_t m_criticalSection; 92 | pthread_mutexattr_t m_criticalSectionAttr; 93 | pthread_condattr_t m_conditionAttr; 94 | pthread_cond_t m_condition; 95 | #endif 96 | 97 | public: 98 | #ifdef _WIN32 99 | static const unsigned long _infinite = INFINITE; 100 | #else 101 | static const unsigned long _infinite = 0xFFFFFFFF; 102 | #endif 103 | 104 | 105 | public: 106 | void wait(unsigned long timeout = _infinite); 107 | void signal(); 108 | 109 | private: 110 | AutoResetEvent(const AutoResetEvent ©); 111 | AutoResetEvent &operator=(const AutoResetEvent &other); 112 | }; 113 | 114 | class ManualResetEvent 115 | { 116 | public: 117 | ManualResetEvent(); 118 | ~ManualResetEvent(); 119 | 120 | private: 121 | #ifdef _WIN32 122 | HANDLE m_handle; 123 | #else 124 | bool m_value; 125 | pthread_mutex_t m_criticalSection; 126 | pthread_mutexattr_t m_criticalSectionAttr; 127 | pthread_condattr_t m_conditionAttr; 128 | pthread_cond_t m_condition; 129 | #endif 130 | 131 | public: 132 | #ifdef _WIN32 133 | static const unsigned long _infinite = INFINITE; 134 | #else 135 | static const unsigned long _infinite = 0xFFFFFFFF; 136 | #endif 137 | 138 | public: 139 | void wait(unsigned long timeout = _infinite); 140 | void set(); 141 | void reset(); 142 | 143 | private: 144 | ManualResetEvent(const ManualResetEvent ©); 145 | ManualResetEvent &operator=(const ManualResetEvent &other); 146 | }; 147 | 148 | #endif // _INC_MUTEX_H 149 | -------------------------------------------------------------------------------- /src/sphere/strings.h: -------------------------------------------------------------------------------- 1 | #ifndef STRINGS_H_ 2 | #define STRINGS_H_ 3 | 4 | // Base abstract class for strings, provides basic information of what should be available 5 | // NOTE: The destructor is NOT virtual for a reason. Children should override destroy() instead 6 | class AbstractString 7 | { 8 | public: 9 | AbstractString(); 10 | virtual ~AbstractString(); 11 | 12 | private: 13 | AbstractString(const AbstractString& copy); 14 | AbstractString& operator=(const AbstractString& other); 15 | 16 | public: 17 | // information 18 | size_t length(); 19 | size_t realLength(); 20 | bool isEmpty(); 21 | const char *toBuffer(); 22 | 23 | // character operations 24 | char charAt(size_t index); 25 | void setAt(size_t index, char c); 26 | 27 | // modification 28 | void append(const char *s); 29 | void replace(char what, char toWhat); 30 | 31 | // comparison 32 | int compareTo(const char *s); // compare with 33 | int compareToIgnoreCase(const char *s); // compare with [case ignored] 34 | bool equals(const char *s); // equals? 35 | bool equalsIgnoreCase(const char *s); // equals? [case ignored] 36 | bool startsWith(const char *s); // starts with this? [case ignored] 37 | bool startsWithHead(const char *s); // starts with this and separator [case ignored] 38 | 39 | // search 40 | int indexOf(char c); 41 | int indexOf(const char *s); 42 | int lastIndexOf(char c); 43 | 44 | // operator 45 | operator LPCTSTR() const; // as a C string 46 | operator char*(); // as a C string 47 | operator const char*&() const; // as a C string 48 | 49 | protected: 50 | // not implemented, should take care that newLength should fit in the buffer 51 | virtual void ensureLength(size_t newLength); 52 | // not implemented, should free up occupied resources 53 | virtual void destroy(); 54 | 55 | protected: 56 | char *m_buf; 57 | size_t m_length; 58 | size_t m_realLength; 59 | }; 60 | 61 | // Common string implementation, implementing AbstractString and working on heap 62 | class String : public AbstractString 63 | { 64 | public: 65 | String(); 66 | virtual ~String() { }; 67 | 68 | private: 69 | String(const String& copy); 70 | String& operator=(const String& other); 71 | 72 | protected: 73 | void ensureLength(size_t newLength); 74 | void destroy(); 75 | }; 76 | 77 | #define MAX_TEMP_LINES_NO_CONTEXT 512 78 | 79 | // Temporary string implementation. Works with thread-safe string 80 | // To create such string: 81 | // TemporaryString str; 82 | // it could be also created via new TemporaryString but whats the point if we still use memory allocation? :) 83 | class TemporaryString : public String 84 | { 85 | public: 86 | TemporaryString(); 87 | TemporaryString(char *buffer, char *state); 88 | ~TemporaryString(); 89 | 90 | private: 91 | TemporaryString(const TemporaryString& copy); 92 | TemporaryString& operator=(const TemporaryString& other); 93 | 94 | public: 95 | // should not really be used, made for use of AbstractSphereThread *only* 96 | void init(char *buffer, char *state); 97 | 98 | protected: 99 | void ensureLength(size_t newLength); 100 | void destroy(); 101 | 102 | private: 103 | bool m_useHeap; // a mark whatever we are in heap (String) or stack (ThreadLocal) mode 104 | char *m_state; // a pointer to thread local state of the line we occupy 105 | 106 | // static buffer to allow similar operations for non-threaded environment 107 | // NOTE: this buffer have no protection against overrun, so beware 108 | static size_t m_tempPosition; 109 | static char m_tempStrings[MAX_TEMP_LINES_NO_CONTEXT][THREAD_STRING_LENGTH]; 110 | }; 111 | 112 | #endif 113 | -------------------------------------------------------------------------------- /src/tables/CBaseBaseDef_props.tbl: -------------------------------------------------------------------------------- 1 | // 2 | // Class: CBaseBaseDef 3 | // Set: attributes 4 | // Prefix: OBC_ 5 | // 6 | 7 | ADD(ARMOR, "ARMOR") 8 | ADD(BASEID, "BASEID") 9 | ADD(CAN, "CAN") 10 | ADD(CATEGORY, "CATEGORY") 11 | ADD(COMBATBONUSPERCENT, "COMBATBONUSPERCENT") 12 | ADD(COMBATBONUSSTAT, "COMBATBONUSSTAT") 13 | ADD(DAM, "DAM") 14 | ADD(DAMCHAOS, "DAMCHAOS") 15 | ADD(DAMCOLD, "DAMCOLD") 16 | ADD(DAMDIRECT, "DAMDIRECT") 17 | ADD(DAMENERGY, "DAMENERGY") 18 | ADD(DAMFIRE, "DAMFIRE") 19 | ADD(DAMPHYSICAL, "DAMPHYSICAL") 20 | ADD(DAMPOISON, "DAMPOISON") 21 | ADD(DEFNAME, "DEFNAME") 22 | ADD(DEFNAME2, "DEFNAME2") 23 | ADD(DESCRIPTION, "DESCRIPTION") 24 | ADD(ENHANCEPOTIONS, "ENHANCEPOTIONS") 25 | ADD(EXPANSION, "EXPANSION") 26 | ADD(FASTERCASTING, "FASTERCASTING") 27 | ADD(FASTERCASTRECOVERY, "FASTERCASTRECOVERY") 28 | ADD(HEIGHT, "HEIGHT") 29 | ADD(HITLEECHLIFE, "HITLEECHLIFE") 30 | ADD(HITLEECHMANA, "HITLEECHMANA") 31 | ADD(HITLEECHSTAM, "HITLEECHSTAM") 32 | ADD(HITMANADRAIN, "HITMANADRAIN") 33 | ADD(INCREASEDAM, "INCREASEDAM") 34 | ADD(INCREASEDEFCHANCE, "INCREASEDEFCHANCE") 35 | ADD(INCREASEDEFCHANCEMAX, "INCREASEDEFCHANCEMAX") 36 | ADD(INCREASEHITCHANCE, "INCREASEHITCHANCE") 37 | ADD(INCREASESPELLDAM, "INCREASESPELLDAM") 38 | ADD(INCREASESWINGSPEED, "INCREASESWINGSPEED") 39 | ADD(INSTANCES, "INSTANCES") 40 | ADD(LOWERMANACOST, "LOWERMANACOST") 41 | ADD(LOWERREAGENTCOST, "LOWERREAGENTCOST") 42 | ADD(LUCK, "LUCK") 43 | ADD(NAME, "NAME") 44 | ADD(NAMELOC, "NAMELOC") 45 | ADD(NIGHTSIGHT, "NIGHTSIGHT") 46 | ADD(RANGE, "RANGE") 47 | ADD(RANGEH, "RANGEH") 48 | ADD(RANGEL, "RANGEL") 49 | ADD(REFLECTPHYSICALDAM, "REFLECTPHYSICALDAM") 50 | ADD(REGENFOOD, "REGENFOOD") 51 | ADD(REGENHITS, "REGENHITS") 52 | ADD(REGENMANA, "REGENMANA") 53 | ADD(REGENSTAM, "REGENSTAM") 54 | ADD(REGENVALFOOD, "REGENVALFOOD") 55 | ADD(REGENVALHITS, "REGENVALHITS") 56 | ADD(REGENVALMANA, "REGENVALMANA") 57 | ADD(REGENVALSTAM, "REGENVALSTAM") 58 | ADD(RESCOLD, "RESCOLD") 59 | ADD(RESCOLDMAX, "RESCOLDMAX") 60 | ADD(RESDISPDNHUE, "RESDISPDNHUE") 61 | ADD(RESENERGY, "RESENERGY") 62 | ADD(RESENERGYMAX, "RESENERGYMAX") 63 | ADD(RESFIRE, "RESFIRE") 64 | ADD(RESFIREMAX, "RESFIREMAX") 65 | ADD(RESLEVEL, "RESLEVEL") 66 | ADD(RESOURCES, "RESOURCES") 67 | ADD(RESPHYSICAL, "RESPHYSICAL") 68 | ADD(RESPHYSICALMAX, "RESPHYSICALMAX") 69 | ADD(RESPOISON, "RESPOISON") 70 | ADD(RESPOISONMAX, "RESPOISONMAX") 71 | ADD(SUBSECTION, "SUBSECTION") 72 | ADD(TAG, "TAG") 73 | ADD(TAG0, "TAG0") 74 | ADD(TEVENTS, "TEVENTS") 75 | -------------------------------------------------------------------------------- /src/tables/CCharBase_props.tbl: -------------------------------------------------------------------------------- 1 | // 2 | // Class: CCharBase 3 | // Set: attributes 4 | // Prefix: CBC_ 5 | // 6 | 7 | ADD(ANIM, "ANIM") 8 | ADD(ARMOR, "ARMOR") 9 | ADD(AVERSIONS, "AVERSIONS") 10 | ADD(BLOODCOLOR, "BLOODCOLOR") 11 | ADD(BREATH, "BREATH") 12 | ADD(CAN, "CAN") 13 | ADD(COLOR, "COLOR") 14 | ADD(DESIRES, "DESIRES") 15 | ADD(DEX, "DEX") 16 | ADD(DISPID, "DISPID") 17 | ADD(FOLLOWERSLOTS, "FOLLOWERSLOTS") 18 | ADD(FOODTYPE, "FOODTYPE") 19 | ADD(HIREDAYWAGE, "HIREDAYWAGE") 20 | ADD(ICON, "ICON") 21 | ADD(ID, "ID") 22 | ADD(INT, "INT") 23 | ADD(JOB, "JOB") 24 | ADD(MAXFOLLOWER, "MAXFOLLOWER") 25 | ADD(MAXFOOD, "MAXFOOD") 26 | ADD(MOVERATE, "MOVERATE") 27 | ADD(RESDISPDNID, "RESDISPDNID") 28 | ADD(SOUND, "SOUND") 29 | ADD(SOUNDDIE, "SOUNDDIE") 30 | ADD(SOUNDGETHIT, "SOUNDGETHIT") 31 | ADD(SOUNDHIT, "SOUNDHIT") 32 | ADD(SOUNDIDLE, "SOUNDIDLE") 33 | ADD(SOUNDNOTICE, "SOUNDNOTICE") 34 | ADD(STR, "STR") 35 | ADD(THROWDAM, "THROWDAM") 36 | ADD(THROWOBJ, "THROWOBJ") 37 | ADD(THROWRANGE, "THROWRANGE") 38 | ADD(TITHING, "TITHING") 39 | ADD(TSPEECH, "TSPEECH") 40 | -------------------------------------------------------------------------------- /src/tables/CCharNpc_props.tbl: -------------------------------------------------------------------------------- 1 | // 2 | // Class: CCharNpc 3 | // Set: attributes 4 | // Prefix: CNC_ 5 | // 6 | 7 | ADD(ACTPRI, "ACTPRI") 8 | ADD(BONDED, "BONDED") 9 | ADD(HOMEDIST, "HOMEDIST") 10 | ADD(NEED, "NEED") 11 | ADD(NEEDNAME, "NEEDNAME") 12 | ADD(NPC, "NPC") 13 | ADD(SPEECH, "SPEECH") 14 | ADD(SPELLADD, "SPELLADD") 15 | ADD(THROWDAM, "THROWDAM") 16 | ADD(THROWOBJ, "THROWOBJ") 17 | ADD(THROWRANGE, "THROWRANGE") 18 | ADD(VENDCAP, "VENDCAP") 19 | ADD(VENDGOLD, "VENDGOLD") 20 | -------------------------------------------------------------------------------- /src/tables/CCharPlayer_functions.tbl: -------------------------------------------------------------------------------- 1 | // 2 | // Class: CCharPlayer 3 | // Set: attributes 4 | // Prefix: CPV_ 5 | // 6 | 7 | ADD(KICK, "KICK") 8 | ADD(PASSWORD, "PASSWORD") 9 | ADD(TARGETCLOSE, "TARGETCLOSE") 10 | -------------------------------------------------------------------------------- /src/tables/CCharPlayer_props.tbl: -------------------------------------------------------------------------------- 1 | // 2 | // Class: CCharPlayer 3 | // Set: attributes 4 | // Prefix: CPC_ 5 | // 6 | 7 | ADD(ACCOUNT, "ACCOUNT") 8 | ADD(DEATHS, "DEATHS") 9 | ADD(DSPEECH, "DSPEECH") 10 | ADD(ISDSPEECH, "ISDSPEECH") 11 | ADD(KILLS, "KILLS") 12 | ADD(KRTOOLBARSTATUS, "KRTOOLBARSTATUS") 13 | ADD(LASTUSED, "LASTUSED") 14 | ADD(PROFILE, "PROFILE") 15 | ADD(REFUSEGLOBALCHATREQUESTS, "REFUSEGLOBALCHATREQUESTS") 16 | ADD(REFUSETRADES, "REFUSETRADES") 17 | ADD(SKILLCLASS, "SKILLCLASS") 18 | ADD(SKILLLOCK, "SKILLLOCK") 19 | ADD(SPEEDMODE, "SPEEDMODE") 20 | ADD(STATLOCK, "STATLOCK") 21 | -------------------------------------------------------------------------------- /src/tables/CChar_functions.tbl: -------------------------------------------------------------------------------- 1 | // 2 | // Class: CChar 3 | // Set: functions 4 | // Prefix: CHV_ 5 | // 6 | 7 | ADD(ALLSKILLS, "ALLSKILLS") 8 | ADD(ANIM, "ANIM") 9 | ADD(ATTACK, "ATTACK") 10 | ADD(BANK, "BANK") 11 | ADD(BARK, "BARK") 12 | ADD(BOUNCE, "BOUNCE") 13 | ADD(BOW, "BOW") 14 | ADD(CONSUME, "CONSUME") 15 | ADD(CONTROL, "CONTROL") 16 | ADD(CRIMINAL, "CRIMINAL") 17 | ADD(DESTROY, "DESTROY") 18 | ADD(DISCONNECT, "DISCONNECT") 19 | ADD(DROP, "DROP") 20 | ADD(DUPE, "DUPE") 21 | ADD(EQUIP, "EQUIP") 22 | ADD(EQUIPARMOR, "EQUIPARMOR") 23 | ADD(EQUIPHALO, "EQUIPHALO") 24 | ADD(EQUIPWEAPON, "EQUIPWEAPON") 25 | ADD(FACE, "FACE") 26 | ADD(FIXWEIGHT, "FIXWEIGHT") 27 | ADD(FORGIVE, "FORGIVE") 28 | ADD(GO, "GO") 29 | ADD(GOCHAR, "GOCHAR") 30 | ADD(GOCHARID, "GOCHARID") 31 | ADD(GOCLI, "GOCLI") 32 | ADD(GOITEMID, "GOITEMID") 33 | ADD(GONAME, "GONAME") 34 | ADD(GOSOCK, "GOSOCK") 35 | ADD(GOTYPE, "GOTYPE") 36 | ADD(GOUID, "GOUID") 37 | ADD(HEAR, "HEAR") 38 | ADD(HUNGRY, "HUNGRY") 39 | ADD(INVIS, "INVIS") 40 | ADD(INVUL, "INVUL") 41 | ADD(JAIL, "JAIL") 42 | ADD(KILL, "KILL") 43 | ADD(MAKEITEM, "MAKEITEM") 44 | ADD(MOUNT, "MOUNT") 45 | ADD(NEWBIESKILL, "NEWBIESKILL") 46 | ADD(NEWGOLD, "NEWGOLD") 47 | ADD(NEWLOOT, "NEWLOOT") 48 | ADD(NOTOCLEAR, "NOTOCLEAR") 49 | ADD(NOTOUPDATE, "NOTOUPDATE") 50 | ADD(PACK, "PACK") 51 | ADD(POISON, "POISON") 52 | ADD(POLY, "POLY") 53 | ADD(PRIVSET, "PRIVSET") 54 | ADD(RELEASE, "RELEASE") 55 | ADD(REMOVE, "REMOVE") 56 | ADD(RESURRECT, "RESURRECT") 57 | ADD(REVEAL, "REVEAL") 58 | ADD(SALUTE, "SALUTE") 59 | ADD(SKILL, "SKILL") 60 | ADD(SKILLGAIN, "SKILLGAIN") 61 | ADD(SMSG, "SMSG") 62 | ADD(SMSGL, "SMSGL") 63 | ADD(SMSGLEX, "SMSGLEX") 64 | ADD(SMSGU, "SMSGU") 65 | ADD(SUICIDE, "SUICIDE") 66 | ADD(SUMMONCAGE, "SUMMONCAGE") 67 | ADD(SUMMONTO, "SUMMONTO") 68 | ADD(SYSMESSAGE, "SYSMESSAGE") 69 | ADD(SYSMESSAGEF, "SYSMESSAGEF") 70 | ADD(SYSMESSAGELOC, "SYSMESSAGELOC") 71 | ADD(SYSMESSAGELOCEX, "SYSMESSAGELOCEX") 72 | ADD(SYSMESSAGEUA, "SYSMESSAGEUA") 73 | ADD(TARGETCLOSE, "TARGETCLOSE") 74 | ADD(UNDERWEAR, "UNDERWEAR") 75 | ADD(UNEQUIP, "UNEQUIP") 76 | ADD(WHERE, "WHERE") 77 | -------------------------------------------------------------------------------- /src/tables/CClient_functions.tbl: -------------------------------------------------------------------------------- 1 | // 2 | // Class: CClient 3 | // Set: functions 4 | // Prefix: CV_ 5 | // 6 | 7 | ADD(ADD, "ADD") 8 | ADD(ADDBUFF, "ADDBUFF") 9 | ADD(ADDCLILOC, "ADDCLILOC") 10 | ADD(ADDCONTEXTENTRY, "ADDCONTEXTENTRY") 11 | ADD(ARROWQUEST, "ARROWQUEST") 12 | ADD(BADSPAWN, "BADSPAWN") 13 | ADD(BANKSELF, "BANKSELF") 14 | ADD(CAST, "CAST") 15 | ADD(CHANGEFACE, "CHANGEFACE") 16 | ADD(CHARLIST, "CHARLIST") 17 | ADD(CLEARCTAGS, "CLEARCTAGS") 18 | ADD(CLEARSPECIALMOVE, "CLEARSPECIALMOVE") 19 | ADD(CLOSEPAPERDOLL, "CLOSEPAPERDOLL") 20 | ADD(CLOSEPROFILE, "CLOSEPROFILE") 21 | ADD(CLOSESTATUS, "CLOSESTATUS") 22 | ADD(CODEXOFWISDOM, "CODEXOFWISDOM") 23 | ADD(CTAGLIST, "CTAGLIST") 24 | ADD(DYE, "DYE") 25 | ADD(EVERBTARG, "EVERBTARG") 26 | ADD(EXTRACT, "EXTRACT") 27 | ADD(FLUSH, "FLUSH") 28 | ADD(GMPAGE, "GMPAGE") 29 | ADD(GOTARG, "GOTARG") 30 | ADD(INFO, "INFO") 31 | ADD(INFORMATION, "INFORMATION") 32 | ADD(LAST, "LAST") 33 | ADD(LINK, "LINK") 34 | ADD(MAPWAYPOINT, "MAPWAYPOINT") 35 | ADD(MENU, "MENU") 36 | ADD(MIDILIST, "MIDILIST") 37 | ADD(NUDGE, "NUDGE") 38 | ADD(NUKE, "NUKE") 39 | ADD(NUKECHAR, "NUKECHAR") 40 | ADD(OPENPAPERDOLL, "OPENPAPERDOLL") 41 | ADD(OPENTRADEWINDOW, "OPENTRADEWINDOW") 42 | ADD(REMOVEBUFF, "REMOVEBUFF") 43 | ADD(REPAIR, "REPAIR") 44 | ADD(RESEND, "RESEND") 45 | ADD(SAVE, "SAVE") 46 | ADD(SCROLL, "SCROLL") 47 | ADD(SELF, "SELF") 48 | ADD(SENDPACKET, "SENDPACKET") 49 | ADD(SHOWSKILLS, "SHOWSKILLS") 50 | ADD(SKILLMENU, "SKILLMENU") 51 | ADD(SKILLSELECT, "SKILLSELECT") 52 | ADD(SMSG, "SMSG") 53 | ADD(SMSGL, "SMSGL") 54 | ADD(SMSGLEX, "SMSGLEX") 55 | ADD(SMSGU, "SMSGU") 56 | ADD(SUMMON, "SUMMON") 57 | ADD(SYSMESSAGE, "SYSMESSAGE") 58 | ADD(SYSMESSAGEF, "SYSMESSAGEF") 59 | ADD(SYSMESSAGELOC, "SYSMESSAGELOC") 60 | ADD(SYSMESSAGELOCEX, "SYSMESSAGELOCEX") 61 | ADD(SYSMESSAGEUA, "SYSMESSAGEUA") 62 | ADD(TELE, "TELE") 63 | ADD(TILE, "TILE") 64 | ADD(UNEXTRACT, "UNEXTRACT") 65 | ADD(WEBLINK, "WEBLINK") 66 | -------------------------------------------------------------------------------- /src/tables/CClient_props.tbl: -------------------------------------------------------------------------------- 1 | // 2 | // Class: CClient 3 | // Set: attributes 4 | // Prefix: CC_ 5 | // 6 | 7 | ADD(ALLMOVE, "ALLMOVE") 8 | ADD(ALLSHOW, "ALLSHOW") 9 | ADD(CLIENTIS3D, "CLIENTIS3D") 10 | ADD(CLIENTISKR, "CLIENTISKR") 11 | ADD(CLIENTISSA, "CLIENTISSA") 12 | ADD(CLIENTVERSION, "CLIENTVERSION") 13 | ADD(DEBUG, "DEBUG") 14 | ADD(DETAIL, "DETAIL") 15 | ADD(GM, "GM") 16 | ADD(HEARALL, "HEARALL") 17 | ADD(LASTEVENT, "LASTEVENT") 18 | ADD(PRIVSHOW, "PRIVSHOW") 19 | ADD(REPORTEDCLIVER, "REPORTEDCLIVER") 20 | ADD(SCREENSIZE, "SCREENSIZE") 21 | ADD(TARG, "TARG") 22 | ADD(TARGP, "TARGP") 23 | ADD(TARGPROP, "TARGPROP") 24 | ADD(TARGPRV, "TARGPRV") 25 | ADD(TARGTXT, "TARGTXT") 26 | -------------------------------------------------------------------------------- /src/tables/CFileObjContainer_functions.tbl: -------------------------------------------------------------------------------- 1 | // 2 | // Class: CFileObjContainer 3 | // Set: functions 4 | // Prefix: CFOV_ 5 | // 6 | 7 | ADD(CLOSEOBJECT, "CLOSEOBJECT") 8 | ADD(RESETOBJECT, "RESETOBJECT") 9 | -------------------------------------------------------------------------------- /src/tables/CFileObjContainer_props.tbl: -------------------------------------------------------------------------------- 1 | // 2 | // Class: CFileObjContainer 3 | // Set: attributes 4 | // Prefix: CFO_ 5 | // 6 | 7 | ADD(GLOBALTIMEOUT, "GLOBALTIMEOUT") 8 | ADD(OBJECTPOOL, "OBJECTPOOL") 9 | -------------------------------------------------------------------------------- /src/tables/CFile_functions.tbl: -------------------------------------------------------------------------------- 1 | // 2 | // Class: CFileObj 3 | // Set: functions 4 | // Prefix: FOV_ 5 | // 6 | 7 | ADD(CLOSE, "CLOSE") 8 | ADD(DELETEFILE, "DELETEFILE") 9 | ADD(FLUSH, "FLUSH") 10 | -------------------------------------------------------------------------------- /src/tables/CFile_props.tbl: -------------------------------------------------------------------------------- 1 | // 2 | // Class: CFileObj 3 | // Set: attributes 4 | // Prefix: FO_ 5 | // 6 | 7 | ADD(FILEEXIST, "FILEEXIST") 8 | ADD(FILELINES, "FILELINES") 9 | ADD(FILEPATH, "FILEPATH") 10 | ADD(INUSE, "INUSE") 11 | ADD(ISEOF, "ISEOF") 12 | ADD(LENGTH, "LENGTH") 13 | ADD(OPEN, "OPEN") 14 | ADD(POSITION, "POSITION") 15 | ADD(READBYTE, "READBYTE") 16 | ADD(READCHAR, "READCHAR") 17 | ADD(READLINE, "READLINE") 18 | ADD(SEEK, "SEEK") 19 | ADD(WRITE, "WRITE") 20 | ADD(WRITECHR, "WRITECHR") 21 | ADD(WRITELINE, "WRITELINE") 22 | -------------------------------------------------------------------------------- /src/tables/CItemBase_props.tbl: -------------------------------------------------------------------------------- 1 | // 2 | // Class: CItemBase 3 | // Set: attributes 4 | // Prefix: IBC_ 5 | // 6 | 7 | ADD(AMMOANIM, "AMMOANIM") 8 | ADD(AMMOANIMHUE, "AMMOANIMHUE") 9 | ADD(AMMOANIMRENDER, "AMMOANIMRENDER") 10 | ADD(AMMOCONT, "AMMOCONT") 11 | ADD(AMMOSOUNDHIT, "AMMOSOUNDHIT") 12 | ADD(AMMOSOUNDMISS, "AMMOSOUNDMISS") 13 | ADD(AMMOTYPE, "AMMOTYPE") 14 | ADD(BONUSDEX, "BONUSDEX") 15 | ADD(BONUSHITS, "BONUSHITS") 16 | ADD(BONUSHITSMAX, "BONUSHITSMAX") 17 | ADD(BONUSINT, "BONUSINT") 18 | ADD(BONUSMANA, "BONUSMANA") 19 | ADD(BONUSMANAMAX, "BONUSMANAMAX") 20 | ADD(BONUSSKILL1, "BONUSSKILL1") 21 | ADD(BONUSSKILL1AMT, "BONUSSKILL1AMT") 22 | ADD(BONUSSKILL2, "BONUSSKILL2") 23 | ADD(BONUSSKILL2AMT, "BONUSSKILL2AMT") 24 | ADD(BONUSSKILL3, "BONUSSKILL3") 25 | ADD(BONUSSKILL3AMT, "BONUSSKILL3AMT") 26 | ADD(BONUSSKILL4, "BONUSSKILL4") 27 | ADD(BONUSSKILL4AMT, "BONUSSKILL4AMT") 28 | ADD(BONUSSKILL5, "BONUSSKILL5") 29 | ADD(BONUSSKILL5AMT, "BONUSSKILL5AMT") 30 | ADD(BONUSSTAM, "BONUSSTAM") 31 | ADD(BONUSSTAMMAX, "BONUSSTAMMAX") 32 | ADD(BONUSSTR, "BONUSSTR") 33 | ADD(CANUSE, "CANUSE") 34 | ADD(DISPID, "DISPID") 35 | ADD(DROPSOUND, "DROPSOUND") 36 | ADD(DUPEITEM, "DUPEITEM") 37 | ADD(DUPELIST, "DUPELIST") 38 | ADD(DYE, "DYE") 39 | ADD(ENCHANT, "ENCHANT") 40 | ADD(EQUIPSOUND, "EQUIPSOUND") 41 | ADD(EXCEPTIONAL, "EXCEPTIONAL") 42 | ADD(EXPANSION, "EXPANSION") 43 | ADD(FLIP, "FLIP") 44 | ADD(HITAREACOLD, "HITAREACOLD") 45 | ADD(HITAREAENERGY, "HITAREAENERGY") 46 | ADD(HITAREAFIRE, "HITAREAFIRE") 47 | ADD(HITAREAPHYSICAL, "HITAREAPHYSICAL") 48 | ADD(HITAREAPOISON, "HITAREAPOISON") 49 | ADD(HITDISPEL, "HITDISPEL") 50 | ADD(HITFIREBALL, "HITFIREBALL") 51 | ADD(HITHARM, "HITHARM") 52 | ADD(HITLIGHTNING, "HITLIGHTNING") 53 | ADD(HITMAGICARROW, "HITMAGICARROW") 54 | ADD(ID, "ID") 55 | ADD(IMBUE, "IMBUE") 56 | ADD(ISARMOR, "ISARMOR") 57 | ADD(ISWEAPON, "ISWEAPON") 58 | ADD(LAYER, "LAYER") 59 | ADD(LIFESPAN, "LIFESPAN") 60 | ADD(LOWERREQ, "LOWERREQ") 61 | ADD(MAGEARMOR, "MAGEARMOR") 62 | ADD(MAGEWEAPON, "MAGEWEAPON") 63 | ADD(MAKERSMARK, "MAKERSMARK") 64 | ADD(MAXAMOUNT, "MAXAMOUNT") 65 | ADD(OCOLOR, "OCOLOR") 66 | ADD(PILE, "PILE") 67 | ADD(RARITY, "RARITY") 68 | ADD(RECYCLE, "RECYCLE") 69 | ADD(REFORGE, "REFORGE") 70 | ADD(REPAIR, "REPAIR") 71 | ADD(REPLICATE, "REPLICATE") 72 | ADD(REQSTR, "REQSTR") 73 | ADD(RESDISPDNID, "RESDISPDNID") 74 | ADD(RESMAKE, "RESMAKE") 75 | ADD(RETAINCOLOR, "RETAINCOLOR") 76 | ADD(SELFREPAIR, "SELFREPAIR") 77 | ADD(SHIPSPEED, "SHIPSPEED") 78 | ADD(SKILL, "SKILL") 79 | ADD(SKILLMAKE, "SKILLMAKE") 80 | ADD(SPEED, "SPEED") 81 | ADD(SPEEDMODE, "SPEEDMODE") 82 | ADD(SPELLCHANNELING, "SPELLCHANNELING") 83 | ADD(TDATA1, "TDATA1") 84 | ADD(TDATA2, "TDATA2") 85 | ADD(TDATA3, "TDATA3") 86 | ADD(TDATA4, "TDATA4") 87 | ADD(TFLAGS, "TFLAGS") 88 | ADD(TWOHANDS, "TWOHANDS") 89 | ADD(TYPE, "TYPE") 90 | ADD(USEBESTWEAPONSKILL, "USEBESTWEAPONSKILL") 91 | ADD(USESCUR, "USESCUR") 92 | ADD(USESMAX, "USESMAX") 93 | ADD(VALUE, "VALUE") 94 | ADD(WEIGHT, "WEIGHT") 95 | ADD(WEIGHTREDUCTION, "WEIGHTREDUCTION") 96 | -------------------------------------------------------------------------------- /src/tables/CItemStone_functions.tbl: -------------------------------------------------------------------------------- 1 | // 2 | // Class: CItemStone 3 | // Set: functions 4 | // Prefix: ISV_ 5 | // 6 | 7 | ADD(ACCEPTCANDIDATE,"ACCEPTCANDIDATE") 8 | ADD(ALLGUILDS,"ALLGUILDS") 9 | ADD(ALLMEMBERS,"ALLMEMBERS") 10 | ADD(APPLYTOJOIN,"APPLYTOJOIN") 11 | ADD(CHANGEALIGN,"CHANGEALIGN") 12 | ADD(DECLAREFEALTY,"DECLAREFEALTY") 13 | ADD(DECLAREPEACE,"DECLAREPEACE") 14 | ADD(DECLAREWAR,"DECLAREWAR") 15 | ADD(DISMISSMEMBER,"DISMISSMEMBER") 16 | ADD(ELECTMASTER,"ELECTMASTER") 17 | ADD(GRANTTITLE,"GRANTTITLE") 18 | ADD(INVITEWAR,"INVITEWAR") 19 | ADD(JOINASMEMBER,"JOINASMEMBER") 20 | ADD(MASTERMENU,"MASTERMENU") 21 | ADD(RECRUIT,"RECRUIT") 22 | ADD(REFUSECANDIDATE,"REFUSECANDIDATE") 23 | ADD(RESIGN,"RESIGN") 24 | ADD(RETURNMAINMENU,"RETURNMAINMENU") 25 | ADD(SETABBREVIATION,"SETABBREVIATION") 26 | ADD(SETCHARTER,"SETCHARTER") 27 | ADD(SETGMTITLE,"SETGMTITLE") 28 | ADD(SETNAME,"SETNAME") 29 | ADD(TOGGLEABBREVIATION,"TOGGLEABBREVIATION") 30 | ADD(VIEWCANDIDATES,"VIEWCANDIDATES") 31 | ADD(VIEWCHARTER,"VIEWCHARTER") 32 | ADD(VIEWENEMYS,"VIEWENEMYS") 33 | ADD(VIEWROSTER,"VIEWROSTER") 34 | ADD(VIEWTHREATS,"VIEWTHREATS") 35 | -------------------------------------------------------------------------------- /src/tables/CItemStone_props.tbl: -------------------------------------------------------------------------------- 1 | // 2 | // Class: CItemStone 3 | // Set: props 4 | // Prefix: STC_ 5 | // 6 | 7 | ADD(ABBREV, "ABBREV") 8 | ADD(ABBREVIATIONTOGGLE, "ABBREVIATIONTOGGLE") 9 | ADD(ALIGN, "ALIGN") 10 | ADD(ALIGNTYPE, "ALIGNTYPE") 11 | ADD(CHARTER, "CHARTER") 12 | ADD(LOYALTO, "LOYALTO") 13 | ADD(MASTER, "MASTER") 14 | ADD(MASTERGENDERTITLE, "MASTERGENDERTITLE") 15 | ADD(MASTERTITLE, "MASTERTITLE") 16 | ADD(MASTERUID, "MASTERUID") 17 | ADD(MEMBER, "MEMBER") 18 | ADD(WEBPAGE, "WEBPAGE") 19 | -------------------------------------------------------------------------------- /src/tables/CItem_functions.tbl: -------------------------------------------------------------------------------- 1 | // 2 | // Class: CItem 3 | // Set: functions 4 | // Prefix: CIV_ 5 | // 6 | 7 | ADD(BOUNCE, "BOUNCE") 8 | ADD(CONSUME, "CONSUME") 9 | ADD(CONTCONSUME, "CONTCONSUME") 10 | ADD(DECAY, "DECAY") 11 | ADD(DESTROY, "DESTROY") 12 | ADD(DROP, "DROP") 13 | ADD(DUPE, "DUPE") 14 | ADD(EQUIP, "EQUIP") 15 | ADD(REPAIR, "REPAIR") 16 | ADD(SMELT, "SMELT") 17 | ADD(UNEQUIP, "UNEQUIP") 18 | ADD(USE, "USE") 19 | -------------------------------------------------------------------------------- /src/tables/CItem_props.tbl: -------------------------------------------------------------------------------- 1 | // 2 | // Class: CItem 3 | // Set: attributes 4 | // Prefix: IC_ 5 | // 6 | 7 | ADD(ADDCIRCLE, "ADDCIRCLE") 8 | ADD(ADDSPELL, "ADDSPELL") 9 | ADD(AMMOANIM, "AMMOANIM") 10 | ADD(AMMOANIMHUE, "AMMOANIMHUE") 11 | ADD(AMMOANIMRENDER, "AMMOANIMRENDER") 12 | ADD(AMMOCONT, "AMMOCONT") 13 | ADD(AMMOSOUNDHIT, "AMMOSOUNDHIT") 14 | ADD(AMMOSOUNDMISS, "AMMOSOUNDMISS") 15 | ADD(AMMOTYPE, "AMMOTYPE") 16 | ADD(AMOUNT, "AMOUNT") 17 | ADD(ATTR, "ATTR") 18 | ADD(BASEWEIGHT, "BASEWEIGHT") 19 | ADD(BONUSDEX, "BONUSDEX") 20 | ADD(BONUSHITS, "BONUSHITS") 21 | ADD(BONUSHITSMAX, "BONUSHITSMAX") 22 | ADD(BONUSINT, "BONUSINT") 23 | ADD(BONUSMANA, "BONUSMANA") 24 | ADD(BONUSMANAMAX, "BONUSMANAMAX") 25 | ADD(BONUSSKILL1, "BONUSSKILL1") 26 | ADD(BONUSSKILL1AMT, "BONUSSKILL1AMT") 27 | ADD(BONUSSKILL2, "BONUSSKILL2") 28 | ADD(BONUSSKILL2AMT, "BONUSSKILL2AMT") 29 | ADD(BONUSSKILL3, "BONUSSKILL3") 30 | ADD(BONUSSKILL3AMT, "BONUSSKILL3AMT") 31 | ADD(BONUSSKILL4, "BONUSSKILL4") 32 | ADD(BONUSSKILL4AMT, "BONUSSKILL4AMT") 33 | ADD(BONUSSKILL5, "BONUSSKILL5") 34 | ADD(BONUSSKILL5AMT, "BONUSSKILL5AMT") 35 | ADD(BONUSSTAM, "BONUSSTAM") 36 | ADD(BONUSSTAMMAX, "BONUSSTAMMAX") 37 | ADD(BONUSSTR, "BONUSSTR") 38 | ADD(CAN, "CAN") 39 | ADD(CANUSE, "CANUSE") 40 | ADD(CONT, "CONT") 41 | ADD(CONTGRID, "CONTGRID") 42 | ADD(CONTP, "CONTP") 43 | ADD(CRAFTEDBY, "CRAFTEDBY") 44 | ADD(DISPID, "DISPID") 45 | ADD(DISPIDDEC, "DISPIDDEC") 46 | ADD(DOORCLOSESOUND, "DOORCLOSESOUND") 47 | ADD(DOOROPENID, "DOOROPENID") 48 | ADD(DOOROPENSOUND, "DOOROPENSOUND") 49 | ADD(DROPSOUND, "DROPSOUND") 50 | ADD(DUPEITEM, "DUPEITEM") 51 | ADD(DYE, "DYE") 52 | ADD(EQUIPSOUND, "EQUIPSOUND") 53 | ADD(FRUIT, "FRUIT") 54 | ADD(HEIGHT, "HEIGHT") 55 | ADD(HITAREACOLD, "HITAREACOLD") 56 | ADD(HITAREAENERGY, "HITAREAENERGY") 57 | ADD(HITAREAFIRE, "HITAREAFIRE") 58 | ADD(HITAREAPHYSICAL, "HITAREAPHYSICAL") 59 | ADD(HITAREAPOISON, "HITAREAPOISON") 60 | ADD(HITDISPEL, "HITDISPEL") 61 | ADD(HITFIREBALL, "HITFIREBALL") 62 | ADD(HITHARM, "HITHARM") 63 | ADD(HITLIGHTNING, "HITLIGHTNING") 64 | ADD(HITMAGICARROW, "HITMAGICARROW") 65 | ADD(HITPOINTS, "HITPOINTS") 66 | ADD(HITS, "HITS") 67 | ADD(ID, "ID") 68 | ADD(LAYER, "LAYER") 69 | ADD(LIFESPAN, "LIFESPAN") 70 | ADD(LINK, "LINK") 71 | ADD(LOWERREQ, "LOWERREQ") 72 | ADD(MAGEARMOR, "MAGEARMOR") 73 | ADD(MAGEWEAPON, "MAGEWEAPON") 74 | ADD(MAXAMOUNT, "MAXAMOUNT") 75 | ADD(MAXHITS, "MAXHITS") 76 | ADD(MORE, "MORE") 77 | ADD(MORE1, "MORE1") 78 | ADD(MORE1h, "MORE1h") 79 | ADD(MORE1l, "MORE1l") 80 | ADD(MORE2, "MORE2") 81 | ADD(MORE2h, "MORE2h") 82 | ADD(MORE2l, "MORE2l") 83 | ADD(MOREM, "MOREM") 84 | ADD(MOREP, "MOREP") 85 | ADD(MOREX, "MOREX") 86 | ADD(MOREY, "MOREY") 87 | ADD(MOREZ, "MOREZ") 88 | ADD(OCOLOR, "OCOLOR") 89 | ADD(P, "P") 90 | ADD(PORTCULISSOUND, "PORTCULISSOUND") 91 | ADD(RARITY, "RARITY") 92 | ADD(SELFREPAIR, "SELFREPAIR") 93 | ADD(SPELLCHANNELING, "SPELLCHANNELING") 94 | ADD(SPELLCOUNT, "SPELLCOUNT") 95 | ADD(TYPE, "TYPE") 96 | ADD(USEBESTWEAPONSKILL, "USEBESTWEAPONSKILL") 97 | ADD(USESCUR, "USESCUR") 98 | ADD(USESMAX, "USESMAX") 99 | ADD(WEIGHT, "WEIGHT") 100 | ADD(WEIGHTREDUCTION, "WEIGHTREDUCTION") 101 | -------------------------------------------------------------------------------- /src/tables/CObjBase_functions.tbl: -------------------------------------------------------------------------------- 1 | // 2 | // Class: CObjBase 3 | // Set: functions 4 | // Prefix: OV_ 5 | // 6 | 7 | ADD(CLICK, "CLICK") 8 | ADD(DAMAGE, "DAMAGE") 9 | ADD(DCLICK, "DCLICK") 10 | ADD(DIALOG, "DIALOG") 11 | ADD(DIALOGCLOSE, "DIALOGCLOSE") 12 | ADD(EDIT, "EDIT") 13 | ADD(EFFECT, "EFFECT") 14 | ADD(EFFECTP, "EFFECTP") 15 | ADD(EMOTE, "EMOTE") 16 | ADD(FIX, "FIX") 17 | ADD(FLIP, "FLIP") 18 | ADD(INFO, "INFO") 19 | ADD(INPDLG, "INPDLG") 20 | ADD(MENU, "MENU") 21 | ADD(MESSAGE, "MESSAGE") 22 | ADD(MESSAGEUA, "MESSAGEUA") 23 | ADD(MOVE, "MOVE") 24 | ADD(MOVENEAR, "MOVENEAR") 25 | ADD(MOVETO, "MOVETO") 26 | ADD(MSG, "MSG") 27 | ADD(NUDGEDOWN, "NUDGEDOWN") 28 | ADD(NUDGEUP, "NUDGEUP") 29 | ADD(P, "P") 30 | ADD(PROMPTCONSOLE, "PROMPTCONSOLE") 31 | ADD(PROMPTCONSOLEU, "PROMPTCONSOLEU") 32 | ADD(PROPSLIST, "PROPSLIST") 33 | ADD(REMOVE, "REMOVE") 34 | ADD(REMOVEFROMVIEW, "REMOVEFROMVIEW") 35 | ADD(RESENDTOOLTIP, "RESENDTOOLTIP") 36 | ADD(SAY, "SAY") 37 | ADD(SAYU, "SAYU") 38 | ADD(SAYUA, "SAYUA") 39 | ADD(SDIALOG, "SDIALOG") 40 | ADD(SOUND, "SOUND") 41 | ADD(SPELLEFFECT, "SPELLEFFECT") 42 | ADD(TAGLIST, "TAGLIST") 43 | ADD(TARGET, "TARGET") 44 | ADD(TIMERF, "TIMERF") 45 | ADD(TRIGGER, "TRIGGER") 46 | ADD(TRY, "TRY") 47 | ADD(TRYP, "TRYP") 48 | ADD(TRYSRC, "TRYSRC") 49 | ADD(TRYSRV, "TRYSRV") 50 | ADD(UID, "UID") 51 | ADD(UPDATE, "UPDATE") 52 | ADD(UPDATEX, "UPDATEX") 53 | ADD(USEITEM, "USEITEM") 54 | ADD(Z, "Z") 55 | -------------------------------------------------------------------------------- /src/tables/CObjBase_props.tbl: -------------------------------------------------------------------------------- 1 | // 2 | // Class: CObjBase 3 | // Set: attributes 4 | // Prefix: OC_ 5 | // 6 | 7 | ADD(ARMOR, "ARMOR") 8 | ADD(CAN, "CAN") 9 | ADD(CANSEE, "CANSEE") 10 | ADD(CANSEELOS, "CANSEELOS") 11 | ADD(CANSEELOSFLAG, "CANSEELOSFLAG") 12 | ADD(COLOR, "COLOR") 13 | ADD(COMBATBONUSPERCENT, "COMBATBONUSPERCENT") 14 | ADD(COMBATBONUSSTAT, "COMBATBONUSSTAT") 15 | ADD(COMPLEXITY, "COMPLEXITY") 16 | ADD(CTAGCOUNT, "CTAGCOUNT") 17 | ADD(DAM, "DAM") 18 | ADD(DAMCHAOS, "DAMCHAOS") 19 | ADD(DAMCOLD, "DAMCOLD") 20 | ADD(DAMDIRECT, "DAMDIRECT") 21 | ADD(DAMENERGY, "DAMENERGY") 22 | ADD(DAMFIRE, "DAMFIRE") 23 | ADD(DAMPHYSICAL, "DAMPHYSICAL") 24 | ADD(DAMPOISON, "DAMPOISON") 25 | ADD(DIALOGLIST, "DIALOGLIST") 26 | ADD(DISTANCE, "DISTANCE") 27 | ADD(ENHANCEPOTIONS, "ENHANCEPOTIONS") 28 | ADD(EVENTS, "EVENTS") 29 | ADD(EXPANSION, "EXPANSION") 30 | ADD(FACING, "FACING") 31 | ADD(FASTERCASTING, "FASTERCASTING") 32 | ADD(FASTERCASTRECOVERY, "FASTERCASTRECOVERY") 33 | ADD(HITLEECHLIFE, "HITLEECHLIFE") 34 | ADD(HITLEECHMANA, "HITLEECHMANA") 35 | ADD(HITLEECHSTAM, "HITLEECHSTAM") 36 | ADD(HITMANADRAIN, "HITMANADRAIN") 37 | ADD(INCREASEDAM, "INCREASEDAM") 38 | ADD(INCREASEDEFCHANCE, "INCREASEDEFCHANCE") 39 | ADD(INCREASEDEFCHANCEMAX,"INCREASEDEFCHANCEMAX") 40 | ADD(INCREASEHITCHANCE, "INCREASEHITCHANCE") 41 | ADD(INCREASESPELLDAM, "INCREASESPELLDAM") 42 | ADD(INCREASESWINGSPEED, "INCREASESWINGSPEED") 43 | ADD(ISARMOR, "ISARMOR") 44 | ADD(ISCHAR, "ISCHAR") 45 | ADD(ISCONT, "ISCONT") 46 | ADD(ISDIALOGOPEN, "ISDIALOGOPEN") 47 | ADD(ISEVENT, "ISEVENT") 48 | ADD(ISITEM, "ISITEM") 49 | ADD(ISNEARTYPE, "ISNEARTYPE") 50 | ADD(ISNEARTYPETOP, "ISNEARTYPETOP") 51 | ADD(ISPLAYER, "ISPLAYER") 52 | ADD(ISTEVENT, "ISTEVENT") 53 | ADD(ISTIMERF, "ISTIMERF") 54 | ADD(ISWEAPON, "ISWEAPON") 55 | ADD(LOWERMANACOST, "LOWERMANACOST") 56 | ADD(LOWERREAGENTCOST, "LOWERREAGENTCOST") 57 | ADD(LUCK, "LUCK") 58 | ADD(MAP, "MAP") 59 | ADD(MODAR, "MODAR") 60 | ADD(MODMAXWEIGHT, "MODMAXWEIGHT") 61 | ADD(NAME, "NAME") 62 | ADD(NAMELOC, "NAMELOC") 63 | ADD(NIGHTSIGHT, "NIGHTSIGHT") 64 | ADD(P, "P") 65 | ADD(PROPSAT, "PROPSAT") 66 | ADD(PROPSCOUNT, "PROPSCOUNT") 67 | ADD(RANGE, "RANGE") 68 | ADD(RANGEH, "RANGEH") 69 | ADD(RANGEL, "RANGEL") 70 | ADD(REFLECTPHYSICALDAM, "REFLECTPHYSICALDAM") 71 | ADD(REGENFOOD, "REGENFOOD") 72 | ADD(REGENHITS, "REGENHITS") 73 | ADD(REGENMANA, "REGENMANA") 74 | ADD(REGENSTAM, "REGENSTAM") 75 | ADD(REGENVALFOOD, "REGENVALFOOD") 76 | ADD(REGENVALHITS, "REGENVALHITS") 77 | ADD(REGENVALMANA, "REGENVALMANA") 78 | ADD(REGENVALSTAM, "REGENVALSTAM") 79 | ADD(RESCOLD, "RESCOLD") 80 | ADD(RESCOLDMAX, "RESCOLDMAX") 81 | ADD(RESDISPDNHUE, "RESDISPDNHUE") 82 | ADD(RESENERGY, "RESENERGY") 83 | ADD(RESENERGYMAX, "RESENERGYMAX") 84 | ADD(RESFIRE, "RESFIRE") 85 | ADD(RESFIREMAX, "RESFIREMAX") 86 | ADD(RESPHYSICAL, "RESPHYSICAL") 87 | ADD(RESPHYSICALMAX, "RESPHYSICALMAX") 88 | ADD(RESPOISON, "RESPOISON") 89 | ADD(RESPOISONMAX, "RESPOISONMAX") 90 | ADD(SERIAL, "SERIAL") 91 | ADD(SEXTANTP, "SEXTANTP") 92 | ADD(SPAWNITEM, "SPAWNITEM") 93 | ADD(TAG, "TAG") 94 | ADD(TAG0, "TAG0") 95 | ADD(TAGAT, "TAGAT") 96 | ADD(TAGCOUNT, "TAGCOUNT") 97 | ADD(TEXTF, "TEXTF") 98 | ADD(TIMER, "TIMER") 99 | ADD(TIMERD, "TIMERD") 100 | ADD(TIMESTAMP, "TIMESTAMP") 101 | ADD(TOPOBJ, "TOPOBJ") 102 | ADD(TRIGGER, "TRIGGER") 103 | ADD(UID, "UID") 104 | ADD(WEIGHT, "WEIGHT") 105 | ADD(Z, "Z") 106 | -------------------------------------------------------------------------------- /src/tables/CParty_functions.tbl: -------------------------------------------------------------------------------- 1 | // 2 | // Class: CParrtyDef 3 | // Set: functions 4 | // Prefix: PDV_ 5 | // 6 | 7 | ADD(ADDMEMBER, "ADDMEMBER") 8 | ADD(ADDMEMBERFORCED,"ADDMEMBERFORCED") 9 | ADD(CLEARTAGS, "CLEARTAGS") 10 | ADD(CREATE, "CREATE") 11 | ADD(DISBAND, "DISBAND") 12 | ADD(MESSAGE, "MESSAGE") 13 | ADD(REMOVEMEMBER, "REMOVEMEMBER") 14 | ADD(SETMASTER, "SETMASTER") 15 | ADD(SYSMESSAGE, "SYSMESSAGE") 16 | ADD(TAGLIST, "TAGLIST") 17 | -------------------------------------------------------------------------------- /src/tables/CParty_props.tbl: -------------------------------------------------------------------------------- 1 | // 2 | // Class: CPartyDef 3 | // Set: attributes 4 | // Prefix: PDC_ 5 | // 6 | 7 | ADD(ISSAMEPARTYOF, "ISSAMEPARTYOF") 8 | ADD(MEMBERS, "MEMBERS") 9 | ADD(SPEECHFILTER, "SPEECHFILTER") 10 | ADD(TAG, "TAG") 11 | ADD(TAG0, "TAG0") 12 | ADD(TAGAT, "TAGAT") 13 | ADD(TAGCOUNT, "TAGCOUNT") 14 | -------------------------------------------------------------------------------- /src/tables/CScriptObj_functions.tbl: -------------------------------------------------------------------------------- 1 | // 2 | // Class: CScriptObj 3 | // Set: functions 4 | // Prefix: SSC_ 5 | // 6 | 7 | ADD(ASC, "ASC") 8 | ADD(ASCPAD, "ASCPAD") 9 | ADD(BETWEEN, "BETWEEN") 10 | ADD(BETWEEN2, "BETWEEN2") 11 | ADD(CATEGORY, "CATEGORY") 12 | ADD(CHR, "CHR") 13 | ADD(CLRBIT, "CLRBIT") 14 | ADD(DEF, "DEF") 15 | ADD(DEF0, "DEF0") 16 | ADD(DEFLIST, "DEFLIST") 17 | ADD(DEFMSG, "DEFMSG") 18 | ADD(DESCRIPTION, "DESCRIPTION") 19 | ADD(EVAL, "Eval") 20 | ADD(EXPLODE, "EXPLODE") 21 | ADD(FEVAL, "FEval") 22 | ADD(FHVAL, "FHval") 23 | ADD(FLOATVAL, "FloatVal") 24 | ADD(FVAL, "Fval") 25 | ADD(HVAL, "Hval") 26 | ADD(ISBIT, "ISBIT") 27 | ADD(ISEMPTY, "ISEMPTY") 28 | ADD(ISNUM, "ISNUM") 29 | ADD(LIST, "LIST") 30 | ADD(LISTCOL, "Listcol") 31 | ADD(MD5HASH, "MD5HASH") 32 | ADD(MULDIV, "MulDiv") 33 | ADD(NEW, "NEW") 34 | ADD(OBJ, "OBJ") 35 | ADD(QVAL, "Qval") 36 | ADD(SETBIT, "SETBIT") 37 | ADD(SRC, "SRC") 38 | ADD(StrArg, "StrArg") 39 | ADD(StrEat, "StrEat") 40 | ADD(StrPos, "StrPos") 41 | ADD(StrReverse, "StrReverse") 42 | ADD(StrSub, "StrSub") 43 | ADD(StrToLower, "StrToLower") 44 | ADD(StrToUpper, "StrToUpper") 45 | ADD(StrTrim, "StrTrim") 46 | ADD(SUBSECTION, "SUBSECTION") 47 | ADD(SYSCMD, "SYSCMD") 48 | ADD(SYSSPAWN, "SYSSPAWN") 49 | ADD(UVAL, "UVAL") 50 | ADD(VAR, "VAR") 51 | ADD(VAR0, "VAR0") 52 | -------------------------------------------------------------------------------- /src/tables/CSector_functions.tbl: -------------------------------------------------------------------------------- 1 | // 2 | // Class: CSector 3 | // Set: functions 4 | // Prefix: SEV_ 5 | // 6 | 7 | ADD(ALLCHARS, "ALLCHARS") 8 | ADD(ALLCHARSIDLE, "ALLCHARSIDLE") 9 | ADD(ALLCLIENTS, "ALLCLIENTS") 10 | ADD(ALLITEMS, "ALLITEMS") 11 | ADD(DRY, "DRY") 12 | ADD(LIGHT, "LIGHT") 13 | ADD(RAIN, "RAIN") 14 | ADD(RESPAWN, "RESPAWN") 15 | ADD(RESTOCK, "RESTOCK") 16 | ADD(SEASON, "SEASON") 17 | ADD(SNOW, "SNOW") 18 | -------------------------------------------------------------------------------- /src/tables/CStoneMember_functions.tbl: -------------------------------------------------------------------------------- 1 | // 2 | // Class: CStoneMember 3 | // Set: functions 4 | // Prefix: STMMV_ 5 | // 6 | -------------------------------------------------------------------------------- /src/tables/CStoneMember_props.tbl: -------------------------------------------------------------------------------- 1 | // 2 | // Class: CStoneMember 3 | // Set: attributes 4 | // Prefix: STMM_ 5 | // 6 | 7 | ADD(ACCOUNTGOLD, "ACCOUNTGOLD") 8 | ADD(GUILD_ISALLY, "ISALLY") 9 | ADD(GUILD_ISENEMY, "ISENEMY") 10 | ADD(GUILD_THEYALLIANCE, "THEYALLIANCE") 11 | ADD(GUILD_THEYWAR, "THEYWAR") 12 | ADD(GUILD_WEALLIANCE, "WEALLIANCE") 13 | ADD(GUILD_WEWAR, "WEWAR") 14 | ADD(ISCANDIDATE, "ISCANDIDATE") 15 | ADD(ISMASTER, "ISMASTER") 16 | ADD(ISMEMBER, "ISMEMBER") 17 | ADD(LOYALTO, "LOYALTO") 18 | ADD(PRIV, "PRIV") 19 | ADD(PRIVNAME, "PRIVNAME") 20 | ADD(SHOWABBREV, "SHOWABBREV") 21 | ADD(TITLE, "GUILDTITLE") 22 | -------------------------------------------------------------------------------- /src/tables/classnames.tbl: -------------------------------------------------------------------------------- 1 | // 2 | // Class: all 3 | // Set: class names 4 | // 5 | 6 | ADD(AbstractThread, "AbstractThread"); 7 | ADD(CAccount, "CAccount"); 8 | ADD(CAccounts, "CAccounts"); 9 | ADD(CResourceLink, "CResourceLink"); 10 | ADD(CChar, "CChar"); 11 | ADD(CCharBase, "CCharBase"); 12 | ADD(CCharNPC, "CCharNPC"); 13 | ADD(CCharPlayer, "CCharPlayer"); 14 | ADD(CClient, "CClient"); 15 | ADD(CDialogDef, "CDialogDef"); 16 | ADD(CDialogResponseArgs, "CDialogResponseArgs"); 17 | ADD(CSectorBase, "CSectorBase"); 18 | ADD(CFileObj, "CFileObj"); 19 | ADD(CFileObjContainer, "CFileObjContainer"); 20 | ADD(CScriptObj, "CScriptObj"); 21 | ADD(CScriptTriggerArgs, "CScriptTriggerArgs"); 22 | ADD(CScript, "CScript"); 23 | ADD(CResourceRefArray, "CResourceRefArray"); 24 | ADD(CRegionWorld, "CRegionWorld"); 25 | ADD(CRegionBase, "CRegionBase"); 26 | ADD(CWorld, "CWorld"); 27 | ADD(CWorldThread, "CWorldThread"); 28 | ADD(CWebPageDef, "CWebPageDef"); 29 | ADD(CServerDef, "CServerDef"); 30 | ADD(CServer, "CServer"); 31 | ADD(CSector, "CSector"); 32 | ADD(CRegionResourceDef, "CRegionResourceDef"); 33 | ADD(CRandGroupDef, "CRandGroupDef"); 34 | ADD(CSpellDef, "CSpellDef"); 35 | ADD(CSkillClassDef, "CSkillClassDef"); 36 | ADD(CItemTypeDef, "CItemTypeDef"); 37 | ADD(CResource, "CResource"); 38 | ADD(CObjBase, "CObjBase"); 39 | ADD(CContainer, "CContainer"); 40 | ADD(CItemContainer, "CItemContainer"); 41 | ADD(CGMPage, "CGMPage"); 42 | ADD(CItemBase, "CItemBase"); 43 | ADD(CItem, "CItem"); 44 | ADD(CItemMulti, "CItemMulti"); 45 | ADD(CItemMultiCustom, "CItemMultiCustom"); 46 | ADD(CItemMap, "CItemMap"); 47 | ADD(CItemMessage, "CItemMessage"); 48 | ADD(CItemVendable, "CItemVendable"); 49 | ADD(CItemShip, "CItemShip"); 50 | ADD(CItemSpawn, "CItemSpawn"); 51 | ADD(CItemStone, "CItemStone"); 52 | ADD(CDataBase, "CDataBase"); 53 | ADD(CItemBaseMulti, "CItemBaseMulti"); 54 | ADD(CPathFinder, "CPathFinder"); 55 | ADD(CPartyDef, "CPartyDef"); 56 | ADD(CSQLite, "CSQLite"); 57 | ADD(CStoneMember, "CStoneMember"); 58 | #ifndef _WIN32 59 | ADD(CUnixTerminal, "CUnixTerminal"); 60 | #endif 61 | ADD(CVarDefCont, "CVarDefCont"); 62 | ADD(CVarDefContNum, "CVarDefContNum"); 63 | ADD(CVarDefContStr, "CVarDefContStr"); 64 | ADD(CVarDefMap, "CVarDefMap"); 65 | ADD(CVarDefMap::CVarDefContTest, "CVarDefContTest"); 66 | ADD(Main, "Main"); 67 | ADD(NetworkInput, "NetworkInput"); 68 | ADD(NetworkOutput, "NetworkOutput"); 69 | ADD(NetworkThread, "NetworkThread"); 70 | ADD(NetworkManager, "NetworkManager"); 71 | --------------------------------------------------------------------------------