GENERIC_SERVER
0.0.0.9
A light-weight, cross-platform, pluggable, extensible and secure framework for deploying C++ plug-ins.
|
This component provides functionality that are common across plug-ins. Framework would instantiate and load objects of type GENERIC_PLUGIN to framework system from plugin shared library. More...
#include <generic_plugin.h>
Public Member Functions | |
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) |
virtual int | plugin_init (int thread_no) |
virtual int | get_plugin_params (string line) |
virtual int | process_request (void *buffer, void *out_buff, unsigned int &size) |
virtual int | server_init (void) |
virtual int | server_shutdown (void) |
virtual string | get_plugin_version (void) |
virtual int | shutdown_plugin (void) |
virtual string | bootstrap_name (void) |
virtual bool | bootstrap_init (string) |
virtual bool | bootstrap_terminate (string) |
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) |
Public Attributes | |
unsigned long | pinstance |
Pointer to 'framework' object. | |
string | plugin_conf_file |
Protected Member Functions | |
int | log (unsigned int, char *) |
int | log (unsigned int, string) |
Protected Attributes | |
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 |
Friends | |
ostream & | operator<< (ostream &output, generic_plugin &p) |
This component provides functionality that are common across plug-ins. Framework would instantiate and load objects of type GENERIC_PLUGIN to framework system from plugin shared library.
Definition at line 108 of file generic_plugin.h.
|
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 in sample_plugin.
Definition at line 505 of file generic_plugin.cpp.
Referenced by generic_server::initialize_plugin_object().
|
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 in sample_plugin.
Definition at line 499 of file generic_plugin.cpp.
Referenced by generic_server::initialize_plugin_object().
|
inlinevirtual |
This is the opposite of 'bootstrap_init()', framework invokes this method once for a 'bootstrap_name' when framework is being terminated.
Reimplemented in sample_plugin.
Definition at line 242 of file generic_plugin.h.
GEN_PLUGIN_MUTEX generic_plugin::create_mutex | ( | void | ) |
OS agnostic wrapper API to create mutex
Definition at line 448 of file generic_plugin.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 in sample2_plugin, and sample_plugin.
Definition at line 422 of file generic_plugin.cpp.
Referenced by sample_plugin::get_plugin_params(), and sample2_plugin::get_plugin_params().
int generic_plugin::lock_mutex | ( | GEN_PLUGIN_MUTEX * | mutex | ) |
OS agnostic wrapper API to lock mutex
Definition at line 460 of file generic_plugin.cpp.
|
inlinevirtual |
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 in sample2_plugin, and sample_plugin.
Definition at line 163 of file generic_plugin.h.
|
inlinevirtual |
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 in sample2_plugin, and sample_plugin.
Definition at line 183 of file generic_plugin.h.
int generic_plugin::rel_mutex | ( | GEN_PLUGIN_MUTEX * | mutex | ) |
OS agnostic wrapper API to release mutex
Definition at line 472 of file generic_plugin.cpp.
|
inlinevirtual |
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 in sample2_plugin, and sample_plugin.
Definition at line 197 of file generic_plugin.h.
Referenced by generic_server::initialize_plugin_object().
|
inlinevirtual |
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 in sample2_plugin, and sample_plugin.
Definition at line 203 of file generic_plugin.h.
|
inlinevirtual |
Terminate plug-in session
This method gets invoked whenever a client session gets terminated.
Reimplemented in sample2_plugin, and sample_plugin.
Definition at line 215 of file generic_plugin.h.
Referenced by terminate_client_session(), and terminate_ssl_client_session().
|
protected |
socket passed on to plug-ins by framework after a successful client connect.
Definition at line 118 of file generic_plugin.h.
|
protected |
socket used by framework to LISTEN/SELECT clients.
Definition at line 115 of file generic_plugin.h.
|
protected |
A plug-in can have one or more 'alias' plug-ins. Essentially, one port,plug-in_type get multi-plexed for all alias plug-ins.
Definition at line 133 of file generic_plugin.h.
|
protected |
Flag to indcate whether framework should authorize any client request to this plug-in.
Definition at line 128 of file generic_plugin.h.