ns-allinone-2.35/ns-2.35/mcast/lms-agent.cc
NsObject* LmsAgent::pkt2agent (Packet *pkt)
{
	Tcl&		tcl = Tcl::instance();
	char		wrk[64];
	const char		*result;
	int		port;
	NsObject*	agent;
	hdr_ip*		ih = HDR_IP(pkt);
	//nsaddr_t	src = ih->saddr();

	port = ih->sport();

	sprintf (wrk, "[%s set node_] agent %d", name (), port);
	tcl.evalc (wrk);
	result = tcl.result ();

#ifdef LMS_DEBUG
printf ("[pkt2agent] port %d, agent %s\n", port, result);
#endif

	agent = (NsObject*)TclObject::lookup (result);
	return (agent);
}
/*
 * Given a packet, determine which agent sent it
 * Agent MUST be attached to this node
 */
Given a packet, determine which agent sent it
Agent MUST be attached to this node
Given a packet determine which agent sent it Agent MUST be attached to this node
NsObject* LmsAgent::pkt2agent (Packet *pkt)
{
	Tcl&		tcl = Tcl::instance();
	char		wrk[64];
	const char		*result;
	int		port;
	NsObject*	agent;
	hdr_ip*		ih = HDR_IP(pkt);
	port = ih->sport();
	sprintf (wrk, "[%s set node_] agent %d", name (), port);
	tcl.evalc (wrk);
	result = tcl.result ();
#ifdef LMS_DEBUG
printf ("[pkt2agent] port %d, agent %s\n", port, result);
#endif
	agent = (NsObject*)TclObject::lookup (result);
	return (agent);
}
NsObject * LmsAgent :: pkt2agent ( Packet * pkt ) { Tcl & tcl = Tcl :: instance ( ) ; char wrk [ 64 ] ; const char * result ; int port ; NsObject * agent ; hdr_ip * ih = HDR_IP ( pkt ) ; port = ih -> sport ( ) ; sprintf ( wrk , " " , name ( ) , port ) ; tcl . evalc ( wrk ) ; result = tcl . result ( ) ; #ifdef LMS_DEBUG printf ( " \n " , port , result ) ; #endif agent = ( NsObject * ) TclObject :: lookup ( result ) ; return ( agent ) ; }
Given a packet, determine which agent sent it
 Agent MUST be attached to this node
Given a packet determine which agent sent it Agent MUST be attached to this node
//nsaddr_t	src = ih->saddr();