Changeset 3 for trunk/Forms


Ignore:
Timestamp:
Sep 16, 2016, 10:49:27 PM (8 years ago)
Author:
chronos
Message:
  • Modified: Network address in each network interface should be full address not just single integer. Yet need to specify network subnets for routing.
Location:
trunk/Forms
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.lfm

    r2 r3  
    11object FormMain: TFormMain
    2   Left = 458
     2  Left = 262
    33  Height = 964
    4   Top = 362
     4  Top = 185
    55  Width = 1759
    66  Caption = 'ISP game'
     
    1010  OnDestroy = FormDestroy
    1111  OnShow = FormShow
     12  Position = poScreenCenter
    1213  LCLVersion = '1.7'
     14  WindowState = wsMaximized
    1315  object PaintBox1: TPaintBox
    1416    Left = 0
  • trunk/Forms/UFormMain.pas

    r2 r3  
    5959  with Network do begin
    6060    NodeRouter := AddRouter('router', Point(400, 300), 2, Log);
    61     TNetworkInterface(NodeRouter.Interfaces[0]).Address := 1;
    62     TNetworkInterface(NodeRouter.Interfaces[0]).Network := 3;
    63     TNetworkInterface(NodeRouter.Interfaces[1]).Address := 8;
    64     TNetworkInterface(NodeRouter.Interfaces[1]).Network := 4;
     61    NodeRouter.Interfaces[0].Address := NetworkAddress([1]);
     62    NodeRouter.Interfaces[0].Network := 3;
     63    NodeRouter.Interfaces[1].Address := NetworkAddress([8]);;
     64    NodeRouter.Interfaces[1].Network := 4;
    6565    NodeSwitch := AddSwitch('switch', Point(200, 200), 4);
    6666    NodeSwitch2 := AddSwitch('switch2', Point(700, 200), 4);
    6767    NodeGeorge := AddHost('george', Point(100, 100), 1, Log);
    68     TNetworkInterface(NodeGeorge.Interfaces[0]).Address := 2;
     68    NodeGeorge.Interfaces[0].Address := NetworkAddress([2]);;
    6969    NodeFranta := AddHost('franta', Point(200, 100), 1, Log);
    70     TNetworkInterface(NodeFranta.Interfaces[0]).Address := 3;
     70    NodeFranta.Interfaces[0].Address := NetworkAddress([3]);;
    7171    NodeHonza := AddHost('honza', Point(300, 100), 1, Log);
    72     TNetworkInterface(NodeHonza.Interfaces[0]).Address := 4;
     72    NodeHonza.Interfaces[0].Address := NetworkAddress([4]);;
    7373    NodeJakub := AddHost('jakub', Point(600, 100), 1, Log);
    74     TNetworkInterface(NodeJakub.Interfaces[0]).Address := 2;
     74    NodeJakub.Interfaces[0].Address := NetworkAddress([2]);;
    7575    NodeMonika := AddHost('monika', Point(700, 100), 1, Log);
    76     TNetworkInterface(NodeMonika.Interfaces[0]).Address := 3;
     76    NodeMonika.Interfaces[0].Address := NetworkAddress([3]);;
    7777
    78     TNetworkInterface(NodeFranta.Interfaces[0]).Connect(TNetworkInterface(NodeSwitch.Interfaces[1]));
    79     TNetworkInterface(NodeGeorge.Interfaces[0]).Connect(TNetworkInterface(NodeSwitch.Interfaces[0]));
    80     TNetworkInterface(NodeHonza.Interfaces[0]).Connect(TNetworkInterface(NodeSwitch.Interfaces[2]));
     78    NodeFranta.Interfaces[0].Connect(NodeSwitch.Interfaces[1]);
     79    NodeGeorge.Interfaces[0].Connect(NodeSwitch.Interfaces[0]);
     80    NodeHonza.Interfaces[0].Connect(NodeSwitch.Interfaces[2]);
    8181
    82     TNetworkInterface(NodeSwitch.Interfaces[3]).Connect(TNetworkInterface(NodeRouter.Interfaces[0]));
    83     TNetworkInterface(NodeSwitch2.Interfaces[0]).Connect(TNetworkInterface(NodeRouter.Interfaces[1]));
     82    NodeSwitch.Interfaces[3].Connect(NodeRouter.Interfaces[0]);
     83    NodeSwitch2.Interfaces[0].Connect(NodeRouter.Interfaces[1]);
    8484
    85     TNetworkInterface(NodeJakub.Interfaces[0]).Connect(TNetworkInterface(NodeSwitch2.Interfaces[1]));
    86     TNetworkInterface(NodeMonika.Interfaces[0]).Connect(TNetworkInterface(NodeSwitch2.Interfaces[2]));
     85    NodeJakub.Interfaces[0].Connect(NodeSwitch2.Interfaces[1]);
     86    NodeMonika.Interfaces[0].Connect(NodeSwitch2.Interfaces[2]);
    8787
    8888    NodeGeorge.Ping(NetworkAddress([1, 4]));
Note: See TracChangeset for help on using the changeset viewer.