Рефераты. Проектирование и разработка сетевых броузеров на основе теоретико-графовых моделей

  SMTP in 'Smtp.pas', {Mail}

  FTP in 'ftp.pas', {MyFtp}

  NNTP in 'nntp.pas', {NewsForm}

  CHAT in 'chat.pas'; {ChatForm}

{$R *.RES}

begin

  Application.Initialize;

  Application.CreateForm(TMainForm, MainForm);

  Application.CreateForm(TDocSourceFrm, DocSourceFrm);

  Application.run;

end.

Приложение 1. Исходный текст модели корпоративной сети

uses crt,dos,graph;

CONST VertexQuantity=7;

      DelayInDomain=1000;

      DelaySendToRouter=1000;

      DelayRouterReceive=1000;

 AdjacencyMatrix : array[1..VertexQuantity,1..VertexQuantity] of byte =(

                              (0,1,0,1,0,0,0),

                              (1,0,1,0,1,0,1),

                              (0,1,0,1,0,0,0),

                              (1,0,1,0,1,0,0),

                              (0,1,0,1,0,1,0),

                              (0,0,0,0,1,0,1),

                              (0,1,0,0,0,1,0)   );

TYPE TAddr = record   {address format}

 router:byte;

 domain:byte;

 comp  :byte;

END;

TYPE TBatch = record  {batch format}

 from:TAddr;

 to_ :TAddr;

 data:string;

 path:array[1..20] of byte; {path is chain of router numbers}

END;

TYPE TComp = object {terminal}

  addr:TAddr;           {adress}

  mem :TBatch;         {memory}

Procedure Send2Router(batch:TBatch);{send batch}

Procedure Send(batch:TBatch);{send batch into domain}

Procedure Receive(batch:TBatch;byRouter:boolean); {receive batch}

END;

TYPE TRouter = object

       num    :byte;

       x,y      :integer;

       memory          :Tbatch;

       state   :boolean; {active or inactive}

Procedure Receive(routerNum:byte;batch:TBatch);

Procedure Send2Comp(batch:TBatch);

Procedure CalcMinPath(sender,target:byte);

Procedure Send2NextRouter(batch:TBatch;currentRouter:byte);

END;

VAR computers       : array[1..38] of TComp; {all computers in the global net}

    routers    : array[1..7] of TRouter;{all routers in the global net}

    OptimalPath   : array[1..49] of byte;{1--> [1,2,3,4,5]}

    OptPathPtr      : byte;

type TMark = record

 delta   : integer;

 prevPtr : byte;

end;

type vertex = record

 mark   : TMark;

 marked : boolean;

end;

AdjacencyRec = record

 link  :byte;

 weight:integer;

end;

VAR  AMatr     : array[1..7,1..7] of AdjacencyRec;

          vertexArr : array [1..7] of vertex;

PROCEDURE HiddenCursor;assembler;

      asm

       mov  ah,01

       mov  ch,20

       mov  cl,18

       int  10h

      end;

PROCEDURE NormalCursor;assembler;

      asm

       mov  ah,01

       mov  ch,9

       mov  cl,10

       int  10h

      end;

Procedure Push(num:byte);

Begin

  OptimalPath[OptPathPtr+1]:=num;inc(OptPathPtr);

End;

Procedure Pop;

Begin

  OptimalPath[OptPathPtr]:=0;dec(OptPathPtr);

End;

Procedure ShowGraphics(second:boolean);

Var grDr,grMode:integer;

          i  :integer;

Begin

  grDr:=vga;grMode:=2;

  InitGraph(grDr,grMode,'d:\lang\tp\bgi');

  SetTextStyle(DefaultFont,HorizDir,2);SetColor(lightRed);

  OutTextXY(10,20,'Arrangement scheme of routers');

  SetColor(white);Rectangle(5,15,480,40);

  Rectangle(5,48,480,70);SetTextStyle(DefaultFont,HorizDir,1);setcolor(lightgreen);

  OutTextXY(10,55,'Main address : Router.Domain.Computer (for ex., 4.2.4)');

  setcolor(white);setFillStyle(7,lightblue);floodfill(5,5,white);

  setlinestyle(0,0,3);

  rectangle(0,0,getmaxX-20,getmaxY-20);

  setFillStyle(9,lightgray);

  floodfill(getmaxX,getmaxY,white);

  setlinestyle(0,0,NormWidth);

  SetFillStyle(1,red);

                    {-------------------router circles-----------------------}

  Circle(routers[1].x,routers[1].y,10);FloodFill(routers[1].x,routers[1].y,white);

  Circle(routers[2].x,routers[2].y,10);FloodFill(routers[2].x,routers[2].y,white);

  Circle(routers[3].x,routers[3].y,10);FloodFill(routers[3].x,routers[3].y,white);

  Circle(routers[4].x,routers[4].y,10);FloodFill(routers[4].x,routers[4].y,white);

  Circle(routers[5].x,routers[5].y,10);FloodFill(routers[5].x,routers[5].y,white);

  Circle(routers[6].x,routers[6].y,10);FloodFill(routers[6].x,routers[6].y,white);

  Circle(routers[7].x,routers[7].y,10);FloodFill(routers[7].x,routers[7].y,white);

  SetFillStyle(1,yellow);

  SetColor(red);{-------------------router lines-------------------------}

  Line(routers[1].x,routers[1].y-10,routers[2].x-2,routers[2].y+10);

  Line(routers[1].x,routers[1].y+10,routers[4].x-10,routers[4].y-6);

  Line(routers[3].x,routers[3].y-10,routers[2].x+2,routers[2].y+10);

  Line(routers[3].x,routers[3].y+10,routers[4].x,routers[4].y-10);

  Line(routers[2].x+4,routers[2].y+10,routers[5].x-2,routers[5].y-10);

  Line(routers[2].x+10,routers[2].y,routers[7].x-10,routers[7].y);

  Line(routers[5].x+2,routers[5].y-10,routers[6].x,routers[6].y+10);

  Line(routers[6].x,routers[6].y-10,routers[7].x,routers[7].y+10);

  Line(routers[4].x+10,routers[4].y,routers[5].x-10,routers[5].y);

{domains}      {-------------domain 1.1----------------------------------}

  SetTextStyle(DefaultFont,HorizDir,1);SetColor(white);

  Rectangle(routers[1].x-50,routers[1].y-50,routers[1].x-30,routers[1].y-20 );

  FloodFill(routers[1].x-48,routers[1].y-48,white);

  Circle(20,routers[1].y-30,8);FloodFill(20,routers[1].y-30,white);

  Circle(40,routers[1].y-30,8);FloodFill(40,routers[1].y-30,white);

  Circle(60,routers[1].y-30,8);FloodFill(60,routers[1].y-30,white);

  SetColor(white);

  Line(routers[1].x-5,routers[1].y-10,routers[1].x-20,routers[1].y-30);

  Line(routers[1].x-20,routers[1].y-30,routers[1].x-110,routers[1].y-30);

                    {-------------domain 1.2----------------------------------}

  Rectangle(routers[1].x-30,routers[1].y+80,routers[1].x-5,routers[1].y+92);

  FloodFill(routers[1].x-28,routers[1].y+82,white);

  Line(routers[1].x-2,routers[1].y+10,routers[1].x-20,routers[1].y+80);

  Circle(routers[1].x-48,routers[1].y+62,9);

  FloodFill(routers[1].x-48,routers[1].y+62,white);

  Line(routers[1].x-28,routers[1].y+82,routers[1].x-52,routers[1].y+62);

  Circle(routers[1].x+10,routers[1].y+62,8);

  FloodFill(routers[1].x+10,routers[1].y+62,white);

  Line(routers[1].x-5,routers[1].y+82,routers[1].x+10,routers[1].y+62);

  Circle(routers[1].x-48,routers[1].y+92,8);

  FloodFill(routers[1].x-48,routers[1].y+92,white);

  Line(routers[1].x-28,routers[1].y+90,routers[1].x-48,routers[1].y+92);

  Circle(routers[1].x-43,routers[1].y+115,8);

  FloodFill(routers[1].x-43,routers[1].y+115,white);

  Line(routers[1].x-23,routers[1].y+90,routers[1].x-48,routers[1].y+115);

  Circle(routers[1].x-18,routers[1].y+115,8);

  FloodFill(routers[1].x-18,routers[1].y+115,white);

  Line(routers[1].x-18,routers[1].y+90,routers[1].x-18,routers[1].y+115);

  Circle(routers[1].x+13,routers[1].y+113,8);

  FloodFill(routers[1].x+13,routers[1].y+113,white);

  Line(routers[1].x-5,routers[1].y+92,routers[1].x+13,routers[1].y+113);

                    {-------------domain 2.1----------------------------------}

  Rectangle(routers[2].x-25,routers[2].y+70,routers[2].x+16,routers[2].y+79);

  FloodFill(routers[2].x-24,routers[2].y+72,white);

  Line(routers[2].x,routers[2].y+10,routers[2].x-5,routers[2].y+70);

  Circle(routers[2].x-24,routers[2].y+100,8);

  FloodFill(routers[2].x-24,routers[2].y+100,white);

  Line(routers[2].x,routers[2].y+72,routers[2].x-24,routers[2].y+100);

                    {-------------domain 2.2----------------------------------}

  Rectangle(routers[2].x-80,routers[2].y+10,routers[2].x-60,routers[2].y+37);

  FloodFill(routers[2].x-78,routers[2].y+12,white);

  Line(routers[2].x-10,routers[2].y,routers[2].x-70,routers[2].y+20);

  Circle(routers[2].x-110,routers[2].y+20,8);

  FloodFill(routers[2].x-110,routers[2].y+20,white);

  Circle(routers[2].x-140,routers[2].y+20,8);

  FloodFill(routers[2].x-140,routers[2].y+20,white);

  Line(routers[2].x-70,routers[2].y+20,routers[2].x-150,routers[2].y+20);

                    {-------------domain 3.1----------------------------------}

  Rectangle(routers[3].x-45,routers[3].y-47,routers[3].x-25,routers[3].y-20);

  FloodFill(routers[3].x-43,routers[3].y-45,white);

  Circle(routers[3].x-60,routers[3].y-37,8);

  FloodFill(routers[3].x-60,routers[3].y-37,white);

  Circle(routers[3].x-80,routers[3].y-37,8);

  FloodFill(routers[3].x-80,routers[3].y-37,white);

  Line(routers[3].x-7,routers[3].y-8,routers[3].x-35,routers[3].y-37);

  Line(routers[3].x-35,routers[3].y-37,routers[3].x-90,routers[3].y-37);

Страницы: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17



2012 © Все права защищены
При использовании материалов активная ссылка на источник обязательна.