[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r17559: {puppetor} Rename de.uniba.wiai.lspi.puppetor to org.torproject.puppeto (in puppetor/trunk/src: . org org/torproject org/torproject/puppetor org/torproject/puppetor/examples org/torproject/puppetor/impl)
Author: kloesing
Date: 2008-12-10 11:05:40 -0500 (Wed, 10 Dec 2008)
New Revision: 17559
Added:
puppetor/trunk/src/org/
puppetor/trunk/src/org/torproject/
puppetor/trunk/src/org/torproject/puppetor/
puppetor/trunk/src/org/torproject/puppetor/ClientApplication.java
puppetor/trunk/src/org/torproject/puppetor/ClientEventType.java
puppetor/trunk/src/org/torproject/puppetor/DirectoryNode.java
puppetor/trunk/src/org/torproject/puppetor/Event.java
puppetor/trunk/src/org/torproject/puppetor/EventListener.java
puppetor/trunk/src/org/torproject/puppetor/EventManager.java
puppetor/trunk/src/org/torproject/puppetor/EventType.java
puppetor/trunk/src/org/torproject/puppetor/HiddenService.java
puppetor/trunk/src/org/torproject/puppetor/HiddenServiceEventType.java
puppetor/trunk/src/org/torproject/puppetor/Network.java
puppetor/trunk/src/org/torproject/puppetor/NetworkFactory.java
puppetor/trunk/src/org/torproject/puppetor/NodeEventType.java
puppetor/trunk/src/org/torproject/puppetor/NodeState.java
puppetor/trunk/src/org/torproject/puppetor/ProxyNode.java
puppetor/trunk/src/org/torproject/puppetor/PuppeTorException.java
puppetor/trunk/src/org/torproject/puppetor/RouterNode.java
puppetor/trunk/src/org/torproject/puppetor/ServerApplication.java
puppetor/trunk/src/org/torproject/puppetor/ServerEventType.java
puppetor/trunk/src/org/torproject/puppetor/examples/
puppetor/trunk/src/org/torproject/puppetor/impl/
Removed:
puppetor/trunk/src/de/
Modified:
puppetor/trunk/src/org/torproject/puppetor/examples/AccessingPublicWebServerOverTor.java
puppetor/trunk/src/org/torproject/puppetor/examples/AdvertisingAndAccessingHiddenServiceOverPrivateTorNetwork.java
puppetor/trunk/src/org/torproject/puppetor/examples/AdvertisingAndAccessingHiddenServiceOverPublicTorNetwork.java
puppetor/trunk/src/org/torproject/puppetor/examples/AdvertisingHiddenServiceToPublicTorNetwork.java
puppetor/trunk/src/org/torproject/puppetor/examples/LongRunningNetwork.java
puppetor/trunk/src/org/torproject/puppetor/examples/MergingRoutersWithLongRunningNetwork.java
puppetor/trunk/src/org/torproject/puppetor/impl/ClientApplicationImpl.java
puppetor/trunk/src/org/torproject/puppetor/impl/DirectoryNodeImpl.java
puppetor/trunk/src/org/torproject/puppetor/impl/EventImpl.java
puppetor/trunk/src/org/torproject/puppetor/impl/EventManagerImpl.java
puppetor/trunk/src/org/torproject/puppetor/impl/HiddenServiceImpl.java
puppetor/trunk/src/org/torproject/puppetor/impl/NetworkImpl.java
puppetor/trunk/src/org/torproject/puppetor/impl/ProxyNodeImpl.java
puppetor/trunk/src/org/torproject/puppetor/impl/RouterNodeImpl.java
puppetor/trunk/src/org/torproject/puppetor/impl/ServerApplicationImpl.java
Log:
Rename de.uniba.wiai.lspi.puppetor to org.torproject.puppetor.
Copied: puppetor/trunk/src/org/torproject/puppetor/ClientApplication.java (from rev 17558, puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/ClientApplication.java)
===================================================================
--- puppetor/trunk/src/org/torproject/puppetor/ClientApplication.java (rev 0)
+++ puppetor/trunk/src/org/torproject/puppetor/ClientApplication.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2007, Karsten Loesing
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.torproject.puppetor;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/**
+ * The <code>ClientApplication</code> can be used to simulate simple
+ * <code>HTTP GET</code> requests by a virtual local client. Therefore, an
+ * address and a port are given to which the client shall connect. Requests are
+ * performed by a background thread, so that multiple requests could be
+ * performed at the same time.
+ *
+ * @author kloesing
+ */
+public interface ClientApplication extends Remote {
+
+ /**
+ * <p>
+ * Performs one or more HTTP requests to a previously provided address and
+ * port. All requests are performed by a thread in the background, so that
+ * this method returns immediately. That thread will try for
+ * <code>retries</code> times to make the request with a timeout of
+ * <code>timeoutForEachRetry</code> milliseconds each. If an attempt is
+ * not successful, the thread nevertheless waits for the timeout to expire
+ * before performing the next attempt. If <code>stopOnSuccess</code> is
+ * set to <code>true</code>, the thread will quit performing requests
+ * immediately after the first successful request.
+ * </p>
+ *
+ * <p>
+ * For each sent request the application fires a
+ * <event>ClientEventType.CLIENT_SENDING_REQUEST</code> event. On receiving
+ * a reply it fires an event of type <code>ClientEventType.CLIENT_REPLY_RECEIVED</code>,
+ * if a request is not successful or times out, a <code>ClientEventType.CLIENT_GAVE_UP_REQUEST</code>
+ * event is fired. After all requests have been performed (either
+ * successfully, or not) an event of type <code>ClientEventType.CLIENT_REQUESTS_PERFORMED</code>
+ * is fired.
+ * </p>
+ *
+ * TODO may this method only be invoked once?!
+ *
+ * @param retries
+ * The number of retries that this client will perform. Must be
+ * <code>1</code> or greater.
+ * @param timeoutForEachRetry
+ * The timeout for each request. If a request is not successful,
+ * the thread nevertheless waits for the timeout to expire. Must
+ * not be negative.
+ * @param stopOnSuccess
+ * If set to <code>true</code>, the client quits performing
+ * requests after the first successful request, if <code>false</code>
+ * it continues until all <code>retries</code> have been
+ * processed.
+ * @throws IllegalArgumentException
+ * Thrown if an invalid value is given for either of the
+ * parameters.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract void startRequests(int retries, long timeoutForEachRetry,
+ boolean stopOnSuccess) throws RemoteException;
+
+ /**
+ * Stops all requests that are currently running.
+ *
+ * @throws IllegalStateException
+ * Thrown if no requests have been started before.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract void stopRequest() throws RemoteException;
+
+ /**
+ * Returns the name of this client.
+ *
+ * @return The name of this client.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract String getClientApplicationName() throws RemoteException;
+
+ /**
+ * Returns the SOCKS port of the local Tor node to which requests are sent.
+ *
+ * @return The SOCKS port of the local Tor node to which requests are sent.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract int getSocksPort() throws RemoteException;
+
+ /**
+ * Returns the target name for the requests sent by this client; can be
+ * either a server name/address or an onion address.
+ *
+ * @return The target name for the requests sent by this client.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract String getTargetName() throws RemoteException;
+
+ /**
+ * Returns the target port for the requests sent by this client; can be
+ * either a server port or a virtual port of a hidden service.
+ *
+ * @return The target port for the requests sent by this client.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract int getTargetPort() throws RemoteException;
+}
Copied: puppetor/trunk/src/org/torproject/puppetor/ClientEventType.java (from rev 17558, puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/ClientEventType.java)
===================================================================
--- puppetor/trunk/src/org/torproject/puppetor/ClientEventType.java (rev 0)
+++ puppetor/trunk/src/org/torproject/puppetor/ClientEventType.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2007, Karsten Loesing
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.torproject.puppetor;
+
+/**
+ * Event types that can be fired by a client application running as thread in
+ * the background.
+ */
+@SuppressWarnings("serial")
+public class ClientEventType implements EventType {
+
+ /**
+ * String identifying the type of the event type.
+ */
+ String typeString;
+
+ /**
+ * Creates a new event type with the given type string.
+ *
+ * @param typeString
+ * String identifying the type of the event type.
+ */
+ public ClientEventType(String typeString) {
+ this.typeString = typeString;
+ }
+
+ public String getTypeName() {
+ return this.typeString;
+ }
+
+ /**
+ * The client application is sending a request; this event is fired
+ * internally and not parsed from a log statement from Tor.
+ */
+ public static final ClientEventType CLIENT_SENDING_REQUEST = new ClientEventType(
+ "CLIENT_SENDING_REQUEST");
+
+ /**
+ * The client application has received a reply to a previously sent request;
+ * this event is fired internally and not parsed from a log statement from
+ * Tor.
+ */
+ public static final ClientEventType CLIENT_REPLY_RECEIVED = new ClientEventType(
+ "CLIENT_REPLY_RECEIVED");
+
+ /**
+ * The client application has given up waiting for the reply to a previously
+ * sent request; this event is fired internally and not parsed from a log
+ * statement from Tor.
+ */
+ public static final ClientEventType CLIENT_GAVE_UP_REQUEST = new ClientEventType(
+ "CLIENT_GAVE_UP_REQUEST");
+
+ /**
+ * The client application has completed a series of requests, whether they
+ * were successful or not; this event is fired internally and not parsed
+ * from a log statement from Tor.
+ */
+ public static final ClientEventType CLIENT_REQUESTS_PERFORMED = new ClientEventType(
+ "CLIENT_REQUESTS_PERFORMED");
+}
Copied: puppetor/trunk/src/org/torproject/puppetor/DirectoryNode.java (from rev 17558, puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/DirectoryNode.java)
===================================================================
--- puppetor/trunk/src/org/torproject/puppetor/DirectoryNode.java (rev 0)
+++ puppetor/trunk/src/org/torproject/puppetor/DirectoryNode.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2007, Karsten Loesing
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.torproject.puppetor;
+
+import java.rmi.RemoteException;
+import java.util.Set;
+
+/**
+ * A <code>DirectoryNode</code> represents a Tor process that acts as
+ * <code>RouterNode</code> and which is further a directory authoritative
+ * server for the (private) Tor network. It inherits most of the configuration
+ * and behavior from <code>RouterNode</code> and adds some directory-specific
+ * configurations and behavior.
+ *
+ * @author kloesing
+ */
+public interface DirectoryNode extends RouterNode {
+
+ /**
+ * Combines the fingerprint of this node to a <code>DirServer</code>
+ * string that can be used to configure this or other nodes to use this node
+ * as directory server.
+ *
+ * @return <code>DirServer</code> string to configure a node to use this
+ * node as directory server.
+ * @throws PuppeTorException
+ * Thrown if a problem occurs when determining the fingerprint
+ * of this node.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract String getDirServerString() throws PuppeTorException,
+ RemoteException;
+
+ /**
+ * Adds the given (possibly empty) set of onion router fingerprints to the
+ * set of approved routers to confirm to directory clients, that the given
+ * routers can be trusted. Changes are only stored locally and not written
+ * to the <code>approved-routers</code> file to disk which will be done
+ * when writing the configuration of this node.
+ *
+ * @param approvedRouters
+ * The set of approved routers to be added. Each provided string
+ * must be formatted as
+ * <code>nickname 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000</code>.
+ * @throws IllegalArgumentException
+ * Thrown if <code>null</code> is passed as parameter.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public void addApprovedRouters(Set<String> approvedRouters)
+ throws RemoteException;
+}
Copied: puppetor/trunk/src/org/torproject/puppetor/Event.java (from rev 17558, puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/Event.java)
===================================================================
--- puppetor/trunk/src/org/torproject/puppetor/Event.java (rev 0)
+++ puppetor/trunk/src/org/torproject/puppetor/Event.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2007, Karsten Loesing
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.torproject.puppetor;
+
+import java.io.Serializable;
+
+/**
+ * An <code>Event</code> is created for every state change of an asynchronous
+ * system component, e.g. a Tor process or a client/server application running
+ * as thread in the background. In contrast to <code>NodeState</code> an
+ * <code>Event</code> cannot be a pre- or postconditions for a method
+ * invocation. There is no prescribed order in which events are fired by a
+ * certain process or application. Some events can be fired only once, others
+ * possibly multiple times. All management operations for events are contained
+ * in the <code>EventManager</code>.
+ *
+ * @author kloesing
+ */
+public interface Event extends Serializable {
+
+ /**
+ * Returns the name of the source of this event, which can be a Tor process
+ * or a client/server application running as thread in the background.
+ *
+ * @return The event source.
+ */
+ public abstract String getSource();
+
+ /**
+ * Returns the event type.
+ *
+ * @return The event type.
+ */
+ public abstract EventType getType();
+
+ /**
+ * Returns the original message that lead to firing this event.
+ *
+ * @return The original message.
+ */
+ public abstract String getMessage();
+
+ /**
+ * Returns the occurrence time of this event, which is either the parsed
+ * time from a Tor log statement, or the current system time when a
+ * client/server application fired this event.
+ *
+ * @return The occurrence time.
+ */
+ public abstract long getOccurrenceTime();
+}
Copied: puppetor/trunk/src/org/torproject/puppetor/EventListener.java (from rev 17558, puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/EventListener.java)
===================================================================
--- puppetor/trunk/src/org/torproject/puppetor/EventListener.java (rev 0)
+++ puppetor/trunk/src/org/torproject/puppetor/EventListener.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2007, Karsten Loesing
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.torproject.puppetor;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/**
+ * This interface must be implemented by any object in a test application that
+ * shall be registered as event listener.
+ *
+ * @author kloesing
+ */
+public interface EventListener extends Remote {
+
+ /**
+ * Is invoked when an asynchronous event is fired by the source (or one of
+ * the sources) for which this listener was registered.
+ *
+ * @param event
+ * The event that was fired.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public void handleEvent(Event event) throws RemoteException;
+
+}
Copied: puppetor/trunk/src/org/torproject/puppetor/EventManager.java (from rev 17558, puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/EventManager.java)
===================================================================
--- puppetor/trunk/src/org/torproject/puppetor/EventManager.java (rev 0)
+++ puppetor/trunk/src/org/torproject/puppetor/EventManager.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -0,0 +1,287 @@
+/*
+ * Copyright (c) 2007, Karsten Loesing
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.torproject.puppetor;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.util.List;
+
+/**
+ * The <code>EventManager</code> is the central place for a test run to manage
+ * asynchronous events by Tor processes and client or server applications
+ * running as threads in the background. A test application can either register
+ * event listeners to be notified asynchronously about events when they occur,
+ * or synchronize with an event by being blocked until a certain event occurs.
+ *
+ * @author kloesing
+ */
+public interface EventManager extends Remote {
+
+ /**
+ * Registers the given <code>listener</code> as event listener for events
+ * originating from the given <code>source</code>. This method returns a
+ * list of all previously fired events by this source, so that each event
+ * fired by this source is either included in the returned list or
+ * signalized in a later invocation on the event listener, but not in both.
+ * This prevents race conditions by eliminating the gap between registration
+ * of an event handler and asking if an event has been fired before
+ * registering.
+ *
+ * @param source
+ * The name of the source of events that the listener is
+ * interested in. May not be <code>null</code> and must be the
+ * name of a previously created node, client, or server.
+ * @param listener
+ * The listener that wants to be notified about events from the
+ * given <code>source</code>. If the <code>listener</code>
+ * is already registered for the same <code>source</code>,
+ * nothing happens, i.e. the <code>listener</code> will not
+ * receive multiple invocations for the same event. May not be
+ * <code>null</code>.
+ * @return A list of all previously fired events for the given
+ * <code>source</code>. If no event has been fired before, an
+ * empty list is returned instead of <code>null</code>.
+ * @throws IllegalArgumentException
+ * Thrown if <code>null</code> is passed for either of the
+ * parameters or if the <code>source</code> is unknown.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract List<Event> addEventListener(String source,
+ EventListener listener) throws RemoteException;
+
+ /**
+ * Registers the given <code>listener</code> as event listener for future
+ * events originating from any source.
+ *
+ * @param listener
+ * The listener that wants to be notified about events from the
+ * given <code>source</code>. If the <code>listener</code>
+ * is already registered for all sources, nothing happens, i.e.
+ * the <code>listener</code> will not receive multiple
+ * invocations for the same event. May not be <code>null</code>.
+ * @throws IllegalArgumentException
+ * Thrown if <code>null</code> is passed for the parameter.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract void addEventListener(EventListener listener)
+ throws RemoteException;
+
+ /**
+ * Returns the list of all previously observed events from the given
+ * <code>source</code>.
+ *
+ * @param source
+ * The source of the events that the invoking thread is
+ * interested in. May not be <code>null</code> and must be the
+ * name of a previously created node, client, or server.
+ * @return List of all previously observed events from the given
+ * <code>source</code>.
+ * @throws IllegalArgumentException
+ * Thrown if <code>null</code> is passed as parameter or if
+ * the <code>source</code> is unknown.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract List<Event> getEventHistory(String source)
+ throws RemoteException;
+
+ /**
+ * Returns whether the given <code>eventType</code> has been observed from
+ * the given <code>source</code> before, or not.
+ *
+ * @param source
+ * The source of the event that the invoking thread is interested
+ * in. May not be <code>null</code> and must be the name of a
+ * previously created node, client, or server.
+ * @param eventType
+ * The event type that the invoking thread is interested in. May
+ * not be <code>null</code>.
+ * @throws IllegalArgumentException
+ * Thrown if <code>null</code> is passed for either of the
+ * parameters or if <code>source</code> is unknown.
+ * @return <code>true</code> if the event has been observed from the
+ * source before, <code>false</code> otherwise.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract boolean hasEventOccured(String source, EventType eventType)
+ throws RemoteException;
+
+ /**
+ * Removes the given <code>listener</code> as event listener from all
+ * previously registered sources. If this listener is not registered for any
+ * source, nothing happens.
+ *
+ * @param listener
+ * The listener that shall be removed from the list of registered
+ * listeners. May not be <code>null</code>.
+ * @throws IllegalArgumentException
+ * Thrown if <code>null</code> is passed as parameter.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract void removeEventListener(EventListener listener)
+ throws RemoteException;
+
+ /**
+ * Checks if the given <code>eventType</code> has been observed from the
+ * given <code>source</code> before; if not, blocks the invoking thread
+ * until the next event of this type is fired from that source. Note that
+ * this method does not restrict waiting to a timeout, so that it could
+ * potentially block forever!
+ *
+ * @param source
+ * The source of the event that the invoking thread is willing to
+ * wait for. May not be <code>null</code> and must be the name
+ * of a previously created node, client, or server.
+ * @param eventType
+ * The event type that the invoking thread is willing to wait for
+ * from the given <code>source</code>. May not be
+ * <code>null</code>.
+ * @throws IllegalArgumentException
+ * Thrown if <code>null</code> is passed for either of the
+ * parameters or if the <code>source</code> is unknown.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract void waitForAnyOccurence(String source, EventType eventType)
+ throws RemoteException;
+
+ /**
+ * Checks if the given <code>eventType</code> has been observed from the
+ * given <code>source</code> before; if not, blocks the invoking thread
+ * until the next event of this type is fired from that source or the given
+ * timeout of <code>maximumTimeToWaitInMillis</code> milliseconds has
+ * expired.
+ *
+ * @param source
+ * The source of the event that the invoking thread is willing to
+ * wait for. May not be <code>null</code> and must be the name
+ * of a previously created node, client, or server.
+ * @param eventType
+ * The event type that the invoking thread is willing to wait for
+ * from the given <code>source</code>. May not be
+ * <code>null</code>.
+ * @param maximumTimeToWaitInMillis
+ * The maximum time to wait in milliseconds. A positive value or
+ * zero restricts waiting to this time. If this value is
+ * negative, we will wait potentially forever.
+ * @return <code>true</code> if an event of the given type has been fired
+ * by the <code>source</code> within the given timeout,
+ * <code>false</code> otherwise.
+ * @throws IllegalArgumentException
+ * Thrown if an invalid value is passed for either of the
+ * parameters or if the <code>source</code> is unknown.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract boolean waitForAnyOccurence(String source,
+ EventType eventType, long maximumTimeToWaitInMillis)
+ throws RemoteException;
+
+ /**
+ * Blocks the invoking thread until the next <code>event</code> is fired
+ * from the given <code>source</code>. This method only waits for the
+ * next occurence of an event, regardless of previous occurrences. Note that
+ * this method does not restrict waiting to a timeout, so that it could
+ * potentially block forever!
+ *
+ * @param source
+ * The source of the event that the invoking thread is willing to
+ * wait for. May not be <code>null</code> and must be the name
+ * of a previously created node, client, or server.
+ * @param eventType
+ * The event type that the invoking thread is willing to wait for
+ * from the given <code>source</code>. May not be
+ * <code>null</code>.
+ * @throws IllegalArgumentException
+ * Thrown if <code>null</code> is passed for either of the
+ * parameters or if the <code>source</code> is unknown.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract void waitForNextOccurence(String source, EventType eventType)
+ throws RemoteException;
+
+ /**
+ * Blocks the invoking thread until the next <code>event</code> is fired
+ * from the given <code>source</code> or the given timeout of
+ * <code>maximumTimeToWaitInMillis</code> milliseconds has expired. This method
+ * only waits for the next occurence of an event, regardless of previous
+ * occurrences.
+ *
+ * @param source
+ * The source of the event that the invoking thread is willing to
+ * wait for. May not be <code>null</code> and must be the name
+ * of a previously created node, client, or server.
+ * @param eventType
+ * The event type that the invoking thread is willing to wait for
+ * from the given <code>source</code>. May not be
+ * <code>null</code>.
+ * @param maximumTimeToWaitInMillis
+ * The maximum time to wait in milliseconds. A positive value or
+ * zero restricts waiting to this time. If this value is
+ * negative, we will wait potentially forever.
+ * @return <code>true</code> if an event of the given type has been fired
+ * by the <code>source</code> within the given timeout,
+ * <code>false</code> otherwise.
+ * @throws IllegalArgumentException
+ * Thrown if an invalid value is passed for either of the
+ * parameters or if the <code>source</code> is unknown.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract boolean waitForNextOccurence(String source,
+ EventType eventType, long maximumTimeToWaitInMillis)
+ throws RemoteException;
+
+ /**
+ * Registers a new event type by passing a pattern string that can be
+ * applied to a regular expression when parsing Tor log statements. This is
+ * useful for log statements that are only included in modified Tor
+ * versions. Therefore, the event type may be an instance of a self-defined
+ * class that implements <code>EventType</code>.
+ *
+ * @param patternString
+ * The pattern string that will be used for parsing Tor log
+ * statements; the syntax corresponds to java.util.regex.Pattern.
+ * @param eventType
+ * The event type of the event that will be fired when a log
+ * statement was parsed that includes the given pattern.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract void registerEventTypePattern(String patternString,
+ EventType eventType) throws RemoteException;
+}
Copied: puppetor/trunk/src/org/torproject/puppetor/EventType.java (from rev 17558, puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/EventType.java)
===================================================================
--- puppetor/trunk/src/org/torproject/puppetor/EventType.java (rev 0)
+++ puppetor/trunk/src/org/torproject/puppetor/EventType.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2007, Karsten Loesing
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.torproject.puppetor;
+
+import java.io.Serializable;
+
+/**
+ * The super interface of possible event types that are fired on a state change
+ * of an asynchronous system component, e.g. a Tor process or a client/server
+ * application running as thread in the background.
+ *
+ * @author kloesing
+ */
+public interface EventType extends Serializable {
+
+ /**
+ * Returns a string representation of the event type name for display
+ * purposes.
+ *
+ * @return String representation of the event type name.
+ */
+ public abstract String getTypeName();
+}
Copied: puppetor/trunk/src/org/torproject/puppetor/HiddenService.java (from rev 17558, puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/HiddenService.java)
===================================================================
--- puppetor/trunk/src/org/torproject/puppetor/HiddenService.java (rev 0)
+++ puppetor/trunk/src/org/torproject/puppetor/HiddenService.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -0,0 +1,68 @@
+package org.torproject.puppetor;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/**
+ * A <code>HiddenService</code> instance contains all configurations of a
+ * hidden service that is registered at a node.
+ *
+ * @author kloesing
+ */
+public interface HiddenService extends Remote {
+
+ /**
+ * Determines the onion address for a previously added hidden service with
+ * name <code>serviceName</code>. Requires that the node has been
+ * started, i.e. is in state <code>NodeState.RUNNING</code>, and is
+ * configured to provide this hidden service.
+ *
+ * @return The onion address string consisting of 16 base32 chars plus
+ * ".onion" for hidden service versions 0 and 1 or 16 base32 chars
+ * plus "." plus 24 base32 chars plus ".onion" for hidden service
+ * version 2.
+ * @throws IllegalArgumentException
+ * Thrown if <code>null</code> or a zero-length string is
+ * passed as parameter.
+ * @throws IllegalStateException
+ * Thrown if the node at which this hidden service is configured
+ * is not in state <code>NodeState.RUNNING</code>.
+ * @throws PuppeTorException
+ * Thrown if the onion address of this hidden service could not
+ * be read, which is also the case when the node's configuration
+ * has not been written and the node has not been HUP'ed after
+ * configuring the hidden service.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract String determineOnionAddress() throws PuppeTorException,
+ RemoteException;
+
+ /**
+ * Returns the name of the hidden service.
+ *
+ * @return The name of the hidden service.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public String getServiceName() throws RemoteException;
+
+ /**
+ * Returns the port on which the service listens for requests.
+ *
+ * @return The port on which the service listens for requests.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public int getServicePort() throws RemoteException;
+
+ /**
+ * Returns the virtual port that this hidden service runs on as it is
+ * announced to clients.
+ *
+ * @return The virtual port of this hidden service.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public int getVirtualPort() throws RemoteException;
+}
Copied: puppetor/trunk/src/org/torproject/puppetor/HiddenServiceEventType.java (from rev 17558, puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/HiddenServiceEventType.java)
===================================================================
--- puppetor/trunk/src/org/torproject/puppetor/HiddenServiceEventType.java (rev 0)
+++ puppetor/trunk/src/org/torproject/puppetor/HiddenServiceEventType.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -0,0 +1,233 @@
+/*
+ * Copyright (c) 2007, Karsten Loesing
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.torproject.puppetor;
+
+/**
+ * Event types that can be fired by all Tor processes performing hidden-service
+ * operations.
+ */
+@SuppressWarnings("serial")
+public class HiddenServiceEventType implements EventType {
+
+ /**
+ * String identifying the type of the event type.
+ */
+ String typeString;
+
+ /**
+ * Creates a new event type with the given type string.
+ *
+ * @param typeString
+ * String identifying the type of the event type.
+ */
+ public HiddenServiceEventType(String typeString) {
+ this.typeString = typeString;
+ }
+
+ public String getTypeName() {
+ return this.typeString;
+ }
+
+ /**
+ * Alice has received an onion request; this event is parsed from a log
+ * statement in connection_ap_handshake_rewrite_and_attach().
+ */
+ public static final HiddenServiceEventType ALICE_ONION_REQUEST_RECEIVED = new HiddenServiceEventType(
+ "ALICE_ONION_REQUEST_RECEIVED");
+
+ /**
+ * Alice sends a fetch request for a hidden service descriptor to a
+ * directory server; this event is parsed from a log statement in
+ * rend_client_refetch_renddesc().
+ */
+ public static final HiddenServiceEventType ALICE_SENDING_FETCH_DESC = new HiddenServiceEventType(
+ "ALICE_SENDING_FETCH_DESC");
+
+ /**
+ * Alice receives a reply to a previous fetch request for a hidden service
+ * descriptors from a directory server; this event is parsed from a log
+ * statement in connection_dir_client_reached_eof().
+ */
+ public static final HiddenServiceEventType ALICE_DESC_FETCHED_RECEIVED = new HiddenServiceEventType(
+ "ALICE_DESC_FETCHED_RECEIVED");
+
+ /**
+ * Alice has built a circuit to a rendezvous point and sends an
+ * ESTABLISH_RENDEZVOUS cell; this event is parsed from a log statement in
+ * rend_client_send_establish_rendezvous().
+ */
+ public static final HiddenServiceEventType ALICE_BUILT_REND_CIRC_SENDING_ESTABLISH_RENDEZVOUS = new HiddenServiceEventType(
+ "ALICE_BUILT_REND_CIRC_SENDING_ESTABLISH_RENDEZVOUS");
+
+ /**
+ * Alice receives a RENDEZVOUS_ESTABLISHED cell from a rendezvous point;
+ * this event is parsed from a log statement in
+ * rend_client_rendezvous_acked().
+ */
+ public static final HiddenServiceEventType ALICE_RENDEZVOUS_ESTABLISHED_RECEIVED = new HiddenServiceEventType(
+ "ALICE_RENDEZVOUS_ESTABLISHED_RECEIVED");
+
+ /**
+ * Alice has built a circuit to an introduction point (which does not
+ * automatically lead to sending an INTRODUCE1 cell, because the rendezvous
+ * circuit might not be ready); this event is parsed from a log statement in
+ * rend_client_introcirc_has_opened().
+ */
+ public static final HiddenServiceEventType ALICE_BUILT_INTRO_CIRC = new HiddenServiceEventType(
+ "ALICE_BUILT_INTRO_CIRC");
+
+ /**
+ * Alice sends an INTRODUCE1 cell to an introduction point; this event is
+ * parsed from a log statement in rend_client_send_introduction().
+ */
+ public static final HiddenServiceEventType ALICE_SENDING_INTRODUCE1 = new HiddenServiceEventType(
+ "ALICE_SENDING_INTRODUCE1");
+
+ /**
+ * Alice has received an INTRODUCE_ACK cell as an acknowledgement to a
+ * previously sent INTRODUCE1 cell; this event is parsed from a log
+ * statement in rend_client_introduction_acked().
+ */
+ public static final HiddenServiceEventType ALICE_INTRODUCE_ACK_RECEIVED = new HiddenServiceEventType(
+ "ALICE_INTRODUCE_ACK_RECEIVED");
+
+ /**
+ * Alice has received a RENDEZVOUS2 cell and can now open an application
+ * connection to the client; this event is parsed from a log statement in
+ * rend_client_receive_rendezvous().
+ */
+ public static final HiddenServiceEventType ALICE_RENDEZVOUS2_RECEIVED_APP_CONN_OPENED = new HiddenServiceEventType(
+ "ALICE_RENDEZVOUS2_RECEIVED_APP_CONN_OPENED");
+
+ /**
+ * Bob has built a circuit to an introduction point and sends an
+ * ESTABLISH_INTRO cell; this event is parsed from a log statement in
+ * rend_service_intro_has_opened().
+ */
+ public static final HiddenServiceEventType BOB_BUILT_INTRO_CIRC_SENDING_ESTABLISH_INTRO = new HiddenServiceEventType(
+ "BOB_BUILT_INTRO_CIRC_SENDING_ESTABLISH_INTRO");
+
+ /**
+ * Bob has received an INTRO_ESTABLISHED cell, i.e. a node has confirmed to
+ * work as introduction point; this event is parsed from a log statement in
+ * rend_service_intro_established().
+ */
+ public static final HiddenServiceEventType BOB_INTRO_ESTABLISHED_RECEIVED = new HiddenServiceEventType(
+ "BOB_INTRO_ESTABLISHED_RECEIVED");
+
+ /**
+ * Bob posts a hidden service descriptor to the directory servers; this
+ * event is parsed from a log statement in upload_service_descriptor().
+ */
+ public static final HiddenServiceEventType BOB_SENDING_PUBLISH_DESC = new HiddenServiceEventType(
+ "BOB_SENDING_PUBLISH_DESC");
+
+ /**
+ * Bob received a response from a directory server to a previous publish
+ * request; this event is parsed from a log statement in
+ * connection_dir_client_reached_eof().
+ */
+ public static final HiddenServiceEventType BOB_DESC_PUBLISHED_RECEIVED = new HiddenServiceEventType(
+ "BOB_DESC_PUBLISHED_RECEIVED");
+
+ /**
+ * Bob has received an INTRODUCE2 cell, i.e. a node wants to establish a
+ * connection, and will now try to establish a circuit to the client's
+ * rendezvous point; this event is parsed from a log statement in
+ * rend_service_introduce().
+ */
+ public static final HiddenServiceEventType BOB_INTRODUCE2_RECEIVED = new HiddenServiceEventType(
+ "BOB_INTRODUCE2_RECEIVED");
+
+ /**
+ * Bob has built a circuit to a rendezvous point and sends a RENDEZVOUS1
+ * cell; this event is parsed from a log statement in
+ * rend_service_rendezvous_has_opened().
+ */
+ public static final HiddenServiceEventType BOB_BUILT_REND_CIRC_SENDING_RENDEZVOUS1 = new HiddenServiceEventType(
+ "BOB_BUILT_REND_CIRC_SENDING_RENDEZVOUS1");
+
+ /**
+ * Bob opens a connection to the actual hidden server; this event is parsed
+ * from a log statement in connection_exit_begin_conn().
+ */
+ public static final HiddenServiceEventType BOB_APP_CONN_OPENED = new HiddenServiceEventType(
+ "BOB_APP_CONN_OPENED");
+
+ /**
+ * The directory server has received a descriptor post request; this event
+ * is parsed from a log statement in directory_handle_command_post().
+ */
+ public static final HiddenServiceEventType DIR_PUBLISH_DESC_RECEIVED = new HiddenServiceEventType(
+ "DIR_PUBLISH_DESC_RECEIVED");
+
+ /**
+ * The directory server has received a descriptor fetch request; this event
+ * is parsed from a log statement in directory_handle_command_get().
+ */
+ public static final HiddenServiceEventType DIR_FETCH_DESC_RECEIVED = new HiddenServiceEventType(
+ "DIR_FETCH_DESC_RECEIVED");
+
+ /**
+ * The node received an ESTABLISH_INTRO cell, i.e. was requested to work as
+ * introduction point, and replies with an INTRO_ESTABLISHED cell; this
+ * event is parsed from a log statement in rend_mid_establish_intro().
+ */
+ public static final HiddenServiceEventType IPO_RECEIVED_ESTABLISH_INTRO_SENDING_INTRO_ESTABLISHED = new HiddenServiceEventType(
+ "IPO_RECEIVED_ESTABLISH_INTRO_SENDING_INTRO_ESTABLISHED");
+
+ /**
+ * The introduction point received an INTRODUCE1 cell and reacts by sending
+ * an INTRODUCE2 cell to Bob and an INTRODUCE_ACK cell to Alice; this event
+ * is parsed from a log statement in rend_mid_introduce().
+ */
+ public static final HiddenServiceEventType IPO_RECEIVED_INTRODUCE1_SENDING_INTRODUCE2_AND_INTRODUCE_ACK = new HiddenServiceEventType(
+ "IPO_RECEIVED_INTRODUCE1_SENDING_INTRODUCE2_AND_INTRODUCE_ACK");
+
+ /**
+ * The node received an ESTABLISH_RENDEZVOUS cell, i.e. was requested to
+ * work as rendezvous point, and replies with a RENDEZVOUS_ESTABLISHED cell;
+ * this event is parsed from a log statement in
+ * rend_mid_establish_rendezvous().
+ */
+ public static final HiddenServiceEventType RPO_RECEIVED_ESTABLISH_RENDEZVOUS_SENDING_RENDEZVOUS_ESTABLISHED = new HiddenServiceEventType(
+ "RPO_RECEIVED_ESTABLISH_RENDEZVOUS_SENDING_RENDEZVOUS_ESTABLISHED");
+
+ /**
+ * The rendezvous point received a RENDEZVOUS1 cell and reacts by sending a
+ * RENDEZVOUS2 cell to Alice; this event is parsed from a log statement in
+ * rend_mid_rendezvous().
+ */
+ public static final HiddenServiceEventType RPO_RECEIVING_RENDEZVOUS1_SENDING_RENDEZVOUS2 = new HiddenServiceEventType(
+ "RPO_RECEIVING_RENDEZVOUS1_SENDING_RENDEZVOUS2");
+
+}
\ No newline at end of file
Copied: puppetor/trunk/src/org/torproject/puppetor/Network.java (from rev 17558, puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/Network.java)
===================================================================
--- puppetor/trunk/src/org/torproject/puppetor/Network.java (rev 0)
+++ puppetor/trunk/src/org/torproject/puppetor/Network.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -0,0 +1,824 @@
+/*
+ * Copyright (c) 2007, Karsten Loesing
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.torproject.puppetor;
+
+import java.io.File;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A Network instance constitutes the central object of any test run and is
+ * aware of the node configuration. It creates all nodes for this configuration
+ * and is able to perform common operations on these nodes. Apart from the
+ * factory methods, all other operations could also be performed manually by an
+ * application using the appropriate interfaces.
+ *
+ * @author kloesing
+ */
+public interface Network extends Remote {
+
+ /**
+ * <p>
+ * Configures this network as private Tor network by exchanging directory
+ * strings and router fingerprints between the nodes of this network.
+ * Afterwards, the nodes will be able to run a private Tor network,
+ * separated from public directory servers and onion routers.
+ * </p>
+ *
+ * <p>
+ * The configuration is done in two steps:
+ * <ol>
+ * <li>Directory strings of directory nodes are added to the configurations
+ * of all nodes in the other network.</li>
+ * <li>Router fingerprints of all router and directory nodes are added to
+ * the <code>approved-routers</code> files of the directory nodes.</li>
+ * </ol>
+ * </p>
+ *
+ * <p>
+ * This operation may be invoked in any state of the contained nodes.
+ * However, a network that does not have directory nodes of its own but
+ * relies on directory nodes of a merged network <b>should not be started
+ * before being configured as private network!</b> Otherwise it would
+ * connect to the public Tor network before being merged with the other
+ * private Tor network. However, it may also be invoked at a later time,
+ * e.g. to admit new nodes.
+ * </p>
+ *
+ * <p>
+ * This operation does not write any configurations to disk and neither
+ * starts a nodes nor sends HUP signals to running nodes. These operations
+ * are left to the application, so that they have more control over the
+ * network behavior.
+ * </p>
+ *
+ * <p>
+ * Applications need to ensure that there are enough directory nodes (2) and
+ * router nodes (3) in the network to allow normal operation.
+ * </p>
+ *
+ * @throws PuppeTorException
+ * Thrown if an I/O problem occurs while determining the nodes'
+ * fingerprints.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract void configureAsPrivateNetwork() throws PuppeTorException,
+ RemoteException;
+
+ /**
+ * <p>
+ * Merges this network with another private Tor network by exchanging
+ * directory strings and router fingerprints. Afterwards, the nodes in both
+ * networks will consider the two networks a single, larger private Tor
+ * network.
+ * </p>
+ *
+ * <p>
+ * The configuration is done in two steps:
+ * <ol>
+ * <li>Directory strings of all directory nodes in this network are added
+ * to the configurations of all nodes in the other network and vice versa.</li>
+ * <li>Router fingerprints of all router and directory nodes in this
+ * network are added to the <code>approved-routers</code> files of all
+ * directory nodes in the other network and vice versa.</li>
+ * </ol>
+ * </p>
+ *
+ * <p>
+ * This operation may be invoked in any state of the contained nodes.
+ * However, a network that does not have directory nodes of its own but
+ * relies on directory nodes of a merged network <b>should not be started
+ * before merging!</b> Otherwise it would connect to the public Tor network
+ * before being merged with the other private Tor network. However, it may
+ * also be invoked at a later time, e.g. to admit new nodes.
+ * </p>
+ *
+ * <p>
+ * This operation does not write any configurations to disk and neither
+ * starts a nodes nor sends HUP signals to running nodes. These operations
+ * are left to the application, so that they have more control over the
+ * network behavior.
+ * </p>
+ *
+ * <p>
+ * Note that this operation is only effective if there are directory nodes
+ * in either of the two networks. Otherwise, no information will be
+ * exchanged between the two networks. Applications need to ensure that
+ * there are in total enough directory nodes (2) and router nodes (3) in
+ * both networks to allow normal operation.
+ * </p>
+ *
+ * @param remoteNetwork
+ * The remote network to merge this network with.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ * @throws PuppeTorException
+ * Thrown if an I/O problem occurs while reading directory
+ * strings or router fingerprints, while writing the new
+ */
+ public abstract void configureAsInterconnectedPrivateNetwork(
+ Network remoteNetwork) throws RemoteException, PuppeTorException;
+
+ /**
+ * Creates a new client application, but does not yet perform a request.
+ *
+ * @param clientApplicationName
+ * The name for this client application, which is used for
+ * logging purposes and as event source. May neither be
+ * <code>null</code> or a zero-length string. The name needs to
+ * be unique in this network.
+ * @param targetAddress
+ * The target for requests sent by this client application. Can
+ * be a publicly available URL or an onion address. May neither
+ * be <code>null</code> or a zero-length string.
+ * @param targetPort
+ * The TCP port for requests sent by this client application. If
+ * the target address is an onion address, this port is the
+ * virtual port that the hidden service has announced. May not be
+ * negative or greater than 65535.
+ * @param socksPort
+ * The TCP port on which a local Tor process is waiting for
+ * incoming SOCKS requests. May not be negative or greater than
+ * 65535.
+ * @return Reference to the created client application.
+ * @throws IllegalArgumentException
+ * Thrown if an invalid value is given for either of the
+ * parameters.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract ClientApplication createClient(
+ String clientApplicationName, String targetAddress, int targetPort,
+ int socksPort) throws RemoteException;
+
+ /**
+ * Creates a new directory node with automatically assigned ports and adds
+ * it to the network, but does not yet write its configuration to disk or
+ * start the corresponding Tor process.
+ *
+ * @param nodeName
+ * The name for this node, which is used as name for the working
+ * directory, for logging purposes, as node nickname, and as
+ * event source. May neither be <code>null</code> or have zero
+ * or more than 19 alpha-numeric characters. The node name needs
+ * to be unique in this network.
+ * @return Reference to the created directory node.
+ * @throws IllegalArgumentException
+ * Thrown if an invalid value is given as node name.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract DirectoryNode createDirectory(String nodeName)
+ throws RemoteException;
+
+ /**
+ * Creates a new directory node with automatically assigned ports that will
+ * listen on the given IP address and adds it to the network, but does not
+ * yet write its configuration to disk or start the corresponding Tor
+ * process.
+ *
+ * @param nodeName
+ * The name for this node, which is used as name for the working
+ * directory, for logging purposes, as node nickname, and as
+ * event source. May neither be <code>null</code> or have zero
+ * or more than 19 alpha-numeric characters. The node name needs
+ * to be unique in this network.
+ * @param serverIpAddress
+ * The IP address on which the node will listen. Must be a valid
+ * IP v4 address in dotted decimal notation. May not be
+ * <code>null</code>.
+ * @return Reference to the created directory node.
+ * @throws IllegalArgumentException
+ * Thrown if an invalid value is given as node name.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract DirectoryNode createDirectory(String nodeName,
+ String serverIpAddress) throws RemoteException;
+
+ /**
+ * Creates a new directory node and adds it to the network, but does not yet
+ * write its configuration to disk or start the corresponding Tor process.
+ *
+ * @param nodeName
+ * The name for this node, which is used as name for the working
+ * directory, for logging purposes, as node nickname, and as
+ * event source. May neither be <code>null</code> or have zero
+ * or more than 19 alpha-numeric characters. The node name needs
+ * to be unique in this network.
+ * @param controlPort
+ * The TCP port on which the corresponding Tor process will wait
+ * for a controller. May not be negative or greater than 65535.
+ * @param socksPort
+ * The TCP port on which the corresponding Tor process will wait
+ * for incoming SOCKS requests. May not be negative or greater
+ * than 65535.
+ * @param orPort
+ * The TCP port on which the corresponding Tor process will wait
+ * for incoming requests from other onion routers. May not be
+ * negative or greater than 65535.
+ * @param dirPort
+ * The TCP port on which the corresponding Tor process will wait
+ * for incoming directory requests. May not be negative or
+ * greater than 65535.
+ * @return Reference to the created directory node.
+ * @throws IllegalArgumentException
+ * Thrown if an invalid value is given for either of the
+ * parameters.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract DirectoryNode createDirectory(String nodeName,
+ int controlPort, int socksPort, int orPort, int dirPort)
+ throws RemoteException;
+
+ /**
+ * Creates a new directory node that will listen on the given IP address and
+ * adds it to the network, but does not yet write its configuration to disk
+ * or start the corresponding Tor process.
+ *
+ * @param nodeName
+ * The name for this node, which is used as name for the working
+ * directory, for logging purposes, as node nickname, and as
+ * event source. May neither be <code>null</code> or have zero
+ * or more than 19 alpha-numeric characters. The node name needs
+ * to be unique in this network.
+ * @param controlPort
+ * The TCP port on which the corresponding Tor process will wait
+ * for a controller. May not be negative or greater than 65535.
+ * @param socksPort
+ * The TCP port on which the corresponding Tor process will wait
+ * for incoming SOCKS requests. May not be negative or greater
+ * than 65535.
+ * @param orPort
+ * The TCP port on which the corresponding Tor process will wait
+ * for incoming requests from other onion routers. May not be
+ * negative or greater than 65535.
+ * @param dirPort
+ * The TCP port on which the corresponding Tor process will wait
+ * for incoming directory requests. May not be negative or
+ * greater than 65535.
+ * @param serverIpAddress
+ * The IP address on which the node will listen. Must be a valid
+ * IP v4 address in dotted decimal notation. May not be
+ * <code>null</code>.
+ * @return Reference to the created directory node.
+ * @throws IllegalArgumentException
+ * Thrown if an invalid value is given for either of the
+ * parameters.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract DirectoryNode createDirectory(String nodeName,
+ int controlPort, int socksPort, int orPort, int dirPort,
+ String serverIpAddress) throws RemoteException;
+
+ /**
+ * Creates a new <code>ProxyNode</code> with automatically assigned ports
+ * and adds it to the network, but does not yet write its configuration to
+ * disk or start the corresponding Tor process.
+ *
+ * @param nodeName
+ * The name for this node, which is used as name for the working
+ * directory, for logging purposes, and as event source. May
+ * neither be <code>null</code> or have zero or more than 19
+ * alpha-numeric characters. The node name needs to be unique in
+ * this network.
+ * @return Reference to the created proxy node.
+ * @throws IllegalArgumentException
+ * Thrown if an invalid value is given as node name.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract ProxyNode createProxy(String nodeName)
+ throws RemoteException;
+
+ /**
+ * Creates a new <code>ProxyNode</code> and adds it to the network, but
+ * does not yet write its configuration to disk or start the corresponding
+ * Tor process.
+ *
+ * @param nodeName
+ * The name for this node, which is used as name for the working
+ * directory, for logging purposes, and as event source. May
+ * neither be <code>null</code> or have zero or more than 19
+ * alpha-numeric characters. The node name needs to be unique in
+ * this network.
+ * @param controlPort
+ * The TCP port on which the corresponding Tor process will wait
+ * for a controller. May not be negative or greater than 65535.
+ * @param socksPort
+ * The TCP port on which the corresponding Tor process will wait
+ * for incoming SOCKS requests. May not be negative or greater
+ * than 65535.
+ * @return Reference to the created proxy node.
+ * @throws IllegalArgumentException
+ * Thrown if an invalid value is given for either of the
+ * parameters.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract ProxyNode createProxy(String nodeName, int controlPort,
+ int socksPort) throws RemoteException;
+
+ /**
+ * Creates a new <code>RouterNode</code> with automatically assigned ports
+ * and adds it to the network, but does not yet write its configuration to
+ * disk or start the corresponding Tor process.
+ *
+ * @param nodeName
+ * The name for this node, which is used as name for the working
+ * directory, for logging purposes, as node nickname, and as
+ * event source. May neither be <code>null</code> or have zero
+ * or more than 19 alpha-numeric characters. The node name needs
+ * to be unique in this network.
+ * @return Reference to the created router node.
+ * @throws IllegalArgumentException
+ * Thrown if an invalid value is given as node name.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract RouterNode createRouter(String nodeName)
+ throws RemoteException;
+
+ /**
+ * Creates a new <code>RouterNode</code> and adds it to the network, but
+ * does not yet write its configuration to disk or start the corresponding
+ * Tor process.
+ *
+ * @param nodeName
+ * The name for this node, which is used as name for the working
+ * directory, for logging purposes, as node nickname, and as
+ * event source. May neither be <code>null</code> or have zero
+ * or more than 19 alpha-numeric characters. The node name needs
+ * to be unique in this network.
+ * @param controlPort
+ * The TCP port on which the corresponding Tor process will wait
+ * for a controller. May not be negative or greater than 65535.
+ * @param socksPort
+ * The TCP port on which the corresponding Tor process will wait
+ * for incoming SOCKS requests. May not be negative or greater
+ * than 65535.
+ * @param orPort
+ * The TCP port on which the corresponding Tor process will wait
+ * for incoming requests from other onion routers. May not be
+ * negative or greater than 65535.
+ * @param dirPort
+ * The TCP port on which the corresponding Tor process will wait
+ * for incoming directory requests which in fact are requests for
+ * the mirrored directory. May not be negative or greater than
+ * 65535.
+ * @return Reference to the created router node.
+ * @throws IllegalArgumentException
+ * Thrown if an invalid value is given for either of the
+ * parameters.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract RouterNode createRouter(String nodeName, int controlPort,
+ int socksPort, int orPort, int dirPort) throws RemoteException;
+
+ /**
+ * Creates a new <code>RouterNode</code> with automatically assigned ports
+ * that will listen on the given IP address and adds it to the network, but
+ * does not yet write its configuration to disk or start the corresponding
+ * Tor process.
+ *
+ * @param nodeName
+ * The name for this node, which is used as name for the working
+ * directory, for logging purposes, as node nickname, and as
+ * event source. May neither be <code>null</code> or have zero
+ * or more than 19 alpha-numeric characters. The node name needs
+ * to be unique in this network.
+ * @param serverIpAddress
+ * The IP address on which the node will listen. Must be a valid
+ * IP v4 address in dotted decimal notation. May not be
+ * <code>null</code>.
+ * @return Reference to the created router node.
+ * @throws IllegalArgumentException
+ * Thrown if an invalid value is given as node name.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract RouterNode createRouter(String nodeName,
+ String serverIpAddress) throws RemoteException;
+
+ /**
+ * Creates a new <code>RouterNode</code> that will listen on the given IP
+ * address and adds it to the network, but does not yet write its
+ * configuration to disk or start the corresponding Tor process.
+ *
+ * @param nodeName
+ * The name for this node, which is used as name for the working
+ * directory, for logging purposes, as node nickname, and as
+ * event source. May neither be <code>null</code> or have zero
+ * or more than 19 alpha-numeric characters. The node name needs
+ * to be unique in this network.
+ * @param controlPort
+ * The TCP port on which the corresponding Tor process will wait
+ * for a controller. May not be negative or greater than 65535.
+ * @param socksPort
+ * The TCP port on which the corresponding Tor process will wait
+ * for incoming SOCKS requests. May not be negative or greater
+ * than 65535.
+ * @param orPort
+ * The TCP port on which the corresponding Tor process will wait
+ * for incoming requests from other onion routers. May not be
+ * negative or greater than 65535.
+ * @param dirPort
+ * The TCP port on which the corresponding Tor process will wait
+ * for incoming directory requests which in fact are requests for
+ * the mirrored directory. May not be negative or greater than
+ * 65535.
+ * @param serverIpAddress
+ * The IP address on which the node will listen. Must be a valid
+ * IP v4 address in dotted decimal notation. May not be
+ * <code>null</code>.
+ * @return Reference to the created router node.
+ * @throws IllegalArgumentException
+ * Thrown if an invalid value is given for either of the
+ * parameters.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract RouterNode createRouter(String nodeName, int controlPort,
+ int socksPort, int orPort, int dirPort, String serverIpAddress)
+ throws RemoteException;
+
+ /**
+ * Creates a new <code>ServerApplication</code> with automatically
+ * assigned ports, but does not start listening for incoming requests.
+ *
+ * @param serverApplicationName
+ * The name for this server application, which is used for
+ * logging purposes and as event source. May neither be
+ * <code>null</code> or a zero-length string. The name needs to
+ * be unique in this network.
+ * @return Reference to the created server application.
+ * @throws IllegalArgumentException
+ * Thrown if an invalid value is given as server application
+ * name.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract ServerApplication createServer(String serverApplicationName)
+ throws RemoteException;
+
+ /**
+ * Creates a new <code>ServerApplication</code>, but does not start
+ * listening for incoming requests.
+ *
+ * @param serverApplicationName
+ * The name for this server application, which is used for
+ * logging purposes and as event source. May neither be
+ * <code>null</code> or a zero-length string. The name needs to
+ * be unique in this network.
+ * @param serverPort
+ * The TCP port on which the server will wait for incoming
+ * requests. May not be negative or greater than 65535.
+ * @return Reference to the created server application.
+ * @throws IllegalArgumentException
+ * Thrown if an invalid value is given for either of the
+ * parameters.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract ServerApplication createServer(
+ String serverApplicationName, int serverPort)
+ throws RemoteException;
+
+ /**
+ * Returns a reference on the (single) event manager for this network.
+ *
+ * @return Reference on the (single) event manager for this network.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract EventManager getEventManager() throws RemoteException;
+
+ /**
+ * Returns (a copy of) the map containing the names of all directory nodes
+ * as keys and the corresponding directory nodes as values.
+ *
+ * @return Map containing all directory nodes.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract Map<String, DirectoryNode> getAllDirectoryNodes()
+ throws RemoteException;
+
+ /**
+ * Returns (a copy of) the map containing the names of all router nodes
+ * (only those that are not acting as directory nodes at the same time) as
+ * keys and the corresponding router nodes as values.
+ *
+ * @return Map containing all router nodes.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract Map<String, RouterNode> getAllRouterNodes()
+ throws RemoteException;
+
+ /**
+ * Returns (a copy of) the map containing the names of all proxy nodes (only
+ * those that are not acting as router or directory nodes at the same time)
+ * as keys and the corresponding proxy nodes as values.
+ *
+ * @return Map containing all proxy nodes.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract Map<String, ProxyNode> getAllProxyNodes()
+ throws RemoteException;
+
+ /**
+ * Returns (a copy of) the map containing the names of all nodes as keys and
+ * the corresponding proxy nodes as values.
+ *
+ * @return Map containing all nodes.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract Map<String, ProxyNode> getAllNodes() throws RemoteException;
+
+ /**
+ * Returns the node with name <code>nodeName</code> or <code>null</code>
+ * if no such node exists.
+ *
+ * @param nodeName
+ * The node name to look up.
+ * @return The node with name <code>nodeName</code>.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract ProxyNode getNode(String nodeName) throws RemoteException;
+
+ /**
+ * <p>
+ * Sends a HUP signal to all nodes in the network in regular intervals and
+ * blocks the invoking thread until all nodes have reported to have
+ * successfully opened a circuit.
+ * </p>
+ *
+ * <p>
+ * First, the method waits for <code>hupInterval</code> milliseconds for
+ * the nodes to have successfully opened a circuit. If they do not succeed
+ * within this time, a HUP signal is sent to all nodes and the method waits
+ * for another <code>hupInterval</code> milliseconds. In total, the method
+ * sends at most <code>tries</code> HUP signals before giving up and
+ * returning with <code>false</code>. Thus, the maximum waiting time is
+ * <code>(tries + 1)</code> times <code>hupInterval</code>. As soon as
+ * all nodes have successfully opened circuits, the method returns with
+ * <code>true</code>. This operation can only be invoked, if all nodes in
+ * the network are in state <code>NodeState.RUNNING</code>.
+ * </p>
+ *
+ * @param tries
+ * The maximum number of HUP signals that are sent to the Tor
+ * processes. Negative values are not allowed. A value of zero
+ * means to wait only for the given time of
+ * <code>hupInterval</code> milliseconds without sending a HUP
+ * signal. Typical values depend on the network being a public or
+ * private Tor network and range about 3 to 5 tries.
+ * @param hupInterval
+ * The time in milliseconds that the method will wait between
+ * sending HUP signals. Negative values are not allowed.
+ * Typically, values should not be smaller than 5 seconds to
+ * permit Tor to stabilize.
+ * @throws IllegalStateException
+ * Thrown if at least one node is not in state
+ * <code>NodeState.RUNNING</code>.
+ * @throws IllegalArgumentException
+ * Thrown if a negative value is given for either
+ * <code>tries</code> or <code>hupInterval</code>.
+ * @throws PuppeTorException
+ * Thrown if an I/O problem occurs while sending HUP signals.
+ * @return <code>true</code> if all nodes have reported to have
+ * successfully opened a circuit, <code>false</code> otherwise.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract boolean hupUntilUp(int tries, long hupInterval)
+ throws PuppeTorException, RemoteException;
+
+ /**
+ * Sends a HUP signal to all nodes in the network once. This operation can
+ * only be invoked, if all nodes in the network are in state
+ * <code>NodeState.RUNNING</code>.
+ *
+ * @throws IllegalStateException
+ * Thrown if at least one node is not in state
+ * <code>NodeState.RUNNING</code>.
+ * @throws PuppeTorException
+ * Thrown if an I/O problem occurs while sending HUP signals.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract void hupAllNodes() throws PuppeTorException,
+ RemoteException;
+
+ /**
+ * Sends a HUP signal to all directory nodes in the network once. This
+ * operation can only be invoked, if all directory nodes in the network are
+ * in state <code>NodeState.RUNNING</code>.
+ *
+ * @throws IllegalStateException
+ * Thrown if at least one directory node is not in state
+ * <code>NodeState.RUNNING</code>.
+ * @throws PuppeTorException
+ * Thrown if an I/O problem occurs while sending HUP signals.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract void hupAllDirectories() throws PuppeTorException,
+ RemoteException;
+
+ /**
+ * Attempts to shut down all running nodes. The method blocks until all
+ * shutdown requests have been sent and either returns, or throws the first
+ * exception that has been observed when shutting down nodes. The method can
+ * be assumed to return very quickly. If there are no running nodes in this
+ * network, this operation has no effect.
+ *
+ * @throws PuppeTorException
+ * Thrown if an I/O problem occurs while shutting down the
+ * nodes.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract void shutdownNodes() throws PuppeTorException,
+ RemoteException;
+
+ /**
+ * Attempts to start all nodes within a given timeout of
+ * <code>maximumTimeToWaitInMillis</code> milliseconds. The method returns
+ * as soon as all nodes have started and opened their control port so that
+ * we can connect to them. It returns a boolean that states whether the
+ * operation was either successful or has timed out. This operation can only
+ * be invoked, if all nodes in the network have written their configuration,
+ * i.e. are not in state <code>NodeState.CONFIGURING</code> anymore.
+ *
+ * @param maximumTimeToWaitInMillis
+ * The maximum time to wait in milliseconds. A positive value or
+ * zero restricts waiting to this time. Negative values are not
+ * allowed. Typical values are in the range of a few seconds.
+ * @return <code>true</code> if all nodes could be started successfully,
+ * <code>false</code> if a timeout has occured.
+ * @throws IllegalStateException
+ * Thrown if at least one node in the network is still in state
+ * <code>NodeState.CONFIGURING</code>.
+ * @throws IllegalArgumentException
+ * Thrown if a negative value is given for
+ * <code>maximumTimeToWaitInMillis</code>.
+ * @throws PuppeTorException
+ * Thrown if an I/O problem occurs while starting the nodes.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract boolean startNodes(long maximumTimeToWaitInMillis)
+ throws PuppeTorException, RemoteException;
+
+ /**
+ * Writes the configurations for all nodes in the network to disk, including
+ * <code>torrc</code> and <code>approved-routers</code> files. This
+ * method is assumed to return very quickly. In case of a private network,
+ * <code>configureAsPrivateNetwork</code> should be invoked in advance to
+ * this method!
+ *
+ * @throws PuppeTorException
+ * Thrown if an I/O problem occurs while writing to the nodes'
+ * working directories.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract void writeConfigurations() throws PuppeTorException,
+ RemoteException;
+
+ /**
+ * Returns the working directory of this network configuration which is in
+ * <code>test-env/networkName/</code>.
+ *
+ * @return Working directory of this network.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract File getWorkingDirectory() throws RemoteException;
+
+ /**
+ * Returns all configuration strings of the template of a node class that
+ * will be added to future instances of this node class and its subclasses.
+ * Note that the result only contains those configuration strings that are
+ * added by this node class to possible superclasses and that parameterized
+ * configuration strings, e.g. port configurations, are not included.
+ *
+ * @param nodeClass
+ * The class which will be configured with the returned template
+ * configuration; may not be <code>null</code>.
+ * @return The template configuration for the given node class.
+ * @throws IllegalArgumentException
+ * Thrown if an invalid value is given for the parameter.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract List<String> getTemplateConfiguration(
+ Class<? extends ProxyNode> nodeClass) throws RemoteException;
+
+ /**
+ * Adds a configuration string to the template of a node class, so that it
+ * will be added to future instances of this node class and its subclasses.
+ *
+ * @param nodeClass
+ * The class of nodes of which future instances will have the
+ * given configuration string; may not be <code>null</code>.
+ * @param templateConfigurationString
+ * The configuration string to add; may neither be
+ * <code>null</code> nor a zero-length string, and must consist
+ * of configuration key and value.
+ * @throws IllegalArgumentException
+ * Thrown if an invalid value is given for either of the
+ * parameters.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract void addTemplateConfiguration(
+ Class<? extends ProxyNode> nodeClass,
+ String templateConfigurationString) throws RemoteException;
+
+ /**
+ * Removes a configuration string from the template of a node class, so that
+ * it will not be added to future instances of this node class and its
+ * subclasses.
+ *
+ * @param nodeClass
+ * The class of nodes of which future instances will have the
+ * given configuration string; may not be <code>null</code>.
+ * @param templateConfigurationKey
+ * The configuration key to remove; may neither be
+ * <code>null</code> nor a zero-length key.
+ * @throws IllegalArgumentException
+ * Thrown if an invalid value is given for either of the
+ * parameters.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract void removeTemplateConfiguration(
+ Class<? extends ProxyNode> nodeClass,
+ String templateConfigurationKey) throws RemoteException;
+
+ /**
+ * Returns the name of this network.
+ *
+ * @return The name of this network.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract String getNetworkName() throws RemoteException;
+
+ /**
+ * Binds the network at the local <code>rmiregistry</code> to make it
+ * remotely available and returns whether binding was successful.
+ *
+ * @return <code>true</code> if binding was successful, <code>false</code>
+ * otherwise.
+ * @throws PuppeTorException
+ * Thrown if an error occurs while binding to the
+ * <code>rmiregistry</code>.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely (though this
+ * might never happen as the object is not bound, yet).
+ */
+ public abstract boolean bindAtRmiregistry() throws RemoteException;
+
+}
Copied: puppetor/trunk/src/org/torproject/puppetor/NetworkFactory.java (from rev 17558, puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/NetworkFactory.java)
===================================================================
--- puppetor/trunk/src/org/torproject/puppetor/NetworkFactory.java (rev 0)
+++ puppetor/trunk/src/org/torproject/puppetor/NetworkFactory.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2007, Karsten Loesing
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.torproject.puppetor;
+
+import java.net.MalformedURLException;
+import java.rmi.Naming;
+import java.rmi.NotBoundException;
+import java.rmi.RemoteException;
+
+import org.torproject.puppetor.impl.NetworkImpl;
+
+
+/**
+ * The <code>NetworkFactory</code> is a concrete factory that can create
+ * <code>Network</code> instances.
+ *
+ * TODO At the moment, this class uses the concrete class NetworkImpl to
+ * implement its only factory method. If we want to make this a real abstract
+ * factory, we need to replace the concrete constructor by reading the class
+ * name of the class implementing Network from a property file and invoking its
+ * constructor using reflection. Currently, this is the only place where we
+ * reference a class from the impl package.
+ *
+ * @author kloesing
+ */
+public abstract class NetworkFactory {
+
+ /**
+ * Creates a new network that is required for a test run. The new network is
+ * initially unpopulated and creates its own working directory at
+ * test-env/randomTestID/. The network automatically assigns port numbers to
+ * newly created nodes starting at <code>7000</code>.
+ *
+ * @param networkName
+ * Name of this network configuration.
+ * @return A new network instance.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public static Network createNetwork(String networkName)
+ throws RemoteException {
+ return new NetworkImpl(networkName);
+ }
+
+ /**
+ * Creates a new network that is required for a test run. The new network is
+ * initially unpopulated and creates its own working directory at
+ * test-env/randomTestID/. The network automatically assigns port numbers to
+ * newly created nodes starting at <code>startPort</code>.
+ *
+ * @param networkName
+ * Name of this network configuration.
+ * @param startPort
+ * The initial value for automatically assigned port numbers of
+ * nodes created by this <code>Network</code>; must be a value
+ * between <code>1024</code> and <code>65535</code>.
+ * Applications need to ensure that there are enough ports left
+ * to the maximum number port <code>65535</code> for all
+ * created nodes.
+ * @return A new network instance.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public static Network createNetwork(String networkName, int startPort)
+ throws RemoteException {
+ return new NetworkImpl(networkName, startPort);
+ }
+
+ /**
+ * Connects to a remote network and returns a reference on it.
+ *
+ * @param remoteHost
+ * The IP address and port of the remote <code>rmiregistry</code>.
+ * @param bindingName
+ * The name under which the other network is bound at the remote
+ * <code>rmiregistry</code>.
+ * @return Reference on the remote network.
+ * @throws PuppeTorException
+ * Thrown if an error occurs when looking up the remote network
+ * at the remote <code>rmiregistry</code>.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public static Network connectToNetwork(String remoteHost, String bindingName)
+ throws PuppeTorException, RemoteException {
+ Network remoteNetwork = null;
+ try {
+ remoteNetwork = (Network) Naming.lookup("rmi://" + remoteHost + "/"
+ + bindingName);
+ } catch (MalformedURLException e) {
+ PuppeTorException ex = new PuppeTorException(
+ "Cannot connect to remote network!", e);
+ throw ex;
+ } catch (NotBoundException e) {
+ PuppeTorException ex = new PuppeTorException(
+ "Cannot connect to remote network!", e);
+ throw ex;
+ }
+ return remoteNetwork;
+ }
+}
Copied: puppetor/trunk/src/org/torproject/puppetor/NodeEventType.java (from rev 17558, puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/NodeEventType.java)
===================================================================
--- puppetor/trunk/src/org/torproject/puppetor/NodeEventType.java (rev 0)
+++ puppetor/trunk/src/org/torproject/puppetor/NodeEventType.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2007, Karsten Loesing
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.torproject.puppetor;
+
+/**
+ * Event types that can be fired by all Tor processes.
+ */
+@SuppressWarnings("serial")
+public class NodeEventType implements EventType {
+
+ /**
+ * String identifying the type of the event type.
+ */
+ String typeString;
+
+ /**
+ * Creates a new event type with the given type string.
+ *
+ * @param typeString
+ * String identifying the type of the event type.
+ */
+ public NodeEventType(String typeString) {
+ this.typeString = typeString;
+ }
+
+ public String getTypeName() {
+ return this.typeString;
+ }
+
+ /**
+ * The node was started and we managed to connect to its control port; this
+ * event is fired internally and not parsed from a log statement from Tor.
+ */
+ public static final NodeEventType NODE_STARTED = new NodeEventType(
+ "NODE_STARTED");
+
+ /**
+ * The node has opened its control port; this event is parsed from a log
+ * statement in connection_create_listener().
+ */
+ public static final NodeEventType NODE_CONTROL_PORT_OPENED = new NodeEventType(
+ "NODE_CONTROL_PORT_OPENED");
+
+ /**
+ * The node which has successfully opened a circuit; this event is parsed
+ * from a log statement in circuit_send_next_onion_skin().
+ */
+ public static final NodeEventType NODE_CIRCUIT_OPENED = new NodeEventType(
+ "NODE_CIRCUIT_OPENED");
+
+ /**
+ * The node was stopped; this event is fired internally and not parsed from
+ * a log statement from Tor.
+ */
+ public static final NodeEventType NODE_STOPPED = new NodeEventType(
+ "NODE_STOPPED");
+}
\ No newline at end of file
Copied: puppetor/trunk/src/org/torproject/puppetor/NodeState.java (from rev 17558, puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/NodeState.java)
===================================================================
--- puppetor/trunk/src/org/torproject/puppetor/NodeState.java (rev 0)
+++ puppetor/trunk/src/org/torproject/puppetor/NodeState.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2007, Karsten Loesing
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.torproject.puppetor;
+
+/**
+ * The <code>NodeState</code> constitutes the state of a single Tor node. In
+ * contrast to <code>EventType</code> the node states depend only on the
+ * methods that have been invoked on these objects, and not on asynchronous
+ * state changes. Most operations of <code>ProxyNode</code> and its subclasses
+ * require a certain <code>NodeState</code> as precondition and may ensure
+ * another <code>NodeState</code> as postcondition. There is a prescribed
+ * order of states.
+ *
+ * @author kloesing
+ */
+public enum NodeState {
+
+ /**
+ * The configuration of this node has not been written to disk. This is the
+ * initial state of a <code>ProxyNode</code> or one of its subclasses.
+ */
+ CONFIGURING,
+
+ /**
+ * The configuration of this node has been written to disk, but the Tor
+ * process has not been started, yet. This state could be useful to review
+ * the configuration that has been written to disk.
+ */
+ CONFIGURATION_WRITTEN,
+
+ /**
+ * The node has been started and is running.
+ */
+ RUNNING,
+
+ /**
+ * The node had been started and shut down. It cannot be started at a later
+ * time anymore.
+ */
+ SHUT_DOWN
+}
Copied: puppetor/trunk/src/org/torproject/puppetor/ProxyNode.java (from rev 17558, puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/ProxyNode.java)
===================================================================
--- puppetor/trunk/src/org/torproject/puppetor/ProxyNode.java (rev 0)
+++ puppetor/trunk/src/org/torproject/puppetor/ProxyNode.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -0,0 +1,335 @@
+/*
+ * Copyright (c) 2007, Karsten Loesing
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.torproject.puppetor;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.util.List;
+
+/**
+ * <p>
+ * A <code>ProxyNode</code> represents a Tor process that is configured as
+ * onion proxy, i.e. to relay traffic from a local application to the Tor
+ * network and vice versa, and does not route traffic on behalf of remote
+ * applications. It is the superclass for other node types that extend the
+ * configuration of a </code>ProxyNode</code>.
+ * </p>
+ *
+ * <p>
+ * <b>Pay extra attention when using in private network!</b> Using proxy nodes
+ * in private networks in the same way as router nodes will fail! Tor has two
+ * different strategies for downloading network status documents: Directory
+ * caches (router nodes) download these documents after every HUP signal and
+ * then accept all contained router entries. But directory clients (proxy nodes)
+ * only download network status documents, if the most recent download lies at
+ * least 30 minutes in the past, and then accept only those of the contained
+ * router entries that are at least 10 minutes old. However, when starting all
+ * nodes of a private network at once, directories cannot contain 10 minutes old
+ * router descriptors. You have at least the following options to cope with this
+ * problem:
+ * </p>
+ *
+ * <ul>
+ * <li>Use router nodes instead of proxy nodes,</li>
+ * <li>start proxy nodes with a delay of at least 10 minutes to be sure that
+ * the router descriptors stored at directory authorities will be accepted by
+ * directory clients, or</li>
+ * <li>change the constants <code>ESTIMATED_PROPAGATION_TIME</code> and
+ * <code>NETWORKSTATUS_CLIENT_DL_INTERVAL</code> in Tor to values smaller than
+ * your overall HUP time for starting the network.</li>
+ * </ul>
+ *
+ * @author kloesing
+ */
+public interface ProxyNode extends Remote {
+
+ /**
+ * Adds the entries for a hidden service to the configuration of this node.
+ *
+ * @param serviceName
+ * Name of the hidden service that will be used as name for the
+ * hidden service directory. May neither be <code>null</code>
+ * or a zero-length string.
+ * @param servicePort
+ * The TCP port on which the service will be available for
+ * requests. This can, but need not be different from the virtual
+ * port that is announced to clients. May not be negative or
+ * greater than 65535.
+ * @param virtualPort
+ * The virtual TCP port that this hidden service runs on as it is
+ * announced to clients. May not be negative or greater than
+ * 65535.
+ * @return <code>HiddenService</code> object containing the configuration
+ * of the created hidden service.
+ * @throws IllegalArgumentException
+ * Thrown if an invalid value is given for either of the
+ * parameters.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract HiddenService addHiddenService(String serviceName,
+ int servicePort, int virtualPort) throws RemoteException;
+
+ /**
+ * Adds the entries for a hidden service with virtual port 80 to the
+ * configuration of this node.
+ *
+ * @param serviceName
+ * Name of the hidden service that will be used as name for the
+ * hidden service directory. May neither be <code>null</code>
+ * or a zero-length string.
+ * @param servicePort
+ * The TCP port on which the service will be available for
+ * requests. This can, but need not be different from the virtual
+ * port that is announced to clients. May not be negative or
+ * greater than 65535.
+ * @return <code>HiddenService</code> object containing the configuration
+ * of the created hidden service.
+ * @throws IllegalArgumentException
+ * Thrown if an invalid value is given for either of the
+ * parameters.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract HiddenService addHiddenService(String serviceName,
+ int servicePort) throws RemoteException;
+
+ /**
+ * Adds the entries for a hidden service with an automatically assigned
+ * service port and virtual port 80 to the configuration of this node.
+ *
+ * service port automatically assigned virtual port 80
+ *
+ * @param serviceName
+ * Name of the hidden service that will be used as name for the
+ * hidden service directory. May neither be <code>null</code>
+ * or a zero-length string.
+ * @return <code>HiddenService</code> object containing the configuration
+ * of the created hidden service.
+ * @throws IllegalArgumentException
+ * Thrown if an invalid value is given for the parameter.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract HiddenService addHiddenService(String serviceName)
+ throws RemoteException;
+
+ /**
+ * Adds the given configuration string, consisting of "<configuration key>
+ * <configuration value>", to the configuration of this node.
+ *
+ * @param configurationString
+ * The configuration string to be added.
+ * @throws IllegalArgumentException
+ * Thrown if the given configuration string is either
+ * <code>null</code>, a zero-length string, or does not
+ * consist of configuration key and value.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract void addConfiguration(String configurationString)
+ throws RemoteException;
+
+ /**
+ * Adds the given configuration strings, each consisting of "<configuration
+ * key> <configuration value>", to the configuration of this node.
+ *
+ * @param configurationStrings
+ * A list of the configuration strings to be added.
+ * @throws IllegalArgumentException
+ * Thrown if the given list is <code>null</code>, or any of
+ * the contained strings is either <code>null</code>, a
+ * zero-length string, or does not consist of configuration key
+ * and value.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract void addConfigurations(List<String> configurationStrings)
+ throws RemoteException;
+
+ /**
+ * Replaces the first configuration string, consisting of "<configuration
+ * key> <configuration value>", that contains the same configuration key as
+ * <code>configurationString</code> by this new configuration string; if
+ * multiple occurrences of the given configuration key are found, only the
+ * first occurrence is replaced; if no configuration can be found, the
+ * configuration string is appended.
+ *
+ * @param configurationString
+ * The replacing configuration string.
+ * @throws IllegalArgumentException
+ * Thrown if the given configuration string is either
+ * <code>null</code>, a zero-length string, or does not
+ * consist of configuration key and value.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract void replaceConfiguration(String configurationString)
+ throws RemoteException;
+
+ /**
+ * Removes all configuration strings containing the given configuration key
+ * in "<configuration key> <configuration value>", regardless of their
+ * configuration value.
+ *
+ * @param configurationKey
+ * The configuration key to remove.
+ * @throws IllegalArgumentException
+ * Thrown if the given configuration key is either
+ * <code>null</code> or a zero-length key.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract void removeConfiguration(String configurationKey)
+ throws RemoteException;
+
+ /**
+ * Returns the name of this node.
+ *
+ * @return The name of this node.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract String getNodeName() throws RemoteException;
+
+ /**
+ * Returns the state of this node.
+ *
+ * @return The state of this node.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract NodeState getNodeState() throws RemoteException;
+
+ /**
+ * Sends a HUP command to the process via its control port to restart it;
+ * can only be done if the node has already been started, i.e. is in state
+ * <code>NodeState.RUNNING</code>!
+ *
+ * @throws PuppeTorException
+ * Thrown if an I/O problem occurs while sending the HUP signal.
+ * @throws IllegalStateException
+ * Thrown if node is not in state <code>NodeState.RUNNING</code>.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract void hup() throws PuppeTorException, RemoteException;
+
+ /**
+ * Shuts down the Tor process corresponding to this node immediately. This
+ * is done by sending the <code>SHUTDOWN</code> signal twice, so that
+ * those nodes extending <code>ProxyNode</code> which have opened their OR
+ * port shutdown immediately, too.
+ *
+ * @throws IllegalStateException
+ * Thrown if this node is not in state
+ * <code>NodeState.RUNNING</code>.
+ * @throws PuppeTorException
+ * Thrown if an I/O problem occurs while sending the
+ * <code>SHUTDOWN</code> signal.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract void shutdown() throws PuppeTorException, RemoteException;
+
+ /**
+ * Starts the Tor process for this node and connects to the control port as
+ * soon as it is opened. <b>In order for this method to succeed it is
+ * absolutely necessary, that logging on the console is not changed in the
+ * configuration of this node to a higher level than NOTICE, because the
+ * output is parsed to see when the control port is opened.</b>
+ *
+ * @param maximumTimeToWaitInMillis
+ * Maximum time in milliseconds we will wait for the Tor process
+ * to be started and the control port being opened. If this value
+ * is negative or zero, we will wait potentially forever.
+ * @return <code>true</code> if the node could be started successfully,
+ * <code>false</code> otherwise.
+ * @throws IllegalStateException
+ * Thrown if node is not in state
+ * <code>NodeState.CONFIGURATION_WRITTEN</code>, i.e. if
+ * either configuration has not been written or the process has
+ * already been started.
+ * @throws PuppeTorException
+ * Thrown if either the process could not be started, or the
+ * connection to the control port could not be established.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract boolean startNode(long maximumTimeToWaitInMillis)
+ throws PuppeTorException, RemoteException;
+
+ /**
+ * Writes the configuration of this node to the <code>torrc</code> file in
+ * its working directory and changes the state to
+ * <code>NodeState.CONFIGURATION_WRITTEN</code>, if it was in state
+ * <code>NodeState.CONFIGURING</code> before.
+ *
+ * @throws PuppeTorException
+ * Thrown if the configuration file <code>torrc</code> cannot
+ * be written to disk.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract void writeConfiguration() throws PuppeTorException,
+ RemoteException;
+
+ /**
+ * Returns the SOCKS port of this node.
+ *
+ * @return The SOCKS port of this node.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract int getSocksPort() throws RemoteException;
+
+ /**
+ * Returns the control port of this node.
+ *
+ * @return The control port of this node.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract int getControlPort() throws RemoteException;
+
+ /**
+ * Returns (a copy of) the list of strings containing the configuration of
+ * this node.
+ *
+ * @return (A copy of) the list of strings containing the configuration of
+ * this node.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract List<String> getConfiguration() throws RemoteException;
+
+}
Copied: puppetor/trunk/src/org/torproject/puppetor/PuppeTorException.java (from rev 17558, puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/PuppeTorException.java)
===================================================================
--- puppetor/trunk/src/org/torproject/puppetor/PuppeTorException.java (rev 0)
+++ puppetor/trunk/src/org/torproject/puppetor/PuppeTorException.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2007, Karsten Loesing
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.torproject.puppetor;
+
+/**
+ * The <code>PuppeTorException</code> comprises all kinds of checked
+ * exceptions that occur when interacting with the JVM-external Tor processes or
+ * with the local file system. Any occurence of this exception denotes either a
+ * configuration problem that can only be solved outside of the JVM, or an
+ * unexpected problem. In contrast to this, all kinds of programming errors of
+ * an application using this API (invoking a method with wrong parameter values,
+ * in wrong state, etc.) will instead cause appropriate runtime exceptions from
+ * the Java API.
+ *
+ * @author kloesing
+ */
+@SuppressWarnings("serial")
+public class PuppeTorException extends Exception {
+
+ /**
+ * Creates a <code>PuppeTorException</code> without detail message or
+ * cause.
+ */
+ public PuppeTorException() {
+ super();
+ }
+
+ /**
+ * Creates a <code>PuppeTorException</code> with the given detail
+ * <code>message</code> and <code>cause</code>.
+ *
+ * @param message
+ * The detail message of this exception.
+ * @param cause
+ * The cause for this exception.
+ */
+ public PuppeTorException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Creates a <code>PuppeTorException</code> with the given detail
+ * <code>message</code>, but without a <code>cause</code>.
+ *
+ * @param message
+ * The detail message of this exception.
+ */
+ public PuppeTorException(String message) {
+ super(message);
+ }
+
+ /**
+ * Creates a <code>PuppeTorException</code> with the given
+ * <code>cause</code>, but without a detail message.
+ *
+ * @param cause
+ * The cause for this exception.
+ */
+ public PuppeTorException(Throwable cause) {
+ super(cause);
+ }
+}
Copied: puppetor/trunk/src/org/torproject/puppetor/RouterNode.java (from rev 17558, puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/RouterNode.java)
===================================================================
--- puppetor/trunk/src/org/torproject/puppetor/RouterNode.java (rev 0)
+++ puppetor/trunk/src/org/torproject/puppetor/RouterNode.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2007, Karsten Loesing
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.torproject.puppetor;
+
+import java.rmi.RemoteException;
+
+/**
+ * A <code>RouterNode</code> represents a Tor process that is configured to
+ * both, relay traffic from a local application to the Tor network and to route
+ * traffic on behalf of remote applications. It inherits most of its
+ * configuration and behavior from its superclass <code>ProxyNode</code> and
+ * adds some router-specific configurations and behavior.
+ *
+ * @author kloesing
+ */
+public interface RouterNode extends ProxyNode {
+
+ /**
+ * Returns the dir port of this node.
+ *
+ * @return The dir port of this node.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract int getDirPort() throws RemoteException;
+
+ /**
+ * Returns the onion port of this node.
+ *
+ * @return The onion port of this node.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract int getOrPort() throws RemoteException;
+
+ /**
+ * <p>
+ * Returns the fingerprint string of this node, formatted like
+ * <code>nickname 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000</code>.
+ * </p>
+ *
+ * <p>
+ * The fingerprint is determined by a background thread that is started as
+ * soon as the node is instantiated. If this background thread has not
+ * finished when this method is invoked, the invoking thread will be blocked
+ * until the fingerprint is available (or determining it has failed,
+ * whereupon an exception will be thrown).
+ * </p>
+ *
+ * @return The fingerprint of this node.
+ * @throws PuppeTorException
+ * Thrown if either the temporary <code>torrc.temp</code>
+ * configuration file cannot be written, the Tor process cannot
+ * be started temporarily, or the fingerprint file cannot be
+ * read.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract String getFingerprint() throws PuppeTorException,
+ RemoteException;
+}
Copied: puppetor/trunk/src/org/torproject/puppetor/ServerApplication.java (from rev 17558, puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/ServerApplication.java)
===================================================================
--- puppetor/trunk/src/org/torproject/puppetor/ServerApplication.java (rev 0)
+++ puppetor/trunk/src/org/torproject/puppetor/ServerApplication.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2007, Karsten Loesing
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.torproject.puppetor;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/**
+ * The <code>ServerApplication</code> can be used as simple HTTP server that
+ * answers all <code>HTTP GET</code> requests by empty <code>HTTP OK</code>
+ * replies. Therefore, a thread will be started to listen for incoming requests
+ * in the background.
+ *
+ * @author kloesing
+ */
+public interface ServerApplication extends Remote {
+
+ /**
+ * Starts listening for incoming <code>HTTP GET</code> requests from
+ * clients. Any incoming request is answered by an empty
+ * <code>HTTP OK</code> reply. This method may only be invoked when the
+ * server is currently not in listening state!
+ *
+ * @throws IllegalStateException
+ * Thrown if the server is currently not in listening state.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract void startListening() throws RemoteException;
+
+ /**
+ * Stops listening for requests. This method may only be invoked when the
+ * server is currently in listening state!
+ *
+ * @throws IllegalStateException
+ * Thrown if the server is currently in listening state.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract void stopListening() throws RemoteException;
+
+ /**
+ * Returns whether this server is currently in listening state.
+ *
+ * @return The listening state of this server.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract boolean isListening() throws RemoteException;
+
+ /**
+ * Returns the name of this server.
+ *
+ * @return The name of this server.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract String getServerApplicationName() throws RemoteException;
+
+ /**
+ * Returns the port on which this server listens.
+ *
+ * @return The port on which this server listens.
+ * @throws RemoteException
+ * Thrown if an error occurs when accessed remotely.
+ */
+ public abstract int getServerPort() throws RemoteException;
+}
Copied: puppetor/trunk/src/org/torproject/puppetor/ServerEventType.java (from rev 17558, puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/ServerEventType.java)
===================================================================
--- puppetor/trunk/src/org/torproject/puppetor/ServerEventType.java (rev 0)
+++ puppetor/trunk/src/org/torproject/puppetor/ServerEventType.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2007, Karsten Loesing
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.torproject.puppetor;
+
+/**
+ * Event types that can be fired by a server application running as thread in
+ * the background.
+ */
+@SuppressWarnings("serial")
+public class ServerEventType implements EventType {
+
+ /**
+ * String identifying the type of the event type.
+ */
+ String typeString;
+
+ /**
+ * Creates a new event type with the given type string.
+ *
+ * @param typeString
+ * String identifying the type of the event type.
+ */
+ public ServerEventType(String typeString) {
+ this.typeString = typeString;
+ }
+
+ public String getTypeName() {
+ return this.typeString;
+ }
+
+ /**
+ * The server application has received a request and sent a reply to it;
+ * this event is fired internally and not parsed from a log statement from
+ * Tor.
+ */
+ public static final ServerEventType SERVER_RECEIVING_REQUEST_SENDING_REPLY = new ServerEventType(
+ "SERVER_RECEIVING_REQUEST_SENDING_REPLY");
+}
\ No newline at end of file
Copied: puppetor/trunk/src/org/torproject/puppetor/examples (from rev 17558, puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/examples)
Modified: puppetor/trunk/src/org/torproject/puppetor/examples/AccessingPublicWebServerOverTor.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/examples/AccessingPublicWebServerOverTor.java 2008-12-10 15:50:04 UTC (rev 17558)
+++ puppetor/trunk/src/org/torproject/puppetor/examples/AccessingPublicWebServerOverTor.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -29,20 +29,21 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-package de.uniba.wiai.lspi.puppetor.examples;
+package org.torproject.puppetor.examples;
import java.rmi.RemoteException;
-import de.uniba.wiai.lspi.puppetor.ClientApplication;
-import de.uniba.wiai.lspi.puppetor.ClientEventType;
-import de.uniba.wiai.lspi.puppetor.Event;
-import de.uniba.wiai.lspi.puppetor.EventListener;
-import de.uniba.wiai.lspi.puppetor.EventManager;
-import de.uniba.wiai.lspi.puppetor.Network;
-import de.uniba.wiai.lspi.puppetor.NetworkFactory;
-import de.uniba.wiai.lspi.puppetor.ProxyNode;
-import de.uniba.wiai.lspi.puppetor.PuppeTorException;
+import org.torproject.puppetor.ClientApplication;
+import org.torproject.puppetor.ClientEventType;
+import org.torproject.puppetor.Event;
+import org.torproject.puppetor.EventListener;
+import org.torproject.puppetor.EventManager;
+import org.torproject.puppetor.Network;
+import org.torproject.puppetor.NetworkFactory;
+import org.torproject.puppetor.ProxyNode;
+import org.torproject.puppetor.PuppeTorException;
+
/**
* Example for accessing a public web server (here: <code>www.google.com</code>)
* over Tor to measure the access time.
Modified: puppetor/trunk/src/org/torproject/puppetor/examples/AdvertisingAndAccessingHiddenServiceOverPrivateTorNetwork.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingAndAccessingHiddenServiceOverPrivateTorNetwork.java 2008-12-10 15:50:04 UTC (rev 17558)
+++ puppetor/trunk/src/org/torproject/puppetor/examples/AdvertisingAndAccessingHiddenServiceOverPrivateTorNetwork.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -29,23 +29,24 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-package de.uniba.wiai.lspi.puppetor.examples;
+package org.torproject.puppetor.examples;
import java.rmi.RemoteException;
-import de.uniba.wiai.lspi.puppetor.ClientApplication;
-import de.uniba.wiai.lspi.puppetor.ClientEventType;
-import de.uniba.wiai.lspi.puppetor.Event;
-import de.uniba.wiai.lspi.puppetor.EventListener;
-import de.uniba.wiai.lspi.puppetor.EventManager;
-import de.uniba.wiai.lspi.puppetor.HiddenService;
-import de.uniba.wiai.lspi.puppetor.HiddenServiceEventType;
-import de.uniba.wiai.lspi.puppetor.Network;
-import de.uniba.wiai.lspi.puppetor.NetworkFactory;
-import de.uniba.wiai.lspi.puppetor.PuppeTorException;
-import de.uniba.wiai.lspi.puppetor.RouterNode;
-import de.uniba.wiai.lspi.puppetor.ServerApplication;
+import org.torproject.puppetor.ClientApplication;
+import org.torproject.puppetor.ClientEventType;
+import org.torproject.puppetor.Event;
+import org.torproject.puppetor.EventListener;
+import org.torproject.puppetor.EventManager;
+import org.torproject.puppetor.HiddenService;
+import org.torproject.puppetor.HiddenServiceEventType;
+import org.torproject.puppetor.Network;
+import org.torproject.puppetor.NetworkFactory;
+import org.torproject.puppetor.PuppeTorException;
+import org.torproject.puppetor.RouterNode;
+import org.torproject.puppetor.ServerApplication;
+
/**
* Example for advertising and accessing a hidden service over a private Tor
* network.
Modified: puppetor/trunk/src/org/torproject/puppetor/examples/AdvertisingAndAccessingHiddenServiceOverPublicTorNetwork.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingAndAccessingHiddenServiceOverPublicTorNetwork.java 2008-12-10 15:50:04 UTC (rev 17558)
+++ puppetor/trunk/src/org/torproject/puppetor/examples/AdvertisingAndAccessingHiddenServiceOverPublicTorNetwork.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -29,24 +29,25 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-package de.uniba.wiai.lspi.puppetor.examples;
+package org.torproject.puppetor.examples;
import java.rmi.RemoteException;
-import de.uniba.wiai.lspi.puppetor.ClientApplication;
-import de.uniba.wiai.lspi.puppetor.ClientEventType;
-import de.uniba.wiai.lspi.puppetor.Event;
-import de.uniba.wiai.lspi.puppetor.EventListener;
-import de.uniba.wiai.lspi.puppetor.EventManager;
-import de.uniba.wiai.lspi.puppetor.HiddenService;
-import de.uniba.wiai.lspi.puppetor.HiddenServiceEventType;
-import de.uniba.wiai.lspi.puppetor.Network;
-import de.uniba.wiai.lspi.puppetor.NetworkFactory;
-import de.uniba.wiai.lspi.puppetor.ProxyNode;
-import de.uniba.wiai.lspi.puppetor.PuppeTorException;
-import de.uniba.wiai.lspi.puppetor.ServerApplication;
-import de.uniba.wiai.lspi.puppetor.ServerEventType;
+import org.torproject.puppetor.ClientApplication;
+import org.torproject.puppetor.ClientEventType;
+import org.torproject.puppetor.Event;
+import org.torproject.puppetor.EventListener;
+import org.torproject.puppetor.EventManager;
+import org.torproject.puppetor.HiddenService;
+import org.torproject.puppetor.HiddenServiceEventType;
+import org.torproject.puppetor.Network;
+import org.torproject.puppetor.NetworkFactory;
+import org.torproject.puppetor.ProxyNode;
+import org.torproject.puppetor.PuppeTorException;
+import org.torproject.puppetor.ServerApplication;
+import org.torproject.puppetor.ServerEventType;
+
/**
* Example for advertising and accessing a hidden service over the public Tor
* network.
Modified: puppetor/trunk/src/org/torproject/puppetor/examples/AdvertisingHiddenServiceToPublicTorNetwork.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingHiddenServiceToPublicTorNetwork.java 2008-12-10 15:50:04 UTC (rev 17558)
+++ puppetor/trunk/src/org/torproject/puppetor/examples/AdvertisingHiddenServiceToPublicTorNetwork.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -29,20 +29,21 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-package de.uniba.wiai.lspi.puppetor.examples;
+package org.torproject.puppetor.examples;
import java.rmi.RemoteException;
-import de.uniba.wiai.lspi.puppetor.Event;
-import de.uniba.wiai.lspi.puppetor.EventListener;
-import de.uniba.wiai.lspi.puppetor.EventManager;
-import de.uniba.wiai.lspi.puppetor.HiddenServiceEventType;
-import de.uniba.wiai.lspi.puppetor.Network;
-import de.uniba.wiai.lspi.puppetor.NetworkFactory;
-import de.uniba.wiai.lspi.puppetor.NodeEventType;
-import de.uniba.wiai.lspi.puppetor.ProxyNode;
-import de.uniba.wiai.lspi.puppetor.PuppeTorException;
+import org.torproject.puppetor.Event;
+import org.torproject.puppetor.EventListener;
+import org.torproject.puppetor.EventManager;
+import org.torproject.puppetor.HiddenServiceEventType;
+import org.torproject.puppetor.Network;
+import org.torproject.puppetor.NetworkFactory;
+import org.torproject.puppetor.NodeEventType;
+import org.torproject.puppetor.ProxyNode;
+import org.torproject.puppetor.PuppeTorException;
+
/**
* Example for advertising a hidden service to the public Tor network and
* observing the publication of rendezvous service descriptors.
Modified: puppetor/trunk/src/org/torproject/puppetor/examples/LongRunningNetwork.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/examples/LongRunningNetwork.java 2008-12-10 15:50:04 UTC (rev 17558)
+++ puppetor/trunk/src/org/torproject/puppetor/examples/LongRunningNetwork.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -31,14 +31,15 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-package de.uniba.wiai.lspi.puppetor.examples;
+package org.torproject.puppetor.examples;
import java.rmi.RemoteException;
-import de.uniba.wiai.lspi.puppetor.Network;
-import de.uniba.wiai.lspi.puppetor.NetworkFactory;
-import de.uniba.wiai.lspi.puppetor.PuppeTorException;
+import org.torproject.puppetor.Network;
+import org.torproject.puppetor.NetworkFactory;
+import org.torproject.puppetor.PuppeTorException;
+
/**
* Example for starting and running a private network of routers and directories
* that may be accessed via RMI, e.g. to be merged with another network.
Modified: puppetor/trunk/src/org/torproject/puppetor/examples/MergingRoutersWithLongRunningNetwork.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/examples/MergingRoutersWithLongRunningNetwork.java 2008-12-10 15:50:04 UTC (rev 17558)
+++ puppetor/trunk/src/org/torproject/puppetor/examples/MergingRoutersWithLongRunningNetwork.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -30,24 +30,25 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-package de.uniba.wiai.lspi.puppetor.examples;
+package org.torproject.puppetor.examples;
import java.rmi.RemoteException;
-import de.uniba.wiai.lspi.puppetor.ClientApplication;
-import de.uniba.wiai.lspi.puppetor.ClientEventType;
-import de.uniba.wiai.lspi.puppetor.Event;
-import de.uniba.wiai.lspi.puppetor.EventListener;
-import de.uniba.wiai.lspi.puppetor.EventManager;
-import de.uniba.wiai.lspi.puppetor.HiddenService;
-import de.uniba.wiai.lspi.puppetor.HiddenServiceEventType;
-import de.uniba.wiai.lspi.puppetor.Network;
-import de.uniba.wiai.lspi.puppetor.NetworkFactory;
-import de.uniba.wiai.lspi.puppetor.PuppeTorException;
-import de.uniba.wiai.lspi.puppetor.RouterNode;
-import de.uniba.wiai.lspi.puppetor.ServerApplication;
-import de.uniba.wiai.lspi.puppetor.ServerEventType;
+import org.torproject.puppetor.ClientApplication;
+import org.torproject.puppetor.ClientEventType;
+import org.torproject.puppetor.Event;
+import org.torproject.puppetor.EventListener;
+import org.torproject.puppetor.EventManager;
+import org.torproject.puppetor.HiddenService;
+import org.torproject.puppetor.HiddenServiceEventType;
+import org.torproject.puppetor.Network;
+import org.torproject.puppetor.NetworkFactory;
+import org.torproject.puppetor.PuppeTorException;
+import org.torproject.puppetor.RouterNode;
+import org.torproject.puppetor.ServerApplication;
+import org.torproject.puppetor.ServerEventType;
+
/**
* Example for a private network of routers without directories that is merged
* with another, long-running private network that contains routers and
Copied: puppetor/trunk/src/org/torproject/puppetor/impl (from rev 17558, puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl)
Modified: puppetor/trunk/src/org/torproject/puppetor/impl/ClientApplicationImpl.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/ClientApplicationImpl.java 2008-12-10 15:50:04 UTC (rev 17558)
+++ puppetor/trunk/src/org/torproject/puppetor/impl/ClientApplicationImpl.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -29,7 +29,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-package de.uniba.wiai.lspi.puppetor.impl;
+package org.torproject.puppetor.impl;
import java.io.BufferedReader;
import java.io.IOException;
@@ -45,9 +45,10 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-import de.uniba.wiai.lspi.puppetor.ClientApplication;
-import de.uniba.wiai.lspi.puppetor.ClientEventType;
+import org.torproject.puppetor.ClientApplication;
+import org.torproject.puppetor.ClientEventType;
+
/**
* Implementation of <code>ClientApplication</code>.
*
Modified: puppetor/trunk/src/org/torproject/puppetor/impl/DirectoryNodeImpl.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/DirectoryNodeImpl.java 2008-12-10 15:50:04 UTC (rev 17558)
+++ puppetor/trunk/src/org/torproject/puppetor/impl/DirectoryNodeImpl.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -29,7 +29,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-package de.uniba.wiai.lspi.puppetor.impl;
+package org.torproject.puppetor.impl;
import java.io.BufferedReader;
import java.io.BufferedWriter;
@@ -48,9 +48,10 @@
import java.util.TreeSet;
import java.util.logging.Level;
-import de.uniba.wiai.lspi.puppetor.DirectoryNode;
-import de.uniba.wiai.lspi.puppetor.PuppeTorException;
+import org.torproject.puppetor.DirectoryNode;
+import org.torproject.puppetor.PuppeTorException;
+
/**
* Implementation of <code>DirectoryNode</code>.
*
Modified: puppetor/trunk/src/org/torproject/puppetor/impl/EventImpl.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/EventImpl.java 2008-12-10 15:50:04 UTC (rev 17558)
+++ puppetor/trunk/src/org/torproject/puppetor/impl/EventImpl.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -29,13 +29,14 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-package de.uniba.wiai.lspi.puppetor.impl;
+package org.torproject.puppetor.impl;
import java.util.Date;
-import de.uniba.wiai.lspi.puppetor.Event;
-import de.uniba.wiai.lspi.puppetor.EventType;
+import org.torproject.puppetor.Event;
+import org.torproject.puppetor.EventType;
+
/**
* Implementation of <code>Event</code>.
*
Modified: puppetor/trunk/src/org/torproject/puppetor/impl/EventManagerImpl.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/EventManagerImpl.java 2008-12-10 15:50:04 UTC (rev 17558)
+++ puppetor/trunk/src/org/torproject/puppetor/impl/EventManagerImpl.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -29,7 +29,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-package de.uniba.wiai.lspi.puppetor.impl;
+package org.torproject.puppetor.impl;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
@@ -51,13 +51,14 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import de.uniba.wiai.lspi.puppetor.Event;
-import de.uniba.wiai.lspi.puppetor.EventListener;
-import de.uniba.wiai.lspi.puppetor.EventManager;
-import de.uniba.wiai.lspi.puppetor.EventType;
-import de.uniba.wiai.lspi.puppetor.HiddenServiceEventType;
-import de.uniba.wiai.lspi.puppetor.NodeEventType;
+import org.torproject.puppetor.Event;
+import org.torproject.puppetor.EventListener;
+import org.torproject.puppetor.EventManager;
+import org.torproject.puppetor.EventType;
+import org.torproject.puppetor.HiddenServiceEventType;
+import org.torproject.puppetor.NodeEventType;
+
/**
* Implementation of <code>EventManager</code>.
*
Modified: puppetor/trunk/src/org/torproject/puppetor/impl/HiddenServiceImpl.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/HiddenServiceImpl.java 2008-12-10 15:50:04 UTC (rev 17558)
+++ puppetor/trunk/src/org/torproject/puppetor/impl/HiddenServiceImpl.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -1,4 +1,4 @@
-package de.uniba.wiai.lspi.puppetor.impl;
+package org.torproject.puppetor.impl;
import java.io.BufferedReader;
import java.io.File;
@@ -9,9 +9,10 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-import de.uniba.wiai.lspi.puppetor.HiddenService;
-import de.uniba.wiai.lspi.puppetor.PuppeTorException;
+import org.torproject.puppetor.HiddenService;
+import org.torproject.puppetor.PuppeTorException;
+
/**
* Implementation of <code>HiddenService</code>.
*
Modified: puppetor/trunk/src/org/torproject/puppetor/impl/NetworkImpl.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/NetworkImpl.java 2008-12-10 15:50:04 UTC (rev 17558)
+++ puppetor/trunk/src/org/torproject/puppetor/impl/NetworkImpl.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -29,7 +29,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-package de.uniba.wiai.lspi.puppetor.impl;
+package org.torproject.puppetor.impl;
import java.io.File;
import java.net.MalformedURLException;
@@ -47,19 +47,20 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-import de.uniba.wiai.lspi.puppetor.ClientApplication;
-import de.uniba.wiai.lspi.puppetor.DirectoryNode;
-import de.uniba.wiai.lspi.puppetor.Event;
-import de.uniba.wiai.lspi.puppetor.EventListener;
-import de.uniba.wiai.lspi.puppetor.EventManager;
-import de.uniba.wiai.lspi.puppetor.Network;
-import de.uniba.wiai.lspi.puppetor.NodeEventType;
-import de.uniba.wiai.lspi.puppetor.NodeState;
-import de.uniba.wiai.lspi.puppetor.ProxyNode;
-import de.uniba.wiai.lspi.puppetor.PuppeTorException;
-import de.uniba.wiai.lspi.puppetor.RouterNode;
-import de.uniba.wiai.lspi.puppetor.ServerApplication;
+import org.torproject.puppetor.ClientApplication;
+import org.torproject.puppetor.DirectoryNode;
+import org.torproject.puppetor.Event;
+import org.torproject.puppetor.EventListener;
+import org.torproject.puppetor.EventManager;
+import org.torproject.puppetor.Network;
+import org.torproject.puppetor.NodeEventType;
+import org.torproject.puppetor.NodeState;
+import org.torproject.puppetor.ProxyNode;
+import org.torproject.puppetor.PuppeTorException;
+import org.torproject.puppetor.RouterNode;
+import org.torproject.puppetor.ServerApplication;
+
/**
* Implementation of <code>Network</code>.
*
Modified: puppetor/trunk/src/org/torproject/puppetor/impl/ProxyNodeImpl.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/ProxyNodeImpl.java 2008-12-10 15:50:04 UTC (rev 17558)
+++ puppetor/trunk/src/org/torproject/puppetor/impl/ProxyNodeImpl.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -29,7 +29,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-package de.uniba.wiai.lspi.puppetor.impl;
+package org.torproject.puppetor.impl;
import java.io.BufferedReader;
import java.io.BufferedWriter;
@@ -46,12 +46,13 @@
import java.util.logging.Level;
import java.util.logging.Logger;
+import org.torproject.puppetor.HiddenService;
+import org.torproject.puppetor.NodeEventType;
+import org.torproject.puppetor.NodeState;
+import org.torproject.puppetor.ProxyNode;
+import org.torproject.puppetor.PuppeTorException;
+
import net.freehaven.tor.control.TorControlConnection;
-import de.uniba.wiai.lspi.puppetor.HiddenService;
-import de.uniba.wiai.lspi.puppetor.NodeEventType;
-import de.uniba.wiai.lspi.puppetor.NodeState;
-import de.uniba.wiai.lspi.puppetor.ProxyNode;
-import de.uniba.wiai.lspi.puppetor.PuppeTorException;
/**
* Implementation of <code>ProxyNode</code>.
Modified: puppetor/trunk/src/org/torproject/puppetor/impl/RouterNodeImpl.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/RouterNodeImpl.java 2008-12-10 15:50:04 UTC (rev 17558)
+++ puppetor/trunk/src/org/torproject/puppetor/impl/RouterNodeImpl.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -29,7 +29,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-package de.uniba.wiai.lspi.puppetor.impl;
+package org.torproject.puppetor.impl;
import java.io.BufferedReader;
import java.io.BufferedWriter;
@@ -43,9 +43,10 @@
import java.util.logging.Level;
import java.util.regex.Pattern;
-import de.uniba.wiai.lspi.puppetor.PuppeTorException;
-import de.uniba.wiai.lspi.puppetor.RouterNode;
+import org.torproject.puppetor.PuppeTorException;
+import org.torproject.puppetor.RouterNode;
+
/**
* Implementation of <code>RouterNode</code>.
*
Modified: puppetor/trunk/src/org/torproject/puppetor/impl/ServerApplicationImpl.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/ServerApplicationImpl.java 2008-12-10 15:50:04 UTC (rev 17558)
+++ puppetor/trunk/src/org/torproject/puppetor/impl/ServerApplicationImpl.java 2008-12-10 16:05:40 UTC (rev 17559)
@@ -29,7 +29,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-package de.uniba.wiai.lspi.puppetor.impl;
+package org.torproject.puppetor.impl;
import java.io.BufferedReader;
import java.io.IOException;
@@ -42,9 +42,10 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-import de.uniba.wiai.lspi.puppetor.ServerApplication;
-import de.uniba.wiai.lspi.puppetor.ServerEventType;
+import org.torproject.puppetor.ServerApplication;
+import org.torproject.puppetor.ServerEventType;
+
/**
* Implementation of <code>ServerApplication</code>.
*