@@ -58,16 +58,16 @@ pub fn handle_key_events(
58
58
59
59
if app. update_filters {
60
60
match & app. focused_block {
61
- FocusedBlock :: NetworkFilter => {
62
- app. focused_block = FocusedBlock :: TransportFilter ;
61
+ FocusedBlock :: TransportFilter => {
62
+ app. focused_block = FocusedBlock :: NetworkFilter ;
63
+ app. network_filter . state . select ( Some ( 0 ) ) ;
63
64
app. transport_filter . state . select ( Some ( 0 ) ) ;
64
- app. network_filter . state . select ( None ) ;
65
65
}
66
66
67
- FocusedBlock :: TransportFilter => {
67
+ FocusedBlock :: NetworkFilter => {
68
68
app. focused_block = FocusedBlock :: LinkFilter ;
69
- app. traffic_direction_filter . state . select ( None ) ;
70
69
app. link_filter . state . select ( Some ( 0 ) ) ;
70
+ app. network_filter . state . select ( None ) ;
71
71
}
72
72
73
73
FocusedBlock :: LinkFilter => {
@@ -82,8 +82,7 @@ pub fn handle_key_events(
82
82
}
83
83
84
84
FocusedBlock :: Start => {
85
- app. focused_block = FocusedBlock :: NetworkFilter ;
86
- app. network_filter . state . select ( Some ( 0 ) ) ;
85
+ app. focused_block = FocusedBlock :: TransportFilter ;
87
86
}
88
87
_ => { }
89
88
} ;
@@ -105,20 +104,20 @@ pub fn handle_key_events(
105
104
106
105
if app. update_filters {
107
106
match & app. focused_block {
108
- FocusedBlock :: NetworkFilter => {
109
- app. focused_block = FocusedBlock :: Start ;
110
- app. network_filter . state . select ( None ) ;
111
- }
112
-
113
107
FocusedBlock :: TransportFilter => {
114
- app. focused_block = FocusedBlock :: NetworkFilter ;
115
- app. network_filter . state . select ( Some ( 0 ) ) ;
108
+ app. focused_block = FocusedBlock :: Start ;
116
109
app. transport_filter . state . select ( None ) ;
117
110
}
118
111
119
- FocusedBlock :: LinkFilter => {
112
+ FocusedBlock :: NetworkFilter => {
120
113
app. focused_block = FocusedBlock :: TransportFilter ;
121
114
app. transport_filter . state . select ( Some ( 0 ) ) ;
115
+ app. network_filter . state . select ( None ) ;
116
+ }
117
+
118
+ FocusedBlock :: LinkFilter => {
119
+ app. focused_block = FocusedBlock :: NetworkFilter ;
120
+ app. network_filter . state . select ( Some ( 0 ) ) ;
122
121
app. link_filter . state . select ( None ) ;
123
122
}
124
123
@@ -161,14 +160,21 @@ pub fn handle_key_events(
161
160
KeyCode :: Char ( 'f' ) => {
162
161
if app. focused_block != FocusedBlock :: Help && app. start_sniffing {
163
162
app. update_filters = true ;
164
- app. focused_block = FocusedBlock :: NetworkFilter ;
163
+ app. focused_block = FocusedBlock :: TransportFilter ;
164
+
165
165
app. network_filter . selected_protocols =
166
166
app. network_filter . applied_protocols . clone ( ) ;
167
+
167
168
app. transport_filter . selected_protocols =
168
169
app. transport_filter . applied_protocols . clone ( ) ;
170
+
171
+ app. link_filter . selected_protocols =
172
+ app. link_filter . applied_protocols . clone ( ) ;
173
+
169
174
app. traffic_direction_filter . selected_direction =
170
175
app. traffic_direction_filter . applied_direction . clone ( ) ;
171
- app. network_filter . state = TableState :: default ( ) . with_selected ( 0 ) ;
176
+
177
+ app. transport_filter . state = TableState :: default ( ) . with_selected ( 0 ) ;
172
178
}
173
179
}
174
180
@@ -229,6 +235,21 @@ pub fn handle_key_events(
229
235
app. transport_filter . state . select ( Some ( i) ) ;
230
236
}
231
237
238
+ FocusedBlock :: LinkFilter => {
239
+ let i = match app. link_filter . state . selected ( ) {
240
+ Some ( i) => {
241
+ if i < ( NB_LINK_PROTOCOL - 1 ) . into ( ) {
242
+ i + 1
243
+ } else {
244
+ i
245
+ }
246
+ }
247
+ None => 0 ,
248
+ } ;
249
+
250
+ app. link_filter . state . select ( Some ( i) ) ;
251
+ }
252
+
232
253
FocusedBlock :: TrafficDirection => {
233
254
app. traffic_direction_filter . state . select ( Some ( 1 ) ) ;
234
255
}
@@ -294,6 +315,21 @@ pub fn handle_key_events(
294
315
app. transport_filter . state . select ( Some ( i) ) ;
295
316
}
296
317
318
+ FocusedBlock :: LinkFilter => {
319
+ let i = match app. link_filter . state . selected ( ) {
320
+ Some ( i) => {
321
+ if i > 1 {
322
+ i - 1
323
+ } else {
324
+ 0
325
+ }
326
+ }
327
+ None => 0 ,
328
+ } ;
329
+
330
+ app. link_filter . state . select ( Some ( i) ) ;
331
+ }
332
+
297
333
FocusedBlock :: TrafficDirection => {
298
334
app. traffic_direction_filter . state . select ( Some ( 0 ) ) ;
299
335
}
@@ -364,7 +400,7 @@ pub fn handle_key_events(
364
400
if app. focused_block != FocusedBlock :: Help && app. start_sniffing {
365
401
app. update_filters = true ;
366
402
367
- app. focused_block = FocusedBlock :: NetworkFilter ;
403
+ app. focused_block = FocusedBlock :: TransportFilter ;
368
404
369
405
app. network_filter . selected_protocols =
370
406
app. network_filter . applied_protocols . clone ( ) ;
@@ -377,7 +413,7 @@ pub fn handle_key_events(
377
413
app. traffic_direction_filter . selected_direction =
378
414
app. traffic_direction_filter . applied_direction . clone ( ) ;
379
415
380
- app. network_filter . state = TableState :: default ( ) . with_selected ( 0 ) ;
416
+ app. transport_filter . state = TableState :: default ( ) . with_selected ( 0 ) ;
381
417
}
382
418
}
383
419
@@ -474,7 +510,7 @@ pub fn handle_key_events(
474
510
}
475
511
476
512
app. start_sniffing = true ;
477
- app. focused_block = FocusedBlock :: NetworkFilter ;
513
+ app. focused_block = FocusedBlock :: TransportFilter ;
478
514
} else if app. start_sniffing && app. update_filters {
479
515
// Remove egress
480
516
if app
@@ -566,16 +602,18 @@ pub fn handle_key_events(
566
602
567
603
if app. update_filters {
568
604
match & app. focused_block {
569
- FocusedBlock :: NetworkFilter => {
570
- app. focused_block = FocusedBlock :: TransportFilter ;
571
- app. transport_filter . state . select ( Some ( 0 ) ) ;
572
- app. network_filter . state . select ( None ) ;
573
- }
574
605
FocusedBlock :: TransportFilter => {
606
+ app. focused_block = FocusedBlock :: NetworkFilter ;
607
+ app. network_filter . state . select ( Some ( 0 ) ) ;
608
+ app. transport_filter . state . select ( None ) ;
609
+ }
610
+
611
+ FocusedBlock :: NetworkFilter => {
575
612
app. focused_block = FocusedBlock :: LinkFilter ;
576
613
app. link_filter . state . select ( Some ( 0 ) ) ;
577
- app. transport_filter . state . select ( None ) ;
614
+ app. network_filter . state . select ( None ) ;
578
615
}
616
+
579
617
FocusedBlock :: LinkFilter => {
580
618
app. focused_block = FocusedBlock :: TrafficDirection ;
581
619
app. traffic_direction_filter . state . select ( Some ( 0 ) ) ;
@@ -588,8 +626,8 @@ pub fn handle_key_events(
588
626
}
589
627
590
628
FocusedBlock :: Start => {
591
- app. focused_block = FocusedBlock :: NetworkFilter ;
592
- app. network_filter . state . select ( Some ( 0 ) ) ;
629
+ app. focused_block = FocusedBlock :: TransportFilter ;
630
+ app. transport_filter . state . select ( Some ( 0 ) ) ;
593
631
}
594
632
_ => { }
595
633
} ;
@@ -604,23 +642,26 @@ pub fn handle_key_events(
604
642
} else {
605
643
match & app. focused_block {
606
644
FocusedBlock :: Interface => {
607
- app. focused_block = FocusedBlock :: NetworkFilter ;
608
- app. previous_focused_block = app. focused_block ;
609
- app. interface . state . select ( None ) ;
610
- app. network_filter . state . select ( Some ( 0 ) ) ;
611
- }
612
- FocusedBlock :: NetworkFilter => {
613
645
app. focused_block = FocusedBlock :: TransportFilter ;
614
646
app. previous_focused_block = app. focused_block ;
647
+ app. interface . state . select ( None ) ;
615
648
app. transport_filter . state . select ( Some ( 0 ) ) ;
616
- app. network_filter . state . select ( None ) ;
617
649
}
650
+
618
651
FocusedBlock :: TransportFilter => {
652
+ app. focused_block = FocusedBlock :: NetworkFilter ;
653
+ app. previous_focused_block = app. focused_block ;
654
+ app. network_filter . state . select ( Some ( 0 ) ) ;
655
+ app. transport_filter . state . select ( None ) ;
656
+ }
657
+
658
+ FocusedBlock :: NetworkFilter => {
619
659
app. focused_block = FocusedBlock :: LinkFilter ;
620
660
app. previous_focused_block = app. focused_block ;
621
661
app. link_filter . state . select ( Some ( 0 ) ) ;
622
- app. transport_filter . state . select ( None ) ;
662
+ app. network_filter . state . select ( None ) ;
623
663
}
664
+
624
665
FocusedBlock :: LinkFilter => {
625
666
app. focused_block = FocusedBlock :: TrafficDirection ;
626
667
app. previous_focused_block = app. focused_block ;
@@ -652,20 +693,20 @@ pub fn handle_key_events(
652
693
653
694
if app. update_filters {
654
695
match & app. focused_block {
655
- FocusedBlock :: NetworkFilter => {
656
- app. focused_block = FocusedBlock :: Start ;
657
- app. network_filter . state . select ( None ) ;
658
- }
659
-
660
696
FocusedBlock :: TransportFilter => {
661
- app. focused_block = FocusedBlock :: NetworkFilter ;
662
- app. network_filter . state . select ( Some ( 0 ) ) ;
697
+ app. focused_block = FocusedBlock :: Start ;
663
698
app. transport_filter . state . select ( None ) ;
664
699
}
665
700
666
- FocusedBlock :: LinkFilter => {
701
+ FocusedBlock :: NetworkFilter => {
667
702
app. focused_block = FocusedBlock :: TransportFilter ;
668
703
app. transport_filter . state . select ( Some ( 0 ) ) ;
704
+ app. network_filter . state . select ( None ) ;
705
+ }
706
+
707
+ FocusedBlock :: LinkFilter => {
708
+ app. focused_block = FocusedBlock :: NetworkFilter ;
709
+ app. network_filter . state . select ( Some ( 0 ) ) ;
669
710
app. link_filter . state . select ( None ) ;
670
711
}
671
712
@@ -695,21 +736,21 @@ pub fn handle_key_events(
695
736
app. interface . state . select ( None ) ;
696
737
}
697
738
698
- FocusedBlock :: NetworkFilter => {
739
+ FocusedBlock :: TransportFilter => {
699
740
app. focused_block = FocusedBlock :: Interface ;
700
741
app. interface . state . select ( Some ( 0 ) ) ;
701
- app. network_filter . state . select ( None ) ;
702
- }
703
-
704
- FocusedBlock :: TransportFilter => {
705
- app. focused_block = FocusedBlock :: NetworkFilter ;
706
- app. network_filter . state . select ( Some ( 0 ) ) ;
707
742
app. transport_filter . state . select ( None ) ;
708
743
}
709
744
710
- FocusedBlock :: LinkFilter => {
745
+ FocusedBlock :: NetworkFilter => {
711
746
app. focused_block = FocusedBlock :: TransportFilter ;
712
747
app. transport_filter . state . select ( Some ( 0 ) ) ;
748
+ app. network_filter . state . select ( None ) ;
749
+ }
750
+
751
+ FocusedBlock :: LinkFilter => {
752
+ app. focused_block = FocusedBlock :: NetworkFilter ;
753
+ app. network_filter . state . select ( Some ( 0 ) ) ;
713
754
app. link_filter . state . select ( None ) ;
714
755
}
715
756
0 commit comments