⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bcast_packet.h

📁 code that can compile NS-2.27 on Fedora Core 4
💻 H
字号:
/******************************************************************* Copyright (C) 2004 Thomas Kunz, CRC Canada, BCAST for IPv4. DISTRIBUTED WITH NO WARRANTY, EXPRESS OR IMPLIED. See the GNU Library General Public License (file COPYING in the MANET_multicast directory) for conditions of use and redistribution.*********************************************************************//*Copyright (c) 1997, 1998 Carnegie Mellon University.  All RightsReserved. Permission to use, copy, modify, and distribute thissoftware and its documentation is hereby granted (including forcommercial or for-profit use), provided that both the copyright notice and this permission notice appear in all copies of the software, derivative works, or modified versions, and any portions thereof, and that both notices appear in supporting documentation, and that credit is given to Carnegie Mellon University in all publications reporting on direct or indirect use of this code or its derivatives.ALL CODE, SOFTWARE, PROTOCOLS, AND ARCHITECTURES DEVELOPED BY THE CMUMONARCH PROJECT ARE EXPERIMENTAL AND ARE KNOWN TO HAVE BUGS, SOME OFWHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON PROVIDES THISSOFTWARE OR OTHER INTELLECTUAL PROPERTY IN ITS ``AS IS'' CONDITION,AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULARPURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITYBE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, ORCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OFSUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; ORBUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCEOR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE ORINTELLECTUAL PROPERTY, EVEN IF ADVISED OF THE POSSIBILITY OF SUCHDAMAGE.Carnegie Mellon encourages (but does not require) users of thissoftware or intellectual property to return any improvements orextensions that they make, and to grant Carnegie Mellon the rights to redistribute these changes without encumbrance.The AODV code developed by the CMU/MONARCH group was optimized and tuned by Samir Das and Mahesh Marina, University of Cincinnati. The work was partially done in Sun Microsystems.*//*  * The original AODV code was modified to support efficient broadcasting * (BCAST) by Thomas Kunz. */#ifndef __bcast_packet_h__#define __bcast_packet_h__// #define RELIABLE	// enables RELIABLE BCAST// #define PIGGYBACK_HELLO	// allows us to piggyback HELLO onto data#define NEIGHBOR_COUNT 50 // assume we have at most NEIGHBOR_COUNT neighbors#include "bcast.h"/* =====================================================================   Packet Formats...   ===================================================================== */#define BCASTTYPE_HELLO  	0x01#define BCASTTYPE_DATA		0x02#define BCASTTYPE_NACK		0x03/* * BCAST Routing Protocol Header Macros */#define HDR_BCAST(p)	     ((struct hdr_bcast*)hdr_bcast::access(p))/* * BCAST Header */struct hdr_bcast {        u_int8_t        type;	packet_t	old_type;        u_int8_t        reserved[2];        u_int8_t        hop_count;           // Hop Count        nsaddr_t        dst;                 // Destination IP Address	u_int32_t	dst_seqno;	     // Destination Sequence Number        nsaddr_t        src;                 // Source IP Address	// When asking for retransmission, we ask for retransmission of a packet	// identified by SRC and SEQNO	u_int32_t	src_seqno;           // Source Sequence Number        double	        lifetime;            // Lifetime	int		no_of_neighbors;	 // how many neighbors	nsaddr_t	neighbors[NEIGHBOR_COUNT];// one-hop neighborhood	// Header access methods	static int offset_; // required by PacketHeaderManager	inline static int& offset() { return offset_; }	inline static hdr_bcast* access(const Packet* p) {	        return (hdr_bcast*) p->access(offset_);	}};#define BCAST_HDR_LEN sizeof(hdr_bcast)#endif /* __bcast_packet_h__ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -