📄 node48.html
字号:
<html><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><!--Converted with jLaTeX2HTML 2002 (1.62) JA patch-1.4patched version by: Kenshi Muto, Debian Project.LaTeX2HTML 2002 (1.62),original version by: Nikos Drakos, CBLU, University of Leeds* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan* with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --><HTML><HEAD><TITLE>5.4.1 Address Classifiers</TITLE><META NAME="description" CONTENT="5.4.1 Address Classifiers"><META NAME="keywords" CONTENT="everything"><META NAME="resource-type" CONTENT="document"><META NAME="distribution" CONTENT="global"><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"><META NAME="Generator" CONTENT="jLaTeX2HTML v2002 JA patch-1.4"><META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"><LINK REL="STYLESHEET" HREF="everything.css" tppabs="http://www.isi.edu/nsnam/ns/doc/everything.css"><LINK REL="next" HREF="node49.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node49.html"><LINK REL="previous" HREF="node47.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node47.html"><LINK REL="up" HREF="node47.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node47.html"><LINK REL="next" HREF="node49.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node49.html"></HEAD><BODY ><!--Navigation Panel--><A NAME="tex2html2059" HREF="node49.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node49.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html2053" HREF="node47.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node47.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html2047" HREF="node47.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node47.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html2055" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html"><IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="file:/usr/share/latex2html/icons/contents.png"></A> <A NAME="tex2html2057" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html"><IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="file:/usr/share/latex2html/icons/index.png"></A> <BR><B> Next:</B> <A NAME="tex2html2060" HREF="node49.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node49.html">5.4.2 Multicast Classifiers</A><B> Up:</B> <A NAME="tex2html2054" HREF="node47.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node47.html">5.4 The Classifier</A><B> Previous:</B> <A NAME="tex2html2048" HREF="node47.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node47.html">5.4 The Classifier</A>   <B> <A NAME="tex2html2056" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html2058" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html">Index</A></B> <BR><BR><!--End of Navigation Panel--><H2><A NAME="SECTION03241000000000000000"></A><A NAME="sec:node:addr-classifier"></A><BR>5.4.1 Address Classifiers</H2><P>An address classifier is used in supporting unicast packet forwarding.It applies a bitwise shift and mask operation to a packet's destinationaddress to produce a slot number.The slot number is returned from the []classify method.The AddressClassifier../ns-2/classifier-addr.cc(defined in classifier-addr.cc) ide defined as follows:<PRE> class AddressClassifier : public Classifier { public: AddressClassifier() : mask_(~0), shift_(0) { bind("mask_", (int*)&mask_); bind("shift_", &shift_); } protected: int classify(Packet *const p) { IPHeader *h = IPHeader::access(p-\>bits()); return ((h-\>dst() \>\> shift_) & mask_); } nsaddr_t mask_; int shift_; };</PRE>The class imposes no direct semantic meaningon a packet's destination address field.Rather, it returns some number of bits from the packet's<TT>dst_</TT> field as the slot number usedin the []Classifier::recv../ns-2/classifier.ccClassifier::recv method.The <TT>mask_</TT> and <TT>shift_</TT> values are set through OTcl.<P><BR><HR><ADDRESS>2003-09-23</ADDRESS></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -