/home/tetron/hack/vos/libs/vos/metaobjects/misc/logctrl.hh
Go to the documentation of this file.00001 #ifndef _MISC_LOGCTRL_HH_
00002 #define _MISC_LOGCTRL_HH_
00003
00004 #include <vos/vos/vos.hh>
00005 #include "miscdefs.hh"
00006
00007 namespace VOS {
00008
00009 class MISC_API LogLevelCtrl : public MetaObject
00010 {
00011 public:
00012 LogLevelCtrl(VobjectBase* vb);
00013 virtual ~LogLevelCtrl();
00014 virtual const std::string getVOSType();
00015
00016 virtual void setLogLevel(const std::string& channel, int level) = 0;
00017 virtual int getLogLevel(const std::string& channel) = 0;
00018 };
00019
00020 class MISC_API LocalLogLevelCtrl : public LogLevelCtrl
00021 {
00022 public:
00023 LocalLogLevelCtrl(VobjectBase* superobject);
00024 static MetaObject* new_LocalLogLevelCtrl(VobjectBase* superobject, const std::string& type);
00025
00026 virtual void setLogLevel(const std::string& channel, int level);
00027 virtual int getLogLevel(const std::string& channel);
00028
00029 void handleSetLogLevel(Message* m);
00030 void handleGetLogLevel(Message* m);
00031 };
00032
00033 class MISC_API RemoteLogLevelCtrl : public LogLevelCtrl
00034 {
00035 public:
00036 RemoteLogLevelCtrl(VobjectBase* superobject);
00037 static MetaObject* new_RemoteLogLevelCtrl(VobjectBase* superobject, const std::string& type);
00038
00039 virtual void setLogLevel(const std::string& channel, int level);
00040 virtual int getLogLevel(const std::string& channel);
00041 };
00042
00043 class MISC_API LogLevelCtrlAccessControl
00044 {
00045 public:
00046 virtual ~LogLevelCtrlAccessControl() { }
00047
00048 virtual const std::string getPolicyName() = 0;
00049
00050 virtual bool checkLogLevelSetPermission(Vobject* requester,
00051 const std::string& channel,
00052 int level,
00053 std::string& errmessage) = 0;
00054 virtual bool checkLogLevelGetPermission(Vobject* requester,
00055 const std::string& channel,
00056 std::string& errmessage) = 0;
00057
00058 };
00059
00060 class MISC_API DenyAllLogLevelCtrlAC : public LogLevelCtrlAccessControl
00061 {
00062 public:
00063 static DenyAllLogLevelCtrlAC static_;
00064
00065 virtual ~DenyAllLogLevelCtrlAC() { }
00066
00067 virtual const std::string getPolicyName()
00068 { return "log-level-control:deny-all"; }
00069
00070 virtual bool checkLogLevelSetPermission(Vobject* requester,
00071 const std::string& channel,
00072 int level,
00073 std::string& errmessage)
00074 { return false; }
00075 virtual bool checkLogLevelGetPermission(Vobject* requester,
00076 const std::string& channel,
00077 std::string& errmessage)
00078 { return false; }
00079
00080 };
00081
00082 class MISC_API ReadOnlyLogLevelCtrlAC : public LogLevelCtrlAccessControl
00083 {
00084 public:
00085 static ReadOnlyLogLevelCtrlAC static_;
00086
00087
00088 virtual const std::string getPolicyName()
00089 { return "log-level-control:read-only"; }
00090
00091 virtual bool checkLogLevelSetPermission(Vobject* requester,
00092 const std::string& channel,
00093 int level,
00094 std::string& errmessage)
00095 { return false; }
00096 virtual bool checkLogLevelGetPermission(Vobject* requester,
00097 const std::string& channel,
00098 std::string& errmessage)
00099 { return true; }
00100
00101 };
00102
00103 class MISC_API AcceptAllLogLevelCtrlAC : public LogLevelCtrlAccessControl
00104 {
00105 public:
00106 static AcceptAllLogLevelCtrlAC static_;
00107
00108
00109 virtual const std::string getPolicyName()
00110 { return "log-level-control:accept-all"; }
00111
00112 virtual bool checkLogLevelSetPermission(Vobject* requester,
00113 const std::string& channel,
00114 int level,
00115 std::string& errmessage)
00116 { return true; }
00117 virtual bool checkLogLevelGetPermission(Vobject* requester,
00118 const std::string& channel,
00119 std::string& errmessage)
00120 { return true; }
00121
00122 };
00123
00124 }
00125
00126 #ifndef MISC_EXPORTS
00127 IMPORT_METAOBJECT_FACTORIES(LogLevelCtrl)
00128 #endif
00129
00130 #endif