Presentation is loading. Please wait.

Presentation is loading. Please wait.

Overlay Network and Packet header Presenter: 曾家豪 695430054.

Similar presentations


Presentation on theme: "Overlay Network and Packet header Presenter: 曾家豪 695430054."— Presentation transcript:

1 Overlay Network and Packet header Presenter: 曾家豪 695430054

2 outline Overview Overlay Network Overlay Network Architecture in Project P2P module in NS2 :GnutellaSim K-cube in Overlay Network About Packet Header Packet Class Assign or Change Data to Header fields How to add own Packet Header fields

3 Overview Overlay Network Overlay: a network on top of another (IP) networks – links on one layer are network segments of lower layers – tunneling, application adaptor, transparent router Make the application control the routing

4 Overlay Network Architecture in Project

5 P2P module in NS2 : GnutellaSim http://www.cc.gatech.edu/computing /compass/gnutella/install.html http://www.cc.gatech.edu/computing /compass/gnutella/install.html

6 GnutellaSim Part I: Application Layer PeerApp-------------------GnutellaApp ActivityController PeerSys BootstrapControl--------SmpBootServer PDNSBootServer Part II: Protocol Layer PeerAgent-----------------GnutellaAgent MsgParser-----------------GnutellaMsg Part III: Socket Adaptation Layer NSSocket PrioSocket AdvwTcp SocketTcp

7 K-cube algorithm in Overlay Network 000 010 001 100 101 110 111011 S 010 XOR) 000 010 XOR) 110 100 010 XOR) 100 110

8 Application/FTP start Agent(Agent/TCP) ;:send(p,h) Classifier ::recv(p,h) RTAgent ::recv(p,h) LL ::sendDown(p,h) Mac ::recv(p,h) 封包傳送出去之流程

9 About Packet Header

10 EX: RTP Header (rtp.h)

11 RTP Header (rtp.cc)

12 Packet Header 在 NS2 中的特性 By default, ns includes ALL packet headers of ALL protocols in ns in EVERY packet in your simulation. If you are doing large- scale web traffic simulation with many big fat pipes, reducing unused packet headers can lead to major memory saving. The size of packet headers of all protocols in ns is about 1.9KB; however,if you turn on only the common header, the IP header and the TCP header, they add up to about 100 bytes. remove-packet-header AODV ARP...... set ns [new Simulator] remove-all-packet-headers add-packet-header IP TCP...... set ns [new Simulator]

13 如何增加自己的 Packet Header fields 1. 要增加 Header fields 於哪裡? Common header IP header TCP or RTP header New your packet type, protocol 2. 是否有定義新增的 Header fields offset_ 與 access 方式 3.Assign 值的方式

14 EX: IP Header (ip.h)

15 IP Header (ip.cc)

16 EX: 設定或修改 field 的值 #include "priqueue.h" using namespace std; struct forkcube { int32_t srcaddr; int32_t dstaddr; int uid; }; In ns-2.31/queue/priqueue.cc #include “packet.h“ #include “ip.h“ PriQueue::recv(Packet *p, Handler *h) { struct hdr_cmn *ch = HDR_CMN(p); struct hdr_ip *ih = HDR_IP(p); struct forkcube fk; if(Prefer_Routing_Protocols) { switch(ch->ptype()) { … default: Queue::recv(p, h); fk.uid = ch->uid(); fk.uid = fk.uid+1 cout<<"the unique id "<<fk.uid <<endl; cout saddr() )<<endl; cout daddr() )<<endl;

17 Packet type & packet header type In packet.h enum packet_t { PT_TCP, PT_UDP, PT_CBR, PT_AUDIO, PT_VIDEO, PT_ACK, PT_START, PT_STOP, PT_PRUNE, PT_GRAFT, PT_GRAFTACK, PT_JOIN, …… In ns-packet.tcl foreach prot { Common Flags IP # IP # Routing Protocols: NV # NixVector classifier for stateless routing rtProtoDV # distance vector routing protocol rtProtoLS # link state routing protocol SR # source routing, dsr/hdr_sr.cc Src_rt # source routing, src_rtg/hdr_src.cc # Routers: LDP # mpls/ldp.cc MPLS # MPLS, MultiProtocol Label Switching ……

18 Next week 抽考 把 common header 的 unique id 與 timestamp 隨著每個封包傳送,利用 cout 印出來。

19 ~/ns2.31/common/Packet.h

20

21


Download ppt "Overlay Network and Packet header Presenter: 曾家豪 695430054."

Similar presentations


Ads by Google