[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ns] variable length packet header
use a hash table? See how classifiers make use of it, and so does Http stuff in
webcache/.
>Date: Tue, 31 Oct 2000 14:24:56 +0100 (MET)
>From: Jan Cerlot <[email protected]>
>Subject: [ns] variable length packet header
>To: [email protected]
>MIME-Version: 1.0
>Content-MD5: utkGqPKUpghNrx5gOt6jcA==
>
>Hi,
>
>I've created a new header to acknowledge received messages at one node. This
>node sends acknowledge packets every x ms. The problem is that, in this period
>of time, this node can receive 1 but also ... 1000 messages to acknowledge.
>Therefore I would like not to have a fixed array with the length 1000 that
would
>be often unused but a dynamic array whose length would grow with the number of
>messages to acknowldege.
>
>So now, I have something like that :
>
>in <rack.h> :
>
>struct hdr_rack {
>
> int sess_id_[1000];
>
> static int offset_;
> inline static int& offset() { return offset_; }
> inline static hdr_rack* access(Packet* p) {
> return (hdr_rack*) p->access(offset_);
> }
>
> int& sess_id(int i) {return sess_id_[i];}
>};
>
>and in <rack.cc> :
>
>int hdr_rack::offset_;
>
>static class RackHeaderClass : public PacketHeaderClass {
>public:
> RackHeaderClass() : PacketHeaderClass("PacketHeader/Rack",
> sizeof(hdr_rack)) {
> bind_offset(&hdr_rack::offset_);
> }
> void export_offsets() {
> field_offset("sess_id_", OFFSET(hdr_rack, sess_id_));
> }
>} class_rackhdr;
>
>What do I need to change to have this sess_id_ array dynamic ??
>
>Thanks a lot for your answers
>
> Jan.
Tarik