]> git.stg.codes - stg.git/blob - include/stg/plugin.h
Public interfaces: part 1
[stg.git] / include / stg / plugin.h
1 /*
2  *    This program is free software; you can redistribute it and/or modify
3  *    it under the terms of the GNU General Public License as published by
4  *    the Free Software Foundation; either version 2 of the License, or
5  *    (at your option) any later version.
6  *
7  *    This program is distributed in the hope that it will be useful,
8  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
9  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  *    GNU General Public License for more details.
11  *
12  *    You should have received a copy of the GNU General Public License
13  *    along with this program; if not, write to the Free Software
14  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
15  */
16
17 /*
18  *    Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
19  */
20
21 #pragma once
22
23 #include <string>
24 #include <cstdint>
25
26 namespace STG
27 {
28
29 struct TraffCounter;
30 struct Settings;
31 struct Store;
32 struct Admins;
33 struct Users;
34 struct Tariffs;
35 struct Services;
36 struct Corporations;
37 struct ModuleSettings;
38
39 struct Plugin {
40     virtual ~Plugin() = default;
41
42     virtual void               SetUsers(Users*) {}
43     virtual void               SetTariffs(Tariffs*) {}
44     virtual void               SetAdmins(Admins*) {}
45     virtual void               SetServices(Services*) {}
46     virtual void               SetCorporations(Corporations*) {}
47     virtual void               SetTraffcounter(TraffCounter*) {}
48     virtual void               SetStore(Store*) {}
49     virtual void               SetStgSettings(const Settings*) {}
50     virtual void               SetSettings(const ModuleSettings&) {}
51     virtual int                ParseSettings() = 0;
52
53     virtual int                Start() = 0;
54     virtual int                Stop() = 0;
55     virtual int                Reload(const ModuleSettings&) = 0;
56     virtual bool               IsRunning() = 0;
57     virtual const std::string& GetStrError() const = 0;
58     virtual std::string        GetVersion() const = 0;
59     virtual uint16_t           GetStartPosition() const = 0;
60     virtual uint16_t           GetStopPosition() const = 0;
61 };
62
63 }