authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-10-30 20:41:28-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-10-30 20:41:28-04:00
logc52ee6efcabbe02e238e61da48fb12da8e1c927d
treee00c93f850a8b9fa56c6d1d526e7246488cb1246
parent0de862e8bafce9a58c1018e9b6f81b3d17279c10
signaturelock-open Commit is signed but in an unrecognized format.

canonicalize std.os IPPROTO constants


3 files changed, 459 insertions(+), 99 deletions(-)

lib/std/os/bits/freebsd.zig+348-37
......@@ -344,43 +344,6 @@ pub const SOCK_SEQPACKET = 5;
344344pub const SOCK_CLOEXEC = 0x10000000;
345345pub const SOCK_NONBLOCK = 0x20000000;
346346
347pub const PROTO_ip = 0o000;
348pub const PROTO_icmp = 0o001;
349pub const PROTO_igmp = 0o002;
350pub const PROTO_ggp = 0o003;
351pub const PROTO_ipencap = 0o004;
352pub const PROTO_st = 0o005;
353pub const PROTO_tcp = 0o006;
354pub const PROTO_egp = 0o010;
355pub const PROTO_pup = 0o014;
356pub const PROTO_udp = 0o021;
357pub const PROTO_hmp = 0o024;
358pub const PROTO_xns_idp = 0o026;
359pub const PROTO_rdp = 0o033;
360pub const PROTO_iso_tp4 = 0o035;
361pub const PROTO_xtp = 0o044;
362pub const PROTO_ddp = 0o045;
363pub const PROTO_idpr_cmtp = 0o046;
364pub const PROTO_ipv6 = 0o051;
365pub const PROTO_ipv6_route = 0o053;
366pub const PROTO_ipv6_frag = 0o054;
367pub const PROTO_idrp = 0o055;
368pub const PROTO_rsvp = 0o056;
369pub const PROTO_gre = 0o057;
370pub const PROTO_esp = 0o062;
371pub const PROTO_ah = 0o063;
372pub const PROTO_skip = 0o071;
373pub const PROTO_ipv6_icmp = 0o072;
374pub const PROTO_ipv6_nonxt = 0o073;
375pub const PROTO_ipv6_opts = 0o074;
376pub const PROTO_rspf = 0o111;
377pub const PROTO_vmtp = 0o121;
378pub const PROTO_ospf = 0o131;
379pub const PROTO_ipip = 0o136;
380pub const PROTO_encap = 0o142;
381pub const PROTO_pim = 0o147;
382pub const PROTO_raw = 0o377;
383
384347pub const PF_UNSPEC = 0;
385348pub const PF_LOCAL = 1;
386349pub const PF_UNIX = PF_LOCAL;
......@@ -971,3 +934,351 @@ pub const AT_REMOVEDIR = 0x0800;
971934
972935/// Fail if not under dirfd
973936pub const AT_BENEATH = 0x1000;
937
938/// dummy for IP
939pub const IPPROTO_IP = 0;
940
941/// control message protocol
942pub const IPPROTO_ICMP = 1;
943
944/// tcp
945pub const IPPROTO_TCP = 6;
946
947/// user datagram protocol
948pub const IPPROTO_UDP = 17;
949
950/// IP6 header
951pub const IPPROTO_IPV6 = 41;
952
953/// raw IP packet
954pub const IPPROTO_RAW = 255;
955
956/// IP6 hop-by-hop options
957pub const IPPROTO_HOPOPTS = 0;
958
959/// group mgmt protocol
960pub const IPPROTO_IGMP = 2;
961
962/// gateway^2 (deprecated)
963pub const IPPROTO_GGP = 3;
964
965/// IPv4 encapsulation
966pub const IPPROTO_IPV4 = 4;
967
968/// for compatibility
969pub const IPPROTO_IPIP = IPPROTO_IPV4;
970
971/// Stream protocol II
972pub const IPPROTO_ST = 7;
973
974/// exterior gateway protocol
975pub const IPPROTO_EGP = 8;
976
977/// private interior gateway
978pub const IPPROTO_PIGP = 9;
979
980/// BBN RCC Monitoring
981pub const IPPROTO_RCCMON = 10;
982
983/// network voice protocol
984pub const IPPROTO_NVPII = 11;
985
986/// pup
987pub const IPPROTO_PUP = 12;
988
989/// Argus
990pub const IPPROTO_ARGUS = 13;
991
992/// EMCON
993pub const IPPROTO_EMCON = 14;
994
995/// Cross Net Debugger
996pub const IPPROTO_XNET = 15;
997
998/// Chaos
999pub const IPPROTO_CHAOS = 16;
1000
1001/// Multiplexing
1002pub const IPPROTO_MUX = 18;
1003
1004/// DCN Measurement Subsystems
1005pub const IPPROTO_MEAS = 19;
1006
1007/// Host Monitoring
1008pub const IPPROTO_HMP = 20;
1009
1010/// Packet Radio Measurement
1011pub const IPPROTO_PRM = 21;
1012
1013/// xns idp
1014pub const IPPROTO_IDP = 22;
1015
1016/// Trunk-1
1017pub const IPPROTO_TRUNK1 = 23;
1018
1019/// Trunk-2
1020pub const IPPROTO_TRUNK2 = 24;
1021
1022/// Leaf-1
1023pub const IPPROTO_LEAF1 = 25;
1024
1025/// Leaf-2
1026pub const IPPROTO_LEAF2 = 26;
1027
1028/// Reliable Data
1029pub const IPPROTO_RDP = 27;
1030
1031/// Reliable Transaction
1032pub const IPPROTO_IRTP = 28;
1033
1034/// tp-4 w/ class negotiation
1035pub const IPPROTO_TP = 29;
1036
1037/// Bulk Data Transfer
1038pub const IPPROTO_BLT = 30;
1039
1040/// Network Services
1041pub const IPPROTO_NSP = 31;
1042
1043/// Merit Internodal
1044pub const IPPROTO_INP = 32;
1045
1046/// Datagram Congestion Control Protocol
1047pub const IPPROTO_DCCP = 33;
1048
1049/// Third Party Connect
1050pub const IPPROTO_3PC = 34;
1051
1052/// InterDomain Policy Routing
1053pub const IPPROTO_IDPR = 35;
1054
1055/// XTP
1056pub const IPPROTO_XTP = 36;
1057
1058/// Datagram Delivery
1059pub const IPPROTO_DDP = 37;
1060
1061/// Control Message Transport
1062pub const IPPROTO_CMTP = 38;
1063
1064/// TP++ Transport
1065pub const IPPROTO_TPXX = 39;
1066
1067/// IL transport protocol
1068pub const IPPROTO_IL = 40;
1069
1070/// Source Demand Routing
1071pub const IPPROTO_SDRP = 42;
1072
1073/// IP6 routing header
1074pub const IPPROTO_ROUTING = 43;
1075
1076/// IP6 fragmentation header
1077pub const IPPROTO_FRAGMENT = 44;
1078
1079/// InterDomain Routing
1080pub const IPPROTO_IDRP = 45;
1081
1082/// resource reservation
1083pub const IPPROTO_RSVP = 46;
1084
1085/// General Routing Encap.
1086pub const IPPROTO_GRE = 47;
1087
1088/// Mobile Host Routing
1089pub const IPPROTO_MHRP = 48;
1090
1091/// BHA
1092pub const IPPROTO_BHA = 49;
1093
1094/// IP6 Encap Sec. Payload
1095pub const IPPROTO_ESP = 50;
1096
1097/// IP6 Auth Header
1098pub const IPPROTO_AH = 51;
1099
1100/// Integ. Net Layer Security
1101pub const IPPROTO_INLSP = 52;
1102
1103/// IP with encryption
1104pub const IPPROTO_SWIPE = 53;
1105
1106/// Next Hop Resolution
1107pub const IPPROTO_NHRP = 54;
1108
1109/// IP Mobility
1110pub const IPPROTO_MOBILE = 55;
1111
1112/// Transport Layer Security
1113pub const IPPROTO_TLSP = 56;
1114
1115/// SKIP
1116pub const IPPROTO_SKIP = 57;
1117
1118/// ICMP6
1119pub const IPPROTO_ICMPV6 = 58;
1120
1121/// IP6 no next header
1122pub const IPPROTO_NONE = 59;
1123
1124/// IP6 destination option
1125pub const IPPROTO_DSTOPTS = 60;
1126
1127/// any host internal protocol
1128pub const IPPROTO_AHIP = 61;
1129
1130/// CFTP
1131pub const IPPROTO_CFTP = 62;
1132
1133/// "hello" routing protocol
1134pub const IPPROTO_HELLO = 63;
1135
1136/// SATNET/Backroom EXPAK
1137pub const IPPROTO_SATEXPAK = 64;
1138
1139/// Kryptolan
1140pub const IPPROTO_KRYPTOLAN = 65;
1141
1142/// Remote Virtual Disk
1143pub const IPPROTO_RVD = 66;
1144
1145/// Pluribus Packet Core
1146pub const IPPROTO_IPPC = 67;
1147
1148/// Any distributed FS
1149pub const IPPROTO_ADFS = 68;
1150
1151/// Satnet Monitoring
1152pub const IPPROTO_SATMON = 69;
1153
1154/// VISA Protocol
1155pub const IPPROTO_VISA = 70;
1156
1157/// Packet Core Utility
1158pub const IPPROTO_IPCV = 71;
1159
1160/// Comp. Prot. Net. Executive
1161pub const IPPROTO_CPNX = 72;
1162
1163/// Comp. Prot. HeartBeat
1164pub const IPPROTO_CPHB = 73;
1165
1166/// Wang Span Network
1167pub const IPPROTO_WSN = 74;
1168
1169/// Packet Video Protocol
1170pub const IPPROTO_PVP = 75;
1171
1172/// BackRoom SATNET Monitoring
1173pub const IPPROTO_BRSATMON = 76;
1174
1175/// Sun net disk proto (temp.)
1176pub const IPPROTO_ND = 77;
1177
1178/// WIDEBAND Monitoring
1179pub const IPPROTO_WBMON = 78;
1180
1181/// WIDEBAND EXPAK
1182pub const IPPROTO_WBEXPAK = 79;
1183
1184/// ISO cnlp
1185pub const IPPROTO_EON = 80;
1186
1187/// VMTP
1188pub const IPPROTO_VMTP = 81;
1189
1190/// Secure VMTP
1191pub const IPPROTO_SVMTP = 82;
1192
1193/// Banyon VINES
1194pub const IPPROTO_VINES = 83;
1195
1196/// TTP
1197pub const IPPROTO_TTP = 84;
1198
1199/// NSFNET-IGP
1200pub const IPPROTO_IGP = 85;
1201
1202/// dissimilar gateway prot.
1203pub const IPPROTO_DGP = 86;
1204
1205/// TCF
1206pub const IPPROTO_TCF = 87;
1207
1208/// Cisco/GXS IGRP
1209pub const IPPROTO_IGRP = 88;
1210
1211/// OSPFIGP
1212pub const IPPROTO_OSPFIGP = 89;
1213
1214/// Strite RPC protocol
1215pub const IPPROTO_SRPC = 90;
1216
1217/// Locus Address Resoloution
1218pub const IPPROTO_LARP = 91;
1219
1220/// Multicast Transport
1221pub const IPPROTO_MTP = 92;
1222
1223/// AX.25 Frames
1224pub const IPPROTO_AX25 = 93;
1225
1226/// IP encapsulated in IP
1227pub const IPPROTO_IPEIP = 94;
1228
1229/// Mobile Int.ing control
1230pub const IPPROTO_MICP = 95;
1231
1232/// Semaphore Comm. security
1233pub const IPPROTO_SCCSP = 96;
1234
1235/// Ethernet IP encapsulation
1236pub const IPPROTO_ETHERIP = 97;
1237
1238/// encapsulation header
1239pub const IPPROTO_ENCAP = 98;
1240
1241/// any private encr. scheme
1242pub const IPPROTO_APES = 99;
1243
1244/// GMTP
1245pub const IPPROTO_GMTP = 100;
1246
1247/// payload compression (IPComp)
1248pub const IPPROTO_IPCOMP = 108;
1249
1250/// SCTP
1251pub const IPPROTO_SCTP = 132;
1252
1253/// IPv6 Mobility Header
1254pub const IPPROTO_MH = 135;
1255
1256/// UDP-Lite
1257pub const IPPROTO_UDPLITE = 136;
1258
1259/// IP6 Host Identity Protocol
1260pub const IPPROTO_HIP = 139;
1261
1262/// IP6 Shim6 Protocol
1263pub const IPPROTO_SHIM6 = 140;
1264
1265/// Protocol Independent Mcast
1266pub const IPPROTO_PIM = 103;
1267
1268/// CARP
1269pub const IPPROTO_CARP = 112;
1270
1271/// PGM
1272pub const IPPROTO_PGM = 113;
1273
1274/// MPLS-in-IP
1275pub const IPPROTO_MPLS = 137;
1276
1277/// PFSYNC
1278pub const IPPROTO_PFSYNC = 240;
1279
1280/// Reserved
1281pub const IPPROTO_RESERVED_253 = 253;
1282
1283/// Reserved
1284pub const IPPROTO_RESERVED_254 = 254;
lib/std/os/bits/linux.zig-37
......@@ -227,43 +227,6 @@ pub const SEEK_SET = 0;
227227pub const SEEK_CUR = 1;
228228pub const SEEK_END = 2;
229229
230pub const PROTO_ip = 0o000;
231pub const PROTO_icmp = 0o001;
232pub const PROTO_igmp = 0o002;
233pub const PROTO_ggp = 0o003;
234pub const PROTO_ipencap = 0o004;
235pub const PROTO_st = 0o005;
236pub const PROTO_tcp = 0o006;
237pub const PROTO_egp = 0o010;
238pub const PROTO_pup = 0o014;
239pub const PROTO_udp = 0o021;
240pub const PROTO_hmp = 0o024;
241pub const PROTO_xns_idp = 0o026;
242pub const PROTO_rdp = 0o033;
243pub const PROTO_iso_tp4 = 0o035;
244pub const PROTO_xtp = 0o044;
245pub const PROTO_ddp = 0o045;
246pub const PROTO_idpr_cmtp = 0o046;
247pub const PROTO_ipv6 = 0o051;
248pub const PROTO_ipv6_route = 0o053;
249pub const PROTO_ipv6_frag = 0o054;
250pub const PROTO_idrp = 0o055;
251pub const PROTO_rsvp = 0o056;
252pub const PROTO_gre = 0o057;
253pub const PROTO_esp = 0o062;
254pub const PROTO_ah = 0o063;
255pub const PROTO_skip = 0o071;
256pub const PROTO_ipv6_icmp = 0o072;
257pub const PROTO_ipv6_nonxt = 0o073;
258pub const PROTO_ipv6_opts = 0o074;
259pub const PROTO_rspf = 0o111;
260pub const PROTO_vmtp = 0o121;
261pub const PROTO_ospf = 0o131;
262pub const PROTO_ipip = 0o136;
263pub const PROTO_encap = 0o142;
264pub const PROTO_pim = 0o147;
265pub const PROTO_raw = 0o377;
266
267230pub const SHUT_RD = 0;
268231pub const SHUT_WR = 1;
269232pub const SHUT_RDWR = 2;
lib/std/os/bits/netbsd.zig+111-25
......@@ -330,31 +330,6 @@ pub const SOCK_SEQPACKET = 5;
330330pub const SOCK_CLOEXEC = 0x10000000;
331331pub const SOCK_NONBLOCK = 0x20000000;
332332
333pub const PROTO_ip = 0;
334pub const PROTO_icmp = 1;
335pub const PROTO_igmp = 2;
336pub const PROTO_ggp = 3;
337pub const PROTO_ipencap = 4;
338pub const PROTO_tcp = 6;
339pub const PROTO_egp = 8;
340pub const PROTO_pup = 12;
341pub const PROTO_udp = 17;
342pub const PROTO_xns_idp = 22;
343pub const PROTO_iso_tp4 = 29;
344pub const PROTO_ipv6 = 41;
345pub const PROTO_ipv6_route = 43;
346pub const PROTO_ipv6_frag = 44;
347pub const PROTO_rsvp = 46;
348pub const PROTO_gre = 47;
349pub const PROTO_esp = 50;
350pub const PROTO_ah = 51;
351pub const PROTO_ipv6_icmp = 58;
352pub const PROTO_ipv6_nonxt = 59;
353pub const PROTO_ipv6_opts = 60;
354pub const PROTO_encap = 98;
355pub const PROTO_pim = 103;
356pub const PROTO_raw = 255;
357
358333pub const PF_UNSPEC = 0;
359334pub const PF_LOCAL = 1;
360335pub const PF_UNIX = PF_LOCAL;
......@@ -841,3 +816,114 @@ pub fn S_IWHT(m: u32) bool {
841816}
842817
843818pub const HOST_NAME_MAX = 255;
819
820/// dummy for IP
821pub const IPPROTO_IP = 0;
822
823/// IP6 hop-by-hop options
824pub const IPPROTO_HOPOPTS = 0;
825
826/// control message protocol
827pub const IPPROTO_ICMP = 1;
828
829/// group mgmt protocol
830pub const IPPROTO_IGMP = 2;
831
832/// gateway^2 (deprecated)
833pub const IPPROTO_GGP = 3;
834
835/// IP header
836pub const IPPROTO_IPV4 = 4;
837
838/// IP inside IP
839pub const IPPROTO_IPIP = 4;
840
841/// tcp
842pub const IPPROTO_TCP = 6;
843
844/// exterior gateway protocol
845pub const IPPROTO_EGP = 8;
846
847/// pup
848pub const IPPROTO_PUP = 12;
849
850/// user datagram protocol
851pub const IPPROTO_UDP = 17;
852
853/// xns idp
854pub const IPPROTO_IDP = 22;
855
856/// tp-4 w/ class negotiation
857pub const IPPROTO_TP = 29;
858
859/// DCCP
860pub const IPPROTO_DCCP = 33;
861
862/// IP6 header
863pub const IPPROTO_IPV6 = 41;
864
865/// IP6 routing header
866pub const IPPROTO_ROUTING = 43;
867
868/// IP6 fragmentation header
869pub const IPPROTO_FRAGMENT = 44;
870
871/// resource reservation
872pub const IPPROTO_RSVP = 46;
873
874/// GRE encaps RFC 1701
875pub const IPPROTO_GRE = 47;
876
877/// encap. security payload
878pub const IPPROTO_ESP = 50;
879
880/// authentication header
881pub const IPPROTO_AH = 51;
882
883/// IP Mobility RFC 2004
884pub const IPPROTO_MOBILE = 55;
885
886/// IPv6 ICMP
887pub const IPPROTO_IPV6_ICMP = 58;
888
889/// ICMP6
890pub const IPPROTO_ICMPV6 = 58;
891
892/// IP6 no next header
893pub const IPPROTO_NONE = 59;
894
895/// IP6 destination option
896pub const IPPROTO_DSTOPTS = 60;
897
898/// ISO cnlp
899pub const IPPROTO_EON = 80;
900
901/// Ethernet-in-IP
902pub const IPPROTO_ETHERIP = 97;
903
904/// encapsulation header
905pub const IPPROTO_ENCAP = 98;
906
907/// Protocol indep. multicast
908pub const IPPROTO_PIM = 103;
909
910/// IP Payload Comp. Protocol
911pub const IPPROTO_IPCOMP = 108;
912
913/// VRRP RFC 2338
914pub const IPPROTO_VRRP = 112;
915
916/// Common Address Resolution Protocol
917pub const IPPROTO_CARP = 112;
918
919/// L2TPv3
920pub const IPPROTO_L2TP = 115;
921
922/// SCTP
923pub const IPPROTO_SCTP = 132;
924
925/// PFSYNC
926pub const IPPROTO_PFSYNC = 240;
927
928/// raw IP packet
929pub const IPPROTO_RAW = 255;