Fix the methods for log iteration simply 76/138476/4
authorSungbae Yoo <sungbae.yoo@samsung.com>
Wed, 12 Jul 2017 08:55:31 +0000 (17:55 +0900)
committerSungbae Yoo <sungbae.yoo@samsung.com>
Mon, 17 Jul 2017 05:47:56 +0000 (14:47 +0900)
Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
Change-Id: I7ac8d340e926b74ca08914d4ca5372e703153311

14 files changed:
lib/audit-trail/dac.cpp
lib/audit-trail/mac.cpp
lib/audit-trail/syscall.cpp
lib/client.cpp
lib/client.h
lib/discretionary-access-control.cpp
lib/mandatory-access-control.cpp
lib/system-call.cpp
rmi/discretionary-access-control.h
rmi/mandatory-access-control.h
rmi/system-call.h
server/discretionary-access-control.cpp
server/mandatory-access-control.cpp
server/system-call.cpp

index a98db7986eed042f492bc11ff97f9fdc56c98c41..1208eccd832797e18bf48d26ccc1738860396832 100644 (file)
@@ -31,14 +31,13 @@ int audit_trail_foreach_dac(audit_trail_h handle, audit_trail_string_cb callback
        AuditTrailContext &client = GetAuditTrailContext(handle);
        auto dac = client.createInterface<DiscretionaryAccessControl>();
 
-       int iter = dac.createIterator();
-       do {
-               std::string log(dac.getIteratorValue(iter));
+       int end = dac.size();
+       for (int i = 0; i < end; i++) {
+               std::string log(dac.get(i));
                if (log.size() > 0) {
                        callback(log.c_str(), user_data);
                }
-       } while (dac.nextIterator(iter));
-       dac.destroyIterator(iter);
+       }
 
        return AUDIT_TRAIL_ERROR_NONE;
 }
@@ -59,8 +58,14 @@ int audit_trail_add_dac_cb(audit_trail_h handle, audit_trail_string_cb callback,
        RET_ON_FAILURE(handle, AUDIT_TRAIL_ERROR_INVALID_PARAMETER);
        RET_ON_FAILURE(callback, AUDIT_TRAIL_ERROR_INVALID_PARAMETER);
 
-       AuditTrailContext &context = GetAuditTrailContext(handle);
-       int ret = context.subscribeNotification("DiscretionaryAccessControl", callback, user_data);
+       AuditTrailContext &client = GetAuditTrailContext(handle);
+       int ret = client.subscribeNotification("DiscretionaryAccessControl",
+                               [callback, user_data, &client] (std::string name, int position)
+                               {
+                                       auto dac = client.createInterface<DiscretionaryAccessControl>();
+                                       auto log(dac.get(position));
+                                       callback(log.c_str(), user_data);
+                               });
        if (ret < 0)
                return AUDIT_TRAIL_ERROR_INVALID_PARAMETER;
 
index 3dea1a1203d1bca2072c12f2f3f2f9c373b2f82f..2737f8bedde5df0694b1ad2136da183630333737 100644 (file)
@@ -31,14 +31,13 @@ int audit_trail_foreach_mac(audit_trail_h handle, audit_trail_string_cb callback
        AuditTrailContext &client = GetAuditTrailContext(handle);
        auto mac = client.createInterface<MandatoryAccessControl>();
 
-       int iter = mac.createIterator();
-       do {
-               std::string log(mac.getIteratorValue(iter));
+       int end = mac.size();
+       for (int i = 0; i < end; i++) {
+               std::string log(mac.get(i));
                if (log.size() > 0) {
                        callback(log.c_str(), user_data);
                }
-       } while (mac.nextIterator(iter));
-       mac.destroyIterator(iter);
+       }
 
        return AUDIT_TRAIL_ERROR_NONE;
 }
@@ -59,8 +58,14 @@ int audit_trail_add_mac_cb(audit_trail_h handle, audit_trail_string_cb callback,
        RET_ON_FAILURE(handle, AUDIT_TRAIL_ERROR_INVALID_PARAMETER);
        RET_ON_FAILURE(callback, AUDIT_TRAIL_ERROR_INVALID_PARAMETER);
 
-       AuditTrailContext &context = GetAuditTrailContext(handle);
-       int ret = context.subscribeNotification("MandatoryAccessControl", callback, user_data);
+       AuditTrailContext &client = GetAuditTrailContext(handle);
+       int ret = client.subscribeNotification("MandatoryAccessControl",
+                               [callback, user_data, &client] (std::string name, int position)
+                               {
+                                       auto mac = client.createInterface<MandatoryAccessControl>();
+                                       auto log(mac.get(position));
+                                       callback(log.c_str(), user_data);
+                               });
        if (ret < 0)
                return AUDIT_TRAIL_ERROR_INVALID_PARAMETER;
 
@@ -73,8 +78,8 @@ int audit_trail_remove_mac_cb(audit_trail_h handle, int callback_id)
        RET_ON_FAILURE(handle, AUDIT_TRAIL_ERROR_INVALID_PARAMETER);
        RET_ON_FAILURE(callback_id >= 0, AUDIT_TRAIL_ERROR_INVALID_PARAMETER);
 
-       AuditTrailContext &context = GetAuditTrailContext(handle);
-       int ret =  context.unsubscribeNotification(callback_id);
+       AuditTrailContext &client = GetAuditTrailContext(handle);
+       int ret =  client.unsubscribeNotification(callback_id);
        if (ret)
                return AUDIT_TRAIL_ERROR_INVALID_PARAMETER;
 
index e6def39caf32d04445dd70e6b463891e2e8f22c4..0b03bf1c4a832f2beab1a7f1f0ff24bf753a178c 100644 (file)
@@ -31,14 +31,13 @@ int audit_trail_foreach_syscall(audit_trail_h handle, audit_trail_string_cb call
        AuditTrailContext &client = GetAuditTrailContext(handle);
        SystemCall systemCall = client.createInterface<SystemCall>();
 
-       int iter = systemCall.createIterator();
-       do {
-               std::string log(systemCall.getIteratorValue(iter));
+       int end = systemCall.size();
+       for (int i = 0; i < end; i++) {
+               std::string log(systemCall.get(i));
                if (log.size() > 0) {
                        callback(log.c_str(), user_data);
                }
-       } while (systemCall.nextIterator(iter));
-       systemCall.destroyIterator(iter);
+       }
 
        return AUDIT_TRAIL_ERROR_NONE;
 }
@@ -59,8 +58,14 @@ int audit_trail_add_syscall_cb(audit_trail_h handle, audit_trail_string_cb callb
        RET_ON_FAILURE(handle, AUDIT_TRAIL_ERROR_INVALID_PARAMETER);
        RET_ON_FAILURE(callback, AUDIT_TRAIL_ERROR_INVALID_PARAMETER);
 
-       AuditTrailContext &context = GetAuditTrailContext(handle);
-       int ret = context.subscribeNotification("SystemCall", callback, user_data);
+       AuditTrailContext &client = GetAuditTrailContext(handle);
+       int ret = client.subscribeNotification("SystemCall",
+                               [callback, user_data, &client] (std::string name, int position)
+                               {
+                                       auto syscall = client.createInterface<SystemCall>();
+                                       auto log(syscall.get(position));
+                                       callback(log.c_str(), user_data);
+                               });
        if (ret < 0)
                return AUDIT_TRAIL_ERROR_INVALID_PARAMETER;
 
@@ -73,8 +78,8 @@ int audit_trail_remove_syscall_cb(audit_trail_h handle, int callback_id)
        RET_ON_FAILURE(handle, AUDIT_TRAIL_ERROR_INVALID_PARAMETER);
        RET_ON_FAILURE(callback_id >= 0, AUDIT_TRAIL_ERROR_INVALID_PARAMETER);
 
-       AuditTrailContext &context = GetAuditTrailContext(handle);
-       int ret =  context.unsubscribeNotification(callback_id);
+       AuditTrailContext &client = GetAuditTrailContext(handle);
+       int ret =  client.unsubscribeNotification(callback_id);
        if (ret)
                return AUDIT_TRAIL_ERROR_INVALID_PARAMETER;
 
index 64182a2efbfaeec0eac3f50a9acfab288dd08fd9..7d00cdb15db70daeeac62c2a49f06e3ba8a3f1a0 100644 (file)
@@ -59,16 +59,11 @@ void AuditTrailContext::disconnect() noexcept
 }
 
 int AuditTrailContext::subscribeNotification(const std::string& name,
-                                                                                       const SignalListener& listener,
-                                                                                       void* data)
+                                                                                       const Listener& listener)
 {
-       auto listenerDispatcher = [listener, data](std::string name, std::string type) {
-               listener(type.c_str(), data);
-       };
-
        try {
-               return client->subscribe<std::string, std::string>
-                                                       (SUBSCRIBER_REGISTER, name, listenerDispatcher);
+               return client->subscribe<std::string, int>
+                                                       (SUBSCRIBER_REGISTER, name, listener);
        } catch (runtime::Exception& e) {
                std::cout << e.what() << std::endl;
                return -1;
index d6dbce2ce2976bf7b9ca8e06a241df0f3a352150..e30d0fbd21a752172218cb856a342631818a34a8 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <klay/rmi/client.h>
 
-typedef std::function<void(const char*, void*)> SignalListener;
+typedef std::function<void(std::string, int)> Listener;
 
 class AuditTrailContext final {
 public:
@@ -36,7 +36,7 @@ public:
        int connect(const std::string& address) noexcept;
        void disconnect() noexcept;
 
-       int subscribeNotification(const std::string& name, const SignalListener& listener, void* data);
+       int subscribeNotification(const std::string& name, const Listener& listener);
        int unsubscribeNotification(int subscriberId);
 
        template<typename Interface, typename... Args>
index 92b26f5c4e67cfad206ccc95a7d50b01cfc0b2d9..5c620696e4a4504032bd03fa1b1b0005c11e2ee4 100644 (file)
@@ -26,36 +26,20 @@ DiscretionaryAccessControl::~DiscretionaryAccessControl()
 {
 }
 
-int DiscretionaryAccessControl::createIterator()
+std::string DiscretionaryAccessControl::get(unsigned int pos)
 {
        try {
-               return context->methodCall<int>("DiscretionaryAccessControl::createIterator");
-       } catch (runtime::Exception& e) {}
-       return -1;
-}
-
-std::string DiscretionaryAccessControl::getIteratorValue(int iterator)
-{
-       try {
-               return context->methodCall<std::string>("DiscretionaryAccessControl::getIteratorValue", iterator);
+               return context->methodCall<std::string>("DiscretionaryAccessControl::get", pos);
        } catch (runtime::Exception& e) {}
        return "";
 }
 
-bool DiscretionaryAccessControl::nextIterator(int iterator)
-{
-       try {
-               return context->methodCall<bool>("DiscretionaryAccessControl::nextIterator", iterator);
-       } catch (runtime::Exception& e) {}
-       return false;
-}
-
-int DiscretionaryAccessControl::destroyIterator(int iterator)
+unsigned int DiscretionaryAccessControl::size()
 {
        try {
-               return context->methodCall<int>("DiscretionaryAccessControl::destroyIterator", iterator);
+               return context->methodCall<unsigned int>("DiscretionaryAccessControl::size");
        } catch (runtime::Exception& e) {}
-       return -1;
+       return 0;
 }
 
 int DiscretionaryAccessControl::clear()
index 70100263a38880fee3155b7f9fffc936af931705..ad2ef4eb2ad02a7da4139e036fd8008fa2d55525 100644 (file)
@@ -26,36 +26,20 @@ MandatoryAccessControl::~MandatoryAccessControl()
 {
 }
 
-int MandatoryAccessControl::createIterator()
+std::string MandatoryAccessControl::get(unsigned int pos)
 {
        try {
-               return context->methodCall<int>("MandatoryAccessControl::createIterator");
-       } catch (runtime::Exception& e) {}
-       return -1;
-}
-
-std::string MandatoryAccessControl::getIteratorValue(int iterator)
-{
-       try {
-               return context->methodCall<std::string>("MandatoryAccessControl::getIteratorValue", iterator);
+               return context->methodCall<std::string>("MandatoryAccessControl::get", pos);
        } catch (runtime::Exception& e) {}
        return "";
 }
 
-bool MandatoryAccessControl::nextIterator(int iterator)
-{
-       try {
-               return context->methodCall<bool>("MandatoryAccessControl::nextIterator", iterator);
-       } catch (runtime::Exception& e) {}
-       return false;
-}
-
-int MandatoryAccessControl::destroyIterator(int iterator)
+unsigned int MandatoryAccessControl::size()
 {
        try {
-               return context->methodCall<int>("MandatoryAccessControl::destroyIterator", iterator);
+               return context->methodCall<unsigned int>("MandatoryAccessControl::size");
        } catch (runtime::Exception& e) {}
-       return -1;
+       return 0;
 }
 
 int MandatoryAccessControl::clear()
index ff792ea463e34ac9549b5c80e344cda570dcba15..d4d219e2c32bd6899b9b237197e4ffa79718d19e 100644 (file)
@@ -26,36 +26,20 @@ SystemCall::~SystemCall()
 {
 }
 
-int SystemCall::createIterator()
+std::string SystemCall::get(unsigned int pos)
 {
        try {
-               return context->methodCall<int>("SystemCall::createIterator");
-       } catch (runtime::Exception& e) {}
-       return -1;
-}
-
-std::string SystemCall::getIteratorValue(int iterator)
-{
-       try {
-               return context->methodCall<std::string>("SystemCall::getIteratorValue", iterator);
+               return context->methodCall<std::string>("SystemCall::get", pos);
        } catch (runtime::Exception& e) {}
        return "";
 }
 
-bool SystemCall::nextIterator(int iterator)
-{
-       try {
-               return context->methodCall<bool>("SystemCall::nextIterator", iterator);
-       } catch (runtime::Exception& e) {}
-       return false;
-}
-
-int SystemCall::destroyIterator(int iterator)
+unsigned int SystemCall::size()
 {
        try {
-               return context->methodCall<int>("SystemCall::destroyIterator", iterator);
+               return context->methodCall<unsigned int>("SystemCall::size");
        } catch (runtime::Exception& e) {}
-       return -1;
+       return 0;
 }
 
 int SystemCall::clear()
index bb8323ef5773fb51dd2c3862192faa0b37643e46..8aedca2d294de27ddb0d35ee590b40e67fa68d98 100644 (file)
@@ -30,10 +30,8 @@ public:
        DiscretionaryAccessControl(AuditTrailControlContext& ctxt);
        ~DiscretionaryAccessControl();
 
-       int createIterator();
-       std::string getIteratorValue(int iterator);
-       bool nextIterator(int iterator);
-       int destroyIterator(int iterator);
+       std::string get(unsigned int pos);
+       unsigned int size();
 
        int clear();
 
index fb55d73294ea44701ed4281a673954e44627edac..c106b6990fa90339a71edd128f0b56ba5a8cc54c 100644 (file)
@@ -30,10 +30,8 @@ public:
        MandatoryAccessControl(AuditTrailControlContext& ctxt);
        ~MandatoryAccessControl();
 
-       int createIterator();
-       std::string getIteratorValue(int iterator);
-       bool nextIterator(int iterator);
-       int destroyIterator(int iterator);
+       std::string get(unsigned int pos);
+       unsigned int size();
 
        int clear();
 
index 10b26c652f76994099e532607b09000d7204c9e9..2d94fcabb59d30eea92e893a2740e26535230323 100644 (file)
@@ -30,10 +30,8 @@ public:
        SystemCall(AuditTrailControlContext& ctxt);
        ~SystemCall();
 
-       int createIterator();
-       std::string getIteratorValue(int iterator);
-       bool nextIterator(int iterator);
-       int destroyIterator(int iterator);
+       std::string get(unsigned int pos);
+       unsigned int size();
 
        int clear();
 
index 791e6e11eb2048c0cbeb29598c1d0307ea85fc19..09ded72b65e86e2ba6f2a5b34eeaddf2d85cef0e 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "rmi/discretionary-access-control.h"
 
-#define AUDIT_RULE_KEY "DiscretionaryAccessControl"
+#define AUDIT_RULE_KEY "DAC"
 #define PRIVILEGE_PLATFORM "http://tizen.org/privilege/internal/default/platform"
 
 namespace AuditTrail {
@@ -28,14 +28,10 @@ namespace AuditTrail {
 namespace {
 
 std::vector<std::string> logs;
-
-std::unordered_map<int, unsigned long long> iteratorMap;
-int newIteratorId = 0;
+bool enabled;
 
 const std::string keyString = " key=\"" AUDIT_RULE_KEY "\"";
-
 netlink::AuditRule ruleDacAccess, ruleDacPerm;
-bool enabled;
 
 } // namespace
 
@@ -43,10 +39,8 @@ bool enabled;
 DiscretionaryAccessControl::DiscretionaryAccessControl(AuditTrailControlContext &ctx) :
        context(ctx)
 {
-       context.expose(this, "", (int)(DiscretionaryAccessControl::createIterator)());
-       context.expose(this, "", (std::string)(DiscretionaryAccessControl::getIteratorValue)(int));
-       context.expose(this, "", (bool)(DiscretionaryAccessControl::nextIterator)(int));
-       context.expose(this, "", (int)(DiscretionaryAccessControl::destroyIterator)(int));
+       context.expose(this, "", (std::string)(DiscretionaryAccessControl::get)(unsigned int));
+       context.expose(this, "", (unsigned int)(DiscretionaryAccessControl::size)());
        context.expose(this, PRIVILEGE_PLATFORM, (int)(DiscretionaryAccessControl::clear)());
        context.expose(this, PRIVILEGE_PLATFORM, (int)(DiscretionaryAccessControl::enable)(bool));
        context.expose(this, "", (bool)(DiscretionaryAccessControl::isEnabled)());
@@ -76,7 +70,7 @@ DiscretionaryAccessControl::DiscretionaryAccessControl(AuditTrailControlContext
                        if (log.substr(keyPos) == keyString) {
                                log = log.substr(0, keyPos);
                                logs.push_back(log);
-                               ctx.notify("DiscretionaryAccessControl", log);
+                               ctx.notify("DiscretionaryAccessControl", logs.size() - 1);
                        }
                }
        });
@@ -86,54 +80,18 @@ DiscretionaryAccessControl::~DiscretionaryAccessControl()
 {
 }
 
-int DiscretionaryAccessControl::createIterator()
-{
-       int iteratorId = -1;
-       iteratorMap.erase(newIteratorId);
-       iteratorMap.insert({newIteratorId, 0});
-
-       iteratorId = newIteratorId;
-
-       if (++newIteratorId < 0) {
-               newIteratorId = 0;
-       }
-       return iteratorId;
-}
-
-std::string DiscretionaryAccessControl::getIteratorValue(int iterator)
+std::string DiscretionaryAccessControl::get(unsigned int pos)
 {
-       auto it = iteratorMap.find(iterator);
-       if (it == iteratorMap.end()) {
+       if (pos >= logs.size()) {
                return "";
        }
 
-       if (it->second >= logs.size()) {
-               return "";
-       }
-
-       return logs[it->second];
+       return logs[pos];
 }
 
-bool DiscretionaryAccessControl::nextIterator(int iterator)
+unsigned int DiscretionaryAccessControl::size()
 {
-       auto it = iteratorMap.find(iterator);
-       if (it != iteratorMap.end()) {
-               if (it->second + 1 < logs.size()) {
-                       it->second++;
-                       return true;
-               }
-       }
-       return false;
-}
-
-int DiscretionaryAccessControl::destroyIterator(int iterator)
-{
-       auto it = iteratorMap.find(iterator);
-       if (it != iteratorMap.end()) {
-               iteratorMap.erase(it);
-               return 0;
-       }
-       return -1;
+       return logs.size();
 }
 
 int DiscretionaryAccessControl::clear()
index 4e30692456fe54c76cb97ca12833e41282299def..d213b732faef65d429494f6be9d4a3a75513b3b2 100644 (file)
@@ -26,10 +26,6 @@ namespace AuditTrail {
 namespace {
 
 std::vector<std::string> logs;
-
-std::unordered_map<int, unsigned long long> iteratorMap;
-int newIteratorId = 0;
-
 bool enabled;
 
 } // namespace
@@ -38,10 +34,8 @@ bool enabled;
 MandatoryAccessControl::MandatoryAccessControl(AuditTrailControlContext &ctx) :
        context(ctx)
 {
-       context.expose(this, "", (int)(MandatoryAccessControl::createIterator)());
-       context.expose(this, "", (std::string)(MandatoryAccessControl::getIteratorValue)(int));
-       context.expose(this, "", (bool)(MandatoryAccessControl::nextIterator)(int));
-       context.expose(this, "", (int)(MandatoryAccessControl::destroyIterator)(int));
+       context.expose(this, "", (std::string)(MandatoryAccessControl::get)(unsigned int));
+       context.expose(this, "", (unsigned int)(MandatoryAccessControl::size)());
        context.expose(this, PRIVILEGE_PLATFORM, (int)(MandatoryAccessControl::clear)());
        context.expose(this, PRIVILEGE_PLATFORM, (int)(MandatoryAccessControl::enable)(bool));
        context.expose(this, "", (bool)(MandatoryAccessControl::isEnabled)());
@@ -54,7 +48,7 @@ MandatoryAccessControl::MandatoryAccessControl(AuditTrailControlContext &ctx) :
                if (type == AUDIT_AVC && enabled) {
                        std::string log(buf.begin(), buf.end());
                        logs.push_back(log);
-                       ctx.notify("MandatoryAccessControl", log);
+                       ctx.notify("MandatoryAccessControl", logs.size() - 1);
                }
        });
 }
@@ -63,54 +57,18 @@ MandatoryAccessControl::~MandatoryAccessControl()
 {
 }
 
-int MandatoryAccessControl::createIterator()
+std::string MandatoryAccessControl::get(unsigned int pos)
 {
-       int iteratorId = -1;
-       iteratorMap.erase(newIteratorId);
-       iteratorMap.insert({newIteratorId, 0});
-
-       iteratorId = newIteratorId;
-
-       if (++newIteratorId < 0) {
-               newIteratorId = 0;
-       }
-       return iteratorId;
-}
-
-std::string MandatoryAccessControl::getIteratorValue(int iterator)
-{
-       auto it = iteratorMap.find(iterator);
-       if (it == iteratorMap.end()) {
+       if (pos >= logs.size()) {
                return "";
        }
 
-       if (it->second >= logs.size()) {
-               return "";
-       }
-
-       return logs[it->second];
-}
-
-bool MandatoryAccessControl::nextIterator(int iterator)
-{
-       auto it = iteratorMap.find(iterator);
-       if (it != iteratorMap.end()) {
-               if (it->second + 1 < logs.size()) {
-                       it->second++;
-                       return true;
-               }
-       }
-       return false;
+       return logs[pos];
 }
 
-int MandatoryAccessControl::destroyIterator(int iterator)
+unsigned int MandatoryAccessControl::size()
 {
-       auto it = iteratorMap.find(iterator);
-       if (it != iteratorMap.end()) {
-               iteratorMap.erase(it);
-               return 0;
-       }
-       return -1;
+       return logs.size();
 }
 
 int MandatoryAccessControl::clear()
index affc40b50d26b17bcc2bf95422216048371c9e31..ba2bbe702d21cbd3f37c0a73ca710e2cac9b7745 100644 (file)
 
 #include "rmi/system-call.h"
 
-#define AUDIT_RULE_KEY "SystemCall"
+#define AUDIT_RULE_KEY "syscall"
 #define PRIVILEGE_PLATFORM "http://tizen.org/privilege/internal/default/platform"
 
 namespace AuditTrail {
 
 namespace {
 
-std::vector<std::string> systemCallLogs;
-
-std::unordered_map<int, unsigned long long> iteratorMap;
-int newIteratorId = 0;
+std::vector<std::string> logs;
+bool enabled;
 
 const std::string keyString = " key=\"" AUDIT_RULE_KEY "\"";
-
 netlink::AuditRule ruleAllSyscall;
-bool enabled;
 
 } // namespace
 
@@ -43,17 +39,14 @@ bool enabled;
 SystemCall::SystemCall(AuditTrailControlContext &ctx) :
        context(ctx)
 {
-       context.expose(this, "", (int)(SystemCall::createIterator)());
-       context.expose(this, "", (std::string)(SystemCall::getIteratorValue)(int));
-       context.expose(this, "", (bool)(SystemCall::nextIterator)(int));
-       context.expose(this, "", (int)(SystemCall::destroyIterator)(int));
+       context.expose(this, "", (std::string)(SystemCall::get)(unsigned int));
+       context.expose(this, "", (unsigned int)(SystemCall::size)());
        context.expose(this, PRIVILEGE_PLATFORM, (int)(SystemCall::clear)());
        context.expose(this, PRIVILEGE_PLATFORM, (int)(SystemCall::enable)(bool));
        context.expose(this, "", (bool)(SystemCall::isEnabled)());
 
        context.createNotification("SystemCall");
 
-
        ruleAllSyscall.setKey(AUDIT_RULE_KEY);
        ruleAllSyscall.setAllSystemCalls();
 
@@ -69,8 +62,8 @@ SystemCall::SystemCall(AuditTrailControlContext &ctx) :
 
                        if (log.substr(keyPos) == keyString) {
                                log = log.substr(0, keyPos);
-                               systemCallLogs.push_back(log);
-                               ctx.notify("SystemCall", log);
+                               logs.push_back(log);
+                               ctx.notify("SystemCall", logs.size() - 1);
                        }
                }
        });
@@ -80,59 +73,23 @@ SystemCall::~SystemCall()
 {
 }
 
-int SystemCall::createIterator()
-{
-       int iteratorId = -1;
-       iteratorMap.erase(newIteratorId);
-       iteratorMap.insert({newIteratorId, 0});
-
-       iteratorId = newIteratorId;
-
-       if (++newIteratorId < 0) {
-               newIteratorId = 0;
-       }
-       return iteratorId;
-}
-
-std::string SystemCall::getIteratorValue(int iterator)
+std::string SystemCall::get(unsigned int pos)
 {
-       auto it = iteratorMap.find(iterator);
-       if (it == iteratorMap.end()) {
+       if (pos >= logs.size()) {
                return "";
        }
 
-       if (it->second >= systemCallLogs.size()) {
-               return "";
-       }
-
-       return systemCallLogs[it->second];
-}
-
-bool SystemCall::nextIterator(int iterator)
-{
-       auto it = iteratorMap.find(iterator);
-       if (it != iteratorMap.end()) {
-               if (it->second + 1 < systemCallLogs.size()) {
-                       it->second++;
-                       return true;
-               }
-       }
-       return false;
+       return logs[pos];
 }
 
-int SystemCall::destroyIterator(int iterator)
+unsigned int SystemCall::size()
 {
-       auto it = iteratorMap.find(iterator);
-       if (it != iteratorMap.end()) {
-               iteratorMap.erase(it);
-               return 0;
-       }
-       return -1;
+       return logs.size();
 }
 
 int SystemCall::clear()
 {
-       systemCallLogs.clear();
+       logs.clear();
        return 0;
 }