Add new connections inside a packet manager.
[R,P,C] = NL_I_PMAddConnections(R,E,D,T,S)
Packet manager.
Emission node of each new connection.
Destination node of each new connection.
Type of each new connection.
Size of each new connection.
Vector of packets ready to send.
Size of each new connection correctly added to the packet manager.
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.
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 | ![]() | ![]() |