From 3a3751f02a3efdc079c3f79987da59b234813f16 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 12 Sep 2008 21:43:42 +0200 Subject: Schreibe Pakettypen ohne TYPE_ --- src/Common/Request/CoreStatusRequest.h | 4 ++-- src/Common/Request/DisconnectRequest.h | 4 ++-- src/Common/Request/GSSAPIAuthRequest.h | 8 ++++---- src/Common/Request/IdentifyRequest.h | 4 ++-- src/Common/RequestManager.cpp | 8 ++++---- src/Core/ConnectionManager.cpp | 4 ++-- src/Core/RequestHandler/CoreStatusRequestHandler.h | 4 ++-- src/Core/RequestHandler/GSSAPIAuthRequestHandler.h | 6 +++--- src/Net/Packet.h | 6 +++--- 9 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/Common/Request/CoreStatusRequest.h b/src/Common/Request/CoreStatusRequest.h index cd28cc2..fb16675 100644 --- a/src/Common/Request/CoreStatusRequest.h +++ b/src/Common/Request/CoreStatusRequest.h @@ -54,7 +54,7 @@ class CoreStatusRequest: public Request { if(isSent()) return false; - if(!connection->send(Net::Packet(Net::Packet::TYPE_CORE_STATUS, requestId))) + if(!connection->send(Net::Packet(Net::Packet::CORE_STATUS, requestId))) return false; setSent(); @@ -65,7 +65,7 @@ class CoreStatusRequest: public Request { if(isFinished()) return false; - if(packet.getType() != Net::Packet::TYPE_OK) + if(packet.getType() != Net::Packet::OK) return false; // TODO Logging finished(Net::Packets::CoreStatusPacket(packet)); diff --git a/src/Common/Request/DisconnectRequest.h b/src/Common/Request/DisconnectRequest.h index 3f6e018..1b2d467 100644 --- a/src/Common/Request/DisconnectRequest.h +++ b/src/Common/Request/DisconnectRequest.h @@ -54,7 +54,7 @@ class DisconnectRequest: public Request { if(isSent()) return false; - if(!connection->send(Net::Packet(Net::Packet::TYPE_DISCONNECT, requestId))) + if(!connection->send(Net::Packet(Net::Packet::DISCONNECT, requestId))) return false; setSent(); @@ -65,7 +65,7 @@ class DisconnectRequest: public Request { if(isFinished()) return false; - if(packet.getType() != Net::Packet::TYPE_OK) + if(packet.getType() != Net::Packet::OK) return false; // TODO Logging connection->disconnect(); diff --git a/src/Common/Request/GSSAPIAuthRequest.h b/src/Common/Request/GSSAPIAuthRequest.h index ff92755..6882f36 100644 --- a/src/Common/Request/GSSAPIAuthRequest.h +++ b/src/Common/Request/GSSAPIAuthRequest.h @@ -97,7 +97,7 @@ class GSSAPIAuthRequest : public Request { return false; } - if(!connection->send(Net::Packet(Net::Packet::TYPE_GSSAPI_AUTH, requestId, buffer.value, buffer.length))) { + if(!connection->send(Net::Packet(Net::Packet::GSSAPI_AUTH, requestId, buffer.value, buffer.length))) { gss_release_buffer(&minStat, &buffer); return false; } @@ -112,7 +112,7 @@ class GSSAPIAuthRequest : public Request { if(isFinished()) return false; - if(packet.getType() != Net::Packet::TYPE_GSSAPI_AUTH) + if(packet.getType() != Net::Packet::GSSAPI_AUTH) return false; // TODO Logging OM_uint32 majStat, minStat; @@ -137,7 +137,7 @@ class GSSAPIAuthRequest : public Request { return false; } - if(!connection->send(Net::Packet(Net::Packet::TYPE_GSSAPI_AUTH, packet.getRequestId(), sendBuffer.value, sendBuffer.length))) { + if(!connection->send(Net::Packet(Net::Packet::GSSAPI_AUTH, packet.getRequestId(), sendBuffer.value, sendBuffer.length))) { gss_release_buffer(&minStat, &sendBuffer); return false; } @@ -171,7 +171,7 @@ class GSSAPIAuthRequest : public Request { return false; } - if(!connection->send(Net::Packet(Net::Packet::TYPE_GSSAPI_AUTH, packet.getRequestId(), sendBuffer.value, sendBuffer.length))) { + if(!connection->send(Net::Packet(Net::Packet::GSSAPI_AUTH, packet.getRequestId(), sendBuffer.value, sendBuffer.length))) { gss_release_buffer(&minStat, &sendBuffer); return false; } diff --git a/src/Common/Request/IdentifyRequest.h b/src/Common/Request/IdentifyRequest.h index dfb6ce6..e7b9d21 100644 --- a/src/Common/Request/IdentifyRequest.h +++ b/src/Common/Request/IdentifyRequest.h @@ -53,7 +53,7 @@ class IdentifyRequest: public Request { if(isSent()) return false; - if(!connection->send(Net::Packet(Net::Packet::TYPE_IDENTIFY, requestId, hostname.c_str(), hostname.length()))) + if(!connection->send(Net::Packet(Net::Packet::IDENTIFY, requestId, hostname.c_str(), hostname.length()))) return false; setSent(); @@ -64,7 +64,7 @@ class IdentifyRequest: public Request { if(isFinished()) return false; - if(packet.getType() != Net::Packet::TYPE_IDENTIFY) + if(packet.getType() != Net::Packet::IDENTIFY) return false; // TODO Logging std::cout << "Identified as '" << hostname << "'." << std::endl; diff --git a/src/Common/RequestManager.cpp b/src/Common/RequestManager.cpp index c9761d2..f8d5450 100644 --- a/src/Common/RequestManager.cpp +++ b/src/Common/RequestManager.cpp @@ -62,14 +62,14 @@ void RequestManager::receiveHandler(Net::Connection *connection, const Net::Pack switch(packet.getType()) { - case Net::Packet::TYPE_DISCONNECT: - connection->send(Net::Packet(Net::Packet::TYPE_OK, packet.getRequestId())); + case Net::Packet::DISCONNECT: + connection->send(Net::Packet(Net::Packet::OK, packet.getRequestId())); connection->disconnect(); break; - case Net::Packet::TYPE_IDENTIFY: + case Net::Packet::IDENTIFY: std::cout << "Received identify request from '" << std::string((char*)packet.getData(), packet.getLength()) << "'." << std::endl; - connection->send(Net::Packet(Net::Packet::TYPE_IDENTIFY, packet.getRequestId(), packet.getData(), packet.getLength())); + connection->send(Net::Packet(Net::Packet::IDENTIFY, packet.getRequestId(), packet.getData(), packet.getLength())); break; default: std::cerr << "Received an unexpected packet." << std::endl; diff --git a/src/Core/ConnectionManager.cpp b/src/Core/ConnectionManager.cpp index e953fce..39c6705 100644 --- a/src/Core/ConnectionManager.cpp +++ b/src/Core/ConnectionManager.cpp @@ -54,8 +54,8 @@ void ConnectionManager::refreshPollfds() { } ConnectionManager::ConnectionManager(const ConfigManager& configManager) : requestManager(true) { - requestManager.registerPacketType(Net::Packet::TYPE_CORE_STATUS); - requestManager.registerPacketType(Net::Packet::TYPE_GSSAPI_AUTH); + requestManager.registerPacketType(Net::Packet::CORE_STATUS); + requestManager.registerPacketType(Net::Packet::GSSAPI_AUTH); const std::vector &listenerAddresses = configManager.getListenerAddresses(); diff --git a/src/Core/RequestHandler/CoreStatusRequestHandler.h b/src/Core/RequestHandler/CoreStatusRequestHandler.h index ec94bb5..3cfa947 100644 --- a/src/Core/RequestHandler/CoreStatusRequestHandler.h +++ b/src/Core/RequestHandler/CoreStatusRequestHandler.h @@ -41,7 +41,7 @@ class CoreStatusRequestHandler : public Common::RequestHandler { if(isFinished()) return false; - if(packet.getType() != Net::Packet::TYPE_CORE_STATUS) + if(packet.getType() != Net::Packet::CORE_STATUS) return false; // TODO Logging // TODO Require authentication @@ -49,7 +49,7 @@ class CoreStatusRequestHandler : public Common::RequestHandler { Common::SystemBackend::UptimeInfo uptimeInfo = Common::SystemBackend::getBackend()->getUptimeInfo(); Common::SystemBackend::MemoryInfo memInfo = Common::SystemBackend::getBackend()->getMemoryInfo(); - if(!connection->send(Net::Packets::CoreStatusPacket(Net::Packet::TYPE_OK, packet.getRequestId(), uptimeInfo.uptime, uptimeInfo.idleTime, + if(!connection->send(Net::Packets::CoreStatusPacket(Net::Packet::OK, packet.getRequestId(), uptimeInfo.uptime, uptimeInfo.idleTime, memInfo.totalMem, memInfo.freeMem, memInfo.totalSwap, memInfo.freeSwap))) return false; diff --git a/src/Core/RequestHandler/GSSAPIAuthRequestHandler.h b/src/Core/RequestHandler/GSSAPIAuthRequestHandler.h index 47538a4..8713db7 100644 --- a/src/Core/RequestHandler/GSSAPIAuthRequestHandler.h +++ b/src/Core/RequestHandler/GSSAPIAuthRequestHandler.h @@ -46,7 +46,7 @@ class GSSAPIAuthRequestHandler : public Common::RequestHandler { if(isFinished()) return false; - if(packet.getType() != Net::Packet::TYPE_GSSAPI_AUTH) + if(packet.getType() != Net::Packet::GSSAPI_AUTH) return false; // TODO Logging OM_uint32 majStat, minStat; @@ -70,7 +70,7 @@ class GSSAPIAuthRequestHandler : public Common::RequestHandler { return false; } - if(!connection->send(Net::Packet(Net::Packet::TYPE_GSSAPI_AUTH, packet.getRequestId(), sendBuffer.value, sendBuffer.length))) { + if(!connection->send(Net::Packet(Net::Packet::GSSAPI_AUTH, packet.getRequestId(), sendBuffer.value, sendBuffer.length))) { gss_release_buffer(&minStat, &sendBuffer); return false; } @@ -93,7 +93,7 @@ class GSSAPIAuthRequestHandler : public Common::RequestHandler { return false; } - if(!connection->send(Net::Packet(Net::Packet::TYPE_GSSAPI_AUTH, packet.getRequestId(), sendBuffer.value, sendBuffer.length))) { + if(!connection->send(Net::Packet(Net::Packet::GSSAPI_AUTH, packet.getRequestId(), sendBuffer.value, sendBuffer.length))) { gss_release_buffer(&minStat, &sendBuffer); return false; } diff --git a/src/Net/Packet.h b/src/Net/Packet.h index e64f37b..7823e01 100644 --- a/src/Net/Packet.h +++ b/src/Net/Packet.h @@ -31,9 +31,9 @@ namespace Net { class Packet { public: enum Type { - TYPE_OK = 0x0000, TYPE_ERROR = 0x0001, TYPE_DISCONNECT = 0x0002, - TYPE_GSSAPI_AUTH = 0x0010, TYPE_IDENTIFY = 0x0011, - TYPE_CORE_STATUS = 0x0020 + OK = 0x0000, ERROR = 0x0001, DISCONNECT = 0x0002, + GSSAPI_AUTH = 0x0010, IDENTIFY = 0x0011, + CORE_STATUS = 0x0020 }; struct Data { -- cgit v1.2.3