classifier-pgm.cc
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:3k
源码类别:

通讯编程

开发平台:

Visual C++

  1. /*
  2.  * classifier-pgm.cc
  3.  * Copyright (C) 2001 by the University of Southern California
  4.  * $Id: classifier-pgm.cc,v 1.4 2006/02/21 15:20:19 mahrenho Exp $
  5.  *
  6.  * This program is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU General Public License,
  8.  * version 2, as published by the Free Software Foundation.
  9.  *
  10.  * This program is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  * GNU General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU General Public License along
  16.  * with this program; if not, write to the Free Software Foundation, Inc.,
  17.  * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
  18.  *
  19.  *
  20.  * The copyright of this module includes the following
  21.  * linking-with-specific-other-licenses addition:
  22.  *
  23.  * In addition, as a special exception, the copyright holders of
  24.  * this module give you permission to combine (via static or
  25.  * dynamic linking) this module with free software programs or
  26.  * libraries that are released under the GNU LGPL and with code
  27.  * included in the standard release of ns-2 under the Apache 2.0
  28.  * license or under otherwise-compatible licenses with advertising
  29.  * requirements (or modified versions of such code, with unchanged
  30.  * license).  You may copy and distribute such a system following the
  31.  * terms of the GNU GPL for this module and the licenses of the
  32.  * other code concerned, provided that you include the source code of
  33.  * that other code when and as the GNU GPL requires distribution of
  34.  * source code.
  35.  *
  36.  * Note that people who make modified versions of this module
  37.  * are not obligated to grant this special exception for their
  38.  * modified versions; it is their choice whether to do so.  The GNU
  39.  * General Public License gives permission to release a modified
  40.  * version without this exception; this exception also makes it
  41.  * possible to release a modified version which carries forward this
  42.  * exception.
  43.  *
  44.  */
  45. /*
  46.  * Pragmatic General Multicast (PGM), Reliable Multicast
  47.  *
  48.  * classifier-pgm.cc
  49.  *
  50.  * This is the classifier used to pick out PGM packets entering a node.
  51.  *
  52.  * Ryan S. Barnett, 2001
  53.  * rbarnett@catarina.usc.edu
  54.  */
  55. #include "config.h"
  56. #ifdef HAVE_STL
  57. #include "config.h"
  58. #include "packet.h"
  59. #include "ip.h"
  60. #include "classifier.h"
  61. class PgmClassifier : public Classifier {
  62. public:
  63.   PgmClassifier();
  64. protected:
  65.   int classify(Packet *const p)
  66.   {
  67.     hdr_cmn* h = HDR_CMN(p);
  68.     if (h->ptype_ == PT_PGM) {
  69.       return 1;
  70.     }
  71.     else {
  72.       return 0;
  73.     }
  74.   }
  75. };
  76. static class PgmClassifierClass : public TclClass {
  77. public:
  78. PgmClassifierClass() : TclClass("Classifier/Pgm") {}
  79. TclObject* create(int, const char*const*) {
  80. return (new PgmClassifier());
  81. }
  82. } class_pgm_classifier;
  83. PgmClassifier::PgmClassifier() {}
  84. #endif //HAVE_STL