/* olsr_pkt_support.h */
/* Data Structures used for the packet fields	*/
/* used in the OLSR Hello and TC Messages		*/

/****************************************/
/*      Copyright (c) 2004-2010         */
/*     by OPNET Technologies, Inc.      */
/*      (A Delaware Corporation)        */
/*   7255 Woodmont Av., Suite 250       */
/*     Bethesda, MD 20814, U.S.A.       */
/*       All Rights Reserved.           */
/****************************************/

/* Protect against multiple includes. 	*/
#ifndef	_OLSR_PKT_SUPPORT_H_INCLUDED_
#define _OLSR_PKT_SUPPORT_H_INCLUDED_

#include <ip_addr_v4.h>
#include <ip_rte_v4.h>

EXTERN_C_BEGIN

/********* CONSTANTS ***********/

/* Message Types */
#define OLSRC_HELLO_MESSAGE				1
#define OLSRC_TC_MESSAGE				2
#define OLSRC_MID_MESSAGE				3
#define OLSRC_HNA_MESSAGE				4

/* Link Types */
#define OLSRC_UNSPECIFIED_LINK			0
#define OLSRC_ASYMMETRIC_LINK			1
#define OLSRC_SYMMETRIC_LINK			2
#define OLSRC_LOST_LINK					3

/* Neighbor Types */
#define OLSRC_NOT_NEIGHBOR				0
#define OLSRC_SYM_NEIGHBOR				1
#define OLSRC_MPR_NEIGHBOR				2

/***** Data Strucutres	*****/

/* OLSR Message */
/* Contents of OLSR messages are shared between copies of a packet.	*/
/* However the header is not shared as it can be modified by each	*/
/* node. Header is represented by OlsrT_Message DS.					*/ 
typedef struct {
	OpT_uInt8			message_type;
	OpT_uInt8			vtime;			/* Valid time */
	OpT_uInt16			message_size;
	int					originator_addr;
	OpT_uInt8			ttl;
	OpT_uInt8			hop_count;
	OpT_uInt16			message_seq_num;
	Boolean				is_ipv6; 
	void*				message;
	} OlsrT_Message;

/* MID Message */
typedef struct
	{
#if defined (OPD_PARALLEL)
	PrgT_Mt_Spinlock	ref_count_lock;
#endif
	int					ref_count; 	     /* memory-sharing counter  */
	PrgT_Vector*		intf_addr_vptr;  /* List of interfaces */
	
	} OlsrT_MID_Message;

/* Hello Message*/
typedef struct
	{
#if defined (OPD_PARALLEL)
	PrgT_Mt_Spinlock	ref_count_lock;
#endif
	int					ref_count; 			/* memory-sharing counter  */
	OpT_uInt16			reserved;
	OpT_uInt8			htime; 			    /* Hello Emission Interval */
	OpT_uInt8			willingness;
	
	
	OpT_uInt16			potfaydata;		     /*nova hodnota*/
	double			    rychlost;		       /*rychlost*/




	PrgT_Vector*		hello_msg_vptr;     /* List of all hello mesgs */
	} OlsrT_Hello_Message;

/* Data stored in hello message depending upon linkcode */
typedef struct
	{
	OpT_uInt8 			linkcode;
	OpT_uInt8			reserved;
	OpT_uInt16			link_msg_size;
	PrgT_Vector*		nbr_intf_addr_vptr; /* List of neighbor interfaces of */
	} OlsrT_Hello_Message_Data;			    /* categorized by link code.      */		

/* TC Message */
typedef struct
	{
#if defined (OPD_PARALLEL)
	PrgT_Mt_Spinlock	ref_count_lock;
#endif
	int					ref_count;    		/* memory-sharing counter		*/
	OpT_uInt16			tc_seq_num;
	OpT_uInt16			reserved;
	PrgT_Vector*		mpr_nodes_vptr;		/* List of mpr selectors for TC */
	} OlsrT_TC_Message;

EXTERN_C_END

#endif 		/* 	_OLSR_PKT_SUPPORT_H_INCLUDED_	*/
