Revision 1.17 |
Revision 1.23 |
Line 24 |
Line 24 |
//! noticed immediately during the call to select in FountainSocketHandlers::CheckConnections. class FountainWireProt { public: 
|
//! noticed immediately during the call to select in FountainSocketHandlers::CheckConnections. class FountainWireProt { public: 
|
//! \brief default constructor
//! Creates an unconnected wire protocol handler
//! \bug hack for temporary SSS_Protocols enum, get the real thing from FountainNOde::DEFAULT_NODE_PROTOCOL somehow
FountainWireProt(SSSWireProt* connection=NULL, SSS_Protocols prot=HTTP);
|
//! \brief Server socket constructor
//! Creates a connected wire protocol handler using the SSS wire protocol handler
//! @param connection A SSSWireProtocol connection already in place
FountainWireProt(SSSWireProt* connection);
|
|
//! \brief Client socket constructor
//! Created an unconnected wire protocol handler ready to connect
//! @param prot The SSS wire protocol to use
FountainWireProt(SSS_Protocols prot);
|
//! \brief Destructor that will close the socket and remove the file descriptor from our vector of clientSockets ~FountainWireProt(); //! \brief Connects to the specified host and port
|
//! \brief Destructor that will close the socket and remove the file descriptor from our vector of clientSockets ~FountainWireProt(); //! \brief Connects to the specified host and port
|
//! @param Host - The hostname to connect to
|
//! @param node The NodeID of the host to connect to
|
//! @param Port - The port on to connect to
//! @return SUCCESS if the connection was successful, or FAILURE if it was not
int connect(const char* Host, int Port);
//! \brief Same as the c-string equivalent function above
int connect(const string& Host, int Port);
//! \brief Same as calling connect(hostname, listenPort)
|
|
int connect(const NodeID& node); //! \brief Blocking send
|
int connect(const NodeID& node); //! \brief Blocking send
|
Line 52 |
Line 49 |
//! \brief Blocking receive //! @return A pointer to a ParseMsg object containing the received message FountainParseMessage* recvMessage();
|
//! \brief Blocking receive //! @return A pointer to a ParseMsg object containing the received message FountainParseMessage* recvMessage();
|
|
//! \brief Blocking receive
//! @return A pointer to a c-string array containing the received message
const char* recvMessage(int& length);
|
//! \brief Send a text message on the socket //! @return SUCCESS if sending the message was successful
|
//! \brief Send a text message on the socket //! @return SUCCESS if sending the message was successful
|
Line 67 |
Line 68 |
//! @param sleepTime The time in seconds to wait for data on this connection int CheckForData(int sleepTime=0);
|
//! @param sleepTime The time in seconds to wait for data on this connection int CheckForData(int sleepTime=0);
|
|
//! @return get the hostname of the host this object is connected to
const std::string& getHostname() const { return _hostname; };
|
//! The FountainSocketHandlers class needs to be a friend class so it //! has access to our static private sockets vector friend class FountainSocketHandlers; private:
|
//! The FountainSocketHandlers class needs to be a friend class so it //! has access to our static private sockets vector friend class FountainSocketHandlers; private:
|
//! \enum FountainWireProtState
|
//! \enum FountainWireProtType
|
|
//! \brief Enumerated types to define client or server sockets
|
enum FountainWireProtType {
|
enum FountainWireProtType {
|
invalid=0,
|
invalidType=0,
|
ClientSocket, ServerSocket,
|
ClientSocket, ServerSocket,
|
|
numFountainWireProtTypes
};
//! \enum FountainWireProtState
//! \brief Enumerated types to define the state of a FountainWireProt object
enum FountainWireProtState {
invalidState=0,
notConnected,
connected,
|
numFountainWireProtStates };
|
numFountainWireProtStates };
|
Line 89 |
Line 103 |
//! \brief This function is called by the FountainWireProt destructor void removeSocket();
|
//! \brief This function is called by the FountainWireProt destructor void removeSocket();
|
|
//! \brief Looks up a hostname of a connected socket using the getpeername system call
void lookupHostname() throw(FountainException);
|
//! \brief Convert a FountainWireProtType enumeration into a c-string static const char* fountain_convert(FountainWireProtType t);
|
//! \brief Convert a FountainWireProtType enumeration into a c-string static const char* fountain_convert(FountainWireProtType t);
|
|
|
|
//! \brief Convert a FountainWireProtState enumeration into a c-string
static const char* fountain_convert(FountainWireProtState t);
|
//! enumerated value to determine if we're a server or client socket FountainWireProtType socketType;
|
//! enumerated value to determine if we're a server or client socket FountainWireProtType socketType;
|
|
//! enumerated value to determine our state
FountainWireProtState state;
|
//! The SSSWireProt handler for each FountainWireProt object SSSWireProt* _connection;
|
//! The SSSWireProt handler for each FountainWireProt object SSSWireProt* _connection;
|
|
//! The hostname of the host this FountainWireProt object is connected to
std::string _hostname;
|
//! Vector of file descriptors for our existing open client sockets. Both this vector and the serverSockets vector //! are static since they contain values needed by the FountainSocketHandlers class during it's system call
|
//! Vector of file descriptors for our existing open client sockets. Both this vector and the serverSockets vector //! are static since they contain values needed by the FountainSocketHandlers class during it's system call
|
Line 113 |
Line 139 |
#endif
|
#endif
|