Restructured files - unfinished
authorKirill Andreev <andreev@iitp.ru>
Thu Mar 12 13:02:29 2009 +0300 (11 months ago)
changeset 4798f5f30f79d845
parent 4797 9902003078aa
child 4799 34d837b1a529
Restructured files - unfinished
src/devices/wifi/mesh-wifi-mac-header.cc
src/devices/wifi/mesh-wifi-mac-header.h
src/devices/wifi/mesh-wifi-mac.cc
src/devices/wifi/wifi-mac-header.cc
src/devices/wifi/wifi-mac-header.h
src/devices/wifi/wscript
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/devices/wifi/mesh-wifi-mac-header.cc	Thu Mar 12 13:02:29 2009 +0300
     1.3 @@ -0,0 +1,341 @@
     1.4 +#include "ns3/assert.h"
     1.5 +#include "ns3/address-utils.h"
     1.6 +#include "mesh-wifi-mac-header.h"
     1.7 +
     1.8 +namespace ns3 {
     1.9 +
    1.10 +/***********************************************************
    1.11 + * 	Here Mesh Mac Header functionality is defined.
    1.12 + ***********************************************************/
    1.13 +TypeId 
    1.14 +WifiMeshHeader::GetTypeId (void)
    1.15 +{
    1.16 +  static TypeId tid = TypeId ("ns3::WifiMeshHeader")
    1.17 +    .SetParent<Header> ()
    1.18 +    .AddConstructor<WifiMeshHeader> ()
    1.19 +    ;
    1.20 +  return tid;
    1.21 +}
    1.22 +
    1.23 +WifiMeshHeader::WifiMeshHeader()
    1.24 +{
    1.25 +	m_meshFlags = 0;
    1.26 +}
    1.27 +
    1.28 +WifiMeshHeader::~WifiMeshHeader()
    1.29 +{
    1.30 +}
    1.31 +
    1.32 +TypeId 
    1.33 +WifiMeshHeader::GetInstanceTypeId (void) const
    1.34 +{
    1.35 +  return GetTypeId ();
    1.36 +}
    1.37 +
    1.38 +void
    1.39 +WifiMeshHeader::SetAddr5 (Mac48Address address)
    1.40 +{
    1.41 +	m_addr5 = address;
    1.42 +}
    1.43 +
    1.44 +void
    1.45 +WifiMeshHeader::SetAddr6 (Mac48Address address)
    1.46 +{
    1.47 +	m_addr6 = address;
    1.48 +}
    1.49 +
    1.50 +void
    1.51 +WifiMeshHeader::SetAddr7 (Mac48Address address)
    1.52 +{
    1.53 +	m_addr7 = address;
    1.54 +}
    1.55 +
    1.56 +Mac48Address
    1.57 +WifiMeshHeader::GetAddr5 ()
    1.58 +{
    1.59 +	return m_addr5;
    1.60 +}
    1.61 +
    1.62 +Mac48Address
    1.63 +WifiMeshHeader::GetAddr6 ()
    1.64 +{
    1.65 +	return m_addr6;
    1.66 +}
    1.67 +
    1.68 +Mac48Address
    1.69 +WifiMeshHeader::GetAddr7 ()
    1.70 +{
    1.71 +	return m_addr7;
    1.72 +}
    1.73 +
    1.74 +void
    1.75 +WifiMeshHeader::SetMeshSeqno (uint32_t seqno)
    1.76 +{
    1.77 +	m_meshSeqno = seqno;
    1.78 +}
    1.79 +
    1.80 +uint32_t
    1.81 +WifiMeshHeader::GetMeshSeqno ()
    1.82 +{
    1.83 +	return m_meshSeqno;
    1.84 +}
    1.85 +
    1.86 +void
    1.87 +WifiMeshHeader::SetMeshTtl (uint8_t TTL)
    1.88 +{
    1.89 +	m_meshTtl = TTL;
    1.90 +}
    1.91 +
    1.92 +uint8_t
    1.93 +WifiMeshHeader::GetMeshTtl ()
    1.94 +{
    1.95 +	return m_meshTtl;
    1.96 +}
    1.97 +
    1.98 +void
    1.99 +WifiMeshHeader::SetAddressExt (uint8_t num_of_addresses)
   1.100 +{
   1.101 +	if (num_of_addresses > 3)
   1.102 +		return;
   1.103 +	m_meshFlags = 0xc0 | (num_of_addresses << 6);
   1.104 +}
   1.105 +
   1.106 +uint8_t
   1.107 +WifiMeshHeader::GetAddressExt ()
   1.108 +{
   1.109 +	return ((0xc0 & m_meshFlags) >> 6);
   1.110 +}
   1.111 +
   1.112 +
   1.113 +uint32_t
   1.114 +WifiMeshHeader::GetSerializedSize (void) const
   1.115 +{
   1.116 +	return 6 + ((0xc0 & m_meshFlags) >> 6)*6;
   1.117 +}
   1.118 +
   1.119 +void
   1.120 +WifiMeshHeader::Serialize (Buffer::Iterator start) const
   1.121 +{
   1.122 +	Buffer::Iterator i = start;
   1.123 +	i.WriteU8(m_meshFlags);
   1.124 +	i.WriteU8(m_meshTtl);
   1.125 +	i.WriteU32(m_meshSeqno);
   1.126 +	uint8_t addresses_to_add = (m_meshFlags & 0xc0) >> 6;
   1.127 +	//Writing Address extensions:
   1.128 +	if(addresses_to_add > 0)
   1.129 +		WriteTo (i, m_addr5);
   1.130 +	if(addresses_to_add > 1)
   1.131 +		WriteTo (i, m_addr6);
   1.132 +	if(addresses_to_add > 2)
   1.133 +		WriteTo (i, m_addr7);
   1.134 +}
   1.135 +
   1.136 +uint32_t
   1.137 +WifiMeshHeader::Deserialize (Buffer::Iterator start)
   1.138 +{
   1.139 +	Buffer::Iterator i = start;
   1.140 +	uint8_t addresses_to_read = 0;
   1.141 +	m_meshFlags = i.ReadU8();
   1.142 +	m_meshTtl = i.ReadU8();
   1.143 +	m_meshSeqno = i.ReadU32();
   1.144 +	addresses_to_read = (m_meshFlags & 0xc0) >> 6;
   1.145 +	if(addresses_to_read > 0)
   1.146 +		ReadFrom (i, m_addr5);
   1.147 +	if(addresses_to_read > 1)
   1.148 +		ReadFrom (i, m_addr6);
   1.149 +	if(addresses_to_read > 2)
   1.150 +		ReadFrom (i, m_addr7);
   1.151 +	return i.GetDistanceFrom(start);
   1.152 +}
   1.153 +void
   1.154 +WifiMeshHeader::Print (std::ostream &os) const
   1.155 +{
   1.156 +	os << "flags" << m_meshFlags
   1.157 +		<< "ttl" << m_meshTtl
   1.158 +		<< "seqno" << m_meshSeqno;
   1.159 +}
   1.160 +/**********************************************************
   1.161 + * 		MultihopActionFrame
   1.162 + **********************************************************/
   1.163 +WifiMeshMultihopActionHeader::WifiMeshMultihopActionHeader ()
   1.164 +{
   1.165 +}
   1.166 +
   1.167 +WifiMeshMultihopActionHeader::~WifiMeshMultihopActionHeader ()
   1.168 +{
   1.169 +}
   1.170 +
   1.171 +void
   1.172 +WifiMeshMultihopActionHeader::SetAction(
   1.173 +		enum WifiMeshMultihopActionHeader::CategoryValue type,
   1.174 +		WifiMeshMultihopActionHeader::ACTION_VALUE action)
   1.175 +{
   1.176 +	switch(type)
   1.177 +	{
   1.178 +		case MESH_PEER_LINK_MGT:
   1.179 +			m_category = 4;
   1.180 +			switch (action.peerLink)
   1.181 +			{
   1.182 +				case PEER_LINK_OPEN:
   1.183 +					m_actionValue = 0;
   1.184 +					break;
   1.185 +				case PEER_LINK_CONFIRM:
   1.186 +					m_actionValue = 1;
   1.187 +					break;
   1.188 +				case PEER_LINK_CLOSE:
   1.189 +					m_actionValue = 2;
   1.190 +					break;
   1.191 +			};
   1.192 +			break;
   1.193 +		case MESH_LINK_METRIC:
   1.194 +			m_category = 5;
   1.195 +			break;
   1.196 +		case MESH_PATH_SELECTION:
   1.197 +			m_category = 6;
   1.198 +			switch(action.pathSelection)
   1.199 +			{
   1.200 +				case PATH_REQUEST:
   1.201 +					m_actionValue = 0;
   1.202 +					break;
   1.203 +				case PATH_REPLY:
   1.204 +					m_actionValue = 1;
   1.205 +					break;
   1.206 +				case PATH_ERROR:
   1.207 +					m_actionValue = 2;
   1.208 +					break;
   1.209 +				case ROOT_ANNOUNCEMENT:
   1.210 +					m_actionValue = 3;
   1.211 +					break;
   1.212 +			};
   1.213 +			break;
   1.214 +		case MESH_INTERWORK_ACTION:
   1.215 +			m_category = 7;
   1.216 +			break;
   1.217 +		case MESH_RESOURCE_COORDINATION:
   1.218 +			m_category = 8;
   1.219 +			break;
   1.220 +	};
   1.221 +}
   1.222 +
   1.223 +enum WifiMeshMultihopActionHeader::CategoryValue
   1.224 +WifiMeshMultihopActionHeader::GetCategory()
   1.225 +{
   1.226 +	switch(m_category)
   1.227 +	{
   1.228 +		case 4:
   1.229 +			return MESH_PEER_LINK_MGT;
   1.230 +		case 5:
   1.231 +			return MESH_LINK_METRIC;
   1.232 +		case 6:
   1.233 +			return MESH_PATH_SELECTION;
   1.234 +		case 7:
   1.235 +			return MESH_INTERWORK_ACTION;
   1.236 +		case 8:
   1.237 +			return MESH_RESOURCE_COORDINATION;
   1.238 +		default:
   1.239 +			NS_ASSERT(false);
   1.240 +			return MESH_PEER_LINK_MGT;
   1.241 +	}
   1.242 +}
   1.243 +
   1.244 +WifiMeshMultihopActionHeader::ACTION_VALUE
   1.245 +WifiMeshMultihopActionHeader::GetAction()
   1.246 +{
   1.247 +	ACTION_VALUE retval;
   1.248 +	switch(m_category)
   1.249 +	{
   1.250 +		case 4:
   1.251 +			//MESH_PEER_LINK_MGT;
   1.252 +			switch(m_actionValue)
   1.253 +			{
   1.254 +				case 0:
   1.255 +					retval.peerLink = PEER_LINK_OPEN;
   1.256 +					return retval;
   1.257 +				case 1:
   1.258 +					retval.peerLink = PEER_LINK_CONFIRM;
   1.259 +					return retval;
   1.260 +				case 2:
   1.261 +					retval.peerLink = PEER_LINK_CLOSE;
   1.262 +					return retval;
   1.263 +				default:
   1.264 +					NS_ASSERT(false);
   1.265 +					return retval;
   1.266 +
   1.267 +			}
   1.268 +		case 5:
   1.269 +			//MESH_LINK_METRIC;
   1.270 +		case 6:
   1.271 +			//MESH_PATH_SELECTION;
   1.272 +			switch(m_actionValue)
   1.273 +			{
   1.274 +				case 0:
   1.275 +					retval.pathSelection = PATH_REQUEST;
   1.276 +					return retval;
   1.277 +				case 1:
   1.278 +					retval.pathSelection = PATH_REPLY;
   1.279 +					return retval;
   1.280 +				case 2:
   1.281 +					retval.pathSelection = PATH_ERROR;
   1.282 +					return retval;
   1.283 +				case 3:
   1.284 +					retval.pathSelection = ROOT_ANNOUNCEMENT;
   1.285 +					return retval;
   1.286 +				default:
   1.287 +					NS_ASSERT(false);
   1.288 +					return retval;
   1.289 +			}
   1.290 +
   1.291 +		case 7:
   1.292 +			//MESH_INTERWORK_ACTION;
   1.293 +		case 8:
   1.294 +			//MESH_RESOURCE_COORDINATION;
   1.295 +		default:
   1.296 +			NS_ASSERT(false);
   1.297 +			return retval;
   1.298 +	}
   1.299 +}
   1.300 +
   1.301 +TypeId
   1.302 +WifiMeshMultihopActionHeader::GetTypeId (void)
   1.303 +{
   1.304 +	static TypeId tid = TypeId ("ns3::WifiMeshMultihopActionHeader")
   1.305 +		.SetParent<Header> ()
   1.306 +		.AddConstructor<WifiMeshMultihopActionHeader> ()
   1.307 +		;
   1.308 +	return tid;
   1.309 +}
   1.310 +
   1.311 +TypeId
   1.312 +WifiMeshMultihopActionHeader::GetInstanceTypeId (void) const
   1.313 +{
   1.314 +	return GetTypeId();
   1.315 +}
   1.316 +
   1.317 +void
   1.318 +WifiMeshMultihopActionHeader::Print (std::ostream &os) const
   1.319 +{
   1.320 +}
   1.321 +
   1.322 +uint32_t
   1.323 +WifiMeshMultihopActionHeader::GetSerializedSize (void) const
   1.324 +{
   1.325 +	return 2;
   1.326 +}
   1.327 +
   1.328 +void
   1.329 +WifiMeshMultihopActionHeader::Serialize (Buffer::Iterator start) const
   1.330 +{
   1.331 +	start.WriteU8(m_category);
   1.332 +	start.WriteU8(m_actionValue);
   1.333 +}
   1.334 +
   1.335 +uint32_t
   1.336 +WifiMeshMultihopActionHeader::Deserialize (Buffer::Iterator start)
   1.337 +{
   1.338 +	Buffer::Iterator i = start;
   1.339 +	m_category = i.ReadU8();
   1.340 +	m_actionValue = i.ReadU8();
   1.341 +	return i.GetDistanceFrom(start);
   1.342 +}
   1.343 +
   1.344 +} // namespace ns3
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/src/devices/wifi/mesh-wifi-mac-header.h	Thu Mar 12 13:02:29 2009 +0300
     2.3 @@ -0,0 +1,124 @@
     2.4 +#ifndef WIFI_MAC_HEADER_H
     2.5 +#define WIFI_MAC_HEADER_H
     2.6 +
     2.7 +#include "ns3/header.h"
     2.8 +#include "ns3/mac48-address.h"
     2.9 +#include "ns3/nstime.h"
    2.10 +#include <stdint.h>
    2.11 +
    2.12 +namespace ns3 {
    2.13 +
    2.14 +class WifiMeshHeader : public Header //7.1.3.5b
    2.15 +{
    2.16 +	public:
    2.17 +		WifiMeshHeader ();
    2.18 +		~WifiMeshHeader ();
    2.19 +		static TypeId GetTypeId (void);
    2.20 +		virtual TypeId GetInstanceTypeId (void) const;
    2.21 +		virtual void Print (std::ostream &os) const;
    2.22 +
    2.23 +		void			SetAddr5 (Mac48Address address);
    2.24 +		void			SetAddr6 (Mac48Address address);
    2.25 +		void			SetAddr7 (Mac48Address address);
    2.26 +		Mac48Address		GetAddr5 ();
    2.27 +		Mac48Address		GetAddr6 ();
    2.28 +		Mac48Address		GetAddr7 ();
    2.29 +
    2.30 +		void			SetMeshSeqno (uint32_t seqno);
    2.31 +		uint32_t		GetMeshSeqno ();
    2.32 +
    2.33 +		void			SetMeshTtl (uint8_t TTL);
    2.34 +		uint8_t		GetMeshTtl ();
    2.35 +
    2.36 +		void			SetAddressExt (uint8_t num_of_addresses);
    2.37 +		uint8_t		GetAddressExt ();
    2.38 +
    2.39 +		virtual uint32_t	GetSerializedSize (void) const;
    2.40 +		virtual void		Serialize (Buffer::Iterator start) const;
    2.41 +		virtual uint32_t	Deserialize (Buffer::Iterator start);
    2.42 +	private:
    2.43 +		uint8_t	m_meshFlags;
    2.44 +		uint8_t	m_meshTtl;
    2.45 +		uint32_t	m_meshSeqno;
    2.46 +		Mac48Address	m_addr5;
    2.47 +		Mac48Address	m_addr6;
    2.48 +		Mac48Address	m_addr7;
    2.49 +};
    2.50 +class WifiMeshMultihopActionHeader : public Header //7.2.3.14
    2.51 +{
    2.52 +	//Multichop action frame consists of Mesh header, Action, and
    2.53 +	//the last information. Mesh header is present within all data
    2.54 +	//frames and multihop action frames, so Mesh header is a
    2.55 +	//separate structure. Each MultihopAction frames (frames like
    2.56 +	//PREQ, PREP and other) start form Category field and Action
    2.57 +	//value field, so the Multihop Action Frame should containt
    2.58 +	//three fields: Category, Action Value;
    2.59 +	public:
    2.60 +		WifiMeshMultihopActionHeader ();
    2.61 +		~WifiMeshMultihopActionHeader ();
    2.62 +		enum CategoryValue //table 7-24 staring from 4
    2.63 +		{
    2.64 +			MESH_PEER_LINK_MGT =4,
    2.65 +			MESH_LINK_METRIC,
    2.66 +			MESH_PATH_SELECTION,
    2.67 +			MESH_INTERWORK_ACTION,
    2.68 +			MESH_RESOURCE_COORDINATION,
    2.69 +		};
    2.70 +		enum PeerLinkMgtActionValue
    2.71 +		{
    2.72 +			PEER_LINK_OPEN = 0,
    2.73 +			PEER_LINK_CONFIRM,
    2.74 +			PEER_LINK_CLOSE,
    2.75 +		};
    2.76 +		enum LinkMetricActionValue
    2.77 +		{
    2.78 +			LINK_METRIC_REQUEST = 0,
    2.79 +			LINK_METRIC_REPORT,
    2.80 +		};
    2.81 +		enum PathSelectionActionValue
    2.82 +		{
    2.83 +			PATH_REQUEST = 0,
    2.84 +			PATH_REPLY,
    2.85 +			PATH_ERROR,
    2.86 +			ROOT_ANNOUNCEMENT,
    2.87 +		};
    2.88 +		enum InterworkActionValue
    2.89 +		{
    2.90 +			PORTAL_ANNOUNCEMENT = 0,
    2.91 +		};
    2.92 +		enum ResourceCoordinationActionValue
    2.93 +		{
    2.94 +			CONGESTION_CONTROL_NOTIFICATION = 0,
    2.95 +			MDA_SETUP_REQUEST,
    2.96 +			MDA_SETUP_REPLY,
    2.97 +			MDAOP_ADVERTISMENT_REQUEST,
    2.98 +			MDAOP_ADVERTISMENTS,
    2.99 +			MDAOP_SET_TEARDOWN,
   2.100 +			BEACON_TIMING_REQUEST,
   2.101 +			BEACON_TIMING_RESPONSE,
   2.102 +			TBTT_ADJASTMENT_REQUEST,
   2.103 +			MESH_CHANNEL_SWITCH_ANNOUNCEMENT,
   2.104 +		};
   2.105 +		typedef union
   2.106 +		{
   2.107 +			enum PeerLinkMgtActionValue		peerLink;
   2.108 +			enum LinkMetricActionValue		linkMetrtic;
   2.109 +			enum PathSelectionActionValue		pathSelection;
   2.110 +			enum InterworkActionValue		interwork;
   2.111 +			enum ResourceCoordinationActionValue	resourceCoordination;
   2.112 +		} ACTION_VALUE;
   2.113 +		void			SetAction(enum CategoryValue type,ACTION_VALUE action);
   2.114 +		enum CategoryValue	GetCategory();
   2.115 +		ACTION_VALUE		GetAction();
   2.116 +		static TypeId		GetTypeId (void);
   2.117 +		virtual	TypeId		GetInstanceTypeId (void) const;
   2.118 +		virtual void		Print (std::ostream &os) const;
   2.119 +		virtual uint32_t	GetSerializedSize (void) const;
   2.120 +		virtual void		Serialize (Buffer::Iterator start) const;
   2.121 +		virtual uint32_t	Deserialize (Buffer::Iterator start);
   2.122 +	private:
   2.123 +		uint8_t	m_category;
   2.124 +		uint8_t	m_actionValue;
   2.125 +};
   2.126 +} // namespace ns3
   2.127 +#endif /* WIFI_MAC_HEADER_H */
     3.1 --- a/src/devices/wifi/mesh-wifi-mac.cc	Thu Mar 12 12:34:49 2009 +0300
     3.2 +++ b/src/devices/wifi/mesh-wifi-mac.cc	Thu Mar 12 13:02:29 2009 +0300
     3.3 @@ -30,6 +30,7 @@
     3.4  #include "mesh-wifi-mac.h"
     3.5  #include "dca-txop.h"
     3.6  #include "wifi-mac-header.h"
     3.7 +#include "mesh-wifi-mac-header.h"
     3.8  #include "mgt-headers.h"
     3.9  #include "wifi-phy.h"
    3.10  #include "dcf-manager.h"
     4.1 --- a/src/devices/wifi/wifi-mac-header.cc	Thu Mar 12 12:34:49 2009 +0300
     4.2 +++ b/src/devices/wifi/wifi-mac-header.cc	Thu Mar 12 13:02:29 2009 +0300
     4.3 @@ -980,338 +980,4 @@
     4.4    return i.GetDistanceFrom (start);
     4.5  }
     4.6  
     4.7 -/***********************************************************
     4.8 - * 	Here Mesh Mac Header functionality is defined.
     4.9 - ***********************************************************/
    4.10 -TypeId 
    4.11 -WifiMeshHeader::GetTypeId (void)
    4.12 -{
    4.13 -  static TypeId tid = TypeId ("ns3::WifiMeshHeader")
    4.14 -    .SetParent<Header> ()
    4.15 -    .AddConstructor<WifiMeshHeader> ()
    4.16 -    ;
    4.17 -  return tid;
    4.18 -}
    4.19 -
    4.20 -WifiMeshHeader::WifiMeshHeader()
    4.21 -{
    4.22 -	m_meshFlags = 0;
    4.23 -}
    4.24 -
    4.25 -WifiMeshHeader::~WifiMeshHeader()
    4.26 -{
    4.27 -}
    4.28 -
    4.29 -TypeId 
    4.30 -WifiMeshHeader::GetInstanceTypeId (void) const
    4.31 -{
    4.32 -  return GetTypeId ();
    4.33 -}
    4.34 -
    4.35 -void
    4.36 -WifiMeshHeader::SetAddr5 (Mac48Address address)
    4.37 -{
    4.38 -	m_addr5 = address;
    4.39 -}
    4.40 -
    4.41 -void
    4.42 -WifiMeshHeader::SetAddr6 (Mac48Address address)
    4.43 -{
    4.44 -	m_addr6 = address;
    4.45 -}
    4.46 -
    4.47 -void
    4.48 -WifiMeshHeader::SetAddr7 (Mac48Address address)
    4.49 -{
    4.50 -	m_addr7 = address;
    4.51 -}
    4.52 -
    4.53 -Mac48Address
    4.54 -WifiMeshHeader::GetAddr5 ()
    4.55 -{
    4.56 -	return m_addr5;
    4.57 -}
    4.58 -
    4.59 -Mac48Address
    4.60 -WifiMeshHeader::GetAddr6 ()
    4.61 -{
    4.62 -	return m_addr6;
    4.63 -}
    4.64 -
    4.65 -Mac48Address
    4.66 -WifiMeshHeader::GetAddr7 ()
    4.67 -{
    4.68 -	return m_addr7;
    4.69 -}
    4.70 -
    4.71 -void
    4.72 -WifiMeshHeader::SetMeshSeqno (uint32_t seqno)
    4.73 -{
    4.74 -	m_meshSeqno = seqno;
    4.75 -}
    4.76 -
    4.77 -uint32_t
    4.78 -WifiMeshHeader::GetMeshSeqno ()
    4.79 -{
    4.80 -	return m_meshSeqno;
    4.81 -}
    4.82 -
    4.83 -void
    4.84 -WifiMeshHeader::SetMeshTtl (uint8_t TTL)
    4.85 -{
    4.86 -	m_meshTtl = TTL;
    4.87 -}
    4.88 -
    4.89 -uint8_t
    4.90 -WifiMeshHeader::GetMeshTtl ()
    4.91 -{
    4.92 -	return m_meshTtl;
    4.93 -}
    4.94 -
    4.95 -void
    4.96 -WifiMeshHeader::SetAddressExt (uint8_t num_of_addresses)
    4.97 -{
    4.98 -	if (num_of_addresses > 3)
    4.99 -		return;
   4.100 -	m_meshFlags = 0xc0 | (num_of_addresses << 6);
   4.101 -}
   4.102 -
   4.103 -uint8_t
   4.104 -WifiMeshHeader::GetAddressExt ()
   4.105 -{
   4.106 -	return ((0xc0 & m_meshFlags) >> 6);
   4.107 -}
   4.108 -
   4.109 -
   4.110 -uint32_t
   4.111 -WifiMeshHeader::GetSerializedSize (void) const
   4.112 -{
   4.113 -	return 6 + ((0xc0 & m_meshFlags) >> 6)*6;
   4.114 -}
   4.115 -
   4.116 -void
   4.117 -WifiMeshHeader::Serialize (Buffer::Iterator start) const
   4.118 -{
   4.119 -	Buffer::Iterator i = start;
   4.120 -	i.WriteU8(m_meshFlags);
   4.121 -	i.WriteU8(m_meshTtl);
   4.122 -	i.WriteU32(m_meshSeqno);
   4.123 -	uint8_t addresses_to_add = (m_meshFlags & 0xc0) >> 6;
   4.124 -	//Writing Address extensions:
   4.125 -	if(addresses_to_add > 0)
   4.126 -		WriteTo (i, m_addr5);
   4.127 -	if(addresses_to_add > 1)
   4.128 -		WriteTo (i, m_addr6);
   4.129 -	if(addresses_to_add > 2)
   4.130 -		WriteTo (i, m_addr7);
   4.131 -}
   4.132 -
   4.133 -uint32_t
   4.134 -WifiMeshHeader::Deserialize (Buffer::Iterator start)
   4.135 -{
   4.136 -	Buffer::Iterator i = start;
   4.137 -	uint8_t addresses_to_read = 0;
   4.138 -	m_meshFlags = i.ReadU8();
   4.139 -	m_meshTtl = i.ReadU8();
   4.140 -	m_meshSeqno = i.ReadU32();
   4.141 -	addresses_to_read = (m_meshFlags & 0xc0) >> 6;
   4.142 -	if(addresses_to_read > 0)
   4.143 -		ReadFrom (i, m_addr5);
   4.144 -	if(addresses_to_read > 1)
   4.145 -		ReadFrom (i, m_addr6);
   4.146 -	if(addresses_to_read > 2)
   4.147 -		ReadFrom (i, m_addr7);
   4.148 -	return i.GetDistanceFrom(start);
   4.149 -}
   4.150 -void
   4.151 -WifiMeshHeader::Print (std::ostream &os) const
   4.152 -{
   4.153 -	os << "flags" << m_meshFlags
   4.154 -		<< "ttl" << m_meshTtl
   4.155 -		<< "seqno" << m_meshSeqno;
   4.156 -}
   4.157 -/**********************************************************
   4.158 - * 		MultihopActionFrame
   4.159 - **********************************************************/
   4.160 -WifiMeshMultihopActionHeader::WifiMeshMultihopActionHeader ()
   4.161 -{
   4.162 -}
   4.163 -
   4.164 -WifiMeshMultihopActionHeader::~WifiMeshMultihopActionHeader ()
   4.165 -{
   4.166 -}
   4.167 -
   4.168 -void
   4.169 -WifiMeshMultihopActionHeader::SetAction(
   4.170 -		enum WifiMeshMultihopActionHeader::CategoryValue type,
   4.171 -		WifiMeshMultihopActionHeader::ACTION_VALUE action)
   4.172 -{
   4.173 -	switch(type)
   4.174 -	{
   4.175 -		case MESH_PEER_LINK_MGT:
   4.176 -			m_category = 4;
   4.177 -			switch (action.peerLink)
   4.178 -			{
   4.179 -				case PEER_LINK_OPEN:
   4.180 -					m_actionValue = 0;
   4.181 -					break;
   4.182 -				case PEER_LINK_CONFIRM:
   4.183 -					m_actionValue = 1;
   4.184 -					break;
   4.185 -				case PEER_LINK_CLOSE:
   4.186 -					m_actionValue = 2;
   4.187 -					break;
   4.188 -			};
   4.189 -			break;
   4.190 -		case MESH_LINK_METRIC:
   4.191 -			m_category = 5;
   4.192 -			break;
   4.193 -		case MESH_PATH_SELECTION:
   4.194 -			m_category = 6;
   4.195 -			switch(action.pathSelection)
   4.196 -			{
   4.197 -				case PATH_REQUEST:
   4.198 -					m_actionValue = 0;
   4.199 -					break;
   4.200 -				case PATH_REPLY:
   4.201 -					m_actionValue = 1;
   4.202 -					break;
   4.203 -				case PATH_ERROR:
   4.204 -					m_actionValue = 2;
   4.205 -					break;
   4.206 -				case ROOT_ANNOUNCEMENT:
   4.207 -					m_actionValue = 3;
   4.208 -					break;
   4.209 -			};
   4.210 -			break;
   4.211 -		case MESH_INTERWORK_ACTION:
   4.212 -			m_category = 7;
   4.213 -			break;
   4.214 -		case MESH_RESOURCE_COORDINATION:
   4.215 -			m_category = 8;
   4.216 -			break;
   4.217 -	};
   4.218 -}
   4.219 -
   4.220 -enum WifiMeshMultihopActionHeader::CategoryValue
   4.221 -WifiMeshMultihopActionHeader::GetCategory()
   4.222 -{
   4.223 -	switch(m_category)
   4.224 -	{
   4.225 -		case 4:
   4.226 -			return MESH_PEER_LINK_MGT;
   4.227 -		case 5:
   4.228 -			return MESH_LINK_METRIC;
   4.229 -		case 6:
   4.230 -			return MESH_PATH_SELECTION;
   4.231 -		case 7:
   4.232 -			return MESH_INTERWORK_ACTION;
   4.233 -		case 8:
   4.234 -			return MESH_RESOURCE_COORDINATION;
   4.235 -		default:
   4.236 -			NS_ASSERT(false);
   4.237 -			return MESH_PEER_LINK_MGT;
   4.238 -	}
   4.239 -}
   4.240 -
   4.241 -WifiMeshMultihopActionHeader::ACTION_VALUE
   4.242 -WifiMeshMultihopActionHeader::GetAction()
   4.243 -{
   4.244 -	ACTION_VALUE retval;
   4.245 -	switch(m_category)
   4.246 -	{
   4.247 -		case 4:
   4.248 -			//MESH_PEER_LINK_MGT;
   4.249 -			switch(m_actionValue)
   4.250 -			{
   4.251 -				case 0:
   4.252 -					retval.peerLink = PEER_LINK_OPEN;
   4.253 -					return retval;
   4.254 -				case 1:
   4.255 -					retval.peerLink = PEER_LINK_CONFIRM;
   4.256 -					return retval;
   4.257 -				case 2:
   4.258 -					retval.peerLink = PEER_LINK_CLOSE;
   4.259 -					return retval;
   4.260 -				default:
   4.261 -					NS_ASSERT(false);
   4.262 -					return retval;
   4.263 -
   4.264 -			}
   4.265 -		case 5:
   4.266 -			//MESH_LINK_METRIC;
   4.267 -		case 6:
   4.268 -			//MESH_PATH_SELECTION;
   4.269 -			switch(m_actionValue)
   4.270 -			{
   4.271 -				case 0:
   4.272 -					retval.pathSelection = PATH_REQUEST;
   4.273 -					return retval;
   4.274 -				case 1:
   4.275 -					retval.pathSelection = PATH_REPLY;
   4.276 -					return retval;
   4.277 -				case 2:
   4.278 -					retval.pathSelection = PATH_ERROR;
   4.279 -					return retval;
   4.280 -				case 3:
   4.281 -					retval.pathSelection = ROOT_ANNOUNCEMENT;
   4.282 -					return retval;
   4.283 -				default:
   4.284 -					NS_ASSERT(false);
   4.285 -					return retval;
   4.286 -			}
   4.287 -
   4.288 -		case 7:
   4.289 -			//MESH_INTERWORK_ACTION;
   4.290 -		case 8:
   4.291 -			//MESH_RESOURCE_COORDINATION;
   4.292 -		default:
   4.293 -			NS_ASSERT(false);
   4.294 -			return retval;
   4.295 -	}
   4.296 -}
   4.297 -
   4.298 -TypeId
   4.299 -WifiMeshMultihopActionHeader::GetTypeId (void)
   4.300 -{
   4.301 -	static TypeId tid = TypeId ("ns3::WifiMeshMultihopActionHeader")
   4.302 -		.SetParent<Header> ()
   4.303 -		.AddConstructor<WifiMeshMultihopActionHeader> ()
   4.304 -		;
   4.305 -	return tid;
   4.306 -}
   4.307 -
   4.308 -TypeId
   4.309 -WifiMeshMultihopActionHeader::GetInstanceTypeId (void) const
   4.310 -{
   4.311 -	return GetTypeId();
   4.312 -}
   4.313 -
   4.314 -void
   4.315 -WifiMeshMultihopActionHeader::Print (std::ostream &os) const
   4.316 -{
   4.317 -}
   4.318 -
   4.319 -uint32_t
   4.320 -WifiMeshMultihopActionHeader::GetSerializedSize (void) const
   4.321 -{
   4.322 -	return 2;
   4.323 -}
   4.324 -
   4.325 -void
   4.326 -WifiMeshMultihopActionHeader::Serialize (Buffer::Iterator start) const
   4.327 -{
   4.328 -	start.WriteU8(m_category);
   4.329 -	start.WriteU8(m_actionValue);
   4.330 -}
   4.331 -
   4.332 -uint32_t
   4.333 -WifiMeshMultihopActionHeader::Deserialize (Buffer::Iterator start)
   4.334 -{
   4.335 -	Buffer::Iterator i = start;
   4.336 -	m_category = i.ReadU8();
   4.337 -	m_actionValue = i.ReadU8();
   4.338 -	return i.GetDistanceFrom(start);
   4.339 -}
   4.340 -
   4.341  } // namespace ns3
     5.1 --- a/src/devices/wifi/wifi-mac-header.h	Thu Mar 12 12:34:49 2009 +0300
     5.2 +++ b/src/devices/wifi/wifi-mac-header.h	Thu Mar 12 13:02:29 2009 +0300
     5.3 @@ -180,120 +180,5 @@
     5.4    uint8_t m_qosAckPolicy;
     5.5    uint16_t m_qosStuff;
     5.6  };
     5.7 -class WifiMeshHeader : public Header //7.1.3.5b
     5.8 -{
     5.9 -	public:
    5.10 -		WifiMeshHeader ();
    5.11 -		~WifiMeshHeader ();
    5.12 -		static TypeId GetTypeId (void);
    5.13 -		virtual TypeId GetInstanceTypeId (void) const;
    5.14 -		virtual void Print (std::ostream &os) const;
    5.15 -
    5.16 -		void			SetAddr5 (Mac48Address address);
    5.17 -		void			SetAddr6 (Mac48Address address);
    5.18 -		void			SetAddr7 (Mac48Address address);
    5.19 -		Mac48Address		GetAddr5 ();
    5.20 -		Mac48Address		GetAddr6 ();
    5.21 -		Mac48Address		GetAddr7 ();
    5.22 -
    5.23 -		void			SetMeshSeqno (uint32_t seqno);
    5.24 -		uint32_t		GetMeshSeqno ();
    5.25 -
    5.26 -		void			SetMeshTtl (uint8_t TTL);
    5.27 -		uint8_t		GetMeshTtl ();
    5.28 -
    5.29 -		void			SetAddressExt (uint8_t num_of_addresses);
    5.30 -		uint8_t		GetAddressExt ();
    5.31 -
    5.32 -		virtual uint32_t	GetSerializedSize (void) const;
    5.33 -		virtual void		Serialize (Buffer::Iterator start) const;
    5.34 -		virtual uint32_t	Deserialize (Buffer::Iterator start);
    5.35 -	private:
    5.36 -		uint8_t	m_meshFlags;
    5.37 -		uint8_t	m_meshTtl;
    5.38 -		uint32_t	m_meshSeqno;
    5.39 -		Mac48Address	m_addr5;
    5.40 -		Mac48Address	m_addr6;
    5.41 -		Mac48Address	m_addr7;
    5.42 -};
    5.43 -class WifiMeshMultihopActionHeader : public Header //7.2.3.14
    5.44 -{
    5.45 -	//Multichop action frame consists of Mesh header, Action, and
    5.46 -	//the last information. Mesh header is present within all data
    5.47 -	//frames and multihop action frames, so Mesh header is a
    5.48 -	//separate structure. Each MultihopAction frames (frames like
    5.49 -	//PREQ, PREP and other) start form Category field and Action
    5.50 -	//value field, so the Multihop Action Frame should containt
    5.51 -	//three fields: Category, Action Value;
    5.52 -	public:
    5.53 -		WifiMeshMultihopActionHeader ();
    5.54 -		~WifiMeshMultihopActionHeader ();
    5.55 -		enum CategoryValue //table 7-24 staring from 4
    5.56 -		{
    5.57 -			MESH_PEER_LINK_MGT =4,
    5.58 -			MESH_LINK_METRIC,
    5.59 -			MESH_PATH_SELECTION,
    5.60 -			MESH_INTERWORK_ACTION,
    5.61 -			MESH_RESOURCE_COORDINATION,
    5.62 -		};
    5.63 -		enum PeerLinkMgtActionValue
    5.64 -		{
    5.65 -			PEER_LINK_OPEN = 0,
    5.66 -			PEER_LINK_CONFIRM,
    5.67 -			PEER_LINK_CLOSE,
    5.68 -		};
    5.69 -		enum LinkMetricActionValue
    5.70 -		{
    5.71 -			LINK_METRIC_REQUEST = 0,
    5.72 -			LINK_METRIC_REPORT,
    5.73 -		};
    5.74 -		enum PathSelectionActionValue
    5.75 -		{
    5.76 -			PATH_REQUEST = 0,
    5.77 -			PATH_REPLY,
    5.78 -			PATH_ERROR,
    5.79 -			ROOT_ANNOUNCEMENT,
    5.80 -		};
    5.81 -		enum InterworkActionValue
    5.82 -		{
    5.83 -			PORTAL_ANNOUNCEMENT = 0,
    5.84 -		};
    5.85 -		enum ResourceCoordinationActionValue
    5.86 -		{
    5.87 -			CONGESTION_CONTROL_NOTIFICATION = 0,
    5.88 -			MDA_SETUP_REQUEST,
    5.89 -			MDA_SETUP_REPLY,
    5.90 -			MDAOP_ADVERTISMENT_REQUEST,
    5.91 -			MDAOP_ADVERTISMENTS,
    5.92 -			MDAOP_SET_TEARDOWN,
    5.93 -			BEACON_TIMING_REQUEST,
    5.94 -			BEACON_TIMING_RESPONSE,
    5.95 -			TBTT_ADJASTMENT_REQUEST,
    5.96 -			MESH_CHANNEL_SWITCH_ANNOUNCEMENT,
    5.97 -		};
    5.98 -		typedef union
    5.99 -		{
   5.100 -			enum PeerLinkMgtActionValue		peerLink;
   5.101 -			enum LinkMetricActionValue		linkMetrtic;
   5.102 -			enum PathSelectionActionValue		pathSelection;
   5.103 -			enum InterworkActionValue		interwork;
   5.104 -			enum ResourceCoordinationActionValue	resourceCoordination;
   5.105 -		} ACTION_VALUE;
   5.106 -		void			SetAction(enum CategoryValue type,ACTION_VALUE action);
   5.107 -		enum CategoryValue	GetCategory();
   5.108 -		ACTION_VALUE		GetAction();
   5.109 -		static TypeId		GetTypeId (void);
   5.110 -		virtual	TypeId		GetInstanceTypeId (void) const;
   5.111 -		virtual void		Print (std::ostream &os) const;
   5.112 -		virtual uint32_t	GetSerializedSize (void) const;
   5.113 -		virtual void		Serialize (Buffer::Iterator start) const;
   5.114 -		virtual uint32_t	Deserialize (Buffer::Iterator start);
   5.115 -	private:
   5.116 -		uint8_t	m_category;
   5.117 -		uint8_t	m_actionValue;
   5.118 -};
   5.119  } // namespace ns3
   5.120 -
   5.121 -
   5.122 -
   5.123  #endif /* WIFI_MAC_HEADER_H */
     6.1 --- a/src/devices/wifi/wscript	Thu Mar 12 12:34:49 2009 +0300
     6.2 +++ b/src/devices/wifi/wscript	Thu Mar 12 13:02:29 2009 +0300
     6.3 @@ -18,6 +18,7 @@
     6.4          'yans-wifi-phy.cc',
     6.5          'yans-wifi-channel.cc',
     6.6          'wifi-mac-header.cc',
     6.7 +        'mesh-wifi-mac-header.cc',
     6.8          'wifi-mac-trailer.cc',
     6.9          'mac-low.cc',
    6.10          'wifi-mac-queue.cc',