|
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
|
2 /* |
|
3 * Copyright (c) 2010 Lalith Suresh |
|
4 * |
|
5 * This program is free software; you can redistribute it and/or modify |
|
6 * it under the terms of the GNU General Public License version 2 as |
|
7 * published by the Free Software Foundation; |
|
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 General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU General Public License |
|
15 * along with this program; if not, write to the Free Software |
|
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 * |
|
18 * Authors: Lalith Suresh <suresh.lalith@gmail.com> |
|
19 */ |
|
20 |
|
21 /** |
|
22 * \ingroup routing |
|
23 * \defgroup click Click |
|
24 * |
|
25 * \section model Model |
|
26 * |
|
27 * This model implements the interface to the Click Modular Router and |
|
28 * provides the Ipv4ClickRouting class to allow a node to use Click |
|
29 * for external routing. Unlike normal Ipv4RoutingProtocol sub types, |
|
30 * Ipv4ClickRouting doesn't use a RouteInput() method, but instead, |
|
31 * receives a packet on the appropriate interface and processes it |
|
32 * accordingly. Note that you need to have a routing table type element |
|
33 * in your Click graph to use Click for external routing. This is needed |
|
34 * by the RouteOutput() function inherited from Ipv4RoutingProtocol. |
|
35 * Furthermore, a Click based node uses a different kind of L3 in the |
|
36 * form of Ipv4L3ClickProtocol, which is a trimmed down version of |
|
37 * Ipv4L3Protocol. Ipv4L3ClickProtocol passes on packets passing through |
|
38 * the stack to Ipv4ClickRouting for processing. |
|
39 * |
|
40 * \section build Build Instructions |
|
41 * |
|
42 * The first step is to build Click. At the top of your Click source directory: |
|
43 * |
|
44 * $: ./configure --enable-userlevel --disable-linuxmodule --enable-nsclick --enable-wifi |
|
45 * $: make |
|
46 * |
|
47 * The --enable wifi flag can be skipped in case you don't intend on using |
|
48 * Click with Wifi. |
|
49 * *Note: You don't need to do a 'make install'. |
|
50 * |
|
51 * Once Click has been built successfully, we proceed to configure ns-3 with |
|
52 * Click Integration support: |
|
53 * |
|
54 * $: ./waf configure --with-nsclick=/path/to/click/source |
|
55 * |
|
56 * If it says 'enabled' beside 'NS-3 Click Integration Support', then you're |
|
57 * good to go. |
|
58 * |
|
59 * Next, try running one of the examples: |
|
60 * |
|
61 * $: ./waf --run nsclick-simple-lan |
|
62 * |
|
63 * You will find a lot of output being generated. This is because of the |
|
64 * IPPrint and Print elements present in the nsclick-simple-lan.click |
|
65 * configuration file that the example script uses. |
|
66 * |
|
67 * \section clickgraph Click Graph Instructions |
|
68 * |
|
69 * The following should be kept in mind when making your Click graph: |
|
70 * - Only userlevel elements can be used. |
|
71 * - You will need to replace FromDevice and ToDevice elements |
|
72 * with FromSimDevice and ToSimDevice elements. |
|
73 * - Packets to the kernel are sent up using ToSimDevice(tap0,IP). |
|
74 * - For any node, the 0th device will be tap0. The remaining devices |
|
75 * should be eth0, eth1 and so forth (even if you're using wifi). |
|
76 * Please note that the device numbering should begin from 0. |
|
77 * - A routing table element is a mandatory. The OUTports of the routing |
|
78 * table element should correspond to the interface number of the device |
|
79 * through which the packet will ultimately be sent out. Violating this |
|
80 * rule will lead to really weird packet traces. This routing table element's |
|
81 * name should then be passed to the Ipv4ClickRouting protocol object as |
|
82 * a simulation parameter. See the Click examples for details. |
|
83 * - When using Wifi with ns-3-click, do not use wifi specific elements like |
|
84 * WifiEncap, ExtraEncap, MadWifiRate etc. for outgoing packets. Incoming |
|
85 * packets should have their Wifi headers removed using WifiDecap + ExtraDecap |
|
86 * or Strip elements. See the nsclick-raw-wlan.click file for an idea of the same. |
|
87 * - The current implementation leaves Click with mainly L3 functionality, |
|
88 * with ns-3 handling L2. We will soon begin working to support the use of |
|
89 * MAC protocols on Click as well. |
|
90 * |
|
91 * \section usage Usage |
|
92 * |
|
93 * To have a node run Click, the easiest way would be to use the ClickInternetStackHelper |
|
94 * class in your simulation script. For instance: |
|
95 * |
|
96 * ClickInternetStackHelper click; |
|
97 * click.SetClickFile (myNodeContainer, "nsclick-simple-lan.click"); |
|
98 * click.SetRoutingTableElement (myNodeContainer, "u/rt"); |
|
99 * click.Install (myNodeContainer); |
|
100 * |
|
101 * The example scripts inside examples/click/ demonstrate the use of Click based |
|
102 * nodes in different scenarios. |
|
103 * |
|
104 * |
|
105 */ |
|
106 |