author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Mon, 09 Jun 2008 15:40:22 -0700 | |
changeset 3260 | 8c0ab08144e6 |
parent 3172 | src/internet-node/internet-stack.cc@e661e08c3211 |
child 3579 | 9e5eaef3e082 |
permissions | -rw-r--r-- |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1 |
// -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
2 |
// |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
3 |
// Copyright (c) 2006 Georgia Tech Research Corporation |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
4 |
// |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
5 |
// This program is free software; you can redistribute it and/or modify |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
6 |
// it under the terms of the GNU General Public License version 2 as |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
7 |
// published by the Free Software Foundation; |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
8 |
// |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
9 |
// This program is distributed in the hope that it will be useful, |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
12 |
// GNU General Public License for more details. |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
13 |
// |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
14 |
// You should have received a copy of the GNU General Public License |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
15 |
// along with this program; if not, write to the Free Software |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
16 |
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
17 |
// |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
18 |
// Author: George F. Riley<riley@ece.gatech.edu> |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
19 |
// |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
20 |
|
524
082ffdd8fbd7
move code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
522
diff
changeset
|
21 |
#include "ns3/net-device.h" |
1176
4894ea885c0f
implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
937
diff
changeset
|
22 |
#include "ns3/callback.h" |
2829
cfb5b6336025
do not include internet-node.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2707
diff
changeset
|
23 |
#include "ns3/node.h" |
345
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
341
diff
changeset
|
24 |
|
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
25 |
#include "ipv4-l4-demux.h" |
741
38ebb2fb16f5
udp.h -> udp-l4-protocol.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
740
diff
changeset
|
26 |
#include "udp-l4-protocol.h" |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1386
diff
changeset
|
27 |
#include "tcp-l4-protocol.h" |
733
fb1882e7d785
rename ipv4.h to ipv4-l3-protocol.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
732
diff
changeset
|
28 |
#include "ipv4-l3-protocol.h" |
735
a3e48148c3ac
arp.h -> arp-l3-protocol.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
734
diff
changeset
|
29 |
#include "arp-l3-protocol.h" |
3126
68d35477a842
s/UdpImpl/UdpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
3123
diff
changeset
|
30 |
#include "udp-socket-factory-impl.h" |
3133
295e061719fc
change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
3126
diff
changeset
|
31 |
#include "tcp-socket-factory-impl.h" |
737
98eeb9273ed2
i-ipv4-impl.h -> ipv4-impl.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
736
diff
changeset
|
32 |
#include "ipv4-impl.h" |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
33 |
|
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
34 |
namespace ns3 { |
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
35 |
|
2707
1c353c7aef5b
introduce AddInternetStack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2592
diff
changeset
|
36 |
void |
1c353c7aef5b
introduce AddInternetStack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2592
diff
changeset
|
37 |
AddInternetStack (Ptr<Node> node) |
605
3a62e5c4de75
rename internet-node.h to i-node-impl.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
594
diff
changeset
|
38 |
{ |
2592
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2498
diff
changeset
|
39 |
Ptr<Ipv4L3Protocol> ipv4 = CreateObject<Ipv4L3Protocol> (); |
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2498
diff
changeset
|
40 |
Ptr<ArpL3Protocol> arp = CreateObject<ArpL3Protocol> (); |
2707
1c353c7aef5b
introduce AddInternetStack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2592
diff
changeset
|
41 |
ipv4->SetNode (node); |
1c353c7aef5b
introduce AddInternetStack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2592
diff
changeset
|
42 |
arp->SetNode (node); |
1176
4894ea885c0f
implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
937
diff
changeset
|
43 |
|
2592
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2498
diff
changeset
|
44 |
Ptr<Ipv4L4Demux> ipv4L4Demux = CreateObject<Ipv4L4Demux> (); |
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2498
diff
changeset
|
45 |
Ptr<UdpL4Protocol> udp = CreateObject<UdpL4Protocol> (); |
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2498
diff
changeset
|
46 |
Ptr<TcpL4Protocol> tcp = CreateObject<TcpL4Protocol> (); |
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2498
diff
changeset
|
47 |
|
2707
1c353c7aef5b
introduce AddInternetStack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2592
diff
changeset
|
48 |
ipv4L4Demux->SetNode (node); |
1c353c7aef5b
introduce AddInternetStack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2592
diff
changeset
|
49 |
udp->SetNode (node); |
1c353c7aef5b
introduce AddInternetStack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2592
diff
changeset
|
50 |
tcp->SetNode (node); |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1386
diff
changeset
|
51 |
|
519
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
516
diff
changeset
|
52 |
ipv4L4Demux->Insert (udp); |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1386
diff
changeset
|
53 |
ipv4L4Demux->Insert (tcp); |
519
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
516
diff
changeset
|
54 |
|
3126
68d35477a842
s/UdpImpl/UdpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
3123
diff
changeset
|
55 |
Ptr<UdpSocketFactoryImpl> udpFactory = CreateObject<UdpSocketFactoryImpl> (); |
3133
295e061719fc
change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
3126
diff
changeset
|
56 |
Ptr<TcpSocketFactoryImpl> tcpFactory = CreateObject<TcpSocketFactoryImpl> (); |
2592
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2498
diff
changeset
|
57 |
Ptr<Ipv4Impl> ipv4Impl = CreateObject<Ipv4Impl> (); |
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2498
diff
changeset
|
58 |
|
3126
68d35477a842
s/UdpImpl/UdpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
3123
diff
changeset
|
59 |
udpFactory->SetUdp (udp); |
3133
295e061719fc
change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
3126
diff
changeset
|
60 |
tcpFactory->SetTcp (tcp); |
2592
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2498
diff
changeset
|
61 |
ipv4Impl->SetIpv4 (ipv4); |
567
6fb98941c36f
remove leaks and rework the Ptr class to work with a new refcount mechanism
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
524
diff
changeset
|
62 |
|
2707
1c353c7aef5b
introduce AddInternetStack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2592
diff
changeset
|
63 |
node->AggregateObject (ipv4); |
1c353c7aef5b
introduce AddInternetStack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2592
diff
changeset
|
64 |
node->AggregateObject (arp); |
1c353c7aef5b
introduce AddInternetStack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2592
diff
changeset
|
65 |
node->AggregateObject (ipv4Impl); |
3126
68d35477a842
s/UdpImpl/UdpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
3123
diff
changeset
|
66 |
node->AggregateObject (udpFactory); |
3133
295e061719fc
change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
3126
diff
changeset
|
67 |
node->AggregateObject (tcpFactory); |
2707
1c353c7aef5b
introduce AddInternetStack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2592
diff
changeset
|
68 |
node->AggregateObject (ipv4L4Demux); |
465
7f620ea278f4
merge in raj's dispose early work
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
451
diff
changeset
|
69 |
} |
234
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
70 |
|
6124bda39cb3
code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
71 |
}//namespace ns3 |