/src/libiec61850/src/logging/log_storage.c
Line | Count | Source |
1 | | /* |
2 | | * log_storage.c |
3 | | * |
4 | | * Copyright 2016 Michael Zillgith |
5 | | * |
6 | | * This file is part of libIEC61850. |
7 | | * |
8 | | * libIEC61850 is free software: you can redistribute it and/or modify |
9 | | * it under the terms of the GNU General Public License as published by |
10 | | * the Free Software Foundation, either version 3 of the License, or |
11 | | * (at your option) any later version. |
12 | | * |
13 | | * libIEC61850 is distributed in the hope that it will be useful, |
14 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | | * GNU General Public License for more details. |
17 | | * |
18 | | * You should have received a copy of the GNU General Public License |
19 | | * along with libIEC61850. If not, see <http://www.gnu.org/licenses/>. |
20 | | * |
21 | | * See COPYING file for the complete license text. |
22 | | */ |
23 | | |
24 | | #include "logging_api.h" |
25 | | |
26 | | |
27 | | void |
28 | | LogStorage_setMaxLogEntries(LogStorage self, int maxEntries) |
29 | 0 | { |
30 | 0 | self->maxLogEntries = maxEntries; |
31 | 0 | } |
32 | | |
33 | | int |
34 | | LogStorage_getMaxLogEntries(LogStorage self) |
35 | 0 | { |
36 | 0 | return self->maxLogEntries; |
37 | 0 | } |
38 | | |
39 | | uint64_t |
40 | | LogStorage_addEntry(LogStorage self, uint64_t timestamp) |
41 | 0 | { |
42 | 0 | return self->addEntry(self, timestamp); |
43 | 0 | } |
44 | | |
45 | | bool |
46 | | LogStorage_addEntryData(LogStorage self, uint64_t entryID, const char* dataRef, uint8_t* data, int dataSize, uint8_t reasonCode) |
47 | 0 | { |
48 | 0 | return self->addEntryData(self, entryID, dataRef, data, dataSize, reasonCode); |
49 | 0 | } |
50 | | |
51 | | bool |
52 | | LogStorage_getEntries(LogStorage self, uint64_t startingTime, uint64_t endingTime, |
53 | | LogEntryCallback entryCallback, LogEntryDataCallback entryDataCallback, void* parameter) |
54 | 0 | { |
55 | 0 | return self->getEntries(self, startingTime, endingTime, entryCallback, entryDataCallback, parameter); |
56 | 0 | } |
57 | | |
58 | | bool |
59 | | LogStorage_getEntriesAfter(LogStorage self, uint64_t startingTime, uint64_t entryID, |
60 | | LogEntryCallback entryCallback, LogEntryDataCallback entryDataCallback, void* parameter) |
61 | 0 | { |
62 | 0 | return self->getEntriesAfter(self, startingTime, entryID, entryCallback, entryDataCallback, parameter); |
63 | 0 | } |
64 | | |
65 | | void |
66 | | LogStorage_destroy(LogStorage self) |
67 | 0 | { |
68 | 0 | self->destroy(self); |
69 | 0 | } |
70 | | |
71 | | |
72 | | bool |
73 | | LogStorage_getOldestAndNewestEntries(LogStorage self, uint64_t* newEntry, uint64_t* newEntryTime, |
74 | | uint64_t* oldEntry, uint64_t* oldEntryTime) |
75 | 0 | { |
76 | 0 | return self->getOldestAndNewestEntries(self, newEntry, newEntryTime, oldEntry, oldEntryTime); |
77 | 0 | } |
78 | | |