27 Kasım 2008 Perşembe

Ohoooo...

Ortalık tam bir request potporisi oldu.
Hep beraber tüm request tipleri kol-kola verdiler halaya tutuştular. Kim kime izin veriyo, nasıl veriyo, verince naapıyor hepten curcuna oldu..
En temizi kapıya sağlam bi adam dikeceksin, kimlik no falan sorucak akışlar için. Bak o zaman bant genişliği sorunu oluyo mu..

Karıştı bu laaaayn..

26 Kasım 2008 Çarşamba

----

Oley, Oley, oleeey...

24 Kasım 2008 Pazartesi

NS2 ve BB Uygulaması..

Ya vallaa, az önce BB için Book-Ahead rezervasyonu bitirdim. Immediate rezervasyonları da yapıyor. Bantgenişliği ayarlaması da yapıyor.
TCL ile simülasyonu da gerçekleştirdim. Rezervasyon yapılan zamanlarda akışlar anlaşılan bantgenişliği ile başlıyor..
Ama İbrahim hocadan hala ses yok. Bakalım ne zaman yanıt verecek..
Tabii bir de ne yanıt vereceği meselesi var..

23 Kasım 2008 Pazar

NS2 TimerHandler..

Tam olarak 4 saattir aptal bir handler ı çalıştırmaya çalışıyorum. Anlamadım ki neden, ama birden çalışmaya başladı. Üstelik başta yaptığım şeyin aynısını yapmışken..

Bu NS2 beni deli ediyor..

20 Kasım 2008 Perşembe

NS2 Scheduler: Event UID not valid!

While I was trying to send more than one packet at a time by C++ codes, like BROADCASTing, this problem occured.
The reason for the error is, giving the send command for the same packet again and again. Created packet had already been sent, so creating another packet with the same header but different destination and sending new packet each time solved the problem..


int tmp;
tmp = here_.addr_;//BBBase must be on the node created finally..
for(int i = 0; i <= tmp; i++){
dst_.addr_ = i;
Packet* gonderiPkt = allocpkt();
hdr_BB* hdr_gonderi = hdr_BB::access(gonderiPkt);
hdr_gonderi->cmd = UALIVE;
send(gonderiPkt, 0);
}
return (TCL_OK);



Ferhat Umut Dizdar..

18 Kasım 2008 Salı

Implementing new agent in NS

in packet.h file you have to add the lines;
static const packet_t PT_BBB = 62; (Certainly, 62 is based on your own packet.h file..)
and
name_[PT_BBB]="BBB";
Also, makefile must be edited to compile agentBB.cc file.
TCL Example;



set ns [new Simulator]

set testTime 20

set namFile [open out.nam w]
$ns namtrace-all $namFile

set traceFile [open out.tr w]
$ns trace-all $traceFile

proc bitir {} {
global ns traceFile namFile
$ns flush-trace
close $traceFile
close $namFile
#exec perl throughput.pl &
#exec nam out.nam &

exit 0
}


set src [$ns node]
set dst [$ns node]

$ns duplex-link $src $dst 10Mb 5ms DropTail
$ns duplex-link $dst $src 10Mb 5ms DropTail


set agentBB1 [new Agent/agentBB]
$ns attach-agent $src $agentBB1
set agentBB2 [new Agent/agentBB]
$ns attach-agent $dst $agentBB2
$ns connect $agentBB1 $agentBB2

$ns at 1.0 "$agentBB2 sendto $agentBB1 0"

$ns at [expr $testTime + 1.0] "bitir"

$ns run




Ferhat Umut Dizdar

Implementing new agent in NS--agentBB.h



#include "agent.h"
#include "tclcl.h"
#include "packet.h"
#include "address.h"
#include "ip.h"

struct hdr_BB{
int cmd;

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

class agentBB : public Agent {
public:
agentBB();
~agentBB();
virtual int command(int argc, const char*const* argv);
virtual void recv(Packet*, Handler*);
int sendto(nsaddr_t, int);
};


Implementing new agent in NS--agentBB.cc



#include "agentBB.h"

#define UALIVE 0 //Are you avlive
#define IMALIVE 1 //Yes I am alive

int hdr_BB::offset_;


static class agentBBHeaderClass : public PacketHeaderClass {
public:
agentBBHeaderClass() : PacketHeaderClass("PacketHeader/BBB",
sizeof(hdr_BB)) {
bind_offset(&hdr_BB::offset_);
}
} class_BBBhdr;

static class agentBBClass : public TclClass {
public:
agentBBClass() : TclClass("Agent/agentBB") {}
TclObject* create(int, const char*const*) {
return (new agentBB());
}
} class_agentBB;

agentBB::agentBB() : Agent(PT_BBB)
{
// printf("agentBB Constructor..");
}

agentBB::~agentBB(){
}

int agentBB::command(int argc, const char*const* argv)
{
if (argc == 4)
{
if (strcmp(argv[1], "sendto") == 0)
{
printf("Packet will be sent to Destination : %s with cmd : %d\n",argv[2], atoi(argv[3]));
return (sendto((nsaddr_t)atoi(argv[2]),atoi(argv[3])));
}
}
return (Agent::command(argc, argv));
}

void agentBB::recv(Packet* pkt, Handler*)
{
int cmd;
nsaddr_t senderAddress;

hdr_BB* hdr_BB_gelen = hdr_BB::access(pkt);
hdr_ip* hdr_ip_gelen = hdr_ip::access(pkt);
cmd = hdr_BB_gelen->cmd;
senderAddress = hdr_ip_gelen->saddr();
printf("Packet Received from %d with cmd : %d\n", senderAddress, cmd);
if(cmd==UALIVE){
printf("--Are You Alive Packet-- is Received..\n");
sendto(senderAddress, 1);
}
if(cmd==IMALIVE){
printf("--I am Alive Packet-- is Received..\n");
}
}

int agentBB::sendto(nsaddr_t destination, int cmd)
{
printf("Prepairing to send packet..\n");
dst_.addr_ = destination;

Packet* gonderiPkt = allocpkt();
hdr_BB* hdr_gonderi = hdr_BB::access(gonderiPkt);

if(cmd == UALIVE){
hdr_gonderi->cmd = UALIVE;
}
if(cmd == IMALIVE){
hdr_gonderi->cmd = IMALIVE;
}

send(gonderiPkt, 0);
return (TCL_OK);
}

16 Kasım 2008 Pazar

Implementing DSCP to NS Environment..

Öncelikle ip headerında DSCP tanımlaması için ip.h dosyası düzenlendi.
ip.cc ile C ve tcl bind gerçekleştirildi.
agent.h dosyasında ve agent.cc dosyasında gerekli düzenlemelere yapıldı. Böylece agent initpkt zamanında varsayılan DSCP ataması yapabilir.
ns-default.tcl de agent için varsayılan DSCP ataması yapıldı.
trace.cc de trace dosyasında DSCP görüntülenmesi sağlandı.
dsPolicy.h dosyasında policyTableEntry yapısında DSCP eklendi.
PolicyEntry eklemesi tcl üzerinden önceden source ve destination için gerçekleştiriliyordu.
$qE1C addPolicyEntry [$s1 id] [$dest id] TokenBucket 20 $cir0 $cbs0
Ancak bundan sonra
$qE1C addPolicyEntry $dscp TokenBucket 20 $cir0 $cbs0
şeklinde DSCP için gerçekleştirilecek. argv2 source argv3 destination argv4 queueType argv5 codePt argv6 cir argv7 winSize idi.
Bundan sonra argv2 dscp argv3 queueType argv4 codePt argv5 cir argv6 winSize(yada diğer parametre ne ise, cbs..) olacak. Yani argv değerleri 1 azaldı..
dsPolicy.cc de;
getPolicyTableEntry(int DSCP) olacak şekilde ayarlandı. Tabii, dsPolicy.h dosyasında da aynı ayar yapıldı.
printPolicyTable DSCP ile görüntüleme yapacak şekilde ayarlandı..

NS ve hatalar..

warning: no class variable Agent/UDP::DSCP_

see tcl-object.tcl in tclcl for info about this warning.
Bu hatanın nedeni C ile bir değişkenin Tcl ile bind edilmesi ancak ns-default.tcl dosyasından bağlantısının yapılmamasıdır.