arzmq-sys 0.5.4

Low-level bindings to the zeromq library
Documentation
MIL_3_Tfile_Hdr_ 120A 107A modeler 9 44284205 464DEF85 AB wn12jh Jim@Hauser 0 0 none none 0 0 none 7A19CC4A 95E4 0 0 0 0 0 0 10de 3                                                                                                                                                                                                                                                                                                                                                                                            ��g�@
M
Q�l��a�e���V�����l�
NORMstart�����������client��������NORMopenStream�����������1024000��������
NORMdebug�����������������������NORMlog�����������������������
NORMtrace�����������������������NORMtxloss�����������0.0��������NORMrxloss�����������0.0��������NORMaddress�����������
224.1.1.1/699��������NORMttl�����������32��������	NORMrate�����������320000��������NORMcc�����������������������NORMbackoff�����������������������
NORMinterval�����������0.0��������NORMrepeat�����������-1��������NORMsegment�����������������������
NORMblock�����������1��������NORMparity�����������0��������	NORMauto�����������������������
NORMextra�����������������������
NORMgsize�����������������������	NORMgrtt�����������������������
NORMtxbuffer�����������������������
NORMrxbuffer�����������100000��������
NORMsendFile�����������������������NORMsendRandomFile�����������������������NORMsendStream�����������������������	NORMpush�����������������������
NORMflush�����������������������NORMunicastNacks�����������������������NORMsilentClient�����������������������	
begsim intrpt
����
doc file	nd_module
endsim intrpt����failure intrptsdisabledintrpt intervalԲI�%��}����priority����recovery intrptsdisabledsubqueue
count���
����
list	���


super priority����
begsim intrpt
begsim intrpt��������������������`OpnetNormProcess	\norm_proc;
Objid	\my_id;Objid	\my_node_id;Objid	\my_pro_id;Objid	\my_udp_id;Objid	\my_tcp_id;Objid	\my_mgen_id;IpT_Address	\my_ip_addr;IpT_Address	\my_ip_mask;Prohandle	\own_prohandle;*OmsT_Pr_Handle	\own_process_record_handle;char	\pid_string [512];char	\node_name [40];ProtoTimerMgr	\timer;ProtoSocket*	\udpsocket;ProtoSocket*	\tcpsocket;$ProtoSocket::Notifier*	\udpnotifier;$ProtoSocket::Notifier*	\tcpnotifier;ProtoAddress	\host_ipv4_addr;!Stathandle	\bits_rcvd_stathandle;7Stathandle	\bitssec_rcvd_flow_stathandle[MAXSTATFLOWS];7Stathandle	\bitssec_sent_flow_stathandle[MAXSTATFLOWS];$Stathandle	\bitssec_rcvd_stathandle;!Stathandle	\pkts_rcvd_stathandle;7Stathandle	\pktssec_rcvd_flow_stathandle[MAXSTATFLOWS];7Stathandle	\pktssec_sent_flow_stathandle[MAXSTATFLOWS];$Stathandle	\pktssec_rcvd_stathandle;!Stathandle	\bits_sent_stathandle;$Stathandle	\bitssec_sent_stathandle;!Stathandle	\pkts_sent_stathandle;$Stathandle	\pktssec_sent_stathandle;!Stathandle	\ete_delay_stathandle;4Stathandle	\ete_delay_flow_stathandle[MAXSTATFLOWS];"Stathandle	\bits_rcvd_gstathandle;%Stathandle	\bitssec_rcvd_gstathandle;"Stathandle	\pkts_rcvd_gstathandle;%Stathandle	\pktssec_rcvd_gstathandle;"Stathandle	\bits_sent_gstathandle;%Stathandle	\bitssec_sent_gstathandle;"Stathandle	\pkts_sent_gstathandle;%Stathandle	\pktssec_sent_gstathandle;"Stathandle	\ete_delay_gstathandle;int	\udp_outstream_index;int	\local_port;IpT_Address	\dest_ip_addr;FILE*	\script_fp;int	\source;Ici*	\app_ici_ptr;Packet*			data_pkptr;Ici*			ici_ptr;int				intrpt_type;int				intrpt_strm;int				intrpt_code;int				pk_size;InetT_Address*	rem_addr_ptr;InetT_Address*	intf_addr_ptr;InetT_Address	temp_ip_addr;InetT_Address	intf_addr;int				type_of_service; int				inet_address_supported;IpT_Address		rem_ipv4_addr;IpT_Address		ipv4_intf_addr;UdpT_Port		rem_port;int				local_minor_port;int				conn_class;int				intf_num;#include <OpnetNormProcess.h>#include <oms_pr.h>#include <oms_tan.h>#include <udp_api.h>#include <ip_rte_v4.h>#include <ip_addr_v4.h>#include <mgenVersion.h>/* Define packet streams  */#define INSTRM_FROM_UDP		0#define INSTRM_FROM_MGEN	1#define OUTSTRM_TO_MGEN		12/*	Define a transition conditions              	*/4#define	SELF_NOTIF		(intrpt_type == OPC_INTRPT_SELF)4#define	END_SIM			(intrpt_type == OPC_INTRPT_ENDSIM)d#define	MSG_FROM_LOWER_LAYER	((intrpt_type == OPC_INTRPT_STRM) && (intrpt_strm == INSTRM_FROM_UDP)) f#define	MSG_FROM_HIGHER_LAYER	((intrpt_type == OPC_INTRPT_STRM) && (intrpt_strm == INSTRM_FROM_MGEN)) j#define TIMEOUT_EVENT	((intrpt_type == OPC_INTRPT_SELF) && (intrpt_code == SELF_INTRT_CODE_TIMEOUT_EVENT))/* Forward Declarations */void norm_conf_udp ();void norm_host_addr ();"static const int MAX_SCRIPT = 128;static const int MAX_LOG = 128;#static const int MAX_COMMAND = 256;#static const int MAXSTATFLOWS = 25;8/* Initialization function */void norm_init ()	{	FIN (norm_init ())/	/* Initilaize the statistic handles to keep	*/8	/* track of traffic sent and sinked by this process.	*/n	bits_rcvd_stathandle 		= op_stat_reg ("NORM.Traffic Received (bits)",			OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);s	bitssec_rcvd_stathandle 	= op_stat_reg ("NORM.Traffic Received (bits/sec)",		OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);p	pkts_rcvd_stathandle 		= op_stat_reg ("NORM.Traffic Received (packets)",		OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);u	pktssec_rcvd_stathandle 	= op_stat_reg ("NORM.Traffic Received (packets/sec)",	OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);j	bits_sent_stathandle 		= op_stat_reg ("NORM.Traffic Sent (bits)",			OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);o	bitssec_sent_stathandle 	= op_stat_reg ("NORM.Traffic Sent (bits/sec)",		OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);l	pkts_sent_stathandle 		= op_stat_reg ("NORM.Traffic Sent (packets)",		OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);q	pktssec_sent_stathandle 	= op_stat_reg ("NORM.Traffic Sent (packets/sec)",	OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);o	ete_delay_stathandle		= op_stat_reg ("NORM.End-to-End Delay (seconds)",		OPC_STAT_INDEX_NONE, OPC_STAT_LOCAL);p	bits_rcvd_gstathandle 		= op_stat_reg ("NORM.Traffic Received (bits)",			OPC_STAT_INDEX_NONE, OPC_STAT_GLOBAL);u	bitssec_rcvd_gstathandle 	= op_stat_reg ("NORM.Traffic Received (bits/sec)",		OPC_STAT_INDEX_NONE, OPC_STAT_GLOBAL);r	pkts_rcvd_gstathandle 		= op_stat_reg ("NORM.Traffic Received (packets)",		OPC_STAT_INDEX_NONE, OPC_STAT_GLOBAL);w	pktssec_rcvd_gstathandle 	= op_stat_reg ("NORM.Traffic Received (packets/sec)",	OPC_STAT_INDEX_NONE, OPC_STAT_GLOBAL);l	bits_sent_gstathandle 		= op_stat_reg ("NORM.Traffic Sent (bits)",			OPC_STAT_INDEX_NONE, OPC_STAT_GLOBAL);q	bitssec_sent_gstathandle 	= op_stat_reg ("NORM.Traffic Sent (bits/sec)",		OPC_STAT_INDEX_NONE, OPC_STAT_GLOBAL);n	pkts_sent_gstathandle 		= op_stat_reg ("NORM.Traffic Sent (packets)",		OPC_STAT_INDEX_NONE, OPC_STAT_GLOBAL);s	pktssec_sent_gstathandle 	= op_stat_reg ("NORM.Traffic Sent (packets/sec)",	OPC_STAT_INDEX_NONE, OPC_STAT_GLOBAL);p	ete_delay_gstathandle		= op_stat_reg ("NORM.End-to-End Delay (seconds)",	OPC_STAT_INDEX_NONE, OPC_STAT_GLOBAL);=	/* Read norm comands specified via opnet model attributes */-	printf("NORM settings for %s:\n",node_name);	char val[128];		int tog;@	op_ima_obj_attr_get_str(my_id,"debug",128,val);		// debug level	if (val[0])		{		printf(" debug =  %s\n",val);(		norm_proc.ProcessCommand("debug",val);		}@	op_ima_obj_attr_get_str(my_id,"log",128,val);		// log file name	if (val[0])		{		printf(" log =  %s\n",val);&		norm_proc.ProcessCommand("log",val);		}D	op_ima_obj_attr_get_toggle(my_id,"trace",&tog);		// message tracing		if (tog)		{		printf(" trace on\n",val);)		norm_proc.ProcessCommand("trace",NULL);		}K	op_ima_obj_attr_get_str(my_id,"txloss",128,val);	// tx packet loss percent	if (val[0])		{ 		printf(" txloss =  %s\n",val);)		norm_proc.ProcessCommand("txloss",val);		}K	op_ima_obj_attr_get_str(my_id,"rxloss",128,val);	// rx packet loss percent	if (val[0])		{ 		printf(" rxloss =  %s\n",val);)		norm_proc.ProcessCommand("rxloss",val);		}J	op_ima_obj_attr_get_str(my_id,"address",128,val);	// session dest address	if (val[0])		{		List* 	fieldlist;		!		printf(" address =  %s\n",val);*		norm_proc.ProcessCommand("address",val);.		fieldlist = op_prg_str_decomp ( val , "/" );S		dest_ip_addr = ip_address_create((const char *)op_prg_list_access(fieldlist, 0));E		local_port = atoi ((const char *)op_prg_list_access(fieldlist, 1));"		op_prg_list_free ( fieldlist );  		op_prg_mem_free ( fieldlist );		}@	op_ima_obj_attr_get_str(my_id,"ttl",128,val);		// multicast ttl	if (val[0])		{		printf(" ttl =  %s\n",val);L		norm_proc.ProcessCommand("ttl",val); // maybe shouldn't use norm_proc code		};	op_ima_obj_attr_get_str(my_id,"rate",128,val);		// tx rate	if (val[0])		{		printf(" rate =  %s\n",val);'		norm_proc.ProcessCommand("rate",val);		}K	op_ima_obj_attr_get_str(my_id,"cc",128,val);		// congestion control on/off	if (val[0])		{		printf(" cc =  %s\n",val);%		norm_proc.ProcessCommand("cc",val);		}`	op_ima_obj_attr_get_str(my_id,"backoff",128,val);	// backoff factor 'k' (maxBackoff = k * GRTT)	if (val[0])		{!		printf(" backoff =  %s\n",val);*		norm_proc.ProcessCommand("backoff",val);		}O	op_ima_obj_attr_get_str(my_id,"interval",128,val);	// delay between tx objects	if (val[0])		{"		printf(" interval =  %s\n",val);+		norm_proc.ProcessCommand("interval",val);		}\	op_ima_obj_attr_get_str(my_id,"repeat",128,val);	// number of times to repeat tx object set	if (val[0])		{ 		printf(" repeat =  %s\n",val);)		norm_proc.ProcessCommand("repeat",val);		}I	op_ima_obj_attr_get_str(my_id,"segment",128,val);	// server segment size	if (val[0])		{!		printf(" segment =  %s\n",val);*		norm_proc.ProcessCommand("segment",val);		}I	op_ima_obj_attr_get_str(my_id,"block",128,val);		// server blocking size	if (val[0])		{		printf(" block =  %s\n",val);(		norm_proc.ProcessCommand("block",val);		}`	op_ima_obj_attr_get_str(my_id,"parity",128,val);	// server parity segments calculated per block	if (val[0])		{ 		printf(" parity =  %s\n",val);)		norm_proc.ProcessCommand("parity",val);		}L	op_ima_obj_attr_get_str(my_id,"auto",128,val);		// server auto parity count	if (val[0])		{		printf(" auto =  %s\n",val);'		norm_proc.ProcessCommand("auto",val);		}N	op_ima_obj_attr_get_str(my_id,"extra",128,val);		// server extra parity count	if (val[0])		{		printf(" extra =  %s\n",val);(		norm_proc.ProcessCommand("extra",val);		}H	op_ima_obj_attr_get_str(my_id,"gsize",128,val);		// group size estimate	if (val[0])		{		printf(" gsize =  %s\n",val);(		norm_proc.ProcessCommand("gsize",val);		}A	op_ima_obj_attr_get_str(my_id,"grtt",128,val);		// grtt estimate	if (val[0])		{		printf(" grtt =  %s\n",val);'		norm_proc.ProcessCommand("grtt",val);		}M	op_ima_obj_attr_get_str(my_id,"txbuffer",128,val);	// tx buffer size (bytes)	if (val[0])		{"		printf(" txbuffer =  %s\n",val);+		norm_proc.ProcessCommand("txbuffer",val);		}M	op_ima_obj_attr_get_str(my_id,"rxbuffer",128,val);	// rx buffer size (bytes)	if (val[0])		{"		printf(" rxbuffer =  %s\n",val);+		norm_proc.ProcessCommand("rxbuffer",val);		}r	op_ima_obj_attr_get_str(my_id,"sendRandomFile",128,val);	// queue random-size file size range <sizeMin>:<sizeMax>	if (val[0])		{(		printf(" sendRandomFile =  %s\n",val);1		norm_proc.ProcessCommand("sendRandomFile",val);		}u	op_ima_obj_attr_get_str(my_id,"push",128,val);	// "on" means real-time push stream advancement (non-blocking) on|off	if (val[0])		{		printf(" push =  %s\n",val);'		norm_proc.ProcessCommand("push",val);		}[	op_ima_obj_attr_get_str(my_id,"flush",128,val);	// stream flush mode (none|passive|active)	if (val[0])		{		printf(" flush =  %s\n",val);(		norm_proc.ProcessCommand("flush",val);		}X	op_ima_obj_attr_get_str(my_id,"unicastNacks",128,val);	// clients will unicast feedback	if (val[0])		{&		printf(" unicastNacks =  %s\n",val);/		norm_proc.ProcessCommand("unicastNacks",val);		}T	op_ima_obj_attr_get_str(my_id,"silentClient",128,val);	// clients will not transmit	if (val[0])		{&		printf(" silentClient =  %s\n",val);/		norm_proc.ProcessCommand("silentClient",val);		}		norm_conf_udp ();	FOUT;	}void norm_stop()	{	FIN(norm_stop());	norm_proc.OnShutdown();	FOUT;	}voidnorm_fatal_error (char *emsg)	{	char info[40];5	/** Abort the simulation with the given message. **/	FIN (norm_fatal_error (emsg));   -	sprintf(info, "NORM Error(%s):", node_name);+	op_sim_end (info, emsg, OPC_NIL, OPC_NIL);	FOUT;	}voidnorm_warn_error (char *wmsg)	{	char info[40];	I	/** Issue an warning (used for potentially inconsistent situations). **/	FIN (norm_warn_error (wmsg));	/	sprintf(info, "NORM Warning(%s):", node_name);,	if (op_prg_odb_ltrace_active ("norm warn"))/		op_prg_odb_print_minor (info, wmsg, OPC_NIL);	FOUT;	}M/*  Function to configure the proper input/output streams to the udp process ;    and setup the udp port numbers via the ICI facility  */voidnorm_conf_udp()	{	int					outstrm_count;	Objid				outstrm_objid;*    List*			 	proc_record_handle_list_ptr;/    OmsT_Pr_Handle		temp_process_record_handle;	FIN(norm_conf_udp());	>	/*                                                         */>	/* Get the outgoing packet stream index to the UDP process */>	/*                                                         */	G    /* First, get the number of output streams for the NORM process. */V    outstrm_count = op_topo_assoc_count (my_id, OPC_TOPO_ASSOC_OUT, OPC_OBJTYPE_STRM);A    /* Then, make sure there's two outgoing streams from NORM. */    if (outstrm_count != 2)^    	norm_fatal_error ("NORM does not have two outgoing streams - one to MGEN & one to UDP.");*	/* Then, get the outgoing stream Objid */S    outstrm_objid = op_topo_assoc (my_id, OPC_TOPO_ASSOC_OUT, OPC_OBJTYPE_STRM, 0);(	/* Retrieve the index of the stream. */I	op_ima_obj_attr_get (outstrm_objid, "src stream", &udp_outstream_index);C    /* 						                                                    */R    /* Locate the UDP module. It must have registered in the process registry.  */C    /* 						                                                    */	K    /* Obtain the process handles by matching the specific descriptors			*/8    proc_record_handle_list_ptr = op_prg_list_create ();L    oms_pr_process_discover (OPC_OBJID_INVALID, proc_record_handle_list_ptr,.    	"node objid",	OMSC_PR_OBJID,		my_node_id,)    	"protocol",		OMSC_PR_STRING,		"udp",    	OPC_NIL);1    /* Each node can have only one UDP module.	*/<    if (op_prg_list_size (proc_record_handle_list_ptr) != 1)    	{O    	/* Having more than one UDP module is a serious error.  End simulation. */_	    norm_fatal_error ("Error: either zero or several UDP processes found in the local node");     	}u    temp_process_record_handle = (OmsT_Pr_Handle) op_prg_list_access (proc_record_handle_list_ptr, OPC_LISTPOS_TAIL);3    /* Obtain the module objid of the udp module	*/[    oms_pr_attr_get (temp_process_record_handle, "module objid",OMSC_PR_OBJID, &my_udp_id);	G	norm_proc.SetUdpProcessId(my_udp_id);  /*  - OpnetProtoSimProcess.h */G    /* Deallocate the memory allocated for holding the record handle	*/>    while (op_prg_list_size (proc_record_handle_list_ptr) > 0)H    	op_prg_list_remove (proc_record_handle_list_ptr, OPC_LISTPOS_HEAD);0    /* Deallocate the temporary list pointer. */3    op_prg_mem_free (proc_record_handle_list_ptr);				FOUT;	}void norm_host_addr ()	{	FIN (norm_host_addr());A    /* Obtain a pointer to the process record handle list of any /       IP processes residing in the local node.	*/=    List* proc_record_handle_list_ptr = op_prg_list_create();K    oms_pr_process_discover(OPC_OBJID_INVALID, proc_record_handle_list_ptr,:	                        "protocol", OMSC_PR_STRING, "ip",B	                        "node objid", OMSC_PR_OBJID, my_node_id, "	                        OPC_NIL);E    /* An error should be created if there are zero or more than     *       one IP processes in the local node.	*/Q    int record_handle_list_size = op_prg_list_size (proc_record_handle_list_ptr);    IpT_Info* ip_info_ptr;%    if (1 != record_handle_list_size)		{0	    /* Generate an error and end simulation. */_	    op_sim_end("Error: either zero or more than one ip processes in local node.", "", "", "");		}    else		{A        /* Obtain the process record handle of the IP process. */	    OmsT_Pr_Handle process_record_handle = (OmsT_Pr_Handle) op_prg_list_access(proc_record_handle_list_ptr, OPC_LISTPOS_HEAD);>	    /* Obtain the pointer to the interface info structure. */d	    oms_pr_attr_get(process_record_handle, "interface information", OMSC_PR_ADDRESS, &ip_info_ptr);		}&    /* Deallocate the list pointer. */=    while (op_prg_list_size(proc_record_handle_list_ptr) > 0)G	    op_prg_list_remove(proc_record_handle_list_ptr, OPC_LISTPOS_HEAD);1    op_prg_mem_free(proc_record_handle_list_ptr);4    /* Obtain the pointer to the IP interface table.B	   Note that the ip_info_ptr->ip_iface_table_ptr is the same list\	     as module_data->interface_table_ptr as shown in ip_dispatch.pr.c->ip_dispatch_do_int()	*/?    List* ip_iface_table_ptr = ip_info_ptr->ip_iface_table_ptr;4    /* Obtain the size of the IP interface table. */C    int ip_iface_table_size = op_prg_list_size(ip_iface_table_ptr);(	int interface_info_index = 0;  /* LP */	J    /* For now, an error should be created if there are zero or more than C       one IP interface attached to this node.  Loopback interfaces!	   and Tunnel interfaces are OK.	*/	C	/* In the future, we should allow more than 1 IP interface for the!	   case of IP routers. LP 3-4-04	*/	!    if (1 != ip_iface_table_size)		{a		/* check to see if there is any loopback interface or tunnel interface.  (LP 3-1-04 - added) */		int i, ip_intf_count = 0;		bool dumb_intf = OPC_FALSE;+		for (i = 0; i < ip_iface_table_size; i++)			{x   			IpT_Interface_Info* intf_ptr = (IpT_Interface_Info*) op_prg_list_access(ip_iface_table_ptr, OPC_LISTPOS_HEAD + i);O			if ((intf_ptr->phys_intf_info_ptr->intf_status == IpC_Intf_Status_Tunnel) ||L				(intf_ptr->phys_intf_info_ptr->intf_status == IpC_Intf_Status_Loopback))				{				dumb_intf = OPC_TRUE;
				break;&				} /* end if tunnel || loop back */			else				{				interface_info_index = i;				ip_intf_count ++;				}			} /* end for i */0	    /* Generate an error and end simulation. */G	    if ((dumb_intf == OPC_FALSE) || (ip_intf_count > 1))  /* end LP */\			op_sim_end("Error: either zero or more than one ip interface on this node.", "", "", "");*		}  /* end if ip_iface_table-size != 1 */	    	<	/* Obtain a pointer to the IP interface data structure. */	�	IpT_Interface_Info* interface_info_pnt = (IpT_Interface_Info*) op_prg_list_access(ip_iface_table_ptr, OPC_LISTPOS_HEAD + interface_info_index);:	my_ip_addr = interface_info_pnt->addr_range_ptr->address;>	my_ip_mask = interface_info_pnt->addr_range_ptr->subnet_mask;*	host_ipv4_addr.SimSetAddress(my_ip_addr);,//	norm_proc.SetHostAddress(host_ipv4_addr);			FOUT;	}$OpnetNormProcess::OpnetNormProcess()3 : NormSimAgent(GetTimerMgr(), GetSocketNotifier()){D printf("OpnetNormProcess::OpnetNormProcess():  this = %x\n", this);}  %OpnetNormProcess::~OpnetNormProcess(){    }$IpT_Address OpnetNormProcess::addr()	{	FIN(OpnetNormProcess());	FRET (my_ip_addr);	}Bbool OpnetNormProcess::OnStartup(int argc, const char*const* argv){	char val[128];		FIN (OnStartup(argc,argv));V	norm_proc.SetSink(new OpnetProtoMessageSink(app_ici_ptr,OUTSTRM_TO_MGEN,local_port));	norm_host_addr();Q	op_ima_obj_attr_get_str(my_id,"start",128,val);	// clients will unicast feedback	if (val[0])		{$		printf(" NORM start =  %s\n",val);		ProcessCommand("start",val);		}U	op_ima_obj_attr_get_str(my_id,"sendStream",128,val);	// send a simulated NORM stream	if (val[0])		{)		printf(" NORM sendStream =  %s\n",val);#		ProcessCommand("sendStream",val);		}[	op_ima_obj_attr_get_str(my_id,"openStream",128,val);	// open a stream object for messaging	if (val[0])		{)		printf(" NORM openStream =  %s\n",val);#		ProcessCommand("openStream",val);5		/* JPH 4/11/06  fake attachment of mgen instance */		//AttachMgen((Mgen*)true);		}j	op_ima_obj_attr_get_str(my_id,"sendFile",128,val);	// queue a "sim" file of <size> bytes for transmission	if (val[0])		{"		printf(" sendFile =  %s\n",val);!		ProcessCommand("sendFile",val);		}
	FRET (true);&} // end OpnetNormProcess::OnStartup()#void OpnetNormProcess::OnShutdown(){	ProcessCommand("stop",NULL);(}  // end OpnetNormProcess::OnShutdown()Ibool OpnetNormProcess::ProcessCommands(int argc, const char*const* argv) {   E    // Process commands, passing unknown commands to base Agent class    int i = 1;    while (i < argc)    {=        NormSimAgent::CmdType cmdType = CommandType(argv[i]);        switch (cmdType)	        {)            case NormSimAgent::CMD_NOARG:3                if (!ProcessCommand(argv[i], NULL))                {^                    DMSG(0, "OpnetNormProcess::ProcessCommands() ProcessCommand(%s) error\n", %                            argv[i]);!                    return false;                }                i++;                break;                '            case NormSimAgent::CMD_ARG:8                if (!ProcessCommand(argv[i], argv[i+1]))                {b                    DMSG(0, "OpnetNormProcess::ProcessCommands() ProcessCommand(%s, %s) error\n", 0                            argv[i], argv[i+1]);!                    return false;                }                i += 2;                break;                +            case NormSimAgent::CMD_INVALID:                return false;	        }    }    return true; -}  // end OpnetNormProcess::ProcessCommands())/* This function not used at present.  */6/* SendMessage called directly from send_msg state. */.// JPH 5/25/06 - revert from mgen 42b8 to 42b69//bool OpnetNormProcess::SendMgenMessage(MgenMsg& theMsg, //				     bool checksum_enable,//				     char* txBuffer)//{//	int len = 0;(//    return SendMessage(len, txBuffer);///}  // end OpnetNormProcess::SendMgenMessage()Fbool OpnetNormProcess::SendMgenMessage(const char*           txBuffer,<                                  unsigned int          len,D                                  const ProtoAddress&   /*dstAddr*/){&    return SendMessage(len, txBuffer);-}  // end OpnetNormProcess::SendMgenMessage() Gvoid OpnetNormProcess::ReceivePacketMonitor(Ici* iciptr, Packet* pkptr)	{*	FIN (ReceivePacketMonitor(iciptr,pkptr));(	/* Caclulate metrics to be updated.		*/8	double pk_size = (double) op_pk_total_size_get (pkptr);E	double ete_delay = op_sim_time () - op_pk_creation_time_get (pkptr);"	/* Update local statistics.				*/1	op_stat_write (bits_rcvd_stathandle, 		pk_size);-	op_stat_write (pkts_rcvd_stathandle, 		1.0);3	op_stat_write (ete_delay_stathandle, 		ete_delay);3	op_stat_write (bitssec_rcvd_stathandle, 	pk_size);/	op_stat_write (bitssec_rcvd_stathandle, 	0.0);/	op_stat_write (pktssec_rcvd_stathandle, 	1.0);/	op_stat_write (pktssec_rcvd_stathandle, 	0.0); 	/* Update global statistics.	*/2	op_stat_write (bits_rcvd_gstathandle, 		pk_size);.	op_stat_write (pkts_rcvd_gstathandle, 		1.0);4	op_stat_write (ete_delay_gstathandle, 		ete_delay);4	op_stat_write (bitssec_rcvd_gstathandle, 	pk_size);0	op_stat_write (bitssec_rcvd_gstathandle, 	0.0);0	op_stat_write (pktssec_rcvd_gstathandle, 	1.0);0	op_stat_write (pktssec_rcvd_gstathandle, 	0.0);	FOUT;	}Fvoid OpnetNormProcess::TransmitPacketMonitor(Ici* ici, Packet* pkptr) 	{(	FIN (TransmitPacketMonitor(ici,pkptr));(	/* Caclulate metrics to be updated.		*/8	double pk_size = (double) op_pk_total_size_get (pkptr);"	/* Update local statistics.				*/1	op_stat_write (bits_sent_stathandle, 		pk_size);-	op_stat_write (pkts_sent_stathandle, 		1.0);3	op_stat_write (bitssec_sent_stathandle, 	pk_size);/	op_stat_write (bitssec_sent_stathandle, 	0.0);/	op_stat_write (pktssec_sent_stathandle, 	1.0);/	op_stat_write (pktssec_sent_stathandle, 	0.0); 	/* Update global statistics.	*/2	op_stat_write (bits_sent_gstathandle, 		pk_size);.	op_stat_write (pkts_sent_gstathandle, 		1.0);4	op_stat_write (bitssec_sent_gstathandle, 	pk_size);0	op_stat_write (bitssec_sent_gstathandle, 	0.0);0	op_stat_write (pktssec_sent_gstathandle, 	1.0);0	op_stat_write (pktssec_sent_gstathandle, 	0.0);	FOUT;	}	J�JidleJJ intrpt_type = op_intrpt_type ();#if (intrpt_type == OPC_INTRPT_STRM)!	intrpt_strm = op_intrpt_strm ();else!	intrpt_code = op_intrpt_code ();ici_ptr = op_intrpt_ici ();J����pr_stateZ�JinitJJ$-app_ici_ptr = op_ici_create ("sink_command");>/* Obtain the object ID of the surrounding norm processor. 	*/my_id = op_id_self ();9/* Also obtain the object ID of the surrounding node.		*/$my_node_id = op_topo_parent (my_id);0/* Obtain the prohandle for this process.					*/own_prohandle = op_pro_self ();;/**	Register the process in the model-wide registry.				**/Eown_process_record_handle = (OmsT_Pr_Handle) oms_pr_process_register ,	(my_node_id, my_id, own_prohandle, "NORM");?/*	Register the protocol attribute in the registry. No other	*/?/*	process should use the string "norm" as the value for its	*/$/*	"protocol" attribute!										*/,oms_pr_attr_set (own_process_record_handle, &	"protocol", 	OMSC_PR_STRING, 	"norm",
	OPC_NIL);=/*	Initialize the state variable used to keep track of the	*/</*	NORM module object ID and to generate trace/debugging 	*/=/*	string information. Obtain process ID of this process. 	*/'my_pro_id = op_pro_id (op_pro_self ());</* 	Set the process ID string, to be later used for trace	*/'/*	and debugging information.								*/1sprintf (pid_string, "NORM PID (%d)", my_pro_id);1/* Get the name of the surrounding node object */5op_ima_obj_attr_get (my_node_id, "name", &node_name);E/* 	Schedule a self interrupt to allow  additional initialization. */,op_intrpt_schedule_self (op_sim_time (), 0);JJnorm_init(); op_intrpt_schedule_self (0.0,0);JJ����Jpr_state��Jinit2JJJJnorm_proc.OnStartup(0,NULL);J����pr_state
JZJproc_msgJJ&norm_proc.OnReceive(op_intrpt_strm());JJ����Jpr_state��JitimerJJnorm_proc.OnSystemTimeout();JJ����Jpr_stateJJJsend_msgJJ6%data_pkptr = op_pk_get (intrpt_strm);$/* The total payload size in bits */5pk_size = (double) op_pk_total_size_get (data_pkptr);F/* ici processing may have some future use for mgen control of norm */F/********************************************************************/Cop_ici_attr_get (ici_ptr, "inet_support", &inet_address_supported);if (inet_address_supported)	{)	/* This is a udp_command_inet ici.				*/6	op_ici_attr_get (ici_ptr, "rem_addr", &rem_addr_ptr);7	op_ici_attr_get (ici_ptr, "src_addr", &intf_addr_ptr);	}else	{'	/* This is a udp_command_v3 ici.				*/7	op_ici_attr_get (ici_ptr, "rem_addr", &rem_ipv4_addr);3	/* Convert the address into InetT_Address form.	*/F	temp_ip_addr = inet_address_from_ipv4_address_create (rem_ipv4_addr);	rem_addr_ptr = &temp_ip_addr;*	/* Get the other fields in the ici.				*/8	op_ici_attr_get (ici_ptr, "src_addr", &ipv4_intf_addr);R	intf_addr = inet_address_from_ipv4_address_create_invalid_check (ipv4_intf_addr);	intf_addr_ptr = &intf_addr;	} 1op_ici_attr_get (ici_ptr, "rem_port", &rem_port);5op_ici_attr_get (ici_ptr, "local_port", &local_port);Aop_ici_attr_get (ici_ptr, "local_minor_port", &local_minor_port);;op_ici_attr_get (ici_ptr, "connection_class", &conn_class);?op_ici_attr_get (ici_ptr, "Type of Service", &type_of_service);B/* Using the "strm_index" to identify the outgoing IP interface	*/@/* to allow sending multicast by setting multicast major port	*/3op_ici_attr_get (ici_ptr, "strm_index", &intf_num);F/********************************************************************/4char* txBuffer = (char*)op_prg_mem_alloc(pk_size/8);(op_pk_fd_get (data_pkptr, 0, &txBuffer);//int len = pk_size/8;2//printf("norm_protolib:send_msg:  txBuffer =\n");//for (int i = 0; i<len; i+=8)�//	printf(" %x %x %x %x %x %x %x %x\n",txBuffer[i],txBuffer[i+1],txBuffer[i+2],txBuffer[i+3],txBuffer[i+4],txBuffer[i+5],txBuffer[i+6],txBuffer[i+7]);		+norm_proc.SendMessage(pk_size/8, txBuffer);op_pk_destroy (data_pkptr);JJ����Jpr_state
		
�D�;�
 
JdefaultJ������������
pr_transition		�3����z5�Jtr_2JJEND_SIMJJnorm_stop()JJ����J����
pr_transition	��q���Jtr_9J��������J����J����
pr_transition
	���<�Jtr_10J��������J����J����
pr_transition	
��T�TpJtr_11JJMSG_FROM_LOWER_LAYERJ����J����J����
pr_transition
	D�BnB�Jtr_12J��������J����J����
pr_transition	����`�Jtr_40J��������J����J����
pr_transition	��_���Jtr_41JJ
TIMEOUT_EVENTJ����J����J����
pr_transition	QO/O�Jtr_17J��������J����J����
pr_transition	�'F�F1Jtr_18JJMSG_FROM_HIGHER_LAYERJ����J����J����
pr_transition	End-to-End Delay (seconds):End-to-end delay of packets received by NORM in this node.NORMbucket/1 secs/sample meanlinearԲI�%��}Traffic Received (bits)0Traffic received (in bits) by NROM at this node.NORMbucket/1 secs/sumlinearԲI�%��}Traffic Received (bits/sec)4Traffic received (in bits/sec) by NORM at this node.NORMbucket/1 secs/sum_timelinearԲI�%��}Traffic Received (packets)3Traffic received (in packets) by NORM at this node.NORMbucket/1 secs/sumlinearԲI�%��}Traffic Received (packets/sec)7Traffic received (in packets/sec) by NORM at this node.NORMbucket/1 secs/sum_timelinearԲI�%��}Traffic Sent (bits).Traffic sent (in bits) by NORM from this node.NORMbucket/1 secs/sumlinearԲI�%��}Traffic Sent (bits/sec)2Traffic sent (in bits/sec) by NORM from this node.NORMbucket/1 secs/sum_timelinearԲI�%��}Traffic Sent (packets)1Traffic sent (in packets) by NORM from this node.NORMbucket/1 secs/sumlinearԲI�%��}Traffic Sent (packets/sec)5Traffic sent (in packets/sec) by NORM from this node.NORMbucket/1 secs/sum_timelinearԲI�%��}	End-to-End Delay (seconds)>End-to-end delay of packets received by NORM across all nodes.NORM bucket/default total/sample meanlinearԲI�%��}Traffic Received (bits)4Traffic received (in bits) by NORM across all nodes.NORMbucket/default total/sumlinearԲI�%��}Traffic Received (bits/sec)8Traffic received (in bits/sec) by NORM across all nodes.NORMbucket/default total/sum_timelinearԲI�%��}Traffic Received (packets)7Traffic received (in packets) by NORM across all nodes.NORMbucket/default total/sumlinearԲI�%��}Traffic Received (packets/sec);Traffic received (in packets/sec) by NORM across all nodes.NORMbucket/default total/sum_timelinearԲI�%��}Traffic Sent (bits)0Traffic sent (in bits) by NORM across all nodes.NORMbucket/default total/sumlinearԲI�%��}Traffic Sent (bits/sec)4Traffic sent (in bits/sec) by NORM across all nodes.NORMbucket/default total/sum_timelinearԲI�%��}Traffic Sent (packets)3Traffic sent (in packets) by NORM across all nodes.NORMbucket/default total/sumlinearԲI�%��}Traffic Sent (packets/sec)7Traffic sent (in packets/sec) by NORM across all nodes.NORMbucket/default total/sum_timelinearԲI�%��}galoisnormEncodernormFilenormMessagenormNode
normObjectnormPostProcessnormSegmentnormSessionnormSimAgentprotoBitmaskGeneral Process Description: ---------------------------- FThe sink process model accepts packets from any number of sources and 4discards them regardless of their content or format. ICI Interfaces: -------------- None Packet Formats: --------------- None Statistic Wires: ---------------- None Process Registry: ----------------- Not ApplicableRestrictions: ------------- None