this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Updating various header files (needed for SystemConfiguration)

+1337 -83
+450 -73
kernel-include/sys/socket.h
··· 1 1 /* 2 - * Copyright (c) 2000-2012 Apple Inc. All rights reserved. 2 + * Copyright (c) 2000-2015 Apple Inc. All rights reserved. 3 3 * 4 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 5 * ··· 78 78 79 79 #ifdef PRIVATE 80 80 #include <sys/param.h> 81 + #include <uuid/uuid.h> 81 82 #endif /* PRIVATE */ 82 83 83 - #ifndef KERNEL 84 + #ifndef KERNEL 84 85 #include <Availability.h> 85 86 #endif 86 87 ··· 91 92 /* 92 93 * Data types. 93 94 */ 94 - #ifndef _GID_T 95 - typedef __darwin_gid_t gid_t; 96 - #define _GID_T 97 - #endif 98 95 99 - #ifndef _OFF_T 100 - typedef __darwin_off_t off_t; 101 - #define _OFF_T 102 - #endif 103 - 104 - #ifndef _PID_T 105 - typedef __darwin_pid_t pid_t; 106 - #define _PID_T 107 - #endif 108 - 109 - #ifndef _SA_FAMILY_T 110 - #define _SA_FAMILY_T 111 - typedef __uint8_t sa_family_t; 112 - #endif 113 - 114 - #ifndef _SOCKLEN_T 115 - #define _SOCKLEN_T 116 - typedef __darwin_socklen_t socklen_t; 117 - #endif 96 + #include <sys/_types/_gid_t.h> 97 + #include <sys/_types/_off_t.h> 98 + #include <sys/_types/_pid_t.h> 99 + #include <sys/_types/_sa_family_t.h> 100 + #include <sys/_types/_socklen_t.h> 118 101 119 102 /* XXX Not explicitly defined by POSIX, but function return types are */ 120 - #ifndef _SIZE_T 121 - #define _SIZE_T 122 - typedef __darwin_size_t size_t; 123 - #endif 103 + #include <sys/_types/_size_t.h> 124 104 125 105 /* XXX Not explicitly defined by POSIX, but function return types are */ 126 - #ifndef _SSIZE_T 127 - #define _SSIZE_T 128 - typedef __darwin_ssize_t ssize_t; 129 - #endif 106 + #include <sys/_types/_ssize_t.h> 130 107 131 108 /* 132 109 * [XSI] The iovec structure shall be defined as described in <sys/uio.h>. 133 110 */ 134 - #ifndef _STRUCT_IOVEC 135 - #define _STRUCT_IOVEC 136 - struct iovec { 137 - void * iov_base; /* [XSI] Base address of I/O memory region */ 138 - size_t iov_len; /* [XSI] Size of region iov_base points to */ 139 - }; 140 - #endif 111 + #include <sys/_types/_iovec_t.h> 141 112 142 113 #ifdef PRIVATE 143 114 #define SO_TCDBG_PID 0x01 /* Set/get traffic class for PID */ ··· 198 169 #define SO_WANTMORE 0x4000 /* APPLE: Give hint when more data ready */ 199 170 #define SO_WANTOOBFLAG 0x8000 /* APPLE: Want OOB in MSG_FLAG on receive */ 200 171 172 + #ifdef PRIVATE 173 + #define SO_NOWAKEFROMSLEEP 0x10000 /* Don't wake for traffic to this socket */ 174 + #endif 175 + 201 176 #endif /* (!__APPLE__) */ 202 177 #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ 203 178 ··· 228 203 #define SO_UPCALLCLOSEWAIT 0x1027 /* APPLE: block on close until an upcall returns */ 229 204 #endif 230 205 #define SO_LINGER_SEC 0x1080 /* linger on close if data present (in seconds) */ 231 - #define SO_RESTRICTIONS 0x1081 /* APPLE: deny inbound/outbound/both/flag set */ 232 - #define SO_RESTRICT_DENYIN 0x00000001 /* flag for SO_RESTRICTIONS - deny inbound */ 233 - #define SO_RESTRICT_DENYOUT 0x00000002 /* flag for SO_RESTRICTIONS - deny outbound */ 234 - #define SO_RESTRICT_DENYSET 0x80000000 /* flag for SO_RESTRICTIONS - deny has been set */ 206 + #ifdef PRIVATE 207 + #define SO_RESTRICTIONS 0x1081 /* APPLE: deny flag set */ 208 + #define SO_RESTRICT_DENY_IN 0x1 /* deny inbound (trapdoor) */ 209 + #define SO_RESTRICT_DENY_OUT 0x2 /* deny outbound (trapdoor) */ 210 + #define SO_RESTRICT_DENY_CELLULAR 0x4 /* deny use of cellular (trapdoor) */ 211 + #define SO_RESTRICT_DENY_EXPENSIVE 0x8 /* deny use of expensive if (trapdoor)*/ 212 + #endif /* PRIVATE */ 235 213 #define SO_RANDOMPORT 0x1082 /* APPLE: request local port randomization */ 236 214 #define SO_NP_EXTENSIONS 0x1083 /* To turn off some POSIX behavior */ 237 215 #endif ··· 340 318 #define SO_TC_ALL (-1) 341 319 342 320 #define SO_RECV_ANYIF 0x1104 /* unrestricted inbound processing */ 321 + #define SO_TRAFFIC_MGT_BACKGROUND 0x1105 /* Background traffic management */ 322 + 323 + #define SO_FLOW_DIVERT_TOKEN 0x1106 /* flow divert token */ 324 + 325 + #define SO_DELEGATED 0x1107 /* set socket as delegate (pid_t) */ 326 + #define SO_DELEGATED_UUID 0x1108 /* set socket as delegate (uuid_t) */ 327 + #define SO_NECP_ATTRIBUTES 0x1109 /* NECP socket attributes (domain, account, etc.) */ 328 + #define SO_CFIL_SOCK_ID 0x1110 /* get content filter socket ID (cfil_sock_id_t) */ 329 + #if MPTCP 330 + #define SO_MPTCP_FASTJOIN 0x1111 /* fast join MPTCP */ 331 + #endif /* MPTCP */ 343 332 #endif /* PRIVATE */ 333 + #define SO_NUMRCVPKT 0x1112 /* number of datagrams in receive socket buffer */ 334 + #ifdef PRIVATE 335 + #define SO_AWDL_UNRESTRICTED 0x1113 /* try to use AWDL in restricted mode */ 336 + #define SO_EXTENDED_BK_IDLE 0x1114 /* extended time to keep socket idle after app is suspended (int) */ 337 + #endif /* PRIVATE */ 338 + 339 + typedef __uint32_t sae_associd_t; 340 + #define SAE_ASSOCID_ANY 0 341 + #define SAE_ASSOCID_ALL ((sae_associd_t)(-1ULL)) 342 + 343 + typedef __uint32_t sae_connid_t; 344 + #define SAE_CONNID_ANY 0 345 + #define SAE_CONNID_ALL ((sae_connid_t)(-1ULL)) 346 + 347 + /* connectx() flag parameters */ 348 + #define CONNECT_RESUME_ON_READ_WRITE 0x1 /* resume connect() on read/write */ 349 + #define CONNECT_DATA_IDEMPOTENT 0x2 /* data is idempotent */ 350 + 351 + /* sockaddr endpoints */ 352 + typedef struct sa_endpoints { 353 + unsigned int sae_srcif; /* optional source interface */ 354 + struct sockaddr *sae_srcaddr; /* optional source address */ 355 + socklen_t sae_srcaddrlen; /* size of source address */ 356 + struct sockaddr *sae_dstaddr; /* destination address */ 357 + socklen_t sae_dstaddrlen; /* size of destination address */ 358 + } sa_endpoints_t; 344 359 #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ 345 360 346 361 /* ··· 375 390 #ifdef KERNEL_PRIVATE 376 391 #define SONPX_MASK_VALID (SONPX_SETOPTSHUT) 377 392 #define IS_SO_TC_BACKGROUND(_tc_) ((_tc_) == SO_TC_BK || (_tc_) == SO_TC_BK_SYS) 393 + #define IS_SO_TC_BACKGROUNDSYSTEM(_tc_) ((_tc_) == SO_TC_BK_SYS) 378 394 #endif /* KERNEL_PRIVATE */ 379 395 380 396 #endif ··· 420 436 #define AF_IPX 23 /* Novell Internet Protocol */ 421 437 #define AF_SIP 24 /* Simple Internet Protocol */ 422 438 #define pseudo_AF_PIP 25 /* Help Identify PIP packets */ 423 - #ifdef __APPLE__ 424 439 /*define pseudo_AF_BLUE 26 Identify packets for Blue Box - Not used */ 425 440 #define AF_NDRV 27 /* Network Driver 'raw' access */ 426 - #endif 427 441 #define AF_ISDN 28 /* Integrated Services Digital Network*/ 428 442 #define AF_E164 AF_ISDN /* CCITT E.164 recommendation */ 429 443 #define pseudo_AF_KEY 29 /* Internal key-management function */ ··· 431 445 #define AF_INET6 30 /* IPv6 */ 432 446 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) 433 447 #define AF_NATM 31 /* native ATM access */ 434 - #ifdef __APPLE__ 435 448 #define AF_SYSTEM 32 /* Kernel event messages */ 436 449 #define AF_NETBIOS 33 /* NetBIOS */ 437 450 #define AF_PPP 34 /* PPP communication protocol */ 438 - #else 439 - #define AF_ATM 30 /* ATM */ 440 - #endif 441 451 #define pseudo_AF_HDRCMPLT 35 /* Used by BPF to not rewrite headers 442 - * in interface output routine 443 - */ 452 + * in interface output routine */ 444 453 #ifdef PRIVATE 445 454 #define AF_AFP 36 /* Used by AFP */ 446 455 #else 447 456 #define AF_RESERVED_36 36 /* Reserved for internal usage */ 448 457 #endif 449 - 450 - #ifndef __APPLE__ 451 - #define AF_NETGRAPH 32 /* Netgraph sockets */ 452 - #endif 453 458 #define AF_IEEE80211 37 /* IEEE 802.11 protocol */ 454 - #ifdef __APPLE__ 455 459 #define AF_UTUN 38 456 - #endif 457 - #define AF_MAX 39 460 + #ifdef PRIVATE 461 + #define AF_MULTIPATH 39 462 + #endif /* PRIVATE */ 463 + #define AF_MAX 40 458 464 #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ 459 465 460 466 /* ··· 501 507 char __ss_pad2[_SS_PAD2SIZE]; 502 508 }; 503 509 510 + #ifdef BSD_KERNEL_PRIVATE 511 + #include <sys/queue.h> 512 + 513 + struct sockaddr_entry { 514 + TAILQ_ENTRY(sockaddr_entry) se_link; 515 + struct sockaddr *se_addr; 516 + uint32_t se_flags; 517 + }; 518 + 519 + #define SEF_ATTACHED 1 /* attached to sockaddr_list */ 520 + 521 + struct sockaddr_list { 522 + TAILQ_HEAD(, sockaddr_entry) sl_head; 523 + uint32_t sl_cnt; 524 + 525 + }; 526 + #endif /* BSD_KERNEL_PRIVATE */ 527 + 504 528 /* 505 529 * Protocol families, same as address families for now. 506 530 */ ··· 532 556 #define PF_IPX AF_IPX /* same format as AF_NS */ 533 557 #define PF_RTIP pseudo_AF_RTIP /* same format as AF_INET */ 534 558 #define PF_PIP pseudo_AF_PIP 535 - #ifdef __APPLE__ 536 559 #define PF_NDRV AF_NDRV 537 - #endif 538 560 #define PF_ISDN AF_ISDN 539 561 #define PF_KEY pseudo_AF_KEY 540 562 #define PF_INET6 AF_INET6 541 563 #define PF_NATM AF_NATM 542 - #ifdef __APPLE__ 543 564 #define PF_SYSTEM AF_SYSTEM 544 565 #define PF_NETBIOS AF_NETBIOS 545 566 #define PF_PPP AF_PPP 546 567 #ifdef PRIVATE 547 - #define PF_AFP AF_AFP 568 + #define PF_AFP AF_AFP 548 569 #else 549 570 #define PF_RESERVED_36 AF_RESERVED_36 550 571 #endif 551 - 552 - #else 553 - #define PF_ATM AF_ATM 554 - #define PF_NETGRAPH AF_NETGRAPH 555 - #endif 556 - 557 - #ifdef __APPLE__ 558 572 #define PF_UTUN AF_UTUN 559 - #endif 573 + #ifdef PRIVATE 574 + #define PF_MULTIPATH AF_MULTIPATH 575 + #endif /* PRIVATE */ 560 576 #define PF_MAX AF_MAX 561 577 562 578 /* ··· 679 695 int msg_flags; /* [XSI] flags on received message */ 680 696 }; 681 697 682 - #ifdef KERNEL 698 + #ifdef PRIVATE 699 + /* 700 + * Extended version for sendmsg_x() and recvmsg_x() calls 701 + * 702 + * For recvmsg_x(), the size of the data received is given by the field 703 + * msg_datalen. 704 + * 705 + * For sendmsg_x(), the size of the data to send is given by the length of 706 + * the iovec array -- like sendmsg(). The field msg_datalen is ignored. 707 + */ 708 + struct msghdr_x { 709 + void *msg_name; /* optional address */ 710 + socklen_t msg_namelen; /* size of address */ 711 + struct iovec *msg_iov; /* scatter/gather array */ 712 + int msg_iovlen; /* # elements in msg_iov */ 713 + void *msg_control; /* ancillary data, see below */ 714 + socklen_t msg_controllen; /* ancillary data buffer len */ 715 + int msg_flags; /* flags on received message */ 716 + size_t msg_datalen; /* byte length of buffer in msg_iov */ 717 + }; 718 + #endif /* PRIVATE */ 719 + 720 + #ifdef XNU_KERNEL_PRIVATE 683 721 /* 684 722 * In-kernel representation of "struct msghdr" from 685 723 * userspace. Has enough precision for 32-bit or ··· 726 764 int msg_flags; /* flags on received message */ 727 765 }; 728 766 729 - #endif // KERNEL 767 + /* 768 + * In-kernel representation of "struct msghdr_x" from 769 + * userspace. Has enough precision for 32-bit or 770 + * 64-bit clients, but does not need to be packed. 771 + */ 772 + 773 + struct user_msghdr_x { 774 + user_addr_t msg_name; /* optional address */ 775 + socklen_t msg_namelen; /* size of address */ 776 + user_addr_t msg_iov; /* scatter/gather array */ 777 + int msg_iovlen; /* # elements in msg_iov */ 778 + user_addr_t msg_control; /* ancillary data, see below */ 779 + socklen_t msg_controllen; /* ancillary data buffer len */ 780 + int msg_flags; /* flags on received message */ 781 + size_t msg_datalen; /* byte length of buffer in msg_iov */ 782 + }; 783 + 784 + /* 785 + * LP64 user version of struct msghdr_x 786 + * WARNING - keep in sync with struct msghdr_x 787 + */ 788 + 789 + struct user64_msghdr_x { 790 + user64_addr_t msg_name; /* optional address */ 791 + socklen_t msg_namelen; /* size of address */ 792 + user64_addr_t msg_iov; /* scatter/gather array */ 793 + int msg_iovlen; /* # elements in msg_iov */ 794 + user64_addr_t msg_control; /* ancillary data, see below */ 795 + socklen_t msg_controllen; /* ancillary data buffer len */ 796 + int msg_flags; /* flags on received message */ 797 + user64_size_t msg_datalen; /* byte length of buffer in msg_iov */ 798 + }; 799 + 800 + /* 801 + * ILP32 user version of struct msghdr_x 802 + * WARNING - keep in sync with struct msghdr_x 803 + */ 804 + 805 + struct user32_msghdr_x { 806 + user32_addr_t msg_name; /* optional address */ 807 + socklen_t msg_namelen; /* size of address */ 808 + user32_addr_t msg_iov; /* scatter/gather array */ 809 + int msg_iovlen; /* # elements in msg_iov */ 810 + user32_addr_t msg_control; /* ancillary data, see below */ 811 + socklen_t msg_controllen; /* ancillary data buffer len */ 812 + int msg_flags; /* flags on received message */ 813 + user32_size_t msg_datalen; /* byte length of buffer in msg_iov */ 814 + }; 815 + 816 + /* 817 + * In-kernel representation of "struct sa_endpoints" from 818 + * userspace. Has enough precision for 32-bit or 819 + * 64-bit clients, but does not need to be packed. 820 + */ 821 + 822 + struct user_sa_endpoints { 823 + unsigned int sae_srcif; /* optional source interface */ 824 + user_addr_t sae_srcaddr; /* optional source address */ 825 + socklen_t sae_srcaddrlen; /* size of source address */ 826 + user_addr_t sae_dstaddr; /* destination address */ 827 + socklen_t sae_dstaddrlen; /* size of destination address */ 828 + }; 829 + 830 + /* 831 + * LP64 user version of struct sa_endpoints 832 + * WARNING - keep in sync with struct sa_endpoints 833 + */ 834 + 835 + struct user64_sa_endpoints { 836 + unsigned int sae_srcif; /* optional source interface */ 837 + user64_addr_t sae_srcaddr; /* optional source address */ 838 + socklen_t sae_srcaddrlen; /* size of source address */ 839 + user64_addr_t sae_dstaddr; /* destination address */ 840 + socklen_t sae_dstaddrlen; /* size of destination address */ 841 + }; 842 + 843 + /* 844 + * ILP32 user version of struct sa_endpoints 845 + * WARNING - keep in sync with struct sa_endpoints 846 + */ 847 + 848 + struct user32_sa_endpoints { 849 + unsigned int sae_srcif; /* optional source interface */ 850 + user32_addr_t sae_srcaddr; /* optional source address */ 851 + socklen_t sae_srcaddrlen; /* size of source address */ 852 + user32_addr_t sae_dstaddr; /* destination address */ 853 + socklen_t sae_dstaddrlen; /* size of destination address */ 854 + }; 855 + 856 + #endif /* XNU_KERNEL_PRIVATE */ 730 857 731 858 #define MSG_OOB 0x1 /* process out-of-band data */ 732 859 #define MSG_PEEK 0x2 /* peek at incoming message */ ··· 758 885 #define MSG_NEEDSA 0x10000 /* Fail receive if socket address cannot be allocated */ 759 886 #ifdef KERNEL_PRIVATE 760 887 #define MSG_NBIO 0x20000 /* FIONBIO mode, used by fifofs */ 888 + #define MSG_SKIPCFIL 0x40000 /* skip pass content filter */ 761 889 #endif 762 890 #ifdef KERNEL 763 891 #define MSG_USEUPCALL 0x80000000 /* Inherit upcall in sock_accept */ ··· 849 977 #define SCM_TIMESTAMP 0x02 /* timestamp (struct timeval) */ 850 978 #define SCM_CREDS 0x03 /* process creds (struct cmsgcred) */ 851 979 #define SCM_TIMESTAMP_MONOTONIC 0x04 /* timestamp (uint64_t) */ 980 + 981 + #ifdef PRIVATE 982 + #define SCM_SEQNUM 0x05 /* TCP unordered recv seq no */ 983 + #define SCM_MSG_PRIORITY 0x06 /* TCP unordered snd priority */ 984 + #endif /* PRIVATE */ 852 985 853 986 #ifdef KERNEL_PRIVATE 854 987 /* ··· 923 1056 924 1057 #endif /* !_POSIX_C_SOURCE */ 925 1058 1059 + #ifdef PRIVATE 1060 + #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) 1061 + 1062 + /* 1063 + * Structure for SIOCGASSOCIDS 1064 + */ 1065 + struct so_aidreq { 1066 + __uint32_t sar_cnt; /* number of associations */ 1067 + sae_associd_t *sar_aidp; /* array of association IDs */ 1068 + }; 1069 + 1070 + #ifdef BSD_KERNEL_PRIVATE 1071 + struct so_aidreq32 { 1072 + __uint32_t sar_cnt; 1073 + user32_addr_t sar_aidp; 1074 + }; 1075 + 1076 + struct so_aidreq64 { 1077 + __uint32_t sar_cnt; 1078 + user64_addr_t sar_aidp __attribute__((aligned(8))); 1079 + }; 1080 + #endif /* BSD_KERNEL_PRIVATE */ 1081 + 1082 + /* 1083 + * Structure for SIOCGCONNIDS 1084 + */ 1085 + struct so_cidreq { 1086 + sae_associd_t scr_aid; /* association ID */ 1087 + __uint32_t scr_cnt; /* number of connections */ 1088 + sae_connid_t *scr_cidp; /* array of connection IDs */ 1089 + }; 1090 + 1091 + #ifdef BSD_KERNEL_PRIVATE 1092 + struct so_cidreq32 { 1093 + sae_associd_t scr_aid; 1094 + __uint32_t scr_cnt; 1095 + user32_addr_t scr_cidp; 1096 + }; 1097 + 1098 + struct so_cidreq64 { 1099 + sae_associd_t scr_aid; 1100 + __uint32_t scr_cnt; 1101 + user64_addr_t scr_cidp __attribute__((aligned(8))); 1102 + }; 1103 + #endif /* BSD_KERNEL_PRIVATE */ 1104 + 1105 + /* 1106 + * Structure for SIOCGCONNINFO 1107 + */ 1108 + struct so_cinforeq { 1109 + sae_connid_t scir_cid; /* connection ID */ 1110 + __uint32_t scir_flags; /* see flags below */ 1111 + __uint32_t scir_ifindex; /* (last) outbound interface */ 1112 + __int32_t scir_error; /* most recent error */ 1113 + struct sockaddr *scir_src; /* source address */ 1114 + socklen_t scir_src_len; /* source address len */ 1115 + struct sockaddr *scir_dst; /* destination address */ 1116 + socklen_t scir_dst_len; /* destination address len */ 1117 + __uint32_t scir_aux_type; /* aux data type (CIAUX) */ 1118 + void *scir_aux_data; /* aux data */ 1119 + __uint32_t scir_aux_len; /* aux data len */ 1120 + }; 1121 + 1122 + #ifdef BSD_KERNEL_PRIVATE 1123 + struct so_cinforeq32 { 1124 + sae_connid_t scir_cid; 1125 + __uint32_t scir_flags; 1126 + __uint32_t scir_ifindex; 1127 + __int32_t scir_error; 1128 + user32_addr_t scir_src; 1129 + socklen_t scir_src_len; 1130 + user32_addr_t scir_dst; 1131 + socklen_t scir_dst_len; 1132 + __uint32_t scir_aux_type; 1133 + user32_addr_t scir_aux_data; 1134 + __uint32_t scir_aux_len; 1135 + }; 1136 + 1137 + struct so_cinforeq64 { 1138 + sae_connid_t scir_cid; 1139 + __uint32_t scir_flags; 1140 + __uint32_t scir_ifindex; 1141 + __int32_t scir_error; 1142 + user64_addr_t scir_src __attribute__((aligned(8))); 1143 + socklen_t scir_src_len; 1144 + user64_addr_t scir_dst __attribute__((aligned(8))); 1145 + socklen_t scir_dst_len; 1146 + __uint32_t scir_aux_type; 1147 + user64_addr_t scir_aux_data __attribute__((aligned(8))); 1148 + __uint32_t scir_aux_len; 1149 + }; 1150 + #endif /* BSD_KERNEL_PRIVATE */ 1151 + 1152 + /* valid connection info flags */ 1153 + #define CIF_CONNECTING 0x1 /* connection was attempted */ 1154 + #define CIF_CONNECTED 0x2 /* connection is established */ 1155 + #define CIF_DISCONNECTING 0x4 /* disconnection was attempted */ 1156 + #define CIF_DISCONNECTED 0x8 /* has been disconnected */ 1157 + #define CIF_BOUND_IF 0x10 /* bound to an interface */ 1158 + #define CIF_BOUND_IP 0x20 /* bound to a src address */ 1159 + #define CIF_BOUND_PORT 0x40 /* bound to a src port */ 1160 + #define CIF_PREFERRED 0x80 /* connection is primary/preferred */ 1161 + #define CIF_MP_CAPABLE 0x100 /* supports multipath protocol */ 1162 + #define CIF_MP_READY 0x200 /* multipath protocol confirmed */ 1163 + #define CIF_MP_DEGRADED 0x400 /* has lost its multipath capability */ 1164 + #define CIF_MP_ACTIVE 0x800 /* this is the active subflow */ 1165 + 1166 + /* valid connection info auxiliary data types */ 1167 + #define CIAUX_TCP 0x1 /* TCP auxiliary data (conninfo_tcp_t) */ 1168 + 1169 + /* 1170 + * Structure for SIOC{S,G}CONNORDER 1171 + */ 1172 + struct so_cordreq { 1173 + sae_connid_t sco_cid; /* connection ID */ 1174 + __uint32_t sco_rank; /* rank (0 means unspecified) */ 1175 + }; 1176 + 1177 + /* 1178 + * Network policy subclass (of KEV_NETWORK_CLASS) 1179 + */ 1180 + #define KEV_NETPOLICY_SUBCLASS 3 1181 + 1182 + #define KEV_NETPOLICY_IFDENIED 1 /* denied access to interface */ 1183 + 1184 + /* 1185 + * Common structure for KEV_NETPOLICY_SUBCLASS 1186 + */ 1187 + struct netpolicy_event_data { 1188 + __uint64_t eupid; /* effective unique PID */ 1189 + pid_t epid; /* effective PID */ 1190 + #if !defined(__LP64__) 1191 + __uint32_t pad; 1192 + #endif /* __LP64__ */ 1193 + uuid_t euuid; /* effective UUID */ 1194 + }; 1195 + 1196 + /* 1197 + * NETPOLICY_IFDENIED event structure 1198 + */ 1199 + struct kev_netpolicy_ifdenied { 1200 + struct netpolicy_event_data ev_data; 1201 + }; 1202 + 1203 + /* 1204 + * Socket subclass (of KEV_NETWORK_CLASS) 1205 + */ 1206 + #define KEV_SOCKET_SUBCLASS 4 1207 + 1208 + /* 1209 + * Events for KEV_SOCKET_SUBCLASS of KEV_NETWORK_CLASS 1210 + */ 1211 + #define KEV_SOCKET_CLOSED 1 /* completely closed by protocol */ 1212 + 1213 + /* 1214 + * Common structure for KEV_SOCKET_SUBCLASS 1215 + */ 1216 + struct kev_socket_event_data { 1217 + struct sockaddr_storage kev_sockname; 1218 + struct sockaddr_storage kev_peername; 1219 + }; 1220 + 1221 + struct kev_socket_closed { 1222 + struct kev_socket_event_data ev_data; 1223 + }; 1224 + 926 1225 #ifndef KERNEL 927 1226 __BEGIN_DECLS 1227 + 1228 + extern int peeloff(int s, sae_associd_t); 1229 + extern int socket_delegate(int, int, int, pid_t); 1230 + 1231 + /* 1232 + * recvmsg_x() is a system call similar to recvmsg(2) to receive 1233 + * several datagrams at once in the array of message headers "msgp". 1234 + * 1235 + * recvmsg_x() can be used only with protocols handlers that have been specially 1236 + * modified to support sending and receiving several datagrams at once. 1237 + * 1238 + * The size of the array "msgp" is given by the argument "cnt". 1239 + * 1240 + * The "flags" arguments supports only the value MSG_DONTWAIT. 1241 + * 1242 + * Each member of "msgp" array is of type "struct msghdr_x". 1243 + * 1244 + * The "msg_iov" and "msg_iovlen" are input parameters that describe where to 1245 + * store a datagram in a scatter gather locations of buffers -- see recvmsg(2). 1246 + * On output the field "msg_datalen" gives the length of the received datagram. 1247 + * 1248 + * The field "msg_flags" must be set to zero on input. On output, "msg_flags" 1249 + * may have MSG_TRUNC set to indicate the trailing portion of the datagram was 1250 + * discarded because the datagram was larger than the buffer supplied. 1251 + * recvmsg_x() returns as soon as a datagram is truncated. 1252 + * 1253 + * recvmsg_x() may return with less than "cnt" datagrams received based on 1254 + * the low water mark and the amount of data pending in the socket buffer. 1255 + * 1256 + * recvmsg_x() returns the number of datagrams that have been received, 1257 + * or -1 if an error occurred. 1258 + * 1259 + * NOTE: This a private system call, the API is subject to change. 1260 + */ 1261 + ssize_t recvmsg_x(int s, const struct msghdr_x *msgp, u_int cnt, int flags); 1262 + 1263 + /* 1264 + * sendmsg_x() is a system call similar to send(2) to send 1265 + * several datagrams at once in the array of message headers "msgp". 1266 + * 1267 + * sendmsg_x() can be used only with protocols handlers that have been specially 1268 + * modified to support sending and receiving several datagrams at once. 1269 + * 1270 + * The size of the array "msgp" is given by the argument "cnt". 1271 + * 1272 + * The "flags" arguments supports only the value MSG_DONTWAIT. 1273 + * 1274 + * Each member of "msgp" array is of type "struct msghdr_x". 1275 + * 1276 + * The "msg_iov" and "msg_iovlen" are input parameters that specify the 1277 + * data to be sent in a scatter gather locations of buffers -- see sendmsg(2). 1278 + * 1279 + * sendmsg_x() fails with EMSGSIZE if the sum of the length of the datagrams 1280 + * is greater than the high water mark. 1281 + * 1282 + * Address and ancillary data are not supported so the following fields 1283 + * must be set to zero on input: 1284 + * "msg_name", "msg_namelen", "msg_control" and "msg_controllen". 1285 + * 1286 + * The field "msg_flags" and "msg_datalen" must be set to zero on input. 1287 + * 1288 + * sendmsg_x() returns the number of datagrams that have been sent, 1289 + * or -1 if an error occurred. 1290 + * 1291 + * NOTE: This a private system call, the API is subject to change. 1292 + */ 1293 + ssize_t sendmsg_x(int s, const struct msghdr_x *msgp, u_int cnt, int flags); 1294 + __END_DECLS 1295 + #endif /* !KERNEL */ 1296 + #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ 1297 + #endif /* PRIVATE */ 1298 + 1299 + #ifndef KERNEL 1300 + __BEGIN_DECLS 1301 + 928 1302 int accept(int, struct sockaddr * __restrict, socklen_t * __restrict) 929 1303 __DARWIN_ALIAS_C(accept); 930 1304 int bind(int, const struct sockaddr *, socklen_t) __DARWIN_ALIAS(bind); ··· 955 1329 956 1330 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) 957 1331 void pfctlinput(int, struct sockaddr *); 1332 + int connectx(int , const sa_endpoints_t *, sae_associd_t, unsigned int, 1333 + const struct iovec *, unsigned int, size_t *, sae_connid_t *); 1334 + int disconnectx(int , sae_associd_t, sae_connid_t); 958 1335 #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ 959 1336 __END_DECLS 960 1337 #endif /* !KERNEL */
+29 -7
kernel-include/sys/sockio.h
··· 1 1 /* 2 - * Copyright (c) 2000-2012 Apple Inc. All rights reserved. 2 + * Copyright (c) 2000-2013 Apple Inc. All rights reserved. 3 3 * 4 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 5 * ··· 197 197 #define SIOCSIFDEVMTU SIOCSIFALTMTU /* deprecated */ 198 198 #endif /* KERNEL_PRIVATE */ 199 199 200 - #ifdef PRIVATE 201 - #ifdef KERNEL 200 + #if !defined(KERNEL) || defined(KERNEL_PRIVATE) 202 201 #define SIOCIFGCLONERS _IOWR('i', 129, struct if_clonereq) /* get cloners */ 202 + #endif /* !KERNEL || KERNEL_PRIVATE */ 203 + #ifdef KERNEL_PRIVATE 203 204 #define SIOCIFGCLONERS32 _IOWR('i', 129, struct if_clonereq32) /* get cloners */ 204 205 #define SIOCIFGCLONERS64 _IOWR('i', 129, struct if_clonereq64) /* get cloners */ 205 - #endif /* KERNEL */ 206 - 207 - #endif /* PRIVATE */ 206 + #endif /* KERNEL_PRIVATE */ 208 207 209 208 #define SIOCGIFASYNCMAP _IOWR('i', 124, struct ifreq) /* get ppp asyncmap */ 210 209 #define SIOCSIFASYNCMAP _IOW('i', 125, struct ifreq) /* set ppp asyncmap */ 211 210 212 211 213 212 #ifdef PRIVATE 214 - #define SIOCSETOT _IOW('s', 128, int) /* set socket for LibOT */ 213 + #define SIOCSETOT _IOW('s', 128, int) /* deprecated */ 215 214 #endif /* PRIVATE */ 216 215 217 216 #define SIOCGIFMAC _IOWR('i', 130, struct ifreq) /* get IF MAC label */ ··· 237 236 #define SIOCGIFTHROTTLE _IOWR('i', 149, struct if_throttlereq) 238 237 #endif /* PRIVATE */ 239 238 239 + #ifdef PRIVATE 240 + #define SIOCGASSOCIDS _IOWR('s', 150, struct so_aidreq) /* get associds */ 241 + #define SIOCGCONNIDS _IOWR('s', 151, struct so_cidreq) /* get connids */ 242 + #define SIOCGCONNINFO _IOWR('s', 152, struct so_cinforeq) /* get conninfo */ 243 + #ifdef BSD_KERNEL_PRIVATE 244 + #define SIOCGASSOCIDS32 _IOWR('s', 150, struct so_aidreq32) 245 + #define SIOCGASSOCIDS64 _IOWR('s', 150, struct so_aidreq64) 246 + #define SIOCGCONNIDS32 _IOWR('s', 151, struct so_cidreq32) 247 + #define SIOCGCONNIDS64 _IOWR('s', 151, struct so_cidreq64) 248 + #define SIOCGCONNINFO32 _IOWR('s', 152, struct so_cinforeq32) 249 + #define SIOCGCONNINFO64 _IOWR('s', 152, struct so_cinforeq64) 250 + #endif /* BSD_KERNEL_PRIVATE */ 251 + #define SIOCSCONNORDER _IOWR('s', 153, struct so_cordreq) /* set conn order */ 252 + #define SIOCGCONNORDER _IOWR('s', 154, struct so_cordreq) /* get conn order */ 253 + #endif /* PRIVATE */ 254 + 255 + #ifdef PRIVATE 256 + #define SIOCSIFLOG _IOWR('i', 155, struct ifreq) 257 + #define SIOCGIFLOG _IOWR('i', 156, struct ifreq) 258 + #define SIOCGIFDELEGATE _IOWR('i', 157, struct ifreq) 259 + #define SIOCGIFLLADDR _IOWR('i', 158, struct ifreq) /* get link level addr */ 260 + #define SIOCGIFTYPE _IOWR('i', 159, struct ifreq) /* get interface type */ 261 + #endif /* PRIVATE */ 240 262 #endif /* !_SYS_SOCKIO_H_ */
+750 -1
platform-include/sys/socket.h
··· 1 1 /* 2 - * Copyright (c) 2000-2014 Apple Inc. All rights reserved. 2 + * Copyright (c) 2000-2015 Apple Inc. All rights reserved. 3 3 * 4 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 5 * ··· 76 76 #include <sys/cdefs.h> 77 77 #include <machine/_param.h> 78 78 79 + #ifdef PRIVATE 80 + #include <sys/param.h> 81 + #include <uuid/uuid.h> 82 + #endif /* PRIVATE */ 79 83 84 + #ifndef KERNEL 80 85 #include <Availability.h> 86 + #endif 81 87 82 88 /* 83 89 * Definitions related to sockets: types, address families, options. ··· 104 110 */ 105 111 #include <sys/_types/_iovec_t.h> 106 112 113 + #ifdef PRIVATE 114 + #define SO_TCDBG_PID 0x01 /* Set/get traffic class for PID */ 115 + #define SO_TCDBG_PNAME 0x02 /* Set/get traffic class for processes of that name */ 116 + #define SO_TCDBG_PURGE 0x04 /* Purge entries for unused PIDs */ 117 + #define SO_TCDBG_FLUSH 0x08 /* Flush all entries */ 118 + #define SO_TCDBG_COUNT 0x10 /* Get count of entries */ 119 + #define SO_TCDBG_LIST 0x20 /* List entries */ 120 + #define SO_TCDBG_DELETE 0x40 /* Delete a process entry */ 121 + #define SO_TCDBG_TCFLUSH_PID 0x80 /* Flush traffic class for PID */ 122 + 123 + struct so_tcdbg { 124 + u_int32_t so_tcdbg_cmd; 125 + int32_t so_tcdbg_tclass; 126 + u_int32_t so_tcdbg_count; 127 + pid_t so_tcdbg_pid; 128 + char so_tcdbg_pname[MAXCOMLEN + 1]; 129 + int32_t so_tcdbg_opportunistic; /* -1: unspecified, 0: off, 1: on, other: errors */ 130 + }; 131 + #endif /* PRIVATE */ 107 132 108 133 /* 109 134 * Types ··· 144 169 #define SO_WANTMORE 0x4000 /* APPLE: Give hint when more data ready */ 145 170 #define SO_WANTOOBFLAG 0x8000 /* APPLE: Want OOB in MSG_FLAG on receive */ 146 171 172 + #ifdef PRIVATE 173 + #define SO_NOWAKEFROMSLEEP 0x10000 /* Don't wake for traffic to this socket */ 174 + #endif 147 175 148 176 #endif /* (!__APPLE__) */ 149 177 #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ ··· 175 203 #define SO_UPCALLCLOSEWAIT 0x1027 /* APPLE: block on close until an upcall returns */ 176 204 #endif 177 205 #define SO_LINGER_SEC 0x1080 /* linger on close if data present (in seconds) */ 206 + #ifdef PRIVATE 207 + #define SO_RESTRICTIONS 0x1081 /* APPLE: deny flag set */ 208 + #define SO_RESTRICT_DENY_IN 0x1 /* deny inbound (trapdoor) */ 209 + #define SO_RESTRICT_DENY_OUT 0x2 /* deny outbound (trapdoor) */ 210 + #define SO_RESTRICT_DENY_CELLULAR 0x4 /* deny use of cellular (trapdoor) */ 211 + #define SO_RESTRICT_DENY_EXPENSIVE 0x8 /* deny use of expensive if (trapdoor)*/ 212 + #endif /* PRIVATE */ 178 213 #define SO_RANDOMPORT 0x1082 /* APPLE: request local port randomization */ 179 214 #define SO_NP_EXTENSIONS 0x1083 /* To turn off some POSIX behavior */ 180 215 #endif 181 216 217 + #ifdef PRIVATE 218 + #define SO_EXECPATH 0x1085 /* Application Firewall Socket option */ 219 + /* 220 + * Traffic service class definitions (lowest to highest): 221 + * 222 + * SO_TC_BK_SYS 223 + * "Background System-Initiated", high delay tolerant, high loss 224 + * tolerant, elastic flow, variable size & long-lived. E.g: system- 225 + * initiated iCloud synching or Time Capsule backup, for which there 226 + * is no progress feedbacks. 227 + * 228 + * SO_TC_BK 229 + * "Background", user-initiated, high delay tolerant, high loss tolerant, 230 + * elastic flow, variable size. E.g. user-initiated iCloud synching or 231 + * Time Capsule backup; or traffics of background applications, for which 232 + * there is some progress feedbacks. 233 + * 234 + * SO_TC_BE 235 + * "Best Effort", unclassified/standard. This is the default service 236 + * class; pretty much a mix of everything. 237 + * 238 + * SO_TC_RD 239 + * "Responsive Data", a notch higher than "Best Effort", medium delay 240 + * tolerant, elastic & inelastic flow, bursty, long-lived. E.g. email, 241 + * instant messaging, for which there is a sense of interactivity and 242 + * urgency (user waiting for output). 243 + * 244 + * SO_TC_OAM 245 + * "Operations, Administration, and Management", medium delay tolerant, 246 + * low-medium loss tolerant, elastic & inelastic flows, variable size. 247 + * E.g. VPN tunnels. 248 + * 249 + * SO_TC_AV 250 + * "Multimedia Audio/Video Streaming", medium delay tolerant, low-medium 251 + * loss tolerant, elastic flow, constant packet interval, variable rate & 252 + * size. E.g. AirPlay playback (both video and audio). 253 + * 254 + * SO_TC_RV 255 + * "Responsive Multimedia Audio/Video", low delay tolerant, low-medium 256 + * loss tolerant, elastic flow, variable packet interval, rate and size. 257 + * E.g. AirPlay mirroring, screen sharing. 258 + * 259 + * SO_TC_VI 260 + * "Interactive Video", low delay tolerant, low-medium loss tolerant, 261 + * elastic flow, constant packet interval, variable rate & size. E.g. 262 + * FaceTime video. 263 + * 264 + * SO_TC_VO 265 + * "Interactive Voice", low delay tolerant, low loss tolerant, inelastic 266 + * flow, constant packet rate, somewhat fixed size. E.g. VoIP including 267 + * FaceTime audio. 268 + * 269 + * SO_TC_CTL 270 + * "Network Control", low delay tolerant, low loss tolerant, inelastic 271 + * flow, rate is bursty but short, variable size. E.g. DNS queries; 272 + * certain types of locally-originated ICMP, ICMPv6; IGMP/MLD join/leave, 273 + * ARP. 274 + */ 275 + #define SO_TRAFFIC_CLASS 0x1086 /* Traffic service class (int) */ 276 + #define SO_TC_BK_SYS 100 /* lowest class */ 277 + #define SO_TC_BK 200 278 + #define SO_TC_BE 0 279 + #define SO_TC_RD 300 280 + #define SO_TC_OAM 400 281 + #define SO_TC_AV 500 282 + #define SO_TC_RV 600 283 + #define SO_TC_VI 700 284 + #define SO_TC_VO 800 285 + #define SO_TC_CTL 900 /* highest class */ 286 + #define SO_TC_MAX 10 /* Total # of traffic classes */ 287 + #ifdef XNU_KERNEL_PRIVATE 288 + #define _SO_TC_BK 1 /* deprecated */ 289 + #define _SO_TC_VI 2 /* deprecated */ 290 + #define _SO_TC_VO 3 /* deprecated */ 291 + #define _SO_TC_MAX 4 /* deprecated */ 182 292 293 + #define SO_VALID_TC(c) \ 294 + (c == SO_TC_BK_SYS || c == SO_TC_BK || c == SO_TC_BE || \ 295 + c == SO_TC_RD || c == SO_TC_OAM || c == SO_TC_AV || \ 296 + c == SO_TC_RV || c == SO_TC_VI || c == SO_TC_VO || c == SO_TC_CTL) 297 + #endif /* XNU_KERNEL_PRIVATE */ 298 + 299 + /* Background socket configuration flags */ 300 + #define TRAFFIC_MGT_SO_BACKGROUND 0x0001 /* background socket */ 301 + #define TRAFFIC_MGT_TCP_RECVBG 0x0002 /* Only TCP sockets, receiver throttling */ 302 + 303 + #define SO_RECV_TRAFFIC_CLASS 0x1087 /* Receive traffic class (bool)*/ 304 + #define SO_TRAFFIC_CLASS_DBG 0x1088 /* Debug traffic class (struct so_tcdbg) */ 305 + #define SO_TRAFFIC_CLASS_STATS 0x1089 /* Traffic class statistics */ 306 + #define SO_PRIVILEGED_TRAFFIC_CLASS 0x1090 /* Privileged traffic class (bool) */ 307 + #define SO_DEFUNCTOK 0x1100 /* can be defunct'd */ 308 + #define SO_ISDEFUNCT 0x1101 /* get defunct status */ 309 + 310 + #define SO_OPPORTUNISTIC 0x1102 /* deprecated; use SO_TRAFFIC_CLASS */ 311 + 312 + /* 313 + * SO_FLUSH flushes any unsent data generated by a given socket. It takes 314 + * an integer parameter, which can be any of the SO_TC traffic class values, 315 + * or the special SO_TC_ALL value. 316 + */ 317 + #define SO_FLUSH 0x1103 /* flush unsent data (int) */ 318 + #define SO_TC_ALL (-1) 319 + 320 + #define SO_RECV_ANYIF 0x1104 /* unrestricted inbound processing */ 321 + #define SO_TRAFFIC_MGT_BACKGROUND 0x1105 /* Background traffic management */ 322 + 323 + #define SO_FLOW_DIVERT_TOKEN 0x1106 /* flow divert token */ 324 + 325 + #define SO_DELEGATED 0x1107 /* set socket as delegate (pid_t) */ 326 + #define SO_DELEGATED_UUID 0x1108 /* set socket as delegate (uuid_t) */ 327 + #define SO_NECP_ATTRIBUTES 0x1109 /* NECP socket attributes (domain, account, etc.) */ 328 + #define SO_CFIL_SOCK_ID 0x1110 /* get content filter socket ID (cfil_sock_id_t) */ 329 + #if MPTCP 330 + #define SO_MPTCP_FASTJOIN 0x1111 /* fast join MPTCP */ 331 + #endif /* MPTCP */ 332 + #endif /* PRIVATE */ 183 333 #define SO_NUMRCVPKT 0x1112 /* number of datagrams in receive socket buffer */ 334 + #ifdef PRIVATE 335 + #define SO_AWDL_UNRESTRICTED 0x1113 /* try to use AWDL in restricted mode */ 336 + #define SO_EXTENDED_BK_IDLE 0x1114 /* extended time to keep socket idle after app is suspended (int) */ 337 + #endif /* PRIVATE */ 184 338 339 + typedef __uint32_t sae_associd_t; 340 + #define SAE_ASSOCID_ANY 0 341 + #define SAE_ASSOCID_ALL ((sae_associd_t)(-1ULL)) 342 + 343 + typedef __uint32_t sae_connid_t; 344 + #define SAE_CONNID_ANY 0 345 + #define SAE_CONNID_ALL ((sae_connid_t)(-1ULL)) 346 + 347 + /* connectx() flag parameters */ 348 + #define CONNECT_RESUME_ON_READ_WRITE 0x1 /* resume connect() on read/write */ 349 + #define CONNECT_DATA_IDEMPOTENT 0x2 /* data is idempotent */ 350 + 351 + /* sockaddr endpoints */ 352 + typedef struct sa_endpoints { 353 + unsigned int sae_srcif; /* optional source interface */ 354 + struct sockaddr *sae_srcaddr; /* optional source address */ 355 + socklen_t sae_srcaddrlen; /* size of source address */ 356 + struct sockaddr *sae_dstaddr; /* destination address */ 357 + socklen_t sae_dstaddrlen; /* size of destination address */ 358 + } sa_endpoints_t; 185 359 #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ 186 360 187 361 /* ··· 213 387 #define SONPX_SETOPTSHUT 0x000000001 /* flag for allowing setsockopt after shutdown */ 214 388 215 389 390 + #ifdef KERNEL_PRIVATE 391 + #define SONPX_MASK_VALID (SONPX_SETOPTSHUT) 392 + #define IS_SO_TC_BACKGROUND(_tc_) ((_tc_) == SO_TC_BK || (_tc_) == SO_TC_BK_SYS) 393 + #define IS_SO_TC_BACKGROUNDSYSTEM(_tc_) ((_tc_) == SO_TC_BK_SYS) 394 + #endif /* KERNEL_PRIVATE */ 216 395 217 396 #endif 218 397 #endif ··· 271 450 #define AF_PPP 34 /* PPP communication protocol */ 272 451 #define pseudo_AF_HDRCMPLT 35 /* Used by BPF to not rewrite headers 273 452 * in interface output routine */ 453 + #ifdef PRIVATE 454 + #define AF_AFP 36 /* Used by AFP */ 455 + #else 274 456 #define AF_RESERVED_36 36 /* Reserved for internal usage */ 457 + #endif 275 458 #define AF_IEEE80211 37 /* IEEE 802.11 protocol */ 276 459 #define AF_UTUN 38 460 + #ifdef PRIVATE 461 + #define AF_MULTIPATH 39 462 + #endif /* PRIVATE */ 277 463 #define AF_MAX 40 278 464 #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ 279 465 ··· 321 507 char __ss_pad2[_SS_PAD2SIZE]; 322 508 }; 323 509 510 + #ifdef BSD_KERNEL_PRIVATE 511 + #include <sys/queue.h> 512 + 513 + struct sockaddr_entry { 514 + TAILQ_ENTRY(sockaddr_entry) se_link; 515 + struct sockaddr *se_addr; 516 + uint32_t se_flags; 517 + }; 518 + 519 + #define SEF_ATTACHED 1 /* attached to sockaddr_list */ 520 + 521 + struct sockaddr_list { 522 + TAILQ_HEAD(, sockaddr_entry) sl_head; 523 + uint32_t sl_cnt; 524 + 525 + }; 526 + #endif /* BSD_KERNEL_PRIVATE */ 324 527 325 528 /* 326 529 * Protocol families, same as address families for now. ··· 361 564 #define PF_SYSTEM AF_SYSTEM 362 565 #define PF_NETBIOS AF_NETBIOS 363 566 #define PF_PPP AF_PPP 567 + #ifdef PRIVATE 568 + #define PF_AFP AF_AFP 569 + #else 364 570 #define PF_RESERVED_36 AF_RESERVED_36 571 + #endif 365 572 #define PF_UTUN AF_UTUN 573 + #ifdef PRIVATE 574 + #define PF_MULTIPATH AF_MULTIPATH 575 + #endif /* PRIVATE */ 366 576 #define PF_MAX AF_MAX 367 577 368 578 /* ··· 370 580 */ 371 581 #define PF_VLAN ((uint32_t)0x766c616e) /* 'vlan' */ 372 582 #define PF_BOND ((uint32_t)0x626f6e64) /* 'bond' */ 583 + #ifdef KERNEL_PRIVATE 584 + #define PF_BRIDGE ((uint32_t)0x62726467) /* 'brdg' */ 585 + #endif /* KERNEL_PRIVATE */ 373 586 374 587 /* 375 588 * Definitions for network related sysctl, CTL_NET. ··· 383 596 #define NET_MAXID AF_MAX 384 597 #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ 385 598 599 + #ifdef KERNEL_PRIVATE 600 + #define CTL_NET_NAMES { \ 601 + { 0, 0 }, \ 602 + { "local", CTLTYPE_NODE }, \ 603 + { "inet", CTLTYPE_NODE }, \ 604 + { "implink", CTLTYPE_NODE }, \ 605 + { "pup", CTLTYPE_NODE }, \ 606 + { "chaos", CTLTYPE_NODE }, \ 607 + { "xerox_ns", CTLTYPE_NODE }, \ 608 + { "iso", CTLTYPE_NODE }, \ 609 + { "emca", CTLTYPE_NODE }, \ 610 + { "datakit", CTLTYPE_NODE }, \ 611 + { "ccitt", CTLTYPE_NODE }, \ 612 + { "ibm_sna", CTLTYPE_NODE }, \ 613 + { "decnet", CTLTYPE_NODE }, \ 614 + { "dec_dli", CTLTYPE_NODE }, \ 615 + { "lat", CTLTYPE_NODE }, \ 616 + { "hylink", CTLTYPE_NODE }, \ 617 + { "appletalk", CTLTYPE_NODE }, \ 618 + { "route", CTLTYPE_NODE }, \ 619 + { "link_layer", CTLTYPE_NODE }, \ 620 + { "xtp", CTLTYPE_NODE }, \ 621 + { "coip", CTLTYPE_NODE }, \ 622 + { "cnt", CTLTYPE_NODE }, \ 623 + { "rtip", CTLTYPE_NODE }, \ 624 + { "ipx", CTLTYPE_NODE }, \ 625 + { "sip", CTLTYPE_NODE }, \ 626 + { "pip", CTLTYPE_NODE }, \ 627 + { 0, 0 }, \ 628 + { "ndrv", CTLTYPE_NODE }, \ 629 + { "isdn", CTLTYPE_NODE }, \ 630 + { "key", CTLTYPE_NODE }, \ 631 + { "inet6", CTLTYPE_NODE }, \ 632 + { "natm", CTLTYPE_NODE }, \ 633 + { "sys", CTLTYPE_NODE }, \ 634 + { "netbios", CTLTYPE_NODE }, \ 635 + { "ppp", CTLTYPE_NODE }, \ 636 + { "hdrcomplete", CTLTYPE_NODE }, \ 637 + } 638 + #endif /* KERNEL_PRIVATE */ 386 639 387 640 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) 388 641 /* ··· 400 653 #define NET_RT_TRASH 5 /* routes not in table but not freed */ 401 654 #define NET_RT_IFLIST2 6 /* interface list with addresses */ 402 655 #define NET_RT_DUMP2 7 /* dump; may limit to a.f. */ 656 + #ifdef PRIVATE 657 + #define NET_RT_DUMPX 8 /* private */ 658 + #define NET_RT_DUMPX_FLAGS 9 /* private */ 659 + #endif /* PRIVATE */ 403 660 #define NET_RT_MAXID 10 404 661 #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ 405 662 663 + #ifdef KERNEL_PRIVATE 664 + #define CTL_NET_RT_NAMES { \ 665 + { 0, 0 }, \ 666 + { "dump", CTLTYPE_STRUCT }, \ 667 + { "flags", CTLTYPE_STRUCT }, \ 668 + { "iflist", CTLTYPE_STRUCT }, \ 669 + { "stat", CTLTYPE_STRUCT }, \ 670 + { "trash", CTLTYPE_INT }, \ 671 + { "iflist2", CTLTYPE_STRUCT }, \ 672 + { "dump2", CTLTYPE_STRUCT }, \ 673 + { "dumpx", CTLTYPE_STRUCT }, \ 674 + { "dumpx_flags", CTLTYPE_STRUCT }, \ 675 + } 676 + 677 + #endif /* KERNEL_PRIVATE */ 406 678 407 679 /* 408 680 * Maximum queue length specifiable by listen. ··· 423 695 int msg_flags; /* [XSI] flags on received message */ 424 696 }; 425 697 698 + #ifdef PRIVATE 699 + /* 700 + * Extended version for sendmsg_x() and recvmsg_x() calls 701 + * 702 + * For recvmsg_x(), the size of the data received is given by the field 703 + * msg_datalen. 704 + * 705 + * For sendmsg_x(), the size of the data to send is given by the length of 706 + * the iovec array -- like sendmsg(). The field msg_datalen is ignored. 707 + */ 708 + struct msghdr_x { 709 + void *msg_name; /* optional address */ 710 + socklen_t msg_namelen; /* size of address */ 711 + struct iovec *msg_iov; /* scatter/gather array */ 712 + int msg_iovlen; /* # elements in msg_iov */ 713 + void *msg_control; /* ancillary data, see below */ 714 + socklen_t msg_controllen; /* ancillary data buffer len */ 715 + int msg_flags; /* flags on received message */ 716 + size_t msg_datalen; /* byte length of buffer in msg_iov */ 717 + }; 718 + #endif /* PRIVATE */ 426 719 720 + #ifdef XNU_KERNEL_PRIVATE 721 + /* 722 + * In-kernel representation of "struct msghdr" from 723 + * userspace. Has enough precision for 32-bit or 724 + * 64-bit clients, but does not need to be packed. 725 + */ 726 + 727 + struct user_msghdr { 728 + user_addr_t msg_name; /* optional address */ 729 + socklen_t msg_namelen; /* size of address */ 730 + user_addr_t msg_iov; /* scatter/gather array */ 731 + int msg_iovlen; /* # elements in msg_iov */ 732 + user_addr_t msg_control; /* ancillary data, see below */ 733 + socklen_t msg_controllen; /* ancillary data buffer len */ 734 + int msg_flags; /* flags on received message */ 735 + }; 736 + 737 + /* 738 + * LP64 user version of struct msghdr. 739 + * WARNING - keep in sync with struct msghdr 740 + */ 741 + 742 + struct user64_msghdr { 743 + user64_addr_t msg_name; /* optional address */ 744 + socklen_t msg_namelen; /* size of address */ 745 + user64_addr_t msg_iov; /* scatter/gather array */ 746 + int msg_iovlen; /* # elements in msg_iov */ 747 + user64_addr_t msg_control; /* ancillary data, see below */ 748 + socklen_t msg_controllen; /* ancillary data buffer len */ 749 + int msg_flags; /* flags on received message */ 750 + }; 751 + 752 + /* 753 + * ILP32 user version of struct msghdr. 754 + * WARNING - keep in sync with struct msghdr 755 + */ 756 + 757 + struct user32_msghdr { 758 + user32_addr_t msg_name; /* optional address */ 759 + socklen_t msg_namelen; /* size of address */ 760 + user32_addr_t msg_iov; /* scatter/gather array */ 761 + int msg_iovlen; /* # elements in msg_iov */ 762 + user32_addr_t msg_control; /* ancillary data, see below */ 763 + socklen_t msg_controllen; /* ancillary data buffer len */ 764 + int msg_flags; /* flags on received message */ 765 + }; 766 + 767 + /* 768 + * In-kernel representation of "struct msghdr_x" from 769 + * userspace. Has enough precision for 32-bit or 770 + * 64-bit clients, but does not need to be packed. 771 + */ 772 + 773 + struct user_msghdr_x { 774 + user_addr_t msg_name; /* optional address */ 775 + socklen_t msg_namelen; /* size of address */ 776 + user_addr_t msg_iov; /* scatter/gather array */ 777 + int msg_iovlen; /* # elements in msg_iov */ 778 + user_addr_t msg_control; /* ancillary data, see below */ 779 + socklen_t msg_controllen; /* ancillary data buffer len */ 780 + int msg_flags; /* flags on received message */ 781 + size_t msg_datalen; /* byte length of buffer in msg_iov */ 782 + }; 783 + 784 + /* 785 + * LP64 user version of struct msghdr_x 786 + * WARNING - keep in sync with struct msghdr_x 787 + */ 788 + 789 + struct user64_msghdr_x { 790 + user64_addr_t msg_name; /* optional address */ 791 + socklen_t msg_namelen; /* size of address */ 792 + user64_addr_t msg_iov; /* scatter/gather array */ 793 + int msg_iovlen; /* # elements in msg_iov */ 794 + user64_addr_t msg_control; /* ancillary data, see below */ 795 + socklen_t msg_controllen; /* ancillary data buffer len */ 796 + int msg_flags; /* flags on received message */ 797 + user64_size_t msg_datalen; /* byte length of buffer in msg_iov */ 798 + }; 799 + 800 + /* 801 + * ILP32 user version of struct msghdr_x 802 + * WARNING - keep in sync with struct msghdr_x 803 + */ 804 + 805 + struct user32_msghdr_x { 806 + user32_addr_t msg_name; /* optional address */ 807 + socklen_t msg_namelen; /* size of address */ 808 + user32_addr_t msg_iov; /* scatter/gather array */ 809 + int msg_iovlen; /* # elements in msg_iov */ 810 + user32_addr_t msg_control; /* ancillary data, see below */ 811 + socklen_t msg_controllen; /* ancillary data buffer len */ 812 + int msg_flags; /* flags on received message */ 813 + user32_size_t msg_datalen; /* byte length of buffer in msg_iov */ 814 + }; 815 + 816 + /* 817 + * In-kernel representation of "struct sa_endpoints" from 818 + * userspace. Has enough precision for 32-bit or 819 + * 64-bit clients, but does not need to be packed. 820 + */ 821 + 822 + struct user_sa_endpoints { 823 + unsigned int sae_srcif; /* optional source interface */ 824 + user_addr_t sae_srcaddr; /* optional source address */ 825 + socklen_t sae_srcaddrlen; /* size of source address */ 826 + user_addr_t sae_dstaddr; /* destination address */ 827 + socklen_t sae_dstaddrlen; /* size of destination address */ 828 + }; 829 + 830 + /* 831 + * LP64 user version of struct sa_endpoints 832 + * WARNING - keep in sync with struct sa_endpoints 833 + */ 834 + 835 + struct user64_sa_endpoints { 836 + unsigned int sae_srcif; /* optional source interface */ 837 + user64_addr_t sae_srcaddr; /* optional source address */ 838 + socklen_t sae_srcaddrlen; /* size of source address */ 839 + user64_addr_t sae_dstaddr; /* destination address */ 840 + socklen_t sae_dstaddrlen; /* size of destination address */ 841 + }; 842 + 843 + /* 844 + * ILP32 user version of struct sa_endpoints 845 + * WARNING - keep in sync with struct sa_endpoints 846 + */ 847 + 848 + struct user32_sa_endpoints { 849 + unsigned int sae_srcif; /* optional source interface */ 850 + user32_addr_t sae_srcaddr; /* optional source address */ 851 + socklen_t sae_srcaddrlen; /* size of source address */ 852 + user32_addr_t sae_dstaddr; /* destination address */ 853 + socklen_t sae_dstaddrlen; /* size of destination address */ 854 + }; 855 + 856 + #endif /* XNU_KERNEL_PRIVATE */ 427 857 428 858 #define MSG_OOB 0x1 /* process out-of-band data */ 429 859 #define MSG_PEEK 0x2 /* peek at incoming message */ ··· 436 866 #define MSG_DONTWAIT 0x80 /* this message should be nonblocking */ 437 867 #define MSG_EOF 0x100 /* data completes connection */ 438 868 #ifdef __APPLE__ 869 + #ifndef PRIVATE 439 870 #ifdef __APPLE_API_OBSOLETE 440 871 #define MSG_WAITSTREAM 0x200 /* wait up to full request.. may return partial */ 441 872 #endif 873 + #else 874 + #define MSG_WAITSTREAM 0x200 /* wait up to full request.. may return partial */ 875 + #endif 442 876 #define MSG_FLUSH 0x400 /* Start of 'hold' seq; dump so_temp */ 443 877 #define MSG_HOLD 0x800 /* Hold frag in so_temp */ 444 878 #define MSG_SEND 0x1000 /* Send the packet in so_temp */ 445 879 #define MSG_HAVEMORE 0x2000 /* Data ready to be read */ 446 880 #define MSG_RCVMORE 0x4000 /* Data remains in current pkt */ 447 881 #endif 882 + #ifdef KERNEL_PRIVATE 883 + #define MSG_COMPAT 0x8000 /* deprecated */ 884 + #endif /* KERNEL_PRIVATE */ 448 885 #define MSG_NEEDSA 0x10000 /* Fail receive if socket address cannot be allocated */ 886 + #ifdef KERNEL_PRIVATE 887 + #define MSG_NBIO 0x20000 /* FIONBIO mode, used by fifofs */ 888 + #define MSG_SKIPCFIL 0x40000 /* skip pass content filter */ 889 + #endif 890 + #ifdef KERNEL 891 + #define MSG_USEUPCALL 0x80000000 /* Inherit upcall in sock_accept */ 892 + #endif 449 893 #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ 450 894 451 895 /* ··· 522 966 #define CMSG_SPACE(l) (__DARWIN_ALIGN32(sizeof(struct cmsghdr)) + __DARWIN_ALIGN32(l)) 523 967 #define CMSG_LEN(l) (__DARWIN_ALIGN32(sizeof(struct cmsghdr)) + (l)) 524 968 969 + #ifdef KERNEL 970 + #define CMSG_ALIGN(n) __DARWIN_ALIGN32(n) 971 + #endif 525 972 #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ 526 973 527 974 /* "Socket"-level control message types: */ ··· 531 978 #define SCM_CREDS 0x03 /* process creds (struct cmsgcred) */ 532 979 #define SCM_TIMESTAMP_MONOTONIC 0x04 /* timestamp (uint64_t) */ 533 980 981 + #ifdef PRIVATE 982 + #define SCM_SEQNUM 0x05 /* TCP unordered recv seq no */ 983 + #define SCM_MSG_PRIORITY 0x06 /* TCP unordered snd priority */ 984 + #endif /* PRIVATE */ 534 985 986 + #ifdef KERNEL_PRIVATE 987 + /* 988 + * 4.3 compat sockaddr (deprecated) 989 + */ 990 + struct osockaddr { 991 + __uint16_t sa_family; /* address family */ 992 + char sa_data[14]; /* up to 14 bytes of direct address */ 993 + }; 994 + 995 + /* 996 + * 4.3-compat message header (deprecated) 997 + */ 998 + struct omsghdr { 999 + void *msg_name; /* optional address */ 1000 + socklen_t msg_namelen; /* size of address */ 1001 + struct iovec *msg_iov; /* scatter/gather array */ 1002 + int msg_iovlen; /* # elements in msg_iov */ 1003 + void *msg_accrights; /* access rights sent/rcvd */ 1004 + int msg_accrightslen; 1005 + }; 1006 + 1007 + #define SA(s) ((struct sockaddr *)(void *)(s)) 1008 + #endif /* KERNEL_PRIVATE */ 535 1009 #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ 536 1010 537 1011 /* ··· 552 1026 int trl_cnt; /* number of trailer iovec's */ 553 1027 }; 554 1028 1029 + #ifdef KERNEL 1030 + 1031 + /* In-kernel representation */ 1032 + struct user_sf_hdtr { 1033 + user_addr_t headers; /* pointer to an array of header struct iovec's */ 1034 + int hdr_cnt; /* number of header iovec's */ 1035 + user_addr_t trailers; /* pointer to an array of trailer struct iovec's */ 1036 + int trl_cnt; /* number of trailer iovec's */ 1037 + }; 1038 + 1039 + /* LP64 user version of struct sf_hdtr */ 1040 + struct user64_sf_hdtr { 1041 + user64_addr_t headers; /* pointer to an array of header struct iovec's */ 1042 + int hdr_cnt; /* number of header iovec's */ 1043 + user64_addr_t trailers; /* pointer to an array of trailer struct iovec's */ 1044 + int trl_cnt; /* number of trailer iovec's */ 1045 + }; 1046 + 1047 + /* ILP32 user version of struct sf_hdtr */ 1048 + struct user32_sf_hdtr { 1049 + user32_addr_t headers; /* pointer to an array of header struct iovec's */ 1050 + int hdr_cnt; /* number of header iovec's */ 1051 + user32_addr_t trailers; /* pointer to an array of trailer struct iovec's */ 1052 + int trl_cnt; /* number of trailer iovec's */ 1053 + }; 1054 + 1055 + #endif /* KERNEL */ 555 1056 556 1057 #endif /* !_POSIX_C_SOURCE */ 557 1058 1059 + #ifdef PRIVATE 1060 + #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) 558 1061 1062 + /* 1063 + * Structure for SIOCGASSOCIDS 1064 + */ 1065 + struct so_aidreq { 1066 + __uint32_t sar_cnt; /* number of associations */ 1067 + sae_associd_t *sar_aidp; /* array of association IDs */ 1068 + }; 1069 + 1070 + #ifdef BSD_KERNEL_PRIVATE 1071 + struct so_aidreq32 { 1072 + __uint32_t sar_cnt; 1073 + user32_addr_t sar_aidp; 1074 + }; 1075 + 1076 + struct so_aidreq64 { 1077 + __uint32_t sar_cnt; 1078 + user64_addr_t sar_aidp __attribute__((aligned(8))); 1079 + }; 1080 + #endif /* BSD_KERNEL_PRIVATE */ 1081 + 1082 + /* 1083 + * Structure for SIOCGCONNIDS 1084 + */ 1085 + struct so_cidreq { 1086 + sae_associd_t scr_aid; /* association ID */ 1087 + __uint32_t scr_cnt; /* number of connections */ 1088 + sae_connid_t *scr_cidp; /* array of connection IDs */ 1089 + }; 1090 + 1091 + #ifdef BSD_KERNEL_PRIVATE 1092 + struct so_cidreq32 { 1093 + sae_associd_t scr_aid; 1094 + __uint32_t scr_cnt; 1095 + user32_addr_t scr_cidp; 1096 + }; 1097 + 1098 + struct so_cidreq64 { 1099 + sae_associd_t scr_aid; 1100 + __uint32_t scr_cnt; 1101 + user64_addr_t scr_cidp __attribute__((aligned(8))); 1102 + }; 1103 + #endif /* BSD_KERNEL_PRIVATE */ 1104 + 1105 + /* 1106 + * Structure for SIOCGCONNINFO 1107 + */ 1108 + struct so_cinforeq { 1109 + sae_connid_t scir_cid; /* connection ID */ 1110 + __uint32_t scir_flags; /* see flags below */ 1111 + __uint32_t scir_ifindex; /* (last) outbound interface */ 1112 + __int32_t scir_error; /* most recent error */ 1113 + struct sockaddr *scir_src; /* source address */ 1114 + socklen_t scir_src_len; /* source address len */ 1115 + struct sockaddr *scir_dst; /* destination address */ 1116 + socklen_t scir_dst_len; /* destination address len */ 1117 + __uint32_t scir_aux_type; /* aux data type (CIAUX) */ 1118 + void *scir_aux_data; /* aux data */ 1119 + __uint32_t scir_aux_len; /* aux data len */ 1120 + }; 1121 + 1122 + #ifdef BSD_KERNEL_PRIVATE 1123 + struct so_cinforeq32 { 1124 + sae_connid_t scir_cid; 1125 + __uint32_t scir_flags; 1126 + __uint32_t scir_ifindex; 1127 + __int32_t scir_error; 1128 + user32_addr_t scir_src; 1129 + socklen_t scir_src_len; 1130 + user32_addr_t scir_dst; 1131 + socklen_t scir_dst_len; 1132 + __uint32_t scir_aux_type; 1133 + user32_addr_t scir_aux_data; 1134 + __uint32_t scir_aux_len; 1135 + }; 1136 + 1137 + struct so_cinforeq64 { 1138 + sae_connid_t scir_cid; 1139 + __uint32_t scir_flags; 1140 + __uint32_t scir_ifindex; 1141 + __int32_t scir_error; 1142 + user64_addr_t scir_src __attribute__((aligned(8))); 1143 + socklen_t scir_src_len; 1144 + user64_addr_t scir_dst __attribute__((aligned(8))); 1145 + socklen_t scir_dst_len; 1146 + __uint32_t scir_aux_type; 1147 + user64_addr_t scir_aux_data __attribute__((aligned(8))); 1148 + __uint32_t scir_aux_len; 1149 + }; 1150 + #endif /* BSD_KERNEL_PRIVATE */ 1151 + 1152 + /* valid connection info flags */ 1153 + #define CIF_CONNECTING 0x1 /* connection was attempted */ 1154 + #define CIF_CONNECTED 0x2 /* connection is established */ 1155 + #define CIF_DISCONNECTING 0x4 /* disconnection was attempted */ 1156 + #define CIF_DISCONNECTED 0x8 /* has been disconnected */ 1157 + #define CIF_BOUND_IF 0x10 /* bound to an interface */ 1158 + #define CIF_BOUND_IP 0x20 /* bound to a src address */ 1159 + #define CIF_BOUND_PORT 0x40 /* bound to a src port */ 1160 + #define CIF_PREFERRED 0x80 /* connection is primary/preferred */ 1161 + #define CIF_MP_CAPABLE 0x100 /* supports multipath protocol */ 1162 + #define CIF_MP_READY 0x200 /* multipath protocol confirmed */ 1163 + #define CIF_MP_DEGRADED 0x400 /* has lost its multipath capability */ 1164 + #define CIF_MP_ACTIVE 0x800 /* this is the active subflow */ 1165 + 1166 + /* valid connection info auxiliary data types */ 1167 + #define CIAUX_TCP 0x1 /* TCP auxiliary data (conninfo_tcp_t) */ 1168 + 1169 + /* 1170 + * Structure for SIOC{S,G}CONNORDER 1171 + */ 1172 + struct so_cordreq { 1173 + sae_connid_t sco_cid; /* connection ID */ 1174 + __uint32_t sco_rank; /* rank (0 means unspecified) */ 1175 + }; 1176 + 1177 + /* 1178 + * Network policy subclass (of KEV_NETWORK_CLASS) 1179 + */ 1180 + #define KEV_NETPOLICY_SUBCLASS 3 1181 + 1182 + #define KEV_NETPOLICY_IFDENIED 1 /* denied access to interface */ 1183 + 1184 + /* 1185 + * Common structure for KEV_NETPOLICY_SUBCLASS 1186 + */ 1187 + struct netpolicy_event_data { 1188 + __uint64_t eupid; /* effective unique PID */ 1189 + pid_t epid; /* effective PID */ 1190 + #if !defined(__LP64__) 1191 + __uint32_t pad; 1192 + #endif /* __LP64__ */ 1193 + uuid_t euuid; /* effective UUID */ 1194 + }; 1195 + 1196 + /* 1197 + * NETPOLICY_IFDENIED event structure 1198 + */ 1199 + struct kev_netpolicy_ifdenied { 1200 + struct netpolicy_event_data ev_data; 1201 + }; 1202 + 1203 + /* 1204 + * Socket subclass (of KEV_NETWORK_CLASS) 1205 + */ 1206 + #define KEV_SOCKET_SUBCLASS 4 1207 + 1208 + /* 1209 + * Events for KEV_SOCKET_SUBCLASS of KEV_NETWORK_CLASS 1210 + */ 1211 + #define KEV_SOCKET_CLOSED 1 /* completely closed by protocol */ 1212 + 1213 + /* 1214 + * Common structure for KEV_SOCKET_SUBCLASS 1215 + */ 1216 + struct kev_socket_event_data { 1217 + struct sockaddr_storage kev_sockname; 1218 + struct sockaddr_storage kev_peername; 1219 + }; 1220 + 1221 + struct kev_socket_closed { 1222 + struct kev_socket_event_data ev_data; 1223 + }; 1224 + 1225 + #ifndef KERNEL 559 1226 __BEGIN_DECLS 1227 + 1228 + extern int peeloff(int s, sae_associd_t); 1229 + extern int socket_delegate(int, int, int, pid_t); 1230 + 1231 + /* 1232 + * recvmsg_x() is a system call similar to recvmsg(2) to receive 1233 + * several datagrams at once in the array of message headers "msgp". 1234 + * 1235 + * recvmsg_x() can be used only with protocols handlers that have been specially 1236 + * modified to support sending and receiving several datagrams at once. 1237 + * 1238 + * The size of the array "msgp" is given by the argument "cnt". 1239 + * 1240 + * The "flags" arguments supports only the value MSG_DONTWAIT. 1241 + * 1242 + * Each member of "msgp" array is of type "struct msghdr_x". 1243 + * 1244 + * The "msg_iov" and "msg_iovlen" are input parameters that describe where to 1245 + * store a datagram in a scatter gather locations of buffers -- see recvmsg(2). 1246 + * On output the field "msg_datalen" gives the length of the received datagram. 1247 + * 1248 + * The field "msg_flags" must be set to zero on input. On output, "msg_flags" 1249 + * may have MSG_TRUNC set to indicate the trailing portion of the datagram was 1250 + * discarded because the datagram was larger than the buffer supplied. 1251 + * recvmsg_x() returns as soon as a datagram is truncated. 1252 + * 1253 + * recvmsg_x() may return with less than "cnt" datagrams received based on 1254 + * the low water mark and the amount of data pending in the socket buffer. 1255 + * 1256 + * recvmsg_x() returns the number of datagrams that have been received, 1257 + * or -1 if an error occurred. 1258 + * 1259 + * NOTE: This a private system call, the API is subject to change. 1260 + */ 1261 + ssize_t recvmsg_x(int s, const struct msghdr_x *msgp, u_int cnt, int flags); 1262 + 1263 + /* 1264 + * sendmsg_x() is a system call similar to send(2) to send 1265 + * several datagrams at once in the array of message headers "msgp". 1266 + * 1267 + * sendmsg_x() can be used only with protocols handlers that have been specially 1268 + * modified to support sending and receiving several datagrams at once. 1269 + * 1270 + * The size of the array "msgp" is given by the argument "cnt". 1271 + * 1272 + * The "flags" arguments supports only the value MSG_DONTWAIT. 1273 + * 1274 + * Each member of "msgp" array is of type "struct msghdr_x". 1275 + * 1276 + * The "msg_iov" and "msg_iovlen" are input parameters that specify the 1277 + * data to be sent in a scatter gather locations of buffers -- see sendmsg(2). 1278 + * 1279 + * sendmsg_x() fails with EMSGSIZE if the sum of the length of the datagrams 1280 + * is greater than the high water mark. 1281 + * 1282 + * Address and ancillary data are not supported so the following fields 1283 + * must be set to zero on input: 1284 + * "msg_name", "msg_namelen", "msg_control" and "msg_controllen". 1285 + * 1286 + * The field "msg_flags" and "msg_datalen" must be set to zero on input. 1287 + * 1288 + * sendmsg_x() returns the number of datagrams that have been sent, 1289 + * or -1 if an error occurred. 1290 + * 1291 + * NOTE: This a private system call, the API is subject to change. 1292 + */ 1293 + ssize_t sendmsg_x(int s, const struct msghdr_x *msgp, u_int cnt, int flags); 1294 + __END_DECLS 1295 + #endif /* !KERNEL */ 1296 + #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ 1297 + #endif /* PRIVATE */ 1298 + 1299 + #ifndef KERNEL 1300 + __BEGIN_DECLS 1301 + 560 1302 int accept(int, struct sockaddr * __restrict, socklen_t * __restrict) 561 1303 __DARWIN_ALIAS_C(accept); 562 1304 int bind(int, const struct sockaddr *, socklen_t) __DARWIN_ALIAS(bind); ··· 587 1329 588 1330 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) 589 1331 void pfctlinput(int, struct sockaddr *); 1332 + int connectx(int , const sa_endpoints_t *, sae_associd_t, unsigned int, 1333 + const struct iovec *, unsigned int, size_t *, sae_connid_t *); 1334 + int disconnectx(int , sae_associd_t, sae_connid_t); 590 1335 #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ 591 1336 __END_DECLS 1337 + #endif /* !KERNEL */ 592 1338 1339 + #ifdef KERNEL 1340 + #include <sys/kpi_socket.h> 1341 + #endif 593 1342 594 1343 #endif /* !_SYS_SOCKET_H_ */
+101 -1
platform-include/sys/sockio.h
··· 1 1 /* 2 - * Copyright (c) 2000-2014 Apple Inc. All rights reserved. 2 + * Copyright (c) 2000-2013 Apple Inc. All rights reserved. 3 3 * 4 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 5 * ··· 81 81 * OSIOCGIF* ioctls are deprecated; they are kept for binary compatibility. 82 82 */ 83 83 #define SIOCSIFADDR _IOW('i', 12, struct ifreq) /* set ifnet address */ 84 + #ifdef KERNEL_PRIVATE 85 + #define OSIOCGIFADDR _IOWR('i', 13, struct ifreq) /* deprecated */ 86 + #endif /* KERNEL_PRIVATE */ 84 87 #define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq) /* set p-p address */ 88 + #ifdef KERNEL_PRIVATE 89 + #define OSIOCGIFDSTADDR _IOWR('i', 15, struct ifreq) /* deprecated */ 90 + #endif /* KERNEL_PRIVATE */ 85 91 #define SIOCSIFFLAGS _IOW('i', 16, struct ifreq) /* set ifnet flags */ 86 92 #define SIOCGIFFLAGS _IOWR('i', 17, struct ifreq) /* get ifnet flags */ 93 + #ifdef KERNEL_PRIVATE 94 + #define OSIOCGIFBRDADDR _IOWR('i', 18, struct ifreq) /* deprecated */ 95 + #endif /* KERNEL_PRIVATE */ 87 96 #define SIOCSIFBRDADDR _IOW('i', 19, struct ifreq) /* set broadcast addr */ 97 + #ifdef KERNEL_PRIVATE 98 + #define OSIOCGIFCONF _IOWR('i', 20, struct ifconf) /* deprecated */ 99 + #define OSIOCGIFCONF32 _IOWR('i', 20, struct ifconf32) /* deprecated */ 100 + #define OSIOCGIFCONF64 _IOWR('i', 20, struct ifconf64) /* deprecated */ 101 + #define OSIOCGIFNETMASK _IOWR('i', 21, struct ifreq) /* deprecated */ 102 + #endif /* KERNEL_PRIVATE */ 88 103 #define SIOCSIFNETMASK _IOW('i', 22, struct ifreq) /* set net addr mask */ 89 104 #define SIOCGIFMETRIC _IOWR('i', 23, struct ifreq) /* get IF metric */ 90 105 #define SIOCSIFMETRIC _IOW('i', 24, struct ifreq) /* set IF metric */ 91 106 #define SIOCDIFADDR _IOW('i', 25, struct ifreq) /* delete IF addr */ 92 107 #define SIOCAIFADDR _IOW('i', 26, struct ifaliasreq)/* add/chg IF alias */ 108 + #define SIOCGETVIFCNT _IOWR('r', 27, struct sioc_vif_req)/* get vif pkt cnt */ 109 + #define SIOCGETSGCNT _IOWR('r', 28, struct sioc_sg_req) /* get s,g pkt cnt */ 110 + #define SIOCALIFADDR _IOW('i', 29, struct if_laddrreq) /* add IF addr */ 111 + #define SIOCGLIFADDR _IOWR('i', 30, struct if_laddrreq) /* get IF addr */ 112 + #define SIOCDLIFADDR _IOW('i', 31, struct if_laddrreq) /* delete IF addr */ 113 + 93 114 94 115 #define SIOCGIFADDR _IOWR('i', 33, struct ifreq) /* get ifnet address */ 95 116 #define SIOCGIFDSTADDR _IOWR('i', 34, struct ifreq) /* get p-p address */ 96 117 #define SIOCGIFBRDADDR _IOWR('i', 35, struct ifreq) /* get broadcast addr */ 118 + #if !defined(KERNEL) || defined(KERNEL_PRIVATE) 97 119 #define SIOCGIFCONF _IOWR('i', 36, struct ifconf) /* get ifnet list */ 120 + #endif /* !KERNEL || KERNEL_PRIVATE */ 121 + #ifdef KERNEL_PRIVATE 122 + #define SIOCGIFCONF32 _IOWR('i', 36, struct ifconf32) /* get ifnet list */ 123 + #define SIOCGIFCONF64 _IOWR('i', 36, struct ifconf64) /* get ifnet list */ 124 + #endif /* KERNEL_PRIVATE */ 98 125 #define SIOCGIFNETMASK _IOWR('i', 37, struct ifreq) /* get net addr mask */ 99 126 #define SIOCAUTOADDR _IOWR('i', 38, struct ifreq) /* autoconf address */ 100 127 #define SIOCAUTONETMASK _IOW('i', 39, struct ifreq) /* autoconf netmask */ ··· 109 136 #define SIOCSIFPHYS _IOW('i', 54, struct ifreq) /* set IF wire */ 110 137 #define SIOCSIFMEDIA _IOWR('i', 55, struct ifreq) /* set net media */ 111 138 #define SIOCGIFMEDIA _IOWR('i', 56, struct ifmediareq) /* get net media */ 139 + #ifdef KERNEL_PRIVATE 140 + #define SIOCGIFMEDIA32 _IOWR('i', 56, struct ifmediareq32) /* get net media */ 141 + #define SIOCGIFMEDIA64 _IOWR('i', 56, struct ifmediareq64) /* get net media (64-bit) */ 142 + #endif /* KERNEL_PRIVATE */ 112 143 #define SIOCSIFGENERIC _IOW('i', 57, struct ifreq) /* generic IF set op */ 113 144 #define SIOCGIFGENERIC _IOWR('i', 58, struct ifreq) /* generic IF get op */ 114 145 #define SIOCRSLVMULTI _IOWR('i', 59, struct rslvmulti_req) ··· 119 150 #define SIOCGIFPSRCADDR _IOWR('i', 63, struct ifreq) /* get gif psrc addr */ 120 151 #define SIOCGIFPDSTADDR _IOWR('i', 64, struct ifreq) /* get gif pdst addr */ 121 152 #define SIOCDIFPHYADDR _IOW('i', 65, struct ifreq) /* delete gif addrs */ 153 + #define SIOCSLIFPHYADDR _IOW('i', 66, struct if_laddrreq) /* set gif addrs */ 154 + #define SIOCGLIFPHYADDR _IOWR('i', 67, struct if_laddrreq) /* get gif addrs */ 122 155 123 156 #define SIOCGIFDEVMTU _IOWR('i', 68, struct ifreq) /* get if ifdevmtu */ 124 157 #define SIOCSIFALTMTU _IOW('i', 69, struct ifreq) /* set if alternate mtu */ ··· 126 159 #define SIOCSIFBOND _IOW('i', 70, struct ifreq) /* set bond if config */ 127 160 #define SIOCGIFBOND _IOWR('i', 71, struct ifreq) /* get bond if config */ 128 161 162 + #ifdef PRIVATE 163 + /* 164 + * temporary control calls to attach/detach IP to/from an ethernet interface 165 + */ 166 + #define SIOCPROTOATTACH _IOWR('i', 80, struct ifreq) /* attach proto to interface */ 167 + #define SIOCPROTODETACH _IOWR('i', 81, struct ifreq) /* detach proto from interface */ 168 + #endif /* PRIVATE */ 129 169 130 170 #define SIOCSIFCAP _IOW('i', 90, struct ifreq) /* set IF features */ 131 171 #define SIOCGIFCAP _IOWR('i', 91, struct ifreq) /* get IF features */ ··· 138 178 parameters */ 139 179 #define SIOCGDRVSPEC _IOWR('i', 123, struct ifdrv) /* get driver-specific 140 180 parameters */ 181 + #ifdef KERNEL_PRIVATE 182 + #define SIOCSDRVSPEC32 _IOW('i', 123, struct ifdrv32) /* set driver-specific 183 + parameters */ 184 + #define SIOCGDRVSPEC32 _IOWR('i', 123, struct ifdrv32) /* get driver-specific 185 + parameters */ 186 + #define SIOCSDRVSPEC64 _IOW('i', 123, struct ifdrv64) /* set driver-specific 187 + parameters */ 188 + #define SIOCGDRVSPEC64 _IOWR('i', 123, struct ifdrv64) /* get driver-specific 189 + parameters */ 190 + 191 + #endif /* KERNEL_PRIVATE */ 141 192 #define SIOCSIFVLAN _IOW('i', 126, struct ifreq) /* set VLAN config */ 142 193 #define SIOCGIFVLAN _IOWR('i', 127, struct ifreq) /* get VLAN config */ 143 194 #define SIOCSETVLAN SIOCSIFVLAN 144 195 #define SIOCGETVLAN SIOCGIFVLAN 196 + #ifdef KERNEL_PRIVATE 197 + #define SIOCSIFDEVMTU SIOCSIFALTMTU /* deprecated */ 198 + #endif /* KERNEL_PRIVATE */ 145 199 200 + #if !defined(KERNEL) || defined(KERNEL_PRIVATE) 146 201 #define SIOCIFGCLONERS _IOWR('i', 129, struct if_clonereq) /* get cloners */ 202 + #endif /* !KERNEL || KERNEL_PRIVATE */ 203 + #ifdef KERNEL_PRIVATE 204 + #define SIOCIFGCLONERS32 _IOWR('i', 129, struct if_clonereq32) /* get cloners */ 205 + #define SIOCIFGCLONERS64 _IOWR('i', 129, struct if_clonereq64) /* get cloners */ 206 + #endif /* KERNEL_PRIVATE */ 147 207 148 208 #define SIOCGIFASYNCMAP _IOWR('i', 124, struct ifreq) /* get ppp asyncmap */ 149 209 #define SIOCSIFASYNCMAP _IOW('i', 125, struct ifreq) /* set ppp asyncmap */ 150 210 151 211 212 + #ifdef PRIVATE 213 + #define SIOCSETOT _IOW('s', 128, int) /* deprecated */ 214 + #endif /* PRIVATE */ 152 215 153 216 #define SIOCGIFMAC _IOWR('i', 130, struct ifreq) /* get IF MAC label */ 154 217 #define SIOCSIFMAC _IOW('i', 131, struct ifreq) /* set IF MAC label */ ··· 157 220 158 221 #define SIOCGIFWAKEFLAGS _IOWR('i', 136, struct ifreq) /* get interface wake property flags */ 159 222 223 + #ifdef PRIVATE 224 + #define SIOCGIFGETRTREFCNT _IOWR('i', 137, struct ifreq) /* get interface route refcnt */ 225 + #define SIOCGIFLINKQUALITYMETRIC _IOWR('i', 138, struct ifreq) /* get LQM */ 226 + #define SIOCSIFOPPORTUNISTIC _IOWR('i', 139, struct ifreq) /* deprecated; use SIOCSIFTHROTTLE */ 227 + #define SIOCGIFOPPORTUNISTIC _IOWR('i', 140, struct ifreq) /* deprecated; use SIOCGIFTHROTTLE */ 228 + #define SIOCSETROUTERMODE _IOWR('i', 141, struct ifreq) /* enable/disable IPv4 router mode on interface */ 229 + #define SIOCGIFEFLAGS _IOWR('i', 142, struct ifreq) /* get extended ifnet flags */ 230 + #define SIOCSIFDESC _IOWR('i', 143, struct if_descreq) 231 + #define SIOCGIFDESC _IOWR('i', 144, struct if_descreq) 232 + #define SIOCSIFLINKPARAMS _IOWR('i', 145, struct if_linkparamsreq) 233 + #define SIOCGIFLINKPARAMS _IOWR('i', 146, struct if_linkparamsreq) 234 + #define SIOCGIFQUEUESTATS _IOWR('i', 147, struct if_qstatsreq) 235 + #define SIOCSIFTHROTTLE _IOWR('i', 148, struct if_throttlereq) 236 + #define SIOCGIFTHROTTLE _IOWR('i', 149, struct if_throttlereq) 237 + #endif /* PRIVATE */ 160 238 239 + #ifdef PRIVATE 240 + #define SIOCGASSOCIDS _IOWR('s', 150, struct so_aidreq) /* get associds */ 241 + #define SIOCGCONNIDS _IOWR('s', 151, struct so_cidreq) /* get connids */ 242 + #define SIOCGCONNINFO _IOWR('s', 152, struct so_cinforeq) /* get conninfo */ 243 + #ifdef BSD_KERNEL_PRIVATE 244 + #define SIOCGASSOCIDS32 _IOWR('s', 150, struct so_aidreq32) 245 + #define SIOCGASSOCIDS64 _IOWR('s', 150, struct so_aidreq64) 246 + #define SIOCGCONNIDS32 _IOWR('s', 151, struct so_cidreq32) 247 + #define SIOCGCONNIDS64 _IOWR('s', 151, struct so_cidreq64) 248 + #define SIOCGCONNINFO32 _IOWR('s', 152, struct so_cinforeq32) 249 + #define SIOCGCONNINFO64 _IOWR('s', 152, struct so_cinforeq64) 250 + #endif /* BSD_KERNEL_PRIVATE */ 251 + #define SIOCSCONNORDER _IOWR('s', 153, struct so_cordreq) /* set conn order */ 252 + #define SIOCGCONNORDER _IOWR('s', 154, struct so_cordreq) /* get conn order */ 253 + #endif /* PRIVATE */ 161 254 255 + #ifdef PRIVATE 256 + #define SIOCSIFLOG _IOWR('i', 155, struct ifreq) 257 + #define SIOCGIFLOG _IOWR('i', 156, struct ifreq) 258 + #define SIOCGIFDELEGATE _IOWR('i', 157, struct ifreq) 259 + #define SIOCGIFLLADDR _IOWR('i', 158, struct ifreq) /* get link level addr */ 260 + #define SIOCGIFTYPE _IOWR('i', 159, struct ifreq) /* get interface type */ 261 + #endif /* PRIVATE */ 162 262 #endif /* !_SYS_SOCKIO_H_ */
+3 -1
src/duct/include/firehose/tracepoint_private.h
··· 116 116 { 117 117 #if KERNEL 118 118 return (atm_get_diagnostic_config() & 0x80) == 0; 119 - #else 119 + #elif defined(_COMM_PAGE_ATM_DIAGNOSTIC_CONFIG) 120 120 return (*((volatile uint32_t *)_COMM_PAGE_ATM_DIAGNOSTIC_CONFIG) & 0x80) == 0; 121 + #else 122 + return false; 121 123 #endif 122 124 } 123 125
+4
src/duct/include/os/log_private.h
··· 28 28 #include <firehose/tracepoint_private.h> 29 29 #include <sys/queue.h> 30 30 31 + #ifndef OS_LOG_NOTAILCALL 32 + #define OS_LOG_NOTAILCALL 33 + #endif 34 + 31 35 __BEGIN_DECLS 32 36 33 37 /*!