示例#1
0
 public SwitchAction(SwitchActionType type, EthernetFrame frame, int vLANID, SwitchPort destPort = null)
 {
     this.Type  = type;
     this.Frame = frame;
     DestPort   = destPort;
     VLANID     = vLANID;
 }
 internal void Set(SwitchPort port, bool vlanSet, bool tagit)
 {
     tagDecicisionPerPort[port]  = tagit;
     sendDecicisionPerPort[port] = vlanSet;
 }
 public bool SendToPort(SwitchPort port)
 {
     return(sendDecicisionPerPort[port]);
 }
 public bool TagForPort(SwitchPort port)
 {
     return(tagDecicisionPerPort[port]);
 }
示例#5
0
 public EthernetHost(string mAC, int vlan, SwitchPort attachedToPort)
 {
     MAC            = mAC;
     this.vlan      = vlan;
     AttachedToPort = attachedToPort;
 }
示例#6
0
        public void AttachPackageToSwitchPort(SwitchPort switchPort)
        {
            DetachFromSwitchPort();
            AttachedCurrentlyToSwitchPort           = switchPort;
            backgroundRectangle                     = new Rectangle();
            backgroundRectangle.Margin              = new Thickness(10, 10, 10, 10);
            backgroundRectangle.VerticalAlignment   = VerticalAlignment.Stretch;
            backgroundRectangle.HorizontalAlignment = HorizontalAlignment.Stretch;
            backgroundRectangle.Fill                = Brushes.LightBlue;
            backgroundRectangle.Stroke              = Brushes.Red;
            backgroundRectangle.StrokeThickness     = 3;
            Grid.SetRow(backgroundRectangle, 0);
            Grid.SetColumn(backgroundRectangle, 1);
            macBorder = new Border()
            {
                BorderBrush         = Brushes.Black,
                BorderThickness     = new Thickness(0, 0, 0, 0.5),
                VerticalAlignment   = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Margin = new Thickness(11, 15, 11, 0),
            };
            var mac = new TextBlock()
            {
                Text = $"Ziel MAC: {DestMac}  |  Quell MAC: {SourceHost.MAC}",
                VerticalAlignment   = VerticalAlignment.Stretch,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                FontSize            = 13,
                TextAlignment       = TextAlignment.Center,
            };

            macBorder.Child = mac;
            vlanBorder      = new Border()
            {
                BorderBrush         = Brushes.Black,
                BorderThickness     = new Thickness(0, 0, 0, 0.5),
                VerticalAlignment   = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Margin = new Thickness(11, 35, 11, 0),
            };
            var vlan = new TextBlock()
            {
                VerticalAlignment   = VerticalAlignment.Stretch,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                FontSize            = 13,
                TextAlignment       = TextAlignment.Center,
            };

            if (vlanTag != null)
            {
                vlan.Text = $"VLAN TAG: {vlanTag}";
            }
            vlanBorder.Child = vlan;

            Grid.SetRow(macBorder, 0);
            Grid.SetColumn(macBorder, 1);
            Grid.SetRow(vlanBorder, 0);
            Grid.SetColumn(vlanBorder, 1);

            switchPort.BaseGrid.Children.Add(backgroundRectangle);
            switchPort.BaseGrid.Children.Add(macBorder);
            switchPort.BaseGrid.Children.Add(vlanBorder);
        }