LEFT | RIGHT |
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2008,2009 IITP RAS | 3 * Copyright (c) 2008,2009 IITP RAS |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "ns3/packet.h" | 27 #include "ns3/packet.h" |
28 | 28 |
29 namespace ns3 { | 29 namespace ns3 { |
30 | 30 |
31 class Packet; | 31 class Packet; |
32 class MeshPointDevice; | 32 class MeshPointDevice; |
33 | 33 |
34 /** | 34 /** |
35 * \ingroup mesh | 35 * \ingroup mesh |
36 * | 36 * |
37 * \brief Interface for L2 mesh routing protocol and mesh point communication. | 37 * \brief Interface for L2 mesh routing protocol and mesh point communication. |
38 * | 38 * |
39 * Every mesh routing protocol must implement this interface. Each mesh point (M
eshPointDevice) is supposed | 39 * Every mesh routing protocol must implement this interface. Each mesh point (M
eshPointDevice) is supposed |
40 * to know single L2RoutingProtocol to work with, see MeshPointDevice::SetRoutin
gProtocol (). | 40 * to know single L2RoutingProtocol to work with, see MeshPointDevice::SetRoutin
gProtocol (). |
41 * | 41 * |
42 * This interface is similar to ipv4 routiong protocol base class. | 42 * This interface is similar to ipv4 routiong protocol base class. |
43 */ | 43 */ |
44 class MeshL2RoutingProtocol : public Object | 44 class MeshL2RoutingProtocol : public Object |
45 { | 45 { |
46 public: | 46 public: |
47 /// Never forget to support NS3 object model | 47 /// Never forget to support NS3 object model |
48 static TypeId GetTypeId (); | 48 static TypeId GetTypeId (); |
49 /// virtual D-tor for subclasses | 49 /// virtual D-tor for subclasses |
50 virtual ~MeshL2RoutingProtocol (); | 50 virtual ~MeshL2RoutingProtocol (); |
51 /** | 51 /** |
52 * Callback to be invoked when route discovery procedure is completed. | 52 * Callback to be invoked when route discovery procedure is completed. |
53 * | 53 * |
54 * \param flag indicating whether a route was actually found and all ne
eded information is | 54 * \param flag indicating whether a route was actually found and all ne
eded information is |
55 * added to the packet succesfully | 55 * added to the packet succesfully |
56 * | 56 * |
57 * \param packet for which the route was resolved. All routing informatio
n for MAC layer | 57 * \param packet for which the route was resolved. All routing informatio
n for MAC layer |
58 * must be stored in proper tags (like in case of HWMP, whe
n WifiMacHeader | 58 * must be stored in proper tags (like in case of HWMP, whe
n WifiMacHeader |
59 * needs address of next hop), or must be added as a packet
header (if MAC | 59 * needs address of next hop), or must be added as a packet
header (if MAC |
60 * does not need any additional information). So, the packe
t is returned back | 60 * does not need any additional information). So, the packe
t is returned back |
61 * to MeshPointDevice looks like a pure packet with etherne
t header | 61 * to MeshPointDevice looks like a pure packet with etherne
t header |
62 * (i.e data + src +dst + protocol). The only special infor
mation addressed | 62 * (i.e data + src +dst + protocol). The only special infor
mation addressed |
63 * to MeshPointDevice is an outcoming interface ID. | 63 * to MeshPointDevice is an outcoming interface ID. |
64 * | 64 * |
65 * \param src source address of the packet | 65 * \param src source address of the packet |
66 * | 66 * |
67 * \param dst destiation address of the packet | 67 * \param dst destiation address of the packet |
68 * | 68 * |
69 * \param protocol ethernet 'Protocol' field, needed to form a proper MAC-l
ayer header | 69 * \param protocol ethernet 'Protocol' field, needed to form a proper MAC-l
ayer header |
70 * | 70 * |
71 * \param uint32_t outcoming interface to use or 0xffffffff if packet shoul
d be sent by ALL interfaces | 71 * \param uint32_t outcoming interface to use or 0xffffffff if packet shoul
d be sent by ALL interfaces |
72 */ | 72 */ |
73 typedef Callback<void,/* return type */ | 73 typedef Callback<void,/* return type */ |
74 bool, /* flag */ | 74 bool, /* flag */ |
75 Ptr<Packet>, /* packet */ | 75 Ptr<Packet>, /* packet */ |
76 Mac48Address,/* src */ | 76 Mac48Address,/* src */ |
77 Mac48Address,/* dst */ | 77 Mac48Address,/* dst */ |
78 uint16_t, /* protocol */ | 78 uint16_t, /* protocol */ |
79 uint32_t /* out interface ID */ | 79 uint32_t /* out interface ID */ |
80 > RouteReplyCallback; | 80 > RouteReplyCallback; |
81 /** | 81 /** |
82 * Request routing information, all packets must go through this request. | 82 * Request routing information, all packets must go through this request. |
83 * | 83 * |
84 * Note that route discovery works async. -- RequestRoute returns immediately,
while | 84 * Note that route discovery works async. -- RequestRoute returns immediately,
while |
85 * reply callback will be called when routing information will be available. | 85 * reply callback will be called when routing information will be available. |
86 * \return true if valid route is already known | 86 * \return true if valid route is already known |
87 * \param sourceIface the incoming interface of the packet | 87 * \param sourceIface the incoming interface of the packet |
88 * \param source source address | 88 * \param source source address |
89 * \param destination destination address | 89 * \param destination destination address |
90 * \param packet the packet to be resolved (needed the whole packet, be
cause | 90 * \param packet the packet to be resolved (needed the whole packet, be
cause |
91 * routing information is added as tags or headers). The
packet | 91 * routing information is added as tags or headers). The
packet |
92 * will be returned to reply callback. | 92 * will be returned to reply callback. |
93 * \param protocolType protocol ID, needed to form a proper MAC-layer header | 93 * \param protocolType protocol ID, needed to form a proper MAC-layer header |
94 * \param routeReply callback to be invoked after route discovery procedure
, supposed | 94 * \param routeReply callback to be invoked after route discovery procedure
, supposed |
95 * to really send packet using routing information. | 95 * to really send packet using routing information. |
96 */ | 96 */ |
97 virtual bool RequestRoute (uint32_t sourceIface, const Mac48Address source, co
nst Mac48Address destination,· | 97 virtual bool RequestRoute (uint32_t sourceIface, const Mac48Address source, co
nst Mac48Address destination, Ptr< |
98 Ptr<const Packet> packet, uint16_t protocolType, RouteReplyCallback route
Reply ) = 0; | 98 const Packet> packet, uint16_t protocolType, RouteReplyCallback routeReply
) = 0; |
99 /** | 99 /** |
100 * \brief When packet is ready to go to upper layer, protocol must | 100 * \brief When packet is ready to go to upper layer, protocol must |
101 * remove all its information: tags, header, etc. So, | 101 * remove all its information: tags, header, etc. So, |
102 * MeshPointDevice must call this method when passing a packet to | 102 * MeshPointDevice must call this method when passing a packet to |
103 * upper layer. | 103 * upper layer. |
104 * \returns true if packet shall not be dropeed, false otherwise. | 104 * \returns true if packet shall not be dropeed, false otherwise. |
105 * \param sourceIface the incoming interface of the packet | 105 * \param fromIface the incoming interface of the packet |
106 * \param source source address | 106 * \param source source address |
107 * \param destination destination address | 107 * \param destination destination address |
108 * \param packet the packet to be handled | 108 * \param packet the packet to be handled |
109 * \param protocolType protocol ID, needed to form a proper MAC-layer header | 109 * \param protocolType protocol ID, needed to form a proper MAC-layer header |
110 * \attention protocol type is passed by reference, because may be | 110 * \attention protocol type is passed by reference, because may be |
111 * changed | 111 * changed |
112 */ | 112 */ |
113 virtual bool RemoveRoutingStuff (uint32_t fromIface, const Mac48Address source
, | 113 virtual bool RemoveRoutingStuff (uint32_t fromIface, const Mac48Address source
, const Mac48Address destination, Ptr< |
114 const Mac48Address destination, Ptr<Packet> packet, uint16_t & protocolT
ype) = 0; | 114 Packet> packet, uint16_t & protocolType) = 0; |
115 /// Set host mesh point, analog of SetNode (...) methods for upper layer proto
cols. | 115 /// Set host mesh point, analog of SetNode (...) methods for upper layer proto
cols. |
116 void SetMeshPoint (Ptr<MeshPointDevice> mp); | 116 void |
| 117 SetMeshPoint (Ptr<MeshPointDevice> mp); |
117 /// Each mesh protocol must be installed on the mesh point to work. | 118 /// Each mesh protocol must be installed on the mesh point to work. |
118 Ptr<MeshPointDevice> GetMeshPoint () const; | 119 Ptr<MeshPointDevice> |
| 120 GetMeshPoint () const; |
119 protected: | 121 protected: |
120 /// Host mesh point | 122 /// Host mesh point |
121 Ptr<MeshPointDevice> m_mp; | 123 Ptr<MeshPointDevice> m_mp; |
122 }; | 124 }; |
123 }//namespace ns3 | 125 }//namespace ns3 |
124 #endif | 126 #endif |
LEFT | RIGHT |