210 likes | 516 Views
NETWORK SIMULATOR. Duke Lee, Mustafa Ergen, Jeff Ko WOW UC Berkeley. Simulator. Animator input Define geographical distribution Define the functional parameters of the network nodes. Define network layer protocols Define traffic characteristics down to each node. Simulator core
E N D
NETWORK SIMULATOR Duke Lee, Mustafa Ergen, Jeff Ko WOW UC Berkeley WOW
Simulator • Animatorinput Define geographical distribution Define the functional parameters of the network nodes. Define network layer protocols Define traffic characteristics down to each node. • Simulator core Network Modules Drive the event. • Analyzer output Statistical graphing tool. • Visual Tracer output Packet-level visualization tool. (NAM) WOW
Simulator Finite State Machine Event Driven Simulation Seed State List Simulation Functions Handler Functions WOW
Event Scheduler • Application • WTP • timers • IP • DSDV, etc. • Link Layer • Timers,WTRP • Channel • Packet transmission • Node Info • position • topology SCHEDULER Application INFO. QUEUE TCP UDP ICMP IP LINK LAYER PHSICAL LAYER NODE CHANNEL WOW
Scheduler Algorithm • struct event { struct event *next; struct event *prev; unsigned long expiration; unsigned long data; void (*handler)(unsigned long); • } WOW
Event Scheduler • add_timer( event *ev); • delete_timer(event *ev); • mod_timer(event *ev); • while(1) { tmp=take_event(); update_clock ; update_position; tmp.handler(); • } SIMULATOR Event Queue add_event take_event WOW
Event Queue CHANNEL Event Queue • Packet Transmission • Timer initialization Packet transmission tx_1 tm_7 timer_7 rx_5 rx_2 rx_1 WOW
Simulator Functions • update_topology(); • record_topology(); • record_transmission(); • record_reception(); • Record Function is a periodic event which periodically starts monitoring SIMULATOR Event Queue record_function record_topology Output Files record_transmission record_reception WOW
Architecture • Overall Design SIMULATOR MODULE CHANNEL MODULE LINUX MODULES VISUAL TRACER GUI DEV1 DEV2 DEV3 … INFO INFO INFO ANIMATOR GUI State List State List State List ANALYZER GUI SCHEDULER WOW
Interface CBR SCHEDULER MONITORING [1] [4] Network Module [5] [2] CHANNEL [3] • Initialize_simulation; • Initialize_topology; • Initialize_traffic; • Initialize_record_function; • Main Loop WOW
[1] CBR-Data Traffic • used to send periodic packet to the module. • sits in the Logical Link Control above the network module. • transmit (received something from the top layer) • int tx_handler (struct device *dev, struct sk_buff * skb) • receive • int app_rx (struct device * dev, struct sk_buff * inskb, unsigned short network_proto) WOW
[2] Scheduler • used to send data to channel module • transmit first schedule a event and wait about a transmission time. • int transmit (struct device *dev, struct sk_buff skb) • called when the module get the event from the scheduler. • received something from the bottom layer. • void rx_handler(struct device *dev , struct sk_buff *skb) WOW
[3] Channel • scheduler to channel • void _transmit (struct device * dev) • channel go through for each node and assign packet reception for those who can get the packet. • channel to scheduler • void add_timer (struct timer_list * timer) WOW
[4] Monitoring Functions I • void record_topology (struct simulation_struct * siminfo, struct device *device_list, struct device * dev, float time, float difftime); • void start_transmission (struct simulation_struct * siminfo, struct device * sender, float time); • void end_transmission (struct simulation_struct * siminfo, struct device * sender, float time); • void start_reception (struct simulation_struct * siminfo, struct device * sender, float time); • void end_reception (struct simulation_struct * siminfo, struct device * sender, float time); WOW
[4] Monitoring Functions II • void record_transmission (struct simulation_struct * siminfo, struct device * device_list, struct device * sender, unsigned char * packet, float time); • void record_reception (struct simulation_struct * siminfo, struct device * device_list, struct device * sender, unsigned char * packet, float time); • printpacketinfo (* packet); needed for different packet types. WOW
[5] Inside Functions • Randomize Functions • basic random function should be used for determinism. • unsigned long net_random(void); WOW
Conclusion • Unique Simulator Functions • Specific Handler Functions • Linux Scheduler Functions • General Event Type • NAM WOW
NAM • Allows backward and forward run • Node variables: color,shape … • Node marking • Variable Tracing • Annotation • Node Exec Button • Save frames as a movie WOW
Appendix I • Transport protocol create sk_buff from output buffers • While device drivers create them for incoming data. TCP sk_buff IP MAC sk_buff Dev. WOW
Appendix II • struct cbr_struct { • struct cbr_struct * next; • unsigned long start_time; • struct device * source; • struct device * dest; • struct timer_list cbr_timer; • int packetsize; • int numpackets; • int bandwidth; • void * handler; • }; • sk_buff • sk – pointer to owning socket • stamp – arrival time • dev - pointer to receiving/transmiting device • h- pointer to transport layer header • nh- pointer to network layer header • mac- pointer to link layer header • dst – pointer to dst_entry • cb –TCP per –packet control information • len – actual data length • csum- checksum • protocol- packet network protocol • truesize- buffer size • head- pointer to head of buffer • data- pointer to data head • Tail- pointer to tail • End- pointer to end • Destructor-pointer to destruct function • struct timer_list { • struct timer_list *next; • struct timer_list *prev; • unsigned long expires; • unsigned long data; • void(*function)(unsigned long); • }; WOW