Wednesday, 22. February 2006, 18:41:05
Info is a very good function for otcl classes and object to discover its relations. Check out the Info section for more details
http://www.openmash.org/developers/docs/otcl-doc/doc/object.htmlhttp://www.openmash.org/developers/docs/otcl-doc/doc/class.htmlLet me list some interesting examples to shows you how you can fully utilize the info to help you understand NS objects and classes.
The main Class of NS is Simulator, from the terminal, type 'ns' to start.
%set ns [new Simulator]
_o4
Let check see whether the class Simulator have how many instances
%Simulator info instances
_o4
_o4 is the object, check where the object instanciate from
%_o4 info class
Simulator
%$ns info class
Simulator
2 ways gives the same result.
If you investigates the info listed on object and class of the page above, you may discover that object info procs, where class info instprocs. So what is the difference between procs and instprocs. Instprocs of class is actually virtual function, that means the object instanciate from the class, should implement that instprocs, but procs of object is the extra function of the particular object.
% Simulator info instprocs
phyType sleepPower mrtproto-iifs PLMcreate-agent llType clear-mcast asim-getAggrTput link add-isl get-nam-traceall ifqType energyModel attach-tagger LMS link-lossmodel re-rewind-nam halt trace-all-satlinks PGM sat_link_destroy mrtproto makeflowmon snapshot routerTrace trace-queue mobileIP OutgoingErrProc namtrace-queue asim-dump duplex-link make-lan rtmodel topoInstance insert-delayer detach-lossmodel rtmodel-at run-mcast after QS now toraDebug rtmodel-configure PLMcbr_flow_PP log-simstart create-omnimcast-agent asim-getLinkDrop get-node-by-addr satnode-geo-repeater dump-namwireless macTrace multihome-add-interface drop-trace node-config bw_parse set-address-format init-nam puts-nam-config initialEnergy bandwidth set-nix-routing get-number-of-nodes node ifqLen check-smac transitionPower ldp-request-color get-node-id-by-addr gen-map maketbtagger at-now rtmodel-delete IncomingErrProc lossmodel expand-port-field-bits terminate-nam channelType idlePower namtrace-all asim-getLinkTput multicast set-dsr-nodetype get-link-head wiredRouting asim-getFlowDrop flush-trace satnode-polar dumper propInstance create-highspeed-connection create-trace dump-namcolors PLMbuild_source_set get-node-by-id eventtrace-all txPower simplex-link-op ldp-withdraw-color pushback-duplex-link get-ns-traceall create-diffusion-rate-agent create-dumb-agent terminate-all-agents hier-topo abstract-tcp delay_parse get-queue src_rting dump-namlans satnode monitor-agent-trace is-started cost create-diffusion-probability-agent monitor-queue dump-approx-sim-data rewind-nam delete-agent-trace attach-diffapp asim-getFlowTput create-connection-listen multicast? diffusionFilter put-in-list create-dsdv-agent delay compute-flat-routes energy-color-change prepare-to-stop puts-nam-traceall use-newtrace MPLS trace-all rxPower downlinkBW register-nam-linkconfig dump-namnodes rtt rtproto expand-address compute-routes create-tcp-connection run create-satnode adhocRouting all-nodes-list dump-namlinks sat_link_up attach-tbf-agent maybeEnableTraceAll ldp-notification-color queue-limit create-wireless-node dump-routelogic-nh get-color namtrace-all-wireless detach-agent dump-namaddress use-taggedtrace create-aodv-agent get-link antType agentTrace namtrace-config create-flooding-agent remove-nam-linkconfig macType add-first-links asim-getLinkDelay asim-run get-nodetype chk-hier-field-lengths attach-fmon ldp-release-color FECProc namtrace-some mpls-node newsatnode connect set-animation-rate nullagent transitionTime propType nam-end-wireless create_packetformat simplex-connect multihome-attach-agent multihome-connect make-abslan clearMemTrace eotTrace src_rting? movementTrace dump-namversion at trace-annotate color puts-ns-traceall addressType attach-agent add-agent-trace channel create-node-instance get-routelogic create-core-diffusion-rtg-agent compute-algo-routes newLan cancel check-node-num all-links-list initial_node_pos compute-hier-routes dump-namagents use-scheduler ldp-mapping-color stopTime create-manual-rtg-agent simplex-link dumpq LDP-peer duplex-link-op create-connection-list pushback-simplex-link create-tora-agent hier-node init get-AllocAddrBits imep-support set-hieraddress set-address dump-namqueues dump-routelogic-distance satNodeType create-connection create-eventtrace get-nam-config duplex-intserv-link maketswtagger satnode-geo satnode-terminal
The Simulator have a lots of the instprocs, but i just wanna shows you one of the example 'node', to query whether the function 'node' exist, i do as bellow.
% Simulator info instprocs node
node
% _o4 node
_o14
The first line query instprocs node, if it doesn't exist, it will return nothing. _o4 is the object of simulator(can be replace with $ns), the third line is shows the object calls the instproc node, and it returns another object _o14 instance. _o14 is instance of Node class.
% _o14 info class
Node
There is a lots more to discover, let say
Simulator info superclass
Although Simulator is the main class for NS, but it is not root class.