The INET Framework is the âlibraryâ of network models for
In the previous parts ...
0. Automatic detection of network topology and unmanaged switches. Mission Impossible? (+ classic Habrahabr UserCSS )
In this part:
Note : additional information for readers of the âMesh-networkâ hub.
{image size: 2.2+ (2.1) MiB; text: 484 KiB; Smileys: 22 pcs. }
Note : [about the structure of sections used] the structure of the tutorial / how-to sections usually differs from the structure of the sections in the directory: in the directory - the structure of the sections allows you to reach the required information in a minimum number of steps (balanced tree); in tutorial / how â to, where sections are strongly connected logically, and a separate section, in fact, is one of the steps in the sequence of steps, the structure is a hierarchy of bookmarks (anchors), which allows you to remind (tutorial / ) about the fragment described earlier.
As it is good that the <section>
tag appeared in HTML5, with its help it became possible to directly set the section nesting level (by manipulating the <section>
tags in each other). The structure of the text can now be clearly reflected in the nesting (hierarchy) of tags.
This also affected the header tags <h#>
, because Now the nesting of sections is determined by the nesting of the <section>
, then to indicate the name of the section - it was enough to use only one <h1>
in the form: â <section><h1> </h1> </section>
â.
I have been using it for a long time (since the very appearance of <section>
), but creating this article, I saw another advantage of using <section>
.
A good section title should accurately reflect its essence, but there are times when it is necessary to hold (not disclose) the essence to the middle of the section. That is, such a section should first pretend to be âroutineâ, and in the middle create a âwow / wtf effectâ. Logically, this is all one section, but if you reveal its name at the very beginning of the section, then the name itself will be a spoiler . Imagine a book (detective story), on the cover of which will be all the information about the âkillerâ.
Here the â <section>
â tag âcomes on the sceneâ. It allows you to determine the name of the section anywhere within itself, i.e. not necessarily at the very beginning. Example: â <section> <h1> </h1> </section>
â. So, we can simultaneously save the logical structure of the text, and show the name of the section at the right time. You can even make the section title visually appear at its beginning, after the reader reaches a certain point (up to the <h1>
in html).
Here are just more than 9 years of the <section>
existence, browsers have not learned how to properly build the âHTML5 document outlineâ to ensure accessibility .
Why not learned? In a document with a complex structure, it is difficult * to determine from which tag (section, article, ...) the numbering of headings (h1, h2, h3, ...) should begin. Now imagine that the document itself is placed on a page like this (with many additional blocks that are not related to the document itself, but have headers), and h1 is used everywhere for headers. And if on one page not one document, but several? However, visually everything looks good ( sample document ).
* - in fact, it is not difficult, everything is described in the standard , but in reality it does not work (see the explanation below).
Why does visually look good? Here, thanks to the styles , additional information appeared - the correspondence between the section hierarchy and the levels of headings (h #). So maybe when building the âHTML5 document outlineâ should use the information from the CSS? To do this, you need to add an additional property in the CSS for the title element, indicating its level, for example:
body>section>h2 { heading-level: 1; font-size: 1.8em; } body>section>section>h2 { heading-level: 2; font-size: 1.4em; } body>section>section>section>h2 { heading-level: 3; font-size: 1.17em; } body>section>section>section>section>h2 { heading-level: 4; font-size: 1em; } body>section>section>section>section>section>h2 { heading-level: 5; font-size: 0.83em; }
Or a more rigorous version - in one section it is allowed to use only one heading. In this case, the header level is set by the section itself:
body>section { heading-level: 1; } body>section>section { heading-level: 2; } body>section>section>section { heading-level: 3; } body>section>section>section>section { heading-level: 4; } body>section>section>section>section>section { heading-level: 5; }
, and it doesn't matter what the title tag will be used: h1 or h5.
However, if earlier to create a â heading-level outline â it was enough to have only markup (HTML), now you also need styles (CSS). Can it be limited to markup (HTML)? With this question we came close to the problem of the âheading-level outlineâ construction algorithm described in the standard. So, the problem is not in the algorithm itself, but in the fact that only a limited (fixed) set of tags can act as the â sectioning root â of an element. But people often have ânon-standard desiresâ: âI want the article tag on my page with a list of articles to be a 'sectioning root' elementâ, âand I want an arbitrary section to become a 'sectioning root' elementâ. Previously, it was enough for them to use several h1 tags on the same page (and they did it). So it can make any section (tags: section, article, ...) become a âsectioning rootâ element, if the title in it is set using the h1 tag? ..
UFO flew and left this gap here ? The reverse side of the piece of paper from the previous article .
First we define what we need to include in the protocol. On the example of LLTR Basic.
The basis of the LLTR is an iteration of statistics collection on multiple hosts during a network scan. There are many iterations in LLTR
Each iteration has its own unicast src host and unicast dst host, so the next thing to include is the assignment method for each iteration of unicast src and dst. That is, in each iteration, one of the hosts must be âawareâ of itself as a unicast src host, the purpose of which is to send traffic to a unicast dst host.
And the last. Upon completion of all iterations, all collected statistics from all hosts must be sent to one host for processing. This host will analyze the collected statistics, and build the network topology.
Also, at this step, you can think about some details of the implementation (limitations) of the protocol. For example, we want a program using LLTR to work without root rights, and from user space (that is, without installing a special driver in the system), which means that LLTR should work, for example, on top of TCP and UDP.
All the rest did implement, they will determine themselves, in the process of creating a model. That is, of course, you can immediately think over everything to the smallest detail, but at the same time there is a risk of âslipping into a local optimumâ and not noticing the âbetterâ implementation. It is good when there are several models - if each implementation has its own model, then it will be possible to combine the models, and step by step come to a better implementation. Recalling the genetic algorithm ïŒïŒ. For example, in one implementation / model there may be a centralized control, in the other - decentralized, in the third - a combination of the best parts from the previous two options.
Now the time has come to decide on the network simulator, in which we will create models and set up experiments.
Basically, from the network simulator, we need the ability to implement âourâ protocol. Not all simulators make it easy to do.
But the presence of OS emulators of real network equipment of âglobal brandsâ, on the contrary, is not necessary. Most likely, emulators will create many restrictions that will only interfere with the experiments.
The Evaluating Network Simulation Tools article (our requirements for the simulator were largely the same) and
And since
Installation in * nix and in Windows is not much different. I will continue on the example of Windows.
Unpack
$. setenv
$ ./configure
$ make
But do not rush to do it!
First, notice the first command . setenv
. setenv
â. There is no â setenv
â file in the âomnetpp-5.0â directory (it was in version 5.0b1). It is not needed (for Windows), so just run âmingwenv.batâ (I advise you to see what it does before launching ... to avoid a rm
). At the end, the terminal will break away (mintty).
Secondly, I advise you to tweak the âconfigure.userâ file a bit (if the parameter mentioned is commented out in the file, then it should be uncommented):
PREFER_CLANG=yes
CFLAGS_RELEASE='-O2 -march=native -DNDEBUG=1'
PREFER_CLANG=no
CFLAGS_RELEASE='-O2 -mfpmath=sse,387 -ffast-math -fpredictive-commoning -ftree-vectorize -march=native -freorder-blocks-and-partition -pipe -DNDEBUG=1'
CFLAGS_RELEASE='-O2 -fpredictive-commoning -march=native -freorder-blocks-and-partition -pipe -DNDEBUG=1'
CFLAGS_RELEASE='-O2 -march=native -freorder-blocks-and-partition -pipe -DNDEBUG=1'
-std=c++11
' + CFLAGS_RELEASE. For example:CXXFLAGS='-std=c++11 -O2 -fpredictive-commoning -march=native -freorder-blocks-and-partition -pipe -DNDEBUG=1'
JAVA_CFLAGS=-fno-strict-aliasing
PREFER_QTENV=yes
WITH_OSG=no
WITH_PARSIM=yes
If it is not explicitly used, then it is not needed (in theory). For details, see section 16.1, 16.3, and 16.3.2 of âParallel Simulation Exampleâ in âdoc / InstallGuide.pdfâ, or here .
Now in the terminal (mintty) you can do:
./configure && make clean MODE=release make MODE=release âj17
Note : â 17
â should be replaced with the number of
In the tools / win32 directory is MSYS2, its compiler packages can be updated:
And
But index
or you can leave 32bit (replaced by int32_t), or make 64bit and modify all bitmasks + descriptions + (maybe) some_logics. Therefore, part of the long variables will need to be left 32bit, and the other part to make 64bit. In general, for correct work, you need to do all the points from:
Moreover, the same must be done with numerous libraries for
In general, I warn you against trying to make a 64bit build of
Under * nix, I also recommend using a 32bit build (at least with version 5.0 or less).
Perhaps, sometime, Andrey2008 will undertake to check the FIXME
â / â Fix
â in the code ïŒïŒ.
PS The references to the fact that the
When you first start, Eclipse offers to place the workspace in the âsamplesâ directory, but it is better to place it in any other convenient directory outside â% ProgramData%â. The main thing is that only Latin letters (+ symbols) are used on the way to the new directory, and there are no spaces.
After the closure of Welcome, the IDE will offer to install INET (as was written above), and import the examples - discard both items.
JVM options . Add to the file âide / omnetpp.iniâ (any editor that understands LF line feed will be suitable for editing; notepad will not work), keeping the empty last line:
-XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+AggressiveOpts -XX:+TieredCompilation -XX:CompileThreshold=100
To make Eclipse, such as in the picture - look inside the picture.
It's time to install INET. The âinetâ directory from the previously downloaded archive (inet-3.4.0-src.tgz) needs to be moved to the workspace. There is an âINSTALLâ file in the directory with a step-by-step installation description. You can use it (section âIf you are using the IDEâ), but just donât build (Build) a project!
Import INET:
Set up the project:
#include
â (happens if you change the âCurrent builderâ several times; it can happen in other cases).
Before setting {A}, you need to correct one of the project files. In the file âinet / .oppfeaturesâ there is a line â inet.examples.visualization
â you need to add an empty line after it in which to write â inet.tutorials.visualization
â, preferably keeping the indent to the left (by analogy with other parameters â nedPackages
â in the file ). If this is not done, then nothing bad will happen, just after setting in âProblemsâ (Alt + Shift + Q, X), errors associated with â inet.tutorials.visualization
â will always hang. You can first make {A} , and look at the errors, and then correct the file âinet / .oppfeaturesâ - while Eclipse will warn about the integrity violation in the settings, and offer to proxy them (we agree to this).
Let's get started (
make MODE=release CONFIGNAME=${ConfigName} -j17
â (â 17
â replace with previous value in the line, ie with selected N) {E} , the same can be done for the configuration of âgcc-debugâ, replacing in the line â MODE=release
â with â MODE=debug
â, after that do not forget to switch back to âgcc-release [Active]â.../src
â directory with the selected âAdd to all configurationsâ and âAdd to all languagesâ {G} - initially â ../src
â is in the âGNU ../src
â appeared in all languages ââand configurations.__cplusplus
â with the value â 201103L
â and selected âAdd to all configurationsâ and âAdd to all languagesâ - {F} for details ;__cplusplus
â the value is â 201103L
â./inet/src
â {G} , if thereâs something else (for example, just â /inet
â), then delete what you have and add (âAdd Folder ... â)â /inet/src
â. Then the âApplyâ button, and return to {A} , since all filters were erased when removed. By the way, â /inet
â can actually be left - with him, too, everything is going fine, but it is better to narrow down to the original â /inet/src
â.-std=c++11
â before â ${FLAGS}
â in âCommand to get compiler specsâ, it should look something like this ` ${COMMAND} -std=c++11 ${FLAGS} -E -P -v -dD "${INPUTS}"
` {F} , more ${COMMAND} -std=c++11 ${FLAGS} -E -P -v -dD "${INPUTS}"
here and here ;__cplusplus
â; do not change the order, delete all references to __cplusplus
__cplusplus
â âCDT Managed Build System Entriesâ, , );__cplusplus=201103L
â ( ).
{E} . . , Eclipse , âconfigure.userâ --just-print
â â --trace
â, , ( g++ -c -std=c++11 -O2 -fpredictive-commoning -march=native -freorder-blocks-and-partition -pipe -DNDEBUG=1 âŠ
â. , .
(
CFLAGS
â, âStringâ, â -O2 -fpredictive-commoning -march=native -freorder-blocks-and-partition -pipe
â;CXXFLAGS
â, âStringâ, â -std=c++11 -O2 -fpredictive-commoning -march=native -freorder-blocks-and-partition -pipe
â;CFLAGS
â, â ${CFLAGS}
â;CXXFLAGS
â, â ${CXXFLAGS}
â;
, , g++ , â --just-print
â â --trace
â, Process Explorer . Process Explorer , â -march=native
â âcc1plus.exeâ.
, , INET! , âgcc-releaseâ {B} , â --just-print
â â --trace
â {E} , . (
, Eclipse, â.cprojectâ â.settingsâ {BG} , : â.oppfeaturesâ, â.oppfeaturestateâ, â.nedexclusionsâ â {A} .
, , .
Note : , â âdocâ
Note : ,
INET, , . , ?
INET âProject Explorerâ, âinet/src/inet/applicationsâ, â udpapp â (UDP Application). UDP broadcast . , , , , â UDPEchoApp â. âUDPBasicAppâ, âBasicâ. â.ccâ, â.hâ â.nedâ . , â.nedâ , ( âparameters:
â ) .
. , ( inet/examples ) INET. , âbroadcastâ ( inet/examples/inet/broadcast )! â.ccâ, â.hâ â.nedâ, â.iniâ â.xmlâ . , :
, (âbroadcastâ) , .. . , , .
Note : Simulation Manual . , , ( RAM) . JS â bookmark let . , Simulation Manual, ( ), ( target
Simulation Manual). Bookmarklet . , , Simulation Manual , bookmarklet .
bookmarklet . . 5- . bookmarklet , .
â bookmarklet â ; bookmarklet , ( 5- ) â .
âLLTRâ, âsrcâ âsimulationsâ, âgcc-releaseâ (File â New â
âinetâ, . , âgcc-debugâ (.. âLLTRâ), âinetâ. : {A,B,G} âProject Referencesâ, âinetâ.
, Wizard, , âpackage.nedâ : âsrcâ, âsimulationsâ. â â package lltr;
â â package lltr.simulations;
â . .
INET, âinet/srcâ â âLLTR/srcâ, âinet/examplesâ â âLLTR/simulationsâ. âLLTR/simulationsâ â.nedâ c Network , âLLTR/srcâ â ().
â INET , INET, , INET. , â INET.
, â.nedâ âLLTR/srcâ ( âinet/srcâ), â package lltr.simulations;
â âLLTR/simulationsâ. âpackage.nedâ âLLTR/srcâ âLLTR/simulationsâ.
LLTR. âLLTR/simulations/omnetpp.iniâ, (
Eclipse âsimulationsâ . , : âLLTR/src/LLTR.exeâ . , âLLTR.exeâ , ( Project â Build Project), ( ).
âNo network specified in the configuration.â, , â network = lltr. Network
â â [General]
â âomnetpp .ini â, â network Network {}
â âpackage .ned â. ( â.nedâ ), ( â.iniâ ) ( Network â ) .
(
Note : (
Note : ( â a1_v0.1.0 (âaâ â article) â git checkout -b âčmy_branchâș tags/a1_v0.1.0
â)
, :
Note : âarticle_#â , , , ( ), /.
â â? , GitHub , :
git clone
â;git clone --branch âčarticle_#âș --single-branch
â ( â --depth
â), â git remote set-branches âadd
â ( â ⊠)
, , â git checkout -b âč my_branch âș tags/âčtag_nameâș
â.
, .. ? Pull Request, >:-), , , , ):
, , Pull Request .
Note : , : , ( â â () , ). â -u â , . , âa1_v0.1. 0 â, âa1_v0.2. 0 â, ⊠â âa1_v0.1. 1 â, âa1_v0.2. 1 â, ⊠, : âa1_v0.1. 2 â, âa1_v0.2. 2 â, âŠ
Note : tutorial , ââ, git , git tag.
Note : git diff , , ( , / ) ( AST ), Java .
âpackage.nedâ ( âDesignâ ), :
, broadcast :
ââ ( ) Eth100M (: 100 Mbps; : 10 ). , 10 , , ? ( )
( âSourceâ ), (git tag a1_v0.2.0) . :
package âč<a href="https://omnetpp.org/doc/omnetpp/manual/#sec:ned-ref:packages"> </a>âș; //<a href="https://omnetpp.org/doc/omnetpp/manual/#sec:ned-ref:directory-structure"> </a> import âč<a href="https://omnetpp.org/doc/omnetpp/manual/#sec:ned-lang:imports-and-name-resolution"> </a>âș; network âč<a href="https://omnetpp.org/doc/omnetpp/manual/#sec:ned-lang:warmup:network"> </a>âș { @display(âč , , âș); <a href="https://omnetpp.org/doc/omnetpp/manual/#sec:ned-ref:submodules">submodules</a>: âč<a href="https://omnetpp.org/doc/omnetpp/manual/#sec:ned-lang:submodules"> </a>âș: âč âș { @display(âč , , âș); } <a href="https://omnetpp.org/doc/omnetpp/manual/#sec:ned-ref:connections">connections</a>: âč âș.âč<a href="https://omnetpp.org/doc/omnetpp/manual/#sec:ned-lang:gates"> </a>âș <--> âč âș <--> âč âș.âč âș; }
Warning : <a>...</a>
â ââ . , , , ( <strong>...</strong>
, <em>...</em>
).
package âč âș; //
import âč âș;
network âč âș
{
@display(âč , , âș);
submodules :
âč âș: âč âș { @display(âč , , âș); }
connections :
âč âș.âč âș <--> âč âș <--> âč âș.âč âș;
}
âč âș.âčgateâș[âčâș]
â, â â âč âș.âčgateâș ++
â.⊠<--> { delay = 100ms; } <--> âŠ
â), / , ( broadcast : â ⊠<--> C <--> âŠ
â), (: â ⊠<--> FastEthernet {per = 1e-6;} <--> âŠ
â), âŠoutput
/ input
; : -->
/ <--
), ( : inout
; : <-->
). , , â $i
â â $o
â .
Warning : 1 â 3 20 ( 504 âGateway Time-outâ). 1 â 3 . ( ):
<a href="#set">: â<code>set: p=1.87548</code>â</a> .
:
<a href="#set"><code>: âset: p=1.87548</code>â</a> .
, 3â . :
, <a href="https://omnetpp.org/doc/omnetpp/manual/#sec:ned-ref:inout-gates"> â<strong><code>$i</code></strong>â â<strong><code>$o</code></strong>â</a>.
Note : target
Simulation Manual â bookmarklet ', .
Note : , CSS JS â , 3 , GitHub Pages 2â ( HTML, , , , â). 3â â .
. . â . â .
Source: https://habr.com/ru/post/420327/
All Articles