summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Client/CommandParser.cpp12
-rw-r--r--src/Client/CommandParser.h4
-rw-r--r--src/Client/Requests/DaemonListRequest.cpp4
-rw-r--r--src/Client/Requests/DaemonListRequest.h6
-rw-r--r--src/Common/HostInfo.h (renamed from src/Core/DaemonInfo.h)27
-rw-r--r--src/Common/Makefile.am2
-rw-r--r--src/Common/Makefile.in2
-rw-r--r--src/Core/ConfigManager.cpp2
-rw-r--r--src/Core/ConfigManager.h7
-rw-r--r--src/Core/ConnectionManager.cpp16
-rw-r--r--src/Core/ConnectionManager.h6
-rw-r--r--src/Core/RequestHandlers/DaemonListRequestHandler.cpp10
-rw-r--r--src/Net/Packets/HostListPacket.cpp87
-rw-r--r--src/Net/Packets/HostListPacket.h (renamed from src/Net/Packets/NameListPacket.h)32
-rw-r--r--src/Net/Packets/Makefile.am4
-rw-r--r--src/Net/Packets/Makefile.in10
-rw-r--r--src/Net/Packets/NameListPacket.cpp56
17 files changed, 167 insertions, 120 deletions
diff --git a/src/Client/CommandParser.cpp b/src/Client/CommandParser.cpp
index aa203b3..76178dc 100644
--- a/src/Client/CommandParser.cpp
+++ b/src/Client/CommandParser.cpp
@@ -25,8 +25,8 @@
#include <Common/Logger.h>
#include <Common/RequestManager.h>
#include <Common/Requests/DisconnectRequest.h>
+#include <Net/Packets/HostListPacket.h>
#include <Net/Packets/HostStatusPacket.h>
-#include <Net/Packets/NameListPacket.h>
#include <iostream>
#include <cstdio>
@@ -182,18 +182,18 @@ void CommandParser::coreStatusRequestFinished(const Common::Request<Net::Packets
requestFinished();
}
-void CommandParser::daemonListRequestFinished(const Common::Request<Net::Packets::NameListPacket> &request) {
+void CommandParser::daemonListRequestFinished(const Common::Request<Net::Packets::HostListPacket> &request) {
try {
- const std::vector<std::string>& hosts = request.getResult().getNameList();
+ const std::vector<Common::HostInfo>& hosts = request.getResult().getHostInfo();
if(hosts.empty()) {
std::cout << "There aren't any active hosts." << std::endl << std::endl;
}
else {
- std::cout << "Active hosts:" << std::endl;
+ std::cout << "Host list:" << std::endl;
- for(std::vector<std::string>::const_iterator host = hosts.begin(); host != hosts.end(); ++host)
- std::cout << "\t" << *host << std::endl;
+ for(std::vector<Common::HostInfo>::const_iterator host = hosts.begin(); host != hosts.end(); ++host)
+ std::cout << "\t" << host->getName() << " (" << (host->getStatus() == Common::HostInfo::RUNNING ? "running" : "inactive") << ")" << std::endl;
std::cout << std::endl;
}
diff --git a/src/Client/CommandParser.h b/src/Client/CommandParser.h
index 4137cb3..16d7e34 100644
--- a/src/Client/CommandParser.h
+++ b/src/Client/CommandParser.h
@@ -36,7 +36,7 @@ class Connection;
namespace Packets {
class HostStatusPacket;
-class NameListPacket;
+class HostListPacket;
}
}
@@ -76,7 +76,7 @@ class CommandParser {
void exitCommand(const std::vector<std::string>&);
void coreStatusRequestFinished(const Common::Request<Net::Packets::HostStatusPacket> &request);
- void daemonListRequestFinished(const Common::Request<Net::Packets::NameListPacket> &request);
+ void daemonListRequestFinished(const Common::Request<Net::Packets::HostListPacket> &request);
void daemonStatusRequestFinished(const Common::Request<Net::Packets::HostStatusPacket> &request);
void disconnectRequestFinished(const Common::Request<> &request);
diff --git a/src/Client/Requests/DaemonListRequest.cpp b/src/Client/Requests/DaemonListRequest.cpp
index 2c2e195..279d19c 100644
--- a/src/Client/Requests/DaemonListRequest.cpp
+++ b/src/Client/Requests/DaemonListRequest.cpp
@@ -19,7 +19,7 @@
#include "DaemonListRequest.h"
#include <Net/Connection.h>
-#include <Net/Packets/NameListPacket.h>
+#include <Net/Packets/HostListPacket.h>
namespace Mad {
namespace Client {
@@ -35,7 +35,7 @@ void DaemonListRequest::handlePacket(Net::Connection*, const Net::Packet &packet
return; // TODO Logging
}
- finish(Net::Packets::NameListPacket(packet));
+ finish(Net::Packets::HostListPacket(packet));
}
}
diff --git a/src/Client/Requests/DaemonListRequest.h b/src/Client/Requests/DaemonListRequest.h
index 5c57502..625e430 100644
--- a/src/Client/Requests/DaemonListRequest.h
+++ b/src/Client/Requests/DaemonListRequest.h
@@ -26,20 +26,20 @@ namespace Mad {
namespace Net {
namespace Packets {
-class NameListPacket;
+class HostListPacket;
}
}
namespace Client {
namespace Requests {
-class DaemonListRequest : public Common::Request<Net::Packets::NameListPacket> {
+class DaemonListRequest : public Common::Request<Net::Packets::HostListPacket> {
protected:
virtual void sendRequest(Net::Connection *connection, uint16_t requestId);
virtual void handlePacket(Net::Connection *connection, const Net::Packet &packet);
public:
- DaemonListRequest(slot_type slot) : Common::Request<Net::Packets::NameListPacket>(slot) {}
+ DaemonListRequest(slot_type slot) : Common::Request<Net::Packets::HostListPacket>(slot) {}
};
}
diff --git a/src/Core/DaemonInfo.h b/src/Common/HostInfo.h
index 0377c57..db7f5d1 100644
--- a/src/Core/DaemonInfo.h
+++ b/src/Common/HostInfo.h
@@ -1,5 +1,5 @@
/*
- * DaemonInfo.h
+ * HostInfo.h
*
* Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de>
*
@@ -17,29 +17,40 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef MAD_CORE_DAEMONINFO_H_
-#define MAD_CORE_DAEMONINFO_H_
+#ifndef MAD_COMMON_HOSTINFO_H_
+#define MAD_COMMON_HOSTINFO_H_
#include <string>
namespace Mad {
-namespace Core {
+namespace Common {
+
+class HostInfo {
+ public:
+ enum Status {
+ INACTIVE, RUNNING
+ };
-class DaemonInfo {
private:
std::string name;
std::string ip;
+ Status status;
+
public:
- DaemonInfo(const std::string& name0) : name(name0) {}
+ HostInfo(const std::string& name0 = std::string()) : name(name0), status(INACTIVE) {}
+ void setName(const std::string &newName) {name = newName;}
const std::string& getName() const {return name;}
- void setIP(const std::string& ip0) {ip = ip0;}
+ void setIP(const std::string& newIp) {ip = newIp;}
const std::string& getIP() const {return ip;}
+
+ void setStatus(Status newStatus) {status = newStatus;}
+ Status getStatus() const {return status;}
};
}
}
-#endif /* MAD_CORE_DAEMONINFO_H_ */
+#endif /* MAD_COMMON_HOSTINFO_H_ */
diff --git a/src/Common/Makefile.am b/src/Common/Makefile.am
index 88126c4..d232f0b 100644
--- a/src/Common/Makefile.am
+++ b/src/Common/Makefile.am
@@ -4,4 +4,4 @@ noinst_LTLIBRARIES = libcommon.la
libcommon_la_SOURCES = ConfigManager.cpp Exception.cpp Logger.cpp RequestManager.cpp SystemBackend.cpp Util.cpp
libcommon_la_LIBADD = Backends/libbackends.la Requests/librequests.la RequestHandlers/librequesthandlers.la
-noinst_HEADERS = ConfigManager.h Exception.h Logger.h Request.h RequestBase.h RequestHandler.h RequestManager.h SystemBackend.h Util.h
+noinst_HEADERS = ConfigManager.h Exception.h HostInfo.h Logger.h Request.h RequestBase.h RequestHandler.h RequestManager.h SystemBackend.h Util.h
diff --git a/src/Common/Makefile.in b/src/Common/Makefile.in
index 9f655ee..06e237f 100644
--- a/src/Common/Makefile.in
+++ b/src/Common/Makefile.in
@@ -201,7 +201,7 @@ SUBDIRS = Backends Requests RequestHandlers
noinst_LTLIBRARIES = libcommon.la
libcommon_la_SOURCES = ConfigManager.cpp Exception.cpp Logger.cpp RequestManager.cpp SystemBackend.cpp Util.cpp
libcommon_la_LIBADD = Backends/libbackends.la Requests/librequests.la RequestHandlers/librequesthandlers.la
-noinst_HEADERS = ConfigManager.h Exception.h Logger.h Request.h RequestBase.h RequestHandler.h RequestManager.h SystemBackend.h Util.h
+noinst_HEADERS = ConfigManager.h Exception.h HostInfo.h Logger.h Request.h RequestBase.h RequestHandler.h RequestManager.h SystemBackend.h Util.h
all: all-recursive
.SUFFIXES:
diff --git a/src/Core/ConfigManager.cpp b/src/Core/ConfigManager.cpp
index d42db35..4484420 100644
--- a/src/Core/ConfigManager.cpp
+++ b/src/Core/ConfigManager.cpp
@@ -32,7 +32,7 @@ bool ConfigManager::parseLine(const std::vector<std::string> &section, const std
return false;
}
else if(Common::Util::tolower(key) == "daemon") {
- daemons.push_back(DaemonInfo(value));
+ daemons.push_back(Common::HostInfo(value));
}
else if(Common::Util::tolower(key) == "listen") {
try {
diff --git a/src/Core/ConfigManager.h b/src/Core/ConfigManager.h
index e089358..7178887 100644
--- a/src/Core/ConfigManager.h
+++ b/src/Core/ConfigManager.h
@@ -20,9 +20,10 @@
#ifndef MAD_CORE_CONFIGMANAGER_H_
#define MAD_CORE_CONFIGMANAGER_H_
-#include "DaemonInfo.h"
#include <Common/ConfigManager.h>
+#include <Common/HostInfo.h>
#include <Net/IPAddress.h>
+
#include <vector>
#include <string>
@@ -38,7 +39,7 @@ class ConfigManager : public Common::ConfigManager {
uint16_t methods;
std::vector<Net::IPAddress> listeners;
- std::vector<DaemonInfo> daemons;
+ std::vector<Common::HostInfo> daemons;
std::string x509TrustFile, x509CrlFile, x509CertFile, x509KeyFile;
@@ -57,7 +58,7 @@ class ConfigManager : public Common::ConfigManager {
}
const std::vector<Net::IPAddress>& getListenerAddresses() const {return listeners;}
- const std::vector<DaemonInfo>& getDaemonList() const {return daemons;}
+ const std::vector<Common::HostInfo>& getDaemonList() const {return daemons;}
const std::string& getX509TrustFile() const {return x509TrustFile;}
const std::string& getX509CrlFile() const {return x509CrlFile;}
diff --git a/src/Core/ConnectionManager.cpp b/src/Core/ConnectionManager.cpp
index 3007fd6..546d097 100644
--- a/src/Core/ConnectionManager.cpp
+++ b/src/Core/ConnectionManager.cpp
@@ -98,9 +98,9 @@ ConnectionManager::ConnectionManager() {
refreshPollfds();
- const std::vector<DaemonInfo>& daemons = configManager->getDaemonList();
+ const std::vector<Common::HostInfo>& daemons = configManager->getDaemonList();
- for(std::vector<DaemonInfo>::const_iterator daemon = daemons.begin(); daemon != daemons.end(); ++daemon) {
+ for(std::vector<Common::HostInfo>::const_iterator daemon = daemons.begin(); daemon != daemons.end(); ++daemon) {
daemonInfo.insert(std::make_pair(daemon->getName(), *daemon));
identifiedDaemonConnections.insert(std::make_pair<std::string,Net::ServerConnection*>(daemon->getName(), 0));
}
@@ -131,6 +131,8 @@ void ConnectionManager::handleConnections(std::list<Net::ServerConnection*>& con
for(std::map<std::string,Net::ServerConnection*>::iterator idCon = identifiedDaemonConnections.begin(); idCon != identifiedDaemonConnections.end(); ++idCon) {
if(idCon->second == *con) {
idCon->second = 0;
+
+ daemonInfo[idCon->first].setStatus(Common::HostInfo::INACTIVE);
break;
}
}
@@ -193,17 +195,17 @@ void ConnectionManager::identifyDaemonConnection(Net::Connection *connection, co
}
idCon->second = *con;
+ daemonInfo[idCon->first].setStatus(Common::HostInfo::RUNNING);
connection->setIdentified();
Common::Logger::log("Identified as '" + name + "'.");
}
-std::map<std::string,DaemonInfo> ConnectionManager::getDaemonList() const {
- std::map<std::string,DaemonInfo> ret;
+std::vector<Common::HostInfo> ConnectionManager::getDaemonList() const {
+ std::vector<Common::HostInfo> ret;
- for(std::map<std::string,Net::ServerConnection*>::const_iterator con = identifiedDaemonConnections.begin(); con != identifiedDaemonConnections.end(); ++con) {
- if(con->second)
- ret.insert(std::make_pair(con->first, daemonInfo.at(con->first)));
+ for(std::map<std::string,Common::HostInfo>::const_iterator daemon = daemonInfo.begin(); daemon != daemonInfo.end(); ++daemon) {
+ ret.push_back(daemon->second);
}
return ret;
diff --git a/src/Core/ConnectionManager.h b/src/Core/ConnectionManager.h
index be9beb9..0832b5a 100644
--- a/src/Core/ConnectionManager.h
+++ b/src/Core/ConnectionManager.h
@@ -26,8 +26,8 @@
#include <memory>
#include <poll.h>
-#include "DaemonInfo.h"
#include <Common/Exception.h>
+#include <Common/HostInfo.h>
#include <Common/RequestManager.h>
namespace Mad {
@@ -50,7 +50,7 @@ class ConnectionManager {
std::list<Net::ServerConnection*> daemonConnections;
std::list<Net::ServerConnection*> clientConnections;
- std::map<std::string,DaemonInfo> daemonInfo;
+ std::map<std::string,Common::HostInfo> daemonInfo;
std::map<std::string,Net::ServerConnection*> identifiedDaemonConnections;
std::vector<struct pollfd> pollfds;
@@ -85,7 +85,7 @@ class ConnectionManager {
Net::Connection* getDaemonConnection(const std::string &name) const throw (Common::Exception&);
void identifyDaemonConnection(Net::Connection *connection, const std::string &name) throw (Common::Exception&);
- std::map<std::string,DaemonInfo> getDaemonList() const;
+ std::vector<Common::HostInfo> getDaemonList() const;
};
}
diff --git a/src/Core/RequestHandlers/DaemonListRequestHandler.cpp b/src/Core/RequestHandlers/DaemonListRequestHandler.cpp
index 2a6b119..cec1c5a 100644
--- a/src/Core/RequestHandlers/DaemonListRequestHandler.cpp
+++ b/src/Core/RequestHandlers/DaemonListRequestHandler.cpp
@@ -22,7 +22,7 @@
#include <Common/Logger.h>
#include <Net/Connection.h>
#include <Net/Packets/ErrorPacket.h>
-#include <Net/Packets/NameListPacket.h>
+#include <Net/Packets/HostListPacket.h>
namespace Mad {
namespace Core {
@@ -39,13 +39,7 @@ void DaemonListRequestHandler::handlePacket(Net::Connection *connection, const N
// TODO Require authentication
- std::map<std::string,DaemonInfo> daemons = ConnectionManager::getConnectionManager()->getDaemonList();
- std::vector<std::string> names;
-
- for(std::map<std::string,DaemonInfo>::iterator daemon = daemons.begin(); daemon != daemons.end(); ++daemon)
- names.push_back(daemon->first);
-
- connection->send(Net::Packets::NameListPacket(Net::Packet::OK, packet.getRequestId(), names));
+ connection->send(Net::Packets::HostListPacket(Net::Packet::OK, packet.getRequestId(), ConnectionManager::getConnectionManager()->getDaemonList()));
signalFinished().emit();
}
diff --git a/src/Net/Packets/HostListPacket.cpp b/src/Net/Packets/HostListPacket.cpp
new file mode 100644
index 0000000..30a33b3
--- /dev/null
+++ b/src/Net/Packets/HostListPacket.cpp
@@ -0,0 +1,87 @@
+/*
+ * HostListPacket.cpp
+ *
+ * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "HostListPacket.h"
+#include <cstring>
+#include <sstream>
+
+namespace Mad {
+namespace Net {
+namespace Packets {
+
+void HostListPacket::assemblePacket() {
+ std::ostringstream stream;
+
+ for(std::vector<Common::HostInfo>::iterator host = hostList.begin(); host != hostList.end(); ++host) {
+ stream << host->getName() << std::endl;
+ stream << host->getIP() << std::endl;
+ }
+
+ std::string str = stream.str();
+
+ setLength(sizeof(uint16_t) + sizeof(HostData)*hostList.size() + str.length());
+
+ nHosts = (uint16_t*)rawData->data;
+ hostData = (HostData*)(rawData->data + sizeof(uint16_t));
+ charData = (char*)(rawData->data + sizeof(uint16_t) + sizeof(HostData)*hostList.size());
+
+ std::memcpy(charData, str.c_str(), str.length());
+
+ *nHosts = htons(hostList.size());
+
+ for(size_t i = 0; i < hostList.size(); ++i) {
+ hostData[i].status = htons((uint16_t)hostList[i].getStatus());
+ }
+}
+
+void HostListPacket::parsePacket() {
+ hostList.clear();
+
+ if(getLength() < sizeof(uint16_t))
+ return;
+
+ nHosts = (uint16_t*)rawData->data;
+ hostList.resize(ntohs(*nHosts));
+
+ if(getLength() < sizeof(uint16_t) + sizeof(HostData)*hostList.size())
+ setLength(sizeof(uint16_t) + sizeof(HostData)*hostList.size());
+
+ nHosts = (uint16_t*)rawData->data;
+ hostData = (HostData*)(rawData->data + sizeof(uint16_t));
+ charData = (char*)(rawData->data + sizeof(uint16_t) + sizeof(HostData)*hostList.size());
+
+ std::istringstream stream(std::string(charData, getLength() - (sizeof(uint16_t)+sizeof(HostData)*hostList.size())));
+
+ for(size_t i = 0; i < hostList.size(); ++i) {
+ hostList[i].setStatus((Common::HostInfo::Status)ntohs(hostData[i].status));
+
+ if(!stream.eof()) {
+ std::string str;
+
+ std::getline(stream, str);
+ hostList[i].setName(str);
+ std::getline(stream, str);
+ hostList[i].setIP(str);
+ }
+ }
+}
+
+}
+}
+}
diff --git a/src/Net/Packets/NameListPacket.h b/src/Net/Packets/HostListPacket.h
index 89cc040..aba6461 100644
--- a/src/Net/Packets/NameListPacket.h
+++ b/src/Net/Packets/HostListPacket.h
@@ -1,5 +1,5 @@
/*
- * NameListPacket.h
+ * HostListPacket.h
*
* Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de>
*
@@ -17,44 +17,52 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef MAD_NET_PACKETS_NAMELISTPACKET_H_
-#define MAD_NET_PACKETS_NAMELISTPACKET_H_
+#ifndef MAD_NET_PACKETS_HOSTLISTPACKET_H_
+#define MAD_NET_PACKETS_HOSTLISTPACKET_H_
#include "../Packet.h"
+#include <Common/HostInfo.h>
#include <vector>
-#include <string>
namespace Mad {
namespace Net {
namespace Packets {
-class NameListPacket : public Packet {
+class HostListPacket : public Packet {
protected:
- std::vector<std::string> nameList;
+ struct HostData {
+ uint16_t status;
+ };
+
+ uint16_t *nHosts;
+ HostData *hostData;
+ char *charData;
+
+ std::vector<Common::HostInfo> hostList;
void assemblePacket();
void parsePacket();
public:
- NameListPacket(Type type, uint16_t requestId, const std::vector<std::string> &nameList0) : Packet(type, requestId), nameList(nameList0) {
+ HostListPacket(Type type, uint16_t requestId, const std::vector<Common::HostInfo> &hosts) : Packet(type, requestId), hostList(hosts) {
assemblePacket();
}
- NameListPacket(const Packet &p) : Packet(p) {
+ HostListPacket(const Packet &p) : Packet(p) {
parsePacket();
}
- NameListPacket& operator=(const Packet &p) {
+ HostListPacket& operator=(const Packet &p) {
Packet::operator=(p);
parsePacket();
return *this;
}
- const std::vector<std::string>& getNameList() const {
- return nameList;
+ const std::vector<Common::HostInfo>& getHostInfo() const {
+ return hostList;
}
};
@@ -62,4 +70,4 @@ class NameListPacket : public Packet {
}
}
-#endif /* MAD_NET_PACKETS_NAMELISTPACKET_H_ */
+#endif /* MAD_NET_PACKETS_HOSTLISTPACKET_H_ */
diff --git a/src/Net/Packets/Makefile.am b/src/Net/Packets/Makefile.am
index 4600c96..6402c10 100644
--- a/src/Net/Packets/Makefile.am
+++ b/src/Net/Packets/Makefile.am
@@ -1,4 +1,4 @@
noinst_LTLIBRARIES = libpackets.la
-libpackets_la_SOURCES = ErrorPacket.cpp HostStatusPacket.cpp NameListPacket.cpp
+libpackets_la_SOURCES = ErrorPacket.cpp HostListPacket.cpp HostStatusPacket.cpp
-noinst_HEADERS = ErrorPacket.cpp HostStatusPacket.h NameListPacket.h
+noinst_HEADERS = ErrorPacket.h HostListPacket.h HostStatusPacket.h
diff --git a/src/Net/Packets/Makefile.in b/src/Net/Packets/Makefile.in
index 4553fab..8344b8e 100644
--- a/src/Net/Packets/Makefile.in
+++ b/src/Net/Packets/Makefile.in
@@ -45,8 +45,8 @@ CONFIG_HEADER = $(top_builddir)/src/config.h
CONFIG_CLEAN_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libpackets_la_LIBADD =
-am_libpackets_la_OBJECTS = ErrorPacket.lo HostStatusPacket.lo \
- NameListPacket.lo
+am_libpackets_la_OBJECTS = ErrorPacket.lo HostListPacket.lo \
+ HostStatusPacket.lo
libpackets_la_OBJECTS = $(am_libpackets_la_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -187,8 +187,8 @@ target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
noinst_LTLIBRARIES = libpackets.la
-libpackets_la_SOURCES = ErrorPacket.cpp HostStatusPacket.cpp NameListPacket.cpp
-noinst_HEADERS = ErrorPacket.cpp HostStatusPacket.h NameListPacket.h
+libpackets_la_SOURCES = ErrorPacket.cpp HostListPacket.cpp HostStatusPacket.cpp
+noinst_HEADERS = ErrorPacket.h HostListPacket.h HostStatusPacket.h
all: all-am
.SUFFIXES:
@@ -241,8 +241,8 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ErrorPacket.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HostListPacket.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HostStatusPacket.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NameListPacket.Plo@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
diff --git a/src/Net/Packets/NameListPacket.cpp b/src/Net/Packets/NameListPacket.cpp
deleted file mode 100644
index 19f588a..0000000
--- a/src/Net/Packets/NameListPacket.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * NameListPacket.cpp
- *
- * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de>
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "NameListPacket.h"
-#include <cstring>
-#include <sstream>
-
-namespace Mad {
-namespace Net {
-namespace Packets {
-
-void NameListPacket::assemblePacket() {
- std::ostringstream stream;
-
- for(std::vector<std::string>::iterator name = nameList.begin(); name != nameList.end(); ++name)
- stream << *name << std::endl;
-
- std::string str = stream.str();
-
- setLength(str.length());
- std::memcpy(rawData->data, str.c_str(), str.length());
-}
-
-void NameListPacket::parsePacket() {
- nameList.clear();
-
- std::istringstream stream(std::string((char*)getData(), getLength()));
-
- while(!stream.eof()) {
- std::string str;
- std::getline(stream, str);
-
- if(!str.empty())
- nameList.push_back(str);
- }
-}
-
-}
-}
-}