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

fragmentation/reassembly functions at link layer



Hello folks,

I like to add some functions at link layer such as packet
fragmentation/reassembly for simulation of IP packets in different
network environments, e.g., ATM.

My idea is as follows: I would write a class "MyLink" derived from, say,
LinkDelay. On receipt of an ip_packet from higher layer, it performs
recv():

struct hdr_atm{
...
}

revc(Packet* ip_packet, Handler*){

	hdr_cmn* ch= (hdr_cmn*)ip_packet->access(hdr_cmn::offset_);
	cellNumber_= ch->size()/53;

	for (int i=0; i <= cellNumber_; i++) {
		Packet* p = Packet::alloc();
		copy_cmn_hdr_into_this_cmn_header();
		initialize_atm_header();
		target_->recv(p);
	}

	// .. and so on
}

I simply copy the hdr_cmn of the IP packet into hdr_cmn of the ATM
cells. The receiving end performs the reassembly function based on the
information carried in the hdr_cmn and hdr_atm of the ATM cells.

However, I think it would violate some rules noted in the ns
Documentation, namely:

- Only class Agent and its classes generate packets.
- hdr_cmn::uid_ must be unique.

My questions are:

- Can I do that?
- How can I set hdr_cmn::uid_?
- Has anyone already implemented link-layer fragmentation/reassembly or
has a better idea?

Thanks very much in advance.

Thanh

-- 
------------------------------------------------
    Nguyen Huu Thanh                      

    Universitaet der Bundeswehr Muenchen  
    Institut fuer informationstechnische Systeme
    Werner-Heisenberg-Weg 39
    85577 Neubiberg                        
    Tel.: +49 89 6004-2279                   
    Email: [email protected]  
-------------------------------------------------