CVS diff for FountainMessage.h between 1.47 and 1.39:

Revision 1.39 Revision 1.47
Line 14 Line 14
#include "define.h" 
#include "NodeInfo.h" 
#include "FountainErrors.h" 
#include "define.h" 
#include "NodeInfo.h" 
#include "FountainErrors.h" 
   
#include "NodeID.h"
 

                         
//forward class declarations 
class FountainParseMessage; 
 
//forward class declarations 
class FountainParseMessage; 
 
Line 41 Line 42
		enum MessageAction { 
invalidAction=0, 
join, 
		enum MessageAction { 
invalidAction=0, 
join, 
			joinAccept,
			joinReject,
			joinAck, 
 
			newParent, 
syncMsg,
			newParent, 
syncMsg,
			rebuildMsg, 
 
			pulseMsg, 
admin, 
pingPong, 
			pulseMsg, 
admin, 
pingPong, 
Line 69 Line 66
		//! \brief Pure virtual destructor so FountainMessage objects cannot be instantiated directly 
virtual ~FountainMessage() = 0; 
 
		//! \brief Pure virtual destructor so FountainMessage objects cannot be instantiated directly 
virtual ~FountainMessage() = 0; 
 
        //! This function adds Status, Code, and Message elements to a FountainMessage
        //! \brief This method adds Status, Code, and Message elements to a FountainMessage using the given parameters 
        //! using the given parameters
 
        //! @param status - true or false f the request was processed with or without errors 
//! @param code - an integer error code specifying what caused the error 
//! @param msg - a c-string specifying the optional Message element of the Status element
        //! @param status - true or false f the request was processed with or without errors 
//! @param code - an integer error code specifying what caused the error 
//! @param msg - a c-string specifying the optional Message element of the Status element
        void buildStandardError(bool status=true, int code=generalSuccess, const char* msg=NULL); 
        void buildStandardError(bool status=true, FountainErrorCode code=generalSuccess, const char* msg=NULL); 
		
		
		//! Same as the c-string equivalent method above
		void buildStandardError(bool status, int code, const std::string& msg) { buildStandardError(status, code, msg.c_str());	}; 
		//! \brief Same as the c-string equivalent method above
		void buildStandardError(bool status, FountainErrorCode code, const std::string& msg) { buildStandardError(status, code, msg.c_str());	}; 
 
//! @return a pointer to the Data element of the message 
XMLElement* getDataElement() const { return dataElement; };
 
//! @return a pointer to the Data element of the message 
XMLElement* getDataElement() const { return dataElement; };
		
		//! @return true if a Status element has been created for this message
		bool hasStatusElement() { return _statusElement != NULL; }; 
 
		 
static const char* fountain_convert(FountainMessage::MessageType t); 
static const char* fountain_convert(FountainMessage::MessageAction m); 
		 
static const char* fountain_convert(FountainMessage::MessageType t); 
static const char* fountain_convert(FountainMessage::MessageAction m); 
Line 104 Line 97
 
//! Private assignment operator so the compiler does not attempt to generate one 
const FountainMessage& operator=(const FountainMessage& rhs); 
 
//! Private assignment operator so the compiler does not attempt to generate one 
const FountainMessage& operator=(const FountainMessage& rhs); 
		
		//! Status XML element
		XMLElement* _statusElement; 
 
         
};  
 
         
};  
 
Line 115 Line 105
class ClientRequest : public FountainMessage { 
public: 
ClientRequest(MessageAction a, SSS_Object_type o); 
class ClientRequest : public FountainMessage { 
public: 
ClientRequest(MessageAction a, SSS_Object_type o); 
        void buildPingPong(); 
        void buildPingPong(const string& numPingPongs, bool useXML);
 
		void buildBomb(const string& bombString);
}; 
 
//! \class ServerMessage 
}; 
 
//! \class ServerMessage 
Line 130 Line 121
		//! @param a the MessageAction 
ServerMessage(MessageType t, MessageAction a); 
 
		//! @param a the MessageAction 
ServerMessage(MessageType t, MessageAction a); 
 
		//! Builds a bomb response message for a client or a bomb request for the Fountain nodes
		//! @param nodeMessage The bomb response message from the master Fountain node
        int buildBomb(const ParseMsg* nodeMessage);
		
		//! Builds a trace response message for a client or a trace request for the Fountain nodes
		//! @param nodeMessage The trace response message from the master Fountain node
        int buildTrace(const ParseMsg* nodeMessage);
		
		//! Builds a pingPong response message for a client or a pingPong request for the Fountain nodes
		//! @param nodeMessage The pingPong response message from the master Fountain node
        int buildPingPong(const ParseMsg* nodeMessage);
		 
 
		//! \brief virtual dtor so ServerMessage objects cannot be instantiated directly 
virtual ~ServerMessage() = 0; 
}; 
		//! \brief virtual dtor so ServerMessage objects cannot be instantiated directly 
virtual ~ServerMessage() = 0; 
}; 
Line 149 Line 128
//! \class ServerRequest 
//! \brief Used for request messages sent from the Fountain server 
class ServerRequest : public ServerMessage { 
//! \class ServerRequest 
//! \brief Used for request messages sent from the Fountain server 
class ServerRequest : public ServerMessage { 
 
	private:
        XMLElement* sourceElement;
        XMLElement* destinationElement; 
    public:
    public:
        ServerRequest(MessageAction a); 
		//! \brief Default constructor
 
        ServerRequest(MessageAction a, const string& src = string("NO SOURCE ID"), const string& dest = string("NO DESTINATION ID"));
		
		//! Builds a pingPong response message for a client or a pingPong request for the Fountain nodes
		//! @param clientRequest The pingPong request message from the client
		//! \throw FountainException if the message could not be created
        void buildPingPong(const ParseMsg* clientRequest) throw(FountainException);
		
		//! Builds a bomb response message for a client or a bomb request for the Fountain nodes
		//! @param clientRequest The bomb request message from client
		//! \throw FountainException if the message could not be created
        void buildBomb(const ParseMsg* clientRequest) throw(FountainException);
}; 
 
//! \class ServerResponse 
//! \brief Used for response messages sent from the Fountain server 
class ServerResponse : public ServerMessage { 
public:
}; 
 
//! \class ServerResponse 
//! \brief Used for response messages sent from the Fountain server 
class ServerResponse : public ServerMessage { 
public:
 
		//! \brief Default constructor 
        ServerResponse(MessageAction a);
        ServerResponse(MessageAction a);
 
	
		//! \brief Builds a trace response message for a client or a trace request for the Fountain nodes
		//! @param nodeResponse The trace response message from the master Fountain node
		//! \throw FountainException if the message could not be created
		void buildTrace(const FountainParseMessage* nodeResponse) throw(FountainException);
		
		//! Builds a bomb response message for a client or a bomb request for the Fountain nodes
		//! @param nodeResponse The bomb response message from the master Fountain node
		//! \throw FountainException if the message could not be created
        void buildBomb(const FountainParseMessage* nodeResponse) throw(FountainException);
		
		//! Builds a pingPong response message for a client or a pingPong request for the Fountain nodes
		//! @param nodeResponse The pingPong response message from the master Fountain node
		//! \throw FountainException if the message could not be created
        void buildPingPong(const FountainParseMessage* nodeResponse) throw(FountainException);
	 
}; 
 
//! \class NodeMessage 
//! \brief Abstract base class for messages sent to and from Fountain nodes 
class NodeMessage : public FountainMessage {
}; 
 
//! \class NodeMessage 
//! \brief Abstract base class for messages sent to and from Fountain nodes 
class NodeMessage : public FountainMessage {
    private:
    	string sourceID;
    	string destinationID;
    protected:
    	std::string sourceID;
    	std::string destinationID; 
        XMLElement* sourceElement;
        XMLElement* destinationElement;
        XMLElement* serverElement;
 
		XMLElement* nodeListElement; 
public: 
//! Constructor 
		XMLElement* nodeListElement; 
public: 
//! Constructor 
Line 176 Line 183
		//! @param a The MessageAction enum for this message 
//! @param src The NodeID of the Fountain node creating this message 
//! @param dest The NodeID of the Fountain node this message is destined to 
		//! @param a The MessageAction enum for this message 
//! @param src The NodeID of the Fountain node creating this message 
//! @param dest The NodeID of the Fountain node this message is destined to 
        NodeMessage(MessageType t, MessageAction a, const string& src, const string& dest) throw(FountainException); 
		NodeMessage(MessageType t, MessageAction a, const NodeID& src, const NodeID& dest) throw(FountainException); 
		 
//! \brief virtual dtor so clients cannot instantiate NodeMessage objects 
virtual ~NodeMessage() = 0;
		 
//! \brief virtual dtor so clients cannot instantiate NodeMessage objects 
virtual ~NodeMessage() = 0;
 
};

//! \class NodeRequest
//! \brief Used for request messages sent from a Fountain node
class NodeRequest : public NodeMessage {
    public:
		//! \brief Default constructor
		//! @param a The MessageAction enum for this message
		//! @param src The NodeID of the Fountain node creating this message
		//! @param dest The NodeID of the Fountain node this message is destined to
        NodeRequest(MessageAction a, const NodeID& src = NodeID(), const NodeID& dest = NodeID());

		//! @param versionNumberString The version number of a Fountain Node
		//! \throw FountainException if the message could not be created
		void buildJoin(const std::string& versionNumberString) throw(FountainException);
};

//! \class NodeResponse
//! \brief Used for response messages sent from a Fountain node
class NodeResponse : public NodeMessage {
    public:
		//! \brief Default constructor
        NodeResponse(MessageAction a, const NodeID& src = NodeID(), const NodeID& dest = NodeID());
	
		//! \brief build a trace response message
		//! @param parentID the NodeID of a Fountain node's parent node
		//! \throw FountainException if the message could not be created
		void buildTrace(const std::string& parentID) throw(FountainException);
		
		//! @param parentMessage The bomb message from our parent node
		//! @return SUCCESS if building the message was successful and this node should not exit
		//! @return FAILURE if building the message was unsuccessful and this node should not exit
		//! @return bomb if this node should exit
		//! \throw FountainException if the message could not be created
        int buildBomb(const FountainParseMessage* parentMessage) throw(FountainException);
		
		//! @param parentMessage The admin message from our parent node
		//! \throw FountainException if the message could not be created
        void buildAdmin(const FountainParseMessage* parentMessage) throw(FountainException);
		
		//! @param nodeInfo The NodeInfo object from a Fountain node
		//! \throw FountainException if the message could not be created
        void buildQuery(NodeInfo& nodeInfo) throw(FountainException);
		
		//! @param parentID The parentID of the Fountain node accepting the join request
		//! \throw FountainException if the message could not be created
        void buildJoinAccept(const std::string& parentID) throw(FountainException); 
		 
//! @param avgPingPongTimes A vector with a length equal to the number of child nodes containing the average time it takes to send n number of pingPong messages to each child 
//! @param maxPingPongTimes A vector with a length equal to the number of child nodes containing the maximum time it takes to send n number of pingPong messages to each child 
//! @param minPingPongTimes A vector with a length equal to the number of child nodes containing the minimum time it takes to send n number of pingPong messages to each child 
//! @param children A vector of strings representing a Fountain node's child nodes
		 
//! @param avgPingPongTimes A vector with a length equal to the number of child nodes containing the average time it takes to send n number of pingPong messages to each child 
//! @param maxPingPongTimes A vector with a length equal to the number of child nodes containing the maximum time it takes to send n number of pingPong messages to each child 
//! @param minPingPongTimes A vector with a length equal to the number of child nodes containing the minimum time it takes to send n number of pingPong messages to each child 
//! @param children A vector of strings representing a Fountain node's child nodes
		//! @return SUCCESS if building the message was successful
		//! \throw FountainException if the message could not be created 
		//! @return FAILURE if building the message was unsuccessful
 
        void buildPingPong(std::vector<double> avgPingPongTimes, std::vector<double> maxPingPongTimes, std::vector<double> minPingPongTimes, std::vector<std::string> children) throw(FountainException);
        void buildPingPong(std::vector<double> avgPingPongTimes, std::vector<double> maxPingPongTimes, std::vector<double> minPingPongTimes, std::vector<std::string> children) throw(FountainException);
		
		//! @param parentID the NodeID of a Fountain node's parent node
		//! @return SUCCESS if building the message was successful
		//! @return FAILURE if building the message was unsuccessful
        void buildTrace(const std::string& parentID) throw(FountainException);
		
		//! @param versionNumberString The version number of a Fountain Node
		//! @return SUCCESS if building the message was successful
		//! @return FAILURE if building the message was unsuccessful
        void buildJoin(const string& versionNumberString) throw(FountainException);
		
		//! @param parentMessage The bomb message from our parent node
		//! @return SUCCESS if building the message was successful
		//! @return FAILURE if building the message was unsuccessful
        int buildBomb(const ParseMsg* parentMessage);
		
		//! @param nodeInfo The NodeInfo object from a Fountain node
		//! @return SUCCESS if building the message was successful
		//! @return FAILURE if building the message was unsuccessful
        void buildQuery(NodeInfo& nodeInfo) throw(FountainException);
		
		//! @param parentID The parentID of the Fountain node accepting the join request
		//! @return SUCCESS if building the message was successful
		//! @return FAILURE if building the message was unsuccessful
        int buildJoinAccept(const string& parentID=string("")); 
 
		 
//! Appends a NodeList element from the msg parameter to this message's NodeList parameter 
//! @return true if the NodeList was appended successfully 
//! @return false if the NodeList element was not found in the msg parameter, or if the NodeList element for this message has not been created yet. 
//! param msg - A message containing a NodeList element as a child of the Data element 
bool appendToNodeList(const FountainParseMessage* msg);
		 
//! Appends a NodeList element from the msg parameter to this message's NodeList parameter 
//! @return true if the NodeList was appended successfully 
//! @return false if the NodeList element was not found in the msg parameter, or if the NodeList element for this message has not been created yet. 
//! param msg - A message containing a NodeList element as a child of the Data element 
bool appendToNodeList(const FountainParseMessage* msg);
 
 
}; 
}; 
//! \class NodeRequest
//! \class FountainParseMessage 
//! \brief Used for request messages sent from a Fountain node
class NodeRequest : public NodeMessage {
    public:
        NodeRequest(MessageAction a, const string& src = string("NO SOURCE ID"), const string& dest = string("NO DESTINATION ID"));
};

//! \class NodeResponse
//! \brief Used for response messages sent from a Fountain node
class NodeResponse : public NodeMessage {
    public:
        NodeResponse(MessageAction a, const string& src = string("NO SOURCE ID"), const string& dest = string("NO DESTINATION ID"));
};

//! \class FountainPasreMessage
 
//! \brief simple wrapper class around the bamboo library ParseMsg class 
class FountainParseMessage : public ParseMsg { 
public: 
//! \brief simple wrapper class around the bamboo library ParseMsg class 
class FountainParseMessage : public ParseMsg { 
public: 
Line 268 Line 281
#endif 
 
 
#endif 
 
 


Legend
Lines deleted from 1.47  
Lines Modified
  Lines added in revision 1.39