130 likes | 261 Views
Stromcode OpenChat. Extendable Chat Server Specification + Protocol. Goals. Design a thorough application specification Create a simple communication protocol Implement several advanced, modern application functions XML configuration files Plug-in hosting (DLL)
E N D
Stromcode OpenChat Extendable Chat Server Specification + Protocol
Goals • Design a thorough application specification • Create a simple communication protocol • Implement several advanced, modern application functions • XML configuration files • Plug-in hosting (DLL) • Cross-platform communication • Version checking • Directory listing • Compact HTTP serving with PHP scripting • To create something I can keep working on
Functionality • XML parsing • MSXML, TinyXML • DTD • Not required
Functionality • PHP • PHP-CLI – no C++ support! • CPHPParser class • PHP.net • Windows pipes • Typically non-intuitive & poorly documented • Win32 | console vs console | console • Use CreatePipe & CreateProcess • Don’t use _popen!
Functionality • More PHP • How to expose program data to external PHP scripts? • Load .php file • Construct array definition string • Push both to PHP-CLI
Functionality • Version Checking • Application opens HTTP connection to version checking server • Application pushes GET data • Version Check server processes GET and returns text • Application parses text for requested data
Functionality • Directory Listing • Not implemented in this version • Similar to Version Checking • Directory server simply adds application supplied information to the database and updates a timestamp
Functionality • Cross-platform Communication • How to terminate a communicated string? • \n • \r • \r\n • Problem: scanning for \n character • Loss of data if not careful • Buffer too long (client pushes too much data before \n)
Functionality: Plug-in Hosting • Plug-ins as objects • DLL exposes functions • CreateObject • Returns pointer to new object • Object created in DLL space! • DestroyObject • Deletes object • Must be done like this because of distinct heaps
Functionality: Plug-in Hosting ////////////////////////////////////////////////////////////////// // CreateClassInstance ////////////////////////////////////////////////////////////////// extern "C" SERVERPLUGIN_API void* CreateClassInstance() { return (void*) (new GDtServerPlugin); } ////////////////////////////////////////////////////////////////// // DeleteClassInstance ////////////////////////////////////////////////////////////////// extern "C" SERVERPLUGIN_API void DeleteClassInstance(GDtServerPluginInterface* obj) { delete obj; }
Functionality: Plug-in Hosting • Memory issues • Heaps • Host • Plug-in • Visual Studio • Returning values • Who deletes it?
Functionality: Plug-in Hosting • Returning values (in depth) • Application function calls member method of plug-in object. • Member method of the plug-in object returns a value. • Function exits. What happens?
The Future • What’s Done • Solid Framework • Easily extendable • Plug-ins, plug-in types, commands and features • What’s Next? • Three new plug-in types • Focus on the client • More protocol commands • Rooms