author | Lalith Suresh |
Fri, 28 May 2010 14:40:42 +0530 | |
changeset 6288 | 9056138c8223 |
parent 6287 | 4c38b94a4aaa |
child 6289 | e3f16dd7456b |
permissions | -rw-r--r-- |
6283 | 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 |
#ifndef __IPV4_CLICK_ROUTING_H__ |
|
22 |
#define __IPV4_CLICK_ROUTING_H__ |
|
23 |
||
24 |
#include "ns3/object.h" |
|
25 |
#include "ns3/packet.h" |
|
6286
bc914b89ab89
Tested simclick_click_send and added methods to Ipv4ClickRouting
Lalith Suresh
parents:
6285
diff
changeset
|
26 |
#include "ns3/ipv4.h" |
6283 | 27 |
#include "ipv4-external-routing.h" |
6285
38baafaa898c
Test code to initialise Click Router instance
Lalith Suresh
parents:
6283
diff
changeset
|
28 |
|
38baafaa898c
Test code to initialise Click Router instance
Lalith Suresh
parents:
6283
diff
changeset
|
29 |
#include <sys/time.h> |
6283 | 30 |
#include <sys/types.h> |
31 |
#include <click/simclick.h> |
|
32 |
||
33 |
#include <map> |
|
34 |
#include <string> |
|
35 |
||
36 |
namespace ns3 { |
|
37 |
||
38 |
class Ipv4ClickRouting : public Ipv4ExternalRouting |
|
39 |
{ |
|
40 |
public: |
|
6288
9056138c8223
Ipv4ClickRouting ready for aggregation with an actual node. nsclick-test.cc improved.
Lalith Suresh
parents:
6287
diff
changeset
|
41 |
|
6283 | 42 |
Ipv4ClickRouting (); |
43 |
virtual ~Ipv4ClickRouting (); |
|
44 |
||
45 |
virtual void DoStart (); |
|
6286
bc914b89ab89
Tested simclick_click_send and added methods to Ipv4ClickRouting
Lalith Suresh
parents:
6285
diff
changeset
|
46 |
virtual void DoDispose (); |
6288
9056138c8223
Ipv4ClickRouting ready for aggregation with an actual node. nsclick-test.cc improved.
Lalith Suresh
parents:
6287
diff
changeset
|
47 |
void SetClickFile (const char *clickfile); |
9056138c8223
Ipv4ClickRouting ready for aggregation with an actual node. nsclick-test.cc improved.
Lalith Suresh
parents:
6287
diff
changeset
|
48 |
void SetNodeName (std::string name); |
6283 | 49 |
|
50 |
private: |
|
6286
bc914b89ab89
Tested simclick_click_send and added methods to Ipv4ClickRouting
Lalith Suresh
parents:
6285
diff
changeset
|
51 |
// Allow Click Service methods to choose appropriate Ipv4ClickRouting object |
bc914b89ab89
Tested simclick_click_send and added methods to Ipv4ClickRouting
Lalith Suresh
parents:
6285
diff
changeset
|
52 |
static std::map < simclick_node_t *, Ptr<Ipv4ClickRouting> > m_clickInstanceFromSimNode; |
bc914b89ab89
Tested simclick_click_send and added methods to Ipv4ClickRouting
Lalith Suresh
parents:
6285
diff
changeset
|
53 |
|
6288
9056138c8223
Ipv4ClickRouting ready for aggregation with an actual node. nsclick-test.cc improved.
Lalith Suresh
parents:
6287
diff
changeset
|
54 |
const char *m_clickFile; |
6283 | 55 |
std::string m_nodeName; |
6287
4c38b94a4aaa
Test code to send packets to and from Click for 10 seconds
Lalith Suresh
parents:
6286
diff
changeset
|
56 |
|
6288
9056138c8223
Ipv4ClickRouting ready for aggregation with an actual node. nsclick-test.cc improved.
Lalith Suresh
parents:
6287
diff
changeset
|
57 |
simclick_node_t *m_simNode; |
6287
4c38b94a4aaa
Test code to send packets to and from Click for 10 seconds
Lalith Suresh
parents:
6286
diff
changeset
|
58 |
|
6286
bc914b89ab89
Tested simclick_click_send and added methods to Ipv4ClickRouting
Lalith Suresh
parents:
6285
diff
changeset
|
59 |
std::map < std::string, uint32_t > m_ifaceIdFromName; |
bc914b89ab89
Tested simclick_click_send and added methods to Ipv4ClickRouting
Lalith Suresh
parents:
6285
diff
changeset
|
60 |
std::map < std::string, Address > m_ifaceMacFromName; |
bc914b89ab89
Tested simclick_click_send and added methods to Ipv4ClickRouting
Lalith Suresh
parents:
6285
diff
changeset
|
61 |
std::map < std::string, Ipv4Address > m_ifaceAddrFromName; |
6283 | 62 |
bool m_clickInitialised; |
63 |
||
6286
bc914b89ab89
Tested simclick_click_send and added methods to Ipv4ClickRouting
Lalith Suresh
parents:
6285
diff
changeset
|
64 |
Ptr<Ipv4> m_ipv4; |
bc914b89ab89
Tested simclick_click_send and added methods to Ipv4ClickRouting
Lalith Suresh
parents:
6285
diff
changeset
|
65 |
|
6283 | 66 |
public: |
6288
9056138c8223
Ipv4ClickRouting ready for aggregation with an actual node. nsclick-test.cc improved.
Lalith Suresh
parents:
6287
diff
changeset
|
67 |
int GetInterfaceId (const char *ifname); |
9056138c8223
Ipv4ClickRouting ready for aggregation with an actual node. nsclick-test.cc improved.
Lalith Suresh
parents:
6287
diff
changeset
|
68 |
std::string GetIpAddrFromIfid (int ifid); |
9056138c8223
Ipv4ClickRouting ready for aggregation with an actual node. nsclick-test.cc improved.
Lalith Suresh
parents:
6287
diff
changeset
|
69 |
std::string GetMacAddrFromIfid (int ifid); |
6283 | 70 |
std::string GetNodeName (); |
71 |
int IfReady (int ifid); |
|
6286
bc914b89ab89
Tested simclick_click_send and added methods to Ipv4ClickRouting
Lalith Suresh
parents:
6285
diff
changeset
|
72 |
virtual void ReceiveFromExtRouter (Ptr<Packet> p, bool direction); |
bc914b89ab89
Tested simclick_click_send and added methods to Ipv4ClickRouting
Lalith Suresh
parents:
6285
diff
changeset
|
73 |
virtual void SendToExtRouter (Ptr<Packet> p, bool direction); |
6285
38baafaa898c
Test code to initialise Click Router instance
Lalith Suresh
parents:
6283
diff
changeset
|
74 |
virtual void SetIpv4 (Ptr<Ipv4> ipv4); |
38baafaa898c
Test code to initialise Click Router instance
Lalith Suresh
parents:
6283
diff
changeset
|
75 |
void TestInit (); |
6286
bc914b89ab89
Tested simclick_click_send and added methods to Ipv4ClickRouting
Lalith Suresh
parents:
6285
diff
changeset
|
76 |
|
bc914b89ab89
Tested simclick_click_send and added methods to Ipv4ClickRouting
Lalith Suresh
parents:
6285
diff
changeset
|
77 |
static Ptr<Ipv4ClickRouting> GetClickInstanceFromSimNode (simclick_node_t *simnode); |
6287
4c38b94a4aaa
Test code to send packets to and from Click for 10 seconds
Lalith Suresh
parents:
6286
diff
changeset
|
78 |
void AddSimNodeToClickMapping (); |
4c38b94a4aaa
Test code to send packets to and from Click for 10 seconds
Lalith Suresh
parents:
6286
diff
changeset
|
79 |
void HandleScheduleFromClick (const struct timeval *when); |
4c38b94a4aaa
Test code to send packets to and from Click for 10 seconds
Lalith Suresh
parents:
6286
diff
changeset
|
80 |
void HandlePacketFromClick (int ifid, int type, const unsigned char *data, int len); |
4c38b94a4aaa
Test code to send packets to and from Click for 10 seconds
Lalith Suresh
parents:
6286
diff
changeset
|
81 |
void SendPacketToClick (int ifid, int type, const unsigned char *data, int len); |
6283 | 82 |
}; |
83 |
||
6286
bc914b89ab89
Tested simclick_click_send and added methods to Ipv4ClickRouting
Lalith Suresh
parents:
6285
diff
changeset
|
84 |
} // namespace ns3 |
6283 | 85 |
|
86 |
#endif // __IPV4_CLICK_ROUTING_H__ |