Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

SummaryScreenCommand.cpp

Go to the documentation of this file.
00001 #include "headers.h"
00002 
00003 const string SummaryScreenCommand::commandString = "summaryScreen";
00004 
00005 string
00006 SummaryScreenCommand::getCommandString() {
00007     return commandString;
00008 }
00009 
00010 
00014 void
00015 SummaryScreenCommand::getHtmlInterface(std::ostream& s) {
00016     UserConfiguration::pageHeading(s);
00017 
00018     s << "<h2>Summary Screen</h2>\n\n";
00019 
00020     Node* node = GlobalObjects::instance()->getConfig()->getSelf()->getNode();
00021     SocketAddress* tmpSocketAddress = node->getSocketAddress();
00022     IpAddress tmpIpAddress = tmpSocketAddress->getIpAddress();
00023 
00024     s << "<h3>Your Computer</h3>\n";
00025     s   << "  IP Address: " << tmpIpAddress << "\n" 
00026         << "  Port: " << tmpSocketAddress->getPort() << "\n";
00027     s << "    * Your computer is ";
00028     if (!node->isNatted()) {
00029         s << "NOT ";
00030     }
00031     s << "behind a Network Address Translation device (NAT)\n";
00032     s << "    * Your computer is ";
00033     if (!node->isFirewalled()) {
00034         s << "NOT ";
00035     }
00036     s << "censored\n";
00037     s << "\n\n";
00038 
00039 
00040     s << "<h3>Your Options</h3>\n";
00041     s << "  * Fast Routing is ";
00042     if (GlobalObjects::instance()->getConfig()->doFastRouting()) {
00043         s << "enabled.\n";
00044     }
00045     else {
00046         s << "disabled.\n";
00047     }
00048 
00049     if (GlobalObjects::instance()->getConfig()->avoidCensoredNodes()) {
00050         s << "  * Avoiding censored nodes\n";
00051     }
00052     else {
00053         s << "  * Routing through all node types\n";
00054     }
00055     s << "\n\n";
00056 
00057 
00058     s << "<h3>Network</h3>\n";
00059     LinkLayerInterface* lli = GlobalObjects::instance()->getNetworkLayer()->getLli();
00060     int numConnections = lli->getNumConnections();
00061     s << "  Number of connections: " << numConnections << "\n";
00062     int numKnownNodes = GlobalObjects::instance()->getCatcher()->getNumberOfNodes();
00063     s << "  Number of known nodes: " << numKnownNodes << "\n";
00064 
00065     /*
00066     if (numConnections == 0) {
00067         s << "None.\n";
00068     }
00069     else {
00070         Node node;
00071         for (int i = 0; i < numConnections; ++i) {
00072             if (lli->getConnection(i, &node)) {
00073                 s << node.getSocketAddress()->getIpAddress() << "\n";
00074             }
00075         }
00076     }
00077     */
00078 } // fn getHtmlInterface
00079 
00080 
00081 void
00082 SummaryScreenCommand::run(std::ostream& s) {
00083     getHtmlInterface(s);
00084 }
00085 
00086 

Generated at Thu Jul 11 13:31:52 2002 for Peekabooty by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001