34 #include "XEventLog.h"
36 #include <sys/socket.h>
37 #include <arpa/inet.h>
39 #include <netinet/in.h>
52 extern "C" __declspec(dllexport)
sample2_plugin *create_instance(
void);
63 sample2_plugin::sample2_plugin(
char *plugin_name,
int plugin_port) :
generic_plugin(plugin_name,plugin_port)
70 extern "C" __declspec(dllexport)
sample2_plugin *create_instance(
void)
85 oss <<
" Thr.ID:" << thread_no <<
" Plugin:" << plugin_name <<
" Successfully initialized session.";
86 log(LOG_HI,oss.str());
89 catch(
const exception& er)
91 oss <<
" Thr.ID:" << thread_no <<
" Plugin:" << plugin_name <<
" " << er.what();
92 log(LOG_HI,oss.str());
102 generic_plugin::operator= (rhs);
103 ftp_dir = rhs.ftp_dir;
117 oss <<
" Thr.ID:" << thread_id <<
" Plugin:" << plugin_name <<
" Successfully shutdown session.";
118 log(LOG_HI,oss.str());
120 catch(
const exception& er)
122 oss <<
" Thr.ID: MAIN Plugin:" << plugin_name <<
" " << er.what();
123 log(LOG_HI,oss.str());
136 oss <<
" Thr.ID: MAIN Plugin:" << plugin_name <<
" Successfully initialized sample2 server.";
137 log(LOG_HI,oss.str());
140 catch(
const exception& er)
142 oss <<
" Thr.ID: MAIN Plugin:" << plugin_name <<
" " << er.what();
143 log(LOG_HI,oss.str());
155 oss <<
" Thr.ID: MAIN Plugin:" << plugin_name <<
" Successfully shutdown sample2 server.";
156 log(LOG_HI,oss.str());
159 catch(
const exception& er)
161 oss <<
" Thr.ID: MAIN Plugin:" << plugin_name <<
" " << er.what();
162 log(LOG_HI,oss.str());
172 unsigned char *req_type;
183 req_type =
static_cast<unsigned char *
>(buffer);
187 fname = ftp_dir +
"/" + string((
char *)buffer+1,size-1);
188 new_file.open(fname.c_str(),ios::binary);
189 if(!new_file.rdbuf()->is_open())
192 return(TERMINATE_SESSION);
196 oss <<
" Thr.ID:" << thread_id <<
" Plugin:" << plugin_name <<
" Creating new file: " << fname;
197 log(LOG_LOW,oss.str());
199 return(CONTINUE_SESSION);
202 new_file << string((
char *)buffer+1,size-1);
203 return(CONTINUE_SESSION);
209 oss <<
" Thr.ID:" << thread_id <<
" Plugin:" << plugin_name <<
" Closing file: " << fname;
210 log(LOG_LOW,oss.str());
212 return(TERMINATE_SESSION);
215 return(TERMINATE_SESSION);
217 return(CONTINUE_SESSION);
221 string sample2_plugin::get_plugin_version(
void)
223 return(PLUGIN_VERSION);
230 if (line.size() > 8 && line.compare(0,8,
"FTP_DIR=") == 0)
232 ftp_dir = line.substr(8);
This is a plug-in to demostrate usage of generic_server. This class is derived from GENERIC_PLUGIN...
Singleton class to manage framework state and provide utility functions. This class stores master Vec...
This is a singleton class and provides framework functionality.
int process_request(void *, void *, unsigned int &)
This component provides functionality that are common across plug-ins. Framework would instantiate an...
This is the base class for all plugins. All plug-ins should derive from this class. This class has a bunch of virtual functions that all plug-in could/should implement. In addition to virtual functions, this class also provides a lot of utility functions for all plug-ins.
int shutdown_plugin(void)
unsigned long pinstance
Pointer to 'framework' object.
int get_plugin_params(string line)
int server_shutdown(void)
Derived from GENERIC_PLUGIN. Implements virtual functions and all plug-in specific functionality...
virtual int get_plugin_params(string line)