?? slides.tex
字號:
$object set boolvar false \; set to false; $object set boolvar junk $object set boolvar 0\end{program}\begin{comment}\item Equivalent b/w spec\item s ignored\item bool spec wierd\item set terrible is true, but set junk can be false...\item real/int are canonical forms\end{comment}\foilhead{\violet class TclObject: \fcn[]{command} methods}\begin{itemize}\item shadow object is accessed by a \proc[]{cmd} procedure, called ``\textbf{instproc-like}''\item For example, \proc[]{distance?} is an ``instance procedure'' of an Adaptive SRM agent \begin{program} int ASRMAgent::command(int argc, const char*const*argv)\nb1 \{ Tcl& tcl = Tcl::instance(); if (argc == 3) \{ if (strcmp(argv[1], "distance?") == 0)\nb2 \{ int sender = atoi(argv[2]); SRMinfo* sp = get_state(sender); tcl.tesultf("%f", sp->distance_); return TCL_OK;\nb3 \} \} return (SRMAgent::command(argc, argv));\nb4 \} \end{program}\end{itemize}\begin{comment}\item arguments\item matching\item return code\item parent calling to make instproc-like\end{comment}\foilhead[-3ex]{\violet class TclObject: \fcn[]{command} methods: call sequence}\begin{itemize}\item Usage: \begin{program} $srm distance? \; instproc-like usage;{\rm{}or} $srm cmd distance? \; explicit usage; \end{program} \placefig{tclobject-cmd}\end{itemize}\begin{comment}\item \verb|\placefig{tclobject-cmd}|\item instproc-like calling sequence\item overloading\item direct executing\item hierarchical resolution\end{comment}\foilhead{\indigo class TclClass}Programmer defines C++ hierarchy that is mirrored in OTcl \placefig{tclclass}not all classes are mirrored exactly\begin{comment} \item \verb|\placefig{tclclass}| \item ``/'' as separator character for interpreted hierarchy \item root of mirrored class hierarchies is TclObject \item extra C++ classes that are not mirrored in OTcl \item TclClass is adjunct to mirrored hierarchy\end{comment}\foilhead{\violet Class TclClass: Definition}\begin{itemize}\item For example, Adaptive SRM agent class in C++ is mirrored into Agent/SRM/Adaptive \begin{program} static class AdaptiveSRMAgentClass : public TclClass\nb1 \{ public: AdaptiveSRMAgentClass() : TclClass("Agent/SRM/Adaptive")\nb2 \{\} TclObject* create(int /*argc*/, const char*const* /*argv*/)\nb3 \{ return (new AdaptiveSRMAgent())\nb4; \} \} AdaptiveSRMAgentInstance\nb5;\end{program}\end{itemize}\begin{comment}\item 1. class derived from Tclclass, defies only constructor and create method\item 2. constructor invokes tclclass construcotr with name of interpreterd class\item 3. class name implicitly defines the hierarchy\item 4. class associated with AdaptiveSRMAgent, returns objects in this associated class\item 5. instance needed to set all this in motion.\item 6. Usually ignores argument, but check out the TraceClass definition\end{comment}\foilhead{\red Class TclClass: Mechanism}\begin{itemize}\item static initialisation by compiler \placefig{tclclass-static}\item run time activation at startup \placefig{tclclass-runt}\end{itemize}\begin{comment}\item \verb|\placefig{tclclass-static}| and \verb|\placefig{tclclass-runt}|\item object constructor is executed during C++ static instance initialisations\item TclClass constructor builds list of TclClass instances\item \fcn[]{Tcl\_AppInit} invokes \fcn[]{TclClass::bind} to create interpreted hierarchies\item \fcn[]{bind} invokes \proc[]{TclObject::register} for each class in list\item \proc[]{register} establishes class hierarchy\item \fcn[]{bind} defines instance procedures \proc[]{create-shadow} and \proc[]{delete-shadow} for each class registered\end{comment}\foilhead{\red class Instvar}\begin{itemize}\item One object per bound variable\item created by \fcn[]{TclObject::bind} call\item Constructor activity \begin{subenum} \item point to C++ member variable \item create instance variable for interpreted object \item enable trap read/writes to instance variable using \fcn[]{Tcl\_TraceVar} \end{subenum}\end{itemize}\begin{comment}\item list of instvar in TclObject\item method execution context assumption?\item implicit when in create-shadow\item other possibilities include dynamic binding\end{comment}\foilhead{\blue OTcl Linkage Summary}\begin{itemize}\item Class Tcl \begin{sublist} \item primitives to access the interpreter \end{sublist}\item Class TclObject: root object for mirrored hierarchies \begin{sublist} \item Unifies interpreted and compiled hierarchy \item Provide seamless access to \ns\ objects in compiled code and interpreted scripts \end{sublist}\item Class TclClass: class that sets up the interpreted hierarchy \begin{sublist} \item establish interpreted hierarchy \item shadowing methods \end{sublist}\end{itemize}\begin{comment}\item summarise key items to remember in interaction\item goodfullness discussion on what goes in OTcl, and how/why\end{comment}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\keyword{Routing}\foilhead{\blue Unicast Routing}Compute the forwarding tables at each node in topology\begin{itemize}\item specify \begin{program} $ns rtproto \tup{protocol} \tup{nodelist} \end{program} \begin{sublist} \item run protocol on nodes listed \item \tup{protocol}: static, session, DV\hfill default: static \item \tup{nodelist}:\hfill default: entire topology \end{sublist}\item Tailor behaviour \begin{program} $ns cost $n1 $n2 5 \end{program} \begin{sublist} \item assign costs to links\hfill default: cost = 1 \end{sublist}% \item Asymetric Routing, MultiPath Routing\end{itemize}\keyword{Unicast Routing}\begin{comment}\item populates classifier\_\item supports multiple route protocols\item centralised vs detailed distinction for DV etc.\end{comment}\foilhead{\indigo Centralized Unicast Routing}Route computation is external to simulation execution\begin{itemize}\item Supported strategies \begin{sublist} \item Static Routing: Routes precomputed prior to start of simulation \item Session Routing: Static + Routes recomputed on topology change \end{sublist}\item Dijkstra's All-pairs SPF algorithm\end{itemize}\begin{comment}\item Algorithm used: Dijkstra's all-pairs spf algorithm\end{comment}\foilhead{\indigo Detailed Unicast Routing}Route computation is part of simulation execution\begin{itemize}\item Currently implemented protocols Distributed Bellman-Ford (\textbf{DV}) routing \begin{sublist} \item \code{advertInterval} = $2s.$ update interval \item Split-horizon w/poison reverse advertisments \item triggered updates on topology change, or new route entries \end{sublist}\item Possible options such as equal cost multi-path routing\end{itemize}\begin{comment}\item aggressive routing strategy\end{comment}\foilhead{\red Class Architecture}\placefig{rtarch}\begin{comment}\item \verb|\placefig{rtarch}|\item RouteLogic global class for routing, all classes need it thgouh\item Only detail routing needs rtObject and associated strategies\end{comment}\foilhead{\red class RouteLogic}\begin{itemize}\item Route Configuration \placefig{rtlconfig}\item Query Node~$n_1$'s nexthop to Node~$n_2$ \begin{program} [$ns get-routelogic] lookup $n1 $n2 \end{program}\item Reconfiguration on Topology Changes \begin{program} [$ns get-routelogic] notify \end{program}\end{itemize}\begin{comment}\item instance variable array \code{rtprotos_}\item centralised routing hookin\item \verb|\placefig{rtlconfig}|\item lookup is overloaded instproc-lioke, returns node id of next hop.\item invokes \proc[]{compute-all} for all unicast routing protocols in simulation.\end{comment}\foilhead{\red Dynamic Routing: class rtObject}Route Controller\begin{tabularx}{\linewidth}{rX} \proc[]{init-all} & Creates \code{rtObject} at each node in argument \\ \proc[]{add-proto} & Adds \tup{protocol} agent to \tup{node} \\ \proc[]{lookup} & Returns nexthop for \tup{dest} handle, -1 if none available \\ \proc[]{compute-routes} & compute and install best route to destinations; invoke \proc[]{send-updates}, \proc[]{flag-multicast} \\ \proc[]{intf-changed} & notify protocol agents; recompute-routes\\ \proc[]{dump-routes} & to \tup{filehandle} specified \\\end{tabularx}\begin{comment}\item other methods to get protocol handle, preference, metric and nexthop of installed route.\item special DIRECT route protocol\item prefernece and metric comparison for compute-routes\end{comment}\foilhead{\red Dynamic Routing: class Agent/rtProto/DV}Route Protocol Agent\begin{tabularx}{\linewidth}{rX} \proc[]{init-all} & create protocol agent at each node in argument \\ \proc[]{compute-routes} & invoked on startup and after topology change; compute best route in protocol; possibly set \code{rtsChanged\_} \\ \proc[]{intf-changed} & called after topology change on incident node \\ \proc[]{send-updates} & whenever routes at node change \\\end{tabularx}\begin{comment}\item init-all invokes init-all for rtObject, add-proto to each node, and find and add peers\item Agent will invoke \proc[]{rtObject::compute-routes} when its routes change\item on topop change, first invoke intf-changed, then compute-routes.\item extensions for LS\item other internal details, sent-periodic updates, send-to-peer, recv-updates\item rtPeer support\end{comment}\foilhead[-3ex]{\red Equal Cost Multi-Path Routes}\code{\textbf{Node set multiPath_ 1}}\placefig{mpath}\begin{comment}\item one mpath classifier per dest possible\item each one will alternate routes to use all of them\item routes must be from the same protocol and metric\end{comment}\foilhead{\red Asymetric Path Routing}\psset{unit=1in}\centerline{ \begin{pspicture}(-1,-1)(1,1) \cnodeput( 0, 1){r1}{$r_1$} \cnodeput( 0,-1){r2}{$r_2$} \cnodeput( 1, 0){n2}{$n_2$} \cnodeput(-1, 0){n1}{$n_1$} \ncline{n1}{r1}\ncline{r1}{n2}\ncline{n2}{r2}\ncline{r2}{n1} \rput[br](-0.75, 0.25){\footnotesize2} \rput[tl]( 0.75, -0.25){\footnotesize2} \rput[br]( 0.25, -0.75){\footnotesize3} \end{pspicture}}\begin{list}{}{}\item \begin{program} $ns cost $n1 $r1 2 $ns cost $n2 $r2 2 $ns cost $r2 $n2 3\end{program}\end{list}\begin{comment}\item adjusts costs to get appropriate multipath route effects\item n1 and n2 are asynetric path\end{comment}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\foilhead{\blue Multicast Routing: Configuration}\begin{program}\small Simulator \textbf{NumberInterfaces_} 1 \; for some multicast routing protocols; Simulator \textbf{EnableMcast_} 1 set ns [new Simulator] Node \textbf{expandaddr} \; if #nodes > 128; # allocate nodes $ns \textbf{mrtproto} \tup{protocol} \tup{nodelist} set group [Node \textbf{allocaddr}] $node \textbf{join-group} $agent $group $node \textbf{leave-group} $agent $group\end{program}\keyword{Multicast Routing} % 15\begin{comment}\item separate class eliminated\item class variable flags multicast\item default topology size limited to 128 nodes, \item no default multicast, must specify protocol\item defautl node list is entire topology\item use allocaddr to allocate addresses portably\end{comment}\foilhead{\red Multicast Node Definition}\placefig{mcastNode}\begin{comment}\item Notice the extra replicators in the node\end{comment}\foilhead{\violet Multicast Routing Protocols Implemented}Valid protocols currently implemented:\begin{itemize}\item Centralised protocols: \begin{tabularx}{\linewidth}{crX} 1. & \code{CtrMcast} & Centralised Multicast (Sparse Mode Protocol) \\ 2. & \code{DM} & Dense Mode \\ \end{tabularx}\item Detailed protocols: \begin{tabularx}{\linewidth}{crX} 1. & \code{dynamicDM} & Dynamic Dense Mode\\ 2. & \code{pimDM} & PIM Dense Mode\\ \end{tabularx}\end{itemize}\begin{comment}\item PIM sm mode currently WIP\item tradeoffs between implementations\end{comment}\foilhead{\indigo Centralised Multicast Configuration}Sparse Mode implementation of multicast\begin{program}\small $ctrmcastcomp \textbf{compute-mroutes} $ctrmcastcomp \textbf{switch-treetype} $group\end{program}Defaults to creating a shared tree.\begin{comment}\item compute-mroutes initialises routing tables at each nodes\item requires unicast routing sanity\item can be invoked anytime required; invoked automatically by netdyn
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -