GENERIC_SERVER
0.0.0.9
A light-weight, cross-platform, pluggable, extensible and secure framework for deploying C++ plug-ins.
|
Master program that initiates GENERIC_SERVER, spawns a thread for each plug-in and runs message loop for that plug-in. More...
#include <map>
#include <vector>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <pthread.h>
#include "sslserver.h"
Go to the source code of this file.
Macros | |
#define | TLS_REQ 1 |
#define | SOCKET_REQ 2 |
#define | PR_SET_NAME 15 |
Functions | |
void | sig_int (int sig_num) |
void | do_nothing (int sig_num) |
void * | thread_fn (void *inp_arg) |
void * | ssl_thread_fn (void *inp_arg) |
void | daemonize () |
unsigned int | get_data_size (unsigned char *recvbuf) |
int | add_size (unsigned char *recvbuf, unsigned int size) |
string | get_input_plugin_name (char *buffer) |
static int | process_client_req (SOCKET clnt_sock, int plugin_init_state, GENERIC_PLUGIN *plugin_p, int thread_no, generic_server *framework) |
static int | process_ssl_client_req (SOCKET clnt_sock, SSL *ssl, int plugin_init_state, GENERIC_PLUGIN *plugin_p, int thread_no, generic_server *framework) |
static int | terminate_client_session (SOCKET clnt_sock, generic_server *framework, GENERIC_PLUGIN *plugin_p, int thread_no, unsigned char *senduf) |
static int | terminate_ssl_client_session (SSL *ssl, generic_server *framework, GENERIC_PLUGIN *plugin_p, int thread_no, unsigned char *senduf) |
static int | print_source_hostname (int clnt_sock, int req_type, generic_server *framework, int thread_no, GENERIC_PLUGIN *plugin_p) |
static int | process_data (void) |
Main loop to 'select()' sockets from multiple clients. | |
static unsigned int | init_sock_fds (fd_set *, SOCKET) |
static int | chk_command_sock (fd_set *, SOCKET) |
static int | launch_thread (GENERIC_PLUGIN *generic_plugin, unsigned int new_slot) |
static int | chk_all_clients (fd_set *socks) |
static int | read_socket (unsigned char *buffer, SOCKET sock, int size) |
Master program that initiates GENERIC_SERVER, spawns a thread for each plug-in and runs message loop for that plug-in.
Contact: suraj @bro adcom .com
Definition in file control.h.
|
static |
Launches a new thread to run a plug-in. Thread could be for an TLS session or a non-TLS session.
[in] | plugin_p | Pointer to generic_plugin object |
[in] | new_slot | slot position into thread_ids map |
Definition at line 689 of file control.cpp.
References generic_server::pinstance, and generic_server::thread_ids.
|
static |
This function gets called in a plug-in specific thread to process request sent by client on raw (non TLS) session. Once a valid request is received, 'process_request()' method on plug-in is invoked. Message structure:
[in] | clnt_sock | Client socket to read/write |
[in] | plugin_init_state | Flag to indicate return status of plugin_init() callback |
[in] | plugin_p | Pointer to plug-in object |
[in] | thread_no | Thread number assigned by framework |
[in] | framework | Pointer to framework object |
|
static |
This function gets called in a plug-in specific thread to process request sent by client on TLS enabled session. Once a valid request is received, 'process_request()' method on plug-in is invoked. Message structure:
[in] | clnt_sock | Client socket attached to SSL |
[in] | ssl | Pointer to SSL structure |
[in] | plugin_init_state | Flag to indicate return status of plugin_init() callback |
[in] | thread_no | Thread number assigned by framework |
[in] | framework | Pointer to framework object |
|
static |
This function gets called in a plug-in specific thread whenever a non-TLS client session is to be terminated.
[in] | clnt_socket | Client socket to read/write |
[in] | framework | Pointer to framework object |
[in] | plugin_p | Pointer to plugin object |
[in] | thread_no | Thread number assigned by framework |
[in] | sendbuf | NULL terminated ASCII data to send to client |
Definition at line 416 of file control.cpp.
References generic_server::log(), and generic_plugin::shutdown_plugin().
|
static |
This function gets called in a plug-in specific thread whenever a TLS client session is to be terminated.
[in] | ssl | Pointer to SSL structure |
[in] | framework | Pointer to framework object |
[in] | plugin_p | Pointer to plugin object |
[in] | thread_no | Thread number assigned by framework |
[in] | sendbuf | NULL terminated ASCII data to send to client |
Definition at line 435 of file control.cpp.
References generic_server::log(), and generic_plugin::shutdown_plugin().