[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ns] TCl class problem



Debo,

I am attaching below two of the C++ files (marker.cc and marker.h) that I 
want to add. Just to mention again, the respective object (marker.o) was 
created when I did a ./configure followed by a "make".
But some how when I tried to test it, using a basic command
[lsmattos@pcmt5 ns-2.1b6]$ ns
% Marker
invalid command name "Marker"

I must say that I have no problems at all with the files (codes) that were 
provided by ns-allione-2.1b6. Let's say, I do the same thing to test tbf.cc 
, provided by ns itself. I got a message that makes sense, recognizing that 
the class TBF exists.

% TBF
wrong # args: should be {TBF message ?args...?}

I am quite desperate to find out my problem. I must also say that I looked 
for similar problems in the mailing list but did not find anything.
Any help will be really appreciated.
Leo



/* -*-  Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
/*
* Copyright (c) Xerox Corporation 1997. All rights reserved.
*
* License is granted to copy, to use, and to make and to use derivative
* works for research and evaluation purposes, provided that Xerox is
* acknowledged in all documentation pertaining to any such copy or
* derivative work. Xerox grants no other licenses expressed or
* implied. The Xerox trade name should not be used in any advertising
* without its written permission.
*
* XEROX CORPORATION 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.
*/

/*
* Copyright Xiao Hannan, Augest 1999. All rights reserved.
*
* Happy day
*
*/

#include "../connector.h"
#include "../ip.h"
#include "marker.h"

Marker::Marker() {
}

Marker::~Marker() {
}


void Marker::recv(Packet *p, Handler *) {
#ifdef hannan_debug
printf("Entering Marker::recv\n");
#endif
    hdr_ip* iph=hdr_ip::access(p);

    /* currently, we do nothing in a Marker, just let the priority field in 
IP header as the marker */
    tag = iph->prio_ ;
    target_->recv(p);
#ifdef hannan_debug
printf("Leaving Marker::recv\n");
#endif
}


static class MarkerClass : public TclClass {
public:
    MarkerClass() : TclClass ("Marker") {}
    TclObject* create(int,const char*const*) {
        return (new Marker());
    }
}class_marker;



/* -*-  Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
/*
* Copyright (c) Xerox Corporation 1997. All rights reserved.
*
* License is granted to copy, to use, and to make and to use derivative
* works for research and evaluation purposes, provided that Xerox is
* acknowledged in all documentation pertaining to any such copy or
* derivative work. Xerox grants no other licenses expressed or
* implied. The Xerox trade name should not be used in any advertising
* without its written permission.
*
* XEROX CORPORATION 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.
*/

/*
* Copyright Xiao Hannan, Augest 1999. All rights reserved.
*
* Happy day
*
*/

#ifndef hannan_debug
// #define hannan_debug
#endif

#ifndef hannan_marker_h
#define hannan_marker_h

#include "../connector.h"
#include "../packet.h"

#ifndef INOUT
#define INOUT
#ifdef ACKIN
#define IN 0
#define OUT 1
#endif
#ifdef ACKOUT
#define IN 1
#define OUT 0
#endif
#endif

class Marker;

class Marker : public Connector {
public:
    Marker();
    ~Marker();
    int tag;
    void recv(Packet *, Handler * );
};

#endif













>From: Debojyoti Dutta <[email protected]>
>To: Leonardo Mattos <[email protected]>
>CC: [email protected]
>Subject: Re: [ns] TCl class problem
>Date: Wed, 18 Oct 2000 23:07:10 -0700 (PDT)
>
>could you include your exact error message ? did you register your class
>in the trcl hierarchy properly. see any sample file eg tcp.cc .... what
>command did you use to instantiate the object ?
>
>debo
>
>On Tue, 17 Oct 2000, Leonardo Mattos wrote:
>
> > Hi all,
> > I am using ns-allinone2.1b6 under Linux RedHat 6.2
> > I wanted to add a C++ code to NS.
> > I added the  .o correspondent file in my Makefile.in, did the 
>./configure
> > and make successfully, but unfortunately when I tried to check for the
> > TclClass created with the C++ code I got a:
> > "invalid command name" message as if the TCl class did not exist.
> > I checked my files and the .o file was created when I did make.
> >
> > Since the "make" went fine, I do not understand why ns is not 
>recognizing my
> > new code.
> > Can anybody help???
> > Please??!!
> >
> > Thanks,
> > Leo
> >
> >
> >
> >
> > 
>_________________________________________________________________________
> > Get Your Private, Free E-mail from MSN Hotmail at 
>http://www.hotmail.com.
> >
> > Share information about yourself, create your own public profile at
> > http://profiles.msn.com.
> >
> >
>

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.