olsr-header.h.tar.gz

  • test12bm12
    了解作者
  • C/C++
    开发工具
  • 3KB
    文件大小
  • gz
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 1
    下载次数
  • 2018-02-15 07:44
    上传日期
this is olsr header.h
olsr-header.h.tar.gz
  • olsr-header.h
    20.7KB
内容介绍
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2007 INESC Porto * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> */ #ifndef OLSR_HEADER_H #define OLSR_HEADER_H #include <stdint.h> #include <vector> #include "ns3/header.h" #include "ns3/ipv4-address.h" #include "ns3/nstime.h" namespace ns3 { namespace olsr { double EmfToSeconds (uint8_t emf); uint8_t SecondsToEmf (double seconds); /** * \ingroup olsr * * The basic layout of any packet in OLSR is as follows (omitting IP and * UDP headers): \verbatim 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Packet Length | Packet Sequence Number | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Message Type | Vtime | Message Size | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Originator Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Time To Live | Hop Count | Message Sequence Number | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | : MESSAGE : | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Message Type | Vtime | Message Size | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Originator Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Time To Live | Hop Count | Message Sequence Number | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | : MESSAGE : | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ : : (etc.) \endverbatim * * This header only holds the common part of a message group, i.e., * the first 4 bytes. */ class PacketHeader : public Header { public: PacketHeader (); virtual ~PacketHeader (); /** * Set the packet total length. * \param length The packet length. */ void SetPacketLength (uint16_t length) { m_packetLength = length; } /** * Get the packet total length. * \return The packet length. */ uint16_t GetPacketLength () const { return m_packetLength; } /** * Set the packet sequence number. * \param seqnum The packet sequence number. */ void SetPacketSequenceNumber (uint16_t seqnum) { m_packetSequenceNumber = seqnum; } /** * Get the packet sequence number. * \returns The packet sequence number. */ uint16_t GetPacketSequenceNumber () const { return m_packetSequenceNumber; } private: uint16_t m_packetLength; //!< The packet length. uint16_t m_packetSequenceNumber; //!< The packet sequence number. public: /** * \brief Get the type ID. * \return The object TypeId. */ static TypeId GetTypeId (void); virtual TypeId GetInstanceTypeId (void) const; virtual void Print (std::ostream &os) const; virtual uint32_t GetSerializedSize (void) const; virtual void Serialize (Buffer::Iterator start) const; virtual uint32_t Deserialize (Buffer::Iterator start); }; /** * \ingroup olsr * * This header can store HELP, TC, MID and HNA messages. * The header size is variable, and depends on the * actual message type. * \verbatim 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Message Type | Vtime | Message Size | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Originator Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Time To Live | Hop Count | Message Sequence Number | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | : MESSAGE : | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \endverbatim */ class MessageHeader : public Header { public: /** * Message type */ enum MessageType { HELLO_MESSAGE = 1, TC_MESSAGE = 2, MID_MESSAGE = 3, HNA_MESSAGE = 4, }; MessageHeader (); virtual ~MessageHeader (); /** * Set the message type. * \param messageType The message type. */ void SetMessageType (MessageType messageType) { m_messageType = messageType; } /** * Get the message type. * \return The message type. */ MessageType GetMessageType () const { return m_messageType; } /** * Set the validity time. * \param time The validity time. */ void SetVTime (Time time) { m_vTime = SecondsToEmf (time.GetSeconds ()); } /** * Get the validity time. * \return The validity time. */ Time GetVTime () const { return Seconds (EmfToSeconds (m_vTime)); } /** * Set the originator address. * \param originatorAddress The originator address. */ void SetOriginatorAddress (Ipv4Address originatorAddress) { m_originatorAddress = originatorAddress; } /** * Get the originator address. * \return The originator address. */ Ipv4Address GetOriginatorAddress () const { return m_originatorAddress; } /** * Set the time to live. * \param timeToLive The time to live. */ void SetTimeToLive (uint8_t timeToLive) { m_timeToLive = timeToLive; } /** * Get the time to live. * \return The time to live. */ uint8_t GetTimeToLive () const { return m_timeToLive; } /** * Set the hop count. * \param hopCount The hop count. */ void SetHopCount (uint8_t hopCount) { m_hopCount = hopCount; } /** * Get the hop count. * \return The hop count. */ uint8_t GetHopCount () const { return m_hopCount; } /** * Set the message sequence number. * \param messageSequenceNumber The message sequence number. */ void SetMessageSequenceNumber (uint16_t messageSequenceNumber) { m_messageSequenceNumber = messageSequenceNumber; } /** * Get the message sequence number. * \return The message sequence number. */ uint16_t GetMessageSequenceNumber () const { return m_messageSequenceNumber; } private: MessageType m_messageType; //!< The message type uint8_t m_vTime; //!< The validity time. Ipv4Address m_originatorAddress; //!< The originator address. uint8_t m_timeToLive; //!< The t
评论
    相关推荐
    • olsr-header.cc.tar.gz
      this is a header of olsr
    • OLSR_graphs.zip
      OLSR graphs for all the parameters
    • OLSR SNMP Agent Plugin-开源
      这是用于OLSRD的OLSR SNMP插件(由www.olsr.org提供)。 它实现了一个AgentX子代理,该代理提供了收集和修改OLSR协议的主要参数的能力。 它使用来自www.net-snmp.org项目的编程库。
    • Windows Mobile OLSR Daemon-开源
      它是由Moviquity创建的,基于Workpad项目中的研究,它提供了C#代码以部署带有协议OLSR的MANET(Ad-Hoc,Meshnet)。 为WM 6,Win XP开发,并且可以使用NET Framework和Compact适应其他平台
    • OLSR源代码
      最新版的OLSR源代码,可以在linux上进行安装。
    • olsr.org-开源
      olsrd是优化链接状态路由(OLSR,RFC3626)协议的实现。 该实现可通过使用可加载插件来扩展。 有关更多信息,请访问http://www.olsr.org。 这个sf.net页面已经过时了! 请访问www.olsr.or
    • OLSR路由协议实现代码
      代码包括OLSR协议的C++代码实现,以及OLSRD的实现,其实就是你们搜到的olsrd协议实现程序或者olsrd-0.5.6-r4.rar。
    • OLSR_MPR.192.zip
      Code to simulate OLSR using NS2
    • OLSR.rar
      Please contact your service provider for more details
    • NS2example.rar
      在ns2下实现无线传感器网络仿真,多个节点进行网络活动