From 138826b6d6a8ae478648f2774d74bdeed3a0261a Mon Sep 17 00:00:00 2001 From: Anonymous Date: Thu, 16 Jan 2014 14:41:17 -0700 Subject: [PATCH] Added MonAPI2 --- .../LoginServer/src/CMakeLists.txt | 20 + .../library/platform/projects/CMakeLists.txt | 1 + .../platform/projects/MonAPI2/CMakeLists.txt | 12 + .../platform/projects/MonAPI2/MonitorAPI.cpp | 642 +++++++++++++++ .../platform/projects/MonAPI2/MonitorAPI.h | 184 +++++ .../projects/MonAPI2/MonitorAPISample.ncb | Bin 0 -> 91136 bytes .../platform/projects/MonAPI2/MonitorData.cpp | 758 ++++++++++++++++++ .../platform/projects/MonAPI2/MonitorData.h | 342 ++++++++ .../platform/projects/MonAPI2/login.cfg | 3 + 9 files changed, 1962 insertions(+) create mode 100644 external/3rd/library/platform/projects/MonAPI2/CMakeLists.txt create mode 100644 external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp create mode 100644 external/3rd/library/platform/projects/MonAPI2/MonitorAPI.h create mode 100644 external/3rd/library/platform/projects/MonAPI2/MonitorAPISample.ncb create mode 100644 external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp create mode 100644 external/3rd/library/platform/projects/MonAPI2/MonitorData.h create mode 100644 external/3rd/library/platform/projects/MonAPI2/login.cfg diff --git a/engine/server/application/LoginServer/src/CMakeLists.txt b/engine/server/application/LoginServer/src/CMakeLists.txt index 8544a480..b00971fd 100644 --- a/engine/server/application/LoginServer/src/CMakeLists.txt +++ b/engine/server/application/LoginServer/src/CMakeLists.txt @@ -84,11 +84,31 @@ endif() include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/shared + ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedCommandParser/include/public + ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedCompression/include/public + ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedDatabaseInterface/include/public ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedDebug/include/public + ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFile/include/public ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public + ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedGame/include/public + ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedLog/include/public + ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMath/include/public ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public + ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public + ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetwork/include/public + ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public + ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedRandom/include/public + ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedSynchronization/include/public + ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedThread/include/public + ${SWG_ENGINE_SOURCE_DIR}/server/library/serverKeyShare/include/public + ${SWG_ENGINE_SOURCE_DIR}/server/library/serverNetworkMessages/include/public + ${SWG_ENGINE_SOURCE_DIR}/server/library/serverUtility/include/public ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/archive/include + ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/singleton/include + ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/unicode/include + ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/platform/projects + ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/platform/utils ) add_executable(LoginServer diff --git a/external/3rd/library/platform/projects/CMakeLists.txt b/external/3rd/library/platform/projects/CMakeLists.txt index ca7e3c99..92bd50f6 100644 --- a/external/3rd/library/platform/projects/CMakeLists.txt +++ b/external/3rd/library/platform/projects/CMakeLists.txt @@ -1,2 +1,3 @@ +add_subdirectory(MonAPI2) add_subdirectory(Session) diff --git a/external/3rd/library/platform/projects/MonAPI2/CMakeLists.txt b/external/3rd/library/platform/projects/MonAPI2/CMakeLists.txt new file mode 100644 index 00000000..3b356b72 --- /dev/null +++ b/external/3rd/library/platform/projects/MonAPI2/CMakeLists.txt @@ -0,0 +1,12 @@ + +include_directories( + ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/udplibrary + ${ZLIB_INCLUDE_DIR} +) + +add_library(MonAPI2 + MonitorAPI.cpp + MonitorAPI.h + MonitorData.cpp + MonitorData.h +) diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp b/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp new file mode 100644 index 00000000..8abd18a9 --- /dev/null +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp @@ -0,0 +1,642 @@ +#include +#include +#include +#include +#include "zlib.h" +#include "MonitorAPI.h" + +// ********************************************************************************************** +// ********************************************************************************************** +// ********************************** DO NOT EDIT THIS FILE *********************************** +// ********************************************************************************************** +// ********************************************************************************************** +void set_bit( unsigned char p[], int bit){ p[bit >> 3] |= 1 << (bit & 0x7); } +void unset_bit(unsigned char p[], int bit){ p[bit >> 3] &= ~(1 << (bit & 0x7)); } +int get_bit( unsigned char p[], int bit){ return (p[bit >> 3] >> (bit & 0x7)) & 1; } +int ZEXPORT uncompress2( Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen); + + +//////////////////////////////////////// +// Player implementation +//////////////////////////////////////// +MonitorObject::MonitorObject(UdpConnection *con,CMonitorData *_gamedata, char *passwd, char **addressList,bool _bprint) +{ + mbprint = _bprint; + mMonitorData = _gamedata; + mbAuthenticated = false; + mPasswd = passwd; + mAddressList = addressList; + mHierarchySent = false; + mSequence = 1; + mlastUpdateTime = 0; + mConnection = con; + mConnection->AddRef(); + mConnection->SetHandler(this); + + // Flag all the descriptions + mMark = new unsigned char [ (mMonitorData->DataMax()/8)+2]; + memset(mMark,0,(mMonitorData->DataMax()/8)+2); + char hold[256]; + if( mbprint ) + { + fprintf(stderr,"MONITOR API CONNECTED: %s:%d\n", + mConnection->GetDestinationIp().GetAddress(hold), + mConnection->GetDestinationPort()); + } +} + +MonitorObject::~MonitorObject() +{ + if( mMark ) + delete [] mMark; + + if( mConnection ) + { + mConnection->SetHandler(NULL); + mConnection->Disconnect(); + mConnection->Release(); + } +} + +void MonitorObject::OnTerminated( UdpConnection * /* con */) +{ +char hold[214]; + + if( mConnection ) + { + if( mbprint ) + { + mConnection->GetDestinationIp().GetAddress(hold); + if( mbprint ) + { + fprintf(stderr,"MONITOR API TERMINATE %s:%d %s - %s\n", + hold, + mConnection->GetDestinationPort(), + UdpConnection::DisconnectReasonText( mConnection->GetDisconnectReason()), + UdpConnection::DisconnectReasonText( mConnection->GetOtherSideDisconnectReason())); + } + } + mConnection->SetHandler(NULL); + mConnection->Disconnect(); + mConnection->Release(); + mConnection = NULL; + } +} + + +void MonitorObject::OnRoutePacket( UdpConnection * con, const unsigned char *data, int dataLen) +{ + + if( dataLen < 6 ) + { + if( mbprint ) + fprintf(stderr,"MONITOR API: This should not happen, line %d\n",__LINE__); + } + + simpleMessage msg(data); + + if( con == NULL ) + { + if( mbprint) + fprintf(stderr,"MONITOR API: MonitorObject.OnRoutePacket, recived a NULL connection.?\n"); + return; + } + + // ************************* Login Process *************************** + if ( mbAuthenticated == false ) + { + if ( msg.getCommand() != MON_MSG_AUTH ) + return; + + if( processAuthRequest(data, dataLen) == false ) + return; + + mbAuthenticated = true; + return; + } + + // ************************* Process Commands *********************** + switch(msg.getCommand()) + { + + // *********************** Game Server Processing ****************** + case MON_MSG_QUERY_ELEMENTS: + if( mHierarchySent == true ) + { + mMonitorData->processElementsRequest(con,mSequence,(char *)&data[6],dataLen,mlastUpdateTime ); + mlastUpdateTime = (long)time(NULL); + break; + } + + // When the hierarchy has changed, fall through + case MON_MSG_QUERY_HIERARCHY_BLOCK: + if( mMonitorData->processHierarchyRequestBlock(con,mSequence) == false) + { + break; + } + mHierarchySent = true; + break; + + case MON_MSG_QUERY_DESCRIPTION: + mMonitorData->processDescriptionRequest(con,mSequence,(char *)&data[6], dataLen,mMark); + break; + + case MON_MSG_ERROR: + processError(data); + break; + + default: + fprintf(stderr,"MONITOR API: unknown message type received from client [%x]\n",msg.getCommand()); + break; + } +} + + +bool MonitorObject::checkAddress(const char * address) +{ +int x = 0; + while( mAddressList[x] ) + { + if (strncmp(mAddressList[x], address, strlen(mAddressList[x]))== 0) + return true; + x++; + } + return false; +} + +bool MonitorObject::checkPasswd( const char *passwd) +{ + if (strcmp(mPasswd,passwd)== 0 ) + return true; + return false; +} + +bool MonitorObject::processAuthRequest(const unsigned char * data, int /* dataLen */) +{ +char reply; +stringMessage strMsg(data); +char addBuff[16] = {0}; +char sendBuf[32]; +int len; + + + reply = '1'; + + if ( checkAddress(mConnection->GetDestinationIp().GetAddress(addBuff)) == false) + { + reply = '3'; + } + else if (checkPasswd(strMsg.getData()) == false) + { + reply = '2'; + } + + memset(sendBuf, 0, sizeof(sendBuf)); + + len = 0; + packShort( sendBuf + len, len,(short)MON_MSG_AUTHREPLY); + packShort( sendBuf + len, len, mSequence); + packShort( sendBuf + len, len,(short)3); + packShort( sendBuf + len, len,(short)CURRENT_API_VERSION); + packByte( sendBuf + len, len, reply); + + mConnection->Send(cUdpChannelReliable1, sendBuf, 9 ); + return true; +} + +void MonitorObject::DescriptionMark(int x,int mode) +{ + if( mode == 0 ) set_bit(mMark,x); else unset_bit(mMark,x); +} + +char * getErrorString(unsigned short errorCode) +{ + if (errorCode == 0) + { + return "none"; + } + else + { + switch (errorCode) + { + case INVALID_HEADER: + case INVALID_SEQUENCE: + case INVALID_MSG_LENGTH: + case INVALID_MSG_TYPE: + return "Invalid message"; + + case INVALID_AUTH_REQUEST: + return "Invalid authorization request"; + + case INVALID_ELEMENT_REQUEST: + case INVALID_HIERARCHY_REQUEST: + return "Invalid data request"; + + case INVALID_AUTH_REPLY: + return "Invalid reply to authentication request"; + + case INVALID_ELEMENT_REPLY: + case INVALID_HIERARCHY_REPLY: + return "Badly formatted data in dataReplyMessage"; + + case INVALID_ERROR_CODE: + return "Received invalid error message"; + + } + } + return "Undefined error code"; +} + +bool MonitorObject::processError(const unsigned char * data) +{ + stringMessage strMsg(data); + unsigned short errCode = (unsigned short)atoi(strMsg.getData()); + fprintf(stderr,"MONITOR API Error: %s\n", getErrorString(errCode)); + return true; +} + +/////////////////////////////////////// +// MonitorManager implementation +//////////////////////////////////////// +MonitorManager::MonitorManager(const char *configFile, CMonitorData *_gamedata, UdpManager *manager, bool _bprint) +{ + mManager = manager; + mbprint = _bprint; + passString = NULL; + mMonitorData = _gamedata; + mObjectCount = 0; + + for(int x=0;xSetHandler(NULL); + con->Disconnect(); + con->Release(); + } + if( mbprint ) + fprintf(stderr,"MonitorAPI: Collector connection reached max (%d).\n",CONNECTION_MAX); + return; + } + + AddObject(new MonitorObject(con,mMonitorData,passString,allowedAddressList,mbprint)); +} + +void MonitorManager::AddObject(MonitorObject *Object) +{ + mObject[mObjectCount++] = Object; +} + +void MonitorManager::GiveTime() +{ + // check if the monitor object is no longer connected + for (int i = 0; i < mObjectCount; i++) + { + if( mObject[i]->mConnection == NULL || + mObject[i]->mConnection->GetStatus() == UdpConnection::cStatusDisconnected ) + { + MonitorObject *o = mObject[i]; + mObjectCount--; + memmove(&mObject[i], &mObject[i + 1], (mObjectCount - i) * sizeof(MonitorObject *)); + i--; + delete o; + } + } +} + +void MonitorManager::HierarchyChanged() +{ + for (int i = 0; i < mObjectCount; i++) + mObject[i]->HeirarchyChanged(); +} + +void MonitorManager::DescriptionMark(int x ,int mode) +{ + for (int i = 0; i < mObjectCount; i++) + mObject[i]->DescriptionMark(x,mode); +} + +bool MonitorManager::loadAuthData(const char * filename) +{ +int nline; +int len; +int x; +char buffer[1024]; + + FILE *fp = fopen(filename,"r"); + if (fp == NULL) + { + fprintf(stderr,"Monitor API: could not open %s file\nTHIS FILE IS REQUIRED.\n", filename); + return false; + } + + if( passString ) + free(passString); + + + for(x=0;x 0 ) + { + if( nline == 0 ) + { + passString = (char *)malloc( len + 1 ); + strcpy(passString,buffer); + } + else + { + allowedAddressList[x] = (char *)malloc( len + 1 ); + strcpy(allowedAddressList[x],buffer); + x++; + } + } + nline++; + } + + // clean up + fclose(fp); + return true; +} + +// ****************************************************************************************************** +// ****************************************************************************************************** +// ****************************************************************************************************** +// ****************************************************************************************************** + +CMonitorAPI::CMonitorAPI( const char *configFile, unsigned short Port, bool _bprint , char *address, UdpManager * mang ) +{ + mbprint = _bprint; + mPort = Port; + + mAddress = NULL; + if( address ) + { + mAddress = (char *)malloc(strlen(address)+1); + strcpy(mAddress,address); + } + + if( mang == NULL ) + { + UdpManager::Params params; + params.handler = NULL; + params.maxConnections = CONNECTION_MAX; + params.outgoingBufferSize = 1000000; + params.noDataTimeout = 130000; + params.oldestUnacknowledgedTimeout = 120000; + params.processIcmpErrors = false; + params.port = mPort; + mManager = new UdpManager(¶ms); + mMonitorData = new CMonitorData(); + } + + mObjectManager = new MonitorManager(configFile,mMonitorData,mManager,mbprint); + + mManager->SetHandler(mObjectManager); + + if( mbprint ) + fprintf(stderr,"MonitorAPI: started on port->%d\n",mPort); +} + +CMonitorAPI::~CMonitorAPI() +{ + if( mAddress ) + free(mAddress); + + if( mObjectManager ) + delete mObjectManager; + + mManager->Release(); + + if( mMonitorData ) + delete mMonitorData; + +} + +void CMonitorAPI::Update() +{ + if( mManager ) + mManager->GiveTime(); + if( mObjectManager ) + mObjectManager->GiveTime(); +} + +int CMonitorAPI::add(const char *label, int id, int ping, const char *des ) +{ +int rnt; + + rnt = mMonitorData->add(label,id,ping,des); + if( rnt ) + mObjectManager->HierarchyChanged(); + return rnt; +} + +void CMonitorAPI::remove(int Id) +{ + mMonitorData->remove(Id); + mObjectManager->HierarchyChanged(); +} + +void CMonitorAPI::setDescription( int Id, const char *Description ) +{ +int x; +int mode; + + x = mMonitorData->setDescription(Id,Description,mode); + if( x == -1 ) + return; + mObjectManager->DescriptionMark(x,mode); +} + +void CMonitorAPI::dump(){ mMonitorData->dump(); } + +//---------------------------------------------------------------- +monMessage::monMessage():command(0),sequence(0),size(0){} + +//---------------------------------------------------------------- +monMessage::monMessage(short cmd,short seq,short s):command(cmd),sequence(seq),size(s){} + +//---------------------------------------------------------------- +monMessage::monMessage(const unsigned char * source):command(0),sequence(0),size(0) +{ +int len; + + len = 0; + unpackShort( (char *)source + len, len,command); + unpackShort( (char *)source + len, len,sequence); + unpackShort( (char *)source + len, len,size); +} + +//---------------------------------------------------------------- +// monMessage::monMessage(const monMessage ©):command(copy.command),sequence(copy.sequence),size(copy.size){} + + + +//---------------------------------------------------------------- +stringMessage::stringMessage(const unsigned char * source):monMessage(source) +{ +int size; + + size = (int)strlen((char *)source+6) +1; + data = new char [ size ]; + strcpy(data,(char *)source+6); // Add six for the size of the header +} + +//---------------------------------------------------------------- +stringMessage::stringMessage(const unsigned short command,const unsigned short sequence,const unsigned short size,char * newData): +monMessage(command, sequence, size) +{ + data = new char [strlen(newData) + 1]; + if (data) + strncpy(data, newData, strlen(newData + 1)); + else + data = NULL; +} + +//---------------------------------------------------------------- +stringMessage::~stringMessage() +{ + if(data) + delete [] data; + data = 0; +} + +//---------------------------------------------------------------- +authReplyMessage::authReplyMessage(const unsigned char * source) : +monMessage(source) +{ + int len = 6; + unpackShort((char *)source+len,len,version); + unpackByte((char *)source+len,len,data); +} + +//---------------------------------------------------------------- +authReplyMessage::authReplyMessage(const unsigned short command, + const unsigned short sequence, + const unsigned short size, + unsigned char newData): +monMessage(command, sequence, size),data(newData){} + + +//---------------------------------------------------------------- +dataReplyMessage::dataReplyMessage(const unsigned char * source) : +monMessage(source) +{ + data = new unsigned char[getSize()+1]; + + if (data) + { + memcpy(data, source + 6, getSize()); + data[getSize()] = 0; + } + else + data = NULL; +} + +//---------------------------------------------------------------- +dataReplyMessage::dataReplyMessage(const unsigned short command, + const unsigned short sequence, + const unsigned short size, + unsigned char * newData, + int newDataLen): +monMessage(command, sequence, size) +{ + data = new unsigned char[newDataLen]; + if (data) + memcpy(data, newData, newDataLen); + else + data = NULL; +} + +//---------------------------------------------------------------- +dataReplyMessage::~dataReplyMessage() +{ + if (data) + { + delete [] data; + data = 0; + } +} + +//---------------------------------------------------------------- +simpleMessage::simpleMessage(const unsigned char * source):monMessage(source){} +//---------------------------------------------------------------- +simpleMessage::simpleMessage(const unsigned short command, + const unsigned short sequence, + const unsigned short size): +monMessage(command, sequence, size){} +//---------------------------------------------------------------- +simpleMessage::~simpleMessage(){} + +//---------------------------------------------------------------- + + +//---------------------------------------------------------------- +dataBlockReplyMessage::dataBlockReplyMessage(const unsigned char * source) : +monMessage(source) +{ +int err; +unsigned long S = 4000000; +unsigned char *p; + + data = NULL; + p = (unsigned char *)malloc(4000000); + memset(p,0,4000000); + err = uncompress(p,&S,(source+6),(long)getSize()); + if( Z_OK != err ) { free(p);return; } + data = new unsigned char[S+1]; + memcpy(data,p,S); + setSize((unsigned short)S); + free(p); +} +//---------------------------------------------------------------- +dataBlockReplyMessage::~dataBlockReplyMessage() +{ + if (data) + { + delete [] data; + data = 0; + } +} + + + + diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.h b/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.h new file mode 100644 index 00000000..d97079c7 --- /dev/null +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.h @@ -0,0 +1,184 @@ +#ifndef __MONITOR_API__ +#define __MONITOR_API__ + +/********************************************************************************************** + Please contact dtaylor@soe.sony.com for any comments or request for chagnes. +********************************************************************************************** + + +Required libs + + UdpLibrary + zlib + + + +********************************** DO NOT EDIT THIS FILE *********************************** +********************************************************************************************** +**********************************************************************************************/ +#include "MonitorData.h" + +class CMonitorAPI { + +private: + + CMonitorData *mMonitorData; + UdpManager *mManager; + MonitorManager *mObjectManager; + char *mAddress; + unsigned short mPort; + bool mbprint; + +public: + + /******************* CMonitorAPI ************************************* + * + * configFile = Included in the zip file, is a file "mon.cfg". In this file is a password and + * ip address's that are allowed to connect to your server. You can rename the + * file or place it in another directory. Use this param to access this file. + * + * + * port = use port 2200 as a default. When using more than one server on a machine, use another port, range 2200-2220 + * + * debug = turn on/off debugging. + * + * address = (NOT USED) Leave as NULL + * + * UdpManager * mang = (NOT USED) Leave as NULL + * + * // GenericNotifier *notifier = (NOT USED) Leave as NULL + * + */ + CMonitorAPI( const char *configFile, unsigned short port, bool debug = false , char * address = NULL, UdpManager * mang = NULL ); + + ~CMonitorAPI(); + + + /**************** Process communication from collectors ****************** + * + * This needs to be called in the main loop every processing cycle. + * Update will read the socket for request and send updates to the + * collector. + * + * Note: Update is non-blocking + */ + void Update(); + + + /**************** Add element to list ********************************** + * + * label = name of the element. + * Elements labels must be unique. "." is use to group labels + * Example: + * Server.Zone 1.process + * Server.Zone 1.CPU + * Server.Zone 2.process + * Server.Zone 2.CPU + * + * Will show as + * Server - + * | + * - Zone 1 - + * - process + * - CPU + * |- Zone 2 - + * - process + * - CPU + * + * Note: do not use "/" char. + * + * Key = This id must be unigue and key use to identify the element when setting it. + * Any positvie intenger can be use. + * + * mode = + * #define MON_HISTORY will store values (avg 5min), you will be able to graph. + * #define MON_ONLY_SHOW will not store vlaue, only for showing. + * + * + * + * description = descritpion of the element. Tell us what the element means. Hostname, BPS, Kbytes, Seconds,..... + * + * Note: All values are sent to the collector every two minutes (forced). In between when values are + * forced, only values that are changed will be sent to the collector. + * + * ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! + * + * Required: + * One element is requried. Name the elment "Population" and in the descritpion please add the follwing, + * + * + * ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! + * + * Max Limited + * #define ELEMENT_MAX_START 2000 + */ + int add( const char *label, int Key, int mode = MON_HISTORY, const char *Description = NULL ); + + + /**************** Set the description of an element ** + * + * Sets the description to an element. + * + * Key = element key. + * + * Description = description of element. + * + * Note: Descriptions take longer to update, do not use description to + * display vital informaiton. + * + */ + void setDescription( int Key, const char *Description ) ; + + + /**************** Set the value of an element ********* + * + * Sets the element to the current value. + * + * Key = element key. + * + * value = current value to set. + * + * Note: When a element is assoicated with a Server. + * Use the following values to signify the status. + * If you would like to add another status mode, + * please contact dtaylor@soe.sony.com + * + * #define STATUS_LOCKED -1 // Server is locking out players, mataince mode + * #define STATUS_DOWN -2 // Server is down. + * #define STATUS_NOCONNECT -3 // Server is not connected + * #define STATUS_LOADING -4 // Server is in a loading state + * + */ + void set(int Key, int value); + + + /**************** Remove element from list *********** + * + * Removes the element. + * + * Key = element key + */ + void remove(int Key); + + + /***************** Debug dump ********************** + * + * Will printf a list of all the elelments. + * Format: + * + * Label, Key, Value, Mode + */ + void dump(); + + + // ************** Do not use ************************* + void setMax(int max){ mMonitorData->setMax(max);} + +}; + + +inline void CMonitorAPI::set(int Id, int value){ mMonitorData->set(Id,value); } + +#endif + + diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorAPISample.ncb b/external/3rd/library/platform/projects/MonAPI2/MonitorAPISample.ncb new file mode 100644 index 0000000000000000000000000000000000000000..68d34aa8ceef5300220c81bf5de55090b81232ec GIT binary patch literal 91136 zcmeI537lL-oyY6-%p`NqBqR_*Af04#4Y?B_3?Z3h5^|7>Ou~&}j!rVB=U@(!073{T zhXhGL#e+*w0R^J4a;kWsh@b&nR%KU#6$Ms6@gR7>{=W5Iy?))(6F||0wW~kX?_cMu z_pj?;Rsa9LmbEl>ws*C!>yFn=t~>bPct>aZ`p$;dcymK{Lt{f%B0g=>lqqG!LzgTx z#^f90nG?)&0-q}1?#Dg4cOd(0a-lfys`133)jFp$GQ4g)z1 zxKKn?>r4CFA7!$1xLISk}5ki$R@133)jFp$GQ4g)z1xKKn?>r4CFA7!$1xL z?@xKKn?>r4CFA7!$1xLISk}5ki$R@ z133)jFp$GQ4g)z1xKKn?>r4CFA7!$1xLISk}5APh{nXNtGH{)yT9N`=AKJYy!e zHMAzW^k{0F+}+T*KGEIMwyxcG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ilV5fks5%xmZ0bwVE1#h*|alJJxmQ&Op9#DGN7LxMMW>9Sl zD+MfOsAfO3BE`}Kivk9=NDQoYutQ*ArF90@K@6-^u&tqn95w~mpPp6xbAtLK4y
>#M7hrJAz499}WJ79?z zp!87#+ey?ocFd?BY=f|YL=EhwQ3LxVEH4;X4q-LpnwG!Sz&_@TV|#*)1T!S=v*W?) z3hN)NS+H`#0tqWItf#QJz;^j&2KFRal%uRvdrJeGA?!!6`#82)SaM)#dtCMG3@m=I z5Ia+;`2hAuSbt$-MBOEZtFSS!Tf<)J46M#k1M3q8wrvb-ORy`$iu|b3!9oKYkYl@q zeG*m}*c78?r0|k6ISk}5@HQ~u^nWq_o@z| zY^UQr75=lZ@@A|5YxfB^Tm4_Pa-;uirJka>%&B_*UK4SLp6LIYGXAjGwVH@8le=5t z*XoJ>ugkuBvj?4ZzuY``>#6AGDLv8u^&36W|7ix?Ed5_A--7AAcuh*267n4VIYTr90qb2$YCId kfgA>M7|3BDhk+ahau~>AAcuh*267n4VIYTr|Nj{HUwpzT8~^|S literal 0 HcmV?d00001 diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp b/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp new file mode 100644 index 00000000..bd417941 --- /dev/null +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp @@ -0,0 +1,758 @@ +#include +#include +#include +#include +#include "zlib.h" +#include "MonitorData.h" + + +//********************************************************************************************** +//********************************************************************************************** +//********************************** DO NOT EDIT THIS FILE *********************************** +//********************************************************************************************** +//********************************************************************************************** + +#define BUFFER_SIZE_START 2048 +#define BUFFER_RESIZE_VALUE 1024 + +extern void set_bit( unsigned char p[], int bit); +extern void unset_bit(unsigned char p[], int bit); +extern int get_bit( unsigned char p[], int bit); + + +// ------------------ Support Routine ----------------------------- +////////////////////////////////////////////////////////////////////// +// qsort compare routine +////////////////////////////////////////////////////////////////////// + +int compar_name( const void *e1, const void *e2 ) +{ +MON_ELEMENT *data1,*data2; + + data1 = *(MON_ELEMENT **)e1; + data2 = *(MON_ELEMENT **)e2; + +#ifdef _WIN32 + return _stricmp(data1->label, data2->label); +#else + return strcasecmp(data1->label,data2->label); +#endif +} + +int compar_index( const void *e1, const void *e2 ) +{ +MON_ELEMENT *data1,*data2; + data1 = (MON_ELEMENT *)e1; + data2 = (MON_ELEMENT *)e2; + return data1->id - data2->id; +} + + +// ------------------ Game Data Object ---------------------------- +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// +//CMonitorData::CMonitorData(GenericNotifier *notifier) +//: m_notifier(notifier) +CMonitorData::CMonitorData() +{ + + m_sequence = 1; + m_buffer = NULL; + m_nbuffer = 0; + m_count = 0; + m_max = ELEMENT_MAX_START; + m_data = new MON_ELEMENT[m_max]; + for(int x=0;xSend(cUdpChannelReliable1, p, size + 6); + free(p); + sequence++; +} + +void CMonitorData::send( UdpConnection *con,short & sequence,short msg,char *data,int size ) +{ +unsigned long compress_len; +int len; +unsigned short usize; +char *p; +int rnt; + + if( CURRENT_API_VERSION != CURRENT_API_3 ) + return; + + p = (char *)malloc(size+6+1000); + len = 0; + memset(p,0,size+6+1000); + packShort(p+len, len, msg); + packShort(p+len, len, m_sequence); + compress_len = size + 1000; + rnt = compress2((Bytef *)p+6,&compress_len,(Bytef *)data,(long)size,2); + if( rnt != Z_OK ) + { + free(p); + printf("CMonitor::send-compress failed, error=%d size =%d\n",rnt,size); + return; + } + + usize = (unsigned short)compress_len; + packShort(p+len, len, usize); + usize += 6; + con->Send(cUdpChannelReliable1, p, usize); + free(p); + sequence++; +} + +bool CMonitorData::processHierarchyRequestBlock( UdpConnection *con, short & sequence ) +{ +int x,size,count,len; +char temp[512]; + + if( m_count == 0 ) + { + send(con,sequence,MON_MSG_REPLY_HIERARCHY,"NOTREADY"); + return 0; + } + + memset(m_buffer,0,16); + send(con,sequence,MON_MSG_REPLY_HIERARCHY_BLOCK_BEGIN,m_buffer); + + MON_ELEMENT **me; + me = new MON_ELEMENT *[m_count]; + for(x=0;xlabel,me[x]->id,me[x]->ping); + if( len+size >= m_nbuffer ) resize_buffer(size+BUFFER_RESIZE_VALUE); + strcpy(&m_buffer[size],temp); + size += len; + if( size > 64000 ) + { + send(con,sequence,MON_MSG_REPLY_HIERARCHY_BLOCK,m_buffer,size+1); + memset(m_buffer,0,size); + count++; + size = 0; + } + x++; + } + delete [] me; + if( size > 0 ) + { + send(con,sequence,MON_MSG_REPLY_HIERARCHY_BLOCK,m_buffer,size+1); + memset(m_buffer,0, 16); + count++; + size = 0; + } + memset(m_buffer,0, 16); + send(con,sequence,MON_MSG_REPLY_HIERARCHY_BLOCK_END,m_buffer); + return 1; +} + + +bool CMonitorData::processElementsRequest( + UdpConnection *con, short & sequence, char * data, int /* dataLen */ , long lastUpdateTime ) +{ +char tmp[200]; +int x,id; +int size; +int count; +char **list; + + memset(m_buffer,0,16); + if( !strcmp(data,"-1") ) + { + size = 0; + for (x=0;x= m_nbuffer ) + resize_buffer(size+BUFFER_RESIZE_VALUE); + strcat(m_buffer,tmp); + if( size > 65000 ) + { + send(con,sequence,MON_MSG_REPLY_ELEMENTS,m_buffer); + memset(m_buffer,0,16); + } + + } + if( size ) + send(con,sequence,MON_MSG_REPLY_ELEMENTS,m_buffer); + + return 1; + } + + if( !strcmp(data,"-2") ) + { + size = 0; + count = 0; + for (x=0;x= m_nbuffer ) + resize_buffer(size+BUFFER_RESIZE_VALUE); + strcat(m_buffer,tmp); + count++; + } + + if( size > 65000 ) + { + send(con,sequence,MON_MSG_REPLY_ELEMENTS,m_buffer); + memset(m_buffer,0,16); + } + } + if ( count ) + { + send(con,sequence,MON_MSG_REPLY_ELEMENTS,m_buffer); + return 1; + } + return 0; + } + + list = new char * [m_max]; + count = parseList( list, data,'|',m_max); + memset(m_buffer,0,16); + + size = 0; + for(x=0;x= m_nbuffer ) + resize_buffer(size+BUFFER_RESIZE_VALUE); + strcat(m_buffer,tmp); + } + } + + delete [] list; + + if( count > 0 ) + send(con,sequence,MON_MSG_REPLY_ELEMENTS,m_buffer); + + return 0; +} + + +bool CMonitorData::processDescriptionRequest(UdpConnection *con, short & sequence, char * userData, int , unsigned char *mark) +{ +char line[4096]; +char tmp[400]; +int x,id,size; +int flag; +char *p; + + size = 0; + memset(m_buffer,0,16); + strcpy(line,userData); + p = strtok(line,"|"); + flag = 0; + if( strstr(p,"next") ) + { + for(x=0;x= m_nbuffer ) + resize_buffer(size+BUFFER_RESIZE_VALUE); + strcat(m_buffer,tmp); + send(con,sequence,MON_MSG_REPLY_DESCRIPTION,m_buffer); + return 1; + } + } + } + } + else + { + if( p ) + { + size = 0; + flag = 0; + id = atoi(p); + for(x=0;x= m_nbuffer ) + resize_buffer(size+BUFFER_RESIZE_VALUE); + strcat(m_buffer,tmp); + if( size >= 2000 || m_data[x].discription ) + { + send(con,sequence,MON_MSG_REPLY_DESCRIPTION,m_buffer); + return 1; + } + } + } + } + } + } + + + if( flag == 2 ) + send(con,sequence,MON_MSG_REPLY_DESCRIPTION,m_buffer); + send(con,sequence,MON_MSG_REPLY_DESCRIPTION,"none"); + return 0; + +} + +int CMonitorData::add(const char *label, int id, int ping, const char *des ) +{ +int x; + + if( strlen(label) >= 127 ) + { + printf("MonAPI Error: add() label exceeds length of 127. ->%s\n",label); + return 0; + } + + for(x=0;x %s\n",id,m_data[x].label,label); + m_data[x].ping = pingValue( ping ); + m_data[x].value = 0; + m_data[x].id = id; + + //******* Label *********** + if( m_data[x].label ) + delete [] m_data[x].label; + m_data[x].label = new char [strlen(label)+1]; + strcpy(m_data[x].label,label); + + //******* Discription ****** + if( m_data[x].discription != NULL ) + delete [] m_data[x].discription; + m_data[x].discription = NULL; + if( des ) + { + m_data[x].discription = new char [strlen(des)+1]; + strcpy(m_data[x].discription,des); + } + qsort(m_data,m_count,sizeof(MON_ELEMENT),compar_index); + return 1; + } + + if( !strcmp(label,m_data[x].label) ) + { + printf("MonAPI ERROR: Label already found %s Id: old(%d) new(%d).\n",label,m_data[x].id,id); + return 0; + } + } + + if( m_max == m_count + 1 ) + { + printf("MonitorObject: max element reached [%d].\n%s\nContact David Taylor (858) 577-3155.\n",m_max,label); + return 0; + } + m_data[m_count].ping = pingValue( ping ); + m_data[m_count].value = 0; + m_data[m_count].id = id; + if(m_data[m_count].label) + delete [] m_data[m_count].label; + m_data[m_count].label = new char [strlen(label)+1]; + strcpy(m_data[m_count].label,label); + if( des ) + { + if( m_data[x].discription ) + delete [] m_data[x].discription; + m_data[x].discription = new char [strlen(des)+1]; + strcpy(m_data[x].discription,des); + } + m_count++; + qsort(m_data,m_count,sizeof(MON_ELEMENT),compar_index); + return 1; +} + +int CMonitorData::setDescription( int Id, const char *Description , int & mode) +{ +int x; + + for(x=0;x 1; ) + { + i = (high+low) / 2; + if ( Id <= m_data[i].id ) + high = i; + else + low = i; + } + + if ( high < m_count && Id==m_data[high].id ) + { + if( m_data[high].ChangedTime == 0 || m_data[high].value != value ) + m_data[high].ChangedTime = (long)time(NULL); + m_data[high].value = value; + } +} + +void CMonitorData::remove(int Id) +{ +int x; + + if( m_count == 1 ) + { + if( m_data[0].label ) + delete [] m_data[0].label; + + if( m_data[0].discription ) + delete [] m_data[0].discription; + + + m_data[0].label = 0; + m_data[0].id = 0; + m_data[0].value = 0;; + m_data[0].ping = 0;; + m_count--; + return; + } + + for(x=0;x 0 ) + { + if( *data == tok ) + { + *data = 0; + data++; + cnt++; + list[count] = data; + if( *data ) count++; + } + cnt++; + if( *data ) data++; + } + return count; +} + + +void CMonitorData::dump() +{ + printf("********** Monitor API Dump *******************\n"); + printf(" Version: %d\n",CURRENT_API_VERSION); + printf("\ncount: %d\n", m_count); + printf("\t%-40s %8s\t%s\t%s\n","Label","Id","Ping","Value"); + for(int x=0;x +#include + +#define CURRENT_API_VERSION 3 +#define CURRENT_API_1 1 +#define CURRENT_API_2 2 +#define CURRENT_API_3 3 + +#define MON_HISTORY 4 // This will ping every 30 sec. and report max of 5 min. +#define MON_ONLY_SHOW 5 // This will not store data. WILL NOT GRAPH + +#define STATUS_LOCKED -1 // Server is locking out players +#define STATUS_DOWN -2 // Server is down. +#define STATUS_NOCONNECT -3 // Server is not connected +#define STATUS_LOADING -4 // Server is in a loading state + +#define ELEMENT_MAX_START 5000 + + +/* + Provide binary data packing and unpacking functions + +Usage + Format strings are as follows: + 'c' - char (1) + 'l' - long int (4) + 'L' - long long int (8) + 'i' - int (4) + 's' - short int (2) + 'S' - C-style, null-terminated string (n + null) + 'Bn' - buffer, of size n. Used for non-terminated strings, or + other binary data. +*/ + +extern int packString(char *buffer, int & len, char * value); +extern int packByte(char *buffer, int & len, char value); +extern int packShort(char *buffer, int & len, short value); +extern int unpackShort(char *buffer, int & len, short & value); +extern int unpackShort(char *buffer, int & len, unsigned short & value); +extern int unpackByte( char *buffer, int & len, char & value); + + +//---------------------------------------------------------------- +typedef unsigned char byte; + +//---------------------------------------------------------------- +// Define the message types that are understood via the Monitoring API +enum MON_MESSAGES +{ + MON_MSG_AUTH = 1, // client sends auth info during connect request + MON_MSG_AUTHREPLY, // server responds to auth request + MON_MSG_QUERY_ELEMENTS, // client asking for element data + MON_MSG_QUERY_HIERARCHY, // client asking for hierarchy data + MON_MSG_REPLY_ELEMENTS, // server returns element data + MON_MSG_REPLY_HIERARCHY, // server returns element data + MON_MSG_QUERY_DESCRIPTION, // client asking for Description of element + MON_MSG_REPLY_DESCRIPTION, // server returns element Description of element + MON_MSG_QUERY_HIERARCHY_BLOCK, // client asking for hierarchy data + MON_MSG_REPLY_HIERARCHY_BLOCK_BEGIN, + MON_MSG_REPLY_HIERARCHY_BLOCK, // server returns element data + MON_MSG_REPLY_HIERARCHY_BLOCK_END, + MON_MSG_ERROR = 99 // one of many errors, defined elsewhere +}; + +// ---------------------------------------------------------------- +// define error codes that can be sent and received via MON_MSG_ERROR types +enum MON_ERRORS +{ + INVALID_HEADER = 10, // could not read the header data reliably + INVALID_SEQUENCE = 20, // out of range or unknown sequence number + INVALID_MSG_LENGTH = 30, // message length field is incorrect + INVALID_AUTH_REQUEST = 101, // could not read the entire request + INVALID_ELEMENT_REQUEST = 102, // could not read the entire request + INVALID_HIERARCHY_REQUEST = 103, // could not read the entire request + INVALID_AUTH_REPLY = 105, // the data reply was incorrectly formatted + INVALID_ELEMENT_REPLY = 106, // the data reply was incorrectly formatted + INVALID_HIERARCHY_REPLY = 107, // the data reply was incorrectly formatted + INVALID_ERROR_CODE = 108, // an error was sent, but it isn't recognized + INVALID_MSG_TYPE = 109, // an invalid message type was sent + INVALID_CONFIG_FILE = 110 // Error in reading config file +}; + +// ---------------------------------------------------------------- +// monMessage +// The base message class for the Monitor API +// This message should not be used explicitly. Use simpleMessage for basic tasks. +// monMessage does not contain the etx field as required by the monitoring protocol. + +class monMessage +{ +public: + monMessage(short command, short sequence, short size); + monMessage(const unsigned char * source); + monMessage(const monMessage ©); + monMessage(); + + inline const unsigned short getCommand() const {return command;} + inline const unsigned short getSequence() const {return sequence;} + inline const unsigned short getSize() const {return size;} + inline void setSize(unsigned short _size ) {size=_size;} + +private: + short command; + short sequence; + unsigned short size; +}; + +//---------------------------------------------------------------- +// stringMessage +// This message type is used for passing messages that can consist of a NULL terminated string +class stringMessage : public monMessage +{ +public: + stringMessage(const unsigned short command, const unsigned short sequence, const unsigned short size, char * data); + stringMessage(const unsigned char * source); + + virtual ~stringMessage(); + + inline const char * getData() const {return data;}; + +private: + char * data; +}; + +//---------------------------------------------------------------- +// authReplyMessage +// This message is used exclusively to tell the client whether or not they were successfully +// authenticated. This message is sent in reply to a MON_MSG_AUTH request. +class authReplyMessage : public monMessage +{ +public: + authReplyMessage(const unsigned short command, const unsigned short sequence, const unsigned short size, byte data); + authReplyMessage(const unsigned char * source); + + inline const unsigned char getData() const {return data;}; + inline const short getVersion() const { return version; }; + inline void setData(const unsigned char newData) {data = newData;} + +private: + char data; + short version; +}; + +//---------------------------------------------------------------- +// dataReplyMessage +// This message type is sent for Element and Hierarchy data requests +// The data is stored and retrieved as a byte array, internally represented as a std::vector +class dataReplyMessage : public monMessage +{ +public: + dataReplyMessage(const unsigned short command, const unsigned short sequence, const unsigned short size, unsigned char *data, int dataLen); + dataReplyMessage(const unsigned char * source); + + virtual ~dataReplyMessage(); + + inline const unsigned char * getData() const {return data;}; + +private: + unsigned char * data; +}; + + +//---------------------------------------------------------------- +// dataReplyMessage +// This message type is sent for Element and Hierarchy data requests +// The data is stored and retrieved as a byte array, internally represented as a std::vector +class dataBlockReplyMessage : public monMessage +{ +public: + dataBlockReplyMessage(const unsigned char * source); + virtual ~dataBlockReplyMessage(); + inline const unsigned char * getData() const {return data;}; + +private: + unsigned char * data; +}; + + +//---------------------------------------------------------------- +// simpleMessage +// This is the most basic monitor API message. It can be created from an +// Archive::ByteStream in order to discover the message type for more complex messages, +// or it could be sent explicitly for query message types. +class simpleMessage : public monMessage +{ +public: + simpleMessage(const unsigned short command, const unsigned short sequence, const unsigned short size); + simpleMessage(const unsigned char * source); + + virtual ~simpleMessage(); + +private: +}; + +// *************** Internal Struct *************************** +typedef struct { + + int value; // Value of the element + int id; // Id for users, user control, could be any value, must be unique + int ping; // Ping time, use one of the API defined values, MON_PING_15,... + char *label; // Label of element, use periods to make sub labels, last name sperated + // by periods is the name of the element. + // + // Example: "Universe.Planet.Zone1.count" + // Universe.Planet.Zone1 = Tree name + // count = element name + // + // NOTE: This label is the name of the data element, change the label name + // and a new history of data is started. You will not be able to change + // the name at run time. + // + char *discription; // Discription of element. This can be changed at will. + + + long ChangedTime; + +} MON_ELEMENT; + +/* +class GenericNotifier +{ +public: + GenericNotifier(){} + virtual ~GenericNotifier(){} + virtual void dataReported(int id ){} +}; + +*/ +class CMonitorData { + + MON_ELEMENT *m_data; // Pointer to MON_DATA elements + int m_ndata; + int m_count; + int m_max; + char *m_buffer; + int m_nbuffer; + short m_sequence; +// GenericNotifier *m_notifier; + + int parseList( char **list, char *data, char tok , int max ); + void resize_buffer(int new_size); + void send( UdpConnection *mConnection, short & sequence, short msg, char *data ); + void send( UdpConnection *mConnection, short & sequence, short msg, char *data , int size); + +public: + +// CMonitorData(GenericNotifier *notifier=NULL ); + CMonitorData(); + virtual ~CMonitorData(); + + int getCount(){ return m_ndata; } + int DataMax(){ return m_max; } + void setMax(int _max); + + // bool processHierarchyRequest(UdpConnection *con, short & sequence); + bool processHierarchyRequestBlock(UdpConnection *con, short & sequence); + bool processElementsRequest( UdpConnection *con, short & sequence, char * userData, int dataLen , long lastUpdateTime); + bool processDescriptionRequest(UdpConnection *con, short & sequence, char * userData, int dataLen,unsigned char *mark); + int add(const char *label, int id, int ping, const char *des ); + int setDescription( int Id, const char *Description , int & mode); + char *getDescription(int x){ if( m_ndata >= x ) return NULL; return m_data[x].discription;} + int pingValue(int p); + void set(int Id, int value); + void remove(int Id); + void dump(); + + // int compress(char *dest,unsigned long *destLen,const char *source,long sourceLen,int level); + +}; + +#define AUTHADDRESS_MAX 30 +#define CONNECTION_MAX 8 + + +class MonitorObject : public UdpConnectionHandler +{ + CMonitorData *mMonitorData; + short mSequence; + char *mPasswd; + char **mAddressList; + unsigned char *mMark; + int mbAuthenticated; + bool mHierarchySent; + bool mbprint; + long mlastUpdateTime; + bool checkAddress(const char * address); + bool checkPasswd( const char *passwd); + + public: + + UdpConnection *mConnection; + MonitorObject(UdpConnection *con, CMonitorData *, char *passwd, char **addressList ,bool _bprint ); + virtual ~MonitorObject(); + virtual void OnRoutePacket( UdpConnection *con, const unsigned char *data, int dataLen); + virtual void OnTerminated( UdpConnection *con); + bool processAuthRequest(const unsigned char * data, int dataLen); + bool processError(const unsigned char * data); + void HeirarchyChanged(){ mHierarchySent = false; } + void DescriptionMark(int x,int mode); +}; + + +class MonitorManager : public UdpManagerHandler +{ + bool mbprint; + CMonitorData *mMonitorData; + char *passString; + char *allowedAddressList[AUTHADDRESS_MAX]; + bool loadAuthData(const char * filename); + +public: + + MonitorManager(const char *configFile, CMonitorData *gamedata, UdpManager *manager , bool _bprint = false); + virtual ~MonitorManager(); + + void AddObject(MonitorObject *player); + void GiveTime(); + void HierarchyChanged(); + void DescriptionMark(int x,int mode); + virtual void OnConnectRequest(UdpConnection *con); + +protected: + + MonitorObject *mObject[CONNECTION_MAX]; + int mObjectCount; + UdpManager *mManager; +}; + + + +#endif + + + diff --git a/external/3rd/library/platform/projects/MonAPI2/login.cfg b/external/3rd/library/platform/projects/MonAPI2/login.cfg new file mode 100644 index 00000000..3191b705 --- /dev/null +++ b/external/3rd/library/platform/projects/MonAPI2/login.cfg @@ -0,0 +1,3 @@ +neverqst +10.10.3 +10.10.4