Documentation

Generated on Thu Aug 31 00:02:29 2006

 

Handler.h

Go to the documentation of this file.
00001 
00002 // $Id: Handler.h,v 1.53 2005/06/12 15:27:01 klas Exp $
00003 //
00004 // Usage: the main loop for connected clients and interpreter for
00005 //        ftp commands.
00006 //
00007 //  A part of babyftpd, licensed under the GNU GPL, see the file
00008 //    LICENSE for complete information.
00010 
00011 #ifndef HANDLER_H
00012 #define HANDLER_H
00013 
00014 #ifdef HANDLER_CPP
00015 #include "generic.h"
00016 #include "Utilities.h"
00017 #include "Configuration.h"
00018 #include "Log.h"
00019 #include "Connection.h"
00020 #include "Commands.h"
00021 #include "User.h"
00022 #include "StringTokenizer.h"
00023 #endif
00024 
00025 struct command_info {
00026   int ant_arg; //Number of arguments. -1 means variable size.
00027   bool (Commands::*pf)(User*, string&, unsigned int);
00028   unsigned int extra_flag; //extra flags that is needed by that function
00029   string hlp_info; // if this is empty, no help.
00030   // constructor for assigning the hash
00031   command_info(int a,
00032       bool (Commands::*p)(User*, string&, unsigned int),
00033       unsigned int e, string h)
00034   {
00035     ant_arg = a;
00036     pf = p;
00037     extra_flag = e;
00038     hlp_info = h;
00039   }
00040   // and one to make the hash functions happy that it still looks like a struct
00041   command_info() {};
00042 };
00043 
00044 class Handler
00045 {
00046   private:
00047     bool interpreter(User*, string);
00048   public:
00049     Handler();
00050     ~Handler();
00051     bool init(User*);
00052     class User *initializer(int);
00053     hash_map<const char*, struct command_info, hash<const char*>,
00054       Utilities::eqstr> cmd_info;
00055 };
00056 
00057 extern class Handler *handler;
00058 
00059 extern vector<User*> user_list;
00060 extern pthread_rwlock_t user_list_lock;
00061 
00062 #endif