rbfrt 0.1.8

Rust library for interaction with Intel Tofino(TM) BFRT switch interface.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
// This file is @generated by prost-build.
/// ------------------------------------------------------------------------------
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WriteRequest {
    /// This is the default TargetDevice.
    /// If entry_tgt under TableEntry is specified, that takes precedence over this field
    #[prost(message, optional, tag = "1")]
    pub target: ::core::option::Option<TargetDevice>,
    #[prost(uint32, tag = "2")]
    pub client_id: u32,
    /// The write batch, comprising a list of Update operations.
    #[prost(message, repeated, tag = "3")]
    pub updates: ::prost::alloc::vec::Vec<Update>,
    #[prost(enumeration = "write_request::Atomicity", tag = "4")]
    pub atomicity: i32,
    #[prost(string, tag = "5")]
    pub p4_name: ::prost::alloc::string::String,
}
/// Nested message and enum types in `WriteRequest`.
pub mod write_request {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
    #[repr(i32)]
    pub enum Atomicity {
        /// Required. This is the default behavior. The batch is processed in a
        /// non-atomic manner from a dataplane point of view. Each operation within
        /// the batch must be attempted even if one or more encounter errors.
        /// Every dataplane packet is guaranteed to be processed according to
        /// table contents as they are between two individual operations of the
        /// batch, but there could be several packets processed that see each of
        /// these intermediate stages.
        ContinueOnError = 0,
        /// Optional. Operations within the batch are committed to dataplane until
        /// an error is encountered. At this point, the operations must be rolled
        /// back such that both software and dataplane state is consistent with the
        /// state before the batch was attempted. The resulting behavior is
        /// all-or-none, except the batch is not atomic from a data plane point of
        /// view. Every dataplane packet is guaranteed to be processed according to
        /// table contents as they are between two individual operations of the
        /// batch, but there could be several packets processed that see each of
        /// these intermediate stages.
        RollbackOnError = 1,
        /// Optional. Every dataplane packet is guaranteed to be processed according
        /// to table contents before the batch began, or after the batch completed
        /// and the operations were programmed to the hardware.
        /// The batch is therefore treated as a transaction.
        DataplaneAtomic = 2,
    }
    impl Atomicity {
        /// String value of the enum field names used in the ProtoBuf definition.
        ///
        /// The values are not transformed in any way and thus are considered stable
        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
        pub fn as_str_name(&self) -> &'static str {
            match self {
                Self::ContinueOnError => "CONTINUE_ON_ERROR",
                Self::RollbackOnError => "ROLLBACK_ON_ERROR",
                Self::DataplaneAtomic => "DATAPLANE_ATOMIC",
            }
        }
        /// Creates an enum from field names used in the ProtoBuf definition.
        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
            match value {
                "CONTINUE_ON_ERROR" => Some(Self::ContinueOnError),
                "ROLLBACK_ON_ERROR" => Some(Self::RollbackOnError),
                "DATAPLANE_ATOMIC" => Some(Self::DataplaneAtomic),
                _ => None,
            }
        }
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WriteResponse {
    #[prost(message, repeated, tag = "1")]
    pub status: ::prost::alloc::vec::Vec<Error>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReadRequest {
    /// This is the default TargetDevice.
    /// If entry_tgt under TableEntry is specified, that takes precedence over this field
    #[prost(message, optional, tag = "1")]
    pub target: ::core::option::Option<TargetDevice>,
    #[prost(uint32, tag = "2")]
    pub client_id: u32,
    #[prost(message, repeated, tag = "3")]
    pub entities: ::prost::alloc::vec::Vec<Entity>,
    #[prost(string, tag = "4")]
    pub p4_name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReadResponse {
    #[prost(message, repeated, tag = "1")]
    pub entities: ::prost::alloc::vec::Vec<Entity>,
    #[prost(message, repeated, tag = "2")]
    pub status: ::prost::alloc::vec::Vec<Error>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TargetDevice {
    #[prost(uint32, tag = "1")]
    pub device_id: u32,
    #[prost(uint32, tag = "2")]
    pub pipe_id: u32,
    #[prost(uint32, tag = "3")]
    pub direction: u32,
    /// More target-specific ids.
    #[prost(uint32, tag = "4")]
    pub prsr_id: u32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Update {
    #[prost(enumeration = "update::Type", tag = "1")]
    pub r#type: i32,
    #[prost(message, optional, tag = "2")]
    pub entity: ::core::option::Option<Entity>,
}
/// Nested message and enum types in `Update`.
pub mod update {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
    #[repr(i32)]
    pub enum Type {
        Unspecified = 0,
        Insert = 1,
        Modify = 2,
        /// MODIFY_INC is used to add/delete the given data to/from the
        /// existing table entry incrementally.
        ModifyInc = 3,
        Delete = 4,
        InsertOrModify = 5,
        Reset = 6,
    }
    impl Type {
        /// String value of the enum field names used in the ProtoBuf definition.
        ///
        /// The values are not transformed in any way and thus are considered stable
        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
        pub fn as_str_name(&self) -> &'static str {
            match self {
                Self::Unspecified => "UNSPECIFIED",
                Self::Insert => "INSERT",
                Self::Modify => "MODIFY",
                Self::ModifyInc => "MODIFY_INC",
                Self::Delete => "DELETE",
                Self::InsertOrModify => "INSERT_OR_MODIFY",
                Self::Reset => "RESET",
            }
        }
        /// Creates an enum from field names used in the ProtoBuf definition.
        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
            match value {
                "UNSPECIFIED" => Some(Self::Unspecified),
                "INSERT" => Some(Self::Insert),
                "MODIFY" => Some(Self::Modify),
                "MODIFY_INC" => Some(Self::ModifyInc),
                "DELETE" => Some(Self::Delete),
                "INSERT_OR_MODIFY" => Some(Self::InsertOrModify),
                "RESET" => Some(Self::Reset),
                _ => None,
            }
        }
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Entity {
    #[prost(oneof = "entity::Entity", tags = "1, 2, 3, 4, 5, 6")]
    pub entity: ::core::option::Option<entity::Entity>,
}
/// Nested message and enum types in `Entity`.
pub mod entity {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Entity {
        #[prost(message, tag = "1")]
        TableEntry(super::TableEntry),
        #[prost(message, tag = "2")]
        TableUsage(super::TableUsage),
        #[prost(message, tag = "3")]
        TableAttribute(super::TableAttribute),
        #[prost(message, tag = "4")]
        TableOperation(super::TableOperation),
        #[prost(message, tag = "5")]
        ObjectId(super::ObjectId),
        #[prost(message, tag = "6")]
        Handle(super::HandleId),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HandleId {
    #[prost(uint32, tag = "1")]
    pub table_id: u32,
    #[prost(oneof = "handle_id::Value", tags = "2, 3")]
    pub value: ::core::option::Option<handle_id::Value>,
}
/// Nested message and enum types in `HandleId`.
pub mod handle_id {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Value {
        #[prost(message, tag = "2")]
        Key(super::TableKey),
        #[prost(uint32, tag = "3")]
        HandleId(u32),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TableEntry {
    #[prost(uint32, tag = "1")]
    pub table_id: u32,
    #[prost(message, optional, tag = "3")]
    pub data: ::core::option::Option<TableData>,
    #[prost(bool, tag = "4")]
    pub is_default_entry: bool,
    /// Deprecated, please use table_flags
    #[deprecated]
    #[prost(message, optional, tag = "5")]
    pub table_read_flag: ::core::option::Option<TableReadFlag>,
    #[deprecated]
    #[prost(message, optional, tag = "6")]
    pub table_mod_inc_flag: ::core::option::Option<TableModIncFlag>,
    /// If entry_tgt is specified, all the fields of entry_tgt are used even if not explicitly set
    #[prost(message, optional, tag = "8")]
    pub entry_tgt: ::core::option::Option<TargetDevice>,
    #[prost(message, optional, tag = "9")]
    pub table_flags: ::core::option::Option<TableFlags>,
    #[prost(oneof = "table_entry::Value", tags = "2, 7")]
    pub value: ::core::option::Option<table_entry::Value>,
}
/// Nested message and enum types in `TableEntry`.
pub mod table_entry {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Value {
        #[prost(message, tag = "2")]
        Key(super::TableKey),
        #[prost(uint32, tag = "7")]
        HandleId(u32),
    }
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TableUsage {
    #[prost(uint32, tag = "1")]
    pub table_id: u32,
    #[prost(uint32, tag = "2")]
    pub usage: u32,
    /// Deprecated, please use table_flags
    #[deprecated]
    #[prost(message, optional, tag = "3")]
    pub table_read_flag: ::core::option::Option<TableReadFlag>,
    #[prost(message, optional, tag = "4")]
    pub table_flags: ::core::option::Option<TableFlags>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TableAttribute {
    #[prost(uint32, tag = "1")]
    pub table_id: u32,
    #[prost(oneof = "table_attribute::Attribute", tags = "2, 3, 4, 5, 6, 7, 8, 9")]
    pub attribute: ::core::option::Option<table_attribute::Attribute>,
}
/// Nested message and enum types in `TableAttribute`.
pub mod table_attribute {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Attribute {
        #[prost(message, tag = "2")]
        IdleTable(super::IdleTable),
        #[prost(message, tag = "3")]
        EntryScope(super::EntryScope),
        #[prost(message, tag = "4")]
        DynKeyMask(super::DynKeyMask),
        #[prost(message, tag = "5")]
        DynHashing(super::DynHashing),
        #[prost(message, tag = "6")]
        ByteCountAdj(super::ByteCountAdj),
        #[prost(message, tag = "7")]
        PortStatusNotify(super::PortStatusChg),
        #[prost(message, tag = "8")]
        IntvlMs(super::StatePullIntvl),
        #[prost(message, tag = "9")]
        PreDeviceConfig(super::PreDeviceConfig),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TableOperation {
    #[prost(uint32, tag = "1")]
    pub table_id: u32,
    #[prost(string, tag = "2")]
    pub table_operations_type: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TableData {
    #[prost(uint32, tag = "1")]
    pub action_id: u32,
    #[prost(message, repeated, tag = "2")]
    pub fields: ::prost::alloc::vec::Vec<DataField>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DataField {
    #[prost(uint32, tag = "1")]
    pub field_id: u32,
    /// All data fields are dealt with using a byte stream except for float
    /// values. Float values are used for data fields for LPF and WRED table
    #[prost(oneof = "data_field::Value", tags = "2, 3, 4, 5, 6, 7, 8, 9")]
    pub value: ::core::option::Option<data_field::Value>,
}
/// Nested message and enum types in `DataField`.
pub mod data_field {
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct IntArray {
        #[prost(uint32, repeated, tag = "1")]
        pub val: ::prost::alloc::vec::Vec<u32>,
    }
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct BoolArray {
        #[prost(bool, repeated, tag = "1")]
        pub val: ::prost::alloc::vec::Vec<bool>,
    }
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct StrArray {
        #[prost(string, repeated, tag = "1")]
        pub val: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    }
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct ContainerArray {
        #[prost(message, repeated, tag = "1")]
        pub container: ::prost::alloc::vec::Vec<container_array::Container>,
    }
    /// Nested message and enum types in `ContainerArray`.
    pub mod container_array {
        #[derive(Clone, PartialEq, ::prost::Message)]
        pub struct Container {
            #[prost(message, repeated, tag = "1")]
            pub val: ::prost::alloc::vec::Vec<super::super::DataField>,
        }
    }
    /// All data fields are dealt with using a byte stream except for float
    /// values. Float values are used for data fields for LPF and WRED table
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Value {
        #[prost(bytes, tag = "2")]
        Stream(::prost::alloc::vec::Vec<u8>),
        #[prost(float, tag = "3")]
        FloatVal(f32),
        #[prost(string, tag = "4")]
        StrVal(::prost::alloc::string::String),
        #[prost(message, tag = "5")]
        IntArrVal(IntArray),
        #[prost(message, tag = "6")]
        BoolArrVal(BoolArray),
        #[prost(message, tag = "7")]
        ContainerArrVal(ContainerArray),
        #[prost(bool, tag = "8")]
        BoolVal(bool),
        #[prost(message, tag = "9")]
        StrArrVal(StrArray),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TableKey {
    #[prost(message, repeated, tag = "1")]
    pub fields: ::prost::alloc::vec::Vec<KeyField>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct KeyField {
    #[prost(uint32, tag = "1")]
    pub field_id: u32,
    #[prost(oneof = "key_field::MatchType", tags = "2, 3, 4, 5, 6")]
    pub match_type: ::core::option::Option<key_field::MatchType>,
}
/// Nested message and enum types in `KeyField`.
pub mod key_field {
    /// Matches can be performed on arbitrarily-large inputs; the protobuf type
    /// 'bytes' is used to model arbitrarily-large values.
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct Exact {
        #[prost(bytes = "vec", tag = "1")]
        pub value: ::prost::alloc::vec::Vec<u8>,
    }
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct Ternary {
        #[prost(bytes = "vec", tag = "1")]
        pub value: ::prost::alloc::vec::Vec<u8>,
        #[prost(bytes = "vec", tag = "2")]
        pub mask: ::prost::alloc::vec::Vec<u8>,
    }
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct Lpm {
        #[prost(bytes = "vec", tag = "1")]
        pub value: ::prost::alloc::vec::Vec<u8>,
        /// in bits
        #[prost(int32, tag = "2")]
        pub prefix_len: i32,
    }
    /// A Range is logically a set that contains all values numerically between
    /// 'low' and 'high' inclusively.
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct Range {
        #[prost(bytes = "vec", tag = "1")]
        pub low: ::prost::alloc::vec::Vec<u8>,
        #[prost(bytes = "vec", tag = "2")]
        pub high: ::prost::alloc::vec::Vec<u8>,
    }
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct Optional {
        #[prost(bytes = "vec", tag = "1")]
        pub value: ::prost::alloc::vec::Vec<u8>,
        #[prost(bool, tag = "2")]
        pub is_valid: bool,
    }
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum MatchType {
        #[prost(message, tag = "2")]
        Exact(Exact),
        #[prost(message, tag = "3")]
        Ternary(Ternary),
        #[prost(message, tag = "4")]
        Lpm(Lpm),
        #[prost(message, tag = "5")]
        Range(Range),
        #[prost(message, tag = "6")]
        Optional(Optional),
    }
}
/// Deprecated, please use TableFlags
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TableReadFlag {
    #[prost(bool, tag = "1")]
    pub from_hw: bool,
    #[prost(bool, tag = "2")]
    pub key_only: bool,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TableFlags {
    #[prost(bool, tag = "1")]
    pub from_hw: bool,
    #[prost(bool, tag = "2")]
    pub key_only: bool,
    #[prost(bool, tag = "3")]
    pub mod_del: bool,
    #[prost(bool, tag = "4")]
    pub reset_ttl: bool,
    #[prost(bool, tag = "5")]
    pub reset_stats: bool,
}
/// Deprecated, please use TableFlags
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TableModIncFlag {
    #[prost(enumeration = "table_mod_inc_flag::Type", tag = "1")]
    pub r#type: i32,
}
/// Nested message and enum types in `TableModIncFlag`.
pub mod table_mod_inc_flag {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
    #[repr(i32)]
    pub enum Type {
        /// Enum to add the given data incrementally to the
        /// exising table entry
        ModIncAdd = 0,
        /// Enum to delete the given data from the
        /// exising table entry
        ModIncDelete = 1,
    }
    impl Type {
        /// String value of the enum field names used in the ProtoBuf definition.
        ///
        /// The values are not transformed in any way and thus are considered stable
        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
        pub fn as_str_name(&self) -> &'static str {
            match self {
                Self::ModIncAdd => "MOD_INC_ADD",
                Self::ModIncDelete => "MOD_INC_DELETE",
            }
        }
        /// Creates an enum from field names used in the ProtoBuf definition.
        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
            match value {
                "MOD_INC_ADD" => Some(Self::ModIncAdd),
                "MOD_INC_DELETE" => Some(Self::ModIncDelete),
                _ => None,
            }
        }
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct KeyFieldMask {
    #[prost(uint32, tag = "1")]
    pub field_id: u32,
    #[prost(bytes = "vec", tag = "2")]
    pub mask: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DynKeyMask {
    #[prost(message, repeated, tag = "1")]
    pub fields: ::prost::alloc::vec::Vec<KeyFieldMask>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct DynHashing {
    #[prost(uint32, tag = "1")]
    pub alg: u32,
    #[prost(uint64, tag = "2")]
    pub seed: u64,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ByteCountAdj {
    #[prost(int32, tag = "1")]
    pub byte_count_adjust: i32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct IdleTable {
    #[prost(uint32, tag = "1")]
    pub ttl_query_interval: u32,
    #[prost(uint32, tag = "2")]
    pub max_ttl: u32,
    #[prost(uint32, tag = "3")]
    pub min_ttl: u32,
    #[prost(enumeration = "idle_table::IdleTableMode", tag = "4")]
    pub idle_table_mode: i32,
    #[prost(bool, tag = "5")]
    pub enable: bool,
}
/// Nested message and enum types in `IdleTable`.
pub mod idle_table {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
    #[repr(i32)]
    pub enum IdleTableMode {
        IdleTablePollMode = 0,
        IdleTableNotifyMode = 1,
    }
    impl IdleTableMode {
        /// String value of the enum field names used in the ProtoBuf definition.
        ///
        /// The values are not transformed in any way and thus are considered stable
        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
        pub fn as_str_name(&self) -> &'static str {
            match self {
                Self::IdleTablePollMode => "IDLE_TABLE_POLL_MODE",
                Self::IdleTableNotifyMode => "IDLE_TABLE_NOTIFY_MODE",
            }
        }
        /// Creates an enum from field names used in the ProtoBuf definition.
        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
            match value {
                "IDLE_TABLE_POLL_MODE" => Some(Self::IdleTablePollMode),
                "IDLE_TABLE_NOTIFY_MODE" => Some(Self::IdleTableNotifyMode),
                _ => None,
            }
        }
    }
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct StatePullIntvl {
    #[prost(uint32, tag = "1")]
    pub intvl_val: u32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PortStatusChg {
    #[prost(bool, tag = "1")]
    pub enable: bool,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Mode {
    #[prost(uint64, tag = "3")]
    pub args: u64,
    #[prost(oneof = "mode::Scope", tags = "1, 2")]
    pub scope: ::core::option::Option<mode::Scope>,
}
/// Nested message and enum types in `Mode`.
pub mod mode {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
    #[repr(i32)]
    pub enum PredefinedMode {
        All = 0,
        Single = 1,
    }
    impl PredefinedMode {
        /// String value of the enum field names used in the ProtoBuf definition.
        ///
        /// The values are not transformed in any way and thus are considered stable
        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
        pub fn as_str_name(&self) -> &'static str {
            match self {
                Self::All => "ALL",
                Self::Single => "SINGLE",
            }
        }
        /// Creates an enum from field names used in the ProtoBuf definition.
        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
            match value {
                "ALL" => Some(Self::All),
                "SINGLE" => Some(Self::Single),
                _ => None,
            }
        }
    }
    #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
    pub enum Scope {
        #[prost(enumeration = "PredefinedMode", tag = "1")]
        Predef(i32),
        #[prost(uint64, tag = "2")]
        UserDefined(u64),
    }
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PreGlobalRid {
    #[prost(uint32, tag = "1")]
    pub global_rid: u32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PrePortProtection {
    #[prost(bool, tag = "1")]
    pub enable: bool,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PreFastFailover {
    #[prost(bool, tag = "1")]
    pub enable: bool,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PreMaxNodesBeforeYield {
    #[prost(uint32, tag = "1")]
    pub count: u32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PreMaxNodeThreshold {
    #[prost(uint32, tag = "1")]
    pub node_count: u32,
    #[prost(uint32, tag = "2")]
    pub port_lag_count: u32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PreDeviceConfig {
    #[prost(message, optional, tag = "1")]
    pub pre_global_rid: ::core::option::Option<PreGlobalRid>,
    #[prost(message, optional, tag = "2")]
    pub pre_port_protection: ::core::option::Option<PrePortProtection>,
    #[prost(message, optional, tag = "3")]
    pub pre_fast_failover: ::core::option::Option<PreFastFailover>,
    #[prost(message, optional, tag = "4")]
    pub pre_max_nodes_before_yield: ::core::option::Option<PreMaxNodesBeforeYield>,
    #[prost(message, optional, tag = "5")]
    pub pre_max_node_threshold: ::core::option::Option<PreMaxNodeThreshold>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct EntryScope {
    #[prost(message, optional, tag = "1")]
    pub gress_scope: ::core::option::Option<Mode>,
    #[prost(message, optional, tag = "2")]
    pub pipe_scope: ::core::option::Option<Mode>,
    #[prost(message, optional, tag = "3")]
    pub prsr_scope: ::core::option::Option<Mode>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ObjectId {
    #[prost(uint32, tag = "3")]
    pub id: u32,
    #[prost(oneof = "object_id::Object", tags = "1, 2")]
    pub object: ::core::option::Option<object_id::Object>,
}
/// Nested message and enum types in `ObjectId`.
pub mod object_id {
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct ActionName {
        #[prost(string, tag = "1")]
        pub action: ::prost::alloc::string::String,
    }
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct KeyFieldName {
        #[prost(string, tag = "1")]
        pub field: ::prost::alloc::string::String,
    }
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct DataFieldName {
        #[prost(string, tag = "1")]
        pub action: ::prost::alloc::string::String,
        #[prost(string, tag = "2")]
        pub field: ::prost::alloc::string::String,
    }
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct TableObject {
        #[prost(string, tag = "1")]
        pub table_name: ::prost::alloc::string::String,
        #[prost(oneof = "table_object::Names", tags = "2, 3, 4")]
        pub names: ::core::option::Option<table_object::Names>,
    }
    /// Nested message and enum types in `TableObject`.
    pub mod table_object {
        #[derive(Clone, PartialEq, ::prost::Oneof)]
        pub enum Names {
            #[prost(message, tag = "2")]
            ActionName(super::ActionName),
            #[prost(message, tag = "3")]
            KeyFieldName(super::KeyFieldName),
            #[prost(message, tag = "4")]
            DataFieldName(super::DataFieldName),
        }
    }
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct LearnObject {
        #[prost(string, tag = "1")]
        pub learn_name: ::prost::alloc::string::String,
        #[prost(message, optional, tag = "2")]
        pub data_field_name: ::core::option::Option<DataFieldName>,
    }
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Object {
        #[prost(message, tag = "1")]
        TableObject(TableObject),
        #[prost(message, tag = "2")]
        LearnObject(LearnObject),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StreamMessageRequest {
    #[prost(uint32, tag = "1")]
    pub client_id: u32,
    #[prost(oneof = "stream_message_request::Update", tags = "2, 3")]
    pub update: ::core::option::Option<stream_message_request::Update>,
}
/// Nested message and enum types in `StreamMessageRequest`.
pub mod stream_message_request {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Update {
        #[prost(message, tag = "2")]
        Subscribe(super::Subscribe),
        #[prost(message, tag = "3")]
        DigestAck(super::DigestListAck),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Subscribe {
    #[deprecated]
    #[prost(bool, tag = "1")]
    pub is_master: bool,
    /// Master for Warm Init messages.
    /// Deprecated and not needed anymore.
    /// Keeping for backward compatibility.
    ///
    /// Device ID
    #[prost(uint32, tag = "2")]
    pub device_id: u32,
    /// Contains which notifications need to be
    #[prost(message, optional, tag = "3")]
    pub notifications: ::core::option::Option<subscribe::Notifications>,
    /// enabled for this client. Default value of
    /// these notifications are false.
    ///
    /// The controller doesn't populate this field.
    #[prost(message, optional, tag = "4")]
    pub status: ::core::option::Option<super::google::rpc::Status>,
}
/// Nested message and enum types in `Subscribe`.
pub mod subscribe {
    #[derive(Clone, Copy, PartialEq, ::prost::Message)]
    pub struct Notifications {
        /// Enable learn digest notifications. These notifications are
        #[prost(bool, tag = "1")]
        pub enable_learn_notifications: bool,
        /// (device, P4-program) based so these will be triggered only after a
        /// client binds to a program.
        ///
        /// Enable idletimeout notifications. These are on per table basis and
        #[prost(bool, tag = "2")]
        pub enable_idletimeout_notifications: bool,
        /// hence (device, P4-Program) based so these will be triggered only
        /// after a client binds to a program.
        ///
        /// Enable port status change notifications. These notifications are
        #[prost(bool, tag = "3")]
        pub enable_port_status_change_notifications: bool,
        /// device based and so they will be triggered whether a client is
        /// bound to a program or not.
        ///
        /// Enable entry active notifications. These are on per table basis and
        #[prost(bool, tag = "4")]
        pub enable_entry_active_notifications: bool,
    }
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct DigestListAck {
    #[prost(uint32, tag = "1")]
    pub digest_id: u32,
    #[prost(uint32, tag = "2")]
    pub list_id: u32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StreamMessageResponse {
    #[prost(oneof = "stream_message_response::Update", tags = "1, 2, 3, 4, 5")]
    pub update: ::core::option::Option<stream_message_response::Update>,
}
/// Nested message and enum types in `StreamMessageResponse`.
pub mod stream_message_response {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Update {
        /// This message is only used to let the server know
        #[prost(message, tag = "1")]
        Subscribe(super::Subscribe),
        /// of the existence of client with this client_id
        ///
        /// Learn Digest
        #[prost(message, tag = "2")]
        Digest(super::DigestList),
        /// Idle timeout notification
        #[prost(message, tag = "3")]
        IdleTimeoutNotification(super::IdleTimeoutNotification),
        /// Port status change notification
        #[prost(message, tag = "4")]
        PortStatusChangeNotification(super::PortStatusChgNotification),
        /// Response for a SetForwardingPipelineConfigRequest is sent here
        #[prost(message, tag = "5")]
        SetForwardingPipelineConfigResponse(super::SetForwardingPipelineConfigResponse),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscribeResponse {
    #[prost(message, optional, tag = "1")]
    pub status: ::core::option::Option<Error>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DigestList {
    /// Identifies the digest extern instance
    #[prost(uint32, tag = "1")]
    pub digest_id: u32,
    #[prost(uint32, tag = "2")]
    pub list_id: u32,
    #[prost(message, repeated, tag = "3")]
    pub data: ::prost::alloc::vec::Vec<TableData>,
    #[prost(message, optional, tag = "4")]
    pub target: ::core::option::Option<TargetDevice>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct IdleTimeoutNotification {
    /// Only "key" fields are required to be set in each TableEntry.
    #[prost(message, optional, tag = "1")]
    pub target: ::core::option::Option<TargetDevice>,
    #[prost(message, optional, tag = "2")]
    pub table_entry: ::core::option::Option<TableEntry>,
    #[prost(enumeration = "idle_timeout_notification::NotificationType", tag = "3")]
    pub r#type: i32,
}
/// Nested message and enum types in `IdleTimeoutNotification`.
pub mod idle_timeout_notification {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
    #[repr(i32)]
    pub enum NotificationType {
        /// Entry changed from idle to active
        EntryActive = 0,
        /// Entry changed from active to idle
        EntryIdle = 1,
    }
    impl NotificationType {
        /// String value of the enum field names used in the ProtoBuf definition.
        ///
        /// The values are not transformed in any way and thus are considered stable
        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
        pub fn as_str_name(&self) -> &'static str {
            match self {
                Self::EntryActive => "ENTRY_ACTIVE",
                Self::EntryIdle => "ENTRY_IDLE",
            }
        }
        /// Creates an enum from field names used in the ProtoBuf definition.
        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
            match value {
                "ENTRY_ACTIVE" => Some(Self::EntryActive),
                "ENTRY_IDLE" => Some(Self::EntryIdle),
                _ => None,
            }
        }
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PortStatusChgNotification {
    /// Only "key" fields are required to be set in each TableEntry.
    #[prost(message, optional, tag = "1")]
    pub table_entry: ::core::option::Option<TableEntry>,
    #[prost(bool, tag = "2")]
    pub port_up: bool,
}
/// -----------------------------------------------------------------------------
/// SetForwardingPipelineConfig RPC takes in this message. It should contain
/// details of the entire device.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SetForwardingPipelineConfigRequest {
    /// Device ID
    #[prost(uint32, tag = "1")]
    pub device_id: u32,
    /// Client ID
    #[prost(uint32, tag = "2")]
    pub client_id: u32,
    /// action
    #[prost(
        enumeration = "set_forwarding_pipeline_config_request::Action",
        tag = "3"
    )]
    pub action: i32,
    /// warm init mode. Fast reconfig or Hitless
    #[prost(
        enumeration = "set_forwarding_pipeline_config_request::DevInitMode",
        tag = "4"
    )]
    pub dev_init_mode: i32,
    /// The base path where the config is wished to be
    #[prost(string, tag = "5")]
    pub base_path: ::prost::alloc::string::String,
    /// stored. If empty, then current directory is used
    ///
    /// Device's config
    #[prost(message, repeated, tag = "6")]
    pub config: ::prost::alloc::vec::Vec<ForwardingPipelineConfig>,
}
/// Nested message and enum types in `SetForwardingPipelineConfigRequest`.
pub mod set_forwarding_pipeline_config_request {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
    #[repr(i32)]
    pub enum Action {
        /// BIND: Default Action. Only binds the client to the program
        Bind = 0,
        /// specified in the p4_name. One client can bind to only one
        /// program. One program can have only one client as of now. Even
        /// in case of multiple programs on a single device, BIND requires
        /// just one program’s config msg. If multiple repeated
        /// forwarding_pipeline_config msgs are sent as part of this
        /// request, then google.rpc.INVALID_ARGUMENT is sent. If a client
        /// doesn't BIND, then it can only access
        /// SetForwardingPipelineConfigRequest,
        /// GetForwardingPipelineConfigRequest and StreamMessageRequest
        /// RPCs. Read and Write RPCs are not allowed for non-bound clients
        ///
        /// VERIFY(Master): Verifies whether this config is valid or not.
        Verify = 1,
        /// Upon failure or incomplete config in the msg,
        /// google.rpc.Code::INVALID_ARGUMENT is sent.
        ///
        /// VERIFY_AND_WARM_INIT_BEGIN(Master):  Verifies the config and then
        VerifyAndWarmInitBegin = 2,
        /// begins warm_init with this config. This does not modify the
        /// forwarding state of the device. However, any subsequent Read /
        /// Write requests must refer to fields in the new config. Returns an
        /// INVALID_ARGUMENT error if the forwarding config is not provided or
        /// if the provided config cannot be realized.
        ///
        /// VERIFY_AND_WARM_INIT_BEGIN_AND_END(Master): Verifies, starts
        VerifyAndWarmInitBeginAndEnd = 3,
        /// warm_init and then initiates warm_init_end on the switch. The
        /// existing forwarding state is reset. Returns an INVALID_ARGUMENT
        /// error if the forwarding config is not provided of if the provided
        /// config cannot be realized.
        ///
        /// WARM_INIT_END(Master): Issues a warm_init_end. If
        WarmInitEnd = 4,
        /// forwarding_pipeline_config contains anything, or if no
        /// WARM_INIT_BEGIN was previously called on the device
        /// with a valid config, then
        /// google.rpc.Code::INVALID_ARGUMENT is sent. The
        /// forwarding state in the target is updated by replaying
        /// the write requests to the target device since the last
        /// config was saved by the client.
        ///
        /// RECONCILE_AND_WARM_INIT_END(Master): Try and reconcile with the
        ReconcileAndWarmInitEnd = 5,
    }
    impl Action {
        /// String value of the enum field names used in the ProtoBuf definition.
        ///
        /// The values are not transformed in any way and thus are considered stable
        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
        pub fn as_str_name(&self) -> &'static str {
            match self {
                Self::Bind => "BIND",
                Self::Verify => "VERIFY",
                Self::VerifyAndWarmInitBegin => "VERIFY_AND_WARM_INIT_BEGIN",
                Self::VerifyAndWarmInitBeginAndEnd => "VERIFY_AND_WARM_INIT_BEGIN_AND_END",
                Self::WarmInitEnd => "WARM_INIT_END",
                Self::ReconcileAndWarmInitEnd => "RECONCILE_AND_WARM_INIT_END",
            }
        }
        /// Creates an enum from field names used in the ProtoBuf definition.
        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
            match value {
                "BIND" => Some(Self::Bind),
                "VERIFY" => Some(Self::Verify),
                "VERIFY_AND_WARM_INIT_BEGIN" => Some(Self::VerifyAndWarmInitBegin),
                "VERIFY_AND_WARM_INIT_BEGIN_AND_END" => Some(Self::VerifyAndWarmInitBeginAndEnd),
                "WARM_INIT_END" => Some(Self::WarmInitEnd),
                "RECONCILE_AND_WARM_INIT_END" => Some(Self::ReconcileAndWarmInitEnd),
                _ => None,
            }
        }
    }
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
    #[repr(i32)]
    pub enum DevInitMode {
        /// This is the default device init mode.
        FastReconfig = 0,
        /// Device incurs a fast-reconfig reset with minimal traffic disruption
        ///
        /// Device incurs a hitless warm init. This incurs even lesser traffic
        Hitless = 1,
    }
    impl DevInitMode {
        /// String value of the enum field names used in the ProtoBuf definition.
        ///
        /// The values are not transformed in any way and thus are considered stable
        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
        pub fn as_str_name(&self) -> &'static str {
            match self {
                Self::FastReconfig => "FAST_RECONFIG",
                Self::Hitless => "HITLESS",
            }
        }
        /// Creates an enum from field names used in the ProtoBuf definition.
        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
            match value {
                "FAST_RECONFIG" => Some(Self::FastReconfig),
                "HITLESS" => Some(Self::Hitless),
                _ => None,
            }
        }
    }
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SetForwardingPipelineConfigResponse {
    #[prost(enumeration = "SetForwardingPipelineConfigResponseType", tag = "1")]
    pub set_forwarding_pipeline_config_response_type: i32,
}
/// This message contains config of a SINGLE program. The reason config is a
/// repeated field in the SetForwardingPipelineConfigRequest is because a
/// device can have multiple programs.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ForwardingPipelineConfig {
    /// P4 program name
    #[prost(string, tag = "1")]
    pub p4_name: ::prost::alloc::string::String,
    /// BF-RT info json file contents
    #[prost(bytes = "vec", tag = "2")]
    pub bfruntime_info: ::prost::alloc::vec::Vec<u8>,
    #[prost(message, repeated, tag = "3")]
    pub profiles: ::prost::alloc::vec::Vec<forwarding_pipeline_config::Profile>,
}
/// Nested message and enum types in `ForwardingPipelineConfig`.
pub mod forwarding_pipeline_config {
    /// P4 Pipeline Profile
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct Profile {
        /// profile name
        #[prost(string, tag = "1")]
        pub profile_name: ::prost::alloc::string::String,
        /// context json file contents
        #[prost(bytes = "vec", tag = "2")]
        pub context: ::prost::alloc::vec::Vec<u8>,
        /// Binary to execute
        #[prost(bytes = "vec", tag = "3")]
        pub binary: ::prost::alloc::vec::Vec<u8>,
        /// Array of pipe_scope.
        #[prost(uint32, repeated, tag = "4")]
        pub pipe_scope: ::prost::alloc::vec::Vec<u32>,
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NonP4Config {
    #[prost(bytes = "vec", tag = "1")]
    pub bfruntime_info: ::prost::alloc::vec::Vec<u8>,
}
/// Request to get config of the entire device. Any client can issue this
/// request
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GetForwardingPipelineConfigRequest {
    #[prost(uint32, tag = "1")]
    pub device_id: u32,
    #[prost(uint32, tag = "2")]
    pub client_id: u32,
}
/// Config of the entire device
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetForwardingPipelineConfigResponse {
    /// P4 info
    #[prost(message, repeated, tag = "1")]
    pub config: ::prost::alloc::vec::Vec<ForwardingPipelineConfig>,
    /// Non-P4 info
    #[prost(message, optional, tag = "2")]
    pub non_p4_config: ::core::option::Option<NonP4Config>,
}
/// Error message used to report a single P4-entity error for a Write RPC.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Error {
    /// gRPC canonical error code (see
    /// github.com/grpc/grpc-go/blob/master/codes/codes.go)
    #[prost(int32, tag = "1")]
    pub canonical_code: i32,
    /// Detailed error message.
    #[prost(string, tag = "2")]
    pub message: ::prost::alloc::string::String,
    /// Target and architecture specific space to which this error belongs.
    /// We encourage using triplet: <target>-<arch>-<vendor>,
    /// e.g."targetX-psa-vendor1" or "targetY-psa-vendor2".
    #[prost(string, tag = "3")]
    pub space: ::prost::alloc::string::String,
    /// Numeric code drawn from target-specific error space above.
    #[prost(int32, tag = "4")]
    pub code: i32,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SetForwardingPipelineConfigResponseType {
    /// WARM_INIT_STARTED indicates a successful
    WarmInitStarted = 0,
    /// WARM_INIT_FINISHED indicates a successful
    WarmInitFinished = 1,
}
impl SetForwardingPipelineConfigResponseType {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::WarmInitStarted => "WARM_INIT_STARTED",
            Self::WarmInitFinished => "WARM_INIT_FINISHED",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "WARM_INIT_STARTED" => Some(Self::WarmInitStarted),
            "WARM_INIT_FINISHED" => Some(Self::WarmInitFinished),
            _ => None,
        }
    }
}
/// Generated client implementations.
pub mod bf_runtime_client {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value
    )]
    use tonic::codegen::http::Uri;
    use tonic::codegen::*;
    #[derive(Debug, Clone)]
    pub struct BfRuntimeClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl BfRuntimeClient<tonic::transport::Channel> {
        /// Attempt to create a new client by connecting to a given endpoint.
        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
        where
            D: TryInto<tonic::transport::Endpoint>,
            D::Error: Into<StdError>,
        {
            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
            Ok(Self::new(conn))
        }
    }
    impl<T> BfRuntimeClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::Body>,
        T::Error: Into<StdError>,
        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
    {
        pub fn new(inner: T) -> Self {
            let inner = tonic::client::Grpc::new(inner);
            Self { inner }
        }
        pub fn with_origin(inner: T, origin: Uri) -> Self {
            let inner = tonic::client::Grpc::with_origin(inner, origin);
            Self { inner }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> BfRuntimeClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                http::Request<tonic::body::Body>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
                Into<StdError> + std::marker::Send + std::marker::Sync,
        {
            BfRuntimeClient::new(InterceptedService::new(inner, interceptor))
        }
        /// Compress requests with the given encoding.
        ///
        /// This requires the server to support it otherwise it might respond with an
        /// error.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.send_compressed(encoding);
            self
        }
        /// Enable decompressing responses.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.accept_compressed(encoding);
            self
        }
        /// Limits the maximum size of a decoded message.
        ///
        /// Default: `4MB`
        #[must_use]
        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_decoding_message_size(limit);
            self
        }
        /// Limits the maximum size of an encoded message.
        ///
        /// Default: `usize::MAX`
        #[must_use]
        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_encoding_message_size(limit);
            self
        }
        /// Update one or more P4 entities on the target.
        pub async fn write(
            &mut self,
            request: impl tonic::IntoRequest<super::WriteRequest>,
        ) -> std::result::Result<tonic::Response<super::WriteResponse>, tonic::Status> {
            self.inner.ready().await.map_err(|e| {
                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
            })?;
            let codec = tonic_prost::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static("/bfrt_proto.BfRuntime/Write");
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(GrpcMethod::new("bfrt_proto.BfRuntime", "Write"));
            self.inner.unary(req, path, codec).await
        }
        /// Read one or more P4 entities from the target.
        pub async fn read(
            &mut self,
            request: impl tonic::IntoRequest<super::ReadRequest>,
        ) -> std::result::Result<
            tonic::Response<tonic::codec::Streaming<super::ReadResponse>>,
            tonic::Status,
        > {
            self.inner.ready().await.map_err(|e| {
                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
            })?;
            let codec = tonic_prost::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static("/bfrt_proto.BfRuntime/Read");
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(GrpcMethod::new("bfrt_proto.BfRuntime", "Read"));
            self.inner.server_streaming(req, path, codec).await
        }
        /// Sets the P4 fowarding-pipeline config.
        pub async fn set_forwarding_pipeline_config(
            &mut self,
            request: impl tonic::IntoRequest<super::SetForwardingPipelineConfigRequest>,
        ) -> std::result::Result<
            tonic::Response<super::SetForwardingPipelineConfigResponse>,
            tonic::Status,
        > {
            self.inner.ready().await.map_err(|e| {
                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
            })?;
            let codec = tonic_prost::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/bfrt_proto.BfRuntime/SetForwardingPipelineConfig",
            );
            let mut req = request.into_request();
            req.extensions_mut().insert(GrpcMethod::new(
                "bfrt_proto.BfRuntime",
                "SetForwardingPipelineConfig",
            ));
            self.inner.unary(req, path, codec).await
        }
        /// Gets the current P4 fowarding-pipeline config.
        pub async fn get_forwarding_pipeline_config(
            &mut self,
            request: impl tonic::IntoRequest<super::GetForwardingPipelineConfigRequest>,
        ) -> std::result::Result<
            tonic::Response<super::GetForwardingPipelineConfigResponse>,
            tonic::Status,
        > {
            self.inner.ready().await.map_err(|e| {
                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
            })?;
            let codec = tonic_prost::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/bfrt_proto.BfRuntime/GetForwardingPipelineConfig",
            );
            let mut req = request.into_request();
            req.extensions_mut().insert(GrpcMethod::new(
                "bfrt_proto.BfRuntime",
                "GetForwardingPipelineConfig",
            ));
            self.inner.unary(req, path, codec).await
        }
        /// Represents the bidirectional stream between the controller and the
        /// switch (initiated by the controller).
        pub async fn stream_channel(
            &mut self,
            request: impl tonic::IntoStreamingRequest<Message = super::StreamMessageRequest>,
        ) -> std::result::Result<
            tonic::Response<tonic::codec::Streaming<super::StreamMessageResponse>>,
            tonic::Status,
        > {
            self.inner.ready().await.map_err(|e| {
                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
            })?;
            let codec = tonic_prost::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static("/bfrt_proto.BfRuntime/StreamChannel");
            let mut req = request.into_streaming_request();
            req.extensions_mut()
                .insert(GrpcMethod::new("bfrt_proto.BfRuntime", "StreamChannel"));
            self.inner.streaming(req, path, codec).await
        }
    }
}
/// Generated server implementations.
pub mod bf_runtime_server {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value
    )]
    use tonic::codegen::*;
    /// Generated trait containing gRPC methods that should be implemented for use with BfRuntimeServer.
    #[async_trait]
    pub trait BfRuntime: std::marker::Send + std::marker::Sync + 'static {
        /// Update one or more P4 entities on the target.
        async fn write(
            &self,
            request: tonic::Request<super::WriteRequest>,
        ) -> std::result::Result<tonic::Response<super::WriteResponse>, tonic::Status>;
        /// Server streaming response type for the Read method.
        type ReadStream: tonic::codegen::tokio_stream::Stream<
                Item = std::result::Result<super::ReadResponse, tonic::Status>,
            > + std::marker::Send
            + 'static;
        /// Read one or more P4 entities from the target.
        async fn read(
            &self,
            request: tonic::Request<super::ReadRequest>,
        ) -> std::result::Result<tonic::Response<Self::ReadStream>, tonic::Status>;
        /// Sets the P4 fowarding-pipeline config.
        async fn set_forwarding_pipeline_config(
            &self,
            request: tonic::Request<super::SetForwardingPipelineConfigRequest>,
        ) -> std::result::Result<
            tonic::Response<super::SetForwardingPipelineConfigResponse>,
            tonic::Status,
        >;
        /// Gets the current P4 fowarding-pipeline config.
        async fn get_forwarding_pipeline_config(
            &self,
            request: tonic::Request<super::GetForwardingPipelineConfigRequest>,
        ) -> std::result::Result<
            tonic::Response<super::GetForwardingPipelineConfigResponse>,
            tonic::Status,
        >;
        /// Server streaming response type for the StreamChannel method.
        type StreamChannelStream: tonic::codegen::tokio_stream::Stream<
                Item = std::result::Result<super::StreamMessageResponse, tonic::Status>,
            > + std::marker::Send
            + 'static;
        /// Represents the bidirectional stream between the controller and the
        /// switch (initiated by the controller).
        async fn stream_channel(
            &self,
            request: tonic::Request<tonic::Streaming<super::StreamMessageRequest>>,
        ) -> std::result::Result<tonic::Response<Self::StreamChannelStream>, tonic::Status>;
    }
    #[derive(Debug)]
    pub struct BfRuntimeServer<T> {
        inner: Arc<T>,
        accept_compression_encodings: EnabledCompressionEncodings,
        send_compression_encodings: EnabledCompressionEncodings,
        max_decoding_message_size: Option<usize>,
        max_encoding_message_size: Option<usize>,
    }
    impl<T> BfRuntimeServer<T> {
        pub fn new(inner: T) -> Self {
            Self::from_arc(Arc::new(inner))
        }
        pub fn from_arc(inner: Arc<T>) -> Self {
            Self {
                inner,
                accept_compression_encodings: Default::default(),
                send_compression_encodings: Default::default(),
                max_decoding_message_size: None,
                max_encoding_message_size: None,
            }
        }
        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
        where
            F: tonic::service::Interceptor,
        {
            InterceptedService::new(Self::new(inner), interceptor)
        }
        /// Enable decompressing requests with the given encoding.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.accept_compression_encodings.enable(encoding);
            self
        }
        /// Compress responses with the given encoding, if the client supports it.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.send_compression_encodings.enable(encoding);
            self
        }
        /// Limits the maximum size of a decoded message.
        ///
        /// Default: `4MB`
        #[must_use]
        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
            self.max_decoding_message_size = Some(limit);
            self
        }
        /// Limits the maximum size of an encoded message.
        ///
        /// Default: `usize::MAX`
        #[must_use]
        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
            self.max_encoding_message_size = Some(limit);
            self
        }
    }
    impl<T, B> tonic::codegen::Service<http::Request<B>> for BfRuntimeServer<T>
    where
        T: BfRuntime,
        B: Body + std::marker::Send + 'static,
        B::Error: Into<StdError> + std::marker::Send + 'static,
    {
        type Response = http::Response<tonic::body::Body>;
        type Error = std::convert::Infallible;
        type Future = BoxFuture<Self::Response, Self::Error>;
        fn poll_ready(
            &mut self,
            _cx: &mut Context<'_>,
        ) -> Poll<std::result::Result<(), Self::Error>> {
            Poll::Ready(Ok(()))
        }
        fn call(&mut self, req: http::Request<B>) -> Self::Future {
            match req.uri().path() {
                "/bfrt_proto.BfRuntime/Write" => {
                    #[allow(non_camel_case_types)]
                    struct WriteSvc<T: BfRuntime>(pub Arc<T>);
                    impl<T: BfRuntime> tonic::server::UnaryService<super::WriteRequest> for WriteSvc<T> {
                        type Response = super::WriteResponse;
                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::WriteRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move { <T as BfRuntime>::write(&inner, request).await };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let max_decoding_message_size = self.max_decoding_message_size;
                    let max_encoding_message_size = self.max_encoding_message_size;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let method = WriteSvc(inner);
                        let codec = tonic_prost::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            )
                            .apply_max_message_size_config(
                                max_decoding_message_size,
                                max_encoding_message_size,
                            );
                        let res = grpc.unary(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                "/bfrt_proto.BfRuntime/Read" => {
                    #[allow(non_camel_case_types)]
                    struct ReadSvc<T: BfRuntime>(pub Arc<T>);
                    impl<T: BfRuntime> tonic::server::ServerStreamingService<super::ReadRequest> for ReadSvc<T> {
                        type Response = super::ReadResponse;
                        type ResponseStream = T::ReadStream;
                        type Future =
                            BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::ReadRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move { <T as BfRuntime>::read(&inner, request).await };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let max_decoding_message_size = self.max_decoding_message_size;
                    let max_encoding_message_size = self.max_encoding_message_size;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let method = ReadSvc(inner);
                        let codec = tonic_prost::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            )
                            .apply_max_message_size_config(
                                max_decoding_message_size,
                                max_encoding_message_size,
                            );
                        let res = grpc.server_streaming(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                "/bfrt_proto.BfRuntime/SetForwardingPipelineConfig" => {
                    #[allow(non_camel_case_types)]
                    struct SetForwardingPipelineConfigSvc<T: BfRuntime>(pub Arc<T>);
                    impl<T: BfRuntime>
                        tonic::server::UnaryService<super::SetForwardingPipelineConfigRequest>
                        for SetForwardingPipelineConfigSvc<T>
                    {
                        type Response = super::SetForwardingPipelineConfigResponse;
                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::SetForwardingPipelineConfigRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as BfRuntime>::set_forwarding_pipeline_config(&inner, request)
                                    .await
                            };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let max_decoding_message_size = self.max_decoding_message_size;
                    let max_encoding_message_size = self.max_encoding_message_size;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let method = SetForwardingPipelineConfigSvc(inner);
                        let codec = tonic_prost::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            )
                            .apply_max_message_size_config(
                                max_decoding_message_size,
                                max_encoding_message_size,
                            );
                        let res = grpc.unary(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                "/bfrt_proto.BfRuntime/GetForwardingPipelineConfig" => {
                    #[allow(non_camel_case_types)]
                    struct GetForwardingPipelineConfigSvc<T: BfRuntime>(pub Arc<T>);
                    impl<T: BfRuntime>
                        tonic::server::UnaryService<super::GetForwardingPipelineConfigRequest>
                        for GetForwardingPipelineConfigSvc<T>
                    {
                        type Response = super::GetForwardingPipelineConfigResponse;
                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::GetForwardingPipelineConfigRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as BfRuntime>::get_forwarding_pipeline_config(&inner, request)
                                    .await
                            };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let max_decoding_message_size = self.max_decoding_message_size;
                    let max_encoding_message_size = self.max_encoding_message_size;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let method = GetForwardingPipelineConfigSvc(inner);
                        let codec = tonic_prost::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            )
                            .apply_max_message_size_config(
                                max_decoding_message_size,
                                max_encoding_message_size,
                            );
                        let res = grpc.unary(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                "/bfrt_proto.BfRuntime/StreamChannel" => {
                    #[allow(non_camel_case_types)]
                    struct StreamChannelSvc<T: BfRuntime>(pub Arc<T>);
                    impl<T: BfRuntime> tonic::server::StreamingService<super::StreamMessageRequest>
                        for StreamChannelSvc<T>
                    {
                        type Response = super::StreamMessageResponse;
                        type ResponseStream = T::StreamChannelStream;
                        type Future =
                            BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>;
                        fn call(
                            &mut self,
                            request: tonic::Request<tonic::Streaming<super::StreamMessageRequest>>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as BfRuntime>::stream_channel(&inner, request).await
                            };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let max_decoding_message_size = self.max_decoding_message_size;
                    let max_encoding_message_size = self.max_encoding_message_size;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let method = StreamChannelSvc(inner);
                        let codec = tonic_prost::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            )
                            .apply_max_message_size_config(
                                max_decoding_message_size,
                                max_encoding_message_size,
                            );
                        let res = grpc.streaming(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                _ => Box::pin(async move {
                    let mut response = http::Response::new(tonic::body::Body::default());
                    let headers = response.headers_mut();
                    headers.insert(
                        tonic::Status::GRPC_STATUS,
                        (tonic::Code::Unimplemented as i32).into(),
                    );
                    headers.insert(
                        http::header::CONTENT_TYPE,
                        tonic::metadata::GRPC_CONTENT_TYPE,
                    );
                    Ok(response)
                }),
            }
        }
    }
    impl<T> Clone for BfRuntimeServer<T> {
        fn clone(&self) -> Self {
            let inner = self.inner.clone();
            Self {
                inner,
                accept_compression_encodings: self.accept_compression_encodings,
                send_compression_encodings: self.send_compression_encodings,
                max_decoding_message_size: self.max_decoding_message_size,
                max_encoding_message_size: self.max_encoding_message_size,
            }
        }
    }
    /// Generated gRPC service name
    pub const SERVICE_NAME: &str = "bfrt_proto.BfRuntime";
    impl<T> tonic::server::NamedService for BfRuntimeServer<T> {
        const NAME: &'static str = SERVICE_NAME;
    }
}