<< NL_I_NodePacketExtract NL_I: Internet NL_I_PMDeletePackets >>

NARVAL >> NL_I: Internet > NL_I_PMAddConnections

NL_I_PMAddConnections

Add new connections inside a packet manager.

Calling Sequence

[R,P,C] = NL_I_PMAddConnections(R,E,D,T,S)

Arguments

R :

Packet manager.

E :

Emission node of each new connection.

D :

Destination node of each new connection.

T :

Type of each new connection.

S :

Size of each new connection.

P :

Vector of packets ready to send.

C :

Size of each new connection correctly added to the packet manager.

Description

NL_I_PMAddConnections adds new connections inside the packet manager R. New connections are assumed to be stored inside 4 vectors, e.i. the emission node of each new connection E, their destination node D, their type T and their size S. P corresponds to the vector of packets ready to send. C represents the size of each new connection correctly added to R.

Examples

n=100;//network size
bs=15;//constant buffer size
network=NL_I_NetworkMatrixInit(n,bs);//initialization of the reception network matrix 
networks=NL_I_NetworkMatrixInit(n,bs);//initialization of the emission network matrix
tpmax=n*bs;//maximal quantity of packets simultaneously supported by each network matrix 
rp=NL_I_PacketManagerInit(tpmax);//initialization of the packet manager
nc=5;//quantity of new connections
en=[];//vector of emission nodes
dn=[];//vector of destination nodes
for i=1:nc
[nd,nf]=NL_F_RandIntNiNj(n);//generation of connection extreme nodes
en=[en nd];
dn=[dn nf];
end
cpmax=6;//maximal connection size
cs=int(cpmax*rand(1,nc))+1;//size of each new connection
cpt=ones(1,nc);//connection type: TCP
[rp,ps,csn]=NL_I_PMAddConnections(rp,en,dn,cpt,cs);//application of NL_I_PMAddConnections
rp(1:sum(csn),:)//display of new packets information
ps
csn

Dependency


Report an issue
<< NL_I_NodePacketExtract NL_I: Internet NL_I_PMDeletePackets >>