summaryrefslogtreecommitdiffstats
path: root/src/Net/Packets
diff options
context:
space:
mode:
Diffstat (limited to 'src/Net/Packets')
-rw-r--r--src/Net/Packets/CoreStatusPacket.cpp10
-rw-r--r--src/Net/Packets/CoreStatusPacket.h37
-rw-r--r--src/Net/Packets/Makefile.in2
3 files changed, 38 insertions, 11 deletions
diff --git a/src/Net/Packets/CoreStatusPacket.cpp b/src/Net/Packets/CoreStatusPacket.cpp
index 4397fa8..ad2a7fb 100644
--- a/src/Net/Packets/CoreStatusPacket.cpp
+++ b/src/Net/Packets/CoreStatusPacket.cpp
@@ -24,12 +24,20 @@ namespace Mad {
namespace Net {
namespace Packets {
-CoreStatusPacket::CoreStatusPacket(Type type, uint16_t requestId, uint32_t uptime, uint32_t idleTime) : Packet(type, requestId) {
+CoreStatusPacket::CoreStatusPacket(Type type, uint16_t requestId, uint32_t uptime, uint32_t idleTime,
+ uint32_t totalMem, uint32_t freeMem, uint32_t totalSwap, uint32_t freeSwap)
+: Packet(type, requestId)
+{
setLength(sizeof(CoreStatusData));
coreStatusData = (CoreStatusData*)&rawData->data;
coreStatusData->uptime = htonl(uptime);
coreStatusData->idleTime = htonl(idleTime);
+
+ coreStatusData->totalMem = htonl(totalMem);
+ coreStatusData->freeMem = htonl(freeMem);
+ coreStatusData->totalSwap = htonl(totalSwap);
+ coreStatusData->freeSwap = htonl(freeSwap);
}
CoreStatusPacket& CoreStatusPacket::operator=(const Packet &p) {
diff --git a/src/Net/Packets/CoreStatusPacket.h b/src/Net/Packets/CoreStatusPacket.h
index 14b022e..a19f8e7 100644
--- a/src/Net/Packets/CoreStatusPacket.h
+++ b/src/Net/Packets/CoreStatusPacket.h
@@ -27,33 +27,34 @@ namespace Net {
namespace Packets {
class CoreStatusPacket : public Packet {
+ private:
+ CoreStatusPacket& operator=(const CoreStatusPacket &p);
+ CoreStatusPacket(const CoreStatusPacket &p);
+
protected:
struct CoreStatusData {
uint32_t uptime;
uint32_t idleTime;
+
+ uint32_t totalMem;
+ uint32_t freeMem;
+ uint32_t totalSwap;
+ uint32_t freeSwap;
};
CoreStatusData *coreStatusData;
public:
- CoreStatusPacket(Type type, uint16_t requestId, uint32_t uptime = 0, uint32_t idleTime = 0);
+ CoreStatusPacket(Type type, uint16_t requestId, uint32_t uptime = 0, uint32_t idleTime = 0,
+ uint32_t totalMem = 0, uint32_t freeMem = 0, uint32_t totalSwap = 0, uint32_t freeSwap = 0);
CoreStatusPacket(const Packet &p) : Packet(p) {
setLength(sizeof(CoreStatusData));
coreStatusData = (CoreStatusData*)&rawData->data;
}
- CoreStatusPacket(const CoreStatusPacket &p) : Packet(p) {
- setLength(sizeof(CoreStatusData));
- coreStatusData = (CoreStatusData*)&rawData->data;
- }
-
CoreStatusPacket& operator=(const Packet &p);
- CoreStatusPacket& operator=(const CoreStatusPacket &p) {
- return (*this = (Packet)p);
- }
-
uint32_t getUptime() const {
return ntohl(coreStatusData->uptime);
}
@@ -61,6 +62,22 @@ class CoreStatusPacket : public Packet {
uint32_t getIdleTime() const {
return ntohl(coreStatusData->idleTime);
}
+
+ uint32_t getTotalMem() const {
+ return ntohl(coreStatusData->totalMem);
+ }
+
+ uint32_t getFreeMem() const {
+ return ntohl(coreStatusData->freeMem);
+ }
+
+ uint32_t getTotalSwap() const {
+ return ntohl(coreStatusData->totalSwap);
+ }
+
+ uint32_t getFreeSwap() const {
+ return ntohl(coreStatusData->freeSwap);
+ }
};
}
diff --git a/src/Net/Packets/Makefile.in b/src/Net/Packets/Makefile.in
index 8fa55b0..3af3051 100644
--- a/src/Net/Packets/Makefile.in
+++ b/src/Net/Packets/Makefile.in
@@ -119,6 +119,8 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PCRECPP_CFLAGS = @PCRECPP_CFLAGS@
+PCRECPP_LIBS = @PCRECPP_LIBS@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SED = @SED@