SlideShare a Scribd company logo
OTCL/C++	Linkages	
T	S	Pradeep	Kumar	
http://www.pradeepkumar.org	
http://www.nsnam.com		
pradeepkumarts@gmail.com
OTcl and C++ linkages in NS2
OTcl and C++ linkages in NS2
TCLCL	Classes
Simple	Agent
class	TSPAgent	:	public	Agent	{	
public:	
								TSPAgent();	
protected:	
								int	command(int	argc,	const	char*const*	argv);	
private:	
								int				tsp_var1;	
								double	tsp_var2;	
								void			TSPPrivFunc(void);	
};
Simple	Agent
static	class	TSPAgentClass	:	public	TclClass	{	
public:	
							TSPAgentClass()	:	TclClass("Agent/TSPAgentOtcl")	{}	
								TclObject*	create(int,	const	char*const*)	{	
																return(new	TSPAgent());	
								}	
}	class_tsp_agent;	
TSPAgent::TSPAgent()	:	Agent(PT_UDP)	{	
							bind("tsp_var1_otcl",	&tsp_var1);	
							bind("tsp_var2_otcl",	&tsp_var2);	
}
Simple	Agent
int	TSPAgent::command(int	argc,	const	char*const*	
argv)	{	
						if(argc	==	2)	{	
											if(strcmp(argv[1],	"call-tsp-priv-func")	==	0)	{	
																		TSPPrivFunc();	
																		return(TCL_OK);	
											}	
						}	
					return(Agent::command(argc,	argv));	
}
Simple	Agent
void	TSPAgent::TSPPrivFunc(void)	{	
Tcl&	tcl	=	Tcl::instance();	
tcl.eval("puts	"Message	From	TSPPrivFunc"");	
tcl.evalf("puts	"					tsp_var1	=	%d"",	tsp_var1);	
tcl.evalf("puts	"					tsp_var2	=	%f"",	tsp_var2);	
}
Creation	of	a	Simple	Agent
#name	it	as	.tcl	file	
#	Create	TSPAgent		
set	myagent	[new	Agent/TSPAgentOtcl]	
#	Set	configurable	parameters	of	TSPAgent	
$myagent	set	tsp_var1_otcl	2	
$myagent	set	tsp_var2_otcl	3.14	
#	Give	a	command	to	TSPAgent	
$myagent	call-tsp-priv-fun
Case	study	–	2	–	Multimedia	over	udp
• to	build	a	multimedia	application	that	runs	
over	a	UDP	connection,		
• five	rate	media	scaling	
• by	changing	encoding	and	transmission	policy	
pairs	associated	with	scale	parameter	values.
Case	study	–	2	–	Multimedia	over	udp
• Based	on	5	rate	
– 0		 0.3mb	
– 1	 0.6mb	
– 2	 0.9mb	
– 3	 1.2mb	
– 4	 1.5mb	
– Packetsize		 1000	
– Random	 false
Case	study	–	2	–	Multimedia	over	udp
ÒWhen	connection	established,	Sender/receiver	
agree	on	5	different	sets	of	encoding	and	
transmission	policy	pairs.	
ÒSender	sends	with	scale	0	but	changes	the	
transmission	rates	according	to	the	value	that	the	
receiver	notifies.	
ÒThe	receiver	is	responsible	for	monitoring	the	
network	congestion	and	determine	the	scale	
factor.	If	congestion,	then	the	receiver	reduces	the	
scale	factor.
Where	to	modify
• ~ns-2.34	is	the	folder	where	all	the	cc	modules	
are	located
Topic Where	to	modify
Routing	Protocol		
(AODV,	DSDV,	DSR)
~ns-2.34/aodv/aodv.cc,	aodv_rtable.cc,	etc
Mobile	Node	(Energy,	Propagation,	
Antenna)
~ns-2.34/mobile/*.cc	and	*.h
TCP	(Vegas,	Reno,	New	Reno,	etc) ~ns-2.34/tcp/	*.cc
New	packet,	agent	to	be	added ~ns-2.34/common/packet.h,	agent.h
Wireless	Physical	layer	or	MAC	Layer	
modification
~ns-2.34/mac/*.cc
Where	to	modify
Topic Where	to	modify
MPLS ~ns-2.34/mpls
Adding	a	new	Queue ~ns-2.34/queue/*.cc	and	*.h
Adding	a	new	application ~ns-2.34/apps/app.h
Sensors ~ns-2.34/sensor-net	(still	to	be	developed)
Examples	(more	than	100) ~ns-2.34/tcl/ex/
What	not	lot	more	in	NS2

More Related Content

PDF
PPTX
Go Concurrency Basics
PPTX
Go Concurrency Patterns
PDF
The... Wonderful? World of Lambdas
PDF
Promise of an API
PDF
ClojureScript loves React, DomCode May 26 2015
PDF
Php 5.6 From the Inside Out
PDF
ClojureScript for the web
Go Concurrency Basics
Go Concurrency Patterns
The... Wonderful? World of Lambdas
Promise of an API
ClojureScript loves React, DomCode May 26 2015
Php 5.6 From the Inside Out
ClojureScript for the web

What's hot (20)

PDF
Using zone.js
PDF
Full Stack Clojure
PDF
Coroutines in Kotlin. UA Mobile 2017.
PDF
Coroutines in Kotlin
PDF
Reactive cocoa made Simple with Swift
PPTX
Fine grain process control 2nd nov
ODP
Groovy Ast Transformations (greach)
KEY
並行処理プログラミングの深淵~Java仮想マシン仕様 スレッドとロック~
PPT
FSE 2008
PDF
An Introduction to Reactive Cocoa
ZIP
Intro to Pig UDF
PDF
Riga Dev Day 2016 - Having fun with Javassist
PDF
Clojure+ClojureScript Webapps
PDF
R/C++ talk at earl 2014
PDF
Minion pool - a worker pool for nodejs
PPTX
AMC Minor Technical Issues
PPTX
PDF
Introduction to RxJS
ODP
Parameter passing
PPTX
.NET Core Summer event 2019 in Brno, CZ - Async demystified -- Karel Zikmund
Using zone.js
Full Stack Clojure
Coroutines in Kotlin. UA Mobile 2017.
Coroutines in Kotlin
Reactive cocoa made Simple with Swift
Fine grain process control 2nd nov
Groovy Ast Transformations (greach)
並行処理プログラミングの深淵~Java仮想マシン仕様 スレッドとロック~
FSE 2008
An Introduction to Reactive Cocoa
Intro to Pig UDF
Riga Dev Day 2016 - Having fun with Javassist
Clojure+ClojureScript Webapps
R/C++ talk at earl 2014
Minion pool - a worker pool for nodejs
AMC Minor Technical Issues
Introduction to RxJS
Parameter passing
.NET Core Summer event 2019 in Brno, CZ - Async demystified -- Karel Zikmund
Ad

Similar to OTcl and C++ linkages in NS2 (20)

PPTX
Network simulator 2
PDF
Creating Lazy stream in CSharp
PDF
PDF
Using CUDA Within Mathematica
PDF
Using Cuda Within Mathematica
PDF
operating system ubuntu,linux,MacProgram will work only if you g.pdf
DOCX
Ejercicios
PPT
TechTalk - Dotnet
PDF
operating system Linux,ubuntu,Mac#include stdio.h #include .pdf
DOCX
Game unleashedjavascript
PDF
Shell to be modified#include stdlib.h #include unistd.h .pdf
PPT
Overloading
PPT
Exception Handling1
PPT
Generics
PPT
Lecture5
PPT
Whats new in_csharp4
PPT
Smart Pointer in C++
PPTX
PDF
Introduction to ATS plugins
DOCX
.net progrmming part1
Network simulator 2
Creating Lazy stream in CSharp
Using CUDA Within Mathematica
Using Cuda Within Mathematica
operating system ubuntu,linux,MacProgram will work only if you g.pdf
Ejercicios
TechTalk - Dotnet
operating system Linux,ubuntu,Mac#include stdio.h #include .pdf
Game unleashedjavascript
Shell to be modified#include stdlib.h #include unistd.h .pdf
Overloading
Exception Handling1
Generics
Lecture5
Whats new in_csharp4
Smart Pointer in C++
Introduction to ATS plugins
.net progrmming part1
Ad

More from Pradeep Kumar TS (20)

PDF
Digital Portfolio and Footprint
PDF
Open book Examination
PDF
Software Define Networking (SDN)
PDF
What next - Career Enhancement of Graduates
PDF
Protothreads
PDF
PDF
Software Defined Networks
PDF
Higher Order Thinking - Question paper setting
PDF
IoT Communication Protocols
PDF
IoT Applications
PDF
RPL - Routing Protocol for Low Power and Lossy Networks
PDF
Mannasim for NS2
PDF
Recompiling network simulator 2
PDF
Wired and Wireless Examples in ns2
PDF
Installation of ns2
PDF
Introduction to ns2
PDF
Software Defined Networking - 1
PDF
Software Defined Networking - 2
PDF
Software Defined Networking - 3
PDF
Tracing and awk in ns2
Digital Portfolio and Footprint
Open book Examination
Software Define Networking (SDN)
What next - Career Enhancement of Graduates
Protothreads
Software Defined Networks
Higher Order Thinking - Question paper setting
IoT Communication Protocols
IoT Applications
RPL - Routing Protocol for Low Power and Lossy Networks
Mannasim for NS2
Recompiling network simulator 2
Wired and Wireless Examples in ns2
Installation of ns2
Introduction to ns2
Software Defined Networking - 1
Software Defined Networking - 2
Software Defined Networking - 3
Tracing and awk in ns2

Recently uploaded (20)

PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
CCleaner Pro 6.38.11537 Crack Final Latest Version 2025
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PPTX
L1 - Introduction to python Backend.pptx
PDF
Autodesk AutoCAD Crack Free Download 2025
PPTX
history of c programming in notes for students .pptx
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
Complete Guide to Website Development in Malaysia for SMEs
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
DOCX
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Odoo Companies in India – Driving Business Transformation.pdf
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Wondershare Filmora 15 Crack With Activation Key [2025
Operating system designcfffgfgggggggvggggggggg
CCleaner Pro 6.38.11537 Crack Final Latest Version 2025
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Navsoft: AI-Powered Business Solutions & Custom Software Development
Why Generative AI is the Future of Content, Code & Creativity?
L1 - Introduction to python Backend.pptx
Autodesk AutoCAD Crack Free Download 2025
history of c programming in notes for students .pptx
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Complete Guide to Website Development in Malaysia for SMEs
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
Designing Intelligence for the Shop Floor.pdf
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises

OTcl and C++ linkages in NS2