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

📄 dsr_support.ex.c

📁 opnet11.5 manet dsr和aodv协议
💻 C
📖 第 1 页 / 共 3 页
字号:
		stat_handles_registered = OPC_TRUE;		}		FRET (stat_handle_ptr);	}void*dsr_array_elements_add (void* array, int count, int add_count, int elem_size)	{	void*		new_array;	/** This procedure allocates a new array of elements of	**/	/** the specified size and copies the elements of the	**/	/** original array into the new array.  The old array	**/	/** is deallocated and the new array is returned.		**/	FIN (dsr_array_elements_add (<args>));	/* Allocate the array. If this fails, the called 	*/	/* procedure will handle the error.					*/	new_array = op_prg_mem_alloc ((count + add_count) * elem_size);	/* If there were any elements previously, copy 		*/	/* them into the new array.							*/	if (count != 0)		{		/* Copy the old array into the new array. */		op_prg_mem_copy (array, new_array, count * elem_size);		/* Deallocate the old array. */		op_prg_mem_free (array);		}	/* Return the new array pointer. */	FRET (new_array);	}voiddsr_support_routing_traffic_sent_stats_update (DsrT_Stathandles* stat_handle_ptr, DsrT_Global_Stathandles* global_stathandle_ptr, Packet* pkptr)	{	OpT_Packet_Size			pkt_size;		/** Updates the routing traffic sent statistics	**/	/** in both bits/sec and pkts/sec				**/	FIN (dsr_support_routing_traffic_sent_stats_update (<args>));		/* Get the size of the packet	*/	pkt_size = op_pk_total_size_get (pkptr);		/* Update the local routing traffic sent stat in bps 	*/	op_stat_write (stat_handle_ptr->rte_traf_sent_bps_shandle, pkt_size);	op_stat_write (stat_handle_ptr->rte_traf_sent_bps_shandle, 0.0);		/* Update the local routing traffic sent stat in pps 	*/	op_stat_write (stat_handle_ptr->rte_traf_sent_pps_shandle, 1.0);	op_stat_write (stat_handle_ptr->rte_traf_sent_pps_shandle, 0.0);		/* Update the global routing traffic sent stat in bps 	*/	op_stat_write (global_stathandle_ptr->rte_traf_sent_bps_global_shandle, pkt_size);	op_stat_write (global_stathandle_ptr->rte_traf_sent_bps_global_shandle, 0.0);		/* Update the global routing traffic sent stat in pps 	*/	op_stat_write (global_stathandle_ptr->rte_traf_sent_pps_global_shandle, 1.0);	op_stat_write (global_stathandle_ptr->rte_traf_sent_pps_global_shandle, 0.0);		FOUT;	}voiddsr_support_routing_traffic_received_stats_update (DsrT_Stathandles* stat_handle_ptr, DsrT_Global_Stathandles* global_stathandle_ptr, Packet* pkptr)	{	OpT_Packet_Size			pkt_size;		/** Updates the routing traffic sent statistics	**/	/** in both bits/sec and pkts/sec				**/	FIN (dsr_support_routing_traffic_received_stats_update (<args>));		/* Get the size of the packet	*/	pkt_size = op_pk_total_size_get (pkptr);		/* Update the local routing traffic sent stat in bps 	*/	op_stat_write (stat_handle_ptr->rte_traf_rcvd_bps_shandle, pkt_size);	op_stat_write (stat_handle_ptr->rte_traf_rcvd_bps_shandle, 0.0);		/* Update the local routing traffic sent stat in pps 	*/	op_stat_write (stat_handle_ptr->rte_traf_rcvd_pps_shandle, 1.0);	op_stat_write (stat_handle_ptr->rte_traf_rcvd_pps_shandle, 0.0);		/* Update the global routing traffic sent stat in bps 	*/	op_stat_write (global_stathandle_ptr->rte_traf_rcvd_bps_global_shandle, pkt_size);	op_stat_write (global_stathandle_ptr->rte_traf_rcvd_bps_global_shandle, 0.0);		/* Update the global routing traffic sent stat in pps 	*/	op_stat_write (global_stathandle_ptr->rte_traf_rcvd_pps_global_shandle, 1.0);	op_stat_write (global_stathandle_ptr->rte_traf_rcvd_pps_global_shandle, 0.0);		FOUT;	}voiddsr_support_total_traffic_sent_stats_update (DsrT_Stathandles* stat_handle_ptr, DsrT_Global_Stathandles* global_stathandle_ptr, Packet* pkptr)	{	OpT_Packet_Size			pkt_size;		/** Updates the routing traffic sent statistics	**/	/** in both bits/sec and pkts/sec				**/	FIN (dsr_support_total_traffic_sent_stats_update (<args>));		/* Get the size of the packet	*/	pkt_size = op_pk_total_size_get (pkptr);		/* Update the local routing traffic sent stat in bps 	*/	op_stat_write (stat_handle_ptr->total_traf_sent_bps_shandle, pkt_size);	op_stat_write (stat_handle_ptr->total_traf_sent_bps_shandle, 0.0);		/* Update the local routing traffic sent stat in pps 	*/	op_stat_write (stat_handle_ptr->total_traf_sent_pps_shandle, 1.0);	op_stat_write (stat_handle_ptr->total_traf_sent_pps_shandle, 0.0);		/* Update the global routing traffic sent stat in bps 	*/	op_stat_write (global_stathandle_ptr->total_traf_sent_bps_global_shandle, pkt_size);	op_stat_write (global_stathandle_ptr->total_traf_sent_bps_global_shandle, 0.0);		/* Update the global routing traffic sent stat in pps 	*/	op_stat_write (global_stathandle_ptr->total_traf_sent_pps_global_shandle, 1.0);	op_stat_write (global_stathandle_ptr->total_traf_sent_pps_global_shandle, 0.0);		FOUT;	}voiddsr_support_total_traffic_received_stats_update (DsrT_Stathandles* stat_handle_ptr, DsrT_Global_Stathandles* global_stathandle_ptr, Packet* pkptr)	{	OpT_Packet_Size			pkt_size;		/** Updates the routing traffic sent statistics	**/	/** in both bits/sec and pkts/sec				**/	FIN (dsr_support_total_traffic_received_stats_update (<args>));		/* Get the size of the packet	*/	pkt_size = op_pk_total_size_get (pkptr);		/* Update the local routing traffic sent stat in bps 	*/	op_stat_write (stat_handle_ptr->total_traf_rcvd_bps_shandle, pkt_size);	op_stat_write (stat_handle_ptr->total_traf_rcvd_bps_shandle, 0.0);		/* Update the local routing traffic sent stat in pps 	*/	op_stat_write (stat_handle_ptr->total_traf_rcvd_pps_shandle, 1.0);	op_stat_write (stat_handle_ptr->total_traf_rcvd_pps_shandle, 0.0);		/* Update the global routing traffic sent stat in bps 	*/	op_stat_write (global_stathandle_ptr->total_traf_rcvd_bps_global_shandle, pkt_size);	op_stat_write (global_stathandle_ptr->total_traf_rcvd_bps_global_shandle, 0.0);		/* Update the global routing traffic sent stat in pps 	*/	op_stat_write (global_stathandle_ptr->total_traf_rcvd_pps_global_shandle, 1.0);	op_stat_write (global_stathandle_ptr->total_traf_rcvd_pps_global_shandle, 0.0);		FOUT;	}voiddsr_support_route_request_sent_stats_update (DsrT_Stathandles* stat_handle_ptr, DsrT_Global_Stathandles* global_stathandle_ptr, 											Boolean non_prop_route_request)	{	/** Update the statistics associated with route requests	**/	FIN (dsr_support_route_request_sent_stats_update (<args>));		/* Based on whether the request is a propagating	*/	/* or non-propagating request, update the			*/	/* appropriate statistic							*/	if (non_prop_route_request)		{		/* Update the statistic for non-propagating	*/		/* route request both locally and globally	*/		op_stat_write (stat_handle_ptr->total_non_prop_requests_sent_shandle, 1.0);		op_stat_write (global_stathandle_ptr->total_non_prop_requests_sent_global_shandle, 1.0);		}	else		{		/* Update the statistic for propagating		*/		/* route request both locally and globally	*/		op_stat_write (stat_handle_ptr->total_prop_requests_sent_shandle, 1.0);		op_stat_write (global_stathandle_ptr->total_prop_requests_sent_global_shandle, 1.0);		}			/* Update the statistics for the total number of	*/	/* requests sent both locally and globally			*/	op_stat_write (stat_handle_ptr->total_requests_sent_shandle, 1.0);	op_stat_write (global_stathandle_ptr->total_requests_sent_global_shandle, 1.0);		FOUT;	}	voiddsr_support_route_reply_sent_stats_update (DsrT_Stathandles* stat_handle_ptr, DsrT_Global_Stathandles* global_stathandle_ptr, 												Boolean cached_route_reply)	{	/** Updates the statistics related to the route replies sent	**/	FIN (dsr_support_route_reply_sent_stats_update (<args>));		/* Based on whether the route reply is a 	*/	/* cached route reply or a route reply from	*/	/* the destination, update the statistic	*/	if (cached_route_reply)		{		/* Update the statistic for the total	*/		/* number of cached route replies sent	*/		/* both locally and globally			*/		op_stat_write (stat_handle_ptr->total_cached_replies_sent_shandle, 1.0);		op_stat_write (global_stathandle_ptr->total_cached_replies_sent_global_shandle, 1.0);		}	else		{		/* Update the statistic for the total	*/		/* number of route replies sent from 	*/		/* the destination both local and global*/		op_stat_write (stat_handle_ptr->total_replies_sent_from_dest_shandle, 1.0);		op_stat_write (global_stathandle_ptr->total_replies_sent_from_dest_global_shandle, 1.0);		}		/* Update the statistic for the total number of	*/	/* route replies sent both locally and globally	*/	op_stat_write (stat_handle_ptr->total_replies_sent_shandle, 1.0);	op_stat_write (global_stathandle_ptr->total_replies_sent_global_shandle, 1.0);		FOUT;	}voiddsr_support_maintenace_stats_update (DsrT_Stathandles* stat_handle_ptr, DsrT_Global_Stathandles* global_stathandle_ptr, 									Boolean ack_request)	{	/** Updates the maintenance related statistics	**/	FIN (dsr_support_maintenace_stats_update (<args>));		/* Based on whether it is a acknowledgement	*/	/* request or an acknowledgement, update 	*/	/* appropriate statistics					*/	if (ack_request)		{		/* Update the statistics for the total	*/		/* number of acknowledgement requests	*/		/* sent both locally and globally		*/		op_stat_write (stat_handle_ptr->total_ack_requests_sent_shandle, 1.0);		op_stat_write (global_stathandle_ptr->total_ack_requests_sent_global_shandle, 1.0);		}	else		{		/* Update the statistics for the total	*/		/* number of acknowledgementssent both	*/		/* locally and globally					*/		op_stat_write (stat_handle_ptr->total_acks_sent_shandle, 1.0);		op_stat_write (global_stathandle_ptr->total_acks_sent_global_shandle, 1.0);		}		FOUT;	}voiddsr_support_route_error_stats_update (DsrT_Stathandles* stat_handle_ptr, DsrT_Global_Stathandles* global_stathandle_ptr)	{	/** Update the statistic for the total number	**/	/** of route error packets sent 			    **/	FIN (dsr_support_route_error_stats_update (<args>));		op_stat_write (stat_handle_ptr->total_route_errors_sent_shandle, 1.0);	op_stat_write (global_stathandle_ptr->total_route_errors_sent_global_shandle, 1.0);		FOUT;	}voiddsr_support_packets_salvaged_stats_update (DsrT_Stathandles* stat_handle_ptr, DsrT_Global_Stathandles* global_stathandle_ptr)	{	/** Update the statistic for the total number	**/	/** of packets salvaged			   			 	**/	FIN (dsr_support_packets_salvaged_stats_update (<args>));		op_stat_write (stat_handle_ptr->total_pkts_salvaged_shandle, 1.0);	op_stat_write (global_stathandle_ptr->total_pkts_salvaged_global_shandle, 1.0);		FOUT;	}

⌨️ 快捷键说明

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