// imapd/CommandParser.hh // This file is part of Decimail; see http://decimail.org // (C) 2004-2007 Philip Endecott // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef Imapd_CommandParser_hh #define Imapd_CommandParser_hh #include #include "ScannerExtra.hh" #include "commands.hh" #include "parse_imap_command.tab.h" #include "scan_imap_command.h" struct ParserParams { Imapd::Session* session; yyscan_t* scanner; ScannerExtra* scanner_extra; std::string tag; ParserParams(Imapd::Session* se, yyscan_t* sc, ScannerExtra* sx): session(se), scanner(sc), scanner_extra(sx) {} }; extern int parse_imap_command_parse(void* params); extern int parse_imap_command_debug; #include "Session.hh" #include "Exception.hh" #include "FileDescriptor.hh" #include #include namespace Imapd { struct PerThreadParamsHandle { ParserParams* const params; PerThreadParamsHandle(ParserParams* p): params(p) {} }; class CommandParser { public: CommandParser(Session& s); ~CommandParser(); void parse(); static ParserParams* get_params_from_thread(void); private: Session& session; yyscan_t scanner; ParserParams parser_params; ScannerExtra scanner_extra; static boost::thread_specific_ptr& get_tsp(void); }; } #endif