GENERIC_SERVER
0.0.0.9
A light-weight, cross-platform, pluggable, extensible and secure framework for deploying C++ plug-ins.
|
Derived from GENERIC_PLUGIN. Implements virtual functions and all plug-in specific functionality. More...
#include <sample.h>
Public Member Functions | |
sample_plugin (char *, int) | |
int | shutdown_plugin (void) |
int | plugin_init (int) |
int | server_init (void) |
int | server_shutdown (void) |
int | process_request (void *, void *, unsigned int &) |
int | init (void) |
int | init (int) |
string | get_plugin_version (void) |
int | get_plugin_params (string line) |
sample_plugin & | operator= (const sample_plugin &) |
string | bootstrap_name (void) |
bool | bootstrap_init (string) |
bool | bootstrap_terminate (string) |
Public Member Functions inherited from generic_plugin | |
string | generic_plugin_version () |
generic_plugin (char *, int) | |
generic_plugin (char *, char *, int) | |
GEN_PLUGIN_MUTEX | create_mutex (void) |
int | lock_mutex (GEN_PLUGIN_MUTEX *) |
int | rel_mutex (GEN_PLUGIN_MUTEX *) |
bool | get_validate_plugin (void) |
virtual unsigned short | get_session (void) |
SOCKET | get_socket () |
int | get_port () |
int | get_thread_id () |
int | get_tls_flag () |
string | get_plugin () |
string | get_plugin_name () |
string | get_plugin_number () |
string | get_plugin_path () |
int | set_plugin (string) |
int | set_plugin_name (string) |
int | set_plugin_number (string) |
int | set_port (int) |
int | set_tls_flag (int) |
int | set_thread_id (int) |
int | set_socket (SOCKET) |
int | set_plugin_path (string) |
int | add_plugin_alias (string) |
int | clear_aliases () |
int | aliases_count () |
string | pop_alias () |
bool | find_plugin_alias (string) |
SOCKET | initialize_socket (string port) |
Binds socket to TCP port, set options on new socket and do socket listen. | |
int | set_client_socket (SOCKET) |
int | set_conf_file (string) |
string | get_conf_file () |
SOCKET | get_client_socket (void) |
generic_plugin & | operator= (const generic_plugin &) |
bool | operator< (generic_plugin a) |
bool | operator== (generic_plugin a) |
Private Attributes | |
string | db_name |
string | db_passwd |
Additional Inherited Members | |
Public Attributes inherited from generic_plugin | |
unsigned long | pinstance |
Pointer to 'framework' object. | |
string | plugin_conf_file |
Protected Member Functions inherited from generic_plugin | |
int | log (unsigned int, char *) |
int | log (unsigned int, string) |
Protected Attributes inherited from generic_plugin | |
SOCKET | server_socket |
SOCKET | client_socket |
int | port |
int | tls_enabled |
int | thread_id |
char * | local_ip_address |
string | plugin_type |
string | plugin_name |
string | plugin_number |
string | plugin_lib_path |
unsigned int | networking |
unsigned int | verbose_level |
bool | validate_plugin |
vector< string > | v_plugin_aliases |
Derived from GENERIC_PLUGIN. Implements virtual functions and all plug-in specific functionality.
|
virtual |
This method gets invoked by the framework when it is being booted up. This method is invoked only once per 'bootstrap_name', each time framework is started up. If there are three plug-ins in generic_server conf file, all of them belonging to different plug-in types and each of them defines the same 'bootstrap_name', then this method gets called only once when the first plug-in is loaded Please note, this method gets invoked during framework start-up time - not during client session initiation. This would be the place to do stuff like:
Reimplemented from generic_plugin.
Definition at line 218 of file sample.cpp.
|
virtual |
GENERIC_SERVER framework provides a feature where plug-ins could request framework to call one or more bootstrap methods when framework is being bootsrapped. Any plug-in could implement 'bootstrap' methods. 'bootstrap_name' is the name associated with a specific 'bootstrap' method. Plug-ins should be co-operative and set differnet bootstrap_names to identify and implement different tasks. Under no circumstances should different plug-ins define the same 'bootstrap_name', if such a case should ever occur, framework will ignore the latter defined and implemented bootstrap method.
Reimplemented from generic_plugin.
Definition at line 212 of file sample.cpp.
|
virtual |
This is the opposite of 'bootstrap_init()', framework invokes this method once for a 'bootstrap_name' when framework is being terminated.
Reimplemented from generic_plugin.
Definition at line 226 of file sample.cpp.
|
virtual |
Read plug-in configuration data
Framework presents configuration information from plug-in conf file to be processed. This method will be invoked once per line in plug-in conf file.
[in] | line | One line from plug-in conf file. |
Reimplemented from generic_plugin.
Definition at line 195 of file sample.cpp.
References generic_plugin::get_plugin_params().
|
virtual |
Initialize plug-in
This method gets invoked whenever a new client session gets initiated.
[in] | thread_no | The thread number assigned to plug-in. |
Reimplemented from generic_plugin.
Definition at line 79 of file sample.cpp.
|
virtual |
Handle client request
Framework presents client input data to plug-in to process.
[in] | buffer | Request sent by client. |
[out] | outbuff | Response to be sent back to client. |
[in,out] | send_bytes | Size of input buffer sent by client, function sets this to size of outbuff. |
Reimplemented from generic_plugin.
Definition at line 169 of file sample.cpp.
References generic_plugin::pinstance.
|
virtual |
This method gets invoked by the framework once per plug-in type when it is getting started. Please note, this method is invoked only ONCE for a particular plug-in type. If there are three plug-ins in generic_server conf file, all of them belonging to same plug-in_type, then this method gets called only once when the first plug-in is loaded. Please note, this method gets invoked during framework start-up in the MAIN thread. This would be the place to do stuff like:
Reimplemented from generic_plugin.
Definition at line 131 of file sample.cpp.
|
virtual |
This is the opposite of 'server_init()', framework invokes this method when a plug-in is removed from generic_server conf file. Similar to 'server_init()', 'server_shutdown()' gets invoked only once when the last plug-in of a plug-in_type is removed.
Reimplemented from generic_plugin.
Definition at line 150 of file sample.cpp.
|
virtual |
Terminate plug-in session
This method gets invoked whenever a client session gets terminated.
Reimplemented from generic_plugin.
Definition at line 110 of file sample.cpp.
References generic_plugin::pinstance.