├── .gitignore ├── Data Collections ├── Combined Data.xlsx ├── Data Collection Sim 0.xlsx ├── Data Collection Sim 1.xlsx ├── Data Collection Sim 2.xlsx └── Simulations Raw Log │ ├── README.txt │ ├── Results from Simulation0.rar │ ├── Results from Simulation1.rar │ └── Results from Simulation2.rar ├── Documentation ├── Attack_Simulation.pdf ├── Motivation_Document.pdf └── Thesis_By_Umeer_Mohammad - Draft.pdf ├── Graphs ├── Gephi Graphs │ ├── 10.gephi │ ├── 100.gephi │ ├── 1000.gephi │ ├── 10000.gephi │ ├── 20.gephi │ ├── 50.gephi │ ├── 500.gephi │ ├── 5000.gephi │ ├── 500_2Components.gephi │ └── node_conversion.xlsx ├── MATLAB Graphs │ ├── Graphs.xlsx │ ├── WattsStrogatz.m │ ├── network_graph_image.JPG │ └── runNetworkGenerator.m └── Tribler Network │ ├── Net5.ned comparitible data.txt │ ├── Tribler network.gephi │ └── TrustChain Network Structure.zip ├── LICENSE ├── README.md ├── Simulation0 ├── .cmdenv-log ├── .cproject ├── .metadata │ ├── .lock │ ├── .log │ ├── .plugins │ │ ├── org.eclipse.cdt.core │ │ │ └── .log │ │ ├── org.eclipse.cdt.make.core │ │ │ ├── specs.c │ │ │ └── specs.cpp │ │ ├── org.eclipse.core.resources │ │ │ ├── .root │ │ │ │ ├── .indexes │ │ │ │ │ ├── history.version │ │ │ │ │ └── properties.version │ │ │ │ └── 1.tree │ │ │ └── .safetable │ │ │ │ └── org.eclipse.core.resources │ │ ├── org.eclipse.core.runtime │ │ │ └── .settings │ │ │ │ ├── org.eclipse.cdt.ui.prefs │ │ │ │ ├── org.eclipse.core.resources.prefs │ │ │ │ ├── org.eclipse.jsch.core.prefs │ │ │ │ ├── org.eclipse.ui.ide.prefs │ │ │ │ ├── org.eclipse.ui.prefs │ │ │ │ └── org.eclipse.ui.workbench.prefs │ │ ├── org.eclipse.e4.workbench │ │ │ └── workbench.xmi │ │ ├── org.eclipse.ui.workbench │ │ │ ├── dialog_settings.xml │ │ │ └── workingsets.xml │ │ └── org.omnetpp.main │ │ │ └── dialog_settings.xml │ └── version.ini ├── .oppbuildspec ├── .project ├── .qtenvrc ├── .settings │ └── language.settings.xml ├── ChangeLog ├── Makefile ├── Net5.anf ├── NoREADME.txt ├── frames │ ├── NetBuilder#0_0000.png │ ├── NetBuilder#0_0001.png │ ├── NetBuilder#0_0002.png │ ├── NetBuilder#0_0003.png │ ├── NetBuilder#0_0004.png │ ├── NetBuilder#0_0005.png │ ├── NetBuilder#0_0006.png │ ├── NetBuilder#0_0007.png │ ├── NetBuilder#0_0008.png │ ├── NetBuilder#0_0009.png │ ├── NetBuilder#0_0010.png │ ├── NetBuilder#0_0011.png │ ├── NetBuilder#0_0012.png │ ├── NetBuilder#0_0013.png │ ├── NetBuilder#0_0014.png │ ├── NetBuilder#0_0015.png │ ├── NetBuilder#0_0016.png │ ├── NetBuilder#0_0017.png │ └── NetBuilder#0_0018.png ├── makefrag ├── networks │ └── Net5.ned ├── node │ ├── App.cc │ ├── App.h │ ├── App.ned │ ├── IApp.ned │ ├── L2Queue.cc │ ├── L2Queue.ned │ ├── Node.ned │ ├── Packet.msg │ ├── PacketType.h │ ├── Packet_m.cc │ ├── Packet_m.h │ ├── Routing.cc │ ├── Routing.h │ └── Routing.ned ├── omnetpp.ini ├── out │ ├── clang-release │ │ ├── .last-copts │ │ └── node │ │ │ ├── App.o.d │ │ │ ├── L2Queue.o.d │ │ │ ├── Packet_m.h.d │ │ │ ├── Packet_m.o.d │ │ │ └── Routing.o.d │ ├── gcc-debug │ │ ├── .last-copts │ │ ├── builder │ │ │ └── netbuilder.d │ │ ├── node │ │ │ ├── App.d │ │ │ ├── BurstyApp.d │ │ │ ├── L2Queue.d │ │ │ ├── Packet_m.d │ │ │ └── Routing.d │ │ └── routing_dbg │ └── gcc-release │ │ ├── .last-copts │ │ ├── builder │ │ └── netbuilder.d │ │ ├── node │ │ ├── App.d │ │ ├── BurstyApp.d │ │ ├── L2Queue.d │ │ ├── Packet_m.d │ │ └── Routing.d │ │ ├── routing │ │ └── routing_umeer ├── package.ned ├── parsim │ ├── README.txt │ ├── omnetpp.ini │ ├── runparsim │ ├── runparsim-cmd.bat │ ├── runparsim-mpi │ └── runparsim.bat └── templates │ └── randomtopo │ ├── Nearest3.java │ ├── gatename.xswt │ ├── nearest3.jar │ ├── nedtypes.xswt │ ├── network.ned.ftl │ ├── omnetpp.ini.ftl │ ├── package.ned.ftl │ ├── params.xswt │ └── template.properties ├── Simulation1 ├── .cmdenv-log ├── .cproject ├── .metadata │ ├── .lock │ ├── .log │ ├── .plugins │ │ ├── org.eclipse.cdt.core │ │ │ └── .log │ │ ├── org.eclipse.cdt.make.core │ │ │ ├── specs.c │ │ │ └── specs.cpp │ │ ├── org.eclipse.core.resources │ │ │ ├── .root │ │ │ │ ├── .indexes │ │ │ │ │ ├── history.version │ │ │ │ │ └── properties.version │ │ │ │ └── 1.tree │ │ │ └── .safetable │ │ │ │ └── org.eclipse.core.resources │ │ ├── org.eclipse.core.runtime │ │ │ └── .settings │ │ │ │ ├── org.eclipse.cdt.ui.prefs │ │ │ │ ├── org.eclipse.core.resources.prefs │ │ │ │ ├── org.eclipse.jsch.core.prefs │ │ │ │ ├── org.eclipse.ui.ide.prefs │ │ │ │ ├── org.eclipse.ui.prefs │ │ │ │ └── org.eclipse.ui.workbench.prefs │ │ ├── org.eclipse.e4.workbench │ │ │ └── workbench.xmi │ │ ├── org.eclipse.ui.workbench │ │ │ ├── dialog_settings.xml │ │ │ └── workingsets.xml │ │ └── org.omnetpp.main │ │ │ └── dialog_settings.xml │ └── version.ini ├── .oppbuildspec ├── .project ├── .qtenvrc ├── .settings │ └── language.settings.xml ├── ChangeLog ├── Makefile ├── Net5.anf ├── NoREADME.txt ├── frames │ ├── NetBuilder#0_0000.png │ ├── NetBuilder#0_0001.png │ ├── NetBuilder#0_0002.png │ ├── NetBuilder#0_0003.png │ ├── NetBuilder#0_0004.png │ ├── NetBuilder#0_0005.png │ ├── NetBuilder#0_0006.png │ ├── NetBuilder#0_0007.png │ ├── NetBuilder#0_0008.png │ ├── NetBuilder#0_0009.png │ ├── NetBuilder#0_0010.png │ ├── NetBuilder#0_0011.png │ ├── NetBuilder#0_0012.png │ ├── NetBuilder#0_0013.png │ ├── NetBuilder#0_0014.png │ ├── NetBuilder#0_0015.png │ ├── NetBuilder#0_0016.png │ ├── NetBuilder#0_0017.png │ └── NetBuilder#0_0018.png ├── makefrag ├── networks │ └── Net5.ned ├── node │ ├── App.cc │ ├── App.h │ ├── App.ned │ ├── IApp.ned │ ├── L2Queue.cc │ ├── L2Queue.ned │ ├── Node.ned │ ├── Packet.msg │ ├── PacketType.h │ ├── Packet_m.cc │ ├── Packet_m.h │ ├── Routing.cc │ ├── Routing.h │ └── Routing.ned ├── omnetpp.ini ├── out │ ├── clang-debug │ │ ├── .last-copts │ │ └── node │ │ │ ├── App.o.d │ │ │ ├── L2Queue.o.d │ │ │ ├── Packet_m.o.d │ │ │ └── Routing.o.d │ ├── clang-release │ │ ├── .last-copts │ │ └── node │ │ │ ├── App.o.d │ │ │ ├── L2Queue.o.d │ │ │ ├── Packet_m.h.d │ │ │ ├── Packet_m.o.d │ │ │ └── Routing.o.d │ ├── gcc-debug │ │ ├── .last-copts │ │ ├── builder │ │ │ ├── netbuilder.d │ │ │ └── netbuilder.o │ │ ├── node │ │ │ ├── App.d │ │ │ ├── App.o │ │ │ ├── BurstyApp.d │ │ │ ├── BurstyApp.o │ │ │ ├── L2Queue.d │ │ │ ├── L2Queue.o │ │ │ ├── Packet_m.d │ │ │ ├── Packet_m.o │ │ │ ├── Routing.d │ │ │ └── Routing.o │ │ └── routing_dbg │ └── gcc-release │ │ ├── .last-copts │ │ ├── builder │ │ ├── netbuilder.d │ │ └── netbuilder.o │ │ ├── node │ │ ├── App.d │ │ ├── App.o │ │ ├── BurstyApp.d │ │ ├── BurstyApp.o │ │ ├── L2Queue.d │ │ ├── L2Queue.o │ │ ├── Packet_m.d │ │ ├── Packet_m.o │ │ ├── Routing.d │ │ └── Routing.o │ │ ├── routing │ │ └── routing_umeer ├── package.ned ├── parsim │ ├── README.txt │ ├── omnetpp.ini │ ├── runparsim │ ├── runparsim-cmd.bat │ ├── runparsim-mpi │ └── runparsim.bat └── templates │ └── randomtopo │ ├── Nearest3.java │ ├── gatename.xswt │ ├── nearest3.jar │ ├── nedtypes.xswt │ ├── network.ned.ftl │ ├── omnetpp.ini.ftl │ ├── package.ned.ftl │ ├── params.xswt │ └── template.properties ├── Simulation2 ├── .cmdenv-log ├── .cproject ├── .metadata │ ├── .lock │ ├── .log │ ├── .plugins │ │ ├── org.eclipse.cdt.core │ │ │ └── .log │ │ ├── org.eclipse.cdt.make.core │ │ │ ├── specs.c │ │ │ └── specs.cpp │ │ ├── org.eclipse.core.resources │ │ │ ├── .root │ │ │ │ ├── .indexes │ │ │ │ │ ├── history.version │ │ │ │ │ └── properties.version │ │ │ │ └── 1.tree │ │ │ └── .safetable │ │ │ │ └── org.eclipse.core.resources │ │ ├── org.eclipse.core.runtime │ │ │ └── .settings │ │ │ │ ├── org.eclipse.cdt.ui.prefs │ │ │ │ ├── org.eclipse.core.resources.prefs │ │ │ │ ├── org.eclipse.jsch.core.prefs │ │ │ │ ├── org.eclipse.ui.ide.prefs │ │ │ │ ├── org.eclipse.ui.prefs │ │ │ │ └── org.eclipse.ui.workbench.prefs │ │ ├── org.eclipse.e4.workbench │ │ │ └── workbench.xmi │ │ ├── org.eclipse.ui.workbench │ │ │ ├── dialog_settings.xml │ │ │ └── workingsets.xml │ │ └── org.omnetpp.main │ │ │ └── dialog_settings.xml │ └── version.ini ├── .oppbuildspec ├── .project ├── .qtenvrc ├── .settings │ └── language.settings.xml ├── ChangeLog ├── Makefile ├── Net5.anf ├── NoREADME.txt ├── frames │ ├── NetBuilder#0_0000.png │ ├── NetBuilder#0_0001.png │ ├── NetBuilder#0_0002.png │ ├── NetBuilder#0_0003.png │ ├── NetBuilder#0_0004.png │ ├── NetBuilder#0_0005.png │ ├── NetBuilder#0_0006.png │ ├── NetBuilder#0_0007.png │ ├── NetBuilder#0_0008.png │ ├── NetBuilder#0_0009.png │ ├── NetBuilder#0_0010.png │ ├── NetBuilder#0_0011.png │ ├── NetBuilder#0_0012.png │ ├── NetBuilder#0_0013.png │ ├── NetBuilder#0_0014.png │ ├── NetBuilder#0_0015.png │ ├── NetBuilder#0_0016.png │ ├── NetBuilder#0_0017.png │ └── NetBuilder#0_0018.png ├── makefrag ├── networks │ └── Net5.ned ├── node │ ├── App.cc │ ├── App.h │ ├── App.ned │ ├── IApp.ned │ ├── L2Queue.cc │ ├── L2Queue.ned │ ├── Node.ned │ ├── Packet.msg │ ├── PacketType.h │ ├── Packet_m.cc │ ├── Packet_m.h │ ├── Routing.cc │ ├── Routing.h │ └── Routing.ned ├── omnetpp.ini ├── out │ ├── clang-debug │ │ ├── .last-copts │ │ └── node │ │ │ ├── App.o.d │ │ │ ├── L2Queue.o.d │ │ │ ├── Packet_m.h.d │ │ │ ├── Packet_m.o.d │ │ │ └── Routing.o.d │ ├── clang-release │ │ ├── .last-copts │ │ └── node │ │ │ ├── App.o.d │ │ │ ├── L2Queue.o.d │ │ │ ├── Packet_m.h.d │ │ │ ├── Packet_m.o.d │ │ │ └── Routing.o.d │ ├── gcc-debug │ │ ├── .last-copts │ │ ├── builder │ │ │ └── netbuilder.d │ │ ├── node │ │ │ ├── App.d │ │ │ ├── BurstyApp.d │ │ │ ├── L2Queue.d │ │ │ ├── Packet_m.d │ │ │ └── Routing.d │ │ └── routing_dbg │ └── gcc-release │ │ ├── .last-copts │ │ ├── builder │ │ └── netbuilder.d │ │ ├── node │ │ ├── App.d │ │ ├── BurstyApp.d │ │ ├── L2Queue.d │ │ ├── Packet_m.d │ │ └── Routing.d │ │ ├── routing │ │ └── routing_umeer ├── package.ned ├── parsim │ ├── README.txt │ ├── omnetpp.ini │ ├── runparsim │ ├── runparsim-cmd.bat │ ├── runparsim-mpi │ └── runparsim.bat ├── templates │ └── randomtopo │ │ ├── Nearest3.java │ │ ├── gatename.xswt │ │ ├── nearest3.jar │ │ ├── nedtypes.xswt │ │ ├── network.ned.ftl │ │ ├── omnetpp.ini.ftl │ │ ├── package.ned.ftl │ │ ├── params.xswt │ │ └── template.properties └── test │ ├── BasicMessage.test │ ├── RandomDistinctPicker.test │ └── TokenizerEvilNodesList.test └── Tools ├── .gitignore ├── Automation Scripts ├── clusterJob.job ├── script.sh ├── scriptOut.sh └── statCalculator.r ├── NetworkGeneratorConverter ├── .classpath ├── .project ├── build.xml ├── build │ ├── built-jar.properties │ └── classes │ │ └── .gitignore ├── dist │ ├── NetworkGeneratorConverter.jar │ ├── README.TXT │ ├── input.txt │ └── output.txt ├── input.txt ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── private │ │ ├── private.properties │ │ └── private.xml │ ├── project.properties │ └── project.xml ├── output.txt └── src │ ├── networkgeneratorconverter │ ├── Edge.java │ ├── FileParser.java │ ├── FileWriter.java │ └── NetworkGeneratorConverter.java │ └── testing │ ├── FileParserTest.java │ └── FileWriterTest.java ├── SimulationsResultExtractor ├── .classpath ├── .project ├── General-#0.elog ├── build.xml ├── build │ ├── built-jar.properties │ └── classes │ │ └── .gitignore ├── dist │ ├── README.TXT │ ├── SimulationsResultExtractor.jar │ ├── input.txt │ └── output.txt ├── input.txt ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── private │ │ ├── private.properties │ │ └── private.xml │ ├── project.properties │ └── project.xml ├── output.txt └── src │ └── SimulationsResultExtractor.java ├── SimulationsResultExtractor2 ├── .classpath ├── .gitignore ├── .project ├── input.txt └── src │ ├── ResultExtractor2.java │ ├── SimulationsResultExtractor2.java │ └── Tester.java └── SimulationsResultTypeCounter ├── .classpath ├── .gitignore ├── .project ├── input.txt └── src ├── SimulationsResultTypeCounter.java └── testing.java /Data Collections/Combined Data.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Data Collections/Combined Data.xlsx -------------------------------------------------------------------------------- /Data Collections/Data Collection Sim 0.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Data Collections/Data Collection Sim 0.xlsx -------------------------------------------------------------------------------- /Data Collections/Data Collection Sim 1.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Data Collections/Data Collection Sim 1.xlsx -------------------------------------------------------------------------------- /Data Collections/Data Collection Sim 2.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Data Collections/Data Collection Sim 2.xlsx -------------------------------------------------------------------------------- /Data Collections/Simulations Raw Log/README.txt: -------------------------------------------------------------------------------- 1 | t*.*-> Results from Simulation0 2 | q*.*-> Results from Simulation1 3 | r*.*-> Results from Simulation2 4 | -------------------------------------------------------------------------------- /Data Collections/Simulations Raw Log/Results from Simulation0.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Data Collections/Simulations Raw Log/Results from Simulation0.rar -------------------------------------------------------------------------------- /Data Collections/Simulations Raw Log/Results from Simulation1.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Data Collections/Simulations Raw Log/Results from Simulation1.rar -------------------------------------------------------------------------------- /Data Collections/Simulations Raw Log/Results from Simulation2.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Data Collections/Simulations Raw Log/Results from Simulation2.rar -------------------------------------------------------------------------------- /Documentation/Attack_Simulation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Documentation/Attack_Simulation.pdf -------------------------------------------------------------------------------- /Documentation/Motivation_Document.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Documentation/Motivation_Document.pdf -------------------------------------------------------------------------------- /Documentation/Thesis_By_Umeer_Mohammad - Draft.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Documentation/Thesis_By_Umeer_Mohammad - Draft.pdf -------------------------------------------------------------------------------- /Graphs/Gephi Graphs/10.gephi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Graphs/Gephi Graphs/10.gephi -------------------------------------------------------------------------------- /Graphs/Gephi Graphs/100.gephi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Graphs/Gephi Graphs/100.gephi -------------------------------------------------------------------------------- /Graphs/Gephi Graphs/1000.gephi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Graphs/Gephi Graphs/1000.gephi -------------------------------------------------------------------------------- /Graphs/Gephi Graphs/10000.gephi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Graphs/Gephi Graphs/10000.gephi -------------------------------------------------------------------------------- /Graphs/Gephi Graphs/20.gephi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Graphs/Gephi Graphs/20.gephi -------------------------------------------------------------------------------- /Graphs/Gephi Graphs/50.gephi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Graphs/Gephi Graphs/50.gephi -------------------------------------------------------------------------------- /Graphs/Gephi Graphs/500.gephi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Graphs/Gephi Graphs/500.gephi -------------------------------------------------------------------------------- /Graphs/Gephi Graphs/5000.gephi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Graphs/Gephi Graphs/5000.gephi -------------------------------------------------------------------------------- /Graphs/Gephi Graphs/500_2Components.gephi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Graphs/Gephi Graphs/500_2Components.gephi -------------------------------------------------------------------------------- /Graphs/Gephi Graphs/node_conversion.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Graphs/Gephi Graphs/node_conversion.xlsx -------------------------------------------------------------------------------- /Graphs/MATLAB Graphs/Graphs.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Graphs/MATLAB Graphs/Graphs.xlsx -------------------------------------------------------------------------------- /Graphs/MATLAB Graphs/WattsStrogatz.m: -------------------------------------------------------------------------------- 1 | % Copyright 2015 The MathWorks, Inc. 2 | 3 | function h = WattsStrogatz(N,K,beta) 4 | % H = WattsStrogatz(N,K,beta) returns a Watts-Strogatz model graph with N 5 | % nodes, N*K edges, mean node degree 2*K, and rewiring probability beta. 6 | % 7 | % beta = 0 is a ring lattice, and beta = 1 is a random graph. 8 | 9 | % Connect each node to its K next and previous neighbors. This constructs 10 | % indices for a ring lattice. 11 | s = repelem((1:N)',1,K); 12 | t = s + repmat(1:K,N,1); 13 | t = mod(t-1,N)+1; 14 | 15 | % Rewire the target node of each edge with probability beta 16 | for source=1:N 17 | switchEdge = rand(K, 1) < beta; 18 | 19 | newTargets = rand(N, 1); 20 | newTargets(source) = 0; 21 | newTargets(s(t==source)) = 0; 22 | newTargets(t(source, ~switchEdge)) = 0; 23 | 24 | [~, ind] = sort(newTargets, 'descend'); 25 | t(source, switchEdge) = ind(1:nnz(switchEdge)); 26 | end 27 | 28 | h = graph(s,t); 29 | end -------------------------------------------------------------------------------- /Graphs/MATLAB Graphs/network_graph_image.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Graphs/MATLAB Graphs/network_graph_image.JPG -------------------------------------------------------------------------------- /Graphs/MATLAB Graphs/runNetworkGenerator.m: -------------------------------------------------------------------------------- 1 | clear h2 2 | clear graph 3 | 4 | 5 | graph = WattsStrogatz(500,5,0.01); 6 | 7 | disp("AvgPathLength:"); 8 | disp(mean(mean(distances(graph)))); 9 | disp("VariancePathLength: "); 10 | disp(mean(var(distances(graph)))); 11 | 12 | figure('name','Graph'); 13 | 14 | colormap hsv 15 | deg = degree(graph); 16 | nSizes = 2*sqrt(deg-min(deg)+0.2); 17 | nColors = deg; 18 | plot(graph,'MarkerSize',nSizes,'NodeCData',nColors,'EdgeAlpha',0.1) 19 | colorbar 20 | 21 | clear ans 22 | clear deg 23 | clear nSizes 24 | clear nColors -------------------------------------------------------------------------------- /Graphs/Tribler Network/Tribler network.gephi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Graphs/Tribler Network/Tribler network.gephi -------------------------------------------------------------------------------- /Graphs/Tribler Network/TrustChain Network Structure.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Graphs/Tribler Network/TrustChain Network Structure.zip -------------------------------------------------------------------------------- /Simulation0/.cmdenv-log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation0/.cmdenv-log -------------------------------------------------------------------------------- /Simulation0/.metadata/.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation0/.metadata/.lock -------------------------------------------------------------------------------- /Simulation0/.metadata/.plugins/org.eclipse.cdt.core/.log: -------------------------------------------------------------------------------- 1 | *** SESSION Jul 31, 2019 12:12:29.07 ------------------------------------------- 2 | -------------------------------------------------------------------------------- /Simulation0/.metadata/.plugins/org.eclipse.cdt.make.core/specs.c: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Simulation0/.metadata/.plugins/org.eclipse.cdt.make.core/specs.cpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Simulation0/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /Simulation0/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /Simulation0/.metadata/.plugins/org.eclipse.core.resources/.root/1.tree: -------------------------------------------------------------------------------- 1 | org.eclipse.cdt.core -------------------------------------------------------------------------------- /Simulation0/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation0/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources -------------------------------------------------------------------------------- /Simulation0/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.cdt.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | spelling_locale=en_GB 3 | spelling_locale_initialized=true 4 | useAnnotationsPrefPage=true 5 | useQuickDiffPrefPage=true 6 | -------------------------------------------------------------------------------- /Simulation0/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | version=1 3 | -------------------------------------------------------------------------------- /Simulation0/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jsch.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jsch.core.hasChangedDefaultWin32SshHome=true 3 | -------------------------------------------------------------------------------- /Simulation0/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs: -------------------------------------------------------------------------------- 1 | PROBLEMS_FILTERS_MIGRATE=true 2 | eclipse.preferences.version=1 3 | platformState=1564567518953 4 | quickStart=false 5 | tipsAndTricks=true 6 | -------------------------------------------------------------------------------- /Simulation0/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | showIntro=false 3 | -------------------------------------------------------------------------------- /Simulation0/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.workbench.prefs: -------------------------------------------------------------------------------- 1 | //org.eclipse.ui.commands/state/org.eclipse.ui.navigator.resources.nested.changeProjectPresentation/org.eclipse.ui.commands.radioState=false 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /Simulation0/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | -------------------------------------------------------------------------------- /Simulation0/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Simulation0/.metadata/.plugins/org.omnetpp.main/dialog_settings.xml: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |
5 | -------------------------------------------------------------------------------- /Simulation0/.metadata/version.ini: -------------------------------------------------------------------------------- 1 | #Wed Jul 31 12:12:26 CEST 2019 2 | org.eclipse.core.runtime=2 3 | org.eclipse.platform=4.11.0.v20190307-0500 4 | -------------------------------------------------------------------------------- /Simulation0/.oppbuildspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Simulation0/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Simulation0 4 | 5 | 6 | 7 | 8 | 9 | org.omnetpp.cdt.MakefileBuilder 10 | 11 | 12 | 13 | 14 | org.omnetpp.scave.builder.vectorfileindexer 15 | 16 | 17 | 18 | 19 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 20 | clean,full,incremental, 21 | 22 | 23 | 24 | 25 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 26 | full,incremental, 27 | 28 | 29 | 30 | 31 | 32 | org.eclipse.cdt.core.cnature 33 | org.eclipse.cdt.core.ccnature 34 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 35 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 36 | org.omnetpp.main.omnetppnature 37 | 38 | 39 | -------------------------------------------------------------------------------- /Simulation0/.qtenvrc: -------------------------------------------------------------------------------- 1 | [General] 2 | last-configname=General 3 | last-runnumber=0 4 | 5 | [RunModeProfiles] 6 | fast-max-animation-speed=nan 7 | fast-max-playback-speed=1e+6 8 | fast-min-animation-speed=nan 9 | fast-min-playback-speed=1 10 | fast-playback-speed=91.20108393559097 11 | run-max-animation-speed=nan 12 | run-max-playback-speed=100 13 | run-min-animation-speed=nan 14 | run-min-playback-speed=0.01 15 | run-playback-speed=100 16 | -------------------------------------------------------------------------------- /Simulation0/.settings/language.settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Simulation0/Net5.anf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Simulation0/NoREADME.txt: -------------------------------------------------------------------------------- 1 | Routing 2 | ======= 3 | 4 | Demonstrates static shortest-path routing. Routing tables are set up at the 5 | beginning of the simulation using the cTopology class. The model is 6 | intentionally kept simple to facilitate understanding. 7 | 8 | The network topology is the one widely known as the "NTT backbone", and it was 9 | contributed by Mudassar Farooq. 10 | 11 | Every node queries the topology of the network independently, using a cTopology 12 | object. Then it computes shortest paths to every other node, and stores the 13 | first nodes of the paths in a next-hop table. (Actually the table contains 14 | the port number to the next-hop node not the node address itself -- the table 15 | thus provides dest-address -> next-hop-address mapping). All the above takes 16 | place once, at the beginning of this simulation. The topology is static during 17 | the simulation, and so there's no need for the nodes to do anything to keep 18 | the tables up-to-date. There's no routing protocol in the model. 19 | 20 | Once the routing tables are set up, nodes start sending packets at random 21 | intervals. Every node gets a list of destination addresses in a parameter, 22 | and for every packet it randomly chooses a destination from the list. 23 | 24 | There are two apps provided: App generates packets with exponential inter-arrival 25 | times, while BurstyApp alternates between active and idle periods. BurstyApp's 26 | implementation demonstrates the use of the FSMs (Finite State Machine). 27 | -------------------------------------------------------------------------------- /Simulation0/frames/NetBuilder#0_0000.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation0/frames/NetBuilder#0_0000.png -------------------------------------------------------------------------------- /Simulation0/frames/NetBuilder#0_0001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation0/frames/NetBuilder#0_0001.png -------------------------------------------------------------------------------- /Simulation0/frames/NetBuilder#0_0002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation0/frames/NetBuilder#0_0002.png -------------------------------------------------------------------------------- /Simulation0/frames/NetBuilder#0_0003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation0/frames/NetBuilder#0_0003.png -------------------------------------------------------------------------------- /Simulation0/frames/NetBuilder#0_0004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation0/frames/NetBuilder#0_0004.png -------------------------------------------------------------------------------- /Simulation0/frames/NetBuilder#0_0005.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation0/frames/NetBuilder#0_0005.png -------------------------------------------------------------------------------- /Simulation0/frames/NetBuilder#0_0006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation0/frames/NetBuilder#0_0006.png -------------------------------------------------------------------------------- /Simulation0/frames/NetBuilder#0_0007.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation0/frames/NetBuilder#0_0007.png -------------------------------------------------------------------------------- /Simulation0/frames/NetBuilder#0_0008.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation0/frames/NetBuilder#0_0008.png -------------------------------------------------------------------------------- /Simulation0/frames/NetBuilder#0_0009.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation0/frames/NetBuilder#0_0009.png -------------------------------------------------------------------------------- /Simulation0/frames/NetBuilder#0_0010.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation0/frames/NetBuilder#0_0010.png -------------------------------------------------------------------------------- /Simulation0/frames/NetBuilder#0_0011.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation0/frames/NetBuilder#0_0011.png -------------------------------------------------------------------------------- /Simulation0/frames/NetBuilder#0_0012.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation0/frames/NetBuilder#0_0012.png -------------------------------------------------------------------------------- /Simulation0/frames/NetBuilder#0_0013.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation0/frames/NetBuilder#0_0013.png -------------------------------------------------------------------------------- /Simulation0/frames/NetBuilder#0_0014.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation0/frames/NetBuilder#0_0014.png -------------------------------------------------------------------------------- /Simulation0/frames/NetBuilder#0_0015.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation0/frames/NetBuilder#0_0015.png -------------------------------------------------------------------------------- /Simulation0/frames/NetBuilder#0_0016.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation0/frames/NetBuilder#0_0016.png -------------------------------------------------------------------------------- /Simulation0/frames/NetBuilder#0_0017.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation0/frames/NetBuilder#0_0017.png -------------------------------------------------------------------------------- /Simulation0/frames/NetBuilder#0_0018.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation0/frames/NetBuilder#0_0018.png -------------------------------------------------------------------------------- /Simulation0/makefrag: -------------------------------------------------------------------------------- 1 | MSGC:=$(MSGC) --msg6 -------------------------------------------------------------------------------- /Simulation0/node/App.ned: -------------------------------------------------------------------------------- 1 | package node; 2 | 3 | // 4 | // Application model to generate traffic for the network. 5 | // 6 | simple App like IApp 7 | { 8 | parameters: 9 | int address; // local node address 10 | int totalNodes; 11 | int initialMoney; 12 | int evilNumberOfSleepingTransaction; 13 | int evilNumberOfTransaction; 14 | string evilNodeIds; 15 | int randomSeed = intuniform(0, 1000000); 16 | volatile double sendIaTime @unit(s) = default(exponential(1s)); // time between generating packets 17 | volatile double sendIaTimeEvil @unit(s); 18 | volatile int packetLength @unit(byte); // length of one message (fixed! no "volatile" modifier) 19 | @display("i=block/browser"); 20 | @signal[endToEndDelay](type="simtime_t"); 21 | @signal[hopCount](type="long"); 22 | @signal[sourceAddress](type="long"); 23 | @statistic[endToEndDelay](title="end-to-end delay of arrived packets"; unit=s; record=vector,mean,max; interpolationmode=none); 24 | @statistic[hopCount](title="hop count of arrived packets"; interpolationmode=none; record=vector?,mean,max); 25 | @statistic[sourceAddress](title="source address of arrived packets"; interpolationmode=none; record=vector?); 26 | gates: 27 | input in; 28 | output out; 29 | output direct; 30 | } 31 | 32 | 33 | -------------------------------------------------------------------------------- /Simulation0/node/IApp.ned: -------------------------------------------------------------------------------- 1 | package node; 2 | 3 | // 4 | // Interface for network traffic generator modules that 5 | // can be used in Node. 6 | // 7 | moduleinterface IApp 8 | { 9 | parameters: 10 | int address; // local node address 11 | gates: 12 | input in; 13 | output out; 14 | } 15 | 16 | 17 | -------------------------------------------------------------------------------- /Simulation0/node/L2Queue.ned: -------------------------------------------------------------------------------- 1 | package node; 2 | 3 | // 4 | // Represents the network interface for a point-to-point connection. 5 | // 6 | // Packets arriving from the upper layer ("in" gate) are sent out on 7 | // the "line" gate, which is expected to be connected to a link with 8 | // nonzero data rate. Packets that arrive while a previous packet is 9 | // being transmitted are queued up. The maximum queue size in packets 10 | // can be specified in a parameter. Excess frames are simply discarded 11 | // and recorded as statistics. 12 | // 13 | // The model can be easily extended in several ways: to make it possible to 14 | // query the queue length from another module via a direct method call 15 | // interface, to implement priority queueing, or to collect link statistics 16 | // (utilization, etc.) 17 | // 18 | simple L2Queue 19 | { 20 | parameters: 21 | int frameCapacity = default(0); // max number of packets; 0 means no limit 22 | bool useCutThroughSwitching = default(false); // use cut-through switching instead of store-and-forward 23 | @display("i=block/queue;q=queue"); 24 | @signal[qlen](type="long"); 25 | @signal[busy](type="bool"); 26 | @signal[queueingTime](type="simtime_t"); 27 | @signal[drop](type="long"); 28 | @signal[txBytes](type="long"); 29 | @signal[rxBytes](type="long"); 30 | @statistic[qlen](title="queue length";record=vector?,timeavg,max;interpolationmode=sample-hold); 31 | @statistic[busy](title="server busy state";record=vector?,timeavg;interpolationmode=sample-hold); 32 | @statistic[queueingTime](title="queueing time at dequeue";unit=s;interpolationmode=none); 33 | @statistic[drop](title="dropped packet byte length";unit=bytes;record=vector?,count,sum;interpolationmode=none); 34 | @statistic[txBytes](title="transmitting packet byte length";unit=bytes;record=vector?,count,sum,histogram;interpolationmode=none); 35 | @statistic[rxBytes](title="received packet byte length";unit=bytes;record=vector?,count,sum,histogram;interpolationmode=none); 36 | gates: 37 | input in; 38 | output out; 39 | inout line; 40 | input direct @directIn; 41 | } 42 | 43 | 44 | -------------------------------------------------------------------------------- /Simulation0/node/Node.ned: -------------------------------------------------------------------------------- 1 | package node; 2 | 3 | // 4 | // A "Node" consists of a Routing plus an App module which represents the 5 | // aggregate traffic of the subnets connected to that router. 6 | // 7 | module Node 8 | { 9 | parameters: 10 | int address; 11 | string appType; 12 | @display("i=misc/node_vs,gold"); 13 | gates: 14 | inout port[]; 15 | submodules: 16 | app: like IApp { 17 | parameters: 18 | address = address; 19 | @display("p=140,60"); 20 | } 21 | routing: Routing { 22 | parameters: 23 | @display("p=140,130"); 24 | gates: 25 | in[sizeof(port)]; 26 | out[sizeof(port)]; 27 | } 28 | queue[sizeof(port)]: L2Queue { 29 | parameters: 30 | @display("p=80,200,row"); 31 | } 32 | connections allowunconnected: 33 | routing.localOut --> app.in; 34 | routing.localIn <-- app.out; 35 | for i=0..sizeof(port)-1 { 36 | routing.out[i] --> queue[i].in; 37 | routing.in[i] <-- queue[i].out; 38 | queue[i].line <--> port[i]; 39 | } 40 | } 41 | 42 | 43 | -------------------------------------------------------------------------------- /Simulation0/node/Packet.msg: -------------------------------------------------------------------------------- 1 | // 2 | // Represents a packet in the network. 3 | // 4 | cplusplus {{ 5 | #include "PacketType.h" 6 | }} 7 | 8 | enum PacketType; 9 | 10 | packet Packet 11 | { 12 | int srcAddr @packetData; 13 | int destAddr @packetData; 14 | int hopCount @packetData; 15 | 16 | // This is an enum and it has the following meaning 17 | // 0 - Transaction 18 | // 1 - Chain Request 19 | // 2 - Send Chain 20 | // 3 - Ack of Transaction 21 | // 4 - Information Dissemination 22 | // 5 - Busy Message 23 | int packetType @packetData; 24 | //int packetType @enum(PacketType); 25 | 26 | //Send Transaction 27 | int transactionValue @packetData; 28 | int myChainSeqNum @packetData; 29 | 30 | //Sending Chain Information 31 | //int databaseSize @packetData; 32 | //int userA[] @packetData; 33 | int userBID[] @packetData; 34 | int userBSeqNum[] @packetData; 35 | int transaction[] @packetData; 36 | 37 | //Dissemination data 38 | int userXID @packetData; 39 | int userXSeqNum @packetData; 40 | int userYID @packetData; 41 | int userYSeqNum @packetData; 42 | } 43 | -------------------------------------------------------------------------------- /Simulation0/node/PacketType.h: -------------------------------------------------------------------------------- 1 | enum PacketType 2 | { 3 | NONE = 0, 4 | UDP = 1, 5 | TCP = 2, 6 | SCTP = 3 7 | }; 8 | -------------------------------------------------------------------------------- /Simulation0/node/Routing.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "Packet_m.h" 4 | 5 | using namespace omnetpp; 6 | 7 | /** 8 | * Demonstrates static routing, utilizing the cTopology class. 9 | */ 10 | class Routing: public cSimpleModule { 11 | private: 12 | int myAddress; 13 | 14 | typedef std::map RoutingTable; // destaddr -> gateindex 15 | RoutingTable rtable; 16 | 17 | simsignal_t dropSignal; 18 | simsignal_t outputIfSignal; 19 | public: 20 | std::vector neighbourNodeAddresses; 21 | 22 | protected: 23 | virtual void initialize() override; 24 | virtual void handleMessage(cMessage *msg) override; 25 | virtual void sendOut(Packet *pk); 26 | }; 27 | -------------------------------------------------------------------------------- /Simulation0/node/Routing.ned: -------------------------------------------------------------------------------- 1 | package node; 2 | 3 | // 4 | // Models a router. 5 | // 6 | simple Routing 7 | { 8 | parameters: 9 | @display("i=block/switch"); 10 | @signal[drop](type="long"); 11 | @signal[outputIf](type="long"); 12 | @statistic[drop](title="dropped packet byte length";unit=bytes;record=vector?,count,sum;interpolationmode=none); 13 | @statistic[outputIf](title="output interface for each routed packet";record=histogram;interpolationmode=none); 14 | gates: 15 | input in[]; 16 | output out[]; 17 | input localIn; 18 | output localOut; 19 | } 20 | 21 | 22 | -------------------------------------------------------------------------------- /Simulation0/omnetpp.ini: -------------------------------------------------------------------------------- 1 | [General] 2 | #eventlog-message-detail-pattern = Packet:declaredOn(Packet) or bitLength 3 | #eventlog-message-detail-pattern = * 4 | #cpu-time-limit = 120s #just as backup for server runs 5 | cmdenv-express-mode = true 6 | cmdenv-performance-display = false 7 | cmdenv-status-frequency = 5000000s 8 | record-eventlog = false 9 | debug-on-errors = false 10 | **.result-recording-modes = - 11 | **.vector-recording = false 12 | **.scalar-recording = false 13 | **.tcp.**.scalar-recording = false 14 | **.endToEndDelay.scalar-recording = false 15 | #cmdenv-stop-batch-on-error = false 16 | 17 | # Simulation 18 | seed-set = ${repetition} 19 | repeat = 50 20 | network = networks.Net5 21 | 22 | # Node 23 | **.totalNodes = 500 24 | **.appType = "App" 25 | **.app.packetLength = 1500 bytes #Packet size https://www.isi.edu/~johnh/PAPERS/Sinha07a.pdf 26 | **.sendIaTime = uniform(5s, 10s) 27 | **.sendIaTimeEvil = 10ms 28 | **.initialMoney = 100 29 | **.evilNodeIds = "" #list of the evil node ids, space is used to separate the ids, -1 mean that there is no evil node, if you leave this empty the evil node is randomly selected 30 | **.evilNumberOfSleepingTransaction = 1 #[1 is MIN] 31 | **.evilNumberOfTransaction = 2 #[2 is MIN] total max number of transaction to perform after the first evil transaction 32 | 33 | 34 | # Channel 35 | Net5.delay = 100ms 36 | #https://wondernetwork.com/pings 37 | #https://enterprise.verizon.com/terms/latency/ 38 | #https://www.dotcom-tools.com/internet-backbone-latency.aspx 39 | Net5.datarate = 7200kbps 40 | #https://www.akamai.com/us/en/about/news/press/2017-press/akamai-releases-first-quarter-2017-state-of-the-internet-connectivity-report.jsp 41 | #https://www.fastmetrics.com/internet-connection-speed-by-country.php#top-10-worldwide -------------------------------------------------------------------------------- /Simulation0/out/clang-release/.last-copts: -------------------------------------------------------------------------------- 1 | -O3 -DNDEBUG=1 -MMD -MP -MF .d -isystem /usr/include -isystem /mingw64/include -Wno-deprecated-register -Wno-unused-function -fno-stack-protector -DXMLPARSER=libxml -DPREFER_QTENV -DWITH_QTENV -DWITH_PARSIM -DWITH_NETBUILDER -DWITH_OSG -DWITH_OSGEARTH -I. -IC:/Users/umeer/Desktop/University/omnetpp-5.5.1/include 2 | -------------------------------------------------------------------------------- /Simulation0/out/clang-release/node/App.o.d: -------------------------------------------------------------------------------- 1 | out/clang-release//node/App.o: node/App.cc node/App.h \ 2 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h \ 3 | node/Packet_m.h node/PacketType.h node/Routing.h 4 | 5 | node/App.h: 6 | 7 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h: 8 | 9 | node/Packet_m.h: 10 | 11 | node/PacketType.h: 12 | 13 | node/Routing.h: 14 | -------------------------------------------------------------------------------- /Simulation0/out/clang-release/node/L2Queue.o.d: -------------------------------------------------------------------------------- 1 | out/clang-release//node/L2Queue.o: node/L2Queue.cc \ 2 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h 3 | 4 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h: 5 | -------------------------------------------------------------------------------- /Simulation0/out/clang-release/node/Packet_m.h.d: -------------------------------------------------------------------------------- 1 | node/Packet_m.cc node/Packet_m.h : \ 2 | node/Packet.msg 3 | node/Packet.msg: 4 | -------------------------------------------------------------------------------- /Simulation0/out/clang-release/node/Packet_m.o.d: -------------------------------------------------------------------------------- 1 | out/clang-release//node/Packet_m.o: node/Packet_m.cc node/Packet_m.h \ 2 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h \ 3 | node/PacketType.h 4 | 5 | node/Packet_m.h: 6 | 7 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h: 8 | 9 | node/PacketType.h: 10 | -------------------------------------------------------------------------------- /Simulation0/out/clang-release/node/Routing.o.d: -------------------------------------------------------------------------------- 1 | out/clang-release//node/Routing.o: node/Routing.cc node/Routing.h \ 2 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h \ 3 | node/Packet_m.h node/PacketType.h 4 | 5 | node/Routing.h: 6 | 7 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h: 8 | 9 | node/Packet_m.h: 10 | 11 | node/PacketType.h: 12 | -------------------------------------------------------------------------------- /Simulation0/out/gcc-debug/.last-copts: -------------------------------------------------------------------------------- 1 | -g -Wall -MMD -MP -MF .d -fPIC -fno-stack-protector -DHAVE_SWAPCONTEXT -DWITH_MPI -DXMLPARSER=libxml -DPREFER_QTENV -DWITH_QTENV -DWITH_PARSIM -DWITH_NETBUILDER -DWITH_OSG -DWITH_OSGEARTH -I/home/umeer/omnetpp-5.4.1/include 2 | -------------------------------------------------------------------------------- /Simulation0/out/gcc-debug/builder/netbuilder.d: -------------------------------------------------------------------------------- 1 | out/gcc-debug//builder/netbuilder.o: builder/netbuilder.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | -------------------------------------------------------------------------------- /Simulation0/out/gcc-debug/node/App.d: -------------------------------------------------------------------------------- 1 | out/gcc-debug//node/App.o: node/App.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h node/Packet_m.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | 6 | node/Packet_m.h: 7 | -------------------------------------------------------------------------------- /Simulation0/out/gcc-debug/node/BurstyApp.d: -------------------------------------------------------------------------------- 1 | out/gcc-debug//node/BurstyApp.o: node/BurstyApp.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h node/Packet_m.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | 6 | node/Packet_m.h: 7 | -------------------------------------------------------------------------------- /Simulation0/out/gcc-debug/node/L2Queue.d: -------------------------------------------------------------------------------- 1 | out/gcc-debug//node/L2Queue.o: node/L2Queue.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | -------------------------------------------------------------------------------- /Simulation0/out/gcc-debug/node/Packet_m.d: -------------------------------------------------------------------------------- 1 | out/gcc-debug//node/Packet_m.o: node/Packet_m.cc node/Packet_m.h \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h 3 | 4 | node/Packet_m.h: 5 | 6 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 7 | -------------------------------------------------------------------------------- /Simulation0/out/gcc-debug/node/Routing.d: -------------------------------------------------------------------------------- 1 | out/gcc-debug//node/Routing.o: node/Routing.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h node/Packet_m.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | 6 | node/Packet_m.h: 7 | -------------------------------------------------------------------------------- /Simulation0/out/gcc-debug/routing_dbg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation0/out/gcc-debug/routing_dbg -------------------------------------------------------------------------------- /Simulation0/out/gcc-release/.last-copts: -------------------------------------------------------------------------------- 1 | -O3 -DNDEBUG=1 -MMD -MP -MF .d -fPIC -fno-stack-protector -DHAVE_SWAPCONTEXT -DWITH_MPI -DXMLPARSER=libxml -DPREFER_QTENV -DWITH_QTENV -DWITH_PARSIM -DWITH_NETBUILDER -DWITH_OSG -DWITH_OSGEARTH -I. -I/home/umeer/omnetpp-5.4.1/include 2 | -------------------------------------------------------------------------------- /Simulation0/out/gcc-release/builder/netbuilder.d: -------------------------------------------------------------------------------- 1 | out/gcc-release//builder/netbuilder.o: builder/netbuilder.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | -------------------------------------------------------------------------------- /Simulation0/out/gcc-release/node/App.d: -------------------------------------------------------------------------------- 1 | out/gcc-release//node/App.o: node/App.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h node/Packet_m.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | 6 | node/Packet_m.h: 7 | -------------------------------------------------------------------------------- /Simulation0/out/gcc-release/node/BurstyApp.d: -------------------------------------------------------------------------------- 1 | out/gcc-release//node/BurstyApp.o: node/BurstyApp.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h node/Packet_m.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | 6 | node/Packet_m.h: 7 | -------------------------------------------------------------------------------- /Simulation0/out/gcc-release/node/L2Queue.d: -------------------------------------------------------------------------------- 1 | out/gcc-release//node/L2Queue.o: node/L2Queue.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | -------------------------------------------------------------------------------- /Simulation0/out/gcc-release/node/Packet_m.d: -------------------------------------------------------------------------------- 1 | out/gcc-release//node/Packet_m.o: node/Packet_m.cc node/Packet_m.h \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h 3 | 4 | node/Packet_m.h: 5 | 6 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 7 | -------------------------------------------------------------------------------- /Simulation0/out/gcc-release/node/Routing.d: -------------------------------------------------------------------------------- 1 | out/gcc-release//node/Routing.o: node/Routing.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h node/Packet_m.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | 6 | node/Packet_m.h: 7 | -------------------------------------------------------------------------------- /Simulation0/out/gcc-release/routing: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation0/out/gcc-release/routing -------------------------------------------------------------------------------- /Simulation0/out/gcc-release/routing_umeer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation0/out/gcc-release/routing_umeer -------------------------------------------------------------------------------- /Simulation0/package.ned: -------------------------------------------------------------------------------- 1 | // this sample simulation is part of OMNeT++ 2 | @license(omnetpp); 3 | -------------------------------------------------------------------------------- /Simulation0/parsim/README.txt: -------------------------------------------------------------------------------- 1 | Parallel version of the Routing example 2 | ======================================= 3 | 4 | This example demonstrates the parallel distributed simulation capabilities 5 | of OMNeT++. The model itself is the "stock" Routing simulation -- it hasn't 6 | been modified or specially instrumented for parallel execution. 7 | 8 | For more information on parallel simulation see the README in the cqn/parsim 9 | directory and the OMNeT++ Manual. 10 | -------------------------------------------------------------------------------- /Simulation0/parsim/omnetpp.ini: -------------------------------------------------------------------------------- 1 | [General] 2 | parallel-simulation = true 3 | parsim-communications-class = "cNamedPipeCommunications" 4 | parsim-synchronization-class = "cNullMessageProtocol" 5 | sim-time-limit = 10000s 6 | 7 | 8 | [Config Net60-parsim] 9 | network = networks.Net60 10 | description = "Possible speedup with parallel simulation" 11 | 12 | **.appType = "App" 13 | **.app.packetLength = 1024 bytes 14 | **.destAddresses = "1 23 34 55" 15 | **.sendIaTime = exponential(10ms) # high traffic 16 | 17 | # assume long distances among network nodes -- a 10ms lookahead may result in 18 | # a reasonable speedup even for this small network 19 | **.channel.delay = 10ms 20 | 21 | *.rte[..26]**.partition-id = 0 22 | *.rte[27..]**.partition-id = 1 23 | 24 | 25 | [Config Net10-parsim] 26 | network = networks.Net10 27 | description = "Poor parsim performance -- network is too small" 28 | 29 | **.appType = "App" 30 | **.app.packetLength = 1024 bytes 31 | **.destAddresses = "1 6" 32 | **.sendIaTime = exponential(10ms) # high traffic 33 | 34 | *.rte[0..4]**.partition-id = 0 35 | *.rte[5..9]**.partition-id = 1 36 | 37 | **.channel.delay = 10ms 38 | -------------------------------------------------------------------------------- /Simulation0/parsim/runparsim: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | echo 3 | echo '*** Distributed execution of the Routing example simulation ***' 4 | echo 'IMPORTANT: If you'"'"'re running the simulation under the Tkenv GUI,' 5 | echo 'you'"'"'ll have to click [Run] in all windows to start the simulation.' 6 | echo 'See Readme.txt for more info.' 7 | echo 8 | 9 | rm -rf comm 10 | mkdir comm 11 | mkdir comm/read 12 | 13 | # make sure HOSTNAME is exported as some distros no longer export it by default 14 | if test "$HOSTNAME" = ""; then 15 | export HOSTNAME=`hostname` 16 | fi 17 | 18 | export NEDPATH=.. 19 | ../routing -p0,2 $* > routing-0.log & 20 | ../routing -p1,2 $* > routing-1.log & 21 | 22 | 23 | -------------------------------------------------------------------------------- /Simulation0/parsim/runparsim-cmd.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo. 3 | echo *** Distributed execution of the Routing example simulation *** 4 | echo. 5 | if "%*"=="" pause 6 | 7 | rmdir /S /Q comm 2>nul 8 | mkdir comm 9 | mkdir comm\read 10 | 11 | set NEDPATH=.. 12 | start /b /belownormal ..\routing -p0,2 -u Cmdenv %* 13 | start /b /belownormal ..\routing -p1,2 -u Cmdenv %* 14 | -------------------------------------------------------------------------------- /Simulation0/parsim/runparsim-mpi: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # make sure HOSTNAME is exported as some distros no longer export it by default 4 | if test "$HOSTNAME" = ""; then 5 | export HOSTNAME=`hostname` 6 | fi 7 | 8 | mpiexec -n 3 ../routing -n .. -c Net10-parsim -u Cmdenv --parsim-communications-class=cMPICommunications 9 | -------------------------------------------------------------------------------- /Simulation0/parsim/runparsim.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo. 3 | echo *** Distributed execution of the Routing example simulation *** 4 | echo If you're running the simulation under the Tkenv GUI, you'll have to 5 | echo click [Run] in all windows to start the simulation. 6 | echo See Readme.txt for more info. 7 | echo. 8 | if "%*"=="" pause 9 | 10 | rmdir /S /Q comm 2>nul 11 | mkdir comm 12 | mkdir comm\read 13 | 14 | set NEDPATH=.. 15 | start /b /belownormal ..\routing -p0,2 %* 16 | start /b /belownormal ..\routing -p1,2 %* 17 | -------------------------------------------------------------------------------- /Simulation0/templates/randomtopo/gatename.xswt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 23 | 24 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /Simulation0/templates/randomtopo/nearest3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation0/templates/randomtopo/nearest3.jar -------------------------------------------------------------------------------- /Simulation0/templates/randomtopo/nedtypes.xswt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 35 | 36 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /Simulation0/templates/randomtopo/network.ned.ftl: -------------------------------------------------------------------------------- 1 | <@setoutput path=targetMainFile?default("")/> 2 | ${bannerComment} 3 | 4 | <#if nedPackageName!="">package ${nedPackageName}; 5 | <#if gateName==""><#assign gateName = "g"> 6 | <#assign gateName = StringUtils.makeValidIdentifier(gateName)> 7 | 8 | <#if !NedUtils.isVisibleType(nodeType,targetFolder)> 9 | <#assign nodeType = StringUtils.makeValidIdentifier(nodeType)> 10 | module ${nodeType} { 11 | parameters: 12 | @display("i=abstract/router_vs"); 13 | gates: 14 | inout ${gateName}[]; 15 | } 16 | 17 | 18 | <#if !NedUtils.isVisibleType(channelType,targetFolder)> 19 | <#assign channelType = StringUtils.makeValidIdentifier(channelType)> 20 | channel ${channelType} extends ned.DatarateChannel { 21 | parameters: 22 | int cost = default(0); 23 | } 24 | 25 | 26 | <#assign numNodes = numNodes?number> 27 | <#assign seed = seed?number> 28 | 29 | <#assign topo = LangUtils.newInstance("Nearest3")> 30 | <@do topo.setNodes(numNodes) !/> 31 | <@do topo.setSeed(seed) !/> 32 | 33 | <#assign graph = topo.generate()> 34 | 35 | <#assign nodeX = graph.nodeX> 36 | <#assign nodeY = graph.nodeY> 37 | <#assign numEdges = graph.numEdges> 38 | <#assign edgeSrc = graph.edgeSrc> 39 | <#assign edgeDest = graph.edgeDest> 40 | 41 | // 42 | // Generated network (${numNodes} nodes, seed=${seed}) 43 | // 44 | <#assign networkKeyword = iif(wizardType=="compoundmodule", "module", "network")> 45 | ${networkKeyword} ${targetTypeName} { 46 | submodules: 47 | <#list 0..numNodes-1 as i> 48 | <#if addCoordinates> 49 | node${i} : ${nodeType} { @display("p=${nodeX[i]},${nodeY[i]}"); }; 50 | <#else> 51 | node${i} : ${nodeType}; 52 | 53 | 54 | connections: 55 | <#list 0..numEdges-1 as i> 56 | node${edgeSrc[i]}.${gateName}++ <--> ${channelType} <--> node${edgeDest[i]}.${gateName}++; 57 | 58 | } 59 | -------------------------------------------------------------------------------- /Simulation0/templates/randomtopo/omnetpp.ini.ftl: -------------------------------------------------------------------------------- 1 | <#if wizardType=="project" || wizardType=="simulation"> 2 | [General] 3 | network = ${targetTypeName} 4 | 5 | -------------------------------------------------------------------------------- /Simulation0/templates/randomtopo/package.ned.ftl: -------------------------------------------------------------------------------- 1 | <#if wizardType=="project"><#-- not needed for simulations, because they go into subfolders --> 2 | <#if nedPackageName!="">package ${nedPackageName}; 3 | 4 | -------------------------------------------------------------------------------- /Simulation0/templates/randomtopo/params.xswt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 34 | 35 | -------------------------------------------------------------------------------- /Simulation0/templates/randomtopo/template.properties: -------------------------------------------------------------------------------- 1 | templateName = Network with a Random Topology 2 | templateDescription = Generates a network with random network topology 3 | templateCategory = 4 | supportedWizardTypes = simulation, nedfile, network, compoundmodule 5 | ignoreResources = *.java 6 | 7 | # template variables 8 | numNodes = 30 9 | seed = 100 10 | 11 | targetTypeName = Network 12 | nodeType = node.Node 13 | channelType = Link 14 | gateName = port 15 | addCoordinates = false 16 | 17 | # custom wizard pages 18 | page.1.file = params.xswt 19 | page.1.title = Generate Random Topology 20 | 21 | page.2.file = nedtypes.xswt 22 | page.2.title = NED Details 23 | 24 | page.3.file = gatename.xswt 25 | page.3.title = Gate 26 | -------------------------------------------------------------------------------- /Simulation1/.cmdenv-log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/.cmdenv-log -------------------------------------------------------------------------------- /Simulation1/.metadata/.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/.metadata/.lock -------------------------------------------------------------------------------- /Simulation1/.metadata/.plugins/org.eclipse.cdt.core/.log: -------------------------------------------------------------------------------- 1 | *** SESSION Jul 31, 2019 12:12:29.07 ------------------------------------------- 2 | -------------------------------------------------------------------------------- /Simulation1/.metadata/.plugins/org.eclipse.cdt.make.core/specs.c: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Simulation1/.metadata/.plugins/org.eclipse.cdt.make.core/specs.cpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Simulation1/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /Simulation1/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /Simulation1/.metadata/.plugins/org.eclipse.core.resources/.root/1.tree: -------------------------------------------------------------------------------- 1 | org.eclipse.cdt.core -------------------------------------------------------------------------------- /Simulation1/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources -------------------------------------------------------------------------------- /Simulation1/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.cdt.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | spelling_locale=en_GB 3 | spelling_locale_initialized=true 4 | useAnnotationsPrefPage=true 5 | useQuickDiffPrefPage=true 6 | -------------------------------------------------------------------------------- /Simulation1/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | version=1 3 | -------------------------------------------------------------------------------- /Simulation1/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jsch.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jsch.core.hasChangedDefaultWin32SshHome=true 3 | -------------------------------------------------------------------------------- /Simulation1/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs: -------------------------------------------------------------------------------- 1 | PROBLEMS_FILTERS_MIGRATE=true 2 | eclipse.preferences.version=1 3 | platformState=1564567518953 4 | quickStart=false 5 | tipsAndTricks=true 6 | -------------------------------------------------------------------------------- /Simulation1/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | showIntro=false 3 | -------------------------------------------------------------------------------- /Simulation1/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.workbench.prefs: -------------------------------------------------------------------------------- 1 | //org.eclipse.ui.commands/state/org.eclipse.ui.navigator.resources.nested.changeProjectPresentation/org.eclipse.ui.commands.radioState=false 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /Simulation1/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | -------------------------------------------------------------------------------- /Simulation1/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Simulation1/.metadata/.plugins/org.omnetpp.main/dialog_settings.xml: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |
5 | -------------------------------------------------------------------------------- /Simulation1/.metadata/version.ini: -------------------------------------------------------------------------------- 1 | #Wed Jul 31 12:12:26 CEST 2019 2 | org.eclipse.core.runtime=2 3 | org.eclipse.platform=4.11.0.v20190307-0500 4 | -------------------------------------------------------------------------------- /Simulation1/.oppbuildspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Simulation1/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Simulation1 4 | 5 | 6 | 7 | 8 | 9 | org.omnetpp.cdt.MakefileBuilder 10 | 11 | 12 | 13 | 14 | org.omnetpp.scave.builder.vectorfileindexer 15 | 16 | 17 | 18 | 19 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 20 | clean,full,incremental, 21 | 22 | 23 | 24 | 25 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 26 | full,incremental, 27 | 28 | 29 | 30 | 31 | 32 | org.eclipse.cdt.core.cnature 33 | org.eclipse.cdt.core.ccnature 34 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 35 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 36 | org.omnetpp.main.omnetppnature 37 | 38 | 39 | -------------------------------------------------------------------------------- /Simulation1/.qtenvrc: -------------------------------------------------------------------------------- 1 | [General] 2 | last-configname=General 3 | last-runnumber=6 4 | 5 | [RunModeProfiles] 6 | fast-max-animation-speed=nan 7 | fast-max-playback-speed=1e+6 8 | fast-min-animation-speed=nan 9 | fast-min-playback-speed=1 10 | fast-playback-speed=91.20108393559097 11 | run-max-animation-speed=nan 12 | run-max-playback-speed=100 13 | run-min-animation-speed=nan 14 | run-min-playback-speed=0.01 15 | run-playback-speed=0.010000000000000002 16 | -------------------------------------------------------------------------------- /Simulation1/.settings/language.settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Simulation1/Net5.anf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Simulation1/NoREADME.txt: -------------------------------------------------------------------------------- 1 | Routing 2 | ======= 3 | 4 | Demonstrates static shortest-path routing. Routing tables are set up at the 5 | beginning of the simulation using the cTopology class. The model is 6 | intentionally kept simple to facilitate understanding. 7 | 8 | The network topology is the one widely known as the "NTT backbone", and it was 9 | contributed by Mudassar Farooq. 10 | 11 | Every node queries the topology of the network independently, using a cTopology 12 | object. Then it computes shortest paths to every other node, and stores the 13 | first nodes of the paths in a next-hop table. (Actually the table contains 14 | the port number to the next-hop node not the node address itself -- the table 15 | thus provides dest-address -> next-hop-address mapping). All the above takes 16 | place once, at the beginning of this simulation. The topology is static during 17 | the simulation, and so there's no need for the nodes to do anything to keep 18 | the tables up-to-date. There's no routing protocol in the model. 19 | 20 | Once the routing tables are set up, nodes start sending packets at random 21 | intervals. Every node gets a list of destination addresses in a parameter, 22 | and for every packet it randomly chooses a destination from the list. 23 | 24 | There are two apps provided: App generates packets with exponential inter-arrival 25 | times, while BurstyApp alternates between active and idle periods. BurstyApp's 26 | implementation demonstrates the use of the FSMs (Finite State Machine). 27 | -------------------------------------------------------------------------------- /Simulation1/frames/NetBuilder#0_0000.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/frames/NetBuilder#0_0000.png -------------------------------------------------------------------------------- /Simulation1/frames/NetBuilder#0_0001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/frames/NetBuilder#0_0001.png -------------------------------------------------------------------------------- /Simulation1/frames/NetBuilder#0_0002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/frames/NetBuilder#0_0002.png -------------------------------------------------------------------------------- /Simulation1/frames/NetBuilder#0_0003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/frames/NetBuilder#0_0003.png -------------------------------------------------------------------------------- /Simulation1/frames/NetBuilder#0_0004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/frames/NetBuilder#0_0004.png -------------------------------------------------------------------------------- /Simulation1/frames/NetBuilder#0_0005.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/frames/NetBuilder#0_0005.png -------------------------------------------------------------------------------- /Simulation1/frames/NetBuilder#0_0006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/frames/NetBuilder#0_0006.png -------------------------------------------------------------------------------- /Simulation1/frames/NetBuilder#0_0007.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/frames/NetBuilder#0_0007.png -------------------------------------------------------------------------------- /Simulation1/frames/NetBuilder#0_0008.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/frames/NetBuilder#0_0008.png -------------------------------------------------------------------------------- /Simulation1/frames/NetBuilder#0_0009.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/frames/NetBuilder#0_0009.png -------------------------------------------------------------------------------- /Simulation1/frames/NetBuilder#0_0010.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/frames/NetBuilder#0_0010.png -------------------------------------------------------------------------------- /Simulation1/frames/NetBuilder#0_0011.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/frames/NetBuilder#0_0011.png -------------------------------------------------------------------------------- /Simulation1/frames/NetBuilder#0_0012.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/frames/NetBuilder#0_0012.png -------------------------------------------------------------------------------- /Simulation1/frames/NetBuilder#0_0013.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/frames/NetBuilder#0_0013.png -------------------------------------------------------------------------------- /Simulation1/frames/NetBuilder#0_0014.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/frames/NetBuilder#0_0014.png -------------------------------------------------------------------------------- /Simulation1/frames/NetBuilder#0_0015.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/frames/NetBuilder#0_0015.png -------------------------------------------------------------------------------- /Simulation1/frames/NetBuilder#0_0016.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/frames/NetBuilder#0_0016.png -------------------------------------------------------------------------------- /Simulation1/frames/NetBuilder#0_0017.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/frames/NetBuilder#0_0017.png -------------------------------------------------------------------------------- /Simulation1/frames/NetBuilder#0_0018.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/frames/NetBuilder#0_0018.png -------------------------------------------------------------------------------- /Simulation1/makefrag: -------------------------------------------------------------------------------- 1 | MSGC:=$(MSGC) --msg6 -------------------------------------------------------------------------------- /Simulation1/node/App.ned: -------------------------------------------------------------------------------- 1 | package node; 2 | 3 | // 4 | // Application model to generate traffic for the network. 5 | // 6 | simple App like IApp 7 | { 8 | parameters: 9 | int address; // local node address 10 | int totalNodes; 11 | int initialMoney; 12 | int evilNumberOfSleepingTransaction; 13 | int evilNumberOfTransaction; 14 | string evilNodeIds; 15 | int randomSeed = intuniform(0, 1000000); 16 | volatile double sendIaTime @unit(s) = default(exponential(1s)); // time between generating packets 17 | volatile double sendIaTimeEvil @unit(s); 18 | volatile int packetLength @unit(byte); // length of one message (fixed! no "volatile" modifier) 19 | @display("i=block/browser"); 20 | @signal[endToEndDelay](type="simtime_t"); 21 | @signal[hopCount](type="long"); 22 | @signal[sourceAddress](type="long"); 23 | @statistic[endToEndDelay](title="end-to-end delay of arrived packets";unit=s;record=vector,mean,max;interpolationmode=none); 24 | @statistic[hopCount](title="hop count of arrived packets";interpolationmode=none;record=vector?,mean,max); 25 | @statistic[sourceAddress](title="source address of arrived packets";interpolationmode=none;record=vector?); 26 | gates: 27 | input in; 28 | output out; 29 | output direct; 30 | } 31 | 32 | 33 | -------------------------------------------------------------------------------- /Simulation1/node/IApp.ned: -------------------------------------------------------------------------------- 1 | package node; 2 | 3 | // 4 | // Interface for network traffic generator modules that 5 | // can be used in Node. 6 | // 7 | moduleinterface IApp 8 | { 9 | parameters: 10 | int address; // local node address 11 | gates: 12 | input in; 13 | output out; 14 | } 15 | 16 | 17 | -------------------------------------------------------------------------------- /Simulation1/node/L2Queue.ned: -------------------------------------------------------------------------------- 1 | package node; 2 | 3 | // 4 | // Represents the network interface for a point-to-point connection. 5 | // 6 | // Packets arriving from the upper layer ("in" gate) are sent out on 7 | // the "line" gate, which is expected to be connected to a link with 8 | // nonzero data rate. Packets that arrive while a previous packet is 9 | // being transmitted are queued up. The maximum queue size in packets 10 | // can be specified in a parameter. Excess frames are simply discarded 11 | // and recorded as statistics. 12 | // 13 | // The model can be easily extended in several ways: to make it possible to 14 | // query the queue length from another module via a direct method call 15 | // interface, to implement priority queueing, or to collect link statistics 16 | // (utilization, etc.) 17 | // 18 | simple L2Queue 19 | { 20 | parameters: 21 | int frameCapacity = default(0); // max number of packets; 0 means no limit 22 | bool useCutThroughSwitching = default(false); // use cut-through switching instead of store-and-forward 23 | @display("i=block/queue;q=queue"); 24 | @signal[qlen](type="long"); 25 | @signal[busy](type="bool"); 26 | @signal[queueingTime](type="simtime_t"); 27 | @signal[drop](type="long"); 28 | @signal[txBytes](type="long"); 29 | @signal[rxBytes](type="long"); 30 | @statistic[qlen](title="queue length";record=vector?,timeavg,max;interpolationmode=sample-hold); 31 | @statistic[busy](title="server busy state";record=vector?,timeavg;interpolationmode=sample-hold); 32 | @statistic[queueingTime](title="queueing time at dequeue";unit=s;interpolationmode=none); 33 | @statistic[drop](title="dropped packet byte length";unit=bytes;record=vector?,count,sum;interpolationmode=none); 34 | @statistic[txBytes](title="transmitting packet byte length";unit=bytes;record=vector?,count,sum,histogram;interpolationmode=none); 35 | @statistic[rxBytes](title="received packet byte length";unit=bytes;record=vector?,count,sum,histogram;interpolationmode=none); 36 | gates: 37 | input in; 38 | output out; 39 | inout line; 40 | input direct @directIn; 41 | } 42 | 43 | 44 | -------------------------------------------------------------------------------- /Simulation1/node/Node.ned: -------------------------------------------------------------------------------- 1 | package node; 2 | 3 | // 4 | // A "Node" consists of a Routing plus an App module which represents the 5 | // aggregate traffic of the subnets connected to that router. 6 | // 7 | module Node 8 | { 9 | parameters: 10 | int address; 11 | string appType; 12 | @display("i=misc/node_vs,gold"); 13 | gates: 14 | inout port[]; 15 | submodules: 16 | app: like IApp { 17 | parameters: 18 | address = address; 19 | @display("p=140,60"); 20 | } 21 | routing: Routing { 22 | parameters: 23 | @display("p=140,130"); 24 | gates: 25 | in[sizeof(port)]; 26 | out[sizeof(port)]; 27 | } 28 | queue[sizeof(port)]: L2Queue { 29 | parameters: 30 | @display("p=80,200,row"); 31 | } 32 | connections allowunconnected: 33 | routing.localOut --> app.in; 34 | routing.localIn <-- app.out; 35 | for i=0..sizeof(port)-1 { 36 | routing.out[i] --> queue[i].in; 37 | routing.in[i] <-- queue[i].out; 38 | queue[i].line <--> port[i]; 39 | } 40 | } 41 | 42 | 43 | -------------------------------------------------------------------------------- /Simulation1/node/Packet.msg: -------------------------------------------------------------------------------- 1 | // 2 | // Represents a packet in the network. 3 | // 4 | cplusplus {{ 5 | #include "PacketType.h" 6 | }} 7 | 8 | enum PacketType; 9 | 10 | packet Packet 11 | { 12 | int srcAddr @packetData; 13 | int destAddr @packetData; 14 | int hopCount @packetData; 15 | 16 | // This is an enum and it has the following meaning 17 | // 0 - Transaction 18 | // 1 - Chain Request 19 | // 2 - Send Chain 20 | // 3 - Ack of Transaction 21 | // 4 - Information Dissemination 22 | // 5 - Busy Message 23 | int packetType @packetData; 24 | //int packetType @enum(PacketType); 25 | 26 | //Send Transaction 27 | int transactionValue @packetData; 28 | int myChainSeqNum @packetData; 29 | 30 | //Sending Chain Information 31 | //int databaseSize @packetData; 32 | //int userA[] @packetData; 33 | int userBID[] @packetData; 34 | int userBSeqNum[] @packetData; 35 | int transaction[] @packetData; 36 | 37 | //Dissemination data 38 | int userXID @packetData; 39 | int userXSeqNum @packetData; 40 | int userYID @packetData; 41 | int userYSeqNum @packetData; 42 | 43 | double time @packetData; 44 | } 45 | -------------------------------------------------------------------------------- /Simulation1/node/PacketType.h: -------------------------------------------------------------------------------- 1 | enum PacketType 2 | { 3 | NONE = 0, 4 | UDP = 1, 5 | TCP = 2, 6 | SCTP = 3 7 | }; 8 | -------------------------------------------------------------------------------- /Simulation1/node/Routing.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "Packet_m.h" 4 | 5 | using namespace omnetpp; 6 | 7 | /** 8 | * Demonstrates static routing, utilizing the cTopology class. 9 | */ 10 | class Routing: public cSimpleModule { 11 | private: 12 | int myAddress; 13 | 14 | typedef std::map RoutingTable; // destaddr -> gateindex 15 | RoutingTable rtable; 16 | 17 | simsignal_t dropSignal; 18 | simsignal_t outputIfSignal; 19 | public: 20 | std::vector neighbourNodeAddresses; 21 | 22 | protected: 23 | virtual void initialize() override; 24 | virtual void handleMessage(cMessage *msg) override; 25 | virtual void sendOut(Packet *pk); 26 | }; 27 | -------------------------------------------------------------------------------- /Simulation1/node/Routing.ned: -------------------------------------------------------------------------------- 1 | package node; 2 | 3 | // 4 | // Models a router. 5 | // 6 | simple Routing 7 | { 8 | parameters: 9 | @display("i=block/switch"); 10 | @signal[drop](type="long"); 11 | @signal[outputIf](type="long"); 12 | @statistic[drop](title="dropped packet byte length";unit=bytes;record=vector?,count,sum;interpolationmode=none); 13 | @statistic[outputIf](title="output interface for each routed packet";record=histogram;interpolationmode=none); 14 | gates: 15 | input in[]; 16 | output out[]; 17 | input localIn; 18 | output localOut; 19 | } 20 | 21 | 22 | -------------------------------------------------------------------------------- /Simulation1/omnetpp.ini: -------------------------------------------------------------------------------- 1 | [General] 2 | #eventlog-message-detail-pattern = Packet:declaredOn(Packet) or bitLength 3 | #eventlog-message-detail-pattern = * 4 | #cpu-time-limit = 120s #just as backup for server runs 5 | cmdenv-express-mode = true 6 | cmdenv-performance-display = false 7 | cmdenv-status-frequency = 5000000s 8 | record-eventlog = false 9 | debug-on-errors = false 10 | **.result-recording-modes = - 11 | **.vector-recording = false 12 | **.scalar-recording = false 13 | **.tcp.**.scalar-recording = false 14 | **.endToEndDelay.scalar-recording = false 15 | #cmdenv-stop-batch-on-error = false 16 | 17 | # Simulation 18 | seed-set = ${repetition} 19 | repeat = 50 20 | network = networks.Net5 21 | 22 | # Node 23 | **.totalNodes = 500 24 | **.appType = "App" 25 | **.app.packetLength = 1500 bytes #Packet size https://www.isi.edu/~johnh/PAPERS/Sinha07a.pdf 26 | **.sendIaTime = uniform(5s, 10s) 27 | **.sendIaTimeEvil = 10ms 28 | **.initialMoney = 100 29 | **.evilNodeIds = "" #list of the evil node ids, space is used to separate the ids, -1 mean that there is no evil node, if you leave this empty the evil node is randomly selected 30 | **.evilNumberOfSleepingTransaction = 1 #[1 is MIN] 31 | **.evilNumberOfTransaction = 2 #[2 is MIN] total max number of transaction to perform after the first evil transaction 32 | 33 | 34 | # Channel 35 | Net5.delay = 100ms 36 | #https://wondernetwork.com/pings 37 | #https://enterprise.verizon.com/terms/latency/ 38 | #https://www.dotcom-tools.com/internet-backbone-latency.aspx 39 | Net5.datarate = 7200kbps 40 | #https://www.akamai.com/us/en/about/news/press/2017-press/akamai-releases-first-quarter-2017-state-of-the-internet-connectivity-report.jsp 41 | #https://www.fastmetrics.com/internet-connection-speed-by-country.php#top-10-worldwide -------------------------------------------------------------------------------- /Simulation1/out/clang-debug/.last-copts: -------------------------------------------------------------------------------- 1 | -g -Wall -MMD -MP -MF .d -isystem /usr/include -isystem /mingw64/include -Wno-deprecated-register -Wno-unused-function -fno-stack-protector -DXMLPARSER=libxml -DPREFER_QTENV -DWITH_QTENV -DWITH_PARSIM -DWITH_NETBUILDER -DWITH_OSG -DWITH_OSGEARTH -I. -IC:/Users/umeer/Desktop/University/omnetpp-5.5.1/include 2 | -------------------------------------------------------------------------------- /Simulation1/out/clang-debug/node/App.o.d: -------------------------------------------------------------------------------- 1 | out/clang-debug//node/App.o: node/App.cc node/App.h \ 2 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h \ 3 | node/Packet_m.h node/PacketType.h node/Routing.h 4 | 5 | node/App.h: 6 | 7 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h: 8 | 9 | node/Packet_m.h: 10 | 11 | node/PacketType.h: 12 | 13 | node/Routing.h: 14 | -------------------------------------------------------------------------------- /Simulation1/out/clang-debug/node/L2Queue.o.d: -------------------------------------------------------------------------------- 1 | out/clang-debug//node/L2Queue.o: node/L2Queue.cc \ 2 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h 3 | 4 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h: 5 | -------------------------------------------------------------------------------- /Simulation1/out/clang-debug/node/Packet_m.o.d: -------------------------------------------------------------------------------- 1 | out/clang-debug//node/Packet_m.o: node/Packet_m.cc node/Packet_m.h \ 2 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h \ 3 | node/PacketType.h 4 | 5 | node/Packet_m.h: 6 | 7 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h: 8 | 9 | node/PacketType.h: 10 | -------------------------------------------------------------------------------- /Simulation1/out/clang-debug/node/Routing.o.d: -------------------------------------------------------------------------------- 1 | out/clang-debug//node/Routing.o: node/Routing.cc node/Routing.h \ 2 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h \ 3 | node/Packet_m.h node/PacketType.h 4 | 5 | node/Routing.h: 6 | 7 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h: 8 | 9 | node/Packet_m.h: 10 | 11 | node/PacketType.h: 12 | -------------------------------------------------------------------------------- /Simulation1/out/clang-release/.last-copts: -------------------------------------------------------------------------------- 1 | -O3 -DNDEBUG=1 -MMD -MP -MF .d -isystem /usr/include -isystem /mingw64/include -Wno-deprecated-register -Wno-unused-function -fno-stack-protector -DXMLPARSER=libxml -DPREFER_QTENV -DWITH_QTENV -DWITH_PARSIM -DWITH_NETBUILDER -DWITH_OSG -DWITH_OSGEARTH -I. -IC:/Users/umeer/Desktop/University/omnetpp-5.5.1/include 2 | -------------------------------------------------------------------------------- /Simulation1/out/clang-release/node/App.o.d: -------------------------------------------------------------------------------- 1 | out/clang-release//node/App.o: node/App.cc node/App.h \ 2 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h \ 3 | node/Packet_m.h node/PacketType.h node/Routing.h 4 | 5 | node/App.h: 6 | 7 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h: 8 | 9 | node/Packet_m.h: 10 | 11 | node/PacketType.h: 12 | 13 | node/Routing.h: 14 | -------------------------------------------------------------------------------- /Simulation1/out/clang-release/node/L2Queue.o.d: -------------------------------------------------------------------------------- 1 | out/clang-release//node/L2Queue.o: node/L2Queue.cc \ 2 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h 3 | 4 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h: 5 | -------------------------------------------------------------------------------- /Simulation1/out/clang-release/node/Packet_m.h.d: -------------------------------------------------------------------------------- 1 | node/Packet_m.cc node/Packet_m.h : \ 2 | node/Packet.msg 3 | node/Packet.msg: 4 | -------------------------------------------------------------------------------- /Simulation1/out/clang-release/node/Packet_m.o.d: -------------------------------------------------------------------------------- 1 | out/clang-release//node/Packet_m.o: node/Packet_m.cc node/Packet_m.h \ 2 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h \ 3 | node/PacketType.h 4 | 5 | node/Packet_m.h: 6 | 7 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h: 8 | 9 | node/PacketType.h: 10 | -------------------------------------------------------------------------------- /Simulation1/out/clang-release/node/Routing.o.d: -------------------------------------------------------------------------------- 1 | out/clang-release//node/Routing.o: node/Routing.cc node/Routing.h \ 2 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h \ 3 | node/Packet_m.h node/PacketType.h 4 | 5 | node/Routing.h: 6 | 7 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h: 8 | 9 | node/Packet_m.h: 10 | 11 | node/PacketType.h: 12 | -------------------------------------------------------------------------------- /Simulation1/out/gcc-debug/.last-copts: -------------------------------------------------------------------------------- 1 | -g -Wall -MMD -MP -MF .d -fPIC -fno-stack-protector -DHAVE_SWAPCONTEXT -DWITH_MPI -DXMLPARSER=libxml -DPREFER_QTENV -DWITH_QTENV -DWITH_PARSIM -DWITH_NETBUILDER -DWITH_OSG -DWITH_OSGEARTH -I/home/umeer/omnetpp-5.4.1/include 2 | -------------------------------------------------------------------------------- /Simulation1/out/gcc-debug/builder/netbuilder.d: -------------------------------------------------------------------------------- 1 | out/gcc-debug//builder/netbuilder.o: builder/netbuilder.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | -------------------------------------------------------------------------------- /Simulation1/out/gcc-debug/builder/netbuilder.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/out/gcc-debug/builder/netbuilder.o -------------------------------------------------------------------------------- /Simulation1/out/gcc-debug/node/App.d: -------------------------------------------------------------------------------- 1 | out/gcc-debug//node/App.o: node/App.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h node/Packet_m.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | 6 | node/Packet_m.h: 7 | -------------------------------------------------------------------------------- /Simulation1/out/gcc-debug/node/App.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/out/gcc-debug/node/App.o -------------------------------------------------------------------------------- /Simulation1/out/gcc-debug/node/BurstyApp.d: -------------------------------------------------------------------------------- 1 | out/gcc-debug//node/BurstyApp.o: node/BurstyApp.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h node/Packet_m.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | 6 | node/Packet_m.h: 7 | -------------------------------------------------------------------------------- /Simulation1/out/gcc-debug/node/BurstyApp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/out/gcc-debug/node/BurstyApp.o -------------------------------------------------------------------------------- /Simulation1/out/gcc-debug/node/L2Queue.d: -------------------------------------------------------------------------------- 1 | out/gcc-debug//node/L2Queue.o: node/L2Queue.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | -------------------------------------------------------------------------------- /Simulation1/out/gcc-debug/node/L2Queue.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/out/gcc-debug/node/L2Queue.o -------------------------------------------------------------------------------- /Simulation1/out/gcc-debug/node/Packet_m.d: -------------------------------------------------------------------------------- 1 | out/gcc-debug//node/Packet_m.o: node/Packet_m.cc node/Packet_m.h \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h 3 | 4 | node/Packet_m.h: 5 | 6 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 7 | -------------------------------------------------------------------------------- /Simulation1/out/gcc-debug/node/Packet_m.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/out/gcc-debug/node/Packet_m.o -------------------------------------------------------------------------------- /Simulation1/out/gcc-debug/node/Routing.d: -------------------------------------------------------------------------------- 1 | out/gcc-debug//node/Routing.o: node/Routing.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h node/Packet_m.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | 6 | node/Packet_m.h: 7 | -------------------------------------------------------------------------------- /Simulation1/out/gcc-debug/node/Routing.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/out/gcc-debug/node/Routing.o -------------------------------------------------------------------------------- /Simulation1/out/gcc-debug/routing_dbg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/out/gcc-debug/routing_dbg -------------------------------------------------------------------------------- /Simulation1/out/gcc-release/.last-copts: -------------------------------------------------------------------------------- 1 | -O3 -DNDEBUG=1 -MMD -MP -MF .d -fPIC -fno-stack-protector -DHAVE_SWAPCONTEXT -DWITH_MPI -DXMLPARSER=libxml -DPREFER_QTENV -DWITH_QTENV -DWITH_PARSIM -DWITH_NETBUILDER -DWITH_OSG -DWITH_OSGEARTH -I. -I/home/umeer/omnetpp-5.4.1/include 2 | -------------------------------------------------------------------------------- /Simulation1/out/gcc-release/builder/netbuilder.d: -------------------------------------------------------------------------------- 1 | out/gcc-release//builder/netbuilder.o: builder/netbuilder.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | -------------------------------------------------------------------------------- /Simulation1/out/gcc-release/builder/netbuilder.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/out/gcc-release/builder/netbuilder.o -------------------------------------------------------------------------------- /Simulation1/out/gcc-release/node/App.d: -------------------------------------------------------------------------------- 1 | out/gcc-release//node/App.o: node/App.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h node/Packet_m.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | 6 | node/Packet_m.h: 7 | -------------------------------------------------------------------------------- /Simulation1/out/gcc-release/node/App.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/out/gcc-release/node/App.o -------------------------------------------------------------------------------- /Simulation1/out/gcc-release/node/BurstyApp.d: -------------------------------------------------------------------------------- 1 | out/gcc-release//node/BurstyApp.o: node/BurstyApp.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h node/Packet_m.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | 6 | node/Packet_m.h: 7 | -------------------------------------------------------------------------------- /Simulation1/out/gcc-release/node/BurstyApp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/out/gcc-release/node/BurstyApp.o -------------------------------------------------------------------------------- /Simulation1/out/gcc-release/node/L2Queue.d: -------------------------------------------------------------------------------- 1 | out/gcc-release//node/L2Queue.o: node/L2Queue.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | -------------------------------------------------------------------------------- /Simulation1/out/gcc-release/node/L2Queue.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/out/gcc-release/node/L2Queue.o -------------------------------------------------------------------------------- /Simulation1/out/gcc-release/node/Packet_m.d: -------------------------------------------------------------------------------- 1 | out/gcc-release//node/Packet_m.o: node/Packet_m.cc node/Packet_m.h \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h 3 | 4 | node/Packet_m.h: 5 | 6 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 7 | -------------------------------------------------------------------------------- /Simulation1/out/gcc-release/node/Packet_m.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/out/gcc-release/node/Packet_m.o -------------------------------------------------------------------------------- /Simulation1/out/gcc-release/node/Routing.d: -------------------------------------------------------------------------------- 1 | out/gcc-release//node/Routing.o: node/Routing.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h node/Packet_m.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | 6 | node/Packet_m.h: 7 | -------------------------------------------------------------------------------- /Simulation1/out/gcc-release/node/Routing.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/out/gcc-release/node/Routing.o -------------------------------------------------------------------------------- /Simulation1/out/gcc-release/routing: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/out/gcc-release/routing -------------------------------------------------------------------------------- /Simulation1/out/gcc-release/routing_umeer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/out/gcc-release/routing_umeer -------------------------------------------------------------------------------- /Simulation1/package.ned: -------------------------------------------------------------------------------- 1 | // this sample simulation is part of OMNeT++ 2 | @license(omnetpp); 3 | -------------------------------------------------------------------------------- /Simulation1/parsim/README.txt: -------------------------------------------------------------------------------- 1 | Parallel version of the Routing example 2 | ======================================= 3 | 4 | This example demonstrates the parallel distributed simulation capabilities 5 | of OMNeT++. The model itself is the "stock" Routing simulation -- it hasn't 6 | been modified or specially instrumented for parallel execution. 7 | 8 | For more information on parallel simulation see the README in the cqn/parsim 9 | directory and the OMNeT++ Manual. 10 | -------------------------------------------------------------------------------- /Simulation1/parsim/omnetpp.ini: -------------------------------------------------------------------------------- 1 | [General] 2 | parallel-simulation = true 3 | parsim-communications-class = "cNamedPipeCommunications" 4 | parsim-synchronization-class = "cNullMessageProtocol" 5 | sim-time-limit = 10000s 6 | 7 | 8 | [Config Net60-parsim] 9 | network = networks.Net60 10 | description = "Possible speedup with parallel simulation" 11 | 12 | **.appType = "App" 13 | **.app.packetLength = 1024 bytes 14 | **.destAddresses = "1 23 34 55" 15 | **.sendIaTime = exponential(10ms) # high traffic 16 | 17 | # assume long distances among network nodes -- a 10ms lookahead may result in 18 | # a reasonable speedup even for this small network 19 | **.channel.delay = 10ms 20 | 21 | *.rte[..26]**.partition-id = 0 22 | *.rte[27..]**.partition-id = 1 23 | 24 | 25 | [Config Net10-parsim] 26 | network = networks.Net10 27 | description = "Poor parsim performance -- network is too small" 28 | 29 | **.appType = "App" 30 | **.app.packetLength = 1024 bytes 31 | **.destAddresses = "1 6" 32 | **.sendIaTime = exponential(10ms) # high traffic 33 | 34 | *.rte[0..4]**.partition-id = 0 35 | *.rte[5..9]**.partition-id = 1 36 | 37 | **.channel.delay = 10ms 38 | -------------------------------------------------------------------------------- /Simulation1/parsim/runparsim: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | echo 3 | echo '*** Distributed execution of the Routing example simulation ***' 4 | echo 'IMPORTANT: If you'"'"'re running the simulation under the Tkenv GUI,' 5 | echo 'you'"'"'ll have to click [Run] in all windows to start the simulation.' 6 | echo 'See Readme.txt for more info.' 7 | echo 8 | 9 | rm -rf comm 10 | mkdir comm 11 | mkdir comm/read 12 | 13 | # make sure HOSTNAME is exported as some distros no longer export it by default 14 | if test "$HOSTNAME" = ""; then 15 | export HOSTNAME=`hostname` 16 | fi 17 | 18 | export NEDPATH=.. 19 | ../routing -p0,2 $* > routing-0.log & 20 | ../routing -p1,2 $* > routing-1.log & 21 | 22 | 23 | -------------------------------------------------------------------------------- /Simulation1/parsim/runparsim-cmd.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo. 3 | echo *** Distributed execution of the Routing example simulation *** 4 | echo. 5 | if "%*"=="" pause 6 | 7 | rmdir /S /Q comm 2>nul 8 | mkdir comm 9 | mkdir comm\read 10 | 11 | set NEDPATH=.. 12 | start /b /belownormal ..\routing -p0,2 -u Cmdenv %* 13 | start /b /belownormal ..\routing -p1,2 -u Cmdenv %* 14 | -------------------------------------------------------------------------------- /Simulation1/parsim/runparsim-mpi: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # make sure HOSTNAME is exported as some distros no longer export it by default 4 | if test "$HOSTNAME" = ""; then 5 | export HOSTNAME=`hostname` 6 | fi 7 | 8 | mpiexec -n 3 ../routing -n .. -c Net10-parsim -u Cmdenv --parsim-communications-class=cMPICommunications 9 | -------------------------------------------------------------------------------- /Simulation1/parsim/runparsim.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo. 3 | echo *** Distributed execution of the Routing example simulation *** 4 | echo If you're running the simulation under the Tkenv GUI, you'll have to 5 | echo click [Run] in all windows to start the simulation. 6 | echo See Readme.txt for more info. 7 | echo. 8 | if "%*"=="" pause 9 | 10 | rmdir /S /Q comm 2>nul 11 | mkdir comm 12 | mkdir comm\read 13 | 14 | set NEDPATH=.. 15 | start /b /belownormal ..\routing -p0,2 %* 16 | start /b /belownormal ..\routing -p1,2 %* 17 | -------------------------------------------------------------------------------- /Simulation1/templates/randomtopo/gatename.xswt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 23 | 24 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /Simulation1/templates/randomtopo/nearest3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation1/templates/randomtopo/nearest3.jar -------------------------------------------------------------------------------- /Simulation1/templates/randomtopo/nedtypes.xswt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 35 | 36 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /Simulation1/templates/randomtopo/network.ned.ftl: -------------------------------------------------------------------------------- 1 | <@setoutput path=targetMainFile?default("")/> 2 | ${bannerComment} 3 | 4 | <#if nedPackageName!="">package ${nedPackageName}; 5 | <#if gateName==""><#assign gateName = "g"> 6 | <#assign gateName = StringUtils.makeValidIdentifier(gateName)> 7 | 8 | <#if !NedUtils.isVisibleType(nodeType,targetFolder)> 9 | <#assign nodeType = StringUtils.makeValidIdentifier(nodeType)> 10 | module ${nodeType} { 11 | parameters: 12 | @display("i=abstract/router_vs"); 13 | gates: 14 | inout ${gateName}[]; 15 | } 16 | 17 | 18 | <#if !NedUtils.isVisibleType(channelType,targetFolder)> 19 | <#assign channelType = StringUtils.makeValidIdentifier(channelType)> 20 | channel ${channelType} extends ned.DatarateChannel { 21 | parameters: 22 | int cost = default(0); 23 | } 24 | 25 | 26 | <#assign numNodes = numNodes?number> 27 | <#assign seed = seed?number> 28 | 29 | <#assign topo = LangUtils.newInstance("Nearest3")> 30 | <@do topo.setNodes(numNodes) !/> 31 | <@do topo.setSeed(seed) !/> 32 | 33 | <#assign graph = topo.generate()> 34 | 35 | <#assign nodeX = graph.nodeX> 36 | <#assign nodeY = graph.nodeY> 37 | <#assign numEdges = graph.numEdges> 38 | <#assign edgeSrc = graph.edgeSrc> 39 | <#assign edgeDest = graph.edgeDest> 40 | 41 | // 42 | // Generated network (${numNodes} nodes, seed=${seed}) 43 | // 44 | <#assign networkKeyword = iif(wizardType=="compoundmodule", "module", "network")> 45 | ${networkKeyword} ${targetTypeName} { 46 | submodules: 47 | <#list 0..numNodes-1 as i> 48 | <#if addCoordinates> 49 | node${i} : ${nodeType} { @display("p=${nodeX[i]},${nodeY[i]}"); }; 50 | <#else> 51 | node${i} : ${nodeType}; 52 | 53 | 54 | connections: 55 | <#list 0..numEdges-1 as i> 56 | node${edgeSrc[i]}.${gateName}++ <--> ${channelType} <--> node${edgeDest[i]}.${gateName}++; 57 | 58 | } 59 | -------------------------------------------------------------------------------- /Simulation1/templates/randomtopo/omnetpp.ini.ftl: -------------------------------------------------------------------------------- 1 | <#if wizardType=="project" || wizardType=="simulation"> 2 | [General] 3 | network = ${targetTypeName} 4 | 5 | -------------------------------------------------------------------------------- /Simulation1/templates/randomtopo/package.ned.ftl: -------------------------------------------------------------------------------- 1 | <#if wizardType=="project"><#-- not needed for simulations, because they go into subfolders --> 2 | <#if nedPackageName!="">package ${nedPackageName}; 3 | 4 | -------------------------------------------------------------------------------- /Simulation1/templates/randomtopo/params.xswt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 34 | 35 | -------------------------------------------------------------------------------- /Simulation1/templates/randomtopo/template.properties: -------------------------------------------------------------------------------- 1 | templateName = Network with a Random Topology 2 | templateDescription = Generates a network with random network topology 3 | templateCategory = 4 | supportedWizardTypes = simulation, nedfile, network, compoundmodule 5 | ignoreResources = *.java 6 | 7 | # template variables 8 | numNodes = 30 9 | seed = 100 10 | 11 | targetTypeName = Network 12 | nodeType = node.Node 13 | channelType = Link 14 | gateName = port 15 | addCoordinates = false 16 | 17 | # custom wizard pages 18 | page.1.file = params.xswt 19 | page.1.title = Generate Random Topology 20 | 21 | page.2.file = nedtypes.xswt 22 | page.2.title = NED Details 23 | 24 | page.3.file = gatename.xswt 25 | page.3.title = Gate 26 | -------------------------------------------------------------------------------- /Simulation2/.cmdenv-log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation2/.cmdenv-log -------------------------------------------------------------------------------- /Simulation2/.metadata/.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation2/.metadata/.lock -------------------------------------------------------------------------------- /Simulation2/.metadata/.plugins/org.eclipse.cdt.core/.log: -------------------------------------------------------------------------------- 1 | *** SESSION Jul 31, 2019 12:12:29.07 ------------------------------------------- 2 | -------------------------------------------------------------------------------- /Simulation2/.metadata/.plugins/org.eclipse.cdt.make.core/specs.c: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Simulation2/.metadata/.plugins/org.eclipse.cdt.make.core/specs.cpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Simulation2/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /Simulation2/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /Simulation2/.metadata/.plugins/org.eclipse.core.resources/.root/1.tree: -------------------------------------------------------------------------------- 1 | org.eclipse.cdt.core -------------------------------------------------------------------------------- /Simulation2/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation2/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources -------------------------------------------------------------------------------- /Simulation2/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.cdt.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | spelling_locale=en_GB 3 | spelling_locale_initialized=true 4 | useAnnotationsPrefPage=true 5 | useQuickDiffPrefPage=true 6 | -------------------------------------------------------------------------------- /Simulation2/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | version=1 3 | -------------------------------------------------------------------------------- /Simulation2/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jsch.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jsch.core.hasChangedDefaultWin32SshHome=true 3 | -------------------------------------------------------------------------------- /Simulation2/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs: -------------------------------------------------------------------------------- 1 | PROBLEMS_FILTERS_MIGRATE=true 2 | eclipse.preferences.version=1 3 | platformState=1564567518953 4 | quickStart=false 5 | tipsAndTricks=true 6 | -------------------------------------------------------------------------------- /Simulation2/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | showIntro=false 3 | -------------------------------------------------------------------------------- /Simulation2/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.workbench.prefs: -------------------------------------------------------------------------------- 1 | //org.eclipse.ui.commands/state/org.eclipse.ui.navigator.resources.nested.changeProjectPresentation/org.eclipse.ui.commands.radioState=false 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /Simulation2/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | -------------------------------------------------------------------------------- /Simulation2/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Simulation2/.metadata/.plugins/org.omnetpp.main/dialog_settings.xml: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |
5 | -------------------------------------------------------------------------------- /Simulation2/.metadata/version.ini: -------------------------------------------------------------------------------- 1 | #Wed Jul 31 12:12:26 CEST 2019 2 | org.eclipse.core.runtime=2 3 | org.eclipse.platform=4.11.0.v20190307-0500 4 | -------------------------------------------------------------------------------- /Simulation2/.oppbuildspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Simulation2/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Simulation2 4 | 5 | 6 | 7 | 8 | 9 | org.omnetpp.cdt.MakefileBuilder 10 | 11 | 12 | 13 | 14 | org.omnetpp.scave.builder.vectorfileindexer 15 | 16 | 17 | 18 | 19 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 20 | clean,full,incremental, 21 | 22 | 23 | 24 | 25 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 26 | full,incremental, 27 | 28 | 29 | 30 | 31 | 32 | org.eclipse.cdt.core.cnature 33 | org.eclipse.cdt.core.ccnature 34 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 35 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 36 | org.omnetpp.main.omnetppnature 37 | 38 | 39 | -------------------------------------------------------------------------------- /Simulation2/.qtenvrc: -------------------------------------------------------------------------------- 1 | [General] 2 | last-configname=General 3 | last-runnumber=10 4 | 5 | [RunModeProfiles] 6 | fast-max-animation-speed=nan 7 | fast-max-playback-speed=1e+6 8 | fast-min-animation-speed=nan 9 | fast-min-playback-speed=1 10 | fast-playback-speed=154881.66189124828 11 | run-max-animation-speed=nan 12 | run-max-playback-speed=100 13 | run-min-animation-speed=nan 14 | run-min-playback-speed=0.01 15 | run-playback-speed=100 16 | -------------------------------------------------------------------------------- /Simulation2/.settings/language.settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Simulation2/Net5.anf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Simulation2/NoREADME.txt: -------------------------------------------------------------------------------- 1 | Routing 2 | ======= 3 | 4 | Demonstrates static shortest-path routing. Routing tables are set up at the 5 | beginning of the simulation using the cTopology class. The model is 6 | intentionally kept simple to facilitate understanding. 7 | 8 | The network topology is the one widely known as the "NTT backbone", and it was 9 | contributed by Mudassar Farooq. 10 | 11 | Every node queries the topology of the network independently, using a cTopology 12 | object. Then it computes shortest paths to every other node, and stores the 13 | first nodes of the paths in a next-hop table. (Actually the table contains 14 | the port number to the next-hop node not the node address itself -- the table 15 | thus provides dest-address -> next-hop-address mapping). All the above takes 16 | place once, at the beginning of this simulation. The topology is static during 17 | the simulation, and so there's no need for the nodes to do anything to keep 18 | the tables up-to-date. There's no routing protocol in the model. 19 | 20 | Once the routing tables are set up, nodes start sending packets at random 21 | intervals. Every node gets a list of destination addresses in a parameter, 22 | and for every packet it randomly chooses a destination from the list. 23 | 24 | There are two apps provided: App generates packets with exponential inter-arrival 25 | times, while BurstyApp alternates between active and idle periods. BurstyApp's 26 | implementation demonstrates the use of the FSMs (Finite State Machine). 27 | -------------------------------------------------------------------------------- /Simulation2/frames/NetBuilder#0_0000.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation2/frames/NetBuilder#0_0000.png -------------------------------------------------------------------------------- /Simulation2/frames/NetBuilder#0_0001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation2/frames/NetBuilder#0_0001.png -------------------------------------------------------------------------------- /Simulation2/frames/NetBuilder#0_0002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation2/frames/NetBuilder#0_0002.png -------------------------------------------------------------------------------- /Simulation2/frames/NetBuilder#0_0003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation2/frames/NetBuilder#0_0003.png -------------------------------------------------------------------------------- /Simulation2/frames/NetBuilder#0_0004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation2/frames/NetBuilder#0_0004.png -------------------------------------------------------------------------------- /Simulation2/frames/NetBuilder#0_0005.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation2/frames/NetBuilder#0_0005.png -------------------------------------------------------------------------------- /Simulation2/frames/NetBuilder#0_0006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation2/frames/NetBuilder#0_0006.png -------------------------------------------------------------------------------- /Simulation2/frames/NetBuilder#0_0007.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation2/frames/NetBuilder#0_0007.png -------------------------------------------------------------------------------- /Simulation2/frames/NetBuilder#0_0008.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation2/frames/NetBuilder#0_0008.png -------------------------------------------------------------------------------- /Simulation2/frames/NetBuilder#0_0009.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation2/frames/NetBuilder#0_0009.png -------------------------------------------------------------------------------- /Simulation2/frames/NetBuilder#0_0010.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation2/frames/NetBuilder#0_0010.png -------------------------------------------------------------------------------- /Simulation2/frames/NetBuilder#0_0011.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation2/frames/NetBuilder#0_0011.png -------------------------------------------------------------------------------- /Simulation2/frames/NetBuilder#0_0012.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation2/frames/NetBuilder#0_0012.png -------------------------------------------------------------------------------- /Simulation2/frames/NetBuilder#0_0013.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation2/frames/NetBuilder#0_0013.png -------------------------------------------------------------------------------- /Simulation2/frames/NetBuilder#0_0014.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation2/frames/NetBuilder#0_0014.png -------------------------------------------------------------------------------- /Simulation2/frames/NetBuilder#0_0015.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation2/frames/NetBuilder#0_0015.png -------------------------------------------------------------------------------- /Simulation2/frames/NetBuilder#0_0016.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation2/frames/NetBuilder#0_0016.png -------------------------------------------------------------------------------- /Simulation2/frames/NetBuilder#0_0017.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation2/frames/NetBuilder#0_0017.png -------------------------------------------------------------------------------- /Simulation2/frames/NetBuilder#0_0018.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation2/frames/NetBuilder#0_0018.png -------------------------------------------------------------------------------- /Simulation2/makefrag: -------------------------------------------------------------------------------- 1 | MSGC:=$(MSGC) --msg6 -------------------------------------------------------------------------------- /Simulation2/node/App.ned: -------------------------------------------------------------------------------- 1 | package node; 2 | 3 | // 4 | // Application model to generate traffic for the network. 5 | // 6 | simple App like IApp 7 | { 8 | parameters: 9 | int address; // local node address 10 | int totalNodes; 11 | int initialMoney; 12 | int evilNumberOfSleepingTransaction; 13 | int evilNumberOfTransaction; 14 | int numberOfAnonymizer; 15 | int numberOfAnonymizerThreshold; 16 | int probabilityAnonymizerToBeEvil; 17 | string evilNodeIds; 18 | int transaction_limit; 19 | int randomSeed = intuniform(0, 1000000); 20 | volatile double sendIaTimeInit @unit(s); 21 | volatile double sendIaTime @unit(s) = default(exponential(1s)); // time between generating packets 22 | volatile double transactionTimeoutTime @unit(s); 23 | volatile double anonymusAuditingTimeoutTime @unit(s); 24 | volatile double sendIaTimeEvil @unit(s); 25 | volatile int packetLength @unit(byte); // length of one message (fixed! no "volatile" modifier) 26 | volatile double anonymizerLifeTime @unit(s); 27 | volatile double anonymizerDisseminationTimeInit @unit(s); 28 | volatile double anonymizerDisseminationTime @unit(s); 29 | @display("i=block/browser"); 30 | @signal[endToEndDelay](type="simtime_t"); 31 | @signal[hopCount](type="long"); 32 | @signal[sourceAddress](type="long"); 33 | @statistic[endToEndDelay](title="end-to-end delay of arrived packets"; unit=s; record=vector,mean,max; interpolationmode=none); 34 | @statistic[hopCount](title="hop count of arrived packets"; interpolationmode=none; record=vector?,mean,max); 35 | @statistic[sourceAddress](title="source address of arrived packets"; interpolationmode=none; record=vector?); 36 | gates: 37 | input in; 38 | output out; 39 | output direct; 40 | } 41 | 42 | 43 | -------------------------------------------------------------------------------- /Simulation2/node/IApp.ned: -------------------------------------------------------------------------------- 1 | package node; 2 | 3 | // 4 | // Interface for network traffic generator modules that 5 | // can be used in Node. 6 | // 7 | moduleinterface IApp 8 | { 9 | parameters: 10 | int address; // local node address 11 | gates: 12 | input in; 13 | output out; 14 | } 15 | 16 | 17 | -------------------------------------------------------------------------------- /Simulation2/node/L2Queue.ned: -------------------------------------------------------------------------------- 1 | package node; 2 | 3 | // 4 | // Represents the network interface for a point-to-point connection. 5 | // 6 | // Packets arriving from the upper layer ("in" gate) are sent out on 7 | // the "line" gate, which is expected to be connected to a link with 8 | // nonzero data rate. Packets that arrive while a previous packet is 9 | // being transmitted are queued up. The maximum queue size in packets 10 | // can be specified in a parameter. Excess frames are simply discarded 11 | // and recorded as statistics. 12 | // 13 | // The model can be easily extended in several ways: to make it possible to 14 | // query the queue length from another module via a direct method call 15 | // interface, to implement priority queueing, or to collect link statistics 16 | // (utilization, etc.) 17 | // 18 | simple L2Queue 19 | { 20 | parameters: 21 | int frameCapacity = default(0); // max number of packets; 0 means no limit 22 | bool useCutThroughSwitching = default(false); // use cut-through switching instead of store-and-forward 23 | @display("i=block/queue;q=queue"); 24 | @signal[qlen](type="long"); 25 | @signal[busy](type="bool"); 26 | @signal[queueingTime](type="simtime_t"); 27 | @signal[drop](type="long"); 28 | @signal[txBytes](type="long"); 29 | @signal[rxBytes](type="long"); 30 | @statistic[qlen](title="queue length";record=vector?,timeavg,max;interpolationmode=sample-hold); 31 | @statistic[busy](title="server busy state";record=vector?,timeavg;interpolationmode=sample-hold); 32 | @statistic[queueingTime](title="queueing time at dequeue";unit=s;interpolationmode=none); 33 | @statistic[drop](title="dropped packet byte length";unit=bytes;record=vector?,count,sum;interpolationmode=none); 34 | @statistic[txBytes](title="transmitting packet byte length";unit=bytes;record=vector?,count,sum,histogram;interpolationmode=none); 35 | @statistic[rxBytes](title="received packet byte length";unit=bytes;record=vector?,count,sum,histogram;interpolationmode=none); 36 | gates: 37 | input in; 38 | output out; 39 | inout line; 40 | input direct @directIn; 41 | } 42 | 43 | 44 | -------------------------------------------------------------------------------- /Simulation2/node/Node.ned: -------------------------------------------------------------------------------- 1 | package node; 2 | 3 | // 4 | // A "Node" consists of a Routing plus an App module which represents the 5 | // aggregate traffic of the subnets connected to that router. 6 | // 7 | module Node 8 | { 9 | parameters: 10 | int address; 11 | string appType; 12 | @display("i=misc/node_vs,gold"); 13 | gates: 14 | inout port[]; 15 | submodules: 16 | app: like IApp { 17 | parameters: 18 | address = address; 19 | @display("p=140,60"); 20 | } 21 | routing: Routing { 22 | parameters: 23 | @display("p=140,130"); 24 | gates: 25 | in[sizeof(port)]; 26 | out[sizeof(port)]; 27 | } 28 | queue[sizeof(port)]: L2Queue { 29 | parameters: 30 | @display("p=80,200,row"); 31 | } 32 | connections allowunconnected: 33 | routing.localOut --> app.in; 34 | routing.localIn <-- app.out; 35 | for i=0..sizeof(port)-1 { 36 | routing.out[i] --> queue[i].in; 37 | routing.in[i] <-- queue[i].out; 38 | queue[i].line <--> port[i]; 39 | } 40 | } 41 | 42 | 43 | -------------------------------------------------------------------------------- /Simulation2/node/Packet.msg: -------------------------------------------------------------------------------- 1 | // 2 | // Represents a packet in the network. 3 | // 4 | cplusplus {{ 5 | #include "PacketType.h" 6 | }} 7 | 8 | enum PacketType; 9 | 10 | packet Packet 11 | { 12 | int srcAddr @packetData; 13 | int destAddr @packetData; 14 | int hopCount @packetData; 15 | 16 | // This is an enum and it has the following meaning 17 | // 0 - Transaction 18 | 19 | // 1 - Chain Request (with anonimyzer if the userXID is set with the target ID (different id from destination)) 20 | // 11 - Okay i will help you back 21 | // 2 - Send Chain (with anonimyzer if userXID is set) 22 | 23 | // 3 - Ack of Transaction 24 | 25 | // 4 - Transaction Dissemination 26 | // 5 - Busy Message 27 | 28 | // 6 - Anonymization Dissemination (userXID is set with the name of the anonymiser) 29 | 30 | 31 | 32 | int packetType @packetData; 33 | //int packetType @enum(PacketType); 34 | 35 | //Send Transaction 36 | int transactionValue @packetData; 37 | int myChainSeqNum @packetData; 38 | 39 | //Sending Chain Information 40 | //int databaseSize @packetData; 41 | //int userA[] @packetData; 42 | int userBID[] @packetData; 43 | int userBSeqNum[] @packetData; 44 | int transaction[] @packetData; 45 | 46 | //Dissemination data 47 | int userXID @packetData; 48 | int userXSeqNum @packetData; 49 | int userYID @packetData; 50 | int userYSeqNum @packetData; 51 | 52 | double time @packetData; 53 | } 54 | -------------------------------------------------------------------------------- /Simulation2/node/PacketType.h: -------------------------------------------------------------------------------- 1 | enum PacketType 2 | { 3 | NONE = 0, 4 | UDP = 1, 5 | TCP = 2, 6 | SCTP = 3 7 | }; 8 | -------------------------------------------------------------------------------- /Simulation2/node/Routing.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "Packet_m.h" 4 | 5 | using namespace omnetpp; 6 | 7 | /** 8 | * Demonstrates static routing, utilizing the cTopology class. 9 | */ 10 | class Routing: public cSimpleModule { 11 | private: 12 | int myAddress; 13 | 14 | typedef std::map RoutingTable; // destaddr -> gateindex 15 | RoutingTable rtable; 16 | 17 | simsignal_t dropSignal; 18 | simsignal_t outputIfSignal; 19 | public: 20 | std::vector neighbourNodeAddresses; 21 | 22 | protected: 23 | virtual void initialize() override; 24 | virtual void handleMessage(cMessage *msg) override; 25 | virtual void sendOut(Packet *pk); 26 | }; 27 | -------------------------------------------------------------------------------- /Simulation2/node/Routing.ned: -------------------------------------------------------------------------------- 1 | package node; 2 | 3 | // 4 | // Models a router. 5 | // 6 | simple Routing 7 | { 8 | parameters: 9 | @display("i=block/switch"); 10 | @signal[drop](type="long"); 11 | @signal[outputIf](type="long"); 12 | @statistic[drop](title="dropped packet byte length";unit=bytes;record=vector?,count,sum;interpolationmode=none); 13 | @statistic[outputIf](title="output interface for each routed packet";record=histogram;interpolationmode=none); 14 | gates: 15 | input in[]; 16 | output out[]; 17 | input localIn; 18 | output localOut; 19 | } 20 | 21 | 22 | -------------------------------------------------------------------------------- /Simulation2/out/clang-debug/.last-copts: -------------------------------------------------------------------------------- 1 | -g -Wall -MMD -MP -MF .d -isystem /usr/include -isystem /mingw64/include -Wno-deprecated-register -Wno-unused-function -fno-stack-protector -DXMLPARSER=libxml -DPREFER_QTENV -DWITH_QTENV -DWITH_PARSIM -DWITH_NETBUILDER -DWITH_OSG -DWITH_OSGEARTH -I. -IC:/Users/umeer/Desktop/University/omnetpp-5.5.1/include 2 | -------------------------------------------------------------------------------- /Simulation2/out/clang-debug/node/App.o.d: -------------------------------------------------------------------------------- 1 | out/clang-debug//node/App.o: node/App.cc node/App.h \ 2 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h \ 3 | node/Packet_m.h node/PacketType.h node/Routing.h 4 | 5 | node/App.h: 6 | 7 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h: 8 | 9 | node/Packet_m.h: 10 | 11 | node/PacketType.h: 12 | 13 | node/Routing.h: 14 | -------------------------------------------------------------------------------- /Simulation2/out/clang-debug/node/L2Queue.o.d: -------------------------------------------------------------------------------- 1 | out/clang-debug//node/L2Queue.o: node/L2Queue.cc \ 2 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h 3 | 4 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h: 5 | -------------------------------------------------------------------------------- /Simulation2/out/clang-debug/node/Packet_m.h.d: -------------------------------------------------------------------------------- 1 | node/Packet_m.cc node/Packet_m.h : \ 2 | node/Packet.msg 3 | node/Packet.msg: 4 | -------------------------------------------------------------------------------- /Simulation2/out/clang-debug/node/Packet_m.o.d: -------------------------------------------------------------------------------- 1 | out/clang-debug//node/Packet_m.o: node/Packet_m.cc node/Packet_m.h \ 2 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h \ 3 | node/PacketType.h 4 | 5 | node/Packet_m.h: 6 | 7 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h: 8 | 9 | node/PacketType.h: 10 | -------------------------------------------------------------------------------- /Simulation2/out/clang-debug/node/Routing.o.d: -------------------------------------------------------------------------------- 1 | out/clang-debug//node/Routing.o: node/Routing.cc node/Routing.h \ 2 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h \ 3 | node/Packet_m.h node/PacketType.h 4 | 5 | node/Routing.h: 6 | 7 | C:/Users/umeer/Desktop/University/omnetpp-5.5.1/include\omnetpp.h: 8 | 9 | node/Packet_m.h: 10 | 11 | node/PacketType.h: 12 | -------------------------------------------------------------------------------- /Simulation2/out/clang-release/.last-copts: -------------------------------------------------------------------------------- 1 | -O3 -DNDEBUG=1 -MMD -MP -MF .d -isystem /usr/include -isystem /mingw64/include -Wno-deprecated-register -Wno-unused-function -fno-stack-protector -DXMLPARSER=libxml -DPREFER_QTENV -DWITH_QTENV -DWITH_PARSIM -DWITH_NETBUILDER -DWITH_OSG -DWITH_OSGEARTH -I. -IC:/Users/Yoga/Desktop/Thesis/Omnetpp/include 2 | -------------------------------------------------------------------------------- /Simulation2/out/clang-release/node/App.o.d: -------------------------------------------------------------------------------- 1 | out/clang-release//node/App.o: node/App.cc node/App.h \ 2 | C:/Users/Yoga/Desktop/Thesis/Omnetpp/include\omnetpp.h node/Packet_m.h \ 3 | node/PacketType.h node/Routing.h 4 | 5 | node/App.h: 6 | 7 | C:/Users/Yoga/Desktop/Thesis/Omnetpp/include\omnetpp.h: 8 | 9 | node/Packet_m.h: 10 | 11 | node/PacketType.h: 12 | 13 | node/Routing.h: 14 | -------------------------------------------------------------------------------- /Simulation2/out/clang-release/node/L2Queue.o.d: -------------------------------------------------------------------------------- 1 | out/clang-release//node/L2Queue.o: node/L2Queue.cc \ 2 | C:/Users/Yoga/Desktop/Thesis/Omnetpp/include\omnetpp.h 3 | 4 | C:/Users/Yoga/Desktop/Thesis/Omnetpp/include\omnetpp.h: 5 | -------------------------------------------------------------------------------- /Simulation2/out/clang-release/node/Packet_m.h.d: -------------------------------------------------------------------------------- 1 | node/Packet_m.cc node/Packet_m.h : \ 2 | node/Packet.msg 3 | node/Packet.msg: 4 | -------------------------------------------------------------------------------- /Simulation2/out/clang-release/node/Packet_m.o.d: -------------------------------------------------------------------------------- 1 | out/clang-release//node/Packet_m.o: node/Packet_m.cc node/Packet_m.h \ 2 | C:/Users/Yoga/Desktop/Thesis/Omnetpp/include\omnetpp.h \ 3 | node/PacketType.h 4 | 5 | node/Packet_m.h: 6 | 7 | C:/Users/Yoga/Desktop/Thesis/Omnetpp/include\omnetpp.h: 8 | 9 | node/PacketType.h: 10 | -------------------------------------------------------------------------------- /Simulation2/out/clang-release/node/Routing.o.d: -------------------------------------------------------------------------------- 1 | out/clang-release//node/Routing.o: node/Routing.cc node/Routing.h \ 2 | C:/Users/Yoga/Desktop/Thesis/Omnetpp/include\omnetpp.h node/Packet_m.h \ 3 | node/PacketType.h 4 | 5 | node/Routing.h: 6 | 7 | C:/Users/Yoga/Desktop/Thesis/Omnetpp/include\omnetpp.h: 8 | 9 | node/Packet_m.h: 10 | 11 | node/PacketType.h: 12 | -------------------------------------------------------------------------------- /Simulation2/out/gcc-debug/.last-copts: -------------------------------------------------------------------------------- 1 | -g -Wall -MMD -MP -MF .d -fPIC -fno-stack-protector -DHAVE_SWAPCONTEXT -DWITH_MPI -DXMLPARSER=libxml -DPREFER_QTENV -DWITH_QTENV -DWITH_PARSIM -DWITH_NETBUILDER -DWITH_OSG -DWITH_OSGEARTH -I/home/umeer/omnetpp-5.4.1/include 2 | -------------------------------------------------------------------------------- /Simulation2/out/gcc-debug/builder/netbuilder.d: -------------------------------------------------------------------------------- 1 | out/gcc-debug//builder/netbuilder.o: builder/netbuilder.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | -------------------------------------------------------------------------------- /Simulation2/out/gcc-debug/node/App.d: -------------------------------------------------------------------------------- 1 | out/gcc-debug//node/App.o: node/App.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h node/Packet_m.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | 6 | node/Packet_m.h: 7 | -------------------------------------------------------------------------------- /Simulation2/out/gcc-debug/node/BurstyApp.d: -------------------------------------------------------------------------------- 1 | out/gcc-debug//node/BurstyApp.o: node/BurstyApp.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h node/Packet_m.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | 6 | node/Packet_m.h: 7 | -------------------------------------------------------------------------------- /Simulation2/out/gcc-debug/node/L2Queue.d: -------------------------------------------------------------------------------- 1 | out/gcc-debug//node/L2Queue.o: node/L2Queue.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | -------------------------------------------------------------------------------- /Simulation2/out/gcc-debug/node/Packet_m.d: -------------------------------------------------------------------------------- 1 | out/gcc-debug//node/Packet_m.o: node/Packet_m.cc node/Packet_m.h \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h 3 | 4 | node/Packet_m.h: 5 | 6 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 7 | -------------------------------------------------------------------------------- /Simulation2/out/gcc-debug/node/Routing.d: -------------------------------------------------------------------------------- 1 | out/gcc-debug//node/Routing.o: node/Routing.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h node/Packet_m.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | 6 | node/Packet_m.h: 7 | -------------------------------------------------------------------------------- /Simulation2/out/gcc-debug/routing_dbg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation2/out/gcc-debug/routing_dbg -------------------------------------------------------------------------------- /Simulation2/out/gcc-release/.last-copts: -------------------------------------------------------------------------------- 1 | -O3 -DNDEBUG=1 -MMD -MP -MF .d -fPIC -fno-stack-protector -DHAVE_SWAPCONTEXT -DWITH_MPI -DXMLPARSER=libxml -DPREFER_QTENV -DWITH_QTENV -DWITH_PARSIM -DWITH_NETBUILDER -DWITH_OSG -DWITH_OSGEARTH -I. -I/home/umeer/omnetpp-5.4.1/include 2 | -------------------------------------------------------------------------------- /Simulation2/out/gcc-release/builder/netbuilder.d: -------------------------------------------------------------------------------- 1 | out/gcc-release//builder/netbuilder.o: builder/netbuilder.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | -------------------------------------------------------------------------------- /Simulation2/out/gcc-release/node/App.d: -------------------------------------------------------------------------------- 1 | out/gcc-release//node/App.o: node/App.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h node/Packet_m.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | 6 | node/Packet_m.h: 7 | -------------------------------------------------------------------------------- /Simulation2/out/gcc-release/node/BurstyApp.d: -------------------------------------------------------------------------------- 1 | out/gcc-release//node/BurstyApp.o: node/BurstyApp.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h node/Packet_m.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | 6 | node/Packet_m.h: 7 | -------------------------------------------------------------------------------- /Simulation2/out/gcc-release/node/L2Queue.d: -------------------------------------------------------------------------------- 1 | out/gcc-release//node/L2Queue.o: node/L2Queue.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | -------------------------------------------------------------------------------- /Simulation2/out/gcc-release/node/Packet_m.d: -------------------------------------------------------------------------------- 1 | out/gcc-release//node/Packet_m.o: node/Packet_m.cc node/Packet_m.h \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h 3 | 4 | node/Packet_m.h: 5 | 6 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 7 | -------------------------------------------------------------------------------- /Simulation2/out/gcc-release/node/Routing.d: -------------------------------------------------------------------------------- 1 | out/gcc-release//node/Routing.o: node/Routing.cc \ 2 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h node/Packet_m.h 3 | 4 | /home/umeer/omnetpp-5.4.1/include/omnetpp.h: 5 | 6 | node/Packet_m.h: 7 | -------------------------------------------------------------------------------- /Simulation2/out/gcc-release/routing: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation2/out/gcc-release/routing -------------------------------------------------------------------------------- /Simulation2/out/gcc-release/routing_umeer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation2/out/gcc-release/routing_umeer -------------------------------------------------------------------------------- /Simulation2/package.ned: -------------------------------------------------------------------------------- 1 | // this sample simulation is part of OMNeT++ 2 | @license(omnetpp); 3 | -------------------------------------------------------------------------------- /Simulation2/parsim/README.txt: -------------------------------------------------------------------------------- 1 | Parallel version of the Routing example 2 | ======================================= 3 | 4 | This example demonstrates the parallel distributed simulation capabilities 5 | of OMNeT++. The model itself is the "stock" Routing simulation -- it hasn't 6 | been modified or specially instrumented for parallel execution. 7 | 8 | For more information on parallel simulation see the README in the cqn/parsim 9 | directory and the OMNeT++ Manual. 10 | -------------------------------------------------------------------------------- /Simulation2/parsim/omnetpp.ini: -------------------------------------------------------------------------------- 1 | [General] 2 | parallel-simulation = true 3 | parsim-communications-class = "cNamedPipeCommunications" 4 | parsim-synchronization-class = "cNullMessageProtocol" 5 | sim-time-limit = 10000s 6 | 7 | 8 | [Config Net60-parsim] 9 | network = networks.Net60 10 | description = "Possible speedup with parallel simulation" 11 | 12 | **.appType = "App" 13 | **.app.packetLength = 1024 bytes 14 | **.destAddresses = "1 23 34 55" 15 | **.sendIaTime = exponential(10ms) # high traffic 16 | 17 | # assume long distances among network nodes -- a 10ms lookahead may result in 18 | # a reasonable speedup even for this small network 19 | **.channel.delay = 10ms 20 | 21 | *.rte[..26]**.partition-id = 0 22 | *.rte[27..]**.partition-id = 1 23 | 24 | 25 | [Config Net10-parsim] 26 | network = networks.Net10 27 | description = "Poor parsim performance -- network is too small" 28 | 29 | **.appType = "App" 30 | **.app.packetLength = 1024 bytes 31 | **.destAddresses = "1 6" 32 | **.sendIaTime = exponential(10ms) # high traffic 33 | 34 | *.rte[0..4]**.partition-id = 0 35 | *.rte[5..9]**.partition-id = 1 36 | 37 | **.channel.delay = 10ms 38 | -------------------------------------------------------------------------------- /Simulation2/parsim/runparsim: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | echo 3 | echo '*** Distributed execution of the Routing example simulation ***' 4 | echo 'IMPORTANT: If you'"'"'re running the simulation under the Tkenv GUI,' 5 | echo 'you'"'"'ll have to click [Run] in all windows to start the simulation.' 6 | echo 'See Readme.txt for more info.' 7 | echo 8 | 9 | rm -rf comm 10 | mkdir comm 11 | mkdir comm/read 12 | 13 | # make sure HOSTNAME is exported as some distros no longer export it by default 14 | if test "$HOSTNAME" = ""; then 15 | export HOSTNAME=`hostname` 16 | fi 17 | 18 | export NEDPATH=.. 19 | ../routing -p0,2 $* > routing-0.log & 20 | ../routing -p1,2 $* > routing-1.log & 21 | 22 | 23 | -------------------------------------------------------------------------------- /Simulation2/parsim/runparsim-cmd.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo. 3 | echo *** Distributed execution of the Routing example simulation *** 4 | echo. 5 | if "%*"=="" pause 6 | 7 | rmdir /S /Q comm 2>nul 8 | mkdir comm 9 | mkdir comm\read 10 | 11 | set NEDPATH=.. 12 | start /b /belownormal ..\routing -p0,2 -u Cmdenv %* 13 | start /b /belownormal ..\routing -p1,2 -u Cmdenv %* 14 | -------------------------------------------------------------------------------- /Simulation2/parsim/runparsim-mpi: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # make sure HOSTNAME is exported as some distros no longer export it by default 4 | if test "$HOSTNAME" = ""; then 5 | export HOSTNAME=`hostname` 6 | fi 7 | 8 | mpiexec -n 3 ../routing -n .. -c Net10-parsim -u Cmdenv --parsim-communications-class=cMPICommunications 9 | -------------------------------------------------------------------------------- /Simulation2/parsim/runparsim.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo. 3 | echo *** Distributed execution of the Routing example simulation *** 4 | echo If you're running the simulation under the Tkenv GUI, you'll have to 5 | echo click [Run] in all windows to start the simulation. 6 | echo See Readme.txt for more info. 7 | echo. 8 | if "%*"=="" pause 9 | 10 | rmdir /S /Q comm 2>nul 11 | mkdir comm 12 | mkdir comm\read 13 | 14 | set NEDPATH=.. 15 | start /b /belownormal ..\routing -p0,2 %* 16 | start /b /belownormal ..\routing -p1,2 %* 17 | -------------------------------------------------------------------------------- /Simulation2/templates/randomtopo/gatename.xswt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 23 | 24 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /Simulation2/templates/randomtopo/nearest3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Simulation2/templates/randomtopo/nearest3.jar -------------------------------------------------------------------------------- /Simulation2/templates/randomtopo/nedtypes.xswt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 35 | 36 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /Simulation2/templates/randomtopo/network.ned.ftl: -------------------------------------------------------------------------------- 1 | <@setoutput path=targetMainFile?default("")/> 2 | ${bannerComment} 3 | 4 | <#if nedPackageName!="">package ${nedPackageName}; 5 | <#if gateName==""><#assign gateName = "g"> 6 | <#assign gateName = StringUtils.makeValidIdentifier(gateName)> 7 | 8 | <#if !NedUtils.isVisibleType(nodeType,targetFolder)> 9 | <#assign nodeType = StringUtils.makeValidIdentifier(nodeType)> 10 | module ${nodeType} { 11 | parameters: 12 | @display("i=abstract/router_vs"); 13 | gates: 14 | inout ${gateName}[]; 15 | } 16 | 17 | 18 | <#if !NedUtils.isVisibleType(channelType,targetFolder)> 19 | <#assign channelType = StringUtils.makeValidIdentifier(channelType)> 20 | channel ${channelType} extends ned.DatarateChannel { 21 | parameters: 22 | int cost = default(0); 23 | } 24 | 25 | 26 | <#assign numNodes = numNodes?number> 27 | <#assign seed = seed?number> 28 | 29 | <#assign topo = LangUtils.newInstance("Nearest3")> 30 | <@do topo.setNodes(numNodes) !/> 31 | <@do topo.setSeed(seed) !/> 32 | 33 | <#assign graph = topo.generate()> 34 | 35 | <#assign nodeX = graph.nodeX> 36 | <#assign nodeY = graph.nodeY> 37 | <#assign numEdges = graph.numEdges> 38 | <#assign edgeSrc = graph.edgeSrc> 39 | <#assign edgeDest = graph.edgeDest> 40 | 41 | // 42 | // Generated network (${numNodes} nodes, seed=${seed}) 43 | // 44 | <#assign networkKeyword = iif(wizardType=="compoundmodule", "module", "network")> 45 | ${networkKeyword} ${targetTypeName} { 46 | submodules: 47 | <#list 0..numNodes-1 as i> 48 | <#if addCoordinates> 49 | node${i} : ${nodeType} { @display("p=${nodeX[i]},${nodeY[i]}"); }; 50 | <#else> 51 | node${i} : ${nodeType}; 52 | 53 | 54 | connections: 55 | <#list 0..numEdges-1 as i> 56 | node${edgeSrc[i]}.${gateName}++ <--> ${channelType} <--> node${edgeDest[i]}.${gateName}++; 57 | 58 | } 59 | -------------------------------------------------------------------------------- /Simulation2/templates/randomtopo/omnetpp.ini.ftl: -------------------------------------------------------------------------------- 1 | <#if wizardType=="project" || wizardType=="simulation"> 2 | [General] 3 | network = ${targetTypeName} 4 | 5 | -------------------------------------------------------------------------------- /Simulation2/templates/randomtopo/package.ned.ftl: -------------------------------------------------------------------------------- 1 | <#if wizardType=="project"><#-- not needed for simulations, because they go into subfolders --> 2 | <#if nedPackageName!="">package ${nedPackageName}; 3 | 4 | -------------------------------------------------------------------------------- /Simulation2/templates/randomtopo/params.xswt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 34 | 35 | -------------------------------------------------------------------------------- /Simulation2/templates/randomtopo/template.properties: -------------------------------------------------------------------------------- 1 | templateName = Network with a Random Topology 2 | templateDescription = Generates a network with random network topology 3 | templateCategory = 4 | supportedWizardTypes = simulation, nedfile, network, compoundmodule 5 | ignoreResources = *.java 6 | 7 | # template variables 8 | numNodes = 30 9 | seed = 100 10 | 11 | targetTypeName = Network 12 | nodeType = node.Node 13 | channelType = Link 14 | gateName = port 15 | addCoordinates = false 16 | 17 | # custom wizard pages 18 | page.1.file = params.xswt 19 | page.1.title = Generate Random Topology 20 | 21 | page.2.file = nedtypes.xswt 22 | page.2.title = NED Details 23 | 24 | page.3.file = gatename.xswt 25 | page.3.title = Gate 26 | -------------------------------------------------------------------------------- /Simulation2/test/BasicMessage.test: -------------------------------------------------------------------------------- 1 | %description: 2 | Check primitive scalar field types in messages 3 | 4 | %file: test.msg 5 | 6 | namespace @TESTNAME@; 7 | 8 | message MyMessage 9 | { 10 | bool b; 11 | char c; 12 | short s; 13 | unsigned short us; 14 | int i; 15 | unsigned int ui; 16 | long l; 17 | unsigned long ul; 18 | double d; 19 | }; 20 | 21 | %includes: 22 | #include "test_m.h" 23 | 24 | %activity: 25 | 26 | #define PRINT(X) EV << #X << ":" << X << endl 27 | 28 | MyMessage x("msg"); 29 | 30 | // test it's really subclassed from cMessage 31 | (void)(cMessage *)&x; 32 | EV << (dynamic_cast(&x)!=0 ? "cMessage" : "generic") << endl; 33 | EV << x.getClassName() << ":" << x.getName() << endl; 34 | 35 | // fields must initialize to zero 36 | PRINT(x.getB()); 37 | PRINT((int)x.getC()); 38 | PRINT(x.getS()); 39 | PRINT(x.getUs()); 40 | PRINT(x.getI()); 41 | PRINT(x.getUi()); 42 | PRINT(x.getL()); 43 | PRINT(x.getUl()); 44 | PRINT(x.getD()); 45 | EV << "--\n"; 46 | 47 | // scalar fields 48 | x.setB(true); PRINT(x.getB()); 49 | x.setB(false); PRINT(x.getB()); 50 | 51 | x.setC('a'); PRINT(x.getC()); 52 | 53 | x.setS(10); PRINT(x.getS()); 54 | x.setS(-10); PRINT(x.getS()); 55 | x.setUs(10); PRINT(x.getUs()); 56 | x.setUs(-10); PRINT((x.getUs()>0)); 57 | 58 | x.setI(10); PRINT(x.getI()); 59 | x.setI(-10); PRINT(x.getI()); 60 | x.setUi(10); PRINT(x.getUi()); 61 | x.setUi(-10); PRINT((x.getUi()>0)); 62 | 63 | x.setL(10); PRINT(x.getL()); 64 | x.setL(-10); PRINT(x.getL()); 65 | x.setUl(10); PRINT(x.getUl()); 66 | x.setUl(-10); PRINT((x.getUl()>0)); 67 | 68 | x.setD(3.1415); PRINT(x.getD()); 69 | 70 | %contains: stdout 71 | cMessage 72 | msg_message_1::MyMessage:msg 73 | x.getB():0 74 | (int)x.getC():0 75 | x.getS():0 76 | x.getUs():0 77 | x.getI():0 78 | x.getUi():0 79 | x.getL():0 80 | x.getUl():0 81 | x.getD():0 82 | -- 83 | x.getB():1 84 | x.getB():0 85 | x.getC():a 86 | x.getS():10 87 | x.getS():-10 88 | x.getUs():10 89 | (x.getUs()>0):1 90 | x.getI():10 91 | x.getI():-10 92 | x.getUi():10 93 | (x.getUi()>0):1 94 | x.getL():10 95 | x.getL():-10 96 | x.getUl():10 97 | (x.getUl()>0):1 98 | x.getD():3.1415 99 | -------------------------------------------------------------------------------- /Simulation2/test/TokenizerEvilNodesList.test: -------------------------------------------------------------------------------- 1 | %description: 2 | Testing RandomDistinctPicker class 3 | 4 | %file: omnetpp.ini 5 | [General] 6 | **.evilNodeIds = "1 2" 7 | set cmdenv-interactive=true 8 | 9 | 10 | %file: test.ned 11 | 12 | simple Sender 13 | { 14 | gates: 15 | input in; 16 | output out; 17 | } 18 | 19 | simple Receiver 20 | { 21 | parameters: 22 | string evilNodeIds = "1 2 3"; 23 | gates: 24 | input in; 25 | output out; 26 | } 27 | 28 | network Test 29 | { 30 | submodules: 31 | theSender : Sender; 32 | theReceiver : Receiver; 33 | connections: 34 | theSender.out --> theReceiver.in; 35 | theSender.in <-- theReceiver.out; 36 | } 37 | 38 | 39 | 40 | %file: test.cc 41 | 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | 49 | using namespace omnetpp; 50 | 51 | namespace @TESTNAME@ { 52 | 53 | class Sender : public cSimpleModule 54 | { 55 | public: 56 | Sender() : cSimpleModule(32768) { } 57 | virtual void activity() override; 58 | }; 59 | 60 | Define_Module(Sender); 61 | 62 | void Sender::activity() 63 | { 64 | cMessage *msg = new cMessage(); 65 | sendDelayed(msg, 0.3456, "out"); 66 | } 67 | 68 | class Receiver : public cSimpleModule 69 | { 70 | public: 71 | Receiver() : cSimpleModule(32768) { } 72 | virtual void activity() override; 73 | }; 74 | 75 | Define_Module(Receiver); 76 | 77 | void Receiver::activity() 78 | { 79 | cMessage *msg = receive(); 80 | 81 | std::vector evilNodeIds; 82 | const char *evilNodeIdsPar = par("evilNodeIds"); 83 | cStringTokenizer tokenizer(evilNodeIdsPar); 84 | const char *token; 85 | while ((token = tokenizer.nextToken()) != nullptr) 86 | evilNodeIds.push_back(atoi(token)); 87 | if (evilNodeIds.size() == 3) { 88 | EV << "result: "<<1<< endl; 89 | }else{ 90 | EV << "result: "<<0<< endl; 91 | } 92 | } 93 | 94 | }; //namespace 95 | 96 | %contains: stdout 97 | result: 1 98 | 99 | -------------------------------------------------------------------------------- /Tools/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | -------------------------------------------------------------------------------- /Tools/Automation Scripts/clusterJob.job: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #SBATCH --time=00:60:00 3 | #SBATCH -N 1 4 | #SBATCH --ntasks-per-node=8 5 | 6 | . /etc/bashrc 7 | . /etc/profile.d/modules.sh 8 | module load openmpi/gcc/64 9 | 10 | cd omnetpp-5.5.1/samples/Simulation1 11 | 12 | ./Simulation1 -r '0.. 99' -m -u Cmdenv omnetpp.ini > ../../../result/$1 13 | 14 | 15 | #opp_runall -j24 -V ./Simulation1 -u Cmdenv -c General -r '0..3' omnetpp.ini > ../../../result/$1Log 16 | #cd results 17 | #cat General-#* > ../../../../result/$1 18 | -------------------------------------------------------------------------------- /Tools/Automation Scripts/script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #to remove DOS line endind: sed -i -e 's/\r$//' fileName.sh 3 | clear 4 | 5 | cd omnetpp-5.5.1/samples/Simulation1/out 6 | rm -r clang-release 7 | rm -r gcc-debug 8 | rm -r gcc-release 9 | 10 | cd ../results 11 | rm General-* 12 | rm Net* 13 | 14 | cd .. 15 | make clean 16 | make MODE=release -j 8 17 | chmod 755 Simulation1 18 | 19 | cd ../../../ 20 | sbatch -J $1 clusterJob.job $1 21 | squeue 22 | -------------------------------------------------------------------------------- /Tools/Automation Scripts/scriptOut.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | clear 3 | 4 | rm -I slurm* 5 | 6 | cd ./result 7 | 8 | if [ ! -f SimulationsResultExtractor.class ]; 9 | then 10 | echo "Simulation result extractor compiledX" 11 | javac SimulationsResultExtractor.java 12 | fi 13 | 14 | 15 | if [ -f $1 ] 16 | then 17 | rm output.txt 18 | rm outputVerbose.txt 19 | java SimulationsResultExtractor $1 > outputVerbose.txt 20 | ./statCalculator.r >> output.txt 21 | 22 | #rm $1 23 | 24 | #if [ -f $1Log ] 25 | #then 26 | #rm $1Log 27 | #fi 28 | 29 | echo "Data from $1 converted to output.txt and outputVerbose.txt:" 30 | cat output.txt 31 | else 32 | echo "The $1 file not exists." 33 | fi 34 | -------------------------------------------------------------------------------- /Tools/Automation Scripts/statCalculator.r: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env Rscript 2 | 3 | cat("\n") 4 | 5 | invisible(x <- read.table("output.txt", header = FALSE)) 6 | invisible(unlist(x)) 7 | 8 | # Average 9 | result.mean <- mean(x$V1) 10 | cat(result.mean) 11 | cat("\n") 12 | 13 | # Standard Dev 14 | s<- sd(x$V1) 15 | cat(s) 16 | cat("\n") 17 | 18 | # Normal 19 | error <- qnorm(0.975)*s/sqrt(100) 20 | cat(error) 21 | cat("\n") 22 | 23 | # T-Student 24 | #error2 <- qt(0.975,df=100-1)*s/sqrt(100) 25 | #cat(error2) 26 | #cat("\n") 27 | -------------------------------------------------------------------------------- /Tools/NetworkGeneratorConverter/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Tools/NetworkGeneratorConverter/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | NetworkGeneratorConverter 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /Tools/NetworkGeneratorConverter/build/built-jar.properties: -------------------------------------------------------------------------------- 1 | #Tue, 02 Jul 2019 20:21:35 +0200 2 | 3 | 4 | C\:\\Users\\Yoga\\Desktop\\University\\Thesis\\TrustChain-Simulator\\NetworkGeneratorConverter= 5 | -------------------------------------------------------------------------------- /Tools/NetworkGeneratorConverter/build/classes/.gitignore: -------------------------------------------------------------------------------- 1 | /networkgeneratorconverter/ 2 | /testing/ 3 | -------------------------------------------------------------------------------- /Tools/NetworkGeneratorConverter/dist/NetworkGeneratorConverter.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Tools/NetworkGeneratorConverter/dist/NetworkGeneratorConverter.jar -------------------------------------------------------------------------------- /Tools/NetworkGeneratorConverter/dist/README.TXT: -------------------------------------------------------------------------------- 1 | ======================== 2 | BUILD OUTPUT DESCRIPTION 3 | ======================== 4 | 5 | When you build an Java application project that has a main class, the IDE 6 | automatically copies all of the JAR 7 | files on the projects classpath to your projects dist/lib folder. The IDE 8 | also adds each of the JAR files to the Class-Path element in the application 9 | JAR files manifest file (MANIFEST.MF). 10 | 11 | To run the project from the command line, go to the dist folder and 12 | type the following: 13 | 14 | java -jar "NetworkGeneratorConverter.jar" 15 | 16 | To distribute this project, zip up the dist folder (including the lib folder) 17 | and distribute the ZIP file. 18 | 19 | Notes: 20 | 21 | * If two JAR files on the project classpath have the same name, only the first 22 | JAR file is copied to the lib folder. 23 | * Only JAR files are copied to the lib folder. 24 | If the classpath contains other types of files or folders, these files (folders) 25 | are not copied. 26 | * If a library on the projects classpath also has a Class-Path element 27 | specified in the manifest,the content of the Class-Path element has to be on 28 | the projects runtime path. 29 | * To set a main class in a standard Java project, right-click the project node 30 | in the Projects window and choose Properties. Then click Run and enter the 31 | class name in the Main Class field. Alternatively, you can manually type the 32 | class name in the manifest Main-Class element. 33 | -------------------------------------------------------------------------------- /Tools/NetworkGeneratorConverter/dist/input.txt: -------------------------------------------------------------------------------- 1 | 1 2 2 | 1 3 3 | 1 62 4 | 1 99 5 | 1 100 6 | 2 3 7 | 2 4 8 | 2 100 9 | 3 5 10 | 3 43 11 | 4 5 12 | 4 6 13 | 5 6 14 | 5 7 15 | 6 7 16 | 6 85 17 | 7 8 18 | 7 9 19 | 7 93 20 | 8 9 21 | 8 10 22 | 9 10 23 | 9 11 24 | 10 11 25 | 10 12 26 | 11 12 27 | 11 13 28 | 11 60 29 | 12 13 30 | 12 14 31 | 13 15 32 | 13 70 33 | 14 15 34 | 14 16 35 | 15 16 36 | 15 17 37 | 15 50 38 | 16 17 39 | 16 18 40 | 17 18 41 | 17 19 42 | 18 19 43 | 18 20 44 | 19 20 45 | 19 21 46 | 19 56 47 | 20 21 48 | 20 22 49 | 21 22 50 | 21 23 51 | 22 23 52 | 22 24 53 | 23 25 54 | 23 86 55 | 24 25 56 | 24 54 57 | 25 26 58 | 25 27 59 | 26 27 60 | 26 28 61 | 27 28 62 | 27 29 63 | 28 29 64 | 28 30 65 | 29 30 66 | 29 31 67 | 30 31 68 | 30 32 69 | 31 32 70 | 31 33 71 | 32 33 72 | 32 34 73 | 33 34 74 | 33 35 75 | 33 77 76 | 34 35 77 | 34 36 78 | 35 36 79 | 35 37 80 | 35 44 81 | 36 37 82 | 36 38 83 | 37 38 84 | 37 39 85 | 38 39 86 | 38 40 87 | 39 40 88 | 39 41 89 | 40 41 90 | 40 42 91 | 41 42 92 | 41 43 93 | 42 43 94 | 42 44 95 | 43 44 96 | 43 45 97 | 44 46 98 | 45 46 99 | 45 47 100 | 46 47 101 | 46 48 102 | 47 48 103 | 47 49 104 | 48 49 105 | 48 50 106 | 49 50 107 | 49 51 108 | 50 52 109 | 51 52 110 | 51 53 111 | 52 53 112 | 52 54 113 | 53 54 114 | 53 55 115 | 54 55 116 | 54 56 117 | 55 56 118 | 55 57 119 | 56 58 120 | 57 58 121 | 57 59 122 | 58 59 123 | 58 60 124 | 59 60 125 | 59 61 126 | 60 62 127 | 61 62 128 | 61 63 129 | 62 63 130 | 63 64 131 | 63 65 132 | 64 65 133 | 64 66 134 | 65 66 135 | 65 67 136 | 66 67 137 | 66 68 138 | 67 68 139 | 67 69 140 | 67 92 141 | 68 69 142 | 68 70 143 | 69 70 144 | 69 71 145 | 70 71 146 | 70 72 147 | 71 72 148 | 71 73 149 | 72 73 150 | 72 74 151 | 73 74 152 | 73 75 153 | 74 75 154 | 74 76 155 | 75 76 156 | 75 77 157 | 76 77 158 | 76 78 159 | 77 79 160 | 78 79 161 | 78 80 162 | 79 80 163 | 79 81 164 | 80 81 165 | 80 82 166 | 81 82 167 | 81 91 168 | 82 83 169 | 82 84 170 | 83 84 171 | 83 85 172 | 84 85 173 | 84 86 174 | 85 86 175 | 85 87 176 | 86 87 177 | 86 88 178 | 87 88 179 | 87 89 180 | 88 89 181 | 88 90 182 | 89 90 183 | 89 91 184 | 90 91 185 | 90 92 186 | 91 92 187 | 91 93 188 | 92 94 189 | 93 94 190 | 94 95 191 | 94 96 192 | 95 96 193 | 95 97 194 | 96 97 195 | 96 98 196 | 97 98 197 | 97 99 198 | 98 99 199 | 98 100 200 | 99 100 -------------------------------------------------------------------------------- /Tools/NetworkGeneratorConverter/input.txt: -------------------------------------------------------------------------------- 1 | 1 2 2 | 1 3 3 | 1 62 4 | 1 99 5 | 1 100 6 | 2 3 7 | 2 4 8 | 2 100 9 | 3 5 10 | 3 43 11 | 4 5 12 | 4 6 13 | 5 6 14 | 5 7 15 | 6 7 16 | 6 85 17 | 7 8 18 | 7 9 19 | 7 93 20 | 8 9 21 | 8 10 22 | 9 10 23 | 9 11 24 | 10 11 25 | 10 12 26 | 11 12 27 | 11 13 28 | 11 60 29 | 12 13 30 | 12 14 31 | 13 15 32 | 13 70 33 | 14 15 34 | 14 16 35 | 15 16 36 | 15 17 37 | 15 50 38 | 16 17 39 | 16 18 40 | 17 18 41 | 17 19 42 | 18 19 43 | 18 20 44 | 19 20 45 | 19 21 46 | 19 56 47 | 20 21 48 | 20 22 49 | 21 22 50 | 21 23 51 | 22 23 52 | 22 24 53 | 23 25 54 | 23 86 55 | 24 25 56 | 24 54 57 | 25 26 58 | 25 27 59 | 26 27 60 | 26 28 61 | 27 28 62 | 27 29 63 | 28 29 64 | 28 30 65 | 29 30 66 | 29 31 67 | 30 31 68 | 30 32 69 | 31 32 70 | 31 33 71 | 32 33 72 | 32 34 73 | 33 34 74 | 33 35 75 | 33 77 76 | 34 35 77 | 34 36 78 | 35 36 79 | 35 37 80 | 35 44 81 | 36 37 82 | 36 38 83 | 37 38 84 | 37 39 85 | 38 39 86 | 38 40 87 | 39 40 88 | 39 41 89 | 40 41 90 | 40 42 91 | 41 42 92 | 41 43 93 | 42 43 94 | 42 44 95 | 43 44 96 | 43 45 97 | 44 46 98 | 45 46 99 | 45 47 100 | 46 47 101 | 46 48 102 | 47 48 103 | 47 49 104 | 48 49 105 | 48 50 106 | 49 50 107 | 49 51 108 | 50 52 109 | 51 52 110 | 51 53 111 | 52 53 112 | 52 54 113 | 53 54 114 | 53 55 115 | 54 55 116 | 54 56 117 | 55 56 118 | 55 57 119 | 56 58 120 | 57 58 121 | 57 59 122 | 58 59 123 | 58 60 124 | 59 60 125 | 59 61 126 | 60 62 127 | 61 62 128 | 61 63 129 | 62 63 130 | 63 64 131 | 63 65 132 | 64 65 133 | 64 66 134 | 65 66 135 | 65 67 136 | 66 67 137 | 66 68 138 | 67 68 139 | 67 69 140 | 67 92 141 | 68 69 142 | 68 70 143 | 69 70 144 | 69 71 145 | 70 71 146 | 70 72 147 | 71 72 148 | 71 73 149 | 72 73 150 | 72 74 151 | 73 74 152 | 73 75 153 | 74 75 154 | 74 76 155 | 75 76 156 | 75 77 157 | 76 77 158 | 76 78 159 | 77 79 160 | 78 79 161 | 78 80 162 | 79 80 163 | 79 81 164 | 80 81 165 | 80 82 166 | 81 82 167 | 81 91 168 | 82 83 169 | 82 84 170 | 83 84 171 | 83 85 172 | 84 85 173 | 84 86 174 | 85 86 175 | 85 87 176 | 86 87 177 | 86 88 178 | 87 88 179 | 87 89 180 | 88 89 181 | 88 90 182 | 89 90 183 | 89 91 184 | 90 91 185 | 90 92 186 | 91 92 187 | 91 93 188 | 92 94 189 | 93 94 190 | 94 95 191 | 94 96 192 | 95 96 193 | 95 97 194 | 96 97 195 | 96 98 196 | 97 98 197 | 97 99 198 | 98 99 199 | 98 100 200 | 99 100 -------------------------------------------------------------------------------- /Tools/NetworkGeneratorConverter/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /Tools/NetworkGeneratorConverter/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=d753e29e 2 | build.xml.script.CRC32=6299f9c4 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=d753e29e 7 | nbproject/build-impl.xml.script.CRC32=e5af7131 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /Tools/NetworkGeneratorConverter/nbproject/private/private.properties: -------------------------------------------------------------------------------- 1 | user.properties.file=C:\\Users\\umeer\\AppData\\Roaming\\NetBeans\\8.2\\build.properties 2 | -------------------------------------------------------------------------------- /Tools/NetworkGeneratorConverter/nbproject/private/private.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Tools/NetworkGeneratorConverter/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processors.list= 4 | annotation.processing.run.all.processors=true 5 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 6 | application.title=NetworkGeneratorConverter 7 | application.vendor=Yoga 8 | build.classes.dir=${build.dir}/classes 9 | build.classes.excludes=**/*.java,**/*.form 10 | # This directory is removed when the project is cleaned: 11 | build.dir=build 12 | build.generated.dir=${build.dir}/generated 13 | build.generated.sources.dir=${build.dir}/generated-sources 14 | # Only compile against the classpath explicitly listed here: 15 | build.sysclasspath=ignore 16 | build.test.classes.dir=${build.dir}/test/classes 17 | build.test.results.dir=${build.dir}/test/results 18 | # Uncomment to specify the preferred debugger connection transport: 19 | #debug.transport=dt_socket 20 | debug.classpath=\ 21 | ${run.classpath} 22 | debug.test.classpath=\ 23 | ${run.test.classpath} 24 | # Files in build.classes.dir which should be excluded from distribution jar 25 | dist.archive.excludes= 26 | # This directory is removed when the project is cleaned: 27 | dist.dir=dist 28 | dist.jar=${dist.dir}/NetworkGeneratorConverter.jar 29 | dist.javadoc.dir=${dist.dir}/javadoc 30 | endorsed.classpath= 31 | excludes= 32 | includes=** 33 | jar.compress=true 34 | javac.classpath= 35 | # Space-separated list of extra javac options 36 | javac.compilerargs= 37 | javac.deprecation=false 38 | javac.external.vm=true 39 | javac.processorpath=\ 40 | ${javac.classpath} 41 | javac.source=1.8 42 | javac.target=1.8 43 | javac.test.classpath=\ 44 | ${javac.classpath}:\ 45 | ${build.classes.dir} 46 | javac.test.processorpath=\ 47 | ${javac.test.classpath} 48 | javadoc.additionalparam= 49 | javadoc.author=false 50 | javadoc.encoding=${source.encoding} 51 | javadoc.noindex=false 52 | javadoc.nonavbar=false 53 | javadoc.notree=false 54 | javadoc.private=false 55 | javadoc.splitindex=true 56 | javadoc.use=true 57 | javadoc.version=false 58 | javadoc.windowtitle= 59 | main.class=networkgeneratorconverter.NetworkGeneratorConverter 60 | manifest.file=manifest.mf 61 | meta.inf.dir=${src.dir}/META-INF 62 | mkdist.disabled=false 63 | platform.active=default_platform 64 | run.classpath=\ 65 | ${javac.classpath}:\ 66 | ${build.classes.dir} 67 | # Space-separated list of JVM arguments used when running the project. 68 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 69 | # To set system properties for unit tests define test-sys-prop.name=value: 70 | run.jvmargs= 71 | run.test.classpath=\ 72 | ${javac.test.classpath}:\ 73 | ${build.test.classes.dir} 74 | source.encoding=UTF-8 75 | src.dir=src 76 | test.src.dir=test 77 | -------------------------------------------------------------------------------- /Tools/NetworkGeneratorConverter/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | NetworkGeneratorConverter 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Tools/NetworkGeneratorConverter/src/networkgeneratorconverter/Edge.java: -------------------------------------------------------------------------------- 1 | package networkgeneratorconverter; 2 | 3 | public class Edge { 4 | public int a; 5 | public int b; 6 | 7 | public Edge(int a, int b) { 8 | this.a = a; 9 | this.b = b; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Tools/NetworkGeneratorConverter/src/networkgeneratorconverter/FileParser.java: -------------------------------------------------------------------------------- 1 | package networkgeneratorconverter; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.FileNotFoundException; 5 | import java.io.FileReader; 6 | import java.io.IOException; 7 | import java.util.ArrayList; 8 | import java.util.StringTokenizer; 9 | 10 | public class FileParser { 11 | 12 | private ArrayList edges; 13 | 14 | public ArrayList parseFile(String fileName) throws FileNotFoundException, IOException, FileNotFoundException { 15 | edges = new ArrayList<>(); 16 | FileReader input = new FileReader(fileName); 17 | BufferedReader inputbufferizzato = new BufferedReader(input); 18 | String Linea; 19 | while ((Linea = inputbufferizzato.readLine()) != null) { 20 | StringTokenizer st = new StringTokenizer(Linea); 21 | while (st.hasMoreTokens()) { 22 | edges.add(new Edge(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()))); 23 | break; 24 | } 25 | } 26 | input.close(); 27 | return edges; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Tools/NetworkGeneratorConverter/src/networkgeneratorconverter/NetworkGeneratorConverter.java: -------------------------------------------------------------------------------- 1 | package networkgeneratorconverter; 2 | 3 | import java.util.ArrayList; 4 | import javax.swing.JFrame; 5 | import javax.swing.JOptionPane; 6 | 7 | public class NetworkGeneratorConverter { 8 | public static void main(String[] args) { 9 | 10 | FileParser parser = new FileParser(); 11 | FileWriter fileWriter = new FileWriter(); 12 | ArrayList edges; 13 | 14 | try { 15 | edges = parser.parseFile("input.txt"); 16 | fileWriter.write("output.txt", edges); 17 | } catch (Exception e) { 18 | final JFrame frame = new JFrame(); 19 | JOptionPane.showMessageDialog(frame, "The input file for Gephi can not be found or it is corrupted."); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Tools/NetworkGeneratorConverter/src/testing/FileParserTest.java: -------------------------------------------------------------------------------- 1 | package testing; 2 | 3 | import static org.junit.jupiter.api.Assertions.*; 4 | 5 | import java.io.File; 6 | import java.io.FileNotFoundException; 7 | import java.io.IOException; 8 | import java.io.PrintWriter; 9 | import java.util.ArrayList; 10 | 11 | import org.junit.jupiter.api.Test; 12 | 13 | import networkgeneratorconverter.Edge; 14 | import networkgeneratorconverter.FileParser; 15 | 16 | class FileParserTest { 17 | 18 | @Test 19 | void test() throws FileNotFoundException, IOException { 20 | 21 | PrintWriter writer = new PrintWriter("test.txt", "UTF-8"); 22 | writer.println("1 2"); 23 | writer.println("2 1"); 24 | writer.close(); 25 | 26 | FileParser parser = new FileParser(); 27 | ArrayList edges = parser.parseFile("test.txt"); 28 | 29 | File f= new File("test.txt"); //file to be delete 30 | f.delete(); 31 | 32 | 33 | assertEquals(2, edges.size()); 34 | assertEquals(1, edges.get(0).a); 35 | assertEquals(2, edges.get(0).b); 36 | assertEquals(2, edges.get(1).a); 37 | assertEquals(1, edges.get(1).b); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /Tools/NetworkGeneratorConverter/src/testing/FileWriterTest.java: -------------------------------------------------------------------------------- 1 | package testing; 2 | 3 | import static org.junit.jupiter.api.Assertions.*; 4 | 5 | import java.io.File; 6 | import java.io.FileNotFoundException; 7 | import java.io.UnsupportedEncodingException; 8 | import java.util.ArrayList; 9 | 10 | import org.junit.jupiter.api.Test; 11 | 12 | import networkgeneratorconverter.Edge; 13 | import networkgeneratorconverter.FileWriter; 14 | 15 | class FileWriterTest { 16 | 17 | @Test 18 | void test() throws FileNotFoundException, UnsupportedEncodingException { 19 | 20 | FileWriter fileWriter = new FileWriter(); 21 | 22 | ArrayList edges = new ArrayList(); 23 | edges.add(new Edge(0, 1)); 24 | edges.add(new Edge(1, 2)); 25 | 26 | fileWriter.write("test.txt", edges); 27 | 28 | File f = new File("test.txt"); // file to be delete 29 | f.delete(); 30 | 31 | assertTrue(true); 32 | } 33 | 34 | @Test 35 | void testFail() throws FileNotFoundException, UnsupportedEncodingException { 36 | 37 | FileWriter fileWriter = new FileWriter(); 38 | 39 | ArrayList edges = new ArrayList(); 40 | edges.add(new Edge(0, 1)); 41 | edges.add(new Edge(1, 2)); 42 | edges.add(new Edge(3, 2)); 43 | 44 | edges.add(new Edge(5, 8)); 45 | 46 | 47 | fileWriter.write("test.txt", edges); 48 | 49 | File f = new File("test.txt"); // file to be delete 50 | f.delete(); 51 | 52 | assertTrue(true); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /Tools/SimulationsResultExtractor/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Tools/SimulationsResultExtractor/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | SimulationsResultExtractor 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /Tools/SimulationsResultExtractor/build/built-jar.properties: -------------------------------------------------------------------------------- 1 | #Sun, 23 Jun 2019 19:43:19 +0200 2 | 3 | 4 | C\:\\Users\\Yoga\\Desktop\\University\\Thesis\\TrustChain-Simulator\\SimulationsResultExtractor= 5 | -------------------------------------------------------------------------------- /Tools/SimulationsResultExtractor/build/classes/.gitignore: -------------------------------------------------------------------------------- 1 | /SimulationsResultExtractor.class 2 | -------------------------------------------------------------------------------- /Tools/SimulationsResultExtractor/dist/README.TXT: -------------------------------------------------------------------------------- 1 | ======================== 2 | BUILD OUTPUT DESCRIPTION 3 | ======================== 4 | 5 | When you build an Java application project that has a main class, the IDE 6 | automatically copies all of the JAR 7 | files on the projects classpath to your projects dist/lib folder. The IDE 8 | also adds each of the JAR files to the Class-Path element in the application 9 | JAR files manifest file (MANIFEST.MF). 10 | 11 | To run the project from the command line, go to the dist folder and 12 | type the following: 13 | 14 | java -jar "SimulationsResultExtractor.jar" 15 | 16 | To distribute this project, zip up the dist folder (including the lib folder) 17 | and distribute the ZIP file. 18 | 19 | Notes: 20 | 21 | * If two JAR files on the project classpath have the same name, only the first 22 | JAR file is copied to the lib folder. 23 | * Only JAR files are copied to the lib folder. 24 | If the classpath contains other types of files or folders, these files (folders) 25 | are not copied. 26 | * If a library on the projects classpath also has a Class-Path element 27 | specified in the manifest,the content of the Class-Path element has to be on 28 | the projects runtime path. 29 | * To set a main class in a standard Java project, right-click the project node 30 | in the Projects window and choose Properties. Then click Run and enter the 31 | class name in the Main Class field. Alternatively, you can manually type the 32 | class name in the manifest Main-Class element. 33 | -------------------------------------------------------------------------------- /Tools/SimulationsResultExtractor/dist/SimulationsResultExtractor.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tribler/trustchain-simulator/5f1f019c85fb0ebe0f93b2e9ac6127ddd1935759/Tools/SimulationsResultExtractor/dist/SimulationsResultExtractor.jar -------------------------------------------------------------------------------- /Tools/SimulationsResultExtractor/dist/input.txt: -------------------------------------------------------------------------------- 1 | Starting... 2 | 3 | $ cd C:/sim/omnetpp-5.4.1/samples/TrustChain-Simulator/routing_umeer 4 | $ routing_umeer.exe -r 1 -m -u Cmdenv -c General omnetpp.ini 5 | 6 | OMNeT++ Discrete Event Simulation (C) 1992-2018 Andras Varga, OpenSim Ltd. 7 | Version: 5.4.1, build: 180629-5e28390, edition: Academic Public License -- NOT FOR COMMERCIAL USE 8 | See the license for distribution terms and warranty disclaimer 9 | 10 | Setting up Cmdenv... 11 | 12 | Loading NED files from .: 7 13 | 14 | Preparing for running configuration General, run #1... 15 | Assigned runID=General-1-20190607-15:48:19-22828 16 | Setting up network "networks.Net5"... 17 | Initializing... 18 | 19 | Running simulation... 20 | ** Event #0 t=0 Elapsed: 5e-006s (0m 00s) 0% completed (0% total) 21 | Speed: ev/sec=0 simsec/sec=0 ev/simsec=0 22 | Messages: created: 32 present: 32 in FES: 10 23 | 24 | Evil node: #1 - starting transaction with #3 of value $6 Time: 64.04766108375 s 25 | 26 | 27 | Evil node: #1 - completed transaction with #3 of value $6 distant: 3 Time: 65.269161143158 s 28 | 29 | 30 | Evil node: #1 - starting transaction with #4 of value $3 Time: 65.27766108375 s 31 | 32 | 33 | Node: #4 - detected double spending in verification done by #1 distant: 1 Time: 65.582761083751 s 34 | 35 | 36 | Simulation: delta detection time: 0.305100000001 37 | 38 | ** Event #16000 t=65.582761083751 Elapsed: 0.052002s (0m 00s) 0% completed (0% total) 39 | Speed: ev/sec=307710 simsec/sec=1261.28 ev/simsec=243.967 40 | Messages: created: 1452 present: 33 in FES: 10 41 | 42 | Simulation stopped with endSimulation() -- in module (App) Net5.rte[4].app (id=50), at t=65.582761083751s, event #16000 43 | 44 | Calling finish() at end of Run #1... 45 | undisposed object: (Packet) Net5.rte[4].app.#102 from-1-to-4 chain log -- check module destructor 46 | 47 | End. 48 | -------------------------------------------------------------------------------- /Tools/SimulationsResultExtractor/dist/output.txt: -------------------------------------------------------------------------------- 1 | 0.305100000001 2 | -------------------------------------------------------------------------------- /Tools/SimulationsResultExtractor/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /Tools/SimulationsResultExtractor/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=81887d34 2 | build.xml.script.CRC32=d20fae21 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=81887d34 7 | nbproject/build-impl.xml.script.CRC32=a66f4046 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /Tools/SimulationsResultExtractor/nbproject/private/private.properties: -------------------------------------------------------------------------------- 1 | user.properties.file=C:\\Users\\umeer\\AppData\\Roaming\\NetBeans\\8.2\\build.properties 2 | -------------------------------------------------------------------------------- /Tools/SimulationsResultExtractor/nbproject/private/private.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Tools/SimulationsResultExtractor/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processor.options= 4 | annotation.processing.processors.list= 5 | annotation.processing.run.all.processors=true 6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 7 | build.classes.dir=${build.dir}/classes 8 | build.classes.excludes=**/*.java,**/*.form 9 | # This directory is removed when the project is cleaned: 10 | build.dir=build 11 | build.generated.dir=${build.dir}/generated 12 | build.generated.sources.dir=${build.dir}/generated-sources 13 | # Only compile against the classpath explicitly listed here: 14 | build.sysclasspath=ignore 15 | build.test.classes.dir=${build.dir}/test/classes 16 | build.test.results.dir=${build.dir}/test/results 17 | # Uncomment to specify the preferred debugger connection transport: 18 | #debug.transport=dt_socket 19 | debug.classpath=\ 20 | ${run.classpath} 21 | debug.test.classpath=\ 22 | ${run.test.classpath} 23 | # Files in build.classes.dir which should be excluded from distribution jar 24 | dist.archive.excludes= 25 | # This directory is removed when the project is cleaned: 26 | dist.dir=dist 27 | dist.jar=${dist.dir}/SimulationsResultExtractor.jar 28 | dist.javadoc.dir=${dist.dir}/javadoc 29 | excludes= 30 | includes=** 31 | jar.compress=false 32 | javac.classpath= 33 | # Space-separated list of extra javac options 34 | javac.compilerargs= 35 | javac.deprecation=false 36 | javac.external.vm=true 37 | javac.processorpath=\ 38 | ${javac.classpath} 39 | javac.source=1.8 40 | javac.target=1.8 41 | javac.test.classpath=\ 42 | ${javac.classpath}:\ 43 | ${build.classes.dir} 44 | javac.test.processorpath=\ 45 | ${javac.test.classpath} 46 | javadoc.additionalparam= 47 | javadoc.author=false 48 | javadoc.encoding=${source.encoding} 49 | javadoc.noindex=false 50 | javadoc.nonavbar=false 51 | javadoc.notree=false 52 | javadoc.private=false 53 | javadoc.splitindex=true 54 | javadoc.use=true 55 | javadoc.version=false 56 | javadoc.windowtitle= 57 | main.class=SimulationsResultExtractor 58 | manifest.file=manifest.mf 59 | meta.inf.dir=${src.dir}/META-INF 60 | mkdist.disabled=false 61 | platform.active=default_platform 62 | run.classpath=\ 63 | ${javac.classpath}:\ 64 | ${build.classes.dir} 65 | # Space-separated list of JVM arguments used when running the project. 66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 67 | # To set system properties for unit tests define test-sys-prop.name=value: 68 | run.jvmargs= 69 | run.test.classpath=\ 70 | ${javac.test.classpath}:\ 71 | ${build.test.classes.dir} 72 | source.encoding=UTF-8 73 | src.dir=src 74 | test.src.dir=test 75 | -------------------------------------------------------------------------------- /Tools/SimulationsResultExtractor/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | SimulationsResultExtractor 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Tools/SimulationsResultExtractor/output.txt: -------------------------------------------------------------------------------- 1 | 9.020689884495 2 | 8.113873202979 3 | 86.067229126342 4 | 54.070096199817 5 | 14.367122357386 6 | 12.070704133185 7 | 18.447748734832 8 | 23.197372250868 9 | 44.948244063538 10 | 57.710943001135 11 | 24.943014619688 12 | 72.021443379563 13 | 13.29247041627 14 | 49.968599852063 15 | 12.860552572982 16 | 60.394606775823 17 | 39.426105506888 18 | 3.972 19 | 9.057573874243 20 | 13.397505731812 21 | 143.935278497129 22 | 55.563554033761 23 | 93.640797061904 24 | 32.155406817094 25 | 18.171900619225 26 | 9.532233570478 27 | 12.720240520995 28 | 8.330689120382 29 | 23.585135122761 30 | 48.680945211055 31 | 14.783931176242 32 | 11.740539271312 33 | 9.730876510621 34 | 13.138436714696 35 | 16.969290059821 36 | 8.114693218005 37 | 80.001357786857 38 | 58.296201882939 39 | 14.434934680985 40 | 8.334257010554 41 | 26.973621089052 42 | 28.607744638524 43 | 12.721196538475 44 | 8.141246970955 45 | 23.976391888583 46 | 32.661469806021 47 | 39.767233249125 48 | 10.544 49 | 14.722160793601 50 | 10.59400788221 51 | -------------------------------------------------------------------------------- /Tools/SimulationsResultExtractor/src/SimulationsResultExtractor.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | import java.io.BufferedReader; 4 | import java.io.FileNotFoundException; 5 | import java.io.FileReader; 6 | import java.io.PrintWriter; 7 | import java.io.UnsupportedEncodingException; 8 | import java.util.StringTokenizer; 9 | 10 | public class SimulationsResultExtractor { 11 | 12 | /** 13 | * This program is used to filter out informations out of OMNeT++ tests log file 14 | * There are two outputs 15 | * - Simulations related informations on standard output 16 | * - Delta detection times 17 | */ 18 | 19 | public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException { 20 | 21 | //File reading -> filtering -> output 22 | try { 23 | FileReader input = new FileReader(args[0]); 24 | PrintWriter writer = new PrintWriter("output.txt", "UTF-8"); 25 | BufferedReader inputbufferizzato = new BufferedReader(input); 26 | String linea; 27 | while ((linea = inputbufferizzato.readLine()) != null) { 28 | if(linea.contains("Preparing") || linea.contains("") && !(linea.contains(" Simulation stopped"))){ 29 | if(linea.contains("Preparing")){ 30 | System.out.println(" "); 31 | } 32 | System.out.println(linea); 33 | } 34 | 35 | if(linea.contains("delta detection time")){ 36 | StringTokenizer detenctionTime = new StringTokenizer(linea, ":"); 37 | detenctionTime.nextElement(); 38 | detenctionTime.nextElement(); 39 | writer.println(((String)(detenctionTime.nextElement())).trim()); 40 | } 41 | } 42 | input.close(); 43 | writer.close(); 44 | 45 | } catch (Exception e) { 46 | System.out.println("Simulation Results Extractor: The input file can not be found or it is corrupted"); 47 | System.exit(0); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Tools/SimulationsResultExtractor2/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Tools/SimulationsResultExtractor2/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | -------------------------------------------------------------------------------- /Tools/SimulationsResultExtractor2/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | SimulationsResultExtractor2 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /Tools/SimulationsResultExtractor2/src/ResultExtractor2.java: -------------------------------------------------------------------------------- 1 | import java.io.BufferedReader; 2 | import java.io.FileReader; 3 | import java.util.ArrayList; 4 | 5 | /** 6 | * This program is used to extract the results from the evaluation set 11. It counts how many time in a run a node is reported because of malicious anonymizer. 7 | */ 8 | public class ResultExtractor2 { 9 | private ArrayList counterList; 10 | 11 | ResultExtractor2(String fileName) { 12 | // File reading -> filtering -> console output 13 | 14 | counterList = new ArrayList(); 15 | 16 | try { 17 | int nodeReportCounter = 0; 18 | 19 | FileReader input = new FileReader(fileName); 20 | 21 | BufferedReader inputbufferizzato = new BufferedReader(input); 22 | String linea; 23 | while ((linea = inputbufferizzato.readLine()) != null) { 24 | 25 | if (linea.contains("Preparing for running configuration")) { 26 | nodeReportCounter = 0; 27 | } 28 | 29 | if (linea.contains("Good node reported as evil")) { 30 | nodeReportCounter++; 31 | } 32 | 33 | if (linea.contains("Calling finish() at end")) { 34 | System.out.println(nodeReportCounter); 35 | counterList.add(nodeReportCounter); 36 | nodeReportCounter = 0; 37 | } 38 | 39 | } 40 | input.close(); 41 | 42 | } catch (Exception e) { 43 | System.out.println("Simulation Results Extractor 2: The input file can not be found or it is corrupted"); 44 | System.exit(0); 45 | } 46 | } 47 | 48 | public ArrayList getCounterList() { 49 | return counterList; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /Tools/SimulationsResultExtractor2/src/SimulationsResultExtractor2.java: -------------------------------------------------------------------------------- 1 | public class SimulationsResultExtractor2 { 2 | 3 | /** 4 | * This program is used to extract the results from the evaluation set 11. It counts how many time in a run a node is reported because of malicious anonymizer. 5 | */ 6 | public static void main(String[] args) { 7 | 8 | // ResultExtractor extractor = new ResultExtractor2(args[0]); 9 | ResultExtractor2 extractor = new ResultExtractor2("input.txt"); 10 | 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Tools/SimulationsResultExtractor2/src/Tester.java: -------------------------------------------------------------------------------- 1 | import static org.junit.jupiter.api.Assertions.*; 2 | 3 | import java.io.File; 4 | import java.io.FileNotFoundException; 5 | import java.io.PrintWriter; 6 | import java.io.UnsupportedEncodingException; 7 | import java.util.ArrayList; 8 | 9 | import org.junit.jupiter.api.*; 10 | 11 | class Tester { 12 | 13 | @Test 14 | void test() throws FileNotFoundException, UnsupportedEncodingException { 15 | 16 | // File f= new File("input.txt"); //file to be delete 17 | // f.delete(); 18 | 19 | PrintWriter writer = new PrintWriter("input.txt", "UTF-8"); 20 | writer.println("Preparing for running configuration "); 21 | writer.println(" Good node reported as evil "); 22 | writer.println(" Calling finish() at end "); 23 | 24 | writer.println(" Preparing for running configuration "); 25 | writer.println(" Calling finish() at end "); 26 | 27 | writer.println("Preparing for running configuration "); 28 | writer.println(" Good node reported as evil "); 29 | writer.println(" Calling finish() at end "); 30 | writer.close(); 31 | 32 | ResultExtractor2 extractor = new ResultExtractor2("input.txt"); 33 | ArrayList counterList = extractor.getCounterList(); 34 | assertEquals(3, counterList.size()); 35 | assertEquals(1, counterList.get(0)); 36 | assertEquals(0, counterList.get(1)); 37 | } 38 | 39 | @Test 40 | void testMore() throws FileNotFoundException, UnsupportedEncodingException { 41 | 42 | assertTrue(true); 43 | 44 | PrintWriter writer = new PrintWriter("input.txt", "UTF-8"); 45 | writer.println("Preparing for running configuration "); 46 | writer.println(" Good node reported as evil "); 47 | writer.println(" Calling finish() at end "); 48 | 49 | writer.println(" Preparing for running configuration "); 50 | writer.println(" Calling finish() at end "); 51 | 52 | writer.close(); 53 | 54 | ResultExtractor2 extractor = new ResultExtractor2("input.txt"); 55 | 56 | assertEquals(2, extractor.getCounterList().size()); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /Tools/SimulationsResultTypeCounter/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Tools/SimulationsResultTypeCounter/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | -------------------------------------------------------------------------------- /Tools/SimulationsResultTypeCounter/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | SimulationsResultTypeCounter 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /Tools/SimulationsResultTypeCounter/src/SimulationsResultTypeCounter.java: -------------------------------------------------------------------------------- 1 | 2 | import java.io.BufferedReader; 3 | import java.io.FileNotFoundException; 4 | import java.io.FileReader; 5 | import java.io.PrintWriter; 6 | import java.io.UnsupportedEncodingException; 7 | import java.util.StringTokenizer; 8 | 9 | public class SimulationsResultTypeCounter { 10 | 11 | /** 12 | * This program is used to filter out informations out of OMNeT++ tests log file 13 | * The console output of this program return the number of detection caused by 14 | * detection in chain verification and in dissemination (with anti error system) 15 | */ 16 | 17 | public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException { 18 | 19 | // File reading -> filtering -> console output 20 | try { 21 | 22 | int disseminationDetection = 0, chainDetection = 0; 23 | int transactionCounter = 0; 24 | 25 | FileReader input = new FileReader(args[0]); 26 | BufferedReader inputbufferizzato = new BufferedReader(input); 27 | String linea; 28 | while ((linea = inputbufferizzato.readLine()) != null) { 29 | 30 | if (linea.contains("Preparing for running configuration")) { 31 | transactionCounter=0; 32 | } 33 | 34 | 35 | if (linea.contains("completed transaction with")) { 36 | transactionCounter++; 37 | } 38 | 39 | if (linea.contains("Calling finish() at end")) { 40 | if(transactionCounter ==1){ 41 | chainDetection++; 42 | }else{ 43 | disseminationDetection++; 44 | } 45 | transactionCounter = 0; 46 | } 47 | 48 | } 49 | input.close(); 50 | 51 | System.out.println(chainDetection); 52 | System.out.println(disseminationDetection); 53 | 54 | } catch (Exception e) { 55 | System.out.println("Simulation Results Type Counter: The input file can not be found or it is corrupted"); 56 | System.exit(0); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Tools/SimulationsResultTypeCounter/src/testing.java: -------------------------------------------------------------------------------- 1 | import static org.junit.jupiter.api.Assertions.*; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | class testing { 6 | 7 | @Test 8 | void test() { 9 | 10 | assertTrue(true); 11 | 12 | } 13 | 14 | } 15 | --------------------------------------------------------------------------------