I tried emulating ip in ns2 to create ipv6, just to increase header size to
emulate ipv6 and make use of fid field and priority field.
After duplicatin the ip.cc/h to ipv6.cc/h. I changed the variable names to
reflect
ipv6 i.e append v6 to places where ip are.

/ns-2.28/common/ipv6.cc
#ifndef lint
static const char rcsid[] =
    "@(#) $Header: /nfs/jade/vint/CVSROOT/ns-2/common/ip.cc,v 1.8 1998/08/12
23:41:05 gnguyen Exp $";
#endif


#include "packet.h"
#include "ipv6.h"

int hdr_ipv6::offset_;


static class IPHeaderClass : public PacketHeaderClass {
public:
        IPHeaderClass() : PacketHeaderClass("PacketHeader/IPV6",
                                            sizeof(hdr_ipv6)) {
                bind_offset(&hdr_ipv6::offset_);
        }
        void export_offsets() {
                field_offset("src_", OFFSET(hdr_ipv6, src_));
                field_offset("dst_", OFFSET(hdr_ipv6, dst_));
                field_offset("ttl_", OFFSET(hdr_ipv6, ttl_));
                field_offset("fid_", OFFSET(hdr_ipv6, fid_));
                field_offset("prio_", OFFSET(hdr_ipv6, prio_));
        }
} class_iphdrv6;


/ns-2.28/common/ipv6.h

/* a network layer; basically like IPv6 */
#ifndef ns_ip_h
#define ns_ip_h

#include "config.h"
#include "packet.h"


#define IP_HDR_LEN      40
#define IP_DEF_TTL      32

// The following undef is to suppress warnings on systems were
// IP_BROADCAST is defined.
#ifdef IP_BROADCAST
#undef IP_BROADCAST
#endif

#define IP_BROADCAST    ((u_int32_t) 0xffffffff)

struct hdr_ipv6 {
        /* common to IPv{4,6} */
        ns_addr_t       src_;
        ns_addr_t       dst_;
        int             ttl_;

        /* Monarch extn */
//      u_int16_t       sport_;
//      u_int16_t       dport_;

        /* IPv6 */
        int             fid_;   /* flow id */
        int             prio_;

        static int offset_;
        inline static int& offset() { return offset_; }
        inline static hdr_ipv6* access(const Packet* p) {
                return (hdr_ipv6*) p->access(offset_);
        }

        /* per-field member acces functions */
        ns_addr_t& src() { return (src_); }
        nsaddr_t& saddr() { return (src_.addr_); }
        int32_t& sport() { return src_.port_;}

        ns_addr_t& dst() { return (dst_); }
        nsaddr_t& daddr() { return (dst_.addr_); }
        int32_t& dport() { return dst_.port_;}
        int& ttl() { return (ttl_); }
        /* ipv6 fields */
        int& flowid() { return (fid_); }
        int& prio() { return (prio_); }
};

#endif


After this, I made modifications to:
/ns-2.28/common/packet.h
#define HDR_MAC_TDMA(p) ((hdr_mac_tdma *)hdr_mac::access(p))
#define HDR_SMAC(p)     ((hdr_smac *)hdr_mac::access(p))
#define HDR_LL(p)       (hdr_ll::access(p))
#define HDR_IP(p)       (hdr_ip::access(p))
//Added by Omotayo Lekan for IPv6
#define HDR_IPV6(p)     (hdr_ipv6::access(p))
#define HDR_RTP(p)      (hdr_rtp::access(p))
#define HDR_TCP(p)      (hdr_tcp::access(p))
#define HDR_SCTP(p)     (hdr_sctp::access(p))

changes in ns-2.28/tcl/lib/ns-packet.tcl
        Encap
        Flags
        HttpInval
        IMEP
        IP
# Added by Omotayo Lekan, IPv6 modification
        IPV6
        IPinIP
        IVS
        LDP
        LL
        mcastCtrl
        MFTP
        MPLS


no changes were made to ns-2.28/common/packet.cc, ns-2.28/tcl/lib/ns-
default.tcl, ns-2.28/tcl/lib/ns-lib



--- Classfier::no-slot{} default handler (tcl/lib/ns-lib.tcl) ---
        _o21: no target for slot 31
        _o21 type: Classifier/Addr
content dump:
classifier _o21
        0 offset
        11 shift
        2047 mask
        0 slots
---------- Finished standard no-slot{} default handler ----------

Reply via email to