<< NL_I: Internet NL_I: Internet NL_I_Connection >>

NARVAL >> NL_I: Internet > NL_I_AddPackets2Network

NL_I_AddPackets2Network

Add new packets of a single connection inside an emission network matrix.

Calling Sequence

[N,R] = NL_I_AddPackets2Network(V,N,R)

Arguments

V :

Vector of connection packets.

N :

Emission network matrix.

R :

Packet manager.

Description

NL_I_AddPackets2Network adds the new packets V of a single connection inside the emission network matrix N. Packets are assumed to be already stored inside the packet manager 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=[];//emission node
dn=[];//destination node
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 connection
cpt=ones(1,nc);//connection type: in this case TCP
[rp,ps,csn]=NL_I_PMAddConnections(rp,en,dn,cpt,cs);//generation of connection packets inside the packet manager
networks(en,:)//emission network matrix initial state for each new connection starting node
ip=[];
for k=1:length(csn)
ip=ip($)+1:sum(csn(1:k));//index of all packets belonging to each connection
[networks,rp]=NL_I_AddPackets2Network(ps(ip),networks,rp);//application of NL_I_AddPackets2Network
end
rp(1:sum(csn),:)//new state of the packet manager
networks(en,:)//new state of the emission network matrix for each new connection starting node

Dependency

NL_I_NodeBufferExtract, , NL_I_PMDeletePackets

Report an issue
<< NL_I: Internet NL_I: Internet NL_I_Connection >>