Packet Headers Format and Trace 蕭博鴻 698430007. Here comes your footer Outline  Introduction  Packet Module  Packet Header  Packet Header Mapping to.

Slides:



Advertisements
Similar presentations
Constructors and Destructors. Constructor Constructor—what’s this? Constructor—what’s this? method used for initializing objects (of certain class) method.
Advertisements

Constructor. 2 constructor The main use of constructors is to initialize objects. A constructor is a special member function, whose name is same as class.
Contents o Introduction o Characteristics of Constructor. o Types of constructor. - Default Constructor - Parameterized Constructor - Copy Constructor.
Core Java Lecture 4-5. What We Will Cover Today What Are Methods Scope and Life Time of Variables Command Line Arguments Use of static keyword in Java.
R4 Dynamically loading processes. Overview R4 is closely related to R3, much of what you have written for R3 applies to R4 In R3, we executed procedures.
How to Add a New Protocol in NS2 Xu Leiming CSCW Lab. at CS Dept., Tsinghua Univ. June 1, 2001.
Module R2 CS450. Next Week R1 is due next Friday ▫Bring manuals in a binder - make sure to have a cover page with group number, module, and date. You.
CS1061: C Programming Lecture 21: Dynamic Memory Allocation and Variations on struct A. O’Riordan, 2004, 2007 updated.
Introduction to Java Programming Lecture 13 Classes I OO Programming.
SNMP 訊息格式 IP 標頭 UDP 標頭 SNMP 訊息 SNMP 標頭 PDU 標頭 PDU 資料.
Overlay Network and Packet header Presenter: 曾家豪
Queues CS-240 & CS-341 Dick Steflik. Queues First In, First Out operation - FIFO As items are added they are chronologically ordered, items are removed.
Linked Lists Chained nodes of information create what are called linked lists, with each node providing a link to the next node. A useful feature of linked.
PZ09A Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ09A - Activation records Programming Language Design.
Introduction to C Programming Overview of C Hello World program Unix environment C programming basics.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 22 - C++ Templates Outline 22.1Introduction 22.2Class Templates 22.3Class Templates and Non-type.
1 Data Structures Data Structures Topic #2. 2 Today’s Agenda Data Abstraction –Given what we talked about last time, we need to step through an example.
2 期末程式第一份報告 報告內容 撰寫此程式的動機和目的以及預期達到的功能和結果 流程圖 繼承關係 資料結構 檔案上傳格式 第 n 組程式流程圖.doc 組別於近日內公告 5/31, 17:00 前交.
Guide To UNIX Using Linux Third Edition
Introduction to Classes and Objects CS-2303, C-Term Introduction to Classes and Objects CS-2303 System Programming Concepts (Slides include materials.
RTP Real-Time Transport Protocol Speaker: Hsiao-Ting Wang Advisor: Quincy Wu Date: July 2 nd 2009.
Dynamic Allocation and Linked Lists. Dynamic memory allocation in C C uses the functions malloc() and free() to implement dynamic allocation. malloc is.
1 Classes and Objects. 2 Outlines Class Definitions and Objects Member Functions Data Members –Get and Set functions –Constructors.
Operating System Program 5 I/O System DMA Device Driver.
Lab-4 ICMP Ping Programming Speaker : Yi-Fong Lin Date:
CS 1031 C++: Object-Oriented Programming Classes and Objects Template classes Operator Overloading Inheritance Polymorphism.
By Nicholas Policelli An Introduction to Java. Basic Program Structure public class ClassName { public static void main(String[] args) { program statements.
CS212: Object Oriented Analysis and Design Lecture 6: Friends, Constructor and destructors.
Ethernet Driver Changes for NET+OS V5.1. Design Changes Resides in bsp\devices\ethernet directory. Source code broken into more C files. Native driver.
STL multimap Container. STL multimaps multimaps are associative containers –Link a key to a value –AKA: Hashtables, Associative Arrays –A multimap allows.
Copyright 2004 Scott/Jones Publishing Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 7 Structured Data and Classes.
Assign one variable to each group of radio buttons To do this, assign one integer variable to the first radio button in each group. All the subsequent.
 2000 Deitel & Associates, Inc. All rights reserved. Chapter 12 - Templates Outline 12.1Introduction 12.2Function Templates 12.3Overloading Template Functions.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Stacks.
Lecture 3 Classes, Structs, Enums Passing by reference and value Arrays.
1 Linked-list, stack and queue. 2 Outline Abstract Data Type (ADT)‏ Linked list Stack Queue.
NS2 Chapter 5.  A node is an OTcl class, but most of its components are TclObjects.  All node contain at least the following components ◦ An address.
ICOM 4035 – Data Structures Dr. Manuel Rodríguez Martínez Electrical and Computer Engineering Department.
CS 261 – Data Structures C Pointers Review. C is Pass By Value Pass-by-value: a copy of the argument is passed in to a parameter void foo (int a) { a.
TEMPLATESTEMPLATES BCAS,Bapatla B.mohini devi. Templates Outline 22.1Introduction 22.2Class Templates 22.3Class Templates and Non-type Parameters 22.4Templates.
An Introduction to Java – Part 1 Erin Hamalainen CS 265 Sec 001 October 20, 2010.
1 Chapter 15-1 Pointers, Dynamic Data, and Reference Types Dale/Weems.
CS 31 Discussion, Week 7 Faisal Alquaddoomi, Office Hours: BH 2432, W 4:30-6:30pm, F 12:30-1:30pm.
Array and Pointers An Introduction Unit Unit Introduction This unit covers the usage of pointers and arrays in C++
Lecturer: Hao-Hua Chu TA: Wen-Chang HSU.  Read and understand the nachos file system  Enhance file system in Nachos  Relax maximum size of a file.
Group 2 Block 胡貴蓉 Project 2 JMVC code tracing.
Linked Lists A formal data structure. Linked Lists Collections of data items “lined up in a row” Inserts and deletes can be done anywhere in the list.
Java Programming Language Lecture27- An Introduction.
Overview of VANET Project(2011) on NS2 Perspective Part 1 of 2 Jae-Myeong Lee Human-centric Mobile Computing Lab.
NS2_Trace and Monitoring support 報告者:羅士捷
Chapter 22 - C++ Templates
CS505 Data Structures and Algorithms
Pointers and Linked Lists
CISC181 Introduction to Computer Science Dr
標題版面配置 副標題. 標題及含清單的內容版面配置 ▪ 在此新增您的第一個項目符號 ▪ 在此新增您的第二個項目符號 ▪ 在此新增您的第三個項目符號.
Chapter 5 Classes.
LinkedList Class.
Pointers and Linked Lists
Recursion.
CS212: Object Oriented Analysis and Design
PZ09A - Activation records
Activation records Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
C Miscellaneous Programs Prabhat Kumar Padhy
Chapter 22 - C++ Templates
Chapter 22 - C++ Templates
Instructor: Dr. Michael Geiger Spring 2019 Lecture 23: Exam 2 Preview
Activation records Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Activation records Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Activation records Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Introduction to Classes and Objects
Presentation transcript:

Packet Headers Format and Trace 蕭博鴻

Here comes your footer Outline  Introduction  Packet Module  Packet Header  Packet Header Mapping to Otcl  Packet Header Manager in NS2  Defining a New Packet Header to NS2 [Step by Step]  Trace Page 2

Here comes your footer Introduction  Packet consists of packet header and data payload.  In most cases, NS2 extracts information from data payload and stores the information into packet header.  By default, NS2 includes All packet headers of All protocols in every packet.  In NS2, Class Packet is derived from class Event. s.schedule(target_, p, txt + delay_) Page 3

Here comes your footer Page 4 Packet Module

Here comes your footer Page 5

Here comes your footer C++ Variables of class Packet  unsigned char* bits_  AppData* data_  int hdr_len_  bool fflag_ -Set to true if the packet is currently referred to by other objects and false otherwise  Packet* free_ -Pointer to the head of the packet free list  int ref_count_ -Number of objects which currently refer to the packet  Packet* next_ -Pointer to the next packet in the linked list of packets Page 6

Here comes your footer C++ Functions of class Packet  void init(Packet* ) -Clears the packet header bits_ of the input packet p.  Packet* copy() -Returns a pointer to a duplicated packet.  Packet* refcopy() -Increases the number of objects, which refer to the packet  Packet* alloc() -Creates a new packet and returns a pointer to the created packet.  Packet* alloc(n) -Creates a new packet with “n” bytes of data payload and returns a pointer to the created packet. Page 7

Here comes your footer Cont’  void allocdata(int) - Allocates “n” bytes of data payload to the variable data_.  void free(Packet*) -Deallocates packet.  char* access(int) -Retrieves a reference to a certain point (specified by the offset “off”) of the variable bits_ (i.e., packet header). Page 8

Here comes your footer Link List of Packet Page 9

Here comes your footer Page 10 Packet Queue

Here comes your footer Packet Allocation  Packet* alloc()  Packet* alloc(n) Page 11

Here comes your footer Packet Deallocation  void free(Packet*) Page 12

Here comes your footer Page 13 Packet Header

Here comes your footer Page 14 Packet Header Module

Here comes your footer Page 15 Common Header Structure

Here comes your footer Page 16 Packet Type

Here comes your footer Page 17 Packet Header Mapping to OTcl Class/ObjectName C++ Structurehdr_cmn OTcl ClassPacketHeader/Common Mapping ClassCommonHeaderClass Mapping Variableclass_cmnhdr

Here comes your footer Page 18

Here comes your footer Page 19 Packet Header Manager in NS2

Here comes your footer Page 20 Packet Header Manager

Here comes your footer Page 21 Packet Header Manager add Packet Header Add all Packet Header to Ns2 Init Simulator And Create Packet Format Init Simulator And Create Packet Format Allocate Packet Header Offset In Packet And increase header length Allocate Packet Header Offset In Packet And increase header length

Here comes your footer The Other Command  add-packet-header args -This global proc will tell simulator to include the specified packet header(s) in your simulation.  remove-packet-header args -operates in the same syntax, but it removes the specified headers from your simulation; notice that it does not remove the common header even it is instructed to do so.  remove-all-packet-headers -It takes no argument and removes all packet headers, except the common header, from your simulation. Page 22

Here comes your footer 1.Define a protocol specific header C++ struct hdr_echo_back −Declare variable offset_ −Define function access(p) −Include all member variables require to hold new packet attributes 2.Include new packet type into packet_t and class p_info −Declare variable PT_ECHOBACK −Protocol header ‘s name is “EchoBack” 3.Define a protocol specific header OTcl class PacketHeader/EchoBack 4.Derive a mapping class EchoBackHeaderClass from PacketHeaderClass −At the construction, feed PacketHeader/EchoBack and sizeof(struct hdr_echo_back) of class PacketHeaderClass −From within the constructor, Use bind_offset function to bind hdr_echo_back::offset_ 5.Active Header into the PacketHeaderManager protocol list. −Added EchoBack into the foreach loop 6.Edit Makefile to Compile your header, then clean the ns2 and recompile ns2. Page 23 Defining a New Packet Header to NS2 Step by Step

Here comes your footer Page 24 抽考題目  在 NS2 的封包內新增一個表頭 (EchoBack) 。

Here comes your footer  根據下面步驟來完成新增動作。 1.Define a protocol specific header C++ struct hdr_echo_back −Declare variable offset_ −Define function access(p) −Include all member variables require to hold new packet attributes 2.Include new packet type into packet_t and class p_info −Declare variable PT_ECHOBACK −Protocol header ‘s name is “EchoBack” 3.Define a protocol specific header OTcl class PacketHeader/EchoBack 4.Derive a mapping class EchoBackHeaderClass from PacketHeaderClass −At the construction, feed PacketHeader/EchoBack and sizeof(struct hdr_echo_back) of class PacketHeaderClass −From within the constructor, Use bind_offset function to bind hdr_echo_back::offset_ 5.Active Header into the PacketHeaderManager protocol list. −Added EchoBack into the foreach loop 6.Edit Makefile to Compile your header, then clean the ns2 and recompile ns2. Page 25  程式碼的部分已經完成,將 echo_back.cc 跟 echo_back.h 放到 NS2 的資料夾內,根據上面的步 驟完成 2 、 5 、 6 的步驟 抽考題目 ( 提示 )

Here comes your footer Page 26 THANK YOU