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

How can I get *Packet????



Hi all....
I'm modifying DRR. And run NS, NS.core occure..

Here is my problem.

Original DRR deque operation...

----snip---------
  pkt=curr->lookup(0);
  ch=(hdr_cmn*)pkt->access(off_cmn_);
  iph= (hdr_ip*)pkt->access(off_ip_);
  if (curr->deficitCounter >= ch->size()) {
   curr->deficitCounter -= ch->size();
   pkt=curr->deque();
   curr->bcount -= ch->size();
   --curr->pkts;
----snip---------


And here is mine
----- snip----------
 while (!pkt) {
...
  cout << "Curr Pointer" << curr << endl;
  cout << "Curr pkts" << curr->pkts << endl;
...
  pkt=curr->lookup(0);
  ch=(hdr_cmn*)pkt->access(off_cmn_);
  iph= (hdr_ip*)pkt->access(off_ip_);
  pkt=curr->deque();
  curr->bcount -= ch->size();
  --curr->pkts;
  --pktcnt;
  bytecnt -= ch->size();
....
  cout << "Curr pkts" << curr->pkts << endl;
  if (curr->pkts == 0) {
   curr->turn=0;
   --flwcnt;
   curr->deficitCounter=0;
   curr=curr->idle(curr);
  }
  else {
   pkt=curr->lookup(0); // HERE ERROR! CORE DUMP
   cout << "pkt pointer" << pkt << endl;
   ch=(hdr_cmn*)pkt->access(off_cmn_);
   iph=(hdr_ip*)pkt->access(off_ip_);
....

While output,
first current pkts(packet counter) = 7 and after deque, curr->pkts = 6.
so it seems that first packet served and remove frome the curr queue.
but when i access again using lookup(0) or lookup(1), (to access 2nd packet)

NS comre dumped...

I want that service 1st packet and read 2nd packet's header information(not
serving)

How can i access 2nd packet's header?

Did I miss something?

Any infomation fine.

Thx in advance.

______________________________________________________

ChoiYoungSoo
e-m@ail   : mailto:[email protected]
icq       : 43998959
myh0me    : http://palgong.knu.ac.kr/~guru0109