inet-doc.ned 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. //
  2. // Copyright (C) 2003 Andras Varga
  3. //
  4. // This program is free software; you can redistribute it and/or
  5. // modify it under the terms of the GNU Lesser General Public License
  6. // as published by the Free Software Foundation; either version 2
  7. // of the License, or (at your option) any later version.
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU Lesser General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Lesser General Public License
  15. // along with this program; if not, see <http://www.gnu.org/licenses/>.
  16. //
  17. // @page whatsnew.html, What's New
  18. //
  19. // <pre>
  20. // <nohtml>
  21. // @include ../../WHATSNEW
  22. // </nohtml>
  23. // </pre>
  24. //
  25. // @page inet-architecture.html, Architecture of the INET Framework
  26. //
  27. // The INET Framework builds upon OMNeT++, and uses the same concept:
  28. // modules communicating by message passing.
  29. //
  30. // <h3>Modules and protocols</h3>
  31. //
  32. // Protocols are represented by simple modules. A simple module's external
  33. // interface (gates [connectors] and parameters) is described in a NED file,
  34. // and the implementation is contained in a C++ class with the same name.
  35. // Some examples: ~TCP, ~IPv4.
  36. //
  37. // These modules can be freely combined to form hosts and other network devices
  38. // with the NED language (no C++ code and no recompilation required).
  39. // Various pre-assembled host, router, switch, access point, etc. models can
  40. // be found in the <code>Nodes/</code> subdirectory (for example: ~StandardHost,
  41. // ~Router), but you can also create your own ones for tailored to your particular
  42. // simulation scenarios.
  43. //
  44. // Network interfaces (Ethernet, 802.11, etc) are usually compound modules (i.e.
  45. // assembled from simple modules) themselves, and are being composed of a queue,
  46. // a MAC, and possibly other simple modules. See ~EthernetInterface as an example.
  47. //
  48. // Not all modules implement protocols though. There are modules which hold
  49. // data (for example ~IPv4RoutingTable), perform autoconfiguration of a network
  50. // (~FlatNetworkConfigurator), move a mobile node around (for example
  51. // ~ConstSpeedMobility), and perform housekeeping associated with radio channels
  52. // in wireless simulations (~IRadioMedium).
  53. //
  54. // Protocol headers and packet formats are described in message definition
  55. // files (msg files), which are translated into C++ classes by OMNeT++'s
  56. // <i>opp_msgc</i> tool. The generated message classes subclass from OMNeT++'s
  57. // <code>cMessage</code> class.
  58. //
  59. // <h3>About the documentation</h3>
  60. //
  61. // The INET Framework documentation itself is also comprised of two bodies of HTML pages:
  62. // <i>neddoc</i> generated from NED and MSG files using OMNeT++'s <i>opp_neddoc</i> tool,
  63. // and the documentation of the underlying C++ classes, generated from the source files
  64. // using Doxygen.
  65. // The C++ doc is generated in a way that it contains <b>the full C++ source code</b>
  66. // as HTML pages. It is syntax highlighted, and variable and class names are hyperlinked
  67. // and cross-referenced, which makes it convenient for exploring the code.
  68. //
  69. //
  70. // <h3>Common modules in hosts and routers</h3>
  71. //
  72. // There are some common modules that appear in all (or many) host, router and device
  73. // models.
  74. //
  75. // - ~InterfaceTable. This module contains the table of network interfaces
  76. // (eth0, wlan0, etc) in the host. This module does not send or receive messages:
  77. // it is accessed by other modules using standard C++ member function calls.
  78. // Other modules rely on the interface table submodule within the host to be called
  79. // <code>interfaceTable</code> to be able to find it. (They obtain a <code>cModule *</code>
  80. // pointer to it, then cast it to <code>InterfaceTable *</code> to be able to call its
  81. // functions). Network interfaces get dynamically registered (added to the table)
  82. // by simple modules implementing the network interface, for example ~EtherMAC.
  83. //
  84. // - ~IPv4RoutingTable. This module contains the IP (v4) routing table, and heavily relies
  85. // on ~InterfaceTable for its operation. This module is also accessed from other
  86. // modules (typically ~IPv4) by calling the public member functions of its C++ class.
  87. // There are member functions for querying, adding, deleting routes, and
  88. // finding the best matching route for a given destination IP address.
  89. // The routing table submodule within the host (router) must be called
  90. // <code>routingTable</code> for other modules to find it.
  91. //
  92. // - ~IPv6RoutingTable. This is like ~IPv4RoutingTable, but for IPv6.
  93. //
  94. // <h3>Common modules at network level</h3>
  95. //
  96. // Some modules have only one instance, at global network level:
  97. //
  98. // - ~FlatNetworkConfigurator assigns IP addresses to hosts and routers,
  99. // and sets up static routing.
  100. //
  101. // - ~ScenarioManager makes simulations scriptable. Modules can be made to support
  102. // scripting by implementing the <code>IScriptable</code> C++ interface.
  103. //
  104. // - ~IRadioMedium is required for wireless simulations. It keeps track of which
  105. // nodes are within interference distance of other nodes.
  106. //
  107. // <h3>Communication between protocol layers</h3>
  108. //
  109. // In the INET Framework, when an upper-layer protocol wants to send a data
  110. // packet over a lower-layer protocol, the upper-layer module just sends the
  111. // message object representing the packet to the lower-layer module, which
  112. // will in turn encapsulate it and send it. The reverse process takes place
  113. // when a lower layer protocol receives a packet and sends it up after
  114. // decapsulation.
  115. //
  116. // It is often necessary to convey extra information with the packet. For
  117. // example, when an application-layer module wants to send data over TCP, some
  118. // connection identifier needs to be specified for TCP. When TCP sends a
  119. // segment over IP, IP will need a destination address and possibly other
  120. // parameters like TTL. When IP sends a datagram to an Ethernet interface for
  121. // transmission, a destination MAC address must be specified. This extra
  122. // information is attached to the message object to as <i>control info</i>.
  123. //
  124. // Control info are small value objects, which are attached to packets
  125. // (message objects) with its <code>setControlInfo()</code> member function.
  126. // Control info only holds auxiliary information for the next protocol layer,
  127. // and is not supposed to be sent over the network to other hosts and routers.
  128. //
  129. // @page ipaddresses.html, Specifying IP (IPv6) addresses in module parameters
  130. //
  131. // In INET, ~TCP, ~UDP and all application layer modules work with
  132. // both IPv4 and IPv6. Internally they use the Address C++ class, which
  133. // can represent both IPv4 and IPv6 addresses.
  134. //
  135. // Most modules use the L3AddressResolver C++ class to resolve addresses
  136. // specified in module parameters in omnetpp.ini.
  137. // L3AddressResolver accepts the following syntax:
  138. //
  139. // - literal IPv4 address: "186.54.66.2"
  140. // - literal IPv6 address: "3011:7cd6:750b:5fd6:aba3:c231:e9f9:6a43"
  141. // - module name: "server", "subnet.server[3]"
  142. // - interface of a host or router: "server/eth0", "subnet.server[3]/eth0"
  143. // - IPv4 or IPv6 address of a host or router: "server(ipv4)",
  144. // "subnet.server[3](ipv6)"
  145. // - IPv4 or IPv6 address of an interface of a host or router:
  146. // "server/eth0(ipv4)", "subnet.server[3]/eth0(ipv6)"
  147. //
  148. // @page irt.html, The IP routing files
  149. //
  150. // Routing files are files with <tt>.irt</tt> or <tt>.mrt</tt> extension,
  151. // and their names are passed in the routingFileName parameter
  152. // to ~IPv4RoutingTable modules. RoutingTables are present in all
  153. // IP nodes (hosts and routers).
  154. //
  155. // Routing files may contain network interface configuration and static
  156. // routes. Both are optional. Network interface entries in the file
  157. // configure existing interfaces; static routes are added to the route table.
  158. //
  159. // Interfaces themselves are represented in the simulation by modules
  160. // (such as the ~PPP module). Modules automatically register themselves
  161. // with appropriate defaults in the ~IPv4RoutingTable, and entries in the
  162. // routing file refine (overwrite) these settings.
  163. // Interfaces are identified by names (e.g. ppp0, ppp1, eth0) which
  164. // are normally derived from the module's name: a module called
  165. // <tt>"ppp[2]"</tt> in the NED file registers itself as interface ppp2.
  166. //
  167. // An example routing file (copied here from one of the example simulations):
  168. //
  169. // <pre>
  170. // ifconfig:
  171. //
  172. // # ethernet card 0 to router
  173. // name: eth0 inet_addr: 172.0.0.3 MTU: 1500 Metric: 1 BROADCAST MULTICAST
  174. // Groups: 225.0.0.1:225.0.1.2:225.0.2.1
  175. //
  176. // # Point to Point link 1 to Host 1
  177. // name: ppp0 inet_addr: 172.0.0.4 MTU: 576 Metric: 1
  178. //
  179. // ifconfigend.
  180. //
  181. // route:
  182. // 172.0.0.2 * 255.255.255.255 H 0 ppp0
  183. // 172.0.0.4 * 255.255.255.255 H 0 ppp0
  184. // default: 10.0.0.13 0.0.0.0 G 0 eth0
  185. //
  186. // 225.0.0.1 * 255.255.255.255 H 0 ppp0
  187. // 225.0.1.2 * 255.255.255.255 H 0 ppp0
  188. // 225.0.2.1 * 255.255.255.255 H 0 ppp0
  189. //
  190. // 225.0.0.0 10.0.0.13 255.0.0.0 G 0 eth0
  191. //
  192. // routeend.
  193. // </pre>
  194. //
  195. // The <tt>ifconfig...ifconfigend.</tt> part configures interfaces,
  196. // and <tt>route..routeend.</tt> part contains static routes.
  197. // The format of these sections roughly corresponds to the output
  198. // of the <tt>ifconfig</tt> and <tt>netstat -rn</tt> Unix commands.
  199. //
  200. // An interface entry begins with a <tt>name:</tt> field, and lasts until
  201. // the next <tt>name:</tt> (or until <tt>ifconfigend.</tt>). It may
  202. // be broken into several lines.
  203. //
  204. // Accepted interface fields are:
  205. // - <tt>name:</tt> - arbitrary interface name (e.g. eth0, ppp0)
  206. // - <tt>inet_addr:</tt> - IP address
  207. // - <tt>Mask:</tt> - netmask
  208. // - <tt>Groups:</tt> Multicast groups. 224.0.0.1 is added automatically,
  209. // and 224.0.0.2 also if the node is a router (forwarding==true).
  210. // - <tt>MTU:</tt> - MTU on the link (e.g. Ethernet: 1500)
  211. // - <tt>Metric:</tt> - integer route metric
  212. // - flags: <tt>BROADCAST</tt>, <tt>MULTICAST</tt>, <tt>POINTTOPOINT</tt>
  213. //
  214. // The following fields are parsed but ignored: <tt>Bcast</tt>,<tt>encap</tt>,
  215. // <tt>HWaddr</tt>.
  216. //
  217. // Interface modules set a good default for MTU, Metric (as 2e9/bitrate) and
  218. // flags, but leave inet_addr and Mask empty. inet_addr and mask should
  219. // be set either from the routing file or by a dynamic network configuration
  220. // module.
  221. //
  222. // The route fields are:
  223. //
  224. // <pre>
  225. // Destination Gateway Netmask Flags Metric Interface
  226. // </pre>
  227. //
  228. // <i>Destination, Gateway</i> and <i>Netmask</i> have the usual meaning.
  229. // The <i>Destination</i> field should either be an IP address or "default:"
  230. // (to designate the default route). For <i>Gateway</i>, <tt>*</tt> is also
  231. // accepted with the meaning <tt>0.0.0.0</tt>.
  232. //
  233. // <i>Flags</i> denotes route type:
  234. // - <i>H</i> "host": direct route (directly attached to the router), and
  235. // - <i>G</i> "gateway": remote route (reached through another router)
  236. //
  237. // <i>Interface</i> is the interface name, e.g. <tt>eth0</tt>.
  238. //
  239. //
  240. //
  241. // @page ipv6overview.html, IPv6 model overview
  242. //
  243. // IPv6 support is implemented by several cooperating modules. The ~IPv6 module
  244. // implements IPv6 datagram handling (sending, forwarding etc). It relies on
  245. // ~IPv6RoutingTable to get access to the routes. ~IPv6RoutingTable also contains the
  246. // neighbour discovery data structures (destination cache, neighbour cache,
  247. // prefix list -- the latter effectively merged into the route table). Interface
  248. // configuration (address, state, timeouts etc) is held in the ~InterfaceTable,
  249. // in <tt>IPv6InterfaceData</tt> objects attached to <tt>InterfaceEntry</tt>
  250. // as its <tt>ipv6()</tt> member.
  251. //
  252. // The ~IPv6NeighbourDiscovery module implements all tasks associated with
  253. // neighbour discovery and stateless address autoconfiguration. The data
  254. // structures themselves (destination cache, neighbour cache, prefix list)
  255. // are kept in ~IPv6RoutingTable, and are accessed via public C++ methods.
  256. // Neighbour discovery packets are only sent and processed by this module --
  257. // when ~IPv6 receives one, it forwards the packet to ~IPv6NeighbourDiscovery.
  258. //
  259. // The rest of ICMPv6 (ICMP errors, echo request/reply etc) is implemented in
  260. // the ~ICMPv6 module, just like with IPv4. ICMP errors are sent to
  261. // ~IPv6ErrorHandling, which the user can extend or replace to have errors
  262. // handled in the way she likes.
  263. //
  264. package inet;