[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r1909: Remove some code that is no longer used. (in trunk: . src/gui/config src/util)
Author: edmanm
Date: 2007-09-05 23:50:59 -0400 (Wed, 05 Sep 2007)
New Revision: 1909
Removed:
trunk/src/util/http.cpp
trunk/src/util/http.h
Modified:
trunk/
trunk/src/gui/config/serverpage.cpp
trunk/src/util/net.cpp
trunk/src/util/net.h
trunk/src/util/util.pri
Log:
r2126@adrastea: edmanm | 2007-09-04 21:59:51 -0400
Remove some code that is no longer used.
Property changes on: trunk
___________________________________________________________________
svk:merge ticket from /vidalia/local/trunk [r2126] on 54b3572a-7227-0410-958f-53ecd705b71a
Modified: trunk/src/gui/config/serverpage.cpp
===================================================================
--- trunk/src/gui/config/serverpage.cpp 2007-09-06 03:50:39 UTC (rev 1908)
+++ trunk/src/gui/config/serverpage.cpp 2007-09-06 03:50:59 UTC (rev 1909)
@@ -26,9 +26,6 @@
*/
#include <vidalia.h>
-#include <util/net.h>
-#include <util/http.h>
-#include <util/html.h>
#include <gui/common/vmessagebox.h>
#include "serverpage.h"
Deleted: trunk/src/util/http.cpp
Deleted: trunk/src/util/http.h
Modified: trunk/src/util/net.cpp
===================================================================
--- trunk/src/util/net.cpp 2007-09-06 03:50:39 UTC (rev 1908)
+++ trunk/src/util/net.cpp 2007-09-06 03:50:59 UTC (rev 1909)
@@ -26,89 +26,10 @@
*/
#include <QTcpSocket>
-#include <QHostInfo>
-#include <QList>
-#include <QUrl>
#include "net.h"
-#include "http.h"
-/** Returns the IP address of the local machine. */
-QHostAddress
-net_local_address()
-{
- QHostInfo localInfo = QHostInfo::fromName(QHostInfo::localHostName());
- if (localInfo.error() == QHostInfo::NoError) {
- foreach (QHostAddress addr, localInfo.addresses()) {
- if (addr.protocol() == QAbstractSocket::IPv4Protocol &&
- !(addr == QHostAddress::LocalHost)) {
- return addr;
- }
- }
- }
- return QHostAddress::LocalHost;
-}
-
-/** Returns true if the given address is a private IP address. */
-bool
-net_is_private_address(QHostAddress addr)
-{
- quint32 ip = addr.toIPv4Address();
- /* Based on RFC1918 and Tor's util.c */
- return (((ip & 0xFF000000) == 0x00000000) || /* 0/8 */
- ((ip & 0xFF000000) == 0x0A000000) || /* 10/8 */
- ((ip & 0xFF000000) == 0x7F000000) || /* 127/8 */
- ((ip & 0xFFF00000) == 0xAC100000) || /* 172.16/12 */
- ((ip & 0xFFFF0000) == 0xA9FE0000) || /* 169.254/16 */
- ((ip & 0xFFFF0000) == 0xC0A80000)); /* 192.168/16 */
-}
-
-/** Returns true if the given string representation of an IP
- * address is valid. */
-bool
-net_is_valid_ip(QString ip)
-{
- return QHostAddress().setAddress(ip);
-}
-
-/** Returns a pre-defined, static list of servers whom we can ask for our
- * public IP address. */
-QList<QUrl>
-get_check_ip_sites()
-{
- static QList<QUrl> sites;
- if (sites.count() == 0) {
- sites.append(QUrl("http://ipid.shat.net/iponly/"));
- sites.append(QUrl("http://freehaven.net/~edmanm/ip.php"));
- sites.append(QUrl("http://vidalia-project.net/iptest/ip.php"));
- } else {
- sites.append(sites.takeFirst());
- }
- return sites;
-}
-
-/** Asks a pre-defined list of servers what they think this machine's public
- * IP address is.
- * \param ip Stores the ip after a successful request
- * \return false if none of the requests were successful
- */
-bool
-net_get_public_ip(QString &ip)
-{
- QList<QUrl> sites = get_check_ip_sites();
- foreach (QUrl site, sites) {
- Http http(site.host());
- if (http.request(site.path())) {
- if (net_is_valid_ip(http.body())) {
- ip = http.body();
- return true;
- }
- }
- }
- return false;
-}
-
/** Attempts a connection to <b>host</b> on <b>port</b>. Returns true if the
* connection was successful, or false if the connection attempt failed. */
bool
Modified: trunk/src/util/net.h
===================================================================
--- trunk/src/util/net.h 2007-09-06 03:50:39 UTC (rev 1908)
+++ trunk/src/util/net.h 2007-09-06 03:50:59 UTC (rev 1909)
@@ -30,18 +30,6 @@
#include <QHostAddress>
-/** Returns the local machine's IP address. */
-QHostAddress net_local_address();
-
-/** Returns true if the given address is a private IP. */
-bool net_is_private_address(QHostAddress addr);
-
-/** Returns true if the given IP address is a valid IPv4 address. */
-bool net_is_valid_ip(QString ip);
-
-/** Tries to determine this machine's external IP. */
-bool net_get_public_ip(QString &ip);
-
/** Attempts a connection to <b>host</b> on <b>port</b>. Returns true if the
* connection was successful, or false if the connection attempt failed. */
bool net_test_connect(QHostAddress host, quint16 port, int timeout = 250);
Modified: trunk/src/util/util.pri
===================================================================
--- trunk/src/util/util.pri 2007-09-06 03:50:39 UTC (rev 1908)
+++ trunk/src/util/util.pri 2007-09-06 03:50:59 UTC (rev 1909)
@@ -22,7 +22,6 @@
#################################################################
HEADERS += $$PWD/net.h \
- $$PWD/http.h \
$$PWD/string.h \
$$PWD/torsocket.h \
$$PWD/html.h \
@@ -33,7 +32,6 @@
$$PWD/crypto.h
SOURCES += $$PWD/net.cpp \
- $$PWD/http.cpp \
$$PWD/string.cpp \
$$PWD/torsocket.cpp \
$$PWD/html.cpp \