overlay network and packet header
DESCRIPTION
Overlay Network and Packet header. P resenter : 曾家豪 695430054. outline. O verview Overlay Network Overlay Network Architecture in Project P2P module in NS2 :GnutellaSim K-cube in Overlay Network About Packet Header Packet Class A ssign or Change Data to Header fields - PowerPoint PPT PresentationTRANSCRIPT
Overlay Network and Packet headerPresenter: 曾家豪
695430054
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
Overview Overlay NetworkOverlay: 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
Overlay Network Architecture in Project
P2P module in NS2 :GnutellaSim
http://www.cc.gatech.edu/computing/compass/gnutella/install.html
GnutellaSimPart I: Application LayerPeerApp-------------------GnutellaApp ActivityController PeerSys BootstrapControl--------SmpBootServer
PDNSBootServer
Part II: Protocol Layer PeerAgent-----------------GnutellaAgent MsgParser-----------------GnutellaMsg
Part III: Socket Adaptation LayerNSSocket
PrioSocket AdvwTcp
SocketTcp
K-cube algorithm in Overlay Network
000
010
001
100
101
110
111011
S
010XOR) 000 010
010XOR) 110 100
010XOR) 100 110
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)
封包傳送出去之流程
About Packet Header
EX: RTP Header (rtp.h)
RTP Header (rtp.cc)
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-headersadd-packet-header IP TCP......set ns [new Simulator]
如何增加自己的 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 值的方式
EX: IP Header (ip.h)
IP Header (ip.cc)
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<<"the source "<<( fk.srcaddr = ih->saddr() )<<endl; cout<<"the destination "<<( fk.dstaddr = ih->daddr() )<<endl;
Packet type & packet header type
In packet.henum 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.tclforeach prot { Common Flags IP # IP# Routing Protocols:NV # NixVector classifier for stateless routing rtProtoDV # distance vector routing protocolrtProtoLS # link state routing protocolSR # source routing, dsr/hdr_sr.ccSrc_rt # source routing, src_rtg/hdr_src.cc# Routers:LDP # mpls/ldp.ccMPLS # MPLS, MultiProtocol Label Switching……
Next week 抽考 把 common header 的 unique id 與
timestamp隨著每個封包傳送,利用cout印出來。
~/ns2.31/common/Packet.h