WOW
NETWORK SIMULATOR
Duke Lee, Mustafa Ergen, Jeff Ko
WOWWOW UC BerkeleyUC Berkeley
WOW
Simulator
• Animator inputDefine geographical distributionDefine the functional parameters of the network nodes.Define network layer protocolsDefine traffic characteristics down to each node.
• Simulator coreNetwork ModulesDrive the event.
• Analyzer outputStatistical graphing tool.
• Visual Tracer outputPacket-level visualization tool. (NAM)
WOW
Simulator
• Finite State Machine
• Event Driven Simulation
• Seed
• State List
• Simulation Functions
• Handler Functions
WOW
Event Scheduler
CHANNEL
INFO.
NODE
• Application
• WTP– timers
• IP– DSDV, etc.
• Link Layer– Timers,WTRP
• Channel– Packet
transmission
• Node Info– position
– topology
SC
HE
DU
LE
RPHSICAL LAYER
LINK LAYER
IPTCP UDP
ICMP
QUEUE
Application
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();
• }
SIM
UL
AT
OR
Event Q
ueue
add_event
take_event
WOW
Event Queue
• Packet Transmission
• Timer initialization
tx_1E
vent Queue
rx_5rx_2
rx_1
CH
AN
NE
L
Packet transmission
timer_7tm_7
WOW
Simulator Functions
• update_topology();• record_topology();• record_transmission();• record_reception();
• Record Function is a periodic event which periodically starts monitoring
SIM
UL
AT
OR
Event Q
ueue
record_function
record_topology
Output F
ilesrecord_transmission
record_reception
WOW
Architecture
• Overall Design
DEV1ANIMATORGUI
DEV2
SCHEDULER
…DEV3
ANALYZERGUI
VISUALTRACER
GUI
SIMULATORMODULE
LINUX MODULES
CHANNELMODULE
StateList
StateList
StateList
INFO INFO INFO
WOW
Interface
• Initialize_simulation;
• Initialize_topology;
• Initialize_traffic;
• Initialize_record_function;
• Main Loop
NetworkModule
MO
NIT
OR
ING
CBR
CHANNEL
SC
HE
DU
LE
R
[1]
[2]
[3]
[4]
[5]
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
IP
MAC
Dev.
sk_buff
sk_buff
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;
• };
• struct timer_list {
• struct timer_list *next;
• struct timer_list *prev;
• unsigned long expires;
• unsigned long data;
• void(*function)(unsigned long);
• };
• 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