| 1 | /**************************************************************************
|
|---|
| 2 | * Copyright (C) 2004-2007 by Michael Medin <michael@medin.name> *
|
|---|
| 3 | * *
|
|---|
| 4 | * This code is part of NSClient++ - http://trac.nakednuns.org/nscp *
|
|---|
| 5 | * *
|
|---|
| 6 | * This program is free software; you can redistribute it and/or modify *
|
|---|
| 7 | * it under the terms of the GNU General Public License as published by *
|
|---|
| 8 | * the Free Software Foundation; either version 2 of the License, or *
|
|---|
| 9 | * (at your option) any later version. *
|
|---|
| 10 | * *
|
|---|
| 11 | * This program is distributed in the hope that it will be useful, *
|
|---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|---|
| 14 | * GNU General Public License for more details. *
|
|---|
| 15 | * *
|
|---|
| 16 | * You should have received a copy of the GNU General Public License *
|
|---|
| 17 | * along with this program; if not, write to the *
|
|---|
| 18 | * Free Software Foundation, Inc., *
|
|---|
| 19 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
|---|
| 20 | ***************************************************************************/
|
|---|
| 21 | #include <strEx.h>
|
|---|
| 22 |
|
|---|
| 23 | #include "simple_scheduler.hpp"
|
|---|
| 24 | #include "schedules.hpp"
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 | class Scheduler : public scheduler::schedule_handler, public nscapi::impl::simple_plugin {
|
|---|
| 28 | private:
|
|---|
| 29 | std::string schedule_path;
|
|---|
| 30 | scheduler::simple_scheduler scheduler_;
|
|---|
| 31 | schedules::schedule_handler schedules_;
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 | public:
|
|---|
| 35 | Scheduler() {
|
|---|
| 36 | scheduler_.set_handler(this);
|
|---|
| 37 | }
|
|---|
| 38 | virtual ~Scheduler() {}
|
|---|
| 39 | // Module calls
|
|---|
| 40 | bool loadModuleEx(std::string alias, NSCAPI::moduleLoadMode mode);
|
|---|
| 41 | bool unloadModule();
|
|---|
| 42 |
|
|---|
| 43 | void add_schedule(std::string alias, std::string command);
|
|---|
| 44 | void handle_schedule(schedules::schedule_object item);
|
|---|
| 45 | void on_error(std::string error);
|
|---|
| 46 | }; |
|---|