⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 classifier-obs-port.cc

📁 obs网络试验平台
💻 CC
字号:
/* Copyright (c) University of Maryland, Baltimore County, 2003. * Original Authors: Ramakrishna Shenai, Sunil Gowda and Krishna Sivalingam. * * This software is developed at the University of Maryland, Baltimore County under * grants from Cisco Systems Inc and the University of Maryland, Baltimore County. * * Permission to use, copy, modify, and distribute this software and its * documentation in source and binary forms for non-commercial purposes * and without fee is hereby granted, provided that the above copyright * notice appear in all copies and that both the copyright notice and * this permission notice appear in supporting documentation. and that * any documentation, advertising materials, and other materials related * to such distribution and use acknowledge that the software was * developed by the University of Maryland, Baltimore County.  The name of * the University may not be used to endorse or promote products derived from * this software without specific prior written permission. * * Copyright (C) 2000-2003 Washington State University. All rights reserved. * This software was originally developed at Alcatel USA and subsequently modified * at Washington State University, Pullman, WA  through research work which was * supported by Alcatel USA, Inc and Cisco Systems Inc. * The  following notice is in adherence to the Washington State University * copyright policy follows. * * License is granted to copy, to use, and to make and to use derivative * works for research and evaluation purposes, provided that Washington * State University is acknowledged in all documentation pertaining to any such * copy or derivative work. Washington State University grants no other * licenses expressed or implied. The Washington State University name * should not be used in any advertising without its written permission. * * WASHINGTON STATE UNIVERSITY MAKES NO REPRESENTATIONS CONCERNING EITHER * THE MERCHANTABILITY OF THIS SOFTWARE OR THE SUITABILITY OF THIS SOFTWARE * FOR ANY PARTICULAR PURPOSE.  The software is provided "as is" *  without express or implied warranty of any kind. These notices must * be retained in any copies of any part of this software. */# include "classifier-obs-port.h"OBSPortClassifier::OBSPortClassifier() : Classifier()  {    bind( "address_", (int*)(&address_) ); //GMG -- cast &address_ as an int* because address_ is of type nasaddr_, which                                           //is typecast as int32_t, which is typecast as long int on cygwin; this does                                           //not match any of the templates for bind in tclcl.h; the closest matching                                           //template is where 2nd argument is of type int.    iAgent_ = NULL;}void OBSPortClassifier::recv( Packet *p, Handler * ) {    if( ( iAgent_ == NULL ) || ( p == NULL ) ){        Debug::debug( __FILE__, __LINE__, "Error Iagent is unitialized or provided packet is NULL" );        return;    }    hdr_cmn* ch = hdr_cmn::access( p );    hdr_ip* iph = hdr_ip::access( p  );    int src_addr = mshift( iph->saddr() ),        des_addr = mshift( iph->daddr() );    //sprintf( s, "Portclassifier at node %d", address_ );    // Debug::debug( s );     if( ( ch->ptype() == PT_IPKT ) && ( des_addr == address_ ) )        iAgent_->recv( p );    else {        if( src_addr == address_ )  {            iAgent_->recv( p );        }        else if( des_addr == address_ ) {          //  Debug::debug( "Portclassifier: received a tcp (or) ack packet" );            slot_[iph->dport()]->recv( p );        }        else {          //  Debug::debug( "Edge-port-classifier: error unknown destination" );            return;        }    }}int OBSPortClassifier::command( int argc, const char*const* argv ) {    if( argc == 3 )    if (strcmp(argv[1], "install-iagent") == 0) {        NsObject* node = (NsObject*)TclObject::lookup( argv[2] );        iAgent_ = node;        return (TCL_OK);    }    return( Classifier::command( argc, argv ) );}static class OBSPortClassifierClass : public TclClass {public:    OBSPortClassifierClass() : TclClass( "Classifier/OBSPort" ) {}    TclObject* create(int, const char*const*) {        return ( new OBSPortClassifier() );    }} class_obs_port_classifier;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -