Using SPLAY Tree s for state-full packet classification

Similar documents
Data Structure Interview Questions

1 Binary Trees and Adaptive Data Compression

Using CppSim to Generate Neural Network Modules in Simulink using the simulink_neural_net_gen command

$ARCSIGHT_HOME/current/user/agent/map. The files are named in sequential order such as:

TRAINING GUIDE. Overview of Lucity Spatial

Using the Swiftpage Connect List Manager

INSTALLING CCRQINVOICE

1 Version Spaces. CS 478 Homework 1 SOLUTION

Integrating QuickBooks with TimePro

Due Date: Lab report is due on Mar 6 (PRA 01) or Mar 7 (PRA 02)

Lab 1 - Calculator. K&R All of Chapter 1, 7.4, and Appendix B1.2

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

Using the Swiftpage Connect List Manager

In Java, we can use Comparable and Comparator to compare objects.

These tasks can now be performed by a special program called FTP clients.

Eastern Mediterranean University School of Computing and Technology Information Technology Lecture2 Functions

MySqlWorkbench Tutorial: Creating Related Database Tables

BI Publisher TEMPLATE Tutorial

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

Automatic imposition version 5

LAB 7 (June 29/July 4) Structures, Stream I/O, Self-referential structures (Linked list) in C

ClassFlow Administrator User Guide

On the road again. The network layer. Data and control planes. Router forwarding tables. The network layer data plane. CS242 Computer Networks

1 Getting and Extracting the Upgrader

1 Getting and Extracting the Upgrader

Paraben s Phone Recovery Stick

ROCK-POND REPORTING 2.1

TL 9000 Quality Management System. Measurements Handbook. SFQ Examples

Lab 0: Compiling, Running, and Debugging

Transmission Control Protocol Introduction

Link-layer switches. Jurassic Park* LANs with backbone hubs are good. LANs with backbone hubs are bad. Hubs, bridges, and switches

UML : MODELS, VIEWS, AND DIAGRAMS

Dynamic Storage (ECS)


Homework: Populate and Extract Data from Your Database

Lab 5 Sorting with Linked Lists

Tutorial 5: Retention time scheduling

1 Getting and Extracting the Upgrader

Populate and Extract Data from Your Database

Please contact technical support if you have questions about the directory that your organization uses for user management.

Scatter Search And Bionomic Algorithms For The Aircraft Landing Problem

Lab 1 - Calculator. K&R All of Chapter 1, 7.4, and Appendix B1.2 Iterative Code Design handout Style Guidelines handout

Performance of VSA in VMware vsphere 5

STIPalm Basics. Quick Reference Guide STI_ STIPalm Basics 1

STIDistrict AL Rollover Procedures

VMware AirWatch Certificate Authentication for Cisco IPSec VPN

UiPath Automation. Walkthrough. Walkthrough Calculate Client Security Hash

Word 2007 The Ribbon, the Mini toolbar, and the Quick Access Toolbar

Troubleshooting of network problems is find and solve with the help of hardware and software is called troubleshooting tools.

Operational Security. Speaking Frankly The Internet is not a very safe place. A sense of false security... Firewalls*

ECE 545 Project Deliverables

Programming Project: Building a Web Server

Chapter 3 Stack. Books: ISRD Group New Delhi Data structure Using C

Avaya 9610 IP Telephone End User Guide

Because this underlying hardware is dedicated to processing graphics commands, OpenGL drawing is typically very fast.

Date: October User guide. Integration through ONVIF driver. Partner Self-test. Prepared By: Devices & Integrations Team, Milestone Systems

TRAINING GUIDE. Lucity Mobile

Adverse Action Letters

24-4 Image Formation by Thin Lenses

Two Dimensional Truss

FIREWALL RULE SET OPTIMIZATION

OASIS SUBMISSIONS FOR FLORIDA: SYSTEM FUNCTIONS

WEB LAB - Subset Extraction

Lab 4. Name: Checked: Objectives:

COP2800 Homework #3 Assignment Spring 2013

SAS Viya 3.2 Administration: Mobile Devices

Hierarchical Classification of Amazon Products

Computer Organization and Architecture

Paraben s Phone Recovery Stick

Frequently Asked Questions

To start your custom application development, perform the steps below.

InformationNOW Standardized Tests

Module Contents Duration Self- Study. Operation on Files: Open, Reset, Find, delete, modify, insert, close, scan

How to effectively log your data

Assignment 10: Transaction Simulation & Crash Recovery

Because of security on the site, you cannot create a bookmark through the usual means. In order to create a bookmark that will work consistently:

TaiRox Mail Merge. Running Mail Merge

MOS Access 2013 Quick Reference

UiPath Automation. Walkthrough. Walkthrough Calculate Client Security Hash

BMC Remedyforce Integration with Bomgar Remote Support

BMC Remedyforce Integration with Remote Support

3 AXIS STAGE CONTROLLER

Stealing passwords via browser refresh

DNS (Domain Name Service)

Avocent Power Management Distribution Unit (PM PDU) Release Notes Firmware Version April 18, 2011

Dashboard Extension for Enterprise Architect

Project #1 - Fraction Calculator

Exercises: Plotting Complex Figures Using R

A FRAMEWORK FOR PROCESSING K-BEST SITE QUERY

NiceLabel LMS. Installation Guide for Single Server Deployment. Rev-1702 NiceLabel

This labs uses traffic traces from Lab 1 and traffic generator and sink components from Lab 2.

Data Miner Platinum. DataMinerPlatinum allows you to build custom reports with advanced queries. Reports > DataMinerPlatinum

Overview of OPC Alarms and Events

B Tech Project First Stage Report on

Structure Query Language (SQL)

Extended Traceability Report for Enterprise Architect

August 22, 2006 IPRO Tech Client Services Tip of the Day. Concordance and IPRO Camera Button / Backwards DB Link Setup

Design Rules for PCB Layout Using Altium Designer

Enabling Your Personal Web Page on the SacLink

Transcription:

Curse Prject Using SPLAY Tree s fr state-full packet classificatin 1- What is a Splay Tree? These ntes discuss the splay tree, a frm f self-adjusting search tree in which the amrtized time fr an access, insertin, r deletin O(lg n ). Splay trees are binary search trees that have implemented a selfadjusting mechanism. This mechanism perfrms in the fllwing way: every time we access a nde f the tree, whether fr insertin r retrieval, we perfrm rtatins (like in AVL trees), lifting the newly inserted/accessed nde all the way up, s that it becmes the rt f the mdified tree. The ndes n the way are rtated such that the tree becmes mre balanced. The splay tree is NOT a height balanced tree since there are situatins when a nde may have the balance factr different frm -1, 0 r +1. Ndes that are frequently accessed will frequently be lifted up t becme the rt, and they will never drift t far frm the tp psitin. Inactive ndes, n the ther hand, will slwly be pushed farther and farther frm the rt. It is pssible that splay trees can becme highly unbalanced, s that a single access t a nde f the tree can be quite expensive. Hwever, we can prve that, ver a lng sequence f accesses, splay trees are nt at all expensive and are guaranteed t require nt many mre peratins even than AVL amrtized analysis trees. The analytical tl used is called amrtized algrithm analysis, since, like insurance calculatins, the few expensive cases are averaged in with many less expensive cases t btain excellent perfrmance ver a lng sequence f peratins. The peratins that are perfrmed are rtatins f a similar frm t thse used fr AVL trees, but nw with many rtatins dne fr every insertin r retrieval in the tree. In fact, rtatins are dne all alng the path frm the rt t the target nde that is being accessed. Let us nw discuss precisely hw these rtatins prceed. The structure f a splay nde is similar with the ne that was used fr binary search trees. Nte the appearance f the parent pinter. struct NdeSplay{ int key; nd *left, *right, *parent;

}; Where: - key represents the tag f the nde(integer number), - left, right and parent represent pinters t the left and right children and t parent nde. Splay trees are typically used in the implementatin f caches, memry allcatrs, ruters, garbage cllectrs, data cmpressin, rpes (replacement f string used fr lng text strings), in Windws NT (in the virtual memry, netwrking, and file system cde) etc. A splay tree is an efficient implementatin f a balanced binary search tree that takes advantage f lcality in the keys used in incming lkup requests. Fr many applicatins, there is excellent key lcality. A gd example is a netwrk ruter. A netwrk ruter receives netwrk packets at a high rate frm incming cnnectins and must quickly decide n which utging wire t send each packet, based n the IP address in the packet. The ruter needs a big table (a map) that can be used t lk up an IP address and find ut which utging cnnectin t use. If an IP address has been used nce, it is likely t be used again, perhaps many times. Splay trees can prvide gd perfrmance in this situatin. 2- Operatins n Splay Trees These are binary search trees which are self-adjusting in the fllwing way: Every time we access a nde f the tree, whether fr retrieval r insertin r deletin, we perfrm radical surgery n the tree, resulting in the newly accessed nde becming the rt f the mdified tree. This surgery will ensure that ndes that are frequently accessed will never drift t far away frm the rt whereas inactive ndes will get pushed away farther frm the rt. Amrtized cmplexity Splay trees can becme highly unbalanced s that a single access t a nde f the tree can be quite expensive. Hwever, ver a lng sequence f accesses, the few expensive cases are averaged in with many inexpensive cases t btain gd perfrmance. Des nt need heights r balance factrs as in AVL trees and clurs as in Red-Black trees. The surgery n the tree is dne using rtatins, als called as splaying steps. There are six different splaying steps.

1. Zig Rtatin (Right Rtatin) 2. Zag Rtatin (Left Rtatin) 3. Zig-Zag (Zig fllwed by Zag) 4. Zag-Zig (Zag fllwed by Zig) 5. Zig-Zig 6. Zag-Zag Here we briefly explain them: Cnsider the path ging frm the rt dwn t the accessed nde. Each time we mve left ging dwn this path, we say we ``zig'' and each time we mve right, we say we ``zag.'' Zig Rtatin and Zag Rtatin Nte that a zig rtatin is the same as a right rtatin whereas the zag step is the left rtatin. See Figure 1 Zig-Zag This is the same as a duble rtatin in an AVL tree. Nte that the target element is lifted up by tw levels. See Figure 2 Zag-Zig This is als the same as a duble rtatin in an AVL tree. Here again, the target element is lifted up by tw levels. See Figure 3 Zig-Zig and Zag-Zag The target element is lifted up by tw levels in each case. Zig-Zig is different frm tw successive right rtatins; zag-zag is different frm tw successive left rtatins. Fr example, see Figures 4, and 5.

See Figure 6 fr an example Figure 1: Zig rtatin and zag rtatin Figure 2: Zig-zag rtatin Figure 3: Zag-zig rtatin Figure 4: Zig-zig and zag-zag rtatins

Figure 5: Tw successive right rtatins Figure 6: An example f splaying

The abve scheme f splaying is called bttm-up splaying. In tp-dwn splaying, we start frm the rt and as we lcate the target element and mve dwn, we splay as we g. This is mre efficient. 3- Search, Insert, Delete in Bttm-up Splaying Search (i, t) If item i is in tree t, return a pinter t the nde cntaining i; therwise return a pinter t the null nde. Search dwn the rt f t, lking fr i If the search is successful and we reach a nde x cntaining i, we cmplete the search by splaying at x and returning a pinter t x If the search is unsuccessful, i.e., we reach the null nde, we splay at the last nn-null nde reached during the search and return a pinter t null. If the tree is empty, we mit any splaying peratin. Example f an unsuccessful search: See Figure 7

figure 7: An example f searching in splay trees Insert (i, t) Search fr i. If the search is successful then splay at the nde cntaining i. If the search is unsuccessful, replace the pinter t null reached during the search by a pinter t a new nde x t cntain i and splay the tree at x Fr an example, See Figure 8. Figure 8: An example f an insert in a splay tree Delete (i, t) Search fr i. If the search is unsuccessful, splay at the last nn-null nde encuntered during search. If the search is successful, let x be the nde cntaining i. Assume x is nt the rt and let y be the parent f x. Replace x by an apprpriate descendent f y in the usual fashin and then splay at y. Fr an example, see Figure 9.

Figure 9: An example f a delete in a splay tree A sample cde f splay tree my be fund at : http://www.sanfundry.cm/cpp-prgram-implement-splay-tree/ 4- Splay Trees t d state-full packet classificatin The prcess f classifying packets int flws in ruters, firewalls, packet filters etc., is called packet classificatin. Packet classificatin is used in a variety f applicatins such as security, mnitring, multimedia applicatins etc. These applicatins perate n packet flws r set f flws. Therefre these ndes must classify packets traversing thrugh it in rder t assign a flw identifier, called as Flw. Packet Classificatin starts by building a classifier f rules r filter table, then searching that table fr a particular filter r a set f filters that match the incming packets. Each filter cnsists f a number f filed values. The field values may be an address filed such as surce, destinatin addresses r a prt field namely surce, destinatin prts r prtcl type. The main research issues in the design f ptimal packet classificatin techniques are: t increase the packet classificatin speed, t increase the update perfrmance speeds fr new rules, t decrease the strage requirements fr caching these rules.

Splay trees are self balancing (r) self adjusting binary search trees [2]. It has special update and access rules. Every time we access a nde f the tree, whether fr retrieval r insertin r deletin, we perfrm radical surgery n the tree, resulting in the newly accessed nde becming the rt f the mdified tree. This surgery will ensure that ndes that are frequently accessed will never drift t far away frm the rt whereas inactive ndes will get pushed away farther frm the rt. When we access a nde, we apply either a single rtatin r a series f rtatins t mve the nde t the rt. The biggest advantage f using Splay trees is that it des nt require height r balance factrs as in AVL trees and clrs as in Red-Black trees. Infrmally, ne can think f the splay trees as implementing a srt f LRU plicy n tree accesses i.e. the mst recently accessed elements are pulled clser t the rt; and indeed, ne can shw that the tree structure adapts dynamically t the elements accessed, s that the least frequently used elements will be thse furthest frm the rt. But remarkably, althugh n explicit balance cnditins are impsed n the tree, each f these peratins can be shwn t use time O(lg n) n an n-element tree, in an amrtized sense. as it is mentined befre, There are six rtatins pssible in a splay tree: 1. Zig Rtatin 2. Zag Rtatin 3. Zig-Zig Rtatin 4. Zag-Zag Rtatin 5. Zig-Zag Rtatin 6. Zag-Zig Rtatin All peratins are illustrated in figure 10.

Figure10. Splay Tree peratin Descriptin f SP-Classifier In this prject, we examine a nvel representatin f the input set and build a tree frm this input set. The basic idea is t cnvert the set f prefixes int integers. Firstly, we find ut the lwer and upper bunds fr each prefix in the surce address. Then we cnvert these values t integers and stre them in a database. The same prcedure is carried ut fr each f the prefixes f the destinatin and stred in the database. While classifying incming packets, we reject packets if they d nt match the cnstraints. Finally we find ut the best matching filter (rule) amng the varius filters fr the valid packets. The prpsed wrk is a basic extensin f the Hierarchical Tries. Here, we cnvert each f the surce and destinatin prefixes int integer ranges. Then the crrespnding tree is cnstructed. The greatest advantage f this apprach is that the prefix specificatin can be extended t any number f bits. Let fllw a sample filter-set representatin by this methd. Table 1 and Table 2 represent a sample filter set. We first cmpute the lwer and upper bunds fr each f the prefixes in the surce address as shwn in Table 1.Then a surce splay tree is cnstructed with the bunds cnverted t integers, which is shwn in Figure 11.Similarly, using the destinatin addresses, a destinatin splay tree is cnstructed as shwn in Table 2 and Figure 12. Table1. Surce prefixes cnversin

Figure11. Surce Splay Tree Table2. Destinatin Prefix Cnversin Figure11. Destinatin Splay Tree

Nw the surce and destinatin splay trees are t be linked. Fr this, we cnnect each leaf f the surce splay tree t the rt f the destinatin splay tree. This cnnectin pinter is similar t a Next-Trie pinter used in a hierarchical trie data structure. In rder t find ut the best matching filter, we cnvert the surce and destinatin prefixes f the search packet t integer values and then begin searching. We first see the integer surce value f the packet and find ut the filters whse lwer bund is less than the packet s surce integer value and whse upper bund is greater than the packet s destinatin integer value. In ther wrds, we pick ut all thse filters within whse range the search packet s value lies. Similarly, we find ut the matching filters fr the destinatin s integer value f the search packet. Then, we perfrm a simple cmparisn between the filters that have matched the surce and destinatin f the packet separately. T cnstruct a surce search table and a destinatin search table, we get the set f distinct integer values in bth the surce and destinatin trees and arrange them in the ascending rder. We nw find the set f filters that match all pints between the first and secnd integer values, between the secnd and third value and s n until the entire table is cnstructed as shwn in Tables 3 and 4. An example search packet is als shwn belw these tables. We firstly cnvert the prefixes f the search packet t integers and then find the separate surce and destinatin matching filters and finally find the final set f matching filters fr that particular search packet. Search Table3. Surce Search table Table4. Destinatin Search table

Example Search Objectives: 1- Use ClassBench tl t prduce sme synthetic rule-set and headers. 2- Implement SP-Classifier accrding t abve explanatin ( in C++ Only). 3- Stre yur rule-set in SP-Classifier 4- Classify synthetic packets f step1, and cmpute fllwing parameters: 1- Number f memry accesses fr classifying each packet 2- Max/ Min and average number f memry accesses fr classifying all synthetic packets. 5- Prepare a technical reprt explain steps f implementatin, simulatin and results! Prject due date is 18 Feb 2015 Gd Luck!