[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r11662: replaced event type enumeration by extensible type hierarchy (in puppetor/trunk/src/de/uniba/wiai/lspi/puppetor: . examples impl)
Author: kloesing
Date: 2007-09-27 08:12:26 -0400 (Thu, 27 Sep 2007)
New Revision: 11662
Added:
puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/AliceEventType.java
puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/BobEventType.java
puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/ClientEventType.java
puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/MiscEventType.java
puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/NodeEventType.java
puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/ServerEventType.java
Modified:
puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/EventType.java
puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/examples/AccessingPublicWebServerOverTor.java
puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingAndAccessingHiddenServiceOverPrivateTorNetwork.java
puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingAndAccessingHiddenServiceOverPublicTorNetwork.java
puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingHiddenServiceToPublicTorNetwork.java
puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/ClientApplicationImpl.java
puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/EventManagerImpl.java
puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/NetworkImpl.java
puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/ProxyNodeImpl.java
puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/ServerApplicationImpl.java
Log:
replaced event type enumeration by extensible type hierarchy
Added: puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/AliceEventType.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/AliceEventType.java (rev 0)
+++ puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/AliceEventType.java 2007-09-27 12:12:26 UTC (rev 11662)
@@ -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 de.uniba.wiai.lspi.puppetor;
+
+public class AliceEventType implements EventType{
+
+ /**
+ * Alice has received an onion request; this event is parsed from a log
+ * statement in connection_ap_handshake_rewrite_and_attach().
+ */
+ public static final AliceEventType ALICE_ONION_REQUEST_RECEIVED = new AliceEventType();
+
+ /**
+ * 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 AliceEventType ALICE_SENDING_FETCH_DESC = new AliceEventType();
+
+ /**
+ * 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 AliceEventType ALICE_DESC_FETCHED_RECEIVED = new AliceEventType();
+
+ /**
+ * 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 AliceEventType ALICE_BUILT_REND_CIRC_SENDING_ESTABLISH_RENDEZVOUS = new AliceEventType();
+
+ /**
+ * 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 AliceEventType ALICE_RENDEZVOUS_ESTABLISHED_RECEIVED = new AliceEventType();
+
+ /**
+ * 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 AliceEventType ALICE_BUILT_INTRO_CIRC = new AliceEventType();
+
+ /**
+ * 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 AliceEventType ALICE_SENDING_INTRODUCE1 = new AliceEventType();
+
+ /**
+ * Alice has received an INTRODUCE_ACK cell as an acknowledgement to the
+ * previous INTRODUCE1 cell; this event is parsed from a log statement in
+ * rend_client_introduction_acked().
+ */
+ public static final AliceEventType ALICE_INTRODUCE_ACK_RECEIVED = new AliceEventType();
+
+ /**
+ * 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 AliceEventType ALICE_RENDEZVOUS2_RECEIVED_APP_CONN_OPENED = new AliceEventType();
+}
\ No newline at end of file
Added: puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/BobEventType.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/BobEventType.java (rev 0)
+++ puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/BobEventType.java 2007-09-27 12:12:26 UTC (rev 11662)
@@ -0,0 +1,85 @@
+/*
+ * 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 de.uniba.wiai.lspi.puppetor;
+
+public class BobEventType implements EventType{
+
+ /**
+ * 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 BobEventType BOB_BUILT_INTRO_CIRC_SENDING_ESTABLISH_INTRO = new BobEventType();
+
+ /**
+ * 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 BobEventType BOB_INTRO_ESTABLISHED_RECEIVED = new BobEventType();
+
+ /**
+ * Bob posts a hidden service descriptor to the directory servers (or to
+ * hidden service directories in a modified Tor); this event is parsed from
+ * a log statement in upload_service_descriptor().
+ */
+ public static final BobEventType BOB_SENDING_PUBLISH_DESC = new BobEventType();
+
+ /**
+ * Bob received a response from a directory server (or from a hidden service
+ * directory in a modified Tor) to a previous publish request; this event is
+ * parsed from a log statement in connection_dir_client_reached_eof().
+ */
+ public static final BobEventType BOB_DESC_PUBLISHED_RECEIVED = new BobEventType();
+
+ /**
+ * 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 BobEventType BOB_INTRODUCE2_RECEIVED = new BobEventType();
+
+ /**
+ * Bob has built a circuit to a rendezvous point and sends an RENDEZVOUS1
+ * cell; this event is parsed from a log statement in
+ * rend_service_rendezvous_has_opened().
+ */
+ public static final BobEventType BOB_BUILT_REND_CIRC_SENDING_RENDEZVOUS1 = new BobEventType();
+
+ /**
+ * 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 BobEventType BOB_APP_CONN_OPENED = new BobEventType();
+
+}
\ No newline at end of file
Added: puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/ClientEventType.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/ClientEventType.java (rev 0)
+++ puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/ClientEventType.java 2007-09-27 12:12:26 UTC (rev 11662)
@@ -0,0 +1,62 @@
+/*
+ * 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 de.uniba.wiai.lspi.puppetor;
+
+public class ClientEventType implements EventType{
+
+ /**
+ * 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();
+
+ /**
+ * 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();
+
+ /**
+ * 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();
+
+ /**
+ * 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();
+}
Modified: puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/EventType.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/EventType.java 2007-09-27 10:28:51 UTC (rev 11661)
+++ puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/EventType.java 2007-09-27 12:12:26 UTC (rev 11662)
@@ -32,248 +32,12 @@
package de.uniba.wiai.lspi.puppetor;
/**
- * The possible types of events that are fired on a state change of an
- * asynchronous system component, e.g. a Tor process or a client/server
+ * 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 enum EventType {
+public interface EventType {
- /**
- * The node has reported that its routing table for v2 hidden services has
- * changed; this event can only be parsed from a log statement in a modified
- * Tor!
- */
- NODE_ROUTING_TABLE_CHANGED,
-
- /**
- * 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.
- */
- NODE_STARTED,
-
- /**
- * The node has opened its control port; this event is parsed from a log
- * statement in connection_create_listener().
- */
- 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().
- */
- NODE_CIRCUIT_OPENED,
-
- /**
- * The node was stopped; this event is fired internally and not parsed from
- * a log statement from Tor.
- */
- NODE_STOPPED,
-
- /**
- * 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().
- */
- 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().
- */
- BOB_INTRO_ESTABLISHED_RECEIVED,
-
- /**
- * Bob posts a hidden service descriptor to the directory servers (or to
- * hidden service directories in a modified Tor); this event is parsed from
- * a log statement in upload_service_descriptor().
- */
- BOB_SENDING_PUBLISH_DESC,
-
- /**
- * Bob received a response from a directory server (or from a hidden service
- * directory in a modified Tor) to a previous publish request; this event is
- * parsed from a log statement in connection_dir_client_reached_eof().
- */
- 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().
- */
- BOB_INTRODUCE2_RECEIVED,
-
- /**
- * Bob has built a circuit to a rendezvous point and sends an RENDEZVOUS1
- * cell; this event is parsed from a log statement in
- * rend_service_rendezvous_has_opened().
- */
- 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().
- */
- BOB_APP_CONN_OPENED,
-
- /**
- * Alice has received an onion request; this event is parsed from a log
- * statement in connection_ap_handshake_rewrite_and_attach().
- */
- 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().
- */
- 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().
- */
- 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().
- */
- 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().
- */
- 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().
- */
- 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().
- */
- ALICE_SENDING_INTRODUCE1,
-
- /**
- * Alice has received an INTRODUCE_ACK cell as an acknowledgement to the
- * previous INTRODUCE1 cell; this event is parsed from a log statement in
- * rend_client_introduction_acked().
- */
- 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().
- */
- ALICE_RENDEZVOUS2_RECEIVED_APP_CONN_OPENED,
-
- /**
- * // directory_handle_command_post(): rewritten url as //
- * '/tor/rendezvous/publish2'.
- *
- * TODO document me
- */
- // HSDIR_PUBLISH_DESC_RECEIVED,
- /**
- * // directory_handle_command_get(): rewritten url as //
- * '/tor/rendezvous2/yniedqlk7yhfdlimcbimsyhtchxoer3t'
- *
- * TODO document me
- */
- // HSDIR_FETCH_DESC_RECEIVED,
- /**
- * The hidden service directory has stored a v2 descriptor; this event can
- * only be parsed from a log statement in a modified Tor!
- */
- HSDIR_DESC_STORED,
-
- /**
- * The directory server has received a descriptor post request; this event
- * is parsed from a log statement in directory_handle_command_post().
- */
- 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().
- */
- 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().
- */
- 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().
- */
- 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 an RENDEZVOUS_ESTABLISHED
- * cell; this event is parsed from a log statement in
- * rend_mid_establish_rendezvous().
- */
- 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().
- */
- RPO_RECEIVING_RENDEZVOUS1_SENDING_RENDEZVOUS2,
-
- /**
- * The client application is sending a request; this event is fired
- * internally and not parsed from a log statement from Tor.
- */
- 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.
- */
- 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.
- */
- 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.
- */
- CLIENT_REQUESTS_PERFORMED,
-
- /**
- * 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.
- */
- SERVER_RECEIVING_REQUEST_SENDING_REPLY,
}
Added: puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/MiscEventType.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/MiscEventType.java (rev 0)
+++ puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/MiscEventType.java 2007-09-27 12:12:26 UTC (rev 11662)
@@ -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 de.uniba.wiai.lspi.puppetor;
+
+public class MiscEventType implements EventType {
+
+ /**
+ * The hidden service directory has stored a v2 descriptor; this event can
+ * only be parsed from a log statement in a modified Tor!
+ */
+ public static final MiscEventType HSDIR_DESC_STORED = new MiscEventType();
+
+ /**
+ * 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 MiscEventType DIR_PUBLISH_DESC_RECEIVED = new MiscEventType();
+
+ /**
+ * 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 MiscEventType DIR_FETCH_DESC_RECEIVED = new MiscEventType();
+
+ /**
+ * 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 MiscEventType IPO_RECEIVED_ESTABLISH_INTRO_SENDING_INTRO_ESTABLISHED = new MiscEventType();
+
+ /**
+ * 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 MiscEventType IPO_RECEIVED_INTRODUCE1_SENDING_INTRODUCE2_AND_INTRODUCE_ACK = new MiscEventType();
+
+ /**
+ * The node received an ESTABLISH_RENDEZVOUS cell, i.e. was requested to
+ * work as rendezvous point, and replies with an RENDEZVOUS_ESTABLISHED
+ * cell; this event is parsed from a log statement in
+ * rend_mid_establish_rendezvous().
+ */
+ public static final MiscEventType RPO_RECEIVED_ESTABLISH_RENDEZVOUS_SENDING_RENDEZVOUS_ESTABLISHED = new MiscEventType();
+
+ /**
+ * 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 MiscEventType RPO_RECEIVING_RENDEZVOUS1_SENDING_RENDEZVOUS2 = new MiscEventType();
+}
Added: puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/NodeEventType.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/NodeEventType.java (rev 0)
+++ puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/NodeEventType.java 2007-09-27 12:12:26 UTC (rev 11662)
@@ -0,0 +1,66 @@
+/*
+ * 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 de.uniba.wiai.lspi.puppetor;
+
+public class NodeEventType implements EventType{
+
+ /**
+ * The node has reported that its routing table for v2 hidden services has
+ * changed; this event can only be parsed from a log statement in a modified
+ * Tor!
+ */
+ public static final NodeEventType NODE_ROUTING_TABLE_CHANGED = new NodeEventType();
+
+ /**
+ * 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();
+
+ /**
+ * 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();
+
+ /**
+ * 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();
+
+ /**
+ * 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();
+}
\ No newline at end of file
Added: puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/ServerEventType.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/ServerEventType.java (rev 0)
+++ puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/ServerEventType.java 2007-09-27 12:12:26 UTC (rev 11662)
@@ -0,0 +1,42 @@
+/*
+ * 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 de.uniba.wiai.lspi.puppetor;
+
+public class ServerEventType implements EventType{
+
+ /**
+ * 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();
+}
\ No newline at end of file
Modified: puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/examples/AccessingPublicWebServerOverTor.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/examples/AccessingPublicWebServerOverTor.java 2007-09-27 10:28:51 UTC (rev 11661)
+++ puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/examples/AccessingPublicWebServerOverTor.java 2007-09-27 12:12:26 UTC (rev 11662)
@@ -34,10 +34,10 @@
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.EventType;
import de.uniba.wiai.lspi.puppetor.Network;
import de.uniba.wiai.lspi.puppetor.NetworkFactory;
import de.uniba.wiai.lspi.puppetor.ProxyNode;
@@ -106,11 +106,9 @@
private long before;
public void handleEvent(Event event) {
- switch (event.getType()) {
- case CLIENT_SENDING_REQUEST:
+ if (event.getType() == ClientEventType.CLIENT_SENDING_REQUEST) {
before = System.currentTimeMillis();
- break;
- case CLIENT_REPLY_RECEIVED:
+ } else if (event.getType() == ClientEventType.CLIENT_REPLY_RECEIVED) {
System.out
.println("Request took "
+ (System.currentTimeMillis() - before)
@@ -131,7 +129,7 @@
// block this thread as long as client requests are running
manager.waitForAnyOccurence(client.getClientApplicationName(),
- EventType.CLIENT_REQUESTS_PERFORMED);
+ ClientEventType.CLIENT_REQUESTS_PERFORMED);
// wait a second before shutting down the proxy
try {
Modified: puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingAndAccessingHiddenServiceOverPrivateTorNetwork.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingAndAccessingHiddenServiceOverPrivateTorNetwork.java 2007-09-27 10:28:51 UTC (rev 11661)
+++ puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingAndAccessingHiddenServiceOverPrivateTorNetwork.java 2007-09-27 12:12:26 UTC (rev 11662)
@@ -33,11 +33,12 @@
import java.rmi.RemoteException;
+import de.uniba.wiai.lspi.puppetor.BobEventType;
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.EventType;
import de.uniba.wiai.lspi.puppetor.Network;
import de.uniba.wiai.lspi.puppetor.NetworkFactory;
import de.uniba.wiai.lspi.puppetor.RouterNode;
@@ -116,7 +117,7 @@
// wait for 3 minutes that the proxy has published its first RSD
if (!manager.waitForAnyOccurence(router1.getNodeName(),
- EventType.BOB_DESC_PUBLISHED_RECEIVED, 3L * 60L * 1000L)) {
+ BobEventType.BOB_DESC_PUBLISHED_RECEIVED, 3L * 60L * 1000L)) {
// failed to publish an RSD
System.out.println("Failed to publish an RSD!");
return;
@@ -155,7 +156,7 @@
// wait for request to be performed
manager.waitForAnyOccurence(client.getClientApplicationName(),
- EventType.CLIENT_REQUESTS_PERFORMED);
+ ClientEventType.CLIENT_REQUESTS_PERFORMED);
// shut down nodes
network.shutdownNodes();
Modified: puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingAndAccessingHiddenServiceOverPublicTorNetwork.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingAndAccessingHiddenServiceOverPublicTorNetwork.java 2007-09-27 10:28:51 UTC (rev 11661)
+++ puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingAndAccessingHiddenServiceOverPublicTorNetwork.java 2007-09-27 12:12:26 UTC (rev 11662)
@@ -33,15 +33,17 @@
import java.rmi.RemoteException;
+import de.uniba.wiai.lspi.puppetor.BobEventType;
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.EventType;
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.ServerApplication;
+import de.uniba.wiai.lspi.puppetor.ServerEventType;
import de.uniba.wiai.lspi.puppetor.TorProcessException;
/**
@@ -103,7 +105,7 @@
// wait for 3 minutes that the proxy has published its first RSD
if (!manager.waitForAnyOccurence(proxy1.getNodeName(),
- EventType.BOB_DESC_PUBLISHED_RECEIVED, 3L * 60L * 1000L)) {
+ BobEventType.BOB_DESC_PUBLISHED_RECEIVED, 3L * 60L * 1000L)) {
// failed to publish an RSD
System.out.println("Failed to publish an RSD!");
@@ -130,17 +132,14 @@
private long requestSentFromClient;
public void handleEvent(Event event) {
- switch (event.getType()) {
- case CLIENT_SENDING_REQUEST:
+ if (event.getType() == ClientEventType.CLIENT_SENDING_REQUEST) {
requestSentFromClient = event.getOccurrenceTime();
- break;
- case SERVER_RECEIVING_REQUEST_SENDING_REPLY:
+ } else if (event.getType() == ServerEventType.SERVER_RECEIVING_REQUEST_SENDING_REPLY) {
requestReceivedAtServer = event.getOccurrenceTime();
System.out.println("Request took "
+ (requestReceivedAtServer - requestSentFromClient)
+ " millis from client to server!");
- break;
- case CLIENT_REPLY_RECEIVED:
+ } else if (event.getType() == ClientEventType.CLIENT_REPLY_RECEIVED) {
System.out
.println("Request took "
+ (event.getOccurrenceTime() - requestSentFromClient)
@@ -165,7 +164,7 @@
// block this thread as long as client requests are running
manager.waitForAnyOccurence(client.getClientApplicationName(),
- EventType.CLIENT_REQUESTS_PERFORMED);
+ ClientEventType.CLIENT_REQUESTS_PERFORMED);
// shut down proxy
network.shutdownNodes();
Modified: puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingHiddenServiceToPublicTorNetwork.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingHiddenServiceToPublicTorNetwork.java 2007-09-27 10:28:51 UTC (rev 11661)
+++ puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/examples/AdvertisingHiddenServiceToPublicTorNetwork.java 2007-09-27 12:12:26 UTC (rev 11662)
@@ -33,11 +33,13 @@
import java.rmi.RemoteException;
+import de.uniba.wiai.lspi.puppetor.BobEventType;
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.NodeEventType;
import de.uniba.wiai.lspi.puppetor.ProxyNode;
import de.uniba.wiai.lspi.puppetor.TorProcessException;
@@ -84,13 +86,11 @@
private long circuitOpened = -1;
public void handleEvent(Event event) {
- switch (event.getType()) {
- case NODE_CIRCUIT_OPENED:
+ if (event.getType() == NodeEventType.NODE_CIRCUIT_OPENED) {
if (circuitOpened == -1) {
circuitOpened = System.currentTimeMillis();
}
- break;
- case BOB_DESC_PUBLISHED_RECEIVED:
+ } else if (event.getType() == BobEventType.BOB_DESC_PUBLISHED_RECEIVED) {
System.out.println("RSD published "
+ (System.currentTimeMillis() - circuitOpened)
+ " millis after first circuit was opened");
Modified: puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/ClientApplicationImpl.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/ClientApplicationImpl.java 2007-09-27 10:28:51 UTC (rev 11661)
+++ puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/ClientApplicationImpl.java 2007-09-27 12:12:26 UTC (rev 11662)
@@ -44,7 +44,7 @@
import java.util.logging.Logger;
import de.uniba.wiai.lspi.puppetor.ClientApplication;
-import de.uniba.wiai.lspi.puppetor.EventType;
+import de.uniba.wiai.lspi.puppetor.ClientEventType;
/**
* Implementation of <code>ClientApplication</code>.
@@ -156,7 +156,7 @@
timeBeforeConnectionAttempt,
ClientApplicationImpl.this
.getClientApplicationName(),
- EventType.CLIENT_SENDING_REQUEST,
+ ClientEventType.CLIENT_SENDING_REQUEST,
"Sending request.");
Socket s = null;
@@ -184,8 +184,8 @@
eventManager.observeInternalEvent(System
.currentTimeMillis(),
ClientApplicationImpl.this
- .getClientApplicationName(),
- EventType.CLIENT_REPLY_RECEIVED,
+ .getClientApplicationName(),
+ ClientEventType.CLIENT_REPLY_RECEIVED,
"Received response.");
// if we should stop on success, stop further connection
@@ -209,8 +209,8 @@
eventManager.observeInternalEvent(System
.currentTimeMillis(),
ClientApplicationImpl.this
- .getClientApplicationName(),
- EventType.CLIENT_GAVE_UP_REQUEST,
+ .getClientApplicationName(),
+ ClientEventType.CLIENT_GAVE_UP_REQUEST,
"Giving up request.");
// try again immediately, if there are retries left
@@ -226,8 +226,8 @@
eventManager.observeInternalEvent(System
.currentTimeMillis(),
ClientApplicationImpl.this
- .getClientApplicationName(),
- EventType.CLIENT_GAVE_UP_REQUEST,
+ .getClientApplicationName(),
+ ClientEventType.CLIENT_GAVE_UP_REQUEST,
"Giving up request.");
// wait for the rest of the timeout
@@ -274,9 +274,8 @@
// send event to event manager
eventManager.observeInternalEvent(System.currentTimeMillis(),
- ClientApplicationImpl.this
- .getClientApplicationName(),
- EventType.CLIENT_REQUESTS_PERFORMED,
+ ClientApplicationImpl.this.getClientApplicationName(),
+ ClientEventType.CLIENT_REQUESTS_PERFORMED,
"Requests performed.");
// log exiting
Modified: puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/EventManagerImpl.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/EventManagerImpl.java 2007-09-27 10:28:51 UTC (rev 11661)
+++ puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/EventManagerImpl.java 2007-09-27 12:12:26 UTC (rev 11662)
@@ -50,10 +50,14 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import de.uniba.wiai.lspi.puppetor.AliceEventType;
+import de.uniba.wiai.lspi.puppetor.BobEventType;
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.MiscEventType;
+import de.uniba.wiai.lspi.puppetor.NodeEventType;
/**
* Implementation of <code>EventManager</code>.
@@ -396,62 +400,63 @@
private void initializeEventTypePatterns() {
eventTypePatterns = new HashMap<Pattern, EventType>();
registerEventTypePattern("Opening Control listener on .*",
- EventType.NODE_CONTROL_PORT_OPENED);
+ NodeEventType.NODE_CONTROL_PORT_OPENED);
registerEventTypePattern("Tor has successfully opened a circuit. "
+ "Looks like client functionality is working.",
- EventType.NODE_CIRCUIT_OPENED);
+ NodeEventType.NODE_CIRCUIT_OPENED);
registerEventTypePattern("Established circuit .* as introduction "
+ "point for service .*",
- EventType.BOB_BUILT_INTRO_CIRC_SENDING_ESTABLISH_INTRO);
+ BobEventType.BOB_BUILT_INTRO_CIRC_SENDING_ESTABLISH_INTRO);
registerEventTypePattern("Received INTRO_ESTABLISHED cell on "
+ "circuit .* for service .*",
- EventType.BOB_INTRO_ESTABLISHED_RECEIVED);
+ BobEventType.BOB_INTRO_ESTABLISHED_RECEIVED);
registerEventTypePattern("Sending publish request for hidden "
- + "service .*", EventType.BOB_SENDING_PUBLISH_DESC);
+ + "service .*", BobEventType.BOB_SENDING_PUBLISH_DESC);
registerEventTypePattern("Uploaded rendezvous descriptor",
- EventType.BOB_DESC_PUBLISHED_RECEIVED);
+ BobEventType.BOB_DESC_PUBLISHED_RECEIVED);
registerEventTypePattern("Received INTRODUCE2 cell for service .* "
- + "on circ .*", EventType.BOB_INTRODUCE2_RECEIVED);
+ + "on circ .*", BobEventType.BOB_INTRODUCE2_RECEIVED);
registerEventTypePattern("Done building circuit .* to rendezvous "
+ "with cookie .* for service .*",
- EventType.BOB_BUILT_REND_CIRC_SENDING_RENDEZVOUS1);
+ BobEventType.BOB_BUILT_REND_CIRC_SENDING_RENDEZVOUS1);
registerEventTypePattern("begin is for rendezvous",
- EventType.BOB_APP_CONN_OPENED);
+ BobEventType.BOB_APP_CONN_OPENED);
registerEventTypePattern("Got a hidden service request for ID '.*'",
- EventType.ALICE_ONION_REQUEST_RECEIVED);
+ AliceEventType.ALICE_ONION_REQUEST_RECEIVED);
registerEventTypePattern("Fetching rendezvous descriptor for "
- + "service .*", EventType.ALICE_SENDING_FETCH_DESC);
+ + "service .*", AliceEventType.ALICE_SENDING_FETCH_DESC);
registerEventTypePattern("Received rendezvous descriptor",
- EventType.ALICE_DESC_FETCHED_RECEIVED);
- registerEventTypePattern("Sending an ESTABLISH_RENDEZVOUS cell",
- EventType.ALICE_BUILT_REND_CIRC_SENDING_ESTABLISH_RENDEZVOUS);
+ AliceEventType.ALICE_DESC_FETCHED_RECEIVED);
+ registerEventTypePattern(
+ "Sending an ESTABLISH_RENDEZVOUS cell",
+ AliceEventType.ALICE_BUILT_REND_CIRC_SENDING_ESTABLISH_RENDEZVOUS);
registerEventTypePattern("Got rendezvous ack. This circuit is now "
+ "ready for rendezvous",
- EventType.ALICE_RENDEZVOUS_ESTABLISHED_RECEIVED);
+ AliceEventType.ALICE_RENDEZVOUS_ESTABLISHED_RECEIVED);
registerEventTypePattern("introcirc is open",
- EventType.ALICE_BUILT_INTRO_CIRC);
+ AliceEventType.ALICE_BUILT_INTRO_CIRC);
registerEventTypePattern("Sending an INTRODUCE1 cell",
- EventType.ALICE_SENDING_INTRODUCE1);
+ AliceEventType.ALICE_SENDING_INTRODUCE1);
registerEventTypePattern("Received ack. Telling rend circ",
- EventType.ALICE_INTRODUCE_ACK_RECEIVED);
+ AliceEventType.ALICE_INTRODUCE_ACK_RECEIVED);
registerEventTypePattern("Got RENDEZVOUS2 cell from hidden service",
- EventType.ALICE_RENDEZVOUS2_RECEIVED_APP_CONN_OPENED);
+ AliceEventType.ALICE_RENDEZVOUS2_RECEIVED_APP_CONN_OPENED);
registerEventTypePattern("Handling rendezvous descriptor post",
- EventType.DIR_PUBLISH_DESC_RECEIVED);
+ MiscEventType.DIR_PUBLISH_DESC_RECEIVED);
registerEventTypePattern("Handling rendezvous descriptor get",
- EventType.DIR_FETCH_DESC_RECEIVED);
+ MiscEventType.DIR_FETCH_DESC_RECEIVED);
registerEventTypePattern(
"Received an ESTABLISH_INTRO request on circuit .*",
- EventType.IPO_RECEIVED_ESTABLISH_INTRO_SENDING_INTRO_ESTABLISHED);
+ MiscEventType.IPO_RECEIVED_ESTABLISH_INTRO_SENDING_INTRO_ESTABLISHED);
registerEventTypePattern(
"Received an INTRODUCE1 request on circuit .*",
- EventType.IPO_RECEIVED_INTRODUCE1_SENDING_INTRODUCE2_AND_INTRODUCE_ACK);
+ MiscEventType.IPO_RECEIVED_INTRODUCE1_SENDING_INTRODUCE2_AND_INTRODUCE_ACK);
registerEventTypePattern(
"Received an ESTABLISH_RENDEZVOUS request on circuit .*",
- EventType.RPO_RECEIVED_ESTABLISH_RENDEZVOUS_SENDING_RENDEZVOUS_ESTABLISHED);
+ MiscEventType.RPO_RECEIVED_ESTABLISH_RENDEZVOUS_SENDING_RENDEZVOUS_ESTABLISHED);
registerEventTypePattern(
"Got request for rendezvous from circuit .* to cookie .*",
- EventType.RPO_RECEIVING_RENDEZVOUS1_SENDING_RENDEZVOUS2);
+ MiscEventType.RPO_RECEIVING_RENDEZVOUS1_SENDING_RENDEZVOUS2);
}
Modified: puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/NetworkImpl.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/NetworkImpl.java 2007-09-27 10:28:51 UTC (rev 11661)
+++ puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/NetworkImpl.java 2007-09-27 12:12:26 UTC (rev 11662)
@@ -52,9 +52,9 @@
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.Network;
import de.uniba.wiai.lspi.puppetor.NetworkState;
+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.RouterNode;
@@ -402,7 +402,7 @@
// fail on first node that is not up
for (ProxyNode node : this.nodes.values()) {
if (!eventManager.hasEventOccured(node.getNodeName(),
- EventType.NODE_CIRCUIT_OPENED)) {
+ NodeEventType.NODE_CIRCUIT_OPENED)) {
// log exiting and return false
this.logger.exiting(this.getClass().getName(), "allNodesUp");
@@ -530,7 +530,7 @@
// add name to event manager as event source
this.eventManager.addEventSource(clientApplicationName);
-
+
// log exiting and return client
this.logger.exiting(this.getClass().getName(), "createClient", client);
return client;
@@ -573,10 +573,10 @@
// add new directory node to nodes collection
this.nodes.put(nodeName, dir);
-
+
// add name to event manager as event source
this.eventManager.addEventSource(nodeName);
-
+
// log exiting and return directory node
this.logger.exiting(this.getClass().getName(), "createDirectory", dir);
return dir;
@@ -662,7 +662,7 @@
// add name to event manager as event source
this.eventManager.addEventSource(nodeName);
-
+
// log exiting and return proxy node
this.logger.exiting(this.getClass().getName(), "createProxy", proxy);
return proxy;
@@ -713,7 +713,7 @@
// add name to event manager as event source
this.eventManager.addEventSource(nodeName);
-
+
// log exiting and return router node
this.logger.exiting(this.getClass().getName(), "createRouter", router);
return router;
@@ -794,7 +794,7 @@
// add name to event manager as event source
this.eventManager.addEventSource(serverApplicationName);
-
+
// log exiting and return server
this.logger.exiting(this.getClass().getName(), "createServer", server);
return server;
@@ -911,7 +911,7 @@
eventManager.addEventListener(node.getNodeName(),
new EventListener() {
public void handleEvent(Event event) {
- if (event.getType() == EventType.NODE_CIRCUIT_OPENED) {
+ if (event.getType() == NodeEventType.NODE_CIRCUIT_OPENED) {
sleepingThread.interrupt();
eventManager.removeEventListener(this);
}
Modified: puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/ProxyNodeImpl.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/ProxyNodeImpl.java 2007-09-27 10:28:51 UTC (rev 11661)
+++ puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/ProxyNodeImpl.java 2007-09-27 12:12:26 UTC (rev 11662)
@@ -49,7 +49,7 @@
import java.util.logging.Logger;
import net.freehaven.tor.control.TorControlConnection;
-import de.uniba.wiai.lspi.puppetor.EventType;
+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.TorProcessException;
@@ -641,7 +641,7 @@
// fire event
eventManager.observeInternalEvent(System.currentTimeMillis(), this
- .getNodeName(), EventType.NODE_STOPPED, "Node stopped.");
+ .getNodeName(), NodeEventType.NODE_STOPPED, "Node stopped.");
// log exiting
this.logger.exiting(this.getClass().getName(), "shutdown");
@@ -764,8 +764,9 @@
// is running; otherwise, silently ignore it...
if (nodeState == NodeState.RUNNING) {
String reason = "IOException when reading output from Tor "
- + "process " + ProxyNodeImpl.this
- .getNodeName() + "!";
+ + "process "
+ + ProxyNodeImpl.this.getNodeName()
+ + "!";
logger.log(Level.WARNING, reason, e);
}
}
@@ -821,7 +822,8 @@
this.logger.log(Level.FINER,
"Waiting for Tor to open its control port...");
if (!this.eventManager.waitForAnyOccurence(this.nodeName,
- EventType.NODE_CONTROL_PORT_OPENED, maximumTimeToWaitInMillis)) {
+ NodeEventType.NODE_CONTROL_PORT_OPENED,
+ maximumTimeToWaitInMillis)) {
// Tor did not open its control port
this.logger.log(Level.WARNING, "Tor node " + this.nodeName
@@ -856,7 +858,7 @@
// fire event
eventManager.observeInternalEvent(System.currentTimeMillis(), this
- .getNodeName(), EventType.NODE_STARTED, "Node started.");
+ .getNodeName(), NodeEventType.NODE_STARTED, "Node started.");
// log exiting and return with success
this.logger.exiting(this.getClass().getName(), "startNode", true);
Modified: puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/ServerApplicationImpl.java
===================================================================
--- puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/ServerApplicationImpl.java 2007-09-27 10:28:51 UTC (rev 11661)
+++ puppetor/trunk/src/de/uniba/wiai/lspi/puppetor/impl/ServerApplicationImpl.java 2007-09-27 12:12:26 UTC (rev 11662)
@@ -40,8 +40,8 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-import de.uniba.wiai.lspi.puppetor.EventType;
import de.uniba.wiai.lspi.puppetor.ServerApplication;
+import de.uniba.wiai.lspi.puppetor.ServerEventType;
/**
* Implementation of <code>ServerApplication</code>.
@@ -96,7 +96,7 @@
// send event to event manager
eventManager.observeInternalEvent(System.currentTimeMillis(),
ServerApplicationImpl.this.getServerApplicationName(),
- EventType.SERVER_RECEIVING_REQUEST_SENDING_REPLY,
+ ServerEventType.SERVER_RECEIVING_REQUEST_SENDING_REPLY,
"Receiving request.");
// write response