iOS aarch64 port of OpenJDK 8 (#5)

This port is still WIP and may not work.
This commit is contained in:
Duy Tran Khanh 2021-05-15 19:43:22 +07:00 committed by GitHub
parent f650380205
commit e52446bf18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
43 changed files with 6600 additions and 102 deletions

View File

@ -1,13 +1,15 @@
name: Build OpenJDK 8 for Android and iOS
name: Build OpenJDK for Android
on: [push, pull_request, workflow_dispatch]
jobs:
build:
build_android:
strategy:
matrix:
arch: [ "aarch32", "aarch64", "x86", "x86_64" ]
fail-fast: false
name: "Build ${{matrix.arch}}"
name: "Build for Android ${{matrix.arch}}"
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
@ -33,36 +35,72 @@ jobs:
with:
name: "jre8-debuginfo-${{matrix.arch}}"
path: dizout
build_iosport:
name: "Build for iOS aarch64"
runs-on: macOS-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: set up JDK 1.7
uses: actions/setup-java@v1
with:
java-version: 1.7
- name: Build with CI build script
run: |
export BUILD_IOS=1
bash "ci_build_arch_aarch64.sh"
- name: Upload JDK build output
uses: actions/upload-artifact@v2
with:
name: "jdk8-ios-aarch64"
path: jdk8*.tar.xz
- name: Upload JRE build output
uses: actions/upload-artifact@v2
with:
name: 'jre8-ios-aarch64'
path: jre8*.tar.xz
- name: Upload JRE debuginfo build output
uses: actions/upload-artifact@v2
with:
name: "jre8-ios-debuginfo-aarch64"
path: dizout
pojav:
needs: build
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Get jre8-aarch32
uses: actions/download-artifact@v2
with:
needs: build_android
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Get jre8-aarch32
uses: actions/download-artifact@v2
with:
name: jre8-aarch32
path: pojav
- name: Get jre8-aarch64
uses: actions/download-artifact@v2
with:
name: jre8-aarch64
path: pojav
- name: Get jre8-x86
uses: actions/download-artifact@v2
with:
name: jre8-x86
path: pojav
- name: Get jre8-x86_64
uses: actions/download-artifact@v2
with:
name: jre8-x86_64
path: pojav
- name: Repack JRE
run: bash "repackjre.sh" $GITHUB_WORKSPACE/pojav $GITHUB_WORKSPACE/pojav/jre8-pojav
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: jre8-pojav
path: pojav/jre8-pojav/*
- name: Get jre8-aarch64
uses: actions/download-artifact@v2
with:
name: jre8-aarch64
path: pojav
- name: Get jre8-x86
uses: actions/download-artifact@v2
with:
name: jre8-x86
path: pojav
- name: Get jre8-x86_64
uses: actions/download-artifact@v2
with:
name: jre8-x86_64
path: pojav
- name: Repack JRE
run: bash "repackjre.sh" $GITHUB_WORKSPACE/pojav $GITHUB_WORKSPACE/pojav/jre8-pojav
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: jre8-pojav
path: pojav/jre8-pojav/*

15
.gitignore vendored
View File

@ -1,11 +1,16 @@
cups-2.2.4-source.tar.gz
freetype-2.6.2.tar.bz2
cups-2.2.4
cups-*-source.tar.gz
freetype-*.tar.gz
freetype-*
cups-*
dummy_libs
freetype-2.6.2
freetype-2.6.2-x86
freetype-*-x86
jdk1.8.0_*
openjdk
android-ndk-r*
jre.tar.xz
jreout
.DS_Store
.idea
ios-missing-include/cups
ios-missing-include/X11
ios-missing-include/Xm

View File

@ -11,14 +11,9 @@ else
export TARGET_PHYS=$TARGET
fi
sudo apt -y install systemtap-sdt-dev gcc-multilib g++-multilib libxtst-dev libasound2-dev libelf-dev libfontconfig1-dev libx11-dev
export FREETYPE_DIR=`pwd`/freetype-$BUILD_FREETYPE_VERSION/build_android-${TARGET_SHORT}
export FREETYPE_DIR=`pwd`/freetype-$BUILD_FREETYPE_VERSION/build_android-$TARGET_SHORT
export CUPS_DIR=`pwd`/cups-2.2.4
# simplest to force headless:)
export CFLAGS+=" -DDONT_COMPILE_SHENANDOAH -DLE_STANDALONE" # -I$FREETYPE_DIR -I$CUPS_DIR
export LDFLAGS+=" -L`pwd`/dummy_libs -Wl,--warn-unresolved-symbols"
export CFLAGS+=" -DLE_STANDALONE" # -I$FREETYPE_DIR -I$CUPS_DI
# if [ "$TARGET_JDK" == "aarch32" ] || [ "$TARGET_JDK" == "aarch64" ]
# then
@ -31,35 +26,57 @@ export LDFLAGS+=" -L`pwd`/dummy_libs -Wl,--warn-unresolved-symbols"
# cp -R /usr/include/X11 $ANDROID_INCLUDE/
# cp -R /usr/include/fontconfig $ANDROID_INCLUDE/
ln -s -f /usr/include/X11 $ANDROID_INCLUDE/
ln -s -f /usr/include/fontconfig $ANDROID_INCLUDE/
if [ "$BUILD_IOS" != "1" ]; then
ln -s -f /usr/include/X11 $ANDROID_INCLUDE/
ln -s -f /usr/include/fontconfig $ANDROID_INCLUDE/
AUTOCONF_x11arg="--x-includes=$ANDROID_INCLUDE/X11"
export LDFLAGS+=" -L`pwd`/dummy_libs"
sudo apt -y install systemtap-sdt-dev gcc-multilib g++-multilib libxtst-dev libasound2-dev libelf-dev libfontconfig1-dev libx11-dev
# Create dummy libraries so we won't have to remove them in OpenJDK makefiles
mkdir -p dummy_libs
ar cru dummy_libs/libpthread.a
ar cru dummy_libs/libthread_db.a
mkdir -p dummy_libs
ar cru dummy_libs/libpthread.a
ar cru dummy_libs/libthread_db.a
else
ln -s -f /opt/X11/include/X11 $ANDROID_INCLUDE/
platform_args=--with-toolchain-type=clang
AUTOCONF_x11arg="--with-x=/opt/X11/include/X11"
sameflags="-arch arm64 -isysroot $thesysroot -miphoneos-version-min=12.0 -DHEADLESS=1 -I$PWD/ios-missing-include -Wno-implicit-function-declaration"
export CFLAGS+=" $sameflags"
export CXXFLAGS="$sameflags"
brew install xquartz
fi
# fix building libjawt
ln -s -f $CUPS_DIR/cups $ANDROID_INCLUDE/
cd openjdk
rm -rf build
#rm -rf build
# --with-extra-cxxflags="$CXXFLAGS -Dchar16_t=uint16_t -Dchar32_t=uint32_t" \
# --with-extra-cflags="$CPPFLAGS" \
# --with-extra-cxxflags="$CXXFLAGS -Dchar16_t=uint16_t -Dchar32_t=uint32_t" \
# --with-extra-cflags="$CPPFLAGS" \
# --with-sysroot="$(xcrun --sdk iphoneos --show-sdk-path)" \
bash ./configure \
--with-extra-cflags="$CFLAGS" \
--with-extra-cxxflags="$CFLAGS" \
--with-extra-ldflags="$LDFLAGS" \
--enable-option-checking=fatal \
--openjdk-target=$TARGET_PHYS \
--with-jdk-variant=normal \
--with-jvm-variants=$JVM_VARIANTS \
--with-cups-include=$CUPS_DIR \
--with-devkit=$TOOLCHAIN \
--with-debug-level=$JDK_DEBUG_LEVEL \
--with-fontconfig-include=$ANDROID_INCLUDE \
--with-freetype-lib=$FREETYPE_DIR/lib \
--with-freetype-include=$FREETYPE_DIR/include/freetype2 \
--x-includes=$ANDROID_INCLUDE \
--x-libraries=/usr/lib || \
--openjdk-target=$TARGET_PHYS \
--with-extra-cflags="$CFLAGS" \
--with-extra-cxxflags="$CFLAGS" \
--with-extra-ldflags="$LDFLAGS" \
--enable-option-checking=fatal \
--with-jdk-variant=normal \
--with-jvm-variants=$JVM_VARIANTS \
--with-cups-include=$CUPS_DIR \
--with-devkit=$TOOLCHAIN \
--with-debug-level=$JDK_DEBUG_LEVEL \
--with-fontconfig-include=$ANDROID_INCLUDE \
--with-freetype-lib=$FREETYPE_DIR/lib \
--with-freetype-include=$FREETYPE_DIR/include/freetype2 \
$AUTOCONF_x11arg $AUTOCONF_EXTRA_ARGS \
--x-libraries=/usr/lib \
$platform_args || \
error_code=$?
if [ "$error_code" -ne 0 ]; then
echo "\n\nCONFIGURE ERROR $error_code , config.log:"
@ -67,8 +84,7 @@ if [ "$error_code" -ne 0 ]; then
exit $error_code
fi
# mkdir -p build/linux-${TARGET_JDK}-normal-${JVM_VARIANTS}-${JDK_DEBUG_LEVEL}
cd build/linux-${TARGET_JDK}-normal-${JVM_VARIANTS}-${JDK_DEBUG_LEVEL}
cd build/${JVM_PLATFORM}-${TARGET_JDK}-normal-${JVM_VARIANTS}-${JDK_DEBUG_LEVEL}
make JOBS=4 images || \
error_code=$?
if [ "$error_code" -ne 0 ]; then

View File

@ -1,18 +1,34 @@
#!/bin/bash
set -e
. setdevkitpath.sh
export PATH=$TOOLCHAIN/bin:$PATH
cd freetype-$BUILD_FREETYPE_VERSION
echo "Building Freetype"
cd freetype-$BUILD_FREETYPE_VERSION
./configure \
--host=$TARGET \
--prefix=`pwd`/build_android-${TARGET_SHORT} \
--without-zlib \
--with-png=no \
--with-harfbuzz=no || \
error_code=$?
if [ "$BUILD_IOS" == "1" ]; then
export CC=$thecc
export CXX=$thecxx
./configure \
--host=$TARGET \
--prefix=`pwd`/build_android-${TARGET_SHORT} \
--without-zlib \
--with-brotli=no \
--with-png=no \
--with-harfbuzz=no \
"CFLAGS=-arch arm64 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -O2 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden -miphoneos-version-min=12.0 -I$thesysroot/usr/include/libxml2/ -isysroot $thesysroot" \
AR=/usr/bin/ar \
"LDFLAGS=-arch arm64 -isysroot $thesysroot -miphoneos-version-min=12.0" \
|| error_code=$?
else
export PATH=$TOOLCHAIN/bin:$PATH
./configure \
--host=$TARGET \
--prefix=`pwd`/build_android-${TARGET_SHORT} \
--without-zlib \
--with-png=no \
--with-harfbuzz=no $EXTRA_ARGS \
|| error_code=$?
fi
if [ "$error_code" -ne 0 ]; then
echo "\n\nCONFIGURE ERROR $error_code , config.log:"
cat config.log

0
ci_build_arch_aarch32.sh Normal file → Executable file
View File

7
ci_build_arch_aarch64.sh Normal file → Executable file
View File

@ -1,7 +1,10 @@
#!/bin/bash
set -e
export TARGET=aarch64-linux-android
if [ "$BUILD_IOS" == "1" ]; then
export TARGET=aarch64-apple-darwin18.2
else
export TARGET=aarch64-linux-android
fi
export TARGET_JDK=aarch64
bash ci_build_global.sh

0
ci_build_arch_x86.sh Normal file → Executable file
View File

0
ci_build_arch_x86_64.sh Normal file → Executable file
View File

19
ci_build_global.sh Normal file → Executable file
View File

@ -3,18 +3,25 @@ set -e
export JDK_DEBUG_LEVEL=release
sudo apt-get update
if [ "$BUILD_IOS" != "1" ]; then
sudo apt update
fi
. setdevkitpath.sh
wget -nc -nv -O android-ndk-$NDK_VERSION-linux-x86_64.zip "https://dl.google.com/android/repository/android-ndk-$NDK_VERSION-linux-x86_64.zip"
./extractndk.sh
./getlibs.sh
./maketoolchain.sh
if [ "$BUILD_IOS" == "1" ]; then
chmod +x ios-arm64-clang
chmod +x ios-arm64-clang++
else
wget -nc -nv -O android-ndk-$NDK_VERSION-linux-x86_64.zip "https://dl.google.com/android/repository/android-ndk-$NDK_VERSION-linux-x86_64.zip"
./extractndk.sh
./maketoolchain.sh
fi
# Some modifies to NDK to fix
./clonejdk.sh
./getlibs.sh
./buildlibs.sh
./clonejdk.sh
./buildjdk.sh
./removejdkdebuginfo.sh
./tarjdk.sh

0
cleanarchbuild.sh Normal file → Executable file
View File

View File

@ -1,8 +1,11 @@
#!/bin/sh
#!/bin/bash
# https://github.com/termux/termux-packages/blob/master/disabled-packages/openjdk-9-jre-headless/build.sh
set -e
wget https://download.savannah.gnu.org/releases/freetype/freetype-$BUILD_FREETYPE_VERSION.tar.bz2
tar xf freetype-$BUILD_FREETYPE_VERSION.tar.bz2
. setdevkitpath.sh
wget https://downloads.sourceforge.net/project/freetype/freetype2/$BUILD_FREETYPE_VERSION/freetype-$BUILD_FREETYPE_VERSION.tar.gz
tar xf freetype-$BUILD_FREETYPE_VERSION.tar.gz
wget https://github.com/apple/cups/releases/download/v2.2.4/cups-2.2.4-source.tar.gz
tar xf cups-2.2.4-source.tar.gz
rm cups-2.2.4-source.tar.gz freetype-$BUILD_FREETYPE_VERSION.tar.bz2
rm cups-2.2.4-source.tar.gz freetype-$BUILD_FREETYPE_VERSION.tar.gz

1
ios-arm64-clang Executable file
View File

@ -0,0 +1 @@
exec $thecc -arch arm64 -isysroot $thesysroot "$@"

1
ios-arm64-clang++ Executable file
View File

@ -0,0 +1 @@
exec $thecxx -arch arm64 -isysroot $thesysroot "$@"

View File

@ -0,0 +1,2 @@
#include <Foundation/Foundation.h>

View File

@ -0,0 +1,20 @@
#include <objc/runtime.h>
#include <objc/message.h>
#include <jni.h>
#define JNF_COCOA_ENTER(env)
#define JNF_COCOA_EXIT(env)
static inline NSString* JNFJavaToNSString(JNIEnv* env, jstring str) {
NSString *result = NULL;
const char *str_cstr = (*env)->GetStringUTFChars(env, str, 0);
if ((*env)->ExceptionOccurred(env)) { return 0; }
if (str_cstr != NULL) {
result = @(str_cstr);
(*env)->ReleaseStringUTFChars(env, str, str_cstr);
}
return result;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,187 @@
/*
* Copyright (c) 2006, 2007, 2010 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#ifndef _LIBPROC_H_
#define _LIBPROC_H_
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <sys/resource.h>
#include <stdint.h>
#include <stdbool.h>
#include <mach/message.h> /* for audit_token_t */
#include <sys/proc_info.h>
#include <Availability.h>
#include <os/availability.h>
/*
* This header file contains private interfaces to obtain process information.
* These interfaces are subject to change in future releases.
*/
/*!
* @define PROC_LISTPIDSPATH_PATH_IS_VOLUME
* @discussion This flag indicates that all processes that hold open
* file references on the volume associated with the specified
* path should be returned.
*/
#define PROC_LISTPIDSPATH_PATH_IS_VOLUME 1
/*!
* @define PROC_LISTPIDSPATH_EXCLUDE_EVTONLY
* @discussion This flag indicates that file references that were opened
* with the O_EVTONLY flag should be excluded from the matching
* criteria.
*/
#define PROC_LISTPIDSPATH_EXCLUDE_EVTONLY 2
__BEGIN_DECLS
/*!
* @function proc_listpidspath
* @discussion A function which will search through the current
* processes looking for open file references which match
* a specified path or volume.
* @param type types of processes to be searched (see proc_listpids)
* @param typeinfo adjunct information for type
* @param path file or volume path
* @param pathflags flags to control which files should be considered
* during the process search.
* @param buffer a C array of int-sized values to be filled with
* process identifiers that hold an open file reference
* matching the specified path or volume. Pass NULL to
* obtain the minimum buffer size needed to hold the
* currently active processes.
* @param buffersize the size (in bytes) of the provided buffer.
* @result the number of bytes of data returned in the provided buffer;
* -1 if an error was encountered;
*/
int proc_listpidspath(uint32_t type,
uint32_t typeinfo,
const char *path,
uint32_t pathflags,
void *buffer,
int buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
int proc_listpids(uint32_t type, uint32_t typeinfo, void *buffer, int buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
int proc_listallpids(void * buffer, int buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_1);
int proc_listpgrppids(pid_t pgrpid, void * buffer, int buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_1);
int proc_listchildpids(pid_t ppid, void * buffer, int buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_1);
int proc_pidinfo(int pid, int flavor, uint64_t arg, void *buffer, int buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
int proc_pidfdinfo(int pid, int fd, int flavor, void * buffer, int buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
int proc_pidfileportinfo(int pid, uint32_t fileport, int flavor, void *buffer, int buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
int proc_name(int pid, void * buffer, uint32_t buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
int proc_regionfilename(int pid, uint64_t address, void * buffer, uint32_t buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
int proc_kmsgbuf(void * buffer, uint32_t buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
int proc_pidpath(int pid, void * buffer, uint32_t buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
int proc_pidpath_audittoken(audit_token_t *audittoken, void * buffer, uint32_t buffersize) API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0));
int proc_libversion(int *major, int * minor) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
/*
* Return resource usage information for the given pid, which can be a live process or a zombie.
*
* Returns 0 on success; or -1 on failure, with errno set to indicate the specific error.
*/
int proc_pid_rusage(int pid, int flavor, rusage_info_t *buffer) __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
/*
* A process can use the following api to set its own process control
* state on resoure starvation. The argument can have one of the PROC_SETPC_XX values
*/
#define PROC_SETPC_NONE 0
#define PROC_SETPC_THROTTLEMEM 1
#define PROC_SETPC_SUSPEND 2
#define PROC_SETPC_TERMINATE 3
int proc_setpcontrol(const int control) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
int proc_setpcontrol(const int control);
int proc_track_dirty(pid_t pid, uint32_t flags);
int proc_set_dirty(pid_t pid, bool dirty);
int proc_get_dirty(pid_t pid, uint32_t *flags);
int proc_clear_dirty(pid_t pid, uint32_t flags);
int proc_terminate(pid_t pid, int *sig);
/*
* NO_SMT means that on an SMT CPU, this thread must be scheduled alone,
* with the paired CPU idle.
*
* Set NO_SMT on the current proc (all existing and future threads)
* This attribute is inherited on fork and exec
*/
int proc_set_no_smt(void) __API_AVAILABLE(macos(11.0));
/* Set NO_SMT on the current thread */
int proc_setthread_no_smt(void) __API_AVAILABLE(macos(11.0));
/*
* CPU Security Mitigation APIs
*
* Set CPU security mitigation on the current proc (all existing and future threads)
* This attribute is inherited on fork and exec
*/
int proc_set_csm(uint32_t flags) __API_AVAILABLE(macos(11.0));
/* Set CPU security mitigation on the current thread */
int proc_setthread_csm(uint32_t flags) __API_AVAILABLE(macos(11.0));
/*
* flags for CPU Security Mitigation APIs
* PROC_CSM_ALL should be used in most cases,
* the individual flags are provided only for performance evaluation etc
*/
#define PROC_CSM_ALL 0x0001 /* Set all available mitigations */
#define PROC_CSM_NOSMT 0x0002 /* Set NO_SMT - see above */
#define PROC_CSM_TECS 0x0004 /* Execute VERW on every return to user mode */
#ifdef PRIVATE
#include <sys/event.h>
/*
* Enumerate potential userspace pointers embedded in kernel data structures.
* Currently inspects kqueues only.
*
* NOTE: returned "pointers" are opaque user-supplied values and thus not
* guaranteed to address valid objects or be pointers at all.
*
* Returns the number of pointers found (which may exceed buffersize), or -1 on
* failure and errno set appropriately.
*/
int proc_list_uptrs(pid_t pid, uint64_t *buffer, uint32_t buffersize);
int proc_list_dynkqueueids(int pid, kqueue_id_t *buf, uint32_t bufsz);
int proc_piddynkqueueinfo(int pid, int flavor, kqueue_id_t kq_id, void *buffer,
int buffersize);
#endif /* PRIVATE */
int proc_udata_info(int pid, int flavor, void *buffer, int buffersize);
__END_DECLS
#endif /*_LIBPROC_H_ */

View File

@ -0,0 +1,150 @@
/*
* Copyright (c) 2000-2016 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)if_arp.h 8.1 (Berkeley) 6/10/93
* $FreeBSD: src/sys/net/if_arp.h,v 1.14.2.1 2000/07/11 20:46:55 archie Exp $
*/
#ifndef _NET_IF_ARP_H_
#define _NET_IF_ARP_H_
#include <stdint.h>
#include <sys/appleapiopts.h>
#include <netinet/in.h>
/*
* Address Resolution Protocol.
*
* See RFC 826 for protocol description. ARP packets are variable
* in size; the arphdr structure defines the fixed-length portion.
* Protocol type values are the same as those for 10 Mb/s Ethernet.
* It is followed by the variable-sized fields ar_sha, arp_spa,
* arp_tha and arp_tpa in that order, according to the lengths
* specified. Field names used correspond to RFC 826.
*/
struct arphdr {
u_short ar_hrd; /* format of hardware address */
#define ARPHRD_ETHER 1 /* ethernet hardware format */
#define ARPHRD_IEEE802 6 /* token-ring hardware format */
#define ARPHRD_FRELAY 15 /* frame relay hardware format */
#define ARPHRD_IEEE1394 24 /* IEEE1394 hardware address */
#define ARPHRD_IEEE1394_EUI64 27 /* IEEE1394 EUI-64 */
u_short ar_pro; /* format of protocol address */
u_char ar_hln; /* length of hardware address */
u_char ar_pln; /* length of protocol address */
u_short ar_op; /* one of: */
#define ARPOP_REQUEST 1 /* request to resolve address */
#define ARPOP_REPLY 2 /* response to previous request */
#define ARPOP_REVREQUEST 3 /* request protocol address given hardware */
#define ARPOP_REVREPLY 4 /* response giving protocol address */
#define ARPOP_INVREQUEST 8 /* request to identify peer */
#define ARPOP_INVREPLY 9 /* response identifying peer */
/*
* The remaining fields are variable in size,
* according to the sizes above.
*/
#ifdef COMMENT_ONLY
u_char ar_sha[]; /* sender hardware address */
u_char ar_spa[]; /* sender protocol address */
u_char ar_tha[]; /* target hardware address */
u_char ar_tpa[]; /* target protocol address */
#endif
};
/*
* ARP ioctl request
*/
struct arpreq {
struct sockaddr arp_pa; /* protocol address */
struct sockaddr arp_ha; /* hardware address */
int arp_flags; /* flags */
};
/* arp_flags and at_flags field values */
#define ATF_INUSE 0x01 /* entry in use */
#define ATF_COM 0x02 /* completed entry (enaddr valid) */
#define ATF_PERM 0x04 /* permanent entry */
#define ATF_PUBL 0x08 /* publish entry (respond for other host) */
#define ATF_USETRAILERS 0x10 /* has requested trailers */
struct arpstat {
/* Normal things that happen: */
uint32_t txrequests; /* # of ARP requests sent by this host. */
uint32_t txreplies; /* # of ARP replies sent by this host. */
uint32_t txannounces; /* # of ARP announcements sent by this host. */
uint32_t rxrequests; /* # of ARP requests received by this host. */
uint32_t rxreplies; /* # of ARP replies received by this host. */
uint32_t received; /* # of ARP packets received by this host. */
/* Abnormal event and error counting: */
uint32_t txconflicts; /* # of ARP conflict probes sent */
uint32_t invalidreqs; /* # of invalid ARP resolve requests */
uint32_t reqnobufs; /* # of failed requests due to no memory */
uint32_t dropped; /* # of packets dropped waiting for a reply. */
uint32_t purged; /* # of packets purged while removing entries */
uint32_t timeouts; /* # of times with entries removed */
/* due to timeout. */
uint32_t dupips; /* # of duplicate IPs detected. */
/* General statistics */
uint32_t inuse; /* # of ARP entries in routing table */
uint32_t txurequests; /* # of ARP requests sent (unicast) */
uint32_t held; /* # of packets held waiting for a reply */
};
#endif /* !_NET_IF_ARP_H_ */

View File

@ -0,0 +1,257 @@
/*
* Copyright (c) 2000-2017 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1980, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)route.h 8.3 (Berkeley) 4/19/94
* $FreeBSD: src/sys/net/route.h,v 1.36.2.1 2000/08/16 06:14:23 jayanth Exp $
*/
#ifndef _NET_ROUTE_H_
#define _NET_ROUTE_H_
#include <sys/appleapiopts.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/socket.h>
/*
* These numbers are used by reliable protocols for determining
* retransmission behavior and are included in the routing structure.
*/
struct rt_metrics {
u_int32_t rmx_locks; /* Kernel leaves these values alone */
u_int32_t rmx_mtu; /* MTU for this path */
u_int32_t rmx_hopcount; /* max hops expected */
int32_t rmx_expire; /* lifetime for route, e.g. redirect */
u_int32_t rmx_recvpipe; /* inbound delay-bandwidth product */
u_int32_t rmx_sendpipe; /* outbound delay-bandwidth product */
u_int32_t rmx_ssthresh; /* outbound gateway buffer limit */
u_int32_t rmx_rtt; /* estimated round trip time */
u_int32_t rmx_rttvar; /* estimated rtt variance */
u_int32_t rmx_pksent; /* packets sent using this route */
u_int32_t rmx_state; /* route state */
u_int32_t rmx_filler[3]; /* will be used for TCP's peer-MSS cache */
};
/*
* rmx_rtt and rmx_rttvar are stored as microseconds;
*/
#define RTM_RTTUNIT 1000000 /* units for rtt, rttvar, as units per sec */
#define RTF_UP 0x1 /* route usable */
#define RTF_GATEWAY 0x2 /* destination is a gateway */
#define RTF_HOST 0x4 /* host entry (net otherwise) */
#define RTF_REJECT 0x8 /* host or net unreachable */
#define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */
#define RTF_MODIFIED 0x20 /* modified dynamically (by redirect) */
#define RTF_DONE 0x40 /* message confirmed */
#define RTF_DELCLONE 0x80 /* delete cloned route */
#define RTF_CLONING 0x100 /* generate new routes on use */
#define RTF_XRESOLVE 0x200 /* external daemon resolves name */
#define RTF_LLINFO 0x400 /* DEPRECATED - exists ONLY for backward
* compatibility */
#define RTF_LLDATA 0x400 /* used by apps to add/del L2 entries */
#define RTF_STATIC 0x800 /* manually added */
#define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */
#define RTF_NOIFREF 0x2000 /* not eligible for RTF_IFREF */
#define RTF_PROTO2 0x4000 /* protocol specific routing flag */
#define RTF_PROTO1 0x8000 /* protocol specific routing flag */
#define RTF_PRCLONING 0x10000 /* protocol requires cloning */
#define RTF_WASCLONED 0x20000 /* route generated through cloning */
#define RTF_PROTO3 0x40000 /* protocol specific routing flag */
/* 0x80000 unused */
#define RTF_PINNED 0x100000 /* future use */
#define RTF_LOCAL 0x200000 /* route represents a local address */
#define RTF_BROADCAST 0x400000 /* route represents a bcast address */
#define RTF_MULTICAST 0x800000 /* route represents a mcast address */
#define RTF_IFSCOPE 0x1000000 /* has valid interface scope */
#define RTF_CONDEMNED 0x2000000 /* defunct; no longer modifiable */
#define RTF_IFREF 0x4000000 /* route holds a ref to interface */
#define RTF_PROXY 0x8000000 /* proxying, no interface scope */
#define RTF_ROUTER 0x10000000 /* host is a router */
#define RTF_DEAD 0x20000000 /* Route entry is being freed */
/* 0x40000000 and up unassigned */
#define RTPRF_OURS RTF_PROTO3 /* set on routes we manage */
#define RTF_BITS \
"\020\1UP\2GATEWAY\3HOST\4REJECT\5DYNAMIC\6MODIFIED\7DONE" \
"\10DELCLONE\11CLONING\12XRESOLVE\13LLINFO\14STATIC\15BLACKHOLE" \
"\16NOIFREF\17PROTO2\20PROTO1\21PRCLONING\22WASCLONED\23PROTO3" \
"\25PINNED\26LOCAL\27BROADCAST\30MULTICAST\31IFSCOPE\32CONDEMNED" \
"\33IFREF\34PROXY\35ROUTER"
#define IS_DIRECT_HOSTROUTE(rt) \
(((rt)->rt_flags & (RTF_HOST | RTF_GATEWAY)) == RTF_HOST)
/*
* Routing statistics.
*/
struct rtstat {
short rts_badredirect; /* bogus redirect calls */
short rts_dynamic; /* routes created by redirects */
short rts_newgateway; /* routes modified by redirects */
short rts_unreach; /* lookups which failed */
short rts_wildcard; /* lookups satisfied by a wildcard */
short rts_badrtgwroute; /* route to gateway is not direct */
};
/*
* Structures for routing messages.
*/
struct rt_msghdr {
u_short rtm_msglen; /* to skip over non-understood messages */
u_char rtm_version; /* future binary compatibility */
u_char rtm_type; /* message type */
u_short rtm_index; /* index for associated ifp */
int rtm_flags; /* flags, incl. kern & message, e.g. DONE */
int rtm_addrs; /* bitmask identifying sockaddrs in msg */
pid_t rtm_pid; /* identify sender */
int rtm_seq; /* for sender to identify action */
int rtm_errno; /* why failed */
int rtm_use; /* from rtentry */
u_int32_t rtm_inits; /* which metrics we are initializing */
struct rt_metrics rtm_rmx; /* metrics themselves */
};
struct rt_msghdr2 {
u_short rtm_msglen; /* to skip over non-understood messages */
u_char rtm_version; /* future binary compatibility */
u_char rtm_type; /* message type */
u_short rtm_index; /* index for associated ifp */
int rtm_flags; /* flags, incl. kern & message, e.g. DONE */
int rtm_addrs; /* bitmask identifying sockaddrs in msg */
int32_t rtm_refcnt; /* reference count */
int rtm_parentflags; /* flags of the parent route */
int rtm_reserved; /* reserved field set to 0 */
int rtm_use; /* from rtentry */
u_int32_t rtm_inits; /* which metrics we are initializing */
struct rt_metrics rtm_rmx; /* metrics themselves */
};
#define RTM_VERSION 5 /* Up the ante and ignore older versions */
/*
* Message types.
*/
#define RTM_ADD 0x1 /* Add Route */
#define RTM_DELETE 0x2 /* Delete Route */
#define RTM_CHANGE 0x3 /* Change Metrics or flags */
#define RTM_GET 0x4 /* Report Metrics */
#define RTM_LOSING 0x5 /* RTM_LOSING is no longer generated by xnu
* and is deprecated */
#define RTM_REDIRECT 0x6 /* Told to use different route */
#define RTM_MISS 0x7 /* Lookup failed on this address */
#define RTM_LOCK 0x8 /* fix specified metrics */
#define RTM_OLDADD 0x9 /* caused by SIOCADDRT */
#define RTM_OLDDEL 0xa /* caused by SIOCDELRT */
#define RTM_RESOLVE 0xb /* req to resolve dst to LL addr */
#define RTM_NEWADDR 0xc /* address being added to iface */
#define RTM_DELADDR 0xd /* address being removed from iface */
#define RTM_IFINFO 0xe /* iface going up/down etc. */
#define RTM_NEWMADDR 0xf /* mcast group membership being added to if */
#define RTM_DELMADDR 0x10 /* mcast group membership being deleted */
#define RTM_IFINFO2 0x12 /* */
#define RTM_NEWMADDR2 0x13 /* */
#define RTM_GET2 0x14 /* */
/*
* Bitmask values for rtm_inits and rmx_locks.
*/
#define RTV_MTU 0x1 /* init or lock _mtu */
#define RTV_HOPCOUNT 0x2 /* init or lock _hopcount */
#define RTV_EXPIRE 0x4 /* init or lock _expire */
#define RTV_RPIPE 0x8 /* init or lock _recvpipe */
#define RTV_SPIPE 0x10 /* init or lock _sendpipe */
#define RTV_SSTHRESH 0x20 /* init or lock _ssthresh */
#define RTV_RTT 0x40 /* init or lock _rtt */
#define RTV_RTTVAR 0x80 /* init or lock _rttvar */
/*
* Bitmask values for rtm_addrs.
*/
#define RTA_DST 0x1 /* destination sockaddr present */
#define RTA_GATEWAY 0x2 /* gateway sockaddr present */
#define RTA_NETMASK 0x4 /* netmask sockaddr present */
#define RTA_GENMASK 0x8 /* cloning mask sockaddr present */
#define RTA_IFP 0x10 /* interface name sockaddr present */
#define RTA_IFA 0x20 /* interface addr sockaddr present */
#define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */
#define RTA_BRD 0x80 /* for NEWADDR, broadcast or p-p dest addr */
/*
* Index offsets for sockaddr array for alternate internal encoding.
*/
#define RTAX_DST 0 /* destination sockaddr present */
#define RTAX_GATEWAY 1 /* gateway sockaddr present */
#define RTAX_NETMASK 2 /* netmask sockaddr present */
#define RTAX_GENMASK 3 /* cloning mask sockaddr present */
#define RTAX_IFP 4 /* interface name sockaddr present */
#define RTAX_IFA 5 /* interface addr sockaddr present */
#define RTAX_AUTHOR 6 /* sockaddr for author of redirect */
#define RTAX_BRD 7 /* for NEWADDR, broadcast or p-p dest addr */
#define RTAX_MAX 8 /* size of array to allocate */
struct rt_addrinfo {
int rti_addrs;
struct sockaddr *rti_info[RTAX_MAX];
};
#endif /* _NET_ROUTE_H_ */

View File

@ -0,0 +1,120 @@
/*
* Copyright (c) 2000-2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1985, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)in_var.h 8.2 (Berkeley) 1/9/95
*/
#ifndef _NETINET_IN_VAR_H_
#define _NETINET_IN_VAR_H_
#include <sys/appleapiopts.h>
#include <sys/queue.h>
#include <sys/kern_event.h>
#include <net/net_kev.h>
struct in_aliasreq {
char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */
struct sockaddr_in ifra_addr;
struct sockaddr_in ifra_broadaddr;
#define ifra_dstaddr ifra_broadaddr
struct sockaddr_in ifra_mask;
};
/*
* Event data, inet style.
*/
struct kev_in_data {
struct net_event_data link_data;
struct in_addr ia_addr; /* interface address */
u_int32_t ia_net; /* network number of interface */
u_int32_t ia_netmask; /* mask of net part */
u_int32_t ia_subnet; /* subnet number, including net */
u_int32_t ia_subnetmask; /* mask of subnet part */
struct in_addr ia_netbroadcast; /* to recognize net broadcasts */
struct in_addr ia_dstaddr;
};
struct kev_in_collision {
struct net_event_data link_data; /* link where ARP was received on */
struct in_addr ia_ipaddr; /* conflicting IP address */
u_char hw_len; /* length of hardware address */
u_char hw_addr[0]; /* variable length hardware address */
};
struct kev_in_arpfailure {
struct net_event_data link_data; /* link where ARP is being sent */
};
struct kev_in_arpalive {
struct net_event_data link_data; /* link where ARP was received */
};
#ifdef __APPLE_API_PRIVATE
struct kev_in_portinuse {
u_int16_t port; /* conflicting port number in host order */
u_int32_t req_pid; /* PID port requestor */
u_int32_t reserved[2];
};
#endif /* __APPLE_API_PRIVATE */
/* INET6 stuff */
#include <netinet6/in6_var.h>
#endif /* _NETINET_IN_VAR_H_ */

View File

@ -0,0 +1,59 @@
/* $FreeBSD: src/sys/netinet6/ah.h,v 1.3.2.2 2001/07/03 11:01:49 ume Exp $ */
/* $KAME: ah.h,v 1.13 2000/10/18 21:28:00 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* RFC1826/2402 authentication header.
*/
#ifndef _NETINET6_AH_H_
#define _NETINET6_AH_H_
#include <sys/appleapiopts.h>
struct ah {
u_int8_t ah_nxt; /* Next Header */
u_int8_t ah_len; /* Length of data, in 32bit */
u_int16_t ah_reserve; /* Reserved for future use */
u_int32_t ah_spi; /* Security parameter index */
/* variable size, 32bit bound*/ /* Authentication data */
};
struct newah {
u_int8_t ah_nxt; /* Next Header */
u_int8_t ah_len; /* Length of data + 1, in 32bit */
u_int16_t ah_reserve; /* Reserved for future use */
u_int32_t ah_spi; /* Security parameter index */
u_int32_t ah_seq; /* Sequence number field */
/* variable size, 32bit bound*/ /* Authentication data */
};
#endif /* _NETINET6_AH_H_ */

View File

@ -0,0 +1,99 @@
/*
* Copyright (c) 2008-2013 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/* $FreeBSD: src/sys/netinet6/esp.h,v 1.2.2.2 2001/07/03 11:01:49 ume Exp $ */
/* $KAME: esp.h,v 1.16 2000/10/18 21:28:00 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* RFC1827/2406 Encapsulated Security Payload.
*/
#ifndef _NETINET6_ESP_H_
#define _NETINET6_ESP_H_
#include <sys/appleapiopts.h>
#include <net/multi_layer_pkt_log.h>
struct esp {
u_int32_t esp_spi; /* ESP */
/*variable size, 32bit bound*/ /* Initialization Vector */
/*variable size*/ /* Payload data */
/*variable size*/ /* padding */
/*8bit*/ /* pad size */
/*8bit*/ /* next header */
/*8bit*/ /* next header */
/*variable size, 32bit bound*/ /* Authentication data (new IPsec) */
};
struct newesp {
u_int32_t esp_spi; /* ESP */
u_int32_t esp_seq; /* Sequence number */
/*variable size*/ /* (IV and) Payload data */
/*variable size*/ /* padding */
/*8bit*/ /* pad size */
/*8bit*/ /* next header */
/*8bit*/ /* next header */
/*variable size, 32bit bound*/ /* Authentication data */
};
struct esptail {
u_int8_t esp_padlen; /* pad length */
u_int8_t esp_nxt; /* Next header */
/*variable size, 32bit bound*/ /* Authentication data (new IPsec)*/
};
#endif /* _NETINET6_ESP_H_ */

View File

@ -0,0 +1,681 @@
/*
* Copyright (c) 2008-2020 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* Copyright (c) 1982, 1986, 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)in.h 8.3 (Berkeley) 1/3/94
*/
#ifndef __KAME_NETINET_IN_H_INCLUDED_
#error "do not include netinet6/in6.h directly, include netinet/in.h. " \
" see RFC2553"
#endif
#ifndef _NETINET6_IN6_H_
#define _NETINET6_IN6_H_
#include <sys/appleapiopts.h>
#include <sys/_types.h>
#include <sys/_types/_sa_family_t.h>
/*
* Identification of the network protocol stack
* for *BSD-current/release: http://www.kame.net/dev/cvsweb.cgi/kame/COVERAGE
* has the table of implementation/integration differences.
*/
#define __KAME__
#define __KAME_VERSION "2009/apple-darwin"
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
/*
* Local port number conventions:
*
* Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root),
* unless a kernel is compiled with IPNOPRIVPORTS defined.
*
* When a user does a bind(2) or connect(2) with a port number of zero,
* a non-conflicting local port address is chosen.
*
* The default range is IPPORT_ANONMIN to IPPORT_ANONMAX, although
* that is settable by sysctl(3); net.inet.ip.anonportmin and
* net.inet.ip.anonportmax respectively.
*
* A user may set the IPPROTO_IP option IP_PORTRANGE to change this
* default assignment range.
*
* The value IP_PORTRANGE_DEFAULT causes the default behavior.
*
* The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT,
* and exists only for FreeBSD compatibility purposes.
*
* The value IP_PORTRANGE_LOW changes the range to the "low" are
* that is (by convention) restricted to privileged processes.
* This convention is based on "vouchsafe" principles only.
* It is only secure if you trust the remote host to restrict these ports.
* The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX.
*/
#define IPV6PORT_RESERVED 1024
#define IPV6PORT_ANONMIN 49152
#define IPV6PORT_ANONMAX 65535
#define IPV6PORT_RESERVEDMIN 600
#define IPV6PORT_RESERVEDMAX (IPV6PORT_RESERVED-1)
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
/*
* IPv6 address
*/
typedef struct in6_addr {
union {
__uint8_t __u6_addr8[16];
__uint16_t __u6_addr16[8];
__uint32_t __u6_addr32[4];
} __u6_addr; /* 128-bit IP6 address */
} in6_addr_t;
#define s6_addr __u6_addr.__u6_addr8
#define INET6_ADDRSTRLEN 46
/*
* Socket address for IPv6
*/
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
#define SIN6_LEN
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
struct sockaddr_in6 {
__uint8_t sin6_len; /* length of this struct(sa_family_t) */
sa_family_t sin6_family; /* AF_INET6 (sa_family_t) */
in_port_t sin6_port; /* Transport layer port # (in_port_t) */
__uint32_t sin6_flowinfo; /* IP6 flow information */
struct in6_addr sin6_addr; /* IP6 address */
__uint32_t sin6_scope_id; /* scope zone index */
};
/*
* Definition of some useful macros to handle IP6 addresses
*/
#define IN6ADDR_ANY_INIT \
{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
#define IN6ADDR_LOOPBACK_INIT \
{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
#define IN6ADDR_NODELOCAL_ALLNODES_INIT \
{{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
#define IN6ADDR_INTFACELOCAL_ALLNODES_INIT \
{{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \
{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}
#define IN6ADDR_LINKLOCAL_ALLV2ROUTERS_INIT \
{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16 }}}
#define IN6ADDR_V4MAPPED_INIT \
{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}}
#define IN6ADDR_MULTICAST_PREFIX IN6MASK8
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
extern const struct in6_addr in6addr_any;
extern const struct in6_addr in6addr_loopback;
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
extern const struct in6_addr in6addr_nodelocal_allnodes;
extern const struct in6_addr in6addr_linklocal_allnodes;
extern const struct in6_addr in6addr_linklocal_allrouters;
extern const struct in6_addr in6addr_linklocal_allv2routers;
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
/*
* Equality
* NOTE: Some of kernel programming environment (for example, openbsd/sparc)
* does not supply memcmp(). For userland memcmp() is preferred as it is
* in ANSI standard.
*/
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
#define IN6_ARE_ADDR_EQUAL(a, b) \
(memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof (struct in6_addr)) \
== 0)
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
/*
* Unspecified
*/
#define IN6_IS_ADDR_UNSPECIFIED(a) \
((*(const __uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[12]) == 0))
/*
* Loopback
*/
#define IN6_IS_ADDR_LOOPBACK(a) \
((*(const __uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[12]) == ntohl(1)))
/*
* IPv4 compatible
*/
#define IN6_IS_ADDR_V4COMPAT(a) \
((*(const __uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[12]) != 0) && \
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[12]) != ntohl(1)))
/*
* Mapped
*/
#define IN6_IS_ADDR_V4MAPPED(a) \
((*(const __uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[8]) == \
ntohl(0x0000ffff)))
/*
* 6to4
*/
#define IN6_IS_ADDR_6TO4(x) (ntohs((x)->s6_addr16[0]) == 0x2002)
/*
* KAME Scope Values
*/
#define __IPV6_ADDR_SCOPE_NODELOCAL 0x01
#define __IPV6_ADDR_SCOPE_INTFACELOCAL 0x01
#define __IPV6_ADDR_SCOPE_LINKLOCAL 0x02
#define __IPV6_ADDR_SCOPE_SITELOCAL 0x05
#define __IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */
#define __IPV6_ADDR_SCOPE_GLOBAL 0x0e
/*
* Unicast Scope
* Note that we must check topmost 10 bits only, not 16 bits (see RFC2373).
*/
#define IN6_IS_ADDR_LINKLOCAL(a) \
(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
#define IN6_IS_ADDR_SITELOCAL(a) \
(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))
/*
* Multicast
*/
#define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff)
#define IPV6_ADDR_MC_FLAGS(a) ((a)->s6_addr[1] & 0xf0)
#define IPV6_ADDR_MC_FLAGS_TRANSIENT 0x10
#define IPV6_ADDR_MC_FLAGS_PREFIX 0x20
#define IPV6_ADDR_MC_FLAGS_UNICAST_BASED (IPV6_ADDR_MC_FLAGS_TRANSIENT | IPV6_ADDR_MC_FLAGS_PREFIX)
#define IN6_IS_ADDR_UNICAST_BASED_MULTICAST(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(IPV6_ADDR_MC_FLAGS(a) == IPV6_ADDR_MC_FLAGS_UNICAST_BASED))
/*
* Unique Local IPv6 Unicast Addresses (per RFC 4193)
*/
#define IN6_IS_ADDR_UNIQUE_LOCAL(a) \
(((a)->s6_addr[0] == 0xfc) || ((a)->s6_addr[0] == 0xfd))
#define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f)
/*
* Multicast Scope
*/
#define IN6_IS_ADDR_MC_NODELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL))
#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(IPV6_ADDR_MC_FLAGS(a) != IPV6_ADDR_MC_FLAGS_UNICAST_BASED) && \
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL))
#define IN6_IS_ADDR_MC_SITELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL))
#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL))
#define IN6_IS_ADDR_MC_GLOBAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL))
/*
* Options for use with [gs]etsockopt at the IPV6 level.
* First word of comment is data type; bool is stored in int.
*/
/* no hdrincl */
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
/*
* RFC 3542 define the following socket options in a manner incompatible
* with RFC 2292:
* IPV6_PKTINFO
* IPV6_HOPLIMIT
* IPV6_NEXTHOP
* IPV6_HOPOPTS
* IPV6_DSTOPTS
* IPV6_RTHDR
*
* To use the new IPv6 Sockets options introduced by RFC 3542
* the constant __APPLE_USE_RFC_3542 must be defined before
* including <netinet/in.h>
*
* To use the old IPv6 Sockets options from RFC 2292
* the constant __APPLE_USE_RFC_2292 must be defined before
* including <netinet/in.h>
*
* Note that eventually RFC 3542 is going to be the
* default and RFC 2292 will be obsolete.
*/
#if defined(__APPLE_USE_RFC_3542) && defined(__APPLE_USE_RFC_2292)
#error "__APPLE_USE_RFC_3542 and __APPLE_USE_RFC_2292 cannot be both defined"
#endif
#if 0 /* the followings are relic in IPv4 and hence are disabled */
#define IPV6_OPTIONS 1 /* buf/ip6_opts; set/get IP6 options */
#define IPV6_RECVOPTS 5 /* bool; receive all IP6 opts w/dgram */
#define IPV6_RECVRETOPTS 6 /* bool; receive IP6 opts for response */
#define IPV6_RECVDSTADDR 7 /* bool; receive IP6 dst addr w/dgram */
#define IPV6_RETOPTS 8 /* ip6_opts; set/get IP6 options */
#endif /* 0 */
#define IPV6_SOCKOPT_RESERVED1 3 /* reserved for future use */
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
#define IPV6_UNICAST_HOPS 4 /* int; IP6 hops */
#define IPV6_MULTICAST_IF 9 /* u_int; set/get IP6 multicast i/f */
#define IPV6_MULTICAST_HOPS 10 /* int; set/get IP6 multicast hops */
#define IPV6_MULTICAST_LOOP 11 /* u_int; set/get IP6 mcast loopback */
#define IPV6_JOIN_GROUP 12 /* ip6_mreq; join a group membership */
#define IPV6_LEAVE_GROUP 13 /* ip6_mreq; leave a group membership */
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
#define IPV6_PORTRANGE 14 /* int; range to choose for unspec port */
#define ICMP6_FILTER 18 /* icmp6_filter; icmp6 filter */
#define IPV6_2292PKTINFO 19 /* bool; send/recv if, src/dst addr */
#define IPV6_2292HOPLIMIT 20 /* bool; hop limit */
#define IPV6_2292NEXTHOP 21 /* bool; next hop addr */
#define IPV6_2292HOPOPTS 22 /* bool; hop-by-hop option */
#define IPV6_2292DSTOPTS 23 /* bool; destinaion option */
#define IPV6_2292RTHDR 24 /* ip6_rthdr: routing header */
/* buf/cmsghdr; set/get IPv6 options [obsoleted by RFC3542] */
#define IPV6_2292PKTOPTIONS 25
#ifdef __APPLE_USE_RFC_2292
#define IPV6_PKTINFO IPV6_2292PKTINFO
#define IPV6_HOPLIMIT IPV6_2292HOPLIMIT
#define IPV6_NEXTHOP IPV6_2292NEXTHOP
#define IPV6_HOPOPTS IPV6_2292HOPOPTS
#define IPV6_DSTOPTS IPV6_2292DSTOPTS
#define IPV6_RTHDR IPV6_2292RTHDR
#define IPV6_PKTOPTIONS IPV6_2292PKTOPTIONS
#endif /* __APPLE_USE_RFC_2292 */
#define IPV6_CHECKSUM 26 /* int; checksum offset for raw socket */
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
#define IPV6_V6ONLY 27 /* bool; only bind INET6 at wildcard bind */
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
#define IPV6_BINDV6ONLY IPV6_V6ONLY
#if 1 /* IPSEC */
#define IPV6_IPSEC_POLICY 28 /* struct; get/set security policy */
#endif /* 1 */
#define IPV6_FAITH 29 /* deprecated */
#if 1 /* IPV6FIREWALL */
#define IPV6_FW_ADD 30 /* add a firewall rule to chain */
#define IPV6_FW_DEL 31 /* delete a firewall rule from chain */
#define IPV6_FW_FLUSH 32 /* flush firewall rule chain */
#define IPV6_FW_ZERO 33 /* clear single/all firewall counter(s) */
#define IPV6_FW_GET 34 /* get entire firewall rule chain */
#endif /* 1 */
/*
* APPLE: NOTE the value of those 2 options is kept unchanged from
* previous version of darwin/OS X for binary compatibility reasons
* and differ from FreeBSD (values 57 and 61). See below.
*/
#define IPV6_RECVTCLASS 35 /* bool; recv traffic class values */
#define IPV6_TCLASS 36 /* int; send traffic class value */
#ifdef __APPLE_USE_RFC_3542
/* new socket options introduced in RFC3542 */
/*
* ip6_dest; send dst option before rthdr
* APPLE: Value purposely different than FreeBSD (35) to avoid
* collision with definition of IPV6_RECVTCLASS in previous
* darwin implementations
*/
#define IPV6_RTHDRDSTOPTS 57
/*
* bool; recv if, dst addr
* APPLE: Value purposely different than FreeBSD(36) to avoid
* collision with definition of IPV6_TCLASS in previous
* darwin implementations
*/
#define IPV6_RECVPKTINFO 61
#define IPV6_RECVHOPLIMIT 37 /* bool; recv hop limit */
#define IPV6_RECVRTHDR 38 /* bool; recv routing header */
#define IPV6_RECVHOPOPTS 39 /* bool; recv hop-by-hop option */
#define IPV6_RECVDSTOPTS 40 /* bool; recv dst option after rthdr */
#define IPV6_USE_MIN_MTU 42 /* bool; send packets at the minimum MTU */
#define IPV6_RECVPATHMTU 43 /* bool; notify an according MTU */
/*
* mtuinfo; get the current path MTU (sopt), 4 bytes int;
* MTU notification (cmsg)
*/
#define IPV6_PATHMTU 44
#if 0 /* obsoleted during 2292bis -> 3542 */
/* no data; ND reachability confirm (cmsg only/not in of RFC3542) */
#define IPV6_REACHCONF 45
#endif
/* more new socket options introduced in RFC3542 */
#define IPV6_3542PKTINFO 46 /* in6_pktinfo; send if, src addr */
#define IPV6_3542HOPLIMIT 47 /* int; send hop limit */
#define IPV6_3542NEXTHOP 48 /* sockaddr; next hop addr */
#define IPV6_3542HOPOPTS 49 /* ip6_hbh; send hop-by-hop option */
#define IPV6_3542DSTOPTS 50 /* ip6_dest; send dst option befor rthdr */
#define IPV6_3542RTHDR 51 /* ip6_rthdr; send routing header */
#define IPV6_PKTINFO IPV6_3542PKTINFO
#define IPV6_HOPLIMIT IPV6_3542HOPLIMIT
#define IPV6_NEXTHOP IPV6_3542NEXTHOP
#define IPV6_HOPOPTS IPV6_3542HOPOPTS
#define IPV6_DSTOPTS IPV6_3542DSTOPTS
#define IPV6_RTHDR IPV6_3542RTHDR
#define IPV6_AUTOFLOWLABEL 59 /* bool; attach flowlabel automagically */
#define IPV6_DONTFRAG 62 /* bool; disable IPv6 fragmentation */
/* int; prefer temporary addresses as the source address. */
#define IPV6_PREFER_TEMPADDR 63
/*
* The following option is private; do not use it from user applications.
* It is deliberately defined to the same value as IP_MSFILTER.
*/
#define IPV6_MSFILTER 74 /* struct __msfilterreq; */
#endif /* __APPLE_USE_RFC_3542 */
#define IPV6_BOUND_IF 125 /* int; set/get bound interface */
/* to define items, should talk with KAME guys first, for *BSD compatibility */
#define IPV6_RTHDR_LOOSE 0 /* this hop need not be a neighbor. */
#define IPV6_RTHDR_STRICT 1 /* this hop must be a neighbor. */
#define IPV6_RTHDR_TYPE_0 0 /* IPv6 routing header type 0 */
/*
* Defaults and limits for options
*/
#define IPV6_DEFAULT_MULTICAST_HOPS 1 /* normally limit m'casts to 1 hop */
#define IPV6_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */
/*
* The im6o_membership vector for each socket is now dynamically allocated at
* run-time, bounded by USHRT_MAX, and is reallocated when needed, sized
* according to a power-of-two increment.
*/
#define IPV6_MIN_MEMBERSHIPS 31
#define IPV6_MAX_MEMBERSHIPS 4095
/*
* Default resource limits for IPv6 multicast source filtering.
* These may be modified by sysctl.
*/
#define IPV6_MAX_GROUP_SRC_FILTER 512 /* sources per group */
#define IPV6_MAX_SOCK_SRC_FILTER 128 /* sources per socket/group */
/*
* Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP.
*/
struct ipv6_mreq {
struct in6_addr ipv6mr_multiaddr;
unsigned int ipv6mr_interface;
};
/*
* IPV6_2292PKTINFO: Packet information(RFC2292 sec 5)
*/
struct in6_pktinfo {
struct in6_addr ipi6_addr; /* src/dst IPv6 address */
unsigned int ipi6_ifindex; /* send/recv interface index */
};
/*
* Control structure for IPV6_RECVPATHMTU socket option.
*/
struct ip6_mtuinfo {
struct sockaddr_in6 ip6m_addr; /* or sockaddr_storage? */
uint32_t ip6m_mtu;
};
/*
* Argument for IPV6_PORTRANGE:
* - which range to search when port is unspecified at bind() or connect()
*/
#define IPV6_PORTRANGE_DEFAULT 0 /* default range */
#define IPV6_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */
#define IPV6_PORTRANGE_LOW 2 /* "low" - vouchsafe security */
/*
* Definitions for inet6 sysctl operations.
*
* Third level is protocol number.
* Fourth level is desired variable within that protocol.
*/
#define IPV6PROTO_MAXID (IPPROTO_PIM + 1) /* don't list to IPV6PROTO_MAX */
/*
* Names for IP sysctl objects
*/
#define IPV6CTL_FORWARDING 1 /* act as router */
#define IPV6CTL_SENDREDIRECTS 2 /* may send redirects when forwarding */
#define IPV6CTL_DEFHLIM 3 /* default Hop-Limit */
#ifdef notyet
#define IPV6CTL_DEFMTU 4 /* default MTU */
#endif
#define IPV6CTL_FORWSRCRT 5 /* forward source-routed dgrams */
#define IPV6CTL_STATS 6 /* stats */
#define IPV6CTL_MRTSTATS 7 /* multicast forwarding stats */
#define IPV6CTL_MRTPROTO 8 /* multicast routing protocol */
#define IPV6CTL_MAXFRAGPACKETS 9 /* max packets reassembly queue */
#define IPV6CTL_SOURCECHECK 10 /* verify source route and intf */
#define IPV6CTL_SOURCECHECK_LOGINT 11 /* minimume logging interval */
#define IPV6CTL_ACCEPT_RTADV 12
#define IPV6CTL_KEEPFAITH 13 /* deprecated */
#define IPV6CTL_LOG_INTERVAL 14
#define IPV6CTL_HDRNESTLIMIT 15
#define IPV6CTL_DAD_COUNT 16
#define IPV6CTL_AUTO_FLOWLABEL 17
#define IPV6CTL_DEFMCASTHLIM 18
#define IPV6CTL_GIF_HLIM 19 /* default HLIM for gif encap packet */
#define IPV6CTL_KAME_VERSION 20
#define IPV6CTL_USE_DEPRECATED 21 /* use deprec addr (RFC2462 5.5.4) */
#define IPV6CTL_RR_PRUNE 22 /* walk timer for router renumbering */
#if 0 /* obsolete */
#define IPV6CTL_MAPPED_ADDR 23
#endif
#define IPV6CTL_V6ONLY 24
#define IPV6CTL_RTEXPIRE 25 /* cloned route expiration time */
#define IPV6CTL_RTMINEXPIRE 26 /* min value for expiration time */
#define IPV6CTL_RTMAXCACHE 27 /* trigger level for dynamic expire */
#define IPV6CTL_USETEMPADDR 32 /* use temporary addresses [RFC 4941] */
#define IPV6CTL_TEMPPLTIME 33 /* preferred lifetime for tmpaddrs */
#define IPV6CTL_TEMPVLTIME 34 /* valid lifetime for tmpaddrs */
#define IPV6CTL_AUTO_LINKLOCAL 35 /* automatic link-local addr assign */
#define IPV6CTL_RIP6STATS 36 /* raw_ip6 stats */
#define IPV6CTL_PREFER_TEMPADDR 37 /* prefer temporary addr as src */
#define IPV6CTL_ADDRCTLPOLICY 38 /* get/set address selection policy */
#define IPV6CTL_USE_DEFAULTZONE 39 /* use default scope zone */
#define IPV6CTL_MAXFRAGS 41 /* max fragments */
#define IPV6CTL_MCAST_PMTU 44 /* enable pMTU discovery for mcast? */
#define IPV6CTL_NEIGHBORGCTHRESH 46
#define IPV6CTL_MAXIFPREFIXES 47
#define IPV6CTL_MAXIFDEFROUTERS 48
#define IPV6CTL_MAXDYNROUTES 49
#define ICMPV6CTL_ND6_ONLINKNSRFC4861 50
/* New entries should be added here from current IPV6CTL_MAXID value. */
/* to define items, should talk with KAME guys first, for *BSD compatibility */
#define IPV6CTL_MAXID 51
__BEGIN_DECLS
struct cmsghdr;
extern int inet6_option_space(int);
extern int inet6_option_init(void *, struct cmsghdr **, int);
extern int inet6_option_append(struct cmsghdr *, const __uint8_t *, int, int);
extern __uint8_t *inet6_option_alloc(struct cmsghdr *, int, int, int);
extern int inet6_option_next(const struct cmsghdr *, __uint8_t **);
extern int inet6_option_find(const struct cmsghdr *, __uint8_t **, int);
extern size_t inet6_rthdr_space(int, int);
extern struct cmsghdr *inet6_rthdr_init(void *, int);
extern int inet6_rthdr_add(struct cmsghdr *, const struct in6_addr *,
unsigned int);
extern int inet6_rthdr_lasthop(struct cmsghdr *, unsigned int);
#if 0 /* not implemented yet */
extern int inet6_rthdr_reverse(const struct cmsghdr *, struct cmsghdr *);
#endif
extern int inet6_rthdr_segments(const struct cmsghdr *);
extern struct in6_addr *inet6_rthdr_getaddr(struct cmsghdr *, int);
extern int inet6_rthdr_getflags(const struct cmsghdr *, int);
extern int inet6_opt_init(void *, socklen_t);
extern int inet6_opt_append(void *, socklen_t, int, __uint8_t, socklen_t,
__uint8_t, void **);
extern int inet6_opt_finish(void *, socklen_t, int);
extern int inet6_opt_set_val(void *, int, void *, socklen_t);
extern int inet6_opt_next(void *, socklen_t, int, __uint8_t *, socklen_t *,
void **);
extern int inet6_opt_find(void *, socklen_t, int, __uint8_t, socklen_t *,
void **);
extern int inet6_opt_get_val(void *, int, void *, socklen_t);
extern socklen_t inet6_rth_space(int, int);
extern void *inet6_rth_init(void *, socklen_t, int, int);
extern int inet6_rth_add(void *, const struct in6_addr *);
extern int inet6_rth_reverse(const void *, void *);
extern int inet6_rth_segments(const void *);
extern struct in6_addr *inet6_rth_getaddr(const void *, int);
__END_DECLS
#endif /* PLATFORM_DriverKit */
#endif /* !_NETINET6_IN6_H_ */

View File

@ -0,0 +1,482 @@
/*
* Copyright (c) 2000-2020 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* Copyright (c) 1985, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)in_var.h 8.1 (Berkeley) 6/10/93
*/
#ifndef _NETINET6_IN6_VAR_H_
#define _NETINET6_IN6_VAR_H_
#include <sys/appleapiopts.h>
#include <net/net_kev.h>
#include <netinet6/scope6_var.h>
#include <sys/kern_event.h>
#include <net/ethernet.h>
/*
* pltime/vltime are just for future reference (required to implements 2
* hour rule for hosts). they should never be modified by nd6_timeout or
* anywhere else.
* userland -> kernel: accept pltime/vltime
* kernel -> userland: throw up everything
* in kernel: modify preferred/expire only
*/
struct in6_addrlifetime {
time_t ia6t_expire; /* valid lifetime expiration time */
time_t ia6t_preferred; /* preferred lifetime expiration time */
u_int32_t ia6t_vltime; /* valid lifetime */
u_int32_t ia6t_pltime; /* prefix lifetime */
};
/* control structure to manage address selection policy */
struct in6_addrpolicy {
struct sockaddr_in6 addr; /* prefix address */
struct sockaddr_in6 addrmask; /* prefix mask */
int preced; /* precedence */
int label; /* matching label */
u_quad_t use; /* statistics */
};
/*
* IPv6 interface statistics, as defined in RFC2465 Ipv6IfStatsEntry (p12).
*/
struct in6_ifstat {
u_quad_t ifs6_in_receive; /* # of total input datagram */
u_quad_t ifs6_in_hdrerr; /* # of datagrams with invalid hdr */
u_quad_t ifs6_in_toobig; /* # of datagrams exceeded MTU */
u_quad_t ifs6_in_noroute; /* # of datagrams with no route */
u_quad_t ifs6_in_addrerr; /* # of datagrams with invalid dst */
u_quad_t ifs6_in_protounknown; /* # of datagrams with unknown proto */
/* NOTE: increment on final dst if */
u_quad_t ifs6_in_truncated; /* # of truncated datagrams */
u_quad_t ifs6_in_discard; /* # of discarded datagrams */
/* NOTE: fragment timeout is not here */
u_quad_t ifs6_in_deliver; /* # of datagrams delivered to ULP */
/* NOTE: increment on final dst if */
u_quad_t ifs6_out_forward; /* # of datagrams forwarded */
/* NOTE: increment on outgoing if */
u_quad_t ifs6_out_request; /* # of outgoing datagrams from ULP */
/* NOTE: does not include forwrads */
u_quad_t ifs6_out_discard; /* # of discarded datagrams */
u_quad_t ifs6_out_fragok; /* # of datagrams fragmented */
u_quad_t ifs6_out_fragfail; /* # of datagrams failed on fragment */
u_quad_t ifs6_out_fragcreat; /* # of fragment datagrams */
/* NOTE: this is # after fragment */
u_quad_t ifs6_reass_reqd; /* # of incoming fragmented packets */
/* NOTE: increment on final dst if */
u_quad_t ifs6_reass_ok; /* # of reassembled packets */
/* NOTE: this is # after reass */
/* NOTE: increment on final dst if */
u_quad_t ifs6_atmfrag_rcvd; /* # of atomic fragments received */
u_quad_t ifs6_reass_fail; /* # of reass failures */
/* NOTE: may not be packet count */
/* NOTE: increment on final dst if */
u_quad_t ifs6_in_mcast; /* # of inbound multicast datagrams */
u_quad_t ifs6_out_mcast; /* # of outbound multicast datagrams */
u_quad_t ifs6_cantfoward_icmp6; /* # of ICMPv6 packets received for unreachable dest */
u_quad_t ifs6_addr_expiry_cnt; /* # of address expiry events (excluding privacy addresses) */
u_quad_t ifs6_pfx_expiry_cnt; /* # of prefix expiry events */
u_quad_t ifs6_defrtr_expiry_cnt; /* # of default router expiry events */
};
/*
* ICMPv6 interface statistics, as defined in RFC2466 Ipv6IfIcmpEntry.
* XXX: I'm not sure if this file is the right place for this structure...
*/
struct icmp6_ifstat {
/*
* Input statistics
*/
/* ipv6IfIcmpInMsgs, total # of input messages */
u_quad_t ifs6_in_msg;
/* ipv6IfIcmpInErrors, # of input error messages */
u_quad_t ifs6_in_error;
/* ipv6IfIcmpInDestUnreachs, # of input dest unreach errors */
u_quad_t ifs6_in_dstunreach;
/* ipv6IfIcmpInAdminProhibs, # of input admin. prohibited errs */
u_quad_t ifs6_in_adminprohib;
/* ipv6IfIcmpInTimeExcds, # of input time exceeded errors */
u_quad_t ifs6_in_timeexceed;
/* ipv6IfIcmpInParmProblems, # of input parameter problem errors */
u_quad_t ifs6_in_paramprob;
/* ipv6IfIcmpInPktTooBigs, # of input packet too big errors */
u_quad_t ifs6_in_pkttoobig;
/* ipv6IfIcmpInEchos, # of input echo requests */
u_quad_t ifs6_in_echo;
/* ipv6IfIcmpInEchoReplies, # of input echo replies */
u_quad_t ifs6_in_echoreply;
/* ipv6IfIcmpInRouterSolicits, # of input router solicitations */
u_quad_t ifs6_in_routersolicit;
/* ipv6IfIcmpInRouterAdvertisements, # of input router advertisements */
u_quad_t ifs6_in_routeradvert;
/* ipv6IfIcmpInNeighborSolicits, # of input neighbor solicitations */
u_quad_t ifs6_in_neighborsolicit;
/* ipv6IfIcmpInNeighborAdvertisements, # of input neighbor advs. */
u_quad_t ifs6_in_neighboradvert;
/* ipv6IfIcmpInRedirects, # of input redirects */
u_quad_t ifs6_in_redirect;
/* ipv6IfIcmpInGroupMembQueries, # of input MLD queries */
u_quad_t ifs6_in_mldquery;
/* ipv6IfIcmpInGroupMembResponses, # of input MLD reports */
u_quad_t ifs6_in_mldreport;
/* ipv6IfIcmpInGroupMembReductions, # of input MLD done */
u_quad_t ifs6_in_mlddone;
/*
* Output statistics. We should solve unresolved routing problem...
*/
/* ipv6IfIcmpOutMsgs, total # of output messages */
u_quad_t ifs6_out_msg;
/* ipv6IfIcmpOutErrors, # of output error messages */
u_quad_t ifs6_out_error;
/* ipv6IfIcmpOutDestUnreachs, # of output dest unreach errors */
u_quad_t ifs6_out_dstunreach;
/* ipv6IfIcmpOutAdminProhibs, # of output admin. prohibited errs */
u_quad_t ifs6_out_adminprohib;
/* ipv6IfIcmpOutTimeExcds, # of output time exceeded errors */
u_quad_t ifs6_out_timeexceed;
/* ipv6IfIcmpOutParmProblems, # of output parameter problem errors */
u_quad_t ifs6_out_paramprob;
/* ipv6IfIcmpOutPktTooBigs, # of output packet too big errors */
u_quad_t ifs6_out_pkttoobig;
/* ipv6IfIcmpOutEchos, # of output echo requests */
u_quad_t ifs6_out_echo;
/* ipv6IfIcmpOutEchoReplies, # of output echo replies */
u_quad_t ifs6_out_echoreply;
/* ipv6IfIcmpOutRouterSolicits, # of output router solicitations */
u_quad_t ifs6_out_routersolicit;
/* ipv6IfIcmpOutRouterAdvertisements, # of output router advs. */
u_quad_t ifs6_out_routeradvert;
/* ipv6IfIcmpOutNeighborSolicits, # of output neighbor solicitations */
u_quad_t ifs6_out_neighborsolicit;
/* ipv6IfIcmpOutNeighborAdvertisements, # of output neighbor advs. */
u_quad_t ifs6_out_neighboradvert;
/* ipv6IfIcmpOutRedirects, # of output redirects */
u_quad_t ifs6_out_redirect;
/* ipv6IfIcmpOutGroupMembQueries, # of output MLD queries */
u_quad_t ifs6_out_mldquery;
/* ipv6IfIcmpOutGroupMembResponses, # of output MLD reports */
u_quad_t ifs6_out_mldreport;
/* ipv6IfIcmpOutGroupMembReductions, # of output MLD done */
u_quad_t ifs6_out_mlddone;
};
struct in6_ifreq {
char ifr_name[IFNAMSIZ];
union {
struct sockaddr_in6 ifru_addr;
struct sockaddr_in6 ifru_dstaddr;
int ifru_flags;
int ifru_flags6;
int ifru_metric;
int ifru_intval;
caddr_t ifru_data;
struct in6_addrlifetime ifru_lifetime;
struct in6_ifstat ifru_stat;
struct icmp6_ifstat ifru_icmp6stat;
u_int32_t ifru_scope_id[SCOPE6_ID_MAX];
} ifr_ifru;
};
struct in6_aliasreq {
char ifra_name[IFNAMSIZ];
struct sockaddr_in6 ifra_addr;
struct sockaddr_in6 ifra_dstaddr;
struct sockaddr_in6 ifra_prefixmask;
int ifra_flags;
struct in6_addrlifetime ifra_lifetime;
};
/* prefix type macro */
#define IN6_PREFIX_ND 1
#define IN6_PREFIX_RR 2
/*
* prefix related flags passed between kernel(NDP related part) and
* user land command(ifconfig) and daemon(rtadvd).
*/
struct in6_prflags {
struct prf_ra {
u_char onlink : 1;
u_char autonomous : 1;
u_char reserved : 6;
} prf_ra;
u_char prf_reserved1;
u_short prf_reserved2;
/* want to put this on 4byte offset */
struct prf_rr {
u_char decrvalid : 1;
u_char decrprefd : 1;
u_char reserved : 6;
} prf_rr;
u_char prf_reserved3;
u_short prf_reserved4;
};
struct in6_prefixreq {
char ipr_name[IFNAMSIZ];
u_char ipr_origin;
u_char ipr_plen;
u_int32_t ipr_vltime;
u_int32_t ipr_pltime;
struct in6_prflags ipr_flags;
struct sockaddr_in6 ipr_prefix;
};
#define PR_ORIG_RA 0
#define PR_ORIG_RR 1
#define PR_ORIG_STATIC 2
#define PR_ORIG_KERNEL 3
#define ipr_raf_onlink ipr_flags.prf_ra.onlink
#define ipr_raf_auto ipr_flags.prf_ra.autonomous
#define ipr_statef_onlink ipr_flags.prf_state.onlink
#define ipr_rrf_decrvalid ipr_flags.prf_rr.decrvalid
#define ipr_rrf_decrprefd ipr_flags.prf_rr.decrprefd
struct in6_rrenumreq {
char irr_name[IFNAMSIZ];
u_char irr_origin;
u_char irr_m_len; /* match len for matchprefix */
u_char irr_m_minlen; /* minlen for matching prefix */
u_char irr_m_maxlen; /* maxlen for matching prefix */
u_char irr_u_uselen; /* uselen for adding prefix */
u_char irr_u_keeplen; /* keeplen from matching prefix */
struct irr_raflagmask {
u_char onlink : 1;
u_char autonomous : 1;
u_char reserved : 6;
} irr_raflagmask;
u_int32_t irr_vltime;
u_int32_t irr_pltime;
struct in6_prflags irr_flags;
struct sockaddr_in6 irr_matchprefix;
struct sockaddr_in6 irr_useprefix;
};
#define irr_raf_mask_onlink irr_raflagmask.onlink
#define irr_raf_mask_auto irr_raflagmask.autonomous
#define irr_raf_mask_reserved irr_raflagmask.reserved
#define irr_raf_onlink irr_flags.prf_ra.onlink
#define irr_raf_auto irr_flags.prf_ra.autonomous
#define irr_statef_onlink irr_flags.prf_state.onlink
#define irr_rrf irr_flags.prf_rr
#define irr_rrf_decrvalid irr_flags.prf_rr.decrvalid
#define irr_rrf_decrprefd irr_flags.prf_rr.decrprefd
/*
* Event data, inet6 style.
*/
struct kev_in6_addrlifetime {
u_int32_t ia6t_expire;
u_int32_t ia6t_preferred;
u_int32_t ia6t_vltime;
u_int32_t ia6t_pltime;
};
struct kev_in6_data {
struct net_event_data link_data;
struct sockaddr_in6 ia_addr; /* interface address */
struct sockaddr_in6 ia_net; /* network number of interface */
struct sockaddr_in6 ia_dstaddr; /* space for destination addr */
struct sockaddr_in6 ia_prefixmask; /* prefix mask */
u_int32_t ia_plen; /* prefix length */
u_int32_t ia6_flags; /* address flags from in6_ifaddr */
struct kev_in6_addrlifetime ia_lifetime; /* address life info */
uint8_t ia_mac[ETHER_ADDR_LEN];
};
#define SIOCSIFADDR_IN6 _IOW('i', 12, struct in6_ifreq)
#define SIOCGIFADDR_IN6 _IOWR('i', 33, struct in6_ifreq)
/*
* SIOCSxxx ioctls should be unused (see comments in in6.c), but
* we do not shift numbers for binary compatibility.
*/
#define SIOCSIFDSTADDR_IN6 _IOW('i', 14, struct in6_ifreq)
#define SIOCSIFNETMASK_IN6 _IOW('i', 22, struct in6_ifreq)
#define SIOCGIFDSTADDR_IN6 _IOWR('i', 34, struct in6_ifreq)
#define SIOCGIFNETMASK_IN6 _IOWR('i', 37, struct in6_ifreq)
#define SIOCDIFADDR_IN6 _IOW('i', 25, struct in6_ifreq)
#define SIOCAIFADDR_IN6 _IOW('i', 26, struct in6_aliasreq)
#define SIOCSIFPHYADDR_IN6 _IOW('i', 62, struct in6_aliasreq)
#define SIOCGIFPSRCADDR_IN6 _IOWR('i', 63, struct in6_ifreq)
#define SIOCGIFPDSTADDR_IN6 _IOWR('i', 64, struct in6_ifreq)
#define SIOCGIFAFLAG_IN6 _IOWR('i', 73, struct in6_ifreq)
#define SIOCGDRLST_IN6 _IOWR('i', 74, struct in6_drlist)
#define SIOCGPRLST_IN6 _IOWR('i', 75, struct in6_prlist)
#define OSIOCGIFINFO_IN6 _IOWR('i', 108, struct in6_ondireq)
#define SIOCGIFINFO_IN6 _IOWR('i', 76, struct in6_ondireq)
#define SIOCSNDFLUSH_IN6 _IOWR('i', 77, struct in6_ifreq)
#define SIOCGNBRINFO_IN6 _IOWR('i', 78, struct in6_nbrinfo)
#define SIOCSPFXFLUSH_IN6 _IOWR('i', 79, struct in6_ifreq)
#define SIOCSRTRFLUSH_IN6 _IOWR('i', 80, struct in6_ifreq)
#define SIOCGIFALIFETIME_IN6 _IOWR('i', 81, struct in6_ifreq)
#define SIOCSIFALIFETIME_IN6 _IOWR('i', 82, struct in6_ifreq)
#define SIOCGIFSTAT_IN6 _IOWR('i', 83, struct in6_ifreq)
#define SIOCGIFSTAT_ICMP6 _IOWR('i', 84, struct in6_ifreq)
#define SIOCSDEFIFACE_IN6 _IOWR('i', 85, struct in6_ndifreq)
#define SIOCGDEFIFACE_IN6 _IOWR('i', 86, struct in6_ndifreq)
#define SIOCSIFINFO_FLAGS _IOWR('i', 87, struct in6_ndireq) /* XXX */
/* N.B.: These 3 ioctls are deprecated and won't work */
#define SIOCSSCOPE6 _IOW('i', 88, struct in6_ifreq)
#define SIOCGSCOPE6 _IOWR('i', 89, struct in6_ifreq)
#define SIOCGSCOPE6DEF _IOWR('i', 90, struct in6_ifreq)
#define SIOCSIFPREFIX_IN6 _IOW('i', 100, struct in6_prefixreq) /* set */
#define SIOCGIFPREFIX_IN6 _IOWR('i', 101, struct in6_prefixreq) /* get */
#define SIOCDIFPREFIX_IN6 _IOW('i', 102, struct in6_prefixreq) /* del */
#define SIOCAIFPREFIX_IN6 _IOW('i', 103, struct in6_rrenumreq) /* add */
/* change */
#define SIOCCIFPREFIX_IN6 _IOW('i', 104, struct in6_rrenumreq)
/* set global */
#define SIOCSGIFPREFIX_IN6 _IOW('i', 105, struct in6_rrenumreq)
/*
* multicast routing, get s/g pkt cnt, pkt cnt per interface.
*/
#define SIOCGETSGCNT_IN6 _IOWR('u', 28, struct sioc_sg_req6)
#define SIOCGETMIFCNT_IN6 _IOWR('u', 107, struct sioc_mif_req6)
#define SIOCAADDRCTL_POLICY _IOW('u', 108, struct in6_addrpolicy)
#define SIOCDADDRCTL_POLICY _IOW('u', 109, struct in6_addrpolicy)
#define IN6_IFF_ANYCAST 0x0001 /* anycast address */
#define IN6_IFF_TENTATIVE 0x0002 /* tentative address */
#define IN6_IFF_DUPLICATED 0x0004 /* DAD detected duplicate */
#define IN6_IFF_DETACHED 0x0008 /* may be detached from the link */
#define IN6_IFF_DEPRECATED 0x0010 /* deprecated address */
/* don't perform DAD on this address (used only at first SIOC* call) */
#define IN6_IFF_NODAD 0x0020
#define IN6_IFF_AUTOCONF 0x0040 /* autoconfigurable address. */
#define IN6_IFF_TEMPORARY 0x0080 /* temporary (anonymous) address. */
#define IN6_IFF_DYNAMIC 0x0100 /* assigned by DHCPv6 service */
#define IN6_IFF_OPTIMISTIC 0x0200 /* optimistic DAD, i.e. RFC 4429 */
#define IN6_IFF_SECURED 0x0400 /* cryptographically generated */
#define IN6_IFF_CLAT46 0x1000 /* Address reserved for CLAT46 */
#define IN6_IFF_NOPFX 0x8000 /* Depreciated. Don't use. */
/* Duplicate Address Detection [DAD] in progress. */
#define IN6_IFF_DADPROGRESS (IN6_IFF_TENTATIVE|IN6_IFF_OPTIMISTIC)
/* do not input/output */
#define IN6_IFF_NOTREADY (IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED)
/* SLAAC/DHCPv6 address */
#define IN6_IFF_NOTMANUAL (IN6_IFF_AUTOCONF|IN6_IFF_DYNAMIC)
#endif /* _NETINET6_IN6_VAR_H_ */

View File

@ -0,0 +1,56 @@
/* $FreeBSD: src/sys/netinet6/ipcomp.h,v 1.1.2.2 2001/07/03 11:01:54 ume Exp $ */
/* $KAME: ipcomp.h,v 1.8 2000/09/26 07:55:14 itojun Exp $ */
/*
* Copyright (C) 1999 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* RFC2393 IP payload compression protocol (IPComp).
*/
#ifndef _NETINET6_IPCOMP_H_
#define _NETINET6_IPCOMP_H_
#include <sys/appleapiopts.h>
#include <netinet6/ipsec.h>
struct ipcomp {
u_int8_t comp_nxt; /* Next Header */
u_int8_t comp_flags; /* reserved, must be zero */
u_int16_t comp_cpi; /* Compression parameter index */
};
/* well-known algorithm number (in CPI), from RFC2409 */
#define IPCOMP_OUI 1 /* vendor specific */
#define IPCOMP_DEFLATE 2 /* RFC2394 */
#define IPCOMP_LZS 3 /* RFC2395 */
#define IPCOMP_MAX 4
#define IPCOMP_CPI_NEGOTIATE_MIN 256
#endif /* _NETINET6_IPCOMP_H_ */

View File

@ -0,0 +1,151 @@
/* $FreeBSD: src/sys/netinet6/ipsec.h,v 1.4.2.2 2001/07/03 11:01:54 ume Exp $ */
/* $KAME: ipsec.h,v 1.44 2001/03/23 08:08:47 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* IPsec controller part.
*/
#ifndef _NETINET6_IPSEC_H_
#define _NETINET6_IPSEC_H_
#include <sys/cdefs.h>
#include <sys/appleapiopts.h>
#include <net/pfkeyv2.h>
#include <uuid/uuid.h>
/* according to IANA assignment, port 0x0000 and proto 0xff are reserved. */
#define IPSEC_PORT_ANY 0
#define IPSEC_ULPROTO_ANY 255
#define IPSEC_PROTO_ANY 255
/* mode of security protocol */
/* NOTE: DON'T use IPSEC_MODE_ANY at SPD. It's only use in SAD */
#define IPSEC_MODE_ANY 0 /* i.e. wildcard. */
#define IPSEC_MODE_TRANSPORT 1
#define IPSEC_MODE_TUNNEL 2
/*
* Direction of security policy.
* NOTE: Since INVALID is used just as flag.
* The other are used for loop counter too.
*/
#define IPSEC_DIR_ANY 0
#define IPSEC_DIR_INBOUND 1
#define IPSEC_DIR_OUTBOUND 2
#define IPSEC_DIR_MAX 3
#define IPSEC_DIR_INVALID 4
/* Policy level */
/*
* IPSEC, ENTRUST and BYPASS are allowed for setsockopt() in PCB,
* DISCARD, IPSEC and NONE are allowed for setkey() in SPD.
* DISCARD and NONE are allowed for system default.
*/
#define IPSEC_POLICY_DISCARD 0 /* discarding packet */
#define IPSEC_POLICY_NONE 1 /* through IPsec engine */
#define IPSEC_POLICY_IPSEC 2 /* do IPsec */
#define IPSEC_POLICY_ENTRUST 3 /* consulting SPD if present. */
#define IPSEC_POLICY_BYPASS 4 /* only for privileged socket. */
#define IPSEC_POLICY_GENERATE 5 /* same as discard - IKE daemon can override with generated policy */
/* Security protocol level */
#define IPSEC_LEVEL_DEFAULT 0 /* reference to system default */
#define IPSEC_LEVEL_USE 1 /* use SA if present. */
#define IPSEC_LEVEL_REQUIRE 2 /* require SA. */
#define IPSEC_LEVEL_UNIQUE 3 /* unique SA. */
#define IPSEC_MANUAL_REQID_MAX 0x3fff
/*
* if security policy level == unique, this id
* indicate to a relative SA for use, else is
* zero.
* 1 - 0x3fff are reserved for manual keying.
* 0 are reserved for above reason. Others is
* for kernel use.
* Note that this id doesn't identify SA
* by only itself.
*/
#define IPSEC_REPLAYWSIZE 32
/* statistics for ipsec processing */
struct ipsecstat {
u_quad_t in_success __attribute__ ((aligned(8))); /* succeeded inbound process */
u_quad_t in_polvio __attribute__ ((aligned(8)));
/* security policy violation for inbound process */
u_quad_t in_nosa __attribute__ ((aligned(8))); /* inbound SA is unavailable */
u_quad_t in_inval __attribute__ ((aligned(8))); /* inbound processing failed due to EINVAL */
u_quad_t in_nomem __attribute__ ((aligned(8))); /* inbound processing failed due to ENOBUFS */
u_quad_t in_badspi __attribute__ ((aligned(8))); /* failed getting a SPI */
u_quad_t in_ahreplay __attribute__ ((aligned(8))); /* AH replay check failed */
u_quad_t in_espreplay __attribute__ ((aligned(8))); /* ESP replay check failed */
u_quad_t in_ahauthsucc __attribute__ ((aligned(8))); /* AH authentication success */
u_quad_t in_ahauthfail __attribute__ ((aligned(8))); /* AH authentication failure */
u_quad_t in_espauthsucc __attribute__ ((aligned(8))); /* ESP authentication success */
u_quad_t in_espauthfail __attribute__ ((aligned(8))); /* ESP authentication failure */
u_quad_t in_esphist[256] __attribute__ ((aligned(8)));
u_quad_t in_ahhist[256] __attribute__ ((aligned(8)));
u_quad_t in_comphist[256] __attribute__ ((aligned(8)));
u_quad_t out_success __attribute__ ((aligned(8))); /* succeeded outbound process */
u_quad_t out_polvio __attribute__ ((aligned(8)));
/* security policy violation for outbound process */
u_quad_t out_nosa __attribute__ ((aligned(8))); /* outbound SA is unavailable */
u_quad_t out_inval __attribute__ ((aligned(8))); /* outbound process failed due to EINVAL */
u_quad_t out_nomem __attribute__ ((aligned(8))); /* inbound processing failed due to ENOBUFS */
u_quad_t out_noroute __attribute__ ((aligned(8))); /* there is no route */
u_quad_t out_esphist[256] __attribute__ ((aligned(8)));
u_quad_t out_ahhist[256] __attribute__ ((aligned(8)));
u_quad_t out_comphist[256] __attribute__ ((aligned(8)));
};
#define IPSEC_MAX_WAKE_PKT_LEN 100
struct ipsec_wake_pkt_info {
u_int8_t wake_pkt[IPSEC_MAX_WAKE_PKT_LEN];
uuid_string_t wake_uuid;
u_int32_t wake_pkt_spi;
u_int32_t wake_pkt_seq;
u_int16_t wake_pkt_len;
};
struct ipsec_wake_pkt_event_data {
uuid_string_t wake_uuid;
};
__BEGIN_DECLS
extern caddr_t ipsec_set_policy(char *, int);
extern int ipsec_get_policylen(caddr_t);
extern char *ipsec_dump_policy(caddr_t, char *);
extern const char *ipsec_strerror(void);
__END_DECLS
#endif /* _NETINET6_IPSEC_H_ */

View File

@ -0,0 +1,242 @@
/*
* Copyright (c) 2000-2020 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _NETINET6_ND6_H_
#define _NETINET6_ND6_H_
#include <sys/appleapiopts.h>
#include <net/net_kev.h>
/* see net/route.h, or net/if_inarp.h */
#ifndef RTF_ANNOUNCE
#define RTF_ANNOUNCE RTF_PROTO2
#endif
#include <sys/queue.h>
#define ND6_LLINFO_PURGE -3
#define ND6_LLINFO_NOSTATE -2
/*
* We don't need the WAITDELETE state any more, but we keep the definition
* in a comment line instead of removing it. This is necessary to avoid
* unintentionally reusing the value for another purpose, which might
* affect backward compatibility with old applications.
* (20000711 jinmei@kame.net)
*/
/* #define ND6_LLINFO_WAITDELETE -1 */
#define ND6_LLINFO_INCOMPLETE 0
#define ND6_LLINFO_REACHABLE 1
#define ND6_LLINFO_STALE 2
#define ND6_LLINFO_DELAY 3
#define ND6_LLINFO_PROBE 4
struct nd_ifinfo {
u_int32_t linkmtu; /* LinkMTU */
u_int32_t maxmtu; /* Upper bound of LinkMTU */
u_int32_t basereachable; /* BaseReachableTime */
u_int32_t reachable; /* Reachable Time */
u_int32_t retrans; /* Retrans Timer */
u_int32_t flags; /* Flags */
int recalctm; /* BaseReacable re-calculation timer */
u_int8_t chlim; /* CurHopLimit */
u_int8_t receivedra;
/* the following 3 members are for privacy extension for addrconf */
u_int8_t randomseed0[8]; /* upper 64 bits of SHA1 digest */
u_int8_t randomseed1[8]; /* lower 64 bits (usually the EUI64 IFID) */
u_int8_t randomid[8]; /* current random ID */
};
#define ND6_IFF_PERFORMNUD 0x1
#define ND6_IFF_PROXY_PREFIXES 0x20
#define ND6_IFF_IGNORE_NA 0x40
#define ND6_IFF_REPLICATED 0x100 /* sleep proxy registered */
#define ND6_IFF_DAD 0x200 /* Perform DAD on the interface */
extern int dad_enhanced;
#define ND6_DAD_ENHANCED_DEFAULT 1
struct in6_nbrinfo {
char ifname[IFNAMSIZ]; /* if name, e.g. "en0" */
struct in6_addr addr; /* IPv6 address of the neighbor */
long asked; /* # of queries already sent for this addr */
int isrouter; /* if it acts as a router */
int state; /* reachability state */
int expire; /* lifetime for NDP state transition */
};
#define DRLSTSIZ 10
#define PRLSTSIZ 10
struct in6_drlist {
char ifname[IFNAMSIZ];
struct {
struct in6_addr rtaddr;
u_char flags;
u_short rtlifetime;
u_long expire;
u_short if_index;
} defrouter[DRLSTSIZ];
};
/* valid values for stateflags */
#define NDDRF_INSTALLED 0x01 /* installed in the routing table */
#define NDDRF_IFSCOPE 0x02 /* installed as a scoped route */
#define NDDRF_STATIC 0x04 /* for internal use only */
#define NDDRF_MAPPED 0x08 /* Default router addr is mapped to a different one for routing */
#define NDDRF_INELIGIBLE 0x10 /* Default router entry is ineligible for default router selection */
struct in6_defrouter {
struct sockaddr_in6 rtaddr;
u_char flags;
u_char stateflags;
u_short rtlifetime;
u_long expire;
u_short if_index;
};
struct in6_prlist {
char ifname[IFNAMSIZ];
struct {
struct in6_addr prefix;
struct prf_ra raflags;
u_char prefixlen;
u_char origin;
u_long vltime;
u_long pltime;
u_long expire;
u_short if_index;
u_short advrtrs; /* number of advertisement routers */
struct in6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */
} prefix[PRLSTSIZ];
};
struct in6_prefix {
struct sockaddr_in6 prefix;
struct prf_ra raflags;
u_char prefixlen;
u_char origin;
u_long vltime;
u_long pltime;
u_long expire;
u_int32_t flags;
int refcnt;
u_short if_index;
u_short advrtrs; /* number of advertisement routers */
/* struct sockaddr_in6 advrtr[] */
};
struct in6_ondireq {
char ifname[IFNAMSIZ];
struct {
u_int32_t linkmtu; /* LinkMTU */
u_int32_t maxmtu; /* Upper bound of LinkMTU */
u_int32_t basereachable; /* BaseReachableTime */
u_int32_t reachable; /* Reachable Time */
u_int32_t retrans; /* Retrans Timer */
u_int32_t flags; /* Flags */
int recalctm; /* BaseReacable re-calculation timer */
u_int8_t chlim; /* CurHopLimit */
/* Number of routers learned on the interface */
u_int8_t receivedra;
/*
* The current collision count value
* being used for secure address generation.
*/
u_int8_t collision_count;
} ndi;
};
struct in6_ndireq {
char ifname[IFNAMSIZ];
struct nd_ifinfo ndi;
};
struct in6_ndifreq {
char ifname[IFNAMSIZ];
u_long ifindex;
};
#define MAX_RTR_SOLICITATION_DELAY 1 /* 1sec */
#define RTR_SOLICITATION_INTERVAL 4 /* 4sec */
/* Prefix status */
#define NDPRF_ONLINK 0x1
#define NDPRF_DETACHED 0x2
#define NDPRF_STATIC 0x100
#define NDPRF_IFSCOPE 0x1000
#define NDPRF_PRPROXY 0x2000
/* protocol constants */
#define MAX_RTR_SOLICITATION_DELAY 1 /* 1sec */
#define RTR_SOLICITATION_INTERVAL 4 /* 4sec */
#define MAX_RTR_SOLICITATIONS 3
#define ND6_INFINITE_LIFETIME 0xffffffff
#define ND6_MAX_LIFETIME 0x7fffffff
/* nd6_send.c */
#endif /* _NETINET6_ND6_H_ */

View File

@ -0,0 +1,79 @@
/*
* Copyright (c) 2008-2013 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/* $FreeBSD: src/sys/netinet6/raw_ip6.h,v 1.1.2.1 2001/07/03 11:01:55 ume Exp $ */
/* $KAME: raw_ip6.h,v 1.2 2001/05/27 13:28:35 itojun Exp $ */
/*
* Copyright (C) 2001 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _NETINET6_RAW_IP6_H_
#define _NETINET6_RAW_IP6_H_
#include <sys/appleapiopts.h>
/*
* ICMPv6 stat is counted separately. see netinet/icmp6.h
*/
struct rip6stat {
u_quad_t rip6s_ipackets; /* total input packets */
u_quad_t rip6s_isum; /* input checksum computations */
u_quad_t rip6s_badsum; /* of above, checksum error */
u_quad_t rip6s_nosock; /* no matching socket */
u_quad_t rip6s_nosockmcast; /* of above, arrived as multicast */
u_quad_t rip6s_fullsock; /* not delivered, input socket full */
u_quad_t rip6s_opackets; /* total output packets */
};
#endif /* _NETINET6_RAW_IP6_H_ */

View File

@ -0,0 +1,68 @@
/*
* Copyright (c) 2009-2015 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (C) 2000 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _NETINET6_SCOPE6_VAR_H_
#define _NETINET6_SCOPE6_VAR_H_
#include <sys/appleapiopts.h>
/*
* 16 is correspondent to 4bit multicast scope field.
* i.e. from node-local to global with some reserved/unassigned types.
*/
#define SCOPE6_ID_MAX 16
#endif /* _NETINET6_SCOPE6_VAR_H_ */

View File

@ -0,0 +1 @@
#include <objc/runtime.h>

View File

@ -0,0 +1,151 @@
/*
* Copyright (c) 2000-2004, 2012-2016 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*!
* @header kern_control.h
* This header defines an API to communicate between a kernel
* extension and a process outside of the kernel.
*/
#ifndef KPI_KERN_CONTROL_H
#define KPI_KERN_CONTROL_H
#include <sys/appleapiopts.h>
#include <sys/_types/_u_char.h>
#include <sys/_types/_u_int16_t.h>
#include <sys/_types/_u_int32_t.h>
/*
* Define Controller event subclass, and associated events.
* Subclass of KEV_SYSTEM_CLASS
*/
/*!
* @defined KEV_CTL_SUBCLASS
* @discussion The kernel event subclass for kernel control events.
*/
#define KEV_CTL_SUBCLASS 2
/*!
* @defined KEV_CTL_REGISTERED
* @discussion The event code indicating a new controller was
* registered. The data portion will contain a ctl_event_data.
*/
#define KEV_CTL_REGISTERED 1 /* a new controller appears */
/*!
* @defined KEV_CTL_DEREGISTERED
* @discussion The event code indicating a controller was unregistered.
* The data portion will contain a ctl_event_data.
*/
#define KEV_CTL_DEREGISTERED 2 /* a controller disappears */
/*!
* @struct ctl_event_data
* @discussion This structure is used for KEV_CTL_SUBCLASS kernel
* events.
* @field ctl_id The kernel control id.
* @field ctl_unit The kernel control unit.
*/
struct ctl_event_data {
u_int32_t ctl_id; /* Kernel Controller ID */
u_int32_t ctl_unit;
};
/*
* Controls destined to the Controller Manager.
*/
/*!
* @defined CTLIOCGCOUNT
* @discussion The CTLIOCGCOUNT ioctl can be used to determine the
* number of kernel controllers registered.
*/
#define CTLIOCGCOUNT _IOR('N', 2, int) /* get number of control structures registered */
/*!
* @defined CTLIOCGINFO
* @discussion The CTLIOCGINFO ioctl can be used to convert a kernel
* control name to a kernel control id.
*/
#define CTLIOCGINFO _IOWR('N', 3, struct ctl_info) /* get id from name */
/*!
* @defined MAX_KCTL_NAME
* @discussion Kernel control names must be no longer than
* MAX_KCTL_NAME.
*/
#define MAX_KCTL_NAME 96
/*
* Controls destined to the Controller Manager.
*/
/*!
* @struct ctl_info
* @discussion This structure is used with the CTLIOCGINFO ioctl to
* translate from a kernel control name to a control id.
* @field ctl_id The kernel control id, filled out upon return.
* @field ctl_name The kernel control name to find.
*/
struct ctl_info {
u_int32_t ctl_id; /* Kernel Controller ID */
char ctl_name[MAX_KCTL_NAME]; /* Kernel Controller Name (a C string) */
};
/*!
* @struct sockaddr_ctl
* @discussion The controller address structure is used to establish
* contact between a user client and a kernel controller. The
* sc_id/sc_unit uniquely identify each controller. sc_id is a
* unique identifier assigned to the controller. The identifier can
* be assigned by the system at registration time or be a 32-bit
* creator code obtained from Apple Computer. sc_unit is a unit
* number for this sc_id, and is privately used by the kernel
* controller to identify several instances of the controller.
* @field sc_len The length of the structure.
* @field sc_family AF_SYSTEM.
* @field ss_sysaddr AF_SYS_KERNCONTROL.
* @field sc_id Controller unique identifier.
* @field sc_unit Kernel controller private unit number.
* @field sc_reserved Reserved, must be set to zero.
*/
struct sockaddr_ctl {
u_char sc_len; /* depends on size of bundle ID string */
u_char sc_family; /* AF_SYSTEM */
u_int16_t ss_sysaddr; /* AF_SYS_KERNCONTROL */
u_int32_t sc_id; /* Controller unique identifier */
u_int32_t sc_unit; /* Developer private unit number */
u_int32_t sc_reserved[5];
};
#endif /* KPI_KERN_CONTROL_H */

View File

@ -0,0 +1,238 @@
/*
* Copyright (c) 2000-2014 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/* Copyright (c) 1998, 1999 Apple Computer, Inc. All Rights Reserved */
/*!
* @header kern_event.h
* This header defines in-kernel functions for generating kernel events as
* well as functions for receiving kernel events using a kernel event
* socket.
*/
#ifndef SYS_KERN_EVENT_H
#define SYS_KERN_EVENT_H
#include <sys/appleapiopts.h>
#include <sys/ioccom.h>
#include <sys/sys_domain.h>
#define KEV_SNDSPACE (4 * 1024)
#define KEV_RECVSPACE (32 * 1024)
#define KEV_ANY_VENDOR 0
#define KEV_ANY_CLASS 0
#define KEV_ANY_SUBCLASS 0
/*
* Vendor Code
*/
/*!
* @defined KEV_VENDOR_APPLE
* @discussion Apple generated kernel events use the hard coded vendor code
* value of 1. Third party kernel events use a dynamically allocated vendor
* code. The vendor code can be found using the SIOCGKEVVENDOR ioctl.
*/
#define KEV_VENDOR_APPLE 1
/*
* Definition of top-level classifications for KEV_VENDOR_APPLE
*/
/*!
* @defined KEV_NETWORK_CLASS
* @discussion Network kernel event class.
*/
#define KEV_NETWORK_CLASS 1
/*!
* @defined KEV_IOKIT_CLASS
* @discussion IOKit kernel event class.
*/
#define KEV_IOKIT_CLASS 2
/*!
* @defined KEV_SYSTEM_CLASS
* @discussion System kernel event class.
*/
#define KEV_SYSTEM_CLASS 3
/*!
* @defined KEV_APPLESHARE_CLASS
* @discussion AppleShare kernel event class.
*/
#define KEV_APPLESHARE_CLASS 4
/*!
* @defined KEV_FIREWALL_CLASS
* @discussion Firewall kernel event class.
*/
#define KEV_FIREWALL_CLASS 5
/*!
* @defined KEV_IEEE80211_CLASS
* @discussion IEEE 802.11 kernel event class.
*/
#define KEV_IEEE80211_CLASS 6
/*
* The following struct is KPI, but it was originally defined with a trailing
* array member of size one, intended to be used as a Variable-Length Array.
* That's problematic because the compiler doesn't know that the array is
* accessed out-of-bounds and can assume it isn't. This makes
* -Warray-bounds-pointer-arithmetic sad. We can't just change the code because
* it requires users to also change their uses of the class, at a minimum
* because kern_event_msg's size changes when making the last member a VLA. This
* macro allows users of this KPI to opt-in to the new behavior.
*/
#if defined(XNU_KERN_EVENT_DATA_IS_VLA)
#define XNU_KERN_EVENT_DATA_SIZE /* nothing, it's a VLA */
#else
#define XNU_KERN_EVENT_DATA_SIZE 1
#endif
/*!
* @struct kern_event_msg
* @discussion This structure is prepended to all kernel events. This
* structure is used to determine the format of the remainder of
* the kernel event. This structure will appear on all messages
* received on a kernel event socket. To post a kernel event, a
* slightly different structure is used.
* @field total_size Total size of the kernel event message including the
* header.
* @field vendor_code The vendor code indicates which vendor generated the
* kernel event. This gives every vendor a unique set of classes
* and subclasses to use. Use the SIOCGKEVVENDOR ioctl to look up
* vendor codes for vendors other than Apple. Apple uses
* KEV_VENDOR_APPLE.
* @field kev_class The class of the kernel event.
* @field kev_subclass The subclass of the kernel event.
* @field id Monotonically increasing value.
* @field event_code The event code.
* @field event_data Any additional data about this event. Format will
* depend on the vendor_code, kev_class, kev_subclass, and
* event_code. The length of the event_data can be determined
* using total_size - KEV_MSG_HEADER_SIZE.
*/
struct kern_event_msg {
u_int32_t total_size; /* Size of entire event msg */
u_int32_t vendor_code; /* For non-Apple extensibility */
u_int32_t kev_class; /* Layer of event source */
u_int32_t kev_subclass; /* Component within layer */
u_int32_t id; /* Monotonically increasing value */
u_int32_t event_code; /* unique code */
u_int32_t event_data[XNU_KERN_EVENT_DATA_SIZE]; /* One or more data words */
};
/*!
* @defined KEV_MSG_HEADER_SIZE
* @discussion Size of the header portion of the kern_event_msg structure.
* This accounts for everything right up to event_data. The size
* of the data can be found by subtracting KEV_MSG_HEADER_SIZE
* from the total size from the kern_event_msg.
*/
#define KEV_MSG_HEADER_SIZE (offsetof(struct kern_event_msg, event_data[0]))
/*!
* @struct kev_request
* @discussion This structure is used with the SIOCSKEVFILT and
* SIOCGKEVFILT to set and get the control filter setting for a
* kernel control socket.
* @field total_size Total size of the kernel event message including the
* header.
* @field vendor_code All kernel events that don't match this vendor code
* will be ignored. KEV_ANY_VENDOR can be used to receive kernel
* events with any vendor code.
* @field kev_class All kernel events that don't match this class will be
* ignored. KEV_ANY_CLASS can be used to receive kernel events with
* any class.
* @field kev_subclass All kernel events that don't match this subclass
* will be ignored. KEV_ANY_SUBCLASS can be used to receive kernel
* events with any subclass.
*/
struct kev_request {
u_int32_t vendor_code;
u_int32_t kev_class;
u_int32_t kev_subclass;
};
/*!
* @defined KEV_VENDOR_CODE_MAX_STR_LEN
* @discussion This define sets the maximum length of a string that can be
* used to identify a vendor or kext when looking up a vendor code.
*/
#define KEV_VENDOR_CODE_MAX_STR_LEN 200
/*!
* @struct kev_vendor_code
* @discussion This structure is used with the SIOCGKEVVENDOR ioctl to
* convert from a string identifying a kext or vendor, in the
* form of a bundle identifier, to a vendor code.
* @field vendor_code After making the SIOCGKEVVENDOR ioctl call, this will
* be filled in with the vendor code if there is one.
* @field vendor_string A bundle style identifier.
*/
#pragma pack(4)
struct kev_vendor_code {
u_int32_t vendor_code;
char vendor_string[KEV_VENDOR_CODE_MAX_STR_LEN];
};
#pragma pack()
/*!
* @defined SIOCGKEVID
* @discussion Retrieve the current event id. Each event generated will
* have a new id. The next event to be generated will have an id
* of id+1.
*/
#define SIOCGKEVID _IOR('e', 1, u_int32_t)
/*!
* @defined SIOCSKEVFILT
* @discussion Set the kernel event filter for this socket. Kernel events
* not matching this filter will not be received on this socket.
*/
#define SIOCSKEVFILT _IOW('e', 2, struct kev_request)
/*!
* @defined SIOCGKEVFILT
* @discussion Retrieve the kernel event filter for this socket. Kernel
* events not matching this filter will not be received on this
* socket.
*/
#define SIOCGKEVFILT _IOR('e', 3, struct kev_request)
/*!
* @defined SIOCGKEVVENDOR
* @discussion Lookup the vendor code for the specified vendor. ENOENT will
* be returned if a vendor code for that vendor string does not
* exist.
*/
#define SIOCGKEVVENDOR _IOWR('e', 4, struct kev_vendor_code)
#endif /* SYS_KERN_EVENT_H */

View File

@ -0,0 +1,799 @@
/*
* Copyright (c) 2005-2020 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _SYS_PROC_INFO_H
#define _SYS_PROC_INFO_H
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/kern_control.h>
#include <sys/event.h>
#include <net/if.h>
#include <net/route.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <mach/machine.h>
#include <uuid/uuid.h>
__BEGIN_DECLS
#define PROC_ALL_PIDS 1
#define PROC_PGRP_ONLY 2
#define PROC_TTY_ONLY 3
#define PROC_UID_ONLY 4
#define PROC_RUID_ONLY 5
#define PROC_PPID_ONLY 6
#define PROC_KDBG_ONLY 7
struct proc_bsdinfo {
uint32_t pbi_flags; /* 64bit; emulated etc */
uint32_t pbi_status;
uint32_t pbi_xstatus;
uint32_t pbi_pid;
uint32_t pbi_ppid;
uid_t pbi_uid;
gid_t pbi_gid;
uid_t pbi_ruid;
gid_t pbi_rgid;
uid_t pbi_svuid;
gid_t pbi_svgid;
uint32_t rfu_1; /* reserved */
char pbi_comm[MAXCOMLEN];
char pbi_name[2 * MAXCOMLEN]; /* empty if no name is registered */
uint32_t pbi_nfiles;
uint32_t pbi_pgid;
uint32_t pbi_pjobc;
uint32_t e_tdev; /* controlling tty dev */
uint32_t e_tpgid; /* tty process group id */
int32_t pbi_nice;
uint64_t pbi_start_tvsec;
uint64_t pbi_start_tvusec;
};
struct proc_bsdshortinfo {
uint32_t pbsi_pid; /* process id */
uint32_t pbsi_ppid; /* process parent id */
uint32_t pbsi_pgid; /* process perp id */
uint32_t pbsi_status; /* p_stat value, SZOMB, SRUN, etc */
char pbsi_comm[MAXCOMLEN]; /* upto 16 characters of process name */
uint32_t pbsi_flags; /* 64bit; emulated etc */
uid_t pbsi_uid; /* current uid on process */
gid_t pbsi_gid; /* current gid on process */
uid_t pbsi_ruid; /* current ruid on process */
gid_t pbsi_rgid; /* current tgid on process */
uid_t pbsi_svuid; /* current svuid on process */
gid_t pbsi_svgid; /* current svgid on process */
uint32_t pbsi_rfu; /* reserved for future use*/
};
/* pbi_flags values */
#define PROC_FLAG_SYSTEM 1 /* System process */
#define PROC_FLAG_TRACED 2 /* process currently being traced, possibly by gdb */
#define PROC_FLAG_INEXIT 4 /* process is working its way in exit() */
#define PROC_FLAG_PPWAIT 8
#define PROC_FLAG_LP64 0x10 /* 64bit process */
#define PROC_FLAG_SLEADER 0x20 /* The process is the session leader */
#define PROC_FLAG_CTTY 0x40 /* process has a control tty */
#define PROC_FLAG_CONTROLT 0x80 /* Has a controlling terminal */
#define PROC_FLAG_THCWD 0x100 /* process has a thread with cwd */
/* process control bits for resource starvation */
#define PROC_FLAG_PC_THROTTLE 0x200 /* In resource starvation situations, this process is to be throttled */
#define PROC_FLAG_PC_SUSP 0x400 /* In resource starvation situations, this process is to be suspended */
#define PROC_FLAG_PC_KILL 0x600 /* In resource starvation situations, this process is to be terminated */
#define PROC_FLAG_PC_MASK 0x600
/* process action bits for resource starvation */
#define PROC_FLAG_PA_THROTTLE 0x800 /* The process is currently throttled due to resource starvation */
#define PROC_FLAG_PA_SUSP 0x1000 /* The process is currently suspended due to resource starvation */
#define PROC_FLAG_PSUGID 0x2000 /* process has set privileges since last exec */
#define PROC_FLAG_EXEC 0x4000 /* process has called exec */
struct proc_taskinfo {
uint64_t pti_virtual_size; /* virtual memory size (bytes) */
uint64_t pti_resident_size; /* resident memory size (bytes) */
uint64_t pti_total_user; /* total time */
uint64_t pti_total_system;
uint64_t pti_threads_user; /* existing threads only */
uint64_t pti_threads_system;
int32_t pti_policy; /* default policy for new threads */
int32_t pti_faults; /* number of page faults */
int32_t pti_pageins; /* number of actual pageins */
int32_t pti_cow_faults; /* number of copy-on-write faults */
int32_t pti_messages_sent; /* number of messages sent */
int32_t pti_messages_received; /* number of messages received */
int32_t pti_syscalls_mach; /* number of mach system calls */
int32_t pti_syscalls_unix; /* number of unix system calls */
int32_t pti_csw; /* number of context switches */
int32_t pti_threadnum; /* number of threads in the task */
int32_t pti_numrunning; /* number of running threads */
int32_t pti_priority; /* task priority*/
};
struct proc_taskallinfo {
struct proc_bsdinfo pbsd;
struct proc_taskinfo ptinfo;
};
#define MAXTHREADNAMESIZE 64
struct proc_threadinfo {
uint64_t pth_user_time; /* user run time */
uint64_t pth_system_time; /* system run time */
int32_t pth_cpu_usage; /* scaled cpu usage percentage */
int32_t pth_policy; /* scheduling policy in effect */
int32_t pth_run_state; /* run state (see below) */
int32_t pth_flags; /* various flags (see below) */
int32_t pth_sleep_time; /* number of seconds that thread */
int32_t pth_curpri; /* cur priority*/
int32_t pth_priority; /* priority*/
int32_t pth_maxpriority; /* max priority*/
char pth_name[MAXTHREADNAMESIZE]; /* thread name, if any */
};
struct proc_regioninfo {
uint32_t pri_protection;
uint32_t pri_max_protection;
uint32_t pri_inheritance;
uint32_t pri_flags; /* shared, external pager, is submap */
uint64_t pri_offset;
uint32_t pri_behavior;
uint32_t pri_user_wired_count;
uint32_t pri_user_tag;
uint32_t pri_pages_resident;
uint32_t pri_pages_shared_now_private;
uint32_t pri_pages_swapped_out;
uint32_t pri_pages_dirtied;
uint32_t pri_ref_count;
uint32_t pri_shadow_depth;
uint32_t pri_share_mode;
uint32_t pri_private_pages_resident;
uint32_t pri_shared_pages_resident;
uint32_t pri_obj_id;
uint32_t pri_depth;
uint64_t pri_address;
uint64_t pri_size;
};
#define PROC_REGION_SUBMAP 1
#define PROC_REGION_SHARED 2
#define SM_COW 1
#define SM_PRIVATE 2
#define SM_EMPTY 3
#define SM_SHARED 4
#define SM_TRUESHARED 5
#define SM_PRIVATE_ALIASED 6
#define SM_SHARED_ALIASED 7
#define SM_LARGE_PAGE 8
/*
* Thread run states (state field).
*/
#define TH_STATE_RUNNING 1 /* thread is running normally */
#define TH_STATE_STOPPED 2 /* thread is stopped */
#define TH_STATE_WAITING 3 /* thread is waiting normally */
#define TH_STATE_UNINTERRUPTIBLE 4 /* thread is in an uninterruptible
* wait */
#define TH_STATE_HALTED 5 /* thread is halted at a
* clean point */
/*
* Thread flags (flags field).
*/
#define TH_FLAGS_SWAPPED 0x1 /* thread is swapped out */
#define TH_FLAGS_IDLE 0x2 /* thread is an idle thread */
struct proc_workqueueinfo {
uint32_t pwq_nthreads; /* total number of workqueue threads */
uint32_t pwq_runthreads; /* total number of running workqueue threads */
uint32_t pwq_blockedthreads; /* total number of blocked workqueue threads */
uint32_t pwq_state;
};
/*
* workqueue state (pwq_state field)
*/
#define WQ_EXCEEDED_CONSTRAINED_THREAD_LIMIT 0x1
#define WQ_EXCEEDED_TOTAL_THREAD_LIMIT 0x2
#define WQ_FLAGS_AVAILABLE 0x4
struct proc_fileinfo {
uint32_t fi_openflags;
uint32_t fi_status;
off_t fi_offset;
int32_t fi_type;
uint32_t fi_guardflags;
};
/* stats flags in proc_fileinfo */
#define PROC_FP_SHARED 1 /* shared by more than one fd */
#define PROC_FP_CLEXEC 2 /* close on exec */
#define PROC_FP_GUARDED 4 /* guarded fd */
#define PROC_FP_CLFORK 8 /* close on fork */
#define PROC_FI_GUARD_CLOSE (1u << 0)
#define PROC_FI_GUARD_DUP (1u << 1)
#define PROC_FI_GUARD_SOCKET_IPC (1u << 2)
#define PROC_FI_GUARD_FILEPORT (1u << 3)
struct proc_exitreasonbasicinfo {
uint32_t beri_namespace;
uint64_t beri_code;
uint64_t beri_flags;
uint32_t beri_reason_buf_size;
} __attribute__((packed));
struct proc_exitreasoninfo {
uint32_t eri_namespace;
uint64_t eri_code;
uint64_t eri_flags;
uint32_t eri_reason_buf_size;
uint64_t eri_kcd_buf;
} __attribute__((packed));
/*
* A copy of stat64 with static sized fields.
*/
struct vinfo_stat {
uint32_t vst_dev; /* [XSI] ID of device containing file */
uint16_t vst_mode; /* [XSI] Mode of file (see below) */
uint16_t vst_nlink; /* [XSI] Number of hard links */
uint64_t vst_ino; /* [XSI] File serial number */
uid_t vst_uid; /* [XSI] User ID of the file */
gid_t vst_gid; /* [XSI] Group ID of the file */
int64_t vst_atime; /* [XSI] Time of last access */
int64_t vst_atimensec; /* nsec of last access */
int64_t vst_mtime; /* [XSI] Last data modification time */
int64_t vst_mtimensec; /* last data modification nsec */
int64_t vst_ctime; /* [XSI] Time of last status change */
int64_t vst_ctimensec; /* nsec of last status change */
int64_t vst_birthtime; /* File creation time(birth) */
int64_t vst_birthtimensec; /* nsec of File creation time */
off_t vst_size; /* [XSI] file size, in bytes */
int64_t vst_blocks; /* [XSI] blocks allocated for file */
int32_t vst_blksize; /* [XSI] optimal blocksize for I/O */
uint32_t vst_flags; /* user defined flags for file */
uint32_t vst_gen; /* file generation number */
uint32_t vst_rdev; /* [XSI] Device ID */
int64_t vst_qspare[2]; /* RESERVED: DO NOT USE! */
};
struct vnode_info {
struct vinfo_stat vi_stat;
int vi_type;
int vi_pad;
fsid_t vi_fsid;
};
struct vnode_info_path {
struct vnode_info vip_vi;
char vip_path[MAXPATHLEN]; /* tail end of it */
};
struct vnode_fdinfo {
struct proc_fileinfo pfi;
struct vnode_info pvi;
};
struct vnode_fdinfowithpath {
struct proc_fileinfo pfi;
struct vnode_info_path pvip;
};
struct proc_regionwithpathinfo {
struct proc_regioninfo prp_prinfo;
struct vnode_info_path prp_vip;
};
struct proc_regionpath {
uint64_t prpo_addr;
uint64_t prpo_regionlength;
char prpo_path[MAXPATHLEN];
};
struct proc_vnodepathinfo {
struct vnode_info_path pvi_cdir;
struct vnode_info_path pvi_rdir;
};
struct proc_threadwithpathinfo {
struct proc_threadinfo pt;
struct vnode_info_path pvip;
};
/*
* Socket
*/
/*
* IPv4 and IPv6 Sockets
*/
#define INI_IPV4 0x1
#define INI_IPV6 0x2
struct in4in6_addr {
u_int32_t i46a_pad32[3];
struct in_addr i46a_addr4;
};
struct in_sockinfo {
int insi_fport; /* foreign port */
int insi_lport; /* local port */
uint64_t insi_gencnt; /* generation count of this instance */
uint32_t insi_flags; /* generic IP/datagram flags */
uint32_t insi_flow;
uint8_t insi_vflag; /* ini_IPV4 or ini_IPV6 */
uint8_t insi_ip_ttl; /* time to live proto */
uint32_t rfu_1; /* reserved */
/* protocol dependent part */
union {
struct in4in6_addr ina_46;
struct in6_addr ina_6;
} insi_faddr; /* foreign host table entry */
union {
struct in4in6_addr ina_46;
struct in6_addr ina_6;
} insi_laddr; /* local host table entry */
struct {
u_char in4_tos; /* type of service */
} insi_v4;
struct {
uint8_t in6_hlim;
int in6_cksum;
u_short in6_ifindex;
short in6_hops;
} insi_v6;
};
/*
* TCP Sockets
*/
#define TSI_T_REXMT 0 /* retransmit */
#define TSI_T_PERSIST 1 /* retransmit persistence */
#define TSI_T_KEEP 2 /* keep alive */
#define TSI_T_2MSL 3 /* 2*msl quiet time timer */
#define TSI_T_NTIMERS 4
#define TSI_S_CLOSED 0 /* closed */
#define TSI_S_LISTEN 1 /* listening for connection */
#define TSI_S_SYN_SENT 2 /* active, have sent syn */
#define TSI_S_SYN_RECEIVED 3 /* have send and received syn */
#define TSI_S_ESTABLISHED 4 /* established */
#define TSI_S__CLOSE_WAIT 5 /* rcvd fin, waiting for close */
#define TSI_S_FIN_WAIT_1 6 /* have closed, sent fin */
#define TSI_S_CLOSING 7 /* closed xchd FIN; await FIN ACK */
#define TSI_S_LAST_ACK 8 /* had fin and close; await FIN ACK */
#define TSI_S_FIN_WAIT_2 9 /* have closed, fin is acked */
#define TSI_S_TIME_WAIT 10 /* in 2*msl quiet wait after close */
#define TSI_S_RESERVED 11 /* pseudo state: reserved */
struct tcp_sockinfo {
struct in_sockinfo tcpsi_ini;
int tcpsi_state;
int tcpsi_timer[TSI_T_NTIMERS];
int tcpsi_mss;
uint32_t tcpsi_flags;
uint32_t rfu_1; /* reserved */
uint64_t tcpsi_tp; /* opaque handle of TCP protocol control block */
};
/*
* Unix Domain Sockets
*/
struct un_sockinfo {
uint64_t unsi_conn_so; /* opaque handle of connected socket */
uint64_t unsi_conn_pcb; /* opaque handle of connected protocol control block */
union {
struct sockaddr_un ua_sun;
char ua_dummy[SOCK_MAXADDRLEN];
} unsi_addr; /* bound address */
union {
struct sockaddr_un ua_sun;
char ua_dummy[SOCK_MAXADDRLEN];
} unsi_caddr; /* address of socket connected to */
};
/*
* PF_NDRV Sockets
*/
struct ndrv_info {
uint32_t ndrvsi_if_family;
uint32_t ndrvsi_if_unit;
char ndrvsi_if_name[IF_NAMESIZE];
};
/*
* Kernel Event Sockets
*/
struct kern_event_info {
uint32_t kesi_vendor_code_filter;
uint32_t kesi_class_filter;
uint32_t kesi_subclass_filter;
};
/*
* Kernel Control Sockets
*/
struct kern_ctl_info {
uint32_t kcsi_id;
uint32_t kcsi_reg_unit;
uint32_t kcsi_flags; /* support flags */
uint32_t kcsi_recvbufsize; /* request more than the default buffer size */
uint32_t kcsi_sendbufsize; /* request more than the default buffer size */
uint32_t kcsi_unit;
char kcsi_name[MAX_KCTL_NAME]; /* unique nke identifier, provided by DTS */
};
/*
* VSock Sockets
*/
struct vsock_sockinfo {
uint32_t local_cid;
uint32_t local_port;
uint32_t remote_cid;
uint32_t remote_port;
};
/* soi_state */
#define SOI_S_NOFDREF 0x0001 /* no file table ref any more */
#define SOI_S_ISCONNECTED 0x0002 /* socket connected to a peer */
#define SOI_S_ISCONNECTING 0x0004 /* in process of connecting to peer */
#define SOI_S_ISDISCONNECTING 0x0008 /* in process of disconnecting */
#define SOI_S_CANTSENDMORE 0x0010 /* can't send more data to peer */
#define SOI_S_CANTRCVMORE 0x0020 /* can't receive more data from peer */
#define SOI_S_RCVATMARK 0x0040 /* at mark on input */
#define SOI_S_PRIV 0x0080 /* privileged for broadcast, raw... */
#define SOI_S_NBIO 0x0100 /* non-blocking ops */
#define SOI_S_ASYNC 0x0200 /* async i/o notify */
#define SOI_S_INCOMP 0x0800 /* Unaccepted, incomplete connection */
#define SOI_S_COMP 0x1000 /* unaccepted, complete connection */
#define SOI_S_ISDISCONNECTED 0x2000 /* socket disconnected from peer */
#define SOI_S_DRAINING 0x4000 /* close waiting for blocked system calls to drain */
struct sockbuf_info {
uint32_t sbi_cc;
uint32_t sbi_hiwat; /* SO_RCVBUF, SO_SNDBUF */
uint32_t sbi_mbcnt;
uint32_t sbi_mbmax;
uint32_t sbi_lowat;
short sbi_flags;
short sbi_timeo;
};
enum {
SOCKINFO_GENERIC = 0,
SOCKINFO_IN = 1,
SOCKINFO_TCP = 2,
SOCKINFO_UN = 3,
SOCKINFO_NDRV = 4,
SOCKINFO_KERN_EVENT = 5,
SOCKINFO_KERN_CTL = 6,
SOCKINFO_VSOCK = 7,
};
struct socket_info {
struct vinfo_stat soi_stat;
uint64_t soi_so; /* opaque handle of socket */
uint64_t soi_pcb; /* opaque handle of protocol control block */
int soi_type;
int soi_protocol;
int soi_family;
short soi_options;
short soi_linger;
short soi_state;
short soi_qlen;
short soi_incqlen;
short soi_qlimit;
short soi_timeo;
u_short soi_error;
uint32_t soi_oobmark;
struct sockbuf_info soi_rcv;
struct sockbuf_info soi_snd;
int soi_kind;
uint32_t rfu_1; /* reserved */
union {
struct in_sockinfo pri_in; /* SOCKINFO_IN */
struct tcp_sockinfo pri_tcp; /* SOCKINFO_TCP */
struct un_sockinfo pri_un; /* SOCKINFO_UN */
struct ndrv_info pri_ndrv; /* SOCKINFO_NDRV */
struct kern_event_info pri_kern_event; /* SOCKINFO_KERN_EVENT */
struct kern_ctl_info pri_kern_ctl; /* SOCKINFO_KERN_CTL */
struct vsock_sockinfo pri_vsock; /* SOCKINFO_VSOCK */
} soi_proto;
};
struct socket_fdinfo {
struct proc_fileinfo pfi;
struct socket_info psi;
};
struct psem_info {
struct vinfo_stat psem_stat;
char psem_name[MAXPATHLEN];
};
struct psem_fdinfo {
struct proc_fileinfo pfi;
struct psem_info pseminfo;
};
struct pshm_info {
struct vinfo_stat pshm_stat;
uint64_t pshm_mappaddr;
char pshm_name[MAXPATHLEN];
};
struct pshm_fdinfo {
struct proc_fileinfo pfi;
struct pshm_info pshminfo;
};
struct pipe_info {
struct vinfo_stat pipe_stat;
uint64_t pipe_handle;
uint64_t pipe_peerhandle;
int pipe_status;
int rfu_1; /* reserved */
};
struct pipe_fdinfo {
struct proc_fileinfo pfi;
struct pipe_info pipeinfo;
};
struct kqueue_info {
struct vinfo_stat kq_stat;
uint32_t kq_state;
uint32_t rfu_1; /* reserved */
};
struct kqueue_dyninfo {
struct kqueue_info kqdi_info;
uint64_t kqdi_servicer;
uint64_t kqdi_owner;
uint32_t kqdi_sync_waiters;
uint8_t kqdi_sync_waiter_qos;
uint8_t kqdi_async_qos;
uint16_t kqdi_request_state;
uint8_t kqdi_events_qos;
uint8_t kqdi_pri;
uint8_t kqdi_pol;
uint8_t kqdi_cpupercent;
uint8_t _kqdi_reserved0[4];
uint64_t _kqdi_reserved1[4];
};
/* keep in sync with KQ_* in sys/eventvar.h */
#define PROC_KQUEUE_SELECT 0x01
#define PROC_KQUEUE_SLEEP 0x02
#define PROC_KQUEUE_32 0x08
#define PROC_KQUEUE_64 0x10
#define PROC_KQUEUE_QOS 0x20
struct kqueue_fdinfo {
struct proc_fileinfo pfi;
struct kqueue_info kqueueinfo;
};
struct appletalk_info {
struct vinfo_stat atalk_stat;
};
struct appletalk_fdinfo {
struct proc_fileinfo pfi;
struct appletalk_info appletalkinfo;
};
typedef uint64_t proc_info_udata_t;
/* defns of process file desc type */
#define PROX_FDTYPE_ATALK 0
#define PROX_FDTYPE_VNODE 1
#define PROX_FDTYPE_SOCKET 2
#define PROX_FDTYPE_PSHM 3
#define PROX_FDTYPE_PSEM 4
#define PROX_FDTYPE_KQUEUE 5
#define PROX_FDTYPE_PIPE 6
#define PROX_FDTYPE_FSEVENTS 7
#define PROX_FDTYPE_NETPOLICY 9
struct proc_fdinfo {
int32_t proc_fd;
uint32_t proc_fdtype;
};
struct proc_fileportinfo {
uint32_t proc_fileport;
uint32_t proc_fdtype;
};
/* Flavors for proc_pidinfo() */
#define PROC_PIDLISTFDS 1
#define PROC_PIDLISTFD_SIZE (sizeof(struct proc_fdinfo))
#define PROC_PIDTASKALLINFO 2
#define PROC_PIDTASKALLINFO_SIZE (sizeof(struct proc_taskallinfo))
#define PROC_PIDTBSDINFO 3
#define PROC_PIDTBSDINFO_SIZE (sizeof(struct proc_bsdinfo))
#define PROC_PIDTASKINFO 4
#define PROC_PIDTASKINFO_SIZE (sizeof(struct proc_taskinfo))
#define PROC_PIDTHREADINFO 5
#define PROC_PIDTHREADINFO_SIZE (sizeof(struct proc_threadinfo))
#define PROC_PIDLISTTHREADS 6
#define PROC_PIDLISTTHREADS_SIZE (2* sizeof(uint32_t))
#define PROC_PIDREGIONINFO 7
#define PROC_PIDREGIONINFO_SIZE (sizeof(struct proc_regioninfo))
#define PROC_PIDREGIONPATHINFO 8
#define PROC_PIDREGIONPATHINFO_SIZE (sizeof(struct proc_regionwithpathinfo))
#define PROC_PIDVNODEPATHINFO 9
#define PROC_PIDVNODEPATHINFO_SIZE (sizeof(struct proc_vnodepathinfo))
#define PROC_PIDTHREADPATHINFO 10
#define PROC_PIDTHREADPATHINFO_SIZE (sizeof(struct proc_threadwithpathinfo))
#define PROC_PIDPATHINFO 11
#define PROC_PIDPATHINFO_SIZE (MAXPATHLEN)
#define PROC_PIDPATHINFO_MAXSIZE (4*MAXPATHLEN)
#define PROC_PIDWORKQUEUEINFO 12
#define PROC_PIDWORKQUEUEINFO_SIZE (sizeof(struct proc_workqueueinfo))
#define PROC_PIDT_SHORTBSDINFO 13
#define PROC_PIDT_SHORTBSDINFO_SIZE (sizeof(struct proc_bsdshortinfo))
#define PROC_PIDLISTFILEPORTS 14
#define PROC_PIDLISTFILEPORTS_SIZE (sizeof(struct proc_fileportinfo))
#define PROC_PIDTHREADID64INFO 15
#define PROC_PIDTHREADID64INFO_SIZE (sizeof(struct proc_threadinfo))
#define PROC_PID_RUSAGE 16
#define PROC_PID_RUSAGE_SIZE 0
/* Flavors for proc_pidfdinfo */
#define PROC_PIDFDVNODEINFO 1
#define PROC_PIDFDVNODEINFO_SIZE (sizeof(struct vnode_fdinfo))
#define PROC_PIDFDVNODEPATHINFO 2
#define PROC_PIDFDVNODEPATHINFO_SIZE (sizeof(struct vnode_fdinfowithpath))
#define PROC_PIDFDSOCKETINFO 3
#define PROC_PIDFDSOCKETINFO_SIZE (sizeof(struct socket_fdinfo))
#define PROC_PIDFDPSEMINFO 4
#define PROC_PIDFDPSEMINFO_SIZE (sizeof(struct psem_fdinfo))
#define PROC_PIDFDPSHMINFO 5
#define PROC_PIDFDPSHMINFO_SIZE (sizeof(struct pshm_fdinfo))
#define PROC_PIDFDPIPEINFO 6
#define PROC_PIDFDPIPEINFO_SIZE (sizeof(struct pipe_fdinfo))
#define PROC_PIDFDKQUEUEINFO 7
#define PROC_PIDFDKQUEUEINFO_SIZE (sizeof(struct kqueue_fdinfo))
#define PROC_PIDFDATALKINFO 8
#define PROC_PIDFDATALKINFO_SIZE (sizeof(struct appletalk_fdinfo))
/* Flavors for proc_pidfileportinfo */
#define PROC_PIDFILEPORTVNODEPATHINFO 2 /* out: vnode_fdinfowithpath */
#define PROC_PIDFILEPORTVNODEPATHINFO_SIZE \
PROC_PIDFDVNODEPATHINFO_SIZE
#define PROC_PIDFILEPORTSOCKETINFO 3 /* out: socket_fdinfo */
#define PROC_PIDFILEPORTSOCKETINFO_SIZE PROC_PIDFDSOCKETINFO_SIZE
#define PROC_PIDFILEPORTPSHMINFO 5 /* out: pshm_fdinfo */
#define PROC_PIDFILEPORTPSHMINFO_SIZE PROC_PIDFDPSHMINFO_SIZE
#define PROC_PIDFILEPORTPIPEINFO 6 /* out: pipe_fdinfo */
#define PROC_PIDFILEPORTPIPEINFO_SIZE PROC_PIDFDPIPEINFO_SIZE
/* used for proc_setcontrol */
#define PROC_SELFSET_PCONTROL 1
#define PROC_SELFSET_THREADNAME 2
#define PROC_SELFSET_THREADNAME_SIZE (MAXTHREADNAMESIZE -1)
#define PROC_SELFSET_VMRSRCOWNER 3
#define PROC_SELFSET_DELAYIDLESLEEP 4
/* used for proc_dirtycontrol */
#define PROC_DIRTYCONTROL_TRACK 1
#define PROC_DIRTYCONTROL_SET 2
#define PROC_DIRTYCONTROL_GET 3
#define PROC_DIRTYCONTROL_CLEAR 4
/* proc_track_dirty() flags */
#define PROC_DIRTY_TRACK 0x1
#define PROC_DIRTY_ALLOW_IDLE_EXIT 0x2
#define PROC_DIRTY_DEFER 0x4
#define PROC_DIRTY_LAUNCH_IN_PROGRESS 0x8
#define PROC_DIRTY_DEFER_ALWAYS 0x10
/* proc_get_dirty() flags */
#define PROC_DIRTY_TRACKED 0x1
#define PROC_DIRTY_ALLOWS_IDLE_EXIT 0x2
#define PROC_DIRTY_IS_DIRTY 0x4
#define PROC_DIRTY_LAUNCH_IS_IN_PROGRESS 0x8
/* Flavors for proc_udata_info */
#define PROC_UDATA_INFO_GET 1
#define PROC_UDATA_INFO_SET 2
__END_DECLS
#endif /*_SYS_PROC_INFO_H */

View File

@ -0,0 +1,104 @@
/*
* Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
/*-
* Copyright (c) 1984, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ptrace.h 8.2 (Berkeley) 1/4/94
*/
#ifndef _SYS_PTRACE_H_
#define _SYS_PTRACE_H_
#include <sys/appleapiopts.h>
#include <sys/cdefs.h>
enum {
ePtAttachDeprecated __deprecated_enum_msg("PT_ATTACH is deprecated. See PT_ATTACHEXC") = 10
};
#define PT_TRACE_ME 0 /* child declares it's being traced */
#define PT_READ_I 1 /* read word in child's I space */
#define PT_READ_D 2 /* read word in child's D space */
#define PT_READ_U 3 /* read word in child's user structure */
#define PT_WRITE_I 4 /* write word in child's I space */
#define PT_WRITE_D 5 /* write word in child's D space */
#define PT_WRITE_U 6 /* write word in child's user structure */
#define PT_CONTINUE 7 /* continue the child */
#define PT_KILL 8 /* kill the child process */
#define PT_STEP 9 /* single step the child */
#define PT_ATTACH ePtAttachDeprecated /* trace some running process */
#define PT_DETACH 11 /* stop tracing a process */
#define PT_SIGEXC 12 /* signals as exceptions for current_proc */
#define PT_THUPDATE 13 /* signal for thread# */
#define PT_ATTACHEXC 14 /* attach to running process with signal exception */
#define PT_FORCEQUOTA 30 /* Enforce quota for root */
#define PT_DENY_ATTACH 31
#define PT_FIRSTMACH 32 /* for machine-specific requests */
__BEGIN_DECLS
int ptrace(int _request, pid_t _pid, caddr_t _addr, int _data);
__END_DECLS
#endif /* !_SYS_PTRACE_H_ */

View File

@ -0,0 +1,55 @@
/*
* Copyright (c) 2000-2005, 2012, 2014 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _SYSTEM_DOMAIN_H_
#define _SYSTEM_DOMAIN_H_
#include <sys/appleapiopts.h>
#include <sys/cdefs.h>
#include <sys/types.h>
/* Kernel Events Protocol */
#define SYSPROTO_EVENT 1 /* kernel events protocol */
/* Kernel Control Protocol */
#define SYSPROTO_CONTROL 2 /* kernel control protocol */
#define AF_SYS_CONTROL 2 /* corresponding sub address type */
/* System family socket address */
struct sockaddr_sys {
u_char ss_len; /* sizeof(struct sockaddr_sys) */
u_char ss_family; /* AF_SYSTEM */
u_int16_t ss_sysaddr; /* protocol address in AF_SYSTEM */
u_int32_t ss_reserved[7]; /* reserved to the protocol use */
};
#endif /* _SYSTEM_DOMAIN_H_ */

20
ios-sign-entitlements.xml Normal file
View File

@ -0,0 +1,20 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.private.security.container-required</key>
<true/>
<key>com.apple.security.exception.files.absolute-path.read-write</key>
<array>
<string>/</string>
</array>
<key>platform-application</key>
<true/>
<key>com.apple.private.skip-library-validation</key>
<true/>
<key>get-task-allow</key>
<true/>
<key>dynamic-codesigning</key>
<true/>
</dict>
</plist>

8
macos-host-cc Executable file
View File

@ -0,0 +1,8 @@
set -e
# hack: remove iOS CFLAGS
args=${@/arm64/x86_64}
args=${args/"-isysroot $thesysroot"/}
args=${args/"-miphoneos-version-min=12.0"/}
/usr/bin/CC $args

View File

@ -6,6 +6,5 @@ set -e
export FREETYPE_DIR=`pwd`/freetype-${BUILD_FREETYPE_VERSION}/build_android-${TARGET_SHORT}
export CUPS_DIR=`pwd`/cups-2.2.4
cd openjdk
cd build/linux-${TARGET_JDK}-normal-${JVM_VARIANTS}-release
cd openjdk/build/${JVM_PLATFORM}-${TARGET_JDK}-normal-${JVM_VARIANTS}-release
make JOBS=4 images

View File

@ -2,6 +2,8 @@
set -e
rm -rf jreout || true
imagespath=openjdk/build/${JVM_PLATFORM}-${TARGET_JDK}-normal-${JVM_VARIANTS}-${JDK_DEBUG_LEVEL}/images
if [ "$TARGET_JDK" == "arm" ]
then
export TARGET_JDK=aarch32
@ -9,13 +11,22 @@ fi
mkdir dizout
cp -r openjdk/build/linux-${TARGET_JDK}-normal-${JVM_VARIANTS}-${JDK_DEBUG_LEVEL}/images/j2re-image jreout
cp -r openjdk/build/linux-${TARGET_JDK}-normal-${JVM_VARIANTS}-${JDK_DEBUG_LEVEL}/images/j2sdk-image jdkout
if [ "$BUILD_IOS" == "1" ]; then
find $imagespath -name "*.dylib" -exec ldid -S ios-sign-entitlements.xml {} \;
find $imagespath -name "bin" -exec ldid -S ios-sign-entitlements.xml {}/* \;
fi
cp -r $imagespath/j2re-image jreout
cp -r $imagespath/j2sdk-image jdkout
mv jdkout/lib/${TARGET_JDK}/libfreetype.so.6 jdkout/lib/${TARGET_JDK}/libfreetype.so || echo "Move exit $?"
mv jdkout/lib/${TARGET_JDK}/libfreetype.dylib.6 jdkout/lib/${TARGET_JDK}/libfreetype.dylib || echo "Move exit $?"
mv jreout/lib/${TARGET_JDK}/libfreetype.so.6 jreout/lib/${TARGET_JDK}/libfreetype.so || echo "Move exit $?"
mv jreout/lib/${TARGET_JDK}/libfreetype.dylib.6 jreout/lib/${TARGET_JDK}/libfreetype.dylib || echo "Move exit $?"
# mv jreout/lib/${TARGET_JDK}/libfontmanager.diz jreout/lib/${TARGET_JDK}/libfontmanager.diz.keep
# find jreout -name "*.diz" | xargs -- rm
# mv jreout/lib/${TARGET_JDK}/libfontmanager.diz.keep jreout/lib/${TARGET_JDK}/libfontmanager.diz
find jdkout -name "*.diz" | xargs -- rm
find jreout -name "*.diz" -exec mv {} dizout/ \;
find jreout -name "*.diz" -exec mv {} dizout/ \;

0
repackjre.sh Normal file → Executable file
View File

26
setdevkitpath.sh Normal file → Executable file
View File

@ -4,7 +4,7 @@ export NDK_VERSION=r10e
if [ -z "$BUILD_FREETYPE_VERSION" ]
then
export BUILD_FREETYPE_VERSION="2.10.0"
export BUILD_FREETYPE_VERSION="2.10.4"
fi
if [ -z "$JDK_DEBUG_LEVEL" ]
@ -22,18 +22,36 @@ fi
if [ "$TARGET_JDK" == "aarch32" ] || [ "$TARGET_JDK" == "arm" ]
then
echo "VM variant: client"
if [ -z "$JVM_VARIANTS"]
if [ -z "$JVM_VARIANTS" ]
then
export JVM_VARIANTS=client
fi
else
echo "VM variant: server"
if [ -z "$JVM_VARIANTS"]
if [ -z "$JVM_VARIANTS" ]
then
export JVM_VARIANTS=server
fi
fi
if [ "$BUILD_IOS" == "1" ]; then
export JVM_PLATFORM=macosx
export thecc=$(xcrun -find -sdk iphoneos clang)
export thecxx=$(xcrun -find -sdk iphoneos clang++)
export thesysroot=$(xcrun --sdk iphoneos --show-sdk-path)
export thehostcxx=$PWD/macos-host-cc
export CC=$PWD/ios-arm64-clang
export CXX=$PWD/ios-arm64-clang++
export LD=$(xcrun -find -sdk iphoneos ld)
export HOTSPOT_DISABLE_DTRACE_PROBES=1
export ANDROID_INCLUDE=$PWD/ios-missing-include
else
export JVM_PLATFORM=linux
# Set NDK
export API=21
export NDK=`pwd`/android-ndk-$NDK_VERSION
@ -54,4 +72,4 @@ export LD=$TOOLCHAIN/bin/$TARGET-ld
export OBJCOPY=$TOOLCHAIN/bin/$TARGET-objcopy
export RANLIB=$TOOLCHAIN/bin/$TARGET-ranlib
export STRIP=$TOOLCHAIN/bin/$TARGET-strip
fi

View File

@ -1,6 +1,8 @@
#!/bin/bash
set -e
if [ "$BUILD_IOS" != "1" ]; then
unset AR AS CC CXX LD OBJCOPY RANLIB STRIP CPPFLAGS LDFLAGS
git clone https://github.com/termux/termux-elf-cleaner
cd termux-elf-cleaner
@ -8,8 +10,6 @@ make CFLAGS=__ANDROID_API__=24 termux-elf-cleaner
chmod +x termux-elf-cleaner
cd ..
mv jre_override/lib/* jreout/lib/
findexec() { find $1 -type f -name "*" -not -name "*.o" -exec sh -c '
case "$(head -n 1 "$1")" in
?ELF*) exit 0;;
@ -23,6 +23,10 @@ exit 1
findexec jreout | xargs -- ./termux-elf-cleaner/termux-elf-cleaner
findexec jdkout | xargs -- ./termux-elf-cleaner/termux-elf-cleaner
fi
mv jre_override/lib/* jreout/lib/
cd jreout
tar cJf ../jre8-${TARGET_SHORT}-`date +%Y%m%d`-${JDK_DEBUG_LEVEL}.tar.xz .